ianstormtaylor / slate

A completely customizable framework for building rich text editors. (Currently in beta.)
http://slatejs.org
MIT License
29.71k stars 3.24k forks source link

Shift-select with the arrow keys fails when selecting toward an inline void node #1518

Closed bengotow closed 6 years ago

bengotow commented 6 years ago

Hey folks! This one's a bit odd. GIF below! In the GIF, I am holding down the shift key the whole time. (I haven't attached a JSFiddle because it's reproduced on http://slatejs.org/#/emojis.)

jan-10-2018 14-18-04

Observations:

cameracker commented 6 years ago

Might be similar to https://github.com/ianstormtaylor/slate/issues/1502

ms88privat commented 6 years ago

Also related? https://github.com/ianstormtaylor/slate/pull/913

conorcussell commented 6 years ago

This is happening because nextText is the zero-width text node slate inserts. As a result, the condition is true and we collapse the selection forward instead of extending it.

I've made a PR which deals with this issue, I still need to check it deals with the other cases and doesn't cause any regressions.

slate-selection