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." "description": "Label for the style editor's CSS theme."
}, },
"colorpickerSwitchFormatTooltip": { "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." "description": "Tooltip for the switch button in the color picker popup in the style editor."
}, },
"colorpickerTooltip": { "colorpickerTooltip": {

View File

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