@markweave/vue2 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +25 -25
- package/dist/index.js +483 -424
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/media-nodeviews.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,45 +9,46 @@ import { MarkweaveCoreImage as g, MarkweaveCoreVideo as _, attrsFromMarkweaveIma
|
|
|
9
9
|
import { detectUploadSource as A, getDirectUploadResult as j, resolveMarkweaveUploadResult as M } from "markweave/internal/plugins/slash-command/upload";
|
|
10
10
|
import { BubbleMenu as N } from "@tiptap/vue-2/menus";
|
|
11
11
|
import { isEditorComposing as ee } from "markweave/internal/editor-core/composition-guard";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
12
|
+
import { createMarkweaveFrameScheduler as P } from "markweave/internal/editor-core/frame-scheduler";
|
|
13
|
+
import { createMarkweaveEditorUpdatePayload as te, getMarkweaveContentType as F, isEditorContentCurrent as ne, isMarkweaveControlledContentEchoCurrent as I, normalizeMarkweaveContentFormat as L } from "markweave/internal/editor-core/editor-content";
|
|
14
|
+
import { getCurrentFloatingToolbarBlockType as R, getFloatingToolbarHighlightColorOptions as re, getFloatingToolbarMoreActions as ie, getFloatingToolbarTextColorOptions as ae, getFloatingToolbarTurnIntoOptions as oe, runFloatingToolbarMoreAction as se, setFloatingToolbarTurnInto as ce } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
15
|
+
import { openMarkweaveReadonlyLinkFromEvent as le } from "markweave/internal/editor-core/readonly-link";
|
|
16
|
+
import { createMarkweaveEditorRuntimeSnapshot as ue } from "markweave/internal/editor-core/runtime-snapshot";
|
|
17
|
+
import { areEditorSelectionSnapshotsEquivalent as de, calculateFloatingToolbarPopoverPlacement as z, createSelectionSnapshot as fe, markweaveRuntimeProjectionDelayMs as pe, shouldShowFloatingToolbar as me } from "markweave/internal/editor-core/selection-state";
|
|
18
|
+
import { createMarkweaveTocState as he, emptyMarkweaveTocState as ge, getActiveMarkweaveTocId as _e, getMarkweaveTocItems as ve, getValidMarkweaveTocActiveId as ye, normalizeMarkweaveInnerTocPlacement as be, observeMarkweaveInnerTocContainerPosition as xe, scrollToMarkweaveTocItem as Se } from "markweave/internal/core/toc-state";
|
|
19
|
+
import { codeBlockCollapsePluginKey as Ce, copyActiveCodeBlock as we, getActiveCodeBlockState as Te, getCodeBlockCopyFeedbackSnapshot as Ee, markweaveCodeBlockBehavior as De, setCodeBlockCollapsedAtPosition as Oe, setCodeBlockLanguageAtPosition as ke, setCodeBlockMermaidPreviewModeAtPosition as Ae } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
20
|
+
import { calculateCodeBlockLanguageMenuPosition as je, clampFullscreenScale as Me, codeBlockCopyFeedbackTimeoutMs as Ne, copyCodeBlockText as Pe, createCodeBlockOverlayPosition as Fe, createMermaidFullscreenViewerState as Ie, createMermaidTabPosition as Le, focusCodeBlockTarget as Re, formatCodeBlockLanguageLabel as ze, formatFullscreenZoom as Be, getActiveCodeBlockElement as Ve, getAnchoredRect as He, getCodeBlockLanguageItems as Ue, getCodeBlockPositionFromEventTarget as We, getCodeBlockStateAtPosition as Ge, getFrameElement as Ke, getMermaidCodeBlockTargets as qe, getMermaidSvgMarkup as Je, isCodeBlockTargetCollapsed as Ye, mergeStableMermaidTabPositions as Xe, mermaidFullscreenZoomStep as Ze, moveMermaidFullscreenViewer as Qe } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
21
|
+
import { normalizeMarkdownLinkHref as $e } from "markweave/internal/plugins/markdown/markdown-input";
|
|
22
|
+
import { applyMarkweaveMathLatex as et, calculateMarkweaveMathPopoverPosition as tt, getMarkweaveMathAnchorRect as nt, getMarkweaveMathBlockIndex as rt, getMarkweaveMathRenderedHtml as it, getMarkweaveMathTargetAtPos as at, getMarkweaveMathTargetFromDomEvent as ot, getMarkweaveMathTargetFromSelection as st, renderMarkweaveMathPreview as ct, setMarkweaveMathEditingDomState as lt, setMarkweaveMathEditingDomStateInView as ut, setMarkweaveMathSelectionInView as dt } from "markweave/internal/plugins/math/math-ui-model";
|
|
23
|
+
import { isMermaidInlinePreviewTransaction as ft, setMermaidInlinePreviewEditorMode as pt, setReadonlyMermaidPreviewMode as mt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
24
|
+
import { getMermaidPreviewState as ht } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
25
|
+
import { filterSlashCommands as gt, isExecutableSlashCommand as _t } from "markweave/internal/plugins/slash-command/command-spec";
|
|
26
|
+
import { getSlashCommandKeyboardAction as vt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
27
|
+
import { executeSlashCommand as yt, getNextSlashCommandState as bt, getSlashCommandAnchoredMenuPosition as xt, getSlashCommandContext as St } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
28
|
+
import { initialSlashCommandState as Ct, reduceSlashCommandState as wt } from "markweave/internal/plugins/slash-command/slash-state";
|
|
29
|
+
import { setMarkweaveTableMenuAxisTarget as Tt } from "markweave/internal/plugins/table/table-clipboard";
|
|
30
|
+
import { getFirstTableDebugSnapshot as Et } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
31
|
+
import { focusFirstTableBodyCell as Dt } from "markweave/internal/plugins/table/table-focus-position";
|
|
32
|
+
import { getTableFocusState as Ot } from "markweave/internal/plugins/table/table-focus-state";
|
|
33
|
+
import { getTableSelectionOverlayState as kt, initialTableInteractionState as At, tableInteractionPluginKey as jt } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
34
|
+
import { calculateAnchoredTableMenuPosition as Mt, calculateTableEdgeHandlePosition as Nt, canRunTableCommand as Pt, executeTableMenuCommand as Ft, formatTableCopyFeedback as It, getActiveTableElement as Lt, getAvailableCellMenuCommandSpecs as Rt, getTableAxisTargetRect as zt, getTableControlAxisSelectionModel as Bt, getTableEditWithAiRequest as Vt, getTableMenuItemGroup as Ht, getTableMenuItemLabel as Ut, getTableMenuItems as Wt, getTableSelectionTargetRect as Gt, measureTableSelectionOverlay as Kt, selectTableAxisFromCell as qt, tableCopyFeedbackTimeoutMs as Jt, tableMenuLabel as Yt } from "markweave/internal/plugins/table/table-ui-model";
|
|
34
35
|
//#region src/vue2-compat.ts
|
|
35
|
-
var
|
|
36
|
-
function
|
|
36
|
+
var Xt = o.default ?? o, Zt = null, Qt = null, $t = null;
|
|
37
|
+
function en(e) {
|
|
37
38
|
return !!(e && typeof e == "object" && "value" in e);
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
+
function tn(e) {
|
|
40
41
|
let t = e.slice(2);
|
|
41
42
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function nn(e) {
|
|
44
45
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
45
46
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
46
47
|
if (o === "class" || o === "style" || o === "key") {
|
|
47
48
|
t[o] = s;
|
|
48
49
|
continue;
|
|
49
50
|
}
|
|
50
|
-
if (o === "ref" &&
|
|
51
|
+
if (o === "ref" && en(s)) {
|
|
51
52
|
a.insert = (e) => {
|
|
52
53
|
s.value = e.elm;
|
|
53
54
|
}, a.destroy = () => {
|
|
@@ -56,7 +57,7 @@ function Zt(e) {
|
|
|
56
57
|
continue;
|
|
57
58
|
}
|
|
58
59
|
if (/^on[A-Z]/.test(o)) {
|
|
59
|
-
i[
|
|
60
|
+
i[tn(o)] = s;
|
|
60
61
|
continue;
|
|
61
62
|
}
|
|
62
63
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -67,14 +68,14 @@ function Zt(e) {
|
|
|
67
68
|
}
|
|
68
69
|
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;
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
+
function rn(e) {
|
|
71
72
|
let t = {}, n = {}, r = {}, i = {};
|
|
72
73
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
73
74
|
if (a === "class" || a === "style" || a === "key") {
|
|
74
75
|
t[a] = o;
|
|
75
76
|
continue;
|
|
76
77
|
}
|
|
77
|
-
if (a === "ref" &&
|
|
78
|
+
if (a === "ref" && en(o)) {
|
|
78
79
|
i.insert = (e) => {
|
|
79
80
|
o.value = e.componentInstance ?? e.elm;
|
|
80
81
|
}, i.destroy = () => {
|
|
@@ -90,25 +91,25 @@ function Qt(e) {
|
|
|
90
91
|
}
|
|
91
92
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
+
function an(e) {
|
|
94
95
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
95
96
|
}
|
|
96
|
-
function
|
|
97
|
+
function on(e) {
|
|
97
98
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
98
99
|
}
|
|
99
|
-
function
|
|
100
|
+
function sn(e) {
|
|
100
101
|
return e == null || Array.isArray(e) ? e : [e];
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
-
return typeof e == "function" ?
|
|
103
|
+
function cn(e) {
|
|
104
|
+
return typeof e == "function" ? sn(e()) : an(e) ? sn(e.default()) : on(e) ? [e] : e;
|
|
104
105
|
}
|
|
105
106
|
function B(e, t, n) {
|
|
106
|
-
if (
|
|
107
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
108
|
-
return
|
|
107
|
+
if (!$t) throw Error("Vue 2 render context is not available.");
|
|
108
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? nn(r) : rn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : cn(n);
|
|
109
|
+
return $t(e, i, a);
|
|
109
110
|
}
|
|
110
111
|
function V(e) {
|
|
111
|
-
return
|
|
112
|
+
return Xt.observable({ value: e });
|
|
112
113
|
}
|
|
113
114
|
var H = V;
|
|
114
115
|
function U(e) {
|
|
@@ -118,19 +119,19 @@ function U(e) {
|
|
|
118
119
|
}
|
|
119
120
|
function W(e, t, n) {
|
|
120
121
|
let r = typeof e == "function" ? e : () => e.value;
|
|
121
|
-
return
|
|
122
|
+
return Zt?.$watch ? Zt.$watch(r, t, n) : () => void 0;
|
|
122
123
|
}
|
|
123
124
|
function G(e) {
|
|
124
|
-
|
|
125
|
+
Qt?.mounted.push(e);
|
|
125
126
|
}
|
|
126
127
|
function K(e) {
|
|
127
|
-
|
|
128
|
+
Qt?.beforeUnmount.push(e);
|
|
128
129
|
}
|
|
129
130
|
function q(e) {
|
|
130
|
-
return
|
|
131
|
+
return Xt.nextTick(e);
|
|
131
132
|
}
|
|
132
133
|
function J(e) {
|
|
133
|
-
return
|
|
134
|
+
return Xt.extend({
|
|
134
135
|
name: e.name,
|
|
135
136
|
props: e.props,
|
|
136
137
|
created() {
|
|
@@ -138,12 +139,12 @@ function J(e) {
|
|
|
138
139
|
mounted: [],
|
|
139
140
|
beforeUnmount: []
|
|
140
141
|
};
|
|
141
|
-
|
|
142
|
+
Zt = this, Qt = t;
|
|
142
143
|
try {
|
|
143
144
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
144
145
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
145
146
|
} finally {
|
|
146
|
-
|
|
147
|
+
Zt = null, Qt = null;
|
|
147
148
|
}
|
|
148
149
|
},
|
|
149
150
|
mounted() {
|
|
@@ -153,19 +154,19 @@ function J(e) {
|
|
|
153
154
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
154
155
|
},
|
|
155
156
|
render(t) {
|
|
156
|
-
|
|
157
|
+
$t = t;
|
|
157
158
|
try {
|
|
158
159
|
let n = this.__markweaveVue2Render;
|
|
159
160
|
return n ? n() : e.render?.(t) ?? null;
|
|
160
161
|
} finally {
|
|
161
|
-
|
|
162
|
+
$t = null;
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
167
|
//#endregion
|
|
167
168
|
//#region src/vue2-icons.ts
|
|
168
|
-
var
|
|
169
|
+
var ln = {
|
|
169
170
|
AlignCenter: {
|
|
170
171
|
iconName: "text-align-center",
|
|
171
172
|
node: [
|
|
@@ -1030,7 +1031,7 @@ var rn = {
|
|
|
1030
1031
|
}]]
|
|
1031
1032
|
}
|
|
1032
1033
|
};
|
|
1033
|
-
function
|
|
1034
|
+
function un(e) {
|
|
1034
1035
|
return e.map(([e, t]) => B(e, t));
|
|
1035
1036
|
}
|
|
1036
1037
|
function Y(e) {
|
|
@@ -1051,7 +1052,7 @@ function Y(e) {
|
|
|
1051
1052
|
}
|
|
1052
1053
|
},
|
|
1053
1054
|
setup(t) {
|
|
1054
|
-
let n =
|
|
1055
|
+
let n = ln[e];
|
|
1055
1056
|
return () => B("svg", {
|
|
1056
1057
|
class: `lucide lucide-${n.iconName}`,
|
|
1057
1058
|
viewBox: "0 0 24 24",
|
|
@@ -1064,14 +1065,14 @@ function Y(e) {
|
|
|
1064
1065
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1065
1066
|
"aria-hidden": "true",
|
|
1066
1067
|
focusable: "false"
|
|
1067
|
-
},
|
|
1068
|
+
}, un(n.node));
|
|
1068
1069
|
}
|
|
1069
1070
|
});
|
|
1070
1071
|
}
|
|
1071
|
-
var
|
|
1072
|
+
var dn = Y("AlignCenter"), fn = Y("AlignJustify"), pn = Y("AlignLeft"), mn = Y("AlignRight"), hn = Y("AlertTriangle"), gn = Y("Bold"), _n = Y("Braces"), vn = Y("Captions"), yn = Y("CheckCircle2"), bn = Y("ChevronDown"), xn = Y("ChevronUp"), Sn = Y("CircleX"), Cn = Y("Code2"), wn = Y("CornerDownLeft"), Tn = Y("Download"), En = Y("Eye"), Dn = Y("ExternalLink"), On = Y("Heading1"), kn = Y("Heading2"), An = Y("Heading3"), jn = Y("Image"), Mn = Y("ImageUp"), Nn = Y("IndentDecrease"), Pn = Y("IndentIncrease"), Fn = Y("Info"), In = Y("Italic"), Ln = Y("Lightbulb"), Rn = Y("Link2"), zn = Y("List"), Bn = Y("ListChecks"), Vn = Y("ListOrdered"), Hn = Y("Minus"), Un = Y("MoreVertical"), Wn = Y("Paperclip");
|
|
1072
1073
|
Y("PencilLine");
|
|
1073
|
-
var
|
|
1074
|
-
function
|
|
1074
|
+
var Gn = Y("Quote"), Kn = Y("Replace"), qn = Y("Sigma"), Jn = Y("SmilePlus"), Yn = Y("Strikethrough"), Xn = Y("Subscript"), Zn = Y("Superscript"), Qn = Y("Table2"), $n = Y("Text"), er = Y("Trash2"), tr = Y("Type"), nr = Y("Underline"), rr = Y("Upload"), ir = Y("Video"), ar = E;
|
|
1075
|
+
function or(e) {
|
|
1075
1076
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1076
1077
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1077
1078
|
return n === "view" ? {
|
|
@@ -1093,13 +1094,13 @@ function tr(e) {
|
|
|
1093
1094
|
i(), a?.disconnect();
|
|
1094
1095
|
}), r;
|
|
1095
1096
|
}
|
|
1096
|
-
function
|
|
1097
|
+
function sr(e) {
|
|
1097
1098
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1098
1099
|
}
|
|
1099
|
-
function
|
|
1100
|
+
function cr(e) {
|
|
1100
1101
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1101
1102
|
}
|
|
1102
|
-
function
|
|
1103
|
+
function lr(e, t) {
|
|
1103
1104
|
return B(e, {
|
|
1104
1105
|
size: 18,
|
|
1105
1106
|
strokeWidth: 1.8,
|
|
@@ -1115,12 +1116,12 @@ function X(e) {
|
|
|
1115
1116
|
"data-active": e.active ? "true" : "false",
|
|
1116
1117
|
onMousedown: (e) => e.preventDefault(),
|
|
1117
1118
|
onClick: e.onClick
|
|
1118
|
-
}, [
|
|
1119
|
+
}, [lr(e.icon, e.label), B("span", {
|
|
1119
1120
|
class: "markweave-image-tooltip",
|
|
1120
1121
|
role: "tooltip"
|
|
1121
1122
|
}, e.label)]);
|
|
1122
1123
|
}
|
|
1123
|
-
function
|
|
1124
|
+
function ur(e) {
|
|
1124
1125
|
let t = V(null), n = e.messages.image;
|
|
1125
1126
|
return B("section", {
|
|
1126
1127
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1154,7 +1155,7 @@ function ar(e) {
|
|
|
1154
1155
|
B("div", {
|
|
1155
1156
|
class: "markweave-image-upload-icon",
|
|
1156
1157
|
"aria-hidden": "true"
|
|
1157
|
-
}, [B(
|
|
1158
|
+
}, [B(Mn, {
|
|
1158
1159
|
size: 46,
|
|
1159
1160
|
strokeWidth: 1.6
|
|
1160
1161
|
})]),
|
|
@@ -1179,7 +1180,7 @@ function ar(e) {
|
|
|
1179
1180
|
"data-testid": "markweave-image-upload-submit",
|
|
1180
1181
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1181
1182
|
onClick: e.onSubmit
|
|
1182
|
-
}, [B(
|
|
1183
|
+
}, [B(Mn, {
|
|
1183
1184
|
size: 16,
|
|
1184
1185
|
strokeWidth: 1.8
|
|
1185
1186
|
}), e.messages.common.insert]),
|
|
@@ -1195,7 +1196,7 @@ function ar(e) {
|
|
|
1195
1196
|
}, e.error) : null
|
|
1196
1197
|
]);
|
|
1197
1198
|
}
|
|
1198
|
-
function
|
|
1199
|
+
function dr(e) {
|
|
1199
1200
|
let t = V(null), n = e.messages.video;
|
|
1200
1201
|
return B("section", {
|
|
1201
1202
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1229,7 +1230,7 @@ function or(e) {
|
|
|
1229
1230
|
B("div", {
|
|
1230
1231
|
class: "markweave-video-upload-icon",
|
|
1231
1232
|
"aria-hidden": "true"
|
|
1232
|
-
}, [B(
|
|
1233
|
+
}, [B(ir, {
|
|
1233
1234
|
size: 46,
|
|
1234
1235
|
strokeWidth: 1.6
|
|
1235
1236
|
})]),
|
|
@@ -1254,7 +1255,7 @@ function or(e) {
|
|
|
1254
1255
|
"data-testid": "markweave-video-upload-submit",
|
|
1255
1256
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1256
1257
|
onClick: e.onSubmit
|
|
1257
|
-
}, [B(
|
|
1258
|
+
}, [B(rr, {
|
|
1258
1259
|
size: 16,
|
|
1259
1260
|
strokeWidth: 1.8
|
|
1260
1261
|
}), e.messages.common.insert]),
|
|
@@ -1270,7 +1271,7 @@ function or(e) {
|
|
|
1270
1271
|
}, e.error) : null
|
|
1271
1272
|
]);
|
|
1272
1273
|
}
|
|
1273
|
-
var
|
|
1274
|
+
var fr = J({
|
|
1274
1275
|
name: "MarkweaveVueImageNodeView",
|
|
1275
1276
|
props: {
|
|
1276
1277
|
editor: {
|
|
@@ -1303,7 +1304,7 @@ var sr = J({
|
|
|
1303
1304
|
}
|
|
1304
1305
|
},
|
|
1305
1306
|
setup(e) {
|
|
1306
|
-
let t = V(null), n = V(!1), r = V(!1), a = V(!1), o = V(""), s = V(null), l = V(!1), u = U(() => e.node.attrs), d = V(!!k(u.value.caption)), f = V(k(u.value.caption) ?? ""), m =
|
|
1307
|
+
let t = V(null), n = V(!1), r = V(!1), a = V(!1), o = V(""), s = V(null), l = V(!1), u = U(() => e.node.attrs), d = V(!!k(u.value.caption)), f = V(k(u.value.caption) ?? ""), m = or(e.editor), g = U(() => c(m.value)), _ = U(() => e.extension.options?.messages ?? p("zh")), y = U(() => _.value.image), b = U(() => k(u.value.src)), C = U(() => ar(u.value.align)), T = U(() => O(u.value.width)), E = U(() => k(u.value.caption)), D = U(() => g.value && (!b.value || r.value)), j = () => {
|
|
1307
1308
|
b.value && h({
|
|
1308
1309
|
src: b.value,
|
|
1309
1310
|
alt: k(u.value.alt) ?? "",
|
|
@@ -1329,7 +1330,7 @@ var sr = J({
|
|
|
1329
1330
|
return;
|
|
1330
1331
|
}
|
|
1331
1332
|
e.deleteNode();
|
|
1332
|
-
},
|
|
1333
|
+
}, P = async (t) => {
|
|
1333
1334
|
if (!g.value) return;
|
|
1334
1335
|
let n = e.extension.options;
|
|
1335
1336
|
l.value = !0, s.value = null;
|
|
@@ -1341,21 +1342,21 @@ var sr = J({
|
|
|
1341
1342
|
} finally {
|
|
1342
1343
|
l.value = !1, a.value = !1;
|
|
1343
1344
|
}
|
|
1344
|
-
},
|
|
1345
|
+
}, te = () => {
|
|
1345
1346
|
if (!o.value.trim()) {
|
|
1346
1347
|
s.value = y.value.uploadRequiredError;
|
|
1347
1348
|
return;
|
|
1348
1349
|
}
|
|
1349
|
-
|
|
1350
|
+
P(A(o.value));
|
|
1350
1351
|
}, F = (e) => {
|
|
1351
|
-
|
|
1352
|
+
P({
|
|
1352
1353
|
type: "file",
|
|
1353
1354
|
file: e,
|
|
1354
1355
|
mimeType: e.type || "image/*"
|
|
1355
1356
|
});
|
|
1356
|
-
},
|
|
1357
|
+
}, ne = () => {
|
|
1357
1358
|
d.value = !d.value, d.value && (f.value = E.value ?? "");
|
|
1358
|
-
},
|
|
1359
|
+
}, I = (n, r) => {
|
|
1359
1360
|
if (!g.value || !b.value) return;
|
|
1360
1361
|
r.preventDefault(), r.stopPropagation(), N();
|
|
1361
1362
|
let i = t.value;
|
|
@@ -1376,7 +1377,7 @@ var sr = J({
|
|
|
1376
1377
|
"data-selected": "false",
|
|
1377
1378
|
"data-hovered": "false",
|
|
1378
1379
|
"data-empty": "true"
|
|
1379
|
-
}, () =>
|
|
1380
|
+
}, () => ur({
|
|
1380
1381
|
messages: _.value,
|
|
1381
1382
|
inputValue: o.value,
|
|
1382
1383
|
error: s.value,
|
|
@@ -1386,7 +1387,7 @@ var sr = J({
|
|
|
1386
1387
|
o.value = e;
|
|
1387
1388
|
},
|
|
1388
1389
|
onFile: F,
|
|
1389
|
-
onSubmit:
|
|
1390
|
+
onSubmit: te,
|
|
1390
1391
|
onCancel: ee,
|
|
1391
1392
|
onDragActive: (e) => {
|
|
1392
1393
|
a.value = e;
|
|
@@ -1406,7 +1407,7 @@ var sr = J({
|
|
|
1406
1407
|
n.value = !1;
|
|
1407
1408
|
},
|
|
1408
1409
|
onMousedown: (e) => {
|
|
1409
|
-
g.value && !
|
|
1410
|
+
g.value && !sr(e.target) && N();
|
|
1410
1411
|
}
|
|
1411
1412
|
}, () => [
|
|
1412
1413
|
g.value ? B("div", {
|
|
@@ -1418,21 +1419,21 @@ var sr = J({
|
|
|
1418
1419
|
X({
|
|
1419
1420
|
testId: "markweave-image-align-left",
|
|
1420
1421
|
label: y.value.alignLeft,
|
|
1421
|
-
icon:
|
|
1422
|
+
icon: pn,
|
|
1422
1423
|
active: C.value === "left",
|
|
1423
1424
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1424
1425
|
}),
|
|
1425
1426
|
X({
|
|
1426
1427
|
testId: "markweave-image-align-center",
|
|
1427
1428
|
label: y.value.alignCenter,
|
|
1428
|
-
icon:
|
|
1429
|
+
icon: dn,
|
|
1429
1430
|
active: C.value === "center",
|
|
1430
1431
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1431
1432
|
}),
|
|
1432
1433
|
X({
|
|
1433
1434
|
testId: "markweave-image-align-right",
|
|
1434
1435
|
label: y.value.alignRight,
|
|
1435
|
-
icon:
|
|
1436
|
+
icon: mn,
|
|
1436
1437
|
active: C.value === "right",
|
|
1437
1438
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1438
1439
|
}),
|
|
@@ -1443,20 +1444,20 @@ var sr = J({
|
|
|
1443
1444
|
X({
|
|
1444
1445
|
testId: "markweave-image-caption",
|
|
1445
1446
|
label: y.value.caption,
|
|
1446
|
-
icon:
|
|
1447
|
+
icon: vn,
|
|
1447
1448
|
active: d.value || !!E.value,
|
|
1448
|
-
onClick:
|
|
1449
|
+
onClick: ne
|
|
1449
1450
|
}),
|
|
1450
1451
|
X({
|
|
1451
1452
|
testId: "markweave-image-preview",
|
|
1452
1453
|
label: y.value.preview,
|
|
1453
|
-
icon:
|
|
1454
|
+
icon: En,
|
|
1454
1455
|
onClick: j
|
|
1455
1456
|
}),
|
|
1456
1457
|
X({
|
|
1457
1458
|
testId: "markweave-image-download",
|
|
1458
1459
|
label: y.value.download,
|
|
1459
|
-
icon:
|
|
1460
|
+
icon: Tn,
|
|
1460
1461
|
onClick: () => {
|
|
1461
1462
|
b.value && w(b.value);
|
|
1462
1463
|
}
|
|
@@ -1464,7 +1465,7 @@ var sr = J({
|
|
|
1464
1465
|
X({
|
|
1465
1466
|
testId: "markweave-image-replace",
|
|
1466
1467
|
label: y.value.replace,
|
|
1467
|
-
icon:
|
|
1468
|
+
icon: Kn,
|
|
1468
1469
|
onClick: () => {
|
|
1469
1470
|
o.value = "", s.value = null, r.value = !0;
|
|
1470
1471
|
}
|
|
@@ -1476,7 +1477,7 @@ var sr = J({
|
|
|
1476
1477
|
X({
|
|
1477
1478
|
testId: "markweave-image-delete",
|
|
1478
1479
|
label: y.value.delete,
|
|
1479
|
-
icon:
|
|
1480
|
+
icon: er,
|
|
1480
1481
|
onClick: () => e.deleteNode()
|
|
1481
1482
|
})
|
|
1482
1483
|
]) : null,
|
|
@@ -1505,7 +1506,7 @@ var sr = J({
|
|
|
1505
1506
|
title: y.value.preview,
|
|
1506
1507
|
onMousedown: (e) => e.preventDefault(),
|
|
1507
1508
|
onClick: j
|
|
1508
|
-
}, [B(
|
|
1509
|
+
}, [B(En, {
|
|
1509
1510
|
size: 16,
|
|
1510
1511
|
strokeWidth: 1.8
|
|
1511
1512
|
}), B("span", {
|
|
@@ -1519,7 +1520,7 @@ var sr = J({
|
|
|
1519
1520
|
"data-side": "left",
|
|
1520
1521
|
"aria-label": y.value.resizeLeft,
|
|
1521
1522
|
"data-markweave-image-ui": "true",
|
|
1522
|
-
onPointerdown: (e) =>
|
|
1523
|
+
onPointerdown: (e) => I("left", e)
|
|
1523
1524
|
}) : null,
|
|
1524
1525
|
g.value ? B("button", {
|
|
1525
1526
|
type: "button",
|
|
@@ -1528,7 +1529,7 @@ var sr = J({
|
|
|
1528
1529
|
"data-side": "right",
|
|
1529
1530
|
"aria-label": y.value.resizeRight,
|
|
1530
1531
|
"data-markweave-image-ui": "true",
|
|
1531
|
-
onPointerdown: (e) =>
|
|
1532
|
+
onPointerdown: (e) => I("right", e)
|
|
1532
1533
|
}) : null
|
|
1533
1534
|
]),
|
|
1534
1535
|
g.value && (d.value || E.value) ? B("input", {
|
|
@@ -1550,7 +1551,7 @@ var sr = J({
|
|
|
1550
1551
|
}, E.value) : null
|
|
1551
1552
|
]);
|
|
1552
1553
|
}
|
|
1553
|
-
}),
|
|
1554
|
+
}), pr = J({
|
|
1554
1555
|
name: "MarkweaveVueVideoNodeView",
|
|
1555
1556
|
props: {
|
|
1556
1557
|
editor: {
|
|
@@ -1583,7 +1584,7 @@ var sr = J({
|
|
|
1583
1584
|
}
|
|
1584
1585
|
},
|
|
1585
1586
|
setup(e) {
|
|
1586
|
-
let t = V(!1), n = V(""), r = V(null), a = V(!1), o =
|
|
1587
|
+
let t = V(!1), n = V(""), r = V(null), a = V(!1), o = or(e.editor), s = U(() => c(o.value)), l = U(() => e.extension.options?.messages ?? p("zh")), u = U(() => l.value.video), d = U(() => e.node.attrs), f = U(() => k(d.value.src)), m = U(() => k(d.value.embedUrl)), h = U(() => k(d.value.provider)), g = U(() => m.value ? D(m.value, h.value) : null), _ = U(() => k(d.value.mimeType)), v = U(() => k(d.value.title)), x = () => {
|
|
1587
1588
|
f.value || e.deleteNode(), n.value = "", r.value = null, t.value = !1;
|
|
1588
1589
|
}, S = async (i) => {
|
|
1589
1590
|
if (!s.value) return;
|
|
@@ -1624,7 +1625,7 @@ var sr = J({
|
|
|
1624
1625
|
"data-testid": "markweave-video-node",
|
|
1625
1626
|
"data-empty": "true",
|
|
1626
1627
|
"data-selected": "false"
|
|
1627
|
-
}, () =>
|
|
1628
|
+
}, () => dr({
|
|
1628
1629
|
messages: l.value,
|
|
1629
1630
|
inputValue: n.value,
|
|
1630
1631
|
error: r.value,
|
|
@@ -1651,7 +1652,7 @@ var sr = J({
|
|
|
1651
1652
|
onFocus: O,
|
|
1652
1653
|
onKeydown: A,
|
|
1653
1654
|
onMousedown: (e) => {
|
|
1654
|
-
s.value && !
|
|
1655
|
+
s.value && !cr(e.target) && (e.preventDefault(), O());
|
|
1655
1656
|
}
|
|
1656
1657
|
}, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
|
|
1657
1658
|
class: "markweave-video-iframe",
|
|
@@ -1661,6 +1662,7 @@ var sr = J({
|
|
|
1661
1662
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
1662
1663
|
"data-markweave-video-src": f.value ?? void 0,
|
|
1663
1664
|
allow: T,
|
|
1665
|
+
loading: "lazy",
|
|
1664
1666
|
allowfullscreen: "true"
|
|
1665
1667
|
}), s.value ? B("button", {
|
|
1666
1668
|
type: "button",
|
|
@@ -1672,6 +1674,7 @@ var sr = J({
|
|
|
1672
1674
|
class: "markweave-video",
|
|
1673
1675
|
src: f.value,
|
|
1674
1676
|
title: v.value ?? void 0,
|
|
1677
|
+
preload: "metadata",
|
|
1675
1678
|
controls: !0,
|
|
1676
1679
|
"data-markweave-video": "true",
|
|
1677
1680
|
"data-markweave-mime-type": _.value ?? void 0
|
|
@@ -1687,7 +1690,7 @@ var sr = J({
|
|
|
1687
1690
|
"aria-hidden": "true"
|
|
1688
1691
|
})]);
|
|
1689
1692
|
}
|
|
1690
|
-
}),
|
|
1693
|
+
}), mr = g.extend({
|
|
1691
1694
|
addOptions() {
|
|
1692
1695
|
return {
|
|
1693
1696
|
...this.parent?.(),
|
|
@@ -1696,9 +1699,9 @@ var sr = J({
|
|
|
1696
1699
|
};
|
|
1697
1700
|
},
|
|
1698
1701
|
addNodeView() {
|
|
1699
|
-
return typeof document > "u" ? null : a(
|
|
1702
|
+
return typeof document > "u" ? null : a(fr, { stopEvent: ({ event: e }) => sr(e.target) });
|
|
1700
1703
|
}
|
|
1701
|
-
}),
|
|
1704
|
+
}), hr = _.extend({
|
|
1702
1705
|
addOptions() {
|
|
1703
1706
|
return {
|
|
1704
1707
|
...this.parent?.(),
|
|
@@ -1707,17 +1710,17 @@ var sr = J({
|
|
|
1707
1710
|
};
|
|
1708
1711
|
},
|
|
1709
1712
|
addNodeView() {
|
|
1710
|
-
return typeof document > "u" ? null : a(
|
|
1713
|
+
return typeof document > "u" ? null : a(pr, { stopEvent: ({ event: e }) => cr(e.target) });
|
|
1711
1714
|
}
|
|
1712
1715
|
});
|
|
1713
1716
|
//#endregion
|
|
1714
1717
|
//#region src/create-editor-extensions.ts
|
|
1715
|
-
function
|
|
1718
|
+
function gr(n = {}) {
|
|
1716
1719
|
return e({
|
|
1717
1720
|
lang: n.lang,
|
|
1718
1721
|
mediaExtensions: t({
|
|
1719
|
-
image:
|
|
1720
|
-
video:
|
|
1722
|
+
image: mr,
|
|
1723
|
+
video: hr,
|
|
1721
1724
|
lang: n.lang,
|
|
1722
1725
|
onImageUpload: n.onImageUpload,
|
|
1723
1726
|
onVideoUpload: n.onVideoUpload
|
|
@@ -1726,7 +1729,7 @@ function dr(n = {}) {
|
|
|
1726
1729
|
}
|
|
1727
1730
|
//#endregion
|
|
1728
1731
|
//#region src/MarkweaveEditor.ts
|
|
1729
|
-
var
|
|
1732
|
+
var _r = {
|
|
1730
1733
|
active: !1,
|
|
1731
1734
|
mode: "outside",
|
|
1732
1735
|
activeCellPos: null,
|
|
@@ -1734,17 +1737,17 @@ var fr = {
|
|
|
1734
1737
|
selectedCellCount: 0,
|
|
1735
1738
|
selectionFrom: 0,
|
|
1736
1739
|
selectionTo: 0
|
|
1737
|
-
},
|
|
1740
|
+
}, vr = {
|
|
1738
1741
|
active: !1,
|
|
1739
|
-
language:
|
|
1742
|
+
language: De.defaultLanguage,
|
|
1740
1743
|
mermaidPreviewMode: "code",
|
|
1741
1744
|
pos: null,
|
|
1742
1745
|
text: ""
|
|
1743
1746
|
};
|
|
1744
|
-
function
|
|
1745
|
-
return
|
|
1747
|
+
function yr(e) {
|
|
1748
|
+
return jt.getState(e.state) ?? At;
|
|
1746
1749
|
}
|
|
1747
|
-
function
|
|
1750
|
+
function br(e) {
|
|
1748
1751
|
if (!e || typeof window > "u") return null;
|
|
1749
1752
|
let t = e.parentElement;
|
|
1750
1753
|
for (; t;) {
|
|
@@ -1761,7 +1764,7 @@ function Z(e, t, n = 18, r = 1.8) {
|
|
|
1761
1764
|
"aria-hidden": "true"
|
|
1762
1765
|
}, { default: () => t });
|
|
1763
1766
|
}
|
|
1764
|
-
function
|
|
1767
|
+
function xr(e) {
|
|
1765
1768
|
return e === "clipboard" ? [B("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" }), B("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" ? [B("circle", {
|
|
1766
1769
|
cx: "10",
|
|
1767
1770
|
cy: "10",
|
|
@@ -1809,57 +1812,57 @@ function Q(e) {
|
|
|
1809
1812
|
"stroke-linecap": "round",
|
|
1810
1813
|
"stroke-linejoin": "round",
|
|
1811
1814
|
"stroke-width": "1.8"
|
|
1812
|
-
},
|
|
1815
|
+
}, xr(e)));
|
|
1813
1816
|
}
|
|
1814
1817
|
function $(e) {
|
|
1815
1818
|
e.preventDefault();
|
|
1816
1819
|
}
|
|
1817
|
-
function
|
|
1818
|
-
let t =
|
|
1820
|
+
function Sr(e) {
|
|
1821
|
+
let t = $e(e);
|
|
1819
1822
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
1820
1823
|
}
|
|
1821
|
-
var
|
|
1822
|
-
bold:
|
|
1823
|
-
italic:
|
|
1824
|
-
underline:
|
|
1825
|
-
strike:
|
|
1826
|
-
"inline-code":
|
|
1827
|
-
link:
|
|
1828
|
-
more:
|
|
1829
|
-
superscript:
|
|
1830
|
-
subscript:
|
|
1831
|
-
"inline-math":
|
|
1832
|
-
"align-left":
|
|
1833
|
-
"align-center":
|
|
1834
|
-
"align-right":
|
|
1835
|
-
"align-justify":
|
|
1836
|
-
"decrease-indent":
|
|
1837
|
-
"increase-indent":
|
|
1838
|
-
},
|
|
1839
|
-
type:
|
|
1840
|
-
"heading-1":
|
|
1841
|
-
"heading-2":
|
|
1842
|
-
"heading-3":
|
|
1843
|
-
"bullet-list":
|
|
1844
|
-
"ordered-list":
|
|
1845
|
-
"task-list":
|
|
1846
|
-
blockquote:
|
|
1847
|
-
"code-block":
|
|
1848
|
-
info:
|
|
1849
|
-
tip:
|
|
1850
|
-
warning:
|
|
1851
|
-
error:
|
|
1852
|
-
success:
|
|
1853
|
-
emoji:
|
|
1854
|
-
math:
|
|
1855
|
-
table:
|
|
1856
|
-
separator:
|
|
1857
|
-
image:
|
|
1858
|
-
video:
|
|
1859
|
-
attachment:
|
|
1824
|
+
var Cr = {
|
|
1825
|
+
bold: gn,
|
|
1826
|
+
italic: In,
|
|
1827
|
+
underline: nr,
|
|
1828
|
+
strike: Yn,
|
|
1829
|
+
"inline-code": Cn,
|
|
1830
|
+
link: Rn,
|
|
1831
|
+
more: Un,
|
|
1832
|
+
superscript: Zn,
|
|
1833
|
+
subscript: Xn,
|
|
1834
|
+
"inline-math": qn,
|
|
1835
|
+
"align-left": pn,
|
|
1836
|
+
"align-center": dn,
|
|
1837
|
+
"align-right": mn,
|
|
1838
|
+
"align-justify": fn,
|
|
1839
|
+
"decrease-indent": Nn,
|
|
1840
|
+
"increase-indent": Pn
|
|
1841
|
+
}, wr = {
|
|
1842
|
+
type: $n,
|
|
1843
|
+
"heading-1": On,
|
|
1844
|
+
"heading-2": kn,
|
|
1845
|
+
"heading-3": An,
|
|
1846
|
+
"bullet-list": zn,
|
|
1847
|
+
"ordered-list": Vn,
|
|
1848
|
+
"task-list": Bn,
|
|
1849
|
+
blockquote: Gn,
|
|
1850
|
+
"code-block": _n,
|
|
1851
|
+
info: Fn,
|
|
1852
|
+
tip: Ln,
|
|
1853
|
+
warning: hn,
|
|
1854
|
+
error: Sn,
|
|
1855
|
+
success: yn,
|
|
1856
|
+
emoji: Jn,
|
|
1857
|
+
math: qn,
|
|
1858
|
+
table: Qn,
|
|
1859
|
+
separator: Hn,
|
|
1860
|
+
image: jn,
|
|
1861
|
+
video: ir,
|
|
1862
|
+
attachment: Wn
|
|
1860
1863
|
};
|
|
1861
|
-
function
|
|
1862
|
-
let t =
|
|
1864
|
+
function Tr(e) {
|
|
1865
|
+
let t = wr[e];
|
|
1863
1866
|
return B(t, {
|
|
1864
1867
|
size: 18,
|
|
1865
1868
|
strokeWidth: 1.6,
|
|
@@ -1867,21 +1870,21 @@ function br(e) {
|
|
|
1867
1870
|
"aria-hidden": "true"
|
|
1868
1871
|
});
|
|
1869
1872
|
}
|
|
1870
|
-
var
|
|
1871
|
-
paragraph:
|
|
1872
|
-
"heading-1":
|
|
1873
|
-
"heading-2":
|
|
1874
|
-
"heading-3":
|
|
1875
|
-
"bullet-list":
|
|
1876
|
-
"numbered-list":
|
|
1877
|
-
"todo-list":
|
|
1878
|
-
quote:
|
|
1879
|
-
"code-block":
|
|
1873
|
+
var Er = {
|
|
1874
|
+
paragraph: tr,
|
|
1875
|
+
"heading-1": On,
|
|
1876
|
+
"heading-2": kn,
|
|
1877
|
+
"heading-3": An,
|
|
1878
|
+
"bullet-list": zn,
|
|
1879
|
+
"numbered-list": Vn,
|
|
1880
|
+
"todo-list": Bn,
|
|
1881
|
+
quote: Gn,
|
|
1882
|
+
"code-block": _n
|
|
1880
1883
|
};
|
|
1881
|
-
function
|
|
1882
|
-
return
|
|
1884
|
+
function Dr(e, t) {
|
|
1885
|
+
return R(e, t).label;
|
|
1883
1886
|
}
|
|
1884
|
-
var
|
|
1887
|
+
var Or = J({
|
|
1885
1888
|
name: "MarkweaveVueFloatingToolbar",
|
|
1886
1889
|
props: {
|
|
1887
1890
|
editor: {
|
|
@@ -1898,44 +1901,66 @@ var Cr = J({
|
|
|
1898
1901
|
}
|
|
1899
1902
|
},
|
|
1900
1903
|
setup(e) {
|
|
1901
|
-
let t = V(null), n = V(""), r = V(null), i = V(null), a = V(
|
|
1904
|
+
let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() => $e(n.value.trim())), u = U(() => e.messages.floatingToolbar), d = U(() => oe(e.messages).map((e) => [
|
|
1902
1905
|
e.id,
|
|
1903
1906
|
e.label,
|
|
1904
|
-
|
|
1905
|
-
])),
|
|
1907
|
+
Er[e.id]
|
|
1908
|
+
])), f = U(() => ae(e.messages).map((e) => [
|
|
1906
1909
|
e.id,
|
|
1907
1910
|
e.value,
|
|
1908
1911
|
e.label
|
|
1909
|
-
])),
|
|
1912
|
+
])), p = U(() => re(e.messages).map((e) => [
|
|
1910
1913
|
e.id,
|
|
1911
1914
|
e.value,
|
|
1912
1915
|
e.label
|
|
1913
|
-
])),
|
|
1914
|
-
|
|
1915
|
-
},
|
|
1916
|
+
])), m = U(() => ie(e.messages).map((e) => e.id)), h = () => {
|
|
1917
|
+
l.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: l.value }).run(), t.value = null);
|
|
1918
|
+
}, g = () => {
|
|
1916
1919
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
1917
|
-
},
|
|
1920
|
+
}, _ = (r) => {
|
|
1918
1921
|
t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
|
|
1919
|
-
},
|
|
1920
|
-
|
|
1922
|
+
}, v = P(() => {
|
|
1923
|
+
let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
1924
|
+
if (!t.value || !n || !r) return;
|
|
1925
|
+
let s = z({
|
|
1926
|
+
toolbarRect: n.getBoundingClientRect(),
|
|
1927
|
+
popoverSize: r.getBoundingClientRect(),
|
|
1928
|
+
viewport: {
|
|
1929
|
+
width: window.innerWidth,
|
|
1930
|
+
height: window.innerHeight
|
|
1931
|
+
},
|
|
1932
|
+
frameRect: i?.getBoundingClientRect() ?? null,
|
|
1933
|
+
gap: t.value === "more" ? 8 : 6
|
|
1934
|
+
});
|
|
1935
|
+
a.value = s.placement;
|
|
1936
|
+
});
|
|
1937
|
+
W(t, (e) => {
|
|
1938
|
+
e && q(v.schedule);
|
|
1939
|
+
}), G(() => {
|
|
1940
|
+
window.addEventListener("resize", v.schedule), window.addEventListener("scroll", v.schedule, !0);
|
|
1941
|
+
}), K(() => {
|
|
1942
|
+
v.cancel(), window.removeEventListener("resize", v.schedule), window.removeEventListener("scroll", v.schedule, !0);
|
|
1943
|
+
});
|
|
1944
|
+
let y = (n) => n === "block-type" || n === "color" || n === "more" ? t.value === n : n === "bold" ? e.editor.isActive("bold") : n === "italic" ? e.editor.isActive("italic") : n === "underline" ? e.editor.isActive("underline") : n === "strike" ? e.editor.isActive("strike") : n === "inline-code" ? e.editor.isActive("code") : n === "link" ? e.editor.isActive("link") : !1, b = (e, t) => {
|
|
1945
|
+
if (r.value = e, !e || !(t instanceof HTMLElement) || !s.value) {
|
|
1921
1946
|
i.value = null;
|
|
1922
1947
|
return;
|
|
1923
1948
|
}
|
|
1924
|
-
let n = t.getBoundingClientRect(),
|
|
1925
|
-
i.value = n.left + n.width / 2 -
|
|
1926
|
-
},
|
|
1949
|
+
let n = t.getBoundingClientRect(), a = s.value.getBoundingClientRect();
|
|
1950
|
+
i.value = n.left + n.width / 2 - a.left;
|
|
1951
|
+
}, x = () => {
|
|
1927
1952
|
let e = r.value;
|
|
1928
1953
|
if (!e || t.value !== null) return null;
|
|
1929
|
-
let n =
|
|
1954
|
+
let n = u.value.buttons[e];
|
|
1930
1955
|
return n ? B("div", {
|
|
1931
1956
|
class: "markweave-floating-toolbar-tooltip",
|
|
1932
1957
|
role: "tooltip",
|
|
1933
1958
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
1934
1959
|
"data-button-id": e,
|
|
1935
|
-
"data-active":
|
|
1960
|
+
"data-active": y(e),
|
|
1936
1961
|
style: i.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${i.value}px` }
|
|
1937
1962
|
}, n) : null;
|
|
1938
|
-
},
|
|
1963
|
+
}, S = (n, i, a, o, s = !1, c) => B("button", {
|
|
1939
1964
|
type: "button",
|
|
1940
1965
|
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
1941
1966
|
"aria-label": i,
|
|
@@ -1948,16 +1973,16 @@ var Cr = J({
|
|
|
1948
1973
|
"data-active": s || t.value === n,
|
|
1949
1974
|
"data-tooltip-active": r.value === n ? "true" : "false",
|
|
1950
1975
|
"data-testid": `markweave-floating-toolbar-button-${n}`,
|
|
1951
|
-
onBlur: () =>
|
|
1952
|
-
onFocus: (e) =>
|
|
1976
|
+
onBlur: () => b(null),
|
|
1977
|
+
onFocus: (e) => b(n, e.currentTarget),
|
|
1953
1978
|
onMousedown: $,
|
|
1954
|
-
onMouseenter: (e) =>
|
|
1955
|
-
onMouseleave: () =>
|
|
1979
|
+
onMouseenter: (e) => b(n, e.currentTarget),
|
|
1980
|
+
onMouseleave: () => b(null),
|
|
1956
1981
|
onClick: o
|
|
1957
|
-
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" },
|
|
1982
|
+
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, Dr(e.editor, e.messages)), Z(t.value === "block-type" ? xn : bn, i)])] : n === "color" ? [B("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [B("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? xn : bn, i)])] : [Z(a, i)]), C = () => B("span", {
|
|
1958
1983
|
class: "markweave-floating-toolbar-divider",
|
|
1959
1984
|
"aria-hidden": "true"
|
|
1960
|
-
}),
|
|
1985
|
+
}), w = (n, r, i) => B("section", {
|
|
1961
1986
|
class: "markweave-floating-toolbar-color-section",
|
|
1962
1987
|
"aria-label": n
|
|
1963
1988
|
}, [B("div", { class: "markweave-floating-toolbar-menu-title" }, n), B("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => B("button", {
|
|
@@ -1976,27 +2001,29 @@ var Cr = J({
|
|
|
1976
2001
|
class: "markweave-floating-toolbar-highlight-swatch",
|
|
1977
2002
|
style: { backgroundColor: i ?? "#ffffff" },
|
|
1978
2003
|
"aria-hidden": "true"
|
|
1979
|
-
})])))]),
|
|
2004
|
+
})])))]), T = () => t.value === "block-type" ? B("div", {
|
|
2005
|
+
ref: c,
|
|
1980
2006
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
|
|
1981
2007
|
"data-testid": "markweave-floating-toolbar-turn-menu"
|
|
1982
|
-
}, [B("div", { class: "markweave-floating-toolbar-menu-title" },
|
|
2008
|
+
}, [B("div", { class: "markweave-floating-toolbar-menu-title" }, u.value.turnIntoTitle), ...d.value.map(([n, r, i]) => B("button", {
|
|
1983
2009
|
key: n,
|
|
1984
2010
|
type: "button",
|
|
1985
2011
|
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
1986
2012
|
onMousedown: $,
|
|
1987
2013
|
onClick: () => {
|
|
1988
|
-
|
|
2014
|
+
ce(e.editor, n), t.value = null;
|
|
1989
2015
|
}
|
|
1990
2016
|
}, [B("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), B("span", null, r)]))]) : t.value === "link" ? B("form", {
|
|
1991
2017
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
2018
|
+
ref: c,
|
|
1992
2019
|
"data-testid": "markweave-floating-toolbar-link-popover",
|
|
1993
2020
|
onSubmit: (e) => {
|
|
1994
|
-
e.preventDefault(),
|
|
2021
|
+
e.preventDefault(), h();
|
|
1995
2022
|
}
|
|
1996
2023
|
}, [B("input", {
|
|
1997
2024
|
value: n.value,
|
|
1998
|
-
placeholder:
|
|
1999
|
-
"aria-label":
|
|
2025
|
+
placeholder: u.value.linkPlaceholder,
|
|
2026
|
+
"aria-label": u.value.linkUrlLabel,
|
|
2000
2027
|
"data-testid": "markweave-floating-toolbar-link-input",
|
|
2001
2028
|
onInput: (e) => {
|
|
2002
2029
|
n.value = e.target.value;
|
|
@@ -2004,42 +2031,44 @@ var Cr = J({
|
|
|
2004
2031
|
}), B("span", { class: "markweave-floating-toolbar-link-actions" }, [
|
|
2005
2032
|
B("button", {
|
|
2006
2033
|
type: "submit",
|
|
2007
|
-
disabled: !
|
|
2008
|
-
"aria-label":
|
|
2034
|
+
disabled: !l.value,
|
|
2035
|
+
"aria-label": u.value.applyLink,
|
|
2009
2036
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2010
2037
|
onMousedown: $
|
|
2011
|
-
}, [Z(
|
|
2038
|
+
}, [Z(wn, u.value.applyLink)]),
|
|
2012
2039
|
B("span", {
|
|
2013
2040
|
class: "markweave-floating-toolbar-link-divider",
|
|
2014
2041
|
"aria-hidden": "true"
|
|
2015
2042
|
}),
|
|
2016
2043
|
B("button", {
|
|
2017
2044
|
type: "button",
|
|
2018
|
-
disabled: !
|
|
2019
|
-
"aria-label":
|
|
2045
|
+
disabled: !l.value,
|
|
2046
|
+
"aria-label": u.value.openLink,
|
|
2020
2047
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2021
2048
|
onMousedown: $,
|
|
2022
|
-
onClick: () =>
|
|
2023
|
-
}, [Z(
|
|
2049
|
+
onClick: () => Sr(n.value)
|
|
2050
|
+
}, [Z(Dn, u.value.openLink)]),
|
|
2024
2051
|
B("button", {
|
|
2025
2052
|
type: "button",
|
|
2026
|
-
"aria-label":
|
|
2053
|
+
"aria-label": u.value.removeLink,
|
|
2027
2054
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2028
2055
|
onMousedown: $,
|
|
2029
|
-
onClick:
|
|
2030
|
-
}, [Z(
|
|
2056
|
+
onClick: g
|
|
2057
|
+
}, [Z(er, u.value.removeLink)])
|
|
2031
2058
|
])]) : t.value === "color" ? B("div", {
|
|
2059
|
+
ref: c,
|
|
2032
2060
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
2033
2061
|
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
2034
|
-
}, [
|
|
2062
|
+
}, [w(u.value.textColorTitle, "text", f.value), w(u.value.highlightColorTitle, "highlight", p.value)]) : t.value === "more" ? B("div", {
|
|
2063
|
+
ref: c,
|
|
2035
2064
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
2036
2065
|
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
2037
|
-
},
|
|
2066
|
+
}, m.value.map((n) => B("span", {
|
|
2038
2067
|
key: n,
|
|
2039
2068
|
class: "markweave-floating-toolbar-more-item"
|
|
2040
2069
|
}, [B("button", {
|
|
2041
2070
|
type: "button",
|
|
2042
|
-
"aria-label":
|
|
2071
|
+
"aria-label": u.value.moreActions[n],
|
|
2043
2072
|
"data-testid": `markweave-floating-toolbar-more-${n}`,
|
|
2044
2073
|
"data-tooltip-active": r.value === n ? "true" : "false",
|
|
2045
2074
|
onMousedown: $,
|
|
@@ -2050,41 +2079,43 @@ var Cr = J({
|
|
|
2050
2079
|
r.value = null;
|
|
2051
2080
|
},
|
|
2052
2081
|
onClick: () => {
|
|
2053
|
-
|
|
2082
|
+
se(e.editor, n), t.value = null;
|
|
2054
2083
|
}
|
|
2055
|
-
}, [Z(
|
|
2084
|
+
}, [Z(Cr[n], u.value.moreActions[n])]), r.value === n ? B("div", {
|
|
2056
2085
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2057
2086
|
role: "tooltip"
|
|
2058
|
-
},
|
|
2087
|
+
}, u.value.moreActions[n]) : null]))) : null;
|
|
2059
2088
|
return () => B(N, {
|
|
2060
2089
|
editor: e.editor,
|
|
2061
|
-
shouldShow: ({ editor: e }) => e.isEditable &&
|
|
2090
|
+
shouldShow: ({ editor: e }) => e.isEditable && me(fe(e)),
|
|
2062
2091
|
options: { placement: "top" }
|
|
2063
2092
|
}, { default: () => B("div", {
|
|
2093
|
+
ref: o,
|
|
2064
2094
|
class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
|
|
2095
|
+
"data-popover-placement": t.value ? a.value : void 0,
|
|
2065
2096
|
"data-testid": "markweave-floating-toolbar"
|
|
2066
2097
|
}, [B("div", {
|
|
2067
|
-
ref:
|
|
2098
|
+
ref: s,
|
|
2068
2099
|
class: "markweave-floating-toolbar-content",
|
|
2069
2100
|
"data-menu": t.value ?? "none"
|
|
2070
2101
|
}, [
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2102
|
+
S("block-type", u.value.buttons["block-type"], tr, () => _("block-type"), t.value === "block-type"),
|
|
2103
|
+
C(),
|
|
2104
|
+
S("bold", u.value.buttons.bold, gn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2105
|
+
S("italic", u.value.buttons.italic, In, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2106
|
+
S("underline", u.value.buttons.underline, nr, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2107
|
+
S("strike", u.value.buttons.strike, Yn, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2108
|
+
S("inline-code", u.value.buttons["inline-code"], Cn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2109
|
+
C(),
|
|
2110
|
+
S("link", u.value.buttons.link, Rn, () => _("link"), e.editor.isActive("link")),
|
|
2111
|
+
S("color", u.value.buttons.color, tr, () => _("color"), t.value === "color"),
|
|
2112
|
+
C(),
|
|
2113
|
+
S("more", u.value.buttons.more, Un, () => _("more"), t.value === "more"),
|
|
2114
|
+
T(),
|
|
2115
|
+
x()
|
|
2085
2116
|
])]) });
|
|
2086
2117
|
}
|
|
2087
|
-
}),
|
|
2118
|
+
}), kr = J({
|
|
2088
2119
|
name: "MarkweaveVueMathEditorPopover",
|
|
2089
2120
|
props: {
|
|
2090
2121
|
editor: {
|
|
@@ -2105,17 +2136,17 @@ var Cr = J({
|
|
|
2105
2136
|
}
|
|
2106
2137
|
},
|
|
2107
2138
|
setup(e) {
|
|
2108
|
-
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(
|
|
2139
|
+
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(it(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
|
|
2109
2140
|
html: a.value,
|
|
2110
2141
|
error: !1
|
|
2111
|
-
} :
|
|
2142
|
+
} : ct(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => rt(e.editor, e.target) ?? 1), u = () => {
|
|
2112
2143
|
if (typeof window > "u") return;
|
|
2113
|
-
let r =
|
|
2144
|
+
let r = nt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2114
2145
|
if (!r || !i) {
|
|
2115
2146
|
e.onClose();
|
|
2116
2147
|
return;
|
|
2117
2148
|
}
|
|
2118
|
-
n.value =
|
|
2149
|
+
n.value = tt({
|
|
2119
2150
|
anchorRect: r,
|
|
2120
2151
|
frameRect: i,
|
|
2121
2152
|
kind: e.target.kind,
|
|
@@ -2124,7 +2155,7 @@ var Cr = J({
|
|
|
2124
2155
|
viewportWidth: window.innerWidth
|
|
2125
2156
|
});
|
|
2126
2157
|
}, d = () => {
|
|
2127
|
-
s.value &&
|
|
2158
|
+
s.value && et(e.editor, e.target, t.value) && e.onClose();
|
|
2128
2159
|
}, f = (t) => {
|
|
2129
2160
|
if (t.key === "Escape") {
|
|
2130
2161
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -2136,13 +2167,13 @@ var Cr = J({
|
|
|
2136
2167
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2137
2168
|
};
|
|
2138
2169
|
return W(() => [e.target.pos, e.target.latex], () => {
|
|
2139
|
-
t.value = e.target.latex, a.value =
|
|
2170
|
+
t.value = e.target.latex, a.value = it(e.editor, e.target), q(u);
|
|
2140
2171
|
}), G(() => {
|
|
2141
|
-
|
|
2172
|
+
lt(e.editor, e.target, !0), u(), q(() => {
|
|
2142
2173
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2143
2174
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2144
2175
|
}), K(() => {
|
|
2145
|
-
|
|
2176
|
+
lt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2146
2177
|
}), () => {
|
|
2147
2178
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2148
2179
|
ref: i,
|
|
@@ -2203,14 +2234,14 @@ var Cr = J({
|
|
|
2203
2234
|
}, [
|
|
2204
2235
|
B("div", { class: "markweave-math-block-toolbar" }, [
|
|
2205
2236
|
B("span", null, c.value.label),
|
|
2206
|
-
Z(
|
|
2237
|
+
Z(Cn, c.value.label, 15, 1.75),
|
|
2207
2238
|
B("button", {
|
|
2208
2239
|
type: "submit",
|
|
2209
2240
|
title: c.value.apply,
|
|
2210
2241
|
"aria-label": c.value.apply,
|
|
2211
2242
|
disabled: !s.value,
|
|
2212
2243
|
"data-testid": "markweave-math-editor-apply"
|
|
2213
|
-
}, [Z(
|
|
2244
|
+
}, [Z(yn, c.value.apply, 16, 2)])
|
|
2214
2245
|
]),
|
|
2215
2246
|
B("label", {
|
|
2216
2247
|
class: "markweave-math-block-source",
|
|
@@ -2233,7 +2264,7 @@ var Cr = J({
|
|
|
2233
2264
|
]);
|
|
2234
2265
|
};
|
|
2235
2266
|
}
|
|
2236
|
-
}),
|
|
2267
|
+
}), Ar = J({
|
|
2237
2268
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2238
2269
|
props: {
|
|
2239
2270
|
commands: {
|
|
@@ -2419,7 +2450,7 @@ var Cr = J({
|
|
|
2419
2450
|
class: "markweave-slash-group",
|
|
2420
2451
|
"aria-label": t.group
|
|
2421
2452
|
}, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
2422
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
2453
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = _t(t);
|
|
2423
2454
|
return B("button", {
|
|
2424
2455
|
key: t.id,
|
|
2425
2456
|
type: "button",
|
|
@@ -2442,7 +2473,7 @@ var Cr = J({
|
|
|
2442
2473
|
}
|
|
2443
2474
|
}
|
|
2444
2475
|
}, [
|
|
2445
|
-
|
|
2476
|
+
Tr(t.icon),
|
|
2446
2477
|
B("span", null, t.label),
|
|
2447
2478
|
t.disabledReason ? B("small", null, t.disabledReason) : null
|
|
2448
2479
|
]);
|
|
@@ -2453,7 +2484,7 @@ var Cr = J({
|
|
|
2453
2484
|
}, e.messages.slash.noResults)])]);
|
|
2454
2485
|
};
|
|
2455
2486
|
}
|
|
2456
|
-
}),
|
|
2487
|
+
}), jr = J({
|
|
2457
2488
|
name: "MarkweaveVueTableControls",
|
|
2458
2489
|
props: {
|
|
2459
2490
|
editor: {
|
|
@@ -2486,12 +2517,12 @@ var Cr = J({
|
|
|
2486
2517
|
}
|
|
2487
2518
|
},
|
|
2488
2519
|
setup(e) {
|
|
2489
|
-
let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ?
|
|
2520
|
+
let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ? Ot(e.editor.state) : _r), h = U(() => Bt(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => Bt(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Rt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? Wt(e.editor, t.value) : []), b = () => {
|
|
2490
2521
|
p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
|
|
2491
2522
|
}, x = (e) => {
|
|
2492
2523
|
b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
|
|
2493
2524
|
s.value = null, p = null;
|
|
2494
|
-
},
|
|
2525
|
+
}, Jt));
|
|
2495
2526
|
}, S = () => {
|
|
2496
2527
|
if (!e.active) {
|
|
2497
2528
|
r.value = null, i.value = null, a.value = null, x(null);
|
|
@@ -2502,16 +2533,16 @@ var Cr = J({
|
|
|
2502
2533
|
r.value = null, i.value = null, a.value = null;
|
|
2503
2534
|
return;
|
|
2504
2535
|
}
|
|
2505
|
-
let s = o.getBoundingClientRect(), c = h.value ?
|
|
2506
|
-
c ? r.value =
|
|
2536
|
+
let s = o.getBoundingClientRect(), c = h.value ? zt(e.editor, h.value) : null, l = g.value ? zt(e.editor, g.value) : null, u = v.value ? Gt(e.editor) : null;
|
|
2537
|
+
c ? r.value = Nt({
|
|
2507
2538
|
targetRect: c,
|
|
2508
2539
|
frameRect: s,
|
|
2509
2540
|
kind: "row"
|
|
2510
|
-
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value =
|
|
2541
|
+
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Nt({
|
|
2511
2542
|
targetRect: l,
|
|
2512
2543
|
frameRect: s,
|
|
2513
2544
|
kind: "column"
|
|
2514
|
-
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value =
|
|
2545
|
+
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Nt({
|
|
2515
2546
|
targetRect: u,
|
|
2516
2547
|
frameRect: s,
|
|
2517
2548
|
kind: "selection"
|
|
@@ -2526,13 +2557,13 @@ var Cr = J({
|
|
|
2526
2557
|
o.value = null;
|
|
2527
2558
|
return;
|
|
2528
2559
|
}
|
|
2529
|
-
let a = i.getBoundingClientRect(), s = t.value === "row" ?
|
|
2560
|
+
let a = i.getBoundingClientRect(), s = t.value === "row" ? Lt(e.editor)?.getBoundingClientRect() : null, c = s ? {
|
|
2530
2561
|
left: a.left,
|
|
2531
2562
|
top: s.top,
|
|
2532
2563
|
width: a.width,
|
|
2533
2564
|
height: a.height
|
|
2534
2565
|
} : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
|
|
2535
|
-
o.value =
|
|
2566
|
+
o.value = Mt({
|
|
2536
2567
|
anchorRect: c,
|
|
2537
2568
|
frameRect: p,
|
|
2538
2569
|
menuSize: {
|
|
@@ -2549,16 +2580,16 @@ var Cr = J({
|
|
|
2549
2580
|
let i = t.value === e && n.value === r;
|
|
2550
2581
|
n.value = r, t.value = i ? null : e, T();
|
|
2551
2582
|
}, D = () => {
|
|
2552
|
-
e.editor.view.dispatch(
|
|
2583
|
+
e.editor.view.dispatch(Tt(e.editor.state.tr, null));
|
|
2553
2584
|
}, O = (t, n) => {
|
|
2554
2585
|
let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
2555
|
-
r !== null &&
|
|
2586
|
+
r !== null && qt(e.editor, r, t, { visualIndex: i }), E(t, n);
|
|
2556
2587
|
}, k = () => {
|
|
2557
2588
|
D(), E("selection", "selection-edge");
|
|
2558
2589
|
}, A = (n = !1) => {
|
|
2559
2590
|
t.value = null, o.value = null, n && e.editor.view.focus();
|
|
2560
2591
|
}, j = async (n, r) => {
|
|
2561
|
-
let i = await
|
|
2592
|
+
let i = await Ft({
|
|
2562
2593
|
editor: e.editor,
|
|
2563
2594
|
commandId: n,
|
|
2564
2595
|
menu: r ?? t.value ?? "selection",
|
|
@@ -2566,7 +2597,7 @@ var Cr = J({
|
|
|
2566
2597
|
});
|
|
2567
2598
|
return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
2568
2599
|
}, M = (t) => {
|
|
2569
|
-
let n =
|
|
2600
|
+
let n = Vt(e.editor, t);
|
|
2570
2601
|
n && e.onEditWithAi?.(n), A(!0);
|
|
2571
2602
|
}, N = (e) => {
|
|
2572
2603
|
!t.value || e.key !== "Escape" || A(!0);
|
|
@@ -2588,11 +2619,11 @@ var Cr = J({
|
|
|
2588
2619
|
t.value,
|
|
2589
2620
|
n.value
|
|
2590
2621
|
], T, { flush: "post" });
|
|
2591
|
-
let
|
|
2622
|
+
let P = () => t.value ? B("div", {
|
|
2592
2623
|
ref: f,
|
|
2593
2624
|
class: "markweave-table-menu",
|
|
2594
2625
|
role: "menu",
|
|
2595
|
-
"aria-label":
|
|
2626
|
+
"aria-label": Yt(t.value, e.messages),
|
|
2596
2627
|
"data-testid": "markweave-table-menu",
|
|
2597
2628
|
"data-positioned": o.value ? "true" : "false",
|
|
2598
2629
|
style: o.value ? {
|
|
@@ -2600,7 +2631,7 @@ var Cr = J({
|
|
|
2600
2631
|
top: `${o.value.top}px`
|
|
2601
2632
|
} : void 0
|
|
2602
2633
|
}, y.value.map((n, r) => {
|
|
2603
|
-
let i =
|
|
2634
|
+
let i = Ht(n), a = r === 0 ? i : Ht(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Pt(e.editor, n.commandId), c = Ut(n, e.messages);
|
|
2604
2635
|
return B("button", {
|
|
2605
2636
|
key: `${n.id}-${r}`,
|
|
2606
2637
|
type: "button",
|
|
@@ -2640,7 +2671,7 @@ var Cr = J({
|
|
|
2640
2671
|
"data-copy-kind": s.value.kind,
|
|
2641
2672
|
"data-text-length": s.value.textLength,
|
|
2642
2673
|
"data-html-length": s.value.htmlLength
|
|
2643
|
-
},
|
|
2674
|
+
}, It(s.value)) : null,
|
|
2644
2675
|
r.value ? B("button", {
|
|
2645
2676
|
ref: l,
|
|
2646
2677
|
type: "button",
|
|
@@ -2697,10 +2728,10 @@ var Cr = J({
|
|
|
2697
2728
|
onMousedown: $,
|
|
2698
2729
|
onClick: k
|
|
2699
2730
|
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2700
|
-
|
|
2731
|
+
P()
|
|
2701
2732
|
]) : null;
|
|
2702
2733
|
}
|
|
2703
|
-
}),
|
|
2734
|
+
}), Mr = J({
|
|
2704
2735
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
2705
2736
|
props: {
|
|
2706
2737
|
editor: {
|
|
@@ -2718,7 +2749,7 @@ var Cr = J({
|
|
|
2718
2749
|
t.value = null;
|
|
2719
2750
|
return;
|
|
2720
2751
|
}
|
|
2721
|
-
t.value =
|
|
2752
|
+
t.value = Kt(e.editor, kt(e.editor.state));
|
|
2722
2753
|
};
|
|
2723
2754
|
return G(() => {
|
|
2724
2755
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
@@ -2756,7 +2787,7 @@ var Cr = J({
|
|
|
2756
2787
|
}) : null;
|
|
2757
2788
|
};
|
|
2758
2789
|
}
|
|
2759
|
-
}),
|
|
2790
|
+
}), Nr = J({
|
|
2760
2791
|
name: "MarkweaveVueCodeBlockControls",
|
|
2761
2792
|
props: {
|
|
2762
2793
|
editor: {
|
|
@@ -2789,112 +2820,112 @@ var Cr = J({
|
|
|
2789
2820
|
active: !1,
|
|
2790
2821
|
lastX: 0,
|
|
2791
2822
|
lastY: 0
|
|
2792
|
-
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value,
|
|
2823
|
+
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, Ge(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
2793
2824
|
...e.state,
|
|
2794
2825
|
pos: e.state.pos,
|
|
2795
2826
|
active: !0
|
|
2796
|
-
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() =>
|
|
2827
|
+
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => Ye(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), D = U(() => !e.readOnly), O = U(() => S.value ? ze(S.value.language) : ze("text")), k = U(() => u.value?.status ?? "idle"), A = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), j = U(() => w.value && A.value === "preview"), M = U(() => (v.value, g.value, _.value, qe(e.editor))), N = U(() => `${_.value}|${M.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), ee = U(() => Ue(l.value)), P = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), te = () => {
|
|
2797
2828
|
y !== null && (window.clearTimeout(y), y = null);
|
|
2798
2829
|
}, F = (e) => {
|
|
2799
|
-
|
|
2830
|
+
te(), u.value = e, e && (y = window.setTimeout(() => {
|
|
2800
2831
|
u.value = null, y = null;
|
|
2801
|
-
},
|
|
2802
|
-
},
|
|
2832
|
+
}, Ne));
|
|
2833
|
+
}, ne = () => {
|
|
2803
2834
|
f.value = null, p.value = null, m.value = !1, h.value = {
|
|
2804
2835
|
active: !1,
|
|
2805
2836
|
lastX: 0,
|
|
2806
2837
|
lastY: 0
|
|
2807
2838
|
}, e.editor.view.focus();
|
|
2808
|
-
},
|
|
2839
|
+
}, I = () => {
|
|
2809
2840
|
let n = t.value;
|
|
2810
2841
|
if (!n) return;
|
|
2811
|
-
if (!
|
|
2842
|
+
if (!Ke(n) || M.value.length === 0) {
|
|
2812
2843
|
o.value = [];
|
|
2813
2844
|
return;
|
|
2814
2845
|
}
|
|
2815
2846
|
let r = n.getBoundingClientRect(), i = M.value.flatMap((t) => {
|
|
2816
|
-
let n =
|
|
2817
|
-
return n ? [
|
|
2847
|
+
let n = He(Ve(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
2848
|
+
return n ? [Le(t, n, r)] : [];
|
|
2818
2849
|
});
|
|
2819
|
-
o.value =
|
|
2820
|
-
},
|
|
2850
|
+
o.value = Xe(o.value, i, M.value.map((e) => e.pos));
|
|
2851
|
+
}, L = () => {
|
|
2821
2852
|
if (!E.value || !S.value) {
|
|
2822
2853
|
a.value = null, s.value = null;
|
|
2823
2854
|
return;
|
|
2824
2855
|
}
|
|
2825
2856
|
let r = t.value;
|
|
2826
2857
|
if (!r) return;
|
|
2827
|
-
let i =
|
|
2858
|
+
let i = Ve(e.editor, S.value.pos, A.value), o = r.getBoundingClientRect(), l = He(i, o);
|
|
2828
2859
|
if (!l) {
|
|
2829
2860
|
a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
|
|
2830
2861
|
return;
|
|
2831
2862
|
}
|
|
2832
|
-
if (a.value =
|
|
2863
|
+
if (a.value = Fe(S.value.pos, l, o), c.value && n.value) {
|
|
2833
2864
|
let e = n.value.getBoundingClientRect();
|
|
2834
|
-
s.value =
|
|
2865
|
+
s.value = je({
|
|
2835
2866
|
overlayRect: o,
|
|
2836
2867
|
buttonRect: e,
|
|
2837
2868
|
windowWidth: window.innerWidth,
|
|
2838
2869
|
windowHeight: window.innerHeight
|
|
2839
2870
|
});
|
|
2840
2871
|
}
|
|
2841
|
-
},
|
|
2872
|
+
}, R = async () => {
|
|
2842
2873
|
if (e.readOnly) {
|
|
2843
2874
|
if (!S.value) return;
|
|
2844
|
-
let e = await
|
|
2845
|
-
F(
|
|
2875
|
+
let e = await Pe(S.value.text);
|
|
2876
|
+
F(Ee(S.value, e ? "copied" : "failed"));
|
|
2846
2877
|
return;
|
|
2847
2878
|
}
|
|
2848
|
-
if (!
|
|
2849
|
-
let t = await
|
|
2850
|
-
F(
|
|
2879
|
+
if (!Re(e.editor, S.value)) return;
|
|
2880
|
+
let t = await we(e.editor);
|
|
2881
|
+
F(Ee(Te(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
2851
2882
|
}, re = (t, n) => {
|
|
2852
2883
|
if (e.readOnly) {
|
|
2853
|
-
|
|
2884
|
+
mt(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
|
|
2854
2885
|
return;
|
|
2855
2886
|
}
|
|
2856
2887
|
let r = e.state.active && e.state.pos === t.pos;
|
|
2857
|
-
|
|
2858
|
-
},
|
|
2888
|
+
Ae(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
|
|
2889
|
+
}, ie = (t) => {
|
|
2859
2890
|
if (e.readOnly || !S.value) return;
|
|
2860
2891
|
let n = e.state.active && e.state.pos === S.value.pos;
|
|
2861
|
-
|
|
2862
|
-
}, ie = () => {
|
|
2863
|
-
e.readOnly || !S.value || Ce(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
2892
|
+
ke(e.editor, S.value.pos, t) && (t === "mermaid" && Ae(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
|
|
2864
2893
|
}, ae = () => {
|
|
2894
|
+
e.readOnly || !S.value || Oe(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
2895
|
+
}, oe = () => {
|
|
2865
2896
|
if (!S.value) return;
|
|
2866
|
-
let t =
|
|
2897
|
+
let t = Je(e.editor, S.value.pos);
|
|
2867
2898
|
if (!t) return;
|
|
2868
2899
|
let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
2869
2900
|
i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
|
|
2870
|
-
},
|
|
2901
|
+
}, se = () => {
|
|
2871
2902
|
if (!S.value) return;
|
|
2872
|
-
let t =
|
|
2873
|
-
t && (f.value =
|
|
2903
|
+
let t = Je(e.editor, S.value.pos);
|
|
2904
|
+
t && (f.value = Ie(t), p.value = null, m.value = !1, h.value = {
|
|
2874
2905
|
active: !1,
|
|
2875
2906
|
lastX: 0,
|
|
2876
2907
|
lastY: 0
|
|
2877
2908
|
});
|
|
2878
|
-
},
|
|
2909
|
+
}, ce = (e) => {
|
|
2879
2910
|
f.value = f.value ? {
|
|
2880
2911
|
...f.value,
|
|
2881
|
-
scale:
|
|
2912
|
+
scale: Me(f.value.scale + e)
|
|
2882
2913
|
} : null;
|
|
2883
|
-
},
|
|
2884
|
-
f.value = f.value ?
|
|
2914
|
+
}, le = () => {
|
|
2915
|
+
f.value = f.value ? Ie(f.value.svg) : null, h.value = {
|
|
2885
2916
|
active: !1,
|
|
2886
2917
|
lastX: 0,
|
|
2887
2918
|
lastY: 0
|
|
2888
2919
|
}, m.value = !1;
|
|
2889
|
-
}, le = (e) => {
|
|
2890
|
-
e.preventDefault(), se(e.deltaY < 0 ? Ke : -Ke);
|
|
2891
2920
|
}, ue = (e) => {
|
|
2921
|
+
e.preventDefault(), ce(e.deltaY < 0 ? Ze : -Ze);
|
|
2922
|
+
}, de = (e) => {
|
|
2892
2923
|
e.button === 0 && (e.preventDefault(), h.value = {
|
|
2893
2924
|
active: !0,
|
|
2894
2925
|
lastX: e.clientX,
|
|
2895
2926
|
lastY: e.clientY
|
|
2896
2927
|
}, m.value = !0);
|
|
2897
|
-
},
|
|
2928
|
+
}, z = (e) => {
|
|
2898
2929
|
let t = h.value;
|
|
2899
2930
|
if (!t.active) return;
|
|
2900
2931
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
@@ -2902,7 +2933,7 @@ var Cr = J({
|
|
|
2902
2933
|
active: !0,
|
|
2903
2934
|
lastX: e.clientX,
|
|
2904
2935
|
lastY: e.clientY
|
|
2905
|
-
}, f.value =
|
|
2936
|
+
}, f.value = Qe(f.value, n, r);
|
|
2906
2937
|
}, fe = () => {
|
|
2907
2938
|
h.value = {
|
|
2908
2939
|
active: !1,
|
|
@@ -2912,10 +2943,10 @@ var Cr = J({
|
|
|
2912
2943
|
};
|
|
2913
2944
|
W(() => e.readOnly, (e) => {
|
|
2914
2945
|
e && (c.value = !1, l.value = "");
|
|
2915
|
-
}), W(
|
|
2946
|
+
}), W(P, () => {
|
|
2916
2947
|
F(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
|
|
2917
2948
|
}), W(c, async (e) => {
|
|
2918
|
-
e && (await q(),
|
|
2949
|
+
e && (await q(), L(), r.value?.focus({ preventScroll: !0 }));
|
|
2919
2950
|
}), W(() => [
|
|
2920
2951
|
E.value,
|
|
2921
2952
|
g.value,
|
|
@@ -2923,12 +2954,12 @@ var Cr = J({
|
|
|
2923
2954
|
c.value,
|
|
2924
2955
|
A.value
|
|
2925
2956
|
], async () => {
|
|
2926
|
-
await q(),
|
|
2957
|
+
await q(), L();
|
|
2927
2958
|
}, {
|
|
2928
2959
|
flush: "post",
|
|
2929
2960
|
immediate: !0
|
|
2930
2961
|
}), W(N, async () => {
|
|
2931
|
-
await q(),
|
|
2962
|
+
await q(), I(), window.requestAnimationFrame(I);
|
|
2932
2963
|
}, {
|
|
2933
2964
|
flush: "post",
|
|
2934
2965
|
immediate: !0
|
|
@@ -2938,14 +2969,14 @@ var Cr = J({
|
|
|
2938
2969
|
q(() => {
|
|
2939
2970
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
2940
2971
|
if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
|
|
2941
|
-
let r =
|
|
2972
|
+
let r = We(e.editor, n.target), a = Ge(e.editor, r), o = a && !Ye(e.editor, a) ? a.pos : null;
|
|
2942
2973
|
i.value = i.value === o ? i.value : o;
|
|
2943
2974
|
}, a = () => {
|
|
2944
2975
|
c.value || (i.value = null);
|
|
2945
2976
|
}, o = (t) => {
|
|
2946
2977
|
if (t.key === "Escape") {
|
|
2947
2978
|
if (f.value) {
|
|
2948
|
-
|
|
2979
|
+
ne();
|
|
2949
2980
|
return;
|
|
2950
2981
|
}
|
|
2951
2982
|
c.value && (c.value = !1, e.editor.view.focus());
|
|
@@ -2953,14 +2984,14 @@ var Cr = J({
|
|
|
2953
2984
|
}, s = (e) => {
|
|
2954
2985
|
c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
|
|
2955
2986
|
}, l = ({ transaction: e }) => {
|
|
2956
|
-
e.getMeta(
|
|
2987
|
+
e.getMeta(Ce) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Ce) || ft(e)) && (v.value += 1);
|
|
2957
2988
|
};
|
|
2958
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize",
|
|
2959
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize",
|
|
2989
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", L), window.addEventListener("scroll", L, !0), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), pe = () => {
|
|
2990
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", L), window.removeEventListener("scroll", L, !0), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), te();
|
|
2960
2991
|
};
|
|
2961
2992
|
});
|
|
2962
2993
|
}), K(() => {
|
|
2963
|
-
pe?.(), pe = null,
|
|
2994
|
+
pe?.(), pe = null, te();
|
|
2964
2995
|
}), () => {
|
|
2965
2996
|
if (!E.value && M.value.length === 0 && !f.value) return null;
|
|
2966
2997
|
let i = a.value ? {
|
|
@@ -3031,7 +3062,7 @@ var Cr = J({
|
|
|
3031
3062
|
"data-testid": "markweave-codeblock-collapse",
|
|
3032
3063
|
"data-collapsed": T.value ? "true" : "false",
|
|
3033
3064
|
onMousedown: $,
|
|
3034
|
-
onClick:
|
|
3065
|
+
onClick: ae
|
|
3035
3066
|
}, [Q("chevron")]) : null,
|
|
3036
3067
|
B("span", { class: "markweave-codeblock-copy-wrap" }, [B("button", {
|
|
3037
3068
|
type: "button",
|
|
@@ -3053,7 +3084,7 @@ var Cr = J({
|
|
|
3053
3084
|
d.value = !1;
|
|
3054
3085
|
},
|
|
3055
3086
|
onClick: () => {
|
|
3056
|
-
|
|
3087
|
+
R();
|
|
3057
3088
|
}
|
|
3058
3089
|
}, [Q(k.value === "copied" ? "check" : "clipboard")]), d.value ? B("span", {
|
|
3059
3090
|
class: "markweave-codeblock-tooltip",
|
|
@@ -3070,7 +3101,7 @@ var Cr = J({
|
|
|
3070
3101
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
3071
3102
|
disabled: !j.value,
|
|
3072
3103
|
onMousedown: $,
|
|
3073
|
-
onClick:
|
|
3104
|
+
onClick: se
|
|
3074
3105
|
}, [Q("expand")]), B("button", {
|
|
3075
3106
|
type: "button",
|
|
3076
3107
|
class: "markweave-codeblock-icon-button",
|
|
@@ -3078,7 +3109,7 @@ var Cr = J({
|
|
|
3078
3109
|
"data-testid": "markweave-mermaid-download",
|
|
3079
3110
|
disabled: !j.value,
|
|
3080
3111
|
onMousedown: $,
|
|
3081
|
-
onClick:
|
|
3112
|
+
onClick: oe
|
|
3082
3113
|
}, [Q("download")])]) : null
|
|
3083
3114
|
]) : null,
|
|
3084
3115
|
D.value && E.value && c.value && S.value ? B("div", {
|
|
@@ -3109,7 +3140,7 @@ var Cr = J({
|
|
|
3109
3140
|
"data-testid": `markweave-codeblock-language-option-${e.language}`,
|
|
3110
3141
|
"data-active": t ? "true" : "false",
|
|
3111
3142
|
onMousedown: $,
|
|
3112
|
-
onClick: () =>
|
|
3143
|
+
onClick: () => ie(e.language)
|
|
3113
3144
|
}, [B("span", null, e.label), t ? Q("check") : null]);
|
|
3114
3145
|
}))]) : null,
|
|
3115
3146
|
f.value ? B("div", {
|
|
@@ -3140,12 +3171,12 @@ var Cr = J({
|
|
|
3140
3171
|
onBlur: () => {
|
|
3141
3172
|
p.value = null;
|
|
3142
3173
|
},
|
|
3143
|
-
onClick: () =>
|
|
3174
|
+
onClick: () => ce(-Ze)
|
|
3144
3175
|
}, [Q("zoomOut")]),
|
|
3145
3176
|
B("span", {
|
|
3146
3177
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3147
3178
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3148
|
-
},
|
|
3179
|
+
}, Be(f.value.scale)),
|
|
3149
3180
|
B("button", {
|
|
3150
3181
|
type: "button",
|
|
3151
3182
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -3163,7 +3194,7 @@ var Cr = J({
|
|
|
3163
3194
|
onBlur: () => {
|
|
3164
3195
|
p.value = null;
|
|
3165
3196
|
},
|
|
3166
|
-
onClick: () =>
|
|
3197
|
+
onClick: () => ce(Ze)
|
|
3167
3198
|
}, [Q("zoomIn")]),
|
|
3168
3199
|
B("button", {
|
|
3169
3200
|
type: "button",
|
|
@@ -3182,7 +3213,7 @@ var Cr = J({
|
|
|
3182
3213
|
onBlur: () => {
|
|
3183
3214
|
p.value = null;
|
|
3184
3215
|
},
|
|
3185
|
-
onClick:
|
|
3216
|
+
onClick: le
|
|
3186
3217
|
}, [Q("reset")]),
|
|
3187
3218
|
p.value ? B("span", {
|
|
3188
3219
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
@@ -3195,15 +3226,15 @@ var Cr = J({
|
|
|
3195
3226
|
class: "markweave-mermaid-fullscreen-close",
|
|
3196
3227
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
3197
3228
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3198
|
-
onClick:
|
|
3229
|
+
onClick: ne
|
|
3199
3230
|
}, [Q("close")]),
|
|
3200
3231
|
B("div", {
|
|
3201
3232
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
3202
3233
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
3203
3234
|
"data-dragging": m.value ? "true" : "false",
|
|
3204
|
-
onWheel:
|
|
3205
|
-
onMousedown:
|
|
3206
|
-
onMousemove:
|
|
3235
|
+
onWheel: ue,
|
|
3236
|
+
onMousedown: de,
|
|
3237
|
+
onMousemove: z,
|
|
3207
3238
|
onMouseup: fe,
|
|
3208
3239
|
onMouseleave: fe
|
|
3209
3240
|
}, [B("div", {
|
|
@@ -3222,7 +3253,7 @@ var Cr = J({
|
|
|
3222
3253
|
]);
|
|
3223
3254
|
};
|
|
3224
3255
|
}
|
|
3225
|
-
}),
|
|
3256
|
+
}), Pr = J({
|
|
3226
3257
|
name: "MarkweaveVueInnerToc",
|
|
3227
3258
|
props: {
|
|
3228
3259
|
editor: {
|
|
@@ -3248,7 +3279,7 @@ var Cr = J({
|
|
|
3248
3279
|
},
|
|
3249
3280
|
setup(e) {
|
|
3250
3281
|
let t = V(null), n, r = () => {
|
|
3251
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
3282
|
+
n?.(), n = e.placement === "container" && t.value ? xe(t.value) : void 0;
|
|
3252
3283
|
};
|
|
3253
3284
|
return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
|
|
3254
3285
|
ref: t,
|
|
@@ -3271,23 +3302,32 @@ var Cr = J({
|
|
|
3271
3302
|
"aria-current": t.active ? "location" : void 0,
|
|
3272
3303
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
3273
3304
|
title: t.text,
|
|
3274
|
-
onClick: () =>
|
|
3305
|
+
onClick: () => Se(e.editor, t, {
|
|
3275
3306
|
behavior: "smooth",
|
|
3276
3307
|
focus: e.editable
|
|
3277
3308
|
})
|
|
3278
3309
|
}, t.text)))])]) : null;
|
|
3279
3310
|
}
|
|
3280
3311
|
});
|
|
3281
|
-
function
|
|
3282
|
-
let t = m(e.lang), r = p(t), i = f(t), a = V(l(e.mode)), o = U(() => a.value === "live" && e.editable !== !1), s = V(0), c = H(null), d = V(
|
|
3283
|
-
|
|
3284
|
-
|
|
3312
|
+
function Fr(e = {}) {
|
|
3313
|
+
let t = m(e.lang), r = p(t), i = f(t), a = V(l(e.mode)), o = U(() => a.value === "live" && e.editable !== !1), s = V(0), c = H(null), d = V(Ct), h = H(null), g = H(null), _ = V("code"), v = H(null), y = H(At), b = V(null), x = V(!1), S = H(null), C = L(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), w = null;
|
|
3314
|
+
function T() {
|
|
3315
|
+
w !== null && (window.clearTimeout(w), w = null), s.value += 1;
|
|
3316
|
+
}
|
|
3317
|
+
function E() {
|
|
3318
|
+
w !== null && window.clearTimeout(w), w = window.setTimeout(() => {
|
|
3319
|
+
w = null, s.value += 1;
|
|
3320
|
+
}, pe);
|
|
3321
|
+
}
|
|
3322
|
+
let D = e.onSlashCommandUpload, O = H(null);
|
|
3323
|
+
O.value = new n({
|
|
3324
|
+
extensions: gr({
|
|
3285
3325
|
lang: t,
|
|
3286
|
-
onImageUpload: (e) =>
|
|
3287
|
-
onVideoUpload: (e) =>
|
|
3326
|
+
onImageUpload: (e) => D?.(e) ?? j(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3327
|
+
onVideoUpload: (e) => D?.(e) ?? j(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
|
|
3288
3328
|
}),
|
|
3289
3329
|
content: e.content ?? e.defaultContent ?? "",
|
|
3290
|
-
contentType:
|
|
3330
|
+
contentType: F(C),
|
|
3291
3331
|
editable: o.value,
|
|
3292
3332
|
autofocus: e.autofocus,
|
|
3293
3333
|
editorProps: {
|
|
@@ -3300,190 +3340,209 @@ function Ar(e = {}) {
|
|
|
3300
3340
|
translate: "no"
|
|
3301
3341
|
},
|
|
3302
3342
|
handleClick: (e, t, n) => {
|
|
3303
|
-
if (!o.value) return
|
|
3304
|
-
let r =
|
|
3305
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
3343
|
+
if (!o.value) return le(n);
|
|
3344
|
+
let r = ot(e, n);
|
|
3345
|
+
return r ? (n.preventDefault(), n.stopPropagation(), A(), ut(e, r, !0), dt(e, r), v.value = r, !0) : (v.value = null, !1);
|
|
3306
3346
|
},
|
|
3307
3347
|
handleDOMEvents: {
|
|
3308
|
-
compositionstart: () => o.value ? (d.value =
|
|
3309
|
-
compositionend: (e) => (o.value && window.setTimeout(() =>
|
|
3348
|
+
compositionstart: () => o.value ? (d.value = wt(d.value, { type: "composition-start" }), h.value = null, !1) : !1,
|
|
3349
|
+
compositionend: (e) => (o.value && window.setTimeout(() => M(e), 0), !1),
|
|
3310
3350
|
click: (e, t) => {
|
|
3311
|
-
if (!o.value) return
|
|
3312
|
-
let n =
|
|
3313
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
3351
|
+
if (!o.value) return le(t);
|
|
3352
|
+
let n = ot(e, t);
|
|
3353
|
+
return n ? (t.preventDefault(), t.stopPropagation(), A(), ut(e, n, !0), dt(e, n), v.value = n, !0) : (v.value = null, !1);
|
|
3314
3354
|
}
|
|
3315
3355
|
}
|
|
3316
3356
|
},
|
|
3317
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
3357
|
+
onSelectionUpdate: ({ editor: e }) => P(e),
|
|
3318
3358
|
onCreate: ({ editor: t }) => {
|
|
3319
3359
|
u(t, {
|
|
3320
3360
|
mode: a.value,
|
|
3321
3361
|
editable: o.value
|
|
3322
|
-
}),
|
|
3362
|
+
}), pt(t, o.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && o.value && Dt(t), R(t), P(t), T();
|
|
3323
3363
|
},
|
|
3324
3364
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3325
|
-
if (
|
|
3326
|
-
let t =
|
|
3365
|
+
if (R(e), (t.docChanged || ft(t)) && E(), t.docChanged && v.value) {
|
|
3366
|
+
let t = at(e, v.value.pos);
|
|
3327
3367
|
v.value = t?.kind === v.value.kind ? t : null;
|
|
3328
3368
|
}
|
|
3329
3369
|
},
|
|
3330
3370
|
onUpdate: ({ editor: t }) => {
|
|
3331
|
-
|
|
3371
|
+
P(t), o.value && N(t), x.value || e.onUpdate?.(te(t, { onContentRead: (n, r) => {
|
|
3372
|
+
let i = L(e.contentFormat);
|
|
3373
|
+
e.content !== void 0 && n === i && (S.value = {
|
|
3374
|
+
content: r,
|
|
3375
|
+
format: n,
|
|
3376
|
+
doc: t.state.doc
|
|
3377
|
+
});
|
|
3378
|
+
} }));
|
|
3332
3379
|
}
|
|
3333
3380
|
});
|
|
3334
|
-
let
|
|
3335
|
-
function
|
|
3336
|
-
h.value = null, g.value = null, d.value =
|
|
3381
|
+
let k = U(() => O.value ?? null);
|
|
3382
|
+
function A() {
|
|
3383
|
+
h.value = null, g.value = null, d.value = Ct;
|
|
3337
3384
|
}
|
|
3338
|
-
function
|
|
3339
|
-
let t =
|
|
3385
|
+
function M(e) {
|
|
3386
|
+
let t = St(e.state);
|
|
3340
3387
|
if (!t) {
|
|
3341
|
-
d.value = d.value.name === "idle" ? d.value :
|
|
3388
|
+
d.value = d.value.name === "idle" ? d.value : Ct, h.value = null, g.value = null;
|
|
3342
3389
|
return;
|
|
3343
3390
|
}
|
|
3344
3391
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3345
|
-
h.value =
|
|
3392
|
+
h.value = xt(n, {
|
|
3346
3393
|
frameRect: i,
|
|
3347
3394
|
triggerRect: r
|
|
3348
|
-
}), d.value =
|
|
3395
|
+
}), d.value = bt(d.value, t);
|
|
3349
3396
|
}
|
|
3350
|
-
function
|
|
3351
|
-
|
|
3397
|
+
function N(e) {
|
|
3398
|
+
M(e.view);
|
|
3352
3399
|
}
|
|
3353
|
-
function
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3400
|
+
function P(e) {
|
|
3401
|
+
let t = fe(e);
|
|
3402
|
+
de(c.value, t) || (c.value = t);
|
|
3403
|
+
let n = st(e);
|
|
3404
|
+
n && (lt(e, n, !0), v.value = n);
|
|
3405
|
+
let r = Te(e);
|
|
3406
|
+
r.active && r.language === "mermaid" && (_.value = r.mermaidPreviewMode);
|
|
3359
3407
|
}
|
|
3360
|
-
function
|
|
3361
|
-
y.value =
|
|
3408
|
+
function R(e) {
|
|
3409
|
+
y.value = yr(e);
|
|
3362
3410
|
}
|
|
3363
|
-
let
|
|
3364
|
-
active:
|
|
3411
|
+
let re = U(() => k.value ? Te(k.value) : vr), ie = U(() => k.value ? Ot(k.value.state) : _r), ae = U(() => c.value?.currentNode === "codeBlock"), oe = U(() => ae.value && re.value.language === "mermaid"), se = U(() => k.value ? ht({
|
|
3412
|
+
active: oe.value,
|
|
3365
3413
|
mode: _.value,
|
|
3366
|
-
source:
|
|
3367
|
-
}) :
|
|
3414
|
+
source: re.value.text
|
|
3415
|
+
}) : ht({
|
|
3368
3416
|
active: !1,
|
|
3369
3417
|
mode: "code",
|
|
3370
3418
|
source: ""
|
|
3371
|
-
})),
|
|
3419
|
+
})), ce = U(() => k.value ? Et(k.value.state) : null), z = U(() => k.value ? ve(k.value.state.doc) : ge.items), me = U(() => ye(z.value, b.value)), be = U(() => he(z.value, me.value)), xe = U(() => gt(d.value.query, i)), Se = U(() => ue({
|
|
3372
3420
|
revision: s.value,
|
|
3373
3421
|
mode: a.value,
|
|
3374
3422
|
editable: o.value,
|
|
3375
|
-
toc:
|
|
3423
|
+
toc: be.value,
|
|
3376
3424
|
selection: c.value,
|
|
3377
3425
|
slash: d.value,
|
|
3378
|
-
table:
|
|
3426
|
+
table: ie.value,
|
|
3379
3427
|
tableInteraction: y.value,
|
|
3380
|
-
codeBlock:
|
|
3381
|
-
mermaid:
|
|
3382
|
-
tableDebugSnapshot:
|
|
3383
|
-
})),
|
|
3384
|
-
closeSlashMenu:
|
|
3385
|
-
focusFirstTableBodyCell: () =>
|
|
3428
|
+
codeBlock: re.value,
|
|
3429
|
+
mermaid: se.value,
|
|
3430
|
+
tableDebugSnapshot: ce.value
|
|
3431
|
+
})), Ce = {
|
|
3432
|
+
closeSlashMenu: A,
|
|
3433
|
+
focusFirstTableBodyCell: () => k.value ? Dt(k.value) : !1,
|
|
3386
3434
|
setContent: (e, t = {}) => {
|
|
3387
|
-
if (!
|
|
3388
|
-
let n =
|
|
3389
|
-
return
|
|
3390
|
-
contentType:
|
|
3435
|
+
if (!k.value) return !1;
|
|
3436
|
+
let n = L(t.format);
|
|
3437
|
+
return k.value.commands.setContent(e, {
|
|
3438
|
+
contentType: F(n),
|
|
3391
3439
|
emitUpdate: t.emitUpdate ?? !1
|
|
3392
|
-
}), t.focusFirstTableBodyCell &&
|
|
3440
|
+
}), t.focusFirstTableBodyCell && Dt(k.value), P(k.value), o.value && N(k.value), R(k.value), T(), !0;
|
|
3393
3441
|
}
|
|
3394
3442
|
};
|
|
3395
|
-
function
|
|
3396
|
-
if (!(!
|
|
3443
|
+
function we(e, t) {
|
|
3444
|
+
if (!(!k.value || !o.value || !_t(e))) {
|
|
3397
3445
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3398
3446
|
g.value = e;
|
|
3399
3447
|
return;
|
|
3400
3448
|
}
|
|
3401
|
-
|
|
3449
|
+
yt(k.value, d.value, e, t), d.value = wt(d.value, { type: "execute" }), A();
|
|
3402
3450
|
}
|
|
3403
3451
|
}
|
|
3404
|
-
function
|
|
3405
|
-
if (!
|
|
3406
|
-
let t =
|
|
3452
|
+
function Ee(e) {
|
|
3453
|
+
if (!k.value || g.value || !o.value) return;
|
|
3454
|
+
let t = vt(d.value, xe.value, e.key, { isComposing: e.isComposing || ee(k.value.state) });
|
|
3407
3455
|
if (t.type !== "ignore") {
|
|
3408
3456
|
if (e.preventDefault(), t.type === "close") {
|
|
3409
|
-
d.value =
|
|
3457
|
+
d.value = wt(d.value, { type: "escape" }), A();
|
|
3410
3458
|
return;
|
|
3411
3459
|
}
|
|
3412
3460
|
if (t.type === "move-active") {
|
|
3413
|
-
d.value =
|
|
3461
|
+
d.value = wt(d.value, {
|
|
3414
3462
|
type: "move-active",
|
|
3415
3463
|
delta: t.delta,
|
|
3416
3464
|
optionCount: t.optionCount
|
|
3417
3465
|
});
|
|
3418
3466
|
return;
|
|
3419
3467
|
}
|
|
3420
|
-
|
|
3468
|
+
we(t.command);
|
|
3421
3469
|
}
|
|
3422
3470
|
}
|
|
3423
3471
|
W(() => [e.mode, e.editable], () => {
|
|
3424
|
-
a.value = l(e.mode),
|
|
3472
|
+
a.value = l(e.mode), k.value && (k.value.setEditable(o.value), u(k.value, {
|
|
3425
3473
|
mode: a.value,
|
|
3426
3474
|
editable: o.value
|
|
3427
|
-
}),
|
|
3475
|
+
}), pt(k.value, o.value ? "live" : "view"), T(), o.value || A());
|
|
3428
3476
|
}, { immediate: !0 }), W(() => e.content, (t) => {
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3477
|
+
let n = L(e.contentFormat);
|
|
3478
|
+
if (!(!k.value || t === void 0)) {
|
|
3479
|
+
if (I(k.value, S.value, t, n)) {
|
|
3480
|
+
S.value = null;
|
|
3481
|
+
return;
|
|
3482
|
+
}
|
|
3483
|
+
S.value = null, !ne(k.value, t, n) && (x.value = !0, k.value.commands.setContent(t, {
|
|
3484
|
+
contentType: F(n),
|
|
3485
|
+
emitUpdate: !1
|
|
3486
|
+
}), x.value = !1, P(k.value), o.value && N(k.value), R(k.value), T());
|
|
3487
|
+
}
|
|
3488
|
+
}), W(Se, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(be, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
|
|
3489
|
+
let t = ye(e, b.value);
|
|
3435
3490
|
b.value !== t && (b.value = t);
|
|
3436
3491
|
});
|
|
3437
|
-
let
|
|
3438
|
-
return
|
|
3492
|
+
let De = null;
|
|
3493
|
+
return K(() => {
|
|
3494
|
+
w !== null && window.clearTimeout(w);
|
|
3495
|
+
}), G(() => {
|
|
3439
3496
|
let e = () => {
|
|
3440
|
-
if (!
|
|
3497
|
+
if (!k.value || !z.value.length) {
|
|
3441
3498
|
b.value = null;
|
|
3442
3499
|
return;
|
|
3443
3500
|
}
|
|
3444
3501
|
let e = null;
|
|
3445
3502
|
try {
|
|
3446
|
-
e =
|
|
3503
|
+
e = _e(k.value, z.value);
|
|
3447
3504
|
} catch {
|
|
3448
3505
|
return;
|
|
3449
3506
|
}
|
|
3450
3507
|
b.value !== e && (b.value = e);
|
|
3451
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
3452
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
3508
|
+
}, t = () => window.requestAnimationFrame(e), n = br(k.value?.view.dom ?? null);
|
|
3509
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), De = () => {
|
|
3453
3510
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3454
3511
|
};
|
|
3455
3512
|
}), K(() => {
|
|
3456
|
-
|
|
3513
|
+
De?.();
|
|
3514
|
+
let e = O.value;
|
|
3515
|
+
O.value = null, q(() => e?.destroy());
|
|
3457
3516
|
}), {
|
|
3458
|
-
editor:
|
|
3459
|
-
runtimeSnapshot:
|
|
3460
|
-
actions:
|
|
3517
|
+
editor: k,
|
|
3518
|
+
runtimeSnapshot: Se,
|
|
3519
|
+
actions: Ce,
|
|
3461
3520
|
__render: {
|
|
3462
3521
|
messages: r,
|
|
3463
3522
|
effectiveEditable: o,
|
|
3464
|
-
tableFocusState:
|
|
3523
|
+
tableFocusState: ie,
|
|
3465
3524
|
tableInteractionState: y,
|
|
3466
|
-
codeBlockState:
|
|
3467
|
-
isCodeBlockActive:
|
|
3525
|
+
codeBlockState: re,
|
|
3526
|
+
isCodeBlockActive: ae,
|
|
3468
3527
|
mermaidMode: _,
|
|
3469
3528
|
mathTarget: v,
|
|
3470
3529
|
setMermaidMode: (e) => {
|
|
3471
3530
|
_.value = e;
|
|
3472
3531
|
},
|
|
3473
|
-
tocState:
|
|
3474
|
-
filteredSlashCommands:
|
|
3532
|
+
tocState: be,
|
|
3533
|
+
filteredSlashCommands: xe,
|
|
3475
3534
|
slashState: d,
|
|
3476
3535
|
slashMenuPosition: h,
|
|
3477
3536
|
slashInputCommand: g,
|
|
3478
|
-
runSlashCommand:
|
|
3479
|
-
handleEditorKeyDown:
|
|
3537
|
+
runSlashCommand: we,
|
|
3538
|
+
handleEditorKeyDown: Ee,
|
|
3480
3539
|
setSlashInputCommand: (e) => {
|
|
3481
3540
|
g.value = e;
|
|
3482
3541
|
}
|
|
3483
3542
|
}
|
|
3484
3543
|
};
|
|
3485
3544
|
}
|
|
3486
|
-
var
|
|
3545
|
+
var Ir = J({
|
|
3487
3546
|
name: "MarkweaveEditor",
|
|
3488
3547
|
props: {
|
|
3489
3548
|
defaultContent: {
|
|
@@ -3576,7 +3635,7 @@ var jr = J({
|
|
|
3576
3635
|
}
|
|
3577
3636
|
},
|
|
3578
3637
|
setup(e) {
|
|
3579
|
-
let t =
|
|
3638
|
+
let t = Fr(e);
|
|
3580
3639
|
return () => {
|
|
3581
3640
|
let n = t.editor.value;
|
|
3582
3641
|
if (!n) return null;
|
|
@@ -3587,16 +3646,16 @@ var jr = J({
|
|
|
3587
3646
|
"data-testid": "markweave-editor-frame",
|
|
3588
3647
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
3589
3648
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
3590
|
-
"data-markweave-inner-toc-placement":
|
|
3649
|
+
"data-markweave-inner-toc-placement": be(e.innerTocPlacement),
|
|
3591
3650
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
3592
3651
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
3593
3652
|
onKeydownCapture: i.handleEditorKeyDown
|
|
3594
3653
|
}, [
|
|
3595
|
-
i.effectiveEditable.value ? B(
|
|
3654
|
+
i.effectiveEditable.value ? B(Or, {
|
|
3596
3655
|
editor: n,
|
|
3597
3656
|
messages: i.messages
|
|
3598
3657
|
}) : null,
|
|
3599
|
-
i.effectiveEditable.value ? B(
|
|
3658
|
+
i.effectiveEditable.value ? B(Ar, {
|
|
3600
3659
|
commands: i.filteredSlashCommands.value,
|
|
3601
3660
|
state: i.slashState.value,
|
|
3602
3661
|
position: i.slashMenuPosition.value,
|
|
@@ -3606,7 +3665,7 @@ var jr = J({
|
|
|
3606
3665
|
onInputCommandChange: i.setSlashInputCommand,
|
|
3607
3666
|
onUpload: e.onSlashCommandUpload
|
|
3608
3667
|
}) : null,
|
|
3609
|
-
i.effectiveEditable.value ? B(
|
|
3668
|
+
i.effectiveEditable.value ? B(jr, {
|
|
3610
3669
|
editor: n,
|
|
3611
3670
|
active: i.tableFocusState.value.active,
|
|
3612
3671
|
interactionState: i.tableInteractionState.value,
|
|
@@ -3615,11 +3674,11 @@ var jr = J({
|
|
|
3615
3674
|
onCommandResult: e.onTableCommandResult,
|
|
3616
3675
|
onEditWithAi: e.onEditWithAi
|
|
3617
3676
|
}) : null,
|
|
3618
|
-
i.effectiveEditable.value ? B(
|
|
3677
|
+
i.effectiveEditable.value ? B(Mr, {
|
|
3619
3678
|
editor: n,
|
|
3620
3679
|
focusState: i.tableFocusState.value
|
|
3621
3680
|
}) : null,
|
|
3622
|
-
B(
|
|
3681
|
+
B(Nr, {
|
|
3623
3682
|
editor: n,
|
|
3624
3683
|
state: i.codeBlockState.value,
|
|
3625
3684
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -3627,14 +3686,14 @@ var jr = J({
|
|
|
3627
3686
|
onMermaidModeChange: i.setMermaidMode,
|
|
3628
3687
|
readOnly: !i.effectiveEditable.value
|
|
3629
3688
|
}),
|
|
3630
|
-
e.innerToc && i.tocState.value.items.length ? B(
|
|
3689
|
+
e.innerToc && i.tocState.value.items.length ? B(Pr, {
|
|
3631
3690
|
editor: n,
|
|
3632
3691
|
state: i.tocState.value,
|
|
3633
3692
|
messages: i.messages,
|
|
3634
3693
|
editable: i.effectiveEditable.value,
|
|
3635
|
-
placement:
|
|
3694
|
+
placement: be(e.innerTocPlacement)
|
|
3636
3695
|
}) : null,
|
|
3637
|
-
i.effectiveEditable.value && i.mathTarget.value ? B(
|
|
3696
|
+
i.effectiveEditable.value && i.mathTarget.value ? B(kr, {
|
|
3638
3697
|
editor: n,
|
|
3639
3698
|
messages: i.messages,
|
|
3640
3699
|
target: i.mathTarget.value,
|
|
@@ -3646,4 +3705,4 @@ var jr = J({
|
|
|
3646
3705
|
}
|
|
3647
3706
|
});
|
|
3648
3707
|
//#endregion
|
|
3649
|
-
export {
|
|
3708
|
+
export { Ir as MarkweaveEditor, gr as createMarkweaveEditorExtensions, gr as createMarkweaveVue2EditorExtensions, Fr as useMarkweaveEditorController };
|