@markweave/vue2 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +392 -388
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -21,44 +21,44 @@ import { createMarkweaveEditorUpdatePayload as ie, getMarkweaveContentType as ae
|
|
|
21
21
|
import { getCurrentFloatingToolbarBlockType as ce, getFloatingToolbarHighlightColorOptions as le, getFloatingToolbarMoreActions as ue, getFloatingToolbarTextColorOptions as de, getFloatingToolbarTurnIntoOptions as fe, runFloatingToolbarMoreAction as pe, setFloatingToolbarTurnInto as me } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
22
22
|
import { openMarkweaveReadonlyLinkFromEvent as he } from "markweave/internal/editor-core/readonly-link";
|
|
23
23
|
import { createMarkweaveEditorRuntimeSnapshot as ge } from "markweave/internal/editor-core/runtime-snapshot";
|
|
24
|
-
import { areEditorSelectionSnapshotsEquivalent as _e, calculateFloatingToolbarPopoverPlacement as ve, createSelectionSnapshot as ye, markweaveRuntimeProjectionDelayMs as be,
|
|
24
|
+
import { areEditorSelectionSnapshotsEquivalent as _e, calculateFloatingToolbarPopoverPlacement as ve, createSelectionSnapshot as ye, markweaveRuntimeProjectionDelayMs as be, shouldShowFloatingToolbarForAiState as xe } from "markweave/internal/editor-core/selection-state";
|
|
25
25
|
import { normalizeMarkweaveCanvasColor as Se, normalizeMarkweaveTheme as Ce } from "markweave/internal/core/theme";
|
|
26
26
|
import { createMarkweaveAiEditController as we } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
|
|
27
|
-
import { MarkweaveAskAiError as Te, acceptMarkweaveAskAiResult as Ee, calculateMarkweaveAskAiPanelPosition as De, canStartMarkweaveAskAiTableTarget as Oe, clearMarkweaveAskAiPreview as ke, clearMarkweaveAskAiTarget as Ae, createMarkweaveAskAiRequest as je, getMappedMarkweaveAskAiSelection as Me, getMarkweaveAskAiSurfaceRect as Ne, getMarkweaveAskAiTarget as Pe, getMarkweaveAskAiTargetRect as Fe,
|
|
28
|
-
import { createMarkweaveTocState as
|
|
29
|
-
import { codeBlockCollapsePluginKey as
|
|
30
|
-
import { calculateCodeBlockLanguageMenuPosition as
|
|
31
|
-
import { normalizeMarkdownLinkHref as
|
|
32
|
-
import { applyMarkweaveMathLatex as
|
|
33
|
-
import { isMermaidInlinePreviewTransaction as
|
|
34
|
-
import { getMermaidPreviewState as
|
|
35
|
-
import { filterSlashCommands as
|
|
36
|
-
import { getSlashCommandKeyboardAction as
|
|
37
|
-
import { areSlashCommandMenuPositionsEquivalent as
|
|
38
|
-
import { initialSlashCommandState as
|
|
39
|
-
import { setMarkweaveTableMenuAxisTarget as
|
|
40
|
-
import { getFirstTableDebugSnapshot as
|
|
41
|
-
import { focusFirstTableBodyCell as
|
|
42
|
-
import { getTableFocusState as
|
|
43
|
-
import { getTableSelectionOverlayState as
|
|
44
|
-
import { applyTableAxisAlignment as
|
|
27
|
+
import { MarkweaveAskAiError as Te, acceptMarkweaveAskAiResult as Ee, calculateMarkweaveAskAiPanelPosition as De, canStartMarkweaveAskAiTableTarget as Oe, clearMarkweaveAskAiPreview as ke, clearMarkweaveAskAiTarget as Ae, createMarkweaveAskAiRequest as je, getMappedMarkweaveAskAiSelection as Me, getMarkweaveAskAiSurfaceRect as Ne, getMarkweaveAskAiTarget as Pe, getMarkweaveAskAiTargetRect as Fe, hasMarkweaveAskAiPreview as Ie, isMarkweaveAskAiSelectionEligible as Le, restoreMarkweaveAskAiTargetSelection as Re, runMarkweaveAskAiHandler as ze, setMarkweaveAskAiPreview as Be, startMarkweaveAskAiTableTarget as Ve, startMarkweaveAskAiTarget as He } from "markweave/internal/plugins/ask-ai/ask-ai-session";
|
|
28
|
+
import { createMarkweaveTocState as Ue, emptyMarkweaveTocState as We, getActiveMarkweaveTocId as Ge, getMarkweaveTocItemsFromState as Ke, getValidMarkweaveTocActiveId as qe, normalizeMarkweaveInnerTocPlacement as Je, observeMarkweaveInnerTocContainerPosition as Ye, scrollToMarkweaveTocItem as Xe } from "markweave/internal/core/toc-state";
|
|
29
|
+
import { codeBlockCollapsePluginKey as Ze, copyActiveCodeBlock as Qe, getActiveCodeBlockState as $e, getCodeBlockCopyFeedbackSnapshot as et, markweaveCodeBlockBehavior as tt, setCodeBlockCollapsedAtPosition as nt, setCodeBlockLanguageAtPosition as rt, setCodeBlockMermaidPreviewModeAtPosition as it } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
30
|
+
import { calculateCodeBlockLanguageMenuPosition as at, clampFullscreenScale as ot, codeBlockCopyFeedbackTimeoutMs as st, copyCodeBlockText as ct, createCodeBlockLanguageMenuDomId as lt, createCodeBlockOverlayPosition as ut, createMermaidFullscreenViewerState as dt, createMermaidTabPosition as ft, focusCodeBlockTarget as pt, formatCodeBlockLanguageLabel as mt, formatFullscreenZoom as ht, getActiveCodeBlockElement as gt, getAnchoredRect as _t, getCodeBlockLanguageItems as vt, getCodeBlockLanguageOptionDomId as yt, getCodeBlockPositionFromEventTarget as bt, getCodeBlockStateAtPosition as xt, getFrameElement as St, getInitialCodeBlockLanguageItemIndex as Ct, getMermaidCodeBlockTargets as wt, getMermaidSvgMarkup as Tt, isCodeBlockTargetCollapsed as Et, mergeStableMermaidTabPositions as Dt, mermaidFullscreenZoomStep as Ot, moveCodeBlockLanguageItemIndex as kt, moveMermaidFullscreenViewer as At, scrollCodeBlockLanguageItemIntoView as jt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
31
|
+
import { normalizeMarkdownLinkHref as Mt } from "markweave/internal/plugins/markdown/markdown-input";
|
|
32
|
+
import { applyMarkweaveMathLatex as Nt, calculateMarkweaveMathPopoverPosition as Pt, getMarkweaveMathAnchorRect as Ft, getMarkweaveMathBlockIndex as It, getMarkweaveMathRenderedHtml as Lt, getMarkweaveMathTargetAtPos as Rt, getMarkweaveMathTargetFromDomEvent as zt, getMarkweaveMathTargetFromSelection as Bt, renderMarkweaveMathPreview as Vt, setMarkweaveMathEditingDomState as Ht, setMarkweaveMathEditingDomStateInView as Ut, setMarkweaveMathSelectionInView as Wt } from "markweave/internal/plugins/math/math-ui-model";
|
|
33
|
+
import { isMermaidInlinePreviewTransaction as Gt, setMarkweaveMermaidTheme as Kt, setMermaidInlinePreviewEditorMode as qt, setReadonlyMermaidPreviewMode as Jt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
34
|
+
import { getMermaidPreviewState as Yt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
35
|
+
import { filterSlashCommands as Xt, isExecutableSlashCommand as Zt } from "markweave/internal/plugins/slash-command/command-spec";
|
|
36
|
+
import { getSlashCommandKeyboardAction as Qt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
37
|
+
import { areSlashCommandMenuPositionsEquivalent as $t, executeSlashCommand as en, getNextSlashCommandState as tn, getSlashCommandAnchoredMenuPosition as nn, getSlashCommandContext as rn, isSlashCommandAnchorVisible as an } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
38
|
+
import { initialSlashCommandState as on, reduceSlashCommandState as sn } from "markweave/internal/plugins/slash-command/slash-state";
|
|
39
|
+
import { setMarkweaveTableMenuAxisTarget as cn } from "markweave/internal/plugins/table/table-clipboard";
|
|
40
|
+
import { getFirstTableDebugSnapshot as ln } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
41
|
+
import { focusFirstTableBodyCell as un } from "markweave/internal/plugins/table/table-focus-position";
|
|
42
|
+
import { getTableFocusState as dn } from "markweave/internal/plugins/table/table-focus-state";
|
|
43
|
+
import { getTableSelectionOverlayState as fn, initialTableInteractionState as pn, tableInteractionPluginKey as mn } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
44
|
+
import { applyTableAxisAlignment as hn, applyTableAxisBackgroundColor as gn, applyTableAxisTextColor as _n, calculateAnchoredTableMenuPosition as vn, calculateAnchoredTableSubmenuPosition as yn, calculateTableAxisHandleLayout as bn, calculateTableExtendButtonLayout as xn, canRunTableCommand as Sn, executeTableMenuCommand as Cn, formatTableCopyFeedback as wn, getActiveTableElement as Tn, getAvailableCellMenuCommandSpecs as En, getTableAxisDropIndexAtPoint as Dn, getTableAxisFormattingState as On, getTableAxisTargetRect as kn, getTableControlAxisSelectionModel as An, getTableMenuBoundaryRect as jn, getTableMenuItemGroup as Mn, getTableMenuItemLabel as Nn, getTableMenuItems as Pn, getTableSelectionTargetRect as Fn, measureTableSelectionOverlay as In, moveTargetedTableAxis as Ln, selectTableAxisFromCell as Rn, tableColorOptions as zn, tableCopyFeedbackTimeoutMs as Bn, tableHorizontalAlignmentOptions as Vn, tableMenuLabel as Hn, tableVerticalAlignmentOptions as Un, targetTableAxisFromCell as Wn } from "markweave/internal/plugins/table/table-ui-model";
|
|
45
45
|
//#region src/vue2-compat.ts
|
|
46
|
-
var
|
|
47
|
-
function
|
|
46
|
+
var Gn = l.default ?? l, Kn = null, qn = null, Jn = null;
|
|
47
|
+
function Yn(e) {
|
|
48
48
|
return !!(e && typeof e == "object" && "value" in e);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Xn(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 Zn(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" && Yn(s)) {
|
|
62
62
|
a.insert = (e) => {
|
|
63
63
|
s.value = e.elm;
|
|
64
64
|
}, a.destroy = () => {
|
|
@@ -67,7 +67,7 @@ function Xn(e) {
|
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
69
|
if (/^on[A-Z]/.test(o)) {
|
|
70
|
-
i[
|
|
70
|
+
i[Xn(o)] = s;
|
|
71
71
|
continue;
|
|
72
72
|
}
|
|
73
73
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -78,14 +78,14 @@ function Xn(e) {
|
|
|
78
78
|
}
|
|
79
79
|
return Object.keys(n).length && (t.attrs = n), Object.keys(r).length && (t.domProps = r), Object.keys(i).length && (t.on = i), Object.keys(a).length && (t.hook = a), t;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function Qn(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" && Yn(o)) {
|
|
89
89
|
i.insert = (e) => {
|
|
90
90
|
o.value = e.componentInstance ?? e.elm;
|
|
91
91
|
}, i.destroy = () => {
|
|
@@ -101,25 +101,25 @@ function Zn(e) {
|
|
|
101
101
|
}
|
|
102
102
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function $n(e) {
|
|
105
105
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function er(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 tr(e) {
|
|
111
111
|
return e == null || Array.isArray(e) ? e : [e];
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
return typeof e == "function" ?
|
|
113
|
+
function nr(e) {
|
|
114
|
+
return typeof e == "function" ? tr(e()) : $n(e) ? tr(e.default()) : er(e) ? [e] : e;
|
|
115
115
|
}
|
|
116
116
|
function H(e, t, n) {
|
|
117
|
-
if (!
|
|
118
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
119
|
-
return
|
|
117
|
+
if (!Jn) throw Error("Vue 2 render context is not available.");
|
|
118
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Zn(r) : Qn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : nr(n);
|
|
119
|
+
return Jn(e, i, a);
|
|
120
120
|
}
|
|
121
121
|
function U(e) {
|
|
122
|
-
return
|
|
122
|
+
return Gn.observable({ value: e });
|
|
123
123
|
}
|
|
124
124
|
var W = U;
|
|
125
125
|
function G(e) {
|
|
@@ -129,19 +129,19 @@ function G(e) {
|
|
|
129
129
|
}
|
|
130
130
|
function K(e, t, n) {
|
|
131
131
|
let r = typeof e == "function" ? e : () => e.value;
|
|
132
|
-
return
|
|
132
|
+
return Kn?.$watch ? Kn.$watch(r, t, n) : () => void 0;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
|
|
134
|
+
function rr(e) {
|
|
135
|
+
qn?.mounted.push(e);
|
|
136
136
|
}
|
|
137
137
|
function q(e) {
|
|
138
|
-
|
|
138
|
+
qn?.beforeUnmount.push(e);
|
|
139
139
|
}
|
|
140
140
|
function J(e) {
|
|
141
|
-
return
|
|
141
|
+
return Gn.nextTick(e);
|
|
142
142
|
}
|
|
143
143
|
function Y(e) {
|
|
144
|
-
return
|
|
144
|
+
return Gn.extend({
|
|
145
145
|
name: e.name,
|
|
146
146
|
props: e.props,
|
|
147
147
|
created() {
|
|
@@ -149,12 +149,12 @@ function Y(e) {
|
|
|
149
149
|
mounted: [],
|
|
150
150
|
beforeUnmount: []
|
|
151
151
|
};
|
|
152
|
-
|
|
152
|
+
Kn = this, qn = 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
|
+
Kn = null, qn = null;
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
160
|
mounted() {
|
|
@@ -164,19 +164,19 @@ function Y(e) {
|
|
|
164
164
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
165
165
|
},
|
|
166
166
|
render(t) {
|
|
167
|
-
|
|
167
|
+
Jn = t;
|
|
168
168
|
try {
|
|
169
169
|
let n = this.__markweaveVue2Render;
|
|
170
170
|
return n ? n() : e.render?.(t) ?? null;
|
|
171
171
|
} finally {
|
|
172
|
-
|
|
172
|
+
Jn = null;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
//#endregion
|
|
178
178
|
//#region src/vue2-icons.ts
|
|
179
|
-
var
|
|
179
|
+
var ir = {
|
|
180
180
|
AlignVerticalJustifyCenter: {
|
|
181
181
|
iconName: "align-vertical-justify-center",
|
|
182
182
|
node: [
|
|
@@ -1498,7 +1498,7 @@ var rr = {
|
|
|
1498
1498
|
}]]
|
|
1499
1499
|
}
|
|
1500
1500
|
};
|
|
1501
|
-
function
|
|
1501
|
+
function ar(e) {
|
|
1502
1502
|
return e.map(([e, t]) => H(e, t));
|
|
1503
1503
|
}
|
|
1504
1504
|
function X(e) {
|
|
@@ -1519,7 +1519,7 @@ function X(e) {
|
|
|
1519
1519
|
}
|
|
1520
1520
|
},
|
|
1521
1521
|
setup(t) {
|
|
1522
|
-
let n =
|
|
1522
|
+
let n = ir[e];
|
|
1523
1523
|
return () => H("svg", {
|
|
1524
1524
|
class: `lucide lucide-${n.iconName}`,
|
|
1525
1525
|
viewBox: "0 0 24 24",
|
|
@@ -1532,12 +1532,12 @@ function X(e) {
|
|
|
1532
1532
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1533
1533
|
"aria-hidden": "true",
|
|
1534
1534
|
focusable: "false"
|
|
1535
|
-
},
|
|
1535
|
+
}, ar(n.node));
|
|
1536
1536
|
}
|
|
1537
1537
|
});
|
|
1538
1538
|
}
|
|
1539
|
-
var
|
|
1540
|
-
function
|
|
1539
|
+
var or = X("AlignCenter"), sr = X("AlignJustify"), cr = X("AlignLeft"), lr = X("AlignRight"), ur = X("AlignVerticalJustifyCenter"), dr = X("AlignVerticalJustifyEnd"), fr = X("AlignVerticalJustifyStart"), pr = X("AlertTriangle"), mr = X("ArrowDown"), hr = X("ArrowDownAZ"), gr = X("ArrowLeft"), _r = X("ArrowRight"), vr = X("ArrowUp"), yr = X("ArrowUpZA"), br = X("BetweenHorizontalEnd"), xr = X("BetweenHorizontalStart"), Sr = X("BetweenVerticalEnd"), Cr = X("BetweenVerticalStart"), wr = X("Bold"), Tr = X("Braces"), Er = X("Captions"), Dr = X("Check"), Or = X("CheckCircle2"), kr = X("ChevronDown"), Ar = X("ChevronRight"), jr = X("ChevronUp"), Mr = X("CircleX"), Nr = X("Code2"), Pr = X("CornerDownLeft"), Fr = X("Copy"), Ir = X("Download"), Lr = X("Eye"), Rr = X("ExternalLink"), zr = X("Heading1"), Br = X("Heading2"), Vr = X("Heading3"), Hr = X("Image"), Ur = X("ImageUp"), Wr = X("IndentDecrease"), Gr = X("IndentIncrease"), Kr = X("Info"), qr = X("Italic"), Jr = X("Lightbulb"), Yr = X("Link2"), Xr = X("List"), Zr = X("ListChecks"), Qr = X("ListOrdered"), $r = X("Minus"), ei = X("MoreVertical"), ti = X("PaintBucket"), ni = X("Paperclip"), ri = X("PencilLine"), ii = X("Plus"), ai = X("Quote"), oi = X("Replace"), si = X("RotateCcw"), ci = X("Sigma"), li = X("SmilePlus"), ui = X("Sparkles"), di = X("Square"), fi = X("SquareX"), pi = X("Strikethrough"), mi = X("Subscript"), hi = X("Superscript"), gi = X("Table2"), _i = X("TableCellsMerge"), vi = X("TableCellsSplit"), yi = X("Text"), bi = X("Trash2"), xi = X("Type"), Si = X("Underline"), Ci = X("Upload"), wi = X("Video"), Ti = X("X"), Ei = ee;
|
|
1540
|
+
function Di(e) {
|
|
1541
1541
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1542
1542
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1543
1543
|
return n === "view" ? {
|
|
@@ -1559,23 +1559,23 @@ function Ei(e) {
|
|
|
1559
1559
|
i(), a?.disconnect();
|
|
1560
1560
|
}), r;
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1562
|
+
function Oi(e) {
|
|
1563
1563
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1564
1564
|
}
|
|
1565
|
-
function
|
|
1565
|
+
function ki(e) {
|
|
1566
1566
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1567
1567
|
}
|
|
1568
|
-
function
|
|
1568
|
+
function Ai(e) {
|
|
1569
1569
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1571
|
+
function ji(e, t) {
|
|
1572
1572
|
return H(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 Mi(e) {
|
|
1579
1579
|
return H("button", {
|
|
1580
1580
|
type: "button",
|
|
1581
1581
|
"aria-label": e.label,
|
|
@@ -1584,12 +1584,12 @@ function ji(e) {
|
|
|
1584
1584
|
"data-active": e.active ? "true" : "false",
|
|
1585
1585
|
onMousedown: (e) => e.preventDefault(),
|
|
1586
1586
|
onClick: e.onClick
|
|
1587
|
-
}, [
|
|
1587
|
+
}, [ji(e.icon, e.label), H("span", {
|
|
1588
1588
|
class: "markweave-image-tooltip",
|
|
1589
1589
|
role: "tooltip"
|
|
1590
1590
|
}, e.label)]);
|
|
1591
1591
|
}
|
|
1592
|
-
function
|
|
1592
|
+
function Ni(e) {
|
|
1593
1593
|
let t = U(null), n = e.messages.image;
|
|
1594
1594
|
return H("section", {
|
|
1595
1595
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1623,7 +1623,7 @@ function Mi(e) {
|
|
|
1623
1623
|
H("div", {
|
|
1624
1624
|
class: "markweave-image-upload-icon",
|
|
1625
1625
|
"aria-hidden": "true"
|
|
1626
|
-
}, [H(
|
|
1626
|
+
}, [H(Ur, {
|
|
1627
1627
|
size: 46,
|
|
1628
1628
|
strokeWidth: 1.6
|
|
1629
1629
|
})]),
|
|
@@ -1648,7 +1648,7 @@ function Mi(e) {
|
|
|
1648
1648
|
"data-testid": "markweave-image-upload-submit",
|
|
1649
1649
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1650
1650
|
onClick: e.onSubmit
|
|
1651
|
-
}, [H(
|
|
1651
|
+
}, [H(Ur, {
|
|
1652
1652
|
size: 16,
|
|
1653
1653
|
strokeWidth: 1.8
|
|
1654
1654
|
}), e.messages.common.insert]),
|
|
@@ -1664,7 +1664,7 @@ function Mi(e) {
|
|
|
1664
1664
|
}, e.error) : null
|
|
1665
1665
|
]);
|
|
1666
1666
|
}
|
|
1667
|
-
function
|
|
1667
|
+
function Pi(e) {
|
|
1668
1668
|
let t = U(null), n = e.messages.video;
|
|
1669
1669
|
return H("section", {
|
|
1670
1670
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1698,7 +1698,7 @@ function Ni(e) {
|
|
|
1698
1698
|
H("div", {
|
|
1699
1699
|
class: "markweave-video-upload-icon",
|
|
1700
1700
|
"aria-hidden": "true"
|
|
1701
|
-
}, [H(
|
|
1701
|
+
}, [H(wi, {
|
|
1702
1702
|
size: 46,
|
|
1703
1703
|
strokeWidth: 1.6
|
|
1704
1704
|
})]),
|
|
@@ -1723,7 +1723,7 @@ function Ni(e) {
|
|
|
1723
1723
|
"data-testid": "markweave-video-upload-submit",
|
|
1724
1724
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1725
1725
|
onClick: e.onSubmit
|
|
1726
|
-
}, [H(
|
|
1726
|
+
}, [H(Ci, {
|
|
1727
1727
|
size: 16,
|
|
1728
1728
|
strokeWidth: 1.8
|
|
1729
1729
|
}), e.messages.common.insert]),
|
|
@@ -1739,7 +1739,7 @@ function Ni(e) {
|
|
|
1739
1739
|
}, e.error) : null
|
|
1740
1740
|
]);
|
|
1741
1741
|
}
|
|
1742
|
-
var
|
|
1742
|
+
var Fi = Y({
|
|
1743
1743
|
name: "MarkweaveVueImageNodeView",
|
|
1744
1744
|
props: {
|
|
1745
1745
|
editor: {
|
|
@@ -1772,7 +1772,7 @@ var Pi = Y({
|
|
|
1772
1772
|
}
|
|
1773
1773
|
},
|
|
1774
1774
|
setup(e) {
|
|
1775
|
-
let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!F(u.value.caption)), p = U(F(u.value.caption) ?? ""), m =
|
|
1775
|
+
let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!F(u.value.caption)), p = U(F(u.value.caption) ?? ""), m = Di(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => F(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
|
|
1776
1776
|
K(v, (t) => {
|
|
1777
1777
|
if (C?.abort(), C = null, !t) {
|
|
1778
1778
|
x.value = null;
|
|
@@ -1793,7 +1793,7 @@ var Pi = Y({
|
|
|
1793
1793
|
r.signal.aborted || (x.value = e);
|
|
1794
1794
|
});
|
|
1795
1795
|
}, { immediate: !0 }), q(() => C?.abort());
|
|
1796
|
-
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() =>
|
|
1796
|
+
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => Ei(u.value.align)), D = G(() => P(u.value.width)), A = G(() => F(u.value.caption)), M = G(() => 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 Pi = Y({
|
|
|
1866
1866
|
"data-selected": "false",
|
|
1867
1867
|
"data-hovered": "false",
|
|
1868
1868
|
"data-empty": "true"
|
|
1869
|
-
}, () =>
|
|
1869
|
+
}, () => Ni({
|
|
1870
1870
|
messages: g.value,
|
|
1871
1871
|
inputValue: o.value,
|
|
1872
1872
|
error: c.value,
|
|
@@ -1896,7 +1896,7 @@ var Pi = Y({
|
|
|
1896
1896
|
r.value = !1;
|
|
1897
1897
|
},
|
|
1898
1898
|
onMousedown: (e) => {
|
|
1899
|
-
h.value && !
|
|
1899
|
+
h.value && !Oi(e.target) && N();
|
|
1900
1900
|
}
|
|
1901
1901
|
}, () => [
|
|
1902
1902
|
h.value ? H("div", {
|
|
@@ -1905,24 +1905,24 @@ var Pi = Y({
|
|
|
1905
1905
|
"data-markweave-image-ui": "true",
|
|
1906
1906
|
"aria-label": _.value.toolsAriaLabel
|
|
1907
1907
|
}, [
|
|
1908
|
-
|
|
1908
|
+
Mi({
|
|
1909
1909
|
testId: "markweave-image-align-left",
|
|
1910
1910
|
label: _.value.alignLeft,
|
|
1911
|
-
icon:
|
|
1911
|
+
icon: cr,
|
|
1912
1912
|
active: E.value === "left",
|
|
1913
1913
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1914
1914
|
}),
|
|
1915
|
-
|
|
1915
|
+
Mi({
|
|
1916
1916
|
testId: "markweave-image-align-center",
|
|
1917
1917
|
label: _.value.alignCenter,
|
|
1918
|
-
icon:
|
|
1918
|
+
icon: or,
|
|
1919
1919
|
active: E.value === "center",
|
|
1920
1920
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1921
1921
|
}),
|
|
1922
|
-
|
|
1922
|
+
Mi({
|
|
1923
1923
|
testId: "markweave-image-align-right",
|
|
1924
1924
|
label: _.value.alignRight,
|
|
1925
|
-
icon:
|
|
1925
|
+
icon: lr,
|
|
1926
1926
|
active: E.value === "right",
|
|
1927
1927
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1928
1928
|
}),
|
|
@@ -1930,31 +1930,31 @@ var Pi = Y({
|
|
|
1930
1930
|
class: "markweave-image-toolbar-divider",
|
|
1931
1931
|
"aria-hidden": "true"
|
|
1932
1932
|
}),
|
|
1933
|
-
|
|
1933
|
+
Mi({
|
|
1934
1934
|
testId: "markweave-image-caption",
|
|
1935
1935
|
label: _.value.caption,
|
|
1936
|
-
icon:
|
|
1936
|
+
icon: Er,
|
|
1937
1937
|
active: f.value || !!A.value,
|
|
1938
1938
|
onClick: re
|
|
1939
1939
|
}),
|
|
1940
|
-
|
|
1940
|
+
Mi({
|
|
1941
1941
|
testId: "markweave-image-preview",
|
|
1942
1942
|
label: _.value.preview,
|
|
1943
|
-
icon:
|
|
1943
|
+
icon: Lr,
|
|
1944
1944
|
onClick: ee
|
|
1945
1945
|
}),
|
|
1946
|
-
|
|
1946
|
+
Mi({
|
|
1947
1947
|
testId: "markweave-image-download",
|
|
1948
1948
|
label: _.value.download,
|
|
1949
|
-
icon:
|
|
1949
|
+
icon: Ir,
|
|
1950
1950
|
onClick: () => {
|
|
1951
1951
|
w.value && j(w.value);
|
|
1952
1952
|
}
|
|
1953
1953
|
}),
|
|
1954
|
-
|
|
1954
|
+
Mi({
|
|
1955
1955
|
testId: "markweave-image-replace",
|
|
1956
1956
|
label: _.value.replace,
|
|
1957
|
-
icon:
|
|
1957
|
+
icon: oi,
|
|
1958
1958
|
onClick: () => {
|
|
1959
1959
|
o.value = "", c.value = null, i.value = !0;
|
|
1960
1960
|
}
|
|
@@ -1963,10 +1963,10 @@ var Pi = Y({
|
|
|
1963
1963
|
class: "markweave-image-toolbar-divider",
|
|
1964
1964
|
"aria-hidden": "true"
|
|
1965
1965
|
}),
|
|
1966
|
-
|
|
1966
|
+
Mi({
|
|
1967
1967
|
testId: "markweave-image-delete",
|
|
1968
1968
|
label: _.value.delete,
|
|
1969
|
-
icon:
|
|
1969
|
+
icon: bi,
|
|
1970
1970
|
onClick: () => e.deleteNode()
|
|
1971
1971
|
})
|
|
1972
1972
|
]) : null,
|
|
@@ -2002,7 +2002,7 @@ var Pi = Y({
|
|
|
2002
2002
|
title: _.value.preview,
|
|
2003
2003
|
onMousedown: (e) => e.preventDefault(),
|
|
2004
2004
|
onClick: ee
|
|
2005
|
-
}, [H(
|
|
2005
|
+
}, [H(Lr, {
|
|
2006
2006
|
size: 16,
|
|
2007
2007
|
strokeWidth: 1.8
|
|
2008
2008
|
}), H("span", {
|
|
@@ -2047,7 +2047,7 @@ var Pi = Y({
|
|
|
2047
2047
|
}, A.value) : null
|
|
2048
2048
|
]);
|
|
2049
2049
|
}
|
|
2050
|
-
}),
|
|
2050
|
+
}), Ii = Y({
|
|
2051
2051
|
name: "MarkweaveVueVideoNodeView",
|
|
2052
2052
|
props: {
|
|
2053
2053
|
editor: {
|
|
@@ -2080,7 +2080,7 @@ var Pi = Y({
|
|
|
2080
2080
|
}
|
|
2081
2081
|
},
|
|
2082
2082
|
setup(e) {
|
|
2083
|
-
let t = U(!1), r = U(""), i = U(null), a = U(!1), o =
|
|
2083
|
+
let t = U(!1), r = U(""), i = U(null), a = U(!1), o = Di(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => F(f.value.src)), m = G(() => F(f.value.embedUrl)), h = G(() => F(f.value.provider)), g = G(() => m.value ? N(m.value, h.value) : null), _ = G(() => F(f.value.mimeType)), v = G(() => 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 Pi = Y({
|
|
|
2121
2121
|
"data-testid": "markweave-video-node",
|
|
2122
2122
|
"data-empty": "true",
|
|
2123
2123
|
"data-selected": "false"
|
|
2124
|
-
}, () =>
|
|
2124
|
+
}, () => Pi({
|
|
2125
2125
|
messages: l.value,
|
|
2126
2126
|
inputValue: r.value,
|
|
2127
2127
|
error: i.value,
|
|
@@ -2148,7 +2148,7 @@ var Pi = Y({
|
|
|
2148
2148
|
onFocus: C,
|
|
2149
2149
|
onKeydown: w,
|
|
2150
2150
|
onMousedown: (e) => {
|
|
2151
|
-
c.value && !
|
|
2151
|
+
c.value && !ki(e.target) && (e.preventDefault(), C());
|
|
2152
2152
|
}
|
|
2153
2153
|
}, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
|
|
2154
2154
|
class: "markweave-video-iframe",
|
|
@@ -2186,7 +2186,7 @@ var Pi = Y({
|
|
|
2186
2186
|
"aria-hidden": "true"
|
|
2187
2187
|
})]);
|
|
2188
2188
|
}
|
|
2189
|
-
}),
|
|
2189
|
+
}), Li = C.extend({
|
|
2190
2190
|
addOptions() {
|
|
2191
2191
|
return {
|
|
2192
2192
|
...this.parent?.(),
|
|
@@ -2197,7 +2197,7 @@ var Pi = Y({
|
|
|
2197
2197
|
},
|
|
2198
2198
|
addNodeView() {
|
|
2199
2199
|
if (typeof document > "u") return null;
|
|
2200
|
-
let e = c(
|
|
2200
|
+
let e = c(Fi, { stopEvent: ({ event: e }) => Oi(e.target) }), t = this.options.resolveMediaSource;
|
|
2201
2201
|
if (!t) return e;
|
|
2202
2202
|
let r = x({
|
|
2203
2203
|
messages: this.options.messages ?? n("zh"),
|
|
@@ -2206,7 +2206,7 @@ var Pi = Y({
|
|
|
2206
2206
|
});
|
|
2207
2207
|
return (t) => F(t.node.attrs.src) ? r(t) : e(t);
|
|
2208
2208
|
}
|
|
2209
|
-
}),
|
|
2209
|
+
}), Ri = w.extend({
|
|
2210
2210
|
addOptions() {
|
|
2211
2211
|
return {
|
|
2212
2212
|
...this.parent?.(),
|
|
@@ -2216,9 +2216,9 @@ var Pi = Y({
|
|
|
2216
2216
|
};
|
|
2217
2217
|
},
|
|
2218
2218
|
addNodeView() {
|
|
2219
|
-
return typeof document > "u" ? null : c(
|
|
2219
|
+
return typeof document > "u" ? null : c(Ii, { stopEvent: ({ event: e }) => ki(e.target) });
|
|
2220
2220
|
}
|
|
2221
|
-
}),
|
|
2221
|
+
}), zi = Y({
|
|
2222
2222
|
name: "MarkweaveVueLinkCardNodeView",
|
|
2223
2223
|
props: {
|
|
2224
2224
|
editor: {
|
|
@@ -2251,7 +2251,7 @@ var Pi = Y({
|
|
|
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 = Di(e.editor), a = U(!1), o = U(!1), c = U(!1), l = G(() => _(e.node.attrs ?? {})), u = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
|
|
2255
2255
|
K(l, (e) => {
|
|
2256
2256
|
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
2257
2257
|
});
|
|
@@ -2286,7 +2286,7 @@ var Pi = Y({
|
|
|
2286
2286
|
"data-testid": n,
|
|
2287
2287
|
onMousedown: h,
|
|
2288
2288
|
onClick: r
|
|
2289
|
-
}, [
|
|
2289
|
+
}, [ji(t, e), H("span", { role: "tooltip" }, e)]);
|
|
2290
2290
|
return () => {
|
|
2291
2291
|
let n = l.value;
|
|
2292
2292
|
if (!n) return null;
|
|
@@ -2322,10 +2322,10 @@ var Pi = Y({
|
|
|
2322
2322
|
a.value = !1;
|
|
2323
2323
|
},
|
|
2324
2324
|
onMousedown: (e) => {
|
|
2325
|
-
|
|
2325
|
+
Ai(e.target) || e.preventDefault();
|
|
2326
2326
|
},
|
|
2327
2327
|
onClick: (e) => {
|
|
2328
|
-
|
|
2328
|
+
Ai(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
2329
2329
|
}
|
|
2330
2330
|
}, () => [
|
|
2331
2331
|
H("a", {
|
|
@@ -2345,9 +2345,9 @@ var Pi = Y({
|
|
|
2345
2345
|
"data-markweave-link-card-ui": "true",
|
|
2346
2346
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
2347
2347
|
}, [
|
|
2348
|
-
C(r.linkCard.convertToLink,
|
|
2349
|
-
C(r.linkCard.copyAddress,
|
|
2350
|
-
C(r.linkCard.edit,
|
|
2348
|
+
C(r.linkCard.convertToLink, Yr, "markweave-link-card-convert", x),
|
|
2349
|
+
C(r.linkCard.copyAddress, Ir, "markweave-link-card-copy", () => b(n.href)),
|
|
2350
|
+
C(r.linkCard.edit, ri, "markweave-link-card-edit", (i) => g({
|
|
2351
2351
|
anchor: i.currentTarget,
|
|
2352
2352
|
editor: e.editor,
|
|
2353
2353
|
messages: r,
|
|
@@ -2357,7 +2357,7 @@ var Pi = Y({
|
|
|
2357
2357
|
attrs: n
|
|
2358
2358
|
}
|
|
2359
2359
|
})),
|
|
2360
|
-
C(r.linkCard.delete,
|
|
2360
|
+
C(r.linkCard.delete, bi, "markweave-link-card-delete", () => e.deleteNode())
|
|
2361
2361
|
]) : null,
|
|
2362
2362
|
p.value && o.value ? H("form", {
|
|
2363
2363
|
class: "markweave-link-card-editor",
|
|
@@ -2385,12 +2385,12 @@ var Pi = Y({
|
|
|
2385
2385
|
type: "submit",
|
|
2386
2386
|
disabled: !v(f.value),
|
|
2387
2387
|
"aria-label": r.linkCard.edit
|
|
2388
|
-
}, [
|
|
2388
|
+
}, [ji(Yr, r.linkCard.edit)])
|
|
2389
2389
|
]) : null
|
|
2390
2390
|
]);
|
|
2391
2391
|
};
|
|
2392
2392
|
}
|
|
2393
|
-
}),
|
|
2393
|
+
}), Bi = h.extend({
|
|
2394
2394
|
addOptions() {
|
|
2395
2395
|
return {
|
|
2396
2396
|
...this.parent?.(),
|
|
@@ -2399,23 +2399,23 @@ var Pi = Y({
|
|
|
2399
2399
|
};
|
|
2400
2400
|
},
|
|
2401
2401
|
addNodeView() {
|
|
2402
|
-
return typeof document > "u" ? null : c(
|
|
2402
|
+
return typeof document > "u" ? null : c(zi, { stopEvent: ({ event: e }) => Ai(e.target) });
|
|
2403
2403
|
}
|
|
2404
2404
|
});
|
|
2405
2405
|
//#endregion
|
|
2406
2406
|
//#region src/create-editor-extensions.ts
|
|
2407
|
-
function
|
|
2407
|
+
function Vi(t = {}) {
|
|
2408
2408
|
return e({
|
|
2409
2409
|
lang: t.lang,
|
|
2410
2410
|
onImageUpload: t.onImageUpload,
|
|
2411
|
-
linkCardExtension:
|
|
2411
|
+
linkCardExtension: Bi.configure({
|
|
2412
2412
|
lang: t.lang,
|
|
2413
2413
|
messages: n(t.lang),
|
|
2414
2414
|
resolver: t.linkCardResolver
|
|
2415
2415
|
}),
|
|
2416
2416
|
mediaExtensions: i({
|
|
2417
|
-
image:
|
|
2418
|
-
video:
|
|
2417
|
+
image: Li,
|
|
2418
|
+
video: Ri,
|
|
2419
2419
|
lang: t.lang,
|
|
2420
2420
|
onImageUpload: t.onImageUpload,
|
|
2421
2421
|
onVideoUpload: t.onVideoUpload,
|
|
@@ -2425,7 +2425,7 @@ function Bi(t = {}) {
|
|
|
2425
2425
|
}
|
|
2426
2426
|
//#endregion
|
|
2427
2427
|
//#region src/MarkweaveEditor.ts
|
|
2428
|
-
var
|
|
2428
|
+
var Hi = {
|
|
2429
2429
|
active: !1,
|
|
2430
2430
|
mode: "outside",
|
|
2431
2431
|
activeCellPos: null,
|
|
@@ -2433,17 +2433,17 @@ var Vi = {
|
|
|
2433
2433
|
selectedCellCount: 0,
|
|
2434
2434
|
selectionFrom: 0,
|
|
2435
2435
|
selectionTo: 0
|
|
2436
|
-
},
|
|
2436
|
+
}, Ui = {
|
|
2437
2437
|
active: !1,
|
|
2438
|
-
language:
|
|
2438
|
+
language: tt.defaultLanguage,
|
|
2439
2439
|
mermaidPreviewMode: "code",
|
|
2440
2440
|
pos: null,
|
|
2441
2441
|
text: ""
|
|
2442
2442
|
};
|
|
2443
|
-
function Ui(e) {
|
|
2444
|
-
return pn.getState(e.state) ?? fn;
|
|
2445
|
-
}
|
|
2446
2443
|
function Wi(e) {
|
|
2444
|
+
return mn.getState(e.state) ?? pn;
|
|
2445
|
+
}
|
|
2446
|
+
function Gi(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 Z(e, t, n = 18, r = 1.8) {
|
|
|
2460
2460
|
"aria-hidden": "true"
|
|
2461
2461
|
}, { default: () => t });
|
|
2462
2462
|
}
|
|
2463
|
-
function
|
|
2463
|
+
function Ki(e) {
|
|
2464
2464
|
return e === "clipboard" ? [H("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" }), H("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" ? [H("circle", {
|
|
2465
2465
|
cx: "10",
|
|
2466
2466
|
cy: "10",
|
|
@@ -2508,57 +2508,57 @@ function Q(e) {
|
|
|
2508
2508
|
"stroke-linecap": "round",
|
|
2509
2509
|
"stroke-linejoin": "round",
|
|
2510
2510
|
"stroke-width": "1.8"
|
|
2511
|
-
},
|
|
2511
|
+
}, Ki(e)));
|
|
2512
2512
|
}
|
|
2513
2513
|
function $(e) {
|
|
2514
2514
|
e.preventDefault();
|
|
2515
2515
|
}
|
|
2516
|
-
function
|
|
2517
|
-
let t =
|
|
2516
|
+
function qi(e) {
|
|
2517
|
+
let t = Mt(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 Ji = {
|
|
2521
|
+
bold: wr,
|
|
2522
|
+
italic: qr,
|
|
2523
|
+
underline: Si,
|
|
2524
|
+
strike: pi,
|
|
2525
|
+
"inline-code": Nr,
|
|
2526
|
+
link: Yr,
|
|
2527
|
+
more: ei,
|
|
2528
|
+
superscript: hi,
|
|
2529
|
+
subscript: mi,
|
|
2530
|
+
"inline-math": ci,
|
|
2531
|
+
"align-left": cr,
|
|
2532
|
+
"align-center": or,
|
|
2533
|
+
"align-right": lr,
|
|
2534
|
+
"align-justify": sr,
|
|
2535
|
+
"decrease-indent": Wr,
|
|
2536
|
+
"increase-indent": Gr
|
|
2537
|
+
}, Yi = {
|
|
2538
|
+
type: yi,
|
|
2539
|
+
"heading-1": zr,
|
|
2540
|
+
"heading-2": Br,
|
|
2541
|
+
"heading-3": Vr,
|
|
2542
|
+
"bullet-list": Xr,
|
|
2543
|
+
"ordered-list": Qr,
|
|
2544
|
+
"task-list": Zr,
|
|
2545
|
+
blockquote: ai,
|
|
2546
|
+
"code-block": Tr,
|
|
2547
|
+
info: Kr,
|
|
2548
|
+
tip: Jr,
|
|
2549
|
+
warning: pr,
|
|
2550
|
+
error: Mr,
|
|
2551
|
+
success: Or,
|
|
2552
|
+
emoji: li,
|
|
2553
|
+
math: ci,
|
|
2554
|
+
table: gi,
|
|
2555
|
+
separator: $r,
|
|
2556
|
+
image: Hr,
|
|
2557
|
+
video: wi,
|
|
2558
|
+
attachment: ni
|
|
2559
2559
|
};
|
|
2560
|
-
function
|
|
2561
|
-
let t =
|
|
2560
|
+
function Xi(e) {
|
|
2561
|
+
let t = Yi[e];
|
|
2562
2562
|
return H(t, {
|
|
2563
2563
|
size: 18,
|
|
2564
2564
|
strokeWidth: 1.6,
|
|
@@ -2566,21 +2566,21 @@ function Yi(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 Zi = {
|
|
2570
|
+
paragraph: xi,
|
|
2571
|
+
"heading-1": zr,
|
|
2572
|
+
"heading-2": Br,
|
|
2573
|
+
"heading-3": Vr,
|
|
2574
|
+
"bullet-list": Xr,
|
|
2575
|
+
"numbered-list": Qr,
|
|
2576
|
+
"todo-list": Zr,
|
|
2577
|
+
quote: ai,
|
|
2578
|
+
"code-block": Tr
|
|
2579
2579
|
};
|
|
2580
|
-
function
|
|
2580
|
+
function Qi(e, t) {
|
|
2581
2581
|
return ce(e, t).label;
|
|
2582
2582
|
}
|
|
2583
|
-
var
|
|
2583
|
+
var $i = Y({
|
|
2584
2584
|
name: "MarkweaveVueFloatingToolbar",
|
|
2585
2585
|
props: {
|
|
2586
2586
|
editor: {
|
|
@@ -2605,10 +2605,10 @@ var Qi = Y({
|
|
|
2605
2605
|
}
|
|
2606
2606
|
},
|
|
2607
2607
|
setup(e) {
|
|
2608
|
-
let t = U(null), n = U("input"), r = U(""), i = U(""), a = U(""), o = U(""), s = W(null), c = W(null), l = U(null), u = U(null), d = "", f = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = U(""), m = U(null), h = U(null), g = U("bottom"), _ = U(null), v = U(null), y = U(null), b = G(() =>
|
|
2608
|
+
let t = U(null), n = U("input"), r = U(""), i = U(""), a = U(""), o = U(""), s = W(null), c = W(null), l = U(null), u = U(null), d = "", f = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = U(""), m = U(null), h = U(null), g = U("bottom"), _ = U(null), v = U(null), y = U(null), b = G(() => Mt(p.value.trim())), x = G(() => e.messages.floatingToolbar), S = G(() => fe(e.messages).map((e) => [
|
|
2609
2609
|
e.id,
|
|
2610
2610
|
e.label,
|
|
2611
|
-
|
|
2611
|
+
Zi[e.id]
|
|
2612
2612
|
])), C = G(() => de(e.messages).map((e) => [
|
|
2613
2613
|
e.id,
|
|
2614
2614
|
e.value,
|
|
@@ -2624,12 +2624,12 @@ var Qi = Y({
|
|
|
2624
2624
|
}, O = (n) => {
|
|
2625
2625
|
t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
|
|
2626
2626
|
}, k = B(() => {
|
|
2627
|
-
|
|
2627
|
+
Be(e.editor, d), a.value = d;
|
|
2628
2628
|
}), A = (n = !0) => {
|
|
2629
|
-
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n &&
|
|
2629
|
+
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && Re(e.editor), Ae(e.editor), t.value = null, n && e.editor.commands.focus();
|
|
2630
2630
|
}, j = () => {
|
|
2631
2631
|
if (!f.value) return;
|
|
2632
|
-
let r =
|
|
2632
|
+
let r = He(e.editor);
|
|
2633
2633
|
r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus()));
|
|
2634
2634
|
}, M = async (t) => {
|
|
2635
2635
|
if (!f.value || e.askAi?.enabled !== !0 || !s.value) return;
|
|
@@ -2647,11 +2647,11 @@ var Qi = Y({
|
|
|
2647
2647
|
let m = new AbortController(), h = je(p, u, e.lang, m.signal, void 0, Pe(e.editor)?.target);
|
|
2648
2648
|
c.value = m, l.value = h.id, i.value = u, k.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
|
|
2649
2649
|
try {
|
|
2650
|
-
let t = await
|
|
2650
|
+
let t = await ze(e.askAi.handler, h, (e) => {
|
|
2651
2651
|
l.value === h.id && !m.signal.aborted && (d = e, k.schedule());
|
|
2652
2652
|
});
|
|
2653
2653
|
if (l.value !== h.id || m.signal.aborted) return;
|
|
2654
|
-
if (k.cancel(), d = t, !
|
|
2654
|
+
if (k.cancel(), d = t, !Be(e.editor, t)) throw new Te("invalid-output", "Ask AI output is incompatible with the selected content.");
|
|
2655
2655
|
a.value = t, r.value = "", n.value = Pe(e.editor)?.status === "target" ? "result" : "conflict";
|
|
2656
2656
|
} catch (t) {
|
|
2657
2657
|
if (l.value !== h.id) return;
|
|
@@ -2720,7 +2720,7 @@ var Qi = Y({
|
|
|
2720
2720
|
o.value
|
|
2721
2721
|
], ([e]) => {
|
|
2722
2722
|
e && J(N.schedule);
|
|
2723
|
-
}),
|
|
2723
|
+
}), rr(() => {
|
|
2724
2724
|
window.addEventListener("resize", N.schedule), window.addEventListener("scroll", N.schedule, !0), e.editor.on("transaction", P), document.addEventListener("keydown", F, !0);
|
|
2725
2725
|
}), q(() => {
|
|
2726
2726
|
N.cancel(), k.cancel(), window.removeEventListener("resize", N.schedule), window.removeEventListener("scroll", N.schedule, !0), e.editor.off("transaction", P), document.removeEventListener("keydown", F, !0), c.value?.abort(), Ae(e.editor);
|
|
@@ -2764,7 +2764,7 @@ var Qi = Y({
|
|
|
2764
2764
|
onMouseenter: (e) => L(n, e.currentTarget),
|
|
2765
2765
|
onMouseleave: () => L(null),
|
|
2766
2766
|
onClick: a
|
|
2767
|
-
}, n === "ask-ai" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [Z(i, r), H("span", null, s ?? r)])] : n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" },
|
|
2767
|
+
}, n === "ask-ai" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [Z(i, r), H("span", null, s ?? r)])] : n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, Qi(e.editor, e.messages)), Z(t.value === "block-type" ? jr : kr, r)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? jr : kr, r)])] : [Z(i, r)]), ne = () => H("span", {
|
|
2768
2768
|
class: "markweave-floating-toolbar-divider",
|
|
2769
2769
|
"aria-hidden": "true"
|
|
2770
2770
|
}), re = (n, r, i) => H("section", {
|
|
@@ -2818,7 +2818,7 @@ var Qi = Y({
|
|
|
2818
2818
|
onClick: () => {
|
|
2819
2819
|
M();
|
|
2820
2820
|
}
|
|
2821
|
-
}, [Z(
|
|
2821
|
+
}, [Z(vr, e.messages.askAi.send)])]) : null;
|
|
2822
2822
|
return H("section", {
|
|
2823
2823
|
ref: y,
|
|
2824
2824
|
class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
|
|
@@ -2834,7 +2834,7 @@ var Qi = Y({
|
|
|
2834
2834
|
H("span", {
|
|
2835
2835
|
class: "markweave-ask-ai-sparkles",
|
|
2836
2836
|
"aria-hidden": "true"
|
|
2837
|
-
}, [Z(
|
|
2837
|
+
}, [Z(ui, "")]),
|
|
2838
2838
|
H("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
|
|
2839
2839
|
H("button", {
|
|
2840
2840
|
type: "button",
|
|
@@ -2844,15 +2844,15 @@ var Qi = Y({
|
|
|
2844
2844
|
onClick: () => {
|
|
2845
2845
|
c.value?.abort(), k.cancel(), ke(e.editor), n.value = "input";
|
|
2846
2846
|
}
|
|
2847
|
-
}, [Z(
|
|
2847
|
+
}, [Z(di, e.messages.askAi.stop)])
|
|
2848
2848
|
]) : null,
|
|
2849
2849
|
n.value === "result" ? H("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
2850
2850
|
t(e.messages.askAi.retry, () => {
|
|
2851
2851
|
M(i.value);
|
|
2852
|
-
}, "markweave-ask-ai-retry",
|
|
2852
|
+
}, "markweave-ask-ai-retry", si),
|
|
2853
2853
|
H("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
2854
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
2855
|
-
t(e.messages.askAi.accept, ee, "markweave-ask-ai-accept",
|
|
2854
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Ti),
|
|
2855
|
+
t(e.messages.askAi.accept, ee, "markweave-ask-ai-accept", Dr)
|
|
2856
2856
|
]) : null,
|
|
2857
2857
|
n.value === "error" || n.value === "conflict" ? H("div", {
|
|
2858
2858
|
class: "markweave-ask-ai-error",
|
|
@@ -2860,9 +2860,9 @@ var Qi = Y({
|
|
|
2860
2860
|
}, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, H("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
2861
2861
|
n.value === "error" ? t(e.messages.askAi.retry, () => {
|
|
2862
2862
|
M(i.value);
|
|
2863
|
-
}, "markweave-ask-ai-retry",
|
|
2863
|
+
}, "markweave-ask-ai-retry", si) : null,
|
|
2864
2864
|
H("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
2865
|
-
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard",
|
|
2865
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Ti)
|
|
2866
2866
|
])]) : null
|
|
2867
2867
|
]);
|
|
2868
2868
|
}
|
|
@@ -2900,7 +2900,7 @@ var Qi = Y({
|
|
|
2900
2900
|
"aria-label": x.value.applyLink,
|
|
2901
2901
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2902
2902
|
onMousedown: $
|
|
2903
|
-
}, [Z(
|
|
2903
|
+
}, [Z(Pr, x.value.applyLink)]),
|
|
2904
2904
|
H("span", {
|
|
2905
2905
|
class: "markweave-floating-toolbar-link-divider",
|
|
2906
2906
|
"aria-hidden": "true"
|
|
@@ -2911,15 +2911,15 @@ var Qi = Y({
|
|
|
2911
2911
|
"aria-label": x.value.openLink,
|
|
2912
2912
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2913
2913
|
onMousedown: $,
|
|
2914
|
-
onClick: () =>
|
|
2915
|
-
}, [Z(
|
|
2914
|
+
onClick: () => qi(p.value)
|
|
2915
|
+
}, [Z(Rr, x.value.openLink)]),
|
|
2916
2916
|
H("button", {
|
|
2917
2917
|
type: "button",
|
|
2918
2918
|
"aria-label": x.value.removeLink,
|
|
2919
2919
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2920
2920
|
onMousedown: $,
|
|
2921
2921
|
onClick: D
|
|
2922
|
-
}, [Z(
|
|
2922
|
+
}, [Z(bi, x.value.removeLink)])
|
|
2923
2923
|
])]) : t.value === "color" ? H("div", {
|
|
2924
2924
|
ref: y,
|
|
2925
2925
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
@@ -2946,7 +2946,7 @@ var Qi = Y({
|
|
|
2946
2946
|
onClick: () => {
|
|
2947
2947
|
pe(e.editor, n), t.value = null;
|
|
2948
2948
|
}
|
|
2949
|
-
}, [Z(
|
|
2949
|
+
}, [Z(Ji[n], x.value.moreActions[n])]), m.value === n ? H("div", {
|
|
2950
2950
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2951
2951
|
role: "tooltip"
|
|
2952
2952
|
}, x.value.moreActions[n]) : null]))) : null;
|
|
@@ -2955,7 +2955,11 @@ var Qi = Y({
|
|
|
2955
2955
|
editor: e.editor,
|
|
2956
2956
|
shouldShow: ({ editor: e }) => {
|
|
2957
2957
|
let t = Pe(e);
|
|
2958
|
-
return
|
|
2958
|
+
return xe(ye(e), {
|
|
2959
|
+
editable: e.isEditable,
|
|
2960
|
+
hasAskAiPreview: Ie(e.state),
|
|
2961
|
+
hasActiveAskAiTableTarget: t?.target.kind === "table" && t.status === "target"
|
|
2962
|
+
});
|
|
2959
2963
|
},
|
|
2960
2964
|
getReferencedVirtualElement: () => {
|
|
2961
2965
|
let t = Pe(e.editor)?.target.kind === "table" ? Fe(e.editor) : null;
|
|
@@ -2976,25 +2980,25 @@ var Qi = Y({
|
|
|
2976
2980
|
class: "markweave-floating-toolbar-content",
|
|
2977
2981
|
"data-menu": t.value ?? "none"
|
|
2978
2982
|
}, [
|
|
2979
|
-
f.value &&
|
|
2980
|
-
f.value &&
|
|
2981
|
-
R("block-type", x.value.buttons["block-type"],
|
|
2983
|
+
f.value && Le(e.editor) ? R("ask-ai", x.value.buttons["ask-ai"], ui, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
|
|
2984
|
+
f.value && Le(e.editor) ? ne() : null,
|
|
2985
|
+
R("block-type", x.value.buttons["block-type"], xi, () => O("block-type"), t.value === "block-type"),
|
|
2982
2986
|
ne(),
|
|
2983
|
-
R("bold", x.value.buttons.bold,
|
|
2984
|
-
R("italic", x.value.buttons.italic,
|
|
2985
|
-
R("underline", x.value.buttons.underline,
|
|
2986
|
-
R("strike", x.value.buttons.strike,
|
|
2987
|
-
R("inline-code", x.value.buttons["inline-code"],
|
|
2987
|
+
R("bold", x.value.buttons.bold, wr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2988
|
+
R("italic", x.value.buttons.italic, qr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2989
|
+
R("underline", x.value.buttons.underline, Si, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2990
|
+
R("strike", x.value.buttons.strike, pi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2991
|
+
R("inline-code", x.value.buttons["inline-code"], Nr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2988
2992
|
ne(),
|
|
2989
|
-
R("link", x.value.buttons.link,
|
|
2990
|
-
R("color", x.value.buttons.color,
|
|
2993
|
+
R("link", x.value.buttons.link, Yr, () => O("link"), e.editor.isActive("link")),
|
|
2994
|
+
R("color", x.value.buttons.color, xi, () => O("color"), t.value === "color"),
|
|
2991
2995
|
ne(),
|
|
2992
|
-
R("more", x.value.buttons.more,
|
|
2996
|
+
R("more", x.value.buttons.more, ei, () => O("more"), t.value === "more"),
|
|
2993
2997
|
ie(),
|
|
2994
2998
|
te()
|
|
2995
2999
|
])]) });
|
|
2996
3000
|
}
|
|
2997
|
-
}),
|
|
3001
|
+
}), ea = Y({
|
|
2998
3002
|
name: "MarkweaveVueMathEditorPopover",
|
|
2999
3003
|
props: {
|
|
3000
3004
|
editor: {
|
|
@@ -3015,17 +3019,17 @@ var Qi = Y({
|
|
|
3015
3019
|
}
|
|
3016
3020
|
},
|
|
3017
3021
|
setup(e) {
|
|
3018
|
-
let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(
|
|
3022
|
+
let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(Lt(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
|
|
3019
3023
|
html: a.value,
|
|
3020
3024
|
error: !1
|
|
3021
|
-
} :
|
|
3025
|
+
} : Vt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => It(e.editor, e.target) ?? 1), u = () => {
|
|
3022
3026
|
if (typeof window > "u") return;
|
|
3023
|
-
let r =
|
|
3027
|
+
let r = Ft(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3024
3028
|
if (!r || !i) {
|
|
3025
3029
|
e.onClose();
|
|
3026
3030
|
return;
|
|
3027
3031
|
}
|
|
3028
|
-
n.value =
|
|
3032
|
+
n.value = Pt({
|
|
3029
3033
|
anchorRect: r,
|
|
3030
3034
|
frameRect: i,
|
|
3031
3035
|
kind: e.target.kind,
|
|
@@ -3034,7 +3038,7 @@ var Qi = Y({
|
|
|
3034
3038
|
viewportWidth: window.innerWidth
|
|
3035
3039
|
});
|
|
3036
3040
|
}, d = () => {
|
|
3037
|
-
s.value &&
|
|
3041
|
+
s.value && Nt(e.editor, e.target, t.value) && e.onClose();
|
|
3038
3042
|
}, f = (t) => {
|
|
3039
3043
|
if (t.key === "Escape") {
|
|
3040
3044
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -3046,13 +3050,13 @@ var Qi = Y({
|
|
|
3046
3050
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
3047
3051
|
};
|
|
3048
3052
|
return K(() => [e.target.pos, e.target.latex], () => {
|
|
3049
|
-
t.value = e.target.latex, a.value =
|
|
3050
|
-
}),
|
|
3051
|
-
|
|
3053
|
+
t.value = e.target.latex, a.value = Lt(e.editor, e.target), J(u);
|
|
3054
|
+
}), rr(() => {
|
|
3055
|
+
Ht(e.editor, e.target, !0), u(), J(() => {
|
|
3052
3056
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
3053
3057
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
3054
3058
|
}), q(() => {
|
|
3055
|
-
|
|
3059
|
+
Ht(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
3056
3060
|
}), () => {
|
|
3057
3061
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
3058
3062
|
ref: i,
|
|
@@ -3113,14 +3117,14 @@ var Qi = Y({
|
|
|
3113
3117
|
}, [
|
|
3114
3118
|
H("div", { class: "markweave-math-block-toolbar" }, [
|
|
3115
3119
|
H("span", null, c.value.label),
|
|
3116
|
-
Z(
|
|
3120
|
+
Z(Nr, c.value.label, 15, 1.75),
|
|
3117
3121
|
H("button", {
|
|
3118
3122
|
type: "submit",
|
|
3119
3123
|
title: c.value.apply,
|
|
3120
3124
|
"aria-label": c.value.apply,
|
|
3121
3125
|
disabled: !s.value,
|
|
3122
3126
|
"data-testid": "markweave-math-editor-apply"
|
|
3123
|
-
}, [Z(
|
|
3127
|
+
}, [Z(Or, c.value.apply, 16, 2)])
|
|
3124
3128
|
]),
|
|
3125
3129
|
H("label", {
|
|
3126
3130
|
class: "markweave-math-block-source",
|
|
@@ -3143,7 +3147,7 @@ var Qi = Y({
|
|
|
3143
3147
|
]);
|
|
3144
3148
|
};
|
|
3145
3149
|
}
|
|
3146
|
-
}),
|
|
3150
|
+
}), ta = Y({
|
|
3147
3151
|
name: "MarkweaveVueSlashCommandMenu",
|
|
3148
3152
|
props: {
|
|
3149
3153
|
commands: {
|
|
@@ -3329,7 +3333,7 @@ var Qi = Y({
|
|
|
3329
3333
|
class: "markweave-slash-group",
|
|
3330
3334
|
"aria-label": t.group
|
|
3331
3335
|
}, [H("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
3332
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
3336
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = Zt(t);
|
|
3333
3337
|
return H("button", {
|
|
3334
3338
|
key: t.id,
|
|
3335
3339
|
type: "button",
|
|
@@ -3352,7 +3356,7 @@ var Qi = Y({
|
|
|
3352
3356
|
}
|
|
3353
3357
|
}
|
|
3354
3358
|
}, [
|
|
3355
|
-
|
|
3359
|
+
Xi(t.icon),
|
|
3356
3360
|
H("span", null, t.label),
|
|
3357
3361
|
t.disabledReason ? H("small", null, t.disabledReason) : null
|
|
3358
3362
|
]);
|
|
@@ -3363,34 +3367,34 @@ var Qi = Y({
|
|
|
3363
3367
|
}, e.messages.slash.noResults)])]);
|
|
3364
3368
|
};
|
|
3365
3369
|
}
|
|
3366
|
-
}),
|
|
3367
|
-
"ask-ai":
|
|
3368
|
-
"move-left":
|
|
3369
|
-
"move-right":
|
|
3370
|
-
"move-up":
|
|
3371
|
-
"move-down":
|
|
3372
|
-
"insert-left":
|
|
3373
|
-
"insert-right":
|
|
3374
|
-
"insert-above":
|
|
3375
|
-
"insert-below":
|
|
3376
|
-
"sort-asc":
|
|
3377
|
-
"sort-desc":
|
|
3378
|
-
color:
|
|
3379
|
-
alignment:
|
|
3380
|
-
clear:
|
|
3381
|
-
duplicate:
|
|
3382
|
-
copy:
|
|
3383
|
-
merge:
|
|
3384
|
-
split:
|
|
3385
|
-
delete:
|
|
3386
|
-
},
|
|
3387
|
-
left:
|
|
3388
|
-
center:
|
|
3389
|
-
right:
|
|
3390
|
-
top:
|
|
3391
|
-
middle:
|
|
3392
|
-
bottom:
|
|
3393
|
-
},
|
|
3370
|
+
}), na = {
|
|
3371
|
+
"ask-ai": ui,
|
|
3372
|
+
"move-left": gr,
|
|
3373
|
+
"move-right": _r,
|
|
3374
|
+
"move-up": vr,
|
|
3375
|
+
"move-down": mr,
|
|
3376
|
+
"insert-left": Cr,
|
|
3377
|
+
"insert-right": Sr,
|
|
3378
|
+
"insert-above": xr,
|
|
3379
|
+
"insert-below": br,
|
|
3380
|
+
"sort-asc": hr,
|
|
3381
|
+
"sort-desc": yr,
|
|
3382
|
+
color: ti,
|
|
3383
|
+
alignment: cr,
|
|
3384
|
+
clear: fi,
|
|
3385
|
+
duplicate: Fr,
|
|
3386
|
+
copy: Fr,
|
|
3387
|
+
merge: _i,
|
|
3388
|
+
split: vi,
|
|
3389
|
+
delete: bi
|
|
3390
|
+
}, ra = {
|
|
3391
|
+
left: cr,
|
|
3392
|
+
center: or,
|
|
3393
|
+
right: lr,
|
|
3394
|
+
top: fr,
|
|
3395
|
+
middle: ur,
|
|
3396
|
+
bottom: dr
|
|
3397
|
+
}, ia = Y({
|
|
3394
3398
|
name: "MarkweaveVueTableControls",
|
|
3395
3399
|
props: {
|
|
3396
3400
|
editor: {
|
|
@@ -3427,12 +3431,12 @@ var Qi = Y({
|
|
|
3427
3431
|
}
|
|
3428
3432
|
},
|
|
3429
3433
|
setup(e) {
|
|
3430
|
-
let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(null), f = U(0), p = U(null), m = U(null), h = U(null), g = U(null), _ = U(null), v = U(null), y = U(null), b = null, x = null, S = null, C = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = G(() => e.active ?
|
|
3434
|
+
let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(null), f = U(0), p = U(null), m = U(null), h = U(null), g = U(null), _ = U(null), v = U(null), y = U(null), b = null, x = null, S = null, C = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = G(() => e.active ? dn(e.editor.state) : Hi), T = G(() => An(e.editor, e.interactionState, "row", w.value.activeCellPos)), E = G(() => An(e.editor, e.interactionState, "column", w.value.activeCellPos)), D = G(() => En(e.editor)), O = G(() => (D.value, w.value.active && Pn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), k = G(() => t.value ? Pn(e.editor, t.value, { askAiEnabled: C.value }) : []), A = () => {
|
|
3431
3435
|
b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
|
|
3432
3436
|
}, j = (e) => {
|
|
3433
3437
|
A(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
|
|
3434
3438
|
d.value = null, b = null;
|
|
3435
|
-
},
|
|
3439
|
+
}, Bn));
|
|
3436
3440
|
}, M = () => {
|
|
3437
3441
|
if (!e.active) {
|
|
3438
3442
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, j(null);
|
|
@@ -3443,26 +3447,26 @@ var Qi = Y({
|
|
|
3443
3447
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
|
|
3444
3448
|
return;
|
|
3445
3449
|
}
|
|
3446
|
-
let l = n.getBoundingClientRect(), u = T.value ?
|
|
3447
|
-
u ? i.value =
|
|
3450
|
+
let l = n.getBoundingClientRect(), u = T.value ? kn(e.editor, T.value) : null, d = E.value ? kn(e.editor, E.value) : null, f = O.value ? Fn(e.editor) : null, p = Tn(e.editor)?.getBoundingClientRect() ?? null;
|
|
3451
|
+
u ? i.value = bn({
|
|
3448
3452
|
targetRect: u,
|
|
3449
3453
|
frameRect: l,
|
|
3450
3454
|
kind: "row"
|
|
3451
|
-
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value =
|
|
3455
|
+
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = bn({
|
|
3452
3456
|
targetRect: d,
|
|
3453
3457
|
frameRect: l,
|
|
3454
3458
|
kind: "column"
|
|
3455
|
-
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value =
|
|
3459
|
+
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = bn({
|
|
3456
3460
|
targetRect: f,
|
|
3457
3461
|
frameRect: l,
|
|
3458
3462
|
kind: "selection"
|
|
3459
3463
|
}) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
|
|
3460
3464
|
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);
|
|
3461
|
-
s.value = p && m ?
|
|
3465
|
+
s.value = p && m ? xn({
|
|
3462
3466
|
tableRect: p,
|
|
3463
3467
|
frameRect: l,
|
|
3464
3468
|
kind: "row"
|
|
3465
|
-
}) : null, c.value = p && h ?
|
|
3469
|
+
}) : null, c.value = p && h ? xn({
|
|
3466
3470
|
tableRect: p,
|
|
3467
3471
|
frameRect: l,
|
|
3468
3472
|
kind: "column"
|
|
@@ -3477,16 +3481,16 @@ var Qi = Y({
|
|
|
3477
3481
|
l.value = null;
|
|
3478
3482
|
return;
|
|
3479
3483
|
}
|
|
3480
|
-
let a = i.getBoundingClientRect(), o = t.value === "row" ?
|
|
3484
|
+
let a = i.getBoundingClientRect(), o = t.value === "row" ? Tn(e.editor)?.getBoundingClientRect() : null, s = o ? {
|
|
3481
3485
|
left: a.left,
|
|
3482
3486
|
top: o.top,
|
|
3483
3487
|
width: a.width,
|
|
3484
3488
|
height: a.height
|
|
3485
3489
|
} : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
|
|
3486
|
-
l.value =
|
|
3490
|
+
l.value = vn({
|
|
3487
3491
|
anchorRect: s,
|
|
3488
3492
|
frameRect: c,
|
|
3489
|
-
boundaryRect:
|
|
3493
|
+
boundaryRect: jn(n),
|
|
3490
3494
|
menuSize: {
|
|
3491
3495
|
width: u.width || 254,
|
|
3492
3496
|
height: f || u.height || 410
|
|
@@ -3504,10 +3508,10 @@ var Qi = Y({
|
|
|
3504
3508
|
return;
|
|
3505
3509
|
}
|
|
3506
3510
|
let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
|
|
3507
|
-
u.value =
|
|
3511
|
+
u.value = yn({
|
|
3508
3512
|
triggerRect: i.getBoundingClientRect(),
|
|
3509
3513
|
parentMenuRect: _.value.getBoundingClientRect(),
|
|
3510
|
-
boundaryRect:
|
|
3514
|
+
boundaryRect: jn(r),
|
|
3511
3515
|
submenuSize: {
|
|
3512
3516
|
width: a.width || 238,
|
|
3513
3517
|
height: o || 410
|
|
@@ -3521,16 +3525,16 @@ var Qi = Y({
|
|
|
3521
3525
|
let a = t.value === e && r.value === i;
|
|
3522
3526
|
r.value = i, t.value = a ? null : e, n.value = null, u.value = null, F();
|
|
3523
3527
|
}, L = () => {
|
|
3524
|
-
e.editor.view.dispatch(
|
|
3528
|
+
e.editor.view.dispatch(cn(e.editor.state.tr, null));
|
|
3525
3529
|
}, te = (t, n) => {
|
|
3526
3530
|
let r = e.interactionState.hoverCellPos ?? w.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
3527
|
-
r !== null &&
|
|
3531
|
+
r !== null && Rn(e.editor, r, t, { visualIndex: i }), I(t, n);
|
|
3528
3532
|
}, R = () => {
|
|
3529
3533
|
L(), I("selection", "selection-edge");
|
|
3530
3534
|
}, z = (r = !1) => {
|
|
3531
3535
|
t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
|
|
3532
3536
|
}, ne = async (n, r) => {
|
|
3533
|
-
let i = await
|
|
3537
|
+
let i = await Cn({
|
|
3534
3538
|
editor: e.editor,
|
|
3535
3539
|
commandId: n,
|
|
3536
3540
|
menu: r ?? t.value ?? "selection",
|
|
@@ -3538,12 +3542,12 @@ var Qi = Y({
|
|
|
3538
3542
|
});
|
|
3539
3543
|
return i.copyFeedback ? (j(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : j(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
3540
3544
|
}, re = (t) => {
|
|
3541
|
-
C.value && (
|
|
3545
|
+
C.value && (Ve(e.editor, t), z(!1));
|
|
3542
3546
|
}, B = (e) => {
|
|
3543
3547
|
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, F());
|
|
3544
3548
|
}, ie = (t) => {
|
|
3545
3549
|
let n = t === "row" ? T.value : E.value, r = e.interactionState.hoverCellPos ?? w.value.activeCellPos;
|
|
3546
|
-
!n || r === null ||
|
|
3550
|
+
!n || r === null || Wn(e.editor, r, t, { visualIndex: n.index }) && ne(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
3547
3551
|
}, ae = (e, t, n) => {
|
|
3548
3552
|
x = {
|
|
3549
3553
|
axis: e,
|
|
@@ -3551,14 +3555,14 @@ var Qi = Y({
|
|
|
3551
3555
|
}, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
|
|
3552
3556
|
}, oe = (t) => {
|
|
3553
3557
|
if (!x) return;
|
|
3554
|
-
let n =
|
|
3558
|
+
let n = Dn(e.editor, x.axis, t.clientX, t.clientY);
|
|
3555
3559
|
n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
|
|
3556
3560
|
}, se = (t) => {
|
|
3557
3561
|
let n = x;
|
|
3558
3562
|
if (!n) return;
|
|
3559
|
-
let r =
|
|
3560
|
-
t.preventDefault(), x = null, S = null, r !== null &&
|
|
3561
|
-
}, V = G(() => (f.value, t.value === "row" || t.value === "column" ?
|
|
3563
|
+
let r = Dn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
|
|
3564
|
+
t.preventDefault(), x = null, S = null, r !== null && Ln(e.editor, n.axis, n.index, r);
|
|
3565
|
+
}, V = G(() => (f.value, t.value === "row" || t.value === "column" ? On(e.editor, t.value) : null)), ce = (e) => {
|
|
3562
3566
|
if (!(!t.value || e.key !== "Escape")) {
|
|
3563
3567
|
if (n.value) {
|
|
3564
3568
|
n.value = null;
|
|
@@ -3575,7 +3579,7 @@ var Qi = Y({
|
|
|
3575
3579
|
}, ue = (e) => {
|
|
3576
3580
|
t.value && (e.target instanceof Node && p.value?.contains(e.target) || z());
|
|
3577
3581
|
};
|
|
3578
|
-
|
|
3582
|
+
rr(() => {
|
|
3579
3583
|
P(), window.addEventListener("resize", P), window.addEventListener("scroll", P, !0), document.addEventListener("keydown", ce), document.addEventListener("mousedown", ue), document.addEventListener("dragover", oe), document.addEventListener("drop", se);
|
|
3580
3584
|
}), q(() => {
|
|
3581
3585
|
A(), window.removeEventListener("resize", P), window.removeEventListener("scroll", P, !0), document.removeEventListener("keydown", ce), document.removeEventListener("mousedown", ue), document.removeEventListener("dragover", oe), document.removeEventListener("drop", se);
|
|
@@ -3594,7 +3598,7 @@ var Qi = Y({
|
|
|
3594
3598
|
let de = () => {
|
|
3595
3599
|
if (!t.value) return null;
|
|
3596
3600
|
let r = k.value.map((r, i) => {
|
|
3597
|
-
let a =
|
|
3601
|
+
let a = Mn(r), o = i === 0 ? a : Mn(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 && Oe(e.editor, c) : Sn(e.editor, r.commandId), u = Nn(r, e.messages), d = na[r.icon];
|
|
3598
3602
|
return H("button", {
|
|
3599
3603
|
key: `${r.id}-${i}`,
|
|
3600
3604
|
type: "button",
|
|
@@ -3638,7 +3642,7 @@ var Qi = Y({
|
|
|
3638
3642
|
strokeWidth: 1.8
|
|
3639
3643
|
})]),
|
|
3640
3644
|
H("span", { class: "markweave-table-menu-item-label" }, u),
|
|
3641
|
-
r.submenuId ? H(
|
|
3645
|
+
r.submenuId ? H(Ar, {
|
|
3642
3646
|
class: "markweave-table-menu-chevron",
|
|
3643
3647
|
size: 16,
|
|
3644
3648
|
"aria-hidden": "true"
|
|
@@ -3665,7 +3669,7 @@ var Qi = Y({
|
|
|
3665
3669
|
onKeydown: le
|
|
3666
3670
|
}, [
|
|
3667
3671
|
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
|
|
3668
|
-
...
|
|
3672
|
+
...zn.map((t) => H("button", {
|
|
3669
3673
|
key: `text-${t.id}`,
|
|
3670
3674
|
type: "button",
|
|
3671
3675
|
role: "menuitemradio",
|
|
@@ -3673,7 +3677,7 @@ var Qi = Y({
|
|
|
3673
3677
|
"data-active": V.value?.textColorId === t.id ? "true" : "false",
|
|
3674
3678
|
"data-testid": `markweave-table-text-color-${t.id}`,
|
|
3675
3679
|
onMousedown: $,
|
|
3676
|
-
onClick: () => B((n) =>
|
|
3680
|
+
onClick: () => B((n) => _n(e.editor, n, t.id))
|
|
3677
3681
|
}, [H("span", {
|
|
3678
3682
|
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3679
3683
|
"aria-hidden": "true",
|
|
@@ -3681,7 +3685,7 @@ var Qi = Y({
|
|
|
3681
3685
|
}), H("span", null, e.messages.table.colors[t.id].text)])),
|
|
3682
3686
|
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3683
3687
|
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
|
|
3684
|
-
...
|
|
3688
|
+
...zn.map((t) => H("button", {
|
|
3685
3689
|
key: `background-${t.id}`,
|
|
3686
3690
|
type: "button",
|
|
3687
3691
|
role: "menuitemradio",
|
|
@@ -3689,7 +3693,7 @@ var Qi = Y({
|
|
|
3689
3693
|
"data-active": V.value?.backgroundColorId === t.id ? "true" : "false",
|
|
3690
3694
|
"data-testid": `markweave-table-background-color-${t.id}`,
|
|
3691
3695
|
onMousedown: $,
|
|
3692
|
-
onClick: () => B((n) =>
|
|
3696
|
+
onClick: () => B((n) => gn(e.editor, n, t.id))
|
|
3693
3697
|
}, [H("span", {
|
|
3694
3698
|
class: "markweave-table-color-swatch",
|
|
3695
3699
|
"aria-hidden": "true",
|
|
@@ -3697,7 +3701,7 @@ var Qi = Y({
|
|
|
3697
3701
|
}), H("span", null, e.messages.table.colors[t.id].background)]))
|
|
3698
3702
|
])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
|
|
3699
3703
|
let t = (t, n) => {
|
|
3700
|
-
let r =
|
|
3704
|
+
let r = ra[t];
|
|
3701
3705
|
return H("button", {
|
|
3702
3706
|
key: t,
|
|
3703
3707
|
type: "button",
|
|
@@ -3706,7 +3710,7 @@ var Qi = Y({
|
|
|
3706
3710
|
"data-active": n ? "true" : "false",
|
|
3707
3711
|
"data-testid": `markweave-table-alignment-${t}`,
|
|
3708
3712
|
onMousedown: $,
|
|
3709
|
-
onClick: () => B((n) =>
|
|
3713
|
+
onClick: () => B((n) => hn(e.editor, n, t))
|
|
3710
3714
|
}, [H(r, {
|
|
3711
3715
|
size: 18,
|
|
3712
3716
|
strokeWidth: 1.8,
|
|
@@ -3728,16 +3732,16 @@ var Qi = Y({
|
|
|
3728
3732
|
} : void 0,
|
|
3729
3733
|
onKeydown: le
|
|
3730
3734
|
}, [
|
|
3731
|
-
...
|
|
3735
|
+
...Vn.map((e) => t(e, V.value?.textAlign === e)),
|
|
3732
3736
|
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3733
|
-
...
|
|
3737
|
+
...Un.map((e) => t(e, V.value?.verticalAlign === e))
|
|
3734
3738
|
]));
|
|
3735
3739
|
}
|
|
3736
3740
|
return H("div", {
|
|
3737
3741
|
ref: _,
|
|
3738
3742
|
class: "markweave-table-menu",
|
|
3739
3743
|
role: "menu",
|
|
3740
|
-
"aria-label":
|
|
3744
|
+
"aria-label": Hn(t.value, e.messages),
|
|
3741
3745
|
"data-testid": "markweave-table-menu",
|
|
3742
3746
|
"data-positioned": l.value ? "true" : "false",
|
|
3743
3747
|
"data-placement": l.value?.placement,
|
|
@@ -3756,7 +3760,7 @@ var Qi = Y({
|
|
|
3756
3760
|
"aria-label": e.messages.table.controlsAriaLabel,
|
|
3757
3761
|
"data-open-menu": t.value ?? "none",
|
|
3758
3762
|
"data-positioned": i.value || a.value || o.value ? "true" : "false",
|
|
3759
|
-
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(
|
|
3763
|
+
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(mn, { type: "clear-hover" }))
|
|
3760
3764
|
}, [
|
|
3761
3765
|
d.value ? H("div", {
|
|
3762
3766
|
class: "markweave-table-copy-feedback",
|
|
@@ -3766,7 +3770,7 @@ var Qi = Y({
|
|
|
3766
3770
|
"data-copy-kind": d.value.kind,
|
|
3767
3771
|
"data-text-length": d.value.textLength,
|
|
3768
3772
|
"data-html-length": d.value.htmlLength
|
|
3769
|
-
},
|
|
3773
|
+
}, wn(d.value)) : null,
|
|
3770
3774
|
i.value ? H("button", {
|
|
3771
3775
|
ref: m,
|
|
3772
3776
|
type: "button",
|
|
@@ -3793,7 +3797,7 @@ var Qi = Y({
|
|
|
3793
3797
|
onDragend: () => {
|
|
3794
3798
|
x = null, S = null;
|
|
3795
3799
|
}
|
|
3796
|
-
}, [H(
|
|
3800
|
+
}, [H(ei, {
|
|
3797
3801
|
size: 14,
|
|
3798
3802
|
"aria-hidden": "true"
|
|
3799
3803
|
})]) : null,
|
|
@@ -3823,7 +3827,7 @@ var Qi = Y({
|
|
|
3823
3827
|
onDragend: () => {
|
|
3824
3828
|
x = null, S = null;
|
|
3825
3829
|
}
|
|
3826
|
-
}, [H(
|
|
3830
|
+
}, [H(ei, {
|
|
3827
3831
|
size: 14,
|
|
3828
3832
|
"aria-hidden": "true"
|
|
3829
3833
|
})]) : null,
|
|
@@ -3844,7 +3848,7 @@ var Qi = Y({
|
|
|
3844
3848
|
},
|
|
3845
3849
|
onMousedown: $,
|
|
3846
3850
|
onClick: R
|
|
3847
|
-
}, [H(
|
|
3851
|
+
}, [H(ei, {
|
|
3848
3852
|
size: 14,
|
|
3849
3853
|
"aria-hidden": "true"
|
|
3850
3854
|
})]) : null,
|
|
@@ -3862,7 +3866,7 @@ var Qi = Y({
|
|
|
3862
3866
|
},
|
|
3863
3867
|
onMousedown: $,
|
|
3864
3868
|
onClick: () => ie("row")
|
|
3865
|
-
}, [H(
|
|
3869
|
+
}, [H(ii, {
|
|
3866
3870
|
size: 14,
|
|
3867
3871
|
"aria-hidden": "true"
|
|
3868
3872
|
})]) : null,
|
|
@@ -3880,14 +3884,14 @@ var Qi = Y({
|
|
|
3880
3884
|
},
|
|
3881
3885
|
onMousedown: $,
|
|
3882
3886
|
onClick: () => ie("column")
|
|
3883
|
-
}, [H(
|
|
3887
|
+
}, [H(ii, {
|
|
3884
3888
|
size: 14,
|
|
3885
3889
|
"aria-hidden": "true"
|
|
3886
3890
|
})]) : null,
|
|
3887
3891
|
de()
|
|
3888
3892
|
]) : null;
|
|
3889
3893
|
}
|
|
3890
|
-
}),
|
|
3894
|
+
}), aa = Y({
|
|
3891
3895
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
3892
3896
|
props: {
|
|
3893
3897
|
editor: {
|
|
@@ -3905,9 +3909,9 @@ var Qi = Y({
|
|
|
3905
3909
|
t.value = null;
|
|
3906
3910
|
return;
|
|
3907
3911
|
}
|
|
3908
|
-
t.value =
|
|
3912
|
+
t.value = In(e.editor, fn(e.editor.state));
|
|
3909
3913
|
};
|
|
3910
|
-
return
|
|
3914
|
+
return rr(() => {
|
|
3911
3915
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
3912
3916
|
}), q(() => {
|
|
3913
3917
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
@@ -3944,7 +3948,7 @@ var Qi = Y({
|
|
|
3944
3948
|
}) : null;
|
|
3945
3949
|
};
|
|
3946
3950
|
}
|
|
3947
|
-
}),
|
|
3951
|
+
}), oa = Y({
|
|
3948
3952
|
name: "MarkweaveVueCodeBlockControls",
|
|
3949
3953
|
props: {
|
|
3950
3954
|
editor: {
|
|
@@ -3977,16 +3981,16 @@ var Qi = Y({
|
|
|
3977
3981
|
active: !1,
|
|
3978
3982
|
lastX: 0,
|
|
3979
3983
|
lastY: 0
|
|
3980
|
-
}), b = U(0), x = U(0), S = U(0), C = null, w = G(() => (S.value,
|
|
3984
|
+
}), b = U(0), x = U(0), S = U(0), C = null, w = G(() => (S.value, xt(e.editor, s.value))), T = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
3981
3985
|
...e.state,
|
|
3982
3986
|
pos: e.state.pos,
|
|
3983
3987
|
active: !0
|
|
3984
|
-
} : null), E = G(() => w.value ?? T.value), D = G(() => E.value !== null), O = G(() => E.value?.language === "mermaid"), k = G(() =>
|
|
3988
|
+
} : null), E = G(() => w.value ?? T.value), D = G(() => E.value !== null), O = G(() => E.value?.language === "mermaid"), k = G(() => Et(e.editor, E.value)), A = G(() => D.value && E.value !== null && !k.value), j = G(() => !e.readOnly), M = G(() => E.value ? mt(E.value.language) : mt("text")), ee = G(() => m.value?.status ?? "idle"), N = G(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), P = G(() => O.value && N.value === "preview"), F = G(() => (S.value, b.value, x.value, wt(e.editor))), I = G(() => `${x.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = G(() => vt(f.value)), te = G(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), R = () => {
|
|
3985
3989
|
C !== null && (window.clearTimeout(C), C = null);
|
|
3986
3990
|
}, z = (e) => {
|
|
3987
3991
|
R(), m.value = e, e && (C = window.setTimeout(() => {
|
|
3988
3992
|
m.value = null, C = null;
|
|
3989
|
-
},
|
|
3993
|
+
}, st));
|
|
3990
3994
|
}, ne = () => {
|
|
3991
3995
|
g.value = null, _.value = null, v.value = !1, y.value = {
|
|
3992
3996
|
active: !1,
|
|
@@ -3996,15 +4000,15 @@ var Qi = Y({
|
|
|
3996
4000
|
}, B = () => {
|
|
3997
4001
|
let n = t.value;
|
|
3998
4002
|
if (!n) return;
|
|
3999
|
-
if (!
|
|
4003
|
+
if (!St(n) || F.value.length === 0) {
|
|
4000
4004
|
l.value = [];
|
|
4001
4005
|
return;
|
|
4002
4006
|
}
|
|
4003
4007
|
let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
|
|
4004
|
-
let n = gt(
|
|
4005
|
-
return n ? [
|
|
4008
|
+
let n = _t(gt(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
4009
|
+
return n ? [ft(t, n, r)] : [];
|
|
4006
4010
|
});
|
|
4007
|
-
l.value =
|
|
4011
|
+
l.value = Dt(l.value, i, F.value.map((e) => e.pos));
|
|
4008
4012
|
}, ie = () => {
|
|
4009
4013
|
if (!A.value || !E.value) {
|
|
4010
4014
|
c.value = null, u.value = null;
|
|
@@ -4012,14 +4016,14 @@ var Qi = Y({
|
|
|
4012
4016
|
}
|
|
4013
4017
|
let i = t.value;
|
|
4014
4018
|
if (!i) return;
|
|
4015
|
-
let a =
|
|
4019
|
+
let a = gt(e.editor, E.value.pos, N.value), o = i.getBoundingClientRect(), s = _t(a, o);
|
|
4016
4020
|
if (!s) {
|
|
4017
4021
|
c.value = c.value?.pos === E.value.pos ? c.value : null, u.value = d.value ? u.value : null;
|
|
4018
4022
|
return;
|
|
4019
4023
|
}
|
|
4020
|
-
if (c.value =
|
|
4024
|
+
if (c.value = ut(E.value.pos, s, o), d.value && n.value) {
|
|
4021
4025
|
let e = n.value.getBoundingClientRect(), t = r.value?.getBoundingClientRect().height;
|
|
4022
|
-
u.value =
|
|
4026
|
+
u.value = at({
|
|
4023
4027
|
overlayRect: o,
|
|
4024
4028
|
buttonRect: e,
|
|
4025
4029
|
menuHeight: t,
|
|
@@ -4030,33 +4034,33 @@ var Qi = Y({
|
|
|
4030
4034
|
}, ae = async () => {
|
|
4031
4035
|
if (e.readOnly) {
|
|
4032
4036
|
if (!E.value) return;
|
|
4033
|
-
let e = await
|
|
4034
|
-
z(
|
|
4037
|
+
let e = await ct(E.value.text);
|
|
4038
|
+
z(et(E.value, e ? "copied" : "failed"));
|
|
4035
4039
|
return;
|
|
4036
4040
|
}
|
|
4037
|
-
if (!
|
|
4038
|
-
let t = await
|
|
4039
|
-
z($e(
|
|
4041
|
+
if (!pt(e.editor, E.value)) return;
|
|
4042
|
+
let t = await Qe(e.editor);
|
|
4043
|
+
z(et($e(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
4040
4044
|
}, oe = (t, n) => {
|
|
4041
4045
|
if (e.readOnly) {
|
|
4042
|
-
|
|
4046
|
+
Jt(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
|
|
4043
4047
|
return;
|
|
4044
4048
|
}
|
|
4045
4049
|
let r = e.state.active && e.state.pos === t.pos;
|
|
4046
|
-
|
|
4050
|
+
it(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
|
|
4047
4051
|
}, se = (t) => {
|
|
4048
4052
|
if (e.readOnly || !E.value) return;
|
|
4049
4053
|
let n = e.state.active && e.state.pos === E.value.pos;
|
|
4050
|
-
|
|
4054
|
+
rt(e.editor, E.value.pos, t) && (t === "mermaid" && it(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());
|
|
4051
4055
|
}, V = () => {
|
|
4052
|
-
d.value = !d.value, d.value && o.value === null && (o.value =
|
|
4056
|
+
d.value = !d.value, d.value && o.value === null && (o.value = lt()), p.value = d.value ? Ct(L.value, E.value?.language ?? null) : -1;
|
|
4053
4057
|
}, ce = (e) => {
|
|
4054
|
-
let t =
|
|
4055
|
-
f.value = e, p.value =
|
|
4058
|
+
let t = vt(e);
|
|
4059
|
+
f.value = e, p.value = Ct(t, e.trim() ? null : E.value?.language ?? null);
|
|
4056
4060
|
}, le = (t) => {
|
|
4057
4061
|
if (!t.isComposing) {
|
|
4058
4062
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
4059
|
-
t.preventDefault(), p.value =
|
|
4063
|
+
t.preventDefault(), p.value = kt(p.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
4060
4064
|
return;
|
|
4061
4065
|
}
|
|
4062
4066
|
if (t.key === "Enter") {
|
|
@@ -4067,10 +4071,10 @@ var Qi = Y({
|
|
|
4067
4071
|
t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
|
|
4068
4072
|
}
|
|
4069
4073
|
}, ue = () => {
|
|
4070
|
-
e.readOnly || !E.value ||
|
|
4074
|
+
e.readOnly || !E.value || nt(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
|
|
4071
4075
|
}, de = () => {
|
|
4072
4076
|
if (!E.value) return;
|
|
4073
|
-
let t =
|
|
4077
|
+
let t = Tt(e.editor, E.value.pos);
|
|
4074
4078
|
t && re({
|
|
4075
4079
|
data: new Blob([t], { type: "image/svg+xml" }),
|
|
4076
4080
|
fileName: "markweave-mermaid.svg",
|
|
@@ -4079,8 +4083,8 @@ var Qi = Y({
|
|
|
4079
4083
|
});
|
|
4080
4084
|
}, fe = () => {
|
|
4081
4085
|
if (!E.value) return;
|
|
4082
|
-
let t =
|
|
4083
|
-
t && (g.value =
|
|
4086
|
+
let t = Tt(e.editor, E.value.pos);
|
|
4087
|
+
t && (g.value = dt(t), _.value = null, v.value = !1, y.value = {
|
|
4084
4088
|
active: !1,
|
|
4085
4089
|
lastX: 0,
|
|
4086
4090
|
lastY: 0
|
|
@@ -4088,16 +4092,16 @@ var Qi = Y({
|
|
|
4088
4092
|
}, pe = (e) => {
|
|
4089
4093
|
g.value = g.value ? {
|
|
4090
4094
|
...g.value,
|
|
4091
|
-
scale:
|
|
4095
|
+
scale: ot(g.value.scale + e)
|
|
4092
4096
|
} : null;
|
|
4093
4097
|
}, me = () => {
|
|
4094
|
-
g.value = g.value ?
|
|
4098
|
+
g.value = g.value ? dt(g.value.svg) : null, y.value = {
|
|
4095
4099
|
active: !1,
|
|
4096
4100
|
lastX: 0,
|
|
4097
4101
|
lastY: 0
|
|
4098
4102
|
}, v.value = !1;
|
|
4099
4103
|
}, he = (e) => {
|
|
4100
|
-
e.preventDefault(), pe(e.deltaY < 0 ?
|
|
4104
|
+
e.preventDefault(), pe(e.deltaY < 0 ? Ot : -Ot);
|
|
4101
4105
|
}, ge = (e) => {
|
|
4102
4106
|
e.button === 0 && (e.preventDefault(), y.value = {
|
|
4103
4107
|
active: !0,
|
|
@@ -4112,7 +4116,7 @@ var Qi = Y({
|
|
|
4112
4116
|
active: !0,
|
|
4113
4117
|
lastX: e.clientX,
|
|
4114
4118
|
lastY: e.clientY
|
|
4115
|
-
}, g.value =
|
|
4119
|
+
}, g.value = At(g.value, n, r);
|
|
4116
4120
|
}, ve = () => {
|
|
4117
4121
|
y.value = {
|
|
4118
4122
|
active: !1,
|
|
@@ -4138,7 +4142,7 @@ var Qi = Y({
|
|
|
4138
4142
|
if (!d.value || p.value < 0) return;
|
|
4139
4143
|
await J();
|
|
4140
4144
|
let e = a.value, t = e?.querySelector(`[data-language-index="${p.value}"]`);
|
|
4141
|
-
e && t &&
|
|
4145
|
+
e && t && jt(e, t);
|
|
4142
4146
|
}, { flush: "post" }), K(() => [
|
|
4143
4147
|
A.value,
|
|
4144
4148
|
b.value,
|
|
@@ -4158,11 +4162,11 @@ var Qi = Y({
|
|
|
4158
4162
|
immediate: !0
|
|
4159
4163
|
});
|
|
4160
4164
|
let ye = null;
|
|
4161
|
-
return
|
|
4165
|
+
return rr(() => {
|
|
4162
4166
|
J(() => {
|
|
4163
4167
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
4164
4168
|
if (n.target instanceof Node && t.value?.contains(n.target) || d.value) return;
|
|
4165
|
-
let r =
|
|
4169
|
+
let r = bt(e.editor, n.target), i = xt(e.editor, r), a = i && !Et(e.editor, i) ? i.pos : null;
|
|
4166
4170
|
s.value = s.value === a ? s.value : a;
|
|
4167
4171
|
}, i = () => {
|
|
4168
4172
|
d.value || (s.value = null);
|
|
@@ -4177,7 +4181,7 @@ var Qi = Y({
|
|
|
4177
4181
|
}, o = (e) => {
|
|
4178
4182
|
d.value && (e.target instanceof Node && t.value?.contains(e.target) || (d.value = !1, p.value = -1));
|
|
4179
4183
|
}, c = ({ transaction: e }) => {
|
|
4180
|
-
e.getMeta(
|
|
4184
|
+
e.getMeta(Ze) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Ze) || Gt(e)) && (S.value += 1);
|
|
4181
4185
|
};
|
|
4182
4186
|
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", ie), window.addEventListener("scroll", ie, !0), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ye = () => {
|
|
4183
4187
|
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", ie), window.removeEventListener("scroll", ie, !0), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), R();
|
|
@@ -4315,7 +4319,7 @@ var Qi = Y({
|
|
|
4315
4319
|
"aria-autocomplete": "list",
|
|
4316
4320
|
"aria-controls": o.value ?? void 0,
|
|
4317
4321
|
"aria-expanded": "true",
|
|
4318
|
-
"aria-activedescendant": o.value && L.value[p.value] ?
|
|
4322
|
+
"aria-activedescendant": o.value && L.value[p.value] ? yt(o.value, L.value[p.value].language) : void 0,
|
|
4319
4323
|
"aria-label": "Search code block languages",
|
|
4320
4324
|
value: f.value,
|
|
4321
4325
|
placeholder: "Search...",
|
|
@@ -4334,7 +4338,7 @@ var Qi = Y({
|
|
|
4334
4338
|
let n = E.value?.language === e.language, r = t === p.value;
|
|
4335
4339
|
return H("button", {
|
|
4336
4340
|
key: e.language,
|
|
4337
|
-
id: o.value ?
|
|
4341
|
+
id: o.value ? yt(o.value, e.language) : void 0,
|
|
4338
4342
|
type: "button",
|
|
4339
4343
|
role: "option",
|
|
4340
4344
|
"aria-selected": n ? "true" : "false",
|
|
@@ -4377,12 +4381,12 @@ var Qi = Y({
|
|
|
4377
4381
|
onBlur: () => {
|
|
4378
4382
|
_.value = null;
|
|
4379
4383
|
},
|
|
4380
|
-
onClick: () => pe(-
|
|
4384
|
+
onClick: () => pe(-Ot)
|
|
4381
4385
|
}, [Q("zoomOut")]),
|
|
4382
4386
|
H("span", {
|
|
4383
4387
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
4384
4388
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
4385
|
-
},
|
|
4389
|
+
}, ht(g.value.scale)),
|
|
4386
4390
|
H("button", {
|
|
4387
4391
|
type: "button",
|
|
4388
4392
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -4400,7 +4404,7 @@ var Qi = Y({
|
|
|
4400
4404
|
onBlur: () => {
|
|
4401
4405
|
_.value = null;
|
|
4402
4406
|
},
|
|
4403
|
-
onClick: () => pe(
|
|
4407
|
+
onClick: () => pe(Ot)
|
|
4404
4408
|
}, [Q("zoomIn")]),
|
|
4405
4409
|
H("button", {
|
|
4406
4410
|
type: "button",
|
|
@@ -4459,7 +4463,7 @@ var Qi = Y({
|
|
|
4459
4463
|
]);
|
|
4460
4464
|
};
|
|
4461
4465
|
}
|
|
4462
|
-
}),
|
|
4466
|
+
}), sa = Y({
|
|
4463
4467
|
name: "MarkweaveVueInnerToc",
|
|
4464
4468
|
props: {
|
|
4465
4469
|
editor: {
|
|
@@ -4485,9 +4489,9 @@ var Qi = Y({
|
|
|
4485
4489
|
},
|
|
4486
4490
|
setup(e) {
|
|
4487
4491
|
let t = U(null), n, r = () => {
|
|
4488
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
4492
|
+
n?.(), n = e.placement === "container" && t.value ? Ye(t.value) : void 0;
|
|
4489
4493
|
};
|
|
4490
|
-
return
|
|
4494
|
+
return rr(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
|
|
4491
4495
|
ref: t,
|
|
4492
4496
|
class: "markweave-inner-toc",
|
|
4493
4497
|
"data-testid": "markweave-inner-toc",
|
|
@@ -4508,15 +4512,15 @@ var Qi = Y({
|
|
|
4508
4512
|
"aria-current": t.active ? "location" : void 0,
|
|
4509
4513
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
4510
4514
|
title: t.text,
|
|
4511
|
-
onClick: () =>
|
|
4515
|
+
onClick: () => Xe(e.editor, t, {
|
|
4512
4516
|
behavior: "smooth",
|
|
4513
4517
|
focus: e.editable
|
|
4514
4518
|
})
|
|
4515
4519
|
}, t.text)))])]) : null;
|
|
4516
4520
|
}
|
|
4517
4521
|
});
|
|
4518
|
-
function
|
|
4519
|
-
let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Ce(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(
|
|
4522
|
+
function ca(e = {}) {
|
|
4523
|
+
let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Ce(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(on), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(pn), x = U(null), S = U(!1), C = W(null), w = V(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
|
|
4520
4524
|
function O() {
|
|
4521
4525
|
D !== null && (window.clearTimeout(D), D = null), d.value += 1;
|
|
4522
4526
|
}
|
|
@@ -4527,7 +4531,7 @@ function sa(e = {}) {
|
|
|
4527
4531
|
}
|
|
4528
4532
|
let A = e.onSlashCommandUpload, j = W(null);
|
|
4529
4533
|
j.value = new a({
|
|
4530
|
-
extensions:
|
|
4534
|
+
extensions: Vi({
|
|
4531
4535
|
lang: i,
|
|
4532
4536
|
linkCardResolver: e.linkCardResolver,
|
|
4533
4537
|
onImageUpload: (e) => A?.(e) ?? L(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
@@ -4550,16 +4554,16 @@ function sa(e = {}) {
|
|
|
4550
4554
|
},
|
|
4551
4555
|
handleClick: (e, t, n) => {
|
|
4552
4556
|
if (!u.value) return he(n);
|
|
4553
|
-
let r =
|
|
4554
|
-
return r ? (n.preventDefault(), n.stopPropagation(), I(),
|
|
4557
|
+
let r = zt(e, n);
|
|
4558
|
+
return r ? (n.preventDefault(), n.stopPropagation(), I(), Ut(e, r, !0), Wt(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
4555
4559
|
},
|
|
4556
4560
|
handleDOMEvents: {
|
|
4557
|
-
compositionstart: () => u.value ? (h.value =
|
|
4561
|
+
compositionstart: () => u.value ? (h.value = sn(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
4558
4562
|
compositionend: (e) => (u.value && window.setTimeout(() => te(e), 0), !1),
|
|
4559
4563
|
click: (e, t) => {
|
|
4560
4564
|
if (!u.value) return he(t);
|
|
4561
|
-
let n =
|
|
4562
|
-
return n ? (t.preventDefault(), t.stopPropagation(), I(),
|
|
4565
|
+
let n = zt(e, t);
|
|
4566
|
+
return n ? (t.preventDefault(), t.stopPropagation(), I(), Ut(e, n, !0), Wt(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
4563
4567
|
}
|
|
4564
4568
|
}
|
|
4565
4569
|
},
|
|
@@ -4568,11 +4572,11 @@ function sa(e = {}) {
|
|
|
4568
4572
|
p(t, {
|
|
4569
4573
|
mode: c.value,
|
|
4570
4574
|
editable: u.value
|
|
4571
|
-
}),
|
|
4575
|
+
}), Kt(t, l.value), qt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && un(t), re(t), z(t), O();
|
|
4572
4576
|
},
|
|
4573
4577
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
4574
|
-
if (re(e), (t.docChanged ||
|
|
4575
|
-
let t =
|
|
4578
|
+
if (re(e), (t.docChanged || Gt(t)) && k(), t.docChanged && y.value) {
|
|
4579
|
+
let t = Rt(e, y.value.pos);
|
|
4576
4580
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
4577
4581
|
}
|
|
4578
4582
|
},
|
|
@@ -4593,24 +4597,24 @@ function sa(e = {}) {
|
|
|
4593
4597
|
});
|
|
4594
4598
|
let F = G(() => j.value ?? null);
|
|
4595
4599
|
function I() {
|
|
4596
|
-
g.value = null, _.value = null, h.value =
|
|
4600
|
+
g.value = null, _.value = null, h.value = on;
|
|
4597
4601
|
}
|
|
4598
4602
|
function te(e) {
|
|
4599
|
-
let t =
|
|
4603
|
+
let t = rn(e.state);
|
|
4600
4604
|
if (!t) {
|
|
4601
|
-
h.value = h.value.name === "idle" ? h.value :
|
|
4605
|
+
h.value = h.value.name === "idle" ? h.value : on, g.value = null, _.value = null;
|
|
4602
4606
|
return;
|
|
4603
4607
|
}
|
|
4604
4608
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
4605
|
-
if (!
|
|
4609
|
+
if (!an(r, { frameRect: i })) {
|
|
4606
4610
|
I();
|
|
4607
4611
|
return;
|
|
4608
4612
|
}
|
|
4609
|
-
let a =
|
|
4613
|
+
let a = nn(n, {
|
|
4610
4614
|
frameRect: i,
|
|
4611
4615
|
triggerRect: r
|
|
4612
4616
|
});
|
|
4613
|
-
|
|
4617
|
+
$t(g.value, a) || (g.value = a), h.value = tn(h.value, t);
|
|
4614
4618
|
}
|
|
4615
4619
|
function R(e) {
|
|
4616
4620
|
te(e.view);
|
|
@@ -4618,23 +4622,23 @@ function sa(e = {}) {
|
|
|
4618
4622
|
function z(e) {
|
|
4619
4623
|
let t = ye(e);
|
|
4620
4624
|
_e(m.value, t) || (m.value = t);
|
|
4621
|
-
let n =
|
|
4622
|
-
n && (
|
|
4623
|
-
let r =
|
|
4625
|
+
let n = Bt(e);
|
|
4626
|
+
n && (Ht(e, n, !0), y.value = n);
|
|
4627
|
+
let r = $e(e);
|
|
4624
4628
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
4625
4629
|
}
|
|
4626
4630
|
function re(e) {
|
|
4627
|
-
b.value =
|
|
4631
|
+
b.value = Wi(e);
|
|
4628
4632
|
}
|
|
4629
|
-
let ce = G(() => F.value ?
|
|
4633
|
+
let ce = G(() => F.value ? $e(F.value) : Ui), le = G(() => F.value ? dn(F.value.state) : Hi), ue = G(() => m.value?.currentNode === "codeBlock"), de = G(() => ue.value && ce.value.language === "mermaid"), fe = G(() => F.value ? Yt({
|
|
4630
4634
|
active: de.value,
|
|
4631
4635
|
mode: v.value,
|
|
4632
4636
|
source: ce.value.text
|
|
4633
|
-
}) :
|
|
4637
|
+
}) : Yt({
|
|
4634
4638
|
active: !1,
|
|
4635
4639
|
mode: "code",
|
|
4636
4640
|
source: ""
|
|
4637
|
-
})), pe = G(() => F.value && e.onRuntimeStateChange ?
|
|
4641
|
+
})), pe = G(() => F.value && e.onRuntimeStateChange ? ln(F.value.state) : null), me = G(() => F.value ? Ke(F.value.state) : We.items), ve = G(() => qe(me.value, x.value)), xe = G(() => Ue(me.value, ve.value)), Se = G(() => Xt(h.value.query, s)), Te = G(() => ge({
|
|
4638
4642
|
revision: d.value,
|
|
4639
4643
|
mode: c.value,
|
|
4640
4644
|
editable: u.value,
|
|
@@ -4648,35 +4652,35 @@ function sa(e = {}) {
|
|
|
4648
4652
|
tableDebugSnapshot: pe.value
|
|
4649
4653
|
})), Ee = {
|
|
4650
4654
|
closeSlashMenu: I,
|
|
4651
|
-
focusFirstTableBodyCell: () => F.value ?
|
|
4655
|
+
focusFirstTableBodyCell: () => F.value ? un(F.value) : !1,
|
|
4652
4656
|
setContent: (e, t = {}) => {
|
|
4653
4657
|
if (!F.value) return !1;
|
|
4654
4658
|
let n = V(t.format);
|
|
4655
4659
|
return F.value.commands.setContent(e, {
|
|
4656
4660
|
contentType: ae(n),
|
|
4657
4661
|
emitUpdate: t.emitUpdate ?? !1
|
|
4658
|
-
}), t.focusFirstTableBodyCell &&
|
|
4662
|
+
}), t.focusFirstTableBodyCell && un(F.value), z(F.value), u.value && R(F.value), re(F.value), O(), !0;
|
|
4659
4663
|
}
|
|
4660
4664
|
};
|
|
4661
4665
|
function De(e, t) {
|
|
4662
|
-
if (!(!F.value || !u.value || !
|
|
4666
|
+
if (!(!F.value || !u.value || !Zt(e))) {
|
|
4663
4667
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
4664
4668
|
_.value = e;
|
|
4665
4669
|
return;
|
|
4666
4670
|
}
|
|
4667
|
-
|
|
4671
|
+
en(F.value, h.value, e, t), h.value = sn(h.value, { type: "execute" }), I();
|
|
4668
4672
|
}
|
|
4669
4673
|
}
|
|
4670
4674
|
function Oe(e) {
|
|
4671
4675
|
if (!F.value || _.value || !u.value) return;
|
|
4672
|
-
let t =
|
|
4676
|
+
let t = Qt(h.value, Se.value, e.key, { isComposing: e.isComposing || ne(F.value.state) });
|
|
4673
4677
|
if (t.type !== "ignore") {
|
|
4674
4678
|
if (e.preventDefault(), t.type === "close") {
|
|
4675
|
-
h.value =
|
|
4679
|
+
h.value = sn(h.value, { type: "escape" }), I();
|
|
4676
4680
|
return;
|
|
4677
4681
|
}
|
|
4678
4682
|
if (t.type === "move-active") {
|
|
4679
|
-
h.value =
|
|
4683
|
+
h.value = sn(h.value, {
|
|
4680
4684
|
type: "move-active",
|
|
4681
4685
|
delta: t.delta,
|
|
4682
4686
|
optionCount: t.optionCount
|
|
@@ -4690,9 +4694,9 @@ function sa(e = {}) {
|
|
|
4690
4694
|
c.value = f(e.mode), F.value && (F.value.setEditable(u.value), p(F.value, {
|
|
4691
4695
|
mode: c.value,
|
|
4692
4696
|
editable: u.value
|
|
4693
|
-
}),
|
|
4697
|
+
}), qt(F.value, u.value ? "live" : "view"), O(), u.value || I());
|
|
4694
4698
|
}, { immediate: !0 }), K(() => e.theme, () => {
|
|
4695
|
-
F.value &&
|
|
4699
|
+
F.value && Kt(F.value, l.value);
|
|
4696
4700
|
}, { immediate: !0 }), K(() => e.content, (t) => {
|
|
4697
4701
|
let n = V(e.contentFormat);
|
|
4698
4702
|
if (!(!F.value || t === void 0)) {
|
|
@@ -4706,7 +4710,7 @@ function sa(e = {}) {
|
|
|
4706
4710
|
}), S.value = !1, z(F.value), u.value && R(F.value), re(F.value), O());
|
|
4707
4711
|
}
|
|
4708
4712
|
}), K(Te, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(xe, (t) => e.onTocChange?.(t), { immediate: !0 }), K(me, (e) => {
|
|
4709
|
-
let t =
|
|
4713
|
+
let t = qe(e, x.value);
|
|
4710
4714
|
x.value !== t && (x.value = t);
|
|
4711
4715
|
});
|
|
4712
4716
|
let ke = B(() => {
|
|
@@ -4716,7 +4720,7 @@ function sa(e = {}) {
|
|
|
4716
4720
|
};
|
|
4717
4721
|
K(g, (e) => {
|
|
4718
4722
|
e ? Ae() : ke.cancel();
|
|
4719
|
-
}),
|
|
4723
|
+
}), rr(() => {
|
|
4720
4724
|
window.addEventListener("resize", Ae), window.addEventListener("scroll", Ae, !0);
|
|
4721
4725
|
}), q(() => {
|
|
4722
4726
|
ke.cancel(), window.removeEventListener("resize", Ae), window.removeEventListener("scroll", Ae, !0);
|
|
@@ -4724,7 +4728,7 @@ function sa(e = {}) {
|
|
|
4724
4728
|
let je = null;
|
|
4725
4729
|
return q(() => {
|
|
4726
4730
|
D !== null && window.clearTimeout(D);
|
|
4727
|
-
}),
|
|
4731
|
+
}), rr(() => {
|
|
4728
4732
|
let e = () => {
|
|
4729
4733
|
if (!F.value || !me.value.length) {
|
|
4730
4734
|
x.value = null;
|
|
@@ -4732,12 +4736,12 @@ function sa(e = {}) {
|
|
|
4732
4736
|
}
|
|
4733
4737
|
let e = null;
|
|
4734
4738
|
try {
|
|
4735
|
-
e =
|
|
4739
|
+
e = Ge(F.value, me.value);
|
|
4736
4740
|
} catch {
|
|
4737
4741
|
return;
|
|
4738
4742
|
}
|
|
4739
4743
|
x.value !== e && (x.value = e);
|
|
4740
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
4744
|
+
}, t = () => window.requestAnimationFrame(e), n = Gi(F.value?.view.dom ?? null);
|
|
4741
4745
|
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), je = () => {
|
|
4742
4746
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
4743
4747
|
};
|
|
@@ -4774,7 +4778,7 @@ function sa(e = {}) {
|
|
|
4774
4778
|
}
|
|
4775
4779
|
};
|
|
4776
4780
|
}
|
|
4777
|
-
var
|
|
4781
|
+
var la = Y({
|
|
4778
4782
|
name: "MarkweaveEditor",
|
|
4779
4783
|
props: {
|
|
4780
4784
|
defaultContent: {
|
|
@@ -4891,7 +4895,7 @@ var ca = Y({
|
|
|
4891
4895
|
}
|
|
4892
4896
|
},
|
|
4893
4897
|
setup(e) {
|
|
4894
|
-
let t =
|
|
4898
|
+
let t = ca(e);
|
|
4895
4899
|
return () => {
|
|
4896
4900
|
let n = t.editor.value;
|
|
4897
4901
|
if (!n) return null;
|
|
@@ -4904,18 +4908,18 @@ var ca = Y({
|
|
|
4904
4908
|
"data-markweave-theme": Ce(e.theme),
|
|
4905
4909
|
style: s ? { "--markweave-canvas": s } : void 0,
|
|
4906
4910
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
4907
|
-
"data-markweave-inner-toc-placement":
|
|
4911
|
+
"data-markweave-inner-toc-placement": Je(e.innerTocPlacement),
|
|
4908
4912
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
4909
4913
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
4910
4914
|
onKeydownCapture: i.handleEditorKeyDown
|
|
4911
4915
|
}, [
|
|
4912
|
-
i.effectiveEditable.value ? H(
|
|
4916
|
+
i.effectiveEditable.value ? H($i, {
|
|
4913
4917
|
editor: n,
|
|
4914
4918
|
lang: r(e.lang),
|
|
4915
4919
|
messages: i.messages,
|
|
4916
4920
|
askAi: e.askAi
|
|
4917
4921
|
}) : null,
|
|
4918
|
-
i.effectiveEditable.value ? H(
|
|
4922
|
+
i.effectiveEditable.value ? H(ta, {
|
|
4919
4923
|
commands: i.filteredSlashCommands.value,
|
|
4920
4924
|
state: i.slashState.value,
|
|
4921
4925
|
position: i.slashMenuPosition.value,
|
|
@@ -4925,7 +4929,7 @@ var ca = Y({
|
|
|
4925
4929
|
onInputCommandChange: i.setSlashInputCommand,
|
|
4926
4930
|
onUpload: e.onSlashCommandUpload
|
|
4927
4931
|
}) : null,
|
|
4928
|
-
i.effectiveEditable.value ? H(
|
|
4932
|
+
i.effectiveEditable.value ? H(ia, {
|
|
4929
4933
|
editor: n,
|
|
4930
4934
|
active: i.tableFocusState.value.active,
|
|
4931
4935
|
interactionState: i.tableInteractionState.value,
|
|
@@ -4935,11 +4939,11 @@ var ca = Y({
|
|
|
4935
4939
|
onCommandResult: e.onTableCommandResult,
|
|
4936
4940
|
onEditWithAi: e.onEditWithAi
|
|
4937
4941
|
}) : null,
|
|
4938
|
-
i.effectiveEditable.value ? H(
|
|
4942
|
+
i.effectiveEditable.value ? H(aa, {
|
|
4939
4943
|
editor: n,
|
|
4940
4944
|
focusState: i.tableFocusState.value
|
|
4941
4945
|
}) : null,
|
|
4942
|
-
H(
|
|
4946
|
+
H(oa, {
|
|
4943
4947
|
editor: n,
|
|
4944
4948
|
state: i.codeBlockState.value,
|
|
4945
4949
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -4947,14 +4951,14 @@ var ca = Y({
|
|
|
4947
4951
|
onMermaidModeChange: i.setMermaidMode,
|
|
4948
4952
|
readOnly: !i.effectiveEditable.value
|
|
4949
4953
|
}),
|
|
4950
|
-
e.innerToc && i.tocState.value.items.length ? H(
|
|
4954
|
+
e.innerToc && i.tocState.value.items.length ? H(sa, {
|
|
4951
4955
|
editor: n,
|
|
4952
4956
|
state: i.tocState.value,
|
|
4953
4957
|
messages: i.messages,
|
|
4954
4958
|
editable: i.effectiveEditable.value,
|
|
4955
|
-
placement:
|
|
4959
|
+
placement: Je(e.innerTocPlacement)
|
|
4956
4960
|
}) : null,
|
|
4957
|
-
i.effectiveEditable.value && i.mathTarget.value ? H(
|
|
4961
|
+
i.effectiveEditable.value && i.mathTarget.value ? H(ea, {
|
|
4958
4962
|
editor: n,
|
|
4959
4963
|
messages: i.messages,
|
|
4960
4964
|
target: i.mathTarget.value,
|
|
@@ -4966,4 +4970,4 @@ var ca = Y({
|
|
|
4966
4970
|
}
|
|
4967
4971
|
});
|
|
4968
4972
|
//#endregion
|
|
4969
|
-
export {
|
|
4973
|
+
export { la as MarkweaveEditor, R as createMarkweaveAiEditController, Vi as createMarkweaveEditorExtensions, Vi as createMarkweaveVue2EditorExtensions, ca as useMarkweaveEditorController };
|