我有一個全球性的大小和高度設置是否有一種方法可以覆蓋編輯器的每個實例的CKEditor配置文件?
CKEDITOR.editorConfig = function(config)
{
config.height = '400px';
config.width = '600px';
...
而且我想改變這種高度和寬度只有一個單獨的頁面編輯器的實例。有沒有其他人完成了這個?
我有一個全球性的大小和高度設置是否有一種方法可以覆蓋編輯器的每個實例的CKEditor配置文件?
CKEDITOR.editorConfig = function(config)
{
config.height = '400px';
config.width = '600px';
...
而且我想改變這種高度和寬度只有一個單獨的頁面編輯器的實例。有沒有其他人完成了這個?
是的。當你在頁面上創建編輯器,可以覆蓋
CKEDITOR.replace(editorName, {
height: 448,
width: 448,
customConfig: '/path/to/yourconfig.js'
});
其實作爲performance recommendation可以分別把所有的配置選項,這裏保存配置文件的加載。您可以在您自己的共享JavaScript文件中執行此操作,以便參數化以覆蓋頁面的特定值。
UPDATE迴應置評
一個單獨的配置文件可以像任何其他環境中使用(與customConfig看上面。如果你不希望任何custom configs加載使用
customConfig: ''
你可以instanceReady
事件調整編輯:
CKEDITOR.on 'instanceReady', (evt) ->
setCustomHeight(evt.editor)
setCustomHeight = (editor) ->
height = $(editor.element.$).attr('height')
return unless height
editor.resize('100%', height)
現在你必須SPECI對要定製的高度textarea的FY height屬性:
<textarea id="my-editor" height="250"></textrarea>
感謝德芙!真的很感激它! – Trip 2010-10-21 13:35:45
迴應性能建議,我試過了,但我的語法錯了,我猜? CKEDITOR.replace(editorName,config)其中config是一個名爲otherConfig.js的config.js文件。 – Trip 2010-10-21 13:40:33
@Trip我已經更新了答案,如果有幫助 – dove 2010-10-21 14:05:00