diff --git a/app/grandchallenge/core/static/js/markdownx_full_page.js b/app/grandchallenge/core/static/js/markdownx_full_page.js index 4936a4a055..18876f2a5a 100644 --- a/app/grandchallenge/core/static/js/markdownx_full_page.js +++ b/app/grandchallenge/core/static/js/markdownx_full_page.js @@ -1,15 +1,16 @@ -$('document').ready(function(){ +$("document").ready(() => { // Sync the height of the preview element to the height of the editor element. - let ELEMENTS = document.getElementsByClassName('markdownx'); - Object.values(ELEMENTS).map(function (element) { - let editor = element.querySelector('.markdownx-editor'), preview = element.querySelector('.markdownx-preview'); - preview.style.height = editor.clientHeight + "px"; - const resizeObserver = new ResizeObserver((entries) => { - for (const entry of entries) { - if (entry.contentBoxSize) { - preview.style.height = editor.clientHeight + "px"; + const ELEMENTS = document.getElementsByClassName("markdownx"); + Object.values(ELEMENTS).map(element => { + const editor = element.querySelector(".markdownx-editor"); + const preview = element.querySelector(".markdownx-preview"); + preview.style.height = `${editor.clientHeight}px`; + const resizeObserver = new ResizeObserver(entries => { + for (const entry of entries) { + if (entry.contentBoxSize) { + preview.style.height = `${editor.clientHeight}px`; + } } - } }); resizeObserver.observe(editor); });