switch colorpicker popup format on PgUp/PgDn only, not Tab

This commit is contained in:
tophf 2017-11-22 04:32:20 +03:00
parent e9abcc8031
commit 5d00602ada
2 changed files with 10 additions and 5 deletions

View File

@ -176,7 +176,7 @@
"description": "Label for the style editor's CSS theme."
},
"colorpickerSwitchFormatTooltip": {
"message": "Switch formats: HEX -> RGB -> HSL.\nShift-click to reverse the direction.\nAlso via PgUp (PageUp), PgDn (PageDown), Tab keys.",
"message": "Switch formats: HEX -> RGB -> HSL.\nShift-click to reverse the direction.\nAlso via PgUp (PageUp), PgDn (PageDown) keys.",
"description": "Tooltip for the switch button in the color picker popup in the style editor."
},
"colorpickerTooltip": {

View File

@ -346,12 +346,17 @@ CodeMirror.defineExtension('colorpicker', function () {
if (!ctrl && !alt && !meta) {
const el = document.activeElement;
const inputs = $inputs[currentFormat];
if (which !== 9 && !shift ||
el === inputs[0] && shift ||
el === inputs[inputs.length - 1] && !shift) {
event.preventDefault();
const lastInput = inputs[inputs.length - 1];
if (which === 9 && shift && el === inputs[0]) {
lastInput.focus();
} else if (which === 9 && !shift && el === lastInput) {
inputs[0].focus();
} else if (which !== 9 && !shift) {
setFromFormatElement({shift: which === 33 || shift});
} else {
return;
}
event.preventDefault();
}
return;
case 38: // Up