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