Ticket #6522: 6522.patch

File 6522.patch, 2.9 KB (added by Alfonso Martínez de Lizarrondo, 14 years ago)

Proposed patch

  • _source/plugins/indent/plugin.js

     
    99
    1010(function()
    1111{
    12         var listNodeNames = { ol : 1, ul : 1 };
    13 
    14         var isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
     12        var listNodeNames = { ol : 1, ul : 1 },
     13                isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ),
    1514                isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true );
    1615
    17         function setState( editor, state )
    18         {
    19                 editor.getCommand( this.name ).setState( state );
    20         }
    21 
    2216        function onSelectionChange( evt )
    2317        {
    2418                var editor = evt.editor;
     
    2721                                list = elementPath && elementPath.contains( listNodeNames );
    2822
    2923                if ( list )
    30                                 return setState.call( this, editor, CKEDITOR.TRISTATE_OFF );
     24                                return this.setState( CKEDITOR.TRISTATE_OFF );
    3125
    3226                if ( !this.useIndentClasses && this.name == 'indent' )
    33                         return setState.call( this, editor, CKEDITOR.TRISTATE_OFF );
     27                        return this.setState( CKEDITOR.TRISTATE_OFF );
    3428
    3529                var path = evt.data.path,
    3630                        firstBlock = path.block || path.blockLimit;
    3731                if ( !firstBlock )
    38                         return setState.call( this, editor, CKEDITOR.TRISTATE_DISABLED );
     32                        return this.setState( CKEDITOR.TRISTATE_DISABLED );
    3933
    4034                if ( this.useIndentClasses )
    4135                {
     
    4842                        }
    4943                        if ( ( this.name == 'outdent' && !indentStep ) ||
    5044                                        ( this.name == 'indent' && indentStep == editor.config.indentClasses.length ) )
    51                                 return setState.call( this, editor, CKEDITOR.TRISTATE_DISABLED );
    52                         return setState.call( this, editor, CKEDITOR.TRISTATE_OFF );
     45                                return this.setState( CKEDITOR.TRISTATE_DISABLED );
     46                        return this.setState( CKEDITOR.TRISTATE_OFF );
    5347                }
    5448                else
    5549                {
     
    5751                        if ( isNaN( indent ) )
    5852                                indent = 0;
    5953                        if ( indent <= 0 )
    60                                 return setState.call( this, editor, CKEDITOR.TRISTATE_DISABLED );
    61                         return setState.call( this, editor, CKEDITOR.TRISTATE_OFF );
     54                                return this.setState( CKEDITOR.TRISTATE_DISABLED );
     55                        return this.setState( CKEDITOR.TRISTATE_OFF );
    6256                }
    6357        }
    6458
     
    352346                init : function( editor )
    353347                {
    354348                        // Register commands.
    355                         var indent = new indentCommand( editor, 'indent' ),
    356                                 outdent = new indentCommand( editor, 'outdent' );
    357                         editor.addCommand( 'indent', indent );
    358                         editor.addCommand( 'outdent', outdent );
     349                        var indent = editor.addCommand( 'indent', new indentCommand( editor, 'indent' ) ),
     350                                outdent = editor.addCommand( 'outdent', new indentCommand( editor, 'outdent' ) );
    359351
    360352                        // Register the toolbar buttons.
    361353                        editor.ui.addButton( 'Indent',
     
    390382                                var range = new CKEDITOR.dom.range( editor.document );
    391383                                range.setStartBefore( e.data );
    392384                                range.setEndAfter( e.data );
    393                                
     385
    394386                                var walker = new CKEDITOR.dom.walker( range ),
    395387                                        node;
    396388
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy