Skip to content

Commit 90d91a9

Browse files
committed
support postMessage "showSolutions"
1 parent 970b911 commit 90d91a9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/WeBWorK/lib/WebworkClient/jwe_secure_format.pl

+6
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@
9191
});
9292
event.source.postMessage('updated templates', event.origin);
9393
}
94+
95+
if (message.hasOwnProperty('showSolutions')) {
96+
const elements = Array.from(window.document.querySelectorAll('.knowl[data-type="solution"]'));
97+
const solutions = elements.map(el => el.dataset.knowlContents);
98+
event.source.postMessage(JSON.stringify({solutions: solutions}), event.origin);
99+
}
94100
});
95101
</script>
96102
</body>

0 commit comments

Comments
 (0)