mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-13 18:53:59 +02:00
Fix IME crash on iOS, but break capitalisation on iOS (#5877)
* Revert "Make capitalizing work for iOS (#5654)"
This reverts commit 2a8b4e958b
.
* Add changeset
* Reference the older issue in comment
This commit is contained in:
@@ -3,7 +3,7 @@ import { Editor, Text, Path, Element, Node } from 'slate'
|
||||
|
||||
import { ReactEditor, useSlateStatic } from '..'
|
||||
import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect'
|
||||
import { IS_ANDROID, IS_IOS } from 'slate-dom'
|
||||
import { IS_ANDROID } from 'slate-dom'
|
||||
import { MARK_PLACEHOLDER_SYMBOL } from 'slate-dom'
|
||||
|
||||
/**
|
||||
@@ -127,9 +127,17 @@ export const ZeroWidthString = (props: {
|
||||
attributes['data-slate-mark-placeholder'] = true
|
||||
}
|
||||
|
||||
// FIXME: Inserting the \uFEFF on iOS breaks capitalization at the start of an
|
||||
// empty editor (https://github.com/ianstormtaylor/slate/issues/5199).
|
||||
//
|
||||
// However, not inserting the \uFEFF on iOS causes the editor to crash when
|
||||
// inserting any text using an IME at the start of a block. This appears to
|
||||
// be because accepting an IME suggestion when at the start of a block (no
|
||||
// preceding \uFEFF) removes one or more DOM elements that `toSlateRange`
|
||||
// depends on. (https://github.com/ianstormtaylor/slate/issues/5703)
|
||||
return (
|
||||
<span {...attributes}>
|
||||
{!(IS_ANDROID || IS_IOS) || !isLineBreak ? '\uFEFF' : null}
|
||||
{!IS_ANDROID || !isLineBreak ? '\uFEFF' : null}
|
||||
{isLineBreak ? <br /> : null}
|
||||
</span>
|
||||
)
|
||||
|
Reference in New Issue
Block a user