Ticket #7915: 7915.patch

File 7915.patch, 3.8 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/iframe/dialogs/iframe.js

     
    3535                        value = this.getValue();
    3636                if ( isRemove )
    3737                        iframeNode.removeAttribute( this.att || this.id );
     38                else if ( this.id == 'height' || this.id == 'width' )
     39                        iframeNode.setStyle( this.id, value );
    3840                else if ( isCheckbox )
    3941                        iframeNode.setAttribute( this.id, checkboxValues[ this.id ][ value ] );
    4042                else
  • _source/plugins/iframe/plugin.js

     
    88        function createFakeElement( editor, realElement )
    99        {
    1010                var fakeElement = editor.createFakeParserElement( realElement, 'cke_iframe', 'iframe', true ),
    11                         fakeStyle = fakeElement.attributes.style || '';
     11                        fakeStyle = fakeElement.attributes.style || '',
     12                        realStyle = new CKEDITOR.htmlParser.style( realElement.attributes.style ).rules;
    1213
    13                 var width = realElement.attributes.width,
    14                         height = realElement.attributes.height;
     14                var width = realStyle && realStyle.width,
     15                        height = realStyle && realStyle.height;
    1516
    1617                if ( typeof width != 'undefined' )
    1718                        fakeStyle += 'width:' + CKEDITOR.tools.cssLength( width ) + ';';
  • _source/core/htmlparser/element.js

     
    6060        };
    6161};
    6262
     63CKEDITOR.htmlParser.style = function( styleText )
     64{
     65        var rules = {};
     66
     67   // html-encoded quote might be introduced by 'font-family'
     68   // from MS-Word which confused the following regexp. e.g.
     69   //'font-family: "Lucida, Console"'
     70   ( styleText || '' )
     71           .replace( /"/g, '"' )
     72           .replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,
     73                        function( match, name, value )
     74                        {
     75                                name == 'font-family' && ( value = value.replace( /["']/g, '' ) );
     76                                rules[ name.toLowerCase() ] = value;
     77                        });
     78
     79        return {
     80                rules : rules,
     81                toString :function()
     82                {
     83                        var output = [];
     84                        for ( var i in rules )
     85                                output.push( i, ':', rules[ i], ';' );
     86                        return output.join( '' );
     87                }
     88        };
     89};
     90
    6391(function()
    6492{
    6593        // Used to sort attribute entries in an array, where the first element of
  • _source/plugins/fakeobjects/plugin.js

     
    2020                                // the real element.
    2121                                if ( realElement && element.attributes[ 'data-cke-resizable' ] )
    2222                                {
    23                                         var style = element.attributes.style;
     23                                        var style = new CKEDITOR.htmlParser.style( element.attributes.style ).rules,
     24                                                width = style.width,
     25                                                height = style.height;
    2426
    25                                         if ( style )
    26                                         {
    27                                                 // Get the width from the style.
    28                                                 var match = /(?:^|\s)width\s*:\s*(.*?)(:?;|$)/i.exec( style ),
    29                                                         width = match && match[1];
     27                                        var realStyle = new CKEDITOR.htmlParser.style( realElement.attributes.style );
    3028
    31                                                 // Get the height from the style.
    32                                                 match = /(?:^|\s)height\s*:\s*(.*?)(:?;|$)/i.exec( style );
    33                                                 var height = match && match[1];
    34 
    35                                                 if ( width )
    36                                                         realElement.attributes.width = width;
    37 
    38                                                 if ( height )
    39                                                         realElement.attributes.height = height;
    40                                         }
    41                                 }
     29                                        width && ( realStyle.rules.width = width );
     30                                        height && ( realStyle.rules.height = height );
     31                                        realElement.attributes.style = realStyle.toString();
     32                                }
    4233
    4334                                return realElement;
    4435                        }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy