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(