@orion-studios/payload-studio 0.6.0-beta.121 → 0.6.0-beta.122

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.
@@ -823,10 +823,16 @@ var updateJsonListAttribute = ({
823
823
  [listAttr]: JSON.stringify(list)
824
824
  });
825
825
  };
826
- var snapshotModel = (model) => ({
827
- attributes: { ...model.getAttributes?.() || {} },
828
- style: { ...model.getStyle?.() || {} }
829
- });
826
+ var snapshotModel = (model, emptyListAttr) => {
827
+ const attributes = { ...model.getAttributes?.() || {} };
828
+ if (emptyListAttr && !attributes[emptyListAttr]) {
829
+ attributes[emptyListAttr] = "[]";
830
+ }
831
+ return {
832
+ attributes,
833
+ style: { ...model.getStyle?.() || {} }
834
+ };
835
+ };
830
836
  var pushModelHistory = ({
831
837
  after,
832
838
  before,
@@ -956,10 +962,10 @@ var bindEditablePreview = (view, editor) => {
956
962
  if (!listAttr) {
957
963
  return;
958
964
  }
959
- const before = snapshotModel(view.model);
965
+ const before = snapshotModel(view.model, listAttr);
960
966
  const runListMutation = (callback) => {
961
967
  withoutUndoTracking(editor, callback);
962
- const after = snapshotModel(view.model);
968
+ const after = snapshotModel(view.model, listAttr);
963
969
  if (JSON.stringify(before) !== JSON.stringify(after)) {
964
970
  pushModelHistory({
965
971
  after,
@@ -2115,7 +2121,7 @@ function GrapesPageEditor({
2115
2121
  }
2116
2122
  return null;
2117
2123
  };
2118
- const isOrionBlockComponent = (component) => Object.keys(parseOrionBlockAttribute(component?.getAttributes?.()?.["data-orion-block"])).length > 0;
2124
+ const isOrionBlockComponent = (component) => Boolean(component?.getAttributes?.()?.["data-orion-component"]) || Object.keys(parseOrionBlockAttribute(component?.getAttributes?.()?.["data-orion-block"])).length > 0;
2119
2125
  const findSelectedCanvasOrionBlock = () => {
2120
2126
  const editor = editorRef.current;
2121
2127
  const wrapper = editor?.DomComponents?.getWrapper?.() || null;
@@ -699,10 +699,16 @@ var updateJsonListAttribute = ({
699
699
  [listAttr]: JSON.stringify(list)
700
700
  });
701
701
  };
702
- var snapshotModel = (model) => ({
703
- attributes: { ...model.getAttributes?.() || {} },
704
- style: { ...model.getStyle?.() || {} }
705
- });
702
+ var snapshotModel = (model, emptyListAttr) => {
703
+ const attributes = { ...model.getAttributes?.() || {} };
704
+ if (emptyListAttr && !attributes[emptyListAttr]) {
705
+ attributes[emptyListAttr] = "[]";
706
+ }
707
+ return {
708
+ attributes,
709
+ style: { ...model.getStyle?.() || {} }
710
+ };
711
+ };
706
712
  var pushModelHistory = ({
707
713
  after,
708
714
  before,
@@ -832,10 +838,10 @@ var bindEditablePreview = (view, editor) => {
832
838
  if (!listAttr) {
833
839
  return;
834
840
  }
835
- const before = snapshotModel(view.model);
841
+ const before = snapshotModel(view.model, listAttr);
836
842
  const runListMutation = (callback) => {
837
843
  withoutUndoTracking(editor, callback);
838
- const after = snapshotModel(view.model);
844
+ const after = snapshotModel(view.model, listAttr);
839
845
  if (JSON.stringify(before) !== JSON.stringify(after)) {
840
846
  pushModelHistory({
841
847
  after,
@@ -1991,7 +1997,7 @@ function GrapesPageEditor({
1991
1997
  }
1992
1998
  return null;
1993
1999
  };
1994
- const isOrionBlockComponent = (component) => Object.keys(parseOrionBlockAttribute(component?.getAttributes?.()?.["data-orion-block"])).length > 0;
2000
+ const isOrionBlockComponent = (component) => Boolean(component?.getAttributes?.()?.["data-orion-component"]) || Object.keys(parseOrionBlockAttribute(component?.getAttributes?.()?.["data-orion-block"])).length > 0;
1995
2001
  const findSelectedCanvasOrionBlock = () => {
1996
2002
  const editor = editorRef.current;
1997
2003
  const wrapper = editor?.DomComponents?.getWrapper?.() || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.121",
3
+ "version": "0.6.0-beta.122",
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",