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:
@@ -220,18 +220,22 @@ const Mention = ({ attributes, children, element }) => {
|
|||||||
data-cy={`mention-${element.character.replace(' ', '-')}`}
|
data-cy={`mention-${element.character.replace(' ', '-')}`}
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
{IS_MAC ? (
|
{/* Prevent Chromium from interrupting IME when moving the cursor */}
|
||||||
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
|
{/* 1. span + inline-block 2. div + contenteditable=false */}
|
||||||
<Fragment>
|
<div contentEditable={false}>
|
||||||
{children}@{element.character}
|
{IS_MAC ? (
|
||||||
</Fragment>
|
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
|
||||||
) : (
|
<Fragment>
|
||||||
// Others like Android https://github.com/ianstormtaylor/slate/pull/5360
|
{children}@{element.character}
|
||||||
<Fragment>
|
</Fragment>
|
||||||
@{element.character}
|
) : (
|
||||||
{children}
|
// Others like Android https://github.com/ianstormtaylor/slate/pull/5360
|
||||||
</Fragment>
|
<Fragment>
|
||||||
)}
|
@{element.character}
|
||||||
|
{children}
|
||||||
|
</Fragment>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -242,18 +242,22 @@ const Mention = ({ attributes, children, element }) => {
|
|||||||
data-cy={`mention-${element.character.replace(' ', '-')}`}
|
data-cy={`mention-${element.character.replace(' ', '-')}`}
|
||||||
style={style}
|
style={style}
|
||||||
>
|
>
|
||||||
{IS_MAC ? (
|
{/* Prevent Chromium from interrupting IME when moving the cursor */}
|
||||||
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
|
{/* 1. span + inline-block 2. div + contenteditable=false */}
|
||||||
<Fragment>
|
<div contentEditable={false}>
|
||||||
{children}@{element.character}
|
{IS_MAC ? (
|
||||||
</Fragment>
|
// Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490
|
||||||
) : (
|
<Fragment>
|
||||||
// Others like Android https://github.com/ianstormtaylor/slate/pull/5360
|
{children}@{element.character}
|
||||||
<Fragment>
|
</Fragment>
|
||||||
@{element.character}
|
) : (
|
||||||
{children}
|
// Others like Android https://github.com/ianstormtaylor/slate/pull/5360
|
||||||
</Fragment>
|
<Fragment>
|
||||||
)}
|
@{element.character}
|
||||||
|
{children}
|
||||||
|
</Fragment>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user