{\r
exec : function( editor )\r
{\r
- editor.container.focusNext( true );\r
+ editor.container.focusNext( true, editor.tabIndex );\r
}\r
};\r
\r
{\r
exec : function( editor )\r
{\r
- editor.container.focusPrevious( true );\r
+ editor.container.focusPrevious( true, editor.tabIndex );\r
}\r
};\r
\r
\r
init : function( editor )\r
{\r
- // Register the keystrokes.\r
- var keystrokes = editor.keystrokeHandler.keystrokes;\r
- keystrokes[ 9 /* TAB */ ] = 'tab';\r
- keystrokes[ CKEDITOR.SHIFT + 9 /* TAB */ ] = 'shiftTab';\r
-\r
- var tabSpaces = editor.config.tabSpaces,\r
+ var tabSpaces = editor.config.tabSpaces || 0,\r
tabText = '';\r
\r
while ( tabSpaces-- )\r
tabText += '\xa0';\r
\r
- // Register the "tab" and "shiftTab" commands.\r
- editor.addCommand( 'tab', CKEDITOR.tools.extend(\r
- {\r
- exec : function( editor )\r
+ if ( tabText )\r
+ {\r
+ editor.on( 'key', function( ev )\r
{\r
- // Fire the "tab" event, making it possible to\r
- // customize the TAB key behavior on specific cases.\r
- if ( !editor.fire( 'tab' ) )\r
+ if ( ev.data.keyCode == 9 ) // TAB\r
{\r
- if ( tabText.length > 0 )\r
- editor.insertHtml( tabText );\r
- else\r
- {\r
- // All browsers jump to the next field on TAB,\r
- // except Safari, so we have to do that manually\r
- // here.\r
- /// https://bugs.webkit.org/show_bug.cgi?id=20597\r
- return editor.execCommand( 'blur' );\r
- }\r
+ editor.insertHtml( tabText );\r
+ ev.cancel();\r
}\r
+ });\r
+ }\r
\r
- return true;\r
- }\r
- }, meta ) );\r
-\r
- editor.addCommand( 'shiftTab', CKEDITOR.tools.extend(\r
- {\r
- exec : function( editor )\r
+ if ( CKEDITOR.env.webkit )\r
+ {\r
+ editor.on( 'key', function( ev )\r
{\r
- // Fire the "tab" event, making it possible to\r
- // customize the TAB key behavior on specific cases.\r
- if ( !editor.fire( 'shiftTab' ) )\r
- return editor.execCommand( 'blurBack' );\r
+ var keyCode = ev.data.keyCode;\r
\r
- return true;\r
- }\r
- }, meta ) );\r
+ if ( keyCode == 9 && !tabText ) // TAB\r
+ {\r
+ ev.cancel();\r
+ editor.execCommand( 'blur' );\r
+ }\r
+\r
+ if ( keyCode == ( CKEDITOR.SHIFT + 9 ) ) // SHIFT+TAB\r
+ {\r
+ editor.execCommand( 'blurBack' );\r
+ ev.cancel();\r
+ }\r
+ });\r
+ }\r
\r
editor.addCommand( 'blur', CKEDITOR.tools.extend( blurCommand, meta ) );\r
editor.addCommand( 'blurBack', CKEDITOR.tools.extend( blurBackCommand, meta ) );\r
* var element = CKEDITOR.document.getById( 'example' );\r
* element.focusNext();\r
*/\r
-CKEDITOR.dom.element.prototype.focusNext = function( ignoreChildren )\r
+CKEDITOR.dom.element.prototype.focusNext = function( ignoreChildren, indexToUse )\r
{\r
var $ = this.$,\r
- curTabIndex = this.getTabIndex(),\r
+ curTabIndex = ( indexToUse === undefined ? this.getTabIndex() : indexToUse ),\r
passedCurrent, enteredCurrent,\r
elected, electedTabIndex,\r
element, elementTabIndex;\r
* var element = CKEDITOR.document.getById( 'example' );\r
* element.focusPrevious();\r
*/\r
-CKEDITOR.dom.element.prototype.focusPrevious = function( ignoreChildren )\r
+CKEDITOR.dom.element.prototype.focusPrevious = function( ignoreChildren, indexToUse )\r
{\r
var $ = this.$,\r
- curTabIndex = this.getTabIndex(),\r
+ curTabIndex = ( indexToUse === undefined ? this.getTabIndex() : indexToUse ),\r
passedCurrent, enteredCurrent,\r
elected,\r
electedTabIndex = 0,\r
* Intructs the editor to add a number of spaces ( ) to the text when\r
* hitting the TAB key. If set to zero, the TAB key will be used to move the\r
* cursor focus to the next element in the page, out of the editor focus.\r
+ * @name CKEDITOR.config.tabSpaces\r
* @type Number\r
* @default 0\r
* @example\r
* config.tabSpaces = 4;\r
*/\r
-CKEDITOR.config.tabSpaces = 0 ;\r