officialblock 2.0.8 → 2.1.0
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/index-B1CWbJxM.mjs +414 -0
- package/dist/{index-8RyJo9_2.js → index-B3PhukvS.js} +1 -1
- package/dist/index-BlREL57D.js +1 -0
- package/dist/index-BmAKDKvH.mjs +4 -0
- package/dist/index-C0VvLaXk.js +20 -0
- package/dist/{index-a3Vsoanj.mjs → index-CT1rjCCp.mjs} +1 -1
- package/dist/index-C_l0k6dm.mjs +29122 -0
- package/dist/index-CdakOmJX.js +1 -0
- package/dist/official-block.cjs.js +1 -1
- package/dist/official-block.es.js +110 -98
- package/dist/official-block.umd.js +8 -4
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/index-B_2L9dK-.mjs +0 -26652
- package/dist/index-Bi2ovj6T.js +0 -16
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { defineComponent as X, defineAsyncComponent as Z, ref as C, computed as w, resolveComponent as g, createBlock as L, openBlock as h, withCtx as r, createElementVNode as a, createVNode as s, createTextVNode as V, unref as R, mergeProps as ee, createElementBlock as D, normalizeClass as $, toDisplayString as F, createCommentVNode as E, getCurrentInstance as te, watch as q, onMounted as ae, normalizeStyle as ne, withDirectives as z, Fragment as oe, renderList as le, vShow as M } from "vue";
|
|
2
|
+
import { P as se, r as T, _ as j, u as de, a as ie, T as ue, b as re, c as me, O as ce, $ as pe } from "./index-C_l0k6dm.mjs";
|
|
3
|
+
const ve = { class: "setting-content" }, fe = { class: "setting-header flex items-center" }, ye = { class: "setting-body" }, be = { class: "setting-toolbar" }, ge = { class: "tools" }, Ve = { class: "setting-item" }, we = { class: "item-header" }, he = { class: "btn-group" }, ke = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "drag-handle"
|
|
6
|
+
}, Ce = { class: "components-content" }, xe = /* @__PURE__ */ X({
|
|
7
|
+
__name: "setting",
|
|
8
|
+
props: {
|
|
9
|
+
show: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
},
|
|
13
|
+
data: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: () => {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
emits: ["update:show"],
|
|
20
|
+
setup(l, { emit: H }) {
|
|
21
|
+
const B = Z(() => import("vuedraggable")), f = C(!1), J = w(() => ({
|
|
22
|
+
animation: 200,
|
|
23
|
+
group: "gallerys",
|
|
24
|
+
disabled: !1,
|
|
25
|
+
ghostClass: "ghost",
|
|
26
|
+
handle: ".drag-handle",
|
|
27
|
+
filter: ".arco-input, .arco-select, .arco-checkbox",
|
|
28
|
+
preventOnFilter: !1
|
|
29
|
+
})), S = (i) => i && i.length > 1, P = l, d = H, K = () => {
|
|
30
|
+
d("update:show", !1);
|
|
31
|
+
}, c = (i) => {
|
|
32
|
+
P.data.data.push({
|
|
33
|
+
id: T(),
|
|
34
|
+
type: "Video",
|
|
35
|
+
videoSrc: "",
|
|
36
|
+
imgSrc: "",
|
|
37
|
+
name: "",
|
|
38
|
+
key: "",
|
|
39
|
+
componentsDataJson: []
|
|
40
|
+
});
|
|
41
|
+
}, O = (i) => {
|
|
42
|
+
P.data.data = P.data.data.filter((e) => e.id !== i);
|
|
43
|
+
};
|
|
44
|
+
return (i, e) => {
|
|
45
|
+
const y = g("a-option"), p = g("a-select"), x = g("icon-plus"), k = g("a-button"), _ = g("icon-drag-arrow"), A = g("icon-delete"), I = g("a-input"), U = g("a-drawer");
|
|
46
|
+
return h(), L(U, {
|
|
47
|
+
width: "60%",
|
|
48
|
+
visible: l.show,
|
|
49
|
+
footer: !1,
|
|
50
|
+
onCancel: K,
|
|
51
|
+
unmountOnClose: ""
|
|
52
|
+
}, {
|
|
53
|
+
title: r(() => [
|
|
54
|
+
V(F(l.data.type) + "组件编辑 ", 1)
|
|
55
|
+
]),
|
|
56
|
+
default: r(() => [
|
|
57
|
+
a("div", ve, [
|
|
58
|
+
a("div", fe, [
|
|
59
|
+
e[11] || (e[11] = a("span", { class: "header-title" }, "组件宽度", -1)),
|
|
60
|
+
s(p, {
|
|
61
|
+
modelValue: l.data.width,
|
|
62
|
+
"onUpdate:modelValue": e[0] || (e[0] = (o) => l.data.width = o),
|
|
63
|
+
placeholder: "请选择",
|
|
64
|
+
"allow-clear": ""
|
|
65
|
+
}, {
|
|
66
|
+
default: r(() => [
|
|
67
|
+
s(y, { value: "default" }, {
|
|
68
|
+
default: r(() => [...e[7] || (e[7] = [
|
|
69
|
+
V("默认", -1)
|
|
70
|
+
])]),
|
|
71
|
+
_: 1
|
|
72
|
+
}),
|
|
73
|
+
s(y, { value: "small" }, {
|
|
74
|
+
default: r(() => [...e[8] || (e[8] = [
|
|
75
|
+
V("小", -1)
|
|
76
|
+
])]),
|
|
77
|
+
_: 1
|
|
78
|
+
}),
|
|
79
|
+
s(y, { value: "medium" }, {
|
|
80
|
+
default: r(() => [...e[9] || (e[9] = [
|
|
81
|
+
V("中", -1)
|
|
82
|
+
])]),
|
|
83
|
+
_: 1
|
|
84
|
+
}),
|
|
85
|
+
s(y, { value: "max" }, {
|
|
86
|
+
default: r(() => [...e[10] || (e[10] = [
|
|
87
|
+
V("大", -1)
|
|
88
|
+
])]),
|
|
89
|
+
_: 1
|
|
90
|
+
})
|
|
91
|
+
]),
|
|
92
|
+
_: 1
|
|
93
|
+
}, 8, ["modelValue"])
|
|
94
|
+
]),
|
|
95
|
+
a("div", ye, [
|
|
96
|
+
a("div", be, [
|
|
97
|
+
e[14] || (e[14] = a("h4", null, "List", -1)),
|
|
98
|
+
a("div", ge, [
|
|
99
|
+
s(k, {
|
|
100
|
+
type: "primary",
|
|
101
|
+
onClick: e[1] || (e[1] = (o) => c())
|
|
102
|
+
}, {
|
|
103
|
+
icon: r(() => [
|
|
104
|
+
s(x)
|
|
105
|
+
]),
|
|
106
|
+
default: r(() => [
|
|
107
|
+
e[12] || (e[12] = V(" 添加 Tab ", -1))
|
|
108
|
+
]),
|
|
109
|
+
_: 1
|
|
110
|
+
}),
|
|
111
|
+
s(k, {
|
|
112
|
+
type: "primary",
|
|
113
|
+
onClick: e[2] || (e[2] = (o) => c())
|
|
114
|
+
}, {
|
|
115
|
+
default: r(() => [...e[13] || (e[13] = [
|
|
116
|
+
V("粘贴 Tab", -1)
|
|
117
|
+
])]),
|
|
118
|
+
_: 1
|
|
119
|
+
})
|
|
120
|
+
])
|
|
121
|
+
]),
|
|
122
|
+
a("div", Ve, [
|
|
123
|
+
s(R(B), ee({
|
|
124
|
+
modelValue: l.data.data,
|
|
125
|
+
"onUpdate:modelValue": e[4] || (e[4] = (o) => l.data.data = o),
|
|
126
|
+
"component-data": {
|
|
127
|
+
tag: "div",
|
|
128
|
+
type: "transition-group",
|
|
129
|
+
name: f.value ? null : "flip-list"
|
|
130
|
+
}
|
|
131
|
+
}, J.value, {
|
|
132
|
+
disabled: !S(l.data.data),
|
|
133
|
+
onStart: e[5] || (e[5] = (o) => f.value = !0),
|
|
134
|
+
onEnd: e[6] || (e[6] = (o) => f.value = !1),
|
|
135
|
+
"item-key": "id"
|
|
136
|
+
}), {
|
|
137
|
+
item: r(({ element: o }) => [
|
|
138
|
+
(h(), D("div", {
|
|
139
|
+
class: $(["item-button draggable-item", {
|
|
140
|
+
"sortable-disabled": !S(l.data.data)
|
|
141
|
+
}]),
|
|
142
|
+
key: o.id
|
|
143
|
+
}, [
|
|
144
|
+
a("div", we, [
|
|
145
|
+
a("div", null, [
|
|
146
|
+
a("h5", null, F(o.name), 1),
|
|
147
|
+
a("span", null, F(o.key), 1)
|
|
148
|
+
]),
|
|
149
|
+
a("div", he, [
|
|
150
|
+
S(l.data.data) ? (h(), D("div", ke, [
|
|
151
|
+
s(_, { class: "drag-icon" })
|
|
152
|
+
])) : E("", !0),
|
|
153
|
+
s(A, {
|
|
154
|
+
class: "btn-delete",
|
|
155
|
+
onClick: (v) => O(o.id)
|
|
156
|
+
}, null, 8, ["onClick"]),
|
|
157
|
+
s(k, {
|
|
158
|
+
size: "mini",
|
|
159
|
+
type: "primary",
|
|
160
|
+
onClick: e[3] || (e[3] = (v) => c())
|
|
161
|
+
}, {
|
|
162
|
+
default: r(() => [...e[15] || (e[15] = [
|
|
163
|
+
V("复制 Tab", -1)
|
|
164
|
+
])]),
|
|
165
|
+
_: 1
|
|
166
|
+
})
|
|
167
|
+
])
|
|
168
|
+
]),
|
|
169
|
+
e[16] || (e[16] = a("p", { class: "item-title" }, "Tab名称", -1)),
|
|
170
|
+
s(I, {
|
|
171
|
+
modelValue: o.name,
|
|
172
|
+
"onUpdate:modelValue": (v) => o.name = v,
|
|
173
|
+
placeholder: "请输入标题",
|
|
174
|
+
"allow-clear": ""
|
|
175
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
176
|
+
e[17] || (e[17] = a("p", { class: "item-title" }, "Key", -1)),
|
|
177
|
+
s(I, {
|
|
178
|
+
modelValue: o.key,
|
|
179
|
+
"onUpdate:modelValue": (v) => o.key = v,
|
|
180
|
+
placeholder: "请输入key",
|
|
181
|
+
"allow-clear": ""
|
|
182
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]),
|
|
183
|
+
e[18] || (e[18] = a("p", null, "components", -1)),
|
|
184
|
+
a("div", Ce, [
|
|
185
|
+
s(se, {
|
|
186
|
+
data: o.componentsDataJson,
|
|
187
|
+
onUpdate: (v) => o.componentsDataJson = v
|
|
188
|
+
}, null, 8, ["data", "onUpdate"])
|
|
189
|
+
])
|
|
190
|
+
], 2))
|
|
191
|
+
]),
|
|
192
|
+
_: 1
|
|
193
|
+
}, 16, ["modelValue", "component-data", "disabled"])
|
|
194
|
+
])
|
|
195
|
+
])
|
|
196
|
+
])
|
|
197
|
+
]),
|
|
198
|
+
_: 1
|
|
199
|
+
}, 8, ["visible"]);
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}), _e = /* @__PURE__ */ j(xe, [["__scopeId", "data-v-f4b12dfa"]]), $e = { class: "tab-default__content" }, Te = {
|
|
203
|
+
"data-aos": "fade-in",
|
|
204
|
+
"data-aos-duration": "1500",
|
|
205
|
+
class: "aos-init aos-animate"
|
|
206
|
+
}, De = { class: "component-wrapper" }, Se = { class: "tab-timeline__mobile" }, Pe = {
|
|
207
|
+
__name: "index",
|
|
208
|
+
props: {
|
|
209
|
+
modelValue: {
|
|
210
|
+
type: Object,
|
|
211
|
+
default: () => {
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
// 是否预览
|
|
215
|
+
isPreview: {
|
|
216
|
+
type: Boolean,
|
|
217
|
+
default: !0
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
emits: ["update:modelValue", "handleDelete", "handleCopy", "handlePaste"],
|
|
221
|
+
setup(l, { emit: H }) {
|
|
222
|
+
const { proxy: B } = te(), { $_vsWidth: f, $_vsScrollY: J, $vsScreenAddListener: S, $vsScreenDestroyListener: P } = B, d = l, K = H, c = de(), O = ie(), i = C(null), e = C(null), y = w(() => {
|
|
223
|
+
var t;
|
|
224
|
+
return (t = d.modelValue) == null ? void 0 : t.data;
|
|
225
|
+
}), p = C(0), x = C(!1), k = C(!1), _ = C(!1), A = w(() => {
|
|
226
|
+
var t;
|
|
227
|
+
return ((t = d.modelValue) == null ? void 0 : t.classes) ?? null;
|
|
228
|
+
}), I = w(() => {
|
|
229
|
+
var t;
|
|
230
|
+
return ((t = d.modelValue) == null ? void 0 : t.style) ?? null;
|
|
231
|
+
});
|
|
232
|
+
w(() => {
|
|
233
|
+
var t;
|
|
234
|
+
return (t = d.modelValue) == null ? void 0 : t.width;
|
|
235
|
+
});
|
|
236
|
+
const U = w(() => {
|
|
237
|
+
var t;
|
|
238
|
+
return (t = d.modelValue) == null ? void 0 : t.id;
|
|
239
|
+
}), o = w(() => {
|
|
240
|
+
var t;
|
|
241
|
+
return (t = d.modelValue) != null && t.bgColor ? d.modelValue.bgColor : f.value >= 768 ? "bg-neutral-lightest" : null;
|
|
242
|
+
}), v = w(() => {
|
|
243
|
+
var n;
|
|
244
|
+
if (!((n = d.modelValue) != null && n.data) || !Array.isArray(d.modelValue.data))
|
|
245
|
+
return [];
|
|
246
|
+
const t = d.modelValue.data[p.value];
|
|
247
|
+
return t ? t.componentsDataJson || [] : [];
|
|
248
|
+
}), W = () => {
|
|
249
|
+
var n;
|
|
250
|
+
if (d.modelValue && d.modelValue.data) {
|
|
251
|
+
setTimeout(() => {
|
|
252
|
+
var u;
|
|
253
|
+
selectTab((u = d.modelValue) == null ? void 0 : u.data[0].id);
|
|
254
|
+
}, 0);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const t = {
|
|
258
|
+
id: ((n = d.modelValue) == null ? void 0 : n.id) || T(),
|
|
259
|
+
//componentKey
|
|
260
|
+
type: "TabTimeLine",
|
|
261
|
+
containerWidth: "",
|
|
262
|
+
bgColor: "",
|
|
263
|
+
classes: "custom-class another-class",
|
|
264
|
+
style: {
|
|
265
|
+
// marginTop: "20px",
|
|
266
|
+
// backgroundColor: "#f5f5f5",
|
|
267
|
+
},
|
|
268
|
+
width: "container-content-middle",
|
|
269
|
+
data: [
|
|
270
|
+
//list
|
|
271
|
+
{
|
|
272
|
+
id: T(),
|
|
273
|
+
key: "11111111",
|
|
274
|
+
name: "tab1",
|
|
275
|
+
componentsDataJson: []
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
id: T(),
|
|
279
|
+
key: "2222",
|
|
280
|
+
name: "tab2",
|
|
281
|
+
componentsDataJson: []
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
id: T(),
|
|
285
|
+
key: "33333",
|
|
286
|
+
name: "tab3",
|
|
287
|
+
componentsDataJson: []
|
|
288
|
+
}
|
|
289
|
+
]
|
|
290
|
+
};
|
|
291
|
+
K("update:modelValue", t), p.value = t.data[0].id;
|
|
292
|
+
}, Y = () => {
|
|
293
|
+
if (!e.value || !i.value) return;
|
|
294
|
+
const t = e.value.getBoundingClientRect().top, n = i.value.getBoundingClientRect().top, u = i.value.getBoundingClientRect().bottom, b = +window.getComputedStyle(document.body).getPropertyValue("--header-height-calc").split("px")[0];
|
|
295
|
+
if (n > b || u < b) {
|
|
296
|
+
x.value = !1;
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
t <= b && (x.value = !0);
|
|
300
|
+
}, Q = () => {
|
|
301
|
+
if (f.value <= 768) return;
|
|
302
|
+
const t = i.value, u = pe(t).y - 150;
|
|
303
|
+
window.scroll({ top: u, left: 0, behavior: "smooth" });
|
|
304
|
+
}, N = () => {
|
|
305
|
+
var u;
|
|
306
|
+
const t = c.query.tab_timeline, n = (u = y.value) == null ? void 0 : u.findIndex((b) => b.key == t);
|
|
307
|
+
n > -1 ? p.value = n : p.value = 0;
|
|
308
|
+
}, G = (t) => {
|
|
309
|
+
debugger;
|
|
310
|
+
p.value = t, O.push({
|
|
311
|
+
path: c.path,
|
|
312
|
+
query: {
|
|
313
|
+
...c.query,
|
|
314
|
+
tab_timeline: y.value[t].key
|
|
315
|
+
},
|
|
316
|
+
hash: c.hash
|
|
317
|
+
});
|
|
318
|
+
};
|
|
319
|
+
return q(
|
|
320
|
+
() => J.value,
|
|
321
|
+
() => {
|
|
322
|
+
console.log("==========$_vsScrollY.value"), Y();
|
|
323
|
+
}
|
|
324
|
+
), q(p, () => {
|
|
325
|
+
Q();
|
|
326
|
+
}), q(
|
|
327
|
+
() => c.query.tab_line,
|
|
328
|
+
() => {
|
|
329
|
+
N();
|
|
330
|
+
}
|
|
331
|
+
), W(), ae(() => {
|
|
332
|
+
N();
|
|
333
|
+
}), (t, n) => {
|
|
334
|
+
var u, b;
|
|
335
|
+
return h(), D("div", {
|
|
336
|
+
class: $(["tab-timeline", A.value]),
|
|
337
|
+
ref_key: "wrapper",
|
|
338
|
+
ref: i,
|
|
339
|
+
style: ne(I.value),
|
|
340
|
+
onMouseover: n[3] || (n[3] = (m) => _.value = !0),
|
|
341
|
+
onMouseout: n[4] || (n[4] = (m) => _.value = !1)
|
|
342
|
+
}, [
|
|
343
|
+
a("div", {
|
|
344
|
+
class: $(["tab-timeline__wrapper", [(u = l.modelValue) != null && u.width ? `container-content-${(b = l.modelValue) == null ? void 0 : b.width}` : "container-content"]])
|
|
345
|
+
}, [
|
|
346
|
+
z(a("div", {
|
|
347
|
+
class: $(["tab-timeline__desktop", [o.value]])
|
|
348
|
+
}, [
|
|
349
|
+
a("div", {
|
|
350
|
+
class: $(["tab-timeline__hold", { "is-fixed": x.value }])
|
|
351
|
+
}, [
|
|
352
|
+
a("div", {
|
|
353
|
+
class: "tab-timeline__nav",
|
|
354
|
+
ref_key: "tab",
|
|
355
|
+
ref: e
|
|
356
|
+
}, [
|
|
357
|
+
s(ue, {
|
|
358
|
+
list: y.value,
|
|
359
|
+
isFixed: x.value,
|
|
360
|
+
currentIdx: p.value,
|
|
361
|
+
onUpdateIdx: G,
|
|
362
|
+
componentKey: U.value
|
|
363
|
+
}, null, 8, ["list", "isFixed", "currentIdx", "componentKey"])
|
|
364
|
+
], 512)
|
|
365
|
+
], 2),
|
|
366
|
+
a("div", $e, [
|
|
367
|
+
a("div", Te, [
|
|
368
|
+
(h(!0), D(oe, null, le(v.value, (m, Ie) => (h(), D("div", {
|
|
369
|
+
key: m.id,
|
|
370
|
+
class: "page-item"
|
|
371
|
+
}, [
|
|
372
|
+
a("div", De, [
|
|
373
|
+
s(re, {
|
|
374
|
+
type: m.type,
|
|
375
|
+
"props-data": { modelValue: m }
|
|
376
|
+
}, null, 8, ["type", "props-data"])
|
|
377
|
+
])
|
|
378
|
+
]))), 128))
|
|
379
|
+
])
|
|
380
|
+
])
|
|
381
|
+
], 2), [
|
|
382
|
+
[M, R(f) >= 768]
|
|
383
|
+
]),
|
|
384
|
+
z(a("div", Se, [
|
|
385
|
+
s(me, {
|
|
386
|
+
modelValue: l.modelValue,
|
|
387
|
+
componentKey: U.value
|
|
388
|
+
}, null, 8, ["modelValue", "componentKey"])
|
|
389
|
+
], 512), [
|
|
390
|
+
[M, R(f) < 768]
|
|
391
|
+
]),
|
|
392
|
+
l.isPreview ? E("", !0) : (h(), L(ce, {
|
|
393
|
+
key: 0,
|
|
394
|
+
show: _.value,
|
|
395
|
+
"onUpdate:show": n[0] || (n[0] = (m) => _.value = m),
|
|
396
|
+
onHandleEdit: n[1] || (n[1] = (m) => k.value = !0),
|
|
397
|
+
onHandleDelete: t.handleDelete,
|
|
398
|
+
onHandleCopy: t.handleCopy,
|
|
399
|
+
onHandlePaste: t.handlePaste
|
|
400
|
+
}, null, 8, ["show", "onHandleDelete", "onHandleCopy", "onHandlePaste"]))
|
|
401
|
+
], 2),
|
|
402
|
+
l.isPreview ? E("", !0) : (h(), L(_e, {
|
|
403
|
+
key: 0,
|
|
404
|
+
show: k.value,
|
|
405
|
+
"onUpdate:show": n[2] || (n[2] = (m) => k.value = m),
|
|
406
|
+
data: l.modelValue
|
|
407
|
+
}, null, 8, ["show", "data"]))
|
|
408
|
+
], 38);
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
}, Be = /* @__PURE__ */ j(Pe, [["__scopeId", "data-v-1d36ae44"]]);
|
|
412
|
+
export {
|
|
413
|
+
Be as default
|
|
414
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var U=Object.defineProperty;var K=(u,r,i)=>r in u?U(u,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[r]=i;var c=(u,r,i)=>K(u,typeof r!="symbol"?r+"":r,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),B=require("@wangeditor/editor-for-vue"),w=require("@wangeditor/editor"),q=require("./index-
|
|
1
|
+
"use strict";var U=Object.defineProperty;var K=(u,r,i)=>r in u?U(u,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[r]=i;var c=(u,r,i)=>K(u,typeof r!="symbol"?r+"":r,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),B=require("@wangeditor/editor-for-vue"),w=require("@wangeditor/editor"),q=require("./index-C0VvLaXk.js"),E={class:"rich-text-editor"},$=t.defineComponent({__name:"index",props:{name:{default:""},modelValue:{default:""},placeholder:{default:"请输入内容..."},height:{default:"400px"},mode:{default:"default"},disabled:{type:Boolean,default:!1},maxLength:{default:1e4},excludeKeys:{default:()=>[]},includeKeys:{default:()=>[]}},emits:["update:modelValue","change","focus","blur","created","upload-image","upload-video"],setup(u,{expose:r,emit:i}){const a=u,m=i,o=t.shallowRef(),d=t.ref(""),I=t.computed(()=>typeof a.height=="number"?`${a.height}px`:a.height),p=t.inject("handleUpload",()=>{}),f=t.inject("fileUrl",null),C=t.inject("chooseName",null),h=t.ref(""),v=t.ref(null),b=e=>{if(!p){console.warn("Upload: handleUpload function not provided by ancestor");return}if(h.value=e,o.value)try{const n=o.value.selection;n&&(v.value={anchor:{path:[...n.anchor.path],offset:n.anchor.offset},focus:{path:[...n.focus.path],offset:n.focus.offset}})}catch(n){console.warn("保存光标位置失败:",n)}const l=a.name+"_"+e;p(!0,l)};t.watch(()=>a.name,()=>{f.value=null},{deep:!0,immediate:!0}),t.watch(()=>[f==null?void 0:f.value],([e])=>{const l=a.name+"_"+h.value;!e||!C.value||C.value!==l||o.value&&t.nextTick(()=>{var n,g;if(o.value){try{if(o.value.focus(),v.value)try{o.value.select(v.value)}catch(s){console.warn("恢复光标位置失败,使用默认位置:",s)}}catch(s){console.warn("聚焦编辑器失败:",s)}if(h.value==="img"){const y=`<img src="${e}" alt="图片" style="max-width: 100%;">`;(n=o.value)==null||n.dangerouslyInsertHtml(y)}else{const y=`<video src="${e}" controls style="max-width: 100%;"></video>`;(g=o.value)==null||g.dangerouslyInsertHtml(y)}v.value=null,h.value=""}})},{immediate:!1});function _(e){return class{constructor(){c(this,"title");c(this,"tag");c(this,"iconSvg");this.title="上传图片",this.tag="button",this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M959.877 128l0.123 0.123v767.775l-0.123 0.122H64.102l-0.122-0.122V128.123l0.122-0.123h895.775zM960 64H64C28.795 64 0 92.795 0 128v768c0 35.205 28.795 64 64 64h896c35.205 0 64-28.795 64-64V128c0-35.205-28.795-64-64-64zM832 288.01c0 53.023-42.988 96.01-96.01 96.01s-96.01-42.987-96.01-96.01S682.967 192 735.99 192 832 234.988 832 288.01zM896 832H128V704l224.01-384 256 320h64l224.01-192z"></path></svg>'}isActive(){return!1}getValue(){return""}isDisabled(){return!1}exec(){t.nextTick(()=>{console.log("点击了自定义上传图片菜单"),e("img")})}}}function k(e){return class{constructor(){c(this,"title");c(this,"tag");c(this,"iconSvg");this.title="上传视频",this.tag="button",this.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M981.184 160.096C837.568 139.456 678.848 128 512 128S186.432 139.456 42.816 160.096C15.296 267.808 0 386.848 0 512s15.264 244.16 42.816 351.904C186.464 884.544 345.152 896 512 896s325.568-11.456 469.184-32.096C1008.704 756.192 1024 637.152 1024 512s-15.264-244.16-42.816-351.904zM384 704V320l320 192-320 192z"></path></svg>'}getValue(){return""}isActive(){return!1}isDisabled(){return!1}exec(){t.nextTick(()=>{console.log("点击了自定义上传视频菜单"),e("video")})}}}const x={toolbarKeys:["headerSelect","bold","italic","through","underline","color","fontSize","lineHeight","delIndent","indent","divider","insertTable","justifyCenter","justifyJustify","justifyLeft","justifyRight","undo","redo","clearStyle","codeBlock"]},H={placeholder:a.placeholder,readOnly:a.disabled,maxLength:a.maxLength,MENU_CONF:{}},M=Math.random().toString(36).substring(2,9),V=`CustomImageMenu_${M}`,S=`CustomVideoMenu_${M}`,j=e=>{o.value=e;try{const l=_(b),n=k(b),g={key:V,factory(){return new l}},s={key:S,factory(){return new n}};w.Boot.registerMenu(g),w.Boot.registerMenu(s)}catch(l){console.warn("菜单注册失败:",l)}x.insertKeys={index:0,keys:[V,S]},m("created",e)};t.onBeforeUnmount(()=>{const e=o.value;e!=null&&e.destroy()}),t.watch(()=>a.modelValue,e=>{e!==d.value&&(d.value=e||"")},{immediate:!0});const z=e=>{m("update:modelValue",d.value),m("change",e)},N=()=>{o.value=void 0},O=e=>{m("focus",e)},T=e=>{m("blur",e)};return r({editor:o,getHtml:()=>d.value,getText:()=>{var e;return((e=o.value)==null?void 0:e.getText())||""},isEmpty:()=>{var e;return((e=o.value)==null?void 0:e.isEmpty())||!0},clear:()=>{var e;return(e=o.value)==null?void 0:e.clear()},focus:()=>{var e;return(e=o.value)==null?void 0:e.focus()},blur:()=>{var e;return(e=o.value)==null?void 0:e.blur()},disable:()=>{var e;return(e=o.value)==null?void 0:e.disable()},enable:()=>{var e;return(e=o.value)==null?void 0:e.enable()}}),(e,l)=>(t.openBlock(),t.createElementBlock("div",E,[t.createVNode(t.unref(B.Toolbar),{class:"editor-toolbar",editor:o.value,defaultConfig:x,mode:u.mode},null,8,["editor","mode"]),t.createVNode(t.unref(B.Editor),{class:"editor-content",style:t.normalizeStyle({height:I.value}),modelValue:d.value,"onUpdate:modelValue":l[0]||(l[0]=n=>d.value=n),defaultConfig:H,mode:u.mode,onOnCreated:j,onOnChange:z,onOnDestroyed:N,onOnFocus:O,onOnBlur:T},null,8,["style","modelValue","mode"])]))}}),D=q._($,[["__scopeId","data-v-e8d1a61b"]]);exports.default=D;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C0VvLaXk.js");exports.default=e.d;
|