fix confirm conflicts shortcuts
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user