@@ -22,34 +22,26 @@ if (hpList === undefined) hpList = {};
2222export default class HParsons extends RunestoneBase {
2323 constructor ( opts ) {
2424 super ( opts ) ;
25- console . log ( 'hparsons' )
2625 if ( opts ) {
2726 // TODO: what is orig?
2827 var orig = opts . orig ; // entire <pre> element that will be replaced by new HTML
2928 this . containerDiv = orig ;
30- this . origElem = $ ( orig ) . find ( "pre.parsonsblocks" ) [ 0 ] ;
29+ this . origElem = $ ( orig ) . find ( ".hparsons" ) [ 0 ] ;
30+ console . log ( 'hparsons' )
3131 console . log ( orig )
32+ console . log ( this . origElem )
3233 this . useRunestoneServices =
3334 opts . useRunestoneServices || eBookConfig . useRunestoneServices ;
3435 this . divid = orig . id ;
3536
3637 // The element that is going to be replaced
37- // this.elem = $(orig).find(".hparsons")[0];
3838 // Find the question text and store it in .question
3939 this . question = $ ( orig ) . find ( `.hparsons_question` ) [ 0 ] ;
4040 // TODO: idk what this is with shortanswer
41- // this.question = this.origElem.innerHTML;
42- // this.optional = false;
43- // if ($(this.origElem).is("[data-optional]")) {
44- // this.optional = true;
45- // }
46- // if ($(this.origElem).is("[data-mathjax]")) {
47- // this.mathjax = true;
48- // }
4941 this . renderHTML ( ) ;
5042 this . caption = "hparsons" ;
51- // this.addCaption("runestone");
52- // this.checkServer("hparsons", true);
43+ this . addCaption ( "runestone" ) ;
44+ this . checkServer ( "hparsons" , true ) ;
5345
5446 // Set the storageId (key for storing data)
5547 var storageId = super . localStorageKey ( ) ;
@@ -63,13 +55,15 @@ export default class HParsons extends RunestoneBase {
6355
6456 renderHTML ( ) {
6557 console . log ( 'renderhtml' ) ;
66- const div = document . createElement ( 'regex-element' ) ;
67- div . setAttribute ( 'input-type' , 'parsons' )
68- div . id = 'abcd' ;
69- $ ( this . origElem ) . replaceWith ( div ) ;
58+ // const div = document.createElement('regex-element');
59+ // div.setAttribute('input-type', 'parsons')
60+ // div.id = 'abcd';
61+ // console.log(this.origElem)
62+ $ ( this . origElem ) . html ( '<regex-element id="tool-area"></regex-element>' ) ;
63+ // console.log(this.origElem)
7064 // $(this.origElem).replaceWith(document.createElement('regex-element'));
7165 // $(this.elem).innerHTML = `<regex-element input-type='parsons' id="abcd"></regex-element>`;
72- console . log ( div )
66+ // console.log(div)
7367 }
7468
7569 checkCurrentAnswer ( ) { }
0 commit comments