diff options
Diffstat (limited to 'src/console')
-rw-r--r-- | src/console/console-frame.js | 10 | ||||
-rw-r--r-- | src/console/console.js | 8 |
2 files changed, 14 insertions, 4 deletions
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) => { |