-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Internal links: use a Monaco link provider #2376
Conversation
Could you update the PR description with more detail for posterity? Great work! |
clarify a comment
Updated to address comments, and added a check in the preview component so that it also skips any links that can't be opened in the editor (rather than closing the selected note). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, code looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work on this PR. I left a comment about making the types more convenient for you and feel free to do that and merge without a re-approval; feel free to ignore it since it's just a small convenience thing.
This was a good find allowing us to avoid the complexity of re-implementing the built-in link state machine. It's a straightforward solution.
Great work! I've been waiting for something like this for years. Would it be possible to add anchor points to the link (to jump somewhere within a note)? For example the heading titles from markdown could be used? |
This PR adds a custom
LinkProvider
that searches the note forsimplenote://
links and linkifies them, then handles the click event by opening the linked note in the editor.If the note ID does not refer to a note we can open, it will silently fail. I'm not sure what else it can or should do in that case.
Also adds a check to the preview component to skip links that can't be opened (i.e. the noteId isn't in our notes list), as otherwise it closes the selected note in favor of.. nothing.