Skip to content

Commit

Permalink
chore: rename format function
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Dec 11, 2024
1 parent 292f1d8 commit 8f5716b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/MarkdownTextInput.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
[parser, parseText, processedMarkdownStyle],
);

const format = useCallback(
const handleFormatSelection = useCallback(
(target: MarkdownTextInputElement, parsedText: string, cursorPosition: number, formatCommand: string): ParseTextResult => {
if (!contentSelection.current) {
return {
Expand Down Expand Up @@ -400,7 +400,7 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP
case 'formatBold':
case 'formatItalic':
case 'formatUnderline':
newInputUpdate = format(divRef.current, parsedText, newCursorPosition, inputType);
newInputUpdate = handleFormatSelection(divRef.current, parsedText, newCursorPosition, inputType);
break;
default:
newInputUpdate = parseText(parser, divRef.current, parsedText, processedMarkdownStyle, newCursorPosition, true, !inputType, inputType === 'pasteText');
Expand Down Expand Up @@ -455,7 +455,21 @@ const MarkdownTextInput = React.forwardRef<MarkdownTextInput, MarkdownTextInputP

handleContentSizeChange();
},
[parser, updateTextColor, updateSelection, onChange, onChangeText, handleContentSizeChange, undo, redo, format, parseText, processedMarkdownStyle, setEventProps, maxLength],
[
parser,
updateTextColor,
updateSelection,
onChange,
onChangeText,
handleContentSizeChange,
undo,
redo,
handleFormatSelection,
parseText,
processedMarkdownStyle,
setEventProps,
maxLength,
],
);

const insertText = useCallback(
Expand Down

0 comments on commit 8f5716b

Please sign in to comment.