JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5.1
[ckeditor.git] / _source / core / editor.js
index b124703..3f1f54d 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -367,7 +367,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
 \r
                                // Setup the submit function because it doesn't fire the\r
                                // "submit" event.\r
-                               if ( !form.$.submit.nodeName )\r
+                               if ( !form.$.submit.nodeName && !form.$.submit.length )\r
                                {\r
                                        form.$.submit = CKEDITOR.tools.override( form.$.submit, function( originalSubmit )\r
                                                {\r
@@ -547,42 +547,7 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                        if ( !noUpdate )\r
                                this.updateElement();\r
 \r
-                       if ( this.mode )\r
-                       {\r
-                               // ->           currentMode.unload( holderElement );\r
-                               this._.modes[ this.mode ].unload( this.getThemeSpace( 'contents' ) );\r
-                       }\r
-\r
-                       this.theme.destroy( this );\r
-\r
-                       var toolbars,\r
-                               index = 0,\r
-                               j,\r
-                               items,\r
-                               instance;\r
-\r
-                       if ( this.toolbox )\r
-                       {\r
-                               toolbars = this.toolbox.toolbars;\r
-                               for ( ; index < toolbars.length ; index++ )\r
-                               {\r
-                                       items = toolbars[ index ].items;\r
-                                       for ( j = 0 ; j < items.length ; j++ )\r
-                                       {\r
-                                               instance = items[ j ];\r
-                                               if ( instance.clickFn ) CKEDITOR.tools.removeFunction( instance.clickFn );\r
-                                               if ( instance.keyDownFn ) CKEDITOR.tools.removeFunction( instance.keyDownFn );\r
-\r
-                                               if ( instance.index ) CKEDITOR.ui.button._.instances[ instance.index ] = null;\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-                       if ( this.contextMenu )\r
-                               CKEDITOR.tools.removeFunction( this.contextMenu._.functionId );\r
-\r
-                       if ( this._.filebrowserFn )\r
-                               CKEDITOR.tools.removeFunction( this._.filebrowserFn );\r
+                       this.theme && this.theme.destroy( this );\r
 \r
                        this.fire( 'destroy' );\r
                        CKEDITOR.remove( this );\r
@@ -892,9 +857,9 @@ CKEDITOR.on( 'loaded', function()
 \r
 /**\r
  * Fired when all plugins are loaded and initialized into the editor instance.\r
- * @name CKEDITOR#pluginsLoaded\r
+ * @name CKEDITOR.editor#pluginsLoaded\r
  * @event\r
- * @param {CKEDITOR.editor} editor The editor instance that has been destroyed.\r
+ * @param {CKEDITOR.editor} editor This editor instance.\r
  */\r
 \r
 /**\r
@@ -941,3 +906,79 @@ CKEDITOR.on( 'loaded', function()
  * if( editor.config.fullPage )\r
  *     alert( 'This is a full page editor' );\r
  */\r
+\r
+/**\r
+ * Fired when this editor instance is destroyed. The editor at this\r
+ * point isn't usable and this event should be used to perform clean up\r
+ * in any plugin.\r
+ * @name CKEDITOR.editor#destroy\r
+ * @event\r
+ */\r
+\r
+/**\r
+ * Internal event to get the current data.\r
+ * @name CKEDITOR.editor#beforeGetData\r
+ * @event\r
+ */\r
+\r
+/**\r
+ * Internal event to perform the #getSnapshot call.\r
+ * @name CKEDITOR.editor#getSnapshot\r
+ * @event\r
+ */\r
+\r
+/**\r
+ * Internal event to perform the #loadSnapshot call.\r
+ * @name CKEDITOR.editor#loadSnapshot\r
+ * @event\r
+ */\r
+\r
+\r
+/**\r
+ * Event fired before the #getData call returns allowing additional manipulation.\r
+ * @name CKEDITOR.editor#getData\r
+ * @event\r
+ * @param {CKEDITOR.editor} editor This editor instance.\r
+ * @param {String} data.dataValue The data that will be returned.\r
+ */\r
+\r
+/**\r
+ * Event fired before the #setData call is executed allowing additional manipulation.\r
+ * @name CKEDITOR.editor#setData\r
+ * @event\r
+ * @param {CKEDITOR.editor} editor This editor instance.\r
+ * @param {String} data.dataValue The data that will be used.\r
+ */\r
+\r
+/**\r
+ * Event fired at the end of the #setData call is executed. Usually it's better to use the\r
+ * {@link CKEDITOR.editor.prototype.dataReady} event.\r
+ * @name CKEDITOR.editor#afterSetData\r
+ * @event\r
+ * @param {CKEDITOR.editor} editor This editor instance.\r
+ * @param {String} data.dataValue The data that has been set.\r
+ */\r
+\r
+/**\r
+ * Internal event to perform the #insertHtml call\r
+ * @name CKEDITOR.editor#insertHtml\r
+ * @event\r
+ * @param {CKEDITOR.editor} editor This editor instance.\r
+ * @param {String} data The HTML to insert.\r
+ */\r
+\r
+/**\r
+ * Internal event to perform the #insertText call\r
+ * @name CKEDITOR.editor#insertText\r
+ * @event\r
+ * @param {CKEDITOR.editor} editor This editor instance.\r
+ * @param {String} text The text to insert.\r
+ */\r
+\r
+/**\r
+ * Internal event to perform the #insertElement call\r
+ * @name CKEDITOR.editor#insertElement\r
+ * @event\r
+ * @param {CKEDITOR.editor} editor This editor instance.\r
+ * @param {Object} element The element to insert.\r
+ */\r