justpasteit icon indicating copy to clipboard operation
justpasteit copied to clipboard

Enhancement: automatic copying of url

Open ThejasKiranPS opened this issue 4 years ago • 7 comments

Main use of this project is to quickly share some text to other people. So wouldn't it be better if the url to share is automatically copied to clipboard when we click save button? (and also show a toast notification) If so Please assign to me

ThejasKiranPS avatar Oct 16 '21 04:10 ThejasKiranPS

@ThejasKiranPS Good one, I guess this makes total sense. If we need to implement this, I think we might need the Copy button also next to the save button and save can be replace with share. @alceil What are your thoughts on this

ajomadlabs avatar Oct 16 '21 05:10 ajomadlabs

Ya, it can be a good enhancement @ThejasKiranPS go ahead with it

alceil avatar Oct 16 '21 05:10 alceil

need some help. I'm having a dilemma on from where to copy the url to clipboard (typing page or share page)

Typing page

This should be the correct page to copy the url (immediately after clicking save/share), but since it immediately redirects to share page there wont be time to notify the user that the url had been copied (toast wont have time to display) But copying works perfectly So I tried to delay the history.push() command by 1.5 second so that the toast have enough time to display (i will link a pr so that you can view the netlify build)

Share page

Option 1

copy to clipboard after loading the component but that would cause all the users viewing the page( when we share the link) to get the toast it could be solved by keeping an isOwner variable in the authors browser which then can be read and determine if this is the author and if so copy the url But that would overcomplicate things

Option 2

copy to clipboard when clicking on the share button (in share page)

What to do?

ThejasKiranPS avatar Oct 16 '21 06:10 ThejasKiranPS

@ThejasKiranPS

I guess you can try the following approach

  • The user types the content in the editor
  • In that page he get's two options - share and copy
  • On clicking share - Call the api to generate unique link, copy that url to the clipboard and show a toast conveying that the share url has been generated and copied to your clipboard.
  • On clicking copy - The text will be copied to the clipboard.

Here we are trying to avoid the redirection to another page and doing all things in one single route.

ajomadlabs avatar Oct 16 '21 06:10 ajomadlabs

oooh that's pretty good. Working on it

ThejasKiranPS avatar Oct 16 '21 06:10 ThejasKiranPS

Hey, can you do a git pull and resolve conflicts new changes have been made!

alceil avatar Oct 17 '21 08:10 alceil

@alceil done

ThejasKiranPS avatar Oct 17 '21 10:10 ThejasKiranPS