我的表单中有两个编辑器。我使用的是angular 4。我应用了以下代码将编辑器设置为只读:
tinymce.activeEditor.getBody().setAttribute('contenteditable', false);
tinymce.activeEditor.getBody().style.backgroundColor = '#ecf0f5';
但是从上面的代码来看,只有一个编辑器内容设置为只读。如何在所有编辑器上执行此操作?
发布于 2018-08-31 19:00:58
我从@Michel的回答中得到了这个想法,并编写了以下代码:
var result = tinymce.editors;
result.forEach(element => {
tinymce.get(element.id).getBody().setAttribute('contenteditable', false);
tinymce.get(element.id).getBody().style.backgroundColor = '#ecf0f5';
});
https://stackoverflow.com/questions/52094638
复制相似问题