@g1cloud/page-builder-editor 1.0.0-alpha.102 → 1.0.0-alpha.103
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/{PbPropertyEditorColor-BLmbxHlj.js → PbPropertyEditorColor-0zFwhnJp.js} +1 -1
- package/dist/{PbPropertyEditorCssLength-D-rlVWI8.js → PbPropertyEditorCssLength-7sBhgyiM.js} +1 -1
- package/dist/{PbPropertyEditorHtml-D65dKk8P.js → PbPropertyEditorHtml-Cz33ZrZp.js} +1 -1
- package/dist/{PbPropertyEditorImage-Bh9_XDi6.js → PbPropertyEditorImage-DCOGVu0_.js} +1 -1
- package/dist/{PbPropertyEditorMultilineText-BQ5EOr92.js → PbPropertyEditorMultilineText-705l-6cb.js} +1 -1
- package/dist/{PbPropertyEditorText-BuNC6dLo.js → PbPropertyEditorText-C1ktcMVa.js} +1 -1
- package/dist/{PbPropertyEditorYoutube-DuPiKQNB.js → PbPropertyEditorYoutube-R2dUexOc.js} +1 -1
- package/dist/{PbWidgetAddModal-BOcLVwum.js → PbWidgetAddModal-CNblLmnp.js} +1 -1
- package/dist/PbYoutubeModal-BJuyyip-.js +148 -0
- package/dist/{index-BKkW50R0.js → index-BsMUbVZy.js} +124 -144
- package/dist/page-builder-editor.js +1 -1
- package/dist/page-builder-editor.umd.cjs +230 -217
- package/dist/style.css +4 -3
- package/package.json +2 -2
- package/dist/PbYoutubeModal-DDC8kUPw.js +0 -117
|
@@ -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-BsMUbVZy.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" };
|
package/dist/{PbPropertyEditorCssLength-D-rlVWI8.js → PbPropertyEditorCssLength-7sBhgyiM.js}
RENAMED
|
@@ -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-
|
|
3
|
+
import { t as toCssLength } from "./index-BsMUbVZy.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-
|
|
3
|
+
import { u as usePageBuilderEditor } from "./index-BsMUbVZy.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-
|
|
2
|
+
import { u as usePageBuilderEditor, C as ChangePropertyCommand } from "./index-BsMUbVZy.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" };
|
package/dist/{PbPropertyEditorMultilineText-BQ5EOr92.js → PbPropertyEditorMultilineText-705l-6cb.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-BsMUbVZy.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-BsMUbVZy.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, createTextVNode, toDisplayString, createVNode, createCommentVNode } from "vue";
|
|
2
2
|
import { useModal, vT, BSButton } from "@g1cloud/bluesea";
|
|
3
|
-
import { s as selectYoutubeVideo } from "./index-
|
|
3
|
+
import { s as selectYoutubeVideo } from "./index-BsMUbVZy.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 = {
|
|
@@ -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-BsMUbVZy.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"];
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createElementVNode, withDirectives, createVNode, createElementBlock, normalizeStyle } from "vue";
|
|
2
|
+
import { useModalHandle, BSModalFrame, vT, BSTextInput } from "@g1cloud/bluesea";
|
|
3
|
+
import { _ as _export_sfc } from "./index-BsMUbVZy.js";
|
|
4
|
+
const _hoisted_1 = { class: "bs-layout-vertical flex-grow-1 h-full" };
|
|
5
|
+
const _hoisted_2 = { class: "pt-8" };
|
|
6
|
+
const _hoisted_3 = { class: "preview-wrapper" };
|
|
7
|
+
const _hoisted_4 = ["src"];
|
|
8
|
+
const _hoisted_5 = { class: "bs-layout-horizontal justify-content-center" };
|
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
10
|
+
__name: "PbYoutubeModal",
|
|
11
|
+
props: {
|
|
12
|
+
url: {}
|
|
13
|
+
},
|
|
14
|
+
emits: ["selectUrl"],
|
|
15
|
+
setup(__props, { emit: __emit }) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const emit = __emit;
|
|
18
|
+
const modalHandle = useModalHandle();
|
|
19
|
+
const url = ref(props.url);
|
|
20
|
+
const aspectRatio = ref();
|
|
21
|
+
const extractVideoId = (raw) => {
|
|
22
|
+
const value = raw.trim();
|
|
23
|
+
if (!value) return void 0;
|
|
24
|
+
if (/^[\w-]{11}$/.test(value)) return value;
|
|
25
|
+
try {
|
|
26
|
+
const u = new URL(value);
|
|
27
|
+
const host = u.hostname.replace(/^www\./, "");
|
|
28
|
+
if (host === "youtu.be") {
|
|
29
|
+
const id = u.pathname.slice(1).split("/")[0];
|
|
30
|
+
return id || void 0;
|
|
31
|
+
}
|
|
32
|
+
if (host === "youtube.com" || host === "youtube-nocookie.com" || host === "m.youtube.com") {
|
|
33
|
+
const v = u.searchParams.get("v");
|
|
34
|
+
if (v) return v;
|
|
35
|
+
const segs = u.pathname.split("/").filter(Boolean);
|
|
36
|
+
const idx = segs.findIndex((s) => s === "embed" || s === "shorts" || s === "live" || s === "v");
|
|
37
|
+
if (idx >= 0 && segs[idx + 1]) return segs[idx + 1];
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
};
|
|
43
|
+
const embedSrc = computed(() => {
|
|
44
|
+
if (!url.value) return void 0;
|
|
45
|
+
const id = extractVideoId(url.value);
|
|
46
|
+
if (!id) return void 0;
|
|
47
|
+
return `https://www.youtube-nocookie.com/embed/${id}`;
|
|
48
|
+
});
|
|
49
|
+
const aspectRatioCss = computed(() => {
|
|
50
|
+
const raw = aspectRatio.value;
|
|
51
|
+
if (raw) {
|
|
52
|
+
const parts = raw.split("/");
|
|
53
|
+
if (parts.length === 2) {
|
|
54
|
+
const w = Number(parts[0]);
|
|
55
|
+
const h = Number(parts[1]);
|
|
56
|
+
if (w > 0 && h > 0) return `${w} / ${h}`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return "16 / 9";
|
|
60
|
+
});
|
|
61
|
+
const iframeStyle = computed(() => ({
|
|
62
|
+
width: "100%",
|
|
63
|
+
aspectRatio: aspectRatioCss.value,
|
|
64
|
+
border: "0",
|
|
65
|
+
display: "block"
|
|
66
|
+
}));
|
|
67
|
+
const fetchAspectRatio = async (videoUrl) => {
|
|
68
|
+
try {
|
|
69
|
+
const oembedUrl = `https://www.youtube.com/oembed?url=${encodeURIComponent(videoUrl)}&format=json`;
|
|
70
|
+
const response = await fetch(oembedUrl);
|
|
71
|
+
if (!response.ok) return;
|
|
72
|
+
const data = await response.json();
|
|
73
|
+
if (data.width && data.height) {
|
|
74
|
+
aspectRatio.value = `${data.width}/${data.height}`;
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const updateUrl = (value) => {
|
|
80
|
+
url.value = value;
|
|
81
|
+
aspectRatio.value = void 0;
|
|
82
|
+
if (value) {
|
|
83
|
+
fetchAspectRatio(value);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
if (props.url) {
|
|
87
|
+
fetchAspectRatio(props.url);
|
|
88
|
+
}
|
|
89
|
+
const ok = () => {
|
|
90
|
+
emit("selectUrl", url.value, aspectRatio.value);
|
|
91
|
+
modalHandle.close();
|
|
92
|
+
};
|
|
93
|
+
return (_ctx, _cache) => {
|
|
94
|
+
return openBlock(), createBlock(unref(BSModalFrame), {
|
|
95
|
+
title: { key: "pb.modal.youtube.title" },
|
|
96
|
+
class: "pb-youtube-modal"
|
|
97
|
+
}, {
|
|
98
|
+
default: withCtx(() => [
|
|
99
|
+
createElementVNode("div", _hoisted_1, [
|
|
100
|
+
withDirectives(createElementVNode("div", null, null, 512), [
|
|
101
|
+
[unref(vT), { key: "pb.modal.youtube.url" }]
|
|
102
|
+
]),
|
|
103
|
+
createVNode(unref(BSTextInput), {
|
|
104
|
+
"model-value": url.value,
|
|
105
|
+
width: "100%",
|
|
106
|
+
"onUpdate:modelValue": updateUrl
|
|
107
|
+
}, null, 8, ["model-value"]),
|
|
108
|
+
withDirectives(createElementVNode("div", _hoisted_2, null, 512), [
|
|
109
|
+
[unref(vT), { key: "pb.modal.youtube.preview" }]
|
|
110
|
+
]),
|
|
111
|
+
createElementVNode("div", _hoisted_3, [
|
|
112
|
+
embedSrc.value ? (openBlock(), createElementBlock("iframe", {
|
|
113
|
+
key: 0,
|
|
114
|
+
src: embedSrc.value,
|
|
115
|
+
style: normalizeStyle(iframeStyle.value),
|
|
116
|
+
frameborder: "0",
|
|
117
|
+
referrerpolicy: "strict-origin-when-cross-origin",
|
|
118
|
+
allow: "accelerometer; encrypted-media; gyroscope; picture-in-picture; web-share",
|
|
119
|
+
allowfullscreen: "",
|
|
120
|
+
loading: "lazy",
|
|
121
|
+
title: "YouTube preview"
|
|
122
|
+
}, null, 12, _hoisted_4)) : (openBlock(), createElementBlock("div", {
|
|
123
|
+
key: 1,
|
|
124
|
+
class: "preview-empty border-w-1 border border-gray",
|
|
125
|
+
style: normalizeStyle({ aspectRatio: aspectRatioCss.value })
|
|
126
|
+
}, null, 4))
|
|
127
|
+
])
|
|
128
|
+
])
|
|
129
|
+
]),
|
|
130
|
+
buttons: withCtx(() => [
|
|
131
|
+
createElementVNode("div", _hoisted_5, [
|
|
132
|
+
withDirectives(createElementVNode("button", {
|
|
133
|
+
class: "mr-4",
|
|
134
|
+
onClick: ok
|
|
135
|
+
}, null, 512), [
|
|
136
|
+
[unref(vT), { key: "pb.button.ok" }]
|
|
137
|
+
])
|
|
138
|
+
])
|
|
139
|
+
]),
|
|
140
|
+
_: 1
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const PbYoutubeModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b8f2a18d"]]);
|
|
146
|
+
export {
|
|
147
|
+
PbYoutubeModal as default
|
|
148
|
+
};
|