Ticket #4836: 4836.patch

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

     
    550550                                        styleRange.insertNode( styleNode );
    551551
    552552                                        // Let's merge our new style with its neighbors, if possible.
    553                                         mergeSiblings( styleNode );
     553                                        styleNode.mergeSiblings();
    554554
    555555                                        // As the style system breaks text nodes constantly, let's normalize
    556556                                        // things for performance.
     
    624624                                                 * no difference that they're separate entities in the DOM tree. So, merge
    625625                                                 * them before removal.
    626626                                                 */
    627                                                 mergeSiblings( element );
     627                                                element.mergeSiblings();
    628628                                                removeFromElement( this, element );
    629629
    630630                                        }
     
    10571057                        if ( firstChild )
    10581058                        {
    10591059                                // Check the cached nodes for merging.
    1060                                 mergeSiblings( firstChild );
     1060                                firstChild.mergeSiblings();
    10611061
    10621062                                if ( lastChild && !firstChild.equals( lastChild ) )
    1063                                         mergeSiblings( lastChild );
     1063                                        lastChild.mergeSiblings();
    10641064                        }
    10651065                }
    10661066        }
    10671067
    1068         function mergeSiblings( element )
    1069         {
    1070                 if ( !element || element.type != CKEDITOR.NODE_ELEMENT || !CKEDITOR.dtd.$removeEmpty[ element.getName() ] )
    1071                         return;
    1072 
    1073                 mergeElements( element, element.getNext(), true );
    1074                 mergeElements( element, element.getPrevious() );
    1075         }
    1076 
    1077         function mergeElements( element, sibling, isNext )
    1078         {
    1079                 if ( sibling && sibling.type == CKEDITOR.NODE_ELEMENT )
    1080                 {
    1081                         var hasBookmark = sibling.getAttribute( '_fck_bookmark' );
    1082 
    1083                         if ( hasBookmark )
    1084                                 sibling = isNext ? sibling.getNext() : sibling.getPrevious();
    1085 
    1086                         if ( sibling && sibling.type == CKEDITOR.NODE_ELEMENT && element.isIdentical( sibling ) )
    1087                         {
    1088                                 // Save the last child to be checked too, to merge things like
    1089                                 // <b><i></i></b><b><i></i></b> => <b><i></i></b>
    1090                                 var innerSibling = isNext ? element.getLast() : element.getFirst();
    1091 
    1092                                 if ( hasBookmark )
    1093                                         ( isNext ? sibling.getPrevious() : sibling.getNext() ).move( element, !isNext );
    1094 
    1095                                 sibling.moveChildren( element, !isNext );
    1096                                 sibling.remove();
    1097 
    1098                                 // Now check the last inner child (see two comments above).
    1099                                 if ( innerSibling )
    1100                                         mergeSiblings( innerSibling );
    1101                         }
    1102                 }
    1103         }
    1104 
    11051068        function getElement( style, targetDocument )
    11061069        {
    11071070                var el;
  • _source/plugins/scayt/plugin.js

     
    6767
    6868                        var scayt_control = new window.scayt( oParams );
    6969
     70                        scayt_control.afterMarkupRemove.push( function( node )
     71                        {
     72                                ( new CKEDITOR.dom.element( node, scayt_control.document ) ).mergeSiblings();
     73                        } );
     74
    7075                        // Copy config.
    7176                        var     lastInstance = plugin.instances[ editor.name ];
    7277                        if ( lastInstance )
     
    257262                        var protocol = document.location.protocol;
    258263                        // Default to 'http' for unknown.
    259264                        protocol = protocol.search( /https?:/) != -1? protocol : 'http:';
    260                         var baseUrl  = 'svc.spellchecker.net/spellcheck31/lf/scayt/scayt22.js';
     265                        var baseUrl  = 'svc.spellchecker.net/spellcheck31/lf/scayt24/loader__base.js';
    261266
    262267                        var scaytUrl  =  editor.config.scayt_srcUrl || ( protocol + '//' + baseUrl );
    263268                        var scaytConfigBaseUrl =  plugin.parseUrl( scaytUrl ).path +  '/';
  • _source/core/dom/node.js

     
    550550                        target.append( this.remove(), toStart );
    551551                },
    552552
     553                mergeSiblings : ( function()
     554                {
     555                        function mergeElements( element, sibling, isNext )
     556                        {
     557                                if ( sibling && sibling.type == CKEDITOR.NODE_ELEMENT )
     558                                {
     559                                        var hasBookmark = sibling.getAttribute( '_fck_bookmark' );
     560
     561                                        if ( hasBookmark )
     562                                                sibling = isNext ? sibling.getNext() : sibling.getPrevious();
     563
     564                                        if ( sibling && sibling.type == CKEDITOR.NODE_ELEMENT && element.isIdentical( sibling ) )
     565                                        {
     566                                                // Save the last child to be checked too, to merge things like
     567                                                // <b><i></i></b><b><i></i></b> => <b><i></i></b>
     568                                                var innerSibling = isNext ? element.getLast() : element.getFirst();
     569
     570                                                if ( hasBookmark )
     571                                                        ( isNext ? sibling.getPrevious() : sibling.getNext() ).move( element, !isNext );
     572
     573                                                sibling.moveChildren( element, !isNext );
     574                                                sibling.remove();
     575
     576                                                // Now check the last inner child (see two comments above).
     577                                                if ( innerSibling )
     578                                                        innerSibling.mergeSiblings();
     579                                        }
     580                                }
     581                        }
     582
     583                        return function()
     584                        {
     585                                if ( this.type != CKEDITOR.NODE_ELEMENT || !CKEDITOR.dtd.$removeEmpty[ this.getName() ] )
     586                                        return;
     587
     588                                mergeElements( this, this.getNext(), true );
     589                                mergeElements( this, this.getPrevious() );
     590                        }
     591                } )(),
     592
    553593                /**
    554594                 * Removes this node from the document DOM.
    555595                 * @param {Boolean} [preserveChildren] Indicates that the children
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy