visual-space / visual-editor

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

Markers - Multiple Fixes #139

Open adrian-moisa opened 1 year ago

adrian-moisa commented 1 year ago

VE Markers - Controller method: highlightMarker() #139

We want to be able to trigger from the controller the highlight behaviour for markers (and highlights if we are doing already for markers). Update doc page to document this new method. Add demo page.

VE Markers - Marker attachments for blocks #147

https://user-images.githubusercontent.com/11160141/193327125-e17b7e87-2b30-4405-99d4-11d2816cda0b.mov

Automatic testing is mandatory

VE Markers - New markers can override existing markers #142 CRITICAL

If the text selection perfectly matches a marker then the dropdown works fine. However if the selection does not overall the marker then no layers are displayed. This is probably happening because the rules for the other styles are different. If you select text that is partly bold partly regular, then the bold button is not highlighted. Meaning that when you click it you have the option to add bold. I believe this behaviour is rather logical and should not change.

https://user-images.githubusercontent.com/11160141/193290910-18858923-b87c-4229-be1e-680f9427903c.mov

New Markers override existing markers Related to the same behaviour. If we select text that contains a marker inside then when we attempt to add a new marker, the old one or old ones get discarded and the new marker is added. This behaviour is unacceptable for VS. We can't simply lose metadata because the editor overrode the markers and therefore we lost the internal UUID that linked the markers to the metadata objects.

As you can see in this demo, we are not supposed to lose old markers.

https://user-images.githubusercontent.com/11160141/193288374-ed1f8ce8-26c0-4585-8435-b8f9cd43e8e1.mov

VE Markers - Tapping the same marker twice type in toolbar, adds it again #219

VE Markers - Each change of style adds a new attachment for the same marker #137

This behaviour happens because the markers get split in children nodes, each one containing a unique combination of styles. We need to track them by id such that we render only once. When the EditableTextLineRenderer collects the marker dat we need to keep a list of markers that have been cached. We need to cach only the first fragment of each unique id. Markers are already built to with unique ids by default.

https://user-images.githubusercontent.com/11160141/193279719-3ba7b148-5597-4eec-87d0-7655265a94bf.mov

VE Markers - Typing in markers creates additional rectangles #143

When typing new characters in the body of a marker, we see some odd behaviour. For some reason the new characters get their own marker rectangle. I don't have a theory from where it comes so we will have to use the good old method of printing from step to step to see why the new chars get inserted as characters. Automatic testing is mandatory.

https://user-images.githubusercontent.com/11160141/193311104-d5a7aa44-d21e-4f47-9bf5-c57ade7d4523.mov

VE Markers - Disable hidden markers rectangles calculation PERF

If we don't show markers attachments for hidden marker types, disable marker calculation PERF

VE Markers - Keep markers attachments visible when the markers are hidden #136

Currently when using the _controller.toggleMarkers() method we also lose the ability to render the marker attachments. We would like to keep rendering the marker attachments while hiding the markers. This would be possible by skipping the draw call.

https://user-images.githubusercontent.com/11160141/200126430-ae945b53-6bb1-4de0-b9a5-c28bf0321a06.mov

VE Markers - Quick menu not working on double tap #186