labellife-design-tool 1.0.4 → 1.0.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/README.md CHANGED
@@ -252,9 +252,68 @@ function App() {
252
252
  }
253
253
  ```
254
254
 
255
+ ## WordPress Integration
256
+
257
+ The library includes a special WordPress-compatible entry point that ensures proper compatibility with WordPress's React environment.
258
+
259
+ ### Using with WordPress
260
+
261
+ When using this library in a WordPress environment, import from the WordPress-specific entry point:
262
+
263
+ ```tsx
264
+ // Import from the WordPress-specific entry point
265
+ import { CanvasEditor } from 'labellife-design-tool/wordpress';
266
+ import 'labellife-design-tool/styles'; // Import CSS
267
+
268
+ // Use as normal
269
+ function MyWordPressComponent() {
270
+ return (
271
+ <CanvasEditor
272
+ name="WordPress Design Editor"
273
+ config={{
274
+ export: { png: true, jpg: true, json: true },
275
+ multiPage: true
276
+ }}
277
+ />
278
+ );
279
+ }
280
+ ```
281
+
282
+ ### WordPress Helper Function
283
+
284
+ For simpler integration with vanilla WordPress plugins, a helper function is provided:
285
+
286
+ ```javascript
287
+ import { initWordPressCanvasEditor } from 'labellife-design-tool/wordpress';
288
+ import 'labellife-design-tool/styles'; // Import CSS
289
+
290
+ // Initialize when DOM is ready
291
+ document.addEventListener('DOMContentLoaded', () => {
292
+ const containerId = 'editor-container'; // ID of your container element
293
+
294
+ initWordPressCanvasEditor(containerId, {
295
+ name: "WordPress Editor",
296
+ config: {
297
+ export: { png: true, jpg: true, json: true },
298
+ multiPage: true,
299
+ variables: true
300
+ }
301
+ });
302
+ });
303
+ ```
304
+
305
+ ### How the WordPress Compatibility Works
306
+
307
+ The WordPress integration automatically handles compatibility with WordPress's React environment by:
308
+
309
+ 1. Detecting when React is available globally (as in WordPress)
310
+ 2. Adding necessary JSX runtime compatibility functions
311
+ 3. Making the library work seamlessly in WordPress's React environment
312
+
255
313
  ## Project Structure
256
314
 
257
315
  - `src/lib/index.ts` - Library entry point (npm package)
316
+ - `src/wordpress.tsx` - WordPress-specific entry point
258
317
  - `src/CanvasEditor.tsx` - Main editor component
259
318
  - `src/types/` - TypeScript type definitions
260
319
  - `src/components/` - React components