From def561da19317cfea6590a608a7d1187dba6a109 Mon Sep 17 00:00:00 2001 From: Davide Scaini Date: Mon, 11 May 2026 22:46:53 +0200 Subject: [PATCH] Editor: column counter + 80-char hint in bottom bar --- src/components/PageEditor.svelte | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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}