@zuilib/text-editor 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +458 -200
- package/dist/styles.css +141 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,6 +120,8 @@ Toggle modes in parent state; the editor preserves content via an internal ref w
|
|
|
120
120
|
| `autoFocus` | `boolean` | `false` | Focus on mount |
|
|
121
121
|
| `className` | `string` | — | Root wrapper class |
|
|
122
122
|
| `toolbar` | `boolean` | `true` | Formatting/insert toolbar in `edit-md` mode |
|
|
123
|
+
| `outline` | `boolean` | `false` | Table-of-contents sidebar listing headings |
|
|
124
|
+
| `foldable` | `boolean` | `true` | Collapse sections under their headings |
|
|
123
125
|
|
|
124
126
|
## Markdown features
|
|
125
127
|
|
|
@@ -167,6 +169,12 @@ Drawings persist inside the markdown as a fenced block, so the document stays a
|
|
|
167
169
|
|
|
168
170
|
In `view` mode (or `readOnly`) the canvas renders the shapes without any editing chrome.
|
|
169
171
|
|
|
172
|
+
## Outline & section folding
|
|
173
|
+
|
|
174
|
+
`outline` docks a collapsible table-of-contents sidebar on the right: it lists the document's headings live (indented by level), scrolls to a heading on click, and highlights the section currently in view. Pure UI — nothing is added to the document. Works in `edit-md` and `view` modes (not `edit-raw`).
|
|
175
|
+
|
|
176
|
+
`foldable` (on by default) adds a chevron in the left gutter of every heading (visible on hover). Clicking it collapses the section — everything up to the next heading of the same or higher level — marked by a trailing `…` on the heading. Folding is view-layer only: the markdown string is unaffected, and fold state resets on remount. If the cursor enters a folded section (e.g. via arrow keys), it auto-expands so content can never be edited invisibly.
|
|
177
|
+
|
|
170
178
|
## Form integration
|
|
171
179
|
|
|
172
180
|
With `@zuilib/form`:
|
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,12 @@ type Props = Readonly<{
|
|
|
13
13
|
autoFocus?: boolean;
|
|
14
14
|
/** Show the formatting/insert toolbar in edit-md mode (default true) */
|
|
15
15
|
toolbar?: boolean;
|
|
16
|
+
/** Show a table-of-contents sidebar listing the document's headings */
|
|
17
|
+
outline?: boolean;
|
|
18
|
+
/** Allow collapsing sections under their headings (default true) */
|
|
19
|
+
foldable?: boolean;
|
|
16
20
|
}>;
|
|
17
|
-
declare function MarkdownEditor({ value, onChange, placeholder, readOnly, className, mode, autoFocus, toolbar, }: Props): react_jsx_runtime.JSX.Element;
|
|
21
|
+
declare function MarkdownEditor({ value, onChange, placeholder, readOnly, className, mode, autoFocus, toolbar, outline, foldable, }: Props): react_jsx_runtime.JSX.Element;
|
|
18
22
|
|
|
19
23
|
type SerializedFrontmatterNode = SerializedElementNode;
|
|
20
24
|
/**
|