@markweave/vue2 0.5.0 → 0.5.1
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 +405 -399
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -25,40 +25,40 @@ import { areEditorSelectionSnapshotsEquivalent as me, calculateFloatingToolbarPo
|
|
|
25
25
|
import { normalizeMarkweaveCanvasColor as ye, normalizeMarkweaveTheme as be } from "markweave/internal/core/theme";
|
|
26
26
|
import { createMarkweaveAiEditController as xe } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
|
|
27
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,
|
|
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
|
|
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, observeMarkweaveInnerTocRailOverflow as Je, scrollToMarkweaveTocItem as Ye } from "markweave/internal/core/toc-state";
|
|
29
|
+
import { codeBlockCollapsePluginKey as Xe, copyActiveCodeBlock as Ze, getActiveCodeBlockState as Qe, getCodeBlockCopyFeedbackSnapshot as $e, markweaveCodeBlockBehavior as et, setCodeBlockCollapsedAtPosition as tt, setCodeBlockLanguageAtPosition as nt, setCodeBlockMermaidPreviewModeAtPosition as rt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
30
|
+
import { calculateCodeBlockLanguageMenuPosition as it, clampFullscreenScale as at, codeBlockCopyFeedbackTimeoutMs as ot, copyCodeBlockText as st, createCodeBlockLanguageMenuDomId as ct, createCodeBlockOverlayPosition as lt, createMermaidFullscreenViewerState as ut, createMermaidTabPosition as dt, focusCodeBlockTarget as ft, formatCodeBlockLanguageLabel as pt, formatFullscreenZoom as mt, getActiveCodeBlockElement as ht, getAnchoredRect as gt, getCodeBlockLanguageItems as _t, getCodeBlockLanguageOptionDomId as vt, getCodeBlockPositionFromEventTarget as yt, getCodeBlockStateAtPosition as bt, getFrameElement as xt, getInitialCodeBlockLanguageItemIndex as St, getMermaidCodeBlockTargets as Ct, getMermaidSvgMarkup as wt, isCodeBlockTargetCollapsed as Tt, mergeStableMermaidTabPositions as Et, mermaidFullscreenZoomStep as Dt, moveCodeBlockLanguageItemIndex as Ot, moveMermaidFullscreenViewer as kt, scrollCodeBlockLanguageItemIntoView as At } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
31
|
+
import { normalizeMarkdownLinkHref as jt } from "markweave/internal/plugins/markdown/markdown-input";
|
|
32
|
+
import { applyMarkweaveMathLatex as Mt, calculateMarkweaveMathPopoverPosition as Nt, getMarkweaveMathAnchorRect as Pt, getMarkweaveMathBlockIndex as Ft, getMarkweaveMathRenderedHtml as It, getMarkweaveMathTargetAtPos as Lt, getMarkweaveMathTargetFromDomEvent as Rt, getMarkweaveMathTargetFromSelection as zt, renderMarkweaveMathPreview as Bt, setMarkweaveMathEditingDomState as Vt, setMarkweaveMathEditingDomStateInView as Ht, setMarkweaveMathSelectionInView as Ut } from "markweave/internal/plugins/math/math-ui-model";
|
|
33
|
+
import { isMermaidInlinePreviewTransaction as Wt, setMarkweaveMermaidTheme as Gt, setMermaidInlinePreviewEditorMode as Kt, setReadonlyMermaidPreviewMode as qt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
34
|
+
import { getMermaidPreviewState as Jt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
35
|
+
import { filterSlashCommands as Yt, isExecutableSlashCommand as Xt } from "markweave/internal/plugins/slash-command/command-spec";
|
|
36
|
+
import { getSlashCommandKeyboardAction as Zt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
37
|
+
import { areSlashCommandMenuPositionsEquivalent as Qt, executeSlashCommand as $t, getNextSlashCommandState as en, getSlashCommandAnchoredMenuPosition as tn, getSlashCommandContext as nn, isSlashCommandAnchorVisible as rn } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
38
|
+
import { initialSlashCommandState as an, reduceSlashCommandState as on } from "markweave/internal/plugins/slash-command/slash-state";
|
|
39
|
+
import { setMarkweaveTableMenuAxisTarget as sn } from "markweave/internal/plugins/table/table-clipboard";
|
|
40
|
+
import { getFirstTableDebugSnapshot as cn } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
41
|
+
import { focusFirstTableBodyCell as ln } from "markweave/internal/plugins/table/table-focus-position";
|
|
42
|
+
import { getTableFocusState as un } from "markweave/internal/plugins/table/table-focus-state";
|
|
43
|
+
import { getTableSelectionOverlayState as dn, initialTableInteractionState as fn, tableInteractionPluginKey as pn } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
44
|
+
import { applyTableAxisAlignment as mn, applyTableAxisBackgroundColor as hn, applyTableAxisTextColor as gn, calculateAnchoredTableMenuPosition as _n, calculateAnchoredTableSubmenuPosition as vn, calculateTableAxisHandleLayout as yn, calculateTableExtendButtonLayout as bn, canRunTableCommand as xn, executeTableMenuCommand as Sn, formatTableCopyFeedback as Cn, getActiveTableElement as wn, getAvailableCellMenuCommandSpecs as Tn, getTableAxisDropIndexAtPoint as En, getTableAxisFormattingState as Dn, getTableAxisTargetRect as On, getTableControlAxisSelectionModel as kn, getTableMenuBoundaryRect as An, getTableMenuItemGroup as jn, getTableMenuItemLabel as Mn, getTableMenuItems as Nn, getTableSelectionTargetRect as Pn, measureTableSelectionOverlay as Fn, moveTargetedTableAxis as In, selectTableAxisFromCell as Ln, tableColorOptions as Rn, tableCopyFeedbackTimeoutMs as zn, tableHorizontalAlignmentOptions as Bn, tableMenuLabel as Vn, tableVerticalAlignmentOptions as Hn, targetTableAxisFromCell as Un } from "markweave/internal/plugins/table/table-ui-model";
|
|
45
45
|
//#region src/vue2-compat.ts
|
|
46
|
-
var
|
|
47
|
-
function
|
|
46
|
+
var Wn = l.default ?? l, Gn = null, Kn = null, qn = null;
|
|
47
|
+
function Jn(e) {
|
|
48
48
|
return !!(e && typeof e == "object" && "value" in e);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Yn(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 Xn(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" && Jn(s)) {
|
|
62
62
|
a.insert = (e) => {
|
|
63
63
|
s.value = e.elm;
|
|
64
64
|
}, a.destroy = () => {
|
|
@@ -67,7 +67,7 @@ function Yn(e) {
|
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
69
|
if (/^on[A-Z]/.test(o)) {
|
|
70
|
-
i[
|
|
70
|
+
i[Yn(o)] = s;
|
|
71
71
|
continue;
|
|
72
72
|
}
|
|
73
73
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -78,14 +78,14 @@ function Yn(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 Zn(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" && Jn(o)) {
|
|
89
89
|
i.insert = (e) => {
|
|
90
90
|
o.value = e.componentInstance ?? e.elm;
|
|
91
91
|
}, i.destroy = () => {
|
|
@@ -101,27 +101,27 @@ function Xn(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 Qn(e) {
|
|
105
105
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function $n(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 er(e) {
|
|
111
111
|
return e == null || Array.isArray(e) ? e : [e];
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
return typeof e == "function" ?
|
|
113
|
+
function tr(e) {
|
|
114
|
+
return typeof e == "function" ? er(e()) : Qn(e) ? er(e.default()) : $n(e) ? [e] : e;
|
|
115
115
|
}
|
|
116
116
|
function G(e, t, n) {
|
|
117
|
-
if (!
|
|
118
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
119
|
-
return
|
|
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);
|
|
120
120
|
}
|
|
121
121
|
function K(e) {
|
|
122
|
-
return
|
|
122
|
+
return Wn.observable({ value: e });
|
|
123
123
|
}
|
|
124
|
-
var
|
|
124
|
+
var nr = K;
|
|
125
125
|
function q(e) {
|
|
126
126
|
return { get value() {
|
|
127
127
|
return e();
|
|
@@ -129,19 +129,19 @@ function q(e) {
|
|
|
129
129
|
}
|
|
130
130
|
function J(e, t, n) {
|
|
131
131
|
let r = typeof e == "function" ? e : () => e.value;
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
function nr(e) {
|
|
135
|
-
Gn?.mounted.push(e);
|
|
132
|
+
return Gn?.$watch ? Gn.$watch(r, t, n) : () => void 0;
|
|
136
133
|
}
|
|
137
134
|
function rr(e) {
|
|
138
|
-
|
|
135
|
+
Kn?.mounted.push(e);
|
|
136
|
+
}
|
|
137
|
+
function ir(e) {
|
|
138
|
+
Kn?.beforeUnmount.push(e);
|
|
139
139
|
}
|
|
140
140
|
function Y(e) {
|
|
141
|
-
return
|
|
141
|
+
return Wn.nextTick(e);
|
|
142
142
|
}
|
|
143
143
|
function X(e) {
|
|
144
|
-
return
|
|
144
|
+
return Wn.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
|
+
Gn = this, Kn = 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
|
+
Gn = null, Kn = 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
|
+
qn = t;
|
|
168
168
|
try {
|
|
169
169
|
let n = this.__markweaveVue2Render;
|
|
170
170
|
return n ? n() : e.render?.(t) ?? null;
|
|
171
171
|
} finally {
|
|
172
|
-
|
|
172
|
+
qn = null;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
//#endregion
|
|
178
178
|
//#region src/vue2-icons.ts
|
|
179
|
-
var
|
|
179
|
+
var ar = {
|
|
180
180
|
AlignVerticalJustifyCenter: {
|
|
181
181
|
iconName: "align-vertical-justify-center",
|
|
182
182
|
node: [
|
|
@@ -1498,7 +1498,7 @@ var ir = {
|
|
|
1498
1498
|
}]]
|
|
1499
1499
|
}
|
|
1500
1500
|
};
|
|
1501
|
-
function
|
|
1501
|
+
function or(e) {
|
|
1502
1502
|
return e.map(([e, t]) => G(e, t));
|
|
1503
1503
|
}
|
|
1504
1504
|
function Z(e) {
|
|
@@ -1519,7 +1519,7 @@ function Z(e) {
|
|
|
1519
1519
|
}
|
|
1520
1520
|
},
|
|
1521
1521
|
setup(t) {
|
|
1522
|
-
let n =
|
|
1522
|
+
let n = ar[e];
|
|
1523
1523
|
return () => G("svg", {
|
|
1524
1524
|
class: `lucide lucide-${n.iconName}`,
|
|
1525
1525
|
viewBox: "0 0 24 24",
|
|
@@ -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
|
+
}, or(n.node));
|
|
1536
1536
|
}
|
|
1537
1537
|
});
|
|
1538
1538
|
}
|
|
1539
|
-
var
|
|
1540
|
-
function
|
|
1539
|
+
var sr = Z("AlignCenter"), cr = Z("AlignJustify"), lr = Z("AlignLeft"), ur = Z("AlignRight"), dr = Z("AlignVerticalJustifyCenter"), fr = Z("AlignVerticalJustifyEnd"), pr = Z("AlignVerticalJustifyStart"), mr = Z("AlertTriangle"), hr = Z("ArrowDown"), gr = Z("ArrowDownAZ"), _r = Z("ArrowLeft"), vr = Z("ArrowRight"), yr = Z("ArrowUp"), br = Z("ArrowUpZA"), xr = Z("BetweenHorizontalEnd"), Sr = Z("BetweenHorizontalStart"), Cr = Z("BetweenVerticalEnd"), wr = Z("BetweenVerticalStart"), Tr = Z("Bold"), Er = Z("Braces"), Dr = Z("Captions"), Or = Z("Check"), kr = Z("CheckCircle2"), Ar = Z("ChevronDown"), jr = Z("ChevronRight"), Mr = Z("ChevronUp"), Nr = Z("CircleX"), Pr = Z("Code2"), Fr = Z("CornerDownLeft"), Ir = Z("Copy"), Lr = Z("Download"), Rr = Z("Eye"), zr = Z("ExternalLink"), Br = Z("Heading1"), Vr = Z("Heading2"), Hr = Z("Heading3"), Ur = Z("Image"), Wr = Z("ImageUp"), Gr = Z("IndentDecrease"), Kr = Z("IndentIncrease"), qr = Z("Info"), Jr = Z("Italic"), Yr = Z("Lightbulb"), Xr = Z("Link2"), Zr = Z("List"), Qr = Z("ListChecks"), $r = Z("ListOrdered"), ei = Z("Minus"), ti = Z("MoreVertical"), ni = Z("PaintBucket"), ri = Z("Paperclip"), ii = Z("PencilLine"), ai = Z("Plus"), oi = Z("Quote"), si = Z("Replace"), ci = Z("RotateCcw"), li = Z("Sigma"), ui = Z("SmilePlus"), di = Z("Sparkles"), fi = Z("Square"), pi = Z("SquareX"), mi = Z("Strikethrough"), hi = Z("Subscript"), gi = Z("Superscript"), _i = Z("Table2"), vi = Z("TableCellsMerge"), yi = Z("TableCellsSplit"), bi = Z("Text"), xi = Z("Trash2"), Si = Z("Type"), Ci = Z("Underline"), wi = Z("Upload"), Ti = Z("Video"), Ei = Z("X"), Di = ee;
|
|
1540
|
+
function Oi(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" ? {
|
|
@@ -1555,27 +1555,27 @@ function Di(e) {
|
|
|
1555
1555
|
return a && t && a.observe(t, {
|
|
1556
1556
|
attributes: !0,
|
|
1557
1557
|
attributeFilter: ["data-markweave-mode"]
|
|
1558
|
-
}),
|
|
1558
|
+
}), ir(() => {
|
|
1559
1559
|
i(), a?.disconnect();
|
|
1560
1560
|
}), r;
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1562
|
+
function ki(e) {
|
|
1563
1563
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1564
1564
|
}
|
|
1565
|
-
function
|
|
1565
|
+
function Ai(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 ji(e) {
|
|
1569
1569
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1571
|
+
function Mi(e, t) {
|
|
1572
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
|
|
1578
|
+
function Ni(e) {
|
|
1579
1579
|
return G("button", {
|
|
1580
1580
|
type: "button",
|
|
1581
1581
|
"aria-label": e.label,
|
|
@@ -1584,12 +1584,12 @@ function Mi(e) {
|
|
|
1584
1584
|
"data-active": e.active ? "true" : "false",
|
|
1585
1585
|
onMousedown: (e) => e.preventDefault(),
|
|
1586
1586
|
onClick: e.onClick
|
|
1587
|
-
}, [
|
|
1587
|
+
}, [Mi(e.icon, e.label), G("span", {
|
|
1588
1588
|
class: "markweave-image-tooltip",
|
|
1589
1589
|
role: "tooltip"
|
|
1590
1590
|
}, e.label)]);
|
|
1591
1591
|
}
|
|
1592
|
-
function
|
|
1592
|
+
function Pi(e) {
|
|
1593
1593
|
let t = K(null), n = e.messages.image;
|
|
1594
1594
|
return G("section", {
|
|
1595
1595
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1623,7 +1623,7 @@ function Ni(e) {
|
|
|
1623
1623
|
G("div", {
|
|
1624
1624
|
class: "markweave-image-upload-icon",
|
|
1625
1625
|
"aria-hidden": "true"
|
|
1626
|
-
}, [G(
|
|
1626
|
+
}, [G(Wr, {
|
|
1627
1627
|
size: 46,
|
|
1628
1628
|
strokeWidth: 1.6
|
|
1629
1629
|
})]),
|
|
@@ -1648,7 +1648,7 @@ function Ni(e) {
|
|
|
1648
1648
|
"data-testid": "markweave-image-upload-submit",
|
|
1649
1649
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1650
1650
|
onClick: e.onSubmit
|
|
1651
|
-
}, [G(
|
|
1651
|
+
}, [G(Wr, {
|
|
1652
1652
|
size: 16,
|
|
1653
1653
|
strokeWidth: 1.8
|
|
1654
1654
|
}), e.messages.common.insert]),
|
|
@@ -1664,7 +1664,7 @@ function Ni(e) {
|
|
|
1664
1664
|
}, e.error) : null
|
|
1665
1665
|
]);
|
|
1666
1666
|
}
|
|
1667
|
-
function
|
|
1667
|
+
function Fi(e) {
|
|
1668
1668
|
let t = K(null), n = e.messages.video;
|
|
1669
1669
|
return G("section", {
|
|
1670
1670
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1698,7 +1698,7 @@ function Pi(e) {
|
|
|
1698
1698
|
G("div", {
|
|
1699
1699
|
class: "markweave-video-upload-icon",
|
|
1700
1700
|
"aria-hidden": "true"
|
|
1701
|
-
}, [G(
|
|
1701
|
+
}, [G(Ti, {
|
|
1702
1702
|
size: 46,
|
|
1703
1703
|
strokeWidth: 1.6
|
|
1704
1704
|
})]),
|
|
@@ -1723,7 +1723,7 @@ function Pi(e) {
|
|
|
1723
1723
|
"data-testid": "markweave-video-upload-submit",
|
|
1724
1724
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1725
1725
|
onClick: e.onSubmit
|
|
1726
|
-
}, [G(
|
|
1726
|
+
}, [G(wi, {
|
|
1727
1727
|
size: 16,
|
|
1728
1728
|
strokeWidth: 1.8
|
|
1729
1729
|
}), e.messages.common.insert]),
|
|
@@ -1739,7 +1739,7 @@ function Pi(e) {
|
|
|
1739
1739
|
}, e.error) : null
|
|
1740
1740
|
]);
|
|
1741
1741
|
}
|
|
1742
|
-
var
|
|
1742
|
+
var Ii = X({
|
|
1743
1743
|
name: "MarkweaveVueImageNodeView",
|
|
1744
1744
|
props: {
|
|
1745
1745
|
editor: {
|
|
@@ -1772,7 +1772,7 @@ var Fi = X({
|
|
|
1772
1772
|
}
|
|
1773
1773
|
},
|
|
1774
1774
|
setup(e) {
|
|
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 =
|
|
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 = Oi(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
1776
|
J(v, (t) => {
|
|
1777
1777
|
if (C?.abort(), C = null, !t) {
|
|
1778
1778
|
x.value = null;
|
|
@@ -1792,8 +1792,8 @@ var Fi = X({
|
|
|
1792
1792
|
}).then((e) => {
|
|
1793
1793
|
r.signal.aborted || (x.value = e);
|
|
1794
1794
|
});
|
|
1795
|
-
}, { immediate: !0 }),
|
|
1796
|
-
let w = q(() => x.value?.src ?? (y.value ? null : v.value)), E = q(() =>
|
|
1795
|
+
}, { immediate: !0 }), ir(() => C?.abort());
|
|
1796
|
+
let w = q(() => x.value?.src ?? (y.value ? null : v.value)), E = q(() => Di(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
1799
|
alt: F(u.value.alt) ?? "",
|
|
@@ -1866,7 +1866,7 @@ var Fi = X({
|
|
|
1866
1866
|
"data-selected": "false",
|
|
1867
1867
|
"data-hovered": "false",
|
|
1868
1868
|
"data-empty": "true"
|
|
1869
|
-
}, () =>
|
|
1869
|
+
}, () => Pi({
|
|
1870
1870
|
messages: g.value,
|
|
1871
1871
|
inputValue: o.value,
|
|
1872
1872
|
error: c.value,
|
|
@@ -1896,7 +1896,7 @@ var Fi = X({
|
|
|
1896
1896
|
r.value = !1;
|
|
1897
1897
|
},
|
|
1898
1898
|
onMousedown: (e) => {
|
|
1899
|
-
h.value && !
|
|
1899
|
+
h.value && !ki(e.target) && N();
|
|
1900
1900
|
}
|
|
1901
1901
|
}, () => [
|
|
1902
1902
|
h.value ? G("div", {
|
|
@@ -1905,24 +1905,24 @@ var Fi = X({
|
|
|
1905
1905
|
"data-markweave-image-ui": "true",
|
|
1906
1906
|
"aria-label": _.value.toolsAriaLabel
|
|
1907
1907
|
}, [
|
|
1908
|
-
|
|
1908
|
+
Ni({
|
|
1909
1909
|
testId: "markweave-image-align-left",
|
|
1910
1910
|
label: _.value.alignLeft,
|
|
1911
|
-
icon:
|
|
1911
|
+
icon: lr,
|
|
1912
1912
|
active: E.value === "left",
|
|
1913
1913
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1914
1914
|
}),
|
|
1915
|
-
|
|
1915
|
+
Ni({
|
|
1916
1916
|
testId: "markweave-image-align-center",
|
|
1917
1917
|
label: _.value.alignCenter,
|
|
1918
|
-
icon:
|
|
1918
|
+
icon: sr,
|
|
1919
1919
|
active: E.value === "center",
|
|
1920
1920
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1921
1921
|
}),
|
|
1922
|
-
|
|
1922
|
+
Ni({
|
|
1923
1923
|
testId: "markweave-image-align-right",
|
|
1924
1924
|
label: _.value.alignRight,
|
|
1925
|
-
icon:
|
|
1925
|
+
icon: ur,
|
|
1926
1926
|
active: E.value === "right",
|
|
1927
1927
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1928
1928
|
}),
|
|
@@ -1930,31 +1930,31 @@ var Fi = X({
|
|
|
1930
1930
|
class: "markweave-image-toolbar-divider",
|
|
1931
1931
|
"aria-hidden": "true"
|
|
1932
1932
|
}),
|
|
1933
|
-
|
|
1933
|
+
Ni({
|
|
1934
1934
|
testId: "markweave-image-caption",
|
|
1935
1935
|
label: _.value.caption,
|
|
1936
|
-
icon:
|
|
1936
|
+
icon: Dr,
|
|
1937
1937
|
active: f.value || !!A.value,
|
|
1938
1938
|
onClick: V
|
|
1939
1939
|
}),
|
|
1940
|
-
|
|
1940
|
+
Ni({
|
|
1941
1941
|
testId: "markweave-image-preview",
|
|
1942
1942
|
label: _.value.preview,
|
|
1943
|
-
icon:
|
|
1943
|
+
icon: Rr,
|
|
1944
1944
|
onClick: ee
|
|
1945
1945
|
}),
|
|
1946
|
-
|
|
1946
|
+
Ni({
|
|
1947
1947
|
testId: "markweave-image-download",
|
|
1948
1948
|
label: _.value.download,
|
|
1949
|
-
icon:
|
|
1949
|
+
icon: Lr,
|
|
1950
1950
|
onClick: () => {
|
|
1951
1951
|
w.value && j(w.value);
|
|
1952
1952
|
}
|
|
1953
1953
|
}),
|
|
1954
|
-
|
|
1954
|
+
Ni({
|
|
1955
1955
|
testId: "markweave-image-replace",
|
|
1956
1956
|
label: _.value.replace,
|
|
1957
|
-
icon:
|
|
1957
|
+
icon: si,
|
|
1958
1958
|
onClick: () => {
|
|
1959
1959
|
o.value = "", c.value = null, i.value = !0;
|
|
1960
1960
|
}
|
|
@@ -1963,10 +1963,10 @@ var Fi = X({
|
|
|
1963
1963
|
class: "markweave-image-toolbar-divider",
|
|
1964
1964
|
"aria-hidden": "true"
|
|
1965
1965
|
}),
|
|
1966
|
-
|
|
1966
|
+
Ni({
|
|
1967
1967
|
testId: "markweave-image-delete",
|
|
1968
1968
|
label: _.value.delete,
|
|
1969
|
-
icon:
|
|
1969
|
+
icon: xi,
|
|
1970
1970
|
onClick: () => e.deleteNode()
|
|
1971
1971
|
})
|
|
1972
1972
|
]) : null,
|
|
@@ -2002,7 +2002,7 @@ var Fi = X({
|
|
|
2002
2002
|
title: _.value.preview,
|
|
2003
2003
|
onMousedown: (e) => e.preventDefault(),
|
|
2004
2004
|
onClick: ee
|
|
2005
|
-
}, [G(
|
|
2005
|
+
}, [G(Rr, {
|
|
2006
2006
|
size: 16,
|
|
2007
2007
|
strokeWidth: 1.8
|
|
2008
2008
|
}), G("span", {
|
|
@@ -2047,7 +2047,7 @@ var Fi = X({
|
|
|
2047
2047
|
}, A.value) : null
|
|
2048
2048
|
]);
|
|
2049
2049
|
}
|
|
2050
|
-
}),
|
|
2050
|
+
}), Li = X({
|
|
2051
2051
|
name: "MarkweaveVueVideoNodeView",
|
|
2052
2052
|
props: {
|
|
2053
2053
|
editor: {
|
|
@@ -2080,7 +2080,7 @@ var Fi = X({
|
|
|
2080
2080
|
}
|
|
2081
2081
|
},
|
|
2082
2082
|
setup(e) {
|
|
2083
|
-
let t = K(!1), r = K(""), i = K(null), a = K(!1), o =
|
|
2083
|
+
let t = K(!1), r = K(""), i = K(null), a = K(!1), o = Oi(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;
|
|
@@ -2121,7 +2121,7 @@ var Fi = X({
|
|
|
2121
2121
|
"data-testid": "markweave-video-node",
|
|
2122
2122
|
"data-empty": "true",
|
|
2123
2123
|
"data-selected": "false"
|
|
2124
|
-
}, () =>
|
|
2124
|
+
}, () => Fi({
|
|
2125
2125
|
messages: l.value,
|
|
2126
2126
|
inputValue: r.value,
|
|
2127
2127
|
error: i.value,
|
|
@@ -2148,7 +2148,7 @@ var Fi = X({
|
|
|
2148
2148
|
onFocus: C,
|
|
2149
2149
|
onKeydown: w,
|
|
2150
2150
|
onMousedown: (e) => {
|
|
2151
|
-
c.value && !
|
|
2151
|
+
c.value && !Ai(e.target) && (e.preventDefault(), C());
|
|
2152
2152
|
}
|
|
2153
2153
|
}, () => [g.value ? G("div", { class: "markweave-video-embed" }, [G("iframe", {
|
|
2154
2154
|
class: "markweave-video-iframe",
|
|
@@ -2186,7 +2186,7 @@ var Fi = X({
|
|
|
2186
2186
|
"aria-hidden": "true"
|
|
2187
2187
|
})]);
|
|
2188
2188
|
}
|
|
2189
|
-
}),
|
|
2189
|
+
}), Ri = C.extend({
|
|
2190
2190
|
addOptions() {
|
|
2191
2191
|
return {
|
|
2192
2192
|
...this.parent?.(),
|
|
@@ -2197,7 +2197,7 @@ var Fi = X({
|
|
|
2197
2197
|
},
|
|
2198
2198
|
addNodeView() {
|
|
2199
2199
|
if (typeof document > "u") return null;
|
|
2200
|
-
let e = c(
|
|
2200
|
+
let e = c(Ii, { stopEvent: ({ event: e }) => ki(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"),
|
|
@@ -2206,7 +2206,7 @@ var Fi = X({
|
|
|
2206
2206
|
});
|
|
2207
2207
|
return (t) => F(t.node.attrs.src) ? r(t) : e(t);
|
|
2208
2208
|
}
|
|
2209
|
-
}),
|
|
2209
|
+
}), zi = w.extend({
|
|
2210
2210
|
addOptions() {
|
|
2211
2211
|
return {
|
|
2212
2212
|
...this.parent?.(),
|
|
@@ -2216,9 +2216,9 @@ var Fi = X({
|
|
|
2216
2216
|
};
|
|
2217
2217
|
},
|
|
2218
2218
|
addNodeView() {
|
|
2219
|
-
return typeof document > "u" ? null : c(
|
|
2219
|
+
return typeof document > "u" ? null : c(Li, { stopEvent: ({ event: e }) => Ai(e.target) });
|
|
2220
2220
|
}
|
|
2221
|
-
}),
|
|
2221
|
+
}), Bi = X({
|
|
2222
2222
|
name: "MarkweaveVueLinkCardNodeView",
|
|
2223
2223
|
props: {
|
|
2224
2224
|
editor: {
|
|
@@ -2251,7 +2251,7 @@ var Fi = X({
|
|
|
2251
2251
|
}
|
|
2252
2252
|
},
|
|
2253
2253
|
setup(e) {
|
|
2254
|
-
let t = e.extension.options, r = t.messages ?? n("zh"), i =
|
|
2254
|
+
let t = e.extension.options, r = t.messages ?? n("zh"), i = Oi(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
2255
|
J(l, (e) => {
|
|
2256
2256
|
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
2257
2257
|
});
|
|
@@ -2286,7 +2286,7 @@ var Fi = X({
|
|
|
2286
2286
|
"data-testid": n,
|
|
2287
2287
|
onMousedown: h,
|
|
2288
2288
|
onClick: r
|
|
2289
|
-
}, [
|
|
2289
|
+
}, [Mi(t, e), G("span", { role: "tooltip" }, e)]);
|
|
2290
2290
|
return () => {
|
|
2291
2291
|
let n = l.value;
|
|
2292
2292
|
if (!n) return null;
|
|
@@ -2322,10 +2322,10 @@ var Fi = X({
|
|
|
2322
2322
|
a.value = !1;
|
|
2323
2323
|
},
|
|
2324
2324
|
onMousedown: (e) => {
|
|
2325
|
-
|
|
2325
|
+
ji(e.target) || e.preventDefault();
|
|
2326
2326
|
},
|
|
2327
2327
|
onClick: (e) => {
|
|
2328
|
-
|
|
2328
|
+
ji(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
2329
2329
|
}
|
|
2330
2330
|
}, () => [
|
|
2331
2331
|
G("a", {
|
|
@@ -2345,9 +2345,9 @@ var Fi = X({
|
|
|
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, Xr, "markweave-link-card-convert", x),
|
|
2349
|
+
C(r.linkCard.copyAddress, Lr, "markweave-link-card-copy", () => b(n.href)),
|
|
2350
|
+
C(r.linkCard.edit, ii, "markweave-link-card-edit", (i) => g({
|
|
2351
2351
|
anchor: i.currentTarget,
|
|
2352
2352
|
editor: e.editor,
|
|
2353
2353
|
messages: r,
|
|
@@ -2357,7 +2357,7 @@ var Fi = X({
|
|
|
2357
2357
|
attrs: n
|
|
2358
2358
|
}
|
|
2359
2359
|
})),
|
|
2360
|
-
C(r.linkCard.delete,
|
|
2360
|
+
C(r.linkCard.delete, xi, "markweave-link-card-delete", () => e.deleteNode())
|
|
2361
2361
|
]) : null,
|
|
2362
2362
|
p.value && o.value ? G("form", {
|
|
2363
2363
|
class: "markweave-link-card-editor",
|
|
@@ -2385,12 +2385,12 @@ var Fi = X({
|
|
|
2385
2385
|
type: "submit",
|
|
2386
2386
|
disabled: !v(f.value),
|
|
2387
2387
|
"aria-label": r.linkCard.edit
|
|
2388
|
-
}, [
|
|
2388
|
+
}, [Mi(Xr, r.linkCard.edit)])
|
|
2389
2389
|
]) : null
|
|
2390
2390
|
]);
|
|
2391
2391
|
};
|
|
2392
2392
|
}
|
|
2393
|
-
}),
|
|
2393
|
+
}), Vi = h.extend({
|
|
2394
2394
|
addOptions() {
|
|
2395
2395
|
return {
|
|
2396
2396
|
...this.parent?.(),
|
|
@@ -2399,23 +2399,23 @@ var Fi = X({
|
|
|
2399
2399
|
};
|
|
2400
2400
|
},
|
|
2401
2401
|
addNodeView() {
|
|
2402
|
-
return typeof document > "u" ? null : c(
|
|
2402
|
+
return typeof document > "u" ? null : c(Bi, { stopEvent: ({ event: e }) => ji(e.target) });
|
|
2403
2403
|
}
|
|
2404
2404
|
});
|
|
2405
2405
|
//#endregion
|
|
2406
2406
|
//#region src/create-editor-extensions.ts
|
|
2407
|
-
function
|
|
2407
|
+
function Hi(t = {}) {
|
|
2408
2408
|
return e({
|
|
2409
2409
|
lang: t.lang,
|
|
2410
2410
|
onImageUpload: t.onImageUpload,
|
|
2411
|
-
linkCardExtension:
|
|
2411
|
+
linkCardExtension: Vi.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: Ri,
|
|
2418
|
+
video: zi,
|
|
2419
2419
|
lang: t.lang,
|
|
2420
2420
|
onImageUpload: t.onImageUpload,
|
|
2421
2421
|
onVideoUpload: t.onVideoUpload,
|
|
@@ -2425,7 +2425,7 @@ function Vi(t = {}) {
|
|
|
2425
2425
|
}
|
|
2426
2426
|
//#endregion
|
|
2427
2427
|
//#region src/MarkweaveEditor.ts
|
|
2428
|
-
var
|
|
2428
|
+
var Ui = {
|
|
2429
2429
|
active: !1,
|
|
2430
2430
|
mode: "outside",
|
|
2431
2431
|
activeCellPos: null,
|
|
@@ -2433,17 +2433,17 @@ var Hi = {
|
|
|
2433
2433
|
selectedCellCount: 0,
|
|
2434
2434
|
selectionFrom: 0,
|
|
2435
2435
|
selectionTo: 0
|
|
2436
|
-
},
|
|
2436
|
+
}, Wi = {
|
|
2437
2437
|
active: !1,
|
|
2438
|
-
language:
|
|
2438
|
+
language: et.defaultLanguage,
|
|
2439
2439
|
mermaidPreviewMode: "code",
|
|
2440
2440
|
pos: null,
|
|
2441
2441
|
text: ""
|
|
2442
2442
|
};
|
|
2443
|
-
function Wi(e) {
|
|
2444
|
-
return fn.getState(e.state) ?? dn;
|
|
2445
|
-
}
|
|
2446
2443
|
function Gi(e) {
|
|
2444
|
+
return pn.getState(e.state) ?? fn;
|
|
2445
|
+
}
|
|
2446
|
+
function Ki(e) {
|
|
2447
2447
|
if (!e || typeof window > "u") return null;
|
|
2448
2448
|
let t = e.parentElement;
|
|
2449
2449
|
for (; t;) {
|
|
@@ -2460,7 +2460,7 @@ function Q(e, t, n = 18, r = 1.8) {
|
|
|
2460
2460
|
"aria-hidden": "true"
|
|
2461
2461
|
}, { default: () => t });
|
|
2462
2462
|
}
|
|
2463
|
-
function
|
|
2463
|
+
function qi(e) {
|
|
2464
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",
|
|
@@ -2497,7 +2497,7 @@ function Ki(e) {
|
|
|
2497
2497
|
G("path", { d: "m14 14 4 4" })
|
|
2498
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
|
|
2500
|
+
function Ji(e) {
|
|
2501
2501
|
return G("svg", {
|
|
2502
2502
|
viewBox: "0 0 24 24",
|
|
2503
2503
|
"aria-hidden": "true",
|
|
@@ -2508,57 +2508,57 @@ function qi(e) {
|
|
|
2508
2508
|
"stroke-linecap": "round",
|
|
2509
2509
|
"stroke-linejoin": "round",
|
|
2510
2510
|
"stroke-width": "1.8"
|
|
2511
|
-
},
|
|
2511
|
+
}, qi(e)));
|
|
2512
2512
|
}
|
|
2513
2513
|
function $(e) {
|
|
2514
2514
|
e.preventDefault();
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2517
|
-
let t =
|
|
2516
|
+
function Yi(e) {
|
|
2517
|
+
let t = jt(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 Xi = {
|
|
2521
|
+
bold: Tr,
|
|
2522
|
+
italic: Jr,
|
|
2523
|
+
underline: Ci,
|
|
2524
|
+
strike: mi,
|
|
2525
|
+
"inline-code": Pr,
|
|
2526
|
+
link: Xr,
|
|
2527
|
+
more: ti,
|
|
2528
|
+
superscript: gi,
|
|
2529
|
+
subscript: hi,
|
|
2530
|
+
"inline-math": li,
|
|
2531
|
+
"align-left": lr,
|
|
2532
|
+
"align-center": sr,
|
|
2533
|
+
"align-right": ur,
|
|
2534
|
+
"align-justify": cr,
|
|
2535
|
+
"decrease-indent": Gr,
|
|
2536
|
+
"increase-indent": Kr
|
|
2537
|
+
}, Zi = {
|
|
2538
|
+
type: bi,
|
|
2539
|
+
"heading-1": Br,
|
|
2540
|
+
"heading-2": Vr,
|
|
2541
|
+
"heading-3": Hr,
|
|
2542
|
+
"bullet-list": Zr,
|
|
2543
|
+
"ordered-list": $r,
|
|
2544
|
+
"task-list": Qr,
|
|
2545
|
+
blockquote: oi,
|
|
2546
|
+
"code-block": Er,
|
|
2547
|
+
info: qr,
|
|
2548
|
+
tip: Yr,
|
|
2549
|
+
warning: mr,
|
|
2550
|
+
error: Nr,
|
|
2551
|
+
success: kr,
|
|
2552
|
+
emoji: ui,
|
|
2553
|
+
math: li,
|
|
2554
|
+
table: _i,
|
|
2555
|
+
separator: ei,
|
|
2556
|
+
image: Ur,
|
|
2557
|
+
video: Ti,
|
|
2558
|
+
attachment: ri
|
|
2559
2559
|
};
|
|
2560
|
-
function
|
|
2561
|
-
let t =
|
|
2560
|
+
function Qi(e) {
|
|
2561
|
+
let t = Zi[e];
|
|
2562
2562
|
return G(t, {
|
|
2563
2563
|
size: 18,
|
|
2564
2564
|
strokeWidth: 1.6,
|
|
@@ -2566,21 +2566,21 @@ function Zi(e) {
|
|
|
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 $i = {
|
|
2570
|
+
paragraph: Si,
|
|
2571
|
+
"heading-1": Br,
|
|
2572
|
+
"heading-2": Vr,
|
|
2573
|
+
"heading-3": Hr,
|
|
2574
|
+
"bullet-list": Zr,
|
|
2575
|
+
"numbered-list": $r,
|
|
2576
|
+
"todo-list": Qr,
|
|
2577
|
+
quote: oi,
|
|
2578
|
+
"code-block": Er
|
|
2579
2579
|
};
|
|
2580
|
-
function
|
|
2580
|
+
function ea(e, t) {
|
|
2581
2581
|
return ae(e, t).label;
|
|
2582
2582
|
}
|
|
2583
|
-
var
|
|
2583
|
+
var ta = X({
|
|
2584
2584
|
name: "MarkweaveVueFloatingToolbar",
|
|
2585
2585
|
props: {
|
|
2586
2586
|
editor: {
|
|
@@ -2605,10 +2605,10 @@ var ea = X({
|
|
|
2605
2605
|
}
|
|
2606
2606
|
},
|
|
2607
2607
|
setup(e) {
|
|
2608
|
-
let t = K(null), n = K("input"), r = K(""), i = K(""), a = K(""), o = K(""), s =
|
|
2608
|
+
let t = K(null), n = K("input"), r = K(""), i = K(""), a = K(""), o = K(""), s = nr(null), c = nr(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(() => jt(p.value.trim())), x = q(() => e.messages.floatingToolbar), S = q(() => le(e.messages).map((e) => [
|
|
2609
2609
|
e.id,
|
|
2610
2610
|
e.label,
|
|
2611
|
-
|
|
2611
|
+
$i[e.id]
|
|
2612
2612
|
])), C = q(() => ce(e.messages).map((e) => [
|
|
2613
2613
|
e.id,
|
|
2614
2614
|
e.value,
|
|
@@ -2728,9 +2728,9 @@ var ea = X({
|
|
|
2728
2728
|
o.value
|
|
2729
2729
|
], ([e]) => {
|
|
2730
2730
|
e && Y(N.schedule);
|
|
2731
|
-
}), nr(() => {
|
|
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
2731
|
}), rr(() => {
|
|
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
|
+
}), ir(() => {
|
|
2734
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
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) => {
|
|
@@ -2772,7 +2772,7 @@ var ea = X({
|
|
|
2772
2772
|
onMouseenter: (e) => R(n, e.currentTarget),
|
|
2773
2773
|
onMouseleave: () => R(null),
|
|
2774
2774
|
onClick: a
|
|
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" },
|
|
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" }, ea(e.editor, e.messages)), Q(t.value === "block-type" ? Mr : Ar, 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" ? Mr : Ar, 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", {
|
|
@@ -2826,7 +2826,7 @@ var ea = X({
|
|
|
2826
2826
|
onClick: () => {
|
|
2827
2827
|
M();
|
|
2828
2828
|
}
|
|
2829
|
-
}, [Q(
|
|
2829
|
+
}, [Q(yr, e.messages.askAi.send)])]) : null;
|
|
2830
2830
|
return G("section", {
|
|
2831
2831
|
ref: y,
|
|
2832
2832
|
class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
|
|
@@ -2842,7 +2842,7 @@ var ea = X({
|
|
|
2842
2842
|
G("span", {
|
|
2843
2843
|
class: "markweave-ask-ai-sparkles",
|
|
2844
2844
|
"aria-hidden": "true"
|
|
2845
|
-
}, [Q(
|
|
2845
|
+
}, [Q(di, "")]),
|
|
2846
2846
|
G("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
|
|
2847
2847
|
G("button", {
|
|
2848
2848
|
type: "button",
|
|
@@ -2852,15 +2852,15 @@ var ea = X({
|
|
|
2852
2852
|
onClick: () => {
|
|
2853
2853
|
c.value?.abort(), k.cancel(), Ee(e.editor), n.value = "input";
|
|
2854
2854
|
}
|
|
2855
|
-
}, [Q(
|
|
2855
|
+
}, [Q(fi, e.messages.askAi.stop)])
|
|
2856
2856
|
]) : null,
|
|
2857
2857
|
n.value === "result" ? G("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
2858
2858
|
t(e.messages.askAi.retry, () => {
|
|
2859
2859
|
M(i.value);
|
|
2860
|
-
}, "markweave-ask-ai-retry",
|
|
2860
|
+
}, "markweave-ask-ai-retry", ci),
|
|
2861
2861
|
G("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
2862
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
2863
|
-
t(e.messages.askAi.accept, ee, "markweave-ask-ai-accept",
|
|
2862
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Ei),
|
|
2863
|
+
t(e.messages.askAi.accept, ee, "markweave-ask-ai-accept", Or)
|
|
2864
2864
|
]) : null,
|
|
2865
2865
|
n.value === "error" || n.value === "conflict" ? G("div", {
|
|
2866
2866
|
class: "markweave-ask-ai-error",
|
|
@@ -2868,9 +2868,9 @@ var ea = X({
|
|
|
2868
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
2870
|
M(i.value);
|
|
2871
|
-
}, "markweave-ask-ai-retry",
|
|
2871
|
+
}, "markweave-ask-ai-retry", ci) : null,
|
|
2872
2872
|
G("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
2873
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
2873
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Ei)
|
|
2874
2874
|
])]) : null
|
|
2875
2875
|
]);
|
|
2876
2876
|
}
|
|
@@ -2908,7 +2908,7 @@ var ea = X({
|
|
|
2908
2908
|
"aria-label": x.value.applyLink,
|
|
2909
2909
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2910
2910
|
onMousedown: $
|
|
2911
|
-
}, [Q(
|
|
2911
|
+
}, [Q(Fr, x.value.applyLink)]),
|
|
2912
2912
|
G("span", {
|
|
2913
2913
|
class: "markweave-floating-toolbar-link-divider",
|
|
2914
2914
|
"aria-hidden": "true"
|
|
@@ -2919,15 +2919,15 @@ var ea = X({
|
|
|
2919
2919
|
"aria-label": x.value.openLink,
|
|
2920
2920
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2921
2921
|
onMousedown: $,
|
|
2922
|
-
onClick: () =>
|
|
2923
|
-
}, [Q(
|
|
2922
|
+
onClick: () => Yi(p.value)
|
|
2923
|
+
}, [Q(zr, x.value.openLink)]),
|
|
2924
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(
|
|
2930
|
+
}, [Q(xi, x.value.removeLink)])
|
|
2931
2931
|
])]) : t.value === "color" ? G("div", {
|
|
2932
2932
|
ref: y,
|
|
2933
2933
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
@@ -2954,7 +2954,7 @@ var ea = X({
|
|
|
2954
2954
|
onClick: () => {
|
|
2955
2955
|
ue(e.editor, n), t.value = null;
|
|
2956
2956
|
}
|
|
2957
|
-
}, [Q(
|
|
2957
|
+
}, [Q(Xi[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;
|
|
@@ -2988,25 +2988,25 @@ var ea = X({
|
|
|
2988
2988
|
class: "markweave-floating-toolbar-content",
|
|
2989
2989
|
"data-menu": t.value ?? "none"
|
|
2990
2990
|
}, [
|
|
2991
|
-
f.value && Pe(e.editor) ? B("ask-ai", x.value.buttons["ask-ai"],
|
|
2991
|
+
f.value && Pe(e.editor) ? B("ask-ai", x.value.buttons["ask-ai"], di, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
|
|
2992
2992
|
f.value && Pe(e.editor) ? V() : null,
|
|
2993
|
-
B("block-type", x.value.buttons["block-type"],
|
|
2993
|
+
B("block-type", x.value.buttons["block-type"], Si, () => 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, Tr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2996
|
+
B("italic", x.value.buttons.italic, Jr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2997
|
+
B("underline", x.value.buttons.underline, Ci, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2998
|
+
B("strike", x.value.buttons.strike, mi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2999
|
+
B("inline-code", x.value.buttons["inline-code"], Pr, () => 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, Xr, () => O("link"), e.editor.isActive("link")),
|
|
3002
|
+
B("color", x.value.buttons.color, Si, () => O("color"), t.value === "color"),
|
|
3003
3003
|
V(),
|
|
3004
|
-
B("more", x.value.buttons.more,
|
|
3004
|
+
B("more", x.value.buttons.more, ti, () => O("more"), t.value === "more"),
|
|
3005
3005
|
ne(),
|
|
3006
3006
|
te()
|
|
3007
3007
|
])]) });
|
|
3008
3008
|
}
|
|
3009
|
-
}),
|
|
3009
|
+
}), na = X({
|
|
3010
3010
|
name: "MarkweaveVueMathEditorPopover",
|
|
3011
3011
|
props: {
|
|
3012
3012
|
editor: {
|
|
@@ -3027,17 +3027,17 @@ var ea = X({
|
|
|
3027
3027
|
}
|
|
3028
3028
|
},
|
|
3029
3029
|
setup(e) {
|
|
3030
|
-
let t = K(e.target.latex), n =
|
|
3030
|
+
let t = K(e.target.latex), n = nr(null), r = K(null), i = K(null), a = nr(It(e.editor, e.target)), o = q(() => t.value === e.target.latex && a.value ? {
|
|
3031
3031
|
html: a.value,
|
|
3032
3032
|
error: !1
|
|
3033
|
-
} :
|
|
3033
|
+
} : Bt(t.value, e.target.kind, e.editor)), s = q(() => t.value.trim().length > 0), c = q(() => e.messages.math), l = q(() => Ft(e.editor, e.target) ?? 1), u = () => {
|
|
3034
3034
|
if (typeof window > "u") return;
|
|
3035
|
-
let r =
|
|
3035
|
+
let r = Pt(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 = Nt({
|
|
3041
3041
|
anchorRect: r,
|
|
3042
3042
|
frameRect: i,
|
|
3043
3043
|
kind: e.target.kind,
|
|
@@ -3046,7 +3046,7 @@ var ea = X({
|
|
|
3046
3046
|
viewportWidth: window.innerWidth
|
|
3047
3047
|
});
|
|
3048
3048
|
}, d = () => {
|
|
3049
|
-
s.value &&
|
|
3049
|
+
s.value && Mt(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();
|
|
@@ -3058,13 +3058,13 @@ var ea = X({
|
|
|
3058
3058
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
3059
3059
|
};
|
|
3060
3060
|
return J(() => [e.target.pos, e.target.latex], () => {
|
|
3061
|
-
t.value = e.target.latex, a.value =
|
|
3062
|
-
}),
|
|
3063
|
-
|
|
3061
|
+
t.value = e.target.latex, a.value = It(e.editor, e.target), Y(u);
|
|
3062
|
+
}), rr(() => {
|
|
3063
|
+
Vt(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
|
+
}), ir(() => {
|
|
3067
|
+
Vt(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,
|
|
@@ -3125,14 +3125,14 @@ var ea = X({
|
|
|
3125
3125
|
}, [
|
|
3126
3126
|
G("div", { class: "markweave-math-block-toolbar" }, [
|
|
3127
3127
|
G("span", null, c.value.label),
|
|
3128
|
-
Q(
|
|
3128
|
+
Q(Pr, c.value.label, 15, 1.75),
|
|
3129
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(kr, c.value.apply, 16, 2)])
|
|
3136
3136
|
]),
|
|
3137
3137
|
G("label", {
|
|
3138
3138
|
class: "markweave-math-block-source",
|
|
@@ -3155,7 +3155,7 @@ var ea = X({
|
|
|
3155
3155
|
]);
|
|
3156
3156
|
};
|
|
3157
3157
|
}
|
|
3158
|
-
}),
|
|
3158
|
+
}), ra = X({
|
|
3159
3159
|
name: "MarkweaveVueSlashCommandMenu",
|
|
3160
3160
|
props: {
|
|
3161
3161
|
commands: {
|
|
@@ -3341,7 +3341,7 @@ var ea = X({
|
|
|
3341
3341
|
class: "markweave-slash-group",
|
|
3342
3342
|
"aria-label": t.group
|
|
3343
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 =
|
|
3344
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = Xt(t);
|
|
3345
3345
|
return G("button", {
|
|
3346
3346
|
key: t.id,
|
|
3347
3347
|
type: "button",
|
|
@@ -3364,7 +3364,7 @@ var ea = X({
|
|
|
3364
3364
|
}
|
|
3365
3365
|
}
|
|
3366
3366
|
}, [
|
|
3367
|
-
|
|
3367
|
+
Qi(t.icon),
|
|
3368
3368
|
G("span", null, t.label),
|
|
3369
3369
|
t.disabledReason ? G("small", null, t.disabledReason) : null
|
|
3370
3370
|
]);
|
|
@@ -3375,34 +3375,34 @@ var ea = X({
|
|
|
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
|
+
}), ia = {
|
|
3379
|
+
"ask-ai": di,
|
|
3380
|
+
"move-left": _r,
|
|
3381
|
+
"move-right": vr,
|
|
3382
|
+
"move-up": yr,
|
|
3383
|
+
"move-down": hr,
|
|
3384
|
+
"insert-left": wr,
|
|
3385
|
+
"insert-right": Cr,
|
|
3386
|
+
"insert-above": Sr,
|
|
3387
|
+
"insert-below": xr,
|
|
3388
|
+
"sort-asc": gr,
|
|
3389
|
+
"sort-desc": br,
|
|
3390
|
+
color: ni,
|
|
3391
|
+
alignment: lr,
|
|
3392
|
+
clear: pi,
|
|
3393
|
+
duplicate: Ir,
|
|
3394
|
+
copy: Ir,
|
|
3395
|
+
merge: vi,
|
|
3396
|
+
split: yi,
|
|
3397
|
+
delete: xi
|
|
3398
|
+
}, aa = {
|
|
3399
|
+
left: lr,
|
|
3400
|
+
center: sr,
|
|
3401
|
+
right: ur,
|
|
3402
|
+
top: pr,
|
|
3403
|
+
middle: dr,
|
|
3404
|
+
bottom: fr
|
|
3405
|
+
}, oa = X({
|
|
3406
3406
|
name: "MarkweaveVueTableControls",
|
|
3407
3407
|
props: {
|
|
3408
3408
|
editor: {
|
|
@@ -3439,12 +3439,12 @@ var ea = X({
|
|
|
3439
3439
|
}
|
|
3440
3440
|
},
|
|
3441
3441
|
setup(e) {
|
|
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 ?
|
|
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 ? un(e.editor.state) : Ui), T = q(() => kn(e.editor, e.interactionState, "row", w.value.activeCellPos)), E = q(() => kn(e.editor, e.interactionState, "column", w.value.activeCellPos)), D = q(() => Tn(e.editor)), O = q(() => (D.value, w.value.active && Nn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), k = q(() => t.value ? Nn(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
|
-
},
|
|
3447
|
+
}, zn));
|
|
3448
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);
|
|
@@ -3455,26 +3455,26 @@ var ea = 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 ? On(e.editor, T.value) : null, d = E.value ? On(e.editor, E.value) : null, f = O.value ? Pn(e.editor) : null, p = wn(e.editor)?.getBoundingClientRect() ?? null;
|
|
3459
|
+
u ? i.value = yn({
|
|
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 = yn({
|
|
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 = yn({
|
|
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 ? bn({
|
|
3474
3474
|
tableRect: p,
|
|
3475
3475
|
frameRect: l,
|
|
3476
3476
|
kind: "row"
|
|
3477
|
-
}) : null, c.value = p && h ?
|
|
3477
|
+
}) : null, c.value = p && h ? bn({
|
|
3478
3478
|
tableRect: p,
|
|
3479
3479
|
frameRect: l,
|
|
3480
3480
|
kind: "column"
|
|
@@ -3489,16 +3489,16 @@ var ea = 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" ? wn(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 = _n({
|
|
3499
3499
|
anchorRect: s,
|
|
3500
3500
|
frameRect: c,
|
|
3501
|
-
boundaryRect:
|
|
3501
|
+
boundaryRect: An(n),
|
|
3502
3502
|
menuSize: {
|
|
3503
3503
|
width: u.width || 254,
|
|
3504
3504
|
height: f || u.height || 410
|
|
@@ -3516,10 +3516,10 @@ var ea = 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 = vn({
|
|
3520
3520
|
triggerRect: i.getBoundingClientRect(),
|
|
3521
3521
|
parentMenuRect: _.value.getBoundingClientRect(),
|
|
3522
|
-
boundaryRect:
|
|
3522
|
+
boundaryRect: An(r),
|
|
3523
3523
|
submenuSize: {
|
|
3524
3524
|
width: a.width || 238,
|
|
3525
3525
|
height: o || 410
|
|
@@ -3533,16 +3533,16 @@ var ea = X({
|
|
|
3533
3533
|
let a = t.value === e && r.value === i;
|
|
3534
3534
|
r.value = i, t.value = a ? null : e, n.value = null, u.value = null, F();
|
|
3535
3535
|
}, L = () => {
|
|
3536
|
-
e.editor.view.dispatch(
|
|
3536
|
+
e.editor.view.dispatch(sn(e.editor.state.tr, null));
|
|
3537
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 &&
|
|
3539
|
+
r !== null && Ln(e.editor, r, t, { visualIndex: i }), I(t, n);
|
|
3540
3540
|
}, te = () => {
|
|
3541
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 Sn({
|
|
3546
3546
|
editor: e.editor,
|
|
3547
3547
|
commandId: n,
|
|
3548
3548
|
menu: r ?? t.value ?? "selection",
|
|
@@ -3555,7 +3555,7 @@ var ea = X({
|
|
|
3555
3555
|
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, F());
|
|
3556
3556
|
}, U = (t) => {
|
|
3557
3557
|
let n = t === "row" ? T.value : E.value, r = e.interactionState.hoverCellPos ?? w.value.activeCellPos;
|
|
3558
|
-
!n || r === null ||
|
|
3558
|
+
!n || r === null || Un(e.editor, r, t, { visualIndex: n.index }) && B(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
3559
3559
|
}, ne = (e, t, n) => {
|
|
3560
3560
|
x = {
|
|
3561
3561
|
axis: e,
|
|
@@ -3563,14 +3563,14 @@ var ea = X({
|
|
|
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 = En(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
|
-
}, W = q(() => (f.value, t.value === "row" || t.value === "column" ?
|
|
3571
|
+
let r = En(e.editor, n.axis, t.clientX, t.clientY) ?? S;
|
|
3572
|
+
t.preventDefault(), x = null, S = null, r !== null && In(e.editor, n.axis, n.index, r);
|
|
3573
|
+
}, W = q(() => (f.value, t.value === "row" || t.value === "column" ? Dn(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;
|
|
@@ -3587,9 +3587,9 @@ var ea = X({
|
|
|
3587
3587
|
}, se = (e) => {
|
|
3588
3588
|
t.value && (e.target instanceof Node && p.value?.contains(e.target) || z());
|
|
3589
3589
|
};
|
|
3590
|
-
|
|
3590
|
+
rr(() => {
|
|
3591
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
|
-
}),
|
|
3592
|
+
}), ir(() => {
|
|
3593
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
3594
|
}), J(() => [
|
|
3595
3595
|
e.active,
|
|
@@ -3606,7 +3606,7 @@ var ea = X({
|
|
|
3606
3606
|
let ce = () => {
|
|
3607
3607
|
if (!t.value) return null;
|
|
3608
3608
|
let r = k.value.map((r, i) => {
|
|
3609
|
-
let a =
|
|
3609
|
+
let a = jn(r), o = i === 0 ? a : jn(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) : xn(e.editor, r.commandId), u = Mn(r, e.messages), d = ia[r.icon];
|
|
3610
3610
|
return G("button", {
|
|
3611
3611
|
key: `${r.id}-${i}`,
|
|
3612
3612
|
type: "button",
|
|
@@ -3650,7 +3650,7 @@ var ea = X({
|
|
|
3650
3650
|
strokeWidth: 1.8
|
|
3651
3651
|
})]),
|
|
3652
3652
|
G("span", { class: "markweave-table-menu-item-label" }, u),
|
|
3653
|
-
r.submenuId ? G(
|
|
3653
|
+
r.submenuId ? G(jr, {
|
|
3654
3654
|
class: "markweave-table-menu-chevron",
|
|
3655
3655
|
size: 16,
|
|
3656
3656
|
"aria-hidden": "true"
|
|
@@ -3677,7 +3677,7 @@ var ea = X({
|
|
|
3677
3677
|
onKeydown: oe
|
|
3678
3678
|
}, [
|
|
3679
3679
|
G("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
|
|
3680
|
-
...
|
|
3680
|
+
...Rn.map((t) => G("button", {
|
|
3681
3681
|
key: `text-${t.id}`,
|
|
3682
3682
|
type: "button",
|
|
3683
3683
|
role: "menuitemradio",
|
|
@@ -3685,7 +3685,7 @@ var ea = X({
|
|
|
3685
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) =>
|
|
3688
|
+
onClick: () => H((n) => gn(e.editor, n, t.id))
|
|
3689
3689
|
}, [G("span", {
|
|
3690
3690
|
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3691
3691
|
"aria-hidden": "true",
|
|
@@ -3693,7 +3693,7 @@ var ea = X({
|
|
|
3693
3693
|
}), G("span", null, e.messages.table.colors[t.id].text)])),
|
|
3694
3694
|
G("div", { class: "markweave-table-submenu-separator" }),
|
|
3695
3695
|
G("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
|
|
3696
|
-
...
|
|
3696
|
+
...Rn.map((t) => G("button", {
|
|
3697
3697
|
key: `background-${t.id}`,
|
|
3698
3698
|
type: "button",
|
|
3699
3699
|
role: "menuitemradio",
|
|
@@ -3701,7 +3701,7 @@ var ea = X({
|
|
|
3701
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) =>
|
|
3704
|
+
onClick: () => H((n) => hn(e.editor, n, t.id))
|
|
3705
3705
|
}, [G("span", {
|
|
3706
3706
|
class: "markweave-table-color-swatch",
|
|
3707
3707
|
"aria-hidden": "true",
|
|
@@ -3709,7 +3709,7 @@ var ea = X({
|
|
|
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 =
|
|
3712
|
+
let r = aa[t];
|
|
3713
3713
|
return G("button", {
|
|
3714
3714
|
key: t,
|
|
3715
3715
|
type: "button",
|
|
@@ -3718,7 +3718,7 @@ var ea = X({
|
|
|
3718
3718
|
"data-active": n ? "true" : "false",
|
|
3719
3719
|
"data-testid": `markweave-table-alignment-${t}`,
|
|
3720
3720
|
onMousedown: $,
|
|
3721
|
-
onClick: () => H((n) =>
|
|
3721
|
+
onClick: () => H((n) => mn(e.editor, n, t))
|
|
3722
3722
|
}, [G(r, {
|
|
3723
3723
|
size: 18,
|
|
3724
3724
|
strokeWidth: 1.8,
|
|
@@ -3740,16 +3740,16 @@ var ea = X({
|
|
|
3740
3740
|
} : void 0,
|
|
3741
3741
|
onKeydown: oe
|
|
3742
3742
|
}, [
|
|
3743
|
-
...
|
|
3743
|
+
...Bn.map((e) => t(e, W.value?.textAlign === e)),
|
|
3744
3744
|
G("div", { class: "markweave-table-submenu-separator" }),
|
|
3745
|
-
...
|
|
3745
|
+
...Hn.map((e) => t(e, W.value?.verticalAlign === e))
|
|
3746
3746
|
]));
|
|
3747
3747
|
}
|
|
3748
3748
|
return G("div", {
|
|
3749
3749
|
ref: _,
|
|
3750
3750
|
class: "markweave-table-menu",
|
|
3751
3751
|
role: "menu",
|
|
3752
|
-
"aria-label":
|
|
3752
|
+
"aria-label": Vn(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,
|
|
@@ -3768,7 +3768,7 @@ var ea = X({
|
|
|
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(pn, { type: "clear-hover" }))
|
|
3772
3772
|
}, [
|
|
3773
3773
|
d.value ? G("div", {
|
|
3774
3774
|
class: "markweave-table-copy-feedback",
|
|
@@ -3778,7 +3778,7 @@ var ea = 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
|
-
},
|
|
3781
|
+
}, Cn(d.value)) : null,
|
|
3782
3782
|
i.value ? G("button", {
|
|
3783
3783
|
ref: m,
|
|
3784
3784
|
type: "button",
|
|
@@ -3805,7 +3805,7 @@ var ea = X({
|
|
|
3805
3805
|
onDragend: () => {
|
|
3806
3806
|
x = null, S = null;
|
|
3807
3807
|
}
|
|
3808
|
-
}, [G(
|
|
3808
|
+
}, [G(ti, {
|
|
3809
3809
|
size: 14,
|
|
3810
3810
|
"aria-hidden": "true"
|
|
3811
3811
|
})]) : null,
|
|
@@ -3835,7 +3835,7 @@ var ea = X({
|
|
|
3835
3835
|
onDragend: () => {
|
|
3836
3836
|
x = null, S = null;
|
|
3837
3837
|
}
|
|
3838
|
-
}, [G(
|
|
3838
|
+
}, [G(ti, {
|
|
3839
3839
|
size: 14,
|
|
3840
3840
|
"aria-hidden": "true"
|
|
3841
3841
|
})]) : null,
|
|
@@ -3856,7 +3856,7 @@ var ea = X({
|
|
|
3856
3856
|
},
|
|
3857
3857
|
onMousedown: $,
|
|
3858
3858
|
onClick: te
|
|
3859
|
-
}, [G(
|
|
3859
|
+
}, [G(ti, {
|
|
3860
3860
|
size: 14,
|
|
3861
3861
|
"aria-hidden": "true"
|
|
3862
3862
|
})]) : null,
|
|
@@ -3874,7 +3874,7 @@ var ea = X({
|
|
|
3874
3874
|
},
|
|
3875
3875
|
onMousedown: $,
|
|
3876
3876
|
onClick: () => U("row")
|
|
3877
|
-
}, [G(
|
|
3877
|
+
}, [G(ai, {
|
|
3878
3878
|
size: 14,
|
|
3879
3879
|
"aria-hidden": "true"
|
|
3880
3880
|
})]) : null,
|
|
@@ -3892,14 +3892,14 @@ var ea = X({
|
|
|
3892
3892
|
},
|
|
3893
3893
|
onMousedown: $,
|
|
3894
3894
|
onClick: () => U("column")
|
|
3895
|
-
}, [G(
|
|
3895
|
+
}, [G(ai, {
|
|
3896
3896
|
size: 14,
|
|
3897
3897
|
"aria-hidden": "true"
|
|
3898
3898
|
})]) : null,
|
|
3899
3899
|
ce()
|
|
3900
3900
|
]) : null;
|
|
3901
3901
|
}
|
|
3902
|
-
}),
|
|
3902
|
+
}), sa = X({
|
|
3903
3903
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
3904
3904
|
props: {
|
|
3905
3905
|
editor: {
|
|
@@ -3917,11 +3917,11 @@ var ea = X({
|
|
|
3917
3917
|
t.value = null;
|
|
3918
3918
|
return;
|
|
3919
3919
|
}
|
|
3920
|
-
t.value =
|
|
3920
|
+
t.value = Fn(e.editor, dn(e.editor.state));
|
|
3921
3921
|
};
|
|
3922
|
-
return
|
|
3922
|
+
return rr(() => {
|
|
3923
3923
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
3924
|
-
}),
|
|
3924
|
+
}), ir(() => {
|
|
3925
3925
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
3926
3926
|
}), J(() => [
|
|
3927
3927
|
e.focusState.activeCellPos,
|
|
@@ -3956,7 +3956,7 @@ var ea = X({
|
|
|
3956
3956
|
}) : null;
|
|
3957
3957
|
};
|
|
3958
3958
|
}
|
|
3959
|
-
}),
|
|
3959
|
+
}), ca = X({
|
|
3960
3960
|
name: "MarkweaveVueCodeBlockControls",
|
|
3961
3961
|
props: {
|
|
3962
3962
|
editor: {
|
|
@@ -3989,16 +3989,16 @@ var ea = X({
|
|
|
3989
3989
|
active: !1,
|
|
3990
3990
|
lastX: 0,
|
|
3991
3991
|
lastY: 0
|
|
3992
|
-
}), b = K(0), x = K(0), S = K(0), C = null, w = q(() => (S.value,
|
|
3992
|
+
}), b = K(0), x = K(0), S = K(0), C = null, w = q(() => (S.value, bt(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 = q(() => w.value ?? T.value), D = q(() => E.value !== null), O = q(() => E.value?.language === "mermaid"), k = q(() =>
|
|
3996
|
+
} : null), E = q(() => w.value ?? T.value), D = q(() => E.value !== null), O = q(() => E.value?.language === "mermaid"), k = q(() => Tt(e.editor, E.value)), A = q(() => D.value && E.value !== null && !k.value), j = q(() => !e.readOnly), M = q(() => E.value ? pt(E.value.language) : pt("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, Ct(e.editor))), I = q(() => `${x.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = q(() => _t(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
|
+
}, ot));
|
|
4002
4002
|
}, B = () => {
|
|
4003
4003
|
g.value = null, _.value = null, v.value = !1, y.value = {
|
|
4004
4004
|
active: !1,
|
|
@@ -4008,15 +4008,15 @@ var ea = X({
|
|
|
4008
4008
|
}, H = () => {
|
|
4009
4009
|
let n = t.value;
|
|
4010
4010
|
if (!n) return;
|
|
4011
|
-
if (!
|
|
4011
|
+
if (!xt(n) || F.value.length === 0) {
|
|
4012
4012
|
l.value = [];
|
|
4013
4013
|
return;
|
|
4014
4014
|
}
|
|
4015
4015
|
let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
|
|
4016
|
-
let n = ht(
|
|
4017
|
-
return n ? [
|
|
4016
|
+
let n = gt(ht(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
4017
|
+
return n ? [dt(t, n, r)] : [];
|
|
4018
4018
|
});
|
|
4019
|
-
l.value =
|
|
4019
|
+
l.value = Et(l.value, i, F.value.map((e) => e.pos));
|
|
4020
4020
|
}, U = () => {
|
|
4021
4021
|
if (!A.value || !E.value) {
|
|
4022
4022
|
c.value = null, u.value = null;
|
|
@@ -4024,14 +4024,14 @@ var ea = X({
|
|
|
4024
4024
|
}
|
|
4025
4025
|
let i = t.value;
|
|
4026
4026
|
if (!i) return;
|
|
4027
|
-
let a =
|
|
4027
|
+
let a = ht(e.editor, E.value.pos, N.value), o = i.getBoundingClientRect(), s = gt(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 = lt(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 = it({
|
|
4035
4035
|
overlayRect: o,
|
|
4036
4036
|
buttonRect: e,
|
|
4037
4037
|
menuHeight: t,
|
|
@@ -4042,33 +4042,33 @@ var ea = X({
|
|
|
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 st(E.value.text);
|
|
4046
|
+
z($e(E.value, e ? "copied" : "failed"));
|
|
4047
4047
|
return;
|
|
4048
4048
|
}
|
|
4049
|
-
if (!
|
|
4050
|
-
let t = await
|
|
4051
|
-
z(Qe(
|
|
4049
|
+
if (!ft(e.editor, E.value)) return;
|
|
4050
|
+
let t = await Ze(e.editor);
|
|
4051
|
+
z($e(Qe(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
4052
4052
|
}, re = (t, n) => {
|
|
4053
4053
|
if (e.readOnly) {
|
|
4054
|
-
|
|
4054
|
+
qt(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
|
-
|
|
4058
|
+
rt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
|
|
4059
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
|
-
|
|
4062
|
+
nt(e.editor, E.value.pos, t) && (t === "mermaid" && rt(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
4063
|
}, W = () => {
|
|
4064
|
-
d.value = !d.value, d.value && o.value === null && (o.value =
|
|
4064
|
+
d.value = !d.value, d.value && o.value === null && (o.value = ct()), p.value = d.value ? St(L.value, E.value?.language ?? null) : -1;
|
|
4065
4065
|
}, ae = (e) => {
|
|
4066
|
-
let t =
|
|
4067
|
-
f.value = e, p.value =
|
|
4066
|
+
let t = _t(e);
|
|
4067
|
+
f.value = e, p.value = St(t, e.trim() ? null : E.value?.language ?? null);
|
|
4068
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 = Ot(p.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
4072
4072
|
return;
|
|
4073
4073
|
}
|
|
4074
4074
|
if (t.key === "Enter") {
|
|
@@ -4079,10 +4079,10 @@ var ea = X({
|
|
|
4079
4079
|
t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
|
|
4080
4080
|
}
|
|
4081
4081
|
}, se = () => {
|
|
4082
|
-
e.readOnly || !E.value ||
|
|
4082
|
+
e.readOnly || !E.value || tt(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
|
|
4083
4083
|
}, ce = () => {
|
|
4084
4084
|
if (!E.value) return;
|
|
4085
|
-
let t =
|
|
4085
|
+
let t = wt(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",
|
|
@@ -4091,8 +4091,8 @@ var ea = X({
|
|
|
4091
4091
|
});
|
|
4092
4092
|
}, le = () => {
|
|
4093
4093
|
if (!E.value) return;
|
|
4094
|
-
let t =
|
|
4095
|
-
t && (g.value =
|
|
4094
|
+
let t = wt(e.editor, E.value.pos);
|
|
4095
|
+
t && (g.value = ut(t), _.value = null, v.value = !1, y.value = {
|
|
4096
4096
|
active: !1,
|
|
4097
4097
|
lastX: 0,
|
|
4098
4098
|
lastY: 0
|
|
@@ -4100,16 +4100,16 @@ var ea = X({
|
|
|
4100
4100
|
}, ue = (e) => {
|
|
4101
4101
|
g.value = g.value ? {
|
|
4102
4102
|
...g.value,
|
|
4103
|
-
scale:
|
|
4103
|
+
scale: at(g.value.scale + e)
|
|
4104
4104
|
} : null;
|
|
4105
4105
|
}, de = () => {
|
|
4106
|
-
g.value = g.value ?
|
|
4106
|
+
g.value = g.value ? ut(g.value.svg) : null, y.value = {
|
|
4107
4107
|
active: !1,
|
|
4108
4108
|
lastX: 0,
|
|
4109
4109
|
lastY: 0
|
|
4110
4110
|
}, v.value = !1;
|
|
4111
4111
|
}, fe = (e) => {
|
|
4112
|
-
e.preventDefault(), ue(e.deltaY < 0 ?
|
|
4112
|
+
e.preventDefault(), ue(e.deltaY < 0 ? Dt : -Dt);
|
|
4113
4113
|
}, pe = (e) => {
|
|
4114
4114
|
e.button === 0 && (e.preventDefault(), y.value = {
|
|
4115
4115
|
active: !0,
|
|
@@ -4124,7 +4124,7 @@ var ea = X({
|
|
|
4124
4124
|
active: !0,
|
|
4125
4125
|
lastX: e.clientX,
|
|
4126
4126
|
lastY: e.clientY
|
|
4127
|
-
}, g.value =
|
|
4127
|
+
}, g.value = kt(g.value, n, r);
|
|
4128
4128
|
}, he = () => {
|
|
4129
4129
|
y.value = {
|
|
4130
4130
|
active: !1,
|
|
@@ -4150,7 +4150,7 @@ var ea = 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 &&
|
|
4153
|
+
e && t && At(e, t);
|
|
4154
4154
|
}, { flush: "post" }), J(() => [
|
|
4155
4155
|
A.value,
|
|
4156
4156
|
b.value,
|
|
@@ -4170,11 +4170,11 @@ var ea = X({
|
|
|
4170
4170
|
immediate: !0
|
|
4171
4171
|
});
|
|
4172
4172
|
let ge = null;
|
|
4173
|
-
return
|
|
4173
|
+
return rr(() => {
|
|
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 = yt(e.editor, n.target), i = bt(e.editor, r), a = i && !Tt(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,13 +4189,13 @@ var ea = 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(Xe) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Xe) || Wt(e)) && (S.value += 1);
|
|
4193
4193
|
};
|
|
4194
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
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
|
-
}),
|
|
4198
|
+
}), ir(() => {
|
|
4199
4199
|
ge?.(), ge = null, te();
|
|
4200
4200
|
}), () => {
|
|
4201
4201
|
if (!A.value && F.value.length === 0 && !g.value) return null;
|
|
@@ -4256,7 +4256,7 @@ var ea = X({
|
|
|
4256
4256
|
"data-testid": "markweave-codeblock-language",
|
|
4257
4257
|
onMousedown: $,
|
|
4258
4258
|
onClick: W
|
|
4259
|
-
}, [G("span", null, M.value),
|
|
4259
|
+
}, [G("span", null, M.value), Ji("chevron")]),
|
|
4260
4260
|
j.value ? G("button", {
|
|
4261
4261
|
type: "button",
|
|
4262
4262
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
@@ -4266,7 +4266,7 @@ var ea = X({
|
|
|
4266
4266
|
"data-collapsed": k.value ? "true" : "false",
|
|
4267
4267
|
onMousedown: $,
|
|
4268
4268
|
onClick: se
|
|
4269
|
-
}, [
|
|
4269
|
+
}, [Ji("chevron")]) : null,
|
|
4270
4270
|
G("span", { class: "markweave-codeblock-copy-wrap" }, [G("button", {
|
|
4271
4271
|
type: "button",
|
|
4272
4272
|
class: "markweave-codeblock-icon-button",
|
|
@@ -4289,7 +4289,7 @@ var ea = X({
|
|
|
4289
4289
|
onClick: () => {
|
|
4290
4290
|
ne();
|
|
4291
4291
|
}
|
|
4292
|
-
}, [
|
|
4292
|
+
}, [Ji(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"
|
|
@@ -4305,7 +4305,7 @@ var ea = X({
|
|
|
4305
4305
|
disabled: !P.value,
|
|
4306
4306
|
onMousedown: $,
|
|
4307
4307
|
onClick: le
|
|
4308
|
-
}, [
|
|
4308
|
+
}, [Ji("expand")]), G("button", {
|
|
4309
4309
|
type: "button",
|
|
4310
4310
|
class: "markweave-codeblock-icon-button",
|
|
4311
4311
|
"aria-label": "Download Mermaid SVG",
|
|
@@ -4313,7 +4313,7 @@ var ea = X({
|
|
|
4313
4313
|
disabled: !P.value,
|
|
4314
4314
|
onMousedown: $,
|
|
4315
4315
|
onClick: ce
|
|
4316
|
-
}, [
|
|
4316
|
+
}, [Ji("download")])]) : null
|
|
4317
4317
|
]) : null,
|
|
4318
4318
|
j.value && A.value && d.value && E.value ? G("div", {
|
|
4319
4319
|
ref: r,
|
|
@@ -4327,7 +4327,7 @@ var ea = X({
|
|
|
4327
4327
|
"aria-autocomplete": "list",
|
|
4328
4328
|
"aria-controls": o.value ?? void 0,
|
|
4329
4329
|
"aria-expanded": "true",
|
|
4330
|
-
"aria-activedescendant": o.value && L.value[p.value] ?
|
|
4330
|
+
"aria-activedescendant": o.value && L.value[p.value] ? vt(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...",
|
|
@@ -4336,7 +4336,7 @@ var ea = X({
|
|
|
4336
4336
|
ae(e.target.value);
|
|
4337
4337
|
},
|
|
4338
4338
|
onKeydown: oe
|
|
4339
|
-
}),
|
|
4339
|
+
}), Ji("search")]), G("div", {
|
|
4340
4340
|
ref: a,
|
|
4341
4341
|
id: o.value ?? void 0,
|
|
4342
4342
|
class: "markweave-codeblock-language-list",
|
|
@@ -4346,7 +4346,7 @@ var ea = X({
|
|
|
4346
4346
|
let n = E.value?.language === e.language, r = t === p.value;
|
|
4347
4347
|
return G("button", {
|
|
4348
4348
|
key: e.language,
|
|
4349
|
-
id: o.value ?
|
|
4349
|
+
id: o.value ? vt(o.value, e.language) : void 0,
|
|
4350
4350
|
type: "button",
|
|
4351
4351
|
role: "option",
|
|
4352
4352
|
"aria-selected": n ? "true" : "false",
|
|
@@ -4359,7 +4359,7 @@ var ea = X({
|
|
|
4359
4359
|
p.value = t;
|
|
4360
4360
|
},
|
|
4361
4361
|
onClick: () => ie(e.language)
|
|
4362
|
-
}, [G("span", null, e.label), n ?
|
|
4362
|
+
}, [G("span", null, e.label), n ? Ji("check") : null]);
|
|
4363
4363
|
}))]) : null,
|
|
4364
4364
|
g.value ? G("div", {
|
|
4365
4365
|
class: "markweave-mermaid-fullscreen-layer",
|
|
@@ -4389,12 +4389,12 @@ var ea = X({
|
|
|
4389
4389
|
onBlur: () => {
|
|
4390
4390
|
_.value = null;
|
|
4391
4391
|
},
|
|
4392
|
-
onClick: () => ue(-
|
|
4393
|
-
}, [
|
|
4392
|
+
onClick: () => ue(-Dt)
|
|
4393
|
+
}, [Ji("zoomOut")]),
|
|
4394
4394
|
G("span", {
|
|
4395
4395
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
4396
4396
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
4397
|
-
},
|
|
4397
|
+
}, mt(g.value.scale)),
|
|
4398
4398
|
G("button", {
|
|
4399
4399
|
type: "button",
|
|
4400
4400
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -4412,8 +4412,8 @@ var ea = X({
|
|
|
4412
4412
|
onBlur: () => {
|
|
4413
4413
|
_.value = null;
|
|
4414
4414
|
},
|
|
4415
|
-
onClick: () => ue(
|
|
4416
|
-
}, [
|
|
4415
|
+
onClick: () => ue(Dt)
|
|
4416
|
+
}, [Ji("zoomIn")]),
|
|
4417
4417
|
G("button", {
|
|
4418
4418
|
type: "button",
|
|
4419
4419
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -4432,7 +4432,7 @@ var ea = X({
|
|
|
4432
4432
|
_.value = null;
|
|
4433
4433
|
},
|
|
4434
4434
|
onClick: de
|
|
4435
|
-
}, [
|
|
4435
|
+
}, [Ji("reset")]),
|
|
4436
4436
|
_.value ? G("span", {
|
|
4437
4437
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
4438
4438
|
role: "tooltip",
|
|
@@ -4445,7 +4445,7 @@ var ea = X({
|
|
|
4445
4445
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
4446
4446
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
4447
4447
|
onClick: B
|
|
4448
|
-
}, [
|
|
4448
|
+
}, [Ji("close")]),
|
|
4449
4449
|
G("div", {
|
|
4450
4450
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
4451
4451
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
@@ -4471,7 +4471,7 @@ var ea = X({
|
|
|
4471
4471
|
]);
|
|
4472
4472
|
};
|
|
4473
4473
|
}
|
|
4474
|
-
}),
|
|
4474
|
+
}), la = X({
|
|
4475
4475
|
name: "MarkweaveVueInnerToc",
|
|
4476
4476
|
props: {
|
|
4477
4477
|
editor: {
|
|
@@ -4496,10 +4496,16 @@ var ea = X({
|
|
|
4496
4496
|
}
|
|
4497
4497
|
},
|
|
4498
4498
|
setup(e) {
|
|
4499
|
-
let t = K(null), n, r = () => {
|
|
4499
|
+
let t = K(null), n, r, i = () => {
|
|
4500
4500
|
n?.(), n = e.placement === "container" && t.value ? qe(t.value) : void 0;
|
|
4501
|
+
}, a = () => {
|
|
4502
|
+
r?.(), r = t.value && e.state.items.length ? Je(t.value, e.state.items.length) : void 0;
|
|
4501
4503
|
};
|
|
4502
|
-
return
|
|
4504
|
+
return rr(() => {
|
|
4505
|
+
i(), a();
|
|
4506
|
+
}), ir(() => {
|
|
4507
|
+
n?.(), r?.();
|
|
4508
|
+
}), J(() => e.placement, i), J(() => e.state.items.length, a, { flush: "post" }), () => e.state.items.length ? G("nav", {
|
|
4503
4509
|
ref: t,
|
|
4504
4510
|
class: "markweave-inner-toc",
|
|
4505
4511
|
"data-testid": "markweave-inner-toc",
|
|
@@ -4521,15 +4527,15 @@ var ea = X({
|
|
|
4521
4527
|
"aria-current": t.active ? "location" : void 0,
|
|
4522
4528
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
4523
4529
|
title: t.text,
|
|
4524
|
-
onClick: () =>
|
|
4530
|
+
onClick: () => Ye(e.editor, t, {
|
|
4525
4531
|
behavior: "smooth",
|
|
4526
4532
|
focus: e.editable
|
|
4527
4533
|
})
|
|
4528
4534
|
}, t.text)))])]) : null;
|
|
4529
4535
|
}
|
|
4530
4536
|
});
|
|
4531
|
-
function
|
|
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 =
|
|
4537
|
+
function ua(e = {}) {
|
|
4538
|
+
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 = nr(null), h = K(an), g = nr(null), _ = nr(null), v = K("code"), y = nr(null), b = nr(fn), x = K(null), S = K(!1), C = nr(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;
|
|
4533
4539
|
function O() {
|
|
4534
4540
|
D !== null && (window.clearTimeout(D), D = null), d.value += 1;
|
|
4535
4541
|
}
|
|
@@ -4538,9 +4544,9 @@ function la(e = {}) {
|
|
|
4538
4544
|
D = null, d.value += 1;
|
|
4539
4545
|
}, _e);
|
|
4540
4546
|
}
|
|
4541
|
-
let A = e.onSlashCommandUpload, j =
|
|
4547
|
+
let A = e.onSlashCommandUpload, j = nr(null);
|
|
4542
4548
|
j.value = new a({
|
|
4543
|
-
extensions:
|
|
4549
|
+
extensions: Hi({
|
|
4544
4550
|
lang: i,
|
|
4545
4551
|
linkCardResolver: e.linkCardResolver,
|
|
4546
4552
|
onImageUpload: (e) => A?.(e) ?? L(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
@@ -4563,16 +4569,16 @@ function la(e = {}) {
|
|
|
4563
4569
|
},
|
|
4564
4570
|
handleClick: (e, t, n) => {
|
|
4565
4571
|
if (!u.value) return fe(n);
|
|
4566
|
-
let r =
|
|
4567
|
-
return r ? (n.preventDefault(), n.stopPropagation(), I(),
|
|
4572
|
+
let r = Rt(e, n);
|
|
4573
|
+
return r ? (n.preventDefault(), n.stopPropagation(), I(), Ht(e, r, !0), Ut(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
4568
4574
|
},
|
|
4569
4575
|
handleDOMEvents: {
|
|
4570
|
-
compositionstart: () => u.value ? (h.value =
|
|
4576
|
+
compositionstart: () => u.value ? (h.value = on(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
4571
4577
|
compositionend: (e) => (u.value && window.setTimeout(() => R(e), 0), !1),
|
|
4572
4578
|
click: (e, t) => {
|
|
4573
4579
|
if (!u.value) return fe(t);
|
|
4574
|
-
let n =
|
|
4575
|
-
return n ? (t.preventDefault(), t.stopPropagation(), I(),
|
|
4580
|
+
let n = Rt(e, t);
|
|
4581
|
+
return n ? (t.preventDefault(), t.stopPropagation(), I(), Ht(e, n, !0), Ut(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
4576
4582
|
}
|
|
4577
4583
|
}
|
|
4578
4584
|
},
|
|
@@ -4581,11 +4587,11 @@ function la(e = {}) {
|
|
|
4581
4587
|
p(t, {
|
|
4582
4588
|
mode: c.value,
|
|
4583
4589
|
editable: u.value
|
|
4584
|
-
}),
|
|
4590
|
+
}), Gt(t, l.value), Kt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && ln(t), V(t), z(t), O();
|
|
4585
4591
|
},
|
|
4586
4592
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
4587
|
-
if (V(e), (t.docChanged ||
|
|
4588
|
-
let t =
|
|
4593
|
+
if (V(e), (t.docChanged || Wt(t)) && k(), t.docChanged && y.value) {
|
|
4594
|
+
let t = Lt(e, y.value.pos);
|
|
4589
4595
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
4590
4596
|
}
|
|
4591
4597
|
},
|
|
@@ -4606,24 +4612,24 @@ function la(e = {}) {
|
|
|
4606
4612
|
});
|
|
4607
4613
|
let F = q(() => j.value ?? null);
|
|
4608
4614
|
function I() {
|
|
4609
|
-
g.value = null, _.value = null, h.value =
|
|
4615
|
+
g.value = null, _.value = null, h.value = an;
|
|
4610
4616
|
}
|
|
4611
4617
|
function R(e) {
|
|
4612
|
-
let t =
|
|
4618
|
+
let t = nn(e.state);
|
|
4613
4619
|
if (!t) {
|
|
4614
|
-
h.value = h.value.name === "idle" ? h.value :
|
|
4620
|
+
h.value = h.value.name === "idle" ? h.value : an, g.value = null, _.value = null;
|
|
4615
4621
|
return;
|
|
4616
4622
|
}
|
|
4617
4623
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
4618
|
-
if (!
|
|
4624
|
+
if (!rn(r, { frameRect: i })) {
|
|
4619
4625
|
I();
|
|
4620
4626
|
return;
|
|
4621
4627
|
}
|
|
4622
|
-
let a =
|
|
4628
|
+
let a = tn(n, {
|
|
4623
4629
|
frameRect: i,
|
|
4624
4630
|
triggerRect: r
|
|
4625
4631
|
});
|
|
4626
|
-
|
|
4632
|
+
Qt(g.value, a) || (g.value = a), h.value = en(h.value, t);
|
|
4627
4633
|
}
|
|
4628
4634
|
function te(e) {
|
|
4629
4635
|
R(e.view);
|
|
@@ -4631,23 +4637,23 @@ function la(e = {}) {
|
|
|
4631
4637
|
function z(e) {
|
|
4632
4638
|
let t = ge(e);
|
|
4633
4639
|
me(m.value, t) || (m.value = t);
|
|
4634
|
-
let n =
|
|
4635
|
-
n && (
|
|
4636
|
-
let r =
|
|
4640
|
+
let n = zt(e);
|
|
4641
|
+
n && (Vt(e, n, !0), y.value = n);
|
|
4642
|
+
let r = Qe(e);
|
|
4637
4643
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
4638
4644
|
}
|
|
4639
4645
|
function V(e) {
|
|
4640
|
-
b.value =
|
|
4646
|
+
b.value = Gi(e);
|
|
4641
4647
|
}
|
|
4642
|
-
let ae = q(() => F.value ?
|
|
4648
|
+
let ae = q(() => F.value ? Qe(F.value) : Wi), oe = q(() => F.value ? un(F.value.state) : Ui), se = q(() => m.value?.currentNode === "codeBlock"), ce = q(() => se.value && ae.value.language === "mermaid"), le = q(() => F.value ? Jt({
|
|
4643
4649
|
active: ce.value,
|
|
4644
4650
|
mode: v.value,
|
|
4645
4651
|
source: ae.value.text
|
|
4646
|
-
}) :
|
|
4652
|
+
}) : Jt({
|
|
4647
4653
|
active: !1,
|
|
4648
4654
|
mode: "code",
|
|
4649
4655
|
source: ""
|
|
4650
|
-
})), ue = q(() => F.value && e.onRuntimeStateChange ?
|
|
4656
|
+
})), ue = q(() => F.value && e.onRuntimeStateChange ? cn(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(() => Yt(h.value.query, s)), Se = q(() => pe({
|
|
4651
4657
|
revision: d.value,
|
|
4652
4658
|
mode: c.value,
|
|
4653
4659
|
editable: u.value,
|
|
@@ -4661,35 +4667,35 @@ function la(e = {}) {
|
|
|
4661
4667
|
tableDebugSnapshot: ue.value
|
|
4662
4668
|
})), Ce = {
|
|
4663
4669
|
closeSlashMenu: I,
|
|
4664
|
-
focusFirstTableBodyCell: () => F.value ?
|
|
4670
|
+
focusFirstTableBodyCell: () => F.value ? ln(F.value) : !1,
|
|
4665
4671
|
setContent: (e, t = {}) => {
|
|
4666
4672
|
if (!F.value) return !1;
|
|
4667
4673
|
let n = W(t.format);
|
|
4668
4674
|
return F.value.commands.setContent(e, {
|
|
4669
4675
|
contentType: ne(n),
|
|
4670
4676
|
emitUpdate: t.emitUpdate ?? !1
|
|
4671
|
-
}), t.focusFirstTableBodyCell &&
|
|
4677
|
+
}), t.focusFirstTableBodyCell && ln(F.value), z(F.value), u.value && te(F.value), V(F.value), O(), !0;
|
|
4672
4678
|
}
|
|
4673
4679
|
};
|
|
4674
4680
|
function we(e, t) {
|
|
4675
|
-
if (!(!F.value || !u.value || !
|
|
4681
|
+
if (!(!F.value || !u.value || !Xt(e))) {
|
|
4676
4682
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
4677
4683
|
_.value = e;
|
|
4678
4684
|
return;
|
|
4679
4685
|
}
|
|
4680
|
-
|
|
4686
|
+
$t(F.value, h.value, e, t), h.value = on(h.value, { type: "execute" }), I();
|
|
4681
4687
|
}
|
|
4682
4688
|
}
|
|
4683
4689
|
function Te(e) {
|
|
4684
4690
|
if (!F.value || _.value || !u.value) return;
|
|
4685
|
-
let t =
|
|
4691
|
+
let t = Zt(h.value, ye.value, e.key, { isComposing: e.isComposing || B(F.value.state) });
|
|
4686
4692
|
if (t.type !== "ignore") {
|
|
4687
4693
|
if (e.preventDefault(), t.type === "close") {
|
|
4688
|
-
h.value =
|
|
4694
|
+
h.value = on(h.value, { type: "escape" }), I();
|
|
4689
4695
|
return;
|
|
4690
4696
|
}
|
|
4691
4697
|
if (t.type === "move-active") {
|
|
4692
|
-
h.value =
|
|
4698
|
+
h.value = on(h.value, {
|
|
4693
4699
|
type: "move-active",
|
|
4694
4700
|
delta: t.delta,
|
|
4695
4701
|
optionCount: t.optionCount
|
|
@@ -4703,9 +4709,9 @@ function la(e = {}) {
|
|
|
4703
4709
|
c.value = f(e.mode), F.value && (F.value.setEditable(u.value), p(F.value, {
|
|
4704
4710
|
mode: c.value,
|
|
4705
4711
|
editable: u.value
|
|
4706
|
-
}),
|
|
4712
|
+
}), Kt(F.value, u.value ? "live" : "view"), O(), u.value || I());
|
|
4707
4713
|
}, { immediate: !0 }), J(() => e.theme, () => {
|
|
4708
|
-
F.value &&
|
|
4714
|
+
F.value && Gt(F.value, l.value);
|
|
4709
4715
|
}, { immediate: !0 }), J(() => e.content, (t) => {
|
|
4710
4716
|
let n = W(e.contentFormat);
|
|
4711
4717
|
if (!(!F.value || t === void 0)) {
|
|
@@ -4729,15 +4735,15 @@ function la(e = {}) {
|
|
|
4729
4735
|
};
|
|
4730
4736
|
J(g, (e) => {
|
|
4731
4737
|
e ? De() : Ee.cancel();
|
|
4732
|
-
}), nr(() => {
|
|
4733
|
-
window.addEventListener("resize", De), window.addEventListener("scroll", De, !0);
|
|
4734
4738
|
}), rr(() => {
|
|
4739
|
+
window.addEventListener("resize", De), window.addEventListener("scroll", De, !0);
|
|
4740
|
+
}), ir(() => {
|
|
4735
4741
|
Ee.cancel(), window.removeEventListener("resize", De), window.removeEventListener("scroll", De, !0);
|
|
4736
4742
|
});
|
|
4737
4743
|
let Oe = null;
|
|
4738
|
-
return
|
|
4744
|
+
return ir(() => {
|
|
4739
4745
|
D !== null && window.clearTimeout(D);
|
|
4740
|
-
}),
|
|
4746
|
+
}), rr(() => {
|
|
4741
4747
|
let e = () => {
|
|
4742
4748
|
if (!F.value || !de.value.length) {
|
|
4743
4749
|
x.value = null;
|
|
@@ -4750,11 +4756,11 @@ function la(e = {}) {
|
|
|
4750
4756
|
return;
|
|
4751
4757
|
}
|
|
4752
4758
|
x.value !== e && (x.value = e);
|
|
4753
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
4759
|
+
}, t = () => window.requestAnimationFrame(e), n = Ki(F.value?.view.dom ?? null);
|
|
4754
4760
|
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
|
|
4755
4761
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
4756
4762
|
};
|
|
4757
|
-
}),
|
|
4763
|
+
}), ir(() => {
|
|
4758
4764
|
Oe?.(), N = !0, P && e.onAiEditControllerChange?.(null);
|
|
4759
4765
|
let t = j.value;
|
|
4760
4766
|
j.value = null, Y(() => t?.destroy());
|
|
@@ -4787,7 +4793,7 @@ function la(e = {}) {
|
|
|
4787
4793
|
}
|
|
4788
4794
|
};
|
|
4789
4795
|
}
|
|
4790
|
-
var
|
|
4796
|
+
var da = X({
|
|
4791
4797
|
name: "MarkweaveEditor",
|
|
4792
4798
|
props: {
|
|
4793
4799
|
defaultContent: {
|
|
@@ -4904,7 +4910,7 @@ var ua = X({
|
|
|
4904
4910
|
}
|
|
4905
4911
|
},
|
|
4906
4912
|
setup(e) {
|
|
4907
|
-
let t =
|
|
4913
|
+
let t = ua(e);
|
|
4908
4914
|
return () => {
|
|
4909
4915
|
let n = t.editor.value;
|
|
4910
4916
|
if (!n) return null;
|
|
@@ -4922,13 +4928,13 @@ var ua = X({
|
|
|
4922
4928
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
4923
4929
|
onKeydownCapture: i.handleEditorKeyDown
|
|
4924
4930
|
}, [
|
|
4925
|
-
i.effectiveEditable.value ? G(
|
|
4931
|
+
i.effectiveEditable.value ? G(ta, {
|
|
4926
4932
|
editor: n,
|
|
4927
4933
|
lang: r(e.lang),
|
|
4928
4934
|
messages: i.messages,
|
|
4929
4935
|
askAi: e.askAi
|
|
4930
4936
|
}) : null,
|
|
4931
|
-
i.effectiveEditable.value ? G(
|
|
4937
|
+
i.effectiveEditable.value ? G(ra, {
|
|
4932
4938
|
commands: i.filteredSlashCommands.value,
|
|
4933
4939
|
state: i.slashState.value,
|
|
4934
4940
|
position: i.slashMenuPosition.value,
|
|
@@ -4938,7 +4944,7 @@ var ua = X({
|
|
|
4938
4944
|
onInputCommandChange: i.setSlashInputCommand,
|
|
4939
4945
|
onUpload: e.onSlashCommandUpload
|
|
4940
4946
|
}) : null,
|
|
4941
|
-
i.effectiveEditable.value ? G(
|
|
4947
|
+
i.effectiveEditable.value ? G(oa, {
|
|
4942
4948
|
editor: n,
|
|
4943
4949
|
active: i.tableFocusState.value.active,
|
|
4944
4950
|
interactionState: i.tableInteractionState.value,
|
|
@@ -4948,11 +4954,11 @@ var ua = X({
|
|
|
4948
4954
|
onCommandResult: e.onTableCommandResult,
|
|
4949
4955
|
onEditWithAi: e.onEditWithAi
|
|
4950
4956
|
}) : null,
|
|
4951
|
-
i.effectiveEditable.value ? G(
|
|
4957
|
+
i.effectiveEditable.value ? G(sa, {
|
|
4952
4958
|
editor: n,
|
|
4953
4959
|
focusState: i.tableFocusState.value
|
|
4954
4960
|
}) : null,
|
|
4955
|
-
G(
|
|
4961
|
+
G(ca, {
|
|
4956
4962
|
editor: n,
|
|
4957
4963
|
state: i.codeBlockState.value,
|
|
4958
4964
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -4960,14 +4966,14 @@ var ua = X({
|
|
|
4960
4966
|
onMermaidModeChange: i.setMermaidMode,
|
|
4961
4967
|
readOnly: !i.effectiveEditable.value
|
|
4962
4968
|
}),
|
|
4963
|
-
e.innerToc && i.tocState.value.items.length ? G(
|
|
4969
|
+
e.innerToc && i.tocState.value.items.length ? G(la, {
|
|
4964
4970
|
editor: n,
|
|
4965
4971
|
state: i.tocState.value,
|
|
4966
4972
|
messages: i.messages,
|
|
4967
4973
|
editable: i.effectiveEditable.value,
|
|
4968
4974
|
placement: Ke(e.innerTocPlacement)
|
|
4969
4975
|
}) : null,
|
|
4970
|
-
i.effectiveEditable.value && i.mathTarget.value ? G(
|
|
4976
|
+
i.effectiveEditable.value && i.mathTarget.value ? G(na, {
|
|
4971
4977
|
editor: n,
|
|
4972
4978
|
messages: i.messages,
|
|
4973
4979
|
target: i.mathTarget.value,
|
|
@@ -4979,4 +4985,4 @@ var ua = X({
|
|
|
4979
4985
|
}
|
|
4980
4986
|
});
|
|
4981
4987
|
//#endregion
|
|
4982
|
-
export {
|
|
4988
|
+
export { da as MarkweaveEditor, te as createMarkweaveAiEditController, Hi as createMarkweaveEditorExtensions, Hi as createMarkweaveVue2EditorExtensions, ua as useMarkweaveEditorController };
|