make colorpicker notify embedder on closing
re-enables Esc key in config-dialog after colorpicker closed itself due to an outside click
This commit is contained in:
parent
07a0518586
commit
85c67872a5
|
@ -218,8 +218,11 @@
|
|||
setFromHexLettercaseElement();
|
||||
}
|
||||
|
||||
function hide() {
|
||||
function hide({notify = true} = {}) {
|
||||
if (shown) {
|
||||
if (notify) {
|
||||
colorpickerCallback('');
|
||||
}
|
||||
unregisterEvents();
|
||||
focusNoScroll(prevFocusedElement);
|
||||
$root.remove();
|
||||
|
@ -553,6 +556,12 @@
|
|||
releaseMouse(event, ['saturation', 'hue', 'opacity']);
|
||||
}
|
||||
|
||||
function onMouseDown(event) {
|
||||
if (event.button === 0 && !event.target.closest('.colorpicker-popup')) {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseMove(event) {
|
||||
if (event.button !== 0) {
|
||||
return;
|
||||
|
@ -589,7 +598,7 @@
|
|||
colorpickerCallback(e.which === 27 ? '' : undefined);
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
hide();
|
||||
hide({notify: false});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -601,12 +610,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
function onMouseDown(event) {
|
||||
if (!event.target.closest('.colorpicker-popup')) {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
//endregion
|
||||
//region Event utilities
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user