From 673114dac65edff1824cf69842458d1540c0622c Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 30 Sep 2022 10:52:47 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/6020 --- app/src/protyle/wysiwyg/enter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts index 82fa2c3e0..b28a0f5fc 100644 --- a/app/src/protyle/wysiwyg/enter.ts +++ b/app/src/protyle/wysiwyg/enter.ts @@ -151,7 +151,7 @@ const listEnter = (protyle: IProtyle, blockElement: HTMLElement, range: Range) = selectNode.firstChild.remove(); } // https://github.com/siyuan-note/siyuan/issues/3850 - if (editableElement?.lastElementChild?.getAttribute("data-type").indexOf("inline-math") > -1 && + if ((editableElement?.lastElementChild?.getAttribute("data-type") || "").indexOf("inline-math") > -1 && !hasNextSibling(editableElement?.lastElementChild)) { editableElement.insertAdjacentText("beforeend", "\n"); } @@ -363,7 +363,7 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle selectNode.firstChild.remove(); } // https://github.com/siyuan-note/siyuan/issues/3850 - if (editableElement?.lastElementChild?.getAttribute("data-type").indexOf("inline-math") > -1 && + if ((editableElement?.lastElementChild?.getAttribute("data-type") || "").indexOf("inline-math") > -1 && !hasNextSibling(editableElement?.lastElementChild)) { editableElement.insertAdjacentText("beforeend", "\n"); }