在 Quill配置选项中,使用名为 formats .此属性中定义的格式将创建一个白名单,其中的所有内容都将被过滤.可以在此处找到所有格式的列表.有关更多信息,请访问以下链接: Quill JavaScript Rich Text Editor限制标签 在羽毛笔中抑制某些格式 如何在QuillJS中使用格式白名单? 要添加对新格式的支持,您将需要创建一种新格式.请参阅以下链接以了解如何完成此操作: 什么,如何以及何时使用静态格式,自定义印迹上的格式和格式? 使用羊皮纸克隆介质 羊皮纸API 本地示例 表情符号示例 作为一个提示,如果要创建Blot,并且希望只对其进行整体编辑或删除,请将Blot设置为嵌入.编辑(2019年12月20日)我忘了说些什么:如果要将内容粘贴到编辑器,则最好看看剪贴板模块.When I use QuillJs to edit an existing HTML document, it removes the comments, indentations etc of the original HTML. Is there anyway to prevent this? 解决方案 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 tagsSuppress certain formats in QuillHow 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 ParchmentParchment APINative examplesA emoji blot exampleAs 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会过滤内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-21 02:46