mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
Call makeObservable for all cmdInput classes (#619)
This commit is contained in:
parent
c53e0a99f6
commit
35e0488f7b
@ -61,9 +61,11 @@ class AIChat extends React.Component<{}, {}> {
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
mobx.makeObservable(this);
|
||||
this.chatWindowScrollRef = React.createRef();
|
||||
this.textAreaRef = React.createRef();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const inputModel = GlobalModel.inputModel;
|
||||
if (this.chatWindowScrollRef?.current != null) {
|
||||
|
@ -29,6 +29,11 @@ class CmdInput extends React.Component<{}, {}> {
|
||||
cmdInputRef: React.RefObject<any> = React.createRef();
|
||||
promptRef: React.RefObject<any> = React.createRef();
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
mobx.makeObservable(this);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.updateCmdInputHeight();
|
||||
}
|
||||
|
@ -42,6 +42,11 @@ class HItem extends React.Component<
|
||||
},
|
||||
{}
|
||||
> {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
mobx.makeObservable(this);
|
||||
}
|
||||
|
||||
renderRemote(hitem: HistoryItem): any {
|
||||
if (hitem.remote == null || isBlank(hitem.remote.remoteid)) {
|
||||
return sprintf("%-15s ", "");
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
import * as React from "react";
|
||||
import * as mobxReact from "mobx-react";
|
||||
import * as mobx from "mobx";
|
||||
import { If, For } from "tsx-control-statements/components";
|
||||
import cn from "classnames";
|
||||
import dayjs from "dayjs";
|
||||
@ -17,6 +18,11 @@ dayjs.extend(localizedFormat);
|
||||
|
||||
@mobxReact.observer
|
||||
class InfoMsg extends React.Component<{}, {}> {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
mobx.makeObservable(this);
|
||||
}
|
||||
|
||||
getAfterSlash(s: string): string {
|
||||
if (s.startsWith("^/")) {
|
||||
return s.substring(1);
|
||||
|
@ -250,6 +250,11 @@ class TextAreaInput extends React.Component<{ screen: Screen; onHeightChange: ()
|
||||
lastSP: StrWithPos = { str: "", pos: appconst.NoStrPos };
|
||||
version: OV<number> = mobx.observable.box(0, { name: "textAreaInput-version" }); // forces render updates
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
mobx.makeObservable(this);
|
||||
}
|
||||
|
||||
@mobx.action
|
||||
incVersion(): void {
|
||||
const v = this.version.get();
|
||||
@ -313,8 +318,8 @@ class TextAreaInput extends React.Component<{ screen: Screen; onHeightChange: ()
|
||||
}
|
||||
}
|
||||
|
||||
@mobx.action
|
||||
componentDidMount() {
|
||||
@mobx.action.bound
|
||||
handleComponentDidMount() {
|
||||
const activeScreen = GlobalModel.getActiveScreen();
|
||||
if (activeScreen != null) {
|
||||
const focusType = activeScreen.focusType.get();
|
||||
@ -327,6 +332,10 @@ class TextAreaInput extends React.Component<{ screen: Screen; onHeightChange: ()
|
||||
this.updateSP();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.handleComponentDidMount();
|
||||
}
|
||||
|
||||
@mobx.action
|
||||
componentDidUpdate() {
|
||||
const activeScreen = GlobalModel.getActiveScreen();
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
import type React from "react";
|
||||
import * as mobx from "mobx";
|
||||
import { boundMethod } from "autobind-decorator";
|
||||
import { isBlank } from "@/util/util";
|
||||
import * as appconst from "@/app/appconst";
|
||||
import type { Model } from "./model";
|
||||
@ -75,6 +74,7 @@ class InputModel {
|
||||
|
||||
constructor(globalModel: Model) {
|
||||
this.globalModel = globalModel;
|
||||
mobx.makeObservable(this);
|
||||
mobx.action(() => {
|
||||
this.codeSelectSelectedIndex.set(-1);
|
||||
this.codeSelectBlockRefArray = [];
|
||||
@ -459,7 +459,6 @@ class InputModel {
|
||||
this.giveFocus();
|
||||
}
|
||||
|
||||
@mobx.computed
|
||||
shouldRenderAuxViewKeybindings(view: InputAuxViewType): boolean {
|
||||
if (view != null && this.getActiveAuxView() != view) {
|
||||
return false;
|
||||
@ -723,7 +722,6 @@ class InputModel {
|
||||
}
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
uiSubmitCommand(): void {
|
||||
const commandStr = this.curLine;
|
||||
if (commandStr.trim() == "") {
|
||||
@ -757,7 +755,6 @@ class InputModel {
|
||||
}
|
||||
|
||||
@mobx.action
|
||||
@boundMethod
|
||||
toggleExpandInput(): void {
|
||||
this.inputExpanded.set(!this.inputExpanded.get());
|
||||
this.forceInputFocus = true;
|
||||
|
Loading…
Reference in New Issue
Block a user