diff --git a/src/components/PageEditor.svelte b/src/components/PageEditor.svelte index 501c1d8..999a784 100644 --- a/src/components/PageEditor.svelte +++ b/src/components/PageEditor.svelte @@ -19,6 +19,17 @@ let dragOver = false; let fileInput: HTMLInputElement; let heroFileInput: HTMLInputElement; + let textarea: HTMLTextAreaElement; + let colCount = 0; + + function updateCol() { + if (!textarea) return; + const pos = textarea.selectionStart ?? 0; + const lineStart = textarea.value.lastIndexOf('\n', pos - 1) + 1; + colCount = pos - lineStart + 1; + } + + $: colColor = colCount >= 80 ? '#f87171' : colCount >= 70 ? '#f59e0b' : 'var(--text-5)'; $: section = SECTIONS.find(s => s.slug === selectedSection) ?? null; $: subs = section?.sub ?? []; @@ -299,11 +310,15 @@ {/if}