2012-07-16 27 views
4

CKEditor創建一個默認大小的可調整大小的窗口。是否可以將窗口設置爲我想要的大小並防止它被調整大小?如何設置和鎖定CKEditor窗口大小?

樣式不起作用,包括textarea標籤中的顯式樣式或行屬性。

jQuery也不起作用(有它的高度功能)。

回答

12

使用這些配置設置:

開始高度和寬度:

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 - Adjust height and width in CKEditor

這一個CKEditor 3.0 Height可能是有趣的,如果你想設置的高度(寬度和也許是太)的百分比。

UPDATE:

巧合的是今天我發現這一點:

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

這意味着,我是不是正確的,編輯器的大小隻能在啓動時進行設置,但它不添加任何問題以及:)。