React-quill 在输入时添加额外的换行符

Pag*_*P.T 6 reactjs quill

我正在使用react-quill并交换了包装

然而,存在额外换行的问题。

这是我的输入以及我希望它在后端传递时的样子(qna 制造商)

<div>
  test1 <br>
  test2 <br>
  test3 <br>
</div>
Run Code Online (Sandbox Code Playgroud)

但它变成这样:

<div> test1 </div>
<div> test2 </div>
<div> test3 </div>
Run Code Online (Sandbox Code Playgroud)

所以当我将它传递到后端时,它会像这样保存

test1\n\ntest2\n\ntest3 当我事实上我只想将其保存为 test1\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}
          />
Run Code Online (Sandbox Code Playgroud)

这是正在保存的标记:

    <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>
Run Code Online (Sandbox Code Playgroud)

这就是 qnamaker 中的样子

在此输入图像描述