Skip to content

Commit

Permalink
support postMessage "showSolutions"
Browse files Browse the repository at this point in the history
  • Loading branch information
drdrew42 committed May 9, 2023
1 parent 970b911 commit 90d91a9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/WeBWorK/lib/WebworkClient/jwe_secure_format.pl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@
});
event.source.postMessage('updated templates', event.origin);
}
if (message.hasOwnProperty('showSolutions')) {
const elements = Array.from(window.document.querySelectorAll('.knowl[data-type="solution"]'));
const solutions = elements.map(el => el.dataset.knowlContents);
event.source.postMessage(JSON.stringify({solutions: solutions}), event.origin);
}
});
</script>
</body>
Expand Down

0 comments on commit 90d91a9

Please sign in to comment.