JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4.3
[ckeditor.git] / _source / plugins / toolbar / plugin.js
index 4b59f6d..029e2dc 100644 (file)
@@ -60,14 +60,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        var itemKeystroke = function( item, keystroke )\r
                        {\r
                                var next, nextToolGroup, groupItemsCount;\r
+                               var rtl = editor.lang.dir == 'rtl';\r
 \r
                                switch ( keystroke )\r
                                {\r
-                                       case 39 :                                       // RIGHT-ARROW\r
+                                       case rtl ? 37 : 39 :                                    // RIGHT-ARROW\r
                                        case 9 :                                        // TAB\r
                                                do\r
                                                {\r
-                                                       // Look for the previous item in the toolbar.\r
+                                                       // Look for the next item in the toolbar.\r
                                                        next = item.next;\r
 \r
                                                        if ( !next )\r
@@ -99,7 +100,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                                                return false;\r
 \r
-                                       case 37 :                                       // LEFT-ARROW\r
+                                       case rtl ? 39 : 37 :                                    // LEFT-ARROW\r
                                        case CKEDITOR.SHIFT + 9 :       // SHIFT + TAB\r
                                                do\r
                                                {\r
@@ -156,9 +157,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                        {\r
                                                editor.toolbox = new toolbox();\r
 \r
-                                               var labelId = 'cke_' + CKEDITOR.tools.getNextNumber();\r
+                                               var labelId = CKEDITOR.tools.getNextId();\r
 \r
-                                               var output = [ '<div class="cke_toolbox" role="toolbar" aria-labelledby="', labelId, '"' ],\r
+                                               var output = [ '<div class="cke_toolbox" role="toolbar" aria-labelledby="', labelId, '" onmousedown="return false;"' ],\r
                                                        expanded =  editor.config.toolbarStartupExpanded !== false,\r
                                                        groupStarted;\r
 \r
@@ -186,7 +187,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        if ( !row )\r
                                                                continue;\r
 \r
-                                                       var toolbarId = 'cke_' + CKEDITOR.tools.getNextNumber(),\r
+                                                       var toolbarId = CKEDITOR.tools.getNextId(),\r
                                                                toolbarObj = { id : toolbarId, items : [] };\r
 \r
                                                        if ( groupStarted )\r
@@ -282,21 +283,25 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                function()\r
                                                                {\r
                                                                        editor.execCommand( 'toolbarCollapse' );\r
-                                                               } );\r
+                                                               });\r
+\r
+                                                       editor.on( 'destroy', function () {\r
+                                                                       CKEDITOR.tools.removeFunction( collapserFn );\r
+                                                               });\r
 \r
-                                                       var collapserId = 'cke_' + CKEDITOR.tools.getNextNumber();\r
+                                                       var collapserId = CKEDITOR.tools.getNextId();\r
 \r
                                                        editor.addCommand( 'toolbarCollapse',\r
                                                                {\r
                                                                        exec : function( editor )\r
                                                                        {\r
-                                                                               var collapser = CKEDITOR.document.getById( collapserId );\r
-                                                                               var toolbox = collapser.getPrevious();\r
-                                                                               var contents = editor.getThemeSpace( 'contents' );\r
-                                                                               var toolboxContainer = toolbox.getParent();\r
-                                                                               var contentHeight = parseInt( contents.$.style.height, 10 );\r
-                                                                               var previousHeight = toolboxContainer.$.offsetHeight;\r
-                                                                               var collapsed = !toolbox.isVisible();\r
+                                                                               var collapser = CKEDITOR.document.getById( collapserId ),\r
+                                                                                       toolbox = collapser.getPrevious(),\r
+                                                                                       contents = editor.getThemeSpace( 'contents' ),\r
+                                                                                       toolboxContainer = toolbox.getParent(),\r
+                                                                                       contentHeight = parseInt( contents.$.style.height, 10 ),\r
+                                                                                       previousHeight = toolboxContainer.$.offsetHeight,\r
+                                                                                       collapsed = !toolbox.isVisible();\r
 \r
                                                                                if ( !collapsed )\r
                                                                                {\r
@@ -408,8 +413,9 @@ CKEDITOR.config.toolbar_Basic =
  *     ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],\r
  *     '/',\r
  *     ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],\r
- *     ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],\r
+ *     ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],\r
  *     ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],\r
+ *     ['BidiLtr', 'BidiRtl' ],\r
  *     ['Link','Unlink','Anchor'],\r
  *     ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],\r
  *     '/',\r
@@ -428,6 +434,7 @@ CKEDITOR.config.toolbar_Full =
        ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],\r
        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],\r
        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],\r
+       ['BidiLtr', 'BidiRtl' ],\r
        ['Link','Unlink','Anchor'],\r
        ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],\r
        '/',\r