Skip to content

EspoCRM – Open Source CRM Application

fix confirm conflicts shortcuts

Yurii7b35a691064c
diff --git a/client/src/helpers/site/shortcut-manager.js b/client/src/helpers/site/shortcut-manager.js
index 7ab0e9c6ba..d7563425c3 100644
--- a/client/src/helpers/site/shortcut-manager.js
+++ b/client/src/helpers/site/shortcut-manager.js
@@ -27,6 +27,7 @@
************************************************************************/
import {register} from 'di';
+import Ui from 'ui';
/** @typedef {import('view').default} View */
/** @typedef {string|function(KeyboardEvent): void} Key */
@@ -116,6 +117,10 @@ export default class ShortcutManager {
return;
}
+ if (Ui.getConfirmCount()) {
+ return;
+ }
+
const key = Espo.Utils.getKeyFromKeyEvent(event);
for (const item of items) {
diff --git a/client/src/ui.js b/client/src/ui.js
index 0a615d1212..0c85ba2a69 100644
--- a/client/src/ui.js
+++ b/client/src/ui.js
@@ -981,6 +981,8 @@ Espo.Ui = {
message = Handlebars.Utils.escapeExpression(message);
}
+ confirmCount ++;
+
return new Promise(resolve => {
const dialog = new Dialog({
backdrop: backdrop,
@@ -1025,6 +1027,8 @@ Espo.Ui = {
}
],
onClose: () => {
+ confirmCount --;
+
if (isResolved) {
return;
}
@@ -1366,8 +1370,19 @@ Espo.Ui = {
info: function (message, options) {
Espo.Ui.notify(message, 'info', 2000, options);
},
+
+ /**
+ * Get the number of opened confirmation dialogues.
+ *
+ * @return {number}
+ * @internal
+ */
+ getConfirmCount() {
+ return confirmCount;
+ }
};
+let confirmCount = 0;
let notifySuppressed = false;
/**