From 6e63ef19d6cbf1427a427f7b4253ff7ca1d8b1c6 Mon Sep 17 00:00:00 2001 From: Robert Swoboda <53216935+Gengar-i@users.noreply.github.com> Date: Tue, 19 Mar 2024 08:46:54 +0100 Subject: [PATCH] IBX-7856: Added possibility to add tag with Enter (#1205) --- .../Resources/public/js/scripts/fieldType/ezkeyword.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/fieldType/ezkeyword.js b/src/bundle/Resources/public/js/scripts/fieldType/ezkeyword.js index 57cf00d786..b88906efff 100644 --- a/src/bundle/Resources/public/js/scripts/fieldType/ezkeyword.js +++ b/src/bundle/Resources/public/js/scripts/fieldType/ezkeyword.js @@ -3,6 +3,8 @@ const SELECTOR_TAGGIFY = '.ibexa-data-source__taggify'; const SELECTOR_ERROR_NODE = '.ibexa-form-error'; const CLASS_TAGGIFY_FOCUS = 'ibexa-data-source__taggify--focused'; + const ENTER_KEY_CODE = 13; + const COMMA_KEY_CODE = 188; class EzKeywordValidator extends ibexa.BaseFieldValidator { /** @@ -70,8 +72,7 @@ containerNode: taggifyContainer, displayLabel: false, displayInputValues: false, - // The "," key code - hotKeys: [188], + hotKeys: [ENTER_KEY_CODE, COMMA_KEY_CODE], }); const keywordInput = field.querySelector('.ibexa-data-source__input-wrapper .ibexa-data-source__input.form-control'); const updateKeywords = updateValue.bind(this, keywordInput);