Open Skateside opened 8 months ago
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()
.
So I've managed to get this working but not overly keen on the result https://github.com/AdmiralGT/botc-scripts/pull/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.
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.)
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.