Add 'Paste Link' Menu#32
Open
Paulemeister wants to merge 1 commit into
Open
Conversation
…al state. Pasting through those respects the setting for relative links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 the
Workspace.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.