@qingwu-ui/ai-editor 0.9.0-beta → 0.9.0-beta.1

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.js CHANGED
@@ -11,54 +11,54 @@ import { BubbleMenu as ne } from "@tiptap/react/menus";
11
11
  import { createPortal as re } from "react-dom";
12
12
  import { Extension as F, Node as ie } from "@tiptap/core";
13
13
  import { NodeSelection as ae, Plugin as I, PluginKey as L, TextSelection as R } from "@tiptap/pm/state";
14
- import { Decoration as oe, DecorationSet as se } from "@tiptap/pm/view";
15
- import { Image as ce } from "@tiptap/extension-image";
16
- import { Link as le } from "@tiptap/extension-link";
17
- import { Underline as ue } from "@tiptap/extension-underline";
18
- import z from "@tiptap/starter-kit";
19
- import { CharacterCount as B } from "@tiptap/extension-character-count";
20
- import { Color as de } from "@tiptap/extension-color";
21
- import { Highlight as V } from "@tiptap/extension-highlight";
22
- import { HorizontalRule as H } from "@tiptap/extension-horizontal-rule";
23
- import { Placeholder as fe } from "@tiptap/extension-placeholder";
24
- import { Table as pe } from "@tiptap/extension-table";
25
- import { TableCell as U } from "@tiptap/extension-table-cell";
26
- import { TableHeader as me } from "@tiptap/extension-table-header";
27
- import { TableRow as W } from "@tiptap/extension-table-row";
28
- import { TaskItem as he } from "@tiptap/extension-task-item";
29
- import { TaskList as G } from "@tiptap/extension-task-list";
30
- import { TextStyle as ge } from "@tiptap/extension-text-style";
31
- import { Markdown as _e } from "tiptap-markdown";
32
- import { CodeBlockLowlight as ve } from "@tiptap/extension-code-block-lowlight";
33
- import ye from "highlight.js/lib/languages/dockerfile";
34
- import { common as be, createLowlight as xe } from "lowlight";
35
- import Se, { findSuggestionMatch as Ce } from "@tiptap/suggestion";
14
+ import { Decoration as oe, DecorationSet as z } from "@tiptap/pm/view";
15
+ import { Image as se } from "@tiptap/extension-image";
16
+ import { Link as ce } from "@tiptap/extension-link";
17
+ import { Underline as le } from "@tiptap/extension-underline";
18
+ import B from "@tiptap/starter-kit";
19
+ import { CharacterCount as V } from "@tiptap/extension-character-count";
20
+ import { Color as ue } from "@tiptap/extension-color";
21
+ import { Highlight as H } from "@tiptap/extension-highlight";
22
+ import { HorizontalRule as U } from "@tiptap/extension-horizontal-rule";
23
+ import { Placeholder as de } from "@tiptap/extension-placeholder";
24
+ import { Table as fe } from "@tiptap/extension-table";
25
+ import { TableCell as W } from "@tiptap/extension-table-cell";
26
+ import { TableHeader as pe } from "@tiptap/extension-table-header";
27
+ import { TableRow as G } from "@tiptap/extension-table-row";
28
+ import { TaskItem as me } from "@tiptap/extension-task-item";
29
+ import { TaskList as K } from "@tiptap/extension-task-list";
30
+ import { TextStyle as he } from "@tiptap/extension-text-style";
31
+ import { Markdown as ge } from "tiptap-markdown";
32
+ import { CodeBlockLowlight as _e } from "@tiptap/extension-code-block-lowlight";
33
+ import ve from "highlight.js/lib/languages/dockerfile";
34
+ import { common as ye, createLowlight as be } from "lowlight";
35
+ import xe, { findSuggestionMatch as Se } from "@tiptap/suggestion";
36
36
  //#region ../text-layout/dist/index.mjs
37
- var we = null, Te = null;
38
- function Ee() {
39
- return Te || (typeof document > "u" ? null : (we = document.createElement("canvas"), Te = we.getContext("2d"), Te));
40
- }
41
- var De = /* @__PURE__ */ new Map();
42
- function Oe(e, t) {
43
- let n = De.get(t);
44
- n || (n = /* @__PURE__ */ new Map(), De.set(t, n));
37
+ var Ce = null, we = null;
38
+ function Te() {
39
+ return we || (typeof document > "u" ? null : (Ce = document.createElement("canvas"), we = Ce.getContext("2d"), we));
40
+ }
41
+ var Ee = /* @__PURE__ */ new Map();
42
+ function De(e, t) {
43
+ let n = Ee.get(t);
44
+ n || (n = /* @__PURE__ */ new Map(), Ee.set(t, n));
45
45
  let r = n.get(e);
46
46
  if (r !== void 0) return r;
47
- let i = Ee();
48
- return i ? (i.font = t, r = i.measureText(e).width) : r = ke(e, t), n.set(e, r), r;
47
+ let i = Te();
48
+ return i ? (i.font = t, r = i.measureText(e).width) : r = Oe(e, t), n.set(e, r), r;
49
49
  }
50
- function ke(e, t) {
50
+ function Oe(e, t) {
51
51
  let n = parseFloat(t) || 16, r = 0;
52
- for (let t of e) Ae(t.codePointAt(0) ?? 0) ? r += n : t === " " ? r += n * .3 : r += n * .55;
52
+ for (let t of e) ke(t.codePointAt(0) ?? 0) ? r += n : t === " " ? r += n * .3 : r += n * .55;
53
53
  return r;
54
54
  }
55
- function Ae(e) {
55
+ function ke(e) {
56
56
  return e >= 19968 && e <= 40959 || e >= 13312 && e <= 19903 || e >= 131072 && e <= 173791 || e >= 63744 && e <= 64255 || e >= 194560 && e <= 195103 || e >= 12288 && e <= 12351 || e >= 65280 && e <= 65519 || e >= 11904 && e <= 12031 || e >= 12736 && e <= 12783 || e >= 44032 && e <= 55215;
57
57
  }
58
- function je(e) {
58
+ function Ae(e) {
59
59
  return e === 12289 || e === 12290 || e === 65292 || e === 65294 || e === 65306 || e === 65307 || e === 65311 || e === 65281 || e === 65289 || e === 65341 || e === 12301 || e === 12303 || e === 12299 || e === 12305;
60
60
  }
61
- function K(e, t) {
61
+ function je(e, t) {
62
62
  let n = [], r = [];
63
63
  if (typeof Intl < "u" && Intl.Segmenter) try {
64
64
  let t = new Intl.Segmenter("zh", { granularity: "grapheme" });
@@ -69,9 +69,9 @@ function K(e, t) {
69
69
  else r = [...e];
70
70
  for (let e of r) {
71
71
  let r = e.codePointAt(0) ?? 0, i = "latin";
72
- e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" : Ae(r) && (i = je(r) ? "punct" : "cjk"), n.push({
72
+ e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" : ke(r) && (i = Ae(r) ? "punct" : "cjk"), n.push({
73
73
  text: e,
74
- width: Oe(e, t),
74
+ width: De(e, t),
75
75
  type: i
76
76
  });
77
77
  }
@@ -89,7 +89,7 @@ function q(e, t, n, r) {
89
89
  };
90
90
  }
91
91
  function Ne(e, t, n = "16px system-ui") {
92
- let { maxWidth: r, lineHeight: i, maxLines: a, overflowWrap: o = "break-word" } = t, s = K(e, n), c = [], l = {
92
+ let { maxWidth: r, lineHeight: i, maxLines: a, overflowWrap: o = "break-word" } = t, s = je(e, n), c = [], l = {
93
93
  lineStart: 0,
94
94
  lineWidth: 0,
95
95
  lastBreakIdx: -1,
@@ -131,19 +131,19 @@ function Ne(e, t, n = "16px system-ui") {
131
131
  //#endregion
132
132
  //#region ../toast/dist/index.mjs
133
133
  var Pe = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, Fe = "13.5px -apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"PingFang SC\", \"Microsoft YaHei\", system-ui, sans-serif";
134
- function J() {
134
+ function Ie() {
135
135
  if (typeof window > "u") return 290;
136
136
  let e = window.innerWidth;
137
137
  return e <= 480 ? Math.max(140, e - 98) : 290;
138
138
  }
139
- var Ie = {
139
+ var Le = {
140
140
  info: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"/></svg>",
141
141
  success: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M9 12l2 2 4-4\"/></svg>",
142
142
  warning: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"/><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/></svg>",
143
143
  error: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"15\" y1=\"9\" x2=\"9\" y2=\"15\"/><line x1=\"9\" y1=\"9\" x2=\"15\" y2=\"15\"/></svg>"
144
- }, Le = 1;
144
+ }, J = 1;
145
145
  function Re() {
146
- return `qt${Le++}${Date.now().toString(36)}`;
146
+ return `qt${J++}${Date.now().toString(36)}`;
147
147
  }
148
148
  function Y(e, t, n) {
149
149
  let r = document.createElement(e);
@@ -278,9 +278,9 @@ var Ue = class {
278
278
  let s = Y("div", `qt-toast qt-${n}${i == null ? "" : " qt-truncate"}${a || o ? " qt-rich" : ""}`);
279
279
  s.setAttribute("data-qt-id", e);
280
280
  let c = Y("span", "qt-icon");
281
- c.innerHTML = Ie[n], s.appendChild(c);
281
+ c.innerHTML = Le[n], s.appendChild(c);
282
282
  let l = Y("div", "qt-body"), u = Y("span", "qt-msg"), d = Ne(t, {
283
- maxWidth: J(),
283
+ maxWidth: Ie(),
284
284
  lineHeight: 1,
285
285
  maxLines: i
286
286
  }, Fe);
@@ -1201,9 +1201,9 @@ function vt(e, t) {
1201
1201
  }), c;
1202
1202
  }
1203
1203
  function yt(e, t) {
1204
- if (t.matches.length === 0) return se.empty;
1204
+ if (t.matches.length === 0) return z.empty;
1205
1205
  let n = t.matches.map((e, n) => oe.inline(e.from, e.to, { class: n === t.currentIndex ? "search-highlight search-highlight--active" : "search-highlight" }));
1206
- return se.create(e, n);
1206
+ return z.create(e, n);
1207
1207
  }
1208
1208
  function bt(e, t) {
1209
1209
  if (t.currentIndex < 0 || t.currentIndex >= t.matches.length) return;
@@ -1258,7 +1258,7 @@ var xt = F.create({
1258
1258
  },
1259
1259
  props: { decorations(e) {
1260
1260
  let t = Z.getState(e);
1261
- return t ? yt(e.doc, t) : se.empty;
1261
+ return t ? yt(e.doc, t) : z.empty;
1262
1262
  } }
1263
1263
  })];
1264
1264
  },
@@ -2809,61 +2809,61 @@ function kn(e, t, n) {
2809
2809
  });
2810
2810
  }
2811
2811
  function An({ node: e, deleteNode: r, selected: i, editor: a }) {
2812
- let o = a?.isEditable ?? !0, s = e.attrs.src || "", [c, l] = w(() => vn.has(s)), [u, f] = w(null), [p, m] = w(null), [h, g] = w(!1), [v, x] = w(null), [T, O] = w(!1), [k, A] = w(null), ee = C(null), j = C(null), M = C(null), P = C(0), te = C(!1), ne = C(null), re = C(0), [F, ie] = w(!1), ae = C(null), [I, L] = w(0), [R, oe] = w("none"), [se, ce] = w(void 0), [le, ue] = w(!1), z = e.attrs.src || "", B = e.attrs.name || z && z.split("/").pop()?.split("?")[0] || (z ? "attachment" : d("editor.attachment.lost")), de = e.attrs.size || 0, V = wn(B), H = !z;
2812
+ let o = a?.isEditable ?? !0, s = e.attrs.src || "", [c, l] = w(() => vn.has(s)), [u, f] = w(null), [p, m] = w(null), [h, g] = w(!1), [v, x] = w(null), [T, O] = w(!1), [k, A] = w(null), ee = C(null), j = C(null), M = C(null), P = C(0), te = C(!1), ne = C(null), re = C(0), [F, ie] = w(!1), ae = C(null), [I, L] = w(0), [R, oe] = w("none"), [z, se] = w(void 0), [ce, le] = w(!1), B = e.attrs.src || "", V = e.attrs.name || B && B.split("/").pop()?.split("?")[0] || (B ? "attachment" : d("editor.attachment.lost")), ue = e.attrs.size || 0, H = wn(V), U = !B;
2813
2813
  b(() => {
2814
2814
  if (!c) {
2815
- ce(void 0), ue(!1);
2815
+ se(void 0), le(!1);
2816
2816
  return;
2817
2817
  }
2818
- let e = bn[V];
2818
+ let e = bn[H];
2819
2819
  if (!e) {
2820
- ce(void 0), ue(!1);
2820
+ se(void 0), le(!1);
2821
2821
  return;
2822
2822
  }
2823
2823
  let t = !0;
2824
- return ce(void 0), ue(!1), xn[e]().then((e) => {
2825
- t && ce(e);
2824
+ return se(void 0), le(!1), xn[e]().then((e) => {
2825
+ t && se(e);
2826
2826
  }).catch((n) => {
2827
- console.error(`[attachment] renderer "${e}" load failed:`, n), t && ue(!0);
2827
+ console.error(`[attachment] renderer "${e}" load failed:`, n), t && le(!0);
2828
2828
  }), () => {
2829
2829
  t = !1;
2830
2830
  };
2831
- }, [c, V]);
2832
- let fe = S(() => ({
2831
+ }, [c, H]);
2832
+ let de = S(() => ({
2833
2833
  ...yn,
2834
- renderers: se ? [se] : [],
2834
+ renderers: z ? [z] : [],
2835
2835
  rendererMode: "replace"
2836
- }), [se]), pe = y((e) => {
2836
+ }), [z]), fe = y((e) => {
2837
2837
  l((t) => {
2838
2838
  let n = typeof e == "function" ? e(t) : e;
2839
- return z && (n ? vn.add(z) : vn.delete(z)), n;
2839
+ return B && (n ? vn.add(B) : vn.delete(B)), n;
2840
2840
  });
2841
- }, [z]);
2841
+ }, [B]);
2842
2842
  b(() => {
2843
- l(z ? vn.has(z) : !1);
2844
- }, [z]);
2845
- let U = y(() => {
2846
- te.current = !0, pe(!0), window.setTimeout(() => {
2847
- window.scrollTo(0, P.current), ne.current && (ne.current.scrollTop = re.current), te.current && pe(!0), te.current = !1;
2843
+ l(B ? vn.has(B) : !1);
2844
+ }, [B]);
2845
+ let W = y(() => {
2846
+ te.current = !0, fe(!0), window.setTimeout(() => {
2847
+ window.scrollTo(0, P.current), ne.current && (ne.current.scrollTop = re.current), te.current && fe(!0), te.current = !1;
2848
2848
  }, 0);
2849
- }, [pe]), me = y(async () => {
2850
- R === "web" ? (oe("none"), document.body.style.overflow = "", U()) : (R === "native" && document.fullscreenElement && await document.exitFullscreen(), P.current = window.scrollY, re.current = ne.current?.scrollTop ?? 0, document.body.style.overflow = "hidden", oe("web"));
2851
- }, [R]), W = y(async () => {
2849
+ }, [fe]), pe = y(async () => {
2850
+ R === "web" ? (oe("none"), document.body.style.overflow = "", W()) : (R === "native" && document.fullscreenElement && await document.exitFullscreen(), P.current = window.scrollY, re.current = ne.current?.scrollTop ?? 0, document.body.style.overflow = "hidden", oe("web"));
2851
+ }, [R]), G = y(async () => {
2852
2852
  let e = j.current;
2853
2853
  e && (R === "native" ? await document.exitFullscreen() : (R === "web" && (oe("none"), document.body.style.overflow = ""), P.current = window.scrollY, re.current = ne.current?.scrollTop ?? 0, await e.requestFullscreen(), oe("native")));
2854
- }, [R, U]), he = y(() => {
2855
- R === "none" && (te.current || pe((e) => !e));
2854
+ }, [R, W]), me = y(() => {
2855
+ R === "none" && (te.current || fe((e) => !e));
2856
2856
  }, [R]);
2857
2857
  b(() => {
2858
2858
  let e = () => {
2859
- document.fullscreenElement || (R === "native" && oe("none"), U());
2859
+ document.fullscreenElement || (R === "native" && oe("none"), W());
2860
2860
  }, t = (e) => {
2861
- e.key === "Escape" && R === "web" && (oe("none"), document.body.style.overflow = "", U());
2861
+ e.key === "Escape" && R === "web" && (oe("none"), document.body.style.overflow = "", W());
2862
2862
  };
2863
2863
  return document.addEventListener("fullscreenchange", e), window.addEventListener("keydown", t), () => {
2864
2864
  document.removeEventListener("fullscreenchange", e), window.removeEventListener("keydown", t);
2865
2865
  };
2866
- }, [R, U]), b(() => {
2866
+ }, [R, W]), b(() => {
2867
2867
  let e = (e) => {
2868
2868
  if (!(e.key !== "Backspace" && e.key !== "Delete") && o && i && !ln()) {
2869
2869
  if (e.preventDefault(), e.stopPropagation(), a) {
@@ -2882,29 +2882,29 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
2882
2882
  a,
2883
2883
  o
2884
2884
  ]), b(() => {
2885
- if (!c || !En(z)) {
2885
+ if (!c || !En(B)) {
2886
2886
  f(null), x(null), M.current = null;
2887
2887
  return;
2888
2888
  }
2889
- if (M.current === z) return;
2889
+ if (M.current === B) return;
2890
2890
  let e = new AbortController(), r = !0;
2891
2891
  return g(!0), x(null), (async () => {
2892
- let i = z.includes("?X-Amz-"), a = null, o = null;
2893
- if (!a && !i && (a = await On(z, e.signal)), !a && !i) try {
2894
- let n = await t(z);
2892
+ let i = B.includes("?X-Amz-"), a = null, o = null;
2893
+ if (!a && !i && (a = await On(B, e.signal)), !a && !i) try {
2894
+ let n = await t(B);
2895
2895
  n && (a = await On(n, e.signal) || await kn(n, void 0, e.signal));
2896
2896
  } catch (e) {
2897
2897
  console.warn("[attachment] signPreviewUrl failed:", e);
2898
2898
  }
2899
2899
  if (!a && !i) try {
2900
- let t = await n(z);
2900
+ let t = await n(B);
2901
2901
  if (t) {
2902
2902
  let n = { "X-Requested-With": "XMLHttpRequest" };
2903
2903
  t.forEach((e, t) => {
2904
2904
  n[t] = e;
2905
2905
  });
2906
2906
  try {
2907
- a = await kn(z, n, e.signal);
2907
+ a = await kn(B, n, e.signal);
2908
2908
  } catch (e) {
2909
2909
  console.warn("[attachment] signed headers XHR failed:", e), o = e instanceof Error ? e : Error(String(e));
2910
2910
  }
@@ -2913,18 +2913,18 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
2913
2913
  console.warn("[attachment] signPreviewUrlHeaders failed:", e);
2914
2914
  }
2915
2915
  if (!a) try {
2916
- a = await kn(z, i ? void 0 : { "X-Requested-With": "XMLHttpRequest" }, e.signal);
2916
+ a = await kn(B, i ? void 0 : { "X-Requested-With": "XMLHttpRequest" }, e.signal);
2917
2917
  } catch (e) {
2918
2918
  console.warn("[attachment] plain XHR failed:", e), o = e instanceof Error ? e : Error(String(e));
2919
2919
  }
2920
2920
  if (!a) throw o || /* @__PURE__ */ Error("所有 fetch 方法均失败");
2921
2921
  if (!r) return;
2922
- f(a), M.current = z;
2922
+ f(a), M.current = B;
2923
2923
  let s = URL.createObjectURL(new Blob([a], { type: "application/octet-stream" }));
2924
2924
  m(s), g(!1);
2925
2925
  })().catch((e) => {
2926
2926
  if (r && !(e instanceof DOMException && e.name === "AbortError")) {
2927
- if (M.current === z) {
2927
+ if (M.current === B) {
2928
2928
  g(!1);
2929
2929
  return;
2930
2930
  }
@@ -2933,46 +2933,46 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
2933
2933
  }), () => {
2934
2934
  r = !1, e.abort();
2935
2935
  };
2936
- }, [c, z]), b(() => () => {
2936
+ }, [c, B]), b(() => () => {
2937
2937
  p && URL.revokeObjectURL(p), f(null);
2938
2938
  }, []), b(() => () => {
2939
2939
  p && URL.revokeObjectURL(p), m(null), f(null), M.current = null;
2940
- }, [z]), b(() => {
2940
+ }, [B]), b(() => {
2941
2941
  if (k !== "success" && k !== "error") return;
2942
2942
  let e = window.setTimeout(() => A(null), 2400);
2943
2943
  return () => window.clearTimeout(e);
2944
2944
  }, [k]);
2945
- let G = y(async () => {
2945
+ let K = y(async () => {
2946
2946
  O(!0), A("loading");
2947
2947
  try {
2948
2948
  if (p) {
2949
2949
  let e = document.createElement("a");
2950
- e.href = p, e.download = B, document.body.appendChild(e), e.click(), document.body.removeChild(e), A("success");
2950
+ e.href = p, e.download = V, document.body.appendChild(e), e.click(), document.body.removeChild(e), A("success");
2951
2951
  return;
2952
2952
  }
2953
- let e = z.includes("?X-Amz-"), r = null;
2953
+ let e = B.includes("?X-Amz-"), r = null;
2954
2954
  if (!e) try {
2955
- let e = await t(z);
2955
+ let e = await t(B);
2956
2956
  e && (r = await fetch(e, { headers: { "X-Requested-With": "XMLHttpRequest" } }), r.ok || (r = null));
2957
2957
  } catch {}
2958
2958
  if (!r && !e) try {
2959
- let e = await n(z);
2960
- e && (r = await fetch(z, { headers: (() => {
2959
+ let e = await n(B);
2960
+ e && (r = await fetch(B, { headers: (() => {
2961
2961
  let t = new Headers(e);
2962
2962
  return t.set("X-Requested-With", "XMLHttpRequest"), t;
2963
2963
  })() }), r.ok || (r = null));
2964
2964
  } catch {}
2965
- if (r ||= await fetch(z, { headers: { "X-Requested-With": "XMLHttpRequest" } }), !r || !r.ok) throw Error("下载失败");
2965
+ if (r ||= await fetch(B, { headers: { "X-Requested-With": "XMLHttpRequest" } }), !r || !r.ok) throw Error("下载失败");
2966
2966
  let i = await r.blob(), a = URL.createObjectURL(i), o = document.createElement("a");
2967
- o.href = a, o.download = B, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(a), A("success");
2967
+ o.href = a, o.download = V, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(a), A("success");
2968
2968
  } catch (e) {
2969
2969
  console.error("[attachment] download failed:", e), A("error");
2970
2970
  } finally {
2971
2971
  O(!1);
2972
2972
  }
2973
2973
  }, [
2974
- z,
2975
2974
  B,
2975
+ V,
2976
2976
  p
2977
2977
  ]);
2978
2978
  return /* @__PURE__ */ D(N, {
@@ -2992,7 +2992,7 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
2992
2992
  className: "att-info",
2993
2993
  children: [/* @__PURE__ */ E("span", {
2994
2994
  className: "att-icon",
2995
- children: H ? /* @__PURE__ */ D("svg", {
2995
+ children: U ? /* @__PURE__ */ D("svg", {
2996
2996
  width: "22",
2997
2997
  height: "22",
2998
2998
  viewBox: "0 0 24 24",
@@ -3008,15 +3008,15 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
3008
3008
  /* @__PURE__ */ E("path", { d: "M12 9v4" }),
3009
3009
  /* @__PURE__ */ E("path", { d: "M12 17h.01" })
3010
3010
  ]
3011
- }) : Cn(B)
3011
+ }) : Cn(V)
3012
3012
  }), /* @__PURE__ */ D("div", {
3013
3013
  className: "att-meta",
3014
3014
  children: [/* @__PURE__ */ E("span", {
3015
3015
  className: "att-name",
3016
- children: B
3017
- }), de > 0 && /* @__PURE__ */ E("span", {
3016
+ children: V
3017
+ }), ue > 0 && /* @__PURE__ */ E("span", {
3018
3018
  className: "att-size",
3019
- children: Sn(de)
3019
+ children: Sn(ue)
3020
3020
  })]
3021
3021
  })]
3022
3022
  }), /* @__PURE__ */ D("div", {
@@ -3069,11 +3069,11 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
3069
3069
  }), /* @__PURE__ */ D("div", {
3070
3070
  className: "att-actions",
3071
3071
  children: [
3072
- z && Tn(B) && /* @__PURE__ */ E("button", {
3072
+ B && Tn(V) && /* @__PURE__ */ E("button", {
3073
3073
  type: "button",
3074
3074
  className: "att-btn",
3075
3075
  onMouseDown: (e) => {
3076
- e.preventDefault(), e.stopPropagation(), he();
3076
+ e.preventDefault(), e.stopPropagation(), me();
3077
3077
  },
3078
3078
  title: d("editor.attachment.preview"),
3079
3079
  "aria-label": d("editor.attachment.preview"),
@@ -3099,8 +3099,8 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
3099
3099
  /* @__PURE__ */ E("button", {
3100
3100
  type: "button",
3101
3101
  className: "att-btn",
3102
- onClick: G,
3103
- disabled: T || H,
3102
+ onClick: K,
3103
+ disabled: T || U,
3104
3104
  title: T ? "正在准备下载" : d("editor.attachment.download"),
3105
3105
  "aria-label": T ? "正在准备下载" : d("editor.attachment.download"),
3106
3106
  children: /* @__PURE__ */ E("svg", {
@@ -3163,7 +3163,7 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
3163
3163
  children: h && !u && !p ? /* @__PURE__ */ E("div", {
3164
3164
  className: "flex items-center justify-center h-full text-default-400 text-sm",
3165
3165
  children: d("editor.attachment.loadingPreview")
3166
- }) : (v || le) && !u && !p ? /* @__PURE__ */ D("div", {
3166
+ }) : (v || ce) && !u && !p ? /* @__PURE__ */ D("div", {
3167
3167
  className: "flex h-full flex-col items-center justify-center gap-2 p-6 text-center text-sm text-default-500",
3168
3168
  children: [/* @__PURE__ */ E("div", {
3169
3169
  className: "font-medium text-default-700",
@@ -3178,15 +3178,15 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
3178
3178
  style: { background: "#fff" },
3179
3179
  children: d("editor.attachment.loadingPreview")
3180
3180
  }),
3181
- children: u || p || z ? se ? /* @__PURE__ */ E(_n, {
3181
+ children: u || p || B ? z ? /* @__PURE__ */ E(_n, {
3182
3182
  buffer: u || void 0,
3183
- url: p || z,
3184
- name: B,
3185
- filename: B,
3186
- type: V,
3187
- size: de || u?.byteLength || 0,
3188
- options: fe
3189
- }, `${z}-${I}`) : /* @__PURE__ */ E("div", {
3183
+ url: p || B,
3184
+ name: V,
3185
+ filename: V,
3186
+ type: H,
3187
+ size: ue || u?.byteLength || 0,
3188
+ options: de
3189
+ }, `${B}-${I}`) : /* @__PURE__ */ E("div", {
3190
3190
  className: "flex h-full items-center justify-center text-sm text-default-400",
3191
3191
  children: "正在加载预览引擎..."
3192
3192
  }) : /* @__PURE__ */ E("div", {
@@ -3213,7 +3213,7 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
3213
3213
  },
3214
3214
  children: [/* @__PURE__ */ E("button", {
3215
3215
  type: "button",
3216
- onClick: me,
3216
+ onClick: pe,
3217
3217
  title: R === "web" ? "退出网页全屏" : "网页全屏",
3218
3218
  "aria-label": R === "web" ? "退出网页全屏" : "网页全屏",
3219
3219
  style: {
@@ -3251,7 +3251,7 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
3251
3251
  })
3252
3252
  }), /* @__PURE__ */ E("button", {
3253
3253
  type: "button",
3254
- onClick: W,
3254
+ onClick: G,
3255
3255
  title: R === "native" ? "退出全屏" : "全屏",
3256
3256
  "aria-label": R === "native" ? "退出全屏" : "全屏",
3257
3257
  style: {
@@ -3293,7 +3293,7 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
3293
3293
  }), /* @__PURE__ */ E(mn, {
3294
3294
  open: F,
3295
3295
  title: "确认删除附件",
3296
- message: H ? "此操作将删除该附件节点,不可撤销。" : `此操作将同时删除对象存储中的文件(${B}),不可撤销。`,
3296
+ message: U ? "此操作将删除该附件节点,不可撤销。" : `此操作将同时删除对象存储中的文件(${V}),不可撤销。`,
3297
3297
  onCancel: () => {
3298
3298
  $(!1), ie(!1);
3299
3299
  },
@@ -3307,7 +3307,7 @@ function An({ node: e, deleteNode: r, selected: i, editor: a }) {
3307
3307
  from: t,
3308
3308
  to: n
3309
3309
  }).deleteSelection().run();
3310
- } else await Lt(z), $(!1), await new Promise((e) => setTimeout(e, 300)), r();
3310
+ } else await Lt(B), $(!1), await new Promise((e) => setTimeout(e, 300)), r();
3311
3311
  } catch {
3312
3312
  $(!1);
3313
3313
  }
@@ -4308,9 +4308,9 @@ function qn(e) {
4308
4308
  return e instanceof Element && !!e.closest(".cb-code-area");
4309
4309
  }
4310
4310
  function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i, selected: a }) {
4311
- let o = n?.isEditable ?? !0, s = !o, [c, l] = w(!1), [u, d] = w(!1), [p, m] = w(!1), [h, g] = w(""), [_, v] = w(!1), [O, k] = w(null), [A, ee] = w(null), [j, P] = w(!1), [te, ne] = w([]), re = C(null), F = C(null), ie = C(null), ae = C(null), I = C(null), L = e.attrs.language || "", R = Wn.find((e) => e.value === (Kn[L] ?? L)), oe = L === "mermaid", se = y((e) => {
4311
+ let o = n?.isEditable ?? !0, s = !o, [c, l] = w(!1), [u, d] = w(!1), [p, m] = w(!1), [h, g] = w(""), [_, v] = w(!1), [O, k] = w(null), [A, ee] = w(null), [j, P] = w(!1), [te, ne] = w([]), re = C(null), F = C(null), ie = C(null), ae = C(null), I = C(null), L = e.attrs.language || "", R = Wn.find((e) => e.value === (Kn[L] ?? L)), oe = L === "mermaid", z = y((e) => {
4312
4312
  qn(e.target) || e.stopPropagation();
4313
- }, []), ce = y(() => {
4313
+ }, []), se = y(() => {
4314
4314
  if (!n || typeof r != "function") return null;
4315
4315
  let t = r();
4316
4316
  return typeof t == "number" ? {
@@ -4321,9 +4321,9 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4321
4321
  n,
4322
4322
  r,
4323
4323
  e.nodeSize
4324
- ]), le = y(() => {
4325
- o && (ln() || (I.current = ce(), window.getSelection()?.removeAllRanges(), $(!0), v(!0)));
4326
- }, [ce, o]), ue = S(() => e.textContent ? e.textContent.split("\n") : [""], [e.textContent]), z = ue.length, B = S(() => Array.from({ length: z }, (e, t) => t + 1), [z]), de = S(() => {
4324
+ ]), ce = y(() => {
4325
+ o && (ln() || (I.current = se(), window.getSelection()?.removeAllRanges(), $(!0), v(!0)));
4326
+ }, [se, o]), le = S(() => e.textContent ? e.textContent.split("\n") : [""], [e.textContent]), B = le.length, V = S(() => Array.from({ length: B }, (e, t) => t + 1), [B]), ue = S(() => {
4327
4327
  let e = h.trim().toLowerCase();
4328
4328
  return e ? Wn.filter((t) => t.label.toLowerCase().includes(e) || t.value.toLowerCase().includes(e)) : Wn;
4329
4329
  }, [h]);
@@ -4360,29 +4360,29 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4360
4360
  n,
4361
4361
  o
4362
4362
  ]);
4363
- let V = y((e) => {
4363
+ let H = y((e) => {
4364
4364
  ne((t) => t.length === e.length && t.every((t, n) => t === e[n]) ? t : e);
4365
- }, []), H = y(() => {
4365
+ }, []), U = y(() => {
4366
4366
  let e = ie.current, t = ae.current;
4367
4367
  if (!e || !t) return;
4368
4368
  t.style.width = `${e.clientWidth}px`;
4369
4369
  let n = t.children, r = Array(n.length);
4370
4370
  for (let e = 0; e < n.length; e++) r[e] = n[e].offsetHeight;
4371
- V(r);
4372
- }, [V]);
4371
+ H(r);
4372
+ }, [H]);
4373
4373
  x(() => {
4374
- H();
4375
- }, [H, ue]), b(() => {
4374
+ U();
4375
+ }, [U, le]), b(() => {
4376
4376
  let e = ie.current;
4377
4377
  if (!e) return;
4378
- let t = new ResizeObserver(() => H());
4379
- return t.observe(e), window.addEventListener("resize", H), document.fonts?.ready?.then(() => H()), () => {
4380
- t.disconnect(), window.removeEventListener("resize", H);
4378
+ let t = new ResizeObserver(() => U());
4379
+ return t.observe(e), window.addEventListener("resize", U), document.fonts?.ready?.then(() => U()), () => {
4380
+ t.disconnect(), window.removeEventListener("resize", U);
4381
4381
  };
4382
- }, [H]);
4383
- let fe = y((e) => {
4382
+ }, [U]);
4383
+ let de = y((e) => {
4384
4384
  t({ language: e || null }), m(!1);
4385
- }, [t]), pe = y(() => {
4385
+ }, [t]), fe = y(() => {
4386
4386
  if (o) {
4387
4387
  if (n && r) {
4388
4388
  let e = r();
@@ -4394,12 +4394,12 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4394
4394
  n,
4395
4395
  r,
4396
4396
  o
4397
- ]), U = y(() => {
4397
+ ]), W = y(() => {
4398
4398
  navigator.clipboard.writeText(e.textContent), l(!0), setTimeout(() => l(!1), 1500);
4399
- }, [e.textContent]), me = y(() => {
4399
+ }, [e.textContent]), pe = y(() => {
4400
4400
  let t = Gn[L] || "txt", n = t ? `code.${t}` : "code.txt", r = new Blob([e.textContent], { type: "text/plain;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
4401
4401
  a.href = i, a.download = n, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
4402
- }, [e.textContent, L]), W = y(async () => {
4402
+ }, [e.textContent, L]), G = y(async () => {
4403
4403
  if (O || j) {
4404
4404
  k(null), ee(null), P(!1);
4405
4405
  return;
@@ -4422,7 +4422,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4422
4422
  e.textContent,
4423
4423
  O,
4424
4424
  j
4425
- ]), he = /* @__PURE__ */ D(T, { children: [R ? R.deviconClass ? /* @__PURE__ */ E("i", {
4425
+ ]), me = /* @__PURE__ */ D(T, { children: [R ? R.deviconClass ? /* @__PURE__ */ E("i", {
4426
4426
  className: `${R.deviconClass} colored cb-lang-icon`,
4427
4427
  style: { color: R.color }
4428
4428
  }) : /* @__PURE__ */ E("span", {
@@ -4438,8 +4438,8 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4438
4438
  return /* @__PURE__ */ D(N, {
4439
4439
  as: "div",
4440
4440
  className: "code-block-node-view group/cb",
4441
- onMouseDown: se,
4442
- onTouchStart: se,
4441
+ onMouseDown: z,
4442
+ onTouchStart: z,
4443
4443
  children: [
4444
4444
  /* @__PURE__ */ D("div", {
4445
4445
  className: "cb-header",
@@ -4450,12 +4450,12 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4450
4450
  contentEditable: !1,
4451
4451
  children: [s ? /* @__PURE__ */ E("span", {
4452
4452
  className: "cb-lang-trigger cb-lang-trigger--static",
4453
- children: he
4453
+ children: me
4454
4454
  }) : /* @__PURE__ */ D("button", {
4455
4455
  type: "button",
4456
4456
  className: "cb-lang-trigger",
4457
4457
  onClick: () => m(!p),
4458
- children: [he, /* @__PURE__ */ E("svg", {
4458
+ children: [me, /* @__PURE__ */ E("svg", {
4459
4459
  className: `cb-lang-chevron${p ? " cb-lang-chevron--open" : ""}`,
4460
4460
  width: "10",
4461
4461
  height: "10",
@@ -4501,16 +4501,16 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4501
4501
  /* @__PURE__ */ D("button", {
4502
4502
  type: "button",
4503
4503
  className: `cb-lang-option${L ? "" : " cb-lang-option--active"}`,
4504
- onClick: () => fe(""),
4504
+ onClick: () => de(""),
4505
4505
  children: [/* @__PURE__ */ E("span", {
4506
4506
  className: "cb-lang-icon cb-lang-icon--auto",
4507
4507
  children: "?"
4508
4508
  }), /* @__PURE__ */ E("span", { children: "自动检测" })]
4509
4509
  }),
4510
- de.map((e) => /* @__PURE__ */ D("button", {
4510
+ ue.map((e) => /* @__PURE__ */ D("button", {
4511
4511
  type: "button",
4512
4512
  className: `cb-lang-option${L === e.value ? " cb-lang-option--active" : ""}`,
4513
- onClick: () => fe(e.value),
4513
+ onClick: () => de(e.value),
4514
4514
  children: [e.deviconClass ? /* @__PURE__ */ E("i", {
4515
4515
  className: `${e.deviconClass} colored cb-lang-icon`,
4516
4516
  style: { color: e.color }
@@ -4519,7 +4519,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4519
4519
  children: "Tx"
4520
4520
  }), /* @__PURE__ */ E("span", { children: e.label })]
4521
4521
  }, e.value)),
4522
- de.length === 0 && /* @__PURE__ */ E("div", {
4522
+ ue.length === 0 && /* @__PURE__ */ E("div", {
4523
4523
  className: "cb-lang-empty",
4524
4524
  children: "无匹配语言"
4525
4525
  })
@@ -4555,7 +4555,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4555
4555
  /* @__PURE__ */ E("button", {
4556
4556
  type: "button",
4557
4557
  className: "cb-btn",
4558
- onClick: U,
4558
+ onClick: W,
4559
4559
  contentEditable: !1,
4560
4560
  title: "复制",
4561
4561
  children: c ? /* @__PURE__ */ E("svg", {
@@ -4585,7 +4585,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4585
4585
  /* @__PURE__ */ E("button", {
4586
4586
  type: "button",
4587
4587
  className: "cb-btn",
4588
- onClick: me,
4588
+ onClick: pe,
4589
4589
  contentEditable: !1,
4590
4590
  title: "下载",
4591
4591
  children: /* @__PURE__ */ E("svg", {
@@ -4604,7 +4604,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4604
4604
  o && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("button", {
4605
4605
  type: "button",
4606
4606
  className: "cb-btn cb-btn--ai",
4607
- onClick: pe,
4607
+ onClick: fe,
4608
4608
  contentEditable: !1,
4609
4609
  title: "写作助手",
4610
4610
  children: /* @__PURE__ */ E("svg", {
@@ -4622,7 +4622,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4622
4622
  }), /* @__PURE__ */ E("button", {
4623
4623
  type: "button",
4624
4624
  className: "cb-btn cb-btn--del",
4625
- onClick: le,
4625
+ onClick: ce,
4626
4626
  contentEditable: !1,
4627
4627
  title: "删除代码块",
4628
4628
  children: /* @__PURE__ */ E("svg", {
@@ -4641,7 +4641,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4641
4641
  oe && /* @__PURE__ */ E("button", {
4642
4642
  type: "button",
4643
4643
  className: "cb-btn cb-btn--diagram",
4644
- onClick: W,
4644
+ onClick: G,
4645
4645
  contentEditable: !1,
4646
4646
  title: O || j ? "取消渲染" : "渲染图表",
4647
4647
  disabled: j,
@@ -4668,7 +4668,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4668
4668
  className: "cb-line-numbers",
4669
4669
  contentEditable: !1,
4670
4670
  "aria-hidden": "true",
4671
- children: B.map((e, t) => /* @__PURE__ */ E("span", {
4671
+ children: V.map((e, t) => /* @__PURE__ */ E("span", {
4672
4672
  className: "cb-line-num",
4673
4673
  style: te[t] ? { height: te[t] } : void 0,
4674
4674
  children: e
@@ -4684,7 +4684,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4684
4684
  className: "cb-code-mirror",
4685
4685
  contentEditable: !1,
4686
4686
  "aria-hidden": "true",
4687
- children: ue.map((e, t) => /* @__PURE__ */ E("span", {
4687
+ children: le.map((e, t) => /* @__PURE__ */ E("span", {
4688
4688
  className: "cb-mirror-line",
4689
4689
  children: e.length ? e : "\xA0"
4690
4690
  }, t))
@@ -4721,7 +4721,7 @@ function Jn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
4721
4721
  },
4722
4722
  onConfirm: async () => {
4723
4723
  if (await new Promise((e) => setTimeout(e, 300)), $(!1), n) {
4724
- let e = I.current ?? ce();
4724
+ let e = I.current ?? se();
4725
4725
  e ? n.chain().focus().setTextSelection(e).deleteSelection().run() : i();
4726
4726
  } else i();
4727
4727
  }
@@ -4832,9 +4832,9 @@ var Yn = [
4832
4832
  value: "mermaid",
4833
4833
  label: "Mermaid"
4834
4834
  }
4835
- ], Xn = xe(be);
4836
- Xn.register({ dockerfile: ye }), Xn.registerAlias("xml", ["vue", "html"]), Xn.registerAlias("javascript", ["react", "jsx"]), Xn.registerAlias("typescript", ["tsx"]);
4837
- var Zn = ve.extend({ addNodeView() {
4835
+ ], Xn = be(ye);
4836
+ Xn.register({ dockerfile: ve }), Xn.registerAlias("xml", ["vue", "html"]), Xn.registerAlias("javascript", ["react", "jsx"]), Xn.registerAlias("typescript", ["tsx"]);
4837
+ var Zn = _e.extend({ addNodeView() {
4838
4838
  return P(Jn);
4839
4839
  } }).configure({ lowlight: Xn });
4840
4840
  //#endregion
@@ -5529,7 +5529,7 @@ function Jr(e) {
5529
5529
  findSuggestionMatch: (e) => {
5530
5530
  let { $position: t } = e;
5531
5531
  for (let e = t.depth; e >= 0; e--) if (t.node(e).type.name === "codeBlock") return null;
5532
- return t.marks().some((e) => e.type.name === "code") ? null : Ce(e);
5532
+ return t.marks().some((e) => e.type.name === "code") ? null : Se(e);
5533
5533
  },
5534
5534
  allow: ({ editor: e, state: t }) => {
5535
5535
  if (!e.isEditable) return !1;
@@ -5603,7 +5603,7 @@ function Jr(e) {
5603
5603
  };
5604
5604
  }
5605
5605
  };
5606
- return [Se({
5606
+ return [xe({
5607
5607
  editor: this.editor,
5608
5608
  ...t
5609
5609
  }), new I({
@@ -5771,7 +5771,7 @@ function Yr(e, t) {
5771
5771
  }
5772
5772
  //#endregion
5773
5773
  //#region src/editor/extensions/index.ts
5774
- var Xr = ce.extend({
5774
+ var Xr = se.extend({
5775
5775
  addNodeView() {
5776
5776
  return P(gn);
5777
5777
  },
@@ -5798,14 +5798,14 @@ var Xr = ce.extend({
5798
5798
  });
5799
5799
  function Zr(e = {}) {
5800
5800
  return [
5801
- z.configure({
5801
+ B.configure({
5802
5802
  codeBlock: !1,
5803
5803
  horizontalRule: !1,
5804
5804
  underline: !1,
5805
5805
  link: !1
5806
5806
  }),
5807
- ue,
5808
- le.configure({
5807
+ le,
5808
+ ce.configure({
5809
5809
  openOnClick: !0,
5810
5810
  HTMLAttributes: {
5811
5811
  rel: "noopener noreferrer",
@@ -5816,24 +5816,24 @@ function Zr(e = {}) {
5816
5816
  inline: !1,
5817
5817
  allowBase64: !0
5818
5818
  }),
5819
- G,
5820
- he.configure({ nested: !0 }),
5821
- V.configure({ multicolor: !0 }),
5822
- ge,
5823
- de,
5824
- B.configure(e.maxLength ? { limit: e.maxLength } : {}),
5825
- H,
5819
+ K,
5820
+ me.configure({ nested: !0 }),
5821
+ H.configure({ multicolor: !0 }),
5822
+ he,
5823
+ ue,
5824
+ V.configure(e.maxLength ? { limit: e.maxLength } : {}),
5825
+ U,
5826
5826
  Zn,
5827
- pe.configure({ resizable: !0 }),
5827
+ fe.configure({ resizable: !0 }),
5828
+ G,
5828
5829
  W,
5829
- U,
5830
- me,
5831
- _e.configure({
5830
+ pe,
5831
+ ge.configure({
5832
5832
  html: !0,
5833
5833
  transformPastedText: !0,
5834
5834
  transformCopiedText: !1
5835
5835
  }),
5836
- fe.configure({ placeholder: e.placeholder || "输入 '/' 打开菜单…" }),
5836
+ de.configure({ placeholder: e.placeholder || "输入 '/' 打开菜单…" }),
5837
5837
  Jr(() => Yr((e) => d(e), {
5838
5838
  maxAttachmentSize: e.maxAttachmentSize,
5839
5839
  maxTotalAttachmentSize: e.maxTotalAttachmentSize
@@ -6316,13 +6316,13 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6316
6316
  children: /* @__PURE__ */ E("div", { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin" })
6317
6317
  })]
6318
6318
  }), bi = ({ initialContent: e = "", onChange: t, placeholder: n, mode: r, readonly: i = !1, maxLength: a, maxAttachmentSize: o, maxTotalAttachmentSize: s, className: c = "", borderless: l = !1, style: f, showToolbar: p = !0, showToc: m = !0, showSearch: h = !0, onEditorReady: g, immediatelyRender: v, onToast: O }) => {
6319
- let k = r === "view" || i, A = S(() => fi(e) ? e : u(e), [e]), [M, N] = w(!1), [P, F] = w({}), [ie, ae] = w("below"), [I, L] = w(50), R = C(null), [oe, se] = w(!1), [ce, le] = w(!1), [ue, z] = w(!1), [B, de] = w(!1), [V, H] = w("none"), [fe, pe] = w({}), [U, me] = w(""), [W, he] = w(null), [G, ge] = w(m), [_e, ve] = w(!1);
6319
+ let k = r === "view" || i, A = S(() => fi(e) ? e : u(e), [e]), [M, N] = w(!1), [P, F] = w({}), [ie, ae] = w("below"), [I, L] = w(50), R = C(null), [oe, z] = w(!1), [se, ce] = w(!1), [le, B] = w(!1), [V, ue] = w(!1), [H, U] = w("none"), [de, fe] = w({}), [W, pe] = w(""), [G, me] = w(null), [K, he] = w(m), [ge, _e] = w(!1);
6320
6320
  b(() => {
6321
- ge(m);
6321
+ he(m);
6322
6322
  }, [m]);
6323
- let [ye, be] = w(!1), [xe, Se] = w(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 80rem)").matches : !0), Ce = C(null), we = C(null), Te = C(null), Ee = C(0), De = C(null), Oe = C(null), ke = C(null), [Ae, je] = w(!1), [K, Me] = w(!1), [q, Ne] = w(!1), Pe = y(() => {
6324
- let e = we.current, t = Te.current;
6325
- e && (K ? (document.body.style.overflow = "", Object.assign(e.style, {
6323
+ let [ve, ye] = w(!1), [be, xe] = w(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 80rem)").matches : !0), [Se, Ce] = w(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 64rem)").matches : !0), we = C(null), Te = C(null), Ee = C(null), De = C(0), Oe = C(null), ke = C(null), Ae = C(null), [je, Me] = w(!1), [q, Ne] = w(!1), [Pe, Fe] = w(!1), Ie = y(() => {
6324
+ let e = Te.current, t = Ee.current;
6325
+ e && (q ? (document.body.style.overflow = "", Object.assign(e.style, {
6326
6326
  position: "",
6327
6327
  top: "",
6328
6328
  left: "",
@@ -6338,9 +6338,9 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6338
6338
  flex: "",
6339
6339
  overflow: "",
6340
6340
  minHeight: ""
6341
- }), Me(!1), requestAnimationFrame(() => {
6342
- window.scrollTo(0, Ee.current);
6343
- })) : (document.fullscreenElement && document.exitFullscreen(), Ee.current = window.scrollY, Object.assign(e.style, {
6341
+ }), Ne(!1), requestAnimationFrame(() => {
6342
+ window.scrollTo(0, De.current);
6343
+ })) : (document.fullscreenElement && document.exitFullscreen(), De.current = window.scrollY, Object.assign(e.style, {
6344
6344
  position: "fixed",
6345
6345
  top: "0",
6346
6346
  left: "0",
@@ -6356,35 +6356,39 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6356
6356
  flex: "1",
6357
6357
  overflow: "auto",
6358
6358
  minHeight: "0"
6359
- }), document.body.style.overflow = "hidden", Me(!0)));
6360
- }, [K]), Fe = y(() => {
6361
- let e = we.current;
6362
- e && (document.fullscreenElement ? document.exitFullscreen() : (K && Pe(), Ee.current = window.scrollY, e.requestFullscreen()));
6363
- }, [K, Pe]);
6359
+ }), document.body.style.overflow = "hidden", Ne(!0)));
6360
+ }, [q]), Le = y(() => {
6361
+ let e = Te.current;
6362
+ e && (document.fullscreenElement ? document.exitFullscreen() : (q && Ie(), De.current = window.scrollY, e.requestFullscreen()));
6363
+ }, [q, Ie]);
6364
6364
  b(() => {
6365
6365
  let e = (e) => {
6366
- e.key === "Escape" && K && Pe();
6366
+ e.key === "Escape" && q && Ie();
6367
6367
  }, t = () => {
6368
- document.fullscreenElement ? Ne(!0) : (Ne(!1), requestAnimationFrame(() => {
6369
- window.scrollTo(0, Ee.current);
6368
+ document.fullscreenElement ? Fe(!0) : (Fe(!1), requestAnimationFrame(() => {
6369
+ window.scrollTo(0, De.current);
6370
6370
  }));
6371
6371
  };
6372
6372
  return window.addEventListener("keydown", e), document.addEventListener("fullscreenchange", t), () => {
6373
6373
  window.removeEventListener("keydown", e), document.removeEventListener("fullscreenchange", t);
6374
6374
  };
6375
- }, [K, Pe]), b(() => {
6375
+ }, [q, Ie]), b(() => {
6376
6376
  if (!h) return;
6377
6377
  let e = (e) => {
6378
6378
  if ((e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F")) {
6379
- if (!we.current) return;
6380
- e.preventDefault(), e.stopPropagation(), be(!0);
6379
+ if (!Te.current) return;
6380
+ e.preventDefault(), e.stopPropagation(), ye(!0);
6381
6381
  }
6382
6382
  };
6383
6383
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
6384
6384
  }, [h]), b(() => {
6385
6385
  if (typeof window > "u" || typeof window.matchMedia != "function") return;
6386
- let e = window.matchMedia("(min-width: 80rem)"), t = (e) => Se(e.matches);
6387
- return Se(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
6386
+ let e = window.matchMedia("(min-width: 80rem)"), t = (e) => xe(e.matches);
6387
+ return xe(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
6388
+ }, []), b(() => {
6389
+ if (typeof window > "u" || typeof window.matchMedia != "function") return;
6390
+ let e = window.matchMedia("(min-width: 64rem)"), t = (e) => Ce(e.matches);
6391
+ return Ce(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
6388
6392
  }, []);
6389
6393
  let J = te({
6390
6394
  extensions: Zr({
@@ -6397,7 +6401,7 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6397
6401
  editable: !k,
6398
6402
  immediatelyRender: v,
6399
6403
  onUpdate: ({ editor: e }) => {
6400
- t && (Ce.current && clearTimeout(Ce.current), Ce.current = setTimeout(() => {
6404
+ t && (we.current && clearTimeout(we.current), we.current = setTimeout(() => {
6401
6405
  t?.(e.getHTML(), e.getJSON());
6402
6406
  }, 300));
6403
6407
  },
@@ -6410,9 +6414,9 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6410
6414
  let r = n.getData("text/plain");
6411
6415
  if (!r || !r.includes("[[")) return !1;
6412
6416
  t.preventDefault();
6413
- let i = Oe.current?.storage?.relativeMedia;
6417
+ let i = ke.current?.storage?.relativeMedia;
6414
6418
  i && (i.clipboardFiles = new Map(Array.from(n.files ?? []).map((e) => [e.name.toLowerCase(), e])), i.pausedUntilPaste = !1);
6415
- let a = Oe.current ? pi(Oe.current, r) : null;
6419
+ let a = ke.current ? pi(ke.current, r) : null;
6416
6420
  if (a) {
6417
6421
  let t = new ee(a, 0, 0);
6418
6422
  e.dispatch(e.state.tr.replaceSelection(t).scrollIntoView());
@@ -6422,7 +6426,7 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6422
6426
  }
6423
6427
  });
6424
6428
  b(() => {
6425
- Oe.current = J, window.__editor = J;
6429
+ ke.current = J, window.__editor = J;
6426
6430
  }, [J]), b(() => {
6427
6431
  if (J) return () => Wt(J);
6428
6432
  }, [J]), b(() => {
@@ -6430,7 +6434,7 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6430
6434
  }, [J, g]), b(() => {
6431
6435
  if (!J) return;
6432
6436
  let e = () => {
6433
- J.state.selection.empty && (H("none"), je(!1));
6437
+ J.state.selection.empty && (U("none"), Me(!1));
6434
6438
  };
6435
6439
  return J.on("selectionUpdate", e), () => {
6436
6440
  J.off("selectionUpdate", e);
@@ -6448,10 +6452,10 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6448
6452
  o,
6449
6453
  s
6450
6454
  ]);
6451
- let Ie = C(e);
6455
+ let Re = C(e);
6452
6456
  b(() => {
6453
- if (!J || e === Ie.current) return;
6454
- Ie.current = e;
6457
+ if (!J || e === Re.current) return;
6458
+ Re.current = e;
6455
6459
  let t = fi(e) ? e : u(e);
6456
6460
  J.commands.setContent(t, { emitUpdate: !1 });
6457
6461
  }, [J, e]), b(() => {
@@ -6474,40 +6478,53 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6474
6478
  o,
6475
6479
  s
6476
6480
  ]);
6477
- let Le = y((e) => {
6478
- let t = ke.current?.getBoundingClientRect();
6479
- H(e), je(!1), pe({
6481
+ let Y = y((e) => {
6482
+ let t = Ae.current?.getBoundingClientRect();
6483
+ U(e), Me(!1), fe({
6480
6484
  position: "fixed",
6481
6485
  top: t ? t.bottom + 8 : void 0,
6482
6486
  left: t ? Math.max(8, Math.min(t.left, window.innerWidth - 240)) : 8,
6483
6487
  zIndex: 9999
6484
6488
  });
6485
- }, []), Re = ti((e) => d(e)), Y = Re.filter((e) => !e.more), ze = Re.filter((e) => e.more), Be = Y.filter((e) => e.key !== "ai"), Ve = Y.find((e) => e.key === "ai"), He = y((e) => {
6486
- if (J) if (je(!1), e.key === "link") if (J.isActive("link")) J.chain().focus().unsetLink().run();
6489
+ }, []), ze = ti((e) => d(e)), Be = ze.filter((e) => !e.more), Ve = ze.filter((e) => e.more), He = Be.filter((e) => e.key !== "ai"), Ue = Be.find((e) => e.key === "ai"), We = y((e) => {
6490
+ if (J) if (Me(!1), e.key === "link") if (J.isActive("link")) J.chain().focus().unsetLink().run();
6487
6491
  else {
6488
6492
  let e = J.getAttributes("link").href || "";
6489
- me(e), Le("link");
6493
+ pe(e), Y("link");
6490
6494
  }
6491
- else e.key === "highlight" ? V === "highlight" ? H("none") : Le("highlight") : e.command(J);
6495
+ else e.key === "highlight" ? H === "highlight" ? U("none") : Y("highlight") : e.command(J);
6492
6496
  }, [
6493
6497
  J,
6494
- V,
6495
- Le
6496
- ]), Ue = y((e) => J ? e.key === "highlight" ? V === "highlight" : e.key === "link" ? J.isActive("link") : e.isActive(J) : !1, [J, V]), [We, Ge] = w(0);
6498
+ H,
6499
+ Y
6500
+ ]), Ge = y((e) => J ? e.key === "highlight" ? H === "highlight" : e.key === "link" ? J.isActive("link") : e.isActive(J) : !1, [J, H]), [Ke, qe] = w(0);
6497
6501
  b(() => {
6498
6502
  if (!J) return;
6499
- let e = () => Ge((e) => (e + 1) % 1e6);
6503
+ let e = () => qe((e) => (e + 1) % 1e6);
6500
6504
  return J.on("update", e), () => {
6501
6505
  J.off("update", e);
6502
6506
  };
6503
6507
  }, [J]);
6504
- let Ke = S(() => J?.storage?.characterCount?.characters?.() ?? 0, [J, We]), qe = a ? Ke > a : !1;
6508
+ let [Je, Ye] = w(!1);
6509
+ b(() => {
6510
+ if (!J) return;
6511
+ let e = () => {
6512
+ let e = !1;
6513
+ J.state.doc.descendants((t) => {
6514
+ t.type.name === "heading" && (e = !0);
6515
+ }), Ye(e);
6516
+ };
6517
+ return e(), J.on("update", e), () => {
6518
+ J.off("update", e);
6519
+ };
6520
+ }, [J]);
6521
+ let Ze = S(() => J?.storage?.characterCount?.characters?.() ?? 0, [J, Ke]), Qe = a ? Ze > a : !1;
6505
6522
  b(() => () => {
6506
- Ce.current && clearTimeout(Ce.current);
6523
+ we.current && clearTimeout(we.current);
6507
6524
  }, []), b(() => () => {
6508
- W && W.resolve(null);
6525
+ G && G.resolve(null);
6509
6526
  }, []);
6510
- let Je = y((e) => {
6527
+ let $e = y((e) => {
6511
6528
  if (!J?.isEditable) return;
6512
6529
  let t = window.getSelection(), n;
6513
6530
  if (e) {
@@ -6532,8 +6549,8 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6532
6549
  width: 0
6533
6550
  };
6534
6551
  }
6535
- De.current = n;
6536
- let r = we.current?.getBoundingClientRect(), i = di(n, void 0, {
6552
+ Oe.current = n;
6553
+ let r = Te.current?.getBoundingClientRect(), i = di(n, void 0, {
6537
6554
  panelWidth: r?.width,
6538
6555
  editorLeft: r?.left
6539
6556
  });
@@ -6542,19 +6559,19 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6542
6559
  b(() => {
6543
6560
  if (!J) return;
6544
6561
  let e = J.storage.qingwuUI;
6545
- if (e) return e.openImageDialog = () => se(!0), e.openVideoDialog = () => le(!0), e.chooseMd = (e, t) => {
6546
- he({
6562
+ if (e) return e.openImageDialog = () => z(!0), e.openVideoDialog = () => ce(!0), e.chooseMd = (e, t) => {
6563
+ me({
6547
6564
  filename: e,
6548
6565
  resolve: t
6549
6566
  });
6550
- }, e.openAI = Je, e.parseMd = (e, t) => J ? pi(J, t) : null, () => {
6567
+ }, e.openAI = $e, e.parseMd = (e, t) => J ? pi(J, t) : null, () => {
6551
6568
  delete e.openImageDialog, delete e.openVideoDialog, delete e.openAI, delete e.parseMd, delete e.chooseMd;
6552
6569
  };
6553
- }, [J, Je]), x(() => {
6570
+ }, [J, $e]), x(() => {
6554
6571
  if (!M || !J) return;
6555
- let e = De.current;
6572
+ let e = Oe.current;
6556
6573
  if (!e) return;
6557
- let t = R.current, n = we.current?.getBoundingClientRect(), r = di(e, t?.offsetHeight || void 0, {
6574
+ let t = R.current, n = Te.current?.getBoundingClientRect(), r = di(e, t?.offsetHeight || void 0, {
6558
6575
  panelWidth: n?.width,
6559
6576
  editorLeft: n?.left
6560
6577
  });
@@ -6562,9 +6579,9 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6562
6579
  }, [M, J]), b(() => {
6563
6580
  if (!M || !J) return;
6564
6581
  let e = () => {
6565
- let e = De.current;
6582
+ let e = Oe.current;
6566
6583
  if (!e) return;
6567
- let t = R.current, n = we.current?.getBoundingClientRect(), r = di(e, t?.offsetHeight || void 0, {
6584
+ let t = R.current, n = Te.current?.getBoundingClientRect(), r = di(e, t?.offsetHeight || void 0, {
6568
6585
  panelWidth: n?.width,
6569
6586
  editorLeft: n?.left
6570
6587
  });
@@ -6572,23 +6589,19 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6572
6589
  };
6573
6590
  return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
6574
6591
  }, [M, J]), b(() => {
6575
- M || (De.current = null);
6592
+ M || (Oe.current = null);
6576
6593
  }, [M]);
6577
- let Ye = y((e) => {
6594
+ let et = y((e) => {
6578
6595
  J?.chain().focus().setImage({ src: e }).run();
6579
- }, [J]), Ze = y((e) => {
6596
+ }, [J]), tt = y((e) => {
6580
6597
  (J?.commands).insertVideo?.({ src: e });
6581
- }, [J]), Qe = G && xe && !K && !q, $e = m && G && !Qe && !_e, et = C(!1);
6598
+ }, [J]), nt = K && be && !q && !Pe, rt = !nt && !ge && (K || Je && !(!k && Se)), it = C(!1);
6582
6599
  return b(() => {
6583
- et.current || (et.current = !0, m && G && !Qe && ve(!0));
6584
- }, [
6585
- m,
6586
- G,
6587
- Qe
6588
- ]), J ? /* @__PURE__ */ D("div", {
6600
+ it.current || (it.current = !0, K && !nt && _e(!0));
6601
+ }, [K, nt]), J ? /* @__PURE__ */ D("div", {
6589
6602
  className: "qingwu-editor-row",
6590
6603
  children: [/* @__PURE__ */ D("div", {
6591
- ref: we,
6604
+ ref: Te,
6592
6605
  className: `qingwu-editor relative flex-1 min-w-0 bg-background ${k ? "qingwu-editor--readonly" : ""} ${l ? "" : "rounded-xl border border-default-200"} ${c}`,
6593
6606
  style: f,
6594
6607
  children: [
@@ -6599,13 +6612,13 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6599
6612
  children: [
6600
6613
  /* @__PURE__ */ E("button", {
6601
6614
  type: "button",
6602
- className: `qed-tb-btn qed-tb-btn--desktop-only${G ? " is-active" : ""}`,
6615
+ className: `qed-tb-btn qed-tb-btn--desktop-only${K ? " is-active" : ""}`,
6603
6616
  onClick: () => {
6604
- G ? (ge(!1), ve(!1)) : (ge(!0), Qe || ve(!0));
6617
+ K ? (he(!1), _e(!1)) : (he(!0), nt || _e(!0));
6605
6618
  },
6606
- title: G ? "隐藏目录" : "显示目录",
6607
- "aria-label": G ? "隐藏目录" : "显示目录",
6608
- "aria-pressed": G,
6619
+ title: K ? "隐藏目录" : "显示目录",
6620
+ "aria-label": K ? "隐藏目录" : "显示目录",
6621
+ "aria-pressed": K,
6609
6622
  children: /* @__PURE__ */ E("svg", {
6610
6623
  fill: "none",
6611
6624
  viewBox: "0 0 24 24",
@@ -6621,11 +6634,11 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6621
6634
  }),
6622
6635
  h && /* @__PURE__ */ E("button", {
6623
6636
  type: "button",
6624
- className: `qed-tb-btn${ye ? " is-active" : ""}`,
6625
- onClick: () => be(!ye),
6637
+ className: `qed-tb-btn${ve ? " is-active" : ""}`,
6638
+ onClick: () => ye(!ve),
6626
6639
  title: "查找 (Ctrl+F)",
6627
6640
  "aria-label": "查找",
6628
- "aria-pressed": ye,
6641
+ "aria-pressed": ve,
6629
6642
  children: /* @__PURE__ */ E("svg", {
6630
6643
  fill: "none",
6631
6644
  viewBox: "0 0 24 24",
@@ -6642,7 +6655,7 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6642
6655
  !k && /* @__PURE__ */ E("button", {
6643
6656
  type: "button",
6644
6657
  className: `qed-tb-btn qed-tb-btn--ai${M ? " is-active" : ""}`,
6645
- onClick: (e) => M ? N(!1) : Je(e.currentTarget),
6658
+ onClick: (e) => M ? N(!1) : $e(e.currentTarget),
6646
6659
  title: d("editor.toolbar.aiTitle"),
6647
6660
  "aria-label": d("editor.toolbar.ai"),
6648
6661
  "aria-pressed": M,
@@ -6670,7 +6683,7 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6670
6683
  /* @__PURE__ */ D("button", {
6671
6684
  type: "button",
6672
6685
  className: "qed-tb-btn qed-tb-btn--solid",
6673
- onClick: () => de(!0),
6686
+ onClick: () => ue(!0),
6674
6687
  title: d("editor.toolbar.exportTitle"),
6675
6688
  children: [/* @__PURE__ */ E("svg", {
6676
6689
  fill: "none",
@@ -6690,11 +6703,11 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6690
6703
  }),
6691
6704
  /* @__PURE__ */ E("button", {
6692
6705
  type: "button",
6693
- className: `qed-tb-btn${K ? " is-active" : ""}`,
6694
- onClick: Pe,
6695
- title: K ? "退出网页全屏" : "网页全屏",
6696
- "aria-label": K ? "退出网页全屏" : "网页全屏",
6697
- "aria-pressed": K,
6706
+ className: `qed-tb-btn${q ? " is-active" : ""}`,
6707
+ onClick: Ie,
6708
+ title: q ? "退出网页全屏" : "网页全屏",
6709
+ "aria-label": q ? "退出网页全屏" : "网页全屏",
6710
+ "aria-pressed": q,
6698
6711
  children: /* @__PURE__ */ E("svg", {
6699
6712
  fill: "none",
6700
6713
  viewBox: "0 0 24 24",
@@ -6710,11 +6723,11 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6710
6723
  }),
6711
6724
  /* @__PURE__ */ E("button", {
6712
6725
  type: "button",
6713
- className: `qed-tb-btn${q ? " is-active" : ""}`,
6714
- onClick: Fe,
6715
- title: q ? "退出全屏" : "全屏",
6716
- "aria-label": q ? "退出全屏" : "全屏",
6717
- "aria-pressed": q,
6726
+ className: `qed-tb-btn${Pe ? " is-active" : ""}`,
6727
+ onClick: Le,
6728
+ title: Pe ? "退出全屏" : "全屏",
6729
+ "aria-label": Pe ? "退出全屏" : "全屏",
6730
+ "aria-pressed": Pe,
6718
6731
  children: /* @__PURE__ */ E("svg", {
6719
6732
  fill: "none",
6720
6733
  viewBox: "0 0 24 24",
@@ -6741,17 +6754,17 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6741
6754
  },
6742
6755
  className: "bubble-menu-pop bg-background border border-default-200 rounded-xl p-1 shadow-lg",
6743
6756
  children: /* @__PURE__ */ D("div", {
6744
- ref: ke,
6757
+ ref: Ae,
6745
6758
  className: "bubble-menu-items relative flex items-center gap-0.5",
6746
6759
  onPointerDown: (e) => {
6747
6760
  e.target.closest("button") && e.preventDefault();
6748
6761
  },
6749
6762
  children: [
6750
- Be.map((e) => /* @__PURE__ */ E("button", {
6763
+ He.map((e) => /* @__PURE__ */ E("button", {
6751
6764
  type: "button",
6752
6765
  className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${e.isActive(J) ? "bg-primary/10 text-primary" : "text-default-600 hover:bg-default-100"}`,
6753
6766
  onClick: (t) => {
6754
- t.preventDefault(), He(e);
6767
+ t.preventDefault(), We(e);
6755
6768
  },
6756
6769
  title: e.label,
6757
6770
  "aria-label": e.label,
@@ -6765,10 +6778,10 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6765
6778
  type: "button",
6766
6779
  className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${M ? "bg-primary/15 text-primary" : "text-primary hover:bg-primary/10"}`,
6767
6780
  onClick: (e) => {
6768
- e.preventDefault(), je(!1), Ve?.command(J);
6781
+ e.preventDefault(), Me(!1), Ue?.command(J);
6769
6782
  },
6770
- title: Ve?.label,
6771
- "aria-label": Ve?.label,
6783
+ title: Ue?.label,
6784
+ "aria-label": Ue?.label,
6772
6785
  children: /* @__PURE__ */ E(Pt, {})
6773
6786
  }),
6774
6787
  /* @__PURE__ */ E("span", {
@@ -6777,27 +6790,27 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6777
6790
  }),
6778
6791
  /* @__PURE__ */ E("button", {
6779
6792
  type: "button",
6780
- "aria-expanded": Ae,
6781
- className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${Ae ? "bg-default-100 text-default-900" : "text-default-600 hover:bg-default-100"}`,
6793
+ "aria-expanded": je,
6794
+ className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${je ? "bg-default-100 text-default-900" : "text-default-600 hover:bg-default-100"}`,
6782
6795
  onClick: (e) => {
6783
- e.preventDefault(), je((e) => !e);
6796
+ e.preventDefault(), Me((e) => !e);
6784
6797
  },
6785
6798
  title: d("editor.bubble.more"),
6786
6799
  "aria-label": d("editor.bubble.more"),
6787
6800
  children: /* @__PURE__ */ E(Ft, {})
6788
6801
  }),
6789
- Ae && /* @__PURE__ */ E("div", {
6802
+ je && /* @__PURE__ */ E("div", {
6790
6803
  role: "menu",
6791
6804
  className: "bubble-more-menu absolute right-0 top-full z-[9999] mt-1 w-max max-h-[70vh] overflow-y-auto flex-col gap-1 rounded-xl border border-default-200 bg-background p-1.5 shadow-xl",
6792
6805
  onPointerDown: (e) => {
6793
6806
  e.target.closest("button") && e.preventDefault();
6794
6807
  },
6795
- children: ze.map((e) => /* @__PURE__ */ D("button", {
6808
+ children: Ve.map((e) => /* @__PURE__ */ D("button", {
6796
6809
  type: "button",
6797
6810
  role: "menuitem",
6798
- className: `flex items-center gap-2 w-full whitespace-nowrap px-3 py-1.5 text-xs rounded-md transition-colors ${Ue(e) ? "bg-primary/10 text-primary" : "text-default-600 hover:bg-default-100"}`,
6811
+ className: `flex items-center gap-2 w-full whitespace-nowrap px-3 py-1.5 text-xs rounded-md transition-colors ${Ge(e) ? "bg-primary/10 text-primary" : "text-default-600 hover:bg-default-100"}`,
6799
6812
  onClick: (t) => {
6800
- t.preventDefault(), He(e);
6813
+ t.preventDefault(), We(e);
6801
6814
  },
6802
6815
  title: e.label,
6803
6816
  children: [/* @__PURE__ */ E("span", {
@@ -6812,14 +6825,14 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6812
6825
  ]
6813
6826
  })
6814
6827
  }),
6815
- J && V !== "none" && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("div", {
6828
+ J && H !== "none" && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("div", {
6816
6829
  className: "fixed inset-0 z-[9998]",
6817
- onClick: () => H("none")
6830
+ onClick: () => U("none")
6818
6831
  }), /* @__PURE__ */ E("div", {
6819
- style: fe,
6832
+ style: de,
6820
6833
  className: "bg-background border border-default-200 rounded-xl shadow-xl",
6821
6834
  onClick: (e) => e.stopPropagation(),
6822
- children: V === "highlight" ? /* @__PURE__ */ D("div", {
6835
+ children: H === "highlight" ? /* @__PURE__ */ D("div", {
6823
6836
  className: "flex items-center gap-1 p-1.5 flex-wrap",
6824
6837
  children: [ci.map((e) => /* @__PURE__ */ E("button", {
6825
6838
  type: "button",
@@ -6827,14 +6840,14 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6827
6840
  style: { background: e.color },
6828
6841
  title: e.name,
6829
6842
  onClick: () => {
6830
- J.chain().focus().setHighlight({ color: e.color }).run(), H("none");
6843
+ J.chain().focus().setHighlight({ color: e.color }).run(), U("none");
6831
6844
  }
6832
6845
  }, e.color)), /* @__PURE__ */ D("button", {
6833
6846
  type: "button",
6834
6847
  className: "w-5 h-5 rounded-full border border-default-200 text-default-500 hover:bg-default-100 flex items-center justify-center text-[10px]",
6835
6848
  title: "清除高亮",
6836
6849
  onClick: () => {
6837
- J.chain().focus().unsetHighlight().run(), H("none");
6850
+ J.chain().focus().unsetHighlight().run(), U("none");
6838
6851
  },
6839
6852
  children: ["✕", " "]
6840
6853
  })]
@@ -6845,16 +6858,16 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6845
6858
  autoFocus: !0,
6846
6859
  className: "flex-1 px-2 py-1 text-xs rounded-md border border-default-200 bg-background focus:outline-none focus:border-primary",
6847
6860
  placeholder: "https://...",
6848
- value: U,
6849
- onChange: (e) => me(e.target.value),
6861
+ value: W,
6862
+ onChange: (e) => pe(e.target.value),
6850
6863
  onKeyDown: (e) => {
6851
- e.key === "Enter" ? (U.trim() && J.chain().focus().setLink({ href: U.trim() }).run(), H("none")) : e.key === "Escape" && H("none");
6864
+ e.key === "Enter" ? (W.trim() && J.chain().focus().setLink({ href: W.trim() }).run(), U("none")) : e.key === "Escape" && U("none");
6852
6865
  }
6853
6866
  }), /* @__PURE__ */ E("button", {
6854
6867
  type: "button",
6855
6868
  className: "px-2 py-1 text-xs rounded-md bg-primary text-white hover:opacity-90",
6856
6869
  onClick: () => {
6857
- U.trim() && J.chain().focus().setLink({ href: U.trim() }).run(), H("none");
6870
+ W.trim() && J.chain().focus().setLink({ href: W.trim() }).run(), U("none");
6858
6871
  },
6859
6872
  children: "确定"
6860
6873
  })]
@@ -6882,55 +6895,55 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6882
6895
  fallback: /* @__PURE__ */ E(yi, {}),
6883
6896
  children: /* @__PURE__ */ E(mi, {
6884
6897
  open: oe,
6885
- onClose: () => se(!1),
6886
- onInsert: Ye,
6898
+ onClose: () => z(!1),
6899
+ onInsert: et,
6887
6900
  validate: (e) => J ? an(J.state.doc, e, {
6888
6901
  maxAttachmentSize: o,
6889
6902
  maxTotalAttachmentSize: s
6890
6903
  }) : null
6891
6904
  })
6892
6905
  }),
6893
- ce && /* @__PURE__ */ E(_, {
6906
+ se && /* @__PURE__ */ E(_, {
6894
6907
  fallback: /* @__PURE__ */ E(yi, {}),
6895
6908
  children: /* @__PURE__ */ E(_i, {
6896
- open: ce,
6897
- onClose: () => le(!1),
6898
- onInsert: Ze
6909
+ open: se,
6910
+ onClose: () => ce(!1),
6911
+ onInsert: tt
6899
6912
  })
6900
6913
  }),
6901
- ue && /* @__PURE__ */ E(_, {
6914
+ le && /* @__PURE__ */ E(_, {
6902
6915
  fallback: /* @__PURE__ */ E(yi, {}),
6903
6916
  children: /* @__PURE__ */ E(hi, {
6904
- open: ue,
6905
- onClose: () => z(!1)
6917
+ open: le,
6918
+ onClose: () => B(!1)
6906
6919
  })
6907
6920
  }),
6908
- B && /* @__PURE__ */ E(_, {
6921
+ V && /* @__PURE__ */ E(_, {
6909
6922
  fallback: /* @__PURE__ */ E(yi, {}),
6910
6923
  children: /* @__PURE__ */ E(gi, {
6911
- open: B,
6912
- onClose: () => de(!1),
6924
+ open: V,
6925
+ onClose: () => ue(!1),
6913
6926
  editor: J
6914
6927
  })
6915
6928
  }),
6916
- W && /* @__PURE__ */ E(_, {
6929
+ G && /* @__PURE__ */ E(_, {
6917
6930
  fallback: /* @__PURE__ */ E(yi, {}),
6918
6931
  children: /* @__PURE__ */ E(vi, {
6919
- open: !!W,
6920
- filename: W.filename,
6932
+ open: !!G,
6933
+ filename: G.filename,
6921
6934
  onRender: () => {
6922
- W.resolve("render"), he(null);
6935
+ G.resolve("render"), me(null);
6923
6936
  },
6924
6937
  onAttach: () => {
6925
- W.resolve("attach"), he(null);
6938
+ G.resolve("attach"), me(null);
6926
6939
  },
6927
6940
  onClose: () => {
6928
- W.resolve(null), he(null);
6941
+ G.resolve(null), me(null);
6929
6942
  }
6930
6943
  })
6931
6944
  }),
6932
6945
  /* @__PURE__ */ E("div", {
6933
- ref: Te,
6946
+ ref: Ee,
6934
6947
  className: "flex editor-body",
6935
6948
  children: /* @__PURE__ */ D("div", {
6936
6949
  className: "relative min-w-0 flex-1",
@@ -6938,11 +6951,11 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6938
6951
  /* @__PURE__ */ E(j, { editor: J }),
6939
6952
  !k && /* @__PURE__ */ E(si, { editor: J }),
6940
6953
  /* @__PURE__ */ E("div", {
6941
- className: `${K || q ? "fixed" : "absolute"} bottom-2 right-4 z-10 pointer-events-none select-none`,
6954
+ className: `${q || Pe ? "fixed" : "absolute"} bottom-2 right-4 z-10 pointer-events-none select-none`,
6942
6955
  children: /* @__PURE__ */ D("span", {
6943
- className: `text-xs ${qe ? "bg-danger/10 text-danger font-medium px-2 py-0.5 rounded" : a && Ke > a * .9 ? "bg-warning/10 text-warning px-2 py-0.5 rounded" : "text-default-300"}`,
6956
+ className: `text-xs ${Qe ? "bg-danger/10 text-danger font-medium px-2 py-0.5 rounded" : a && Ze > a * .9 ? "bg-warning/10 text-warning px-2 py-0.5 rounded" : "text-default-300"}`,
6944
6957
  children: [
6945
- Ke,
6958
+ Ze,
6946
6959
  a ? ` / ${a}` : "",
6947
6960
  " 字"
6948
6961
  ]
@@ -6951,14 +6964,14 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6951
6964
  ]
6952
6965
  })
6953
6966
  }),
6954
- h && ye && /* @__PURE__ */ E(Ct, {
6967
+ h && ve && /* @__PURE__ */ E(Ct, {
6955
6968
  editor: J,
6956
- onClose: () => be(!1)
6969
+ onClose: () => ye(!1)
6957
6970
  }),
6958
- $e && /* @__PURE__ */ E("button", {
6971
+ rt && /* @__PURE__ */ E("button", {
6959
6972
  type: "button",
6960
6973
  className: "qingwu-toc-fab",
6961
- onClick: () => ve(!0),
6974
+ onClick: () => _e(!0),
6962
6975
  title: "目录",
6963
6976
  "aria-label": "打开目录",
6964
6977
  children: /* @__PURE__ */ E("svg", {
@@ -6974,7 +6987,7 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6974
6987
  })
6975
6988
  })
6976
6989
  }),
6977
- m && _e && /* @__PURE__ */ D("div", {
6990
+ ge && /* @__PURE__ */ D("div", {
6978
6991
  className: "qingwu-toc-drawer toc-scroll",
6979
6992
  children: [/* @__PURE__ */ D("div", {
6980
6993
  className: "qed-drawer-head",
@@ -6984,7 +6997,7 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
6984
6997
  }), /* @__PURE__ */ E("button", {
6985
6998
  type: "button",
6986
6999
  className: "qed-drawer-head__close",
6987
- onClick: () => ve(!1),
7000
+ onClick: () => _e(!1),
6988
7001
  "aria-label": "关闭目录",
6989
7002
  children: /* @__PURE__ */ E("svg", {
6990
7003
  fill: "none",
@@ -7003,16 +7016,16 @@ var mi = v(() => Promise.resolve().then(() => Ze).then((e) => ({ default: e.Imag
7003
7016
  editor: J,
7004
7017
  className: "!p-3",
7005
7018
  onClose: () => {
7006
- ve(!1), ge(!1);
7019
+ _e(!1), he(!1);
7007
7020
  }
7008
7021
  })]
7009
7022
  })
7010
7023
  ]
7011
- }), Qe && /* @__PURE__ */ E("aside", {
7024
+ }), nt && /* @__PURE__ */ E("aside", {
7012
7025
  className: "qingwu-toc-desktop toc-scroll",
7013
7026
  children: /* @__PURE__ */ E(ot, {
7014
7027
  editor: J,
7015
- onClose: () => ge(!1)
7028
+ onClose: () => he(!1)
7016
7029
  })
7017
7030
  })]
7018
7031
  }) : /* @__PURE__ */ E("div", {