Disabling CKEditor, Re-enabling with JS

核能气质少年 提交于 2019-12-24 07:57:33

问题


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

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.

Is this possible? Thanks!

B


回答1:


not sure if you are still looking for an answer but here is what I did and it was much simpler than the work around they suggest.

<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>



回答2:


Check this CKEditor forum entry where the issue is discussed, and a CKEditor team member provides a workaround.




回答3:


An important update to this thread, as of 3.6 this is supported by: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly



来源:https://stackoverflow.com/questions/1943210/disabling-ckeditor-re-enabling-with-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!