Work on toolbar buffer solution
This commit is contained in:
parent
d70732d12b
commit
b3c0097270
@ -214,6 +214,9 @@ let appCode = function (){
|
||||
if (request.keys == "Backspace"){
|
||||
keyBuffer = keyBuffer.slice(0, -1)
|
||||
}
|
||||
else if (request.keys == "Tab"){
|
||||
keyBuffer += "\t"
|
||||
}
|
||||
else if(request.keys.length > 4){
|
||||
// pass
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
<button id="toggleSite">Disable Keyboard Privacy</button>
|
||||
<p id="reloadPage">Refresh the page to apply</p>
|
||||
|
||||
<textarea id="keyBuffer" cols="20" rows="10" placeholder="Type in this buffer then click where you want to send it on the page"></textarea>
|
||||
<br>
|
||||
<textarea id="keyBuffer" cols="20" rows="10" placeholder="Text typed here will be sent to active input/textarea elements."></textarea>
|
||||
</body>
|
||||
</html>
|
@ -43,6 +43,20 @@ function getCurrent(){
|
||||
|
||||
let sender = async function(e){
|
||||
|
||||
if (e.key == 'Tab') {
|
||||
e.preventDefault();
|
||||
let start = this.selectionStart;
|
||||
let end = this.selectionEnd;
|
||||
|
||||
// set textarea value to: text before caret + tab + text after caret
|
||||
this.value = this.value.substring(0, start) +
|
||||
"\t" + this.value.substring(end);
|
||||
|
||||
// put caret at right position again
|
||||
this.selectionStart =
|
||||
this.selectionEnd = start + 1;
|
||||
}
|
||||
|
||||
let sendMessageToTabs = function(tabs){
|
||||
doSendMsg(e.key, tabs)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user