Would it be possible for the drawSelection
to return a callback with the new selection dom elements, and their sizes, so that one can decorate them easily? I would like to add a border around the selection for example.
Or it doesn’t necessarily have to be a callback, just a simple way to get the selection elements so I can decorate them in a meaningful way.
How would adding a border around the selection work? This is drawn with elements that can be arranged in various ways, touching in non-obvious places, so that having a border that goes around it but isn’t visible inside it would be difficult.
The selection seems to be made up of 1-3 elements, one top, middle, and bottom.
There are a couple of scenarios to consider, and from there, draw the borders. They will be done using regular border
in css, but also (most likely) before/after pseudo elements to draw the partial borders between the rectangles. We know the sizes they are offset from eachother (top/left), so it should be possible.
I would need to try this out, but first step would be to get easy access to the elements.
It can be a lot more elements in bidirectional text.
I’d recommend to just not do this. But if you really must, I’d recommend forking drawSelection
or adding another similar plugin that draws a slightly larger selection layer below the regular one.
Okay. I did not consider bidirectional texts.
Having a border around would help with visualizing where the selection starts/end (since my editor has a lot going on already), but perhaps it’s more work than its worth.
Another idea could be if we have the measurements of the rects, we could place a “border” rect under them, and then use clip-path
to outline the border? Would that work you think?
RectangleMarker.forRange
will pretty much give you the coordinates where the selection rectangles will be drawn, if that’s any use.