@g1cloud/page-builder-editor 1.0.0-alpha.101 → 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/style.css CHANGED
@@ -386,8 +386,9 @@
386
386
  height: 28px;
387
387
  background-color: var(--primary);
388
388
  }
389
- .preview-container[data-v-c0ba6980] {
389
+ .preview-wrapper[data-v-b8f2a18d] {
390
+ width: 100%;
391
+ }
392
+ .preview-empty[data-v-b8f2a18d] {
390
393
  width: 100%;
391
- min-height: 300px;
392
- overflow: hidden;
393
394
  }
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.101",
4
+ "version": "1.0.0-alpha.103",
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.101"
34
+ "@g1cloud/page-builder-viewer": "1.0.0-alpha.103"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^20.12.7",
@@ -1,117 +0,0 @@
1
- import { defineComponent, ref, onMounted, openBlock, createBlock, unref, withCtx, createElementVNode, withDirectives, createVNode, normalizeStyle, createCommentVNode } from "vue";
2
- import { useModalHandle, BSModalFrame, vT, BSTextInput } from "@g1cloud/bluesea";
3
- import YouTube from "vue3-youtube";
4
- import { _ as _export_sfc } from "./index-SyHEuk0H.js";
5
- const _hoisted_1 = { class: "bs-layout-vertical flex-grow-1 h-full" };
6
- const _hoisted_2 = { class: "pt-8" };
7
- const _hoisted_3 = { class: "bs-layout-horizontal justify-content-center" };
8
- const _sfc_main = /* @__PURE__ */ defineComponent({
9
- __name: "PbYoutubeModal",
10
- props: {
11
- url: {}
12
- },
13
- emits: ["selectUrl"],
14
- setup(__props, { emit: __emit }) {
15
- const props = __props;
16
- const emit = __emit;
17
- const modalHandle = useModalHandle();
18
- const previewContainer = ref();
19
- const url = ref(props.url);
20
- const aspectRatio = ref();
21
- const previewWidth = ref(480);
22
- const previewHeight = ref(360);
23
- const fetchAspectRatio = async (videoUrl) => {
24
- try {
25
- const oembedUrl = `https://www.youtube.com/oembed?url=${encodeURIComponent(videoUrl)}&format=json`;
26
- const response = await fetch(oembedUrl);
27
- if (!response.ok) return;
28
- const data = await response.json();
29
- if (data.width && data.height) {
30
- aspectRatio.value = `${data.width}/${data.height}`;
31
- previewHeight.value = Math.round(previewWidth.value * data.height / data.width);
32
- }
33
- } catch {
34
- }
35
- };
36
- const updateUrl = (value) => {
37
- url.value = value;
38
- aspectRatio.value = void 0;
39
- if (value) {
40
- fetchAspectRatio(value);
41
- }
42
- };
43
- if (props.url) {
44
- fetchAspectRatio(props.url);
45
- }
46
- const measureContainer = () => {
47
- var _a;
48
- const w = (_a = previewContainer.value) == null ? void 0 : _a.clientWidth;
49
- if (w && w > 0) {
50
- previewWidth.value = w;
51
- previewHeight.value = Math.round(w * 9 / 16);
52
- return true;
53
- }
54
- return false;
55
- };
56
- onMounted(() => {
57
- if (!measureContainer()) {
58
- requestAnimationFrame(() => measureContainer());
59
- }
60
- });
61
- const ok = () => {
62
- emit("selectUrl", url.value, aspectRatio.value);
63
- modalHandle.close();
64
- };
65
- return (_ctx, _cache) => {
66
- return openBlock(), createBlock(unref(BSModalFrame), {
67
- title: { key: "pb.modal.youtube.title" },
68
- class: "pb-youtube-modal"
69
- }, {
70
- default: withCtx(() => [
71
- createElementVNode("div", _hoisted_1, [
72
- withDirectives(createElementVNode("div", null, null, 512), [
73
- [unref(vT), { key: "pb.modal.youtube.url" }]
74
- ]),
75
- createVNode(unref(BSTextInput), {
76
- "model-value": url.value,
77
- width: "100%",
78
- "onUpdate:modelValue": updateUrl
79
- }, null, 8, ["model-value"]),
80
- withDirectives(createElementVNode("div", _hoisted_2, null, 512), [
81
- [unref(vT), { key: "pb.modal.youtube.preview" }]
82
- ]),
83
- createElementVNode("div", {
84
- ref_key: "previewContainer",
85
- ref: previewContainer,
86
- class: "preview-container border-w-1 border border-gray",
87
- style: normalizeStyle({ minHeight: url.value ? void 0 : "300px", overflow: "hidden" })
88
- }, [
89
- url.value ? (openBlock(), createBlock(unref(YouTube), {
90
- key: 0,
91
- ref: "youtube",
92
- src: url.value,
93
- width: previewWidth.value,
94
- height: previewHeight.value
95
- }, null, 8, ["src", "width", "height"])) : createCommentVNode("", true)
96
- ], 4)
97
- ])
98
- ]),
99
- buttons: withCtx(() => [
100
- createElementVNode("div", _hoisted_3, [
101
- withDirectives(createElementVNode("button", {
102
- class: "mr-4",
103
- onClick: ok
104
- }, null, 512), [
105
- [unref(vT), { key: "pb.button.ok" }]
106
- ])
107
- ])
108
- ]),
109
- _: 1
110
- });
111
- };
112
- }
113
- });
114
- const PbYoutubeModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c0ba6980"]]);
115
- export {
116
- PbYoutubeModal as default
117
- };