Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/5066 onLayoutReady

Vanessab898f7b4c7ca
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index 6100c80c43..84c33d3dde 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -449,16 +449,20 @@ export const JSONToLayout = (app: App, isStart: boolean) => {
}
const idZoomIn = getIdZoomInByPath();
- // 启动时 layout 中有该文档,该文档还原会在此之后,因此需有延迟
- if (idZoomIn.id) {
- setTimeout(() => {
+
+ setTimeout(() => {
+ // 启动时 layout 中有该文档,该文档还原会在此之后,因此需有延迟
+ if (idZoomIn.id) {
openFileById({
id: idZoomIn.id,
action: idZoomIn.isZoomIn ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT],
zoomIn: idZoomIn.isZoomIn
});
- }, Constants.TIMEOUT_LOAD);
- }
+ }
+ app.plugins.forEach(item => {
+ item.onLayoutReady();
+ })
+ }, Constants.TIMEOUT_LOAD);
};
export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any, dropEditScroll = false) => {
diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts
index 3ea80aa168..5c462c7716 100644
--- a/app/src/plugin/index.ts
+++ b/app/src/plugin/index.ts
@@ -47,6 +47,10 @@ export class Plugin {
// 禁用/卸载
}
+ public onLayoutReady() {
+ // 布局加载完成
+ }
+
public addTopBar(options: {
icon: string,
title: string,