X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fthemes%2Fdefault%2Ftheme.js;h=b2502024ece7414c567e04449d0acfb51a37c44c;hb=1056598c95187351dc58f4991d331e2258d038b5;hp=1e077d46d0d5517181d9e82d5c18aff134581066;hpb=055b6b0792ce7dc53d47af606b367c04b927c2ab;p=ckeditor.git diff --git a/_source/themes/default/theme.js b/_source/themes/default/theme.js index 1e077d4..b250202 100644 --- a/_source/themes/default/theme.js +++ b/_source/themes/default/theme.js @@ -1,10 +1,17 @@ /* -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 */ +/** + * @name CKEDITOR.theme + * @class + */ + CKEDITOR.themes.add( 'default', (function() { + var hiddenSkins = {}; + function checkSharedSpace( editor, spaceName ) { var container, @@ -21,8 +28,10 @@ CKEDITOR.themes.add( 'default', (function() { // Creates an HTML structure that reproduces the editor class hierarchy. var html = - '' + - '' + + '' + + '' + '' + '' + '' + @@ -40,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() { @@ -65,7 +78,7 @@ CKEDITOR.themes.add( 'default', (function() return container; } - return { + return /** @lends CKEDITOR.theme */ { build : function( editor, themePath ) { var name = editor.name, @@ -110,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( '' ) ); @@ -158,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' ); }, @@ -167,7 +197,7 @@ CKEDITOR.themes.add( 'default', (function() var baseIdNumber = CKEDITOR.tools.getNextNumber(); var element = CKEDITOR.dom.element.createFromHtml( [ - '' + 'X' + '
' + - '' + + '' + + '' + '' + - '' + - '' + + '' + + '' + + '' + + '' + + '' + '
' + '
' + '
' + @@ -222,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; + } } }; })() ); @@ -285,10 +323,6 @@ CKEDITOR.editor.prototype.getThemeSpace = function( spaceName ) */ CKEDITOR.editor.prototype.resize = function( width, height, isContentHeight, resizeInner ) { - var numberRegex = /^\d+$/; - if ( numberRegex.test( width ) ) - width += 'px'; - var container = this.container, contents = CKEDITOR.document.getById( 'cke_contents_' + this.name ), outer = resizeInner ? container.getChild( 1 ) : container; @@ -297,7 +331,8 @@ CKEDITOR.editor.prototype.resize = function( width, height, isContentHeight, res // WEBKIT BUG: Webkit requires that we put the editor off from display when we // resize it. If we don't, the browser crashes! CKEDITOR.env.webkit && outer.setStyle( 'display', 'none' ); - outer.setStyle( 'width', width ); + // Set as border box width. (#5353) + outer.setSize( 'width', width, true ); if ( CKEDITOR.env.webkit ) { outer.$.offsetWidth; @@ -322,7 +357,7 @@ CKEDITOR.editor.prototype.resize = function( width, height, isContentHeight, res */ CKEDITOR.editor.prototype.getResizable = function() { - return this.container.getChild( 1 ); + return this.container; }; /** @@ -354,6 +389,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 */