Ticket #6522: 6522_3.patch

File 6522_3.patch, 5.0 KB (added by Alfonso Martínez de Lizarrondo, 15 years ago)

Updated for trunk

  • _source/plugins/indent/plugin.js

     
    1 /*
     1/*
    22Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
    33For licensing, see LICENSE.html or http://ckeditor.com/license
    44*/
     
    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
     
    354348                init : function( editor )
    355349                {
    356350                        // Register commands.
    357                         var indent = new indentCommand( editor, 'indent' ),
    358                                 outdent = new indentCommand( editor, 'outdent' );
    359                         editor.addCommand( 'indent', indent );
    360                         editor.addCommand( 'outdent', outdent );
     351                        var indent = editor.addCommand( 'indent', new indentCommand( editor, 'indent' ) ),
     352                                outdent = editor.addCommand( 'outdent', new indentCommand( editor, 'outdent' ) );
    361353
    362354                        // Register the toolbar buttons.
    363355                        editor.ui.addButton( 'Indent',
  • _source/plugins/list/plugin.js

     
    203203                }
    204204        };
    205205
    206         function setState( editor, state )
    207         {
    208                 editor.getCommand( this.name ).setState( state );
    209         }
    210 
    211206        function onSelectionChange( evt )
    212207        {
    213208                var path = evt.data.path,
    214209                        blockLimit = path.blockLimit,
    215210                        elements = path.elements,
    216                         element;
     211                        element,
     212                        i;
    217213
    218214                // Grouping should only happen under blockLimit.(#3940).
    219                 for ( var i = 0 ; i < elements.length && ( element = elements[ i ] )
     215                for ( i = 0 ; i < elements.length && ( element = elements[ i ] )
    220216                          && !element.equals( blockLimit ); i++ )
    221217                {
    222218                        if ( listNodeNames[ elements[i].getName() ] )
    223                         {
    224                                 return setState.call( this, evt.editor,
    225                                                 this.type == elements[i].getName() ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
    226                         }
     219                                return this.setState( this.type == elements[i].getName() ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
    227220                }
    228221
    229                 return setState.call( this, evt.editor, CKEDITOR.TRISTATE_OFF );
     222                return this.setState( CKEDITOR.TRISTATE_OFF );
    230223        }
    231224
    232225        function changeListType( editor, groupObj, database, listsCreated )
     
    492485                                                enclosedNode = range && range.getEnclosedNode();
    493486                                        if ( enclosedNode && enclosedNode.is
    494487                                                && this.type == enclosedNode.getName() )
    495                                                         setState.call( this, editor, CKEDITOR.TRISTATE_ON );
     488                                                        this.setState( CKEDITOR.TRISTATE_ON );
    496489                                }
    497490                        }
    498491
     
    693686                init : function( editor )
    694687                {
    695688                        // Register commands.
    696                         var numberedListCommand = new listCommand( 'numberedlist', 'ol' ),
    697                                 bulletedListCommand = new listCommand( 'bulletedlist', 'ul' );
    698                         editor.addCommand( 'numberedlist', numberedListCommand );
    699                         editor.addCommand( 'bulletedlist', bulletedListCommand );
     689                        var numberedListCommand = editor.addCommand( 'numberedlist', new listCommand( 'numberedlist', 'ol' ) ),
     690                                bulletedListCommand = editor.addCommand( 'bulletedlist', new listCommand( 'bulletedlist', 'ul' ) );
    700691
    701692                        // Register the toolbar button.
    702693                        editor.ui.addButton( 'NumberedList',
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy