officialblock 1.8.2 → 1.8.4
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-B00sdBWG.js +1 -0
- package/dist/index-BVmrkk8g.js +16 -0
- package/dist/{index-pGN5r5O6.mjs → index-CXOWxR2L.mjs} +74 -75
- package/dist/index-DmjHG1Mk.mjs +26662 -0
- package/dist/official-block.cjs.js +1 -1
- package/dist/official-block.es.js +107 -73
- package/dist/official-block.umd.js +4 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/index-AsxEaDQ4.js +0 -15
- package/dist/index-CLkSJ0Zb.js +0 -1
- package/dist/index-OZu_uw51.mjs +0 -18779
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var F = (l, a,
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import
|
|
6
|
-
import { Boot as
|
|
7
|
-
import { _ as
|
|
8
|
-
const
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var F = (l, a, i) => a in l ? D(l, a, { enumerable: !0, configurable: !0, writable: !0, value: i }) : l[a] = i;
|
|
3
|
+
var s = (l, a, i) => F(l, typeof a != "symbol" ? a + "" : a, i);
|
|
4
|
+
import { defineComponent as K, shallowRef as A, ref as f, computed as $, inject as g, watch as w, onBeforeUnmount as N, createElementBlock as P, openBlock as J, createVNode as M, unref as V, normalizeStyle as q, nextTick as _ } from "vue";
|
|
5
|
+
import "@wangeditor/editor-for-vue";
|
|
6
|
+
import { Boot as B } from "@wangeditor/editor";
|
|
7
|
+
import { _ as G } from "./index-DmjHG1Mk.mjs";
|
|
8
|
+
const Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null }, Symbol.toStringTag, { value: "Module" })), W = { class: "rich-text-editor" }, X = /* @__PURE__ */ K({
|
|
9
9
|
__name: "RichTextEditor",
|
|
10
10
|
props: {
|
|
11
11
|
name: { default: "" },
|
|
@@ -19,28 +19,28 @@ const X = { class: "rich-text-editor" }, Y = /* @__PURE__ */ N({
|
|
|
19
19
|
includeKeys: { default: () => [] }
|
|
20
20
|
},
|
|
21
21
|
emits: ["update:modelValue", "change", "focus", "blur", "created", "upload-image", "upload-video"],
|
|
22
|
-
setup(l, { expose: a, emit:
|
|
23
|
-
const n = l, d =
|
|
24
|
-
}),
|
|
22
|
+
setup(l, { expose: a, emit: i }) {
|
|
23
|
+
const n = l, d = i, o = A(), u = f(""), S = f(!1), j = $(() => typeof n.height == "number" ? `${n.height}px` : n.height), v = g("handleUpload", () => {
|
|
24
|
+
}), m = g("fileUrl", null), h = g("chooseName", null), c = f(""), y = () => {
|
|
25
25
|
if (!v) {
|
|
26
26
|
console.warn("Upload: handleUpload function not provided by ancestor");
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
v(!0, n.name + c.value);
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
() => [
|
|
31
|
+
w(
|
|
32
|
+
() => [m == null ? void 0 : m.value, h == null ? void 0 : h.value],
|
|
33
33
|
([e, t]) => {
|
|
34
|
-
var
|
|
35
|
-
!e || !t || t !== n.name + c.value || (c.value === "img" ? (
|
|
34
|
+
var r, C;
|
|
35
|
+
!e || !t || t !== n.name + c.value || (c.value === "img" ? (r = o.value) == null || r.dangerouslyInsertHtml('<img src="https://osswebsite.ycyw.com/media-library/ywies-bj/images/home/ywies-tx.jpg" alt="图片" style="max-width: 100%;">') : (C = o.value) == null || C.dangerouslyInsertHtml('<video src="https://osswebsite.ycyw.com/media-library/ywies-bj/images/home/ywies-tx.jpg" controls style="max-width: 100%;"></video>'));
|
|
36
36
|
},
|
|
37
37
|
{ immediate: !1 }
|
|
38
38
|
);
|
|
39
|
-
class
|
|
39
|
+
class z {
|
|
40
40
|
constructor() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
s(this, "title");
|
|
42
|
+
s(this, "tag");
|
|
43
|
+
s(this, "iconSvg");
|
|
44
44
|
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>';
|
|
45
45
|
}
|
|
46
46
|
isActive(t) {
|
|
@@ -52,17 +52,17 @@ const X = { class: "rich-text-editor" }, Y = /* @__PURE__ */ N({
|
|
|
52
52
|
isDisabled(t) {
|
|
53
53
|
return !1;
|
|
54
54
|
}
|
|
55
|
-
exec(t,
|
|
55
|
+
exec(t, r) {
|
|
56
56
|
_(() => {
|
|
57
57
|
console.log("点击了自定义上传图片菜单"), c.value = "img", y();
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
class
|
|
61
|
+
class E {
|
|
62
62
|
constructor() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
s(this, "title");
|
|
64
|
+
s(this, "tag");
|
|
65
|
+
s(this, "iconSvg");
|
|
66
66
|
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>';
|
|
67
67
|
}
|
|
68
68
|
getValue(t) {
|
|
@@ -74,7 +74,7 @@ const X = { class: "rich-text-editor" }, Y = /* @__PURE__ */ N({
|
|
|
74
74
|
isDisabled(t) {
|
|
75
75
|
return !1;
|
|
76
76
|
}
|
|
77
|
-
exec(t,
|
|
77
|
+
exec(t, r) {
|
|
78
78
|
_(() => {
|
|
79
79
|
c.value = "video", y();
|
|
80
80
|
});
|
|
@@ -123,55 +123,62 @@ const X = { class: "rich-text-editor" }, Y = /* @__PURE__ */ N({
|
|
|
123
123
|
"codeBlock"
|
|
124
124
|
//代码块
|
|
125
125
|
]
|
|
126
|
-
},
|
|
126
|
+
}, H = {
|
|
127
127
|
placeholder: n.placeholder,
|
|
128
128
|
readOnly: n.disabled,
|
|
129
129
|
maxLength: n.maxLength,
|
|
130
130
|
MENU_CONF: {}
|
|
131
|
-
}
|
|
132
|
-
b.MENU_CONF = {};
|
|
133
|
-
const H = (e) => {
|
|
131
|
+
}, O = (e) => {
|
|
134
132
|
o.value = e;
|
|
135
133
|
const t = {
|
|
136
134
|
key: "CustomImageMenu",
|
|
137
135
|
// 定义 menu key :要保证唯一、不重复(重要)
|
|
138
136
|
factory() {
|
|
139
|
-
return new
|
|
137
|
+
return new z();
|
|
140
138
|
}
|
|
141
|
-
},
|
|
139
|
+
}, r = {
|
|
142
140
|
key: "CustomVideoMenu",
|
|
143
141
|
// 定义 menu key :要保证唯一、不重复(重要)
|
|
144
142
|
factory() {
|
|
145
|
-
return new
|
|
143
|
+
return new E();
|
|
146
144
|
}
|
|
147
145
|
};
|
|
148
|
-
|
|
146
|
+
B.registerMenu(t), B.registerMenu(r), p.insertKeys = {
|
|
149
147
|
index: 0,
|
|
150
148
|
keys: ["CustomImageMenu", "CustomVideoMenu"]
|
|
151
149
|
}, d("created", e);
|
|
152
150
|
};
|
|
153
|
-
|
|
151
|
+
N(() => {
|
|
154
152
|
const e = o.value;
|
|
155
153
|
e != null && e.destroy();
|
|
156
|
-
}),
|
|
154
|
+
}), w(
|
|
157
155
|
() => n.modelValue,
|
|
158
156
|
(e) => {
|
|
159
|
-
e !==
|
|
157
|
+
e !== u.value && (u.value = e || "");
|
|
160
158
|
},
|
|
161
159
|
{ immediate: !0 }
|
|
162
160
|
);
|
|
163
|
-
const
|
|
164
|
-
d("update:modelValue",
|
|
165
|
-
},
|
|
161
|
+
const T = (e) => {
|
|
162
|
+
d("update:modelValue", u.value), d("change", e);
|
|
163
|
+
}, I = () => {
|
|
166
164
|
o.value = void 0;
|
|
167
|
-
},
|
|
165
|
+
}, U = (e) => {
|
|
168
166
|
d("focus", e);
|
|
169
|
-
},
|
|
167
|
+
}, k = (e) => {
|
|
170
168
|
d("blur", e);
|
|
171
169
|
};
|
|
172
|
-
|
|
170
|
+
let b = null, x = null;
|
|
171
|
+
return onMounted(async () => {
|
|
172
|
+
if (typeof window < "u")
|
|
173
|
+
try {
|
|
174
|
+
const e = await import("@wangeditor/editor-for-vue");
|
|
175
|
+
b = e.Editor, x = e.Toolbar, await Promise.resolve().then(() => Q), S.value = !0;
|
|
176
|
+
} catch (e) {
|
|
177
|
+
console.error("编辑器加载失败:", e);
|
|
178
|
+
}
|
|
179
|
+
}), a({
|
|
173
180
|
editor: o,
|
|
174
|
-
getHtml: () =>
|
|
181
|
+
getHtml: () => u.value,
|
|
175
182
|
getText: () => {
|
|
176
183
|
var e;
|
|
177
184
|
return ((e = o.value) == null ? void 0 : e.getText()) || "";
|
|
@@ -200,38 +207,30 @@ const X = { class: "rich-text-editor" }, Y = /* @__PURE__ */ N({
|
|
|
200
207
|
var e;
|
|
201
208
|
return (e = o.value) == null ? void 0 : e.enable();
|
|
202
209
|
}
|
|
203
|
-
}), (e, t) =>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
onOnFocus: E,
|
|
225
|
-
onOnBlur: I
|
|
226
|
-
}, null, 8, ["style", "modelValue", "mode"])
|
|
227
|
-
])
|
|
228
|
-
]),
|
|
229
|
-
_: 1
|
|
230
|
-
});
|
|
231
|
-
};
|
|
210
|
+
}), (e, t) => (J(), P("div", W, [
|
|
211
|
+
M(V(x), {
|
|
212
|
+
class: "editor-toolbar",
|
|
213
|
+
editor: o.value,
|
|
214
|
+
defaultConfig: p,
|
|
215
|
+
mode: l.mode
|
|
216
|
+
}, null, 8, ["editor", "mode"]),
|
|
217
|
+
M(V(b), {
|
|
218
|
+
class: "editor-content",
|
|
219
|
+
style: q({ height: j.value }),
|
|
220
|
+
modelValue: u.value,
|
|
221
|
+
"onUpdate:modelValue": t[0] || (t[0] = (r) => u.value = r),
|
|
222
|
+
defaultConfig: H,
|
|
223
|
+
mode: l.mode,
|
|
224
|
+
onOnCreated: O,
|
|
225
|
+
onOnChange: T,
|
|
226
|
+
onOnDestroyed: I,
|
|
227
|
+
onOnFocus: U,
|
|
228
|
+
onOnBlur: k
|
|
229
|
+
}, null, 8, ["style", "modelValue", "mode"])
|
|
230
|
+
]));
|
|
232
231
|
}
|
|
233
|
-
}),
|
|
232
|
+
}), le = /* @__PURE__ */ G(X, [["__scopeId", "data-v-44814993"]]);
|
|
234
233
|
export {
|
|
235
|
-
|
|
236
|
-
|
|
234
|
+
le as RichTextEditor,
|
|
235
|
+
le as default
|
|
237
236
|
};
|