为什么Quill会过滤内容? [英] Why does Quill filter it's content?
问题描述
当我使用QuillJs编辑现有的HTML文档时,它将删除原始HTML的注释,缩进等.反正是有防止这种情况发生的吗?
Quill不支持任意HTML.默认情况下,所有无法识别的内容都将在可能的情况下转换(将< strong>
标记转换为< b>
标记),否则将被删除.>
在 Quill配置选项中,使用名为 formats
.此属性中定义的格式将创建一个白名单,其中的所有内容都将被过滤.可以在此处找到所有格式的列表.
有关更多信息,请访问以下链接:
要添加对新格式的支持,您将需要创建一种新格式.请参阅以下链接以了解如何完成此操作:
作为一个提示,如果要创建Blot,并且希望只对其进行整体编辑或删除,请将Blot设置为 解决方案
Quill does not support arbitrary HTML. By default, anything that is not recognized will be converted (the <strong>
tag to the <b>
tag) when possible, or removed when not.
In 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.
For more information, visit the following links:
- Quill JavaScript Rich Text Editor restrict tags
- Suppress certain formats in Quill
- How to use format whitelist in QuillJS?
To add support for new formats you will need to create a new one. See the following links to find out how this can be done:
- What, how and when to use static formats, formats and format on custom blot?
- Cloning Medium with Parchment
- Parchment API
- Native examples
- A emoji blot example
As a tip, if you want to create Blot, and you want to allow it to be only edited or removed as a whole, set your Blot to be a child of Embed.
EDIT (DEC 20, 2019)
I forgot to say something: If you are pasting content to the editor, you better take a look at the clipboard module.
这篇关于为什么Quill会过滤内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!