From 12512c58a0c41d9205c025df754859d4451dcd7d Mon Sep 17 00:00:00 2001 From: Bhavishy Date: Wed, 8 Apr 2026 02:05:47 +0530 Subject: [PATCH] fix: resolve deep-link merge issues and restore settings/page scrolling --- src/app/components/ThreadCreate.svelte | 26 +++++++++++++++++++++++--- src/lib/components/Page.svelte | 2 +- src/routes/people/+page.svelte | 2 +- src/routes/settings/+layout.svelte | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/app/components/ThreadCreate.svelte b/src/app/components/ThreadCreate.svelte index 24e338a9..350516f2 100644 --- a/src/app/components/ThreadCreate.svelte +++ b/src/app/components/ThreadCreate.svelte @@ -18,8 +18,14 @@ import {pushToast} from "@app/util/toast" import {PROTECTED} from "@app/core/state" import {makeEditor} from "@app/editor" + import {DraftKey} from "@app/util/drafts" import {canEnforceNip70} from "@app/core/commands" + type Values = { + content?: string | object + title?: string + } + type Props = { url: string h?: string @@ -28,6 +34,9 @@ const {url, h, initialContent = ""}: Props = $props() + const draftKey = new DraftKey(`thread:${url}:${h ?? ""}`) + const initialValues = initialContent ? {content: initialContent} : draftKey.get() + const shouldProtect = canEnforceNip70(url) const uploading = writable(false) @@ -71,18 +80,29 @@ event: makeEvent(THREAD, {content, tags}), }) + draftKey.clear() history.back() } + let title: string = $state(initialValues?.title ?? "") + let content: string | object = $state(initialValues?.content ?? "") + + const onChange = (json: object) => { + content = json + } + const editor = makeEditor({ - content: initialContent, url, submit, uploading, + onChange, placeholder: "What's on your mind?", + content, }) - let title: string = $state("") + $effect(() => { + draftKey.set({title, content}) + }) @@ -137,4 +157,4 @@ - \ No newline at end of file + diff --git a/src/lib/components/Page.svelte b/src/lib/components/Page.svelte index 8ee859e6..b0879ad7 100644 --- a/src/lib/components/Page.svelte +++ b/src/lib/components/Page.svelte @@ -9,6 +9,6 @@
+ class="scroll-container relative flex-grow flex min-h-0 flex-col min-w-0 overflow-y-auto overflow-x-hidden ml-sai mb-sai mt-sai mr-sai bg-base-200 md:ml-0 md:mb-0 {props.class}"> {@render props.children?.()}
diff --git a/src/routes/people/+page.svelte b/src/routes/people/+page.svelte index a6006f42..d532dda1 100644 --- a/src/routes/people/+page.svelte +++ b/src/routes/people/+page.svelte @@ -19,7 +19,7 @@ if (term) { pubkeys = Array.from(new Set($profileSearch.searchValues(term))) } else { - pubkeys = Array.from(new Set($bootstrapPubkeys)) + pubkeys = $bootstrapPubkeys } }) diff --git a/src/routes/settings/+layout.svelte b/src/routes/settings/+layout.svelte index 3603ffb4..4b24ac9e 100644 --- a/src/routes/settings/+layout.svelte +++ b/src/routes/settings/+layout.svelte @@ -67,6 +67,6 @@ - + {@render children?.()}