don't reinsert reinterpreted color on start

do it only on the Enter key or once the user explicitly changed the color at least once
This commit is contained in:
tophf 2017-11-22 15:20:10 +03:00
parent e0ea76a940
commit 0ed6e3d4bf

View File

@ -330,8 +330,8 @@ CodeMirror.defineExtension('colorpicker', function () {
setFromInputs(); setFromInputs();
} }
function setFromInputs() { function setFromInputs(event) {
userActivity = performance.now(); userActivity = event ? performance.now() : userActivity;
if ($inputs[currentFormat].every(validateInput)) { if ($inputs[currentFormat].every(validateInput)) {
setFromColor($inputs.color); setFromColor($inputs.color);
} }
@ -598,7 +598,7 @@ CodeMirror.defineExtension('colorpicker', function () {
if (!e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) { if (!e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) {
switch (e.which) { switch (e.which) {
case 13: case 13:
setFromInputs(); setFromInputs({});
colorpickerCallback(); colorpickerCallback();
// fallthrough to 27 // fallthrough to 27
case 27: case 27: