From 6a27c3f5e156d49f335bd24ce7781a78957072c1 Mon Sep 17 00:00:00 2001 From: Giulio Cesare Solaroli Date: Sun, 22 Mar 2015 22:41:23 +0100 Subject: [PATCH] Fixed a UI glitch where a tag may not be saved --- .../js/Clipperz/PM/UI/Components/Cards/TagEditor.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/delta/js/Clipperz/PM/UI/Components/Cards/TagEditor.js b/frontend/delta/js/Clipperz/PM/UI/Components/Cards/TagEditor.js index b04258c..a52694d 100644 --- a/frontend/delta/js/Clipperz/PM/UI/Components/Cards/TagEditor.js +++ b/frontend/delta/js/Clipperz/PM/UI/Components/Cards/TagEditor.js @@ -76,7 +76,7 @@ Clipperz.PM.UI.Components.Cards.TagEditor = React.createClass({ anEvent.currentTarget.value = ""; }, - handleKeyDown: function(anEvent) { + handleKeyDown: function (anEvent) { switch (anEvent.keyCode) { case 9: // tab @@ -112,7 +112,11 @@ Clipperz.PM.UI.Components.Cards.TagEditor = React.createClass({ */ } }, - + + handleBlur: function (anEvent) { + this.addTagValue(anEvent); + }, + //---------------------------------------------------------------------------- renderTag: function (aTag) { @@ -124,7 +128,7 @@ Clipperz.PM.UI.Components.Cards.TagEditor = React.createClass({ renderEditField: function () { return [ - React.DOM.input({'type':'text', 'list':'tagListData', 'onKeyDown':this.handleKeyDown, 'placeholder': "tag"}), + React.DOM.input({'type':'text', 'list':'tagListData', 'onKeyDown':this.handleKeyDown, 'onBlur':this.handleBlur, 'placeholder': "tag"}), React.DOM.datalist({'id':'tagListData'}, MochiKit.Base.map(function (aTag) { return React.DOM.option({}, aTag); }, this.listOfTagsNotUsedYet())) ]; },