Vanessa 2022-10-05 10:12:21 +08:00
parent a87f096fb1
commit c20da40cd7
9 changed files with 32 additions and 26 deletions

View file

@ -4,6 +4,7 @@ import {Model} from "../layout/Model";
import {disabledProtyle} from "../protyle/util/onGet";
import {setPadding} from "../protyle/ui/initUI";
import {getAllModels} from "../layout/getAll";
import {countBlockWord} from "../layout/status";
export class Editor extends Model {
public element: HTMLElement;
@ -60,6 +61,7 @@ export class Editor extends Model {
}
});
}
countBlockWord([], editor.protyle.block.rootID);
},
});
// 需在 after 回调之前,否则不会聚焦 https://github.com/siyuan-note/siyuan/issues/5303

View file

@ -317,7 +317,7 @@ export const updatePanelByEditor = (protyle?: IProtyle, focus = true, pushBackSt
if (focus) {
if (protyle.toolbar.range) {
focusByRange(protyle.toolbar.range);
countSelectWord(protyle.toolbar.range);
countSelectWord(protyle.toolbar.range, protyle.block.rootID);
if (pushBackStack && protyle.preview.element.classList.contains("fn__none")) {
pushBack(protyle, protyle.toolbar.range);
}
@ -326,8 +326,7 @@ 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([]);
countBlockWord([], protyle.block.rootID);
}
}
if (window.siyuan.config.fileTree.alwaysSelectOpenedFile && protyle) {