Skip to content

Commit

Permalink
fix: IOU - one character descriptions are not saved
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-liang committed May 22, 2024
1 parent 377ab57 commit 423e963
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ interface MarkdownTextInputProps extends TextInputProps {

interface MarkdownNativeEvent extends Event {
inputType: string;
data: string;
}

type Selection = {
Expand Down Expand Up @@ -337,14 +338,14 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
}
const changedText = e.target.innerText;

if (compositionRef.current) {
updateTextColor(divRef.current, changedText);
const nativeEvent = e.nativeEvent as MarkdownNativeEvent;
if (compositionRef.current && (nativeEvent.inputType !== 'insertCompositionText' || nativeEvent.data !== '*')) {
updateTextColor(divRef.current, e.target.innerText);
compositionRef.current = false;
return;
}

let text = '';
const nativeEvent = e.nativeEvent as MarkdownNativeEvent;
switch (nativeEvent.inputType) {
case 'historyUndo':
text = undo(divRef.current);
Expand Down

0 comments on commit 423e963

Please sign in to comment.