X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Findent%2Fplugin.js;h=c36370c1d56fa5c6126b8b540a8061cd8efaa94f;hp=c49ce882832188b5b1c876898cd5a5d9d2762a6b;hb=48b1db88210b4160dce439c6e3e32e14af8c106b;hpb=9afde8772159bd3436f1f5b7862960307710ae5a diff --git a/_source/plugins/indent/plugin.js b/_source/plugins/indent/plugin.js index c49ce88..c36370c 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,16 +9,10 @@ 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; @@ -27,15 +21,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license list = elementPath && elementPath.contains( listNodeNames ); 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 +42,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 +51,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 +209,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 +348,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',