@orion-studios/payload-studio 0.6.0-beta.125 → 0.6.0-beta.126

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.
@@ -2706,6 +2706,17 @@ function GrapesPageEditor({
2706
2706
  }
2707
2707
  restoreComponentSnapshot(snapshot);
2708
2708
  };
2709
+ const equivalentHistoryAttributes = (before, after) => {
2710
+ const beforeBlock = parseOrionBlockAttribute(before["data-orion-block"]);
2711
+ const afterBlock = parseOrionBlockAttribute(after["data-orion-block"]);
2712
+ const beforeComparable = { ...before };
2713
+ const afterComparable = { ...after };
2714
+ if (Object.keys(beforeBlock).length > 0 && Object.keys(afterBlock).length > 0 && JSON.stringify(beforeBlock.items || []) === JSON.stringify(afterBlock.items || [])) {
2715
+ beforeComparable["data-orion-block"] = "";
2716
+ afterComparable["data-orion-block"] = "";
2717
+ }
2718
+ return JSON.stringify(beforeComparable) === JSON.stringify(afterComparable);
2719
+ };
2709
2720
  const pushCustomHistoryEntry = (before, after) => {
2710
2721
  if (!before && !after) {
2711
2722
  return;
@@ -2713,7 +2724,7 @@ function GrapesPageEditor({
2713
2724
  if (before && after && before.component !== after.component) {
2714
2725
  return;
2715
2726
  }
2716
- if (before && after && JSON.stringify(before.style) === JSON.stringify(after.style) && JSON.stringify(before.attributes) === JSON.stringify(after.attributes)) {
2727
+ if (before && after && JSON.stringify(before.style) === JSON.stringify(after.style) && equivalentHistoryAttributes(before.attributes, after.attributes)) {
2717
2728
  return;
2718
2729
  }
2719
2730
  customUndoStackRef.current.push({ after, before });
@@ -2582,6 +2582,17 @@ function GrapesPageEditor({
2582
2582
  }
2583
2583
  restoreComponentSnapshot(snapshot);
2584
2584
  };
2585
+ const equivalentHistoryAttributes = (before, after) => {
2586
+ const beforeBlock = parseOrionBlockAttribute(before["data-orion-block"]);
2587
+ const afterBlock = parseOrionBlockAttribute(after["data-orion-block"]);
2588
+ const beforeComparable = { ...before };
2589
+ const afterComparable = { ...after };
2590
+ if (Object.keys(beforeBlock).length > 0 && Object.keys(afterBlock).length > 0 && JSON.stringify(beforeBlock.items || []) === JSON.stringify(afterBlock.items || [])) {
2591
+ beforeComparable["data-orion-block"] = "";
2592
+ afterComparable["data-orion-block"] = "";
2593
+ }
2594
+ return JSON.stringify(beforeComparable) === JSON.stringify(afterComparable);
2595
+ };
2585
2596
  const pushCustomHistoryEntry = (before, after) => {
2586
2597
  if (!before && !after) {
2587
2598
  return;
@@ -2589,7 +2600,7 @@ function GrapesPageEditor({
2589
2600
  if (before && after && before.component !== after.component) {
2590
2601
  return;
2591
2602
  }
2592
- if (before && after && JSON.stringify(before.style) === JSON.stringify(after.style) && JSON.stringify(before.attributes) === JSON.stringify(after.attributes)) {
2603
+ if (before && after && JSON.stringify(before.style) === JSON.stringify(after.style) && equivalentHistoryAttributes(before.attributes, after.attributes)) {
2593
2604
  return;
2594
2605
  }
2595
2606
  customUndoStackRef.current.push({ after, before });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.125",
3
+ "version": "0.6.0-beta.126",
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",