Button for copy to clipboard
We often find ourselves doing a web service call in swagger-ui and wanting to subsequently copy the result to the clipboard. Currently the only option is to go to the text box and mark the text using the mouse of keyboard (cmd-A is not a viable shortcut since it'll select the entire page).
I've seen other applications add a "copy to clipboard" button next to content which people typically want to copy to elsewhere. I think that such a button next to (or above) the response body output would be nice.
I don't think it's rocket science either. So if you like the idea, I can try to implement it and do a PR.
Hi, that is a good suggestion, and it was once in swagger-ui. The reason it was removed was because of large definitions taking a long time to create all the "copy" buttons (it was using flash if I recall). If it can be done on-demand (like when expanding a resource), it'd be great to have.
Great. I'd be very surprised if it caused any overhead to add these buttons in the current JS/HTML5 based implementation. I'm less surprised to learn that ol' Flash performed poorly :)
I'll see if I can find the time to add it and also to check how it impacts performance.
Thank you, there are probably better techniques than what we did before. Would be happy if you had time to contribute.
Closing as an old ticket. If anyone wants to submit a PR to cover this issue, we'd be happy to review.
I would be interested in this too. As explained in the description, when you need to call a series of endpoints passing the response of one as the input of another, the live demo experience becomes quite clunky (although you could prepare everything upfront, but still!).
I see a couple of options to tackle this:
- adding a small copy button next to the textbox of the response;
- enabling something like "triple click" in the text box to select all (like it happens here on GitHub when you triple click on a snippet), e.g.
triple click meeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Based on the this comment, I believe this issue was closed because of the lack of contributor. I would be happy to help, assuming there is a preference in the options listed above.
@webron, would you be inclined to reopen this issue?
+1 for this enhancement
+1
+1
+1
+1