From 47260bd5fa2a64834b2c032fbf326015d9777b9e Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 29 Sep 2014 19:30:02 +0200 Subject: [PATCH] Changed pasting tags to "soft-add" last tag --- TODO | 1 - public_html/js/Controls/TagInput.js | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 32d3df28..645a2333 100644 --- a/TODO +++ b/TODO @@ -111,7 +111,6 @@ miscellaneous: - endless pager should include information about page number - add hotkeys for focusing items in top navigation - add ability to select tags text in tag input - - pasting tags should "soft-add" latest word in clipboard to input - pasting tags should have protection against very long clipboard content - add protection against ridiculously long tag names - add customizable favicon diff --git a/public_html/js/Controls/TagInput.js b/public_html/js/Controls/TagInput.js index 09f45623..3b22a6ba 100644 --- a/public_html/js/Controls/TagInput.js +++ b/public_html/js/Controls/TagInput.js @@ -45,7 +45,8 @@ App.Controls.TagInput = function( }); $input.attr('placeholder', $underlyingInput.attr('placeholder')); - pasteText($underlyingInput.val()); + var tagsToAdd = $underlyingInput.val().split(/\s+/); + _.map(tagsToAdd, addTag); $underlyingInput.val(''); $input.unbind('focus').bind('focus', function(e) { @@ -71,9 +72,9 @@ App.Controls.TagInput = function( function pasteText(pastedText) { var pastedTags = pastedText.split(/\s+/); - _.each(pastedTags, function(tag) { - addTag(tag); - }); + var lastTag = pastedTags.pop(); + _.map(pastedTags, addTag); + $input.val(lastTag); } $input.unbind('keydown').bind('keydown', function(e) {