ScoopInstaller / scoopinstaller.github.io

ScoopInstaller homepage and search engine
https://scoop.sh
MIT License
78 stars 18 forks source link

Use navigator.clipboard.writeText() instead of deprecated method #51

Closed r15ch13 closed 1 year ago

r15ch13 commented 1 year ago

Since document.execCommand('copy') seems to be deprecated shouldn't it use navigator.clipboard.writeText() instead for copying commands?

Could writeText() handle the state of the copy button?

navigator.clipboard.writeText(searchValue).then(
  () => {
    // handle effect based on success
  },
  () => {
    // handle effect based on error
  }
);

I tried to fiddle around with it but I don't get how exactly data flows in React. (never used it)

gpailler commented 1 year ago

Thanks for the info about the deprecated command. I switched to the new writeText() API and this new version is available on https://scoop.sh/scoopinstaller-dev.github.io but I need to run some extra checks before deploying to https://scoop.sh

Could you give it a try on your side?

r15ch13 commented 1 year ago

Works great 👍🏽

gpailler commented 1 year ago

Deployed to https://scoop.sh. 🚀 Thanks again