officialblock 1.8.1 → 1.8.2
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-AsxEaDQ4.js +15 -0
- package/dist/index-CLkSJ0Zb.js +1 -0
- package/dist/index-OZu_uw51.mjs +18779 -0
- package/dist/index-pGN5r5O6.mjs +237 -0
- package/dist/official-block.cjs.js +1 -15
- package/dist/official-block.es.js +73 -18852
- package/dist/official-block.umd.js +3 -3
- package/dist/style.css +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
var T = Object.defineProperty;
|
|
2
|
+
var F = (l, a, u) => a in l ? T(l, a, { enumerable: !0, configurable: !0, writable: !0, value: u }) : l[a] = u;
|
|
3
|
+
var i = (l, a, u) => F(l, typeof a != "symbol" ? a + "" : a, u);
|
|
4
|
+
import { defineComponent as N, shallowRef as R, ref as x, computed as D, inject as g, watch as C, onBeforeUnmount as K, resolveComponent as L, createBlock as A, openBlock as $, withCtx as J, createElementVNode as q, createVNode as M, unref as V, normalizeStyle as G, nextTick as _ } from "vue";
|
|
5
|
+
import { Toolbar as P, Editor as Q } from "@wangeditor/editor-for-vue";
|
|
6
|
+
import { Boot as w } from "@wangeditor/editor";
|
|
7
|
+
import { _ as W } from "./index-OZu_uw51.mjs";
|
|
8
|
+
const X = { class: "rich-text-editor" }, Y = /* @__PURE__ */ N({
|
|
9
|
+
__name: "RichTextEditor",
|
|
10
|
+
props: {
|
|
11
|
+
name: { default: "" },
|
|
12
|
+
modelValue: { default: "" },
|
|
13
|
+
placeholder: { default: "请输入内容..." },
|
|
14
|
+
height: { default: "400px" },
|
|
15
|
+
mode: { default: "default" },
|
|
16
|
+
disabled: { type: Boolean, default: !1 },
|
|
17
|
+
maxLength: { default: 1e4 },
|
|
18
|
+
excludeKeys: { default: () => [] },
|
|
19
|
+
includeKeys: { default: () => [] }
|
|
20
|
+
},
|
|
21
|
+
emits: ["update:modelValue", "change", "focus", "blur", "created", "upload-image", "upload-video"],
|
|
22
|
+
setup(l, { expose: a, emit: u }) {
|
|
23
|
+
const n = l, d = u, o = R(), r = x(""), B = D(() => typeof n.height == "number" ? `${n.height}px` : n.height), v = g("handleUpload", () => {
|
|
24
|
+
}), h = g("fileUrl", null), f = g("chooseName", null), c = x(""), y = () => {
|
|
25
|
+
if (!v) {
|
|
26
|
+
console.warn("Upload: handleUpload function not provided by ancestor");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
v(!0, n.name + c.value);
|
|
30
|
+
};
|
|
31
|
+
C(
|
|
32
|
+
() => [h == null ? void 0 : h.value, f == null ? void 0 : f.value],
|
|
33
|
+
([e, t]) => {
|
|
34
|
+
var s, m;
|
|
35
|
+
!e || !t || t !== n.name + c.value || (c.value === "img" ? (s = o.value) == null || s.dangerouslyInsertHtml('<img src="https://osswebsite.ycyw.com/media-library/ywies-bj/images/home/ywies-tx.jpg" alt="图片" style="max-width: 100%;">') : (m = o.value) == null || m.dangerouslyInsertHtml('<video src="https://osswebsite.ycyw.com/media-library/ywies-bj/images/home/ywies-tx.jpg" controls style="max-width: 100%;"></video>'));
|
|
36
|
+
},
|
|
37
|
+
{ immediate: !1 }
|
|
38
|
+
);
|
|
39
|
+
class S {
|
|
40
|
+
constructor() {
|
|
41
|
+
i(this, "title");
|
|
42
|
+
i(this, "tag");
|
|
43
|
+
i(this, "iconSvg");
|
|
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
|
+
}
|
|
46
|
+
isActive(t) {
|
|
47
|
+
return !1;
|
|
48
|
+
}
|
|
49
|
+
getValue(t) {
|
|
50
|
+
return "";
|
|
51
|
+
}
|
|
52
|
+
isDisabled(t) {
|
|
53
|
+
return !1;
|
|
54
|
+
}
|
|
55
|
+
exec(t, s) {
|
|
56
|
+
_(() => {
|
|
57
|
+
console.log("点击了自定义上传图片菜单"), c.value = "img", y();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
class j {
|
|
62
|
+
constructor() {
|
|
63
|
+
i(this, "title");
|
|
64
|
+
i(this, "tag");
|
|
65
|
+
i(this, "iconSvg");
|
|
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
|
+
}
|
|
68
|
+
getValue(t) {
|
|
69
|
+
return "";
|
|
70
|
+
}
|
|
71
|
+
isActive(t) {
|
|
72
|
+
return !1;
|
|
73
|
+
}
|
|
74
|
+
isDisabled(t) {
|
|
75
|
+
return !1;
|
|
76
|
+
}
|
|
77
|
+
exec(t, s) {
|
|
78
|
+
_(() => {
|
|
79
|
+
c.value = "video", y();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const p = {
|
|
84
|
+
toolbarKeys: [
|
|
85
|
+
// 菜单 key
|
|
86
|
+
"headerSelect",
|
|
87
|
+
"bold",
|
|
88
|
+
// 加粗
|
|
89
|
+
"italic",
|
|
90
|
+
// 斜体
|
|
91
|
+
"through",
|
|
92
|
+
// 删除线
|
|
93
|
+
"underline",
|
|
94
|
+
// 下划线
|
|
95
|
+
"color",
|
|
96
|
+
// 文字颜色
|
|
97
|
+
"fontSize",
|
|
98
|
+
// 字体大小
|
|
99
|
+
"lineHeight",
|
|
100
|
+
// 行高
|
|
101
|
+
"delIndent",
|
|
102
|
+
// 缩进
|
|
103
|
+
"indent",
|
|
104
|
+
// 增进
|
|
105
|
+
"divider",
|
|
106
|
+
// 分割线
|
|
107
|
+
"insertTable",
|
|
108
|
+
// 插入表格
|
|
109
|
+
"justifyCenter",
|
|
110
|
+
// 居中对齐
|
|
111
|
+
"justifyJustify",
|
|
112
|
+
// 两端对齐
|
|
113
|
+
"justifyLeft",
|
|
114
|
+
// 左对齐
|
|
115
|
+
"justifyRight",
|
|
116
|
+
// 右对齐
|
|
117
|
+
"undo",
|
|
118
|
+
// 撤销
|
|
119
|
+
"redo",
|
|
120
|
+
// 重做
|
|
121
|
+
"clearStyle",
|
|
122
|
+
// 清除格式
|
|
123
|
+
"codeBlock"
|
|
124
|
+
//代码块
|
|
125
|
+
]
|
|
126
|
+
}, b = {
|
|
127
|
+
placeholder: n.placeholder,
|
|
128
|
+
readOnly: n.disabled,
|
|
129
|
+
maxLength: n.maxLength,
|
|
130
|
+
MENU_CONF: {}
|
|
131
|
+
};
|
|
132
|
+
b.MENU_CONF = {};
|
|
133
|
+
const H = (e) => {
|
|
134
|
+
o.value = e;
|
|
135
|
+
const t = {
|
|
136
|
+
key: "CustomImageMenu",
|
|
137
|
+
// 定义 menu key :要保证唯一、不重复(重要)
|
|
138
|
+
factory() {
|
|
139
|
+
return new S();
|
|
140
|
+
}
|
|
141
|
+
}, s = {
|
|
142
|
+
key: "CustomVideoMenu",
|
|
143
|
+
// 定义 menu key :要保证唯一、不重复(重要)
|
|
144
|
+
factory() {
|
|
145
|
+
return new j();
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
w.registerMenu(t), w.registerMenu(s), p.insertKeys = {
|
|
149
|
+
index: 0,
|
|
150
|
+
keys: ["CustomImageMenu", "CustomVideoMenu"]
|
|
151
|
+
}, d("created", e);
|
|
152
|
+
};
|
|
153
|
+
K(() => {
|
|
154
|
+
const e = o.value;
|
|
155
|
+
e != null && e.destroy();
|
|
156
|
+
}), C(
|
|
157
|
+
() => n.modelValue,
|
|
158
|
+
(e) => {
|
|
159
|
+
e !== r.value && (r.value = e || "");
|
|
160
|
+
},
|
|
161
|
+
{ immediate: !0 }
|
|
162
|
+
);
|
|
163
|
+
const U = (e) => {
|
|
164
|
+
d("update:modelValue", r.value), d("change", e);
|
|
165
|
+
}, z = () => {
|
|
166
|
+
o.value = void 0;
|
|
167
|
+
}, E = (e) => {
|
|
168
|
+
d("focus", e);
|
|
169
|
+
}, I = (e) => {
|
|
170
|
+
d("blur", e);
|
|
171
|
+
};
|
|
172
|
+
return a({
|
|
173
|
+
editor: o,
|
|
174
|
+
getHtml: () => r.value,
|
|
175
|
+
getText: () => {
|
|
176
|
+
var e;
|
|
177
|
+
return ((e = o.value) == null ? void 0 : e.getText()) || "";
|
|
178
|
+
},
|
|
179
|
+
isEmpty: () => {
|
|
180
|
+
var e;
|
|
181
|
+
return ((e = o.value) == null ? void 0 : e.isEmpty()) || !0;
|
|
182
|
+
},
|
|
183
|
+
clear: () => {
|
|
184
|
+
var e;
|
|
185
|
+
return (e = o.value) == null ? void 0 : e.clear();
|
|
186
|
+
},
|
|
187
|
+
focus: () => {
|
|
188
|
+
var e;
|
|
189
|
+
return (e = o.value) == null ? void 0 : e.focus();
|
|
190
|
+
},
|
|
191
|
+
blur: () => {
|
|
192
|
+
var e;
|
|
193
|
+
return (e = o.value) == null ? void 0 : e.blur();
|
|
194
|
+
},
|
|
195
|
+
disable: () => {
|
|
196
|
+
var e;
|
|
197
|
+
return (e = o.value) == null ? void 0 : e.disable();
|
|
198
|
+
},
|
|
199
|
+
enable: () => {
|
|
200
|
+
var e;
|
|
201
|
+
return (e = o.value) == null ? void 0 : e.enable();
|
|
202
|
+
}
|
|
203
|
+
}), (e, t) => {
|
|
204
|
+
const s = L("client-only");
|
|
205
|
+
return $(), A(s, null, {
|
|
206
|
+
default: J(() => [
|
|
207
|
+
q("div", X, [
|
|
208
|
+
M(V(P), {
|
|
209
|
+
class: "editor-toolbar",
|
|
210
|
+
editor: o.value,
|
|
211
|
+
defaultConfig: p,
|
|
212
|
+
mode: l.mode
|
|
213
|
+
}, null, 8, ["editor", "mode"]),
|
|
214
|
+
M(V(Q), {
|
|
215
|
+
class: "editor-content",
|
|
216
|
+
style: G({ height: B.value }),
|
|
217
|
+
modelValue: r.value,
|
|
218
|
+
"onUpdate:modelValue": t[0] || (t[0] = (m) => r.value = m),
|
|
219
|
+
defaultConfig: b,
|
|
220
|
+
mode: l.mode,
|
|
221
|
+
onOnCreated: H,
|
|
222
|
+
onOnChange: U,
|
|
223
|
+
onOnDestroyed: z,
|
|
224
|
+
onOnFocus: E,
|
|
225
|
+
onOnBlur: I
|
|
226
|
+
}, null, 8, ["style", "modelValue", "mode"])
|
|
227
|
+
])
|
|
228
|
+
]),
|
|
229
|
+
_: 1
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}), ae = /* @__PURE__ */ W(Y, [["__scopeId", "data-v-5810ba54"]]);
|
|
234
|
+
export {
|
|
235
|
+
ae as RichTextEditor,
|
|
236
|
+
ae as default
|
|
237
|
+
};
|