robobyte-front-builder 1.0.2 → 1.0.3
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/package.json
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { useRef } from 'react'
|
|
2
|
-
import
|
|
3
|
-
import 'suneditor/dist/css/suneditor.min.css'
|
|
2
|
+
import dynamic from 'next/dynamic'
|
|
4
3
|
import { Box, FormHelperText } from '@mui/material'
|
|
5
4
|
import ViewerComponentWrapper from '../ViewerComponentWrapper'
|
|
6
5
|
import { resolveProps } from 'services/builderHelper/resolveProps'
|
|
7
6
|
|
|
7
|
+
// SunEditor requires the DOM and loads suneditor/src/plugins at require-time,
|
|
8
|
+
// which is raw ESM with bare specifiers. Node.js 22's strict ESM resolver
|
|
9
|
+
// cannot resolve those extensionless imports at SSR, causing a fatal error.
|
|
10
|
+
// Dynamic import with ssr:false keeps the entire module out of the server bundle.
|
|
11
|
+
const SunEditor = dynamic(
|
|
12
|
+
() => {
|
|
13
|
+
// Import the CSS alongside the component so it's only loaded client-side too.
|
|
14
|
+
// Using require() inside the factory avoids a separate async CSS chunk.
|
|
15
|
+
require('suneditor/dist/css/suneditor.min.css')
|
|
16
|
+
return import('suneditor-react')
|
|
17
|
+
},
|
|
18
|
+
{ ssr: false }
|
|
19
|
+
)
|
|
20
|
+
|
|
8
21
|
export default function RichTextRenderer({ node, viewerContext }) {
|
|
9
22
|
const { data, form, updateFormValue, validationErrors } = viewerContext
|
|
10
23
|
const main = resolveProps(node, 'main', { form, data })
|
|
@@ -52,7 +65,7 @@ export default function RichTextRenderer({ node, viewerContext }) {
|
|
|
52
65
|
height: main.height || '300px',
|
|
53
66
|
placeholder: main.placeholder || 'Enter text here...',
|
|
54
67
|
disabled: main.disabled,
|
|
55
|
-
mode: main.mode || 'classic',
|
|
68
|
+
mode: main.mode || 'classic',
|
|
56
69
|
resizingBar: main.resizingBar !== false,
|
|
57
70
|
showPathLabel: main.showPathLabel !== false,
|
|
58
71
|
charCounter: main.charCounter !== false,
|