fix(history): Align the system editing history group transforms for composition case #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "bugfix/fix-ime-input-prodecure"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Support composition case when typing with IME Pinyin case. it will save history in group by composition end
Using mutable globals in state update logic is not okay. Could you describe the logic you're trying to implement and the problem you're trying to solve a bit more clearly?
I am working on fixing a scenario related to Sougou Pinyin Chinese input integration. When using prosemirror-history with its default time-based grouping, as I type each character in Pinyin, the undo operation rolls back to the previous Pinyin letter state after confirming the candidate word. This behavior is inconsistent with the system editor's native behavior. Therefore, I need to introduce a temporary variable internally to generate a new group at the first "compositionstart" event and another new group at the first input event after the "compositionend" event. This way, the Pinyin input process can be combined into a single group for the Chinese characters output by the IME, and thus aligns with the system editor's behavior.
We can see the default editor behaviour in this video.
https://github.com/ProseMirror/prosemirror-history/assets/9990676/9e35b37a-7c98-469c-b0b8-fcd6ebba51eb
The system editor behaviour will ignore pinyin procedure by composition end, the expected undo operation is revert to empty content not revert to pinyin characters
Attached patch fixes the actual issue that was causing this.
Pull request closed