@mdaemon/html-editor-react 1.7.1 → 1.8.1

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 +53 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -12,6 +12,13 @@ npm install @mdaemon/html-editor-react @mdaemon/html-editor
12
12
 
13
13
  **Peer dependencies:** `react` and `react-dom` (v18 or v19).
14
14
 
15
+ **TipTap:** the editor is built on TipTap 3, and this package tracks the same version the
16
+ engine uses — currently **3.31.3** (`@mdaemon/html-editor` `^1.12.1`,
17
+ `@tiptap/react` `^3.31.3`). If your app depends on any `@tiptap/*` package directly, keep
18
+ it on that version too: ProseMirror throws at runtime if two copies of `@tiptap/core` /
19
+ `@tiptap/pm` end up in the bundle. If you only use `<Editor>` or `useEditor`, there is
20
+ nothing to do.
21
+
15
22
  ## Styles
16
23
 
17
24
  You must import the editor stylesheet for the toolbar and UI to render correctly:
@@ -252,7 +259,7 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
252
259
  | `plugins` | `string` | &mdash; | Accepted for TinyMCE compatibility and ignored &mdash; all features are built in. |
253
260
  | `browser_spellcheck` | `boolean` | `true` | Enable browser spell check. |
254
261
  | `entity_encoding` | `'raw' \| 'named' \| 'numeric'` | `'raw'` | HTML entity encoding mode. |
255
- | `paste_from_office` | `boolean` | `true` | Clean and preserve formatting when pasting from Microsoft Word/Excel. |
262
+ | `paste_from_office` | `boolean` | `true` | Clean and preserve formatting when pasting from Microsoft Word/Excel. Pasted list indentation is normalized either way &mdash; see [Lists & Indentation](#lists--indentation). |
256
263
  | `speech_to_text` | `boolean` | `true` | Enable the `speechtotext` and `dictate` toolbar buttons (requires the Web Speech API). |
257
264
  | `convert_unsafe_embeds` | `boolean` | `true` | Sanitize embedded content. |
258
265
  | `format_empty_lines` | `boolean` | `true` | Preserve blank lines outside the editor. On the way out (`getContent()`, the `onChange` payload, preview, and the source dialog) each empty block is filled with a `<br>` &mdash; bare empty blocks otherwise collapse to zero height in mail clients; on the way in (`setContent()`, `insertContent()`, templates) it is stripped back out, so `setContent(getContent(x))` is stable across round-trips. Set `false` to pass content through unchanged in both directions. |
@@ -407,6 +414,47 @@ tiptap?.chain().focus().setBlockFontFamily('Georgia, serif').run();
407
414
  tiptap?.chain().focus().setBlockFontSize('14pt').run();
408
415
  ```
409
416
 
417
+ ## Lists & Indentation
418
+
419
+ ### Increase / Decrease Indent
420
+
421
+ The `indent` / `outdent` toolbar buttons, `execCommand('indent' | 'outdent')`, and the <kbd>Tab</kbd> / <kbd>Shift</kbd>+<kbd>Tab</kbd> keys all resolve to the same behavior, chosen by what is under the cursor:
422
+
423
+ | Context | Increase indent | Decrease indent |
424
+ |---------|-----------------|-----------------|
425
+ | List item with a previous sibling | Nests it one level deeper | Reduces its own indent, then un-nests it one level |
426
+ | First list item at its level | Adds a `margin-left` to the `<li>` | Reduces that margin, then lifts the item out of the list |
427
+ | Paragraph, heading | Adds a `margin-left` in 40px steps (max 400px) | Removes one step |
428
+ | Code block | Inserts a literal tab | Nothing |
429
+
430
+ Inside a list the indent is written to the `<li>` rather than to the paragraph inside it, so the bullet or number moves with the text. Because it is an inline `margin-left`, it survives in the exported HTML &mdash; in a mail client, say &mdash; without the editor's stylesheet. In a table, <kbd>Tab</kbd> still moves between cells; the toolbar buttons indent the paragraph in the cell.
431
+
432
+ ### Ordered List Numbering
433
+
434
+ An ordered list's numbering style is preserved rather than normalized to `1, 2, 3`. `<ol type="A">`, `type="a"`, `type="I"`, `type="i"` and `start="5"` round-trip through `setContent()` / `getContent()` and render as written. A list that states its style with CSS instead (`<ol style="list-style-type:upper-alpha">`) is read the same way and exported as `<ol type="A">`.
435
+
436
+ ```tsx
437
+ <Editor
438
+ config={{}}
439
+ initialValue='<ol type="A" start="3"><li><p>Third</p></li><li><p>Fourth</p></li></ol>'
440
+ />
441
+ // renders as C. Third / D. Fourth
442
+ ```
443
+
444
+ Lists that declare nothing keep the editor's nesting defaults: decimal, then lower-alpha, then lower-roman for ordered lists; disc, circle, then square for bullets.
445
+
446
+ > If you layer your own CSS on the editing surface (`content_style`, or a stylesheet in the host app), avoid a blanket `ol { list-style-type: ... }` reset &mdash; it outranks the `type` attribute and flattens typed lists back to decimal.
447
+
448
+ ### Pasting a List
449
+
450
+ Lists pasted from Word, Outlook, Google Docs, another editor, or a web page are normalized on the way in:
451
+
452
+ - **Indentation is dropped.** Those sources position a list with inline `margin-left` / `padding-left` / `text-indent` from their own page layout. Carried over, that stacks on top of the editor's list indent, so a pasted list sits a level further right than one built with the toolbar. Nesting is structural (`<ol><li><ol>`), so nothing is lost by dropping it. Indentation on non-list blocks (paragraphs, blockquotes) is left alone.
453
+ - **A list that is already a real `<ol>`/`<ul>` stays one list.** Word and Outlook email HTML often marks up a genuine list whose `<li>`s also carry Word's `MsoListParagraph` class and `mso-list` metadata; those items are cleaned in place instead of being wrapped in a second list.
454
+ - **Word's numbering style is kept.** `mso-level-number-format` (and `mso-level-start-at`) become the list's `type` and `start`, so a lettered or roman Word list is not renumbered. When the clipboard carries no `@list` rules at all &mdash; common &mdash; the style is inferred from the marker text Word inlines (`A.`, `iv.`, `1.`, `&middot;`), which also keeps a numbered list from arriving as a bullet list.
455
+
456
+ Word/Excel cleaning as a whole can be turned off with [`paste_from_office: false`](#configuration); list indentation is normalized either way.
457
+
410
458
  ## Templates
411
459
 
412
460
  Enable the template dropdown and provide a `templates` array:
@@ -518,8 +566,8 @@ Buttons after `||` begin collapsed behind a toggle (`...`) button.
518
566
  | `superscript` | Toggle superscript |
519
567
  | `bullist` | Bullet list |
520
568
  | `numlist` | Numbered list |
521
- | `outdent` | Decrease indent (lifts a list item, or removes block `margin-left`) |
522
- | `indent` | Increase indent (nests a list item, or adds block `margin-left`) |
569
+ | `outdent` | Decrease indent &mdash; un-nests a list item, or removes block `margin-left` (see [Lists & Indentation](#lists--indentation)) |
570
+ | `indent` | Increase indent &mdash; nests a list item, or adds block `margin-left` (see [Lists & Indentation](#lists--indentation)) |
523
571
  | `blockquote` | Toggle block quote |
524
572
  | `fontfamily` | Font family dropdown |
525
573
  | `fontsize` | Font size dropdown |
@@ -652,8 +700,8 @@ setGetFileSrc((path) => `https://cdn.example.com${path}`);
652
700
  | Ctrl/Cmd + Z | Undo |
653
701
  | Ctrl/Cmd + Shift + Z | Redo |
654
702
  | Ctrl/Cmd + F | Find & Replace |
655
- | Tab | Indent &mdash; nests a list item, moves to the next table cell, or adds block indent |
656
- | Shift + Tab | Outdent &mdash; lifts a list item, moves to the previous table cell, or removes block indent |
703
+ | Tab | Increase indent &mdash; nests or indents a list item, moves to the next table cell, inserts a tab in a code block, or indents the block ([details](#lists--indentation)) |
704
+ | Shift + Tab | Decrease indent &mdash; un-nests a list item, moves to the previous table cell, or removes block indent ([details](#lists--indentation)) |
657
705
  | Esc, then Tab | Move focus to the next element outside the editor (keyboard escape) |
658
706
  | Esc, then Shift + Tab | Move focus to the previous element outside the editor |
659
707
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdaemon/html-editor-react",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "description": "React wrapper for MDHTMLEditor",
5
5
  "homepage": "https://github.com/mdaemon-technologies/MDHTMLEditor-react",
6
6
  "repository": {
@@ -53,8 +53,8 @@
53
53
  "react-dom": "^19.0.0 || ^18.0.0"
54
54
  },
55
55
  "dependencies": {
56
- "@mdaemon/html-editor": "^1.11.1",
57
- "@tiptap/react": "^3.27.4"
56
+ "@mdaemon/html-editor": "^1.12.1",
57
+ "@tiptap/react": "^3.31.3"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@eslint/js": "^9.39.4",