How to set and lock the CKEditor window size?

流过昼夜 提交于 2019-12-01 07:37:34
codewaggle

Use these config settings:

Starting height and width:

config.height = '111px'; 
config.width = 111;

Is the CkEditor window resizeable:

config.resize_enabled = false; //false says not resizable

You can let it be resizable, but control the direction (vertical or horizontal) and the minimum and maximum values.

config.resize_dir = 'vertical'; //Can use (both, vertical, and horizontal)

Height:

config.resize_maxHeight = 111;
config.resize_minHeight = 111;

Width:

config.resize_maxWidth = 111;
config.resize_minWidth = 111;

The CkEditor API for config settings is here:
CKEDITOR.config API

It tells you the allowed values and formatting for each setting.

Reinmar

You can set editor's height and width at start up (only) - there are config options height and width.

See this: CKEditor & JavaScript - Adjust height and width in CKEditor

This one CKEditor 3.0 Height may be interesting to if you want to set height (and width maybe too) to a percentage.

UPDATE:

By coincidence I found today this:

/**
 * 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 )

This means that I wasn't right that editor's size can be set only at start up, however it doesn't add anything to the question as well :).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!