Skip to content

Commit

Permalink
Move updateTextColor function
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed Jul 3, 2024
1 parent e24d259 commit 092775d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,12 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
const isPasteInputType = nativeEvent.inputType === 'pasteText';

const parsedText = isPasteInputType ? divRef.current.value : parseInnerHTMLToText(e.target);
updateTextColor(divRef.current, parsedText);

const tree = buildTree(divRef.current, parsedText);
divRef.current.tree = tree;

if (compositionRef.current && !BrowserUtils.isMobile) {
updateTextColor(divRef.current, parsedText);
compositionRef.current = false;
return;
}
Expand All @@ -284,8 +285,6 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>(
text = parseText(divRef.current, parsedText, processedMarkdownStyle, nativeEvent.inputType === 'pasteText' ? contentSelection.current?.start : null).text;
}

updateTextColor(divRef.current, text);

if (onChange) {
const event = e as unknown as NativeSyntheticEvent<any>;
setEventProps(event);
Expand Down

0 comments on commit 092775d

Please sign in to comment.