diff --git a/corsscripts/stacksortable.js b/corsscripts/stacksortable.js index b1788dbb6f7..20c66066273 100644 --- a/corsscripts/stacksortable.js +++ b/corsscripts/stacksortable.js @@ -31,7 +31,7 @@ export const stack_sortable = class { generate_available(proofSteps) { for (const key in this.state.available) { let li = document.createElement("li"); - li.innerText = proofSteps[this.state.available[key]]; + li.innerHTML = proofSteps[this.state.available[key]]; li.setAttribute("data-id", this.state.available[key]); li.className = "list-group-item"; this.available.append(li); @@ -41,7 +41,7 @@ export const stack_sortable = class { generate_used(proofSteps) { for (const key in this.state.used) { let li = document.createElement("li"); - li.innerText = proofSteps[this.state.used[key]]; + li.innerHTML = proofSteps[this.state.used[key]]; li.setAttribute("data-id", this.state.used[key]); li.className = "list-group-item"; this.used.append(li); diff --git a/corsscripts/stacksortable.min.js b/corsscripts/stacksortable.min.js index 68141404540..8c21e8938a3 100644 --- a/corsscripts/stacksortable.min.js +++ b/corsscripts/stacksortable.min.js @@ -1,5 +1,5 @@ export const stack_sortable=class{constructor(state,availableId,usedId,inputId=null,options=null){this.state=state;this.inputId=inputId;if(inputId!=null){this.input=document.getElementById(this.inputId);};this.availableId=availableId;this.available=document.getElementById(this.availableId);this.usedId=usedId;this.used=document.getElementById(this.usedId);this.defaultOptions={animation:50};if(options==null){this.userOptions=this.defaultOptions;}else{this.userOptions=Object.assign(this.defaultOptions,options);};this.options=Object.assign(this.userOptions,{ghostClass:"list-group-item-info",group:"shared"});} -generate_available(proofSteps){for(const key in this.state.available){let li=document.createElement("li");li.innerText=proofSteps[this.state.available[key]];li.setAttribute("data-id",this.state.available[key]);li.className="list-group-item";this.available.append(li);};} -generate_used(proofSteps){for(const key in this.state.used){let li=document.createElement("li");li.innerText=proofSteps[this.state.used[key]];li.setAttribute("data-id",this.state.used[key]);li.className="list-group-item";this.used.append(li);};} +generate_available(proofSteps){for(const key in this.state.available){let li=document.createElement("li");li.innerHTML=proofSteps[this.state.available[key]];li.setAttribute("data-id",this.state.available[key]);li.className="list-group-item";this.available.append(li);};} +generate_used(proofSteps){for(const key in this.state.used){let li=document.createElement("li");li.innerHTML=proofSteps[this.state.used[key]];li.setAttribute("data-id",this.state.used[key]);li.className="list-group-item";this.used.append(li);};} update_state(newUsed,newAvailable){var newState={used:[],available:[]};newState.used=newUsed.toArray();newState.available=newAvailable.toArray();if(this.inputId!=null){this.input.value=JSON.stringify(newState);this.input.dispatchEvent(new Event('change'));};this.state=newState;}};export default{stack_sortable}; \ No newline at end of file diff --git a/stack/cas/castext2/blocks/parsons.block.php b/stack/cas/castext2/blocks/parsons.block.php index 9c1cdf4d0fc..7cbe985d9af 100644 --- a/stack/cas/castext2/blocks/parsons.block.php +++ b/stack/cas/castext2/blocks/parsons.block.php @@ -102,10 +102,14 @@ public function compile($format, $options): ? MP_Node { new MP_String('script'), new MP_String(json_encode(['type' => 'text/javascript', 'src' => $js])) ]);*/ + $resizeScript = ''; // We need to define a size for the inner content. $width = '100%'; - $height = '400px'; + $height = '100px'; $aspectratio = false; if (array_key_exists('width', $xpars)) { $width = $xpars['width']; @@ -138,7 +142,7 @@ public function compile($format, $options): ? MP_Node { #availableList:empty {height:50px;background-color:lightpink} '); - $r->items[] = new MP_String('
+ $r->items[] = new MP_String('
      @@ -203,8 +207,9 @@ public function compile($format, $options): ? MP_Node { $code .= 'const sortable = new stack_sortable(state, "availableList", "usedList", id, userOpts);' . "\n"; $code .= 'sortable.generate_used(proofSteps);' . "\n"; $code .= 'sortable.generate_available(proofSteps);' . "\n"; + if (count($inputs) > 0) { - $code .= 'MathJax.typesetPromise();' . "\n"; + //$code .= 'MathJax.typesetPromise();' . "\n"; }; $code .= 'var opts = {...sortable.options, ...{onSort: () => {sortable.update_state(sortableUsed, sortableAvailable);}}}' . "\n"; $code .= 'var sortableUsed = Sortable.create(usedList, opts);' . "\n";