rj-editor 1.2.0 → 1.3.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.
- package/README.md +35 -3
- package/dist/LexicalCodePrism.prod-aiocbvfq.js +1416 -0
- package/dist/components/code-block/actions/code-block-action/CodeBlockAction.d.ts +3 -1
- package/dist/components/rj-text-editor/createInitialConfig.d.ts +6 -2
- package/dist/nodes/ExtendedCodeNode.d.ts +29 -0
- package/dist/nodes/index.d.ts +1 -0
- package/dist/plugins/CodeCompletionPlugin.d.ts +1 -0
- package/dist/plugins/CodeHighlightPlugin.d.ts +1 -0
- package/dist/plugins/InlineCodeStylePlugin.d.ts +1 -0
- package/dist/prism-2TqtsDnJ.js +1917 -0
- package/dist/prism-bash-HogikaHd.js +175 -0
- package/dist/prism-docker-DI1lriSm.js +75 -0
- package/dist/prism-json-CPmaNewv.js +25 -0
- package/dist/prism-jsx-DCSoxYIa.js +46 -0
- package/dist/prism-tsx-BRUTQfCu.js +8 -0
- package/dist/prism-yaml-D6c5M_c9.js +68 -0
- package/dist/rj-editor.css +1 -1
- package/dist/rj-editor.js +2654 -2566
- package/dist/rj-editor.umd.cjs +12 -4
- package/dist/types/InsertCodeBlockPayload.d.ts +1 -0
- package/dist/types/RJEditorTranslations.d.ts +1 -0
- package/dist/utils/helpers/normalizePastedCodeBlockHtml.d.ts +1 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ It provides a ready-to-use `RJTextEditor` component with a tabbed toolbar, text
|
|
|
12
12
|
- Style controls: font size, font family, text color, background color, clear formatting.
|
|
13
13
|
- Paragraph tools: alignment, ordered list, unordered list, indent, outdent, line and paragraph spacing.
|
|
14
14
|
- Insert tools: table, link, image, YouTube video, and editable code blocks.
|
|
15
|
-
- Code blocks: editable code blocks, language selection, and persistent copy controls in both the editor and rendered HTML.
|
|
15
|
+
- Code blocks: editable code blocks, custom headers, language selection, syntax highlighting, lightweight completions, and persistent copy controls in both the editor and rendered HTML.
|
|
16
16
|
- Table editing: add/remove rows and columns, merge/split cells, header row/column, cell background, vertical alignment, delete table.
|
|
17
17
|
- Image editing: upload, drag-and-drop, paste from clipboard, resize, align, alt text, caption, link, border, border radius, shadow, object fit, wrapping, rotate, replace, delete.
|
|
18
18
|
- Browser fullscreen mode.
|
|
@@ -87,7 +87,11 @@ export function Article({ html }: { html: string }) {
|
|
|
87
87
|
}
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Exported
|
|
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.
|
|
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`.
|
|
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.
|
|
91
95
|
|
|
92
96
|
Only render trusted or sanitized HTML. Sanitize untrusted user-provided HTML before passing it to `dangerouslySetInnerHTML`.
|
|
93
97
|
|
|
@@ -292,6 +296,8 @@ Available table tools:
|
|
|
292
296
|
- set vertical alignment;
|
|
293
297
|
- delete table.
|
|
294
298
|
|
|
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.
|
|
300
|
+
|
|
295
301
|
## Links
|
|
296
302
|
|
|
297
303
|
Links are created with a custom modal. The modal supports URL and display text fields and works correctly in fullscreen mode.
|
|
@@ -305,11 +311,20 @@ Paste a YouTube URL from the `Insert` tab to add an embedded video. The editor c
|
|
|
305
311
|
Insert a code block from the `Insert` tab. Code blocks support:
|
|
306
312
|
|
|
307
313
|
- direct editing inside the document;
|
|
308
|
-
-
|
|
314
|
+
- a custom header/title, for example `package.json`, `Terminal`, or `npm`;
|
|
315
|
+
- searchable language selection with presets such as Plain Text, Terminal, JSON, Bash, Shell, PNPM, NPM, Yarn, Bun, JavaScript, JSX, TypeScript, TSX, HTML, CSS, YAML, Dockerfile, SQL, Python, Rust, and more;
|
|
316
|
+
- syntax highlighting when a Prism grammar is available;
|
|
317
|
+
- Bash-style highlighting aliases for Terminal, Shell, PNPM, NPM, Yarn, and Bun;
|
|
318
|
+
- lightweight code completions for supported languages and command snippets;
|
|
309
319
|
- a copy button that remains visible when the block is not focused;
|
|
310
320
|
- a persistent copy button in exported HTML rendered with `dangerouslySetInnerHTML`;
|
|
321
|
+
- normalized paste handling for common documentation code panels, including tabbed package-manager examples;
|
|
311
322
|
- HTML round trips through `value` and `defaultValue` without copying toolbar controls into the editable content.
|
|
312
323
|
|
|
324
|
+
The code block header title is independent from the selected language. Use the title for the label users should see, and use the language selector for syntax highlighting and completions.
|
|
325
|
+
|
|
326
|
+
Completions appear while typing inside a code block. Use `ArrowUp` and `ArrowDown` to move through suggestions, `Enter` or `Tab` to apply one, and `Escape` to close the menu.
|
|
327
|
+
|
|
313
328
|
## Fullscreen
|
|
314
329
|
|
|
315
330
|
The fullscreen button uses the browser Fullscreen API. The editor is opened in real fullscreen mode, not only enlarged with CSS.
|
|
@@ -447,7 +462,24 @@ Common variables:
|
|
|
447
462
|
| `--rj-editor-warning-border` | Validation warning border color. |
|
|
448
463
|
| `--rj-editor-table-border` | Table border color. |
|
|
449
464
|
| `--rj-editor-table-header-bg` | Table header background. |
|
|
465
|
+
| `--rj-editor-table-selected-bg` | Selected table cell background. |
|
|
466
|
+
| `--rj-editor-inline-code-bg` | Inline code background. |
|
|
467
|
+
| `--rj-editor-inline-code-border` | Inline code border color. |
|
|
468
|
+
| `--rj-editor-inline-code-text` | Inline code text color. |
|
|
469
|
+
| `--rj-editor-code-bg` | Code block background. |
|
|
470
|
+
| `--rj-editor-code-header-bg` | Code block header background. |
|
|
471
|
+
| `--rj-editor-code-border` | Code block border and scrollbar color. |
|
|
472
|
+
| `--rj-editor-code-text` | Code block base text color. |
|
|
473
|
+
| `--rj-editor-code-muted` | Code block header and muted text color. |
|
|
474
|
+
| `--rj-editor-code-keyword` | Code token keyword color. |
|
|
475
|
+
| `--rj-editor-code-string` | Code token string color. |
|
|
476
|
+
| `--rj-editor-code-number` | Code token number color. |
|
|
477
|
+
| `--rj-editor-code-comment` | Code token comment color. |
|
|
478
|
+
| `--rj-editor-code-function` | Code token function/class color. |
|
|
479
|
+
| `--rj-editor-code-operator` | Code token operator/property/punctuation color. |
|
|
480
|
+
| `--rj-editor-code-tag` | Code token tag/deleted color. |
|
|
450
481
|
| `--rj-editor-image-border` | Image selection border color. |
|
|
482
|
+
| `--rj-editor-image-shadow` | Image shadow value. |
|
|
451
483
|
| `--rj-editor-danger` | Dangerous action color. |
|
|
452
484
|
|
|
453
485
|
Override only the dark theme by targeting the editor theme attribute:
|