X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fthemes%2Fdefault%2Ftheme.js;h=f7ff8e485df66f24119950ec521d2cf2cbc32b0a;hb=f0610347140239143439a511ee2bd48cb784f470;hp=26fc3d60a1fe382c68b49e13e2d164fc158c980c;hpb=039a051ccf3901311661022a30afd60fc38130c9;p=ckeditor.git diff --git a/_source/themes/default/theme.js b/_source/themes/default/theme.js index 26fc3d6..f7ff8e4 100644 --- a/_source/themes/default/theme.js +++ b/_source/themes/default/theme.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 */ @@ -10,6 +10,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license CKEDITOR.themes.add( 'default', (function() { + var hiddenSkins = {}; + function checkSharedSpace( editor, spaceName ) { var container, @@ -26,7 +28,9 @@ CKEDITOR.themes.add( 'default', (function() { // Creates an HTML structure that reproduces the editor class hierarchy. var html = - '' + + '' + '' + '' + '' + @@ -45,6 +49,10 @@ CKEDITOR.themes.add( 'default', (function() // Get the deeper inner
. container = mainContainer.getChild( [0,0,0,0] ); + // Save a reference to the shared space container. + !editor.sharedSpaces && ( editor.sharedSpaces = {} ); + editor.sharedSpaces[ spaceName ] = container; + // When the editor gets focus, we show the space container, hiding others. editor.on( 'focus', function() { @@ -115,15 +123,20 @@ CKEDITOR.themes.add( 'default', (function() sharedTop && ( sharedTop.setHtml( topHtml ) , topHtml = '' ); sharedBottoms && ( sharedBottoms.setHtml( bottomHtml ), bottomHtml = '' ); + var hideSkin = ''; + if ( hiddenSkins[ editor.skinClass ] ) + hideSkin = ''; + else + hiddenSkins[ editor.skinClass ] = 1; + var container = CKEDITOR.dom.element.createFromHtml( [ '' , bottomHtml , '' + '' + //Hide the container when loading skins, later restored by skin css. - '' + + hideSkin + '' + '' + '' ].join( '' ) ); @@ -163,6 +176,18 @@ CKEDITOR.themes.add( 'default', (function() // Disable browser context menu for editor's chrome. container.disableContextMenu(); + // Use a class to indicate that the current selection is in different direction than the UI. + editor.on( 'contentDirChanged', function( evt ) + { + var func = ( editor.lang.dir != evt.data ? 'add' : 'remove' ) + 'Class'; + + container.getChild( 1 )[ func ]( 'cke_mixed_dir_content' ); + + // Put the mixed direction class on the respective element also for shared spaces. + var toolbarSpace = this.sharedSpaces && this.sharedSpaces[ this.config.toolbarLocation ]; + toolbarSpace && toolbarSpace.getParent().getParent()[ func ]( 'cke_mixed_dir_content' ); + }); + editor.fireOnce( 'themeLoaded' ); editor.fireOnce( 'uiReady' ); }, @@ -185,10 +210,14 @@ CKEDITOR.themes.add( 'default', (function() '' + 'X' + '
' + - '' + + '' + + '' + '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + '
' + '
' + '
' + @@ -227,24 +256,28 @@ CKEDITOR.themes.add( 'default', (function() close : close, tabs : body.getChild( 2 ), contents : body.getChild( [ 3, 0, 0, 0 ] ), - footer : body.getChild( 4 ) + footer : body.getChild( [ 3, 0, 1, 0 ] ) } }; }, destroy : function( editor ) { - var container = editor.container; - container.clearCustomData(); - editor.element.clearCustomData(); + var container = editor.container, + element = editor.element; if ( container ) + { + container.clearCustomData(); container.remove(); + } - if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) - editor.element.show(); - - delete editor.element; + if ( element ) + { + element.clearCustomData(); + editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && element.show(); + delete editor.element; + } } }; })() ); @@ -319,12 +352,13 @@ CKEDITOR.editor.prototype.resize = function( width, height, isContentHeight, res * Gets the element that can be freely used to check the editor size. This method * is mainly used by the resize plugin, which adds a UI handle that can be used * to resize the editor. + * @param {Boolean} forContents Whether to return the "contents" part of the theme instead of the container. * @returns {CKEDITOR.dom.element} The resizable element. * @example */ -CKEDITOR.editor.prototype.getResizable = function() +CKEDITOR.editor.prototype.getResizable = function( forContents ) { - return this.container.getChild( 1 ); + return forContents ? CKEDITOR.document.getById( 'cke_contents_' + this.name ) : this.container; }; /** @@ -356,6 +390,6 @@ CKEDITOR.editor.prototype.getResizable = function() /** * Fired after the editor instance is resized through * the {@link CKEDITOR.editor.prototype.resize} method. - * @name CKEDITOR#resize + * @name CKEDITOR.editor#resize * @event */