Skip to content
Snippets Groups Projects
Commit 16e75dc0 authored by William Faircloth's avatar William Faircloth
Browse files

add imgs

parent 8e59184b
No related branches found
No related tags found
No related merge requests found
Pipeline #6041 failed
......@@ -20,6 +20,21 @@
behavior: 'instant'
});
});
function fixImgs(html: string): string {
const parser = new DOMParser();
const doc = parser.parseFromString(html, 'text/html');
const imgs = doc.querySelectorAll('img');
imgs.forEach(img => {
const src = img.getAttribute('src');
if (src && !src.startsWith('http')) {
img.setAttribute('src', new URL(src, "https://systems.cs.odu.edu/img/").href);
}
});
// delete all "{width=".*"}"
return doc.body.innerHTML.replaceAll(/{width=".*"}/g, '');
}
</script>
<div
......@@ -42,7 +57,7 @@
</div>
<div class="answer">
<h3>Archibald</h3>
<div class="bubble">{@html converter.makeHtml(context.response)}</div>
<div class="bubble">{@html fixImgs(converter.makeHtml(context.response))}</div>
</div>
{/each}
{/if}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment