Ticket #6522: 6522_2.patch
File 6522_2.patch, 5.6 KB (added by , 15 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 -
_source/plugins/list/plugin.js
183 183 } 184 184 }; 185 185 186 function setState( editor, state )187 {188 editor.getCommand( this.name ).setState( state );189 }190 191 186 function onSelectionChange( evt ) 192 187 { 193 188 var path = evt.data.path, 194 189 blockLimit = path.blockLimit, 195 190 elements = path.elements, 196 element; 191 element, 192 i; 197 193 198 194 // Grouping should only happen under blockLimit.(#3940). 199 for ( vari = 0 ; i < elements.length && ( element = elements[ i ] )195 for ( i = 0 ; i < elements.length && ( element = elements[ i ] ) 200 196 && !element.equals( blockLimit ); i++ ) 201 197 { 202 198 if ( listNodeNames[ elements[i].getName() ] ) 203 { 204 return setState.call( this, evt.editor, 205 this.type == elements[i].getName() ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF ); 206 } 199 return this.setState( this.type == elements[i].getName() ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF ); 207 200 } 208 201 209 return setState.call( this, evt.editor,CKEDITOR.TRISTATE_OFF );202 return this.setState( CKEDITOR.TRISTATE_OFF ); 210 203 } 211 204 212 205 function changeListType( editor, groupObj, database, listsCreated ) … … 292 285 { 293 286 listContents.push( contentNode ); 294 287 295 // Determine the lists's direction. 288 // Determine the lists's direction. 296 289 if ( !explicitDirection && contentNode.getDirection() ) 297 290 explicitDirection = 1; 298 291 … … 340 333 contentBlock.removeStyle( 'direction' ); 341 334 contentBlock.removeAttribute( 'dir' ); 342 335 } 343 336 344 337 contentBlock.copyAttributes( listItem ); 345 338 contentBlock.moveChildren( listItem ); 346 339 contentBlock.remove(); … … 472 465 enclosedNode = range && range.getEnclosedNode(); 473 466 if ( enclosedNode && enclosedNode.is 474 467 && this.type == enclosedNode.getName() ) 475 setState.call( this, editor,CKEDITOR.TRISTATE_ON );468 this.setState( CKEDITOR.TRISTATE_ON ); 476 469 } 477 470 } 478 471 … … 673 666 init : function( editor ) 674 667 { 675 668 // Register commands. 676 var numberedListCommand = new listCommand( 'numberedlist', 'ol' ), 677 bulletedListCommand = new listCommand( 'bulletedlist', 'ul' ); 678 editor.addCommand( 'numberedlist', numberedListCommand ); 679 editor.addCommand( 'bulletedlist', bulletedListCommand ); 669 var numberedListCommand = editor.addCommand( 'numberedlist', new listCommand( 'numberedlist', 'ol' ) ), 670 bulletedListCommand = editor.addCommand( 'bulletedlist', new listCommand( 'bulletedlist', 'ul' ) ); 680 671 681 672 // Register the toolbar button. 682 673 editor.ui.addButton( 'NumberedList',