Tinymce选择禁用还是只读

时间:2020-09-21 10:52:58

标签: javascript tinymce

我查看了太多不同的答案和文档,但找不到适合的属性。我已经在这里初始化了编辑:

$(document).ready(function () {
                            if($("#elm1").length > 0){
                                tinymce.init({
                                                                        content_css : "/css/style.css",
                                    selector: "textarea#elm1",
                                    theme: "modern",
                                    height:300,
                                    plugins: [
                                        "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
                                        "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                                        "save table contextmenu directionality emoticons template paste textcolor"
                                    ],
                                    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l      ink image | print preview media fullpage | forecolor backcolor emoticons",
                                    style_formats: [
                                        {title: \'Bold text\', inline: \'b\'},
                                        {title: \'Red text\', inline: \'span\', styles: {color: \'#ff0000\'}},
                                        {title: \'Red header\', block: \'h1\', styles: {color: \'#ff0000\'}},
                                        {title: \'Example 1\', inline: \'span\', classes: \'example1\'},
                                        {title: \'Example 2\', inline: \'span\', classes: \'example2\'},
                                        {title: \'Table styles\'},
                                        {title: \'Table row 1\', selector: \'tr\', classes: \'tablerow1\'}
                                    ]
                                });
                            }
                        });

,在发生事件之后,我想将编辑器设置为不可编辑。我目前有以下一行

tinymce.get("elm1").setMode('readonly');

我很确定我正在获取该元素,因为在其他地方我正在使用tinymce.get("elm1").setContent(...);,它工作正常。我正在使用版本4.4。*。有人知道正确的属性是什么吗?

0 个答案:

没有答案