Ticket #6522: 6522.patch
File 6522.patch, 2.9 KB (added by , 14 years ago) |
---|
-
_source/plugins/indent/plugin.js
9 9 10 10 (function() 11 11 { 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 ), 15 14 isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ); 16 15 17 function setState( editor, state )18 {19 editor.getCommand( this.name ).setState( state );20 }21 22 16 function onSelectionChange( evt ) 23 17 { 24 18 var editor = evt.editor; … … 27 21 list = elementPath && elementPath.contains( listNodeNames ); 28 22 29 23 if ( list ) 30 return setState.call( this, editor,CKEDITOR.TRISTATE_OFF );24 return this.setState( CKEDITOR.TRISTATE_OFF ); 31 25 32 26 if ( !this.useIndentClasses && this.name == 'indent' ) 33 return setState.call( this, editor,CKEDITOR.TRISTATE_OFF );27 return this.setState( CKEDITOR.TRISTATE_OFF ); 34 28 35 29 var path = evt.data.path, 36 30 firstBlock = path.block || path.blockLimit; 37 31 if ( !firstBlock ) 38 return setState.call( this, editor,CKEDITOR.TRISTATE_DISABLED );32 return this.setState( CKEDITOR.TRISTATE_DISABLED ); 39 33 40 34 if ( this.useIndentClasses ) 41 35 { … … 48 42 } 49 43 if ( ( this.name == 'outdent' && !indentStep ) || 50 44 ( 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 ); 53 47 } 54 48 else 55 49 { … … 57 51 if ( isNaN( indent ) ) 58 52 indent = 0; 59 53 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 ); 62 56 } 63 57 } 64 58 … … 352 346 init : function( editor ) 353 347 { 354 348 // 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' ) ); 359 351 360 352 // Register the toolbar buttons. 361 353 editor.ui.addButton( 'Indent', … … 390 382 var range = new CKEDITOR.dom.range( editor.document ); 391 383 range.setStartBefore( e.data ); 392 384 range.setEndAfter( e.data ); 393 385 394 386 var walker = new CKEDITOR.dom.walker( range ), 395 387 node; 396 388