未捕获的类型错误:无法读取属性'添加'未定义的tinymce版本4.x
Uncaught TypeError: Cannot read property 'add' of undefined tinymce version 4.x
我使用的是微小的mce 4.x版本,这是我在html文件中编写的代码
<script type="text/javascript" src="tinymce/tinymce.min.js"></script>
<script>
tinymce.init({
selector: "textarea#elm1",
theme: "modern",
width: 500,
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"
],
content_css: "css/content.css",
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link 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'}
],
setup : function(ed) {
ed.onBeforeRenderUI.add(function(ed, cm) {
console.log('add function called');
});
ed.onLoadContent.add(function(ed, o) {
console.log('add function called');
});
}
});
<body>
<textarea id="elm1" name="area"></textarea>
</body>
我得到错误
Uncaught TypeError:当调用BeforeRenderUI.add()方法
请帮我解决这个问题。非常感谢。
感谢您分享对您有效的解决方案。但要正确:问题的解决方案是使用tinymce4代码(onLoadContent仅适用于tinymce3)。正确的使用方法是:
setup : function(ed) {
ed.on('BeforeRenderUI', function(e) {
console.log('BeforeRenderUI function called');
});
ed.on('LoadContent', function(e) {
console.log('LoadContent function called');
});
相关文章:
- jQuery验证器添加方法未定义
- 为什么这个功能打印“;未定义的未定义的“;作为联系人名称,添加“新对象”
- 未捕获的引用错误:添加网络代码时未定义 $
- 在 JavaScript 对象中添加子对象时获取“无法设置未定义的属性'项目'”
- 未捕获的引用错误:添加未在javascript代码中定义
- "未捕获的类型错误:未定义的不是函数“;当向输入字段添加值时
- Javascript:添加键值对文字,给出未定义的结果
- 如何将未定义的元素添加到数组中
- JavaScript-为什么当我向表中添加新列时,它会说“;未定义的“;在额外的细胞中
- 在数据表的新行中添加按钮,变得未定义
- AmChart - 未定义添加标题
- 尝试添加到根父节点时出现 KendoUI 未定义节点问题
- JQuery UI AutoComplete:.data(..) 未定义 [但仅当我添加第二个自动完成框时]
- 使用 Javascript 将样式动态添加到样式表,但我收到“无法读取未定义的属性'长度'”错误
- $.each() 添加“未定义”值
- 角度选择添加未定义的选项
- JavaScript/JQuery:添加未定义字段中的数字(带0)
- JavaScript target=_blank添加未定义的url
- For循环添加未定义条目's
- jquery数据表添加未定义的行