@orion-studios/payload-studio 0.6.0-beta.136 → 0.6.0-beta.138

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.
@@ -2851,6 +2851,10 @@ function GrapesPageEditor({
2851
2851
  updateHistoryState(editorRef.current);
2852
2852
  }
2853
2853
  };
2854
+ const getHistorySnapshotID = (snapshot) => {
2855
+ const value = snapshot?.attributes["data-orion-id"];
2856
+ return typeof value === "string" ? value : "";
2857
+ };
2854
2858
  const completeHistoryRestore = (editor) => {
2855
2859
  window.requestAnimationFrame(() => {
2856
2860
  window.setTimeout(() => {
@@ -2878,6 +2882,13 @@ function GrapesPageEditor({
2878
2882
  historyRestoreActiveRef.current = true;
2879
2883
  restoreCustomHistoryEntry(customEntry, action === "undo" ? "before" : "after");
2880
2884
  if (action === "undo") {
2885
+ if (!customEntry.before && customEntry.after) {
2886
+ const removedComponent = customEntry.after.component;
2887
+ const removedID = getHistorySnapshotID(customEntry.after);
2888
+ customUndoStackRef.current = customUndoStackRef.current.filter(
2889
+ (entry) => entry.before?.component !== removedComponent && entry.after?.component !== removedComponent && (!removedID || getHistorySnapshotID(entry.before) !== removedID && getHistorySnapshotID(entry.after) !== removedID)
2890
+ );
2891
+ }
2881
2892
  customRedoStackRef.current.push(customEntry);
2882
2893
  } else {
2883
2894
  customUndoStackRef.current.push(customEntry);
@@ -2727,6 +2727,10 @@ function GrapesPageEditor({
2727
2727
  updateHistoryState(editorRef.current);
2728
2728
  }
2729
2729
  };
2730
+ const getHistorySnapshotID = (snapshot) => {
2731
+ const value = snapshot?.attributes["data-orion-id"];
2732
+ return typeof value === "string" ? value : "";
2733
+ };
2730
2734
  const completeHistoryRestore = (editor) => {
2731
2735
  window.requestAnimationFrame(() => {
2732
2736
  window.setTimeout(() => {
@@ -2754,6 +2758,13 @@ function GrapesPageEditor({
2754
2758
  historyRestoreActiveRef.current = true;
2755
2759
  restoreCustomHistoryEntry(customEntry, action === "undo" ? "before" : "after");
2756
2760
  if (action === "undo") {
2761
+ if (!customEntry.before && customEntry.after) {
2762
+ const removedComponent = customEntry.after.component;
2763
+ const removedID = getHistorySnapshotID(customEntry.after);
2764
+ customUndoStackRef.current = customUndoStackRef.current.filter(
2765
+ (entry) => entry.before?.component !== removedComponent && entry.after?.component !== removedComponent && (!removedID || getHistorySnapshotID(entry.before) !== removedID && getHistorySnapshotID(entry.after) !== removedID)
2766
+ );
2767
+ }
2757
2768
  customRedoStackRef.current.push(customEntry);
2758
2769
  } else {
2759
2770
  customUndoStackRef.current.push(customEntry);
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  admin_exports
3
3
  } from "./chunk-JC3UV74N.mjs";
4
+ import {
5
+ blocks_exports
6
+ } from "./chunk-JQAHXYAM.mjs";
4
7
  import {
5
8
  admin_app_exports
6
9
  } from "./chunk-RKTIFEUY.mjs";
7
10
  import "./chunk-W2UOCJDX.mjs";
8
- import {
9
- blocks_exports
10
- } from "./chunk-JQAHXYAM.mjs";
11
11
  import {
12
12
  nextjs_exports
13
13
  } from "./chunk-ZADL33R6.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.136",
3
+ "version": "0.6.0-beta.138",
4
4
  "description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",