@orion-studios/payload-studio 0.6.0-beta.181 → 0.6.0-beta.183
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.
|
@@ -1160,7 +1160,8 @@ var registerProjectDynamicComponents = (editor, adapter) => {
|
|
|
1160
1160
|
const props = propsFromAttributes(attributes);
|
|
1161
1161
|
withoutUndoTracking(editor, () => {
|
|
1162
1162
|
const backgroundColor = defaultBackgroundForComponent(type, props);
|
|
1163
|
-
|
|
1163
|
+
const currentBackgroundColor = normalizeCssColor(this.model.getStyle?.()?.["background-color"]);
|
|
1164
|
+
if (backgroundColor && currentBackgroundColor !== backgroundColor) {
|
|
1164
1165
|
this.model.addStyle?.({ "background-color": backgroundColor });
|
|
1165
1166
|
this.model.addAttributes?.({ "data-orion-background-color": backgroundColor });
|
|
1166
1167
|
}
|
|
@@ -1773,22 +1774,7 @@ var quickVerticalAlignStyles = {
|
|
|
1773
1774
|
middle: "center",
|
|
1774
1775
|
top: "flex-start"
|
|
1775
1776
|
};
|
|
1776
|
-
var negativePaddingCss = `
|
|
1777
|
-
.orion-builder-v2-negative-padding {
|
|
1778
|
-
display: flow-root;
|
|
1779
|
-
margin-top: var(--orion-negative-padding-top, 0px) !important;
|
|
1780
|
-
margin-right: var(--orion-negative-padding-right, 0px) !important;
|
|
1781
|
-
margin-bottom: var(--orion-negative-padding-bottom, 0px) !important;
|
|
1782
|
-
margin-left: var(--orion-negative-padding-left, 0px) !important;
|
|
1783
|
-
max-width: none !important;
|
|
1784
|
-
overflow: visible;
|
|
1785
|
-
position: relative;
|
|
1786
|
-
width: calc(100% - var(--orion-negative-padding-left, 0px) - var(--orion-negative-padding-right, 0px)) !important;
|
|
1787
|
-
}
|
|
1788
|
-
`;
|
|
1789
1777
|
var canvasSelectionCss = `
|
|
1790
|
-
${negativePaddingCss}
|
|
1791
|
-
|
|
1792
1778
|
.gjs-selected,
|
|
1793
1779
|
[data-gjs-highlightable].gjs-selected {
|
|
1794
1780
|
outline-color: #c7643d !important;
|
|
@@ -1957,14 +1943,6 @@ var readStylePanelColor = (property) => {
|
|
|
1957
1943
|
return swatchColor;
|
|
1958
1944
|
};
|
|
1959
1945
|
var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
|
|
1960
|
-
var cssPixelValue = (value) => {
|
|
1961
|
-
const match = value.trim().match(/^(-?\d*\.?\d+)(px)?$/i);
|
|
1962
|
-
if (!match) {
|
|
1963
|
-
return null;
|
|
1964
|
-
}
|
|
1965
|
-
const parsed = Number.parseFloat(match[1]);
|
|
1966
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
1967
|
-
};
|
|
1968
1946
|
var propertyNameFromStyleControl = (element) => {
|
|
1969
1947
|
const property = element?.closest(".gjs-sm-property");
|
|
1970
1948
|
const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
|
|
@@ -1997,13 +1975,9 @@ var spacingProperties = [
|
|
|
1997
1975
|
"padding-left",
|
|
1998
1976
|
"padding-right"
|
|
1999
1977
|
];
|
|
2000
|
-
var
|
|
2001
|
-
var
|
|
2002
|
-
var
|
|
2003
|
-
var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
|
|
2004
|
-
var negativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
|
|
2005
|
-
var negativePaddingBackgroundVariable = "--orion-negative-padding-background";
|
|
2006
|
-
var hasNegativePaddingState = (attrs, style) => negativePaddingSides.some((side) => Boolean(attrs[negativePaddingAttributeForSide(side)] || style[negativePaddingVariableForSide(side)]));
|
|
1978
|
+
var legacyNegativePaddingSides = ["top", "bottom", "left", "right"];
|
|
1979
|
+
var legacyNegativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
|
|
1980
|
+
var legacyNegativePaddingBackgroundVariable = "--orion-negative-padding-background";
|
|
2007
1981
|
var removeGeneratedSelectionMargins = (component) => {
|
|
2008
1982
|
const style = component?.getStyle?.() || {};
|
|
2009
1983
|
const cleanup = {};
|
|
@@ -2017,38 +1991,50 @@ var removeGeneratedSelectionMargins = (component) => {
|
|
|
2017
1991
|
component?.addStyle?.(cleanup);
|
|
2018
1992
|
}
|
|
2019
1993
|
};
|
|
2020
|
-
var
|
|
2021
|
-
|
|
2022
|
-
return;
|
|
2023
|
-
}
|
|
2024
|
-
const property = `margin-${side}`;
|
|
1994
|
+
var stripLegacyNegativePadding = (component) => {
|
|
1995
|
+
const attrs = component?.getAttributes?.() || {};
|
|
2025
1996
|
const style = component?.getStyle?.() || {};
|
|
2026
|
-
const
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
component?.addStyle?.({ [property]: "" });
|
|
2030
|
-
writeStylePanelLength(property, "0px");
|
|
1997
|
+
const hasLegacyNegativePadding = component?.getEl?.()?.classList.contains("orion-builder-v2-negative-padding") || legacyNegativePaddingSides.some((side) => Boolean(attrs[`data-orion-negative-padding-${side}`] || style[`--orion-negative-padding-${side}`]));
|
|
1998
|
+
if (!hasLegacyNegativePadding) {
|
|
1999
|
+
return;
|
|
2031
2000
|
}
|
|
2032
|
-
};
|
|
2033
|
-
var getStoredOrionBackgroundColor = (attrs, style) => {
|
|
2034
2001
|
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
2035
|
-
|
|
2036
|
-
attrs[
|
|
2037
|
-
style[
|
|
2002
|
+
const backgroundColor = firstString(
|
|
2003
|
+
attrs[legacyNegativePaddingBackgroundAttribute],
|
|
2004
|
+
style[legacyNegativePaddingBackgroundVariable],
|
|
2038
2005
|
attrs["data-orion-background-color"],
|
|
2039
2006
|
block.backgroundColor
|
|
2040
2007
|
);
|
|
2008
|
+
const cleanupStyle = {
|
|
2009
|
+
[legacyNegativePaddingBackgroundVariable]: ""
|
|
2010
|
+
};
|
|
2011
|
+
const cleanupAttributes = [legacyNegativePaddingBackgroundAttribute];
|
|
2012
|
+
legacyNegativePaddingSides.forEach((side) => {
|
|
2013
|
+
cleanupStyle[`--orion-negative-padding-${side}`] = "";
|
|
2014
|
+
cleanupAttributes.push(`data-orion-negative-padding-${side}`);
|
|
2015
|
+
component?.removeClass?.(`is-orion-negative-padding-${side}`);
|
|
2016
|
+
});
|
|
2017
|
+
component?.removeClass?.("orion-builder-v2-negative-padding");
|
|
2018
|
+
component?.addStyle?.({
|
|
2019
|
+
...cleanupStyle,
|
|
2020
|
+
...backgroundColor ? { "background-color": backgroundColor } : {}
|
|
2021
|
+
});
|
|
2022
|
+
component?.removeAttributes?.(cleanupAttributes);
|
|
2023
|
+
if (backgroundColor && Object.keys(block).length > 0) {
|
|
2024
|
+
component?.addAttributes?.({
|
|
2025
|
+
"data-orion-background-color": backgroundColor,
|
|
2026
|
+
"data-orion-block": serializeOrionBlockAttribute({
|
|
2027
|
+
...block,
|
|
2028
|
+
backgroundColor
|
|
2029
|
+
})
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
removeGeneratedSelectionMargins(component);
|
|
2041
2033
|
};
|
|
2042
|
-
var
|
|
2034
|
+
var storedOrionBlockBackgroundColor = (component) => {
|
|
2043
2035
|
const attrs = component?.getAttributes?.() || {};
|
|
2044
|
-
const
|
|
2045
|
-
|
|
2046
|
-
return;
|
|
2047
|
-
}
|
|
2048
|
-
const backgroundColor = getStoredOrionBackgroundColor(attrs, style);
|
|
2049
|
-
if (backgroundColor && getStyleColorValue(style, "background-color") !== backgroundColor) {
|
|
2050
|
-
component?.addStyle?.({ "background-color": backgroundColor });
|
|
2051
|
-
}
|
|
2036
|
+
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
2037
|
+
return firstString(attrs["data-orion-background-color"], block.backgroundColor);
|
|
2052
2038
|
};
|
|
2053
2039
|
var spacingTargetForComponent = (component) => {
|
|
2054
2040
|
const element = component?.getEl?.();
|
|
@@ -2241,8 +2227,7 @@ var postToParent = (payload) => {
|
|
|
2241
2227
|
};
|
|
2242
2228
|
var buildSavePayload = (editor, status, projectData) => ({
|
|
2243
2229
|
builderMode: "grapes-v2",
|
|
2244
|
-
compiledCss: scopeBuilderCss(
|
|
2245
|
-
${editor.getCss()}`),
|
|
2230
|
+
compiledCss: scopeBuilderCss(editor.getCss()),
|
|
2246
2231
|
compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
|
|
2247
2232
|
projectData,
|
|
2248
2233
|
status
|
|
@@ -2631,60 +2616,13 @@ function GrapesPageEditor({
|
|
|
2631
2616
|
if (!selected) {
|
|
2632
2617
|
return;
|
|
2633
2618
|
}
|
|
2634
|
-
|
|
2619
|
+
let value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2635
2620
|
selectedComponentRef.current = selected;
|
|
2636
2621
|
lastSelectedComponentRef.current = selected;
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
const attrs = selected.getAttributes?.() || {};
|
|
2642
|
-
const selectedStyle = selected.getStyle?.() || {};
|
|
2643
|
-
const currentNegativePaddingValue = attrs[negativePaddingAttributeForSide(side)] || selectedStyle[negativePaddingVariableForSide(side)];
|
|
2644
|
-
const nextNegativePaddingBySide = Object.fromEntries(
|
|
2645
|
-
negativePaddingSides.map((paddingSide) => [
|
|
2646
|
-
paddingSide,
|
|
2647
|
-
paddingSide === side ? "" : firstString(attrs[negativePaddingAttributeForSide(paddingSide)])
|
|
2648
|
-
])
|
|
2649
|
-
);
|
|
2650
|
-
const hasOtherNegativePadding = negativePaddingSides.some(
|
|
2651
|
-
(paddingSide) => Boolean(nextNegativePaddingBySide[paddingSide])
|
|
2652
|
-
);
|
|
2653
|
-
const negativePaddingBackground = getStoredOrionBackgroundColor(attrs, selectedStyle);
|
|
2654
|
-
selected.removeStyle?.(negativePaddingVariableForSide(side));
|
|
2655
|
-
selected.removeAttributes?.(negativePaddingAttributeForSide(side));
|
|
2656
|
-
selected.removeClass?.(`is-orion-negative-padding-${side}`);
|
|
2657
|
-
removeGeneratedNegativePaddingMargin(selected, side, currentNegativePaddingValue);
|
|
2658
|
-
if (!hasOtherNegativePadding) {
|
|
2659
|
-
if (negativePaddingBackground) {
|
|
2660
|
-
selected.addStyle?.({ "background-color": negativePaddingBackground });
|
|
2661
|
-
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
2662
|
-
if (Object.keys(block).length > 0) {
|
|
2663
|
-
selected.addAttributes?.({
|
|
2664
|
-
"data-orion-background-color": negativePaddingBackground,
|
|
2665
|
-
"data-orion-block": serializeOrionBlockAttribute({
|
|
2666
|
-
...block,
|
|
2667
|
-
backgroundColor: negativePaddingBackground
|
|
2668
|
-
})
|
|
2669
|
-
});
|
|
2670
|
-
}
|
|
2671
|
-
}
|
|
2672
|
-
selected.removeStyle?.(negativePaddingBackgroundVariable);
|
|
2673
|
-
selected.removeAttributes?.(negativePaddingBackgroundAttribute);
|
|
2674
|
-
negativePaddingSides.forEach((paddingSide) => {
|
|
2675
|
-
selected.removeStyle?.(negativePaddingVariableForSide(paddingSide));
|
|
2676
|
-
selected.removeAttributes?.(negativePaddingAttributeForSide(paddingSide));
|
|
2677
|
-
selected.removeClass?.(`is-orion-negative-padding-${paddingSide}`);
|
|
2678
|
-
});
|
|
2679
|
-
selected.removeClass?.("orion-builder-v2-negative-padding");
|
|
2680
|
-
} else if (negativePaddingBackground) {
|
|
2681
|
-
selected.addStyle?.({
|
|
2682
|
-
[negativePaddingBackgroundVariable]: negativePaddingBackground,
|
|
2683
|
-
"background-color": negativePaddingBackground
|
|
2684
|
-
});
|
|
2685
|
-
selected.addAttributes?.({ [negativePaddingBackgroundAttribute]: negativePaddingBackground });
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2622
|
+
stripLegacyNegativePadding(selected);
|
|
2623
|
+
if (property.startsWith("padding-") && String(value).trim().startsWith("-")) {
|
|
2624
|
+
value = "0px";
|
|
2625
|
+
writeStylePanelLength(property, value);
|
|
2688
2626
|
}
|
|
2689
2627
|
selected.addStyle?.({ [property]: value });
|
|
2690
2628
|
editorRef.current?.select?.(selected);
|
|
@@ -2696,11 +2634,10 @@ function GrapesPageEditor({
|
|
|
2696
2634
|
});
|
|
2697
2635
|
}
|
|
2698
2636
|
};
|
|
2699
|
-
const applyNegativeSpacingInput = (property, value
|
|
2637
|
+
const applyNegativeSpacingInput = (property, value) => {
|
|
2700
2638
|
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
2701
|
-
const isPadding = property.startsWith("padding-");
|
|
2702
2639
|
const isMargin = property.startsWith("margin-");
|
|
2703
|
-
if (!selected || !
|
|
2640
|
+
if (!selected || !isMargin || !value.startsWith("-")) {
|
|
2704
2641
|
return;
|
|
2705
2642
|
}
|
|
2706
2643
|
const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
|
|
@@ -2708,38 +2645,11 @@ function GrapesPageEditor({
|
|
|
2708
2645
|
if (!Number.isFinite(adjustment)) {
|
|
2709
2646
|
return;
|
|
2710
2647
|
}
|
|
2711
|
-
const
|
|
2712
|
-
const next = isPadding ? Math.max(0, base + adjustment) : adjustment;
|
|
2713
|
-
const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
|
|
2648
|
+
const styleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
|
|
2714
2649
|
selectedComponentRef.current = selected;
|
|
2715
2650
|
lastSelectedComponentRef.current = selected;
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
|
|
2719
|
-
const currentStyle = selected.getStyle?.() || {};
|
|
2720
|
-
const currentAttributes = selected.getAttributes?.() || {};
|
|
2721
|
-
const backgroundColor = firstString(
|
|
2722
|
-
getStoredOrionBackgroundColor(currentAttributes, currentStyle),
|
|
2723
|
-
getStyleColorValue(currentStyle, "background-color")
|
|
2724
|
-
);
|
|
2725
|
-
selected.addClass?.("orion-builder-v2-negative-padding");
|
|
2726
|
-
selected.addClass?.(`is-orion-negative-padding-${side}`);
|
|
2727
|
-
removeGeneratedSelectionMargins(selected);
|
|
2728
|
-
selected.addAttributes?.({
|
|
2729
|
-
...backgroundColor ? { [negativePaddingBackgroundAttribute]: backgroundColor } : {},
|
|
2730
|
-
[negativePaddingAttributeForSide(side)]: negativeStyleValue
|
|
2731
|
-
});
|
|
2732
|
-
selected.addStyle?.({
|
|
2733
|
-
...backgroundColor ? {
|
|
2734
|
-
[negativePaddingBackgroundVariable]: backgroundColor,
|
|
2735
|
-
"background-color": backgroundColor
|
|
2736
|
-
} : {},
|
|
2737
|
-
[negativePaddingVariableForSide(side)]: negativeStyleValue,
|
|
2738
|
-
[property]: "0px"
|
|
2739
|
-
});
|
|
2740
|
-
} else {
|
|
2741
|
-
selected.addStyle?.({ [property]: styleValue });
|
|
2742
|
-
}
|
|
2651
|
+
stripLegacyNegativePadding(selected);
|
|
2652
|
+
selected.addStyle?.({ [property]: styleValue });
|
|
2743
2653
|
editorRef.current?.select?.(selected);
|
|
2744
2654
|
};
|
|
2745
2655
|
const updateSelectedOrionBlock = (updates) => {
|
|
@@ -2828,10 +2738,8 @@ function GrapesPageEditor({
|
|
|
2828
2738
|
if (Object.keys(block).length === 0) {
|
|
2829
2739
|
return;
|
|
2830
2740
|
}
|
|
2831
|
-
const
|
|
2832
|
-
const
|
|
2833
|
-
const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
|
|
2834
|
-
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : getStyleColorValue(componentStyle || targetStyle, "background-color");
|
|
2741
|
+
const componentStyle = component?.getStyle?.() || target.getStyle?.() || {};
|
|
2742
|
+
const backgroundColor = getStyleColorValue(componentStyle, "background-color");
|
|
2835
2743
|
if (!backgroundColor) {
|
|
2836
2744
|
return;
|
|
2837
2745
|
}
|
|
@@ -2935,15 +2843,14 @@ function GrapesPageEditor({
|
|
|
2935
2843
|
const targetStyle = target.getStyle?.() || {};
|
|
2936
2844
|
const componentStyle = component?.getStyle?.() || targetStyle;
|
|
2937
2845
|
const styleBackgroundColor = getStyleColorValue(componentStyle || targetStyle, "background-color");
|
|
2938
|
-
const
|
|
2939
|
-
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
|
|
2846
|
+
const backgroundColor = normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
|
|
2940
2847
|
if (!backgroundColor) {
|
|
2941
2848
|
return;
|
|
2942
2849
|
}
|
|
2943
|
-
if (
|
|
2850
|
+
if (getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
|
|
2944
2851
|
target.addStyle?.({ "background-color": backgroundColor });
|
|
2945
2852
|
}
|
|
2946
|
-
if (
|
|
2853
|
+
if (component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
|
|
2947
2854
|
component.addStyle?.({ "background-color": backgroundColor });
|
|
2948
2855
|
}
|
|
2949
2856
|
target.addAttributes?.({
|
|
@@ -2969,9 +2876,21 @@ function GrapesPageEditor({
|
|
|
2969
2876
|
if (Object.keys(block).length === 0) {
|
|
2970
2877
|
return;
|
|
2971
2878
|
}
|
|
2879
|
+
stripLegacyNegativePadding(component);
|
|
2972
2880
|
const style = component.getStyle?.() || {};
|
|
2973
|
-
const
|
|
2974
|
-
|
|
2881
|
+
const storedBackgroundColor = firstString(attrs["data-orion-background-color"], block.backgroundColor);
|
|
2882
|
+
if (storedBackgroundColor && getStyleColorValue(style, "background-color") !== storedBackgroundColor) {
|
|
2883
|
+
component.addStyle?.({ "background-color": storedBackgroundColor });
|
|
2884
|
+
component.addAttributes?.({
|
|
2885
|
+
"data-orion-background-color": storedBackgroundColor,
|
|
2886
|
+
"data-orion-block": serializeOrionBlockAttribute({
|
|
2887
|
+
...block,
|
|
2888
|
+
backgroundColor: storedBackgroundColor
|
|
2889
|
+
})
|
|
2890
|
+
});
|
|
2891
|
+
return;
|
|
2892
|
+
}
|
|
2893
|
+
const backgroundColor = getStyleColorValue(style, "background-color");
|
|
2975
2894
|
if (!backgroundColor || normalizeCssColorValue(block.backgroundColor) === backgroundColor && normalizeCssColorValue(attrs["data-orion-background-color"]) === backgroundColor) {
|
|
2976
2895
|
return;
|
|
2977
2896
|
}
|
|
@@ -2987,6 +2906,21 @@ function GrapesPageEditor({
|
|
|
2987
2906
|
syncingOrionBlockStylesRef.current = false;
|
|
2988
2907
|
}
|
|
2989
2908
|
};
|
|
2909
|
+
const hydrateAllOrionBlockBackgroundStyles = () => {
|
|
2910
|
+
const editor = editorRef.current;
|
|
2911
|
+
const wrapper = editor?.DomComponents?.getWrapper?.() || null;
|
|
2912
|
+
const blocks = wrapper?.find?.("[data-orion-block]") || [];
|
|
2913
|
+
blocks.forEach((component) => {
|
|
2914
|
+
stripLegacyNegativePadding(component);
|
|
2915
|
+
const backgroundColor = storedOrionBlockBackgroundColor(component);
|
|
2916
|
+
if (!backgroundColor) {
|
|
2917
|
+
return;
|
|
2918
|
+
}
|
|
2919
|
+
if (getStyleColorValue(component.getStyle?.() || {}, "background-color") !== backgroundColor) {
|
|
2920
|
+
component.addStyle?.({ "background-color": backgroundColor });
|
|
2921
|
+
}
|
|
2922
|
+
});
|
|
2923
|
+
};
|
|
2990
2924
|
const hydrateSelectedTypographyStyleFromOrionBlock = (component) => {
|
|
2991
2925
|
if (!component) {
|
|
2992
2926
|
return;
|
|
@@ -3038,7 +2972,7 @@ function GrapesPageEditor({
|
|
|
3038
2972
|
return;
|
|
3039
2973
|
}
|
|
3040
2974
|
hydrateSelectedTypographyStyleFromOrionBlock(component);
|
|
3041
|
-
|
|
2975
|
+
stripLegacyNegativePadding(component);
|
|
3042
2976
|
rememberComponentSnapshot(component);
|
|
3043
2977
|
markSelectedCanvasBlock(component);
|
|
3044
2978
|
refreshSelectedState(component);
|
|
@@ -3052,18 +2986,8 @@ function GrapesPageEditor({
|
|
|
3052
2986
|
return;
|
|
3053
2987
|
}
|
|
3054
2988
|
const computed = window.getComputedStyle(element);
|
|
3055
|
-
const attrs = component.getAttributes?.() || {};
|
|
3056
2989
|
const style = component.getStyle?.() || {};
|
|
3057
|
-
if (hasNegativePaddingState(attrs, style)) {
|
|
3058
|
-
removeGeneratedSelectionMargins(component);
|
|
3059
|
-
}
|
|
3060
2990
|
spacingProperties.forEach((property) => {
|
|
3061
|
-
const negativePaddingSide = negativePaddingSideFromProperty(property);
|
|
3062
|
-
const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
|
|
3063
|
-
if (negativePaddingValue) {
|
|
3064
|
-
writeStylePanelLength(property, negativePaddingValue);
|
|
3065
|
-
return;
|
|
3066
|
-
}
|
|
3067
2991
|
if (property.startsWith("margin-")) {
|
|
3068
2992
|
writeStylePanelLength(property, firstString(style[property], "0px"));
|
|
3069
2993
|
return;
|
|
@@ -3552,6 +3476,8 @@ function GrapesPageEditor({
|
|
|
3552
3476
|
registerProjectDynamicComponents(editor, adapter);
|
|
3553
3477
|
historyReadyRef.current = false;
|
|
3554
3478
|
editor.loadProjectData(projectData);
|
|
3479
|
+
hydrateAllOrionBlockBackgroundStyles();
|
|
3480
|
+
window.requestAnimationFrame(() => hydrateAllOrionBlockBackgroundStyles());
|
|
3555
3481
|
void loadPayloadMediaAssets(editor);
|
|
3556
3482
|
window.setTimeout(() => {
|
|
3557
3483
|
customUndoStackRef.current = [];
|
|
@@ -3914,7 +3840,7 @@ function GrapesPageEditor({
|
|
|
3914
3840
|
if (!detail.property || !detail.value) {
|
|
3915
3841
|
return;
|
|
3916
3842
|
}
|
|
3917
|
-
applyNegativeSpacingInput(detail.property, detail.value
|
|
3843
|
+
applyNegativeSpacingInput(detail.property, detail.value);
|
|
3918
3844
|
};
|
|
3919
3845
|
const observer = new MutationObserver(() => {
|
|
3920
3846
|
decorateBuilderControls();
|
|
@@ -1036,7 +1036,8 @@ var registerProjectDynamicComponents = (editor, adapter) => {
|
|
|
1036
1036
|
const props = propsFromAttributes(attributes);
|
|
1037
1037
|
withoutUndoTracking(editor, () => {
|
|
1038
1038
|
const backgroundColor = defaultBackgroundForComponent(type, props);
|
|
1039
|
-
|
|
1039
|
+
const currentBackgroundColor = normalizeCssColor(this.model.getStyle?.()?.["background-color"]);
|
|
1040
|
+
if (backgroundColor && currentBackgroundColor !== backgroundColor) {
|
|
1040
1041
|
this.model.addStyle?.({ "background-color": backgroundColor });
|
|
1041
1042
|
this.model.addAttributes?.({ "data-orion-background-color": backgroundColor });
|
|
1042
1043
|
}
|
|
@@ -1649,22 +1650,7 @@ var quickVerticalAlignStyles = {
|
|
|
1649
1650
|
middle: "center",
|
|
1650
1651
|
top: "flex-start"
|
|
1651
1652
|
};
|
|
1652
|
-
var negativePaddingCss = `
|
|
1653
|
-
.orion-builder-v2-negative-padding {
|
|
1654
|
-
display: flow-root;
|
|
1655
|
-
margin-top: var(--orion-negative-padding-top, 0px) !important;
|
|
1656
|
-
margin-right: var(--orion-negative-padding-right, 0px) !important;
|
|
1657
|
-
margin-bottom: var(--orion-negative-padding-bottom, 0px) !important;
|
|
1658
|
-
margin-left: var(--orion-negative-padding-left, 0px) !important;
|
|
1659
|
-
max-width: none !important;
|
|
1660
|
-
overflow: visible;
|
|
1661
|
-
position: relative;
|
|
1662
|
-
width: calc(100% - var(--orion-negative-padding-left, 0px) - var(--orion-negative-padding-right, 0px)) !important;
|
|
1663
|
-
}
|
|
1664
|
-
`;
|
|
1665
1653
|
var canvasSelectionCss = `
|
|
1666
|
-
${negativePaddingCss}
|
|
1667
|
-
|
|
1668
1654
|
.gjs-selected,
|
|
1669
1655
|
[data-gjs-highlightable].gjs-selected {
|
|
1670
1656
|
outline-color: #c7643d !important;
|
|
@@ -1833,14 +1819,6 @@ var readStylePanelColor = (property) => {
|
|
|
1833
1819
|
return swatchColor;
|
|
1834
1820
|
};
|
|
1835
1821
|
var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
|
|
1836
|
-
var cssPixelValue = (value) => {
|
|
1837
|
-
const match = value.trim().match(/^(-?\d*\.?\d+)(px)?$/i);
|
|
1838
|
-
if (!match) {
|
|
1839
|
-
return null;
|
|
1840
|
-
}
|
|
1841
|
-
const parsed = Number.parseFloat(match[1]);
|
|
1842
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
1843
|
-
};
|
|
1844
1822
|
var propertyNameFromStyleControl = (element) => {
|
|
1845
1823
|
const property = element?.closest(".gjs-sm-property");
|
|
1846
1824
|
const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
|
|
@@ -1873,13 +1851,9 @@ var spacingProperties = [
|
|
|
1873
1851
|
"padding-left",
|
|
1874
1852
|
"padding-right"
|
|
1875
1853
|
];
|
|
1876
|
-
var
|
|
1877
|
-
var
|
|
1878
|
-
var
|
|
1879
|
-
var negativePaddingVariableForSide = (side) => `--orion-negative-padding-${side}`;
|
|
1880
|
-
var negativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
|
|
1881
|
-
var negativePaddingBackgroundVariable = "--orion-negative-padding-background";
|
|
1882
|
-
var hasNegativePaddingState = (attrs, style) => negativePaddingSides.some((side) => Boolean(attrs[negativePaddingAttributeForSide(side)] || style[negativePaddingVariableForSide(side)]));
|
|
1854
|
+
var legacyNegativePaddingSides = ["top", "bottom", "left", "right"];
|
|
1855
|
+
var legacyNegativePaddingBackgroundAttribute = "data-orion-negative-padding-background";
|
|
1856
|
+
var legacyNegativePaddingBackgroundVariable = "--orion-negative-padding-background";
|
|
1883
1857
|
var removeGeneratedSelectionMargins = (component) => {
|
|
1884
1858
|
const style = component?.getStyle?.() || {};
|
|
1885
1859
|
const cleanup = {};
|
|
@@ -1893,38 +1867,50 @@ var removeGeneratedSelectionMargins = (component) => {
|
|
|
1893
1867
|
component?.addStyle?.(cleanup);
|
|
1894
1868
|
}
|
|
1895
1869
|
};
|
|
1896
|
-
var
|
|
1897
|
-
|
|
1898
|
-
return;
|
|
1899
|
-
}
|
|
1900
|
-
const property = `margin-${side}`;
|
|
1870
|
+
var stripLegacyNegativePadding = (component) => {
|
|
1871
|
+
const attrs = component?.getAttributes?.() || {};
|
|
1901
1872
|
const style = component?.getStyle?.() || {};
|
|
1902
|
-
const
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
component?.addStyle?.({ [property]: "" });
|
|
1906
|
-
writeStylePanelLength(property, "0px");
|
|
1873
|
+
const hasLegacyNegativePadding = component?.getEl?.()?.classList.contains("orion-builder-v2-negative-padding") || legacyNegativePaddingSides.some((side) => Boolean(attrs[`data-orion-negative-padding-${side}`] || style[`--orion-negative-padding-${side}`]));
|
|
1874
|
+
if (!hasLegacyNegativePadding) {
|
|
1875
|
+
return;
|
|
1907
1876
|
}
|
|
1908
|
-
};
|
|
1909
|
-
var getStoredOrionBackgroundColor = (attrs, style) => {
|
|
1910
1877
|
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
1911
|
-
|
|
1912
|
-
attrs[
|
|
1913
|
-
style[
|
|
1878
|
+
const backgroundColor = firstString(
|
|
1879
|
+
attrs[legacyNegativePaddingBackgroundAttribute],
|
|
1880
|
+
style[legacyNegativePaddingBackgroundVariable],
|
|
1914
1881
|
attrs["data-orion-background-color"],
|
|
1915
1882
|
block.backgroundColor
|
|
1916
1883
|
);
|
|
1884
|
+
const cleanupStyle = {
|
|
1885
|
+
[legacyNegativePaddingBackgroundVariable]: ""
|
|
1886
|
+
};
|
|
1887
|
+
const cleanupAttributes = [legacyNegativePaddingBackgroundAttribute];
|
|
1888
|
+
legacyNegativePaddingSides.forEach((side) => {
|
|
1889
|
+
cleanupStyle[`--orion-negative-padding-${side}`] = "";
|
|
1890
|
+
cleanupAttributes.push(`data-orion-negative-padding-${side}`);
|
|
1891
|
+
component?.removeClass?.(`is-orion-negative-padding-${side}`);
|
|
1892
|
+
});
|
|
1893
|
+
component?.removeClass?.("orion-builder-v2-negative-padding");
|
|
1894
|
+
component?.addStyle?.({
|
|
1895
|
+
...cleanupStyle,
|
|
1896
|
+
...backgroundColor ? { "background-color": backgroundColor } : {}
|
|
1897
|
+
});
|
|
1898
|
+
component?.removeAttributes?.(cleanupAttributes);
|
|
1899
|
+
if (backgroundColor && Object.keys(block).length > 0) {
|
|
1900
|
+
component?.addAttributes?.({
|
|
1901
|
+
"data-orion-background-color": backgroundColor,
|
|
1902
|
+
"data-orion-block": serializeOrionBlockAttribute({
|
|
1903
|
+
...block,
|
|
1904
|
+
backgroundColor
|
|
1905
|
+
})
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
removeGeneratedSelectionMargins(component);
|
|
1917
1909
|
};
|
|
1918
|
-
var
|
|
1910
|
+
var storedOrionBlockBackgroundColor = (component) => {
|
|
1919
1911
|
const attrs = component?.getAttributes?.() || {};
|
|
1920
|
-
const
|
|
1921
|
-
|
|
1922
|
-
return;
|
|
1923
|
-
}
|
|
1924
|
-
const backgroundColor = getStoredOrionBackgroundColor(attrs, style);
|
|
1925
|
-
if (backgroundColor && getStyleColorValue(style, "background-color") !== backgroundColor) {
|
|
1926
|
-
component?.addStyle?.({ "background-color": backgroundColor });
|
|
1927
|
-
}
|
|
1912
|
+
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
1913
|
+
return firstString(attrs["data-orion-background-color"], block.backgroundColor);
|
|
1928
1914
|
};
|
|
1929
1915
|
var spacingTargetForComponent = (component) => {
|
|
1930
1916
|
const element = component?.getEl?.();
|
|
@@ -2117,8 +2103,7 @@ var postToParent = (payload) => {
|
|
|
2117
2103
|
};
|
|
2118
2104
|
var buildSavePayload = (editor, status, projectData) => ({
|
|
2119
2105
|
builderMode: "grapes-v2",
|
|
2120
|
-
compiledCss: scopeBuilderCss(
|
|
2121
|
-
${editor.getCss()}`),
|
|
2106
|
+
compiledCss: scopeBuilderCss(editor.getCss()),
|
|
2122
2107
|
compiledHtml: sanitizeBuilderHtml(editor.getHtml()),
|
|
2123
2108
|
projectData,
|
|
2124
2109
|
status
|
|
@@ -2507,60 +2492,13 @@ function GrapesPageEditor({
|
|
|
2507
2492
|
if (!selected) {
|
|
2508
2493
|
return;
|
|
2509
2494
|
}
|
|
2510
|
-
|
|
2495
|
+
let value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
|
|
2511
2496
|
selectedComponentRef.current = selected;
|
|
2512
2497
|
lastSelectedComponentRef.current = selected;
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
const attrs = selected.getAttributes?.() || {};
|
|
2518
|
-
const selectedStyle = selected.getStyle?.() || {};
|
|
2519
|
-
const currentNegativePaddingValue = attrs[negativePaddingAttributeForSide(side)] || selectedStyle[negativePaddingVariableForSide(side)];
|
|
2520
|
-
const nextNegativePaddingBySide = Object.fromEntries(
|
|
2521
|
-
negativePaddingSides.map((paddingSide) => [
|
|
2522
|
-
paddingSide,
|
|
2523
|
-
paddingSide === side ? "" : firstString(attrs[negativePaddingAttributeForSide(paddingSide)])
|
|
2524
|
-
])
|
|
2525
|
-
);
|
|
2526
|
-
const hasOtherNegativePadding = negativePaddingSides.some(
|
|
2527
|
-
(paddingSide) => Boolean(nextNegativePaddingBySide[paddingSide])
|
|
2528
|
-
);
|
|
2529
|
-
const negativePaddingBackground = getStoredOrionBackgroundColor(attrs, selectedStyle);
|
|
2530
|
-
selected.removeStyle?.(negativePaddingVariableForSide(side));
|
|
2531
|
-
selected.removeAttributes?.(negativePaddingAttributeForSide(side));
|
|
2532
|
-
selected.removeClass?.(`is-orion-negative-padding-${side}`);
|
|
2533
|
-
removeGeneratedNegativePaddingMargin(selected, side, currentNegativePaddingValue);
|
|
2534
|
-
if (!hasOtherNegativePadding) {
|
|
2535
|
-
if (negativePaddingBackground) {
|
|
2536
|
-
selected.addStyle?.({ "background-color": negativePaddingBackground });
|
|
2537
|
-
const block = parseOrionBlockAttribute(attrs["data-orion-block"]);
|
|
2538
|
-
if (Object.keys(block).length > 0) {
|
|
2539
|
-
selected.addAttributes?.({
|
|
2540
|
-
"data-orion-background-color": negativePaddingBackground,
|
|
2541
|
-
"data-orion-block": serializeOrionBlockAttribute({
|
|
2542
|
-
...block,
|
|
2543
|
-
backgroundColor: negativePaddingBackground
|
|
2544
|
-
})
|
|
2545
|
-
});
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
selected.removeStyle?.(negativePaddingBackgroundVariable);
|
|
2549
|
-
selected.removeAttributes?.(negativePaddingBackgroundAttribute);
|
|
2550
|
-
negativePaddingSides.forEach((paddingSide) => {
|
|
2551
|
-
selected.removeStyle?.(negativePaddingVariableForSide(paddingSide));
|
|
2552
|
-
selected.removeAttributes?.(negativePaddingAttributeForSide(paddingSide));
|
|
2553
|
-
selected.removeClass?.(`is-orion-negative-padding-${paddingSide}`);
|
|
2554
|
-
});
|
|
2555
|
-
selected.removeClass?.("orion-builder-v2-negative-padding");
|
|
2556
|
-
} else if (negativePaddingBackground) {
|
|
2557
|
-
selected.addStyle?.({
|
|
2558
|
-
[negativePaddingBackgroundVariable]: negativePaddingBackground,
|
|
2559
|
-
"background-color": negativePaddingBackground
|
|
2560
|
-
});
|
|
2561
|
-
selected.addAttributes?.({ [negativePaddingBackgroundAttribute]: negativePaddingBackground });
|
|
2562
|
-
}
|
|
2563
|
-
}
|
|
2498
|
+
stripLegacyNegativePadding(selected);
|
|
2499
|
+
if (property.startsWith("padding-") && String(value).trim().startsWith("-")) {
|
|
2500
|
+
value = "0px";
|
|
2501
|
+
writeStylePanelLength(property, value);
|
|
2564
2502
|
}
|
|
2565
2503
|
selected.addStyle?.({ [property]: value });
|
|
2566
2504
|
editorRef.current?.select?.(selected);
|
|
@@ -2572,11 +2510,10 @@ function GrapesPageEditor({
|
|
|
2572
2510
|
});
|
|
2573
2511
|
}
|
|
2574
2512
|
};
|
|
2575
|
-
const applyNegativeSpacingInput = (property, value
|
|
2513
|
+
const applyNegativeSpacingInput = (property, value) => {
|
|
2576
2514
|
const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
|
|
2577
|
-
const isPadding = property.startsWith("padding-");
|
|
2578
2515
|
const isMargin = property.startsWith("margin-");
|
|
2579
|
-
if (!selected || !
|
|
2516
|
+
if (!selected || !isMargin || !value.startsWith("-")) {
|
|
2580
2517
|
return;
|
|
2581
2518
|
}
|
|
2582
2519
|
const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
|
|
@@ -2584,38 +2521,11 @@ function GrapesPageEditor({
|
|
|
2584
2521
|
if (!Number.isFinite(adjustment)) {
|
|
2585
2522
|
return;
|
|
2586
2523
|
}
|
|
2587
|
-
const
|
|
2588
|
-
const next = isPadding ? Math.max(0, base + adjustment) : adjustment;
|
|
2589
|
-
const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
|
|
2524
|
+
const styleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
|
|
2590
2525
|
selectedComponentRef.current = selected;
|
|
2591
2526
|
lastSelectedComponentRef.current = selected;
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
const negativeStyleValue = `${Number.isInteger(adjustment) ? adjustment : Number(adjustment.toFixed(2))}${unit}`;
|
|
2595
|
-
const currentStyle = selected.getStyle?.() || {};
|
|
2596
|
-
const currentAttributes = selected.getAttributes?.() || {};
|
|
2597
|
-
const backgroundColor = firstString(
|
|
2598
|
-
getStoredOrionBackgroundColor(currentAttributes, currentStyle),
|
|
2599
|
-
getStyleColorValue(currentStyle, "background-color")
|
|
2600
|
-
);
|
|
2601
|
-
selected.addClass?.("orion-builder-v2-negative-padding");
|
|
2602
|
-
selected.addClass?.(`is-orion-negative-padding-${side}`);
|
|
2603
|
-
removeGeneratedSelectionMargins(selected);
|
|
2604
|
-
selected.addAttributes?.({
|
|
2605
|
-
...backgroundColor ? { [negativePaddingBackgroundAttribute]: backgroundColor } : {},
|
|
2606
|
-
[negativePaddingAttributeForSide(side)]: negativeStyleValue
|
|
2607
|
-
});
|
|
2608
|
-
selected.addStyle?.({
|
|
2609
|
-
...backgroundColor ? {
|
|
2610
|
-
[negativePaddingBackgroundVariable]: backgroundColor,
|
|
2611
|
-
"background-color": backgroundColor
|
|
2612
|
-
} : {},
|
|
2613
|
-
[negativePaddingVariableForSide(side)]: negativeStyleValue,
|
|
2614
|
-
[property]: "0px"
|
|
2615
|
-
});
|
|
2616
|
-
} else {
|
|
2617
|
-
selected.addStyle?.({ [property]: styleValue });
|
|
2618
|
-
}
|
|
2527
|
+
stripLegacyNegativePadding(selected);
|
|
2528
|
+
selected.addStyle?.({ [property]: styleValue });
|
|
2619
2529
|
editorRef.current?.select?.(selected);
|
|
2620
2530
|
};
|
|
2621
2531
|
const updateSelectedOrionBlock = (updates) => {
|
|
@@ -2704,10 +2614,8 @@ function GrapesPageEditor({
|
|
|
2704
2614
|
if (Object.keys(block).length === 0) {
|
|
2705
2615
|
return;
|
|
2706
2616
|
}
|
|
2707
|
-
const
|
|
2708
|
-
const
|
|
2709
|
-
const negativePaddingActive = hasNegativePaddingState(attrs, targetStyle) || hasNegativePaddingState(attrs, componentStyle);
|
|
2710
|
-
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : getStyleColorValue(componentStyle || targetStyle, "background-color");
|
|
2617
|
+
const componentStyle = component?.getStyle?.() || target.getStyle?.() || {};
|
|
2618
|
+
const backgroundColor = getStyleColorValue(componentStyle, "background-color");
|
|
2711
2619
|
if (!backgroundColor) {
|
|
2712
2620
|
return;
|
|
2713
2621
|
}
|
|
@@ -2811,15 +2719,14 @@ function GrapesPageEditor({
|
|
|
2811
2719
|
const targetStyle = target.getStyle?.() || {};
|
|
2812
2720
|
const componentStyle = component?.getStyle?.() || targetStyle;
|
|
2813
2721
|
const styleBackgroundColor = getStyleColorValue(componentStyle || targetStyle, "background-color");
|
|
2814
|
-
const
|
|
2815
|
-
const backgroundColor = negativePaddingActive ? getStoredOrionBackgroundColor(attrs, targetStyle) || getStoredOrionBackgroundColor(attrs, componentStyle) : normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
|
|
2722
|
+
const backgroundColor = normalizeCssColorValue(panelBackgroundColor === "none" ? "" : panelBackgroundColor) || styleBackgroundColor;
|
|
2816
2723
|
if (!backgroundColor) {
|
|
2817
2724
|
return;
|
|
2818
2725
|
}
|
|
2819
|
-
if (
|
|
2726
|
+
if (getStyleColorValue(targetStyle, "background-color") !== backgroundColor) {
|
|
2820
2727
|
target.addStyle?.({ "background-color": backgroundColor });
|
|
2821
2728
|
}
|
|
2822
|
-
if (
|
|
2729
|
+
if (component && component !== target && getStyleColorValue(componentStyle, "background-color") !== backgroundColor) {
|
|
2823
2730
|
component.addStyle?.({ "background-color": backgroundColor });
|
|
2824
2731
|
}
|
|
2825
2732
|
target.addAttributes?.({
|
|
@@ -2845,9 +2752,21 @@ function GrapesPageEditor({
|
|
|
2845
2752
|
if (Object.keys(block).length === 0) {
|
|
2846
2753
|
return;
|
|
2847
2754
|
}
|
|
2755
|
+
stripLegacyNegativePadding(component);
|
|
2848
2756
|
const style = component.getStyle?.() || {};
|
|
2849
|
-
const
|
|
2850
|
-
|
|
2757
|
+
const storedBackgroundColor = firstString(attrs["data-orion-background-color"], block.backgroundColor);
|
|
2758
|
+
if (storedBackgroundColor && getStyleColorValue(style, "background-color") !== storedBackgroundColor) {
|
|
2759
|
+
component.addStyle?.({ "background-color": storedBackgroundColor });
|
|
2760
|
+
component.addAttributes?.({
|
|
2761
|
+
"data-orion-background-color": storedBackgroundColor,
|
|
2762
|
+
"data-orion-block": serializeOrionBlockAttribute({
|
|
2763
|
+
...block,
|
|
2764
|
+
backgroundColor: storedBackgroundColor
|
|
2765
|
+
})
|
|
2766
|
+
});
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
const backgroundColor = getStyleColorValue(style, "background-color");
|
|
2851
2770
|
if (!backgroundColor || normalizeCssColorValue(block.backgroundColor) === backgroundColor && normalizeCssColorValue(attrs["data-orion-background-color"]) === backgroundColor) {
|
|
2852
2771
|
return;
|
|
2853
2772
|
}
|
|
@@ -2863,6 +2782,21 @@ function GrapesPageEditor({
|
|
|
2863
2782
|
syncingOrionBlockStylesRef.current = false;
|
|
2864
2783
|
}
|
|
2865
2784
|
};
|
|
2785
|
+
const hydrateAllOrionBlockBackgroundStyles = () => {
|
|
2786
|
+
const editor = editorRef.current;
|
|
2787
|
+
const wrapper = editor?.DomComponents?.getWrapper?.() || null;
|
|
2788
|
+
const blocks = wrapper?.find?.("[data-orion-block]") || [];
|
|
2789
|
+
blocks.forEach((component) => {
|
|
2790
|
+
stripLegacyNegativePadding(component);
|
|
2791
|
+
const backgroundColor = storedOrionBlockBackgroundColor(component);
|
|
2792
|
+
if (!backgroundColor) {
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
if (getStyleColorValue(component.getStyle?.() || {}, "background-color") !== backgroundColor) {
|
|
2796
|
+
component.addStyle?.({ "background-color": backgroundColor });
|
|
2797
|
+
}
|
|
2798
|
+
});
|
|
2799
|
+
};
|
|
2866
2800
|
const hydrateSelectedTypographyStyleFromOrionBlock = (component) => {
|
|
2867
2801
|
if (!component) {
|
|
2868
2802
|
return;
|
|
@@ -2914,7 +2848,7 @@ function GrapesPageEditor({
|
|
|
2914
2848
|
return;
|
|
2915
2849
|
}
|
|
2916
2850
|
hydrateSelectedTypographyStyleFromOrionBlock(component);
|
|
2917
|
-
|
|
2851
|
+
stripLegacyNegativePadding(component);
|
|
2918
2852
|
rememberComponentSnapshot(component);
|
|
2919
2853
|
markSelectedCanvasBlock(component);
|
|
2920
2854
|
refreshSelectedState(component);
|
|
@@ -2928,18 +2862,8 @@ function GrapesPageEditor({
|
|
|
2928
2862
|
return;
|
|
2929
2863
|
}
|
|
2930
2864
|
const computed = window.getComputedStyle(element);
|
|
2931
|
-
const attrs = component.getAttributes?.() || {};
|
|
2932
2865
|
const style = component.getStyle?.() || {};
|
|
2933
|
-
if (hasNegativePaddingState(attrs, style)) {
|
|
2934
|
-
removeGeneratedSelectionMargins(component);
|
|
2935
|
-
}
|
|
2936
2866
|
spacingProperties.forEach((property) => {
|
|
2937
|
-
const negativePaddingSide = negativePaddingSideFromProperty(property);
|
|
2938
|
-
const negativePaddingValue = negativePaddingSide ? firstString(attrs[negativePaddingAttributeForSide(negativePaddingSide)]) : "";
|
|
2939
|
-
if (negativePaddingValue) {
|
|
2940
|
-
writeStylePanelLength(property, negativePaddingValue);
|
|
2941
|
-
return;
|
|
2942
|
-
}
|
|
2943
2867
|
if (property.startsWith("margin-")) {
|
|
2944
2868
|
writeStylePanelLength(property, firstString(style[property], "0px"));
|
|
2945
2869
|
return;
|
|
@@ -3428,6 +3352,8 @@ function GrapesPageEditor({
|
|
|
3428
3352
|
registerProjectDynamicComponents(editor, adapter);
|
|
3429
3353
|
historyReadyRef.current = false;
|
|
3430
3354
|
editor.loadProjectData(projectData);
|
|
3355
|
+
hydrateAllOrionBlockBackgroundStyles();
|
|
3356
|
+
window.requestAnimationFrame(() => hydrateAllOrionBlockBackgroundStyles());
|
|
3431
3357
|
void loadPayloadMediaAssets(editor);
|
|
3432
3358
|
window.setTimeout(() => {
|
|
3433
3359
|
customUndoStackRef.current = [];
|
|
@@ -3790,7 +3716,7 @@ function GrapesPageEditor({
|
|
|
3790
3716
|
if (!detail.property || !detail.value) {
|
|
3791
3717
|
return;
|
|
3792
3718
|
}
|
|
3793
|
-
applyNegativeSpacingInput(detail.property, detail.value
|
|
3719
|
+
applyNegativeSpacingInput(detail.property, detail.value);
|
|
3794
3720
|
};
|
|
3795
3721
|
const observer = new MutationObserver(() => {
|
|
3796
3722
|
decorateBuilderControls();
|
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
admin_exports
|
|
3
3
|
} from "./chunk-KHK6RTGC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
blocks_exports
|
|
6
|
+
} from "./chunk-JQAHXYAM.mjs";
|
|
4
7
|
import {
|
|
5
8
|
nextjs_exports
|
|
6
9
|
} from "./chunk-ZADL33R6.mjs";
|
|
7
10
|
import "./chunk-ZTXJG4K5.mjs";
|
|
8
11
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
admin_app_exports
|
|
13
|
+
} from "./chunk-RKTIFEUY.mjs";
|
|
14
|
+
import "./chunk-W2UOCJDX.mjs";
|
|
11
15
|
import {
|
|
12
16
|
studio_pages_exports
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-7ZMXZRBP.mjs";
|
|
17
|
+
} from "./chunk-NGLIA2OE.mjs";
|
|
15
18
|
import "./chunk-OQSEJXC4.mjs";
|
|
19
|
+
import "./chunk-7ZMXZRBP.mjs";
|
|
16
20
|
import {
|
|
17
21
|
studio_exports
|
|
18
22
|
} from "./chunk-ADIIWIYL.mjs";
|
|
19
|
-
import {
|
|
20
|
-
admin_app_exports
|
|
21
|
-
} from "./chunk-RKTIFEUY.mjs";
|
|
22
|
-
import "./chunk-W2UOCJDX.mjs";
|
|
23
23
|
import "./chunk-6BWS3CLP.mjs";
|
|
24
24
|
export {
|
|
25
25
|
admin_exports as admin,
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
pageStudioModuleManifest,
|
|
8
8
|
resolveBuilderThemeTokens,
|
|
9
9
|
toEditorInitialDoc
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-NGLIA2OE.mjs";
|
|
11
|
+
import "../chunk-OQSEJXC4.mjs";
|
|
11
12
|
import {
|
|
12
13
|
createDefaultStudioDocument,
|
|
13
14
|
defaultBuilderThemeTokens,
|
|
14
15
|
layoutToStudioDocument,
|
|
15
16
|
studioDocumentToLayout
|
|
16
17
|
} from "../chunk-7ZMXZRBP.mjs";
|
|
17
|
-
import "../chunk-OQSEJXC4.mjs";
|
|
18
18
|
import "../chunk-ADIIWIYL.mjs";
|
|
19
19
|
import "../chunk-6BWS3CLP.mjs";
|
|
20
20
|
export {
|
package/package.json
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sectionStyleDefaults
|
|
3
|
+
} from "./chunk-OQSEJXC4.mjs";
|
|
1
4
|
import {
|
|
2
5
|
createDefaultStudioDocument,
|
|
3
6
|
defaultBuilderThemeTokens,
|
|
@@ -5,9 +8,6 @@ import {
|
|
|
5
8
|
migrateBlockToSettingsV2,
|
|
6
9
|
studioDocumentToLayout
|
|
7
10
|
} from "./chunk-7ZMXZRBP.mjs";
|
|
8
|
-
import {
|
|
9
|
-
sectionStyleDefaults
|
|
10
|
-
} from "./chunk-OQSEJXC4.mjs";
|
|
11
11
|
import {
|
|
12
12
|
assertStudioDocumentV1,
|
|
13
13
|
compileStudioDocument,
|