mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-17 20:51:55 +01:00
Fixes a regression that would unfocus from the history input (#615)
* Fixes a regression that would unfocus from the history input * remove debug statements * Update historyinfo.tsx * fix scrolling the right way
This commit is contained in:
parent
4296856cc1
commit
50662c2152
@ -104,15 +104,11 @@ class AIChat extends React.Component<{}, {}> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onTextAreaFocused(e: any) {
|
onTextAreaFocused(e: any) {
|
||||||
mobx.action(() => {
|
GlobalModel.inputModel.setAuxViewFocus(true);
|
||||||
GlobalModel.inputModel.setAuxViewFocus(true);
|
|
||||||
})();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextAreaBlur(e: any) {
|
onTextAreaBlur(e: any) {
|
||||||
mobx.action(() => {
|
GlobalModel.inputModel.setAuxViewFocus(false);
|
||||||
GlobalModel.inputModel.setAuxViewFocus(false);
|
|
||||||
})();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust the height of the textarea to fit the text
|
// Adjust the height of the textarea to fit the text
|
||||||
|
@ -16,11 +16,12 @@ interface AuxiliaryCmdViewProps {
|
|||||||
titleBarContents?: React.ReactElement[];
|
titleBarContents?: React.ReactElement[];
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
onClose?: React.MouseEventHandler<HTMLDivElement>;
|
onClose?: React.MouseEventHandler<HTMLDivElement>;
|
||||||
|
onScrollbarInitialized?: () => void;
|
||||||
scrollable?: boolean;
|
scrollable?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AuxiliaryCmdView: React.FC<AuxiliaryCmdViewProps> = observer((props) => {
|
export const AuxiliaryCmdView: React.FC<AuxiliaryCmdViewProps> = observer((props) => {
|
||||||
const { title, className, iconClass, titleBarContents, children, onClose } = props;
|
const { title, className, iconClass, titleBarContents, children, onClose, onScrollbarInitialized } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn("auxview", className)}>
|
<div className={cn("auxview", className)}>
|
||||||
@ -50,6 +51,8 @@ export const AuxiliaryCmdView: React.FC<AuxiliaryCmdViewProps> = observer((props
|
|||||||
<OverlayScrollbarsComponent
|
<OverlayScrollbarsComponent
|
||||||
className="auxview-content"
|
className="auxview-content"
|
||||||
options={{ scrollbars: { autoHide: "leave" } }}
|
options={{ scrollbars: { autoHide: "leave" } }}
|
||||||
|
defer={true}
|
||||||
|
events={{ initialized: onScrollbarInitialized }}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</OverlayScrollbarsComponent>
|
</OverlayScrollbarsComponent>
|
||||||
|
@ -73,7 +73,6 @@ class CmdInput extends React.Component<{}, {}> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GlobalModel.inputModel.setAuxViewFocus(false);
|
GlobalModel.inputModel.setAuxViewFocus(false);
|
||||||
GlobalModel.inputModel.giveFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
@ -232,12 +231,7 @@ class CmdInput extends React.Component<{}, {}> {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</If>
|
</If>
|
||||||
<div
|
<div key="base-cmdinput" className="base-cmdinput" onClick={this.baseCmdInputClick}>
|
||||||
key="base-cmdinput"
|
|
||||||
className="base-cmdinput"
|
|
||||||
onClick={this.baseCmdInputClick}
|
|
||||||
onSelect={this.baseCmdInputClick}
|
|
||||||
>
|
|
||||||
<div className="cmdinput-actions">
|
<div className="cmdinput-actions">
|
||||||
<If condition={numRunningLines > 0}>
|
<If condition={numRunningLines > 0}>
|
||||||
<div
|
<div
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
.history-items {
|
.history-items {
|
||||||
color: var(--app-text-color);
|
color: var(--app-text-color);
|
||||||
height: 100%;
|
display: flex;
|
||||||
width: 100%;
|
flex-direction: column-reverse;
|
||||||
|
|
||||||
.history-item {
|
.history-item {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -154,7 +154,11 @@ class HistoryInfo extends React.Component<{}, {}> {
|
|||||||
lastClickTs: number = 0;
|
lastClickTs: number = 0;
|
||||||
containingText: mobx.IObservableValue<string> = mobx.observable.box("");
|
containingText: mobx.IObservableValue<string> = mobx.observable.box("");
|
||||||
|
|
||||||
componentDidMount() {
|
/**
|
||||||
|
* Handles the OverlayScrollbars initialization event to set the scroll position without it being overridden.
|
||||||
|
*/
|
||||||
|
@boundMethod
|
||||||
|
handleScrollbarInitialized() {
|
||||||
const inputModel = GlobalModel.inputModel;
|
const inputModel = GlobalModel.inputModel;
|
||||||
let hitem = inputModel.getHistorySelectedItem();
|
let hitem = inputModel.getHistorySelectedItem();
|
||||||
if (hitem == null) {
|
if (hitem == null) {
|
||||||
@ -225,7 +229,7 @@ class HistoryInfo extends React.Component<{}, {}> {
|
|||||||
render() {
|
render() {
|
||||||
const inputModel = GlobalModel.inputModel;
|
const inputModel = GlobalModel.inputModel;
|
||||||
const selItem = inputModel.getHistorySelectedItem();
|
const selItem = inputModel.getHistorySelectedItem();
|
||||||
const hitems = inputModel.getFilteredHistoryItems().slice().reverse();
|
const hitems = inputModel.getFilteredHistoryItems();
|
||||||
const opts = inputModel.historyQueryOpts.get();
|
const opts = inputModel.historyQueryOpts.get();
|
||||||
let hitem: HistoryItem = null;
|
let hitem: HistoryItem = null;
|
||||||
let snames: Record<string, string> = {};
|
let snames: Record<string, string> = {};
|
||||||
@ -244,6 +248,7 @@ class HistoryInfo extends React.Component<{}, {}> {
|
|||||||
titleBarContents={this.getTitleBarContents()}
|
titleBarContents={this.getTitleBarContents()}
|
||||||
iconClass="fa-sharp fa-solid fa-clock-rotate-left"
|
iconClass="fa-sharp fa-solid fa-clock-rotate-left"
|
||||||
scrollable={true}
|
scrollable={true}
|
||||||
|
onScrollbarInitialized={this.handleScrollbarInitialized}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
|
@ -151,7 +151,7 @@ class InputModel {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "aichat":
|
case appconst.InputAuxView_AIChat:
|
||||||
this.setAIChatFocus();
|
this.setAIChatFocus();
|
||||||
break;
|
break;
|
||||||
case null: {
|
case null: {
|
||||||
@ -549,7 +549,6 @@ class InputModel {
|
|||||||
|
|
||||||
if (info != null && timeoutMs) {
|
if (info != null && timeoutMs) {
|
||||||
this.infoTimeoutId = setTimeout(() => {
|
this.infoTimeoutId = setTimeout(() => {
|
||||||
console.log("clearing info msg");
|
|
||||||
if (this.activeAuxView.get() != appconst.InputAuxView_Info) {
|
if (this.activeAuxView.get() != appconst.InputAuxView_Info) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user