Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions jquery.tag-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
var $t = $(this);

// left/up key + backspace key on empty field
if ((e.which == 37 || !o.autocomplete && e.which == 38) && !$t.caret() || e.which == 8 && !$t.val()) {
if (o.keyboardEdit && ((e.which == 37 || !o.autocomplete && e.which == 38) && !$t.caret() || e.which == 8 && !$t.val())) {
var prev_tag = $t.closest('li').prev('li').find('.tag-editor-tag');
if (prev_tag.length) prev_tag.click().find('input').caret(-1);
else if ($t.val()) $(new_tag).insertBefore($t.closest('li')).find('.tag-editor-tag').click();
Expand All @@ -267,8 +267,8 @@
else {
el.attr('disabled', 'disabled');
setTimeout(function(){ el.removeAttr('disabled'); }, 30);
return;
}
return;
}
return false;
// tab
} else {
Expand All @@ -280,7 +280,7 @@
}
}
// del key
else if (e.which == 46 && (!$.trim($t.val()) || ($t.caret() == $t.val().length))) {
else if (o.keyboardEdit && (e.which == 46 && (!$.trim($t.val()) || ($t.caret() == $t.val().length)))) {
var next_tag = $t.closest('li').next('li').find('.tag-editor-tag');
if (next_tag.length) next_tag.click().find('input').caret(0);
else if ($t.val()) ed.click();
Expand All @@ -292,9 +292,9 @@
return false;
}
// pos1
else if (e.which == 36 && !$t.caret()) ed.find('.tag-editor-tag').first().click();
else if (o.keyboardEdit && (e.which == 36 && !$t.caret())) ed.find('.tag-editor-tag').first().click();
// end
else if (e.which == 35 && $t.caret() == $t.val().length) ed.find('.tag-editor-tag').last().click();
else if (o.keyboardEdit && (e.which == 35 && $t.caret() == $t.val().length)) ed.find('.tag-editor-tag').last().click();
// esc
else if (e.which == 27) {
$t.val($t.data('old_tag') ? $t.data('old_tag') : '').blur();
Expand Down Expand Up @@ -329,6 +329,7 @@
placeholder: '',
forceLowercase: true,
clickDelete: false,
keyboardEdit: true,
sortable: true, // jQuery UI sortable
autocomplete: null, // options dict for jQuery UI autocomplete

Expand Down
2 changes: 1 addition & 1 deletion jquery.tag-editor.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.