@byline/richtext-lexical 1.8.2 → 1.9.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/dist/richtext-field.d.ts +17 -1
- package/dist/richtext-field.js +5 -2
- package/dist/server.d.ts +2 -0
- package/dist/server.js +1 -0
- package/package.json +8 -4
- package/src/richtext-field.tsx +22 -0
- package/src/server.ts +8 -0
package/dist/richtext-field.d.ts
CHANGED
|
@@ -19,6 +19,22 @@ interface Props {
|
|
|
19
19
|
path?: string;
|
|
20
20
|
/** When provided, renders a LocaleBadge next to the field label. */
|
|
21
21
|
locale?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Feature nodes rendered **before** the editor surface (inside the
|
|
24
|
+
* `LexicalComposer` tree, so plugins can use `useLexicalComposerContext`).
|
|
25
|
+
* Use for plugins like AI assistants that need editor access.
|
|
26
|
+
*/
|
|
27
|
+
featureBeforeEditor?: React.ReactNode[];
|
|
28
|
+
/**
|
|
29
|
+
* Feature nodes rendered **after** the editor surface. Same composer
|
|
30
|
+
* context as `featureBeforeEditor`.
|
|
31
|
+
*/
|
|
32
|
+
featureAfterEditor?: React.ReactNode[];
|
|
33
|
+
/**
|
|
34
|
+
* Feature nodes rendered as additional composer children — e.g. plugins
|
|
35
|
+
* that need to register commands or listeners without rendering UI.
|
|
36
|
+
*/
|
|
37
|
+
featureChildren?: React.ReactNode[];
|
|
22
38
|
}
|
|
23
|
-
export declare const RichTextField: ({ field, value, defaultValue, editorConfig, readonly, instanceKey, onChange, path, locale, }: Props) => React.JSX.Element;
|
|
39
|
+
export declare const RichTextField: ({ field, value, defaultValue, editorConfig, readonly, instanceKey, onChange, path, locale, featureBeforeEditor, featureAfterEditor, featureChildren, }: Props) => React.JSX.Element;
|
|
24
40
|
export {};
|
package/dist/richtext-field.js
CHANGED
|
@@ -4,7 +4,7 @@ import classnames from "classnames";
|
|
|
4
4
|
import { defaultEditorConfig } from "./field/config/default.js";
|
|
5
5
|
import { EditorField } from "./field/editor-field.js";
|
|
6
6
|
import richtext_field_module from "./richtext-field.module.js";
|
|
7
|
-
const RichTextField = ({ field, value, defaultValue, editorConfig, readonly = false, instanceKey, onChange, path, locale })=>{
|
|
7
|
+
const RichTextField = ({ field, value, defaultValue, editorConfig, readonly = false, instanceKey, onChange, path, locale, featureBeforeEditor, featureAfterEditor, featureChildren })=>{
|
|
8
8
|
const fieldPath = path ?? field.name;
|
|
9
9
|
const fieldError = useFieldError(fieldPath);
|
|
10
10
|
const fieldValue = useFieldValue(fieldPath);
|
|
@@ -48,7 +48,10 @@ const RichTextField = ({ field, value, defaultValue, editorConfig, readonly = fa
|
|
|
48
48
|
label: labelNode,
|
|
49
49
|
required: !field.optional,
|
|
50
50
|
value: incomingValue,
|
|
51
|
-
defaultValue: incomingDefault
|
|
51
|
+
defaultValue: incomingDefault,
|
|
52
|
+
featureBeforeEditor: featureBeforeEditor,
|
|
53
|
+
featureAfterEditor: featureAfterEditor,
|
|
54
|
+
featureChildren: featureChildren
|
|
52
55
|
}, fieldId),
|
|
53
56
|
fieldError && /*#__PURE__*/ jsx(ErrorText, {
|
|
54
57
|
id: `${field.name}-error`,
|
package/dist/server.d.ts
CHANGED
|
@@ -28,8 +28,10 @@
|
|
|
28
28
|
import type { BylineClient } from '@byline/client';
|
|
29
29
|
import type { RichTextPopulateFn } from '@byline/core';
|
|
30
30
|
import { type LexicalNodeVisitor } from './field/lexical-populate-shared';
|
|
31
|
+
export { defaultEditorConfig } from './field/config/default';
|
|
31
32
|
export { inlineImageVisitor } from './field/plugins/inline-image-plugin/populate';
|
|
32
33
|
export { linkVisitor } from './field/plugins/link-plugin/populate';
|
|
34
|
+
export type { EditorConfig, EditorSettings, EditorSettingsOverride } from './field/config/types';
|
|
33
35
|
export type { LexicalNodeLike, LexicalNodeVisitor, PendingHydration, } from './field/lexical-populate-shared';
|
|
34
36
|
export interface LexicalServerOptions {
|
|
35
37
|
/**
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.9.0",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
"main": "./dist/index.js",
|
|
43
43
|
"default": "./dist/index.js"
|
|
44
44
|
},
|
|
45
|
+
"./toolbar-extensions": {
|
|
46
|
+
"types": "./dist/field/toolbar-extensions.d.ts",
|
|
47
|
+
"import": "./dist/field/toolbar-extensions.js"
|
|
48
|
+
},
|
|
45
49
|
"./server": {
|
|
46
50
|
"types": "./dist/server.d.ts",
|
|
47
51
|
"import": "./dist/server.js",
|
|
@@ -71,9 +75,9 @@
|
|
|
71
75
|
"npm-run-all": "^4.1.5",
|
|
72
76
|
"prism-react-renderer": "^2.4.1",
|
|
73
77
|
"react-error-boundary": "^6.1.1",
|
|
74
|
-
"@byline/
|
|
75
|
-
"@byline/
|
|
76
|
-
"@byline/
|
|
78
|
+
"@byline/core": "1.9.0",
|
|
79
|
+
"@byline/ui": "1.9.0",
|
|
80
|
+
"@byline/client": "1.9.0"
|
|
77
81
|
},
|
|
78
82
|
"peerDependencies": {
|
|
79
83
|
"react": "^19.0.0",
|
package/src/richtext-field.tsx
CHANGED
|
@@ -28,6 +28,22 @@ interface Props {
|
|
|
28
28
|
path?: string
|
|
29
29
|
/** When provided, renders a LocaleBadge next to the field label. */
|
|
30
30
|
locale?: string
|
|
31
|
+
/**
|
|
32
|
+
* Feature nodes rendered **before** the editor surface (inside the
|
|
33
|
+
* `LexicalComposer` tree, so plugins can use `useLexicalComposerContext`).
|
|
34
|
+
* Use for plugins like AI assistants that need editor access.
|
|
35
|
+
*/
|
|
36
|
+
featureBeforeEditor?: React.ReactNode[]
|
|
37
|
+
/**
|
|
38
|
+
* Feature nodes rendered **after** the editor surface. Same composer
|
|
39
|
+
* context as `featureBeforeEditor`.
|
|
40
|
+
*/
|
|
41
|
+
featureAfterEditor?: React.ReactNode[]
|
|
42
|
+
/**
|
|
43
|
+
* Feature nodes rendered as additional composer children — e.g. plugins
|
|
44
|
+
* that need to register commands or listeners without rendering UI.
|
|
45
|
+
*/
|
|
46
|
+
featureChildren?: React.ReactNode[]
|
|
31
47
|
}
|
|
32
48
|
|
|
33
49
|
export const RichTextField = ({
|
|
@@ -40,6 +56,9 @@ export const RichTextField = ({
|
|
|
40
56
|
onChange,
|
|
41
57
|
path,
|
|
42
58
|
locale,
|
|
59
|
+
featureBeforeEditor,
|
|
60
|
+
featureAfterEditor,
|
|
61
|
+
featureChildren,
|
|
43
62
|
}: Props) => {
|
|
44
63
|
const fieldPath = path ?? field.name
|
|
45
64
|
const fieldError = useFieldError(fieldPath)
|
|
@@ -102,6 +121,9 @@ export const RichTextField = ({
|
|
|
102
121
|
required={!field.optional}
|
|
103
122
|
value={incomingValue}
|
|
104
123
|
defaultValue={incomingDefault}
|
|
124
|
+
featureBeforeEditor={featureBeforeEditor}
|
|
125
|
+
featureAfterEditor={featureAfterEditor}
|
|
126
|
+
featureChildren={featureChildren}
|
|
105
127
|
// Ensure React fully remounts when instanceKey changes
|
|
106
128
|
key={fieldId}
|
|
107
129
|
/>
|
package/src/server.ts
CHANGED
|
@@ -34,8 +34,16 @@ import { type LexicalNodeVisitor, runLexicalPopulate } from './field/lexical-pop
|
|
|
34
34
|
import { inlineImageVisitor } from './field/plugins/inline-image-plugin/populate'
|
|
35
35
|
import { linkVisitor } from './field/plugins/link-plugin/populate'
|
|
36
36
|
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Schema-data re-exports — data-only Lexical config that's safe to evaluate
|
|
39
|
+
// outside Vite (e.g. tsx-loaded seeds). Importing these from the root barrel
|
|
40
|
+
// (`@byline/richtext-lexical`) drags in `RichTextField` / `EditorField` and
|
|
41
|
+
// their CSS imports; the `/server` subpath stays React-free.
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
export { defaultEditorConfig } from './field/config/default'
|
|
37
44
|
export { inlineImageVisitor } from './field/plugins/inline-image-plugin/populate'
|
|
38
45
|
export { linkVisitor } from './field/plugins/link-plugin/populate'
|
|
46
|
+
export type { EditorConfig, EditorSettings, EditorSettingsOverride } from './field/config/types'
|
|
39
47
|
export type {
|
|
40
48
|
LexicalNodeLike,
|
|
41
49
|
LexicalNodeVisitor,
|