refactor: extract persistence and reveal logic into new stores

Move localStorage and URL parameter management from `journalStream`
to a dedicated `persistence` store. Relocate DOM reveal and heading
injection logic to a new `reveal` store to improve separation of
concerns.
This commit is contained in:
2026-07-07 18:10:43 +08:00
parent ef7295ff7a
commit 3690d13407
6 changed files with 331 additions and 203 deletions
+11
View File
@@ -21,6 +21,7 @@ import {
Match,
} from "solid-js";
import { sendMessage, useJournalStream } from "../stores/journalStream";
import { linkPrefill, setLinkPrefill } from "../stores/reveal";
import { useJournalCompletions, ensureCompletions } from "./completions";
import { resolveRollPayload } from "./types/roll";
@@ -88,6 +89,16 @@ export const JournalInput: Component = () => {
void ensureCompletions();
});
// Listen for /link prefill requests from article headings
createEffect(() => {
const prefilled = linkPrefill();
if (prefilled) {
setText(prefilled);
setLinkPrefill(null);
textareaRef?.focus();
}
});
// ---- Send ----
function handleSend() {