@markweave/react 0.3.8 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMarkweaveEditorExtensions as e } from "markweave/internal/editor-core/create-editor-extensions";
|
|
2
2
|
import { getLocalizedSlashCommandSpecs as t, getMarkweaveMessages as n, normalizeMarkweaveLang as r } from "markweave/internal/i18n";
|
|
3
3
|
import { EditorContent as i, NodeViewWrapper as a, ReactNodeViewRenderer as o, useEditor as s } from "@tiptap/react";
|
|
4
|
-
import { AlertTriangle as c, AlignCenter as l, AlignJustify as u, AlignLeft as d, AlignRight as f, AlignVerticalJustifyCenter as p, AlignVerticalJustifyEnd as m, AlignVerticalJustifyStart as h, ArrowDown as g, ArrowDownAZ as _, ArrowLeft as v, ArrowRight as y, ArrowUp as b, ArrowUpZA as x, BetweenHorizontalEnd as S, BetweenHorizontalStart as C, BetweenVerticalEnd as w, BetweenVerticalStart as T, Bold as E, Braces as D, Captions as
|
|
4
|
+
import { AlertTriangle as c, AlignCenter as l, AlignJustify as u, AlignLeft as d, AlignRight as f, AlignVerticalJustifyCenter as p, AlignVerticalJustifyEnd as m, AlignVerticalJustifyStart as h, ArrowDown as g, ArrowDownAZ as _, ArrowLeft as v, ArrowRight as y, ArrowUp as b, ArrowUpZA as x, BetweenHorizontalEnd as S, BetweenHorizontalStart as C, BetweenVerticalEnd as w, BetweenVerticalStart as T, Bold as E, Braces as D, Captions as ee, Check as O, CheckCircle2 as k, ChevronDown as A, ChevronRight as j, ChevronUp as M, CircleX as te, Code2 as N, Copy as P, CornerDownLeft as ne, Download as re, ExternalLink as F, Eye as I, Heading1 as ie, Heading2 as ae, Heading3 as L, Image as R, ImageUp as z, IndentDecrease as B, IndentIncrease as V, Info as oe, Italic as se, Lightbulb as ce, Link2 as le, List as ue, ListChecks as H, ListOrdered as U, Minus as de, MoreVertical as fe, PaintBucket as W, Paperclip as pe, Pencil as me, Plus as he, Quote as ge, Replace as _e, RotateCcw as ve, Sigma as ye, SmilePlus as be, Sparkles as xe, Square as Se, SquareX as Ce, Strikethrough as we, Subscript as Te, Superscript as Ee, Table2 as De, TableCellsMerge as Oe, TableCellsSplit as ke, Text as Ae, Trash2 as je, Type as Me, Underline as Ne, Upload as Pe, Video as Fe, X as Ie } from "lucide-react";
|
|
5
5
|
import { useCallback as G, useEffect as K, useLayoutEffect as Le, useMemo as q, useRef as J, useState as Y, useSyncExternalStore as Re } from "react";
|
|
6
6
|
import { detectUploadSource as ze, getDirectUploadResult as Be, resolveMarkweaveUploadResult as X } from "markweave/internal/plugins/slash-command/upload";
|
|
7
7
|
import { MarkweaveCoreImage as Ve, MarkweaveCoreVideo as He, attrsFromMarkweaveImageUploadResult as Ue, attrsFromMarkweaveVideoUploadResult as We, attrsFromMarkweaveVideoUrl as Ge, clampMarkweaveImageWidth as Ke, createMarkweaveImageUploadRequest as qe, createMarkweaveVideoUploadRequest as Je, downloadMarkweaveImage as Ye, markweaveVideoIframeAllow as Xe, normalizeMarkweaveCoreImageAlign as Ze, normalizeMarkweaveVideoEmbedUrl as Qe, numberAttribute as $e, stringAttribute as et } from "markweave/internal/plugins/media/core-media-nodes";
|
|
@@ -61,7 +61,7 @@ function Ai(e) {
|
|
|
61
61
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
62
62
|
}
|
|
63
63
|
function ji(e) {
|
|
64
|
-
let { deleteNode: t, editor: r, getPos: i, node: o, selected: s, updateAttributes: c } = e, l = e.extension.options, u = l.messages ?? n("zh"), d = u.image, f = nt(Oi(r)), p = et(o.attrs.src), m = ki(o.attrs.align), h = $e(o.attrs.width), g = et(o.attrs.caption), _ = J(null), v = Li(p, l.resolveMediaSource, _, s), y = v?.src ?? (l.resolveMediaSource ? null : p), b = J(null), [x, S] = Y(!1), [C, w] = Y(!1), [T, E] = Y(!1), [D,
|
|
64
|
+
let { deleteNode: t, editor: r, getPos: i, node: o, selected: s, updateAttributes: c } = e, l = e.extension.options, u = l.messages ?? n("zh"), d = u.image, f = nt(Oi(r)), p = et(o.attrs.src), m = ki(o.attrs.align), h = $e(o.attrs.width), g = et(o.attrs.caption), _ = J(null), v = Li(p, l.resolveMediaSource, _, s), y = v?.src ?? (l.resolveMediaSource ? null : p), b = J(null), [x, S] = Y(!1), [C, w] = Y(!1), [T, E] = Y(!1), [D, ee] = Y(""), [O, k] = Y(null), [A, j] = Y(!1), [M, te] = Y(!!g), [N, P] = Y(g ?? ""), ne = f && (!p || C), re = () => {
|
|
65
65
|
y && ot({
|
|
66
66
|
src: y,
|
|
67
67
|
alt: et(o.attrs.alt) ?? "",
|
|
@@ -75,57 +75,57 @@ function ji(e) {
|
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
K(() => {
|
|
78
|
-
|
|
79
|
-
}, [g,
|
|
80
|
-
let
|
|
78
|
+
M || P(g ?? "");
|
|
79
|
+
}, [g, M]);
|
|
80
|
+
let F = () => {
|
|
81
81
|
if (!f) return;
|
|
82
82
|
let e = i();
|
|
83
83
|
typeof e == "number" && r.chain().focus().setNodeSelection(e).run();
|
|
84
|
-
},
|
|
84
|
+
}, ie = () => {
|
|
85
85
|
if (f) {
|
|
86
|
-
if (
|
|
86
|
+
if (ee(""), k(null), E(!1), p) {
|
|
87
87
|
w(!1);
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
t();
|
|
91
91
|
}
|
|
92
|
-
},
|
|
92
|
+
}, ae = async (e) => {
|
|
93
93
|
if (f) {
|
|
94
|
-
|
|
94
|
+
k(null), j(!0);
|
|
95
95
|
try {
|
|
96
96
|
let t = await X(qe(e, p && C ? "image-replace" : "image-insert"), l.onUpload);
|
|
97
|
-
c(Ue(o.attrs, t)), w(!1),
|
|
97
|
+
c(Ue(o.attrs, t)), w(!1), ee("");
|
|
98
98
|
} catch (e) {
|
|
99
|
-
|
|
99
|
+
k(e instanceof Error ? e.message : d.uploadFailedError);
|
|
100
100
|
} finally {
|
|
101
101
|
j(!1), E(!1);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
},
|
|
104
|
+
}, L = () => {
|
|
105
105
|
if (f) {
|
|
106
106
|
if (!D.trim()) {
|
|
107
|
-
|
|
107
|
+
k(d.uploadRequiredError);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
ae(ze(D));
|
|
111
111
|
}
|
|
112
|
-
},
|
|
113
|
-
!f || !e ||
|
|
112
|
+
}, R = (e) => {
|
|
113
|
+
!f || !e || ae({
|
|
114
114
|
type: "file",
|
|
115
115
|
file: e,
|
|
116
116
|
mimeType: e.type
|
|
117
117
|
});
|
|
118
|
-
}, R = (e) => {
|
|
119
|
-
L(e.currentTarget.files?.[0] ?? null), e.currentTarget.value = "";
|
|
120
118
|
}, z = (e) => {
|
|
121
|
-
|
|
122
|
-
}, B = () => {
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
f && (
|
|
126
|
-
},
|
|
119
|
+
R(e.currentTarget.files?.[0] ?? null), e.currentTarget.value = "";
|
|
120
|
+
}, B = (e) => {
|
|
121
|
+
e.preventDefault(), e.stopPropagation(), f && R(e.dataTransfer.files?.[0] ?? null);
|
|
122
|
+
}, V = () => {
|
|
123
|
+
f && (te((e) => !e), M || P(g ?? ""));
|
|
124
|
+
}, oe = (e) => {
|
|
125
|
+
f && (P(e), c({ caption: e.trim() ? e : null }));
|
|
126
|
+
}, se = (e, t) => {
|
|
127
127
|
if (t.preventDefault(), t.stopPropagation(), !f) return;
|
|
128
|
-
|
|
128
|
+
F();
|
|
129
129
|
let n = _.current;
|
|
130
130
|
if (!n) return;
|
|
131
131
|
let r = t.clientX, i = n.getBoundingClientRect().width || h || 320, a = n.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? n.parentElement?.getBoundingClientRect().width ?? i, o = (t) => {
|
|
@@ -143,39 +143,39 @@ function ji(e) {
|
|
|
143
143
|
"data-align": m,
|
|
144
144
|
"data-selected": f && s ? "true" : "false",
|
|
145
145
|
"data-hovered": x ? "true" : "false",
|
|
146
|
-
"data-empty":
|
|
146
|
+
"data-empty": ne ? "true" : "false",
|
|
147
147
|
onPointerEnter: () => S(!0),
|
|
148
148
|
onPointerLeave: () => S(!1),
|
|
149
149
|
onMouseDown: (e) => {
|
|
150
|
-
f && !Ai(e.target) &&
|
|
150
|
+
f && !Ai(e.target) && F();
|
|
151
151
|
},
|
|
152
|
-
children:
|
|
152
|
+
children: ne ? /* @__PURE__ */ Z(Mi, {
|
|
153
153
|
dragActive: T,
|
|
154
|
-
error:
|
|
154
|
+
error: O,
|
|
155
155
|
inputValue: D,
|
|
156
|
-
isSubmitting:
|
|
156
|
+
isSubmitting: A,
|
|
157
157
|
fileInputRef: b,
|
|
158
158
|
messages: u,
|
|
159
|
-
onCancel:
|
|
160
|
-
onDrop:
|
|
159
|
+
onCancel: ie,
|
|
160
|
+
onDrop: B,
|
|
161
161
|
onDragActiveChange: E,
|
|
162
|
-
onFileChange:
|
|
163
|
-
onInputChange:
|
|
164
|
-
onSubmit:
|
|
162
|
+
onFileChange: z,
|
|
163
|
+
onInputChange: ee,
|
|
164
|
+
onSubmit: L
|
|
165
165
|
}) : /* @__PURE__ */ Q(lt, { children: [
|
|
166
166
|
f ? /* @__PURE__ */ Z(Ni, {
|
|
167
167
|
align: m,
|
|
168
|
-
captionActive:
|
|
168
|
+
captionActive: M || !!g,
|
|
169
169
|
messages: u,
|
|
170
170
|
onAlign: (e) => c({ align: e }),
|
|
171
|
-
onCaption:
|
|
171
|
+
onCaption: V,
|
|
172
172
|
onDelete: t,
|
|
173
173
|
onDownload: () => {
|
|
174
174
|
y && Ye(y);
|
|
175
175
|
},
|
|
176
|
-
onPreview:
|
|
176
|
+
onPreview: re,
|
|
177
177
|
onReplace: () => {
|
|
178
|
-
|
|
178
|
+
ee(""), k(null), w(!0);
|
|
179
179
|
}
|
|
180
180
|
}) : null,
|
|
181
181
|
/* @__PURE__ */ Q("div", {
|
|
@@ -209,8 +209,8 @@ function ji(e) {
|
|
|
209
209
|
"aria-label": d.preview,
|
|
210
210
|
title: d.preview,
|
|
211
211
|
onMouseDown: (e) => e.preventDefault(),
|
|
212
|
-
onClick:
|
|
213
|
-
children: [/* @__PURE__ */ Z(
|
|
212
|
+
onClick: re,
|
|
213
|
+
children: [/* @__PURE__ */ Z(I, {
|
|
214
214
|
size: 16,
|
|
215
215
|
strokeWidth: 1.8
|
|
216
216
|
}), /* @__PURE__ */ Z("span", {
|
|
@@ -222,25 +222,25 @@ function ji(e) {
|
|
|
222
222
|
f ? /* @__PURE__ */ Z(Fi, {
|
|
223
223
|
side: "left",
|
|
224
224
|
messages: u,
|
|
225
|
-
onPointerDown:
|
|
225
|
+
onPointerDown: se
|
|
226
226
|
}) : null,
|
|
227
227
|
f ? /* @__PURE__ */ Z(Fi, {
|
|
228
228
|
side: "right",
|
|
229
229
|
messages: u,
|
|
230
|
-
onPointerDown:
|
|
230
|
+
onPointerDown: se
|
|
231
231
|
}) : null
|
|
232
232
|
]
|
|
233
233
|
}),
|
|
234
|
-
f && (
|
|
234
|
+
f && (M || g) ? /* @__PURE__ */ Z("input", {
|
|
235
235
|
className: "markweave-image-caption-input",
|
|
236
236
|
"data-markweave-image-ui": "true",
|
|
237
237
|
"data-testid": "markweave-image-caption-input",
|
|
238
|
-
value:
|
|
238
|
+
value: N,
|
|
239
239
|
placeholder: d.captionPlaceholder,
|
|
240
240
|
"aria-label": d.captionAriaLabel,
|
|
241
|
-
onChange: (e) =>
|
|
241
|
+
onChange: (e) => oe(e.currentTarget.value),
|
|
242
242
|
onKeyDown: (e) => {
|
|
243
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
243
|
+
e.key === "Escape" && (e.preventDefault(), te(!1));
|
|
244
244
|
}
|
|
245
245
|
}) : g ? /* @__PURE__ */ Z("figcaption", {
|
|
246
246
|
className: "markweave-image-caption",
|
|
@@ -277,7 +277,7 @@ function Mi({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
|
|
|
277
277
|
/* @__PURE__ */ Z("div", {
|
|
278
278
|
className: "markweave-image-upload-icon",
|
|
279
279
|
"aria-hidden": "true",
|
|
280
|
-
children: /* @__PURE__ */ Z(
|
|
280
|
+
children: /* @__PURE__ */ Z(z, {
|
|
281
281
|
size: 46,
|
|
282
282
|
strokeWidth: 1.6
|
|
283
283
|
})
|
|
@@ -312,7 +312,7 @@ function Mi({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
|
|
|
312
312
|
"data-testid": "markweave-image-upload-submit",
|
|
313
313
|
disabled: i || !r.trim(),
|
|
314
314
|
onClick: d,
|
|
315
|
-
children: [/* @__PURE__ */ Z(
|
|
315
|
+
children: [/* @__PURE__ */ Z(z, {
|
|
316
316
|
size: 16,
|
|
317
317
|
strokeWidth: 1.8
|
|
318
318
|
}), a.common.insert]
|
|
@@ -368,20 +368,20 @@ function Ni({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i,
|
|
|
368
368
|
/* @__PURE__ */ Z(Pi, {
|
|
369
369
|
testId: "markweave-image-caption",
|
|
370
370
|
label: u.caption,
|
|
371
|
-
icon:
|
|
371
|
+
icon: ee,
|
|
372
372
|
active: t,
|
|
373
373
|
onClick: i
|
|
374
374
|
}),
|
|
375
375
|
/* @__PURE__ */ Z(Pi, {
|
|
376
376
|
testId: "markweave-image-preview",
|
|
377
377
|
label: u.preview,
|
|
378
|
-
icon:
|
|
378
|
+
icon: I,
|
|
379
379
|
onClick: s
|
|
380
380
|
}),
|
|
381
381
|
/* @__PURE__ */ Z(Pi, {
|
|
382
382
|
testId: "markweave-image-download",
|
|
383
383
|
label: u.download,
|
|
384
|
-
icon:
|
|
384
|
+
icon: re,
|
|
385
385
|
onClick: o
|
|
386
386
|
}),
|
|
387
387
|
/* @__PURE__ */ Z(Pi, {
|
|
@@ -504,13 +504,13 @@ function Ri(e) {
|
|
|
504
504
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
505
505
|
}
|
|
506
506
|
function zi(e) {
|
|
507
|
-
let { deleteNode: t, editor: r, getPos: i, node: o, selected: s, updateAttributes: c } = e, l = e.extension.options, u = l.messages ?? n("zh"), d = u.video, f = nt(Oi(r)), p = et(o.attrs.src), m = et(o.attrs.embedUrl), h = et(o.attrs.provider), g = m ? Qe(m, h) : null, _ = et(o.attrs.mimeType), v = et(o.attrs.title), y = J(null), [b, x] = Y(!1), [S, C] = Y(""), [w, T] = Y(null), [E, D] = Y(!1),
|
|
507
|
+
let { deleteNode: t, editor: r, getPos: i, node: o, selected: s, updateAttributes: c } = e, l = e.extension.options, u = l.messages ?? n("zh"), d = u.video, f = nt(Oi(r)), p = et(o.attrs.src), m = et(o.attrs.embedUrl), h = et(o.attrs.provider), g = m ? Qe(m, h) : null, _ = et(o.attrs.mimeType), v = et(o.attrs.title), y = J(null), [b, x] = Y(!1), [S, C] = Y(""), [w, T] = Y(null), [E, D] = Y(!1), ee = f && !p, O = () => {
|
|
508
508
|
if (!f) return;
|
|
509
509
|
let e = i();
|
|
510
510
|
typeof e == "number" && r.chain().focus().setNodeSelection(e).run();
|
|
511
|
+
}, k = (e) => {
|
|
512
|
+
f && (Ri(e.target) || (e.preventDefault(), O()));
|
|
511
513
|
}, A = (e) => {
|
|
512
|
-
f && (Ri(e.target) || (e.preventDefault(), k()));
|
|
513
|
-
}, ee = (e) => {
|
|
514
514
|
f && (e.key === "Delete" || e.key === "Backspace") && s && (e.preventDefault(), t());
|
|
515
515
|
}, j = async (e) => {
|
|
516
516
|
if (!(!f || !e)) {
|
|
@@ -529,7 +529,7 @@ function zi(e) {
|
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
};
|
|
532
|
-
return
|
|
532
|
+
return ee ? /* @__PURE__ */ Z(a, {
|
|
533
533
|
as: "figure",
|
|
534
534
|
className: "markweave-video-node",
|
|
535
535
|
"data-testid": "markweave-video-node",
|
|
@@ -570,9 +570,9 @@ function zi(e) {
|
|
|
570
570
|
"data-selected": f && s ? "true" : "false",
|
|
571
571
|
tabIndex: f ? 0 : void 0,
|
|
572
572
|
"aria-label": d.nodeAriaLabel,
|
|
573
|
-
onFocus:
|
|
574
|
-
onKeyDown:
|
|
575
|
-
onMouseDown:
|
|
573
|
+
onFocus: O,
|
|
574
|
+
onKeyDown: A,
|
|
575
|
+
onMouseDown: k,
|
|
576
576
|
children: g ? /* @__PURE__ */ Q("div", {
|
|
577
577
|
className: "markweave-video-embed",
|
|
578
578
|
children: [/* @__PURE__ */ Z("iframe", {
|
|
@@ -813,13 +813,13 @@ function Ki(e) {
|
|
|
813
813
|
children: [
|
|
814
814
|
/* @__PURE__ */ Z(qi, {
|
|
815
815
|
label: u.convertToLink,
|
|
816
|
-
icon:
|
|
816
|
+
icon: le,
|
|
817
817
|
onClick: T,
|
|
818
818
|
testId: "markweave-link-card-convert"
|
|
819
819
|
}),
|
|
820
820
|
/* @__PURE__ */ Z(qi, {
|
|
821
821
|
label: u.copyAddress,
|
|
822
|
-
icon:
|
|
822
|
+
icon: P,
|
|
823
823
|
onClick: () => void Ui(f.href),
|
|
824
824
|
testId: "markweave-link-card-copy"
|
|
825
825
|
}),
|
|
@@ -871,7 +871,7 @@ function Ki(e) {
|
|
|
871
871
|
type: "submit",
|
|
872
872
|
"aria-label": u.edit,
|
|
873
873
|
disabled: !ft(x),
|
|
874
|
-
children: /* @__PURE__ */ Z(
|
|
874
|
+
children: /* @__PURE__ */ Z(le, { size: 16 })
|
|
875
875
|
})
|
|
876
876
|
]
|
|
877
877
|
}) : null
|
|
@@ -983,35 +983,35 @@ function Zi({ icon: e }) {
|
|
|
983
983
|
});
|
|
984
984
|
}
|
|
985
985
|
function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, readOnly: i = !1 }) {
|
|
986
|
-
let a = J(null), o = J(null), s = J(null), c = J(null), l = J(null), u = J({
|
|
986
|
+
let a = J(null), o = J(null), s = J(null), c = J(null), l = J(null), u = J(null), d = J({
|
|
987
987
|
active: !1,
|
|
988
988
|
lastX: 0,
|
|
989
989
|
lastY: 0
|
|
990
|
-
}), [
|
|
991
|
-
...
|
|
992
|
-
pos:
|
|
990
|
+
}), [f, p] = Y(null), [m, h] = Y(null), [g, _] = Y([]), [v, y] = Y(null), [b, x] = Y(!1), [S, C] = Y(""), [w, T] = Y(-1), [E, D] = Y(null), [ee, O] = Y(!1), [k, A] = Y(null), [j, M] = Y(null), [te, N] = Y(!1), [P, ne] = Y(0), [re, F] = Y(0), I = zt(t), ie = Wn(t, f), ae = !i && e && I.active && I.pos !== null ? {
|
|
991
|
+
...I,
|
|
992
|
+
pos: I.pos,
|
|
993
993
|
active: !0
|
|
994
|
-
} : null,
|
|
994
|
+
} : null, L = ie ?? ae, R = L !== null, z = L?.language === "mermaid", B = Yn(t, L), V = R && L !== null && !B, oe = !i, se = Ln(L ? L.language : "text"), ce = E?.status ?? "idle", le = L?.mermaidPreviewMode ?? n, ue = z && le === "preview", H = qn(t), U = `${re}|${H.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`, de = q(() => Vn(S.trim().toLowerCase()), [S]);
|
|
995
995
|
if (K(() => {
|
|
996
|
-
i && (
|
|
996
|
+
i && (x(!1), C(""), T(-1));
|
|
997
997
|
}, [i]), K(() => {
|
|
998
|
-
if (!
|
|
998
|
+
if (!E) return;
|
|
999
999
|
let e = window.setTimeout(() => {
|
|
1000
|
-
|
|
1000
|
+
D(null);
|
|
1001
1001
|
}, An);
|
|
1002
1002
|
return () => {
|
|
1003
1003
|
window.clearTimeout(e);
|
|
1004
1004
|
};
|
|
1005
|
-
}, [
|
|
1006
|
-
|
|
1005
|
+
}, [E]), K(() => {
|
|
1006
|
+
D(null), x(!1), C(""), T(-1), A(null), M(null), N(!1);
|
|
1007
1007
|
}, [
|
|
1008
1008
|
e,
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1009
|
+
L?.language,
|
|
1010
|
+
L?.pos,
|
|
1011
|
+
L?.text
|
|
1012
1012
|
]), K(() => {
|
|
1013
1013
|
let e = ({ transaction: e }) => {
|
|
1014
|
-
e.getMeta(Lt) &&
|
|
1014
|
+
e.getMeta(Lt) && ne((e) => e + 1);
|
|
1015
1015
|
};
|
|
1016
1016
|
return t.on("transaction", e), () => {
|
|
1017
1017
|
t.off("transaction", e);
|
|
@@ -1020,29 +1020,29 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1020
1020
|
let e = t.view.dom.closest(".markweave-editor-frame");
|
|
1021
1021
|
if (!e) return;
|
|
1022
1022
|
let n = (e) => {
|
|
1023
|
-
if (e.target instanceof Node && a.current?.contains(e.target) ||
|
|
1023
|
+
if (e.target instanceof Node && a.current?.contains(e.target) || b) return;
|
|
1024
1024
|
let n = Wn(t, Un(t, e.target)), r = n && !Yn(t, n) ? n.pos : null;
|
|
1025
|
-
|
|
1025
|
+
p((e) => e === r ? e : r);
|
|
1026
1026
|
}, r = () => {
|
|
1027
|
-
|
|
1027
|
+
b || p(null);
|
|
1028
1028
|
};
|
|
1029
1029
|
return e.addEventListener("mousemove", n), e.addEventListener("mouseleave", r), () => {
|
|
1030
1030
|
e.removeEventListener("mousemove", n), e.removeEventListener("mouseleave", r);
|
|
1031
1031
|
};
|
|
1032
|
-
}, [t,
|
|
1033
|
-
|
|
1034
|
-
}, [
|
|
1035
|
-
if (!
|
|
1036
|
-
let e =
|
|
1032
|
+
}, [t, b]), K(() => {
|
|
1033
|
+
b && c.current?.focus({ preventScroll: !0 });
|
|
1034
|
+
}, [b]), Le(() => {
|
|
1035
|
+
if (!b || w < 0) return;
|
|
1036
|
+
let e = l.current, t = e?.querySelector(`[data-language-index="${w}"]`);
|
|
1037
1037
|
e && t && er(e, t);
|
|
1038
1038
|
}, [
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1039
|
+
w,
|
|
1040
|
+
de,
|
|
1041
|
+
b
|
|
1042
1042
|
]), K(() => {
|
|
1043
1043
|
if (!k) return;
|
|
1044
1044
|
let e = (e) => {
|
|
1045
|
-
e.key === "Escape" && (A(null),
|
|
1045
|
+
e.key === "Escape" && (A(null), M(null), N(!1), d.current = {
|
|
1046
1046
|
active: !1,
|
|
1047
1047
|
lastX: 0,
|
|
1048
1048
|
lastY: 0
|
|
@@ -1052,32 +1052,32 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1052
1052
|
document.removeEventListener("keydown", e);
|
|
1053
1053
|
};
|
|
1054
1054
|
}, [t, k]), K(() => {
|
|
1055
|
-
if (!
|
|
1055
|
+
if (!R || !b) return;
|
|
1056
1056
|
let e = (e) => {
|
|
1057
|
-
e.key === "Escape" && (
|
|
1057
|
+
e.key === "Escape" && (x(!1), T(-1), t.view.focus());
|
|
1058
1058
|
}, n = (e) => {
|
|
1059
|
-
e.target instanceof Node && a.current?.contains(e.target) || (
|
|
1059
|
+
e.target instanceof Node && a.current?.contains(e.target) || (x(!1), T(-1));
|
|
1060
1060
|
};
|
|
1061
1061
|
return document.addEventListener("keydown", e), document.addEventListener("mousedown", n), () => {
|
|
1062
1062
|
document.removeEventListener("keydown", e), document.removeEventListener("mousedown", n);
|
|
1063
1063
|
};
|
|
1064
1064
|
}, [
|
|
1065
|
-
|
|
1065
|
+
R,
|
|
1066
1066
|
t,
|
|
1067
|
-
|
|
1067
|
+
b
|
|
1068
1068
|
]), Le(() => {
|
|
1069
1069
|
let e = () => {
|
|
1070
1070
|
let e = a.current;
|
|
1071
1071
|
if (!e) return;
|
|
1072
|
-
if (!Gn(e) ||
|
|
1073
|
-
|
|
1072
|
+
if (!Gn(e) || H.length === 0) {
|
|
1073
|
+
_([]);
|
|
1074
1074
|
return;
|
|
1075
1075
|
}
|
|
1076
|
-
let n = e.getBoundingClientRect(), r =
|
|
1076
|
+
let n = e.getBoundingClientRect(), r = H.flatMap((e) => {
|
|
1077
1077
|
let r = Bn(zn(t, e.pos, e.mermaidPreviewMode), n);
|
|
1078
1078
|
return r ? [Fn(e, r, n)] : [];
|
|
1079
1079
|
});
|
|
1080
|
-
|
|
1080
|
+
_((e) => Xn(e, r, H.map((e) => e.pos)));
|
|
1081
1081
|
};
|
|
1082
1082
|
e();
|
|
1083
1083
|
let n = window.requestAnimationFrame(e);
|
|
@@ -1085,28 +1085,29 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1085
1085
|
window.cancelAnimationFrame(n), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
1086
1086
|
};
|
|
1087
1087
|
}, [
|
|
1088
|
-
|
|
1088
|
+
P,
|
|
1089
1089
|
t,
|
|
1090
|
-
|
|
1090
|
+
U
|
|
1091
1091
|
]), Le(() => {
|
|
1092
|
-
if (!
|
|
1093
|
-
|
|
1092
|
+
if (!V || !L) {
|
|
1093
|
+
h(null), y(null);
|
|
1094
1094
|
return;
|
|
1095
1095
|
}
|
|
1096
1096
|
let e = () => {
|
|
1097
1097
|
let e = a.current;
|
|
1098
1098
|
if (!e) return;
|
|
1099
|
-
let n = zn(t,
|
|
1099
|
+
let n = zn(t, L.pos, le), r = e.getBoundingClientRect(), i = Bn(n, r);
|
|
1100
1100
|
if (!i) {
|
|
1101
|
-
|
|
1101
|
+
h((e) => e?.pos === L.pos ? e : null), y((e) => b ? e : null);
|
|
1102
1102
|
return;
|
|
1103
1103
|
}
|
|
1104
|
-
let
|
|
1105
|
-
if (
|
|
1106
|
-
let e = o.current.getBoundingClientRect();
|
|
1107
|
-
|
|
1104
|
+
let c = Nn(L.pos, i, r);
|
|
1105
|
+
if (h(c), b && o.current) {
|
|
1106
|
+
let e = o.current.getBoundingClientRect(), t = s.current?.getBoundingClientRect().height;
|
|
1107
|
+
y(On({
|
|
1108
1108
|
overlayRect: r,
|
|
1109
1109
|
buttonRect: e,
|
|
1110
|
+
menuHeight: t,
|
|
1110
1111
|
windowWidth: window.innerWidth,
|
|
1111
1112
|
windowHeight: window.innerHeight
|
|
1112
1113
|
}));
|
|
@@ -1116,115 +1117,116 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1116
1117
|
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
1117
1118
|
};
|
|
1118
1119
|
}, [
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1120
|
+
V,
|
|
1121
|
+
P,
|
|
1122
|
+
L?.pos,
|
|
1122
1123
|
t,
|
|
1123
|
-
|
|
1124
|
+
de.length,
|
|
1125
|
+
b,
|
|
1124
1126
|
le
|
|
1125
|
-
]), !
|
|
1126
|
-
let fe =
|
|
1127
|
-
top:
|
|
1128
|
-
right:
|
|
1129
|
-
} : void 0,
|
|
1127
|
+
]), !V && H.length === 0 && !k) return null;
|
|
1128
|
+
let fe = m ? {
|
|
1129
|
+
top: m.top,
|
|
1130
|
+
right: m.right
|
|
1131
|
+
} : void 0, W = async () => {
|
|
1130
1132
|
if (i) {
|
|
1131
|
-
if (!
|
|
1132
|
-
let e = await jn(
|
|
1133
|
-
|
|
1133
|
+
if (!L) return;
|
|
1134
|
+
let e = await jn(L.text);
|
|
1135
|
+
D(Bt(L, e ? "copied" : "failed"));
|
|
1134
1136
|
return;
|
|
1135
1137
|
}
|
|
1136
|
-
if (!In(t,
|
|
1138
|
+
if (!In(t, L)) return;
|
|
1137
1139
|
let e = await Rt(t);
|
|
1138
|
-
|
|
1139
|
-
},
|
|
1140
|
+
D(Bt(zt(t), e ? "copied" : "failed")), t.view.focus();
|
|
1141
|
+
}, pe = (e, n) => {
|
|
1140
1142
|
if (i) {
|
|
1141
|
-
Jt(t, e.pos, n) &&
|
|
1143
|
+
Jt(t, e.pos, n) && F((e) => e + 1);
|
|
1142
1144
|
return;
|
|
1143
1145
|
}
|
|
1144
|
-
let a =
|
|
1145
|
-
Wt(t, e.pos, n) && (r(n),
|
|
1146
|
-
},
|
|
1147
|
-
if (i || !
|
|
1148
|
-
let n =
|
|
1149
|
-
Ut(t,
|
|
1150
|
-
},
|
|
1151
|
-
let e = !
|
|
1152
|
-
e &&
|
|
1153
|
-
}, he = (e) => {
|
|
1154
|
-
let t = Vn(e);
|
|
1155
|
-
S(e), w(Kn(t, e.trim() ? null : I?.language ?? null));
|
|
1146
|
+
let a = I.active && I.pos === e.pos;
|
|
1147
|
+
Wt(t, e.pos, n) && (r(n), F((e) => e + 1), a && t.view.focus());
|
|
1148
|
+
}, me = (e) => {
|
|
1149
|
+
if (i || !L) return;
|
|
1150
|
+
let n = I.active && I.pos === L.pos;
|
|
1151
|
+
Ut(t, L.pos, e) && (e === "mermaid" && Wt(t, L.pos, "preview") && r("preview"), x(!1), C(""), T(-1), F((e) => e + 1), n && t.view.focus());
|
|
1152
|
+
}, he = () => {
|
|
1153
|
+
let e = !b;
|
|
1154
|
+
e && u.current === null && (u.current = Mn()), T(e ? Kn(de, L?.language ?? null) : -1), x(e);
|
|
1156
1155
|
}, ge = (e) => {
|
|
1156
|
+
let t = Vn(e);
|
|
1157
|
+
C(e), T(Kn(t, e.trim() ? null : L?.language ?? null));
|
|
1158
|
+
}, _e = (e) => {
|
|
1157
1159
|
if (!e.nativeEvent.isComposing) {
|
|
1158
1160
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
1159
|
-
e.preventDefault(),
|
|
1161
|
+
e.preventDefault(), T((t) => Qn(t, de.length, e.key === "ArrowUp" ? "previous" : "next"));
|
|
1160
1162
|
return;
|
|
1161
1163
|
}
|
|
1162
1164
|
if (e.key === "Enter") {
|
|
1163
|
-
let t =
|
|
1164
|
-
t && (e.preventDefault(),
|
|
1165
|
+
let t = de[w];
|
|
1166
|
+
t && (e.preventDefault(), me(t.language));
|
|
1165
1167
|
return;
|
|
1166
1168
|
}
|
|
1167
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
1169
|
+
e.key === "Escape" && (e.preventDefault(), x(!1), T(-1), t.view.focus());
|
|
1168
1170
|
}
|
|
1169
|
-
},
|
|
1170
|
-
i || !
|
|
1171
|
-
},
|
|
1172
|
-
if (!
|
|
1173
|
-
let e = Jn(t,
|
|
1171
|
+
}, ve = de[w], ye = u.current && ve ? Hn(u.current, ve.language) : void 0, be = () => {
|
|
1172
|
+
i || !L || Ht(t, L.pos, !B) && (ne((e) => e + 1), p(null));
|
|
1173
|
+
}, xe = () => {
|
|
1174
|
+
if (!L) return;
|
|
1175
|
+
let e = Jn(t, L.pos);
|
|
1174
1176
|
e && Dn({
|
|
1175
1177
|
data: new Blob([e], { type: "image/svg+xml" }),
|
|
1176
1178
|
fileName: "markweave-mermaid.svg",
|
|
1177
1179
|
onSettled: () => t.view.focus(),
|
|
1178
1180
|
ownerDocument: document
|
|
1179
1181
|
});
|
|
1180
|
-
},
|
|
1181
|
-
if (!
|
|
1182
|
-
let e = Jn(t,
|
|
1183
|
-
e && (A(Pn(e)),
|
|
1182
|
+
}, Se = () => {
|
|
1183
|
+
if (!L) return;
|
|
1184
|
+
let e = Jn(t, L.pos);
|
|
1185
|
+
e && (A(Pn(e)), M(null), N(!1), d.current = {
|
|
1184
1186
|
active: !1,
|
|
1185
1187
|
lastX: 0,
|
|
1186
1188
|
lastY: 0
|
|
1187
1189
|
});
|
|
1188
|
-
},
|
|
1189
|
-
A(null),
|
|
1190
|
+
}, Ce = () => {
|
|
1191
|
+
A(null), M(null), N(!1), d.current = {
|
|
1190
1192
|
active: !1,
|
|
1191
1193
|
lastX: 0,
|
|
1192
1194
|
lastY: 0
|
|
1193
1195
|
}, t.view.focus();
|
|
1194
|
-
},
|
|
1196
|
+
}, we = (e) => {
|
|
1195
1197
|
A((t) => t && {
|
|
1196
1198
|
...t,
|
|
1197
1199
|
scale: kn(t.scale + e)
|
|
1198
1200
|
});
|
|
1199
|
-
},
|
|
1200
|
-
A((e) => e && Pn(e.svg)),
|
|
1201
|
+
}, Te = () => {
|
|
1202
|
+
A((e) => e && Pn(e.svg)), d.current = {
|
|
1201
1203
|
active: !1,
|
|
1202
1204
|
lastX: 0,
|
|
1203
1205
|
lastY: 0
|
|
1204
|
-
},
|
|
1205
|
-
}, Te = (e) => {
|
|
1206
|
-
e.preventDefault(), Ce(e.deltaY < 0 ? Zn : -Zn);
|
|
1206
|
+
}, N(!1);
|
|
1207
1207
|
}, Ee = (e) => {
|
|
1208
|
-
e.
|
|
1208
|
+
e.preventDefault(), we(e.deltaY < 0 ? Zn : -Zn);
|
|
1209
|
+
}, De = (e) => {
|
|
1210
|
+
e.button === 0 && (e.preventDefault(), d.current = {
|
|
1209
1211
|
active: !0,
|
|
1210
1212
|
lastX: e.clientX,
|
|
1211
1213
|
lastY: e.clientY
|
|
1212
|
-
},
|
|
1213
|
-
},
|
|
1214
|
-
let t =
|
|
1214
|
+
}, N(!0));
|
|
1215
|
+
}, Oe = (e) => {
|
|
1216
|
+
let t = d.current;
|
|
1215
1217
|
if (!t.active) return;
|
|
1216
1218
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
1217
|
-
|
|
1219
|
+
d.current = {
|
|
1218
1220
|
active: !0,
|
|
1219
1221
|
lastX: e.clientX,
|
|
1220
1222
|
lastY: e.clientY
|
|
1221
1223
|
}, A((e) => $n(e, n, r));
|
|
1222
|
-
},
|
|
1223
|
-
|
|
1224
|
+
}, ke = () => {
|
|
1225
|
+
d.current = {
|
|
1224
1226
|
active: !1,
|
|
1225
1227
|
lastX: 0,
|
|
1226
1228
|
lastY: 0
|
|
1227
|
-
},
|
|
1229
|
+
}, N(!1);
|
|
1228
1230
|
};
|
|
1229
1231
|
return /* @__PURE__ */ Q("div", {
|
|
1230
1232
|
ref: a,
|
|
@@ -1232,8 +1234,8 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1232
1234
|
"data-testid": "markweave-codeblock-overlay",
|
|
1233
1235
|
"data-read-only": i ? "true" : "false",
|
|
1234
1236
|
children: [
|
|
1235
|
-
|
|
1236
|
-
let t =
|
|
1237
|
+
H.map((e) => {
|
|
1238
|
+
let t = g.find((t) => t.pos === e.pos);
|
|
1237
1239
|
return /* @__PURE__ */ Z("div", {
|
|
1238
1240
|
className: "markweave-mermaid-tabs",
|
|
1239
1241
|
"data-testid": "markweave-mermaid-tabs",
|
|
@@ -1248,16 +1250,16 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1248
1250
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
1249
1251
|
"data-active": e.mermaidPreviewMode === t,
|
|
1250
1252
|
onMouseDown: (e) => e.preventDefault(),
|
|
1251
|
-
onClick: () =>
|
|
1253
|
+
onClick: () => pe(e, t),
|
|
1252
1254
|
children: t === "code" ? "Code" : "Preview"
|
|
1253
1255
|
}, t))
|
|
1254
1256
|
}, e.pos);
|
|
1255
1257
|
}),
|
|
1256
|
-
|
|
1258
|
+
V ? /* @__PURE__ */ Q("div", {
|
|
1257
1259
|
className: "markweave-codeblock-controls",
|
|
1258
1260
|
"data-testid": "markweave-codeblock-controls",
|
|
1259
|
-
"data-positioned":
|
|
1260
|
-
"data-collapsed":
|
|
1261
|
+
"data-positioned": m ? "true" : "false",
|
|
1262
|
+
"data-collapsed": B ? "true" : "false",
|
|
1261
1263
|
"data-read-only": i ? "true" : "false",
|
|
1262
1264
|
"aria-label": "Code block controls",
|
|
1263
1265
|
style: fe,
|
|
@@ -1272,22 +1274,22 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1272
1274
|
type: "button",
|
|
1273
1275
|
className: "markweave-codeblock-language-button",
|
|
1274
1276
|
"aria-label": "Code block language",
|
|
1275
|
-
"aria-expanded":
|
|
1277
|
+
"aria-expanded": b,
|
|
1276
1278
|
"aria-haspopup": "listbox",
|
|
1277
1279
|
"data-testid": "markweave-codeblock-language",
|
|
1278
1280
|
onMouseDown: (e) => e.preventDefault(),
|
|
1279
|
-
onClick:
|
|
1281
|
+
onClick: he,
|
|
1280
1282
|
children: [/* @__PURE__ */ Z("span", { children: se }), /* @__PURE__ */ Z(Zi, { icon: "chevron" })]
|
|
1281
1283
|
}),
|
|
1282
|
-
|
|
1284
|
+
oe ? /* @__PURE__ */ Z("button", {
|
|
1283
1285
|
type: "button",
|
|
1284
1286
|
className: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
1285
|
-
"aria-label":
|
|
1286
|
-
title:
|
|
1287
|
+
"aria-label": B ? "Expand code block" : "Collapse code block",
|
|
1288
|
+
title: B ? "Expand code block" : "Collapse code block",
|
|
1287
1289
|
"data-testid": "markweave-codeblock-collapse",
|
|
1288
|
-
"data-collapsed":
|
|
1290
|
+
"data-collapsed": B ? "true" : "false",
|
|
1289
1291
|
onMouseDown: (e) => e.preventDefault(),
|
|
1290
|
-
onClick:
|
|
1292
|
+
onClick: be,
|
|
1291
1293
|
children: /* @__PURE__ */ Z(Zi, { icon: "chevron" })
|
|
1292
1294
|
}) : null,
|
|
1293
1295
|
/* @__PURE__ */ Q("span", {
|
|
@@ -1303,16 +1305,16 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1303
1305
|
onMouseLeave: () => O(!1),
|
|
1304
1306
|
onFocus: () => O(!0),
|
|
1305
1307
|
onBlur: () => O(!1),
|
|
1306
|
-
onClick:
|
|
1308
|
+
onClick: W,
|
|
1307
1309
|
children: /* @__PURE__ */ Z(Zi, { icon: ce === "copied" ? "check" : "clipboard" })
|
|
1308
|
-
}),
|
|
1310
|
+
}), ee ? /* @__PURE__ */ Z("span", {
|
|
1309
1311
|
className: "markweave-codeblock-tooltip",
|
|
1310
1312
|
role: "tooltip",
|
|
1311
1313
|
"data-testid": "markweave-codeblock-copy-tooltip",
|
|
1312
1314
|
children: "Copy to clipboard"
|
|
1313
1315
|
}) : null]
|
|
1314
1316
|
}),
|
|
1315
|
-
|
|
1317
|
+
z && le === "preview" ? /* @__PURE__ */ Q("div", {
|
|
1316
1318
|
className: "markweave-mermaid-preview-actions",
|
|
1317
1319
|
"data-testid": "markweave-mermaid-preview-actions",
|
|
1318
1320
|
children: [/* @__PURE__ */ Z("button", {
|
|
@@ -1322,7 +1324,7 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1322
1324
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
1323
1325
|
disabled: !ue,
|
|
1324
1326
|
onMouseDown: (e) => e.preventDefault(),
|
|
1325
|
-
onClick:
|
|
1327
|
+
onClick: Se,
|
|
1326
1328
|
children: /* @__PURE__ */ Z(Zi, { icon: "expand" })
|
|
1327
1329
|
}), /* @__PURE__ */ Z("button", {
|
|
1328
1330
|
type: "button",
|
|
@@ -1331,46 +1333,47 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1331
1333
|
"data-testid": "markweave-mermaid-download",
|
|
1332
1334
|
disabled: !ue,
|
|
1333
1335
|
onMouseDown: (e) => e.preventDefault(),
|
|
1334
|
-
onClick:
|
|
1336
|
+
onClick: xe,
|
|
1335
1337
|
children: /* @__PURE__ */ Z(Zi, { icon: "download" })
|
|
1336
1338
|
})]
|
|
1337
1339
|
}) : null
|
|
1338
1340
|
]
|
|
1339
1341
|
}) : null,
|
|
1340
|
-
|
|
1342
|
+
oe && V && b ? /* @__PURE__ */ Q("div", {
|
|
1343
|
+
ref: s,
|
|
1341
1344
|
className: "markweave-codeblock-language-menu",
|
|
1342
1345
|
"data-testid": "markweave-codeblock-language-menu",
|
|
1343
|
-
"data-positioned":
|
|
1344
|
-
style:
|
|
1345
|
-
left:
|
|
1346
|
-
top:
|
|
1346
|
+
"data-positioned": v ? "true" : "false",
|
|
1347
|
+
style: v ? {
|
|
1348
|
+
left: v.left,
|
|
1349
|
+
top: v.top
|
|
1347
1350
|
} : void 0,
|
|
1348
1351
|
children: [/* @__PURE__ */ Q("label", {
|
|
1349
1352
|
className: "markweave-codeblock-language-search",
|
|
1350
1353
|
children: [/* @__PURE__ */ Z("input", {
|
|
1351
|
-
ref:
|
|
1354
|
+
ref: c,
|
|
1352
1355
|
role: "combobox",
|
|
1353
1356
|
"aria-autocomplete": "list",
|
|
1354
|
-
"aria-controls":
|
|
1357
|
+
"aria-controls": u.current ?? void 0,
|
|
1355
1358
|
"aria-expanded": "true",
|
|
1356
|
-
"aria-activedescendant":
|
|
1359
|
+
"aria-activedescendant": ye,
|
|
1357
1360
|
"aria-label": "Search code block languages",
|
|
1358
|
-
value:
|
|
1361
|
+
value: S,
|
|
1359
1362
|
placeholder: "Search...",
|
|
1360
1363
|
"data-testid": "markweave-codeblock-language-search",
|
|
1361
|
-
onChange: (e) =>
|
|
1362
|
-
onKeyDown:
|
|
1364
|
+
onChange: (e) => ge(e.target.value),
|
|
1365
|
+
onKeyDown: _e
|
|
1363
1366
|
}), /* @__PURE__ */ Z(Zi, { icon: "search" })]
|
|
1364
1367
|
}), /* @__PURE__ */ Z("div", {
|
|
1365
|
-
ref:
|
|
1366
|
-
id:
|
|
1368
|
+
ref: l,
|
|
1369
|
+
id: u.current ?? void 0,
|
|
1367
1370
|
className: "markweave-codeblock-language-list",
|
|
1368
1371
|
role: "listbox",
|
|
1369
1372
|
"aria-label": "Code block languages",
|
|
1370
|
-
children:
|
|
1371
|
-
let n = e.language ===
|
|
1373
|
+
children: de.map((e, t) => {
|
|
1374
|
+
let n = e.language === L.language, r = t === w;
|
|
1372
1375
|
return /* @__PURE__ */ Q("button", {
|
|
1373
|
-
id:
|
|
1376
|
+
id: u.current ? Hn(u.current, e.language) : void 0,
|
|
1374
1377
|
type: "button",
|
|
1375
1378
|
role: "option",
|
|
1376
1379
|
"aria-selected": n,
|
|
@@ -1379,8 +1382,8 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1379
1382
|
"data-highlighted": r ? "true" : "false",
|
|
1380
1383
|
"data-language-index": t,
|
|
1381
1384
|
onMouseDown: (e) => e.preventDefault(),
|
|
1382
|
-
onMouseEnter: () =>
|
|
1383
|
-
onClick: () =>
|
|
1385
|
+
onMouseEnter: () => T(t),
|
|
1386
|
+
onClick: () => me(e.language),
|
|
1384
1387
|
children: [/* @__PURE__ */ Z("span", { children: e.label }), n ? /* @__PURE__ */ Z(Zi, { icon: "check" }) : null]
|
|
1385
1388
|
}, e.language);
|
|
1386
1389
|
})
|
|
@@ -1402,11 +1405,11 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1402
1405
|
className: "markweave-mermaid-fullscreen-control",
|
|
1403
1406
|
"aria-label": "Zoom out",
|
|
1404
1407
|
"data-testid": "markweave-mermaid-fullscreen-zoom-out",
|
|
1405
|
-
onMouseEnter: () =>
|
|
1406
|
-
onMouseLeave: () =>
|
|
1407
|
-
onFocus: () =>
|
|
1408
|
-
onBlur: () =>
|
|
1409
|
-
onClick: () =>
|
|
1408
|
+
onMouseEnter: () => M("zoom-out"),
|
|
1409
|
+
onMouseLeave: () => M(null),
|
|
1410
|
+
onFocus: () => M("zoom-out"),
|
|
1411
|
+
onBlur: () => M(null),
|
|
1412
|
+
onClick: () => we(-Zn),
|
|
1410
1413
|
children: /* @__PURE__ */ Z(Zi, { icon: "zoomOut" })
|
|
1411
1414
|
}),
|
|
1412
1415
|
/* @__PURE__ */ Z("span", {
|
|
@@ -1419,11 +1422,11 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1419
1422
|
className: "markweave-mermaid-fullscreen-control",
|
|
1420
1423
|
"aria-label": "Zoom in",
|
|
1421
1424
|
"data-testid": "markweave-mermaid-fullscreen-zoom-in",
|
|
1422
|
-
onMouseEnter: () =>
|
|
1423
|
-
onMouseLeave: () =>
|
|
1424
|
-
onFocus: () =>
|
|
1425
|
-
onBlur: () =>
|
|
1426
|
-
onClick: () =>
|
|
1425
|
+
onMouseEnter: () => M("zoom-in"),
|
|
1426
|
+
onMouseLeave: () => M(null),
|
|
1427
|
+
onFocus: () => M("zoom-in"),
|
|
1428
|
+
onBlur: () => M(null),
|
|
1429
|
+
onClick: () => we(Zn),
|
|
1427
1430
|
children: /* @__PURE__ */ Z(Zi, { icon: "zoomIn" })
|
|
1428
1431
|
}),
|
|
1429
1432
|
/* @__PURE__ */ Z("button", {
|
|
@@ -1431,18 +1434,18 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1431
1434
|
className: "markweave-mermaid-fullscreen-control",
|
|
1432
1435
|
"aria-label": "Reset zoom",
|
|
1433
1436
|
"data-testid": "markweave-mermaid-fullscreen-reset",
|
|
1434
|
-
onMouseEnter: () =>
|
|
1435
|
-
onMouseLeave: () =>
|
|
1436
|
-
onFocus: () =>
|
|
1437
|
-
onBlur: () =>
|
|
1438
|
-
onClick:
|
|
1437
|
+
onMouseEnter: () => M("reset"),
|
|
1438
|
+
onMouseLeave: () => M(null),
|
|
1439
|
+
onFocus: () => M("reset"),
|
|
1440
|
+
onBlur: () => M(null),
|
|
1441
|
+
onClick: Te,
|
|
1439
1442
|
children: /* @__PURE__ */ Z(Zi, { icon: "reset" })
|
|
1440
1443
|
}),
|
|
1441
|
-
|
|
1444
|
+
j ? /* @__PURE__ */ Z("span", {
|
|
1442
1445
|
className: "markweave-mermaid-fullscreen-tooltip",
|
|
1443
1446
|
role: "tooltip",
|
|
1444
1447
|
"data-testid": "markweave-mermaid-fullscreen-tooltip",
|
|
1445
|
-
children:
|
|
1448
|
+
children: j === "zoom-out" ? "Zoom out" : j === "zoom-in" ? "Zoom in" : "Reset"
|
|
1446
1449
|
}) : null
|
|
1447
1450
|
]
|
|
1448
1451
|
}),
|
|
@@ -1451,18 +1454,18 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1451
1454
|
className: "markweave-mermaid-fullscreen-close",
|
|
1452
1455
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
1453
1456
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
1454
|
-
onClick:
|
|
1457
|
+
onClick: Ce,
|
|
1455
1458
|
children: /* @__PURE__ */ Z(Zi, { icon: "close" })
|
|
1456
1459
|
}),
|
|
1457
1460
|
/* @__PURE__ */ Z("div", {
|
|
1458
1461
|
className: "markweave-mermaid-fullscreen-viewport",
|
|
1459
1462
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
1460
1463
|
"data-dragging": te ? "true" : "false",
|
|
1461
|
-
onWheel:
|
|
1462
|
-
onMouseDown:
|
|
1463
|
-
onMouseMove:
|
|
1464
|
-
onMouseUp:
|
|
1465
|
-
onMouseLeave:
|
|
1464
|
+
onWheel: Ee,
|
|
1465
|
+
onMouseDown: De,
|
|
1466
|
+
onMouseMove: Oe,
|
|
1467
|
+
onMouseUp: ke,
|
|
1468
|
+
onMouseLeave: ke,
|
|
1466
1469
|
children: /* @__PURE__ */ Z("div", {
|
|
1467
1470
|
className: "markweave-mermaid-fullscreen-content",
|
|
1468
1471
|
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
@@ -1600,14 +1603,14 @@ function va(e, t, n) {
|
|
|
1600
1603
|
}
|
|
1601
1604
|
var ya = "markweave-floating-toolbar";
|
|
1602
1605
|
function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r, askAi: i, onRewriteSelection: a }) {
|
|
1603
|
-
let o = q(() => cr(n), [n]), s = Nt(r, { editable: e.isEditable }), [c, l] = Y(s), [u, d] = Y(null), [f, p] = Y(null), [m, h] = Y(null), [g, _] = Y("input"), [v, y] = Y(""), [b, x] = Y(""), [S, C] = Y(""), [w, T] = Y(""), [E, D] = Y(""), [
|
|
1604
|
-
|
|
1605
|
-
}, []),
|
|
1606
|
-
|
|
1607
|
-
}, [
|
|
1608
|
-
let t =
|
|
1606
|
+
let o = q(() => cr(n), [n]), s = Nt(r, { editable: e.isEditable }), [c, l] = Y(s), [u, d] = Y(null), [f, p] = Y(null), [m, h] = Y(null), [g, _] = Y("input"), [v, y] = Y(""), [b, x] = Y(""), [S, C] = Y(""), [w, T] = Y(""), [E, D] = Y(""), [ee, O] = Y(""), [k, A] = Y(null), [j, M] = Y(0), [te, N] = Y(s.boundaryPadding), [P, ne] = Y("bottom"), re = J(0), F = J(null), I = J(null), ie = J(null), ae = J(null), L = J(null), R = J(null), z = J(null), B = J(null), V = J(null), oe = J(""), se = i?.enabled === !0 && typeof i.handler == "function", ce = ir(e, c.variant, n, { askAiEnabled: se }), le = ur(ce.find((e) => e.id === u) ?? null), ue = Lr(E), H = G(() => {
|
|
1607
|
+
V.current !== null && (window.cancelAnimationFrame(V.current), V.current = null);
|
|
1608
|
+
}, []), U = G((t = !0) => {
|
|
1609
|
+
z.current?.abort(), z.current = null, B.current = null, H(), t && Mr(e), Er(e), h(null);
|
|
1610
|
+
}, [H, e]), de = G(() => {
|
|
1611
|
+
let t = F.current, n = e.view.dom.closest(".markweave-editor-frame");
|
|
1609
1612
|
if (!t || !(n instanceof HTMLElement)) return;
|
|
1610
|
-
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = na(t,
|
|
1613
|
+
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = na(t, I.current), o = re.current, s = Ot({
|
|
1611
1614
|
toolbarRect: {
|
|
1612
1615
|
left: r.left - o,
|
|
1613
1616
|
top: r.top,
|
|
@@ -1635,16 +1638,16 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1635
1638
|
offset: c.offset,
|
|
1636
1639
|
boundaryPadding: c.boundaryPadding
|
|
1637
1640
|
});
|
|
1638
|
-
t.style.marginLeft = s === 0 ? "" : `${s}px`, t.style.visibility = "visible", t.style.opacity = "1",
|
|
1641
|
+
t.style.marginLeft = s === 0 ? "" : `${s}px`, t.style.visibility = "visible", t.style.opacity = "1", re.current = s, M((e) => e === s ? e : s), N((e) => e === l ? e : l);
|
|
1639
1642
|
}, [
|
|
1640
1643
|
e.view.dom,
|
|
1641
1644
|
c.boundaryPadding,
|
|
1642
1645
|
c.offset
|
|
1643
|
-
]),
|
|
1644
|
-
|
|
1646
|
+
]), fe = G(() => {
|
|
1647
|
+
F.current && (F.current.style.visibility = "hidden", F.current.style.opacity = "0");
|
|
1645
1648
|
}, []), W = G(() => {
|
|
1646
|
-
|
|
1647
|
-
}, [
|
|
1649
|
+
de();
|
|
1650
|
+
}, [de]), pe = G(() => Ar(e)?.target.kind === "table" ? {
|
|
1648
1651
|
getBoundingClientRect: () => {
|
|
1649
1652
|
let t = jr(e);
|
|
1650
1653
|
return t ? ia(t.left, t.top, t.width, t.height) : ia(0, 0, 0, 0);
|
|
@@ -1654,13 +1657,13 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1654
1657
|
return t ? [ia(t.left, t.top, t.width, t.height)] : [];
|
|
1655
1658
|
}
|
|
1656
1659
|
} : ga(e), [e]), me = G((e) => {
|
|
1657
|
-
|
|
1660
|
+
ie.current = e, e?.classList.contains("markweave-ask-ai-popover") && (e.dataset.positioned = "false");
|
|
1658
1661
|
}, []), he = G(() => {
|
|
1659
|
-
let t =
|
|
1662
|
+
let t = F.current, n = ie.current, r = e.view.dom.closest(".markweave-editor-frame");
|
|
1660
1663
|
if (!m || !t || !n) return;
|
|
1661
1664
|
let i = t.getBoundingClientRect(), a = n.getBoundingClientRect(), o = r?.getBoundingClientRect() ?? null;
|
|
1662
1665
|
if (m === "ask-ai") {
|
|
1663
|
-
let t = jr(e), r =
|
|
1666
|
+
let t = jr(e), r = I.current?.getBoundingClientRect();
|
|
1664
1667
|
if (!t || !r) return;
|
|
1665
1668
|
let i = {
|
|
1666
1669
|
anchorRect: r,
|
|
@@ -1679,7 +1682,7 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1679
1682
|
n.style.width !== l && (n.style.width = l, s = Cr({
|
|
1680
1683
|
...i,
|
|
1681
1684
|
panelSize: n.getBoundingClientRect()
|
|
1682
|
-
})), n.style.left = `${s.left}px`, n.style.top = `${s.top}px`, n.style.bottom = "auto", n.style.maxWidth = `${s.maxWidth}px`, n.style.maxHeight = `${Math.max(0, s.maxHeight)}px`, n.dataset.positioned = "true",
|
|
1685
|
+
})), n.style.left = `${s.left}px`, n.style.top = `${s.top}px`, n.style.bottom = "auto", n.style.maxWidth = `${s.maxWidth}px`, n.style.maxHeight = `${Math.max(0, s.maxHeight)}px`, n.dataset.positioned = "true", ne((e) => e === s.placement ? e : s.placement);
|
|
1683
1686
|
return;
|
|
1684
1687
|
}
|
|
1685
1688
|
let s = kt({
|
|
@@ -1693,20 +1696,20 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1693
1696
|
gap: m === "more" ? 8 : 6,
|
|
1694
1697
|
boundaryPadding: c.boundaryPadding
|
|
1695
1698
|
});
|
|
1696
|
-
|
|
1699
|
+
ne((e) => e === s.placement ? e : s.placement);
|
|
1697
1700
|
}, [
|
|
1698
1701
|
e,
|
|
1699
1702
|
m,
|
|
1700
1703
|
c.boundaryPadding
|
|
1701
1704
|
]), ge = q(() => ({
|
|
1702
|
-
...Mt(c, { topBoundaryPadding:
|
|
1703
|
-
onShow:
|
|
1705
|
+
...Mt(c, { topBoundaryPadding: te }),
|
|
1706
|
+
onShow: fe,
|
|
1704
1707
|
onUpdate: W
|
|
1705
1708
|
}), [
|
|
1706
|
-
|
|
1709
|
+
fe,
|
|
1707
1710
|
W,
|
|
1708
1711
|
c,
|
|
1709
|
-
|
|
1712
|
+
te
|
|
1710
1713
|
]);
|
|
1711
1714
|
K(() => {
|
|
1712
1715
|
let e = ea();
|
|
@@ -1736,22 +1739,22 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1736
1739
|
c.motionStartedAtMs
|
|
1737
1740
|
]), Le(() => {
|
|
1738
1741
|
if (c.visibility !== "visible") {
|
|
1739
|
-
|
|
1742
|
+
re.current = 0, F.current && (F.current.style.marginLeft = "", F.current.style.visibility = "hidden", F.current.style.opacity = "0"), M(0), N(c.boundaryPadding);
|
|
1740
1743
|
return;
|
|
1741
1744
|
}
|
|
1742
|
-
let e = vt(
|
|
1745
|
+
let e = vt(de);
|
|
1743
1746
|
return e.schedule(), window.addEventListener("resize", e.schedule), window.addEventListener("scroll", e.schedule, !0), () => {
|
|
1744
1747
|
e.cancel(), window.removeEventListener("resize", e.schedule), window.removeEventListener("scroll", e.schedule, !0);
|
|
1745
1748
|
};
|
|
1746
1749
|
}, [
|
|
1747
|
-
|
|
1750
|
+
de,
|
|
1748
1751
|
e.view.dom,
|
|
1749
1752
|
m,
|
|
1750
1753
|
r?.from,
|
|
1751
1754
|
r?.to,
|
|
1752
1755
|
c.variant,
|
|
1753
1756
|
c.visibility,
|
|
1754
|
-
|
|
1757
|
+
ce.length
|
|
1755
1758
|
]), Le(() => {
|
|
1756
1759
|
if (!m) return;
|
|
1757
1760
|
let e = vt(he);
|
|
@@ -1765,33 +1768,33 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1765
1768
|
m,
|
|
1766
1769
|
he
|
|
1767
1770
|
]), K(() => {
|
|
1768
|
-
m === "more" && o.some((e) => e.id === u) ||
|
|
1771
|
+
m === "more" && o.some((e) => e.id === u) || ce.some((e) => e.id === u) || (d(null), p(null));
|
|
1769
1772
|
}, [
|
|
1770
1773
|
o,
|
|
1771
1774
|
m,
|
|
1772
1775
|
u,
|
|
1773
|
-
|
|
1776
|
+
ce
|
|
1774
1777
|
]), K(() => {
|
|
1775
1778
|
if (!m) return;
|
|
1776
1779
|
let t = (e) => {
|
|
1777
|
-
|
|
1780
|
+
I.current?.contains(e.target) || (m === "ask-ai" ? U(!0) : h(null));
|
|
1778
1781
|
}, n = (t) => {
|
|
1779
|
-
t.key === "Escape" && (t.preventDefault(), m === "ask-ai" ? g === "generating" ? (
|
|
1782
|
+
t.key === "Escape" && (t.preventDefault(), m === "ask-ai" ? g === "generating" ? (z.current?.abort(), H(), _("input")) : U(!0) : (h(null), e.commands.focus()));
|
|
1780
1783
|
};
|
|
1781
1784
|
return document.addEventListener("pointerdown", t, !0), document.addEventListener("keydown", n, !0), () => {
|
|
1782
1785
|
document.removeEventListener("pointerdown", t, !0), document.removeEventListener("keydown", n, !0);
|
|
1783
1786
|
};
|
|
1784
1787
|
}, [
|
|
1785
1788
|
g,
|
|
1786
|
-
V,
|
|
1787
1789
|
H,
|
|
1790
|
+
U,
|
|
1788
1791
|
e,
|
|
1789
1792
|
m
|
|
1790
1793
|
]), K(() => {
|
|
1791
1794
|
let t = () => {
|
|
1792
1795
|
let t = Ar(e);
|
|
1793
1796
|
if (t?.target.kind === "table" && t.status === "target" && m !== "ask-ai") {
|
|
1794
|
-
|
|
1797
|
+
R.current = t.selection, _("input"), y(""), C(""), T(""), x(""), l((e) => ({
|
|
1795
1798
|
...e,
|
|
1796
1799
|
visibility: "visible",
|
|
1797
1800
|
variant: "default",
|
|
@@ -1801,21 +1804,21 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1801
1804
|
})), h("ask-ai");
|
|
1802
1805
|
return;
|
|
1803
1806
|
}
|
|
1804
|
-
m === "ask-ai" && t?.status === "conflict" && (
|
|
1807
|
+
m === "ask-ai" && t?.status === "conflict" && (z.current?.abort(), H(), _("conflict"));
|
|
1805
1808
|
};
|
|
1806
1809
|
return e.on("transaction", t), () => {
|
|
1807
1810
|
e.off("transaction", t);
|
|
1808
1811
|
};
|
|
1809
1812
|
}, [
|
|
1810
|
-
|
|
1813
|
+
H,
|
|
1811
1814
|
e,
|
|
1812
1815
|
m
|
|
1813
1816
|
]), K(() => () => {
|
|
1814
|
-
|
|
1815
|
-
}, [
|
|
1817
|
+
z.current?.abort(), H(), Er(e);
|
|
1818
|
+
}, [H, e]), K(() => {
|
|
1816
1819
|
if (m !== "link" && m !== "ask-ai") return;
|
|
1817
1820
|
let e = window.requestAnimationFrame(() => {
|
|
1818
|
-
m === "ask-ai" ?
|
|
1821
|
+
m === "ask-ai" ? L.current?.focus() : (ae.current?.focus(), ae.current?.select());
|
|
1819
1822
|
});
|
|
1820
1823
|
return () => window.cancelAnimationFrame(e);
|
|
1821
1824
|
}, [m]), K(() => {
|
|
@@ -1825,18 +1828,18 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1825
1828
|
if (_a(t.id)) {
|
|
1826
1829
|
let n = t.id;
|
|
1827
1830
|
if (m === n) {
|
|
1828
|
-
n === "ask-ai" ?
|
|
1831
|
+
n === "ask-ai" ? U(!0) : h(null);
|
|
1829
1832
|
return;
|
|
1830
1833
|
}
|
|
1831
|
-
if (m === "ask-ai" &&
|
|
1832
|
-
if (!
|
|
1834
|
+
if (m === "ask-ai" && U(!1), n === "ask-ai") {
|
|
1835
|
+
if (!se) return;
|
|
1833
1836
|
let t = Ir(e);
|
|
1834
1837
|
if (!t) return;
|
|
1835
|
-
|
|
1838
|
+
R.current = t, _("input"), C(""), T(""), x("");
|
|
1836
1839
|
}
|
|
1837
1840
|
if (n === "link") {
|
|
1838
1841
|
let t = or(e);
|
|
1839
|
-
D(t),
|
|
1842
|
+
D(t), O(t), A({
|
|
1840
1843
|
from: Math.min(e.state.selection.from, e.state.selection.to),
|
|
1841
1844
|
to: Math.max(e.state.selection.from, e.state.selection.to)
|
|
1842
1845
|
});
|
|
@@ -1850,32 +1853,32 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1850
1853
|
}
|
|
1851
1854
|
t.run(), e.commands.focus();
|
|
1852
1855
|
}, ve = G(async (r) => {
|
|
1853
|
-
if (!
|
|
1856
|
+
if (!se || i?.enabled !== !0 || !R.current) return;
|
|
1854
1857
|
let a = (r ?? v).trim();
|
|
1855
1858
|
if (!a) {
|
|
1856
1859
|
T(n.askAi.emptyPrompt), _("error");
|
|
1857
1860
|
return;
|
|
1858
1861
|
}
|
|
1859
|
-
let o = Or(e,
|
|
1862
|
+
let o = Or(e, R.current);
|
|
1860
1863
|
if (!o) {
|
|
1861
1864
|
_("conflict");
|
|
1862
1865
|
return;
|
|
1863
1866
|
}
|
|
1864
|
-
|
|
1867
|
+
R.current = o, z.current?.abort(), H(), Tr(e);
|
|
1865
1868
|
let s = new AbortController(), c = Dr(o, a, t, s.signal, void 0, Ar(e)?.target);
|
|
1866
|
-
|
|
1869
|
+
z.current = s, B.current = c.id, x(a), T(""), C(""), _("generating");
|
|
1867
1870
|
try {
|
|
1868
1871
|
let t = await Nr(i.handler, c, (t) => {
|
|
1869
|
-
|
|
1870
|
-
|
|
1872
|
+
B.current !== c.id || s.signal.aborted || (oe.current = t, V.current === null && (V.current = window.requestAnimationFrame(() => {
|
|
1873
|
+
V.current = null, Pr(e, oe.current), C(oe.current);
|
|
1871
1874
|
})));
|
|
1872
1875
|
});
|
|
1873
|
-
if (
|
|
1876
|
+
if (B.current !== c.id || s.signal.aborted) return;
|
|
1874
1877
|
if (!Pr(e, t)) throw new xr("invalid-output", "Ask AI output is incompatible with the selected content.");
|
|
1875
|
-
|
|
1878
|
+
H(), C(t), y(""), _(Ar(e)?.status === "target" ? "result" : "conflict");
|
|
1876
1879
|
} catch (t) {
|
|
1877
|
-
if (
|
|
1878
|
-
if (
|
|
1880
|
+
if (B.current !== c.id) return;
|
|
1881
|
+
if (H(), s.signal.aborted) {
|
|
1879
1882
|
Tr(e), _(Ar(e)?.status === "conflict" ? "conflict" : "input");
|
|
1880
1883
|
return;
|
|
1881
1884
|
}
|
|
@@ -1883,9 +1886,9 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1883
1886
|
}
|
|
1884
1887
|
}, [
|
|
1885
1888
|
i,
|
|
1886
|
-
|
|
1889
|
+
se,
|
|
1887
1890
|
v,
|
|
1888
|
-
|
|
1891
|
+
H,
|
|
1889
1892
|
e,
|
|
1890
1893
|
t,
|
|
1891
1894
|
n
|
|
@@ -1894,7 +1897,7 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1894
1897
|
_(Ar(e)?.status === "conflict" ? "conflict" : "error"), T(n.askAi.errorFallback);
|
|
1895
1898
|
return;
|
|
1896
1899
|
}
|
|
1897
|
-
h(null),
|
|
1900
|
+
h(null), B.current = null, window.setTimeout(() => Er(e), 560), e.commands.focus();
|
|
1898
1901
|
}, [
|
|
1899
1902
|
S,
|
|
1900
1903
|
e,
|
|
@@ -1902,32 +1905,32 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1902
1905
|
]), be = () => {
|
|
1903
1906
|
h(null), e.commands.focus();
|
|
1904
1907
|
}, xe = () => {
|
|
1905
|
-
|
|
1908
|
+
k && e.commands.setTextSelection(k);
|
|
1906
1909
|
}, Se = () => {
|
|
1907
1910
|
xe(), nr(e, E) && be();
|
|
1908
1911
|
}, Ce = () => {
|
|
1909
1912
|
if (xe(), gr(e)) {
|
|
1910
|
-
D(""),
|
|
1913
|
+
D(""), O(""), be();
|
|
1911
1914
|
return;
|
|
1912
1915
|
}
|
|
1913
1916
|
E.trim() && D("");
|
|
1914
1917
|
}, we = (e, t) => {
|
|
1915
|
-
if (d(e), !e || !t || !
|
|
1918
|
+
if (d(e), !e || !t || !I.current) {
|
|
1916
1919
|
p(null);
|
|
1917
1920
|
return;
|
|
1918
1921
|
}
|
|
1919
|
-
let n = t.getBoundingClientRect(), r =
|
|
1922
|
+
let n = t.getBoundingClientRect(), r = I.current.getBoundingClientRect();
|
|
1920
1923
|
p(n.left + n.width / 2 - r.left);
|
|
1921
1924
|
};
|
|
1922
1925
|
return /* @__PURE__ */ Z(tr, {
|
|
1923
|
-
ref:
|
|
1926
|
+
ref: F,
|
|
1924
1927
|
editor: e,
|
|
1925
1928
|
pluginKey: ya,
|
|
1926
1929
|
className: `markweave-floating-toolbar markweave-floating-toolbar--${c.variant} markweave-floating-toolbar--motion-${c.motionPhase}`,
|
|
1927
1930
|
"data-motion": c.motionPhase,
|
|
1928
1931
|
"data-position-strategy": ge.strategy,
|
|
1929
1932
|
"data-boundary-padding": c.boundaryPadding,
|
|
1930
|
-
"data-popover-placement": m ?
|
|
1933
|
+
"data-popover-placement": m ? P : void 0,
|
|
1931
1934
|
"data-ask-ai-session": m === "ask-ai" ? "open" : "closed",
|
|
1932
1935
|
"data-testid": "markweave-floating-toolbar",
|
|
1933
1936
|
style: ta(c, j),
|
|
@@ -1939,14 +1942,14 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1939
1942
|
return e.isEditable && (t?.target.kind === "table" && t.status === "target" || Ft(jt(e)));
|
|
1940
1943
|
},
|
|
1941
1944
|
children: /* @__PURE__ */ Q("div", {
|
|
1942
|
-
ref:
|
|
1945
|
+
ref: I,
|
|
1943
1946
|
className: "markweave-floating-toolbar-content",
|
|
1944
1947
|
"data-menu": m ?? "none",
|
|
1945
1948
|
children: [
|
|
1946
|
-
|
|
1949
|
+
ce.map((e, t) => /* @__PURE__ */ Z(Ca, {
|
|
1947
1950
|
button: e,
|
|
1948
1951
|
expanded: m === e.id,
|
|
1949
|
-
showDivider: t > 0 &&
|
|
1952
|
+
showDivider: t > 0 && ce[t - 1].group !== e.group,
|
|
1950
1953
|
tooltipActive: u === e.id,
|
|
1951
1954
|
onPointerDown: hr,
|
|
1952
1955
|
onTooltipChange: we,
|
|
@@ -1959,7 +1962,7 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1959
1962
|
onClose: () => h(null)
|
|
1960
1963
|
}) : null,
|
|
1961
1964
|
m === "ask-ai" ? /* @__PURE__ */ Z(Sa, {
|
|
1962
|
-
inputRef:
|
|
1965
|
+
inputRef: L,
|
|
1963
1966
|
messages: n,
|
|
1964
1967
|
phase: g,
|
|
1965
1968
|
prompt: v,
|
|
@@ -1968,20 +1971,20 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1968
1971
|
onPromptChange: y,
|
|
1969
1972
|
onSubmit: ve,
|
|
1970
1973
|
onStop: () => {
|
|
1971
|
-
|
|
1974
|
+
z.current?.abort(), H(), Tr(e), _("input");
|
|
1972
1975
|
},
|
|
1973
1976
|
onAccept: ye,
|
|
1974
1977
|
onRetry: () => ve(b),
|
|
1975
|
-
onDiscard: () =>
|
|
1978
|
+
onDiscard: () => U(!0),
|
|
1976
1979
|
onPopoverRef: me
|
|
1977
1980
|
}) : null,
|
|
1978
1981
|
m === "link" ? /* @__PURE__ */ Z(xa, {
|
|
1979
|
-
inputRef:
|
|
1982
|
+
inputRef: ae,
|
|
1980
1983
|
messages: n,
|
|
1981
1984
|
value: E,
|
|
1982
|
-
canApply: !!
|
|
1983
|
-
canOpen: !!
|
|
1984
|
-
canRemove: !!(
|
|
1985
|
+
canApply: !!ue,
|
|
1986
|
+
canOpen: !!ue,
|
|
1987
|
+
canRemove: !!(ee || E.trim()),
|
|
1985
1988
|
onValueChange: D,
|
|
1986
1989
|
onApply: Se,
|
|
1987
1990
|
onOpen: () => mr(E),
|
|
@@ -2002,14 +2005,14 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
2002
2005
|
onTooltipChange: d,
|
|
2003
2006
|
onClose: () => h(null)
|
|
2004
2007
|
}) : null,
|
|
2005
|
-
|
|
2008
|
+
le && m === null ? /* @__PURE__ */ Z("div", {
|
|
2006
2009
|
className: "markweave-floating-toolbar-tooltip",
|
|
2007
2010
|
role: "tooltip",
|
|
2008
2011
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
2009
|
-
"data-button-id":
|
|
2010
|
-
"data-active":
|
|
2012
|
+
"data-button-id": le.buttonId,
|
|
2013
|
+
"data-active": le.active,
|
|
2011
2014
|
style: ra(f),
|
|
2012
|
-
children:
|
|
2015
|
+
children: le.label
|
|
2013
2016
|
}) : null
|
|
2014
2017
|
]
|
|
2015
2018
|
})
|
|
@@ -2349,22 +2352,22 @@ function ja({ id: e }) {
|
|
|
2349
2352
|
var Ma = {
|
|
2350
2353
|
sparkles: xe,
|
|
2351
2354
|
"arrow-up": b,
|
|
2352
|
-
check:
|
|
2353
|
-
"chevron-down":
|
|
2354
|
-
"chevron-up":
|
|
2355
|
-
"corner-down-left":
|
|
2356
|
-
"external-link":
|
|
2355
|
+
check: O,
|
|
2356
|
+
"chevron-down": A,
|
|
2357
|
+
"chevron-up": M,
|
|
2358
|
+
"corner-down-left": ne,
|
|
2359
|
+
"external-link": F,
|
|
2357
2360
|
bold: E,
|
|
2358
|
-
italic:
|
|
2361
|
+
italic: se,
|
|
2359
2362
|
underline: Ne,
|
|
2360
2363
|
strike: we,
|
|
2361
|
-
"inline-code":
|
|
2362
|
-
link:
|
|
2363
|
-
more:
|
|
2364
|
+
"inline-code": N,
|
|
2365
|
+
link: le,
|
|
2366
|
+
more: fe,
|
|
2364
2367
|
text: Me,
|
|
2365
|
-
"bullet-list":
|
|
2366
|
-
"numbered-list":
|
|
2367
|
-
"todo-list":
|
|
2368
|
+
"bullet-list": ue,
|
|
2369
|
+
"numbered-list": U,
|
|
2370
|
+
"todo-list": H,
|
|
2368
2371
|
quote: ge,
|
|
2369
2372
|
"code-block": D,
|
|
2370
2373
|
superscript: Ee,
|
|
@@ -2374,8 +2377,8 @@ var Ma = {
|
|
|
2374
2377
|
"align-center": l,
|
|
2375
2378
|
"align-right": f,
|
|
2376
2379
|
"align-justify": u,
|
|
2377
|
-
"decrease-indent":
|
|
2378
|
-
"increase-indent":
|
|
2380
|
+
"decrease-indent": B,
|
|
2381
|
+
"increase-indent": V,
|
|
2379
2382
|
trash: je,
|
|
2380
2383
|
"rotate-ccw": ve,
|
|
2381
2384
|
square: Se,
|
|
@@ -2521,7 +2524,7 @@ function Na({ editor: e, messages: t, onClose: n, target: r }) {
|
|
|
2521
2524
|
className: "markweave-math-block-toolbar",
|
|
2522
2525
|
children: [
|
|
2523
2526
|
/* @__PURE__ */ Z("span", { children: u.label }),
|
|
2524
|
-
/* @__PURE__ */ Z(
|
|
2527
|
+
/* @__PURE__ */ Z(N, {
|
|
2525
2528
|
"aria-hidden": "true",
|
|
2526
2529
|
size: 15,
|
|
2527
2530
|
strokeWidth: 1.75
|
|
@@ -2532,7 +2535,7 @@ function Na({ editor: e, messages: t, onClose: n, target: r }) {
|
|
|
2532
2535
|
disabled: !m,
|
|
2533
2536
|
title: u.apply,
|
|
2534
2537
|
type: "submit",
|
|
2535
|
-
children: /* @__PURE__ */ Z(
|
|
2538
|
+
children: /* @__PURE__ */ Z(O, {
|
|
2536
2539
|
"aria-hidden": "true",
|
|
2537
2540
|
size: 16,
|
|
2538
2541
|
strokeWidth: 2
|
|
@@ -2579,24 +2582,24 @@ function Na({ editor: e, messages: t, onClose: n, target: r }) {
|
|
|
2579
2582
|
//#region src/ui/slash-command/SlashCommandMenu.tsx
|
|
2580
2583
|
var Pa = n("zh"), Fa = {
|
|
2581
2584
|
type: Ae,
|
|
2582
|
-
"heading-1":
|
|
2583
|
-
"heading-2":
|
|
2584
|
-
"heading-3":
|
|
2585
|
-
"bullet-list":
|
|
2586
|
-
"ordered-list":
|
|
2587
|
-
"task-list":
|
|
2585
|
+
"heading-1": ie,
|
|
2586
|
+
"heading-2": ae,
|
|
2587
|
+
"heading-3": L,
|
|
2588
|
+
"bullet-list": ue,
|
|
2589
|
+
"ordered-list": U,
|
|
2590
|
+
"task-list": H,
|
|
2588
2591
|
blockquote: ge,
|
|
2589
2592
|
"code-block": D,
|
|
2590
|
-
info:
|
|
2591
|
-
tip:
|
|
2593
|
+
info: oe,
|
|
2594
|
+
tip: ce,
|
|
2592
2595
|
warning: c,
|
|
2593
|
-
error:
|
|
2594
|
-
success:
|
|
2596
|
+
error: te,
|
|
2597
|
+
success: k,
|
|
2595
2598
|
emoji: be,
|
|
2596
2599
|
math: ye,
|
|
2597
2600
|
table: De,
|
|
2598
|
-
separator:
|
|
2599
|
-
image:
|
|
2601
|
+
separator: de,
|
|
2602
|
+
image: R,
|
|
2600
2603
|
video: Fe,
|
|
2601
2604
|
attachment: pe
|
|
2602
2605
|
};
|
|
@@ -2888,8 +2891,8 @@ var Ua = n("zh"), Wa = {
|
|
|
2888
2891
|
color: W,
|
|
2889
2892
|
alignment: d,
|
|
2890
2893
|
clear: Ce,
|
|
2891
|
-
duplicate:
|
|
2892
|
-
copy:
|
|
2894
|
+
duplicate: P,
|
|
2895
|
+
copy: P,
|
|
2893
2896
|
merge: Oe,
|
|
2894
2897
|
split: ke,
|
|
2895
2898
|
"ask-ai": xe,
|
|
@@ -2903,37 +2906,37 @@ var Ua = n("zh"), Wa = {
|
|
|
2903
2906
|
bottom: m
|
|
2904
2907
|
};
|
|
2905
2908
|
function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua, onCopyPayload: i, onCommandResult: a, askAi: o }) {
|
|
2906
|
-
let [s, c] = Y(null), [l, u] = Y(null), [d, f] = Y("row-edge"), [p, m] = Y(null), [h, g] = Y(null), [_, v] = Y(null), [y, b] = Y(null), [x, S] = Y(null), [C, w] = Y(null), [T, E] = Y(null), [, D] = Y(0),
|
|
2909
|
+
let [s, c] = Y(null), [l, u] = Y(null), [d, f] = Y("row-edge"), [p, m] = Y(null), [h, g] = Y(null), [_, v] = Y(null), [y, b] = Y(null), [x, S] = Y(null), [C, w] = Y(null), [T, E] = Y(null), [, D] = Y(0), ee = J(null), O = J(null), [k, A] = Y(null), M = J(null), te = J(null), N = J(null), P = J(null), ne = J(null), re = J(null), F = J(null), I = e ? Cn(t.state) : null;
|
|
2907
2910
|
if (K(() => {
|
|
2908
|
-
if (!
|
|
2911
|
+
if (!k) return;
|
|
2909
2912
|
let e = window.setTimeout(() => {
|
|
2910
|
-
|
|
2913
|
+
A(null);
|
|
2911
2914
|
}, li);
|
|
2912
2915
|
return () => {
|
|
2913
2916
|
window.clearTimeout(e);
|
|
2914
2917
|
};
|
|
2915
|
-
}, [
|
|
2918
|
+
}, [k]), K(() => {
|
|
2916
2919
|
let e = (e) => {
|
|
2917
|
-
let n =
|
|
2920
|
+
let n = ee.current;
|
|
2918
2921
|
if (!n) return;
|
|
2919
2922
|
let r = Xr(t, n.axis, e.clientX, e.clientY);
|
|
2920
|
-
r !== null && (e.preventDefault(),
|
|
2923
|
+
r !== null && (e.preventDefault(), O.current = r, e.dataTransfer && (e.dataTransfer.dropEffect = "move"));
|
|
2921
2924
|
}, n = (e) => {
|
|
2922
|
-
let n =
|
|
2925
|
+
let n = ee.current;
|
|
2923
2926
|
if (!n) return;
|
|
2924
|
-
let r = Xr(t, n.axis, e.clientX, e.clientY) ??
|
|
2925
|
-
e.preventDefault(),
|
|
2927
|
+
let r = Xr(t, n.axis, e.clientX, e.clientY) ?? O.current;
|
|
2928
|
+
e.preventDefault(), ee.current = null, O.current = null, r !== null && oi(t, n.axis, n.index, r);
|
|
2926
2929
|
};
|
|
2927
2930
|
return document.addEventListener("dragover", e), document.addEventListener("drop", n), () => {
|
|
2928
2931
|
document.removeEventListener("dragover", e), document.removeEventListener("drop", n);
|
|
2929
2932
|
};
|
|
2930
2933
|
}, [t]), Le(() => {
|
|
2931
2934
|
if (!e) {
|
|
2932
|
-
v(null), b(null), S(null), w(null), E(null),
|
|
2935
|
+
v(null), b(null), S(null), w(null), E(null), A(null);
|
|
2933
2936
|
return;
|
|
2934
2937
|
}
|
|
2935
2938
|
let r = () => {
|
|
2936
|
-
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, r = $r(t, n, "row",
|
|
2939
|
+
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, r = $r(t, n, "row", I?.activeCellPos ?? null), i = $r(t, n, "column", I?.activeCellPos ?? null), a = r ? Qr(t, r) : null, o = i ? Qr(t, i) : null, c = ri(t, "selection").length > 0 ? ii(t) : null, l = Yr(t)?.getBoundingClientRect() ?? null;
|
|
2937
2940
|
if (!e) {
|
|
2938
2941
|
v(null), b(null), S(null), w(null), E(null);
|
|
2939
2942
|
return;
|
|
@@ -2969,9 +2972,9 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
2969
2972
|
}, [
|
|
2970
2973
|
e,
|
|
2971
2974
|
t,
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
+
I?.activeCellPos,
|
|
2976
|
+
I?.selectionFrom,
|
|
2977
|
+
I?.selectionTo,
|
|
2975
2978
|
n.hoverCellPos,
|
|
2976
2979
|
n.hoverVisualColumnIndex,
|
|
2977
2980
|
n.hoverVisualRowIndex,
|
|
@@ -2983,7 +2986,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
2983
2986
|
return;
|
|
2984
2987
|
}
|
|
2985
2988
|
let n = () => {
|
|
2986
|
-
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, n = d === "row-edge" ?
|
|
2989
|
+
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, n = d === "row-edge" ? ne.current : d === "column-edge" ? re.current : F.current, r = te.current;
|
|
2987
2990
|
if (!e || !n || !r) {
|
|
2988
2991
|
m(null);
|
|
2989
2992
|
return;
|
|
@@ -2993,7 +2996,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
2993
2996
|
top: a.top,
|
|
2994
2997
|
width: i.width,
|
|
2995
2998
|
height: i.height
|
|
2996
|
-
} : i, c = e.getBoundingClientRect(), l = r.getBoundingClientRect(), u =
|
|
2999
|
+
} : i, c = e.getBoundingClientRect(), l = r.getBoundingClientRect(), u = N.current?.scrollHeight ?? 0, f = u > 0 ? u + 12 : 0, p = Hr({
|
|
2997
3000
|
anchorRect: o,
|
|
2998
3001
|
frameRect: c,
|
|
2999
3002
|
boundaryRect: ei(e),
|
|
@@ -3022,7 +3025,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3022
3025
|
return;
|
|
3023
3026
|
}
|
|
3024
3027
|
let n = () => {
|
|
3025
|
-
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, n =
|
|
3028
|
+
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, n = te.current, r = P.current, i = n?.querySelector(`[data-submenu-trigger="${l}"]`);
|
|
3026
3029
|
if (!e || !n || !r || !i) {
|
|
3027
3030
|
g(null);
|
|
3028
3031
|
return;
|
|
@@ -3039,7 +3042,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3039
3042
|
}));
|
|
3040
3043
|
};
|
|
3041
3044
|
n();
|
|
3042
|
-
let r =
|
|
3045
|
+
let r = N.current;
|
|
3043
3046
|
return r?.addEventListener("scroll", n), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
|
|
3044
3047
|
r?.removeEventListener("scroll", n), window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
3045
3048
|
};
|
|
@@ -3060,7 +3063,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3060
3063
|
c(null), u(null), t.view.focus();
|
|
3061
3064
|
}
|
|
3062
3065
|
}, r = (e) => {
|
|
3063
|
-
e.target instanceof Node &&
|
|
3066
|
+
e.target instanceof Node && M.current?.contains(e.target) || (c(null), u(null));
|
|
3064
3067
|
};
|
|
3065
3068
|
return document.addEventListener("keydown", n), document.addEventListener("mousedown", r), () => {
|
|
3066
3069
|
document.removeEventListener("keydown", n), document.removeEventListener("mousedown", r);
|
|
@@ -3071,37 +3074,37 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3071
3074
|
s,
|
|
3072
3075
|
l
|
|
3073
3076
|
]), !e) return null;
|
|
3074
|
-
let
|
|
3077
|
+
let ie = (e, t) => {
|
|
3075
3078
|
let n = s === e && d === t;
|
|
3076
3079
|
f(t), c(n ? null : e), u(null);
|
|
3077
|
-
},
|
|
3080
|
+
}, ae = () => {
|
|
3078
3081
|
t.view.dispatch(Rr(t.state.tr, null));
|
|
3079
|
-
},
|
|
3080
|
-
let i = n.hoverCellPos ??
|
|
3081
|
-
i !== null && si(t, i, e, { visualIndex: a }),
|
|
3082
|
-
},
|
|
3083
|
-
|
|
3084
|
-
},
|
|
3082
|
+
}, L = (e, r) => {
|
|
3083
|
+
let i = n.hoverCellPos ?? I?.activeCellPos ?? null, a = n.hoverCellPos === null ? null : e === "row" ? n.hoverVisualRowIndex : n.hoverVisualColumnIndex;
|
|
3084
|
+
i !== null && si(t, i, e, { visualIndex: a }), ie(e, r);
|
|
3085
|
+
}, R = () => {
|
|
3086
|
+
ae(), ie("selection", "selection-edge");
|
|
3087
|
+
}, z = $r(t, n, "row", I?.activeCellPos ?? null), B = $r(t, n, "column", I?.activeCellPos ?? null), V = o?.enabled === !0 && typeof o.handler == "function", oe = ri(t, "selection", { askAiEnabled: V }).length > 0, se = s ? ri(t, s, { askAiEnabled: V }) : [], ce = async (e, n) => {
|
|
3085
3088
|
let o = await qr({
|
|
3086
3089
|
editor: t,
|
|
3087
3090
|
commandId: e,
|
|
3088
3091
|
menu: n ?? s ?? "selection",
|
|
3089
3092
|
messages: r
|
|
3090
3093
|
});
|
|
3091
|
-
return o.copyFeedback ? (
|
|
3094
|
+
return o.copyFeedback ? (A(o.copyFeedback), o.copyPayload && i?.(o.copyPayload)) : A(null), a?.(o.commandResult), o.success;
|
|
3095
|
+
}, le = (e) => {
|
|
3096
|
+
!V || !Fr(t, e) || (c(null), u(null));
|
|
3092
3097
|
}, ue = (e) => {
|
|
3093
|
-
!B || !Fr(t, e) || (c(null), u(null));
|
|
3094
|
-
}, de = (e) => {
|
|
3095
3098
|
s !== "row" && s !== "column" || e(s) && D((e) => e + 1);
|
|
3096
|
-
},
|
|
3097
|
-
let r = e === "row" ?
|
|
3098
|
-
!r || i === null || pi(t, i, e, { visualIndex: r.index }) &&
|
|
3099
|
-
},
|
|
3100
|
-
|
|
3099
|
+
}, H = (e) => {
|
|
3100
|
+
let r = e === "row" ? z : B, i = n.hoverCellPos ?? I?.activeCellPos ?? null;
|
|
3101
|
+
!r || i === null || pi(t, i, e, { visualIndex: r.index }) && ce(e === "row" ? "add-row-after" : "add-column-after", e);
|
|
3102
|
+
}, U = (e, t, n) => {
|
|
3103
|
+
ee.current = {
|
|
3101
3104
|
axis: e,
|
|
3102
3105
|
index: t
|
|
3103
|
-
},
|
|
3104
|
-
},
|
|
3106
|
+
}, O.current = t, n.dataTransfer.effectAllowed = "move", n.dataTransfer.setData("application/x-markweave-table-axis", `${e}:${t}`);
|
|
3107
|
+
}, de = (e) => {
|
|
3105
3108
|
let t = e.currentTarget, n = t.classList.contains("markweave-table-menu") ? t.querySelector(":scope > .markweave-table-menu-scroll") ?? t : t, r = Array.from(n.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), i = r.indexOf(document.activeElement);
|
|
3106
3109
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
3107
3110
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -3110,7 +3113,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3110
3113
|
}
|
|
3111
3114
|
}, W = s === "row" || s === "column" ? Zr(t, s) : null;
|
|
3112
3115
|
return /* @__PURE__ */ Q("div", {
|
|
3113
|
-
ref:
|
|
3116
|
+
ref: M,
|
|
3114
3117
|
className: "markweave-table-controls",
|
|
3115
3118
|
"data-testid": "markweave-table-controls",
|
|
3116
3119
|
"aria-label": r.table.controlsAriaLabel,
|
|
@@ -3120,29 +3123,29 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3120
3123
|
t.view.dispatch(t.state.tr.setMeta(En, { type: "clear-hover" }));
|
|
3121
3124
|
},
|
|
3122
3125
|
children: [
|
|
3123
|
-
|
|
3126
|
+
k ? /* @__PURE__ */ Z("div", {
|
|
3124
3127
|
className: "markweave-table-copy-feedback",
|
|
3125
3128
|
role: "status",
|
|
3126
3129
|
"aria-live": "polite",
|
|
3127
3130
|
"data-testid": "markweave-table-copy-feedback",
|
|
3128
|
-
"data-copy-kind":
|
|
3129
|
-
"data-text-length":
|
|
3130
|
-
"data-html-length":
|
|
3131
|
-
children: Jr(
|
|
3131
|
+
"data-copy-kind": k.kind,
|
|
3132
|
+
"data-text-length": k.textLength,
|
|
3133
|
+
"data-html-length": k.htmlLength,
|
|
3134
|
+
children: Jr(k)
|
|
3132
3135
|
}) : null,
|
|
3133
3136
|
_ ? /* @__PURE__ */ Z("button", {
|
|
3134
3137
|
type: "button",
|
|
3135
|
-
ref:
|
|
3138
|
+
ref: ne,
|
|
3136
3139
|
className: "markweave-table-edge-handle markweave-table-edge-handle--row",
|
|
3137
3140
|
"aria-label": r.table.activeRowActions,
|
|
3138
3141
|
"aria-expanded": s === "row" && d === "row-edge",
|
|
3139
3142
|
"aria-haspopup": "menu",
|
|
3140
3143
|
title: r.table.rowActions,
|
|
3141
3144
|
"data-testid": "markweave-table-hover-row-handle",
|
|
3142
|
-
"data-axis-index":
|
|
3143
|
-
"data-axis-selected-cells":
|
|
3144
|
-
"data-axis-visual-cells":
|
|
3145
|
-
"data-axis-visual-size":
|
|
3145
|
+
"data-axis-index": z?.index ?? "",
|
|
3146
|
+
"data-axis-selected-cells": z?.selectedCellCount ?? "",
|
|
3147
|
+
"data-axis-visual-cells": z?.visualCellCount ?? "",
|
|
3148
|
+
"data-axis-visual-size": z?.visualHeight ?? "",
|
|
3146
3149
|
style: {
|
|
3147
3150
|
left: _.left,
|
|
3148
3151
|
top: _.top,
|
|
@@ -3150,31 +3153,31 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3150
3153
|
height: _.height
|
|
3151
3154
|
},
|
|
3152
3155
|
draggable: !0,
|
|
3153
|
-
onDragStart: (e) =>
|
|
3156
|
+
onDragStart: (e) => U("row", z?.index ?? 0, e),
|
|
3154
3157
|
onDragEnd: () => {
|
|
3155
|
-
|
|
3158
|
+
ee.current = null, O.current = null;
|
|
3156
3159
|
},
|
|
3157
3160
|
onClick: () => {
|
|
3158
|
-
|
|
3161
|
+
L("row", "row-edge");
|
|
3159
3162
|
},
|
|
3160
|
-
children: /* @__PURE__ */ Z(
|
|
3163
|
+
children: /* @__PURE__ */ Z(fe, {
|
|
3161
3164
|
"aria-hidden": "true",
|
|
3162
3165
|
size: 14
|
|
3163
3166
|
})
|
|
3164
3167
|
}) : null,
|
|
3165
3168
|
y ? /* @__PURE__ */ Z("button", {
|
|
3166
3169
|
type: "button",
|
|
3167
|
-
ref:
|
|
3170
|
+
ref: re,
|
|
3168
3171
|
className: "markweave-table-edge-handle markweave-table-edge-handle--column",
|
|
3169
3172
|
"aria-label": r.table.activeColumnActions,
|
|
3170
3173
|
"aria-expanded": s === "column" && d === "column-edge",
|
|
3171
3174
|
"aria-haspopup": "menu",
|
|
3172
3175
|
title: r.table.columnActions,
|
|
3173
3176
|
"data-testid": "markweave-table-hover-column-handle",
|
|
3174
|
-
"data-axis-index":
|
|
3175
|
-
"data-axis-selected-cells":
|
|
3176
|
-
"data-axis-visual-cells":
|
|
3177
|
-
"data-axis-visual-size":
|
|
3177
|
+
"data-axis-index": B?.index ?? "",
|
|
3178
|
+
"data-axis-selected-cells": B?.selectedCellCount ?? "",
|
|
3179
|
+
"data-axis-visual-cells": B?.visualCellCount ?? "",
|
|
3180
|
+
"data-axis-visual-size": B?.visualWidth ?? "",
|
|
3178
3181
|
style: {
|
|
3179
3182
|
left: y.left,
|
|
3180
3183
|
top: y.top,
|
|
@@ -3182,14 +3185,14 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3182
3185
|
height: y.height
|
|
3183
3186
|
},
|
|
3184
3187
|
draggable: !0,
|
|
3185
|
-
onDragStart: (e) =>
|
|
3188
|
+
onDragStart: (e) => U("column", B?.index ?? 0, e),
|
|
3186
3189
|
onDragEnd: () => {
|
|
3187
|
-
|
|
3190
|
+
ee.current = null, O.current = null;
|
|
3188
3191
|
},
|
|
3189
3192
|
onClick: () => {
|
|
3190
|
-
|
|
3193
|
+
L("column", "column-edge");
|
|
3191
3194
|
},
|
|
3192
|
-
children: /* @__PURE__ */ Z(
|
|
3195
|
+
children: /* @__PURE__ */ Z(fe, {
|
|
3193
3196
|
"aria-hidden": "true",
|
|
3194
3197
|
size: 14
|
|
3195
3198
|
})
|
|
@@ -3207,7 +3210,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3207
3210
|
height: C.height
|
|
3208
3211
|
},
|
|
3209
3212
|
onMouseDown: (e) => e.preventDefault(),
|
|
3210
|
-
onClick: () =>
|
|
3213
|
+
onClick: () => H("row"),
|
|
3211
3214
|
children: /* @__PURE__ */ Z(he, {
|
|
3212
3215
|
"aria-hidden": "true",
|
|
3213
3216
|
size: 16
|
|
@@ -3226,15 +3229,15 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3226
3229
|
height: T.height
|
|
3227
3230
|
},
|
|
3228
3231
|
onMouseDown: (e) => e.preventDefault(),
|
|
3229
|
-
onClick: () =>
|
|
3232
|
+
onClick: () => H("column"),
|
|
3230
3233
|
children: /* @__PURE__ */ Z(he, {
|
|
3231
3234
|
"aria-hidden": "true",
|
|
3232
3235
|
size: 16
|
|
3233
3236
|
})
|
|
3234
3237
|
}) : null,
|
|
3235
|
-
|
|
3238
|
+
oe && x ? /* @__PURE__ */ Z("button", {
|
|
3236
3239
|
type: "button",
|
|
3237
|
-
ref:
|
|
3240
|
+
ref: F,
|
|
3238
3241
|
className: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
3239
3242
|
"aria-label": r.table.selectionActions,
|
|
3240
3243
|
"aria-expanded": s === "selection" && d === "selection-edge",
|
|
@@ -3248,14 +3251,14 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3248
3251
|
height: x.height
|
|
3249
3252
|
},
|
|
3250
3253
|
onMouseDown: (e) => e.preventDefault(),
|
|
3251
|
-
onClick:
|
|
3252
|
-
children: /* @__PURE__ */ Z(
|
|
3254
|
+
onClick: R,
|
|
3255
|
+
children: /* @__PURE__ */ Z(fe, {
|
|
3253
3256
|
"aria-hidden": "true",
|
|
3254
3257
|
size: 14
|
|
3255
3258
|
})
|
|
3256
3259
|
}) : null,
|
|
3257
3260
|
s ? /* @__PURE__ */ Q("div", {
|
|
3258
|
-
ref:
|
|
3261
|
+
ref: te,
|
|
3259
3262
|
className: "markweave-table-menu",
|
|
3260
3263
|
role: "menu",
|
|
3261
3264
|
"aria-label": di(s, r),
|
|
@@ -3267,14 +3270,14 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3267
3270
|
left: p.left,
|
|
3268
3271
|
top: p.top
|
|
3269
3272
|
} : void 0,
|
|
3270
|
-
onKeyDown:
|
|
3273
|
+
onKeyDown: de,
|
|
3271
3274
|
children: [
|
|
3272
3275
|
/* @__PURE__ */ Z("div", {
|
|
3273
|
-
ref:
|
|
3276
|
+
ref: N,
|
|
3274
3277
|
className: "markweave-table-menu-scroll",
|
|
3275
3278
|
style: p ? { maxHeight: Math.max(1, p.maxHeight - 12) } : void 0,
|
|
3276
|
-
children:
|
|
3277
|
-
let i = ti(e), a = n === 0 ? i : ti(
|
|
3279
|
+
children: se.map((e, n) => {
|
|
3280
|
+
let i = ti(e), a = n === 0 ? i : ti(se[n - 1]), o = n > 0 && a !== i, d = s === "row" || s === "column" ? s : "selection", f = e.submenuId ? !0 : e.id === "edit-with-ai" ? V && wr(t, d) : e.commandId === null ? !1 : Kr(t, e.commandId), p = ni(e, r), m = Wa[e.icon];
|
|
3278
3281
|
return /* @__PURE__ */ Q("button", {
|
|
3279
3282
|
type: "button",
|
|
3280
3283
|
role: "menuitem",
|
|
@@ -3283,14 +3286,14 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3283
3286
|
"aria-haspopup": e.submenuId ? "menu" : void 0,
|
|
3284
3287
|
"aria-expanded": e.submenuId ? l === e.submenuId : void 0,
|
|
3285
3288
|
disabled: !f,
|
|
3286
|
-
title: e.id === "edit-with-ai" &&
|
|
3289
|
+
title: e.id === "edit-with-ai" && V && !f ? r.askAi.tableMergedUnsupported : void 0,
|
|
3287
3290
|
"data-menu-group": i,
|
|
3288
3291
|
"data-starts-group": o ? "true" : "false",
|
|
3289
3292
|
"data-command-enabled": f ? "true" : "false",
|
|
3290
3293
|
"data-submenu-trigger": e.submenuId ?? void 0,
|
|
3291
3294
|
"data-testid": e.commandId ? `markweave-table-menu-command-${e.commandId}` : e.submenuId ? `markweave-table-menu-submenu-${e.submenuId}` : "markweave-table-menu-command-edit-with-ai",
|
|
3292
3295
|
onMouseDown: (t) => {
|
|
3293
|
-
t.preventDefault(), f && e.id === "edit-with-ai" &&
|
|
3296
|
+
t.preventDefault(), f && e.id === "edit-with-ai" && le(d);
|
|
3294
3297
|
},
|
|
3295
3298
|
onMouseEnter: () => u(e.submenuId),
|
|
3296
3299
|
onClick: (t) => {
|
|
@@ -3300,10 +3303,10 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3300
3303
|
return;
|
|
3301
3304
|
}
|
|
3302
3305
|
if (e.commandId === null) {
|
|
3303
|
-
t.detail === 0 &&
|
|
3306
|
+
t.detail === 0 && le(d);
|
|
3304
3307
|
return;
|
|
3305
3308
|
}
|
|
3306
|
-
|
|
3309
|
+
ce(e.commandId).finally(() => {
|
|
3307
3310
|
c(null), u(null);
|
|
3308
3311
|
});
|
|
3309
3312
|
}
|
|
@@ -3331,7 +3334,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3331
3334
|
})
|
|
3332
3335
|
}),
|
|
3333
3336
|
l === "color" && (s === "row" || s === "column") ? /* @__PURE__ */ Q("div", {
|
|
3334
|
-
ref:
|
|
3337
|
+
ref: P,
|
|
3335
3338
|
className: "markweave-table-submenu markweave-table-color-menu",
|
|
3336
3339
|
role: "menu",
|
|
3337
3340
|
"aria-label": r.table.submenus.color,
|
|
@@ -3343,7 +3346,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3343
3346
|
top: h.top,
|
|
3344
3347
|
maxHeight: h.maxHeight
|
|
3345
3348
|
} : void 0,
|
|
3346
|
-
onKeyDown:
|
|
3349
|
+
onKeyDown: de,
|
|
3347
3350
|
children: [
|
|
3348
3351
|
/* @__PURE__ */ Z("div", {
|
|
3349
3352
|
className: "markweave-table-submenu-title",
|
|
@@ -3356,7 +3359,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3356
3359
|
"data-active": W?.textColorId === e.id ? "true" : "false",
|
|
3357
3360
|
"data-testid": `markweave-table-text-color-${e.id}`,
|
|
3358
3361
|
onMouseDown: (e) => e.preventDefault(),
|
|
3359
|
-
onClick: () =>
|
|
3362
|
+
onClick: () => ue((n) => Vr(t, n, e.id)),
|
|
3360
3363
|
children: [/* @__PURE__ */ Z("span", {
|
|
3361
3364
|
className: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3362
3365
|
"aria-hidden": "true",
|
|
@@ -3375,7 +3378,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3375
3378
|
"data-active": W?.backgroundColorId === e.id ? "true" : "false",
|
|
3376
3379
|
"data-testid": `markweave-table-background-color-${e.id}`,
|
|
3377
3380
|
onMouseDown: (e) => e.preventDefault(),
|
|
3378
|
-
onClick: () =>
|
|
3381
|
+
onClick: () => ue((n) => Br(t, n, e.id)),
|
|
3379
3382
|
children: [/* @__PURE__ */ Z("span", {
|
|
3380
3383
|
className: "markweave-table-color-swatch",
|
|
3381
3384
|
"aria-hidden": "true",
|
|
@@ -3385,7 +3388,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3385
3388
|
]
|
|
3386
3389
|
}) : null,
|
|
3387
3390
|
l === "alignment" && (s === "row" || s === "column") ? /* @__PURE__ */ Q("div", {
|
|
3388
|
-
ref:
|
|
3391
|
+
ref: P,
|
|
3389
3392
|
className: "markweave-table-submenu markweave-table-alignment-menu",
|
|
3390
3393
|
role: "menu",
|
|
3391
3394
|
"aria-label": r.table.submenus.alignment,
|
|
@@ -3397,7 +3400,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3397
3400
|
top: h.top,
|
|
3398
3401
|
maxHeight: h.maxHeight
|
|
3399
3402
|
} : void 0,
|
|
3400
|
-
onKeyDown:
|
|
3403
|
+
onKeyDown: de,
|
|
3401
3404
|
children: [
|
|
3402
3405
|
ui.map((e) => {
|
|
3403
3406
|
let n = Ga[e], i = W?.textAlign === e;
|
|
@@ -3408,7 +3411,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3408
3411
|
"data-active": i ? "true" : "false",
|
|
3409
3412
|
"data-testid": `markweave-table-alignment-${e}`,
|
|
3410
3413
|
onMouseDown: (e) => e.preventDefault(),
|
|
3411
|
-
onClick: () =>
|
|
3414
|
+
onClick: () => ue((n) => zr(t, n, e)),
|
|
3412
3415
|
children: [/* @__PURE__ */ Z(n, {
|
|
3413
3416
|
"aria-hidden": "true",
|
|
3414
3417
|
size: 18,
|
|
@@ -3426,7 +3429,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3426
3429
|
"data-active": i ? "true" : "false",
|
|
3427
3430
|
"data-testid": `markweave-table-alignment-${e}`,
|
|
3428
3431
|
onMouseDown: (e) => e.preventDefault(),
|
|
3429
|
-
onClick: () =>
|
|
3432
|
+
onClick: () => ue((n) => zr(t, n, e)),
|
|
3430
3433
|
children: [/* @__PURE__ */ Z(n, {
|
|
3431
3434
|
"aria-hidden": "true",
|
|
3432
3435
|
size: 18,
|
|
@@ -3576,48 +3579,48 @@ function no(e) {
|
|
|
3576
3579
|
}
|
|
3577
3580
|
globalThis.clearTimeout(e);
|
|
3578
3581
|
}
|
|
3579
|
-
function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autofocus: o = !1, content: c, contentFormat: l, defaultContent: u = "", defaultContentFormat: d, editable: f = !0, innerToc: p = !0, innerTocPlacement: m, lang: h, mode: g = "live", theme: _, canvasColor: v, onEditWithAi: y, onExtractToNote: b, onRewriteSelection: x, onAiEditControllerChange: S, onRuntimeStateChange: C, onSearchControllerChange: w, onSlashCommandUpload: T, onTableCommandResult: E, onTableCopyPayload: D, onTocChange:
|
|
3580
|
-
let j = rt(g),
|
|
3582
|
+
function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autofocus: o = !1, content: c, contentFormat: l, defaultContent: u = "", defaultContentFormat: d, editable: f = !0, innerToc: p = !0, innerTocPlacement: m, lang: h, mode: g = "live", theme: _, canvasColor: v, onEditWithAi: y, onExtractToNote: b, onRewriteSelection: x, onAiEditControllerChange: S, onRuntimeStateChange: C, onSearchControllerChange: w, onSlashCommandUpload: T, onTableCommandResult: E, onTableCopyPayload: D, onTocChange: ee, onUpdate: O, linkCardResolver: k, resolveMediaSource: A } = {}) {
|
|
3583
|
+
let j = rt(g), M = Ci(_), te = Si(v), N = yi(m), P = j === "live" && f !== !1, ne = Ct(c === void 0 ? d : l), re = c ?? u, F = typeof re == "string" && re.length >= 2e5, I = c === void 0 && ne === "markdown" && F && typeof re == "string", ie = J(I ? re : null), [ae, L] = Y(I), R = J({
|
|
3581
3584
|
editorMode: j,
|
|
3582
|
-
effectiveEditable:
|
|
3585
|
+
effectiveEditable: P
|
|
3583
3586
|
});
|
|
3584
|
-
|
|
3587
|
+
R.current = {
|
|
3585
3588
|
editorMode: j,
|
|
3586
|
-
effectiveEditable:
|
|
3589
|
+
effectiveEditable: P
|
|
3587
3590
|
};
|
|
3588
|
-
let
|
|
3589
|
-
|
|
3590
|
-
let
|
|
3591
|
-
|
|
3592
|
-
let
|
|
3593
|
-
|
|
3594
|
-
let
|
|
3595
|
-
|
|
3596
|
-
let
|
|
3597
|
-
|
|
3598
|
-
let
|
|
3599
|
-
lang:
|
|
3591
|
+
let z = J(null);
|
|
3592
|
+
z.current === null && (z.current = r(h));
|
|
3593
|
+
let B = z.current, V = q(() => n(B), [B]), oe = q(() => t(B), [B]), se = J(T);
|
|
3594
|
+
se.current = T;
|
|
3595
|
+
let ce = J(w);
|
|
3596
|
+
ce.current = w;
|
|
3597
|
+
let le = J(S);
|
|
3598
|
+
le.current = S;
|
|
3599
|
+
let ue = J(k);
|
|
3600
|
+
ue.current = k;
|
|
3601
|
+
let H = q(() => Yi({
|
|
3602
|
+
lang: B,
|
|
3600
3603
|
onImageUpload: (e) => {
|
|
3601
|
-
if (
|
|
3604
|
+
if (se.current) return se.current(e);
|
|
3602
3605
|
let t = Be(e);
|
|
3603
3606
|
if (!t) throw Error("File upload requires an upload handler.");
|
|
3604
3607
|
return t;
|
|
3605
3608
|
},
|
|
3606
3609
|
onVideoUpload: (e) => {
|
|
3607
|
-
if (
|
|
3610
|
+
if (se.current) return se.current(e);
|
|
3608
3611
|
let t = Be(e);
|
|
3609
3612
|
if (!t) throw Error("File upload requires an upload handler.");
|
|
3610
3613
|
return t;
|
|
3611
3614
|
},
|
|
3612
|
-
linkCardResolver: (e) =>
|
|
3613
|
-
resolveMediaSource:
|
|
3614
|
-
}), [
|
|
3615
|
+
linkCardResolver: (e) => ue.current?.(e) ?? Promise.resolve(null),
|
|
3616
|
+
resolveMediaSource: A
|
|
3617
|
+
}), [A, B]), [U, de] = Y(null), [fe, W] = Y(yn), [pe, me] = Y(null), [he, ge] = Y(null), [_e, ve] = Y("code"), [ye, be] = Y(null), [xe, Se] = Y(Tn), [Ce, we] = Y(null), [Te, Ee] = Y(0), De = J(!1), Oe = J({
|
|
3615
3618
|
content: c,
|
|
3616
|
-
format:
|
|
3617
|
-
}), ke = J(null), Ae = J(null), je = J({ onUpdate:
|
|
3618
|
-
je.current = { onUpdate:
|
|
3619
|
+
format: ne
|
|
3620
|
+
}), ke = J(null), Ae = J(null), je = J({ onUpdate: O }), Me = q(() => ln(fe.query, oe), [oe, fe.query]);
|
|
3621
|
+
je.current = { onUpdate: O }, Oe.current = {
|
|
3619
3622
|
content: c,
|
|
3620
|
-
format:
|
|
3623
|
+
format: ne
|
|
3621
3624
|
};
|
|
3622
3625
|
let Ne = G(() => {
|
|
3623
3626
|
Ae.current !== null && (window.clearTimeout(Ae.current), Ae.current = null), Ee((e) => e + 1);
|
|
@@ -3649,7 +3652,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3649
3652
|
me((e) => pn(e, a) ? e : a), W((e) => hn(e, t));
|
|
3650
3653
|
}, []), Le = G((e) => Ie(e.view), [Ie]), Re = G((e) => {
|
|
3651
3654
|
let t = jt(e);
|
|
3652
|
-
|
|
3655
|
+
de((e) => Dt(e, t) ? e : t);
|
|
3653
3656
|
let n = rn(e);
|
|
3654
3657
|
n && (on(e, n, !0), be(n));
|
|
3655
3658
|
let r = zt(e);
|
|
@@ -3658,27 +3661,27 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3658
3661
|
Se($a(e));
|
|
3659
3662
|
}, []), X = s({
|
|
3660
3663
|
shouldRerenderOnTransaction: !1,
|
|
3661
|
-
extensions:
|
|
3662
|
-
content:
|
|
3663
|
-
contentType: bt(
|
|
3664
|
-
editable:
|
|
3664
|
+
extensions: H,
|
|
3665
|
+
content: I ? "" : re,
|
|
3666
|
+
contentType: bt(ne),
|
|
3667
|
+
editable: P,
|
|
3665
3668
|
autofocus: o,
|
|
3666
3669
|
editorProps: {
|
|
3667
3670
|
attributes: {
|
|
3668
3671
|
class: "markweave-editor-surface",
|
|
3669
3672
|
"data-testid": "markweave-editor-surface",
|
|
3670
|
-
"data-markweave-large-document":
|
|
3673
|
+
"data-markweave-large-document": F ? "true" : "false",
|
|
3671
3674
|
autocapitalize: "off",
|
|
3672
3675
|
autocorrect: "off",
|
|
3673
3676
|
spellcheck: "false",
|
|
3674
3677
|
translate: "no"
|
|
3675
3678
|
},
|
|
3676
|
-
handleClick: (e, t, n) =>
|
|
3679
|
+
handleClick: (e, t, n) => R.current.effectiveEditable ? !1 : wt(n),
|
|
3677
3680
|
handleDOMEvents: {
|
|
3678
|
-
compositionstart: () =>
|
|
3679
|
-
compositionend: (e) => (
|
|
3681
|
+
compositionstart: () => R.current.effectiveEditable ? (W((e) => bn(e, { type: "composition-start" })), me(null), !1) : !1,
|
|
3682
|
+
compositionend: (e) => (R.current.effectiveEditable && window.setTimeout(() => Ie(e), 0), !1),
|
|
3680
3683
|
click: (e, t) => {
|
|
3681
|
-
if (
|
|
3684
|
+
if (R.current.effectiveEditable) {
|
|
3682
3685
|
let n = nn(e, t);
|
|
3683
3686
|
return n ? (t.preventDefault(), t.stopPropagation(), Fe(), sn(e, n, !0), cn(e, n), be(n), !0) : (be(null), !1);
|
|
3684
3687
|
}
|
|
@@ -3690,7 +3693,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3690
3693
|
Re(e);
|
|
3691
3694
|
},
|
|
3692
3695
|
onCreate: ({ editor: e }) => {
|
|
3693
|
-
a &&
|
|
3696
|
+
a && R.current.effectiveEditable && Sn(e), ze(e), Re(e), Ne();
|
|
3694
3697
|
},
|
|
3695
3698
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3696
3699
|
ze(e), (t.docChanged || Gt(t)) && Pe(), t.docChanged && be((t) => {
|
|
@@ -3700,7 +3703,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3700
3703
|
});
|
|
3701
3704
|
},
|
|
3702
3705
|
onUpdate: ({ editor: e }) => {
|
|
3703
|
-
Re(e),
|
|
3706
|
+
Re(e), R.current.effectiveEditable && Le(e), De.current || je.current.onUpdate?.(yt(e, { onContentRead: (t, n) => {
|
|
3704
3707
|
let r = Oe.current;
|
|
3705
3708
|
r.content !== void 0 && t === r.format && (ke.current = {
|
|
3706
3709
|
content: n,
|
|
@@ -3711,7 +3714,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3711
3714
|
}
|
|
3712
3715
|
});
|
|
3713
3716
|
K(() => {
|
|
3714
|
-
let e =
|
|
3717
|
+
let e = ie.current;
|
|
3715
3718
|
if (!X || !e) return;
|
|
3716
3719
|
let t = !1;
|
|
3717
3720
|
return (async () => {
|
|
@@ -3726,7 +3729,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3726
3729
|
X.view.dispatch(a.setMeta("addToHistory", !1)), n = !1;
|
|
3727
3730
|
}
|
|
3728
3731
|
if (t) return;
|
|
3729
|
-
Re(X), ze(X), Ne(),
|
|
3732
|
+
Re(X), ze(X), Ne(), ie.current = null, L(!1);
|
|
3730
3733
|
} finally {
|
|
3731
3734
|
De.current = !1;
|
|
3732
3735
|
}
|
|
@@ -3734,7 +3737,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3734
3737
|
t || (X.commands.setContent(e, {
|
|
3735
3738
|
contentType: "markdown",
|
|
3736
3739
|
emitUpdate: !1
|
|
3737
|
-
}),
|
|
3740
|
+
}), ie.current = null, L(!1));
|
|
3738
3741
|
}), () => {
|
|
3739
3742
|
t = !0;
|
|
3740
3743
|
};
|
|
@@ -3744,30 +3747,30 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3744
3747
|
Re,
|
|
3745
3748
|
ze
|
|
3746
3749
|
]), K(() => {
|
|
3747
|
-
if (X) return
|
|
3748
|
-
|
|
3750
|
+
if (X) return ce.current?.(Ti(X)), () => {
|
|
3751
|
+
ce.current?.(null);
|
|
3749
3752
|
};
|
|
3750
3753
|
}, [X]), K(() => {
|
|
3751
|
-
if (X) return
|
|
3752
|
-
|
|
3754
|
+
if (X) return le.current?.(Ei(X)), () => {
|
|
3755
|
+
le.current?.(null);
|
|
3753
3756
|
};
|
|
3754
3757
|
}, [X]), K(() => {
|
|
3755
3758
|
if (!X) return;
|
|
3756
|
-
let e =
|
|
3759
|
+
let e = P && !ae;
|
|
3757
3760
|
X.setEditable(e), it(X, {
|
|
3758
3761
|
mode: j,
|
|
3759
3762
|
editable: e
|
|
3760
|
-
}), qt(X, e ? "live" : "view"), Ne(),
|
|
3763
|
+
}), qt(X, e ? "live" : "view"), Ne(), P || Fe();
|
|
3761
3764
|
}, [
|
|
3762
3765
|
Fe,
|
|
3763
3766
|
X,
|
|
3764
3767
|
j,
|
|
3765
|
-
|
|
3768
|
+
P,
|
|
3766
3769
|
Ne,
|
|
3767
|
-
|
|
3770
|
+
ae
|
|
3768
3771
|
]), K(() => {
|
|
3769
|
-
X && Kt(X,
|
|
3770
|
-
}, [X,
|
|
3772
|
+
X && Kt(X, M);
|
|
3773
|
+
}, [X, M]), K(() => {
|
|
3771
3774
|
let e = Ct(l);
|
|
3772
3775
|
if (!(!X || c === void 0)) {
|
|
3773
3776
|
if (St(X, ke.current, c, e)) {
|
|
@@ -3777,12 +3780,12 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3777
3780
|
ke.current = null, !xt(X, c, e) && (De.current = !0, X.commands.setContent(c, {
|
|
3778
3781
|
contentType: bt(e),
|
|
3779
3782
|
emitUpdate: !1
|
|
3780
|
-
}), De.current = !1, Re(X),
|
|
3783
|
+
}), De.current = !1, Re(X), P && Le(X), ze(X), Ne());
|
|
3781
3784
|
}
|
|
3782
3785
|
}, [
|
|
3783
3786
|
c,
|
|
3784
3787
|
l,
|
|
3785
|
-
|
|
3788
|
+
P,
|
|
3786
3789
|
X,
|
|
3787
3790
|
Ne,
|
|
3788
3791
|
Re,
|
|
@@ -3813,13 +3816,13 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3813
3816
|
let He = q(() => X ? zt(X) : Za, [
|
|
3814
3817
|
X,
|
|
3815
3818
|
Te,
|
|
3816
|
-
|
|
3819
|
+
U
|
|
3817
3820
|
]), Ue = q(() => X ? Cn(X.state) : Xa, [
|
|
3818
3821
|
X,
|
|
3819
3822
|
Te,
|
|
3820
|
-
|
|
3823
|
+
U,
|
|
3821
3824
|
xe
|
|
3822
|
-
]), We =
|
|
3825
|
+
]), We = U?.currentNode === "codeBlock", Ge = We && He.language === "mermaid", Ke = q(() => X ? Yt({
|
|
3823
3826
|
active: Ge,
|
|
3824
3827
|
mode: _e,
|
|
3825
3828
|
source: He.text
|
|
@@ -3863,10 +3866,10 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3863
3866
|
let Qe = q(() => Tt({
|
|
3864
3867
|
revision: Te,
|
|
3865
3868
|
mode: j,
|
|
3866
|
-
editable:
|
|
3869
|
+
editable: P,
|
|
3867
3870
|
toc: Xe,
|
|
3868
|
-
selection:
|
|
3869
|
-
slash:
|
|
3871
|
+
selection: U,
|
|
3872
|
+
slash: fe,
|
|
3870
3873
|
table: Ue,
|
|
3871
3874
|
tableInteraction: xe,
|
|
3872
3875
|
codeBlock: He,
|
|
@@ -3875,11 +3878,11 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3875
3878
|
}), [
|
|
3876
3879
|
He,
|
|
3877
3880
|
j,
|
|
3878
|
-
|
|
3881
|
+
P,
|
|
3879
3882
|
Ke,
|
|
3880
3883
|
Te,
|
|
3881
|
-
H,
|
|
3882
3884
|
U,
|
|
3885
|
+
fe,
|
|
3883
3886
|
qe,
|
|
3884
3887
|
Ue,
|
|
3885
3888
|
xe,
|
|
@@ -3888,21 +3891,21 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3888
3891
|
K(() => {
|
|
3889
3892
|
C?.(Qe);
|
|
3890
3893
|
}, [C, Qe]), K(() => {
|
|
3891
|
-
|
|
3892
|
-
}, [
|
|
3894
|
+
ee?.(Xe);
|
|
3895
|
+
}, [ee, Xe]);
|
|
3893
3896
|
let $e = G((e, t) => {
|
|
3894
|
-
if (!(!X || !
|
|
3897
|
+
if (!(!X || !P) && un(e)) {
|
|
3895
3898
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3896
3899
|
ge(e);
|
|
3897
3900
|
return;
|
|
3898
3901
|
}
|
|
3899
|
-
mn(X,
|
|
3902
|
+
mn(X, fe, e, t), W((e) => bn(e, { type: "execute" })), Fe();
|
|
3900
3903
|
}
|
|
3901
3904
|
}, [
|
|
3902
3905
|
Fe,
|
|
3903
|
-
|
|
3906
|
+
P,
|
|
3904
3907
|
X,
|
|
3905
|
-
|
|
3908
|
+
fe
|
|
3906
3909
|
]), et = G((e) => {
|
|
3907
3910
|
W((t) => bn(t, {
|
|
3908
3911
|
type: "set-active",
|
|
@@ -3910,8 +3913,8 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3910
3913
|
optionCount: Me.length
|
|
3911
3914
|
}));
|
|
3912
3915
|
}, [Me.length]), tt = G((e) => {
|
|
3913
|
-
if (!X || he || !
|
|
3914
|
-
let t = dn(
|
|
3916
|
+
if (!X || he || !P) return;
|
|
3917
|
+
let t = dn(fe, Me, e.key, { isComposing: e.nativeEvent.isComposing || _t(X.state) });
|
|
3915
3918
|
if (t.type !== "ignore") {
|
|
3916
3919
|
if (t.type === "close") {
|
|
3917
3920
|
e.preventDefault(), W((e) => bn(e, { type: "escape" })), Fe();
|
|
@@ -3929,12 +3932,12 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3929
3932
|
}
|
|
3930
3933
|
}, [
|
|
3931
3934
|
Fe,
|
|
3932
|
-
|
|
3935
|
+
P,
|
|
3933
3936
|
X,
|
|
3934
3937
|
Me,
|
|
3935
3938
|
$e,
|
|
3936
3939
|
he,
|
|
3937
|
-
|
|
3940
|
+
fe
|
|
3938
3941
|
]), nt = q(() => ({
|
|
3939
3942
|
closeSlashMenu: Fe,
|
|
3940
3943
|
focusFirstTableBodyCell: () => X ? Sn(X) : !1,
|
|
@@ -3944,11 +3947,11 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3944
3947
|
return X.commands.setContent(e, {
|
|
3945
3948
|
contentType: bt(n),
|
|
3946
3949
|
emitUpdate: t.emitUpdate ?? !1
|
|
3947
|
-
}), t.focusFirstTableBodyCell && Sn(X), Re(X),
|
|
3950
|
+
}), t.focusFirstTableBodyCell && Sn(X), Re(X), P && Le(X), ze(X), Ne(), !0;
|
|
3948
3951
|
}
|
|
3949
3952
|
}), [
|
|
3950
3953
|
Fe,
|
|
3951
|
-
|
|
3954
|
+
P,
|
|
3952
3955
|
X,
|
|
3953
3956
|
Ne,
|
|
3954
3957
|
Re,
|
|
@@ -3959,15 +3962,15 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3959
3962
|
editor: X,
|
|
3960
3963
|
frameProps: q(() => ({
|
|
3961
3964
|
className: "markweave-editor-frame",
|
|
3962
|
-
"aria-label": i ??
|
|
3965
|
+
"aria-label": i ?? V.common.editorAriaLabel,
|
|
3963
3966
|
"data-testid": "markweave-editor-frame",
|
|
3964
3967
|
"data-markweave-mode": j,
|
|
3965
|
-
"aria-busy":
|
|
3966
|
-
"data-markweave-large-document-loading":
|
|
3967
|
-
"data-markweave-theme":
|
|
3968
|
-
style:
|
|
3968
|
+
"aria-busy": ae,
|
|
3969
|
+
"data-markweave-large-document-loading": ae ? "true" : "false",
|
|
3970
|
+
"data-markweave-theme": M,
|
|
3971
|
+
style: te ? { "--markweave-canvas": te } : void 0,
|
|
3969
3972
|
"data-markweave-inner-toc": p ? "true" : "false",
|
|
3970
|
-
"data-markweave-inner-toc-placement":
|
|
3973
|
+
"data-markweave-inner-toc-placement": N,
|
|
3971
3974
|
"data-mermaid-mode": Ke.mode,
|
|
3972
3975
|
"data-table-focus-mode": Ue.mode,
|
|
3973
3976
|
onKeyDownCapture: tt
|
|
@@ -3976,78 +3979,78 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3976
3979
|
j,
|
|
3977
3980
|
tt,
|
|
3978
3981
|
p,
|
|
3979
|
-
|
|
3982
|
+
ae,
|
|
3980
3983
|
Ke.mode,
|
|
3981
|
-
|
|
3982
|
-
M,
|
|
3983
|
-
ne,
|
|
3984
|
+
V.common.editorAriaLabel,
|
|
3984
3985
|
te,
|
|
3986
|
+
N,
|
|
3987
|
+
M,
|
|
3985
3988
|
Ue.mode
|
|
3986
3989
|
]),
|
|
3987
3990
|
overlayProps: q(() => ({
|
|
3988
|
-
floatingToolbar: X &&
|
|
3991
|
+
floatingToolbar: X && P ? {
|
|
3989
3992
|
editor: X,
|
|
3990
|
-
lang:
|
|
3991
|
-
messages:
|
|
3992
|
-
selectionSnapshot:
|
|
3993
|
+
lang: B,
|
|
3994
|
+
messages: V,
|
|
3995
|
+
selectionSnapshot: U,
|
|
3993
3996
|
askAi: e,
|
|
3994
3997
|
onRewriteSelection: x,
|
|
3995
3998
|
onExtractToNote: b
|
|
3996
3999
|
} : null,
|
|
3997
|
-
slashCommandMenu: X &&
|
|
4000
|
+
slashCommandMenu: X && P ? {
|
|
3998
4001
|
commands: Me,
|
|
3999
|
-
state:
|
|
4002
|
+
state: fe,
|
|
4000
4003
|
position: pe,
|
|
4001
4004
|
inputCommand: he,
|
|
4002
|
-
messages:
|
|
4005
|
+
messages: V,
|
|
4003
4006
|
onActiveIndexChange: et,
|
|
4004
4007
|
onInputCommandChange: ge,
|
|
4005
4008
|
onSelect: $e,
|
|
4006
4009
|
onUpload: T
|
|
4007
4010
|
} : null,
|
|
4008
|
-
tableControls: X &&
|
|
4011
|
+
tableControls: X && P ? {
|
|
4009
4012
|
editor: X,
|
|
4010
4013
|
active: Ue.active,
|
|
4011
4014
|
interactionState: xe,
|
|
4012
|
-
messages:
|
|
4015
|
+
messages: V,
|
|
4013
4016
|
onCopyPayload: D,
|
|
4014
4017
|
onCommandResult: E,
|
|
4015
4018
|
onEditWithAi: y,
|
|
4016
4019
|
askAi: e
|
|
4017
4020
|
} : null,
|
|
4018
|
-
tableSelectionOverlay: X &&
|
|
4021
|
+
tableSelectionOverlay: X && P ? {
|
|
4019
4022
|
editor: X,
|
|
4020
4023
|
focusState: Ue
|
|
4021
4024
|
} : null,
|
|
4022
4025
|
codeBlockControls: X ? {
|
|
4023
4026
|
editor: X,
|
|
4024
|
-
active:
|
|
4027
|
+
active: P && We,
|
|
4025
4028
|
mermaidMode: _e,
|
|
4026
4029
|
onMermaidModeChange: ve,
|
|
4027
|
-
readOnly: !
|
|
4030
|
+
readOnly: !P
|
|
4028
4031
|
} : null,
|
|
4029
4032
|
innerToc: X && p && Xe.items.length ? {
|
|
4030
4033
|
editor: X,
|
|
4031
|
-
editable:
|
|
4032
|
-
messages:
|
|
4033
|
-
placement:
|
|
4034
|
+
editable: P,
|
|
4035
|
+
messages: V,
|
|
4036
|
+
placement: N,
|
|
4034
4037
|
state: Xe
|
|
4035
4038
|
} : null,
|
|
4036
|
-
mathEditorPopover: X &&
|
|
4039
|
+
mathEditorPopover: X && P && ye ? {
|
|
4037
4040
|
editor: X,
|
|
4038
|
-
messages:
|
|
4041
|
+
messages: V,
|
|
4039
4042
|
target: ye,
|
|
4040
4043
|
onClose: () => be(null)
|
|
4041
4044
|
} : null
|
|
4042
4045
|
}), [
|
|
4043
|
-
|
|
4046
|
+
P,
|
|
4044
4047
|
e,
|
|
4045
4048
|
X,
|
|
4046
4049
|
Me,
|
|
4047
4050
|
p,
|
|
4048
4051
|
We,
|
|
4049
4052
|
_e,
|
|
4050
|
-
|
|
4053
|
+
V,
|
|
4051
4054
|
ye,
|
|
4052
4055
|
y,
|
|
4053
4056
|
b,
|
|
@@ -4056,11 +4059,11 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
4056
4059
|
E,
|
|
4057
4060
|
D,
|
|
4058
4061
|
$e,
|
|
4059
|
-
|
|
4062
|
+
U,
|
|
4060
4063
|
et,
|
|
4061
4064
|
he,
|
|
4062
4065
|
pe,
|
|
4063
|
-
|
|
4066
|
+
fe,
|
|
4064
4067
|
Ue,
|
|
4065
4068
|
xe,
|
|
4066
4069
|
Xe
|