@markweave/vue2 0.3.3 → 0.3.5
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 +27 -25
- package/dist/index.js +540 -496
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10,13 +10,13 @@ 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 { BubbleMenu as
|
|
16
|
-
import { isEditorComposing as
|
|
17
|
-
import { saveMarkweaveBrowserFile as
|
|
18
|
-
import { createMarkweaveFrameScheduler as
|
|
19
|
-
import { createMarkweaveEditorUpdatePayload as
|
|
13
|
+
import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as ee, markweaveVideoIframeAllow as j, normalizeMarkweaveCoreImageAlign as M, normalizeMarkweaveVideoEmbedUrl as N, numberAttribute as P, stringAttribute as F } from "markweave/internal/plugins/media/core-media-nodes";
|
|
14
|
+
import { detectUploadSource as I, getDirectUploadResult as te, resolveMarkweaveUploadResult as L } from "markweave/internal/plugins/slash-command/upload";
|
|
15
|
+
import { BubbleMenu as R } from "@tiptap/vue-2/menus";
|
|
16
|
+
import { isEditorComposing as ne } from "markweave/internal/editor-core/composition-guard";
|
|
17
|
+
import { saveMarkweaveBrowserFile as re } from "markweave/internal/core/browser-file-save";
|
|
18
|
+
import { createMarkweaveFrameScheduler as z } from "markweave/internal/editor-core/frame-scheduler";
|
|
19
|
+
import { createMarkweaveEditorUpdatePayload as B, getMarkweaveContentType as ie, isEditorContentCurrent as ae, isMarkweaveControlledContentEchoCurrent as oe, normalizeMarkweaveContentFormat as V } from "markweave/internal/editor-core/editor-content";
|
|
20
20
|
import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightColorOptions as ce, getFloatingToolbarMoreActions as le, getFloatingToolbarTextColorOptions as ue, getFloatingToolbarTurnIntoOptions as de, runFloatingToolbarMoreAction as fe, setFloatingToolbarTurnInto as pe } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
21
21
|
import { openMarkweaveReadonlyLinkFromEvent as me } from "markweave/internal/editor-core/readonly-link";
|
|
22
22
|
import { createMarkweaveEditorRuntimeSnapshot as he } from "markweave/internal/editor-core/runtime-snapshot";
|
|
@@ -38,24 +38,24 @@ import { getFirstTableDebugSnapshot as Ht } from "markweave/internal/plugins/tab
|
|
|
38
38
|
import { focusFirstTableBodyCell as Ut } from "markweave/internal/plugins/table/table-focus-position";
|
|
39
39
|
import { getTableFocusState as Wt } from "markweave/internal/plugins/table/table-focus-state";
|
|
40
40
|
import { getTableSelectionOverlayState as Gt, initialTableInteractionState as Kt, tableInteractionPluginKey as qt } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
41
|
-
import { applyTableAxisAlignment as Jt, applyTableAxisBackgroundColor as Yt, applyTableAxisTextColor as Xt, calculateAnchoredTableMenuPosition as Zt,
|
|
41
|
+
import { applyTableAxisAlignment as Jt, applyTableAxisBackgroundColor as Yt, applyTableAxisTextColor as Xt, calculateAnchoredTableMenuPosition as Zt, calculateAnchoredTableSubmenuPosition as Qt, calculateTableAxisHandleLayout as $t, calculateTableExtendButtonLayout as en, canRunTableCommand as tn, executeTableMenuCommand as nn, formatTableCopyFeedback as rn, getActiveTableElement as an, getAvailableCellMenuCommandSpecs as on, getTableAxisDropIndexAtPoint as sn, getTableAxisFormattingState as cn, getTableAxisTargetRect as ln, getTableControlAxisSelectionModel as un, getTableEditWithAiRequest as dn, getTableMenuBoundaryRect as fn, getTableMenuItemGroup as pn, getTableMenuItemLabel as mn, getTableMenuItems as hn, getTableSelectionTargetRect as gn, measureTableSelectionOverlay as _n, moveTargetedTableAxis as vn, selectTableAxisFromCell as yn, tableColorOptions as bn, tableCopyFeedbackTimeoutMs as xn, tableHorizontalAlignmentOptions as Sn, tableMenuLabel as Cn, tableVerticalAlignmentOptions as wn, targetTableAxisFromCell as Tn } from "markweave/internal/plugins/table/table-ui-model";
|
|
42
42
|
//#region src/vue2-compat.ts
|
|
43
|
-
var
|
|
44
|
-
function
|
|
43
|
+
var En = l.default ?? l, Dn = null, On = null, kn = null;
|
|
44
|
+
function An(e) {
|
|
45
45
|
return !!(e && typeof e == "object" && "value" in e);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function jn(e) {
|
|
48
48
|
let t = e.slice(2);
|
|
49
49
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function Mn(e) {
|
|
52
52
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
53
53
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
54
54
|
if (o === "class" || o === "style" || o === "key") {
|
|
55
55
|
t[o] = s;
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
58
|
-
if (o === "ref" &&
|
|
58
|
+
if (o === "ref" && An(s)) {
|
|
59
59
|
a.insert = (e) => {
|
|
60
60
|
s.value = e.elm;
|
|
61
61
|
}, a.destroy = () => {
|
|
@@ -64,7 +64,7 @@ function An(e) {
|
|
|
64
64
|
continue;
|
|
65
65
|
}
|
|
66
66
|
if (/^on[A-Z]/.test(o)) {
|
|
67
|
-
i[
|
|
67
|
+
i[jn(o)] = s;
|
|
68
68
|
continue;
|
|
69
69
|
}
|
|
70
70
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -75,14 +75,14 @@ function An(e) {
|
|
|
75
75
|
}
|
|
76
76
|
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
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function Nn(e) {
|
|
79
79
|
let t = {}, n = {}, r = {}, i = {};
|
|
80
80
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
81
81
|
if (a === "class" || a === "style" || a === "key") {
|
|
82
82
|
t[a] = o;
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
85
|
-
if (a === "ref" &&
|
|
85
|
+
if (a === "ref" && An(o)) {
|
|
86
86
|
i.insert = (e) => {
|
|
87
87
|
o.value = e.componentInstance ?? e.elm;
|
|
88
88
|
}, i.destroy = () => {
|
|
@@ -98,25 +98,25 @@ function jn(e) {
|
|
|
98
98
|
}
|
|
99
99
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function Pn(e) {
|
|
102
102
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function Fn(e) {
|
|
105
105
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function In(e) {
|
|
108
108
|
return e == null || Array.isArray(e) ? e : [e];
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
return typeof e == "function" ?
|
|
110
|
+
function Ln(e) {
|
|
111
|
+
return typeof e == "function" ? In(e()) : Pn(e) ? In(e.default()) : Fn(e) ? [e] : e;
|
|
112
112
|
}
|
|
113
113
|
function H(e, t, n) {
|
|
114
|
-
if (!
|
|
115
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
116
|
-
return
|
|
114
|
+
if (!kn) throw Error("Vue 2 render context is not available.");
|
|
115
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Mn(r) : Nn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Ln(n);
|
|
116
|
+
return kn(e, i, a);
|
|
117
117
|
}
|
|
118
118
|
function U(e) {
|
|
119
|
-
return
|
|
119
|
+
return En.observable({ value: e });
|
|
120
120
|
}
|
|
121
121
|
var W = U;
|
|
122
122
|
function G(e) {
|
|
@@ -126,19 +126,19 @@ function G(e) {
|
|
|
126
126
|
}
|
|
127
127
|
function K(e, t, n) {
|
|
128
128
|
let r = typeof e == "function" ? e : () => e.value;
|
|
129
|
-
return
|
|
129
|
+
return Dn?.$watch ? Dn.$watch(r, t, n) : () => void 0;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
131
|
+
function Rn(e) {
|
|
132
|
+
On?.mounted.push(e);
|
|
133
133
|
}
|
|
134
134
|
function q(e) {
|
|
135
|
-
|
|
135
|
+
On?.beforeUnmount.push(e);
|
|
136
136
|
}
|
|
137
137
|
function J(e) {
|
|
138
|
-
return
|
|
138
|
+
return En.nextTick(e);
|
|
139
139
|
}
|
|
140
140
|
function Y(e) {
|
|
141
|
-
return
|
|
141
|
+
return En.extend({
|
|
142
142
|
name: e.name,
|
|
143
143
|
props: e.props,
|
|
144
144
|
created() {
|
|
@@ -146,12 +146,12 @@ function Y(e) {
|
|
|
146
146
|
mounted: [],
|
|
147
147
|
beforeUnmount: []
|
|
148
148
|
};
|
|
149
|
-
|
|
149
|
+
Dn = this, On = t;
|
|
150
150
|
try {
|
|
151
151
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
152
152
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
153
153
|
} finally {
|
|
154
|
-
|
|
154
|
+
Dn = null, On = null;
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
mounted() {
|
|
@@ -161,19 +161,19 @@ function Y(e) {
|
|
|
161
161
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
162
162
|
},
|
|
163
163
|
render(t) {
|
|
164
|
-
|
|
164
|
+
kn = t;
|
|
165
165
|
try {
|
|
166
166
|
let n = this.__markweaveVue2Render;
|
|
167
167
|
return n ? n() : e.render?.(t) ?? null;
|
|
168
168
|
} finally {
|
|
169
|
-
|
|
169
|
+
kn = null;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
//#endregion
|
|
175
175
|
//#region src/vue2-icons.ts
|
|
176
|
-
var
|
|
176
|
+
var zn = {
|
|
177
177
|
AlignVerticalJustifyCenter: {
|
|
178
178
|
iconName: "align-vertical-justify-center",
|
|
179
179
|
node: [
|
|
@@ -1432,7 +1432,7 @@ var Ln = {
|
|
|
1432
1432
|
}]]
|
|
1433
1433
|
}
|
|
1434
1434
|
};
|
|
1435
|
-
function
|
|
1435
|
+
function Bn(e) {
|
|
1436
1436
|
return e.map(([e, t]) => H(e, t));
|
|
1437
1437
|
}
|
|
1438
1438
|
function X(e) {
|
|
@@ -1453,7 +1453,7 @@ function X(e) {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
},
|
|
1455
1455
|
setup(t) {
|
|
1456
|
-
let n =
|
|
1456
|
+
let n = zn[e];
|
|
1457
1457
|
return () => H("svg", {
|
|
1458
1458
|
class: `lucide lucide-${n.iconName}`,
|
|
1459
1459
|
viewBox: "0 0 24 24",
|
|
@@ -1466,12 +1466,12 @@ function X(e) {
|
|
|
1466
1466
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1467
1467
|
"aria-hidden": "true",
|
|
1468
1468
|
focusable: "false"
|
|
1469
|
-
},
|
|
1469
|
+
}, Bn(n.node));
|
|
1470
1470
|
}
|
|
1471
1471
|
});
|
|
1472
1472
|
}
|
|
1473
|
-
var
|
|
1474
|
-
function
|
|
1473
|
+
var Vn = X("AlignCenter"), Hn = X("AlignJustify"), Un = X("AlignLeft"), Wn = X("AlignRight"), Gn = X("AlignVerticalJustifyCenter"), Kn = X("AlignVerticalJustifyEnd"), qn = X("AlignVerticalJustifyStart"), Jn = X("AlertTriangle"), Yn = X("ArrowDown"), Xn = X("ArrowDownAZ"), Zn = X("ArrowLeft"), Qn = X("ArrowRight"), $n = X("ArrowUp"), er = X("ArrowUpZA"), tr = X("BetweenHorizontalEnd"), nr = X("BetweenHorizontalStart"), rr = X("BetweenVerticalEnd"), ir = X("BetweenVerticalStart"), ar = X("Bold"), or = X("Braces"), sr = X("Captions"), cr = X("CheckCircle2"), lr = X("ChevronDown"), ur = X("ChevronRight"), dr = X("ChevronUp"), fr = X("CircleX"), pr = X("Code2"), mr = X("CornerDownLeft"), hr = X("Copy"), gr = X("Download"), _r = X("Eye"), vr = X("ExternalLink"), yr = X("Heading1"), br = X("Heading2"), xr = X("Heading3"), Sr = X("Image"), Cr = X("ImageUp"), wr = X("IndentDecrease"), Tr = X("IndentIncrease"), Er = X("Info"), Dr = X("Italic"), Or = X("Lightbulb"), kr = X("Link2"), Ar = X("List"), jr = X("ListChecks"), Mr = X("ListOrdered"), Nr = X("Minus"), Pr = X("MoreVertical"), Fr = X("PaintBucket"), Ir = X("Paperclip"), Lr = X("PencilLine"), Rr = X("Plus"), zr = X("Quote"), Br = X("Replace"), Vr = X("Sigma"), Hr = X("SmilePlus"), Ur = X("SquareX"), Wr = X("Strikethrough"), Gr = X("Subscript"), Kr = X("Superscript"), qr = X("Table2"), Jr = X("TableCellsMerge"), Yr = X("TableCellsSplit"), Xr = X("Text"), Zr = X("Trash2"), Qr = X("Type"), $r = X("Underline"), ei = X("Upload"), ti = X("Video"), ni = M;
|
|
1474
|
+
function ri(e) {
|
|
1475
1475
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1476
1476
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1477
1477
|
return n === "view" ? {
|
|
@@ -1493,23 +1493,23 @@ function ti(e) {
|
|
|
1493
1493
|
i(), a?.disconnect();
|
|
1494
1494
|
}), r;
|
|
1495
1495
|
}
|
|
1496
|
-
function
|
|
1496
|
+
function ii(e) {
|
|
1497
1497
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1498
1498
|
}
|
|
1499
|
-
function
|
|
1499
|
+
function ai(e) {
|
|
1500
1500
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1501
1501
|
}
|
|
1502
|
-
function
|
|
1502
|
+
function oi(e) {
|
|
1503
1503
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1504
1504
|
}
|
|
1505
|
-
function
|
|
1505
|
+
function si(e, t) {
|
|
1506
1506
|
return H(e, {
|
|
1507
1507
|
size: 18,
|
|
1508
1508
|
strokeWidth: 1.8,
|
|
1509
1509
|
"aria-hidden": "true"
|
|
1510
1510
|
}, { default: () => t });
|
|
1511
1511
|
}
|
|
1512
|
-
function
|
|
1512
|
+
function ci(e) {
|
|
1513
1513
|
return H("button", {
|
|
1514
1514
|
type: "button",
|
|
1515
1515
|
"aria-label": e.label,
|
|
@@ -1518,12 +1518,12 @@ function oi(e) {
|
|
|
1518
1518
|
"data-active": e.active ? "true" : "false",
|
|
1519
1519
|
onMousedown: (e) => e.preventDefault(),
|
|
1520
1520
|
onClick: e.onClick
|
|
1521
|
-
}, [
|
|
1521
|
+
}, [si(e.icon, e.label), H("span", {
|
|
1522
1522
|
class: "markweave-image-tooltip",
|
|
1523
1523
|
role: "tooltip"
|
|
1524
1524
|
}, e.label)]);
|
|
1525
1525
|
}
|
|
1526
|
-
function
|
|
1526
|
+
function li(e) {
|
|
1527
1527
|
let t = U(null), n = e.messages.image;
|
|
1528
1528
|
return H("section", {
|
|
1529
1529
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1557,7 +1557,7 @@ function si(e) {
|
|
|
1557
1557
|
H("div", {
|
|
1558
1558
|
class: "markweave-image-upload-icon",
|
|
1559
1559
|
"aria-hidden": "true"
|
|
1560
|
-
}, [H(
|
|
1560
|
+
}, [H(Cr, {
|
|
1561
1561
|
size: 46,
|
|
1562
1562
|
strokeWidth: 1.6
|
|
1563
1563
|
})]),
|
|
@@ -1582,7 +1582,7 @@ function si(e) {
|
|
|
1582
1582
|
"data-testid": "markweave-image-upload-submit",
|
|
1583
1583
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1584
1584
|
onClick: e.onSubmit
|
|
1585
|
-
}, [H(
|
|
1585
|
+
}, [H(Cr, {
|
|
1586
1586
|
size: 16,
|
|
1587
1587
|
strokeWidth: 1.8
|
|
1588
1588
|
}), e.messages.common.insert]),
|
|
@@ -1598,7 +1598,7 @@ function si(e) {
|
|
|
1598
1598
|
}, e.error) : null
|
|
1599
1599
|
]);
|
|
1600
1600
|
}
|
|
1601
|
-
function
|
|
1601
|
+
function ui(e) {
|
|
1602
1602
|
let t = U(null), n = e.messages.video;
|
|
1603
1603
|
return H("section", {
|
|
1604
1604
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1632,7 +1632,7 @@ function ci(e) {
|
|
|
1632
1632
|
H("div", {
|
|
1633
1633
|
class: "markweave-video-upload-icon",
|
|
1634
1634
|
"aria-hidden": "true"
|
|
1635
|
-
}, [H(
|
|
1635
|
+
}, [H(ti, {
|
|
1636
1636
|
size: 46,
|
|
1637
1637
|
strokeWidth: 1.6
|
|
1638
1638
|
})]),
|
|
@@ -1657,7 +1657,7 @@ function ci(e) {
|
|
|
1657
1657
|
"data-testid": "markweave-video-upload-submit",
|
|
1658
1658
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1659
1659
|
onClick: e.onSubmit
|
|
1660
|
-
}, [H(
|
|
1660
|
+
}, [H(ei, {
|
|
1661
1661
|
size: 16,
|
|
1662
1662
|
strokeWidth: 1.8
|
|
1663
1663
|
}), e.messages.common.insert]),
|
|
@@ -1673,7 +1673,7 @@ function ci(e) {
|
|
|
1673
1673
|
}, e.error) : null
|
|
1674
1674
|
]);
|
|
1675
1675
|
}
|
|
1676
|
-
var
|
|
1676
|
+
var di = Y({
|
|
1677
1677
|
name: "MarkweaveVueImageNodeView",
|
|
1678
1678
|
props: {
|
|
1679
1679
|
editor: {
|
|
@@ -1706,7 +1706,7 @@ var li = Y({
|
|
|
1706
1706
|
}
|
|
1707
1707
|
},
|
|
1708
1708
|
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(!!
|
|
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(!!F(u.value.caption)), p = U(F(u.value.caption) ?? ""), m = ri(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => F(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
|
|
1710
1710
|
K(v, (t) => {
|
|
1711
1711
|
if (C?.abort(), C = null, !t) {
|
|
1712
1712
|
x.value = null;
|
|
@@ -1727,10 +1727,10 @@ var li = Y({
|
|
|
1727
1727
|
r.signal.aborted || (x.value = e);
|
|
1728
1728
|
});
|
|
1729
1729
|
}, { immediate: !0 }), q(() => C?.abort());
|
|
1730
|
-
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() =>
|
|
1730
|
+
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => ni(u.value.align)), D = G(() => P(u.value.width)), A = G(() => F(u.value.caption)), j = G(() => h.value && (!v.value || i.value)), M = () => {
|
|
1731
1731
|
w.value && b({
|
|
1732
1732
|
src: w.value,
|
|
1733
|
-
alt:
|
|
1733
|
+
alt: F(u.value.alt) ?? "",
|
|
1734
1734
|
messages: {
|
|
1735
1735
|
dialogAriaLabel: _.value.previewDialogAriaLabel,
|
|
1736
1736
|
zoomOut: _.value.previewZoomOut,
|
|
@@ -1743,45 +1743,45 @@ var li = Y({
|
|
|
1743
1743
|
K(A, (e) => {
|
|
1744
1744
|
f.value || (p.value = e ?? "");
|
|
1745
1745
|
});
|
|
1746
|
-
let
|
|
1746
|
+
let N = () => {
|
|
1747
1747
|
if (!h.value) return;
|
|
1748
1748
|
let t = e.getPos();
|
|
1749
1749
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1750
|
-
},
|
|
1750
|
+
}, te = () => {
|
|
1751
1751
|
if (o.value = "", c.value = null, a.value = !1, v.value) {
|
|
1752
1752
|
i.value = !1;
|
|
1753
1753
|
return;
|
|
1754
1754
|
}
|
|
1755
1755
|
e.deleteNode();
|
|
1756
|
-
},
|
|
1756
|
+
}, R = async (t) => {
|
|
1757
1757
|
if (!h.value) return;
|
|
1758
1758
|
let n = e.extension.options;
|
|
1759
1759
|
l.value = !0, c.value = null;
|
|
1760
1760
|
try {
|
|
1761
|
-
let r = await
|
|
1761
|
+
let r = await L(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1762
1762
|
e.updateAttributes(T(u.value, r)), o.value = "", i.value = !1;
|
|
1763
1763
|
} catch (e) {
|
|
1764
1764
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
1765
1765
|
} finally {
|
|
1766
1766
|
l.value = !1, a.value = !1;
|
|
1767
1767
|
}
|
|
1768
|
-
},
|
|
1768
|
+
}, ne = () => {
|
|
1769
1769
|
if (!o.value.trim()) {
|
|
1770
1770
|
c.value = _.value.uploadRequiredError;
|
|
1771
1771
|
return;
|
|
1772
1772
|
}
|
|
1773
|
-
|
|
1774
|
-
},
|
|
1775
|
-
|
|
1773
|
+
R(I(o.value));
|
|
1774
|
+
}, re = (e) => {
|
|
1775
|
+
R({
|
|
1776
1776
|
type: "file",
|
|
1777
1777
|
file: e,
|
|
1778
1778
|
mimeType: e.type || "image/*"
|
|
1779
1779
|
});
|
|
1780
|
-
},
|
|
1780
|
+
}, z = () => {
|
|
1781
1781
|
f.value = !f.value, f.value && (p.value = A.value ?? "");
|
|
1782
|
-
},
|
|
1782
|
+
}, B = (n, r) => {
|
|
1783
1783
|
if (!h.value || !v.value) return;
|
|
1784
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1784
|
+
r.preventDefault(), r.stopPropagation(), N();
|
|
1785
1785
|
let i = t.value;
|
|
1786
1786
|
if (!i) return;
|
|
1787
1787
|
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 +1792,7 @@ var li = Y({
|
|
|
1792
1792
|
};
|
|
1793
1793
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1794
1794
|
};
|
|
1795
|
-
return () =>
|
|
1795
|
+
return () => j.value ? H(s, {
|
|
1796
1796
|
as: "figure",
|
|
1797
1797
|
class: "markweave-image-node",
|
|
1798
1798
|
"data-testid": "markweave-image-node",
|
|
@@ -1800,7 +1800,7 @@ var li = Y({
|
|
|
1800
1800
|
"data-selected": "false",
|
|
1801
1801
|
"data-hovered": "false",
|
|
1802
1802
|
"data-empty": "true"
|
|
1803
|
-
}, () =>
|
|
1803
|
+
}, () => li({
|
|
1804
1804
|
messages: g.value,
|
|
1805
1805
|
inputValue: o.value,
|
|
1806
1806
|
error: c.value,
|
|
@@ -1809,9 +1809,9 @@ var li = Y({
|
|
|
1809
1809
|
onInputValue: (e) => {
|
|
1810
1810
|
o.value = e;
|
|
1811
1811
|
},
|
|
1812
|
-
onFile:
|
|
1813
|
-
onSubmit:
|
|
1814
|
-
onCancel:
|
|
1812
|
+
onFile: re,
|
|
1813
|
+
onSubmit: ne,
|
|
1814
|
+
onCancel: te,
|
|
1815
1815
|
onDragActive: (e) => {
|
|
1816
1816
|
a.value = e;
|
|
1817
1817
|
}
|
|
@@ -1830,7 +1830,7 @@ var li = Y({
|
|
|
1830
1830
|
r.value = !1;
|
|
1831
1831
|
},
|
|
1832
1832
|
onMousedown: (e) => {
|
|
1833
|
-
h.value && !
|
|
1833
|
+
h.value && !ii(e.target) && N();
|
|
1834
1834
|
}
|
|
1835
1835
|
}, () => [
|
|
1836
1836
|
h.value ? H("div", {
|
|
@@ -1839,24 +1839,24 @@ var li = Y({
|
|
|
1839
1839
|
"data-markweave-image-ui": "true",
|
|
1840
1840
|
"aria-label": _.value.toolsAriaLabel
|
|
1841
1841
|
}, [
|
|
1842
|
-
|
|
1842
|
+
ci({
|
|
1843
1843
|
testId: "markweave-image-align-left",
|
|
1844
1844
|
label: _.value.alignLeft,
|
|
1845
|
-
icon:
|
|
1845
|
+
icon: Un,
|
|
1846
1846
|
active: E.value === "left",
|
|
1847
1847
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1848
1848
|
}),
|
|
1849
|
-
|
|
1849
|
+
ci({
|
|
1850
1850
|
testId: "markweave-image-align-center",
|
|
1851
1851
|
label: _.value.alignCenter,
|
|
1852
|
-
icon:
|
|
1852
|
+
icon: Vn,
|
|
1853
1853
|
active: E.value === "center",
|
|
1854
1854
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1855
1855
|
}),
|
|
1856
|
-
|
|
1856
|
+
ci({
|
|
1857
1857
|
testId: "markweave-image-align-right",
|
|
1858
1858
|
label: _.value.alignRight,
|
|
1859
|
-
icon:
|
|
1859
|
+
icon: Wn,
|
|
1860
1860
|
active: E.value === "right",
|
|
1861
1861
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1862
1862
|
}),
|
|
@@ -1864,31 +1864,31 @@ var li = Y({
|
|
|
1864
1864
|
class: "markweave-image-toolbar-divider",
|
|
1865
1865
|
"aria-hidden": "true"
|
|
1866
1866
|
}),
|
|
1867
|
-
|
|
1867
|
+
ci({
|
|
1868
1868
|
testId: "markweave-image-caption",
|
|
1869
1869
|
label: _.value.caption,
|
|
1870
|
-
icon:
|
|
1870
|
+
icon: sr,
|
|
1871
1871
|
active: f.value || !!A.value,
|
|
1872
|
-
onClick:
|
|
1872
|
+
onClick: z
|
|
1873
1873
|
}),
|
|
1874
|
-
|
|
1874
|
+
ci({
|
|
1875
1875
|
testId: "markweave-image-preview",
|
|
1876
1876
|
label: _.value.preview,
|
|
1877
|
-
icon:
|
|
1878
|
-
onClick:
|
|
1877
|
+
icon: _r,
|
|
1878
|
+
onClick: M
|
|
1879
1879
|
}),
|
|
1880
|
-
|
|
1880
|
+
ci({
|
|
1881
1881
|
testId: "markweave-image-download",
|
|
1882
1882
|
label: _.value.download,
|
|
1883
|
-
icon:
|
|
1883
|
+
icon: gr,
|
|
1884
1884
|
onClick: () => {
|
|
1885
|
-
w.value &&
|
|
1885
|
+
w.value && ee(w.value);
|
|
1886
1886
|
}
|
|
1887
1887
|
}),
|
|
1888
|
-
|
|
1888
|
+
ci({
|
|
1889
1889
|
testId: "markweave-image-replace",
|
|
1890
1890
|
label: _.value.replace,
|
|
1891
|
-
icon:
|
|
1891
|
+
icon: Br,
|
|
1892
1892
|
onClick: () => {
|
|
1893
1893
|
o.value = "", c.value = null, i.value = !0;
|
|
1894
1894
|
}
|
|
@@ -1897,10 +1897,10 @@ var li = Y({
|
|
|
1897
1897
|
class: "markweave-image-toolbar-divider",
|
|
1898
1898
|
"aria-hidden": "true"
|
|
1899
1899
|
}),
|
|
1900
|
-
|
|
1900
|
+
ci({
|
|
1901
1901
|
testId: "markweave-image-delete",
|
|
1902
1902
|
label: _.value.delete,
|
|
1903
|
-
icon:
|
|
1903
|
+
icon: Zr,
|
|
1904
1904
|
onClick: () => e.deleteNode()
|
|
1905
1905
|
})
|
|
1906
1906
|
]) : null,
|
|
@@ -1915,8 +1915,8 @@ var li = Y({
|
|
|
1915
1915
|
w.value ? H("img", {
|
|
1916
1916
|
class: "markweave-image",
|
|
1917
1917
|
src: w.value,
|
|
1918
|
-
alt:
|
|
1919
|
-
title:
|
|
1918
|
+
alt: F(u.value.alt) ?? "",
|
|
1919
|
+
title: F(u.value.title) ?? void 0,
|
|
1920
1920
|
draggable: !1,
|
|
1921
1921
|
loading: "lazy",
|
|
1922
1922
|
decoding: "async",
|
|
@@ -1935,8 +1935,8 @@ var li = Y({
|
|
|
1935
1935
|
"aria-label": _.value.preview,
|
|
1936
1936
|
title: _.value.preview,
|
|
1937
1937
|
onMousedown: (e) => e.preventDefault(),
|
|
1938
|
-
onClick:
|
|
1939
|
-
}, [H(
|
|
1938
|
+
onClick: M
|
|
1939
|
+
}, [H(_r, {
|
|
1940
1940
|
size: 16,
|
|
1941
1941
|
strokeWidth: 1.8
|
|
1942
1942
|
}), H("span", {
|
|
@@ -1950,7 +1950,7 @@ var li = Y({
|
|
|
1950
1950
|
"data-side": "left",
|
|
1951
1951
|
"aria-label": _.value.resizeLeft,
|
|
1952
1952
|
"data-markweave-image-ui": "true",
|
|
1953
|
-
onPointerdown: (e) =>
|
|
1953
|
+
onPointerdown: (e) => B("left", e)
|
|
1954
1954
|
}) : null,
|
|
1955
1955
|
h.value ? H("button", {
|
|
1956
1956
|
type: "button",
|
|
@@ -1959,7 +1959,7 @@ var li = Y({
|
|
|
1959
1959
|
"data-side": "right",
|
|
1960
1960
|
"aria-label": _.value.resizeRight,
|
|
1961
1961
|
"data-markweave-image-ui": "true",
|
|
1962
|
-
onPointerdown: (e) =>
|
|
1962
|
+
onPointerdown: (e) => B("right", e)
|
|
1963
1963
|
}) : null
|
|
1964
1964
|
]),
|
|
1965
1965
|
h.value && (f.value || A.value) ? H("input", {
|
|
@@ -1981,7 +1981,7 @@ var li = Y({
|
|
|
1981
1981
|
}, A.value) : null
|
|
1982
1982
|
]);
|
|
1983
1983
|
}
|
|
1984
|
-
}),
|
|
1984
|
+
}), fi = Y({
|
|
1985
1985
|
name: "MarkweaveVueVideoNodeView",
|
|
1986
1986
|
props: {
|
|
1987
1987
|
editor: {
|
|
@@ -2014,14 +2014,14 @@ var li = Y({
|
|
|
2014
2014
|
}
|
|
2015
2015
|
},
|
|
2016
2016
|
setup(e) {
|
|
2017
|
-
let t = U(!1), r = U(""), i = U(null), a = U(!1), o =
|
|
2017
|
+
let t = U(!1), r = U(""), i = U(null), a = U(!1), o = ri(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => F(f.value.src)), m = G(() => F(f.value.embedUrl)), h = G(() => F(f.value.provider)), g = G(() => m.value ? N(m.value, h.value) : null), _ = G(() => F(f.value.mimeType)), v = G(() => F(f.value.title)), y = () => {
|
|
2018
2018
|
p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
|
|
2019
2019
|
}, b = async (n) => {
|
|
2020
2020
|
if (!c.value) return;
|
|
2021
2021
|
let o = e.extension.options;
|
|
2022
2022
|
a.value = !0, i.value = null;
|
|
2023
2023
|
try {
|
|
2024
|
-
let t = await
|
|
2024
|
+
let t = await L(A(n), o?.onUpload);
|
|
2025
2025
|
e.updateAttributes(E(t)), r.value = "";
|
|
2026
2026
|
} catch (e) {
|
|
2027
2027
|
i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
@@ -2055,7 +2055,7 @@ var li = Y({
|
|
|
2055
2055
|
"data-testid": "markweave-video-node",
|
|
2056
2056
|
"data-empty": "true",
|
|
2057
2057
|
"data-selected": "false"
|
|
2058
|
-
}, () =>
|
|
2058
|
+
}, () => ui({
|
|
2059
2059
|
messages: l.value,
|
|
2060
2060
|
inputValue: r.value,
|
|
2061
2061
|
error: i.value,
|
|
@@ -2082,7 +2082,7 @@ var li = Y({
|
|
|
2082
2082
|
onFocus: C,
|
|
2083
2083
|
onKeydown: w,
|
|
2084
2084
|
onMousedown: (e) => {
|
|
2085
|
-
c.value && !
|
|
2085
|
+
c.value && !ai(e.target) && (e.preventDefault(), C());
|
|
2086
2086
|
}
|
|
2087
2087
|
}, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
|
|
2088
2088
|
class: "markweave-video-iframe",
|
|
@@ -2091,7 +2091,7 @@ var li = Y({
|
|
|
2091
2091
|
"data-markweave-video-embed": "true",
|
|
2092
2092
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
2093
2093
|
"data-markweave-video-src": p.value ?? void 0,
|
|
2094
|
-
allow:
|
|
2094
|
+
allow: j,
|
|
2095
2095
|
loading: "lazy",
|
|
2096
2096
|
allowfullscreen: "true"
|
|
2097
2097
|
}), c.value ? H("button", {
|
|
@@ -2120,7 +2120,7 @@ var li = Y({
|
|
|
2120
2120
|
"aria-hidden": "true"
|
|
2121
2121
|
})]);
|
|
2122
2122
|
}
|
|
2123
|
-
}),
|
|
2123
|
+
}), pi = C.extend({
|
|
2124
2124
|
addOptions() {
|
|
2125
2125
|
return {
|
|
2126
2126
|
...this.parent?.(),
|
|
@@ -2131,16 +2131,16 @@ var li = Y({
|
|
|
2131
2131
|
},
|
|
2132
2132
|
addNodeView() {
|
|
2133
2133
|
if (typeof document > "u") return null;
|
|
2134
|
-
let e = c(
|
|
2134
|
+
let e = c(di, { stopEvent: ({ event: e }) => ii(e.target) }), t = this.options.resolveMediaSource;
|
|
2135
2135
|
if (!t) return e;
|
|
2136
2136
|
let r = x({
|
|
2137
2137
|
messages: this.options.messages ?? n("zh"),
|
|
2138
2138
|
onUpload: this.options.onUpload,
|
|
2139
2139
|
resolveMediaSource: t
|
|
2140
2140
|
});
|
|
2141
|
-
return (t) =>
|
|
2141
|
+
return (t) => F(t.node.attrs.src) ? r(t) : e(t);
|
|
2142
2142
|
}
|
|
2143
|
-
}),
|
|
2143
|
+
}), mi = w.extend({
|
|
2144
2144
|
addOptions() {
|
|
2145
2145
|
return {
|
|
2146
2146
|
...this.parent?.(),
|
|
@@ -2150,9 +2150,9 @@ var li = Y({
|
|
|
2150
2150
|
};
|
|
2151
2151
|
},
|
|
2152
2152
|
addNodeView() {
|
|
2153
|
-
return typeof document > "u" ? null : c(
|
|
2153
|
+
return typeof document > "u" ? null : c(fi, { stopEvent: ({ event: e }) => ai(e.target) });
|
|
2154
2154
|
}
|
|
2155
|
-
}),
|
|
2155
|
+
}), hi = Y({
|
|
2156
2156
|
name: "MarkweaveVueLinkCardNodeView",
|
|
2157
2157
|
props: {
|
|
2158
2158
|
editor: {
|
|
@@ -2185,7 +2185,7 @@ var li = Y({
|
|
|
2185
2185
|
}
|
|
2186
2186
|
},
|
|
2187
2187
|
setup(e) {
|
|
2188
|
-
let t = e.extension.options, r = t.messages ?? n("zh"), i =
|
|
2188
|
+
let t = e.extension.options, r = t.messages ?? n("zh"), i = ri(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
2189
|
K(l, (e) => {
|
|
2190
2190
|
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
2191
2191
|
});
|
|
@@ -2220,7 +2220,7 @@ var li = Y({
|
|
|
2220
2220
|
"data-testid": n,
|
|
2221
2221
|
onMousedown: h,
|
|
2222
2222
|
onClick: r
|
|
2223
|
-
}, [
|
|
2223
|
+
}, [si(t, e), H("span", { role: "tooltip" }, e)]);
|
|
2224
2224
|
return () => {
|
|
2225
2225
|
let n = l.value;
|
|
2226
2226
|
if (!n) return null;
|
|
@@ -2256,10 +2256,10 @@ var li = Y({
|
|
|
2256
2256
|
a.value = !1;
|
|
2257
2257
|
},
|
|
2258
2258
|
onMousedown: (e) => {
|
|
2259
|
-
|
|
2259
|
+
oi(e.target) || e.preventDefault();
|
|
2260
2260
|
},
|
|
2261
2261
|
onClick: (e) => {
|
|
2262
|
-
|
|
2262
|
+
oi(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
2263
2263
|
}
|
|
2264
2264
|
}, () => [
|
|
2265
2265
|
H("a", {
|
|
@@ -2279,9 +2279,9 @@ var li = Y({
|
|
|
2279
2279
|
"data-markweave-link-card-ui": "true",
|
|
2280
2280
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
2281
2281
|
}, [
|
|
2282
|
-
C(r.linkCard.convertToLink,
|
|
2283
|
-
C(r.linkCard.copyAddress,
|
|
2284
|
-
C(r.linkCard.edit,
|
|
2282
|
+
C(r.linkCard.convertToLink, kr, "markweave-link-card-convert", x),
|
|
2283
|
+
C(r.linkCard.copyAddress, gr, "markweave-link-card-copy", () => b(n.href)),
|
|
2284
|
+
C(r.linkCard.edit, Lr, "markweave-link-card-edit", (i) => g({
|
|
2285
2285
|
anchor: i.currentTarget,
|
|
2286
2286
|
editor: e.editor,
|
|
2287
2287
|
messages: r,
|
|
@@ -2291,7 +2291,7 @@ var li = Y({
|
|
|
2291
2291
|
attrs: n
|
|
2292
2292
|
}
|
|
2293
2293
|
})),
|
|
2294
|
-
C(r.linkCard.delete,
|
|
2294
|
+
C(r.linkCard.delete, Zr, "markweave-link-card-delete", () => e.deleteNode())
|
|
2295
2295
|
]) : null,
|
|
2296
2296
|
p.value && o.value ? H("form", {
|
|
2297
2297
|
class: "markweave-link-card-editor",
|
|
@@ -2319,12 +2319,12 @@ var li = Y({
|
|
|
2319
2319
|
type: "submit",
|
|
2320
2320
|
disabled: !v(f.value),
|
|
2321
2321
|
"aria-label": r.linkCard.edit
|
|
2322
|
-
}, [
|
|
2322
|
+
}, [si(kr, r.linkCard.edit)])
|
|
2323
2323
|
]) : null
|
|
2324
2324
|
]);
|
|
2325
2325
|
};
|
|
2326
2326
|
}
|
|
2327
|
-
}),
|
|
2327
|
+
}), gi = h.extend({
|
|
2328
2328
|
addOptions() {
|
|
2329
2329
|
return {
|
|
2330
2330
|
...this.parent?.(),
|
|
@@ -2333,23 +2333,23 @@ var li = Y({
|
|
|
2333
2333
|
};
|
|
2334
2334
|
},
|
|
2335
2335
|
addNodeView() {
|
|
2336
|
-
return typeof document > "u" ? null : c(
|
|
2336
|
+
return typeof document > "u" ? null : c(hi, { stopEvent: ({ event: e }) => oi(e.target) });
|
|
2337
2337
|
}
|
|
2338
2338
|
});
|
|
2339
2339
|
//#endregion
|
|
2340
2340
|
//#region src/create-editor-extensions.ts
|
|
2341
|
-
function
|
|
2341
|
+
function _i(t = {}) {
|
|
2342
2342
|
return e({
|
|
2343
2343
|
lang: t.lang,
|
|
2344
2344
|
onImageUpload: t.onImageUpload,
|
|
2345
|
-
linkCardExtension:
|
|
2345
|
+
linkCardExtension: gi.configure({
|
|
2346
2346
|
lang: t.lang,
|
|
2347
2347
|
messages: n(t.lang),
|
|
2348
2348
|
resolver: t.linkCardResolver
|
|
2349
2349
|
}),
|
|
2350
2350
|
mediaExtensions: i({
|
|
2351
|
-
image:
|
|
2352
|
-
video:
|
|
2351
|
+
image: pi,
|
|
2352
|
+
video: mi,
|
|
2353
2353
|
lang: t.lang,
|
|
2354
2354
|
onImageUpload: t.onImageUpload,
|
|
2355
2355
|
onVideoUpload: t.onVideoUpload,
|
|
@@ -2359,7 +2359,7 @@ function hi(t = {}) {
|
|
|
2359
2359
|
}
|
|
2360
2360
|
//#endregion
|
|
2361
2361
|
//#region src/MarkweaveEditor.ts
|
|
2362
|
-
var
|
|
2362
|
+
var vi = {
|
|
2363
2363
|
active: !1,
|
|
2364
2364
|
mode: "outside",
|
|
2365
2365
|
activeCellPos: null,
|
|
@@ -2367,17 +2367,17 @@ var gi = {
|
|
|
2367
2367
|
selectedCellCount: 0,
|
|
2368
2368
|
selectionFrom: 0,
|
|
2369
2369
|
selectionTo: 0
|
|
2370
|
-
},
|
|
2370
|
+
}, yi = {
|
|
2371
2371
|
active: !1,
|
|
2372
2372
|
language: Fe.defaultLanguage,
|
|
2373
2373
|
mermaidPreviewMode: "code",
|
|
2374
2374
|
pos: null,
|
|
2375
2375
|
text: ""
|
|
2376
2376
|
};
|
|
2377
|
-
function
|
|
2377
|
+
function bi(e) {
|
|
2378
2378
|
return qt.getState(e.state) ?? Kt;
|
|
2379
2379
|
}
|
|
2380
|
-
function
|
|
2380
|
+
function xi(e) {
|
|
2381
2381
|
if (!e || typeof window > "u") return null;
|
|
2382
2382
|
let t = e.parentElement;
|
|
2383
2383
|
for (; t;) {
|
|
@@ -2394,7 +2394,7 @@ function Z(e, t, n = 18, r = 1.8) {
|
|
|
2394
2394
|
"aria-hidden": "true"
|
|
2395
2395
|
}, { default: () => t });
|
|
2396
2396
|
}
|
|
2397
|
-
function
|
|
2397
|
+
function Si(e) {
|
|
2398
2398
|
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
2399
|
cx: "10",
|
|
2400
2400
|
cy: "10",
|
|
@@ -2442,57 +2442,57 @@ function Q(e) {
|
|
|
2442
2442
|
"stroke-linecap": "round",
|
|
2443
2443
|
"stroke-linejoin": "round",
|
|
2444
2444
|
"stroke-width": "1.8"
|
|
2445
|
-
},
|
|
2445
|
+
}, Si(e)));
|
|
2446
2446
|
}
|
|
2447
2447
|
function $(e) {
|
|
2448
2448
|
e.preventDefault();
|
|
2449
2449
|
}
|
|
2450
|
-
function
|
|
2450
|
+
function Ci(e) {
|
|
2451
2451
|
let t = ft(e);
|
|
2452
2452
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
2453
2453
|
}
|
|
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:
|
|
2454
|
+
var wi = {
|
|
2455
|
+
bold: ar,
|
|
2456
|
+
italic: Dr,
|
|
2457
|
+
underline: $r,
|
|
2458
|
+
strike: Wr,
|
|
2459
|
+
"inline-code": pr,
|
|
2460
|
+
link: kr,
|
|
2461
|
+
more: Pr,
|
|
2462
|
+
superscript: Kr,
|
|
2463
|
+
subscript: Gr,
|
|
2464
|
+
"inline-math": Vr,
|
|
2465
|
+
"align-left": Un,
|
|
2466
|
+
"align-center": Vn,
|
|
2467
|
+
"align-right": Wn,
|
|
2468
|
+
"align-justify": Hn,
|
|
2469
|
+
"decrease-indent": wr,
|
|
2470
|
+
"increase-indent": Tr
|
|
2471
|
+
}, Ti = {
|
|
2472
|
+
type: Xr,
|
|
2473
|
+
"heading-1": yr,
|
|
2474
|
+
"heading-2": br,
|
|
2475
|
+
"heading-3": xr,
|
|
2476
|
+
"bullet-list": Ar,
|
|
2477
|
+
"ordered-list": Mr,
|
|
2478
|
+
"task-list": jr,
|
|
2479
|
+
blockquote: zr,
|
|
2480
|
+
"code-block": or,
|
|
2481
|
+
info: Er,
|
|
2482
|
+
tip: Or,
|
|
2483
|
+
warning: Jn,
|
|
2484
|
+
error: fr,
|
|
2485
|
+
success: cr,
|
|
2486
|
+
emoji: Hr,
|
|
2487
|
+
math: Vr,
|
|
2488
|
+
table: qr,
|
|
2489
|
+
separator: Nr,
|
|
2490
|
+
image: Sr,
|
|
2491
|
+
video: ti,
|
|
2492
|
+
attachment: Ir
|
|
2493
2493
|
};
|
|
2494
|
-
function
|
|
2495
|
-
let t =
|
|
2494
|
+
function Ei(e) {
|
|
2495
|
+
let t = Ti[e];
|
|
2496
2496
|
return H(t, {
|
|
2497
2497
|
size: 18,
|
|
2498
2498
|
strokeWidth: 1.6,
|
|
@@ -2500,21 +2500,21 @@ function wi(e) {
|
|
|
2500
2500
|
"aria-hidden": "true"
|
|
2501
2501
|
});
|
|
2502
2502
|
}
|
|
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":
|
|
2503
|
+
var Di = {
|
|
2504
|
+
paragraph: Qr,
|
|
2505
|
+
"heading-1": yr,
|
|
2506
|
+
"heading-2": br,
|
|
2507
|
+
"heading-3": xr,
|
|
2508
|
+
"bullet-list": Ar,
|
|
2509
|
+
"numbered-list": Mr,
|
|
2510
|
+
"todo-list": jr,
|
|
2511
|
+
quote: zr,
|
|
2512
|
+
"code-block": or
|
|
2513
2513
|
};
|
|
2514
|
-
function
|
|
2514
|
+
function Oi(e, t) {
|
|
2515
2515
|
return se(e, t).label;
|
|
2516
2516
|
}
|
|
2517
|
-
var
|
|
2517
|
+
var ki = Y({
|
|
2518
2518
|
name: "MarkweaveVueFloatingToolbar",
|
|
2519
2519
|
props: {
|
|
2520
2520
|
editor: {
|
|
@@ -2534,7 +2534,7 @@ var Di = Y({
|
|
|
2534
2534
|
let t = U(null), n = U(""), r = U(null), i = U(null), a = U("bottom"), o = U(null), s = U(null), c = U(null), l = G(() => ft(n.value.trim())), u = G(() => e.messages.floatingToolbar), d = G(() => de(e.messages).map((e) => [
|
|
2535
2535
|
e.id,
|
|
2536
2536
|
e.label,
|
|
2537
|
-
|
|
2537
|
+
Di[e.id]
|
|
2538
2538
|
])), f = G(() => ue(e.messages).map((e) => [
|
|
2539
2539
|
e.id,
|
|
2540
2540
|
e.value,
|
|
@@ -2549,7 +2549,7 @@ var Di = Y({
|
|
|
2549
2549
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
2550
2550
|
}, _ = (r) => {
|
|
2551
2551
|
t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
|
|
2552
|
-
}, v =
|
|
2552
|
+
}, v = z(() => {
|
|
2553
2553
|
let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
2554
2554
|
if (!t.value || !n || !r) return;
|
|
2555
2555
|
let s = _e({
|
|
@@ -2566,7 +2566,7 @@ var Di = Y({
|
|
|
2566
2566
|
});
|
|
2567
2567
|
K(t, (e) => {
|
|
2568
2568
|
e && J(v.schedule);
|
|
2569
|
-
}),
|
|
2569
|
+
}), Rn(() => {
|
|
2570
2570
|
window.addEventListener("resize", v.schedule), window.addEventListener("scroll", v.schedule, !0);
|
|
2571
2571
|
}), q(() => {
|
|
2572
2572
|
v.cancel(), window.removeEventListener("resize", v.schedule), window.removeEventListener("scroll", v.schedule, !0);
|
|
@@ -2609,7 +2609,7 @@ var Di = Y({
|
|
|
2609
2609
|
onMouseenter: (e) => b(n, e.currentTarget),
|
|
2610
2610
|
onMouseleave: () => b(null),
|
|
2611
2611
|
onClick: o
|
|
2612
|
-
}, n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" },
|
|
2612
|
+
}, n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, Oi(e.editor, e.messages)), Z(t.value === "block-type" ? dr : lr, i)])] : 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" ? dr : lr, i)])] : [Z(a, i)]), C = () => H("span", {
|
|
2613
2613
|
class: "markweave-floating-toolbar-divider",
|
|
2614
2614
|
"aria-hidden": "true"
|
|
2615
2615
|
}), w = (n, r, i) => H("section", {
|
|
@@ -2665,7 +2665,7 @@ var Di = Y({
|
|
|
2665
2665
|
"aria-label": u.value.applyLink,
|
|
2666
2666
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2667
2667
|
onMousedown: $
|
|
2668
|
-
}, [Z(
|
|
2668
|
+
}, [Z(mr, u.value.applyLink)]),
|
|
2669
2669
|
H("span", {
|
|
2670
2670
|
class: "markweave-floating-toolbar-link-divider",
|
|
2671
2671
|
"aria-hidden": "true"
|
|
@@ -2676,15 +2676,15 @@ var Di = Y({
|
|
|
2676
2676
|
"aria-label": u.value.openLink,
|
|
2677
2677
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2678
2678
|
onMousedown: $,
|
|
2679
|
-
onClick: () =>
|
|
2680
|
-
}, [Z(
|
|
2679
|
+
onClick: () => Ci(n.value)
|
|
2680
|
+
}, [Z(vr, u.value.openLink)]),
|
|
2681
2681
|
H("button", {
|
|
2682
2682
|
type: "button",
|
|
2683
2683
|
"aria-label": u.value.removeLink,
|
|
2684
2684
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2685
2685
|
onMousedown: $,
|
|
2686
2686
|
onClick: g
|
|
2687
|
-
}, [Z(
|
|
2687
|
+
}, [Z(Zr, u.value.removeLink)])
|
|
2688
2688
|
])]) : t.value === "color" ? H("div", {
|
|
2689
2689
|
ref: c,
|
|
2690
2690
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
@@ -2711,11 +2711,11 @@ var Di = Y({
|
|
|
2711
2711
|
onClick: () => {
|
|
2712
2712
|
fe(e.editor, n), t.value = null;
|
|
2713
2713
|
}
|
|
2714
|
-
}, [Z(
|
|
2714
|
+
}, [Z(wi[n], u.value.moreActions[n])]), r.value === n ? H("div", {
|
|
2715
2715
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2716
2716
|
role: "tooltip"
|
|
2717
2717
|
}, u.value.moreActions[n]) : null]))) : null;
|
|
2718
|
-
return () => H(
|
|
2718
|
+
return () => H(R, {
|
|
2719
2719
|
editor: e.editor,
|
|
2720
2720
|
shouldShow: ({ editor: e }) => e.isEditable && be(ve(e)),
|
|
2721
2721
|
options: { placement: "top" }
|
|
@@ -2729,23 +2729,23 @@ var Di = Y({
|
|
|
2729
2729
|
class: "markweave-floating-toolbar-content",
|
|
2730
2730
|
"data-menu": t.value ?? "none"
|
|
2731
2731
|
}, [
|
|
2732
|
-
S("block-type", u.value.buttons["block-type"],
|
|
2732
|
+
S("block-type", u.value.buttons["block-type"], Qr, () => _("block-type"), t.value === "block-type"),
|
|
2733
2733
|
C(),
|
|
2734
|
-
S("bold", u.value.buttons.bold,
|
|
2735
|
-
S("italic", u.value.buttons.italic,
|
|
2736
|
-
S("underline", u.value.buttons.underline,
|
|
2737
|
-
S("strike", u.value.buttons.strike,
|
|
2738
|
-
S("inline-code", u.value.buttons["inline-code"],
|
|
2734
|
+
S("bold", u.value.buttons.bold, ar, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2735
|
+
S("italic", u.value.buttons.italic, Dr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2736
|
+
S("underline", u.value.buttons.underline, $r, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2737
|
+
S("strike", u.value.buttons.strike, Wr, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2738
|
+
S("inline-code", u.value.buttons["inline-code"], pr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2739
2739
|
C(),
|
|
2740
|
-
S("link", u.value.buttons.link,
|
|
2741
|
-
S("color", u.value.buttons.color,
|
|
2740
|
+
S("link", u.value.buttons.link, kr, () => _("link"), e.editor.isActive("link")),
|
|
2741
|
+
S("color", u.value.buttons.color, Qr, () => _("color"), t.value === "color"),
|
|
2742
2742
|
C(),
|
|
2743
|
-
S("more", u.value.buttons.more,
|
|
2743
|
+
S("more", u.value.buttons.more, Pr, () => _("more"), t.value === "more"),
|
|
2744
2744
|
T(),
|
|
2745
2745
|
x()
|
|
2746
2746
|
])]) });
|
|
2747
2747
|
}
|
|
2748
|
-
}),
|
|
2748
|
+
}), Ai = Y({
|
|
2749
2749
|
name: "MarkweaveVueMathEditorPopover",
|
|
2750
2750
|
props: {
|
|
2751
2751
|
editor: {
|
|
@@ -2798,7 +2798,7 @@ var Di = Y({
|
|
|
2798
2798
|
};
|
|
2799
2799
|
return K(() => [e.target.pos, e.target.latex], () => {
|
|
2800
2800
|
t.value = e.target.latex, a.value = _t(e.editor, e.target), J(u);
|
|
2801
|
-
}),
|
|
2801
|
+
}), Rn(() => {
|
|
2802
2802
|
St(e.editor, e.target, !0), u(), J(() => {
|
|
2803
2803
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2804
2804
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
@@ -2864,14 +2864,14 @@ var Di = Y({
|
|
|
2864
2864
|
}, [
|
|
2865
2865
|
H("div", { class: "markweave-math-block-toolbar" }, [
|
|
2866
2866
|
H("span", null, c.value.label),
|
|
2867
|
-
Z(
|
|
2867
|
+
Z(pr, c.value.label, 15, 1.75),
|
|
2868
2868
|
H("button", {
|
|
2869
2869
|
type: "submit",
|
|
2870
2870
|
title: c.value.apply,
|
|
2871
2871
|
"aria-label": c.value.apply,
|
|
2872
2872
|
disabled: !s.value,
|
|
2873
2873
|
"data-testid": "markweave-math-editor-apply"
|
|
2874
|
-
}, [Z(
|
|
2874
|
+
}, [Z(cr, c.value.apply, 16, 2)])
|
|
2875
2875
|
]),
|
|
2876
2876
|
H("label", {
|
|
2877
2877
|
class: "markweave-math-block-source",
|
|
@@ -2894,7 +2894,7 @@ var Di = Y({
|
|
|
2894
2894
|
]);
|
|
2895
2895
|
};
|
|
2896
2896
|
}
|
|
2897
|
-
}),
|
|
2897
|
+
}), ji = Y({
|
|
2898
2898
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2899
2899
|
props: {
|
|
2900
2900
|
commands: {
|
|
@@ -2953,13 +2953,13 @@ var Di = Y({
|
|
|
2953
2953
|
} : {
|
|
2954
2954
|
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
2955
2955
|
trigger: "slash-command",
|
|
2956
|
-
source:
|
|
2956
|
+
source: I(t.value)
|
|
2957
2957
|
};
|
|
2958
2958
|
if (!n.value && !t.value.trim()) {
|
|
2959
2959
|
r.value = e.messages.slash.uploadRequiredError;
|
|
2960
2960
|
return;
|
|
2961
2961
|
}
|
|
2962
|
-
let a = await
|
|
2962
|
+
let a = await L(i, e.onUpload);
|
|
2963
2963
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2964
2964
|
} catch (t) {
|
|
2965
2965
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -3103,7 +3103,7 @@ var Di = Y({
|
|
|
3103
3103
|
}
|
|
3104
3104
|
}
|
|
3105
3105
|
}, [
|
|
3106
|
-
|
|
3106
|
+
Ei(t.icon),
|
|
3107
3107
|
H("span", null, t.label),
|
|
3108
3108
|
t.disabledReason ? H("small", null, t.disabledReason) : null
|
|
3109
3109
|
]);
|
|
@@ -3114,33 +3114,33 @@ var Di = Y({
|
|
|
3114
3114
|
}, e.messages.slash.noResults)])]);
|
|
3115
3115
|
};
|
|
3116
3116
|
}
|
|
3117
|
-
}),
|
|
3118
|
-
"move-left":
|
|
3119
|
-
"move-right":
|
|
3120
|
-
"move-up":
|
|
3121
|
-
"move-down":
|
|
3122
|
-
"insert-left":
|
|
3123
|
-
"insert-right":
|
|
3124
|
-
"insert-above":
|
|
3125
|
-
"insert-below":
|
|
3126
|
-
"sort-asc":
|
|
3127
|
-
"sort-desc":
|
|
3128
|
-
color:
|
|
3129
|
-
alignment:
|
|
3130
|
-
clear:
|
|
3131
|
-
duplicate:
|
|
3132
|
-
copy:
|
|
3133
|
-
merge:
|
|
3134
|
-
split:
|
|
3135
|
-
delete:
|
|
3136
|
-
},
|
|
3137
|
-
left:
|
|
3138
|
-
center:
|
|
3139
|
-
right:
|
|
3140
|
-
top:
|
|
3141
|
-
middle:
|
|
3142
|
-
bottom:
|
|
3143
|
-
},
|
|
3117
|
+
}), Mi = {
|
|
3118
|
+
"move-left": Zn,
|
|
3119
|
+
"move-right": Qn,
|
|
3120
|
+
"move-up": $n,
|
|
3121
|
+
"move-down": Yn,
|
|
3122
|
+
"insert-left": ir,
|
|
3123
|
+
"insert-right": rr,
|
|
3124
|
+
"insert-above": nr,
|
|
3125
|
+
"insert-below": tr,
|
|
3126
|
+
"sort-asc": Xn,
|
|
3127
|
+
"sort-desc": er,
|
|
3128
|
+
color: Fr,
|
|
3129
|
+
alignment: Un,
|
|
3130
|
+
clear: Ur,
|
|
3131
|
+
duplicate: hr,
|
|
3132
|
+
copy: hr,
|
|
3133
|
+
merge: Jr,
|
|
3134
|
+
split: Yr,
|
|
3135
|
+
delete: Zr
|
|
3136
|
+
}, Ni = {
|
|
3137
|
+
left: Un,
|
|
3138
|
+
center: Vn,
|
|
3139
|
+
right: Wn,
|
|
3140
|
+
top: qn,
|
|
3141
|
+
middle: Gn,
|
|
3142
|
+
bottom: Kn
|
|
3143
|
+
}, Pi = Y({
|
|
3144
3144
|
name: "MarkweaveVueTableControls",
|
|
3145
3145
|
props: {
|
|
3146
3146
|
editor: {
|
|
@@ -3173,15 +3173,15 @@ var Di = Y({
|
|
|
3173
3173
|
}
|
|
3174
3174
|
},
|
|
3175
3175
|
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(
|
|
3177
|
-
|
|
3178
|
-
},
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
},
|
|
3182
|
-
},
|
|
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 ? Wt(e.editor.state) : vi), w = G(() => un(e.editor, e.interactionState, "row", C.value.activeCellPos)), T = G(() => un(e.editor, e.interactionState, "column", C.value.activeCellPos)), E = G(() => on(e.editor)), D = G(() => (E.value, C.value.active)), O = G(() => t.value ? hn(e.editor, t.value) : []), k = () => {
|
|
3177
|
+
b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
|
|
3178
|
+
}, A = (e) => {
|
|
3179
|
+
k(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
|
|
3180
|
+
d.value = null, b = null;
|
|
3181
|
+
}, xn));
|
|
3182
|
+
}, ee = () => {
|
|
3183
3183
|
if (!e.active) {
|
|
3184
|
-
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null,
|
|
3184
|
+
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, A(null);
|
|
3185
3185
|
return;
|
|
3186
3186
|
}
|
|
3187
3187
|
let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement;
|
|
@@ -3189,137 +3189,159 @@ var Di = Y({
|
|
|
3189
3189
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
|
|
3190
3190
|
return;
|
|
3191
3191
|
}
|
|
3192
|
-
let l = n.getBoundingClientRect(), u =
|
|
3193
|
-
u ? i.value =
|
|
3192
|
+
let l = n.getBoundingClientRect(), u = w.value ? ln(e.editor, w.value) : null, d = T.value ? ln(e.editor, T.value) : null, f = D.value ? gn(e.editor) : null, p = an(e.editor)?.getBoundingClientRect() ?? null;
|
|
3193
|
+
u ? i.value = $t({
|
|
3194
3194
|
targetRect: u,
|
|
3195
3195
|
frameRect: l,
|
|
3196
3196
|
kind: "row"
|
|
3197
|
-
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value =
|
|
3197
|
+
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = $t({
|
|
3198
3198
|
targetRect: d,
|
|
3199
3199
|
frameRect: l,
|
|
3200
3200
|
kind: "column"
|
|
3201
|
-
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value =
|
|
3201
|
+
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = $t({
|
|
3202
3202
|
targetRect: f,
|
|
3203
3203
|
frameRect: l,
|
|
3204
3204
|
kind: "selection"
|
|
3205
3205
|
}) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
|
|
3206
|
-
let m = e.interactionState.hoverCellPos !== null && !!(
|
|
3207
|
-
s.value = p && m ?
|
|
3206
|
+
let m = e.interactionState.hoverCellPos !== null && !!(w.value && w.value.index === w.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(T.value && T.value.index === T.value.visualWidth - 1);
|
|
3207
|
+
s.value = p && m ? en({
|
|
3208
3208
|
tableRect: p,
|
|
3209
3209
|
frameRect: l,
|
|
3210
3210
|
kind: "row"
|
|
3211
|
-
}) : null, c.value = p && h ?
|
|
3211
|
+
}) : null, c.value = p && h ? en({
|
|
3212
3212
|
tableRect: p,
|
|
3213
3213
|
frameRect: l,
|
|
3214
3214
|
kind: "column"
|
|
3215
3215
|
}) : null;
|
|
3216
|
-
},
|
|
3216
|
+
}, j = () => {
|
|
3217
3217
|
if (!e.active || !t.value) {
|
|
3218
3218
|
l.value = null;
|
|
3219
3219
|
return;
|
|
3220
3220
|
}
|
|
3221
|
-
let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = r.value === "row-edge" ?
|
|
3222
|
-
if (!n || !i || !
|
|
3221
|
+
let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = r.value === "row-edge" ? m.value : r.value === "column-edge" ? h.value : g.value;
|
|
3222
|
+
if (!n || !i || !_.value) {
|
|
3223
3223
|
l.value = null;
|
|
3224
3224
|
return;
|
|
3225
3225
|
}
|
|
3226
|
-
let a = i.getBoundingClientRect(), o = t.value === "row" ?
|
|
3226
|
+
let a = i.getBoundingClientRect(), o = t.value === "row" ? an(e.editor)?.getBoundingClientRect() : null, s = o ? {
|
|
3227
3227
|
left: a.left,
|
|
3228
3228
|
top: o.top,
|
|
3229
3229
|
width: a.width,
|
|
3230
3230
|
height: a.height
|
|
3231
|
-
} : a, c = n.getBoundingClientRect(), u =
|
|
3231
|
+
} : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
|
|
3232
3232
|
l.value = Zt({
|
|
3233
3233
|
anchorRect: s,
|
|
3234
3234
|
frameRect: c,
|
|
3235
|
+
boundaryRect: fn(n),
|
|
3235
3236
|
menuSize: {
|
|
3236
3237
|
width: u.width || 254,
|
|
3237
|
-
height: u.height || 410
|
|
3238
|
+
height: f || u.height || 410
|
|
3238
3239
|
},
|
|
3239
3240
|
kind: t.value
|
|
3240
3241
|
});
|
|
3241
|
-
},
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
let
|
|
3247
|
-
r
|
|
3242
|
+
}, M = () => {
|
|
3243
|
+
if (!e.active || !t.value || !n.value || !l.value) {
|
|
3244
|
+
u.value = null;
|
|
3245
|
+
return;
|
|
3246
|
+
}
|
|
3247
|
+
let r = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = _.value?.querySelector(`[data-submenu-trigger="${n.value}"]`);
|
|
3248
|
+
if (!r || !_.value || !y.value || !i) {
|
|
3249
|
+
u.value = null;
|
|
3250
|
+
return;
|
|
3251
|
+
}
|
|
3252
|
+
let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
|
|
3253
|
+
u.value = Qt({
|
|
3254
|
+
triggerRect: i.getBoundingClientRect(),
|
|
3255
|
+
parentMenuRect: _.value.getBoundingClientRect(),
|
|
3256
|
+
boundaryRect: fn(r),
|
|
3257
|
+
submenuSize: {
|
|
3258
|
+
width: a.width || 238,
|
|
3259
|
+
height: o || 410
|
|
3260
|
+
}
|
|
3261
|
+
});
|
|
3248
3262
|
}, N = () => {
|
|
3263
|
+
ee(), j(), M();
|
|
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();
|
|
3269
|
+
}, I = () => {
|
|
3249
3270
|
e.editor.view.dispatch(Vt(e.editor.state.tr, null));
|
|
3250
|
-
},
|
|
3251
|
-
let r = e.interactionState.hoverCellPos ??
|
|
3252
|
-
r !== null &&
|
|
3253
|
-
},
|
|
3254
|
-
|
|
3255
|
-
},
|
|
3256
|
-
t.value = null, n.value = null, l.value = null, r && e.editor.view.focus();
|
|
3257
|
-
},
|
|
3258
|
-
let i = await
|
|
3271
|
+
}, te = (t, n) => {
|
|
3272
|
+
let r = e.interactionState.hoverCellPos ?? C.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
3273
|
+
r !== null && yn(e.editor, r, t, { visualIndex: i }), F(t, n);
|
|
3274
|
+
}, L = () => {
|
|
3275
|
+
I(), F("selection", "selection-edge");
|
|
3276
|
+
}, R = (r = !1) => {
|
|
3277
|
+
t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
|
|
3278
|
+
}, ne = async (n, r) => {
|
|
3279
|
+
let i = await nn({
|
|
3259
3280
|
editor: e.editor,
|
|
3260
3281
|
commandId: n,
|
|
3261
3282
|
menu: r ?? t.value ?? "selection",
|
|
3262
3283
|
messages: e.messages
|
|
3263
3284
|
});
|
|
3264
|
-
return i.copyFeedback ? (
|
|
3265
|
-
},
|
|
3266
|
-
let n =
|
|
3267
|
-
n && e.onEditWithAi?.(n),
|
|
3268
|
-
},
|
|
3269
|
-
t.value !== "row" && t.value !== "column" || e(t.value) && (
|
|
3270
|
-
},
|
|
3271
|
-
let n = t === "row" ?
|
|
3272
|
-
!n || r === null ||
|
|
3273
|
-
},
|
|
3274
|
-
|
|
3285
|
+
return i.copyFeedback ? (A(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : A(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
3286
|
+
}, re = (t) => {
|
|
3287
|
+
let n = dn(e.editor, t);
|
|
3288
|
+
n && e.onEditWithAi?.(n), R(!0);
|
|
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);
|
|
3294
|
+
}, ie = (e, t, n) => {
|
|
3295
|
+
x = {
|
|
3275
3296
|
axis: e,
|
|
3276
3297
|
index: t
|
|
3277
|
-
},
|
|
3278
|
-
},
|
|
3279
|
-
if (!
|
|
3280
|
-
let n =
|
|
3281
|
-
n !== null && (t.preventDefault(),
|
|
3282
|
-
},
|
|
3283
|
-
let n =
|
|
3298
|
+
}, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
|
|
3299
|
+
}, ae = (t) => {
|
|
3300
|
+
if (!x) return;
|
|
3301
|
+
let n = sn(e.editor, x.axis, t.clientX, t.clientY);
|
|
3302
|
+
n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
|
|
3303
|
+
}, oe = (t) => {
|
|
3304
|
+
let n = x;
|
|
3284
3305
|
if (!n) return;
|
|
3285
|
-
let r =
|
|
3286
|
-
t.preventDefault(),
|
|
3287
|
-
}, V = G(() => (
|
|
3306
|
+
let r = sn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
|
|
3307
|
+
t.preventDefault(), x = null, S = null, r !== null && vn(e.editor, n.axis, n.index, r);
|
|
3308
|
+
}, V = G(() => (f.value, t.value === "row" || t.value === "column" ? cn(e.editor, t.value) : null)), se = (e) => {
|
|
3288
3309
|
if (!(!t.value || e.key !== "Escape")) {
|
|
3289
3310
|
if (n.value) {
|
|
3290
3311
|
n.value = null;
|
|
3291
3312
|
return;
|
|
3292
3313
|
}
|
|
3293
|
-
|
|
3314
|
+
R(!0);
|
|
3294
3315
|
}
|
|
3295
|
-
},
|
|
3316
|
+
}, ce = (e) => {
|
|
3296
3317
|
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
3297
3318
|
let t = e.currentTarget;
|
|
3298
3319
|
if (!(t instanceof HTMLElement)) return;
|
|
3299
|
-
let n = Array.from(
|
|
3300
|
-
e.preventDefault(), e.stopPropagation(),
|
|
3301
|
-
},
|
|
3302
|
-
t.value && (e.target instanceof Node &&
|
|
3320
|
+
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
|
+
e.preventDefault(), e.stopPropagation(), r[o]?.focus();
|
|
3322
|
+
}, le = (e) => {
|
|
3323
|
+
t.value && (e.target instanceof Node && p.value?.contains(e.target) || R());
|
|
3303
3324
|
};
|
|
3304
|
-
|
|
3305
|
-
|
|
3325
|
+
Rn(() => {
|
|
3326
|
+
N(), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), document.addEventListener("keydown", se), document.addEventListener("mousedown", le), document.addEventListener("dragover", ae), document.addEventListener("drop", oe);
|
|
3306
3327
|
}), q(() => {
|
|
3307
|
-
|
|
3328
|
+
k(), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0), document.removeEventListener("keydown", se), document.removeEventListener("mousedown", le), document.removeEventListener("dragover", ae), document.removeEventListener("drop", oe);
|
|
3308
3329
|
}), K(() => [
|
|
3309
3330
|
e.active,
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3331
|
+
C.value.activeCellPos,
|
|
3332
|
+
C.value.selectionFrom,
|
|
3333
|
+
C.value.selectionTo,
|
|
3313
3334
|
e.interactionState.hoverCellPos,
|
|
3314
3335
|
e.interactionState.hoverVisualColumnIndex,
|
|
3315
3336
|
e.interactionState.hoverVisualRowIndex,
|
|
3316
3337
|
t.value,
|
|
3338
|
+
n.value,
|
|
3317
3339
|
r.value
|
|
3318
|
-
],
|
|
3319
|
-
let
|
|
3340
|
+
], P, { flush: "post" });
|
|
3341
|
+
let ue = () => {
|
|
3320
3342
|
if (!t.value) return null;
|
|
3321
|
-
let r =
|
|
3322
|
-
let a =
|
|
3343
|
+
let r = O.value.map((r, i) => {
|
|
3344
|
+
let a = pn(r), o = i === 0 ? a : pn(O.value[i - 1]), s = i > 0 && o !== a, c = r.submenuId ? !0 : r.commandId === null ? !!e.onEditWithAi : tn(e.editor, r.commandId), l = mn(r, e.messages), u = Mi[r.icon];
|
|
3323
3345
|
return H("button", {
|
|
3324
3346
|
key: `${r.id}-${i}`,
|
|
3325
3347
|
type: "button",
|
|
@@ -3345,10 +3367,10 @@ var Di = Y({
|
|
|
3345
3367
|
return;
|
|
3346
3368
|
}
|
|
3347
3369
|
if (r.commandId === null) {
|
|
3348
|
-
|
|
3370
|
+
re(t.value === "row" || t.value === "column" ? t.value : "selection");
|
|
3349
3371
|
return;
|
|
3350
3372
|
}
|
|
3351
|
-
|
|
3373
|
+
ne(r.commandId).finally(() => R());
|
|
3352
3374
|
}
|
|
3353
3375
|
}
|
|
3354
3376
|
}, [
|
|
@@ -3360,22 +3382,34 @@ var Di = Y({
|
|
|
3360
3382
|
strokeWidth: 1.8
|
|
3361
3383
|
})]),
|
|
3362
3384
|
H("span", { class: "markweave-table-menu-item-label" }, l),
|
|
3363
|
-
r.submenuId ? H(
|
|
3385
|
+
r.submenuId ? H(ur, {
|
|
3364
3386
|
class: "markweave-table-menu-chevron",
|
|
3365
3387
|
size: 16,
|
|
3366
3388
|
"aria-hidden": "true"
|
|
3367
3389
|
}) : null
|
|
3368
3390
|
]);
|
|
3369
|
-
})
|
|
3370
|
-
|
|
3391
|
+
}), i = [H("div", {
|
|
3392
|
+
ref: v,
|
|
3393
|
+
class: "markweave-table-menu-scroll",
|
|
3394
|
+
style: l.value ? { maxHeight: `${Math.max(1, l.value.maxHeight - 12)}px` } : void 0
|
|
3395
|
+
}, r)];
|
|
3396
|
+
if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(H("div", {
|
|
3397
|
+
ref: y,
|
|
3371
3398
|
class: "markweave-table-submenu markweave-table-color-menu",
|
|
3372
3399
|
role: "menu",
|
|
3373
3400
|
"aria-label": e.messages.table.submenus.color,
|
|
3374
3401
|
"data-testid": "markweave-table-color-menu",
|
|
3375
|
-
|
|
3402
|
+
"data-positioned": u.value ? "true" : "false",
|
|
3403
|
+
"data-placement": u.value?.placement,
|
|
3404
|
+
style: u.value ? {
|
|
3405
|
+
left: `${u.value.left}px`,
|
|
3406
|
+
top: `${u.value.top}px`,
|
|
3407
|
+
maxHeight: `${u.value.maxHeight}px`
|
|
3408
|
+
} : void 0,
|
|
3409
|
+
onKeydown: ce
|
|
3376
3410
|
}, [
|
|
3377
3411
|
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
|
|
3378
|
-
...
|
|
3412
|
+
...bn.map((t) => H("button", {
|
|
3379
3413
|
key: `text-${t.id}`,
|
|
3380
3414
|
type: "button",
|
|
3381
3415
|
role: "menuitemradio",
|
|
@@ -3383,7 +3417,7 @@ var Di = Y({
|
|
|
3383
3417
|
"data-active": V.value?.textColorId === t.id ? "true" : "false",
|
|
3384
3418
|
"data-testid": `markweave-table-text-color-${t.id}`,
|
|
3385
3419
|
onMousedown: $,
|
|
3386
|
-
onClick: () =>
|
|
3420
|
+
onClick: () => z((n) => Xt(e.editor, n, t.id))
|
|
3387
3421
|
}, [H("span", {
|
|
3388
3422
|
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3389
3423
|
"aria-hidden": "true",
|
|
@@ -3391,7 +3425,7 @@ var Di = Y({
|
|
|
3391
3425
|
}), H("span", null, e.messages.table.colors[t.id].text)])),
|
|
3392
3426
|
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3393
3427
|
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
|
|
3394
|
-
...
|
|
3428
|
+
...bn.map((t) => H("button", {
|
|
3395
3429
|
key: `background-${t.id}`,
|
|
3396
3430
|
type: "button",
|
|
3397
3431
|
role: "menuitemradio",
|
|
@@ -3399,7 +3433,7 @@ var Di = Y({
|
|
|
3399
3433
|
"data-active": V.value?.backgroundColorId === t.id ? "true" : "false",
|
|
3400
3434
|
"data-testid": `markweave-table-background-color-${t.id}`,
|
|
3401
3435
|
onMousedown: $,
|
|
3402
|
-
onClick: () =>
|
|
3436
|
+
onClick: () => z((n) => Yt(e.editor, n, t.id))
|
|
3403
3437
|
}, [H("span", {
|
|
3404
3438
|
class: "markweave-table-color-swatch",
|
|
3405
3439
|
"aria-hidden": "true",
|
|
@@ -3407,7 +3441,7 @@ var Di = Y({
|
|
|
3407
3441
|
}), H("span", null, e.messages.table.colors[t.id].background)]))
|
|
3408
3442
|
])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
|
|
3409
3443
|
let t = (t, n) => {
|
|
3410
|
-
let r =
|
|
3444
|
+
let r = Ni[t];
|
|
3411
3445
|
return H("button", {
|
|
3412
3446
|
key: t,
|
|
3413
3447
|
type: "button",
|
|
@@ -3416,42 +3450,51 @@ var Di = Y({
|
|
|
3416
3450
|
"data-active": n ? "true" : "false",
|
|
3417
3451
|
"data-testid": `markweave-table-alignment-${t}`,
|
|
3418
3452
|
onMousedown: $,
|
|
3419
|
-
onClick: () =>
|
|
3453
|
+
onClick: () => z((n) => Jt(e.editor, n, t))
|
|
3420
3454
|
}, [H(r, {
|
|
3421
3455
|
size: 18,
|
|
3422
3456
|
strokeWidth: 1.8,
|
|
3423
3457
|
"aria-hidden": "true"
|
|
3424
3458
|
}), H("span", null, e.messages.table.alignments[t])]);
|
|
3425
3459
|
};
|
|
3426
|
-
|
|
3460
|
+
i.push(H("div", {
|
|
3461
|
+
ref: y,
|
|
3427
3462
|
class: "markweave-table-submenu markweave-table-alignment-menu",
|
|
3428
3463
|
role: "menu",
|
|
3429
3464
|
"aria-label": e.messages.table.submenus.alignment,
|
|
3430
3465
|
"data-testid": "markweave-table-alignment-menu",
|
|
3431
|
-
|
|
3466
|
+
"data-positioned": u.value ? "true" : "false",
|
|
3467
|
+
"data-placement": u.value?.placement,
|
|
3468
|
+
style: u.value ? {
|
|
3469
|
+
left: `${u.value.left}px`,
|
|
3470
|
+
top: `${u.value.top}px`,
|
|
3471
|
+
maxHeight: `${u.value.maxHeight}px`
|
|
3472
|
+
} : void 0,
|
|
3473
|
+
onKeydown: ce
|
|
3432
3474
|
}, [
|
|
3433
|
-
...
|
|
3475
|
+
...Sn.map((e) => t(e, V.value?.textAlign === e)),
|
|
3434
3476
|
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3435
|
-
...
|
|
3477
|
+
...wn.map((e) => t(e, V.value?.verticalAlign === e))
|
|
3436
3478
|
]));
|
|
3437
3479
|
}
|
|
3438
3480
|
return H("div", {
|
|
3439
|
-
ref:
|
|
3481
|
+
ref: _,
|
|
3440
3482
|
class: "markweave-table-menu",
|
|
3441
3483
|
role: "menu",
|
|
3442
|
-
"aria-label":
|
|
3484
|
+
"aria-label": Cn(t.value, e.messages),
|
|
3443
3485
|
"data-testid": "markweave-table-menu",
|
|
3444
3486
|
"data-positioned": l.value ? "true" : "false",
|
|
3487
|
+
"data-placement": l.value?.placement,
|
|
3445
3488
|
"data-submenu": n.value ?? "none",
|
|
3446
3489
|
style: l.value ? {
|
|
3447
3490
|
left: `${l.value.left}px`,
|
|
3448
3491
|
top: `${l.value.top}px`
|
|
3449
3492
|
} : void 0,
|
|
3450
|
-
onKeydown:
|
|
3451
|
-
},
|
|
3493
|
+
onKeydown: ce
|
|
3494
|
+
}, i);
|
|
3452
3495
|
};
|
|
3453
3496
|
return () => e.active ? H("div", {
|
|
3454
|
-
ref:
|
|
3497
|
+
ref: p,
|
|
3455
3498
|
class: "markweave-table-controls",
|
|
3456
3499
|
"data-testid": "markweave-table-controls",
|
|
3457
3500
|
"aria-label": e.messages.table.controlsAriaLabel,
|
|
@@ -3459,17 +3502,17 @@ var Di = Y({
|
|
|
3459
3502
|
"data-positioned": i.value || a.value || o.value ? "true" : "false",
|
|
3460
3503
|
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(qt, { type: "clear-hover" }))
|
|
3461
3504
|
}, [
|
|
3462
|
-
|
|
3505
|
+
d.value ? H("div", {
|
|
3463
3506
|
class: "markweave-table-copy-feedback",
|
|
3464
3507
|
role: "status",
|
|
3465
3508
|
"aria-live": "polite",
|
|
3466
3509
|
"data-testid": "markweave-table-copy-feedback",
|
|
3467
|
-
"data-copy-kind":
|
|
3468
|
-
"data-text-length":
|
|
3469
|
-
"data-html-length":
|
|
3470
|
-
},
|
|
3510
|
+
"data-copy-kind": d.value.kind,
|
|
3511
|
+
"data-text-length": d.value.textLength,
|
|
3512
|
+
"data-html-length": d.value.htmlLength
|
|
3513
|
+
}, rn(d.value)) : null,
|
|
3471
3514
|
i.value ? H("button", {
|
|
3472
|
-
ref:
|
|
3515
|
+
ref: m,
|
|
3473
3516
|
type: "button",
|
|
3474
3517
|
draggable: !0,
|
|
3475
3518
|
class: "markweave-table-edge-handle markweave-table-edge-handle--row",
|
|
@@ -3478,10 +3521,10 @@ var Di = Y({
|
|
|
3478
3521
|
"aria-haspopup": "menu",
|
|
3479
3522
|
title: e.messages.table.rowActions,
|
|
3480
3523
|
"data-testid": "markweave-table-hover-row-handle",
|
|
3481
|
-
"data-axis-index":
|
|
3482
|
-
"data-axis-selected-cells":
|
|
3483
|
-
"data-axis-visual-cells":
|
|
3484
|
-
"data-axis-visual-size":
|
|
3524
|
+
"data-axis-index": w.value?.index ?? "",
|
|
3525
|
+
"data-axis-selected-cells": w.value?.selectedCellCount ?? "",
|
|
3526
|
+
"data-axis-visual-cells": w.value?.visualCellCount ?? "",
|
|
3527
|
+
"data-axis-visual-size": w.value?.visualHeight ?? "",
|
|
3485
3528
|
style: {
|
|
3486
3529
|
left: `${i.value.left}px`,
|
|
3487
3530
|
top: `${i.value.top}px`,
|
|
@@ -3489,17 +3532,17 @@ var Di = Y({
|
|
|
3489
3532
|
height: `${i.value.height}px`
|
|
3490
3533
|
},
|
|
3491
3534
|
onMousedown: $,
|
|
3492
|
-
onClick: () =>
|
|
3493
|
-
onDragstart: (e) =>
|
|
3535
|
+
onClick: () => te("row", "row-edge"),
|
|
3536
|
+
onDragstart: (e) => ie("row", w.value?.index ?? 0, e),
|
|
3494
3537
|
onDragend: () => {
|
|
3495
|
-
|
|
3538
|
+
x = null, S = null;
|
|
3496
3539
|
}
|
|
3497
|
-
}, [H(
|
|
3540
|
+
}, [H(Pr, {
|
|
3498
3541
|
size: 14,
|
|
3499
3542
|
"aria-hidden": "true"
|
|
3500
3543
|
})]) : null,
|
|
3501
3544
|
a.value ? H("button", {
|
|
3502
|
-
ref:
|
|
3545
|
+
ref: h,
|
|
3503
3546
|
type: "button",
|
|
3504
3547
|
draggable: !0,
|
|
3505
3548
|
class: "markweave-table-edge-handle markweave-table-edge-handle--column",
|
|
@@ -3508,10 +3551,10 @@ var Di = Y({
|
|
|
3508
3551
|
"aria-haspopup": "menu",
|
|
3509
3552
|
title: e.messages.table.columnActions,
|
|
3510
3553
|
"data-testid": "markweave-table-hover-column-handle",
|
|
3511
|
-
"data-axis-index":
|
|
3512
|
-
"data-axis-selected-cells":
|
|
3513
|
-
"data-axis-visual-cells":
|
|
3514
|
-
"data-axis-visual-size":
|
|
3554
|
+
"data-axis-index": T.value?.index ?? "",
|
|
3555
|
+
"data-axis-selected-cells": T.value?.selectedCellCount ?? "",
|
|
3556
|
+
"data-axis-visual-cells": T.value?.visualCellCount ?? "",
|
|
3557
|
+
"data-axis-visual-size": T.value?.visualWidth ?? "",
|
|
3515
3558
|
style: {
|
|
3516
3559
|
left: `${a.value.left}px`,
|
|
3517
3560
|
top: `${a.value.top}px`,
|
|
@@ -3519,17 +3562,17 @@ var Di = Y({
|
|
|
3519
3562
|
height: `${a.value.height}px`
|
|
3520
3563
|
},
|
|
3521
3564
|
onMousedown: $,
|
|
3522
|
-
onClick: () =>
|
|
3523
|
-
onDragstart: (e) =>
|
|
3565
|
+
onClick: () => te("column", "column-edge"),
|
|
3566
|
+
onDragstart: (e) => ie("column", T.value?.index ?? 0, e),
|
|
3524
3567
|
onDragend: () => {
|
|
3525
|
-
|
|
3568
|
+
x = null, S = null;
|
|
3526
3569
|
}
|
|
3527
|
-
}, [H(
|
|
3570
|
+
}, [H(Pr, {
|
|
3528
3571
|
size: 14,
|
|
3529
3572
|
"aria-hidden": "true"
|
|
3530
3573
|
})]) : null,
|
|
3531
|
-
|
|
3532
|
-
ref:
|
|
3574
|
+
D.value && o.value ? H("button", {
|
|
3575
|
+
ref: g,
|
|
3533
3576
|
type: "button",
|
|
3534
3577
|
class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
3535
3578
|
"aria-label": e.messages.table.selectionActions,
|
|
@@ -3544,8 +3587,8 @@ var Di = Y({
|
|
|
3544
3587
|
height: `${o.value.height}px`
|
|
3545
3588
|
},
|
|
3546
3589
|
onMousedown: $,
|
|
3547
|
-
onClick:
|
|
3548
|
-
}, [H(
|
|
3590
|
+
onClick: L
|
|
3591
|
+
}, [H(Pr, {
|
|
3549
3592
|
size: 14,
|
|
3550
3593
|
"aria-hidden": "true"
|
|
3551
3594
|
})]) : null,
|
|
@@ -3562,8 +3605,8 @@ var Di = Y({
|
|
|
3562
3605
|
height: `${s.value.height}px`
|
|
3563
3606
|
},
|
|
3564
3607
|
onMousedown: $,
|
|
3565
|
-
onClick: () =>
|
|
3566
|
-
}, [H(
|
|
3608
|
+
onClick: () => B("row")
|
|
3609
|
+
}, [H(Rr, {
|
|
3567
3610
|
size: 14,
|
|
3568
3611
|
"aria-hidden": "true"
|
|
3569
3612
|
})]) : null,
|
|
@@ -3580,15 +3623,15 @@ var Di = Y({
|
|
|
3580
3623
|
height: `${c.value.height}px`
|
|
3581
3624
|
},
|
|
3582
3625
|
onMousedown: $,
|
|
3583
|
-
onClick: () =>
|
|
3584
|
-
}, [H(
|
|
3626
|
+
onClick: () => B("column")
|
|
3627
|
+
}, [H(Rr, {
|
|
3585
3628
|
size: 14,
|
|
3586
3629
|
"aria-hidden": "true"
|
|
3587
3630
|
})]) : null,
|
|
3588
|
-
|
|
3631
|
+
ue()
|
|
3589
3632
|
]) : null;
|
|
3590
3633
|
}
|
|
3591
|
-
}),
|
|
3634
|
+
}), Fi = Y({
|
|
3592
3635
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
3593
3636
|
props: {
|
|
3594
3637
|
editor: {
|
|
@@ -3606,9 +3649,9 @@ var Di = Y({
|
|
|
3606
3649
|
t.value = null;
|
|
3607
3650
|
return;
|
|
3608
3651
|
}
|
|
3609
|
-
t.value =
|
|
3652
|
+
t.value = _n(e.editor, Gt(e.editor.state));
|
|
3610
3653
|
};
|
|
3611
|
-
return
|
|
3654
|
+
return Rn(() => {
|
|
3612
3655
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
3613
3656
|
}), q(() => {
|
|
3614
3657
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
@@ -3626,6 +3669,7 @@ var Di = Y({
|
|
|
3626
3669
|
return e ? H("div", {
|
|
3627
3670
|
"aria-hidden": "true",
|
|
3628
3671
|
class: "markweave-table-selection-overlay",
|
|
3672
|
+
"data-axis-target": e.axisTarget ?? "none",
|
|
3629
3673
|
"data-anchor-cell-pos": e.anchorCellPos ?? "",
|
|
3630
3674
|
"data-head-cell-pos": e.headCellPos ?? "",
|
|
3631
3675
|
"data-selected-cells": e.selectedCellCount,
|
|
@@ -3644,7 +3688,7 @@ var Di = Y({
|
|
|
3644
3688
|
}) : null;
|
|
3645
3689
|
};
|
|
3646
3690
|
}
|
|
3647
|
-
}),
|
|
3691
|
+
}), Ii = Y({
|
|
3648
3692
|
name: "MarkweaveVueCodeBlockControls",
|
|
3649
3693
|
props: {
|
|
3650
3694
|
editor: {
|
|
@@ -3681,38 +3725,38 @@ var Di = Y({
|
|
|
3681
3725
|
...e.state,
|
|
3682
3726
|
pos: e.state.pos,
|
|
3683
3727
|
active: !0
|
|
3684
|
-
} : null), T = G(() => C.value ?? w.value), E = G(() => T.value !== null), D = G(() => T.value?.language === "mermaid"), O = G(() => ot(e.editor, T.value)), k = G(() => E.value && T.value !== null && !O.value), A = G(() => !e.readOnly),
|
|
3728
|
+
} : null), T = G(() => C.value ?? w.value), E = G(() => T.value !== null), D = G(() => T.value?.language === "mermaid"), O = G(() => ot(e.editor, T.value)), k = G(() => E.value && T.value !== null && !O.value), A = G(() => !e.readOnly), ee = G(() => T.value ? Je(T.value.language) : Je("text")), j = G(() => p.value?.status ?? "idle"), M = G(() => T.value?.mermaidPreviewMode ?? e.mermaidMode), N = G(() => D.value && M.value === "preview"), P = G(() => (x.value, y.value, b.value, it(e.editor))), F = G(() => `${b.value}|${P.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), I = G(() => Qe(d.value)), te = G(() => T.value ? `${T.value.pos}:${T.value.language}:${T.value.text}` : "none"), L = () => {
|
|
3685
3729
|
S !== null && (window.clearTimeout(S), S = null);
|
|
3686
|
-
},
|
|
3687
|
-
|
|
3730
|
+
}, R = (e) => {
|
|
3731
|
+
L(), p.value = e, e && (S = window.setTimeout(() => {
|
|
3688
3732
|
p.value = null, S = null;
|
|
3689
3733
|
}, Ve));
|
|
3690
|
-
},
|
|
3734
|
+
}, ne = () => {
|
|
3691
3735
|
h.value = null, g.value = null, _.value = !1, v.value = {
|
|
3692
3736
|
active: !1,
|
|
3693
3737
|
lastX: 0,
|
|
3694
3738
|
lastY: 0
|
|
3695
3739
|
}, e.editor.view.focus();
|
|
3696
|
-
},
|
|
3740
|
+
}, z = () => {
|
|
3697
3741
|
let n = t.value;
|
|
3698
3742
|
if (!n) return;
|
|
3699
|
-
if (!nt(n) ||
|
|
3743
|
+
if (!nt(n) || P.value.length === 0) {
|
|
3700
3744
|
c.value = [];
|
|
3701
3745
|
return;
|
|
3702
3746
|
}
|
|
3703
|
-
let r = n.getBoundingClientRect(), i =
|
|
3747
|
+
let r = n.getBoundingClientRect(), i = P.value.flatMap((t) => {
|
|
3704
3748
|
let n = Ze(Xe(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
3705
3749
|
return n ? [Ke(t, n, r)] : [];
|
|
3706
3750
|
});
|
|
3707
|
-
c.value = st(c.value, i,
|
|
3708
|
-
},
|
|
3751
|
+
c.value = st(c.value, i, P.value.map((e) => e.pos));
|
|
3752
|
+
}, B = () => {
|
|
3709
3753
|
if (!k.value || !T.value) {
|
|
3710
3754
|
s.value = null, l.value = null;
|
|
3711
3755
|
return;
|
|
3712
3756
|
}
|
|
3713
3757
|
let r = t.value;
|
|
3714
3758
|
if (!r) return;
|
|
3715
|
-
let i = Xe(e.editor, T.value.pos,
|
|
3759
|
+
let i = Xe(e.editor, T.value.pos, M.value), a = r.getBoundingClientRect(), o = Ze(i, a);
|
|
3716
3760
|
if (!o) {
|
|
3717
3761
|
s.value = s.value?.pos === T.value.pos ? s.value : null, l.value = u.value ? l.value : null;
|
|
3718
3762
|
return;
|
|
@@ -3726,41 +3770,41 @@ var Di = Y({
|
|
|
3726
3770
|
windowHeight: window.innerHeight
|
|
3727
3771
|
});
|
|
3728
3772
|
}
|
|
3729
|
-
},
|
|
3773
|
+
}, ie = async () => {
|
|
3730
3774
|
if (e.readOnly) {
|
|
3731
3775
|
if (!T.value) return;
|
|
3732
3776
|
let e = await He(T.value.text);
|
|
3733
|
-
|
|
3777
|
+
R(Pe(T.value, e ? "copied" : "failed"));
|
|
3734
3778
|
return;
|
|
3735
3779
|
}
|
|
3736
3780
|
if (!qe(e.editor, T.value)) return;
|
|
3737
3781
|
let t = await Me(e.editor);
|
|
3738
|
-
|
|
3739
|
-
},
|
|
3782
|
+
R(Pe(Ne(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
3783
|
+
}, ae = (t, n) => {
|
|
3740
3784
|
if (e.readOnly) {
|
|
3741
3785
|
Ot(e.editor, t.pos, n) && (b.value += 1, x.value += 1);
|
|
3742
3786
|
return;
|
|
3743
3787
|
}
|
|
3744
3788
|
let r = e.state.active && e.state.pos === t.pos;
|
|
3745
3789
|
Re(e.editor, t.pos, n) && (e.onMermaidModeChange(n), x.value += 1, r && e.editor.view.focus());
|
|
3746
|
-
},
|
|
3790
|
+
}, oe = (t) => {
|
|
3747
3791
|
if (e.readOnly || !T.value) return;
|
|
3748
3792
|
let n = e.state.active && e.state.pos === T.value.pos;
|
|
3749
3793
|
Le(e.editor, T.value.pos, t) && (t === "mermaid" && Re(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());
|
|
3750
|
-
},
|
|
3751
|
-
u.value = !u.value, u.value && a.value === null && (a.value = Ue()), f.value = u.value ? rt(
|
|
3794
|
+
}, V = () => {
|
|
3795
|
+
u.value = !u.value, u.value && a.value === null && (a.value = Ue()), f.value = u.value ? rt(I.value, T.value?.language ?? null) : -1;
|
|
3752
3796
|
}, se = (e) => {
|
|
3753
3797
|
let t = Qe(e);
|
|
3754
3798
|
d.value = e, f.value = rt(t, e.trim() ? null : T.value?.language ?? null);
|
|
3755
3799
|
}, ce = (t) => {
|
|
3756
3800
|
if (!t.isComposing) {
|
|
3757
3801
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
3758
|
-
t.preventDefault(), f.value = lt(f.value,
|
|
3802
|
+
t.preventDefault(), f.value = lt(f.value, I.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
3759
3803
|
return;
|
|
3760
3804
|
}
|
|
3761
3805
|
if (t.key === "Enter") {
|
|
3762
|
-
let e =
|
|
3763
|
-
e && (t.preventDefault(),
|
|
3806
|
+
let e = I.value[f.value];
|
|
3807
|
+
e && (t.preventDefault(), oe(e.language));
|
|
3764
3808
|
return;
|
|
3765
3809
|
}
|
|
3766
3810
|
t.key === "Escape" && (t.preventDefault(), u.value = !1, f.value = -1, e.editor.view.focus());
|
|
@@ -3770,7 +3814,7 @@ var Di = Y({
|
|
|
3770
3814
|
}, ue = () => {
|
|
3771
3815
|
if (!T.value) return;
|
|
3772
3816
|
let t = at(e.editor, T.value.pos);
|
|
3773
|
-
t &&
|
|
3817
|
+
t && re({
|
|
3774
3818
|
data: new Blob([t], { type: "image/svg+xml" }),
|
|
3775
3819
|
fileName: "markweave-mermaid.svg",
|
|
3776
3820
|
onSettled: () => e.editor.view.focus(),
|
|
@@ -3821,14 +3865,14 @@ var Di = Y({
|
|
|
3821
3865
|
};
|
|
3822
3866
|
K(() => e.readOnly, (e) => {
|
|
3823
3867
|
e && (u.value = !1, d.value = "");
|
|
3824
|
-
}), K(
|
|
3825
|
-
|
|
3868
|
+
}), K(te, () => {
|
|
3869
|
+
R(null), u.value = !1, d.value = "", f.value = -1, h.value = null, g.value = null, _.value = !1;
|
|
3826
3870
|
}), K(u, async (e) => {
|
|
3827
3871
|
if (!e) {
|
|
3828
3872
|
f.value = -1;
|
|
3829
3873
|
return;
|
|
3830
3874
|
}
|
|
3831
|
-
await J(),
|
|
3875
|
+
await J(), B(), r.value?.focus({ preventScroll: !0 });
|
|
3832
3876
|
}), K(() => [
|
|
3833
3877
|
u.value,
|
|
3834
3878
|
d.value,
|
|
@@ -3843,20 +3887,20 @@ var Di = Y({
|
|
|
3843
3887
|
y.value,
|
|
3844
3888
|
T.value?.pos ?? null,
|
|
3845
3889
|
u.value,
|
|
3846
|
-
|
|
3890
|
+
M.value
|
|
3847
3891
|
], async () => {
|
|
3848
|
-
await J(),
|
|
3892
|
+
await J(), B();
|
|
3849
3893
|
}, {
|
|
3850
3894
|
flush: "post",
|
|
3851
3895
|
immediate: !0
|
|
3852
|
-
}), K(
|
|
3853
|
-
await J(),
|
|
3896
|
+
}), K(F, async () => {
|
|
3897
|
+
await J(), z(), window.requestAnimationFrame(z);
|
|
3854
3898
|
}, {
|
|
3855
3899
|
flush: "post",
|
|
3856
3900
|
immediate: !0
|
|
3857
3901
|
});
|
|
3858
3902
|
let ve = null;
|
|
3859
|
-
return
|
|
3903
|
+
return Rn(() => {
|
|
3860
3904
|
J(() => {
|
|
3861
3905
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
3862
3906
|
if (n.target instanceof Node && t.value?.contains(n.target) || u.value) return;
|
|
@@ -3867,7 +3911,7 @@ var Di = Y({
|
|
|
3867
3911
|
}, a = (t) => {
|
|
3868
3912
|
if (t.key === "Escape") {
|
|
3869
3913
|
if (h.value) {
|
|
3870
|
-
|
|
3914
|
+
ne();
|
|
3871
3915
|
return;
|
|
3872
3916
|
}
|
|
3873
3917
|
u.value && (u.value = !1, f.value = -1, e.editor.view.focus());
|
|
@@ -3877,14 +3921,14 @@ var Di = Y({
|
|
|
3877
3921
|
}, c = ({ transaction: e }) => {
|
|
3878
3922
|
e.getMeta(je) && (y.value += 1), (e.docChanged || e.selectionSet || e.getMeta(je) || Tt(e)) && (x.value += 1);
|
|
3879
3923
|
};
|
|
3880
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize",
|
|
3881
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize",
|
|
3924
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), window.addEventListener("resize", z), window.addEventListener("scroll", z, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", s), e.editor.on("transaction", c), ve = () => {
|
|
3925
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), window.removeEventListener("resize", z), window.removeEventListener("scroll", z, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", s), e.editor.off("transaction", c), L();
|
|
3882
3926
|
};
|
|
3883
3927
|
});
|
|
3884
3928
|
}), q(() => {
|
|
3885
|
-
ve?.(), ve = null,
|
|
3929
|
+
ve?.(), ve = null, L();
|
|
3886
3930
|
}), () => {
|
|
3887
|
-
if (!k.value &&
|
|
3931
|
+
if (!k.value && P.value.length === 0 && !h.value) return null;
|
|
3888
3932
|
let o = s.value ? {
|
|
3889
3933
|
top: `${s.value.top}px`,
|
|
3890
3934
|
right: `${s.value.right}px`
|
|
@@ -3898,7 +3942,7 @@ var Di = Y({
|
|
|
3898
3942
|
"data-testid": "markweave-codeblock-overlay",
|
|
3899
3943
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
3900
3944
|
}, [
|
|
3901
|
-
...
|
|
3945
|
+
...P.value.map((e) => {
|
|
3902
3946
|
let t = c.value.find((t) => t.pos === e.pos);
|
|
3903
3947
|
return H("div", {
|
|
3904
3948
|
key: e.pos,
|
|
@@ -3916,7 +3960,7 @@ var Di = Y({
|
|
|
3916
3960
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
3917
3961
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
3918
3962
|
onMousedown: $,
|
|
3919
|
-
onClick: () =>
|
|
3963
|
+
onClick: () => ae(e, t)
|
|
3920
3964
|
}, t === "code" ? "Code" : "Preview")));
|
|
3921
3965
|
}),
|
|
3922
3966
|
k.value && T.value ? H("div", {
|
|
@@ -3932,7 +3976,7 @@ var Di = Y({
|
|
|
3932
3976
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
3933
3977
|
"aria-label": "Code block language",
|
|
3934
3978
|
"data-testid": "markweave-codeblock-language"
|
|
3935
|
-
}, [H("span", null,
|
|
3979
|
+
}, [H("span", null, ee.value)]) : H("button", {
|
|
3936
3980
|
ref: n,
|
|
3937
3981
|
type: "button",
|
|
3938
3982
|
class: "markweave-codeblock-language-button",
|
|
@@ -3941,8 +3985,8 @@ var Di = Y({
|
|
|
3941
3985
|
"aria-haspopup": "listbox",
|
|
3942
3986
|
"data-testid": "markweave-codeblock-language",
|
|
3943
3987
|
onMousedown: $,
|
|
3944
|
-
onClick:
|
|
3945
|
-
}, [H("span", null,
|
|
3988
|
+
onClick: V
|
|
3989
|
+
}, [H("span", null, ee.value), Q("chevron")]),
|
|
3946
3990
|
A.value ? H("button", {
|
|
3947
3991
|
type: "button",
|
|
3948
3992
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
@@ -3958,7 +4002,7 @@ var Di = Y({
|
|
|
3958
4002
|
class: "markweave-codeblock-icon-button",
|
|
3959
4003
|
"aria-label": "Copy to clipboard",
|
|
3960
4004
|
"data-testid": "markweave-codeblock-copy",
|
|
3961
|
-
"data-copy-state":
|
|
4005
|
+
"data-copy-state": j.value,
|
|
3962
4006
|
onMousedown: $,
|
|
3963
4007
|
onMouseenter: () => {
|
|
3964
4008
|
m.value = !0;
|
|
@@ -3973,14 +4017,14 @@ var Di = Y({
|
|
|
3973
4017
|
m.value = !1;
|
|
3974
4018
|
},
|
|
3975
4019
|
onClick: () => {
|
|
3976
|
-
|
|
4020
|
+
ie();
|
|
3977
4021
|
}
|
|
3978
|
-
}, [Q(
|
|
4022
|
+
}, [Q(j.value === "copied" ? "check" : "clipboard")]), m.value ? H("span", {
|
|
3979
4023
|
class: "markweave-codeblock-tooltip",
|
|
3980
4024
|
role: "tooltip",
|
|
3981
4025
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
3982
4026
|
}, "Copy to clipboard") : null]),
|
|
3983
|
-
D.value &&
|
|
4027
|
+
D.value && M.value === "preview" ? H("div", {
|
|
3984
4028
|
class: "markweave-mermaid-preview-actions",
|
|
3985
4029
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
3986
4030
|
}, [H("button", {
|
|
@@ -3988,7 +4032,7 @@ var Di = Y({
|
|
|
3988
4032
|
class: "markweave-codeblock-icon-button",
|
|
3989
4033
|
"aria-label": "Fullscreen Mermaid preview",
|
|
3990
4034
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
3991
|
-
disabled: !
|
|
4035
|
+
disabled: !N.value,
|
|
3992
4036
|
onMousedown: $,
|
|
3993
4037
|
onClick: de
|
|
3994
4038
|
}, [Q("expand")]), H("button", {
|
|
@@ -3996,7 +4040,7 @@ var Di = Y({
|
|
|
3996
4040
|
class: "markweave-codeblock-icon-button",
|
|
3997
4041
|
"aria-label": "Download Mermaid SVG",
|
|
3998
4042
|
"data-testid": "markweave-mermaid-download",
|
|
3999
|
-
disabled: !
|
|
4043
|
+
disabled: !N.value,
|
|
4000
4044
|
onMousedown: $,
|
|
4001
4045
|
onClick: ue
|
|
4002
4046
|
}, [Q("download")])]) : null
|
|
@@ -4012,7 +4056,7 @@ var Di = Y({
|
|
|
4012
4056
|
"aria-autocomplete": "list",
|
|
4013
4057
|
"aria-controls": a.value ?? void 0,
|
|
4014
4058
|
"aria-expanded": "true",
|
|
4015
|
-
"aria-activedescendant": a.value &&
|
|
4059
|
+
"aria-activedescendant": a.value && I.value[f.value] ? $e(a.value, I.value[f.value].language) : void 0,
|
|
4016
4060
|
"aria-label": "Search code block languages",
|
|
4017
4061
|
value: d.value,
|
|
4018
4062
|
placeholder: "Search...",
|
|
@@ -4027,7 +4071,7 @@ var Di = Y({
|
|
|
4027
4071
|
class: "markweave-codeblock-language-list",
|
|
4028
4072
|
role: "listbox",
|
|
4029
4073
|
"aria-label": "Code block languages"
|
|
4030
|
-
},
|
|
4074
|
+
}, I.value.map((e, t) => {
|
|
4031
4075
|
let n = T.value?.language === e.language, r = t === f.value;
|
|
4032
4076
|
return H("button", {
|
|
4033
4077
|
key: e.language,
|
|
@@ -4043,7 +4087,7 @@ var Di = Y({
|
|
|
4043
4087
|
onMouseenter: () => {
|
|
4044
4088
|
f.value = t;
|
|
4045
4089
|
},
|
|
4046
|
-
onClick: () =>
|
|
4090
|
+
onClick: () => oe(e.language)
|
|
4047
4091
|
}, [H("span", null, e.label), n ? Q("check") : null]);
|
|
4048
4092
|
}))]) : null,
|
|
4049
4093
|
h.value ? H("div", {
|
|
@@ -4129,7 +4173,7 @@ var Di = Y({
|
|
|
4129
4173
|
class: "markweave-mermaid-fullscreen-close",
|
|
4130
4174
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
4131
4175
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
4132
|
-
onClick:
|
|
4176
|
+
onClick: ne
|
|
4133
4177
|
}, [Q("close")]),
|
|
4134
4178
|
H("div", {
|
|
4135
4179
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
@@ -4156,7 +4200,7 @@ var Di = Y({
|
|
|
4156
4200
|
]);
|
|
4157
4201
|
};
|
|
4158
4202
|
}
|
|
4159
|
-
}),
|
|
4203
|
+
}), Li = Y({
|
|
4160
4204
|
name: "MarkweaveVueInnerToc",
|
|
4161
4205
|
props: {
|
|
4162
4206
|
editor: {
|
|
@@ -4184,7 +4228,7 @@ var Di = Y({
|
|
|
4184
4228
|
let t = U(null), n, r = () => {
|
|
4185
4229
|
n?.(), n = e.placement === "container" && t.value ? ke(t.value) : void 0;
|
|
4186
4230
|
};
|
|
4187
|
-
return
|
|
4231
|
+
return Rn(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
|
|
4188
4232
|
ref: t,
|
|
4189
4233
|
class: "markweave-inner-toc",
|
|
4190
4234
|
"data-testid": "markweave-inner-toc",
|
|
@@ -4212,8 +4256,8 @@ var Di = Y({
|
|
|
4212
4256
|
}, t.text)))])]) : null;
|
|
4213
4257
|
}
|
|
4214
4258
|
});
|
|
4215
|
-
function
|
|
4216
|
-
let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Se(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(zt), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(Kt), x = U(null), S = U(!1), C = W(null), w =
|
|
4259
|
+
function Ri(e = {}) {
|
|
4260
|
+
let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Se(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(zt), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(Kt), x = U(null), S = U(!1), C = W(null), w = V(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
|
|
4217
4261
|
function O() {
|
|
4218
4262
|
D !== null && (window.clearTimeout(D), D = null), d.value += 1;
|
|
4219
4263
|
}
|
|
@@ -4222,17 +4266,17 @@ function Ii(e = {}) {
|
|
|
4222
4266
|
D = null, d.value += 1;
|
|
4223
4267
|
}, ye);
|
|
4224
4268
|
}
|
|
4225
|
-
let A = e.onSlashCommandUpload,
|
|
4226
|
-
|
|
4227
|
-
extensions:
|
|
4269
|
+
let A = e.onSlashCommandUpload, ee = W(null);
|
|
4270
|
+
ee.value = new a({
|
|
4271
|
+
extensions: _i({
|
|
4228
4272
|
lang: i,
|
|
4229
4273
|
linkCardResolver: e.linkCardResolver,
|
|
4230
|
-
onImageUpload: (e) => A?.(e) ??
|
|
4231
|
-
onVideoUpload: (e) => A?.(e) ??
|
|
4274
|
+
onImageUpload: (e) => A?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4275
|
+
onVideoUpload: (e) => A?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4232
4276
|
resolveMediaSource: e.resolveMediaSource
|
|
4233
4277
|
}),
|
|
4234
4278
|
content: T,
|
|
4235
|
-
contentType:
|
|
4279
|
+
contentType: ie(w),
|
|
4236
4280
|
editable: u.value,
|
|
4237
4281
|
autofocus: e.autofocus,
|
|
4238
4282
|
editorProps: {
|
|
@@ -4248,34 +4292,34 @@ function Ii(e = {}) {
|
|
|
4248
4292
|
handleClick: (e, t, n) => {
|
|
4249
4293
|
if (!u.value) return me(n);
|
|
4250
4294
|
let r = yt(e, n);
|
|
4251
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
4295
|
+
return r ? (n.preventDefault(), n.stopPropagation(), M(), Ct(e, r, !0), wt(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
4252
4296
|
},
|
|
4253
4297
|
handleDOMEvents: {
|
|
4254
4298
|
compositionstart: () => u.value ? (h.value = Bt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
4255
|
-
compositionend: (e) => (u.value && window.setTimeout(() =>
|
|
4299
|
+
compositionend: (e) => (u.value && window.setTimeout(() => N(e), 0), !1),
|
|
4256
4300
|
click: (e, t) => {
|
|
4257
4301
|
if (!u.value) return me(t);
|
|
4258
4302
|
let n = yt(e, t);
|
|
4259
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
4303
|
+
return n ? (t.preventDefault(), t.stopPropagation(), M(), Ct(e, n, !0), wt(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
4260
4304
|
}
|
|
4261
4305
|
}
|
|
4262
4306
|
},
|
|
4263
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
4307
|
+
onSelectionUpdate: ({ editor: e }) => F(e),
|
|
4264
4308
|
onCreate: ({ editor: t }) => {
|
|
4265
4309
|
p(t, {
|
|
4266
4310
|
mode: c.value,
|
|
4267
4311
|
editable: u.value
|
|
4268
|
-
}), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Ut(t),
|
|
4312
|
+
}), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Ut(t), I(t), F(t), O();
|
|
4269
4313
|
},
|
|
4270
4314
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
4271
|
-
if (
|
|
4315
|
+
if (I(e), (t.docChanged || Tt(t)) && k(), t.docChanged && y.value) {
|
|
4272
4316
|
let t = vt(e, y.value.pos);
|
|
4273
4317
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
4274
4318
|
}
|
|
4275
4319
|
},
|
|
4276
4320
|
onUpdate: ({ editor: t }) => {
|
|
4277
|
-
|
|
4278
|
-
let i =
|
|
4321
|
+
F(t), u.value && P(t), S.value || e.onUpdate?.(B(t, { onContentRead: (n, r) => {
|
|
4322
|
+
let i = V(e.contentFormat);
|
|
4279
4323
|
e.content !== void 0 && n === i && (C.value = {
|
|
4280
4324
|
content: r,
|
|
4281
4325
|
format: n,
|
|
@@ -4284,11 +4328,11 @@ function Ii(e = {}) {
|
|
|
4284
4328
|
} }));
|
|
4285
4329
|
}
|
|
4286
4330
|
});
|
|
4287
|
-
let
|
|
4288
|
-
function
|
|
4331
|
+
let j = G(() => ee.value ?? null);
|
|
4332
|
+
function M() {
|
|
4289
4333
|
g.value = null, _.value = null, h.value = zt;
|
|
4290
4334
|
}
|
|
4291
|
-
function
|
|
4335
|
+
function N(e) {
|
|
4292
4336
|
let t = Lt(e.state);
|
|
4293
4337
|
if (!t) {
|
|
4294
4338
|
h.value = h.value.name === "idle" ? h.value : zt, g.value = null, _.value = null;
|
|
@@ -4296,7 +4340,7 @@ function Ii(e = {}) {
|
|
|
4296
4340
|
}
|
|
4297
4341
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
4298
4342
|
if (!Rt(r, { frameRect: i })) {
|
|
4299
|
-
|
|
4343
|
+
M();
|
|
4300
4344
|
return;
|
|
4301
4345
|
}
|
|
4302
4346
|
let a = It(n, {
|
|
@@ -4305,10 +4349,10 @@ function Ii(e = {}) {
|
|
|
4305
4349
|
});
|
|
4306
4350
|
Nt(g.value, a) || (g.value = a), h.value = Ft(h.value, t);
|
|
4307
4351
|
}
|
|
4308
|
-
function
|
|
4309
|
-
|
|
4352
|
+
function P(e) {
|
|
4353
|
+
N(e.view);
|
|
4310
4354
|
}
|
|
4311
|
-
function
|
|
4355
|
+
function F(e) {
|
|
4312
4356
|
let t = ve(e);
|
|
4313
4357
|
ge(m.value, t) || (m.value = t);
|
|
4314
4358
|
let n = bt(e);
|
|
@@ -4316,56 +4360,56 @@ function Ii(e = {}) {
|
|
|
4316
4360
|
let r = Ne(e);
|
|
4317
4361
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
4318
4362
|
}
|
|
4319
|
-
function
|
|
4320
|
-
b.value =
|
|
4363
|
+
function I(e) {
|
|
4364
|
+
b.value = bi(e);
|
|
4321
4365
|
}
|
|
4322
|
-
let
|
|
4366
|
+
let L = G(() => j.value ? Ne(j.value) : yi), R = G(() => j.value ? Wt(j.value.state) : vi), re = G(() => m.value?.currentNode === "codeBlock"), se = G(() => re.value && L.value.language === "mermaid"), ce = G(() => j.value ? kt({
|
|
4323
4367
|
active: se.value,
|
|
4324
4368
|
mode: v.value,
|
|
4325
|
-
source:
|
|
4369
|
+
source: L.value.text
|
|
4326
4370
|
}) : kt({
|
|
4327
4371
|
active: !1,
|
|
4328
4372
|
mode: "code",
|
|
4329
4373
|
source: ""
|
|
4330
|
-
})), le = G(() =>
|
|
4374
|
+
})), le = G(() => j.value && e.onRuntimeStateChange ? Ht(j.value.state) : null), ue = G(() => j.value ? Ee(j.value.state) : we.items), de = G(() => De(ue.value, x.value)), fe = G(() => Ce(ue.value, de.value)), pe = G(() => At(h.value.query, s)), _e = G(() => he({
|
|
4331
4375
|
revision: d.value,
|
|
4332
4376
|
mode: c.value,
|
|
4333
4377
|
editable: u.value,
|
|
4334
4378
|
toc: fe.value,
|
|
4335
4379
|
selection: m.value,
|
|
4336
4380
|
slash: h.value,
|
|
4337
|
-
table:
|
|
4381
|
+
table: R.value,
|
|
4338
4382
|
tableInteraction: b.value,
|
|
4339
|
-
codeBlock:
|
|
4383
|
+
codeBlock: L.value,
|
|
4340
4384
|
mermaid: ce.value,
|
|
4341
4385
|
tableDebugSnapshot: le.value
|
|
4342
4386
|
})), be = {
|
|
4343
|
-
closeSlashMenu:
|
|
4344
|
-
focusFirstTableBodyCell: () =>
|
|
4387
|
+
closeSlashMenu: M,
|
|
4388
|
+
focusFirstTableBodyCell: () => j.value ? Ut(j.value) : !1,
|
|
4345
4389
|
setContent: (e, t = {}) => {
|
|
4346
|
-
if (!
|
|
4347
|
-
let n =
|
|
4348
|
-
return
|
|
4349
|
-
contentType:
|
|
4390
|
+
if (!j.value) return !1;
|
|
4391
|
+
let n = V(t.format);
|
|
4392
|
+
return j.value.commands.setContent(e, {
|
|
4393
|
+
contentType: ie(n),
|
|
4350
4394
|
emitUpdate: t.emitUpdate ?? !1
|
|
4351
|
-
}), t.focusFirstTableBodyCell && Ut(
|
|
4395
|
+
}), t.focusFirstTableBodyCell && Ut(j.value), F(j.value), u.value && P(j.value), I(j.value), O(), !0;
|
|
4352
4396
|
}
|
|
4353
4397
|
};
|
|
4354
4398
|
function xe(e, t) {
|
|
4355
|
-
if (!(!
|
|
4399
|
+
if (!(!j.value || !u.value || !jt(e))) {
|
|
4356
4400
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
4357
4401
|
_.value = e;
|
|
4358
4402
|
return;
|
|
4359
4403
|
}
|
|
4360
|
-
Pt(
|
|
4404
|
+
Pt(j.value, h.value, e, t), h.value = Bt(h.value, { type: "execute" }), M();
|
|
4361
4405
|
}
|
|
4362
4406
|
}
|
|
4363
4407
|
function Oe(e) {
|
|
4364
|
-
if (!
|
|
4365
|
-
let t = Mt(h.value, pe.value, e.key, { isComposing: e.isComposing ||
|
|
4408
|
+
if (!j.value || _.value || !u.value) return;
|
|
4409
|
+
let t = Mt(h.value, pe.value, e.key, { isComposing: e.isComposing || ne(j.value.state) });
|
|
4366
4410
|
if (t.type !== "ignore") {
|
|
4367
4411
|
if (e.preventDefault(), t.type === "close") {
|
|
4368
|
-
h.value = Bt(h.value, { type: "escape" }),
|
|
4412
|
+
h.value = Bt(h.value, { type: "escape" }), M();
|
|
4369
4413
|
return;
|
|
4370
4414
|
}
|
|
4371
4415
|
if (t.type === "move-active") {
|
|
@@ -4380,36 +4424,36 @@ function Ii(e = {}) {
|
|
|
4380
4424
|
}
|
|
4381
4425
|
}
|
|
4382
4426
|
K(() => [e.mode, e.editable], () => {
|
|
4383
|
-
c.value = f(e.mode),
|
|
4427
|
+
c.value = f(e.mode), j.value && (j.value.setEditable(u.value), p(j.value, {
|
|
4384
4428
|
mode: c.value,
|
|
4385
4429
|
editable: u.value
|
|
4386
|
-
}), Dt(
|
|
4430
|
+
}), Dt(j.value, u.value ? "live" : "view"), O(), u.value || M());
|
|
4387
4431
|
}, { immediate: !0 }), K(() => e.theme, () => {
|
|
4388
|
-
|
|
4432
|
+
j.value && Et(j.value, l.value);
|
|
4389
4433
|
}, { immediate: !0 }), K(() => e.content, (t) => {
|
|
4390
|
-
let n =
|
|
4391
|
-
if (!(!
|
|
4392
|
-
if (
|
|
4434
|
+
let n = V(e.contentFormat);
|
|
4435
|
+
if (!(!j.value || t === void 0)) {
|
|
4436
|
+
if (oe(j.value, C.value, t, n)) {
|
|
4393
4437
|
C.value = null;
|
|
4394
4438
|
return;
|
|
4395
4439
|
}
|
|
4396
|
-
C.value = null, !
|
|
4397
|
-
contentType:
|
|
4440
|
+
C.value = null, !ae(j.value, t, n) && (S.value = !0, j.value.commands.setContent(t, {
|
|
4441
|
+
contentType: ie(n),
|
|
4398
4442
|
emitUpdate: !1
|
|
4399
|
-
}), S.value = !1,
|
|
4443
|
+
}), S.value = !1, F(j.value), u.value && P(j.value), I(j.value), O());
|
|
4400
4444
|
}
|
|
4401
4445
|
}), K(_e, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(fe, (t) => e.onTocChange?.(t), { immediate: !0 }), K(ue, (e) => {
|
|
4402
4446
|
let t = De(e, x.value);
|
|
4403
4447
|
x.value !== t && (x.value = t);
|
|
4404
4448
|
});
|
|
4405
|
-
let ke =
|
|
4406
|
-
|
|
4449
|
+
let ke = z(() => {
|
|
4450
|
+
j.value && g.value && N(j.value.view);
|
|
4407
4451
|
}), Ae = () => {
|
|
4408
4452
|
g.value && ke.schedule();
|
|
4409
4453
|
};
|
|
4410
4454
|
K(g, (e) => {
|
|
4411
4455
|
e ? Ae() : ke.cancel();
|
|
4412
|
-
}),
|
|
4456
|
+
}), Rn(() => {
|
|
4413
4457
|
window.addEventListener("resize", Ae), window.addEventListener("scroll", Ae, !0);
|
|
4414
4458
|
}), q(() => {
|
|
4415
4459
|
ke.cancel(), window.removeEventListener("resize", Ae), window.removeEventListener("scroll", Ae, !0);
|
|
@@ -4417,38 +4461,38 @@ function Ii(e = {}) {
|
|
|
4417
4461
|
let je = null;
|
|
4418
4462
|
return q(() => {
|
|
4419
4463
|
D !== null && window.clearTimeout(D);
|
|
4420
|
-
}),
|
|
4464
|
+
}), Rn(() => {
|
|
4421
4465
|
let e = () => {
|
|
4422
|
-
if (!
|
|
4466
|
+
if (!j.value || !ue.value.length) {
|
|
4423
4467
|
x.value = null;
|
|
4424
4468
|
return;
|
|
4425
4469
|
}
|
|
4426
4470
|
let e = null;
|
|
4427
4471
|
try {
|
|
4428
|
-
e = Te(
|
|
4472
|
+
e = Te(j.value, ue.value);
|
|
4429
4473
|
} catch {
|
|
4430
4474
|
return;
|
|
4431
4475
|
}
|
|
4432
4476
|
x.value !== e && (x.value = e);
|
|
4433
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
4477
|
+
}, t = () => window.requestAnimationFrame(e), n = xi(j.value?.view.dom ?? null);
|
|
4434
4478
|
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), je = () => {
|
|
4435
4479
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
4436
4480
|
};
|
|
4437
4481
|
}), q(() => {
|
|
4438
4482
|
je?.();
|
|
4439
|
-
let e =
|
|
4440
|
-
|
|
4483
|
+
let e = ee.value;
|
|
4484
|
+
ee.value = null, J(() => e?.destroy());
|
|
4441
4485
|
}), {
|
|
4442
|
-
editor:
|
|
4486
|
+
editor: j,
|
|
4443
4487
|
runtimeSnapshot: _e,
|
|
4444
4488
|
actions: be,
|
|
4445
4489
|
__render: {
|
|
4446
4490
|
messages: o,
|
|
4447
4491
|
effectiveEditable: u,
|
|
4448
|
-
tableFocusState:
|
|
4492
|
+
tableFocusState: R,
|
|
4449
4493
|
tableInteractionState: b,
|
|
4450
|
-
codeBlockState:
|
|
4451
|
-
isCodeBlockActive:
|
|
4494
|
+
codeBlockState: L,
|
|
4495
|
+
isCodeBlockActive: re,
|
|
4452
4496
|
mermaidMode: v,
|
|
4453
4497
|
mathTarget: y,
|
|
4454
4498
|
setMermaidMode: (e) => {
|
|
@@ -4467,7 +4511,7 @@ function Ii(e = {}) {
|
|
|
4467
4511
|
}
|
|
4468
4512
|
};
|
|
4469
4513
|
}
|
|
4470
|
-
var
|
|
4514
|
+
var zi = Y({
|
|
4471
4515
|
name: "MarkweaveEditor",
|
|
4472
4516
|
props: {
|
|
4473
4517
|
defaultContent: {
|
|
@@ -4576,7 +4620,7 @@ var Li = Y({
|
|
|
4576
4620
|
}
|
|
4577
4621
|
},
|
|
4578
4622
|
setup(e) {
|
|
4579
|
-
let t =
|
|
4623
|
+
let t = Ri(e);
|
|
4580
4624
|
return () => {
|
|
4581
4625
|
let n = t.editor.value;
|
|
4582
4626
|
if (!n) return null;
|
|
@@ -4594,11 +4638,11 @@ var Li = Y({
|
|
|
4594
4638
|
"data-table-focus-mode": r.tableFocusState.value.mode,
|
|
4595
4639
|
onKeydownCapture: r.handleEditorKeyDown
|
|
4596
4640
|
}, [
|
|
4597
|
-
r.effectiveEditable.value ? H(
|
|
4641
|
+
r.effectiveEditable.value ? H(ki, {
|
|
4598
4642
|
editor: n,
|
|
4599
4643
|
messages: r.messages
|
|
4600
4644
|
}) : null,
|
|
4601
|
-
r.effectiveEditable.value ? H(
|
|
4645
|
+
r.effectiveEditable.value ? H(ji, {
|
|
4602
4646
|
commands: r.filteredSlashCommands.value,
|
|
4603
4647
|
state: r.slashState.value,
|
|
4604
4648
|
position: r.slashMenuPosition.value,
|
|
@@ -4608,7 +4652,7 @@ var Li = Y({
|
|
|
4608
4652
|
onInputCommandChange: r.setSlashInputCommand,
|
|
4609
4653
|
onUpload: e.onSlashCommandUpload
|
|
4610
4654
|
}) : null,
|
|
4611
|
-
r.effectiveEditable.value ? H(
|
|
4655
|
+
r.effectiveEditable.value ? H(Pi, {
|
|
4612
4656
|
editor: n,
|
|
4613
4657
|
active: r.tableFocusState.value.active,
|
|
4614
4658
|
interactionState: r.tableInteractionState.value,
|
|
@@ -4617,11 +4661,11 @@ var Li = Y({
|
|
|
4617
4661
|
onCommandResult: e.onTableCommandResult,
|
|
4618
4662
|
onEditWithAi: e.onEditWithAi
|
|
4619
4663
|
}) : null,
|
|
4620
|
-
r.effectiveEditable.value ? H(
|
|
4664
|
+
r.effectiveEditable.value ? H(Fi, {
|
|
4621
4665
|
editor: n,
|
|
4622
4666
|
focusState: r.tableFocusState.value
|
|
4623
4667
|
}) : null,
|
|
4624
|
-
H(
|
|
4668
|
+
H(Ii, {
|
|
4625
4669
|
editor: n,
|
|
4626
4670
|
state: r.codeBlockState.value,
|
|
4627
4671
|
active: r.effectiveEditable.value && r.isCodeBlockActive.value,
|
|
@@ -4629,14 +4673,14 @@ var Li = Y({
|
|
|
4629
4673
|
onMermaidModeChange: r.setMermaidMode,
|
|
4630
4674
|
readOnly: !r.effectiveEditable.value
|
|
4631
4675
|
}),
|
|
4632
|
-
e.innerToc && r.tocState.value.items.length ? H(
|
|
4676
|
+
e.innerToc && r.tocState.value.items.length ? H(Li, {
|
|
4633
4677
|
editor: n,
|
|
4634
4678
|
state: r.tocState.value,
|
|
4635
4679
|
messages: r.messages,
|
|
4636
4680
|
editable: r.effectiveEditable.value,
|
|
4637
4681
|
placement: Oe(e.innerTocPlacement)
|
|
4638
4682
|
}) : null,
|
|
4639
|
-
r.effectiveEditable.value && r.mathTarget.value ? H(
|
|
4683
|
+
r.effectiveEditable.value && r.mathTarget.value ? H(Ai, {
|
|
4640
4684
|
editor: n,
|
|
4641
4685
|
messages: r.messages,
|
|
4642
4686
|
target: r.mathTarget.value,
|
|
@@ -4648,4 +4692,4 @@ var Li = Y({
|
|
|
4648
4692
|
}
|
|
4649
4693
|
});
|
|
4650
4694
|
//#endregion
|
|
4651
|
-
export {
|
|
4695
|
+
export { zi as MarkweaveEditor, _i as createMarkweaveEditorExtensions, _i as createMarkweaveVue2EditorExtensions, Ri as useMarkweaveEditorController };
|