From af726fc4a040eee360a07d89374e5681b5467d4d Mon Sep 17 00:00:00 2001 From: June Date: Tue, 3 Feb 2026 18:23:15 +1300 Subject: [PATCH] Replace tiptap with marked + markdown lol --- .vscode/settings.json | 5 -- package.json | 1 + pnpm-lock.yaml | 10 ++++ src/lib/components/calendar.svelte | 8 +-- src/lib/components/editor/imageTarget.svelte | 4 +- src/lib/components/editor/index.svelte | 11 +--- src/lib/components/editor/textEditor.svelte | 53 +++++--------------- src/lib/components/entrySummaryView.svelte | 3 +- src/lib/server/db/schema.ts | 2 +- src/routes/+page.svelte | 8 +-- 10 files changed, 39 insertions(+), 66 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index bc31e15..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "files.associations": { - "*.css": "tailwindcss" - } -} diff --git a/package.json b/package.json index 74321d2..812044b 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "@tiptap/html": "^3.18.0", "@tiptap/pm": "^3.18.0", "@tiptap/starter-kit": "^3.18.0", + "marked": "^17.0.1", "postgres": "^3.4.8", "tiptap": "^1.32.2" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e90788a..e966e63 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,9 @@ importers: '@tiptap/starter-kit': specifier: ^3.18.0 version: 3.18.0 + marked: + specifier: ^17.0.1 + version: 17.0.1 postgres: specifier: ^3.4.8 version: 3.4.8 @@ -1408,6 +1411,11 @@ packages: resolution: {integrity: sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==} hasBin: true + marked@17.0.1: + resolution: {integrity: sha512-boeBdiS0ghpWcSwoNm/jJBwdpFaMnZWRzjA6SkUMYb40SVaN1x7mmfGKp0jvexGcx+7y2La5zRZsYFZI6Qpypg==} + engines: {node: '>= 20'} + hasBin: true + mdurl@2.0.0: resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} @@ -2698,6 +2706,8 @@ snapshots: punycode.js: 2.3.1 uc.micro: 2.1.0 + marked@17.0.1: {} + mdurl@2.0.0: {} mini-svg-data-uri@1.4.4: {} diff --git a/src/lib/components/calendar.svelte b/src/lib/components/calendar.svelte index 0d4f9e3..eaa2ac0 100644 --- a/src/lib/components/calendar.svelte +++ b/src/lib/components/calendar.svelte @@ -9,6 +9,7 @@ let { year = $bindable("2026"), month = $bindable("0"), + dayClickCallback = $bindable(() => {}), entries, } = $props(); @@ -212,11 +213,12 @@
{#each days as day, index} -
dayClickCallback(day.entry.id) : null } style={day.entry?.image ? `background-image: url(${day.entry.image}); background-size: cover; background-position: center;` : ""} @@ -233,7 +235,7 @@ {/if}
-
+ {/each} diff --git a/src/lib/components/editor/imageTarget.svelte b/src/lib/components/editor/imageTarget.svelte index 8565e8e..e7628a0 100644 --- a/src/lib/components/editor/imageTarget.svelte +++ b/src/lib/components/editor/imageTarget.svelte @@ -39,7 +39,7 @@ \ No newline at end of file diff --git a/src/lib/components/editor/index.svelte b/src/lib/components/editor/index.svelte index e42a274..d4339c2 100644 --- a/src/lib/components/editor/index.svelte +++ b/src/lib/components/editor/index.svelte @@ -3,17 +3,10 @@ import TextEditor from "./textEditor.svelte"; import { formatDate } from "$lib/date.ts"; - let { - entry = $bindable(""), - editorState = $bindable({ editor: null }) - } = $props(); + let { entry = $bindable({}) } = $props(); let edit = $state(false); let editModeText = $derived(edit ? "done" : "edit") - - function getContent() { - return editorState.editor.getJSON(); - }
@@ -27,4 +20,4 @@
- + diff --git a/src/lib/components/editor/textEditor.svelte b/src/lib/components/editor/textEditor.svelte index 6a508c2..377bec1 100644 --- a/src/lib/components/editor/textEditor.svelte +++ b/src/lib/components/editor/textEditor.svelte @@ -1,49 +1,20 @@ -
-
+
+ {#if edit} + + {:else} + {@html marked(content)} + {/if} +
- - diff --git a/src/lib/components/entrySummaryView.svelte b/src/lib/components/entrySummaryView.svelte index 578878c..a89854e 100644 --- a/src/lib/components/entrySummaryView.svelte +++ b/src/lib/components/entrySummaryView.svelte @@ -1,5 +1,6 @@ - + await selectEntry(entryID)} />
{#if selectedEntry} - + {:else}