X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fthemes%2Fdefault%2Ftheme.js;h=00219fff35d1c82ca2e3d09e94a2f73bd4d03982;hb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7;hp=b9150b478ff8e7c41b72ae0adc7d8ebe541b8db4;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/themes/default/theme.js b/_source/themes/default/theme.js index b9150b4..00219ff 100644 --- a/_source/themes/default/theme.js +++ b/_source/themes/default/theme.js @@ -118,6 +118,7 @@ CKEDITOR.themes.add( 'default', (function() ' dir="', editor.lang.dir, '"' + ' title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '"' + ' lang="', editor.langCode, '"' + + ( CKEDITOR.env.webkit? ' tabindex="' + tabIndex + '"' : '' ) + ' role="application"' + ' aria-labelledby="cke_', name, '_arialbl"' + ( style ? ' style="' + style + '"' : '' ) + @@ -126,9 +127,9 @@ CKEDITOR.themes.add( 'default', (function() '' + '' + '' + - '' + - '' + - '' + + '' + + '' + + '' + '' + //Hide the container when loading skins, later restored by skin css. '' + @@ -232,28 +233,6 @@ CKEDITOR.themes.add( 'default', (function() container.clearCustomData(); editor.element.clearCustomData(); - /* - * 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 ) {} - } - if ( container ) container.remove(); @@ -265,6 +244,17 @@ CKEDITOR.themes.add( 'default', (function() }; })() ); +/** + * 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; @@ -273,12 +263,28 @@ 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 container = this.container, contents = CKEDITOR.document.getById( 'cke_contents_' + this.name ), outer = resizeInner ? container.getChild( 1 ) : container; @@ -287,7 +293,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; @@ -303,6 +310,13 @@ CKEDITOR.editor.prototype.resize = function( width, height, isContentHeight, res this.fire( 'resize' ); }; +/** + * 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. + * @returns {CKEDITOR.dom.element} The resizable element. + * @example + */ CKEDITOR.editor.prototype.getResizable = function() { return this.container.getChild( 1 ); @@ -333,3 +347,10 @@ CKEDITOR.editor.prototype.getResizable = function() * top : 'someElementId' * }; */ + +/** + * Fired after the editor instance is resized through + * the {@link CKEDITOR.editor.prototype.resize} method. + * @name CKEDITOR#resize + * @event + */