Slate: Chinese input breaks when using marks

Created on 3 Dec 2018  ·  6Comments  ·  Source: ianstormtaylor/slate

Do you want to request a _feature_ or report a _bug_?


Bug

What's the current behavior?


Input some characters with Chinese IME and then hit "cmd + i" without selecting anything. Input Chinese again and there will be both English and Chinese characters displayed.
The deletion behavior is not as expected either.
on Mojave + Chrome with sougou input method
GIF here

What's the expected behavior?


should only display Chinese.

bug ♥ help ⚑ ime

Most helpful comment

editor.toggleMark(type); if (editor.value.selection.isCollapsed) { editor.insertText('\u200B'); }
@giddens9527

All 6 comments

貌似这是一个普遍的用IME在block尾部编辑会出现的问题,在block中间位置编辑则正常。主要出现在chrome。可以参考一下https://github.com/ianstormtaylor/slate/issues/2062 这个issue。

editor.toggleMark(type); if (editor.value.selection.isCollapsed) { editor.insertText('\u200B'); }
@giddens9527

editor.toggleMark(type); if (editor.value.selection.isCollapsed) { editor.insertText('\u200B'); }
@giddens9527

Worked like a charm! Thanks! Mind explaining why it works?

请问这个问题解决了吗?
这行代码怎么使用?
@giddens9527 @changlin-cn

@Jiang-Rain 我这边就是按toggleMark后面加editor.insertText('\u200B'); 解决的,治标不治本吧。暂时没发现带来其他问题。

Hey, thanks for reporting this. I think this is actually a duplicate of https://github.com/ianstormtaylor/slate/issues/2368, so I'm going to close this in favor of that one. Feel free to comment over there with any other info!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrpeter picture chrpeter  ·  3Comments

bengotow picture bengotow  ·  3Comments

ianstormtaylor picture ianstormtaylor  ·  3Comments

YurkaninRyan picture YurkaninRyan  ·  3Comments

ianstormtaylor picture ianstormtaylor  ·  3Comments