@fy-/fws-vue 0.3.32 → 0.3.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -131,9 +131,9 @@ defineExpose({ focus, blur, getInputRef });
|
|
|
131
131
|
>
|
|
132
132
|
<label
|
|
133
133
|
:for="id"
|
|
134
|
-
v-if="label
|
|
134
|
+
v-if="label"
|
|
135
135
|
class="block mb-2 text-sm font-medium text-fv-neutral-900 dark:text-white"
|
|
136
|
-
>{{ label
|
|
136
|
+
>{{ label }}
|
|
137
137
|
</label>
|
|
138
138
|
<input
|
|
139
139
|
ref="inputRef"
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
ref="textInput"
|
|
32
32
|
@input="handleInput"
|
|
33
33
|
@paste.prevent="handlePaste"
|
|
34
|
+
@keydown="handleKeydown"
|
|
34
35
|
placeholder="Add a tag..."
|
|
35
36
|
></div>
|
|
36
37
|
</div>
|
|
@@ -126,6 +127,17 @@ const handlePaste = (e: any) => {
|
|
|
126
127
|
e.preventDefault();
|
|
127
128
|
addTag();
|
|
128
129
|
};
|
|
130
|
+
const handleKeydown = (event: KeyboardEvent) => {
|
|
131
|
+
if (!textInput.value) return;
|
|
132
|
+
|
|
133
|
+
// Handles backspace when there is no separator involved
|
|
134
|
+
if (event.key === "Backspace" && textInput.value.innerText) {
|
|
135
|
+
// Prevent default to stop any default backspace behavior
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
// Remove last character
|
|
138
|
+
textInput.value.innerText = textInput.value.innerText.slice(0, -1);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
129
141
|
</script>
|
|
130
142
|
|
|
131
143
|
<style scoped>
|