JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.2.1
[ckeditor.git] / _source / core / editor.js
index 7168ad0..f0f3682 100644 (file)
@@ -331,7 +331,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                for ( var name in commands )\r
                {\r
                        command = commands[ name ];\r
-                       command[ command.modes[ mode ] ? 'enable' : 'disable' ]();\r
+                       command[ command.startDisabled ? 'disable' : command.modes[ mode ] ? 'enable' : 'disable' ]();\r
                }\r
        }\r
 \r
@@ -468,7 +468,43 @@ 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
+\r
                        this.fire( 'destroy' );\r
                        CKEDITOR.remove( this );\r
                        CKEDITOR.fire( 'instanceDestroyed', null, this );\r