improve keystrokes, cleanup
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -65,7 +65,7 @@ export default class StorageViewModel extends Context {
|
||||
return;
|
||||
}
|
||||
this.isShowingStorageModal.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// init
|
||||
constructor(public readonly coreViewModel: CoreViewModel) {
|
||||
|
||||
Reference in New Issue
Block a user