@mdaemon/html-editor-react 1.2.1 → 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.
Files changed (2) hide show
  1. package/README.md +56 -3
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -214,15 +214,24 @@ 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. |
@@ -230,6 +239,10 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
230
239
  | `auto_focus` | `string` | — | Auto-focus on init. |
231
240
  | `browser_spellcheck` | `boolean` | `true` | Enable browser spell check. |
232
241
  | `entity_encoding` | `'raw' \| 'named' \| 'numeric'` | `'raw'` | HTML entity encoding mode. |
242
+ | `paste_from_office` | `boolean` | `true` | Clean and preserve formatting when pasting from Microsoft Word/Excel. |
243
+ | `speech_to_text` | `boolean` | `true` | Enable the `speechtotext` and `dictate` toolbar buttons (requires the Web Speech API). |
244
+ | `convert_unsafe_embeds` | `boolean` | `true` | Sanitize embedded content. |
245
+ | `format_empty_lines` | `boolean` | `true` | Format empty lines. |
233
246
  | `includeTemplates` | `boolean` | `false` | Show the template dropdown. |
234
247
  | `templates` | `Template[]` | `[]` | Predefined HTML templates. |
235
248
  | `dropbox` | `boolean` | `false` | Enable Dropbox integration. |
@@ -238,6 +251,9 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
238
251
  | `images_upload_base_path` | `string` | `'/'` | Prefix for uploaded image URLs. |
239
252
  | `images_upload_max_size` | `number` | `10485760` | Max upload size in bytes (10 MB). |
240
253
  | `images_upload_headers` | `Record<string, string>` | &mdash; | Extra headers for upload requests. |
254
+ | `images_file_types` | `string` | *(permissive)* | Comma/space-separated accepted extensions (e.g. `'jpg,jpeg,png,gif'`). |
255
+ | `images_upload_validate` | `(file: File) => string \| null` | &mdash; | Pre-upload hook; return a message to reject the file, or `null` to allow. |
256
+ | `images_upload_error` | `(message: string) => void` | &mdash; | Caller-supplied alert for drag-drop/paste upload rejections and failures. |
241
257
  | `setup` | `(editor) => void` | &mdash; | Pre-init callback for registering custom toolbar buttons. |
242
258
 
243
259
  ### Dark Theme
@@ -251,6 +267,19 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
251
267
  />
252
268
  ```
253
269
 
270
+ ### Confab Skin
271
+
272
+ 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:
273
+
274
+ ```tsx
275
+ <Editor
276
+ config={{
277
+ skin: 'confab-dark',
278
+ content_css: 'confab-dark',
279
+ }}
280
+ />
281
+ ```
282
+
254
283
  ### Custom Content Styles
255
284
 
256
285
  ```tsx
@@ -261,6 +290,20 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
261
290
  />
262
291
  ```
263
292
 
293
+ ### Read-Only Mode
294
+
295
+ Start the editor read-only with `readonly: true`, or toggle it at runtime through the underlying editor instance:
296
+
297
+ ```tsx
298
+ <Editor config={{ readonly: true }} ref={editorRef} />
299
+
300
+ // Toggle later
301
+ editorRef.current?.getEditor()?.setReadOnly(false);
302
+ const isReadOnly = editorRef.current?.getEditor()?.isReadOnly();
303
+ ```
304
+
305
+ > 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()`.
306
+
264
307
  ## Templates
265
308
 
266
309
  Enable the template dropdown and provide a `templates` array:
@@ -368,6 +411,8 @@ Buttons after `||` begin collapsed behind a toggle (`...`) button.
368
411
  | `italic` | Toggle italic |
369
412
  | `underline` | Toggle underline |
370
413
  | `strikethrough` | Toggle strikethrough |
414
+ | `subscript` | Toggle subscript |
415
+ | `superscript` | Toggle superscript |
371
416
  | `bullist` | Bullet list |
372
417
  | `numlist` | Numbered list |
373
418
  | `outdent` | Decrease indent |
@@ -376,6 +421,8 @@ Buttons after `||` begin collapsed behind a toggle (`...`) button.
376
421
  | `fontfamily` | Font family dropdown |
377
422
  | `fontsize` | Font size dropdown |
378
423
  | `lineheight` | Line height dropdown |
424
+ | `blocks` | Block format dropdown &mdash; Paragraph, Heading 1&ndash;6 (alias `formatselect`) |
425
+ | `styles` | Named styles dropdown (configurable via `style_formats`) |
379
426
  | `template` | Template dropdown (requires `includeTemplates: true`) |
380
427
  | `alignleft` | Left align |
381
428
  | `aligncenter` | Center align |
@@ -390,14 +437,20 @@ Buttons after `||` begin collapsed behind a toggle (`...`) button.
390
437
  | `undo` | Undo |
391
438
  | `redo` | Redo |
392
439
  | `image` | Insert image (upload or URL) |
440
+ | `table` | Table dropdown (insert table + row/column/cell operations) |
441
+ | `hr` | Insert horizontal rule |
393
442
  | `charmap` | Special character picker |
394
443
  | `emoticons` | Emoji picker with search |
395
- | `code` | Toggle code block |
444
+ | `code` | Open HTML source code editor dialog |
396
445
  | `link` | Insert/edit hyperlink |
446
+ | `unlink` | Remove the link at the cursor |
447
+ | `anchor` | Insert a named anchor (`<a id>` target) |
397
448
  | `codesample` | Toggle code sample |
398
449
  | `fullscreen` | Toggle fullscreen |
399
450
  | `preview` | Preview in new window |
400
451
  | `searchreplace` | Find & Replace dialog |
452
+ | `speechtotext` | Open Speech to Text dialog (requires `speech_to_text` + browser support) |
453
+ | `dictate` | Toggle inline dictation &mdash; inserts speech at the cursor (requires `speech_to_text` + browser support) |
401
454
  | `ltr` | Left-to-right direction |
402
455
  | `rtl` | Right-to-left direction |
403
456
 
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.3.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.5.0",
57
57
  "@tiptap/react": "^3.23.4"
58
58
  },
59
59
  "devDependencies": {