@pexelize/react-editor 2.1.3 → 2.1.5
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 +83 -89
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +82 -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,25 @@
|
|
|
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 Promise.resolve(window.pexelize);
|
|
16
11
|
}
|
|
17
12
|
sdkLoadPromise = new Promise((resolve, reject) => {
|
|
18
13
|
const script = document.createElement("script");
|
|
19
14
|
script.src = SDK_CDN_URL;
|
|
20
15
|
script.async = true;
|
|
21
16
|
script.onload = () => {
|
|
22
|
-
if (window.
|
|
23
|
-
resolve();
|
|
17
|
+
if (window.pexelize) {
|
|
18
|
+
resolve(window.pexelize);
|
|
24
19
|
}
|
|
25
20
|
else {
|
|
26
21
|
sdkLoadPromise = null;
|
|
27
|
-
reject(new Error("Failed to load Pexelize SDK
|
|
22
|
+
reject(new Error("Failed to load Pexelize SDK"));
|
|
28
23
|
}
|
|
29
24
|
};
|
|
30
25
|
script.onerror = () => {
|
|
@@ -35,22 +30,15 @@ function loadSDKScript() {
|
|
|
35
30
|
});
|
|
36
31
|
return sdkLoadPromise;
|
|
37
32
|
}
|
|
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
33
|
const PexelizeEditor = forwardRef((props, ref) => {
|
|
49
34
|
const { editorId, apiKey, templateId, design, editorMode, contentType, ai, height, options = {}, className, style, minHeight = "600px", onReady, onLoad, onChange, onError, } = props;
|
|
50
35
|
const containerRef = useRef(null);
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
36
|
+
const [editor, setEditor] = useState(null);
|
|
37
|
+
const [hasLoadedSDK, setHasLoadedSDK] = useState(false);
|
|
38
|
+
const [isEditorReady, setIsEditorReady] = useState(false);
|
|
39
|
+
// Stable container ID using useMemo
|
|
40
|
+
const containerId = useMemo(() => `pexelize-editor-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
41
|
+
// Refs for callbacks to avoid dependency issues
|
|
54
42
|
const onReadyRef = useRef(onReady);
|
|
55
43
|
const onLoadRef = useRef(onLoad);
|
|
56
44
|
const onChangeRef = useRef(onChange);
|
|
@@ -67,83 +55,89 @@ const PexelizeEditor = forwardRef((props, ref) => {
|
|
|
67
55
|
useEffect(() => {
|
|
68
56
|
onErrorRef.current = onError;
|
|
69
57
|
}, [onError]);
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
// Build options object (memoized for comparison)
|
|
59
|
+
const editorOptions = useMemo(() => {
|
|
60
|
+
const editorConfig = contentType === "module"
|
|
61
|
+
? { ...options.editor, contentType, minRows: 1, maxRows: 1 }
|
|
62
|
+
: options.editor;
|
|
63
|
+
return {
|
|
64
|
+
containerId,
|
|
65
|
+
editorId,
|
|
66
|
+
apiKey,
|
|
67
|
+
...options,
|
|
68
|
+
...(templateId !== undefined && { templateId }),
|
|
69
|
+
...(design !== undefined && { design }),
|
|
70
|
+
...(editorMode !== undefined && { editorMode }),
|
|
71
|
+
...(ai !== undefined && { ai }),
|
|
72
|
+
...(editorConfig && { editor: editorConfig }),
|
|
73
|
+
};
|
|
74
|
+
}, [
|
|
75
|
+
containerId,
|
|
76
|
+
editorId,
|
|
77
|
+
apiKey,
|
|
78
|
+
templateId,
|
|
79
|
+
design,
|
|
80
|
+
editorMode,
|
|
81
|
+
ai,
|
|
82
|
+
contentType,
|
|
83
|
+
options,
|
|
84
|
+
]);
|
|
85
|
+
// 1. Cleanup effect - runs only on final unmount
|
|
77
86
|
useEffect(() => {
|
|
78
|
-
|
|
87
|
+
return () => {
|
|
88
|
+
editor?.destroy();
|
|
89
|
+
};
|
|
90
|
+
}, []); // Empty deps - only runs on unmount
|
|
91
|
+
// 2. SDK loading effect
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
setHasLoadedSDK(false);
|
|
94
|
+
loadSDK()
|
|
95
|
+
.then(() => setHasLoadedSDK(true))
|
|
96
|
+
.catch((err) => onErrorRef.current?.(err));
|
|
97
|
+
}, []); // Load SDK once
|
|
98
|
+
// 3. Editor creation effect - DESTROY BEFORE CREATE
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (!hasLoadedSDK || !containerRef.current)
|
|
79
101
|
return;
|
|
80
|
-
|
|
102
|
+
// KEY: Destroy previous editor BEFORE creating new one
|
|
103
|
+
editor?.destroy();
|
|
81
104
|
const initEditor = async () => {
|
|
82
105
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
const pexelize = await loadSDK();
|
|
107
|
+
// Initialize the editor
|
|
108
|
+
pexelize.init(editorOptions);
|
|
109
|
+
setEditor(pexelize);
|
|
110
|
+
// Set up event listeners
|
|
111
|
+
const unsubscribeReady = pexelize.addEventListener("editor:ready", () => {
|
|
112
|
+
setIsEditorReady(true);
|
|
113
|
+
onReadyRef.current?.(pexelize);
|
|
114
|
+
});
|
|
115
|
+
const unsubscribeLoad = pexelize.addEventListener("design:loaded", () => {
|
|
116
|
+
onLoadRef.current?.();
|
|
117
|
+
});
|
|
118
|
+
const unsubscribeChange = pexelize.addEventListener("design:updated", (data) => {
|
|
119
|
+
onChangeRef.current?.(data);
|
|
120
|
+
});
|
|
121
|
+
// Cleanup listeners (but NOT the editor - that's handled in effect 1)
|
|
122
|
+
return () => {
|
|
123
|
+
unsubscribeReady();
|
|
124
|
+
unsubscribeLoad();
|
|
125
|
+
unsubscribeChange();
|
|
103
126
|
};
|
|
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
127
|
}
|
|
114
128
|
catch (err) {
|
|
115
|
-
if (!mounted)
|
|
116
|
-
return;
|
|
117
129
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
118
130
|
onErrorRef.current?.(error);
|
|
131
|
+
// Return empty cleanup function on error
|
|
132
|
+
return () => { };
|
|
119
133
|
}
|
|
120
134
|
};
|
|
121
135
|
initEditor();
|
|
122
|
-
|
|
123
|
-
mounted = false;
|
|
124
|
-
eventUnsubscribersRef.current.forEach((unsub) => {
|
|
125
|
-
try {
|
|
126
|
-
unsub();
|
|
127
|
-
}
|
|
128
|
-
catch {
|
|
129
|
-
// ignore
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
eventUnsubscribersRef.current = [];
|
|
133
|
-
try {
|
|
134
|
-
editorInstanceRef.current?.destroy();
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
// ignore
|
|
138
|
-
}
|
|
139
|
-
editorInstanceRef.current = null;
|
|
140
|
-
setIsEditorReady(false);
|
|
141
|
-
};
|
|
142
|
-
}, [editorId, apiKey, handleReady]);
|
|
136
|
+
}, [JSON.stringify(editorOptions), hasLoadedSDK]);
|
|
143
137
|
useImperativeHandle(ref, () => ({
|
|
144
|
-
editor:
|
|
138
|
+
editor: editor,
|
|
145
139
|
isReady: () => isEditorReady,
|
|
146
|
-
}), [isEditorReady]);
|
|
140
|
+
}), [editor, isEditorReady]);
|
|
147
141
|
const effectiveHeight = height ?? minHeight;
|
|
148
142
|
const containerStyle = {
|
|
149
143
|
width: "100%",
|
|
@@ -152,7 +146,7 @@ const PexelizeEditor = forwardRef((props, ref) => {
|
|
|
152
146
|
: effectiveHeight,
|
|
153
147
|
...style,
|
|
154
148
|
};
|
|
155
|
-
return (jsx("div", { className: className, style: containerStyle, children: jsx("div", { id: containerId
|
|
149
|
+
return (jsx("div", { className: className, style: containerStyle, children: jsx("div", { id: containerId, ref: containerRef, style: { width: "100%", height: "100%" } }) }));
|
|
156
150
|
});
|
|
157
151
|
PexelizeEditor.displayName = "PexelizeEditor";
|
|
158
152
|
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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AAG;AACH,QAAA,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,IAAI,IAAI;QACnC,OAAO;KACR;AACH;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -7,28 +7,23 @@ 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 Promise.resolve(window.pexelize);
|
|
20
15
|
}
|
|
21
16
|
sdkLoadPromise = new Promise((resolve, reject) => {
|
|
22
17
|
const script = document.createElement("script");
|
|
23
18
|
script.src = SDK_CDN_URL;
|
|
24
19
|
script.async = true;
|
|
25
20
|
script.onload = () => {
|
|
26
|
-
if (window.
|
|
27
|
-
resolve();
|
|
21
|
+
if (window.pexelize) {
|
|
22
|
+
resolve(window.pexelize);
|
|
28
23
|
}
|
|
29
24
|
else {
|
|
30
25
|
sdkLoadPromise = null;
|
|
31
|
-
reject(new Error("Failed to load Pexelize SDK
|
|
26
|
+
reject(new Error("Failed to load Pexelize SDK"));
|
|
32
27
|
}
|
|
33
28
|
};
|
|
34
29
|
script.onerror = () => {
|
|
@@ -39,22 +34,15 @@ function loadSDKScript() {
|
|
|
39
34
|
});
|
|
40
35
|
return sdkLoadPromise;
|
|
41
36
|
}
|
|
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
37
|
const PexelizeEditor = react.forwardRef((props, ref) => {
|
|
53
38
|
const { editorId, apiKey, templateId, design, editorMode, contentType, ai, height, options = {}, className, style, minHeight = "600px", onReady, onLoad, onChange, onError, } = props;
|
|
54
39
|
const containerRef = react.useRef(null);
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
40
|
+
const [editor, setEditor] = react.useState(null);
|
|
41
|
+
const [hasLoadedSDK, setHasLoadedSDK] = react.useState(false);
|
|
42
|
+
const [isEditorReady, setIsEditorReady] = react.useState(false);
|
|
43
|
+
// Stable container ID using useMemo
|
|
44
|
+
const containerId = react.useMemo(() => `pexelize-editor-${Math.random().toString(36).substr(2, 9)}`, []);
|
|
45
|
+
// Refs for callbacks to avoid dependency issues
|
|
58
46
|
const onReadyRef = react.useRef(onReady);
|
|
59
47
|
const onLoadRef = react.useRef(onLoad);
|
|
60
48
|
const onChangeRef = react.useRef(onChange);
|
|
@@ -71,83 +59,89 @@ const PexelizeEditor = react.forwardRef((props, ref) => {
|
|
|
71
59
|
react.useEffect(() => {
|
|
72
60
|
onErrorRef.current = onError;
|
|
73
61
|
}, [onError]);
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
// Build options object (memoized for comparison)
|
|
63
|
+
const editorOptions = react.useMemo(() => {
|
|
64
|
+
const editorConfig = contentType === "module"
|
|
65
|
+
? { ...options.editor, contentType, minRows: 1, maxRows: 1 }
|
|
66
|
+
: options.editor;
|
|
67
|
+
return {
|
|
68
|
+
containerId,
|
|
69
|
+
editorId,
|
|
70
|
+
apiKey,
|
|
71
|
+
...options,
|
|
72
|
+
...(templateId !== undefined && { templateId }),
|
|
73
|
+
...(design !== undefined && { design }),
|
|
74
|
+
...(editorMode !== undefined && { editorMode }),
|
|
75
|
+
...(ai !== undefined && { ai }),
|
|
76
|
+
...(editorConfig && { editor: editorConfig }),
|
|
77
|
+
};
|
|
78
|
+
}, [
|
|
79
|
+
containerId,
|
|
80
|
+
editorId,
|
|
81
|
+
apiKey,
|
|
82
|
+
templateId,
|
|
83
|
+
design,
|
|
84
|
+
editorMode,
|
|
85
|
+
ai,
|
|
86
|
+
contentType,
|
|
87
|
+
options,
|
|
88
|
+
]);
|
|
89
|
+
// 1. Cleanup effect - runs only on final unmount
|
|
81
90
|
react.useEffect(() => {
|
|
82
|
-
|
|
91
|
+
return () => {
|
|
92
|
+
editor?.destroy();
|
|
93
|
+
};
|
|
94
|
+
}, []); // Empty deps - only runs on unmount
|
|
95
|
+
// 2. SDK loading effect
|
|
96
|
+
react.useEffect(() => {
|
|
97
|
+
setHasLoadedSDK(false);
|
|
98
|
+
loadSDK()
|
|
99
|
+
.then(() => setHasLoadedSDK(true))
|
|
100
|
+
.catch((err) => onErrorRef.current?.(err));
|
|
101
|
+
}, []); // Load SDK once
|
|
102
|
+
// 3. Editor creation effect - DESTROY BEFORE CREATE
|
|
103
|
+
react.useEffect(() => {
|
|
104
|
+
if (!hasLoadedSDK || !containerRef.current)
|
|
83
105
|
return;
|
|
84
|
-
|
|
106
|
+
// KEY: Destroy previous editor BEFORE creating new one
|
|
107
|
+
editor?.destroy();
|
|
85
108
|
const initEditor = async () => {
|
|
86
109
|
try {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
110
|
+
const pexelize = await loadSDK();
|
|
111
|
+
// Initialize the editor
|
|
112
|
+
pexelize.init(editorOptions);
|
|
113
|
+
setEditor(pexelize);
|
|
114
|
+
// Set up event listeners
|
|
115
|
+
const unsubscribeReady = pexelize.addEventListener("editor:ready", () => {
|
|
116
|
+
setIsEditorReady(true);
|
|
117
|
+
onReadyRef.current?.(pexelize);
|
|
118
|
+
});
|
|
119
|
+
const unsubscribeLoad = pexelize.addEventListener("design:loaded", () => {
|
|
120
|
+
onLoadRef.current?.();
|
|
121
|
+
});
|
|
122
|
+
const unsubscribeChange = pexelize.addEventListener("design:updated", (data) => {
|
|
123
|
+
onChangeRef.current?.(data);
|
|
124
|
+
});
|
|
125
|
+
// Cleanup listeners (but NOT the editor - that's handled in effect 1)
|
|
126
|
+
return () => {
|
|
127
|
+
unsubscribeReady();
|
|
128
|
+
unsubscribeLoad();
|
|
129
|
+
unsubscribeChange();
|
|
107
130
|
};
|
|
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
131
|
}
|
|
118
132
|
catch (err) {
|
|
119
|
-
if (!mounted)
|
|
120
|
-
return;
|
|
121
133
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
122
134
|
onErrorRef.current?.(error);
|
|
135
|
+
// Return empty cleanup function on error
|
|
136
|
+
return () => { };
|
|
123
137
|
}
|
|
124
138
|
};
|
|
125
139
|
initEditor();
|
|
126
|
-
|
|
127
|
-
mounted = false;
|
|
128
|
-
eventUnsubscribersRef.current.forEach((unsub) => {
|
|
129
|
-
try {
|
|
130
|
-
unsub();
|
|
131
|
-
}
|
|
132
|
-
catch {
|
|
133
|
-
// ignore
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
eventUnsubscribersRef.current = [];
|
|
137
|
-
try {
|
|
138
|
-
editorInstanceRef.current?.destroy();
|
|
139
|
-
}
|
|
140
|
-
catch {
|
|
141
|
-
// ignore
|
|
142
|
-
}
|
|
143
|
-
editorInstanceRef.current = null;
|
|
144
|
-
setIsEditorReady(false);
|
|
145
|
-
};
|
|
146
|
-
}, [editorId, apiKey, handleReady]);
|
|
140
|
+
}, [JSON.stringify(editorOptions), hasLoadedSDK]);
|
|
147
141
|
react.useImperativeHandle(ref, () => ({
|
|
148
|
-
editor:
|
|
142
|
+
editor: editor,
|
|
149
143
|
isReady: () => isEditorReady,
|
|
150
|
-
}), [isEditorReady]);
|
|
144
|
+
}), [editor, isEditorReady]);
|
|
151
145
|
const effectiveHeight = height ?? minHeight;
|
|
152
146
|
const containerStyle = {
|
|
153
147
|
width: "100%",
|
|
@@ -156,7 +150,7 @@ const PexelizeEditor = react.forwardRef((props, ref) => {
|
|
|
156
150
|
: effectiveHeight,
|
|
157
151
|
...style,
|
|
158
152
|
};
|
|
159
|
-
return (jsxRuntime.jsx("div", { className: className, style: containerStyle, children: jsxRuntime.jsx("div", { id: containerId
|
|
153
|
+
return (jsxRuntime.jsx("div", { className: className, style: containerStyle, children: jsxRuntime.jsx("div", { id: containerId, ref: containerRef, style: { width: "100%", height: "100%" } }) }));
|
|
160
154
|
});
|
|
161
155
|
PexelizeEditor.displayName = "PexelizeEditor";
|
|
162
156
|
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":";;;;;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,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.5",
|
|
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
|
+
}
|