如何设置和锁定CKEditor窗口大小?

4

CKEditor创建一个可调整大小的窗口,其默认大小可能无法满足需求。是否可以设置窗口大小并禁止调整大小?

样式不起作用,包括文本区标记中的显式样式或行属性。

jQuery也不起作用(使用其高度函数)。

2个回答

13

使用以下配置设置:

起始高度和宽度:

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

CkEditor窗口是否可调整大小:


config.resize_enabled = false; //false says not resizable
你可以让它可调整大小,但控制方向(垂直或水平)和最小值和最大值。
config.resize_dir = 'vertical'; //Can use (both, vertical, and horizontal)

高度:

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

宽度:

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

在这里可以找到CkEditor的API配置设置:
CKEDITOR.config API

它会告诉你每个设置允许的值和格式。


3
您可以在启动时设置编辑器的高度和宽度 - 有配置选项heightwidth

请参见:CKEditor&JavaScript-调整CKEditor中的高度和宽度

如果您想将高度(可能还包括宽度)设置为百分比,则此CKEditor 3.0 Height 可能会非常有趣。

更新:

恰巧今天我发现了这个:

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

这意味着我之前的想法不正确,编辑器的大小不仅可以在启动时设置,但这对于问题也没有任何帮助 :).

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接