【发布时间】:2017-10-16 02:03:10
【问题描述】:
我正在尝试使用 tinymce 4.7.1(从我的旧 tinymce 4.3.1 升级)。当我尝试通过调用方法 setContent 以编程方式设置 tinymce 的内容时,它会抛出以下错误:
Cannot read property 'parse' of undefined TypeError: Cannot read property 'parse' of undefined
在查看了错误的细节之后,我意识到 tinymce 期望在它的 tinymce.dom 中有序列化的类,并且在没有这个类的情况下它无法解析因此这个错误。
这是来自 tinymce 的 sn-p
else {
// Parse and serialize the html
if (args.format !== 'raw') {
content = new Serializer({
validate: self.validate
}, self.schema).serialize(
self.parser.parse(content, { isRootContent: true }) //this line is throwing error
);
}
与以前的版本(以前对我来说很好,版本 4.3.1)相比,对序列化类没有这种依赖。
有人可以建议我是否必须添加更多插件或类(默认包中未提供)以使我的代码正常工作?
我的观察:在一个孤立的原型示例中,当我运行托管在云上的 tinymce 时,它运行良好。
【问题讨论】:
标签: javascript angularjs serialization tinymce-4