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