Skip to content

Commit e7bb999

Browse files
committed
support postMessage "showSolutions"
1 parent 1e954d8 commit e7bb999

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: lib/WebworkClient/jwe_secure_format.pl

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

0 commit comments

Comments
 (0)