1111 :debounceTime =" meta.debounceTime"
1212 />
1313 <div class =" absolute right-2 bottom-1" >
14- <Tooltip v-if =" isUntouched" >
14+ <Tooltip v-if =" isUntouched || (!currentValue.trim() && !isFocused) " >
1515 <button
1616 @click.stop =" handleFocus"
1717 @mousedown.prevent
2525 </Tooltip >
2626
2727 <Spinner v-else-if =" isLoading" class =" w-6 h-6" lightFill =" #000000" darkFill =" #ffffff" />
28- <Tooltip v-else >
28+ <Tooltip v-else-if = " isFocused " >
2929 <button
3030 @click.stop =" approveCompletion"
3131 @mousedown.prevent
@@ -64,11 +64,19 @@ const emit = defineEmits([
6464
6565const isLoading = ref <boolean >(false );
6666const isUntouched = ref <boolean >(true );
67+ const isFocused = ref <boolean >(false );
6768const currentValue: Ref <string > = ref (' ' );
6869const suggestionInputRef = ref <InstanceType <typeof SuggestionInput > | null >(null );
6970
7071onMounted (() => {
7172 currentValue .value = props .record [props .column .name ] || ' ' ;
73+ if (suggestionInputRef .value ) {
74+ const editor = suggestionInputRef .value .$el .querySelector (' .ql-editor' );
75+ if (editor ) {
76+ editor .addEventListener (' focus' , handleFocus );
77+ editor .addEventListener (' blur' , handleBlur );
78+ }
79+ }
7280});
7381
7482watch (() => currentValue .value , (value ) => {
@@ -103,6 +111,7 @@ const approveCompletion = async () => {
103111}
104112
105113function handleFocus() {
114+ isFocused .value = true ;
106115 if (suggestionInputRef .value ) {
107116 const editor = suggestionInputRef .value .$el .querySelector (' .ql-editor' );
108117 if (editor ) {
@@ -111,6 +120,10 @@ function handleFocus() {
111120 }
112121}
113122
123+ function handleBlur() {
124+ isFocused .value = false ;
125+ }
126+
114127 </script >
115128
116129<style >
0 commit comments