0
我必須在一個頁面中加載5個富文本編輯器 - TinyMCE RTE。 一般加載單Timy MCE,我使用下面的代碼:使用單一功能在一頁中初始化多個Tiny MCE RTE
var _setTinymce = function() {
var ed = new tinymce.Editor('textAreaContent', {
menubar: 'edit insert view format table',
plugins: ["autolink fullscreen table lists link image charmap print preview anchor code "],
toolbar: "insertfile undo redo | bold italic | underline | alignleft aligncenter alignright alignjustify | strikethrough | superscript | subscript | code | removeformatbullist | numlist outdent indent | link image | fontselect ",
browser_spellcheck: true,
relative_urls: false,
}, tinymce.EditorManager);
ed.render();
};
textAreaContent是在HTML我的文字區域的ID。
在document.ready中,我調用了這個函數_setTinymce(); 這工作絕對好。
現在我必須加載這個TinyMCE RTE在多個文本區域(近7) 我不想重複相同的代碼(上面給出)。
我採取了一個包含所有textareas ID的數組。
var rteDisplay = [textAreaContent ,textAreaContent1, textAreaContent2, textAreaContent3, textAreaContent4 ];
我有一個通用的功能,我通過文本區域ID作爲參數。 但是RTEs不加載。
我得到錯誤:
tinymce.min.js:53 Uncaught TypeError: Cannot read property 'visibility' of undefined