mirror of
https://github.com/wavetermdev/backup.git
synced 2026-04-22 15:26:58 -07:00
Compare commits
3 Commits
v0.7.4
...
red/esc-modals
| Author | SHA1 | Date | |
|---|---|---|---|
| 407bddeb33 | |||
| 4c33d24a7b | |||
| f850e3b728 |
@@ -44,7 +44,7 @@ class AlertModal extends React.Component<{}, {}> {
|
||||
<Markdown text={message?.message ?? ""} extraClassName="bottom-margin" />
|
||||
</If>
|
||||
<If condition={!message?.markdown}>{message?.message}</If>
|
||||
<If condition={message.confirmflag}>
|
||||
<If condition={message?.confirmflag}>
|
||||
<Checkbox
|
||||
onChange={this.handleDontShowAgain}
|
||||
label={"Don't show me this again"}
|
||||
|
||||
@@ -206,7 +206,7 @@ class BookmarksModel {
|
||||
}
|
||||
|
||||
handleDocKeyDown(e: any): void {
|
||||
let waveEvent = adaptFromReactOrNativeKeyEvent(e);
|
||||
const waveEvent = adaptFromReactOrNativeKeyEvent(e);
|
||||
if (checkKeyPressed(waveEvent, "Escape")) {
|
||||
e.preventDefault();
|
||||
if (this.editingBookmark.get() != null) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import * as mobx from "mobx";
|
||||
import { Model } from "./model";
|
||||
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil";
|
||||
|
||||
class ClientSettingsViewModel {
|
||||
globalModel: Model;
|
||||
@@ -21,6 +22,15 @@ class ClientSettingsViewModel {
|
||||
this.globalModel.activeMainView.set("clientsettings");
|
||||
})();
|
||||
}
|
||||
|
||||
handleDocKeyDown(e: any): void {
|
||||
const waveEvent = adaptFromReactOrNativeKeyEvent(e);
|
||||
if (checkKeyPressed(waveEvent, "Escape")) {
|
||||
e.preventDefault();
|
||||
this.closeView();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { ClientSettingsViewModel };
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import * as mobx from "mobx";
|
||||
import { Model } from "./model";
|
||||
import { checkKeyPressed, adaptFromReactOrNativeKeyEvent } from "@/util/keyutil";
|
||||
|
||||
class ConnectionsViewModel {
|
||||
globalModel: Model;
|
||||
@@ -21,6 +22,15 @@ class ConnectionsViewModel {
|
||||
this.globalModel.activeMainView.set("connections");
|
||||
})();
|
||||
}
|
||||
|
||||
handleDocKeyDown(e: any): void {
|
||||
const waveEvent = adaptFromReactOrNativeKeyEvent(e);
|
||||
if (checkKeyPressed(waveEvent, "Escape")) {
|
||||
e.preventDefault();
|
||||
this.closeView();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { ConnectionsViewModel };
|
||||
|
||||
@@ -291,7 +291,7 @@ class HistoryViewModel {
|
||||
}
|
||||
|
||||
handleDocKeyDown(e: any): void {
|
||||
let waveEvent = adaptFromReactOrNativeKeyEvent(e);
|
||||
const waveEvent = adaptFromReactOrNativeKeyEvent(e);
|
||||
if (checkKeyPressed(waveEvent, "Escape")) {
|
||||
e.preventDefault();
|
||||
this.closeView();
|
||||
|
||||
@@ -18,10 +18,11 @@ class ModalsModel {
|
||||
}
|
||||
}
|
||||
|
||||
popModal() {
|
||||
popModal(callback?: () => void) {
|
||||
mobx.action(() => {
|
||||
this.store.pop();
|
||||
})();
|
||||
callback && callback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-34
@@ -372,7 +372,6 @@ class Model {
|
||||
cancelAlert(): void {
|
||||
mobx.action(() => {
|
||||
this.alertMessage.set(null);
|
||||
this.modalsModel.popModal();
|
||||
})();
|
||||
if (this.alertPromiseResolver != null) {
|
||||
this.alertPromiseResolver(false);
|
||||
@@ -493,7 +492,7 @@ class Model {
|
||||
if (this.alertMessage.get() != null) {
|
||||
if (checkKeyPressed(waveEvent, "Escape")) {
|
||||
e.preventDefault();
|
||||
this.cancelAlert();
|
||||
this.modalsModel.popModal(() => this.cancelAlert());
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Enter")) {
|
||||
@@ -503,6 +502,10 @@ class Model {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Escape") && this.modalsModel.store.length > 0) {
|
||||
this.modalsModel.popModal();
|
||||
return;
|
||||
}
|
||||
if (this.activeMainView.get() == "bookmarks") {
|
||||
this.bookmarksModel.handleDocKeyDown(e);
|
||||
}
|
||||
@@ -510,10 +513,10 @@ class Model {
|
||||
this.historyViewModel.handleDocKeyDown(e);
|
||||
}
|
||||
if (this.activeMainView.get() == "connections") {
|
||||
this.historyViewModel.handleDocKeyDown(e);
|
||||
this.connectionViewModel.handleDocKeyDown(e);
|
||||
}
|
||||
if (this.activeMainView.get() == "clientsettings") {
|
||||
this.historyViewModel.handleDocKeyDown(e);
|
||||
this.clientSettingsViewModel.handleDocKeyDown(e);
|
||||
} else {
|
||||
if (checkKeyPressed(waveEvent, "Escape")) {
|
||||
e.preventDefault();
|
||||
@@ -521,9 +524,6 @@ class Model {
|
||||
this.showSessionView();
|
||||
return;
|
||||
}
|
||||
if (this.clearModals()) {
|
||||
return;
|
||||
}
|
||||
const inputModel = this.inputModel;
|
||||
inputModel.toggleInfoMsg();
|
||||
if (inputModel.inputMode.get() != null) {
|
||||
@@ -643,33 +643,6 @@ class Model {
|
||||
return screen.getTermWrap(line.lineid);
|
||||
}
|
||||
|
||||
clearModals(): boolean {
|
||||
let didSomething = false;
|
||||
mobx.action(() => {
|
||||
if (this.screenSettingsModal.get()) {
|
||||
this.screenSettingsModal.set(null);
|
||||
didSomething = true;
|
||||
}
|
||||
if (this.sessionSettingsModal.get()) {
|
||||
this.sessionSettingsModal.set(null);
|
||||
didSomething = true;
|
||||
}
|
||||
if (this.screenSettingsModal.get()) {
|
||||
this.screenSettingsModal.set(null);
|
||||
didSomething = true;
|
||||
}
|
||||
if (this.clientSettingsModal.get()) {
|
||||
this.clientSettingsModal.set(false);
|
||||
didSomething = true;
|
||||
}
|
||||
if (this.lineSettingsModal.get()) {
|
||||
this.lineSettingsModal.set(null);
|
||||
didSomething = true;
|
||||
}
|
||||
})();
|
||||
return didSomething;
|
||||
}
|
||||
|
||||
restartWaveSrv(): void {
|
||||
getApi().restartWaveSrv();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user