小编Bob*_*man的帖子

React-Quill - 错误你很可能想要`editor.getContents()`

当我保存表单(onSubmit)时,我收到此错误:您正在将事件中的delta对象传onChangevalue.你很可能想要的editor.getContents().

脚本的其余部分运行正常,并按预期将所有内容写入数据库,但React-Quill触发错误并挂起页面.

我需要做什么来定义editor.getContents()

export default class CreateDiscussionForm extends Component {
constructor(props){
super(props);
this.state = {
  error: '',
  editorHtml: ''
};
this.handleChange = this.handleChange.bind(this);
}

handleChange (html) {
 this.setState({ editorHtml: html });
}

onSubmit(e) {
 var background = this.state.editorHtml;
 console.log('background', background); //<p>testing</p>
 //... rest of code



<ReactQuill
    name="editor"
    theme={'snow'}
    ref="comment"
    onChange={this.handleChange}
    value={this.state.editorHtml}
    modules={quillModules}
    placeholder="add the discussion background (optional)"
/>
Run Code Online (Sandbox Code Playgroud)

提前谢谢 - 鲍勃

reactjs quill

4
推荐指数
1
解决办法
3714
查看次数

quilljs 用 &lt;b&gt; 替换 &lt;strong&gt;

我有一个 Meteor React 应用程序。

我正在使用 Quill,但粗体会生成一个<strong>标签而不是一个<b>标签。

要通过危险的SetInnerHTML 呈现HTML,它不会显示<strong>为粗体。

有没有办法让 Quilljs 使用<b>而不是<strong>

meteor reactjs quill

0
推荐指数
1
解决办法
1180
查看次数

标签 统计

quill ×2

reactjs ×2

meteor ×1