From 30999e0c651242d8071dca6a90f5739f22ac9afb Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sat, 2 Sep 2017 10:17:44 +0900 Subject: rename command names --- src/console/console.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/console/console.js') diff --git a/src/console/console.js b/src/console/console.js index a171ecc..61c5e24 100644 --- a/src/console/console.js +++ b/src/console/console.js @@ -8,20 +8,20 @@ var prevValue = ""; const blurMessage = () => { return { - type: 'vimvixen.commandline.blur' + type: 'vimvixen.command.blur' }; }; const keydownMessage = (input) => { return { - type: 'vimvixen.commandline.enter', + type: 'vimvixen.command.enter', value: input.value }; }; const keyupMessage = (input) => { return { - type: 'vimvixen.commandline.change', + type: 'vimvixen.command.change', value: input.value }; }; -- cgit v1.2.3 From 29f82d3a7f339fa99759b589923f0d8657da28f5 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 3 Sep 2017 17:41:01 +0900 Subject: reopen command line after error --- src/console/console-frame.js | 10 ++++++++++ src/console/console.js | 8 ++++---- src/content/index.js | 4 +++- 3 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src/console/console.js') diff --git a/src/console/console-frame.js b/src/console/console-frame.js index aabb96a..ea9f523 100644 --- a/src/console/console-frame.js +++ b/src/console/console-frame.js @@ -10,6 +10,8 @@ export default class ConsoleFrame { this.element = element; + this.errorShown = true; + this.hide(); } @@ -21,6 +23,7 @@ export default class ConsoleFrame { text: text }; messages.send(this.element.contentWindow, message); + this.errorShown = false; } showError(text) { @@ -31,6 +34,8 @@ export default class ConsoleFrame { text: text }; messages.send(this.element.contentWindow, message); + this.errorShown = true; + this.element.blur(); } showFrame() { @@ -40,5 +45,10 @@ export default class ConsoleFrame { hide() { this.element.style.display = 'none'; this.element.blur(); + this.errorShown = false; + } + + isErrorShown() { + return this.element.style.display === 'block' && this.errorShown; } } diff --git a/src/console/console.js b/src/console/console.js index 61c5e24..e0227aa 100644 --- a/src/console/console.js +++ b/src/console/console.js @@ -57,15 +57,15 @@ window.addEventListener('load', () => { }); const showCommand = (text) => { - let input = window.document.querySelector('#vimvixen-console-command-input'); - input.value = text; - input.focus(); - let command = window.document.querySelector('#vimvixen-console-command'); command.style.display = 'block'; let error = window.document.querySelector('#vimvixen-console-error'); error.style.display = 'none'; + + let input = window.document.querySelector('#vimvixen-console-command-input'); + input.value = text; + input.focus(); } const showError = (text) => { diff --git a/src/content/index.js b/src/content/index.js index 26c3840..8b3eb58 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -91,7 +91,9 @@ window.addEventListener("keypress", (e) => { messages.receive(window, (message) => { switch (message.type) { case 'vimvixen.command.blur': - vvConsole.hide(); + if (!vvConsole.isErrorShown()) { + vvConsole.hide(); + } break; case 'vimvixen.command.enter': browser.runtime.sendMessage({ -- cgit v1.2.3