首页 > 解决方案 > 如何使tinymce输入只读

问题描述

我想让tinymce输入只读。我试过下面的代码。请帮我解决这个问题。

tinymce.init({
    selector: '#deliberations',
    menubar: false,
    readonly: true, 
    branding: false,
    height: 100,
    max_height: 400,
    theme: 'modern',
    toolbar: false,
                toolbar_items_size: 'small',
                plugins: ['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 toc help'],

                toolbar1: 'insert | undo redo |  styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image print preview media | forecolor backcolor emoticons | fullscreen | table',

    image_advtab: true,
    templates: [{
            title: 'Test template 1',
            content: 'Test 1'
        },
        {
            title: 'Test template 2',
            content: 'Test 2'

        }
    ],
    content_css: [

    ]

});

标签: javascriptjquerytinymce

解决方案


如果您使用的是 4.x 版,请删除 readonly: true 选项并尝试

setup: function (editor) {
    editor.setMode("readonly")
    },

http://fiddle.tinymce.com/Lugaab/2


推荐阅读