禁用CKEditor,用JS重新启用 [英] Disabling CKEditor, Re-enabling with JS

查看:361
本文介绍了禁用CKEditor,用JS重新启用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下:
POST页面,允许用户在CKEditor中编写文本
VIEW页面,查看CKEditor中的文本

I have the following: POST page that allows users to write text in CKEditor VIEW Page, that views the text in CKEditor

如何使CKEditor在视图页面只读,意味着用户不能编辑注释中的文本?我想在视图页面中使用CKEditor的原因有两个原因:
1.我可以使用JavaScript将编辑器从禁用移动到启用
2.保持风格与POST&查看页面。

How can I make CKEditor in the view page READ only, meaning the user can not edit the text in the note? The reason I want to use CKEditor in the view page is for 2 reasons: 1. I can use JavaScript to move the editor from disabled to enabled 2. Keep the styles the same from the POST & View page.

这是可能吗?谢谢!

B

推荐答案

<script type="text/javascript">
        window.onload = function () {

            CKEDITOR.on("instanceReady", function (ev) {
                var bodyelement = ev.editor.document.$.body;
                bodyelement.setAttribute("contenteditable", false);


            });
            CKEDITOR.replace('editor1');
        };

    </script>

这篇关于禁用CKEditor,用JS重新启用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆