I find the workaround solution to fix.
Here is the code.
let composingStart = false;
let compositionStartTime = NaN;
// define customize history plugin,
new Plugin({
key: new PluginKey('CustomizeHistory'),
props: {
// overwrite handleTextInput merge composition events in single historyState by set same transaction time
handleTextInput: (view, chFrom, chTo, text) => {
if (view.composing) {
if (composingStart === false) {
composingStart = true;
compositionStartTime = Date.now();
}
view.dispatch(
view.state.tr
.insertText(text, chFrom, chTo)
.setTime(compositionStartTime)
);
return true;
}
if (composingStart === true) {
composingStart = false;
view.dispatch(
view.state.tr
.insertText(text, chFrom, chTo)
.setTime(compositionStartTime),
);
return true;
}
return false;
},
},
});