From 323589f2815995873673e4975a83d72fa9842131 Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Mon, 21 Sep 2026 11:04:08 -0600 Subject: [PATCH] Default markdown editors to preview mode - Open markdown editors in the rendered preview state instead of raw markdown by default. - Preserve edit and live views through the editor toolbar. - Keep the `preview` prop overridable by callers because it is spread after the default. --- components/markdown/markdown-widgets.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/markdown/markdown-widgets.tsx b/components/markdown/markdown-widgets.tsx index 8e3e15e..763b2d1 100644 --- a/components/markdown/markdown-widgets.tsx +++ b/components/markdown/markdown-widgets.tsx @@ -9,7 +9,16 @@ import type { RehypeRewriteOptions } from "rehype-rewrite"; // out of the initial board bundle. Shared here so every place that needs // markdown (group notes, to-do details) uses the exact same editor/preview // widgets instead of each declaring its own dynamic import. -export const MDEditor = dynamic(() => import("@uiw/react-md-editor"), { ssr: false }); +const RawMDEditor = dynamic(() => import("@uiw/react-md-editor"), { ssr: false }); + +// `preview` only seeds the editor's initial mode -- @uiw/react-md-editor +// owns it as internal state after that, flipped by the edit/live/preview +// toolbar buttons. Defaulting it to "preview" opens every editor rendered +// instead of raw markdown, while the toolbar still lets someone drop into +// "edit" (or the split "live" view) when they want granular control. +export function MDEditor(props: ComponentProps) { + return ; +} const RawMarkdownPreview = dynamic( () => import("@uiw/react-md-editor").then((mod) => mod.default.Markdown),