diff --git a/frontend/editor-poc.html b/frontend/editor-poc.html index d9614b6..13d17dd 100644 --- a/frontend/editor-poc.html +++ b/frontend/editor-poc.html @@ -491,6 +491,7 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig if (!fileVault || !filePath) { // Demo mode ta.value = '# Demo Document\n\nType **/** for commands. Select text for formatting.\n\n## Features\n\n- Slash commands: type / at start of line\n- Bubble menu: select text\n- AI actions: use the sparkle button or slash /ai\n- Preview: click the eye button\n'; + autoHeight(); statFile.textContent = 'Demo mode'; document.title = 'ObsiGate Forge — Demo'; originalContent = ta.value; @@ -506,6 +507,7 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig }) .then(function(data) { ta.value = data.raw || ''; + autoHeight(); originalContent = ta.value; // Extract title from first # heading or filename var title = filePath.split('/').pop().replace(/\.md$/, ''); @@ -1058,10 +1060,14 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig ta.addEventListener('input', function() { updateStats(); markDirty(); - // Auto-height: grow textarea to fit content (no double scrollbar) + autoHeight(); + }); + + // ---- Auto-height textarea ---- + function autoHeight() { ta.style.height = 'auto'; ta.style.height = ta.scrollHeight + 'px'; - }); + } ta.addEventListener('mouseup', function() { setTimeout(showBubble, 50); }); // Bubble follows cursor on any selection change (keyboard too) document.addEventListener('selectionchange', function() {