X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Feditingblock%2Fplugin.js;h=05d78b6a35f0ca50d213e6f79d9f59db7b6cb605;hb=4e90e78dc97789709ee7404359a5517540c27553;hp=4d0885bd3c490b59b51f2f07a75e6a8c5b5f83ca;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/editingblock/plugin.js b/_source/plugins/editingblock/plugin.js index 4d0885b..05d78b6 100644 --- a/_source/plugins/editingblock/plugin.js +++ b/_source/plugins/editingblock/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, 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 */ @@ -71,7 +71,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license if ( !isHandlingData && editor.mode ) { isHandlingData = true; - editor.setData( getMode( editor ).getData() ); + editor.setData( getMode( editor ).getData(), null, 1 ); isHandlingData = false; } }); @@ -95,21 +95,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Do that once only. event.removeListener(); - // Grab editor focus if the editor container is focused. (#3104) - var focusGrabber = editor.container; - - // Safari 3 can't handle tabindex in all elements, so we do - // a trick to make it move the focus to the editor on TAB. - if ( CKEDITOR.env.webkit && CKEDITOR.env.version < 528 ) - { - var tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0; - focusGrabber = focusGrabber.append( CKEDITOR.dom.element.createFromHtml( - '' ) ); - } - - focusGrabber.on( 'focus', function() + // Redirect the focus into editor for webkit. (#5713) + CKEDITOR.env.webkit && editor.container.on( 'focus', function() { editor.focus(); }); @@ -123,8 +110,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license setTimeout( function(){ editor.fireOnce( 'instanceReady' ); CKEDITOR.fire( 'instanceReady', null, editor ); - } ); + }, 0 ); }); + + editor.on( 'destroy', function () + { + // -> currentMode.unload( holderElement ); + if ( this.mode ) + this._.modes[ this.mode ].unload( this.getThemeSpace( 'contents' ) ); + }); } }); @@ -159,6 +153,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editor.prototype.setMode = function( mode ) { + this.fire( 'beforeSetMode', { newMode : mode } ); + var data, holderElement = this.getThemeSpace( 'contents' ), isDirty = this.checkDirty(); @@ -201,6 +197,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.editor.prototype.focus = function() { + this.forceNextSelectionCheck(); var mode = getMode( this ); if ( mode ) mode.focus(); @@ -219,12 +216,12 @@ CKEDITOR.config.startupMode = 'wysiwyg'; /** * Sets whether the editor should have the focus when the page loads. + * @name CKEDITOR.config.startupFocus * @type Boolean * @default false * @example * config.startupFocus = true; */ -CKEDITOR.config.startupFocus = false; /** * Whether to render or not the editing block area in the editor interface. @@ -234,3 +231,30 @@ CKEDITOR.config.startupFocus = false; * config.editingBlock = false; */ CKEDITOR.config.editingBlock = true; + +/** + * Fired when a CKEDITOR instance is created, fully initialized and ready for interaction. + * @name CKEDITOR#instanceReady + * @event + * @param {CKEDITOR.editor} editor The editor instance that has been created. + */ + +/** + * Fired when the CKEDITOR instance is created, fully initialized and ready for interaction. + * @name CKEDITOR.editor#instanceReady + * @event + */ + +/** + * Fired before changing the editing mode. + * @name CKEDITOR.editor#beforeModeUnload + * @event + */ + + /** + * Fired before the editor mode is set. + * @name CKEDITOR.editor#beforeSetMode + * @event + * @since 3.5.3 + * @param {String} newMode The name of the mode which is about to be set. + */