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 22, 2023
1 parent 1e954d8 commit e7bb999
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/WebworkClient/jwe_secure_format.pl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,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 e7bb999

Please sign in to comment.