improve keystrokes, cleanup

This commit is contained in:
marlon-erler
2026-04-15 12:47:10 +00:00
parent ed8f523a89
commit 091c666ccc
31 changed files with 324 additions and 245 deletions
+6 -3
View File
@@ -27,7 +27,10 @@ export default class CoreViewModel {
history.pushState({ id: context.contextId }, "");
}
closeContext = (contextId: string, fromHistoryEvent: boolean = false): void => {
closeContext = (
contextId: string,
fromHistoryEvent: boolean = false,
): void => {
if (
!this.contexts
.map((context) => context.contextId)
@@ -81,7 +84,7 @@ export default class CoreViewModel {
window.onpopstate = () => {
this.closeContext(this.context.contextId, true);
}
};
}
// util
@@ -110,7 +113,7 @@ export class Context {
this.keystrokes.set(key, fn);
};
constructor(public contextDebugDescription: string) { }
constructor(public contextDebugDescription: string) {}
}
export class ContextHost<T> extends Context {
@@ -171,7 +171,7 @@ export default class FileTransferViewModel extends Context {
handleContextClose = (): void => {
this.presentedModal.value = undefined;
}
};
// init
constructor(public readonly coreViewModel: CoreViewModel) {
+2 -5
View File
@@ -71,7 +71,7 @@ export default class SettingsViewModel extends Context {
if (this.requiresReload.value == true) {
window.location.reload();
}
}
};
// init
constructor(public readonly coreViewModel: CoreViewModel) {
@@ -102,10 +102,7 @@ export default class SettingsViewModel extends Context {
);
// keystrokes
this.registerKeyStroke(
CommonKeys.CloseOrCancel,
this.close,
);
this.registerKeyStroke(CommonKeys.CloseOrCancel, this.close);
}
static generateThemeMedia(): MediaQueryList {
+1 -1
View File
@@ -65,7 +65,7 @@ export default class StorageViewModel extends Context {
return;
}
this.isShowingStorageModal.value = false;
}
};
// init
constructor(public readonly coreViewModel: CoreViewModel) {