@pexelize/react-editor 2.1.4 → 2.1.6
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/index.d.ts +1 -62
- package/dist/index.esm.js +120 -89
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +119 -88
- package/dist/index.js.map +1 -1
- package/package.json +88 -88
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Pexelize React Editor Types
|
|
5
|
+
* Minimal type definitions for the React wrapper
|
|
5
6
|
*/
|
|
6
7
|
type EditorMode = "email" | "web" | "popup" | "document";
|
|
7
8
|
type ThemeMode = "light" | "dark" | "auto" | "pexelize-light" | "pexelize-dark";
|
|
@@ -95,64 +96,10 @@ interface SpecialLinkGroup {
|
|
|
95
96
|
name: string;
|
|
96
97
|
specialLinks: SpecialLink[];
|
|
97
98
|
}
|
|
98
|
-
interface ModulesTabConfig {
|
|
99
|
-
/** Rows accordion configuration */
|
|
100
|
-
rows?: {
|
|
101
|
-
visible?: boolean;
|
|
102
|
-
defaultExpanded?: boolean;
|
|
103
|
-
};
|
|
104
|
-
/** Saved modules accordion configuration */
|
|
105
|
-
savedModules?: {
|
|
106
|
-
visible?: boolean;
|
|
107
|
-
defaultExpanded?: boolean;
|
|
108
|
-
/** Title for the saved modules accordion (default: "Saved Modules") */
|
|
109
|
-
title?: string;
|
|
110
|
-
};
|
|
111
|
-
/** Custom tabs configuration */
|
|
112
|
-
customTabs?: Array<{
|
|
113
|
-
id: string;
|
|
114
|
-
title: string;
|
|
115
|
-
icon?: string;
|
|
116
|
-
defaultExpanded?: boolean;
|
|
117
|
-
items?: Array<{
|
|
118
|
-
id: string;
|
|
119
|
-
name: string;
|
|
120
|
-
thumbnail?: string;
|
|
121
|
-
data?: Record<string, unknown>;
|
|
122
|
-
}>;
|
|
123
|
-
}>;
|
|
124
|
-
}
|
|
125
|
-
interface StylesTabConfig {
|
|
126
|
-
general?: {
|
|
127
|
-
visible?: boolean;
|
|
128
|
-
defaultExpanded?: boolean;
|
|
129
|
-
};
|
|
130
|
-
fonts?: {
|
|
131
|
-
visible?: boolean;
|
|
132
|
-
defaultExpanded?: boolean;
|
|
133
|
-
};
|
|
134
|
-
contentAlignment?: {
|
|
135
|
-
visible?: boolean;
|
|
136
|
-
defaultExpanded?: boolean;
|
|
137
|
-
};
|
|
138
|
-
backgroundImage?: {
|
|
139
|
-
visible?: boolean;
|
|
140
|
-
defaultExpanded?: boolean;
|
|
141
|
-
};
|
|
142
|
-
linkStyles?: {
|
|
143
|
-
visible?: boolean;
|
|
144
|
-
defaultExpanded?: boolean;
|
|
145
|
-
};
|
|
146
|
-
preheader?: {
|
|
147
|
-
visible?: boolean;
|
|
148
|
-
defaultExpanded?: boolean;
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
99
|
interface AppearanceConfig {
|
|
152
100
|
theme?: ThemeMode | object;
|
|
153
101
|
accentColor?: string;
|
|
154
102
|
sidePanel?: {
|
|
155
|
-
/** Main tab visibility */
|
|
156
103
|
tabs?: {
|
|
157
104
|
content?: {
|
|
158
105
|
visible?: boolean;
|
|
@@ -164,15 +111,8 @@ interface AppearanceConfig {
|
|
|
164
111
|
visible?: boolean;
|
|
165
112
|
};
|
|
166
113
|
};
|
|
167
|
-
/** Modules tab configuration */
|
|
168
|
-
modulesTab?: ModulesTabConfig;
|
|
169
|
-
/** Styles tab configuration */
|
|
170
|
-
stylesTab?: StylesTabConfig;
|
|
171
|
-
/** Panel position: 'left' or 'right' (default: 'right') */
|
|
172
114
|
dock?: "left" | "right";
|
|
173
|
-
/** Panel width in pixels (default: 380) */
|
|
174
115
|
width?: number;
|
|
175
|
-
/** Whether panel can be collapsed (default: false) */
|
|
176
116
|
collapsible?: boolean;
|
|
177
117
|
};
|
|
178
118
|
}
|
|
@@ -321,7 +261,6 @@ interface PexelizeSDK {
|
|
|
321
261
|
declare global {
|
|
322
262
|
interface Window {
|
|
323
263
|
pexelize?: PexelizeSDK;
|
|
324
|
-
createEditor?: () => PexelizeSDK;
|
|
325
264
|
}
|
|
326
265
|
}
|
|
327
266
|
interface PexelizeEditorRef {
|
package/dist/index.esm.js
CHANGED
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useRef,
|
|
2
|
+
import { forwardRef, useRef, useState, useMemo, useEffect, useImperativeHandle } from 'react';
|
|
3
3
|
|
|
4
4
|
const SDK_CDN_URL = "https://sdk.pexelize.com/latest/pexelize-sdk.min.js";
|
|
5
5
|
let sdkLoadPromise = null;
|
|
6
|
-
|
|
7
|
-
* Load the SDK script (only once across all components).
|
|
8
|
-
* After loading, window.createEditor will be available.
|
|
9
|
-
*/
|
|
10
|
-
function loadSDKScript() {
|
|
6
|
+
function loadSDK() {
|
|
11
7
|
if (sdkLoadPromise)
|
|
12
8
|
return sdkLoadPromise;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return Promise.resolve(
|
|
9
|
+
if (typeof window !== "undefined" && window.pexelize) {
|
|
10
|
+
// Return the SDK module with createEditor function
|
|
11
|
+
return Promise.resolve({
|
|
12
|
+
pexelize: window.pexelize,
|
|
13
|
+
createEditor: (config) => {
|
|
14
|
+
const instance = new window.pexelize.constructor();
|
|
15
|
+
instance.init(config);
|
|
16
|
+
return instance;
|
|
17
|
+
},
|
|
18
|
+
PexelizeSDK: window.pexelize.constructor,
|
|
19
|
+
});
|
|
16
20
|
}
|
|
17
21
|
sdkLoadPromise = new Promise((resolve, reject) => {
|
|
18
22
|
const script = document.createElement("script");
|
|
19
23
|
script.src = SDK_CDN_URL;
|
|
20
24
|
script.async = true;
|
|
21
25
|
script.onload = () => {
|
|
22
|
-
if (window.
|
|
23
|
-
|
|
26
|
+
if (window.pexelize) {
|
|
27
|
+
// Resolve with SDK module interface
|
|
28
|
+
resolve({
|
|
29
|
+
pexelize: window.pexelize,
|
|
30
|
+
createEditor: (config) => {
|
|
31
|
+
const instance = new window.pexelize.constructor();
|
|
32
|
+
instance.init(config);
|
|
33
|
+
return instance;
|
|
34
|
+
},
|
|
35
|
+
PexelizeSDK: window.pexelize.constructor,
|
|
36
|
+
});
|
|
24
37
|
}
|
|
25
38
|
else {
|
|
26
39
|
sdkLoadPromise = null;
|
|
27
|
-
reject(new Error("Failed to load Pexelize SDK
|
|
40
|
+
reject(new Error("Failed to load Pexelize SDK"));
|
|
28
41
|
}
|
|
29
42
|
};
|
|
30
43
|
script.onerror = () => {
|
|
@@ -35,22 +48,15 @@ function loadSDKScript() {
|
|
|
35
48
|
});
|
|
36
49
|
return sdkLoadPromise;
|
|
37
50
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Create a new editor instance.
|
|
40
|
-
* Each component gets its own independent instance for multiple editors support.
|
|
41
|
-
*/
|
|
42
|
-
function createEditorInstance() {
|
|
43
|
-
if (!window.createEditor) {
|
|
44
|
-
throw new Error("Pexelize SDK not loaded - call loadSDKScript first");
|
|
45
|
-
}
|
|
46
|
-
return window.createEditor();
|
|
47
|
-
}
|
|
48
51
|
const PexelizeEditor = forwardRef((props, ref) => {
|
|
49
52
|
const { editorId, apiKey, templateId, design, editorMode, contentType, ai, height, options = {}, className, style, minHeight = "600px", onReady, onLoad, onChange, onError, } = props;
|
|
50
53
|
const containerRef = useRef(null);
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
+
const [editor, setEditor] = useState(null);
|
|
55
|
+
const [hasLoadedSDK, setHasLoadedSDK] = useState(false);
|
|
56
|
+
const [isEditorReady, setIsEditorReady] = useState(false);
|
|
57
|
+
// Stable container ID using useMemo
|
|
58
|
+
const containerId = useMemo(() => `pexelize-editor-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
59
|
+
// Refs for callbacks to avoid dependency issues
|
|
54
60
|
const onReadyRef = useRef(onReady);
|
|
55
61
|
const onLoadRef = useRef(onLoad);
|
|
56
62
|
const onChangeRef = useRef(onChange);
|
|
@@ -67,83 +73,108 @@ const PexelizeEditor = forwardRef((props, ref) => {
|
|
|
67
73
|
useEffect(() => {
|
|
68
74
|
onErrorRef.current = onError;
|
|
69
75
|
}, [onError]);
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
// Build options object (memoized for comparison)
|
|
77
|
+
const editorOptions = useMemo(() => {
|
|
78
|
+
const editorConfig = contentType === "module"
|
|
79
|
+
? { ...options.editor, contentType, minRows: 1, maxRows: 1 }
|
|
80
|
+
: options.editor;
|
|
81
|
+
return {
|
|
82
|
+
containerId,
|
|
83
|
+
editorId,
|
|
84
|
+
apiKey,
|
|
85
|
+
...options,
|
|
86
|
+
...(templateId !== undefined && { templateId }),
|
|
87
|
+
...(design !== undefined && { design }),
|
|
88
|
+
...(editorMode !== undefined && { editorMode }),
|
|
89
|
+
...(ai !== undefined && { ai }),
|
|
90
|
+
...(editorConfig && { editor: editorConfig }),
|
|
91
|
+
};
|
|
92
|
+
}, [
|
|
93
|
+
containerId,
|
|
94
|
+
editorId,
|
|
95
|
+
apiKey,
|
|
96
|
+
templateId,
|
|
97
|
+
design,
|
|
98
|
+
editorMode,
|
|
99
|
+
ai,
|
|
100
|
+
contentType,
|
|
101
|
+
options,
|
|
102
|
+
]);
|
|
103
|
+
// 1. Cleanup effect - runs only on final unmount
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
return () => {
|
|
106
|
+
editor?.destroy();
|
|
107
|
+
};
|
|
108
|
+
}, []); // Empty deps - only runs on unmount
|
|
109
|
+
// 2. SDK loading effect
|
|
77
110
|
useEffect(() => {
|
|
78
|
-
|
|
111
|
+
setHasLoadedSDK(false);
|
|
112
|
+
loadSDK()
|
|
113
|
+
.then(() => setHasLoadedSDK(true))
|
|
114
|
+
.catch((err) => onErrorRef.current?.(err));
|
|
115
|
+
}, []); // Load SDK once
|
|
116
|
+
// 3. Editor creation effect - ONLY on core props change
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (!hasLoadedSDK || !containerRef.current)
|
|
79
119
|
return;
|
|
80
|
-
|
|
120
|
+
// KEY: Destroy previous editor BEFORE creating new one
|
|
121
|
+
editor?.destroy();
|
|
81
122
|
const initEditor = async () => {
|
|
82
123
|
try {
|
|
83
|
-
//
|
|
84
|
-
await
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
124
|
+
// Import createEditor for multiple instance support
|
|
125
|
+
const { createEditor } = await loadSDK();
|
|
126
|
+
// Create a new editor instance (not singleton)
|
|
127
|
+
const editorInstance = createEditor(editorOptions);
|
|
128
|
+
setEditor(editorInstance);
|
|
129
|
+
// Set up event listeners
|
|
130
|
+
const unsubscribeReady = editorInstance.addEventListener("editor:ready", () => {
|
|
131
|
+
setIsEditorReady(true);
|
|
132
|
+
onReadyRef.current?.(editorInstance);
|
|
133
|
+
});
|
|
134
|
+
const unsubscribeLoad = editorInstance.addEventListener("design:loaded", () => {
|
|
135
|
+
onLoadRef.current?.();
|
|
136
|
+
});
|
|
137
|
+
const unsubscribeChange = editorInstance.addEventListener("design:updated", (data) => {
|
|
138
|
+
onChangeRef.current?.(data);
|
|
139
|
+
});
|
|
140
|
+
// Cleanup listeners (but NOT the editor - that's handled in effect 1)
|
|
141
|
+
return () => {
|
|
142
|
+
unsubscribeReady();
|
|
143
|
+
unsubscribeLoad();
|
|
144
|
+
unsubscribeChange();
|
|
103
145
|
};
|
|
104
|
-
// Initialize THIS instance
|
|
105
|
-
editor.init(config);
|
|
106
|
-
// Subscribe to events on THIS instance
|
|
107
|
-
const unsubscribeReady = editor.addEventListener("editor:ready", handleReady);
|
|
108
|
-
eventUnsubscribersRef.current.push(unsubscribeReady);
|
|
109
|
-
const unsubscribeLoad = editor.addEventListener("design:loaded", () => onLoadRef.current?.());
|
|
110
|
-
eventUnsubscribersRef.current.push(unsubscribeLoad);
|
|
111
|
-
const unsubscribeChange = editor.addEventListener("design:updated", (data) => onChangeRef.current?.(data));
|
|
112
|
-
eventUnsubscribersRef.current.push(unsubscribeChange);
|
|
113
146
|
}
|
|
114
147
|
catch (err) {
|
|
115
|
-
if (!mounted)
|
|
116
|
-
return;
|
|
117
148
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
118
149
|
onErrorRef.current?.(error);
|
|
150
|
+
// Return empty cleanup function on error
|
|
151
|
+
return () => { };
|
|
119
152
|
}
|
|
120
153
|
};
|
|
121
154
|
initEditor();
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
};
|
|
142
|
-
}, [editorId, apiKey, handleReady]);
|
|
155
|
+
}, [
|
|
156
|
+
// Only re-init on core props that MUST trigger re-initialization
|
|
157
|
+
containerId,
|
|
158
|
+
editorId,
|
|
159
|
+
apiKey,
|
|
160
|
+
templateId,
|
|
161
|
+
hasLoadedSDK,
|
|
162
|
+
]);
|
|
163
|
+
// 4. Update options effect - update without re-init
|
|
164
|
+
useEffect(() => {
|
|
165
|
+
if (!editor || !isEditorReady)
|
|
166
|
+
return;
|
|
167
|
+
// Update modules without re-initialization
|
|
168
|
+
if (editorOptions.modules) {
|
|
169
|
+
// Cast to any to access setModules (it exists but type def may be outdated)
|
|
170
|
+
editor.setModules(editorOptions.modules);
|
|
171
|
+
}
|
|
172
|
+
// Note: Most options can't be updated after init, only modules can be updated
|
|
173
|
+
}, [editor, isEditorReady, editorOptions.modules]);
|
|
143
174
|
useImperativeHandle(ref, () => ({
|
|
144
|
-
editor:
|
|
175
|
+
editor: editor,
|
|
145
176
|
isReady: () => isEditorReady,
|
|
146
|
-
}), [isEditorReady]);
|
|
177
|
+
}), [editor, isEditorReady]);
|
|
147
178
|
const effectiveHeight = height ?? minHeight;
|
|
148
179
|
const containerStyle = {
|
|
149
180
|
width: "100%",
|
|
@@ -152,7 +183,7 @@ const PexelizeEditor = forwardRef((props, ref) => {
|
|
|
152
183
|
: effectiveHeight,
|
|
153
184
|
...style,
|
|
154
185
|
};
|
|
155
|
-
return (jsx("div", { className: className, style: containerStyle, children: jsx("div", { id: containerId
|
|
186
|
+
return (jsx("div", { className: className, style: containerStyle, children: jsx("div", { id: containerId, ref: containerRef, style: { width: "100%", height: "100%" } }) }));
|
|
156
187
|
});
|
|
157
188
|
PexelizeEditor.displayName = "PexelizeEditor";
|
|
158
189
|
function usePexelizeEditor() {
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;AA6DA,MAAM,WAAW,GAAG,qDAAqD;AAQzE,IAAI,cAAc,GAA8B,IAAI;AAEpD,SAAS,OAAO,GAAA;AACd,IAAA,IAAI,cAAc;AAAE,QAAA,OAAO,cAAc;IACzC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAK,MAAc,CAAC,QAAQ,EAAE;;QAE7D,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,QAAQ,EAAG,MAAc,CAAC,QAAQ;AAClC,YAAA,YAAY,EAAE,CAAC,MAAW,KAAI;gBAC5B,MAAM,QAAQ,GAAG,IAAK,MAAc,CAAC,QAAQ,CAAC,WAAW,EAAE;AAC3D,gBAAA,QAAQ,CAAC,IAAI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AC,GAAG,QAAQ,CAAC,KAAK,CAAC;IAE7C,SAAS,CAAC,MAAK;QACb,MAAM,UAAU,GAAG,MAAK;YACtB,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,KAAK;YAC7C,UAAU,CAAC,KAAK,CAAC;AACnB,QAAA,CAAC;AAED,QAAA,UAAU,EAAE;QACZ,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC;AAC7C,QAAA,OAAO,MAAM,aAAa,CAAC,QAAQ,CAAC;IACtC,CAAC,EAAE,EAAE,CAAC;IAEN,OAAO;QACL,GAAG;AACH,QAAA,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,IAAI,IAAI;QACnC,OAAO;KACR;AACH;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -7,28 +7,41 @@ var react = require('react');
|
|
|
7
7
|
|
|
8
8
|
const SDK_CDN_URL = "https://sdk.pexelize.com/latest/pexelize-sdk.min.js";
|
|
9
9
|
let sdkLoadPromise = null;
|
|
10
|
-
|
|
11
|
-
* Load the SDK script (only once across all components).
|
|
12
|
-
* After loading, window.createEditor will be available.
|
|
13
|
-
*/
|
|
14
|
-
function loadSDKScript() {
|
|
10
|
+
function loadSDK() {
|
|
15
11
|
if (sdkLoadPromise)
|
|
16
12
|
return sdkLoadPromise;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return Promise.resolve(
|
|
13
|
+
if (typeof window !== "undefined" && window.pexelize) {
|
|
14
|
+
// Return the SDK module with createEditor function
|
|
15
|
+
return Promise.resolve({
|
|
16
|
+
pexelize: window.pexelize,
|
|
17
|
+
createEditor: (config) => {
|
|
18
|
+
const instance = new window.pexelize.constructor();
|
|
19
|
+
instance.init(config);
|
|
20
|
+
return instance;
|
|
21
|
+
},
|
|
22
|
+
PexelizeSDK: window.pexelize.constructor,
|
|
23
|
+
});
|
|
20
24
|
}
|
|
21
25
|
sdkLoadPromise = new Promise((resolve, reject) => {
|
|
22
26
|
const script = document.createElement("script");
|
|
23
27
|
script.src = SDK_CDN_URL;
|
|
24
28
|
script.async = true;
|
|
25
29
|
script.onload = () => {
|
|
26
|
-
if (window.
|
|
27
|
-
|
|
30
|
+
if (window.pexelize) {
|
|
31
|
+
// Resolve with SDK module interface
|
|
32
|
+
resolve({
|
|
33
|
+
pexelize: window.pexelize,
|
|
34
|
+
createEditor: (config) => {
|
|
35
|
+
const instance = new window.pexelize.constructor();
|
|
36
|
+
instance.init(config);
|
|
37
|
+
return instance;
|
|
38
|
+
},
|
|
39
|
+
PexelizeSDK: window.pexelize.constructor,
|
|
40
|
+
});
|
|
28
41
|
}
|
|
29
42
|
else {
|
|
30
43
|
sdkLoadPromise = null;
|
|
31
|
-
reject(new Error("Failed to load Pexelize SDK
|
|
44
|
+
reject(new Error("Failed to load Pexelize SDK"));
|
|
32
45
|
}
|
|
33
46
|
};
|
|
34
47
|
script.onerror = () => {
|
|
@@ -39,22 +52,15 @@ function loadSDKScript() {
|
|
|
39
52
|
});
|
|
40
53
|
return sdkLoadPromise;
|
|
41
54
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Create a new editor instance.
|
|
44
|
-
* Each component gets its own independent instance for multiple editors support.
|
|
45
|
-
*/
|
|
46
|
-
function createEditorInstance() {
|
|
47
|
-
if (!window.createEditor) {
|
|
48
|
-
throw new Error("Pexelize SDK not loaded - call loadSDKScript first");
|
|
49
|
-
}
|
|
50
|
-
return window.createEditor();
|
|
51
|
-
}
|
|
52
55
|
const PexelizeEditor = react.forwardRef((props, ref) => {
|
|
53
56
|
const { editorId, apiKey, templateId, design, editorMode, contentType, ai, height, options = {}, className, style, minHeight = "600px", onReady, onLoad, onChange, onError, } = props;
|
|
54
57
|
const containerRef = react.useRef(null);
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
+
const [editor, setEditor] = react.useState(null);
|
|
59
|
+
const [hasLoadedSDK, setHasLoadedSDK] = react.useState(false);
|
|
60
|
+
const [isEditorReady, setIsEditorReady] = react.useState(false);
|
|
61
|
+
// Stable container ID using useMemo
|
|
62
|
+
const containerId = react.useMemo(() => `pexelize-editor-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
63
|
+
// Refs for callbacks to avoid dependency issues
|
|
58
64
|
const onReadyRef = react.useRef(onReady);
|
|
59
65
|
const onLoadRef = react.useRef(onLoad);
|
|
60
66
|
const onChangeRef = react.useRef(onChange);
|
|
@@ -71,83 +77,108 @@ const PexelizeEditor = react.forwardRef((props, ref) => {
|
|
|
71
77
|
react.useEffect(() => {
|
|
72
78
|
onErrorRef.current = onError;
|
|
73
79
|
}, [onError]);
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
// Build options object (memoized for comparison)
|
|
81
|
+
const editorOptions = react.useMemo(() => {
|
|
82
|
+
const editorConfig = contentType === "module"
|
|
83
|
+
? { ...options.editor, contentType, minRows: 1, maxRows: 1 }
|
|
84
|
+
: options.editor;
|
|
85
|
+
return {
|
|
86
|
+
containerId,
|
|
87
|
+
editorId,
|
|
88
|
+
apiKey,
|
|
89
|
+
...options,
|
|
90
|
+
...(templateId !== undefined && { templateId }),
|
|
91
|
+
...(design !== undefined && { design }),
|
|
92
|
+
...(editorMode !== undefined && { editorMode }),
|
|
93
|
+
...(ai !== undefined && { ai }),
|
|
94
|
+
...(editorConfig && { editor: editorConfig }),
|
|
95
|
+
};
|
|
96
|
+
}, [
|
|
97
|
+
containerId,
|
|
98
|
+
editorId,
|
|
99
|
+
apiKey,
|
|
100
|
+
templateId,
|
|
101
|
+
design,
|
|
102
|
+
editorMode,
|
|
103
|
+
ai,
|
|
104
|
+
contentType,
|
|
105
|
+
options,
|
|
106
|
+
]);
|
|
107
|
+
// 1. Cleanup effect - runs only on final unmount
|
|
108
|
+
react.useEffect(() => {
|
|
109
|
+
return () => {
|
|
110
|
+
editor?.destroy();
|
|
111
|
+
};
|
|
112
|
+
}, []); // Empty deps - only runs on unmount
|
|
113
|
+
// 2. SDK loading effect
|
|
81
114
|
react.useEffect(() => {
|
|
82
|
-
|
|
115
|
+
setHasLoadedSDK(false);
|
|
116
|
+
loadSDK()
|
|
117
|
+
.then(() => setHasLoadedSDK(true))
|
|
118
|
+
.catch((err) => onErrorRef.current?.(err));
|
|
119
|
+
}, []); // Load SDK once
|
|
120
|
+
// 3. Editor creation effect - ONLY on core props change
|
|
121
|
+
react.useEffect(() => {
|
|
122
|
+
if (!hasLoadedSDK || !containerRef.current)
|
|
83
123
|
return;
|
|
84
|
-
|
|
124
|
+
// KEY: Destroy previous editor BEFORE creating new one
|
|
125
|
+
editor?.destroy();
|
|
85
126
|
const initEditor = async () => {
|
|
86
127
|
try {
|
|
87
|
-
//
|
|
88
|
-
await
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
128
|
+
// Import createEditor for multiple instance support
|
|
129
|
+
const { createEditor } = await loadSDK();
|
|
130
|
+
// Create a new editor instance (not singleton)
|
|
131
|
+
const editorInstance = createEditor(editorOptions);
|
|
132
|
+
setEditor(editorInstance);
|
|
133
|
+
// Set up event listeners
|
|
134
|
+
const unsubscribeReady = editorInstance.addEventListener("editor:ready", () => {
|
|
135
|
+
setIsEditorReady(true);
|
|
136
|
+
onReadyRef.current?.(editorInstance);
|
|
137
|
+
});
|
|
138
|
+
const unsubscribeLoad = editorInstance.addEventListener("design:loaded", () => {
|
|
139
|
+
onLoadRef.current?.();
|
|
140
|
+
});
|
|
141
|
+
const unsubscribeChange = editorInstance.addEventListener("design:updated", (data) => {
|
|
142
|
+
onChangeRef.current?.(data);
|
|
143
|
+
});
|
|
144
|
+
// Cleanup listeners (but NOT the editor - that's handled in effect 1)
|
|
145
|
+
return () => {
|
|
146
|
+
unsubscribeReady();
|
|
147
|
+
unsubscribeLoad();
|
|
148
|
+
unsubscribeChange();
|
|
107
149
|
};
|
|
108
|
-
// Initialize THIS instance
|
|
109
|
-
editor.init(config);
|
|
110
|
-
// Subscribe to events on THIS instance
|
|
111
|
-
const unsubscribeReady = editor.addEventListener("editor:ready", handleReady);
|
|
112
|
-
eventUnsubscribersRef.current.push(unsubscribeReady);
|
|
113
|
-
const unsubscribeLoad = editor.addEventListener("design:loaded", () => onLoadRef.current?.());
|
|
114
|
-
eventUnsubscribersRef.current.push(unsubscribeLoad);
|
|
115
|
-
const unsubscribeChange = editor.addEventListener("design:updated", (data) => onChangeRef.current?.(data));
|
|
116
|
-
eventUnsubscribersRef.current.push(unsubscribeChange);
|
|
117
150
|
}
|
|
118
151
|
catch (err) {
|
|
119
|
-
if (!mounted)
|
|
120
|
-
return;
|
|
121
152
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
122
153
|
onErrorRef.current?.(error);
|
|
154
|
+
// Return empty cleanup function on error
|
|
155
|
+
return () => { };
|
|
123
156
|
}
|
|
124
157
|
};
|
|
125
158
|
initEditor();
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
};
|
|
146
|
-
}, [editorId, apiKey, handleReady]);
|
|
159
|
+
}, [
|
|
160
|
+
// Only re-init on core props that MUST trigger re-initialization
|
|
161
|
+
containerId,
|
|
162
|
+
editorId,
|
|
163
|
+
apiKey,
|
|
164
|
+
templateId,
|
|
165
|
+
hasLoadedSDK,
|
|
166
|
+
]);
|
|
167
|
+
// 4. Update options effect - update without re-init
|
|
168
|
+
react.useEffect(() => {
|
|
169
|
+
if (!editor || !isEditorReady)
|
|
170
|
+
return;
|
|
171
|
+
// Update modules without re-initialization
|
|
172
|
+
if (editorOptions.modules) {
|
|
173
|
+
// Cast to any to access setModules (it exists but type def may be outdated)
|
|
174
|
+
editor.setModules(editorOptions.modules);
|
|
175
|
+
}
|
|
176
|
+
// Note: Most options can't be updated after init, only modules can be updated
|
|
177
|
+
}, [editor, isEditorReady, editorOptions.modules]);
|
|
147
178
|
react.useImperativeHandle(ref, () => ({
|
|
148
|
-
editor:
|
|
179
|
+
editor: editor,
|
|
149
180
|
isReady: () => isEditorReady,
|
|
150
|
-
}), [isEditorReady]);
|
|
181
|
+
}), [editor, isEditorReady]);
|
|
151
182
|
const effectiveHeight = height ?? minHeight;
|
|
152
183
|
const containerStyle = {
|
|
153
184
|
width: "100%",
|
|
@@ -156,7 +187,7 @@ const PexelizeEditor = react.forwardRef((props, ref) => {
|
|
|
156
187
|
: effectiveHeight,
|
|
157
188
|
...style,
|
|
158
189
|
};
|
|
159
|
-
return (jsxRuntime.jsx("div", { className: className, style: containerStyle, children: jsxRuntime.jsx("div", { id: containerId
|
|
190
|
+
return (jsxRuntime.jsx("div", { className: className, style: containerStyle, children: jsxRuntime.jsx("div", { id: containerId, ref: containerRef, style: { width: "100%", height: "100%" } }) }));
|
|
160
191
|
});
|
|
161
192
|
PexelizeEditor.displayName = "PexelizeEditor";
|
|
162
193
|
function usePexelizeEditor() {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":[null],"names":["forwardRef","useRef","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.tsx"],"sourcesContent":[null],"names":["forwardRef","useRef","useState","useMemo","useEffect","useImperativeHandle","_jsx"],"mappings":";;;;;;;AA6DA,MAAM,WAAW,GAAG,qDAAqD;AAQzE,IAAI,cAAc,GAA8B,IAAI;AAEpD,SAAS,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E,KAAK,EAAE,cAAc,EAAA,QAAA,EAC9CA,cAAA,CAAA,KAAA,EAAA,EACE,EAAE,EAAE,WAAW,EACf,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAA,CACxC,EAAA,CACE;AAEV,CAAC;AAED,cAAc,CAAC,WAAW,GAAG,gBAAgB;SAE7B,iBAAiB,GAAA;AAC/B,IAAA,MAAM,GAAG,GAAGL,YAAM,CAAoB,IAAI,CAAC;IAC3C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;IAE7CE,eAAS,CAAC,MAAK;QACb,MAAM,UAAU,GAAG,MAAK;YACtB,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,KAAK;YAC7C,UAAU,CAAC,KAAK,CAAC;AACnB,QAAA,CAAC;AAED,QAAA,UAAU,EAAE;QACZ,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC;AAC7C,QAAA,OAAO,MAAM,aAAa,CAAC,QAAQ,CAAC;IACtC,CAAC,EAAE,EAAE,CAAC;IAEN,OAAO;QACL,GAAG;AACH,QAAA,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,IAAI,IAAI;QACnC,OAAO;KACR;AACH;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pexelize/react-editor",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "React wrapper component for the Pexelize Editor - thin wrapper that exposes raw SDK for maximum flexibility",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"module": "dist/index.esm.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": "./dist/index.esm.js",
|
|
12
|
-
"require": "./dist/index.js",
|
|
13
|
-
"types": "./dist/index.d.ts"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"dist",
|
|
18
|
-
"README.md",
|
|
19
|
-
"LICENSE"
|
|
20
|
-
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "rollup -c",
|
|
23
|
-
"build:watch": "rollup -c -w",
|
|
24
|
-
"dev": "rollup -c -w",
|
|
25
|
-
"test": "vitest",
|
|
26
|
-
"lint": "eslint src --ext .ts,.tsx",
|
|
27
|
-
"typecheck": "tsc --noEmit",
|
|
28
|
-
"clean": "rimraf dist",
|
|
29
|
-
"prepublishOnly": "npm run build"
|
|
30
|
-
},
|
|
31
|
-
"keywords": [
|
|
32
|
-
"pexelize",
|
|
33
|
-
"editor",
|
|
34
|
-
"email-editor",
|
|
35
|
-
"react",
|
|
36
|
-
"react-component",
|
|
37
|
-
"template-editor",
|
|
38
|
-
"template-builder",
|
|
39
|
-
"drag-and-drop",
|
|
40
|
-
"web page builder",
|
|
41
|
-
"page-builder"
|
|
42
|
-
],
|
|
43
|
-
"author": "Pexelize",
|
|
44
|
-
"license": "MIT",
|
|
45
|
-
"repository": {
|
|
46
|
-
"type": "git",
|
|
47
|
-
"url": "https://github.com/Zaman-Meer/pexelize-react.git"
|
|
48
|
-
},
|
|
49
|
-
"bugs": {
|
|
50
|
-
"url": "https://github.com/Zaman-Meer/pexelize-react/issues"
|
|
51
|
-
},
|
|
52
|
-
"homepage": "https://github.com/Zaman-Meer/pexelize-react#readme",
|
|
53
|
-
"peerDependencies": {
|
|
54
|
-
"react": ">=17.0.0",
|
|
55
|
-
"react-dom": ">=17.0.0"
|
|
56
|
-
},
|
|
57
|
-
"peerDependenciesMeta": {
|
|
58
|
-
"react": {
|
|
59
|
-
"optional": false
|
|
60
|
-
},
|
|
61
|
-
"react-dom": {
|
|
62
|
-
"optional": false
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"devDependencies": {
|
|
66
|
-
"@rollup/plugin-commonjs": "^25.0.7",
|
|
67
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
68
|
-
"@rollup/plugin-typescript": "^11.1.5",
|
|
69
|
-
"@types/node": "^20.10.4",
|
|
70
|
-
"@types/react": "^18.2.43",
|
|
71
|
-
"@types/react-dom": "^18.2.17",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
|
73
|
-
"@typescript-eslint/parser": "^6.13.2",
|
|
74
|
-
"eslint": "^8.55.0",
|
|
75
|
-
"react": "^18.2.0",
|
|
76
|
-
"react-dom": "^18.2.0",
|
|
77
|
-
"rimraf": "^5.0.5",
|
|
78
|
-
"rollup": "^4.9.0",
|
|
79
|
-
"rollup-plugin-dts": "^6.1.0",
|
|
80
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
81
|
-
"tslib": "^2.8.1",
|
|
82
|
-
"typescript": "^5.3.3",
|
|
83
|
-
"vitest": "^1.0.4"
|
|
84
|
-
},
|
|
85
|
-
"engines": {
|
|
86
|
-
"node": ">=16.0.0"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@pexelize/react-editor",
|
|
3
|
+
"version": "2.1.6",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "React wrapper component for the Pexelize Editor - thin wrapper that exposes raw SDK for maximum flexibility",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.esm.js",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rollup -c",
|
|
23
|
+
"build:watch": "rollup -c -w",
|
|
24
|
+
"dev": "rollup -c -w",
|
|
25
|
+
"test": "vitest",
|
|
26
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"clean": "rimraf dist",
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"pexelize",
|
|
33
|
+
"editor",
|
|
34
|
+
"email-editor",
|
|
35
|
+
"react",
|
|
36
|
+
"react-component",
|
|
37
|
+
"template-editor",
|
|
38
|
+
"template-builder",
|
|
39
|
+
"drag-and-drop",
|
|
40
|
+
"web page builder",
|
|
41
|
+
"page-builder"
|
|
42
|
+
],
|
|
43
|
+
"author": "Pexelize",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/Zaman-Meer/pexelize-react.git"
|
|
48
|
+
},
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/Zaman-Meer/pexelize-react/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/Zaman-Meer/pexelize-react#readme",
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": ">=17.0.0",
|
|
55
|
+
"react-dom": ">=17.0.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"react": {
|
|
59
|
+
"optional": false
|
|
60
|
+
},
|
|
61
|
+
"react-dom": {
|
|
62
|
+
"optional": false
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
67
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
68
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
69
|
+
"@types/node": "^20.10.4",
|
|
70
|
+
"@types/react": "^18.2.43",
|
|
71
|
+
"@types/react-dom": "^18.2.17",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
|
73
|
+
"@typescript-eslint/parser": "^6.13.2",
|
|
74
|
+
"eslint": "^8.55.0",
|
|
75
|
+
"react": "^18.2.0",
|
|
76
|
+
"react-dom": "^18.2.0",
|
|
77
|
+
"rimraf": "^5.0.5",
|
|
78
|
+
"rollup": "^4.9.0",
|
|
79
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
80
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
81
|
+
"tslib": "^2.8.1",
|
|
82
|
+
"typescript": "^5.3.3",
|
|
83
|
+
"vitest": "^1.0.4"
|
|
84
|
+
},
|
|
85
|
+
"engines": {
|
|
86
|
+
"node": ">=16.0.0"
|
|
87
|
+
}
|
|
88
|
+
}
|