@g1cloud/page-builder-editor 1.0.0-alpha.33 → 1.0.0-alpha.35
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.
- package/css/page-page.scss +3 -7
- package/css/page-section.scss +1 -0
- package/dist/{PbPropertyEditorColor-Btwd1WP_.js → PbPropertyEditorColor-Cb7qpN96.js} +1 -1
- package/dist/{PbPropertyEditorHtml-DQpflvo0.js → PbPropertyEditorHtml-DRmHv8Gm.js} +1 -1
- package/dist/{PbPropertyEditorImage-BV2SeGBT.js → PbPropertyEditorImage-BG7rGnU3.js} +1 -1
- package/dist/{PbPropertyEditorMultilineText-RrUB1pI3.js → PbPropertyEditorMultilineText-BqEprlZ-.js} +1 -1
- package/dist/{PbPropertyEditorText-tvKIJh2H.js → PbPropertyEditorText-bXscT9jE.js} +1 -1
- package/dist/{PbPropertyEditorYoutube-Bcq06f0I.js → PbPropertyEditorYoutube-Bz_UU0kC.js} +1 -1
- package/dist/{PbWidgetAddModal-Ca9HNoSU.js → PbWidgetAddModal-Cfhjs6Z4.js} +1 -1
- package/dist/components/part/PbBlock.vue.d.ts +2 -0
- package/dist/components/part/PbSection.vue.d.ts +2 -0
- package/dist/{index-B8JifwHW.js → index-EsPg-Em5.js} +313 -132
- package/dist/model/context.d.ts +6 -0
- package/dist/model/default-part-property-group.d.ts +2 -0
- package/dist/page-builder-editor.js +1 -1
- package/dist/page-builder-editor.umd.cjs +306 -125
- package/package.json +3 -3
|
@@ -6670,6 +6670,24 @@ class Part {
|
|
|
6670
6670
|
isNestedWidget() {
|
|
6671
6671
|
return false;
|
|
6672
6672
|
}
|
|
6673
|
+
isParentOf(part) {
|
|
6674
|
+
if (!part) return false;
|
|
6675
|
+
let parent = part.parent;
|
|
6676
|
+
while (parent) {
|
|
6677
|
+
if (parent === this || parent.partId === this.partId) return true;
|
|
6678
|
+
parent = parent.parent;
|
|
6679
|
+
}
|
|
6680
|
+
return false;
|
|
6681
|
+
}
|
|
6682
|
+
isChildOf(part) {
|
|
6683
|
+
if (!part) return false;
|
|
6684
|
+
let parent = this.parent;
|
|
6685
|
+
while (parent) {
|
|
6686
|
+
if (parent === part || parent.partId === part.partId) return true;
|
|
6687
|
+
parent = parent.parent;
|
|
6688
|
+
}
|
|
6689
|
+
return false;
|
|
6690
|
+
}
|
|
6673
6691
|
getName() {
|
|
6674
6692
|
var _a;
|
|
6675
6693
|
return (_a = this.properties) == null ? void 0 : _a.name;
|
|
@@ -6683,80 +6701,87 @@ class Part {
|
|
|
6683
6701
|
return ((_a = this.properties) == null ? void 0 : _a.classNames) || "";
|
|
6684
6702
|
}
|
|
6685
6703
|
getAlignStyleValue(align) {
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6704
|
+
switch (align) {
|
|
6705
|
+
case "start":
|
|
6706
|
+
return "flex-start";
|
|
6707
|
+
case "end":
|
|
6708
|
+
return "flex-end";
|
|
6709
|
+
case "center":
|
|
6710
|
+
return "center";
|
|
6711
|
+
case "between":
|
|
6712
|
+
return "space-between";
|
|
6713
|
+
default:
|
|
6714
|
+
return;
|
|
6715
|
+
}
|
|
6689
6716
|
}
|
|
6690
6717
|
getStyles(isMobilePage) {
|
|
6691
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P;
|
|
6718
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q;
|
|
6692
6719
|
const style = {};
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
style.alignSelf = this.getAlignStyleValue(align);
|
|
6696
|
-
} else if (this.isPage()) {
|
|
6697
|
-
style.display = "flex";
|
|
6698
|
-
style.flexDirection = "column";
|
|
6699
|
-
style.alignItems = this.getAlignStyleValue(align);
|
|
6720
|
+
if (((_a = this.properties) == null ? void 0 : _a.direction) === "horizontal") {
|
|
6721
|
+
style.flexDirection = "row";
|
|
6700
6722
|
} else {
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
style.flexDirection = "row";
|
|
6705
|
-
style.justifyContent = this.getAlignStyleValue(align);
|
|
6706
|
-
} else if (direction === "vertical") {
|
|
6707
|
-
style.display = "flex";
|
|
6708
|
-
style.flexDirection = "column";
|
|
6709
|
-
style.alignItems = this.getAlignStyleValue(align);
|
|
6710
|
-
}
|
|
6711
|
-
}
|
|
6712
|
-
if (((_d = this.properties) == null ? void 0 : _d.wrap) === "wrap") {
|
|
6723
|
+
style.flexDirection = "column";
|
|
6724
|
+
}
|
|
6725
|
+
if (((_b = this.properties) == null ? void 0 : _b.wrap) === "wrap") {
|
|
6713
6726
|
style.flexWrap = "wrap";
|
|
6714
6727
|
}
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
if (
|
|
6719
|
-
|
|
6720
|
-
if (
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
if ((
|
|
6728
|
-
if ((
|
|
6729
|
-
if ((
|
|
6730
|
-
if ((
|
|
6731
|
-
if ((
|
|
6732
|
-
if ((
|
|
6733
|
-
if ((
|
|
6734
|
-
if ((
|
|
6735
|
-
if ((
|
|
6736
|
-
if ((
|
|
6737
|
-
if ((
|
|
6738
|
-
if ((
|
|
6739
|
-
if ((
|
|
6740
|
-
if ((
|
|
6741
|
-
if ((
|
|
6742
|
-
if ((
|
|
6743
|
-
if ((
|
|
6744
|
-
if ((
|
|
6745
|
-
if ((
|
|
6728
|
+
const alignItems = this.getAlignStyleValue((_c = this.properties) == null ? void 0 : _c.alignItems);
|
|
6729
|
+
const justifyContent = this.getAlignStyleValue((_d = this.properties) == null ? void 0 : _d.justifyContent);
|
|
6730
|
+
const alignSelf = this.getAlignStyleValue((_e = this.properties) == null ? void 0 : _e.alignSelf);
|
|
6731
|
+
if (this.isWidget()) {
|
|
6732
|
+
if (alignSelf) style.alignSelf = alignSelf;
|
|
6733
|
+
} else if (this.isPage()) {
|
|
6734
|
+
if (alignItems) style.alignItems = alignItems;
|
|
6735
|
+
} else {
|
|
6736
|
+
if (alignItems) style.alignItems = alignItems;
|
|
6737
|
+
if (justifyContent) style.justifyContent = justifyContent;
|
|
6738
|
+
if (alignSelf) style.alignSelf = alignSelf;
|
|
6739
|
+
}
|
|
6740
|
+
if ((_f = this.properties) == null ? void 0 : _f.margin) style.margin = this.properties.margin;
|
|
6741
|
+
if ((_g = this.properties) == null ? void 0 : _g.marginLeft) style.marginLeft = this.properties.marginLeft;
|
|
6742
|
+
if ((_h = this.properties) == null ? void 0 : _h.marginRight) style.marginRight = this.properties.marginRight;
|
|
6743
|
+
if ((_i = this.properties) == null ? void 0 : _i.marginTop) style.marginTop = this.properties.marginTop;
|
|
6744
|
+
if ((_j = this.properties) == null ? void 0 : _j.marginBottom) style.marginBottom = this.properties.marginBottom;
|
|
6745
|
+
if ((_k = this.properties) == null ? void 0 : _k.padding) style.padding = this.properties.padding;
|
|
6746
|
+
if ((_l = this.properties) == null ? void 0 : _l.paddingLeft) style.paddingLeft = this.properties.paddingLeft;
|
|
6747
|
+
if ((_m = this.properties) == null ? void 0 : _m.paddingRight) style.paddingRight = this.properties.paddingRight;
|
|
6748
|
+
if ((_n = this.properties) == null ? void 0 : _n.paddingTop) style.paddingTop = this.properties.paddingTop;
|
|
6749
|
+
if ((_o = this.properties) == null ? void 0 : _o.paddingBottom) style.paddingBottom = this.properties.paddingBottom;
|
|
6750
|
+
if ((_p = this.properties) == null ? void 0 : _p.left) style.left = this.properties.left;
|
|
6751
|
+
if ((_q = this.properties) == null ? void 0 : _q.right) style.right = this.properties.right;
|
|
6752
|
+
if ((_r = this.properties) == null ? void 0 : _r.top) style.top = this.properties.top;
|
|
6753
|
+
if ((_s = this.properties) == null ? void 0 : _s.bottom) style.bottom = this.properties.bottom;
|
|
6754
|
+
if ((_t = this.properties) == null ? void 0 : _t.width) style.width = this.properties.width;
|
|
6755
|
+
if ((_u = this.properties) == null ? void 0 : _u.height) style.height = this.properties.height;
|
|
6756
|
+
if ((_v = this.properties) == null ? void 0 : _v.maxWidth) style.maxWidth = this.properties.maxWidth;
|
|
6757
|
+
if ((_w = this.properties) == null ? void 0 : _w.maxHeight) style.maxHeight = this.properties.maxHeight;
|
|
6758
|
+
if ((_x = this.properties) == null ? void 0 : _x.minWidth) style.minWidth = this.properties.minWidth;
|
|
6759
|
+
if ((_y = this.properties) == null ? void 0 : _y.minHeight) style.minHeight = this.properties.minHeight;
|
|
6760
|
+
if ((_z = this.properties) == null ? void 0 : _z.textAlign) style.textAlign = this.properties.textAlign;
|
|
6761
|
+
if ((_A = this.properties) == null ? void 0 : _A.backgroundColor) style.backgroundColor = this.properties.backgroundColor;
|
|
6762
|
+
if ((_B = this.properties) == null ? void 0 : _B.borderLeftWidth) style.borderLeftWidth = this.properties.borderLeftWidth;
|
|
6763
|
+
if ((_C = this.properties) == null ? void 0 : _C.borderRightWidth) style.borderRightWidth = this.properties.borderRightWidth;
|
|
6764
|
+
if ((_D = this.properties) == null ? void 0 : _D.borderTopWidth) style.borderTopWidth = this.properties.borderTopWidth;
|
|
6765
|
+
if ((_E = this.properties) == null ? void 0 : _E.borderBottomWidth) style.borderBottomWidth = this.properties.borderBottomWidth;
|
|
6766
|
+
if ((_F = this.properties) == null ? void 0 : _F.borderTopLeftRadius) style.borderTopLeftRadius = this.properties.borderTopLeftRadius;
|
|
6767
|
+
if ((_G = this.properties) == null ? void 0 : _G.borderTopRightRadius) style.borderTopRightRadius = this.properties.borderTopRightRadius;
|
|
6768
|
+
if ((_H = this.properties) == null ? void 0 : _H.borderBottomLeftRadius) style.borderBottomLeftRadius = this.properties.borderBottomLeftRadius;
|
|
6769
|
+
if ((_I = this.properties) == null ? void 0 : _I.borderBottomRightRadius) style.borderBottomRightRadius = this.properties.borderBottomRightRadius;
|
|
6770
|
+
if (((_J = this.properties) == null ? void 0 : _J.borderColor) && style.borderLeftWidth) {
|
|
6746
6771
|
style.borderLeftStyle = "solid";
|
|
6747
|
-
style.borderLeftColor = (
|
|
6772
|
+
style.borderLeftColor = (_K = this.properties) == null ? void 0 : _K.borderColor;
|
|
6748
6773
|
}
|
|
6749
|
-
if (((
|
|
6774
|
+
if (((_L = this.properties) == null ? void 0 : _L.borderColor) && style.borderRightWidth) {
|
|
6750
6775
|
style.borderRightStyle = "solid";
|
|
6751
|
-
style.borderRightColor = (
|
|
6776
|
+
style.borderRightColor = (_M = this.properties) == null ? void 0 : _M.borderColor;
|
|
6752
6777
|
}
|
|
6753
|
-
if (((
|
|
6778
|
+
if (((_N = this.properties) == null ? void 0 : _N.borderColor) && style.borderTopWidth) {
|
|
6754
6779
|
style.borderTopStyle = "solid";
|
|
6755
|
-
style.borderTopColor = (
|
|
6780
|
+
style.borderTopColor = (_O = this.properties) == null ? void 0 : _O.borderColor;
|
|
6756
6781
|
}
|
|
6757
|
-
if (((
|
|
6782
|
+
if (((_P = this.properties) == null ? void 0 : _P.borderColor) && style.borderBottomWidth) {
|
|
6758
6783
|
style.borderBottomStyle = "solid";
|
|
6759
|
-
style.borderBottomColor = (
|
|
6784
|
+
style.borderBottomColor = (_Q = this.properties) == null ? void 0 : _Q.borderColor;
|
|
6760
6785
|
}
|
|
6761
6786
|
return style;
|
|
6762
6787
|
}
|
|
@@ -7534,8 +7559,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
7534
7559
|
const pageBuilder = usePageBuilder();
|
|
7535
7560
|
const comp = computed(() => pageBuilder.getCustomWidgetComponent(props.part));
|
|
7536
7561
|
const bind = computed(() => ({
|
|
7537
|
-
...props.part.properties || {}
|
|
7538
|
-
placeholder: props.placeholder
|
|
7562
|
+
...props.part.properties || {}
|
|
7539
7563
|
}));
|
|
7540
7564
|
return (_ctx, _cache) => {
|
|
7541
7565
|
return comp.value ? (openBlock(), createBlock$1(resolveDynamicComponent(comp.value), normalizeProps(mergeProps({ key: 0 }, bind.value)), null, 16)) : createCommentVNode("", true);
|
|
@@ -8121,15 +8145,15 @@ class PartManager {
|
|
|
8121
8145
|
const defaultPartPropertyEditors = () => {
|
|
8122
8146
|
return {
|
|
8123
8147
|
"readonly-text": () => defineAsyncComponent(() => import("./PbPropertyEditorReadonlyText-Dgp_AVOD.js")),
|
|
8124
|
-
"text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-
|
|
8148
|
+
"text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-bXscT9jE.js")),
|
|
8125
8149
|
"number": () => defineAsyncComponent(() => import("./PbPropertyEditorNumber-TTgo0zbQ.js")),
|
|
8126
8150
|
"boolean": () => defineAsyncComponent(() => import("./PbPropertyEditorBoolean-C7-iSAtn.js")),
|
|
8127
|
-
"multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-
|
|
8151
|
+
"multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-BqEprlZ-.js")),
|
|
8128
8152
|
"select": () => defineAsyncComponent(() => import("./PbPropertyEditorSelect-CWedbXJI.js")),
|
|
8129
|
-
"color": () => defineAsyncComponent(() => import("./PbPropertyEditorColor-
|
|
8130
|
-
"image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-
|
|
8131
|
-
"html": () => defineAsyncComponent(() => import("./PbPropertyEditorHtml-
|
|
8132
|
-
"youtube": () => defineAsyncComponent(() => import("./PbPropertyEditorYoutube-
|
|
8153
|
+
"color": () => defineAsyncComponent(() => import("./PbPropertyEditorColor-Cb7qpN96.js")),
|
|
8154
|
+
"image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-BG7rGnU3.js")),
|
|
8155
|
+
"html": () => defineAsyncComponent(() => import("./PbPropertyEditorHtml-DRmHv8Gm.js")),
|
|
8156
|
+
"youtube": () => defineAsyncComponent(() => import("./PbPropertyEditorYoutube-Bz_UU0kC.js"))
|
|
8133
8157
|
};
|
|
8134
8158
|
};
|
|
8135
8159
|
const getPropertyValueOfParts = (parts, propertyName) => {
|
|
@@ -8180,6 +8204,7 @@ const setSelectHandler = (el, binding) => {
|
|
|
8180
8204
|
el.onmousedown = async (event) => {
|
|
8181
8205
|
if (event.button === 0) {
|
|
8182
8206
|
setTimeout(() => {
|
|
8207
|
+
if (pageBuilder.context.isSelected(part)) return;
|
|
8183
8208
|
if (event.shiftKey) {
|
|
8184
8209
|
pageBuilder.context.addSelection([part]);
|
|
8185
8210
|
} else {
|
|
@@ -8198,9 +8223,8 @@ const setContextMenuHandler = (el, binding) => {
|
|
|
8198
8223
|
const eventAny = event;
|
|
8199
8224
|
if (eventAny._partContextMenuHandled) return;
|
|
8200
8225
|
else eventAny._partContextMenuHandled = true;
|
|
8201
|
-
if (
|
|
8202
|
-
|
|
8203
|
-
}
|
|
8226
|
+
if (pageBuilder.context.isSelected(part)) return;
|
|
8227
|
+
pageBuilder.context.setSelection([part]);
|
|
8204
8228
|
};
|
|
8205
8229
|
};
|
|
8206
8230
|
const createPositionMark = () => {
|
|
@@ -8369,11 +8393,7 @@ const locateRight = (style, top, height) => {
|
|
|
8369
8393
|
style.height = height || "";
|
|
8370
8394
|
};
|
|
8371
8395
|
const getLayoutDirection = (isMobilePage, properties) => {
|
|
8372
|
-
|
|
8373
|
-
return properties && properties.directionSm || "vertical";
|
|
8374
|
-
} else {
|
|
8375
|
-
return properties && properties.directionLg || "horizontal";
|
|
8376
|
-
}
|
|
8396
|
+
return properties && properties.direction || (isMobilePage ? "vertical" : "horizontal");
|
|
8377
8397
|
};
|
|
8378
8398
|
const _export_sfc = (sfc, props) => {
|
|
8379
8399
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -8871,7 +8891,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
8871
8891
|
__name: "PbBlock",
|
|
8872
8892
|
props: {
|
|
8873
8893
|
part: {},
|
|
8874
|
-
isMobilePage: { type: Boolean }
|
|
8894
|
+
isMobilePage: { type: Boolean },
|
|
8895
|
+
placeholder: { type: Boolean }
|
|
8875
8896
|
},
|
|
8876
8897
|
setup(__props) {
|
|
8877
8898
|
const props = __props;
|
|
@@ -9095,7 +9116,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
9095
9116
|
__name: "PbSection",
|
|
9096
9117
|
props: {
|
|
9097
9118
|
part: {},
|
|
9098
|
-
isMobilePage: { type: Boolean }
|
|
9119
|
+
isMobilePage: { type: Boolean },
|
|
9120
|
+
placeholder: { type: Boolean }
|
|
9099
9121
|
},
|
|
9100
9122
|
setup(__props) {
|
|
9101
9123
|
const props = __props;
|
|
@@ -11941,14 +11963,8 @@ const layoutGroup = () => {
|
|
|
11941
11963
|
caption: "Layout",
|
|
11942
11964
|
properties: [
|
|
11943
11965
|
{
|
|
11944
|
-
propertyName: "
|
|
11945
|
-
caption: "
|
|
11946
|
-
propertyType: "select",
|
|
11947
|
-
params: "vertical,horizontal"
|
|
11948
|
-
},
|
|
11949
|
-
{
|
|
11950
|
-
propertyName: "directionLg",
|
|
11951
|
-
caption: "Direction for PC (> 768px)",
|
|
11966
|
+
propertyName: "direction",
|
|
11967
|
+
caption: "Layout",
|
|
11952
11968
|
propertyType: "select",
|
|
11953
11969
|
params: "vertical,horizontal"
|
|
11954
11970
|
},
|
|
@@ -11967,10 +11983,50 @@ const alignGroup = () => {
|
|
|
11967
11983
|
caption: "Align",
|
|
11968
11984
|
properties: [
|
|
11969
11985
|
{
|
|
11970
|
-
propertyName: "
|
|
11971
|
-
caption: "Align",
|
|
11986
|
+
propertyName: "alignItems",
|
|
11987
|
+
caption: "Align Items",
|
|
11988
|
+
propertyType: "select",
|
|
11989
|
+
params: "start,center,end"
|
|
11990
|
+
},
|
|
11991
|
+
{
|
|
11992
|
+
propertyName: "justifyContent",
|
|
11993
|
+
caption: "Justify Content",
|
|
11994
|
+
propertyType: "select",
|
|
11995
|
+
params: "start,center,end,between"
|
|
11996
|
+
},
|
|
11997
|
+
{
|
|
11998
|
+
propertyName: "alignSelf",
|
|
11999
|
+
caption: "Align Self",
|
|
12000
|
+
propertyType: "select",
|
|
12001
|
+
params: "start,center,end"
|
|
12002
|
+
}
|
|
12003
|
+
]
|
|
12004
|
+
};
|
|
12005
|
+
};
|
|
12006
|
+
const alignItemsGroup = () => {
|
|
12007
|
+
return {
|
|
12008
|
+
groupName: "align",
|
|
12009
|
+
caption: "Align",
|
|
12010
|
+
properties: [
|
|
12011
|
+
{
|
|
12012
|
+
propertyName: "alignItems",
|
|
12013
|
+
caption: "Align Items",
|
|
12014
|
+
propertyType: "select",
|
|
12015
|
+
params: "start,center,end"
|
|
12016
|
+
}
|
|
12017
|
+
]
|
|
12018
|
+
};
|
|
12019
|
+
};
|
|
12020
|
+
const alignSelfGroup = () => {
|
|
12021
|
+
return {
|
|
12022
|
+
groupName: "align",
|
|
12023
|
+
caption: "Align",
|
|
12024
|
+
properties: [
|
|
12025
|
+
{
|
|
12026
|
+
propertyName: "alignSelf",
|
|
12027
|
+
caption: "Align Self",
|
|
11972
12028
|
propertyType: "select",
|
|
11973
|
-
params: "
|
|
12029
|
+
params: ",start,center,end"
|
|
11974
12030
|
}
|
|
11975
12031
|
]
|
|
11976
12032
|
};
|
|
@@ -12052,7 +12108,7 @@ const defaultPropertyGroups = () => {
|
|
|
12052
12108
|
return [layoutGroup(), alignGroup(), sizeGroup(), marginGroup(), paddingGroup(), backgroundGroup(), commonGroup()];
|
|
12053
12109
|
};
|
|
12054
12110
|
const defaultWidgetPropertyGroups = () => {
|
|
12055
|
-
return [
|
|
12111
|
+
return [alignSelfGroup(), positionGroup(), sizeGroup(), marginGroup(), paddingGroup(), borderGroup(), backgroundGroup(), commonGroup()];
|
|
12056
12112
|
};
|
|
12057
12113
|
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
12058
12114
|
__name: "PbContainerWidget",
|
|
@@ -12103,13 +12159,13 @@ const pageParts = [
|
|
|
12103
12159
|
}
|
|
12104
12160
|
]
|
|
12105
12161
|
},
|
|
12106
|
-
|
|
12162
|
+
alignItemsGroup(),
|
|
12107
12163
|
paddingGroup(),
|
|
12108
12164
|
backgroundGroup(),
|
|
12109
12165
|
commonGroup()
|
|
12110
12166
|
],
|
|
12111
12167
|
initialProperties: {
|
|
12112
|
-
|
|
12168
|
+
alignItems: "center"
|
|
12113
12169
|
},
|
|
12114
12170
|
allowsChild: () => true,
|
|
12115
12171
|
creator: () => _sfc_main$l
|
|
@@ -12126,9 +12182,9 @@ const sectionParts = [
|
|
|
12126
12182
|
...defaultPropertyGroups()
|
|
12127
12183
|
],
|
|
12128
12184
|
initialProperties: {
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12185
|
+
direction: "horizontal",
|
|
12186
|
+
alignItems: "start",
|
|
12187
|
+
justifyContent: "start"
|
|
12132
12188
|
},
|
|
12133
12189
|
allowsChild: () => true,
|
|
12134
12190
|
creator: () => _sfc_main$l
|
|
@@ -12145,9 +12201,9 @@ const blockParts = [
|
|
|
12145
12201
|
...defaultPropertyGroups()
|
|
12146
12202
|
],
|
|
12147
12203
|
initialProperties: {
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12204
|
+
direction: "vertical",
|
|
12205
|
+
alignItems: "start",
|
|
12206
|
+
justifyContent: "start"
|
|
12151
12207
|
},
|
|
12152
12208
|
allowsChild: () => true,
|
|
12153
12209
|
creator: () => _sfc_main$n
|
|
@@ -12431,7 +12487,7 @@ __publicField(_OpenAddWidgetModalCommand, "COMMAND_ID", "OpenAddWidgetModal");
|
|
|
12431
12487
|
let OpenAddWidgetModalCommand = _OpenAddWidgetModalCommand;
|
|
12432
12488
|
const openWidgetAddModal = (modal, args, callback) => {
|
|
12433
12489
|
modal.openModal({
|
|
12434
|
-
component: defineAsyncComponent(() => import("./PbWidgetAddModal-
|
|
12490
|
+
component: defineAsyncComponent(() => import("./PbWidgetAddModal-Cfhjs6Z4.js")),
|
|
12435
12491
|
style: {
|
|
12436
12492
|
width: "80%",
|
|
12437
12493
|
height: "80%",
|
|
@@ -12465,12 +12521,38 @@ const openWidgetAddModal = (modal, args, callback) => {
|
|
|
12465
12521
|
});
|
|
12466
12522
|
};
|
|
12467
12523
|
const findInsertTargetAndIndex = (pageBuilder, partType) => {
|
|
12468
|
-
var _a;
|
|
12524
|
+
var _a, _b, _c;
|
|
12469
12525
|
const selected = pageBuilder.context.getSelectedParts()[0];
|
|
12470
|
-
pageBuilder.context.getSelectedPage();
|
|
12471
|
-
|
|
12472
|
-
|
|
12473
|
-
|
|
12526
|
+
const page = pageBuilder.context.getSelectedPage();
|
|
12527
|
+
if (!page) return {};
|
|
12528
|
+
if (partType === SECTION_TYPE) {
|
|
12529
|
+
const section = pageBuilder.partManager.findNearestSection(selected);
|
|
12530
|
+
return {
|
|
12531
|
+
target: page,
|
|
12532
|
+
index: section ? page.children.indexOf(section) + 1 : (_a = page.children) == null ? void 0 : _a.length
|
|
12533
|
+
};
|
|
12534
|
+
} else if (partType === BLOCK_TYPE) {
|
|
12535
|
+
let section = pageBuilder.partManager.findNearestSection(selected);
|
|
12536
|
+
let block = pageBuilder.partManager.findNearestBlock(selected);
|
|
12537
|
+
if (!section) {
|
|
12538
|
+
section = page.children[page.children.length - 1];
|
|
12539
|
+
}
|
|
12540
|
+
return {
|
|
12541
|
+
target: section,
|
|
12542
|
+
index: block ? section.children.indexOf(block) + 1 : (_b = section.children) == null ? void 0 : _b.length
|
|
12543
|
+
};
|
|
12544
|
+
} else {
|
|
12545
|
+
let block = pageBuilder.partManager.findNearestBlock(selected);
|
|
12546
|
+
let widget = selected.parent.isWidget() ? selected.parent : selected;
|
|
12547
|
+
if (!block) {
|
|
12548
|
+
const section = page.children[page.children.length - 1];
|
|
12549
|
+
block = section.children[section.children.length - 1];
|
|
12550
|
+
}
|
|
12551
|
+
return {
|
|
12552
|
+
target: block,
|
|
12553
|
+
index: widget ? block.children.indexOf(widget) + 1 : (_c = block.children) == null ? void 0 : _c.length
|
|
12554
|
+
};
|
|
12555
|
+
}
|
|
12474
12556
|
};
|
|
12475
12557
|
const createPartWithDefinition = (def, properties) => {
|
|
12476
12558
|
const part = createPart(def.partType, def.partName, def.initialProperties);
|
|
@@ -12537,9 +12619,14 @@ const _AddSectionCommand = class _AddSectionCommand {
|
|
|
12537
12619
|
if (args && args.page) {
|
|
12538
12620
|
addSectionToPage(pageBuilder, args.page);
|
|
12539
12621
|
} else {
|
|
12540
|
-
const
|
|
12541
|
-
if (
|
|
12542
|
-
|
|
12622
|
+
const selected = pageBuilder.context.getSelectedParts()[0];
|
|
12623
|
+
if (selected && selected.isPage()) {
|
|
12624
|
+
addSectionToPage(pageBuilder, selected);
|
|
12625
|
+
} else {
|
|
12626
|
+
const def = pageBuilder.partManager.getSectionDefinition();
|
|
12627
|
+
if (!def) return;
|
|
12628
|
+
addPart(pageBuilder, def);
|
|
12629
|
+
}
|
|
12543
12630
|
}
|
|
12544
12631
|
}
|
|
12545
12632
|
};
|
|
@@ -12931,11 +13018,20 @@ const _DeletePartCommand = class _DeletePartCommand {
|
|
|
12931
13018
|
__publicField(this, "caption", _DeletePartCommand.CAPTION);
|
|
12932
13019
|
}
|
|
12933
13020
|
execute(pageBuilder) {
|
|
12934
|
-
const
|
|
12935
|
-
|
|
12936
|
-
|
|
12937
|
-
|
|
12938
|
-
|
|
13021
|
+
const selected = pageBuilder.context.getSelectedParts();
|
|
13022
|
+
if (selected.length === 0) return;
|
|
13023
|
+
let partIds;
|
|
13024
|
+
if (selected[0].isPage()) {
|
|
13025
|
+
const page = selected[0];
|
|
13026
|
+
const partsToDelete = page.children || [];
|
|
13027
|
+
if (partsToDelete.length === 0) return;
|
|
13028
|
+
partIds = partsToDelete.map((part) => part.partId);
|
|
13029
|
+
} else {
|
|
13030
|
+
partIds = selected.filter((part) => {
|
|
13031
|
+
return !selected.some((v) => part.isChildOf(v));
|
|
13032
|
+
}).map((part) => part.partId);
|
|
13033
|
+
}
|
|
13034
|
+
pageBuilder.model.updateModel({ delete: partIds });
|
|
12939
13035
|
}
|
|
12940
13036
|
};
|
|
12941
13037
|
__publicField(_DeletePartCommand, "COMMAND_ID", "DeletePart");
|
|
@@ -12957,7 +13053,11 @@ const _CopyPartCommand = class _CopyPartCommand {
|
|
|
12957
13053
|
__publicField(this, "commandId", _CopyPartCommand.COMMAND_ID);
|
|
12958
13054
|
}
|
|
12959
13055
|
async execute(pageBuilder) {
|
|
12960
|
-
const
|
|
13056
|
+
const selected = pageBuilder.context.getSelectedParts();
|
|
13057
|
+
if (selected.length === 0) return;
|
|
13058
|
+
const partIds = selected.filter((part) => {
|
|
13059
|
+
return !selected.some((v) => part.isChildOf(v));
|
|
13060
|
+
}).map((part) => part.partId);
|
|
12961
13061
|
if (partIds.length > 0) {
|
|
12962
13062
|
const json = pageBuilder.model.serializeParts(partIds);
|
|
12963
13063
|
await navigator.clipboard.writeText(json);
|
|
@@ -12982,13 +13082,14 @@ const _PastePartCommand = class _PastePartCommand {
|
|
|
12982
13082
|
__publicField(this, "commandId", _PastePartCommand.COMMAND_ID);
|
|
12983
13083
|
}
|
|
12984
13084
|
async execute(pageBuilder) {
|
|
13085
|
+
var _a;
|
|
12985
13086
|
const json = await navigator.clipboard.readText();
|
|
12986
13087
|
const object = JSON.parse(json);
|
|
12987
13088
|
if (object.partType === ROOT_TYPE) {
|
|
12988
13089
|
const rootPart = partFromJsonObject(object, true);
|
|
12989
13090
|
if (!rootPart) throw new Error("Invalid data format");
|
|
12990
13091
|
let partIdsToDelete = void 0;
|
|
12991
|
-
if (pageBuilder.model.rootPart.children
|
|
13092
|
+
if ((_a = pageBuilder.model.rootPart.children) == null ? void 0 : _a.length) {
|
|
12992
13093
|
partIdsToDelete = pageBuilder.model.rootPart.children.map((v) => v.partId);
|
|
12993
13094
|
}
|
|
12994
13095
|
const param = {
|
|
@@ -13002,13 +13103,88 @@ const _PastePartCommand = class _PastePartCommand {
|
|
|
13002
13103
|
]
|
|
13003
13104
|
};
|
|
13004
13105
|
pageBuilder.model.updateModel(param);
|
|
13106
|
+
} else if (Array.isArray(object) && object[0] && object[0].partType === PAGE_TYPE) {
|
|
13107
|
+
const newPages = pageBuilder.model.parseParts(json);
|
|
13108
|
+
if (!newPages) throw new Error("Invalid data format");
|
|
13109
|
+
const newPage = newPages[0];
|
|
13110
|
+
const selectedPage = pageBuilder.context.getSelectedPage();
|
|
13111
|
+
if (!selectedPage) return;
|
|
13112
|
+
const pages = pageBuilder.model.rootPart.children;
|
|
13113
|
+
if (!pages) return;
|
|
13114
|
+
let index = 0;
|
|
13115
|
+
if (pages.length == 1) {
|
|
13116
|
+
newPage.properties = {
|
|
13117
|
+
...newPage.properties || {},
|
|
13118
|
+
name: "Page"
|
|
13119
|
+
};
|
|
13120
|
+
} else if (selectedPage === pages[0]) {
|
|
13121
|
+
newPage.properties = {
|
|
13122
|
+
...newPage.properties || {},
|
|
13123
|
+
name: "Page (Mobile)"
|
|
13124
|
+
};
|
|
13125
|
+
} else if (selectedPage === pages[1]) {
|
|
13126
|
+
newPage.properties = {
|
|
13127
|
+
...newPage.properties || {},
|
|
13128
|
+
name: "Page (PC)"
|
|
13129
|
+
};
|
|
13130
|
+
index = 1;
|
|
13131
|
+
}
|
|
13132
|
+
const param = {
|
|
13133
|
+
delete: [selectedPage.partId],
|
|
13134
|
+
insert: [
|
|
13135
|
+
{
|
|
13136
|
+
partId: pageBuilder.model.getRootPartId(),
|
|
13137
|
+
index,
|
|
13138
|
+
parts: [newPage]
|
|
13139
|
+
}
|
|
13140
|
+
]
|
|
13141
|
+
};
|
|
13142
|
+
pageBuilder.model.updateModel(param);
|
|
13005
13143
|
} else {
|
|
13006
|
-
const
|
|
13007
|
-
if (
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13144
|
+
const parts = pageBuilder.model.parseParts(json);
|
|
13145
|
+
if (!parts) return;
|
|
13146
|
+
let pasteType = "";
|
|
13147
|
+
parts.forEach((part) => {
|
|
13148
|
+
if (part.partType === SECTION_TYPE) pasteType = SECTION_TYPE;
|
|
13149
|
+
else if (part.partType === BLOCK_TYPE && (!pasteType || pasteType === WIDGET_TYPE)) pasteType = BLOCK_TYPE;
|
|
13150
|
+
else if (part.partType === WIDGET_TYPE && !pasteType) pasteType = WIDGET_TYPE;
|
|
13151
|
+
});
|
|
13152
|
+
if (!pasteType) return;
|
|
13153
|
+
const partsToInsert = parts.map((part) => {
|
|
13154
|
+
if (pasteType === SECTION_TYPE) {
|
|
13155
|
+
if (part.partType === SECTION_TYPE) {
|
|
13156
|
+
return part;
|
|
13157
|
+
} else if (part.partType === BLOCK_TYPE) {
|
|
13158
|
+
const section = createSection(pageBuilder);
|
|
13159
|
+
if (!section) return;
|
|
13160
|
+
section.children = [part];
|
|
13161
|
+
return section;
|
|
13162
|
+
} else {
|
|
13163
|
+
const block = createBlock(pageBuilder);
|
|
13164
|
+
if (!block) return;
|
|
13165
|
+
block.children = [part];
|
|
13166
|
+
const section = createSection(pageBuilder);
|
|
13167
|
+
if (!section) return;
|
|
13168
|
+
section.children = [block];
|
|
13169
|
+
return section;
|
|
13170
|
+
}
|
|
13171
|
+
} else if (pasteType === BLOCK_TYPE) {
|
|
13172
|
+
if (part.partType === BLOCK_TYPE) {
|
|
13173
|
+
return part;
|
|
13174
|
+
} else {
|
|
13175
|
+
const block = createBlock(pageBuilder);
|
|
13176
|
+
if (!block) return;
|
|
13177
|
+
block.children = [part];
|
|
13178
|
+
return block;
|
|
13179
|
+
}
|
|
13180
|
+
} else {
|
|
13181
|
+
return part;
|
|
13011
13182
|
}
|
|
13183
|
+
}).filter(notNull);
|
|
13184
|
+
const targetType = pasteType === SECTION_TYPE ? SECTION_TYPE : pasteType === BLOCK_TYPE ? BLOCK_TYPE : WIDGET_TYPE;
|
|
13185
|
+
const { target, index } = findInsertTargetAndIndex(pageBuilder, targetType);
|
|
13186
|
+
if (target && index !== void 0 && partsToInsert) {
|
|
13187
|
+
insertParts(pageBuilder, target.partId, index, partsToInsert, false);
|
|
13012
13188
|
}
|
|
13013
13189
|
}
|
|
13014
13190
|
}
|
|
@@ -13384,6 +13560,7 @@ class PageBuilderContextImpl {
|
|
|
13384
13560
|
}
|
|
13385
13561
|
}
|
|
13386
13562
|
addSelection(parts) {
|
|
13563
|
+
if (parts && !parts.length) return;
|
|
13387
13564
|
parts.forEach((part) => this.selection.push(part));
|
|
13388
13565
|
}
|
|
13389
13566
|
removeSelection(parts) {
|
|
@@ -14260,7 +14437,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
14260
14437
|
const style = computed(() => {
|
|
14261
14438
|
var _a, _b;
|
|
14262
14439
|
return {
|
|
14263
|
-
// width: `${props.width || 420}px`,
|
|
14264
14440
|
minHeight: ((_b = (_a = props.part) == null ? void 0 : _a.children) == null ? void 0 : _b.length) ? void 0 : "200px"
|
|
14265
14441
|
};
|
|
14266
14442
|
});
|
|
@@ -14281,7 +14457,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
14281
14457
|
const contextMenu = useContextMenu();
|
|
14282
14458
|
const handleClick = (event) => {
|
|
14283
14459
|
if (event.button === 0) {
|
|
14284
|
-
pageBuilder.context.
|
|
14460
|
+
pageBuilder.context.setSelection([props.part]);
|
|
14285
14461
|
}
|
|
14286
14462
|
};
|
|
14287
14463
|
const showContextMenu = (event) => {
|
|
@@ -14334,8 +14510,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
14334
14510
|
};
|
|
14335
14511
|
}
|
|
14336
14512
|
});
|
|
14337
|
-
const canvasStyle = '.pb-page-wrapper {\n margin: 0 auto;\n padding: 0;\n}\n\n.pb-page {\n
|
|
14338
|
-
const _hoisted_1$2 = ["
|
|
14513
|
+
const canvasStyle = '.pb-page-wrapper {\n margin: 0 auto;\n padding: 0;\n}\n\n.pb-page {\n display: flex;\n flex-direction: column;\n margin: 0 auto;\n width: 100%;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n}\n\n.pb-page .pb-page-content.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-page * {\n box-sizing: border-box;\n}\n\n.pb-add-widget-button {\n width: 100%;\n height: 100%;\n min-height: 200px;\n position: relative;\n}\n\n.pb-add-widget-button button {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n padding: 8px;\n background: none;\n border: none;\n cursor: pointer;\n}\n\n.pb-add-widget-button button:hover {\n background-color: #eeeeee;\n}\n\n.pb-add-widget-button .icon {\n font-size: 1rem;\n vertical-align: middle;\n}\n\n.pb-add-widget-button .text {\n font-size: 1rem;\n vertical-align: middle;\n margin-left: 0.4rem;\n}\n\n.pb-section {\n display: flex;\n position: relative;\n width: 100%;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n outline: 1px dashed #ccc;\n background-color: #fff;\n}\n\n.pb-section:hover:not(:has(.pb-block:hover)) {\n background-color: #f0f0f0;\n}\n\n.pb-section.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-section.pb-section-static {\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n}\n\n.pb-section.pb-section-static:after {\n content: "";\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.2);\n}\n\n.pb-section-static .pb-widget {\n outline: none;\n}\n\n.pb-block {\n display: flex;\n min-width: 1px;\n position: relative;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n width: 100%;\n outline: 1px dashed #ccc;\n}\n\n.pb-block:hover:not(:has(.pb-widget:hover)) {\n background-color: #f0f0f0;\n}\n\n.pb-block.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-widget {\n position: relative;\n outline: 1px dashed #ccc;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n pointer-events: auto !important;\n}\n\n.pb-widget * {\n pointer-events: none;\n}\n\n.pb-widget.selected::before {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: 2px solid #4998f8;\n z-index: 999;\n pointer-events: none;\n}\n\n.pb-widget .children {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n\n.pb-widget .pan-handle {\n position: absolute;\n left: -6px;\n top: -6px;\n width: 12px;\n height: 12px;\n background-color: #27ae60;\n cursor: move;\n pointer-events: auto !important;\n}\n\n.pb-widget .resize-handle {\n position: absolute;\n right: -6px;\n bottom: -6px;\n width: 12px;\n height: 12px;\n background-color: #27ae60;\n cursor: nwse-resize;\n pointer-events: auto !important;\n}\n\n.pb-widget {\n position: relative;\n background-position: 50% 50%;\n background-repeat: no-repeat;\n background-size: cover;\n width: 100%;\n}\n\n.pb-widget .children {\n position: absolute;\n width: 100%;\n height: 100%;\n}\n\n.pb-text-widget {\n width: 100%;\n height: fit-content;\n}\n\n.pb-text-widget .text {\n color: #333;\n}\n\n.pb-text-widget .placeholder {\n padding: 4px 0;\n font-size: 18px;\n text-align: center;\n color: #999;\n}\n\n.pb-image-widget {\n width: 100%;\n}\n\n.pb-image-widget .image {\n width: 100%;\n}\n\n.pb-image-widget .placeholder {\n height: 100px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-image-widget .placeholder span {\n font-size: 40px;\n color: #999;\n line-height: 100px;\n vertical-align: middle;\n}\n\n.pb-html-widget {\n width: 100%;\n height: fit-content;\n}\n\n.pb-html-widget .placeholder {\n padding: 4px 0;\n font-size: 18px;\n text-align: center;\n color: #999;\n}\n\n.pb-iframe-widget {\n width: 100%;\n height: fit-content;\n}\n\n.pb-iframe-widget .placeholder {\n padding: 4px 0;\n font-size: 18px;\n text-align: center;\n color: #999;\n}\n\n.pb-youtube-widget {\n width: 100%;\n}\n\n.pb-youtube-widget .youtube {\n width: 100%;\n height: 100%;\n}\n\n.pb-youtube-widget .placeholder {\n height: 100px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-youtube-widget .placeholder span {\n font-size: 40px;\n color: #999;\n line-height: 100px;\n vertical-align: middle;\n}\n\n.pb-container-widget {\n width: 100%;\n}\n\n.pb-container-widget .placeholder {\n height: 100px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-container-widget .placeholder span {\n font-size: 40px;\n color: #999;\n line-height: 100px;\n vertical-align: middle;\n}\n\n.pb-product-list-widget {\n width: 100%;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-start;\n align-items: center;\n}\n\n.pb-product-list-widget .product-wrapper {\n width: 25%;\n}\n\n.pb-product-list-widget .product-wrapper .product {\n width: 95%;\n margin: 0 auto;\n padding-top: 8px;\n padding-bottom: 8px;\n}\n\n.pb-product-list-widget .product-wrapper img {\n width: 100%;\n}\n\n.pb-product-list-widget .product-wrapper .name {\n margin-top: 8px;\n font-size: 14px;\n}\n\n.pb-product-list-widget .product-wrapper .price {\n margin-top: 8px;\n font-size: 14px;\n font-weight: bold;\n}\n\n.pb-product-list-widget .product-wrapper .empty {\n height: 200px;\n background-color: #eee;\n text-align: center;\n}\n\n.pb-product-list-widget .product-wrapper .empty span {\n font-size: 40px;\n color: #999;\n line-height: 200px;\n vertical-align: middle;\n}\n\n@media (max-width: 768px) {\n .pb-product-list-widget .product-wrapper {\n width: 50%;\n }\n}\n\n.mobile .pb-product-list-widget .product-wrapper {\n width: 50%;\n}\n\n.pb-login-widget {\n height: 200px;\n text-align: center;\n}\n\n.pb-login-widget h3 {\n padding: 0;\n margin: 0;\n font-size: 32px;\n font-weight: bold;\n color: #ccc;\n line-height: 200px;\n vertical-align: middle;\n}\n\n.font-icon {\n font-family: Material Symbols Outlined, monospace;\n font-size: 1rem;\n max-width: 1em;\n}\n\nhtml, body {\n font-family: Noto Sans, Noto Sans KR, Noto Sans JP, Arial, sans-serif;\n font-size: 12px;\n}\n\nbody {\n margin: 0;\n padding: 0;\n background-color: #aaa;\n overflow: hidden;\n}\n\n.pb-position-mark {\n background-color: #ff3333;\n opacity: 0.5;\n border-radius: 2px;\n}\n\n.pb-add-section-handle {\n position: relative;\n text-align: center;\n cursor: pointer;\n z-index: 5;\n height: 0;\n}\n\n.pb-add-section-handle.top::before, .pb-add-section-handle.bottom::before, .pb-add-section-handle.middle::before {\n content: "";\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n opacity: 0;\n pointer-events: none;\n}\n\n.pb-add-section-handle.bottom {\n left: 50%;\n bottom: -32px;\n}\n\n.pb-add-section-handle:hover.top::before, .pb-add-section-handle:hover.bottom::before, .pb-add-section-handle:hover.middle::before,\n.pb-add-section-handle:hover > i {\n opacity: 1;\n}\n\n.pb-add-section-handle > i {\n vertical-align: middle;\n position: absolute;\n top: 50%;\n left: 0;\n font-size: 2rem;\n transform: translate(-50%, -50%);\n opacity: 0.2;\n}';
|
|
14514
|
+
const _hoisted_1$2 = ["width"];
|
|
14339
14515
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
14340
14516
|
__name: "PbPageFrame",
|
|
14341
14517
|
props: {
|
|
@@ -14396,35 +14572,41 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
14396
14572
|
}
|
|
14397
14573
|
);
|
|
14398
14574
|
const width = ref(props.width);
|
|
14399
|
-
|
|
14575
|
+
ref(200);
|
|
14400
14576
|
const isMobilePage = computed(() => width.value <= 768);
|
|
14401
14577
|
const style = computed(() => ({
|
|
14402
14578
|
// width: `${width.value}px`,
|
|
14403
14579
|
// height: `${height.value}px`,
|
|
14404
14580
|
}));
|
|
14405
14581
|
let resizeObserver;
|
|
14582
|
+
let mutationObserver;
|
|
14406
14583
|
const updateIframeHeight = () => {
|
|
14407
|
-
|
|
14584
|
+
requestAnimationFrame(() => {
|
|
14408
14585
|
if (!iframeRef.value || !iframeRef.value.contentDocument) return;
|
|
14409
14586
|
const iframeBody = iframeRef.value.contentDocument.body;
|
|
14410
14587
|
if (iframeBody) {
|
|
14411
|
-
|
|
14588
|
+
iframeRef.value.style.height = "1px";
|
|
14589
|
+
const newHeight = iframeBody.scrollHeight;
|
|
14590
|
+
iframeRef.value.style.height = `${newHeight}px`;
|
|
14412
14591
|
}
|
|
14413
|
-
}
|
|
14592
|
+
});
|
|
14414
14593
|
};
|
|
14415
14594
|
onMounted(() => {
|
|
14416
14595
|
if (!iframeRef.value || !iframeRef.value.contentDocument) return;
|
|
14417
14596
|
const iframeBody = iframeRef.value.contentDocument.body;
|
|
14418
|
-
resizeObserver = new ResizeObserver(
|
|
14419
|
-
updateIframeHeight();
|
|
14420
|
-
});
|
|
14597
|
+
resizeObserver = new ResizeObserver(updateIframeHeight);
|
|
14421
14598
|
resizeObserver.observe(iframeBody, {});
|
|
14599
|
+
mutationObserver = new MutationObserver(updateIframeHeight);
|
|
14600
|
+
mutationObserver.observe(iframeBody, { childList: true, subtree: true });
|
|
14422
14601
|
iframeRef.value.onload = updateIframeHeight;
|
|
14423
14602
|
});
|
|
14424
14603
|
onBeforeUnmount(() => {
|
|
14425
14604
|
if (resizeObserver) {
|
|
14426
14605
|
resizeObserver.disconnect();
|
|
14427
14606
|
}
|
|
14607
|
+
if (mutationObserver) {
|
|
14608
|
+
mutationObserver.disconnect();
|
|
14609
|
+
}
|
|
14428
14610
|
});
|
|
14429
14611
|
return (_ctx, _cache) => {
|
|
14430
14612
|
var _a, _b, _c, _d;
|
|
@@ -14446,7 +14628,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
14446
14628
|
createElementVNode("iframe", {
|
|
14447
14629
|
ref_key: "iframeRef",
|
|
14448
14630
|
ref: iframeRef,
|
|
14449
|
-
height: `${height.value}px`,
|
|
14450
14631
|
style: normalizeStyle(style.value),
|
|
14451
14632
|
width: `${width.value}px`,
|
|
14452
14633
|
class: "page-frame mt-12"
|