X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Findent%2Fplugin.js;h=7967c78b660676e917a4d3a96f299665f11c6923;hb=refs%2Ftags%2Fv3.5.4;hp=c49ce882832188b5b1c876898cd5a5d9d2762a6b;hpb=614511639979907ceb0da3614122a4d8eb963ad4;p=ckeditor.git diff --git a/_source/plugins/indent/plugin.js b/_source/plugins/indent/plugin.js index c49ce88..7967c78 100644 --- a/_source/plugins/indent/plugin.js +++ b/_source/plugins/indent/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -9,33 +9,25 @@ For licensing, see LICENSE.html or http://ckeditor.com/license (function() { - var listNodeNames = { ol : 1, ul : 1 }; - - var isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ), + var listNodeNames = { ol : 1, ul : 1 }, + isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( true ), isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true ); - function setState( editor, state ) - { - editor.getCommand( this.name ).setState( state ); - } - function onSelectionChange( evt ) { - var editor = evt.editor; - - var elementPath = evt.data.path, - list = elementPath && elementPath.contains( listNodeNames ); + var editor = evt.editor, + elementPath = evt.data.path, + list = elementPath && elementPath.contains( listNodeNames ), + firstBlock = elementPath.block || elementPath.blockLimit; if ( list ) - return setState.call( this, editor, CKEDITOR.TRISTATE_OFF ); + return this.setState( CKEDITOR.TRISTATE_OFF ); if ( !this.useIndentClasses && this.name == 'indent' ) - return setState.call( this, editor, CKEDITOR.TRISTATE_OFF ); + return this.setState( CKEDITOR.TRISTATE_OFF ); - var path = evt.data.path, - firstBlock = path.block || path.blockLimit; if ( !firstBlock ) - return setState.call( this, editor, CKEDITOR.TRISTATE_DISABLED ); + return this.setState( CKEDITOR.TRISTATE_DISABLED ); if ( this.useIndentClasses ) { @@ -48,8 +40,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } if ( ( this.name == 'outdent' && !indentStep ) || ( this.name == 'indent' && indentStep == editor.config.indentClasses.length ) ) - return setState.call( this, editor, CKEDITOR.TRISTATE_DISABLED ); - return setState.call( this, editor, CKEDITOR.TRISTATE_OFF ); + return this.setState( CKEDITOR.TRISTATE_DISABLED ); + return this.setState( CKEDITOR.TRISTATE_OFF ); } else { @@ -57,8 +49,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( isNaN( indent ) ) indent = 0; if ( indent <= 0 ) - return setState.call( this, editor, CKEDITOR.TRISTATE_DISABLED ); - return setState.call( this, editor, CKEDITOR.TRISTATE_OFF ); + return this.setState( CKEDITOR.TRISTATE_DISABLED ); + return this.setState( CKEDITOR.TRISTATE_OFF ); } } @@ -215,7 +207,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license iterator.enforceRealBlocks = true; iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR; var block; - while ( ( block = iterator.getNextParagraph() ) ) + while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) ) indentElement( block ); } @@ -354,10 +346,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license init : function( editor ) { // Register commands. - var indent = new indentCommand( editor, 'indent' ), - outdent = new indentCommand( editor, 'outdent' ); - editor.addCommand( 'indent', indent ); - editor.addCommand( 'outdent', outdent ); + var indent = editor.addCommand( 'indent', new indentCommand( editor, 'indent' ) ), + outdent = editor.addCommand( 'outdent', new indentCommand( editor, 'outdent' ) ); // Register the toolbar buttons. editor.ui.addButton( 'Indent', @@ -461,7 +451,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license * and instead the {@link #indentUnit} and {@link #indentOffset} properties will be used. * @name CKEDITOR.config.indentClasses * @type Array - * default null + * @default null * @example * // Use the classes 'Indent1', 'Indent2', 'Indent3' * config.indentClasses = ['Indent1', 'Indent2', 'Indent3'];