mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-04-20 21:34:53 +02:00
Don't remove selection when hovering over a non-selectable DOM element (#4577)
* Don't remove selection when hovering over a non-selectable node Fixes https://github.com/ianstormtaylor/slate/issues/4545 To reproduce the buggy behavior: 1. Create a page that renders a Slate element with a `contentEditable: false` element in it. 2. Start selecting some text with the mouse. 3. During the drag, mouseover the `contentEditable: false` element. Expected behavior: After doing a drag-to-select with the mouse, from a valid anchor point on mousedown to a valid focus point on mouseup, the selection is set to those anchor and focus points. Actual behavior: your selection is removed as soon as your mouse hits the `contentEditable: false` element. This is because the current behavior clears the selection if it is momentarily not a valid Slate location. * Add changeset
This commit is contained in:
parent
11ef83b47f
commit
4b2e4000d6
5
.changeset/curly-timers-watch.md
Normal file
5
.changeset/curly-timers-watch.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate-react': patch
|
||||
---
|
||||
|
||||
Fixed a bug that removed the selection when hovering over a non-selectable DOM element
|
@ -505,8 +505,6 @@ export const Editable = (props: EditableProps) => {
|
||||
exactMatch: false,
|
||||
})
|
||||
Transforms.select(editor, range)
|
||||
} else {
|
||||
Transforms.deselect(editor)
|
||||
}
|
||||
}
|
||||
}, 100),
|
||||
|
Loading…
x
Reference in New Issue
Block a user