ace2_inner: Build `sidedivinner` programmatically

pull/5153/head
Richard Hansen 2021-07-29 02:33:51 -04:00
parent b80295c228
commit 15b1d4cb75
1 changed files with 11 additions and 5 deletions

View File

@ -64,11 +64,17 @@ function Ace2Inner(editorInfo, cssManagers) {
const outerDoc = outerWin.document; const outerDoc = outerWin.document;
const sideDiv = outerDoc.getElementById('sidediv'); const sideDiv = outerDoc.getElementById('sidediv');
const lineMetricsDiv = outerDoc.getElementById('linemetricsdiv'); const lineMetricsDiv = outerDoc.getElementById('linemetricsdiv');
const sideDivInner = (() => { const sideDivInner = outerDoc.createElement('div');
const htmlOpen = '<div id="sidedivinner" class="sidedivinner"><div><span class="line-number">1'; sideDivInner.id = 'sidedivinner';
const htmlClose = '</span></div></div>'; sideDivInner.classList.add('sidedivinner');
sideDiv.innerHTML = `${htmlOpen}${htmlClose}`; sideDiv.appendChild(sideDivInner);
return outerDoc.getElementById('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; let lineNumbersShown = 1;