From beb4209baf8ad434fcc7c31078ee580d4449aeac Mon Sep 17 00:00:00 2001 From: Frederic Cabassut Date: Wed, 8 Apr 2026 22:00:06 +0200 Subject: [PATCH] fix: decode HTML entities in unlinkifyHtml and fix indentation - Add entity decoding (& < > ") to unlinkifyHtml to prevent double-encoding on contenteditable edit cycles - Fix indentation of LinkPopover import and state declaration - Move LinkPopover inside root div - Add unit test for entity decoding Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/components/Checklist.svelte | 14 +++++++------- src/lib/utils/checklist.test.ts | 6 ++++++ src/lib/utils/checklist.ts | 7 ++++++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/lib/components/Checklist.svelte b/src/lib/components/Checklist.svelte index ffe5fc2..bf9c0fb 100644 --- a/src/lib/components/Checklist.svelte +++ b/src/lib/components/Checklist.svelte @@ -7,7 +7,7 @@ import { dragHandleZone, dragHandle, type DndEvent } from 'svelte-dnd-action'; import { flip } from 'svelte/animate'; import { type ChecklistItem, generateId, parseChecklist, serializeChecklist, toggleItemWithCascade, indentItem, outdentItem, linkifyText, unlinkifyHtml } from '$lib/utils/checklist.js'; -import LinkPopover from './LinkPopover.svelte'; + import LinkPopover from './LinkPopover.svelte'; interface Props { content: string; @@ -20,7 +20,7 @@ import LinkPopover from './LinkPopover.svelte'; let items = $state(parseChecklist(content)); let doneExpanded = $state(true); const flipDurationMs = 150; -let linkPopover = $state<{ url: string; anchor: DOMRect } | null>(null); + let linkPopover = $state<{ url: string; anchor: DOMRect } | null>(null); // Track the last content we emitted so we can distinguish self-originated // changes from external ones (sync, history restore, etc.) @@ -314,7 +314,7 @@ let linkPopover = $state<{ url: string; anchor: DOMRect } | null>(null); data-testid="checklist-input" data-item-id={item.id} role="textbox" - tabindex="0" + tabindex="0" >{@html linkifyText(item.text)}