Custom Templates with Scratchpad UI and injected code

Re: Custom Templates with Scratchpad UI and injected code

de către Richard Lobb-
Număr de răspunsuri: 1
If you inspect the rendered HTML for a CodeRunner question, you should see the original textarea element with an attribute data-global extra that contains what you want. i think you should be able to modify the scratchpad wrapper code to find that textarea and extract the globalextra code from it. I don't think I've ever done exactly that, though, but give it a go and report back.

Don't forget that there will in general be multiple questions on a page so you need to find the right one.
Ca răspuns la Richard Lobb

Re: Custom Templates with Scratchpad UI and injected code

de către Mike McDowell-

Returning to this I made a couple quick mods to ui_scratchpad.js (modded version attached)

It now allows for the insertion of code from the global extra field using {| GLOBAL_EXTRA |} similar to the existing {| ANSWER_CODE |} and {| SCRATCHPAD_CODE |} functionality.