@mdaemon/html-editor-react 1.8.1 → 1.8.3

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 +24 -2
  2. package/package.json +87 -87
package/README.md CHANGED
@@ -13,7 +13,7 @@ npm install @mdaemon/html-editor-react @mdaemon/html-editor
13
13
  **Peer dependencies:** `react` and `react-dom` (v18 or v19).
14
14
 
15
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`,
16
+ engine uses — currently **3.31.3** (`@mdaemon/html-editor` `^1.12.3`,
17
17
  `@tiptap/react` `^3.31.3`). If your app depends on any `@tiptap/*` package directly, keep
18
18
  it on that version too: ProseMirror throws at runtime if two copies of `@tiptap/core` /
19
19
  `@tiptap/pm` end up in the bundle. If you only use `<Editor>` or `useEditor`, there is
@@ -262,7 +262,7 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
262
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). |
263
263
  | `speech_to_text` | `boolean` | `true` | Enable the `speechtotext` and `dictate` toolbar buttons (requires the Web Speech API). |
264
264
  | `convert_unsafe_embeds` | `boolean` | `true` | Sanitize embedded content. |
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. |
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. A block is only "empty" if it has no visible content &mdash; a `<div>&nbsp;</div>` spacer counts as content and is left alone. Set `false` to pass content through unchanged in both directions. |
266
266
  | `includeTemplates` | `boolean` | `false` | Show the template dropdown. |
267
267
  | `templates` | `Template[]` | `[]` | Predefined HTML templates. |
268
268
  | `dropbox` | `boolean` | `false` | Enable Dropbox integration. |
@@ -493,6 +493,28 @@ interface Template {
493
493
  }
494
494
  ```
495
495
 
496
+ `content` may be pretty-printed &mdash; indented, one block per line. The newlines and
497
+ tabs between block elements are collapsed per the usual HTML rules when the template is
498
+ inserted, so they do not become extra list items or blank blocks. Indentation inside a
499
+ `<pre>` or code block is preserved.
500
+
501
+ Stored templates are also tolerant of the wrappers and placeholders real-world HTML
502
+ carries:
503
+
504
+ - **Container `<div>`s do not become blank lines.** A body swaddled in several nested
505
+ `<div>`s (the shape mail clients and CMSes produce) is flattened on import rather than
506
+ leaving one empty line per wrapper.
507
+ - **A wrapper's font reaches the lines it wrapped.** `font-family`, `font-size`, `color`,
508
+ `line-height`, `text-align` and the other inherited properties on a container are
509
+ carried down to its children, so a body wrapped in
510
+ `<div style="font-family:Georgia;font-size:10pt">` keeps that font instead of falling
511
+ back to the editor default. A child that states its own value wins.
512
+ - **`<a href="">` survives.** A link whose target was left for later keeps its anchor
513
+ element instead of collapsing to plain text. Non-empty targets are still validated, so
514
+ `javascript:` and `data:` URLs are rejected as before.
515
+
516
+ `<blockquote>`, list items, table cells and the signature container keep their structure.
517
+
496
518
  ## Custom Toolbar Buttons
497
519
 
498
520
  Register custom buttons via the `setup` callback in `config`:
package/package.json CHANGED
@@ -1,87 +1,87 @@
1
- {
2
- "name": "@mdaemon/html-editor-react",
3
- "version": "1.8.1",
4
- "description": "React wrapper for MDHTMLEditor",
5
- "homepage": "https://github.com/mdaemon-technologies/MDHTMLEditor-react",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/mdaemon-technologies/MDHTMLEditor-react.git"
9
- },
10
- "bugs": {
11
- "url": "https://github.com/mdaemon-technologies/MDHTMLEditor-react/issues"
12
- },
13
- "main": "dist/index.js",
14
- "module": "dist/index.mjs",
15
- "types": "dist/index.d.ts",
16
- "exports": {
17
- ".": {
18
- "types": "./dist/index.d.ts",
19
- "import": "./dist/index.mjs",
20
- "require": "./dist/index.js"
21
- }
22
- },
23
- "publishConfig": {
24
- "access": "public"
25
- },
26
- "files": [
27
- "dist"
28
- ],
29
- "scripts": {
30
- "build": "vite build --mode production",
31
- "build:dev": "vite build --mode development",
32
- "dev": "vite build --watch --mode development",
33
- "demo": "vite serve --config vite.demo.config.ts",
34
- "test": "jest",
35
- "test:coverage": "jest --coverage",
36
- "lint": "eslint src --ext .ts,.tsx",
37
- "typecheck": "tsc --noEmit"
38
- },
39
- "keywords": [
40
- "html-editor",
41
- "wysiwyg",
42
- "react",
43
- "tiptap"
44
- ],
45
- "author": {
46
- "name": "MDaemon Technologies, Ltd.",
47
- "email": "jonathan.ehman@mdaemon.com",
48
- "url": "https://www.mdaemon.com"
49
- },
50
- "license": "LGPL-3.0-or-later",
51
- "peerDependencies": {
52
- "react": "^19.0.0 || ^18.0.0",
53
- "react-dom": "^19.0.0 || ^18.0.0"
54
- },
55
- "dependencies": {
56
- "@mdaemon/html-editor": "^1.12.1",
57
- "@tiptap/react": "^3.31.3"
58
- },
59
- "devDependencies": {
60
- "@eslint/js": "^9.39.4",
61
- "@swc/core": "^1.11.0",
62
- "@swc/jest": "^0.2.39",
63
- "@testing-library/jest-dom": "^6.9.1",
64
- "@testing-library/react": "^16.3.2",
65
- "@types/jest": "^30.0.0",
66
- "@types/react": "^19.2.0",
67
- "@types/react-dom": "^19.2.0",
68
- "@vitejs/plugin-react": "^6.0.2",
69
- "eslint": "^9.39.4",
70
- "eslint-plugin-react": "^7.37.5",
71
- "eslint-plugin-react-hooks": "^5.2.0",
72
- "globals": "^15.15.0",
73
- "jest": "^30.3.0",
74
- "jest-environment-jsdom": "^30.3.0",
75
- "react": "^19.2.0",
76
- "react-dom": "^19.2.0",
77
- "typescript": "^6.0.2",
78
- "typescript-eslint": "^8.61.0",
79
- "vite": "^8.0.16",
80
- "vite-plugin-dts": "^5.0.2"
81
- },
82
- "allowScripts": {
83
- "@swc/core": true,
84
- "esbuild": true,
85
- "unrs-resolver": true
86
- }
87
- }
1
+ {
2
+ "name": "@mdaemon/html-editor-react",
3
+ "version": "1.8.3",
4
+ "description": "React wrapper for MDHTMLEditor",
5
+ "homepage": "https://github.com/mdaemon-technologies/MDHTMLEditor-react",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/mdaemon-technologies/MDHTMLEditor-react.git"
9
+ },
10
+ "bugs": {
11
+ "url": "https://github.com/mdaemon-technologies/MDHTMLEditor-react/issues"
12
+ },
13
+ "main": "dist/index.js",
14
+ "module": "dist/index.mjs",
15
+ "types": "dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.mjs",
20
+ "require": "./dist/index.js"
21
+ }
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "scripts": {
30
+ "build": "vite build --mode production",
31
+ "build:dev": "vite build --mode development",
32
+ "dev": "vite build --watch --mode development",
33
+ "demo": "vite serve --config vite.demo.config.ts",
34
+ "test": "jest",
35
+ "test:coverage": "jest --coverage",
36
+ "lint": "eslint src --ext .ts,.tsx",
37
+ "typecheck": "tsc --noEmit"
38
+ },
39
+ "keywords": [
40
+ "html-editor",
41
+ "wysiwyg",
42
+ "react",
43
+ "tiptap"
44
+ ],
45
+ "author": {
46
+ "name": "MDaemon Technologies, Ltd.",
47
+ "email": "jonathan.ehman@mdaemon.com",
48
+ "url": "https://www.mdaemon.com"
49
+ },
50
+ "license": "LGPL-3.0-or-later",
51
+ "peerDependencies": {
52
+ "react": "^19.0.0 || ^18.0.0",
53
+ "react-dom": "^19.0.0 || ^18.0.0"
54
+ },
55
+ "dependencies": {
56
+ "@mdaemon/html-editor": "^1.12.3",
57
+ "@tiptap/react": "^3.31.3"
58
+ },
59
+ "devDependencies": {
60
+ "@eslint/js": "^9.39.4",
61
+ "@swc/core": "^1.11.0",
62
+ "@swc/jest": "^0.2.39",
63
+ "@testing-library/jest-dom": "^6.9.1",
64
+ "@testing-library/react": "^16.3.2",
65
+ "@types/jest": "^30.0.0",
66
+ "@types/react": "^19.2.0",
67
+ "@types/react-dom": "^19.2.0",
68
+ "@vitejs/plugin-react": "^6.0.2",
69
+ "eslint": "^9.39.4",
70
+ "eslint-plugin-react": "^7.37.5",
71
+ "eslint-plugin-react-hooks": "^5.2.0",
72
+ "globals": "^15.15.0",
73
+ "jest": "^30.3.0",
74
+ "jest-environment-jsdom": "^30.3.0",
75
+ "react": "^19.2.0",
76
+ "react-dom": "^19.2.0",
77
+ "typescript": "^6.0.2",
78
+ "typescript-eslint": "^8.61.0",
79
+ "vite": "^8.0.16",
80
+ "vite-plugin-dts": "^5.0.2"
81
+ },
82
+ "allowScripts": {
83
+ "@swc/core": true,
84
+ "esbuild": true,
85
+ "unrs-resolver": true
86
+ }
87
+ }