@qingwu-ui/ai-editor 0.9.0-beta.16 → 0.9.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/toc.d.ts +5 -0
- package/dist/components/toc.d.ts.map +1 -1
- package/dist/editor/ai-editor.d.ts.map +1 -1
- package/dist/editor/extensions/code-block.d.ts.map +1 -1
- package/dist/editor/extensions/ime-commit-space-guard.d.ts +3 -0
- package/dist/editor/extensions/ime-commit-space-guard.d.ts.map +1 -0
- package/dist/editor/extensions/index.d.ts.map +1 -1
- package/dist/editor/extensions/slash-command.d.ts.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +356 -315
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20,45 +20,45 @@ import { CharacterCount as K } from "@tiptap/extension-character-count";
|
|
|
20
20
|
import { Color as q } from "@tiptap/extension-color";
|
|
21
21
|
import { Highlight as se } from "@tiptap/extension-highlight";
|
|
22
22
|
import { HorizontalRule as ce } from "@tiptap/extension-horizontal-rule";
|
|
23
|
-
import { Placeholder as
|
|
24
|
-
import { Table as
|
|
25
|
-
import { TableCell as
|
|
26
|
-
import { TableHeader as
|
|
27
|
-
import { TableRow as
|
|
28
|
-
import { TaskItem as
|
|
29
|
-
import { TaskList as
|
|
30
|
-
import { TextStyle as
|
|
31
|
-
import { Markdown as
|
|
32
|
-
import { CodeBlockLowlight as
|
|
33
|
-
import
|
|
34
|
-
import { common as
|
|
35
|
-
import
|
|
23
|
+
import { Placeholder as le } from "@tiptap/extension-placeholder";
|
|
24
|
+
import { Table as ue } from "@tiptap/extension-table";
|
|
25
|
+
import { TableCell as de } from "@tiptap/extension-table-cell";
|
|
26
|
+
import { TableHeader as fe } from "@tiptap/extension-table-header";
|
|
27
|
+
import { TableRow as pe } from "@tiptap/extension-table-row";
|
|
28
|
+
import { TaskItem as me } from "@tiptap/extension-task-item";
|
|
29
|
+
import { TaskList as he } from "@tiptap/extension-task-list";
|
|
30
|
+
import { TextStyle as ge } from "@tiptap/extension-text-style";
|
|
31
|
+
import { Markdown as _e } from "tiptap-markdown";
|
|
32
|
+
import { CodeBlockLowlight as ve } from "@tiptap/extension-code-block-lowlight";
|
|
33
|
+
import ye from "highlight.js/lib/languages/dockerfile";
|
|
34
|
+
import { common as be, createLowlight as xe } from "lowlight";
|
|
35
|
+
import Se, { exitSuggestion as Ce, findSuggestionMatch as we } from "@tiptap/suggestion";
|
|
36
36
|
//#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(),
|
|
37
|
+
var Te = null, Ee = null;
|
|
38
|
+
function De() {
|
|
39
|
+
return Ee || (typeof document > "u" ? null : (Te = document.createElement("canvas"), Ee = Te.getContext("2d"), Ee));
|
|
40
|
+
}
|
|
41
|
+
var Oe = /* @__PURE__ */ new Map();
|
|
42
|
+
function ke(e, t) {
|
|
43
|
+
let n = Oe.get(t);
|
|
44
|
+
n || (n = /* @__PURE__ */ new Map(), Oe.set(t, n));
|
|
45
45
|
let r = n.get(e);
|
|
46
46
|
if (r !== void 0) return r;
|
|
47
|
-
let i =
|
|
48
|
-
return i ? (i.font = t, r = i.measureText(e).width) : r =
|
|
47
|
+
let i = De();
|
|
48
|
+
return i ? (i.font = t, r = i.measureText(e).width) : r = Ae(e, t), n.set(e, r), r;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Ae(e, t) {
|
|
51
51
|
let n = parseFloat(t) || 16, r = 0;
|
|
52
|
-
for (let t of e)
|
|
52
|
+
for (let t of e) je(t.codePointAt(0) ?? 0) ? r += n : t === " " ? r += n * .3 : r += n * .55;
|
|
53
53
|
return r;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function je(e) {
|
|
56
56
|
return e >= 19968 && e <= 40959 || e >= 13312 && e <= 19903 || e >= 131072 && e <= 173791 || e >= 63744 && e <= 64255 || e >= 194560 && e <= 195103 || e >= 12288 && e <= 12351 || e >= 65280 && e <= 65519 || e >= 11904 && e <= 12031 || e >= 12736 && e <= 12783 || e >= 44032 && e <= 55215;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Me(e) {
|
|
59
59
|
return e === 12289 || e === 12290 || e === 65292 || e === 65294 || e === 65306 || e === 65307 || e === 65311 || e === 65281 || e === 65289 || e === 65341 || e === 12301 || e === 12303 || e === 12299 || e === 12305;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function J(e, t) {
|
|
62
62
|
let n = [], r = [];
|
|
63
63
|
if (typeof Intl < "u" && Intl.Segmenter) try {
|
|
64
64
|
let t = new Intl.Segmenter("zh", { granularity: "grapheme" });
|
|
@@ -69,27 +69,27 @@ function je(e, t) {
|
|
|
69
69
|
else r = [...e];
|
|
70
70
|
for (let e of r) {
|
|
71
71
|
let r = e.codePointAt(0) ?? 0, i = "latin";
|
|
72
|
-
e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" :
|
|
72
|
+
e === "\n" ? i = "break" : e === " " || e === " " ? i = "space" : je(r) && (i = Me(r) ? "punct" : "cjk"), n.push({
|
|
73
73
|
text: e,
|
|
74
|
-
width:
|
|
74
|
+
width: ke(e, t),
|
|
75
75
|
type: i
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
return n;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function Ne(e, t, n) {
|
|
81
81
|
let r = 0, i = Math.min(n, e.length);
|
|
82
82
|
for (let n = t; n < i; n++) r += e[n].width;
|
|
83
83
|
return r;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function Y(e, t, n, r) {
|
|
86
86
|
return {
|
|
87
87
|
text: e.slice(t, Math.min(n, e.length)).map((e) => e.text).join(""),
|
|
88
88
|
width: r
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
function Pe(e, t, n = "16px system-ui") {
|
|
92
|
-
let { maxWidth: r, lineHeight: i, maxLines: a, overflowWrap: o = "break-word" } = t, s =
|
|
92
|
+
let { maxWidth: r, lineHeight: i, maxLines: a, overflowWrap: o = "break-word" } = t, s = J(e, n), c = [], l = {
|
|
93
93
|
lineStart: 0,
|
|
94
94
|
lineWidth: 0,
|
|
95
95
|
lastBreakIdx: -1,
|
|
@@ -98,28 +98,28 @@ function Pe(e, t, n = "16px system-ui") {
|
|
|
98
98
|
for (let e = 0; e < s.length; e++) {
|
|
99
99
|
let t = s[e];
|
|
100
100
|
if (t.type === "break") {
|
|
101
|
-
c.push(
|
|
101
|
+
c.push(Y(s, l.lineStart, e, l.lineWidth)), l.lineStart = e + 1, l.lineWidth = 0, l.lastBreakIdx = -1;
|
|
102
102
|
continue;
|
|
103
103
|
}
|
|
104
104
|
let n = l.lineWidth + t.width;
|
|
105
105
|
if (t.type === "space") {
|
|
106
|
-
if (n > r && l.lineWidth > 0 ? (l.lastBreakIdx >= 0 ? (c.push(
|
|
106
|
+
if (n > r && l.lineWidth > 0 ? (l.lastBreakIdx >= 0 ? (c.push(Y(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Ne(s, l.lineStart, e + 1)) : (c.push(Y(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
107
|
continue;
|
|
108
108
|
}
|
|
109
109
|
if (t.type === "cjk") {
|
|
110
|
-
if (n > r && l.lineWidth > 0 ? (c.push(
|
|
110
|
+
if (n > r && l.lineWidth > 0 ? (c.push(Y(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
111
|
continue;
|
|
112
112
|
}
|
|
113
113
|
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(
|
|
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(Y(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Ne(s, l.lineStart, e + 1)) : l.lineWidth = n, l.lastBreakIdx = -1) : l.lineWidth = n, a && c.length >= a) break;
|
|
115
115
|
continue;
|
|
116
116
|
}
|
|
117
|
-
if (n > r && l.lineWidth > 0 ? l.lastBreakIdx >= 0 ? (c.push(
|
|
117
|
+
if (n > r && l.lineWidth > 0 ? l.lastBreakIdx >= 0 ? (c.push(Y(s, l.lineStart, l.lastBreakIdx + 1, l.lastBreakWidth)), l.lineStart = l.lastBreakIdx + 1, l.lineWidth = Ne(s, l.lineStart, e + 1), l.lastBreakIdx = -1) : o === "break-word" ? (c.push(Y(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
118
|
}
|
|
119
119
|
let u = l.lineStart < s.length;
|
|
120
120
|
if (u && (!a || c.length < a)) {
|
|
121
|
-
let e =
|
|
122
|
-
c.push(
|
|
121
|
+
let e = Ne(s, l.lineStart, s.length);
|
|
122
|
+
c.push(Y(s, l.lineStart, s.length, e));
|
|
123
123
|
}
|
|
124
124
|
return {
|
|
125
125
|
lines: c,
|
|
@@ -131,12 +131,12 @@ function Pe(e, t, n = "16px system-ui") {
|
|
|
131
131
|
//#endregion
|
|
132
132
|
//#region ../toast/dist/index.mjs
|
|
133
133
|
var Fe = typeof window < "u" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, Ie = "13.5px -apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"PingFang SC\", \"Microsoft YaHei\", system-ui, sans-serif";
|
|
134
|
-
function
|
|
134
|
+
function Le() {
|
|
135
135
|
if (typeof window > "u") return 290;
|
|
136
136
|
let e = window.innerWidth;
|
|
137
137
|
return e <= 480 ? Math.max(140, e - 98) : 290;
|
|
138
138
|
}
|
|
139
|
-
var
|
|
139
|
+
var X = {
|
|
140
140
|
info: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><line x1=\"12\" y1=\"16\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"8\" x2=\"12.01\" y2=\"8\"/></svg>",
|
|
141
141
|
success: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M9 12l2 2 4-4\"/></svg>",
|
|
142
142
|
warning: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"/><line x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"/><line x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"/></svg>",
|
|
@@ -278,9 +278,9 @@ var Ge = class {
|
|
|
278
278
|
let s = Be("div", `qt-toast qt-${n}${i == null ? "" : " qt-truncate"}${a || o ? " qt-rich" : ""}`);
|
|
279
279
|
s.setAttribute("data-qt-id", e);
|
|
280
280
|
let c = Be("span", "qt-icon");
|
|
281
|
-
c.innerHTML =
|
|
281
|
+
c.innerHTML = X[n], s.appendChild(c);
|
|
282
282
|
let l = Be("div", "qt-body"), u = Be("span", "qt-msg"), d = Pe(t, {
|
|
283
|
-
maxWidth:
|
|
283
|
+
maxWidth: Le(),
|
|
284
284
|
lineHeight: 1,
|
|
285
285
|
maxLines: i
|
|
286
286
|
}, Ie);
|
|
@@ -2918,28 +2918,28 @@ function Fn({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
2918
2918
|
x(() => {
|
|
2919
2919
|
l(U ? Cn.has(U) : !1);
|
|
2920
2920
|
}, [U]);
|
|
2921
|
-
let
|
|
2921
|
+
let le = b(() => {
|
|
2922
2922
|
I.current = !0, ce(!0), window.setTimeout(() => {
|
|
2923
2923
|
window.scrollTo(0, P.current), L.current && (L.current.scrollTop = ee.current), I.current && ce(!0), I.current = !1;
|
|
2924
2924
|
}, 0);
|
|
2925
|
-
}, [ce]),
|
|
2926
|
-
z === "web" ? (B("none"), document.body.style.overflow = "",
|
|
2927
|
-
}, [z]),
|
|
2925
|
+
}, [ce]), ue = b(async () => {
|
|
2926
|
+
z === "web" ? (B("none"), document.body.style.overflow = "", le()) : (z === "native" && document.fullscreenElement && await document.exitFullscreen(), P.current = window.scrollY, ee.current = L.current?.scrollTop ?? 0, document.body.style.overflow = "hidden", B("web"));
|
|
2927
|
+
}, [z]), de = b(async () => {
|
|
2928
2928
|
let e = M.current;
|
|
2929
2929
|
e && (z === "native" ? await document.exitFullscreen() : (z === "web" && (B("none"), document.body.style.overflow = ""), P.current = window.scrollY, ee.current = L.current?.scrollTop ?? 0, await e.requestFullscreen(), B("native")));
|
|
2930
|
-
}, [z,
|
|
2930
|
+
}, [z, le]), fe = b(() => {
|
|
2931
2931
|
z === "none" && (I.current || ce((e) => !e));
|
|
2932
2932
|
}, [z]);
|
|
2933
2933
|
x(() => {
|
|
2934
2934
|
let e = () => {
|
|
2935
|
-
document.fullscreenElement || (z === "native" && B("none"),
|
|
2935
|
+
document.fullscreenElement || (z === "native" && B("none"), le());
|
|
2936
2936
|
}, t = (e) => {
|
|
2937
|
-
e.key === "Escape" && z === "web" && (B("none"), document.body.style.overflow = "",
|
|
2937
|
+
e.key === "Escape" && z === "web" && (B("none"), document.body.style.overflow = "", le());
|
|
2938
2938
|
};
|
|
2939
2939
|
return document.addEventListener("fullscreenchange", e), window.addEventListener("keydown", t), () => {
|
|
2940
2940
|
document.removeEventListener("fullscreenchange", e), window.removeEventListener("keydown", t);
|
|
2941
2941
|
};
|
|
2942
|
-
}, [z,
|
|
2942
|
+
}, [z, le]), x(() => {
|
|
2943
2943
|
let e = (e) => {
|
|
2944
2944
|
if (!(e.key !== "Backspace" && e.key !== "Delete") && o && i && !mn()) {
|
|
2945
2945
|
if (e.preventDefault(), e.stopPropagation(), a) {
|
|
@@ -3018,7 +3018,7 @@ function Fn({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3018
3018
|
let e = window.setTimeout(() => A(null), 2400);
|
|
3019
3019
|
return () => window.clearTimeout(e);
|
|
3020
3020
|
}, [k]);
|
|
3021
|
-
let
|
|
3021
|
+
let pe = b(async () => {
|
|
3022
3022
|
E(!0), A("loading");
|
|
3023
3023
|
try {
|
|
3024
3024
|
if (p) {
|
|
@@ -3149,7 +3149,7 @@ function Fn({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3149
3149
|
type: "button",
|
|
3150
3150
|
className: "att-btn",
|
|
3151
3151
|
onMouseDown: (e) => {
|
|
3152
|
-
e.preventDefault(), e.stopPropagation(),
|
|
3152
|
+
e.preventDefault(), e.stopPropagation(), fe();
|
|
3153
3153
|
},
|
|
3154
3154
|
title: f("editor.attachment.preview"),
|
|
3155
3155
|
"aria-label": f("editor.attachment.preview"),
|
|
@@ -3175,7 +3175,7 @@ function Fn({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3175
3175
|
/* @__PURE__ */ D("button", {
|
|
3176
3176
|
type: "button",
|
|
3177
3177
|
className: "att-btn",
|
|
3178
|
-
onClick:
|
|
3178
|
+
onClick: pe,
|
|
3179
3179
|
disabled: S || q,
|
|
3180
3180
|
title: S ? "正在准备下载" : f("editor.attachment.download"),
|
|
3181
3181
|
"aria-label": S ? "正在准备下载" : f("editor.attachment.download"),
|
|
@@ -3289,7 +3289,7 @@ function Fn({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3289
3289
|
},
|
|
3290
3290
|
children: [/* @__PURE__ */ D("button", {
|
|
3291
3291
|
type: "button",
|
|
3292
|
-
onClick:
|
|
3292
|
+
onClick: ue,
|
|
3293
3293
|
title: z === "web" ? "退出网页全屏" : "网页全屏",
|
|
3294
3294
|
"aria-label": z === "web" ? "退出网页全屏" : "网页全屏",
|
|
3295
3295
|
style: {
|
|
@@ -3327,7 +3327,7 @@ function Fn({ node: e, deleteNode: r, selected: i, editor: a }) {
|
|
|
3327
3327
|
})
|
|
3328
3328
|
}), /* @__PURE__ */ D("button", {
|
|
3329
3329
|
type: "button",
|
|
3330
|
-
onClick:
|
|
3330
|
+
onClick: de,
|
|
3331
3331
|
title: z === "native" ? "退出全屏" : "全屏",
|
|
3332
3332
|
"aria-label": z === "native" ? "退出全屏" : "全屏",
|
|
3333
3333
|
style: {
|
|
@@ -4590,7 +4590,7 @@ function Qn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4590
4590
|
}, [e.textContent]), ce = b(() => {
|
|
4591
4591
|
let t = Xn[V] || "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");
|
|
4592
4592
|
a.href = i, a.download = n, document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
4593
|
-
}, [e.textContent, V]),
|
|
4593
|
+
}, [e.textContent, V]), le = b(async () => {
|
|
4594
4594
|
if (N || L) {
|
|
4595
4595
|
P(null), I(null), ee(!1);
|
|
4596
4596
|
return;
|
|
@@ -4613,7 +4613,7 @@ function Qn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4613
4613
|
e.textContent,
|
|
4614
4614
|
N,
|
|
4615
4615
|
L
|
|
4616
|
-
]),
|
|
4616
|
+
]), ue = /* @__PURE__ */ O(E, { children: [H ? H.deviconClass ? /* @__PURE__ */ D("i", {
|
|
4617
4617
|
className: `${H.deviconClass} colored cb-lang-icon`,
|
|
4618
4618
|
style: { color: H.color }
|
|
4619
4619
|
}) : /* @__PURE__ */ D("span", {
|
|
@@ -4634,6 +4634,7 @@ function Qn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4634
4634
|
/* @__PURE__ */ O("div", {
|
|
4635
4635
|
className: "cb-header",
|
|
4636
4636
|
contentEditable: !1,
|
|
4637
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
4637
4638
|
children: [
|
|
4638
4639
|
/* @__PURE__ */ D("div", {
|
|
4639
4640
|
className: "cb-lang-wrap",
|
|
@@ -4641,13 +4642,13 @@ function Qn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4641
4642
|
contentEditable: !1,
|
|
4642
4643
|
children: s ? /* @__PURE__ */ D("span", {
|
|
4643
4644
|
className: "cb-lang-trigger cb-lang-trigger--static",
|
|
4644
|
-
children:
|
|
4645
|
+
children: ue
|
|
4645
4646
|
}) : /* @__PURE__ */ O("button", {
|
|
4646
4647
|
ref: re,
|
|
4647
4648
|
type: "button",
|
|
4648
4649
|
className: "cb-lang-trigger",
|
|
4649
4650
|
onClick: () => m(!f),
|
|
4650
|
-
children: [
|
|
4651
|
+
children: [ue, /* @__PURE__ */ D("svg", {
|
|
4651
4652
|
className: `cb-lang-chevron${f ? " cb-lang-chevron--open" : ""}`,
|
|
4652
4653
|
width: "10",
|
|
4653
4654
|
height: "10",
|
|
@@ -4844,7 +4845,7 @@ function Qn({ node: e, updateAttributes: t, editor: n, getPos: r, deleteNode: i,
|
|
|
4844
4845
|
ae && /* @__PURE__ */ D("button", {
|
|
4845
4846
|
type: "button",
|
|
4846
4847
|
className: "cb-btn cb-btn--diagram",
|
|
4847
|
-
onClick:
|
|
4848
|
+
onClick: le,
|
|
4848
4849
|
contentEditable: !1,
|
|
4849
4850
|
title: N || L ? "取消渲染" : "渲染图表",
|
|
4850
4851
|
disabled: L,
|
|
@@ -5003,8 +5004,8 @@ var $n = [
|
|
|
5003
5004
|
value: "mermaid",
|
|
5004
5005
|
label: "Mermaid"
|
|
5005
5006
|
}
|
|
5006
|
-
], er = be
|
|
5007
|
-
er.register({ dockerfile:
|
|
5007
|
+
], er = xe(be);
|
|
5008
|
+
er.register({ dockerfile: ye }), er.registerAlias("xml", ["vue", "html"]), er.registerAlias("javascript", ["react", "jsx"]), er.registerAlias("typescript", ["tsx"]);
|
|
5008
5009
|
function tr(e) {
|
|
5009
5010
|
return e ? e.split("\n") : [""];
|
|
5010
5011
|
}
|
|
@@ -5071,7 +5072,7 @@ function ir(e, t, n) {
|
|
|
5071
5072
|
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;
|
|
5072
5073
|
}
|
|
5073
5074
|
}
|
|
5074
|
-
var ar =
|
|
5075
|
+
var ar = ve.extend({
|
|
5075
5076
|
addNodeView() {
|
|
5076
5077
|
return (e) => {
|
|
5077
5078
|
let { node: t, editor: n, getPos: r } = e, i = t, a = (e) => {
|
|
@@ -5514,25 +5515,45 @@ var kr = R.create({
|
|
|
5514
5515
|
}
|
|
5515
5516
|
})];
|
|
5516
5517
|
}
|
|
5517
|
-
}), Ar =
|
|
5518
|
-
|
|
5518
|
+
}), Ar = 100, jr = R.create({
|
|
5519
|
+
name: "imeCommitSpaceGuard",
|
|
5520
|
+
addProseMirrorPlugins() {
|
|
5521
|
+
let e = 0;
|
|
5522
|
+
return [new z({
|
|
5523
|
+
key: new B("imeCommitSpaceGuard"),
|
|
5524
|
+
props: { handleDOMEvents: {
|
|
5525
|
+
compositionend() {
|
|
5526
|
+
return e = performance.now(), !1;
|
|
5527
|
+
},
|
|
5528
|
+
input(t, n) {
|
|
5529
|
+
return n.isComposing && (e = performance.now()), !1;
|
|
5530
|
+
},
|
|
5531
|
+
beforeinput(t, n) {
|
|
5532
|
+
let r = n;
|
|
5533
|
+
return r.inputType !== "insertText" || r.data !== " " || r.isComposing || performance.now() - e > Ar ? !1 : (r.preventDefault(), !0);
|
|
5534
|
+
}
|
|
5535
|
+
} }
|
|
5536
|
+
})];
|
|
5537
|
+
}
|
|
5538
|
+
}), Mr = /\.(png|jpe?g|gif|webp|bmp|svg|avif)(\?|#|$)/i, Nr = /\.(mp4|m3u8|webm|ogg|flv|mkv|mov|avi|wmv|ts|m4v|3gp|f4v|rmvb)(\?|#|$)/i, Pr = /\.(mp3|wav|ogg|flac|aac|m4a|wma|opus)(\?|#|$)/i;
|
|
5539
|
+
function Fr(e) {
|
|
5519
5540
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
5520
5541
|
}
|
|
5521
|
-
function
|
|
5542
|
+
function Ir(e) {
|
|
5522
5543
|
let t = e.trim().replace(/\\/g, "/");
|
|
5523
5544
|
return t.split("/").pop() || t;
|
|
5524
5545
|
}
|
|
5525
|
-
function
|
|
5546
|
+
function Lr(e, t) {
|
|
5526
5547
|
let n = e.src.slice(e.pos), r = /^!\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/.exec(n), i = !0;
|
|
5527
5548
|
if (r || (r = /^\[\[([^\]|]+)(?:\|([^\]]+))?\]\]/.exec(n), i = !1), !r) return !1;
|
|
5528
5549
|
let a = r[1].trim(), o = r[2]?.trim();
|
|
5529
5550
|
if (!t) {
|
|
5530
|
-
let t = o ||
|
|
5551
|
+
let t = o || Ir(a);
|
|
5531
5552
|
if (i) {
|
|
5532
5553
|
let n = "";
|
|
5533
|
-
if (
|
|
5534
|
-
else if (
|
|
5535
|
-
else if (
|
|
5554
|
+
if (Mr.test(a) || /^data:image\//i.test(a)) n = `<img src="${Fr(a)}" alt="${Fr(t)}">`;
|
|
5555
|
+
else if (Nr.test(a) || /^data:video\//i.test(a)) n = `<div data-video-embed src="${Fr(a)}"></div>`;
|
|
5556
|
+
else if (Pr.test(a) || /^data:audio\//i.test(a)) n = `<audio src="${Fr(a)}"></audio>`;
|
|
5536
5557
|
else {
|
|
5537
5558
|
let n = e.push("link_open", "a", 1);
|
|
5538
5559
|
n.attrs = [["href", a]];
|
|
@@ -5550,14 +5571,14 @@ function Fr(e, t) {
|
|
|
5550
5571
|
}
|
|
5551
5572
|
return e.pos += r[0].length, !0;
|
|
5552
5573
|
}
|
|
5553
|
-
var
|
|
5574
|
+
var Rr = R.create({
|
|
5554
5575
|
name: "obsidianMarkdown",
|
|
5555
5576
|
addStorage() {
|
|
5556
5577
|
return { markdown: { parse: { setup(e) {
|
|
5557
|
-
e.__obsidianReg || (e.__obsidianReg = !0, e.inline.ruler.before("link", "obsidian_embed",
|
|
5578
|
+
e.__obsidianReg || (e.__obsidianReg = !0, e.inline.ruler.before("link", "obsidian_embed", Lr));
|
|
5558
5579
|
} } } };
|
|
5559
5580
|
}
|
|
5560
|
-
}),
|
|
5581
|
+
}), zr = R.create({
|
|
5561
5582
|
name: "qingwuUI",
|
|
5562
5583
|
addStorage() {
|
|
5563
5584
|
return {};
|
|
@@ -5565,7 +5586,7 @@ var Ir = R.create({
|
|
|
5565
5586
|
});
|
|
5566
5587
|
//#endregion
|
|
5567
5588
|
//#region src/editor/utils/render-probe.ts
|
|
5568
|
-
function
|
|
5589
|
+
function Br(e, t) {
|
|
5569
5590
|
return new Promise((n) => {
|
|
5570
5591
|
if (typeof Image != "function") return n(!0);
|
|
5571
5592
|
let r = new Image(), i = !1, a = setTimeout(() => o(!1), t), o = (e) => {
|
|
@@ -5574,14 +5595,14 @@ function Rr(e, t) {
|
|
|
5574
5595
|
r.onload = () => o(!0), r.onerror = () => o(!1), r.src = e;
|
|
5575
5596
|
});
|
|
5576
5597
|
}
|
|
5577
|
-
async function
|
|
5578
|
-
if (await
|
|
5598
|
+
async function Vr(e, t = 8e3) {
|
|
5599
|
+
if (await Br(e, t)) return !0;
|
|
5579
5600
|
try {
|
|
5580
5601
|
let r = await n(e);
|
|
5581
5602
|
if (!r) return !1;
|
|
5582
5603
|
let i = await fetch(e, { headers: r });
|
|
5583
5604
|
if (!i.ok) return !1;
|
|
5584
|
-
let a = URL.createObjectURL(await i.blob()), o = await
|
|
5605
|
+
let a = URL.createObjectURL(await i.blob()), o = await Br(a, t);
|
|
5585
5606
|
return URL.revokeObjectURL(a), o;
|
|
5586
5607
|
} catch {
|
|
5587
5608
|
return !1;
|
|
@@ -5589,7 +5610,7 @@ async function zr(e, t = 8e3) {
|
|
|
5589
5610
|
}
|
|
5590
5611
|
//#endregion
|
|
5591
5612
|
//#region src/editor/utils/resolve-local-media.ts
|
|
5592
|
-
function
|
|
5613
|
+
function Hr() {
|
|
5593
5614
|
return {
|
|
5594
5615
|
uploaded: 0,
|
|
5595
5616
|
sessionOnly: 0,
|
|
@@ -5599,10 +5620,10 @@ function Br() {
|
|
|
5599
5620
|
readFailed: []
|
|
5600
5621
|
};
|
|
5601
5622
|
}
|
|
5602
|
-
function
|
|
5623
|
+
function Ur(e, t) {
|
|
5603
5624
|
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);
|
|
5604
5625
|
}
|
|
5605
|
-
function
|
|
5626
|
+
function Wr(e, t, n, r) {
|
|
5606
5627
|
let { state: i } = e, a = [];
|
|
5607
5628
|
if (i.doc.descendants((e, n) => {
|
|
5608
5629
|
e.attrs?.src === t && a.push(n);
|
|
@@ -5618,7 +5639,7 @@ function Hr(e, t, n, r) {
|
|
|
5618
5639
|
}
|
|
5619
5640
|
return e.dispatch(o), !0;
|
|
5620
5641
|
}
|
|
5621
|
-
function
|
|
5642
|
+
function Gr(e, t, n) {
|
|
5622
5643
|
let { state: r } = e, i = r.schema.marks.link;
|
|
5623
5644
|
if (!i) return !1;
|
|
5624
5645
|
let a = [];
|
|
@@ -5636,7 +5657,7 @@ function Ur(e, t, n) {
|
|
|
5636
5657
|
}));
|
|
5637
5658
|
return e.dispatch(o), !0;
|
|
5638
5659
|
}
|
|
5639
|
-
function
|
|
5660
|
+
function Kr(e) {
|
|
5640
5661
|
let t = /* @__PURE__ */ new Map();
|
|
5641
5662
|
for (let n of e) {
|
|
5642
5663
|
let e = t.get(n.normalized);
|
|
@@ -5644,7 +5665,7 @@ function Wr(e) {
|
|
|
5644
5665
|
}
|
|
5645
5666
|
return Array.from(t.values());
|
|
5646
5667
|
}
|
|
5647
|
-
async function
|
|
5668
|
+
async function qr(e, t, n, r) {
|
|
5648
5669
|
if (n.length === 0) return "sessionOnly";
|
|
5649
5670
|
let i = n[0], a = ln(t);
|
|
5650
5671
|
if (a) {
|
|
@@ -5654,26 +5675,26 @@ async function Gr(e, t, n, r) {
|
|
|
5654
5675
|
let s = n.filter((e) => !e.isLink), c = n.filter((e) => e.isLink);
|
|
5655
5676
|
if (s.length === 0) try {
|
|
5656
5677
|
let t = await o().upload(r, "editor"), n = !1;
|
|
5657
|
-
for (let r of c)
|
|
5678
|
+
for (let r of c) Gr(e, r.src, t) && (n = !0);
|
|
5658
5679
|
return n ? "uploaded" : "sessionOnly";
|
|
5659
5680
|
} catch (e) {
|
|
5660
5681
|
return console.error(`本地附件 ${i.basename} 上传失败:`, e), Z(`「${i.basename}」上传失败`, "error"), "sessionOnly";
|
|
5661
5682
|
}
|
|
5662
5683
|
let l = URL.createObjectURL(r), u = !1;
|
|
5663
|
-
for (let t of s)
|
|
5684
|
+
for (let t of s) Wr(e, t.src, l, r.size) && (u = !0);
|
|
5664
5685
|
let d;
|
|
5665
5686
|
try {
|
|
5666
5687
|
d = await o().upload(r, "editor");
|
|
5667
5688
|
} catch (e) {
|
|
5668
5689
|
return console.error(`本地文件 ${i.basename} 上传失败:`, e), Z(`「${i.basename}」上传失败`, "error"), URL.revokeObjectURL(l), "sessionOnly";
|
|
5669
5690
|
}
|
|
5670
|
-
URL.revokeObjectURL(l), u &&
|
|
5671
|
-
for (let t of c)
|
|
5672
|
-
return !u && c.length === 0 ? "sessionOnly" : u && n.some((e) => e.kind === "image") ? await
|
|
5691
|
+
URL.revokeObjectURL(l), u && Wr(e, l, d, r.size);
|
|
5692
|
+
for (let t of c) Gr(e, t.src, d);
|
|
5693
|
+
return !u && c.length === 0 ? "sessionOnly" : u && n.some((e) => e.kind === "image") ? await Vr(d) ? "uploaded" : "renderFailed" : "uploaded";
|
|
5673
5694
|
}
|
|
5674
|
-
function
|
|
5695
|
+
function Jr(e, t) {
|
|
5675
5696
|
let n = [], r = [];
|
|
5676
|
-
for (let i of
|
|
5697
|
+
for (let i of Kr(e)) {
|
|
5677
5698
|
let e = i[0], a = t.get(e.basename);
|
|
5678
5699
|
a ? (n.push({
|
|
5679
5700
|
refs: i,
|
|
@@ -5685,30 +5706,30 @@ function Kr(e, t) {
|
|
|
5685
5706
|
unmatched: r
|
|
5686
5707
|
};
|
|
5687
5708
|
}
|
|
5688
|
-
async function
|
|
5689
|
-
let i =
|
|
5690
|
-
for (let a of
|
|
5709
|
+
async function Yr(e, t, n, r) {
|
|
5710
|
+
let i = Hr();
|
|
5711
|
+
for (let a of Kr(n)) {
|
|
5691
5712
|
let n = a[0], { file: o, readError: s } = await yr(r, n.src);
|
|
5692
5713
|
if (!o) {
|
|
5693
5714
|
s ? (console.warn(`本地文件「${n.basename}」在所选文件夹中找到但读取失败:`, s), i.readFailed.push(n)) : (console.warn(`本地文件「${n.basename}」未在所选文件夹「${r.name}」中找到`), i.missing.push(n));
|
|
5694
5715
|
continue;
|
|
5695
5716
|
}
|
|
5696
|
-
let c = await
|
|
5717
|
+
let c = await qr(e, t, a, o);
|
|
5697
5718
|
i[c]++;
|
|
5698
5719
|
}
|
|
5699
5720
|
return i;
|
|
5700
5721
|
}
|
|
5701
|
-
function
|
|
5722
|
+
function Xr(e) {
|
|
5702
5723
|
let t = e.map((e) => e.basename);
|
|
5703
5724
|
return t.length <= 3 ? t.join("、") : `${t.slice(0, 3).join("、")} 等 ${t.length} 个文件`;
|
|
5704
5725
|
}
|
|
5705
|
-
function
|
|
5726
|
+
function Zr(e) {
|
|
5706
5727
|
let t = [];
|
|
5707
|
-
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} 个找到但读取失败:${
|
|
5728
|
+
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} 个找到但读取失败:${Xr(e.readFailed)}(若在 OneDrive / WPS 云盘等同步目录,请右键文件选择「始终保留在此设备」后重试)`), e.missing.length > 0 && t.push(`${e.missing.length} 个未能获取:${Xr(e.missing)}(可把文件直接拖进编辑器上传)`), t.length === 0) return;
|
|
5708
5729
|
let n = e.uploaded > 0 && e.renderFailed === 0 && e.missing.length === 0 && e.readFailed.length === 0;
|
|
5709
5730
|
Z(`本地文件解析完成:${t.join(";")}`, n ? "success" : "info");
|
|
5710
5731
|
}
|
|
5711
|
-
function
|
|
5732
|
+
function Qr(e) {
|
|
5712
5733
|
return new Promise((t) => {
|
|
5713
5734
|
let n = document.createElement("div");
|
|
5714
5735
|
n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
|
|
@@ -5735,7 +5756,7 @@ function Xr(e) {
|
|
|
5735
5756
|
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);
|
|
5736
5757
|
});
|
|
5737
5758
|
}
|
|
5738
|
-
function
|
|
5759
|
+
function $r(e) {
|
|
5739
5760
|
let t = document.createElement("div");
|
|
5740
5761
|
t.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
|
|
5741
5762
|
let n = document.createElement("div");
|
|
@@ -5757,7 +5778,7 @@ function Zr(e) {
|
|
|
5757
5778
|
let c = document.createElement("button");
|
|
5758
5779
|
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);
|
|
5759
5780
|
}
|
|
5760
|
-
function
|
|
5781
|
+
function ei(e) {
|
|
5761
5782
|
return new Promise((t) => {
|
|
5762
5783
|
let n = document.createElement("div");
|
|
5763
5784
|
n.className = "fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none";
|
|
@@ -5783,8 +5804,8 @@ function Qr(e) {
|
|
|
5783
5804
|
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);
|
|
5784
5805
|
});
|
|
5785
5806
|
}
|
|
5786
|
-
async function
|
|
5787
|
-
let r =
|
|
5807
|
+
async function ti(e, t, n) {
|
|
5808
|
+
let r = Hr(), i = Kr(n), a = await gr();
|
|
5788
5809
|
if (!a) {
|
|
5789
5810
|
for (let e of i) r.missing.push(e[0]);
|
|
5790
5811
|
return r;
|
|
@@ -5797,14 +5818,14 @@ async function $r(e, t, n) {
|
|
|
5797
5818
|
continue;
|
|
5798
5819
|
}
|
|
5799
5820
|
o.delete(i.basename);
|
|
5800
|
-
let s = await
|
|
5821
|
+
let s = await qr(e, t, n, a);
|
|
5801
5822
|
r[s]++;
|
|
5802
5823
|
}
|
|
5803
5824
|
return r;
|
|
5804
5825
|
}
|
|
5805
5826
|
//#endregion
|
|
5806
5827
|
//#region src/editor/extensions/relative-media.ts
|
|
5807
|
-
var
|
|
5828
|
+
var ni = R.create({
|
|
5808
5829
|
name: "relativeMedia",
|
|
5809
5830
|
addStorage() {
|
|
5810
5831
|
return {
|
|
@@ -5814,26 +5835,26 @@ var ei = R.create({
|
|
|
5814
5835
|
},
|
|
5815
5836
|
addProseMirrorPlugins() {
|
|
5816
5837
|
let e = this.editor, t = this.storage, n = !1, r = null, i = async (n, i) => {
|
|
5817
|
-
let a = e.view, o =
|
|
5838
|
+
let a = e.view, o = Hr(), { matched: s, unmatched: c } = Jr(n, t.clipboardFiles);
|
|
5818
5839
|
for (let { refs: t, file: n } of s) {
|
|
5819
|
-
let r = await
|
|
5840
|
+
let r = await qr(a, e, t, n);
|
|
5820
5841
|
o[r]++;
|
|
5821
5842
|
}
|
|
5822
5843
|
if (c.length > 0) {
|
|
5823
|
-
let t =
|
|
5844
|
+
let t = Kr(c).length;
|
|
5824
5845
|
if (pr()) {
|
|
5825
5846
|
let n = i ?? null;
|
|
5826
|
-
if (n || (await
|
|
5827
|
-
r = n,
|
|
5847
|
+
if (n || (await Qr(t) === "pick" ? (n = await mr(), n || Z("没有选择文件夹。本地文件暂以占位显示,稍后可直接把文件拖进编辑器上传", "info")) : Z("已选择稍后处理。本地文件暂以占位显示,可直接把文件拖进编辑器上传", "info")), n) {
|
|
5848
|
+
r = n, Ur(o, await Yr(a, e, c, n));
|
|
5828
5849
|
let t = [...o.missing, ...o.readFailed];
|
|
5829
|
-
if (t.length > 0 && hr() && await
|
|
5830
|
-
let n = await
|
|
5831
|
-
|
|
5850
|
+
if (t.length > 0 && hr() && await ei(t.map((e) => e.basename)) === "pick") {
|
|
5851
|
+
let n = await ti(a, e, t);
|
|
5852
|
+
Ur(o, n), o.missing = n.missing, o.readFailed = [];
|
|
5832
5853
|
}
|
|
5833
5854
|
}
|
|
5834
|
-
} else
|
|
5855
|
+
} else $r(t);
|
|
5835
5856
|
}
|
|
5836
|
-
|
|
5857
|
+
Zr(o);
|
|
5837
5858
|
}, o = () => {
|
|
5838
5859
|
if (!e || e.isDestroyed || t.pausedUntilPaste) return;
|
|
5839
5860
|
let o = a(), s = xr(e.state.doc, o);
|
|
@@ -5859,18 +5880,18 @@ var ei = R.create({
|
|
|
5859
5880
|
}
|
|
5860
5881
|
})];
|
|
5861
5882
|
}
|
|
5862
|
-
}),
|
|
5863
|
-
function
|
|
5883
|
+
}), ri = new B("slashCommand");
|
|
5884
|
+
function ii(e) {
|
|
5864
5885
|
return R.create({
|
|
5865
5886
|
name: "slashCommand",
|
|
5866
5887
|
addProseMirrorPlugins() {
|
|
5867
5888
|
let t = {
|
|
5868
5889
|
char: "/",
|
|
5869
|
-
pluginKey:
|
|
5890
|
+
pluginKey: ri,
|
|
5870
5891
|
findSuggestionMatch: (e) => {
|
|
5871
5892
|
let { $position: t } = e;
|
|
5872
5893
|
for (let e = t.depth; e >= 0; e--) if (t.node(e).type.name === "codeBlock") return null;
|
|
5873
|
-
return t.marks().some((e) => e.type.name === "code") ? null :
|
|
5894
|
+
return t.marks().some((e) => e.type.name === "code") ? null : we(e);
|
|
5874
5895
|
},
|
|
5875
5896
|
allow: ({ editor: e, state: t }) => {
|
|
5876
5897
|
if (!e.isEditable) return !1;
|
|
@@ -5952,7 +5973,7 @@ function ni(e) {
|
|
|
5952
5973
|
if (e.key === "Escape") {
|
|
5953
5974
|
e.preventDefault();
|
|
5954
5975
|
let t = a?.view;
|
|
5955
|
-
t &&
|
|
5976
|
+
t && Ce(t, ri);
|
|
5956
5977
|
}
|
|
5957
5978
|
});
|
|
5958
5979
|
}
|
|
@@ -5970,7 +5991,7 @@ function ni(e) {
|
|
|
5970
5991
|
if (!e || e.style.display === "none" || n.target instanceof Node && e.contains(n.target) || t) return;
|
|
5971
5992
|
let r = a?.view;
|
|
5972
5993
|
r && (t = !0, window.setTimeout(() => {
|
|
5973
|
-
t = !1, e?.style.display !== "none" &&
|
|
5994
|
+
t = !1, e?.style.display !== "none" && Ce(r, ri);
|
|
5974
5995
|
}, 0));
|
|
5975
5996
|
}, document.addEventListener("mousedown", o, !0), document.addEventListener("touchstart", o, !0);
|
|
5976
5997
|
}
|
|
@@ -5994,7 +6015,7 @@ function ni(e) {
|
|
|
5994
6015
|
};
|
|
5995
6016
|
}
|
|
5996
6017
|
};
|
|
5997
|
-
return [
|
|
6018
|
+
return [Se({
|
|
5998
6019
|
editor: this.editor,
|
|
5999
6020
|
...t
|
|
6000
6021
|
}), new z({
|
|
@@ -6006,14 +6027,14 @@ function ni(e) {
|
|
|
6006
6027
|
break;
|
|
6007
6028
|
}
|
|
6008
6029
|
if (!i && !r.marks().some((e) => e.type.name === "code")) return null;
|
|
6009
|
-
let a =
|
|
6010
|
-
return a && a.active ? n.tr.setMeta(
|
|
6030
|
+
let a = ri.getState(n);
|
|
6031
|
+
return a && a.active ? n.tr.setMeta(ri, { exit: !0 }) : null;
|
|
6011
6032
|
}
|
|
6012
6033
|
})];
|
|
6013
6034
|
}
|
|
6014
6035
|
});
|
|
6015
6036
|
}
|
|
6016
|
-
function
|
|
6037
|
+
function ai(e, t) {
|
|
6017
6038
|
return [
|
|
6018
6039
|
{
|
|
6019
6040
|
title: e("editor.slash.heading1"),
|
|
@@ -6162,7 +6183,7 @@ function ri(e, t) {
|
|
|
6162
6183
|
}
|
|
6163
6184
|
//#endregion
|
|
6164
6185
|
//#region src/editor/extensions/index.ts
|
|
6165
|
-
var
|
|
6186
|
+
var oi = oe.extend({
|
|
6166
6187
|
addNodeView() {
|
|
6167
6188
|
return I(xn);
|
|
6168
6189
|
},
|
|
@@ -6187,7 +6208,7 @@ var ii = oe.extend({
|
|
|
6187
6208
|
};
|
|
6188
6209
|
}
|
|
6189
6210
|
});
|
|
6190
|
-
function
|
|
6211
|
+
function si(e = {}) {
|
|
6191
6212
|
return [
|
|
6192
6213
|
G.configure({
|
|
6193
6214
|
codeBlock: !1,
|
|
@@ -6203,29 +6224,29 @@ function ai(e = {}) {
|
|
|
6203
6224
|
target: "_blank"
|
|
6204
6225
|
}
|
|
6205
6226
|
}),
|
|
6206
|
-
|
|
6227
|
+
oi.configure({
|
|
6207
6228
|
inline: !1,
|
|
6208
6229
|
allowBase64: !0
|
|
6209
6230
|
}),
|
|
6210
|
-
me,
|
|
6211
|
-
pe.configure({ nested: !0 }),
|
|
6212
|
-
se.configure({ multicolor: !0 }),
|
|
6213
6231
|
he,
|
|
6232
|
+
me.configure({ nested: !0 }),
|
|
6233
|
+
se.configure({ multicolor: !0 }),
|
|
6234
|
+
ge,
|
|
6214
6235
|
q,
|
|
6215
6236
|
K.configure(e.maxLength ? { limit: e.maxLength } : {}),
|
|
6216
6237
|
ce,
|
|
6217
6238
|
ar,
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
ue,
|
|
6239
|
+
ue.configure({ resizable: !0 }),
|
|
6240
|
+
pe,
|
|
6221
6241
|
de,
|
|
6222
|
-
|
|
6242
|
+
fe,
|
|
6243
|
+
_e.configure({
|
|
6223
6244
|
html: !0,
|
|
6224
6245
|
transformPastedText: !0,
|
|
6225
6246
|
transformCopiedText: !1
|
|
6226
6247
|
}),
|
|
6227
|
-
|
|
6228
|
-
|
|
6248
|
+
le.configure({ placeholder: e.placeholder || "输入 '/' 打开菜单…" }),
|
|
6249
|
+
ii(() => ai((e) => f(e), {
|
|
6229
6250
|
maxAttachmentSize: e.maxAttachmentSize,
|
|
6230
6251
|
maxTotalAttachmentSize: e.maxTotalAttachmentSize
|
|
6231
6252
|
})),
|
|
@@ -6233,10 +6254,11 @@ function ai(e = {}) {
|
|
|
6233
6254
|
maxAttachmentSize: e.maxAttachmentSize,
|
|
6234
6255
|
maxTotalAttachmentSize: e.maxTotalAttachmentSize
|
|
6235
6256
|
}),
|
|
6236
|
-
|
|
6237
|
-
|
|
6257
|
+
ni,
|
|
6258
|
+
Rr,
|
|
6238
6259
|
Et,
|
|
6239
|
-
|
|
6260
|
+
jr,
|
|
6261
|
+
zr,
|
|
6240
6262
|
Kn,
|
|
6241
6263
|
zn,
|
|
6242
6264
|
In
|
|
@@ -6244,14 +6266,14 @@ function ai(e = {}) {
|
|
|
6244
6266
|
}
|
|
6245
6267
|
//#endregion
|
|
6246
6268
|
//#region src/editor/extensions/bubble-menu.tsx
|
|
6247
|
-
var
|
|
6248
|
-
function
|
|
6249
|
-
|
|
6269
|
+
var ci = "https://www.bing.com/search?q={query}";
|
|
6270
|
+
function li(e) {
|
|
6271
|
+
ci = e;
|
|
6250
6272
|
}
|
|
6251
|
-
function
|
|
6252
|
-
return
|
|
6273
|
+
function ui() {
|
|
6274
|
+
return ci;
|
|
6253
6275
|
}
|
|
6254
|
-
function
|
|
6276
|
+
function di(e) {
|
|
6255
6277
|
return [
|
|
6256
6278
|
{
|
|
6257
6279
|
key: "bold",
|
|
@@ -6325,7 +6347,7 @@ function li(e) {
|
|
|
6325
6347
|
if (e.isActive("table")) return;
|
|
6326
6348
|
let { from: t, to: n } = e.state.selection, r = e.state.doc.textBetween(t, n, " ").trim();
|
|
6327
6349
|
if (!r) return;
|
|
6328
|
-
let i =
|
|
6350
|
+
let i = ci.replace("{query}", encodeURIComponent(r));
|
|
6329
6351
|
window.open(i, "_blank", "noopener,noreferrer");
|
|
6330
6352
|
}
|
|
6331
6353
|
},
|
|
@@ -6359,7 +6381,7 @@ function li(e) {
|
|
|
6359
6381
|
R.create({ name: "bubbleMenu" });
|
|
6360
6382
|
//#endregion
|
|
6361
6383
|
//#region src/editor/extensions/table-toolbar.tsx
|
|
6362
|
-
function
|
|
6384
|
+
function fi(e) {
|
|
6363
6385
|
let { $from: t } = e.state.selection;
|
|
6364
6386
|
for (let e = t.depth; e > 0; e--) {
|
|
6365
6387
|
let n = t.node(e);
|
|
@@ -6370,7 +6392,7 @@ function ui(e) {
|
|
|
6370
6392
|
}
|
|
6371
6393
|
return null;
|
|
6372
6394
|
}
|
|
6373
|
-
function
|
|
6395
|
+
function pi(e) {
|
|
6374
6396
|
let t = [];
|
|
6375
6397
|
return e.forEach((e) => {
|
|
6376
6398
|
let n = [];
|
|
@@ -6379,7 +6401,7 @@ function di(e) {
|
|
|
6379
6401
|
}), t.push(n);
|
|
6380
6402
|
}), t;
|
|
6381
6403
|
}
|
|
6382
|
-
function
|
|
6404
|
+
function mi(e) {
|
|
6383
6405
|
if (e.length === 0) return "";
|
|
6384
6406
|
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(" | ")} |`;
|
|
6385
6407
|
return [
|
|
@@ -6388,11 +6410,11 @@ function fi(e) {
|
|
|
6388
6410
|
...i.map(a)
|
|
6389
6411
|
].join("\n");
|
|
6390
6412
|
}
|
|
6391
|
-
function
|
|
6413
|
+
function hi(e) {
|
|
6392
6414
|
let t = (e) => /[",\n]/.test(e) ? `"${e.replace(/"/g, "\"\"")}"` : e;
|
|
6393
6415
|
return e.map((e) => e.map(t).join(",")).join("\n");
|
|
6394
6416
|
}
|
|
6395
|
-
function
|
|
6417
|
+
function gi(e) {
|
|
6396
6418
|
let t = e.trim();
|
|
6397
6419
|
if (!t) return null;
|
|
6398
6420
|
let n = t.split(/\r?\n/);
|
|
@@ -6406,7 +6428,7 @@ function mi(e) {
|
|
|
6406
6428
|
}
|
|
6407
6429
|
return null;
|
|
6408
6430
|
}
|
|
6409
|
-
function
|
|
6431
|
+
function _i({ editor: e }) {
|
|
6410
6432
|
let [t, n] = T(null), [r, i] = T(!1), [a, o] = T(!1), s = w(null), c = w(null), l = e.isEditable, u = b(() => {
|
|
6411
6433
|
c.current != null && cancelAnimationFrame(c.current), c.current = requestAnimationFrame(() => {
|
|
6412
6434
|
c.current = null;
|
|
@@ -6422,7 +6444,7 @@ function hi({ editor: e }) {
|
|
|
6422
6444
|
n(null);
|
|
6423
6445
|
return;
|
|
6424
6446
|
}
|
|
6425
|
-
let t =
|
|
6447
|
+
let t = fi(e);
|
|
6426
6448
|
if (!t) {
|
|
6427
6449
|
n(null);
|
|
6428
6450
|
return;
|
|
@@ -6451,24 +6473,24 @@ function hi({ editor: e }) {
|
|
|
6451
6473
|
});
|
|
6452
6474
|
return n.nodes.table.create(null, i);
|
|
6453
6475
|
}, p = () => {
|
|
6454
|
-
let t =
|
|
6476
|
+
let t = fi(e);
|
|
6455
6477
|
if (!t) return;
|
|
6456
|
-
let n =
|
|
6478
|
+
let n = mi(pi(t.node));
|
|
6457
6479
|
navigator.clipboard?.writeText(n), i(!0), setTimeout(() => i(!1), 1500);
|
|
6458
6480
|
}, m = () => {
|
|
6459
|
-
let t =
|
|
6481
|
+
let t = fi(e);
|
|
6460
6482
|
if (!t) return;
|
|
6461
|
-
let n = pi(
|
|
6483
|
+
let n = hi(pi(t.node)), r = new Blob([`\ufeff${n}`], { type: "text/csv;charset=utf-8" }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
6462
6484
|
a.href = i, a.download = "table.csv", document.body.appendChild(a), a.click(), document.body.removeChild(a), URL.revokeObjectURL(i);
|
|
6463
6485
|
}, h = async () => {
|
|
6464
6486
|
if (l) try {
|
|
6465
6487
|
let t = await navigator.clipboard?.readText();
|
|
6466
6488
|
if (!t) return;
|
|
6467
|
-
let n =
|
|
6489
|
+
let n = gi(t);
|
|
6468
6490
|
if (!n || n.length === 0) return;
|
|
6469
6491
|
let r = f(n);
|
|
6470
6492
|
if (!r) return;
|
|
6471
|
-
let i =
|
|
6493
|
+
let i = fi(e), a = e.chain().focus();
|
|
6472
6494
|
if (i) {
|
|
6473
6495
|
let t = Math.min(i.pos + i.node.nodeSize, e.state.doc.content.size);
|
|
6474
6496
|
a.setTextSelection(t);
|
|
@@ -6622,7 +6644,7 @@ function hi({ editor: e }) {
|
|
|
6622
6644
|
}
|
|
6623
6645
|
//#endregion
|
|
6624
6646
|
//#region src/editor/ai-editor.tsx
|
|
6625
|
-
var
|
|
6647
|
+
var vi = [
|
|
6626
6648
|
{
|
|
6627
6649
|
color: "#fef08a",
|
|
6628
6650
|
name: "黄"
|
|
@@ -6647,9 +6669,9 @@ var gi = [
|
|
|
6647
6669
|
color: "#ddd6fe",
|
|
6648
6670
|
name: "紫"
|
|
6649
6671
|
}
|
|
6650
|
-
],
|
|
6651
|
-
function
|
|
6652
|
-
let r = window.innerWidth, i = window.innerHeight, a = Math.min(n.panelWidth ||
|
|
6672
|
+
], yi = 288, bi = 480, xi = 320;
|
|
6673
|
+
function Si(e, t, n = {}) {
|
|
6674
|
+
let r = window.innerWidth, i = window.innerHeight, a = Math.min(n.panelWidth || yi, bi, r - 32), o = Math.max(t || xi, 160);
|
|
6653
6675
|
if (r < 640) {
|
|
6654
6676
|
let t = Math.max(8, Math.min(e.top + 10, i - 420));
|
|
6655
6677
|
return {
|
|
@@ -6690,10 +6712,10 @@ function bi(e, t, n = {}) {
|
|
|
6690
6712
|
arrowLeft: p
|
|
6691
6713
|
};
|
|
6692
6714
|
}
|
|
6693
|
-
function
|
|
6715
|
+
function Ci(e) {
|
|
6694
6716
|
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*\|.+\|/i.test(e);
|
|
6695
6717
|
}
|
|
6696
|
-
function
|
|
6718
|
+
function wi(e, t) {
|
|
6697
6719
|
try {
|
|
6698
6720
|
let n = e.storage?.markdown?.parser;
|
|
6699
6721
|
if (!n) return null;
|
|
@@ -6703,20 +6725,20 @@ function Si(e, t) {
|
|
|
6703
6725
|
return null;
|
|
6704
6726
|
}
|
|
6705
6727
|
}
|
|
6706
|
-
var
|
|
6728
|
+
var Ti = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.ImageUploadDialog }))), Ei = y(() => import("./storage-settings-dialog-DZqqDAiO.js").then((e) => ({ default: e.StorageSettingsDialog }))), Di = y(() => import("./export-dialog-CL7ie13Z.js").then((e) => ({ default: e.ExportDialog }))), Oi = y(() => import("./video-embed-dialog-AeGcMb4X.js").then((e) => ({ default: e.VideoEmbedDialog }))), ki = y(() => import("./md-import-dialog-Cf3ZOwA_.js").then((e) => ({ default: e.MdImportDialog }))), Ai = () => /* @__PURE__ */ O("div", {
|
|
6707
6729
|
className: "fixed inset-0 z-[9999] flex items-center justify-center",
|
|
6708
6730
|
children: [/* @__PURE__ */ D("div", { className: "absolute inset-0 bg-black/40 backdrop-blur-sm" }), /* @__PURE__ */ D("div", {
|
|
6709
6731
|
className: "relative bg-background rounded-2xl border border-default-200 p-8 flex items-center justify-center",
|
|
6710
6732
|
children: /* @__PURE__ */ D("div", { className: "w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin" })
|
|
6711
6733
|
})]
|
|
6712
|
-
}),
|
|
6713
|
-
let k = r === "view" || i, A = C(() => typeof e == "object" && e ||
|
|
6734
|
+
}), ji = ({ 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 }) => {
|
|
6735
|
+
let k = r === "view" || i, A = C(() => typeof e == "object" && e || Ci(e) ? e : d(e), [e]), [j, M] = T(!1), [F, I] = T({}), [L, R] = T("below"), [re, ie] = T(50), z = w(null), [B, V] = T(!1), [H, ae] = T(!1), [oe, U] = T(!1), [W, G] = T(!1), [K, q] = T("none"), [se, ce] = T({}), [le, ue] = T(""), [de, fe] = T(null), [pe, me] = T(m), [he, ge] = T(!1);
|
|
6714
6736
|
x(() => {
|
|
6715
|
-
|
|
6737
|
+
me(m);
|
|
6716
6738
|
}, [m]);
|
|
6717
|
-
let [
|
|
6718
|
-
let e =
|
|
6719
|
-
e && (
|
|
6739
|
+
let [_e, ve] = T(!1), [ye, be] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 80rem)").matches : !0), [xe, Se] = T(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(min-width: 64rem)").matches : !0), Ce = w(null), we = w(null), Te = w(null), Ee = w(0), De = w(null), Oe = w(null), ke = w(null), Ae = w(null), [je, Me] = T(!1), [J, Ne] = T(!1), [Y, Pe] = T(!1), Fe = w(null), Ie = b(() => {
|
|
6740
|
+
let e = we.current, t = Te.current;
|
|
6741
|
+
e && (J ? (document.body.style.overflow = "", Object.assign(e.style, {
|
|
6720
6742
|
position: "",
|
|
6721
6743
|
top: "",
|
|
6722
6744
|
left: "",
|
|
@@ -6732,9 +6754,9 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6732
6754
|
flex: "",
|
|
6733
6755
|
overflow: "",
|
|
6734
6756
|
minHeight: ""
|
|
6735
|
-
}),
|
|
6736
|
-
window.scrollTo(0,
|
|
6737
|
-
})) : (document.fullscreenElement && document.exitFullscreen(),
|
|
6757
|
+
}), Ne(!1), requestAnimationFrame(() => {
|
|
6758
|
+
window.scrollTo(0, Ee.current);
|
|
6759
|
+
})) : (document.fullscreenElement && document.exitFullscreen(), Ee.current = window.scrollY, Object.assign(e.style, {
|
|
6738
6760
|
position: "fixed",
|
|
6739
6761
|
top: "0",
|
|
6740
6762
|
left: "0",
|
|
@@ -6750,42 +6772,42 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6750
6772
|
flex: "1",
|
|
6751
6773
|
overflow: "auto",
|
|
6752
6774
|
minHeight: "0"
|
|
6753
|
-
}), document.body.style.overflow = "hidden",
|
|
6754
|
-
}, [
|
|
6755
|
-
let e =
|
|
6756
|
-
e && (document.fullscreenElement ? document.exitFullscreen() : (
|
|
6757
|
-
}, [
|
|
6775
|
+
}), document.body.style.overflow = "hidden", Ne(!0)));
|
|
6776
|
+
}, [J]), Le = b(() => {
|
|
6777
|
+
let e = we.current;
|
|
6778
|
+
e && (document.fullscreenElement ? document.exitFullscreen() : (J && Ie(), Ee.current = window.scrollY, e.requestFullscreen()));
|
|
6779
|
+
}, [J, Ie]);
|
|
6758
6780
|
x(() => {
|
|
6759
6781
|
let e = (e) => {
|
|
6760
|
-
e.key === "Escape" &&
|
|
6782
|
+
e.key === "Escape" && J && Ie();
|
|
6761
6783
|
}, t = () => {
|
|
6762
|
-
document.fullscreenElement ?
|
|
6763
|
-
window.scrollTo(0,
|
|
6784
|
+
document.fullscreenElement ? Pe(!0) : (Pe(!1), requestAnimationFrame(() => {
|
|
6785
|
+
window.scrollTo(0, Ee.current);
|
|
6764
6786
|
}));
|
|
6765
6787
|
};
|
|
6766
6788
|
return window.addEventListener("keydown", e), document.addEventListener("fullscreenchange", t), () => {
|
|
6767
6789
|
window.removeEventListener("keydown", e), document.removeEventListener("fullscreenchange", t);
|
|
6768
6790
|
};
|
|
6769
|
-
}, [
|
|
6791
|
+
}, [J, Ie]), x(() => {
|
|
6770
6792
|
if (!h) return;
|
|
6771
6793
|
let e = (e) => {
|
|
6772
6794
|
if ((e.ctrlKey || e.metaKey) && (e.key === "f" || e.key === "F")) {
|
|
6773
|
-
if (!
|
|
6774
|
-
e.preventDefault(), e.stopPropagation(),
|
|
6795
|
+
if (!we.current) return;
|
|
6796
|
+
e.preventDefault(), e.stopPropagation(), ve(!0);
|
|
6775
6797
|
}
|
|
6776
6798
|
};
|
|
6777
6799
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
6778
6800
|
}, [h]), x(() => {
|
|
6779
6801
|
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
6780
|
-
let e = window.matchMedia("(min-width: 80rem)"), t = (e) =>
|
|
6781
|
-
return
|
|
6802
|
+
let e = window.matchMedia("(min-width: 80rem)"), t = (e) => be(e.matches);
|
|
6803
|
+
return be(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
6782
6804
|
}, []), x(() => {
|
|
6783
6805
|
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
6784
|
-
let e = window.matchMedia("(min-width: 64rem)"), t = (e) =>
|
|
6785
|
-
return
|
|
6806
|
+
let e = window.matchMedia("(min-width: 64rem)"), t = (e) => Se(e.matches);
|
|
6807
|
+
return Se(e.matches), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
6786
6808
|
}, []);
|
|
6787
6809
|
let X = ee({
|
|
6788
|
-
extensions:
|
|
6810
|
+
extensions: si({
|
|
6789
6811
|
placeholder: n || f("editor.placeholder"),
|
|
6790
6812
|
maxLength: a,
|
|
6791
6813
|
maxAttachmentSize: o,
|
|
@@ -6795,7 +6817,7 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6795
6817
|
editable: !k,
|
|
6796
6818
|
immediatelyRender: _,
|
|
6797
6819
|
onUpdate: ({ editor: e }) => {
|
|
6798
|
-
t && (
|
|
6820
|
+
t && (Ce.current && clearTimeout(Ce.current), Ce.current = setTimeout(() => {
|
|
6799
6821
|
t?.(e.getHTML(), e.getJSON());
|
|
6800
6822
|
}, 300));
|
|
6801
6823
|
},
|
|
@@ -6811,9 +6833,9 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6811
6833
|
let r = n.getData("text/plain");
|
|
6812
6834
|
if (!r || !r.includes("[[")) return !1;
|
|
6813
6835
|
t.preventDefault();
|
|
6814
|
-
let i =
|
|
6836
|
+
let i = Oe.current?.storage?.relativeMedia;
|
|
6815
6837
|
i && (i.clipboardFiles = new Map(Array.from(n.files ?? []).map((e) => [e.name.toLowerCase(), e])), i.pausedUntilPaste = !1);
|
|
6816
|
-
let a =
|
|
6838
|
+
let a = Oe.current ? wi(Oe.current, r) : null;
|
|
6817
6839
|
if (a) {
|
|
6818
6840
|
let t = new N(a, 0, 0);
|
|
6819
6841
|
e.dispatch(e.state.tr.replaceSelection(t).scrollIntoView());
|
|
@@ -6823,7 +6845,7 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6823
6845
|
}
|
|
6824
6846
|
});
|
|
6825
6847
|
x(() => {
|
|
6826
|
-
|
|
6848
|
+
Oe.current = X, window.__editor = X;
|
|
6827
6849
|
}, [X]), x(() => {
|
|
6828
6850
|
if (X) return () => Yt(X);
|
|
6829
6851
|
}, [X]), x(() => {
|
|
@@ -6831,13 +6853,13 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6831
6853
|
}, [X, g]), x(() => {
|
|
6832
6854
|
if (!X) return;
|
|
6833
6855
|
let e = () => {
|
|
6834
|
-
X.state.selection.empty && (q("none"),
|
|
6856
|
+
X.state.selection.empty && (q("none"), Me(!1));
|
|
6835
6857
|
};
|
|
6836
6858
|
return X.on("selectionUpdate", e), () => {
|
|
6837
6859
|
X.off("selectionUpdate", e);
|
|
6838
6860
|
};
|
|
6839
6861
|
}, [X]), x(() => {
|
|
6840
|
-
X && X.setOptions({ extensions:
|
|
6862
|
+
X && X.setOptions({ extensions: si({
|
|
6841
6863
|
placeholder: n || f("editor.placeholder"),
|
|
6842
6864
|
maxLength: a,
|
|
6843
6865
|
maxAttachmentSize: o,
|
|
@@ -6849,11 +6871,11 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6849
6871
|
o,
|
|
6850
6872
|
s
|
|
6851
6873
|
]);
|
|
6852
|
-
let
|
|
6874
|
+
let Re = w(e);
|
|
6853
6875
|
x(() => {
|
|
6854
|
-
if (!X || e ===
|
|
6855
|
-
|
|
6856
|
-
let t = typeof e == "object" && e ||
|
|
6876
|
+
if (!X || e === Re.current) return;
|
|
6877
|
+
Re.current = e;
|
|
6878
|
+
let t = typeof e == "object" && e || Ci(e) ? e : d(e);
|
|
6857
6879
|
X.commands.setContent(t, { emitUpdate: !1 });
|
|
6858
6880
|
}, [X, e]), x(() => {
|
|
6859
6881
|
X && X.setEditable(!k, !1);
|
|
@@ -6875,53 +6897,53 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6875
6897
|
o,
|
|
6876
6898
|
s
|
|
6877
6899
|
]);
|
|
6878
|
-
let
|
|
6879
|
-
let t =
|
|
6880
|
-
q(e),
|
|
6900
|
+
let ze = b((e) => {
|
|
6901
|
+
let t = Ae.current?.getBoundingClientRect();
|
|
6902
|
+
q(e), Me(!1), ce({
|
|
6881
6903
|
position: "fixed",
|
|
6882
6904
|
top: t ? t.bottom + 8 : void 0,
|
|
6883
6905
|
left: t ? Math.max(8, Math.min(t.left, window.innerWidth - 240)) : 8,
|
|
6884
6906
|
zIndex: 9999
|
|
6885
6907
|
});
|
|
6886
|
-
}, []),
|
|
6887
|
-
if (X) if (
|
|
6908
|
+
}, []), Be = di((e) => f(e)), Ve = Be.filter((e) => !e.more), He = Be.filter((e) => e.more), Ue = Ve.filter((e) => e.key !== "ai"), We = Ve.find((e) => e.key === "ai"), Ge = b((e) => {
|
|
6909
|
+
if (X) if (Me(!1), e.key === "link") if (X.isActive("link")) X.chain().focus().unsetLink().run();
|
|
6888
6910
|
else {
|
|
6889
6911
|
let e = X.getAttributes("link").href || "";
|
|
6890
|
-
|
|
6912
|
+
ue(e), ze("link");
|
|
6891
6913
|
}
|
|
6892
|
-
else e.key === "highlight" ? K === "highlight" ? q("none") :
|
|
6914
|
+
else e.key === "highlight" ? K === "highlight" ? q("none") : ze("highlight") : e.command(X);
|
|
6893
6915
|
}, [
|
|
6894
6916
|
X,
|
|
6895
6917
|
K,
|
|
6896
|
-
|
|
6897
|
-
]),
|
|
6918
|
+
ze
|
|
6919
|
+
]), Ke = b((e) => X ? e.key === "highlight" ? K === "highlight" : e.key === "link" ? X.isActive("link") : e.isActive(X) : !1, [X, K]), [qe, Je] = T(0);
|
|
6898
6920
|
x(() => {
|
|
6899
6921
|
if (!X) return;
|
|
6900
|
-
let e = () =>
|
|
6922
|
+
let e = () => Je((e) => (e + 1) % 1e6);
|
|
6901
6923
|
return X.on("update", e), () => {
|
|
6902
6924
|
X.off("update", e);
|
|
6903
6925
|
};
|
|
6904
6926
|
}, [X]);
|
|
6905
|
-
let [
|
|
6927
|
+
let [Ye, Xe] = T(!1);
|
|
6906
6928
|
x(() => {
|
|
6907
6929
|
if (!X) return;
|
|
6908
6930
|
let e = () => {
|
|
6909
6931
|
let e = !1;
|
|
6910
6932
|
X.state.doc.descendants((t) => {
|
|
6911
6933
|
t.type.name === "heading" && (e = !0);
|
|
6912
|
-
}),
|
|
6934
|
+
}), Xe(e);
|
|
6913
6935
|
};
|
|
6914
6936
|
return e(), X.on("update", e), () => {
|
|
6915
6937
|
X.off("update", e);
|
|
6916
6938
|
};
|
|
6917
6939
|
}, [X]);
|
|
6918
|
-
let
|
|
6940
|
+
let Ze = C(() => X?.storage?.characterCount?.characters?.() ?? 0, [X, qe]), $e = a ? Ze > a : !1;
|
|
6919
6941
|
x(() => () => {
|
|
6920
|
-
|
|
6942
|
+
Ce.current && clearTimeout(Ce.current);
|
|
6921
6943
|
}, []), x(() => () => {
|
|
6922
|
-
|
|
6944
|
+
de && de.resolve(null);
|
|
6923
6945
|
}, []);
|
|
6924
|
-
let
|
|
6946
|
+
let et = b((e) => {
|
|
6925
6947
|
if (!X?.isEditable) return;
|
|
6926
6948
|
let t = window.getSelection(), n;
|
|
6927
6949
|
if (e) {
|
|
@@ -6946,8 +6968,8 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6946
6968
|
width: 0
|
|
6947
6969
|
};
|
|
6948
6970
|
}
|
|
6949
|
-
|
|
6950
|
-
let r =
|
|
6971
|
+
De.current = n;
|
|
6972
|
+
let r = we.current?.getBoundingClientRect(), i = Si(n, void 0, {
|
|
6951
6973
|
panelWidth: r?.width,
|
|
6952
6974
|
editorLeft: r?.left
|
|
6953
6975
|
});
|
|
@@ -6957,18 +6979,18 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6957
6979
|
if (!X) return;
|
|
6958
6980
|
let e = X.storage.qingwuUI;
|
|
6959
6981
|
if (e) return e.openImageDialog = () => V(!0), e.openVideoDialog = () => ae(!0), e.chooseMd = (e, t) => {
|
|
6960
|
-
|
|
6982
|
+
fe({
|
|
6961
6983
|
filename: e,
|
|
6962
6984
|
resolve: t
|
|
6963
6985
|
});
|
|
6964
|
-
}, e.openAI =
|
|
6986
|
+
}, e.openAI = et, e.parseMd = (e, t) => X ? wi(X, t) : null, () => {
|
|
6965
6987
|
delete e.openImageDialog, delete e.openVideoDialog, delete e.openAI, delete e.parseMd, delete e.chooseMd;
|
|
6966
6988
|
};
|
|
6967
|
-
}, [X,
|
|
6989
|
+
}, [X, et]), S(() => {
|
|
6968
6990
|
if (!j || !X) return;
|
|
6969
|
-
let e =
|
|
6991
|
+
let e = De.current;
|
|
6970
6992
|
if (!e) return;
|
|
6971
|
-
let t = z.current, n =
|
|
6993
|
+
let t = z.current, n = we.current?.getBoundingClientRect(), r = Si(e, t?.offsetHeight || void 0, {
|
|
6972
6994
|
panelWidth: n?.width,
|
|
6973
6995
|
editorLeft: n?.left
|
|
6974
6996
|
});
|
|
@@ -6976,9 +6998,9 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6976
6998
|
}, [j, X]), x(() => {
|
|
6977
6999
|
if (!j || !X) return;
|
|
6978
7000
|
let e = () => {
|
|
6979
|
-
let e =
|
|
7001
|
+
let e = De.current;
|
|
6980
7002
|
if (!e) return;
|
|
6981
|
-
let t = z.current, n =
|
|
7003
|
+
let t = z.current, n = we.current?.getBoundingClientRect(), r = Si(e, t?.offsetHeight || void 0, {
|
|
6982
7004
|
panelWidth: n?.width,
|
|
6983
7005
|
editorLeft: n?.left
|
|
6984
7006
|
});
|
|
@@ -6986,30 +7008,49 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
6986
7008
|
};
|
|
6987
7009
|
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
6988
7010
|
}, [j, X]), x(() => {
|
|
6989
|
-
j || (
|
|
7011
|
+
j || (De.current = null);
|
|
6990
7012
|
}, [j]);
|
|
6991
|
-
let
|
|
7013
|
+
let tt = b((e) => {
|
|
6992
7014
|
X?.chain().focus().setImage({ src: e }).run();
|
|
6993
|
-
}, [X]),
|
|
7015
|
+
}, [X]), nt = b((e) => {
|
|
6994
7016
|
(X?.commands).insertVideo?.({ src: e });
|
|
6995
|
-
}, [X]),
|
|
7017
|
+
}, [X]), rt = pe && ye && !J && !Y, it = !rt && !he && (pe || Ye && !(!k && xe)), at = w(!1);
|
|
6996
7018
|
return x(() => {
|
|
6997
|
-
|
|
6998
|
-
}, [
|
|
6999
|
-
if (!
|
|
7019
|
+
at.current || (at.current = !0, pe && !rt && ge(!0));
|
|
7020
|
+
}, [pe, rt]), x(() => {
|
|
7021
|
+
if (!he) return;
|
|
7000
7022
|
let e = (e) => {
|
|
7001
7023
|
let t = e.target;
|
|
7002
|
-
|
|
7024
|
+
Fe.current?.contains(t) || ge(!1);
|
|
7003
7025
|
}, t = (e) => {
|
|
7004
|
-
e.key === "Escape" &&
|
|
7026
|
+
e.key === "Escape" && ge(!1);
|
|
7005
7027
|
};
|
|
7006
7028
|
return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e, { passive: !0 }), document.addEventListener("keydown", t), () => {
|
|
7007
7029
|
document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e), document.removeEventListener("keydown", t);
|
|
7008
7030
|
};
|
|
7009
|
-
}, [
|
|
7031
|
+
}, [he]), x(() => {
|
|
7032
|
+
if (!X || !rt) return;
|
|
7033
|
+
let e = ke.current;
|
|
7034
|
+
if (!(e instanceof HTMLElement)) return;
|
|
7035
|
+
let t = (t) => {
|
|
7036
|
+
let n = t.deltaY;
|
|
7037
|
+
if (n === 0) return;
|
|
7038
|
+
let r = e.scrollTop <= 0, i = !(e.scrollTop + e.clientHeight >= e.scrollHeight - 1);
|
|
7039
|
+
if (n > 0 && i || n < 0 && !r) {
|
|
7040
|
+
e.scrollTop += n, t.preventDefault(), t.stopPropagation();
|
|
7041
|
+
return;
|
|
7042
|
+
}
|
|
7043
|
+
let a = ot(X.view.dom);
|
|
7044
|
+
if (a) {
|
|
7045
|
+
a.scrollTop += n, t.preventDefault(), t.stopPropagation();
|
|
7046
|
+
return;
|
|
7047
|
+
}
|
|
7048
|
+
};
|
|
7049
|
+
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
7050
|
+
}, [X, rt]), X ? /* @__PURE__ */ O("div", {
|
|
7010
7051
|
className: "qingwu-editor-row",
|
|
7011
7052
|
children: [/* @__PURE__ */ O("div", {
|
|
7012
|
-
ref:
|
|
7053
|
+
ref: we,
|
|
7013
7054
|
className: `qingwu-editor relative flex-1 min-w-0 bg-background ${k ? "qingwu-editor--readonly" : ""} ${l ? "" : "rounded-xl border border-default-200"} ${c}`,
|
|
7014
7055
|
style: u,
|
|
7015
7056
|
children: [
|
|
@@ -7020,13 +7061,13 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7020
7061
|
children: [
|
|
7021
7062
|
/* @__PURE__ */ D("button", {
|
|
7022
7063
|
type: "button",
|
|
7023
|
-
className: `qed-tb-btn qed-tb-btn--desktop-only${
|
|
7064
|
+
className: `qed-tb-btn qed-tb-btn--desktop-only${pe ? " is-active" : ""}`,
|
|
7024
7065
|
onClick: () => {
|
|
7025
|
-
|
|
7066
|
+
pe ? (me(!1), ge(!1)) : (me(!0), ye && !J && !Y || ge(!0));
|
|
7026
7067
|
},
|
|
7027
|
-
title:
|
|
7028
|
-
"aria-label":
|
|
7029
|
-
"aria-pressed":
|
|
7068
|
+
title: pe ? "隐藏目录" : "显示目录",
|
|
7069
|
+
"aria-label": pe ? "隐藏目录" : "显示目录",
|
|
7070
|
+
"aria-pressed": pe,
|
|
7030
7071
|
children: /* @__PURE__ */ D("svg", {
|
|
7031
7072
|
fill: "none",
|
|
7032
7073
|
viewBox: "0 0 24 24",
|
|
@@ -7042,11 +7083,11 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7042
7083
|
}),
|
|
7043
7084
|
h && /* @__PURE__ */ D("button", {
|
|
7044
7085
|
type: "button",
|
|
7045
|
-
className: `qed-tb-btn${
|
|
7046
|
-
onClick: () =>
|
|
7086
|
+
className: `qed-tb-btn${_e ? " is-active" : ""}`,
|
|
7087
|
+
onClick: () => ve(!_e),
|
|
7047
7088
|
title: "查找 (Ctrl+F)",
|
|
7048
7089
|
"aria-label": "查找",
|
|
7049
|
-
"aria-pressed":
|
|
7090
|
+
"aria-pressed": _e,
|
|
7050
7091
|
children: /* @__PURE__ */ D("svg", {
|
|
7051
7092
|
fill: "none",
|
|
7052
7093
|
viewBox: "0 0 24 24",
|
|
@@ -7063,7 +7104,7 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7063
7104
|
!k && /* @__PURE__ */ D("button", {
|
|
7064
7105
|
type: "button",
|
|
7065
7106
|
className: `qed-tb-btn qed-tb-btn--ai${j ? " is-active" : ""}`,
|
|
7066
|
-
onClick: (e) => j ? M(!1) :
|
|
7107
|
+
onClick: (e) => j ? M(!1) : et(e.currentTarget),
|
|
7067
7108
|
title: f("editor.toolbar.aiTitle"),
|
|
7068
7109
|
"aria-label": f("editor.toolbar.ai"),
|
|
7069
7110
|
"aria-pressed": j,
|
|
@@ -7111,11 +7152,11 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7111
7152
|
}),
|
|
7112
7153
|
/* @__PURE__ */ D("button", {
|
|
7113
7154
|
type: "button",
|
|
7114
|
-
className: `qed-tb-btn${
|
|
7115
|
-
onClick:
|
|
7116
|
-
title:
|
|
7117
|
-
"aria-label":
|
|
7118
|
-
"aria-pressed":
|
|
7155
|
+
className: `qed-tb-btn${J ? " is-active" : ""}`,
|
|
7156
|
+
onClick: Ie,
|
|
7157
|
+
title: J ? "退出网页全屏" : "网页全屏",
|
|
7158
|
+
"aria-label": J ? "退出网页全屏" : "网页全屏",
|
|
7159
|
+
"aria-pressed": J,
|
|
7119
7160
|
children: /* @__PURE__ */ D("svg", {
|
|
7120
7161
|
fill: "none",
|
|
7121
7162
|
viewBox: "0 0 24 24",
|
|
@@ -7131,11 +7172,11 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7131
7172
|
}),
|
|
7132
7173
|
/* @__PURE__ */ D("button", {
|
|
7133
7174
|
type: "button",
|
|
7134
|
-
className: `qed-tb-btn${
|
|
7135
|
-
onClick:
|
|
7136
|
-
title:
|
|
7137
|
-
"aria-label":
|
|
7138
|
-
"aria-pressed":
|
|
7175
|
+
className: `qed-tb-btn${Y ? " is-active" : ""}`,
|
|
7176
|
+
onClick: Le,
|
|
7177
|
+
title: Y ? "退出全屏" : "全屏",
|
|
7178
|
+
"aria-label": Y ? "退出全屏" : "全屏",
|
|
7179
|
+
"aria-pressed": Y,
|
|
7139
7180
|
children: /* @__PURE__ */ D("svg", {
|
|
7140
7181
|
fill: "none",
|
|
7141
7182
|
viewBox: "0 0 24 24",
|
|
@@ -7162,17 +7203,17 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7162
7203
|
},
|
|
7163
7204
|
className: "bubble-menu-pop bg-background border border-default-200 rounded-xl p-1 shadow-lg",
|
|
7164
7205
|
children: /* @__PURE__ */ O("div", {
|
|
7165
|
-
ref:
|
|
7206
|
+
ref: Ae,
|
|
7166
7207
|
className: "bubble-menu-items relative flex items-center gap-0.5",
|
|
7167
7208
|
onPointerDown: (e) => {
|
|
7168
7209
|
e.target.closest("button") && e.preventDefault();
|
|
7169
7210
|
},
|
|
7170
7211
|
children: [
|
|
7171
|
-
|
|
7212
|
+
Ue.map((e) => /* @__PURE__ */ D("button", {
|
|
7172
7213
|
type: "button",
|
|
7173
7214
|
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"}`,
|
|
7174
7215
|
onClick: (t) => {
|
|
7175
|
-
t.preventDefault(),
|
|
7216
|
+
t.preventDefault(), Ge(e);
|
|
7176
7217
|
},
|
|
7177
7218
|
title: e.label,
|
|
7178
7219
|
"aria-label": e.label,
|
|
@@ -7186,10 +7227,10 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7186
7227
|
type: "button",
|
|
7187
7228
|
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"}`,
|
|
7188
7229
|
onClick: (e) => {
|
|
7189
|
-
e.preventDefault(),
|
|
7230
|
+
e.preventDefault(), Me(!1), We?.command(X);
|
|
7190
7231
|
},
|
|
7191
|
-
title:
|
|
7192
|
-
"aria-label":
|
|
7232
|
+
title: We?.label,
|
|
7233
|
+
"aria-label": We?.label,
|
|
7193
7234
|
children: /* @__PURE__ */ D(zt, {})
|
|
7194
7235
|
}),
|
|
7195
7236
|
/* @__PURE__ */ D("span", {
|
|
@@ -7198,27 +7239,27 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7198
7239
|
}),
|
|
7199
7240
|
/* @__PURE__ */ D("button", {
|
|
7200
7241
|
type: "button",
|
|
7201
|
-
"aria-expanded":
|
|
7202
|
-
className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${
|
|
7242
|
+
"aria-expanded": je,
|
|
7243
|
+
className: `flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${je ? "bg-default-100 text-default-900" : "text-default-600 hover:bg-default-100"}`,
|
|
7203
7244
|
onClick: (e) => {
|
|
7204
|
-
e.preventDefault(),
|
|
7245
|
+
e.preventDefault(), Me((e) => !e);
|
|
7205
7246
|
},
|
|
7206
7247
|
title: f("editor.bubble.more"),
|
|
7207
7248
|
"aria-label": f("editor.bubble.more"),
|
|
7208
7249
|
children: /* @__PURE__ */ D(Bt, {})
|
|
7209
7250
|
}),
|
|
7210
|
-
|
|
7251
|
+
je && /* @__PURE__ */ D("div", {
|
|
7211
7252
|
role: "menu",
|
|
7212
7253
|
className: "bubble-more-menu absolute right-0 top-full z-[9999] mt-1 w-max max-h-[70vh] overflow-y-auto flex-col gap-1 rounded-xl border border-default-200 bg-background p-1.5 shadow-xl",
|
|
7213
7254
|
onPointerDown: (e) => {
|
|
7214
7255
|
e.target.closest("button") && e.preventDefault();
|
|
7215
7256
|
},
|
|
7216
|
-
children:
|
|
7257
|
+
children: He.map((e) => /* @__PURE__ */ O("button", {
|
|
7217
7258
|
type: "button",
|
|
7218
7259
|
role: "menuitem",
|
|
7219
|
-
className: `flex items-center gap-2 w-full whitespace-nowrap px-3 py-1.5 text-xs rounded-md transition-colors ${
|
|
7260
|
+
className: `flex items-center gap-2 w-full whitespace-nowrap px-3 py-1.5 text-xs rounded-md transition-colors ${Ke(e) ? "bg-primary/10 text-primary" : "text-default-600 hover:bg-default-100"}`,
|
|
7220
7261
|
onClick: (t) => {
|
|
7221
|
-
t.preventDefault(),
|
|
7262
|
+
t.preventDefault(), Ge(e);
|
|
7222
7263
|
},
|
|
7223
7264
|
title: e.label,
|
|
7224
7265
|
children: [/* @__PURE__ */ D("span", {
|
|
@@ -7242,7 +7283,7 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7242
7283
|
onClick: (e) => e.stopPropagation(),
|
|
7243
7284
|
children: K === "highlight" ? /* @__PURE__ */ O("div", {
|
|
7244
7285
|
className: "flex items-center gap-1 p-1.5 flex-wrap",
|
|
7245
|
-
children: [
|
|
7286
|
+
children: [vi.map((e) => /* @__PURE__ */ D("button", {
|
|
7246
7287
|
type: "button",
|
|
7247
7288
|
className: "w-5 h-5 rounded-full border border-default-200 hover:scale-110 transition-transform",
|
|
7248
7289
|
style: { background: e.color },
|
|
@@ -7265,16 +7306,16 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7265
7306
|
type: "url",
|
|
7266
7307
|
className: "flex-1 px-2 py-1 text-xs rounded-md border border-default-200 bg-background focus:outline-none focus:border-primary",
|
|
7267
7308
|
placeholder: "https://...",
|
|
7268
|
-
value:
|
|
7269
|
-
onChange: (e) =>
|
|
7309
|
+
value: le,
|
|
7310
|
+
onChange: (e) => ue(e.target.value),
|
|
7270
7311
|
onKeyDown: (e) => {
|
|
7271
|
-
e.key === "Enter" ? (
|
|
7312
|
+
e.key === "Enter" ? (le.trim() && X.chain().focus().setLink({ href: le.trim() }).run(), q("none")) : e.key === "Escape" && q("none");
|
|
7272
7313
|
}
|
|
7273
7314
|
}), /* @__PURE__ */ D("button", {
|
|
7274
7315
|
type: "button",
|
|
7275
7316
|
className: "px-2 py-1 text-xs rounded-md bg-primary text-white hover:opacity-90",
|
|
7276
7317
|
onClick: () => {
|
|
7277
|
-
|
|
7318
|
+
le.trim() && X.chain().focus().setLink({ href: le.trim() }).run(), q("none");
|
|
7278
7319
|
},
|
|
7279
7320
|
children: "确定"
|
|
7280
7321
|
})]
|
|
@@ -7299,11 +7340,11 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7299
7340
|
})]
|
|
7300
7341
|
})] }), document.body),
|
|
7301
7342
|
B && /* @__PURE__ */ D(v, {
|
|
7302
|
-
fallback: /* @__PURE__ */ D(
|
|
7303
|
-
children: /* @__PURE__ */ D(
|
|
7343
|
+
fallback: /* @__PURE__ */ D(Ai, {}),
|
|
7344
|
+
children: /* @__PURE__ */ D(Ti, {
|
|
7304
7345
|
open: B,
|
|
7305
7346
|
onClose: () => V(!1),
|
|
7306
|
-
onInsert:
|
|
7347
|
+
onInsert: tt,
|
|
7307
7348
|
validate: (e) => X ? un(X.state.doc, e, {
|
|
7308
7349
|
maxAttachmentSize: o,
|
|
7309
7350
|
maxTotalAttachmentSize: s
|
|
@@ -7311,58 +7352,58 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7311
7352
|
})
|
|
7312
7353
|
}),
|
|
7313
7354
|
H && /* @__PURE__ */ D(v, {
|
|
7314
|
-
fallback: /* @__PURE__ */ D(
|
|
7315
|
-
children: /* @__PURE__ */ D(
|
|
7355
|
+
fallback: /* @__PURE__ */ D(Ai, {}),
|
|
7356
|
+
children: /* @__PURE__ */ D(Oi, {
|
|
7316
7357
|
open: H,
|
|
7317
7358
|
onClose: () => ae(!1),
|
|
7318
|
-
onInsert:
|
|
7359
|
+
onInsert: nt
|
|
7319
7360
|
})
|
|
7320
7361
|
}),
|
|
7321
7362
|
oe && /* @__PURE__ */ D(v, {
|
|
7322
|
-
fallback: /* @__PURE__ */ D(
|
|
7323
|
-
children: /* @__PURE__ */ D(
|
|
7363
|
+
fallback: /* @__PURE__ */ D(Ai, {}),
|
|
7364
|
+
children: /* @__PURE__ */ D(Ei, {
|
|
7324
7365
|
open: oe,
|
|
7325
7366
|
onClose: () => U(!1)
|
|
7326
7367
|
})
|
|
7327
7368
|
}),
|
|
7328
7369
|
W && /* @__PURE__ */ D(v, {
|
|
7329
|
-
fallback: /* @__PURE__ */ D(
|
|
7330
|
-
children: /* @__PURE__ */ D(
|
|
7370
|
+
fallback: /* @__PURE__ */ D(Ai, {}),
|
|
7371
|
+
children: /* @__PURE__ */ D(Di, {
|
|
7331
7372
|
open: W,
|
|
7332
7373
|
onClose: () => G(!1),
|
|
7333
7374
|
editor: X
|
|
7334
7375
|
})
|
|
7335
7376
|
}),
|
|
7336
|
-
|
|
7337
|
-
fallback: /* @__PURE__ */ D(
|
|
7338
|
-
children: /* @__PURE__ */ D(
|
|
7339
|
-
open: !!
|
|
7340
|
-
filename:
|
|
7377
|
+
de && /* @__PURE__ */ D(v, {
|
|
7378
|
+
fallback: /* @__PURE__ */ D(Ai, {}),
|
|
7379
|
+
children: /* @__PURE__ */ D(ki, {
|
|
7380
|
+
open: !!de,
|
|
7381
|
+
filename: de.filename,
|
|
7341
7382
|
onRender: () => {
|
|
7342
|
-
|
|
7383
|
+
de.resolve("render"), fe(null);
|
|
7343
7384
|
},
|
|
7344
7385
|
onAttach: () => {
|
|
7345
|
-
|
|
7386
|
+
de.resolve("attach"), fe(null);
|
|
7346
7387
|
},
|
|
7347
7388
|
onClose: () => {
|
|
7348
|
-
|
|
7389
|
+
de.resolve(null), fe(null);
|
|
7349
7390
|
}
|
|
7350
7391
|
})
|
|
7351
7392
|
}),
|
|
7352
7393
|
/* @__PURE__ */ D("div", {
|
|
7353
|
-
ref:
|
|
7394
|
+
ref: Te,
|
|
7354
7395
|
className: "flex editor-body",
|
|
7355
7396
|
children: /* @__PURE__ */ O("div", {
|
|
7356
7397
|
className: "relative min-w-0 flex-1",
|
|
7357
7398
|
children: [
|
|
7358
7399
|
/* @__PURE__ */ D(P, { editor: X }),
|
|
7359
|
-
!k && /* @__PURE__ */ D(
|
|
7400
|
+
!k && /* @__PURE__ */ D(_i, { editor: X }),
|
|
7360
7401
|
/* @__PURE__ */ D("div", {
|
|
7361
|
-
className: `${
|
|
7402
|
+
className: `${J || Y ? "fixed" : "absolute"} bottom-2 right-4 z-10 pointer-events-none select-none`,
|
|
7362
7403
|
children: /* @__PURE__ */ O("span", {
|
|
7363
|
-
className: `text-xs ${
|
|
7404
|
+
className: `text-xs ${$e ? "bg-danger/10 text-danger font-medium px-2 py-0.5 rounded" : a && Ze > a * .9 ? "bg-warning/10 text-warning px-2 py-0.5 rounded" : "text-default-300"}`,
|
|
7364
7405
|
children: [
|
|
7365
|
-
|
|
7406
|
+
Ze,
|
|
7366
7407
|
a ? ` / ${a}` : "",
|
|
7367
7408
|
" 字"
|
|
7368
7409
|
]
|
|
@@ -7371,14 +7412,14 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7371
7412
|
]
|
|
7372
7413
|
})
|
|
7373
7414
|
}),
|
|
7374
|
-
h &&
|
|
7415
|
+
h && _e && /* @__PURE__ */ D(Ot, {
|
|
7375
7416
|
editor: X,
|
|
7376
|
-
onClose: () =>
|
|
7417
|
+
onClose: () => ve(!1)
|
|
7377
7418
|
}),
|
|
7378
|
-
|
|
7419
|
+
it && /* @__PURE__ */ D("button", {
|
|
7379
7420
|
type: "button",
|
|
7380
7421
|
className: "qingwu-toc-fab",
|
|
7381
|
-
onClick: () =>
|
|
7422
|
+
onClick: () => ge(!0),
|
|
7382
7423
|
title: "目录",
|
|
7383
7424
|
"aria-label": "打开目录",
|
|
7384
7425
|
children: /* @__PURE__ */ D("svg", {
|
|
@@ -7394,8 +7435,8 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7394
7435
|
})
|
|
7395
7436
|
})
|
|
7396
7437
|
}),
|
|
7397
|
-
|
|
7398
|
-
ref:
|
|
7438
|
+
he && ne(/* @__PURE__ */ O("div", {
|
|
7439
|
+
ref: Fe,
|
|
7399
7440
|
className: "qingwu-toc-drawer toc-scroll",
|
|
7400
7441
|
"data-lenis-prevent": !0,
|
|
7401
7442
|
children: [/* @__PURE__ */ O("div", {
|
|
@@ -7406,7 +7447,7 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7406
7447
|
}), /* @__PURE__ */ D("button", {
|
|
7407
7448
|
type: "button",
|
|
7408
7449
|
className: "qed-drawer-head__close",
|
|
7409
|
-
onClick: () =>
|
|
7450
|
+
onClick: () => ge(!1),
|
|
7410
7451
|
"aria-label": "关闭目录",
|
|
7411
7452
|
children: /* @__PURE__ */ D("svg", {
|
|
7412
7453
|
fill: "none",
|
|
@@ -7425,17 +7466,17 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7425
7466
|
editor: X,
|
|
7426
7467
|
className: "!p-3",
|
|
7427
7468
|
onClose: () => {
|
|
7428
|
-
|
|
7469
|
+
ge(!1), me(!1);
|
|
7429
7470
|
}
|
|
7430
7471
|
})]
|
|
7431
7472
|
}), document.body)
|
|
7432
7473
|
]
|
|
7433
|
-
}),
|
|
7474
|
+
}), rt && /* @__PURE__ */ D("aside", {
|
|
7475
|
+
ref: ke,
|
|
7434
7476
|
className: "qingwu-toc-desktop toc-scroll",
|
|
7435
|
-
"data-lenis-prevent": !0,
|
|
7436
7477
|
children: /* @__PURE__ */ D(ut, {
|
|
7437
7478
|
editor: X,
|
|
7438
|
-
onClose: () =>
|
|
7479
|
+
onClose: () => me(!1)
|
|
7439
7480
|
})
|
|
7440
7481
|
})]
|
|
7441
7482
|
}) : /* @__PURE__ */ D("div", {
|
|
@@ -7445,7 +7486,7 @@ var Ci = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7445
7486
|
};
|
|
7446
7487
|
//#endregion
|
|
7447
7488
|
//#region src/editor/clipper/receiver-browser.ts
|
|
7448
|
-
function
|
|
7489
|
+
function Mi(e) {
|
|
7449
7490
|
let t = async (t) => {
|
|
7450
7491
|
let n = t.data;
|
|
7451
7492
|
if (!n || typeof n != "object" || n.kind !== "qingwu-clip") return;
|
|
@@ -7462,7 +7503,7 @@ function Ai(e) {
|
|
|
7462
7503
|
}
|
|
7463
7504
|
//#endregion
|
|
7464
7505
|
//#region src/editor/storage/providers/cos.ts
|
|
7465
|
-
function
|
|
7506
|
+
function Ni(e) {
|
|
7466
7507
|
return g({
|
|
7467
7508
|
endpoint: `https://cos.${e.region}.myqcloud.com`,
|
|
7468
7509
|
bucket: e.bucket,
|
|
@@ -7476,7 +7517,7 @@ function ji(e) {
|
|
|
7476
7517
|
}
|
|
7477
7518
|
//#endregion
|
|
7478
7519
|
//#region src/editor/storage/providers/oss.ts
|
|
7479
|
-
function
|
|
7520
|
+
function Pi(e) {
|
|
7480
7521
|
return g({
|
|
7481
7522
|
endpoint: `https://${e.bucket}.${e.region}.aliyuncs.com`,
|
|
7482
7523
|
bucket: e.bucket,
|
|
@@ -7489,4 +7530,4 @@ function Mi(e) {
|
|
|
7489
7530
|
});
|
|
7490
7531
|
}
|
|
7491
7532
|
//#endregion
|
|
7492
|
-
export { $n as CODE_LANGUAGES, ar as CodeBlock, kr as ImageUpload, et as ImageUploadDialog,
|
|
7533
|
+
export { $n as CODE_LANGUAGES, ar as CodeBlock, kr as ImageUpload, et as ImageUploadDialog, ji as QingWuAIEditor, ni as RelativeMedia, Et as SearchHighlight, ut as TocPanel, Kn as VideoEmbed, dt as buildSystemPrompt, pt as createAILanguageModelProvider, Ni as createCOSStorage, _t as createDeepSeekProvider, _ as createLocalStorage, Pi as createOSSStorage, gt as createOpenAICompatProvider, vt as createOpenAIProvider, yt as createQwenProvider, g as createS3Storage, ii as createSlashCommandExtension, h as escapeHtml, cn as formatBytes, ht as getAIProvider, di as getBubbleMenuActions, ai as getDefaultSlashCommands, sn as getDocAttachmentTotal, si as getEditorExtensions, u as getLocale, ui as getSearchEngine, Dt as getSearchState, c as getStorageInfo, o as getStorageProvider, s as loadStorageConfig, r as registerS3PreviewConfig, d as sanitizeHtml, p as sanitizeSvg, mt as setAIProvider, gn as setConfirmProvider, l as setLocale, li as setSearchEngine, i as setStorageProvider, Ze as setToastProvider, n as signPreviewUrlHeaders, Mi as startBrowserClipperReceiver, Qe as subscribeToast, f as t, m as tf, Z as toast, un as validateAttachmentFile };
|