1

我需要在内联模式下禁用编辑模式。

我尝试使用此代码

CKEDITOR.disableAutoInline = false;
                var editor = CKEDITOR.inline(elm[0], {
                    extraAllowedContent: '*',
                    toolbarStartupExpanded : false,
                    toolbarCanCollapse  : false,
                    startupFocus: false,                    
                });

                editor.on('instanceReady', function (ev) {
                    var ed = ev.editor;
                    ed.setReadOnly(true);
                    editor.removeListener();
                });
                editor.on('focus', function (event) {
                    return false;
                });
                editor.on('blur', function () {
                    return false;
                });

此代码隐藏工具栏,但菜单(鼠标右键单击)已启用,我需要完全禁用(只读模式)仅用于“渲染内容”,但我需要所有插件,包括“代码”和引用。(如果我将渲染与“removePlugin”工具栏“一起使用,我的插件代码、引用等不会使我的代码正确)有什么想法吗?

4

1 回答 1

0

只需添加:

config.readOnly = true;

参考:https ://ckeditor.com/docs/ckeditor4/latest/guide/dev_readonly.html

于 2019-04-22T12:37:39.963 回答