From 78bf2c8d9bd45d6c35cf3e22d7d49ce15ab7e722 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 22 Nov 2017 05:35:24 +0300 Subject: [PATCH] close colorpicker config on Enter --- edit/colorpicker-helper.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/edit/colorpicker-helper.js b/edit/colorpicker-helper.js index 66c7d4e6..c65e6a31 100644 --- a/edit/colorpicker-helper.js +++ b/edit/colorpicker-helper.js @@ -1,4 +1,4 @@ -/* global CodeMirror loadScript editors */ +/* global CodeMirror loadScript editors showHelp */ 'use strict'; window.initColorpicker = () => { @@ -75,9 +75,10 @@ window.initColorpicker = () => { onkeydown(event) { const key = CodeMirror.keyName(event); // ignore: [Shift?] characters, modifiers-only, [Shift?] Esc, Enter, [Shift?] Tab - if (/^(Enter|(Shift-)?(Esc|Tab))$/.test(key)) { + if (key === 'Enter' || key === 'Esc') { + $('#help-popup .dismiss').onclick(); return; - } else if (/^((Shift-)?[!-~]|(Shift-?|Ctrl-?|Alt-?|Cmd-?)*)$/.test(key)) { + } else if (/^((Shift-)?(Esc|Tab|[!-~])|(Shift-?|Ctrl-?|Alt-?|Cmd-?)*)$/.test(key)) { this.setCustomValidity('Not allowed'); } else { this.setCustomValidity('');