mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-11 09:43:58 +02:00
Enable Shadow DOM fix for Safari 17. (#5659)
* Enable Safari Shadow DOM fix for Safari 17. * Create weak-files-jam.md * Update changeset.
This commit is contained in:
5
.changeset/weak-files-jam.md
Normal file
5
.changeset/weak-files-jam.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate-react': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Enable Shadow DOM fix for all Safari versions.
|
@@ -51,7 +51,6 @@ import {
|
|||||||
IS_WEBKIT,
|
IS_WEBKIT,
|
||||||
IS_UC_MOBILE,
|
IS_UC_MOBILE,
|
||||||
IS_WECHATBROWSER,
|
IS_WECHATBROWSER,
|
||||||
IS_SAFARI_LEGACY,
|
|
||||||
} from '../utils/environment'
|
} from '../utils/environment'
|
||||||
import Hotkeys from '../utils/hotkeys'
|
import Hotkeys from '../utils/hotkeys'
|
||||||
import {
|
import {
|
||||||
@@ -208,12 +207,7 @@ export const Editable = (props: EditableProps) => {
|
|||||||
const el = ReactEditor.toDOMNode(editor, editor)
|
const el = ReactEditor.toDOMNode(editor, editor)
|
||||||
const root = el.getRootNode()
|
const root = el.getRootNode()
|
||||||
|
|
||||||
if (
|
if (!processing.current && IS_WEBKIT && root instanceof ShadowRoot) {
|
||||||
IS_SAFARI_LEGACY &&
|
|
||||||
!processing.current &&
|
|
||||||
IS_WEBKIT &&
|
|
||||||
root instanceof ShadowRoot
|
|
||||||
) {
|
|
||||||
processing.current = true
|
processing.current = true
|
||||||
|
|
||||||
const active = getActiveElement()
|
const active = getActiveElement()
|
||||||
@@ -500,12 +494,7 @@ export const Editable = (props: EditableProps) => {
|
|||||||
const el = ReactEditor.toDOMNode(editor, editor)
|
const el = ReactEditor.toDOMNode(editor, editor)
|
||||||
const root = el.getRootNode()
|
const root = el.getRootNode()
|
||||||
|
|
||||||
if (
|
if (processing?.current && IS_WEBKIT && root instanceof ShadowRoot) {
|
||||||
IS_SAFARI_LEGACY &&
|
|
||||||
processing?.current &&
|
|
||||||
IS_WEBKIT &&
|
|
||||||
root instanceof ShadowRoot
|
|
||||||
) {
|
|
||||||
const ranges = event.getTargetRanges()
|
const ranges = event.getTargetRanges()
|
||||||
const range = ranges[0]
|
const range = ranges[0]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user