当我保存表单(onSubmit)时,我收到此错误:您正在将事件中的delta对象传onChange回value.你很可能想要的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)
提前谢谢 - 鲍勃
我有一个 Meteor React 应用程序。
我正在使用 Quill,但粗体会生成一个<strong>标签而不是一个<b>标签。
要通过危险的SetInnerHTML 呈现HTML,它不会显示<strong>为粗体。
有没有办法让 Quilljs 使用<b>而不是<strong>?