问题
I've tried by acquiring the quill object like this:
- got the ref from ReactQuill Component
<ReactQuill ref={this.setRef}/> and then in
componentDidMountgot the quill object itselfthis.quillRef= this.reactQuillRef.getEditor();and then I call
this.quillRef.history.undo()/this.quillRef.history.redo()
But there seems to be a problem with focus, kinda like ReactQuill and Quill are out of sync. When i do undo or redo sometimes it just moves the cursor.
But everything works fine on ctrl + z and ctrl + y.
来源:https://stackoverflow.com/questions/49489085/react-quill-how-to-do-undo-redo-on-button-click