@commercetools-demo/puck-editor 0.5.0 → 0.5.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/dist/index.js CHANGED
@@ -10301,19 +10301,14 @@ var PuckEditorInner = ({
10301
10301
  onError?.(err);
10302
10302
  }
10303
10303
  }, [saveDraft, onSave, onError]);
10304
- const handlePublish = (0, import_react12.useCallback)(
10305
- async (data) => {
10306
- try {
10307
- await saveDraft(data);
10308
- setHasUnsavedChanges(false);
10309
- await publish(false);
10310
- onPublish?.(data);
10311
- } catch (err) {
10312
- onError?.(err);
10313
- }
10314
- },
10315
- [saveDraft, publish, onPublish, onError]
10316
- );
10304
+ const handlePublish = (0, import_react12.useCallback)(async () => {
10305
+ try {
10306
+ await publish(false);
10307
+ onPublish?.(currentData);
10308
+ } catch (err) {
10309
+ onError?.(err);
10310
+ }
10311
+ }, [publish, onPublish, currentData, onError]);
10317
10312
  const handleRevert = (0, import_react12.useCallback)(async () => {
10318
10313
  try {
10319
10314
  await revertToPublished();
@@ -10392,7 +10387,7 @@ var PuckEditorInner = ({
10392
10387
  config,
10393
10388
  data: activeData,
10394
10389
  onChange: handleChange,
10395
- onPublish: handlePublish,
10390
+ onPublish: () => void handlePublish(),
10396
10391
  overrides: {
10397
10392
  headerActions: () => versionHistory.isPreviewingHistory ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_spacings4.default.Inline, { scale: "s", alignItems: "center", children: [
10398
10393
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
@@ -10412,7 +10407,7 @@ var PuckEditorInner = ({
10412
10407
  isDirty: hasUnsavedChanges,
10413
10408
  states,
10414
10409
  onSave: () => void handleSave(),
10415
- onPublish: () => void handlePublish(activeData),
10410
+ onPublish: () => void handlePublish(),
10416
10411
  onRevert: () => void handleRevert(),
10417
10412
  showPublishButton
10418
10413
  }