Add a visible Markdown formatting bar to pages and bookmark notes

Shared component (components/markdown-toolbar.tsx): bold/italic/
strikethrough/inline code/link with URL preselected, H1-H3, quote,
bullet/numbered/to-do line-prefix toggles across the selection, divider.
Mounted above the page editor textarea and the notes editor in the
bookmark detail sheet; the textarea stays the source of truth so
autosave/conflict handling and the notes save flow are untouched, and
the page slash menu remains as the keyboard path. Gitea issue #7.
This commit is contained in:
Andrew S Erwin
2026-11-02 21:56:51 -06:00
parent 6fbe5f23bf
commit 390b541b0a
3 changed files with 127 additions and 2 deletions
+2
View File
@@ -17,6 +17,7 @@ import { Textarea } from '@/components/ui/textarea'
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
import { cn } from '@/lib/utils'
import { MarkdownToolbar } from '@/components/markdown-toolbar'
import { PageAutosave, PageConflictError, type PageSaveState } from '@/lib/page-autosave'
import {
PAGES_CHANGED, collectionEmbedMarkdown, descendantPageIds, internalPageId, nextUntitledTitle,
@@ -822,6 +823,7 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
{mode === 'edit' ? (
<div className="relative">
<MarkdownToolbar textareaRef={textareaRef} value={content} onChange={onContentChange} className="mb-2" />
<Textarea
ref={textareaRef}
value={content}