Skip to content

Add 'Paste Link' Menu#32

Open
Paulemeister wants to merge 1 commit into
mgmeyers:mainfrom
Paulemeister:main
Open

Add 'Paste Link' Menu#32
Paulemeister wants to merge 1 commit into
mgmeyers:mainfrom
Paulemeister:main

Conversation

@Paulemeister
Copy link
Copy Markdown

I hacked together two menu entries and commands for pasting links and embedded links. This has the advantage that the target file is known and relative paths can be calculated by obsidian.

Internally the file, subpath(heading or block) and if the link was a heading is stored so that i can be used to recalculate the link based on the currently open file to paste into.

Do you think an extra menu is the right way to go? One could also hook into theWorkspace.on('editor-paste') handler. That would require checking the clipboard for the last copied link ( don't want to paste the link if the clipboard was modified). Maybe adding settings to switch between those behaviors would be nice.

I'm by no means a JS dev and i find the obsidian docs to be not that verbose. If you have objections to the coding style or i made some mistakes, let me know, I'll get to it.

Should fix #25 or at least be a workaround for it.

…al state. Pasting through those respects the setting for relative links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Links are not relative to pasted location

1 participant