added copy link action

This commit is contained in:
Ell 2022-03-29 15:53:18 +02:00
parent 7bef7cdd0a
commit 85e9c5a0a4

View file

@ -5,13 +5,19 @@ export class CustomFrameView extends ItemView {
private static readonly actions: Action[] = [
{
name: "Open dev tools",
icon: "binary",
action: v => v.toggleDevTools()
}, {
name: "Return to original page",
icon: "home",
action: v => v.return()
},
{
name: "Open dev tools",
icon: "binary",
action: v => v.toggleDevTools()
},
{
name: "Copy link",
icon: "link",
action: v => v.copyLink()
}, {
name: "Refresh",
icon: "refresh-cw",
@ -140,6 +146,11 @@ export class CustomFrameView extends ItemView {
}
}
}
private copyLink(): void {
let link = this.frame instanceof HTMLIFrameElement ? this.frame.contentWindow.location.href : this.frame.getURL();
navigator.clipboard.writeText(link);
}
}
interface Action {