Fixed form submission with Meta+Enter keyboard shortcut

This commit is contained in:
Frederic Guillot
2016-04-13 18:24:36 -04:00
parent 2a574c408e
commit ab02a9a162
4 changed files with 19 additions and 6 deletions

View File

@@ -14,6 +14,7 @@ Improvements:
Bug fixes: Bug fixes:
* Fixed form submission with Meta+Enter keyboard shortcut
* Removed PHP notices in comment suppression view * Removed PHP notices in comment suppression view
Version 1.0.27 Version 1.0.27

File diff suppressed because one or more lines are too long

View File

@@ -42,7 +42,17 @@ Kanboard.App.prototype.keyboardShortcuts = function() {
// Submit form // Submit form
Mousetrap.bindGlobal("mod+enter", function() { Mousetrap.bindGlobal("mod+enter", function() {
$("form").submit(); var forms = $("form");
if (forms.length == 1) {
forms.submit();
} else if (forms.length > 1) {
if (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA') {
$(document.activeElement).parents("form").submit();
} else if (self.get("Popover").isOpen()) {
$("#popover-container form").submit();
}
}
}); });
// Open board selector // Open board selector

View File

@@ -45,10 +45,12 @@ Kanboard.Popover.prototype.isOpen = function() {
Kanboard.Popover.prototype.open = function(link) { Kanboard.Popover.prototype.open = function(link) {
var self = this; var self = this;
$.get(link, function(content) { if (!self.isOpen()) {
$("body").prepend('<div id="popover-container"><div id="popover-content">' + content + '</div></div>'); $.get(link, function(content) {
self.executeOnOpenedListeners(); $("body").prepend('<div id="popover-container"><div id="popover-content">' + content + '</div></div>');
}); self.executeOnOpenedListeners();
});
}
}; };
Kanboard.Popover.prototype.close = function(e) { Kanboard.Popover.prototype.close = function(e) {