rj-editor 1.3.0 → 1.3.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # RJ Editor
2
2
 
3
- `rj-editor` is a React rich text editor package for building article editors, admin panels, CMS forms, learning platforms, notes, documentation tools, and other content-heavy interfaces.
3
+ `rj-editor` is a React text editor package for building article editors, admin panels, CMS forms, learning platforms, notes, documentation tools, and other content-heavy interfaces.
4
4
 
5
5
  It provides a ready-to-use `RJTextEditor` component with a tabbed toolbar, text formatting, tables, links, images, YouTube embeds, fullscreen mode, i18n, theming, and Ant Design Form support.
6
6
 
@@ -87,11 +87,19 @@ export function Article({ html }: { html: string }) {
87
87
  }
88
88
  ```
89
89
 
90
- Exported content includes inline styles for rich editor-only elements such as code blocks, inline code, tables, images, YouTube embeds, and equations. This lets saved HTML render correctly in pages that do not mount the editor stylesheet.
90
+ Exported content includes inline styles for editor-only elements such as code blocks, inline code, tables, images, YouTube embeds, and equations. This lets saved HTML render correctly in pages that do not mount the editor stylesheet.
91
91
 
92
- Exported code blocks keep their header and copy button. Importing `rj-editor` automatically registers the lightweight delegated copy handler, so code block copy controls also work inside content rendered with `dangerouslySetInnerHTML`.
92
+ Exported code blocks keep their header and copy button. The exported copy button includes a small inline fallback, but many applications sanitize HTML or block inline handlers with CSP. For reliable code-block copy controls on pages that only render saved HTML, import the lightweight rendered HTML helper in that client application:
93
93
 
94
- If you sanitize saved HTML before rendering it, keep the exported `style`, `data-rj-editor-code-block`, and `data-rj-editor-code-copy` attributes if you want the built-in rendered styles and copy controls to remain active.
94
+ ```tsx
95
+ import 'rj-editor/rendered-html'
96
+
97
+ export function Article({ html }: { html: string }) {
98
+ return <article dangerouslySetInnerHTML={{ __html: html }} />
99
+ }
100
+ ```
101
+
102
+ This helper does not mount the editor. It only registers the delegated copy handler for exported code blocks. If you sanitize saved HTML before rendering it, keep the exported `style`, `data-rj-editor-code-block`, `data-rj-editor-code-copy`, and `data-rj-editor-code-content` attributes if you want the built-in rendered styles and copy controls to remain active. The `onclick` attribute is optional when the helper is imported.
95
103
 
96
104
  Only render trusted or sanitized HTML. Sanitize untrusted user-provided HTML before passing it to `dangerouslySetInnerHTML`.
97
105
 
@@ -230,7 +238,8 @@ Important details:
230
238
  - Maximum image size is `5MB`.
231
239
  - If `onUpload` is not provided, base64 fallback keeps local/demo usage working.
232
240
  - `onUpload` is used for image insert, paste, drop, and replace actions.
233
- - While the upload promise is pending, the relevant image controls show loading and are disabled.
241
+ - While the upload promise is pending, image controls show loading and are disabled, including uploads started by clipboard paste and drag-and-drop.
242
+ - Duplicate clipboard file entries are de-duplicated before insertion and active uploads for the same file share one promise.
234
243
  - If the upload promise rejects, the image is not inserted/replaced and the editor shows the localized upload error.
235
244
 
236
245
  Upload example:
@@ -296,7 +305,7 @@ Available table tools:
296
305
  - set vertical alignment;
297
306
  - delete table.
298
307
 
299
- Exported tables include inline border, header background, selected-cell cleanup, and rounded corner styles. The exported table palette follows the active editor theme so tables rendered with `dangerouslySetInnerHTML` match the light or dark editor output.
308
+ Exported tables include inline border, header background, selected-cell cleanup, and rounded corner styles. The exported table palette uses neutral translucent colors so saved tables remain readable when the consuming page switches between light and dark mode.
300
309
 
301
310
  ## Links
302
311