From 15925f625d6c00fa78632895ca51be23871e2be1 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 16 Mar 2020 14:42:27 +0100 Subject: [PATCH] Fix keyboard shortcuts in kanban edit modal --- www/kanban/inner.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/www/kanban/inner.js b/www/kanban/inner.js index 6aca4ac67..ade42f271 100644 --- a/www/kanban/inner.js +++ b/www/kanban/inner.js @@ -171,6 +171,7 @@ define([ h('label', {for:'cp-kanban-edit-color'}, Messages.kanban_color), colors = h('div#cp-kanban-edit-colors'), ]); + var $tags = $(tagsDiv); var $conflict = $(conflicts); @@ -216,12 +217,17 @@ define([ var editor = CodeMirror.fromTextArea(text, { allowDropFileTypes: [], lineWrapping: true, - styleActiveLine : true, + styleActiveLine: true, + autoCloseBrackets: true, inputStyle: 'contenteditable', extraKeys: {"Shift-Ctrl-R": undefined}, mode: "gfm" }); editor.on('keydown', function (editor, e) { + if (e.which === 27) { + // Focus the next form element but don't close the modal (stopPropagation) + $tags.find('.token-input').focus(); + } e.stopPropagation(); }); var common = framework._.sfCommon; @@ -255,7 +261,6 @@ define([ }); // Tags - var $tags = $(tagsDiv); var _field, initialTags; var tags = { getValue: function () { @@ -278,6 +283,10 @@ define([ }); _field.setTokens(tags || []); + $tags.find('.token-input').on('keydown', function (e) { + e.stopPropagation(); + }); + var commitTags = function () { setTimeout(function () { dataObject.tags = Util.deduplicateString(_field.getTokens().map(function (t) {