fix colorpicker hotkey config

This commit is contained in:
tophf 2017-11-22 02:20:09 +03:00
parent 2a0ecec28e
commit 6c858d6449
2 changed files with 11 additions and 2 deletions

View File

@ -103,6 +103,10 @@ h2 .svg-icon, label .svg-icon {
.svg-icon.settings:hover { .svg-icon.settings:hover {
fill: #000; fill: #000;
} }
input:invalid {
background-color: rgba(255, 0, 0, 0.1);
color: darkred;
}
#enabled { #enabled {
margin-left: 0; margin-left: 0;
vertical-align: middle; vertical-align: middle;

View File

@ -2144,12 +2144,17 @@ function configureColorpicker() {
onkeydown(event) { onkeydown(event) {
const key = CodeMirror.keyName(event); const key = CodeMirror.keyName(event);
// ignore: [Shift?] characters, modifiers-only, [Shift?] Esc, Enter, [Shift?] Tab // ignore: [Shift?] characters, modifiers-only, [Shift?] Esc, Enter, [Shift?] Tab
if (/^(Enter|(Shift-)?(Esc|Tab|[!-~])|(Shift-?|Ctrl-?|Alt-?|Cmd-?)*)$/.test(key)) { if (/^(Enter|(Shift-)?(Esc|Tab))$/.test(key)) {
this.setCustomValidity('');
return; return;
} else if (/^((Shift-)?[!-~]|(Shift-?|Ctrl-?|Alt-?|Cmd-?)*)$/.test(key)) {
this.setCustomValidity('Not allowed');
} else {
this.setCustomValidity('');
prefs.set('editor.colorpicker.hotkey', key);
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
prefs.set('editor.colorpicker.hotkey', key);
this.value = key; this.value = key;
}, },
oninput() { oninput() {