mirror of
https://github.com/Ellpeck/ObsidianCustomFrames.git
synced 2024-11-14 14:59:08 +01:00
added copy link action
This commit is contained in:
parent
7bef7cdd0a
commit
85e9c5a0a4
1 changed files with 15 additions and 4 deletions
19
src/view.ts
19
src/view.ts
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue