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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user