ianstormtaylor / slate

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

Cannot resolve a Slate point from DOM point #3723

Open ncqwer opened 4 years ago

ncqwer commented 4 years ago

Do you want to request a feature or report a bug?

bug

What's the current behavior?

Under the situation that if a normally parent element's children are all void element,clicking the area(contenteditable=false) that belong to parent element and multiple times will result in an error(Cannot resolve a Slate point from DOM point: [object Text],17)

here is the exmaple: example Jun-05-2020 17-20-30 The bug doesn't happen each time.

Slate: 0.58.1 Browser: Chrome OS: Mac

What's the expected behavior?

No error occured!

maebert commented 4 years ago

Probably the same issue as #3421.

TL;DR every element that has contentEditable={false} should also have style={{ userSelect: 'none' }} to avoid this issue.

williamtstanley commented 4 years ago

I am getting this behaviour even with user-select: none in the styles. Seems to be related to blocks that only have a void nodes in them.

gorpher commented 3 years ago

Probably the same issue as #3421.

TL;DR every element that has contentEditable={false} should also have style={{ userSelect: 'none' }} to avoid this issue.

good idea. it's solved,thanks.