@g1cloud/page-builder-editor 1.0.0-alpha.50 → 1.0.0-alpha.52
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/dist/PageBuilderEditor.vue.d.ts +1 -0
- package/dist/{PbPropertyEditorColor-hFvMuUZC.js → PbPropertyEditorColor-Db3UUuLc.js} +1 -1
- package/dist/{PbPropertyEditorHtml-gzh9Nb2Q.js → PbPropertyEditorHtml-CoxUtACW.js} +1 -1
- package/dist/{PbPropertyEditorImage-D4wJ9fgi.js → PbPropertyEditorImage-B73oOweb.js} +1 -1
- package/dist/{PbPropertyEditorMultilineText-Bq1QUweO.js → PbPropertyEditorMultilineText-C43eDCgk.js} +1 -1
- package/dist/{PbPropertyEditorText-BGIyzz1q.js → PbPropertyEditorText-DmTjpx6J.js} +1 -1
- package/dist/{PbPropertyEditorYoutube-uRftqvVU.js → PbPropertyEditorYoutube-DPX-k3c5.js} +1 -1
- package/dist/{PbWidgetAddModal-DF7MRQUS.js → PbWidgetAddModal-CoT-pyXr.js} +1 -2
- package/dist/{index-B-YMeKky.js → index-DkU6TZPE.js} +255 -194
- package/dist/index.d.ts +2 -1
- package/dist/model/command.d.ts +1 -0
- package/dist/model/default-part-property-group.d.ts +1 -0
- package/dist/model/page-builder-editor.d.ts +3 -2
- package/dist/model/plugin.d.ts +9 -1
- package/dist/page-builder-editor.js +1 -1
- package/dist/page-builder-editor.umd.cjs +248 -188
- package/package.json +3 -3
|
@@ -10,6 +10,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
10
10
|
plugin?: unknown;
|
|
11
11
|
}>>, {
|
|
12
12
|
getPageContent: () => string;
|
|
13
|
+
pastePageContent: (contentJson: string) => void;
|
|
13
14
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
15
|
"update-model": (modified: boolean) => void;
|
|
15
16
|
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createVNode } from "vue";
|
|
2
2
|
import { vT, BSTextInput } from "@g1cloud/bluesea";
|
|
3
|
-
import { P as PbColorPicker } from "./index-
|
|
3
|
+
import { P as PbColorPicker } from "./index-DkU6TZPE.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-color" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
|
6
6
|
const _hoisted_3 = { class: "bs-layout-horizontal flex-align-center color" };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createTextVNode, defineAsyncComponent } from "vue";
|
|
2
2
|
import { useModal, vT } from "@g1cloud/bluesea";
|
|
3
|
-
import { u as usePageBuilderEditor } from "./index-
|
|
3
|
+
import { u as usePageBuilderEditor } from "./index-DkU6TZPE.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-image flex-align-center" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
|
6
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, withDirectives, unref } from "vue";
|
|
2
|
-
import { u as usePageBuilderEditor } from "./index-
|
|
2
|
+
import { u as usePageBuilderEditor } from "./index-DkU6TZPE.js";
|
|
3
3
|
import { useModal, vT } from "@g1cloud/bluesea";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-image flex-align-center" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
package/dist/{PbPropertyEditorMultilineText-Bq1QUweO.js → PbPropertyEditorMultilineText-C43eDCgk.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createBlock } from "vue";
|
|
2
2
|
import { vT, BSMultiLangTextArea, BSTextArea } from "@g1cloud/bluesea";
|
|
3
|
-
import { u as usePageBuilderEditor } from "./index-
|
|
3
|
+
import { u as usePageBuilderEditor } from "./index-DkU6TZPE.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-multiline-text" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
|
6
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createBlock } from "vue";
|
|
2
2
|
import { vT, BSMultiLangTextInput, BSTextInput } from "@g1cloud/bluesea";
|
|
3
|
-
import { u as usePageBuilderEditor } from "./index-
|
|
3
|
+
import { u as usePageBuilderEditor } from "./index-DkU6TZPE.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-text flex-align-center" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
|
6
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, withDirectives, unref } from "vue";
|
|
2
2
|
import { useModal, vT } from "@g1cloud/bluesea";
|
|
3
|
-
import { s as selectYoutubeVideo } from "./index-
|
|
3
|
+
import { s as selectYoutubeVideo } from "./index-DkU6TZPE.js";
|
|
4
4
|
const _hoisted_1 = { class: "property-editor property-editor-image flex-align-center" };
|
|
5
5
|
const _hoisted_2 = { class: "title" };
|
|
6
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createElementBlock, Fragment, renderList, toDisplayString } from "vue";
|
|
2
2
|
import { useModalHandle, BSModalFrame } from "@g1cloud/bluesea";
|
|
3
|
-
import { w as widgetPartDefinitions } from "./index-
|
|
3
|
+
import { w as widgetPartDefinitions } from "./index-DkU6TZPE.js";
|
|
4
4
|
const _hoisted_1 = { class: "bs-layout-vertical pb-part-add-modal" };
|
|
5
5
|
const _hoisted_2 = { class: "bs-layout-horizontal-wrap ml-16 mb-8 gap-8" };
|
|
6
6
|
const _hoisted_3 = ["onClick", "textContent"];
|
|
@@ -21,7 +21,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
21
21
|
const modalHandle = useModalHandle();
|
|
22
22
|
const customWidgets = computed(() => props.pageBuilder.getCustomWidgets());
|
|
23
23
|
const select = (partDefinition) => {
|
|
24
|
-
console.log(partDefinition);
|
|
25
24
|
emit("selectHandler", partDefinition);
|
|
26
25
|
modalHandle.close();
|
|
27
26
|
};
|
|
@@ -6891,8 +6891,9 @@ const _sfc_main$c$1 = /* @__PURE__ */ defineComponent({
|
|
|
6891
6891
|
const emit = __emit;
|
|
6892
6892
|
const visible = ref(true);
|
|
6893
6893
|
const updateVisible = (value) => {
|
|
6894
|
+
var _a;
|
|
6894
6895
|
visible.value = value;
|
|
6895
|
-
emit("update:visible", value);
|
|
6896
|
+
emit("update:visible", value, !!((_a = props.part.properties) == null ? void 0 : _a.hideParentWhenInvisible));
|
|
6896
6897
|
};
|
|
6897
6898
|
const classNames = computed(() => [getPartClassName(props.part), props.part.getClassNames()]);
|
|
6898
6899
|
const styleTag = computed(() => props.part.getStyleTag());
|
|
@@ -6936,11 +6937,11 @@ const _sfc_main$b$1 = /* @__PURE__ */ defineComponent({
|
|
|
6936
6937
|
const props = __props;
|
|
6937
6938
|
const emit = __emit;
|
|
6938
6939
|
const visible = ref(true);
|
|
6939
|
-
const
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
emit("update:visible", visible.value);
|
|
6940
|
+
const updateVisible = (value, hideParentWhenInvisible) => {
|
|
6941
|
+
if (hideParentWhenInvisible && !value) {
|
|
6942
|
+
visible.value = false;
|
|
6943
|
+
}
|
|
6944
|
+
emit("update:visible", visible.value, hideParentWhenInvisible);
|
|
6944
6945
|
};
|
|
6945
6946
|
const classNames = computed(() => [getPartClassName(props.part), props.part.getClassNames()]);
|
|
6946
6947
|
const styleTag = computed(() => props.part.getStyleTag());
|
|
@@ -6963,8 +6964,8 @@ const _sfc_main$b$1 = /* @__PURE__ */ defineComponent({
|
|
|
6963
6964
|
return openBlock(), createBlock$1(_sfc_main$c$1, {
|
|
6964
6965
|
key: child.partId,
|
|
6965
6966
|
part: child,
|
|
6966
|
-
"onUpdate:visible": (value) => updateVisible(
|
|
6967
|
-
}, null, 8, ["part"
|
|
6967
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = (value, hideParentWhenInvisible) => updateVisible(value, hideParentWhenInvisible))
|
|
6968
|
+
}, null, 8, ["part"]);
|
|
6968
6969
|
}), 128)) : createCommentVNode("", true)
|
|
6969
6970
|
], 14, _hoisted_1$a$1), [
|
|
6970
6971
|
[vShow, visible.value]
|
|
@@ -6983,10 +6984,10 @@ const _sfc_main$a$1 = /* @__PURE__ */ defineComponent({
|
|
|
6983
6984
|
setup(__props) {
|
|
6984
6985
|
const props = __props;
|
|
6985
6986
|
const visible = ref(true);
|
|
6986
|
-
const
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6987
|
+
const updateVisible = (value, hideParentWhenInvisible) => {
|
|
6988
|
+
if (hideParentWhenInvisible && !value) {
|
|
6989
|
+
visible.value = false;
|
|
6990
|
+
}
|
|
6990
6991
|
};
|
|
6991
6992
|
const classNames = computed(() => [getPartClassName(props.part), props.part.getClassNames()]);
|
|
6992
6993
|
const styleTag = computed(() => props.part.getStyleTag());
|
|
@@ -7010,8 +7011,8 @@ const _sfc_main$a$1 = /* @__PURE__ */ defineComponent({
|
|
|
7010
7011
|
key: child.partId,
|
|
7011
7012
|
"is-mobile-page": _ctx.isMobilePage,
|
|
7012
7013
|
part: child,
|
|
7013
|
-
"onUpdate:visible": (value) => updateVisible(
|
|
7014
|
-
}, null, 8, ["is-mobile-page", "part"
|
|
7014
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = (value, hideParentWhenInvisible) => updateVisible(value, hideParentWhenInvisible))
|
|
7015
|
+
}, null, 8, ["is-mobile-page", "part"]);
|
|
7015
7016
|
}), 128)) : createCommentVNode("", true)
|
|
7016
7017
|
], 14, _hoisted_1$9$1), [
|
|
7017
7018
|
[vShow, visible.value]
|
|
@@ -7474,6 +7475,7 @@ class PageBuilderViewerImpl {
|
|
|
7474
7475
|
parsePartContent(partContent) {
|
|
7475
7476
|
const part = this.createPart(partContent.partType);
|
|
7476
7477
|
if (!part) return;
|
|
7478
|
+
part.partId = partContent.partId;
|
|
7477
7479
|
part.partType = partContent.partType;
|
|
7478
7480
|
part.partName = partContent.partName;
|
|
7479
7481
|
part.properties = partContent.properties ? JSON.parse(JSON.stringify(partContent.properties)) : null;
|
|
@@ -8268,15 +8270,15 @@ class PartManager {
|
|
|
8268
8270
|
const defaultPartPropertyEditors = () => {
|
|
8269
8271
|
return {
|
|
8270
8272
|
"readonly-text": () => defineAsyncComponent(() => import("./PbPropertyEditorReadonlyText-BJ5qx69O.js")),
|
|
8271
|
-
"text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-
|
|
8273
|
+
"text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-DmTjpx6J.js")),
|
|
8272
8274
|
"number": () => defineAsyncComponent(() => import("./PbPropertyEditorNumber-B76ArSb5.js")),
|
|
8273
8275
|
"boolean": () => defineAsyncComponent(() => import("./PbPropertyEditorBoolean-c5CNiTpt.js")),
|
|
8274
|
-
"multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-
|
|
8276
|
+
"multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-C43eDCgk.js")),
|
|
8275
8277
|
"select": () => defineAsyncComponent(() => import("./PbPropertyEditorSelect-B5sfulvx.js")),
|
|
8276
|
-
"color": () => defineAsyncComponent(() => import("./PbPropertyEditorColor-
|
|
8277
|
-
"image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-
|
|
8278
|
-
"html": () => defineAsyncComponent(() => import("./PbPropertyEditorHtml-
|
|
8279
|
-
"youtube": () => defineAsyncComponent(() => import("./PbPropertyEditorYoutube-
|
|
8278
|
+
"color": () => defineAsyncComponent(() => import("./PbPropertyEditorColor-Db3UUuLc.js")),
|
|
8279
|
+
"image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-B73oOweb.js")),
|
|
8280
|
+
"html": () => defineAsyncComponent(() => import("./PbPropertyEditorHtml-CoxUtACW.js")),
|
|
8281
|
+
"youtube": () => defineAsyncComponent(() => import("./PbPropertyEditorYoutube-DPX-k3c5.js"))
|
|
8280
8282
|
};
|
|
8281
8283
|
};
|
|
8282
8284
|
const getPropertyValueOfParts = (parts, propertyName) => {
|
|
@@ -12268,11 +12270,24 @@ const borderGroup = () => {
|
|
|
12268
12270
|
propertyGroupEditor: () => _sfc_main$h
|
|
12269
12271
|
};
|
|
12270
12272
|
};
|
|
12273
|
+
const hideParentGroup = () => {
|
|
12274
|
+
return {
|
|
12275
|
+
groupName: "hideParentGroup",
|
|
12276
|
+
caption: "pb.prop.hideParent",
|
|
12277
|
+
properties: [
|
|
12278
|
+
{
|
|
12279
|
+
propertyName: "hideParentWhenInvisible",
|
|
12280
|
+
caption: "pb.prop.hideParentWhenInvisible",
|
|
12281
|
+
propertyType: "boolean"
|
|
12282
|
+
}
|
|
12283
|
+
]
|
|
12284
|
+
};
|
|
12285
|
+
};
|
|
12271
12286
|
const defaultPropertyGroups = () => {
|
|
12272
12287
|
return [layoutGroup(), alignGroup(), sizeGroup(), marginGroup(), paddingGroup(), backgroundGroup(), commonGroup()];
|
|
12273
12288
|
};
|
|
12274
12289
|
const defaultWidgetPropertyGroups = () => {
|
|
12275
|
-
return [alignSelfGroup(), positionGroup(), sizeGroup(), marginGroup(), paddingGroup(), borderGroup(), backgroundGroup(), commonGroup()];
|
|
12290
|
+
return [alignSelfGroup(), positionGroup(), sizeGroup(), marginGroup(), paddingGroup(), borderGroup(), backgroundGroup(), commonGroup(), hideParentGroup()];
|
|
12276
12291
|
};
|
|
12277
12292
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
12278
12293
|
__name: "PbContainerWidget",
|
|
@@ -12835,7 +12850,7 @@ __publicField(_OpenAddWidgetModalCommand, "COMMAND_ID", "OpenAddWidgetModal");
|
|
|
12835
12850
|
let OpenAddWidgetModalCommand = _OpenAddWidgetModalCommand;
|
|
12836
12851
|
const openWidgetAddModal = (modal, args, callback) => {
|
|
12837
12852
|
modal.openModal({
|
|
12838
|
-
component: defineAsyncComponent(() => import("./PbWidgetAddModal-
|
|
12853
|
+
component: defineAsyncComponent(() => import("./PbWidgetAddModal-CoT-pyXr.js")),
|
|
12839
12854
|
style: {
|
|
12840
12855
|
width: "80%",
|
|
12841
12856
|
height: "80%",
|
|
@@ -12911,6 +12926,177 @@ const insertParts = (pageBuilder, partId, index, parts, selectAfterInsert) => {
|
|
|
12911
12926
|
if (part) pageBuilder.context.setSelection([part]);
|
|
12912
12927
|
}
|
|
12913
12928
|
};
|
|
12929
|
+
const pasteContentJson = (pageBuilder, json) => {
|
|
12930
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
12931
|
+
const object = JSON.parse(json);
|
|
12932
|
+
if (object.partType === ROOT_TYPE) {
|
|
12933
|
+
const rootPart = partFromJsonObject(object, true);
|
|
12934
|
+
if (!rootPart) throw new Error("Invalid data format");
|
|
12935
|
+
let partIdsToDelete = void 0;
|
|
12936
|
+
if ((_a = pageBuilder.model.rootPart.children) == null ? void 0 : _a.length) {
|
|
12937
|
+
partIdsToDelete = pageBuilder.model.rootPart.children.map((v) => v.partId);
|
|
12938
|
+
}
|
|
12939
|
+
const param = {
|
|
12940
|
+
delete: partIdsToDelete,
|
|
12941
|
+
insert: [
|
|
12942
|
+
{
|
|
12943
|
+
partId: pageBuilder.model.getRootPartId(),
|
|
12944
|
+
index: 0,
|
|
12945
|
+
parts: rootPart.children || []
|
|
12946
|
+
}
|
|
12947
|
+
]
|
|
12948
|
+
};
|
|
12949
|
+
pageBuilder.model.updateModel(param);
|
|
12950
|
+
} else if (Array.isArray(object) && object[0] && object[0].partType === PAGE_TYPE) {
|
|
12951
|
+
const newPages = pageBuilder.model.parseParts(json);
|
|
12952
|
+
if (!newPages) throw new Error("Invalid data format");
|
|
12953
|
+
const newPage = newPages[0];
|
|
12954
|
+
const selectedPage = pageBuilder.context.getSelectedPage();
|
|
12955
|
+
if (!selectedPage) return;
|
|
12956
|
+
const pages = pageBuilder.model.rootPart.children;
|
|
12957
|
+
if (!pages) return;
|
|
12958
|
+
let index = 0;
|
|
12959
|
+
if (pages.length == 1) {
|
|
12960
|
+
newPage.properties = {
|
|
12961
|
+
...newPage.properties || {},
|
|
12962
|
+
name: "Page"
|
|
12963
|
+
};
|
|
12964
|
+
} else if (selectedPage === pages[0]) {
|
|
12965
|
+
newPage.properties = {
|
|
12966
|
+
...newPage.properties || {},
|
|
12967
|
+
name: "Page (Mobile)"
|
|
12968
|
+
};
|
|
12969
|
+
} else if (selectedPage === pages[1]) {
|
|
12970
|
+
newPage.properties = {
|
|
12971
|
+
...newPage.properties || {},
|
|
12972
|
+
name: "Page (PC)"
|
|
12973
|
+
};
|
|
12974
|
+
index = 1;
|
|
12975
|
+
}
|
|
12976
|
+
const param = {
|
|
12977
|
+
delete: [selectedPage.partId],
|
|
12978
|
+
insert: [
|
|
12979
|
+
{
|
|
12980
|
+
partId: pageBuilder.model.getRootPartId(),
|
|
12981
|
+
index,
|
|
12982
|
+
parts: [newPage]
|
|
12983
|
+
}
|
|
12984
|
+
]
|
|
12985
|
+
};
|
|
12986
|
+
pageBuilder.model.updateModel(param);
|
|
12987
|
+
} else {
|
|
12988
|
+
const parts = pageBuilder.model.parseParts(json);
|
|
12989
|
+
if (!parts) return;
|
|
12990
|
+
let pasteType = "";
|
|
12991
|
+
parts.forEach((part) => {
|
|
12992
|
+
if (part.partType === SECTION_TYPE) pasteType = SECTION_TYPE;
|
|
12993
|
+
else if (part.partType === BLOCK_TYPE && (!pasteType || pasteType === WIDGET_TYPE)) pasteType = BLOCK_TYPE;
|
|
12994
|
+
else if (part.partType === WIDGET_TYPE && !pasteType) pasteType = WIDGET_TYPE;
|
|
12995
|
+
});
|
|
12996
|
+
if (!pasteType) return;
|
|
12997
|
+
const partsToPaste = parts.map((part) => {
|
|
12998
|
+
if (pasteType === SECTION_TYPE) {
|
|
12999
|
+
if (part.partType === SECTION_TYPE) {
|
|
13000
|
+
return part;
|
|
13001
|
+
} else if (part.partType === BLOCK_TYPE) {
|
|
13002
|
+
const section = createSection(pageBuilder);
|
|
13003
|
+
if (!section) return;
|
|
13004
|
+
section.children = [part];
|
|
13005
|
+
return section;
|
|
13006
|
+
} else {
|
|
13007
|
+
const block = createBlock(pageBuilder);
|
|
13008
|
+
if (!block) return;
|
|
13009
|
+
block.children = [part];
|
|
13010
|
+
const section = createSection(pageBuilder);
|
|
13011
|
+
if (!section) return;
|
|
13012
|
+
section.children = [block];
|
|
13013
|
+
return section;
|
|
13014
|
+
}
|
|
13015
|
+
} else if (pasteType === BLOCK_TYPE) {
|
|
13016
|
+
if (part.partType === BLOCK_TYPE) {
|
|
13017
|
+
return part;
|
|
13018
|
+
} else {
|
|
13019
|
+
const block = createBlock(pageBuilder);
|
|
13020
|
+
if (!block) return;
|
|
13021
|
+
block.children = [part];
|
|
13022
|
+
return block;
|
|
13023
|
+
}
|
|
13024
|
+
} else {
|
|
13025
|
+
return part;
|
|
13026
|
+
}
|
|
13027
|
+
}).filter(notNull);
|
|
13028
|
+
const selectedPage = pageBuilder.context.getSelectedPage();
|
|
13029
|
+
const selected = pageBuilder.context.getSelectedParts()[0] || selectedPage;
|
|
13030
|
+
if (!selectedPage || !selected) return;
|
|
13031
|
+
let selectedWidget;
|
|
13032
|
+
if (selected && selected.isWidget()) selectedWidget = selected;
|
|
13033
|
+
if (selectedWidget && selectedWidget.isNestedWidget()) selectedWidget = selectedWidget.parent;
|
|
13034
|
+
let selectedBlock;
|
|
13035
|
+
if (selectedWidget) selectedBlock = selectedWidget.parent;
|
|
13036
|
+
else if (selected && selected.isBlock()) selectedBlock = selected;
|
|
13037
|
+
let selectedSection;
|
|
13038
|
+
if (selectedBlock) selectedSection = selectedBlock.parent;
|
|
13039
|
+
else if (selected && selected.isSection()) selectedSection = selected;
|
|
13040
|
+
let targetPartId;
|
|
13041
|
+
let targetIndex = -1;
|
|
13042
|
+
let partsToInsert;
|
|
13043
|
+
if (pasteType === SECTION_TYPE) {
|
|
13044
|
+
targetPartId = selectedPage.partId;
|
|
13045
|
+
targetIndex = selectedSection ? selectedPage.children.indexOf(selectedSection) + 1 : ((_b = selectedPage.children) == null ? void 0 : _b.length) || 0;
|
|
13046
|
+
partsToInsert = partsToPaste;
|
|
13047
|
+
} else if (pasteType === BLOCK_TYPE) {
|
|
13048
|
+
if (selectedSection) {
|
|
13049
|
+
targetPartId = selectedSection.partId;
|
|
13050
|
+
targetIndex = selectedBlock ? selectedSection.children.indexOf(selectedBlock) + 1 : ((_c = selectedSection.children) == null ? void 0 : _c.length) || 0;
|
|
13051
|
+
partsToInsert = partsToPaste;
|
|
13052
|
+
} else if ((_d = selectedPage.children) == null ? void 0 : _d.length) {
|
|
13053
|
+
selectedSection = selectedPage.children[selectedPage.children.length - 1];
|
|
13054
|
+
targetPartId = selectedSection.partId;
|
|
13055
|
+
targetIndex = ((_e = selectedSection.children) == null ? void 0 : _e.length) || 0;
|
|
13056
|
+
partsToInsert = partsToPaste;
|
|
13057
|
+
} else {
|
|
13058
|
+
const newSection = createSection(pageBuilder);
|
|
13059
|
+
if (!newSection) return;
|
|
13060
|
+
newSection.children = partsToPaste;
|
|
13061
|
+
targetPartId = selectedPage.partId;
|
|
13062
|
+
targetIndex = 0;
|
|
13063
|
+
partsToInsert = [newSection];
|
|
13064
|
+
}
|
|
13065
|
+
} else if (pasteType === WIDGET_TYPE) {
|
|
13066
|
+
if (selectedBlock) {
|
|
13067
|
+
targetPartId = selectedBlock.partId;
|
|
13068
|
+
targetIndex = selectedWidget ? selectedBlock.children.indexOf(selectedWidget) + 1 : ((_f = selectedBlock.children) == null ? void 0 : _f.length) || 0;
|
|
13069
|
+
partsToInsert = partsToPaste;
|
|
13070
|
+
} else if (selectedSection || ((_g = selectedPage.children) == null ? void 0 : _g.length)) {
|
|
13071
|
+
if (!selectedSection) selectedSection = selectedPage.children[selectedPage.children.length - 1];
|
|
13072
|
+
if ((_h = selectedSection.children) == null ? void 0 : _h.length) {
|
|
13073
|
+
selectedBlock = selectedSection.children[selectedSection.children.length - 1];
|
|
13074
|
+
targetPartId = selectedBlock.partId;
|
|
13075
|
+
targetIndex = ((_i = selectedBlock.children) == null ? void 0 : _i.length) || 0;
|
|
13076
|
+
partsToInsert = partsToPaste;
|
|
13077
|
+
} else {
|
|
13078
|
+
const newBlock = createBlock(pageBuilder);
|
|
13079
|
+
if (!newBlock) return;
|
|
13080
|
+
newBlock.children = partsToPaste;
|
|
13081
|
+
targetPartId = selectedSection.partId;
|
|
13082
|
+
targetIndex = 0;
|
|
13083
|
+
partsToInsert = [newBlock];
|
|
13084
|
+
}
|
|
13085
|
+
} else {
|
|
13086
|
+
const newBlock = createBlock(pageBuilder);
|
|
13087
|
+
const newSection = createSection(pageBuilder);
|
|
13088
|
+
if (!newBlock || !newSection) return;
|
|
13089
|
+
newSection.children = [newBlock];
|
|
13090
|
+
newBlock.children = partsToPaste;
|
|
13091
|
+
targetPartId = selectedPage.partId;
|
|
13092
|
+
targetIndex = 0;
|
|
13093
|
+
partsToInsert = [newSection];
|
|
13094
|
+
}
|
|
13095
|
+
}
|
|
13096
|
+
if (!targetPartId || targetIndex < 0 || !partsToInsert) return;
|
|
13097
|
+
insertParts(pageBuilder, targetPartId, targetIndex, partsToInsert, false);
|
|
13098
|
+
}
|
|
13099
|
+
};
|
|
12914
13100
|
const _AddPartCommand = class _AddPartCommand {
|
|
12915
13101
|
constructor(modal) {
|
|
12916
13102
|
__publicField(this, "commandId", _AddPartCommand.COMMAND_ID);
|
|
@@ -13396,176 +13582,8 @@ const _PastePartCommand = class _PastePartCommand {
|
|
|
13396
13582
|
__publicField(this, "commandId", _PastePartCommand.COMMAND_ID);
|
|
13397
13583
|
}
|
|
13398
13584
|
async execute(pageBuilder) {
|
|
13399
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
13400
13585
|
const json = await navigator.clipboard.readText();
|
|
13401
|
-
|
|
13402
|
-
if (object.partType === ROOT_TYPE) {
|
|
13403
|
-
const rootPart = partFromJsonObject(object, true);
|
|
13404
|
-
if (!rootPart) throw new Error("Invalid data format");
|
|
13405
|
-
let partIdsToDelete = void 0;
|
|
13406
|
-
if ((_a = pageBuilder.model.rootPart.children) == null ? void 0 : _a.length) {
|
|
13407
|
-
partIdsToDelete = pageBuilder.model.rootPart.children.map((v) => v.partId);
|
|
13408
|
-
}
|
|
13409
|
-
const param = {
|
|
13410
|
-
delete: partIdsToDelete,
|
|
13411
|
-
insert: [
|
|
13412
|
-
{
|
|
13413
|
-
partId: pageBuilder.model.getRootPartId(),
|
|
13414
|
-
index: 0,
|
|
13415
|
-
parts: rootPart.children || []
|
|
13416
|
-
}
|
|
13417
|
-
]
|
|
13418
|
-
};
|
|
13419
|
-
pageBuilder.model.updateModel(param);
|
|
13420
|
-
} else if (Array.isArray(object) && object[0] && object[0].partType === PAGE_TYPE) {
|
|
13421
|
-
const newPages = pageBuilder.model.parseParts(json);
|
|
13422
|
-
if (!newPages) throw new Error("Invalid data format");
|
|
13423
|
-
const newPage = newPages[0];
|
|
13424
|
-
const selectedPage = pageBuilder.context.getSelectedPage();
|
|
13425
|
-
if (!selectedPage) return;
|
|
13426
|
-
const pages = pageBuilder.model.rootPart.children;
|
|
13427
|
-
if (!pages) return;
|
|
13428
|
-
let index = 0;
|
|
13429
|
-
if (pages.length == 1) {
|
|
13430
|
-
newPage.properties = {
|
|
13431
|
-
...newPage.properties || {},
|
|
13432
|
-
name: "Page"
|
|
13433
|
-
};
|
|
13434
|
-
} else if (selectedPage === pages[0]) {
|
|
13435
|
-
newPage.properties = {
|
|
13436
|
-
...newPage.properties || {},
|
|
13437
|
-
name: "Page (Mobile)"
|
|
13438
|
-
};
|
|
13439
|
-
} else if (selectedPage === pages[1]) {
|
|
13440
|
-
newPage.properties = {
|
|
13441
|
-
...newPage.properties || {},
|
|
13442
|
-
name: "Page (PC)"
|
|
13443
|
-
};
|
|
13444
|
-
index = 1;
|
|
13445
|
-
}
|
|
13446
|
-
const param = {
|
|
13447
|
-
delete: [selectedPage.partId],
|
|
13448
|
-
insert: [
|
|
13449
|
-
{
|
|
13450
|
-
partId: pageBuilder.model.getRootPartId(),
|
|
13451
|
-
index,
|
|
13452
|
-
parts: [newPage]
|
|
13453
|
-
}
|
|
13454
|
-
]
|
|
13455
|
-
};
|
|
13456
|
-
pageBuilder.model.updateModel(param);
|
|
13457
|
-
} else {
|
|
13458
|
-
const parts = pageBuilder.model.parseParts(json);
|
|
13459
|
-
if (!parts) return;
|
|
13460
|
-
let pasteType = "";
|
|
13461
|
-
parts.forEach((part) => {
|
|
13462
|
-
if (part.partType === SECTION_TYPE) pasteType = SECTION_TYPE;
|
|
13463
|
-
else if (part.partType === BLOCK_TYPE && (!pasteType || pasteType === WIDGET_TYPE)) pasteType = BLOCK_TYPE;
|
|
13464
|
-
else if (part.partType === WIDGET_TYPE && !pasteType) pasteType = WIDGET_TYPE;
|
|
13465
|
-
});
|
|
13466
|
-
if (!pasteType) return;
|
|
13467
|
-
const partsToPaste = parts.map((part) => {
|
|
13468
|
-
if (pasteType === SECTION_TYPE) {
|
|
13469
|
-
if (part.partType === SECTION_TYPE) {
|
|
13470
|
-
return part;
|
|
13471
|
-
} else if (part.partType === BLOCK_TYPE) {
|
|
13472
|
-
const section = createSection(pageBuilder);
|
|
13473
|
-
if (!section) return;
|
|
13474
|
-
section.children = [part];
|
|
13475
|
-
return section;
|
|
13476
|
-
} else {
|
|
13477
|
-
const block = createBlock(pageBuilder);
|
|
13478
|
-
if (!block) return;
|
|
13479
|
-
block.children = [part];
|
|
13480
|
-
const section = createSection(pageBuilder);
|
|
13481
|
-
if (!section) return;
|
|
13482
|
-
section.children = [block];
|
|
13483
|
-
return section;
|
|
13484
|
-
}
|
|
13485
|
-
} else if (pasteType === BLOCK_TYPE) {
|
|
13486
|
-
if (part.partType === BLOCK_TYPE) {
|
|
13487
|
-
return part;
|
|
13488
|
-
} else {
|
|
13489
|
-
const block = createBlock(pageBuilder);
|
|
13490
|
-
if (!block) return;
|
|
13491
|
-
block.children = [part];
|
|
13492
|
-
return block;
|
|
13493
|
-
}
|
|
13494
|
-
} else {
|
|
13495
|
-
return part;
|
|
13496
|
-
}
|
|
13497
|
-
}).filter(notNull);
|
|
13498
|
-
const selectedPage = pageBuilder.context.getSelectedPage();
|
|
13499
|
-
const selected = pageBuilder.context.getSelectedParts()[0] || selectedPage;
|
|
13500
|
-
if (!selectedPage || !selected) return;
|
|
13501
|
-
let selectedWidget;
|
|
13502
|
-
if (selected && selected.isWidget()) selectedWidget = selected;
|
|
13503
|
-
if (selectedWidget && selectedWidget.isNestedWidget()) selectedWidget = selectedWidget.parent;
|
|
13504
|
-
let selectedBlock;
|
|
13505
|
-
if (selectedWidget) selectedBlock = selectedWidget.parent;
|
|
13506
|
-
else if (selected && selected.isBlock()) selectedBlock = selected;
|
|
13507
|
-
let selectedSection;
|
|
13508
|
-
if (selectedBlock) selectedSection = selectedBlock.parent;
|
|
13509
|
-
else if (selected && selected.isSection()) selectedSection = selected;
|
|
13510
|
-
let targetPartId;
|
|
13511
|
-
let targetIndex = -1;
|
|
13512
|
-
let partsToInsert;
|
|
13513
|
-
if (pasteType === SECTION_TYPE) {
|
|
13514
|
-
targetPartId = selectedPage.partId;
|
|
13515
|
-
targetIndex = selectedSection ? selectedPage.children.indexOf(selectedSection) + 1 : ((_b = selectedPage.children) == null ? void 0 : _b.length) || 0;
|
|
13516
|
-
partsToInsert = partsToPaste;
|
|
13517
|
-
} else if (pasteType === BLOCK_TYPE) {
|
|
13518
|
-
if (selectedSection) {
|
|
13519
|
-
targetPartId = selectedSection.partId;
|
|
13520
|
-
targetIndex = selectedBlock ? selectedSection.children.indexOf(selectedBlock) + 1 : ((_c = selectedSection.children) == null ? void 0 : _c.length) || 0;
|
|
13521
|
-
partsToInsert = partsToPaste;
|
|
13522
|
-
} else if ((_d = selectedPage.children) == null ? void 0 : _d.length) {
|
|
13523
|
-
selectedSection = selectedPage.children[selectedPage.children.length - 1];
|
|
13524
|
-
targetPartId = selectedSection.partId;
|
|
13525
|
-
targetIndex = ((_e = selectedSection.children) == null ? void 0 : _e.length) || 0;
|
|
13526
|
-
partsToInsert = partsToPaste;
|
|
13527
|
-
} else {
|
|
13528
|
-
const newSection = createSection(pageBuilder);
|
|
13529
|
-
if (!newSection) return;
|
|
13530
|
-
newSection.children = partsToPaste;
|
|
13531
|
-
targetPartId = selectedPage.partId;
|
|
13532
|
-
targetIndex = 0;
|
|
13533
|
-
partsToInsert = [newSection];
|
|
13534
|
-
}
|
|
13535
|
-
} else if (pasteType === WIDGET_TYPE) {
|
|
13536
|
-
if (selectedBlock) {
|
|
13537
|
-
targetPartId = selectedBlock.partId;
|
|
13538
|
-
targetIndex = selectedWidget ? selectedBlock.children.indexOf(selectedWidget) + 1 : ((_f = selectedBlock.children) == null ? void 0 : _f.length) || 0;
|
|
13539
|
-
partsToInsert = partsToPaste;
|
|
13540
|
-
} else if (selectedSection || ((_g = selectedPage.children) == null ? void 0 : _g.length)) {
|
|
13541
|
-
if (!selectedSection) selectedSection = selectedPage.children[selectedPage.children.length - 1];
|
|
13542
|
-
if ((_h = selectedSection.children) == null ? void 0 : _h.length) {
|
|
13543
|
-
selectedBlock = selectedSection.children[selectedSection.children.length - 1];
|
|
13544
|
-
targetPartId = selectedBlock.partId;
|
|
13545
|
-
targetIndex = ((_i = selectedBlock.children) == null ? void 0 : _i.length) || 0;
|
|
13546
|
-
partsToInsert = partsToPaste;
|
|
13547
|
-
} else {
|
|
13548
|
-
const newBlock = createBlock(pageBuilder);
|
|
13549
|
-
if (!newBlock) return;
|
|
13550
|
-
newBlock.children = partsToPaste;
|
|
13551
|
-
targetPartId = selectedSection.partId;
|
|
13552
|
-
targetIndex = 0;
|
|
13553
|
-
partsToInsert = [newBlock];
|
|
13554
|
-
}
|
|
13555
|
-
} else {
|
|
13556
|
-
const newBlock = createBlock(pageBuilder);
|
|
13557
|
-
const newSection = createSection(pageBuilder);
|
|
13558
|
-
if (!newBlock || !newSection) return;
|
|
13559
|
-
newSection.children = [newBlock];
|
|
13560
|
-
newBlock.children = partsToPaste;
|
|
13561
|
-
targetPartId = selectedPage.partId;
|
|
13562
|
-
targetIndex = 0;
|
|
13563
|
-
partsToInsert = [newSection];
|
|
13564
|
-
}
|
|
13565
|
-
}
|
|
13566
|
-
if (!targetPartId || targetIndex < 0 || !partsToInsert) return;
|
|
13567
|
-
insertParts(pageBuilder, targetPartId, targetIndex, partsToInsert, false);
|
|
13568
|
-
}
|
|
13586
|
+
pasteContentJson(pageBuilder, json);
|
|
13569
13587
|
}
|
|
13570
13588
|
};
|
|
13571
13589
|
__publicField(_PastePartCommand, "COMMAND_ID", "PastePart");
|
|
@@ -14144,7 +14162,7 @@ class PageBuilderEditorImpl {
|
|
|
14144
14162
|
if (plugin.keyHandlers) this.keyHandlers.appendKeyHandlers(plugin.keyHandlers);
|
|
14145
14163
|
if (plugin.toolButtonGroups) this.toolButtonRegistry.registerToolButtonGroups(plugin.toolButtonGroups);
|
|
14146
14164
|
}
|
|
14147
|
-
registerCustomPlugin(plugin) {
|
|
14165
|
+
registerCustomPlugin(plugin, modal) {
|
|
14148
14166
|
if (plugin.widgets) {
|
|
14149
14167
|
const partDefinitions2 = {};
|
|
14150
14168
|
plugin.widgets.forEach((group) => {
|
|
@@ -14183,6 +14201,29 @@ class PageBuilderEditorImpl {
|
|
|
14183
14201
|
this.externalCssContent = plugin.css.content;
|
|
14184
14202
|
}
|
|
14185
14203
|
}
|
|
14204
|
+
if (plugin.contextMenus) {
|
|
14205
|
+
const self = this;
|
|
14206
|
+
const contextMenus = plugin.contextMenus.map((menu) => {
|
|
14207
|
+
return {
|
|
14208
|
+
commandId: menu.menuId,
|
|
14209
|
+
groupId: "external",
|
|
14210
|
+
precedence: 10,
|
|
14211
|
+
getMenuItem(pageBuilder) {
|
|
14212
|
+
const selected = self.context.getSelectedParts();
|
|
14213
|
+
if (menu.visible(selected)) {
|
|
14214
|
+
return {
|
|
14215
|
+
menuId: menu.menuId,
|
|
14216
|
+
caption: menu.caption,
|
|
14217
|
+
handler() {
|
|
14218
|
+
menu.handler(selected, self.model, modal);
|
|
14219
|
+
}
|
|
14220
|
+
};
|
|
14221
|
+
}
|
|
14222
|
+
}
|
|
14223
|
+
};
|
|
14224
|
+
});
|
|
14225
|
+
this.contextMenuRegistry.registerContextMenus(contextMenus);
|
|
14226
|
+
}
|
|
14186
14227
|
}
|
|
14187
14228
|
initData(data) {
|
|
14188
14229
|
const _data = JSON.parse(data || "{}") || {};
|
|
@@ -15416,6 +15457,10 @@ const enTexts = [
|
|
|
15416
15457
|
{
|
|
15417
15458
|
key: "pb.modal.htmlEditor.style",
|
|
15418
15459
|
text: "Style"
|
|
15460
|
+
},
|
|
15461
|
+
{
|
|
15462
|
+
key: "pb.prop.hideParentWhenInvisible",
|
|
15463
|
+
text: "Hide block and section when invisible"
|
|
15419
15464
|
}
|
|
15420
15465
|
];
|
|
15421
15466
|
const jaTexts = [
|
|
@@ -15738,6 +15783,10 @@ const jaTexts = [
|
|
|
15738
15783
|
{
|
|
15739
15784
|
key: "pb.modal.htmlEditor.style",
|
|
15740
15785
|
text: "スタイル"
|
|
15786
|
+
},
|
|
15787
|
+
{
|
|
15788
|
+
key: "pb.prop.hideParentWhenInvisible",
|
|
15789
|
+
text: "非表示の場合はブロックとセクションも隠す"
|
|
15741
15790
|
}
|
|
15742
15791
|
];
|
|
15743
15792
|
const koTexts = [
|
|
@@ -16060,6 +16109,10 @@ const koTexts = [
|
|
|
16060
16109
|
{
|
|
16061
16110
|
key: "pb.modal.htmlEditor.style",
|
|
16062
16111
|
text: "스타일"
|
|
16112
|
+
},
|
|
16113
|
+
{
|
|
16114
|
+
key: "pb.prop.hideParentWhenInvisible",
|
|
16115
|
+
text: "블록과 섹션도 함께 숨김처리하기"
|
|
16063
16116
|
}
|
|
16064
16117
|
];
|
|
16065
16118
|
const zhTexts = [
|
|
@@ -16382,6 +16435,10 @@ const zhTexts = [
|
|
|
16382
16435
|
{
|
|
16383
16436
|
key: "pb.modal.htmlEditor.style",
|
|
16384
16437
|
text: "样式"
|
|
16438
|
+
},
|
|
16439
|
+
{
|
|
16440
|
+
key: "pb.prop.hideParentWhenInvisible",
|
|
16441
|
+
text: "不可见时隐藏区块和区域"
|
|
16385
16442
|
}
|
|
16386
16443
|
];
|
|
16387
16444
|
i18n.addTexts("en", enTexts);
|
|
@@ -16414,7 +16471,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16414
16471
|
};
|
|
16415
16472
|
if (props.locales) pageBuilderEditor.setLocales(props.locales);
|
|
16416
16473
|
if (props.locale) pageBuilderEditor.setLocale(props.locale);
|
|
16417
|
-
if (props.plugin) pageBuilderEditor.registerCustomPlugin(props.plugin);
|
|
16474
|
+
if (props.plugin) pageBuilderEditor.registerCustomPlugin(props.plugin, modal);
|
|
16418
16475
|
pageBuilderEditor.registerPlugin({
|
|
16419
16476
|
// TODO
|
|
16420
16477
|
commands: createDefaultCommands(modal)
|
|
@@ -16434,8 +16491,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
16434
16491
|
const getPageContent = () => {
|
|
16435
16492
|
return pageBuilderEditor.model.serializeModel((part) => pageBuilderEditor.extractMedia(part));
|
|
16436
16493
|
};
|
|
16494
|
+
const pastePageContent = (contentJson) => {
|
|
16495
|
+
pasteContentJson(pageBuilderEditor, contentJson);
|
|
16496
|
+
};
|
|
16437
16497
|
__expose({
|
|
16438
|
-
getPageContent
|
|
16498
|
+
getPageContent,
|
|
16499
|
+
pastePageContent
|
|
16439
16500
|
});
|
|
16440
16501
|
return (_ctx, _cache) => {
|
|
16441
16502
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|