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/17556

Vanessaf8cc5d5f29b4
diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.ts
index 34f2e45830..20d0d73f14 100644
--- a/app/src/boot/onGetConfig.ts
+++ b/app/src/boot/onGetConfig.ts
@@ -98,6 +98,9 @@ export const onGetConfig = (isStart: boolean, app: App) => {
}
});
}
+ window.siyuan.dialogs.forEach(item => {
+ item.resize();
+ });
}, Constants.TIMEOUT_RESIZE);
});
};
diff --git a/app/src/dialog/index.ts b/app/src/dialog/index.ts
index 2640886d13..82d8dbcbe6 100644
--- a/app/src/dialog/index.ts
+++ b/app/src/dialog/index.ts
@@ -14,6 +14,7 @@ export class Dialog {
private disableClose: boolean;
public editors: { [key: string]: Protyle };
public data: any;
+ private resizeCallback: (type: string) => void;
constructor(options: {
positionId?: string,
@@ -29,6 +30,7 @@ export class Dialog {
resizeCallback?: (type: string) => void,
containerClassName?: string
}) {
+ this.resizeCallback = options.resizeCallback;
this.disableClose = options.disableClose;
this.id = genUUID();
window.siyuan.dialogs.push(this);
@@ -85,6 +87,15 @@ left:${left || "auto"};top:${top || "auto"}">
/// #endif
}
+ public resize() {
+ if (this.resizeCallback) {
+ const containerElement = this.element.querySelector(".b3-dialog__container") as HTMLElement;
+ if (containerElement && (!containerElement.style.height.endsWith("px") || containerElement.style.width.endsWith("px"))) {
+ this.resizeCallback("rd");
+ }
+ }
+ }
+
public destroy(options?: IObject) {
this.element.classList.remove("b3-dialog--open");
setTimeout(() => {
diff --git a/app/src/window/init.ts b/app/src/window/init.ts
index 3bbe836224..60e1288362 100644
--- a/app/src/window/init.ts
+++ b/app/src/window/init.ts
@@ -77,6 +77,9 @@ export const init = (app: App) => {
}
});
}
+ window.siyuan.dialogs.forEach(item => {
+ item.resize();
+ });
}, Constants.TIMEOUT_RESIZE);
});
};