flexible prompt
This commit is contained in:
parent
86b534b1e1
commit
cb4b26e03f
2 changed files with 19 additions and 3 deletions
|
@ -95,13 +95,23 @@ export default class ConsoleComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
showCommand(text) {
|
showCommand(text) {
|
||||||
|
this.showConsole('command', text);
|
||||||
|
}
|
||||||
|
|
||||||
|
showFind() {
|
||||||
|
this.showConsole('find', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
showConsole(mode, initial) {
|
||||||
let doc = this.wrapper.ownerDocument;
|
let doc = this.wrapper.ownerDocument;
|
||||||
let command = doc.querySelector('#vimvixen-console-command');
|
let command = doc.querySelector('#vimvixen-console-command');
|
||||||
let input = doc.querySelector('#vimvixen-console-command-input');
|
let input = doc.querySelector('#vimvixen-console-command-input');
|
||||||
|
let promptEle = doc.querySelector('.vimvixen-console-command-prompt');
|
||||||
|
|
||||||
command.style.display = 'block';
|
command.style.display = 'block';
|
||||||
input.value = text;
|
input.value = initial;
|
||||||
input.focus();
|
input.focus();
|
||||||
|
promptEle.className = `vimvixen-console-command-prompt prompt-${mode}`;
|
||||||
|
|
||||||
window.focus();
|
window.focus();
|
||||||
this.onInput({ target: input });
|
this.onInput({ target: input });
|
||||||
|
|
|
@ -85,11 +85,17 @@ body {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
&-prompt:before {
|
&-prompt:before {
|
||||||
content: ':';
|
|
||||||
|
|
||||||
@include consoole-font;
|
@include consoole-font;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-prompt.prompt-command:before {
|
||||||
|
content: ':';
|
||||||
|
}
|
||||||
|
|
||||||
|
&-prompt.prompt-find:before {
|
||||||
|
content: '/';
|
||||||
|
}
|
||||||
|
|
||||||
&-input {
|
&-input {
|
||||||
border: none;
|
border: none;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
Reference in a new issue