X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=_source%2Fplugins%2Fpanel%2Fplugin.js;h=07c9c71c50c3af87a76d02342b2f6b3f50ab6b39;hb=a272c66d841421f8bf933c16535bdcde1c4649fc;hp=b9e78865c8f5341b0e8420adf1555b8fa54bffb6;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git
diff --git a/_source/plugins/panel/plugin.js b/_source/plugins/panel/plugin.js
index b9e7886..07c9c71 100644
--- a/_source/plugins/panel/plugin.js
+++ b/_source/plugins/panel/plugin.js
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
@@ -16,7 +16,7 @@ CKEDITOR.plugins.add( 'panel',
* @constant
* @example
*/
-CKEDITOR.UI_PANEL = 2;
+CKEDITOR.UI_PANEL = 'panel';
CKEDITOR.ui.panel = function( document, definition )
{
@@ -31,7 +31,7 @@ CKEDITOR.ui.panel = function( document, definition )
css : []
});
- this.id = CKEDITOR.tools.getNextNumber();
+ this.id = CKEDITOR.tools.getNextId();
this.document = document;
this._ =
@@ -73,7 +73,7 @@ CKEDITOR.ui.panel.prototype =
*/
render : function( editor, output )
{
- var id = 'cke_' + this.id;
+ var id = this.id;
output.push(
'
' +
'' +
'' +
+ CKEDITOR.tools.buildStyleHtml( this.css ) +
'' +
'' +
- // It looks strange, but for FF2, the styles must go
- // after , so it (body) becames immediatelly
- // available. (#3031)
- CKEDITOR.tools.buildStyleHtml( this.css ) +
- '<\/html>' );
- doc.$.close();
+ '<\/html>';
+
+ doc.write( data );
var win = doc.getWindow();
// Register the CKEDITOR global.
win.$.CKEDITOR = CKEDITOR;
- doc.on( 'keydown', function( evt )
+ // Arrow keys for scrolling is only preventable with 'keypress' event in Opera (#4534).
+ doc.on( 'key' + ( CKEDITOR.env.opera? 'press':'down' ), function( evt )
{
var keystroke = evt.data.getKeystroke(),
- dir = this.document.getById( 'cke_' + this.id ).getAttribute( 'dir' );
+ dir = this.document.getById( this.id ).getAttribute( 'dir' );
// Delegate key processing to block.
if ( this._.onKeyDown && this._.onKeyDown( keystroke ) === false )
@@ -186,15 +186,17 @@ CKEDITOR.ui.panel.prototype =
if ( keystroke == 27 || keystroke == ( dir == 'rtl' ? 39 : 37 ) )
{
if ( this.onEscape && this.onEscape( keystroke ) === false )
- evt.data.preventDefault( );
+ evt.data.preventDefault();
}
},
this );
holder = doc.getBody();
+ holder.unselectable();
+ CKEDITOR.env.air && CKEDITOR.tools.callFunction( onLoad );
}
else
- holder = this.document.getById( 'cke_' + this.id );
+ holder = this.document.getById( this.id );
this._.holder = holder;
}
@@ -222,13 +224,12 @@ CKEDITOR.ui.panel.prototype =
{
var blocks = this._.blocks,
block = blocks[ name ],
- current = this._.currentBlock,
- holder = this.forceIFrame ?
- this.document.getById( 'cke_' + this.id + '_frame' )
- : this._.holder;
+ current = this._.currentBlock;
- // Disable context menu for block panel.
- holder.getParent().getParent().disableContextMenu();
+ // ARIA role works better in IE on the body element, while on the iframe
+ // for FF. (#8864)
+ var holder = !this.forceIFrame || CKEDITOR.env.ie ?
+ this._.holder : this.document.getById( this.id + '_frame' );
if ( current )
{
@@ -247,16 +248,6 @@ CKEDITOR.ui.panel.prototype =
this._.onKeyDown = block.onKeyDown && CKEDITOR.tools.bind( block.onKeyDown, block );
- block.onMark = function( item )
- {
- holder.setAttribute( 'aria-activedescendant', item.getId() + '_option' );
- };
-
- block.onUnmark = function()
- {
- holder.removeAttribute( 'aria-activedescendant' );
- };
-
block.show();
return block;
@@ -316,7 +307,7 @@ CKEDITOR.ui.panel.block = CKEDITOR.tools.createClass(
// Safari need focus on the iframe window first(#3389), but we need
// lock the blur to avoid hiding the panel.
- if ( CKEDITOR.env.webkit )
+ if ( CKEDITOR.env.webkit || CKEDITOR.env.opera )
item.getDocument().getWindow().focus();
item.focus();
@@ -382,11 +373,12 @@ CKEDITOR.ui.panel.block = CKEDITOR.tools.createClass(
return false;
case 'click' :
+ case 'mouseup' :
index = this._.focusIndex;
link = index >= 0 && this.element.getElementsByTag( 'a' ).getItem( index );
if ( link )
- link.$.click ? link.$.click() : link.$.onclick();
+ link.$[ keyAction ] ? link.$[ keyAction ]() : link.$[ 'on' + keyAction ]();
return false;
}
@@ -395,3 +387,10 @@ CKEDITOR.ui.panel.block = CKEDITOR.tools.createClass(
}
}
});
+
+/**
+ * Fired when a panel is added to the document
+ * @name CKEDITOR#ariaWidget
+ * @event
+ * @param {Object} holder The element wrapping the panel
+ */