mirror of
https://github.com/JanGross/quicknotes.git
synced 2025-12-01 15:47:17 +01:00
Fix try close modal when select text and mouseup outside note.. Issue #27
This commit is contained in:
14
js/script.js
14
js/script.js
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user