在 DOM 中渲染 TinyMCE 后执行操作 [英] Perform action after TinyMCE rendered in DOM
本文介绍了在 DOM 中渲染 TinyMCE 后执行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 TinyMCE 4 并进行如下设置:
I'm using TinyMCE 4 and setting it up as follows:
tinyMCE.init({
mode : "specific_textareas",
editor_selector : "basicTinyMCE",
theme : "modern",
readonly : false,
...});
我想在一个函数在 DOM 中呈现后调用它.
I want to call a function after it has been rendered in the DOM.
我遇到了这个并尝试:
tinyMCE.init({
mode : "specific_textareas",
editor_selector : "basicTinyMCE",
theme : "modern",
readonly : false,
setup : function(ed) {
ed.onPostRender.add(function(ed,cm) {
console.log('After render: ' + ed.id);
});
}
});
我收到以下错误:
SCRIPT5007: Unable to get property 'add' of undefined or null reference
如果这是实现我想要的正确方法,有什么想法吗?如果是这样,为什么会出现错误?
Any ideas if this is the correct way to achieve what I want? And if so, why is the error appearing?
推荐答案
您有两个选择:
- 使用配置 init_instance_callback http://www.tinymce.com/wiki.php/Configuration:init_instance_callback
使用新方法添加回调
- Use configuration init_instance_callback http://www.tinymce.com/wiki.php/Configuration:init_instance_callback
Use new way to add callbacks
ed.on('postRender', function(e) {console.log('postRender');});
ed.on('postRender', function(e) { console.log('postRender'); });
这篇关于在 DOM 中渲染 TinyMCE 后执行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文