ace2_inner: Replace `initLineNumbers()` with an IIFE

pull/5153/head
Richard Hansen 2021-07-29 02:16:13 -04:00
parent b5bfff43cf
commit 7a8edc816b
1 changed files with 3 additions and 7 deletions

View File

@ -65,17 +65,13 @@ function Ace2Inner(editorInfo, cssManagers) {
const sideDiv = outerDoc.getElementById('sidediv'); const sideDiv = outerDoc.getElementById('sidediv');
const lineMetricsDiv = outerDoc.getElementById('linemetricsdiv'); const lineMetricsDiv = outerDoc.getElementById('linemetricsdiv');
let lineNumbersShown; let lineNumbersShown;
let sideDivInner; const sideDivInner = (() => {
const initLineNumbers = () => {
const htmlOpen = '<div id="sidedivinner" class="sidedivinner"><div><span class="line-number">1'; const htmlOpen = '<div id="sidedivinner" class="sidedivinner"><div><span class="line-number">1';
const htmlClose = '</span></div></div>'; const htmlClose = '</span></div></div>';
lineNumbersShown = 1; lineNumbersShown = 1;
sideDiv.innerHTML = `${htmlOpen}${htmlClose}`; sideDiv.innerHTML = `${htmlOpen}${htmlClose}`;
sideDivInner = outerWin.document.getElementById('sidedivinner'); return outerDoc.getElementById('sidedivinner');
}; })();
initLineNumbers();
const scroll = Scroll.init(outerWin); const scroll = Scroll.init(outerWin);