-
-
Notifications
You must be signed in to change notification settings - Fork 603
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
"Remove Link" option in the right-click context menu for links #5126
Conversation
Thank you for opening your first PR! 🎉 We are very happy and would like to thank you very much for your contribution. If everything checks out, we'll make sure to review the PR as soon as possible and give feedback. In the meantime, to make the reviewing process as fast as possible, you can help us by checking the following things:
Furthermore, make sure that the linter does not complain, which will check your code on every new commit. If the linter task fails, make sure to run |
Authored-by: MWBruce <MaxwellWallaceBruce@gmail.com>
ab01667
to
2283e72
Compare
Thank you! Looks good so far -- just one comment: instead of slicing the entire node, you can also just search for the various child nodes that it should have. If I remember correctly, the link title that you want is not represented by its own node, instead you would have to check for two CodeMark nodes, and slice from the end of the first to the start of the second. That makes it more resilient to edge cases and leverages the parser more. I think I already implemented that snippet in the markdown AST parser module. I think searching for |
- Deal with either of the link nodes being selected (Text or Url) - Use same logic as AST Parser to parse the LinkText
This has been implemented as suggested. |
Looks good. I found one issue while testing this out, though: It doesn't work with angle brackets links, i.e.: This is some text with a plain link: <https://www.google.com> Right-clicking that link will give you the option to remove a link, but it won't actually remove the angled brackets as I would expect it. |
I didn't even know this was a possible markdown link :) |
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.
We're getting there! Just a few more things!
source/common/modules/markdown-editor/util/remove-markdown-link.ts
Outdated
Show resolved
Hide resolved
source/common/modules/markdown-editor/util/remove-markdown-link.ts
Outdated
Show resolved
Hide resolved
source/common/modules/markdown-editor/util/remove-markdown-link.ts
Outdated
Show resolved
Hide resolved
source/common/modules/markdown-editor/util/remove-markdown-link.ts
Outdated
Show resolved
Hide resolved
source/common/modules/markdown-editor/util/remove-markdown-link.ts
Outdated
Show resolved
Hide resolved
328816d
to
b69f2d1
Compare
Hi @nathanlesage, I believe all your comments above, except the one regarding the reference style links have been implemented. |
@kyaso Further to a discord conversation I had with Nathan could you please advise if there is anything further required. |
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.
Sorry for the late reply!
I just tested your PR locally, and it seems to do its job, so everything fine code-wise from my side.
One thing we should add is a Changelog entry (see https://github.com/Zettlr/Zettlr/blob/develop/CHANGELOG.md). You can add it under the "GUI and Functionality" section.
Once this has been done, I guess, @nathanlesage, we can merge?
Hi, a changelog entry has now been added under the "GUI and Functionality" section. |
Looks good for me, too, but the linter is complaining about an extra semicolon and about another issue (see the unit test) — once that's fixed we can merge. Thanks @kyaso for the code review! |
Apologies should have checked this before hand, all should be fixed now. |
All good, no worries! I'll wait for the unit tests to finish and then merge it in! Thanks again for the work! |
There we go, your PR got merged! Welcome to the party! 🔥 |
Description
#5046 Adds a "Remove Link" option in the right-click context menu for links, which when clicked would remove the URL and associated markup from the markdown text, leaving only the text.
Changes
Additional information
Tested on: