' +
- '
' +
- '
' +
- 'X' +
- '
' +
- '
' +
- '
' +
- '' +
+ '
' +
+ '' +
+ '' +
+ ' ' +
+ ' X' +
+ ' ' +
+ ' ' +
+ '' +
+ ' | ' +
+ ' ' +
+ '' +
+ '' +
+ ' ' +
+ ' ' +
' ' +
'' +
'' +
@@ -122,7 +227,8 @@ CKEDITOR.themes.add( 'default', (function()
'' +
'' +
'' +
- '',
+ ' |
' +
+ '
',
//Hide the container when loading skins, later restored by skin css.
( CKEDITOR.env.ie ? '' : '' ),
@@ -132,11 +238,27 @@ CKEDITOR.themes.add( 'default', (function()
.replace( /#/g, '_' + baseIdNumber )
.replace( /%/g, 'cke_dialog_' ) );
- var body = element.getChild( [ 0, 0 ] );
+ var body = element.getChild( [ 0, 0, 0, 0, 0 ] ),
+ title = body.getChild( 0 ),
+ close = body.getChild( 1 );
+
+ // IFrame shim for dialog that masks activeX in IE. (#7619)
+ if ( CKEDITOR.env.ie && !CKEDITOR.env.ie6Compat )
+ {
+ var isCustomDomain = CKEDITOR.env.isCustomDomain(),
+ src = 'javascript:void(function(){' + encodeURIComponent( 'document.open();' + ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) + 'document.close();' ) + '}())',
+ iframe = CKEDITOR.dom.element.createFromHtml( '
' );
+ iframe.appendTo( body.getParent() );
+ }
// Make the Title and Close Button unselectable.
- body.getChild( 0 ).unselectable();
- body.getChild( 1 ).unselectable();
+ title.unselectable();
+ close.unselectable();
return {
@@ -144,11 +266,11 @@ CKEDITOR.themes.add( 'default', (function()
parts :
{
dialog : element.getChild( 0 ),
- title : body.getChild( 0 ),
- close : body.getChild( 1 ),
+ title : title,
+ close : close,
tabs : body.getChild( 2 ),
- contents : body.getChild( 3 ),
- footer : body.getChild( 4 )
+ contents : body.getChild( [ 3, 0, 0, 0 ] ),
+ footer : body.getChild( [ 3, 0, 1, 0 ] )
}
};
},
@@ -156,45 +278,35 @@ CKEDITOR.themes.add( 'default', (function()
destroy : function( editor )
{
var container = editor.container,
- panels = editor.panels;
-
- /*
- * IE BUG: Removing the editor DOM elements while the selection is inside
- * the editing area would break IE7/8's selection system. So we need to put
- * the selection back to the parent document without scrolling the window.
- * (#3812)
- */
- if ( CKEDITOR.env.ie )
- {
- container.setStyle( 'display', 'none' );
-
- var $range = document.body.createTextRange();
- $range.moveToElementText( container.$ );
- try
- {
- // Putting the selection to a display:none element - this will certainly
- // fail. But! We've just put the selection document back to the parent
- // document without scrolling the window!
- $range.select();
- }
- catch ( e ) {}
- }
+ element = editor.element;
if ( container )
+ {
+ container.clearCustomData();
container.remove();
+ }
- for( var i = 0 ; panels && i < panels.length ; i++ )
- panels[ i ].remove();
-
- if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )
+ if ( element )
{
- editor.element.show();
+ element.clearCustomData();
+ editor.elementMode == CKEDITOR.ELEMENT_MODE_REPLACE && element.show();
delete editor.element;
}
}
};
})() );
+/**
+ * Returns the DOM element that represents a theme space. The default theme defines
+ * three spaces, namely "top", "contents" and "bottom", representing the main
+ * blocks that compose the editor interface.
+ * @param {String} spaceName The space name.
+ * @returns {CKEDITOR.dom.element} The element that represents the space.
+ * @example
+ * // Hide the bottom space in the UI.
+ * var bottom = editor.getThemeSpace( 'bottom' );
+ * bottom.setStyle( 'display', 'none' );
+ */
CKEDITOR.editor.prototype.getThemeSpace = function( spaceName )
{
var spacePrefix = 'cke_' + spaceName;
@@ -203,37 +315,93 @@ CKEDITOR.editor.prototype.getThemeSpace = function( spaceName )
return space;
};
+/**
+ * Resizes the editor interface.
+ * @param {Number|String} width The new width. It can be an pixels integer or a
+ * CSS size value.
+ * @param {Number|String} height The new height. It can be an pixels integer or
+ * a CSS size value.
+ * @param {Boolean} [isContentHeight] Indicates that the provided height is to
+ * be applied to the editor contents space, not to the entire editor
+ * interface. Defaults to false.
+ * @param {Boolean} [resizeInner] Indicates that the first inner interface
+ * element must receive the size, not the outer element. The default theme
+ * defines the interface inside a pair of span elements
+ * (<span><span>...</span></span>). By default the
+ * first span element receives the sizes. If this parameter is set to
+ * true, the second span is sized instead.
+ * @example
+ * editor.resize( 900, 300 );
+ * @example
+ * editor.resize( '100%', 450, true );
+ */
CKEDITOR.editor.prototype.resize = function( width, height, isContentHeight, resizeInner )
{
- var numberRegex = /^\d+$/;
- if ( numberRegex.test( width ) )
- width += 'px';
-
- var contents = CKEDITOR.document.getById( 'cke_contents_' + this.name );
- var outer = resizeInner ? contents.getAscendant( 'table' ).getParent()
- : contents.getAscendant( 'table' ).getParent().getParent().getParent();
-
- // Resize the width first.
- // 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 );
- if ( CKEDITOR.env.webkit )
- {
- outer.$.offsetWidth;
- outer.setStyle( 'display', '' );
- }
+ var container = this.container,
+ contents = CKEDITOR.document.getById( 'cke_contents_' + this.name ),
+ contentsFrame = CKEDITOR.env.webkit && this.document && this.document.getWindow().$.frameElement,
+ outer = resizeInner ? container.getChild( 1 ) : container;
+
+ // Set as border box width. (#5353)
+ outer.setSize( 'width', width, true );
+
+ // WebKit needs to refresh the iframe size to avoid rendering issues. (1/2) (#8348)
+ contentsFrame && ( contentsFrame.style.width = '1%' );
// Get the height delta between the outer table and the content area.
// If we're setting the content area's height, then we don't need the delta.
var delta = isContentHeight ? 0 : ( outer.$.offsetHeight || 0 ) - ( contents.$.clientHeight || 0 );
contents.setStyle( 'height', Math.max( height - delta, 0 ) + 'px' );
+ // WebKit needs to refresh the iframe size to avoid rendering issues. (2/2) (#8348)
+ contentsFrame && ( contentsFrame.style.width = '100%' );
+
// Emit a resize event.
this.fire( 'resize' );
};
-CKEDITOR.editor.prototype.getResizable = function()
+/**
+ * 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( forContents )
{
- return this.container.getChild( [ 0, 0 ] );
+ return forContents ? CKEDITOR.document.getById( 'cke_contents_' + this.name ) : this.container;
};
+
+/**
+ * Makes it possible to place some of the editor UI blocks, like the toolbar
+ * and the elements path, into any element in the page.
+ * The elements used to hold the UI blocks can be shared among several editor
+ * instances. In that case, only the blocks of the active editor instance will
+ * display.
+ * @name CKEDITOR.config.sharedSpaces
+ * @type Object
+ * @default undefined
+ * @example
+ * // Place the toolbar inside the element with ID "someElementId" and the
+ * // elements path into the element with ID "anotherId".
+ * config.sharedSpaces =
+ * {
+ * top : 'someElementId',
+ * bottom : 'anotherId'
+ * };
+ * @example
+ * // Place the toolbar inside the element with ID "someElementId". The
+ * // elements path will remain attached to the editor UI.
+ * config.sharedSpaces =
+ * {
+ * top : 'someElementId'
+ * };
+ */
+
+/**
+ * Fired after the editor instance is resized through
+ * the {@link CKEDITOR.editor.prototype.resize} method.
+ * @name CKEDITOR.editor#resize
+ * @event
+ */