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

Easy way to copy code. #4

Closed
cramdesign opened this issue Jul 10, 2013 · 4 comments
Closed

Easy way to copy code. #4

cramdesign opened this issue Jul 10, 2013 · 4 comments

Comments

@cramdesign
Copy link

It would be a good idea if there were an easy way to copy the code from the source window. Perhaps a little button? Cheers.

@GeoffYoung
Copy link
Contributor

You could add a "copy to clipboard" button with the ZeroClipboard library, but personally I don't think it's that compelling of a feature.
Javascript add text to the clipboard, but you can select the text. Maybe a "get the code" button that selects the sample markup will do the job, assuming that selecting the text for them is enough of a visual cue for them to hit Ctrl+C.

@bjankord
Copy link
Owner

@GeoffYoung When looking around for solutions I came across ZeroClipboard as well.

I like the idea of going with a solution that selects the text and prompts the user to hit Ctrl+C to copy it. It is unfortunate JavaScripts has limitations with the clipboard. ZeroClipboard is nice and gets around these limitations, though I'd prefer to avoid a solution that uses flash.

I'll start working on Ctrl+C solution this weekend.

@GeoffYoung
Copy link
Contributor

I made a sample to make sure selecting text wouldn't be unreasonably difficult. I can pretty it up a little and make a PR.

@bjankord
Copy link
Owner

Thanks @GeoffYoung The PR looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants