X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Feditor.js;h=d66aac9a223c887ebda764673b383fdda3084adf;hb=8f6c203fdaa543c3bca40baea6ae4ddcdf1a77f5;hp=a8921db7c1590bbc77606bc972c1d24b16818665;hpb=039a051ccf3901311661022a30afd60fc38130c9;p=ckeditor.git
diff --git a/_source/core/editor.js b/_source/core/editor.js
index a8921db..d66aac9 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
*/
@@ -227,6 +227,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
plugins = plugins.replace( removeRegex, '' );
}
+ // Load the Adobe AIR plugin conditionally.
+ CKEDITOR.env.air && ( plugins += ',adobeair' );
+
// Load all plugins defined in the "plugins" setting.
CKEDITOR.plugins.load( plugins.split( ',' ), function( plugins )
{
@@ -364,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 )
{
@@ -544,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 );
},
@@ -716,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
@@ -724,7 +693,7 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
* this.checkDirty(); // true
* });
*/
- setData : function( data , callback )
+ setData : function( data , callback, internal )
{
if( callback )
{
@@ -737,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 );
},
/**
@@ -756,6 +725,22 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
},
/**
+ * Insert text content into the currently selected position in the
+ * editor, in WYSIWYG mode, styles of the selected element will be applied to the inserted text,
+ * spaces around the text will be leaving untouched.
+ * Note: two subsequent line-breaks will introduce one paragraph, which element depends on {@link CKEDITOR.config.enterMode};
+ * A single line-break will be instead translated into one <br />.
+ * @since 3.5
+ * @param {String} text Text to be inserted into the editor.
+ * @example
+ * CKEDITOR.instances.editor1.insertText( ' line1 \n\n line2' );
+ */
+ insertText : function( text )
+ {
+ this.fire( 'insertText', text );
+ },
+
+ /**
* Inserts an element into the currently selected position in the
* editor.
* @param {CKEDITOR.dom.element} element The element to be inserted
@@ -873,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.
*/
/**
@@ -922,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.
+ */