Ticket #6522: 6522_3.patch
File 6522_3.patch, 5.0 KB (added by , 15 years ago) |
---|
-
_source/plugins/indent/plugin.js
1 /*1 /* 2 2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ … … 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 … … 354 348 init : function( editor ) 355 349 { 356 350 // 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' ) ); 361 353 362 354 // Register the toolbar buttons. 363 355 editor.ui.addButton( 'Indent', -
_source/plugins/list/plugin.js
203 203 } 204 204 }; 205 205 206 function setState( editor, state )207 {208 editor.getCommand( this.name ).setState( state );209 }210 211 206 function onSelectionChange( evt ) 212 207 { 213 208 var path = evt.data.path, 214 209 blockLimit = path.blockLimit, 215 210 elements = path.elements, 216 element; 211 element, 212 i; 217 213 218 214 // Grouping should only happen under blockLimit.(#3940). 219 for ( vari = 0 ; i < elements.length && ( element = elements[ i ] )215 for ( i = 0 ; i < elements.length && ( element = elements[ i ] ) 220 216 && !element.equals( blockLimit ); i++ ) 221 217 { 222 218 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 ); 227 220 } 228 221 229 return setState.call( this, evt.editor,CKEDITOR.TRISTATE_OFF );222 return this.setState( CKEDITOR.TRISTATE_OFF ); 230 223 } 231 224 232 225 function changeListType( editor, groupObj, database, listsCreated ) … … 492 485 enclosedNode = range && range.getEnclosedNode(); 493 486 if ( enclosedNode && enclosedNode.is 494 487 && this.type == enclosedNode.getName() ) 495 setState.call( this, editor,CKEDITOR.TRISTATE_ON );488 this.setState( CKEDITOR.TRISTATE_ON ); 496 489 } 497 490 } 498 491 … … 693 686 init : function( editor ) 694 687 { 695 688 // 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' ) ); 700 691 701 692 // Register the toolbar button. 702 693 editor.ui.addButton( 'NumberedList',