CKEditor只读 [英] CKEditor ReadOnly
问题描述
由于我使用CKEditor( http://ckeditor.com/ ),因此出现了问题。问题是我找不到一种使编辑器成为ReadOnly的方法,而且我也不能只使用文本区域,因为我想保持一致性。我已经在StackOwerflow上看到过很多类似的问题,但是它们都不起作用或太旧了。
I got a problem since I use the CKEditor (http://ckeditor.com/). The problem is that I can't find a way to make the editor ReadOnly and I can't just use a textarea since I want to keep consistency. I've already seen lots og questions like this at StackOwerflow, but none of them work or are too old.
到目前为止,我的代码仅用于显示/初始化编辑器:
My code so far is only to display/initialize the editor:
$(document).ready(function(){
CKEDITOR.replace( 'ckeditor', {
on: {
// Check for availability of corresponding plugins.
pluginsLoaded: function( evt ) {
var doc = CKEDITOR.document, ed = evt.editor;
if ( !ed.getCommand( 'bold' ) )
doc.getById( 'exec-bold' ).hide();
if ( !ed.getCommand( 'link' ) )
doc.getById( 'exec-link' ).hide();
}
}
});
});
我使用最新的CKEditor版本(v.4.1.1完整软件包)
I use the newest CKEditor version(v.4.1.1 Full package)
谢谢! :)
推荐答案
在文档 readOnly ,您可以将配置设置为readOnly
In the docs readOnly you can set the config to readOnly
config.readOnly = true;
还有一个示例,其中显示了通过方法进行设置的示例
There is also an example that shows setting it via a method
editor.setReadOnly( true);
这篇关于CKEditor只读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!