I found a problem in safari browser when using
It is ok in chrome browser. But I test it in two version’s safari browser (v15.0, v14.1), both have the same problem.
The problem happens on IME composing (input CJK characters) and it’s ok when just input the western characters. Here are details of the problem.
- In empty
thcell, input the CJK characters and it will auto add a new column after inputing.
- In empty
tdcell, input the CJK characters and it will keep both western characters and CJK characters after inputing.
After some research, I think it maybe a bug of webkit engine on handling the caret in nesting element.
Then I try to fix the problem. I tried a lot:
- write some hack css(-webkit-user-modify), but it will make new problems
- read the source code of
prosemirro-view, try to add a hack node or whatelse, but failed
Then I find an issue: IME composing is not working when the cursor is in th tag.
It inspires me. I try to add a zero-width-space on the empty cell, then the CJK characters can be input normally.
Based on above things, I write a plugin to auto insert and delete a zero-width-sapce during input CJK characters. It really solve the problem but I am not sure it is the best way.
Tada, let the community speaks.
The demo: Prosemirror Table (forked) - CodeSandbox
autoInsertZeroSpaceplugin to see the right effect.