JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.3
[ckeditor.git] / _source / core / editor.js
index 5a80fe8..0b373f7 100644 (file)
@@ -122,6 +122,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                editor.skinPath = skinPath;\r
                editor.skinClass = 'cke_skin_' + skinName;\r
 \r
+               editor.tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0;\r
+\r
                // Fire the "configLoaded" event.\r
                editor.fireOnce( 'configLoaded' );\r
 \r
@@ -144,6 +146,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 && editor.lang.dir == 'rtl' )\r
                                        editor.lang.dir = 'ltr';\r
 \r
+                               var config = editor.config;\r
+                               config.contentsLangDirection == 'ui' && ( config.contentsLangDirection = editor.lang.dir );\r
+\r
                                loadPlugins( editor );\r
                        });\r
        };\r
@@ -329,7 +334,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
@@ -466,7 +471,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