don't autohide colorpicker popup when invoked via hotkey

This commit is contained in:
tophf 2017-12-24 14:32:53 +03:00
parent a53fb162a8
commit 1040c20330
2 changed files with 5 additions and 4 deletions

View File

@ -832,8 +832,6 @@ const NAMED_COLORS = new Map([
window.addEventListener('keydown', onKeyDown, true); window.addEventListener('keydown', onKeyDown, true);
window.addEventListener('mousedown', onMouseDown, true); window.addEventListener('mousedown', onMouseDown, true);
window.addEventListener('close-colorpicker-popup', onCloseRequest, true); window.addEventListener('close-colorpicker-popup', onCloseRequest, true);
$root.addEventListener('mouseleave', snooze);
$root.addEventListener('mouseenter', stopSnoozing);
$root.addEventListener('input', setFromInputs); $root.addEventListener('input', setFromInputs);
$root.addEventListener('keydown', setFromKeyboard); $root.addEventListener('keydown', setFromKeyboard);
$formatChangeButton.addEventListener('click', setFromFormatElement); $formatChangeButton.addEventListener('click', setFromFormatElement);
@ -847,8 +845,12 @@ const NAMED_COLORS = new Map([
$hexLettercase.false.addEventListener('click', onHexLettercaseClicked); $hexLettercase.false.addEventListener('click', onHexLettercaseClicked);
stopSnoozing(); stopSnoozing();
if (!options.isShortCut) {
$root.addEventListener('mouseleave', snooze);
$root.addEventListener('mouseenter', stopSnoozing);
timerFadeColorPicker = setTimeout(fade, options.hideDelay / 2); timerFadeColorPicker = setTimeout(fade, options.hideDelay / 2);
} }
}
function unregisterEvents() { function unregisterEvents() {
window.removeEventListener('keydown', onKeyDown, true); window.removeEventListener('keydown', onKeyDown, true);

View File

@ -496,7 +496,6 @@
cm: state.cm, cm: state.cm,
color: data.color, color: data.color,
prevColor: data.color || '', prevColor: data.color || '',
isShortCut: false,
callback: popupOnChange, callback: popupOnChange,
})); }));
} }