Changed pasting tags to "soft-add" last tag

This commit is contained in:
Marcin Kurczewski 2014-09-29 19:30:02 +02:00
parent 060ddf46ad
commit 47260bd5fa
2 changed files with 5 additions and 5 deletions

1
TODO
View file

@ -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

View file

@ -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) {