@byline/richtext-lexical 3.11.3 → 3.12.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/dist/field/editor-field.js +2 -6
- package/dist/field/editor-placeholder.d.ts +20 -0
- package/dist/field/editor-placeholder.js +39 -0
- package/dist/lexical-editor.js +8 -15
- package/package.json +5 -5
- package/src/field/editor-field.tsx +2 -3
- package/src/field/editor-placeholder.tsx +43 -0
- package/src/lexical-editor.tsx +14 -19
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Suspense, lazy } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { EditorPlaceholder } from "./editor-placeholder.js";
|
|
5
5
|
const EditorComponent = /*#__PURE__*/ lazy(()=>import("./editor-component.js").then((module)=>({
|
|
6
6
|
default: module.EditorComponent
|
|
7
7
|
})));
|
|
8
8
|
function EditorField(props) {
|
|
9
9
|
return /*#__PURE__*/ jsx(Suspense, {
|
|
10
|
-
fallback: /*#__PURE__*/ jsx(
|
|
11
|
-
variant: "text",
|
|
12
|
-
lines: 20,
|
|
13
|
-
lineHeight: "1.15rem"
|
|
14
|
-
}),
|
|
10
|
+
fallback: /*#__PURE__*/ jsx(EditorPlaceholder, {}),
|
|
15
11
|
children: /*#__PURE__*/ jsx(EditorComponent, {
|
|
16
12
|
...props
|
|
17
13
|
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
import type React from 'react';
|
|
9
|
+
/**
|
|
10
|
+
* Skeleton shown while the editor module graph is loading. Composes the
|
|
11
|
+
* `Shimmer` primitive into a document-shaped layout — a heading, a couple
|
|
12
|
+
* of paragraphs, an inset image, a sub-heading, then more text — so the
|
|
13
|
+
* placeholder reads as document-shaped content rather than a flat stack of
|
|
14
|
+
* identical rows.
|
|
15
|
+
*
|
|
16
|
+
* Shared by both the outer `lexicalEditor()` Suspense fallback (while the
|
|
17
|
+
* editor's lazy module graph loads) and the inner `EditorField` Suspense
|
|
18
|
+
* fallback, so the visible cold-load sequence stays consistent throughout.
|
|
19
|
+
*/
|
|
20
|
+
export declare function EditorPlaceholder(): React.JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Shimmer } from "@byline/ui/react";
|
|
3
|
+
function EditorPlaceholder() {
|
|
4
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
5
|
+
style: {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
flexDirection: 'column',
|
|
8
|
+
gap: '1.25rem'
|
|
9
|
+
},
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ jsx(Shimmer, {
|
|
12
|
+
variant: "rectangular",
|
|
13
|
+
width: "60%",
|
|
14
|
+
height: "1.75rem"
|
|
15
|
+
}),
|
|
16
|
+
/*#__PURE__*/ jsx(Shimmer, {
|
|
17
|
+
variant: "text",
|
|
18
|
+
lines: 4,
|
|
19
|
+
lineHeight: "1.15rem"
|
|
20
|
+
}),
|
|
21
|
+
/*#__PURE__*/ jsx(Shimmer, {
|
|
22
|
+
variant: "rectangular",
|
|
23
|
+
width: "100%",
|
|
24
|
+
height: "12rem"
|
|
25
|
+
}),
|
|
26
|
+
/*#__PURE__*/ jsx(Shimmer, {
|
|
27
|
+
variant: "rectangular",
|
|
28
|
+
width: "40%",
|
|
29
|
+
height: "1.35rem"
|
|
30
|
+
}),
|
|
31
|
+
/*#__PURE__*/ jsx(Shimmer, {
|
|
32
|
+
variant: "text",
|
|
33
|
+
lines: 6,
|
|
34
|
+
lineHeight: "1.15rem"
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export { EditorPlaceholder };
|
package/dist/lexical-editor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense, lazy } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { EditorPlaceholder } from "./field/editor-placeholder.js";
|
|
4
4
|
let editorBundlePromise = null;
|
|
5
5
|
function loadEditorBundle() {
|
|
6
6
|
if (!editorBundlePromise) editorBundlePromise = (async ()=>{
|
|
@@ -39,24 +39,17 @@ function lexicalEditor(configure) {
|
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
41
|
const ConfiguredEditor = (props)=>/*#__PURE__*/ jsx(Suspense, {
|
|
42
|
-
fallback: /*#__PURE__*/ jsx(
|
|
42
|
+
fallback: /*#__PURE__*/ jsx("div", {
|
|
43
|
+
className: "byline-field-richtext",
|
|
44
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
45
|
+
className: "byline-field-richtext-body",
|
|
46
|
+
children: /*#__PURE__*/ jsx(EditorPlaceholder, {})
|
|
47
|
+
})
|
|
48
|
+
}),
|
|
43
49
|
children: /*#__PURE__*/ jsx(Lazy, {
|
|
44
50
|
...props
|
|
45
51
|
})
|
|
46
52
|
});
|
|
47
53
|
return ConfiguredEditor;
|
|
48
54
|
}
|
|
49
|
-
function EditorPlaceholder() {
|
|
50
|
-
return /*#__PURE__*/ jsx("div", {
|
|
51
|
-
className: "byline-field-richtext",
|
|
52
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
53
|
-
className: "byline-field-richtext-body",
|
|
54
|
-
children: /*#__PURE__*/ jsx(Shimmer, {
|
|
55
|
-
variant: "text",
|
|
56
|
-
lines: 20,
|
|
57
|
-
lineHeight: "1.15rem"
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
55
|
export { lexicalEditor };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.12.1",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=20.9.0"
|
|
9
9
|
},
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"npm-run-all": "^4.1.5",
|
|
78
78
|
"prism-react-renderer": "^2.4.1",
|
|
79
79
|
"react-error-boundary": "^6.1.1",
|
|
80
|
-
"@byline/
|
|
81
|
-
"@byline/
|
|
82
|
-
"@byline/
|
|
83
|
-
"@byline/ui": "3.
|
|
80
|
+
"@byline/core": "3.12.1",
|
|
81
|
+
"@byline/admin": "3.12.1",
|
|
82
|
+
"@byline/client": "3.12.1",
|
|
83
|
+
"@byline/ui": "3.12.1"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"react": "^19.0.0",
|
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
import type * as React from 'react'
|
|
35
35
|
import { lazy, Suspense } from 'react'
|
|
36
36
|
|
|
37
|
-
import {
|
|
38
|
-
|
|
37
|
+
import { EditorPlaceholder } from './editor-placeholder'
|
|
39
38
|
import type { EditorFieldProps } from '../types'
|
|
40
39
|
|
|
41
40
|
const EditorComponent = lazy(() =>
|
|
@@ -44,7 +43,7 @@ const EditorComponent = lazy(() =>
|
|
|
44
43
|
|
|
45
44
|
export function EditorField(props: EditorFieldProps): React.JSX.Element {
|
|
46
45
|
return (
|
|
47
|
-
<Suspense fallback={<
|
|
46
|
+
<Suspense fallback={<EditorPlaceholder />}>
|
|
48
47
|
<EditorComponent {...props} />
|
|
49
48
|
</Suspense>
|
|
50
49
|
)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type React from 'react'
|
|
10
|
+
|
|
11
|
+
import { Shimmer } from '@byline/ui/react'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Skeleton shown while the editor module graph is loading. Composes the
|
|
15
|
+
* `Shimmer` primitive into a document-shaped layout — a heading, a couple
|
|
16
|
+
* of paragraphs, an inset image, a sub-heading, then more text — so the
|
|
17
|
+
* placeholder reads as document-shaped content rather than a flat stack of
|
|
18
|
+
* identical rows.
|
|
19
|
+
*
|
|
20
|
+
* Shared by both the outer `lexicalEditor()` Suspense fallback (while the
|
|
21
|
+
* editor's lazy module graph loads) and the inner `EditorField` Suspense
|
|
22
|
+
* fallback, so the visible cold-load sequence stays consistent throughout.
|
|
23
|
+
*/
|
|
24
|
+
export function EditorPlaceholder(): React.JSX.Element {
|
|
25
|
+
return (
|
|
26
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1.25rem' }}>
|
|
27
|
+
{/* Heading (h1) */}
|
|
28
|
+
<Shimmer variant="rectangular" width="60%" height="1.75rem" />
|
|
29
|
+
|
|
30
|
+
{/* Opening paragraph */}
|
|
31
|
+
<Shimmer variant="text" lines={4} lineHeight="1.15rem" />
|
|
32
|
+
|
|
33
|
+
{/* Inset image / media block */}
|
|
34
|
+
<Shimmer variant="rectangular" width="100%" height="12rem" />
|
|
35
|
+
|
|
36
|
+
{/* Sub-heading (h2) */}
|
|
37
|
+
<Shimmer variant="rectangular" width="40%" height="1.35rem" />
|
|
38
|
+
|
|
39
|
+
{/* Closing paragraphs */}
|
|
40
|
+
<Shimmer variant="text" lines={6} lineHeight="1.15rem" />
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
package/src/lexical-editor.tsx
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
import { lazy, Suspense } from 'react'
|
|
10
10
|
|
|
11
11
|
import type { RichTextEditorComponent } from '@byline/core'
|
|
12
|
-
import { Shimmer } from '@byline/ui/react'
|
|
13
12
|
|
|
13
|
+
import { EditorPlaceholder } from './field/editor-placeholder'
|
|
14
14
|
import type { ExtensionsList } from './field/config/extensions-list'
|
|
15
15
|
import type { EditorConfig } from './field/config/types'
|
|
16
16
|
|
|
@@ -129,26 +129,21 @@ export function lexicalEditor(configure?: ConfigureFn): RichTextEditorComponent
|
|
|
129
129
|
})
|
|
130
130
|
|
|
131
131
|
const ConfiguredEditor: RichTextEditorComponent = (props) => (
|
|
132
|
-
<Suspense
|
|
132
|
+
<Suspense
|
|
133
|
+
fallback={
|
|
134
|
+
// Mirror the `byline-field-richtext` / `byline-field-richtext-body`
|
|
135
|
+
// shell that `RichTextField` renders so the visible cold-load
|
|
136
|
+
// sequence is just "shimmer → editor" instead of
|
|
137
|
+
// "blank → shimmer → editor".
|
|
138
|
+
<div className="byline-field-richtext">
|
|
139
|
+
<div className="byline-field-richtext-body">
|
|
140
|
+
<EditorPlaceholder />
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
}
|
|
144
|
+
>
|
|
133
145
|
<Lazy {...(props as object)} />
|
|
134
146
|
</Suspense>
|
|
135
147
|
)
|
|
136
148
|
return ConfiguredEditor
|
|
137
149
|
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Skeleton shown while the editor module graph is loading. Mirrors the
|
|
141
|
-
* `byline-field-richtext` / `byline-field-richtext-body` shell that
|
|
142
|
-
* `RichTextField` renders, and reuses the same `Shimmer` placeholder the
|
|
143
|
-
* inner `EditorField` Suspense uses — so the visible cold-load sequence
|
|
144
|
-
* is just "shimmer → editor" instead of "blank → shimmer → editor".
|
|
145
|
-
*/
|
|
146
|
-
function EditorPlaceholder() {
|
|
147
|
-
return (
|
|
148
|
-
<div className="byline-field-richtext">
|
|
149
|
-
<div className="byline-field-richtext-body">
|
|
150
|
-
<Shimmer variant="text" lines={20} lineHeight="1.15rem" />
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
)
|
|
154
|
-
}
|