反应羽毛笔在输入上添加额外的换行符

时间:2019-02-27 14:17:35

标签: reactjs 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 \ 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中的样子

enter image description here

0 个答案:

没有答案