@opositatest/markdown-text-editor 1.2.0 → 1.3.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 +41 -29
- package/dist/editor.css +1 -1
- package/dist/editor.js +10490 -9557
- package/dist/react/index.js +9409 -8485
- package/dist/react/markdown-text-editor.css +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ In the editor UI, the math block is available from the slash menu and can be fou
|
|
|
47
47
|
|
|
48
48
|
### Scope note
|
|
49
49
|
|
|
50
|
-
This package documents and supports the text-oriented authoring experience above, including the custom math block. Advanced upstream BlockNote media and
|
|
50
|
+
This package documents and supports the text-oriented authoring experience above, including the custom math block. Advanced upstream BlockNote media flows (video, audio, and file blocks) are not part of the documented, supported surface of this package, and are **hidden from the slash menu by default**. Enable them explicitly with `enabled-media-blocks` / `enabledMediaBlocks` if a host app needs them — see [Available slash menu item ids](#available-slash-menu-item-ids).
|
|
51
51
|
|
|
52
52
|
## Web Component
|
|
53
53
|
|
|
@@ -91,39 +91,48 @@ Load via CDN (no build step required):
|
|
|
91
91
|
| `disabled` | boolean | Disables the editor |
|
|
92
92
|
| `readonly` | boolean | Makes the editor read-only |
|
|
93
93
|
| `required` | boolean | Participates in native form validation |
|
|
94
|
-
| `hidden-slash-menu-items` | string | JSON array of item
|
|
94
|
+
| `hidden-slash-menu-items` | string | JSON array of item ids to hide from the slash menu |
|
|
95
|
+
| `enabled-media-blocks` | string | JSON array of item ids to re-enable; `video`, `audio`, and `file` are hidden from the slash menu by default (see [Scope note](#scope-note)) |
|
|
95
96
|
| `formatting-toolbar` | boolean | Floating formatting toolbar on text selection (default: enabled, set to `false` to disable) |
|
|
96
97
|
|
|
97
98
|
`width` and `height` accept any valid CSS size, such as `320px`, `40rem`, or `100%`.
|
|
98
99
|
|
|
99
|
-
#### Available slash menu item
|
|
100
|
-
|
|
101
|
-
Use these
|
|
102
|
-
|
|
103
|
-
|
|
|
104
|
-
| ---------------- | ------------ |
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
|
|
122
|
-
**Example:** Hide
|
|
100
|
+
#### Available slash menu item ids
|
|
101
|
+
|
|
102
|
+
Use these stable, English ids (not the localized, user-facing title) in the `hidden-slash-menu-items` / `enabled-media-blocks` JSON arrays:
|
|
103
|
+
|
|
104
|
+
| Id | Group | Description | Visible by default |
|
|
105
|
+
| ---------------- | ------------ | ------------------------------- | ------------------- |
|
|
106
|
+
| `heading-1` | Headings | Top-level heading | Yes |
|
|
107
|
+
| `heading-2` | Headings | Key section heading | Yes |
|
|
108
|
+
| `heading-3` | Headings | Subsection and group heading | Yes |
|
|
109
|
+
| `paragraph` | Basic blocks | Plain text | Yes |
|
|
110
|
+
| `bullet-list` | Basic blocks | Create a simple bullet list | Yes |
|
|
111
|
+
| `numbered-list` | Basic blocks | Create a list with numbering | Yes |
|
|
112
|
+
| `checklist` | Basic blocks | Track tasks with a checklist | Yes |
|
|
113
|
+
| `blockquote` | Basic blocks | Capture a quote | Yes |
|
|
114
|
+
| `code-block` | Basic blocks | Capture a code snippet | Yes |
|
|
115
|
+
| `divider` | Basic blocks | Visually divide blocks | Yes |
|
|
116
|
+
| `image` | Multimedia | Fullscreen image | Yes |
|
|
117
|
+
| `video` | Multimedia | Resizable video with caption | **No** — opt in via `enabled-media-blocks` |
|
|
118
|
+
| `audio` | Multimedia | Embed audio | **No** — opt in via `enabled-media-blocks` |
|
|
119
|
+
| `file` | Multimedia | Embed a file | **No** — opt in via `enabled-media-blocks` |
|
|
120
|
+
| `table` | Multimedia | Create a table | Yes |
|
|
121
|
+
| `math-formula` | Multimedia | Insert LaTeX formula | Yes |
|
|
122
|
+
|
|
123
|
+
**Example:** Hide the image and table items, on top of the media items that are already hidden by default:
|
|
123
124
|
|
|
124
125
|
```html
|
|
125
126
|
<markdown-text-editor
|
|
126
|
-
hidden-slash-menu-items='["
|
|
127
|
+
hidden-slash-menu-items='["image", "table"]'
|
|
128
|
+
></markdown-text-editor>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Example:** Opt in to the video block while keeping audio and file hidden:
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<markdown-text-editor
|
|
135
|
+
enabled-media-blocks='["video"]'
|
|
127
136
|
></markdown-text-editor>
|
|
128
137
|
```
|
|
129
138
|
|
|
@@ -136,6 +145,8 @@ Use these exact titles in the `hidden-slash-menu-items` JSON array to hide speci
|
|
|
136
145
|
| `element.height` | string | Get or set CSS height |
|
|
137
146
|
| `element.disabled` | boolean | Get or set disabled state |
|
|
138
147
|
| `element.readOnly` | boolean | Get or set read-only state |
|
|
148
|
+
| `element.hiddenSlashMenuItems` | string[] | Get or set the list of hidden slash menu item ids |
|
|
149
|
+
| `element.enabledMediaBlocks` | string[] | Get or set the list of default-hidden media item ids to re-enable |
|
|
139
150
|
| `element.formattingToolbar` | boolean | Get or set the floating formatting toolbar state |
|
|
140
151
|
|
|
141
152
|
### Methods
|
|
@@ -187,12 +198,13 @@ import "@opositatest/markdown-text-editor/style";
|
|
|
187
198
|
| `disabled` | `boolean` | Disables the editor |
|
|
188
199
|
| `readonly` | `boolean` | Makes the editor read-only |
|
|
189
200
|
| `className` | `string` | Additional CSS class on the editor container |
|
|
190
|
-
| `hiddenSlashMenuItems` | `string[]` | Array of item
|
|
201
|
+
| `hiddenSlashMenuItems` | `string[]` | Array of item ids to hide from the slash menu |
|
|
202
|
+
| `enabledMediaBlocks` | `string[]` | Array of item ids to re-enable; `video`, `audio`, and `file` are hidden by default |
|
|
191
203
|
| `formattingToolbar` | `boolean` | Floating formatting toolbar on text selection (default: `true`) |
|
|
192
204
|
|
|
193
205
|
`width` and `height` accept any valid CSS size, such as `320px`, `40rem`, or `100%`.
|
|
194
206
|
|
|
195
|
-
See the [Web Component section](#available-slash-menu-item-
|
|
207
|
+
See the [Web Component section](#available-slash-menu-item-ids) for the list of available item ids.
|
|
196
208
|
|
|
197
209
|
### Imperative handle (via ref)
|
|
198
210
|
|