Skip to content

Commit 387eea1

Browse files
authored
Update inputUtils.ts
1 parent 1dcae78 commit 387eea1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/web/utils/inputUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ function parseInnerHTMLToText(target: MarkdownTextInputElement, cursorPosition:
6767
if (isTopComponent) {
6868
// When inputType is undefined, the first part of the replaced text is added as a text node.
6969
// Because of it, we need to prevent adding new lines in this case
70-
if (!isMultiline && !inputType && node.nodeType === Node.TEXT_NODE) {
70+
if (!inputType && node.nodeType === Node.TEXT_NODE) {
7171
shouldAddNewline = false;
7272
} else {
7373
const firstChild = node.firstChild as HTMLElement;
7474
const containsEmptyBlockElement = firstChild?.getAttribute?.('data-type') === 'block' && firstChild.textContent === '';
7575
// Only add newlines for multiline inputs
76-
if (shouldAddNewline && !containsEmptyBlockElement) {
76+
if (isMultiline && shouldAddNewline && !containsEmptyBlockElement) {
7777
text += '\n';
7878
shouldAddNewline = false;
7979
}

0 commit comments

Comments
 (0)