allow < in tag input (fixes philomena-dev/philomena#35

This commit is contained in:
Luna D 2020-10-21 19:17:24 +02:00
parent 4a61a0d213
commit 60b2c01a71
No known key found for this signature in database
GPG key ID: 81AF416F2CC36FC8

View file

@ -64,7 +64,7 @@ function setupTagsInput(tagBlock) {
} }
function handleKeyEvent(event) { function handleKeyEvent(event) {
const { keyCode, ctrlKey } = event; const { keyCode, ctrlKey, shiftKey } = event;
// allow form submission with ctrl+enter if no text was typed // allow form submission with ctrl+enter if no text was typed
if (keyCode === 13 && ctrlKey && inputField.value === '') { if (keyCode === 13 && ctrlKey && inputField.value === '') {
@ -80,7 +80,7 @@ function setupTagsInput(tagBlock) {
} }
// enter or comma // enter or comma
if (keyCode === 13 || keyCode === 188) { if (keyCode === 13 || (keyCode === 188 && !shiftKey)) {
event.preventDefault(); event.preventDefault();
inputField.value.split(',').forEach(t => insertTag(t)); inputField.value.split(',').forEach(t => insertTag(t));
inputField.value = ''; inputField.value = '';