Quill - 使编辑器在 Div 中换行文本而不是 P 标签 [英] Quill - Make Editor wrap text in Div instead of P tag
问题描述
我使用 React-Quill 在 ReactJS 中构建了一个 Quill 文本编辑器.我想用 Div 标签而不是 P 标签在文本编辑器中包装生成的文本.这可能吗?
我的使用概述:在 Quill 编辑器中生成/编辑文本时,它会复制到页面另一部分的另一个 div 中.我们对这个编辑器的使用可以追溯到几年前,因此是在旧版本的 Quill 上构建的,当时文本是在 Div 中生成的.我们最近升级到 Quill 1.0,当在 P 标签中生成文本时,它会创建我们无法删除的不需要的样式.最简单和最简单的解决方案是生成 div 而不是 p 标签,但我不知道这是否可能.
有人知道更多吗?
谢谢.
您可以更改默认 Block 的 tagName:
var Block = Quill.import('blots/block');Block.tagName = 'div';Quill.register(块);
工作示例:https://codepen.io/anon/pen/brgvPR>
I have built a Quill text editor in ReactJS with React-Quill. I would like to wrap the generated text in the text editor with a Div tag instead of a P tag. Is this possible?
Overview of my use: When text is generated/edited in the Quill editor it is duplicated in another div on another part of the page. Our use of this editor goes back a few years, and thus was built on an older version of Quill, when the text was generated in Div's. We recently upgraded to Quill 1.0 and when the text is generated in P tags it creates unwanted styles that we can't remove. The simplest and least hacky solution would be to generate div's instead of p tags, but I have no idea if that's even possible.
Does anyone know more about this?
Thank you.
You can just change the tagName of the default Block:
var Block = Quill.import('blots/block');
Block.tagName = 'div';
Quill.register(Block);
Working example: https://codepen.io/anon/pen/brgvPR
这篇关于Quill - 使编辑器在 Div 中换行文本而不是 P 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!