@markweave/vue2 0.4.3 → 0.4.4
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 +885 -884
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10,55 +10,55 @@ import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as
|
|
|
10
10
|
import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
|
|
11
11
|
import { createMarkweaveLightweightImageNodeViewRenderer as x } from "markweave/internal/plugins/media/lightweight-image-node-view";
|
|
12
12
|
import { resolveMarkweaveMediaSource as S } from "markweave/internal/plugins/media/media-source";
|
|
13
|
-
import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as j, markweaveVideoIframeAllow as
|
|
14
|
-
import { detectUploadSource as
|
|
15
|
-
import { createMarkweaveAiEditController as
|
|
13
|
+
import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as j, markweaveVideoIframeAllow as M, normalizeMarkweaveCoreImageAlign as ee, normalizeMarkweaveVideoEmbedUrl as N, numberAttribute as P, stringAttribute as F } from "markweave/internal/plugins/media/core-media-nodes";
|
|
14
|
+
import { detectUploadSource as I, getDirectUploadResult as L, resolveMarkweaveUploadResult as R } from "markweave/internal/plugins/slash-command/upload";
|
|
15
|
+
import { createMarkweaveAiEditController as te } from "markweave";
|
|
16
16
|
import { BubbleMenu as z } from "@tiptap/vue-2/menus";
|
|
17
17
|
import { isEditorComposing as B } from "markweave/internal/editor-core/composition-guard";
|
|
18
18
|
import { saveMarkweaveBrowserFile as V } from "markweave/internal/core/browser-file-save";
|
|
19
19
|
import { createMarkweaveFrameScheduler as H } from "markweave/internal/editor-core/frame-scheduler";
|
|
20
|
-
import { createMarkweaveEditorUpdatePayload as
|
|
21
|
-
import { getCurrentFloatingToolbarBlockType as
|
|
22
|
-
import { openMarkweaveReadonlyLinkFromEvent as
|
|
23
|
-
import { createMarkweaveEditorRuntimeSnapshot as
|
|
24
|
-
import { areEditorSelectionSnapshotsEquivalent as
|
|
25
|
-
import { normalizeMarkweaveCanvasColor as
|
|
26
|
-
import { createMarkweaveAiEditController as
|
|
27
|
-
import { MarkweaveAskAiError as
|
|
28
|
-
import { createMarkweaveTocState as
|
|
29
|
-
import { codeBlockCollapsePluginKey as
|
|
30
|
-
import { calculateCodeBlockLanguageMenuPosition as
|
|
31
|
-
import { normalizeMarkdownLinkHref as
|
|
32
|
-
import { applyMarkweaveMathLatex as
|
|
33
|
-
import { isMermaidInlinePreviewTransaction as
|
|
34
|
-
import { getMermaidPreviewState as
|
|
35
|
-
import { filterSlashCommands as
|
|
36
|
-
import { getSlashCommandKeyboardAction as
|
|
37
|
-
import { areSlashCommandMenuPositionsEquivalent as
|
|
38
|
-
import { initialSlashCommandState as
|
|
39
|
-
import { setMarkweaveTableMenuAxisTarget as
|
|
40
|
-
import { getFirstTableDebugSnapshot as
|
|
41
|
-
import { focusFirstTableBodyCell as
|
|
42
|
-
import { getTableFocusState as
|
|
43
|
-
import { getTableSelectionOverlayState as
|
|
44
|
-
import { applyTableAxisAlignment as
|
|
20
|
+
import { createMarkweaveEditorUpdatePayload as U, getMarkweaveContentType as ne, isEditorContentCurrent as re, isMarkweaveControlledContentEchoCurrent as ie, normalizeMarkweaveContentFormat as W } from "markweave/internal/editor-core/editor-content";
|
|
21
|
+
import { getCurrentFloatingToolbarBlockType as ae, getFloatingToolbarHighlightColorOptions as oe, getFloatingToolbarMoreActions as se, getFloatingToolbarTextColorOptions as ce, getFloatingToolbarTurnIntoOptions as le, runFloatingToolbarMoreAction as ue, setFloatingToolbarTurnInto as de } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
22
|
+
import { openMarkweaveReadonlyLinkFromEvent as fe } from "markweave/internal/editor-core/readonly-link";
|
|
23
|
+
import { createMarkweaveEditorRuntimeSnapshot as pe } from "markweave/internal/editor-core/runtime-snapshot";
|
|
24
|
+
import { areEditorSelectionSnapshotsEquivalent as me, calculateFloatingToolbarPopoverPlacement as he, createSelectionSnapshot as ge, markweaveRuntimeProjectionDelayMs as _e, shouldShowFloatingToolbarForAiState as ve } from "markweave/internal/editor-core/selection-state";
|
|
25
|
+
import { normalizeMarkweaveCanvasColor as ye, normalizeMarkweaveTheme as be } from "markweave/internal/core/theme";
|
|
26
|
+
import { createMarkweaveAiEditController as xe } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
|
|
27
|
+
import { MarkweaveAskAiError as Se, acceptMarkweaveAskAiResult as Ce, calculateMarkweaveAskAiPanelPosition as we, canStartMarkweaveAskAiTableTarget as Te, clearMarkweaveAskAiPreview as Ee, clearMarkweaveAskAiTarget as De, createMarkweaveAskAiRequest as Oe, getMappedMarkweaveAskAiSelection as ke, getMarkweaveAskAiSurfaceRect as Ae, getMarkweaveAskAiTarget as je, getMarkweaveAskAiTargetRect as Me, hasMarkweaveAskAiPreview as Ne, isMarkweaveAskAiSelectionEligible as Pe, restoreMarkweaveAskAiTargetSelection as Fe, runMarkweaveAskAiHandler as Ie, setMarkweaveAskAiPreview as Le, startMarkweaveAskAiTableTarget as Re, startMarkweaveAskAiTarget as ze } from "markweave/internal/plugins/ask-ai/ask-ai-session";
|
|
28
|
+
import { createMarkweaveTocState as Be, emptyMarkweaveTocState as Ve, getActiveMarkweaveTocId as He, getMarkweaveInnerTocRailHeight as Ue, getMarkweaveTocItemsFromState as We, getValidMarkweaveTocActiveId as Ge, normalizeMarkweaveInnerTocPlacement as Ke, observeMarkweaveInnerTocContainerPosition as qe, scrollToMarkweaveTocItem as Je } from "markweave/internal/core/toc-state";
|
|
29
|
+
import { codeBlockCollapsePluginKey as Ye, copyActiveCodeBlock as Xe, getActiveCodeBlockState as Ze, getCodeBlockCopyFeedbackSnapshot as Qe, markweaveCodeBlockBehavior as $e, setCodeBlockCollapsedAtPosition as et, setCodeBlockLanguageAtPosition as tt, setCodeBlockMermaidPreviewModeAtPosition as nt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
30
|
+
import { calculateCodeBlockLanguageMenuPosition as rt, clampFullscreenScale as it, codeBlockCopyFeedbackTimeoutMs as at, copyCodeBlockText as ot, createCodeBlockLanguageMenuDomId as st, createCodeBlockOverlayPosition as ct, createMermaidFullscreenViewerState as lt, createMermaidTabPosition as ut, focusCodeBlockTarget as dt, formatCodeBlockLanguageLabel as ft, formatFullscreenZoom as pt, getActiveCodeBlockElement as mt, getAnchoredRect as ht, getCodeBlockLanguageItems as gt, getCodeBlockLanguageOptionDomId as _t, getCodeBlockPositionFromEventTarget as vt, getCodeBlockStateAtPosition as yt, getFrameElement as bt, getInitialCodeBlockLanguageItemIndex as xt, getMermaidCodeBlockTargets as St, getMermaidSvgMarkup as Ct, isCodeBlockTargetCollapsed as wt, mergeStableMermaidTabPositions as Tt, mermaidFullscreenZoomStep as Et, moveCodeBlockLanguageItemIndex as Dt, moveMermaidFullscreenViewer as Ot, scrollCodeBlockLanguageItemIntoView as kt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
31
|
+
import { normalizeMarkdownLinkHref as At } from "markweave/internal/plugins/markdown/markdown-input";
|
|
32
|
+
import { applyMarkweaveMathLatex as jt, calculateMarkweaveMathPopoverPosition as Mt, getMarkweaveMathAnchorRect as Nt, getMarkweaveMathBlockIndex as Pt, getMarkweaveMathRenderedHtml as Ft, getMarkweaveMathTargetAtPos as It, getMarkweaveMathTargetFromDomEvent as Lt, getMarkweaveMathTargetFromSelection as Rt, renderMarkweaveMathPreview as zt, setMarkweaveMathEditingDomState as Bt, setMarkweaveMathEditingDomStateInView as Vt, setMarkweaveMathSelectionInView as Ht } from "markweave/internal/plugins/math/math-ui-model";
|
|
33
|
+
import { isMermaidInlinePreviewTransaction as Ut, setMarkweaveMermaidTheme as Wt, setMermaidInlinePreviewEditorMode as Gt, setReadonlyMermaidPreviewMode as Kt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
34
|
+
import { getMermaidPreviewState as qt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
35
|
+
import { filterSlashCommands as Jt, isExecutableSlashCommand as Yt } from "markweave/internal/plugins/slash-command/command-spec";
|
|
36
|
+
import { getSlashCommandKeyboardAction as Xt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
37
|
+
import { areSlashCommandMenuPositionsEquivalent as Zt, executeSlashCommand as Qt, getNextSlashCommandState as $t, getSlashCommandAnchoredMenuPosition as en, getSlashCommandContext as tn, isSlashCommandAnchorVisible as nn } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
38
|
+
import { initialSlashCommandState as rn, reduceSlashCommandState as an } from "markweave/internal/plugins/slash-command/slash-state";
|
|
39
|
+
import { setMarkweaveTableMenuAxisTarget as on } from "markweave/internal/plugins/table/table-clipboard";
|
|
40
|
+
import { getFirstTableDebugSnapshot as sn } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
41
|
+
import { focusFirstTableBodyCell as cn } from "markweave/internal/plugins/table/table-focus-position";
|
|
42
|
+
import { getTableFocusState as ln } from "markweave/internal/plugins/table/table-focus-state";
|
|
43
|
+
import { getTableSelectionOverlayState as un, initialTableInteractionState as dn, tableInteractionPluginKey as fn } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
44
|
+
import { applyTableAxisAlignment as pn, applyTableAxisBackgroundColor as mn, applyTableAxisTextColor as hn, calculateAnchoredTableMenuPosition as gn, calculateAnchoredTableSubmenuPosition as _n, calculateTableAxisHandleLayout as vn, calculateTableExtendButtonLayout as yn, canRunTableCommand as bn, executeTableMenuCommand as xn, formatTableCopyFeedback as Sn, getActiveTableElement as Cn, getAvailableCellMenuCommandSpecs as wn, getTableAxisDropIndexAtPoint as Tn, getTableAxisFormattingState as En, getTableAxisTargetRect as Dn, getTableControlAxisSelectionModel as On, getTableMenuBoundaryRect as kn, getTableMenuItemGroup as An, getTableMenuItemLabel as jn, getTableMenuItems as Mn, getTableSelectionTargetRect as Nn, measureTableSelectionOverlay as Pn, moveTargetedTableAxis as Fn, selectTableAxisFromCell as In, tableColorOptions as Ln, tableCopyFeedbackTimeoutMs as Rn, tableHorizontalAlignmentOptions as zn, tableMenuLabel as Bn, tableVerticalAlignmentOptions as Vn, targetTableAxisFromCell as Hn } from "markweave/internal/plugins/table/table-ui-model";
|
|
45
45
|
//#region src/vue2-compat.ts
|
|
46
|
-
var
|
|
47
|
-
function
|
|
46
|
+
var Un = l.default ?? l, Wn = null, Gn = null, Kn = null;
|
|
47
|
+
function qn(e) {
|
|
48
48
|
return !!(e && typeof e == "object" && "value" in e);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Jn(e) {
|
|
51
51
|
let t = e.slice(2);
|
|
52
52
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Yn(e) {
|
|
55
55
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
56
56
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
57
57
|
if (o === "class" || o === "style" || o === "key") {
|
|
58
58
|
t[o] = s;
|
|
59
59
|
continue;
|
|
60
60
|
}
|
|
61
|
-
if (o === "ref" &&
|
|
61
|
+
if (o === "ref" && qn(s)) {
|
|
62
62
|
a.insert = (e) => {
|
|
63
63
|
s.value = e.elm;
|
|
64
64
|
}, a.destroy = () => {
|
|
@@ -67,7 +67,7 @@ function Xn(e) {
|
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
69
|
if (/^on[A-Z]/.test(o)) {
|
|
70
|
-
i[
|
|
70
|
+
i[Jn(o)] = s;
|
|
71
71
|
continue;
|
|
72
72
|
}
|
|
73
73
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -78,14 +78,14 @@ function Xn(e) {
|
|
|
78
78
|
}
|
|
79
79
|
return Object.keys(n).length && (t.attrs = n), Object.keys(r).length && (t.domProps = r), Object.keys(i).length && (t.on = i), Object.keys(a).length && (t.hook = a), t;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Xn(e) {
|
|
82
82
|
let t = {}, n = {}, r = {}, i = {};
|
|
83
83
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
84
84
|
if (a === "class" || a === "style" || a === "key") {
|
|
85
85
|
t[a] = o;
|
|
86
86
|
continue;
|
|
87
87
|
}
|
|
88
|
-
if (a === "ref" &&
|
|
88
|
+
if (a === "ref" && qn(o)) {
|
|
89
89
|
i.insert = (e) => {
|
|
90
90
|
o.value = e.componentInstance ?? e.elm;
|
|
91
91
|
}, i.destroy = () => {
|
|
@@ -101,47 +101,47 @@ function Zn(e) {
|
|
|
101
101
|
}
|
|
102
102
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function Zn(e) {
|
|
105
105
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function Qn(e) {
|
|
108
108
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function $n(e) {
|
|
111
111
|
return e == null || Array.isArray(e) ? e : [e];
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
return typeof e == "function" ?
|
|
115
|
-
}
|
|
116
|
-
function U(e, t, n) {
|
|
117
|
-
if (!qn) throw Error("Vue 2 render context is not available.");
|
|
118
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Xn(r) : Zn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : tr(n);
|
|
119
|
-
return qn(e, i, a);
|
|
113
|
+
function er(e) {
|
|
114
|
+
return typeof e == "function" ? $n(e()) : Zn(e) ? $n(e.default()) : Qn(e) ? [e] : e;
|
|
120
115
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
116
|
+
function G(e, t, n) {
|
|
117
|
+
if (!Kn) throw Error("Vue 2 render context is not available.");
|
|
118
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Yn(r) : Xn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : er(n);
|
|
119
|
+
return Kn(e, i, a);
|
|
123
120
|
}
|
|
124
|
-
var G = W;
|
|
125
121
|
function K(e) {
|
|
122
|
+
return Un.observable({ value: e });
|
|
123
|
+
}
|
|
124
|
+
var tr = K;
|
|
125
|
+
function q(e) {
|
|
126
126
|
return { get value() {
|
|
127
127
|
return e();
|
|
128
128
|
} };
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function J(e, t, n) {
|
|
131
131
|
let r = typeof e == "function" ? e : () => e.value;
|
|
132
|
-
return
|
|
132
|
+
return Wn?.$watch ? Wn.$watch(r, t, n) : () => void 0;
|
|
133
133
|
}
|
|
134
134
|
function nr(e) {
|
|
135
|
-
|
|
135
|
+
Gn?.mounted.push(e);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
|
|
137
|
+
function rr(e) {
|
|
138
|
+
Gn?.beforeUnmount.push(e);
|
|
139
139
|
}
|
|
140
140
|
function Y(e) {
|
|
141
|
-
return
|
|
141
|
+
return Un.nextTick(e);
|
|
142
142
|
}
|
|
143
143
|
function X(e) {
|
|
144
|
-
return
|
|
144
|
+
return Un.extend({
|
|
145
145
|
name: e.name,
|
|
146
146
|
props: e.props,
|
|
147
147
|
created() {
|
|
@@ -149,12 +149,12 @@ function X(e) {
|
|
|
149
149
|
mounted: [],
|
|
150
150
|
beforeUnmount: []
|
|
151
151
|
};
|
|
152
|
-
|
|
152
|
+
Wn = this, Gn = t;
|
|
153
153
|
try {
|
|
154
154
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
155
155
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
156
156
|
} finally {
|
|
157
|
-
|
|
157
|
+
Wn = null, Gn = null;
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
160
|
mounted() {
|
|
@@ -164,19 +164,19 @@ function X(e) {
|
|
|
164
164
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
165
165
|
},
|
|
166
166
|
render(t) {
|
|
167
|
-
|
|
167
|
+
Kn = t;
|
|
168
168
|
try {
|
|
169
169
|
let n = this.__markweaveVue2Render;
|
|
170
170
|
return n ? n() : e.render?.(t) ?? null;
|
|
171
171
|
} finally {
|
|
172
|
-
|
|
172
|
+
Kn = null;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
//#endregion
|
|
178
178
|
//#region src/vue2-icons.ts
|
|
179
|
-
var
|
|
179
|
+
var ir = {
|
|
180
180
|
AlignVerticalJustifyCenter: {
|
|
181
181
|
iconName: "align-vertical-justify-center",
|
|
182
182
|
node: [
|
|
@@ -1498,8 +1498,8 @@ var rr = {
|
|
|
1498
1498
|
}]]
|
|
1499
1499
|
}
|
|
1500
1500
|
};
|
|
1501
|
-
function
|
|
1502
|
-
return e.map(([e, t]) =>
|
|
1501
|
+
function ar(e) {
|
|
1502
|
+
return e.map(([e, t]) => G(e, t));
|
|
1503
1503
|
}
|
|
1504
1504
|
function Z(e) {
|
|
1505
1505
|
return X({
|
|
@@ -1519,8 +1519,8 @@ function Z(e) {
|
|
|
1519
1519
|
}
|
|
1520
1520
|
},
|
|
1521
1521
|
setup(t) {
|
|
1522
|
-
let n =
|
|
1523
|
-
return () =>
|
|
1522
|
+
let n = ir[e];
|
|
1523
|
+
return () => G("svg", {
|
|
1524
1524
|
class: `lucide lucide-${n.iconName}`,
|
|
1525
1525
|
viewBox: "0 0 24 24",
|
|
1526
1526
|
width: t.size,
|
|
@@ -1532,12 +1532,12 @@ function Z(e) {
|
|
|
1532
1532
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1533
1533
|
"aria-hidden": "true",
|
|
1534
1534
|
focusable: "false"
|
|
1535
|
-
},
|
|
1535
|
+
}, ar(n.node));
|
|
1536
1536
|
}
|
|
1537
1537
|
});
|
|
1538
1538
|
}
|
|
1539
|
-
var
|
|
1540
|
-
function
|
|
1539
|
+
var or = Z("AlignCenter"), sr = Z("AlignJustify"), cr = Z("AlignLeft"), lr = Z("AlignRight"), ur = Z("AlignVerticalJustifyCenter"), dr = Z("AlignVerticalJustifyEnd"), fr = Z("AlignVerticalJustifyStart"), pr = Z("AlertTriangle"), mr = Z("ArrowDown"), hr = Z("ArrowDownAZ"), gr = Z("ArrowLeft"), _r = Z("ArrowRight"), vr = Z("ArrowUp"), yr = Z("ArrowUpZA"), br = Z("BetweenHorizontalEnd"), xr = Z("BetweenHorizontalStart"), Sr = Z("BetweenVerticalEnd"), Cr = Z("BetweenVerticalStart"), wr = Z("Bold"), Tr = Z("Braces"), Er = Z("Captions"), Dr = Z("Check"), Or = Z("CheckCircle2"), kr = Z("ChevronDown"), Ar = Z("ChevronRight"), jr = Z("ChevronUp"), Mr = Z("CircleX"), Nr = Z("Code2"), Pr = Z("CornerDownLeft"), Fr = Z("Copy"), Ir = Z("Download"), Lr = Z("Eye"), Rr = Z("ExternalLink"), zr = Z("Heading1"), Br = Z("Heading2"), Vr = Z("Heading3"), Hr = Z("Image"), Ur = Z("ImageUp"), Wr = Z("IndentDecrease"), Gr = Z("IndentIncrease"), Kr = Z("Info"), qr = Z("Italic"), Jr = Z("Lightbulb"), Yr = Z("Link2"), Xr = Z("List"), Zr = Z("ListChecks"), Qr = Z("ListOrdered"), $r = Z("Minus"), ei = Z("MoreVertical"), ti = Z("PaintBucket"), ni = Z("Paperclip"), ri = Z("PencilLine"), ii = Z("Plus"), ai = Z("Quote"), oi = Z("Replace"), si = Z("RotateCcw"), ci = Z("Sigma"), li = Z("SmilePlus"), ui = Z("Sparkles"), di = Z("Square"), fi = Z("SquareX"), pi = Z("Strikethrough"), mi = Z("Subscript"), hi = Z("Superscript"), gi = Z("Table2"), _i = Z("TableCellsMerge"), vi = Z("TableCellsSplit"), yi = Z("Text"), bi = Z("Trash2"), xi = Z("Type"), Si = Z("Underline"), Ci = Z("Upload"), wi = Z("Video"), Ti = Z("X"), Ei = ee;
|
|
1540
|
+
function Di(e) {
|
|
1541
1541
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1542
1542
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1543
1543
|
return n === "view" ? {
|
|
@@ -1547,7 +1547,7 @@ function Ei(e) {
|
|
|
1547
1547
|
mode: "live",
|
|
1548
1548
|
editable: e.isEditable
|
|
1549
1549
|
} : u(e);
|
|
1550
|
-
}, r =
|
|
1550
|
+
}, r = K(n()), i = m(e, () => {
|
|
1551
1551
|
r.value = n();
|
|
1552
1552
|
}), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
|
|
1553
1553
|
r.value = n();
|
|
@@ -1555,28 +1555,28 @@ function Ei(e) {
|
|
|
1555
1555
|
return a && t && a.observe(t, {
|
|
1556
1556
|
attributes: !0,
|
|
1557
1557
|
attributeFilter: ["data-markweave-mode"]
|
|
1558
|
-
}),
|
|
1558
|
+
}), rr(() => {
|
|
1559
1559
|
i(), a?.disconnect();
|
|
1560
1560
|
}), r;
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1562
|
+
function Oi(e) {
|
|
1563
1563
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1564
1564
|
}
|
|
1565
|
-
function
|
|
1565
|
+
function ki(e) {
|
|
1566
1566
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1567
1567
|
}
|
|
1568
|
-
function
|
|
1568
|
+
function Ai(e) {
|
|
1569
1569
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1572
|
-
return
|
|
1571
|
+
function ji(e, t) {
|
|
1572
|
+
return G(e, {
|
|
1573
1573
|
size: 18,
|
|
1574
1574
|
strokeWidth: 1.8,
|
|
1575
1575
|
"aria-hidden": "true"
|
|
1576
1576
|
}, { default: () => t });
|
|
1577
1577
|
}
|
|
1578
|
-
function
|
|
1579
|
-
return
|
|
1578
|
+
function Mi(e) {
|
|
1579
|
+
return G("button", {
|
|
1580
1580
|
type: "button",
|
|
1581
1581
|
"aria-label": e.label,
|
|
1582
1582
|
title: e.label,
|
|
@@ -1584,14 +1584,14 @@ function ji(e) {
|
|
|
1584
1584
|
"data-active": e.active ? "true" : "false",
|
|
1585
1585
|
onMousedown: (e) => e.preventDefault(),
|
|
1586
1586
|
onClick: e.onClick
|
|
1587
|
-
}, [
|
|
1587
|
+
}, [ji(e.icon, e.label), G("span", {
|
|
1588
1588
|
class: "markweave-image-tooltip",
|
|
1589
1589
|
role: "tooltip"
|
|
1590
1590
|
}, e.label)]);
|
|
1591
1591
|
}
|
|
1592
|
-
function
|
|
1593
|
-
let t =
|
|
1594
|
-
return
|
|
1592
|
+
function Ni(e) {
|
|
1593
|
+
let t = K(null), n = e.messages.image;
|
|
1594
|
+
return G("section", {
|
|
1595
1595
|
class: "markweave-image-upload-placeholder",
|
|
1596
1596
|
"data-testid": "markweave-image-upload-placeholder",
|
|
1597
1597
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1609,7 +1609,7 @@ function Mi(e) {
|
|
|
1609
1609
|
n && e.onFile(n);
|
|
1610
1610
|
}
|
|
1611
1611
|
}, [
|
|
1612
|
-
|
|
1612
|
+
G("input", {
|
|
1613
1613
|
ref: t,
|
|
1614
1614
|
"data-testid": "markweave-image-file-input",
|
|
1615
1615
|
type: "file",
|
|
@@ -1620,20 +1620,20 @@ function Mi(e) {
|
|
|
1620
1620
|
r && e.onFile(r), n.value = "";
|
|
1621
1621
|
}
|
|
1622
1622
|
}),
|
|
1623
|
-
|
|
1623
|
+
G("div", {
|
|
1624
1624
|
class: "markweave-image-upload-icon",
|
|
1625
1625
|
"aria-hidden": "true"
|
|
1626
|
-
}, [
|
|
1626
|
+
}, [G(Ur, {
|
|
1627
1627
|
size: 46,
|
|
1628
1628
|
strokeWidth: 1.6
|
|
1629
1629
|
})]),
|
|
1630
|
-
|
|
1630
|
+
G("div", { class: "markweave-image-upload-copy" }, [G("button", {
|
|
1631
1631
|
type: "button",
|
|
1632
1632
|
onClick: () => t.value?.click()
|
|
1633
|
-
}, n.clickToUpload),
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1633
|
+
}, n.clickToUpload), G("span", null, n.dragAndDrop)]),
|
|
1634
|
+
G("div", { class: "markweave-image-upload-note" }, n.uploadNote),
|
|
1635
|
+
G("div", { class: "markweave-image-upload-row" }, [
|
|
1636
|
+
G("input", {
|
|
1637
1637
|
"data-testid": "markweave-image-url-input",
|
|
1638
1638
|
value: e.inputValue,
|
|
1639
1639
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1643,30 +1643,30 @@ function Mi(e) {
|
|
|
1643
1643
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1644
1644
|
}
|
|
1645
1645
|
}),
|
|
1646
|
-
|
|
1646
|
+
G("button", {
|
|
1647
1647
|
type: "button",
|
|
1648
1648
|
"data-testid": "markweave-image-upload-submit",
|
|
1649
1649
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1650
1650
|
onClick: e.onSubmit
|
|
1651
|
-
}, [
|
|
1651
|
+
}, [G(Ur, {
|
|
1652
1652
|
size: 16,
|
|
1653
1653
|
strokeWidth: 1.8
|
|
1654
1654
|
}), e.messages.common.insert]),
|
|
1655
|
-
|
|
1655
|
+
G("button", {
|
|
1656
1656
|
type: "button",
|
|
1657
1657
|
"data-testid": "markweave-image-upload-cancel",
|
|
1658
1658
|
onClick: e.onCancel
|
|
1659
1659
|
}, e.messages.common.cancel)
|
|
1660
1660
|
]),
|
|
1661
|
-
e.error ?
|
|
1661
|
+
e.error ? G("div", {
|
|
1662
1662
|
class: "markweave-image-upload-error",
|
|
1663
1663
|
role: "alert"
|
|
1664
1664
|
}, e.error) : null
|
|
1665
1665
|
]);
|
|
1666
1666
|
}
|
|
1667
|
-
function
|
|
1668
|
-
let t =
|
|
1669
|
-
return
|
|
1667
|
+
function Pi(e) {
|
|
1668
|
+
let t = K(null), n = e.messages.video;
|
|
1669
|
+
return G("section", {
|
|
1670
1670
|
class: "markweave-video-upload-placeholder",
|
|
1671
1671
|
"data-testid": "markweave-video-upload-placeholder",
|
|
1672
1672
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1684,7 +1684,7 @@ function Ni(e) {
|
|
|
1684
1684
|
n && e.onFile(n);
|
|
1685
1685
|
}
|
|
1686
1686
|
}, [
|
|
1687
|
-
|
|
1687
|
+
G("input", {
|
|
1688
1688
|
ref: t,
|
|
1689
1689
|
"data-testid": "markweave-video-file-input",
|
|
1690
1690
|
type: "file",
|
|
@@ -1695,20 +1695,20 @@ function Ni(e) {
|
|
|
1695
1695
|
r && e.onFile(r), n.value = "";
|
|
1696
1696
|
}
|
|
1697
1697
|
}),
|
|
1698
|
-
|
|
1698
|
+
G("div", {
|
|
1699
1699
|
class: "markweave-video-upload-icon",
|
|
1700
1700
|
"aria-hidden": "true"
|
|
1701
|
-
}, [
|
|
1701
|
+
}, [G(wi, {
|
|
1702
1702
|
size: 46,
|
|
1703
1703
|
strokeWidth: 1.6
|
|
1704
1704
|
})]),
|
|
1705
|
-
|
|
1705
|
+
G("div", { class: "markweave-video-upload-copy" }, [G("button", {
|
|
1706
1706
|
type: "button",
|
|
1707
1707
|
onClick: () => t.value?.click()
|
|
1708
|
-
}, n.clickToUpload),
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1708
|
+
}, n.clickToUpload), G("span", null, n.dragAndDrop)]),
|
|
1709
|
+
G("div", { class: "markweave-video-upload-note" }, n.uploadNote),
|
|
1710
|
+
G("div", { class: "markweave-video-upload-row" }, [
|
|
1711
|
+
G("input", {
|
|
1712
1712
|
"data-testid": "markweave-video-url-input",
|
|
1713
1713
|
value: e.inputValue,
|
|
1714
1714
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1718,28 +1718,28 @@ function Ni(e) {
|
|
|
1718
1718
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1719
1719
|
}
|
|
1720
1720
|
}),
|
|
1721
|
-
|
|
1721
|
+
G("button", {
|
|
1722
1722
|
type: "button",
|
|
1723
1723
|
"data-testid": "markweave-video-upload-submit",
|
|
1724
1724
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1725
1725
|
onClick: e.onSubmit
|
|
1726
|
-
}, [
|
|
1726
|
+
}, [G(Ci, {
|
|
1727
1727
|
size: 16,
|
|
1728
1728
|
strokeWidth: 1.8
|
|
1729
1729
|
}), e.messages.common.insert]),
|
|
1730
|
-
|
|
1730
|
+
G("button", {
|
|
1731
1731
|
type: "button",
|
|
1732
1732
|
"data-testid": "markweave-video-upload-cancel",
|
|
1733
1733
|
onClick: e.onCancel
|
|
1734
1734
|
}, e.messages.common.cancel)
|
|
1735
1735
|
]),
|
|
1736
|
-
e.error ?
|
|
1736
|
+
e.error ? G("div", {
|
|
1737
1737
|
class: "markweave-video-upload-error",
|
|
1738
1738
|
role: "alert"
|
|
1739
1739
|
}, e.error) : null
|
|
1740
1740
|
]);
|
|
1741
1741
|
}
|
|
1742
|
-
var
|
|
1742
|
+
var Fi = X({
|
|
1743
1743
|
name: "MarkweaveVueImageNodeView",
|
|
1744
1744
|
props: {
|
|
1745
1745
|
editor: {
|
|
@@ -1772,8 +1772,8 @@ var Pi = X({
|
|
|
1772
1772
|
}
|
|
1773
1773
|
},
|
|
1774
1774
|
setup(e) {
|
|
1775
|
-
let t =
|
|
1776
|
-
|
|
1775
|
+
let t = K(null), r = K(!1), i = K(!1), a = K(!1), o = K(""), c = K(null), l = K(!1), u = q(() => e.node.attrs), f = K(!!F(u.value.caption)), p = K(F(u.value.caption) ?? ""), m = Di(e.editor), h = q(() => d(m.value)), g = q(() => e.extension.options?.messages ?? n("zh")), _ = q(() => g.value.image), v = q(() => F(u.value.src)), y = q(() => e.extension.options?.resolveMediaSource), x = K(null), C = null;
|
|
1776
|
+
J(v, (t) => {
|
|
1777
1777
|
if (C?.abort(), C = null, !t) {
|
|
1778
1778
|
x.value = null;
|
|
1779
1779
|
return;
|
|
@@ -1792,11 +1792,11 @@ var Pi = X({
|
|
|
1792
1792
|
}).then((e) => {
|
|
1793
1793
|
r.signal.aborted || (x.value = e);
|
|
1794
1794
|
});
|
|
1795
|
-
}, { immediate: !0 }),
|
|
1796
|
-
let w =
|
|
1795
|
+
}, { immediate: !0 }), rr(() => C?.abort());
|
|
1796
|
+
let w = q(() => x.value?.src ?? (y.value ? null : v.value)), E = q(() => Ei(u.value.align)), D = q(() => P(u.value.width)), A = q(() => F(u.value.caption)), M = q(() => h.value && (!v.value || i.value)), ee = () => {
|
|
1797
1797
|
w.value && b({
|
|
1798
1798
|
src: w.value,
|
|
1799
|
-
alt:
|
|
1799
|
+
alt: F(u.value.alt) ?? "",
|
|
1800
1800
|
messages: {
|
|
1801
1801
|
dialogAriaLabel: _.value.previewDialogAriaLabel,
|
|
1802
1802
|
zoomOut: _.value.previewZoomOut,
|
|
@@ -1806,25 +1806,25 @@ var Pi = X({
|
|
|
1806
1806
|
}
|
|
1807
1807
|
});
|
|
1808
1808
|
};
|
|
1809
|
-
|
|
1809
|
+
J(A, (e) => {
|
|
1810
1810
|
f.value || (p.value = e ?? "");
|
|
1811
1811
|
});
|
|
1812
|
-
let
|
|
1812
|
+
let N = () => {
|
|
1813
1813
|
if (!h.value) return;
|
|
1814
1814
|
let t = e.getPos();
|
|
1815
1815
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1816
|
-
},
|
|
1816
|
+
}, L = () => {
|
|
1817
1817
|
if (o.value = "", c.value = null, a.value = !1, v.value) {
|
|
1818
1818
|
i.value = !1;
|
|
1819
1819
|
return;
|
|
1820
1820
|
}
|
|
1821
1821
|
e.deleteNode();
|
|
1822
|
-
},
|
|
1822
|
+
}, te = async (t) => {
|
|
1823
1823
|
if (!h.value) return;
|
|
1824
1824
|
let n = e.extension.options;
|
|
1825
1825
|
l.value = !0, c.value = null;
|
|
1826
1826
|
try {
|
|
1827
|
-
let r = await
|
|
1827
|
+
let r = await R(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1828
1828
|
e.updateAttributes(T(u.value, r)), o.value = "", i.value = !1;
|
|
1829
1829
|
} catch (e) {
|
|
1830
1830
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
@@ -1836,9 +1836,9 @@ var Pi = X({
|
|
|
1836
1836
|
c.value = _.value.uploadRequiredError;
|
|
1837
1837
|
return;
|
|
1838
1838
|
}
|
|
1839
|
-
|
|
1839
|
+
te(I(o.value));
|
|
1840
1840
|
}, B = (e) => {
|
|
1841
|
-
|
|
1841
|
+
te({
|
|
1842
1842
|
type: "file",
|
|
1843
1843
|
file: e,
|
|
1844
1844
|
mimeType: e.type || "image/*"
|
|
@@ -1847,7 +1847,7 @@ var Pi = X({
|
|
|
1847
1847
|
f.value = !f.value, f.value && (p.value = A.value ?? "");
|
|
1848
1848
|
}, H = (n, r) => {
|
|
1849
1849
|
if (!h.value || !v.value) return;
|
|
1850
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1850
|
+
r.preventDefault(), r.stopPropagation(), N();
|
|
1851
1851
|
let i = t.value;
|
|
1852
1852
|
if (!i) return;
|
|
1853
1853
|
let a = r.clientX, o = i.getBoundingClientRect().width || D.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
|
|
@@ -1858,7 +1858,7 @@ var Pi = X({
|
|
|
1858
1858
|
};
|
|
1859
1859
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1860
1860
|
};
|
|
1861
|
-
return () =>
|
|
1861
|
+
return () => M.value ? G(s, {
|
|
1862
1862
|
as: "figure",
|
|
1863
1863
|
class: "markweave-image-node",
|
|
1864
1864
|
"data-testid": "markweave-image-node",
|
|
@@ -1866,7 +1866,7 @@ var Pi = X({
|
|
|
1866
1866
|
"data-selected": "false",
|
|
1867
1867
|
"data-hovered": "false",
|
|
1868
1868
|
"data-empty": "true"
|
|
1869
|
-
}, () =>
|
|
1869
|
+
}, () => Ni({
|
|
1870
1870
|
messages: g.value,
|
|
1871
1871
|
inputValue: o.value,
|
|
1872
1872
|
error: c.value,
|
|
@@ -1877,11 +1877,11 @@ var Pi = X({
|
|
|
1877
1877
|
},
|
|
1878
1878
|
onFile: B,
|
|
1879
1879
|
onSubmit: z,
|
|
1880
|
-
onCancel:
|
|
1880
|
+
onCancel: L,
|
|
1881
1881
|
onDragActive: (e) => {
|
|
1882
1882
|
a.value = e;
|
|
1883
1883
|
}
|
|
1884
|
-
})) :
|
|
1884
|
+
})) : G(s, {
|
|
1885
1885
|
as: "figure",
|
|
1886
1886
|
class: "markweave-image-node",
|
|
1887
1887
|
"data-testid": "markweave-image-node",
|
|
@@ -1896,81 +1896,81 @@ var Pi = X({
|
|
|
1896
1896
|
r.value = !1;
|
|
1897
1897
|
},
|
|
1898
1898
|
onMousedown: (e) => {
|
|
1899
|
-
h.value && !
|
|
1899
|
+
h.value && !Oi(e.target) && N();
|
|
1900
1900
|
}
|
|
1901
1901
|
}, () => [
|
|
1902
|
-
h.value ?
|
|
1902
|
+
h.value ? G("div", {
|
|
1903
1903
|
class: "markweave-image-toolbar",
|
|
1904
1904
|
"data-testid": "markweave-image-toolbar",
|
|
1905
1905
|
"data-markweave-image-ui": "true",
|
|
1906
1906
|
"aria-label": _.value.toolsAriaLabel
|
|
1907
1907
|
}, [
|
|
1908
|
-
|
|
1908
|
+
Mi({
|
|
1909
1909
|
testId: "markweave-image-align-left",
|
|
1910
1910
|
label: _.value.alignLeft,
|
|
1911
|
-
icon:
|
|
1911
|
+
icon: cr,
|
|
1912
1912
|
active: E.value === "left",
|
|
1913
1913
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1914
1914
|
}),
|
|
1915
|
-
|
|
1915
|
+
Mi({
|
|
1916
1916
|
testId: "markweave-image-align-center",
|
|
1917
1917
|
label: _.value.alignCenter,
|
|
1918
|
-
icon:
|
|
1918
|
+
icon: or,
|
|
1919
1919
|
active: E.value === "center",
|
|
1920
1920
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1921
1921
|
}),
|
|
1922
|
-
|
|
1922
|
+
Mi({
|
|
1923
1923
|
testId: "markweave-image-align-right",
|
|
1924
1924
|
label: _.value.alignRight,
|
|
1925
|
-
icon:
|
|
1925
|
+
icon: lr,
|
|
1926
1926
|
active: E.value === "right",
|
|
1927
1927
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1928
1928
|
}),
|
|
1929
|
-
|
|
1929
|
+
G("span", {
|
|
1930
1930
|
class: "markweave-image-toolbar-divider",
|
|
1931
1931
|
"aria-hidden": "true"
|
|
1932
1932
|
}),
|
|
1933
|
-
|
|
1933
|
+
Mi({
|
|
1934
1934
|
testId: "markweave-image-caption",
|
|
1935
1935
|
label: _.value.caption,
|
|
1936
|
-
icon:
|
|
1936
|
+
icon: Er,
|
|
1937
1937
|
active: f.value || !!A.value,
|
|
1938
1938
|
onClick: V
|
|
1939
1939
|
}),
|
|
1940
|
-
|
|
1940
|
+
Mi({
|
|
1941
1941
|
testId: "markweave-image-preview",
|
|
1942
1942
|
label: _.value.preview,
|
|
1943
|
-
icon:
|
|
1944
|
-
onClick:
|
|
1943
|
+
icon: Lr,
|
|
1944
|
+
onClick: ee
|
|
1945
1945
|
}),
|
|
1946
|
-
|
|
1946
|
+
Mi({
|
|
1947
1947
|
testId: "markweave-image-download",
|
|
1948
1948
|
label: _.value.download,
|
|
1949
|
-
icon:
|
|
1949
|
+
icon: Ir,
|
|
1950
1950
|
onClick: () => {
|
|
1951
1951
|
w.value && j(w.value);
|
|
1952
1952
|
}
|
|
1953
1953
|
}),
|
|
1954
|
-
|
|
1954
|
+
Mi({
|
|
1955
1955
|
testId: "markweave-image-replace",
|
|
1956
1956
|
label: _.value.replace,
|
|
1957
|
-
icon:
|
|
1957
|
+
icon: oi,
|
|
1958
1958
|
onClick: () => {
|
|
1959
1959
|
o.value = "", c.value = null, i.value = !0;
|
|
1960
1960
|
}
|
|
1961
1961
|
}),
|
|
1962
|
-
|
|
1962
|
+
G("span", {
|
|
1963
1963
|
class: "markweave-image-toolbar-divider",
|
|
1964
1964
|
"aria-hidden": "true"
|
|
1965
1965
|
}),
|
|
1966
|
-
|
|
1966
|
+
Mi({
|
|
1967
1967
|
testId: "markweave-image-delete",
|
|
1968
1968
|
label: _.value.delete,
|
|
1969
|
-
icon:
|
|
1969
|
+
icon: bi,
|
|
1970
1970
|
onClick: () => e.deleteNode()
|
|
1971
1971
|
})
|
|
1972
1972
|
]) : null,
|
|
1973
|
-
|
|
1973
|
+
G("div", {
|
|
1974
1974
|
ref: t,
|
|
1975
1975
|
class: "markweave-image-box",
|
|
1976
1976
|
style: {
|
|
@@ -1978,22 +1978,22 @@ var Pi = X({
|
|
|
1978
1978
|
...x.value?.width && x.value.height ? { aspectRatio: `${x.value.width} / ${x.value.height}` } : {}
|
|
1979
1979
|
}
|
|
1980
1980
|
}, [
|
|
1981
|
-
w.value ?
|
|
1981
|
+
w.value ? G("img", {
|
|
1982
1982
|
class: "markweave-image",
|
|
1983
1983
|
src: w.value,
|
|
1984
|
-
alt:
|
|
1985
|
-
title:
|
|
1984
|
+
alt: F(u.value.alt) ?? "",
|
|
1985
|
+
title: F(u.value.title) ?? void 0,
|
|
1986
1986
|
draggable: !1,
|
|
1987
1987
|
loading: "lazy",
|
|
1988
1988
|
decoding: "async",
|
|
1989
1989
|
width: x.value?.width,
|
|
1990
1990
|
height: x.value?.height
|
|
1991
|
-
}) :
|
|
1991
|
+
}) : G("div", {
|
|
1992
1992
|
class: "markweave-image-readonly-empty",
|
|
1993
1993
|
"data-testid": "markweave-image-readonly-empty",
|
|
1994
1994
|
"aria-hidden": "true"
|
|
1995
1995
|
}),
|
|
1996
|
-
!h.value && w.value ?
|
|
1996
|
+
!h.value && w.value ? G("button", {
|
|
1997
1997
|
type: "button",
|
|
1998
1998
|
class: "markweave-image-preview-trigger",
|
|
1999
1999
|
"data-testid": "markweave-image-preview",
|
|
@@ -2001,15 +2001,15 @@ var Pi = X({
|
|
|
2001
2001
|
"aria-label": _.value.preview,
|
|
2002
2002
|
title: _.value.preview,
|
|
2003
2003
|
onMousedown: (e) => e.preventDefault(),
|
|
2004
|
-
onClick:
|
|
2005
|
-
}, [
|
|
2004
|
+
onClick: ee
|
|
2005
|
+
}, [G(Lr, {
|
|
2006
2006
|
size: 16,
|
|
2007
2007
|
strokeWidth: 1.8
|
|
2008
|
-
}),
|
|
2008
|
+
}), G("span", {
|
|
2009
2009
|
class: "markweave-image-tooltip",
|
|
2010
2010
|
role: "tooltip"
|
|
2011
2011
|
}, _.value.preview)]) : null,
|
|
2012
|
-
h.value ?
|
|
2012
|
+
h.value ? G("button", {
|
|
2013
2013
|
type: "button",
|
|
2014
2014
|
class: "markweave-image-resize-handle",
|
|
2015
2015
|
"data-testid": "markweave-image-resize-left",
|
|
@@ -2018,7 +2018,7 @@ var Pi = X({
|
|
|
2018
2018
|
"data-markweave-image-ui": "true",
|
|
2019
2019
|
onPointerdown: (e) => H("left", e)
|
|
2020
2020
|
}) : null,
|
|
2021
|
-
h.value ?
|
|
2021
|
+
h.value ? G("button", {
|
|
2022
2022
|
type: "button",
|
|
2023
2023
|
class: "markweave-image-resize-handle",
|
|
2024
2024
|
"data-testid": "markweave-image-resize-right",
|
|
@@ -2028,7 +2028,7 @@ var Pi = X({
|
|
|
2028
2028
|
onPointerdown: (e) => H("right", e)
|
|
2029
2029
|
}) : null
|
|
2030
2030
|
]),
|
|
2031
|
-
h.value && (f.value || A.value) ?
|
|
2031
|
+
h.value && (f.value || A.value) ? G("input", {
|
|
2032
2032
|
class: "markweave-image-caption-input",
|
|
2033
2033
|
"data-testid": "markweave-image-caption-input",
|
|
2034
2034
|
"data-markweave-image-ui": "true",
|
|
@@ -2041,13 +2041,13 @@ var Pi = X({
|
|
|
2041
2041
|
onKeydown: (e) => {
|
|
2042
2042
|
e.key === "Escape" && (e.preventDefault(), f.value = !1);
|
|
2043
2043
|
}
|
|
2044
|
-
}) : A.value ?
|
|
2044
|
+
}) : A.value ? G("figcaption", {
|
|
2045
2045
|
class: "markweave-image-caption",
|
|
2046
2046
|
"data-testid": "markweave-image-caption"
|
|
2047
2047
|
}, A.value) : null
|
|
2048
2048
|
]);
|
|
2049
2049
|
}
|
|
2050
|
-
}),
|
|
2050
|
+
}), Ii = X({
|
|
2051
2051
|
name: "MarkweaveVueVideoNodeView",
|
|
2052
2052
|
props: {
|
|
2053
2053
|
editor: {
|
|
@@ -2080,14 +2080,14 @@ var Pi = X({
|
|
|
2080
2080
|
}
|
|
2081
2081
|
},
|
|
2082
2082
|
setup(e) {
|
|
2083
|
-
let t =
|
|
2083
|
+
let t = K(!1), r = K(""), i = K(null), a = K(!1), o = Di(e.editor), c = q(() => d(o.value)), l = q(() => e.extension.options?.messages ?? n("zh")), u = q(() => l.value.video), f = q(() => e.node.attrs), p = q(() => F(f.value.src)), m = q(() => F(f.value.embedUrl)), h = q(() => F(f.value.provider)), g = q(() => m.value ? N(m.value, h.value) : null), _ = q(() => F(f.value.mimeType)), v = q(() => F(f.value.title)), y = () => {
|
|
2084
2084
|
p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
|
|
2085
2085
|
}, b = async (n) => {
|
|
2086
2086
|
if (!c.value) return;
|
|
2087
2087
|
let o = e.extension.options;
|
|
2088
2088
|
a.value = !0, i.value = null;
|
|
2089
2089
|
try {
|
|
2090
|
-
let t = await
|
|
2090
|
+
let t = await R(A(n), o?.onUpload);
|
|
2091
2091
|
e.updateAttributes(E(t)), r.value = "";
|
|
2092
2092
|
} catch (e) {
|
|
2093
2093
|
i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
@@ -2115,13 +2115,13 @@ var Pi = X({
|
|
|
2115
2115
|
}, w = (t) => {
|
|
2116
2116
|
c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
|
|
2117
2117
|
};
|
|
2118
|
-
return () => c.value && !p.value ?
|
|
2118
|
+
return () => c.value && !p.value ? G(s, {
|
|
2119
2119
|
as: "figure",
|
|
2120
2120
|
class: "markweave-video-node",
|
|
2121
2121
|
"data-testid": "markweave-video-node",
|
|
2122
2122
|
"data-empty": "true",
|
|
2123
2123
|
"data-selected": "false"
|
|
2124
|
-
}, () =>
|
|
2124
|
+
}, () => Pi({
|
|
2125
2125
|
messages: l.value,
|
|
2126
2126
|
inputValue: r.value,
|
|
2127
2127
|
error: i.value,
|
|
@@ -2136,7 +2136,7 @@ var Pi = X({
|
|
|
2136
2136
|
onDragActive: (e) => {
|
|
2137
2137
|
t.value = e;
|
|
2138
2138
|
}
|
|
2139
|
-
})) :
|
|
2139
|
+
})) : G(s, {
|
|
2140
2140
|
as: "figure",
|
|
2141
2141
|
class: "markweave-video-node",
|
|
2142
2142
|
"data-testid": "markweave-video-node",
|
|
@@ -2148,25 +2148,25 @@ var Pi = X({
|
|
|
2148
2148
|
onFocus: C,
|
|
2149
2149
|
onKeydown: w,
|
|
2150
2150
|
onMousedown: (e) => {
|
|
2151
|
-
c.value && !
|
|
2151
|
+
c.value && !ki(e.target) && (e.preventDefault(), C());
|
|
2152
2152
|
}
|
|
2153
|
-
}, () => [g.value ?
|
|
2153
|
+
}, () => [g.value ? G("div", { class: "markweave-video-embed" }, [G("iframe", {
|
|
2154
2154
|
class: "markweave-video-iframe",
|
|
2155
2155
|
src: g.value,
|
|
2156
2156
|
title: v.value ?? `${h.value ?? "Video"} embed`,
|
|
2157
2157
|
"data-markweave-video-embed": "true",
|
|
2158
2158
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
2159
2159
|
"data-markweave-video-src": p.value ?? void 0,
|
|
2160
|
-
allow:
|
|
2160
|
+
allow: M,
|
|
2161
2161
|
loading: "lazy",
|
|
2162
2162
|
allowfullscreen: "true"
|
|
2163
|
-
}), c.value ?
|
|
2163
|
+
}), c.value ? G("button", {
|
|
2164
2164
|
type: "button",
|
|
2165
2165
|
class: "markweave-video-selection-layer",
|
|
2166
2166
|
"data-testid": "markweave-video-selection-layer",
|
|
2167
2167
|
tabindex: -1,
|
|
2168
2168
|
"aria-label": u.value.selectAriaLabel
|
|
2169
|
-
}) : null]) : p.value ?
|
|
2169
|
+
}) : null]) : p.value ? G("div", { class: "markweave-video-box" }, [G("video", {
|
|
2170
2170
|
class: "markweave-video",
|
|
2171
2171
|
src: p.value,
|
|
2172
2172
|
title: v.value ?? void 0,
|
|
@@ -2174,19 +2174,19 @@ var Pi = X({
|
|
|
2174
2174
|
controls: !0,
|
|
2175
2175
|
"data-markweave-video": "true",
|
|
2176
2176
|
"data-markweave-mime-type": _.value ?? void 0
|
|
2177
|
-
}), c.value ?
|
|
2177
|
+
}), c.value ? G("button", {
|
|
2178
2178
|
type: "button",
|
|
2179
2179
|
class: "markweave-video-selection-layer",
|
|
2180
2180
|
"data-testid": "markweave-video-selection-layer",
|
|
2181
2181
|
tabindex: -1,
|
|
2182
2182
|
"aria-label": u.value.selectAriaLabel
|
|
2183
|
-
}) : null]) :
|
|
2183
|
+
}) : null]) : G("div", {
|
|
2184
2184
|
class: "markweave-video-readonly-empty",
|
|
2185
2185
|
"data-testid": "markweave-video-readonly-empty",
|
|
2186
2186
|
"aria-hidden": "true"
|
|
2187
2187
|
})]);
|
|
2188
2188
|
}
|
|
2189
|
-
}),
|
|
2189
|
+
}), Li = C.extend({
|
|
2190
2190
|
addOptions() {
|
|
2191
2191
|
return {
|
|
2192
2192
|
...this.parent?.(),
|
|
@@ -2197,16 +2197,16 @@ var Pi = X({
|
|
|
2197
2197
|
},
|
|
2198
2198
|
addNodeView() {
|
|
2199
2199
|
if (typeof document > "u") return null;
|
|
2200
|
-
let e = c(
|
|
2200
|
+
let e = c(Fi, { stopEvent: ({ event: e }) => Oi(e.target) }), t = this.options.resolveMediaSource;
|
|
2201
2201
|
if (!t) return e;
|
|
2202
2202
|
let r = x({
|
|
2203
2203
|
messages: this.options.messages ?? n("zh"),
|
|
2204
2204
|
onUpload: this.options.onUpload,
|
|
2205
2205
|
resolveMediaSource: t
|
|
2206
2206
|
});
|
|
2207
|
-
return (t) =>
|
|
2207
|
+
return (t) => F(t.node.attrs.src) ? r(t) : e(t);
|
|
2208
2208
|
}
|
|
2209
|
-
}),
|
|
2209
|
+
}), Ri = w.extend({
|
|
2210
2210
|
addOptions() {
|
|
2211
2211
|
return {
|
|
2212
2212
|
...this.parent?.(),
|
|
@@ -2216,9 +2216,9 @@ var Pi = X({
|
|
|
2216
2216
|
};
|
|
2217
2217
|
},
|
|
2218
2218
|
addNodeView() {
|
|
2219
|
-
return typeof document > "u" ? null : c(
|
|
2219
|
+
return typeof document > "u" ? null : c(Ii, { stopEvent: ({ event: e }) => ki(e.target) });
|
|
2220
2220
|
}
|
|
2221
|
-
}),
|
|
2221
|
+
}), zi = X({
|
|
2222
2222
|
name: "MarkweaveVueLinkCardNodeView",
|
|
2223
2223
|
props: {
|
|
2224
2224
|
editor: {
|
|
@@ -2251,11 +2251,11 @@ var Pi = X({
|
|
|
2251
2251
|
}
|
|
2252
2252
|
},
|
|
2253
2253
|
setup(e) {
|
|
2254
|
-
let t = e.extension.options, r = t.messages ?? n("zh"), i =
|
|
2255
|
-
|
|
2254
|
+
let t = e.extension.options, r = t.messages ?? n("zh"), i = Di(e.editor), a = K(!1), o = K(!1), c = K(!1), l = q(() => _(e.node.attrs ?? {})), u = K(l.value?.title ?? ""), f = K(l.value?.href ?? "");
|
|
2255
|
+
J(l, (e) => {
|
|
2256
2256
|
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
2257
2257
|
});
|
|
2258
|
-
let p =
|
|
2258
|
+
let p = q(() => d(i.value)), m = q(() => {
|
|
2259
2259
|
try {
|
|
2260
2260
|
return new URL(l.value?.href ?? "").host;
|
|
2261
2261
|
} catch {
|
|
@@ -2279,18 +2279,18 @@ var Pi = X({
|
|
|
2279
2279
|
...r,
|
|
2280
2280
|
...i
|
|
2281
2281
|
}) ?? r);
|
|
2282
|
-
}, C = (e, t, n, r) =>
|
|
2282
|
+
}, C = (e, t, n, r) => G("button", {
|
|
2283
2283
|
type: "button",
|
|
2284
2284
|
title: e,
|
|
2285
2285
|
"aria-label": e,
|
|
2286
2286
|
"data-testid": n,
|
|
2287
2287
|
onMousedown: h,
|
|
2288
2288
|
onClick: r
|
|
2289
|
-
}, [
|
|
2289
|
+
}, [ji(t, e), G("span", { role: "tooltip" }, e)]);
|
|
2290
2290
|
return () => {
|
|
2291
2291
|
let n = l.value;
|
|
2292
2292
|
if (!n) return null;
|
|
2293
|
-
let i = !c.value && n.imageUrl ?
|
|
2293
|
+
let i = !c.value && n.imageUrl ? G("img", {
|
|
2294
2294
|
src: n.imageUrl,
|
|
2295
2295
|
alt: "",
|
|
2296
2296
|
loading: "lazy",
|
|
@@ -2298,7 +2298,7 @@ var Pi = X({
|
|
|
2298
2298
|
onError: () => {
|
|
2299
2299
|
c.value = !0;
|
|
2300
2300
|
}
|
|
2301
|
-
}) : !c.value && n.faviconUrl ?
|
|
2301
|
+
}) : !c.value && n.faviconUrl ? G("img", {
|
|
2302
2302
|
class: "markweave-link-card-favicon",
|
|
2303
2303
|
src: n.faviconUrl,
|
|
2304
2304
|
alt: "",
|
|
@@ -2307,8 +2307,8 @@ var Pi = X({
|
|
|
2307
2307
|
onError: () => {
|
|
2308
2308
|
c.value = !0;
|
|
2309
2309
|
}
|
|
2310
|
-
}) :
|
|
2311
|
-
return
|
|
2310
|
+
}) : G("b", null, m.value.slice(0, 1).toUpperCase());
|
|
2311
|
+
return G(s, {
|
|
2312
2312
|
as: "article",
|
|
2313
2313
|
class: "markweave-link-card",
|
|
2314
2314
|
"data-testid": "markweave-link-card",
|
|
@@ -2322,32 +2322,32 @@ var Pi = X({
|
|
|
2322
2322
|
a.value = !1;
|
|
2323
2323
|
},
|
|
2324
2324
|
onMousedown: (e) => {
|
|
2325
|
-
|
|
2325
|
+
Ai(e.target) || e.preventDefault();
|
|
2326
2326
|
},
|
|
2327
2327
|
onClick: (e) => {
|
|
2328
|
-
|
|
2328
|
+
Ai(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
2329
2329
|
}
|
|
2330
2330
|
}, () => [
|
|
2331
|
-
|
|
2331
|
+
G("a", {
|
|
2332
2332
|
class: "markweave-link-card-main",
|
|
2333
2333
|
href: n.href,
|
|
2334
2334
|
"aria-label": r.linkCard.open
|
|
2335
|
-
}, [
|
|
2336
|
-
|
|
2337
|
-
n.description ?
|
|
2338
|
-
|
|
2339
|
-
]),
|
|
2335
|
+
}, [G("span", { class: "markweave-link-card-copy" }, [
|
|
2336
|
+
G("strong", null, n.title),
|
|
2337
|
+
n.description ? G("span", null, n.description) : null,
|
|
2338
|
+
G("small", null, n.siteName ?? m.value)
|
|
2339
|
+
]), G("span", {
|
|
2340
2340
|
class: "markweave-link-card-media",
|
|
2341
2341
|
"aria-hidden": "true"
|
|
2342
2342
|
}, [i])]),
|
|
2343
|
-
p.value && a.value ?
|
|
2343
|
+
p.value && a.value ? G("div", {
|
|
2344
2344
|
class: "markweave-link-card-tools",
|
|
2345
2345
|
"data-markweave-link-card-ui": "true",
|
|
2346
2346
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
2347
2347
|
}, [
|
|
2348
|
-
C(r.linkCard.convertToLink,
|
|
2349
|
-
C(r.linkCard.copyAddress,
|
|
2350
|
-
C(r.linkCard.edit,
|
|
2348
|
+
C(r.linkCard.convertToLink, Yr, "markweave-link-card-convert", x),
|
|
2349
|
+
C(r.linkCard.copyAddress, Ir, "markweave-link-card-copy", () => b(n.href)),
|
|
2350
|
+
C(r.linkCard.edit, ri, "markweave-link-card-edit", (i) => g({
|
|
2351
2351
|
anchor: i.currentTarget,
|
|
2352
2352
|
editor: e.editor,
|
|
2353
2353
|
messages: r,
|
|
@@ -2357,15 +2357,15 @@ var Pi = X({
|
|
|
2357
2357
|
attrs: n
|
|
2358
2358
|
}
|
|
2359
2359
|
})),
|
|
2360
|
-
C(r.linkCard.delete,
|
|
2360
|
+
C(r.linkCard.delete, bi, "markweave-link-card-delete", () => e.deleteNode())
|
|
2361
2361
|
]) : null,
|
|
2362
|
-
p.value && o.value ?
|
|
2362
|
+
p.value && o.value ? G("form", {
|
|
2363
2363
|
class: "markweave-link-card-editor",
|
|
2364
2364
|
"data-markweave-link-card-ui": "true",
|
|
2365
2365
|
"data-testid": "markweave-link-card-editor",
|
|
2366
2366
|
onSubmit: S
|
|
2367
2367
|
}, [
|
|
2368
|
-
|
|
2368
|
+
G("label", null, [G("span", null, r.linkCard.titleLabel), G("input", {
|
|
2369
2369
|
value: u.value,
|
|
2370
2370
|
placeholder: r.linkCard.titlePlaceholder,
|
|
2371
2371
|
"aria-label": r.linkCard.titleLabel,
|
|
@@ -2373,7 +2373,7 @@ var Pi = X({
|
|
|
2373
2373
|
u.value = e.target.value;
|
|
2374
2374
|
}
|
|
2375
2375
|
})]),
|
|
2376
|
-
|
|
2376
|
+
G("label", null, [G("span", null, r.linkCard.addressLabel), G("input", {
|
|
2377
2377
|
value: f.value,
|
|
2378
2378
|
placeholder: r.linkCard.addressPlaceholder,
|
|
2379
2379
|
"aria-label": r.linkCard.addressLabel,
|
|
@@ -2381,16 +2381,16 @@ var Pi = X({
|
|
|
2381
2381
|
f.value = e.target.value;
|
|
2382
2382
|
}
|
|
2383
2383
|
})]),
|
|
2384
|
-
|
|
2384
|
+
G("button", {
|
|
2385
2385
|
type: "submit",
|
|
2386
2386
|
disabled: !v(f.value),
|
|
2387
2387
|
"aria-label": r.linkCard.edit
|
|
2388
|
-
}, [
|
|
2388
|
+
}, [ji(Yr, r.linkCard.edit)])
|
|
2389
2389
|
]) : null
|
|
2390
2390
|
]);
|
|
2391
2391
|
};
|
|
2392
2392
|
}
|
|
2393
|
-
}),
|
|
2393
|
+
}), Bi = h.extend({
|
|
2394
2394
|
addOptions() {
|
|
2395
2395
|
return {
|
|
2396
2396
|
...this.parent?.(),
|
|
@@ -2399,23 +2399,23 @@ var Pi = X({
|
|
|
2399
2399
|
};
|
|
2400
2400
|
},
|
|
2401
2401
|
addNodeView() {
|
|
2402
|
-
return typeof document > "u" ? null : c(
|
|
2402
|
+
return typeof document > "u" ? null : c(zi, { stopEvent: ({ event: e }) => Ai(e.target) });
|
|
2403
2403
|
}
|
|
2404
2404
|
});
|
|
2405
2405
|
//#endregion
|
|
2406
2406
|
//#region src/create-editor-extensions.ts
|
|
2407
|
-
function
|
|
2407
|
+
function Vi(t = {}) {
|
|
2408
2408
|
return e({
|
|
2409
2409
|
lang: t.lang,
|
|
2410
2410
|
onImageUpload: t.onImageUpload,
|
|
2411
|
-
linkCardExtension:
|
|
2411
|
+
linkCardExtension: Bi.configure({
|
|
2412
2412
|
lang: t.lang,
|
|
2413
2413
|
messages: n(t.lang),
|
|
2414
2414
|
resolver: t.linkCardResolver
|
|
2415
2415
|
}),
|
|
2416
2416
|
mediaExtensions: i({
|
|
2417
|
-
image:
|
|
2418
|
-
video:
|
|
2417
|
+
image: Li,
|
|
2418
|
+
video: Ri,
|
|
2419
2419
|
lang: t.lang,
|
|
2420
2420
|
onImageUpload: t.onImageUpload,
|
|
2421
2421
|
onVideoUpload: t.onVideoUpload,
|
|
@@ -2425,7 +2425,7 @@ function Bi(t = {}) {
|
|
|
2425
2425
|
}
|
|
2426
2426
|
//#endregion
|
|
2427
2427
|
//#region src/MarkweaveEditor.ts
|
|
2428
|
-
var
|
|
2428
|
+
var Hi = {
|
|
2429
2429
|
active: !1,
|
|
2430
2430
|
mode: "outside",
|
|
2431
2431
|
activeCellPos: null,
|
|
@@ -2433,17 +2433,17 @@ var Vi = {
|
|
|
2433
2433
|
selectedCellCount: 0,
|
|
2434
2434
|
selectionFrom: 0,
|
|
2435
2435
|
selectionTo: 0
|
|
2436
|
-
},
|
|
2436
|
+
}, Ui = {
|
|
2437
2437
|
active: !1,
|
|
2438
|
-
language:
|
|
2438
|
+
language: $e.defaultLanguage,
|
|
2439
2439
|
mermaidPreviewMode: "code",
|
|
2440
2440
|
pos: null,
|
|
2441
2441
|
text: ""
|
|
2442
2442
|
};
|
|
2443
|
-
function Ui(e) {
|
|
2444
|
-
return pn.getState(e.state) ?? fn;
|
|
2445
|
-
}
|
|
2446
2443
|
function Wi(e) {
|
|
2444
|
+
return fn.getState(e.state) ?? dn;
|
|
2445
|
+
}
|
|
2446
|
+
function Gi(e) {
|
|
2447
2447
|
if (!e || typeof window > "u") return null;
|
|
2448
2448
|
let t = e.parentElement;
|
|
2449
2449
|
for (; t;) {
|
|
@@ -2454,133 +2454,133 @@ function Wi(e) {
|
|
|
2454
2454
|
return null;
|
|
2455
2455
|
}
|
|
2456
2456
|
function Q(e, t, n = 18, r = 1.8) {
|
|
2457
|
-
return
|
|
2457
|
+
return G(e, {
|
|
2458
2458
|
size: n,
|
|
2459
2459
|
strokeWidth: r,
|
|
2460
2460
|
"aria-hidden": "true"
|
|
2461
2461
|
}, { default: () => t });
|
|
2462
2462
|
}
|
|
2463
|
-
function
|
|
2464
|
-
return e === "clipboard" ? [
|
|
2463
|
+
function Ki(e) {
|
|
2464
|
+
return e === "clipboard" ? [G("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" }), G("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" ? [G("circle", {
|
|
2465
2465
|
cx: "10",
|
|
2466
2466
|
cy: "10",
|
|
2467
2467
|
r: "5.5"
|
|
2468
|
-
}),
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2468
|
+
}), G("path", { d: "m14 14 4 4" })] : e === "check" ? [G("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
|
|
2469
|
+
G("path", { d: "M8 4H4v4" }),
|
|
2470
|
+
G("path", { d: "M4 4l5 5" }),
|
|
2471
|
+
G("path", { d: "M16 4h4v4" }),
|
|
2472
|
+
G("path", { d: "m20 4-5 5" }),
|
|
2473
|
+
G("path", { d: "M8 20H4v-4" }),
|
|
2474
|
+
G("path", { d: "m4 20 5-5" }),
|
|
2475
|
+
G("path", { d: "M16 20h4v-4" }),
|
|
2476
|
+
G("path", { d: "m20 20-5-5" })
|
|
2477
2477
|
] : e === "download" ? [
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
] : e === "close" ? [
|
|
2482
|
-
|
|
2478
|
+
G("path", { d: "M12 4v10" }),
|
|
2479
|
+
G("path", { d: "m8 10 4 4 4-4" }),
|
|
2480
|
+
G("path", { d: "M5 19h14" })
|
|
2481
|
+
] : e === "close" ? [G("path", { d: "M6 6l12 12" }), G("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
|
|
2482
|
+
G("circle", {
|
|
2483
2483
|
cx: "10",
|
|
2484
2484
|
cy: "10",
|
|
2485
2485
|
r: "5.25"
|
|
2486
2486
|
}),
|
|
2487
|
-
|
|
2488
|
-
|
|
2487
|
+
G("path", { d: "M7.5 10h5" }),
|
|
2488
|
+
G("path", { d: "m14 14 4 4" })
|
|
2489
2489
|
] : e === "zoomIn" ? [
|
|
2490
|
-
|
|
2490
|
+
G("circle", {
|
|
2491
2491
|
cx: "10",
|
|
2492
2492
|
cy: "10",
|
|
2493
2493
|
r: "5.25"
|
|
2494
2494
|
}),
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
] : e === "reset" ? [
|
|
2495
|
+
G("path", { d: "M7.5 10h5" }),
|
|
2496
|
+
G("path", { d: "M10 7.5v5" }),
|
|
2497
|
+
G("path", { d: "m14 14 4 4" })
|
|
2498
|
+
] : e === "reset" ? [G("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), G("path", { d: "M6.5 8.5H3.5v-3" })] : [G("path", { d: "m6 9 6 6 6-6" })];
|
|
2499
2499
|
}
|
|
2500
|
-
function
|
|
2501
|
-
return
|
|
2500
|
+
function qi(e) {
|
|
2501
|
+
return G("svg", {
|
|
2502
2502
|
viewBox: "0 0 24 24",
|
|
2503
2503
|
"aria-hidden": "true",
|
|
2504
2504
|
focusable: "false"
|
|
2505
|
-
},
|
|
2505
|
+
}, G("g", {
|
|
2506
2506
|
fill: "none",
|
|
2507
2507
|
stroke: "currentColor",
|
|
2508
2508
|
"stroke-linecap": "round",
|
|
2509
2509
|
"stroke-linejoin": "round",
|
|
2510
2510
|
"stroke-width": "1.8"
|
|
2511
|
-
},
|
|
2511
|
+
}, Ki(e)));
|
|
2512
2512
|
}
|
|
2513
2513
|
function $(e) {
|
|
2514
2514
|
e.preventDefault();
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2517
|
-
let t =
|
|
2516
|
+
function Ji(e) {
|
|
2517
|
+
let t = At(e);
|
|
2518
2518
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
2519
2519
|
}
|
|
2520
|
-
var
|
|
2521
|
-
bold:
|
|
2522
|
-
italic:
|
|
2523
|
-
underline:
|
|
2524
|
-
strike:
|
|
2525
|
-
"inline-code":
|
|
2526
|
-
link:
|
|
2527
|
-
more:
|
|
2528
|
-
superscript:
|
|
2529
|
-
subscript:
|
|
2530
|
-
"inline-math":
|
|
2531
|
-
"align-left":
|
|
2532
|
-
"align-center":
|
|
2533
|
-
"align-right":
|
|
2534
|
-
"align-justify":
|
|
2535
|
-
"decrease-indent":
|
|
2536
|
-
"increase-indent":
|
|
2537
|
-
},
|
|
2538
|
-
type:
|
|
2539
|
-
"heading-1":
|
|
2540
|
-
"heading-2":
|
|
2541
|
-
"heading-3":
|
|
2542
|
-
"bullet-list":
|
|
2543
|
-
"ordered-list":
|
|
2544
|
-
"task-list":
|
|
2545
|
-
blockquote:
|
|
2546
|
-
"code-block":
|
|
2547
|
-
info:
|
|
2548
|
-
tip:
|
|
2549
|
-
warning:
|
|
2550
|
-
error:
|
|
2551
|
-
success:
|
|
2552
|
-
emoji:
|
|
2553
|
-
math:
|
|
2554
|
-
table:
|
|
2555
|
-
separator:
|
|
2556
|
-
image:
|
|
2557
|
-
video:
|
|
2558
|
-
attachment:
|
|
2520
|
+
var Yi = {
|
|
2521
|
+
bold: wr,
|
|
2522
|
+
italic: qr,
|
|
2523
|
+
underline: Si,
|
|
2524
|
+
strike: pi,
|
|
2525
|
+
"inline-code": Nr,
|
|
2526
|
+
link: Yr,
|
|
2527
|
+
more: ei,
|
|
2528
|
+
superscript: hi,
|
|
2529
|
+
subscript: mi,
|
|
2530
|
+
"inline-math": ci,
|
|
2531
|
+
"align-left": cr,
|
|
2532
|
+
"align-center": or,
|
|
2533
|
+
"align-right": lr,
|
|
2534
|
+
"align-justify": sr,
|
|
2535
|
+
"decrease-indent": Wr,
|
|
2536
|
+
"increase-indent": Gr
|
|
2537
|
+
}, Xi = {
|
|
2538
|
+
type: yi,
|
|
2539
|
+
"heading-1": zr,
|
|
2540
|
+
"heading-2": Br,
|
|
2541
|
+
"heading-3": Vr,
|
|
2542
|
+
"bullet-list": Xr,
|
|
2543
|
+
"ordered-list": Qr,
|
|
2544
|
+
"task-list": Zr,
|
|
2545
|
+
blockquote: ai,
|
|
2546
|
+
"code-block": Tr,
|
|
2547
|
+
info: Kr,
|
|
2548
|
+
tip: Jr,
|
|
2549
|
+
warning: pr,
|
|
2550
|
+
error: Mr,
|
|
2551
|
+
success: Or,
|
|
2552
|
+
emoji: li,
|
|
2553
|
+
math: ci,
|
|
2554
|
+
table: gi,
|
|
2555
|
+
separator: $r,
|
|
2556
|
+
image: Hr,
|
|
2557
|
+
video: wi,
|
|
2558
|
+
attachment: ni
|
|
2559
2559
|
};
|
|
2560
|
-
function
|
|
2561
|
-
let t =
|
|
2562
|
-
return
|
|
2560
|
+
function Zi(e) {
|
|
2561
|
+
let t = Xi[e];
|
|
2562
|
+
return G(t, {
|
|
2563
2563
|
size: 18,
|
|
2564
2564
|
strokeWidth: 1.6,
|
|
2565
2565
|
absoluteStrokeWidth: !0,
|
|
2566
2566
|
"aria-hidden": "true"
|
|
2567
2567
|
});
|
|
2568
2568
|
}
|
|
2569
|
-
var
|
|
2570
|
-
paragraph:
|
|
2571
|
-
"heading-1":
|
|
2572
|
-
"heading-2":
|
|
2573
|
-
"heading-3":
|
|
2574
|
-
"bullet-list":
|
|
2575
|
-
"numbered-list":
|
|
2576
|
-
"todo-list":
|
|
2577
|
-
quote:
|
|
2578
|
-
"code-block":
|
|
2569
|
+
var Qi = {
|
|
2570
|
+
paragraph: xi,
|
|
2571
|
+
"heading-1": zr,
|
|
2572
|
+
"heading-2": Br,
|
|
2573
|
+
"heading-3": Vr,
|
|
2574
|
+
"bullet-list": Xr,
|
|
2575
|
+
"numbered-list": Qr,
|
|
2576
|
+
"todo-list": Zr,
|
|
2577
|
+
quote: ai,
|
|
2578
|
+
"code-block": Tr
|
|
2579
2579
|
};
|
|
2580
|
-
function
|
|
2581
|
-
return
|
|
2580
|
+
function $i(e, t) {
|
|
2581
|
+
return ae(e, t).label;
|
|
2582
2582
|
}
|
|
2583
|
-
var
|
|
2583
|
+
var ea = X({
|
|
2584
2584
|
name: "MarkweaveVueFloatingToolbar",
|
|
2585
2585
|
props: {
|
|
2586
2586
|
editor: {
|
|
@@ -2605,73 +2605,73 @@ var $i = X({
|
|
|
2605
2605
|
}
|
|
2606
2606
|
},
|
|
2607
2607
|
setup(e) {
|
|
2608
|
-
let t =
|
|
2608
|
+
let t = K(null), n = K("input"), r = K(""), i = K(""), a = K(""), o = K(""), s = tr(null), c = tr(null), l = K(null), u = K(null), d = "", f = q(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = K(""), m = K(null), h = K(null), g = K("bottom"), _ = K(null), v = K(null), y = K(null), b = q(() => At(p.value.trim())), x = q(() => e.messages.floatingToolbar), S = q(() => le(e.messages).map((e) => [
|
|
2609
2609
|
e.id,
|
|
2610
2610
|
e.label,
|
|
2611
|
-
|
|
2612
|
-
])), C =
|
|
2611
|
+
Qi[e.id]
|
|
2612
|
+
])), C = q(() => ce(e.messages).map((e) => [
|
|
2613
2613
|
e.id,
|
|
2614
2614
|
e.value,
|
|
2615
2615
|
e.label
|
|
2616
|
-
])), w =
|
|
2616
|
+
])), w = q(() => oe(e.messages).map((e) => [
|
|
2617
2617
|
e.id,
|
|
2618
2618
|
e.value,
|
|
2619
2619
|
e.label
|
|
2620
|
-
])), T =
|
|
2620
|
+
])), T = q(() => se(e.messages).map((e) => e.id)), E = () => {
|
|
2621
2621
|
b.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: b.value }).run(), t.value = null);
|
|
2622
2622
|
}, D = () => {
|
|
2623
2623
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), p.value = "", t.value = null;
|
|
2624
2624
|
}, O = (n) => {
|
|
2625
2625
|
t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
|
|
2626
2626
|
}, k = H(() => {
|
|
2627
|
-
|
|
2627
|
+
Le(e.editor, d), a.value = d;
|
|
2628
2628
|
}), A = (n = !0) => {
|
|
2629
|
-
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n &&
|
|
2629
|
+
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && Fe(e.editor), De(e.editor), t.value = null, n && e.editor.commands.focus();
|
|
2630
2630
|
}, j = () => {
|
|
2631
2631
|
if (!f.value) return;
|
|
2632
|
-
let r =
|
|
2632
|
+
let r = ze(e.editor);
|
|
2633
2633
|
r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", Y(() => u.value?.focus()));
|
|
2634
|
-
},
|
|
2634
|
+
}, M = async (t) => {
|
|
2635
2635
|
if (!f.value || e.askAi?.enabled !== !0 || !s.value) return;
|
|
2636
2636
|
let u = (t ?? r.value).trim();
|
|
2637
2637
|
if (!u) {
|
|
2638
2638
|
o.value = e.messages.askAi.emptyPrompt, n.value = "error";
|
|
2639
2639
|
return;
|
|
2640
2640
|
}
|
|
2641
|
-
let p =
|
|
2641
|
+
let p = ke(e.editor, s.value);
|
|
2642
2642
|
if (!p) {
|
|
2643
2643
|
n.value = "conflict";
|
|
2644
2644
|
return;
|
|
2645
2645
|
}
|
|
2646
|
-
s.value = p, c.value?.abort(),
|
|
2647
|
-
let m = new AbortController(), h =
|
|
2646
|
+
s.value = p, c.value?.abort(), Ee(e.editor);
|
|
2647
|
+
let m = new AbortController(), h = Oe(p, u, e.lang, m.signal, void 0, je(e.editor)?.target);
|
|
2648
2648
|
c.value = m, l.value = h.id, i.value = u, k.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
|
|
2649
2649
|
try {
|
|
2650
|
-
let t = await
|
|
2650
|
+
let t = await Ie(e.askAi.handler, h, (e) => {
|
|
2651
2651
|
l.value === h.id && !m.signal.aborted && (d = e, k.schedule());
|
|
2652
2652
|
});
|
|
2653
2653
|
if (l.value !== h.id || m.signal.aborted) return;
|
|
2654
|
-
if (k.cancel(), d = t, !
|
|
2655
|
-
a.value = t, r.value = "", n.value =
|
|
2654
|
+
if (k.cancel(), d = t, !Le(e.editor, t)) throw new Se("invalid-output", "Ask AI output is incompatible with the selected content.");
|
|
2655
|
+
a.value = t, r.value = "", n.value = je(e.editor)?.status === "target" ? "result" : "conflict";
|
|
2656
2656
|
} catch (t) {
|
|
2657
2657
|
if (l.value !== h.id) return;
|
|
2658
2658
|
if (k.cancel(), m.signal.aborted) {
|
|
2659
|
-
|
|
2659
|
+
Ee(e.editor), n.value = je(e.editor)?.status === "conflict" ? "conflict" : "input";
|
|
2660
2660
|
return;
|
|
2661
2661
|
}
|
|
2662
|
-
|
|
2662
|
+
Ee(e.editor), o.value = t instanceof Se ? t.code === "empty-result" ? e.messages.askAi.emptyResult : e.messages.askAi.errorFallback : t instanceof Error && t.message ? t.message : e.messages.askAi.errorFallback, n.value = "error";
|
|
2663
2663
|
}
|
|
2664
|
-
},
|
|
2665
|
-
if (!
|
|
2666
|
-
n.value =
|
|
2664
|
+
}, ee = () => {
|
|
2665
|
+
if (!Ce(e.editor, a.value)) {
|
|
2666
|
+
n.value = je(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
|
|
2667
2667
|
return;
|
|
2668
2668
|
}
|
|
2669
|
-
t.value = null, window.setTimeout(() =>
|
|
2670
|
-
},
|
|
2669
|
+
t.value = null, window.setTimeout(() => De(e.editor), 560), e.editor.commands.focus();
|
|
2670
|
+
}, N = H(() => {
|
|
2671
2671
|
let n = _.value, r = y.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
2672
2672
|
if (!t.value || !n || !r) return;
|
|
2673
2673
|
if (t.value === "ask-ai") {
|
|
2674
|
-
let t =
|
|
2674
|
+
let t = Me(e.editor), n = v.value?.getBoundingClientRect();
|
|
2675
2675
|
if (!t || !n) return;
|
|
2676
2676
|
let a = {
|
|
2677
2677
|
anchorRect: n,
|
|
@@ -2681,18 +2681,18 @@ var $i = X({
|
|
|
2681
2681
|
height: window.innerHeight
|
|
2682
2682
|
},
|
|
2683
2683
|
frameRect: i?.getBoundingClientRect() ?? null,
|
|
2684
|
-
surfaceRect:
|
|
2685
|
-
}, o =
|
|
2684
|
+
surfaceRect: Ae(e.editor.view.dom)
|
|
2685
|
+
}, o = we({
|
|
2686
2686
|
...a,
|
|
2687
2687
|
panelSize: r.getBoundingClientRect()
|
|
2688
2688
|
}), s = `${o.width}px`;
|
|
2689
|
-
r.style.width !== s && (r.style.width = s, o =
|
|
2689
|
+
r.style.width !== s && (r.style.width = s, o = we({
|
|
2690
2690
|
...a,
|
|
2691
2691
|
panelSize: r.getBoundingClientRect()
|
|
2692
2692
|
})), r.style.left = `${o.left}px`, r.style.top = `${o.top}px`, r.style.bottom = "auto", r.style.maxWidth = `${o.maxWidth}px`, r.style.maxHeight = `${Math.max(0, o.maxHeight)}px`, r.dataset.positioned = "true", g.value = o.placement;
|
|
2693
2693
|
return;
|
|
2694
2694
|
}
|
|
2695
|
-
let a =
|
|
2695
|
+
let a = he({
|
|
2696
2696
|
toolbarRect: n.getBoundingClientRect(),
|
|
2697
2697
|
popoverSize: r.getBoundingClientRect(),
|
|
2698
2698
|
viewport: {
|
|
@@ -2703,16 +2703,16 @@ var $i = X({
|
|
|
2703
2703
|
gap: t.value === "more" ? 8 : 6
|
|
2704
2704
|
});
|
|
2705
2705
|
g.value = a.placement;
|
|
2706
|
-
}),
|
|
2707
|
-
let l =
|
|
2706
|
+
}), P = () => {
|
|
2707
|
+
let l = je(e.editor);
|
|
2708
2708
|
if (l?.target.kind === "table" && l.status === "target" && t.value !== "ask-ai") {
|
|
2709
2709
|
s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", Y(() => u.value?.focus());
|
|
2710
2710
|
return;
|
|
2711
2711
|
}
|
|
2712
2712
|
t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(), k.cancel(), n.value = "conflict");
|
|
2713
|
-
}, P = (e) => {
|
|
2714
|
-
e.key !== "Escape" || t.value !== "ask-ai" || (e.preventDefault(), n.value === "generating" ? (c.value?.abort(), k.cancel(), n.value = "input") : A(!0));
|
|
2715
2713
|
}, F = (e) => {
|
|
2714
|
+
e.key !== "Escape" || t.value !== "ask-ai" || (e.preventDefault(), n.value === "generating" ? (c.value?.abort(), k.cancel(), n.value = "input") : A(!0));
|
|
2715
|
+
}, I = (e) => {
|
|
2716
2716
|
if (!(!t.value || v.value?.contains(e.target))) {
|
|
2717
2717
|
if (t.value === "ask-ai") {
|
|
2718
2718
|
A(!0);
|
|
@@ -2721,38 +2721,38 @@ var $i = X({
|
|
|
2721
2721
|
t.value = null;
|
|
2722
2722
|
}
|
|
2723
2723
|
};
|
|
2724
|
-
|
|
2724
|
+
J(() => [
|
|
2725
2725
|
t.value,
|
|
2726
2726
|
n.value,
|
|
2727
2727
|
a.value,
|
|
2728
2728
|
o.value
|
|
2729
2729
|
], ([e]) => {
|
|
2730
|
-
e && Y(
|
|
2730
|
+
e && Y(N.schedule);
|
|
2731
2731
|
}), nr(() => {
|
|
2732
|
-
window.addEventListener("resize",
|
|
2733
|
-
}),
|
|
2734
|
-
|
|
2732
|
+
window.addEventListener("resize", N.schedule), window.addEventListener("scroll", N.schedule, !0), e.editor.on("transaction", P), document.addEventListener("pointerdown", I, !0), document.addEventListener("keydown", F, !0);
|
|
2733
|
+
}), rr(() => {
|
|
2734
|
+
N.cancel(), k.cancel(), window.removeEventListener("resize", N.schedule), window.removeEventListener("scroll", N.schedule, !0), e.editor.off("transaction", P), document.removeEventListener("pointerdown", I, !0), document.removeEventListener("keydown", F, !0), c.value?.abort(), De(e.editor);
|
|
2735
2735
|
});
|
|
2736
|
-
let
|
|
2736
|
+
let L = (n) => n === "block-type" || n === "color" || n === "more" ? t.value === n : n === "bold" ? e.editor.isActive("bold") : n === "italic" ? e.editor.isActive("italic") : n === "underline" ? e.editor.isActive("underline") : n === "strike" ? e.editor.isActive("strike") : n === "inline-code" ? e.editor.isActive("code") : n === "link" ? e.editor.isActive("link") : !1, R = (e, t) => {
|
|
2737
2737
|
if (m.value = e, !e || !(t instanceof HTMLElement) || !v.value) {
|
|
2738
2738
|
h.value = null;
|
|
2739
2739
|
return;
|
|
2740
2740
|
}
|
|
2741
2741
|
let n = t.getBoundingClientRect(), r = v.value.getBoundingClientRect();
|
|
2742
2742
|
h.value = n.left + n.width / 2 - r.left;
|
|
2743
|
-
},
|
|
2743
|
+
}, te = () => {
|
|
2744
2744
|
let e = m.value;
|
|
2745
2745
|
if (!e || t.value !== null) return null;
|
|
2746
2746
|
let n = x.value.buttons[e];
|
|
2747
|
-
return n ?
|
|
2747
|
+
return n ? G("div", {
|
|
2748
2748
|
class: "markweave-floating-toolbar-tooltip",
|
|
2749
2749
|
role: "tooltip",
|
|
2750
2750
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
2751
2751
|
"data-button-id": e,
|
|
2752
|
-
"data-active":
|
|
2752
|
+
"data-active": L(e),
|
|
2753
2753
|
style: h.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${h.value}px` }
|
|
2754
2754
|
}, n) : null;
|
|
2755
|
-
}, B = (n, r, i, a, o = !1, s) =>
|
|
2755
|
+
}, B = (n, r, i, a, o = !1, s) => G("button", {
|
|
2756
2756
|
type: "button",
|
|
2757
2757
|
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
2758
2758
|
"aria-label": r,
|
|
@@ -2766,19 +2766,19 @@ var $i = X({
|
|
|
2766
2766
|
"data-active": o || t.value === n,
|
|
2767
2767
|
"data-tooltip-active": m.value === n ? "true" : "false",
|
|
2768
2768
|
"data-testid": `markweave-floating-toolbar-button-${n}`,
|
|
2769
|
-
onBlur: () =>
|
|
2770
|
-
onFocus: (e) =>
|
|
2769
|
+
onBlur: () => R(null),
|
|
2770
|
+
onFocus: (e) => R(n, e.currentTarget),
|
|
2771
2771
|
onMousedown: $,
|
|
2772
|
-
onMouseenter: (e) =>
|
|
2773
|
-
onMouseleave: () =>
|
|
2772
|
+
onMouseenter: (e) => R(n, e.currentTarget),
|
|
2773
|
+
onMouseleave: () => R(null),
|
|
2774
2774
|
onClick: a
|
|
2775
|
-
}, n === "ask-ai" ? [
|
|
2775
|
+
}, n === "ask-ai" ? [G("span", { class: "markweave-floating-toolbar-button-inner" }, [Q(i, r), G("span", null, s ?? r)])] : n === "block-type" ? [G("span", { class: "markweave-floating-toolbar-button-inner" }, [G("span", { class: "markweave-floating-toolbar-block-label" }, $i(e.editor, e.messages)), Q(t.value === "block-type" ? jr : kr, r)])] : n === "color" ? [G("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [G("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Q(t.value === "color" ? jr : kr, r)])] : [Q(i, r)]), V = () => G("span", {
|
|
2776
2776
|
class: "markweave-floating-toolbar-divider",
|
|
2777
2777
|
"aria-hidden": "true"
|
|
2778
|
-
}),
|
|
2778
|
+
}), U = (n, r, i) => G("section", {
|
|
2779
2779
|
class: "markweave-floating-toolbar-color-section",
|
|
2780
2780
|
"aria-label": n
|
|
2781
|
-
}, [
|
|
2781
|
+
}, [G("div", { class: "markweave-floating-toolbar-menu-title" }, n), G("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => G("button", {
|
|
2782
2782
|
key: `${r}-${n}`,
|
|
2783
2783
|
type: "button",
|
|
2784
2784
|
"aria-label": a,
|
|
@@ -2787,24 +2787,24 @@ var $i = X({
|
|
|
2787
2787
|
onClick: () => {
|
|
2788
2788
|
r === "text" ? i ? e.editor.chain().focus().setColor(i).run() : e.editor.chain().focus().unsetColor().run() : i ? e.editor.chain().focus().toggleHighlight({ color: i }).run() : e.editor.chain().focus().unsetHighlight().run(), t.value = null;
|
|
2789
2789
|
}
|
|
2790
|
-
}, r === "text" ? [
|
|
2790
|
+
}, r === "text" ? [G("span", {
|
|
2791
2791
|
class: "markweave-floating-toolbar-text-swatch",
|
|
2792
2792
|
style: { color: i ?? "#646970" }
|
|
2793
|
-
}, "A")] : [
|
|
2793
|
+
}, "A")] : [G("span", {
|
|
2794
2794
|
class: "markweave-floating-toolbar-highlight-swatch",
|
|
2795
2795
|
style: { backgroundColor: i ?? "#ffffff" },
|
|
2796
2796
|
"aria-hidden": "true"
|
|
2797
|
-
})])))]),
|
|
2797
|
+
})])))]), ne = () => {
|
|
2798
2798
|
if (t.value === "ask-ai") {
|
|
2799
|
-
let t = (e, t, n, r) =>
|
|
2799
|
+
let t = (e, t, n, r) => G("button", {
|
|
2800
2800
|
type: "button",
|
|
2801
2801
|
class: n,
|
|
2802
2802
|
onMousedown: $,
|
|
2803
2803
|
onClick: t
|
|
2804
|
-
}, r ? [Q(r, e),
|
|
2804
|
+
}, r ? [Q(r, e), G("span", null, e)] : e), s = n.value === "input" || n.value === "result" || n.value === "error" ? G("div", {
|
|
2805
2805
|
class: "markweave-ask-ai-composer",
|
|
2806
2806
|
"data-variant": n.value === "result" ? "follow-up" : "prompt"
|
|
2807
|
-
}, [
|
|
2807
|
+
}, [G("textarea", {
|
|
2808
2808
|
ref: u,
|
|
2809
2809
|
class: "markweave-ask-ai-input",
|
|
2810
2810
|
rows: 2,
|
|
@@ -2815,19 +2815,19 @@ var $i = X({
|
|
|
2815
2815
|
r.value = e.target.value;
|
|
2816
2816
|
},
|
|
2817
2817
|
onKeydown: (e) => {
|
|
2818
|
-
e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(),
|
|
2818
|
+
e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), M());
|
|
2819
2819
|
}
|
|
2820
|
-
}),
|
|
2820
|
+
}), G("button", {
|
|
2821
2821
|
type: "button",
|
|
2822
2822
|
class: "markweave-ask-ai-send",
|
|
2823
2823
|
"aria-label": e.messages.askAi.send,
|
|
2824
2824
|
disabled: !r.value.trim(),
|
|
2825
2825
|
onMousedown: $,
|
|
2826
2826
|
onClick: () => {
|
|
2827
|
-
|
|
2827
|
+
M();
|
|
2828
2828
|
}
|
|
2829
|
-
}, [Q(
|
|
2830
|
-
return
|
|
2829
|
+
}, [Q(vr, e.messages.askAi.send)])]) : null;
|
|
2830
|
+
return G("section", {
|
|
2831
2831
|
ref: y,
|
|
2832
2832
|
class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
|
|
2833
2833
|
"aria-label": e.messages.askAi.ariaLabel,
|
|
@@ -2835,65 +2835,65 @@ var $i = X({
|
|
|
2835
2835
|
"data-testid": "markweave-ask-ai-popover"
|
|
2836
2836
|
}, [
|
|
2837
2837
|
s,
|
|
2838
|
-
n.value === "generating" ?
|
|
2838
|
+
n.value === "generating" ? G("div", {
|
|
2839
2839
|
class: "markweave-ask-ai-progress markweave-ask-ai-generating",
|
|
2840
2840
|
role: "status"
|
|
2841
2841
|
}, [
|
|
2842
|
-
|
|
2842
|
+
G("span", {
|
|
2843
2843
|
class: "markweave-ask-ai-sparkles",
|
|
2844
2844
|
"aria-hidden": "true"
|
|
2845
|
-
}, [Q(
|
|
2846
|
-
|
|
2847
|
-
|
|
2845
|
+
}, [Q(ui, "")]),
|
|
2846
|
+
G("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
|
|
2847
|
+
G("button", {
|
|
2848
2848
|
type: "button",
|
|
2849
2849
|
class: "markweave-ask-ai-stop",
|
|
2850
2850
|
"aria-label": e.messages.askAi.stop,
|
|
2851
2851
|
onMousedown: $,
|
|
2852
2852
|
onClick: () => {
|
|
2853
|
-
c.value?.abort(), k.cancel(),
|
|
2853
|
+
c.value?.abort(), k.cancel(), Ee(e.editor), n.value = "input";
|
|
2854
2854
|
}
|
|
2855
|
-
}, [Q(
|
|
2855
|
+
}, [Q(di, e.messages.askAi.stop)])
|
|
2856
2856
|
]) : null,
|
|
2857
|
-
n.value === "result" ?
|
|
2857
|
+
n.value === "result" ? G("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
2858
2858
|
t(e.messages.askAi.retry, () => {
|
|
2859
|
-
|
|
2860
|
-
}, "markweave-ask-ai-retry",
|
|
2861
|
-
|
|
2862
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
2863
|
-
t(e.messages.askAi.accept,
|
|
2859
|
+
M(i.value);
|
|
2860
|
+
}, "markweave-ask-ai-retry", si),
|
|
2861
|
+
G("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
2862
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Ti),
|
|
2863
|
+
t(e.messages.askAi.accept, ee, "markweave-ask-ai-accept", Dr)
|
|
2864
2864
|
]) : null,
|
|
2865
|
-
n.value === "error" || n.value === "conflict" ?
|
|
2865
|
+
n.value === "error" || n.value === "conflict" ? G("div", {
|
|
2866
2866
|
class: "markweave-ask-ai-error",
|
|
2867
2867
|
role: "alert"
|
|
2868
|
-
}, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback,
|
|
2868
|
+
}, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, G("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
2869
2869
|
n.value === "error" ? t(e.messages.askAi.retry, () => {
|
|
2870
|
-
|
|
2871
|
-
}, "markweave-ask-ai-retry",
|
|
2872
|
-
|
|
2873
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
2870
|
+
M(i.value);
|
|
2871
|
+
}, "markweave-ask-ai-retry", si) : null,
|
|
2872
|
+
G("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
2873
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Ti)
|
|
2874
2874
|
])]) : null
|
|
2875
2875
|
]);
|
|
2876
2876
|
}
|
|
2877
|
-
return t.value === "block-type" ?
|
|
2877
|
+
return t.value === "block-type" ? G("div", {
|
|
2878
2878
|
ref: y,
|
|
2879
2879
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
|
|
2880
2880
|
"data-testid": "markweave-floating-toolbar-turn-menu"
|
|
2881
|
-
}, [
|
|
2881
|
+
}, [G("div", { class: "markweave-floating-toolbar-menu-title" }, x.value.turnIntoTitle), ...S.value.map(([n, r, i]) => G("button", {
|
|
2882
2882
|
key: n,
|
|
2883
2883
|
type: "button",
|
|
2884
2884
|
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
2885
2885
|
onMousedown: $,
|
|
2886
2886
|
onClick: () => {
|
|
2887
|
-
|
|
2887
|
+
de(e.editor, n), t.value = null;
|
|
2888
2888
|
}
|
|
2889
|
-
}, [
|
|
2889
|
+
}, [G("span", { class: "markweave-floating-toolbar-menu-icon" }, [Q(i, r)]), G("span", null, r)]))]) : t.value === "link" ? G("form", {
|
|
2890
2890
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
2891
2891
|
ref: y,
|
|
2892
2892
|
"data-testid": "markweave-floating-toolbar-link-popover",
|
|
2893
2893
|
onSubmit: (e) => {
|
|
2894
2894
|
e.preventDefault(), E();
|
|
2895
2895
|
}
|
|
2896
|
-
}, [
|
|
2896
|
+
}, [G("input", {
|
|
2897
2897
|
value: p.value,
|
|
2898
2898
|
placeholder: x.value.linkPlaceholder,
|
|
2899
2899
|
"aria-label": x.value.linkUrlLabel,
|
|
@@ -2901,45 +2901,45 @@ var $i = X({
|
|
|
2901
2901
|
onInput: (e) => {
|
|
2902
2902
|
p.value = e.target.value;
|
|
2903
2903
|
}
|
|
2904
|
-
}),
|
|
2905
|
-
|
|
2904
|
+
}), G("span", { class: "markweave-floating-toolbar-link-actions" }, [
|
|
2905
|
+
G("button", {
|
|
2906
2906
|
type: "submit",
|
|
2907
2907
|
disabled: !b.value,
|
|
2908
2908
|
"aria-label": x.value.applyLink,
|
|
2909
2909
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2910
2910
|
onMousedown: $
|
|
2911
|
-
}, [Q(
|
|
2912
|
-
|
|
2911
|
+
}, [Q(Pr, x.value.applyLink)]),
|
|
2912
|
+
G("span", {
|
|
2913
2913
|
class: "markweave-floating-toolbar-link-divider",
|
|
2914
2914
|
"aria-hidden": "true"
|
|
2915
2915
|
}),
|
|
2916
|
-
|
|
2916
|
+
G("button", {
|
|
2917
2917
|
type: "button",
|
|
2918
2918
|
disabled: !b.value,
|
|
2919
2919
|
"aria-label": x.value.openLink,
|
|
2920
2920
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2921
2921
|
onMousedown: $,
|
|
2922
|
-
onClick: () =>
|
|
2923
|
-
}, [Q(
|
|
2924
|
-
|
|
2922
|
+
onClick: () => Ji(p.value)
|
|
2923
|
+
}, [Q(Rr, x.value.openLink)]),
|
|
2924
|
+
G("button", {
|
|
2925
2925
|
type: "button",
|
|
2926
2926
|
"aria-label": x.value.removeLink,
|
|
2927
2927
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2928
2928
|
onMousedown: $,
|
|
2929
2929
|
onClick: D
|
|
2930
|
-
}, [Q(
|
|
2931
|
-
])]) : t.value === "color" ?
|
|
2930
|
+
}, [Q(bi, x.value.removeLink)])
|
|
2931
|
+
])]) : t.value === "color" ? G("div", {
|
|
2932
2932
|
ref: y,
|
|
2933
2933
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
2934
2934
|
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
2935
|
-
}, [
|
|
2935
|
+
}, [U(x.value.textColorTitle, "text", C.value), U(x.value.highlightColorTitle, "highlight", w.value)]) : t.value === "more" ? G("div", {
|
|
2936
2936
|
ref: y,
|
|
2937
2937
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
2938
2938
|
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
2939
|
-
}, T.value.map((n) =>
|
|
2939
|
+
}, T.value.map((n) => G("span", {
|
|
2940
2940
|
key: n,
|
|
2941
2941
|
class: "markweave-floating-toolbar-more-item"
|
|
2942
|
-
}, [
|
|
2942
|
+
}, [G("button", {
|
|
2943
2943
|
type: "button",
|
|
2944
2944
|
"aria-label": x.value.moreActions[n],
|
|
2945
2945
|
"data-testid": `markweave-floating-toolbar-more-${n}`,
|
|
@@ -2952,61 +2952,61 @@ var $i = X({
|
|
|
2952
2952
|
m.value = null;
|
|
2953
2953
|
},
|
|
2954
2954
|
onClick: () => {
|
|
2955
|
-
|
|
2955
|
+
ue(e.editor, n), t.value = null;
|
|
2956
2956
|
}
|
|
2957
|
-
}, [Q(
|
|
2957
|
+
}, [Q(Yi[n], x.value.moreActions[n])]), m.value === n ? G("div", {
|
|
2958
2958
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2959
2959
|
role: "tooltip"
|
|
2960
2960
|
}, x.value.moreActions[n]) : null]))) : null;
|
|
2961
2961
|
};
|
|
2962
|
-
return () =>
|
|
2962
|
+
return () => G(z, {
|
|
2963
2963
|
editor: e.editor,
|
|
2964
2964
|
shouldShow: ({ editor: e }) => {
|
|
2965
|
-
let t =
|
|
2966
|
-
return
|
|
2965
|
+
let t = je(e);
|
|
2966
|
+
return ve(ge(e), {
|
|
2967
2967
|
editable: e.isEditable,
|
|
2968
|
-
hasAskAiPreview:
|
|
2968
|
+
hasAskAiPreview: Ne(e.state),
|
|
2969
2969
|
hasActiveAskAiTableTarget: t?.target.kind === "table" && t.status === "target"
|
|
2970
2970
|
});
|
|
2971
2971
|
},
|
|
2972
2972
|
getReferencedVirtualElement: () => {
|
|
2973
|
-
let t =
|
|
2973
|
+
let t = je(e.editor)?.target.kind === "table" ? Me(e.editor) : null;
|
|
2974
2974
|
return t ? {
|
|
2975
2975
|
getBoundingClientRect: () => new DOMRect(t.left, t.top, t.width, t.height),
|
|
2976
2976
|
getClientRects: () => [new DOMRect(t.left, t.top, t.width, t.height)]
|
|
2977
2977
|
} : null;
|
|
2978
2978
|
},
|
|
2979
2979
|
options: { placement: "top" }
|
|
2980
|
-
}, { default: () =>
|
|
2980
|
+
}, { default: () => G("div", {
|
|
2981
2981
|
ref: _,
|
|
2982
2982
|
class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
|
|
2983
2983
|
"data-popover-placement": t.value ? g.value : void 0,
|
|
2984
2984
|
"data-ask-ai-session": t.value === "ask-ai" ? "open" : "closed",
|
|
2985
2985
|
"data-testid": "markweave-floating-toolbar"
|
|
2986
|
-
}, [
|
|
2986
|
+
}, [G("div", {
|
|
2987
2987
|
ref: v,
|
|
2988
2988
|
class: "markweave-floating-toolbar-content",
|
|
2989
2989
|
"data-menu": t.value ?? "none"
|
|
2990
2990
|
}, [
|
|
2991
|
-
f.value &&
|
|
2992
|
-
f.value &&
|
|
2993
|
-
B("block-type", x.value.buttons["block-type"],
|
|
2991
|
+
f.value && Pe(e.editor) ? B("ask-ai", x.value.buttons["ask-ai"], ui, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
|
|
2992
|
+
f.value && Pe(e.editor) ? V() : null,
|
|
2993
|
+
B("block-type", x.value.buttons["block-type"], xi, () => O("block-type"), t.value === "block-type"),
|
|
2994
2994
|
V(),
|
|
2995
|
-
B("bold", x.value.buttons.bold,
|
|
2996
|
-
B("italic", x.value.buttons.italic,
|
|
2997
|
-
B("underline", x.value.buttons.underline,
|
|
2998
|
-
B("strike", x.value.buttons.strike,
|
|
2999
|
-
B("inline-code", x.value.buttons["inline-code"],
|
|
2995
|
+
B("bold", x.value.buttons.bold, wr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2996
|
+
B("italic", x.value.buttons.italic, qr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2997
|
+
B("underline", x.value.buttons.underline, Si, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2998
|
+
B("strike", x.value.buttons.strike, pi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2999
|
+
B("inline-code", x.value.buttons["inline-code"], Nr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
3000
3000
|
V(),
|
|
3001
|
-
B("link", x.value.buttons.link,
|
|
3002
|
-
B("color", x.value.buttons.color,
|
|
3001
|
+
B("link", x.value.buttons.link, Yr, () => O("link"), e.editor.isActive("link")),
|
|
3002
|
+
B("color", x.value.buttons.color, xi, () => O("color"), t.value === "color"),
|
|
3003
3003
|
V(),
|
|
3004
|
-
B("more", x.value.buttons.more,
|
|
3005
|
-
|
|
3006
|
-
|
|
3004
|
+
B("more", x.value.buttons.more, ei, () => O("more"), t.value === "more"),
|
|
3005
|
+
ne(),
|
|
3006
|
+
te()
|
|
3007
3007
|
])]) });
|
|
3008
3008
|
}
|
|
3009
|
-
}),
|
|
3009
|
+
}), ta = X({
|
|
3010
3010
|
name: "MarkweaveVueMathEditorPopover",
|
|
3011
3011
|
props: {
|
|
3012
3012
|
editor: {
|
|
@@ -3027,17 +3027,17 @@ var $i = X({
|
|
|
3027
3027
|
}
|
|
3028
3028
|
},
|
|
3029
3029
|
setup(e) {
|
|
3030
|
-
let t =
|
|
3030
|
+
let t = K(e.target.latex), n = tr(null), r = K(null), i = K(null), a = tr(Ft(e.editor, e.target)), o = q(() => t.value === e.target.latex && a.value ? {
|
|
3031
3031
|
html: a.value,
|
|
3032
3032
|
error: !1
|
|
3033
|
-
} :
|
|
3033
|
+
} : zt(t.value, e.target.kind, e.editor)), s = q(() => t.value.trim().length > 0), c = q(() => e.messages.math), l = q(() => Pt(e.editor, e.target) ?? 1), u = () => {
|
|
3034
3034
|
if (typeof window > "u") return;
|
|
3035
|
-
let r =
|
|
3035
|
+
let r = Nt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3036
3036
|
if (!r || !i) {
|
|
3037
3037
|
e.onClose();
|
|
3038
3038
|
return;
|
|
3039
3039
|
}
|
|
3040
|
-
n.value =
|
|
3040
|
+
n.value = Mt({
|
|
3041
3041
|
anchorRect: r,
|
|
3042
3042
|
frameRect: i,
|
|
3043
3043
|
kind: e.target.kind,
|
|
@@ -3046,7 +3046,7 @@ var $i = X({
|
|
|
3046
3046
|
viewportWidth: window.innerWidth
|
|
3047
3047
|
});
|
|
3048
3048
|
}, d = () => {
|
|
3049
|
-
s.value &&
|
|
3049
|
+
s.value && jt(e.editor, e.target, t.value) && e.onClose();
|
|
3050
3050
|
}, f = (t) => {
|
|
3051
3051
|
if (t.key === "Escape") {
|
|
3052
3052
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -3057,14 +3057,14 @@ var $i = X({
|
|
|
3057
3057
|
let n = t.target;
|
|
3058
3058
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
3059
3059
|
};
|
|
3060
|
-
return
|
|
3061
|
-
t.value = e.target.latex, a.value =
|
|
3060
|
+
return J(() => [e.target.pos, e.target.latex], () => {
|
|
3061
|
+
t.value = e.target.latex, a.value = Ft(e.editor, e.target), Y(u);
|
|
3062
3062
|
}), nr(() => {
|
|
3063
|
-
|
|
3063
|
+
Bt(e.editor, e.target, !0), u(), Y(() => {
|
|
3064
3064
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
3065
3065
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
3066
|
-
}),
|
|
3067
|
-
|
|
3066
|
+
}), rr(() => {
|
|
3067
|
+
Bt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
3068
3068
|
}), () => {
|
|
3069
3069
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
3070
3070
|
ref: i,
|
|
@@ -3077,7 +3077,7 @@ var $i = X({
|
|
|
3077
3077
|
},
|
|
3078
3078
|
onKeydown: f
|
|
3079
3079
|
};
|
|
3080
|
-
return e.target.kind === "inline" ?
|
|
3080
|
+
return e.target.kind === "inline" ? G("form", {
|
|
3081
3081
|
ref: r,
|
|
3082
3082
|
class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
|
|
3083
3083
|
"aria-label": a,
|
|
@@ -3092,22 +3092,22 @@ var $i = X({
|
|
|
3092
3092
|
onSubmit: (e) => {
|
|
3093
3093
|
e.preventDefault(), d();
|
|
3094
3094
|
}
|
|
3095
|
-
}, [
|
|
3095
|
+
}, [G("label", {
|
|
3096
3096
|
class: "markweave-math-inline-source",
|
|
3097
3097
|
"data-testid": "markweave-math-inline-source"
|
|
3098
3098
|
}, [
|
|
3099
|
-
|
|
3100
|
-
|
|
3099
|
+
G("span", { attrs: { "aria-hidden": "true" } }, "$"),
|
|
3100
|
+
G("input", {
|
|
3101
3101
|
...u,
|
|
3102
3102
|
"aria-label": c.value.latexLabel,
|
|
3103
3103
|
size: Math.max(t.value.length, 1)
|
|
3104
3104
|
}),
|
|
3105
|
-
|
|
3106
|
-
]),
|
|
3105
|
+
G("span", { attrs: { "aria-hidden": "true" } }, "$")
|
|
3106
|
+
]), G("div", {
|
|
3107
3107
|
class: "markweave-math-inline-preview",
|
|
3108
3108
|
"data-error": o.value.error ? "true" : "false",
|
|
3109
3109
|
"data-testid": "markweave-math-editor-preview"
|
|
3110
|
-
}, [
|
|
3110
|
+
}, [G("div", { innerHTML: o.value.html || " " }), o.value.error ? G("small", null, c.value.invalidPreview) : null])]) : G("form", {
|
|
3111
3111
|
ref: r,
|
|
3112
3112
|
class: "markweave-math-editor-popover markweave-math-editor-popover--block",
|
|
3113
3113
|
"aria-label": a,
|
|
@@ -3123,39 +3123,39 @@ var $i = X({
|
|
|
3123
3123
|
e.preventDefault(), d();
|
|
3124
3124
|
}
|
|
3125
3125
|
}, [
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
Q(
|
|
3129
|
-
|
|
3126
|
+
G("div", { class: "markweave-math-block-toolbar" }, [
|
|
3127
|
+
G("span", null, c.value.label),
|
|
3128
|
+
Q(Nr, c.value.label, 15, 1.75),
|
|
3129
|
+
G("button", {
|
|
3130
3130
|
type: "submit",
|
|
3131
3131
|
title: c.value.apply,
|
|
3132
3132
|
"aria-label": c.value.apply,
|
|
3133
3133
|
disabled: !s.value,
|
|
3134
3134
|
"data-testid": "markweave-math-editor-apply"
|
|
3135
|
-
}, [Q(
|
|
3135
|
+
}, [Q(Or, c.value.apply, 16, 2)])
|
|
3136
3136
|
]),
|
|
3137
|
-
|
|
3137
|
+
G("label", {
|
|
3138
3138
|
class: "markweave-math-block-source",
|
|
3139
3139
|
"data-testid": "markweave-math-block-source"
|
|
3140
3140
|
}, [
|
|
3141
|
-
|
|
3142
|
-
|
|
3141
|
+
G("span", { attrs: { "aria-hidden": "true" } }, "$$"),
|
|
3142
|
+
G("textarea", {
|
|
3143
3143
|
...u,
|
|
3144
3144
|
"aria-label": c.value.latexLabel,
|
|
3145
3145
|
rows: 3
|
|
3146
3146
|
}),
|
|
3147
|
-
|
|
3147
|
+
G("span", { attrs: { "aria-hidden": "true" } }, "$$")
|
|
3148
3148
|
]),
|
|
3149
|
-
|
|
3149
|
+
G("div", {
|
|
3150
3150
|
class: "markweave-math-block-preview",
|
|
3151
3151
|
"data-error": o.value.error ? "true" : "false",
|
|
3152
3152
|
"data-math-number": String(l.value),
|
|
3153
3153
|
"data-testid": "markweave-math-editor-preview"
|
|
3154
|
-
}, [
|
|
3154
|
+
}, [G("div", { innerHTML: o.value.html || " " }), o.value.error ? G("small", null, c.value.invalidPreview) : null])
|
|
3155
3155
|
]);
|
|
3156
3156
|
};
|
|
3157
3157
|
}
|
|
3158
|
-
}),
|
|
3158
|
+
}), na = X({
|
|
3159
3159
|
name: "MarkweaveVueSlashCommandMenu",
|
|
3160
3160
|
props: {
|
|
3161
3161
|
commands: {
|
|
@@ -3192,7 +3192,7 @@ var $i = X({
|
|
|
3192
3192
|
}
|
|
3193
3193
|
},
|
|
3194
3194
|
setup(e) {
|
|
3195
|
-
let t =
|
|
3195
|
+
let t = K(""), n = K(null), r = K(null), i = K(!1), a = K(""), o = K(0), s = q(() => {
|
|
3196
3196
|
let t = a.value.trim().toLowerCase();
|
|
3197
3197
|
return (t ? e.messages.slash.emojiItems.filter((e) => [
|
|
3198
3198
|
e.emoji,
|
|
@@ -3214,13 +3214,13 @@ var $i = X({
|
|
|
3214
3214
|
} : {
|
|
3215
3215
|
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
3216
3216
|
trigger: "slash-command",
|
|
3217
|
-
source:
|
|
3217
|
+
source: I(t.value)
|
|
3218
3218
|
};
|
|
3219
3219
|
if (!n.value && !t.value.trim()) {
|
|
3220
3220
|
r.value = e.messages.slash.uploadRequiredError;
|
|
3221
3221
|
return;
|
|
3222
3222
|
}
|
|
3223
|
-
let a = await
|
|
3223
|
+
let a = await R(i, e.onUpload);
|
|
3224
3224
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
3225
3225
|
} catch (t) {
|
|
3226
3226
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -3247,32 +3247,32 @@ var $i = X({
|
|
|
3247
3247
|
group: t,
|
|
3248
3248
|
commands: e.commands.filter((e) => e.group === t)
|
|
3249
3249
|
})).filter((e) => e.commands.length);
|
|
3250
|
-
return
|
|
3250
|
+
return G("div", {
|
|
3251
3251
|
class: "markweave-slash-layer",
|
|
3252
3252
|
style: { display: "contents" },
|
|
3253
3253
|
"data-testid": "markweave-slash-layer"
|
|
3254
|
-
}, [
|
|
3254
|
+
}, [G("div", {
|
|
3255
3255
|
class: "markweave-slash-trigger",
|
|
3256
3256
|
style: d,
|
|
3257
3257
|
"aria-hidden": "true",
|
|
3258
3258
|
"data-testid": "markweave-slash-trigger"
|
|
3259
|
-
}, [
|
|
3259
|
+
}, [G("span", null, "/"), G("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), G("div", {
|
|
3260
3260
|
class: "markweave-slash-menu",
|
|
3261
3261
|
style: u,
|
|
3262
3262
|
role: "listbox",
|
|
3263
3263
|
"aria-label": e.messages.slash.ariaLabel,
|
|
3264
3264
|
"data-placement": e.position.placement,
|
|
3265
3265
|
"data-testid": "markweave-slash-menu"
|
|
3266
|
-
}, [e.inputCommand?.inputKind === "emoji" ?
|
|
3266
|
+
}, [e.inputCommand?.inputKind === "emoji" ? G("div", {
|
|
3267
3267
|
class: "markweave-slash-subpanel",
|
|
3268
3268
|
"data-testid": "markweave-slash-emoji-picker"
|
|
3269
3269
|
}, [
|
|
3270
|
-
|
|
3270
|
+
G("div", { class: "markweave-slash-subpanel-header" }, [G("button", {
|
|
3271
3271
|
type: "button",
|
|
3272
3272
|
onMousedown: $,
|
|
3273
3273
|
onClick: () => e.onInputCommandChange(null)
|
|
3274
|
-
}, e.messages.common.back),
|
|
3275
|
-
|
|
3274
|
+
}, e.messages.common.back), G("span", null, e.messages.slash.emojiTitle)]),
|
|
3275
|
+
G("label", { class: "markweave-slash-input" }, [G("span", null, "/"), G("input", {
|
|
3276
3276
|
autofocus: !0,
|
|
3277
3277
|
value: a.value,
|
|
3278
3278
|
placeholder: e.messages.slash.emojiSearchPlaceholder,
|
|
@@ -3283,11 +3283,11 @@ var $i = X({
|
|
|
3283
3283
|
t.key === "Escape" ? (t.preventDefault(), e.onInputCommandChange(null)) : t.key === "ArrowDown" ? (t.preventDefault(), o.value = s.value.length ? (o.value + 1) % s.value.length : 0) : t.key === "ArrowUp" ? (t.preventDefault(), o.value = s.value.length ? (o.value - 1 + s.value.length) % s.value.length : 0) : (t.key === "Enter" || t.key === "Tab") && (t.preventDefault(), l(o.value));
|
|
3284
3284
|
}
|
|
3285
3285
|
})]),
|
|
3286
|
-
|
|
3286
|
+
G("div", {
|
|
3287
3287
|
class: "markweave-slash-emoji-grid",
|
|
3288
3288
|
role: "listbox",
|
|
3289
3289
|
"aria-label": e.messages.slash.emojiTitle
|
|
3290
|
-
}, s.value.map((e, t) =>
|
|
3290
|
+
}, s.value.map((e, t) => G("button", {
|
|
3291
3291
|
key: `${e.emoji}-${e.label}`,
|
|
3292
3292
|
type: "button",
|
|
3293
3293
|
role: "option",
|
|
@@ -3296,17 +3296,17 @@ var $i = X({
|
|
|
3296
3296
|
onMouseenter: () => o.value = t,
|
|
3297
3297
|
onMousedown: $,
|
|
3298
3298
|
onClick: () => l(t)
|
|
3299
|
-
}, [
|
|
3300
|
-
]) : e.inputCommand?.inputKind === "upload" ?
|
|
3299
|
+
}, [G("span", null, e.emoji), G("small", null, e.label)])))
|
|
3300
|
+
]) : e.inputCommand?.inputKind === "upload" ? G("div", {
|
|
3301
3301
|
class: "markweave-slash-subpanel",
|
|
3302
3302
|
"data-testid": "markweave-slash-upload-panel"
|
|
3303
3303
|
}, [
|
|
3304
|
-
|
|
3304
|
+
G("div", { class: "markweave-slash-upload-header" }, [G("button", {
|
|
3305
3305
|
type: "button",
|
|
3306
3306
|
onMousedown: $,
|
|
3307
3307
|
onClick: () => e.onInputCommandChange(null)
|
|
3308
|
-
}, e.messages.common.back),
|
|
3309
|
-
|
|
3308
|
+
}, e.messages.common.back), G("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
|
|
3309
|
+
G("label", { class: "markweave-slash-upload-field" }, [G("span", null, e.messages.slash.uploadValueLabel), G("input", {
|
|
3310
3310
|
autofocus: !0,
|
|
3311
3311
|
value: t.value,
|
|
3312
3312
|
placeholder: e.messages.slash.uploadValuePlaceholder,
|
|
@@ -3317,32 +3317,32 @@ var $i = X({
|
|
|
3317
3317
|
e.key === "Enter" && (e.preventDefault(), c());
|
|
3318
3318
|
}
|
|
3319
3319
|
})]),
|
|
3320
|
-
|
|
3320
|
+
G("label", { class: "markweave-slash-upload-field" }, [G("span", null, e.messages.common.file), G("input", {
|
|
3321
3321
|
type: "file",
|
|
3322
3322
|
onChange: (e) => n.value = e.target.files?.[0] ?? null
|
|
3323
3323
|
})]),
|
|
3324
|
-
r.value ?
|
|
3324
|
+
r.value ? G("div", {
|
|
3325
3325
|
class: "markweave-slash-upload-error",
|
|
3326
3326
|
role: "alert"
|
|
3327
3327
|
}, r.value) : null,
|
|
3328
|
-
|
|
3328
|
+
G("div", { class: "markweave-slash-upload-actions" }, [G("button", {
|
|
3329
3329
|
type: "button",
|
|
3330
3330
|
onMousedown: $,
|
|
3331
3331
|
onClick: () => e.onInputCommandChange(null)
|
|
3332
|
-
}, e.messages.common.cancel),
|
|
3332
|
+
}, e.messages.common.cancel), G("button", {
|
|
3333
3333
|
type: "button",
|
|
3334
3334
|
"data-primary": "true",
|
|
3335
3335
|
disabled: i.value,
|
|
3336
3336
|
onMousedown: $,
|
|
3337
3337
|
onClick: c
|
|
3338
3338
|
}, e.messages.common.insert)])
|
|
3339
|
-
]) : e.commands.length ?
|
|
3339
|
+
]) : e.commands.length ? G("div", { class: "markweave-slash-command-list" }, f.map((t) => G("section", {
|
|
3340
3340
|
key: t.group,
|
|
3341
3341
|
class: "markweave-slash-group",
|
|
3342
3342
|
"aria-label": t.group
|
|
3343
|
-
}, [
|
|
3344
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
3345
|
-
return
|
|
3343
|
+
}, [G("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
3344
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = Yt(t);
|
|
3345
|
+
return G("button", {
|
|
3346
3346
|
key: t.id,
|
|
3347
3347
|
type: "button",
|
|
3348
3348
|
role: "option",
|
|
@@ -3364,45 +3364,45 @@ var $i = X({
|
|
|
3364
3364
|
}
|
|
3365
3365
|
}
|
|
3366
3366
|
}, [
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
t.disabledReason ?
|
|
3367
|
+
Zi(t.icon),
|
|
3368
|
+
G("span", null, t.label),
|
|
3369
|
+
t.disabledReason ? G("small", null, t.disabledReason) : null
|
|
3370
3370
|
]);
|
|
3371
|
-
})]))) :
|
|
3371
|
+
})]))) : G("div", {
|
|
3372
3372
|
class: "markweave-slash-menu__empty",
|
|
3373
3373
|
role: "option",
|
|
3374
3374
|
"aria-disabled": "true"
|
|
3375
3375
|
}, e.messages.slash.noResults)])]);
|
|
3376
3376
|
};
|
|
3377
3377
|
}
|
|
3378
|
-
}),
|
|
3379
|
-
"ask-ai":
|
|
3380
|
-
"move-left":
|
|
3381
|
-
"move-right":
|
|
3382
|
-
"move-up":
|
|
3383
|
-
"move-down":
|
|
3384
|
-
"insert-left":
|
|
3385
|
-
"insert-right":
|
|
3386
|
-
"insert-above":
|
|
3387
|
-
"insert-below":
|
|
3388
|
-
"sort-asc":
|
|
3389
|
-
"sort-desc":
|
|
3390
|
-
color:
|
|
3391
|
-
alignment:
|
|
3392
|
-
clear:
|
|
3393
|
-
duplicate:
|
|
3394
|
-
copy:
|
|
3395
|
-
merge:
|
|
3396
|
-
split:
|
|
3397
|
-
delete:
|
|
3398
|
-
},
|
|
3399
|
-
left:
|
|
3400
|
-
center:
|
|
3401
|
-
right:
|
|
3402
|
-
top:
|
|
3403
|
-
middle:
|
|
3404
|
-
bottom:
|
|
3405
|
-
},
|
|
3378
|
+
}), ra = {
|
|
3379
|
+
"ask-ai": ui,
|
|
3380
|
+
"move-left": gr,
|
|
3381
|
+
"move-right": _r,
|
|
3382
|
+
"move-up": vr,
|
|
3383
|
+
"move-down": mr,
|
|
3384
|
+
"insert-left": Cr,
|
|
3385
|
+
"insert-right": Sr,
|
|
3386
|
+
"insert-above": xr,
|
|
3387
|
+
"insert-below": br,
|
|
3388
|
+
"sort-asc": hr,
|
|
3389
|
+
"sort-desc": yr,
|
|
3390
|
+
color: ti,
|
|
3391
|
+
alignment: cr,
|
|
3392
|
+
clear: fi,
|
|
3393
|
+
duplicate: Fr,
|
|
3394
|
+
copy: Fr,
|
|
3395
|
+
merge: _i,
|
|
3396
|
+
split: vi,
|
|
3397
|
+
delete: bi
|
|
3398
|
+
}, ia = {
|
|
3399
|
+
left: cr,
|
|
3400
|
+
center: or,
|
|
3401
|
+
right: lr,
|
|
3402
|
+
top: fr,
|
|
3403
|
+
middle: ur,
|
|
3404
|
+
bottom: dr
|
|
3405
|
+
}, aa = X({
|
|
3406
3406
|
name: "MarkweaveVueTableControls",
|
|
3407
3407
|
props: {
|
|
3408
3408
|
editor: {
|
|
@@ -3439,13 +3439,13 @@ var $i = X({
|
|
|
3439
3439
|
}
|
|
3440
3440
|
},
|
|
3441
3441
|
setup(e) {
|
|
3442
|
-
let t =
|
|
3442
|
+
let t = K(null), n = K(null), r = K("row-edge"), i = K(null), a = K(null), o = K(null), s = K(null), c = K(null), l = K(null), u = K(null), d = K(null), f = K(0), p = K(null), m = K(null), h = K(null), g = K(null), _ = K(null), v = K(null), y = K(null), b = null, x = null, S = null, C = q(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = q(() => e.active ? ln(e.editor.state) : Hi), T = q(() => On(e.editor, e.interactionState, "row", w.value.activeCellPos)), E = q(() => On(e.editor, e.interactionState, "column", w.value.activeCellPos)), D = q(() => wn(e.editor)), O = q(() => (D.value, w.value.active && Mn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), k = q(() => t.value ? Mn(e.editor, t.value, { askAiEnabled: C.value }) : []), A = () => {
|
|
3443
3443
|
b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
|
|
3444
3444
|
}, j = (e) => {
|
|
3445
3445
|
A(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
|
|
3446
3446
|
d.value = null, b = null;
|
|
3447
|
-
},
|
|
3448
|
-
},
|
|
3447
|
+
}, Rn));
|
|
3448
|
+
}, M = () => {
|
|
3449
3449
|
if (!e.active) {
|
|
3450
3450
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, j(null);
|
|
3451
3451
|
return;
|
|
@@ -3455,31 +3455,31 @@ var $i = X({
|
|
|
3455
3455
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
|
|
3456
3456
|
return;
|
|
3457
3457
|
}
|
|
3458
|
-
let l = n.getBoundingClientRect(), u = T.value ?
|
|
3459
|
-
u ? i.value =
|
|
3458
|
+
let l = n.getBoundingClientRect(), u = T.value ? Dn(e.editor, T.value) : null, d = E.value ? Dn(e.editor, E.value) : null, f = O.value ? Nn(e.editor) : null, p = Cn(e.editor)?.getBoundingClientRect() ?? null;
|
|
3459
|
+
u ? i.value = vn({
|
|
3460
3460
|
targetRect: u,
|
|
3461
3461
|
frameRect: l,
|
|
3462
3462
|
kind: "row"
|
|
3463
|
-
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value =
|
|
3463
|
+
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = vn({
|
|
3464
3464
|
targetRect: d,
|
|
3465
3465
|
frameRect: l,
|
|
3466
3466
|
kind: "column"
|
|
3467
|
-
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value =
|
|
3467
|
+
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = vn({
|
|
3468
3468
|
targetRect: f,
|
|
3469
3469
|
frameRect: l,
|
|
3470
3470
|
kind: "selection"
|
|
3471
3471
|
}) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
|
|
3472
3472
|
let m = e.interactionState.hoverCellPos !== null && !!(T.value && T.value.index === T.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(E.value && E.value.index === E.value.visualWidth - 1);
|
|
3473
|
-
s.value = p && m ?
|
|
3473
|
+
s.value = p && m ? yn({
|
|
3474
3474
|
tableRect: p,
|
|
3475
3475
|
frameRect: l,
|
|
3476
3476
|
kind: "row"
|
|
3477
|
-
}) : null, c.value = p && h ?
|
|
3477
|
+
}) : null, c.value = p && h ? yn({
|
|
3478
3478
|
tableRect: p,
|
|
3479
3479
|
frameRect: l,
|
|
3480
3480
|
kind: "column"
|
|
3481
3481
|
}) : null;
|
|
3482
|
-
},
|
|
3482
|
+
}, ee = () => {
|
|
3483
3483
|
if (!e.active || !t.value) {
|
|
3484
3484
|
l.value = null;
|
|
3485
3485
|
return;
|
|
@@ -3489,23 +3489,23 @@ var $i = X({
|
|
|
3489
3489
|
l.value = null;
|
|
3490
3490
|
return;
|
|
3491
3491
|
}
|
|
3492
|
-
let a = i.getBoundingClientRect(), o = t.value === "row" ?
|
|
3492
|
+
let a = i.getBoundingClientRect(), o = t.value === "row" ? Cn(e.editor)?.getBoundingClientRect() : null, s = o ? {
|
|
3493
3493
|
left: a.left,
|
|
3494
3494
|
top: o.top,
|
|
3495
3495
|
width: a.width,
|
|
3496
3496
|
height: a.height
|
|
3497
3497
|
} : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
|
|
3498
|
-
l.value =
|
|
3498
|
+
l.value = gn({
|
|
3499
3499
|
anchorRect: s,
|
|
3500
3500
|
frameRect: c,
|
|
3501
|
-
boundaryRect:
|
|
3501
|
+
boundaryRect: kn(n),
|
|
3502
3502
|
menuSize: {
|
|
3503
3503
|
width: u.width || 254,
|
|
3504
3504
|
height: f || u.height || 410
|
|
3505
3505
|
},
|
|
3506
3506
|
kind: t.value
|
|
3507
3507
|
});
|
|
3508
|
-
},
|
|
3508
|
+
}, N = () => {
|
|
3509
3509
|
if (!e.active || !t.value || !n.value || !l.value) {
|
|
3510
3510
|
u.value = null;
|
|
3511
3511
|
return;
|
|
@@ -3516,33 +3516,33 @@ var $i = X({
|
|
|
3516
3516
|
return;
|
|
3517
3517
|
}
|
|
3518
3518
|
let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
|
|
3519
|
-
u.value =
|
|
3519
|
+
u.value = _n({
|
|
3520
3520
|
triggerRect: i.getBoundingClientRect(),
|
|
3521
3521
|
parentMenuRect: _.value.getBoundingClientRect(),
|
|
3522
|
-
boundaryRect:
|
|
3522
|
+
boundaryRect: kn(r),
|
|
3523
3523
|
submenuSize: {
|
|
3524
3524
|
width: a.width || 238,
|
|
3525
3525
|
height: o || 410
|
|
3526
3526
|
}
|
|
3527
3527
|
});
|
|
3528
|
-
}, N = () => {
|
|
3529
|
-
ee(), te(), M();
|
|
3530
3528
|
}, P = () => {
|
|
3531
|
-
|
|
3532
|
-
}, F = (
|
|
3529
|
+
M(), ee(), N();
|
|
3530
|
+
}, F = () => {
|
|
3531
|
+
Y(P);
|
|
3532
|
+
}, I = (e, i) => {
|
|
3533
3533
|
let a = t.value === e && r.value === i;
|
|
3534
|
-
r.value = i, t.value = a ? null : e, n.value = null, u.value = null,
|
|
3535
|
-
},
|
|
3536
|
-
e.editor.view.dispatch(
|
|
3537
|
-
},
|
|
3534
|
+
r.value = i, t.value = a ? null : e, n.value = null, u.value = null, F();
|
|
3535
|
+
}, L = () => {
|
|
3536
|
+
e.editor.view.dispatch(on(e.editor.state.tr, null));
|
|
3537
|
+
}, R = (t, n) => {
|
|
3538
3538
|
let r = e.interactionState.hoverCellPos ?? w.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
3539
|
-
r !== null &&
|
|
3540
|
-
},
|
|
3541
|
-
|
|
3539
|
+
r !== null && In(e.editor, r, t, { visualIndex: i }), I(t, n);
|
|
3540
|
+
}, te = () => {
|
|
3541
|
+
L(), I("selection", "selection-edge");
|
|
3542
3542
|
}, z = (r = !1) => {
|
|
3543
3543
|
t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
|
|
3544
3544
|
}, B = async (n, r) => {
|
|
3545
|
-
let i = await
|
|
3545
|
+
let i = await xn({
|
|
3546
3546
|
editor: e.editor,
|
|
3547
3547
|
commandId: n,
|
|
3548
3548
|
menu: r ?? t.value ?? "selection",
|
|
@@ -3550,27 +3550,27 @@ var $i = X({
|
|
|
3550
3550
|
});
|
|
3551
3551
|
return i.copyFeedback ? (j(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : j(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
3552
3552
|
}, V = (t) => {
|
|
3553
|
-
C.value && (
|
|
3553
|
+
C.value && (Re(e.editor, t), z(!1));
|
|
3554
3554
|
}, H = (e) => {
|
|
3555
|
-
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1,
|
|
3556
|
-
},
|
|
3555
|
+
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, F());
|
|
3556
|
+
}, U = (t) => {
|
|
3557
3557
|
let n = t === "row" ? T.value : E.value, r = e.interactionState.hoverCellPos ?? w.value.activeCellPos;
|
|
3558
|
-
!n || r === null ||
|
|
3559
|
-
},
|
|
3558
|
+
!n || r === null || Hn(e.editor, r, t, { visualIndex: n.index }) && B(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
3559
|
+
}, ne = (e, t, n) => {
|
|
3560
3560
|
x = {
|
|
3561
3561
|
axis: e,
|
|
3562
3562
|
index: t
|
|
3563
3563
|
}, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
|
|
3564
|
-
},
|
|
3564
|
+
}, re = (t) => {
|
|
3565
3565
|
if (!x) return;
|
|
3566
|
-
let n =
|
|
3566
|
+
let n = Tn(e.editor, x.axis, t.clientX, t.clientY);
|
|
3567
3567
|
n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
|
|
3568
|
-
},
|
|
3568
|
+
}, ie = (t) => {
|
|
3569
3569
|
let n = x;
|
|
3570
3570
|
if (!n) return;
|
|
3571
|
-
let r =
|
|
3572
|
-
t.preventDefault(), x = null, S = null, r !== null &&
|
|
3573
|
-
},
|
|
3571
|
+
let r = Tn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
|
|
3572
|
+
t.preventDefault(), x = null, S = null, r !== null && Fn(e.editor, n.axis, n.index, r);
|
|
3573
|
+
}, W = q(() => (f.value, t.value === "row" || t.value === "column" ? En(e.editor, t.value) : null)), ae = (e) => {
|
|
3574
3574
|
if (!(!t.value || e.key !== "Escape")) {
|
|
3575
3575
|
if (n.value) {
|
|
3576
3576
|
n.value = null;
|
|
@@ -3578,20 +3578,20 @@ var $i = X({
|
|
|
3578
3578
|
}
|
|
3579
3579
|
z(!0);
|
|
3580
3580
|
}
|
|
3581
|
-
},
|
|
3581
|
+
}, oe = (e) => {
|
|
3582
3582
|
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
3583
3583
|
let t = e.currentTarget;
|
|
3584
3584
|
if (!(t instanceof HTMLElement)) return;
|
|
3585
3585
|
let 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), a = e.key === "ArrowDown" ? 1 : -1, o = i < 0 ? 0 : Math.min(r.length - 1, Math.max(0, i + a));
|
|
3586
3586
|
e.preventDefault(), e.stopPropagation(), r[o]?.focus();
|
|
3587
|
-
},
|
|
3587
|
+
}, se = (e) => {
|
|
3588
3588
|
t.value && (e.target instanceof Node && p.value?.contains(e.target) || z());
|
|
3589
3589
|
};
|
|
3590
3590
|
nr(() => {
|
|
3591
|
-
|
|
3592
|
-
}),
|
|
3593
|
-
A(), window.removeEventListener("resize",
|
|
3594
|
-
}),
|
|
3591
|
+
P(), window.addEventListener("resize", P), window.addEventListener("scroll", P, !0), document.addEventListener("keydown", ae), document.addEventListener("mousedown", se), document.addEventListener("dragover", re), document.addEventListener("drop", ie);
|
|
3592
|
+
}), rr(() => {
|
|
3593
|
+
A(), window.removeEventListener("resize", P), window.removeEventListener("scroll", P, !0), document.removeEventListener("keydown", ae), document.removeEventListener("mousedown", se), document.removeEventListener("dragover", re), document.removeEventListener("drop", ie);
|
|
3594
|
+
}), J(() => [
|
|
3595
3595
|
e.active,
|
|
3596
3596
|
w.value.activeCellPos,
|
|
3597
3597
|
w.value.selectionFrom,
|
|
@@ -3602,12 +3602,12 @@ var $i = X({
|
|
|
3602
3602
|
t.value,
|
|
3603
3603
|
n.value,
|
|
3604
3604
|
r.value
|
|
3605
|
-
],
|
|
3606
|
-
let
|
|
3605
|
+
], F, { flush: "post" });
|
|
3606
|
+
let ce = () => {
|
|
3607
3607
|
if (!t.value) return null;
|
|
3608
3608
|
let r = k.value.map((r, i) => {
|
|
3609
|
-
let a =
|
|
3610
|
-
return
|
|
3609
|
+
let a = An(r), o = i === 0 ? a : An(k.value[i - 1]), s = i > 0 && o !== a, c = t.value === "row" || t.value === "column" ? t.value : "selection", l = r.submenuId ? !0 : r.commandId === null ? C.value && Te(e.editor, c) : bn(e.editor, r.commandId), u = jn(r, e.messages), d = ra[r.icon];
|
|
3610
|
+
return G("button", {
|
|
3611
3611
|
key: `${r.id}-${i}`,
|
|
3612
3612
|
type: "button",
|
|
3613
3613
|
role: "menuitem",
|
|
@@ -3642,26 +3642,26 @@ var $i = X({
|
|
|
3642
3642
|
}
|
|
3643
3643
|
}
|
|
3644
3644
|
}, [
|
|
3645
|
-
|
|
3645
|
+
G("span", {
|
|
3646
3646
|
class: "markweave-table-menu-item-icon",
|
|
3647
3647
|
"aria-hidden": "true"
|
|
3648
|
-
}, [
|
|
3648
|
+
}, [G(d, {
|
|
3649
3649
|
size: 18,
|
|
3650
3650
|
strokeWidth: 1.8
|
|
3651
3651
|
})]),
|
|
3652
|
-
|
|
3653
|
-
r.submenuId ?
|
|
3652
|
+
G("span", { class: "markweave-table-menu-item-label" }, u),
|
|
3653
|
+
r.submenuId ? G(Ar, {
|
|
3654
3654
|
class: "markweave-table-menu-chevron",
|
|
3655
3655
|
size: 16,
|
|
3656
3656
|
"aria-hidden": "true"
|
|
3657
3657
|
}) : null
|
|
3658
3658
|
]);
|
|
3659
|
-
}), i = [
|
|
3659
|
+
}), i = [G("div", {
|
|
3660
3660
|
ref: v,
|
|
3661
3661
|
class: "markweave-table-menu-scroll",
|
|
3662
3662
|
style: l.value ? { maxHeight: `${Math.max(1, l.value.maxHeight - 12)}px` } : void 0
|
|
3663
3663
|
}, r)];
|
|
3664
|
-
if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(
|
|
3664
|
+
if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(G("div", {
|
|
3665
3665
|
ref: y,
|
|
3666
3666
|
class: "markweave-table-submenu markweave-table-color-menu",
|
|
3667
3667
|
role: "menu",
|
|
@@ -3674,43 +3674,43 @@ var $i = X({
|
|
|
3674
3674
|
top: `${u.value.top}px`,
|
|
3675
3675
|
maxHeight: `${u.value.maxHeight}px`
|
|
3676
3676
|
} : void 0,
|
|
3677
|
-
onKeydown:
|
|
3677
|
+
onKeydown: oe
|
|
3678
3678
|
}, [
|
|
3679
|
-
|
|
3680
|
-
...
|
|
3679
|
+
G("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
|
|
3680
|
+
...Ln.map((t) => G("button", {
|
|
3681
3681
|
key: `text-${t.id}`,
|
|
3682
3682
|
type: "button",
|
|
3683
3683
|
role: "menuitemradio",
|
|
3684
|
-
"aria-checked":
|
|
3685
|
-
"data-active":
|
|
3684
|
+
"aria-checked": W.value?.textColorId === t.id,
|
|
3685
|
+
"data-active": W.value?.textColorId === t.id ? "true" : "false",
|
|
3686
3686
|
"data-testid": `markweave-table-text-color-${t.id}`,
|
|
3687
3687
|
onMousedown: $,
|
|
3688
|
-
onClick: () => H((n) =>
|
|
3689
|
-
}, [
|
|
3688
|
+
onClick: () => H((n) => hn(e.editor, n, t.id))
|
|
3689
|
+
}, [G("span", {
|
|
3690
3690
|
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3691
3691
|
"aria-hidden": "true",
|
|
3692
3692
|
style: { backgroundColor: t.textColor ?? "var(--markweave-text)" }
|
|
3693
|
-
}),
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
...
|
|
3693
|
+
}), G("span", null, e.messages.table.colors[t.id].text)])),
|
|
3694
|
+
G("div", { class: "markweave-table-submenu-separator" }),
|
|
3695
|
+
G("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
|
|
3696
|
+
...Ln.map((t) => G("button", {
|
|
3697
3697
|
key: `background-${t.id}`,
|
|
3698
3698
|
type: "button",
|
|
3699
3699
|
role: "menuitemradio",
|
|
3700
|
-
"aria-checked":
|
|
3701
|
-
"data-active":
|
|
3700
|
+
"aria-checked": W.value?.backgroundColorId === t.id,
|
|
3701
|
+
"data-active": W.value?.backgroundColorId === t.id ? "true" : "false",
|
|
3702
3702
|
"data-testid": `markweave-table-background-color-${t.id}`,
|
|
3703
3703
|
onMousedown: $,
|
|
3704
|
-
onClick: () => H((n) =>
|
|
3705
|
-
}, [
|
|
3704
|
+
onClick: () => H((n) => mn(e.editor, n, t.id))
|
|
3705
|
+
}, [G("span", {
|
|
3706
3706
|
class: "markweave-table-color-swatch",
|
|
3707
3707
|
"aria-hidden": "true",
|
|
3708
3708
|
style: { backgroundColor: t.backgroundColor }
|
|
3709
|
-
}),
|
|
3709
|
+
}), G("span", null, e.messages.table.colors[t.id].background)]))
|
|
3710
3710
|
])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
|
|
3711
3711
|
let t = (t, n) => {
|
|
3712
|
-
let r =
|
|
3713
|
-
return
|
|
3712
|
+
let r = ia[t];
|
|
3713
|
+
return G("button", {
|
|
3714
3714
|
key: t,
|
|
3715
3715
|
type: "button",
|
|
3716
3716
|
role: "menuitemradio",
|
|
@@ -3718,14 +3718,14 @@ var $i = X({
|
|
|
3718
3718
|
"data-active": n ? "true" : "false",
|
|
3719
3719
|
"data-testid": `markweave-table-alignment-${t}`,
|
|
3720
3720
|
onMousedown: $,
|
|
3721
|
-
onClick: () => H((n) =>
|
|
3722
|
-
}, [
|
|
3721
|
+
onClick: () => H((n) => pn(e.editor, n, t))
|
|
3722
|
+
}, [G(r, {
|
|
3723
3723
|
size: 18,
|
|
3724
3724
|
strokeWidth: 1.8,
|
|
3725
3725
|
"aria-hidden": "true"
|
|
3726
|
-
}),
|
|
3726
|
+
}), G("span", null, e.messages.table.alignments[t])]);
|
|
3727
3727
|
};
|
|
3728
|
-
i.push(
|
|
3728
|
+
i.push(G("div", {
|
|
3729
3729
|
ref: y,
|
|
3730
3730
|
class: "markweave-table-submenu markweave-table-alignment-menu",
|
|
3731
3731
|
role: "menu",
|
|
@@ -3738,18 +3738,18 @@ var $i = X({
|
|
|
3738
3738
|
top: `${u.value.top}px`,
|
|
3739
3739
|
maxHeight: `${u.value.maxHeight}px`
|
|
3740
3740
|
} : void 0,
|
|
3741
|
-
onKeydown:
|
|
3741
|
+
onKeydown: oe
|
|
3742
3742
|
}, [
|
|
3743
|
-
...
|
|
3744
|
-
|
|
3745
|
-
...
|
|
3743
|
+
...zn.map((e) => t(e, W.value?.textAlign === e)),
|
|
3744
|
+
G("div", { class: "markweave-table-submenu-separator" }),
|
|
3745
|
+
...Vn.map((e) => t(e, W.value?.verticalAlign === e))
|
|
3746
3746
|
]));
|
|
3747
3747
|
}
|
|
3748
|
-
return
|
|
3748
|
+
return G("div", {
|
|
3749
3749
|
ref: _,
|
|
3750
3750
|
class: "markweave-table-menu",
|
|
3751
3751
|
role: "menu",
|
|
3752
|
-
"aria-label":
|
|
3752
|
+
"aria-label": Bn(t.value, e.messages),
|
|
3753
3753
|
"data-testid": "markweave-table-menu",
|
|
3754
3754
|
"data-positioned": l.value ? "true" : "false",
|
|
3755
3755
|
"data-placement": l.value?.placement,
|
|
@@ -3758,19 +3758,19 @@ var $i = X({
|
|
|
3758
3758
|
left: `${l.value.left}px`,
|
|
3759
3759
|
top: `${l.value.top}px`
|
|
3760
3760
|
} : void 0,
|
|
3761
|
-
onKeydown:
|
|
3761
|
+
onKeydown: oe
|
|
3762
3762
|
}, i);
|
|
3763
3763
|
};
|
|
3764
|
-
return () => e.active ?
|
|
3764
|
+
return () => e.active ? G("div", {
|
|
3765
3765
|
ref: p,
|
|
3766
3766
|
class: "markweave-table-controls",
|
|
3767
3767
|
"data-testid": "markweave-table-controls",
|
|
3768
3768
|
"aria-label": e.messages.table.controlsAriaLabel,
|
|
3769
3769
|
"data-open-menu": t.value ?? "none",
|
|
3770
3770
|
"data-positioned": i.value || a.value || o.value ? "true" : "false",
|
|
3771
|
-
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(
|
|
3771
|
+
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(fn, { type: "clear-hover" }))
|
|
3772
3772
|
}, [
|
|
3773
|
-
d.value ?
|
|
3773
|
+
d.value ? G("div", {
|
|
3774
3774
|
class: "markweave-table-copy-feedback",
|
|
3775
3775
|
role: "status",
|
|
3776
3776
|
"aria-live": "polite",
|
|
@@ -3778,8 +3778,8 @@ var $i = X({
|
|
|
3778
3778
|
"data-copy-kind": d.value.kind,
|
|
3779
3779
|
"data-text-length": d.value.textLength,
|
|
3780
3780
|
"data-html-length": d.value.htmlLength
|
|
3781
|
-
},
|
|
3782
|
-
i.value ?
|
|
3781
|
+
}, Sn(d.value)) : null,
|
|
3782
|
+
i.value ? G("button", {
|
|
3783
3783
|
ref: m,
|
|
3784
3784
|
type: "button",
|
|
3785
3785
|
draggable: !0,
|
|
@@ -3800,16 +3800,16 @@ var $i = X({
|
|
|
3800
3800
|
height: `${i.value.height}px`
|
|
3801
3801
|
},
|
|
3802
3802
|
onMousedown: $,
|
|
3803
|
-
onClick: () =>
|
|
3804
|
-
onDragstart: (e) =>
|
|
3803
|
+
onClick: () => R("row", "row-edge"),
|
|
3804
|
+
onDragstart: (e) => ne("row", T.value?.index ?? 0, e),
|
|
3805
3805
|
onDragend: () => {
|
|
3806
3806
|
x = null, S = null;
|
|
3807
3807
|
}
|
|
3808
|
-
}, [
|
|
3808
|
+
}, [G(ei, {
|
|
3809
3809
|
size: 14,
|
|
3810
3810
|
"aria-hidden": "true"
|
|
3811
3811
|
})]) : null,
|
|
3812
|
-
a.value ?
|
|
3812
|
+
a.value ? G("button", {
|
|
3813
3813
|
ref: h,
|
|
3814
3814
|
type: "button",
|
|
3815
3815
|
draggable: !0,
|
|
@@ -3830,16 +3830,16 @@ var $i = X({
|
|
|
3830
3830
|
height: `${a.value.height}px`
|
|
3831
3831
|
},
|
|
3832
3832
|
onMousedown: $,
|
|
3833
|
-
onClick: () =>
|
|
3834
|
-
onDragstart: (e) =>
|
|
3833
|
+
onClick: () => R("column", "column-edge"),
|
|
3834
|
+
onDragstart: (e) => ne("column", E.value?.index ?? 0, e),
|
|
3835
3835
|
onDragend: () => {
|
|
3836
3836
|
x = null, S = null;
|
|
3837
3837
|
}
|
|
3838
|
-
}, [
|
|
3838
|
+
}, [G(ei, {
|
|
3839
3839
|
size: 14,
|
|
3840
3840
|
"aria-hidden": "true"
|
|
3841
3841
|
})]) : null,
|
|
3842
|
-
O.value && o.value ?
|
|
3842
|
+
O.value && o.value ? G("button", {
|
|
3843
3843
|
ref: g,
|
|
3844
3844
|
type: "button",
|
|
3845
3845
|
class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
@@ -3855,12 +3855,12 @@ var $i = X({
|
|
|
3855
3855
|
height: `${o.value.height}px`
|
|
3856
3856
|
},
|
|
3857
3857
|
onMousedown: $,
|
|
3858
|
-
onClick:
|
|
3859
|
-
}, [
|
|
3858
|
+
onClick: te
|
|
3859
|
+
}, [G(ei, {
|
|
3860
3860
|
size: 14,
|
|
3861
3861
|
"aria-hidden": "true"
|
|
3862
3862
|
})]) : null,
|
|
3863
|
-
s.value ?
|
|
3863
|
+
s.value ? G("button", {
|
|
3864
3864
|
type: "button",
|
|
3865
3865
|
class: "markweave-table-extend-button markweave-table-extend-button--row",
|
|
3866
3866
|
"aria-label": e.messages.table.addRow,
|
|
@@ -3873,12 +3873,12 @@ var $i = X({
|
|
|
3873
3873
|
height: `${s.value.height}px`
|
|
3874
3874
|
},
|
|
3875
3875
|
onMousedown: $,
|
|
3876
|
-
onClick: () =>
|
|
3877
|
-
}, [
|
|
3876
|
+
onClick: () => U("row")
|
|
3877
|
+
}, [G(ii, {
|
|
3878
3878
|
size: 14,
|
|
3879
3879
|
"aria-hidden": "true"
|
|
3880
3880
|
})]) : null,
|
|
3881
|
-
c.value ?
|
|
3881
|
+
c.value ? G("button", {
|
|
3882
3882
|
type: "button",
|
|
3883
3883
|
class: "markweave-table-extend-button markweave-table-extend-button--column",
|
|
3884
3884
|
"aria-label": e.messages.table.addColumn,
|
|
@@ -3891,15 +3891,15 @@ var $i = X({
|
|
|
3891
3891
|
height: `${c.value.height}px`
|
|
3892
3892
|
},
|
|
3893
3893
|
onMousedown: $,
|
|
3894
|
-
onClick: () =>
|
|
3895
|
-
}, [
|
|
3894
|
+
onClick: () => U("column")
|
|
3895
|
+
}, [G(ii, {
|
|
3896
3896
|
size: 14,
|
|
3897
3897
|
"aria-hidden": "true"
|
|
3898
3898
|
})]) : null,
|
|
3899
|
-
|
|
3899
|
+
ce()
|
|
3900
3900
|
]) : null;
|
|
3901
3901
|
}
|
|
3902
|
-
}),
|
|
3902
|
+
}), oa = X({
|
|
3903
3903
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
3904
3904
|
props: {
|
|
3905
3905
|
editor: {
|
|
@@ -3912,18 +3912,18 @@ var $i = X({
|
|
|
3912
3912
|
}
|
|
3913
3913
|
},
|
|
3914
3914
|
setup(e) {
|
|
3915
|
-
let t =
|
|
3915
|
+
let t = K(null), n = () => {
|
|
3916
3916
|
if (e.focusState.mode !== "cell-selection") {
|
|
3917
3917
|
t.value = null;
|
|
3918
3918
|
return;
|
|
3919
3919
|
}
|
|
3920
|
-
t.value =
|
|
3920
|
+
t.value = Pn(e.editor, un(e.editor.state));
|
|
3921
3921
|
};
|
|
3922
3922
|
return nr(() => {
|
|
3923
3923
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
3924
|
-
}),
|
|
3924
|
+
}), rr(() => {
|
|
3925
3925
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
3926
|
-
}),
|
|
3926
|
+
}), J(() => [
|
|
3927
3927
|
e.focusState.activeCellPos,
|
|
3928
3928
|
e.focusState.anchorCellPos,
|
|
3929
3929
|
e.focusState.mode,
|
|
@@ -3934,7 +3934,7 @@ var $i = X({
|
|
|
3934
3934
|
Y(n);
|
|
3935
3935
|
}, { flush: "post" }), () => {
|
|
3936
3936
|
let e = t.value;
|
|
3937
|
-
return e ?
|
|
3937
|
+
return e ? G("div", {
|
|
3938
3938
|
"aria-hidden": "true",
|
|
3939
3939
|
class: "markweave-table-selection-overlay",
|
|
3940
3940
|
"data-axis-target": e.axisTarget ?? "none",
|
|
@@ -3956,7 +3956,7 @@ var $i = X({
|
|
|
3956
3956
|
}) : null;
|
|
3957
3957
|
};
|
|
3958
3958
|
}
|
|
3959
|
-
}),
|
|
3959
|
+
}), sa = X({
|
|
3960
3960
|
name: "MarkweaveVueCodeBlockControls",
|
|
3961
3961
|
props: {
|
|
3962
3962
|
editor: {
|
|
@@ -3985,20 +3985,20 @@ var $i = X({
|
|
|
3985
3985
|
}
|
|
3986
3986
|
},
|
|
3987
3987
|
setup(e) {
|
|
3988
|
-
let t =
|
|
3988
|
+
let t = K(null), n = K(null), r = K(null), i = K(null), a = K(null), o = K(null), s = K(null), c = K(null), l = K([]), u = K(null), d = K(!1), f = K(""), p = K(-1), m = K(null), h = K(!1), g = K(null), _ = K(null), v = K(!1), y = K({
|
|
3989
3989
|
active: !1,
|
|
3990
3990
|
lastX: 0,
|
|
3991
3991
|
lastY: 0
|
|
3992
|
-
}), b =
|
|
3992
|
+
}), b = K(0), x = K(0), S = K(0), C = null, w = q(() => (S.value, yt(e.editor, s.value))), T = q(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
3993
3993
|
...e.state,
|
|
3994
3994
|
pos: e.state.pos,
|
|
3995
3995
|
active: !0
|
|
3996
|
-
} : null), E =
|
|
3996
|
+
} : null), E = q(() => w.value ?? T.value), D = q(() => E.value !== null), O = q(() => E.value?.language === "mermaid"), k = q(() => wt(e.editor, E.value)), A = q(() => D.value && E.value !== null && !k.value), j = q(() => !e.readOnly), M = q(() => E.value ? ft(E.value.language) : ft("text")), ee = q(() => m.value?.status ?? "idle"), N = q(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), P = q(() => O.value && N.value === "preview"), F = q(() => (S.value, b.value, x.value, St(e.editor))), I = q(() => `${x.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = q(() => gt(f.value)), R = q(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), te = () => {
|
|
3997
3997
|
C !== null && (window.clearTimeout(C), C = null);
|
|
3998
3998
|
}, z = (e) => {
|
|
3999
|
-
|
|
3999
|
+
te(), m.value = e, e && (C = window.setTimeout(() => {
|
|
4000
4000
|
m.value = null, C = null;
|
|
4001
|
-
},
|
|
4001
|
+
}, at));
|
|
4002
4002
|
}, B = () => {
|
|
4003
4003
|
g.value = null, _.value = null, v.value = !1, y.value = {
|
|
4004
4004
|
active: !1,
|
|
@@ -4008,30 +4008,30 @@ var $i = X({
|
|
|
4008
4008
|
}, H = () => {
|
|
4009
4009
|
let n = t.value;
|
|
4010
4010
|
if (!n) return;
|
|
4011
|
-
if (!
|
|
4011
|
+
if (!bt(n) || F.value.length === 0) {
|
|
4012
4012
|
l.value = [];
|
|
4013
4013
|
return;
|
|
4014
4014
|
}
|
|
4015
|
-
let r = n.getBoundingClientRect(), i =
|
|
4016
|
-
let n =
|
|
4017
|
-
return n ? [
|
|
4015
|
+
let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
|
|
4016
|
+
let n = ht(mt(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
4017
|
+
return n ? [ut(t, n, r)] : [];
|
|
4018
4018
|
});
|
|
4019
|
-
l.value =
|
|
4020
|
-
},
|
|
4019
|
+
l.value = Tt(l.value, i, F.value.map((e) => e.pos));
|
|
4020
|
+
}, U = () => {
|
|
4021
4021
|
if (!A.value || !E.value) {
|
|
4022
4022
|
c.value = null, u.value = null;
|
|
4023
4023
|
return;
|
|
4024
4024
|
}
|
|
4025
4025
|
let i = t.value;
|
|
4026
4026
|
if (!i) return;
|
|
4027
|
-
let a =
|
|
4027
|
+
let a = mt(e.editor, E.value.pos, N.value), o = i.getBoundingClientRect(), s = ht(a, o);
|
|
4028
4028
|
if (!s) {
|
|
4029
4029
|
c.value = c.value?.pos === E.value.pos ? c.value : null, u.value = d.value ? u.value : null;
|
|
4030
4030
|
return;
|
|
4031
4031
|
}
|
|
4032
|
-
if (c.value =
|
|
4032
|
+
if (c.value = ct(E.value.pos, s, o), d.value && n.value) {
|
|
4033
4033
|
let e = n.value.getBoundingClientRect(), t = r.value?.getBoundingClientRect().height;
|
|
4034
|
-
u.value =
|
|
4034
|
+
u.value = rt({
|
|
4035
4035
|
overlayRect: o,
|
|
4036
4036
|
buttonRect: e,
|
|
4037
4037
|
menuHeight: t,
|
|
@@ -4039,84 +4039,84 @@ var $i = X({
|
|
|
4039
4039
|
windowHeight: window.innerHeight
|
|
4040
4040
|
});
|
|
4041
4041
|
}
|
|
4042
|
-
},
|
|
4042
|
+
}, ne = async () => {
|
|
4043
4043
|
if (e.readOnly) {
|
|
4044
4044
|
if (!E.value) return;
|
|
4045
|
-
let e = await
|
|
4046
|
-
z(
|
|
4045
|
+
let e = await ot(E.value.text);
|
|
4046
|
+
z(Qe(E.value, e ? "copied" : "failed"));
|
|
4047
4047
|
return;
|
|
4048
4048
|
}
|
|
4049
|
-
if (!
|
|
4050
|
-
let t = await
|
|
4051
|
-
z(
|
|
4052
|
-
},
|
|
4049
|
+
if (!dt(e.editor, E.value)) return;
|
|
4050
|
+
let t = await Xe(e.editor);
|
|
4051
|
+
z(Qe(Ze(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
4052
|
+
}, re = (t, n) => {
|
|
4053
4053
|
if (e.readOnly) {
|
|
4054
|
-
|
|
4054
|
+
Kt(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
|
|
4055
4055
|
return;
|
|
4056
4056
|
}
|
|
4057
4057
|
let r = e.state.active && e.state.pos === t.pos;
|
|
4058
|
-
|
|
4059
|
-
},
|
|
4058
|
+
nt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
|
|
4059
|
+
}, ie = (t) => {
|
|
4060
4060
|
if (e.readOnly || !E.value) return;
|
|
4061
4061
|
let n = e.state.active && e.state.pos === E.value.pos;
|
|
4062
|
-
|
|
4063
|
-
},
|
|
4064
|
-
d.value = !d.value, d.value && o.value === null && (o.value =
|
|
4065
|
-
},
|
|
4066
|
-
let t =
|
|
4067
|
-
f.value = e, p.value =
|
|
4068
|
-
},
|
|
4062
|
+
tt(e.editor, E.value.pos, t) && (t === "mermaid" && nt(e.editor, E.value.pos, "preview") && e.onMermaidModeChange("preview"), d.value = !1, f.value = "", p.value = -1, S.value += 1, n && e.editor.view.focus());
|
|
4063
|
+
}, W = () => {
|
|
4064
|
+
d.value = !d.value, d.value && o.value === null && (o.value = st()), p.value = d.value ? xt(L.value, E.value?.language ?? null) : -1;
|
|
4065
|
+
}, ae = (e) => {
|
|
4066
|
+
let t = gt(e);
|
|
4067
|
+
f.value = e, p.value = xt(t, e.trim() ? null : E.value?.language ?? null);
|
|
4068
|
+
}, oe = (t) => {
|
|
4069
4069
|
if (!t.isComposing) {
|
|
4070
4070
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
4071
|
-
t.preventDefault(), p.value =
|
|
4071
|
+
t.preventDefault(), p.value = Dt(p.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
4072
4072
|
return;
|
|
4073
4073
|
}
|
|
4074
4074
|
if (t.key === "Enter") {
|
|
4075
|
-
let e =
|
|
4076
|
-
e && (t.preventDefault(),
|
|
4075
|
+
let e = L.value[p.value];
|
|
4076
|
+
e && (t.preventDefault(), ie(e.language));
|
|
4077
4077
|
return;
|
|
4078
4078
|
}
|
|
4079
4079
|
t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
|
|
4080
4080
|
}
|
|
4081
|
-
},
|
|
4082
|
-
e.readOnly || !E.value ||
|
|
4083
|
-
},
|
|
4081
|
+
}, se = () => {
|
|
4082
|
+
e.readOnly || !E.value || et(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
|
|
4083
|
+
}, ce = () => {
|
|
4084
4084
|
if (!E.value) return;
|
|
4085
|
-
let t =
|
|
4085
|
+
let t = Ct(e.editor, E.value.pos);
|
|
4086
4086
|
t && V({
|
|
4087
4087
|
data: new Blob([t], { type: "image/svg+xml" }),
|
|
4088
4088
|
fileName: "markweave-mermaid.svg",
|
|
4089
4089
|
onSettled: () => e.editor.view.focus(),
|
|
4090
4090
|
ownerDocument: document
|
|
4091
4091
|
});
|
|
4092
|
-
},
|
|
4092
|
+
}, le = () => {
|
|
4093
4093
|
if (!E.value) return;
|
|
4094
|
-
let t =
|
|
4095
|
-
t && (g.value =
|
|
4094
|
+
let t = Ct(e.editor, E.value.pos);
|
|
4095
|
+
t && (g.value = lt(t), _.value = null, v.value = !1, y.value = {
|
|
4096
4096
|
active: !1,
|
|
4097
4097
|
lastX: 0,
|
|
4098
4098
|
lastY: 0
|
|
4099
4099
|
});
|
|
4100
|
-
},
|
|
4100
|
+
}, ue = (e) => {
|
|
4101
4101
|
g.value = g.value ? {
|
|
4102
4102
|
...g.value,
|
|
4103
|
-
scale:
|
|
4103
|
+
scale: it(g.value.scale + e)
|
|
4104
4104
|
} : null;
|
|
4105
|
-
},
|
|
4106
|
-
g.value = g.value ?
|
|
4105
|
+
}, de = () => {
|
|
4106
|
+
g.value = g.value ? lt(g.value.svg) : null, y.value = {
|
|
4107
4107
|
active: !1,
|
|
4108
4108
|
lastX: 0,
|
|
4109
4109
|
lastY: 0
|
|
4110
4110
|
}, v.value = !1;
|
|
4111
|
-
},
|
|
4112
|
-
e.preventDefault(),
|
|
4113
|
-
},
|
|
4111
|
+
}, fe = (e) => {
|
|
4112
|
+
e.preventDefault(), ue(e.deltaY < 0 ? Et : -Et);
|
|
4113
|
+
}, pe = (e) => {
|
|
4114
4114
|
e.button === 0 && (e.preventDefault(), y.value = {
|
|
4115
4115
|
active: !0,
|
|
4116
4116
|
lastX: e.clientX,
|
|
4117
4117
|
lastY: e.clientY
|
|
4118
4118
|
}, v.value = !0);
|
|
4119
|
-
},
|
|
4119
|
+
}, me = (e) => {
|
|
4120
4120
|
let t = y.value;
|
|
4121
4121
|
if (!t.active) return;
|
|
4122
4122
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
@@ -4124,25 +4124,25 @@ var $i = X({
|
|
|
4124
4124
|
active: !0,
|
|
4125
4125
|
lastX: e.clientX,
|
|
4126
4126
|
lastY: e.clientY
|
|
4127
|
-
}, g.value =
|
|
4128
|
-
},
|
|
4127
|
+
}, g.value = Ot(g.value, n, r);
|
|
4128
|
+
}, he = () => {
|
|
4129
4129
|
y.value = {
|
|
4130
4130
|
active: !1,
|
|
4131
4131
|
lastX: 0,
|
|
4132
4132
|
lastY: 0
|
|
4133
4133
|
}, v.value = !1;
|
|
4134
4134
|
};
|
|
4135
|
-
|
|
4135
|
+
J(() => e.readOnly, (e) => {
|
|
4136
4136
|
e && (d.value = !1, f.value = "");
|
|
4137
|
-
}),
|
|
4137
|
+
}), J(R, () => {
|
|
4138
4138
|
z(null), d.value = !1, f.value = "", p.value = -1, g.value = null, _.value = null, v.value = !1;
|
|
4139
|
-
}),
|
|
4139
|
+
}), J(d, async (e) => {
|
|
4140
4140
|
if (!e) {
|
|
4141
4141
|
p.value = -1;
|
|
4142
4142
|
return;
|
|
4143
4143
|
}
|
|
4144
|
-
await Y(),
|
|
4145
|
-
}),
|
|
4144
|
+
await Y(), U(), i.value?.focus({ preventScroll: !0 });
|
|
4145
|
+
}), J(() => [
|
|
4146
4146
|
d.value,
|
|
4147
4147
|
f.value,
|
|
4148
4148
|
p.value
|
|
@@ -4150,31 +4150,31 @@ var $i = X({
|
|
|
4150
4150
|
if (!d.value || p.value < 0) return;
|
|
4151
4151
|
await Y();
|
|
4152
4152
|
let e = a.value, t = e?.querySelector(`[data-language-index="${p.value}"]`);
|
|
4153
|
-
e && t &&
|
|
4154
|
-
}, { flush: "post" }),
|
|
4153
|
+
e && t && kt(e, t);
|
|
4154
|
+
}, { flush: "post" }), J(() => [
|
|
4155
4155
|
A.value,
|
|
4156
4156
|
b.value,
|
|
4157
4157
|
E.value?.pos ?? null,
|
|
4158
|
-
|
|
4158
|
+
L.value.length,
|
|
4159
4159
|
d.value,
|
|
4160
|
-
|
|
4160
|
+
N.value
|
|
4161
4161
|
], async () => {
|
|
4162
|
-
await Y(),
|
|
4162
|
+
await Y(), U();
|
|
4163
4163
|
}, {
|
|
4164
4164
|
flush: "post",
|
|
4165
4165
|
immediate: !0
|
|
4166
|
-
}),
|
|
4166
|
+
}), J(I, async () => {
|
|
4167
4167
|
await Y(), H(), window.requestAnimationFrame(H);
|
|
4168
4168
|
}, {
|
|
4169
4169
|
flush: "post",
|
|
4170
4170
|
immediate: !0
|
|
4171
4171
|
});
|
|
4172
|
-
let
|
|
4172
|
+
let ge = null;
|
|
4173
4173
|
return nr(() => {
|
|
4174
4174
|
Y(() => {
|
|
4175
4175
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
4176
4176
|
if (n.target instanceof Node && t.value?.contains(n.target) || d.value) return;
|
|
4177
|
-
let r =
|
|
4177
|
+
let r = vt(e.editor, n.target), i = yt(e.editor, r), a = i && !wt(e.editor, i) ? i.pos : null;
|
|
4178
4178
|
s.value = s.value === a ? s.value : a;
|
|
4179
4179
|
}, i = () => {
|
|
4180
4180
|
d.value || (s.value = null);
|
|
@@ -4189,16 +4189,16 @@ var $i = X({
|
|
|
4189
4189
|
}, o = (e) => {
|
|
4190
4190
|
d.value && (e.target instanceof Node && t.value?.contains(e.target) || (d.value = !1, p.value = -1));
|
|
4191
4191
|
}, c = ({ transaction: e }) => {
|
|
4192
|
-
e.getMeta(
|
|
4192
|
+
e.getMeta(Ye) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Ye) || Ut(e)) && (S.value += 1);
|
|
4193
4193
|
};
|
|
4194
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize",
|
|
4195
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize",
|
|
4194
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", U), window.addEventListener("scroll", U, !0), window.addEventListener("resize", H), window.addEventListener("scroll", H, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ge = () => {
|
|
4195
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", U), window.removeEventListener("scroll", U, !0), window.removeEventListener("resize", H), window.removeEventListener("scroll", H, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), te();
|
|
4196
4196
|
};
|
|
4197
4197
|
});
|
|
4198
|
-
}),
|
|
4199
|
-
|
|
4198
|
+
}), rr(() => {
|
|
4199
|
+
ge?.(), ge = null, te();
|
|
4200
4200
|
}), () => {
|
|
4201
|
-
if (!A.value &&
|
|
4201
|
+
if (!A.value && F.value.length === 0 && !g.value) return null;
|
|
4202
4202
|
let s = c.value ? {
|
|
4203
4203
|
top: `${c.value.top}px`,
|
|
4204
4204
|
right: `${c.value.right}px`
|
|
@@ -4206,15 +4206,15 @@ var $i = X({
|
|
|
4206
4206
|
left: `${u.value.left}px`,
|
|
4207
4207
|
top: `${u.value.top}px`
|
|
4208
4208
|
} : void 0;
|
|
4209
|
-
return
|
|
4209
|
+
return G("div", {
|
|
4210
4210
|
ref: t,
|
|
4211
4211
|
class: "markweave-codeblock-overlay",
|
|
4212
4212
|
"data-testid": "markweave-codeblock-overlay",
|
|
4213
4213
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
4214
4214
|
}, [
|
|
4215
|
-
...
|
|
4215
|
+
...F.value.map((e) => {
|
|
4216
4216
|
let t = l.value.find((t) => t.pos === e.pos);
|
|
4217
|
-
return
|
|
4217
|
+
return G("div", {
|
|
4218
4218
|
key: e.pos,
|
|
4219
4219
|
class: "markweave-mermaid-tabs",
|
|
4220
4220
|
"data-testid": "markweave-mermaid-tabs",
|
|
@@ -4224,16 +4224,16 @@ var $i = X({
|
|
|
4224
4224
|
top: `${t.top}px`,
|
|
4225
4225
|
left: `${t.left}px`
|
|
4226
4226
|
} : void 0
|
|
4227
|
-
}, ["code", "preview"].map((t) =>
|
|
4227
|
+
}, ["code", "preview"].map((t) => G("button", {
|
|
4228
4228
|
key: t,
|
|
4229
4229
|
type: "button",
|
|
4230
4230
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
4231
4231
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
4232
4232
|
onMousedown: $,
|
|
4233
|
-
onClick: () =>
|
|
4233
|
+
onClick: () => re(e, t)
|
|
4234
4234
|
}, t === "code" ? "Code" : "Preview")));
|
|
4235
4235
|
}),
|
|
4236
|
-
A.value && E.value ?
|
|
4236
|
+
A.value && E.value ? G("div", {
|
|
4237
4237
|
class: "markweave-codeblock-controls",
|
|
4238
4238
|
"data-testid": "markweave-codeblock-controls",
|
|
4239
4239
|
"data-positioned": c.value ? "true" : "false",
|
|
@@ -4242,11 +4242,11 @@ var $i = X({
|
|
|
4242
4242
|
"aria-label": "Code block controls",
|
|
4243
4243
|
style: s
|
|
4244
4244
|
}, [
|
|
4245
|
-
e.readOnly ?
|
|
4245
|
+
e.readOnly ? G("span", {
|
|
4246
4246
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
4247
4247
|
"aria-label": "Code block language",
|
|
4248
4248
|
"data-testid": "markweave-codeblock-language"
|
|
4249
|
-
}, [
|
|
4249
|
+
}, [G("span", null, M.value)]) : G("button", {
|
|
4250
4250
|
ref: n,
|
|
4251
4251
|
type: "button",
|
|
4252
4252
|
class: "markweave-codeblock-language-button",
|
|
@@ -4255,9 +4255,9 @@ var $i = X({
|
|
|
4255
4255
|
"aria-haspopup": "listbox",
|
|
4256
4256
|
"data-testid": "markweave-codeblock-language",
|
|
4257
4257
|
onMousedown: $,
|
|
4258
|
-
onClick:
|
|
4259
|
-
}, [
|
|
4260
|
-
j.value ?
|
|
4258
|
+
onClick: W
|
|
4259
|
+
}, [G("span", null, M.value), qi("chevron")]),
|
|
4260
|
+
j.value ? G("button", {
|
|
4261
4261
|
type: "button",
|
|
4262
4262
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
4263
4263
|
"aria-label": k.value ? "Expand code block" : "Collapse code block",
|
|
@@ -4265,14 +4265,14 @@ var $i = X({
|
|
|
4265
4265
|
"data-testid": "markweave-codeblock-collapse",
|
|
4266
4266
|
"data-collapsed": k.value ? "true" : "false",
|
|
4267
4267
|
onMousedown: $,
|
|
4268
|
-
onClick:
|
|
4269
|
-
}, [
|
|
4270
|
-
|
|
4268
|
+
onClick: se
|
|
4269
|
+
}, [qi("chevron")]) : null,
|
|
4270
|
+
G("span", { class: "markweave-codeblock-copy-wrap" }, [G("button", {
|
|
4271
4271
|
type: "button",
|
|
4272
4272
|
class: "markweave-codeblock-icon-button",
|
|
4273
4273
|
"aria-label": "Copy to clipboard",
|
|
4274
4274
|
"data-testid": "markweave-codeblock-copy",
|
|
4275
|
-
"data-copy-state":
|
|
4275
|
+
"data-copy-state": ee.value,
|
|
4276
4276
|
onMousedown: $,
|
|
4277
4277
|
onMouseenter: () => {
|
|
4278
4278
|
h.value = !0;
|
|
@@ -4287,66 +4287,66 @@ var $i = X({
|
|
|
4287
4287
|
h.value = !1;
|
|
4288
4288
|
},
|
|
4289
4289
|
onClick: () => {
|
|
4290
|
-
|
|
4290
|
+
ne();
|
|
4291
4291
|
}
|
|
4292
|
-
}, [
|
|
4292
|
+
}, [qi(ee.value === "copied" ? "check" : "clipboard")]), h.value ? G("span", {
|
|
4293
4293
|
class: "markweave-codeblock-tooltip",
|
|
4294
4294
|
role: "tooltip",
|
|
4295
4295
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
4296
4296
|
}, "Copy to clipboard") : null]),
|
|
4297
|
-
O.value &&
|
|
4297
|
+
O.value && N.value === "preview" ? G("div", {
|
|
4298
4298
|
class: "markweave-mermaid-preview-actions",
|
|
4299
4299
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
4300
|
-
}, [
|
|
4300
|
+
}, [G("button", {
|
|
4301
4301
|
type: "button",
|
|
4302
4302
|
class: "markweave-codeblock-icon-button",
|
|
4303
4303
|
"aria-label": "Fullscreen Mermaid preview",
|
|
4304
4304
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
4305
|
-
disabled: !
|
|
4305
|
+
disabled: !P.value,
|
|
4306
4306
|
onMousedown: $,
|
|
4307
|
-
onClick:
|
|
4308
|
-
}, [
|
|
4307
|
+
onClick: le
|
|
4308
|
+
}, [qi("expand")]), G("button", {
|
|
4309
4309
|
type: "button",
|
|
4310
4310
|
class: "markweave-codeblock-icon-button",
|
|
4311
4311
|
"aria-label": "Download Mermaid SVG",
|
|
4312
4312
|
"data-testid": "markweave-mermaid-download",
|
|
4313
|
-
disabled: !
|
|
4313
|
+
disabled: !P.value,
|
|
4314
4314
|
onMousedown: $,
|
|
4315
|
-
onClick:
|
|
4316
|
-
}, [
|
|
4315
|
+
onClick: ce
|
|
4316
|
+
}, [qi("download")])]) : null
|
|
4317
4317
|
]) : null,
|
|
4318
|
-
j.value && A.value && d.value && E.value ?
|
|
4318
|
+
j.value && A.value && d.value && E.value ? G("div", {
|
|
4319
4319
|
ref: r,
|
|
4320
4320
|
class: "markweave-codeblock-language-menu",
|
|
4321
4321
|
"data-testid": "markweave-codeblock-language-menu",
|
|
4322
4322
|
"data-positioned": u.value ? "true" : "false",
|
|
4323
4323
|
style: m
|
|
4324
|
-
}, [
|
|
4324
|
+
}, [G("label", { class: "markweave-codeblock-language-search" }, [G("input", {
|
|
4325
4325
|
ref: i,
|
|
4326
4326
|
role: "combobox",
|
|
4327
4327
|
"aria-autocomplete": "list",
|
|
4328
4328
|
"aria-controls": o.value ?? void 0,
|
|
4329
4329
|
"aria-expanded": "true",
|
|
4330
|
-
"aria-activedescendant": o.value &&
|
|
4330
|
+
"aria-activedescendant": o.value && L.value[p.value] ? _t(o.value, L.value[p.value].language) : void 0,
|
|
4331
4331
|
"aria-label": "Search code block languages",
|
|
4332
4332
|
value: f.value,
|
|
4333
4333
|
placeholder: "Search...",
|
|
4334
4334
|
"data-testid": "markweave-codeblock-language-search",
|
|
4335
4335
|
onInput: (e) => {
|
|
4336
|
-
|
|
4336
|
+
ae(e.target.value);
|
|
4337
4337
|
},
|
|
4338
|
-
onKeydown:
|
|
4339
|
-
}),
|
|
4338
|
+
onKeydown: oe
|
|
4339
|
+
}), qi("search")]), G("div", {
|
|
4340
4340
|
ref: a,
|
|
4341
4341
|
id: o.value ?? void 0,
|
|
4342
4342
|
class: "markweave-codeblock-language-list",
|
|
4343
4343
|
role: "listbox",
|
|
4344
4344
|
"aria-label": "Code block languages"
|
|
4345
|
-
},
|
|
4345
|
+
}, L.value.map((e, t) => {
|
|
4346
4346
|
let n = E.value?.language === e.language, r = t === p.value;
|
|
4347
|
-
return
|
|
4347
|
+
return G("button", {
|
|
4348
4348
|
key: e.language,
|
|
4349
|
-
id: o.value ?
|
|
4349
|
+
id: o.value ? _t(o.value, e.language) : void 0,
|
|
4350
4350
|
type: "button",
|
|
4351
4351
|
role: "option",
|
|
4352
4352
|
"aria-selected": n ? "true" : "false",
|
|
@@ -4358,21 +4358,21 @@ var $i = X({
|
|
|
4358
4358
|
onMouseenter: () => {
|
|
4359
4359
|
p.value = t;
|
|
4360
4360
|
},
|
|
4361
|
-
onClick: () =>
|
|
4362
|
-
}, [
|
|
4361
|
+
onClick: () => ie(e.language)
|
|
4362
|
+
}, [G("span", null, e.label), n ? qi("check") : null]);
|
|
4363
4363
|
}))]) : null,
|
|
4364
|
-
g.value ?
|
|
4364
|
+
g.value ? G("div", {
|
|
4365
4365
|
class: "markweave-mermaid-fullscreen-layer",
|
|
4366
4366
|
role: "dialog",
|
|
4367
4367
|
"aria-modal": "true",
|
|
4368
4368
|
"aria-label": "Mermaid preview",
|
|
4369
4369
|
"data-testid": "markweave-mermaid-fullscreen-layer"
|
|
4370
4370
|
}, [
|
|
4371
|
-
|
|
4371
|
+
G("div", {
|
|
4372
4372
|
class: "markweave-mermaid-fullscreen-toolbar",
|
|
4373
4373
|
"data-testid": "markweave-mermaid-fullscreen-toolbar"
|
|
4374
4374
|
}, [
|
|
4375
|
-
|
|
4375
|
+
G("button", {
|
|
4376
4376
|
type: "button",
|
|
4377
4377
|
class: "markweave-mermaid-fullscreen-control",
|
|
4378
4378
|
"aria-label": "Zoom out",
|
|
@@ -4389,13 +4389,13 @@ var $i = X({
|
|
|
4389
4389
|
onBlur: () => {
|
|
4390
4390
|
_.value = null;
|
|
4391
4391
|
},
|
|
4392
|
-
onClick: () =>
|
|
4393
|
-
}, [
|
|
4394
|
-
|
|
4392
|
+
onClick: () => ue(-Et)
|
|
4393
|
+
}, [qi("zoomOut")]),
|
|
4394
|
+
G("span", {
|
|
4395
4395
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
4396
4396
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
4397
|
-
},
|
|
4398
|
-
|
|
4397
|
+
}, pt(g.value.scale)),
|
|
4398
|
+
G("button", {
|
|
4399
4399
|
type: "button",
|
|
4400
4400
|
class: "markweave-mermaid-fullscreen-control",
|
|
4401
4401
|
"aria-label": "Zoom in",
|
|
@@ -4412,9 +4412,9 @@ var $i = X({
|
|
|
4412
4412
|
onBlur: () => {
|
|
4413
4413
|
_.value = null;
|
|
4414
4414
|
},
|
|
4415
|
-
onClick: () =>
|
|
4416
|
-
}, [
|
|
4417
|
-
|
|
4415
|
+
onClick: () => ue(Et)
|
|
4416
|
+
}, [qi("zoomIn")]),
|
|
4417
|
+
G("button", {
|
|
4418
4418
|
type: "button",
|
|
4419
4419
|
class: "markweave-mermaid-fullscreen-control",
|
|
4420
4420
|
"aria-label": "Reset zoom",
|
|
@@ -4431,31 +4431,31 @@ var $i = X({
|
|
|
4431
4431
|
onBlur: () => {
|
|
4432
4432
|
_.value = null;
|
|
4433
4433
|
},
|
|
4434
|
-
onClick:
|
|
4435
|
-
}, [
|
|
4436
|
-
_.value ?
|
|
4434
|
+
onClick: de
|
|
4435
|
+
}, [qi("reset")]),
|
|
4436
|
+
_.value ? G("span", {
|
|
4437
4437
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
4438
4438
|
role: "tooltip",
|
|
4439
4439
|
"data-testid": "markweave-mermaid-fullscreen-tooltip"
|
|
4440
4440
|
}, _.value === "zoom-out" ? "Zoom out" : _.value === "zoom-in" ? "Zoom in" : "Reset") : null
|
|
4441
4441
|
]),
|
|
4442
|
-
|
|
4442
|
+
G("button", {
|
|
4443
4443
|
type: "button",
|
|
4444
4444
|
class: "markweave-mermaid-fullscreen-close",
|
|
4445
4445
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
4446
4446
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
4447
4447
|
onClick: B
|
|
4448
|
-
}, [
|
|
4449
|
-
|
|
4448
|
+
}, [qi("close")]),
|
|
4449
|
+
G("div", {
|
|
4450
4450
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
4451
4451
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
4452
4452
|
"data-dragging": v.value ? "true" : "false",
|
|
4453
|
-
onWheel:
|
|
4454
|
-
onMousedown:
|
|
4455
|
-
onMousemove:
|
|
4456
|
-
onMouseup:
|
|
4457
|
-
onMouseleave:
|
|
4458
|
-
}, [
|
|
4453
|
+
onWheel: fe,
|
|
4454
|
+
onMousedown: pe,
|
|
4455
|
+
onMousemove: me,
|
|
4456
|
+
onMouseup: he,
|
|
4457
|
+
onMouseleave: he
|
|
4458
|
+
}, [G("div", {
|
|
4459
4459
|
class: "markweave-mermaid-fullscreen-content",
|
|
4460
4460
|
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
4461
4461
|
"data-scale-percent": Math.round(g.value.scale * 100),
|
|
@@ -4471,7 +4471,7 @@ var $i = X({
|
|
|
4471
4471
|
]);
|
|
4472
4472
|
};
|
|
4473
4473
|
}
|
|
4474
|
-
}),
|
|
4474
|
+
}), ca = X({
|
|
4475
4475
|
name: "MarkweaveVueInnerToc",
|
|
4476
4476
|
props: {
|
|
4477
4477
|
editor: {
|
|
@@ -4496,22 +4496,23 @@ var $i = X({
|
|
|
4496
4496
|
}
|
|
4497
4497
|
},
|
|
4498
4498
|
setup(e) {
|
|
4499
|
-
let t =
|
|
4500
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
4499
|
+
let t = K(null), n, r = () => {
|
|
4500
|
+
n?.(), n = e.placement === "container" && t.value ? qe(t.value) : void 0;
|
|
4501
4501
|
};
|
|
4502
|
-
return nr(r),
|
|
4502
|
+
return nr(r), rr(() => n?.()), J(() => e.placement, r), () => e.state.items.length ? G("nav", {
|
|
4503
4503
|
ref: t,
|
|
4504
4504
|
class: "markweave-inner-toc",
|
|
4505
4505
|
"data-testid": "markweave-inner-toc",
|
|
4506
|
-
"aria-label": e.messages.toc.ariaLabel
|
|
4507
|
-
|
|
4506
|
+
"aria-label": e.messages.toc.ariaLabel,
|
|
4507
|
+
style: { "--markweave-inner-toc-rail-height": Ue(e.state.items.length) }
|
|
4508
|
+
}, [G("div", {
|
|
4508
4509
|
class: "markweave-inner-toc-rail",
|
|
4509
4510
|
"aria-hidden": "true"
|
|
4510
|
-
}, e.state.items.map((e) =>
|
|
4511
|
+
}, e.state.items.map((e) => G("span", {
|
|
4511
4512
|
key: e.id,
|
|
4512
4513
|
"data-level": e.level,
|
|
4513
4514
|
"data-active": e.active ? "true" : "false"
|
|
4514
|
-
}))),
|
|
4515
|
+
}))), G("div", { class: "markweave-inner-toc-panel" }, [G("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => G("button", {
|
|
4515
4516
|
key: t.id,
|
|
4516
4517
|
type: "button",
|
|
4517
4518
|
class: "markweave-inner-toc-item",
|
|
@@ -4520,34 +4521,34 @@ var $i = X({
|
|
|
4520
4521
|
"aria-current": t.active ? "location" : void 0,
|
|
4521
4522
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
4522
4523
|
title: t.text,
|
|
4523
|
-
onClick: () =>
|
|
4524
|
+
onClick: () => Je(e.editor, t, {
|
|
4524
4525
|
behavior: "smooth",
|
|
4525
4526
|
focus: e.editable
|
|
4526
4527
|
})
|
|
4527
4528
|
}, t.text)))])]) : null;
|
|
4528
4529
|
}
|
|
4529
4530
|
});
|
|
4530
|
-
function
|
|
4531
|
-
let i = r(e.lang), o = n(i), s = t(i), c =
|
|
4531
|
+
function la(e = {}) {
|
|
4532
|
+
let i = r(e.lang), o = n(i), s = t(i), c = K(f(e.mode)), l = q(() => be(e.theme)), u = q(() => c.value === "live" && e.editable !== !1), d = K(0), m = tr(null), h = K(rn), g = tr(null), _ = tr(null), v = K("code"), y = tr(null), b = tr(dn), x = K(null), S = K(!1), C = tr(null), w = W(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
|
|
4532
4533
|
function O() {
|
|
4533
4534
|
D !== null && (window.clearTimeout(D), D = null), d.value += 1;
|
|
4534
4535
|
}
|
|
4535
4536
|
function k() {
|
|
4536
4537
|
D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
|
|
4537
4538
|
D = null, d.value += 1;
|
|
4538
|
-
},
|
|
4539
|
+
}, _e);
|
|
4539
4540
|
}
|
|
4540
|
-
let A = e.onSlashCommandUpload, j =
|
|
4541
|
+
let A = e.onSlashCommandUpload, j = tr(null);
|
|
4541
4542
|
j.value = new a({
|
|
4542
|
-
extensions:
|
|
4543
|
+
extensions: Vi({
|
|
4543
4544
|
lang: i,
|
|
4544
4545
|
linkCardResolver: e.linkCardResolver,
|
|
4545
|
-
onImageUpload: (e) => A?.(e) ??
|
|
4546
|
-
onVideoUpload: (e) => A?.(e) ??
|
|
4546
|
+
onImageUpload: (e) => A?.(e) ?? L(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4547
|
+
onVideoUpload: (e) => A?.(e) ?? L(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4547
4548
|
resolveMediaSource: e.resolveMediaSource
|
|
4548
4549
|
}),
|
|
4549
4550
|
content: T,
|
|
4550
|
-
contentType:
|
|
4551
|
+
contentType: ne(w),
|
|
4551
4552
|
editable: u.value,
|
|
4552
4553
|
autofocus: e.autofocus,
|
|
4553
4554
|
editorProps: {
|
|
@@ -4561,17 +4562,17 @@ function ca(e = {}) {
|
|
|
4561
4562
|
translate: "no"
|
|
4562
4563
|
},
|
|
4563
4564
|
handleClick: (e, t, n) => {
|
|
4564
|
-
if (!u.value) return
|
|
4565
|
-
let r =
|
|
4566
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
4565
|
+
if (!u.value) return fe(n);
|
|
4566
|
+
let r = Lt(e, n);
|
|
4567
|
+
return r ? (n.preventDefault(), n.stopPropagation(), I(), Vt(e, r, !0), Ht(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
4567
4568
|
},
|
|
4568
4569
|
handleDOMEvents: {
|
|
4569
|
-
compositionstart: () => u.value ? (h.value =
|
|
4570
|
-
compositionend: (e) => (u.value && window.setTimeout(() =>
|
|
4570
|
+
compositionstart: () => u.value ? (h.value = an(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
4571
|
+
compositionend: (e) => (u.value && window.setTimeout(() => R(e), 0), !1),
|
|
4571
4572
|
click: (e, t) => {
|
|
4572
|
-
if (!u.value) return
|
|
4573
|
-
let n =
|
|
4574
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
4573
|
+
if (!u.value) return fe(t);
|
|
4574
|
+
let n = Lt(e, t);
|
|
4575
|
+
return n ? (t.preventDefault(), t.stopPropagation(), I(), Vt(e, n, !0), Ht(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
4575
4576
|
}
|
|
4576
4577
|
}
|
|
4577
4578
|
},
|
|
@@ -4580,17 +4581,17 @@ function ca(e = {}) {
|
|
|
4580
4581
|
p(t, {
|
|
4581
4582
|
mode: c.value,
|
|
4582
4583
|
editable: u.value
|
|
4583
|
-
}),
|
|
4584
|
+
}), Wt(t, l.value), Gt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && cn(t), V(t), z(t), O();
|
|
4584
4585
|
},
|
|
4585
4586
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
4586
|
-
if (V(e), (t.docChanged ||
|
|
4587
|
-
let t =
|
|
4587
|
+
if (V(e), (t.docChanged || Ut(t)) && k(), t.docChanged && y.value) {
|
|
4588
|
+
let t = It(e, y.value.pos);
|
|
4588
4589
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
4589
4590
|
}
|
|
4590
4591
|
},
|
|
4591
4592
|
onUpdate: ({ editor: t }) => {
|
|
4592
|
-
z(t), u.value &&
|
|
4593
|
-
let i =
|
|
4593
|
+
z(t), u.value && te(t), S.value || e.onUpdate?.(U(t, { onContentRead: (n, r) => {
|
|
4594
|
+
let i = W(e.contentFormat);
|
|
4594
4595
|
e.content !== void 0 && n === i && (C.value = {
|
|
4595
4596
|
content: r,
|
|
4596
4597
|
format: n,
|
|
@@ -4599,194 +4600,194 @@ function ca(e = {}) {
|
|
|
4599
4600
|
} }));
|
|
4600
4601
|
}
|
|
4601
4602
|
});
|
|
4602
|
-
let
|
|
4603
|
+
let M = j.value, ee = xe(M), N = !1, P = !1;
|
|
4603
4604
|
Y(() => {
|
|
4604
|
-
|
|
4605
|
+
N || j.value !== M || (P = !0, e.onAiEditControllerChange?.(ee));
|
|
4605
4606
|
});
|
|
4606
|
-
let
|
|
4607
|
-
function
|
|
4608
|
-
g.value = null, _.value = null, h.value =
|
|
4607
|
+
let F = q(() => j.value ?? null);
|
|
4608
|
+
function I() {
|
|
4609
|
+
g.value = null, _.value = null, h.value = rn;
|
|
4609
4610
|
}
|
|
4610
|
-
function
|
|
4611
|
-
let t =
|
|
4611
|
+
function R(e) {
|
|
4612
|
+
let t = tn(e.state);
|
|
4612
4613
|
if (!t) {
|
|
4613
|
-
h.value = h.value.name === "idle" ? h.value :
|
|
4614
|
+
h.value = h.value.name === "idle" ? h.value : rn, g.value = null, _.value = null;
|
|
4614
4615
|
return;
|
|
4615
4616
|
}
|
|
4616
4617
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
4617
|
-
if (!
|
|
4618
|
-
|
|
4618
|
+
if (!nn(r, { frameRect: i })) {
|
|
4619
|
+
I();
|
|
4619
4620
|
return;
|
|
4620
4621
|
}
|
|
4621
|
-
let a =
|
|
4622
|
+
let a = en(n, {
|
|
4622
4623
|
frameRect: i,
|
|
4623
4624
|
triggerRect: r
|
|
4624
4625
|
});
|
|
4625
|
-
|
|
4626
|
+
Zt(g.value, a) || (g.value = a), h.value = $t(h.value, t);
|
|
4626
4627
|
}
|
|
4627
|
-
function
|
|
4628
|
-
|
|
4628
|
+
function te(e) {
|
|
4629
|
+
R(e.view);
|
|
4629
4630
|
}
|
|
4630
4631
|
function z(e) {
|
|
4631
|
-
let t =
|
|
4632
|
-
|
|
4633
|
-
let n =
|
|
4634
|
-
n && (
|
|
4635
|
-
let r =
|
|
4632
|
+
let t = ge(e);
|
|
4633
|
+
me(m.value, t) || (m.value = t);
|
|
4634
|
+
let n = Rt(e);
|
|
4635
|
+
n && (Bt(e, n, !0), y.value = n);
|
|
4636
|
+
let r = Ze(e);
|
|
4636
4637
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
4637
4638
|
}
|
|
4638
4639
|
function V(e) {
|
|
4639
|
-
b.value =
|
|
4640
|
+
b.value = Wi(e);
|
|
4640
4641
|
}
|
|
4641
|
-
let
|
|
4642
|
-
active:
|
|
4642
|
+
let ae = q(() => F.value ? Ze(F.value) : Ui), oe = q(() => F.value ? ln(F.value.state) : Hi), se = q(() => m.value?.currentNode === "codeBlock"), ce = q(() => se.value && ae.value.language === "mermaid"), le = q(() => F.value ? qt({
|
|
4643
|
+
active: ce.value,
|
|
4643
4644
|
mode: v.value,
|
|
4644
|
-
source:
|
|
4645
|
-
}) :
|
|
4645
|
+
source: ae.value.text
|
|
4646
|
+
}) : qt({
|
|
4646
4647
|
active: !1,
|
|
4647
4648
|
mode: "code",
|
|
4648
4649
|
source: ""
|
|
4649
|
-
})),
|
|
4650
|
+
})), ue = q(() => F.value && e.onRuntimeStateChange ? sn(F.value.state) : null), de = q(() => F.value ? We(F.value.state) : Ve.items), he = q(() => Ge(de.value, x.value)), ve = q(() => Be(de.value, he.value)), ye = q(() => Jt(h.value.query, s)), Se = q(() => pe({
|
|
4650
4651
|
revision: d.value,
|
|
4651
4652
|
mode: c.value,
|
|
4652
4653
|
editable: u.value,
|
|
4653
|
-
toc:
|
|
4654
|
+
toc: ve.value,
|
|
4654
4655
|
selection: m.value,
|
|
4655
4656
|
slash: h.value,
|
|
4656
|
-
table:
|
|
4657
|
+
table: oe.value,
|
|
4657
4658
|
tableInteraction: b.value,
|
|
4658
|
-
codeBlock:
|
|
4659
|
-
mermaid:
|
|
4660
|
-
tableDebugSnapshot:
|
|
4661
|
-
})),
|
|
4662
|
-
closeSlashMenu:
|
|
4663
|
-
focusFirstTableBodyCell: () =>
|
|
4659
|
+
codeBlock: ae.value,
|
|
4660
|
+
mermaid: le.value,
|
|
4661
|
+
tableDebugSnapshot: ue.value
|
|
4662
|
+
})), Ce = {
|
|
4663
|
+
closeSlashMenu: I,
|
|
4664
|
+
focusFirstTableBodyCell: () => F.value ? cn(F.value) : !1,
|
|
4664
4665
|
setContent: (e, t = {}) => {
|
|
4665
|
-
if (!
|
|
4666
|
-
let n =
|
|
4667
|
-
return
|
|
4668
|
-
contentType:
|
|
4666
|
+
if (!F.value) return !1;
|
|
4667
|
+
let n = W(t.format);
|
|
4668
|
+
return F.value.commands.setContent(e, {
|
|
4669
|
+
contentType: ne(n),
|
|
4669
4670
|
emitUpdate: t.emitUpdate ?? !1
|
|
4670
|
-
}), t.focusFirstTableBodyCell &&
|
|
4671
|
+
}), t.focusFirstTableBodyCell && cn(F.value), z(F.value), u.value && te(F.value), V(F.value), O(), !0;
|
|
4671
4672
|
}
|
|
4672
4673
|
};
|
|
4673
|
-
function
|
|
4674
|
-
if (!(!
|
|
4674
|
+
function we(e, t) {
|
|
4675
|
+
if (!(!F.value || !u.value || !Yt(e))) {
|
|
4675
4676
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
4676
4677
|
_.value = e;
|
|
4677
4678
|
return;
|
|
4678
4679
|
}
|
|
4679
|
-
|
|
4680
|
+
Qt(F.value, h.value, e, t), h.value = an(h.value, { type: "execute" }), I();
|
|
4680
4681
|
}
|
|
4681
4682
|
}
|
|
4682
|
-
function
|
|
4683
|
-
if (!
|
|
4684
|
-
let t =
|
|
4683
|
+
function Te(e) {
|
|
4684
|
+
if (!F.value || _.value || !u.value) return;
|
|
4685
|
+
let t = Xt(h.value, ye.value, e.key, { isComposing: e.isComposing || B(F.value.state) });
|
|
4685
4686
|
if (t.type !== "ignore") {
|
|
4686
4687
|
if (e.preventDefault(), t.type === "close") {
|
|
4687
|
-
h.value =
|
|
4688
|
+
h.value = an(h.value, { type: "escape" }), I();
|
|
4688
4689
|
return;
|
|
4689
4690
|
}
|
|
4690
4691
|
if (t.type === "move-active") {
|
|
4691
|
-
h.value =
|
|
4692
|
+
h.value = an(h.value, {
|
|
4692
4693
|
type: "move-active",
|
|
4693
4694
|
delta: t.delta,
|
|
4694
4695
|
optionCount: t.optionCount
|
|
4695
4696
|
});
|
|
4696
4697
|
return;
|
|
4697
4698
|
}
|
|
4698
|
-
|
|
4699
|
+
we(t.command);
|
|
4699
4700
|
}
|
|
4700
4701
|
}
|
|
4701
|
-
|
|
4702
|
-
c.value = f(e.mode),
|
|
4702
|
+
J(() => [e.mode, e.editable], () => {
|
|
4703
|
+
c.value = f(e.mode), F.value && (F.value.setEditable(u.value), p(F.value, {
|
|
4703
4704
|
mode: c.value,
|
|
4704
4705
|
editable: u.value
|
|
4705
|
-
}),
|
|
4706
|
-
}, { immediate: !0 }),
|
|
4707
|
-
|
|
4708
|
-
}, { immediate: !0 }),
|
|
4709
|
-
let n =
|
|
4710
|
-
if (!(!
|
|
4711
|
-
if (
|
|
4706
|
+
}), Gt(F.value, u.value ? "live" : "view"), O(), u.value || I());
|
|
4707
|
+
}, { immediate: !0 }), J(() => e.theme, () => {
|
|
4708
|
+
F.value && Wt(F.value, l.value);
|
|
4709
|
+
}, { immediate: !0 }), J(() => e.content, (t) => {
|
|
4710
|
+
let n = W(e.contentFormat);
|
|
4711
|
+
if (!(!F.value || t === void 0)) {
|
|
4712
|
+
if (ie(F.value, C.value, t, n)) {
|
|
4712
4713
|
C.value = null;
|
|
4713
4714
|
return;
|
|
4714
4715
|
}
|
|
4715
|
-
C.value = null, !
|
|
4716
|
-
contentType:
|
|
4716
|
+
C.value = null, !re(F.value, t, n) && (S.value = !0, F.value.commands.setContent(t, {
|
|
4717
|
+
contentType: ne(n),
|
|
4717
4718
|
emitUpdate: !1
|
|
4718
|
-
}), S.value = !1, z(
|
|
4719
|
+
}), S.value = !1, z(F.value), u.value && te(F.value), V(F.value), O());
|
|
4719
4720
|
}
|
|
4720
|
-
}),
|
|
4721
|
-
let t =
|
|
4721
|
+
}), J(Se, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), J(ve, (t) => e.onTocChange?.(t), { immediate: !0 }), J(de, (e) => {
|
|
4722
|
+
let t = Ge(e, x.value);
|
|
4722
4723
|
x.value !== t && (x.value = t);
|
|
4723
4724
|
});
|
|
4724
|
-
let
|
|
4725
|
-
|
|
4726
|
-
}),
|
|
4727
|
-
g.value &&
|
|
4725
|
+
let Ee = H(() => {
|
|
4726
|
+
F.value && g.value && R(F.value.view);
|
|
4727
|
+
}), De = () => {
|
|
4728
|
+
g.value && Ee.schedule();
|
|
4728
4729
|
};
|
|
4729
|
-
|
|
4730
|
-
e ?
|
|
4730
|
+
J(g, (e) => {
|
|
4731
|
+
e ? De() : Ee.cancel();
|
|
4731
4732
|
}), nr(() => {
|
|
4732
|
-
window.addEventListener("resize",
|
|
4733
|
-
}),
|
|
4734
|
-
|
|
4733
|
+
window.addEventListener("resize", De), window.addEventListener("scroll", De, !0);
|
|
4734
|
+
}), rr(() => {
|
|
4735
|
+
Ee.cancel(), window.removeEventListener("resize", De), window.removeEventListener("scroll", De, !0);
|
|
4735
4736
|
});
|
|
4736
|
-
let
|
|
4737
|
-
return
|
|
4737
|
+
let Oe = null;
|
|
4738
|
+
return rr(() => {
|
|
4738
4739
|
D !== null && window.clearTimeout(D);
|
|
4739
4740
|
}), nr(() => {
|
|
4740
4741
|
let e = () => {
|
|
4741
|
-
if (!
|
|
4742
|
+
if (!F.value || !de.value.length) {
|
|
4742
4743
|
x.value = null;
|
|
4743
4744
|
return;
|
|
4744
4745
|
}
|
|
4745
4746
|
let e = null;
|
|
4746
4747
|
try {
|
|
4747
|
-
e =
|
|
4748
|
+
e = He(F.value, de.value);
|
|
4748
4749
|
} catch {
|
|
4749
4750
|
return;
|
|
4750
4751
|
}
|
|
4751
4752
|
x.value !== e && (x.value = e);
|
|
4752
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
4753
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
4753
|
+
}, t = () => window.requestAnimationFrame(e), n = Gi(F.value?.view.dom ?? null);
|
|
4754
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
|
|
4754
4755
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
4755
4756
|
};
|
|
4756
|
-
}),
|
|
4757
|
-
|
|
4757
|
+
}), rr(() => {
|
|
4758
|
+
Oe?.(), N = !0, P && e.onAiEditControllerChange?.(null);
|
|
4758
4759
|
let t = j.value;
|
|
4759
4760
|
j.value = null, Y(() => t?.destroy());
|
|
4760
4761
|
}), {
|
|
4761
|
-
editor:
|
|
4762
|
-
runtimeSnapshot:
|
|
4763
|
-
actions:
|
|
4762
|
+
editor: F,
|
|
4763
|
+
runtimeSnapshot: Se,
|
|
4764
|
+
actions: Ce,
|
|
4764
4765
|
__render: {
|
|
4765
4766
|
messages: o,
|
|
4766
4767
|
effectiveEditable: u,
|
|
4767
|
-
tableFocusState:
|
|
4768
|
+
tableFocusState: oe,
|
|
4768
4769
|
tableInteractionState: b,
|
|
4769
|
-
codeBlockState:
|
|
4770
|
-
isCodeBlockActive:
|
|
4770
|
+
codeBlockState: ae,
|
|
4771
|
+
isCodeBlockActive: se,
|
|
4771
4772
|
mermaidMode: v,
|
|
4772
4773
|
mathTarget: y,
|
|
4773
4774
|
setMermaidMode: (e) => {
|
|
4774
4775
|
v.value = e;
|
|
4775
4776
|
},
|
|
4776
|
-
tocState:
|
|
4777
|
-
filteredSlashCommands:
|
|
4777
|
+
tocState: ve,
|
|
4778
|
+
filteredSlashCommands: ye,
|
|
4778
4779
|
slashState: h,
|
|
4779
4780
|
slashMenuPosition: g,
|
|
4780
4781
|
slashInputCommand: _,
|
|
4781
|
-
runSlashCommand:
|
|
4782
|
-
handleEditorKeyDown:
|
|
4782
|
+
runSlashCommand: we,
|
|
4783
|
+
handleEditorKeyDown: Te,
|
|
4783
4784
|
setSlashInputCommand: (e) => {
|
|
4784
4785
|
_.value = e;
|
|
4785
4786
|
}
|
|
4786
4787
|
}
|
|
4787
4788
|
};
|
|
4788
4789
|
}
|
|
4789
|
-
var
|
|
4790
|
+
var ua = X({
|
|
4790
4791
|
name: "MarkweaveEditor",
|
|
4791
4792
|
props: {
|
|
4792
4793
|
defaultContent: {
|
|
@@ -4903,31 +4904,31 @@ var la = X({
|
|
|
4903
4904
|
}
|
|
4904
4905
|
},
|
|
4905
4906
|
setup(e) {
|
|
4906
|
-
let t =
|
|
4907
|
+
let t = la(e);
|
|
4907
4908
|
return () => {
|
|
4908
4909
|
let n = t.editor.value;
|
|
4909
4910
|
if (!n) return null;
|
|
4910
|
-
let i = t.__render, a = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s =
|
|
4911
|
-
return
|
|
4911
|
+
let i = t.__render, a = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = ye(e.canvasColor);
|
|
4912
|
+
return G("section", {
|
|
4912
4913
|
class: a,
|
|
4913
4914
|
"aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
|
|
4914
4915
|
"data-testid": "markweave-editor-frame",
|
|
4915
4916
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
4916
|
-
"data-markweave-theme":
|
|
4917
|
+
"data-markweave-theme": be(e.theme),
|
|
4917
4918
|
style: s ? { "--markweave-canvas": s } : void 0,
|
|
4918
4919
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
4919
|
-
"data-markweave-inner-toc-placement":
|
|
4920
|
+
"data-markweave-inner-toc-placement": Ke(e.innerTocPlacement),
|
|
4920
4921
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
4921
4922
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
4922
4923
|
onKeydownCapture: i.handleEditorKeyDown
|
|
4923
4924
|
}, [
|
|
4924
|
-
i.effectiveEditable.value ?
|
|
4925
|
+
i.effectiveEditable.value ? G(ea, {
|
|
4925
4926
|
editor: n,
|
|
4926
4927
|
lang: r(e.lang),
|
|
4927
4928
|
messages: i.messages,
|
|
4928
4929
|
askAi: e.askAi
|
|
4929
4930
|
}) : null,
|
|
4930
|
-
i.effectiveEditable.value ?
|
|
4931
|
+
i.effectiveEditable.value ? G(na, {
|
|
4931
4932
|
commands: i.filteredSlashCommands.value,
|
|
4932
4933
|
state: i.slashState.value,
|
|
4933
4934
|
position: i.slashMenuPosition.value,
|
|
@@ -4937,7 +4938,7 @@ var la = X({
|
|
|
4937
4938
|
onInputCommandChange: i.setSlashInputCommand,
|
|
4938
4939
|
onUpload: e.onSlashCommandUpload
|
|
4939
4940
|
}) : null,
|
|
4940
|
-
i.effectiveEditable.value ?
|
|
4941
|
+
i.effectiveEditable.value ? G(aa, {
|
|
4941
4942
|
editor: n,
|
|
4942
4943
|
active: i.tableFocusState.value.active,
|
|
4943
4944
|
interactionState: i.tableInteractionState.value,
|
|
@@ -4947,11 +4948,11 @@ var la = X({
|
|
|
4947
4948
|
onCommandResult: e.onTableCommandResult,
|
|
4948
4949
|
onEditWithAi: e.onEditWithAi
|
|
4949
4950
|
}) : null,
|
|
4950
|
-
i.effectiveEditable.value ?
|
|
4951
|
+
i.effectiveEditable.value ? G(oa, {
|
|
4951
4952
|
editor: n,
|
|
4952
4953
|
focusState: i.tableFocusState.value
|
|
4953
4954
|
}) : null,
|
|
4954
|
-
|
|
4955
|
+
G(sa, {
|
|
4955
4956
|
editor: n,
|
|
4956
4957
|
state: i.codeBlockState.value,
|
|
4957
4958
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -4959,23 +4960,23 @@ var la = X({
|
|
|
4959
4960
|
onMermaidModeChange: i.setMermaidMode,
|
|
4960
4961
|
readOnly: !i.effectiveEditable.value
|
|
4961
4962
|
}),
|
|
4962
|
-
e.innerToc && i.tocState.value.items.length ?
|
|
4963
|
+
e.innerToc && i.tocState.value.items.length ? G(ca, {
|
|
4963
4964
|
editor: n,
|
|
4964
4965
|
state: i.tocState.value,
|
|
4965
4966
|
messages: i.messages,
|
|
4966
4967
|
editable: i.effectiveEditable.value,
|
|
4967
|
-
placement:
|
|
4968
|
+
placement: Ke(e.innerTocPlacement)
|
|
4968
4969
|
}) : null,
|
|
4969
|
-
i.effectiveEditable.value && i.mathTarget.value ?
|
|
4970
|
+
i.effectiveEditable.value && i.mathTarget.value ? G(ta, {
|
|
4970
4971
|
editor: n,
|
|
4971
4972
|
messages: i.messages,
|
|
4972
4973
|
target: i.mathTarget.value,
|
|
4973
4974
|
onClose: () => i.mathTarget.value = null
|
|
4974
4975
|
}) : null,
|
|
4975
|
-
|
|
4976
|
+
G(o, { editor: n })
|
|
4976
4977
|
]);
|
|
4977
4978
|
};
|
|
4978
4979
|
}
|
|
4979
4980
|
});
|
|
4980
4981
|
//#endregion
|
|
4981
|
-
export {
|
|
4982
|
+
export { ua as MarkweaveEditor, te as createMarkweaveAiEditController, Vi as createMarkweaveEditorExtensions, Vi as createMarkweaveVue2EditorExtensions, la as useMarkweaveEditorController };
|