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 5, 2023
1 parent 970b911 commit c4e76ed
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), event.origin);
}
});
</script>
</body>
Expand Down

0 comments on commit c4e76ed

Please sign in to comment.