Fix keyboard shortcuts in kanban edit modal

pull/1/head
yflory 5 years ago
parent a2b6501adb
commit 15925f625d

@ -171,6 +171,7 @@ define([
h('label', {for:'cp-kanban-edit-color'}, Messages.kanban_color), h('label', {for:'cp-kanban-edit-color'}, Messages.kanban_color),
colors = h('div#cp-kanban-edit-colors'), colors = h('div#cp-kanban-edit-colors'),
]); ]);
var $tags = $(tagsDiv);
var $conflict = $(conflicts); var $conflict = $(conflicts);
@ -216,12 +217,17 @@ define([
var editor = CodeMirror.fromTextArea(text, { var editor = CodeMirror.fromTextArea(text, {
allowDropFileTypes: [], allowDropFileTypes: [],
lineWrapping: true, lineWrapping: true,
styleActiveLine : true, styleActiveLine: true,
autoCloseBrackets: true,
inputStyle: 'contenteditable', inputStyle: 'contenteditable',
extraKeys: {"Shift-Ctrl-R": undefined}, extraKeys: {"Shift-Ctrl-R": undefined},
mode: "gfm" mode: "gfm"
}); });
editor.on('keydown', function (editor, e) { 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(); e.stopPropagation();
}); });
var common = framework._.sfCommon; var common = framework._.sfCommon;
@ -255,7 +261,6 @@ define([
}); });
// Tags // Tags
var $tags = $(tagsDiv);
var _field, initialTags; var _field, initialTags;
var tags = { var tags = {
getValue: function () { getValue: function () {
@ -278,6 +283,10 @@ define([
}); });
_field.setTokens(tags || []); _field.setTokens(tags || []);
$tags.find('.token-input').on('keydown', function (e) {
e.stopPropagation();
});
var commitTags = function () { var commitTags = function () {
setTimeout(function () { setTimeout(function () {
dataObject.tags = Util.deduplicateString(_field.getTokens().map(function (t) { dataObject.tags = Util.deduplicateString(_field.getTokens().map(function (t) {

Loading…
Cancel
Save