X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Feditor.js;h=352c4b22826f0fcb450c948f345cd3967462bc9a;hb=4e90e78dc97789709ee7404359a5517540c27553;hp=b1247037feaa6c381d4b651d025fa6e2ca3575f5;hpb=9afde8772159bd3436f1f5b7862960307710ae5a;p=ckeditor.git diff --git a/_source/core/editor.js b/_source/core/editor.js index b124703..352c4b2 100644 --- a/_source/core/editor.js +++ b/_source/core/editor.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 */ @@ -272,7 +272,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // is not available, get the first one (default one). lang = ( CKEDITOR.tools.indexOf( pluginLangs, editor.langCode ) >= 0 ? editor.langCode : pluginLangs[ 0 ] ); - if ( !plugin.lang[ lang ] ) + if ( !plugin.langEntries || !plugin.langEntries[ lang ] ) { // Put the language file URL into the list of files to // get downloaded. @@ -280,7 +280,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license } else { - CKEDITOR.tools.extend( editor.lang, plugin.lang[ lang ] ); + CKEDITOR.tools.extend( editor.lang, plugin.langEntries[ lang ] ); lang = null; } } @@ -305,7 +305,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Uses the first loop to update the language entries also. if ( m === 0 && languageCodes[ i ] && plugin.lang ) - CKEDITOR.tools.extend( editor.lang, plugin.lang[ languageCodes[ i ] ] ); + CKEDITOR.tools.extend( editor.lang, plugin.langEntries[ languageCodes[ i ] ] ); // Call the plugin method (beforeInit and init). if ( plugin[ methods[ m ] ] ) @@ -367,7 +367,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Setup the submit function because it doesn't fire the // "submit" event. - if ( !form.$.submit.nodeName ) + if ( !form.$.submit.nodeName && !form.$.submit.length ) { form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit ) { @@ -547,44 +547,9 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, if ( !noUpdate ) this.updateElement(); - if ( this.mode ) - { - // -> currentMode.unload( holderElement ); - this._.modes[ this.mode ].unload( this.getThemeSpace( 'contents' ) ); - } - - this.theme.destroy( this ); - - var toolbars, - index = 0, - j, - items, - instance; - - if ( this.toolbox ) - { - toolbars = this.toolbox.toolbars; - for ( ; index < toolbars.length ; index++ ) - { - items = toolbars[ index ].items; - for ( j = 0 ; j < items.length ; j++ ) - { - instance = items[ j ]; - if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn ); - if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn ); - - if ( instance.index ) CKEDITOR.ui.button._.instances[ instance.index ] = null; - } - } - } - - if ( this.contextMenu ) - CKEDITOR.tools.removeFunction( this.contextMenu._.functionId ); - - if ( this._.filebrowserFn ) - CKEDITOR.tools.removeFunction( this._.filebrowserFn ); - this.fire( 'destroy' ); + this.theme && this.theme.destroy( this ); + CKEDITOR.remove( this ); CKEDITOR.fire( 'instanceDestroyed', null, this ); }, @@ -719,6 +684,7 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, * editor. * @param {Function} callback Function to be called after the setData * is completed. + *@param {Boolean} internal Whether suppress any event firing when copying data internally inside editor. * @example * CKEDITOR.instances.editor1.setData( '<p>This is the editor data.</p>' ); * @example @@ -727,7 +693,7 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, * this.checkDirty(); // true * }); */ - setData : function( data , callback ) + setData : function( data , callback, internal ) { if( callback ) { @@ -740,11 +706,11 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, // Fire "setData" so data manipulation may happen. var eventData = { dataValue : data }; - this.fire( 'setData', eventData ); + !internal && this.fire( 'setData', eventData ); this._.data = eventData.dataValue; - this.fire( 'afterSetData', eventData ); + !internal && this.fire( 'afterSetData', eventData ); }, /** @@ -892,9 +858,9 @@ CKEDITOR.on( 'loaded', function() /** * Fired when all plugins are loaded and initialized into the editor instance. - * @name CKEDITOR#pluginsLoaded + * @name CKEDITOR.editor#pluginsLoaded * @event - * @param {CKEDITOR.editor} editor The editor instance that has been destroyed. + * @param {CKEDITOR.editor} editor This editor instance. */ /** @@ -941,3 +907,79 @@ CKEDITOR.on( 'loaded', function() * if( editor.config.fullPage ) * alert( 'This is a full page editor' ); */ + +/** + * Fired when this editor instance is destroyed. The editor at this + * point isn't usable and this event should be used to perform clean up + * in any plugin. + * @name CKEDITOR.editor#destroy + * @event + */ + +/** + * Internal event to get the current data. + * @name CKEDITOR.editor#beforeGetData + * @event + */ + +/** + * Internal event to perform the #getSnapshot call. + * @name CKEDITOR.editor#getSnapshot + * @event + */ + +/** + * Internal event to perform the #loadSnapshot call. + * @name CKEDITOR.editor#loadSnapshot + * @event + */ + + +/** + * Event fired before the #getData call returns allowing additional manipulation. + * @name CKEDITOR.editor#getData + * @event + * @param {CKEDITOR.editor} editor This editor instance. + * @param {String} data.dataValue The data that will be returned. + */ + +/** + * Event fired before the #setData call is executed allowing additional manipulation. + * @name CKEDITOR.editor#setData + * @event + * @param {CKEDITOR.editor} editor This editor instance. + * @param {String} data.dataValue The data that will be used. + */ + +/** + * Event fired at the end of the #setData call is executed. Usually it's better to use the + * {@link CKEDITOR.editor.prototype.dataReady} event. + * @name CKEDITOR.editor#afterSetData + * @event + * @param {CKEDITOR.editor} editor This editor instance. + * @param {String} data.dataValue The data that has been set. + */ + +/** + * Internal event to perform the #insertHtml call + * @name CKEDITOR.editor#insertHtml + * @event + * @param {CKEDITOR.editor} editor This editor instance. + * @param {String} data The HTML to insert. + */ + +/** + * Internal event to perform the #insertText call + * @name CKEDITOR.editor#insertText + * @event + * @param {CKEDITOR.editor} editor This editor instance. + * @param {String} text The text to insert. + */ + +/** + * Internal event to perform the #insertElement call + * @name CKEDITOR.editor#insertElement + * @event + * @param {CKEDITOR.editor} editor This editor instance. + * @param {Object} element The element to insert. + */