Yank now works; paste to open is broken

This commit is contained in:
Oliver Blanthorn 2017-10-19 13:21:55 +01:00
parent c76d3a6c9a
commit 238f4c1063
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 18 additions and 6 deletions

View file

@ -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

View file

@ -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"],