@g1cloud/page-builder-editor 1.0.0-alpha.83 → 1.0.0-alpha.84

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,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-CzWzYmyG.js";
3
+ import { P as PbColorPicker } from "./index-7cKWXpSb.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, createVNode } from "vue";
2
2
  import { vT, BSTextInput } from "@g1cloud/bluesea";
3
- import { t as toCssLength } from "./index-CzWzYmyG.js";
3
+ import { t as toCssLength } from "./index-7cKWXpSb.js";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-number 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, createTextVNode, defineAsyncComponent } from "vue";
2
2
  import { useModal, vT } from "@g1cloud/bluesea";
3
- import { u as usePageBuilderEditor } from "./index-CzWzYmyG.js";
3
+ import { u as usePageBuilderEditor } from "./index-7cKWXpSb.js";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-html 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, computed, openBlock, createElementBlock, createElementVNode, withDirectives, unref, createTextVNode, toDisplayString, createVNode, createCommentVNode, Fragment } from "vue";
2
- import { u as usePageBuilderEditor, C as ChangePropertyCommand } from "./index-CzWzYmyG.js";
2
+ import { u as usePageBuilderEditor, C as ChangePropertyCommand } from "./index-7cKWXpSb.js";
3
3
  import { useModal, vT, BSButton, BSMultiLangTextInput, showNotification } from "@g1cloud/bluesea";
4
4
  const _hoisted_1 = { class: "property-editor property-editor-image" };
5
5
  const _hoisted_2 = { class: "title" };
@@ -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-CzWzYmyG.js";
3
+ import { u as usePageBuilderEditor } from "./index-7cKWXpSb.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-CzWzYmyG.js";
3
+ import { u as usePageBuilderEditor } from "./index-7cKWXpSb.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-CzWzYmyG.js";
3
+ import { s as selectYoutubeVideo } from "./index-7cKWXpSb.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-CzWzYmyG.js";
3
+ import { w as widgetPartDefinitions } from "./index-7cKWXpSb.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"];
@@ -7083,7 +7083,7 @@ const _sfc_main$9$1 = /* @__PURE__ */ defineComponent({
7083
7083
  }
7084
7084
  });
7085
7085
  const _hoisted_1$7$1 = ["href", "target"];
7086
- const _hoisted_2$4$1 = ["alt", "src"];
7086
+ const _hoisted_2$3$1 = ["alt", "src"];
7087
7087
  const _hoisted_3$d = ["alt", "src"];
7088
7088
  const _hoisted_4$b = ["poster"];
7089
7089
  const _hoisted_5$8 = ["src"];
@@ -7142,7 +7142,7 @@ const _sfc_main$8$1 = /* @__PURE__ */ defineComponent({
7142
7142
  src: ((_d = _ctx.part.properties) == null ? void 0 : _d.media).fileUrl,
7143
7143
  style: normalizeStyle(style.value),
7144
7144
  class: "image"
7145
- }, null, 12, _hoisted_2$4$1)
7145
+ }, null, 12, _hoisted_2$3$1)
7146
7146
  ], 8, _hoisted_1$7$1)) : (openBlock(), createElementBlock("img", {
7147
7147
  key: 1,
7148
7148
  alt: altText.value,
@@ -7168,7 +7168,7 @@ const _sfc_main$8$1 = /* @__PURE__ */ defineComponent({
7168
7168
  }
7169
7169
  });
7170
7170
  const _hoisted_1$6$1 = ["textContent"];
7171
- const _hoisted_2$3$1 = {
7171
+ const _hoisted_2$2$1 = {
7172
7172
  key: 1,
7173
7173
  class: "placeholder",
7174
7174
  textContent: "Empty Text"
@@ -7208,12 +7208,12 @@ const _sfc_main$7$1 = /* @__PURE__ */ defineComponent({
7208
7208
  style: normalizeStyle(style.value),
7209
7209
  class: "text",
7210
7210
  textContent: toDisplayString(text.value)
7211
- }, null, 12, _hoisted_1$6$1)) : _ctx.placeholder ? (openBlock(), createElementBlock("div", _hoisted_2$3$1)) : createCommentVNode("", true);
7211
+ }, null, 12, _hoisted_1$6$1)) : _ctx.placeholder ? (openBlock(), createElementBlock("div", _hoisted_2$2$1)) : createCommentVNode("", true);
7212
7212
  };
7213
7213
  }
7214
7214
  });
7215
7215
  const _hoisted_1$5$1 = ["innerHTML"];
7216
- const _hoisted_2$2$1 = {
7216
+ const _hoisted_2$1$1 = {
7217
7217
  key: 1,
7218
7218
  class: "placeholder",
7219
7219
  textContent: "Empty HTML"
@@ -7236,28 +7236,78 @@ const _sfc_main$6$1 = /* @__PURE__ */ defineComponent({
7236
7236
  _html = html2;
7237
7237
  }
7238
7238
  if (!_html) {
7239
- return "";
7239
+ return;
7240
7240
  }
7241
- return `${_html.tags}
7242
- <style>
7243
- ${_html.style}
7244
- </style>`;
7241
+ return { tags: _html.tags, style: _html.style };
7245
7242
  };
7246
7243
  const html = computed(() => {
7247
7244
  var _a;
7248
7245
  return getHtml((_a = props.part.properties) == null ? void 0 : _a.html);
7249
7246
  });
7247
+ const partRef = ref(null);
7248
+ let observer = null;
7249
+ function ensureStyleTag() {
7250
+ var _a;
7251
+ removeStyleTag();
7252
+ if (!partRef.value) return;
7253
+ const doc = partRef.value.ownerDocument;
7254
+ if (!doc || !((_a = html.value) == null ? void 0 : _a.style)) return;
7255
+ const styleId = `data-part-style-id="${props.part.partId}"`;
7256
+ const apply = () => {
7257
+ var _a2;
7258
+ let styleEl = doc.head.querySelector(`style[${styleId}]`);
7259
+ if (!styleEl) {
7260
+ styleEl = doc.createElement("style");
7261
+ styleEl.setAttribute("data-part-style-id", props.part.partId);
7262
+ doc.head.appendChild(styleEl);
7263
+ }
7264
+ styleEl.textContent = ((_a2 = html.value) == null ? void 0 : _a2.style) || "";
7265
+ };
7266
+ apply();
7267
+ observer = new MutationObserver(() => {
7268
+ const styleExists = doc.head.querySelector(`style[${styleId}]`);
7269
+ if (!styleExists) {
7270
+ apply();
7271
+ }
7272
+ });
7273
+ observer.observe(doc.head, { childList: true, subtree: false });
7274
+ }
7275
+ function removeStyleTag() {
7276
+ if (!partRef.value) return;
7277
+ const doc = partRef.value.ownerDocument;
7278
+ if (!doc) return;
7279
+ const styleEl = doc.head.querySelector(`style[data-part-style-id="${props.part.partId}"]`);
7280
+ if (styleEl) {
7281
+ doc.head.removeChild(styleEl);
7282
+ }
7283
+ if (observer) {
7284
+ observer.disconnect();
7285
+ observer = null;
7286
+ }
7287
+ }
7288
+ watch(html, () => {
7289
+ ensureStyleTag();
7290
+ });
7291
+ onMounted(() => {
7292
+ ensureStyleTag();
7293
+ });
7294
+ onBeforeUnmount(() => {
7295
+ removeStyleTag();
7296
+ });
7250
7297
  return (_ctx, _cache) => {
7251
- return html.value ? (openBlock(), createElementBlock("div", {
7298
+ var _a, _b;
7299
+ return ((_a = html.value) == null ? void 0 : _a.tags) ? (openBlock(), createElementBlock("div", {
7252
7300
  key: 0,
7301
+ ref_key: "partRef",
7302
+ ref: partRef,
7253
7303
  class: "html",
7254
- innerHTML: html.value
7255
- }, null, 8, _hoisted_1$5$1)) : _ctx.placeholder ? (openBlock(), createElementBlock("div", _hoisted_2$2$1)) : createCommentVNode("", true);
7304
+ innerHTML: (_b = html.value) == null ? void 0 : _b.tags
7305
+ }, null, 8, _hoisted_1$5$1)) : _ctx.placeholder ? (openBlock(), createElementBlock("div", _hoisted_2$1$1)) : createCommentVNode("", true);
7256
7306
  };
7257
7307
  }
7258
7308
  });
7259
7309
  const _hoisted_1$4$1 = ["src"];
7260
- const _hoisted_2$1$1 = {
7310
+ const _hoisted_2$i = {
7261
7311
  key: 1,
7262
7312
  class: "placeholder",
7263
7313
  textContent: "Empty URL"
@@ -7405,7 +7455,7 @@ const _sfc_main$5$1 = /* @__PURE__ */ defineComponent({
7405
7455
  ref: iframeRef,
7406
7456
  src: url.value,
7407
7457
  style: normalizeStyle(style.value)
7408
- }, null, 12, _hoisted_1$4$1)) : _ctx.placeholder ? (openBlock(), createElementBlock("div", _hoisted_2$1$1)) : createCommentVNode("", true);
7458
+ }, null, 12, _hoisted_1$4$1)) : _ctx.placeholder ? (openBlock(), createElementBlock("div", _hoisted_2$i)) : createCommentVNode("", true);
7409
7459
  };
7410
7460
  }
7411
7461
  });
@@ -7722,8 +7772,7 @@ const _sfc_main$3$1 = /* @__PURE__ */ defineComponent({
7722
7772
  };
7723
7773
  }
7724
7774
  });
7725
- const _hoisted_1$1$1 = ["innerHTML"];
7726
- const _hoisted_2$i = { class: "pb-viewer" };
7775
+ const _hoisted_1$1$1 = { class: "pb-viewer" };
7727
7776
  const _sfc_main$2$1 = /* @__PURE__ */ defineComponent({
7728
7777
  __name: "PageBuilderViewer",
7729
7778
  props: {
@@ -7739,7 +7788,6 @@ const _sfc_main$2$1 = /* @__PURE__ */ defineComponent({
7739
7788
  if (props.plugin) viewer.registerCustomPlugin(props.plugin);
7740
7789
  providePageBuilderViewer(viewer);
7741
7790
  providePageBuilder(viewer);
7742
- const externalCss = viewer.getExternalCss();
7743
7791
  const part = computed(() => {
7744
7792
  const parts = viewer.model.rootPart.value.children;
7745
7793
  if (!parts || !parts.length) return;
@@ -7758,20 +7806,41 @@ const _sfc_main$2$1 = /* @__PURE__ */ defineComponent({
7758
7806
  }
7759
7807
  }
7760
7808
  );
7809
+ const styleTag = computed(() => viewer.externalCssContent);
7810
+ function ensureStyleTag() {
7811
+ removeStyleTag();
7812
+ if (!styleTag.value) return;
7813
+ let styleEl = document.head.querySelector(".pb-viewer-style");
7814
+ if (!styleEl) {
7815
+ styleEl = document.createElement("style");
7816
+ styleEl.classList.add("pb-viewer-style");
7817
+ document.head.appendChild(styleEl);
7818
+ }
7819
+ styleEl.textContent = styleTag.value;
7820
+ }
7821
+ function removeStyleTag() {
7822
+ const styleEl = document.head.querySelector(".pb-viewer-style");
7823
+ if (styleEl) {
7824
+ document.head.removeChild(styleEl);
7825
+ }
7826
+ }
7827
+ watch(styleTag, () => {
7828
+ ensureStyleTag();
7829
+ });
7830
+ onMounted(() => {
7831
+ ensureStyleTag();
7832
+ });
7833
+ onBeforeUnmount(() => {
7834
+ removeStyleTag();
7835
+ });
7761
7836
  return (_ctx, _cache) => {
7762
- return openBlock(), createElementBlock(Fragment, null, [
7763
- unref(externalCss) ? (openBlock(), createElementBlock("div", {
7837
+ return openBlock(), createElementBlock("div", _hoisted_1$1$1, [
7838
+ part.value ? (openBlock(), createBlock$1(_sfc_main$3$1, {
7764
7839
  key: 0,
7765
- innerHTML: unref(externalCss)
7766
- }, null, 8, _hoisted_1$1$1)) : createCommentVNode("", true),
7767
- createElementVNode("div", _hoisted_2$i, [
7768
- part.value ? (openBlock(), createBlock$1(_sfc_main$3$1, {
7769
- key: 0,
7770
- "is-mobile-page": _ctx.isMobilePage,
7771
- part: part.value
7772
- }, null, 8, ["is-mobile-page", "part"])) : createCommentVNode("", true)
7773
- ])
7774
- ], 64);
7840
+ "is-mobile-page": _ctx.isMobilePage,
7841
+ part: part.value
7842
+ }, null, 8, ["is-mobile-page", "part"])) : createCommentVNode("", true)
7843
+ ]);
7775
7844
  };
7776
7845
  }
7777
7846
  });
@@ -8404,16 +8473,16 @@ class PartManager {
8404
8473
  const defaultPartPropertyEditors = () => {
8405
8474
  return {
8406
8475
  "readonly-text": () => defineAsyncComponent(() => import("./PbPropertyEditorReadonlyText-BJ5qx69O.js")),
8407
- "text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-BqXqhBvc.js")),
8476
+ "text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-_pmqNt0Q.js")),
8408
8477
  "number": () => defineAsyncComponent(() => import("./PbPropertyEditorNumber-B76ArSb5.js")),
8409
8478
  "boolean": () => defineAsyncComponent(() => import("./PbPropertyEditorBoolean-c5CNiTpt.js")),
8410
- "multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-CP-gnrl0.js")),
8479
+ "multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-BGl9Ymfs.js")),
8411
8480
  "select": () => defineAsyncComponent(() => import("./PbPropertyEditorSelect-B5sfulvx.js")),
8412
- "css-length": () => defineAsyncComponent(() => import("./PbPropertyEditorCssLength-Cq5y3hp5.js")),
8413
- "color": () => defineAsyncComponent(() => import("./PbPropertyEditorColor-B2whCX1d.js")),
8414
- "image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-CAULnDMs.js")),
8415
- "html": () => defineAsyncComponent(() => import("./PbPropertyEditorHtml-DunmjOZP.js")),
8416
- "youtube": () => defineAsyncComponent(() => import("./PbPropertyEditorYoutube-BM-3CS85.js"))
8481
+ "css-length": () => defineAsyncComponent(() => import("./PbPropertyEditorCssLength-OmHOXifI.js")),
8482
+ "color": () => defineAsyncComponent(() => import("./PbPropertyEditorColor-Drq7aJIZ.js")),
8483
+ "image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-Dv6SR-r1.js")),
8484
+ "html": () => defineAsyncComponent(() => import("./PbPropertyEditorHtml-Ce3uSfj1.js")),
8485
+ "youtube": () => defineAsyncComponent(() => import("./PbPropertyEditorYoutube-C9V3otnf.js"))
8417
8486
  };
8418
8487
  };
8419
8488
  const getPropertyValueOfParts = (parts, propertyName) => {
@@ -13053,7 +13122,7 @@ __publicField(_OpenAddWidgetModalCommand, "COMMAND_ID", "OpenAddWidgetModal");
13053
13122
  let OpenAddWidgetModalCommand = _OpenAddWidgetModalCommand;
13054
13123
  const openWidgetAddModal = (modal, args, callback) => {
13055
13124
  modal.openModal({
13056
- component: defineAsyncComponent(() => import("./PbWidgetAddModal-B0EJiVqs.js")),
13125
+ component: defineAsyncComponent(() => import("./PbWidgetAddModal-DTdNz5d_.js")),
13057
13126
  style: {
13058
13127
  width: "80%",
13059
13128
  height: "80%",
@@ -1,4 +1,4 @@
1
- import { B, b, M, c, d, e, _, a, f, g, h, i, j, k, l, m, n, R, o, S, p, W, q, r, v, x, y, z, A, D, E } from "./index-CzWzYmyG.js";
1
+ import { B, b, M, c, d, e, _, a, f, g, h, i, j, k, l, m, n, R, o, S, p, W, q, r, v, x, y, z, A, D, E } from "./index-7cKWXpSb.js";
2
2
  export {
3
3
  B as BLOCK_TYPE,
4
4
  b as Block,
@@ -7084,7 +7084,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7084
7084
  }
7085
7085
  });
7086
7086
  const _hoisted_1$7$1 = ["href", "target"];
7087
- const _hoisted_2$4$1 = ["alt", "src"];
7087
+ const _hoisted_2$3$1 = ["alt", "src"];
7088
7088
  const _hoisted_3$k = ["alt", "src"];
7089
7089
  const _hoisted_4$f = ["poster"];
7090
7090
  const _hoisted_5$b = ["src"];
@@ -7143,7 +7143,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7143
7143
  src: ((_d = _ctx.part.properties) == null ? void 0 : _d.media).fileUrl,
7144
7144
  style: vue.normalizeStyle(style.value),
7145
7145
  class: "image"
7146
- }, null, 12, _hoisted_2$4$1)
7146
+ }, null, 12, _hoisted_2$3$1)
7147
7147
  ], 8, _hoisted_1$7$1)) : (vue.openBlock(), vue.createElementBlock("img", {
7148
7148
  key: 1,
7149
7149
  alt: altText.value,
@@ -7169,7 +7169,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7169
7169
  }
7170
7170
  });
7171
7171
  const _hoisted_1$6$1 = ["textContent"];
7172
- const _hoisted_2$3$1 = {
7172
+ const _hoisted_2$2$1 = {
7173
7173
  key: 1,
7174
7174
  class: "placeholder",
7175
7175
  textContent: "Empty Text"
@@ -7209,12 +7209,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7209
7209
  style: vue.normalizeStyle(style.value),
7210
7210
  class: "text",
7211
7211
  textContent: vue.toDisplayString(text.value)
7212
- }, null, 12, _hoisted_1$6$1)) : _ctx.placeholder ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3$1)) : vue.createCommentVNode("", true);
7212
+ }, null, 12, _hoisted_1$6$1)) : _ctx.placeholder ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2$1)) : vue.createCommentVNode("", true);
7213
7213
  };
7214
7214
  }
7215
7215
  });
7216
7216
  const _hoisted_1$5$1 = ["innerHTML"];
7217
- const _hoisted_2$2$1 = {
7217
+ const _hoisted_2$1$1 = {
7218
7218
  key: 1,
7219
7219
  class: "placeholder",
7220
7220
  textContent: "Empty HTML"
@@ -7237,28 +7237,78 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
7237
7237
  _html = html2;
7238
7238
  }
7239
7239
  if (!_html) {
7240
- return "";
7240
+ return;
7241
7241
  }
7242
- return `${_html.tags}
7243
- <style>
7244
- ${_html.style}
7245
- </style>`;
7242
+ return { tags: _html.tags, style: _html.style };
7246
7243
  };
7247
7244
  const html = vue.computed(() => {
7248
7245
  var _a;
7249
7246
  return getHtml((_a = props.part.properties) == null ? void 0 : _a.html);
7250
7247
  });
7248
+ const partRef = vue.ref(null);
7249
+ let observer = null;
7250
+ function ensureStyleTag() {
7251
+ var _a;
7252
+ removeStyleTag();
7253
+ if (!partRef.value) return;
7254
+ const doc = partRef.value.ownerDocument;
7255
+ if (!doc || !((_a = html.value) == null ? void 0 : _a.style)) return;
7256
+ const styleId = `data-part-style-id="${props.part.partId}"`;
7257
+ const apply = () => {
7258
+ var _a2;
7259
+ let styleEl = doc.head.querySelector(`style[${styleId}]`);
7260
+ if (!styleEl) {
7261
+ styleEl = doc.createElement("style");
7262
+ styleEl.setAttribute("data-part-style-id", props.part.partId);
7263
+ doc.head.appendChild(styleEl);
7264
+ }
7265
+ styleEl.textContent = ((_a2 = html.value) == null ? void 0 : _a2.style) || "";
7266
+ };
7267
+ apply();
7268
+ observer = new MutationObserver(() => {
7269
+ const styleExists = doc.head.querySelector(`style[${styleId}]`);
7270
+ if (!styleExists) {
7271
+ apply();
7272
+ }
7273
+ });
7274
+ observer.observe(doc.head, { childList: true, subtree: false });
7275
+ }
7276
+ function removeStyleTag() {
7277
+ if (!partRef.value) return;
7278
+ const doc = partRef.value.ownerDocument;
7279
+ if (!doc) return;
7280
+ const styleEl = doc.head.querySelector(`style[data-part-style-id="${props.part.partId}"]`);
7281
+ if (styleEl) {
7282
+ doc.head.removeChild(styleEl);
7283
+ }
7284
+ if (observer) {
7285
+ observer.disconnect();
7286
+ observer = null;
7287
+ }
7288
+ }
7289
+ vue.watch(html, () => {
7290
+ ensureStyleTag();
7291
+ });
7292
+ vue.onMounted(() => {
7293
+ ensureStyleTag();
7294
+ });
7295
+ vue.onBeforeUnmount(() => {
7296
+ removeStyleTag();
7297
+ });
7251
7298
  return (_ctx, _cache) => {
7252
- return html.value ? (vue.openBlock(), vue.createElementBlock("div", {
7299
+ var _a, _b;
7300
+ return ((_a = html.value) == null ? void 0 : _a.tags) ? (vue.openBlock(), vue.createElementBlock("div", {
7253
7301
  key: 0,
7302
+ ref_key: "partRef",
7303
+ ref: partRef,
7254
7304
  class: "html",
7255
- innerHTML: html.value
7256
- }, null, 8, _hoisted_1$5$1)) : _ctx.placeholder ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2$1)) : vue.createCommentVNode("", true);
7305
+ innerHTML: (_b = html.value) == null ? void 0 : _b.tags
7306
+ }, null, 8, _hoisted_1$5$1)) : _ctx.placeholder ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1$1)) : vue.createCommentVNode("", true);
7257
7307
  };
7258
7308
  }
7259
7309
  });
7260
7310
  const _hoisted_1$4$1 = ["src"];
7261
- const _hoisted_2$1$1 = {
7311
+ const _hoisted_2$w = {
7262
7312
  key: 1,
7263
7313
  class: "placeholder",
7264
7314
  textContent: "Empty URL"
@@ -7406,7 +7456,7 @@ ${_html.style}
7406
7456
  ref: iframeRef,
7407
7457
  src: url.value,
7408
7458
  style: vue.normalizeStyle(style.value)
7409
- }, null, 12, _hoisted_1$4$1)) : _ctx.placeholder ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1$1)) : vue.createCommentVNode("", true);
7459
+ }, null, 12, _hoisted_1$4$1)) : _ctx.placeholder ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$w)) : vue.createCommentVNode("", true);
7410
7460
  };
7411
7461
  }
7412
7462
  });
@@ -7723,8 +7773,7 @@ ${_html.style}
7723
7773
  };
7724
7774
  }
7725
7775
  });
7726
- const _hoisted_1$1$1 = ["innerHTML"];
7727
- const _hoisted_2$w = { class: "pb-viewer" };
7776
+ const _hoisted_1$1$1 = { class: "pb-viewer" };
7728
7777
  const _sfc_main$2$1 = /* @__PURE__ */ vue.defineComponent({
7729
7778
  __name: "PageBuilderViewer",
7730
7779
  props: {
@@ -7740,7 +7789,6 @@ ${_html.style}
7740
7789
  if (props.plugin) viewer.registerCustomPlugin(props.plugin);
7741
7790
  providePageBuilderViewer(viewer);
7742
7791
  providePageBuilder(viewer);
7743
- const externalCss = viewer.getExternalCss();
7744
7792
  const part = vue.computed(() => {
7745
7793
  const parts = viewer.model.rootPart.value.children;
7746
7794
  if (!parts || !parts.length) return;
@@ -7759,20 +7807,41 @@ ${_html.style}
7759
7807
  }
7760
7808
  }
7761
7809
  );
7810
+ const styleTag = vue.computed(() => viewer.externalCssContent);
7811
+ function ensureStyleTag() {
7812
+ removeStyleTag();
7813
+ if (!styleTag.value) return;
7814
+ let styleEl = document.head.querySelector(".pb-viewer-style");
7815
+ if (!styleEl) {
7816
+ styleEl = document.createElement("style");
7817
+ styleEl.classList.add("pb-viewer-style");
7818
+ document.head.appendChild(styleEl);
7819
+ }
7820
+ styleEl.textContent = styleTag.value;
7821
+ }
7822
+ function removeStyleTag() {
7823
+ const styleEl = document.head.querySelector(".pb-viewer-style");
7824
+ if (styleEl) {
7825
+ document.head.removeChild(styleEl);
7826
+ }
7827
+ }
7828
+ vue.watch(styleTag, () => {
7829
+ ensureStyleTag();
7830
+ });
7831
+ vue.onMounted(() => {
7832
+ ensureStyleTag();
7833
+ });
7834
+ vue.onBeforeUnmount(() => {
7835
+ removeStyleTag();
7836
+ });
7762
7837
  return (_ctx, _cache) => {
7763
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
7764
- vue.unref(externalCss) ? (vue.openBlock(), vue.createElementBlock("div", {
7838
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1$1, [
7839
+ part.value ? (vue.openBlock(), vue.createBlock(_sfc_main$3$1, {
7765
7840
  key: 0,
7766
- innerHTML: vue.unref(externalCss)
7767
- }, null, 8, _hoisted_1$1$1)) : vue.createCommentVNode("", true),
7768
- vue.createElementVNode("div", _hoisted_2$w, [
7769
- part.value ? (vue.openBlock(), vue.createBlock(_sfc_main$3$1, {
7770
- key: 0,
7771
- "is-mobile-page": _ctx.isMobilePage,
7772
- part: part.value
7773
- }, null, 8, ["is-mobile-page", "part"])) : vue.createCommentVNode("", true)
7774
- ])
7775
- ], 64);
7841
+ "is-mobile-page": _ctx.isMobilePage,
7842
+ part: part.value
7843
+ }, null, 8, ["is-mobile-page", "part"])) : vue.createCommentVNode("", true)
7844
+ ]);
7776
7845
  };
7777
7846
  }
7778
7847
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@g1cloud/page-builder-editor",
3
3
  "private": false,
4
- "version": "1.0.0-alpha.83",
4
+ "version": "1.0.0-alpha.84",
5
5
  "engins": {
6
6
  "node": ">= 20.0.0"
7
7
  },
@@ -31,7 +31,7 @@
31
31
  "vue-router": "^4.4.3",
32
32
  "vue3-click-away": "^1.2.4",
33
33
  "yjs": "^13.6.14",
34
- "@g1cloud/page-builder-viewer": "1.0.0-alpha.83"
34
+ "@g1cloud/page-builder-viewer": "1.0.0-alpha.84"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^20.12.7",