An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug:删除后字数统计没更新
Vanessa2a3372ff5c28
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 2d65790ee6..96931851d6 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 = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;+ let html = "";response.data.blocks.forEach((item: { path: string, content: string }, index: number) => {html += `<div data-value="${item.path}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">${item.content}</div>`;});+ if (html === "") {+ html = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;+ }this.subElement.style.width = "";this.subElement.style.padding = "";this.subElement.innerHTML = `<div class="fn__flex-column" style="max-height:50vh"><input style="margin: 4px 8px 8px 8px" class="b3-text-field"/>@@ -1060,11 +1063,11 @@ export class Toolbar {fetchPost("/api/search/searchTemplate", {k: inputElement.value,}, (response) => {- let searchHTML = `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;+ let searchHTML = "";response.data.blocks.forEach((item: { path: string, content: string }, index: number) => {searchHTML += `<div data-value="${item.path}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">${item.content}</div>`;});- this.subElement.firstElementChild.lastElementChild.innerHTML = searchHTML;+ this.subElement.firstElementChild.lastElementChild.innerHTML = searchHTML || `<li class="b3-list--empty">${window.siyuan.languages.emptyContent}</li>`;});});this.subElement.lastElementChild.addEventListener("click", (event) => {diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex fcd473353e..2e297d0411 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/5607if (!event.altKey && !event.shiftKey && (event.key === "Backspace" || event.key === "Delete")) {+ countBlockWord([]);// https://github.com/siyuan-note/siyuan/issues/5547const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement;if (range.startOffset === 1 && range.startContainer.textContent === Constants.ZWSP &&