From 6389017d4561954cc0e8683546f212784967a4e5 Mon Sep 17 00:00:00 2001 From: daledah Date: Fri, 19 Dec 2025 12:05:22 +0700 Subject: [PATCH] Add cover submitBehavior prop --- src/MarkdownTextInput.web.tsx | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/MarkdownTextInput.web.tsx b/src/MarkdownTextInput.web.tsx index fa3283df..e1b77c58 100644 --- a/src/MarkdownTextInput.web.tsx +++ b/src/MarkdownTextInput.web.tsx @@ -87,6 +87,7 @@ const MarkdownTextInput = React.forwardRef); - } else if (multiline) { + } else if (multiline && (!shouldSubmit || e.shiftKey)) { // We need to change normal behavior of "Enter" key to insert a line breaks, to prevent wrapping contentEditable text in
tags. // Thanks to that in every situation we have proper amount of new lines in our parsed text. Without it pressing enter in empty lines will add 2 more new lines. insertText(e, '\n'); } - if (!e.shiftKey && ((shouldBlurOnSubmit && hostNode !== null) || !multiline)) { + if (!e.shiftKey && shouldBlurOnSubmit && hostNode !== null) { setTimeout(() => divRef.current && divRef.current.blur(), 0); } } }, - [multiline, blurOnSubmit, setEventProps, onKeyPress, handleOnChangeText, onSubmitEditing, insertText], + [multiline, blurOnSubmit, submitBehavior, setEventProps, onKeyPress, handleOnChangeText, onSubmitEditing, insertText], ); const handleFocus: FocusEventHandler = useCallback(