aboutsummaryrefslogtreecommitdiff
path: root/src/console/components
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-08 19:08:51 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-10-08 19:58:36 +0900
commit7ac00fce6f6c431f96c531179c6af3796df7e07a (patch)
treea10db125bd25c1447bb08de2ef156c010243f019 /src/console/components
parentb0d2b5328107a9a2018132938fb5a9efcd77fc50 (diff)
Show info on yanked
Diffstat (limited to 'src/console/components')
-rw-r--r--src/console/components/console.js27
1 files changed, 13 insertions, 14 deletions
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';
}
}