为什么 Quill 会过滤它的内容?

Why does Quill filter its content?

当我使用 QuillJs 编辑现有 HTML 文档时,它会删除原始 HTML 的注释、缩进等。有什么办法可以防止这种情况吗?

Quill 不支持任意HTML。默认情况下,任何无法识别的内容都将在可能的情况下进行转换(<strong> 标记为 <b> 标记),否则将被删除。

Quill configuration options, use the configuration named formats. The formats defined in this property will create a whitelist, where anything not in it will be filtered. A list of all formats can be found here.

有关详细信息,请访问以下链接:

  • Suppress certain formats in Quill
  • How to use format whitelist in QuillJS?

要添加对新格式的支持,您需要创建一个新格式。请参阅以下链接以了解如何完成此操作:

作为提示,如果您想要创建 Blot,并且您希望只允许对其进行编辑或作为一个整体删除,请将您的 Blot 设置为 Embed 的子项。

编辑(2019 年 12 月 20 日)

忘了说一句:如果你是粘贴内容到编辑器,你最好看看clipboard module