在init上隐藏TinyMce工具栏

时间:2017-08-23 13:39:21

标签: angular typescript tinymce

我想在设置内容之后只设置我的tinymce工具栏。所以我在init函数上订阅了这个

的编辑器
 editor.on('init', () => {
          editor.setContent(this.value);
          if (this.disabled) {
            editor.contentDocument.body.bgColor = '#eeeeee';
            editor.toolbar = this.disabled ? !this.disabled : undefined;
            editor.setMode('readonly');
          }

但如果我将编辑器工具栏设置为false,则始终会显示工具栏。我怎么能这样做?

1 个答案:

答案 0 :(得分:2)

您可以使用工具栏DOM元素并使用css隐藏。

var toolbar = editor.getContainer().querySelector('.mce-toolbar-grp');
toolbar.style.display = 'none';