Fix try close modal when select text and mouseup outside note.. Issue #27

This commit is contained in:
Matias De lellis
2022-05-16 20:37:33 -03:00
parent 78e39d7c34
commit 9606f5218e

View File

@@ -433,8 +433,20 @@ View.prototype = {
/* /*
* Modal actions. * Modal actions.
*/ */
// Cancel when click outside the modal.
/**
* Save references of event target on mouse down to avoid manage click on
* next event handler when selecting outside text outside the content.
*/
var _clickTarget = undefined;
$('#div-content').on('mousedown', function (event) {
_clickTarget = event.target;
});
// Cancel when explicit click outside the modal.
$('#div-content').on('click', '.modal-note-background', function (event) { $('#div-content').on('click', '.modal-note-background', function (event) {
if (_clickTarget != event.target)
return;
event.stopPropagation(); event.stopPropagation();
if (self._colorPick.isVisible()) { if (self._colorPick.isVisible()) {
self._colorPick.close(); self._colorPick.close();