@markweave/react 0.3.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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";
|
|
@@ -20,7 +20,7 @@ import { createMarkweaveFrameScheduler as vt } from "markweave/internal/editor-c
|
|
|
20
20
|
import { createMarkweaveEditorUpdatePayload as yt, getMarkweaveContentType as bt, isEditorContentCurrent as xt, isMarkweaveControlledContentEchoCurrent as St, normalizeMarkweaveContentFormat as Ct } from "markweave/internal/editor-core/editor-content";
|
|
21
21
|
import { openMarkweaveReadonlyLinkFromEvent as wt } from "markweave/internal/editor-core/readonly-link";
|
|
22
22
|
import { createMarkweaveEditorRuntimeSnapshot as Tt } from "markweave/internal/editor-core/runtime-snapshot";
|
|
23
|
-
import { advanceFloatingToolbarMotionState as Et, areEditorSelectionSnapshotsEquivalent as Dt, calculateFloatingToolbarFrameShift as Ot, calculateFloatingToolbarPopoverPlacement as kt, calculateFloatingToolbarTopBoundary as At, createSelectionSnapshot as jt, getFloatingToolbarFloatingOptions as Mt, getFloatingToolbarState as Nt, markweaveRuntimeProjectionDelayMs as Pt,
|
|
23
|
+
import { advanceFloatingToolbarMotionState as Et, areEditorSelectionSnapshotsEquivalent as Dt, calculateFloatingToolbarFrameShift as Ot, calculateFloatingToolbarPopoverPlacement as kt, calculateFloatingToolbarTopBoundary as At, createSelectionSnapshot as jt, getFloatingToolbarFloatingOptions as Mt, getFloatingToolbarState as Nt, markweaveRuntimeProjectionDelayMs as Pt, shouldShowFloatingToolbarForAiState as Ft, transitionFloatingToolbarState as It } from "markweave/internal/editor-core/selection-state";
|
|
24
24
|
import { codeBlockCollapsePluginKey as Lt, copyActiveCodeBlock as Rt, getActiveCodeBlockState as zt, getCodeBlockCopyFeedbackSnapshot as Bt, markweaveCodeBlockBehavior as Vt, setCodeBlockCollapsedAtPosition as Ht, setCodeBlockLanguageAtPosition as Ut, setCodeBlockMermaidPreviewModeAtPosition as Wt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
25
25
|
import { isMermaidInlinePreviewTransaction as Gt, setMarkweaveMermaidTheme as Kt, setMermaidInlinePreviewEditorMode as qt, setReadonlyMermaidPreviewMode as Jt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
26
26
|
import { getMermaidPreviewState as Yt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
@@ -37,31 +37,31 @@ import { saveMarkweaveBrowserFile as Dn } from "markweave/internal/core/browser-
|
|
|
37
37
|
import { calculateCodeBlockLanguageMenuPosition as On, clampFullscreenScale as kn, codeBlockCopyFeedbackTimeoutMs as An, copyCodeBlockText as jn, createCodeBlockLanguageMenuDomId as Mn, createCodeBlockOverlayPosition as Nn, createMermaidFullscreenViewerState as Pn, createMermaidTabPosition as Fn, focusCodeBlockTarget as In, formatCodeBlockLanguageLabel as Ln, formatFullscreenZoom as Rn, getActiveCodeBlockElement as zn, getAnchoredRect as Bn, getCodeBlockLanguageItems as Vn, getCodeBlockLanguageOptionDomId as Hn, getCodeBlockPositionFromEventTarget as Un, getCodeBlockStateAtPosition as Wn, getFrameElement as Gn, getInitialCodeBlockLanguageItemIndex as Kn, getMermaidCodeBlockTargets as qn, getMermaidSvgMarkup as Jn, isCodeBlockTargetCollapsed as Yn, mergeStableMermaidTabPositions as Xn, mermaidFullscreenZoomStep as Zn, moveCodeBlockLanguageItemIndex as Qn, moveMermaidFullscreenViewer as $n, scrollCodeBlockLanguageItemIntoView as er } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
38
38
|
import { BubbleMenu as tr } from "@tiptap/react/menus";
|
|
39
39
|
import { applyFloatingToolbarLink as nr, createFloatingToolbarAssistantRequest as rr, getFloatingToolbarButtonModels as ir, getFloatingToolbarHighlightColorOptions as ar, getFloatingToolbarLinkHref as or, getFloatingToolbarMessageSet as sr, getFloatingToolbarMoreActions as cr, getFloatingToolbarTextColorOptions as lr, getFloatingToolbarTooltipModel as ur, getFloatingToolbarTurnIntoOptions as dr, isFloatingToolbarMoreActionActive as fr, isFloatingToolbarTurnIntoActive as pr, openFloatingToolbarLinkHref as mr, preventFloatingToolbarPointerFocusLoss as hr, removeFloatingToolbarLink as gr, runFloatingToolbarMoreAction as _r, setFloatingToolbarHighlightColor as vr, setFloatingToolbarTextColor as yr, setFloatingToolbarTurnInto as br } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
40
|
-
import { MarkweaveAskAiError as xr, acceptMarkweaveAskAiResult as Sr, calculateMarkweaveAskAiPanelPosition as Cr, canStartMarkweaveAskAiTableTarget as wr, clearMarkweaveAskAiPreview as Tr, clearMarkweaveAskAiTarget as Er, createMarkweaveAskAiRequest as Dr, getMappedMarkweaveAskAiSelection as Or, getMarkweaveAskAiSurfaceRect as kr, getMarkweaveAskAiTarget as Ar, getMarkweaveAskAiTargetRect as jr,
|
|
41
|
-
import { normalizeMarkdownLinkHref as
|
|
42
|
-
import { setMarkweaveTableMenuAxisTarget as
|
|
43
|
-
import { applyTableAxisAlignment as
|
|
44
|
-
import { createMarkweaveTocState as
|
|
45
|
-
import { normalizeMarkweaveCanvasColor as
|
|
46
|
-
import { splitMarkweaveLargeMarkdown as
|
|
47
|
-
import { createMarkweaveSearchController as
|
|
48
|
-
import { createMarkweaveAiEditController as
|
|
40
|
+
import { MarkweaveAskAiError as xr, acceptMarkweaveAskAiResult as Sr, calculateMarkweaveAskAiPanelPosition as Cr, canStartMarkweaveAskAiTableTarget as wr, clearMarkweaveAskAiPreview as Tr, clearMarkweaveAskAiTarget as Er, createMarkweaveAskAiRequest as Dr, getMappedMarkweaveAskAiSelection as Or, getMarkweaveAskAiSurfaceRect as kr, getMarkweaveAskAiTarget as Ar, getMarkweaveAskAiTargetRect as jr, hasMarkweaveAskAiPreview as Mr, restoreMarkweaveAskAiTargetSelection as Nr, runMarkweaveAskAiHandler as Pr, setMarkweaveAskAiPreview as Fr, startMarkweaveAskAiTableTarget as Ir, startMarkweaveAskAiTarget as Lr } from "markweave/internal/plugins/ask-ai/ask-ai-session";
|
|
41
|
+
import { normalizeMarkdownLinkHref as Rr } from "markweave/internal/plugins/markdown/markdown-input";
|
|
42
|
+
import { setMarkweaveTableMenuAxisTarget as zr } from "markweave/internal/plugins/table/table-clipboard";
|
|
43
|
+
import { applyTableAxisAlignment as Br, applyTableAxisBackgroundColor as Vr, applyTableAxisTextColor as Hr, calculateAnchoredTableMenuPosition as Ur, calculateAnchoredTableSubmenuPosition as Wr, calculateTableAxisHandleLayout as Gr, calculateTableExtendButtonLayout as Kr, canRunTableCommand as qr, executeTableMenuCommand as Jr, formatTableCopyFeedback as Yr, getActiveTableElement as Xr, getTableAxisDropIndexAtPoint as Zr, getTableAxisFormattingState as Qr, getTableAxisTargetRect as $r, getTableControlAxisSelectionModel as ei, getTableMenuBoundaryRect as ti, getTableMenuItemGroup as ni, getTableMenuItemLabel as ri, getTableMenuItems as ii, getTableSelectionTargetRect as ai, measureTableSelectionOverlay as oi, moveTargetedTableAxis as si, selectTableAxisFromCell as ci, tableColorOptions as li, tableCopyFeedbackTimeoutMs as ui, tableHorizontalAlignmentOptions as di, tableMenuLabel as fi, tableVerticalAlignmentOptions as pi, targetTableAxisFromCell as mi } from "markweave/internal/plugins/table/table-ui-model";
|
|
44
|
+
import { createMarkweaveTocState as hi, emptyMarkweaveTocState as gi, getActiveMarkweaveTocId as _i, getMarkweaveTocItemsFromState as vi, getValidMarkweaveTocActiveId as yi, normalizeMarkweaveInnerTocPlacement as bi, observeMarkweaveInnerTocContainerPosition as xi, scrollToMarkweaveTocItem as Si } from "markweave/internal/core/toc-state";
|
|
45
|
+
import { normalizeMarkweaveCanvasColor as Ci, normalizeMarkweaveTheme as wi } from "markweave/internal/core/theme";
|
|
46
|
+
import { splitMarkweaveLargeMarkdown as Ti } from "markweave/internal/core/large-document";
|
|
47
|
+
import { createMarkweaveSearchController as Ei } from "markweave/internal/plugins/search/search-controller";
|
|
48
|
+
import { createMarkweaveAiEditController as Di } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
|
|
49
49
|
//#region src/editor-mode-state.ts
|
|
50
|
-
var
|
|
50
|
+
var Oi = {
|
|
51
51
|
mode: "live",
|
|
52
52
|
editable: !0
|
|
53
53
|
};
|
|
54
|
-
function
|
|
55
|
-
return Re((t) => at(e, t), () => tt(e), () =>
|
|
54
|
+
function ki(e) {
|
|
55
|
+
return Re((t) => at(e, t), () => tt(e), () => Oi);
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/media/image-node.tsx
|
|
59
|
-
var
|
|
60
|
-
function
|
|
59
|
+
var Ai = Ze;
|
|
60
|
+
function ji(e) {
|
|
61
61
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
62
62
|
}
|
|
63
|
-
function
|
|
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(
|
|
63
|
+
function Mi(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(ki(r)), p = et(o.attrs.src), m = Ai(o.attrs.align), h = $e(o.attrs.width), g = et(o.attrs.caption), _ = J(null), v = Ri(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 && !
|
|
150
|
+
f && !ji(e.target) && F();
|
|
151
151
|
},
|
|
152
|
-
children:
|
|
152
|
+
children: ne ? /* @__PURE__ */ Z(Ni, {
|
|
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
|
-
f ? /* @__PURE__ */ Z(
|
|
166
|
+
f ? /* @__PURE__ */ Z(Pi, {
|
|
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", {
|
|
@@ -219,28 +219,28 @@ function ji(e) {
|
|
|
219
219
|
children: d.preview
|
|
220
220
|
})]
|
|
221
221
|
}) : null,
|
|
222
|
-
f ? /* @__PURE__ */ Z(
|
|
222
|
+
f ? /* @__PURE__ */ Z(Ii, {
|
|
223
223
|
side: "left",
|
|
224
224
|
messages: u,
|
|
225
|
-
onPointerDown:
|
|
225
|
+
onPointerDown: se
|
|
226
226
|
}) : null,
|
|
227
|
-
f ? /* @__PURE__ */ Z(
|
|
227
|
+
f ? /* @__PURE__ */ Z(Ii, {
|
|
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",
|
|
@@ -250,7 +250,7 @@ function ji(e) {
|
|
|
250
250
|
] })
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function Ni({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
|
|
254
254
|
let f = a.image;
|
|
255
255
|
return /* @__PURE__ */ Q("section", {
|
|
256
256
|
className: "markweave-image-upload-placeholder",
|
|
@@ -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]
|
|
@@ -332,7 +332,7 @@ function Mi({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
|
|
|
332
332
|
]
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function Pi({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i, onDelete: a, onDownload: o, onPreview: s, onReplace: c }) {
|
|
336
336
|
let u = n.image;
|
|
337
337
|
return /* @__PURE__ */ Q("div", {
|
|
338
338
|
className: "markweave-image-toolbar",
|
|
@@ -340,21 +340,21 @@ function Ni({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i,
|
|
|
340
340
|
"data-markweave-image-ui": "true",
|
|
341
341
|
"aria-label": u.toolsAriaLabel,
|
|
342
342
|
children: [
|
|
343
|
-
/* @__PURE__ */ Z(
|
|
343
|
+
/* @__PURE__ */ Z(Fi, {
|
|
344
344
|
testId: "markweave-image-align-left",
|
|
345
345
|
label: u.alignLeft,
|
|
346
346
|
icon: d,
|
|
347
347
|
active: e === "left",
|
|
348
348
|
onClick: () => r("left")
|
|
349
349
|
}),
|
|
350
|
-
/* @__PURE__ */ Z(
|
|
350
|
+
/* @__PURE__ */ Z(Fi, {
|
|
351
351
|
testId: "markweave-image-align-center",
|
|
352
352
|
label: u.alignCenter,
|
|
353
353
|
icon: l,
|
|
354
354
|
active: e === "center",
|
|
355
355
|
onClick: () => r("center")
|
|
356
356
|
}),
|
|
357
|
-
/* @__PURE__ */ Z(
|
|
357
|
+
/* @__PURE__ */ Z(Fi, {
|
|
358
358
|
testId: "markweave-image-align-right",
|
|
359
359
|
label: u.alignRight,
|
|
360
360
|
icon: f,
|
|
@@ -365,26 +365,26 @@ function Ni({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i,
|
|
|
365
365
|
className: "markweave-image-toolbar-divider",
|
|
366
366
|
"aria-hidden": "true"
|
|
367
367
|
}),
|
|
368
|
-
/* @__PURE__ */ Z(
|
|
368
|
+
/* @__PURE__ */ Z(Fi, {
|
|
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
|
-
/* @__PURE__ */ Z(
|
|
375
|
+
/* @__PURE__ */ Z(Fi, {
|
|
376
376
|
testId: "markweave-image-preview",
|
|
377
377
|
label: u.preview,
|
|
378
|
-
icon:
|
|
378
|
+
icon: I,
|
|
379
379
|
onClick: s
|
|
380
380
|
}),
|
|
381
|
-
/* @__PURE__ */ Z(
|
|
381
|
+
/* @__PURE__ */ Z(Fi, {
|
|
382
382
|
testId: "markweave-image-download",
|
|
383
383
|
label: u.download,
|
|
384
|
-
icon:
|
|
384
|
+
icon: re,
|
|
385
385
|
onClick: o
|
|
386
386
|
}),
|
|
387
|
-
/* @__PURE__ */ Z(
|
|
387
|
+
/* @__PURE__ */ Z(Fi, {
|
|
388
388
|
testId: "markweave-image-replace",
|
|
389
389
|
label: u.replace,
|
|
390
390
|
icon: _e,
|
|
@@ -394,7 +394,7 @@ function Ni({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i,
|
|
|
394
394
|
className: "markweave-image-toolbar-divider",
|
|
395
395
|
"aria-hidden": "true"
|
|
396
396
|
}),
|
|
397
|
-
/* @__PURE__ */ Z(
|
|
397
|
+
/* @__PURE__ */ Z(Fi, {
|
|
398
398
|
testId: "markweave-image-delete",
|
|
399
399
|
label: u.delete,
|
|
400
400
|
icon: je,
|
|
@@ -403,7 +403,7 @@ function Ni({ align: e, captionActive: t, messages: n, onAlign: r, onCaption: i,
|
|
|
403
403
|
]
|
|
404
404
|
});
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function Fi({ active: e = !1, icon: t, label: n, onClick: r, testId: i }) {
|
|
407
407
|
return /* @__PURE__ */ Q("button", {
|
|
408
408
|
type: "button",
|
|
409
409
|
"aria-label": n,
|
|
@@ -422,7 +422,7 @@ function Pi({ active: e = !1, icon: t, label: n, onClick: r, testId: i }) {
|
|
|
422
422
|
})]
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function Ii({ messages: e, onPointerDown: t, side: n }) {
|
|
426
426
|
return /* @__PURE__ */ Z("button", {
|
|
427
427
|
type: "button",
|
|
428
428
|
className: "markweave-image-resize-handle",
|
|
@@ -433,7 +433,7 @@ function Fi({ messages: e, onPointerDown: t, side: n }) {
|
|
|
433
433
|
onPointerDown: (e) => t(n, e)
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
|
-
var
|
|
436
|
+
var Li = Ve.extend({
|
|
437
437
|
addOptions() {
|
|
438
438
|
return {
|
|
439
439
|
...this.parent?.(),
|
|
@@ -444,7 +444,7 @@ var Ii = Ve.extend({
|
|
|
444
444
|
},
|
|
445
445
|
addNodeView() {
|
|
446
446
|
if (typeof document > "u") return null;
|
|
447
|
-
let e = o(
|
|
447
|
+
let e = o(Mi, { stopEvent: ({ event: e }) => ji(e.target) }), t = this.options.resolveMediaSource;
|
|
448
448
|
if (!t) return e;
|
|
449
449
|
let r = st({
|
|
450
450
|
messages: this.options.messages ?? n("zh"),
|
|
@@ -454,7 +454,7 @@ var Ii = Ve.extend({
|
|
|
454
454
|
return (t) => et(t.node.attrs.src) ? r(t) : e(t);
|
|
455
455
|
}
|
|
456
456
|
});
|
|
457
|
-
function
|
|
457
|
+
function Ri(e, t, n, r) {
|
|
458
458
|
let [i, a] = Y(t ? "background" : "visible"), [o, s] = Y(() => !t && e ? { src: e } : null);
|
|
459
459
|
return K(() => {
|
|
460
460
|
s(!t && e ? { src: e } : null), a(t ? "background" : "visible");
|
|
@@ -500,17 +500,17 @@ function Li(e, t, n, r) {
|
|
|
500
500
|
}
|
|
501
501
|
//#endregion
|
|
502
502
|
//#region src/media/video-node.tsx
|
|
503
|
-
function
|
|
503
|
+
function zi(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
|
-
function
|
|
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(
|
|
506
|
+
function Bi(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(ki(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 && (zi(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,13 +529,13 @@ 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",
|
|
536
536
|
"data-empty": "true",
|
|
537
537
|
"data-selected": "false",
|
|
538
|
-
children: /* @__PURE__ */ Z(
|
|
538
|
+
children: /* @__PURE__ */ Z(Vi, {
|
|
539
539
|
dragActive: b,
|
|
540
540
|
error: w,
|
|
541
541
|
fileInputRef: y,
|
|
@@ -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", {
|
|
@@ -616,7 +616,7 @@ function zi(e) {
|
|
|
616
616
|
})
|
|
617
617
|
});
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function Vi({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitting: i, messages: a, onCancel: o, onDragActiveChange: s, onDrop: c, onFileChange: l, onInputChange: u, onSubmit: d }) {
|
|
620
620
|
let f = a.video;
|
|
621
621
|
return /* @__PURE__ */ Q("section", {
|
|
622
622
|
className: "markweave-video-upload-placeholder",
|
|
@@ -698,7 +698,7 @@ function Bi({ dragActive: e, error: t, fileInputRef: n, inputValue: r, isSubmitt
|
|
|
698
698
|
]
|
|
699
699
|
});
|
|
700
700
|
}
|
|
701
|
-
var
|
|
701
|
+
var Hi = He.extend({
|
|
702
702
|
addOptions() {
|
|
703
703
|
return {
|
|
704
704
|
...this.parent?.(),
|
|
@@ -708,29 +708,29 @@ var Vi = He.extend({
|
|
|
708
708
|
};
|
|
709
709
|
},
|
|
710
710
|
addNodeView() {
|
|
711
|
-
return typeof document > "u" ? null : o(
|
|
711
|
+
return typeof document > "u" ? null : o(Bi, { stopEvent: ({ event: e }) => zi(e.target) });
|
|
712
712
|
}
|
|
713
713
|
});
|
|
714
714
|
//#endregion
|
|
715
715
|
//#region src/link-card-node.tsx
|
|
716
|
-
function
|
|
716
|
+
function Ui(e) {
|
|
717
717
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
718
718
|
}
|
|
719
|
-
function
|
|
719
|
+
function Wi(e) {
|
|
720
720
|
return typeof navigator < "u" && navigator.clipboard?.writeText ? navigator.clipboard.writeText(e).catch(() => void 0) : Promise.resolve();
|
|
721
721
|
}
|
|
722
|
-
function
|
|
722
|
+
function Gi(e) {
|
|
723
723
|
!e || typeof window > "u" || window.open(e, "_blank", "noopener,noreferrer");
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function Ki(e) {
|
|
726
726
|
try {
|
|
727
727
|
return new URL(e).host;
|
|
728
728
|
} catch {
|
|
729
729
|
return e;
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
|
-
function
|
|
733
|
-
let { deleteNode: t, editor: r, getPos: i, node: o, updateAttributes: s } = e, c = e.extension.options, l = c.messages ?? n("zh"), u = l.linkCard, d = nt(
|
|
732
|
+
function qi(e) {
|
|
733
|
+
let { deleteNode: t, editor: r, getPos: i, node: o, updateAttributes: s } = e, c = e.extension.options, l = c.messages ?? n("zh"), u = l.linkCard, d = nt(ki(r)), f = dt(o.attrs), [p, m] = Y(!1), [h, g] = Y(!1), [_, v] = Y(!1), [y, b] = Y(f?.title ?? ""), [x, S] = Y(f?.href ?? ""), C = J(null);
|
|
734
734
|
if (K(() => () => C.current?.abort(), []), K(() => {
|
|
735
735
|
b(f?.title ?? ""), S(f?.href ?? ""), v(!1);
|
|
736
736
|
}, [f?.href, f?.title]), !f) return null;
|
|
@@ -759,7 +759,7 @@ function Ki(e) {
|
|
|
759
759
|
}, T = () => {
|
|
760
760
|
let e = i();
|
|
761
761
|
typeof e == "number" && pt(r, e);
|
|
762
|
-
}, E = _ ? null : f.imageUrl, D =
|
|
762
|
+
}, E = _ ? null : f.imageUrl, D = Ki(f.href);
|
|
763
763
|
return /* @__PURE__ */ Q(a, {
|
|
764
764
|
as: "article",
|
|
765
765
|
className: "markweave-link-card",
|
|
@@ -770,10 +770,10 @@ function Ki(e) {
|
|
|
770
770
|
onMouseEnter: () => m(!0),
|
|
771
771
|
onMouseLeave: () => m(!1),
|
|
772
772
|
onMouseDown: (e) => {
|
|
773
|
-
|
|
773
|
+
Ui(e.target) || e.preventDefault();
|
|
774
774
|
},
|
|
775
775
|
onClick: (e) => {
|
|
776
|
-
|
|
776
|
+
Ui(e.target) || (e.preventDefault(), Gi(f.href));
|
|
777
777
|
},
|
|
778
778
|
children: [
|
|
779
779
|
/* @__PURE__ */ Q("a", {
|
|
@@ -811,19 +811,19 @@ function Ki(e) {
|
|
|
811
811
|
"data-markweave-link-card-ui": "true",
|
|
812
812
|
"aria-label": u.toolsAriaLabel,
|
|
813
813
|
children: [
|
|
814
|
-
/* @__PURE__ */ Z(
|
|
814
|
+
/* @__PURE__ */ Z(Ji, {
|
|
815
815
|
label: u.convertToLink,
|
|
816
|
-
icon:
|
|
816
|
+
icon: le,
|
|
817
817
|
onClick: T,
|
|
818
818
|
testId: "markweave-link-card-convert"
|
|
819
819
|
}),
|
|
820
|
-
/* @__PURE__ */ Z(
|
|
820
|
+
/* @__PURE__ */ Z(Ji, {
|
|
821
821
|
label: u.copyAddress,
|
|
822
|
-
icon:
|
|
823
|
-
onClick: () => void
|
|
822
|
+
icon: P,
|
|
823
|
+
onClick: () => void Wi(f.href),
|
|
824
824
|
testId: "markweave-link-card-copy"
|
|
825
825
|
}),
|
|
826
|
-
/* @__PURE__ */ Z(
|
|
826
|
+
/* @__PURE__ */ Z(Ji, {
|
|
827
827
|
label: u.edit,
|
|
828
828
|
icon: me,
|
|
829
829
|
onClick: (e) => {
|
|
@@ -841,7 +841,7 @@ function Ki(e) {
|
|
|
841
841
|
},
|
|
842
842
|
testId: "markweave-link-card-edit"
|
|
843
843
|
}),
|
|
844
|
-
/* @__PURE__ */ Z(
|
|
844
|
+
/* @__PURE__ */ Z(Ji, {
|
|
845
845
|
label: u.delete,
|
|
846
846
|
icon: je,
|
|
847
847
|
onClick: t,
|
|
@@ -871,14 +871,14 @@ 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
|
|
878
878
|
]
|
|
879
879
|
});
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function Ji({ icon: e, label: t, onClick: n, testId: r }) {
|
|
882
882
|
return /* @__PURE__ */ Q("button", {
|
|
883
883
|
type: "button",
|
|
884
884
|
"aria-label": t,
|
|
@@ -895,7 +895,7 @@ function qi({ icon: e, label: t, onClick: n, testId: r }) {
|
|
|
895
895
|
})]
|
|
896
896
|
});
|
|
897
897
|
}
|
|
898
|
-
var
|
|
898
|
+
var Yi = ht.extend({
|
|
899
899
|
addOptions() {
|
|
900
900
|
return {
|
|
901
901
|
...this.parent?.(),
|
|
@@ -904,23 +904,23 @@ var Ji = ht.extend({
|
|
|
904
904
|
};
|
|
905
905
|
},
|
|
906
906
|
addNodeView() {
|
|
907
|
-
return typeof document > "u" ? null : o(
|
|
907
|
+
return typeof document > "u" ? null : o(qi, { stopEvent: ({ event: e }) => Ui(e.target) });
|
|
908
908
|
}
|
|
909
909
|
});
|
|
910
910
|
//#endregion
|
|
911
911
|
//#region src/create-editor-extensions.ts
|
|
912
|
-
function
|
|
912
|
+
function Xi(t = {}) {
|
|
913
913
|
return e({
|
|
914
914
|
lang: t.lang,
|
|
915
915
|
onImageUpload: t.onImageUpload,
|
|
916
|
-
linkCardExtension:
|
|
916
|
+
linkCardExtension: Yi.configure({
|
|
917
917
|
lang: t.lang,
|
|
918
918
|
messages: n(t.lang),
|
|
919
919
|
resolver: t.linkCardResolver
|
|
920
920
|
}),
|
|
921
921
|
mediaExtensions: ut({
|
|
922
|
-
image:
|
|
923
|
-
video:
|
|
922
|
+
image: Li,
|
|
923
|
+
video: Hi,
|
|
924
924
|
lang: t.lang,
|
|
925
925
|
onImageUpload: t.onImageUpload,
|
|
926
926
|
onVideoUpload: t.onVideoUpload,
|
|
@@ -930,7 +930,7 @@ function Yi(t = {}) {
|
|
|
930
930
|
}
|
|
931
931
|
//#endregion
|
|
932
932
|
//#region src/ui/codeblock/CodeBlockControls.tsx
|
|
933
|
-
function
|
|
933
|
+
function Zi(e) {
|
|
934
934
|
return e === "clipboard" ? /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Z("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), /* @__PURE__ */ Z("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] }) : e === "search" ? /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Z("circle", {
|
|
935
935
|
cx: "10",
|
|
936
936
|
cy: "10",
|
|
@@ -967,7 +967,7 @@ function Xi(e) {
|
|
|
967
967
|
/* @__PURE__ */ Z("path", { d: "m14 14 4 4" })
|
|
968
968
|
] }) : e === "reset" ? /* @__PURE__ */ Q(lt, { children: [/* @__PURE__ */ Z("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), /* @__PURE__ */ Z("path", { d: "M6.5 8.5H3.5v-3" })] }) : /* @__PURE__ */ Z("path", { d: "m6 9 6 6 6-6" });
|
|
969
969
|
}
|
|
970
|
-
function
|
|
970
|
+
function Qi({ icon: e }) {
|
|
971
971
|
return /* @__PURE__ */ Z("svg", {
|
|
972
972
|
viewBox: "0 0 24 24",
|
|
973
973
|
"aria-hidden": "true",
|
|
@@ -978,40 +978,40 @@ function Zi({ icon: e }) {
|
|
|
978
978
|
strokeLinecap: "round",
|
|
979
979
|
strokeLinejoin: "round",
|
|
980
980
|
strokeWidth: "1.8",
|
|
981
|
-
children:
|
|
981
|
+
children: Zi(e)
|
|
982
982
|
})
|
|
983
983
|
});
|
|
984
984
|
}
|
|
985
|
-
function
|
|
986
|
-
let a = J(null), o = J(null), s = J(null), c = J(null), l = J(null), u = J({
|
|
985
|
+
function $i({ 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(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,23 +1274,23 @@ 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:
|
|
1280
|
-
children: [/* @__PURE__ */ Z("span", { children: se }), /* @__PURE__ */ Z(
|
|
1281
|
+
onClick: he,
|
|
1282
|
+
children: [/* @__PURE__ */ Z("span", { children: se }), /* @__PURE__ */ Z(Qi, { 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:
|
|
1291
|
-
children: /* @__PURE__ */ Z(
|
|
1292
|
+
onClick: be,
|
|
1293
|
+
children: /* @__PURE__ */ Z(Qi, { icon: "chevron" })
|
|
1292
1294
|
}) : null,
|
|
1293
1295
|
/* @__PURE__ */ Q("span", {
|
|
1294
1296
|
className: "markweave-codeblock-copy-wrap",
|
|
@@ -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:
|
|
1307
|
-
children: /* @__PURE__ */ Z(
|
|
1308
|
-
}),
|
|
1308
|
+
onClick: W,
|
|
1309
|
+
children: /* @__PURE__ */ Z(Qi, { icon: ce === "copied" ? "check" : "clipboard" })
|
|
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,8 +1324,8 @@ 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:
|
|
1326
|
-
children: /* @__PURE__ */ Z(
|
|
1327
|
+
onClick: Se,
|
|
1328
|
+
children: /* @__PURE__ */ Z(Qi, { icon: "expand" })
|
|
1327
1329
|
}), /* @__PURE__ */ Z("button", {
|
|
1328
1330
|
type: "button",
|
|
1329
1331
|
className: "markweave-codeblock-icon-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:
|
|
1335
|
-
children: /* @__PURE__ */ Z(
|
|
1336
|
+
onClick: xe,
|
|
1337
|
+
children: /* @__PURE__ */ Z(Qi, { 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:
|
|
1363
|
-
}), /* @__PURE__ */ Z(
|
|
1364
|
+
onChange: (e) => ge(e.target.value),
|
|
1365
|
+
onKeyDown: _e
|
|
1366
|
+
}), /* @__PURE__ */ Z(Qi, { 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,9 +1382,9 @@ 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: () =>
|
|
1384
|
-
children: [/* @__PURE__ */ Z("span", { children: e.label }), n ? /* @__PURE__ */ Z(
|
|
1385
|
+
onMouseEnter: () => T(t),
|
|
1386
|
+
onClick: () => me(e.language),
|
|
1387
|
+
children: [/* @__PURE__ */ Z("span", { children: e.label }), n ? /* @__PURE__ */ Z(Qi, { icon: "check" }) : null]
|
|
1385
1388
|
}, e.language);
|
|
1386
1389
|
})
|
|
1387
1390
|
})]
|
|
@@ -1402,12 +1405,12 @@ 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: () =>
|
|
1410
|
-
children: /* @__PURE__ */ Z(
|
|
1408
|
+
onMouseEnter: () => M("zoom-out"),
|
|
1409
|
+
onMouseLeave: () => M(null),
|
|
1410
|
+
onFocus: () => M("zoom-out"),
|
|
1411
|
+
onBlur: () => M(null),
|
|
1412
|
+
onClick: () => we(-Zn),
|
|
1413
|
+
children: /* @__PURE__ */ Z(Qi, { icon: "zoomOut" })
|
|
1411
1414
|
}),
|
|
1412
1415
|
/* @__PURE__ */ Z("span", {
|
|
1413
1416
|
className: "markweave-mermaid-fullscreen-zoom-label",
|
|
@@ -1419,30 +1422,30 @@ 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: () =>
|
|
1427
|
-
children: /* @__PURE__ */ Z(
|
|
1425
|
+
onMouseEnter: () => M("zoom-in"),
|
|
1426
|
+
onMouseLeave: () => M(null),
|
|
1427
|
+
onFocus: () => M("zoom-in"),
|
|
1428
|
+
onBlur: () => M(null),
|
|
1429
|
+
onClick: () => we(Zn),
|
|
1430
|
+
children: /* @__PURE__ */ Z(Qi, { icon: "zoomIn" })
|
|
1428
1431
|
}),
|
|
1429
1432
|
/* @__PURE__ */ Z("button", {
|
|
1430
1433
|
type: "button",
|
|
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:
|
|
1439
|
-
children: /* @__PURE__ */ Z(
|
|
1437
|
+
onMouseEnter: () => M("reset"),
|
|
1438
|
+
onMouseLeave: () => M(null),
|
|
1439
|
+
onFocus: () => M("reset"),
|
|
1440
|
+
onBlur: () => M(null),
|
|
1441
|
+
onClick: Te,
|
|
1442
|
+
children: /* @__PURE__ */ Z(Qi, { 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:
|
|
1455
|
-
children: /* @__PURE__ */ Z(
|
|
1457
|
+
onClick: Ce,
|
|
1458
|
+
children: /* @__PURE__ */ Z(Qi, { 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",
|
|
@@ -1483,25 +1486,25 @@ function Qi({ active: e, editor: t, mermaidMode: n, onMermaidModeChange: r, read
|
|
|
1483
1486
|
}
|
|
1484
1487
|
//#endregion
|
|
1485
1488
|
//#region src/ui/floating-toolbar/FloatingToolbar.tsx
|
|
1486
|
-
var
|
|
1487
|
-
function
|
|
1489
|
+
var ea = n("zh");
|
|
1490
|
+
function ta() {
|
|
1488
1491
|
return typeof performance > "u" ? Date.now() : performance.now();
|
|
1489
1492
|
}
|
|
1490
|
-
function
|
|
1493
|
+
function na(e, t) {
|
|
1491
1494
|
return {
|
|
1492
1495
|
"--markweave-toolbar-motion-duration": `${e.motionDurationMs}ms`,
|
|
1493
1496
|
"--markweave-toolbar-motion-easing": e.motionEasing,
|
|
1494
1497
|
marginLeft: t === 0 ? void 0 : `${t}px`
|
|
1495
1498
|
};
|
|
1496
1499
|
}
|
|
1497
|
-
function
|
|
1500
|
+
function ra(e, t) {
|
|
1498
1501
|
let n = e?.getBoundingClientRect().height ?? 0, r = t?.getBoundingClientRect().height ?? 0;
|
|
1499
1502
|
return Math.max(n, r, 44);
|
|
1500
1503
|
}
|
|
1501
|
-
function
|
|
1504
|
+
function ia(e) {
|
|
1502
1505
|
if (e !== null) return { "--markweave-floating-toolbar-tooltip-left": `${e}px` };
|
|
1503
1506
|
}
|
|
1504
|
-
function
|
|
1507
|
+
function aa(e, t, n, r) {
|
|
1505
1508
|
let i = {
|
|
1506
1509
|
bottom: t + r,
|
|
1507
1510
|
height: r,
|
|
@@ -1517,26 +1520,26 @@ function ia(e, t, n, r) {
|
|
|
1517
1520
|
toJSON: () => i
|
|
1518
1521
|
};
|
|
1519
1522
|
}
|
|
1520
|
-
function
|
|
1523
|
+
function oa(e) {
|
|
1521
1524
|
return e.width > 0 && e.height > 0;
|
|
1522
1525
|
}
|
|
1523
|
-
function
|
|
1526
|
+
function sa(e) {
|
|
1524
1527
|
let t = Math.min(...e.map((e) => e.left)), n = Math.min(...e.map((e) => e.top)), r = Math.max(...e.map((e) => e.right)), i = Math.max(...e.map((e) => e.bottom));
|
|
1525
|
-
return
|
|
1528
|
+
return aa(t, n, r - t, i - n);
|
|
1526
1529
|
}
|
|
1527
|
-
function
|
|
1530
|
+
function ca(e, t) {
|
|
1528
1531
|
let n = e.view.dom.ownerDocument.defaultView?.Node.ELEMENT_NODE ?? 1, r = (t) => t ? e.view.dom.contains(t.nodeType === n ? t : t.parentNode) : !1;
|
|
1529
1532
|
return r(t.anchorNode) && r(t.focusNode);
|
|
1530
1533
|
}
|
|
1531
|
-
function
|
|
1534
|
+
function la(e) {
|
|
1532
1535
|
if (typeof e.getClientRects != "function") return null;
|
|
1533
|
-
let t = Array.from(e.getClientRects()).filter(
|
|
1536
|
+
let t = Array.from(e.getClientRects()).filter(oa).map((e) => aa(e.left, e.top, e.width, e.height));
|
|
1534
1537
|
if (t.length > 0) return t;
|
|
1535
1538
|
if (typeof e.getBoundingClientRect != "function") return null;
|
|
1536
1539
|
let n = e.getBoundingClientRect();
|
|
1537
|
-
return
|
|
1540
|
+
return oa(n) ? [aa(n.left, n.top, n.width, n.height)] : null;
|
|
1538
1541
|
}
|
|
1539
|
-
function
|
|
1542
|
+
function ua(e, t) {
|
|
1540
1543
|
if (t.rangeCount === 0) return null;
|
|
1541
1544
|
let n = t.getRangeAt(0);
|
|
1542
1545
|
try {
|
|
@@ -1549,8 +1552,8 @@ function la(e, t) {
|
|
|
1549
1552
|
return null;
|
|
1550
1553
|
}
|
|
1551
1554
|
}
|
|
1552
|
-
function
|
|
1553
|
-
let n =
|
|
1555
|
+
function da(e, t) {
|
|
1556
|
+
let n = ua(e, t);
|
|
1554
1557
|
if (!n) return !1;
|
|
1555
1558
|
let { selection: r } = e.state, i = {
|
|
1556
1559
|
from: Math.min(r.from, r.to),
|
|
@@ -1558,56 +1561,56 @@ function ua(e, t) {
|
|
|
1558
1561
|
};
|
|
1559
1562
|
return n.from === i.from && n.to === i.to;
|
|
1560
1563
|
}
|
|
1561
|
-
function
|
|
1564
|
+
function fa(e) {
|
|
1562
1565
|
let t = e.view.dom.ownerDocument.getSelection();
|
|
1563
|
-
return !t || t.rangeCount === 0 || t.isCollapsed || !
|
|
1566
|
+
return !t || t.rangeCount === 0 || t.isCollapsed || !ca(e, t) || !da(e, t) ? null : la(t.getRangeAt(0));
|
|
1564
1567
|
}
|
|
1565
|
-
function
|
|
1568
|
+
function pa(e) {
|
|
1566
1569
|
let { selection: t } = e.state;
|
|
1567
1570
|
if (t.empty) return null;
|
|
1568
1571
|
let n = Math.min(t.from, t.to), r = Math.max(t.from, t.to);
|
|
1569
1572
|
try {
|
|
1570
1573
|
let t = e.view.domAtPos(n), i = e.view.domAtPos(r), a = e.view.dom.ownerDocument.createRange();
|
|
1571
|
-
return a.setStart(t.node, t.offset), a.setEnd(i.node, i.offset),
|
|
1574
|
+
return a.setStart(t.node, t.offset), a.setEnd(i.node, i.offset), la(a);
|
|
1572
1575
|
} catch {
|
|
1573
1576
|
return null;
|
|
1574
1577
|
}
|
|
1575
1578
|
}
|
|
1576
|
-
function
|
|
1579
|
+
function ma(e) {
|
|
1577
1580
|
let { selection: t } = e.state;
|
|
1578
1581
|
if (t.empty) return null;
|
|
1579
|
-
let n = Math.min(t.from, t.to), r = Math.max(t.from, t.to), i = e.view.coordsAtPos(n), a = e.view.coordsAtPos(r, -1), o = Math.min(i.top, a.top), s = Math.max(i.bottom, a.bottom), c = Math.min(i.left, a.left), l =
|
|
1580
|
-
return
|
|
1581
|
-
}
|
|
1582
|
-
function ma(e) {
|
|
1583
|
-
return da(e) ?? fa(e) ?? pa(e);
|
|
1582
|
+
let n = Math.min(t.from, t.to), r = Math.max(t.from, t.to), i = e.view.coordsAtPos(n), a = e.view.coordsAtPos(r, -1), o = Math.min(i.top, a.top), s = Math.max(i.bottom, a.bottom), c = Math.min(i.left, a.left), l = aa(c, o, Math.max(i.right, a.right) - c, s - o);
|
|
1583
|
+
return oa(l) ? [l] : null;
|
|
1584
1584
|
}
|
|
1585
1585
|
function ha(e) {
|
|
1586
|
-
|
|
1587
|
-
return t && t.length > 0 ? oa(t) : null;
|
|
1586
|
+
return fa(e) ?? pa(e) ?? ma(e);
|
|
1588
1587
|
}
|
|
1589
1588
|
function ga(e) {
|
|
1589
|
+
let t = ha(e);
|
|
1590
|
+
return t && t.length > 0 ? sa(t) : null;
|
|
1591
|
+
}
|
|
1592
|
+
function _a(e) {
|
|
1590
1593
|
return {
|
|
1591
|
-
getBoundingClientRect: () =>
|
|
1592
|
-
getClientRects: () =>
|
|
1594
|
+
getBoundingClientRect: () => ga(e) ?? aa(0, 0, 0, 0),
|
|
1595
|
+
getClientRects: () => ha(e) ?? []
|
|
1593
1596
|
};
|
|
1594
1597
|
}
|
|
1595
|
-
function
|
|
1598
|
+
function va(e) {
|
|
1596
1599
|
return e === "ask-ai" || e === "block-type" || e === "link" || e === "color" || e === "more";
|
|
1597
1600
|
}
|
|
1598
|
-
function
|
|
1601
|
+
function ya(e, t, n) {
|
|
1599
1602
|
n?.(rr(e, t)), e.commands.focus();
|
|
1600
1603
|
}
|
|
1601
|
-
var
|
|
1602
|
-
function
|
|
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 =
|
|
1604
|
+
var ba = "markweave-floating-toolbar";
|
|
1605
|
+
function xa({ editor: e, lang: t = "zh", messages: n = ea, selectionSnapshot: r, askAi: i, onRewriteSelection: a }) {
|
|
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 = Rr(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 && Nr(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 =
|
|
1613
|
+
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = ra(t, I.current), o = re.current, s = Ot({
|
|
1611
1614
|
toolbarRect: {
|
|
1612
1615
|
left: r.left - o,
|
|
1613
1616
|
top: r.top,
|
|
@@ -1635,32 +1638,32 @@ 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
|
-
return t ?
|
|
1653
|
+
return t ? aa(t.left, t.top, t.width, t.height) : aa(0, 0, 0, 0);
|
|
1651
1654
|
},
|
|
1652
1655
|
getClientRects: () => {
|
|
1653
1656
|
let t = jr(e);
|
|
1654
|
-
return t ? [
|
|
1657
|
+
return t ? [aa(t.left, t.top, t.width, t.height)] : [];
|
|
1655
1658
|
}
|
|
1656
|
-
} :
|
|
1657
|
-
|
|
1659
|
+
} : _a(e), [e]), me = G((e) => {
|
|
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,23 +1696,23 @@ 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
|
-
let e =
|
|
1715
|
+
let e = ta();
|
|
1713
1716
|
l((t) => It(t, s, e));
|
|
1714
1717
|
}, [
|
|
1715
1718
|
s.hiddenReason,
|
|
@@ -1724,8 +1727,8 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1724
1727
|
s.visibility
|
|
1725
1728
|
]), K(() => {
|
|
1726
1729
|
if (c.motionStartedAtMs === null || c.motionDurationMs <= 0) return;
|
|
1727
|
-
let e = Math.max(0, c.motionStartedAtMs + c.motionDurationMs -
|
|
1728
|
-
l((e) => Et(e,
|
|
1730
|
+
let e = Math.max(0, c.motionStartedAtMs + c.motionDurationMs - ta()), t = window.setTimeout(() => {
|
|
1731
|
+
l((e) => Et(e, ta()));
|
|
1729
1732
|
}, e);
|
|
1730
1733
|
return () => {
|
|
1731
1734
|
window.clearTimeout(t);
|
|
@@ -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,42 +1804,42 @@ 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(() => {
|
|
1822
|
-
m !== "ask-ai" || e.isDestroyed || e.view.dispatch(e.state.tr.setMeta(
|
|
1825
|
+
m !== "ask-ai" || e.isDestroyed || e.view.dispatch(e.state.tr.setMeta(ba, "show").setMeta("addToHistory", !1));
|
|
1823
1826
|
}, [e, m]);
|
|
1824
1827
|
let _e = (t) => {
|
|
1825
|
-
if (
|
|
1828
|
+
if (va(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 (!
|
|
1833
|
-
let t =
|
|
1834
|
+
if (m === "ask-ai" && U(!1), n === "ask-ai") {
|
|
1835
|
+
if (!se) return;
|
|
1836
|
+
let t = Lr(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
|
});
|
|
@@ -1845,37 +1848,37 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1845
1848
|
return;
|
|
1846
1849
|
}
|
|
1847
1850
|
if (h(null), t.id === "improve") {
|
|
1848
|
-
|
|
1851
|
+
ya(e, "rewrite-selection", a);
|
|
1849
1852
|
return;
|
|
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
|
-
let t = await
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
+
let t = await Pr(i.handler, c, (t) => {
|
|
1872
|
+
B.current !== c.id || s.signal.aborted || (oe.current = t, V.current === null && (V.current = window.requestAnimationFrame(() => {
|
|
1873
|
+
V.current = null, Fr(e, oe.current), C(oe.current);
|
|
1871
1874
|
})));
|
|
1872
1875
|
});
|
|
1873
|
-
if (
|
|
1874
|
-
if (!
|
|
1875
|
-
|
|
1876
|
+
if (B.current !== c.id || s.signal.aborted) return;
|
|
1877
|
+
if (!Fr(e, t)) throw new xr("invalid-output", "Ask AI output is incompatible with the selected content.");
|
|
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,64 +1905,68 @@ 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
|
-
pluginKey:
|
|
1928
|
+
pluginKey: ba,
|
|
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
|
-
style:
|
|
1936
|
+
style: na(c, j),
|
|
1934
1937
|
updateDelay: 0,
|
|
1935
1938
|
getReferencedVirtualElement: pe,
|
|
1936
1939
|
options: ge,
|
|
1937
1940
|
shouldShow: ({ editor: e }) => {
|
|
1938
1941
|
let t = Ar(e);
|
|
1939
|
-
return
|
|
1942
|
+
return Ft(jt(e), {
|
|
1943
|
+
editable: e.isEditable,
|
|
1944
|
+
hasAskAiPreview: Mr(e.state),
|
|
1945
|
+
hasActiveAskAiTableTarget: t?.target.kind === "table" && t.status === "target"
|
|
1946
|
+
});
|
|
1940
1947
|
},
|
|
1941
1948
|
children: /* @__PURE__ */ Q("div", {
|
|
1942
|
-
ref:
|
|
1949
|
+
ref: I,
|
|
1943
1950
|
className: "markweave-floating-toolbar-content",
|
|
1944
1951
|
"data-menu": m ?? "none",
|
|
1945
1952
|
children: [
|
|
1946
|
-
|
|
1953
|
+
ce.map((e, t) => /* @__PURE__ */ Z(wa, {
|
|
1947
1954
|
button: e,
|
|
1948
1955
|
expanded: m === e.id,
|
|
1949
|
-
showDivider: t > 0 &&
|
|
1956
|
+
showDivider: t > 0 && ce[t - 1].group !== e.group,
|
|
1950
1957
|
tooltipActive: u === e.id,
|
|
1951
1958
|
onPointerDown: hr,
|
|
1952
1959
|
onTooltipChange: we,
|
|
1953
1960
|
onRun: _e
|
|
1954
1961
|
}, e.id)),
|
|
1955
|
-
m === "block-type" ? /* @__PURE__ */ Z(
|
|
1962
|
+
m === "block-type" ? /* @__PURE__ */ Z(Ea, {
|
|
1956
1963
|
editor: e,
|
|
1957
1964
|
messages: n,
|
|
1958
1965
|
onPopoverRef: me,
|
|
1959
1966
|
onClose: () => h(null)
|
|
1960
1967
|
}) : null,
|
|
1961
|
-
m === "ask-ai" ? /* @__PURE__ */ Z(
|
|
1962
|
-
inputRef:
|
|
1968
|
+
m === "ask-ai" ? /* @__PURE__ */ Z(Ca, {
|
|
1969
|
+
inputRef: L,
|
|
1963
1970
|
messages: n,
|
|
1964
1971
|
phase: g,
|
|
1965
1972
|
prompt: v,
|
|
@@ -1968,33 +1975,33 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
1968
1975
|
onPromptChange: y,
|
|
1969
1976
|
onSubmit: ve,
|
|
1970
1977
|
onStop: () => {
|
|
1971
|
-
|
|
1978
|
+
z.current?.abort(), H(), Tr(e), _("input");
|
|
1972
1979
|
},
|
|
1973
1980
|
onAccept: ye,
|
|
1974
1981
|
onRetry: () => ve(b),
|
|
1975
|
-
onDiscard: () =>
|
|
1982
|
+
onDiscard: () => U(!0),
|
|
1976
1983
|
onPopoverRef: me
|
|
1977
1984
|
}) : null,
|
|
1978
|
-
m === "link" ? /* @__PURE__ */ Z(
|
|
1979
|
-
inputRef:
|
|
1985
|
+
m === "link" ? /* @__PURE__ */ Z(Sa, {
|
|
1986
|
+
inputRef: ae,
|
|
1980
1987
|
messages: n,
|
|
1981
1988
|
value: E,
|
|
1982
|
-
canApply: !!
|
|
1983
|
-
canOpen: !!
|
|
1984
|
-
canRemove: !!(
|
|
1989
|
+
canApply: !!ue,
|
|
1990
|
+
canOpen: !!ue,
|
|
1991
|
+
canRemove: !!(ee || E.trim()),
|
|
1985
1992
|
onValueChange: D,
|
|
1986
1993
|
onApply: Se,
|
|
1987
1994
|
onOpen: () => mr(E),
|
|
1988
1995
|
onRemove: Ce,
|
|
1989
1996
|
onPopoverRef: me
|
|
1990
1997
|
}) : null,
|
|
1991
|
-
m === "color" ? /* @__PURE__ */ Z(
|
|
1998
|
+
m === "color" ? /* @__PURE__ */ Z(Oa, {
|
|
1992
1999
|
editor: e,
|
|
1993
2000
|
messages: n,
|
|
1994
2001
|
onPopoverRef: me,
|
|
1995
2002
|
onClose: () => h(null)
|
|
1996
2003
|
}) : null,
|
|
1997
|
-
m === "more" ? /* @__PURE__ */ Z(
|
|
2004
|
+
m === "more" ? /* @__PURE__ */ Z(Aa, {
|
|
1998
2005
|
editor: e,
|
|
1999
2006
|
messages: n,
|
|
2000
2007
|
activeTooltipId: u,
|
|
@@ -2002,20 +2009,20 @@ function ba({ editor: e, lang: t = "zh", messages: n = $i, selectionSnapshot: r,
|
|
|
2002
2009
|
onTooltipChange: d,
|
|
2003
2010
|
onClose: () => h(null)
|
|
2004
2011
|
}) : null,
|
|
2005
|
-
|
|
2012
|
+
le && m === null ? /* @__PURE__ */ Z("div", {
|
|
2006
2013
|
className: "markweave-floating-toolbar-tooltip",
|
|
2007
2014
|
role: "tooltip",
|
|
2008
2015
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
2009
|
-
"data-button-id":
|
|
2010
|
-
"data-active":
|
|
2011
|
-
style:
|
|
2012
|
-
children:
|
|
2016
|
+
"data-button-id": le.buttonId,
|
|
2017
|
+
"data-active": le.active,
|
|
2018
|
+
style: ia(f),
|
|
2019
|
+
children: le.label
|
|
2013
2020
|
}) : null
|
|
2014
2021
|
]
|
|
2015
2022
|
})
|
|
2016
2023
|
});
|
|
2017
2024
|
}
|
|
2018
|
-
function
|
|
2025
|
+
function Sa({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRemove: a, onValueChange: o, onApply: s, onOpen: c, onRemove: l, onPopoverRef: u }) {
|
|
2019
2026
|
let d = sr(t);
|
|
2020
2027
|
return /* @__PURE__ */ Q("form", {
|
|
2021
2028
|
ref: u,
|
|
@@ -2068,7 +2075,7 @@ function xa({ inputRef: e, messages: t, value: n, canApply: r, canOpen: i, canRe
|
|
|
2068
2075
|
})]
|
|
2069
2076
|
});
|
|
2070
2077
|
}
|
|
2071
|
-
function
|
|
2078
|
+
function Ca({ inputRef: e, messages: t, phase: n, prompt: r, hasStreamedContent: i, error: a, onPromptChange: o, onSubmit: s, onStop: c, onAccept: l, onRetry: u, onDiscard: d, onPopoverRef: f }) {
|
|
2072
2079
|
let p = n === "input" || n === "result" || n === "error";
|
|
2073
2080
|
return /* @__PURE__ */ Q("section", {
|
|
2074
2081
|
ref: f,
|
|
@@ -2178,7 +2185,7 @@ function Sa({ inputRef: e, messages: t, phase: n, prompt: r, hasStreamedContent:
|
|
|
2178
2185
|
]
|
|
2179
2186
|
});
|
|
2180
2187
|
}
|
|
2181
|
-
function
|
|
2188
|
+
function wa({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointerDown: i, onTooltipChange: a, onRun: o }) {
|
|
2182
2189
|
return /* @__PURE__ */ Q(lt, { children: [n ? /* @__PURE__ */ Z("span", {
|
|
2183
2190
|
className: "markweave-floating-toolbar-divider",
|
|
2184
2191
|
"aria-hidden": "true"
|
|
@@ -2186,7 +2193,7 @@ function Ca({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointe
|
|
|
2186
2193
|
type: "button",
|
|
2187
2194
|
className: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${e.id}`,
|
|
2188
2195
|
"aria-label": e.label,
|
|
2189
|
-
"aria-expanded":
|
|
2196
|
+
"aria-expanded": va(e.id) ? t : void 0,
|
|
2190
2197
|
"data-active": e.active || t,
|
|
2191
2198
|
"data-tooltip-active": r ? "true" : "false",
|
|
2192
2199
|
"data-testid": `markweave-floating-toolbar-button-${e.id}`,
|
|
@@ -2196,13 +2203,13 @@ function Ca({ button: e, expanded: t, showDivider: n, tooltipActive: r, onPointe
|
|
|
2196
2203
|
onMouseEnter: (t) => a(e.id, t.currentTarget),
|
|
2197
2204
|
onMouseLeave: () => a(null),
|
|
2198
2205
|
onClick: () => o(e),
|
|
2199
|
-
children: /* @__PURE__ */ Z(
|
|
2206
|
+
children: /* @__PURE__ */ Z(Ta, {
|
|
2200
2207
|
button: e,
|
|
2201
2208
|
expanded: t
|
|
2202
2209
|
})
|
|
2203
2210
|
})] });
|
|
2204
2211
|
}
|
|
2205
|
-
function
|
|
2212
|
+
function Ta({ button: e, expanded: t }) {
|
|
2206
2213
|
return e.id === "improve" || e.id === "ask-ai" ? /* @__PURE__ */ Q("span", {
|
|
2207
2214
|
className: "markweave-floating-toolbar-button-inner",
|
|
2208
2215
|
children: [/* @__PURE__ */ Z($, { name: "sparkles" }), /* @__PURE__ */ Z("span", { children: e.glyph })]
|
|
@@ -2220,7 +2227,7 @@ function wa({ button: e, expanded: t }) {
|
|
|
2220
2227
|
}), /* @__PURE__ */ Z($, { name: t ? "chevron-up" : "chevron-down" })]
|
|
2221
2228
|
}) : /* @__PURE__ */ Z($, { name: "more" });
|
|
2222
2229
|
}
|
|
2223
|
-
function
|
|
2230
|
+
function Ea({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
|
|
2224
2231
|
let i = sr(t), a = dr(t);
|
|
2225
2232
|
return /* @__PURE__ */ Q("div", {
|
|
2226
2233
|
ref: n,
|
|
@@ -2239,21 +2246,21 @@ function Ta({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
|
|
|
2239
2246
|
},
|
|
2240
2247
|
children: [/* @__PURE__ */ Z("span", {
|
|
2241
2248
|
className: "markweave-floating-toolbar-menu-icon",
|
|
2242
|
-
children: /* @__PURE__ */ Z(
|
|
2249
|
+
children: /* @__PURE__ */ Z(Da, { option: t })
|
|
2243
2250
|
}), /* @__PURE__ */ Z("span", { children: t.label })]
|
|
2244
2251
|
}, t.id))]
|
|
2245
2252
|
});
|
|
2246
2253
|
}
|
|
2247
|
-
function
|
|
2254
|
+
function Da({ option: e }) {
|
|
2248
2255
|
return e.id === "paragraph" ? /* @__PURE__ */ Z($, { name: "text" }) : e.glyph === "bullet-list" || e.glyph === "numbered-list" || e.glyph === "todo-list" || e.glyph === "quote" || e.glyph === "code-block" ? /* @__PURE__ */ Z($, { name: e.glyph }) : /* @__PURE__ */ Z("span", { children: e.glyph });
|
|
2249
2256
|
}
|
|
2250
|
-
function
|
|
2257
|
+
function Oa({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
|
|
2251
2258
|
let i = sr(t), a = e.getAttributes("textStyle").color, o = e.getAttributes("highlight").color;
|
|
2252
2259
|
return /* @__PURE__ */ Q("div", {
|
|
2253
2260
|
ref: n,
|
|
2254
2261
|
className: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
2255
2262
|
"data-testid": "markweave-floating-toolbar-color-menu",
|
|
2256
|
-
children: [/* @__PURE__ */ Z(
|
|
2263
|
+
children: [/* @__PURE__ */ Z(ka, {
|
|
2257
2264
|
title: i.textColorTitle,
|
|
2258
2265
|
mode: "text",
|
|
2259
2266
|
activeColor: a ?? null,
|
|
@@ -2261,7 +2268,7 @@ function Da({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
|
|
|
2261
2268
|
onSelect: (t) => {
|
|
2262
2269
|
yr(e, t), r();
|
|
2263
2270
|
}
|
|
2264
|
-
}), /* @__PURE__ */ Z(
|
|
2271
|
+
}), /* @__PURE__ */ Z(ka, {
|
|
2265
2272
|
title: i.highlightColorTitle,
|
|
2266
2273
|
mode: "highlight",
|
|
2267
2274
|
activeColor: o ?? null,
|
|
@@ -2272,7 +2279,7 @@ function Da({ editor: e, messages: t, onPopoverRef: n, onClose: r }) {
|
|
|
2272
2279
|
})]
|
|
2273
2280
|
});
|
|
2274
2281
|
}
|
|
2275
|
-
function
|
|
2282
|
+
function ka({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
|
|
2276
2283
|
return /* @__PURE__ */ Q("section", {
|
|
2277
2284
|
className: "markweave-floating-toolbar-color-section",
|
|
2278
2285
|
"aria-label": e,
|
|
@@ -2301,13 +2308,13 @@ function Oa({ title: e, mode: t, activeColor: n, options: r, onSelect: i }) {
|
|
|
2301
2308
|
})]
|
|
2302
2309
|
});
|
|
2303
2310
|
}
|
|
2304
|
-
function
|
|
2311
|
+
function Aa({ editor: e, messages: t, activeTooltipId: n, onPopoverRef: r, onTooltipChange: i, onClose: a }) {
|
|
2305
2312
|
let o = cr(t);
|
|
2306
2313
|
return /* @__PURE__ */ Z("div", {
|
|
2307
2314
|
ref: r,
|
|
2308
2315
|
className: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
2309
2316
|
"data-testid": "markweave-floating-toolbar-more-menu",
|
|
2310
|
-
children: o.map((t, r) => /* @__PURE__ */ Z(
|
|
2317
|
+
children: o.map((t, r) => /* @__PURE__ */ Z(ja, {
|
|
2311
2318
|
action: t,
|
|
2312
2319
|
active: fr(e, t.id),
|
|
2313
2320
|
tooltipActive: n === t.id,
|
|
@@ -2319,7 +2326,7 @@ function ka({ editor: e, messages: t, activeTooltipId: n, onPopoverRef: r, onToo
|
|
|
2319
2326
|
}, t.id))
|
|
2320
2327
|
});
|
|
2321
2328
|
}
|
|
2322
|
-
function
|
|
2329
|
+
function ja({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipChange: i, onRun: a }) {
|
|
2323
2330
|
return /* @__PURE__ */ Q(lt, { children: [r ? /* @__PURE__ */ Z("span", {
|
|
2324
2331
|
className: "markweave-floating-toolbar-divider",
|
|
2325
2332
|
"aria-hidden": "true"
|
|
@@ -2335,7 +2342,7 @@ function Aa({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipC
|
|
|
2335
2342
|
onMouseEnter: () => i(e.id),
|
|
2336
2343
|
onMouseLeave: () => i(null),
|
|
2337
2344
|
onClick: a,
|
|
2338
|
-
children: /* @__PURE__ */ Z(
|
|
2345
|
+
children: /* @__PURE__ */ Z(Ma, { id: e.id })
|
|
2339
2346
|
}), n ? /* @__PURE__ */ Z("div", {
|
|
2340
2347
|
className: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2341
2348
|
role: "tooltip",
|
|
@@ -2343,28 +2350,28 @@ function Aa({ action: e, active: t, tooltipActive: n, showDivider: r, onTooltipC
|
|
|
2343
2350
|
}) : null]
|
|
2344
2351
|
})] });
|
|
2345
2352
|
}
|
|
2346
|
-
function
|
|
2353
|
+
function Ma({ id: e }) {
|
|
2347
2354
|
return e === "superscript" ? /* @__PURE__ */ Z($, { name: "superscript" }) : e === "subscript" ? /* @__PURE__ */ Z($, { name: "subscript" }) : e === "inline-math" ? /* @__PURE__ */ Z($, { name: "math" }) : Z($, { name: e });
|
|
2348
2355
|
}
|
|
2349
|
-
var
|
|
2356
|
+
var Na = {
|
|
2350
2357
|
sparkles: xe,
|
|
2351
2358
|
"arrow-up": b,
|
|
2352
|
-
check:
|
|
2353
|
-
"chevron-down":
|
|
2354
|
-
"chevron-up":
|
|
2355
|
-
"corner-down-left":
|
|
2356
|
-
"external-link":
|
|
2359
|
+
check: O,
|
|
2360
|
+
"chevron-down": A,
|
|
2361
|
+
"chevron-up": M,
|
|
2362
|
+
"corner-down-left": ne,
|
|
2363
|
+
"external-link": F,
|
|
2357
2364
|
bold: E,
|
|
2358
|
-
italic:
|
|
2365
|
+
italic: se,
|
|
2359
2366
|
underline: Ne,
|
|
2360
2367
|
strike: we,
|
|
2361
|
-
"inline-code":
|
|
2362
|
-
link:
|
|
2363
|
-
more:
|
|
2368
|
+
"inline-code": N,
|
|
2369
|
+
link: le,
|
|
2370
|
+
more: fe,
|
|
2364
2371
|
text: Me,
|
|
2365
|
-
"bullet-list":
|
|
2366
|
-
"numbered-list":
|
|
2367
|
-
"todo-list":
|
|
2372
|
+
"bullet-list": ue,
|
|
2373
|
+
"numbered-list": U,
|
|
2374
|
+
"todo-list": H,
|
|
2368
2375
|
quote: ge,
|
|
2369
2376
|
"code-block": D,
|
|
2370
2377
|
superscript: Ee,
|
|
@@ -2374,15 +2381,15 @@ var Ma = {
|
|
|
2374
2381
|
"align-center": l,
|
|
2375
2382
|
"align-right": f,
|
|
2376
2383
|
"align-justify": u,
|
|
2377
|
-
"decrease-indent":
|
|
2378
|
-
"increase-indent":
|
|
2384
|
+
"decrease-indent": B,
|
|
2385
|
+
"increase-indent": V,
|
|
2379
2386
|
trash: je,
|
|
2380
2387
|
"rotate-ccw": ve,
|
|
2381
2388
|
square: Se,
|
|
2382
2389
|
x: Ie
|
|
2383
2390
|
};
|
|
2384
2391
|
function $({ name: e }) {
|
|
2385
|
-
let t =
|
|
2392
|
+
let t = Na[e];
|
|
2386
2393
|
return /* @__PURE__ */ Z(t, {
|
|
2387
2394
|
"aria-hidden": "true",
|
|
2388
2395
|
absoluteStrokeWidth: !0,
|
|
@@ -2392,7 +2399,7 @@ function $({ name: e }) {
|
|
|
2392
2399
|
}
|
|
2393
2400
|
//#endregion
|
|
2394
2401
|
//#region src/ui/math/MathEditorPopover.tsx
|
|
2395
|
-
function
|
|
2402
|
+
function Pa({ editor: e, messages: t, onClose: n, target: r }) {
|
|
2396
2403
|
let i = J(null), a = J(null), [o, s] = Y(r.latex), [c, l] = Y(null), u = t.math, d = q(() => $t(e, r) ?? 1, [e, r]), f = q(() => en(e, r), [e, r]), p = q(() => o === r.latex && f ? {
|
|
2397
2404
|
html: f,
|
|
2398
2405
|
error: !1
|
|
@@ -2521,7 +2528,7 @@ function Na({ editor: e, messages: t, onClose: n, target: r }) {
|
|
|
2521
2528
|
className: "markweave-math-block-toolbar",
|
|
2522
2529
|
children: [
|
|
2523
2530
|
/* @__PURE__ */ Z("span", { children: u.label }),
|
|
2524
|
-
/* @__PURE__ */ Z(
|
|
2531
|
+
/* @__PURE__ */ Z(N, {
|
|
2525
2532
|
"aria-hidden": "true",
|
|
2526
2533
|
size: 15,
|
|
2527
2534
|
strokeWidth: 1.75
|
|
@@ -2532,7 +2539,7 @@ function Na({ editor: e, messages: t, onClose: n, target: r }) {
|
|
|
2532
2539
|
disabled: !m,
|
|
2533
2540
|
title: u.apply,
|
|
2534
2541
|
type: "submit",
|
|
2535
|
-
children: /* @__PURE__ */ Z(
|
|
2542
|
+
children: /* @__PURE__ */ Z(O, {
|
|
2536
2543
|
"aria-hidden": "true",
|
|
2537
2544
|
size: 16,
|
|
2538
2545
|
strokeWidth: 2
|
|
@@ -2577,31 +2584,31 @@ function Na({ editor: e, messages: t, onClose: n, target: r }) {
|
|
|
2577
2584
|
}
|
|
2578
2585
|
//#endregion
|
|
2579
2586
|
//#region src/ui/slash-command/SlashCommandMenu.tsx
|
|
2580
|
-
var
|
|
2587
|
+
var Fa = n("zh"), Ia = {
|
|
2581
2588
|
type: Ae,
|
|
2582
|
-
"heading-1":
|
|
2583
|
-
"heading-2":
|
|
2584
|
-
"heading-3":
|
|
2585
|
-
"bullet-list":
|
|
2586
|
-
"ordered-list":
|
|
2587
|
-
"task-list":
|
|
2589
|
+
"heading-1": ie,
|
|
2590
|
+
"heading-2": ae,
|
|
2591
|
+
"heading-3": L,
|
|
2592
|
+
"bullet-list": ue,
|
|
2593
|
+
"ordered-list": U,
|
|
2594
|
+
"task-list": H,
|
|
2588
2595
|
blockquote: ge,
|
|
2589
2596
|
"code-block": D,
|
|
2590
|
-
info:
|
|
2591
|
-
tip:
|
|
2597
|
+
info: oe,
|
|
2598
|
+
tip: ce,
|
|
2592
2599
|
warning: c,
|
|
2593
|
-
error:
|
|
2594
|
-
success:
|
|
2600
|
+
error: te,
|
|
2601
|
+
success: k,
|
|
2595
2602
|
emoji: be,
|
|
2596
2603
|
math: ye,
|
|
2597
2604
|
table: De,
|
|
2598
|
-
separator:
|
|
2599
|
-
image:
|
|
2605
|
+
separator: de,
|
|
2606
|
+
image: R,
|
|
2600
2607
|
video: Fe,
|
|
2601
2608
|
attachment: pe
|
|
2602
2609
|
};
|
|
2603
|
-
function
|
|
2604
|
-
let t =
|
|
2610
|
+
function La({ name: e }) {
|
|
2611
|
+
let t = Ia[e];
|
|
2605
2612
|
return /* @__PURE__ */ Z(t, {
|
|
2606
2613
|
"aria-hidden": "true",
|
|
2607
2614
|
absoluteStrokeWidth: !0,
|
|
@@ -2609,7 +2616,7 @@ function Ia({ name: e }) {
|
|
|
2609
2616
|
strokeWidth: 1.6
|
|
2610
2617
|
});
|
|
2611
2618
|
}
|
|
2612
|
-
function
|
|
2619
|
+
function Ra(e, t, n) {
|
|
2613
2620
|
return !fn(e) || !n ? {
|
|
2614
2621
|
visible: !1,
|
|
2615
2622
|
empty: !1,
|
|
@@ -2624,16 +2631,16 @@ function La(e, t, n) {
|
|
|
2624
2631
|
activeIndex: Math.min(t.length - 1, Math.max(0, e.activeIndex))
|
|
2625
2632
|
};
|
|
2626
2633
|
}
|
|
2627
|
-
function
|
|
2634
|
+
function za(e, t) {
|
|
2628
2635
|
return Object.values(t.slash.groups).map((t) => ({
|
|
2629
2636
|
group: t,
|
|
2630
2637
|
commands: e.filter((e) => e.group === t)
|
|
2631
2638
|
})).filter((e) => e.commands.length > 0);
|
|
2632
2639
|
}
|
|
2633
|
-
function
|
|
2640
|
+
function Ba(e, t) {
|
|
2634
2641
|
return t.slash.uploadKindLabels[e] ?? t.slash.uploadKindLabels.upload;
|
|
2635
2642
|
}
|
|
2636
|
-
function
|
|
2643
|
+
function Va({ command: e, messages: t, onBack: n, onSelect: r }) {
|
|
2637
2644
|
let [i, a] = Y(""), [o, s] = Y(0), c = q(() => {
|
|
2638
2645
|
let e = i.trim().toLowerCase();
|
|
2639
2646
|
return (e ? t.slash.emojiItems.filter((t) => [
|
|
@@ -2700,7 +2707,7 @@ function Ba({ command: e, messages: t, onBack: n, onSelect: r }) {
|
|
|
2700
2707
|
]
|
|
2701
2708
|
});
|
|
2702
2709
|
}
|
|
2703
|
-
function
|
|
2710
|
+
function Ha({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
|
|
2704
2711
|
let a = e.uploadKind ?? "attachment", [o, s] = Y(""), [c, l] = Y(null), [u, d] = Y(null), [f, p] = Y(!1), m = async (t) => {
|
|
2705
2712
|
r(e, { uploadResult: await X({
|
|
2706
2713
|
kind: a,
|
|
@@ -2740,7 +2747,7 @@ function Va({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
|
|
|
2740
2747
|
onMouseDown: (e) => e.preventDefault(),
|
|
2741
2748
|
onClick: n,
|
|
2742
2749
|
children: t.common.back
|
|
2743
|
-
}), /* @__PURE__ */ Z("span", { children:
|
|
2750
|
+
}), /* @__PURE__ */ Z("span", { children: Ba(a, t) })]
|
|
2744
2751
|
}),
|
|
2745
2752
|
/* @__PURE__ */ Q("label", {
|
|
2746
2753
|
className: "markweave-slash-upload-field",
|
|
@@ -2788,10 +2795,10 @@ function Va({ command: e, messages: t, onBack: n, onSelect: r, onUpload: i }) {
|
|
|
2788
2795
|
]
|
|
2789
2796
|
});
|
|
2790
2797
|
}
|
|
2791
|
-
function
|
|
2792
|
-
let l =
|
|
2798
|
+
function Ua({ commands: e, messages: t = Fa, state: n, position: r, inputCommand: i, onActiveIndexChange: a, onInputCommandChange: o, onSelect: s, onUpload: c }) {
|
|
2799
|
+
let l = Ra(n, e, r);
|
|
2793
2800
|
if (!l.visible || !r) return null;
|
|
2794
|
-
let u =
|
|
2801
|
+
let u = za(e, t), d = {
|
|
2795
2802
|
left: r.left,
|
|
2796
2803
|
top: r.top,
|
|
2797
2804
|
maxHeight: r.maxHeight,
|
|
@@ -2813,12 +2820,12 @@ function Ha({ commands: e, messages: t = Pa, state: n, position: r, inputCommand
|
|
|
2813
2820
|
"aria-label": t.slash.ariaLabel,
|
|
2814
2821
|
"data-placement": r.placement,
|
|
2815
2822
|
"data-testid": "markweave-slash-menu",
|
|
2816
|
-
children: i?.inputKind === "emoji" ? /* @__PURE__ */ Z(
|
|
2823
|
+
children: i?.inputKind === "emoji" ? /* @__PURE__ */ Z(Va, {
|
|
2817
2824
|
command: i,
|
|
2818
2825
|
messages: t,
|
|
2819
2826
|
onBack: m,
|
|
2820
2827
|
onSelect: s
|
|
2821
|
-
}) : i?.inputKind === "upload" ? /* @__PURE__ */ Z(
|
|
2828
|
+
}) : i?.inputKind === "upload" ? /* @__PURE__ */ Z(Ha, {
|
|
2822
2829
|
command: i,
|
|
2823
2830
|
messages: t,
|
|
2824
2831
|
onBack: m,
|
|
@@ -2862,7 +2869,7 @@ function Ha({ commands: e, messages: t = Pa, state: n, position: r, inputCommand
|
|
|
2862
2869
|
}
|
|
2863
2870
|
},
|
|
2864
2871
|
children: [
|
|
2865
|
-
/* @__PURE__ */ Z(
|
|
2872
|
+
/* @__PURE__ */ Z(La, { name: t.icon }),
|
|
2866
2873
|
/* @__PURE__ */ Z("span", { children: t.label }),
|
|
2867
2874
|
o && t.disabledReason ? /* @__PURE__ */ Z("small", { children: t.disabledReason }) : null
|
|
2868
2875
|
]
|
|
@@ -2874,7 +2881,7 @@ function Ha({ commands: e, messages: t = Pa, state: n, position: r, inputCommand
|
|
|
2874
2881
|
}
|
|
2875
2882
|
//#endregion
|
|
2876
2883
|
//#region src/ui/table/TableControls.tsx
|
|
2877
|
-
var
|
|
2884
|
+
var Wa = n("zh"), Ga = {
|
|
2878
2885
|
"move-left": v,
|
|
2879
2886
|
"move-right": y,
|
|
2880
2887
|
"move-up": b,
|
|
@@ -2888,13 +2895,13 @@ var Ua = n("zh"), Wa = {
|
|
|
2888
2895
|
color: W,
|
|
2889
2896
|
alignment: d,
|
|
2890
2897
|
clear: Ce,
|
|
2891
|
-
duplicate:
|
|
2892
|
-
copy:
|
|
2898
|
+
duplicate: P,
|
|
2899
|
+
copy: P,
|
|
2893
2900
|
merge: Oe,
|
|
2894
2901
|
split: ke,
|
|
2895
2902
|
"ask-ai": xe,
|
|
2896
2903
|
delete: je
|
|
2897
|
-
},
|
|
2904
|
+
}, Ka = {
|
|
2898
2905
|
left: d,
|
|
2899
2906
|
center: l,
|
|
2900
2907
|
right: f,
|
|
@@ -2902,62 +2909,62 @@ var Ua = n("zh"), Wa = {
|
|
|
2902
2909
|
middle: p,
|
|
2903
2910
|
bottom: m
|
|
2904
2911
|
};
|
|
2905
|
-
function
|
|
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),
|
|
2912
|
+
function qa({ active: e, editor: t, interactionState: n = Tn, messages: r = Wa, onCopyPayload: i, onCommandResult: a, askAi: o }) {
|
|
2913
|
+
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
2914
|
if (K(() => {
|
|
2908
|
-
if (!
|
|
2915
|
+
if (!k) return;
|
|
2909
2916
|
let e = window.setTimeout(() => {
|
|
2910
|
-
|
|
2911
|
-
},
|
|
2917
|
+
A(null);
|
|
2918
|
+
}, ui);
|
|
2912
2919
|
return () => {
|
|
2913
2920
|
window.clearTimeout(e);
|
|
2914
2921
|
};
|
|
2915
|
-
}, [
|
|
2922
|
+
}, [k]), K(() => {
|
|
2916
2923
|
let e = (e) => {
|
|
2917
|
-
let n =
|
|
2924
|
+
let n = ee.current;
|
|
2918
2925
|
if (!n) return;
|
|
2919
|
-
let r =
|
|
2920
|
-
r !== null && (e.preventDefault(),
|
|
2926
|
+
let r = Zr(t, n.axis, e.clientX, e.clientY);
|
|
2927
|
+
r !== null && (e.preventDefault(), O.current = r, e.dataTransfer && (e.dataTransfer.dropEffect = "move"));
|
|
2921
2928
|
}, n = (e) => {
|
|
2922
|
-
let n =
|
|
2929
|
+
let n = ee.current;
|
|
2923
2930
|
if (!n) return;
|
|
2924
|
-
let r =
|
|
2925
|
-
e.preventDefault(),
|
|
2931
|
+
let r = Zr(t, n.axis, e.clientX, e.clientY) ?? O.current;
|
|
2932
|
+
e.preventDefault(), ee.current = null, O.current = null, r !== null && si(t, n.axis, n.index, r);
|
|
2926
2933
|
};
|
|
2927
2934
|
return document.addEventListener("dragover", e), document.addEventListener("drop", n), () => {
|
|
2928
2935
|
document.removeEventListener("dragover", e), document.removeEventListener("drop", n);
|
|
2929
2936
|
};
|
|
2930
2937
|
}, [t]), Le(() => {
|
|
2931
2938
|
if (!e) {
|
|
2932
|
-
v(null), b(null), S(null), w(null), E(null),
|
|
2939
|
+
v(null), b(null), S(null), w(null), E(null), A(null);
|
|
2933
2940
|
return;
|
|
2934
2941
|
}
|
|
2935
2942
|
let r = () => {
|
|
2936
|
-
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, r =
|
|
2943
|
+
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, r = ei(t, n, "row", I?.activeCellPos ?? null), i = ei(t, n, "column", I?.activeCellPos ?? null), a = r ? $r(t, r) : null, o = i ? $r(t, i) : null, c = ii(t, "selection").length > 0 ? ai(t) : null, l = Xr(t)?.getBoundingClientRect() ?? null;
|
|
2937
2944
|
if (!e) {
|
|
2938
2945
|
v(null), b(null), S(null), w(null), E(null);
|
|
2939
2946
|
return;
|
|
2940
2947
|
}
|
|
2941
2948
|
let u = e.getBoundingClientRect();
|
|
2942
|
-
a ? v(
|
|
2949
|
+
a ? v(Gr({
|
|
2943
2950
|
targetRect: a,
|
|
2944
2951
|
frameRect: u,
|
|
2945
2952
|
kind: "row"
|
|
2946
|
-
})) : s === "row" && d === "row-edge" || v(null), o ? b(
|
|
2953
|
+
})) : s === "row" && d === "row-edge" || v(null), o ? b(Gr({
|
|
2947
2954
|
targetRect: o,
|
|
2948
2955
|
frameRect: u,
|
|
2949
2956
|
kind: "column"
|
|
2950
|
-
})) : s === "column" && d === "column-edge" || b(null), c ? S(
|
|
2957
|
+
})) : s === "column" && d === "column-edge" || b(null), c ? S(Gr({
|
|
2951
2958
|
targetRect: c,
|
|
2952
2959
|
frameRect: u,
|
|
2953
2960
|
kind: "selection"
|
|
2954
2961
|
})) : s === "selection" && d === "selection-edge" || S(null);
|
|
2955
2962
|
let f = n.hoverCellPos !== null && !!(r && r.index === r.visualHeight - 1), p = n.hoverCellPos !== null && !!(i && i.index === i.visualWidth - 1);
|
|
2956
|
-
w(l && f ?
|
|
2963
|
+
w(l && f ? Kr({
|
|
2957
2964
|
tableRect: l,
|
|
2958
2965
|
frameRect: u,
|
|
2959
2966
|
kind: "row"
|
|
2960
|
-
}) : null), E(l && p ?
|
|
2967
|
+
}) : null), E(l && p ? Kr({
|
|
2961
2968
|
tableRect: l,
|
|
2962
2969
|
frameRect: u,
|
|
2963
2970
|
kind: "column"
|
|
@@ -2969,9 +2976,9 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
2969
2976
|
}, [
|
|
2970
2977
|
e,
|
|
2971
2978
|
t,
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2979
|
+
I?.activeCellPos,
|
|
2980
|
+
I?.selectionFrom,
|
|
2981
|
+
I?.selectionTo,
|
|
2975
2982
|
n.hoverCellPos,
|
|
2976
2983
|
n.hoverVisualColumnIndex,
|
|
2977
2984
|
n.hoverVisualRowIndex,
|
|
@@ -2983,20 +2990,20 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
2983
2990
|
return;
|
|
2984
2991
|
}
|
|
2985
2992
|
let n = () => {
|
|
2986
|
-
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, n = d === "row-edge" ?
|
|
2993
|
+
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
2994
|
if (!e || !n || !r) {
|
|
2988
2995
|
m(null);
|
|
2989
2996
|
return;
|
|
2990
2997
|
}
|
|
2991
|
-
let i = n.getBoundingClientRect(), a = s === "row" ?
|
|
2998
|
+
let i = n.getBoundingClientRect(), a = s === "row" ? Xr(t)?.getBoundingClientRect() : null, o = a ? {
|
|
2992
2999
|
left: i.left,
|
|
2993
3000
|
top: a.top,
|
|
2994
3001
|
width: i.width,
|
|
2995
3002
|
height: i.height
|
|
2996
|
-
} : i, c = e.getBoundingClientRect(), l = r.getBoundingClientRect(), u =
|
|
3003
|
+
} : i, c = e.getBoundingClientRect(), l = r.getBoundingClientRect(), u = N.current?.scrollHeight ?? 0, f = u > 0 ? u + 12 : 0, p = Ur({
|
|
2997
3004
|
anchorRect: o,
|
|
2998
3005
|
frameRect: c,
|
|
2999
|
-
boundaryRect:
|
|
3006
|
+
boundaryRect: ti(e),
|
|
3000
3007
|
menuSize: {
|
|
3001
3008
|
width: l.width || 254,
|
|
3002
3009
|
height: f || l.height || 410
|
|
@@ -3022,16 +3029,16 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3022
3029
|
return;
|
|
3023
3030
|
}
|
|
3024
3031
|
let n = () => {
|
|
3025
|
-
let e = t.view.dom.closest(".markweave-editor-frame") ?? t.view.dom.parentElement, n =
|
|
3032
|
+
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
3033
|
if (!e || !n || !r || !i) {
|
|
3027
3034
|
g(null);
|
|
3028
3035
|
return;
|
|
3029
3036
|
}
|
|
3030
3037
|
let a = r.getBoundingClientRect(), o = Math.max(r.scrollHeight + 2, a.height);
|
|
3031
|
-
g(
|
|
3038
|
+
g(Wr({
|
|
3032
3039
|
triggerRect: i.getBoundingClientRect(),
|
|
3033
3040
|
parentMenuRect: n.getBoundingClientRect(),
|
|
3034
|
-
boundaryRect:
|
|
3041
|
+
boundaryRect: ti(e),
|
|
3035
3042
|
submenuSize: {
|
|
3036
3043
|
width: a.width || 238,
|
|
3037
3044
|
height: o || 410
|
|
@@ -3039,7 +3046,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3039
3046
|
}));
|
|
3040
3047
|
};
|
|
3041
3048
|
n();
|
|
3042
|
-
let r =
|
|
3049
|
+
let r = N.current;
|
|
3043
3050
|
return r?.addEventListener("scroll", n), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
|
|
3044
3051
|
r?.removeEventListener("scroll", n), window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
3045
3052
|
};
|
|
@@ -3060,7 +3067,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3060
3067
|
c(null), u(null), t.view.focus();
|
|
3061
3068
|
}
|
|
3062
3069
|
}, r = (e) => {
|
|
3063
|
-
e.target instanceof Node &&
|
|
3070
|
+
e.target instanceof Node && M.current?.contains(e.target) || (c(null), u(null));
|
|
3064
3071
|
};
|
|
3065
3072
|
return document.addEventListener("keydown", n), document.addEventListener("mousedown", r), () => {
|
|
3066
3073
|
document.removeEventListener("keydown", n), document.removeEventListener("mousedown", r);
|
|
@@ -3071,46 +3078,46 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3071
3078
|
s,
|
|
3072
3079
|
l
|
|
3073
3080
|
]), !e) return null;
|
|
3074
|
-
let
|
|
3081
|
+
let ie = (e, t) => {
|
|
3075
3082
|
let n = s === e && d === t;
|
|
3076
3083
|
f(t), c(n ? null : e), u(null);
|
|
3077
|
-
},
|
|
3078
|
-
t.view.dispatch(
|
|
3079
|
-
},
|
|
3080
|
-
let i = n.hoverCellPos ??
|
|
3081
|
-
i !== null &&
|
|
3082
|
-
},
|
|
3083
|
-
|
|
3084
|
-
},
|
|
3085
|
-
let o = await
|
|
3084
|
+
}, ae = () => {
|
|
3085
|
+
t.view.dispatch(zr(t.state.tr, null));
|
|
3086
|
+
}, L = (e, r) => {
|
|
3087
|
+
let i = n.hoverCellPos ?? I?.activeCellPos ?? null, a = n.hoverCellPos === null ? null : e === "row" ? n.hoverVisualRowIndex : n.hoverVisualColumnIndex;
|
|
3088
|
+
i !== null && ci(t, i, e, { visualIndex: a }), ie(e, r);
|
|
3089
|
+
}, R = () => {
|
|
3090
|
+
ae(), ie("selection", "selection-edge");
|
|
3091
|
+
}, z = ei(t, n, "row", I?.activeCellPos ?? null), B = ei(t, n, "column", I?.activeCellPos ?? null), V = o?.enabled === !0 && typeof o.handler == "function", oe = ii(t, "selection", { askAiEnabled: V }).length > 0, se = s ? ii(t, s, { askAiEnabled: V }) : [], ce = async (e, n) => {
|
|
3092
|
+
let o = await Jr({
|
|
3086
3093
|
editor: t,
|
|
3087
3094
|
commandId: e,
|
|
3088
3095
|
menu: n ?? s ?? "selection",
|
|
3089
3096
|
messages: r
|
|
3090
3097
|
});
|
|
3091
|
-
return o.copyFeedback ? (
|
|
3098
|
+
return o.copyFeedback ? (A(o.copyFeedback), o.copyPayload && i?.(o.copyPayload)) : A(null), a?.(o.commandResult), o.success;
|
|
3099
|
+
}, le = (e) => {
|
|
3100
|
+
!V || !Ir(t, e) || (c(null), u(null));
|
|
3092
3101
|
}, ue = (e) => {
|
|
3093
|
-
!B || !Fr(t, e) || (c(null), u(null));
|
|
3094
|
-
}, de = (e) => {
|
|
3095
3102
|
s !== "row" && s !== "column" || e(s) && D((e) => e + 1);
|
|
3096
|
-
},
|
|
3097
|
-
let r = e === "row" ?
|
|
3098
|
-
!r || i === null ||
|
|
3099
|
-
},
|
|
3100
|
-
|
|
3103
|
+
}, H = (e) => {
|
|
3104
|
+
let r = e === "row" ? z : B, i = n.hoverCellPos ?? I?.activeCellPos ?? null;
|
|
3105
|
+
!r || i === null || mi(t, i, e, { visualIndex: r.index }) && ce(e === "row" ? "add-row-after" : "add-column-after", e);
|
|
3106
|
+
}, U = (e, t, n) => {
|
|
3107
|
+
ee.current = {
|
|
3101
3108
|
axis: e,
|
|
3102
3109
|
index: t
|
|
3103
|
-
},
|
|
3104
|
-
},
|
|
3110
|
+
}, O.current = t, n.dataTransfer.effectAllowed = "move", n.dataTransfer.setData("application/x-markweave-table-axis", `${e}:${t}`);
|
|
3111
|
+
}, de = (e) => {
|
|
3105
3112
|
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
3113
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
3107
3114
|
e.preventDefault(), e.stopPropagation();
|
|
3108
3115
|
let t = e.key === "ArrowDown" ? 1 : -1;
|
|
3109
3116
|
r[i < 0 ? 0 : Math.min(r.length - 1, Math.max(0, i + t))]?.focus();
|
|
3110
3117
|
}
|
|
3111
|
-
}, W = s === "row" || s === "column" ?
|
|
3118
|
+
}, W = s === "row" || s === "column" ? Qr(t, s) : null;
|
|
3112
3119
|
return /* @__PURE__ */ Q("div", {
|
|
3113
|
-
ref:
|
|
3120
|
+
ref: M,
|
|
3114
3121
|
className: "markweave-table-controls",
|
|
3115
3122
|
"data-testid": "markweave-table-controls",
|
|
3116
3123
|
"aria-label": r.table.controlsAriaLabel,
|
|
@@ -3120,29 +3127,29 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3120
3127
|
t.view.dispatch(t.state.tr.setMeta(En, { type: "clear-hover" }));
|
|
3121
3128
|
},
|
|
3122
3129
|
children: [
|
|
3123
|
-
|
|
3130
|
+
k ? /* @__PURE__ */ Z("div", {
|
|
3124
3131
|
className: "markweave-table-copy-feedback",
|
|
3125
3132
|
role: "status",
|
|
3126
3133
|
"aria-live": "polite",
|
|
3127
3134
|
"data-testid": "markweave-table-copy-feedback",
|
|
3128
|
-
"data-copy-kind":
|
|
3129
|
-
"data-text-length":
|
|
3130
|
-
"data-html-length":
|
|
3131
|
-
children:
|
|
3135
|
+
"data-copy-kind": k.kind,
|
|
3136
|
+
"data-text-length": k.textLength,
|
|
3137
|
+
"data-html-length": k.htmlLength,
|
|
3138
|
+
children: Yr(k)
|
|
3132
3139
|
}) : null,
|
|
3133
3140
|
_ ? /* @__PURE__ */ Z("button", {
|
|
3134
3141
|
type: "button",
|
|
3135
|
-
ref:
|
|
3142
|
+
ref: ne,
|
|
3136
3143
|
className: "markweave-table-edge-handle markweave-table-edge-handle--row",
|
|
3137
3144
|
"aria-label": r.table.activeRowActions,
|
|
3138
3145
|
"aria-expanded": s === "row" && d === "row-edge",
|
|
3139
3146
|
"aria-haspopup": "menu",
|
|
3140
3147
|
title: r.table.rowActions,
|
|
3141
3148
|
"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":
|
|
3149
|
+
"data-axis-index": z?.index ?? "",
|
|
3150
|
+
"data-axis-selected-cells": z?.selectedCellCount ?? "",
|
|
3151
|
+
"data-axis-visual-cells": z?.visualCellCount ?? "",
|
|
3152
|
+
"data-axis-visual-size": z?.visualHeight ?? "",
|
|
3146
3153
|
style: {
|
|
3147
3154
|
left: _.left,
|
|
3148
3155
|
top: _.top,
|
|
@@ -3150,31 +3157,31 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3150
3157
|
height: _.height
|
|
3151
3158
|
},
|
|
3152
3159
|
draggable: !0,
|
|
3153
|
-
onDragStart: (e) =>
|
|
3160
|
+
onDragStart: (e) => U("row", z?.index ?? 0, e),
|
|
3154
3161
|
onDragEnd: () => {
|
|
3155
|
-
|
|
3162
|
+
ee.current = null, O.current = null;
|
|
3156
3163
|
},
|
|
3157
3164
|
onClick: () => {
|
|
3158
|
-
|
|
3165
|
+
L("row", "row-edge");
|
|
3159
3166
|
},
|
|
3160
|
-
children: /* @__PURE__ */ Z(
|
|
3167
|
+
children: /* @__PURE__ */ Z(fe, {
|
|
3161
3168
|
"aria-hidden": "true",
|
|
3162
3169
|
size: 14
|
|
3163
3170
|
})
|
|
3164
3171
|
}) : null,
|
|
3165
3172
|
y ? /* @__PURE__ */ Z("button", {
|
|
3166
3173
|
type: "button",
|
|
3167
|
-
ref:
|
|
3174
|
+
ref: re,
|
|
3168
3175
|
className: "markweave-table-edge-handle markweave-table-edge-handle--column",
|
|
3169
3176
|
"aria-label": r.table.activeColumnActions,
|
|
3170
3177
|
"aria-expanded": s === "column" && d === "column-edge",
|
|
3171
3178
|
"aria-haspopup": "menu",
|
|
3172
3179
|
title: r.table.columnActions,
|
|
3173
3180
|
"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":
|
|
3181
|
+
"data-axis-index": B?.index ?? "",
|
|
3182
|
+
"data-axis-selected-cells": B?.selectedCellCount ?? "",
|
|
3183
|
+
"data-axis-visual-cells": B?.visualCellCount ?? "",
|
|
3184
|
+
"data-axis-visual-size": B?.visualWidth ?? "",
|
|
3178
3185
|
style: {
|
|
3179
3186
|
left: y.left,
|
|
3180
3187
|
top: y.top,
|
|
@@ -3182,14 +3189,14 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3182
3189
|
height: y.height
|
|
3183
3190
|
},
|
|
3184
3191
|
draggable: !0,
|
|
3185
|
-
onDragStart: (e) =>
|
|
3192
|
+
onDragStart: (e) => U("column", B?.index ?? 0, e),
|
|
3186
3193
|
onDragEnd: () => {
|
|
3187
|
-
|
|
3194
|
+
ee.current = null, O.current = null;
|
|
3188
3195
|
},
|
|
3189
3196
|
onClick: () => {
|
|
3190
|
-
|
|
3197
|
+
L("column", "column-edge");
|
|
3191
3198
|
},
|
|
3192
|
-
children: /* @__PURE__ */ Z(
|
|
3199
|
+
children: /* @__PURE__ */ Z(fe, {
|
|
3193
3200
|
"aria-hidden": "true",
|
|
3194
3201
|
size: 14
|
|
3195
3202
|
})
|
|
@@ -3207,7 +3214,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3207
3214
|
height: C.height
|
|
3208
3215
|
},
|
|
3209
3216
|
onMouseDown: (e) => e.preventDefault(),
|
|
3210
|
-
onClick: () =>
|
|
3217
|
+
onClick: () => H("row"),
|
|
3211
3218
|
children: /* @__PURE__ */ Z(he, {
|
|
3212
3219
|
"aria-hidden": "true",
|
|
3213
3220
|
size: 16
|
|
@@ -3226,15 +3233,15 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3226
3233
|
height: T.height
|
|
3227
3234
|
},
|
|
3228
3235
|
onMouseDown: (e) => e.preventDefault(),
|
|
3229
|
-
onClick: () =>
|
|
3236
|
+
onClick: () => H("column"),
|
|
3230
3237
|
children: /* @__PURE__ */ Z(he, {
|
|
3231
3238
|
"aria-hidden": "true",
|
|
3232
3239
|
size: 16
|
|
3233
3240
|
})
|
|
3234
3241
|
}) : null,
|
|
3235
|
-
|
|
3242
|
+
oe && x ? /* @__PURE__ */ Z("button", {
|
|
3236
3243
|
type: "button",
|
|
3237
|
-
ref:
|
|
3244
|
+
ref: F,
|
|
3238
3245
|
className: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
3239
3246
|
"aria-label": r.table.selectionActions,
|
|
3240
3247
|
"aria-expanded": s === "selection" && d === "selection-edge",
|
|
@@ -3248,17 +3255,17 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3248
3255
|
height: x.height
|
|
3249
3256
|
},
|
|
3250
3257
|
onMouseDown: (e) => e.preventDefault(),
|
|
3251
|
-
onClick:
|
|
3252
|
-
children: /* @__PURE__ */ Z(
|
|
3258
|
+
onClick: R,
|
|
3259
|
+
children: /* @__PURE__ */ Z(fe, {
|
|
3253
3260
|
"aria-hidden": "true",
|
|
3254
3261
|
size: 14
|
|
3255
3262
|
})
|
|
3256
3263
|
}) : null,
|
|
3257
3264
|
s ? /* @__PURE__ */ Q("div", {
|
|
3258
|
-
ref:
|
|
3265
|
+
ref: te,
|
|
3259
3266
|
className: "markweave-table-menu",
|
|
3260
3267
|
role: "menu",
|
|
3261
|
-
"aria-label":
|
|
3268
|
+
"aria-label": fi(s, r),
|
|
3262
3269
|
"data-testid": "markweave-table-menu",
|
|
3263
3270
|
"data-positioned": p ? "true" : "false",
|
|
3264
3271
|
"data-placement": p?.placement,
|
|
@@ -3267,14 +3274,14 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3267
3274
|
left: p.left,
|
|
3268
3275
|
top: p.top
|
|
3269
3276
|
} : void 0,
|
|
3270
|
-
onKeyDown:
|
|
3277
|
+
onKeyDown: de,
|
|
3271
3278
|
children: [
|
|
3272
3279
|
/* @__PURE__ */ Z("div", {
|
|
3273
|
-
ref:
|
|
3280
|
+
ref: N,
|
|
3274
3281
|
className: "markweave-table-menu-scroll",
|
|
3275
3282
|
style: p ? { maxHeight: Math.max(1, p.maxHeight - 12) } : void 0,
|
|
3276
|
-
children:
|
|
3277
|
-
let i =
|
|
3283
|
+
children: se.map((e, n) => {
|
|
3284
|
+
let i = ni(e), a = n === 0 ? i : ni(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 : qr(t, e.commandId), p = ri(e, r), m = Ga[e.icon];
|
|
3278
3285
|
return /* @__PURE__ */ Q("button", {
|
|
3279
3286
|
type: "button",
|
|
3280
3287
|
role: "menuitem",
|
|
@@ -3283,14 +3290,14 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3283
3290
|
"aria-haspopup": e.submenuId ? "menu" : void 0,
|
|
3284
3291
|
"aria-expanded": e.submenuId ? l === e.submenuId : void 0,
|
|
3285
3292
|
disabled: !f,
|
|
3286
|
-
title: e.id === "edit-with-ai" &&
|
|
3293
|
+
title: e.id === "edit-with-ai" && V && !f ? r.askAi.tableMergedUnsupported : void 0,
|
|
3287
3294
|
"data-menu-group": i,
|
|
3288
3295
|
"data-starts-group": o ? "true" : "false",
|
|
3289
3296
|
"data-command-enabled": f ? "true" : "false",
|
|
3290
3297
|
"data-submenu-trigger": e.submenuId ?? void 0,
|
|
3291
3298
|
"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
3299
|
onMouseDown: (t) => {
|
|
3293
|
-
t.preventDefault(), f && e.id === "edit-with-ai" &&
|
|
3300
|
+
t.preventDefault(), f && e.id === "edit-with-ai" && le(d);
|
|
3294
3301
|
},
|
|
3295
3302
|
onMouseEnter: () => u(e.submenuId),
|
|
3296
3303
|
onClick: (t) => {
|
|
@@ -3300,10 +3307,10 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3300
3307
|
return;
|
|
3301
3308
|
}
|
|
3302
3309
|
if (e.commandId === null) {
|
|
3303
|
-
t.detail === 0 &&
|
|
3310
|
+
t.detail === 0 && le(d);
|
|
3304
3311
|
return;
|
|
3305
3312
|
}
|
|
3306
|
-
|
|
3313
|
+
ce(e.commandId).finally(() => {
|
|
3307
3314
|
c(null), u(null);
|
|
3308
3315
|
});
|
|
3309
3316
|
}
|
|
@@ -3331,7 +3338,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3331
3338
|
})
|
|
3332
3339
|
}),
|
|
3333
3340
|
l === "color" && (s === "row" || s === "column") ? /* @__PURE__ */ Q("div", {
|
|
3334
|
-
ref:
|
|
3341
|
+
ref: P,
|
|
3335
3342
|
className: "markweave-table-submenu markweave-table-color-menu",
|
|
3336
3343
|
role: "menu",
|
|
3337
3344
|
"aria-label": r.table.submenus.color,
|
|
@@ -3343,20 +3350,20 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3343
3350
|
top: h.top,
|
|
3344
3351
|
maxHeight: h.maxHeight
|
|
3345
3352
|
} : void 0,
|
|
3346
|
-
onKeyDown:
|
|
3353
|
+
onKeyDown: de,
|
|
3347
3354
|
children: [
|
|
3348
3355
|
/* @__PURE__ */ Z("div", {
|
|
3349
3356
|
className: "markweave-table-submenu-title",
|
|
3350
3357
|
children: r.table.submenus.textColor
|
|
3351
3358
|
}),
|
|
3352
|
-
|
|
3359
|
+
li.map((e) => /* @__PURE__ */ Q("button", {
|
|
3353
3360
|
type: "button",
|
|
3354
3361
|
role: "menuitemradio",
|
|
3355
3362
|
"aria-checked": W?.textColorId === e.id,
|
|
3356
3363
|
"data-active": W?.textColorId === e.id ? "true" : "false",
|
|
3357
3364
|
"data-testid": `markweave-table-text-color-${e.id}`,
|
|
3358
3365
|
onMouseDown: (e) => e.preventDefault(),
|
|
3359
|
-
onClick: () =>
|
|
3366
|
+
onClick: () => ue((n) => Hr(t, n, e.id)),
|
|
3360
3367
|
children: [/* @__PURE__ */ Z("span", {
|
|
3361
3368
|
className: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3362
3369
|
"aria-hidden": "true",
|
|
@@ -3368,14 +3375,14 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3368
3375
|
className: "markweave-table-submenu-title",
|
|
3369
3376
|
children: r.table.submenus.backgroundColor
|
|
3370
3377
|
}),
|
|
3371
|
-
|
|
3378
|
+
li.map((e) => /* @__PURE__ */ Q("button", {
|
|
3372
3379
|
type: "button",
|
|
3373
3380
|
role: "menuitemradio",
|
|
3374
3381
|
"aria-checked": W?.backgroundColorId === e.id,
|
|
3375
3382
|
"data-active": W?.backgroundColorId === e.id ? "true" : "false",
|
|
3376
3383
|
"data-testid": `markweave-table-background-color-${e.id}`,
|
|
3377
3384
|
onMouseDown: (e) => e.preventDefault(),
|
|
3378
|
-
onClick: () =>
|
|
3385
|
+
onClick: () => ue((n) => Vr(t, n, e.id)),
|
|
3379
3386
|
children: [/* @__PURE__ */ Z("span", {
|
|
3380
3387
|
className: "markweave-table-color-swatch",
|
|
3381
3388
|
"aria-hidden": "true",
|
|
@@ -3385,7 +3392,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3385
3392
|
]
|
|
3386
3393
|
}) : null,
|
|
3387
3394
|
l === "alignment" && (s === "row" || s === "column") ? /* @__PURE__ */ Q("div", {
|
|
3388
|
-
ref:
|
|
3395
|
+
ref: P,
|
|
3389
3396
|
className: "markweave-table-submenu markweave-table-alignment-menu",
|
|
3390
3397
|
role: "menu",
|
|
3391
3398
|
"aria-label": r.table.submenus.alignment,
|
|
@@ -3397,10 +3404,10 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3397
3404
|
top: h.top,
|
|
3398
3405
|
maxHeight: h.maxHeight
|
|
3399
3406
|
} : void 0,
|
|
3400
|
-
onKeyDown:
|
|
3407
|
+
onKeyDown: de,
|
|
3401
3408
|
children: [
|
|
3402
|
-
|
|
3403
|
-
let n =
|
|
3409
|
+
di.map((e) => {
|
|
3410
|
+
let n = Ka[e], i = W?.textAlign === e;
|
|
3404
3411
|
return /* @__PURE__ */ Q("button", {
|
|
3405
3412
|
type: "button",
|
|
3406
3413
|
role: "menuitemradio",
|
|
@@ -3408,7 +3415,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3408
3415
|
"data-active": i ? "true" : "false",
|
|
3409
3416
|
"data-testid": `markweave-table-alignment-${e}`,
|
|
3410
3417
|
onMouseDown: (e) => e.preventDefault(),
|
|
3411
|
-
onClick: () =>
|
|
3418
|
+
onClick: () => ue((n) => Br(t, n, e)),
|
|
3412
3419
|
children: [/* @__PURE__ */ Z(n, {
|
|
3413
3420
|
"aria-hidden": "true",
|
|
3414
3421
|
size: 18,
|
|
@@ -3417,8 +3424,8 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3417
3424
|
}, e);
|
|
3418
3425
|
}),
|
|
3419
3426
|
/* @__PURE__ */ Z("div", { className: "markweave-table-submenu-separator" }),
|
|
3420
|
-
|
|
3421
|
-
let n =
|
|
3427
|
+
pi.map((e) => {
|
|
3428
|
+
let n = Ka[e], i = W?.verticalAlign === e;
|
|
3422
3429
|
return /* @__PURE__ */ Q("button", {
|
|
3423
3430
|
type: "button",
|
|
3424
3431
|
role: "menuitemradio",
|
|
@@ -3426,7 +3433,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3426
3433
|
"data-active": i ? "true" : "false",
|
|
3427
3434
|
"data-testid": `markweave-table-alignment-${e}`,
|
|
3428
3435
|
onMouseDown: (e) => e.preventDefault(),
|
|
3429
|
-
onClick: () =>
|
|
3436
|
+
onClick: () => ue((n) => Br(t, n, e)),
|
|
3430
3437
|
children: [/* @__PURE__ */ Z(n, {
|
|
3431
3438
|
"aria-hidden": "true",
|
|
3432
3439
|
size: 18,
|
|
@@ -3443,7 +3450,7 @@ function Ka({ active: e, editor: t, interactionState: n = Tn, messages: r = Ua,
|
|
|
3443
3450
|
}
|
|
3444
3451
|
//#endregion
|
|
3445
3452
|
//#region src/ui/table/TableSelectionOverlay.tsx
|
|
3446
|
-
function
|
|
3453
|
+
function Ja({ editor: e, focusState: t }) {
|
|
3447
3454
|
let [n, r] = Y(null);
|
|
3448
3455
|
return Le(() => {
|
|
3449
3456
|
if (t.mode !== "cell-selection") {
|
|
@@ -3451,7 +3458,7 @@ function qa({ editor: e, focusState: t }) {
|
|
|
3451
3458
|
return;
|
|
3452
3459
|
}
|
|
3453
3460
|
let n = () => {
|
|
3454
|
-
r(
|
|
3461
|
+
r(oi(e, wn(e.state)));
|
|
3455
3462
|
};
|
|
3456
3463
|
return n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
|
|
3457
3464
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
@@ -3487,16 +3494,16 @@ function qa({ editor: e, focusState: t }) {
|
|
|
3487
3494
|
}
|
|
3488
3495
|
//#endregion
|
|
3489
3496
|
//#region src/ui/toc/MarkweaveInnerToc.tsx
|
|
3490
|
-
function
|
|
3497
|
+
function Ya(e, t) {
|
|
3491
3498
|
return `${e.toc.itemAriaLabel}: ${t.text}`;
|
|
3492
3499
|
}
|
|
3493
|
-
function
|
|
3500
|
+
function Xa({ editor: e, state: t, messages: n, editable: r, placement: i }) {
|
|
3494
3501
|
let a = J(null);
|
|
3495
3502
|
if (K(() => {
|
|
3496
|
-
if (!(i !== "container" || !a.current)) return
|
|
3503
|
+
if (!(i !== "container" || !a.current)) return xi(a.current);
|
|
3497
3504
|
}, [i]), !t.items.length) return null;
|
|
3498
3505
|
let o = (t) => {
|
|
3499
|
-
|
|
3506
|
+
Si(e, t, {
|
|
3500
3507
|
behavior: "smooth",
|
|
3501
3508
|
focus: r
|
|
3502
3509
|
});
|
|
@@ -3523,7 +3530,7 @@ function Ya({ editor: e, state: t, messages: n, editable: r, placement: i }) {
|
|
|
3523
3530
|
"data-level": e.level,
|
|
3524
3531
|
"data-active": e.active ? "true" : "false",
|
|
3525
3532
|
"aria-current": e.active ? "location" : void 0,
|
|
3526
|
-
"aria-label":
|
|
3533
|
+
"aria-label": Ya(n, e),
|
|
3527
3534
|
title: e.text,
|
|
3528
3535
|
onClick: () => o(e),
|
|
3529
3536
|
children: e.text
|
|
@@ -3534,7 +3541,7 @@ function Ya({ editor: e, state: t, messages: n, editable: r, placement: i }) {
|
|
|
3534
3541
|
}
|
|
3535
3542
|
//#endregion
|
|
3536
3543
|
//#region src/MarkweaveEditor.tsx
|
|
3537
|
-
var
|
|
3544
|
+
var Za = {
|
|
3538
3545
|
active: !1,
|
|
3539
3546
|
mode: "outside",
|
|
3540
3547
|
activeCellPos: null,
|
|
@@ -3542,21 +3549,21 @@ var Xa = {
|
|
|
3542
3549
|
selectedCellCount: 0,
|
|
3543
3550
|
selectionFrom: 0,
|
|
3544
3551
|
selectionTo: 0
|
|
3545
|
-
},
|
|
3552
|
+
}, Qa = {
|
|
3546
3553
|
active: !1,
|
|
3547
3554
|
language: Vt.defaultLanguage,
|
|
3548
3555
|
mermaidPreviewMode: "code",
|
|
3549
3556
|
pos: null,
|
|
3550
3557
|
text: ""
|
|
3551
|
-
},
|
|
3558
|
+
}, $a = Yt({
|
|
3552
3559
|
active: !1,
|
|
3553
3560
|
mode: "code",
|
|
3554
3561
|
source: ""
|
|
3555
3562
|
});
|
|
3556
|
-
function
|
|
3563
|
+
function eo(e) {
|
|
3557
3564
|
return En.getState(e.state) ?? Tn;
|
|
3558
3565
|
}
|
|
3559
|
-
function
|
|
3566
|
+
function to(e) {
|
|
3560
3567
|
if (!e || typeof window > "u") return null;
|
|
3561
3568
|
let t = e.parentElement;
|
|
3562
3569
|
for (; t;) {
|
|
@@ -3566,58 +3573,58 @@ function eo(e) {
|
|
|
3566
3573
|
}
|
|
3567
3574
|
return null;
|
|
3568
3575
|
}
|
|
3569
|
-
function
|
|
3576
|
+
function no(e) {
|
|
3570
3577
|
return typeof window > "u" || typeof window.requestAnimationFrame != "function" ? globalThis.setTimeout(() => e(0), 0) : window.requestAnimationFrame(e);
|
|
3571
3578
|
}
|
|
3572
|
-
function
|
|
3579
|
+
function ro(e) {
|
|
3573
3580
|
if (typeof window < "u" && typeof window.cancelAnimationFrame == "function") {
|
|
3574
3581
|
window.cancelAnimationFrame(e);
|
|
3575
3582
|
return;
|
|
3576
3583
|
}
|
|
3577
3584
|
globalThis.clearTimeout(e);
|
|
3578
3585
|
}
|
|
3579
|
-
function
|
|
3580
|
-
let j = rt(g),
|
|
3586
|
+
function io({ 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 } = {}) {
|
|
3587
|
+
let j = rt(g), M = wi(_), te = Ci(v), N = bi(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
3588
|
editorMode: j,
|
|
3582
|
-
effectiveEditable:
|
|
3589
|
+
effectiveEditable: P
|
|
3583
3590
|
});
|
|
3584
|
-
|
|
3591
|
+
R.current = {
|
|
3585
3592
|
editorMode: j,
|
|
3586
|
-
effectiveEditable:
|
|
3593
|
+
effectiveEditable: P
|
|
3587
3594
|
};
|
|
3588
|
-
let
|
|
3589
|
-
|
|
3590
|
-
let
|
|
3591
|
-
|
|
3592
|
-
let
|
|
3593
|
-
|
|
3594
|
-
let
|
|
3595
|
-
|
|
3596
|
-
let
|
|
3597
|
-
|
|
3598
|
-
let
|
|
3599
|
-
lang:
|
|
3595
|
+
let z = J(null);
|
|
3596
|
+
z.current === null && (z.current = r(h));
|
|
3597
|
+
let B = z.current, V = q(() => n(B), [B]), oe = q(() => t(B), [B]), se = J(T);
|
|
3598
|
+
se.current = T;
|
|
3599
|
+
let ce = J(w);
|
|
3600
|
+
ce.current = w;
|
|
3601
|
+
let le = J(S);
|
|
3602
|
+
le.current = S;
|
|
3603
|
+
let ue = J(k);
|
|
3604
|
+
ue.current = k;
|
|
3605
|
+
let H = q(() => Xi({
|
|
3606
|
+
lang: B,
|
|
3600
3607
|
onImageUpload: (e) => {
|
|
3601
|
-
if (
|
|
3608
|
+
if (se.current) return se.current(e);
|
|
3602
3609
|
let t = Be(e);
|
|
3603
3610
|
if (!t) throw Error("File upload requires an upload handler.");
|
|
3604
3611
|
return t;
|
|
3605
3612
|
},
|
|
3606
3613
|
onVideoUpload: (e) => {
|
|
3607
|
-
if (
|
|
3614
|
+
if (se.current) return se.current(e);
|
|
3608
3615
|
let t = Be(e);
|
|
3609
3616
|
if (!t) throw Error("File upload requires an upload handler.");
|
|
3610
3617
|
return t;
|
|
3611
3618
|
},
|
|
3612
|
-
linkCardResolver: (e) =>
|
|
3613
|
-
resolveMediaSource:
|
|
3614
|
-
}), [
|
|
3619
|
+
linkCardResolver: (e) => ue.current?.(e) ?? Promise.resolve(null),
|
|
3620
|
+
resolveMediaSource: A
|
|
3621
|
+
}), [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
3622
|
content: c,
|
|
3616
|
-
format:
|
|
3617
|
-
}), ke = J(null), Ae = J(null), je = J({ onUpdate:
|
|
3618
|
-
je.current = { onUpdate:
|
|
3623
|
+
format: ne
|
|
3624
|
+
}), ke = J(null), Ae = J(null), je = J({ onUpdate: O }), Me = q(() => ln(fe.query, oe), [oe, fe.query]);
|
|
3625
|
+
je.current = { onUpdate: O }, Oe.current = {
|
|
3619
3626
|
content: c,
|
|
3620
|
-
format:
|
|
3627
|
+
format: ne
|
|
3621
3628
|
};
|
|
3622
3629
|
let Ne = G(() => {
|
|
3623
3630
|
Ae.current !== null && (window.clearTimeout(Ae.current), Ae.current = null), Ee((e) => e + 1);
|
|
@@ -3649,36 +3656,36 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3649
3656
|
me((e) => pn(e, a) ? e : a), W((e) => hn(e, t));
|
|
3650
3657
|
}, []), Le = G((e) => Ie(e.view), [Ie]), Re = G((e) => {
|
|
3651
3658
|
let t = jt(e);
|
|
3652
|
-
|
|
3659
|
+
de((e) => Dt(e, t) ? e : t);
|
|
3653
3660
|
let n = rn(e);
|
|
3654
3661
|
n && (on(e, n, !0), be(n));
|
|
3655
3662
|
let r = zt(e);
|
|
3656
3663
|
r.active && r.language === "mermaid" && ve(r.mermaidPreviewMode);
|
|
3657
3664
|
}, []), ze = G((e) => {
|
|
3658
|
-
Se(
|
|
3665
|
+
Se(eo(e));
|
|
3659
3666
|
}, []), X = s({
|
|
3660
3667
|
shouldRerenderOnTransaction: !1,
|
|
3661
|
-
extensions:
|
|
3662
|
-
content:
|
|
3663
|
-
contentType: bt(
|
|
3664
|
-
editable:
|
|
3668
|
+
extensions: H,
|
|
3669
|
+
content: I ? "" : re,
|
|
3670
|
+
contentType: bt(ne),
|
|
3671
|
+
editable: P,
|
|
3665
3672
|
autofocus: o,
|
|
3666
3673
|
editorProps: {
|
|
3667
3674
|
attributes: {
|
|
3668
3675
|
class: "markweave-editor-surface",
|
|
3669
3676
|
"data-testid": "markweave-editor-surface",
|
|
3670
|
-
"data-markweave-large-document":
|
|
3677
|
+
"data-markweave-large-document": F ? "true" : "false",
|
|
3671
3678
|
autocapitalize: "off",
|
|
3672
3679
|
autocorrect: "off",
|
|
3673
3680
|
spellcheck: "false",
|
|
3674
3681
|
translate: "no"
|
|
3675
3682
|
},
|
|
3676
|
-
handleClick: (e, t, n) =>
|
|
3683
|
+
handleClick: (e, t, n) => R.current.effectiveEditable ? !1 : wt(n),
|
|
3677
3684
|
handleDOMEvents: {
|
|
3678
|
-
compositionstart: () =>
|
|
3679
|
-
compositionend: (e) => (
|
|
3685
|
+
compositionstart: () => R.current.effectiveEditable ? (W((e) => bn(e, { type: "composition-start" })), me(null), !1) : !1,
|
|
3686
|
+
compositionend: (e) => (R.current.effectiveEditable && window.setTimeout(() => Ie(e), 0), !1),
|
|
3680
3687
|
click: (e, t) => {
|
|
3681
|
-
if (
|
|
3688
|
+
if (R.current.effectiveEditable) {
|
|
3682
3689
|
let n = nn(e, t);
|
|
3683
3690
|
return n ? (t.preventDefault(), t.stopPropagation(), Fe(), sn(e, n, !0), cn(e, n), be(n), !0) : (be(null), !1);
|
|
3684
3691
|
}
|
|
@@ -3690,7 +3697,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3690
3697
|
Re(e);
|
|
3691
3698
|
},
|
|
3692
3699
|
onCreate: ({ editor: e }) => {
|
|
3693
|
-
a &&
|
|
3700
|
+
a && R.current.effectiveEditable && Sn(e), ze(e), Re(e), Ne();
|
|
3694
3701
|
},
|
|
3695
3702
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3696
3703
|
ze(e), (t.docChanged || Gt(t)) && Pe(), t.docChanged && be((t) => {
|
|
@@ -3700,7 +3707,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3700
3707
|
});
|
|
3701
3708
|
},
|
|
3702
3709
|
onUpdate: ({ editor: e }) => {
|
|
3703
|
-
Re(e),
|
|
3710
|
+
Re(e), R.current.effectiveEditable && Le(e), De.current || je.current.onUpdate?.(yt(e, { onContentRead: (t, n) => {
|
|
3704
3711
|
let r = Oe.current;
|
|
3705
3712
|
r.content !== void 0 && t === r.format && (ke.current = {
|
|
3706
3713
|
content: n,
|
|
@@ -3711,14 +3718,14 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3711
3718
|
}
|
|
3712
3719
|
});
|
|
3713
3720
|
K(() => {
|
|
3714
|
-
let e =
|
|
3721
|
+
let e = ie.current;
|
|
3715
3722
|
if (!X || !e) return;
|
|
3716
3723
|
let t = !1;
|
|
3717
3724
|
return (async () => {
|
|
3718
3725
|
De.current = !0;
|
|
3719
3726
|
try {
|
|
3720
3727
|
let n = !0;
|
|
3721
|
-
for (let r of
|
|
3728
|
+
for (let r of Ti(e)) {
|
|
3722
3729
|
if (await new Promise((e) => window.setTimeout(e, 0)), t) return;
|
|
3723
3730
|
let e = X.markdown?.parse(r);
|
|
3724
3731
|
if (!e) throw Error("Markdown parser is unavailable.");
|
|
@@ -3726,7 +3733,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3726
3733
|
X.view.dispatch(a.setMeta("addToHistory", !1)), n = !1;
|
|
3727
3734
|
}
|
|
3728
3735
|
if (t) return;
|
|
3729
|
-
Re(X), ze(X), Ne(),
|
|
3736
|
+
Re(X), ze(X), Ne(), ie.current = null, L(!1);
|
|
3730
3737
|
} finally {
|
|
3731
3738
|
De.current = !1;
|
|
3732
3739
|
}
|
|
@@ -3734,7 +3741,7 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3734
3741
|
t || (X.commands.setContent(e, {
|
|
3735
3742
|
contentType: "markdown",
|
|
3736
3743
|
emitUpdate: !1
|
|
3737
|
-
}),
|
|
3744
|
+
}), ie.current = null, L(!1));
|
|
3738
3745
|
}), () => {
|
|
3739
3746
|
t = !0;
|
|
3740
3747
|
};
|
|
@@ -3744,30 +3751,30 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3744
3751
|
Re,
|
|
3745
3752
|
ze
|
|
3746
3753
|
]), K(() => {
|
|
3747
|
-
if (X) return
|
|
3748
|
-
|
|
3754
|
+
if (X) return ce.current?.(Ei(X)), () => {
|
|
3755
|
+
ce.current?.(null);
|
|
3749
3756
|
};
|
|
3750
3757
|
}, [X]), K(() => {
|
|
3751
|
-
if (X) return
|
|
3752
|
-
|
|
3758
|
+
if (X) return le.current?.(Di(X)), () => {
|
|
3759
|
+
le.current?.(null);
|
|
3753
3760
|
};
|
|
3754
3761
|
}, [X]), K(() => {
|
|
3755
3762
|
if (!X) return;
|
|
3756
|
-
let e =
|
|
3763
|
+
let e = P && !ae;
|
|
3757
3764
|
X.setEditable(e), it(X, {
|
|
3758
3765
|
mode: j,
|
|
3759
3766
|
editable: e
|
|
3760
|
-
}), qt(X, e ? "live" : "view"), Ne(),
|
|
3767
|
+
}), qt(X, e ? "live" : "view"), Ne(), P || Fe();
|
|
3761
3768
|
}, [
|
|
3762
3769
|
Fe,
|
|
3763
3770
|
X,
|
|
3764
3771
|
j,
|
|
3765
|
-
|
|
3772
|
+
P,
|
|
3766
3773
|
Ne,
|
|
3767
|
-
|
|
3774
|
+
ae
|
|
3768
3775
|
]), K(() => {
|
|
3769
|
-
X && Kt(X,
|
|
3770
|
-
}, [X,
|
|
3776
|
+
X && Kt(X, M);
|
|
3777
|
+
}, [X, M]), K(() => {
|
|
3771
3778
|
let e = Ct(l);
|
|
3772
3779
|
if (!(!X || c === void 0)) {
|
|
3773
3780
|
if (St(X, ke.current, c, e)) {
|
|
@@ -3777,12 +3784,12 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3777
3784
|
ke.current = null, !xt(X, c, e) && (De.current = !0, X.commands.setContent(c, {
|
|
3778
3785
|
contentType: bt(e),
|
|
3779
3786
|
emitUpdate: !1
|
|
3780
|
-
}), De.current = !1, Re(X),
|
|
3787
|
+
}), De.current = !1, Re(X), P && Le(X), ze(X), Ne());
|
|
3781
3788
|
}
|
|
3782
3789
|
}, [
|
|
3783
3790
|
c,
|
|
3784
3791
|
l,
|
|
3785
|
-
|
|
3792
|
+
P,
|
|
3786
3793
|
X,
|
|
3787
3794
|
Ne,
|
|
3788
3795
|
Re,
|
|
@@ -3810,20 +3817,20 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3810
3817
|
Ve,
|
|
3811
3818
|
Ie
|
|
3812
3819
|
]);
|
|
3813
|
-
let He = q(() => X ? zt(X) :
|
|
3820
|
+
let He = q(() => X ? zt(X) : Qa, [
|
|
3814
3821
|
X,
|
|
3815
3822
|
Te,
|
|
3816
|
-
|
|
3817
|
-
]), Ue = q(() => X ? Cn(X.state) :
|
|
3823
|
+
U
|
|
3824
|
+
]), Ue = q(() => X ? Cn(X.state) : Za, [
|
|
3818
3825
|
X,
|
|
3819
3826
|
Te,
|
|
3820
|
-
|
|
3827
|
+
U,
|
|
3821
3828
|
xe
|
|
3822
|
-
]), We =
|
|
3829
|
+
]), We = U?.currentNode === "codeBlock", Ge = We && He.language === "mermaid", Ke = q(() => X ? Yt({
|
|
3823
3830
|
active: Ge,
|
|
3824
3831
|
mode: _e,
|
|
3825
3832
|
source: He.text
|
|
3826
|
-
}) :
|
|
3833
|
+
}) : $a, [
|
|
3827
3834
|
He.text,
|
|
3828
3835
|
X,
|
|
3829
3836
|
Ge,
|
|
@@ -3832,28 +3839,28 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3832
3839
|
X,
|
|
3833
3840
|
C,
|
|
3834
3841
|
Te
|
|
3835
|
-
]), Je = q(() => X ?
|
|
3842
|
+
]), Je = q(() => X ? vi(X.state) : gi.items, [X, Te]), Ye = q(() => yi(Je, Ce), [Ce, Je]), Xe = q(() => hi(Je, Ye), [Ye, Je]), Ze = G(() => {
|
|
3836
3843
|
if (!X || !Je.length) {
|
|
3837
3844
|
we(null);
|
|
3838
3845
|
return;
|
|
3839
3846
|
}
|
|
3840
|
-
let e =
|
|
3847
|
+
let e = _i(X, Je);
|
|
3841
3848
|
we((t) => t === e ? t : e);
|
|
3842
3849
|
}, [X, Je]);
|
|
3843
3850
|
K(() => {
|
|
3844
3851
|
we((e) => {
|
|
3845
|
-
let t =
|
|
3852
|
+
let t = yi(Je, e);
|
|
3846
3853
|
return e === t ? e : t;
|
|
3847
3854
|
});
|
|
3848
3855
|
}, [Je]), K(() => {
|
|
3849
3856
|
if (!X || !Je.length || typeof window > "u") return;
|
|
3850
3857
|
let e = null, t = () => {
|
|
3851
|
-
e !== null &&
|
|
3858
|
+
e !== null && ro(e), e = no(() => {
|
|
3852
3859
|
e = null, Ze();
|
|
3853
3860
|
});
|
|
3854
|
-
}, n =
|
|
3861
|
+
}, n = to(X.view.dom);
|
|
3855
3862
|
return window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), () => {
|
|
3856
|
-
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t), e !== null &&
|
|
3863
|
+
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t), e !== null && ro(e);
|
|
3857
3864
|
};
|
|
3858
3865
|
}, [
|
|
3859
3866
|
X,
|
|
@@ -3863,10 +3870,10 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3863
3870
|
let Qe = q(() => Tt({
|
|
3864
3871
|
revision: Te,
|
|
3865
3872
|
mode: j,
|
|
3866
|
-
editable:
|
|
3873
|
+
editable: P,
|
|
3867
3874
|
toc: Xe,
|
|
3868
|
-
selection:
|
|
3869
|
-
slash:
|
|
3875
|
+
selection: U,
|
|
3876
|
+
slash: fe,
|
|
3870
3877
|
table: Ue,
|
|
3871
3878
|
tableInteraction: xe,
|
|
3872
3879
|
codeBlock: He,
|
|
@@ -3875,11 +3882,11 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3875
3882
|
}), [
|
|
3876
3883
|
He,
|
|
3877
3884
|
j,
|
|
3878
|
-
|
|
3885
|
+
P,
|
|
3879
3886
|
Ke,
|
|
3880
3887
|
Te,
|
|
3881
|
-
H,
|
|
3882
3888
|
U,
|
|
3889
|
+
fe,
|
|
3883
3890
|
qe,
|
|
3884
3891
|
Ue,
|
|
3885
3892
|
xe,
|
|
@@ -3888,21 +3895,21 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3888
3895
|
K(() => {
|
|
3889
3896
|
C?.(Qe);
|
|
3890
3897
|
}, [C, Qe]), K(() => {
|
|
3891
|
-
|
|
3892
|
-
}, [
|
|
3898
|
+
ee?.(Xe);
|
|
3899
|
+
}, [ee, Xe]);
|
|
3893
3900
|
let $e = G((e, t) => {
|
|
3894
|
-
if (!(!X || !
|
|
3901
|
+
if (!(!X || !P) && un(e)) {
|
|
3895
3902
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3896
3903
|
ge(e);
|
|
3897
3904
|
return;
|
|
3898
3905
|
}
|
|
3899
|
-
mn(X,
|
|
3906
|
+
mn(X, fe, e, t), W((e) => bn(e, { type: "execute" })), Fe();
|
|
3900
3907
|
}
|
|
3901
3908
|
}, [
|
|
3902
3909
|
Fe,
|
|
3903
|
-
|
|
3910
|
+
P,
|
|
3904
3911
|
X,
|
|
3905
|
-
|
|
3912
|
+
fe
|
|
3906
3913
|
]), et = G((e) => {
|
|
3907
3914
|
W((t) => bn(t, {
|
|
3908
3915
|
type: "set-active",
|
|
@@ -3910,8 +3917,8 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3910
3917
|
optionCount: Me.length
|
|
3911
3918
|
}));
|
|
3912
3919
|
}, [Me.length]), tt = G((e) => {
|
|
3913
|
-
if (!X || he || !
|
|
3914
|
-
let t = dn(
|
|
3920
|
+
if (!X || he || !P) return;
|
|
3921
|
+
let t = dn(fe, Me, e.key, { isComposing: e.nativeEvent.isComposing || _t(X.state) });
|
|
3915
3922
|
if (t.type !== "ignore") {
|
|
3916
3923
|
if (t.type === "close") {
|
|
3917
3924
|
e.preventDefault(), W((e) => bn(e, { type: "escape" })), Fe();
|
|
@@ -3929,12 +3936,12 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3929
3936
|
}
|
|
3930
3937
|
}, [
|
|
3931
3938
|
Fe,
|
|
3932
|
-
|
|
3939
|
+
P,
|
|
3933
3940
|
X,
|
|
3934
3941
|
Me,
|
|
3935
3942
|
$e,
|
|
3936
3943
|
he,
|
|
3937
|
-
|
|
3944
|
+
fe
|
|
3938
3945
|
]), nt = q(() => ({
|
|
3939
3946
|
closeSlashMenu: Fe,
|
|
3940
3947
|
focusFirstTableBodyCell: () => X ? Sn(X) : !1,
|
|
@@ -3944,11 +3951,11 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3944
3951
|
return X.commands.setContent(e, {
|
|
3945
3952
|
contentType: bt(n),
|
|
3946
3953
|
emitUpdate: t.emitUpdate ?? !1
|
|
3947
|
-
}), t.focusFirstTableBodyCell && Sn(X), Re(X),
|
|
3954
|
+
}), t.focusFirstTableBodyCell && Sn(X), Re(X), P && Le(X), ze(X), Ne(), !0;
|
|
3948
3955
|
}
|
|
3949
3956
|
}), [
|
|
3950
3957
|
Fe,
|
|
3951
|
-
|
|
3958
|
+
P,
|
|
3952
3959
|
X,
|
|
3953
3960
|
Ne,
|
|
3954
3961
|
Re,
|
|
@@ -3959,15 +3966,15 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3959
3966
|
editor: X,
|
|
3960
3967
|
frameProps: q(() => ({
|
|
3961
3968
|
className: "markweave-editor-frame",
|
|
3962
|
-
"aria-label": i ??
|
|
3969
|
+
"aria-label": i ?? V.common.editorAriaLabel,
|
|
3963
3970
|
"data-testid": "markweave-editor-frame",
|
|
3964
3971
|
"data-markweave-mode": j,
|
|
3965
|
-
"aria-busy":
|
|
3966
|
-
"data-markweave-large-document-loading":
|
|
3967
|
-
"data-markweave-theme":
|
|
3968
|
-
style:
|
|
3972
|
+
"aria-busy": ae,
|
|
3973
|
+
"data-markweave-large-document-loading": ae ? "true" : "false",
|
|
3974
|
+
"data-markweave-theme": M,
|
|
3975
|
+
style: te ? { "--markweave-canvas": te } : void 0,
|
|
3969
3976
|
"data-markweave-inner-toc": p ? "true" : "false",
|
|
3970
|
-
"data-markweave-inner-toc-placement":
|
|
3977
|
+
"data-markweave-inner-toc-placement": N,
|
|
3971
3978
|
"data-mermaid-mode": Ke.mode,
|
|
3972
3979
|
"data-table-focus-mode": Ue.mode,
|
|
3973
3980
|
onKeyDownCapture: tt
|
|
@@ -3976,78 +3983,78 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
3976
3983
|
j,
|
|
3977
3984
|
tt,
|
|
3978
3985
|
p,
|
|
3979
|
-
|
|
3986
|
+
ae,
|
|
3980
3987
|
Ke.mode,
|
|
3981
|
-
|
|
3982
|
-
M,
|
|
3983
|
-
ne,
|
|
3988
|
+
V.common.editorAriaLabel,
|
|
3984
3989
|
te,
|
|
3990
|
+
N,
|
|
3991
|
+
M,
|
|
3985
3992
|
Ue.mode
|
|
3986
3993
|
]),
|
|
3987
3994
|
overlayProps: q(() => ({
|
|
3988
|
-
floatingToolbar: X &&
|
|
3995
|
+
floatingToolbar: X && P ? {
|
|
3989
3996
|
editor: X,
|
|
3990
|
-
lang:
|
|
3991
|
-
messages:
|
|
3992
|
-
selectionSnapshot:
|
|
3997
|
+
lang: B,
|
|
3998
|
+
messages: V,
|
|
3999
|
+
selectionSnapshot: U,
|
|
3993
4000
|
askAi: e,
|
|
3994
4001
|
onRewriteSelection: x,
|
|
3995
4002
|
onExtractToNote: b
|
|
3996
4003
|
} : null,
|
|
3997
|
-
slashCommandMenu: X &&
|
|
4004
|
+
slashCommandMenu: X && P ? {
|
|
3998
4005
|
commands: Me,
|
|
3999
|
-
state:
|
|
4006
|
+
state: fe,
|
|
4000
4007
|
position: pe,
|
|
4001
4008
|
inputCommand: he,
|
|
4002
|
-
messages:
|
|
4009
|
+
messages: V,
|
|
4003
4010
|
onActiveIndexChange: et,
|
|
4004
4011
|
onInputCommandChange: ge,
|
|
4005
4012
|
onSelect: $e,
|
|
4006
4013
|
onUpload: T
|
|
4007
4014
|
} : null,
|
|
4008
|
-
tableControls: X &&
|
|
4015
|
+
tableControls: X && P ? {
|
|
4009
4016
|
editor: X,
|
|
4010
4017
|
active: Ue.active,
|
|
4011
4018
|
interactionState: xe,
|
|
4012
|
-
messages:
|
|
4019
|
+
messages: V,
|
|
4013
4020
|
onCopyPayload: D,
|
|
4014
4021
|
onCommandResult: E,
|
|
4015
4022
|
onEditWithAi: y,
|
|
4016
4023
|
askAi: e
|
|
4017
4024
|
} : null,
|
|
4018
|
-
tableSelectionOverlay: X &&
|
|
4025
|
+
tableSelectionOverlay: X && P ? {
|
|
4019
4026
|
editor: X,
|
|
4020
4027
|
focusState: Ue
|
|
4021
4028
|
} : null,
|
|
4022
4029
|
codeBlockControls: X ? {
|
|
4023
4030
|
editor: X,
|
|
4024
|
-
active:
|
|
4031
|
+
active: P && We,
|
|
4025
4032
|
mermaidMode: _e,
|
|
4026
4033
|
onMermaidModeChange: ve,
|
|
4027
|
-
readOnly: !
|
|
4034
|
+
readOnly: !P
|
|
4028
4035
|
} : null,
|
|
4029
4036
|
innerToc: X && p && Xe.items.length ? {
|
|
4030
4037
|
editor: X,
|
|
4031
|
-
editable:
|
|
4032
|
-
messages:
|
|
4033
|
-
placement:
|
|
4038
|
+
editable: P,
|
|
4039
|
+
messages: V,
|
|
4040
|
+
placement: N,
|
|
4034
4041
|
state: Xe
|
|
4035
4042
|
} : null,
|
|
4036
|
-
mathEditorPopover: X &&
|
|
4043
|
+
mathEditorPopover: X && P && ye ? {
|
|
4037
4044
|
editor: X,
|
|
4038
|
-
messages:
|
|
4045
|
+
messages: V,
|
|
4039
4046
|
target: ye,
|
|
4040
4047
|
onClose: () => be(null)
|
|
4041
4048
|
} : null
|
|
4042
4049
|
}), [
|
|
4043
|
-
|
|
4050
|
+
P,
|
|
4044
4051
|
e,
|
|
4045
4052
|
X,
|
|
4046
4053
|
Me,
|
|
4047
4054
|
p,
|
|
4048
4055
|
We,
|
|
4049
4056
|
_e,
|
|
4050
|
-
|
|
4057
|
+
V,
|
|
4051
4058
|
ye,
|
|
4052
4059
|
y,
|
|
4053
4060
|
b,
|
|
@@ -4056,11 +4063,11 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
4056
4063
|
E,
|
|
4057
4064
|
D,
|
|
4058
4065
|
$e,
|
|
4059
|
-
|
|
4066
|
+
U,
|
|
4060
4067
|
et,
|
|
4061
4068
|
he,
|
|
4062
4069
|
pe,
|
|
4063
|
-
|
|
4070
|
+
fe,
|
|
4064
4071
|
Ue,
|
|
4065
4072
|
xe,
|
|
4066
4073
|
Xe
|
|
@@ -4069,24 +4076,24 @@ function ro({ askAi: e, ariaLabel: i, autoFocusFirstTableBodyCell: a = !1, autof
|
|
|
4069
4076
|
actions: nt
|
|
4070
4077
|
};
|
|
4071
4078
|
}
|
|
4072
|
-
function
|
|
4073
|
-
let n =
|
|
4079
|
+
function ao({ className: e, ...t }) {
|
|
4080
|
+
let n = io(t);
|
|
4074
4081
|
if (!n.editor) return null;
|
|
4075
4082
|
let r = [n.frameProps.className, e].filter(Boolean).join(" ");
|
|
4076
4083
|
return /* @__PURE__ */ Q("section", {
|
|
4077
4084
|
...n.frameProps,
|
|
4078
4085
|
className: r,
|
|
4079
4086
|
children: [
|
|
4080
|
-
n.overlayProps.floatingToolbar ? /* @__PURE__ */ Z(
|
|
4081
|
-
n.overlayProps.slashCommandMenu ? /* @__PURE__ */ Z(
|
|
4082
|
-
n.overlayProps.tableControls ? /* @__PURE__ */ Z(
|
|
4083
|
-
n.overlayProps.tableSelectionOverlay ? /* @__PURE__ */ Z(
|
|
4084
|
-
n.overlayProps.codeBlockControls ? /* @__PURE__ */ Z(
|
|
4085
|
-
n.overlayProps.innerToc ? /* @__PURE__ */ Z(
|
|
4086
|
-
n.overlayProps.mathEditorPopover ? /* @__PURE__ */ Z(
|
|
4087
|
+
n.overlayProps.floatingToolbar ? /* @__PURE__ */ Z(xa, { ...n.overlayProps.floatingToolbar }) : null,
|
|
4088
|
+
n.overlayProps.slashCommandMenu ? /* @__PURE__ */ Z(Ua, { ...n.overlayProps.slashCommandMenu }) : null,
|
|
4089
|
+
n.overlayProps.tableControls ? /* @__PURE__ */ Z(qa, { ...n.overlayProps.tableControls }) : null,
|
|
4090
|
+
n.overlayProps.tableSelectionOverlay ? /* @__PURE__ */ Z(Ja, { ...n.overlayProps.tableSelectionOverlay }) : null,
|
|
4091
|
+
n.overlayProps.codeBlockControls ? /* @__PURE__ */ Z($i, { ...n.overlayProps.codeBlockControls }) : null,
|
|
4092
|
+
n.overlayProps.innerToc ? /* @__PURE__ */ Z(Xa, { ...n.overlayProps.innerToc }) : null,
|
|
4093
|
+
n.overlayProps.mathEditorPopover ? /* @__PURE__ */ Z(Pa, { ...n.overlayProps.mathEditorPopover }) : null,
|
|
4087
4094
|
/* @__PURE__ */ Z(i, { editor: n.editor })
|
|
4088
4095
|
]
|
|
4089
4096
|
});
|
|
4090
4097
|
}
|
|
4091
4098
|
//#endregion
|
|
4092
|
-
export {
|
|
4099
|
+
export { ao as MarkweaveEditor, gt as createMarkweaveAiEditController, Xi as createMarkweaveEditorExtensions, Xi as createMarkweaveReactEditorExtensions, io as useMarkweaveEditorController };
|