如何设置nicedit uneditable

时间:2010-11-26 03:58:53

标签: javascript nicedit

我正在使用nicedit js,这是我文本区域中的WYSIWYG编辑器来查看html文档,但它仍然可编辑,如何将此nicedit设置为只读模式,我尝试从其文档中搜索但无法找到它,任何人都有使用nicedit的经验,

提前致谢

6 个答案:

答案 0 :(得分:7)

这是一个有用的jQuery解决方案,我和nicEdit一起使用:

jQuery('.nicEdit-main').attr('contenteditable','false');
jQuery('.nicEdit-panel').hide();

您只需将其更改回“true”即可再次进行编辑。

注意:我会考虑将div background-color与此解决方案一起切换。

答案 1 :(得分:3)

最后解决方案是

var myNicEditor = new nicEditor(); myNicEditor.addInstance( 'templateContent'); nicEditors.findEditor( “templateContent”)禁用();

答案 2 :(得分:1)

随着声明 nicEditors.findEditor("TextArea").disable(); niceditor不可编辑 但是

nicEditors.findEditor("TextArea").attr("contentEditable","true");

不会再次编辑

答案 3 :(得分:0)

我猜它是一个WYSIWYG编辑器。

试试这个......

document.getElementById('nicedit').removeAttribute('contentEditable');

答案 4 :(得分:0)

function edit(){

a = new nicEditor({fullPanel:true})。panelInstance(' area5',{hasPanel:true}); }

function no_edit(){

a.removeInstance('区域5&#39);
}

答案 5 :(得分:0)

nicEditors.findEditor(“ TextArea”)。disable();

以上语句将禁用TextArea。

要启用TextArea,请更新nicEdit.js(请参见下文更新内容)

搜索 disable:function(){this.elm.setAttribute(“ contentEditable”,“ false”); }

在此代码旁边添加以下代码

,启用:function(){this.elm.setAttribute(“ contentEditable”,“ true”); }

,然后在您的JavaScript中调用 nicEditors.findEditor(“ TextArea”)。enable();