hnakamur / FormatLink-Firefox

A Firefox web-extension to copy the URL and the title or the selected text to clipboard
https://addons.mozilla.org/ja/firefox/addon/format-link3/
MIT License
45 stars 8 forks source link

unexpected result when pasting (template seems to be partially ignored) #36

Closed atomGit closed 4 years ago

atomGit commented 4 years ago

given the name of this extension, i suspect this request may be outside its scope, but i'm really hoping it isn't ...

one of the things i need to do is copy a linked page title and article excerpt - for this i'm a template similar to the following:

<h2><a href="{{url}}">{{title}}</a></h2>\n{{text}}

if the {{text}} part has a link in it however, it seems all the selected text is ignored except for the link text and the {{url}} used for the page title is not the page URL

hnakamur commented 4 years ago

I'm afraid it is the expected behavior for the {{url}} variable. Maybe we can add another {{page_url}} variable which always expands to the page URL.

atomGit commented 4 years ago

that would be super!

will that also allow copying/pasting all of the selected text (rather than just the link text)?

hnakamur commented 4 years ago

will that also allow copying/pasting all of the selected text (rather than just the link text)?

No, but I fixed it at https://github.com/hnakamur/FormatLink-Firefox/pull/37/commits/0b042433fc567d288622aefb9b1c1152b838d455 in https://github.com/hnakamur/FormatLink-Firefox/pull/37

I just submitted version 5.1.0, you can try it once published.

hnakamur commented 4 years ago

As for the {{url}} variable, it expands to the page URL if you open the context menu outside of links after selecting text containings links.

atomGit commented 4 years ago

actually 'outside of links' doesn't seem accurate - you have to open the context menu while hovering completely outside of any selected text that contains a link for {{url}}} to expand to the page URL

it is a bit awkward to have to click off of the selected text, but it does what i need it to do now so thanks! i think that adding a {page_url} variable might still be worth while though - i'll let you close this since i don't know what you want to do

hnakamur commented 4 years ago

I already added {{page_url}} variable in version 5.1.0 which is published by now. Could you try that?

atomGit commented 4 years ago

sorry, i didn't realize that ... and yes, it works fine - thanks