diff --git a/src/main.tsx b/src/main.tsx index 1aa479bf3..ab5358171 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1750,11 +1750,36 @@ class HistoryInfo extends React.Component<{}, {}> { @mobxReact.observer class CmdInput extends React.Component<{}, {}> { + cmdInputRef : React.RefObject = React.createRef(); + @boundMethod onInfoToggle() : void { GlobalModel.inputModel.toggleInfoMsg(); return; } + + componentDidMount() { + console.log("cmd-input mount", this.cmdInputRef); + let elem = this.cmdInputRef.current; + if (elem == null) { + return; + } + let height = elem.offsetHeight; + mobx.action(() => { + GlobalModel.inputModel.cmdInputHeight.set(height); + })(); + } + + componentDidUpdate(prevProps, prevState, snapshot : {height : number}) : void { + let elem = this.cmdInputRef.current; + if (elem == null) { + return; + } + let height = elem.offsetHeight; + mobx.action(() => { + GlobalModel.inputModel.cmdInputHeight.set(height); + })(); + } render() { let model = GlobalModel; @@ -1782,7 +1807,7 @@ class CmdInput extends React.Component<{}, {}> { let focusVal = inputModel.physicalInputFocused.get(); let inputMode : string = inputModel.inputMode.get(); return ( -
+
@@ -2342,11 +2367,15 @@ class SessionView extends React.Component<{}, {}> { return
(no active session)
; } let activeScreen = session.getActiveScreen(); + let cmdInputHeight = model.inputModel.cmdInputHeight.get(); + if (cmdInputHeight == 0) { + cmdInputHeight = 110; + } return (
-
+
); diff --git a/src/model.ts b/src/model.ts index 3e22a360f..d8bf4d986 100644 --- a/src/model.ts +++ b/src/model.ts @@ -860,6 +860,7 @@ function getDefaultHistoryQueryOpts() : HistoryQueryOpts { class InputModel { historyShow : OV = mobx.observable.box(false); infoShow : OV = mobx.observable.box(false); + cmdInputHeight : OV = mobx.observable.box(0); historyType : mobx.IObservableValue = mobx.observable.box("window"); historyLoading : mobx.IObservableValue = mobx.observable.box(false);