mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-16 20:24:01 +02:00
Fix mouse refocus in IE 11 (#2535)
* Fix mouse focus in IE 11 In IE11, refocusing by click would cause the editor to immediately lose focus. Fixes #2364 * Skip delect onFocus for EDGE
This commit is contained in:
committed by
Ian Storm Taylor
parent
1564c3a031
commit
83e45ac054
@@ -3,7 +3,7 @@ import Debug from 'debug'
|
|||||||
import Hotkeys from 'slate-hotkeys'
|
import Hotkeys from 'slate-hotkeys'
|
||||||
import Plain from 'slate-plain-serializer'
|
import Plain from 'slate-plain-serializer'
|
||||||
import getWindow from 'get-window'
|
import getWindow from 'get-window'
|
||||||
import { IS_IOS } from 'slate-dev-environment'
|
import { IS_IOS, IS_IE, IS_EDGE } from 'slate-dev-environment'
|
||||||
|
|
||||||
import cloneFragment from '../utils/clone-fragment'
|
import cloneFragment from '../utils/clone-fragment'
|
||||||
import findDOMNode from '../utils/find-dom-node'
|
import findDOMNode from '../utils/find-dom-node'
|
||||||
@@ -392,7 +392,7 @@ function AfterPlugin(options = {}) {
|
|||||||
// followed by a `selectionchange`, so we need to deselect here to prevent
|
// followed by a `selectionchange`, so we need to deselect here to prevent
|
||||||
// the old selection from being set by the `updateSelection` of `<Content>`,
|
// the old selection from being set by the `updateSelection` of `<Content>`,
|
||||||
// preventing the `selectionchange` from firing. (2018/11/07)
|
// preventing the `selectionchange` from firing. (2018/11/07)
|
||||||
if (isMouseDown) {
|
if (isMouseDown && !IS_IE && !IS_EDGE) {
|
||||||
editor.deselect().focus()
|
editor.deselect().focus()
|
||||||
} else {
|
} else {
|
||||||
editor.focus()
|
editor.focus()
|
||||||
|
Reference in New Issue
Block a user