@@ -355,7 +355,8 @@ function createGradingPanel(element, acid, studentId, multiGrader) {
355355 }
356356 }
357357 $ . getJSON ( "/runestone/admin/htmlsrc" , data , async function ( result ) {
358- var htmlsrc = result ;
358+ var htmlsrc = result . htmlsrc ;
359+ const attachURL = result . attach_url ;
359360 var enforceDeadline = $ ( "#enforceDeadline" ) . is ( ":checked" ) ;
360361 var dl = showDeadline ( ) ;
361362 await renderRunestoneComponent ( htmlsrc , elementID + ">#questiondisplay" , {
@@ -367,6 +368,7 @@ function createGradingPanel(element, acid, studentId, multiGrader) {
367368 tzoff : new Date ( ) . getTimezoneOffset ( ) / 60 ,
368369 multiGrader : multiGrader ,
369370 gradingContainer : elementID ,
371+ attachURL : attachURL ,
370372 } ) ;
371373 } ) ;
372374
@@ -1816,14 +1818,17 @@ function create_question(formdata) {
18161818}
18171819
18181820// Given a question ID, preview it.
1821+ // This is NOT the function used to generate the grading panel on the grades page
1822+ // this is used in other places.
18191823function preview_question_id ( question_id , preview_div , sid , gradeit ) {
18201824 if ( arguments . length == 1 ) {
18211825 preview_div = "component-preview" ;
18221826 }
18231827 // Request the preview HTML from the server.
18241828 $ . getJSON ( "/runestone/admin/htmlsrc" , {
18251829 acid : question_id ,
1826- } ) . done ( function ( html_src ) {
1830+ } ) . done ( function ( jsonData ) {
1831+ html_src = jsonData . htmlsrc
18271832 // Render it.
18281833 data = { acid : question_id } ;
18291834 if ( sid ) {
@@ -2058,7 +2063,7 @@ async function renderRunestoneComponent(componentSrc, whereDiv, moreOpts) {
20582063 }
20592064 // $(`#${whereDiv}`).css("background-color", "white");
20602065 }
2061- MathJax . Hub . Queue ( [ "Typeset" , MathJax . Hub ] ) ;
2066+ MathJax . typeset ( [ document . querySelector ( `# ${ whereDiv } ` ) ] )
20622067}
20632068
20642069// Called by the "Search" button in the "Search question bank" panel.
0 commit comments