Ticket #6107: 6107_2.patch

File 6107_2.patch, 2.6 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/plugins/styles/plugin.js

     
    149149                        return ( this.removeFromRange =
    150150                                                this.type == CKEDITOR.STYLE_INLINE ?
    151151                                                        removeInlineStyle
     152                                                : this.type == CKEDITOR.STYLE_BLOCK ?
     153                                                        removeBlockStyle
    152154                                                : this.type == CKEDITOR.STYLE_OBJECT ?
    153155                                                        removeObjectStyle
    154156                                                : null ).call( this, range );
     
    881883                range.moveToBookmark( bookmark );
    882884        }
    883885
     886        function removeBlockStyle( range )
     887        {
     888                // Serializible bookmarks is needed here since
     889                // elements may be merged.
     890                var bookmark = range.createBookmark( 1 );
     891
     892                var iterator = range.createIterator();
     893                iterator.enforceRealBlocks = true;
     894
     895                iterator.enlargeBr = this._.enterMode != CKEDITOR.ENTER_BR;
     896
     897                var block;
     898                var doc = range.document;
     899
     900                while ( ( block = iterator.getNextParagraph() ) )
     901                {
     902                        if ( !this.checkElementRemovable( block ) )
     903                                continue;
     904
     905                        if ( this._.enterMode == CKEDITOR.ENTER_BR ) 
     906                                block.remove( 1 ); 
     907                        else 
     908                                replaceBlock( block, new CKEDITOR.dom.element( this._.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' ) );
     909                }
     910
     911                range.moveToBookmark( bookmark );
     912        }
     913
    884914        // Replace the original block with new one, with special treatment
    885915        // for <pre> blocks to make sure content format is well preserved, and merging/splitting adjacent
    886916        // when necessary.(#3188)
     
    14331463
    14341464                var iterator = ranges.createIterator();
    14351465                while ( ( range = iterator.getNextRange() ) )
    1436                 {
    14371466                        func.call( this, range );
    1438                 }
    14391467
    14401468                selection.selectRanges( ranges );
    14411469
  • _source/plugins/stylescombo/plugin.js

     
    105105                                                        selection = editor.getSelection();
    106106
    107107                                                var elementPath = new CKEDITOR.dom.elementPath( selection.getStartElement() );
     108
     109                                                style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document );
    108110
    109                                                 if ( style.type == CKEDITOR.STYLE_INLINE && style.checkActive( elementPath ) )
    110                                                         style.remove( editor.document );
    111                                                 else if ( style.type == CKEDITOR.STYLE_OBJECT && style.checkActive( elementPath ) )
    112                                                         style.remove( editor.document );
    113                                                 else
    114                                                         style.apply( editor.document );
    115 
    116111                                                editor.fire( 'saveSnapshot' );
    117112                                        },
    118113
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy