1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-17 12:41:44 +02:00

Fix selection being reset incorrectly after combination of events (#2686)

* Fix selection being reset incorrectly after combination of events

If mouseDown happens inside editor container and mouseUp outside it,
then programmatically calling editor.focus() after that will mess up
the selection

* Update after.js
This commit is contained in:
Stan Gurenkov
2019-04-24 17:24:15 -07:00
committed by Ian Storm Taylor
parent 7855783b2d
commit feaad7e7cd

View File

@@ -634,6 +634,11 @@ function AfterPlugin(options = {}) {
const window = getWindow(event.target)
const selection = window.getSelection()
setSelectionFromDom(window, editor, selection)
// COMPAT: reset the `isMouseDown` state here in case a `mouseup` event
// happens outside the editor. This is needed for `onFocus` handling.
isMouseDown = false
next()
}