mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 21:21:21 +02:00
fix blur not triggering (#1342)
This commit is contained in:
committed by
Ian Storm Taylor
parent
5973bb41a7
commit
d1ee4dba57
@@ -71,15 +71,13 @@ function BeforePlugin() {
|
|||||||
const { value } = change
|
const { value } = change
|
||||||
const focusTarget = event.relatedTarget
|
const focusTarget = event.relatedTarget
|
||||||
|
|
||||||
// If focusTarget is null, the blur event is due to the window itself being
|
// focusTarget may be null when window itself being blurred
|
||||||
// blurred (eg. when changing tabs) so we should ignore the event, since we
|
// (eg. when changing tabs), or when user clicks on elements
|
||||||
// want to maintain focus when returning.
|
// without`tabindex` attribute.
|
||||||
if (!focusTarget) return true
|
if (focusTarget) {
|
||||||
|
|
||||||
const el = findDOMNode(editor)
|
const el = findDOMNode(editor)
|
||||||
|
// The event should be ignored if the focus returns to the editor from an
|
||||||
// The event should also be ignored if the focus returns to the editor from
|
// embedded editable element (eg. an input element inside a void node).
|
||||||
// an embedded editable element (eg. an input element inside a void node),
|
|
||||||
if (focusTarget == el) return true
|
if (focusTarget == el) return true
|
||||||
|
|
||||||
// when the focus moved from the editor to a void node spacer...
|
// when the focus moved from the editor to a void node spacer...
|
||||||
@@ -93,6 +91,7 @@ function BeforePlugin() {
|
|||||||
) {
|
) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
debug('onBlur', { event })
|
debug('onBlur', { event })
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user