@orion-studios/payload-studio 0.6.0-beta.137 → 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(() => {
@@ -2880,8 +2884,9 @@ function GrapesPageEditor({
2880
2884
  if (action === "undo") {
2881
2885
  if (!customEntry.before && customEntry.after) {
2882
2886
  const removedComponent = customEntry.after.component;
2887
+ const removedID = getHistorySnapshotID(customEntry.after);
2883
2888
  customUndoStackRef.current = customUndoStackRef.current.filter(
2884
- (entry) => entry.before?.component !== removedComponent && entry.after?.component !== removedComponent
2889
+ (entry) => entry.before?.component !== removedComponent && entry.after?.component !== removedComponent && (!removedID || getHistorySnapshotID(entry.before) !== removedID && getHistorySnapshotID(entry.after) !== removedID)
2885
2890
  );
2886
2891
  }
2887
2892
  customRedoStackRef.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(() => {
@@ -2756,8 +2760,9 @@ function GrapesPageEditor({
2756
2760
  if (action === "undo") {
2757
2761
  if (!customEntry.before && customEntry.after) {
2758
2762
  const removedComponent = customEntry.after.component;
2763
+ const removedID = getHistorySnapshotID(customEntry.after);
2759
2764
  customUndoStackRef.current = customUndoStackRef.current.filter(
2760
- (entry) => entry.before?.component !== removedComponent && entry.after?.component !== removedComponent
2765
+ (entry) => entry.before?.component !== removedComponent && entry.after?.component !== removedComponent && (!removedID || getHistorySnapshotID(entry.before) !== removedID && getHistorySnapshotID(entry.after) !== removedID)
2761
2766
  );
2762
2767
  }
2763
2768
  customRedoStackRef.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.137",
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",