/* DokuWiki MoaiEditor Cm_watcher.js file Version : 0.5a (May 6, 2026) Author : MoaiTools License : GPL 3 (http://www.gnu.org/licenses/gpl.html) */ /* */ MoaiEditor.CodemirrorWatcher = class extends MoaiEditor.WatchTextChanges { getTextLines() { return this.outer.editor.getValue().split("\n"); } // ──────────────────────────────────── debug() { // Exit if debugline is not enabled const line = document.querySelector("#moai__debug div:nth-child(2)"); if (!line) return; var msg = ''; // Monitor line 424 reported height msg += parseInt(this.outer.editor.heightAtLine(423, 'local')); //const top = this.editor.heightAtLine(0, 'local'); // Num rendered lines var lines = document.querySelectorAll(".CodeMirror-code .CodeMirror-line "); msg += " #" + lines.length; // Get viewport const vp = this.outer.editor.getViewport(); msg += " [" + vp.from + "-" + vp.to + "]"; //const top = this.editor.heightAtLine(0, 'local'); // Scroll var content = document.querySelector(".CodeMirror-scroll"); msg += " ↓" + parseInt(content.scrollTop); // Height var content = document.querySelector(".CodeMirror-sizer"); msg += " ↕" + content.getBoundingClientRect().height; // Show const elapsed = ''+(Date.now()-this.last).toString().padStart(4," ")+''; const text = msg; //line.innerHTML = text; line.title = 'CM '; } }; // End Class