Javascript CKeditor使内联编辑器只读
我正在使用ckeditor的内联编辑器创建html内容。如何使其成为只读并仅显示预览模式的内容。我尝试了以下配置,但它对我不起作用Javascript CKeditor使内联编辑器只读,javascript,ckeditor,Javascript,Ckeditor,我正在使用ckeditor的内联编辑器创建html内容。如何使其成为只读并仅显示预览模式的内容。我尝试了以下配置,但它对我不起作用 this.editorInstance.setReadOnly( true); 这是我的编辑。我只想在预览模式下显示内容,不想显示编辑器的工具栏。使用以下脚本使CKeditor为只读。在toggleReadOnly函数中传递'true'或'false'参数,使ckeditor相应地被禁用或启用 var editor; // The instanceReady
this.editorInstance.setReadOnly( true);
这是我的编辑。我只想在预览模式下显示内容,不想显示编辑器的工具栏。使用以下脚本使CKeditor为只读。在
toggleReadOnly
函数中传递'true'或'false'参数,使ckeditor相应地被禁用或启用
var editor;
// The instanceReady event is fired when an instance of CKEditor has finished
// its initialization.
CKEDITOR.on( 'instanceReady', function ( ev ) {
editor = ev.editor;
// Show this "on" button.
document.getElementById( 'readOnlyOn' ).style.display = '';
// Event fired when the readOnly property changes.
editor.on( 'readOnly', function () {
document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
} );
} );
function toggleReadOnly( isReadOnly ) {
// Change the read-only state of the editor.
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setReadOnly
editor.setReadOnly( isReadOnly );
}
请参阅工作演示:我尝试过这个,但在内联编辑器中不起作用。是的,它起作用了。但如果您使用的是基本编辑器,您可以尝试使用内联编辑器。link@GiteshPurbia检查我更新的小提琴。我用过你的手机,效果很好there@GiteshPurbia它起作用了吗?你检查过新小提琴了吗?是的,它正在工作。但我想我在和angularjs合作。所以我用ng模型绑定内容。所以我觉得我的案子不管用。我通过ng模型向ckeditor提供内容。