react-quill How to do undo & redo on button click?

流过昼夜 提交于 2021-02-10 05:26:57

问题


I've tried by acquiring the quill object like this:

  • got the ref from ReactQuill Component <ReactQuill ref={this.setRef}/>
  • and then in componentDidMount got the quill object itself this.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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!