@qingwu-ui/ai-editor 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +2 -2
- package/README.md +2 -1
- package/dist/assets/katex-fonts/katex-0.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-1.woff +0 -0
- package/dist/assets/katex-fonts/katex-10.woff +0 -0
- package/dist/assets/katex-fonts/katex-11.ttf +0 -0
- package/dist/assets/katex-fonts/katex-12.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-13.woff +0 -0
- package/dist/assets/katex-fonts/katex-14.ttf +0 -0
- package/dist/assets/katex-fonts/katex-15.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-16.woff +0 -0
- package/dist/assets/katex-fonts/katex-17.ttf +0 -0
- package/dist/assets/katex-fonts/katex-18.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-19.woff +0 -0
- package/dist/assets/katex-fonts/katex-2.ttf +0 -0
- package/dist/assets/katex-fonts/katex-20.ttf +0 -0
- package/dist/assets/katex-fonts/katex-21.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-22.woff +0 -0
- package/dist/assets/katex-fonts/katex-23.ttf +0 -0
- package/dist/assets/katex-fonts/katex-24.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-25.woff +0 -0
- package/dist/assets/katex-fonts/katex-26.ttf +0 -0
- package/dist/assets/katex-fonts/katex-27.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-28.woff +0 -0
- package/dist/assets/katex-fonts/katex-29.ttf +0 -0
- package/dist/assets/katex-fonts/katex-3.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-30.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-31.woff +0 -0
- package/dist/assets/katex-fonts/katex-32.ttf +0 -0
- package/dist/assets/katex-fonts/katex-33.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-34.woff +0 -0
- package/dist/assets/katex-fonts/katex-35.ttf +0 -0
- package/dist/assets/katex-fonts/katex-36.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-37.woff +0 -0
- package/dist/assets/katex-fonts/katex-38.ttf +0 -0
- package/dist/assets/katex-fonts/katex-39.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-4.woff +0 -0
- package/dist/assets/katex-fonts/katex-40.woff +0 -0
- package/dist/assets/katex-fonts/katex-41.ttf +0 -0
- package/dist/assets/katex-fonts/katex-42.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-43.woff +0 -0
- package/dist/assets/katex-fonts/katex-44.ttf +0 -0
- package/dist/assets/katex-fonts/katex-45.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-46.woff +0 -0
- package/dist/assets/katex-fonts/katex-47.ttf +0 -0
- package/dist/assets/katex-fonts/katex-48.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-49.woff +0 -0
- package/dist/assets/katex-fonts/katex-5.ttf +0 -0
- package/dist/assets/katex-fonts/katex-50.ttf +0 -0
- package/dist/assets/katex-fonts/katex-51.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-52.woff +0 -0
- package/dist/assets/katex-fonts/katex-53.ttf +0 -0
- package/dist/assets/katex-fonts/katex-54.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-55.woff +0 -0
- package/dist/assets/katex-fonts/katex-56.ttf +0 -0
- package/dist/assets/katex-fonts/katex-57.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-58.woff +0 -0
- package/dist/assets/katex-fonts/katex-59.ttf +0 -0
- package/dist/assets/katex-fonts/katex-6.woff2 +0 -0
- package/dist/assets/katex-fonts/katex-7.woff +0 -0
- package/dist/assets/katex-fonts/katex-8.ttf +0 -0
- package/dist/assets/katex-fonts/katex-9.woff2 +0 -0
- package/dist/components/release-notes-dialog.d.ts.map +1 -1
- package/dist/editor/extensions/code-block-view.d.ts.map +1 -1
- package/dist/editor/extensions/index.d.ts +2 -1
- package/dist/editor/extensions/index.d.ts.map +1 -1
- package/dist/editor/extensions/math-utils.d.ts +9 -0
- package/dist/editor/extensions/math-utils.d.ts.map +1 -0
- package/dist/editor/extensions/math-view.d.ts +27 -0
- package/dist/editor/extensions/math-view.d.ts.map +1 -0
- package/dist/editor/extensions/math.d.ts +44 -0
- package/dist/editor/extensions/math.d.ts.map +1 -0
- package/dist/editor/extensions/slash-command.d.ts.map +1 -1
- package/dist/editor/i18n/en-US.d.ts +14 -0
- package/dist/editor/i18n/en-US.d.ts.map +1 -1
- package/dist/editor/i18n/zh-CN.d.ts +14 -0
- package/dist/editor/i18n/zh-CN.d.ts.map +1 -1
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/utils/local-media.d.ts +1 -1
- package/dist/editor/utils/local-media.d.ts.map +1 -1
- package/dist/{export-dialog-BJReD1PN.cjs → export-dialog-BKShGPNv.cjs} +1 -1
- package/dist/{export-dialog-CJhm3uqR.js → export-dialog-DMY_QIVq.js} +1 -1
- package/dist/index.cjs +13 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1340 -891
- package/dist/sanitize-D4Bd9RtA.cjs +1 -0
- package/dist/{sanitize-wGLeVLFO.js → sanitize-DdIs-mcO.js} +28 -0
- package/dist/{signed-fetch-BiI-JlzZ.cjs → signed-fetch-ULpEJyn5.cjs} +1 -1
- package/dist/{storage-settings-dialog-zPgJahMO.cjs → storage-settings-dialog-WBHfAUak.cjs} +1 -1
- package/dist/styles.css +1 -2
- package/package.json +3 -1
- package/dist/sanitize-Bcj55kwd.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { a as e, n as t, r as n, t as r } from "./signed-fetch-CPPWCUUS.js";
|
|
2
2
|
import { a as i, i as a, n as o, r as s, t as c } from "./storage-DUcmM2Ex.js";
|
|
3
|
-
import { a as l, i as u, n as d, o as f, r as p, s as m, t as h } from "./sanitize-
|
|
3
|
+
import { a as l, i as u, n as d, o as f, r as p, s as m, t as h } from "./sanitize-DdIs-mcO.js";
|
|
4
4
|
import { n as g, t as _ } from "./local-B20eAPCo.js";
|
|
5
5
|
import { Suspense as v, lazy as y, useCallback as b, useEffect as x, useLayoutEffect as S, useMemo as C, useRef as w, useState as T } from "react";
|
|
6
6
|
import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
|
|
7
7
|
import { generateText as k, streamText as A } from "ai";
|
|
8
8
|
import { DOMParser as j, Fragment as M, Slice as N } from "@tiptap/pm/model";
|
|
9
|
-
import { EditorContent as
|
|
10
|
-
import { BubbleMenu as
|
|
11
|
-
import { createPortal as
|
|
12
|
-
import { Extension as R,
|
|
13
|
-
import { NodeSelection as
|
|
14
|
-
import { Decoration as
|
|
15
|
-
import { Image as
|
|
16
|
-
import { Link as
|
|
9
|
+
import { EditorContent as ee, NodeViewWrapper as P, ReactNodeViewRenderer as F, ReactRenderer as I, useEditor as te } from "@tiptap/react";
|
|
10
|
+
import { BubbleMenu as ne } from "@tiptap/react/menus";
|
|
11
|
+
import { createPortal as L } from "react-dom";
|
|
12
|
+
import { Extension as R, InputRule as re, Node as ie, markInputRule as z } from "@tiptap/core";
|
|
13
|
+
import { NodeSelection as B, Plugin as V, PluginKey as H, TextSelection as ae } from "@tiptap/pm/state";
|
|
14
|
+
import { Decoration as oe, DecorationSet as U } from "@tiptap/pm/view";
|
|
15
|
+
import { Image as W } from "@tiptap/extension-image";
|
|
16
|
+
import { Link as se } from "@tiptap/extension-link";
|
|
17
17
|
import { Underline as G } from "@tiptap/extension-underline";
|
|
18
18
|
import K from "@tiptap/starter-kit";
|
|
19
|
-
import { CharacterCount as
|
|
20
|
-
import { Color as
|
|
21
|
-
import { Highlight as
|
|
22
|
-
import { HorizontalRule as
|
|
23
|
-
import { Placeholder as
|
|
24
|
-
import { Table as
|
|
25
|
-
import { TableCell as
|
|
19
|
+
import { CharacterCount as ce } from "@tiptap/extension-character-count";
|
|
20
|
+
import { Color as q } from "@tiptap/extension-color";
|
|
21
|
+
import { Highlight as le } from "@tiptap/extension-highlight";
|
|
22
|
+
import { HorizontalRule as ue } 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 J } from "@tiptap/extension-table-cell";
|
|
26
26
|
import { TableHeader as pe } from "@tiptap/extension-table-header";
|
|
27
27
|
import { TableRow as me } from "@tiptap/extension-table-row";
|
|
28
28
|
import { TaskItem as he } from "@tiptap/extension-task-item";
|
|
@@ -32,30 +32,31 @@ import { Markdown as ve } from "tiptap-markdown";
|
|
|
32
32
|
import { CodeBlockLowlight as ye } from "@tiptap/extension-code-block-lowlight";
|
|
33
33
|
import be from "highlight.js/lib/languages/dockerfile";
|
|
34
34
|
import { common as xe, createLowlight as Se } from "lowlight";
|
|
35
|
-
import Ce
|
|
35
|
+
import Ce from "katex";
|
|
36
|
+
import we, { exitSuggestion as Te, findSuggestionMatch as Ee } from "@tiptap/suggestion";
|
|
36
37
|
//#region ../text-layout/dist/index.mjs
|
|
37
|
-
var
|
|
38
|
-
function
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
var
|
|
42
|
-
function
|
|
43
|
-
let n =
|
|
44
|
-
n || (n = /* @__PURE__ */ new Map(),
|
|
38
|
+
var De = null, Oe = null;
|
|
39
|
+
function ke() {
|
|
40
|
+
return Oe || (typeof document > "u" ? null : (De = document.createElement("canvas"), Oe = De.getContext("2d"), Oe));
|
|
41
|
+
}
|
|
42
|
+
var Ae = /* @__PURE__ */ new Map();
|
|
43
|
+
function je(e, t) {
|
|
44
|
+
let n = Ae.get(t);
|
|
45
|
+
n || (n = /* @__PURE__ */ new Map(), Ae.set(t, n));
|
|
45
46
|
let r = n.get(e);
|
|
46
47
|
if (r !== void 0) return r;
|
|
47
|
-
let i =
|
|
48
|
-
return i ? (i.font = t, r = i.measureText(e).width) : r =
|
|
48
|
+
let i = ke();
|
|
49
|
+
return i ? (i.font = t, r = i.measureText(e).width) : r = Me(e, t), n.set(e, r), r;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function Me(e, t) {
|
|
51
52
|
let n = parseFloat(t) || 16, r = 0;
|
|
52
|
-
for (let t of e)
|
|
53
|
+
for (let t of e) Ne(t.codePointAt(0) ?? 0) ? r += n : t === " " ? r += n * .3 : r += n * .55;
|
|
53
54
|
return r;
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function Ne(e) {
|
|
56
57
|
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
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function Y(e) {
|
|
59
60
|
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
61
|
}
|
|
61
62
|
function Pe(e, t) {
|
|
@@ -69,26 +70,26 @@ function Pe(e, t) {
|
|
|
69
70
|
else r = [...e];
|
|
70
71
|
for (let e of r) {
|
|
71
72
|
let r = e.codePointAt(0) ?? 0, i = "latin";
|
|
72
|
-
e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" :
|
|
73
|
+
e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" : Ne(r) && (i = Y(r) ? "punct" : "cjk"), n.push({
|
|
73
74
|
text: e,
|
|
74
|
-
width:
|
|
75
|
+
width: je(e, t),
|
|
75
76
|
type: i
|
|
76
77
|
});
|
|
77
78
|
}
|
|
78
79
|
return n;
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
+
function Fe(e, t, n) {
|
|
81
82
|
let r = 0, i = Math.min(n, e.length);
|
|
82
83
|
for (let n = t; n < i; n++) r += e[n].width;
|
|
83
84
|
return r;
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
+
function Ie(e, t, n, r) {
|
|
86
87
|
return {
|
|
87
88
|
text: e.slice(t, Math.min(n, e.length)).map((e) => e.text).join(""),
|
|
88
89
|
width: r
|
|
89
90
|
};
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
+
function Le(e, t, n = "16px system-ui") {
|
|
92
93
|
let { maxWidth: r, lineHeight: i, maxLines: a, overflowWrap: o = "break-word" } = t, s = Pe(e, n), c = [], l = {
|
|
93
94
|
lineStart: 0,
|
|
94
95
|
lineWidth: 0,
|
|
@@ -98,28 +99,28 @@ function Ie(e, t, n = "16px system-ui") {
|
|
|
98
99
|
for (let e = 0; e < s.length; e++) {
|
|
99
100
|
let t = s[e];
|
|
100
101
|
if (t.type === "break") {
|
|
101
|
-
c.push(
|
|
102
|
+
c.push(Ie(s, l.lineStart, e, l.lineWidth)), l.lineStart = e + 1, l.lineWidth = 0, l.lastBreakIdx = -1;
|
|
102
103
|
continue;
|
|
103
104
|
}
|
|
104
105
|
let n = l.lineWidth + t.width;
|
|
105
106
|
if (t.type === "space") {
|
|
106
|
-
if (n > r && l.lineWidth > 0 ? (l.lastBreakIdx >= 0 ? (c.push(
|
|
107
|
+
if (n > r && l.lineWidth > 0 ? (l.lastBreakIdx >= 0 ? (c.push(Ie(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Fe(s, l.lineStart, e + 1)) : (c.push(Ie(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width), l.lastBreakIdx = -1) : (l.lineWidth = n, l.lastBreakIdx = e, l.lastBreakWidth = l.lineWidth), a && c.length >= a) break;
|
|
107
108
|
continue;
|
|
108
109
|
}
|
|
109
110
|
if (t.type === "cjk") {
|
|
110
|
-
if (n > r && l.lineWidth > 0 ? (c.push(
|
|
111
|
+
if (n > r && l.lineWidth > 0 ? (c.push(Ie(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width, l.lastBreakIdx = -1) : (l.lineWidth = n, l.lastBreakIdx = e, l.lastBreakWidth = l.lineWidth), a && c.length >= a) break;
|
|
111
112
|
continue;
|
|
112
113
|
}
|
|
113
114
|
if (t.type === "punct") {
|
|
114
|
-
if (l.lineWidth === 0 && c.length > 0 ? c[c.length - 1].text.length > 0 && (l.lineWidth = t.width) : n > r ? (l.lastBreakIdx >= 0 ? (c.push(
|
|
115
|
+
if (l.lineWidth === 0 && c.length > 0 ? c[c.length - 1].text.length > 0 && (l.lineWidth = t.width) : n > r ? (l.lastBreakIdx >= 0 ? (c.push(Ie(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Fe(s, l.lineStart, e + 1)) : l.lineWidth = n, l.lastBreakIdx = -1) : l.lineWidth = n, a && c.length >= a) break;
|
|
115
116
|
continue;
|
|
116
117
|
}
|
|
117
|
-
if (n > r && l.lineWidth > 0 ? l.lastBreakIdx >= 0 ? (c.push(
|
|
118
|
+
if (n > r && l.lineWidth > 0 ? l.lastBreakIdx >= 0 ? (c.push(Ie(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Fe(s, l.lineStart, e + 1), l.lastBreakIdx = -1) : o === "break-word" ? (c.push(Ie(s, l.lineStart, e, l.lineWidth)), l.lineStart = e, l.lineWidth = t.width) : l.lineWidth = n : l.lineWidth = n, a && c.length >= a) break;
|
|
118
119
|
}
|
|
119
120
|
let u = l.lineStart < s.length;
|
|
120
121
|
if (u && (!a || c.length < a)) {
|
|
121
|
-
let e =
|
|
122
|
-
c.push(
|
|
122
|
+
let e = Fe(s, l.lineStart, s.length);
|
|
123
|
+
c.push(Ie(s, l.lineStart, s.length, e));
|
|
123
124
|
}
|
|
124
125
|
return {
|
|
125
126
|
lines: c,
|
|
@@ -130,8 +131,8 @@ function Ie(e, t, n = "16px system-ui") {
|
|
|
130
131
|
}
|
|
131
132
|
//#endregion
|
|
132
133
|
//#region ../toast/dist/index.mjs
|
|
133
|
-
var
|
|
134
|
-
function
|
|
134
|
+
var Re = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, ze = "13.5px -apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"PingFang SC\", \"Microsoft YaHei\", system-ui, sans-serif";
|
|
135
|
+
function X() {
|
|
135
136
|
if (typeof window > "u") return 290;
|
|
136
137
|
let e = window.innerWidth;
|
|
137
138
|
return e <= 480 ? Math.max(140, e - 98) : 290;
|
|
@@ -141,25 +142,25 @@ var Be = {
|
|
|
141
142
|
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
143
|
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
144
|
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
|
-
},
|
|
145
|
-
function
|
|
146
|
-
return `qt${
|
|
145
|
+
}, Ve = 1;
|
|
146
|
+
function He() {
|
|
147
|
+
return `qt${Ve++}${Date.now().toString(36)}`;
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
+
function Ue(e, t, n) {
|
|
149
150
|
let r = document.createElement(e);
|
|
150
151
|
return t && (r.className = t), n != null && (r.innerHTML = n), r;
|
|
151
152
|
}
|
|
152
|
-
function
|
|
153
|
+
function We(e, t) {
|
|
153
154
|
let n = t.split(/\*\*(.+?)\*\*/g);
|
|
154
155
|
for (let t = 0; t < n.length; t++) {
|
|
155
156
|
let r = n[t];
|
|
156
157
|
if (r) if (t % 2 == 1) {
|
|
157
|
-
let t =
|
|
158
|
+
let t = Ue("em", "qt-mark");
|
|
158
159
|
t.textContent = r, e.appendChild(t);
|
|
159
160
|
} else e.appendChild(document.createTextNode(r));
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
|
-
var
|
|
163
|
+
var Ge = {
|
|
163
164
|
type: "info",
|
|
164
165
|
position: "top-center",
|
|
165
166
|
duration: 4e3,
|
|
@@ -168,19 +169,19 @@ var Ue = {
|
|
|
168
169
|
persistMaxVisible: 3,
|
|
169
170
|
maxLines: void 0,
|
|
170
171
|
vibrate: !0
|
|
171
|
-
},
|
|
172
|
+
}, Ke = [
|
|
172
173
|
80,
|
|
173
174
|
40,
|
|
174
175
|
80
|
|
175
176
|
];
|
|
176
|
-
function
|
|
177
|
+
function qe() {
|
|
177
178
|
if (!(typeof navigator > "u" || !("vibrate" in navigator))) try {
|
|
178
|
-
navigator.vibrate(
|
|
179
|
+
navigator.vibrate(Ke);
|
|
179
180
|
} catch {}
|
|
180
181
|
}
|
|
181
|
-
var
|
|
182
|
+
var Je = class {
|
|
182
183
|
containers = /* @__PURE__ */ new Map();
|
|
183
|
-
opts = { ...
|
|
184
|
+
opts = { ...Ge };
|
|
184
185
|
toasts = /* @__PURE__ */ new Map();
|
|
185
186
|
queue = [];
|
|
186
187
|
_seq = 0;
|
|
@@ -189,10 +190,10 @@ var Ke = class {
|
|
|
189
190
|
}
|
|
190
191
|
ensureContainer(e) {
|
|
191
192
|
let t = this.containers.get(e);
|
|
192
|
-
return t || (t =
|
|
193
|
+
return t || (t = Ue("div", "qt-container"), t.setAttribute("data-qt-pos", e), t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("aria-atomic", "false"), document.body.appendChild(t), this.containers.set(e, t)), t;
|
|
193
194
|
}
|
|
194
195
|
show(e, t) {
|
|
195
|
-
let n = t?.type ?? this.opts.type, r = t?.position ?? this.opts.position, i = t?.persist ?? this.opts.persist ? 0 : t?.duration ?? this.opts.duration, a = t?.dismissible ?? !0, o = t?.maxLines ?? this.opts.maxLines, s = t?.description, c = t?.action, l =
|
|
196
|
+
let n = t?.type ?? this.opts.type, r = t?.position ?? this.opts.position, i = t?.persist ?? this.opts.persist ? 0 : t?.duration ?? this.opts.duration, a = t?.dismissible ?? !0, o = t?.maxLines ?? this.opts.maxLines, s = t?.description, c = t?.action, l = He(), u = {
|
|
196
197
|
id: l,
|
|
197
198
|
type: n,
|
|
198
199
|
dismissible: a,
|
|
@@ -275,30 +276,30 @@ var Ke = class {
|
|
|
275
276
|
this.containers.clear();
|
|
276
277
|
}
|
|
277
278
|
buildElement(e, t, n, r, i, a, o) {
|
|
278
|
-
let s =
|
|
279
|
+
let s = Ue("div", `qt-toast qt-${n}${i == null ? "" : " qt-truncate"}${a || o ? " qt-rich" : ""}`);
|
|
279
280
|
s.setAttribute("data-qt-id", e);
|
|
280
|
-
let c =
|
|
281
|
+
let c = Ue("span", "qt-icon");
|
|
281
282
|
c.innerHTML = Be[n], s.appendChild(c);
|
|
282
|
-
let l =
|
|
283
|
-
maxWidth:
|
|
283
|
+
let l = Ue("div", "qt-body"), u = Ue("span", "qt-msg"), d = Le(t, {
|
|
284
|
+
maxWidth: X(),
|
|
284
285
|
lineHeight: 1,
|
|
285
286
|
maxLines: i
|
|
286
|
-
},
|
|
287
|
-
if (d.lineCount <= 1 ?
|
|
288
|
-
let n =
|
|
289
|
-
t === d.lines.length - 1 && d.truncated && !r.endsWith("…") && (r += "…"),
|
|
287
|
+
}, ze);
|
|
288
|
+
if (d.lineCount <= 1 ? We(u, t) : d.lines.forEach((e, t) => {
|
|
289
|
+
let n = Ue("span", "qt-line"), r = e.text;
|
|
290
|
+
t === d.lines.length - 1 && d.truncated && !r.endsWith("…") && (r += "…"), We(n, r), u.appendChild(n);
|
|
290
291
|
}), l.appendChild(u), a) {
|
|
291
|
-
let e =
|
|
292
|
+
let e = Ue("div", "qt-desc");
|
|
292
293
|
e.textContent = a, l.appendChild(e);
|
|
293
294
|
}
|
|
294
295
|
if (s.appendChild(l), o) {
|
|
295
|
-
let t =
|
|
296
|
+
let t = Ue("button", "qt-action");
|
|
296
297
|
t.type = "button", t.textContent = o.label, t.addEventListener("click", (t) => {
|
|
297
298
|
t.stopPropagation(), this.dismiss(e), o.onClick();
|
|
298
299
|
}), s.appendChild(t);
|
|
299
300
|
}
|
|
300
301
|
if (r) {
|
|
301
|
-
let t =
|
|
302
|
+
let t = Ue("button", "qt-close", "<svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><path d=\"M18 6 6 18M6 6l12 12\"/></svg>");
|
|
302
303
|
t.type = "button", t.setAttribute("aria-label", "关闭通知"), t.addEventListener("click", (t) => {
|
|
303
304
|
t.stopPropagation(), this.dismiss(e);
|
|
304
305
|
}), s.appendChild(t);
|
|
@@ -310,7 +311,7 @@ var Ke = class {
|
|
|
310
311
|
mount(e) {
|
|
311
312
|
e.duration === 0 && this.evictPersistIfNeeded(e);
|
|
312
313
|
let t = this.ensureContainer(e.position);
|
|
313
|
-
this.toasts.set(e.id, e), t.appendChild(e.element), e.type === "error" && this.opts.vibrate &&
|
|
314
|
+
this.toasts.set(e.id, e), t.appendChild(e.element), e.type === "error" && this.opts.vibrate && qe(), requestAnimationFrame(() => {
|
|
314
315
|
requestAnimationFrame(() => {
|
|
315
316
|
e.element.classList.add("qt-enter");
|
|
316
317
|
});
|
|
@@ -332,7 +333,7 @@ var Ke = class {
|
|
|
332
333
|
let t = () => {
|
|
333
334
|
e.element.remove(), this.toasts.delete(e.id), this._dequeue();
|
|
334
335
|
};
|
|
335
|
-
if (
|
|
336
|
+
if (Re) t();
|
|
336
337
|
else {
|
|
337
338
|
let n = !1, r = () => {
|
|
338
339
|
n || (n = !0, t());
|
|
@@ -345,46 +346,46 @@ var Ke = class {
|
|
|
345
346
|
let e = this.queue.shift();
|
|
346
347
|
this.mount(e);
|
|
347
348
|
}
|
|
348
|
-
},
|
|
349
|
-
function
|
|
350
|
-
return
|
|
351
|
-
}
|
|
352
|
-
var
|
|
353
|
-
info: (e, t) =>
|
|
354
|
-
success: (e, t) =>
|
|
355
|
-
warn: (e, t) =>
|
|
356
|
-
error: (e, t) =>
|
|
357
|
-
promise: (e, t, n) =>
|
|
358
|
-
dismiss: (e) =>
|
|
359
|
-
dismissAll: () =>
|
|
360
|
-
configure: (e) =>
|
|
361
|
-
}),
|
|
362
|
-
function
|
|
363
|
-
|
|
349
|
+
}, Ye = null;
|
|
350
|
+
function Xe() {
|
|
351
|
+
return Ye ||= new Je(), Ye;
|
|
352
|
+
}
|
|
353
|
+
var Ze = Object.assign((e, t) => Xe().show(e, t), {
|
|
354
|
+
info: (e, t) => Xe().info(e, t),
|
|
355
|
+
success: (e, t) => Xe().success(e, t),
|
|
356
|
+
warn: (e, t) => Xe().warn(e, t),
|
|
357
|
+
error: (e, t) => Xe().error(e, t),
|
|
358
|
+
promise: (e, t, n) => Xe().promise(e, t, n),
|
|
359
|
+
dismiss: (e) => Xe().dismiss(e),
|
|
360
|
+
dismissAll: () => Xe().dismissAll(),
|
|
361
|
+
configure: (e) => Xe().configure(e)
|
|
362
|
+
}), Qe = /* @__PURE__ */ new Set(), $e = null;
|
|
363
|
+
function et(e) {
|
|
364
|
+
$e = e;
|
|
364
365
|
}
|
|
365
366
|
function Z(e, t = "error", n) {
|
|
366
367
|
let r = {
|
|
367
368
|
persist: !0,
|
|
368
369
|
...n
|
|
369
370
|
};
|
|
370
|
-
if (
|
|
371
|
-
for (let n of
|
|
371
|
+
if (Qe.size > 0) {
|
|
372
|
+
for (let n of Qe) n(e, t, r);
|
|
372
373
|
return;
|
|
373
374
|
}
|
|
374
|
-
if (
|
|
375
|
-
|
|
375
|
+
if ($e) {
|
|
376
|
+
$e(e, t, r);
|
|
376
377
|
return;
|
|
377
378
|
}
|
|
378
|
-
t === "success" ?
|
|
379
|
+
t === "success" ? Ze.success(e, r) : t === "info" ? Ze.info(e, r) : Ze.error(e, r);
|
|
379
380
|
}
|
|
380
|
-
function
|
|
381
|
-
return
|
|
382
|
-
|
|
381
|
+
function tt(e) {
|
|
382
|
+
return Qe.add(e), () => {
|
|
383
|
+
Qe.delete(e);
|
|
383
384
|
};
|
|
384
385
|
}
|
|
385
386
|
//#endregion
|
|
386
387
|
//#region src/components/image-upload-dialog.tsx
|
|
387
|
-
var
|
|
388
|
+
var nt = /* @__PURE__ */ e({ ImageUploadDialog: () => rt }), rt = ({ open: e, onClose: t, onInsert: n, validate: r }) => {
|
|
388
389
|
let [i, a] = T("upload"), [s, c] = T(!1), [l, u] = T(!1), [d, f] = T(null), [p, m] = T(null), [h, g] = T(""), [_, v] = T(null), y = w(null), x = (() => {
|
|
389
390
|
try {
|
|
390
391
|
let e = o();
|
|
@@ -676,10 +677,10 @@ var et = /* @__PURE__ */ e({ ImageUploadDialog: () => tt }), tt = ({ open: e, on
|
|
|
676
677
|
};
|
|
677
678
|
//#endregion
|
|
678
679
|
//#region src/components/toc.tsx
|
|
679
|
-
function
|
|
680
|
+
function it(e, t) {
|
|
680
681
|
return `${e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu, "").replace(/\s+/g, "-").slice(0, 40) || "heading"}-${t}`;
|
|
681
682
|
}
|
|
682
|
-
function
|
|
683
|
+
function at(e) {
|
|
683
684
|
let t = [], n = [];
|
|
684
685
|
for (let r of e) {
|
|
685
686
|
let e = {
|
|
@@ -691,18 +692,18 @@ function rt(e) {
|
|
|
691
692
|
}
|
|
692
693
|
return t;
|
|
693
694
|
}
|
|
694
|
-
function
|
|
695
|
+
function ot(e) {
|
|
695
696
|
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
696
697
|
for (let r of e) r.children.length > 0 && (t.add(r.id), n(r.children));
|
|
697
698
|
};
|
|
698
699
|
return n(e), t;
|
|
699
700
|
}
|
|
700
|
-
function
|
|
701
|
+
function st(e, t) {
|
|
701
702
|
let n = [];
|
|
702
|
-
for (let r of e) n.push(r), r.children.length > 0 && !t.has(r.id) && n.push(...
|
|
703
|
+
for (let r of e) n.push(r), r.children.length > 0 && !t.has(r.id) && n.push(...st(r.children, t));
|
|
703
704
|
return n;
|
|
704
705
|
}
|
|
705
|
-
function
|
|
706
|
+
function ct(e, t) {
|
|
706
707
|
let n = t.toLowerCase(), r = (e) => {
|
|
707
708
|
let t = [];
|
|
708
709
|
for (let i of e) {
|
|
@@ -716,7 +717,7 @@ function ot(e, t) {
|
|
|
716
717
|
};
|
|
717
718
|
return r(e);
|
|
718
719
|
}
|
|
719
|
-
function
|
|
720
|
+
function lt(e) {
|
|
720
721
|
let t = e.parentElement;
|
|
721
722
|
for (; t && t !== document.documentElement;) {
|
|
722
723
|
let e = getComputedStyle(t).overflowY;
|
|
@@ -725,7 +726,7 @@ function st(e) {
|
|
|
725
726
|
}
|
|
726
727
|
return null;
|
|
727
728
|
}
|
|
728
|
-
function
|
|
729
|
+
function ut(e) {
|
|
729
730
|
if (e.isDestroyed) return null;
|
|
730
731
|
try {
|
|
731
732
|
return e.view.dom;
|
|
@@ -733,7 +734,7 @@ function ct(e) {
|
|
|
733
734
|
return null;
|
|
734
735
|
}
|
|
735
736
|
}
|
|
736
|
-
function
|
|
737
|
+
function dt(e, t) {
|
|
737
738
|
if (!t) return e;
|
|
738
739
|
let n = e.toLowerCase(), r = t.toLowerCase(), i = [], a = 0, o = 0;
|
|
739
740
|
for (;;) {
|
|
@@ -746,12 +747,12 @@ function lt(e, t) {
|
|
|
746
747
|
}
|
|
747
748
|
return a < e.length && i.push(e.slice(a)), i.length ? i : e;
|
|
748
749
|
}
|
|
749
|
-
var
|
|
750
|
+
var ft = 84, pt = 3e3, mt = ({ editor: e, className: t = "", onClose: n }) => {
|
|
750
751
|
let [r, i] = T([]), [a, o] = T(""), [s, c] = T(/* @__PURE__ */ new Set()), [l, u] = T(""), d = w(""), f = w([]), p = w(null), m = w(null), h = w(null), g = w(0), _ = b(() => {
|
|
751
752
|
h.current &&= (clearTimeout(h.current.timer), null);
|
|
752
753
|
}, []), v = b(() => {
|
|
753
|
-
let t =
|
|
754
|
-
return t ? Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6")).map((e, t) => (e.id ||=
|
|
754
|
+
let t = ut(e);
|
|
755
|
+
return t ? Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6")).map((e, t) => (e.id ||= it(e.textContent || "", t), {
|
|
755
756
|
id: e.id,
|
|
756
757
|
level: Number(e.tagName.slice(1)),
|
|
757
758
|
text: e.textContent?.trim() || "(无标题)",
|
|
@@ -760,7 +761,7 @@ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
|
|
|
760
761
|
}, [e]), y = b(() => {
|
|
761
762
|
let e = f.current;
|
|
762
763
|
if ((!e.length || e.some((e) => !e.el.isConnected)) && (e = v(), f.current = e), !e.length) return;
|
|
763
|
-
let t = m.current, n = (t ? t.getBoundingClientRect().top : 0) +
|
|
764
|
+
let t = m.current, n = (t ? t.getBoundingClientRect().top : 0) + ft, r = t ? t.scrollHeight - t.scrollTop - t.clientHeight < 2 : document.documentElement.scrollHeight - window.scrollY - window.innerHeight < 2, i = "";
|
|
764
765
|
for (let t of e) t.el.isConnected && t.el.getBoundingClientRect().top <= n && (i = t.id);
|
|
765
766
|
if (r) {
|
|
766
767
|
for (let t = e.length - 1; t >= 0; t--) if (e[t].el.isConnected) {
|
|
@@ -784,7 +785,7 @@ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
|
|
|
784
785
|
t !== d.current && (d.current = t, f.current = e, i(e), S());
|
|
785
786
|
}, [v, S]);
|
|
786
787
|
x(() => {
|
|
787
|
-
let t =
|
|
788
|
+
let t = ut(e), n = t ? lt(t) : null;
|
|
788
789
|
m.current = n;
|
|
789
790
|
let r = n ?? window;
|
|
790
791
|
return r.addEventListener("scroll", S, { passive: !0 }), window.addEventListener("resize", S), r.addEventListener("wheel", _, { passive: !0 }), r.addEventListener("touchstart", _, { passive: !0 }), () => {
|
|
@@ -812,7 +813,7 @@ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
|
|
|
812
813
|
_
|
|
813
814
|
]);
|
|
814
815
|
let k = b((t) => {
|
|
815
|
-
let n =
|
|
816
|
+
let n = ut(e);
|
|
816
817
|
if (!n) return;
|
|
817
818
|
let r = t.el;
|
|
818
819
|
if ((!r || !n.contains(r)) && (r = n.querySelector(`[id="${CSS.escape(t.id)}"]`)), !r) {
|
|
@@ -825,59 +826,59 @@ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
|
|
|
825
826
|
if (!r) return;
|
|
826
827
|
_(), h.current = {
|
|
827
828
|
id: t.id,
|
|
828
|
-
timer: setTimeout(_,
|
|
829
|
+
timer: setTimeout(_, pt)
|
|
829
830
|
}, o(t.id);
|
|
830
831
|
let i = m.current, a = r.getBoundingClientRect().top;
|
|
831
832
|
if (i) {
|
|
832
833
|
let e = i.getBoundingClientRect().top;
|
|
833
834
|
i.scrollTo({
|
|
834
|
-
top: i.scrollTop + a - e -
|
|
835
|
+
top: i.scrollTop + a - e - ft,
|
|
835
836
|
behavior: "smooth"
|
|
836
837
|
});
|
|
837
838
|
} else window.scrollTo({
|
|
838
|
-
top: window.scrollY + a -
|
|
839
|
+
top: window.scrollY + a - ft,
|
|
839
840
|
behavior: "smooth"
|
|
840
841
|
});
|
|
841
|
-
}, [e, _]), A = C(() =>
|
|
842
|
+
}, [e, _]), A = C(() => at(r), [r]), j = C(() => ot(A), [A]), M = C(() => {
|
|
842
843
|
let e = /* @__PURE__ */ new Map(), t = (n, r) => {
|
|
843
844
|
for (let i of n) r && e.set(i.id, r), t(i.children, i.id);
|
|
844
845
|
};
|
|
845
846
|
return t(A, ""), e;
|
|
846
|
-
}, [A]), N = l.trim().length > 0,
|
|
847
|
+
}, [A]), N = l.trim().length > 0, ee = C(() => N ? ct(A, l.trim()) : A, [
|
|
847
848
|
A,
|
|
848
849
|
N,
|
|
849
850
|
l
|
|
850
|
-
]),
|
|
851
|
-
|
|
851
|
+
]), P = C(() => st(ee, N ? /* @__PURE__ */ new Set() : s), [
|
|
852
|
+
ee,
|
|
852
853
|
s,
|
|
853
854
|
N
|
|
854
|
-
]),
|
|
855
|
+
]), F = C(() => new Set(P.map((e) => e.id)), [P]), I = C(() => {
|
|
855
856
|
let e = a;
|
|
856
|
-
for (; e && !
|
|
857
|
+
for (; e && !F.has(e);) e = M.get(e) ?? "";
|
|
857
858
|
return e;
|
|
858
859
|
}, [
|
|
859
860
|
a,
|
|
860
|
-
|
|
861
|
+
F,
|
|
861
862
|
M
|
|
862
863
|
]);
|
|
863
864
|
x(() => {
|
|
864
865
|
let e = p.current;
|
|
865
|
-
if (!e || !
|
|
866
|
+
if (!e || !I) return;
|
|
866
867
|
let t = e.closest(".toc-scroll");
|
|
867
868
|
if (!(t instanceof HTMLElement)) return;
|
|
868
|
-
let n = e.querySelector(`[data-toc-id="${CSS.escape(
|
|
869
|
+
let n = e.querySelector(`[data-toc-id="${CSS.escape(I)}"]`);
|
|
869
870
|
if (!n) return;
|
|
870
871
|
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
871
872
|
i.top < r.top + 8 ? t.scrollTop -= r.top + 8 - i.top : i.bottom > r.bottom - 8 && (t.scrollTop += i.bottom - (r.bottom - 8));
|
|
872
|
-
}, [
|
|
873
|
-
let
|
|
873
|
+
}, [I]);
|
|
874
|
+
let te = b((e) => {
|
|
874
875
|
c((t) => {
|
|
875
876
|
let n = new Set(t);
|
|
876
877
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
877
878
|
});
|
|
878
|
-
}, []),
|
|
879
|
+
}, []), ne = b(() => {
|
|
879
880
|
c(new Set(j));
|
|
880
|
-
}, [j]),
|
|
881
|
+
}, [j]), L = b(() => {
|
|
881
882
|
c(/* @__PURE__ */ new Set());
|
|
882
883
|
}, []);
|
|
883
884
|
return r.length ? /* @__PURE__ */ O("nav", {
|
|
@@ -948,7 +949,7 @@ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
|
|
|
948
949
|
children: [/* @__PURE__ */ D("button", {
|
|
949
950
|
type: "button",
|
|
950
951
|
className: "toc-action-btn",
|
|
951
|
-
onClick:
|
|
952
|
+
onClick: ne,
|
|
952
953
|
title: "全部折叠",
|
|
953
954
|
"aria-label": "全部折叠",
|
|
954
955
|
disabled: N,
|
|
@@ -969,7 +970,7 @@ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
|
|
|
969
970
|
}), /* @__PURE__ */ D("button", {
|
|
970
971
|
type: "button",
|
|
971
972
|
className: "toc-action-btn",
|
|
972
|
-
onClick:
|
|
973
|
+
onClick: L,
|
|
973
974
|
title: "全部展开",
|
|
974
975
|
"aria-label": "全部展开",
|
|
975
976
|
disabled: N,
|
|
@@ -1040,22 +1041,22 @@ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
|
|
|
1040
1041
|
})
|
|
1041
1042
|
]
|
|
1042
1043
|
}),
|
|
1043
|
-
|
|
1044
|
+
P.length === 0 ? /* @__PURE__ */ D("div", {
|
|
1044
1045
|
className: "toc-search__empty",
|
|
1045
1046
|
children: N ? `未找到"${l.trim()}"相关标题` : "文档暂无标题"
|
|
1046
1047
|
}) : /* @__PURE__ */ D("ul", {
|
|
1047
1048
|
className: "toc-list",
|
|
1048
|
-
children:
|
|
1049
|
+
children: P.map((e) => {
|
|
1049
1050
|
let t = j.has(e.id), n = s.has(e.id);
|
|
1050
1051
|
return /* @__PURE__ */ O("li", {
|
|
1051
1052
|
"data-toc-id": e.id,
|
|
1052
|
-
className: `toc-item ${
|
|
1053
|
+
className: `toc-item ${I === e.id ? "is-active" : ""}`,
|
|
1053
1054
|
style: { paddingLeft: `${(e.level - 1) * 12 + 12}px` },
|
|
1054
1055
|
children: [t ? /* @__PURE__ */ D("button", {
|
|
1055
1056
|
type: "button",
|
|
1056
1057
|
className: `toc-toggle ${n ? "is-collapsed" : "is-expanded"}`,
|
|
1057
1058
|
onClick: (t) => {
|
|
1058
|
-
t.stopPropagation(),
|
|
1059
|
+
t.stopPropagation(), te(e.id);
|
|
1059
1060
|
},
|
|
1060
1061
|
title: n ? "展开子标题" : "折叠子标题",
|
|
1061
1062
|
"aria-label": n ? "展开子标题" : "折叠子标题",
|
|
@@ -1078,7 +1079,7 @@ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
|
|
|
1078
1079
|
title: e.text,
|
|
1079
1080
|
children: /* @__PURE__ */ D("span", {
|
|
1080
1081
|
className: "toc-text",
|
|
1081
|
-
children: N ?
|
|
1082
|
+
children: N ? dt(e.text, l.trim()) : e.text
|
|
1082
1083
|
})
|
|
1083
1084
|
})]
|
|
1084
1085
|
}, e.id);
|
|
@@ -1102,7 +1103,7 @@ var ut = 84, dt = 3e3, ft = ({ editor: e, className: t = "", onClose: n }) => {
|
|
|
1102
1103
|
};
|
|
1103
1104
|
//#endregion
|
|
1104
1105
|
//#region src/editor/ai/index.ts
|
|
1105
|
-
function
|
|
1106
|
+
function ht(e, t) {
|
|
1106
1107
|
return {
|
|
1107
1108
|
continue: "你是一个写作助手。请从下文尾部自然流畅地续写内容,保持风格一致。只输出续写的内容,不要加任何前缀说明。",
|
|
1108
1109
|
improve: "你是一个文字润色专家。请优化以下文本的表达,提升文采和流畅度,保持原意不变。只输出润色后的文本。",
|
|
@@ -1113,8 +1114,8 @@ function pt(e, t) {
|
|
|
1113
1114
|
zap: t || "你是一个全能的 AI 写作助手。请根据用户的指令处理文本。"
|
|
1114
1115
|
}[e];
|
|
1115
1116
|
}
|
|
1116
|
-
var
|
|
1117
|
-
async function
|
|
1117
|
+
var gt = null;
|
|
1118
|
+
async function _t(e) {
|
|
1118
1119
|
let t;
|
|
1119
1120
|
try {
|
|
1120
1121
|
({createOpenAI: t} = await import("@ai-sdk/openai"));
|
|
@@ -1129,7 +1130,7 @@ async function ht(e) {
|
|
|
1129
1130
|
async *stream(e) {
|
|
1130
1131
|
let t = await A({
|
|
1131
1132
|
model: n,
|
|
1132
|
-
system:
|
|
1133
|
+
system: ht(e.mode, e.instruction),
|
|
1133
1134
|
prompt: e.context,
|
|
1134
1135
|
temperature: .7,
|
|
1135
1136
|
maxOutputTokens: 2048
|
|
@@ -1139,7 +1140,7 @@ async function ht(e) {
|
|
|
1139
1140
|
async generate(e) {
|
|
1140
1141
|
return (await k({
|
|
1141
1142
|
model: n,
|
|
1142
|
-
system:
|
|
1143
|
+
system: ht(e.mode, e.instruction),
|
|
1143
1144
|
prompt: e.context,
|
|
1144
1145
|
temperature: .7,
|
|
1145
1146
|
maxOutputTokens: 2048
|
|
@@ -1147,16 +1148,16 @@ async function ht(e) {
|
|
|
1147
1148
|
}
|
|
1148
1149
|
};
|
|
1149
1150
|
}
|
|
1150
|
-
function
|
|
1151
|
-
|
|
1151
|
+
function vt(e) {
|
|
1152
|
+
gt = e;
|
|
1152
1153
|
}
|
|
1153
|
-
function
|
|
1154
|
-
if (!
|
|
1155
|
-
return
|
|
1154
|
+
function yt() {
|
|
1155
|
+
if (!gt) throw Error("未配置 AI 服务。请调用 createAILanguageModelProvider() 创建并通过 setAIProvider() 注册。");
|
|
1156
|
+
return gt;
|
|
1156
1157
|
}
|
|
1157
1158
|
//#endregion
|
|
1158
1159
|
//#region src/editor/ai/providers/openai-compat.ts
|
|
1159
|
-
function
|
|
1160
|
+
function bt(e) {
|
|
1160
1161
|
let { apiKey: t, baseURL: n, model: r, headers: i } = e;
|
|
1161
1162
|
async function* a(e, a) {
|
|
1162
1163
|
let o = await fetch(`${n}/chat/completions`, {
|
|
@@ -1207,10 +1208,10 @@ function vt(e) {
|
|
|
1207
1208
|
}
|
|
1208
1209
|
return {
|
|
1209
1210
|
async *stream(e) {
|
|
1210
|
-
yield* a(
|
|
1211
|
+
yield* a(ht(e.mode, e.instruction), e.context);
|
|
1211
1212
|
},
|
|
1212
1213
|
async generate(e) {
|
|
1213
|
-
let t =
|
|
1214
|
+
let t = ht(e.mode, e.instruction), n = "";
|
|
1214
1215
|
for await (let r of a(t, e.context)) n += r;
|
|
1215
1216
|
return n;
|
|
1216
1217
|
}
|
|
@@ -1218,8 +1219,8 @@ function vt(e) {
|
|
|
1218
1219
|
}
|
|
1219
1220
|
//#endregion
|
|
1220
1221
|
//#region src/editor/ai/providers/deepseek.ts
|
|
1221
|
-
function
|
|
1222
|
-
return
|
|
1222
|
+
function xt(e) {
|
|
1223
|
+
return bt({
|
|
1223
1224
|
apiKey: e.apiKey,
|
|
1224
1225
|
baseURL: e.baseURL || "https://api.deepseek.com/v1",
|
|
1225
1226
|
model: e.model || "deepseek-v4-flash",
|
|
@@ -1228,8 +1229,8 @@ function yt(e) {
|
|
|
1228
1229
|
}
|
|
1229
1230
|
//#endregion
|
|
1230
1231
|
//#region src/editor/ai/providers/openai.ts
|
|
1231
|
-
function
|
|
1232
|
-
return
|
|
1232
|
+
function St(e) {
|
|
1233
|
+
return bt({
|
|
1233
1234
|
apiKey: e.apiKey,
|
|
1234
1235
|
baseURL: e.baseURL || "https://api.openai.com/v1",
|
|
1235
1236
|
model: e.model || "gpt-5.6-luna",
|
|
@@ -1238,8 +1239,8 @@ function bt(e) {
|
|
|
1238
1239
|
}
|
|
1239
1240
|
//#endregion
|
|
1240
1241
|
//#region src/editor/ai/providers/qwen.ts
|
|
1241
|
-
function
|
|
1242
|
-
return
|
|
1242
|
+
function Ct(e) {
|
|
1243
|
+
return bt({
|
|
1243
1244
|
apiKey: e.apiKey,
|
|
1244
1245
|
baseURL: e.baseURL || "https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|
1245
1246
|
model: e.model || "qwen3.7-plus",
|
|
@@ -1248,20 +1249,20 @@ function xt(e) {
|
|
|
1248
1249
|
}
|
|
1249
1250
|
//#endregion
|
|
1250
1251
|
//#region src/editor/extensions/search-highlight.ts
|
|
1251
|
-
var
|
|
1252
|
+
var wt = {
|
|
1252
1253
|
keyword: "",
|
|
1253
1254
|
caseSensitive: !1,
|
|
1254
1255
|
wholeWord: !1,
|
|
1255
1256
|
matches: [],
|
|
1256
1257
|
currentIndex: -1
|
|
1257
|
-
},
|
|
1258
|
-
function
|
|
1258
|
+
}, Tt = new H("search-highlight");
|
|
1259
|
+
function Et(e) {
|
|
1259
1260
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1260
1261
|
}
|
|
1261
|
-
function
|
|
1262
|
+
function Dt(e, t) {
|
|
1262
1263
|
let { keyword: n, caseSensitive: r, wholeWord: i } = t;
|
|
1263
1264
|
if (!n) return [];
|
|
1264
|
-
let a = r ? "g" : "gi", o = i ? `\\b${
|
|
1265
|
+
let a = r ? "g" : "gi", o = i ? `\\b${Et(n)}\\b` : Et(n), s = new RegExp(o, a), c = [];
|
|
1265
1266
|
return e.descendants((e, t) => {
|
|
1266
1267
|
if (!e.isText || !e.text) return;
|
|
1267
1268
|
s.lastIndex = 0;
|
|
@@ -1275,12 +1276,12 @@ function Tt(e, t) {
|
|
|
1275
1276
|
}
|
|
1276
1277
|
}), c;
|
|
1277
1278
|
}
|
|
1278
|
-
function
|
|
1279
|
-
if (t.matches.length === 0) return
|
|
1280
|
-
let n = t.matches.map((e, n) =>
|
|
1281
|
-
return
|
|
1279
|
+
function Ot(e, t) {
|
|
1280
|
+
if (t.matches.length === 0) return U.empty;
|
|
1281
|
+
let n = t.matches.map((e, n) => oe.inline(e.from, e.to, { class: n === t.currentIndex ? "search-highlight search-highlight--active" : "search-highlight" }));
|
|
1282
|
+
return U.create(e, n);
|
|
1282
1283
|
}
|
|
1283
|
-
function
|
|
1284
|
+
function kt(e, t) {
|
|
1284
1285
|
if (t.currentIndex < 0 || t.currentIndex >= t.matches.length) return;
|
|
1285
1286
|
let n = t.matches[t.currentIndex];
|
|
1286
1287
|
n && requestAnimationFrame(() => {
|
|
@@ -1305,15 +1306,15 @@ function Dt(e, t) {
|
|
|
1305
1306
|
} catch {}
|
|
1306
1307
|
});
|
|
1307
1308
|
}
|
|
1308
|
-
var
|
|
1309
|
+
var At = R.create({
|
|
1309
1310
|
name: "searchHighlight",
|
|
1310
1311
|
addProseMirrorPlugins() {
|
|
1311
|
-
return [new
|
|
1312
|
-
key:
|
|
1312
|
+
return [new V({
|
|
1313
|
+
key: Tt,
|
|
1313
1314
|
state: {
|
|
1314
|
-
init: () =>
|
|
1315
|
+
init: () => wt,
|
|
1315
1316
|
apply(e, t) {
|
|
1316
|
-
let n = e.getMeta(
|
|
1317
|
+
let n = e.getMeta(Tt);
|
|
1317
1318
|
if (n) return {
|
|
1318
1319
|
...t,
|
|
1319
1320
|
...n,
|
|
@@ -1321,7 +1322,7 @@ var Ot = R.create({
|
|
|
1321
1322
|
currentIndex: n.currentIndex === void 0 ? t.currentIndex : n.currentIndex
|
|
1322
1323
|
};
|
|
1323
1324
|
if (e.docChanged && t.keyword) {
|
|
1324
|
-
let n =
|
|
1325
|
+
let n = Dt(e.doc, t), r = t.currentIndex;
|
|
1325
1326
|
return r >= n.length && (r = n.length - 1), r < 0 && (r = n.length > 0 ? 0 : -1), {
|
|
1326
1327
|
...t,
|
|
1327
1328
|
matches: n,
|
|
@@ -1332,52 +1333,52 @@ var Ot = R.create({
|
|
|
1332
1333
|
}
|
|
1333
1334
|
},
|
|
1334
1335
|
props: { decorations(e) {
|
|
1335
|
-
let t =
|
|
1336
|
-
return t ?
|
|
1336
|
+
let t = Tt.getState(e);
|
|
1337
|
+
return t ? Ot(e.doc, t) : U.empty;
|
|
1337
1338
|
} }
|
|
1338
1339
|
})];
|
|
1339
1340
|
},
|
|
1340
1341
|
addCommands() {
|
|
1341
1342
|
return {
|
|
1342
1343
|
setSearch: (e, t = {}) => ({ state: n, dispatch: r, view: i }) => {
|
|
1343
|
-
let a =
|
|
1344
|
+
let a = Tt.getState(n) || wt, o = {
|
|
1344
1345
|
keyword: e,
|
|
1345
1346
|
caseSensitive: t.caseSensitive ?? a.caseSensitive,
|
|
1346
1347
|
wholeWord: t.wholeWord ?? a.wholeWord,
|
|
1347
1348
|
matches: [],
|
|
1348
1349
|
currentIndex: -1
|
|
1349
1350
|
};
|
|
1350
|
-
return o.matches =
|
|
1351
|
+
return o.matches = Dt(n.doc, o), o.currentIndex = o.matches.length > 0 ? 0 : -1, r && (r(n.tr.setMeta(Tt, o)), i && kt(i, o)), !0;
|
|
1351
1352
|
},
|
|
1352
1353
|
nextMatch: () => ({ state: e, dispatch: t, view: n }) => {
|
|
1353
|
-
let r =
|
|
1354
|
+
let r = Tt.getState(e) || wt;
|
|
1354
1355
|
if (r.matches.length === 0) return !1;
|
|
1355
1356
|
let i = (r.currentIndex + 1) % r.matches.length;
|
|
1356
|
-
return t && (t(e.tr.setMeta(
|
|
1357
|
+
return t && (t(e.tr.setMeta(Tt, { currentIndex: i })), n && kt(n, {
|
|
1357
1358
|
...r,
|
|
1358
1359
|
currentIndex: i
|
|
1359
1360
|
})), !0;
|
|
1360
1361
|
},
|
|
1361
1362
|
prevMatch: () => ({ state: e, dispatch: t, view: n }) => {
|
|
1362
|
-
let r =
|
|
1363
|
+
let r = Tt.getState(e) || wt;
|
|
1363
1364
|
if (r.matches.length === 0) return !1;
|
|
1364
1365
|
let i = (r.currentIndex - 1 + r.matches.length) % r.matches.length;
|
|
1365
|
-
return t && (t(e.tr.setMeta(
|
|
1366
|
+
return t && (t(e.tr.setMeta(Tt, { currentIndex: i })), n && kt(n, {
|
|
1366
1367
|
...r,
|
|
1367
1368
|
currentIndex: i
|
|
1368
1369
|
})), !0;
|
|
1369
1370
|
},
|
|
1370
|
-
clearSearch: () => ({ state: e, dispatch: t }) => (t && t(e.tr.setMeta(
|
|
1371
|
+
clearSearch: () => ({ state: e, dispatch: t }) => (t && t(e.tr.setMeta(Tt, wt)), !0)
|
|
1371
1372
|
};
|
|
1372
1373
|
}
|
|
1373
1374
|
});
|
|
1374
|
-
function
|
|
1375
|
+
function jt(e) {
|
|
1375
1376
|
let t = e.state;
|
|
1376
|
-
return
|
|
1377
|
+
return Tt.getState(t) || wt;
|
|
1377
1378
|
}
|
|
1378
1379
|
//#endregion
|
|
1379
1380
|
//#region src/components/search-bar.tsx
|
|
1380
|
-
var
|
|
1381
|
+
var Mt = ({ editor: e, onClose: t }) => {
|
|
1381
1382
|
let [n, r] = T(""), [i, a] = T(!1), [o, s] = T(!1), [c, l] = T(0), u = w(null), d = w({
|
|
1382
1383
|
keyword: n,
|
|
1383
1384
|
caseSensitive: i,
|
|
@@ -1442,7 +1443,7 @@ var At = ({ editor: e, onClose: t }) => {
|
|
|
1442
1443
|
}, [f, p]), h = C(() => {
|
|
1443
1444
|
if (!e) return null;
|
|
1444
1445
|
try {
|
|
1445
|
-
return
|
|
1446
|
+
return jt(e);
|
|
1446
1447
|
} catch {
|
|
1447
1448
|
return null;
|
|
1448
1449
|
}
|
|
@@ -1594,36 +1595,36 @@ function Q({ children: e, ...t }) {
|
|
|
1594
1595
|
children: e
|
|
1595
1596
|
});
|
|
1596
1597
|
}
|
|
1597
|
-
var
|
|
1598
|
+
var Nt = (e) => /* @__PURE__ */ O(Q, {
|
|
1598
1599
|
...e,
|
|
1599
1600
|
children: [/* @__PURE__ */ D("path", { d: "M6 4h8a4 4 0 0 1 0 8H6z" }), /* @__PURE__ */ D("path", { d: "M6 12h9a4 4 0 0 1 0 8H6z" })]
|
|
1600
|
-
}),
|
|
1601
|
+
}), Pt = (e) => /* @__PURE__ */ O(Q, {
|
|
1601
1602
|
...e,
|
|
1602
1603
|
children: [
|
|
1603
1604
|
/* @__PURE__ */ D("path", { d: "M19 4h-9" }),
|
|
1604
1605
|
/* @__PURE__ */ D("path", { d: "M14 20H5" }),
|
|
1605
1606
|
/* @__PURE__ */ D("path", { d: "M15 4 9 20" })
|
|
1606
1607
|
]
|
|
1607
|
-
}),
|
|
1608
|
+
}), Ft = (e) => /* @__PURE__ */ O(Q, {
|
|
1608
1609
|
...e,
|
|
1609
1610
|
children: [/* @__PURE__ */ D("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }), /* @__PURE__ */ D("path", { d: "M4 20h16" })]
|
|
1610
|
-
}),
|
|
1611
|
+
}), It = (e) => /* @__PURE__ */ O(Q, {
|
|
1611
1612
|
...e,
|
|
1612
1613
|
children: [
|
|
1613
1614
|
/* @__PURE__ */ D("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
|
|
1614
1615
|
/* @__PURE__ */ D("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
|
|
1615
1616
|
/* @__PURE__ */ D("path", { d: "M4 12h16" })
|
|
1616
1617
|
]
|
|
1617
|
-
}),
|
|
1618
|
+
}), Lt = (e) => /* @__PURE__ */ O(Q, {
|
|
1618
1619
|
...e,
|
|
1619
1620
|
children: [/* @__PURE__ */ D("path", { d: "m16 18 6-6-6-6" }), /* @__PURE__ */ D("path", { d: "m8 6-6 6 6 6" })]
|
|
1620
|
-
}),
|
|
1621
|
+
}), Rt = (e) => /* @__PURE__ */ O(Q, {
|
|
1621
1622
|
...e,
|
|
1622
1623
|
children: [/* @__PURE__ */ D("path", { d: "m9 11-6 6v3h9l3-3" }), /* @__PURE__ */ D("path", { d: "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4" })]
|
|
1623
|
-
}),
|
|
1624
|
+
}), zt = (e) => /* @__PURE__ */ O(Q, {
|
|
1624
1625
|
...e,
|
|
1625
1626
|
children: [/* @__PURE__ */ D("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ D("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })]
|
|
1626
|
-
}),
|
|
1627
|
+
}), Bt = (e) => /* @__PURE__ */ O(Q, {
|
|
1627
1628
|
...e,
|
|
1628
1629
|
children: [/* @__PURE__ */ D("rect", {
|
|
1629
1630
|
x: "3",
|
|
@@ -1633,7 +1634,7 @@ var jt = (e) => /* @__PURE__ */ O(Q, {
|
|
|
1633
1634
|
rx: "2",
|
|
1634
1635
|
ry: "2"
|
|
1635
1636
|
}), /* @__PURE__ */ D("path", { d: "M3 9h18M3 15h18M9 3v18M15 3v18" })]
|
|
1636
|
-
}),
|
|
1637
|
+
}), Vt = (e) => /* @__PURE__ */ O(Q, {
|
|
1637
1638
|
...e,
|
|
1638
1639
|
children: [/* @__PURE__ */ D("rect", {
|
|
1639
1640
|
x: "8",
|
|
@@ -1643,17 +1644,17 @@ var jt = (e) => /* @__PURE__ */ O(Q, {
|
|
|
1643
1644
|
rx: "2",
|
|
1644
1645
|
ry: "2"
|
|
1645
1646
|
}), /* @__PURE__ */ D("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })]
|
|
1646
|
-
}),
|
|
1647
|
+
}), Ht = (e) => /* @__PURE__ */ O(Q, {
|
|
1647
1648
|
...e,
|
|
1648
1649
|
children: [/* @__PURE__ */ D("circle", {
|
|
1649
1650
|
cx: "11",
|
|
1650
1651
|
cy: "11",
|
|
1651
1652
|
r: "8"
|
|
1652
1653
|
}), /* @__PURE__ */ D("path", { d: "m21 21-4.3-4.3" })]
|
|
1653
|
-
}),
|
|
1654
|
+
}), Ut = (e) => /* @__PURE__ */ O(Q, {
|
|
1654
1655
|
...e,
|
|
1655
1656
|
children: [/* @__PURE__ */ D("path", { d: "M12 3l1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6L12 3z" }), /* @__PURE__ */ D("path", { d: "M18.5 14l.7 1.9 1.9.7-1.9.7-.7 1.9-.7-1.9-1.9-.7 1.9-.7.7-1.9z" })]
|
|
1656
|
-
}),
|
|
1657
|
+
}), Wt = (e) => /* @__PURE__ */ O(Q, {
|
|
1657
1658
|
...e,
|
|
1658
1659
|
children: [
|
|
1659
1660
|
/* @__PURE__ */ D("circle", {
|
|
@@ -1672,13 +1673,13 @@ var jt = (e) => /* @__PURE__ */ O(Q, {
|
|
|
1672
1673
|
r: "1"
|
|
1673
1674
|
})
|
|
1674
1675
|
]
|
|
1675
|
-
}),
|
|
1676
|
+
}), Gt = (e) => /* @__PURE__ */ O(Q, {
|
|
1676
1677
|
...e,
|
|
1677
1678
|
children: [/* @__PURE__ */ D("path", { d: "M18 6 6 18" }), /* @__PURE__ */ D("path", { d: "m6 6 12 12" })]
|
|
1678
1679
|
});
|
|
1679
1680
|
//#endregion
|
|
1680
1681
|
//#region src/editor/storage/remove-resource.ts
|
|
1681
|
-
async function
|
|
1682
|
+
async function Kt(e) {
|
|
1682
1683
|
if (e) {
|
|
1683
1684
|
if (e.startsWith("blob:")) {
|
|
1684
1685
|
URL.revokeObjectURL(e);
|
|
@@ -1693,61 +1694,61 @@ async function Wt(e) {
|
|
|
1693
1694
|
}
|
|
1694
1695
|
//#endregion
|
|
1695
1696
|
//#region src/editor/ai/pending-removal.ts
|
|
1696
|
-
var
|
|
1697
|
+
var qt = 3e4, Jt = /* @__PURE__ */ new Set([
|
|
1697
1698
|
"image",
|
|
1698
1699
|
"attachmentEmbed",
|
|
1699
1700
|
"audioEmbed",
|
|
1700
1701
|
"videoEmbed"
|
|
1701
|
-
]),
|
|
1702
|
-
function
|
|
1702
|
+
]), Yt = /* @__PURE__ */ new WeakMap();
|
|
1703
|
+
function Xt(e) {
|
|
1703
1704
|
let t = /* @__PURE__ */ new Set();
|
|
1704
1705
|
return e.state.doc.descendants((e) => {
|
|
1705
|
-
if (
|
|
1706
|
+
if (Jt.has(e.type.name)) {
|
|
1706
1707
|
let n = e.attrs.src;
|
|
1707
1708
|
n && t.add(n);
|
|
1708
1709
|
}
|
|
1709
1710
|
return !0;
|
|
1710
1711
|
}), t;
|
|
1711
1712
|
}
|
|
1712
|
-
function
|
|
1713
|
-
let t =
|
|
1713
|
+
function Zt(e) {
|
|
1714
|
+
let t = Yt.get(e);
|
|
1714
1715
|
return t || (t = {
|
|
1715
1716
|
timers: /* @__PURE__ */ new Map(),
|
|
1716
1717
|
onTransaction: () => {},
|
|
1717
1718
|
listening: !1
|
|
1718
|
-
},
|
|
1719
|
+
}, Yt.set(e, t)), t;
|
|
1719
1720
|
}
|
|
1720
|
-
function
|
|
1721
|
+
function Qt(e, t) {
|
|
1721
1722
|
let n = [...new Set(t.filter(Boolean))];
|
|
1722
1723
|
if (n.length === 0) return;
|
|
1723
|
-
let r =
|
|
1724
|
+
let r = Zt(e);
|
|
1724
1725
|
r.listening ||= (r.onTransaction = () => {
|
|
1725
1726
|
if (r.timers.size === 0) return;
|
|
1726
|
-
let t =
|
|
1727
|
+
let t = Xt(e);
|
|
1727
1728
|
for (let [e, n] of r.timers) t.has(e) && (clearTimeout(n), r.timers.delete(e));
|
|
1728
1729
|
}, e.on("transaction", r.onTransaction), !0);
|
|
1729
1730
|
for (let t of n) {
|
|
1730
1731
|
if (r.timers.has(t)) continue;
|
|
1731
1732
|
let n = setTimeout(() => {
|
|
1732
|
-
|
|
1733
|
-
},
|
|
1733
|
+
Xt(e).has(t) || Kt(t), r.timers.delete(t);
|
|
1734
|
+
}, qt);
|
|
1734
1735
|
r.timers.set(t, n);
|
|
1735
1736
|
}
|
|
1736
1737
|
}
|
|
1737
|
-
function
|
|
1738
|
-
let t =
|
|
1738
|
+
function $t(e) {
|
|
1739
|
+
let t = Yt.get(e);
|
|
1739
1740
|
if (t) {
|
|
1740
1741
|
if (t.listening &&= (e.off("transaction", t.onTransaction), !1), t.timers.size > 0) {
|
|
1741
|
-
let n =
|
|
1742
|
-
for (let [e, r] of t.timers) clearTimeout(r), n.has(e) ||
|
|
1742
|
+
let n = Xt(e);
|
|
1743
|
+
for (let [e, r] of t.timers) clearTimeout(r), n.has(e) || Kt(e);
|
|
1743
1744
|
t.timers.clear();
|
|
1744
1745
|
}
|
|
1745
|
-
|
|
1746
|
+
Yt.delete(e);
|
|
1746
1747
|
}
|
|
1747
1748
|
}
|
|
1748
1749
|
//#endregion
|
|
1749
1750
|
//#region src/editor/ai/components/ai-selector.tsx
|
|
1750
|
-
var
|
|
1751
|
+
var en = [
|
|
1751
1752
|
{
|
|
1752
1753
|
mode: "continue",
|
|
1753
1754
|
labelKey: "editor.ai.continue",
|
|
@@ -1790,24 +1791,24 @@ var Qt = [
|
|
|
1790
1791
|
descKey: "editor.ai.zapDesc",
|
|
1791
1792
|
icon: "⚡"
|
|
1792
1793
|
}
|
|
1793
|
-
],
|
|
1794
|
+
], tn = /* @__PURE__ */ new Set([
|
|
1794
1795
|
"image",
|
|
1795
1796
|
"attachmentEmbed",
|
|
1796
1797
|
"audioEmbed",
|
|
1797
1798
|
"videoEmbed"
|
|
1798
|
-
]),
|
|
1799
|
+
]), nn = {
|
|
1799
1800
|
image: "editor.ai.nodeImage",
|
|
1800
1801
|
attachmentEmbed: "editor.ai.nodeAttachment",
|
|
1801
1802
|
videoEmbed: "editor.ai.nodeVideo",
|
|
1802
1803
|
audioEmbed: "editor.ai.nodeAudio"
|
|
1803
1804
|
};
|
|
1804
|
-
function
|
|
1805
|
+
function rn(e, t) {
|
|
1805
1806
|
return e.storage.qingwuUI?.parseMd?.(e.schema, t) || null;
|
|
1806
1807
|
}
|
|
1807
|
-
function
|
|
1808
|
+
function an(e, t, n) {
|
|
1808
1809
|
let r = [];
|
|
1809
1810
|
return e.state.doc.nodesBetween(t, n, (e) => {
|
|
1810
|
-
if (
|
|
1811
|
+
if (tn.has(e.type.name)) {
|
|
1811
1812
|
let t = e.attrs.src;
|
|
1812
1813
|
t && r.push({
|
|
1813
1814
|
type: e.type.name,
|
|
@@ -1817,27 +1818,27 @@ function nn(e, t, n) {
|
|
|
1817
1818
|
return !0;
|
|
1818
1819
|
}), r;
|
|
1819
1820
|
}
|
|
1820
|
-
function
|
|
1821
|
+
function on(e) {
|
|
1821
1822
|
let t = /* @__PURE__ */ new Set();
|
|
1822
1823
|
return e.state.doc.descendants((e) => {
|
|
1823
|
-
if (
|
|
1824
|
+
if (tn.has(e.type.name)) {
|
|
1824
1825
|
let n = e.attrs.src;
|
|
1825
1826
|
n && t.add(n);
|
|
1826
1827
|
}
|
|
1827
1828
|
return !0;
|
|
1828
1829
|
}), t;
|
|
1829
1830
|
}
|
|
1830
|
-
function
|
|
1831
|
-
let n =
|
|
1831
|
+
function sn(e, t) {
|
|
1832
|
+
let n = rn(e, t);
|
|
1832
1833
|
if (n && n.size > 0) {
|
|
1833
1834
|
let t = e.state.tr;
|
|
1834
|
-
t.replaceWith(0, e.state.doc.content.size, n), t.setSelection(
|
|
1835
|
+
t.replaceWith(0, e.state.doc.content.size, n), t.setSelection(ae.create(t.doc, t.doc.content.size)), e.view.dispatch(t.scrollIntoView()), e.commands.focus();
|
|
1835
1836
|
return;
|
|
1836
1837
|
}
|
|
1837
1838
|
e.commands.setContent(t), e.commands.focus();
|
|
1838
1839
|
}
|
|
1839
|
-
function
|
|
1840
|
-
let i =
|
|
1840
|
+
function cn(e, t, n, r) {
|
|
1841
|
+
let i = rn(e, t);
|
|
1841
1842
|
if (e.commands.focus(), !i) {
|
|
1842
1843
|
let i = e.chain().focus();
|
|
1843
1844
|
n === "replace" ? i.setTextSelection({
|
|
@@ -1849,7 +1850,7 @@ function on(e, t, n, r) {
|
|
|
1849
1850
|
let a = e.state.tr;
|
|
1850
1851
|
n === "replace" ? a.replaceRange(r.from, r.to, new N(i, 0, 0)) : a.insert(Math.min(r.to, e.state.doc.content.size), i), e.view.dispatch(a.scrollIntoView());
|
|
1851
1852
|
}
|
|
1852
|
-
function
|
|
1853
|
+
function ln({ editor: e, onClose: t }) {
|
|
1853
1854
|
let [n, r] = T(null), [i, a] = T(""), [o, s] = T(""), [c, l] = T(!1), [u, d] = T(null), [p, m] = T(null), h = w({
|
|
1854
1855
|
from: 0,
|
|
1855
1856
|
to: 0,
|
|
@@ -1868,7 +1869,7 @@ function sn({ editor: e, onClose: t }) {
|
|
|
1868
1869
|
empty: n.empty
|
|
1869
1870
|
}, l(!0), s(""), v.current = !0, d(null);
|
|
1870
1871
|
try {
|
|
1871
|
-
let r =
|
|
1872
|
+
let r = yt(), a = n.empty ? e.state.doc.textContent : e.state.doc.textBetween(n.from, n.to), o = [];
|
|
1872
1873
|
for await (let e of r.stream({
|
|
1873
1874
|
mode: t,
|
|
1874
1875
|
context: a,
|
|
@@ -1893,13 +1894,13 @@ function sn({ editor: e, onClose: t }) {
|
|
|
1893
1894
|
!e || !v.current || (e.scrollTop = e.scrollHeight);
|
|
1894
1895
|
}, [o]);
|
|
1895
1896
|
let k = b((t, n, r) => {
|
|
1896
|
-
let i = new Set(
|
|
1897
|
-
t === "replaceAll" ?
|
|
1898
|
-
let a =
|
|
1899
|
-
|
|
1897
|
+
let i = new Set(an(e, r.from, r.to).map((e) => e.src));
|
|
1898
|
+
t === "replaceAll" ? sn(e, n) : cn(e, n, "replace", h.current);
|
|
1899
|
+
let a = on(e);
|
|
1900
|
+
Qt(e, [...i].filter((e) => !a.has(e)));
|
|
1900
1901
|
}, [e]), A = b((n) => {
|
|
1901
1902
|
if (n === "below") {
|
|
1902
|
-
|
|
1903
|
+
cn(e, o, "below", h.current), t();
|
|
1903
1904
|
return;
|
|
1904
1905
|
}
|
|
1905
1906
|
let r = h.current, i = n === "replaceAll" ? {
|
|
@@ -1908,7 +1909,7 @@ function sn({ editor: e, onClose: t }) {
|
|
|
1908
1909
|
} : {
|
|
1909
1910
|
from: r.from,
|
|
1910
1911
|
to: r.to
|
|
1911
|
-
}, a =
|
|
1912
|
+
}, a = an(e, i.from, i.to);
|
|
1912
1913
|
if (a.length > 0) {
|
|
1913
1914
|
m({
|
|
1914
1915
|
position: n,
|
|
@@ -1949,19 +1950,19 @@ function sn({ editor: e, onClose: t }) {
|
|
|
1949
1950
|
className: "flex items-center justify-between pl-3 pr-1.5 py-1.5 border-b border-default-100 shrink-0",
|
|
1950
1951
|
children: [/* @__PURE__ */ O("span", {
|
|
1951
1952
|
className: "flex items-center gap-1.5 text-xs font-medium text-default-500",
|
|
1952
|
-
children: [/* @__PURE__ */ D(
|
|
1953
|
+
children: [/* @__PURE__ */ D(Ut, { className: "text-primary" }), f("editor.ai.trigger")]
|
|
1953
1954
|
}), /* @__PURE__ */ D("button", {
|
|
1954
1955
|
type: "button",
|
|
1955
1956
|
onClick: t,
|
|
1956
1957
|
"aria-label": f("editor.ai.close"),
|
|
1957
1958
|
title: f("editor.ai.close"),
|
|
1958
1959
|
className: "flex items-center justify-center w-6 h-6 rounded-md text-default-400 hover:bg-default-100 hover:text-default-700 transition-colors",
|
|
1959
|
-
children: /* @__PURE__ */ D(
|
|
1960
|
+
children: /* @__PURE__ */ D(Gt, {})
|
|
1960
1961
|
})]
|
|
1961
1962
|
}),
|
|
1962
1963
|
/* @__PURE__ */ D("div", {
|
|
1963
1964
|
className: "grid grid-cols-[repeat(auto-fit,minmax(64px,1fr))] gap-1.5 p-2 shrink-0",
|
|
1964
|
-
children:
|
|
1965
|
+
children: en.map(({ mode: e, labelKey: t, descKey: r, icon: i }) => /* @__PURE__ */ O("button", {
|
|
1965
1966
|
type: "button",
|
|
1966
1967
|
className: `flex flex-col items-center gap-1 px-1 py-2 rounded-xl border transition-colors ${n === e ? "border-primary/40 bg-primary/10 text-primary" : "border-default-200 text-default-600 hover:bg-default-100 hover:text-default-900"}`,
|
|
1967
1968
|
onClick: () => y(e),
|
|
@@ -2104,7 +2105,7 @@ function sn({ editor: e, onClose: t }) {
|
|
|
2104
2105
|
children: Object.entries(N).map(([e, t]) => /* @__PURE__ */ O("li", {
|
|
2105
2106
|
className: "text-sm text-default-700",
|
|
2106
2107
|
children: [
|
|
2107
|
-
f(
|
|
2108
|
+
f(nn[e] ?? e),
|
|
2108
2109
|
" ×",
|
|
2109
2110
|
t
|
|
2110
2111
|
]
|
|
@@ -2136,19 +2137,19 @@ function sn({ editor: e, onClose: t }) {
|
|
|
2136
2137
|
}
|
|
2137
2138
|
//#endregion
|
|
2138
2139
|
//#region src/editor/attachment-limits.ts
|
|
2139
|
-
var
|
|
2140
|
+
var un = /* @__PURE__ */ new Set([
|
|
2140
2141
|
"attachmentEmbed",
|
|
2141
2142
|
"videoEmbed",
|
|
2142
2143
|
"audioEmbed",
|
|
2143
2144
|
"image"
|
|
2144
2145
|
]);
|
|
2145
|
-
function
|
|
2146
|
+
function dn(e) {
|
|
2146
2147
|
let t = 0;
|
|
2147
2148
|
return e.descendants((e) => {
|
|
2148
|
-
|
|
2149
|
+
un.has(e.type.name) && (t += Number(e.attrs?.size) || 0);
|
|
2149
2150
|
}), t;
|
|
2150
2151
|
}
|
|
2151
|
-
function
|
|
2152
|
+
function fn(e) {
|
|
2152
2153
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
2153
2154
|
let t = [
|
|
2154
2155
|
"B",
|
|
@@ -2159,41 +2160,41 @@ function un(e) {
|
|
|
2159
2160
|
], n = Math.min(t.length - 1, Math.floor(Math.log(e) / Math.log(1024))), r = e / 1024 ** n;
|
|
2160
2161
|
return `${n === 0 || r >= 100 ? `${Math.round(r)}` : `${Math.round(r * 10) / 10}`} ${t[n]}`;
|
|
2161
2162
|
}
|
|
2162
|
-
function
|
|
2163
|
+
function pn(e) {
|
|
2163
2164
|
return (e?.storage)?.qingwuUI?.limits;
|
|
2164
2165
|
}
|
|
2165
|
-
function
|
|
2166
|
+
function mn(e, t, n) {
|
|
2166
2167
|
let { maxAttachmentSize: r, maxTotalAttachmentSize: i } = n;
|
|
2167
|
-
if (r && t.size > r) return `单文件大小不能超过 ${
|
|
2168
|
+
if (r && t.size > r) return `单文件大小不能超过 ${fn(r)}(当前 ${fn(t.size)})`;
|
|
2168
2169
|
if (i) {
|
|
2169
|
-
let n =
|
|
2170
|
-
if (n > i) return `附件总大小不能超过 ${
|
|
2170
|
+
let n = dn(e) + t.size;
|
|
2171
|
+
if (n > i) return `附件总大小不能超过 ${fn(i)}(当前合计 ${fn(n)})`;
|
|
2171
2172
|
}
|
|
2172
2173
|
return null;
|
|
2173
2174
|
}
|
|
2174
2175
|
//#endregion
|
|
2175
2176
|
//#region src/editor/utils/delete-confirm.ts
|
|
2176
|
-
var
|
|
2177
|
-
function
|
|
2178
|
-
return
|
|
2177
|
+
var hn = !1, gn = null, _n = 5e3;
|
|
2178
|
+
function vn() {
|
|
2179
|
+
return hn;
|
|
2179
2180
|
}
|
|
2180
2181
|
function $(e) {
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
},
|
|
2182
|
+
hn = e, gn &&= (clearTimeout(gn), null), e && (gn = setTimeout(() => {
|
|
2183
|
+
hn = !1, gn = null;
|
|
2184
|
+
}, _n));
|
|
2184
2185
|
}
|
|
2185
|
-
var
|
|
2186
|
-
function
|
|
2187
|
-
|
|
2186
|
+
var yn = null;
|
|
2187
|
+
function bn(e) {
|
|
2188
|
+
yn = e;
|
|
2188
2189
|
}
|
|
2189
|
-
function
|
|
2190
|
-
return
|
|
2190
|
+
function xn() {
|
|
2191
|
+
return yn;
|
|
2191
2192
|
}
|
|
2192
2193
|
//#endregion
|
|
2193
2194
|
//#region src/editor/utils/delete-confirm-dialog.tsx
|
|
2194
|
-
var
|
|
2195
|
-
function
|
|
2196
|
-
let [s, c] = T(!1), l = w(!1), u =
|
|
2195
|
+
var Sn = 300;
|
|
2196
|
+
function Cn({ open: e, title: t, message: n, confirmText: r = "删除", cancelText: i = "取消", onConfirm: a, onCancel: o }) {
|
|
2197
|
+
let [s, c] = T(!1), l = w(!1), u = xn();
|
|
2197
2198
|
return x(() => {
|
|
2198
2199
|
if (!e) {
|
|
2199
2200
|
l.current = !1;
|
|
@@ -2219,7 +2220,7 @@ function xn({ open: e, title: t, message: n, confirmText: r = "删除", cancelTe
|
|
|
2219
2220
|
o
|
|
2220
2221
|
]), x(() => {
|
|
2221
2222
|
e || c(!1);
|
|
2222
|
-
}, [e]), u || !e ? null :
|
|
2223
|
+
}, [e]), u || !e ? null : L(/* @__PURE__ */ D("div", {
|
|
2223
2224
|
className: "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none",
|
|
2224
2225
|
onClick: () => {
|
|
2225
2226
|
s || o();
|
|
@@ -2263,7 +2264,7 @@ function xn({ open: e, title: t, message: n, confirmText: r = "删除", cancelTe
|
|
|
2263
2264
|
await a();
|
|
2264
2265
|
} finally {
|
|
2265
2266
|
let t = Date.now() - e;
|
|
2266
|
-
t <
|
|
2267
|
+
t < Sn && await new Promise((e) => setTimeout(e, Sn - t)), c(!1), o();
|
|
2267
2268
|
}
|
|
2268
2269
|
},
|
|
2269
2270
|
disabled: s,
|
|
@@ -2276,18 +2277,18 @@ function xn({ open: e, title: t, message: n, confirmText: r = "删除", cancelTe
|
|
|
2276
2277
|
}
|
|
2277
2278
|
//#endregion
|
|
2278
2279
|
//#region src/editor/extensions/image-view.tsx
|
|
2279
|
-
function
|
|
2280
|
+
function wn(e) {
|
|
2280
2281
|
return /^(\.\.?\/|[a-zA-Z]:\\|file:\/\/)/.test(e) ? !0 : !(/^[a-z]+:\/\//i.test(e) || e.startsWith("/") || e.startsWith("data:") || e.startsWith("blob:"));
|
|
2281
2282
|
}
|
|
2282
|
-
function
|
|
2283
|
-
let [i, a] = T(!1), [o, s] = T(!1), [c, l] = T(!1), u = w(!1), [d, f] = T(!1), p = e.attrs.src || "", m = e.attrs.alt || "", h = e.attrs.width || null, g = e.attrs.height || null, _ = w(null), v = w(null), y = w(null), S = w(null), C = w(null), E = w(!1), k = w(!1), A = w(0), [j, M] = T(p), N = r?.isEditable ?? !0,
|
|
2283
|
+
function Tn({ node: e, deleteNode: t, editor: r }) {
|
|
2284
|
+
let [i, a] = T(!1), [o, s] = T(!1), [c, l] = T(!1), u = w(!1), [d, f] = T(!1), p = e.attrs.src || "", m = e.attrs.alt || "", h = e.attrs.width || null, g = e.attrs.height || null, _ = w(null), v = w(null), y = w(null), S = w(null), C = w(null), E = w(!1), k = w(!1), A = w(0), [j, M] = T(p), N = r?.isEditable ?? !0, ee = b(() => {
|
|
2284
2285
|
o || (A.current = window.scrollY, a(!0));
|
|
2285
|
-
}, [o]),
|
|
2286
|
+
}, [o]), F = b(() => {
|
|
2286
2287
|
a(!1), requestAnimationFrame(() => window.scrollTo(0, A.current));
|
|
2287
|
-
}, []),
|
|
2288
|
+
}, []), I = b(() => {
|
|
2288
2289
|
let e = _.current;
|
|
2289
2290
|
e && (A.current = window.scrollY, e.requestFullscreen ? e.requestFullscreen() : e.webkitRequestFullscreen && e.webkitRequestFullscreen());
|
|
2290
|
-
}, []),
|
|
2291
|
+
}, []), te = b(() => {
|
|
2291
2292
|
let e = v.current;
|
|
2292
2293
|
e && (A.current = window.scrollY, e.requestFullscreen ? e.requestFullscreen() : e.webkitRequestFullscreen && e.webkitRequestFullscreen());
|
|
2293
2294
|
}, []);
|
|
@@ -2332,20 +2333,20 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2332
2333
|
};
|
|
2333
2334
|
return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
|
|
2334
2335
|
}, []);
|
|
2335
|
-
let
|
|
2336
|
-
return /* @__PURE__ */ O(
|
|
2336
|
+
let ne = o || wn(p);
|
|
2337
|
+
return /* @__PURE__ */ O(P, {
|
|
2337
2338
|
as: "div",
|
|
2338
2339
|
className: "image-node-view group/img",
|
|
2339
2340
|
contentEditable: !1,
|
|
2340
2341
|
children: [
|
|
2341
|
-
|
|
2342
|
+
ne ? /* @__PURE__ */ O("div", {
|
|
2342
2343
|
className: "image-placeholder",
|
|
2343
2344
|
children: [
|
|
2344
2345
|
N && /* @__PURE__ */ D("button", {
|
|
2345
2346
|
type: "button",
|
|
2346
2347
|
className: "img-ctrl-btn img-ctrl-btn--del image-placeholder-del",
|
|
2347
2348
|
onClick: () => {
|
|
2348
|
-
|
|
2349
|
+
vn() || ($(!0), f(!0));
|
|
2349
2350
|
},
|
|
2350
2351
|
title: "删除",
|
|
2351
2352
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -2377,7 +2378,7 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2377
2378
|
}),
|
|
2378
2379
|
/* @__PURE__ */ D("span", {
|
|
2379
2380
|
className: "image-placeholder-text",
|
|
2380
|
-
children:
|
|
2381
|
+
children: wn(p) ? "本地图片无法加载" : "图片加载失败"
|
|
2381
2382
|
}),
|
|
2382
2383
|
/* @__PURE__ */ D("span", {
|
|
2383
2384
|
className: "image-placeholder-path",
|
|
@@ -2393,7 +2394,7 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2393
2394
|
alt: m,
|
|
2394
2395
|
width: h || void 0,
|
|
2395
2396
|
height: g || void 0,
|
|
2396
|
-
onClick:
|
|
2397
|
+
onClick: ee,
|
|
2397
2398
|
onError: () => {
|
|
2398
2399
|
E.current || o || (E.current = !0, (async () => {
|
|
2399
2400
|
try {
|
|
@@ -2419,7 +2420,7 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2419
2420
|
/* @__PURE__ */ D("button", {
|
|
2420
2421
|
type: "button",
|
|
2421
2422
|
className: "img-ctrl-btn",
|
|
2422
|
-
onClick:
|
|
2423
|
+
onClick: ee,
|
|
2423
2424
|
title: "网页全屏",
|
|
2424
2425
|
children: /* @__PURE__ */ D("svg", {
|
|
2425
2426
|
width: "14",
|
|
@@ -2438,7 +2439,7 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2438
2439
|
/* @__PURE__ */ D("button", {
|
|
2439
2440
|
type: "button",
|
|
2440
2441
|
className: "img-ctrl-btn",
|
|
2441
|
-
onClick:
|
|
2442
|
+
onClick: I,
|
|
2442
2443
|
title: "全屏",
|
|
2443
2444
|
children: /* @__PURE__ */ D("svg", {
|
|
2444
2445
|
width: "14",
|
|
@@ -2458,7 +2459,7 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2458
2459
|
type: "button",
|
|
2459
2460
|
className: "img-ctrl-btn img-ctrl-btn--del",
|
|
2460
2461
|
onClick: () => {
|
|
2461
|
-
|
|
2462
|
+
vn() || ($(!0), f(!0));
|
|
2462
2463
|
},
|
|
2463
2464
|
title: "删除",
|
|
2464
2465
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -2478,15 +2479,15 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2478
2479
|
]
|
|
2479
2480
|
})]
|
|
2480
2481
|
}),
|
|
2481
|
-
i && !
|
|
2482
|
+
i && !ne && /* @__PURE__ */ O("div", {
|
|
2482
2483
|
className: "image-lightbox",
|
|
2483
|
-
onClick:
|
|
2484
|
+
onClick: F,
|
|
2484
2485
|
children: [/* @__PURE__ */ O("div", {
|
|
2485
2486
|
className: "image-lightbox-bar",
|
|
2486
2487
|
children: [/* @__PURE__ */ D("button", {
|
|
2487
2488
|
type: "button",
|
|
2488
2489
|
className: "image-lightbox-bar-btn",
|
|
2489
|
-
onClick:
|
|
2490
|
+
onClick: te,
|
|
2490
2491
|
title: "全屏",
|
|
2491
2492
|
children: /* @__PURE__ */ D("svg", {
|
|
2492
2493
|
width: "18",
|
|
@@ -2504,7 +2505,7 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2504
2505
|
}), /* @__PURE__ */ D("button", {
|
|
2505
2506
|
type: "button",
|
|
2506
2507
|
className: "image-lightbox-bar-btn",
|
|
2507
|
-
onClick:
|
|
2508
|
+
onClick: F,
|
|
2508
2509
|
title: "关闭",
|
|
2509
2510
|
children: /* @__PURE__ */ D("svg", {
|
|
2510
2511
|
width: "18",
|
|
@@ -2545,16 +2546,16 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2545
2546
|
}
|
|
2546
2547
|
})]
|
|
2547
2548
|
}),
|
|
2548
|
-
/* @__PURE__ */ D(
|
|
2549
|
+
/* @__PURE__ */ D(Cn, {
|
|
2549
2550
|
open: d,
|
|
2550
2551
|
title: "确认删除图片",
|
|
2551
|
-
message:
|
|
2552
|
+
message: ne ? "该图片无法在当前环境加载,仅从编辑器中移除该图片节点,不影响存储文件。" : "此操作将同时删除对象存储中的文件,不可撤销。",
|
|
2552
2553
|
onCancel: () => {
|
|
2553
2554
|
$(!1), f(!1);
|
|
2554
2555
|
},
|
|
2555
2556
|
onConfirm: async () => {
|
|
2556
|
-
if (!
|
|
2557
|
-
await
|
|
2557
|
+
if (!ne) try {
|
|
2558
|
+
await Kt(p);
|
|
2558
2559
|
} catch {}
|
|
2559
2560
|
$(!1), await new Promise((e) => setTimeout(e, 300)), t();
|
|
2560
2561
|
}
|
|
@@ -2564,7 +2565,7 @@ function Cn({ node: e, deleteNode: t, editor: r }) {
|
|
|
2564
2565
|
}
|
|
2565
2566
|
//#endregion
|
|
2566
2567
|
//#region src/editor/embeds/attachment-view.tsx
|
|
2567
|
-
var
|
|
2568
|
+
var En = y(() => import("@file-viewer/react")), Dn = /* @__PURE__ */ new Set(), On = {
|
|
2568
2569
|
rendererMode: "replace",
|
|
2569
2570
|
autoRenderers: !0,
|
|
2570
2571
|
theme: "light",
|
|
@@ -2593,7 +2594,7 @@ var wn = y(() => import("@file-viewer/react")), Tn = /* @__PURE__ */ new Set(),
|
|
|
2593
2594
|
cache: !0,
|
|
2594
2595
|
workerTimeoutMs: 3e4
|
|
2595
2596
|
}
|
|
2596
|
-
},
|
|
2597
|
+
}, kn = {
|
|
2597
2598
|
pdf: "pdf",
|
|
2598
2599
|
docx: "word",
|
|
2599
2600
|
docm: "word",
|
|
@@ -2648,7 +2649,7 @@ var wn = y(() => import("@file-viewer/react")), Tn = /* @__PURE__ */ new Set(),
|
|
|
2648
2649
|
xml: "text",
|
|
2649
2650
|
yml: "text",
|
|
2650
2651
|
yaml: "text"
|
|
2651
|
-
},
|
|
2652
|
+
}, An = {
|
|
2652
2653
|
pdf: () => import("@file-viewer/renderer-pdf").then((e) => e.pdfRenderer),
|
|
2653
2654
|
word: () => import("@file-viewer/renderer-word").then((e) => e.wordRenderer),
|
|
2654
2655
|
spreadsheet: () => import("@file-viewer/renderer-spreadsheet").then((e) => e.spreadsheetRenderer),
|
|
@@ -2656,10 +2657,10 @@ var wn = y(() => import("@file-viewer/react")), Tn = /* @__PURE__ */ new Set(),
|
|
|
2656
2657
|
archive: () => import("@file-viewer/renderer-archive").then((e) => e.archiveRenderer),
|
|
2657
2658
|
text: () => import("@file-viewer/renderer-text").then((e) => e.textRenderer)
|
|
2658
2659
|
};
|
|
2659
|
-
function
|
|
2660
|
+
function jn(e) {
|
|
2660
2661
|
return e ? e < 1024 ? `${e} B` : e < 1048576 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1048576).toFixed(1)} MB` : "";
|
|
2661
2662
|
}
|
|
2662
|
-
function
|
|
2663
|
+
function Mn(e) {
|
|
2663
2664
|
let t = e.split(".").pop()?.toLowerCase() || "", n = {
|
|
2664
2665
|
pdf: {
|
|
2665
2666
|
label: "PDF",
|
|
@@ -2832,22 +2833,22 @@ function An(e) {
|
|
|
2832
2833
|
]
|
|
2833
2834
|
});
|
|
2834
2835
|
}
|
|
2835
|
-
function
|
|
2836
|
+
function Nn(e) {
|
|
2836
2837
|
return e.split(".").pop()?.toLowerCase() || "";
|
|
2837
2838
|
}
|
|
2838
|
-
function
|
|
2839
|
+
function Pn(e) {
|
|
2839
2840
|
let t = e.split(".").pop()?.toLowerCase() || "";
|
|
2840
2841
|
return /^(pdf|docx?|dotx?|xlsx?|xltx?|pptx?|potx?|txt|md|html?|csv|json|xml|yml|yaml|log|zip|rar|7z|tar|gz|odt|ods|odp|rtf|xlsm|xlsb|ppsx|numbers|tgz|bz2|xz|zst|js|ts|tsx|py|sh|sql)$/.test(t);
|
|
2841
2842
|
}
|
|
2842
|
-
function
|
|
2843
|
+
function Fn(e) {
|
|
2843
2844
|
return !!e && !e.startsWith("file:");
|
|
2844
2845
|
}
|
|
2845
|
-
function
|
|
2846
|
+
function In(e) {
|
|
2846
2847
|
return btoa(encodeURIComponent(e)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
2847
2848
|
}
|
|
2848
|
-
async function
|
|
2849
|
+
async function Ln(e, t) {
|
|
2849
2850
|
try {
|
|
2850
|
-
let n =
|
|
2851
|
+
let n = In(e), r = await fetch(`/api/preview/${n}`, {
|
|
2851
2852
|
signal: t,
|
|
2852
2853
|
cache: "no-store"
|
|
2853
2854
|
});
|
|
@@ -2859,7 +2860,7 @@ async function Fn(e, t) {
|
|
|
2859
2860
|
return null;
|
|
2860
2861
|
}
|
|
2861
2862
|
}
|
|
2862
|
-
function
|
|
2863
|
+
function Rn(e, t, n) {
|
|
2863
2864
|
return new Promise((r, i) => {
|
|
2864
2865
|
let a = new XMLHttpRequest();
|
|
2865
2866
|
if (a.open("GET", e, !0), a.responseType = "arraybuffer", t) {
|
|
@@ -2897,51 +2898,51 @@ function In(e, t, n) {
|
|
|
2897
2898
|
a.send();
|
|
2898
2899
|
});
|
|
2899
2900
|
}
|
|
2900
|
-
function
|
|
2901
|
-
let o = a?.isEditable ?? !0, s = e.attrs.src || "", [c, l] = T(() =>
|
|
2901
|
+
function zn({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
2902
|
+
let o = a?.isEditable ?? !0, s = e.attrs.src || "", [c, l] = T(() => Dn.has(s)), [u, d] = T(null), [p, m] = T(null), [h, g] = T(!1), [_, y] = T(null), [S, E] = T(!1), [k, A] = T(null), j = w(null), M = w(null), N = w(null), ee = w(0), F = w(!1), I = w(null), te = w(0), [ne, L] = T(!1), R = w(null), [re, ie] = T(0), [z, B] = T("none"), [V, H] = T(void 0), [ae, oe] = T(!1), U = e.attrs.src || "", W = e.attrs.name || U && U.split("/").pop()?.split("?")[0] || (U ? "attachment" : f("editor.attachment.lost")), se = e.attrs.size || 0, G = Nn(W), K = !U;
|
|
2902
2903
|
x(() => {
|
|
2903
2904
|
if (!c) {
|
|
2904
2905
|
H(void 0), oe(!1);
|
|
2905
2906
|
return;
|
|
2906
2907
|
}
|
|
2907
|
-
let e =
|
|
2908
|
+
let e = kn[G];
|
|
2908
2909
|
if (!e) {
|
|
2909
2910
|
H(void 0), oe(!1);
|
|
2910
2911
|
return;
|
|
2911
2912
|
}
|
|
2912
2913
|
let t = !0;
|
|
2913
|
-
return H(void 0), oe(!1),
|
|
2914
|
+
return H(void 0), oe(!1), An[e]().then((e) => {
|
|
2914
2915
|
t && H(e);
|
|
2915
2916
|
}).catch((n) => {
|
|
2916
2917
|
console.error(`[attachment] renderer "${e}" load failed:`, n), t && oe(!0);
|
|
2917
2918
|
}), () => {
|
|
2918
2919
|
t = !1;
|
|
2919
2920
|
};
|
|
2920
|
-
}, [c,
|
|
2921
|
-
let
|
|
2922
|
-
...
|
|
2921
|
+
}, [c, G]);
|
|
2922
|
+
let ce = C(() => ({
|
|
2923
|
+
...On,
|
|
2923
2924
|
renderers: V ? [V] : [],
|
|
2924
2925
|
rendererMode: "replace"
|
|
2925
|
-
}), [V]),
|
|
2926
|
+
}), [V]), q = b((e) => {
|
|
2926
2927
|
l((t) => {
|
|
2927
2928
|
let n = typeof e == "function" ? e(t) : e;
|
|
2928
|
-
return U && (n ?
|
|
2929
|
+
return U && (n ? Dn.add(U) : Dn.delete(U)), n;
|
|
2929
2930
|
});
|
|
2930
2931
|
}, [U]);
|
|
2931
2932
|
x(() => {
|
|
2932
|
-
l(U ?
|
|
2933
|
+
l(U ? Dn.has(U) : !1);
|
|
2933
2934
|
}, [U]);
|
|
2934
2935
|
let le = b(() => {
|
|
2935
|
-
|
|
2936
|
-
window.scrollTo(0,
|
|
2936
|
+
F.current = !0, q(!0), window.setTimeout(() => {
|
|
2937
|
+
window.scrollTo(0, ee.current), I.current && (I.current.scrollTop = te.current), F.current && q(!0), F.current = !1;
|
|
2937
2938
|
}, 0);
|
|
2938
|
-
}, [
|
|
2939
|
-
z === "web" ? (B("none"), document.body.style.overflow = "", le()) : (z === "native" && document.fullscreenElement && await document.exitFullscreen(),
|
|
2939
|
+
}, [q]), ue = b(async () => {
|
|
2940
|
+
z === "web" ? (B("none"), document.body.style.overflow = "", le()) : (z === "native" && document.fullscreenElement && await document.exitFullscreen(), ee.current = window.scrollY, te.current = I.current?.scrollTop ?? 0, document.body.style.overflow = "hidden", B("web"));
|
|
2940
2941
|
}, [z]), de = b(async () => {
|
|
2941
2942
|
let e = M.current;
|
|
2942
|
-
e && (z === "native" ? await document.exitFullscreen() : (z === "web" && (B("none"), document.body.style.overflow = ""),
|
|
2943
|
+
e && (z === "native" ? await document.exitFullscreen() : (z === "web" && (B("none"), document.body.style.overflow = ""), ee.current = window.scrollY, te.current = I.current?.scrollTop ?? 0, await e.requestFullscreen(), B("native")));
|
|
2943
2944
|
}, [z, le]), fe = b(() => {
|
|
2944
|
-
z === "none" && (
|
|
2945
|
+
z === "none" && (F.current || q((e) => !e));
|
|
2945
2946
|
}, [z]);
|
|
2946
2947
|
x(() => {
|
|
2947
2948
|
let e = () => {
|
|
@@ -2954,7 +2955,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
2954
2955
|
};
|
|
2955
2956
|
}, [z, le]), x(() => {
|
|
2956
2957
|
let e = (e) => {
|
|
2957
|
-
if (e.key !== "Backspace" && e.key !== "Delete" || !o || !i ||
|
|
2958
|
+
if (e.key !== "Backspace" && e.key !== "Delete" || !o || !i || vn()) return;
|
|
2958
2959
|
let t = a?.view?.dom, n = e.target;
|
|
2959
2960
|
if (a?.isFocused && n instanceof Node && t?.contains(n)) {
|
|
2960
2961
|
if (e.preventDefault(), e.stopPropagation(), a) {
|
|
@@ -2964,7 +2965,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
2964
2965
|
to: t
|
|
2965
2966
|
};
|
|
2966
2967
|
}
|
|
2967
|
-
window.getSelection()?.removeAllRanges(), $(!0),
|
|
2968
|
+
window.getSelection()?.removeAllRanges(), $(!0), L(!0);
|
|
2968
2969
|
}
|
|
2969
2970
|
};
|
|
2970
2971
|
return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
|
|
@@ -2973,7 +2974,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
2973
2974
|
a,
|
|
2974
2975
|
o
|
|
2975
2976
|
]), x(() => {
|
|
2976
|
-
if (!c || !
|
|
2977
|
+
if (!c || !Fn(U)) {
|
|
2977
2978
|
d(null), y(null), N.current = null;
|
|
2978
2979
|
return;
|
|
2979
2980
|
}
|
|
@@ -2981,9 +2982,9 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
2981
2982
|
let e = new AbortController(), r = !0;
|
|
2982
2983
|
return g(!0), y(null), (async () => {
|
|
2983
2984
|
let i = U.includes("?X-Amz-"), a = null, o = null;
|
|
2984
|
-
if (!a && !i && (a = await
|
|
2985
|
+
if (!a && !i && (a = await Ln(U, e.signal)), !a && !i) try {
|
|
2985
2986
|
let n = await t(U);
|
|
2986
|
-
n && (a = await
|
|
2987
|
+
n && (a = await Ln(n, e.signal) || await Rn(n, void 0, e.signal));
|
|
2987
2988
|
} catch (e) {
|
|
2988
2989
|
console.warn("[attachment] signPreviewUrl failed:", e);
|
|
2989
2990
|
}
|
|
@@ -2995,7 +2996,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
2995
2996
|
n[t] = e;
|
|
2996
2997
|
});
|
|
2997
2998
|
try {
|
|
2998
|
-
a = await
|
|
2999
|
+
a = await Rn(U, n, e.signal);
|
|
2999
3000
|
} catch (e) {
|
|
3000
3001
|
console.warn("[attachment] signed headers XHR failed:", e), o = e instanceof Error ? e : Error(String(e));
|
|
3001
3002
|
}
|
|
@@ -3004,7 +3005,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3004
3005
|
console.warn("[attachment] signPreviewUrlHeaders failed:", e);
|
|
3005
3006
|
}
|
|
3006
3007
|
if (!a) try {
|
|
3007
|
-
a = await
|
|
3008
|
+
a = await Rn(U, i ? void 0 : { "X-Requested-With": "XMLHttpRequest" }, e.signal);
|
|
3008
3009
|
} catch (e) {
|
|
3009
3010
|
console.warn("[attachment] plain XHR failed:", e), o = e instanceof Error ? e : Error(String(e));
|
|
3010
3011
|
}
|
|
@@ -3033,7 +3034,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3033
3034
|
let e = window.setTimeout(() => A(null), 2400);
|
|
3034
3035
|
return () => window.clearTimeout(e);
|
|
3035
3036
|
}, [k]);
|
|
3036
|
-
let
|
|
3037
|
+
let J = b(async () => {
|
|
3037
3038
|
E(!0), A("loading");
|
|
3038
3039
|
try {
|
|
3039
3040
|
if (p) {
|
|
@@ -3066,7 +3067,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3066
3067
|
W,
|
|
3067
3068
|
p
|
|
3068
3069
|
]);
|
|
3069
|
-
return /* @__PURE__ */ O(
|
|
3070
|
+
return /* @__PURE__ */ O(P, {
|
|
3070
3071
|
ref: j,
|
|
3071
3072
|
as: "div",
|
|
3072
3073
|
className: `attachment-embed group/att ${i ? "is-selected" : ""}`,
|
|
@@ -3083,7 +3084,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3083
3084
|
className: "att-info",
|
|
3084
3085
|
children: [/* @__PURE__ */ D("span", {
|
|
3085
3086
|
className: "att-icon",
|
|
3086
|
-
children:
|
|
3087
|
+
children: K ? /* @__PURE__ */ O("svg", {
|
|
3087
3088
|
width: "22",
|
|
3088
3089
|
height: "22",
|
|
3089
3090
|
viewBox: "0 0 24 24",
|
|
@@ -3099,15 +3100,15 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3099
3100
|
/* @__PURE__ */ D("path", { d: "M12 9v4" }),
|
|
3100
3101
|
/* @__PURE__ */ D("path", { d: "M12 17h.01" })
|
|
3101
3102
|
]
|
|
3102
|
-
}) :
|
|
3103
|
+
}) : Mn(W)
|
|
3103
3104
|
}), /* @__PURE__ */ O("div", {
|
|
3104
3105
|
className: "att-meta",
|
|
3105
3106
|
children: [/* @__PURE__ */ D("span", {
|
|
3106
3107
|
className: "att-name",
|
|
3107
3108
|
children: W
|
|
3108
|
-
}),
|
|
3109
|
+
}), se > 0 && /* @__PURE__ */ D("span", {
|
|
3109
3110
|
className: "att-size",
|
|
3110
|
-
children:
|
|
3111
|
+
children: jn(se)
|
|
3111
3112
|
})]
|
|
3112
3113
|
})]
|
|
3113
3114
|
}), /* @__PURE__ */ O("div", {
|
|
@@ -3160,7 +3161,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3160
3161
|
}), /* @__PURE__ */ O("div", {
|
|
3161
3162
|
className: "att-actions",
|
|
3162
3163
|
children: [
|
|
3163
|
-
U &&
|
|
3164
|
+
U && Pn(W) && /* @__PURE__ */ D("button", {
|
|
3164
3165
|
type: "button",
|
|
3165
3166
|
className: "att-btn",
|
|
3166
3167
|
onMouseDown: (e) => {
|
|
@@ -3190,8 +3191,8 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3190
3191
|
/* @__PURE__ */ D("button", {
|
|
3191
3192
|
type: "button",
|
|
3192
3193
|
className: "att-btn",
|
|
3193
|
-
onClick:
|
|
3194
|
-
disabled: S ||
|
|
3194
|
+
onClick: J,
|
|
3195
|
+
disabled: S || K,
|
|
3195
3196
|
title: S ? "正在准备下载" : f("editor.attachment.download"),
|
|
3196
3197
|
"aria-label": S ? "正在准备下载" : f("editor.attachment.download"),
|
|
3197
3198
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -3213,7 +3214,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3213
3214
|
type: "button",
|
|
3214
3215
|
className: "att-btn att-btn--del",
|
|
3215
3216
|
onClick: () => {
|
|
3216
|
-
!o ||
|
|
3217
|
+
!o || vn() || ($(!0), L(!0));
|
|
3217
3218
|
},
|
|
3218
3219
|
title: f("editor.attachment.delete"),
|
|
3219
3220
|
"aria-label": f("editor.attachment.delete"),
|
|
@@ -3245,7 +3246,7 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3245
3246
|
background: "#fff"
|
|
3246
3247
|
},
|
|
3247
3248
|
children: [/* @__PURE__ */ D("div", {
|
|
3248
|
-
ref:
|
|
3249
|
+
ref: I,
|
|
3249
3250
|
className: "att-preview-scroll",
|
|
3250
3251
|
style: {
|
|
3251
3252
|
height: "100%",
|
|
@@ -3269,14 +3270,14 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3269
3270
|
style: { background: "#fff" },
|
|
3270
3271
|
children: f("editor.attachment.loadingPreview")
|
|
3271
3272
|
}),
|
|
3272
|
-
children: u || p || U ? V ? /* @__PURE__ */ D(
|
|
3273
|
+
children: u || p || U ? V ? /* @__PURE__ */ D(En, {
|
|
3273
3274
|
buffer: u || void 0,
|
|
3274
3275
|
url: p || U,
|
|
3275
3276
|
name: W,
|
|
3276
3277
|
filename: W,
|
|
3277
|
-
type:
|
|
3278
|
-
size:
|
|
3279
|
-
options:
|
|
3278
|
+
type: G,
|
|
3279
|
+
size: se || u?.byteLength || 0,
|
|
3280
|
+
options: ce
|
|
3280
3281
|
}, `${U}-${re}`) : /* @__PURE__ */ D("div", {
|
|
3281
3282
|
className: "flex h-full items-center justify-center text-sm text-default-400",
|
|
3282
3283
|
children: "正在加载预览引擎..."
|
|
@@ -3381,24 +3382,24 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3381
3382
|
})]
|
|
3382
3383
|
})]
|
|
3383
3384
|
})]
|
|
3384
|
-
}), /* @__PURE__ */ D(
|
|
3385
|
-
open:
|
|
3385
|
+
}), /* @__PURE__ */ D(Cn, {
|
|
3386
|
+
open: ne,
|
|
3386
3387
|
title: "确认删除附件",
|
|
3387
|
-
message:
|
|
3388
|
+
message: K ? "此操作将删除该附件节点,不可撤销。" : `此操作将同时删除对象存储中的文件(${W}),不可撤销。`,
|
|
3388
3389
|
onCancel: () => {
|
|
3389
|
-
$(!1),
|
|
3390
|
+
$(!1), L(!1);
|
|
3390
3391
|
},
|
|
3391
3392
|
onConfirm: async () => {
|
|
3392
3393
|
try {
|
|
3393
3394
|
if (a) {
|
|
3394
3395
|
let e = R.current, t = e?.from ?? a.state.selection.from, n = e?.to ?? a.state.selection.to, r = [];
|
|
3395
3396
|
a.state.doc.nodesBetween(t, n, (e) => {
|
|
3396
|
-
e.type.name === "attachmentEmbed" && e.attrs?.src && r.push(
|
|
3397
|
+
e.type.name === "attachmentEmbed" && e.attrs?.src && r.push(Kt(e.attrs.src));
|
|
3397
3398
|
}), await Promise.all(r), $(!1), await new Promise((e) => setTimeout(e, 300)), a.chain().focus().setTextSelection({
|
|
3398
3399
|
from: t,
|
|
3399
3400
|
to: n
|
|
3400
3401
|
}).deleteSelection().run();
|
|
3401
|
-
} else await
|
|
3402
|
+
} else await Kt(U), $(!1), await new Promise((e) => setTimeout(e, 300)), r();
|
|
3402
3403
|
} catch {
|
|
3403
3404
|
$(!1);
|
|
3404
3405
|
}
|
|
@@ -3408,13 +3409,13 @@ function Ln({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3408
3409
|
}
|
|
3409
3410
|
//#endregion
|
|
3410
3411
|
//#region src/editor/embeds/attachment.ts
|
|
3411
|
-
var
|
|
3412
|
+
var Bn = ie.create({
|
|
3412
3413
|
name: "attachmentEmbed",
|
|
3413
3414
|
group: "block",
|
|
3414
3415
|
atom: !0,
|
|
3415
3416
|
inline: !1,
|
|
3416
3417
|
addNodeView() {
|
|
3417
|
-
return
|
|
3418
|
+
return F(zn);
|
|
3418
3419
|
},
|
|
3419
3420
|
addAttributes() {
|
|
3420
3421
|
return {
|
|
@@ -3463,7 +3464,7 @@ var Rn = re.create({
|
|
|
3463
3464
|
});
|
|
3464
3465
|
//#endregion
|
|
3465
3466
|
//#region src/editor/embeds/audio-view.tsx
|
|
3466
|
-
function
|
|
3467
|
+
function Vn({ node: e, deleteNode: t, editor: r }) {
|
|
3467
3468
|
let i = e.attrs.src || "", a = e.attrs.name || i.split("/").pop()?.split("?")[0] || "audio", [o, s] = T(!1), c = r?.isEditable ?? !0;
|
|
3468
3469
|
x(() => () => {
|
|
3469
3470
|
i.startsWith("blob:") && URL.revokeObjectURL(i);
|
|
@@ -3495,7 +3496,7 @@ function zn({ node: e, deleteNode: t, editor: r }) {
|
|
|
3495
3496
|
})(), () => {
|
|
3496
3497
|
e = !0, m.current &&= (URL.revokeObjectURL(m.current), null);
|
|
3497
3498
|
};
|
|
3498
|
-
}, [i]), /* @__PURE__ */ O(
|
|
3499
|
+
}, [i]), /* @__PURE__ */ O(P, {
|
|
3499
3500
|
as: "div",
|
|
3500
3501
|
className: "audio-embed group/audio",
|
|
3501
3502
|
style: { margin: "1rem 0" },
|
|
@@ -3529,7 +3530,7 @@ function zn({ node: e, deleteNode: t, editor: r }) {
|
|
|
3529
3530
|
type: "button",
|
|
3530
3531
|
className: "audio-embed-btn audio-embed-btn--del",
|
|
3531
3532
|
onClick: () => {
|
|
3532
|
-
|
|
3533
|
+
vn() || ($(!0), s(!0));
|
|
3533
3534
|
},
|
|
3534
3535
|
title: "删除",
|
|
3535
3536
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -3575,7 +3576,7 @@ function zn({ node: e, deleteNode: t, editor: r }) {
|
|
|
3575
3576
|
}), "音频文件缺失"]
|
|
3576
3577
|
})
|
|
3577
3578
|
})]
|
|
3578
|
-
}), /* @__PURE__ */ D(
|
|
3579
|
+
}), /* @__PURE__ */ D(Cn, {
|
|
3579
3580
|
open: o,
|
|
3580
3581
|
title: "确认删除音频",
|
|
3581
3582
|
message: `此操作将同时删除对象存储中的文件(${a}),不可撤销。`,
|
|
@@ -3584,7 +3585,7 @@ function zn({ node: e, deleteNode: t, editor: r }) {
|
|
|
3584
3585
|
},
|
|
3585
3586
|
onConfirm: async () => {
|
|
3586
3587
|
try {
|
|
3587
|
-
await
|
|
3588
|
+
await Kt(i);
|
|
3588
3589
|
} catch {}
|
|
3589
3590
|
$(!1), await new Promise((e) => setTimeout(e, 300)), t();
|
|
3590
3591
|
}
|
|
@@ -3593,25 +3594,25 @@ function zn({ node: e, deleteNode: t, editor: r }) {
|
|
|
3593
3594
|
}
|
|
3594
3595
|
//#endregion
|
|
3595
3596
|
//#region src/editor/embeds/audio.ts
|
|
3596
|
-
function
|
|
3597
|
+
function Hn(e) {
|
|
3597
3598
|
return /\.(mp3|wav|ogg|flac|aac|m4a|wma|opus)(\?|$)/i.test(e) || /\/.*\.(mp3|wav|ogg|flac)/i.test(e);
|
|
3598
3599
|
}
|
|
3599
|
-
var
|
|
3600
|
+
var Un = ie.create({
|
|
3600
3601
|
name: "audioEmbed",
|
|
3601
3602
|
group: "block",
|
|
3602
3603
|
atom: !0,
|
|
3603
3604
|
inline: !1,
|
|
3604
3605
|
addNodeView() {
|
|
3605
|
-
return
|
|
3606
|
+
return F(Vn);
|
|
3606
3607
|
},
|
|
3607
3608
|
addProseMirrorPlugins() {
|
|
3608
|
-
return [new
|
|
3609
|
+
return [new V({ props: { handlePaste(e, t) {
|
|
3609
3610
|
let n = t.clipboardData?.getData("text/plain");
|
|
3610
3611
|
if (!n) return !1;
|
|
3611
3612
|
let r = n.split(/\r?\n/);
|
|
3612
3613
|
for (let n of r) {
|
|
3613
3614
|
let r = n.trim();
|
|
3614
|
-
if (!r || r.includes(" ") || !
|
|
3615
|
+
if (!r || r.includes(" ") || !Hn(r)) continue;
|
|
3615
3616
|
t.preventDefault();
|
|
3616
3617
|
let i = e.state.schema.nodes.audioEmbed.create({ src: r });
|
|
3617
3618
|
return e.dispatch(e.state.tr.replaceSelectionWith(i)), !0;
|
|
@@ -3658,17 +3659,17 @@ var Vn = re.create({
|
|
|
3658
3659
|
});
|
|
3659
3660
|
//#endregion
|
|
3660
3661
|
//#region src/editor/embeds/video-view.tsx
|
|
3661
|
-
function
|
|
3662
|
+
function Wn(e) {
|
|
3662
3663
|
return e ? /bilibili\.com|BV[a-zA-Z0-9]{10}|av\d+/i.test(e) ? "bilibili" : /xiaohongshu\.com|xhslink\.com/i.test(e) ? "xiaohongshu" : /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|$)/i.test(e) || /\/.*\.(mp4|m3u8|mov|webm|flv|mkv)/i.test(e) ? "direct" : "unknown" : "unknown";
|
|
3663
3664
|
}
|
|
3664
|
-
function
|
|
3665
|
+
function Gn(e) {
|
|
3665
3666
|
let t = e.match(/BV[a-zA-Z0-9]{10}/);
|
|
3666
3667
|
if (t) return t[0];
|
|
3667
3668
|
let n = e.match(/av(\d+)/i);
|
|
3668
3669
|
return n ? n[0] : e;
|
|
3669
3670
|
}
|
|
3670
|
-
function
|
|
3671
|
-
let r = e.attrs.src || "", i = e.attrs.source || "unknown", a = i === "unknown" ?
|
|
3671
|
+
function Kn({ node: e, deleteNode: t, editor: n }) {
|
|
3672
|
+
let r = e.attrs.src || "", i = e.attrs.source || "unknown", a = i === "unknown" ? Wn(r) : i, [o, s] = T(!1), [c, l] = T(!1), [u, d] = T(!1), f = n?.isEditable ?? !0, p = !f && r.startsWith("blob:"), m = /* @__PURE__ */ D(Cn, {
|
|
3672
3673
|
open: o,
|
|
3673
3674
|
title: "确认删除视频",
|
|
3674
3675
|
message: "此操作将同时删除对象存储中的文件,不可撤销。",
|
|
@@ -3677,7 +3678,7 @@ function Wn({ node: e, deleteNode: t, editor: n }) {
|
|
|
3677
3678
|
},
|
|
3678
3679
|
onConfirm: async () => {
|
|
3679
3680
|
try {
|
|
3680
|
-
await
|
|
3681
|
+
await Kt(r);
|
|
3681
3682
|
} catch {}
|
|
3682
3683
|
$(!1), await new Promise((e) => setTimeout(e, 300)), t();
|
|
3683
3684
|
}
|
|
@@ -3691,7 +3692,7 @@ function Wn({ node: e, deleteNode: t, editor: n }) {
|
|
|
3691
3692
|
e && (e.style.position === "fixed" ? A() : (e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "99999", e.style.borderRadius = "0", document.body.style.overflow = "hidden"));
|
|
3692
3693
|
}, [A]), N = b(() => {
|
|
3693
3694
|
k.current = window.scrollY, S.current?.requestFullscreen?.();
|
|
3694
|
-
}, []),
|
|
3695
|
+
}, []), ee = b(() => {
|
|
3695
3696
|
let e = v.current?.closest(".video-embed--direct") || v.current;
|
|
3696
3697
|
e && (k.current = window.scrollY, e.requestFullscreen?.());
|
|
3697
3698
|
}, []);
|
|
@@ -3780,8 +3781,8 @@ function Wn({ node: e, deleteNode: t, editor: n }) {
|
|
|
3780
3781
|
}, [a, h]), x(() => {
|
|
3781
3782
|
u && (_.current?.destroy(), _.current = null);
|
|
3782
3783
|
}, [u]), a === "bilibili") {
|
|
3783
|
-
let e =
|
|
3784
|
-
return /* @__PURE__ */ O(
|
|
3784
|
+
let e = Gn(r);
|
|
3785
|
+
return /* @__PURE__ */ O(P, {
|
|
3785
3786
|
as: "div",
|
|
3786
3787
|
className: "video-embed video-embed--bilibili group/video",
|
|
3787
3788
|
style: { margin: "1rem 0" },
|
|
@@ -3857,7 +3858,7 @@ function Wn({ node: e, deleteNode: t, editor: n }) {
|
|
|
3857
3858
|
className: "video-fs-btn video-fs-btn--del",
|
|
3858
3859
|
title: "删除",
|
|
3859
3860
|
onClick: () => {
|
|
3860
|
-
|
|
3861
|
+
vn() || ($(!0), s(!0));
|
|
3861
3862
|
},
|
|
3862
3863
|
children: /* @__PURE__ */ D("svg", {
|
|
3863
3864
|
width: "12",
|
|
@@ -3899,7 +3900,7 @@ function Wn({ node: e, deleteNode: t, editor: n }) {
|
|
|
3899
3900
|
}), m]
|
|
3900
3901
|
});
|
|
3901
3902
|
}
|
|
3902
|
-
return a === "xiaohongshu" ? /* @__PURE__ */ O(
|
|
3903
|
+
return a === "xiaohongshu" ? /* @__PURE__ */ O(P, {
|
|
3903
3904
|
as: "div",
|
|
3904
3905
|
className: "video-embed video-embed--xiaohongshu",
|
|
3905
3906
|
style: {
|
|
@@ -3945,7 +3946,7 @@ function Wn({ node: e, deleteNode: t, editor: n }) {
|
|
|
3945
3946
|
},
|
|
3946
3947
|
children: "在小红书中打开 →"
|
|
3947
3948
|
})] })]
|
|
3948
|
-
}) : /* @__PURE__ */ O(
|
|
3949
|
+
}) : /* @__PURE__ */ O(P, {
|
|
3949
3950
|
as: "div",
|
|
3950
3951
|
className: "video-embed video-embed--direct group/video",
|
|
3951
3952
|
style: {
|
|
@@ -3964,7 +3965,7 @@ function Wn({ node: e, deleteNode: t, editor: n }) {
|
|
|
3964
3965
|
className: "video-fs-btn video-fs-btn--del",
|
|
3965
3966
|
title: "删除",
|
|
3966
3967
|
onClick: () => {
|
|
3967
|
-
|
|
3968
|
+
vn() || ($(!0), s(!0));
|
|
3968
3969
|
},
|
|
3969
3970
|
children: /* @__PURE__ */ D("svg", {
|
|
3970
3971
|
width: "12",
|
|
@@ -3983,7 +3984,7 @@ function Wn({ node: e, deleteNode: t, editor: n }) {
|
|
|
3983
3984
|
type: "button",
|
|
3984
3985
|
className: "video-fs-btn",
|
|
3985
3986
|
title: "全屏",
|
|
3986
|
-
onClick:
|
|
3987
|
+
onClick: ee,
|
|
3987
3988
|
children: /* @__PURE__ */ D("svg", {
|
|
3988
3989
|
width: "12",
|
|
3989
3990
|
height: "12",
|
|
@@ -4121,33 +4122,33 @@ function Wn({ node: e, deleteNode: t, editor: n }) {
|
|
|
4121
4122
|
}
|
|
4122
4123
|
//#endregion
|
|
4123
4124
|
//#region src/editor/embeds/video.ts
|
|
4124
|
-
function
|
|
4125
|
+
function qn(e) {
|
|
4125
4126
|
return /bilibili\.com|BV[a-zA-Z0-9]{10}|av\d+/i.test(e) ? "bilibili" : /xiaohongshu\.com|xhslink\.com/i.test(e) ? "xiaohongshu" : /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|$)/i.test(e) || /\/.*\.(mp4|m3u8|mov|webm|flv|mkv)/i.test(e) ? "direct" : "unknown";
|
|
4126
4127
|
}
|
|
4127
|
-
function
|
|
4128
|
+
function Jn(e) {
|
|
4128
4129
|
let t = e.match(/BV[a-zA-Z0-9]{10}/);
|
|
4129
4130
|
if (t) return t[0];
|
|
4130
4131
|
let n = e.match(/av(\d+)/i);
|
|
4131
4132
|
return n ? n[0] : e;
|
|
4132
4133
|
}
|
|
4133
|
-
function
|
|
4134
|
+
function Yn(e) {
|
|
4134
4135
|
let t = e.match(/explore\/([a-zA-Z0-9]+)/);
|
|
4135
4136
|
return t ? t[1] : e;
|
|
4136
4137
|
}
|
|
4137
|
-
var
|
|
4138
|
+
var Xn = ie.create({
|
|
4138
4139
|
name: "videoEmbed",
|
|
4139
4140
|
group: "block",
|
|
4140
4141
|
atom: !0,
|
|
4141
4142
|
inline: !1,
|
|
4142
4143
|
addNodeView() {
|
|
4143
|
-
return
|
|
4144
|
+
return F(Kn);
|
|
4144
4145
|
},
|
|
4145
4146
|
addProseMirrorPlugins() {
|
|
4146
|
-
return [new
|
|
4147
|
+
return [new V({ props: {
|
|
4147
4148
|
handleKeyDown(e, t) {
|
|
4148
4149
|
if (t.key !== " ") return !1;
|
|
4149
4150
|
let n = e.state.selection;
|
|
4150
|
-
if (n instanceof
|
|
4151
|
+
if (n instanceof B && n.node.type.name === "videoEmbed") {
|
|
4151
4152
|
t.preventDefault();
|
|
4152
4153
|
let r = e.nodeDOM(n.from);
|
|
4153
4154
|
if (r) {
|
|
@@ -4165,7 +4166,7 @@ var Jn = re.create({
|
|
|
4165
4166
|
for (let n of r) {
|
|
4166
4167
|
let r = n.trim();
|
|
4167
4168
|
if (!r || r.includes(" ")) continue;
|
|
4168
|
-
let i =
|
|
4169
|
+
let i = qn(r);
|
|
4169
4170
|
if (i === "unknown") continue;
|
|
4170
4171
|
t.preventDefault();
|
|
4171
4172
|
let a = e.state.schema.nodes.videoEmbed.create({
|
|
@@ -4197,7 +4198,7 @@ var Jn = re.create({
|
|
|
4197
4198
|
let t = e, n = t.getAttribute("src") || t.getAttribute("data-src") || "";
|
|
4198
4199
|
return {
|
|
4199
4200
|
src: n,
|
|
4200
|
-
source:
|
|
4201
|
+
source: qn(n)
|
|
4201
4202
|
};
|
|
4202
4203
|
}
|
|
4203
4204
|
},
|
|
@@ -4206,9 +4207,9 @@ var Jn = re.create({
|
|
|
4206
4207
|
];
|
|
4207
4208
|
},
|
|
4208
4209
|
renderHTML({ HTMLAttributes: e }) {
|
|
4209
|
-
let t = e.src || "", n =
|
|
4210
|
+
let t = e.src || "", n = qn(t);
|
|
4210
4211
|
if (n === "bilibili") {
|
|
4211
|
-
let e =
|
|
4212
|
+
let e = Jn(t);
|
|
4212
4213
|
return [
|
|
4213
4214
|
"div",
|
|
4214
4215
|
{
|
|
@@ -4229,7 +4230,7 @@ var Jn = re.create({
|
|
|
4229
4230
|
}]
|
|
4230
4231
|
];
|
|
4231
4232
|
}
|
|
4232
|
-
if (n === "xiaohongshu") return
|
|
4233
|
+
if (n === "xiaohongshu") return Yn(t), [
|
|
4233
4234
|
"div",
|
|
4234
4235
|
{
|
|
4235
4236
|
"data-video-embed": "xiaohongshu",
|
|
@@ -4281,7 +4282,7 @@ var Jn = re.create({
|
|
|
4281
4282
|
},
|
|
4282
4283
|
addCommands() {
|
|
4283
4284
|
return { insertVideo: (e) => ({ chain: t }) => {
|
|
4284
|
-
let n =
|
|
4285
|
+
let n = qn(e.src);
|
|
4285
4286
|
return t().insertContent({
|
|
4286
4287
|
type: this.name,
|
|
4287
4288
|
attrs: {
|
|
@@ -4291,13 +4292,20 @@ var Jn = re.create({
|
|
|
4291
4292
|
}).focus().run();
|
|
4292
4293
|
} };
|
|
4293
4294
|
}
|
|
4294
|
-
}),
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4295
|
+
}), Zn = null, Qn = {
|
|
4296
|
+
bg: "var(--color-background, #ffffff)",
|
|
4297
|
+
fg: "var(--color-foreground, #11181c)",
|
|
4298
|
+
accent: "var(--color-qingwu-600, #0891b2)",
|
|
4299
|
+
transparent: !0,
|
|
4300
|
+
font: "Inter, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif",
|
|
4301
|
+
padding: 32
|
|
4302
|
+
}, $n = .25, er = 4, tr = .25;
|
|
4303
|
+
async function nr(e, t) {
|
|
4304
|
+
Zn ||= await import("beautiful-mermaid");
|
|
4305
|
+
let n = Zn.renderMermaidSVG;
|
|
4306
|
+
return n(e, t);
|
|
4307
|
+
}
|
|
4308
|
+
var rr = [
|
|
4301
4309
|
{
|
|
4302
4310
|
value: "javascript",
|
|
4303
4311
|
label: "JavaScript",
|
|
@@ -4458,7 +4466,7 @@ var Zn = [
|
|
|
4458
4466
|
label: "Plain Text",
|
|
4459
4467
|
color: "#6b7280"
|
|
4460
4468
|
}
|
|
4461
|
-
],
|
|
4469
|
+
], ir = {
|
|
4462
4470
|
javascript: "js",
|
|
4463
4471
|
typescript: "ts",
|
|
4464
4472
|
python: "py",
|
|
@@ -4484,7 +4492,7 @@ var Zn = [
|
|
|
4484
4492
|
txt: "txt",
|
|
4485
4493
|
vue: "vue",
|
|
4486
4494
|
react: "jsx"
|
|
4487
|
-
},
|
|
4495
|
+
}, ar = {
|
|
4488
4496
|
js: "javascript",
|
|
4489
4497
|
ts: "typescript",
|
|
4490
4498
|
py: "python",
|
|
@@ -4500,12 +4508,51 @@ var Zn = [
|
|
|
4500
4508
|
jsx: "javascript",
|
|
4501
4509
|
tsx: "typescript"
|
|
4502
4510
|
};
|
|
4503
|
-
function
|
|
4511
|
+
function or({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i, selected: a }) {
|
|
4504
4512
|
let o = n?.isEditable ?? !0, s = !o, [c, l] = T(!1), [u, d] = T(!1), [f, m] = T(!1), [h, g] = T(!1), [_, v] = T(220), [y, S] = T({
|
|
4505
4513
|
top: 0,
|
|
4506
4514
|
left: 0,
|
|
4507
4515
|
width: 210
|
|
4508
|
-
}), [k, A] = T(""), [j, M] = T(!1), [N,
|
|
4516
|
+
}), [k, A] = T(""), [j, M] = T(!1), [N, ee] = T(null), [P, F] = T(null), [I, te] = T(!1), [ne, R] = T(!1), [re, ie] = T(1), [z, B] = T({
|
|
4517
|
+
x: 0,
|
|
4518
|
+
y: 0
|
|
4519
|
+
}), [V, H] = T(!1), ae = w(null), oe = w(null), U = w(null), W = w(null), se = w(null), G = w(null), K = w(null), ce = e.attrs.language || "", q = rr.find((e) => e.value === (ar[ce] ?? ce)), le = ce === "mermaid", ue = (e) => Math.min(er, Math.max($n, e)), de = (e) => ie((t) => Math.round(ue(t + e) * 100) / 100), fe = () => {
|
|
4520
|
+
ie(1), B({
|
|
4521
|
+
x: 0,
|
|
4522
|
+
y: 0
|
|
4523
|
+
});
|
|
4524
|
+
}, J = () => {
|
|
4525
|
+
fe(), R(!0);
|
|
4526
|
+
};
|
|
4527
|
+
x(() => {
|
|
4528
|
+
N || R(!1);
|
|
4529
|
+
}, [N]), x(() => {
|
|
4530
|
+
if (!ne) return;
|
|
4531
|
+
let e = document.body.style.overflow;
|
|
4532
|
+
document.body.style.overflow = "hidden";
|
|
4533
|
+
let t = (e) => {
|
|
4534
|
+
e.key === "Escape" && R(!1);
|
|
4535
|
+
};
|
|
4536
|
+
return window.addEventListener("keydown", t), () => {
|
|
4537
|
+
document.body.style.overflow = e, window.removeEventListener("keydown", t);
|
|
4538
|
+
};
|
|
4539
|
+
}, [ne]);
|
|
4540
|
+
let pe = (e) => {
|
|
4541
|
+
e.button === 0 && (e.currentTarget.setPointerCapture(e.pointerId), ae.current = {
|
|
4542
|
+
x: e.clientX,
|
|
4543
|
+
y: e.clientY,
|
|
4544
|
+
panX: z.x,
|
|
4545
|
+
panY: z.y
|
|
4546
|
+
}, H(!0));
|
|
4547
|
+
}, me = (e) => {
|
|
4548
|
+
let t = ae.current;
|
|
4549
|
+
t && B({
|
|
4550
|
+
x: t.panX + e.clientX - t.x,
|
|
4551
|
+
y: t.panY + e.clientY - t.y
|
|
4552
|
+
});
|
|
4553
|
+
}, he = () => {
|
|
4554
|
+
ae.current = null, H(!1);
|
|
4555
|
+
}, ge = b(() => {
|
|
4509
4556
|
if (!n || typeof r != "function") return null;
|
|
4510
4557
|
let t = r();
|
|
4511
4558
|
return typeof t == "number" ? {
|
|
@@ -4516,19 +4563,19 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4516
4563
|
n,
|
|
4517
4564
|
r,
|
|
4518
4565
|
e.nodeSize
|
|
4519
|
-
]),
|
|
4520
|
-
o && (
|
|
4521
|
-
}, [
|
|
4566
|
+
]), _e = b(() => {
|
|
4567
|
+
o && (vn() || (K.current = ge(), window.getSelection()?.removeAllRanges(), $(!0), M(!0)));
|
|
4568
|
+
}, [ge, o]), ve = C(() => {
|
|
4522
4569
|
let e = k.trim().toLowerCase();
|
|
4523
|
-
return e ?
|
|
4570
|
+
return e ? rr.filter((t) => t.label.toLowerCase().includes(e) || t.value.toLowerCase().includes(e)) : rr;
|
|
4524
4571
|
}, [k]);
|
|
4525
4572
|
x(() => {
|
|
4526
|
-
(
|
|
4573
|
+
(G.current?.closest(".code-block-node-view"))?.classList.toggle("code-block-node-view--collapsed", u);
|
|
4527
4574
|
}, [u]);
|
|
4528
|
-
let
|
|
4529
|
-
let e =
|
|
4575
|
+
let ye = b(() => {
|
|
4576
|
+
let e = W.current;
|
|
4530
4577
|
if (!e) return;
|
|
4531
|
-
let t = e.getBoundingClientRect(), n = Math.min(t.left, window.innerWidth - 210 - 8), r = window.innerHeight - t.bottom - 12, i = t.top - 12, a =
|
|
4578
|
+
let t = e.getBoundingClientRect(), n = Math.min(t.left, window.innerWidth - 210 - 8), r = window.innerHeight - t.bottom - 12, i = t.top - 12, a = rr.length * 31 + 8, o = r - 52, s = i - 52;
|
|
4532
4579
|
o < 220 && s > o ? (g(!0), v(Math.max(120, Math.min(a, s))), S({
|
|
4533
4580
|
top: t.top,
|
|
4534
4581
|
left: n,
|
|
@@ -4541,16 +4588,16 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4541
4588
|
}, []);
|
|
4542
4589
|
x(() => {
|
|
4543
4590
|
if (!f) return;
|
|
4544
|
-
A(""),
|
|
4545
|
-
let e = setTimeout(() =>
|
|
4546
|
-
return window.addEventListener("resize",
|
|
4547
|
-
clearTimeout(e), window.removeEventListener("resize",
|
|
4591
|
+
A(""), ye();
|
|
4592
|
+
let e = setTimeout(() => se.current?.focus(), 50);
|
|
4593
|
+
return window.addEventListener("resize", ye), window.addEventListener("scroll", ye, !0), () => {
|
|
4594
|
+
clearTimeout(e), window.removeEventListener("resize", ye), window.removeEventListener("scroll", ye, !0);
|
|
4548
4595
|
};
|
|
4549
|
-
}, [f,
|
|
4596
|
+
}, [f, ye]), x(() => {
|
|
4550
4597
|
if (!f) return;
|
|
4551
4598
|
let e = (e) => {
|
|
4552
4599
|
let t = e.target;
|
|
4553
|
-
t && (
|
|
4600
|
+
t && (W.current?.contains(t) || U.current?.contains(t) || m(!1));
|
|
4554
4601
|
};
|
|
4555
4602
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
4556
4603
|
}, [f]), x(() => {
|
|
@@ -4561,12 +4608,12 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4561
4608
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
4562
4609
|
}, [f]), x(() => {
|
|
4563
4610
|
let e = (e) => {
|
|
4564
|
-
if (e.key !== "Backspace" && e.key !== "Delete" || !o || !a ||
|
|
4611
|
+
if (e.key !== "Backspace" && e.key !== "Delete" || !o || !a || vn()) return;
|
|
4565
4612
|
let t = n?.view?.dom, r = e.target;
|
|
4566
4613
|
if (n?.isFocused && r instanceof Node && t?.contains(r)) {
|
|
4567
4614
|
if (e.preventDefault(), e.stopPropagation(), n) {
|
|
4568
4615
|
let { from: e, to: t } = n.state.selection;
|
|
4569
|
-
|
|
4616
|
+
K.current = {
|
|
4570
4617
|
from: e,
|
|
4571
4618
|
to: t
|
|
4572
4619
|
};
|
|
@@ -4580,9 +4627,9 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4580
4627
|
n,
|
|
4581
4628
|
o
|
|
4582
4629
|
]);
|
|
4583
|
-
let
|
|
4630
|
+
let be = b((e) => {
|
|
4584
4631
|
t({ language: e || null }), m(!1);
|
|
4585
|
-
}, [t]),
|
|
4632
|
+
}, [t]), xe = b(() => {
|
|
4586
4633
|
if (o) {
|
|
4587
4634
|
if (n && r) {
|
|
4588
4635
|
let e = r();
|
|
@@ -4594,7 +4641,7 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4594
4641
|
n,
|
|
4595
4642
|
r,
|
|
4596
4643
|
o
|
|
4597
|
-
]),
|
|
4644
|
+
]), Se = b(() => {
|
|
4598
4645
|
let t = e.textContent, n = (e) => {
|
|
4599
4646
|
let t = document.createElement("textarea");
|
|
4600
4647
|
t.value = e, t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select();
|
|
@@ -4604,35 +4651,35 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4604
4651
|
document.body.removeChild(t);
|
|
4605
4652
|
};
|
|
4606
4653
|
navigator.clipboard?.writeText ? navigator.clipboard.writeText(t).catch(() => n(t)) : n(t), l(!0), setTimeout(() => l(!1), 1500);
|
|
4607
|
-
}, [e.textContent]),
|
|
4608
|
-
let t =
|
|
4654
|
+
}, [e.textContent]), Ce = b(() => {
|
|
4655
|
+
let t = ir[ce] || "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");
|
|
4609
4656
|
a.href = i, a.download = n, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
4610
|
-
}, [e.textContent,
|
|
4611
|
-
if (N ||
|
|
4612
|
-
|
|
4657
|
+
}, [e.textContent, ce]), we = b(async () => {
|
|
4658
|
+
if (N || I) {
|
|
4659
|
+
ee(null), F(null), te(!1);
|
|
4613
4660
|
return;
|
|
4614
4661
|
}
|
|
4615
|
-
|
|
4662
|
+
te(!0), F(null), ee(null);
|
|
4616
4663
|
try {
|
|
4617
4664
|
let t = (e.textContent || "").trim();
|
|
4618
4665
|
if (!t) {
|
|
4619
|
-
|
|
4666
|
+
F("代码块内容为空");
|
|
4620
4667
|
return;
|
|
4621
4668
|
}
|
|
4622
|
-
let n = p(await
|
|
4623
|
-
|
|
4669
|
+
let n = p(await nr(t, Qn));
|
|
4670
|
+
ee(n);
|
|
4624
4671
|
} catch (e) {
|
|
4625
|
-
|
|
4672
|
+
F(e instanceof Error ? e.message : "Mermaid 渲染失败");
|
|
4626
4673
|
} finally {
|
|
4627
|
-
|
|
4674
|
+
te(!1);
|
|
4628
4675
|
}
|
|
4629
4676
|
}, [
|
|
4630
4677
|
e.textContent,
|
|
4631
4678
|
N,
|
|
4632
|
-
|
|
4633
|
-
]),
|
|
4634
|
-
className: `${
|
|
4635
|
-
style: { color:
|
|
4679
|
+
I
|
|
4680
|
+
]), Te = /* @__PURE__ */ O(E, { children: [q ? q.deviconClass ? /* @__PURE__ */ D("i", {
|
|
4681
|
+
className: `${q.deviconClass} colored cb-lang-icon`,
|
|
4682
|
+
style: { color: q.color }
|
|
4636
4683
|
}) : /* @__PURE__ */ D("span", {
|
|
4637
4684
|
className: "cb-lang-icon cb-lang-icon--auto",
|
|
4638
4685
|
children: "Tx"
|
|
@@ -4641,10 +4688,10 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4641
4688
|
children: "?"
|
|
4642
4689
|
}), /* @__PURE__ */ D("span", {
|
|
4643
4690
|
className: "cb-lang-label",
|
|
4644
|
-
children:
|
|
4691
|
+
children: q?.label || "自动"
|
|
4645
4692
|
})] });
|
|
4646
4693
|
return /* @__PURE__ */ O("div", {
|
|
4647
|
-
ref:
|
|
4694
|
+
ref: G,
|
|
4648
4695
|
className: "cb-react-shell group/cb",
|
|
4649
4696
|
style: { display: "contents" },
|
|
4650
4697
|
children: [
|
|
@@ -4655,17 +4702,17 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4655
4702
|
children: [
|
|
4656
4703
|
/* @__PURE__ */ D("div", {
|
|
4657
4704
|
className: "cb-lang-wrap",
|
|
4658
|
-
ref:
|
|
4705
|
+
ref: oe,
|
|
4659
4706
|
contentEditable: !1,
|
|
4660
4707
|
children: s ? /* @__PURE__ */ D("span", {
|
|
4661
4708
|
className: "cb-lang-trigger cb-lang-trigger--static",
|
|
4662
|
-
children:
|
|
4709
|
+
children: Te
|
|
4663
4710
|
}) : /* @__PURE__ */ O("button", {
|
|
4664
|
-
ref:
|
|
4711
|
+
ref: W,
|
|
4665
4712
|
type: "button",
|
|
4666
4713
|
className: "cb-lang-trigger",
|
|
4667
4714
|
onClick: () => m(!f),
|
|
4668
|
-
children: [
|
|
4715
|
+
children: [Te, /* @__PURE__ */ D("svg", {
|
|
4669
4716
|
className: `cb-lang-chevron${f ? " cb-lang-chevron--open" : ""}`,
|
|
4670
4717
|
width: "10",
|
|
4671
4718
|
height: "10",
|
|
@@ -4687,7 +4734,7 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4687
4734
|
contentEditable: !1,
|
|
4688
4735
|
onClick: () => d(!1),
|
|
4689
4736
|
title: "展开代码块",
|
|
4690
|
-
children: [
|
|
4737
|
+
children: [Te, /* @__PURE__ */ D("svg", {
|
|
4691
4738
|
className: "cb-lang-chevron",
|
|
4692
4739
|
width: "12",
|
|
4693
4740
|
height: "12",
|
|
@@ -4702,8 +4749,8 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4702
4749
|
})
|
|
4703
4750
|
})]
|
|
4704
4751
|
}),
|
|
4705
|
-
o && f &&
|
|
4706
|
-
ref:
|
|
4752
|
+
o && f && L(/* @__PURE__ */ O("div", {
|
|
4753
|
+
ref: U,
|
|
4707
4754
|
className: `cb-lang-dropdown${h ? " cb-lang-dropdown--up" : ""}`,
|
|
4708
4755
|
style: {
|
|
4709
4756
|
position: "fixed",
|
|
@@ -4728,7 +4775,7 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4728
4775
|
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
4729
4776
|
})
|
|
4730
4777
|
}), /* @__PURE__ */ D("input", {
|
|
4731
|
-
ref:
|
|
4778
|
+
ref: se,
|
|
4732
4779
|
className: "cb-lang-search",
|
|
4733
4780
|
type: "text",
|
|
4734
4781
|
placeholder: "搜索语言...",
|
|
@@ -4742,17 +4789,17 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4742
4789
|
children: [
|
|
4743
4790
|
/* @__PURE__ */ O("button", {
|
|
4744
4791
|
type: "button",
|
|
4745
|
-
className: `cb-lang-option${
|
|
4746
|
-
onClick: () =>
|
|
4792
|
+
className: `cb-lang-option${ce ? "" : " cb-lang-option--active"}`,
|
|
4793
|
+
onClick: () => be(""),
|
|
4747
4794
|
children: [/* @__PURE__ */ D("span", {
|
|
4748
4795
|
className: "cb-lang-icon cb-lang-icon--auto",
|
|
4749
4796
|
children: "?"
|
|
4750
4797
|
}), /* @__PURE__ */ D("span", { children: "自动检测" })]
|
|
4751
4798
|
}),
|
|
4752
|
-
|
|
4799
|
+
ve.map((e) => /* @__PURE__ */ O("button", {
|
|
4753
4800
|
type: "button",
|
|
4754
|
-
className: `cb-lang-option${
|
|
4755
|
-
onClick: () =>
|
|
4801
|
+
className: `cb-lang-option${ce === e.value ? " cb-lang-option--active" : ""}`,
|
|
4802
|
+
onClick: () => be(e.value),
|
|
4756
4803
|
children: [e.deviconClass ? /* @__PURE__ */ D("i", {
|
|
4757
4804
|
className: `${e.deviconClass} colored cb-lang-icon`,
|
|
4758
4805
|
style: { color: e.color }
|
|
@@ -4761,7 +4808,7 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4761
4808
|
children: "Tx"
|
|
4762
4809
|
}), /* @__PURE__ */ D("span", { children: e.label })]
|
|
4763
4810
|
}, e.value)),
|
|
4764
|
-
|
|
4811
|
+
ve.length === 0 && /* @__PURE__ */ D("div", {
|
|
4765
4812
|
className: "cb-lang-empty",
|
|
4766
4813
|
children: "无匹配语言"
|
|
4767
4814
|
})
|
|
@@ -4797,7 +4844,7 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4797
4844
|
/* @__PURE__ */ D("button", {
|
|
4798
4845
|
type: "button",
|
|
4799
4846
|
className: "cb-btn",
|
|
4800
|
-
onClick:
|
|
4847
|
+
onClick: Se,
|
|
4801
4848
|
contentEditable: !1,
|
|
4802
4849
|
title: "复制",
|
|
4803
4850
|
children: c ? /* @__PURE__ */ D("svg", {
|
|
@@ -4827,7 +4874,7 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4827
4874
|
/* @__PURE__ */ D("button", {
|
|
4828
4875
|
type: "button",
|
|
4829
4876
|
className: "cb-btn",
|
|
4830
|
-
onClick:
|
|
4877
|
+
onClick: Ce,
|
|
4831
4878
|
contentEditable: !1,
|
|
4832
4879
|
title: "下载",
|
|
4833
4880
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -4846,7 +4893,7 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4846
4893
|
o && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("button", {
|
|
4847
4894
|
type: "button",
|
|
4848
4895
|
className: "cb-btn cb-btn--ai",
|
|
4849
|
-
onClick:
|
|
4896
|
+
onClick: xe,
|
|
4850
4897
|
contentEditable: !1,
|
|
4851
4898
|
title: "写作助手",
|
|
4852
4899
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -4864,7 +4911,7 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4864
4911
|
}), /* @__PURE__ */ D("button", {
|
|
4865
4912
|
type: "button",
|
|
4866
4913
|
className: "cb-btn cb-btn--del",
|
|
4867
|
-
onClick:
|
|
4914
|
+
onClick: _e,
|
|
4868
4915
|
contentEditable: !1,
|
|
4869
4916
|
title: "删除代码块",
|
|
4870
4917
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -4880,13 +4927,13 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4880
4927
|
})
|
|
4881
4928
|
})
|
|
4882
4929
|
})] }),
|
|
4883
|
-
|
|
4930
|
+
le && /* @__PURE__ */ D("button", {
|
|
4884
4931
|
type: "button",
|
|
4885
4932
|
className: "cb-btn cb-btn--diagram",
|
|
4886
|
-
onClick:
|
|
4933
|
+
onClick: we,
|
|
4887
4934
|
contentEditable: !1,
|
|
4888
|
-
title: N ||
|
|
4889
|
-
disabled:
|
|
4935
|
+
title: N || I ? "取消渲染" : "渲染图表",
|
|
4936
|
+
disabled: I,
|
|
4890
4937
|
children: /* @__PURE__ */ D("svg", {
|
|
4891
4938
|
className: "cb-btn-icon",
|
|
4892
4939
|
fill: "none",
|
|
@@ -4904,28 +4951,121 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4904
4951
|
})
|
|
4905
4952
|
]
|
|
4906
4953
|
}),
|
|
4907
|
-
(N ||
|
|
4954
|
+
(N || P || I) && /* @__PURE__ */ O("div", {
|
|
4908
4955
|
className: "cb-diagram-output",
|
|
4909
4956
|
contentEditable: !1,
|
|
4910
4957
|
children: [
|
|
4911
|
-
|
|
4958
|
+
I && /* @__PURE__ */ D("div", {
|
|
4912
4959
|
className: "cb-diagram-loading",
|
|
4913
4960
|
children: "渲染图表中…"
|
|
4914
4961
|
}),
|
|
4915
|
-
|
|
4962
|
+
P && /* @__PURE__ */ O("div", {
|
|
4916
4963
|
className: "cb-diagram-error",
|
|
4917
4964
|
children: [/* @__PURE__ */ D("span", {
|
|
4918
4965
|
className: "cb-diagram-error-icon",
|
|
4919
4966
|
children: "!"
|
|
4920
|
-
}),
|
|
4967
|
+
}), P]
|
|
4921
4968
|
}),
|
|
4922
|
-
N && /* @__PURE__ */
|
|
4969
|
+
N && /* @__PURE__ */ O("div", {
|
|
4923
4970
|
className: "cb-diagram-svg",
|
|
4924
|
-
|
|
4971
|
+
role: "button",
|
|
4972
|
+
tabIndex: 0,
|
|
4973
|
+
title: "点击放大查看",
|
|
4974
|
+
onClick: J,
|
|
4975
|
+
onKeyDown: (e) => {
|
|
4976
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), J());
|
|
4977
|
+
},
|
|
4978
|
+
children: [/* @__PURE__ */ D("div", {
|
|
4979
|
+
className: "cb-diagram-svg-inner",
|
|
4980
|
+
dangerouslySetInnerHTML: { __html: N }
|
|
4981
|
+
}), /* @__PURE__ */ D("span", {
|
|
4982
|
+
className: "cb-diagram-zoom-hint",
|
|
4983
|
+
children: "点击放大"
|
|
4984
|
+
})]
|
|
4925
4985
|
})
|
|
4926
4986
|
]
|
|
4927
4987
|
}),
|
|
4928
|
-
/* @__PURE__ */
|
|
4988
|
+
ne && N && L(/* @__PURE__ */ O("div", {
|
|
4989
|
+
className: "fixed inset-0 z-[10002] flex flex-col bg-black/75 backdrop-blur-sm select-none",
|
|
4990
|
+
role: "dialog",
|
|
4991
|
+
"aria-modal": "true",
|
|
4992
|
+
"aria-label": "Mermaid 图表预览",
|
|
4993
|
+
children: [/* @__PURE__ */ O("div", {
|
|
4994
|
+
className: "flex items-center justify-between gap-3 px-4 py-3 text-white",
|
|
4995
|
+
children: [/* @__PURE__ */ D("span", {
|
|
4996
|
+
className: "text-sm font-medium",
|
|
4997
|
+
children: "Mermaid 图表"
|
|
4998
|
+
}), /* @__PURE__ */ O("div", {
|
|
4999
|
+
className: "flex items-center gap-1.5",
|
|
5000
|
+
children: [
|
|
5001
|
+
/* @__PURE__ */ D("button", {
|
|
5002
|
+
type: "button",
|
|
5003
|
+
className: "flex h-8 min-w-8 items-center justify-center rounded-lg bg-white/10 px-2 text-base text-white transition-colors hover:bg-white/20",
|
|
5004
|
+
onClick: () => de(-.25),
|
|
5005
|
+
title: "缩小",
|
|
5006
|
+
"aria-label": "缩小",
|
|
5007
|
+
children: "−"
|
|
5008
|
+
}),
|
|
5009
|
+
/* @__PURE__ */ O("button", {
|
|
5010
|
+
type: "button",
|
|
5011
|
+
className: "flex h-8 min-w-14 items-center justify-center rounded-lg bg-white/10 px-2 text-xs text-white transition-colors hover:bg-white/20",
|
|
5012
|
+
onClick: fe,
|
|
5013
|
+
title: "重置为 100%",
|
|
5014
|
+
"aria-label": "重置缩放",
|
|
5015
|
+
children: [Math.round(re * 100), "%"]
|
|
5016
|
+
}),
|
|
5017
|
+
/* @__PURE__ */ D("button", {
|
|
5018
|
+
type: "button",
|
|
5019
|
+
className: "flex h-8 min-w-8 items-center justify-center rounded-lg bg-white/10 px-2 text-base text-white transition-colors hover:bg-white/20",
|
|
5020
|
+
onClick: () => de(tr),
|
|
5021
|
+
title: "放大",
|
|
5022
|
+
"aria-label": "放大",
|
|
5023
|
+
children: "+"
|
|
5024
|
+
}),
|
|
5025
|
+
/* @__PURE__ */ D("button", {
|
|
5026
|
+
type: "button",
|
|
5027
|
+
className: "flex h-8 min-w-8 items-center justify-center rounded-lg bg-white/10 px-2 text-sm text-white transition-colors hover:bg-white/20",
|
|
5028
|
+
onClick: fe,
|
|
5029
|
+
title: "重置",
|
|
5030
|
+
"aria-label": "重置",
|
|
5031
|
+
children: "⟲"
|
|
5032
|
+
}),
|
|
5033
|
+
/* @__PURE__ */ D("span", { className: "mx-1 h-5 w-px bg-white/20" }),
|
|
5034
|
+
/* @__PURE__ */ D("button", {
|
|
5035
|
+
type: "button",
|
|
5036
|
+
className: "flex h-8 min-w-8 items-center justify-center rounded-lg bg-white/10 px-2 text-lg text-white transition-colors hover:bg-white/20",
|
|
5037
|
+
onClick: () => R(!1),
|
|
5038
|
+
title: "关闭",
|
|
5039
|
+
"aria-label": "关闭",
|
|
5040
|
+
children: "×"
|
|
5041
|
+
})
|
|
5042
|
+
]
|
|
5043
|
+
})]
|
|
5044
|
+
}), /* @__PURE__ */ D("div", {
|
|
5045
|
+
className: "flex flex-1 touch-none items-center justify-center overflow-hidden",
|
|
5046
|
+
style: { cursor: V ? "grabbing" : re > 1 ? "grab" : "default" },
|
|
5047
|
+
onWheel: (e) => de(e.deltaY > 0 ? -.25 : tr),
|
|
5048
|
+
onPointerDown: pe,
|
|
5049
|
+
onPointerMove: me,
|
|
5050
|
+
onPointerUp: he,
|
|
5051
|
+
onPointerCancel: he,
|
|
5052
|
+
onDoubleClick: () => {
|
|
5053
|
+
ie((e) => e === 1 ? 2 : 1), B({
|
|
5054
|
+
x: 0,
|
|
5055
|
+
y: 0
|
|
5056
|
+
});
|
|
5057
|
+
},
|
|
5058
|
+
children: /* @__PURE__ */ D("div", {
|
|
5059
|
+
className: "cb-diagram-zoom-content",
|
|
5060
|
+
style: {
|
|
5061
|
+
transform: `translate(${z.x}px, ${z.y}px) scale(${re})`,
|
|
5062
|
+
transition: V ? "none" : "transform 120ms ease-out"
|
|
5063
|
+
},
|
|
5064
|
+
dangerouslySetInnerHTML: { __html: N }
|
|
5065
|
+
})
|
|
5066
|
+
})]
|
|
5067
|
+
}), document.body),
|
|
5068
|
+
/* @__PURE__ */ D(Cn, {
|
|
4929
5069
|
open: j,
|
|
4930
5070
|
title: "确认删除代码块",
|
|
4931
5071
|
message: "此操作不可撤销。",
|
|
@@ -4941,7 +5081,7 @@ function er({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4941
5081
|
}
|
|
4942
5082
|
//#endregion
|
|
4943
5083
|
//#region src/editor/extensions/code-block.ts
|
|
4944
|
-
var
|
|
5084
|
+
var sr = [
|
|
4945
5085
|
{
|
|
4946
5086
|
value: "javascript",
|
|
4947
5087
|
label: "JavaScript"
|
|
@@ -5042,12 +5182,12 @@ var tr = [
|
|
|
5042
5182
|
value: "mermaid",
|
|
5043
5183
|
label: "Mermaid"
|
|
5044
5184
|
}
|
|
5045
|
-
],
|
|
5046
|
-
|
|
5047
|
-
function
|
|
5185
|
+
], cr = Se(xe);
|
|
5186
|
+
cr.register({ dockerfile: be }), cr.registerAlias("xml", ["vue", "html"]), cr.registerAlias("javascript", ["react", "jsx"]), cr.registerAlias("typescript", ["tsx"]);
|
|
5187
|
+
function lr(e) {
|
|
5048
5188
|
return e ? e.split("\n") : [""];
|
|
5049
5189
|
}
|
|
5050
|
-
function
|
|
5190
|
+
function ur(e, t) {
|
|
5051
5191
|
if (e.childElementCount !== t) {
|
|
5052
5192
|
e.replaceChildren();
|
|
5053
5193
|
for (let n = 1; n <= t; n++) {
|
|
@@ -5056,14 +5196,14 @@ function ir(e, t) {
|
|
|
5056
5196
|
}
|
|
5057
5197
|
}
|
|
5058
5198
|
}
|
|
5059
|
-
function
|
|
5199
|
+
function dr(e, t) {
|
|
5060
5200
|
e.replaceChildren();
|
|
5061
5201
|
for (let n of t) {
|
|
5062
5202
|
let t = document.createElement("span");
|
|
5063
5203
|
t.className = "cb-mirror-line", t.textContent = n.length ? n : "\xA0", e.appendChild(t);
|
|
5064
5204
|
}
|
|
5065
5205
|
}
|
|
5066
|
-
function
|
|
5206
|
+
function fr(e, t, n) {
|
|
5067
5207
|
let r = getComputedStyle(e), i = parseFloat(r.paddingLeft), a = parseFloat(r.paddingRight);
|
|
5068
5208
|
t.style.boxSizing = "content-box", t.style.width = `${Math.max(0, e.clientWidth - i - a)}px`, t.style.padding = r.padding;
|
|
5069
5209
|
let o = getComputedStyle(n);
|
|
@@ -5110,7 +5250,7 @@ function or(e, t, n) {
|
|
|
5110
5250
|
r = e + 1 < C.length ? C[e + 1] - C[e] : w - T, (!Number.isFinite(r) || r < 1) && (r = c), t.style.height = `${r}px`, T += r;
|
|
5111
5251
|
}
|
|
5112
5252
|
}
|
|
5113
|
-
var
|
|
5253
|
+
var pr = ye.extend({
|
|
5114
5254
|
addNodeView() {
|
|
5115
5255
|
return (e) => {
|
|
5116
5256
|
let { node: t, editor: n, getPos: r } = e, i = t, a = (e) => {
|
|
@@ -5138,9 +5278,9 @@ var sr = ye.extend({
|
|
|
5138
5278
|
f.appendChild(p);
|
|
5139
5279
|
let m = document.createElement("div");
|
|
5140
5280
|
m.className = "cb-code-mirror", m.contentEditable = "false", m.setAttribute("aria-hidden", "true"), u.appendChild(d), u.appendChild(f), u.appendChild(m), l.appendChild(u), s.appendChild(l);
|
|
5141
|
-
let h =
|
|
5142
|
-
|
|
5143
|
-
let g = new
|
|
5281
|
+
let h = lr(t.textContent);
|
|
5282
|
+
ur(d, h.length), dr(m, h);
|
|
5283
|
+
let g = new I(or, {
|
|
5144
5284
|
editor: n,
|
|
5145
5285
|
props: {
|
|
5146
5286
|
node: t,
|
|
@@ -5153,12 +5293,12 @@ var sr = ye.extend({
|
|
|
5153
5293
|
});
|
|
5154
5294
|
c.appendChild(g.element);
|
|
5155
5295
|
let _ = (e) => {
|
|
5156
|
-
let t =
|
|
5157
|
-
|
|
5296
|
+
let t = lr(e.textContent);
|
|
5297
|
+
ur(d, t.length), dr(m, t), requestAnimationFrame(() => fr(f, m, d));
|
|
5158
5298
|
};
|
|
5159
|
-
requestAnimationFrame(() =>
|
|
5160
|
-
let v = new ResizeObserver(() =>
|
|
5161
|
-
return v.observe(f), document.fonts?.ready?.then(() =>
|
|
5299
|
+
requestAnimationFrame(() => fr(f, m, d));
|
|
5300
|
+
let v = new ResizeObserver(() => fr(f, m, d));
|
|
5301
|
+
return v.observe(f), document.fonts?.ready?.then(() => fr(f, m, d)), {
|
|
5162
5302
|
dom: s,
|
|
5163
5303
|
contentDOM: p,
|
|
5164
5304
|
update(e) {
|
|
@@ -5218,10 +5358,10 @@ var sr = ye.extend({
|
|
|
5218
5358
|
}
|
|
5219
5359
|
}));
|
|
5220
5360
|
}
|
|
5221
|
-
}).configure({ lowlight:
|
|
5361
|
+
}).configure({ lowlight: cr });
|
|
5222
5362
|
//#endregion
|
|
5223
5363
|
//#region src/editor/utils/import-choice-dialog.ts
|
|
5224
|
-
function
|
|
5364
|
+
function mr(e) {
|
|
5225
5365
|
return new Promise((t) => {
|
|
5226
5366
|
let n = document.createElement("div");
|
|
5227
5367
|
n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
|
|
@@ -5251,16 +5391,16 @@ function cr(e) {
|
|
|
5251
5391
|
}
|
|
5252
5392
|
//#endregion
|
|
5253
5393
|
//#region src/editor/utils/local-media.ts
|
|
5254
|
-
var
|
|
5255
|
-
function
|
|
5394
|
+
var hr = /\.(png|jpe?g|gif|webp|bmp|svg|avif|mp4|m4v|webm|ogg|mov|avi|mkv|mp3|wav|flac|m4a|aac|opus|pdf|docx?|xlsx?|pptx?|odt|rtf|txt|md|csv|zip|rar|7z|json)(\?|#|$)/i, gr = /^(?:mailto:|tel:|javascript:|about:|data:|blob:)/i;
|
|
5395
|
+
function _r(e) {
|
|
5256
5396
|
if (!e) return !1;
|
|
5257
5397
|
let t = e.trim();
|
|
5258
|
-
return !(!t || /^(?:https?:)?\/\//i.test(t) ||
|
|
5398
|
+
return !(!t || /^(?:https?:)?\/\//i.test(t) || gr.test(t) || t.startsWith("#"));
|
|
5259
5399
|
}
|
|
5260
|
-
function
|
|
5261
|
-
return
|
|
5400
|
+
function vr(e) {
|
|
5401
|
+
return hr.test(e);
|
|
5262
5402
|
}
|
|
5263
|
-
function
|
|
5403
|
+
function yr(e) {
|
|
5264
5404
|
let t = e.trim();
|
|
5265
5405
|
t = t.replace(/^(?:file|app):\/\/(?:localhost)?/i, "");
|
|
5266
5406
|
try {
|
|
@@ -5268,26 +5408,26 @@ function pr(e) {
|
|
|
5268
5408
|
} catch {}
|
|
5269
5409
|
return t = t.replace(/\\/g, "/"), t = t.replace(/^\.\//, ""), t = t.replace(/^\/+/, ""), t = t.replace(/^[a-zA-Z]:\//, ""), t;
|
|
5270
5410
|
}
|
|
5271
|
-
function
|
|
5272
|
-
let t =
|
|
5411
|
+
function br(e) {
|
|
5412
|
+
let t = yr(e), n = t.split("/").filter(Boolean);
|
|
5273
5413
|
return (n[n.length - 1] || t).toLowerCase();
|
|
5274
5414
|
}
|
|
5275
|
-
function
|
|
5415
|
+
function xr() {
|
|
5276
5416
|
return typeof window > "u" || window.isSecureContext === !1 ? !1 : typeof window.showDirectoryPicker == "function";
|
|
5277
5417
|
}
|
|
5278
|
-
async function
|
|
5279
|
-
if (!
|
|
5418
|
+
async function Sr() {
|
|
5419
|
+
if (!xr()) return null;
|
|
5280
5420
|
try {
|
|
5281
5421
|
return await window.showDirectoryPicker.call(window, { mode: "read" }) ?? null;
|
|
5282
5422
|
} catch {
|
|
5283
5423
|
return null;
|
|
5284
5424
|
}
|
|
5285
5425
|
}
|
|
5286
|
-
function
|
|
5426
|
+
function Cr() {
|
|
5287
5427
|
return typeof window > "u" || window.isSecureContext === !1 ? !1 : typeof window.showOpenFilePicker == "function";
|
|
5288
5428
|
}
|
|
5289
|
-
async function
|
|
5290
|
-
if (!
|
|
5429
|
+
async function wr() {
|
|
5430
|
+
if (!Cr()) return null;
|
|
5291
5431
|
try {
|
|
5292
5432
|
let e = await window.showOpenFilePicker.call(window, { multiple: !0 });
|
|
5293
5433
|
return await Promise.all(e.map((e) => e.getFile()));
|
|
@@ -5295,7 +5435,7 @@ async function vr() {
|
|
|
5295
5435
|
return null;
|
|
5296
5436
|
}
|
|
5297
5437
|
}
|
|
5298
|
-
async function
|
|
5438
|
+
async function Tr(e, t) {
|
|
5299
5439
|
if (t.length === 0) return { file: null };
|
|
5300
5440
|
let n = e;
|
|
5301
5441
|
for (let e = 0; e < t.length - 1; e++) try {
|
|
@@ -5317,7 +5457,7 @@ async function yr(e, t) {
|
|
|
5317
5457
|
return { file: null };
|
|
5318
5458
|
}
|
|
5319
5459
|
}
|
|
5320
|
-
async function
|
|
5460
|
+
async function Er(e, t, n = 5e3) {
|
|
5321
5461
|
let r = t.toLowerCase(), i = [e], a = 0, o;
|
|
5322
5462
|
for (; i.length > 0 && a < n;) {
|
|
5323
5463
|
let e = i.pop();
|
|
@@ -5339,37 +5479,37 @@ async function br(e, t, n = 5e3) {
|
|
|
5339
5479
|
readError: o
|
|
5340
5480
|
};
|
|
5341
5481
|
}
|
|
5342
|
-
async function
|
|
5343
|
-
let n =
|
|
5482
|
+
async function Dr(e, t) {
|
|
5483
|
+
let n = yr(t).split("/").filter(Boolean);
|
|
5344
5484
|
if (n.length === 0) return { file: null };
|
|
5345
5485
|
let r;
|
|
5346
5486
|
for (let t = 0; t < n.length; t++) {
|
|
5347
|
-
let i = await
|
|
5487
|
+
let i = await Tr(e, n.slice(t));
|
|
5348
5488
|
if (i.file) return i;
|
|
5349
5489
|
i.readError && (r = i.readError);
|
|
5350
5490
|
}
|
|
5351
|
-
let i = await
|
|
5491
|
+
let i = await Er(e, n[n.length - 1]);
|
|
5352
5492
|
return i.file || i.readError ? i : {
|
|
5353
5493
|
file: null,
|
|
5354
5494
|
readError: r
|
|
5355
5495
|
};
|
|
5356
5496
|
}
|
|
5357
|
-
var
|
|
5497
|
+
var Or = {
|
|
5358
5498
|
image: "image",
|
|
5359
5499
|
videoEmbed: "video",
|
|
5360
5500
|
audioEmbed: "audio",
|
|
5361
5501
|
attachmentEmbed: "attachment"
|
|
5362
5502
|
};
|
|
5363
|
-
function
|
|
5503
|
+
function kr(e, t) {
|
|
5364
5504
|
let n = /* @__PURE__ */ new Set(), r = [];
|
|
5365
5505
|
return e.descendants((e) => {
|
|
5366
|
-
let i =
|
|
5506
|
+
let i = Or[e.type?.name];
|
|
5367
5507
|
if (i) {
|
|
5368
5508
|
let a = e.attrs?.src, o = `node:${a}`;
|
|
5369
|
-
typeof a == "string" &&
|
|
5509
|
+
typeof a == "string" && _r(a) && !n.has(o) && !t?.(a) && (n.add(o), r.push({
|
|
5370
5510
|
src: a,
|
|
5371
|
-
normalized:
|
|
5372
|
-
basename:
|
|
5511
|
+
normalized: yr(a),
|
|
5512
|
+
basename: br(a),
|
|
5373
5513
|
kind: i,
|
|
5374
5514
|
isLink: !1
|
|
5375
5515
|
}));
|
|
@@ -5378,17 +5518,17 @@ function Cr(e, t) {
|
|
|
5378
5518
|
if (e.isText && e.marks) for (let i of e.marks) {
|
|
5379
5519
|
if (i.type.name !== "link") continue;
|
|
5380
5520
|
let e = i.attrs?.href, a = `link:${e}`;
|
|
5381
|
-
typeof e == "string" &&
|
|
5521
|
+
typeof e == "string" && _r(e) && vr(e) && !n.has(a) && !t?.(e) && (n.add(a), r.push({
|
|
5382
5522
|
src: e,
|
|
5383
|
-
normalized:
|
|
5384
|
-
basename:
|
|
5523
|
+
normalized: yr(e),
|
|
5524
|
+
basename: br(e),
|
|
5385
5525
|
kind: "attachment",
|
|
5386
5526
|
isLink: !0
|
|
5387
5527
|
}));
|
|
5388
5528
|
}
|
|
5389
5529
|
}), r;
|
|
5390
5530
|
}
|
|
5391
|
-
function
|
|
5531
|
+
function Ar(e, t, n) {
|
|
5392
5532
|
let r = t ? `${e}\n${t}` : e;
|
|
5393
5533
|
if (!r) return !1;
|
|
5394
5534
|
let i = [];
|
|
@@ -5396,28 +5536,28 @@ function wr(e, t, n) {
|
|
|
5396
5536
|
for (let e of r.matchAll(/!?\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g)) i.push(e[1]);
|
|
5397
5537
|
for (let e of r.matchAll(/<(?:img|video|audio|source)[^>]*\bsrc=["']([^"']+)["']/gi)) i.push(e[1]);
|
|
5398
5538
|
for (let e of r.matchAll(/<a[^>]*\bhref=["']([^"']+)["']/gi)) i.push(e[1]);
|
|
5399
|
-
return i.some((e) =>
|
|
5539
|
+
return i.some((e) => vr(e) && _r(e) && !n?.(e));
|
|
5400
5540
|
}
|
|
5401
5541
|
//#endregion
|
|
5402
5542
|
//#region src/editor/extensions/image-upload.ts
|
|
5403
|
-
function
|
|
5543
|
+
function jr(e) {
|
|
5404
5544
|
if (e.type.startsWith("image/")) return "image";
|
|
5405
5545
|
if (e.type.startsWith("video/")) return "video";
|
|
5406
5546
|
if (e.type.startsWith("audio/")) return "audio";
|
|
5407
5547
|
let t = e.name.split(".").pop()?.toLowerCase() || "";
|
|
5408
5548
|
return /^(png|jpe?g|gif|webp|bmp|svg|avif)$/.test(t) ? "image" : /^(mp4|m3u8|webm|ogg|mov|avi|wmv|flv|mkv|ts|m4v|3gp|f4v|rmvb)$/.test(t) ? "video" : /^(mp3|wav|flac|aac|m4a|wma|opus)$/.test(t) ? "audio" : /^(md|markdown)$/.test(t) ? "markdown" : "file";
|
|
5409
5549
|
}
|
|
5410
|
-
function
|
|
5550
|
+
function Mr(e) {
|
|
5411
5551
|
let t = e.name.split(".").pop()?.toLowerCase() || "";
|
|
5412
5552
|
return t === "md" || t === "markdown";
|
|
5413
5553
|
}
|
|
5414
|
-
async function
|
|
5415
|
-
let i = n ?? e.state.selection.from, a = r ?
|
|
5416
|
-
o?.chooseMd ? o.chooseMd(t.name, e) :
|
|
5554
|
+
async function Nr(e, t, n, r) {
|
|
5555
|
+
let i = n ?? e.state.selection.from, a = r ? pn(r) : void 0, o = r?.storage?.qingwuUI, s = await new Promise((e) => {
|
|
5556
|
+
o?.chooseMd ? o.chooseMd(t.name, e) : mr(t.name).then(e);
|
|
5417
5557
|
});
|
|
5418
5558
|
if (s === null) return;
|
|
5419
5559
|
if (s === "attach") {
|
|
5420
|
-
let n = a ?
|
|
5560
|
+
let n = a ? mn(e.state.doc, t, a) : null;
|
|
5421
5561
|
if (n) {
|
|
5422
5562
|
Z(n);
|
|
5423
5563
|
return;
|
|
@@ -5448,8 +5588,8 @@ async function Dr(e, t, n, r) {
|
|
|
5448
5588
|
e.dispatch(e.state.tr.insert(i, t.from(u)));
|
|
5449
5589
|
}
|
|
5450
5590
|
}
|
|
5451
|
-
function
|
|
5452
|
-
switch (
|
|
5591
|
+
function Pr(e, t, n) {
|
|
5592
|
+
switch (jr(t)) {
|
|
5453
5593
|
case "image": return e.nodes.image?.create({
|
|
5454
5594
|
src: n,
|
|
5455
5595
|
alt: t.name
|
|
@@ -5475,7 +5615,7 @@ function Or(e, t, n) {
|
|
|
5475
5615
|
}
|
|
5476
5616
|
}
|
|
5477
5617
|
}
|
|
5478
|
-
async function
|
|
5618
|
+
async function Fr(e, t, n) {
|
|
5479
5619
|
let r;
|
|
5480
5620
|
try {
|
|
5481
5621
|
r = o();
|
|
@@ -5494,13 +5634,13 @@ async function kr(e, t, n) {
|
|
|
5494
5634
|
return console.error(`${t.type} upload failed:`, e), URL.revokeObjectURL(n), null;
|
|
5495
5635
|
}
|
|
5496
5636
|
}
|
|
5497
|
-
async function
|
|
5498
|
-
let i = r ?
|
|
5637
|
+
async function Ir(e, t, n, r) {
|
|
5638
|
+
let i = r ? pn(r) : void 0, a = i ? mn(e.state.doc, t, i) : null;
|
|
5499
5639
|
if (a) {
|
|
5500
5640
|
Z(a);
|
|
5501
5641
|
return;
|
|
5502
5642
|
}
|
|
5503
|
-
let o = URL.createObjectURL(t), s =
|
|
5643
|
+
let o = URL.createObjectURL(t), s = Pr(e.state.schema, t, o);
|
|
5504
5644
|
if (!s) return;
|
|
5505
5645
|
let c = n ?? e.state.selection.from;
|
|
5506
5646
|
try {
|
|
@@ -5508,9 +5648,9 @@ async function Ar(e, t, n, r) {
|
|
|
5508
5648
|
} catch {
|
|
5509
5649
|
return;
|
|
5510
5650
|
}
|
|
5511
|
-
await
|
|
5651
|
+
await Fr(e, t, o);
|
|
5512
5652
|
}
|
|
5513
|
-
var
|
|
5653
|
+
var Lr = R.create({
|
|
5514
5654
|
name: "imageUpload",
|
|
5515
5655
|
addOptions() {
|
|
5516
5656
|
return {
|
|
@@ -5520,8 +5660,8 @@ var jr = R.create({
|
|
|
5520
5660
|
},
|
|
5521
5661
|
addProseMirrorPlugins() {
|
|
5522
5662
|
let e = this.editor;
|
|
5523
|
-
return [new
|
|
5524
|
-
key: new
|
|
5663
|
+
return [new V({
|
|
5664
|
+
key: new H("imageUpload"),
|
|
5525
5665
|
props: {
|
|
5526
5666
|
handleDrop(t, n) {
|
|
5527
5667
|
let r = n.dataTransfer?.files;
|
|
@@ -5531,23 +5671,23 @@ var jr = R.create({
|
|
|
5531
5671
|
left: n.clientX,
|
|
5532
5672
|
top: n.clientY
|
|
5533
5673
|
});
|
|
5534
|
-
for (let n of Array.from(r))
|
|
5674
|
+
for (let n of Array.from(r)) Mr(n) ? Nr(t, n, i?.pos, e) : Ir(t, n, i?.pos, e);
|
|
5535
5675
|
return !0;
|
|
5536
5676
|
},
|
|
5537
5677
|
handlePaste(t, n) {
|
|
5538
5678
|
let r = n.clipboardData?.items;
|
|
5539
5679
|
if (!r) return !1;
|
|
5540
5680
|
let i = n.clipboardData?.getData("text/plain") || "";
|
|
5541
|
-
if ((n.clipboardData?.files?.length ?? 0) > 0 &&
|
|
5681
|
+
if ((n.clipboardData?.files?.length ?? 0) > 0 && Ar(i, void 0, a())) return !1;
|
|
5542
5682
|
for (let i of Array.from(r)) {
|
|
5543
5683
|
if (i.type.startsWith("image/") || i.type.startsWith("video/") || i.type.startsWith("audio/")) {
|
|
5544
5684
|
n.preventDefault();
|
|
5545
5685
|
let r = i.getAsFile();
|
|
5546
|
-
return r &&
|
|
5686
|
+
return r && jr(r) !== "file" && Ir(t, r, void 0, e), !0;
|
|
5547
5687
|
}
|
|
5548
5688
|
if (i.kind === "file") {
|
|
5549
5689
|
let r = i.getAsFile();
|
|
5550
|
-
if (r &&
|
|
5690
|
+
if (r && Mr(r)) return n.preventDefault(), Nr(t, r, void 0, e), !0;
|
|
5551
5691
|
}
|
|
5552
5692
|
}
|
|
5553
5693
|
return !1;
|
|
@@ -5555,12 +5695,12 @@ var jr = R.create({
|
|
|
5555
5695
|
}
|
|
5556
5696
|
})];
|
|
5557
5697
|
}
|
|
5558
|
-
}),
|
|
5698
|
+
}), Rr = 100, zr = R.create({
|
|
5559
5699
|
name: "imeCommitSpaceGuard",
|
|
5560
5700
|
addProseMirrorPlugins() {
|
|
5561
5701
|
let e = 0;
|
|
5562
|
-
return [new
|
|
5563
|
-
key: new
|
|
5702
|
+
return [new V({
|
|
5703
|
+
key: new H("imeCommitSpaceGuard"),
|
|
5564
5704
|
props: { handleDOMEvents: {
|
|
5565
5705
|
compositionend() {
|
|
5566
5706
|
return e = performance.now(), !1;
|
|
@@ -5570,39 +5710,328 @@ var jr = R.create({
|
|
|
5570
5710
|
},
|
|
5571
5711
|
beforeinput(t, n) {
|
|
5572
5712
|
let r = n;
|
|
5573
|
-
return r.inputType !== "insertText" || r.data !== " " || r.isComposing || performance.now() - e >
|
|
5713
|
+
return r.inputType !== "insertText" || r.data !== " " || r.isComposing || performance.now() - e > Rr ? !1 : (r.preventDefault(), !0);
|
|
5574
5714
|
}
|
|
5575
5715
|
} }
|
|
5576
5716
|
})];
|
|
5577
5717
|
}
|
|
5578
|
-
}),
|
|
5718
|
+
}), Br = R.create({
|
|
5579
5719
|
name: "inlineCodeEnd",
|
|
5580
5720
|
addInputRules() {
|
|
5581
5721
|
let e = this.editor.schema.marks.code;
|
|
5582
|
-
return e ? [
|
|
5722
|
+
return e ? [z({
|
|
5583
5723
|
find: /`([^`]+)`$/,
|
|
5584
5724
|
type: e
|
|
5585
5725
|
})] : [];
|
|
5586
5726
|
}
|
|
5587
|
-
})
|
|
5588
|
-
|
|
5727
|
+
});
|
|
5728
|
+
//#endregion
|
|
5729
|
+
//#region src/editor/extensions/math-utils.ts
|
|
5730
|
+
function Vr(e) {
|
|
5731
|
+
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, " ");
|
|
5732
|
+
}
|
|
5733
|
+
function Hr(e) {
|
|
5734
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
5735
|
+
}
|
|
5736
|
+
function Ur(e, t) {
|
|
5737
|
+
let n = e ?? "";
|
|
5738
|
+
if (!n.trim()) return "";
|
|
5739
|
+
try {
|
|
5740
|
+
return Ce.renderToString(n, {
|
|
5741
|
+
displayMode: t,
|
|
5742
|
+
throwOnError: !1,
|
|
5743
|
+
strict: "ignore",
|
|
5744
|
+
trust: !1,
|
|
5745
|
+
output: "htmlAndMathml"
|
|
5746
|
+
});
|
|
5747
|
+
} catch {
|
|
5748
|
+
return `<span class="math-fallback">${Hr(n)}</span>`;
|
|
5749
|
+
}
|
|
5750
|
+
}
|
|
5751
|
+
//#endregion
|
|
5752
|
+
//#region src/editor/extensions/math-view.tsx
|
|
5753
|
+
function Wr({ node: e, updateAttributes: t, deleteNode: n, editor: r, selected: i }) {
|
|
5754
|
+
let a = e.type.name === "mathBlock", o = String(e.attrs.latex ?? ""), s = r?.isEditable ?? !0, [c, l] = T(!1), [u, d] = T(o), p = w(null), m = w(!1), h = w(() => {}), g = w(() => {}), _ = C(() => Ur(o, a), [o, a]), v = C(() => Ur(u, a), [u, a]), y = () => {
|
|
5755
|
+
let e = u.trim();
|
|
5756
|
+
if (!e) {
|
|
5757
|
+
l(!1), s && n?.();
|
|
5758
|
+
return;
|
|
5759
|
+
}
|
|
5760
|
+
t({ latex: e }), l(!1);
|
|
5761
|
+
}, b = () => {
|
|
5762
|
+
l(!1), !o && s && n?.();
|
|
5763
|
+
};
|
|
5764
|
+
h.current = y, g.current = b, x(() => {
|
|
5765
|
+
!s || m.current || (m.current = !0, o || l(!0));
|
|
5766
|
+
}, [s, o]), x(() => {
|
|
5767
|
+
if (!c) return;
|
|
5768
|
+
d(o);
|
|
5769
|
+
let e = window.setTimeout(() => {
|
|
5770
|
+
p.current?.focus(), p.current?.select();
|
|
5771
|
+
}, 30), t = (e) => {
|
|
5772
|
+
e.key === "Escape" ? (e.preventDefault(), g.current()) : (e.metaKey || e.ctrlKey) && e.key === "Enter" && (e.preventDefault(), h.current());
|
|
5773
|
+
};
|
|
5774
|
+
return window.addEventListener("keydown", t, !0), () => {
|
|
5775
|
+
window.clearTimeout(e), window.removeEventListener("keydown", t, !0);
|
|
5776
|
+
};
|
|
5777
|
+
}, [c, o]);
|
|
5778
|
+
let S = () => {
|
|
5779
|
+
s && l(!0);
|
|
5780
|
+
};
|
|
5781
|
+
return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(P, {
|
|
5782
|
+
as: a ? "div" : "span",
|
|
5783
|
+
className: `math-node ${a ? "math-node--block" : "math-node--inline"}${i ? " is-selected" : ""}`,
|
|
5784
|
+
contentEditable: !1,
|
|
5785
|
+
onMouseDown: (e) => {
|
|
5786
|
+
s && e.preventDefault();
|
|
5787
|
+
},
|
|
5788
|
+
onClick: (e) => {
|
|
5789
|
+
e.preventDefault(), e.stopPropagation(), S();
|
|
5790
|
+
},
|
|
5791
|
+
children: o ? /* @__PURE__ */ D("span", {
|
|
5792
|
+
className: "math-render",
|
|
5793
|
+
dangerouslySetInnerHTML: { __html: _ }
|
|
5794
|
+
}) : /* @__PURE__ */ D("span", {
|
|
5795
|
+
className: "math-placeholder",
|
|
5796
|
+
children: f("editor.math.empty")
|
|
5797
|
+
})
|
|
5798
|
+
}), c && L(/* @__PURE__ */ D("div", {
|
|
5799
|
+
className: "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none",
|
|
5800
|
+
onClick: b,
|
|
5801
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
5802
|
+
children: /* @__PURE__ */ O("div", {
|
|
5803
|
+
className: "w-full max-w-lg mx-4 rounded-xl border border-default-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 p-5 shadow-xl",
|
|
5804
|
+
onClick: (e) => e.stopPropagation(),
|
|
5805
|
+
children: [
|
|
5806
|
+
/* @__PURE__ */ D("div", {
|
|
5807
|
+
className: "mb-3 text-sm font-medium text-default-800 dark:text-zinc-100",
|
|
5808
|
+
children: f(a ? "editor.math.blockTitle" : "editor.math.inlineTitle")
|
|
5809
|
+
}),
|
|
5810
|
+
/* @__PURE__ */ D("textarea", {
|
|
5811
|
+
ref: p,
|
|
5812
|
+
value: u,
|
|
5813
|
+
onChange: (e) => d(e.target.value),
|
|
5814
|
+
rows: a ? 5 : 2,
|
|
5815
|
+
spellCheck: !1,
|
|
5816
|
+
placeholder: f("editor.math.placeholder"),
|
|
5817
|
+
className: "w-full resize-y rounded-lg border border-default-200 dark:border-zinc-700 bg-default-50 dark:bg-zinc-900 px-3 py-2 font-mono text-sm text-default-800 dark:text-zinc-100 outline-none focus:ring-2 focus:ring-qingwu-500/40"
|
|
5818
|
+
}),
|
|
5819
|
+
/* @__PURE__ */ D("div", {
|
|
5820
|
+
className: "math-dialog-preview",
|
|
5821
|
+
children: u.trim() ? /* @__PURE__ */ D("div", { dangerouslySetInnerHTML: { __html: v } }) : /* @__PURE__ */ D("span", {
|
|
5822
|
+
className: "math-placeholder",
|
|
5823
|
+
children: f("editor.math.emptyPreview")
|
|
5824
|
+
})
|
|
5825
|
+
}),
|
|
5826
|
+
/* @__PURE__ */ O("div", {
|
|
5827
|
+
className: "mt-4 flex items-center justify-between gap-3",
|
|
5828
|
+
children: [/* @__PURE__ */ D("span", {
|
|
5829
|
+
className: "text-[11px] text-default-400 dark:text-zinc-500",
|
|
5830
|
+
children: f("editor.math.hint")
|
|
5831
|
+
}), /* @__PURE__ */ O("div", {
|
|
5832
|
+
className: "flex shrink-0 gap-2",
|
|
5833
|
+
children: [/* @__PURE__ */ D("button", {
|
|
5834
|
+
type: "button",
|
|
5835
|
+
className: "px-3 py-1.5 text-xs rounded-lg border border-default-200 dark:border-zinc-600 hover:bg-default-100 dark:hover:bg-zinc-700 transition-colors",
|
|
5836
|
+
onClick: b,
|
|
5837
|
+
children: f("editor.math.cancel")
|
|
5838
|
+
}), /* @__PURE__ */ D("button", {
|
|
5839
|
+
type: "button",
|
|
5840
|
+
className: "px-3 py-1.5 text-xs rounded-lg bg-qingwu-600 hover:bg-qingwu-700 text-white transition-colors",
|
|
5841
|
+
onClick: y,
|
|
5842
|
+
children: f("editor.math.save")
|
|
5843
|
+
})]
|
|
5844
|
+
})]
|
|
5845
|
+
})
|
|
5846
|
+
]
|
|
5847
|
+
})
|
|
5848
|
+
}), document.body)] });
|
|
5849
|
+
}
|
|
5850
|
+
//#endregion
|
|
5851
|
+
//#region src/editor/extensions/math.ts
|
|
5852
|
+
var Gr = /(?:^|[^\\$])\$([^\s$](?:[^$\n]*[^\s$])?)\$$/, Kr = /^\$\$([\s\S]+?)\$\$$/;
|
|
5853
|
+
function qr(e) {
|
|
5854
|
+
return new re({
|
|
5855
|
+
find: Gr,
|
|
5856
|
+
handler: ({ state: t, range: n, match: r }) => {
|
|
5857
|
+
let i = r[1], a = r[0].indexOf("$");
|
|
5858
|
+
if (a < 0) return;
|
|
5859
|
+
let o = n.from + a, s = n.to;
|
|
5860
|
+
o >= s || t.tr.replaceWith(o, s, e.create({ latex: i }));
|
|
5861
|
+
}
|
|
5862
|
+
});
|
|
5863
|
+
}
|
|
5864
|
+
function Jr(e) {
|
|
5865
|
+
return new re({
|
|
5866
|
+
find: Kr,
|
|
5867
|
+
handler: ({ state: t, range: n, match: r }) => {
|
|
5868
|
+
let i = r[1].trim();
|
|
5869
|
+
if (!i) return;
|
|
5870
|
+
let a = t.doc.resolve(n.from), o = a.depth, s = a.before(o), c = a.after(o), l = e.create({ latex: i }), u = t.tr.replaceWith(s, c, l), d = s + l.nodeSize, f = u.doc.resolve(d);
|
|
5871
|
+
(!f.nodeAfter || !f.nodeAfter.isTextblock) && u.insert(d, t.schema.nodes.paragraph.create()), u.setSelection(ae.near(u.doc.resolve(d), 1));
|
|
5872
|
+
}
|
|
5873
|
+
});
|
|
5874
|
+
}
|
|
5875
|
+
function Yr(e, t) {
|
|
5876
|
+
let n = e.src, r = e.pos;
|
|
5877
|
+
if (n.charCodeAt(r) !== 36 || n.charCodeAt(r + 1) === 36) return !1;
|
|
5878
|
+
let i = r + 1;
|
|
5879
|
+
for (; i < n.length;) {
|
|
5880
|
+
let e = n.charCodeAt(i);
|
|
5881
|
+
if (e === 10) return !1;
|
|
5882
|
+
if (e === 36 && n.charCodeAt(i - 1) !== 92) break;
|
|
5883
|
+
i += 1;
|
|
5884
|
+
}
|
|
5885
|
+
if (i >= n.length) return !1;
|
|
5886
|
+
let a = n.slice(r + 1, i);
|
|
5887
|
+
if (!a || /^\s|\s$/.test(a)) return !1;
|
|
5888
|
+
if (!t) {
|
|
5889
|
+
let t = e.push("html_inline", "", 0);
|
|
5890
|
+
t.content = `<span data-type="inline-math" data-latex="${Vr(a)}"></span>`;
|
|
5891
|
+
}
|
|
5892
|
+
return e.pos = i + 1, !0;
|
|
5893
|
+
}
|
|
5894
|
+
function Xr(e, t, n, r) {
|
|
5895
|
+
let i = e.bMarks[t] + e.tShift[t], a = e.eMarks[t];
|
|
5896
|
+
if (i + 1 >= a || e.src.charCodeAt(i) !== 36 || e.src.charCodeAt(i + 1) !== 36) return !1;
|
|
5897
|
+
let o = e.src.slice(i, a).trim(), s = "", c = t + 1;
|
|
5898
|
+
if (o.length > 4 && o.endsWith("$$")) s = o.slice(2, -2);
|
|
5899
|
+
else {
|
|
5900
|
+
let t = [], r = o.slice(2), i = r.endsWith("$$");
|
|
5901
|
+
if (i) s = r.slice(0, -2);
|
|
5902
|
+
else {
|
|
5903
|
+
for (r && t.push(r); c < n; c += 1) {
|
|
5904
|
+
let n = e.bMarks[c] + e.tShift[c], r = e.eMarks[c], a = e.src.slice(n, r), o = a.trimEnd();
|
|
5905
|
+
if (o.endsWith("$$")) {
|
|
5906
|
+
t.push(o.slice(0, -2)), i = !0, c += 1;
|
|
5907
|
+
break;
|
|
5908
|
+
}
|
|
5909
|
+
t.push(a);
|
|
5910
|
+
}
|
|
5911
|
+
if (!i) return !1;
|
|
5912
|
+
s = t.join("\n");
|
|
5913
|
+
}
|
|
5914
|
+
}
|
|
5915
|
+
if (r) return !0;
|
|
5916
|
+
let l = e.push("html_block", "", 0);
|
|
5917
|
+
return l.content = `<div data-type="block-math" data-latex="${Vr(s.trim())}"></div>\n`, e.line = c, !0;
|
|
5918
|
+
}
|
|
5919
|
+
function Zr(e) {
|
|
5920
|
+
e.__qingwuMathReg || (e.__qingwuMathReg = !0, e.inline.ruler.before("backticks", "qingwu_math_inline", Yr), e.block.ruler.before("fence", "qingwu_math_block", Xr, { alt: ["paragraph"] }));
|
|
5921
|
+
}
|
|
5922
|
+
function Qr(e) {
|
|
5923
|
+
return { markdown: {
|
|
5924
|
+
serialize(t, n) {
|
|
5925
|
+
let r = String(n.attrs.latex ?? "");
|
|
5926
|
+
if (!e) {
|
|
5927
|
+
t.write(`$${r}$`);
|
|
5928
|
+
return;
|
|
5929
|
+
}
|
|
5930
|
+
t.ensureNewLine(), t.write("$$"), t.ensureNewLine();
|
|
5931
|
+
for (let e of r.split("\n")) t.write(e), t.ensureNewLine();
|
|
5932
|
+
t.write("$$"), t.closeBlock(n);
|
|
5933
|
+
},
|
|
5934
|
+
parse: { setup(e) {
|
|
5935
|
+
Zr(e);
|
|
5936
|
+
} }
|
|
5937
|
+
} };
|
|
5938
|
+
}
|
|
5939
|
+
var $r = ie.create({
|
|
5940
|
+
name: "mathInline",
|
|
5941
|
+
group: "inline",
|
|
5942
|
+
inline: !0,
|
|
5943
|
+
atom: !0,
|
|
5944
|
+
selectable: !0,
|
|
5945
|
+
addAttributes() {
|
|
5946
|
+
return { latex: {
|
|
5947
|
+
default: "",
|
|
5948
|
+
parseHTML: (e) => e.getAttribute("data-latex") ?? e.textContent ?? ""
|
|
5949
|
+
} };
|
|
5950
|
+
},
|
|
5951
|
+
parseHTML() {
|
|
5952
|
+
return [{ tag: "span[data-type=\"inline-math\"]" }, { tag: "span.math-node--inline" }];
|
|
5953
|
+
},
|
|
5954
|
+
renderHTML({ node: e }) {
|
|
5955
|
+
let t = String(e.attrs.latex ?? ""), n = {
|
|
5956
|
+
"data-type": "inline-math",
|
|
5957
|
+
"data-latex": t,
|
|
5958
|
+
class: "math-node math-node--inline"
|
|
5959
|
+
};
|
|
5960
|
+
if (typeof document > "u") return [
|
|
5961
|
+
"span",
|
|
5962
|
+
n,
|
|
5963
|
+
t
|
|
5964
|
+
];
|
|
5965
|
+
let r = document.createElement("span");
|
|
5966
|
+
for (let [e, t] of Object.entries(n)) r.setAttribute(e, t);
|
|
5967
|
+
return r.innerHTML = Ur(t, !1), r;
|
|
5968
|
+
},
|
|
5969
|
+
addNodeView() {
|
|
5970
|
+
return F(Wr);
|
|
5971
|
+
},
|
|
5972
|
+
addInputRules() {
|
|
5973
|
+
return [qr(this.type)];
|
|
5974
|
+
},
|
|
5975
|
+
addStorage() {
|
|
5976
|
+
return Qr(!1);
|
|
5977
|
+
}
|
|
5978
|
+
}), ei = ie.create({
|
|
5979
|
+
name: "mathBlock",
|
|
5980
|
+
group: "block",
|
|
5981
|
+
atom: !0,
|
|
5982
|
+
selectable: !0,
|
|
5983
|
+
addAttributes() {
|
|
5984
|
+
return { latex: {
|
|
5985
|
+
default: "",
|
|
5986
|
+
parseHTML: (e) => e.getAttribute("data-latex") ?? e.textContent ?? ""
|
|
5987
|
+
} };
|
|
5988
|
+
},
|
|
5989
|
+
parseHTML() {
|
|
5990
|
+
return [{ tag: "div[data-type=\"block-math\"]" }, { tag: "div.math-node--block" }];
|
|
5991
|
+
},
|
|
5992
|
+
renderHTML({ node: e }) {
|
|
5993
|
+
let t = String(e.attrs.latex ?? ""), n = {
|
|
5994
|
+
"data-type": "block-math",
|
|
5995
|
+
"data-latex": t,
|
|
5996
|
+
class: "math-node math-node--block"
|
|
5997
|
+
};
|
|
5998
|
+
if (typeof document > "u") return [
|
|
5999
|
+
"div",
|
|
6000
|
+
n,
|
|
6001
|
+
t
|
|
6002
|
+
];
|
|
6003
|
+
let r = document.createElement("div");
|
|
6004
|
+
for (let [e, t] of Object.entries(n)) r.setAttribute(e, t);
|
|
6005
|
+
return r.innerHTML = Ur(t, !0), r;
|
|
6006
|
+
},
|
|
6007
|
+
addNodeView() {
|
|
6008
|
+
return F(Wr);
|
|
6009
|
+
},
|
|
6010
|
+
addInputRules() {
|
|
6011
|
+
return [Jr(this.type)];
|
|
6012
|
+
},
|
|
6013
|
+
addStorage() {
|
|
6014
|
+
return Qr(!0);
|
|
6015
|
+
}
|
|
6016
|
+
}), ti = /\.(png|jpe?g|gif|webp|bmp|svg|avif)(\?|#|$)/i, ni = /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|#|$)/i, ri = /\.(mp3|wav|ogg|flac|aac|m4a|wma|opus)(\?|#|$)/i;
|
|
6017
|
+
function ii(e) {
|
|
5589
6018
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
5590
6019
|
}
|
|
5591
|
-
function
|
|
6020
|
+
function ai(e) {
|
|
5592
6021
|
let t = e.trim().replace(/\\/g, "/");
|
|
5593
6022
|
return t.split("/").pop() || t;
|
|
5594
6023
|
}
|
|
5595
|
-
function
|
|
6024
|
+
function oi(e, t) {
|
|
5596
6025
|
let n = e.src.slice(e.pos), r = /^!\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/.exec(n), i = !0;
|
|
5597
6026
|
if (r || (r = /^\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/.exec(n), i = !1), !r) return !1;
|
|
5598
6027
|
let a = r[1].trim(), o = r[2]?.trim();
|
|
5599
6028
|
if (!t) {
|
|
5600
|
-
let t = o ||
|
|
6029
|
+
let t = o || ai(a);
|
|
5601
6030
|
if (i) {
|
|
5602
6031
|
let n = "";
|
|
5603
|
-
if (
|
|
5604
|
-
else if (
|
|
5605
|
-
else if (
|
|
6032
|
+
if (ti.test(a) || /^data:image\//i.test(a)) n = `<img src="${ii(a)}" alt="${ii(t)}">`;
|
|
6033
|
+
else if (ni.test(a) || /^data:video\//i.test(a)) n = `<div data-video-embed src="${ii(a)}"></div>`;
|
|
6034
|
+
else if (ri.test(a) || /^data:audio\//i.test(a)) n = `<audio src="${ii(a)}"></audio>`;
|
|
5606
6035
|
else {
|
|
5607
6036
|
let n = e.push("link_open", "a", 1);
|
|
5608
6037
|
n.attrs = [["href", a]];
|
|
@@ -5620,14 +6049,14 @@ function Br(e, t) {
|
|
|
5620
6049
|
}
|
|
5621
6050
|
return e.pos += r[0].length, !0;
|
|
5622
6051
|
}
|
|
5623
|
-
var
|
|
6052
|
+
var si = R.create({
|
|
5624
6053
|
name: "obsidianMarkdown",
|
|
5625
6054
|
addStorage() {
|
|
5626
6055
|
return { markdown: { parse: { setup(e) {
|
|
5627
|
-
e.__obsidianReg || (e.__obsidianReg = !0, e.inline.ruler.before("link", "obsidian_embed",
|
|
6056
|
+
e.__obsidianReg || (e.__obsidianReg = !0, e.inline.ruler.before("link", "obsidian_embed", oi));
|
|
5628
6057
|
} } } };
|
|
5629
6058
|
}
|
|
5630
|
-
}),
|
|
6059
|
+
}), ci = R.create({
|
|
5631
6060
|
name: "qingwuUI",
|
|
5632
6061
|
addStorage() {
|
|
5633
6062
|
return {};
|
|
@@ -5635,7 +6064,7 @@ var Vr = R.create({
|
|
|
5635
6064
|
});
|
|
5636
6065
|
//#endregion
|
|
5637
6066
|
//#region src/editor/utils/render-probe.ts
|
|
5638
|
-
function
|
|
6067
|
+
function li(e, t) {
|
|
5639
6068
|
return new Promise((n) => {
|
|
5640
6069
|
if (typeof Image != "function") return n(!0);
|
|
5641
6070
|
let r = new Image(), i = !1, a = setTimeout(() => o(!1), t), o = (e) => {
|
|
@@ -5644,14 +6073,14 @@ function Ur(e, t) {
|
|
|
5644
6073
|
r.onload = () => o(!0), r.onerror = () => o(!1), r.src = e;
|
|
5645
6074
|
});
|
|
5646
6075
|
}
|
|
5647
|
-
async function
|
|
5648
|
-
if (await
|
|
6076
|
+
async function ui(e, t = 8e3) {
|
|
6077
|
+
if (await li(e, t)) return !0;
|
|
5649
6078
|
try {
|
|
5650
6079
|
let r = await n(e);
|
|
5651
6080
|
if (!r) return !1;
|
|
5652
6081
|
let i = await fetch(e, { headers: r });
|
|
5653
6082
|
if (!i.ok) return !1;
|
|
5654
|
-
let a = URL.createObjectURL(await i.blob()), o = await
|
|
6083
|
+
let a = URL.createObjectURL(await i.blob()), o = await li(a, t);
|
|
5655
6084
|
return URL.revokeObjectURL(a), o;
|
|
5656
6085
|
} catch {
|
|
5657
6086
|
return !1;
|
|
@@ -5659,7 +6088,7 @@ async function Wr(e, t = 8e3) {
|
|
|
5659
6088
|
}
|
|
5660
6089
|
//#endregion
|
|
5661
6090
|
//#region src/editor/utils/resolve-local-media.ts
|
|
5662
|
-
function
|
|
6091
|
+
function di() {
|
|
5663
6092
|
return {
|
|
5664
6093
|
uploaded: 0,
|
|
5665
6094
|
sessionOnly: 0,
|
|
@@ -5669,10 +6098,10 @@ function Gr() {
|
|
|
5669
6098
|
readFailed: []
|
|
5670
6099
|
};
|
|
5671
6100
|
}
|
|
5672
|
-
function
|
|
6101
|
+
function fi(e, t) {
|
|
5673
6102
|
e.uploaded += t.uploaded, e.sessionOnly += t.sessionOnly, e.limitRejected += t.limitRejected, e.renderFailed += t.renderFailed, e.missing.push(...t.missing), e.readFailed.push(...t.readFailed);
|
|
5674
6103
|
}
|
|
5675
|
-
function
|
|
6104
|
+
function pi(e, t, n, r) {
|
|
5676
6105
|
let { state: i } = e, a = [];
|
|
5677
6106
|
if (i.doc.descendants((e, n) => {
|
|
5678
6107
|
e.attrs?.src === t && a.push(n);
|
|
@@ -5688,7 +6117,7 @@ function qr(e, t, n, r) {
|
|
|
5688
6117
|
}
|
|
5689
6118
|
return e.dispatch(o), !0;
|
|
5690
6119
|
}
|
|
5691
|
-
function
|
|
6120
|
+
function mi(e, t, n) {
|
|
5692
6121
|
let { state: r } = e, i = r.schema.marks.link;
|
|
5693
6122
|
if (!i) return !1;
|
|
5694
6123
|
let a = [];
|
|
@@ -5706,7 +6135,7 @@ function Jr(e, t, n) {
|
|
|
5706
6135
|
}));
|
|
5707
6136
|
return e.dispatch(o), !0;
|
|
5708
6137
|
}
|
|
5709
|
-
function
|
|
6138
|
+
function hi(e) {
|
|
5710
6139
|
let t = /* @__PURE__ */ new Map();
|
|
5711
6140
|
for (let n of e) {
|
|
5712
6141
|
let e = t.get(n.normalized);
|
|
@@ -5714,36 +6143,36 @@ function Yr(e) {
|
|
|
5714
6143
|
}
|
|
5715
6144
|
return Array.from(t.values());
|
|
5716
6145
|
}
|
|
5717
|
-
async function
|
|
6146
|
+
async function gi(e, t, n, r) {
|
|
5718
6147
|
if (n.length === 0) return "sessionOnly";
|
|
5719
|
-
let i = n[0], a =
|
|
6148
|
+
let i = n[0], a = pn(t);
|
|
5720
6149
|
if (a) {
|
|
5721
|
-
let t =
|
|
6150
|
+
let t = mn(e.state.doc, r, a);
|
|
5722
6151
|
if (t) return Z(`${i.basename}:${t}`, "error"), "limitRejected";
|
|
5723
6152
|
}
|
|
5724
6153
|
let s = n.filter((e) => !e.isLink), c = n.filter((e) => e.isLink);
|
|
5725
6154
|
if (s.length === 0) try {
|
|
5726
6155
|
let t = await o().upload(r, "editor"), n = !1;
|
|
5727
|
-
for (let r of c)
|
|
6156
|
+
for (let r of c) mi(e, r.src, t) && (n = !0);
|
|
5728
6157
|
return n ? "uploaded" : "sessionOnly";
|
|
5729
6158
|
} catch (e) {
|
|
5730
6159
|
return console.error(`本地附件 ${i.basename} 上传失败:`, e), Z(`「${i.basename}」上传失败`, "error"), "sessionOnly";
|
|
5731
6160
|
}
|
|
5732
6161
|
let l = URL.createObjectURL(r), u = !1;
|
|
5733
|
-
for (let t of s)
|
|
6162
|
+
for (let t of s) pi(e, t.src, l, r.size) && (u = !0);
|
|
5734
6163
|
let d;
|
|
5735
6164
|
try {
|
|
5736
6165
|
d = await o().upload(r, "editor");
|
|
5737
6166
|
} catch (e) {
|
|
5738
6167
|
return console.error(`本地文件 ${i.basename} 上传失败:`, e), Z(`「${i.basename}」上传失败`, "error"), URL.revokeObjectURL(l), "sessionOnly";
|
|
5739
6168
|
}
|
|
5740
|
-
URL.revokeObjectURL(l), u &&
|
|
5741
|
-
for (let t of c)
|
|
5742
|
-
return !u && c.length === 0 ? "sessionOnly" : u && n.some((e) => e.kind === "image") ? await
|
|
6169
|
+
URL.revokeObjectURL(l), u && pi(e, l, d, r.size);
|
|
6170
|
+
for (let t of c) mi(e, t.src, d);
|
|
6171
|
+
return !u && c.length === 0 ? "sessionOnly" : u && n.some((e) => e.kind === "image") ? await ui(d) ? "uploaded" : "renderFailed" : "uploaded";
|
|
5743
6172
|
}
|
|
5744
|
-
function
|
|
6173
|
+
function _i(e, t) {
|
|
5745
6174
|
let n = [], r = [];
|
|
5746
|
-
for (let i of
|
|
6175
|
+
for (let i of hi(e)) {
|
|
5747
6176
|
let e = i[0], a = t.get(e.basename);
|
|
5748
6177
|
a ? (n.push({
|
|
5749
6178
|
refs: i,
|
|
@@ -5755,30 +6184,30 @@ function Zr(e, t) {
|
|
|
5755
6184
|
unmatched: r
|
|
5756
6185
|
};
|
|
5757
6186
|
}
|
|
5758
|
-
async function
|
|
5759
|
-
let i =
|
|
5760
|
-
for (let a of
|
|
5761
|
-
let n = a[0], { file: o, readError: s } = await
|
|
6187
|
+
async function vi(e, t, n, r) {
|
|
6188
|
+
let i = di();
|
|
6189
|
+
for (let a of hi(n)) {
|
|
6190
|
+
let n = a[0], { file: o, readError: s } = await Dr(r, n.src);
|
|
5762
6191
|
if (!o) {
|
|
5763
6192
|
s ? (console.warn(`本地文件「${n.basename}」在所选文件夹中找到但读取失败:`, s), i.readFailed.push(n)) : (console.warn(`本地文件「${n.basename}」未在所选文件夹「${r.name}」中找到`), i.missing.push(n));
|
|
5764
6193
|
continue;
|
|
5765
6194
|
}
|
|
5766
|
-
let c = await
|
|
6195
|
+
let c = await gi(e, t, a, o);
|
|
5767
6196
|
i[c]++;
|
|
5768
6197
|
}
|
|
5769
6198
|
return i;
|
|
5770
6199
|
}
|
|
5771
|
-
function
|
|
6200
|
+
function yi(e) {
|
|
5772
6201
|
let t = e.map((e) => e.basename);
|
|
5773
6202
|
return t.length <= 3 ? t.join("、") : `${t.slice(0, 3).join("、")} 等 ${t.length} 个文件`;
|
|
5774
6203
|
}
|
|
5775
|
-
function
|
|
6204
|
+
function bi(e) {
|
|
5776
6205
|
let t = [];
|
|
5777
|
-
if (e.uploaded > 0 && t.push(`${e.uploaded} 个已上传至存储`), e.sessionOnly > 0 && t.push(`${e.sessionOnly} 个仅本次会话可见(未配置存储或上传失败)`), e.limitRejected > 0 && t.push(`${e.limitRejected} 个超出大小限制`), e.renderFailed > 0 && t.push(`${e.renderFailed} 个上传成功但页面渲染失败(存储 URL 无法在浏览器访问/解码)`), e.readFailed.length > 0 && t.push(`${e.readFailed.length} 个找到但读取失败:${
|
|
6206
|
+
if (e.uploaded > 0 && t.push(`${e.uploaded} 个已上传至存储`), e.sessionOnly > 0 && t.push(`${e.sessionOnly} 个仅本次会话可见(未配置存储或上传失败)`), e.limitRejected > 0 && t.push(`${e.limitRejected} 个超出大小限制`), e.renderFailed > 0 && t.push(`${e.renderFailed} 个上传成功但页面渲染失败(存储 URL 无法在浏览器访问/解码)`), e.readFailed.length > 0 && t.push(`${e.readFailed.length} 个找到但读取失败:${yi(e.readFailed)}(若在 OneDrive / WPS 云盘等同步目录,请右键文件选择「始终保留在此设备」后重试)`), e.missing.length > 0 && t.push(`${e.missing.length} 个未能获取:${yi(e.missing)}(可把文件直接拖进编辑器上传)`), t.length === 0) return;
|
|
5778
6207
|
let n = e.uploaded > 0 && e.renderFailed === 0 && e.missing.length === 0 && e.readFailed.length === 0;
|
|
5779
6208
|
Z(`本地文件解析完成:${t.join(";")}`, n ? "success" : "info");
|
|
5780
6209
|
}
|
|
5781
|
-
function
|
|
6210
|
+
function xi(e) {
|
|
5782
6211
|
return new Promise((t) => {
|
|
5783
6212
|
let n = document.createElement("div");
|
|
5784
6213
|
n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
|
|
@@ -5805,7 +6234,7 @@ function ti(e) {
|
|
|
5805
6234
|
u.type = "button", u.className = "px-3 py-1.5 text-xs rounded-lg bg-blue-500 hover:bg-blue-600 text-white", u.textContent = "选择文件夹…", u.addEventListener("click", () => s("pick")), o.append(l, u), r.append(i, a, o), n.appendChild(r), document.addEventListener("keydown", c), document.body.appendChild(n);
|
|
5806
6235
|
});
|
|
5807
6236
|
}
|
|
5808
|
-
function
|
|
6237
|
+
function Si(e) {
|
|
5809
6238
|
let t = document.createElement("div");
|
|
5810
6239
|
t.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
|
|
5811
6240
|
let n = document.createElement("div");
|
|
@@ -5827,7 +6256,7 @@ function ni(e) {
|
|
|
5827
6256
|
let c = document.createElement("button");
|
|
5828
6257
|
c.type = "button", c.className = "px-3 py-1.5 text-xs rounded-lg bg-blue-500 hover:bg-blue-600 text-white", c.textContent = "知道了", c.addEventListener("click", o), a.append(c), n.append(r, i, a), t.appendChild(n), document.addEventListener("keydown", s), document.body.appendChild(t);
|
|
5829
6258
|
}
|
|
5830
|
-
function
|
|
6259
|
+
function Ci(e) {
|
|
5831
6260
|
return new Promise((t) => {
|
|
5832
6261
|
let n = document.createElement("div");
|
|
5833
6262
|
n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
|
|
@@ -5853,8 +6282,8 @@ function ri(e) {
|
|
|
5853
6282
|
u.type = "button", u.className = "px-3 py-1.5 text-xs rounded-lg bg-blue-500 hover:bg-blue-600 text-white", u.textContent = "选择文件…", u.addEventListener("click", () => s("pick")), o.append(l, u), r.append(i, a, o), n.appendChild(r), document.addEventListener("keydown", c), document.body.appendChild(n);
|
|
5854
6283
|
});
|
|
5855
6284
|
}
|
|
5856
|
-
async function
|
|
5857
|
-
let r =
|
|
6285
|
+
async function wi(e, t, n) {
|
|
6286
|
+
let r = di(), i = hi(n), a = await wr();
|
|
5858
6287
|
if (!a) {
|
|
5859
6288
|
for (let e of i) r.missing.push(e[0]);
|
|
5860
6289
|
return r;
|
|
@@ -5867,14 +6296,14 @@ async function ii(e, t, n) {
|
|
|
5867
6296
|
continue;
|
|
5868
6297
|
}
|
|
5869
6298
|
o.delete(i.basename);
|
|
5870
|
-
let s = await
|
|
6299
|
+
let s = await gi(e, t, n, a);
|
|
5871
6300
|
r[s]++;
|
|
5872
6301
|
}
|
|
5873
6302
|
return r;
|
|
5874
6303
|
}
|
|
5875
6304
|
//#endregion
|
|
5876
6305
|
//#region src/editor/extensions/relative-media.ts
|
|
5877
|
-
var
|
|
6306
|
+
var Ti = R.create({
|
|
5878
6307
|
name: "relativeMedia",
|
|
5879
6308
|
addStorage() {
|
|
5880
6309
|
return {
|
|
@@ -5884,42 +6313,42 @@ var ai = R.create({
|
|
|
5884
6313
|
},
|
|
5885
6314
|
addProseMirrorPlugins() {
|
|
5886
6315
|
let e = this.editor, t = this.storage, n = !1, r = null, i = async (n, i) => {
|
|
5887
|
-
let a = e.view, o =
|
|
6316
|
+
let a = e.view, o = di(), { matched: s, unmatched: c } = _i(n, t.clipboardFiles);
|
|
5888
6317
|
for (let { refs: t, file: n } of s) {
|
|
5889
|
-
let r = await
|
|
6318
|
+
let r = await gi(a, e, t, n);
|
|
5890
6319
|
o[r]++;
|
|
5891
6320
|
}
|
|
5892
6321
|
if (c.length > 0) {
|
|
5893
|
-
let t =
|
|
5894
|
-
if (
|
|
6322
|
+
let t = hi(c).length;
|
|
6323
|
+
if (xr()) {
|
|
5895
6324
|
let n = i ?? null;
|
|
5896
|
-
if (n || (await
|
|
5897
|
-
r = n,
|
|
6325
|
+
if (n || (await xi(t) === "pick" ? (n = await Sr(), n || Z("没有选择文件夹。本地文件暂以占位显示,稍后可直接把文件拖进编辑器上传", "info")) : Z("已选择稍后处理。本地文件暂以占位显示,可直接把文件拖进编辑器上传", "info")), n) {
|
|
6326
|
+
r = n, fi(o, await vi(a, e, c, n));
|
|
5898
6327
|
let t = [...o.missing, ...o.readFailed];
|
|
5899
|
-
if (t.length > 0 &&
|
|
5900
|
-
let n = await
|
|
5901
|
-
|
|
6328
|
+
if (t.length > 0 && Cr() && await Ci(t.map((e) => e.basename)) === "pick") {
|
|
6329
|
+
let n = await wi(a, e, t);
|
|
6330
|
+
fi(o, n), o.missing = n.missing, o.readFailed = [];
|
|
5902
6331
|
}
|
|
5903
6332
|
}
|
|
5904
|
-
} else
|
|
6333
|
+
} else Si(t);
|
|
5905
6334
|
}
|
|
5906
|
-
|
|
6335
|
+
bi(o);
|
|
5907
6336
|
}, o = () => {
|
|
5908
6337
|
if (!e || e.isDestroyed || t.pausedUntilPaste) return;
|
|
5909
|
-
let o = a(), s =
|
|
6338
|
+
let o = a(), s = kr(e.state.doc, o);
|
|
5910
6339
|
if (s.length === 0 || n) return;
|
|
5911
6340
|
n = !0;
|
|
5912
6341
|
let c = new Set(s.map((e) => e.src));
|
|
5913
6342
|
i(s).then(() => {
|
|
5914
6343
|
if (e.isDestroyed) return;
|
|
5915
|
-
let t =
|
|
6344
|
+
let t = kr(e.state.doc, o).filter((e) => !c.has(e.src));
|
|
5916
6345
|
if (t.length !== 0) return i(t, r);
|
|
5917
6346
|
}).finally(() => {
|
|
5918
|
-
n = !1, !(!e || e.isDestroyed) && (t.pausedUntilPaste =
|
|
6347
|
+
n = !1, !(!e || e.isDestroyed) && (t.pausedUntilPaste = kr(e.state.doc, o).length > 0);
|
|
5919
6348
|
});
|
|
5920
6349
|
};
|
|
5921
|
-
return [new
|
|
5922
|
-
key: new
|
|
6350
|
+
return [new V({
|
|
6351
|
+
key: new H("relativeMedia"),
|
|
5923
6352
|
props: { handlePaste(e, n) {
|
|
5924
6353
|
let r = n.clipboardData?.files;
|
|
5925
6354
|
return t.clipboardFiles = new Map(Array.from(r ?? []).map((e) => [e.name.toLowerCase(), e])), t.pausedUntilPaste = !1, !1;
|
|
@@ -5929,18 +6358,18 @@ var ai = R.create({
|
|
|
5929
6358
|
}
|
|
5930
6359
|
})];
|
|
5931
6360
|
}
|
|
5932
|
-
}),
|
|
5933
|
-
function
|
|
6361
|
+
}), Ei = new H("slashCommand");
|
|
6362
|
+
function Di(e) {
|
|
5934
6363
|
return R.create({
|
|
5935
6364
|
name: "slashCommand",
|
|
5936
6365
|
addProseMirrorPlugins() {
|
|
5937
6366
|
let t = {
|
|
5938
6367
|
char: "/",
|
|
5939
|
-
pluginKey:
|
|
6368
|
+
pluginKey: Ei,
|
|
5940
6369
|
findSuggestionMatch: (e) => {
|
|
5941
6370
|
let { $position: t } = e;
|
|
5942
6371
|
for (let e = t.depth; e >= 0; e--) if (t.node(e).type.name === "codeBlock") return null;
|
|
5943
|
-
return t.marks().some((e) => e.type.name === "code") ? null :
|
|
6372
|
+
return t.marks().some((e) => e.type.name === "code") ? null : Ee(e);
|
|
5944
6373
|
},
|
|
5945
6374
|
allow: ({ editor: e, state: t }) => {
|
|
5946
6375
|
if (!e.isEditable) return !1;
|
|
@@ -6022,7 +6451,7 @@ function si(e) {
|
|
|
6022
6451
|
if (e.key === "Escape") {
|
|
6023
6452
|
e.preventDefault();
|
|
6024
6453
|
let t = a?.view;
|
|
6025
|
-
t &&
|
|
6454
|
+
t && Te(t, Ei);
|
|
6026
6455
|
}
|
|
6027
6456
|
});
|
|
6028
6457
|
}
|
|
@@ -6040,7 +6469,7 @@ function si(e) {
|
|
|
6040
6469
|
if (!e || e.style.display === "none" || n.target instanceof Node && e.contains(n.target) || t) return;
|
|
6041
6470
|
let r = a?.view;
|
|
6042
6471
|
r && (t = !0, window.setTimeout(() => {
|
|
6043
|
-
t = !1, e?.style.display !== "none" &&
|
|
6472
|
+
t = !1, e?.style.display !== "none" && Te(r, Ei);
|
|
6044
6473
|
}, 0));
|
|
6045
6474
|
}, document.addEventListener("mousedown", o, !0), document.addEventListener("touchstart", o, !0);
|
|
6046
6475
|
}
|
|
@@ -6064,11 +6493,11 @@ function si(e) {
|
|
|
6064
6493
|
};
|
|
6065
6494
|
}
|
|
6066
6495
|
};
|
|
6067
|
-
return [
|
|
6496
|
+
return [we({
|
|
6068
6497
|
editor: this.editor,
|
|
6069
6498
|
...t
|
|
6070
|
-
}), new
|
|
6071
|
-
key: new
|
|
6499
|
+
}), new V({
|
|
6500
|
+
key: new H("slashCodeBlockGuard"),
|
|
6072
6501
|
appendTransaction: (e, t, n) => {
|
|
6073
6502
|
let { $from: r } = n.selection, i = !1;
|
|
6074
6503
|
for (let e = r.depth; e >= 0; e--) if (r.node(e).type.name === "codeBlock") {
|
|
@@ -6076,14 +6505,14 @@ function si(e) {
|
|
|
6076
6505
|
break;
|
|
6077
6506
|
}
|
|
6078
6507
|
if (!i && !r.marks().some((e) => e.type.name === "code")) return null;
|
|
6079
|
-
let a =
|
|
6080
|
-
return a && a.active ? n.tr.setMeta(
|
|
6508
|
+
let a = Ei.getState(n);
|
|
6509
|
+
return a && a.active ? n.tr.setMeta(Ei, { exit: !0 }) : null;
|
|
6081
6510
|
}
|
|
6082
6511
|
})];
|
|
6083
6512
|
}
|
|
6084
6513
|
});
|
|
6085
6514
|
}
|
|
6086
|
-
function
|
|
6515
|
+
function Oi(e, t) {
|
|
6087
6516
|
return [
|
|
6088
6517
|
{
|
|
6089
6518
|
title: e("editor.slash.heading1"),
|
|
@@ -6157,6 +6586,24 @@ function ci(e, t) {
|
|
|
6157
6586
|
icon: "—",
|
|
6158
6587
|
command: ({ editor: e }) => e.chain().focus().setHorizontalRule().run()
|
|
6159
6588
|
},
|
|
6589
|
+
{
|
|
6590
|
+
title: e("editor.slash.mathInline"),
|
|
6591
|
+
description: e("editor.slash.mathInlineDesc"),
|
|
6592
|
+
icon: "∑",
|
|
6593
|
+
command: ({ editor: e }) => e.chain().focus().insertContent({
|
|
6594
|
+
type: "mathInline",
|
|
6595
|
+
attrs: { latex: "" }
|
|
6596
|
+
}).run()
|
|
6597
|
+
},
|
|
6598
|
+
{
|
|
6599
|
+
title: e("editor.slash.mathBlock"),
|
|
6600
|
+
description: e("editor.slash.mathBlockDesc"),
|
|
6601
|
+
icon: "∫",
|
|
6602
|
+
command: ({ editor: e }) => e.chain().focus().insertContent({
|
|
6603
|
+
type: "mathBlock",
|
|
6604
|
+
attrs: { latex: "" }
|
|
6605
|
+
}).run()
|
|
6606
|
+
},
|
|
6160
6607
|
{
|
|
6161
6608
|
title: e("editor.slash.image"),
|
|
6162
6609
|
description: e("editor.slash.imageDesc"),
|
|
@@ -6182,7 +6629,7 @@ function ci(e, t) {
|
|
|
6182
6629
|
n.type = "file", n.accept = "audio/*", n.onchange = async () => {
|
|
6183
6630
|
let r = n.files?.[0];
|
|
6184
6631
|
if (!r) return;
|
|
6185
|
-
let i =
|
|
6632
|
+
let i = pn(e) ?? t, a = i ? mn(e.state.doc, r, i) : null;
|
|
6186
6633
|
if (a) {
|
|
6187
6634
|
Z(a);
|
|
6188
6635
|
return;
|
|
@@ -6192,7 +6639,7 @@ function ci(e, t) {
|
|
|
6192
6639
|
name: r.name,
|
|
6193
6640
|
size: r.size
|
|
6194
6641
|
});
|
|
6195
|
-
s && (e.chain().focus().insertContent(s).run(), await
|
|
6642
|
+
s && (e.chain().focus().insertContent(s).run(), await Fr(e.view, r, o));
|
|
6196
6643
|
}, n.click();
|
|
6197
6644
|
}
|
|
6198
6645
|
},
|
|
@@ -6205,7 +6652,7 @@ function ci(e, t) {
|
|
|
6205
6652
|
n.type = "file", n.accept = "*/*", n.multiple = !0, n.onchange = async () => {
|
|
6206
6653
|
let r = n.files;
|
|
6207
6654
|
if (!(!r || r.length === 0)) for (let n of Array.from(r)) {
|
|
6208
|
-
let r =
|
|
6655
|
+
let r = pn(e) ?? t, i = r ? mn(e.state.doc, n, r) : null;
|
|
6209
6656
|
if (i) {
|
|
6210
6657
|
Z(i);
|
|
6211
6658
|
continue;
|
|
@@ -6222,7 +6669,7 @@ function ci(e, t) {
|
|
|
6222
6669
|
} catch {
|
|
6223
6670
|
continue;
|
|
6224
6671
|
}
|
|
6225
|
-
await
|
|
6672
|
+
await Fr(e.view, n, a);
|
|
6226
6673
|
}
|
|
6227
6674
|
}
|
|
6228
6675
|
}, n.click();
|
|
@@ -6232,9 +6679,9 @@ function ci(e, t) {
|
|
|
6232
6679
|
}
|
|
6233
6680
|
//#endregion
|
|
6234
6681
|
//#region src/editor/extensions/index.ts
|
|
6235
|
-
var
|
|
6682
|
+
var ki = W.extend({
|
|
6236
6683
|
addNodeView() {
|
|
6237
|
-
return
|
|
6684
|
+
return F(Tn);
|
|
6238
6685
|
},
|
|
6239
6686
|
addAttributes() {
|
|
6240
6687
|
return {
|
|
@@ -6257,7 +6704,7 @@ var li = U.extend({
|
|
|
6257
6704
|
};
|
|
6258
6705
|
}
|
|
6259
6706
|
});
|
|
6260
|
-
function
|
|
6707
|
+
function Ai(e = {}) {
|
|
6261
6708
|
return [
|
|
6262
6709
|
K.configure({
|
|
6263
6710
|
codeBlock: !1,
|
|
@@ -6266,104 +6713,106 @@ function ui(e = {}) {
|
|
|
6266
6713
|
link: !1
|
|
6267
6714
|
}),
|
|
6268
6715
|
G,
|
|
6269
|
-
|
|
6716
|
+
se.configure({
|
|
6270
6717
|
openOnClick: !0,
|
|
6271
6718
|
HTMLAttributes: {
|
|
6272
6719
|
rel: "noopener noreferrer",
|
|
6273
6720
|
target: "_blank"
|
|
6274
6721
|
}
|
|
6275
6722
|
}),
|
|
6276
|
-
|
|
6723
|
+
ki.configure({
|
|
6277
6724
|
inline: !1,
|
|
6278
6725
|
allowBase64: !0
|
|
6279
6726
|
}),
|
|
6280
6727
|
ge,
|
|
6281
6728
|
he.configure({ nested: !0 }),
|
|
6282
|
-
|
|
6729
|
+
le.configure({ multicolor: !0 }),
|
|
6283
6730
|
_e,
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6731
|
+
q,
|
|
6732
|
+
ce.configure(e.maxLength ? { limit: e.maxLength } : {}),
|
|
6733
|
+
ue,
|
|
6734
|
+
Br,
|
|
6735
|
+
$r,
|
|
6736
|
+
ei,
|
|
6737
|
+
pr,
|
|
6738
|
+
fe.configure({ resizable: !0 }),
|
|
6290
6739
|
me,
|
|
6291
|
-
|
|
6740
|
+
J,
|
|
6292
6741
|
pe,
|
|
6293
6742
|
ve.configure({
|
|
6294
6743
|
html: !0,
|
|
6295
6744
|
transformPastedText: !0,
|
|
6296
6745
|
transformCopiedText: !1
|
|
6297
6746
|
}),
|
|
6298
|
-
|
|
6299
|
-
|
|
6747
|
+
de.configure({ placeholder: e.placeholder || "输入 '/' 打开菜单…" }),
|
|
6748
|
+
Di(() => Oi((e) => f(e), {
|
|
6300
6749
|
maxAttachmentSize: e.maxAttachmentSize,
|
|
6301
6750
|
maxTotalAttachmentSize: e.maxTotalAttachmentSize
|
|
6302
6751
|
})),
|
|
6303
|
-
|
|
6752
|
+
Lr.configure({
|
|
6304
6753
|
maxAttachmentSize: e.maxAttachmentSize,
|
|
6305
6754
|
maxTotalAttachmentSize: e.maxTotalAttachmentSize
|
|
6306
6755
|
}),
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6756
|
+
Ti,
|
|
6757
|
+
si,
|
|
6758
|
+
At,
|
|
6759
|
+
zr,
|
|
6760
|
+
ci,
|
|
6761
|
+
Xn,
|
|
6762
|
+
Un,
|
|
6763
|
+
Bn
|
|
6315
6764
|
];
|
|
6316
6765
|
}
|
|
6317
6766
|
//#endregion
|
|
6318
6767
|
//#region src/editor/extensions/bubble-menu.tsx
|
|
6319
|
-
var
|
|
6320
|
-
function
|
|
6321
|
-
|
|
6768
|
+
var ji = "https://www.bing.com/search?q={query}";
|
|
6769
|
+
function Mi(e) {
|
|
6770
|
+
ji = e;
|
|
6322
6771
|
}
|
|
6323
|
-
function
|
|
6324
|
-
return
|
|
6772
|
+
function Ni() {
|
|
6773
|
+
return ji;
|
|
6325
6774
|
}
|
|
6326
|
-
function
|
|
6775
|
+
function Pi(e) {
|
|
6327
6776
|
return [
|
|
6328
6777
|
{
|
|
6329
6778
|
key: "bold",
|
|
6330
6779
|
label: e("editor.bubble.bold"),
|
|
6331
|
-
icon: /* @__PURE__ */ D(
|
|
6780
|
+
icon: /* @__PURE__ */ D(Nt, {}),
|
|
6332
6781
|
isActive: (e) => e.isActive("bold"),
|
|
6333
6782
|
command: (e) => e.isEditable && e.chain().focus().toggleBold().run()
|
|
6334
6783
|
},
|
|
6335
6784
|
{
|
|
6336
6785
|
key: "italic",
|
|
6337
6786
|
label: e("editor.bubble.italic"),
|
|
6338
|
-
icon: /* @__PURE__ */ D(
|
|
6787
|
+
icon: /* @__PURE__ */ D(Pt, {}),
|
|
6339
6788
|
isActive: (e) => e.isActive("italic"),
|
|
6340
6789
|
command: (e) => e.isEditable && e.chain().focus().toggleItalic().run()
|
|
6341
6790
|
},
|
|
6342
6791
|
{
|
|
6343
6792
|
key: "underline",
|
|
6344
6793
|
label: e("editor.bubble.underline"),
|
|
6345
|
-
icon: /* @__PURE__ */ D(
|
|
6794
|
+
icon: /* @__PURE__ */ D(Ft, {}),
|
|
6346
6795
|
isActive: (e) => e.isActive("underline"),
|
|
6347
6796
|
command: (e) => e.isEditable && e.chain().focus().toggleUnderline().run()
|
|
6348
6797
|
},
|
|
6349
6798
|
{
|
|
6350
6799
|
key: "strikethrough",
|
|
6351
6800
|
label: e("editor.bubble.strikethrough"),
|
|
6352
|
-
icon: /* @__PURE__ */ D(
|
|
6801
|
+
icon: /* @__PURE__ */ D(It, {}),
|
|
6353
6802
|
isActive: (e) => e.isActive("strike"),
|
|
6354
6803
|
command: (e) => e.isEditable && e.chain().focus().toggleStrike().run()
|
|
6355
6804
|
},
|
|
6356
6805
|
{
|
|
6357
6806
|
key: "code",
|
|
6358
6807
|
label: e("editor.bubble.emphasis"),
|
|
6359
|
-
icon: /* @__PURE__ */ D(
|
|
6808
|
+
icon: /* @__PURE__ */ D(Lt, {}),
|
|
6360
6809
|
isActive: (e) => e.isActive("code"),
|
|
6361
6810
|
command: (e) => e.isEditable && e.chain().focus().toggleCode().run()
|
|
6362
6811
|
},
|
|
6363
6812
|
{
|
|
6364
6813
|
key: "highlight",
|
|
6365
6814
|
label: e("editor.bubble.highlight"),
|
|
6366
|
-
icon: /* @__PURE__ */ D(
|
|
6815
|
+
icon: /* @__PURE__ */ D(Rt, {}),
|
|
6367
6816
|
more: !0,
|
|
6368
6817
|
isActive: (e) => e.isActive("highlight"),
|
|
6369
6818
|
command: () => {}
|
|
@@ -6371,7 +6820,7 @@ function mi(e) {
|
|
|
6371
6820
|
{
|
|
6372
6821
|
key: "link",
|
|
6373
6822
|
label: e("editor.bubble.link"),
|
|
6374
|
-
icon: /* @__PURE__ */ D(
|
|
6823
|
+
icon: /* @__PURE__ */ D(zt, {}),
|
|
6375
6824
|
more: !0,
|
|
6376
6825
|
isActive: (e) => e.isActive("link"),
|
|
6377
6826
|
command: () => {}
|
|
@@ -6379,7 +6828,7 @@ function mi(e) {
|
|
|
6379
6828
|
{
|
|
6380
6829
|
key: "copy",
|
|
6381
6830
|
label: e("editor.bubble.copy"),
|
|
6382
|
-
icon: /* @__PURE__ */ D(
|
|
6831
|
+
icon: /* @__PURE__ */ D(Vt, {}),
|
|
6383
6832
|
more: !0,
|
|
6384
6833
|
isActive: () => !1,
|
|
6385
6834
|
command: (e) => {
|
|
@@ -6390,21 +6839,21 @@ function mi(e) {
|
|
|
6390
6839
|
{
|
|
6391
6840
|
key: "search",
|
|
6392
6841
|
label: e("editor.bubble.search"),
|
|
6393
|
-
icon: /* @__PURE__ */ D(
|
|
6842
|
+
icon: /* @__PURE__ */ D(Ht, {}),
|
|
6394
6843
|
more: !0,
|
|
6395
6844
|
isActive: () => !1,
|
|
6396
6845
|
command: (e) => {
|
|
6397
6846
|
if (e.isActive("table")) return;
|
|
6398
6847
|
let { from: t, to: n } = e.state.selection, r = e.state.doc.textBetween(t, n, " ").trim();
|
|
6399
6848
|
if (!r) return;
|
|
6400
|
-
let i =
|
|
6849
|
+
let i = ji.replace("{query}", encodeURIComponent(r));
|
|
6401
6850
|
window.open(i, "_blank", "noopener,noreferrer");
|
|
6402
6851
|
}
|
|
6403
6852
|
},
|
|
6404
6853
|
{
|
|
6405
6854
|
key: "table",
|
|
6406
6855
|
label: e("editor.bubble.table"),
|
|
6407
|
-
icon: /* @__PURE__ */ D(
|
|
6856
|
+
icon: /* @__PURE__ */ D(Bt, {}),
|
|
6408
6857
|
more: !0,
|
|
6409
6858
|
isActive: (e) => e.isActive("table"),
|
|
6410
6859
|
command: (e) => {
|
|
@@ -6420,7 +6869,7 @@ function mi(e) {
|
|
|
6420
6869
|
{
|
|
6421
6870
|
key: "ai",
|
|
6422
6871
|
label: e("editor.ai.trigger"),
|
|
6423
|
-
icon: /* @__PURE__ */ D(
|
|
6872
|
+
icon: /* @__PURE__ */ D(Ut, {}),
|
|
6424
6873
|
isActive: () => !1,
|
|
6425
6874
|
command: (e) => {
|
|
6426
6875
|
e.isEditable && e.storage.qingwuUI?.openAI?.();
|
|
@@ -6431,7 +6880,7 @@ function mi(e) {
|
|
|
6431
6880
|
R.create({ name: "bubbleMenu" });
|
|
6432
6881
|
//#endregion
|
|
6433
6882
|
//#region src/editor/extensions/table-toolbar.tsx
|
|
6434
|
-
function
|
|
6883
|
+
function Fi(e) {
|
|
6435
6884
|
let { $from: t } = e.state.selection;
|
|
6436
6885
|
for (let e = t.depth; e > 0; e--) {
|
|
6437
6886
|
let n = t.node(e);
|
|
@@ -6442,7 +6891,7 @@ function hi(e) {
|
|
|
6442
6891
|
}
|
|
6443
6892
|
return null;
|
|
6444
6893
|
}
|
|
6445
|
-
function
|
|
6894
|
+
function Ii(e) {
|
|
6446
6895
|
let t = [];
|
|
6447
6896
|
return e.forEach((e) => {
|
|
6448
6897
|
let n = [];
|
|
@@ -6451,7 +6900,7 @@ function gi(e) {
|
|
|
6451
6900
|
}), t.push(n);
|
|
6452
6901
|
}), t;
|
|
6453
6902
|
}
|
|
6454
|
-
function
|
|
6903
|
+
function Li(e) {
|
|
6455
6904
|
if (e.length === 0) return "";
|
|
6456
6905
|
let t = Math.max(...e.map((e) => e.length), 1), n = (e) => e.concat(Array(Math.max(0, t - e.length)).fill("")).slice(0, t), r = n(e[0]), i = e.slice(1).map(n), a = (e) => `| ${e.join(" | ")} |`;
|
|
6457
6906
|
return [
|
|
@@ -6460,11 +6909,11 @@ function _i(e) {
|
|
|
6460
6909
|
...i.map(a)
|
|
6461
6910
|
].join("\n");
|
|
6462
6911
|
}
|
|
6463
|
-
function
|
|
6912
|
+
function Ri(e) {
|
|
6464
6913
|
let t = (e) => /[",\n]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e;
|
|
6465
6914
|
return e.map((e) => e.map(t).join(",")).join("\n");
|
|
6466
6915
|
}
|
|
6467
|
-
function
|
|
6916
|
+
function zi(e) {
|
|
6468
6917
|
let t = e.trim();
|
|
6469
6918
|
if (!t) return null;
|
|
6470
6919
|
let n = t.split(/\r?\n/);
|
|
@@ -6478,7 +6927,7 @@ function yi(e) {
|
|
|
6478
6927
|
}
|
|
6479
6928
|
return null;
|
|
6480
6929
|
}
|
|
6481
|
-
function
|
|
6930
|
+
function Bi({ editor: e }) {
|
|
6482
6931
|
let [t, n] = T(null), [r, i] = T(!1), [a, o] = T(!1), s = w(null), c = w(null), l = e.isEditable, u = b(() => {
|
|
6483
6932
|
c.current != null && cancelAnimationFrame(c.current), c.current = requestAnimationFrame(() => {
|
|
6484
6933
|
c.current = null;
|
|
@@ -6494,7 +6943,7 @@ function bi({ editor: e }) {
|
|
|
6494
6943
|
n(null);
|
|
6495
6944
|
return;
|
|
6496
6945
|
}
|
|
6497
|
-
let t =
|
|
6946
|
+
let t = Fi(e);
|
|
6498
6947
|
if (!t) {
|
|
6499
6948
|
n(null);
|
|
6500
6949
|
return;
|
|
@@ -6523,24 +6972,24 @@ function bi({ editor: e }) {
|
|
|
6523
6972
|
});
|
|
6524
6973
|
return n.nodes.table.create(null, i);
|
|
6525
6974
|
}, p = () => {
|
|
6526
|
-
let t =
|
|
6975
|
+
let t = Fi(e);
|
|
6527
6976
|
if (!t) return;
|
|
6528
|
-
let n =
|
|
6977
|
+
let n = Li(Ii(t.node));
|
|
6529
6978
|
navigator.clipboard?.writeText(n), i(!0), setTimeout(() => i(!1), 1500);
|
|
6530
6979
|
}, m = () => {
|
|
6531
|
-
let t =
|
|
6980
|
+
let t = Fi(e);
|
|
6532
6981
|
if (!t) return;
|
|
6533
|
-
let n =
|
|
6982
|
+
let n = Ri(Ii(t.node)), r = new Blob([`\ufeff${n}`], { type: "text/csv;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
6534
6983
|
a.href = i, a.download = "table.csv", document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
6535
6984
|
}, h = async () => {
|
|
6536
6985
|
if (l) try {
|
|
6537
6986
|
let t = await navigator.clipboard?.readText();
|
|
6538
6987
|
if (!t) return;
|
|
6539
|
-
let n =
|
|
6988
|
+
let n = zi(t);
|
|
6540
6989
|
if (!n || n.length === 0) return;
|
|
6541
6990
|
let r = f(n);
|
|
6542
6991
|
if (!r) return;
|
|
6543
|
-
let i =
|
|
6992
|
+
let i = Fi(e), a = e.chain().focus();
|
|
6544
6993
|
if (i) {
|
|
6545
6994
|
let t = Math.min(i.pos + i.node.nodeSize, e.state.doc.content.size);
|
|
6546
6995
|
a.setTextSelection(t);
|
|
@@ -6660,7 +7109,7 @@ function bi({ editor: e }) {
|
|
|
6660
7109
|
type: "button",
|
|
6661
7110
|
className: "tbl-btn tbl-btn--del",
|
|
6662
7111
|
onClick: () => {
|
|
6663
|
-
!l ||
|
|
7112
|
+
!l || vn() || ($(!0), o(!0));
|
|
6664
7113
|
},
|
|
6665
7114
|
title: "删除",
|
|
6666
7115
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -6678,7 +7127,7 @@ function bi({ editor: e }) {
|
|
|
6678
7127
|
})
|
|
6679
7128
|
})
|
|
6680
7129
|
}),
|
|
6681
|
-
/* @__PURE__ */ D(
|
|
7130
|
+
/* @__PURE__ */ D(Cn, {
|
|
6682
7131
|
open: a,
|
|
6683
7132
|
title: "确认删除表格",
|
|
6684
7133
|
message: "此操作不可撤销。",
|
|
@@ -6694,7 +7143,7 @@ function bi({ editor: e }) {
|
|
|
6694
7143
|
}
|
|
6695
7144
|
//#endregion
|
|
6696
7145
|
//#region src/editor/ai-editor.tsx
|
|
6697
|
-
var
|
|
7146
|
+
var Vi = [
|
|
6698
7147
|
{
|
|
6699
7148
|
color: "#fef08a",
|
|
6700
7149
|
name: "黄"
|
|
@@ -6719,9 +7168,9 @@ var xi = [
|
|
|
6719
7168
|
color: "#ddd6fe",
|
|
6720
7169
|
name: "紫"
|
|
6721
7170
|
}
|
|
6722
|
-
],
|
|
6723
|
-
function
|
|
6724
|
-
let r = window.innerWidth, i = window.innerHeight, a = Math.min(n.panelWidth ||
|
|
7171
|
+
], Hi = 288, Ui = 480, Wi = 320;
|
|
7172
|
+
function Gi(e, t, n = {}) {
|
|
7173
|
+
let r = window.innerWidth, i = window.innerHeight, a = Math.min(n.panelWidth || Hi, Ui, r - 32), o = Math.max(t || Wi, 160);
|
|
6725
7174
|
if (r < 640) {
|
|
6726
7175
|
let t = Math.max(8, Math.min(e.top + 10, i - 420));
|
|
6727
7176
|
return {
|
|
@@ -6762,10 +7211,10 @@ function Ti(e, t, n = {}) {
|
|
|
6762
7211
|
arrowLeft: p
|
|
6763
7212
|
};
|
|
6764
7213
|
}
|
|
6765
|
-
function
|
|
6766
|
-
return /(^|\n)```|(^|\n)#{1,6}\s|(^|\n)>\s?|(^|\n)\s*([-*_])(?:\s*\4){2,}\s*(?=\n|$)|(^|\n)\s*[-*+]\s+|(^|\n)\s*\d+[.)]\s+|(^|\n)\s*<img\s+|(^|\n)\s
|
|
7214
|
+
function Ki(e) {
|
|
7215
|
+
return /(^|\n)```|(^|\n)#{1,6}\s|(^|\n)>\s?|(^|\n)\s*([-*_])(?:\s*\4){2,}\s*(?=\n|$)|(^|\n)\s*[-*+]\s+|(^|\n)\s*\d+[.)]\s+|(^|\n)\s*<img\s+|(^|\n)\s*\|.+\||(^|\n)\s*\$\$[\s\S]*?\$\$|(^|[^\\$])\$[^\s$\n](?:[^$\n]*[^\s$\n])?\$/i.test(e);
|
|
6767
7216
|
}
|
|
6768
|
-
function
|
|
7217
|
+
function qi(e, t) {
|
|
6769
7218
|
try {
|
|
6770
7219
|
let n = e.storage?.markdown?.parser;
|
|
6771
7220
|
if (!n) return null;
|
|
@@ -6775,20 +7224,20 @@ function Di(e, t) {
|
|
|
6775
7224
|
return null;
|
|
6776
7225
|
}
|
|
6777
7226
|
}
|
|
6778
|
-
var
|
|
7227
|
+
var Ji = y(() => Promise.resolve().then(() => nt).then((e) => ({ default: e.ImageUploadDialog }))), Yi = y(() => import("./storage-settings-dialog-DnWNQWjN.js").then((e) => ({ default: e.StorageSettingsDialog }))), Xi = y(() => import("./export-dialog-DMY_QIVq.js").then((e) => ({ default: e.ExportDialog }))), Zi = y(() => import("./video-embed-dialog-B0_pc5xe.js").then((e) => ({ default: e.VideoEmbedDialog }))), Qi = y(() => import("./md-import-dialog-DbC-NCH_.js").then((e) => ({ default: e.MdImportDialog }))), $i = () => /* @__PURE__ */ O("div", {
|
|
6779
7228
|
className: "fixed inset-0 z-[9999] flex items-center justify-center",
|
|
6780
7229
|
children: [/* @__PURE__ */ D("div", { className: "absolute inset-0 bg-black/40 backdrop-blur-sm" }), /* @__PURE__ */ D("div", {
|
|
6781
7230
|
className: "relative bg-background rounded-2xl border border-default-200 p-8 flex items-center justify-center",
|
|
6782
7231
|
children: /* @__PURE__ */ D("div", { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin" })
|
|
6783
7232
|
})]
|
|
6784
|
-
}),
|
|
6785
|
-
let k = r === "view" || i, A = C(() => typeof e == "object" && e ||
|
|
7233
|
+
}), ea = ({ initialContent: e = "", onChange: t, placeholder: n, mode: r, readonly: i = !1, maxLength: a, maxAttachmentSize: o, maxTotalAttachmentSize: s, className: c = "", borderless: l = !1, style: u, showToolbar: p = !0, showToc: m = !0, showSearch: h = !0, onEditorReady: g, immediatelyRender: _, onToast: y }) => {
|
|
7234
|
+
let k = r === "view" || i, A = C(() => typeof e == "object" && e || Ki(e) ? e : d(e), [e]), [j, M] = T(!1), [P, F] = T({}), [I, R] = T("below"), [re, ie] = T(50), z = w(null), [B, V] = T(!1), [H, ae] = T(!1), [oe, U] = T(!1), [W, se] = T(!1), [G, K] = T("none"), [ce, q] = T({}), le = w(null), ue = w(null), [de, fe] = T(""), [J, pe] = T(null), [me, he] = T(m), [ge, _e] = T(!1);
|
|
6786
7235
|
x(() => {
|
|
6787
|
-
|
|
7236
|
+
he(m);
|
|
6788
7237
|
}, [m]);
|
|
6789
|
-
let [
|
|
6790
|
-
let e =
|
|
6791
|
-
e && (
|
|
7238
|
+
let [ve, ye] = T(!1), [be, xe] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 80rem)").matches : !0), [Se, Ce] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 64rem)").matches : !0), we = w(null), Te = w(null), Ee = w(null), De = w(0), Oe = w(null), ke = w(null), Ae = w(null), je = w(null), [Me, Ne] = T(!1), [Y, Pe] = T(!1), [Fe, Ie] = T(!1), Le = w(null), Re = b(() => {
|
|
7239
|
+
let e = Te.current, t = Ee.current;
|
|
7240
|
+
e && (Y ? (document.body.style.overflow = "", Object.assign(e.style, {
|
|
6792
7241
|
position: "",
|
|
6793
7242
|
top: "",
|
|
6794
7243
|
left: "",
|
|
@@ -6804,9 +7253,9 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
6804
7253
|
flex: "",
|
|
6805
7254
|
overflow: "",
|
|
6806
7255
|
minHeight: ""
|
|
6807
|
-
}),
|
|
6808
|
-
window.scrollTo(0,
|
|
6809
|
-
})) : (document.fullscreenElement && document.exitFullscreen(),
|
|
7256
|
+
}), Pe(!1), requestAnimationFrame(() => {
|
|
7257
|
+
window.scrollTo(0, De.current);
|
|
7258
|
+
})) : (document.fullscreenElement && document.exitFullscreen(), De.current = window.scrollY, Object.assign(e.style, {
|
|
6810
7259
|
position: "fixed",
|
|
6811
7260
|
top: "0",
|
|
6812
7261
|
left: "0",
|
|
@@ -6821,42 +7270,42 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
6821
7270
|
flex: "1",
|
|
6822
7271
|
overflow: "auto",
|
|
6823
7272
|
minHeight: "0"
|
|
6824
|
-
}), document.body.style.overflow = "hidden",
|
|
6825
|
-
}, [
|
|
6826
|
-
let e =
|
|
6827
|
-
e && (document.fullscreenElement ? document.exitFullscreen() : (
|
|
6828
|
-
}, [
|
|
7273
|
+
}), document.body.style.overflow = "hidden", Pe(!0)));
|
|
7274
|
+
}, [Y]), ze = b(() => {
|
|
7275
|
+
let e = Te.current;
|
|
7276
|
+
e && (document.fullscreenElement ? document.exitFullscreen() : (Y && Re(), De.current = window.scrollY, e.requestFullscreen()));
|
|
7277
|
+
}, [Y, Re]);
|
|
6829
7278
|
x(() => {
|
|
6830
7279
|
let e = (e) => {
|
|
6831
|
-
e.key === "Escape" &&
|
|
7280
|
+
e.key === "Escape" && Y && Re();
|
|
6832
7281
|
}, t = () => {
|
|
6833
|
-
document.fullscreenElement ?
|
|
6834
|
-
window.scrollTo(0,
|
|
7282
|
+
document.fullscreenElement ? Ie(!0) : (Ie(!1), requestAnimationFrame(() => {
|
|
7283
|
+
window.scrollTo(0, De.current);
|
|
6835
7284
|
}));
|
|
6836
7285
|
};
|
|
6837
7286
|
return window.addEventListener("keydown", e), document.addEventListener("fullscreenchange", t), () => {
|
|
6838
7287
|
window.removeEventListener("keydown", e), document.removeEventListener("fullscreenchange", t);
|
|
6839
7288
|
};
|
|
6840
|
-
}, [
|
|
7289
|
+
}, [Y, Re]), x(() => {
|
|
6841
7290
|
if (!h) return;
|
|
6842
7291
|
let e = (e) => {
|
|
6843
7292
|
if ((e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F")) {
|
|
6844
|
-
if (!
|
|
6845
|
-
e.preventDefault(), e.stopPropagation(),
|
|
7293
|
+
if (!Te.current) return;
|
|
7294
|
+
e.preventDefault(), e.stopPropagation(), ye(!0);
|
|
6846
7295
|
}
|
|
6847
7296
|
};
|
|
6848
7297
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
6849
7298
|
}, [h]), x(() => {
|
|
6850
7299
|
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
6851
|
-
let e = window.matchMedia("(min-width: 80rem)"), t = (e) =>
|
|
6852
|
-
return
|
|
7300
|
+
let e = window.matchMedia("(min-width: 80rem)"), t = (e) => xe(e.matches);
|
|
7301
|
+
return xe(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
6853
7302
|
}, []), x(() => {
|
|
6854
7303
|
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
6855
|
-
let e = window.matchMedia("(min-width: 64rem)"), t = (e) =>
|
|
6856
|
-
return
|
|
7304
|
+
let e = window.matchMedia("(min-width: 64rem)"), t = (e) => Ce(e.matches);
|
|
7305
|
+
return Ce(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
6857
7306
|
}, []);
|
|
6858
|
-
let
|
|
6859
|
-
extensions:
|
|
7307
|
+
let X = te({
|
|
7308
|
+
extensions: Ai({
|
|
6860
7309
|
placeholder: n || f("editor.placeholder"),
|
|
6861
7310
|
maxLength: a,
|
|
6862
7311
|
maxAttachmentSize: o,
|
|
@@ -6866,7 +7315,7 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
6866
7315
|
editable: !k,
|
|
6867
7316
|
immediatelyRender: _,
|
|
6868
7317
|
onUpdate: ({ editor: e }) => {
|
|
6869
|
-
t && (
|
|
7318
|
+
t && (we.current && clearTimeout(we.current), we.current = setTimeout(() => {
|
|
6870
7319
|
t?.(e.getHTML(), e.getJSON());
|
|
6871
7320
|
}, 300));
|
|
6872
7321
|
},
|
|
@@ -6882,9 +7331,9 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
6882
7331
|
let r = n.getData("text/plain");
|
|
6883
7332
|
if (!r || !r.includes("[[")) return !1;
|
|
6884
7333
|
t.preventDefault();
|
|
6885
|
-
let i =
|
|
7334
|
+
let i = ke.current?.storage?.relativeMedia;
|
|
6886
7335
|
i && (i.clipboardFiles = new Map(Array.from(n.files ?? []).map((e) => [e.name.toLowerCase(), e])), i.pausedUntilPaste = !1);
|
|
6887
|
-
let a =
|
|
7336
|
+
let a = ke.current ? qi(ke.current, r) : null;
|
|
6888
7337
|
if (a) {
|
|
6889
7338
|
let t = new N(a, 0, 0);
|
|
6890
7339
|
e.dispatch(e.state.tr.replaceSelection(t).scrollIntoView());
|
|
@@ -6894,21 +7343,21 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
6894
7343
|
}
|
|
6895
7344
|
});
|
|
6896
7345
|
x(() => {
|
|
6897
|
-
|
|
6898
|
-
}, [
|
|
6899
|
-
if (
|
|
6900
|
-
}, [
|
|
6901
|
-
!
|
|
6902
|
-
}, [
|
|
6903
|
-
if (!
|
|
7346
|
+
ke.current = X, window.__editor = X;
|
|
7347
|
+
}, [X]), x(() => {
|
|
7348
|
+
if (X) return () => $t(X);
|
|
7349
|
+
}, [X]), x(() => {
|
|
7350
|
+
!X || !g || g(X);
|
|
7351
|
+
}, [X, g]), x(() => {
|
|
7352
|
+
if (!X) return;
|
|
6904
7353
|
let e = () => {
|
|
6905
|
-
|
|
7354
|
+
X.state.selection.empty && (K("none"), Ne(!1));
|
|
6906
7355
|
};
|
|
6907
|
-
return
|
|
6908
|
-
|
|
7356
|
+
return X.on("selectionUpdate", e), () => {
|
|
7357
|
+
X.off("selectionUpdate", e);
|
|
6909
7358
|
};
|
|
6910
|
-
}, [
|
|
6911
|
-
|
|
7359
|
+
}, [X]), x(() => {
|
|
7360
|
+
X && X.setOptions({ extensions: Ai({
|
|
6912
7361
|
placeholder: n || f("editor.placeholder"),
|
|
6913
7362
|
maxLength: a,
|
|
6914
7363
|
maxAttachmentSize: o,
|
|
@@ -6920,33 +7369,33 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
6920
7369
|
o,
|
|
6921
7370
|
s
|
|
6922
7371
|
]);
|
|
6923
|
-
let
|
|
7372
|
+
let Be = w(e);
|
|
6924
7373
|
x(() => {
|
|
6925
|
-
if (!
|
|
6926
|
-
|
|
6927
|
-
let t = typeof e == "object" && e ||
|
|
6928
|
-
|
|
6929
|
-
}, [
|
|
6930
|
-
|
|
6931
|
-
}, [
|
|
6932
|
-
if (y) return
|
|
7374
|
+
if (!X || e === Be.current) return;
|
|
7375
|
+
Be.current = e;
|
|
7376
|
+
let t = typeof e == "object" && e || Ki(e) ? e : d(e);
|
|
7377
|
+
X.commands.setContent(t, { emitUpdate: !1 });
|
|
7378
|
+
}, [X, e]), x(() => {
|
|
7379
|
+
X && X.setEditable(!k, !1);
|
|
7380
|
+
}, [X, k]), x(() => {
|
|
7381
|
+
if (y) return tt(y);
|
|
6933
7382
|
}, [y]), x(() => {
|
|
6934
|
-
if (!
|
|
6935
|
-
let e =
|
|
6936
|
-
e > s && Z(`文档内附件总大小 ${
|
|
6937
|
-
}, [
|
|
6938
|
-
if (!
|
|
6939
|
-
let e =
|
|
7383
|
+
if (!X) return;
|
|
7384
|
+
let e = dn(X.state.doc);
|
|
7385
|
+
e > s && Z(`文档内附件总大小 ${fn(e)} 已超过限制 ${fn(s)}`, "info");
|
|
7386
|
+
}, [X, s]), x(() => {
|
|
7387
|
+
if (!X) return;
|
|
7388
|
+
let e = X.storage.qingwuUI;
|
|
6940
7389
|
e && (e.limits = {
|
|
6941
7390
|
maxAttachmentSize: o,
|
|
6942
7391
|
maxTotalAttachmentSize: s
|
|
6943
7392
|
});
|
|
6944
7393
|
}, [
|
|
6945
|
-
|
|
7394
|
+
X,
|
|
6946
7395
|
o,
|
|
6947
7396
|
s
|
|
6948
7397
|
]);
|
|
6949
|
-
let
|
|
7398
|
+
let Ve = b((e, t) => {
|
|
6950
7399
|
let n = e ? Math.max(8, Math.min(e.left, window.innerWidth - 240 - 8)) : 8, r;
|
|
6951
7400
|
return r = e ? t && e.bottom + 8 + t > window.innerHeight ? Math.max(8, e.top - t - 8) : e.bottom + 8 : 8, {
|
|
6952
7401
|
position: "fixed",
|
|
@@ -6955,65 +7404,65 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
6955
7404
|
zIndex: 9999
|
|
6956
7405
|
};
|
|
6957
7406
|
}, []), He = b((e) => {
|
|
6958
|
-
let t =
|
|
6959
|
-
ue.current = t,
|
|
6960
|
-
}, [
|
|
7407
|
+
let t = je.current?.getBoundingClientRect() ?? null;
|
|
7408
|
+
ue.current = t, K(e), Ne(!1), q(Ve(t, void 0));
|
|
7409
|
+
}, [Ve]);
|
|
6961
7410
|
S(() => {
|
|
6962
|
-
if (
|
|
7411
|
+
if (G === "none") return;
|
|
6963
7412
|
let e = le.current;
|
|
6964
|
-
|
|
6965
|
-
}, [
|
|
6966
|
-
if (
|
|
6967
|
-
let e = () =>
|
|
7413
|
+
q(Ve(ue.current, e?.offsetHeight || void 0));
|
|
7414
|
+
}, [G, Ve]), x(() => {
|
|
7415
|
+
if (G === "none") return;
|
|
7416
|
+
let e = () => K("none"), t = () => {
|
|
6968
7417
|
let e = le.current;
|
|
6969
|
-
|
|
7418
|
+
q(Ve(ue.current, e?.offsetHeight || void 0));
|
|
6970
7419
|
};
|
|
6971
7420
|
return window.addEventListener("scroll", e, !0), window.addEventListener("resize", t), () => {
|
|
6972
7421
|
window.removeEventListener("scroll", e, !0), window.removeEventListener("resize", t);
|
|
6973
7422
|
};
|
|
6974
|
-
}, [
|
|
6975
|
-
|
|
6976
|
-
}, [
|
|
6977
|
-
let Ue =
|
|
6978
|
-
if (
|
|
7423
|
+
}, [G, Ve]), x(() => {
|
|
7424
|
+
G === "none" && (ue.current = null);
|
|
7425
|
+
}, [G]);
|
|
7426
|
+
let Ue = Pi((e) => f(e)), We = Ue.filter((e) => !e.more), Ge = Ue.filter((e) => e.more), Ke = We.filter((e) => e.key !== "ai"), qe = We.find((e) => e.key === "ai"), Je = b((e) => {
|
|
7427
|
+
if (X) if (Ne(!1), e.key === "link") if (X.isActive("link")) X.chain().focus().unsetLink().run();
|
|
6979
7428
|
else {
|
|
6980
|
-
let e =
|
|
7429
|
+
let e = X.getAttributes("link").href || "";
|
|
6981
7430
|
fe(e), He("link");
|
|
6982
7431
|
}
|
|
6983
|
-
else e.key === "highlight" ?
|
|
7432
|
+
else e.key === "highlight" ? G === "highlight" ? K("none") : He("highlight") : e.command(X);
|
|
6984
7433
|
}, [
|
|
6985
|
-
|
|
6986
|
-
|
|
7434
|
+
X,
|
|
7435
|
+
G,
|
|
6987
7436
|
He
|
|
6988
|
-
]), Ye = b((e) =>
|
|
7437
|
+
]), Ye = b((e) => X ? e.key === "highlight" ? G === "highlight" : e.key === "link" ? X.isActive("link") : e.isActive(X) : !1, [X, G]), [Xe, Ze] = T(0);
|
|
6989
7438
|
x(() => {
|
|
6990
|
-
if (!
|
|
7439
|
+
if (!X) return;
|
|
6991
7440
|
let e = () => Ze((e) => (e + 1) % 1e6);
|
|
6992
|
-
return
|
|
6993
|
-
|
|
7441
|
+
return X.on("update", e), () => {
|
|
7442
|
+
X.off("update", e);
|
|
6994
7443
|
};
|
|
6995
|
-
}, [
|
|
6996
|
-
let [Qe,
|
|
7444
|
+
}, [X]);
|
|
7445
|
+
let [Qe, $e] = T(!1);
|
|
6997
7446
|
x(() => {
|
|
6998
|
-
if (!
|
|
7447
|
+
if (!X) return;
|
|
6999
7448
|
let e = () => {
|
|
7000
7449
|
let e = !1;
|
|
7001
|
-
|
|
7450
|
+
X.state.doc.descendants((t) => {
|
|
7002
7451
|
t.type.name === "heading" && (e = !0);
|
|
7003
|
-
}),
|
|
7452
|
+
}), $e(e);
|
|
7004
7453
|
};
|
|
7005
|
-
return e(),
|
|
7006
|
-
|
|
7454
|
+
return e(), X.on("update", e), () => {
|
|
7455
|
+
X.off("update", e);
|
|
7007
7456
|
};
|
|
7008
|
-
}, [
|
|
7009
|
-
let
|
|
7457
|
+
}, [X]);
|
|
7458
|
+
let et = C(() => X?.storage?.characterCount?.characters?.() ?? 0, [X, Xe]), nt = a ? et > a : !1;
|
|
7010
7459
|
x(() => () => {
|
|
7011
|
-
|
|
7460
|
+
we.current && clearTimeout(we.current);
|
|
7012
7461
|
}, []), x(() => () => {
|
|
7013
|
-
|
|
7462
|
+
J && J.resolve(null);
|
|
7014
7463
|
}, []);
|
|
7015
7464
|
let rt = b((e) => {
|
|
7016
|
-
if (!
|
|
7465
|
+
if (!X?.isEditable) return;
|
|
7017
7466
|
let t = window.getSelection(), n;
|
|
7018
7467
|
if (e) {
|
|
7019
7468
|
let t = e.getBoundingClientRect();
|
|
@@ -7030,76 +7479,76 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7030
7479
|
width: e.width
|
|
7031
7480
|
};
|
|
7032
7481
|
} else {
|
|
7033
|
-
let e =
|
|
7482
|
+
let e = X.view.coordsAtPos(X.state.selection.from);
|
|
7034
7483
|
n = {
|
|
7035
7484
|
top: e.bottom,
|
|
7036
7485
|
left: e.left,
|
|
7037
7486
|
width: 0
|
|
7038
7487
|
};
|
|
7039
7488
|
}
|
|
7040
|
-
|
|
7041
|
-
let r =
|
|
7489
|
+
Oe.current = n;
|
|
7490
|
+
let r = Te.current?.getBoundingClientRect(), i = Gi(n, void 0, {
|
|
7042
7491
|
panelWidth: r?.width,
|
|
7043
7492
|
editorLeft: r?.left
|
|
7044
7493
|
});
|
|
7045
|
-
M(!0),
|
|
7046
|
-
}, [
|
|
7494
|
+
M(!0), F(i.style), R(i.placement), ie(i.arrowLeft);
|
|
7495
|
+
}, [X]);
|
|
7047
7496
|
x(() => {
|
|
7048
|
-
if (!
|
|
7049
|
-
let e =
|
|
7497
|
+
if (!X) return;
|
|
7498
|
+
let e = X.storage.qingwuUI;
|
|
7050
7499
|
if (e) return e.openImageDialog = () => V(!0), e.openVideoDialog = () => ae(!0), e.chooseMd = (e, t) => {
|
|
7051
|
-
|
|
7500
|
+
pe({
|
|
7052
7501
|
filename: e,
|
|
7053
7502
|
resolve: t
|
|
7054
7503
|
});
|
|
7055
|
-
}, e.openAI = rt, e.parseMd = (e, t) =>
|
|
7504
|
+
}, e.openAI = rt, e.parseMd = (e, t) => X ? qi(X, t) : null, () => {
|
|
7056
7505
|
delete e.openImageDialog, delete e.openVideoDialog, delete e.openAI, delete e.parseMd, delete e.chooseMd;
|
|
7057
7506
|
};
|
|
7058
|
-
}, [
|
|
7059
|
-
if (!j || !
|
|
7060
|
-
let e =
|
|
7507
|
+
}, [X, rt]), S(() => {
|
|
7508
|
+
if (!j || !X) return;
|
|
7509
|
+
let e = Oe.current;
|
|
7061
7510
|
if (!e) return;
|
|
7062
|
-
let t = z.current, n =
|
|
7511
|
+
let t = z.current, n = Te.current?.getBoundingClientRect(), r = Gi(e, t?.offsetHeight || void 0, {
|
|
7063
7512
|
panelWidth: n?.width,
|
|
7064
7513
|
editorLeft: n?.left
|
|
7065
7514
|
});
|
|
7066
|
-
R(r.placement), ie(r.arrowLeft),
|
|
7067
|
-
}, [j,
|
|
7068
|
-
if (!j || !
|
|
7515
|
+
R(r.placement), ie(r.arrowLeft), F(r.style);
|
|
7516
|
+
}, [j, X]), x(() => {
|
|
7517
|
+
if (!j || !X) return;
|
|
7069
7518
|
let e = () => {
|
|
7070
|
-
let e =
|
|
7519
|
+
let e = Oe.current;
|
|
7071
7520
|
if (!e) return;
|
|
7072
|
-
let t = z.current, n =
|
|
7521
|
+
let t = z.current, n = Te.current?.getBoundingClientRect(), r = Gi(e, t?.offsetHeight || void 0, {
|
|
7073
7522
|
panelWidth: n?.width,
|
|
7074
7523
|
editorLeft: n?.left
|
|
7075
7524
|
});
|
|
7076
|
-
R(r.placement), ie(r.arrowLeft),
|
|
7525
|
+
R(r.placement), ie(r.arrowLeft), F(r.style);
|
|
7077
7526
|
};
|
|
7078
7527
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
7079
|
-
}, [j,
|
|
7080
|
-
j || (
|
|
7528
|
+
}, [j, X]), x(() => {
|
|
7529
|
+
j || (Oe.current = null);
|
|
7081
7530
|
}, [j]);
|
|
7082
7531
|
let it = b((e) => {
|
|
7083
|
-
|
|
7084
|
-
}, [
|
|
7085
|
-
(
|
|
7086
|
-
}, [
|
|
7532
|
+
X?.chain().focus().setImage({ src: e }).run();
|
|
7533
|
+
}, [X]), at = b((e) => {
|
|
7534
|
+
(X?.commands).insertVideo?.({ src: e });
|
|
7535
|
+
}, [X]), ot = me && be && !Y && !Fe, st = !ot && !ge && (me || Qe && !(!k && Se)), ct = w(!1);
|
|
7087
7536
|
return x(() => {
|
|
7088
|
-
|
|
7089
|
-
}, [
|
|
7090
|
-
if (!
|
|
7537
|
+
ct.current || (ct.current = !0, me && !ot && _e(!0));
|
|
7538
|
+
}, [me, ot]), x(() => {
|
|
7539
|
+
if (!ge) return;
|
|
7091
7540
|
let e = (e) => {
|
|
7092
7541
|
let t = e.target;
|
|
7093
|
-
|
|
7542
|
+
Le.current?.contains(t) || _e(!1);
|
|
7094
7543
|
}, t = (e) => {
|
|
7095
|
-
e.key === "Escape" &&
|
|
7544
|
+
e.key === "Escape" && _e(!1);
|
|
7096
7545
|
};
|
|
7097
7546
|
return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e, { passive: !0 }), document.addEventListener("keydown", t), () => {
|
|
7098
7547
|
document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e), document.removeEventListener("keydown", t);
|
|
7099
7548
|
};
|
|
7100
|
-
}, [
|
|
7101
|
-
if (!
|
|
7102
|
-
let e =
|
|
7549
|
+
}, [ge]), x(() => {
|
|
7550
|
+
if (!X || !ot) return;
|
|
7551
|
+
let e = Ae.current;
|
|
7103
7552
|
if (!(e instanceof HTMLElement)) return;
|
|
7104
7553
|
let t = (t) => {
|
|
7105
7554
|
let n = t.deltaY;
|
|
@@ -7109,17 +7558,17 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7109
7558
|
e.scrollTop += n, t.preventDefault(), t.stopPropagation();
|
|
7110
7559
|
return;
|
|
7111
7560
|
}
|
|
7112
|
-
let a =
|
|
7561
|
+
let a = ut(X), o = a ? lt(a) : null;
|
|
7113
7562
|
if (o) {
|
|
7114
7563
|
o.scrollTop += n, t.preventDefault(), t.stopPropagation();
|
|
7115
7564
|
return;
|
|
7116
7565
|
}
|
|
7117
7566
|
};
|
|
7118
7567
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
7119
|
-
}, [
|
|
7568
|
+
}, [X, ot]), X ? /* @__PURE__ */ O("div", {
|
|
7120
7569
|
className: "qingwu-editor-row",
|
|
7121
7570
|
children: [/* @__PURE__ */ O("div", {
|
|
7122
|
-
ref:
|
|
7571
|
+
ref: Te,
|
|
7123
7572
|
className: `qingwu-editor relative flex-1 min-w-0 bg-background ${k ? "qingwu-editor--readonly" : ""} ${l ? "" : "rounded-xl border border-default-200"} ${c}`,
|
|
7124
7573
|
style: u,
|
|
7125
7574
|
children: [
|
|
@@ -7130,13 +7579,13 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7130
7579
|
children: [
|
|
7131
7580
|
/* @__PURE__ */ D("button", {
|
|
7132
7581
|
type: "button",
|
|
7133
|
-
className: `qed-tb-btn qed-tb-btn--desktop-only${
|
|
7582
|
+
className: `qed-tb-btn qed-tb-btn--desktop-only${me ? " is-active" : ""}`,
|
|
7134
7583
|
onClick: () => {
|
|
7135
|
-
|
|
7584
|
+
me ? (he(!1), _e(!1)) : (he(!0), be && !Y && !Fe || _e(!0));
|
|
7136
7585
|
},
|
|
7137
|
-
title:
|
|
7138
|
-
"aria-label":
|
|
7139
|
-
"aria-pressed":
|
|
7586
|
+
title: me ? "隐藏目录" : "显示目录",
|
|
7587
|
+
"aria-label": me ? "隐藏目录" : "显示目录",
|
|
7588
|
+
"aria-pressed": me,
|
|
7140
7589
|
children: /* @__PURE__ */ D("svg", {
|
|
7141
7590
|
fill: "none",
|
|
7142
7591
|
viewBox: "0 0 24 24",
|
|
@@ -7152,11 +7601,11 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7152
7601
|
}),
|
|
7153
7602
|
h && /* @__PURE__ */ D("button", {
|
|
7154
7603
|
type: "button",
|
|
7155
|
-
className: `qed-tb-btn${
|
|
7156
|
-
onClick: () =>
|
|
7604
|
+
className: `qed-tb-btn${ve ? " is-active" : ""}`,
|
|
7605
|
+
onClick: () => ye(!ve),
|
|
7157
7606
|
title: "查找 (Ctrl+F)",
|
|
7158
7607
|
"aria-label": "查找",
|
|
7159
|
-
"aria-pressed":
|
|
7608
|
+
"aria-pressed": ve,
|
|
7160
7609
|
children: /* @__PURE__ */ D("svg", {
|
|
7161
7610
|
fill: "none",
|
|
7162
7611
|
viewBox: "0 0 24 24",
|
|
@@ -7201,7 +7650,7 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7201
7650
|
/* @__PURE__ */ O("button", {
|
|
7202
7651
|
type: "button",
|
|
7203
7652
|
className: "qed-tb-btn qed-tb-btn--solid",
|
|
7204
|
-
onClick: () =>
|
|
7653
|
+
onClick: () => se(!0),
|
|
7205
7654
|
title: f("editor.toolbar.exportTitle"),
|
|
7206
7655
|
children: [/* @__PURE__ */ D("svg", {
|
|
7207
7656
|
fill: "none",
|
|
@@ -7221,11 +7670,11 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7221
7670
|
}),
|
|
7222
7671
|
/* @__PURE__ */ D("button", {
|
|
7223
7672
|
type: "button",
|
|
7224
|
-
className: `qed-tb-btn${
|
|
7225
|
-
onClick:
|
|
7226
|
-
title:
|
|
7227
|
-
"aria-label":
|
|
7228
|
-
"aria-pressed":
|
|
7673
|
+
className: `qed-tb-btn${Y ? " is-active" : ""}`,
|
|
7674
|
+
onClick: Re,
|
|
7675
|
+
title: Y ? "退出网页全屏" : "网页全屏",
|
|
7676
|
+
"aria-label": Y ? "退出网页全屏" : "网页全屏",
|
|
7677
|
+
"aria-pressed": Y,
|
|
7229
7678
|
children: /* @__PURE__ */ D("svg", {
|
|
7230
7679
|
fill: "none",
|
|
7231
7680
|
viewBox: "0 0 24 24",
|
|
@@ -7241,11 +7690,11 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7241
7690
|
}),
|
|
7242
7691
|
/* @__PURE__ */ D("button", {
|
|
7243
7692
|
type: "button",
|
|
7244
|
-
className: `qed-tb-btn${
|
|
7245
|
-
onClick:
|
|
7246
|
-
title:
|
|
7247
|
-
"aria-label":
|
|
7248
|
-
"aria-pressed":
|
|
7693
|
+
className: `qed-tb-btn${Fe ? " is-active" : ""}`,
|
|
7694
|
+
onClick: ze,
|
|
7695
|
+
title: Fe ? "退出全屏" : "全屏",
|
|
7696
|
+
"aria-label": Fe ? "退出全屏" : "全屏",
|
|
7697
|
+
"aria-pressed": Fe,
|
|
7249
7698
|
children: /* @__PURE__ */ D("svg", {
|
|
7250
7699
|
fill: "none",
|
|
7251
7700
|
viewBox: "0 0 24 24",
|
|
@@ -7262,8 +7711,8 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7262
7711
|
]
|
|
7263
7712
|
})]
|
|
7264
7713
|
}),
|
|
7265
|
-
|
|
7266
|
-
editor:
|
|
7714
|
+
X && !k && X.isEditable && /* @__PURE__ */ D(ne, {
|
|
7715
|
+
editor: X,
|
|
7267
7716
|
shouldShow: ({ editor: e, state: t }) => !(e.isActive("image") || e.isActive("videoEmbed") || e.isActive("codeBlock") || e.isActive("audioEmbed") || e.isActive("attachmentEmbed") || t.selection.empty),
|
|
7268
7717
|
options: {
|
|
7269
7718
|
placement: "bottom",
|
|
@@ -7272,7 +7721,7 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7272
7721
|
},
|
|
7273
7722
|
className: "bubble-menu-pop bg-background border border-default-200 rounded-xl p-1 shadow-lg",
|
|
7274
7723
|
children: /* @__PURE__ */ O("div", {
|
|
7275
|
-
ref:
|
|
7724
|
+
ref: je,
|
|
7276
7725
|
className: "bubble-menu-items relative flex items-center gap-0.5",
|
|
7277
7726
|
onPointerDown: (e) => {
|
|
7278
7727
|
e.target.closest("button") && e.preventDefault();
|
|
@@ -7280,7 +7729,7 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7280
7729
|
children: [
|
|
7281
7730
|
Ke.map((e) => /* @__PURE__ */ D("button", {
|
|
7282
7731
|
type: "button",
|
|
7283
|
-
className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${e.isActive(
|
|
7732
|
+
className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${e.isActive(X) ? "bg-primary/10 text-primary" : "text-default-600 hover:bg-default-100"}`,
|
|
7284
7733
|
onClick: (t) => {
|
|
7285
7734
|
t.preventDefault(), Je(e);
|
|
7286
7735
|
},
|
|
@@ -7296,11 +7745,11 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7296
7745
|
type: "button",
|
|
7297
7746
|
className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${j ? "bg-primary/15 text-primary" : "text-primary hover:bg-primary/10"}`,
|
|
7298
7747
|
onClick: (e) => {
|
|
7299
|
-
e.preventDefault(),
|
|
7748
|
+
e.preventDefault(), Ne(!1), qe?.command(X);
|
|
7300
7749
|
},
|
|
7301
7750
|
title: qe?.label,
|
|
7302
7751
|
"aria-label": qe?.label,
|
|
7303
|
-
children: /* @__PURE__ */ D(
|
|
7752
|
+
children: /* @__PURE__ */ D(Ut, {})
|
|
7304
7753
|
}),
|
|
7305
7754
|
/* @__PURE__ */ D("span", {
|
|
7306
7755
|
className: "w-px h-4 bg-default-200 mx-0.5 shrink-0",
|
|
@@ -7308,16 +7757,16 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7308
7757
|
}),
|
|
7309
7758
|
/* @__PURE__ */ D("button", {
|
|
7310
7759
|
type: "button",
|
|
7311
|
-
"aria-expanded":
|
|
7312
|
-
className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${
|
|
7760
|
+
"aria-expanded": Me,
|
|
7761
|
+
className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${Me ? "bg-default-100 text-default-900" : "text-default-600 hover:bg-default-100"}`,
|
|
7313
7762
|
onClick: (e) => {
|
|
7314
|
-
e.preventDefault(),
|
|
7763
|
+
e.preventDefault(), Ne((e) => !e);
|
|
7315
7764
|
},
|
|
7316
7765
|
title: f("editor.bubble.more"),
|
|
7317
7766
|
"aria-label": f("editor.bubble.more"),
|
|
7318
|
-
children: /* @__PURE__ */ D(
|
|
7767
|
+
children: /* @__PURE__ */ D(Wt, {})
|
|
7319
7768
|
}),
|
|
7320
|
-
|
|
7769
|
+
Me && /* @__PURE__ */ D("div", {
|
|
7321
7770
|
role: "menu",
|
|
7322
7771
|
className: "bubble-more-menu absolute right-0 top-full z-[9999] mt-1 w-max max-h-[70dvh] overflow-y-auto flex-col gap-1 rounded-xl border border-default-200 bg-background p-1.5 shadow-xl",
|
|
7323
7772
|
onPointerDown: (e) => {
|
|
@@ -7343,30 +7792,30 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7343
7792
|
]
|
|
7344
7793
|
})
|
|
7345
7794
|
}),
|
|
7346
|
-
|
|
7795
|
+
X && G !== "none" && L(/* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
|
|
7347
7796
|
className: "fixed inset-0 z-[9998]",
|
|
7348
|
-
onClick: () =>
|
|
7797
|
+
onClick: () => K("none")
|
|
7349
7798
|
}), /* @__PURE__ */ D("div", {
|
|
7350
7799
|
ref: le,
|
|
7351
|
-
style:
|
|
7800
|
+
style: ce,
|
|
7352
7801
|
className: "bg-background border border-default-200 rounded-xl shadow-xl",
|
|
7353
7802
|
onClick: (e) => e.stopPropagation(),
|
|
7354
|
-
children:
|
|
7803
|
+
children: G === "highlight" ? /* @__PURE__ */ O("div", {
|
|
7355
7804
|
className: "flex items-center gap-1 p-1.5 flex-wrap",
|
|
7356
|
-
children: [
|
|
7805
|
+
children: [Vi.map((e) => /* @__PURE__ */ D("button", {
|
|
7357
7806
|
type: "button",
|
|
7358
7807
|
className: "w-5 h-5 rounded-full border border-default-200 hover:scale-110 transition-transform",
|
|
7359
7808
|
style: { background: e.color },
|
|
7360
7809
|
title: e.name,
|
|
7361
7810
|
onClick: () => {
|
|
7362
|
-
|
|
7811
|
+
X.chain().focus().setHighlight({ color: e.color }).run(), K("none");
|
|
7363
7812
|
}
|
|
7364
7813
|
}, e.color)), /* @__PURE__ */ O("button", {
|
|
7365
7814
|
type: "button",
|
|
7366
7815
|
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]",
|
|
7367
7816
|
title: "清除高亮",
|
|
7368
7817
|
onClick: () => {
|
|
7369
|
-
|
|
7818
|
+
X.chain().focus().unsetHighlight().run(), K("none");
|
|
7370
7819
|
},
|
|
7371
7820
|
children: ["✕", " "]
|
|
7372
7821
|
})]
|
|
@@ -7379,101 +7828,101 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7379
7828
|
value: de,
|
|
7380
7829
|
onChange: (e) => fe(e.target.value),
|
|
7381
7830
|
onKeyDown: (e) => {
|
|
7382
|
-
e.key === "Enter" ? (de.trim() &&
|
|
7831
|
+
e.key === "Enter" ? (de.trim() && X.chain().focus().setLink({ href: de.trim() }).run(), K("none")) : e.key === "Escape" && K("none");
|
|
7383
7832
|
}
|
|
7384
7833
|
}), /* @__PURE__ */ D("button", {
|
|
7385
7834
|
type: "button",
|
|
7386
7835
|
className: "px-2 py-1 text-xs rounded-md bg-primary text-white hover:opacity-90",
|
|
7387
7836
|
onClick: () => {
|
|
7388
|
-
de.trim() &&
|
|
7837
|
+
de.trim() && X.chain().focus().setLink({ href: de.trim() }).run(), K("none");
|
|
7389
7838
|
},
|
|
7390
7839
|
children: "确定"
|
|
7391
7840
|
})]
|
|
7392
7841
|
})
|
|
7393
7842
|
})] }), document.body),
|
|
7394
|
-
!k && j &&
|
|
7843
|
+
!k && j && L(/* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
|
|
7395
7844
|
className: "fixed inset-0 z-[9998]",
|
|
7396
7845
|
onClick: () => M(!1)
|
|
7397
7846
|
}), /* @__PURE__ */ O("div", {
|
|
7398
7847
|
ref: z,
|
|
7399
7848
|
"data-lenis-prevent": !0,
|
|
7400
|
-
style:
|
|
7401
|
-
className: `ai-panel relative flex flex-col bg-background border border-default-200 rounded-xl shadow-xl${
|
|
7849
|
+
style: P,
|
|
7850
|
+
className: `ai-panel relative flex flex-col bg-background border border-default-200 rounded-xl shadow-xl${I === "above" ? " ai-panel--above" : ""}`,
|
|
7402
7851
|
onClick: (e) => e.stopPropagation(),
|
|
7403
7852
|
children: [/* @__PURE__ */ D("span", {
|
|
7404
7853
|
className: "ai-panel__arrow",
|
|
7405
7854
|
style: { left: `${re}%` },
|
|
7406
7855
|
"aria-hidden": "true"
|
|
7407
|
-
}), /* @__PURE__ */ D(
|
|
7408
|
-
editor:
|
|
7856
|
+
}), /* @__PURE__ */ D(ln, {
|
|
7857
|
+
editor: X,
|
|
7409
7858
|
onClose: () => M(!1)
|
|
7410
7859
|
})]
|
|
7411
7860
|
})] }), document.body),
|
|
7412
7861
|
B && /* @__PURE__ */ D(v, {
|
|
7413
|
-
fallback: /* @__PURE__ */ D(
|
|
7414
|
-
children: /* @__PURE__ */ D(
|
|
7862
|
+
fallback: /* @__PURE__ */ D($i, {}),
|
|
7863
|
+
children: /* @__PURE__ */ D(Ji, {
|
|
7415
7864
|
open: B,
|
|
7416
7865
|
onClose: () => V(!1),
|
|
7417
7866
|
onInsert: it,
|
|
7418
|
-
validate: (e) =>
|
|
7867
|
+
validate: (e) => X ? mn(X.state.doc, e, {
|
|
7419
7868
|
maxAttachmentSize: o,
|
|
7420
7869
|
maxTotalAttachmentSize: s
|
|
7421
7870
|
}) : null
|
|
7422
7871
|
})
|
|
7423
7872
|
}),
|
|
7424
7873
|
H && /* @__PURE__ */ D(v, {
|
|
7425
|
-
fallback: /* @__PURE__ */ D(
|
|
7426
|
-
children: /* @__PURE__ */ D(
|
|
7874
|
+
fallback: /* @__PURE__ */ D($i, {}),
|
|
7875
|
+
children: /* @__PURE__ */ D(Zi, {
|
|
7427
7876
|
open: H,
|
|
7428
7877
|
onClose: () => ae(!1),
|
|
7429
7878
|
onInsert: at
|
|
7430
7879
|
})
|
|
7431
7880
|
}),
|
|
7432
7881
|
oe && /* @__PURE__ */ D(v, {
|
|
7433
|
-
fallback: /* @__PURE__ */ D(
|
|
7434
|
-
children: /* @__PURE__ */ D(
|
|
7882
|
+
fallback: /* @__PURE__ */ D($i, {}),
|
|
7883
|
+
children: /* @__PURE__ */ D(Yi, {
|
|
7435
7884
|
open: oe,
|
|
7436
7885
|
onClose: () => U(!1)
|
|
7437
7886
|
})
|
|
7438
7887
|
}),
|
|
7439
7888
|
W && /* @__PURE__ */ D(v, {
|
|
7440
|
-
fallback: /* @__PURE__ */ D(
|
|
7441
|
-
children: /* @__PURE__ */ D(
|
|
7889
|
+
fallback: /* @__PURE__ */ D($i, {}),
|
|
7890
|
+
children: /* @__PURE__ */ D(Xi, {
|
|
7442
7891
|
open: W,
|
|
7443
|
-
onClose: () =>
|
|
7444
|
-
editor:
|
|
7892
|
+
onClose: () => se(!1),
|
|
7893
|
+
editor: X
|
|
7445
7894
|
})
|
|
7446
7895
|
}),
|
|
7447
|
-
|
|
7448
|
-
fallback: /* @__PURE__ */ D(
|
|
7449
|
-
children: /* @__PURE__ */ D(
|
|
7450
|
-
open: !!
|
|
7451
|
-
filename:
|
|
7896
|
+
J && /* @__PURE__ */ D(v, {
|
|
7897
|
+
fallback: /* @__PURE__ */ D($i, {}),
|
|
7898
|
+
children: /* @__PURE__ */ D(Qi, {
|
|
7899
|
+
open: !!J,
|
|
7900
|
+
filename: J.filename,
|
|
7452
7901
|
onRender: () => {
|
|
7453
|
-
|
|
7902
|
+
J.resolve("render"), pe(null);
|
|
7454
7903
|
},
|
|
7455
7904
|
onAttach: () => {
|
|
7456
|
-
|
|
7905
|
+
J.resolve("attach"), pe(null);
|
|
7457
7906
|
},
|
|
7458
7907
|
onClose: () => {
|
|
7459
|
-
|
|
7908
|
+
J.resolve(null), pe(null);
|
|
7460
7909
|
}
|
|
7461
7910
|
})
|
|
7462
7911
|
}),
|
|
7463
7912
|
/* @__PURE__ */ D("div", {
|
|
7464
|
-
ref:
|
|
7913
|
+
ref: Ee,
|
|
7465
7914
|
className: "flex editor-body",
|
|
7466
7915
|
children: /* @__PURE__ */ O("div", {
|
|
7467
7916
|
className: "relative min-w-0 flex-1",
|
|
7468
7917
|
children: [
|
|
7469
|
-
/* @__PURE__ */ D(
|
|
7470
|
-
!k && /* @__PURE__ */ D(
|
|
7918
|
+
/* @__PURE__ */ D(ee, { editor: X }),
|
|
7919
|
+
!k && /* @__PURE__ */ D(Bi, { editor: X }),
|
|
7471
7920
|
/* @__PURE__ */ D("div", {
|
|
7472
|
-
className: `${
|
|
7921
|
+
className: `${Y || Fe ? "fixed" : "absolute"} bottom-2 right-4 z-10 pointer-events-none select-none`,
|
|
7473
7922
|
children: /* @__PURE__ */ O("span", {
|
|
7474
|
-
className: `text-xs ${nt ? "bg-danger/10 text-danger font-medium px-2 py-0.5 rounded" : a &&
|
|
7923
|
+
className: `text-xs ${nt ? "bg-danger/10 text-danger font-medium px-2 py-0.5 rounded" : a && et > a * .9 ? "bg-warning/10 text-warning px-2 py-0.5 rounded" : "text-default-300"}`,
|
|
7475
7924
|
children: [
|
|
7476
|
-
|
|
7925
|
+
et,
|
|
7477
7926
|
a ? ` / ${a}` : "",
|
|
7478
7927
|
" 字"
|
|
7479
7928
|
]
|
|
@@ -7482,14 +7931,14 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7482
7931
|
]
|
|
7483
7932
|
})
|
|
7484
7933
|
}),
|
|
7485
|
-
h &&
|
|
7486
|
-
editor:
|
|
7487
|
-
onClose: () =>
|
|
7934
|
+
h && ve && /* @__PURE__ */ D(Mt, {
|
|
7935
|
+
editor: X,
|
|
7936
|
+
onClose: () => ye(!1)
|
|
7488
7937
|
}),
|
|
7489
|
-
|
|
7938
|
+
st && /* @__PURE__ */ D("button", {
|
|
7490
7939
|
type: "button",
|
|
7491
7940
|
className: "qingwu-toc-fab",
|
|
7492
|
-
onClick: () =>
|
|
7941
|
+
onClick: () => _e(!0),
|
|
7493
7942
|
title: "目录",
|
|
7494
7943
|
"aria-label": "打开目录",
|
|
7495
7944
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -7505,8 +7954,8 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7505
7954
|
})
|
|
7506
7955
|
})
|
|
7507
7956
|
}),
|
|
7508
|
-
|
|
7509
|
-
ref:
|
|
7957
|
+
ge && L(/* @__PURE__ */ O("div", {
|
|
7958
|
+
ref: Le,
|
|
7510
7959
|
className: "qingwu-toc-drawer toc-scroll",
|
|
7511
7960
|
"data-lenis-prevent": !0,
|
|
7512
7961
|
children: [/* @__PURE__ */ O("div", {
|
|
@@ -7517,7 +7966,7 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7517
7966
|
}), /* @__PURE__ */ D("button", {
|
|
7518
7967
|
type: "button",
|
|
7519
7968
|
className: "qed-drawer-head__close",
|
|
7520
|
-
onClick: () =>
|
|
7969
|
+
onClick: () => _e(!1),
|
|
7521
7970
|
"aria-label": "关闭目录",
|
|
7522
7971
|
children: /* @__PURE__ */ D("svg", {
|
|
7523
7972
|
fill: "none",
|
|
@@ -7532,21 +7981,21 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7532
7981
|
})
|
|
7533
7982
|
})
|
|
7534
7983
|
})]
|
|
7535
|
-
}), /* @__PURE__ */ D(
|
|
7536
|
-
editor:
|
|
7984
|
+
}), /* @__PURE__ */ D(mt, {
|
|
7985
|
+
editor: X,
|
|
7537
7986
|
className: "!p-3",
|
|
7538
7987
|
onClose: () => {
|
|
7539
|
-
|
|
7988
|
+
_e(!1), he(!1);
|
|
7540
7989
|
}
|
|
7541
7990
|
})]
|
|
7542
7991
|
}), document.body)
|
|
7543
7992
|
]
|
|
7544
|
-
}), ot &&
|
|
7545
|
-
ref:
|
|
7993
|
+
}), ot && L(/* @__PURE__ */ D("aside", {
|
|
7994
|
+
ref: Ae,
|
|
7546
7995
|
className: "qingwu-toc-desktop toc-scroll",
|
|
7547
|
-
children: /* @__PURE__ */ D(
|
|
7548
|
-
editor:
|
|
7549
|
-
onClose: () =>
|
|
7996
|
+
children: /* @__PURE__ */ D(mt, {
|
|
7997
|
+
editor: X,
|
|
7998
|
+
onClose: () => he(!1)
|
|
7550
7999
|
})
|
|
7551
8000
|
}), document.body)]
|
|
7552
8001
|
}) : /* @__PURE__ */ D("div", {
|
|
@@ -7556,7 +8005,7 @@ var Oi = y(() => Promise.resolve().then(() => et).then((e) => ({ default: e.Imag
|
|
|
7556
8005
|
};
|
|
7557
8006
|
//#endregion
|
|
7558
8007
|
//#region src/editor/clipper/receiver-browser.ts
|
|
7559
|
-
function
|
|
8008
|
+
function ta(e) {
|
|
7560
8009
|
let t = async (t) => {
|
|
7561
8010
|
let n = t.data;
|
|
7562
8011
|
if (!n || typeof n != "object" || n.kind !== "qingwu-clip") return;
|
|
@@ -7573,7 +8022,7 @@ function Fi(e) {
|
|
|
7573
8022
|
}
|
|
7574
8023
|
//#endregion
|
|
7575
8024
|
//#region src/editor/storage/providers/cos.ts
|
|
7576
|
-
function
|
|
8025
|
+
function na(e) {
|
|
7577
8026
|
return g({
|
|
7578
8027
|
endpoint: `https://cos.${e.region}.myqcloud.com`,
|
|
7579
8028
|
bucket: e.bucket,
|
|
@@ -7587,7 +8036,7 @@ function Ii(e) {
|
|
|
7587
8036
|
}
|
|
7588
8037
|
//#endregion
|
|
7589
8038
|
//#region src/editor/storage/providers/oss.ts
|
|
7590
|
-
function
|
|
8039
|
+
function ra(e) {
|
|
7591
8040
|
return g({
|
|
7592
8041
|
endpoint: `https://${e.bucket}.${e.region}.aliyuncs.com`,
|
|
7593
8042
|
bucket: e.bucket,
|
|
@@ -7600,4 +8049,4 @@ function Li(e) {
|
|
|
7600
8049
|
});
|
|
7601
8050
|
}
|
|
7602
8051
|
//#endregion
|
|
7603
|
-
export {
|
|
8052
|
+
export { sr as CODE_LANGUAGES, pr as CodeBlock, Lr as ImageUpload, rt as ImageUploadDialog, ei as MathBlock, $r as MathInline, ea as QingWuAIEditor, Ti as RelativeMedia, At as SearchHighlight, mt as TocPanel, Xn as VideoEmbed, ht as buildSystemPrompt, _t as createAILanguageModelProvider, na as createCOSStorage, xt as createDeepSeekProvider, _ as createLocalStorage, ra as createOSSStorage, bt as createOpenAICompatProvider, St as createOpenAIProvider, Ct as createQwenProvider, g as createS3Storage, Di as createSlashCommandExtension, h as escapeHtml, fn as formatBytes, yt as getAIProvider, Pi as getBubbleMenuActions, Oi as getDefaultSlashCommands, dn as getDocAttachmentTotal, Ai as getEditorExtensions, u as getLocale, Ni as getSearchEngine, jt as getSearchState, c as getStorageInfo, o as getStorageProvider, s as loadStorageConfig, r as registerS3PreviewConfig, d as sanitizeHtml, p as sanitizeSvg, vt as setAIProvider, bn as setConfirmProvider, l as setLocale, Mi as setSearchEngine, i as setStorageProvider, et as setToastProvider, n as signPreviewUrlHeaders, ta as startBrowserClipperReceiver, tt as subscribeToast, f as t, m as tf, Z as toast, mn as validateAttachmentFile };
|