clicking anywhere on the cmdinput will give focus. also fix the click handler for exec to only be on the icon

This commit is contained in:
sawka
2023-10-26 01:40:18 -07:00
parent d8d7d0b7d2
commit f239832435
+13 -3
View File
@@ -67,6 +67,11 @@ class CmdInput extends React.Component<{}, {}> {
GlobalModel.inputModel.giveFocus();
}
@boundMethod
cmdInputClick(): void {
GlobalModel.inputModel.giveFocus();
}
@boundMethod
clickHistoryHint(e: any): void {
e.preventDefault();
@@ -109,7 +114,11 @@ class CmdInput extends React.Component<{}, {}> {
let inputMode: string = inputModel.inputMode.get();
let textAreaInputKey = screen == null ? "null" : screen.screenId;
return (
<div ref={this.cmdInputRef} className={cn("cmd-input", { "has-info": infoShow }, { active: focusVal })}>
<div
ref={this.cmdInputRef}
className={cn("cmd-input", { "has-info": infoShow }, { active: focusVal })}
onClick={this.cmdInputClick}
>
<div key="minmax" onClick={this.onInfoToggle} className="input-minmax-control">
<If condition={infoShow || historyShow}>
<i className="fa-sharp fa-solid fa-chevron-down" />
@@ -156,10 +165,10 @@ class CmdInput extends React.Component<{}, {}> {
</div>
</If>
<TextAreaInput key={textAreaInputKey} onHeightChange={this.handleInnerHeightUpdate} />
<div className="control cmd-exec" onClick={inputModel.uiSubmitCommand}>
<div className="control cmd-exec">
{/**<div onClick={inputModel.toggleExpandInput} className="hint-item color-white">
{inputModel.inputExpanded.get() ? "shrink" : "expand"} input ({renderCmdText("E")})
</div>**/}
</div>**/}
{!focusVal && (
<div onClick={this.clickFocusInputHint} className="cmd-btn hoverEffect">
focus input ({renderCmdText("I")})
@@ -171,6 +180,7 @@ class CmdInput extends React.Component<{}, {}> {
</div>
)}
<ExecIcon
onClick={inputModel.uiSubmitCommand}
className={`icon ${inputModel.getCurLine().trim() === "" ? "disabled" : "hoverEffect"}`}
/>
</div>