@orion-studios/payload-studio 0.6.0-beta.162 → 0.6.0-beta.164

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.
@@ -1786,6 +1786,14 @@ var canvasSelectionCss = `
1786
1786
  position: relative;
1787
1787
  }
1788
1788
 
1789
+ .orion-builder-v2-has-negative-padding > .xo-builder-preview,
1790
+ .orion-builder-v2-runtime .orion-builder-v2-has-negative-padding > * {
1791
+ margin-top: calc(var(--orion-builder-negative-padding-top, 0px) * -1) !important;
1792
+ margin-right: calc(var(--orion-builder-negative-padding-right, 0px) * -1) !important;
1793
+ margin-bottom: calc(var(--orion-builder-negative-padding-bottom, 0px) * -1) !important;
1794
+ margin-left: calc(var(--orion-builder-negative-padding-left, 0px) * -1) !important;
1795
+ }
1796
+
1789
1797
  .xo-builder-preview-grid {
1790
1798
  display: grid;
1791
1799
  gap: 22px;
@@ -2592,7 +2600,7 @@ function GrapesPageEditor({
2592
2600
  selectedComponentRef.current = selected;
2593
2601
  lastSelectedComponentRef.current = selected;
2594
2602
  selected.addClass?.("orion-builder-v2-has-negative-padding");
2595
- selected.addStyle?.({ [property]: "0px", [variable]: styleValue });
2603
+ selected.addStyle?.({ [variable]: styleValue });
2596
2604
  editorRef.current?.select?.(selected);
2597
2605
  };
2598
2606
  const updateSelectedOrionBlock = (updates) => {
@@ -3654,6 +3662,19 @@ function GrapesPageEditor({
3654
3662
  (0, import_react.useEffect)(() => {
3655
3663
  saveRef.current = save;
3656
3664
  }, [saving]);
3665
+ (0, import_react.useEffect)(() => {
3666
+ const onBeforeUnload = (event) => {
3667
+ if (!isDirty) {
3668
+ return;
3669
+ }
3670
+ event.preventDefault();
3671
+ event.returnValue = "";
3672
+ };
3673
+ window.addEventListener("beforeunload", onBeforeUnload);
3674
+ return () => {
3675
+ window.removeEventListener("beforeunload", onBeforeUnload);
3676
+ };
3677
+ }, [isDirty]);
3657
3678
  (0, import_react.useEffect)(() => {
3658
3679
  decorateBuilderControls();
3659
3680
  const refreshControls = () => refreshSelectedState(selectedComponentRef.current);
@@ -1662,6 +1662,14 @@ var canvasSelectionCss = `
1662
1662
  position: relative;
1663
1663
  }
1664
1664
 
1665
+ .orion-builder-v2-has-negative-padding > .xo-builder-preview,
1666
+ .orion-builder-v2-runtime .orion-builder-v2-has-negative-padding > * {
1667
+ margin-top: calc(var(--orion-builder-negative-padding-top, 0px) * -1) !important;
1668
+ margin-right: calc(var(--orion-builder-negative-padding-right, 0px) * -1) !important;
1669
+ margin-bottom: calc(var(--orion-builder-negative-padding-bottom, 0px) * -1) !important;
1670
+ margin-left: calc(var(--orion-builder-negative-padding-left, 0px) * -1) !important;
1671
+ }
1672
+
1665
1673
  .xo-builder-preview-grid {
1666
1674
  display: grid;
1667
1675
  gap: 22px;
@@ -2468,7 +2476,7 @@ function GrapesPageEditor({
2468
2476
  selectedComponentRef.current = selected;
2469
2477
  lastSelectedComponentRef.current = selected;
2470
2478
  selected.addClass?.("orion-builder-v2-has-negative-padding");
2471
- selected.addStyle?.({ [property]: "0px", [variable]: styleValue });
2479
+ selected.addStyle?.({ [variable]: styleValue });
2472
2480
  editorRef.current?.select?.(selected);
2473
2481
  };
2474
2482
  const updateSelectedOrionBlock = (updates) => {
@@ -3530,6 +3538,19 @@ function GrapesPageEditor({
3530
3538
  useEffect(() => {
3531
3539
  saveRef.current = save;
3532
3540
  }, [saving]);
3541
+ useEffect(() => {
3542
+ const onBeforeUnload = (event) => {
3543
+ if (!isDirty) {
3544
+ return;
3545
+ }
3546
+ event.preventDefault();
3547
+ event.returnValue = "";
3548
+ };
3549
+ window.addEventListener("beforeunload", onBeforeUnload);
3550
+ return () => {
3551
+ window.removeEventListener("beforeunload", onBeforeUnload);
3552
+ };
3553
+ }, [isDirty]);
3533
3554
  useEffect(() => {
3534
3555
  decorateBuilderControls();
3535
3556
  const refreshControls = () => refreshSelectedState(selectedComponentRef.current);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.162",
3
+ "version": "0.6.0-beta.164",
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",