JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5.3
[ckeditor.git] / _source / plugins / editingblock / plugin.js
index 8d54142..05d78b6 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
@@ -71,7 +71,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                        if ( !isHandlingData && editor.mode )\r
                                        {\r
                                                isHandlingData = true;\r
-                                               editor.setData( getMode( editor ).getData() );\r
+                                               editor.setData( getMode( editor ).getData(), null, 1 );\r
                                                isHandlingData = false;\r
                                        }\r
                                });\r
@@ -95,6 +95,12 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                        // Do that once only.\r
                                        event.removeListener();\r
 \r
+                                       // Redirect the focus into editor for webkit. (#5713)\r
+                                       CKEDITOR.env.webkit && editor.container.on( 'focus', function()\r
+                                               {\r
+                                                       editor.focus();\r
+                                               });\r
+\r
                                        if ( editor.config.startupFocus )\r
                                                editor.focus();\r
 \r
@@ -104,8 +110,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                        setTimeout( function(){\r
                                                editor.fireOnce( 'instanceReady' );\r
                                                CKEDITOR.fire( 'instanceReady', null, editor );\r
-                                       } );\r
+                                       }, 0 );\r
                                });\r
+\r
+                       editor.on( 'destroy', function ()\r
+                       {\r
+                               // ->           currentMode.unload( holderElement );\r
+                               if ( this.mode )\r
+                                       this._.modes[ this.mode ].unload( this.getThemeSpace( 'contents' ) );\r
+                       });\r
                }\r
        });\r
 \r
@@ -140,6 +153,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
         */\r
        CKEDITOR.editor.prototype.setMode = function( mode )\r
        {\r
+               this.fire( 'beforeSetMode', { newMode : mode } );\r
+\r
                var data,\r
                        holderElement = this.getThemeSpace( 'contents' ),\r
                        isDirty = this.checkDirty();\r
@@ -182,6 +197,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
         */\r
        CKEDITOR.editor.prototype.focus = function()\r
        {\r
+               this.forceNextSelectionCheck();\r
                var mode = getMode( this );\r
                if ( mode )\r
                        mode.focus();\r
@@ -200,12 +216,12 @@ CKEDITOR.config.startupMode = 'wysiwyg';
 \r
 /**\r
  * Sets whether the editor should have the focus when the page loads.\r
+ * @name CKEDITOR.config.startupFocus\r
  * @type Boolean\r
  * @default false\r
  * @example\r
  * config.startupFocus = true;\r
  */\r
-CKEDITOR.config.startupFocus = false;\r
 \r
 /**\r
  * Whether to render or not the editing block area in the editor interface.\r
@@ -222,3 +238,23 @@ CKEDITOR.config.editingBlock = true;
  * @event\r
  * @param {CKEDITOR.editor} editor The editor instance that has been created.\r
  */\r
+\r
+/**\r
+ * Fired when the CKEDITOR instance is created, fully initialized and ready for interaction.\r
+ * @name CKEDITOR.editor#instanceReady\r
+ * @event\r
+ */\r
+\r
+/**\r
+ * Fired before changing the editing mode.\r
+ * @name CKEDITOR.editor#beforeModeUnload\r
+ * @event\r
+ */\r
+\r
+ /**\r
+ * Fired before the editor mode is set.\r
+ * @name CKEDITOR.editor#beforeSetMode\r
+ * @event\r
+ * @since 3.5.3\r
+ * @param {String} newMode The name of the mode which is about to be set.\r
+ */\r