mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 09:31:41 -05:00
Yank now works; paste to open is broken
This commit is contained in:
parent
c76d3a6c9a
commit
238f4c1063
2 changed files with 18 additions and 6 deletions
|
@ -362,12 +362,23 @@ export function fillcmdline(str?: string) {
|
|||
export function clipboard(excmd = "open"){
|
||||
let scratchpad = document.createElement("input")
|
||||
scratchpad.contentEditable = "true"
|
||||
scratchpad.textContent = window.location.href
|
||||
scratchpad.select()
|
||||
document.execCommand("Copy")
|
||||
console.log(scratchpad)
|
||||
let pastecontent = scratchpad.textContent
|
||||
console.log(pastecontent)
|
||||
document.documentElement.appendChild(scratchpad)
|
||||
if (excmd == "yank"){
|
||||
scratchpad.value = window.location.href
|
||||
scratchpad.select()
|
||||
document.execCommand("Copy")
|
||||
scratchpad.select()
|
||||
// open is broken - fails with Failed to execute excmd: clipboard(...open)!
|
||||
} else if (excmd == "open"){
|
||||
scratchpad.focus()
|
||||
document.execCommand("Paste")
|
||||
let url = scratchpad.textContent
|
||||
console.log(url)
|
||||
open(url)
|
||||
}
|
||||
document.documentElement.removeChild(scratchpad)
|
||||
// let pastecontent = scratchpad.textContent
|
||||
// console.log(pastecontent)
|
||||
}
|
||||
|
||||
//#content
|
||||
|
|
|
@ -38,6 +38,7 @@ export namespace normalmode {
|
|||
["]]", "clicknext"],
|
||||
["[[", "clicknext prev"],
|
||||
["T", "current-url tab"],
|
||||
["yy", "clipboard yank"],
|
||||
["p", "clipboard open"],
|
||||
["P", "clipboard tabopen"],
|
||||
["j", "scrollline 10"],
|
||||
|
|
Loading…
Add table
Reference in a new issue