Phase 2d: preview pane, in-app dialogs, theme toggle - #7
Merged
Conversation
Final polish slice of the notes-app before Phase 3 (docker bundling). Markdown preview: - New MarkdownPreview component (marked + DOMPurify). Wiki links registered as a marked inline extension so [[Page Name]] and [[Page Name|alias]] become <a class="wiki-link" data-target="..."> in rendered HTML, with code spans/blocks naturally exempt because marked skips inline tokenization inside them. - Click handler delegates [data-target] anchors to the same resolveWikiTarget pipeline the editor uses. - View mode toggle in the header: edit / split / preview, persisted to localStorage. Split is two panes side by side. Dialogs: - DialogProvider exposes promise-based prompt/confirm/alert via the useDialog hook, replacing window.prompt and window.confirm throughout the app. - Backdrop, Esc-to-cancel, focus management (input auto-selected on prompt; cancel-focused on confirm), Enter to submit. - Restyled to match the rest of the app, including light/dark. Theme: - useTheme hook, three-state cycle (system / light / dark) persisted to localStorage. - :root[data-theme=...] vars override the prefers-color-scheme default; :root:not([data-theme]) keeps OS preference for "system". - Theme button in the header shows current state with a glyph. Phase 3 readiness: - The SPA is now feature-complete enough to ship as the BizerOS Knowledge web client. Phase 3 swaps the docker image's bundle from the Logseq SPA to packages/notes-app/dist and proxies /api to the file-api service.
kelsi-bizer
marked this pull request as ready for review
May 9, 2026 16:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Final polish slice of the notes-app before Phase 3 hands the bundle off to the Docker image. Three quality-of-life additions:
edit/split/previewview modesprompt/confirmWhat changed
Markdown preview (
MarkdownPreview.tsx)markedfor parsing,DOMPurifyto sanitize the rendered HTML before injecting (single-user trusted brain, but agents and external tools also write here, so HTML is treated as untrusted by default).markedinline extension:[[Page Name]]and[[Page Name|alias]]become<a class="wiki-link" data-target="…">in the rendered HTML. Code spans and fenced code blocks are skipped automatically becausemarkeddoesn't run inline tokenizers inside them.[data-target]anchors back to the sameresolveWikiTargetpipeline the editor uses, so wiki-link navigation is identical in both views.View mode toggle
edit/split/previewsegmented control, persisted tolocalStorage.splitputs the editor and preview side-by-side with a divider; the editor still owns Cmd/Ctrl-click navigation.Dialogs (
Dialog.tsx+useDialog)DialogProviderexposes a promise-based API:prompt({ title, defaultValue, message }),confirm(message, { title }),alert(message).window.prompt/window.confirm/window.alertcall across the app (new note, rename, delete confirm, error toasts).Theme (
useTheme.ts)system(default),light,dark. Cycled by the header toggle.:root[data-theme=light|dark]overrides theprefers-color-schemedefaults;:root:not([data-theme])keeps OS preference forsystemmode.localStorage; defensively wrapped in try/catch so privacy-mode browsers don't crash.Bundle impact
The +24 KB is
marked+DOMPurify. Acceptable; can be split viaimport()if needed later.Phase 3 readiness
The SPA is now feature-complete enough to ship as the BizerOS Knowledge web client. Phase 3 will:
packages/notes-appin the Docker imagepackages/file-apiin the Docker imagepackages/notes-app/distfile-apias a sidecar process and proxy/api/*to it from nginxdocker run -v /host/brain:/brain -p 8080:80 ghcr.io/kelsi-bizer/bizeros-knowledge:latestTest plan
cd packages/file-api && pnpm startandcd packages/notes-app && pnpm dev# heading,**bold**,``` fenced code ```,[[Some Page]]). Toggleedit→split→preview— content renders correctly in each[[wiki link]]in the rendered preview — navigates same as Cmd/Ctrl-click in the editorpnpm typecheck && pnpm buildpassGenerated by Claude Code