Skip to content

Commit

Permalink
fix: remove unnecessary conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszGrajdek committed Mar 1, 2024
1 parent e92290e commit 5cf88db
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/web/parserUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ function parseText(

const markdownRanges: MarkdownRange[] = ranges as MarkdownRange[];

let appended = false;

// We don't want to parse text with single '\n', because contentEditable represents it as invisible <br />
if (!!text && text !== '\n') {
const dom = parseRangesToHTMLNodes(text, markdownRanges, markdownStyle);
Expand All @@ -191,8 +189,6 @@ function parseText(
targetElement.innerText = '';
target.appendChild(dom);

appended = true;

if (alwaysMoveCursorToTheEnd) {
CursorUtils.moveCursorToEnd(target);
} else if (isFocused && cursorPosition !== null) {
Expand All @@ -201,7 +197,7 @@ function parseText(
}
}

return {text: appended ? text : target.innerText, cursorPosition: cursorPosition || 0};
return {text: target.innerText, cursorPosition: cursorPosition || 0};
}

export {parseText, parseRangesToHTMLNodes};
Expand Down

0 comments on commit 5cf88db

Please sign in to comment.