Skip to content

Commit ce5c2aa

Browse files
committed
enhance reportAnswer results with both text and HTML versions
1 parent ccb8ba9 commit ce5c2aa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/web/js/events.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,14 @@ function makeEvents(config) {
283283

284284
if(typeof reportAnswer === 'string') {
285285
const state = { ...getCurrentState(config), replContents: "" };
286+
const elts = $("#output").children(".echo-container").last().nextAll();
287+
const texts = elts.map((_, e) => $(e).text()).get();
288+
const htmls = elts.map((_, e) => $(e).html()).get();
289+
const textResult = JSON.stringify({ texts, htmls });
286290
comm.sendEvent({
287291
type: "interactionResult",
288292
reportAnswer,
289-
textResult: $("#output").children().last().text(),
293+
textResult,
290294
}, `Reporting an interaction by request, ${src} ${reportAnswer}.`, state);
291295
}
292296
}

0 commit comments

Comments
 (0)