mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-01 11:12:42 +02:00
fix: chromium interrupt ime (#5736)
This commit is contained in:
@@ -220,18 +220,22 @@ const Mention = ({ attributes, children, element }) => {
|
||||
data-cy={`mention-${element.character.replace(' ', '-')}`}
|
||||
style={style}
|
||||
>
|
||||
{IS_MAC ? (
|
||||
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
|
||||
<Fragment>
|
||||
{children}@{element.character}
|
||||
</Fragment>
|
||||
) : (
|
||||
// Others like Android https://github.com/ianstormtaylor/slate/pull/5360
|
||||
<Fragment>
|
||||
@{element.character}
|
||||
{children}
|
||||
</Fragment>
|
||||
)}
|
||||
{/* Prevent Chromium from interrupting IME when moving the cursor */}
|
||||
{/* 1. span + inline-block 2. div + contenteditable=false */}
|
||||
<div contentEditable={false}>
|
||||
{IS_MAC ? (
|
||||
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
|
||||
<Fragment>
|
||||
{children}@{element.character}
|
||||
</Fragment>
|
||||
) : (
|
||||
// Others like Android https://github.com/ianstormtaylor/slate/pull/5360
|
||||
<Fragment>
|
||||
@{element.character}
|
||||
{children}
|
||||
</Fragment>
|
||||
)}
|
||||
</div>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
@@ -242,18 +242,22 @@ const Mention = ({ attributes, children, element }) => {
|
||||
data-cy={`mention-${element.character.replace(' ', '-')}`}
|
||||
style={style}
|
||||
>
|
||||
{IS_MAC ? (
|
||||
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
|
||||
<Fragment>
|
||||
{children}@{element.character}
|
||||
</Fragment>
|
||||
) : (
|
||||
// Others like Android https://github.com/ianstormtaylor/slate/pull/5360
|
||||
<Fragment>
|
||||
@{element.character}
|
||||
{children}
|
||||
</Fragment>
|
||||
)}
|
||||
{/* Prevent Chromium from interrupting IME when moving the cursor */}
|
||||
{/* 1. span + inline-block 2. div + contenteditable=false */}
|
||||
<div contentEditable={false}>
|
||||
{IS_MAC ? (
|
||||
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
|
||||
<Fragment>
|
||||
{children}@{element.character}
|
||||
</Fragment>
|
||||
) : (
|
||||
// Others like Android https://github.com/ianstormtaylor/slate/pull/5360
|
||||
<Fragment>
|
||||
@{element.character}
|
||||
{children}
|
||||
</Fragment>
|
||||
)}
|
||||
</div>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user