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

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-yhrcYaQY.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-yhrcYaQY.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-yhrcYaQY.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-yhrcYaQY.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-yhrcYaQY.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-yhrcYaQY.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-yhrcYaQY.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-yhrcYaQY.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"];
@@ -7236,22 +7236,72 @@ 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
7304
+ innerHTML: (_b = html.value) == null ? void 0 : _b.tags
7255
7305
  }, null, 8, _hoisted_1$5$1)) : _ctx.placeholder ? (openBlock(), createElementBlock("div", _hoisted_2$2$1)) : createCommentVNode("", true);
7256
7306
  };
7257
7307
  }
@@ -7758,6 +7808,33 @@ const _sfc_main$2$1 = /* @__PURE__ */ defineComponent({
7758
7808
  }
7759
7809
  }
7760
7810
  );
7811
+ const styleTag = computed(() => viewer.externalCssContent);
7812
+ function ensureStyleTag() {
7813
+ removeStyleTag();
7814
+ if (!styleTag.value) return;
7815
+ let styleEl = document.head.querySelector(".pb-viewer-style");
7816
+ if (!styleEl) {
7817
+ styleEl = document.createElement("style");
7818
+ styleEl.classList.add("pb-viewer-style");
7819
+ document.head.appendChild(styleEl);
7820
+ }
7821
+ styleEl.textContent = styleTag.value;
7822
+ }
7823
+ function removeStyleTag() {
7824
+ const styleEl = document.head.querySelector(".pb-viewer-style");
7825
+ if (styleEl) {
7826
+ document.head.removeChild(styleEl);
7827
+ }
7828
+ }
7829
+ watch(styleTag, () => {
7830
+ ensureStyleTag();
7831
+ });
7832
+ onMounted(() => {
7833
+ ensureStyleTag();
7834
+ });
7835
+ onBeforeUnmount(() => {
7836
+ removeStyleTag();
7837
+ });
7761
7838
  return (_ctx, _cache) => {
7762
7839
  return openBlock(), createElementBlock(Fragment, null, [
7763
7840
  unref(externalCss) ? (openBlock(), createElementBlock("div", {
@@ -8404,16 +8481,16 @@ class PartManager {
8404
8481
  const defaultPartPropertyEditors = () => {
8405
8482
  return {
8406
8483
  "readonly-text": () => defineAsyncComponent(() => import("./PbPropertyEditorReadonlyText-BJ5qx69O.js")),
8407
- "text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-BqXqhBvc.js")),
8484
+ "text": () => defineAsyncComponent(() => import("./PbPropertyEditorText-E92cKCb2.js")),
8408
8485
  "number": () => defineAsyncComponent(() => import("./PbPropertyEditorNumber-B76ArSb5.js")),
8409
8486
  "boolean": () => defineAsyncComponent(() => import("./PbPropertyEditorBoolean-c5CNiTpt.js")),
8410
- "multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-CP-gnrl0.js")),
8487
+ "multiline-text": () => defineAsyncComponent(() => import("./PbPropertyEditorMultilineText-BpFMGEOv.js")),
8411
8488
  "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"))
8489
+ "css-length": () => defineAsyncComponent(() => import("./PbPropertyEditorCssLength-BwkrC9am.js")),
8490
+ "color": () => defineAsyncComponent(() => import("./PbPropertyEditorColor-Bti0mVmo.js")),
8491
+ "image": () => defineAsyncComponent(() => import("./PbPropertyEditorImage-Bv5gVaiP.js")),
8492
+ "html": () => defineAsyncComponent(() => import("./PbPropertyEditorHtml-wnS2l_pT.js")),
8493
+ "youtube": () => defineAsyncComponent(() => import("./PbPropertyEditorYoutube-DRguFXvJ.js"))
8417
8494
  };
8418
8495
  };
8419
8496
  const getPropertyValueOfParts = (parts, propertyName) => {
@@ -13053,7 +13130,7 @@ __publicField(_OpenAddWidgetModalCommand, "COMMAND_ID", "OpenAddWidgetModal");
13053
13130
  let OpenAddWidgetModalCommand = _OpenAddWidgetModalCommand;
13054
13131
  const openWidgetAddModal = (modal, args, callback) => {
13055
13132
  modal.openModal({
13056
- component: defineAsyncComponent(() => import("./PbWidgetAddModal-B0EJiVqs.js")),
13133
+ component: defineAsyncComponent(() => import("./PbWidgetAddModal-_yFu9o2c.js")),
13057
13134
  style: {
13058
13135
  width: "80%",
13059
13136
  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-yhrcYaQY.js";
2
2
  export {
3
3
  B as BLOCK_TYPE,
4
4
  b as Block,
@@ -7237,22 +7237,72 @@ 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
7305
+ innerHTML: (_b = html.value) == null ? void 0 : _b.tags
7256
7306
  }, null, 8, _hoisted_1$5$1)) : _ctx.placeholder ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2$1)) : vue.createCommentVNode("", true);
7257
7307
  };
7258
7308
  }
@@ -7759,6 +7809,33 @@ ${_html.style}
7759
7809
  }
7760
7810
  }
7761
7811
  );
7812
+ const styleTag = vue.computed(() => viewer.externalCssContent);
7813
+ function ensureStyleTag() {
7814
+ removeStyleTag();
7815
+ if (!styleTag.value) return;
7816
+ let styleEl = document.head.querySelector(".pb-viewer-style");
7817
+ if (!styleEl) {
7818
+ styleEl = document.createElement("style");
7819
+ styleEl.classList.add("pb-viewer-style");
7820
+ document.head.appendChild(styleEl);
7821
+ }
7822
+ styleEl.textContent = styleTag.value;
7823
+ }
7824
+ function removeStyleTag() {
7825
+ const styleEl = document.head.querySelector(".pb-viewer-style");
7826
+ if (styleEl) {
7827
+ document.head.removeChild(styleEl);
7828
+ }
7829
+ }
7830
+ vue.watch(styleTag, () => {
7831
+ ensureStyleTag();
7832
+ });
7833
+ vue.onMounted(() => {
7834
+ ensureStyleTag();
7835
+ });
7836
+ vue.onBeforeUnmount(() => {
7837
+ removeStyleTag();
7838
+ });
7762
7839
  return (_ctx, _cache) => {
7763
7840
  return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
7764
7841
  vue.unref(externalCss) ? (vue.openBlock(), vue.createElementBlock("div", {
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.85",
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.85"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^20.12.7",