reactjs - react-quill 在输入时添加额外的换行符
问题描述
我正在使用 react-quill 并从
但是,存在额外换行符的问题。
这是我的输入以及我希望它在后端传递时的样子(qna 制造商)
<div>
test1 <br>
test2 <br>
test3 <br>
</div>
但它变成了这样:
<div> test1 </div>
<div> test2 </div>
<div> test3 </div>
所以当我将它传递给后端时,它会像这样保存
test1\n\ntest2\n\ntest3 实际上我只想将它保存为 test1\n\ntest2\ntest3
我用过这个:
var Block = Quill.import('blots/block');
Block.tagName = 'DIV';
Quill.register(Block, true);
```````
<ReactQuill
value={this.props.value}
onChange={this.handleChange}
onBlur={this.setProps}
modules={this.modules}
formats={this.formats}
/>
这是正在保存的标记:
<div>click <a href=\"https://twitter.com\" target=\"_blank\">here </a> for sample link test test testing test new line sample link <a href=\"https://www.google.com\" target=\"_blank\">here</a>.. and then <a href=\"https://www.facebook.com\" target=\"_blank\">here</a> test here</div>
<div>endtered value here</div>
<div><br></div>
<div><br></div>
<div>this is a new paragraphs</div>
<div>but this is just a new line</div>
这就是它在 qnamaker 中的样子
解决方案
推荐阅读
- c++ - 引用、地址、解引用和指针的含义
- javascript - 捕获未包含在 span 中的字符串
- python - 为什么 Python 在 Visual Studio 中加载非常缓慢?
- javascript - Electron:如何捕获来自主进程的所有请求响应?
- java - 在 Spring Boot 中可分页
- python - 如何从 WTForms 中删除建议
- javascript - 使用 vue 根据元素 ui 树中的文件夹选择过滤文件
- r - 访问Rstudio中具有“useMethod(”packagefunction“)的函数的整个源代码?
- c++ - 在 C++ 中引用 string::string 中的任何字符
- delphi - 如何确定程序是否仅接受文件或文件列表作为参数?