diff --git a/src/MarkdownTextInput.web.tsx b/src/MarkdownTextInput.web.tsx index 13c00e6d..6b3b8849 100644 --- a/src/MarkdownTextInput.web.tsx +++ b/src/MarkdownTextInput.web.tsx @@ -62,6 +62,7 @@ interface MarkdownTextInputProps extends TextInputProps { interface MarkdownNativeEvent extends Event { inputType: string; + data: string; } type Selection = { @@ -337,14 +338,14 @@ const MarkdownTextInput = React.forwardRef( } const changedText = e.target.innerText; - if (compositionRef.current) { + const nativeEvent = e.nativeEvent as MarkdownNativeEvent; + if (compositionRef.current && (nativeEvent.inputType === 'insertCompositionText' || nativeEvent.data !== '*')) { updateTextColor(divRef.current, changedText); compositionRef.current = false; return; } let text = ''; - const nativeEvent = e.nativeEvent as MarkdownNativeEvent; switch (nativeEvent.inputType) { case 'historyUndo': text = undo(divRef.current);