From e46d704573c8df9e9ef240212dfdb5f36c55c041 Mon Sep 17 00:00:00 2001 From: iamsivin Date: Wed, 20 Nov 2024 17:03:50 +0530 Subject: [PATCH] chore: Minor fix --- .../dashboard/components-next/taginput/TagInput.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/javascript/dashboard/components-next/taginput/TagInput.vue b/app/javascript/dashboard/components-next/taginput/TagInput.vue index b48823d94..22db61fc1 100644 --- a/app/javascript/dashboard/components-next/taginput/TagInput.vue +++ b/app/javascript/dashboard/components-next/taginput/TagInput.vue @@ -119,7 +119,7 @@ const addTag = async () => { return; } - if (props.type === 'email' && props.allowCreate) { + if (props.type === 'email' || props.allowCreate) { if (!(await v$.value.$validate())) return; emitDataOnAdd(trimmedTag); } @@ -157,6 +157,13 @@ const handleFocus = () => { isFocused.value = true; }; +const handleKeydown = event => { + if (event.key === ',') { + event.preventDefault(); + addTag(); + } +}; + const handleClickOutside = () => { if (tags.value.length) isFocused.value = false; emit('onClickOutside'); @@ -218,6 +225,7 @@ const handleBlur = e => emit('blur', e); @focus="handleFocus" @input="handleInput" @blur="handleBlur" + @keydown="handleKeydown" />