diff --git a/site/examples/js/mentions.jsx b/site/examples/js/mentions.jsx index 41c92654e5..080a1839da 100644 --- a/site/examples/js/mentions.jsx +++ b/site/examples/js/mentions.jsx @@ -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 - - {children}@{element.character} - - ) : ( - // Others like Android https://github.com/ianstormtaylor/slate/pull/5360 - - @{element.character} - {children} - - )} + {/* Prevent Chromium from interrupting IME when moving the cursor */} + {/* 1. span + inline-block 2. div + contenteditable=false */} +
+ {IS_MAC ? ( + // Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490 + + {children}@{element.character} + + ) : ( + // Others like Android https://github.com/ianstormtaylor/slate/pull/5360 + + @{element.character} + {children} + + )} +
) } diff --git a/site/examples/ts/mentions.tsx b/site/examples/ts/mentions.tsx index b990c55de8..74d81f4a6b 100644 --- a/site/examples/ts/mentions.tsx +++ b/site/examples/ts/mentions.tsx @@ -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 - - {children}@{element.character} - - ) : ( - // Others like Android https://github.com/ianstormtaylor/slate/pull/5360 - - @{element.character} - {children} - - )} + {/* Prevent Chromium from interrupting IME when moving the cursor */} + {/* 1. span + inline-block 2. div + contenteditable=false */} +
+ {IS_MAC ? ( + // Mac OS IME https://github.com/ianstormtaylor/slate/issues/3490 + + {children}@{element.character} + + ) : ( + // Others like Android https://github.com/ianstormtaylor/slate/pull/5360 + + @{element.character} + {children} + + )} +
) }