notify embedder on closing colorpicker
fixup 7fea2cfc: messageBox's Esc handler wasn't restored
This commit is contained in:
parent
373fe5f510
commit
26d7c26770
|
@ -222,11 +222,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
function hide({notify = true} = {}) {
|
||||
function hide() {
|
||||
if (shown) {
|
||||
if (notify) {
|
||||
colorpickerCallback('');
|
||||
}
|
||||
unregisterEvents();
|
||||
focusNoScroll(prevFocusedElement);
|
||||
$root.remove();
|
||||
|
@ -623,7 +621,7 @@
|
|||
case 27:
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
hide({notify: false});
|
||||
hide();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -643,19 +641,22 @@
|
|||
//region Event utilities
|
||||
|
||||
function colorpickerCallback(colorString = currentColorToString()) {
|
||||
// Esc pressed?
|
||||
if (!colorString) {
|
||||
const isCallable = typeof options.callback === 'function';
|
||||
// hiding
|
||||
if (!colorString && isCallable) {
|
||||
options.callback('');
|
||||
return;
|
||||
}
|
||||
if (
|
||||
userActivity &&
|
||||
$inputs[currentFormat].every(el => el.checkValidity()) &&
|
||||
typeof options.callback === 'function'
|
||||
$inputs[currentFormat].every(el => el.checkValidity())
|
||||
) {
|
||||
lastOutputColor = colorString.replace(/\b0\./g, '.');
|
||||
if (isCallable) {
|
||||
options.callback(lastOutputColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function captureMouse({button}, mode) {
|
||||
if (button !== 0) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user