@mdaemon/html-editor-react 1.9.1 → 1.11.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/LICENSE CHANGED
@@ -1,165 +1,165 @@
1
- GNU LESSER GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
3
-
4
- Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
- Everyone is permitted to copy and distribute verbatim copies
6
- of this license document, but changing it is not allowed.
7
-
8
-
9
- This version of the GNU Lesser General Public License incorporates
10
- the terms and conditions of version 3 of the GNU General Public
11
- License, supplemented by the additional permissions listed below.
12
-
13
- 0. Additional Definitions.
14
-
15
- As used herein, "this License" refers to version 3 of the GNU Lesser
16
- General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
- General Public License.
18
-
19
- "The Library" refers to a covered work governed by this License,
20
- other than an Application or a Combined Work as defined below.
21
-
22
- An "Application" is any work that makes use of an interface provided
23
- by the Library, but which is not otherwise based on the Library.
24
- Defining a subclass of a class defined by the Library is deemed a mode
25
- of using an interface provided by the Library.
26
-
27
- A "Combined Work" is a work produced by combining or linking an
28
- Application with the Library. The particular version of the Library
29
- with which the Combined Work was made is also called the "Linked
30
- Version".
31
-
32
- The "Minimal Corresponding Source" for a Combined Work means the
33
- Corresponding Source for the Combined Work, excluding any source code
34
- for portions of the Combined Work that, considered in isolation, are
35
- based on the Application, and not on the Linked Version.
36
-
37
- The "Corresponding Application Code" for a Combined Work means the
38
- object code and/or source code for the Application, including any data
39
- and utility programs needed for reproducing the Combined Work from the
40
- Application, but excluding the System Libraries of the Combined Work.
41
-
42
- 1. Exception to Section 3 of the GNU GPL.
43
-
44
- You may convey a covered work under sections 3 and 4 of this License
45
- without being bound by section 3 of the GNU GPL.
46
-
47
- 2. Conveying Modified Versions.
48
-
49
- If you modify a copy of the Library, and, in your modifications, a
50
- facility refers to a function or data to be supplied by an Application
51
- that uses the facility (other than as an argument passed when the
52
- facility is invoked), then you may convey a copy of the modified
53
- version:
54
-
55
- a) under this License, provided that you make a good faith effort to
56
- ensure that, in the event an Application does not supply the
57
- function or data, the facility still operates, and performs
58
- whatever part of its purpose remains meaningful, or
59
-
60
- b) under the GNU GPL, with none of the additional permissions of
61
- this License applicable to that copy.
62
-
63
- 3. Object Code Incorporating Material from Library Header Files.
64
-
65
- The object code form of an Application may incorporate material from
66
- a header file that is part of the Library. You may convey such object
67
- code under terms of your choice, provided that, if the incorporated
68
- material is not limited to numerical parameters, data structure
69
- layouts and accessors, or small macros, inline functions and templates
70
- (ten or fewer lines in length), you do both of the following:
71
-
72
- a) Give prominent notice with each copy of the object code that the
73
- Library is used in it and that the Library and its use are
74
- covered by this License.
75
-
76
- b) Accompany the object code with a copy of the GNU GPL and this license
77
- document.
78
-
79
- 4. Combined Works.
80
-
81
- You may convey a Combined Work under terms of your choice that,
82
- taken together, effectively do not restrict modification of the
83
- portions of the Library contained in the Combined Work and reverse
84
- engineering for debugging such modifications, if you also do each of
85
- the following:
86
-
87
- a) Give prominent notice with each copy of the Combined Work that
88
- the Library is used in it and that the Library and its use are
89
- covered by this License.
90
-
91
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
- document.
93
-
94
- c) For a Combined Work that displays copyright notices during
95
- execution, include the copyright notice for the Library among
96
- these notices, as well as a reference directing the user to the
97
- copies of the GNU GPL and this license document.
98
-
99
- d) Do one of the following:
100
-
101
- 0) Convey the Minimal Corresponding Source under the terms of this
102
- License, and the Corresponding Application Code in a form
103
- suitable for, and under terms that permit, the user to
104
- recombine or relink the Application with a modified version of
105
- the Linked Version to produce a modified Combined Work, in the
106
- manner specified by section 6 of the GNU GPL for conveying
107
- Corresponding Source.
108
-
109
- 1) Use a suitable shared library mechanism for linking with the
110
- Library. A suitable mechanism is one that (a) uses at run time
111
- a copy of the Library already present on the user's computer
112
- system, and (b) will operate properly with a modified version
113
- of the Library that is interface-compatible with the Linked
114
- Version.
115
-
116
- e) Provide Installation Information, but only if you would otherwise
117
- be required to provide such information under section 6 of the
118
- GNU GPL, and only to the extent that such information is
119
- necessary to install and execute a modified version of the
120
- Combined Work produced by recombining or relinking the
121
- Application with a modified version of the Linked Version. (If
122
- you use option 4d0, the Installation Information must accompany
123
- the Minimal Corresponding Source and Corresponding Application
124
- Code. If you use option 4d1, you must provide the Installation
125
- Information in the manner specified by section 6 of the GNU GPL
126
- for conveying Corresponding Source.)
127
-
128
- 5. Combined Libraries.
129
-
130
- You may place library facilities that are a work based on the
131
- Library side by side in a single library together with other library
132
- facilities that are not Applications and are not covered by this
133
- License, and convey such a combined library under terms of your
134
- choice, if you do both of the following:
135
-
136
- a) Accompany the combined library with a copy of the same work based
137
- on the Library, uncombined with any other library facilities,
138
- conveyed under the terms of this License.
139
-
140
- b) Give prominent notice with the combined library that part of it
141
- is a work based on the Library, and explaining where to find the
142
- accompanying uncombined form of the same work.
143
-
144
- 6. Revised Versions of the GNU Lesser General Public License.
145
-
146
- The Free Software Foundation may publish revised and/or new versions
147
- of the GNU Lesser General Public License from time to time. Such new
148
- versions will be similar in spirit to the present version, but may
149
- differ in detail to address new problems or concerns.
150
-
151
- Each version is given a distinguishing version number. If the
152
- Library as you received it specifies that a certain numbered version
153
- of the GNU Lesser General Public License "or any later version"
154
- applies to it, you have the option of following the terms and
155
- conditions either of that published version or of any later version
156
- published by the Free Software Foundation. If the Library as you
157
- received it does not specify a version number of the GNU Lesser
158
- General Public License, you may choose any version of the GNU Lesser
159
- General Public License ever published by the Free Software Foundation.
160
-
161
- If the Library as you received it specifies that a proxy can decide
162
- whether future versions of the GNU Lesser General Public License shall
163
- apply, that proxy's public statement of acceptance of any version is
164
- permanent authorization for you to choose that version for the
165
- Library.
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm](https://img.shields.io/npm/v/@mdaemon/html-editor-react?color=blue)](https://www.npmjs.com/package/@mdaemon/html-editor-react)
4
4
  [![license](https://img.shields.io/npm/l/@mdaemon/html-editor-react?color=green)](LICENSE)
5
5
  [![node](https://img.shields.io/node/v/@mdaemon/html-editor-react)](https://nodejs.org)
6
- [![install size](https://packagephobia.com/badge?p=@mdaemon/html-editor-react)](https://packagephobia.com/result?p=@mdaemon/html-editor-react)
6
+ [![install size](https://img.shields.io/npm/unpacked-size/@mdaemon/html-editor-react)](https://packagephobia.com/result?p=@mdaemon/html-editor-react)
7
7
  [![CI](https://github.com/mdaemon-technologies/MDHTMLEditor-react/actions/workflows/ci.yml/badge.svg)](https://github.com/mdaemon-technologies/MDHTMLEditor-react/actions/workflows/ci.yml)
8
8
 
9
9
  React wrapper for MDHTMLEditor
@@ -19,8 +19,8 @@ npm install @mdaemon/html-editor-react
19
19
  **Peer dependencies:** `react` and `react-dom` (v18 or v19).
20
20
 
21
21
  **TipTap:** the editor is built on TipTap 3, and this package tracks the same version the
22
- engine uses &mdash; currently **3.31.3** (`@mdaemon/html-editor` `^1.13.1`,
23
- `@tiptap/react` `^3.31.3`). If your app depends on any `@tiptap/*` package directly, keep
22
+ engine uses &mdash; currently **3.32.0** (`@mdaemon/html-editor` `^1.16.0`,
23
+ `@tiptap/react` `^3.32.0`). If your app depends on any `@tiptap/*` package directly, keep
24
24
  it on that version too: ProseMirror throws at runtime if two copies of `@tiptap/core` /
25
25
  `@tiptap/pm` end up in the bundle. If you only use `<Editor>` or `useEditor`, there is
26
26
  nothing to do.
@@ -233,7 +233,7 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
233
233
  | `height` | `string \| number` | `300` | Editor height. |
234
234
  | `min_height` | `string \| number` | &mdash; | Minimum editor height. |
235
235
  | `max_height` | `string \| number` | &mdash; | Maximum editor height. |
236
- | `language` | `string` | `'en'` | UI language code. 31 languages built in. |
236
+ | `language` | `string` | `'en'` | UI language code. 32 languages built in &mdash; see [Supported Languages](#supported-languages). |
237
237
  | `skin` | `'oxide' \| 'oxide-dark' \| 'confab' \| 'confab-dark'` | `'oxide'` | Toolbar and dialog theme. |
238
238
  | `content_css` | `'default' \| 'dark' \| 'confab' \| 'confab-dark'` | `'default'` | Content area theme. |
239
239
  | `content_style` | `string` | &mdash; | Custom CSS injected into the editing surface. |
@@ -246,7 +246,7 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
246
246
  | `block_formats` | `string` | *(Paragraph + H1&ndash;H6)* | Block-format dropdown definitions for the `blocks` button (`Name=tag;...`). |
247
247
  | `style_formats` | `StyleFormat[]` | *(subset)* | Named styles for the `styles` dropdown (CKEditor `stylesSet`-compatible). |
248
248
  | `forced_root_block` | `'p' \| 'div'` | `'p'` | Block element produced on Enter. `'div'` gives CKEditor `ENTER_DIV` parity. |
249
- | `trailingNode` | `boolean` | `false` | Append an empty trailing paragraph after a block node (table, image, code block) so the cursor can sit after it. |
249
+ | `trailingNode` | `boolean` | `false` | Append an empty trailing paragraph after a block node (table, code block) so the cursor can sit after it. |
250
250
  | `directionality` | `'ltr' \| 'rtl'` | `'ltr'` | Text direction. |
251
251
  | `toolbar` | `string` | *(preset)* | Custom toolbar layout string. |
252
252
  | `toolbar_mode` | `'sliding' \| 'floating' \| 'wrap'` | `'wrap'` | Toolbar overflow behavior. |
@@ -258,6 +258,8 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
258
258
  | `quickbars_selection_toolbar` | `string` | `'bold italic \| quicklink blockquote'` | Inline floating toolbar shown over a text selection. |
259
259
  | `quickbars_image_toolbar` | `boolean` | `false` | Inline floating toolbar shown when an image is selected. |
260
260
  | `quickbars_insert_toolbar` | `boolean` | `false` | Inline floating toolbar shown on empty lines for quick insertion. |
261
+ | `object_resizing` | `boolean \| string` | `true` | Show drag handles on a selected image to resize it. `false` turns resizing off; a CSS selector string (TinyMCE-style, e.g. `'img[alt]'`) limits it to the images that match &mdash; see [Resizing Images](#resizing-images). |
262
+ | `resize_img_proportional` | `boolean` | `true` | Corner handles keep the image's aspect ratio. Holding Shift while dragging does the opposite for that drag. |
261
263
  | `elementpath` | `boolean` | `false` | Show a breadcrumb of the node path at the cursor in the status bar. |
262
264
  | `valid_children` | `string` | &mdash; | TinyMCE-style rules controlling which child elements are allowed. |
263
265
  | `auto_focus` | `string` | &mdash; | Auto-focus on init. |
@@ -267,6 +269,7 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
267
269
  | `entity_encoding` | `'raw' \| 'named' \| 'numeric'` | `'raw'` | HTML entity encoding mode. |
268
270
  | `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). |
269
271
  | `paste_markdown` | `boolean` | `false` | Start with paste-as-Markdown on, so a paste is read as Markdown and inserted as real formatting. Toggle at runtime via `getEditor()?.setPasteMarkdown()` or the `pastemarkdown` toolbar button &mdash; see [Pasting Markdown](#pasting-markdown). |
272
+ | `quote_marker_class` | `string` | &mdash; | Class that marks a reply's quoted original. A `<blockquote>` or `<div>` whose class is exactly this value keeps the class and its margin, padding and border in `getContent()`, so the quote can be found again. One class name; off when unset or empty. See the [engine docs](https://github.com/mdaemon-technologies/MDHTMLEditor#quoted-original-of-a-reply). |
270
273
  | `speech_to_text` | `boolean` | `true` | Enable the `speechtotext` and `dictate` toolbar buttons (requires the Web Speech API). |
271
274
  | `convert_unsafe_embeds` | `boolean` | `true` | Sanitize embedded content. |
272
275
  | `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. |
@@ -281,6 +284,7 @@ The `config` prop (or `useEditor`'s `config` option) accepts an `EditorConfig` o
281
284
  | `images_file_types` | `string` | *(permissive)* | Comma/space-separated accepted extensions (e.g. `'jpg,jpeg,png,gif'`). |
282
285
  | `images_upload_validate` | `(file: File) => string \| null` | &mdash; | Pre-upload hook; return a message to reject the file, or `null` to allow. |
283
286
  | `images_upload_error` | `(message: string) => void` | &mdash; | Caller-supplied alert for drag-drop/paste upload rejections and failures. |
287
+ | `images_upload_error_message` | `(response: unknown, status: number) => string \| null \| undefined` | &mdash; | Words the message for a failed upload from the server's reply (parsed JSON body, or `null`, and the HTTP status). Return `null`/`undefined` for the editor's own translated message &mdash; see [Image Upload](#image-upload). |
284
288
  | `setup` | `(editor) => void` | &mdash; | Pre-init callback for registering custom toolbar buttons. |
285
289
 
286
290
  ### Dark Theme
@@ -695,7 +699,7 @@ Buttons after `||` begin collapsed behind a toggle (`...`) button.
695
699
  | `link` | Insert/edit hyperlink (with the caret on a link, edits that link in place) |
696
700
  | `unlink` | Remove the link at the cursor |
697
701
  | `anchor` | Insert a named anchor (`<a id>` target) |
698
- | `codesample` | Toggle code sample |
702
+ | `codesample` | Toggle code sample on the lines the selection touches (lines split by Shift+Enter outside the selection stay text) |
699
703
  | `fullscreen` | Toggle fullscreen |
700
704
  | `preview` | Preview in new window (the window carries a Content Security Policy that blocks script) |
701
705
  | `searchreplace` | Find & Replace dialog |
@@ -726,6 +730,44 @@ SVGs are automatically sanitized (script tags, event handlers, and dangerous ele
726
730
  />
727
731
  ```
728
732
 
733
+ Upload failures are shown in the editor's language. When your server explains a refusal in its reply, `images_upload_error_message` lets you word the message yourself. It receives the parsed JSON body (`null` when the body is not JSON) and the HTTP status, and returns the message to show, or `null`/`undefined` to keep the editor's own. It is not called for a network error or an aborted request. The message is shown in the image dialog, and passed to `images_upload_error` for a dropped or pasted image.
734
+
735
+ ```tsx
736
+ <Editor
737
+ config={{
738
+ images_upload_url: '/api/upload',
739
+ // The server answers a refusal with HTTP 200 and {"error": "<reason>"}
740
+ images_upload_error_message: (response) => {
741
+ const error = (response as { error?: unknown } | null)?.error;
742
+ return typeof error === 'string' ? error : null;
743
+ },
744
+ images_upload_error: (message) => showAlert(message),
745
+ }}
746
+ />
747
+ ```
748
+
749
+ ### Resizing Images
750
+
751
+ Click an image in the full editor to select it, and drag one of the eight handles to resize it. Corners keep the aspect ratio (hold Shift to stretch freely), sides change only the width or the height, and Escape cancels the drag. The new size is saved in the image's `width` and `height` attributes, as TinyMCE does, as one undo step that fires `onDirty` and `onChange` like any other edit. Handles are hidden in read-only mode.
752
+
753
+ Resizing is on by default. Set `object_resizing: false` to turn it off, or pass a CSS selector to allow it only for the images that match. The `objectresizestart` and `objectresized` events have no props; register them on the editor in `onInit`:
754
+
755
+ ```tsx
756
+ <Editor
757
+ config={{
758
+ object_resizing: 'img[alt]', // or true (default) / false
759
+ resize_img_proportional: true, // corners keep the aspect ratio (default)
760
+ }}
761
+ onInit={(editor) => {
762
+ editor.on('objectresized', ({ width, height }) => {
763
+ console.log(`Image resized to ${width} × ${height}`);
764
+ });
765
+ }}
766
+ />
767
+ ```
768
+
769
+ Images are inline, as in TinyMCE and mail HTML: a link around an image is kept, and an `<img>` that is not already in a line of text is put in a `<p>` (or a `<div>` with `forced_root_block: 'div'`).
770
+
729
771
  ## Localization
730
772
 
731
773
  ### Set Language at Init
@@ -745,6 +787,8 @@ setTranslate((key) => myTranslations[key] ?? key);
745
787
  <Editor translate={(key) => myTranslations[key] ?? key} config={{}} />
746
788
  ```
747
789
 
790
+ The built-in locale is the fallback: when your function returns an empty string (or, through `setTranslate()`, `null` or `undefined`), the editor shows its own translation for that key. A custom function therefore only needs the strings it wants to change. Keys with a placeholder, such as `Upload failed: {status}` and `Confidence: {percent}%`, must keep it in the translation.
791
+
748
792
  ### Change Language at Runtime
749
793
 
750
794
  ```tsx
@@ -754,6 +798,8 @@ const editorRef = useRef<EditorRef>(null);
754
798
  editorRef.current?.getEditor()?.setLanguage('fr');
755
799
  ```
756
800
 
801
+ `setLanguage()` keeps a custom translate function; it changes only the fallback locale.
802
+
757
803
  ### Supported Languages
758
804
 
759
805
  | Code | Language | Code | Language |
@@ -764,15 +810,15 @@ editorRef.current?.getEditor()?.setLanguage('fr');
764
810
  | `zh` | Chinese | `pt` | Portugues |
765
811
  | `cs` | Cesky | `ro` | Romana |
766
812
  | `da` | Dansk | `ru` | Russian |
767
- | `en-gb` | English (UK) | `sr` | Srpski |
768
- | `fi` | Suomi | `sl` | Slovenscina |
769
- | `fr` | Francais | `es` | Espanol |
770
- | `fr-ca` | Canadien francais | `sv` | Svenska |
771
- | `de` | Deutsch | `zh-tw` | Chinese (Taiwan) |
772
- | `el` | Greek | `th` | Thai |
773
- | `hu` | Magyar | `tr` | Turkce |
774
- | `id` | Bahasa Indonesia | `vi` | Tieng Viet |
775
- | `it` | Italiano | | |
813
+ | `en-gb` | English (UK) | `sr` | Srpski (Cyrillic) |
814
+ | `fi` | Suomi | `sr-latn` | Srpski (latinica) |
815
+ | `fr` | Francais | `sl` | Slovenscina |
816
+ | `fr-ca` | Canadien francais | `es` | Espanol |
817
+ | `de` | Deutsch | `sv` | Svenska |
818
+ | `el` | Greek | `zh-tw` | Chinese (Taiwan) |
819
+ | `hu` | Magyar | `th` | Thai |
820
+ | `id` | Bahasa Indonesia | `tr` | Turkce |
821
+ | `it` | Italiano | `vi` | Tieng Viet |
776
822
  | `ja` | Japanese | | |
777
823
  | `ko` | Korean | | |
778
824
 
@@ -799,6 +845,7 @@ setGetFileSrc((path) => `https://cdn.example.com${path}`);
799
845
  | Ctrl/Cmd + Z | Undo |
800
846
  | Ctrl/Cmd + Shift + Z | Redo |
801
847
  | Ctrl/Cmd + F | Find & Replace |
848
+ | Ctrl + Alt + C (Cmd + Option + C on macOS) | Toggle code sample |
802
849
  | 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)) |
803
850
  | Shift + Tab | Decrease indent &mdash; un-nests a list item, moves to the previous table cell, or removes block indent ([details](#lists--indentation)) |
804
851
  | Esc, then Tab | Move focus to the next element outside the editor (keyboard escape) |
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let react = require("react");
3
3
  let _mdaemon_html_editor = require("@mdaemon/html-editor");
4
4
  let react_jsx_runtime = require("react/jsx-runtime");
5
- //#region src/Editor.tsx
5
+ // src/Editor.tsx
6
6
  /**
7
7
  * MDHTMLEditor React Component
8
8
  * A TinyMCE-compatible React wrapper for MDHTMLEditor
@@ -97,8 +97,7 @@ var Editor = (0, react.forwardRef)(function Editor(props, ref) {
97
97
  });
98
98
  });
99
99
  Editor.displayName = "MDHTMLEditor";
100
- //#endregion
101
- //#region src/useEditor.ts
100
+ // src/useEditor.ts
102
101
  /**
103
102
  * useEditor Hook
104
103
  * Custom hook for advanced editor usage
@@ -152,7 +151,6 @@ function useEditor(options = {}) {
152
151
  isDirty
153
152
  };
154
153
  }
155
- //#endregion
156
154
  exports.Editor = Editor;
157
155
  exports.MDEditor = Editor;
158
156
  Object.defineProperty(exports, "fontNames", {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from "react";
2
2
  import { HTMLEditor, fontNames, setGetFileSrc, setGetFileSrc as setGetFileSrc$1, setTranslate, setTranslate as setTranslate$1 } from "@mdaemon/html-editor";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
- //#region src/Editor.tsx
4
+ // src/Editor.tsx
5
5
  /**
6
6
  * MDHTMLEditor React Component
7
7
  * A TinyMCE-compatible React wrapper for MDHTMLEditor
@@ -96,8 +96,7 @@ var Editor = forwardRef(function Editor(props, ref) {
96
96
  });
97
97
  });
98
98
  Editor.displayName = "MDHTMLEditor";
99
- //#endregion
100
- //#region src/useEditor.ts
99
+ // src/useEditor.ts
101
100
  /**
102
101
  * useEditor Hook
103
102
  * Custom hook for advanced editor usage
@@ -151,5 +150,4 @@ function useEditor(options = {}) {
151
150
  isDirty
152
151
  };
153
152
  }
154
- //#endregion
155
153
  export { Editor, Editor as MDEditor, fontNames, getEditorContent, setEditorContent, setGetFileSrc, setTranslate, useEditor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdaemon/html-editor-react",
3
- "version": "1.9.1",
3
+ "version": "1.11.0",
4
4
  "description": "React wrapper for MDHTMLEditor",
5
5
  "homepage": "https://github.com/mdaemon-technologies/MDHTMLEditor-react",
6
6
  "repository": {
@@ -56,8 +56,8 @@
56
56
  "react-dom": "^19.0.0 || ^18.0.0"
57
57
  },
58
58
  "dependencies": {
59
- "@mdaemon/html-editor": "^1.13.1",
60
- "@tiptap/react": "^3.31.3"
59
+ "@mdaemon/html-editor": "^1.16.0",
60
+ "@tiptap/react": "^3.32.0"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@eslint/js": "^9.39.4",