1bl4z3r / hermit-V2

Continuing Hermit's legacy to be minimal and fast theme
https://1bl4z3r.github.io/hermit-V2/
MIT License
79 stars 33 forks source link

Request: `shareSocial` option to copy link to clipboard #41

Closed jamesbraza closed 10 months ago

jamesbraza commented 10 months ago

Here is what my current share menu looks like (as of https://github.com/1bl4z3r/hermit-V2/commit/3eabdaf2b46a01d2abe0e137919c2f9c825a8f43), and it looks great. 🥳

screenshot of share menu

For many share features on other website, a sharing option is supported that copies the page's hyperlink to the clipboard. On Google Chrome's mobile app, this sharing option is called "Copy link".

My request here: add a share option for just copying the page's link to the clipboard

1bl4z3r commented 10 months ago

Hi @jamesbraza, I was unable to understand your question completely. Could you please describe a workflow. Please make a mockup or a drawing for me to understand properly

As I can see, long pressing icon of the share links (on chrome mobile) opens context menu to copy link.

OR, are you asking about integration with browser's Clipboard API and copying the URL to system/browser clipboard?

jamesbraza commented 10 months ago

Yeah sorry for being unclear, let me elaborate 👌

long pressing icon of the share links (on chrome mobile) opens context menu to copy link.

My thinking here is, this is a possible route on mobile, but not necessarily on computers. Also, fwiw one has to know to long-press on the title.

I find an explicit "copy link" icon as part of the share modal, something like this (in blue box):

Though it doesn't need to actually have the text "copy link". Another possible route I found here from JIRA:

screenshot of JIRA share

And another, this one is from Google Drive:

screenshot of Google Drive share

Does that clarify what I am looking for? One of these copy link icons in the share socials modal

1bl4z3r commented 10 months ago

Yeah, that can be done. I will try to hook into browsers' Share API (which will bring up share page like your first image) for mobile and Clipboard API (to simply copy the link) for desktops.

There will be checks nonetheless if browsers supports the API.

Let me know if you are on board with this.

jamesbraza commented 10 months ago

Yeah I like what you're thinking with outsourcing to browser. For me, I am primarily a desktop user.

Thanks for being open to this! 👍

1bl4z3r commented 10 months ago

Sure, its a few lines of JS. Changes will be there shortly

1bl4z3r commented 10 months ago

Added Share link. If you want to change order, you may extend the partial. image

It first checks if browser supports Webshare API, if yes, it will ask Browser/OS to open Share Link Else it invokes Clipboard API to copy the URL (Clipboard cannot copy much BTW). If everything fails, you will get Console output.

Closing this issue

jamesbraza commented 10 months ago

Gave it a try just now, and it worked!! Yaayy!

Nice job @1bl4z3r 👍