davidroyer / vue2-editor

A text editor using Vue.js and Quill
MIT License
2.5k stars 362 forks source link

fix: supports undo command when it has only initial content #415

Closed mathdecastilho closed 8 months ago

mathdecastilho commented 10 months ago

When the editor has an initial value and the undo command is pressed (ctrl+z or cmd+z) the entire content is erased.

This problem occurs because it is changing the content after it is loaded. The correct form of using the initial content is putting the content inside the quill container, in HTML. As can be seen here: https://quilljs.com/docs/quickstart/

This code simulates this behavior, changing the innerHTML from the container before Quill is mounted and it fixes the problem