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 - endless pager should include information about page number
- add hotkeys for focusing items in top navigation - add hotkeys for focusing items in top navigation
- add ability to select tags text in tag input - 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 - pasting tags should have protection against very long clipboard content
- add protection against ridiculously long tag names - add protection against ridiculously long tag names
- add customizable favicon - add customizable favicon

View file

@ -45,7 +45,8 @@ App.Controls.TagInput = function(
}); });
$input.attr('placeholder', $underlyingInput.attr('placeholder')); $input.attr('placeholder', $underlyingInput.attr('placeholder'));
pasteText($underlyingInput.val()); var tagsToAdd = $underlyingInput.val().split(/\s+/);
_.map(tagsToAdd, addTag);
$underlyingInput.val(''); $underlyingInput.val('');
$input.unbind('focus').bind('focus', function(e) { $input.unbind('focus').bind('focus', function(e) {
@ -71,9 +72,9 @@ App.Controls.TagInput = function(
function pasteText(pastedText) { function pasteText(pastedText) {
var pastedTags = pastedText.split(/\s+/); var pastedTags = pastedText.split(/\s+/);
_.each(pastedTags, function(tag) { var lastTag = pastedTags.pop();
addTag(tag); _.map(pastedTags, addTag);
}); $input.val(lastTag);
} }
$input.unbind('keydown').bind('keydown', function(e) { $input.unbind('keydown').bind('keydown', function(e) {