Open huyz opened 2 years ago
I second this motion
This functionality should really be part of obsidian core... But until then, I guess some needs to make a PR...
Somehwere here, I guess:
I don't know js so I'm not sure where to start. One thing I don't understand is: once the autocompletion popup shows up (that should be after line 30, if I'm not mistaken), does the plugin unload (which would mean any code that removes the |
would have to go into the onunload() {}
section) or can we make it wait at line 30 to see if any file was selected in the autocomplete popup and if not, we delete the |
and move to the end of the link?
what if the internal page already exists? then there should be no need for an alias.
Yet, maybe it is a good idea to always add an alias, even when it is identical with the actual file link, because if you do, the text wont change in case the file name is changed (see #5 ).
The default "Add internal link" actually has 2 use cases that are different from your plugin's:
Your plugin is useful for another use case: when we know we want to link to an existing note and set an alias.
So I actually need to set 2 hotkeys to handle all these cases.
But there is a way to actually make your plugin better than the default command. And that's if there's a way to fallback to the original behavior in real time. For example, after hitting your command, the cursor is positioned just before the
|
character and the autocompletion pop-up shows up; if I could then just hit Esc, then the pop-up would close and your plugin would remove the|
character, then that would leave us with a more powerful combination.