and was wondering if there is anyway to keep the widget visible through deletion?
I know currently, that block widgets have a default MapMode of MapMode.TrackBefore but because of this when I delete through the line the widget is placed it is removed from the DOM.
I would love if it was possible to map the widget to the next valid position after deleting through the line. Which I believe is the behavior of MapMode.Simple. But I can’t find a way to configure the Widget to propagate this setting to the Decoration, and I don’t believe it’s possible since PointDecoration determines it’s mapMode like so:
Hi Marijn, thank you so much for the response and the quick patch. This definitely fixes the update() call and results in the correct RangeSet being returned . But I am still seeing the widget removed from the editor.
I will do some additional work tonight to trace through the code and understand better the logic, and report back.
On closer look, I didn’t really think this patch through. RangeSet has an optimization that allows it to drop chunks of ranges that are entirely deleted, in which case it won’t even look at the map mode for those ranges. Thus, the approach in my patch just won’t work. I’ve revered my patch. You’ll have to take care of re-adding these in your own code after all.
Makes sense. Also thinking it through a bit more, for block width widget which are expected to span the entire line we need to perform more calculations to position them to the beginning of the line upon which they are moving onto, we can’t just take the cursor position.