@mdaemon/html-editor-react 1.2.1 → 1.4.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.
Files changed (2) hide show
  1. package/README.md +86 -3
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -214,22 +214,46 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
214
214
  | Option | Type | Default | Description |
215
215
  |--------|------|---------|-------------|
216
216
  | `basicEditor` | `boolean` | `false` | Use a simplified toolbar (no images, tables, code blocks). |
217
+ | `readonly` | `boolean` | `false` | Start the editor in read-only mode. Toggle at runtime via `getEditor()?.setReadOnly()`. |
217
218
  | `height` | `string \| number` | `300` | Editor height. |
219
+ | `min_height` | `string \| number` | — | Minimum editor height. |
220
+ | `max_height` | `string \| number` | — | Maximum editor height. |
218
221
  | `language` | `string` | `'en'` | UI language code. 31 languages built in. |
219
- | `skin` | `'oxide' \| 'oxide-dark'` | `'oxide'` | Toolbar and dialog theme. |
220
- | `content_css` | `'default' \| 'dark'` | `'default'` | Content area theme. |
222
+ | `skin` | `'oxide' \| 'oxide-dark' \| 'confab' \| 'confab-dark'` | `'oxide'` | Toolbar and dialog theme. |
223
+ | `content_css` | `'default' \| 'dark' \| 'confab' \| 'confab-dark'` | `'default'` | Content area theme. |
221
224
  | `content_style` | `string` | — | Custom CSS injected into the editing surface. |
222
225
  | `fontName` | `string` | — | Default font family. |
223
226
  | `fontSize` | `string` | — | Default font size. |
224
227
  | `font_family_formats` | `string` | *(TinyMCE defaults)* | Semicolon-delimited font list (`Name=family,...`). |
225
228
  | `font_size_formats` | `string` | `'8pt 9pt 10pt 12pt 14pt 18pt 24pt 36pt'` | Space-delimited size options. |
229
+ | `font_names` | `string` | — | CKEditor alias for `font_family_formats`. |
230
+ | `fontSize_sizes` | `string` | — | CKEditor alias for `font_size_formats`. |
231
+ | `block_formats` | `string` | *(Paragraph + H1–H6)* | Block-format dropdown definitions for the `blocks` button (`Name=tag;...`). |
232
+ | `style_formats` | `StyleFormat[]` | *(subset)* | Named styles for the `styles` dropdown (CKEditor `stylesSet`-compatible). |
233
+ | `forced_root_block` | `'p' \| 'div'` | `'p'` | Block element produced on Enter. `'div'` gives CKEditor `ENTER_DIV` parity. |
234
+ | `trailingNode` | `boolean` | `false` | Append an empty trailing paragraph after a block node (table, image, code block) so the cursor can sit after it. |
226
235
  | `directionality` | `'ltr' \| 'rtl'` | `'ltr'` | Text direction. |
227
236
  | `toolbar` | `string` | *(preset)* | Custom toolbar layout string. |
228
237
  | `toolbar_mode` | `'sliding' \| 'floating' \| 'wrap'` | `'wrap'` | Toolbar overflow behavior. |
229
238
  | `toolbar_sticky` | `boolean` | `true` | Pin toolbar at top when scrolling. |
239
+ | `toolbar_narrow_breakpoint` | `number` | — | Pixel width below which the toolbar collapses into the overflow toggle. |
240
+ | `toolbar_priority` | `Record<string, number>` | &mdash; | Per-button overflow priority &mdash; higher values stay visible longer as the toolbar narrows. |
241
+ | `menubar` | `boolean` | `false` | Show a TinyMCE-style menu bar above the toolbar. |
242
+ | `contextmenu` | `boolean \| string` | `''` | Enable a right-click context menu. Pass a button-list string to customize its contents. |
243
+ | `quickbars_selection_toolbar` | `string` | `'bold italic \| quicklink blockquote'` | Inline floating toolbar shown over a text selection. |
244
+ | `quickbars_image_toolbar` | `boolean` | `false` | Inline floating toolbar shown when an image is selected. |
245
+ | `quickbars_insert_toolbar` | `boolean` | `false` | Inline floating toolbar shown on empty lines for quick insertion. |
246
+ | `elementpath` | `boolean` | `false` | Show a breadcrumb of the node path at the cursor in the status bar. |
247
+ | `valid_children` | `string` | &mdash; | TinyMCE-style rules controlling which child elements are allowed. |
230
248
  | `auto_focus` | `string` | &mdash; | Auto-focus on init. |
249
+ | `setFocus` | `string` | &mdash; | CSS selector for the element to focus on init (used when `auto_focus` is not set). |
250
+ | `plugins` | `string` | &mdash; | Accepted for TinyMCE compatibility and ignored &mdash; all features are built in. |
231
251
  | `browser_spellcheck` | `boolean` | `true` | Enable browser spell check. |
232
252
  | `entity_encoding` | `'raw' \| 'named' \| 'numeric'` | `'raw'` | HTML entity encoding mode. |
253
+ | `paste_from_office` | `boolean` | `true` | Clean and preserve formatting when pasting from Microsoft Word/Excel. |
254
+ | `speech_to_text` | `boolean` | `true` | Enable the `speechtotext` and `dictate` toolbar buttons (requires the Web Speech API). |
255
+ | `convert_unsafe_embeds` | `boolean` | `true` | Sanitize embedded content. |
256
+ | `format_empty_lines` | `boolean` | `true` | Format empty lines. |
233
257
  | `includeTemplates` | `boolean` | `false` | Show the template dropdown. |
234
258
  | `templates` | `Template[]` | `[]` | Predefined HTML templates. |
235
259
  | `dropbox` | `boolean` | `false` | Enable Dropbox integration. |
@@ -238,6 +262,9 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
238
262
  | `images_upload_base_path` | `string` | `'/'` | Prefix for uploaded image URLs. |
239
263
  | `images_upload_max_size` | `number` | `10485760` | Max upload size in bytes (10 MB). |
240
264
  | `images_upload_headers` | `Record<string, string>` | &mdash; | Extra headers for upload requests. |
265
+ | `images_file_types` | `string` | *(permissive)* | Comma/space-separated accepted extensions (e.g. `'jpg,jpeg,png,gif'`). |
266
+ | `images_upload_validate` | `(file: File) => string \| null` | &mdash; | Pre-upload hook; return a message to reject the file, or `null` to allow. |
267
+ | `images_upload_error` | `(message: string) => void` | &mdash; | Caller-supplied alert for drag-drop/paste upload rejections and failures. |
241
268
  | `setup` | `(editor) => void` | &mdash; | Pre-init callback for registering custom toolbar buttons. |
242
269
 
243
270
  ### Dark Theme
@@ -251,6 +278,19 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
251
278
  />
252
279
  ```
253
280
 
281
+ ### Confab Skin
282
+
283
+ The `confab` / `confab-dark` skins integrate with the WorldClient theming system, pulling colors from the host application's CSS custom properties so the editor adapts when the app theme changes:
284
+
285
+ ```tsx
286
+ <Editor
287
+ config={{
288
+ skin: 'confab-dark',
289
+ content_css: 'confab-dark',
290
+ }}
291
+ />
292
+ ```
293
+
254
294
  ### Custom Content Styles
255
295
 
256
296
  ```tsx
@@ -261,6 +301,39 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
261
301
  />
262
302
  ```
263
303
 
304
+ ### Menu Bar, Context Menu & Quick Toolbars
305
+
306
+ Opt into the additional editing surfaces exposed by `@mdaemon/html-editor` 1.6.0:
307
+
308
+ ```tsx
309
+ <Editor
310
+ config={{
311
+ menubar: true, // menu bar above the toolbar
312
+ contextmenu: true, // right-click context menu
313
+ quickbars_selection_toolbar: 'bold italic | quicklink blockquote',
314
+ quickbars_image_toolbar: true, // floating toolbar when an image is selected
315
+ elementpath: true, // breadcrumb status bar at the cursor
316
+ }}
317
+ />
318
+ ```
319
+
320
+ `contextmenu` also accepts a button-list string to customize its contents, and
321
+ `quickbars_insert_toolbar` shows a floating insert toolbar on empty lines.
322
+
323
+ ### Read-Only Mode
324
+
325
+ Start the editor read-only with `readonly: true`, or toggle it at runtime through the underlying editor instance:
326
+
327
+ ```tsx
328
+ <Editor config={{ readonly: true }} ref={editorRef} />
329
+
330
+ // Toggle later
331
+ editorRef.current?.getEditor()?.setReadOnly(false);
332
+ const isReadOnly = editorRef.current?.getEditor()?.isReadOnly();
333
+ ```
334
+
335
+ > The `disabled` prop applies a lightweight visual lock (pointer-events off, reduced opacity). For true non-editable behavior that also dims the toolbar, prefer `readonly` / `setReadOnly()`.
336
+
264
337
  ## Templates
265
338
 
266
339
  Enable the template dropdown and provide a `templates` array:
@@ -368,6 +441,8 @@ Buttons after `||` begin collapsed behind a toggle (`...`) button.
368
441
  | `italic` | Toggle italic |
369
442
  | `underline` | Toggle underline |
370
443
  | `strikethrough` | Toggle strikethrough |
444
+ | `subscript` | Toggle subscript |
445
+ | `superscript` | Toggle superscript |
371
446
  | `bullist` | Bullet list |
372
447
  | `numlist` | Numbered list |
373
448
  | `outdent` | Decrease indent |
@@ -376,6 +451,8 @@ Buttons after `||` begin collapsed behind a toggle (`...`) button.
376
451
  | `fontfamily` | Font family dropdown |
377
452
  | `fontsize` | Font size dropdown |
378
453
  | `lineheight` | Line height dropdown |
454
+ | `blocks` | Block format dropdown &mdash; Paragraph, Heading 1&ndash;6 (alias `formatselect`) |
455
+ | `styles` | Named styles dropdown (configurable via `style_formats`) |
379
456
  | `template` | Template dropdown (requires `includeTemplates: true`) |
380
457
  | `alignleft` | Left align |
381
458
  | `aligncenter` | Center align |
@@ -390,14 +467,20 @@ Buttons after `||` begin collapsed behind a toggle (`...`) button.
390
467
  | `undo` | Undo |
391
468
  | `redo` | Redo |
392
469
  | `image` | Insert image (upload or URL) |
470
+ | `table` | Table dropdown (insert table + row/column/cell operations) |
471
+ | `hr` | Insert horizontal rule |
393
472
  | `charmap` | Special character picker |
394
473
  | `emoticons` | Emoji picker with search |
395
- | `code` | Toggle code block |
474
+ | `code` | Open HTML source code editor dialog |
396
475
  | `link` | Insert/edit hyperlink |
476
+ | `unlink` | Remove the link at the cursor |
477
+ | `anchor` | Insert a named anchor (`<a id>` target) |
397
478
  | `codesample` | Toggle code sample |
398
479
  | `fullscreen` | Toggle fullscreen |
399
480
  | `preview` | Preview in new window |
400
481
  | `searchreplace` | Find & Replace dialog |
482
+ | `speechtotext` | Open Speech to Text dialog (requires `speech_to_text` + browser support) |
483
+ | `dictate` | Toggle inline dictation &mdash; inserts speech at the cursor (requires `speech_to_text` + browser support) |
401
484
  | `ltr` | Left-to-right direction |
402
485
  | `rtl` | Right-to-left direction |
403
486
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdaemon/html-editor-react",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "React wrapper for MDHTMLEditor",
5
5
  "homepage": "https://github.com/mdaemon-technologies/MDHTMLEditor-react",
6
6
  "repository": {
@@ -53,7 +53,7 @@
53
53
  "react-dom": "^19.0.0 || ^18.0.0"
54
54
  },
55
55
  "dependencies": {
56
- "@mdaemon/html-editor": "^1.4.2",
56
+ "@mdaemon/html-editor": "^1.6.0",
57
57
  "@tiptap/react": "^3.23.4"
58
58
  },
59
59
  "devDependencies": {