dyoo / WeScheme

29 stars 16 forks source link

request: print whole page #54

Open dyoo opened 12 years ago

dyoo commented 12 years ago

Request from a Stack Overflow user: provide ability to print source code. http://stackoverflow.com/questions/9346711/how-to-print-wescheme-programs

schanzer commented 11 years ago

This is tricky, since CodeMirror never actually renders the entire program (if it did, we could just change the CSS).We'll have to detect print events programmatically.

There's a cross-browser javascript solution for detecting printEvents here: http://tjvantoll.com/2012/06/15/detecting-print-requests-with-javascript/

All we need to do is add a

node, and fill it with the program contents. Then we can use CSS to make sure that the only thing ever printed is div#print.