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..4d69b3e9 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,13 @@ }, "name": "ng-tags-input", "prettyName": "ngTagsInput", - "version": "3.1.1", + "version": "3.1.3", "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" diff --git a/src/tags-input.js b/src/tags-input.js index 4afc66d1..f3ad4c08 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 !== undefined) && (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();