Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: fix https://github.com/siyuan-note/siyuan/issues/5328

Vanessaae60245014df
diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts
index f740e5dd51..c3c9c207ae 100644
--- a/app/src/editor/util.ts
+++ b/app/src/editor/util.ts
@@ -27,6 +27,7 @@ import {
import {getPreviousHeading} from "../protyle/wysiwyg/getBlock";
import {lockFile, setTitle} from "../dialog/processSystem";
import {zoomOut} from "../menus/protyle";
+import {countBlockWord, countSelectWord} from "../layout/status";
export const openFileById = (options: {
id: string,
@@ -315,6 +316,7 @@ export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackSt
if (focus) {
if (protyle.toolbar.range) {
focusByRange(protyle.toolbar.range);
+ countSelectWord(protyle.toolbar.range);
if (pushBackStack && protyle.preview.element.classList.contains("fn__none")) {
pushBack(protyle, protyle.toolbar.range);
}
@@ -323,6 +325,8 @@ export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackSt
if (pushBackStack && protyle.preview.element.classList.contains("fn__none")) {
pushBack(protyle, undefined, protyle.wysiwyg.element.firstElementChild);
}
+ // 用于清空状态栏字数统计
+ countBlockWord([]);
}
}
if (window.siyuan.config.fileTree.alwaysSelectOpenedFile && protyle) {
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts
index f9411a4c8d..41e9c595bf 100644
--- a/app/src/layout/Wnd.ts
+++ b/app/src/layout/Wnd.ts
@@ -25,6 +25,7 @@ import {scrollCenter} from "../util/highlightById";
import {getAllModels} from "./getAll";
import {fetchPost} from "../util/fetch";
import {onGet} from "../protyle/util/onGet";
+import {countBlockWord} from "./status";
export class Wnd {
public id: string;
@@ -460,6 +461,7 @@ export class Wnd {
}
});
model.editor.destroy();
+ countBlockWord([]);
return;
}
if (model instanceof Search) {