From 15b1d4cb75d3c961a03d01d124d062a9ed2ef2f8 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 29 Jul 2021 02:33:51 -0400 Subject: [PATCH] ace2_inner: Build `sidedivinner` programmatically --- src/static/js/ace2_inner.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index c7494cff9..3b83591b6 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -64,11 +64,17 @@ function Ace2Inner(editorInfo, cssManagers) { const outerDoc = outerWin.document; const sideDiv = outerDoc.getElementById('sidediv'); const lineMetricsDiv = outerDoc.getElementById('linemetricsdiv'); - const sideDivInner = (() => { - const htmlOpen = '
1'; - const htmlClose = '
'; - sideDiv.innerHTML = `${htmlOpen}${htmlClose}`; - return outerDoc.getElementById('sidedivinner'); + const sideDivInner = outerDoc.createElement('div'); + sideDivInner.id = 'sidedivinner'; + sideDivInner.classList.add('sidedivinner'); + sideDiv.appendChild(sideDivInner); + (() => { + const lineDiv = outerDoc.createElement('div'); + sideDivInner.appendChild(lineDiv); + const lineSpan = outerDoc.createElement('span'); + lineSpan.classList.add('line-number'); + lineSpan.appendChild(outerDoc.createTextNode('1')); + lineDiv.appendChild(lineSpan); })(); let lineNumbersShown = 1;