我有一个需要内联 CKEditor 但没有工具栏的应用程序。对于内联 CKEditor 部分,我有:
CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline('editable', {on: {
instanceReady: function() {periodic();}
}});
var periodic = (function() {
var data, oldData;
return function() {
if ((data = editor.getData()) !== oldData) {
oldData = data;
$.post("update.php", {txt:data});
}
setTimeout(periodic, 1000);
};
})();
Run Code Online (Sandbox Code Playgroud)
然后对于工具栏隐藏部分我发现了这个:CKEditor 4 Inline: How to hidetoolbar ondemand?
//Whenever CKEditor loses focus, We will hide the corresponding toolbar DIV.
function hideToolBarDiv(event) {
// Select the correct toolbar DIV and hide it.
//'event.editor.name' returns the name of the DIV receiving focus.
$('#'+event.editor.name+'TBdiv').hide();
}
Run Code Online (Sandbox Code Playgroud)
问题是我不知道如何将这两者结合在一起:)我很感激任何提示。谢谢。
我发现另一个链接似乎可以解决我的问题:Can I use CKEditor without atoolbar? 该脚本似乎工作正常,但我仍然不确定这是否是正确的方法:
CKEDITOR.disableAutoInline = true;
var editor = CKEDITOR.inline('editable', {
removePlugins: 'toolbar',
allowedContent: 'p h1 h2 strong em; a[!href]; img[!src,width,height]'
on: {instanceReady: function() {periodic();}}
});
var periodic = (function() {
var data, oldData;
return function() {
if ((data = editor.getData()) !== oldData) {
oldData = data;
$.post("update.php", {txt:data});
}
setTimeout(periodic, 1000);
};
})();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7363 次 |
| 最近记录: |