JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _source / plugins / panel / plugin.js
index ae712c0..6dc1616 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -16,7 +16,7 @@ CKEDITOR.plugins.add( 'panel',
  * @constant\r
  * @example\r
  */\r
-CKEDITOR.UI_PANEL = 2;\r
+CKEDITOR.UI_PANEL = 'panel';\r
 \r
 CKEDITOR.ui.panel = function( document, definition )\r
 {\r
@@ -137,6 +137,13 @@ CKEDITOR.ui.panel.prototype =
                                        langCode = parentDiv.getParent().getAttribute( 'lang' ),\r
                                        doc = iframe.getFrameDocument();\r
 \r
+                               // Make it scrollable on iOS. (#8308)\r
+                               CKEDITOR.env.iOS && parentDiv.setStyles(\r
+                                       {\r
+                                               'overflow' : 'scroll',\r
+                                               '-webkit-overflow-scrolling' : 'touch'\r
+                                       });\r
+\r
                                var onLoad = CKEDITOR.tools.addFunction( CKEDITOR.tools.bind( function( ev )\r
                                        {\r
                                                this.isLoaded = true;\r
@@ -149,13 +156,10 @@ CKEDITOR.ui.panel.prototype =
                                        '<html dir="' + dir + '" class="' + className + '_container" lang="' + langCode + '">' +\r
                                                '<head>' +\r
                                                        '<style>.' + className + '_container{visibility:hidden}</style>' +\r
+                                                       CKEDITOR.tools.buildStyleHtml( this.css ) +\r
                                                '</head>' +\r
                                                '<body class="cke_' + dir + ' cke_panel_frame ' + CKEDITOR.env.cssClass + '" style="margin:0;padding:0"' +\r
                                                ' onload="( window.CKEDITOR || window.parent.CKEDITOR ).tools.callFunction(' + onLoad + ');"></body>' +\r
-                                               // It looks strange, but for FF2, the styles must go\r
-                                               // after <body>, so it (body) becames immediatelly\r
-                                               // available. (#3031)\r
-                                               CKEDITOR.tools.buildStyleHtml( this.css ) +\r
                                        '<\/html>';\r
 \r
                                doc.write( data );\r
@@ -220,13 +224,12 @@ CKEDITOR.ui.panel.prototype =
        {\r
                var blocks = this._.blocks,\r
                        block = blocks[ name ],\r
-                       current = this._.currentBlock,\r
-                       holder = this.forceIFrame ?\r
-                               this.document.getById( this.id + '_frame' )\r
-                               : this._.holder;\r
+                       current = this._.currentBlock;\r
 \r
-               // Disable context menu for block panel.\r
-               holder.getParent().getParent().disableContextMenu();\r
+               // ARIA role works better in IE on the body element, while on the iframe\r
+               // for FF. (#8864)\r
+               var holder = !this.forceIFrame || CKEDITOR.env.ie ?\r
+                                this._.holder : this.document.getById( this.id + '_frame' );\r
 \r
                if ( current )\r
                {\r
@@ -245,16 +248,6 @@ CKEDITOR.ui.panel.prototype =
 \r
                this._.onKeyDown = block.onKeyDown && CKEDITOR.tools.bind( block.onKeyDown, block );\r
 \r
-               block.onMark = function( item )\r
-               {\r
-                       holder.setAttribute( 'aria-activedescendant', item.getId() + '_option' );\r
-               };\r
-\r
-               block.onUnmark = function()\r
-               {\r
-                       holder.removeAttribute( 'aria-activedescendant' );\r
-               };\r
-\r
                block.show();\r
 \r
                return block;\r
@@ -380,11 +373,12 @@ CKEDITOR.ui.panel.block = CKEDITOR.tools.createClass(
                                        return false;\r
 \r
                                case 'click' :\r
+                               case 'mouseup' :\r
                                        index = this._.focusIndex;\r
                                        link = index >= 0 && this.element.getElementsByTag( 'a' ).getItem( index );\r
 \r
                                        if ( link )\r
-                                               link.$.click ? link.$.click() : link.$.onclick();\r
+                                               link.$[ keyAction ] ? link.$[ keyAction ]() : link.$[ 'on' + keyAction ]();\r
 \r
                                        return false;\r
                        }\r