@g1cloud/page-builder-editor 1.0.0-alpha.21 → 1.0.0-alpha.22

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.
@@ -1,25 +1,18 @@
1
- .pb-page {
2
- // @import "pb-simple-carousel";
3
- // @import "pb-simple-html";
4
- // @import "pb-simple-media";
5
- // @import "pb-simple-button";
6
- // @import "pb-animation";
7
- // @import "coupon-download";
8
- // @import "pb-tabs";
9
- // @import "pb-image-map";
10
-
1
+ .pb-page-wrapper {
11
2
  margin: 0 auto;
12
- margin-top: 20px;
3
+ padding: 0;
4
+ }
5
+
6
+ .pb-page {
7
+ margin: 20px 0 auto 0;
13
8
  background-position: 50% 50%;
14
9
  background-repeat: no-repeat;
15
10
  background-size: cover;
16
- // background-color: white;
17
11
 
18
12
  .pb-page-content {
19
13
  &.selected {
20
14
  outline: 2px solid #4998f8;
21
15
  outline-offset: 5px;
22
- // z-index: 9999;
23
16
  }
24
17
  }
25
18
 
package/css/canvas.scss CHANGED
@@ -16,29 +16,30 @@ html, body {
16
16
  }
17
17
 
18
18
  body {
19
- background-color: white;
20
- height: 100%;
21
19
  margin: 0;
20
+ padding: 0;
21
+ background-color: $color-canvas-frame-bg;
22
+ overflow: auto;
22
23
  }
23
24
 
24
25
  .pb-canvas-wrapper {
25
- padding: 32px 40px 56px 40px;
26
- height: 100%;
27
- background-color: $color-canvas-frame-bg;
28
- overflow: auto;
26
+ margin: 0;
27
+ padding: 0;
28
+ width: fit-content;
29
+ //overflow: auto;
29
30
 
30
31
  .pb-canvas {
31
- // background-color: white;
32
32
  display: flex;
33
33
  flex-direction: row;
34
+ flex: 1 1 auto;
35
+ //flex-grow: 1;
36
+ //flex-shrink: 1;
34
37
  transform-origin: top left;
35
-
36
38
  width: fit-content;
37
- min-width: 40px;
38
- min-height: 40px;
39
- // box-shadow: 4px 4px 8px $color-gray;
40
- margin: 0 auto;
41
- // margin-bottom: 100px;
39
+ //margin: 0 auto;
40
+ margin: 0;
41
+ //padding: 0;
42
+ padding: 32px 40px 56px 40px;
42
43
  }
43
44
  }
44
45
 
@@ -46,20 +47,14 @@ body {
46
47
  background-color: #ff3333;
47
48
  opacity: 0.5;
48
49
  border-radius: 2px;
49
- // z-index: 999;
50
50
  }
51
51
 
52
52
  .pb-add-section-handle {
53
53
  position: relative;
54
- // width: 33.33%;
55
- // background: rgba(230, 126, 34, 0.5);
56
- // position: relative;
57
54
  text-align: center;
58
55
  cursor: pointer;
59
56
  z-index: 5;
60
57
  height: 0;
61
- // opacity: 0;
62
- // margin: 0;
63
58
 
64
59
  &.top::before,
65
60
  &.bottom::before,
@@ -69,39 +64,22 @@ body {
69
64
  left: 0;
70
65
  right: 0;
71
66
  top: 0;
72
- // height: 2px;
73
- // background: rgba(0, 0, 0, 0.5);
74
67
  opacity: 0;
75
68
  pointer-events: none;
76
69
  }
77
70
 
78
71
  &.top {
79
- // top: 0;
80
- // left: 50%;
81
- // transform: translate(-50%, -50%);
82
- // margin-top: 24px;
83
- // margin-bottom: 24px;
84
72
  }
85
73
 
86
74
  &.middle {
87
- // top: 0;
88
- // left: 50%;
89
- // transform: translate(-50%, -50%);
90
- // margin-top: 24px;
91
- // margin-bottom: 24px;
92
75
  }
93
76
 
94
77
  &.bottom {
95
- // bottom: 0;
96
78
  left: 50%;
97
79
  bottom: -32px;
98
- // transform: translate(-50%, 50%);
99
- // margin-top: 24px;
100
80
  }
101
81
 
102
82
  &:hover {
103
- // opacity: 1;
104
-
105
83
  &.top::before,
106
84
  &.bottom::before,
107
85
  &.middle::before,
@@ -234,7 +234,11 @@
234
234
 
235
235
  .content {
236
236
  border: solid 1px #ccc;
237
- overflow-y: auto;
237
+
238
+ iframe {
239
+ width: 100%;
240
+ height: 100%;
241
+ }
238
242
  }
239
243
  }
240
244
 
@@ -245,7 +249,6 @@
245
249
  height: 60%;
246
250
 
247
251
  .content {
248
- overflow-y: auto;
249
252
  }
250
253
  }
251
254
 
@@ -253,7 +256,6 @@
253
256
  height: 40%;
254
257
 
255
258
  .content {
256
- overflow-y: auto;
257
259
  }
258
260
  }
259
261
 
@@ -1,42 +1,45 @@
1
- import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createSlots, renderList } from "vue";
2
- import { useModalHandle, BSModalFrame, BSTabSheet, BSCodeEditor } from "@g1cloud/bluesea";
1
+ import { defineComponent, ref, computed, onMounted, onBeforeUnmount, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createSlots, renderList } from "vue";
2
+ import { useModalHandle, waitDuring, BSModalFrame, BSTabSheet, BSCodeEditor } from "@g1cloud/bluesea";
3
3
  const _hoisted_1 = { class: "bs-layout-vertical flex-grow-1 h-full" };
4
4
  const _hoisted_2 = { class: "bs-layout-horizontal h-full pt-8" };
5
- const _hoisted_3 = { class: "preview flex-grow-1" };
5
+ const _hoisted_3 = { class: "preview" };
6
6
  const _hoisted_4 = { class: "bs-layout-vertical w-full h-full" };
7
7
  const _hoisted_5 = /* @__PURE__ */ createElementVNode("div", { class: "title pb-4" }, "Preview", -1);
8
- const _hoisted_6 = ["innerHTML"];
9
- const _hoisted_7 = { class: "editor bs-layout-vertical pl-8" };
10
- const _hoisted_8 = { class: "tags bs-layout-vertical w-full" };
11
- const _hoisted_9 = /* @__PURE__ */ createElementVNode("div", { class: "title pb-4" }, "HTML", -1);
12
- const _hoisted_10 = { class: "content flex-grow-1" };
13
- const _hoisted_11 = { class: "style bs-layout-vertical w-full pt-8" };
14
- const _hoisted_12 = /* @__PURE__ */ createElementVNode("div", { class: "title pb-4" }, "Style", -1);
15
- const _hoisted_13 = { class: "content flex-grow-1" };
8
+ const _hoisted_6 = { class: "content flex-grow-1" };
9
+ const _hoisted_7 = ["srcdoc"];
10
+ const _hoisted_8 = { class: "editor bs-layout-vertical pl-8 h-full" };
16
11
  const _sfc_main = /* @__PURE__ */ defineComponent({
17
12
  __name: "PbHtmlEditorModal",
18
13
  props: {
19
14
  html: {},
20
15
  locales: {},
21
- localeTabs: {}
16
+ localeTabs: {},
17
+ pageBuilder: {}
22
18
  },
23
19
  emits: ["updateHtml"],
24
20
  setup(__props, { emit: __emit }) {
25
21
  const props = __props;
26
22
  const emit = __emit;
27
- const tabId = ref(props.localeTabs && props.localeTabs[0].tabId);
23
+ const localeTabId = ref(props.localeTabs && props.localeTabs[0].tabId);
28
24
  const modalHandle = useModalHandle();
29
25
  const html = ref(props.html || {});
30
26
  const preview = computed(() => {
31
27
  var _a;
32
28
  let data = {};
29
+ const externalCss = props.pageBuilder.getExternalCss();
33
30
  (_a = props.locales) == null ? void 0 : _a.forEach((locale) => {
34
31
  const _html = html.value[locale] || { tags: "", style: "" };
35
- data[locale] = _html.tags ? `${_html.tags}
36
- <style>${_html.style}</style>` : "";
32
+ data[locale] = _html.tags ? `${externalCss}
33
+ <style>${_html.style}</style>
34
+ ${_html.tags}` : "";
37
35
  });
38
36
  return data;
39
37
  });
38
+ const editorTabs = [
39
+ { tabId: "tags", caption: "Tags" },
40
+ { tabId: "style", caption: "Style" }
41
+ ];
42
+ const editorTabId = ref("tags");
40
43
  const updateTags = (locale, value) => {
41
44
  if (!html.value)
42
45
  html.value = {};
@@ -55,6 +58,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
55
58
  emit("updateHtml", html.value);
56
59
  modalHandle.close();
57
60
  };
61
+ const editorHeight = ref("");
62
+ const updateEditorHeight = async () => {
63
+ await waitDuring(50);
64
+ if (editorHeight.value) {
65
+ const editor = document.querySelector(".bs-code-editor");
66
+ if (editor) {
67
+ editor.style.height = editorHeight.value;
68
+ }
69
+ }
70
+ };
71
+ let resizeObserver;
72
+ onMounted(async () => {
73
+ await waitDuring(50);
74
+ const editorParent = document.querySelector(".editor > .bs-tab-sheet > .bs-layout-vertical");
75
+ resizeObserver = new ResizeObserver(() => {
76
+ if (editorParent && editorParent.clientHeight) {
77
+ editorHeight.value = `${editorParent.clientHeight}px`;
78
+ updateEditorHeight();
79
+ }
80
+ });
81
+ if (editorParent) {
82
+ resizeObserver.observe(editorParent);
83
+ }
84
+ });
85
+ onBeforeUnmount(() => {
86
+ if (resizeObserver) {
87
+ resizeObserver.disconnect();
88
+ }
89
+ });
58
90
  return (_ctx, _cache) => {
59
91
  return openBlock(), createBlock(unref(BSModalFrame), {
60
92
  class: "pb-html-editor-modal",
@@ -63,8 +95,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
63
95
  default: withCtx(() => [
64
96
  createElementVNode("div", _hoisted_1, [
65
97
  createVNode(unref(BSTabSheet), {
66
- "tab-id": tabId.value,
67
- "onUpdate:tabId": _cache[0] || (_cache[0] = ($event) => tabId.value = $event),
98
+ "tab-id": localeTabId.value,
99
+ "onUpdate:tabId": [
100
+ _cache[1] || (_cache[1] = ($event) => localeTabId.value = $event),
101
+ updateEditorHeight
102
+ ],
68
103
  tabs: _ctx.localeTabs,
69
104
  class: "flex-grow-1"
70
105
  }, createSlots({ _: 2 }, [
@@ -76,35 +111,41 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
76
111
  createElementVNode("div", _hoisted_3, [
77
112
  createElementVNode("div", _hoisted_4, [
78
113
  _hoisted_5,
79
- createElementVNode("div", {
80
- class: "content flex-grow-1",
81
- innerHTML: preview.value[locale]
82
- }, null, 8, _hoisted_6)
114
+ createElementVNode("div", _hoisted_6, [
115
+ createElementVNode("iframe", {
116
+ srcdoc: preview.value[locale]
117
+ }, null, 8, _hoisted_7)
118
+ ])
83
119
  ])
84
120
  ]),
85
- createElementVNode("div", _hoisted_7, [
86
- createElementVNode("div", _hoisted_8, [
87
- _hoisted_9,
88
- createElementVNode("div", _hoisted_10, [
121
+ createElementVNode("div", _hoisted_8, [
122
+ createVNode(unref(BSTabSheet), {
123
+ "tab-id": editorTabId.value,
124
+ "onUpdate:tabId": [
125
+ _cache[0] || (_cache[0] = ($event) => editorTabId.value = $event),
126
+ updateEditorHeight
127
+ ],
128
+ tabs: editorTabs,
129
+ class: "flex-grow-1"
130
+ }, {
131
+ tags: withCtx(() => [
89
132
  createVNode(unref(BSCodeEditor), {
90
133
  "model-value": (html.value[locale] || {}).tags,
91
134
  "editor-height": "100%",
92
135
  lang: "html",
93
136
  "onUpdate:modelValue": (value) => updateTags(locale, value)
94
137
  }, null, 8, ["model-value", "onUpdate:modelValue"])
95
- ])
96
- ]),
97
- createElementVNode("div", _hoisted_11, [
98
- _hoisted_12,
99
- createElementVNode("div", _hoisted_13, [
138
+ ]),
139
+ style: withCtx(() => [
100
140
  createVNode(unref(BSCodeEditor), {
101
141
  "model-value": (html.value[locale] || {}).style,
102
142
  "editor-height": "100%",
103
143
  lang: "css",
104
144
  "onUpdate:modelValue": (value) => updateStyle(locale, value)
105
145
  }, null, 8, ["model-value", "onUpdate:modelValue"])
106
- ])
107
- ])
146
+ ]),
147
+ _: 2
148
+ }, 1032, ["tab-id"])
108
149
  ])
109
150
  ])
110
151
  ])
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, createVNode, unref } from "vue";
2
2
  import { BSTextInput } from "@g1cloud/bluesea";
3
- import { P as PbColorPicker } from "./index-Cr-_-n9T.js";
3
+ import { P as PbColorPicker } from "./index-Bss8IrUk.js";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-color" };
5
5
  const _hoisted_2 = { class: "title" };
6
6
  const _hoisted_3 = ["textContent"];
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString, defineAsyncComponent } from "vue";
2
2
  import { useModal } from "@g1cloud/bluesea";
3
- import { u as usePageBuilderEditor } from "./index-Cr-_-n9T.js";
3
+ import { u as usePageBuilderEditor } from "./index-Bss8IrUk.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 _hoisted_3 = ["textContent"];
@@ -20,7 +20,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  const locales = pageBuilder.getLocales();
21
21
  const localeTabs = locales.map((v) => ({ tabId: `tab-${v}`, caption: v }));
22
22
  modal.openModal({
23
- component: defineAsyncComponent(() => import("./PbHtmlEditorModal-aaecwH7V.js")),
23
+ component: defineAsyncComponent(() => import("./PbHtmlEditorModal-pn7PlMQg.js")),
24
24
  style: {
25
25
  width: "80%",
26
26
  height: "80%",
@@ -30,7 +30,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
30
30
  bind: {
31
31
  html: JSON.parse(JSON.stringify(props.value || {})),
32
32
  locales,
33
- localeTabs
33
+ localeTabs,
34
+ pageBuilder
34
35
  },
35
36
  on: {
36
37
  updateHtml: (html) => {
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, openBlock, createElementBlock, createElementVNode, toDisplayString } from "vue";
2
- import { u as usePageBuilderEditor } from "./index-Cr-_-n9T.js";
2
+ import { u as usePageBuilderEditor } from "./index-Bss8IrUk.js";
3
3
  import { useModal } from "@g1cloud/bluesea";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-image flex-align-center" };
5
5
  const _hoisted_2 = { class: "title" };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, createBlock, unref } from "vue";
2
2
  import { BSMultiLangTextArea, BSTextArea } from "@g1cloud/bluesea";
3
- import { u as usePageBuilderEditor } from "./index-Cr-_-n9T.js";
3
+ import { u as usePageBuilderEditor } from "./index-Bss8IrUk.js";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-multiline-text" };
5
5
  const _hoisted_2 = { class: "title" };
6
6
  const _hoisted_3 = ["textContent"];
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, createBlock, unref } from "vue";
2
2
  import { BSMultiLangTextInput, BSTextInput } from "@g1cloud/bluesea";
3
- import { u as usePageBuilderEditor } from "./index-Cr-_-n9T.js";
3
+ import { u as usePageBuilderEditor } from "./index-Bss8IrUk.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 _hoisted_3 = ["textContent"];
@@ -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-Cr-_-n9T.js";
3
+ import { w as widgetPartDefinitions } from "./index-Bss8IrUk.js";
4
4
  const _hoisted_1 = { class: "bs-layout-vertical pb-part-add-modal" };
5
5
  const _hoisted_2 = /* @__PURE__ */ createElementVNode("div", {
6
6
  class: "mb-8",
@@ -1,15 +1,18 @@
1
+ import { PageBuilderEditor } from '../../model/page-builder-editor.ts';
1
2
  import { TabEntry } from '@g1cloud/bluesea';
2
3
 
3
4
  declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
4
5
  html?: Record<string, unknown> | undefined;
5
6
  locales?: string[] | undefined;
6
7
  localeTabs?: TabEntry[] | undefined;
8
+ pageBuilder: PageBuilderEditor;
7
9
  }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
8
10
  updateHtml: (html: Record<string, unknown>) => void;
9
11
  }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
10
12
  html?: Record<string, unknown> | undefined;
11
13
  locales?: string[] | undefined;
12
14
  localeTabs?: TabEntry[] | undefined;
15
+ pageBuilder: PageBuilderEditor;
13
16
  }>>> & {
14
17
  onUpdateHtml?: ((html: Record<string, unknown>) => any) | undefined;
15
18
  }, {}, {}>;
@@ -1,11 +1,11 @@
1
1
  import { IPart } from '@g1cloud/page-builder-viewer';
2
2
 
3
3
  declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
4
- page: IPart | undefined;
4
+ part: IPart;
5
5
  width: number;
6
6
  isMobilePage: boolean;
7
7
  }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
- page: IPart | undefined;
8
+ part: IPart;
9
9
  width: number;
10
10
  isMobilePage: boolean;
11
11
  }>>>, {}, {}>;
@@ -0,0 +1,21 @@
1
+ import { IPart } from '@g1cloud/page-builder-viewer';
2
+
3
+ declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<{
4
+ part: IPart;
5
+ width: number;
6
+ isMobilePage: boolean;
7
+ }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
8
+ part: IPart;
9
+ width: number;
10
+ isMobilePage: boolean;
11
+ }>>>, {}, {}>;
12
+ export default _default;
13
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
+ type __VLS_TypePropsToRuntimeProps<T> = {
15
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
16
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
+ } : {
18
+ type: import('vue').PropType<T[K]>;
19
+ required: true;
20
+ };
21
+ };