From 7ac00fce6f6c431f96c531179c6af3796df7e07a Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 8 Oct 2017 19:08:51 +0900 Subject: Show info on yanked --- src/console/components/console.js | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/console/components/console.js') diff --git a/src/console/components/console.js b/src/console/components/console.js index b8431ce..93802f8 100644 --- a/src/console/components/console.js +++ b/src/console/components/console.js @@ -16,7 +16,7 @@ export default class ConsoleComponent { input.addEventListener('keyup', this.onKeyUp.bind(this)); this.hideCommand(); - this.hideError(); + this.hideMessage(); } onBlur() { @@ -78,11 +78,10 @@ export default class ConsoleComponent { this.hideCommand(); } - if (state.mode === 'error') { - this.setErrorText(state.messageText); - this.showError(); + if (state.mode === 'error' || state.mode === 'info') { + this.showMessage(state.mode, state.messageText); } else { - this.hideError(); + this.hideMessage(); } if (state.groupSelection >= 0 && state.itemSelection >= 0) { @@ -128,21 +127,21 @@ export default class ConsoleComponent { input.value = this.completionOrigin; } - setErrorText(text) { + showMessage(mode, text) { let doc = this.wrapper.ownerDocument; - let error = doc.querySelector('#vimvixen-console-error'); + let error = doc.querySelector('#vimvixen-console-message'); + error.classList.remove( + 'vimvixen-console-info', + 'vimvixen-console-error' + ); + error.classList.add('vimvixen-console-' + mode); error.textContent = text; - } - - showError() { - let doc = this.wrapper.ownerDocument; - let error = doc.querySelector('#vimvixen-console-error'); error.style.display = 'block'; } - hideError() { + hideMessage() { let doc = this.wrapper.ownerDocument; - let error = doc.querySelector('#vimvixen-console-error'); + let error = doc.querySelector('#vimvixen-console-message'); error.style.display = 'none'; } } -- cgit v1.2.3