mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-13 11:44:55 +01:00
fix broken onSelect event (#1309)
* fix broken onSelect event * Update after.js
This commit is contained in:
parent
ac14038607
commit
44b3c8c30c
@ -368,6 +368,20 @@ function AfterPlugin() {
|
||||
if (type == 'node' && Inline.isInline(node)) {
|
||||
change.insertInline(node).removeNodeByKey(node.key)
|
||||
}
|
||||
|
||||
// COMPAT: React's onSelect event breaks after an onDrop event
|
||||
// has fired in a node: https://github.com/facebook/react/issues/11379.
|
||||
// Until this is fixed in React, we dispatch a mouseup event on that
|
||||
// DOM node, since that will make it go back to normal.
|
||||
const node = document.getNode(target.focusKey)
|
||||
const el = findDOMNode(node)
|
||||
if (!el) return
|
||||
|
||||
el.dispatchEvent(new MouseEvent('mouseup', {
|
||||
view: window,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user