首页 > 解决方案 > TinyMCE 编辑器高度不会改变

问题描述

我是 tinymce 的新手,并使用带有 angularJS 的编辑器。我正在使用 tinymce 库 4.3.13 使用以下 HTML 和 angularJS 代码生成 tinymce 编辑器。在 UI 中渲染编辑器时,高度变得非常小(75 像素),它不会在 tinymceOptions 对象中设置分配的高度。尝试了许多解决方案,但无法提出解决方案。非常感谢任何帮助。

<textarea class="form-control" ui-tinymce="tinymceOptions" rows="16" required></textarea>

$scope.tinymceOptions = {
        plugins: [
            'autoresize advlist autolink lists link image charmap print preview hr anchor pagebreak',
            'searchreplace wordcount visualblocks visualchars code fullscreen',
            'insertdatetime media nonbreaking save table contextmenu directionality',
            'emoticons template paste textcolor colorpicker textpattern imagetools codesample'
        ],
        autoresize_bottom_margin : 5,
        menubar:false,
        statusbar: false,
        toolbar: 'undo redo cut copy paste pastetext alignleft aligncenter alignright alignjustify bullist numlist outdent indent bold italic underline strikethrough formats removeformat fontselect fontsizeselect forecolor backcolor link hr',
        height: 400,
        width: 1200,
        theme: 'modern',
    };

标签: htmlangularjstinymcetinymce-4

解决方案


tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "autoresize",
  selector: '#editor',
  selector: 'textarea',  // change this value according to your HTML
  autoresize_min_height: 100,
  autoresize_max_height: 1000,
  autoresize_bottom_margin: 0,
  allow_conditional_comments: true
});

请查看autoresize 插件 tinymce文档


推荐阅读