X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpanel%2Fplugin.js;h=cb0a615dcf294ec286d0fa73888ca9fa1e882796;hb=f0610347140239143439a511ee2bd48cb784f470;hp=b9e78865c8f5341b0e8420adf1555b8fa54bffb6;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/plugins/panel/plugin.js b/_source/plugins/panel/plugin.js index b9e7886..cb0a615 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-2011, 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( '
' + '' + @@ -162,18 +156,20 @@ CKEDITOR.ui.panel.prototype = // 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 +182,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; } @@ -224,7 +222,7 @@ CKEDITOR.ui.panel.prototype = block = blocks[ name ], current = this._.currentBlock, holder = this.forceIFrame ? - this.document.getById( 'cke_' + this.id + '_frame' ) + this.document.getById( this.id + '_frame' ) : this._.holder; // Disable context menu for block panel. @@ -316,7 +314,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 +380,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 +394,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 + */