@open-elements/ui 0.8.0 → 0.10.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 +153 -18
- package/dist/components/capability-status.d.ts +10 -0
- package/dist/components/capability-status.d.ts.map +1 -0
- package/dist/components/capability-status.js +12 -0
- package/dist/components/capability-status.js.map +1 -0
- package/dist/components/markdown-editor.d.ts +1 -1
- package/dist/components/markdown-editor.d.ts.map +1 -1
- package/dist/components/markdown-editor.js +131 -44
- package/dist/components/markdown-editor.js.map +1 -1
- package/dist/components/markdown-view.d.ts +1 -1
- package/dist/components/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view.js +110 -27
- package/dist/components/markdown-view.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/markdown-extensions.d.ts +48 -0
- package/dist/lib/markdown-extensions.d.ts.map +1 -0
- package/dist/lib/markdown-extensions.js +73 -0
- package/dist/lib/markdown-extensions.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +17 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +41 -24
- package/src/components/__tests__/capability-status.test.tsx +82 -0
- package/src/components/__tests__/markdown-editor.test.tsx +226 -22
- package/src/components/__tests__/markdown-view.test.tsx +274 -21
- package/src/components/capability-status.tsx +63 -0
- package/src/components/markdown-editor.tsx +185 -79
- package/src/components/markdown-view.tsx +133 -28
- package/src/index.ts +3 -0
- package/src/lib/__tests__/markdown-extensions.test.ts +290 -0
- package/src/lib/markdown-extensions.ts +107 -0
- package/src/test/setup.ts +29 -0
- package/src/types/__tests__/markdown-toolbar-action.test.ts +34 -0
- package/src/types/index.ts +32 -0
package/src/types/index.ts
CHANGED
|
@@ -54,12 +54,44 @@ export interface UserMultiSelectProps {
|
|
|
54
54
|
readonly translations: UserMultiSelectTranslations;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* A single action offered in the {@link MarkdownEditorProps.toolbar}. Names follow
|
|
59
|
+
* the underlying TipTap node/mark names so the mapping to commands is obvious.
|
|
60
|
+
* Unlink is deliberately absent — it is rendered contextually as part of `"link"`.
|
|
61
|
+
*/
|
|
62
|
+
export type MarkdownToolbarAction =
|
|
63
|
+
| "bold"
|
|
64
|
+
| "italic"
|
|
65
|
+
| "strike"
|
|
66
|
+
| "code"
|
|
67
|
+
| "link"
|
|
68
|
+
| "h1"
|
|
69
|
+
| "h2"
|
|
70
|
+
| "h3"
|
|
71
|
+
| "bulletList"
|
|
72
|
+
| "orderedList"
|
|
73
|
+
| "taskList"
|
|
74
|
+
| "blockquote"
|
|
75
|
+
| "codeBlock"
|
|
76
|
+
| "horizontalRule";
|
|
77
|
+
|
|
57
78
|
export interface MarkdownEditorProps {
|
|
58
79
|
readonly value: string;
|
|
59
80
|
readonly onChange: (value: string) => void;
|
|
60
81
|
readonly placeholder?: string;
|
|
82
|
+
/** Actions offered in the toolbar, in render order. Defaults to `["bold", "italic"]`. */
|
|
83
|
+
readonly toolbar?: readonly MarkdownToolbarAction[];
|
|
61
84
|
}
|
|
62
85
|
|
|
63
86
|
export interface MarkdownViewProps {
|
|
64
87
|
readonly content: string;
|
|
88
|
+
/**
|
|
89
|
+
* Called when the reader toggles a task list checkbox, with the complete
|
|
90
|
+
* updated Markdown. Omit to render checkboxes as read-only.
|
|
91
|
+
*
|
|
92
|
+
* Return a Promise to have the view disable interaction until it settles and
|
|
93
|
+
* revert the document if it rejects. Return nothing (`void`) to apply the
|
|
94
|
+
* toggle without a busy state or rollback.
|
|
95
|
+
*/
|
|
96
|
+
readonly onChange?: (markdown: string) => void | Promise<void>;
|
|
65
97
|
}
|