/*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
+/**\r
+ * @name CKEDITOR.theme\r
+ * @class\r
+ */\r
+\r
CKEDITOR.themes.add( 'default', (function()\r
{\r
function checkSharedSpace( editor, spaceName )\r
{\r
// Creates an HTML structure that reproduces the editor class hierarchy.\r
var html =\r
- '<span class="cke_shared">' +\r
- '<span class="' + editor.skinClass + ' cke_editor_' + editor.name + '">' +\r
+ '<span class="cke_shared "' +\r
+ ' dir="'+ editor.lang.dir + '"' +\r
+ '>' +\r
+ '<span class="' + editor.skinClass + ' ' + editor.id + ' cke_editor_' + editor.name + '">' +\r
'<span class="' + CKEDITOR.env.cssClass + '">' +\r
'<span class="cke_wrapper cke_' + editor.lang.dir + '">' +\r
'<span class="cke_editor">' +\r
// Get the deeper inner <div>.\r
container = mainContainer.getChild( [0,0,0,0] );\r
\r
+ // Save a reference to the shared space container.\r
+ !editor.sharedSpaces && ( editor.sharedSpaces = {} );\r
+ editor.sharedSpaces[ spaceName ] = container;\r
+\r
// When the editor gets focus, we show the space container, hiding others.\r
editor.on( 'focus', function()\r
{\r
return container;\r
}\r
\r
- return {\r
+ return /** @lends CKEDITOR.theme */ {\r
build : function( editor, themePath )\r
{\r
var name = editor.name,\r
var container = CKEDITOR.dom.element.createFromHtml( [\r
'<span' +\r
' id="cke_', name, '"' +\r
- ' onmousedown="return false;"' +\r
- ' class="', editor.skinClass, ' cke_editor_', name, '"' +\r
+ ' class="', editor.skinClass, ' ', editor.id, ' cke_editor_', name, '"' +\r
' dir="', editor.lang.dir, '"' +\r
' title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '"' +\r
' lang="', editor.langCode, '"' +\r
+ ( CKEDITOR.env.webkit? ' tabindex="' + tabIndex + '"' : '' ) +\r
' role="application"' +\r
' aria-labelledby="cke_', name, '_arialbl"' +\r
( style ? ' style="' + style + '"' : '' ) +\r
var baseIdNumber = CKEDITOR.tools.getNextNumber();\r
\r
var element = CKEDITOR.dom.element.createFromHtml( [\r
- '<div class="cke_editor_' + editor.name.replace('.', '\\.') + '_dialog cke_skin_', editor.skinName,\r
+ '<div class="', editor.id, '_dialog cke_editor_', editor.name.replace('.', '\\.'), '_dialog cke_skin_', editor.skinName,\r
'" dir="', editor.lang.dir, '"' +\r
' lang="', editor.langCode, '"' +\r
' role="dialog"' +\r
'<div id="%title#" class="%title" role="presentation"></div>' +\r
'<a id="%close_button#" class="%close_button" href="javascript:void(0)" title="' + editor.lang.common.close+'" role="button"><span class="cke_label">X</span></a>' +\r
'<div id="%tabs#" class="%tabs" role="tablist"></div>' +\r
- '<table class="%contents" role="presentation"><tr>' +\r
+ '<table class="%contents" role="presentation">' +\r
+ '<tr>' +\r
'<td id="%contents#" class="%contents" role="presentation"></td>' +\r
- '</tr></table>' +\r
- '<div id="%footer#" class="%footer" role="presentation"></div>' +\r
+ '</tr>' +\r
+ '<tr>' +\r
+ '<td id="%footer#" class="%footer" role="presentation"></td>' +\r
+ '</tr>' +\r
+ '</table>' +\r
'</div>' +\r
'<div id="%tl#" class="%tl"></div>' +\r
'<div id="%tc#" class="%tc"></div>' +\r
close : close,\r
tabs : body.getChild( 2 ),\r
contents : body.getChild( [ 3, 0, 0, 0 ] ),\r
- footer : body.getChild( 4 )\r
+ footer : body.getChild( [ 3, 0, 1, 0 ] )\r
}\r
};\r
},\r
\r
destroy : function( editor )\r
{\r
- var container = editor.container;\r
- container.clearCustomData();\r
- editor.element.clearCustomData();\r
-\r
- /*\r
- * IE BUG: Removing the editor DOM elements while the selection is inside\r
- * the editing area would break IE7/8's selection system. So we need to put\r
- * the selection back to the parent document without scrolling the window.\r
- * (#3812)\r
- */\r
- if ( CKEDITOR.env.ie )\r
- {\r
- container.setStyle( 'display', 'none' );\r
-\r
- var $range = document.body.createTextRange();\r
- $range.moveToElementText( container.$ );\r
- try\r
- {\r
- // Putting the selection to a display:none element - this will certainly\r
- // fail. But! We've just put the selection document back to the parent\r
- // document without scrolling the window!\r
- $range.select();\r
- }\r
- catch ( e ) {}\r
- }\r
+ var container = editor.container,\r
+ element = editor.element;\r
\r
if ( container )\r
+ {\r
+ container.clearCustomData();\r
container.remove();\r
+ }\r
\r
- if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )\r
- editor.element.show();\r
-\r
- delete editor.element;\r
+ if ( element )\r
+ {\r
+ element.clearCustomData();\r
+ editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && element.show();\r
+ delete editor.element;\r
+ }\r
}\r
};\r
})() );\r
\r
+/**\r
+ * Returns the DOM element that represents a theme space. The default theme defines\r
+ * three spaces, namely "top", "contents" and "bottom", representing the main\r
+ * blocks that compose the editor interface.\r
+ * @param {String} spaceName The space name.\r
+ * @returns {CKEDITOR.dom.element} The element that represents the space.\r
+ * @example\r
+ * // Hide the bottom space in the UI.\r
+ * var bottom = editor.getThemeSpace( 'bottom' );\r
+ * bottom.setStyle( 'display', 'none' );\r
+ */\r
CKEDITOR.editor.prototype.getThemeSpace = function( spaceName )\r
{\r
var spacePrefix = 'cke_' + spaceName;\r
return space;\r
};\r
\r
+/**\r
+ * Resizes the editor interface.\r
+ * @param {Number|String} width The new width. It can be an pixels integer or a\r
+ * CSS size value.\r
+ * @param {Number|String} height The new height. It can be an pixels integer or\r
+ * a CSS size value.\r
+ * @param {Boolean} [isContentHeight] Indicates that the provided height is to\r
+ * be applied to the editor contents space, not to the entire editor\r
+ * interface. Defaults to false.\r
+ * @param {Boolean} [resizeInner] Indicates that the first inner interface\r
+ * element must receive the size, not the outer element. The default theme\r
+ * defines the interface inside a pair of span elements\r
+ * (<span><span>...</span></span>). By default the\r
+ * first span element receives the sizes. If this parameter is set to\r
+ * true, the second span is sized instead.\r
+ * @example\r
+ * editor.resize( 900, 300 );\r
+ * @example\r
+ * editor.resize( '100%', 450, true );\r
+ */\r
CKEDITOR.editor.prototype.resize = function( width, height, isContentHeight, resizeInner )\r
{\r
- var numberRegex = /^\d+$/;\r
- if ( numberRegex.test( width ) )\r
- width += 'px';\r
-\r
var container = this.container,\r
contents = CKEDITOR.document.getById( 'cke_contents_' + this.name ),\r
outer = resizeInner ? container.getChild( 1 ) : container;\r
// WEBKIT BUG: Webkit requires that we put the editor off from display when we\r
// resize it. If we don't, the browser crashes!\r
CKEDITOR.env.webkit && outer.setStyle( 'display', 'none' );\r
- outer.setStyle( 'width', width );\r
+ // Set as border box width. (#5353)\r
+ outer.setSize( 'width', width, true );\r
if ( CKEDITOR.env.webkit )\r
{\r
outer.$.offsetWidth;\r
this.fire( 'resize' );\r
};\r
\r
+/**\r
+ * Gets the element that can be freely used to check the editor size. This method\r
+ * is mainly used by the resize plugin, which adds a UI handle that can be used\r
+ * to resize the editor.\r
+ * @returns {CKEDITOR.dom.element} The resizable element.\r
+ * @example\r
+ */\r
CKEDITOR.editor.prototype.getResizable = function()\r
{\r
- return this.container.getChild( 1 );\r
+ return this.container;\r
};\r
\r
/**\r
* top : 'someElementId'\r
* };\r
*/\r
+\r
+/**\r
+ * Fired after the editor instance is resized through\r
+ * the {@link CKEDITOR.editor.prototype.resize} method.\r
+ * @name CKEDITOR.editor#resize\r
+ * @event\r
+ */\r