Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: copy script to clipboard #366

Open
Skateside opened this issue Jan 30, 2024 · 3 comments
Open

Feature: copy script to clipboard #366

Skateside opened this issue Jan 30, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@Skateside
Copy link

Description
A button that can copy the script JSON to the clipboard. The language wouldn't matter.

Additional context
I got a feature request for the Pocket Grimoire to allow a script's JSON to be pasted directly. This seems to have been well received and, when I announced it, someone mentioned that being able to copy JSON from the script repository directly would be a cool addition.

@Skateside Skateside added the enhancement New feature or request label Jan 30, 2024
@AdmiralGT
Copy link
Owner

AdmiralGT commented Jan 30, 2024

This is what I've tried to achieve with the JSON button that currently exists but I had trouble with this writing the JSON content to clipboard and hence why I write the API URL which is itself just the JSON content. It's possible that I'm using the wrong method and need to use .write() rather than .writeText().

@AdmiralGT
Copy link
Owner

So I've managed to get this working but not overly keen on the result
#367

It basically results in the entire JSON being inserted as a Javascript element on the page. Going to hold off merging this and have a think about the solution.

@dgfranklin
Copy link

FWIW, I think this would be a great feature and your implementation of it is roughly how I'd do it as well.

Moreover, I'd look at Angular CDK's implementation here (and wrapped here) which might serve as a good reference for making the added element hidden and subsequently removing it (as well as handling some browser-specific edge cases.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants