From 8f73915322cbda916feb5f87d88bcd7e8aeb18c6 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 26 Sep 2022 20:56:22 +0800 Subject: [PATCH] :bug: fix https://github.com/siyuan-note/siyuan/issues/5891 --- app/src/protyle/index.ts | 2 +- app/src/protyle/toolbar/index.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts index 99bb31bdf..afe4d37c2 100644 --- a/app/src/protyle/index.ts +++ b/app/src/protyle/index.ts @@ -129,7 +129,7 @@ class Protyle { } } // update ref - this.protyle.wysiwyg.element.querySelectorAll(`[data-type="~block-ref"][data-id="${data.data.id}"]`).forEach(item => { + this.protyle.wysiwyg.element.querySelectorAll(`[data-type~="block-ref"][data-id="${data.data.id}"]`).forEach(item => { if (item.getAttribute("data-subtype") === "d") { item.textContent = data.data.title; } diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index e4616c982..890ae46cc 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -578,15 +578,17 @@ export class Toolbar { protyle.toolbar.showRender(protyle, newNodes[0] as HTMLElement, undefined, html); return; } - } - if (type === "inline-memo") { + } else if (type === "inline-memo") { protyle.toolbar.showRender(protyle, newNodes[0] as HTMLElement, newNodes as Element[], html); return; - } - if (type === "a") { + } else if (type === "block-ref") { + this.range.collapse(false); + } else if (type === "a") { const aElement = newNodes[0] as HTMLElement if (aElement.textContent.replace(Constants.ZWSP, "") === "" || !aElement.getAttribute("data-href")) { linkMenu(protyle, aElement, aElement.getAttribute("data-href") ? true : false); + } else { + this.range.collapse(false); } } nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));