reedsy / quill-cursors

A multi cursor module for Quill text editor.
MIT License
250 stars 53 forks source link

Move selection behind text #34

Closed alecgibson closed 5 years ago

alecgibson commented 5 years ago

Fixes https://github.com/reedsy/quill-cursors/issues/32

At the moment, when we add a selection using span elements, they appear further down the DOM, and hence are put "on top" of the editor text. In other words, if another user has highlighted some text, then their selection will prevent me from placing my cursor inside it.

This change moves the selection behind the text with a z-index: -1, which avoids intercepting the click on the editor. It should be noted that this will also hide the selections if a background is applied to the editor, but fixing that case is left to the consumer.