@markweave/vue2 0.3.4 → 0.3.6
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/LICENSE +21 -21
- package/README.md +37 -25
- package/dist/index.js +1000 -733
- package/dist/types/MarkweaveEditor.d.ts +6 -1
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/create-editor-extensions.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/vue2-icons.d.ts +62 -0
- package/dist/types/vue2-icons.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10,52 +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
|
|
14
|
-
import { detectUploadSource as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
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 N, normalizeMarkweaveVideoEmbedUrl as P, numberAttribute as F, stringAttribute as I } from "markweave/internal/plugins/media/core-media-nodes";
|
|
14
|
+
import { detectUploadSource as L, getDirectUploadResult as ee, resolveMarkweaveUploadResult as R } from "markweave/internal/plugins/slash-command/upload";
|
|
15
|
+
import { createMarkweaveAiEditController as z } from "markweave";
|
|
16
|
+
import { BubbleMenu as te } from "@tiptap/vue-2/menus";
|
|
17
|
+
import { isEditorComposing as B } from "markweave/internal/editor-core/composition-guard";
|
|
18
|
+
import { saveMarkweaveBrowserFile as ne } from "markweave/internal/core/browser-file-save";
|
|
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 se } from "markweave/internal/editor-core/editor-content";
|
|
21
|
+
import { getCurrentFloatingToolbarBlockType as ce, getFloatingToolbarHighlightColorOptions as le, getFloatingToolbarMoreActions as ue, getFloatingToolbarTextColorOptions as de, getFloatingToolbarTurnIntoOptions as fe, runFloatingToolbarMoreAction as pe, setFloatingToolbarTurnInto as me } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
22
|
+
import { openMarkweaveReadonlyLinkFromEvent as he } from "markweave/internal/editor-core/readonly-link";
|
|
23
|
+
import { createMarkweaveEditorRuntimeSnapshot as ge } from "markweave/internal/editor-core/runtime-snapshot";
|
|
24
|
+
import { areEditorSelectionSnapshotsEquivalent as _e, calculateFloatingToolbarPopoverPlacement as ve, createSelectionSnapshot as ye, markweaveRuntimeProjectionDelayMs as be, shouldShowFloatingToolbar as xe } from "markweave/internal/editor-core/selection-state";
|
|
25
|
+
import { normalizeMarkweaveCanvasColor as Se, normalizeMarkweaveTheme as Ce } from "markweave/internal/core/theme";
|
|
26
|
+
import { createMarkweaveAiEditController as we } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
|
|
27
|
+
import { MarkweaveAskAiError as Te, acceptMarkweaveAskAiResult as Ee, calculateMarkweaveAskAiPanelPosition as De, canStartMarkweaveAskAiTableTarget as Oe, clearMarkweaveAskAiPreview as ke, clearMarkweaveAskAiTarget as Ae, createMarkweaveAskAiRequest as je, getMappedMarkweaveAskAiSelection as Me, getMarkweaveAskAiSurfaceRect as Ne, getMarkweaveAskAiTarget as Pe, getMarkweaveAskAiTargetRect as Fe, isMarkweaveAskAiSelectionEligible as Ie, restoreMarkweaveAskAiTargetSelection as Le, runMarkweaveAskAiHandler as Re, setMarkweaveAskAiPreview as ze, startMarkweaveAskAiTableTarget as Be, startMarkweaveAskAiTarget as Ve } from "markweave/internal/plugins/ask-ai/ask-ai-session";
|
|
28
|
+
import { createMarkweaveTocState as He, emptyMarkweaveTocState as Ue, getActiveMarkweaveTocId as We, getMarkweaveTocItemsFromState as Ge, getValidMarkweaveTocActiveId as Ke, normalizeMarkweaveInnerTocPlacement as qe, observeMarkweaveInnerTocContainerPosition as Je, scrollToMarkweaveTocItem as Ye } from "markweave/internal/core/toc-state";
|
|
29
|
+
import { codeBlockCollapsePluginKey as Xe, copyActiveCodeBlock as Ze, getActiveCodeBlockState as Qe, getCodeBlockCopyFeedbackSnapshot as $e, markweaveCodeBlockBehavior as et, setCodeBlockCollapsedAtPosition as tt, setCodeBlockLanguageAtPosition as nt, setCodeBlockMermaidPreviewModeAtPosition as rt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
30
|
+
import { calculateCodeBlockLanguageMenuPosition as it, clampFullscreenScale as at, codeBlockCopyFeedbackTimeoutMs as ot, copyCodeBlockText as st, createCodeBlockLanguageMenuDomId as ct, createCodeBlockOverlayPosition as lt, createMermaidFullscreenViewerState as ut, createMermaidTabPosition as dt, focusCodeBlockTarget as ft, formatCodeBlockLanguageLabel as pt, formatFullscreenZoom as mt, getActiveCodeBlockElement as ht, getAnchoredRect as gt, getCodeBlockLanguageItems as _t, getCodeBlockLanguageOptionDomId as vt, getCodeBlockPositionFromEventTarget as yt, getCodeBlockStateAtPosition as bt, getFrameElement as xt, getInitialCodeBlockLanguageItemIndex as St, getMermaidCodeBlockTargets as Ct, getMermaidSvgMarkup as wt, isCodeBlockTargetCollapsed as Tt, mergeStableMermaidTabPositions as Et, mermaidFullscreenZoomStep as Dt, moveCodeBlockLanguageItemIndex as Ot, moveMermaidFullscreenViewer as kt, scrollCodeBlockLanguageItemIntoView as At } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
31
|
+
import { normalizeMarkdownLinkHref as jt } from "markweave/internal/plugins/markdown/markdown-input";
|
|
32
|
+
import { applyMarkweaveMathLatex as Mt, calculateMarkweaveMathPopoverPosition as Nt, getMarkweaveMathAnchorRect as Pt, getMarkweaveMathBlockIndex as Ft, getMarkweaveMathRenderedHtml as It, getMarkweaveMathTargetAtPos as Lt, getMarkweaveMathTargetFromDomEvent as Rt, getMarkweaveMathTargetFromSelection as zt, renderMarkweaveMathPreview as Bt, setMarkweaveMathEditingDomState as Vt, setMarkweaveMathEditingDomStateInView as Ht, setMarkweaveMathSelectionInView as Ut } from "markweave/internal/plugins/math/math-ui-model";
|
|
33
|
+
import { isMermaidInlinePreviewTransaction as Wt, setMarkweaveMermaidTheme as Gt, setMermaidInlinePreviewEditorMode as Kt, setReadonlyMermaidPreviewMode as qt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
34
|
+
import { getMermaidPreviewState as Jt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
35
|
+
import { filterSlashCommands as Yt, isExecutableSlashCommand as Xt } from "markweave/internal/plugins/slash-command/command-spec";
|
|
36
|
+
import { getSlashCommandKeyboardAction as Zt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
37
|
+
import { areSlashCommandMenuPositionsEquivalent as Qt, executeSlashCommand as $t, getNextSlashCommandState as en, getSlashCommandAnchoredMenuPosition as tn, getSlashCommandContext as nn, isSlashCommandAnchorVisible as rn } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
38
|
+
import { initialSlashCommandState as an, reduceSlashCommandState as on } from "markweave/internal/plugins/slash-command/slash-state";
|
|
39
|
+
import { setMarkweaveTableMenuAxisTarget as sn } from "markweave/internal/plugins/table/table-clipboard";
|
|
40
|
+
import { getFirstTableDebugSnapshot as cn } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
41
|
+
import { focusFirstTableBodyCell as ln } from "markweave/internal/plugins/table/table-focus-position";
|
|
42
|
+
import { getTableFocusState as un } from "markweave/internal/plugins/table/table-focus-state";
|
|
43
|
+
import { getTableSelectionOverlayState as dn, initialTableInteractionState as fn, tableInteractionPluginKey as pn } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
44
|
+
import { applyTableAxisAlignment as mn, applyTableAxisBackgroundColor as hn, applyTableAxisTextColor as gn, calculateAnchoredTableMenuPosition as _n, calculateAnchoredTableSubmenuPosition as vn, calculateTableAxisHandleLayout as yn, calculateTableExtendButtonLayout as bn, canRunTableCommand as xn, executeTableMenuCommand as Sn, formatTableCopyFeedback as Cn, getActiveTableElement as wn, getAvailableCellMenuCommandSpecs as Tn, getTableAxisDropIndexAtPoint as En, getTableAxisFormattingState as Dn, getTableAxisTargetRect as On, getTableControlAxisSelectionModel as kn, getTableMenuBoundaryRect as An, getTableMenuItemGroup as jn, getTableMenuItemLabel as Mn, getTableMenuItems as Nn, getTableSelectionTargetRect as Pn, measureTableSelectionOverlay as Fn, moveTargetedTableAxis as In, selectTableAxisFromCell as Ln, tableColorOptions as Rn, tableCopyFeedbackTimeoutMs as zn, tableHorizontalAlignmentOptions as Bn, tableMenuLabel as Vn, tableVerticalAlignmentOptions as Hn, targetTableAxisFromCell as Un } from "markweave/internal/plugins/table/table-ui-model";
|
|
42
45
|
//#region src/vue2-compat.ts
|
|
43
|
-
var
|
|
44
|
-
function
|
|
46
|
+
var Wn = l.default ?? l, Gn = null, Kn = null, qn = null;
|
|
47
|
+
function Jn(e) {
|
|
45
48
|
return !!(e && typeof e == "object" && "value" in e);
|
|
46
49
|
}
|
|
47
|
-
function
|
|
50
|
+
function Yn(e) {
|
|
48
51
|
let t = e.slice(2);
|
|
49
52
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
50
53
|
}
|
|
51
|
-
function
|
|
54
|
+
function Xn(e) {
|
|
52
55
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
53
56
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
54
57
|
if (o === "class" || o === "style" || o === "key") {
|
|
55
58
|
t[o] = s;
|
|
56
59
|
continue;
|
|
57
60
|
}
|
|
58
|
-
if (o === "ref" &&
|
|
61
|
+
if (o === "ref" && Jn(s)) {
|
|
59
62
|
a.insert = (e) => {
|
|
60
63
|
s.value = e.elm;
|
|
61
64
|
}, a.destroy = () => {
|
|
@@ -64,7 +67,7 @@ function Mn(e) {
|
|
|
64
67
|
continue;
|
|
65
68
|
}
|
|
66
69
|
if (/^on[A-Z]/.test(o)) {
|
|
67
|
-
i[
|
|
70
|
+
i[Yn(o)] = s;
|
|
68
71
|
continue;
|
|
69
72
|
}
|
|
70
73
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -75,14 +78,14 @@ function Mn(e) {
|
|
|
75
78
|
}
|
|
76
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;
|
|
77
80
|
}
|
|
78
|
-
function
|
|
81
|
+
function Zn(e) {
|
|
79
82
|
let t = {}, n = {}, r = {}, i = {};
|
|
80
83
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
81
84
|
if (a === "class" || a === "style" || a === "key") {
|
|
82
85
|
t[a] = o;
|
|
83
86
|
continue;
|
|
84
87
|
}
|
|
85
|
-
if (a === "ref" &&
|
|
88
|
+
if (a === "ref" && Jn(o)) {
|
|
86
89
|
i.insert = (e) => {
|
|
87
90
|
o.value = e.componentInstance ?? e.elm;
|
|
88
91
|
}, i.destroy = () => {
|
|
@@ -98,25 +101,25 @@ function Nn(e) {
|
|
|
98
101
|
}
|
|
99
102
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
100
103
|
}
|
|
101
|
-
function
|
|
104
|
+
function Qn(e) {
|
|
102
105
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
103
106
|
}
|
|
104
|
-
function
|
|
107
|
+
function $n(e) {
|
|
105
108
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
106
109
|
}
|
|
107
|
-
function
|
|
110
|
+
function er(e) {
|
|
108
111
|
return e == null || Array.isArray(e) ? e : [e];
|
|
109
112
|
}
|
|
110
|
-
function
|
|
111
|
-
return typeof e == "function" ?
|
|
113
|
+
function tr(e) {
|
|
114
|
+
return typeof e == "function" ? er(e()) : Qn(e) ? er(e.default()) : $n(e) ? [e] : e;
|
|
112
115
|
}
|
|
113
116
|
function H(e, t, n) {
|
|
114
|
-
if (!
|
|
115
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
116
|
-
return
|
|
117
|
+
if (!qn) throw Error("Vue 2 render context is not available.");
|
|
118
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Xn(r) : Zn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : tr(n);
|
|
119
|
+
return qn(e, i, a);
|
|
117
120
|
}
|
|
118
121
|
function U(e) {
|
|
119
|
-
return
|
|
122
|
+
return Wn.observable({ value: e });
|
|
120
123
|
}
|
|
121
124
|
var W = U;
|
|
122
125
|
function G(e) {
|
|
@@ -126,19 +129,19 @@ function G(e) {
|
|
|
126
129
|
}
|
|
127
130
|
function K(e, t, n) {
|
|
128
131
|
let r = typeof e == "function" ? e : () => e.value;
|
|
129
|
-
return
|
|
132
|
+
return Gn?.$watch ? Gn.$watch(r, t, n) : () => void 0;
|
|
130
133
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
134
|
+
function nr(e) {
|
|
135
|
+
Kn?.mounted.push(e);
|
|
133
136
|
}
|
|
134
137
|
function q(e) {
|
|
135
|
-
|
|
138
|
+
Kn?.beforeUnmount.push(e);
|
|
136
139
|
}
|
|
137
140
|
function J(e) {
|
|
138
|
-
return
|
|
141
|
+
return Wn.nextTick(e);
|
|
139
142
|
}
|
|
140
143
|
function Y(e) {
|
|
141
|
-
return
|
|
144
|
+
return Wn.extend({
|
|
142
145
|
name: e.name,
|
|
143
146
|
props: e.props,
|
|
144
147
|
created() {
|
|
@@ -146,12 +149,12 @@ function Y(e) {
|
|
|
146
149
|
mounted: [],
|
|
147
150
|
beforeUnmount: []
|
|
148
151
|
};
|
|
149
|
-
|
|
152
|
+
Gn = this, Kn = t;
|
|
150
153
|
try {
|
|
151
154
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
152
155
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
153
156
|
} finally {
|
|
154
|
-
|
|
157
|
+
Gn = null, Kn = null;
|
|
155
158
|
}
|
|
156
159
|
},
|
|
157
160
|
mounted() {
|
|
@@ -161,19 +164,19 @@ function Y(e) {
|
|
|
161
164
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
162
165
|
},
|
|
163
166
|
render(t) {
|
|
164
|
-
|
|
167
|
+
qn = t;
|
|
165
168
|
try {
|
|
166
169
|
let n = this.__markweaveVue2Render;
|
|
167
170
|
return n ? n() : e.render?.(t) ?? null;
|
|
168
171
|
} finally {
|
|
169
|
-
|
|
172
|
+
qn = null;
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
});
|
|
173
176
|
}
|
|
174
177
|
//#endregion
|
|
175
178
|
//#region src/vue2-icons.ts
|
|
176
|
-
var
|
|
179
|
+
var rr = {
|
|
177
180
|
AlignVerticalJustifyCenter: {
|
|
178
181
|
iconName: "align-vertical-justify-center",
|
|
179
182
|
node: [
|
|
@@ -492,6 +495,17 @@ var zn = {
|
|
|
492
495
|
key: "s699le"
|
|
493
496
|
}]]
|
|
494
497
|
},
|
|
498
|
+
Square: {
|
|
499
|
+
iconName: "square",
|
|
500
|
+
node: [["rect", {
|
|
501
|
+
width: "18",
|
|
502
|
+
height: "18",
|
|
503
|
+
x: "3",
|
|
504
|
+
y: "3",
|
|
505
|
+
rx: "2",
|
|
506
|
+
key: "afitv7"
|
|
507
|
+
}]]
|
|
508
|
+
},
|
|
495
509
|
SquareX: {
|
|
496
510
|
iconName: "square-x",
|
|
497
511
|
node: [
|
|
@@ -685,6 +699,13 @@ var zn = {
|
|
|
685
699
|
key: "1ueiar"
|
|
686
700
|
}]]
|
|
687
701
|
},
|
|
702
|
+
Check: {
|
|
703
|
+
iconName: "check",
|
|
704
|
+
node: [["path", {
|
|
705
|
+
d: "M20 6 9 17l-5-5",
|
|
706
|
+
key: "1gmf2c"
|
|
707
|
+
}]]
|
|
708
|
+
},
|
|
688
709
|
CheckCircle2: {
|
|
689
710
|
iconName: "circle-check",
|
|
690
711
|
node: [["circle", {
|
|
@@ -1417,6 +1438,41 @@ var zn = {
|
|
|
1417
1438
|
}]
|
|
1418
1439
|
]
|
|
1419
1440
|
},
|
|
1441
|
+
RotateCcw: {
|
|
1442
|
+
iconName: "rotate-ccw",
|
|
1443
|
+
node: [["path", {
|
|
1444
|
+
d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",
|
|
1445
|
+
key: "1357e3"
|
|
1446
|
+
}], ["path", {
|
|
1447
|
+
d: "M3 3v5h5",
|
|
1448
|
+
key: "1xhq8a"
|
|
1449
|
+
}]]
|
|
1450
|
+
},
|
|
1451
|
+
Sparkles: {
|
|
1452
|
+
iconName: "sparkles",
|
|
1453
|
+
node: [
|
|
1454
|
+
["path", {
|
|
1455
|
+
d: "m12 3-1.9 5.8a2 2 0 0 1-1.3 1.3L3 12l5.8 1.9a2 2 0 0 1 1.3 1.3L12 21l1.9-5.8a2 2 0 0 1 1.3-1.3L21 12l-5.8-1.9a2 2 0 0 1-1.3-1.3Z",
|
|
1456
|
+
key: "nraa5p"
|
|
1457
|
+
}],
|
|
1458
|
+
["path", {
|
|
1459
|
+
d: "M5 3v4",
|
|
1460
|
+
key: "bklmnn"
|
|
1461
|
+
}],
|
|
1462
|
+
["path", {
|
|
1463
|
+
d: "M19 17v4",
|
|
1464
|
+
key: "iiml17"
|
|
1465
|
+
}],
|
|
1466
|
+
["path", {
|
|
1467
|
+
d: "M3 5h4",
|
|
1468
|
+
key: "nem4j1"
|
|
1469
|
+
}],
|
|
1470
|
+
["path", {
|
|
1471
|
+
d: "M17 19h4",
|
|
1472
|
+
key: "lbex7p"
|
|
1473
|
+
}]
|
|
1474
|
+
]
|
|
1475
|
+
},
|
|
1420
1476
|
Video: {
|
|
1421
1477
|
iconName: "video",
|
|
1422
1478
|
node: [["path", {
|
|
@@ -1430,9 +1486,19 @@ var zn = {
|
|
|
1430
1486
|
rx: "2",
|
|
1431
1487
|
key: "158x01"
|
|
1432
1488
|
}]]
|
|
1489
|
+
},
|
|
1490
|
+
X: {
|
|
1491
|
+
iconName: "x",
|
|
1492
|
+
node: [["path", {
|
|
1493
|
+
d: "M18 6 6 18",
|
|
1494
|
+
key: "1bl5f8"
|
|
1495
|
+
}], ["path", {
|
|
1496
|
+
d: "m6 6 12 12",
|
|
1497
|
+
key: "d8bk6v"
|
|
1498
|
+
}]]
|
|
1433
1499
|
}
|
|
1434
1500
|
};
|
|
1435
|
-
function
|
|
1501
|
+
function ir(e) {
|
|
1436
1502
|
return e.map(([e, t]) => H(e, t));
|
|
1437
1503
|
}
|
|
1438
1504
|
function X(e) {
|
|
@@ -1453,7 +1519,7 @@ function X(e) {
|
|
|
1453
1519
|
}
|
|
1454
1520
|
},
|
|
1455
1521
|
setup(t) {
|
|
1456
|
-
let n =
|
|
1522
|
+
let n = rr[e];
|
|
1457
1523
|
return () => H("svg", {
|
|
1458
1524
|
class: `lucide lucide-${n.iconName}`,
|
|
1459
1525
|
viewBox: "0 0 24 24",
|
|
@@ -1466,12 +1532,12 @@ function X(e) {
|
|
|
1466
1532
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1467
1533
|
"aria-hidden": "true",
|
|
1468
1534
|
focusable: "false"
|
|
1469
|
-
},
|
|
1535
|
+
}, ir(n.node));
|
|
1470
1536
|
}
|
|
1471
1537
|
});
|
|
1472
1538
|
}
|
|
1473
|
-
var
|
|
1474
|
-
function
|
|
1539
|
+
var ar = X("AlignCenter"), or = X("AlignJustify"), sr = X("AlignLeft"), cr = X("AlignRight"), lr = X("AlignVerticalJustifyCenter"), ur = X("AlignVerticalJustifyEnd"), dr = X("AlignVerticalJustifyStart"), fr = X("AlertTriangle"), pr = X("ArrowDown"), mr = X("ArrowDownAZ"), hr = X("ArrowLeft"), gr = X("ArrowRight"), _r = X("ArrowUp"), vr = X("ArrowUpZA"), yr = X("BetweenHorizontalEnd"), br = X("BetweenHorizontalStart"), xr = X("BetweenVerticalEnd"), Sr = X("BetweenVerticalStart"), Cr = X("Bold"), wr = X("Braces"), Tr = X("Captions"), Er = X("Check"), Dr = X("CheckCircle2"), Or = X("ChevronDown"), kr = X("ChevronRight"), Ar = X("ChevronUp"), jr = X("CircleX"), Mr = X("Code2"), Nr = X("CornerDownLeft"), Pr = X("Copy"), Fr = X("Download"), Ir = X("Eye"), Lr = X("ExternalLink"), Rr = X("Heading1"), zr = X("Heading2"), Br = X("Heading3"), Vr = X("Image"), Hr = X("ImageUp"), Ur = X("IndentDecrease"), Wr = X("IndentIncrease"), Gr = X("Info"), Kr = X("Italic"), qr = X("Lightbulb"), Jr = X("Link2"), Yr = X("List"), Xr = X("ListChecks"), Zr = X("ListOrdered"), Qr = X("Minus"), $r = X("MoreVertical"), ei = X("PaintBucket"), ti = X("Paperclip"), ni = X("PencilLine"), ri = X("Plus"), ii = X("Quote"), ai = X("Replace"), oi = X("RotateCcw"), si = X("Sigma"), ci = X("SmilePlus"), li = X("Sparkles"), ui = X("Square"), di = X("SquareX"), fi = X("Strikethrough"), pi = X("Subscript"), mi = X("Superscript"), hi = X("Table2"), gi = X("TableCellsMerge"), _i = X("TableCellsSplit"), vi = X("Text"), yi = X("Trash2"), bi = X("Type"), xi = X("Underline"), Si = X("Upload"), Ci = X("Video"), wi = X("X"), Ti = N;
|
|
1540
|
+
function Ei(e) {
|
|
1475
1541
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1476
1542
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1477
1543
|
return n === "view" ? {
|
|
@@ -1493,23 +1559,23 @@ function ri(e) {
|
|
|
1493
1559
|
i(), a?.disconnect();
|
|
1494
1560
|
}), r;
|
|
1495
1561
|
}
|
|
1496
|
-
function
|
|
1562
|
+
function Di(e) {
|
|
1497
1563
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1498
1564
|
}
|
|
1499
|
-
function
|
|
1565
|
+
function Oi(e) {
|
|
1500
1566
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1501
1567
|
}
|
|
1502
|
-
function
|
|
1568
|
+
function ki(e) {
|
|
1503
1569
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1504
1570
|
}
|
|
1505
|
-
function
|
|
1571
|
+
function Ai(e, t) {
|
|
1506
1572
|
return H(e, {
|
|
1507
1573
|
size: 18,
|
|
1508
1574
|
strokeWidth: 1.8,
|
|
1509
1575
|
"aria-hidden": "true"
|
|
1510
1576
|
}, { default: () => t });
|
|
1511
1577
|
}
|
|
1512
|
-
function
|
|
1578
|
+
function ji(e) {
|
|
1513
1579
|
return H("button", {
|
|
1514
1580
|
type: "button",
|
|
1515
1581
|
"aria-label": e.label,
|
|
@@ -1518,12 +1584,12 @@ function ci(e) {
|
|
|
1518
1584
|
"data-active": e.active ? "true" : "false",
|
|
1519
1585
|
onMousedown: (e) => e.preventDefault(),
|
|
1520
1586
|
onClick: e.onClick
|
|
1521
|
-
}, [
|
|
1587
|
+
}, [Ai(e.icon, e.label), H("span", {
|
|
1522
1588
|
class: "markweave-image-tooltip",
|
|
1523
1589
|
role: "tooltip"
|
|
1524
1590
|
}, e.label)]);
|
|
1525
1591
|
}
|
|
1526
|
-
function
|
|
1592
|
+
function Mi(e) {
|
|
1527
1593
|
let t = U(null), n = e.messages.image;
|
|
1528
1594
|
return H("section", {
|
|
1529
1595
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1557,7 +1623,7 @@ function li(e) {
|
|
|
1557
1623
|
H("div", {
|
|
1558
1624
|
class: "markweave-image-upload-icon",
|
|
1559
1625
|
"aria-hidden": "true"
|
|
1560
|
-
}, [H(
|
|
1626
|
+
}, [H(Hr, {
|
|
1561
1627
|
size: 46,
|
|
1562
1628
|
strokeWidth: 1.6
|
|
1563
1629
|
})]),
|
|
@@ -1582,7 +1648,7 @@ function li(e) {
|
|
|
1582
1648
|
"data-testid": "markweave-image-upload-submit",
|
|
1583
1649
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1584
1650
|
onClick: e.onSubmit
|
|
1585
|
-
}, [H(
|
|
1651
|
+
}, [H(Hr, {
|
|
1586
1652
|
size: 16,
|
|
1587
1653
|
strokeWidth: 1.8
|
|
1588
1654
|
}), e.messages.common.insert]),
|
|
@@ -1598,7 +1664,7 @@ function li(e) {
|
|
|
1598
1664
|
}, e.error) : null
|
|
1599
1665
|
]);
|
|
1600
1666
|
}
|
|
1601
|
-
function
|
|
1667
|
+
function Ni(e) {
|
|
1602
1668
|
let t = U(null), n = e.messages.video;
|
|
1603
1669
|
return H("section", {
|
|
1604
1670
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1632,7 +1698,7 @@ function ui(e) {
|
|
|
1632
1698
|
H("div", {
|
|
1633
1699
|
class: "markweave-video-upload-icon",
|
|
1634
1700
|
"aria-hidden": "true"
|
|
1635
|
-
}, [H(
|
|
1701
|
+
}, [H(Ci, {
|
|
1636
1702
|
size: 46,
|
|
1637
1703
|
strokeWidth: 1.6
|
|
1638
1704
|
})]),
|
|
@@ -1657,7 +1723,7 @@ function ui(e) {
|
|
|
1657
1723
|
"data-testid": "markweave-video-upload-submit",
|
|
1658
1724
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1659
1725
|
onClick: e.onSubmit
|
|
1660
|
-
}, [H(
|
|
1726
|
+
}, [H(Si, {
|
|
1661
1727
|
size: 16,
|
|
1662
1728
|
strokeWidth: 1.8
|
|
1663
1729
|
}), e.messages.common.insert]),
|
|
@@ -1673,7 +1739,7 @@ function ui(e) {
|
|
|
1673
1739
|
}, e.error) : null
|
|
1674
1740
|
]);
|
|
1675
1741
|
}
|
|
1676
|
-
var
|
|
1742
|
+
var Pi = Y({
|
|
1677
1743
|
name: "MarkweaveVueImageNodeView",
|
|
1678
1744
|
props: {
|
|
1679
1745
|
editor: {
|
|
@@ -1706,7 +1772,7 @@ var di = Y({
|
|
|
1706
1772
|
}
|
|
1707
1773
|
},
|
|
1708
1774
|
setup(e) {
|
|
1709
|
-
let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!
|
|
1775
|
+
let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!I(u.value.caption)), p = U(I(u.value.caption) ?? ""), m = Ei(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => I(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
|
|
1710
1776
|
K(v, (t) => {
|
|
1711
1777
|
if (C?.abort(), C = null, !t) {
|
|
1712
1778
|
x.value = null;
|
|
@@ -1727,10 +1793,10 @@ var di = Y({
|
|
|
1727
1793
|
r.signal.aborted || (x.value = e);
|
|
1728
1794
|
});
|
|
1729
1795
|
}, { immediate: !0 }), q(() => C?.abort());
|
|
1730
|
-
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() =>
|
|
1796
|
+
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => Ti(u.value.align)), D = G(() => F(u.value.width)), A = G(() => I(u.value.caption)), M = G(() => h.value && (!v.value || i.value)), N = () => {
|
|
1731
1797
|
w.value && b({
|
|
1732
1798
|
src: w.value,
|
|
1733
|
-
alt:
|
|
1799
|
+
alt: I(u.value.alt) ?? "",
|
|
1734
1800
|
messages: {
|
|
1735
1801
|
dialogAriaLabel: _.value.previewDialogAriaLabel,
|
|
1736
1802
|
zoomOut: _.value.previewZoomOut,
|
|
@@ -1743,45 +1809,45 @@ var di = Y({
|
|
|
1743
1809
|
K(A, (e) => {
|
|
1744
1810
|
f.value || (p.value = e ?? "");
|
|
1745
1811
|
});
|
|
1746
|
-
let
|
|
1812
|
+
let P = () => {
|
|
1747
1813
|
if (!h.value) return;
|
|
1748
1814
|
let t = e.getPos();
|
|
1749
1815
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1750
|
-
},
|
|
1816
|
+
}, ee = () => {
|
|
1751
1817
|
if (o.value = "", c.value = null, a.value = !1, v.value) {
|
|
1752
1818
|
i.value = !1;
|
|
1753
1819
|
return;
|
|
1754
1820
|
}
|
|
1755
1821
|
e.deleteNode();
|
|
1756
|
-
},
|
|
1822
|
+
}, z = async (t) => {
|
|
1757
1823
|
if (!h.value) return;
|
|
1758
1824
|
let n = e.extension.options;
|
|
1759
1825
|
l.value = !0, c.value = null;
|
|
1760
1826
|
try {
|
|
1761
|
-
let r = await
|
|
1827
|
+
let r = await R(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1762
1828
|
e.updateAttributes(T(u.value, r)), o.value = "", i.value = !1;
|
|
1763
1829
|
} catch (e) {
|
|
1764
1830
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
1765
1831
|
} finally {
|
|
1766
1832
|
l.value = !1, a.value = !1;
|
|
1767
1833
|
}
|
|
1768
|
-
},
|
|
1834
|
+
}, te = () => {
|
|
1769
1835
|
if (!o.value.trim()) {
|
|
1770
1836
|
c.value = _.value.uploadRequiredError;
|
|
1771
1837
|
return;
|
|
1772
1838
|
}
|
|
1773
|
-
|
|
1774
|
-
},
|
|
1775
|
-
|
|
1839
|
+
z(L(o.value));
|
|
1840
|
+
}, B = (e) => {
|
|
1841
|
+
z({
|
|
1776
1842
|
type: "file",
|
|
1777
1843
|
file: e,
|
|
1778
1844
|
mimeType: e.type || "image/*"
|
|
1779
1845
|
});
|
|
1780
|
-
},
|
|
1846
|
+
}, ne = () => {
|
|
1781
1847
|
f.value = !f.value, f.value && (p.value = A.value ?? "");
|
|
1782
|
-
},
|
|
1848
|
+
}, V = (n, r) => {
|
|
1783
1849
|
if (!h.value || !v.value) return;
|
|
1784
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1850
|
+
r.preventDefault(), r.stopPropagation(), P();
|
|
1785
1851
|
let i = t.value;
|
|
1786
1852
|
if (!i) return;
|
|
1787
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) => {
|
|
@@ -1792,7 +1858,7 @@ var di = Y({
|
|
|
1792
1858
|
};
|
|
1793
1859
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1794
1860
|
};
|
|
1795
|
-
return () =>
|
|
1861
|
+
return () => M.value ? H(s, {
|
|
1796
1862
|
as: "figure",
|
|
1797
1863
|
class: "markweave-image-node",
|
|
1798
1864
|
"data-testid": "markweave-image-node",
|
|
@@ -1800,7 +1866,7 @@ var di = Y({
|
|
|
1800
1866
|
"data-selected": "false",
|
|
1801
1867
|
"data-hovered": "false",
|
|
1802
1868
|
"data-empty": "true"
|
|
1803
|
-
}, () =>
|
|
1869
|
+
}, () => Mi({
|
|
1804
1870
|
messages: g.value,
|
|
1805
1871
|
inputValue: o.value,
|
|
1806
1872
|
error: c.value,
|
|
@@ -1809,9 +1875,9 @@ var di = Y({
|
|
|
1809
1875
|
onInputValue: (e) => {
|
|
1810
1876
|
o.value = e;
|
|
1811
1877
|
},
|
|
1812
|
-
onFile:
|
|
1813
|
-
onSubmit:
|
|
1814
|
-
onCancel:
|
|
1878
|
+
onFile: B,
|
|
1879
|
+
onSubmit: te,
|
|
1880
|
+
onCancel: ee,
|
|
1815
1881
|
onDragActive: (e) => {
|
|
1816
1882
|
a.value = e;
|
|
1817
1883
|
}
|
|
@@ -1830,7 +1896,7 @@ var di = Y({
|
|
|
1830
1896
|
r.value = !1;
|
|
1831
1897
|
},
|
|
1832
1898
|
onMousedown: (e) => {
|
|
1833
|
-
h.value && !
|
|
1899
|
+
h.value && !Di(e.target) && P();
|
|
1834
1900
|
}
|
|
1835
1901
|
}, () => [
|
|
1836
1902
|
h.value ? H("div", {
|
|
@@ -1839,24 +1905,24 @@ var di = Y({
|
|
|
1839
1905
|
"data-markweave-image-ui": "true",
|
|
1840
1906
|
"aria-label": _.value.toolsAriaLabel
|
|
1841
1907
|
}, [
|
|
1842
|
-
|
|
1908
|
+
ji({
|
|
1843
1909
|
testId: "markweave-image-align-left",
|
|
1844
1910
|
label: _.value.alignLeft,
|
|
1845
|
-
icon:
|
|
1911
|
+
icon: sr,
|
|
1846
1912
|
active: E.value === "left",
|
|
1847
1913
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1848
1914
|
}),
|
|
1849
|
-
|
|
1915
|
+
ji({
|
|
1850
1916
|
testId: "markweave-image-align-center",
|
|
1851
1917
|
label: _.value.alignCenter,
|
|
1852
|
-
icon:
|
|
1918
|
+
icon: ar,
|
|
1853
1919
|
active: E.value === "center",
|
|
1854
1920
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1855
1921
|
}),
|
|
1856
|
-
|
|
1922
|
+
ji({
|
|
1857
1923
|
testId: "markweave-image-align-right",
|
|
1858
1924
|
label: _.value.alignRight,
|
|
1859
|
-
icon:
|
|
1925
|
+
icon: cr,
|
|
1860
1926
|
active: E.value === "right",
|
|
1861
1927
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1862
1928
|
}),
|
|
@@ -1864,31 +1930,31 @@ var di = Y({
|
|
|
1864
1930
|
class: "markweave-image-toolbar-divider",
|
|
1865
1931
|
"aria-hidden": "true"
|
|
1866
1932
|
}),
|
|
1867
|
-
|
|
1933
|
+
ji({
|
|
1868
1934
|
testId: "markweave-image-caption",
|
|
1869
1935
|
label: _.value.caption,
|
|
1870
|
-
icon:
|
|
1936
|
+
icon: Tr,
|
|
1871
1937
|
active: f.value || !!A.value,
|
|
1872
|
-
onClick:
|
|
1938
|
+
onClick: ne
|
|
1873
1939
|
}),
|
|
1874
|
-
|
|
1940
|
+
ji({
|
|
1875
1941
|
testId: "markweave-image-preview",
|
|
1876
1942
|
label: _.value.preview,
|
|
1877
|
-
icon:
|
|
1878
|
-
onClick:
|
|
1943
|
+
icon: Ir,
|
|
1944
|
+
onClick: N
|
|
1879
1945
|
}),
|
|
1880
|
-
|
|
1946
|
+
ji({
|
|
1881
1947
|
testId: "markweave-image-download",
|
|
1882
1948
|
label: _.value.download,
|
|
1883
|
-
icon:
|
|
1949
|
+
icon: Fr,
|
|
1884
1950
|
onClick: () => {
|
|
1885
|
-
w.value &&
|
|
1951
|
+
w.value && j(w.value);
|
|
1886
1952
|
}
|
|
1887
1953
|
}),
|
|
1888
|
-
|
|
1954
|
+
ji({
|
|
1889
1955
|
testId: "markweave-image-replace",
|
|
1890
1956
|
label: _.value.replace,
|
|
1891
|
-
icon:
|
|
1957
|
+
icon: ai,
|
|
1892
1958
|
onClick: () => {
|
|
1893
1959
|
o.value = "", c.value = null, i.value = !0;
|
|
1894
1960
|
}
|
|
@@ -1897,10 +1963,10 @@ var di = Y({
|
|
|
1897
1963
|
class: "markweave-image-toolbar-divider",
|
|
1898
1964
|
"aria-hidden": "true"
|
|
1899
1965
|
}),
|
|
1900
|
-
|
|
1966
|
+
ji({
|
|
1901
1967
|
testId: "markweave-image-delete",
|
|
1902
1968
|
label: _.value.delete,
|
|
1903
|
-
icon:
|
|
1969
|
+
icon: yi,
|
|
1904
1970
|
onClick: () => e.deleteNode()
|
|
1905
1971
|
})
|
|
1906
1972
|
]) : null,
|
|
@@ -1915,8 +1981,8 @@ var di = Y({
|
|
|
1915
1981
|
w.value ? H("img", {
|
|
1916
1982
|
class: "markweave-image",
|
|
1917
1983
|
src: w.value,
|
|
1918
|
-
alt:
|
|
1919
|
-
title:
|
|
1984
|
+
alt: I(u.value.alt) ?? "",
|
|
1985
|
+
title: I(u.value.title) ?? void 0,
|
|
1920
1986
|
draggable: !1,
|
|
1921
1987
|
loading: "lazy",
|
|
1922
1988
|
decoding: "async",
|
|
@@ -1935,8 +2001,8 @@ var di = Y({
|
|
|
1935
2001
|
"aria-label": _.value.preview,
|
|
1936
2002
|
title: _.value.preview,
|
|
1937
2003
|
onMousedown: (e) => e.preventDefault(),
|
|
1938
|
-
onClick:
|
|
1939
|
-
}, [H(
|
|
2004
|
+
onClick: N
|
|
2005
|
+
}, [H(Ir, {
|
|
1940
2006
|
size: 16,
|
|
1941
2007
|
strokeWidth: 1.8
|
|
1942
2008
|
}), H("span", {
|
|
@@ -1950,7 +2016,7 @@ var di = Y({
|
|
|
1950
2016
|
"data-side": "left",
|
|
1951
2017
|
"aria-label": _.value.resizeLeft,
|
|
1952
2018
|
"data-markweave-image-ui": "true",
|
|
1953
|
-
onPointerdown: (e) =>
|
|
2019
|
+
onPointerdown: (e) => V("left", e)
|
|
1954
2020
|
}) : null,
|
|
1955
2021
|
h.value ? H("button", {
|
|
1956
2022
|
type: "button",
|
|
@@ -1959,7 +2025,7 @@ var di = Y({
|
|
|
1959
2025
|
"data-side": "right",
|
|
1960
2026
|
"aria-label": _.value.resizeRight,
|
|
1961
2027
|
"data-markweave-image-ui": "true",
|
|
1962
|
-
onPointerdown: (e) =>
|
|
2028
|
+
onPointerdown: (e) => V("right", e)
|
|
1963
2029
|
}) : null
|
|
1964
2030
|
]),
|
|
1965
2031
|
h.value && (f.value || A.value) ? H("input", {
|
|
@@ -1981,7 +2047,7 @@ var di = Y({
|
|
|
1981
2047
|
}, A.value) : null
|
|
1982
2048
|
]);
|
|
1983
2049
|
}
|
|
1984
|
-
}),
|
|
2050
|
+
}), Fi = Y({
|
|
1985
2051
|
name: "MarkweaveVueVideoNodeView",
|
|
1986
2052
|
props: {
|
|
1987
2053
|
editor: {
|
|
@@ -2014,14 +2080,14 @@ var di = Y({
|
|
|
2014
2080
|
}
|
|
2015
2081
|
},
|
|
2016
2082
|
setup(e) {
|
|
2017
|
-
let t = U(!1), r = U(""), i = U(null), a = U(!1), o =
|
|
2083
|
+
let t = U(!1), r = U(""), i = U(null), a = U(!1), o = Ei(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => I(f.value.src)), m = G(() => I(f.value.embedUrl)), h = G(() => I(f.value.provider)), g = G(() => m.value ? P(m.value, h.value) : null), _ = G(() => I(f.value.mimeType)), v = G(() => I(f.value.title)), y = () => {
|
|
2018
2084
|
p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
|
|
2019
2085
|
}, b = async (n) => {
|
|
2020
2086
|
if (!c.value) return;
|
|
2021
2087
|
let o = e.extension.options;
|
|
2022
2088
|
a.value = !0, i.value = null;
|
|
2023
2089
|
try {
|
|
2024
|
-
let t = await
|
|
2090
|
+
let t = await R(A(n), o?.onUpload);
|
|
2025
2091
|
e.updateAttributes(E(t)), r.value = "";
|
|
2026
2092
|
} catch (e) {
|
|
2027
2093
|
i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
@@ -2055,7 +2121,7 @@ var di = Y({
|
|
|
2055
2121
|
"data-testid": "markweave-video-node",
|
|
2056
2122
|
"data-empty": "true",
|
|
2057
2123
|
"data-selected": "false"
|
|
2058
|
-
}, () =>
|
|
2124
|
+
}, () => Ni({
|
|
2059
2125
|
messages: l.value,
|
|
2060
2126
|
inputValue: r.value,
|
|
2061
2127
|
error: i.value,
|
|
@@ -2082,7 +2148,7 @@ var di = Y({
|
|
|
2082
2148
|
onFocus: C,
|
|
2083
2149
|
onKeydown: w,
|
|
2084
2150
|
onMousedown: (e) => {
|
|
2085
|
-
c.value && !
|
|
2151
|
+
c.value && !Oi(e.target) && (e.preventDefault(), C());
|
|
2086
2152
|
}
|
|
2087
2153
|
}, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
|
|
2088
2154
|
class: "markweave-video-iframe",
|
|
@@ -2091,7 +2157,7 @@ var di = Y({
|
|
|
2091
2157
|
"data-markweave-video-embed": "true",
|
|
2092
2158
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
2093
2159
|
"data-markweave-video-src": p.value ?? void 0,
|
|
2094
|
-
allow:
|
|
2160
|
+
allow: M,
|
|
2095
2161
|
loading: "lazy",
|
|
2096
2162
|
allowfullscreen: "true"
|
|
2097
2163
|
}), c.value ? H("button", {
|
|
@@ -2120,7 +2186,7 @@ var di = Y({
|
|
|
2120
2186
|
"aria-hidden": "true"
|
|
2121
2187
|
})]);
|
|
2122
2188
|
}
|
|
2123
|
-
}),
|
|
2189
|
+
}), Ii = C.extend({
|
|
2124
2190
|
addOptions() {
|
|
2125
2191
|
return {
|
|
2126
2192
|
...this.parent?.(),
|
|
@@ -2131,16 +2197,16 @@ var di = Y({
|
|
|
2131
2197
|
},
|
|
2132
2198
|
addNodeView() {
|
|
2133
2199
|
if (typeof document > "u") return null;
|
|
2134
|
-
let e = c(
|
|
2200
|
+
let e = c(Pi, { stopEvent: ({ event: e }) => Di(e.target) }), t = this.options.resolveMediaSource;
|
|
2135
2201
|
if (!t) return e;
|
|
2136
2202
|
let r = x({
|
|
2137
2203
|
messages: this.options.messages ?? n("zh"),
|
|
2138
2204
|
onUpload: this.options.onUpload,
|
|
2139
2205
|
resolveMediaSource: t
|
|
2140
2206
|
});
|
|
2141
|
-
return (t) =>
|
|
2207
|
+
return (t) => I(t.node.attrs.src) ? r(t) : e(t);
|
|
2142
2208
|
}
|
|
2143
|
-
}),
|
|
2209
|
+
}), Li = w.extend({
|
|
2144
2210
|
addOptions() {
|
|
2145
2211
|
return {
|
|
2146
2212
|
...this.parent?.(),
|
|
@@ -2150,9 +2216,9 @@ var di = Y({
|
|
|
2150
2216
|
};
|
|
2151
2217
|
},
|
|
2152
2218
|
addNodeView() {
|
|
2153
|
-
return typeof document > "u" ? null : c(
|
|
2219
|
+
return typeof document > "u" ? null : c(Fi, { stopEvent: ({ event: e }) => Oi(e.target) });
|
|
2154
2220
|
}
|
|
2155
|
-
}),
|
|
2221
|
+
}), Ri = Y({
|
|
2156
2222
|
name: "MarkweaveVueLinkCardNodeView",
|
|
2157
2223
|
props: {
|
|
2158
2224
|
editor: {
|
|
@@ -2185,7 +2251,7 @@ var di = Y({
|
|
|
2185
2251
|
}
|
|
2186
2252
|
},
|
|
2187
2253
|
setup(e) {
|
|
2188
|
-
let t = e.extension.options, r = t.messages ?? n("zh"), i =
|
|
2254
|
+
let t = e.extension.options, r = t.messages ?? n("zh"), i = Ei(e.editor), a = U(!1), o = U(!1), c = U(!1), l = G(() => _(e.node.attrs ?? {})), u = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
|
|
2189
2255
|
K(l, (e) => {
|
|
2190
2256
|
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
2191
2257
|
});
|
|
@@ -2220,7 +2286,7 @@ var di = Y({
|
|
|
2220
2286
|
"data-testid": n,
|
|
2221
2287
|
onMousedown: h,
|
|
2222
2288
|
onClick: r
|
|
2223
|
-
}, [
|
|
2289
|
+
}, [Ai(t, e), H("span", { role: "tooltip" }, e)]);
|
|
2224
2290
|
return () => {
|
|
2225
2291
|
let n = l.value;
|
|
2226
2292
|
if (!n) return null;
|
|
@@ -2256,10 +2322,10 @@ var di = Y({
|
|
|
2256
2322
|
a.value = !1;
|
|
2257
2323
|
},
|
|
2258
2324
|
onMousedown: (e) => {
|
|
2259
|
-
|
|
2325
|
+
ki(e.target) || e.preventDefault();
|
|
2260
2326
|
},
|
|
2261
2327
|
onClick: (e) => {
|
|
2262
|
-
|
|
2328
|
+
ki(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
2263
2329
|
}
|
|
2264
2330
|
}, () => [
|
|
2265
2331
|
H("a", {
|
|
@@ -2279,9 +2345,9 @@ var di = Y({
|
|
|
2279
2345
|
"data-markweave-link-card-ui": "true",
|
|
2280
2346
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
2281
2347
|
}, [
|
|
2282
|
-
C(r.linkCard.convertToLink,
|
|
2283
|
-
C(r.linkCard.copyAddress,
|
|
2284
|
-
C(r.linkCard.edit,
|
|
2348
|
+
C(r.linkCard.convertToLink, Jr, "markweave-link-card-convert", x),
|
|
2349
|
+
C(r.linkCard.copyAddress, Fr, "markweave-link-card-copy", () => b(n.href)),
|
|
2350
|
+
C(r.linkCard.edit, ni, "markweave-link-card-edit", (i) => g({
|
|
2285
2351
|
anchor: i.currentTarget,
|
|
2286
2352
|
editor: e.editor,
|
|
2287
2353
|
messages: r,
|
|
@@ -2291,7 +2357,7 @@ var di = Y({
|
|
|
2291
2357
|
attrs: n
|
|
2292
2358
|
}
|
|
2293
2359
|
})),
|
|
2294
|
-
C(r.linkCard.delete,
|
|
2360
|
+
C(r.linkCard.delete, yi, "markweave-link-card-delete", () => e.deleteNode())
|
|
2295
2361
|
]) : null,
|
|
2296
2362
|
p.value && o.value ? H("form", {
|
|
2297
2363
|
class: "markweave-link-card-editor",
|
|
@@ -2319,12 +2385,12 @@ var di = Y({
|
|
|
2319
2385
|
type: "submit",
|
|
2320
2386
|
disabled: !v(f.value),
|
|
2321
2387
|
"aria-label": r.linkCard.edit
|
|
2322
|
-
}, [
|
|
2388
|
+
}, [Ai(Jr, r.linkCard.edit)])
|
|
2323
2389
|
]) : null
|
|
2324
2390
|
]);
|
|
2325
2391
|
};
|
|
2326
2392
|
}
|
|
2327
|
-
}),
|
|
2393
|
+
}), zi = h.extend({
|
|
2328
2394
|
addOptions() {
|
|
2329
2395
|
return {
|
|
2330
2396
|
...this.parent?.(),
|
|
@@ -2333,23 +2399,23 @@ var di = Y({
|
|
|
2333
2399
|
};
|
|
2334
2400
|
},
|
|
2335
2401
|
addNodeView() {
|
|
2336
|
-
return typeof document > "u" ? null : c(
|
|
2402
|
+
return typeof document > "u" ? null : c(Ri, { stopEvent: ({ event: e }) => ki(e.target) });
|
|
2337
2403
|
}
|
|
2338
2404
|
});
|
|
2339
2405
|
//#endregion
|
|
2340
2406
|
//#region src/create-editor-extensions.ts
|
|
2341
|
-
function
|
|
2407
|
+
function Bi(t = {}) {
|
|
2342
2408
|
return e({
|
|
2343
2409
|
lang: t.lang,
|
|
2344
2410
|
onImageUpload: t.onImageUpload,
|
|
2345
|
-
linkCardExtension:
|
|
2411
|
+
linkCardExtension: zi.configure({
|
|
2346
2412
|
lang: t.lang,
|
|
2347
2413
|
messages: n(t.lang),
|
|
2348
2414
|
resolver: t.linkCardResolver
|
|
2349
2415
|
}),
|
|
2350
2416
|
mediaExtensions: i({
|
|
2351
|
-
image:
|
|
2352
|
-
video:
|
|
2417
|
+
image: Ii,
|
|
2418
|
+
video: Li,
|
|
2353
2419
|
lang: t.lang,
|
|
2354
2420
|
onImageUpload: t.onImageUpload,
|
|
2355
2421
|
onVideoUpload: t.onVideoUpload,
|
|
@@ -2359,7 +2425,7 @@ function _i(t = {}) {
|
|
|
2359
2425
|
}
|
|
2360
2426
|
//#endregion
|
|
2361
2427
|
//#region src/MarkweaveEditor.ts
|
|
2362
|
-
var
|
|
2428
|
+
var Vi = {
|
|
2363
2429
|
active: !1,
|
|
2364
2430
|
mode: "outside",
|
|
2365
2431
|
activeCellPos: null,
|
|
@@ -2367,17 +2433,17 @@ var vi = {
|
|
|
2367
2433
|
selectedCellCount: 0,
|
|
2368
2434
|
selectionFrom: 0,
|
|
2369
2435
|
selectionTo: 0
|
|
2370
|
-
},
|
|
2436
|
+
}, Hi = {
|
|
2371
2437
|
active: !1,
|
|
2372
|
-
language:
|
|
2438
|
+
language: et.defaultLanguage,
|
|
2373
2439
|
mermaidPreviewMode: "code",
|
|
2374
2440
|
pos: null,
|
|
2375
2441
|
text: ""
|
|
2376
2442
|
};
|
|
2377
|
-
function
|
|
2378
|
-
return
|
|
2443
|
+
function Ui(e) {
|
|
2444
|
+
return pn.getState(e.state) ?? fn;
|
|
2379
2445
|
}
|
|
2380
|
-
function
|
|
2446
|
+
function Wi(e) {
|
|
2381
2447
|
if (!e || typeof window > "u") return null;
|
|
2382
2448
|
let t = e.parentElement;
|
|
2383
2449
|
for (; t;) {
|
|
@@ -2394,7 +2460,7 @@ function Z(e, t, n = 18, r = 1.8) {
|
|
|
2394
2460
|
"aria-hidden": "true"
|
|
2395
2461
|
}, { default: () => t });
|
|
2396
2462
|
}
|
|
2397
|
-
function
|
|
2463
|
+
function Gi(e) {
|
|
2398
2464
|
return e === "clipboard" ? [H("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), H("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] : e === "search" ? [H("circle", {
|
|
2399
2465
|
cx: "10",
|
|
2400
2466
|
cy: "10",
|
|
@@ -2442,57 +2508,57 @@ function Q(e) {
|
|
|
2442
2508
|
"stroke-linecap": "round",
|
|
2443
2509
|
"stroke-linejoin": "round",
|
|
2444
2510
|
"stroke-width": "1.8"
|
|
2445
|
-
},
|
|
2511
|
+
}, Gi(e)));
|
|
2446
2512
|
}
|
|
2447
2513
|
function $(e) {
|
|
2448
2514
|
e.preventDefault();
|
|
2449
2515
|
}
|
|
2450
|
-
function
|
|
2451
|
-
let t =
|
|
2516
|
+
function Ki(e) {
|
|
2517
|
+
let t = jt(e);
|
|
2452
2518
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
2453
2519
|
}
|
|
2454
|
-
var
|
|
2455
|
-
bold:
|
|
2456
|
-
italic:
|
|
2457
|
-
underline:
|
|
2458
|
-
strike:
|
|
2459
|
-
"inline-code":
|
|
2460
|
-
link:
|
|
2461
|
-
more:
|
|
2462
|
-
superscript:
|
|
2463
|
-
subscript:
|
|
2464
|
-
"inline-math":
|
|
2465
|
-
"align-left":
|
|
2466
|
-
"align-center":
|
|
2467
|
-
"align-right":
|
|
2468
|
-
"align-justify":
|
|
2469
|
-
"decrease-indent":
|
|
2470
|
-
"increase-indent":
|
|
2471
|
-
},
|
|
2472
|
-
type:
|
|
2473
|
-
"heading-1":
|
|
2474
|
-
"heading-2":
|
|
2475
|
-
"heading-3":
|
|
2476
|
-
"bullet-list":
|
|
2477
|
-
"ordered-list":
|
|
2478
|
-
"task-list":
|
|
2479
|
-
blockquote:
|
|
2480
|
-
"code-block":
|
|
2481
|
-
info:
|
|
2482
|
-
tip:
|
|
2483
|
-
warning:
|
|
2484
|
-
error:
|
|
2485
|
-
success:
|
|
2486
|
-
emoji:
|
|
2487
|
-
math:
|
|
2488
|
-
table:
|
|
2489
|
-
separator:
|
|
2490
|
-
image:
|
|
2491
|
-
video:
|
|
2492
|
-
attachment:
|
|
2520
|
+
var qi = {
|
|
2521
|
+
bold: Cr,
|
|
2522
|
+
italic: Kr,
|
|
2523
|
+
underline: xi,
|
|
2524
|
+
strike: fi,
|
|
2525
|
+
"inline-code": Mr,
|
|
2526
|
+
link: Jr,
|
|
2527
|
+
more: $r,
|
|
2528
|
+
superscript: mi,
|
|
2529
|
+
subscript: pi,
|
|
2530
|
+
"inline-math": si,
|
|
2531
|
+
"align-left": sr,
|
|
2532
|
+
"align-center": ar,
|
|
2533
|
+
"align-right": cr,
|
|
2534
|
+
"align-justify": or,
|
|
2535
|
+
"decrease-indent": Ur,
|
|
2536
|
+
"increase-indent": Wr
|
|
2537
|
+
}, Ji = {
|
|
2538
|
+
type: vi,
|
|
2539
|
+
"heading-1": Rr,
|
|
2540
|
+
"heading-2": zr,
|
|
2541
|
+
"heading-3": Br,
|
|
2542
|
+
"bullet-list": Yr,
|
|
2543
|
+
"ordered-list": Zr,
|
|
2544
|
+
"task-list": Xr,
|
|
2545
|
+
blockquote: ii,
|
|
2546
|
+
"code-block": wr,
|
|
2547
|
+
info: Gr,
|
|
2548
|
+
tip: qr,
|
|
2549
|
+
warning: fr,
|
|
2550
|
+
error: jr,
|
|
2551
|
+
success: Dr,
|
|
2552
|
+
emoji: ci,
|
|
2553
|
+
math: si,
|
|
2554
|
+
table: hi,
|
|
2555
|
+
separator: Qr,
|
|
2556
|
+
image: Vr,
|
|
2557
|
+
video: Ci,
|
|
2558
|
+
attachment: ti
|
|
2493
2559
|
};
|
|
2494
|
-
function
|
|
2495
|
-
let t =
|
|
2560
|
+
function Yi(e) {
|
|
2561
|
+
let t = Ji[e];
|
|
2496
2562
|
return H(t, {
|
|
2497
2563
|
size: 18,
|
|
2498
2564
|
strokeWidth: 1.6,
|
|
@@ -2500,59 +2566,133 @@ function Ei(e) {
|
|
|
2500
2566
|
"aria-hidden": "true"
|
|
2501
2567
|
});
|
|
2502
2568
|
}
|
|
2503
|
-
var
|
|
2504
|
-
paragraph:
|
|
2505
|
-
"heading-1":
|
|
2506
|
-
"heading-2":
|
|
2507
|
-
"heading-3":
|
|
2508
|
-
"bullet-list":
|
|
2509
|
-
"numbered-list":
|
|
2510
|
-
"todo-list":
|
|
2511
|
-
quote:
|
|
2512
|
-
"code-block":
|
|
2569
|
+
var Xi = {
|
|
2570
|
+
paragraph: bi,
|
|
2571
|
+
"heading-1": Rr,
|
|
2572
|
+
"heading-2": zr,
|
|
2573
|
+
"heading-3": Br,
|
|
2574
|
+
"bullet-list": Yr,
|
|
2575
|
+
"numbered-list": Zr,
|
|
2576
|
+
"todo-list": Xr,
|
|
2577
|
+
quote: ii,
|
|
2578
|
+
"code-block": wr
|
|
2513
2579
|
};
|
|
2514
|
-
function
|
|
2515
|
-
return
|
|
2580
|
+
function Zi(e, t) {
|
|
2581
|
+
return ce(e, t).label;
|
|
2516
2582
|
}
|
|
2517
|
-
var
|
|
2583
|
+
var Qi = Y({
|
|
2518
2584
|
name: "MarkweaveVueFloatingToolbar",
|
|
2519
2585
|
props: {
|
|
2520
2586
|
editor: {
|
|
2521
2587
|
type: Object,
|
|
2522
2588
|
required: !0
|
|
2523
2589
|
},
|
|
2590
|
+
lang: {
|
|
2591
|
+
type: String,
|
|
2592
|
+
required: !0
|
|
2593
|
+
},
|
|
2524
2594
|
messages: {
|
|
2525
2595
|
type: Object,
|
|
2526
2596
|
required: !0
|
|
2527
2597
|
},
|
|
2598
|
+
askAi: {
|
|
2599
|
+
type: Object,
|
|
2600
|
+
default: void 0
|
|
2601
|
+
},
|
|
2528
2602
|
onRewriteSelection: {
|
|
2529
2603
|
type: Function,
|
|
2530
2604
|
default: void 0
|
|
2531
2605
|
}
|
|
2532
2606
|
},
|
|
2533
2607
|
setup(e) {
|
|
2534
|
-
let t = U(null), n = U(""), r = U(
|
|
2608
|
+
let t = U(null), n = U("input"), r = U(""), i = U(""), a = U(""), o = U(""), s = W(null), c = W(null), l = U(null), u = U(null), d = "", f = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = U(""), m = U(null), h = U(null), g = U("bottom"), _ = U(null), v = U(null), y = U(null), b = G(() => jt(p.value.trim())), x = G(() => e.messages.floatingToolbar), S = G(() => fe(e.messages).map((e) => [
|
|
2535
2609
|
e.id,
|
|
2536
2610
|
e.label,
|
|
2537
|
-
|
|
2538
|
-
])),
|
|
2611
|
+
Xi[e.id]
|
|
2612
|
+
])), C = G(() => de(e.messages).map((e) => [
|
|
2539
2613
|
e.id,
|
|
2540
2614
|
e.value,
|
|
2541
2615
|
e.label
|
|
2542
|
-
])),
|
|
2616
|
+
])), w = G(() => le(e.messages).map((e) => [
|
|
2543
2617
|
e.id,
|
|
2544
2618
|
e.value,
|
|
2545
2619
|
e.label
|
|
2546
|
-
])),
|
|
2547
|
-
|
|
2548
|
-
},
|
|
2549
|
-
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(),
|
|
2550
|
-
},
|
|
2551
|
-
t.value = t.value ===
|
|
2552
|
-
},
|
|
2553
|
-
|
|
2620
|
+
])), T = G(() => ue(e.messages).map((e) => e.id)), E = () => {
|
|
2621
|
+
b.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: b.value }).run(), t.value = null);
|
|
2622
|
+
}, D = () => {
|
|
2623
|
+
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), p.value = "", t.value = null;
|
|
2624
|
+
}, O = (n) => {
|
|
2625
|
+
t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
|
|
2626
|
+
}, k = V(() => {
|
|
2627
|
+
ze(e.editor, d), a.value = d;
|
|
2628
|
+
}), A = (n = !0) => {
|
|
2629
|
+
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && Le(e.editor), Ae(e.editor), t.value = null, n && e.editor.commands.focus();
|
|
2630
|
+
}, j = () => {
|
|
2631
|
+
if (!f.value) return;
|
|
2632
|
+
let r = Ve(e.editor);
|
|
2633
|
+
r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus()));
|
|
2634
|
+
}, M = async (t) => {
|
|
2635
|
+
if (!f.value || e.askAi?.enabled !== !0 || !s.value) return;
|
|
2636
|
+
let u = (t ?? r.value).trim();
|
|
2637
|
+
if (!u) {
|
|
2638
|
+
o.value = e.messages.askAi.emptyPrompt, n.value = "error";
|
|
2639
|
+
return;
|
|
2640
|
+
}
|
|
2641
|
+
let p = Me(e.editor, s.value);
|
|
2642
|
+
if (!p) {
|
|
2643
|
+
n.value = "conflict";
|
|
2644
|
+
return;
|
|
2645
|
+
}
|
|
2646
|
+
s.value = p, c.value?.abort(), ke(e.editor);
|
|
2647
|
+
let m = new AbortController(), h = je(p, u, e.lang, m.signal, void 0, Pe(e.editor)?.target);
|
|
2648
|
+
c.value = m, l.value = h.id, i.value = u, k.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
|
|
2649
|
+
try {
|
|
2650
|
+
let t = await Re(e.askAi.handler, h, (e) => {
|
|
2651
|
+
l.value === h.id && !m.signal.aborted && (d = e, k.schedule());
|
|
2652
|
+
});
|
|
2653
|
+
if (l.value !== h.id || m.signal.aborted) return;
|
|
2654
|
+
if (k.cancel(), d = t, !ze(e.editor, t)) throw new Te("invalid-output", "Ask AI output is incompatible with the selected content.");
|
|
2655
|
+
a.value = t, r.value = "", n.value = Pe(e.editor)?.status === "target" ? "result" : "conflict";
|
|
2656
|
+
} catch (t) {
|
|
2657
|
+
if (l.value !== h.id) return;
|
|
2658
|
+
if (k.cancel(), m.signal.aborted) {
|
|
2659
|
+
ke(e.editor), n.value = Pe(e.editor)?.status === "conflict" ? "conflict" : "input";
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
ke(e.editor), o.value = t instanceof Te ? 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
|
+
}
|
|
2664
|
+
}, N = () => {
|
|
2665
|
+
if (!Ee(e.editor, a.value)) {
|
|
2666
|
+
n.value = Pe(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
|
|
2667
|
+
return;
|
|
2668
|
+
}
|
|
2669
|
+
t.value = null, window.setTimeout(() => Ae(e.editor), 560), e.editor.commands.focus();
|
|
2670
|
+
}, P = V(() => {
|
|
2671
|
+
let n = _.value, r = y.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
2554
2672
|
if (!t.value || !n || !r) return;
|
|
2555
|
-
|
|
2673
|
+
if (t.value === "ask-ai") {
|
|
2674
|
+
let t = Fe(e.editor), n = v.value?.getBoundingClientRect();
|
|
2675
|
+
if (!t || !n) return;
|
|
2676
|
+
let a = {
|
|
2677
|
+
anchorRect: n,
|
|
2678
|
+
selectionRect: t,
|
|
2679
|
+
viewport: {
|
|
2680
|
+
width: window.innerWidth,
|
|
2681
|
+
height: window.innerHeight
|
|
2682
|
+
},
|
|
2683
|
+
frameRect: i?.getBoundingClientRect() ?? null,
|
|
2684
|
+
surfaceRect: Ne(e.editor.view.dom)
|
|
2685
|
+
}, o = De({
|
|
2686
|
+
...a,
|
|
2687
|
+
panelSize: r.getBoundingClientRect()
|
|
2688
|
+
}), s = `${o.width}px`;
|
|
2689
|
+
r.style.width !== s && (r.style.width = s, o = De({
|
|
2690
|
+
...a,
|
|
2691
|
+
panelSize: r.getBoundingClientRect()
|
|
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
|
+
return;
|
|
2694
|
+
}
|
|
2695
|
+
let a = ve({
|
|
2556
2696
|
toolbarRect: n.getBoundingClientRect(),
|
|
2557
2697
|
popoverSize: r.getBoundingClientRect(),
|
|
2558
2698
|
viewport: {
|
|
@@ -2562,57 +2702,72 @@ var ki = Y({
|
|
|
2562
2702
|
frameRect: i?.getBoundingClientRect() ?? null,
|
|
2563
2703
|
gap: t.value === "more" ? 8 : 6
|
|
2564
2704
|
});
|
|
2565
|
-
|
|
2566
|
-
})
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2705
|
+
g.value = a.placement;
|
|
2706
|
+
}), F = () => {
|
|
2707
|
+
let l = Pe(e.editor);
|
|
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", J(() => u.value?.focus());
|
|
2710
|
+
return;
|
|
2711
|
+
}
|
|
2712
|
+
t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(), k.cancel(), n.value = "conflict");
|
|
2713
|
+
}, I = (e) => {
|
|
2714
|
+
e.key !== "Escape" || t.value !== "ask-ai" || (e.preventDefault(), n.value === "generating" ? (c.value?.abort(), k.cancel(), n.value = "input") : A(!0));
|
|
2715
|
+
};
|
|
2716
|
+
K(() => [
|
|
2717
|
+
t.value,
|
|
2718
|
+
n.value,
|
|
2719
|
+
a.value,
|
|
2720
|
+
o.value
|
|
2721
|
+
], ([e]) => {
|
|
2722
|
+
e && J(P.schedule);
|
|
2723
|
+
}), nr(() => {
|
|
2724
|
+
window.addEventListener("resize", P.schedule), window.addEventListener("scroll", P.schedule, !0), e.editor.on("transaction", F), document.addEventListener("keydown", I, !0);
|
|
2571
2725
|
}), q(() => {
|
|
2572
|
-
|
|
2726
|
+
P.cancel(), k.cancel(), window.removeEventListener("resize", P.schedule), window.removeEventListener("scroll", P.schedule, !0), e.editor.off("transaction", F), document.removeEventListener("keydown", I, !0), c.value?.abort(), Ae(e.editor);
|
|
2573
2727
|
});
|
|
2574
|
-
let
|
|
2575
|
-
if (
|
|
2576
|
-
|
|
2728
|
+
let L = (n) => n === "block-type" || n === "color" || n === "more" ? t.value === n : n === "bold" ? e.editor.isActive("bold") : n === "italic" ? e.editor.isActive("italic") : n === "underline" ? e.editor.isActive("underline") : n === "strike" ? e.editor.isActive("strike") : n === "inline-code" ? e.editor.isActive("code") : n === "link" ? e.editor.isActive("link") : !1, ee = (e, t) => {
|
|
2729
|
+
if (m.value = e, !e || !(t instanceof HTMLElement) || !v.value) {
|
|
2730
|
+
h.value = null;
|
|
2577
2731
|
return;
|
|
2578
2732
|
}
|
|
2579
|
-
let n = t.getBoundingClientRect(),
|
|
2580
|
-
|
|
2581
|
-
},
|
|
2582
|
-
let e =
|
|
2733
|
+
let n = t.getBoundingClientRect(), r = v.value.getBoundingClientRect();
|
|
2734
|
+
h.value = n.left + n.width / 2 - r.left;
|
|
2735
|
+
}, R = () => {
|
|
2736
|
+
let e = m.value;
|
|
2583
2737
|
if (!e || t.value !== null) return null;
|
|
2584
|
-
let n =
|
|
2738
|
+
let n = x.value.buttons[e];
|
|
2585
2739
|
return n ? H("div", {
|
|
2586
2740
|
class: "markweave-floating-toolbar-tooltip",
|
|
2587
2741
|
role: "tooltip",
|
|
2588
2742
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
2589
2743
|
"data-button-id": e,
|
|
2590
|
-
"data-active":
|
|
2591
|
-
style:
|
|
2744
|
+
"data-active": L(e),
|
|
2745
|
+
style: h.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${h.value}px` }
|
|
2592
2746
|
}, n) : null;
|
|
2593
|
-
},
|
|
2747
|
+
}, z = (n, r, i, a, o = !1, s) => H("button", {
|
|
2594
2748
|
type: "button",
|
|
2595
2749
|
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
2596
|
-
"aria-label":
|
|
2750
|
+
"aria-label": r,
|
|
2597
2751
|
"aria-expanded": [
|
|
2752
|
+
"ask-ai",
|
|
2598
2753
|
"block-type",
|
|
2599
2754
|
"link",
|
|
2600
2755
|
"color",
|
|
2601
2756
|
"more"
|
|
2602
2757
|
].includes(n) ? t.value === n : void 0,
|
|
2603
|
-
"data-active":
|
|
2604
|
-
"data-tooltip-active":
|
|
2758
|
+
"data-active": o || t.value === n,
|
|
2759
|
+
"data-tooltip-active": m.value === n ? "true" : "false",
|
|
2605
2760
|
"data-testid": `markweave-floating-toolbar-button-${n}`,
|
|
2606
|
-
onBlur: () =>
|
|
2607
|
-
onFocus: (e) =>
|
|
2761
|
+
onBlur: () => ee(null),
|
|
2762
|
+
onFocus: (e) => ee(n, e.currentTarget),
|
|
2608
2763
|
onMousedown: $,
|
|
2609
|
-
onMouseenter: (e) =>
|
|
2610
|
-
onMouseleave: () =>
|
|
2611
|
-
onClick:
|
|
2612
|
-
}, n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" },
|
|
2764
|
+
onMouseenter: (e) => ee(n, e.currentTarget),
|
|
2765
|
+
onMouseleave: () => ee(null),
|
|
2766
|
+
onClick: a
|
|
2767
|
+
}, n === "ask-ai" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [Z(i, r), H("span", null, s ?? r)])] : n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, Zi(e.editor, e.messages)), Z(t.value === "block-type" ? Ar : Or, r)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? Ar : Or, r)])] : [Z(i, r)]), B = () => H("span", {
|
|
2613
2768
|
class: "markweave-floating-toolbar-divider",
|
|
2614
2769
|
"aria-hidden": "true"
|
|
2615
|
-
}),
|
|
2770
|
+
}), ne = (n, r, i) => H("section", {
|
|
2616
2771
|
class: "markweave-floating-toolbar-color-section",
|
|
2617
2772
|
"aria-label": n
|
|
2618
2773
|
}, [H("div", { class: "markweave-floating-toolbar-menu-title" }, n), H("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => H("button", {
|
|
@@ -2631,121 +2786,215 @@ var ki = Y({
|
|
|
2631
2786
|
class: "markweave-floating-toolbar-highlight-swatch",
|
|
2632
2787
|
style: { backgroundColor: i ?? "#ffffff" },
|
|
2633
2788
|
"aria-hidden": "true"
|
|
2634
|
-
})])))]),
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2789
|
+
})])))]), re = () => {
|
|
2790
|
+
if (t.value === "ask-ai") {
|
|
2791
|
+
let t = (e, t, n, r) => H("button", {
|
|
2792
|
+
type: "button",
|
|
2793
|
+
class: n,
|
|
2794
|
+
onMousedown: $,
|
|
2795
|
+
onClick: t
|
|
2796
|
+
}, r ? [Z(r, e), H("span", null, e)] : e), s = n.value === "input" || n.value === "result" || n.value === "error" ? H("div", {
|
|
2797
|
+
class: "markweave-ask-ai-composer",
|
|
2798
|
+
"data-variant": n.value === "result" ? "follow-up" : "prompt"
|
|
2799
|
+
}, [H("textarea", {
|
|
2800
|
+
ref: u,
|
|
2801
|
+
class: "markweave-ask-ai-input",
|
|
2802
|
+
rows: 2,
|
|
2803
|
+
placeholder: n.value === "result" ? e.messages.askAi.followUpPlaceholder : e.messages.askAi.promptPlaceholder,
|
|
2804
|
+
"aria-label": n.value === "result" ? e.messages.askAi.followUpPlaceholder : e.messages.askAi.promptPlaceholder,
|
|
2805
|
+
value: r.value,
|
|
2806
|
+
onInput: (e) => {
|
|
2807
|
+
r.value = e.target.value;
|
|
2808
|
+
},
|
|
2809
|
+
onKeydown: (e) => {
|
|
2810
|
+
e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), M());
|
|
2811
|
+
}
|
|
2812
|
+
}), H("button", {
|
|
2813
|
+
type: "button",
|
|
2814
|
+
class: "markweave-ask-ai-send",
|
|
2815
|
+
"aria-label": e.messages.askAi.send,
|
|
2816
|
+
disabled: !r.value.trim(),
|
|
2817
|
+
onMousedown: $,
|
|
2818
|
+
onClick: () => {
|
|
2819
|
+
M();
|
|
2820
|
+
}
|
|
2821
|
+
}, [Z(_r, e.messages.askAi.send)])]) : null;
|
|
2822
|
+
return H("section", {
|
|
2823
|
+
ref: y,
|
|
2824
|
+
class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
|
|
2825
|
+
"aria-label": e.messages.askAi.ariaLabel,
|
|
2826
|
+
"data-phase": n.value,
|
|
2827
|
+
"data-testid": "markweave-ask-ai-popover"
|
|
2828
|
+
}, [
|
|
2829
|
+
s,
|
|
2830
|
+
n.value === "generating" ? H("div", {
|
|
2831
|
+
class: "markweave-ask-ai-progress markweave-ask-ai-generating",
|
|
2832
|
+
role: "status"
|
|
2833
|
+
}, [
|
|
2834
|
+
H("span", {
|
|
2835
|
+
class: "markweave-ask-ai-sparkles",
|
|
2836
|
+
"aria-hidden": "true"
|
|
2837
|
+
}, [Z(li, "")]),
|
|
2838
|
+
H("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
|
|
2839
|
+
H("button", {
|
|
2840
|
+
type: "button",
|
|
2841
|
+
class: "markweave-ask-ai-stop",
|
|
2842
|
+
"aria-label": e.messages.askAi.stop,
|
|
2843
|
+
onMousedown: $,
|
|
2844
|
+
onClick: () => {
|
|
2845
|
+
c.value?.abort(), k.cancel(), ke(e.editor), n.value = "input";
|
|
2846
|
+
}
|
|
2847
|
+
}, [Z(ui, e.messages.askAi.stop)])
|
|
2848
|
+
]) : null,
|
|
2849
|
+
n.value === "result" ? H("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
2850
|
+
t(e.messages.askAi.retry, () => {
|
|
2851
|
+
M(i.value);
|
|
2852
|
+
}, "markweave-ask-ai-retry", oi),
|
|
2853
|
+
H("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
2854
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", wi),
|
|
2855
|
+
t(e.messages.askAi.accept, N, "markweave-ask-ai-accept", Er)
|
|
2856
|
+
]) : null,
|
|
2857
|
+
n.value === "error" || n.value === "conflict" ? H("div", {
|
|
2858
|
+
class: "markweave-ask-ai-error",
|
|
2859
|
+
role: "alert"
|
|
2860
|
+
}, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, H("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
2861
|
+
n.value === "error" ? t(e.messages.askAi.retry, () => {
|
|
2862
|
+
M(i.value);
|
|
2863
|
+
}, "markweave-ask-ai-retry", oi) : null,
|
|
2864
|
+
H("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
2865
|
+
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", wi)
|
|
2866
|
+
])]) : null
|
|
2867
|
+
]);
|
|
2660
2868
|
}
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
onMousedown: $
|
|
2668
|
-
}, [Z(mr, u.value.applyLink)]),
|
|
2669
|
-
H("span", {
|
|
2670
|
-
class: "markweave-floating-toolbar-link-divider",
|
|
2671
|
-
"aria-hidden": "true"
|
|
2672
|
-
}),
|
|
2673
|
-
H("button", {
|
|
2869
|
+
return t.value === "block-type" ? H("div", {
|
|
2870
|
+
ref: y,
|
|
2871
|
+
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
|
|
2872
|
+
"data-testid": "markweave-floating-toolbar-turn-menu"
|
|
2873
|
+
}, [H("div", { class: "markweave-floating-toolbar-menu-title" }, x.value.turnIntoTitle), ...S.value.map(([n, r, i]) => H("button", {
|
|
2874
|
+
key: n,
|
|
2674
2875
|
type: "button",
|
|
2675
|
-
|
|
2676
|
-
"aria-label": u.value.openLink,
|
|
2677
|
-
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2876
|
+
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
2678
2877
|
onMousedown: $,
|
|
2679
|
-
onClick: () =>
|
|
2680
|
-
|
|
2681
|
-
|
|
2878
|
+
onClick: () => {
|
|
2879
|
+
me(e.editor, n), t.value = null;
|
|
2880
|
+
}
|
|
2881
|
+
}, [H("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), H("span", null, r)]))]) : t.value === "link" ? H("form", {
|
|
2882
|
+
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
2883
|
+
ref: y,
|
|
2884
|
+
"data-testid": "markweave-floating-toolbar-link-popover",
|
|
2885
|
+
onSubmit: (e) => {
|
|
2886
|
+
e.preventDefault(), E();
|
|
2887
|
+
}
|
|
2888
|
+
}, [H("input", {
|
|
2889
|
+
value: p.value,
|
|
2890
|
+
placeholder: x.value.linkPlaceholder,
|
|
2891
|
+
"aria-label": x.value.linkUrlLabel,
|
|
2892
|
+
"data-testid": "markweave-floating-toolbar-link-input",
|
|
2893
|
+
onInput: (e) => {
|
|
2894
|
+
p.value = e.target.value;
|
|
2895
|
+
}
|
|
2896
|
+
}), H("span", { class: "markweave-floating-toolbar-link-actions" }, [
|
|
2897
|
+
H("button", {
|
|
2898
|
+
type: "submit",
|
|
2899
|
+
disabled: !b.value,
|
|
2900
|
+
"aria-label": x.value.applyLink,
|
|
2901
|
+
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2902
|
+
onMousedown: $
|
|
2903
|
+
}, [Z(Nr, x.value.applyLink)]),
|
|
2904
|
+
H("span", {
|
|
2905
|
+
class: "markweave-floating-toolbar-link-divider",
|
|
2906
|
+
"aria-hidden": "true"
|
|
2907
|
+
}),
|
|
2908
|
+
H("button", {
|
|
2909
|
+
type: "button",
|
|
2910
|
+
disabled: !b.value,
|
|
2911
|
+
"aria-label": x.value.openLink,
|
|
2912
|
+
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2913
|
+
onMousedown: $,
|
|
2914
|
+
onClick: () => Ki(p.value)
|
|
2915
|
+
}, [Z(Lr, x.value.openLink)]),
|
|
2916
|
+
H("button", {
|
|
2917
|
+
type: "button",
|
|
2918
|
+
"aria-label": x.value.removeLink,
|
|
2919
|
+
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2920
|
+
onMousedown: $,
|
|
2921
|
+
onClick: D
|
|
2922
|
+
}, [Z(yi, x.value.removeLink)])
|
|
2923
|
+
])]) : t.value === "color" ? H("div", {
|
|
2924
|
+
ref: y,
|
|
2925
|
+
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
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" ? H("div", {
|
|
2928
|
+
ref: y,
|
|
2929
|
+
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
2930
|
+
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
2931
|
+
}, T.value.map((n) => H("span", {
|
|
2932
|
+
key: n,
|
|
2933
|
+
class: "markweave-floating-toolbar-more-item"
|
|
2934
|
+
}, [H("button", {
|
|
2682
2935
|
type: "button",
|
|
2683
|
-
"aria-label":
|
|
2684
|
-
"data-testid":
|
|
2936
|
+
"aria-label": x.value.moreActions[n],
|
|
2937
|
+
"data-testid": `markweave-floating-toolbar-more-${n}`,
|
|
2938
|
+
"data-tooltip-active": m.value === n ? "true" : "false",
|
|
2685
2939
|
onMousedown: $,
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
"
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
}
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
onMouseenter: () => {
|
|
2706
|
-
r.value = n;
|
|
2940
|
+
onMouseenter: () => {
|
|
2941
|
+
m.value = n;
|
|
2942
|
+
},
|
|
2943
|
+
onMouseleave: () => {
|
|
2944
|
+
m.value = null;
|
|
2945
|
+
},
|
|
2946
|
+
onClick: () => {
|
|
2947
|
+
pe(e.editor, n), t.value = null;
|
|
2948
|
+
}
|
|
2949
|
+
}, [Z(qi[n], x.value.moreActions[n])]), m.value === n ? H("div", {
|
|
2950
|
+
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2951
|
+
role: "tooltip"
|
|
2952
|
+
}, x.value.moreActions[n]) : null]))) : null;
|
|
2953
|
+
};
|
|
2954
|
+
return () => H(te, {
|
|
2955
|
+
editor: e.editor,
|
|
2956
|
+
shouldShow: ({ editor: e }) => {
|
|
2957
|
+
let t = Pe(e);
|
|
2958
|
+
return e.isEditable && (t?.target.kind === "table" && t.status === "target" ? !0 : xe(ye(e)));
|
|
2707
2959
|
},
|
|
2708
|
-
|
|
2709
|
-
|
|
2960
|
+
getReferencedVirtualElement: () => {
|
|
2961
|
+
let t = Pe(e.editor)?.target.kind === "table" ? Fe(e.editor) : null;
|
|
2962
|
+
return t ? {
|
|
2963
|
+
getBoundingClientRect: () => new DOMRect(t.left, t.top, t.width, t.height),
|
|
2964
|
+
getClientRects: () => [new DOMRect(t.left, t.top, t.width, t.height)]
|
|
2965
|
+
} : null;
|
|
2710
2966
|
},
|
|
2711
|
-
onClick: () => {
|
|
2712
|
-
fe(e.editor, n), t.value = null;
|
|
2713
|
-
}
|
|
2714
|
-
}, [Z(wi[n], u.value.moreActions[n])]), r.value === n ? H("div", {
|
|
2715
|
-
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2716
|
-
role: "tooltip"
|
|
2717
|
-
}, u.value.moreActions[n]) : null]))) : null;
|
|
2718
|
-
return () => H(R, {
|
|
2719
|
-
editor: e.editor,
|
|
2720
|
-
shouldShow: ({ editor: e }) => e.isEditable && be(ve(e)),
|
|
2721
2967
|
options: { placement: "top" }
|
|
2722
2968
|
}, { default: () => H("div", {
|
|
2723
|
-
ref:
|
|
2969
|
+
ref: _,
|
|
2724
2970
|
class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
|
|
2725
|
-
"data-popover-placement": t.value ?
|
|
2971
|
+
"data-popover-placement": t.value ? g.value : void 0,
|
|
2972
|
+
"data-ask-ai-session": t.value === "ask-ai" ? "open" : "closed",
|
|
2726
2973
|
"data-testid": "markweave-floating-toolbar"
|
|
2727
2974
|
}, [H("div", {
|
|
2728
|
-
ref:
|
|
2975
|
+
ref: v,
|
|
2729
2976
|
class: "markweave-floating-toolbar-content",
|
|
2730
2977
|
"data-menu": t.value ?? "none"
|
|
2731
2978
|
}, [
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
x()
|
|
2979
|
+
f.value && Ie(e.editor) ? z("ask-ai", x.value.buttons["ask-ai"], li, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
|
|
2980
|
+
f.value && Ie(e.editor) ? B() : null,
|
|
2981
|
+
z("block-type", x.value.buttons["block-type"], bi, () => O("block-type"), t.value === "block-type"),
|
|
2982
|
+
B(),
|
|
2983
|
+
z("bold", x.value.buttons.bold, Cr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2984
|
+
z("italic", x.value.buttons.italic, Kr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2985
|
+
z("underline", x.value.buttons.underline, xi, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2986
|
+
z("strike", x.value.buttons.strike, fi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2987
|
+
z("inline-code", x.value.buttons["inline-code"], Mr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2988
|
+
B(),
|
|
2989
|
+
z("link", x.value.buttons.link, Jr, () => O("link"), e.editor.isActive("link")),
|
|
2990
|
+
z("color", x.value.buttons.color, bi, () => O("color"), t.value === "color"),
|
|
2991
|
+
B(),
|
|
2992
|
+
z("more", x.value.buttons.more, $r, () => O("more"), t.value === "more"),
|
|
2993
|
+
re(),
|
|
2994
|
+
R()
|
|
2746
2995
|
])]) });
|
|
2747
2996
|
}
|
|
2748
|
-
}),
|
|
2997
|
+
}), $i = Y({
|
|
2749
2998
|
name: "MarkweaveVueMathEditorPopover",
|
|
2750
2999
|
props: {
|
|
2751
3000
|
editor: {
|
|
@@ -2766,17 +3015,17 @@ var ki = Y({
|
|
|
2766
3015
|
}
|
|
2767
3016
|
},
|
|
2768
3017
|
setup(e) {
|
|
2769
|
-
let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(
|
|
3018
|
+
let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(It(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
|
|
2770
3019
|
html: a.value,
|
|
2771
3020
|
error: !1
|
|
2772
|
-
} :
|
|
3021
|
+
} : Bt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => Ft(e.editor, e.target) ?? 1), u = () => {
|
|
2773
3022
|
if (typeof window > "u") return;
|
|
2774
|
-
let r =
|
|
3023
|
+
let r = Pt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2775
3024
|
if (!r || !i) {
|
|
2776
3025
|
e.onClose();
|
|
2777
3026
|
return;
|
|
2778
3027
|
}
|
|
2779
|
-
n.value =
|
|
3028
|
+
n.value = Nt({
|
|
2780
3029
|
anchorRect: r,
|
|
2781
3030
|
frameRect: i,
|
|
2782
3031
|
kind: e.target.kind,
|
|
@@ -2785,7 +3034,7 @@ var ki = Y({
|
|
|
2785
3034
|
viewportWidth: window.innerWidth
|
|
2786
3035
|
});
|
|
2787
3036
|
}, d = () => {
|
|
2788
|
-
s.value &&
|
|
3037
|
+
s.value && Mt(e.editor, e.target, t.value) && e.onClose();
|
|
2789
3038
|
}, f = (t) => {
|
|
2790
3039
|
if (t.key === "Escape") {
|
|
2791
3040
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -2797,13 +3046,13 @@ var ki = Y({
|
|
|
2797
3046
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2798
3047
|
};
|
|
2799
3048
|
return K(() => [e.target.pos, e.target.latex], () => {
|
|
2800
|
-
t.value = e.target.latex, a.value =
|
|
2801
|
-
}),
|
|
2802
|
-
|
|
3049
|
+
t.value = e.target.latex, a.value = It(e.editor, e.target), J(u);
|
|
3050
|
+
}), nr(() => {
|
|
3051
|
+
Vt(e.editor, e.target, !0), u(), J(() => {
|
|
2803
3052
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2804
3053
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2805
3054
|
}), q(() => {
|
|
2806
|
-
|
|
3055
|
+
Vt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2807
3056
|
}), () => {
|
|
2808
3057
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2809
3058
|
ref: i,
|
|
@@ -2864,14 +3113,14 @@ var ki = Y({
|
|
|
2864
3113
|
}, [
|
|
2865
3114
|
H("div", { class: "markweave-math-block-toolbar" }, [
|
|
2866
3115
|
H("span", null, c.value.label),
|
|
2867
|
-
Z(
|
|
3116
|
+
Z(Mr, c.value.label, 15, 1.75),
|
|
2868
3117
|
H("button", {
|
|
2869
3118
|
type: "submit",
|
|
2870
3119
|
title: c.value.apply,
|
|
2871
3120
|
"aria-label": c.value.apply,
|
|
2872
3121
|
disabled: !s.value,
|
|
2873
3122
|
"data-testid": "markweave-math-editor-apply"
|
|
2874
|
-
}, [Z(
|
|
3123
|
+
}, [Z(Dr, c.value.apply, 16, 2)])
|
|
2875
3124
|
]),
|
|
2876
3125
|
H("label", {
|
|
2877
3126
|
class: "markweave-math-block-source",
|
|
@@ -2894,7 +3143,7 @@ var ki = Y({
|
|
|
2894
3143
|
]);
|
|
2895
3144
|
};
|
|
2896
3145
|
}
|
|
2897
|
-
}),
|
|
3146
|
+
}), ea = Y({
|
|
2898
3147
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2899
3148
|
props: {
|
|
2900
3149
|
commands: {
|
|
@@ -2953,13 +3202,13 @@ var ki = Y({
|
|
|
2953
3202
|
} : {
|
|
2954
3203
|
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
2955
3204
|
trigger: "slash-command",
|
|
2956
|
-
source:
|
|
3205
|
+
source: L(t.value)
|
|
2957
3206
|
};
|
|
2958
3207
|
if (!n.value && !t.value.trim()) {
|
|
2959
3208
|
r.value = e.messages.slash.uploadRequiredError;
|
|
2960
3209
|
return;
|
|
2961
3210
|
}
|
|
2962
|
-
let a = await
|
|
3211
|
+
let a = await R(i, e.onUpload);
|
|
2963
3212
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2964
3213
|
} catch (t) {
|
|
2965
3214
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -3080,7 +3329,7 @@ var ki = Y({
|
|
|
3080
3329
|
class: "markweave-slash-group",
|
|
3081
3330
|
"aria-label": t.group
|
|
3082
3331
|
}, [H("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
3083
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
3332
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = Xt(t);
|
|
3084
3333
|
return H("button", {
|
|
3085
3334
|
key: t.id,
|
|
3086
3335
|
type: "button",
|
|
@@ -3103,7 +3352,7 @@ var ki = Y({
|
|
|
3103
3352
|
}
|
|
3104
3353
|
}
|
|
3105
3354
|
}, [
|
|
3106
|
-
|
|
3355
|
+
Yi(t.icon),
|
|
3107
3356
|
H("span", null, t.label),
|
|
3108
3357
|
t.disabledReason ? H("small", null, t.disabledReason) : null
|
|
3109
3358
|
]);
|
|
@@ -3114,33 +3363,34 @@ var ki = Y({
|
|
|
3114
3363
|
}, e.messages.slash.noResults)])]);
|
|
3115
3364
|
};
|
|
3116
3365
|
}
|
|
3117
|
-
}),
|
|
3118
|
-
"
|
|
3119
|
-
"move-
|
|
3120
|
-
"move-
|
|
3121
|
-
"move-
|
|
3122
|
-
"
|
|
3123
|
-
"insert-
|
|
3124
|
-
"insert-
|
|
3125
|
-
"insert-
|
|
3126
|
-
"
|
|
3127
|
-
"sort-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3366
|
+
}), ta = {
|
|
3367
|
+
"ask-ai": li,
|
|
3368
|
+
"move-left": hr,
|
|
3369
|
+
"move-right": gr,
|
|
3370
|
+
"move-up": _r,
|
|
3371
|
+
"move-down": pr,
|
|
3372
|
+
"insert-left": Sr,
|
|
3373
|
+
"insert-right": xr,
|
|
3374
|
+
"insert-above": br,
|
|
3375
|
+
"insert-below": yr,
|
|
3376
|
+
"sort-asc": mr,
|
|
3377
|
+
"sort-desc": vr,
|
|
3378
|
+
color: ei,
|
|
3379
|
+
alignment: sr,
|
|
3380
|
+
clear: di,
|
|
3381
|
+
duplicate: Pr,
|
|
3382
|
+
copy: Pr,
|
|
3383
|
+
merge: gi,
|
|
3384
|
+
split: _i,
|
|
3385
|
+
delete: yi
|
|
3386
|
+
}, na = {
|
|
3387
|
+
left: sr,
|
|
3388
|
+
center: ar,
|
|
3389
|
+
right: cr,
|
|
3390
|
+
top: dr,
|
|
3391
|
+
middle: lr,
|
|
3392
|
+
bottom: ur
|
|
3393
|
+
}, ra = Y({
|
|
3144
3394
|
name: "MarkweaveVueTableControls",
|
|
3145
3395
|
props: {
|
|
3146
3396
|
editor: {
|
|
@@ -3159,6 +3409,10 @@ var ki = Y({
|
|
|
3159
3409
|
type: Object,
|
|
3160
3410
|
required: !0
|
|
3161
3411
|
},
|
|
3412
|
+
askAi: {
|
|
3413
|
+
type: Object,
|
|
3414
|
+
default: void 0
|
|
3415
|
+
},
|
|
3162
3416
|
onCopyPayload: {
|
|
3163
3417
|
type: Function,
|
|
3164
3418
|
default: void 0
|
|
@@ -3173,15 +3427,15 @@ var ki = Y({
|
|
|
3173
3427
|
}
|
|
3174
3428
|
},
|
|
3175
3429
|
setup(e) {
|
|
3176
|
-
let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(null), f = U(0), p = U(null), m = U(null), h = U(null), g = U(null), _ = U(null), v = U(null), y = U(null), b = null, x = null, S = null, C = G(() => e.active ?
|
|
3430
|
+
let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(null), f = U(0), p = U(null), m = U(null), h = U(null), g = U(null), _ = U(null), v = U(null), y = U(null), b = null, x = null, S = null, C = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = G(() => e.active ? un(e.editor.state) : Vi), T = G(() => kn(e.editor, e.interactionState, "row", w.value.activeCellPos)), E = G(() => kn(e.editor, e.interactionState, "column", w.value.activeCellPos)), D = G(() => Tn(e.editor)), O = G(() => (D.value, w.value.active && Nn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), k = G(() => t.value ? Nn(e.editor, t.value, { askAiEnabled: C.value }) : []), A = () => {
|
|
3177
3431
|
b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
|
|
3178
|
-
},
|
|
3179
|
-
|
|
3432
|
+
}, j = (e) => {
|
|
3433
|
+
A(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
|
|
3180
3434
|
d.value = null, b = null;
|
|
3181
|
-
},
|
|
3182
|
-
},
|
|
3435
|
+
}, zn));
|
|
3436
|
+
}, M = () => {
|
|
3183
3437
|
if (!e.active) {
|
|
3184
|
-
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null,
|
|
3438
|
+
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, j(null);
|
|
3185
3439
|
return;
|
|
3186
3440
|
}
|
|
3187
3441
|
let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement;
|
|
@@ -3189,31 +3443,31 @@ var ki = Y({
|
|
|
3189
3443
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
|
|
3190
3444
|
return;
|
|
3191
3445
|
}
|
|
3192
|
-
let l = n.getBoundingClientRect(), u =
|
|
3193
|
-
u ? i.value =
|
|
3446
|
+
let l = n.getBoundingClientRect(), u = T.value ? On(e.editor, T.value) : null, d = E.value ? On(e.editor, E.value) : null, f = O.value ? Pn(e.editor) : null, p = wn(e.editor)?.getBoundingClientRect() ?? null;
|
|
3447
|
+
u ? i.value = yn({
|
|
3194
3448
|
targetRect: u,
|
|
3195
3449
|
frameRect: l,
|
|
3196
3450
|
kind: "row"
|
|
3197
|
-
}) : 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 = yn({
|
|
3198
3452
|
targetRect: d,
|
|
3199
3453
|
frameRect: l,
|
|
3200
3454
|
kind: "column"
|
|
3201
|
-
}) : 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 = yn({
|
|
3202
3456
|
targetRect: f,
|
|
3203
3457
|
frameRect: l,
|
|
3204
3458
|
kind: "selection"
|
|
3205
3459
|
}) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
|
|
3206
|
-
let m = e.interactionState.hoverCellPos !== null && !!(
|
|
3207
|
-
s.value = p && m ?
|
|
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 ? bn({
|
|
3208
3462
|
tableRect: p,
|
|
3209
3463
|
frameRect: l,
|
|
3210
3464
|
kind: "row"
|
|
3211
|
-
}) : null, c.value = p && h ?
|
|
3465
|
+
}) : null, c.value = p && h ? bn({
|
|
3212
3466
|
tableRect: p,
|
|
3213
3467
|
frameRect: l,
|
|
3214
3468
|
kind: "column"
|
|
3215
3469
|
}) : null;
|
|
3216
|
-
},
|
|
3470
|
+
}, N = () => {
|
|
3217
3471
|
if (!e.active || !t.value) {
|
|
3218
3472
|
l.value = null;
|
|
3219
3473
|
return;
|
|
@@ -3223,23 +3477,23 @@ var ki = Y({
|
|
|
3223
3477
|
l.value = null;
|
|
3224
3478
|
return;
|
|
3225
3479
|
}
|
|
3226
|
-
let a = i.getBoundingClientRect(), o = t.value === "row" ?
|
|
3480
|
+
let a = i.getBoundingClientRect(), o = t.value === "row" ? wn(e.editor)?.getBoundingClientRect() : null, s = o ? {
|
|
3227
3481
|
left: a.left,
|
|
3228
3482
|
top: o.top,
|
|
3229
3483
|
width: a.width,
|
|
3230
3484
|
height: a.height
|
|
3231
3485
|
} : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
|
|
3232
|
-
l.value =
|
|
3486
|
+
l.value = _n({
|
|
3233
3487
|
anchorRect: s,
|
|
3234
3488
|
frameRect: c,
|
|
3235
|
-
boundaryRect:
|
|
3489
|
+
boundaryRect: An(n),
|
|
3236
3490
|
menuSize: {
|
|
3237
3491
|
width: u.width || 254,
|
|
3238
3492
|
height: f || u.height || 410
|
|
3239
3493
|
},
|
|
3240
3494
|
kind: t.value
|
|
3241
3495
|
});
|
|
3242
|
-
},
|
|
3496
|
+
}, P = () => {
|
|
3243
3497
|
if (!e.active || !t.value || !n.value || !l.value) {
|
|
3244
3498
|
u.value = null;
|
|
3245
3499
|
return;
|
|
@@ -3250,47 +3504,46 @@ var ki = Y({
|
|
|
3250
3504
|
return;
|
|
3251
3505
|
}
|
|
3252
3506
|
let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
|
|
3253
|
-
u.value =
|
|
3507
|
+
u.value = vn({
|
|
3254
3508
|
triggerRect: i.getBoundingClientRect(),
|
|
3255
3509
|
parentMenuRect: _.value.getBoundingClientRect(),
|
|
3256
|
-
boundaryRect:
|
|
3510
|
+
boundaryRect: An(r),
|
|
3257
3511
|
submenuSize: {
|
|
3258
3512
|
width: a.width || 238,
|
|
3259
3513
|
height: o || 410
|
|
3260
3514
|
}
|
|
3261
3515
|
});
|
|
3262
|
-
},
|
|
3263
|
-
|
|
3264
|
-
}, P = () => {
|
|
3265
|
-
J(N);
|
|
3266
|
-
}, F = (e, i) => {
|
|
3267
|
-
let a = t.value === e && r.value === i;
|
|
3268
|
-
r.value = i, t.value = a ? null : e, n.value = null, u.value = null, P();
|
|
3516
|
+
}, F = () => {
|
|
3517
|
+
M(), N(), P();
|
|
3269
3518
|
}, I = () => {
|
|
3270
|
-
|
|
3271
|
-
},
|
|
3272
|
-
let
|
|
3273
|
-
r
|
|
3274
|
-
},
|
|
3275
|
-
|
|
3276
|
-
}, R = (
|
|
3519
|
+
J(F);
|
|
3520
|
+
}, L = (e, i) => {
|
|
3521
|
+
let a = t.value === e && r.value === i;
|
|
3522
|
+
r.value = i, t.value = a ? null : e, n.value = null, u.value = null, I();
|
|
3523
|
+
}, ee = () => {
|
|
3524
|
+
e.editor.view.dispatch(sn(e.editor.state.tr, null));
|
|
3525
|
+
}, R = (t, n) => {
|
|
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 && Ln(e.editor, r, t, { visualIndex: i }), L(t, n);
|
|
3528
|
+
}, z = () => {
|
|
3529
|
+
ee(), L("selection", "selection-edge");
|
|
3530
|
+
}, te = (r = !1) => {
|
|
3277
3531
|
t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
|
|
3278
|
-
},
|
|
3279
|
-
let i = await
|
|
3532
|
+
}, B = async (n, r) => {
|
|
3533
|
+
let i = await Sn({
|
|
3280
3534
|
editor: e.editor,
|
|
3281
3535
|
commandId: n,
|
|
3282
3536
|
menu: r ?? t.value ?? "selection",
|
|
3283
3537
|
messages: e.messages
|
|
3284
3538
|
});
|
|
3285
|
-
return i.copyFeedback ? (
|
|
3539
|
+
return i.copyFeedback ? (j(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : j(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
3540
|
+
}, ne = (t) => {
|
|
3541
|
+
C.value && (Be(e.editor, t), te(!1));
|
|
3542
|
+
}, V = (e) => {
|
|
3543
|
+
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, I());
|
|
3286
3544
|
}, re = (t) => {
|
|
3287
|
-
let n =
|
|
3288
|
-
n
|
|
3289
|
-
}, z = (e) => {
|
|
3290
|
-
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, P());
|
|
3291
|
-
}, B = (t) => {
|
|
3292
|
-
let n = t === "row" ? w.value : T.value, r = e.interactionState.hoverCellPos ?? C.value.activeCellPos;
|
|
3293
|
-
!n || r === null || Tn(e.editor, r, t, { visualIndex: n.index }) && ne(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
3545
|
+
let n = t === "row" ? T.value : E.value, r = e.interactionState.hoverCellPos ?? w.value.activeCellPos;
|
|
3546
|
+
!n || r === null || Un(e.editor, r, t, { visualIndex: n.index }) && B(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
3294
3547
|
}, ie = (e, t, n) => {
|
|
3295
3548
|
x = {
|
|
3296
3549
|
axis: e,
|
|
@@ -3298,91 +3551,94 @@ var ki = Y({
|
|
|
3298
3551
|
}, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
|
|
3299
3552
|
}, ae = (t) => {
|
|
3300
3553
|
if (!x) return;
|
|
3301
|
-
let n =
|
|
3554
|
+
let n = En(e.editor, x.axis, t.clientX, t.clientY);
|
|
3302
3555
|
n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
|
|
3303
3556
|
}, oe = (t) => {
|
|
3304
3557
|
let n = x;
|
|
3305
3558
|
if (!n) return;
|
|
3306
|
-
let r =
|
|
3307
|
-
t.preventDefault(), x = null, S = null, r !== null &&
|
|
3308
|
-
},
|
|
3559
|
+
let r = En(e.editor, n.axis, t.clientX, t.clientY) ?? S;
|
|
3560
|
+
t.preventDefault(), x = null, S = null, r !== null && In(e.editor, n.axis, n.index, r);
|
|
3561
|
+
}, se = G(() => (f.value, t.value === "row" || t.value === "column" ? Dn(e.editor, t.value) : null)), ce = (e) => {
|
|
3309
3562
|
if (!(!t.value || e.key !== "Escape")) {
|
|
3310
3563
|
if (n.value) {
|
|
3311
3564
|
n.value = null;
|
|
3312
3565
|
return;
|
|
3313
3566
|
}
|
|
3314
|
-
|
|
3567
|
+
te(!0);
|
|
3315
3568
|
}
|
|
3316
|
-
},
|
|
3569
|
+
}, le = (e) => {
|
|
3317
3570
|
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
3318
3571
|
let t = e.currentTarget;
|
|
3319
3572
|
if (!(t instanceof HTMLElement)) return;
|
|
3320
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));
|
|
3321
3574
|
e.preventDefault(), e.stopPropagation(), r[o]?.focus();
|
|
3322
|
-
},
|
|
3323
|
-
t.value && (e.target instanceof Node && p.value?.contains(e.target) ||
|
|
3575
|
+
}, ue = (e) => {
|
|
3576
|
+
t.value && (e.target instanceof Node && p.value?.contains(e.target) || te());
|
|
3324
3577
|
};
|
|
3325
|
-
|
|
3326
|
-
|
|
3578
|
+
nr(() => {
|
|
3579
|
+
F(), window.addEventListener("resize", F), window.addEventListener("scroll", F, !0), document.addEventListener("keydown", ce), document.addEventListener("mousedown", ue), document.addEventListener("dragover", ae), document.addEventListener("drop", oe);
|
|
3327
3580
|
}), q(() => {
|
|
3328
|
-
|
|
3581
|
+
A(), window.removeEventListener("resize", F), window.removeEventListener("scroll", F, !0), document.removeEventListener("keydown", ce), document.removeEventListener("mousedown", ue), document.removeEventListener("dragover", ae), document.removeEventListener("drop", oe);
|
|
3329
3582
|
}), K(() => [
|
|
3330
3583
|
e.active,
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3584
|
+
w.value.activeCellPos,
|
|
3585
|
+
w.value.selectionFrom,
|
|
3586
|
+
w.value.selectionTo,
|
|
3334
3587
|
e.interactionState.hoverCellPos,
|
|
3335
3588
|
e.interactionState.hoverVisualColumnIndex,
|
|
3336
3589
|
e.interactionState.hoverVisualRowIndex,
|
|
3337
3590
|
t.value,
|
|
3338
3591
|
n.value,
|
|
3339
3592
|
r.value
|
|
3340
|
-
],
|
|
3341
|
-
let
|
|
3593
|
+
], I, { flush: "post" });
|
|
3594
|
+
let de = () => {
|
|
3342
3595
|
if (!t.value) return null;
|
|
3343
|
-
let r =
|
|
3344
|
-
let a =
|
|
3596
|
+
let r = k.value.map((r, i) => {
|
|
3597
|
+
let a = jn(r), o = i === 0 ? a : jn(k.value[i - 1]), s = i > 0 && o !== a, c = t.value === "row" || t.value === "column" ? t.value : "selection", l = r.submenuId ? !0 : r.commandId === null ? C.value && Oe(e.editor, c) : xn(e.editor, r.commandId), u = Mn(r, e.messages), d = ta[r.icon];
|
|
3345
3598
|
return H("button", {
|
|
3346
3599
|
key: `${r.id}-${i}`,
|
|
3347
3600
|
type: "button",
|
|
3348
3601
|
role: "menuitem",
|
|
3349
|
-
"aria-label":
|
|
3350
|
-
"aria-disabled": !
|
|
3602
|
+
"aria-label": u,
|
|
3603
|
+
"aria-disabled": !l,
|
|
3351
3604
|
"aria-haspopup": r.submenuId ? "menu" : void 0,
|
|
3352
3605
|
"aria-expanded": r.submenuId ? n.value === r.submenuId : void 0,
|
|
3353
|
-
disabled: !
|
|
3606
|
+
disabled: !l,
|
|
3607
|
+
title: r.id === "edit-with-ai" && C.value && !l ? e.messages.askAi.tableMergedUnsupported : void 0,
|
|
3354
3608
|
"data-menu-group": a,
|
|
3355
3609
|
"data-starts-group": s ? "true" : "false",
|
|
3356
|
-
"data-command-enabled":
|
|
3610
|
+
"data-command-enabled": l ? "true" : "false",
|
|
3357
3611
|
"data-submenu-trigger": r.submenuId ?? void 0,
|
|
3358
3612
|
"data-testid": r.commandId ? `markweave-table-menu-command-${r.commandId}` : r.submenuId ? `markweave-table-menu-submenu-${r.submenuId}` : "markweave-table-menu-command-edit-with-ai",
|
|
3359
|
-
onMousedown:
|
|
3613
|
+
onMousedown: (e) => {
|
|
3614
|
+
$(e), l && r.id === "edit-with-ai" && ne(c);
|
|
3615
|
+
},
|
|
3360
3616
|
onMouseenter: () => {
|
|
3361
3617
|
n.value = r.submenuId;
|
|
3362
3618
|
},
|
|
3363
|
-
onClick: () => {
|
|
3364
|
-
if (
|
|
3619
|
+
onClick: (e) => {
|
|
3620
|
+
if (l) {
|
|
3365
3621
|
if (r.submenuId) {
|
|
3366
3622
|
n.value = r.submenuId;
|
|
3367
3623
|
return;
|
|
3368
3624
|
}
|
|
3369
3625
|
if (r.commandId === null) {
|
|
3370
|
-
|
|
3626
|
+
e.detail === 0 && ne(c);
|
|
3371
3627
|
return;
|
|
3372
3628
|
}
|
|
3373
|
-
|
|
3629
|
+
B(r.commandId).finally(() => te());
|
|
3374
3630
|
}
|
|
3375
3631
|
}
|
|
3376
3632
|
}, [
|
|
3377
3633
|
H("span", {
|
|
3378
3634
|
class: "markweave-table-menu-item-icon",
|
|
3379
3635
|
"aria-hidden": "true"
|
|
3380
|
-
}, [H(
|
|
3636
|
+
}, [H(d, {
|
|
3381
3637
|
size: 18,
|
|
3382
3638
|
strokeWidth: 1.8
|
|
3383
3639
|
})]),
|
|
3384
|
-
H("span", { class: "markweave-table-menu-item-label" },
|
|
3385
|
-
r.submenuId ? H(
|
|
3640
|
+
H("span", { class: "markweave-table-menu-item-label" }, u),
|
|
3641
|
+
r.submenuId ? H(kr, {
|
|
3386
3642
|
class: "markweave-table-menu-chevron",
|
|
3387
3643
|
size: 16,
|
|
3388
3644
|
"aria-hidden": "true"
|
|
@@ -3406,18 +3662,18 @@ var ki = Y({
|
|
|
3406
3662
|
top: `${u.value.top}px`,
|
|
3407
3663
|
maxHeight: `${u.value.maxHeight}px`
|
|
3408
3664
|
} : void 0,
|
|
3409
|
-
onKeydown:
|
|
3665
|
+
onKeydown: le
|
|
3410
3666
|
}, [
|
|
3411
3667
|
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
|
|
3412
|
-
...
|
|
3668
|
+
...Rn.map((t) => H("button", {
|
|
3413
3669
|
key: `text-${t.id}`,
|
|
3414
3670
|
type: "button",
|
|
3415
3671
|
role: "menuitemradio",
|
|
3416
|
-
"aria-checked":
|
|
3417
|
-
"data-active":
|
|
3672
|
+
"aria-checked": se.value?.textColorId === t.id,
|
|
3673
|
+
"data-active": se.value?.textColorId === t.id ? "true" : "false",
|
|
3418
3674
|
"data-testid": `markweave-table-text-color-${t.id}`,
|
|
3419
3675
|
onMousedown: $,
|
|
3420
|
-
onClick: () =>
|
|
3676
|
+
onClick: () => V((n) => gn(e.editor, n, t.id))
|
|
3421
3677
|
}, [H("span", {
|
|
3422
3678
|
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3423
3679
|
"aria-hidden": "true",
|
|
@@ -3425,15 +3681,15 @@ var ki = Y({
|
|
|
3425
3681
|
}), H("span", null, e.messages.table.colors[t.id].text)])),
|
|
3426
3682
|
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3427
3683
|
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
|
|
3428
|
-
...
|
|
3684
|
+
...Rn.map((t) => H("button", {
|
|
3429
3685
|
key: `background-${t.id}`,
|
|
3430
3686
|
type: "button",
|
|
3431
3687
|
role: "menuitemradio",
|
|
3432
|
-
"aria-checked":
|
|
3433
|
-
"data-active":
|
|
3688
|
+
"aria-checked": se.value?.backgroundColorId === t.id,
|
|
3689
|
+
"data-active": se.value?.backgroundColorId === t.id ? "true" : "false",
|
|
3434
3690
|
"data-testid": `markweave-table-background-color-${t.id}`,
|
|
3435
3691
|
onMousedown: $,
|
|
3436
|
-
onClick: () =>
|
|
3692
|
+
onClick: () => V((n) => hn(e.editor, n, t.id))
|
|
3437
3693
|
}, [H("span", {
|
|
3438
3694
|
class: "markweave-table-color-swatch",
|
|
3439
3695
|
"aria-hidden": "true",
|
|
@@ -3441,7 +3697,7 @@ var ki = Y({
|
|
|
3441
3697
|
}), H("span", null, e.messages.table.colors[t.id].background)]))
|
|
3442
3698
|
])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
|
|
3443
3699
|
let t = (t, n) => {
|
|
3444
|
-
let r =
|
|
3700
|
+
let r = na[t];
|
|
3445
3701
|
return H("button", {
|
|
3446
3702
|
key: t,
|
|
3447
3703
|
type: "button",
|
|
@@ -3450,7 +3706,7 @@ var ki = Y({
|
|
|
3450
3706
|
"data-active": n ? "true" : "false",
|
|
3451
3707
|
"data-testid": `markweave-table-alignment-${t}`,
|
|
3452
3708
|
onMousedown: $,
|
|
3453
|
-
onClick: () =>
|
|
3709
|
+
onClick: () => V((n) => mn(e.editor, n, t))
|
|
3454
3710
|
}, [H(r, {
|
|
3455
3711
|
size: 18,
|
|
3456
3712
|
strokeWidth: 1.8,
|
|
@@ -3470,18 +3726,18 @@ var ki = Y({
|
|
|
3470
3726
|
top: `${u.value.top}px`,
|
|
3471
3727
|
maxHeight: `${u.value.maxHeight}px`
|
|
3472
3728
|
} : void 0,
|
|
3473
|
-
onKeydown:
|
|
3729
|
+
onKeydown: le
|
|
3474
3730
|
}, [
|
|
3475
|
-
...
|
|
3731
|
+
...Bn.map((e) => t(e, se.value?.textAlign === e)),
|
|
3476
3732
|
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3477
|
-
...
|
|
3733
|
+
...Hn.map((e) => t(e, se.value?.verticalAlign === e))
|
|
3478
3734
|
]));
|
|
3479
3735
|
}
|
|
3480
3736
|
return H("div", {
|
|
3481
3737
|
ref: _,
|
|
3482
3738
|
class: "markweave-table-menu",
|
|
3483
3739
|
role: "menu",
|
|
3484
|
-
"aria-label":
|
|
3740
|
+
"aria-label": Vn(t.value, e.messages),
|
|
3485
3741
|
"data-testid": "markweave-table-menu",
|
|
3486
3742
|
"data-positioned": l.value ? "true" : "false",
|
|
3487
3743
|
"data-placement": l.value?.placement,
|
|
@@ -3490,7 +3746,7 @@ var ki = Y({
|
|
|
3490
3746
|
left: `${l.value.left}px`,
|
|
3491
3747
|
top: `${l.value.top}px`
|
|
3492
3748
|
} : void 0,
|
|
3493
|
-
onKeydown:
|
|
3749
|
+
onKeydown: le
|
|
3494
3750
|
}, i);
|
|
3495
3751
|
};
|
|
3496
3752
|
return () => e.active ? H("div", {
|
|
@@ -3500,7 +3756,7 @@ var ki = Y({
|
|
|
3500
3756
|
"aria-label": e.messages.table.controlsAriaLabel,
|
|
3501
3757
|
"data-open-menu": t.value ?? "none",
|
|
3502
3758
|
"data-positioned": i.value || a.value || o.value ? "true" : "false",
|
|
3503
|
-
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(
|
|
3759
|
+
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(pn, { type: "clear-hover" }))
|
|
3504
3760
|
}, [
|
|
3505
3761
|
d.value ? H("div", {
|
|
3506
3762
|
class: "markweave-table-copy-feedback",
|
|
@@ -3510,7 +3766,7 @@ var ki = Y({
|
|
|
3510
3766
|
"data-copy-kind": d.value.kind,
|
|
3511
3767
|
"data-text-length": d.value.textLength,
|
|
3512
3768
|
"data-html-length": d.value.htmlLength
|
|
3513
|
-
},
|
|
3769
|
+
}, Cn(d.value)) : null,
|
|
3514
3770
|
i.value ? H("button", {
|
|
3515
3771
|
ref: m,
|
|
3516
3772
|
type: "button",
|
|
@@ -3521,10 +3777,10 @@ var ki = Y({
|
|
|
3521
3777
|
"aria-haspopup": "menu",
|
|
3522
3778
|
title: e.messages.table.rowActions,
|
|
3523
3779
|
"data-testid": "markweave-table-hover-row-handle",
|
|
3524
|
-
"data-axis-index":
|
|
3525
|
-
"data-axis-selected-cells":
|
|
3526
|
-
"data-axis-visual-cells":
|
|
3527
|
-
"data-axis-visual-size":
|
|
3780
|
+
"data-axis-index": T.value?.index ?? "",
|
|
3781
|
+
"data-axis-selected-cells": T.value?.selectedCellCount ?? "",
|
|
3782
|
+
"data-axis-visual-cells": T.value?.visualCellCount ?? "",
|
|
3783
|
+
"data-axis-visual-size": T.value?.visualHeight ?? "",
|
|
3528
3784
|
style: {
|
|
3529
3785
|
left: `${i.value.left}px`,
|
|
3530
3786
|
top: `${i.value.top}px`,
|
|
@@ -3532,12 +3788,12 @@ var ki = Y({
|
|
|
3532
3788
|
height: `${i.value.height}px`
|
|
3533
3789
|
},
|
|
3534
3790
|
onMousedown: $,
|
|
3535
|
-
onClick: () =>
|
|
3536
|
-
onDragstart: (e) => ie("row",
|
|
3791
|
+
onClick: () => R("row", "row-edge"),
|
|
3792
|
+
onDragstart: (e) => ie("row", T.value?.index ?? 0, e),
|
|
3537
3793
|
onDragend: () => {
|
|
3538
3794
|
x = null, S = null;
|
|
3539
3795
|
}
|
|
3540
|
-
}, [H(
|
|
3796
|
+
}, [H($r, {
|
|
3541
3797
|
size: 14,
|
|
3542
3798
|
"aria-hidden": "true"
|
|
3543
3799
|
})]) : null,
|
|
@@ -3551,10 +3807,10 @@ var ki = Y({
|
|
|
3551
3807
|
"aria-haspopup": "menu",
|
|
3552
3808
|
title: e.messages.table.columnActions,
|
|
3553
3809
|
"data-testid": "markweave-table-hover-column-handle",
|
|
3554
|
-
"data-axis-index":
|
|
3555
|
-
"data-axis-selected-cells":
|
|
3556
|
-
"data-axis-visual-cells":
|
|
3557
|
-
"data-axis-visual-size":
|
|
3810
|
+
"data-axis-index": E.value?.index ?? "",
|
|
3811
|
+
"data-axis-selected-cells": E.value?.selectedCellCount ?? "",
|
|
3812
|
+
"data-axis-visual-cells": E.value?.visualCellCount ?? "",
|
|
3813
|
+
"data-axis-visual-size": E.value?.visualWidth ?? "",
|
|
3558
3814
|
style: {
|
|
3559
3815
|
left: `${a.value.left}px`,
|
|
3560
3816
|
top: `${a.value.top}px`,
|
|
@@ -3562,16 +3818,16 @@ var ki = Y({
|
|
|
3562
3818
|
height: `${a.value.height}px`
|
|
3563
3819
|
},
|
|
3564
3820
|
onMousedown: $,
|
|
3565
|
-
onClick: () =>
|
|
3566
|
-
onDragstart: (e) => ie("column",
|
|
3821
|
+
onClick: () => R("column", "column-edge"),
|
|
3822
|
+
onDragstart: (e) => ie("column", E.value?.index ?? 0, e),
|
|
3567
3823
|
onDragend: () => {
|
|
3568
3824
|
x = null, S = null;
|
|
3569
3825
|
}
|
|
3570
|
-
}, [H(
|
|
3826
|
+
}, [H($r, {
|
|
3571
3827
|
size: 14,
|
|
3572
3828
|
"aria-hidden": "true"
|
|
3573
3829
|
})]) : null,
|
|
3574
|
-
|
|
3830
|
+
O.value && o.value ? H("button", {
|
|
3575
3831
|
ref: g,
|
|
3576
3832
|
type: "button",
|
|
3577
3833
|
class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
@@ -3587,8 +3843,8 @@ var ki = Y({
|
|
|
3587
3843
|
height: `${o.value.height}px`
|
|
3588
3844
|
},
|
|
3589
3845
|
onMousedown: $,
|
|
3590
|
-
onClick:
|
|
3591
|
-
}, [H(
|
|
3846
|
+
onClick: z
|
|
3847
|
+
}, [H($r, {
|
|
3592
3848
|
size: 14,
|
|
3593
3849
|
"aria-hidden": "true"
|
|
3594
3850
|
})]) : null,
|
|
@@ -3605,8 +3861,8 @@ var ki = Y({
|
|
|
3605
3861
|
height: `${s.value.height}px`
|
|
3606
3862
|
},
|
|
3607
3863
|
onMousedown: $,
|
|
3608
|
-
onClick: () =>
|
|
3609
|
-
}, [H(
|
|
3864
|
+
onClick: () => re("row")
|
|
3865
|
+
}, [H(ri, {
|
|
3610
3866
|
size: 14,
|
|
3611
3867
|
"aria-hidden": "true"
|
|
3612
3868
|
})]) : null,
|
|
@@ -3623,15 +3879,15 @@ var ki = Y({
|
|
|
3623
3879
|
height: `${c.value.height}px`
|
|
3624
3880
|
},
|
|
3625
3881
|
onMousedown: $,
|
|
3626
|
-
onClick: () =>
|
|
3627
|
-
}, [H(
|
|
3882
|
+
onClick: () => re("column")
|
|
3883
|
+
}, [H(ri, {
|
|
3628
3884
|
size: 14,
|
|
3629
3885
|
"aria-hidden": "true"
|
|
3630
3886
|
})]) : null,
|
|
3631
|
-
|
|
3887
|
+
de()
|
|
3632
3888
|
]) : null;
|
|
3633
3889
|
}
|
|
3634
|
-
}),
|
|
3890
|
+
}), ia = Y({
|
|
3635
3891
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
3636
3892
|
props: {
|
|
3637
3893
|
editor: {
|
|
@@ -3649,9 +3905,9 @@ var ki = Y({
|
|
|
3649
3905
|
t.value = null;
|
|
3650
3906
|
return;
|
|
3651
3907
|
}
|
|
3652
|
-
t.value =
|
|
3908
|
+
t.value = Fn(e.editor, dn(e.editor.state));
|
|
3653
3909
|
};
|
|
3654
|
-
return
|
|
3910
|
+
return nr(() => {
|
|
3655
3911
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
3656
3912
|
}), q(() => {
|
|
3657
3913
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
@@ -3688,7 +3944,7 @@ var ki = Y({
|
|
|
3688
3944
|
}) : null;
|
|
3689
3945
|
};
|
|
3690
3946
|
}
|
|
3691
|
-
}),
|
|
3947
|
+
}), aa = Y({
|
|
3692
3948
|
name: "MarkweaveVueCodeBlockControls",
|
|
3693
3949
|
props: {
|
|
3694
3950
|
editor: {
|
|
@@ -3721,100 +3977,100 @@ var ki = Y({
|
|
|
3721
3977
|
active: !1,
|
|
3722
3978
|
lastX: 0,
|
|
3723
3979
|
lastY: 0
|
|
3724
|
-
}), y = U(0), b = U(0), x = U(0), S = null, C = G(() => (x.value,
|
|
3980
|
+
}), y = U(0), b = U(0), x = U(0), S = null, C = G(() => (x.value, bt(e.editor, o.value))), w = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
3725
3981
|
...e.state,
|
|
3726
3982
|
pos: e.state.pos,
|
|
3727
3983
|
active: !0
|
|
3728
|
-
} : null), T = G(() => C.value ?? w.value), E = G(() => T.value !== null), D = G(() => T.value?.language === "mermaid"), O = G(() =>
|
|
3984
|
+
} : null), T = G(() => C.value ?? w.value), E = G(() => T.value !== null), D = G(() => T.value?.language === "mermaid"), O = G(() => Tt(e.editor, T.value)), k = G(() => E.value && T.value !== null && !O.value), A = G(() => !e.readOnly), j = G(() => T.value ? pt(T.value.language) : pt("text")), M = G(() => p.value?.status ?? "idle"), N = G(() => T.value?.mermaidPreviewMode ?? e.mermaidMode), P = G(() => D.value && N.value === "preview"), F = G(() => (x.value, y.value, b.value, Ct(e.editor))), I = G(() => `${b.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = G(() => _t(d.value)), ee = G(() => T.value ? `${T.value.pos}:${T.value.language}:${T.value.text}` : "none"), R = () => {
|
|
3729
3985
|
S !== null && (window.clearTimeout(S), S = null);
|
|
3730
|
-
},
|
|
3731
|
-
|
|
3986
|
+
}, z = (e) => {
|
|
3987
|
+
R(), p.value = e, e && (S = window.setTimeout(() => {
|
|
3732
3988
|
p.value = null, S = null;
|
|
3733
|
-
},
|
|
3734
|
-
},
|
|
3989
|
+
}, ot));
|
|
3990
|
+
}, te = () => {
|
|
3735
3991
|
h.value = null, g.value = null, _.value = !1, v.value = {
|
|
3736
3992
|
active: !1,
|
|
3737
3993
|
lastX: 0,
|
|
3738
3994
|
lastY: 0
|
|
3739
3995
|
}, e.editor.view.focus();
|
|
3740
|
-
},
|
|
3996
|
+
}, B = () => {
|
|
3741
3997
|
let n = t.value;
|
|
3742
3998
|
if (!n) return;
|
|
3743
|
-
if (!
|
|
3999
|
+
if (!xt(n) || F.value.length === 0) {
|
|
3744
4000
|
c.value = [];
|
|
3745
4001
|
return;
|
|
3746
4002
|
}
|
|
3747
|
-
let r = n.getBoundingClientRect(), i =
|
|
3748
|
-
let n =
|
|
3749
|
-
return n ? [
|
|
4003
|
+
let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
|
|
4004
|
+
let n = gt(ht(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
4005
|
+
return n ? [dt(t, n, r)] : [];
|
|
3750
4006
|
});
|
|
3751
|
-
c.value =
|
|
3752
|
-
},
|
|
4007
|
+
c.value = Et(c.value, i, F.value.map((e) => e.pos));
|
|
4008
|
+
}, V = () => {
|
|
3753
4009
|
if (!k.value || !T.value) {
|
|
3754
4010
|
s.value = null, l.value = null;
|
|
3755
4011
|
return;
|
|
3756
4012
|
}
|
|
3757
4013
|
let r = t.value;
|
|
3758
4014
|
if (!r) return;
|
|
3759
|
-
let i =
|
|
4015
|
+
let i = ht(e.editor, T.value.pos, N.value), a = r.getBoundingClientRect(), o = gt(i, a);
|
|
3760
4016
|
if (!o) {
|
|
3761
4017
|
s.value = s.value?.pos === T.value.pos ? s.value : null, l.value = u.value ? l.value : null;
|
|
3762
4018
|
return;
|
|
3763
4019
|
}
|
|
3764
|
-
if (s.value =
|
|
4020
|
+
if (s.value = lt(T.value.pos, o, a), u.value && n.value) {
|
|
3765
4021
|
let e = n.value.getBoundingClientRect();
|
|
3766
|
-
l.value =
|
|
4022
|
+
l.value = it({
|
|
3767
4023
|
overlayRect: a,
|
|
3768
4024
|
buttonRect: e,
|
|
3769
4025
|
windowWidth: window.innerWidth,
|
|
3770
4026
|
windowHeight: window.innerHeight
|
|
3771
4027
|
});
|
|
3772
4028
|
}
|
|
3773
|
-
},
|
|
4029
|
+
}, re = async () => {
|
|
3774
4030
|
if (e.readOnly) {
|
|
3775
4031
|
if (!T.value) return;
|
|
3776
|
-
let e = await
|
|
3777
|
-
|
|
4032
|
+
let e = await st(T.value.text);
|
|
4033
|
+
z($e(T.value, e ? "copied" : "failed"));
|
|
3778
4034
|
return;
|
|
3779
4035
|
}
|
|
3780
|
-
if (!
|
|
3781
|
-
let t = await
|
|
3782
|
-
|
|
3783
|
-
},
|
|
4036
|
+
if (!ft(e.editor, T.value)) return;
|
|
4037
|
+
let t = await Ze(e.editor);
|
|
4038
|
+
z($e(Qe(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
4039
|
+
}, ie = (t, n) => {
|
|
3784
4040
|
if (e.readOnly) {
|
|
3785
|
-
|
|
4041
|
+
qt(e.editor, t.pos, n) && (b.value += 1, x.value += 1);
|
|
3786
4042
|
return;
|
|
3787
4043
|
}
|
|
3788
4044
|
let r = e.state.active && e.state.pos === t.pos;
|
|
3789
|
-
|
|
3790
|
-
},
|
|
4045
|
+
rt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), x.value += 1, r && e.editor.view.focus());
|
|
4046
|
+
}, ae = (t) => {
|
|
3791
4047
|
if (e.readOnly || !T.value) return;
|
|
3792
4048
|
let n = e.state.active && e.state.pos === T.value.pos;
|
|
3793
|
-
|
|
3794
|
-
},
|
|
3795
|
-
u.value = !u.value, u.value && a.value === null && (a.value =
|
|
4049
|
+
nt(e.editor, T.value.pos, t) && (t === "mermaid" && rt(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
|
+
}, oe = () => {
|
|
4051
|
+
u.value = !u.value, u.value && a.value === null && (a.value = ct()), f.value = u.value ? St(L.value, T.value?.language ?? null) : -1;
|
|
3796
4052
|
}, se = (e) => {
|
|
3797
|
-
let t =
|
|
3798
|
-
d.value = e, f.value =
|
|
4053
|
+
let t = _t(e);
|
|
4054
|
+
d.value = e, f.value = St(t, e.trim() ? null : T.value?.language ?? null);
|
|
3799
4055
|
}, ce = (t) => {
|
|
3800
4056
|
if (!t.isComposing) {
|
|
3801
4057
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
3802
|
-
t.preventDefault(), f.value =
|
|
4058
|
+
t.preventDefault(), f.value = Ot(f.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
3803
4059
|
return;
|
|
3804
4060
|
}
|
|
3805
4061
|
if (t.key === "Enter") {
|
|
3806
|
-
let e =
|
|
3807
|
-
e && (t.preventDefault(),
|
|
4062
|
+
let e = L.value[f.value];
|
|
4063
|
+
e && (t.preventDefault(), ae(e.language));
|
|
3808
4064
|
return;
|
|
3809
4065
|
}
|
|
3810
4066
|
t.key === "Escape" && (t.preventDefault(), u.value = !1, f.value = -1, e.editor.view.focus());
|
|
3811
4067
|
}
|
|
3812
4068
|
}, le = () => {
|
|
3813
|
-
e.readOnly || !T.value ||
|
|
4069
|
+
e.readOnly || !T.value || tt(e.editor, T.value.pos, !O.value) && (y.value += 1, x.value += 1, o.value = null);
|
|
3814
4070
|
}, ue = () => {
|
|
3815
4071
|
if (!T.value) return;
|
|
3816
|
-
let t =
|
|
3817
|
-
t &&
|
|
4072
|
+
let t = wt(e.editor, T.value.pos);
|
|
4073
|
+
t && ne({
|
|
3818
4074
|
data: new Blob([t], { type: "image/svg+xml" }),
|
|
3819
4075
|
fileName: "markweave-mermaid.svg",
|
|
3820
4076
|
onSettled: () => e.editor.view.focus(),
|
|
@@ -3822,8 +4078,8 @@ var ki = Y({
|
|
|
3822
4078
|
});
|
|
3823
4079
|
}, de = () => {
|
|
3824
4080
|
if (!T.value) return;
|
|
3825
|
-
let t =
|
|
3826
|
-
t && (h.value =
|
|
4081
|
+
let t = wt(e.editor, T.value.pos);
|
|
4082
|
+
t && (h.value = ut(t), g.value = null, _.value = !1, v.value = {
|
|
3827
4083
|
active: !1,
|
|
3828
4084
|
lastX: 0,
|
|
3829
4085
|
lastY: 0
|
|
@@ -3831,16 +4087,16 @@ var ki = Y({
|
|
|
3831
4087
|
}, fe = (e) => {
|
|
3832
4088
|
h.value = h.value ? {
|
|
3833
4089
|
...h.value,
|
|
3834
|
-
scale:
|
|
4090
|
+
scale: at(h.value.scale + e)
|
|
3835
4091
|
} : null;
|
|
3836
4092
|
}, pe = () => {
|
|
3837
|
-
h.value = h.value ?
|
|
4093
|
+
h.value = h.value ? ut(h.value.svg) : null, v.value = {
|
|
3838
4094
|
active: !1,
|
|
3839
4095
|
lastX: 0,
|
|
3840
4096
|
lastY: 0
|
|
3841
4097
|
}, _.value = !1;
|
|
3842
4098
|
}, me = (e) => {
|
|
3843
|
-
e.preventDefault(), fe(e.deltaY < 0 ?
|
|
4099
|
+
e.preventDefault(), fe(e.deltaY < 0 ? Dt : -Dt);
|
|
3844
4100
|
}, he = (e) => {
|
|
3845
4101
|
e.button === 0 && (e.preventDefault(), v.value = {
|
|
3846
4102
|
active: !0,
|
|
@@ -3855,7 +4111,7 @@ var ki = Y({
|
|
|
3855
4111
|
active: !0,
|
|
3856
4112
|
lastX: e.clientX,
|
|
3857
4113
|
lastY: e.clientY
|
|
3858
|
-
}, h.value =
|
|
4114
|
+
}, h.value = kt(h.value, n, r);
|
|
3859
4115
|
}, _e = () => {
|
|
3860
4116
|
v.value = {
|
|
3861
4117
|
active: !1,
|
|
@@ -3865,14 +4121,14 @@ var ki = Y({
|
|
|
3865
4121
|
};
|
|
3866
4122
|
K(() => e.readOnly, (e) => {
|
|
3867
4123
|
e && (u.value = !1, d.value = "");
|
|
3868
|
-
}), K(
|
|
3869
|
-
|
|
4124
|
+
}), K(ee, () => {
|
|
4125
|
+
z(null), u.value = !1, d.value = "", f.value = -1, h.value = null, g.value = null, _.value = !1;
|
|
3870
4126
|
}), K(u, async (e) => {
|
|
3871
4127
|
if (!e) {
|
|
3872
4128
|
f.value = -1;
|
|
3873
4129
|
return;
|
|
3874
4130
|
}
|
|
3875
|
-
await J(),
|
|
4131
|
+
await J(), V(), r.value?.focus({ preventScroll: !0 });
|
|
3876
4132
|
}), K(() => [
|
|
3877
4133
|
u.value,
|
|
3878
4134
|
d.value,
|
|
@@ -3881,37 +4137,37 @@ var ki = Y({
|
|
|
3881
4137
|
if (!u.value || f.value < 0) return;
|
|
3882
4138
|
await J();
|
|
3883
4139
|
let e = i.value, t = e?.querySelector(`[data-language-index="${f.value}"]`);
|
|
3884
|
-
e && t &&
|
|
4140
|
+
e && t && At(e, t);
|
|
3885
4141
|
}, { flush: "post" }), K(() => [
|
|
3886
4142
|
k.value,
|
|
3887
4143
|
y.value,
|
|
3888
4144
|
T.value?.pos ?? null,
|
|
3889
4145
|
u.value,
|
|
3890
|
-
|
|
4146
|
+
N.value
|
|
3891
4147
|
], async () => {
|
|
3892
|
-
await J(),
|
|
4148
|
+
await J(), V();
|
|
3893
4149
|
}, {
|
|
3894
4150
|
flush: "post",
|
|
3895
4151
|
immediate: !0
|
|
3896
|
-
}), K(
|
|
3897
|
-
await J(),
|
|
4152
|
+
}), K(I, async () => {
|
|
4153
|
+
await J(), B(), window.requestAnimationFrame(B);
|
|
3898
4154
|
}, {
|
|
3899
4155
|
flush: "post",
|
|
3900
4156
|
immediate: !0
|
|
3901
4157
|
});
|
|
3902
4158
|
let ve = null;
|
|
3903
|
-
return
|
|
4159
|
+
return nr(() => {
|
|
3904
4160
|
J(() => {
|
|
3905
4161
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
3906
4162
|
if (n.target instanceof Node && t.value?.contains(n.target) || u.value) return;
|
|
3907
|
-
let r =
|
|
4163
|
+
let r = yt(e.editor, n.target), i = bt(e.editor, r), a = i && !Tt(e.editor, i) ? i.pos : null;
|
|
3908
4164
|
o.value = o.value === a ? o.value : a;
|
|
3909
4165
|
}, i = () => {
|
|
3910
4166
|
u.value || (o.value = null);
|
|
3911
4167
|
}, a = (t) => {
|
|
3912
4168
|
if (t.key === "Escape") {
|
|
3913
4169
|
if (h.value) {
|
|
3914
|
-
|
|
4170
|
+
te();
|
|
3915
4171
|
return;
|
|
3916
4172
|
}
|
|
3917
4173
|
u.value && (u.value = !1, f.value = -1, e.editor.view.focus());
|
|
@@ -3919,16 +4175,16 @@ var ki = Y({
|
|
|
3919
4175
|
}, s = (e) => {
|
|
3920
4176
|
u.value && (e.target instanceof Node && t.value?.contains(e.target) || (u.value = !1, f.value = -1));
|
|
3921
4177
|
}, c = ({ transaction: e }) => {
|
|
3922
|
-
e.getMeta(
|
|
4178
|
+
e.getMeta(Xe) && (y.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Xe) || Wt(e)) && (x.value += 1);
|
|
3923
4179
|
};
|
|
3924
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize",
|
|
3925
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize",
|
|
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), ve = () => {
|
|
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), R();
|
|
3926
4182
|
};
|
|
3927
4183
|
});
|
|
3928
4184
|
}), q(() => {
|
|
3929
|
-
ve?.(), ve = null,
|
|
4185
|
+
ve?.(), ve = null, R();
|
|
3930
4186
|
}), () => {
|
|
3931
|
-
if (!k.value &&
|
|
4187
|
+
if (!k.value && F.value.length === 0 && !h.value) return null;
|
|
3932
4188
|
let o = s.value ? {
|
|
3933
4189
|
top: `${s.value.top}px`,
|
|
3934
4190
|
right: `${s.value.right}px`
|
|
@@ -3942,7 +4198,7 @@ var ki = Y({
|
|
|
3942
4198
|
"data-testid": "markweave-codeblock-overlay",
|
|
3943
4199
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
3944
4200
|
}, [
|
|
3945
|
-
...
|
|
4201
|
+
...F.value.map((e) => {
|
|
3946
4202
|
let t = c.value.find((t) => t.pos === e.pos);
|
|
3947
4203
|
return H("div", {
|
|
3948
4204
|
key: e.pos,
|
|
@@ -3960,7 +4216,7 @@ var ki = Y({
|
|
|
3960
4216
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
3961
4217
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
3962
4218
|
onMousedown: $,
|
|
3963
|
-
onClick: () =>
|
|
4219
|
+
onClick: () => ie(e, t)
|
|
3964
4220
|
}, t === "code" ? "Code" : "Preview")));
|
|
3965
4221
|
}),
|
|
3966
4222
|
k.value && T.value ? H("div", {
|
|
@@ -3976,7 +4232,7 @@ var ki = Y({
|
|
|
3976
4232
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
3977
4233
|
"aria-label": "Code block language",
|
|
3978
4234
|
"data-testid": "markweave-codeblock-language"
|
|
3979
|
-
}, [H("span", null,
|
|
4235
|
+
}, [H("span", null, j.value)]) : H("button", {
|
|
3980
4236
|
ref: n,
|
|
3981
4237
|
type: "button",
|
|
3982
4238
|
class: "markweave-codeblock-language-button",
|
|
@@ -3985,8 +4241,8 @@ var ki = Y({
|
|
|
3985
4241
|
"aria-haspopup": "listbox",
|
|
3986
4242
|
"data-testid": "markweave-codeblock-language",
|
|
3987
4243
|
onMousedown: $,
|
|
3988
|
-
onClick:
|
|
3989
|
-
}, [H("span", null,
|
|
4244
|
+
onClick: oe
|
|
4245
|
+
}, [H("span", null, j.value), Q("chevron")]),
|
|
3990
4246
|
A.value ? H("button", {
|
|
3991
4247
|
type: "button",
|
|
3992
4248
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
@@ -4002,7 +4258,7 @@ var ki = Y({
|
|
|
4002
4258
|
class: "markweave-codeblock-icon-button",
|
|
4003
4259
|
"aria-label": "Copy to clipboard",
|
|
4004
4260
|
"data-testid": "markweave-codeblock-copy",
|
|
4005
|
-
"data-copy-state":
|
|
4261
|
+
"data-copy-state": M.value,
|
|
4006
4262
|
onMousedown: $,
|
|
4007
4263
|
onMouseenter: () => {
|
|
4008
4264
|
m.value = !0;
|
|
@@ -4017,14 +4273,14 @@ var ki = Y({
|
|
|
4017
4273
|
m.value = !1;
|
|
4018
4274
|
},
|
|
4019
4275
|
onClick: () => {
|
|
4020
|
-
|
|
4276
|
+
re();
|
|
4021
4277
|
}
|
|
4022
|
-
}, [Q(
|
|
4278
|
+
}, [Q(M.value === "copied" ? "check" : "clipboard")]), m.value ? H("span", {
|
|
4023
4279
|
class: "markweave-codeblock-tooltip",
|
|
4024
4280
|
role: "tooltip",
|
|
4025
4281
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
4026
4282
|
}, "Copy to clipboard") : null]),
|
|
4027
|
-
D.value &&
|
|
4283
|
+
D.value && N.value === "preview" ? H("div", {
|
|
4028
4284
|
class: "markweave-mermaid-preview-actions",
|
|
4029
4285
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
4030
4286
|
}, [H("button", {
|
|
@@ -4032,7 +4288,7 @@ var ki = Y({
|
|
|
4032
4288
|
class: "markweave-codeblock-icon-button",
|
|
4033
4289
|
"aria-label": "Fullscreen Mermaid preview",
|
|
4034
4290
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
4035
|
-
disabled: !
|
|
4291
|
+
disabled: !P.value,
|
|
4036
4292
|
onMousedown: $,
|
|
4037
4293
|
onClick: de
|
|
4038
4294
|
}, [Q("expand")]), H("button", {
|
|
@@ -4040,7 +4296,7 @@ var ki = Y({
|
|
|
4040
4296
|
class: "markweave-codeblock-icon-button",
|
|
4041
4297
|
"aria-label": "Download Mermaid SVG",
|
|
4042
4298
|
"data-testid": "markweave-mermaid-download",
|
|
4043
|
-
disabled: !
|
|
4299
|
+
disabled: !P.value,
|
|
4044
4300
|
onMousedown: $,
|
|
4045
4301
|
onClick: ue
|
|
4046
4302
|
}, [Q("download")])]) : null
|
|
@@ -4056,7 +4312,7 @@ var ki = Y({
|
|
|
4056
4312
|
"aria-autocomplete": "list",
|
|
4057
4313
|
"aria-controls": a.value ?? void 0,
|
|
4058
4314
|
"aria-expanded": "true",
|
|
4059
|
-
"aria-activedescendant": a.value &&
|
|
4315
|
+
"aria-activedescendant": a.value && L.value[f.value] ? vt(a.value, L.value[f.value].language) : void 0,
|
|
4060
4316
|
"aria-label": "Search code block languages",
|
|
4061
4317
|
value: d.value,
|
|
4062
4318
|
placeholder: "Search...",
|
|
@@ -4071,11 +4327,11 @@ var ki = Y({
|
|
|
4071
4327
|
class: "markweave-codeblock-language-list",
|
|
4072
4328
|
role: "listbox",
|
|
4073
4329
|
"aria-label": "Code block languages"
|
|
4074
|
-
},
|
|
4330
|
+
}, L.value.map((e, t) => {
|
|
4075
4331
|
let n = T.value?.language === e.language, r = t === f.value;
|
|
4076
4332
|
return H("button", {
|
|
4077
4333
|
key: e.language,
|
|
4078
|
-
id: a.value ?
|
|
4334
|
+
id: a.value ? vt(a.value, e.language) : void 0,
|
|
4079
4335
|
type: "button",
|
|
4080
4336
|
role: "option",
|
|
4081
4337
|
"aria-selected": n ? "true" : "false",
|
|
@@ -4087,7 +4343,7 @@ var ki = Y({
|
|
|
4087
4343
|
onMouseenter: () => {
|
|
4088
4344
|
f.value = t;
|
|
4089
4345
|
},
|
|
4090
|
-
onClick: () =>
|
|
4346
|
+
onClick: () => ae(e.language)
|
|
4091
4347
|
}, [H("span", null, e.label), n ? Q("check") : null]);
|
|
4092
4348
|
}))]) : null,
|
|
4093
4349
|
h.value ? H("div", {
|
|
@@ -4118,12 +4374,12 @@ var ki = Y({
|
|
|
4118
4374
|
onBlur: () => {
|
|
4119
4375
|
g.value = null;
|
|
4120
4376
|
},
|
|
4121
|
-
onClick: () => fe(-
|
|
4377
|
+
onClick: () => fe(-Dt)
|
|
4122
4378
|
}, [Q("zoomOut")]),
|
|
4123
4379
|
H("span", {
|
|
4124
4380
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
4125
4381
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
4126
|
-
},
|
|
4382
|
+
}, mt(h.value.scale)),
|
|
4127
4383
|
H("button", {
|
|
4128
4384
|
type: "button",
|
|
4129
4385
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -4141,7 +4397,7 @@ var ki = Y({
|
|
|
4141
4397
|
onBlur: () => {
|
|
4142
4398
|
g.value = null;
|
|
4143
4399
|
},
|
|
4144
|
-
onClick: () => fe(
|
|
4400
|
+
onClick: () => fe(Dt)
|
|
4145
4401
|
}, [Q("zoomIn")]),
|
|
4146
4402
|
H("button", {
|
|
4147
4403
|
type: "button",
|
|
@@ -4173,7 +4429,7 @@ var ki = Y({
|
|
|
4173
4429
|
class: "markweave-mermaid-fullscreen-close",
|
|
4174
4430
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
4175
4431
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
4176
|
-
onClick:
|
|
4432
|
+
onClick: te
|
|
4177
4433
|
}, [Q("close")]),
|
|
4178
4434
|
H("div", {
|
|
4179
4435
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
@@ -4200,7 +4456,7 @@ var ki = Y({
|
|
|
4200
4456
|
]);
|
|
4201
4457
|
};
|
|
4202
4458
|
}
|
|
4203
|
-
}),
|
|
4459
|
+
}), oa = Y({
|
|
4204
4460
|
name: "MarkweaveVueInnerToc",
|
|
4205
4461
|
props: {
|
|
4206
4462
|
editor: {
|
|
@@ -4226,9 +4482,9 @@ var ki = Y({
|
|
|
4226
4482
|
},
|
|
4227
4483
|
setup(e) {
|
|
4228
4484
|
let t = U(null), n, r = () => {
|
|
4229
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
4485
|
+
n?.(), n = e.placement === "container" && t.value ? Je(t.value) : void 0;
|
|
4230
4486
|
};
|
|
4231
|
-
return
|
|
4487
|
+
return nr(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
|
|
4232
4488
|
ref: t,
|
|
4233
4489
|
class: "markweave-inner-toc",
|
|
4234
4490
|
"data-testid": "markweave-inner-toc",
|
|
@@ -4249,30 +4505,30 @@ var ki = Y({
|
|
|
4249
4505
|
"aria-current": t.active ? "location" : void 0,
|
|
4250
4506
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
4251
4507
|
title: t.text,
|
|
4252
|
-
onClick: () =>
|
|
4508
|
+
onClick: () => Ye(e.editor, t, {
|
|
4253
4509
|
behavior: "smooth",
|
|
4254
4510
|
focus: e.editable
|
|
4255
4511
|
})
|
|
4256
4512
|
}, t.text)))])]) : null;
|
|
4257
4513
|
}
|
|
4258
4514
|
});
|
|
4259
|
-
function
|
|
4260
|
-
let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() =>
|
|
4515
|
+
function sa(e = {}) {
|
|
4516
|
+
let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Ce(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(an), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(fn), x = U(null), S = U(!1), C = W(null), w = se(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
|
|
4261
4517
|
function O() {
|
|
4262
4518
|
D !== null && (window.clearTimeout(D), D = null), d.value += 1;
|
|
4263
4519
|
}
|
|
4264
4520
|
function k() {
|
|
4265
4521
|
D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
|
|
4266
4522
|
D = null, d.value += 1;
|
|
4267
|
-
},
|
|
4523
|
+
}, be);
|
|
4268
4524
|
}
|
|
4269
|
-
let A = e.onSlashCommandUpload,
|
|
4270
|
-
|
|
4271
|
-
extensions:
|
|
4525
|
+
let A = e.onSlashCommandUpload, j = W(null);
|
|
4526
|
+
j.value = new a({
|
|
4527
|
+
extensions: Bi({
|
|
4272
4528
|
lang: i,
|
|
4273
4529
|
linkCardResolver: e.linkCardResolver,
|
|
4274
|
-
onImageUpload: (e) => A?.(e) ??
|
|
4275
|
-
onVideoUpload: (e) => A?.(e) ??
|
|
4530
|
+
onImageUpload: (e) => A?.(e) ?? ee(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4531
|
+
onVideoUpload: (e) => A?.(e) ?? ee(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4276
4532
|
resolveMediaSource: e.resolveMediaSource
|
|
4277
4533
|
}),
|
|
4278
4534
|
content: T,
|
|
@@ -4290,36 +4546,36 @@ function Ri(e = {}) {
|
|
|
4290
4546
|
translate: "no"
|
|
4291
4547
|
},
|
|
4292
4548
|
handleClick: (e, t, n) => {
|
|
4293
|
-
if (!u.value) return
|
|
4294
|
-
let r =
|
|
4295
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
4549
|
+
if (!u.value) return he(n);
|
|
4550
|
+
let r = Rt(e, n);
|
|
4551
|
+
return r ? (n.preventDefault(), n.stopPropagation(), N(), Ht(e, r, !0), Ut(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
4296
4552
|
},
|
|
4297
4553
|
handleDOMEvents: {
|
|
4298
|
-
compositionstart: () => u.value ? (h.value =
|
|
4299
|
-
compositionend: (e) => (u.value && window.setTimeout(() =>
|
|
4554
|
+
compositionstart: () => u.value ? (h.value = on(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
4555
|
+
compositionend: (e) => (u.value && window.setTimeout(() => P(e), 0), !1),
|
|
4300
4556
|
click: (e, t) => {
|
|
4301
|
-
if (!u.value) return
|
|
4302
|
-
let n =
|
|
4303
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
4557
|
+
if (!u.value) return he(t);
|
|
4558
|
+
let n = Rt(e, t);
|
|
4559
|
+
return n ? (t.preventDefault(), t.stopPropagation(), N(), Ht(e, n, !0), Ut(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
4304
4560
|
}
|
|
4305
4561
|
}
|
|
4306
4562
|
},
|
|
4307
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
4563
|
+
onSelectionUpdate: ({ editor: e }) => I(e),
|
|
4308
4564
|
onCreate: ({ editor: t }) => {
|
|
4309
4565
|
p(t, {
|
|
4310
4566
|
mode: c.value,
|
|
4311
4567
|
editable: u.value
|
|
4312
|
-
}),
|
|
4568
|
+
}), Gt(t, l.value), Kt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && ln(t), L(t), I(t), O();
|
|
4313
4569
|
},
|
|
4314
4570
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
4315
|
-
if (
|
|
4316
|
-
let t =
|
|
4571
|
+
if (L(e), (t.docChanged || Wt(t)) && k(), t.docChanged && y.value) {
|
|
4572
|
+
let t = Lt(e, y.value.pos);
|
|
4317
4573
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
4318
4574
|
}
|
|
4319
4575
|
},
|
|
4320
4576
|
onUpdate: ({ editor: t }) => {
|
|
4321
|
-
|
|
4322
|
-
let i =
|
|
4577
|
+
I(t), u.value && F(t), S.value || e.onUpdate?.(re(t, { onContentRead: (n, r) => {
|
|
4578
|
+
let i = se(e.contentFormat);
|
|
4323
4579
|
e.content !== void 0 && n === i && (C.value = {
|
|
4324
4580
|
content: r,
|
|
4325
4581
|
format: n,
|
|
@@ -4327,93 +4583,93 @@ function Ri(e = {}) {
|
|
|
4327
4583
|
});
|
|
4328
4584
|
} }));
|
|
4329
4585
|
}
|
|
4330
|
-
});
|
|
4331
|
-
let
|
|
4332
|
-
function
|
|
4333
|
-
g.value = null, _.value = null, h.value =
|
|
4586
|
+
}), e.onAiEditControllerChange?.(we(j.value));
|
|
4587
|
+
let M = G(() => j.value ?? null);
|
|
4588
|
+
function N() {
|
|
4589
|
+
g.value = null, _.value = null, h.value = an;
|
|
4334
4590
|
}
|
|
4335
|
-
function
|
|
4336
|
-
let t =
|
|
4591
|
+
function P(e) {
|
|
4592
|
+
let t = nn(e.state);
|
|
4337
4593
|
if (!t) {
|
|
4338
|
-
h.value = h.value.name === "idle" ? h.value :
|
|
4594
|
+
h.value = h.value.name === "idle" ? h.value : an, g.value = null, _.value = null;
|
|
4339
4595
|
return;
|
|
4340
4596
|
}
|
|
4341
4597
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
4342
|
-
if (!
|
|
4343
|
-
|
|
4598
|
+
if (!rn(r, { frameRect: i })) {
|
|
4599
|
+
N();
|
|
4344
4600
|
return;
|
|
4345
4601
|
}
|
|
4346
|
-
let a =
|
|
4602
|
+
let a = tn(n, {
|
|
4347
4603
|
frameRect: i,
|
|
4348
4604
|
triggerRect: r
|
|
4349
4605
|
});
|
|
4350
|
-
|
|
4351
|
-
}
|
|
4352
|
-
function P(e) {
|
|
4353
|
-
N(e.view);
|
|
4606
|
+
Qt(g.value, a) || (g.value = a), h.value = en(h.value, t);
|
|
4354
4607
|
}
|
|
4355
4608
|
function F(e) {
|
|
4356
|
-
|
|
4357
|
-
ge(m.value, t) || (m.value = t);
|
|
4358
|
-
let n = bt(e);
|
|
4359
|
-
n && (St(e, n, !0), y.value = n);
|
|
4360
|
-
let r = Ne(e);
|
|
4361
|
-
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
4609
|
+
P(e.view);
|
|
4362
4610
|
}
|
|
4363
4611
|
function I(e) {
|
|
4364
|
-
|
|
4612
|
+
let t = ye(e);
|
|
4613
|
+
_e(m.value, t) || (m.value = t);
|
|
4614
|
+
let n = zt(e);
|
|
4615
|
+
n && (Vt(e, n, !0), y.value = n);
|
|
4616
|
+
let r = Qe(e);
|
|
4617
|
+
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
4618
|
+
}
|
|
4619
|
+
function L(e) {
|
|
4620
|
+
b.value = Ui(e);
|
|
4365
4621
|
}
|
|
4366
|
-
let
|
|
4367
|
-
active:
|
|
4622
|
+
let R = G(() => M.value ? Qe(M.value) : Hi), z = G(() => M.value ? un(M.value.state) : Vi), te = G(() => m.value?.currentNode === "codeBlock"), ne = G(() => te.value && R.value.language === "mermaid"), ce = G(() => M.value ? Jt({
|
|
4623
|
+
active: ne.value,
|
|
4368
4624
|
mode: v.value,
|
|
4369
|
-
source:
|
|
4370
|
-
}) :
|
|
4625
|
+
source: R.value.text
|
|
4626
|
+
}) : Jt({
|
|
4371
4627
|
active: !1,
|
|
4372
4628
|
mode: "code",
|
|
4373
4629
|
source: ""
|
|
4374
|
-
})), le = G(() =>
|
|
4630
|
+
})), le = G(() => M.value && e.onRuntimeStateChange ? cn(M.value.state) : null), ue = G(() => M.value ? Ge(M.value.state) : Ue.items), de = G(() => Ke(ue.value, x.value)), fe = G(() => He(ue.value, de.value)), pe = G(() => Yt(h.value.query, s)), me = G(() => ge({
|
|
4375
4631
|
revision: d.value,
|
|
4376
4632
|
mode: c.value,
|
|
4377
4633
|
editable: u.value,
|
|
4378
4634
|
toc: fe.value,
|
|
4379
4635
|
selection: m.value,
|
|
4380
4636
|
slash: h.value,
|
|
4381
|
-
table:
|
|
4637
|
+
table: z.value,
|
|
4382
4638
|
tableInteraction: b.value,
|
|
4383
|
-
codeBlock:
|
|
4639
|
+
codeBlock: R.value,
|
|
4384
4640
|
mermaid: ce.value,
|
|
4385
4641
|
tableDebugSnapshot: le.value
|
|
4386
|
-
})),
|
|
4387
|
-
closeSlashMenu:
|
|
4388
|
-
focusFirstTableBodyCell: () =>
|
|
4642
|
+
})), ve = {
|
|
4643
|
+
closeSlashMenu: N,
|
|
4644
|
+
focusFirstTableBodyCell: () => M.value ? ln(M.value) : !1,
|
|
4389
4645
|
setContent: (e, t = {}) => {
|
|
4390
|
-
if (!
|
|
4391
|
-
let n =
|
|
4392
|
-
return
|
|
4646
|
+
if (!M.value) return !1;
|
|
4647
|
+
let n = se(t.format);
|
|
4648
|
+
return M.value.commands.setContent(e, {
|
|
4393
4649
|
contentType: ie(n),
|
|
4394
4650
|
emitUpdate: t.emitUpdate ?? !1
|
|
4395
|
-
}), t.focusFirstTableBodyCell &&
|
|
4651
|
+
}), t.focusFirstTableBodyCell && ln(M.value), I(M.value), u.value && F(M.value), L(M.value), O(), !0;
|
|
4396
4652
|
}
|
|
4397
4653
|
};
|
|
4398
4654
|
function xe(e, t) {
|
|
4399
|
-
if (!(!
|
|
4655
|
+
if (!(!M.value || !u.value || !Xt(e))) {
|
|
4400
4656
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
4401
4657
|
_.value = e;
|
|
4402
4658
|
return;
|
|
4403
4659
|
}
|
|
4404
|
-
|
|
4660
|
+
$t(M.value, h.value, e, t), h.value = on(h.value, { type: "execute" }), N();
|
|
4405
4661
|
}
|
|
4406
4662
|
}
|
|
4407
|
-
function
|
|
4408
|
-
if (!
|
|
4409
|
-
let t =
|
|
4663
|
+
function Se(e) {
|
|
4664
|
+
if (!M.value || _.value || !u.value) return;
|
|
4665
|
+
let t = Zt(h.value, pe.value, e.key, { isComposing: e.isComposing || B(M.value.state) });
|
|
4410
4666
|
if (t.type !== "ignore") {
|
|
4411
4667
|
if (e.preventDefault(), t.type === "close") {
|
|
4412
|
-
h.value =
|
|
4668
|
+
h.value = on(h.value, { type: "escape" }), N();
|
|
4413
4669
|
return;
|
|
4414
4670
|
}
|
|
4415
4671
|
if (t.type === "move-active") {
|
|
4416
|
-
h.value =
|
|
4672
|
+
h.value = on(h.value, {
|
|
4417
4673
|
type: "move-active",
|
|
4418
4674
|
delta: t.delta,
|
|
4419
4675
|
optionCount: t.optionCount
|
|
@@ -4424,75 +4680,75 @@ function Ri(e = {}) {
|
|
|
4424
4680
|
}
|
|
4425
4681
|
}
|
|
4426
4682
|
K(() => [e.mode, e.editable], () => {
|
|
4427
|
-
c.value = f(e.mode),
|
|
4683
|
+
c.value = f(e.mode), M.value && (M.value.setEditable(u.value), p(M.value, {
|
|
4428
4684
|
mode: c.value,
|
|
4429
4685
|
editable: u.value
|
|
4430
|
-
}),
|
|
4686
|
+
}), Kt(M.value, u.value ? "live" : "view"), O(), u.value || N());
|
|
4431
4687
|
}, { immediate: !0 }), K(() => e.theme, () => {
|
|
4432
|
-
|
|
4688
|
+
M.value && Gt(M.value, l.value);
|
|
4433
4689
|
}, { immediate: !0 }), K(() => e.content, (t) => {
|
|
4434
|
-
let n =
|
|
4435
|
-
if (!(!
|
|
4436
|
-
if (oe(
|
|
4690
|
+
let n = se(e.contentFormat);
|
|
4691
|
+
if (!(!M.value || t === void 0)) {
|
|
4692
|
+
if (oe(M.value, C.value, t, n)) {
|
|
4437
4693
|
C.value = null;
|
|
4438
4694
|
return;
|
|
4439
4695
|
}
|
|
4440
|
-
C.value = null, !ae(
|
|
4696
|
+
C.value = null, !ae(M.value, t, n) && (S.value = !0, M.value.commands.setContent(t, {
|
|
4441
4697
|
contentType: ie(n),
|
|
4442
4698
|
emitUpdate: !1
|
|
4443
|
-
}), S.value = !1,
|
|
4699
|
+
}), S.value = !1, I(M.value), u.value && F(M.value), L(M.value), O());
|
|
4444
4700
|
}
|
|
4445
|
-
}), K(
|
|
4446
|
-
let t =
|
|
4701
|
+
}), K(me, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(fe, (t) => e.onTocChange?.(t), { immediate: !0 }), K(ue, (e) => {
|
|
4702
|
+
let t = Ke(e, x.value);
|
|
4447
4703
|
x.value !== t && (x.value = t);
|
|
4448
4704
|
});
|
|
4449
|
-
let
|
|
4450
|
-
|
|
4451
|
-
}),
|
|
4452
|
-
g.value &&
|
|
4705
|
+
let Te = V(() => {
|
|
4706
|
+
M.value && g.value && P(M.value.view);
|
|
4707
|
+
}), Ee = () => {
|
|
4708
|
+
g.value && Te.schedule();
|
|
4453
4709
|
};
|
|
4454
4710
|
K(g, (e) => {
|
|
4455
|
-
e ?
|
|
4456
|
-
}),
|
|
4457
|
-
window.addEventListener("resize",
|
|
4711
|
+
e ? Ee() : Te.cancel();
|
|
4712
|
+
}), nr(() => {
|
|
4713
|
+
window.addEventListener("resize", Ee), window.addEventListener("scroll", Ee, !0);
|
|
4458
4714
|
}), q(() => {
|
|
4459
|
-
|
|
4715
|
+
Te.cancel(), window.removeEventListener("resize", Ee), window.removeEventListener("scroll", Ee, !0);
|
|
4460
4716
|
});
|
|
4461
|
-
let
|
|
4717
|
+
let De = null;
|
|
4462
4718
|
return q(() => {
|
|
4463
4719
|
D !== null && window.clearTimeout(D);
|
|
4464
|
-
}),
|
|
4720
|
+
}), nr(() => {
|
|
4465
4721
|
let e = () => {
|
|
4466
|
-
if (!
|
|
4722
|
+
if (!M.value || !ue.value.length) {
|
|
4467
4723
|
x.value = null;
|
|
4468
4724
|
return;
|
|
4469
4725
|
}
|
|
4470
4726
|
let e = null;
|
|
4471
4727
|
try {
|
|
4472
|
-
e =
|
|
4728
|
+
e = We(M.value, ue.value);
|
|
4473
4729
|
} catch {
|
|
4474
4730
|
return;
|
|
4475
4731
|
}
|
|
4476
4732
|
x.value !== e && (x.value = e);
|
|
4477
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
4478
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
4733
|
+
}, t = () => window.requestAnimationFrame(e), n = Wi(M.value?.view.dom ?? null);
|
|
4734
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), De = () => {
|
|
4479
4735
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
4480
4736
|
};
|
|
4481
4737
|
}), q(() => {
|
|
4482
|
-
|
|
4483
|
-
let
|
|
4484
|
-
|
|
4738
|
+
De?.(), e.onAiEditControllerChange?.(null);
|
|
4739
|
+
let t = j.value;
|
|
4740
|
+
j.value = null, J(() => t?.destroy());
|
|
4485
4741
|
}), {
|
|
4486
|
-
editor:
|
|
4487
|
-
runtimeSnapshot:
|
|
4488
|
-
actions:
|
|
4742
|
+
editor: M,
|
|
4743
|
+
runtimeSnapshot: me,
|
|
4744
|
+
actions: ve,
|
|
4489
4745
|
__render: {
|
|
4490
4746
|
messages: o,
|
|
4491
4747
|
effectiveEditable: u,
|
|
4492
|
-
tableFocusState:
|
|
4748
|
+
tableFocusState: z,
|
|
4493
4749
|
tableInteractionState: b,
|
|
4494
|
-
codeBlockState:
|
|
4495
|
-
isCodeBlockActive:
|
|
4750
|
+
codeBlockState: R,
|
|
4751
|
+
isCodeBlockActive: te,
|
|
4496
4752
|
mermaidMode: v,
|
|
4497
4753
|
mathTarget: y,
|
|
4498
4754
|
setMermaidMode: (e) => {
|
|
@@ -4504,14 +4760,14 @@ function Ri(e = {}) {
|
|
|
4504
4760
|
slashMenuPosition: g,
|
|
4505
4761
|
slashInputCommand: _,
|
|
4506
4762
|
runSlashCommand: xe,
|
|
4507
|
-
handleEditorKeyDown:
|
|
4763
|
+
handleEditorKeyDown: Se,
|
|
4508
4764
|
setSlashInputCommand: (e) => {
|
|
4509
4765
|
_.value = e;
|
|
4510
4766
|
}
|
|
4511
4767
|
}
|
|
4512
4768
|
};
|
|
4513
4769
|
}
|
|
4514
|
-
var
|
|
4770
|
+
var ca = Y({
|
|
4515
4771
|
name: "MarkweaveEditor",
|
|
4516
4772
|
props: {
|
|
4517
4773
|
defaultContent: {
|
|
@@ -4590,6 +4846,10 @@ var zi = Y({
|
|
|
4590
4846
|
type: Function,
|
|
4591
4847
|
default: void 0
|
|
4592
4848
|
},
|
|
4849
|
+
askAi: {
|
|
4850
|
+
type: Object,
|
|
4851
|
+
default: void 0
|
|
4852
|
+
},
|
|
4593
4853
|
onRewriteSelection: {
|
|
4594
4854
|
type: Function,
|
|
4595
4855
|
default: void 0
|
|
@@ -4614,77 +4874,84 @@ var zi = Y({
|
|
|
4614
4874
|
type: Function,
|
|
4615
4875
|
default: void 0
|
|
4616
4876
|
},
|
|
4877
|
+
onAiEditControllerChange: {
|
|
4878
|
+
type: Function,
|
|
4879
|
+
default: void 0
|
|
4880
|
+
},
|
|
4617
4881
|
onTocChange: {
|
|
4618
4882
|
type: Function,
|
|
4619
4883
|
default: void 0
|
|
4620
4884
|
}
|
|
4621
4885
|
},
|
|
4622
4886
|
setup(e) {
|
|
4623
|
-
let t =
|
|
4887
|
+
let t = sa(e);
|
|
4624
4888
|
return () => {
|
|
4625
4889
|
let n = t.editor.value;
|
|
4626
4890
|
if (!n) return null;
|
|
4627
|
-
let
|
|
4891
|
+
let i = t.__render, a = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = Se(e.canvasColor);
|
|
4628
4892
|
return H("section", {
|
|
4629
|
-
class:
|
|
4630
|
-
"aria-label": e.ariaLabel ??
|
|
4893
|
+
class: a,
|
|
4894
|
+
"aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
|
|
4631
4895
|
"data-testid": "markweave-editor-frame",
|
|
4632
4896
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
4633
|
-
"data-markweave-theme":
|
|
4634
|
-
style:
|
|
4897
|
+
"data-markweave-theme": Ce(e.theme),
|
|
4898
|
+
style: s ? { "--markweave-canvas": s } : void 0,
|
|
4635
4899
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
4636
|
-
"data-markweave-inner-toc-placement":
|
|
4900
|
+
"data-markweave-inner-toc-placement": qe(e.innerTocPlacement),
|
|
4637
4901
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
4638
|
-
"data-table-focus-mode":
|
|
4639
|
-
onKeydownCapture:
|
|
4902
|
+
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
4903
|
+
onKeydownCapture: i.handleEditorKeyDown
|
|
4640
4904
|
}, [
|
|
4641
|
-
|
|
4905
|
+
i.effectiveEditable.value ? H(Qi, {
|
|
4642
4906
|
editor: n,
|
|
4643
|
-
|
|
4907
|
+
lang: r(e.lang),
|
|
4908
|
+
messages: i.messages,
|
|
4909
|
+
askAi: e.askAi
|
|
4644
4910
|
}) : null,
|
|
4645
|
-
|
|
4646
|
-
commands:
|
|
4647
|
-
state:
|
|
4648
|
-
position:
|
|
4649
|
-
inputCommand:
|
|
4650
|
-
messages:
|
|
4651
|
-
onSelect:
|
|
4652
|
-
onInputCommandChange:
|
|
4911
|
+
i.effectiveEditable.value ? H(ea, {
|
|
4912
|
+
commands: i.filteredSlashCommands.value,
|
|
4913
|
+
state: i.slashState.value,
|
|
4914
|
+
position: i.slashMenuPosition.value,
|
|
4915
|
+
inputCommand: i.slashInputCommand.value,
|
|
4916
|
+
messages: i.messages,
|
|
4917
|
+
onSelect: i.runSlashCommand,
|
|
4918
|
+
onInputCommandChange: i.setSlashInputCommand,
|
|
4653
4919
|
onUpload: e.onSlashCommandUpload
|
|
4654
4920
|
}) : null,
|
|
4655
|
-
|
|
4921
|
+
i.effectiveEditable.value ? H(ra, {
|
|
4656
4922
|
editor: n,
|
|
4657
|
-
active:
|
|
4658
|
-
interactionState:
|
|
4659
|
-
messages:
|
|
4923
|
+
active: i.tableFocusState.value.active,
|
|
4924
|
+
interactionState: i.tableInteractionState.value,
|
|
4925
|
+
messages: i.messages,
|
|
4926
|
+
askAi: e.askAi,
|
|
4660
4927
|
onCopyPayload: e.onTableCopyPayload,
|
|
4661
4928
|
onCommandResult: e.onTableCommandResult,
|
|
4662
4929
|
onEditWithAi: e.onEditWithAi
|
|
4663
4930
|
}) : null,
|
|
4664
|
-
|
|
4931
|
+
i.effectiveEditable.value ? H(ia, {
|
|
4665
4932
|
editor: n,
|
|
4666
|
-
focusState:
|
|
4933
|
+
focusState: i.tableFocusState.value
|
|
4667
4934
|
}) : null,
|
|
4668
|
-
H(
|
|
4935
|
+
H(aa, {
|
|
4669
4936
|
editor: n,
|
|
4670
|
-
state:
|
|
4671
|
-
active:
|
|
4672
|
-
mermaidMode:
|
|
4673
|
-
onMermaidModeChange:
|
|
4674
|
-
readOnly: !
|
|
4937
|
+
state: i.codeBlockState.value,
|
|
4938
|
+
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
4939
|
+
mermaidMode: i.mermaidMode.value,
|
|
4940
|
+
onMermaidModeChange: i.setMermaidMode,
|
|
4941
|
+
readOnly: !i.effectiveEditable.value
|
|
4675
4942
|
}),
|
|
4676
|
-
e.innerToc &&
|
|
4943
|
+
e.innerToc && i.tocState.value.items.length ? H(oa, {
|
|
4677
4944
|
editor: n,
|
|
4678
|
-
state:
|
|
4679
|
-
messages:
|
|
4680
|
-
editable:
|
|
4681
|
-
placement:
|
|
4945
|
+
state: i.tocState.value,
|
|
4946
|
+
messages: i.messages,
|
|
4947
|
+
editable: i.effectiveEditable.value,
|
|
4948
|
+
placement: qe(e.innerTocPlacement)
|
|
4682
4949
|
}) : null,
|
|
4683
|
-
|
|
4950
|
+
i.effectiveEditable.value && i.mathTarget.value ? H($i, {
|
|
4684
4951
|
editor: n,
|
|
4685
|
-
messages:
|
|
4686
|
-
target:
|
|
4687
|
-
onClose: () =>
|
|
4952
|
+
messages: i.messages,
|
|
4953
|
+
target: i.mathTarget.value,
|
|
4954
|
+
onClose: () => i.mathTarget.value = null
|
|
4688
4955
|
}) : null,
|
|
4689
4956
|
H(o, { editor: n })
|
|
4690
4957
|
]);
|
|
@@ -4692,4 +4959,4 @@ var zi = Y({
|
|
|
4692
4959
|
}
|
|
4693
4960
|
});
|
|
4694
4961
|
//#endregion
|
|
4695
|
-
export {
|
|
4962
|
+
export { ca as MarkweaveEditor, z as createMarkweaveAiEditController, Bi as createMarkweaveEditorExtensions, Bi as createMarkweaveVue2EditorExtensions, sa as useMarkweaveEditorController };
|