From 2a3372ff5c28c938a8535840360ebea6bed46735 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 18 Aug 2022 18:20:49 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=E5=88=A0=E9=99=A4=E5=90=8E=E5=AD=97?= =?UTF-8?q?=E6=95=B0=E7=BB=9F=E8=AE=A1=E6=B2=A1=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/toolbar/index.ts | 9 ++++++--- app/src/protyle/wysiwyg/keydown.ts | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index 2d65790ee..96931851d 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -1022,10 +1022,13 @@ export class Toolbar { fetchPost("/api/search/searchTemplate", { k: "", }, (response) => { - let html = `
  • ${window.siyuan.languages.emptyContent}
  • `; + let html = ""; response.data.blocks.forEach((item: { path: string, content: string }, index: number) => { html += `
    ${item.content}
    `; }); + if (html === "") { + html = `
  • ${window.siyuan.languages.emptyContent}
  • `; + } this.subElement.style.width = ""; this.subElement.style.padding = ""; this.subElement.innerHTML = `
    @@ -1060,11 +1063,11 @@ export class Toolbar { fetchPost("/api/search/searchTemplate", { k: inputElement.value, }, (response) => { - let searchHTML = `
  • ${window.siyuan.languages.emptyContent}
  • `; + let searchHTML = ""; response.data.blocks.forEach((item: { path: string, content: string }, index: number) => { searchHTML += `
    ${item.content}
    `; }); - this.subElement.firstElementChild.lastElementChild.innerHTML = searchHTML; + this.subElement.firstElementChild.lastElementChild.innerHTML = searchHTML || `
  • ${window.siyuan.languages.emptyContent}
  • `; }); }); this.subElement.lastElementChild.addEventListener("click", (event) => { diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index fcd473353..2e297d041 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -663,6 +663,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { const selectText = range.toString(); // 删除,不可使用 !isCtrl(event),否则软删除回导致 https://github.com/siyuan-note/siyuan/issues/5607 if (!event.altKey && !event.shiftKey && (event.key === "Backspace" || event.key === "Delete")) { + countBlockWord([]); // https://github.com/siyuan-note/siyuan/issues/5547 const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement; if (range.startOffset === 1 && range.startContainer.textContent === Constants.ZWSP &&