如何将tinymce编辑器的readonly属性设置为false?

如何将tinymce编辑器的readonly属性设置为false?,tinymce,text-editor,Tinymce,Text Editor,我在页面的文本区域有一个tinymce编辑器。我通过将READONLY属性设置为true,在只读模式下初始化它。请参阅下面的init: tinyMCE.init({ mode : "exact", elements : "p_desc", debug : false, nowrap : false, cleanup_on_startup : true, fix_nesting : true, readonly : true, for

我在页面的文本区域有一个tinymce编辑器。我通过将READONLY属性设置为true,在只读模式下初始化它。请参阅下面的init:

tinyMCE.init({
    mode : "exact",
    elements : "p_desc",
    debug : false,
    nowrap : false,
    cleanup_on_startup : true,
    fix_nesting : true,
    readonly : true,
    force_br_newlines : true,
    force_p_newlines : false,
    gecko_spellcheck : true,
    forced_root_block : '' ,
...
    setup : function(ed) {
            ed.onKeyUp.add(function(ed) {
                textCounter('p_desc','Charcount',4000);
            });}
});
现在,根据同一页面上隐藏输入字段的值,我使用tinyMCE.get('p_desc').getBody().setAttribute('contenteditable',true)启用编辑

编辑器在可编辑模式下开始工作,但安装程序中定义的onKeyUp事件仍不工作

有人请帮忙。

你可以试试

tinyMCE.init({
    readonly : true,
...
    setup : function(ed) {
            if (!ed.getParam('readonly')) ed.onKeyUp.add(function(ed) {
                textCounter('p_desc','Charcount',4000);
            });}
});

尝试在关闭只读模式的情况下初始化,然后将其置于RO模式。David,照你说的做,不起作用…Thariama,我希望无论readonly属性的值如何,此事件都能起作用。嗯,在这里可能会很难,对我来说,这看起来像个bug。你使用的是哪个版本的tinymce?