Home  >  Article  >  Web Front-end  >  设置TinyMCE在线HTML编辑控件只读_html/css_WEB-ITnose

设置TinyMCE在线HTML编辑控件只读_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:31:201978browse

TinyMCE是一款主流在线HTML/Text编辑器,特定情况下需要设置成只读状态(比如用户访问权限受控时)。


有两种方法:一种是通过配置在控件初始化时设置,另外一种是运行时设置。

1. 通过配置在控件初始化时设置

tinyMCE.init({        ...        theme : "advanced",        readonly : 1});
2. 在运行时设置编辑器iframe body的contenteditable属性为false

tinymce.activeEditor.getBody().setAttribute('contenteditable', false);


by iefreer

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn