visual-space / visual-editor

Rich text editor for Flutter based on Delta format (Quill fork)
MIT License
283 stars 44 forks source link

Demos - Sandbox page, preview delta json #66

Closed adrian-moisa closed 2 years ago

adrian-moisa commented 2 years ago

During development, it's often times super helpful to have a page that previews the the delta content of a document.

adrian-moisa commented 2 years ago

We had several issue to fix along the way related to: https://github.com/visual-space/visual-editor/issues/77 . Also had to deal with a modification in the EditorController code. Added in the update() command a new optional parameter to ignoreFocus. Basically when you update the document you can request for the caret not to be placed. It was necessary especially when dispatching update commands from the controller of the json input. Without this parameter the editor was always recapturing focus thus robbing the json input from the opportunity to insert changes in the document raw json.

Now it finally works with some minor issues. However one caveat is that a bad json wont update the editor. It might feel as if the page is broken. In future we could improve by adding a warning to indicate the json format is corrupted.

https://user-images.githubusercontent.com/11160141/180625376-64b0698e-5b6f-4d54-b42a-1fdb50c852ec.mov