MarkdownEditor
Markdown editing with the rendered result beside it
Release notes
A small release with @gpuixui/editor fixes.
- The split keeps its size
- An unclosed fence is closed for the preview
const value = "source";Usage
import { MarkdownEditor } from "@gpuixui/editor";
<MarkdownEditor
value={value}
onValueChange={setValue}
label="Release notes"
width={640}
height={300}
/>;API
| Prop | Type | Default |
|---|---|---|
value | string | — (uncontrolled) |
defaultValue | string | "" |
onValueChange | (value: string) => void | — |
mode | "split" | "source" | "preview" | — (uncontrolled) |
defaultMode | "split" | "source" | "preview" | "split" |
onModeChange | (mode) => void | — |
label | string | "Markdown editor" |
placeholder | string | — |
width | number | 640 |
height | number | 280 |
splitSize | number | — (uncontrolled) |
defaultSplitSize | number | half the body |
onSplitSizeChange | (size: number) => void | — |
readOnly | boolean | false |
disabled | boolean | false |
className | string | — |
style | StyleDesc | — |
testId | string | — |
Names
label names the editor and every part of it: the source field is "<label> source", the preview "<label> preview" and the split's divider "<label> split". A label that arrives blank — from an i18n table or a saved record — is an absence, so each part falls back to Markdown editor rather than publishing " source"; a label that is not text at all (a number a record kept) is no name either, so the parts keep the same default instead of the render throwing out of the name seam.
Views
The three view buttons are a choice, not three separate actions: the painted
view is the one with secondary paint, and it also carries aria-selected —
0.11.0 has no aria-current, and aria-selected is the substitution the
Pagination, Stepper and Timeline controls publish for the same job. Every button
states its own value, so the colour of the paint is not the only channel that
says which view is showing; a reader on a screen reader gets the same fact from
the control it is on.
Edit this page on GitHubpackages/editor/docs/markdown-editor.mdx