Ticket #6934: 6934.patch

File 6934.patch, 2.9 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/styles/plugin.js

     
    295295                buildPreview : function()
    296296                {
    297297                        var styleDefinition = this._.definition,
    298                                 html = [],
    299                                 elementName = styleDefinition.element;
     298                                html = styleDefinition.displayHtml;
    300299
    301                         // Avoid <bdo> in the preview.
    302                         if ( elementName == 'bdo' )
    303                                 elementName = 'span';
     300                        if ( !html )
     301                        {
     302                                html = [];
     303                                var elementName = styleDefinition.element;
     304
     305                                // Avoid <bdo> in the preview.
     306                                if ( elementName == 'bdo' )
     307                                        elementName = 'span';
    304308
    305                         html = [ '<', elementName ];
     309                                html = [ '<', elementName ];
    306310
    307                         // Assign all defined attributes.
    308                         var attribs     = styleDefinition.attributes;
    309                         if ( attribs )
    310                         {
    311                                 for ( var att in attribs )
    312                                 {
    313                                         html.push( ' ', att, '="', attribs[ att ], '"' );
    314                                 }
    315                         }
     311                                // Assign all defined attributes.
     312                                var attribs     = styleDefinition.attributes;
     313                                if ( attribs )
     314                                {
     315                                        for ( var att in attribs )
     316                                        {
     317                                                html.push( ' ', att, '="', attribs[ att ], '"' );
     318                                        }
     319                                }
    316320
    317                         // Assign the style attribute.
    318                         var cssStyle = CKEDITOR.style.getStyleText( styleDefinition );
    319                         if ( cssStyle )
    320                                 html.push( ' style="', cssStyle, '"' );
     321                                // Assign the style attribute.
     322                                var cssStyle = CKEDITOR.style.getStyleText( styleDefinition );
     323                                if ( cssStyle )
     324                                        html.push( ' style="', cssStyle, '"' );
    321325
    322                         html.push( '>', styleDefinition.name, '</', elementName, '>' );
     326                                html.push( '>', styleDefinition.name, '</', elementName, '>' );
    323327
    324                         return html.join( '' );
    325                 }
     328                                html = html.join( '' );
     329                        }
     330
     331                        return html;
     332                }
    326333        };
    327334
    328335        // Build the cssText based on the styles definition.
     
    367374
    368375        // Gets the parent element which blocks the styling for an element. This
    369376        // can be done through read-only elements (contenteditable=false) or
    370         // elements with the "data-cke-nostyle" attribute.
     377        // elements with the "data-nostyle" attribute.
    371378        function getUnstylableParent( element )
    372379        {
    373380                var unstylable,
     
    378385                        if ( element.getName() == 'body' )
    379386                                break;
    380387
    381                         if ( element.getAttribute( 'data-cke-nostyle' ) )
     388                        if ( element.getAttribute( 'data-nostyle' ) )
    382389                                unstylable = element;
    383390                        else if ( !editable )
    384391                        {
     
    473480                                var nodeType = currentNode.type;
    474481                                var nodeName = nodeType == CKEDITOR.NODE_ELEMENT ? currentNode.getName() : null;
    475482                                var nodeIsReadonly = nodeName && ( currentNode.getAttribute( 'contentEditable' ) == 'false' );
    476                                 var nodeIsNoStyle = nodeName && currentNode.getAttribute( 'data-cke-nostyle' );
     483                                var nodeIsNoStyle = nodeName && currentNode.getAttribute( 'data-nostyle' );
    477484
    478485                                if ( nodeName && currentNode.data( 'cke-bookmark' ) )
    479486                                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy