Closed herrkaefer closed 2 years ago
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
For more information, open the CLA check for this pull request.
I'm not sure this is universally useful. While it may suit your personal use case (for example, by including the
🔗
emoji), other users may have different preferences.
@tomayac Thanks for your comments! The modifications are all based on my personal need, and they makes this tool much more useful to me than the default behavior, i.e. only copy the link of the text. The 🔗 was a replace of the original design: "Some text [link]" i.e. append a "[link]" to the text. I had been wondering quite a while between them.
Please feel free to ignore this pull request if you feel uncomfortable with the customization. Thanks for your work.
Left some more comments. I think we can add this as a third alternative link option:
https://example.com/#:~:text=Example%20Domain,-This%20domain%20is
.Example Domain
.Example Domain
🔗 https://example.com/#:~:text=Example%20Domain,-This%20domain%20is
."HTML" has been renamed to "rich plus raw" in 582a8cbb9e1de8713b70ca824013f031ff8a3081.
Applying encodeURI
to the url
seems to have fixed the encoding issue, by which I mean it has at least passed a few testings on my side. Now "rich" and "rich plus raw" both copy the link as HTML (as a
element).
@herrkaefer Just wanted to let you know that this PR is still on my radar. I simply need to deal with an urgent deadline for an event. Thanks for your patience.
@tomayac Thanks for your attention! Would like to update if you have more comments.
With the added "HTML" link style the selected text is copied with its original HTML format, plus a link appended at the end. The purpose is to preserve the text format rather than just copying the text string.
Explanation of motivation: When copying text fragment for note taking, I want both the text and the link be placed in the note. The "rich" style actually provides this, but seems not perfect: 1) The original format is lost, but many apps can recognize the HTML during copy and display it pretty; 2) The link is applied to the whole text, which sometimes seems annoying especially when you want to select part of the copied text.
I noticed that the URL in the rich style has some encoding issue: the spaces are still space which should be %20. Didn't figure out a way to fix it. So in the HTML style, the link is added as a markdown style:
[🔗 ](url)
.