Skip to content

Commit fc88645

Browse files
committed
Update index.js
1 parent 622f5d7 commit fc88645

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/main/js/components/dialogs/index.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ let _defaults = {
1313
hideCloseButton: false,
1414
allowEmpty: false,
1515
submitButton: false,
16+
preventCloseOnOutsideClick: false,
1617
};
1718

1819
let _typeClassMap = {
@@ -66,12 +67,14 @@ Dialog.prototype.init = function () {
6667
this.dialog.dispatchEvent(new Event("cancel")),
6768
);
6869
}
69-
this.dialog.addEventListener("click", function (e) {
70-
if (e.target !== e.currentTarget) {
71-
return;
72-
}
73-
this.dispatchEvent(new Event("cancel"));
74-
});
70+
if (!this.options.preventCloseOnOutsideClick) {
71+
this.dialog.addEventListener("click", function (e) {
72+
if (e.target !== e.currentTarget) {
73+
return;
74+
}
75+
this.dispatchEvent(new Event("cancel"));
76+
});
77+
}
7578
this.ok = null;
7679
} else {
7780
this.form = null;

0 commit comments

Comments
 (0)