File tree 2 files changed +18
-3
lines changed
gui/src/components/mainInput
2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -225,15 +225,15 @@ function InputToolbar(props: InputToolbarProps) {
225
225
} }
226
226
disabled = { isEnterDisabled }
227
227
>
228
- < div data-tooltip-id = "submit-tooltip" >
228
+ < span data-tooltip-id = "submit-tooltip" >
229
229
< PaperAirplaneIcon
230
230
className = { `h-4 w-4 ${
231
231
props . hasText
232
232
? "text-[var(--vscode-editorForeground)]"
233
233
: "text-[var(--vscode-descriptionForeground)]"
234
234
} transition duration-150 ease-in-out`}
235
235
/>
236
- </ div >
236
+ </ span >
237
237
< ToolTip id = "submit-tooltip" place = "top-middle" >
238
238
Send (Enter)
239
239
</ ToolTip >
Original file line number Diff line number Diff line change @@ -551,6 +551,21 @@ function TipTapEditor(props: TipTapEditorProps) {
551
551
editable : ! isStreaming || props . isMainInput ,
552
552
} ) ;
553
553
554
+ const [ hasText , setHasText ] = useState ( false ) ;
555
+ useEffect ( ( ) => {
556
+ if ( ! editor ) return ;
557
+ // Check if the editor has text
558
+ const updateEditorHandler = ( ) => {
559
+ const text = editor . getText ( ) . trim ( ) ;
560
+ setHasText ( text . length > 0 ) ;
561
+ } ;
562
+ editor . on ( "update" , updateEditorHandler ) ;
563
+ updateEditorHandler ( ) ;
564
+ return ( ) => {
565
+ editor . off ( "update" , updateEditorHandler ) ;
566
+ } ;
567
+ } , [ editor ] ) ;
568
+
554
569
const [ shouldHideToolbar , setShouldHideToolbar ] = useState ( false ) ;
555
570
const debouncedShouldHideToolbar = debounce ( ( value ) => {
556
571
setShouldHideToolbar ( value ) ;
@@ -1015,7 +1030,7 @@ function TipTapEditor(props: TipTapEditorProps) {
1015
1030
} ) ;
1016
1031
} }
1017
1032
disabled = { isStreaming }
1018
- hasText = { editor ? editor . getText ( ) . trim ( ) . length > 0 : false }
1033
+ hasText = { hasText }
1019
1034
/>
1020
1035
</ div >
1021
1036
You can’t perform that action at this time.
0 commit comments