Skip to content

Commit

Permalink
correct HTML formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
smmercuri committed Nov 7, 2023
1 parent ff99a64 commit b8ee5e5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions corsscripts/stacksortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions corsscripts/stacksortable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions stack/cas/castext2/blocks/parsons.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<script type="text/javascript">' . "\n";
$resizeScript .= 'function resizeIframe(iframe) {' . "\n";
$resizeScript .= 'iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";}' . "\n";
$resizeScript .= '</script>';

// 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'];
Expand Down Expand Up @@ -138,7 +142,7 @@ public function compile($format, $options): ? MP_Node {
#availableList:empty {height:50px;background-color:lightpink}
</style>');

$r->items[] = new MP_String('<div class="container" style="width:100%;height:100%:">
$r->items[] = new MP_String('<div class="container" style="' . $astyle . '">
<div class="row">
<ul class="list-group col" id="usedList"></ul>
<ul class="list-group col" id="availableList"></ul>
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit b8ee5e5

Please sign in to comment.