我正在使用 TinyMCE 4 并按如下方式设置:
tinyMCE.init({
mode : "specific_textareas",
editor_selector : "basicTinyMCE",
theme : "modern",
readonly : false,
...});
我想在 DOM 中渲染后调用一个函数。
我碰到this http://www.tinymce.com/wiki.php/API3%3aevent.tinymce.Editor.onPostRender并尝试过:
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
如果这是实现我想要的目标的正确方法,有什么想法吗?
如果是这样,为什么会出现错误?
你有两个选择:
- 使用配置初始化实例回调 http://www.tinymce.com/wiki.php/Configuration:init_instance_callback http://www.tinymce.com/wiki.php/Configuration%3ainit_instance_callback
-
使用新方式添加回调
ed.on('postRender', 函数(e) {
console.log('postRender');
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)