@pexelize/react-editor 1.0.0 → 1.0.2
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/README.md +18 -97
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @pexelize/react-editor
|
|
2
2
|
|
|
3
|
-
React wrapper component for the **Pexelize Email Editor**.
|
|
3
|
+
React wrapper component for the **Pexelize Email Editor**.
|
|
4
4
|
|
|
5
5
|
## 🚀 Installation
|
|
6
6
|
|
|
@@ -35,11 +35,11 @@ function EmailBuilder() {
|
|
|
35
35
|
<button onClick={handleSave}>Save</button>
|
|
36
36
|
<button onClick={handleExport}>Export HTML</button>
|
|
37
37
|
</div>
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
<PexelizeEditor
|
|
40
40
|
ref={editorRef}
|
|
41
|
-
editorMode=
|
|
42
|
-
height=
|
|
41
|
+
editorMode='email'
|
|
42
|
+
height='600px'
|
|
43
43
|
onReady={() => console.log('Editor ready!')}
|
|
44
44
|
onChange={({ design }) => console.log('Changed:', design)}
|
|
45
45
|
/>
|
|
@@ -50,18 +50,18 @@ function EmailBuilder() {
|
|
|
50
50
|
|
|
51
51
|
## 🔧 Props
|
|
52
52
|
|
|
53
|
-
| Prop
|
|
54
|
-
|
|
55
|
-
| `editorMode` | `'email' \| 'web' \| 'popup'` | `'email'` | Editor mode
|
|
56
|
-
| `height`
|
|
57
|
-
| `design`
|
|
58
|
-
| `mergeTags`
|
|
59
|
-
| `appearance` | `AppearanceConfig`
|
|
60
|
-
| `onReady`
|
|
61
|
-
| `onChange`
|
|
62
|
-
| `onLoad`
|
|
63
|
-
| `onImage`
|
|
64
|
-
| `onSave`
|
|
53
|
+
| Prop | Type | Default | Description |
|
|
54
|
+
| ------------ | ----------------------------- | --------- | ------------------------------ |
|
|
55
|
+
| `editorMode` | `'email' \| 'web' \| 'popup'` | `'email'` | Editor mode |
|
|
56
|
+
| `height` | `string \| number` | `'600px'` | Editor height |
|
|
57
|
+
| `design` | `DesignJson` | - | Initial design to load |
|
|
58
|
+
| `mergeTags` | `MergeTag[]` | - | Merge tags for personalization |
|
|
59
|
+
| `appearance` | `AppearanceConfig` | - | Visual customization |
|
|
60
|
+
| `onReady` | `() => void` | - | Called when editor is ready |
|
|
61
|
+
| `onChange` | `(data) => void` | - | Called when design changes |
|
|
62
|
+
| `onLoad` | `(data) => void` | - | Called when design is loaded |
|
|
63
|
+
| `onImage` | `ImageUploadCallback` | - | Image upload handler |
|
|
64
|
+
| `onSave` | `SaveCallback` | - | Save handler |
|
|
65
65
|
|
|
66
66
|
## 📚 Ref Methods
|
|
67
67
|
|
|
@@ -114,8 +114,8 @@ function MyComponent() {
|
|
|
114
114
|
|
|
115
115
|
return (
|
|
116
116
|
<div>
|
|
117
|
-
<div id=
|
|
118
|
-
<button
|
|
117
|
+
<div id='my-editor' style={{ height: '600px' }} />
|
|
118
|
+
<button
|
|
119
119
|
disabled={!isReady}
|
|
120
120
|
onClick={() => sdk?.exportHtml((d) => console.log(d.html))}
|
|
121
121
|
>
|
|
@@ -125,82 +125,3 @@ function MyComponent() {
|
|
|
125
125
|
);
|
|
126
126
|
}
|
|
127
127
|
```
|
|
128
|
-
|
|
129
|
-
## 🌐 CDN Architecture
|
|
130
|
-
|
|
131
|
-
This package automatically loads the Pexelize SDK from jsDelivr CDN:
|
|
132
|
-
|
|
133
|
-
```
|
|
134
|
-
https://cdn.jsdelivr.net/gh/Zaman-Meer/pexelize-sdk@dev/dist/pexelize-sdk.min.js
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Benefits:**
|
|
138
|
-
- ✅ Smaller bundle size (SDK loaded separately)
|
|
139
|
-
- ✅ SDK cached by browser across sites
|
|
140
|
-
- ✅ Always get latest SDK updates
|
|
141
|
-
- ✅ No npm dependency conflicts
|
|
142
|
-
|
|
143
|
-
## 📦 Publishing to npm
|
|
144
|
-
|
|
145
|
-
### 1. Setup npm account
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
# Login to npm (create account at npmjs.com if needed)
|
|
149
|
-
npm login
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### 2. Build the package
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
cd pexelize-react
|
|
156
|
-
npm install
|
|
157
|
-
npm run build
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### 3. Publish
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
# For scoped package (@pexelize/react-editor)
|
|
164
|
-
npm publish --access public
|
|
165
|
-
|
|
166
|
-
# For unscoped package
|
|
167
|
-
npm publish
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### 4. Update version for future releases
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
# Patch version (1.0.0 -> 1.0.1)
|
|
174
|
-
npm version patch
|
|
175
|
-
|
|
176
|
-
# Minor version (1.0.0 -> 1.1.0)
|
|
177
|
-
npm version minor
|
|
178
|
-
|
|
179
|
-
# Major version (1.0.0 -> 2.0.0)
|
|
180
|
-
npm version major
|
|
181
|
-
|
|
182
|
-
# Then publish
|
|
183
|
-
npm publish --access public
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## ❓ FAQ
|
|
187
|
-
|
|
188
|
-
### Is the CDN publicly available?
|
|
189
|
-
|
|
190
|
-
**Yes!** The SDK is hosted on jsDelivr which serves files directly from our public GitHub repository. Anyone can access it:
|
|
191
|
-
|
|
192
|
-
```html
|
|
193
|
-
<script src="https://cdn.jsdelivr.net/gh/Zaman-Meer/pexelize-sdk@dev/dist/pexelize-sdk.min.js"></script>
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Can I use a different SDK version?
|
|
197
|
-
|
|
198
|
-
Yes, change the CDN URL by forking and modifying `SDK_CDN_URL` in the source, or use the hook to initialize manually.
|
|
199
|
-
|
|
200
|
-
### Does this work with SSR (Next.js)?
|
|
201
|
-
|
|
202
|
-
Yes! The SDK is loaded client-side only using `useEffect`. The component shows a loading state until the SDK is ready.
|
|
203
|
-
|
|
204
|
-
## 📄 License
|
|
205
|
-
|
|
206
|
-
MIT
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pexelize/react-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "React wrapper component for the Pexelize Editor
|
|
5
|
+
"description": "React wrapper component for the Pexelize Editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|