11
11
:debounceTime =" meta.debounceTime"
12
12
/>
13
13
<div class =" absolute right-2 bottom-1" >
14
- <Tooltip v-if =" isUntouched" >
14
+ <Tooltip v-if =" isUntouched || (!currentValue.trim() && !isFocused) " >
15
15
<button
16
16
@click.stop =" handleFocus"
17
17
@mousedown.prevent
25
25
</Tooltip >
26
26
27
27
<Spinner v-else-if =" isLoading" class =" w-6 h-6" lightFill =" #000000" darkFill =" #ffffff" />
28
- <Tooltip v-else >
28
+ <Tooltip v-else-if = " isFocused " >
29
29
<button
30
30
@click.stop =" approveCompletion"
31
31
@mousedown.prevent
@@ -64,11 +64,19 @@ const emit = defineEmits([
64
64
65
65
const isLoading = ref <boolean >(false );
66
66
const isUntouched = ref <boolean >(true );
67
+ const isFocused = ref <boolean >(false );
67
68
const currentValue: Ref <string > = ref (' ' );
68
69
const suggestionInputRef = ref <InstanceType <typeof SuggestionInput > | null >(null );
69
70
70
71
onMounted (() => {
71
72
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
+ }
72
80
});
73
81
74
82
watch (() => currentValue .value , (value ) => {
@@ -103,6 +111,7 @@ const approveCompletion = async () => {
103
111
}
104
112
105
113
function handleFocus() {
114
+ isFocused .value = true ;
106
115
if (suggestionInputRef .value ) {
107
116
const editor = suggestionInputRef .value .$el .querySelector (' .ql-editor' );
108
117
if (editor ) {
@@ -111,6 +120,10 @@ function handleFocus() {
111
120
}
112
121
}
113
122
123
+ function handleBlur() {
124
+ isFocused .value = false ;
125
+ }
126
+
114
127
</script >
115
128
116
129
<style >
0 commit comments