私は反応アプリでリッチテキストエディタとしてreact-quillを使用しています。react-quill onBlur not working
テキストエディタのコンテンツをローカルのReact状態で保存し、値をRedux 'onBlur'に送信するだけです。私の問題は、フォーカスを取った後、テキストエディタの外にあるボタンをクリックするとonBlurが動作しなくなることです。 (つまり、onBlurは非インタラクティブな要素を画面上でクリックすると機能しますが、「保存」ボタンをクリックすると機能しません)。
現在のコード:
class TextEditor extends React.Component {
constructor(props) {
super(props)
this.state={
content: this.props.content;
}
this.handleQuillEditor_change = this.handleQuillEditor_change.bind(this)
this.handleQuillEditor_update = this.handleQuillEditor_update.bind(this)
}
handleQuillEditor_change (value) {
// handleChange...
}
handleQuillEditor_update() {
console.log('blur activated!')
}
render() {
const cmsProps = this.props.cmsProps
return (
<div style={containerStyle}>
<ReactQuill value={this.state.content}
onChange={this.handleQuillEditor_change}
onBlur={this.handleQuillEditor_update}/>
</div>
)
}
}
うわー、本当の解決策のようです。 「onBlur」のdivでRTEをラップしていないのですか? – jaimefps