From ffd7a0351a0136573df2ada7cc204e1b64459955 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 25 Aug 2022 20:13:22 +0200 Subject: [PATCH] Improve display of images for code output --- app/assets/javascripts/editor/evaluation.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/editor/evaluation.js b/app/assets/javascripts/editor/evaluation.js index 6fbec44a..a4a9311a 100644 --- a/app/assets/javascripts/editor/evaluation.js +++ b/app/assets/javascripts/editor/evaluation.js @@ -209,6 +209,13 @@ CodeOceanEditorEvaluation = { if (output.stdout !== undefined && !output.stdout.startsWith(" document + const parsedElement = doc.firstChild.lastChild.firstChild; + const sanitized_img = document.createElement('img'); + sanitized_img.src = parsedElement.src; + output.stdout = sanitized_img.outerHTML; } var element = this.findOrCreateOutputElement(index);