1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-01 19:22:35 +02:00

fix: chromium interrupt ime (#5736)

This commit is contained in:
Czy
2024-10-08 21:55:45 +08:00
committed by GitHub
parent b1a1021612
commit 8c7f7ea6ac
2 changed files with 32 additions and 24 deletions

View File

@@ -220,6 +220,9 @@ const Mention = ({ attributes, children, element }) => {
data-cy={`mention-${element.character.replace(' ', '-')}`} data-cy={`mention-${element.character.replace(' ', '-')}`}
style={style} style={style}
> >
{/* Prevent Chromium from interrupting IME when moving the cursor */}
{/* 1. span + inline-block 2. div + contenteditable=false */}
<div contentEditable={false}>
{IS_MAC ? ( {IS_MAC ? (
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490 // Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
<Fragment> <Fragment>
@@ -232,6 +235,7 @@ const Mention = ({ attributes, children, element }) => {
{children} {children}
</Fragment> </Fragment>
)} )}
</div>
</span> </span>
) )
} }

View File

@@ -242,6 +242,9 @@ const Mention = ({ attributes, children, element }) => {
data-cy={`mention-${element.character.replace(' ', '-')}`} data-cy={`mention-${element.character.replace(' ', '-')}`}
style={style} style={style}
> >
{/* Prevent Chromium from interrupting IME when moving the cursor */}
{/* 1. span + inline-block 2. div + contenteditable=false */}
<div contentEditable={false}>
{IS_MAC ? ( {IS_MAC ? (
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490 // Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
<Fragment> <Fragment>
@@ -254,6 +257,7 @@ const Mention = ({ attributes, children, element }) => {
{children} {children}
</Fragment> </Fragment>
)} )}
</div>
</span> </span>
) )
} }