officialblock 1.8.4 → 1.8.6

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.
@@ -1,12 +1,12 @@
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
- __name: "RichTextEditor",
1
+ var T = Object.defineProperty;
2
+ var D = (o, l, u) => l in o ? T(o, l, { enumerable: !0, configurable: !0, writable: !0, value: u }) : o[l] = u;
3
+ var s = (o, l, u) => D(o, typeof l != "symbol" ? l + "" : l, u);
4
+ import { defineComponent as F, shallowRef as K, ref as b, computed as L, inject as f, watch as x, onBeforeUnmount as A, createElementBlock as R, openBlock as $, createVNode as C, unref as M, normalizeStyle as N, nextTick as V } from "vue";
5
+ import { Toolbar as J, Editor as q } from "@wangeditor/editor-for-vue";
6
+ import { Boot as w } from "@wangeditor/editor";
7
+ import { _ as G } from "./index-BZXCZXXX.mjs";
8
+ const P = { class: "rich-text-editor" }, Q = /* @__PURE__ */ F({
9
+ __name: "index",
10
10
  props: {
11
11
  name: { default: "" },
12
12
  modelValue: { default: "" },
@@ -19,68 +19,68 @@ const Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
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: 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
- if (!v) {
22
+ setup(o, { expose: l, emit: u }) {
23
+ const a = o, d = u, t = K(), i = b(""), B = L(() => typeof a.height == "number" ? `${a.height}px` : a.height), g = f("handleUpload", () => {
24
+ }), m = f("fileUrl", null), h = f("chooseName", null), c = b(""), v = () => {
25
+ if (!g) {
26
26
  console.warn("Upload: handleUpload function not provided by ancestor");
27
27
  return;
28
28
  }
29
- v(!0, n.name + c.value);
29
+ g(!0, a.name + c.value);
30
30
  };
31
- w(
31
+ x(
32
32
  () => [m == null ? void 0 : m.value, h == null ? void 0 : h.value],
33
- ([e, t]) => {
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>'));
33
+ ([e, n]) => {
34
+ var r, p;
35
+ !e || !n || n !== a.name + c.value || (c.value === "img" ? (r = t.value) == null || r.dangerouslyInsertHtml('<img src="https://osswebsite.ycyw.com/media-library/ywies-bj/images/home/ywies-tx.jpg" alt="图片" style="max-width: 100%;">') : (p = t.value) == null || p.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 z {
39
+ class S {
40
40
  constructor() {
41
41
  s(this, "title");
42
42
  s(this, "tag");
43
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
- isActive(t) {
46
+ isActive() {
47
47
  return !1;
48
48
  }
49
- getValue(t) {
49
+ getValue() {
50
50
  return "";
51
51
  }
52
- isDisabled(t) {
52
+ isDisabled() {
53
53
  return !1;
54
54
  }
55
- exec(t, r) {
56
- _(() => {
57
- console.log("点击了自定义上传图片菜单"), c.value = "img", y();
55
+ exec() {
56
+ V(() => {
57
+ console.log("点击了自定义上传图片菜单"), c.value = "img", v();
58
58
  });
59
59
  }
60
60
  }
61
- class E {
61
+ class j {
62
62
  constructor() {
63
63
  s(this, "title");
64
64
  s(this, "tag");
65
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
- getValue(t) {
68
+ getValue() {
69
69
  return "";
70
70
  }
71
- isActive(t) {
71
+ isActive() {
72
72
  return !1;
73
73
  }
74
- isDisabled(t) {
74
+ isDisabled() {
75
75
  return !1;
76
76
  }
77
- exec(t, r) {
78
- _(() => {
79
- c.value = "video", y();
77
+ exec() {
78
+ V(() => {
79
+ c.value = "video", v();
80
80
  });
81
81
  }
82
82
  }
83
- const p = {
83
+ const y = {
84
84
  toolbarKeys: [
85
85
  // 菜单 key
86
86
  "headerSelect",
@@ -124,113 +124,103 @@ const Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
124
124
  //代码块
125
125
  ]
126
126
  }, H = {
127
- placeholder: n.placeholder,
128
- readOnly: n.disabled,
129
- maxLength: n.maxLength,
127
+ placeholder: a.placeholder,
128
+ readOnly: a.disabled,
129
+ maxLength: a.maxLength,
130
130
  MENU_CONF: {}
131
- }, O = (e) => {
132
- o.value = e;
133
- const t = {
131
+ }, z = (e) => {
132
+ t.value = e;
133
+ const n = {
134
134
  key: "CustomImageMenu",
135
135
  // 定义 menu key :要保证唯一、不重复(重要)
136
136
  factory() {
137
- return new z();
137
+ return new S();
138
138
  }
139
139
  }, r = {
140
140
  key: "CustomVideoMenu",
141
141
  // 定义 menu key :要保证唯一、不重复(重要)
142
142
  factory() {
143
- return new E();
143
+ return new j();
144
144
  }
145
145
  };
146
- B.registerMenu(t), B.registerMenu(r), p.insertKeys = {
146
+ w.registerMenu(n), w.registerMenu(r), y.insertKeys = {
147
147
  index: 0,
148
148
  keys: ["CustomImageMenu", "CustomVideoMenu"]
149
149
  }, d("created", e);
150
150
  };
151
- N(() => {
152
- const e = o.value;
151
+ A(() => {
152
+ const e = t.value;
153
153
  e != null && e.destroy();
154
- }), w(
155
- () => n.modelValue,
154
+ }), x(
155
+ () => a.modelValue,
156
156
  (e) => {
157
- e !== u.value && (u.value = e || "");
157
+ e !== i.value && (i.value = e || "");
158
158
  },
159
159
  { immediate: !0 }
160
160
  );
161
- const T = (e) => {
162
- d("update:modelValue", u.value), d("change", e);
163
- }, I = () => {
164
- o.value = void 0;
165
- }, U = (e) => {
161
+ const I = (e) => {
162
+ d("update:modelValue", i.value), d("change", e);
163
+ }, U = () => {
164
+ t.value = void 0;
165
+ }, _ = (e) => {
166
166
  d("focus", e);
167
167
  }, k = (e) => {
168
168
  d("blur", e);
169
169
  };
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({
180
- editor: o,
181
- getHtml: () => u.value,
170
+ return l({
171
+ editor: t,
172
+ getHtml: () => i.value,
182
173
  getText: () => {
183
174
  var e;
184
- return ((e = o.value) == null ? void 0 : e.getText()) || "";
175
+ return ((e = t.value) == null ? void 0 : e.getText()) || "";
185
176
  },
186
177
  isEmpty: () => {
187
178
  var e;
188
- return ((e = o.value) == null ? void 0 : e.isEmpty()) || !0;
179
+ return ((e = t.value) == null ? void 0 : e.isEmpty()) || !0;
189
180
  },
190
181
  clear: () => {
191
182
  var e;
192
- return (e = o.value) == null ? void 0 : e.clear();
183
+ return (e = t.value) == null ? void 0 : e.clear();
193
184
  },
194
185
  focus: () => {
195
186
  var e;
196
- return (e = o.value) == null ? void 0 : e.focus();
187
+ return (e = t.value) == null ? void 0 : e.focus();
197
188
  },
198
189
  blur: () => {
199
190
  var e;
200
- return (e = o.value) == null ? void 0 : e.blur();
191
+ return (e = t.value) == null ? void 0 : e.blur();
201
192
  },
202
193
  disable: () => {
203
194
  var e;
204
- return (e = o.value) == null ? void 0 : e.disable();
195
+ return (e = t.value) == null ? void 0 : e.disable();
205
196
  },
206
197
  enable: () => {
207
198
  var e;
208
- return (e = o.value) == null ? void 0 : e.enable();
199
+ return (e = t.value) == null ? void 0 : e.enable();
209
200
  }
210
- }), (e, t) => (J(), P("div", W, [
211
- M(V(x), {
201
+ }), (e, n) => ($(), R("div", P, [
202
+ C(M(J), {
212
203
  class: "editor-toolbar",
213
- editor: o.value,
214
- defaultConfig: p,
215
- mode: l.mode
204
+ editor: t.value,
205
+ defaultConfig: y,
206
+ mode: o.mode
216
207
  }, null, 8, ["editor", "mode"]),
217
- M(V(b), {
208
+ C(M(q), {
218
209
  class: "editor-content",
219
- style: q({ height: j.value }),
220
- modelValue: u.value,
221
- "onUpdate:modelValue": t[0] || (t[0] = (r) => u.value = r),
210
+ style: N({ height: B.value }),
211
+ modelValue: i.value,
212
+ "onUpdate:modelValue": n[0] || (n[0] = (r) => i.value = r),
222
213
  defaultConfig: H,
223
- mode: l.mode,
224
- onOnCreated: O,
225
- onOnChange: T,
226
- onOnDestroyed: I,
227
- onOnFocus: U,
214
+ mode: o.mode,
215
+ onOnCreated: z,
216
+ onOnChange: I,
217
+ onOnDestroyed: U,
218
+ onOnFocus: _,
228
219
  onOnBlur: k
229
220
  }, null, 8, ["style", "modelValue", "mode"])
230
221
  ]));
231
222
  }
232
- }), le = /* @__PURE__ */ G(X, [["__scopeId", "data-v-44814993"]]);
223
+ }), te = /* @__PURE__ */ G(Q, [["__scopeId", "data-v-b409e38f"]]);
233
224
  export {
234
- le as RichTextEditor,
235
- le as default
225
+ te as default
236
226
  };