From 7637515cd51fa8c90f11f321326b588a2e29b0e1 Mon Sep 17 00:00:00 2001 From: gnarvaja Date: Sun, 3 Jul 2016 22:34:58 -0300 Subject: [PATCH 1/5] Fixes bug on Android/Chrome because Android does not sends the correct keyCode. Manually detects comma from the input text. --- src/tags-input.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/tags-input.js b/src/tags-input.js index 4afc66d1..82091213 100644 --- a/src/tags-input.js +++ b/src/tags-input.js @@ -411,7 +411,12 @@ tagsInput.directive('tagsInput', function($timeout, $document, $window, $q, tags .on('input-keydown', function(event) { var key = event.keyCode, addKeys = {}, - shouldAdd, shouldRemove, shouldSelect, shouldEditLastTag; + shouldAdd, shouldRemove, shouldSelect, shouldEditLastTag, + newTagText = scope.newTag.text(); + if ((event.keyCode == 229) && (scope.text[newTagText.length -1] == ',')) { + key = KEYS.comma; + newTagText = newTagText.slice(0, -1); // Remove comma + } if (tiUtil.isModifierOn(event) || hotkeys.indexOf(key) === -1) { return; @@ -423,11 +428,11 @@ tagsInput.directive('tagsInput', function($timeout, $document, $window, $q, tags shouldAdd = !options.addFromAutocompleteOnly && addKeys[key]; shouldRemove = (key === KEYS.backspace || key === KEYS.delete) && tagList.selected; - shouldEditLastTag = key === KEYS.backspace && scope.newTag.text().length === 0 && options.enableEditingLastTag; - shouldSelect = (key === KEYS.backspace || key === KEYS.left || key === KEYS.right) && scope.newTag.text().length === 0 && !options.enableEditingLastTag; + shouldEditLastTag = key === KEYS.backspace && newTagText.length === 0 && options.enableEditingLastTag; + shouldSelect = (key === KEYS.backspace || key === KEYS.left || key === KEYS.right) && newTagText.length === 0 && !options.enableEditingLastTag; if (shouldAdd) { - tagList.addText(scope.newTag.text()); + tagList.addText(newTagText); } else if (shouldEditLastTag) { tagList.selectPrior(); From d2b22d22e8500e29d66e96aa972d198675d68dc8 Mon Sep 17 00:00:00 2001 From: gnarvaja Date: Sun, 3 Jul 2016 22:43:18 -0300 Subject: [PATCH 2/5] New version. --- CHANGELOG.md | 6 ++++++ package.json | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fe6bf6b..979706c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 3.1.2 (2016-07-03) + +#### Bug Fixes + +Fixes bug with comma detection on android/chrome. + ## 3.1.1 (2016-05-27) #### Bug Fixes diff --git a/package.json b/package.json index 55e5d743..2cc37ecd 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,13 @@ }, "name": "ng-tags-input", "prettyName": "ngTagsInput", - "version": "3.1.1", + "version": "3.1.2", "description": "Tags input directive for AngularJS", "license": "MIT", "homepage": "http://mbenford.github.io/ngTagsInput", "repository": { "type": "git", - "url": "https://github.com/mbenford/ngTagsInput.git" + "url": "https://github.com/lambdasistemas/ngTagsInput.git" }, "bugs": { "url": "https://github.com/mbenford/ngTagsInput/issues" From 46f609bdbfde496123b2f3776bed0a1927d8d1c9 Mon Sep 17 00:00:00 2001 From: Guillermo Narvaja Date: Fri, 2 Sep 2016 15:00:11 -0300 Subject: [PATCH 3/5] Replaces "==" by "===" in the comparison. --- src/tags-input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tags-input.js b/src/tags-input.js index 82091213..b644336d 100644 --- a/src/tags-input.js +++ b/src/tags-input.js @@ -413,7 +413,7 @@ tagsInput.directive('tagsInput', function($timeout, $document, $window, $q, tags addKeys = {}, shouldAdd, shouldRemove, shouldSelect, shouldEditLastTag, newTagText = scope.newTag.text(); - if ((event.keyCode == 229) && (scope.text[newTagText.length -1] == ',')) { + if ((event.keyCode === 229) && (scope.text[newTagText.length -1] === ',')) { key = KEYS.comma; newTagText = newTagText.slice(0, -1); // Remove comma } From a467d2cbdbda71db4dbb8a7b663f9b234121b202 Mon Sep 17 00:00:00 2001 From: Guillermo Narvaja Date: Wed, 19 Oct 2016 12:53:32 -0300 Subject: [PATCH 4/5] Fixes "-1" of undefined error produced when losing focus. --- src/tags-input.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tags-input.js b/src/tags-input.js index b644336d..f3ad4c08 100644 --- a/src/tags-input.js +++ b/src/tags-input.js @@ -413,7 +413,7 @@ tagsInput.directive('tagsInput', function($timeout, $document, $window, $q, tags addKeys = {}, shouldAdd, shouldRemove, shouldSelect, shouldEditLastTag, newTagText = scope.newTag.text(); - if ((event.keyCode === 229) && (scope.text[newTagText.length -1] === ',')) { + if ((event.keyCode === 229) && (scope.text !== undefined) && (scope.text[newTagText.length -1] === ',')) { key = KEYS.comma; newTagText = newTagText.slice(0, -1); // Remove comma } From b0233e6749f164bc6260f55f5aa223a6209c0f16 Mon Sep 17 00:00:00 2001 From: Guillermo Narvaja Date: Thu, 19 Apr 2018 11:46:05 -0300 Subject: [PATCH 5/5] Version 3.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2cc37ecd..4d69b3e9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ }, "name": "ng-tags-input", "prettyName": "ngTagsInput", - "version": "3.1.2", + "version": "3.1.3", "description": "Tags input directive for AngularJS", "license": "MIT", "homepage": "http://mbenford.github.io/ngTagsInput",