|
|
@ -1,8 +1,5 @@ |
|
|
|
import './console.scss'; |
|
|
|
import './console.scss'; |
|
|
|
import Completion from './completion'; |
|
|
|
import Completion from './completion'; |
|
|
|
import * as messages from '../shared/messages'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const parent = window.parent; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO consider object-oriented
|
|
|
|
// TODO consider object-oriented
|
|
|
|
var prevValue = ""; |
|
|
|
var prevValue = ""; |
|
|
@ -30,7 +27,7 @@ const keyupMessage = (input) => { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const handleBlur = () => { |
|
|
|
const handleBlur = () => { |
|
|
|
messages.send(parent, blurMessage()); |
|
|
|
return browser.runtime.sendMessage(blurMessage()); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const completeNext = () => { |
|
|
|
const completeNext = () => { |
|
|
@ -66,11 +63,9 @@ const completePrev = () => { |
|
|
|
const handleKeydown = (e) => { |
|
|
|
const handleKeydown = (e) => { |
|
|
|
switch(e.keyCode) { |
|
|
|
switch(e.keyCode) { |
|
|
|
case KeyboardEvent.DOM_VK_ESCAPE: |
|
|
|
case KeyboardEvent.DOM_VK_ESCAPE: |
|
|
|
messages.send(parent, blurMessage()); |
|
|
|
return browser.runtime.sendMessage(blurMessage()); |
|
|
|
break; |
|
|
|
|
|
|
|
case KeyboardEvent.DOM_VK_RETURN: |
|
|
|
case KeyboardEvent.DOM_VK_RETURN: |
|
|
|
messages.send(parent, keydownMessage(e.target)); |
|
|
|
return browser.runtime.sendMessage(keydownMessage(e.target)); |
|
|
|
break; |
|
|
|
|
|
|
|
case KeyboardEvent.DOM_VK_TAB: |
|
|
|
case KeyboardEvent.DOM_VK_TAB: |
|
|
|
if (e.shiftKey) { |
|
|
|
if (e.shiftKey) { |
|
|
|
completePrev(); |
|
|
|
completePrev(); |
|
|
@ -90,8 +85,8 @@ const handleKeyup = (e) => { |
|
|
|
if (e.target.value === prevValue) { |
|
|
|
if (e.target.value === prevValue) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
messages.send(parent, keyupMessage(e.target)); |
|
|
|
|
|
|
|
prevValue = e.target.value; |
|
|
|
prevValue = e.target.value; |
|
|
|
|
|
|
|
return browser.runtime.sendMessage(keyupMessage(e.target)); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('load', () => { |
|
|
|
window.addEventListener('load', () => { |
|
|
@ -115,9 +110,8 @@ const showCommand = (text) => { |
|
|
|
completion = null; |
|
|
|
completion = null; |
|
|
|
let container = window.document.querySelector('#vimvixen-console-completion'); |
|
|
|
let container = window.document.querySelector('#vimvixen-console-completion'); |
|
|
|
container.innerHTML = ''; |
|
|
|
container.innerHTML = ''; |
|
|
|
messages.send(parent, keyupMessage(input)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Promise.resolve(); |
|
|
|
return browser.runtime.sendMessage(keyupMessage(input)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const showError = (text) => { |
|
|
|
const showError = (text) => { |
|
|
|