我有一个Quill编辑器,它需要转换某些遗留内容,这已经是HTML,到羊皮纸增量格式。在创建Quill编辑器之前,将HTML放入DOM可以很好地工作:
<div id="my-editor">
<p>My legacy content</p>
</div>
<script>
var editor = new Quill("#my-editor");
</script>然而,一些遗留的HTML非常混乱,并且包含我不想支持的某些样式结构(字体、颜色、背景)。
Quill在忽略它不理解的标记、类和样式属性方面做得很好。但我想注销某些已知的格式,我希望它也忽略这些格式。我试过这样做...
Quill.register({
'formats/color': null,
'formats/font': null,
'formats/background': null
});尝试从...in注册表中注销这些格式。但是在运行时我得到了这个错误:
TypeError: Cannot read property 'blotName' of null
at Function.register (vendor/quill-1.3.2.js:1068:82)有什么建议吗?
https://stackoverflow.com/questions/46328147
复制相似问题