Hi folks, I’d like to separate input procedure when user type Chinese word using input method.
When inputing a Chinese word, the user first spell them in English letters, and then select the Chinese word with the help of input method, as the gif shows. But after inputing a Chinese word, when the user hit undo(Command/Ctrl+Z), the inputed content is reverted to the English letters, while we expect it to be empty.
GIF of prosemirror official demo.
The behaviour in CodeMirror is expected. GIF of codemirror official demo.
Is there a way to implement the same behaviour in ProseMirror?
During my research, I found that when the editor transaction step contain “你好”, there is a logic in
Branch#addTransform method that will call
steps[i].invert(transform.docs[I]). This line will invert “你好” to “nihao” as the previous
state.doc instead of empty state.