mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
fix another special case ai-chat close + cmd focus issue
This commit is contained in:
parent
02d605a624
commit
51c0c00416
@ -5,7 +5,7 @@ import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { GlobalModel } from "@/models";
|
||||
import { isBlank } from "@/util";
|
||||
import { isBlank } from "@/util/util";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import cn from "classnames";
|
||||
import { For } from "tsx-control-statements/components";
|
||||
@ -92,7 +92,7 @@ class AIChat extends React.Component<{}, {}> {
|
||||
if (checkKeyPressed(waveEvent, "Escape")) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
inputModel.closeAIAssistantChat();
|
||||
inputModel.closeAIAssistantChat(true);
|
||||
}
|
||||
|
||||
if (checkKeyPressed(waveEvent, "Ctrl:l")) {
|
||||
|
@ -232,7 +232,7 @@ class TextAreaInput extends React.Component<{ screen: Screen; onHeightChange: ()
|
||||
if (inputModel.inputMode.get() != null) {
|
||||
inputModel.resetInputMode();
|
||||
}
|
||||
inputModel.closeAIAssistantChat();
|
||||
inputModel.closeAIAssistantChat(true);
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Cmd:e")) {
|
||||
|
@ -618,13 +618,17 @@ class InputModel {
|
||||
})();
|
||||
}
|
||||
|
||||
closeAIAssistantChat(): void {
|
||||
// pass true to give focus to the input (e.g. if this is an 'active' close of the chat)
|
||||
// when resetting the input (when switching screens, don't give focus)
|
||||
closeAIAssistantChat(giveFocus: boolean): void {
|
||||
if (!this.aIChatShow.get()) {
|
||||
return;
|
||||
}
|
||||
mobx.action(() => {
|
||||
this.aIChatShow.set(false);
|
||||
this.giveFocus();
|
||||
if (giveFocus) {
|
||||
this.giveFocus();
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
@ -726,7 +730,7 @@ class InputModel {
|
||||
resetInput(): void {
|
||||
mobx.action(() => {
|
||||
this.setHistoryShow(false);
|
||||
this.closeAIAssistantChat();
|
||||
this.closeAIAssistantChat(false);
|
||||
this.infoShow.set(false);
|
||||
this.inputMode.set(null);
|
||||
this.resetHistory();
|
||||
|
Loading…
Reference in New Issue
Block a user