diff --git a/src/app/common/elements/markdown.tsx b/src/app/common/elements/markdown.tsx index 1fca32a5..a88386e4 100644 --- a/src/app/common/elements/markdown.tsx +++ b/src/app/common/elements/markdown.tsx @@ -43,17 +43,16 @@ class CodeBlockMarkdown extends React.Component< this.blockIndex = GlobalModel.inputModel.addCodeBlockToCodeSelect(this.blockRef, this.props.uuid); } + @boundMethod + handleClick(e: React.MouseEvent) { + console.log("this.blockIndex", this.blockIndex); + GlobalModel.inputModel.setCodeSelectSelectedCodeBlock(this.blockIndex); + } + render() { - const clickHandler = (e: React.MouseEvent, blockIndex: number) => { - GlobalModel.inputModel.setCodeSelectSelectedCodeBlock(blockIndex); - }; let selected = this.blockIndex == this.props.codeSelectSelectedIndex; return ( -
 clickHandler(event, this.blockIndex)}
-            >
+            
                 {this.props.children}
             
); diff --git a/src/app/sidebar/aichat.tsx b/src/app/sidebar/aichat.tsx index 1890171e..c8d847fd 100644 --- a/src/app/sidebar/aichat.tsx +++ b/src/app/sidebar/aichat.tsx @@ -161,6 +161,26 @@ class AIChat extends React.Component<{}, {}> { chatWindowRef: React.RefObject = React.createRef(); termFontSize: number = 14; + componentDidMount() { + const inputModel = GlobalModel.inputModel; + + inputModel.openAIAssistantChat(); + + if (this.textAreaRef.current != null) { + this.textAreaRef.current.focus(); + inputModel.setCmdInfoChatRefs(this.textAreaRef, this.chatWindowRef); + } + this.requestChatUpdate(); + this.onTextAreaChange(null); + } + + requestChatUpdate() { + const chatMessageItems = GlobalModel.inputModel.AICmdInfoChatItems.slice(); + if (chatMessageItems == null || chatMessageItems.length == 0) { + this.submitChatMessage(""); + } + } + // Adjust the height of the textarea to fit the text @boundMethod onTextAreaChange(e: any) { @@ -183,26 +203,6 @@ class AIChat extends React.Component<{}, {}> { GlobalModel.inputModel.codeSelectDeselectAll(); } - componentDidMount() { - const inputModel = GlobalModel.inputModel; - - inputModel.openAIAssistantChat(); - - if (this.textAreaRef.current != null) { - this.textAreaRef.current.focus(); - inputModel.setCmdInfoChatRefs(this.textAreaRef, this.chatWindowRef); - } - this.requestChatUpdate(); - this.onTextAreaChange(null); - } - - requestChatUpdate() { - const chatMessageItems = GlobalModel.inputModel.AICmdInfoChatItems.slice(); - if (chatMessageItems == null || chatMessageItems.length == 0) { - this.submitChatMessage(""); - } - } - submitChatMessage(messageStr: string) { const curLine = GlobalModel.inputModel.curLine; const prtn = GlobalModel.submitChatInfoCommand(messageStr, curLine, false); @@ -222,7 +222,6 @@ class AIChat extends React.Component<{}, {}> { @mobx.action @boundMethod onTextAreaFocused(e: any) { - console.log("focused"); GlobalModel.inputModel.setAuxViewFocus(true); GlobalModel.inputModel.setActiveAuxView(appconst.InputAuxView_AIChat); @@ -307,8 +306,7 @@ class AIChat extends React.Component<{}, {}> { render() { const chatMessageItems = GlobalModel.inputModel.AICmdInfoChatItems.slice(); const renderAIChatKeybindings = GlobalModel.inputModel.shouldRenderAuxViewKeybindings( - appconst.InputAuxView_AIChat, - "sidebar" + appconst.InputAuxView_AIChat ); console.log("renderAIChatKeybindings=====", renderAIChatKeybindings); return ( diff --git a/src/models/input.ts b/src/models/input.ts index 7b2bc8d9..2a239eda 100644 --- a/src/models/input.ts +++ b/src/models/input.ts @@ -460,7 +460,7 @@ class InputModel { this.giveFocus(); } - shouldRenderAuxViewKeybindings(view: InputAuxViewType, test?: string): boolean { + shouldRenderAuxViewKeybindings(view: InputAuxViewType): boolean { console.log("view", view, this.getAuxViewFocus(), this.getActiveAuxView()); if (GlobalModel.activeMainView.get() != "session") { console.log("1");