feat: enhance LoraModal with notes hint and cleanup functionality on close

This commit is contained in:
Will Miao
2025-06-21 20:02:19 +08:00
parent fa0902dc74
commit ba2e42b06e
3 changed files with 36 additions and 36 deletions

View File

@@ -299,7 +299,7 @@ export class ModalManager {
return null;
}
showModal(id, content = null, onCloseCallback = null) {
showModal(id, content = null, onCloseCallback = null, cleanupCallback = null) {
const modal = this.getModal(id);
if (!modal) return;
@@ -314,9 +314,8 @@ export class ModalManager {
}
// Store callback
if (onCloseCallback) {
modal.onCloseCallback = onCloseCallback;
}
modal.onCloseCallback = onCloseCallback;
modal.cleanupCallback = cleanupCallback;
// Store current scroll position before showing modal
this.scrollPosition = window.scrollY;
@@ -362,6 +361,11 @@ export class ModalManager {
modal.onCloseCallback();
modal.onCloseCallback = null;
}
if (modal.cleanupCallback) {
modal.cleanupCallback();
modal.cleanupCallback = null;
}
}
handleEscape(e) {