X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fthemes%2Fdefault%2Ftheme.js;h=9eb488daa01216e9ccb19f3c5e2eca45f9639b1d;hb=a272c66d841421f8bf933c16535bdcde1c4649fc;hp=96ff928b48067e0fe83d71e2aae8bc6a64233679;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git diff --git a/_source/themes/default/theme.js b/_source/themes/default/theme.js index 96ff928..9eb488d 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-2013, 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,32 +123,40 @@ 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( [ '' + - '' + - '' + - '' + - '' + - '' + - '' + + '' + editor.lang.editor + '' + + '' + + '' + + '
' , topHtml , '
', contentsHtml, '
' , bottomHtml , '
' + + '' + + '' + + '' + '' + //Hide the container when loading skins, later restored by skin css. - '' + + hideSkin + '
' + '
' + '' ].join( '' ) ); - container.getChild( [0, 0, 0, 0, 0] ).unselectable(); - container.getChild( [0, 0, 0, 0, 2] ).unselectable(); + container.getChild( [1, 0, 0, 0, 0] ).unselectable(); + container.getChild( [1, 0, 0, 0, 2] ).unselectable(); if ( elementMode == CKEDITOR.ELEMENT_MODE_REPLACE ) container.insertAfter( element ); @@ -155,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' ); }, @@ -164,23 +197,27 @@ CKEDITOR.themes.add( 'default', (function() var baseIdNumber = CKEDITOR.tools.getNextNumber(); var element = CKEDITOR.dom.element.createFromHtml( [ - '