X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ftoolbar%2Fplugin.js;h=029e2dc462729519b8fbcba1de45b5cb2486cd46;hb=614511639979907ceb0da3614122a4d8eb963ad4;hp=a891c157a28569fb8d16a54135d726828e357ee5;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d;p=ckeditor.git diff --git a/_source/plugins/toolbar/plugin.js b/_source/plugins/toolbar/plugin.js index a891c15..029e2dc 100644 --- a/_source/plugins/toolbar/plugin.js +++ b/_source/plugins/toolbar/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -59,13 +59,37 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { var itemKeystroke = function( item, keystroke ) { + var next, nextToolGroup, groupItemsCount; + var rtl = editor.lang.dir == 'rtl'; + switch ( keystroke ) { - case 39 : // RIGHT-ARROW + case rtl ? 37 : 39 : // RIGHT-ARROW case 9 : // TAB - // Look for the next item in the toolbar. - while ( ( item = item.next || ( item.toolbar.next && item.toolbar.next.items[ 0 ] ) ) && !item.focus ) - { /*jsl:pass*/ } + do + { + // Look for the next item in the toolbar. + next = item.next; + + if ( !next ) + { + nextToolGroup = item.toolbar.next; + groupItemsCount = nextToolGroup && nextToolGroup.items.length; + + // Bypass the empty toolgroups. + while ( groupItemsCount === 0 ) + { + nextToolGroup = nextToolGroup.next; + groupItemsCount = nextToolGroup && nextToolGroup.items.length; + } + + if ( nextToolGroup ) + next = nextToolGroup.items[ 0 ]; + } + + item = next; + } + while ( item && !item.focus ) // If available, just focus it, otherwise focus the // first one. @@ -76,11 +100,32 @@ For licensing, see LICENSE.html or http://ckeditor.com/license return false; - case 37 : // LEFT-ARROW + case rtl ? 39 : 37 : // LEFT-ARROW case CKEDITOR.SHIFT + 9 : // SHIFT + TAB - // Look for the previous item in the toolbar. - while ( ( item = item.previous || ( item.toolbar.previous && item.toolbar.previous.items[ item.toolbar.previous.items.length - 1 ] ) ) && !item.focus ) - { /*jsl:pass*/ } + do + { + // Look for the previous item in the toolbar. + next = item.previous; + + if ( !next ) + { + nextToolGroup = item.toolbar.previous; + groupItemsCount = nextToolGroup && nextToolGroup.items.length; + + // Bypass the empty toolgroups. + while ( groupItemsCount === 0 ) + { + nextToolGroup = nextToolGroup.previous; + groupItemsCount = nextToolGroup && nextToolGroup.items.length; + } + + if ( nextToolGroup ) + next = nextToolGroup.items[ groupItemsCount - 1 ]; + } + + item = next; + } + while ( item && !item.focus ) // If available, just focus it, otherwise focus the // last one. @@ -112,12 +157,17 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { editor.toolbox = new toolbox(); - var output = [ '