Closed adrian-moisa closed 1 year ago
In case anyone is reading this ticket searching for updates. Yes, we are still alive. VE is still a project that we take care of. We've been slow to release any major updates because we are 110% focused on finishing our own startup projects and getting it live. Once it's live VE becomes major priority. Around end of September you will start seeing tickets moving.
(!) Calling
update()
will trigger two operations:clear()
andcompose()
.clear()
will usereplace()
to cleanup the entire document until we are left with[{"insert":"\n"}]
.compose()
will then use the new delta to append it to the document.documentController.compose()
will trigger an insert on therootNode
(nodes list). Reminder:clear()
has updated both the delta androotNode
to contain an empty line with a simple break line inside. This means we are adding empty rootNode "\n" + new data: "abc\n" and we will get "abc\n\n".rootNode
go out of sync.update()
. This seems to work fine when you have just an empty field being updated with empty doc. However it no longer works when you attempt to update with a regular document that has chars. Another issue was that I did not update the internal delta of the controller to match the new state of therootNode
. Once again things were going crazy with further interactions due to the mismatch between internal delta and rootNode.clear()
. That's why I created theoverrideRootNode
param. This entire setup might look like a hack, but there's simply no way to get rid of the double \n\n when updating the doc. The entire nodes manipulation code is built under the assumption that a document line will always end with \n. Therefore there's no simple way of getting rid of the initial \n of an empty doc. Thus we are left only with the option presented here: to remove the double \n if we now it was generated by update().https://github.com/visual-space/visual-editor/assets/11160141/37b5020e-2fb6-400f-bc44-dd8fca8d53b9