@markweave/vue2 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +710 -663
- package/dist/types/MarkweaveEditor.d.ts +2 -0
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/create-editor-extensions.d.ts +6 -1
- package/dist/types/create-editor-extensions.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/media-nodeviews.d.ts +3 -0
- package/dist/types/media-nodeviews.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8,19 +8,21 @@ import { MarkweaveLinkCard as h } from "markweave/internal/plugins/link-card/lin
|
|
|
8
8
|
import { openMarkweaveLinkCardComposer as g } from "markweave/internal/plugins/link-card/link-card-composer";
|
|
9
9
|
import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as v, replaceMarkweaveLinkCardWithLink as y } from "markweave/internal/plugins/link-card/link-card";
|
|
10
10
|
import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
11
|
+
import { createMarkweaveLightweightImageNodeViewRenderer as x } from "markweave/internal/plugins/media/lightweight-image-node-view";
|
|
12
|
+
import { resolveMarkweaveMediaSource as S } from "markweave/internal/plugins/media/media-source";
|
|
13
|
+
import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as j, markweaveVideoIframeAllow as M, normalizeMarkweaveCoreImageAlign as N, normalizeMarkweaveVideoEmbedUrl as P, numberAttribute as F, stringAttribute as I } from "markweave/internal/plugins/media/core-media-nodes";
|
|
14
|
+
import { detectUploadSource as L, getDirectUploadResult as ee, resolveMarkweaveUploadResult as R } from "markweave/internal/plugins/slash-command/upload";
|
|
15
|
+
import { BubbleMenu as z } from "@tiptap/vue-2/menus";
|
|
16
|
+
import { isEditorComposing as te } from "markweave/internal/editor-core/composition-guard";
|
|
17
|
+
import { saveMarkweaveBrowserFile as ne } from "markweave/internal/core/browser-file-save";
|
|
18
|
+
import { createMarkweaveFrameScheduler as B } from "markweave/internal/editor-core/frame-scheduler";
|
|
19
|
+
import { createMarkweaveEditorUpdatePayload as V, getMarkweaveContentType as re, isEditorContentCurrent as ie, isMarkweaveControlledContentEchoCurrent as ae, normalizeMarkweaveContentFormat as oe } from "markweave/internal/editor-core/editor-content";
|
|
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
|
+
import { openMarkweaveReadonlyLinkFromEvent as me } from "markweave/internal/editor-core/readonly-link";
|
|
22
|
+
import { createMarkweaveEditorRuntimeSnapshot as he } from "markweave/internal/editor-core/runtime-snapshot";
|
|
23
|
+
import { areEditorSelectionSnapshotsEquivalent as ge, calculateFloatingToolbarPopoverPlacement as _e, createSelectionSnapshot as ve, markweaveRuntimeProjectionDelayMs as ye, shouldShowFloatingToolbar as be } from "markweave/internal/editor-core/selection-state";
|
|
22
24
|
import { normalizeMarkweaveCanvasColor as xe, normalizeMarkweaveTheme as Se } from "markweave/internal/core/theme";
|
|
23
|
-
import { createMarkweaveTocState as Ce, emptyMarkweaveTocState as we, getActiveMarkweaveTocId as Te,
|
|
25
|
+
import { createMarkweaveTocState as Ce, emptyMarkweaveTocState as we, getActiveMarkweaveTocId as Te, getMarkweaveTocItemsFromState as Ee, getValidMarkweaveTocActiveId as De, normalizeMarkweaveInnerTocPlacement as Oe, observeMarkweaveInnerTocContainerPosition as ke, scrollToMarkweaveTocItem as Ae } from "markweave/internal/core/toc-state";
|
|
24
26
|
import { codeBlockCollapsePluginKey as je, copyActiveCodeBlock as Me, getActiveCodeBlockState as Ne, getCodeBlockCopyFeedbackSnapshot as Pe, markweaveCodeBlockBehavior as Fe, setCodeBlockCollapsedAtPosition as Ie, setCodeBlockLanguageAtPosition as Le, setCodeBlockMermaidPreviewModeAtPosition as Re } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
25
27
|
import { calculateCodeBlockLanguageMenuPosition as ze, clampFullscreenScale as Be, codeBlockCopyFeedbackTimeoutMs as Ve, copyCodeBlockText as He, createCodeBlockLanguageMenuDomId as Ue, createCodeBlockOverlayPosition as We, createMermaidFullscreenViewerState as Ge, createMermaidTabPosition as Ke, focusCodeBlockTarget as qe, formatCodeBlockLanguageLabel as Je, formatFullscreenZoom as Ye, getActiveCodeBlockElement as Xe, getAnchoredRect as Ze, getCodeBlockLanguageItems as Qe, getCodeBlockLanguageOptionDomId as $e, getCodeBlockPositionFromEventTarget as et, getCodeBlockStateAtPosition as tt, getFrameElement as nt, getInitialCodeBlockLanguageItemIndex as rt, getMermaidCodeBlockTargets as it, getMermaidSvgMarkup as at, isCodeBlockTargetCollapsed as ot, mergeStableMermaidTabPositions as st, mermaidFullscreenZoomStep as ct, moveCodeBlockLanguageItemIndex as lt, moveMermaidFullscreenViewer as ut, scrollCodeBlockLanguageItemIntoView as dt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
26
28
|
import { normalizeMarkdownLinkHref as ft } from "markweave/internal/plugins/markdown/markdown-input";
|
|
@@ -108,34 +110,34 @@ function xn(e) {
|
|
|
108
110
|
function Sn(e) {
|
|
109
111
|
return typeof e == "function" ? xn(e()) : yn(e) ? xn(e.default()) : bn(e) ? [e] : e;
|
|
110
112
|
}
|
|
111
|
-
function
|
|
113
|
+
function H(e, t, n) {
|
|
112
114
|
if (!mn) throw Error("Vue 2 render context is not available.");
|
|
113
115
|
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? _n(r) : vn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Sn(n);
|
|
114
116
|
return mn(e, i, a);
|
|
115
117
|
}
|
|
116
|
-
function
|
|
118
|
+
function U(e) {
|
|
117
119
|
return dn.observable({ value: e });
|
|
118
120
|
}
|
|
119
|
-
var
|
|
120
|
-
function
|
|
121
|
+
var W = U;
|
|
122
|
+
function G(e) {
|
|
121
123
|
return { get value() {
|
|
122
124
|
return e();
|
|
123
125
|
} };
|
|
124
126
|
}
|
|
125
|
-
function
|
|
127
|
+
function K(e, t, n) {
|
|
126
128
|
let r = typeof e == "function" ? e : () => e.value;
|
|
127
129
|
return fn?.$watch ? fn.$watch(r, t, n) : () => void 0;
|
|
128
130
|
}
|
|
129
|
-
function
|
|
131
|
+
function Cn(e) {
|
|
130
132
|
pn?.mounted.push(e);
|
|
131
133
|
}
|
|
132
|
-
function
|
|
134
|
+
function q(e) {
|
|
133
135
|
pn?.beforeUnmount.push(e);
|
|
134
136
|
}
|
|
135
|
-
function
|
|
137
|
+
function J(e) {
|
|
136
138
|
return dn.nextTick(e);
|
|
137
139
|
}
|
|
138
|
-
function
|
|
140
|
+
function Y(e) {
|
|
139
141
|
return dn.extend({
|
|
140
142
|
name: e.name,
|
|
141
143
|
props: e.props,
|
|
@@ -171,7 +173,7 @@ function J(e) {
|
|
|
171
173
|
}
|
|
172
174
|
//#endregion
|
|
173
175
|
//#region src/vue2-icons.ts
|
|
174
|
-
var
|
|
176
|
+
var wn = {
|
|
175
177
|
AlignCenter: {
|
|
176
178
|
iconName: "text-align-center",
|
|
177
179
|
node: [
|
|
@@ -1036,11 +1038,11 @@ var Cn = {
|
|
|
1036
1038
|
}]]
|
|
1037
1039
|
}
|
|
1038
1040
|
};
|
|
1039
|
-
function
|
|
1040
|
-
return e.map(([e, t]) =>
|
|
1041
|
+
function Tn(e) {
|
|
1042
|
+
return e.map(([e, t]) => H(e, t));
|
|
1041
1043
|
}
|
|
1042
|
-
function
|
|
1043
|
-
return
|
|
1044
|
+
function X(e) {
|
|
1045
|
+
return Y({
|
|
1044
1046
|
name: `MarkweaveVue2Icon${e}`,
|
|
1045
1047
|
props: {
|
|
1046
1048
|
size: {
|
|
@@ -1057,8 +1059,8 @@ function Y(e) {
|
|
|
1057
1059
|
}
|
|
1058
1060
|
},
|
|
1059
1061
|
setup(t) {
|
|
1060
|
-
let n =
|
|
1061
|
-
return () =>
|
|
1062
|
+
let n = wn[e];
|
|
1063
|
+
return () => H("svg", {
|
|
1062
1064
|
class: `lucide lucide-${n.iconName}`,
|
|
1063
1065
|
viewBox: "0 0 24 24",
|
|
1064
1066
|
width: t.size,
|
|
@@ -1070,12 +1072,12 @@ function Y(e) {
|
|
|
1070
1072
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1071
1073
|
"aria-hidden": "true",
|
|
1072
1074
|
focusable: "false"
|
|
1073
|
-
},
|
|
1075
|
+
}, Tn(n.node));
|
|
1074
1076
|
}
|
|
1075
1077
|
});
|
|
1076
1078
|
}
|
|
1077
|
-
var
|
|
1078
|
-
function
|
|
1079
|
+
var En = X("AlignCenter"), Dn = X("AlignJustify"), On = X("AlignLeft"), kn = X("AlignRight"), An = X("AlertTriangle"), jn = X("Bold"), Mn = X("Braces"), Nn = X("Captions"), Pn = X("CheckCircle2"), Fn = X("ChevronDown"), In = X("ChevronUp"), Ln = X("CircleX"), Rn = X("Code2"), zn = X("CornerDownLeft"), Bn = X("Download"), Vn = X("Eye"), Hn = X("ExternalLink"), Un = X("Heading1"), Wn = X("Heading2"), Gn = X("Heading3"), Kn = X("Image"), qn = X("ImageUp"), Jn = X("IndentDecrease"), Yn = X("IndentIncrease"), Xn = X("Info"), Zn = X("Italic"), Qn = X("Lightbulb"), $n = X("Link2"), er = X("List"), tr = X("ListChecks"), nr = X("ListOrdered"), rr = X("Minus"), ir = X("MoreVertical"), ar = X("Paperclip"), or = X("PencilLine"), sr = X("Quote"), cr = X("Replace"), lr = X("Sigma"), ur = X("SmilePlus"), dr = X("Strikethrough"), fr = X("Subscript"), pr = X("Superscript"), mr = X("Table2"), hr = X("Text"), gr = X("Trash2"), _r = X("Type"), vr = X("Underline"), yr = X("Upload"), br = X("Video"), xr = N;
|
|
1080
|
+
function Sr(e) {
|
|
1079
1081
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1080
1082
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1081
1083
|
return n === "view" ? {
|
|
@@ -1085,7 +1087,7 @@ function xr(e) {
|
|
|
1085
1087
|
mode: "live",
|
|
1086
1088
|
editable: e.isEditable
|
|
1087
1089
|
} : u(e);
|
|
1088
|
-
}, r =
|
|
1090
|
+
}, r = U(n()), i = m(e, () => {
|
|
1089
1091
|
r.value = n();
|
|
1090
1092
|
}), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
|
|
1091
1093
|
r.value = n();
|
|
@@ -1093,28 +1095,28 @@ function xr(e) {
|
|
|
1093
1095
|
return a && t && a.observe(t, {
|
|
1094
1096
|
attributes: !0,
|
|
1095
1097
|
attributeFilter: ["data-markweave-mode"]
|
|
1096
|
-
}),
|
|
1098
|
+
}), q(() => {
|
|
1097
1099
|
i(), a?.disconnect();
|
|
1098
1100
|
}), r;
|
|
1099
1101
|
}
|
|
1100
|
-
function
|
|
1102
|
+
function Cr(e) {
|
|
1101
1103
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1102
1104
|
}
|
|
1103
|
-
function
|
|
1105
|
+
function wr(e) {
|
|
1104
1106
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1105
1107
|
}
|
|
1106
|
-
function
|
|
1108
|
+
function Tr(e) {
|
|
1107
1109
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1108
1110
|
}
|
|
1109
|
-
function
|
|
1110
|
-
return
|
|
1111
|
+
function Er(e, t) {
|
|
1112
|
+
return H(e, {
|
|
1111
1113
|
size: 18,
|
|
1112
1114
|
strokeWidth: 1.8,
|
|
1113
1115
|
"aria-hidden": "true"
|
|
1114
1116
|
}, { default: () => t });
|
|
1115
1117
|
}
|
|
1116
|
-
function
|
|
1117
|
-
return
|
|
1118
|
+
function Dr(e) {
|
|
1119
|
+
return H("button", {
|
|
1118
1120
|
type: "button",
|
|
1119
1121
|
"aria-label": e.label,
|
|
1120
1122
|
title: e.label,
|
|
@@ -1122,14 +1124,14 @@ function X(e) {
|
|
|
1122
1124
|
"data-active": e.active ? "true" : "false",
|
|
1123
1125
|
onMousedown: (e) => e.preventDefault(),
|
|
1124
1126
|
onClick: e.onClick
|
|
1125
|
-
}, [
|
|
1127
|
+
}, [Er(e.icon, e.label), H("span", {
|
|
1126
1128
|
class: "markweave-image-tooltip",
|
|
1127
1129
|
role: "tooltip"
|
|
1128
1130
|
}, e.label)]);
|
|
1129
1131
|
}
|
|
1130
|
-
function
|
|
1131
|
-
let t =
|
|
1132
|
-
return
|
|
1132
|
+
function Or(e) {
|
|
1133
|
+
let t = U(null), n = e.messages.image;
|
|
1134
|
+
return H("section", {
|
|
1133
1135
|
class: "markweave-image-upload-placeholder",
|
|
1134
1136
|
"data-testid": "markweave-image-upload-placeholder",
|
|
1135
1137
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1147,7 +1149,7 @@ function Er(e) {
|
|
|
1147
1149
|
n && e.onFile(n);
|
|
1148
1150
|
}
|
|
1149
1151
|
}, [
|
|
1150
|
-
|
|
1152
|
+
H("input", {
|
|
1151
1153
|
ref: t,
|
|
1152
1154
|
"data-testid": "markweave-image-file-input",
|
|
1153
1155
|
type: "file",
|
|
@@ -1158,20 +1160,20 @@ function Er(e) {
|
|
|
1158
1160
|
r && e.onFile(r), n.value = "";
|
|
1159
1161
|
}
|
|
1160
1162
|
}),
|
|
1161
|
-
|
|
1163
|
+
H("div", {
|
|
1162
1164
|
class: "markweave-image-upload-icon",
|
|
1163
1165
|
"aria-hidden": "true"
|
|
1164
|
-
}, [
|
|
1166
|
+
}, [H(qn, {
|
|
1165
1167
|
size: 46,
|
|
1166
1168
|
strokeWidth: 1.6
|
|
1167
1169
|
})]),
|
|
1168
|
-
|
|
1170
|
+
H("div", { class: "markweave-image-upload-copy" }, [H("button", {
|
|
1169
1171
|
type: "button",
|
|
1170
1172
|
onClick: () => t.value?.click()
|
|
1171
|
-
}, n.clickToUpload),
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1173
|
+
}, n.clickToUpload), H("span", null, n.dragAndDrop)]),
|
|
1174
|
+
H("div", { class: "markweave-image-upload-note" }, n.uploadNote),
|
|
1175
|
+
H("div", { class: "markweave-image-upload-row" }, [
|
|
1176
|
+
H("input", {
|
|
1175
1177
|
"data-testid": "markweave-image-url-input",
|
|
1176
1178
|
value: e.inputValue,
|
|
1177
1179
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1181,30 +1183,30 @@ function Er(e) {
|
|
|
1181
1183
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1182
1184
|
}
|
|
1183
1185
|
}),
|
|
1184
|
-
|
|
1186
|
+
H("button", {
|
|
1185
1187
|
type: "button",
|
|
1186
1188
|
"data-testid": "markweave-image-upload-submit",
|
|
1187
1189
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1188
1190
|
onClick: e.onSubmit
|
|
1189
|
-
}, [
|
|
1191
|
+
}, [H(qn, {
|
|
1190
1192
|
size: 16,
|
|
1191
1193
|
strokeWidth: 1.8
|
|
1192
1194
|
}), e.messages.common.insert]),
|
|
1193
|
-
|
|
1195
|
+
H("button", {
|
|
1194
1196
|
type: "button",
|
|
1195
1197
|
"data-testid": "markweave-image-upload-cancel",
|
|
1196
1198
|
onClick: e.onCancel
|
|
1197
1199
|
}, e.messages.common.cancel)
|
|
1198
1200
|
]),
|
|
1199
|
-
e.error ?
|
|
1201
|
+
e.error ? H("div", {
|
|
1200
1202
|
class: "markweave-image-upload-error",
|
|
1201
1203
|
role: "alert"
|
|
1202
1204
|
}, e.error) : null
|
|
1203
1205
|
]);
|
|
1204
1206
|
}
|
|
1205
|
-
function
|
|
1206
|
-
let t =
|
|
1207
|
-
return
|
|
1207
|
+
function kr(e) {
|
|
1208
|
+
let t = U(null), n = e.messages.video;
|
|
1209
|
+
return H("section", {
|
|
1208
1210
|
class: "markweave-video-upload-placeholder",
|
|
1209
1211
|
"data-testid": "markweave-video-upload-placeholder",
|
|
1210
1212
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1222,7 +1224,7 @@ function Dr(e) {
|
|
|
1222
1224
|
n && e.onFile(n);
|
|
1223
1225
|
}
|
|
1224
1226
|
}, [
|
|
1225
|
-
|
|
1227
|
+
H("input", {
|
|
1226
1228
|
ref: t,
|
|
1227
1229
|
"data-testid": "markweave-video-file-input",
|
|
1228
1230
|
type: "file",
|
|
@@ -1233,20 +1235,20 @@ function Dr(e) {
|
|
|
1233
1235
|
r && e.onFile(r), n.value = "";
|
|
1234
1236
|
}
|
|
1235
1237
|
}),
|
|
1236
|
-
|
|
1238
|
+
H("div", {
|
|
1237
1239
|
class: "markweave-video-upload-icon",
|
|
1238
1240
|
"aria-hidden": "true"
|
|
1239
|
-
}, [
|
|
1241
|
+
}, [H(br, {
|
|
1240
1242
|
size: 46,
|
|
1241
1243
|
strokeWidth: 1.6
|
|
1242
1244
|
})]),
|
|
1243
|
-
|
|
1245
|
+
H("div", { class: "markweave-video-upload-copy" }, [H("button", {
|
|
1244
1246
|
type: "button",
|
|
1245
1247
|
onClick: () => t.value?.click()
|
|
1246
|
-
}, n.clickToUpload),
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1248
|
+
}, n.clickToUpload), H("span", null, n.dragAndDrop)]),
|
|
1249
|
+
H("div", { class: "markweave-video-upload-note" }, n.uploadNote),
|
|
1250
|
+
H("div", { class: "markweave-video-upload-row" }, [
|
|
1251
|
+
H("input", {
|
|
1250
1252
|
"data-testid": "markweave-video-url-input",
|
|
1251
1253
|
value: e.inputValue,
|
|
1252
1254
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1256,28 +1258,28 @@ function Dr(e) {
|
|
|
1256
1258
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1257
1259
|
}
|
|
1258
1260
|
}),
|
|
1259
|
-
|
|
1261
|
+
H("button", {
|
|
1260
1262
|
type: "button",
|
|
1261
1263
|
"data-testid": "markweave-video-upload-submit",
|
|
1262
1264
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1263
1265
|
onClick: e.onSubmit
|
|
1264
|
-
}, [
|
|
1266
|
+
}, [H(yr, {
|
|
1265
1267
|
size: 16,
|
|
1266
1268
|
strokeWidth: 1.8
|
|
1267
1269
|
}), e.messages.common.insert]),
|
|
1268
|
-
|
|
1270
|
+
H("button", {
|
|
1269
1271
|
type: "button",
|
|
1270
1272
|
"data-testid": "markweave-video-upload-cancel",
|
|
1271
1273
|
onClick: e.onCancel
|
|
1272
1274
|
}, e.messages.common.cancel)
|
|
1273
1275
|
]),
|
|
1274
|
-
e.error ?
|
|
1276
|
+
e.error ? H("div", {
|
|
1275
1277
|
class: "markweave-video-upload-error",
|
|
1276
1278
|
role: "alert"
|
|
1277
1279
|
}, e.error) : null
|
|
1278
1280
|
]);
|
|
1279
1281
|
}
|
|
1280
|
-
var
|
|
1282
|
+
var Ar = Y({
|
|
1281
1283
|
name: "MarkweaveVueImageNodeView",
|
|
1282
1284
|
props: {
|
|
1283
1285
|
editor: {
|
|
@@ -1310,10 +1312,31 @@ var Or = J({
|
|
|
1310
1312
|
}
|
|
1311
1313
|
},
|
|
1312
1314
|
setup(e) {
|
|
1313
|
-
let t =
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1315
|
+
let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!I(u.value.caption)), p = U(I(u.value.caption) ?? ""), m = Sr(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => I(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
|
|
1316
|
+
K(v, (t) => {
|
|
1317
|
+
if (C?.abort(), C = null, !t) {
|
|
1318
|
+
x.value = null;
|
|
1319
|
+
return;
|
|
1320
|
+
}
|
|
1321
|
+
let n = y.value;
|
|
1322
|
+
if (!n) {
|
|
1323
|
+
x.value = { src: t };
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
let r = new AbortController();
|
|
1327
|
+
C = r, S(n, {
|
|
1328
|
+
kind: "image",
|
|
1329
|
+
priority: e.selected ? "visible" : "nearby",
|
|
1330
|
+
signal: r.signal,
|
|
1331
|
+
src: t
|
|
1332
|
+
}).then((e) => {
|
|
1333
|
+
r.signal.aborted || (x.value = e);
|
|
1334
|
+
});
|
|
1335
|
+
}, { immediate: !0 }), q(() => C?.abort());
|
|
1336
|
+
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => xr(u.value.align)), D = G(() => F(u.value.width)), A = G(() => I(u.value.caption)), M = G(() => h.value && (!v.value || i.value)), N = () => {
|
|
1337
|
+
w.value && b({
|
|
1338
|
+
src: w.value,
|
|
1339
|
+
alt: I(u.value.alt) ?? "",
|
|
1317
1340
|
messages: {
|
|
1318
1341
|
dialogAriaLabel: _.value.previewDialogAriaLabel,
|
|
1319
1342
|
zoomOut: _.value.previewZoomOut,
|
|
@@ -1323,67 +1346,67 @@ var Or = J({
|
|
|
1323
1346
|
}
|
|
1324
1347
|
});
|
|
1325
1348
|
};
|
|
1326
|
-
|
|
1349
|
+
K(A, (e) => {
|
|
1327
1350
|
f.value || (p.value = e ?? "");
|
|
1328
1351
|
});
|
|
1329
|
-
let
|
|
1352
|
+
let P = () => {
|
|
1330
1353
|
if (!h.value) return;
|
|
1331
1354
|
let t = e.getPos();
|
|
1332
1355
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1333
|
-
},
|
|
1356
|
+
}, ee = () => {
|
|
1334
1357
|
if (o.value = "", c.value = null, a.value = !1, v.value) {
|
|
1335
1358
|
i.value = !1;
|
|
1336
1359
|
return;
|
|
1337
1360
|
}
|
|
1338
1361
|
e.deleteNode();
|
|
1339
|
-
},
|
|
1362
|
+
}, z = async (t) => {
|
|
1340
1363
|
if (!h.value) return;
|
|
1341
1364
|
let n = e.extension.options;
|
|
1342
1365
|
l.value = !0, c.value = null;
|
|
1343
1366
|
try {
|
|
1344
|
-
let r = await
|
|
1345
|
-
e.updateAttributes(
|
|
1367
|
+
let r = await R(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1368
|
+
e.updateAttributes(T(u.value, r)), o.value = "", i.value = !1;
|
|
1346
1369
|
} catch (e) {
|
|
1347
1370
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
1348
1371
|
} finally {
|
|
1349
1372
|
l.value = !1, a.value = !1;
|
|
1350
1373
|
}
|
|
1351
|
-
},
|
|
1374
|
+
}, te = () => {
|
|
1352
1375
|
if (!o.value.trim()) {
|
|
1353
1376
|
c.value = _.value.uploadRequiredError;
|
|
1354
1377
|
return;
|
|
1355
1378
|
}
|
|
1356
|
-
|
|
1357
|
-
},
|
|
1358
|
-
|
|
1379
|
+
z(L(o.value));
|
|
1380
|
+
}, ne = (e) => {
|
|
1381
|
+
z({
|
|
1359
1382
|
type: "file",
|
|
1360
1383
|
file: e,
|
|
1361
1384
|
mimeType: e.type || "image/*"
|
|
1362
1385
|
});
|
|
1363
|
-
},
|
|
1364
|
-
f.value = !f.value, f.value && (p.value =
|
|
1365
|
-
},
|
|
1386
|
+
}, B = () => {
|
|
1387
|
+
f.value = !f.value, f.value && (p.value = A.value ?? "");
|
|
1388
|
+
}, V = (n, r) => {
|
|
1366
1389
|
if (!h.value || !v.value) return;
|
|
1367
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1390
|
+
r.preventDefault(), r.stopPropagation(), P();
|
|
1368
1391
|
let i = t.value;
|
|
1369
1392
|
if (!i) return;
|
|
1370
|
-
let a = r.clientX, o = i.getBoundingClientRect().width ||
|
|
1393
|
+
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) => {
|
|
1371
1394
|
let r = n === "right" ? t.clientX - a : a - t.clientX;
|
|
1372
|
-
e.updateAttributes({ width:
|
|
1395
|
+
e.updateAttributes({ width: O(o + r, s) });
|
|
1373
1396
|
}, l = () => {
|
|
1374
1397
|
window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
|
|
1375
1398
|
};
|
|
1376
1399
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1377
1400
|
};
|
|
1378
|
-
return () =>
|
|
1401
|
+
return () => M.value ? H(s, {
|
|
1379
1402
|
as: "figure",
|
|
1380
1403
|
class: "markweave-image-node",
|
|
1381
1404
|
"data-testid": "markweave-image-node",
|
|
1382
|
-
"data-align":
|
|
1405
|
+
"data-align": E.value,
|
|
1383
1406
|
"data-selected": "false",
|
|
1384
1407
|
"data-hovered": "false",
|
|
1385
1408
|
"data-empty": "true"
|
|
1386
|
-
}, () =>
|
|
1409
|
+
}, () => Or({
|
|
1387
1410
|
messages: g.value,
|
|
1388
1411
|
inputValue: o.value,
|
|
1389
1412
|
error: c.value,
|
|
@@ -1392,17 +1415,17 @@ var Or = J({
|
|
|
1392
1415
|
onInputValue: (e) => {
|
|
1393
1416
|
o.value = e;
|
|
1394
1417
|
},
|
|
1395
|
-
onFile:
|
|
1396
|
-
onSubmit:
|
|
1397
|
-
onCancel:
|
|
1418
|
+
onFile: ne,
|
|
1419
|
+
onSubmit: te,
|
|
1420
|
+
onCancel: ee,
|
|
1398
1421
|
onDragActive: (e) => {
|
|
1399
1422
|
a.value = e;
|
|
1400
1423
|
}
|
|
1401
|
-
})) :
|
|
1424
|
+
})) : H(s, {
|
|
1402
1425
|
as: "figure",
|
|
1403
1426
|
class: "markweave-image-node",
|
|
1404
1427
|
"data-testid": "markweave-image-node",
|
|
1405
|
-
"data-align":
|
|
1428
|
+
"data-align": E.value,
|
|
1406
1429
|
"data-selected": h.value && e.selected ? "true" : "false",
|
|
1407
1430
|
"data-hovered": r.value ? "true" : "false",
|
|
1408
1431
|
"data-empty": "false",
|
|
@@ -1413,97 +1436,104 @@ var Or = J({
|
|
|
1413
1436
|
r.value = !1;
|
|
1414
1437
|
},
|
|
1415
1438
|
onMousedown: (e) => {
|
|
1416
|
-
h.value && !
|
|
1439
|
+
h.value && !Cr(e.target) && P();
|
|
1417
1440
|
}
|
|
1418
1441
|
}, () => [
|
|
1419
|
-
h.value ?
|
|
1442
|
+
h.value ? H("div", {
|
|
1420
1443
|
class: "markweave-image-toolbar",
|
|
1421
1444
|
"data-testid": "markweave-image-toolbar",
|
|
1422
1445
|
"data-markweave-image-ui": "true",
|
|
1423
1446
|
"aria-label": _.value.toolsAriaLabel
|
|
1424
1447
|
}, [
|
|
1425
|
-
|
|
1448
|
+
Dr({
|
|
1426
1449
|
testId: "markweave-image-align-left",
|
|
1427
1450
|
label: _.value.alignLeft,
|
|
1428
|
-
icon:
|
|
1429
|
-
active:
|
|
1451
|
+
icon: On,
|
|
1452
|
+
active: E.value === "left",
|
|
1430
1453
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1431
1454
|
}),
|
|
1432
|
-
|
|
1455
|
+
Dr({
|
|
1433
1456
|
testId: "markweave-image-align-center",
|
|
1434
1457
|
label: _.value.alignCenter,
|
|
1435
|
-
icon:
|
|
1436
|
-
active:
|
|
1458
|
+
icon: En,
|
|
1459
|
+
active: E.value === "center",
|
|
1437
1460
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1438
1461
|
}),
|
|
1439
|
-
|
|
1462
|
+
Dr({
|
|
1440
1463
|
testId: "markweave-image-align-right",
|
|
1441
1464
|
label: _.value.alignRight,
|
|
1442
|
-
icon:
|
|
1443
|
-
active:
|
|
1465
|
+
icon: kn,
|
|
1466
|
+
active: E.value === "right",
|
|
1444
1467
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1445
1468
|
}),
|
|
1446
|
-
|
|
1469
|
+
H("span", {
|
|
1447
1470
|
class: "markweave-image-toolbar-divider",
|
|
1448
1471
|
"aria-hidden": "true"
|
|
1449
1472
|
}),
|
|
1450
|
-
|
|
1473
|
+
Dr({
|
|
1451
1474
|
testId: "markweave-image-caption",
|
|
1452
1475
|
label: _.value.caption,
|
|
1453
|
-
icon:
|
|
1454
|
-
active: f.value || !!
|
|
1455
|
-
onClick:
|
|
1476
|
+
icon: Nn,
|
|
1477
|
+
active: f.value || !!A.value,
|
|
1478
|
+
onClick: B
|
|
1456
1479
|
}),
|
|
1457
|
-
|
|
1480
|
+
Dr({
|
|
1458
1481
|
testId: "markweave-image-preview",
|
|
1459
1482
|
label: _.value.preview,
|
|
1460
|
-
icon:
|
|
1461
|
-
onClick:
|
|
1483
|
+
icon: Vn,
|
|
1484
|
+
onClick: N
|
|
1462
1485
|
}),
|
|
1463
|
-
|
|
1486
|
+
Dr({
|
|
1464
1487
|
testId: "markweave-image-download",
|
|
1465
1488
|
label: _.value.download,
|
|
1466
|
-
icon:
|
|
1489
|
+
icon: Bn,
|
|
1467
1490
|
onClick: () => {
|
|
1468
|
-
|
|
1491
|
+
w.value && j(w.value);
|
|
1469
1492
|
}
|
|
1470
1493
|
}),
|
|
1471
|
-
|
|
1494
|
+
Dr({
|
|
1472
1495
|
testId: "markweave-image-replace",
|
|
1473
1496
|
label: _.value.replace,
|
|
1474
|
-
icon:
|
|
1497
|
+
icon: cr,
|
|
1475
1498
|
onClick: () => {
|
|
1476
1499
|
o.value = "", c.value = null, i.value = !0;
|
|
1477
1500
|
}
|
|
1478
1501
|
}),
|
|
1479
|
-
|
|
1502
|
+
H("span", {
|
|
1480
1503
|
class: "markweave-image-toolbar-divider",
|
|
1481
1504
|
"aria-hidden": "true"
|
|
1482
1505
|
}),
|
|
1483
|
-
|
|
1506
|
+
Dr({
|
|
1484
1507
|
testId: "markweave-image-delete",
|
|
1485
1508
|
label: _.value.delete,
|
|
1486
|
-
icon:
|
|
1509
|
+
icon: gr,
|
|
1487
1510
|
onClick: () => e.deleteNode()
|
|
1488
1511
|
})
|
|
1489
1512
|
]) : null,
|
|
1490
|
-
|
|
1513
|
+
H("div", {
|
|
1491
1514
|
ref: t,
|
|
1492
1515
|
class: "markweave-image-box",
|
|
1493
|
-
style:
|
|
1516
|
+
style: {
|
|
1517
|
+
...D.value ? { width: `${Math.round(D.value)}px` } : {},
|
|
1518
|
+
...x.value?.width && x.value.height ? { aspectRatio: `${x.value.width} / ${x.value.height}` } : {}
|
|
1519
|
+
}
|
|
1494
1520
|
}, [
|
|
1495
|
-
|
|
1521
|
+
w.value ? H("img", {
|
|
1496
1522
|
class: "markweave-image",
|
|
1497
|
-
src:
|
|
1498
|
-
alt:
|
|
1499
|
-
title:
|
|
1500
|
-
draggable: !1
|
|
1501
|
-
|
|
1523
|
+
src: w.value,
|
|
1524
|
+
alt: I(u.value.alt) ?? "",
|
|
1525
|
+
title: I(u.value.title) ?? void 0,
|
|
1526
|
+
draggable: !1,
|
|
1527
|
+
loading: "lazy",
|
|
1528
|
+
decoding: "async",
|
|
1529
|
+
width: x.value?.width,
|
|
1530
|
+
height: x.value?.height
|
|
1531
|
+
}) : H("div", {
|
|
1502
1532
|
class: "markweave-image-readonly-empty",
|
|
1503
1533
|
"data-testid": "markweave-image-readonly-empty",
|
|
1504
1534
|
"aria-hidden": "true"
|
|
1505
1535
|
}),
|
|
1506
|
-
!h.value &&
|
|
1536
|
+
!h.value && w.value ? H("button", {
|
|
1507
1537
|
type: "button",
|
|
1508
1538
|
class: "markweave-image-preview-trigger",
|
|
1509
1539
|
"data-testid": "markweave-image-preview",
|
|
@@ -1511,34 +1541,34 @@ var Or = J({
|
|
|
1511
1541
|
"aria-label": _.value.preview,
|
|
1512
1542
|
title: _.value.preview,
|
|
1513
1543
|
onMousedown: (e) => e.preventDefault(),
|
|
1514
|
-
onClick:
|
|
1515
|
-
}, [
|
|
1544
|
+
onClick: N
|
|
1545
|
+
}, [H(Vn, {
|
|
1516
1546
|
size: 16,
|
|
1517
1547
|
strokeWidth: 1.8
|
|
1518
|
-
}),
|
|
1548
|
+
}), H("span", {
|
|
1519
1549
|
class: "markweave-image-tooltip",
|
|
1520
1550
|
role: "tooltip"
|
|
1521
1551
|
}, _.value.preview)]) : null,
|
|
1522
|
-
h.value ?
|
|
1552
|
+
h.value ? H("button", {
|
|
1523
1553
|
type: "button",
|
|
1524
1554
|
class: "markweave-image-resize-handle",
|
|
1525
1555
|
"data-testid": "markweave-image-resize-left",
|
|
1526
1556
|
"data-side": "left",
|
|
1527
1557
|
"aria-label": _.value.resizeLeft,
|
|
1528
1558
|
"data-markweave-image-ui": "true",
|
|
1529
|
-
onPointerdown: (e) =>
|
|
1559
|
+
onPointerdown: (e) => V("left", e)
|
|
1530
1560
|
}) : null,
|
|
1531
|
-
h.value ?
|
|
1561
|
+
h.value ? H("button", {
|
|
1532
1562
|
type: "button",
|
|
1533
1563
|
class: "markweave-image-resize-handle",
|
|
1534
1564
|
"data-testid": "markweave-image-resize-right",
|
|
1535
1565
|
"data-side": "right",
|
|
1536
1566
|
"aria-label": _.value.resizeRight,
|
|
1537
1567
|
"data-markweave-image-ui": "true",
|
|
1538
|
-
onPointerdown: (e) =>
|
|
1568
|
+
onPointerdown: (e) => V("right", e)
|
|
1539
1569
|
}) : null
|
|
1540
1570
|
]),
|
|
1541
|
-
h.value && (f.value ||
|
|
1571
|
+
h.value && (f.value || A.value) ? H("input", {
|
|
1542
1572
|
class: "markweave-image-caption-input",
|
|
1543
1573
|
"data-testid": "markweave-image-caption-input",
|
|
1544
1574
|
"data-markweave-image-ui": "true",
|
|
@@ -1551,13 +1581,13 @@ var Or = J({
|
|
|
1551
1581
|
onKeydown: (e) => {
|
|
1552
1582
|
e.key === "Escape" && (e.preventDefault(), f.value = !1);
|
|
1553
1583
|
}
|
|
1554
|
-
}) :
|
|
1584
|
+
}) : A.value ? H("figcaption", {
|
|
1555
1585
|
class: "markweave-image-caption",
|
|
1556
1586
|
"data-testid": "markweave-image-caption"
|
|
1557
|
-
},
|
|
1587
|
+
}, A.value) : null
|
|
1558
1588
|
]);
|
|
1559
1589
|
}
|
|
1560
|
-
}),
|
|
1590
|
+
}), jr = Y({
|
|
1561
1591
|
name: "MarkweaveVueVideoNodeView",
|
|
1562
1592
|
props: {
|
|
1563
1593
|
editor: {
|
|
@@ -1590,15 +1620,15 @@ var Or = J({
|
|
|
1590
1620
|
}
|
|
1591
1621
|
},
|
|
1592
1622
|
setup(e) {
|
|
1593
|
-
let t =
|
|
1623
|
+
let t = U(!1), r = U(""), i = U(null), a = U(!1), o = Sr(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => I(f.value.src)), m = G(() => I(f.value.embedUrl)), h = G(() => I(f.value.provider)), g = G(() => m.value ? P(m.value, h.value) : null), _ = G(() => I(f.value.mimeType)), v = G(() => I(f.value.title)), y = () => {
|
|
1594
1624
|
p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
|
|
1595
1625
|
}, b = async (n) => {
|
|
1596
1626
|
if (!c.value) return;
|
|
1597
1627
|
let o = e.extension.options;
|
|
1598
1628
|
a.value = !0, i.value = null;
|
|
1599
1629
|
try {
|
|
1600
|
-
let t = await
|
|
1601
|
-
e.updateAttributes(
|
|
1630
|
+
let t = await R(A(n), o?.onUpload);
|
|
1631
|
+
e.updateAttributes(E(t)), r.value = "";
|
|
1602
1632
|
} catch (e) {
|
|
1603
1633
|
i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
1604
1634
|
} finally {
|
|
@@ -1606,7 +1636,7 @@ var Or = J({
|
|
|
1606
1636
|
}
|
|
1607
1637
|
}, x = () => {
|
|
1608
1638
|
if (!c.value) return;
|
|
1609
|
-
let t =
|
|
1639
|
+
let t = D(r.value);
|
|
1610
1640
|
if (!t) {
|
|
1611
1641
|
i.value = u.value.unsupportedUrlError;
|
|
1612
1642
|
return;
|
|
@@ -1622,16 +1652,16 @@ var Or = J({
|
|
|
1622
1652
|
if (!c.value) return;
|
|
1623
1653
|
let t = e.getPos();
|
|
1624
1654
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1625
|
-
},
|
|
1655
|
+
}, w = (t) => {
|
|
1626
1656
|
c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
|
|
1627
1657
|
};
|
|
1628
|
-
return () => c.value && !p.value ?
|
|
1658
|
+
return () => c.value && !p.value ? H(s, {
|
|
1629
1659
|
as: "figure",
|
|
1630
1660
|
class: "markweave-video-node",
|
|
1631
1661
|
"data-testid": "markweave-video-node",
|
|
1632
1662
|
"data-empty": "true",
|
|
1633
1663
|
"data-selected": "false"
|
|
1634
|
-
}, () =>
|
|
1664
|
+
}, () => kr({
|
|
1635
1665
|
messages: l.value,
|
|
1636
1666
|
inputValue: r.value,
|
|
1637
1667
|
error: i.value,
|
|
@@ -1646,7 +1676,7 @@ var Or = J({
|
|
|
1646
1676
|
onDragActive: (e) => {
|
|
1647
1677
|
t.value = e;
|
|
1648
1678
|
}
|
|
1649
|
-
})) :
|
|
1679
|
+
})) : H(s, {
|
|
1650
1680
|
as: "figure",
|
|
1651
1681
|
class: "markweave-video-node",
|
|
1652
1682
|
"data-testid": "markweave-video-node",
|
|
@@ -1656,27 +1686,27 @@ var Or = J({
|
|
|
1656
1686
|
"aria-label": u.value.nodeAriaLabel,
|
|
1657
1687
|
tabindex: c.value ? 0 : void 0,
|
|
1658
1688
|
onFocus: C,
|
|
1659
|
-
onKeydown:
|
|
1689
|
+
onKeydown: w,
|
|
1660
1690
|
onMousedown: (e) => {
|
|
1661
|
-
c.value && !
|
|
1691
|
+
c.value && !wr(e.target) && (e.preventDefault(), C());
|
|
1662
1692
|
}
|
|
1663
|
-
}, () => [g.value ?
|
|
1693
|
+
}, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
|
|
1664
1694
|
class: "markweave-video-iframe",
|
|
1665
1695
|
src: g.value,
|
|
1666
1696
|
title: v.value ?? `${h.value ?? "Video"} embed`,
|
|
1667
1697
|
"data-markweave-video-embed": "true",
|
|
1668
1698
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
1669
1699
|
"data-markweave-video-src": p.value ?? void 0,
|
|
1670
|
-
allow:
|
|
1700
|
+
allow: M,
|
|
1671
1701
|
loading: "lazy",
|
|
1672
1702
|
allowfullscreen: "true"
|
|
1673
|
-
}), c.value ?
|
|
1703
|
+
}), c.value ? H("button", {
|
|
1674
1704
|
type: "button",
|
|
1675
1705
|
class: "markweave-video-selection-layer",
|
|
1676
1706
|
"data-testid": "markweave-video-selection-layer",
|
|
1677
1707
|
tabindex: -1,
|
|
1678
1708
|
"aria-label": u.value.selectAriaLabel
|
|
1679
|
-
}) : null]) : p.value ?
|
|
1709
|
+
}) : null]) : p.value ? H("div", { class: "markweave-video-box" }, [H("video", {
|
|
1680
1710
|
class: "markweave-video",
|
|
1681
1711
|
src: p.value,
|
|
1682
1712
|
title: v.value ?? void 0,
|
|
@@ -1684,41 +1714,51 @@ var Or = J({
|
|
|
1684
1714
|
controls: !0,
|
|
1685
1715
|
"data-markweave-video": "true",
|
|
1686
1716
|
"data-markweave-mime-type": _.value ?? void 0
|
|
1687
|
-
}), c.value ?
|
|
1717
|
+
}), c.value ? H("button", {
|
|
1688
1718
|
type: "button",
|
|
1689
1719
|
class: "markweave-video-selection-layer",
|
|
1690
1720
|
"data-testid": "markweave-video-selection-layer",
|
|
1691
1721
|
tabindex: -1,
|
|
1692
1722
|
"aria-label": u.value.selectAriaLabel
|
|
1693
|
-
}) : null]) :
|
|
1723
|
+
}) : null]) : H("div", {
|
|
1694
1724
|
class: "markweave-video-readonly-empty",
|
|
1695
1725
|
"data-testid": "markweave-video-readonly-empty",
|
|
1696
1726
|
"aria-hidden": "true"
|
|
1697
1727
|
})]);
|
|
1698
1728
|
}
|
|
1699
|
-
}),
|
|
1729
|
+
}), Mr = C.extend({
|
|
1700
1730
|
addOptions() {
|
|
1701
1731
|
return {
|
|
1702
1732
|
...this.parent?.(),
|
|
1703
1733
|
messages: n("zh"),
|
|
1704
|
-
onUpload: void 0
|
|
1734
|
+
onUpload: void 0,
|
|
1735
|
+
resolveMediaSource: void 0
|
|
1705
1736
|
};
|
|
1706
1737
|
},
|
|
1707
1738
|
addNodeView() {
|
|
1708
|
-
|
|
1739
|
+
if (typeof document > "u") return null;
|
|
1740
|
+
let e = c(Ar, { stopEvent: ({ event: e }) => Cr(e.target) }), t = this.options.resolveMediaSource;
|
|
1741
|
+
if (!t) return e;
|
|
1742
|
+
let r = x({
|
|
1743
|
+
messages: this.options.messages ?? n("zh"),
|
|
1744
|
+
onUpload: this.options.onUpload,
|
|
1745
|
+
resolveMediaSource: t
|
|
1746
|
+
});
|
|
1747
|
+
return (t) => I(t.node.attrs.src) ? r(t) : e(t);
|
|
1709
1748
|
}
|
|
1710
|
-
}),
|
|
1749
|
+
}), Nr = w.extend({
|
|
1711
1750
|
addOptions() {
|
|
1712
1751
|
return {
|
|
1713
1752
|
...this.parent?.(),
|
|
1714
1753
|
messages: n("zh"),
|
|
1715
|
-
onUpload: void 0
|
|
1754
|
+
onUpload: void 0,
|
|
1755
|
+
resolveMediaSource: void 0
|
|
1716
1756
|
};
|
|
1717
1757
|
},
|
|
1718
1758
|
addNodeView() {
|
|
1719
|
-
return typeof document > "u" ? null : c(
|
|
1759
|
+
return typeof document > "u" ? null : c(jr, { stopEvent: ({ event: e }) => wr(e.target) });
|
|
1720
1760
|
}
|
|
1721
|
-
}),
|
|
1761
|
+
}), Pr = Y({
|
|
1722
1762
|
name: "MarkweaveVueLinkCardNodeView",
|
|
1723
1763
|
props: {
|
|
1724
1764
|
editor: {
|
|
@@ -1751,11 +1791,11 @@ var Or = J({
|
|
|
1751
1791
|
}
|
|
1752
1792
|
},
|
|
1753
1793
|
setup(e) {
|
|
1754
|
-
let t = e.extension.options, r = t.messages ?? n("zh"), i =
|
|
1755
|
-
|
|
1794
|
+
let t = e.extension.options, r = t.messages ?? n("zh"), i = Sr(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 ?? "");
|
|
1795
|
+
K(l, (e) => {
|
|
1756
1796
|
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
1757
1797
|
});
|
|
1758
|
-
let p =
|
|
1798
|
+
let p = G(() => d(i.value)), m = G(() => {
|
|
1759
1799
|
try {
|
|
1760
1800
|
return new URL(l.value?.href ?? "").host;
|
|
1761
1801
|
} catch {
|
|
@@ -1779,18 +1819,18 @@ var Or = J({
|
|
|
1779
1819
|
...r,
|
|
1780
1820
|
...i
|
|
1781
1821
|
}) ?? r);
|
|
1782
|
-
}, C = (e, t, n, r) =>
|
|
1822
|
+
}, C = (e, t, n, r) => H("button", {
|
|
1783
1823
|
type: "button",
|
|
1784
1824
|
title: e,
|
|
1785
1825
|
"aria-label": e,
|
|
1786
1826
|
"data-testid": n,
|
|
1787
1827
|
onMousedown: h,
|
|
1788
1828
|
onClick: r
|
|
1789
|
-
}, [
|
|
1829
|
+
}, [Er(t, e), H("span", { role: "tooltip" }, e)]);
|
|
1790
1830
|
return () => {
|
|
1791
1831
|
let n = l.value;
|
|
1792
1832
|
if (!n) return null;
|
|
1793
|
-
let i = !c.value && n.imageUrl ?
|
|
1833
|
+
let i = !c.value && n.imageUrl ? H("img", {
|
|
1794
1834
|
src: n.imageUrl,
|
|
1795
1835
|
alt: "",
|
|
1796
1836
|
loading: "lazy",
|
|
@@ -1798,7 +1838,7 @@ var Or = J({
|
|
|
1798
1838
|
onError: () => {
|
|
1799
1839
|
c.value = !0;
|
|
1800
1840
|
}
|
|
1801
|
-
}) : !c.value && n.faviconUrl ?
|
|
1841
|
+
}) : !c.value && n.faviconUrl ? H("img", {
|
|
1802
1842
|
class: "markweave-link-card-favicon",
|
|
1803
1843
|
src: n.faviconUrl,
|
|
1804
1844
|
alt: "",
|
|
@@ -1807,8 +1847,8 @@ var Or = J({
|
|
|
1807
1847
|
onError: () => {
|
|
1808
1848
|
c.value = !0;
|
|
1809
1849
|
}
|
|
1810
|
-
}) :
|
|
1811
|
-
return
|
|
1850
|
+
}) : H("b", null, m.value.slice(0, 1).toUpperCase());
|
|
1851
|
+
return H(s, {
|
|
1812
1852
|
as: "article",
|
|
1813
1853
|
class: "markweave-link-card",
|
|
1814
1854
|
"data-testid": "markweave-link-card",
|
|
@@ -1822,32 +1862,32 @@ var Or = J({
|
|
|
1822
1862
|
a.value = !1;
|
|
1823
1863
|
},
|
|
1824
1864
|
onMousedown: (e) => {
|
|
1825
|
-
|
|
1865
|
+
Tr(e.target) || e.preventDefault();
|
|
1826
1866
|
},
|
|
1827
1867
|
onClick: (e) => {
|
|
1828
|
-
|
|
1868
|
+
Tr(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
1829
1869
|
}
|
|
1830
1870
|
}, () => [
|
|
1831
|
-
|
|
1871
|
+
H("a", {
|
|
1832
1872
|
class: "markweave-link-card-main",
|
|
1833
1873
|
href: n.href,
|
|
1834
1874
|
"aria-label": r.linkCard.open
|
|
1835
|
-
}, [
|
|
1836
|
-
|
|
1837
|
-
n.description ?
|
|
1838
|
-
|
|
1839
|
-
]),
|
|
1875
|
+
}, [H("span", { class: "markweave-link-card-copy" }, [
|
|
1876
|
+
H("strong", null, n.title),
|
|
1877
|
+
n.description ? H("span", null, n.description) : null,
|
|
1878
|
+
H("small", null, n.siteName ?? m.value)
|
|
1879
|
+
]), H("span", {
|
|
1840
1880
|
class: "markweave-link-card-media",
|
|
1841
1881
|
"aria-hidden": "true"
|
|
1842
1882
|
}, [i])]),
|
|
1843
|
-
p.value && a.value ?
|
|
1883
|
+
p.value && a.value ? H("div", {
|
|
1844
1884
|
class: "markweave-link-card-tools",
|
|
1845
1885
|
"data-markweave-link-card-ui": "true",
|
|
1846
1886
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
1847
1887
|
}, [
|
|
1848
|
-
C(r.linkCard.convertToLink,
|
|
1849
|
-
C(r.linkCard.copyAddress,
|
|
1850
|
-
C(r.linkCard.edit,
|
|
1888
|
+
C(r.linkCard.convertToLink, $n, "markweave-link-card-convert", x),
|
|
1889
|
+
C(r.linkCard.copyAddress, Bn, "markweave-link-card-copy", () => b(n.href)),
|
|
1890
|
+
C(r.linkCard.edit, or, "markweave-link-card-edit", (i) => g({
|
|
1851
1891
|
anchor: i.currentTarget,
|
|
1852
1892
|
editor: e.editor,
|
|
1853
1893
|
messages: r,
|
|
@@ -1857,15 +1897,15 @@ var Or = J({
|
|
|
1857
1897
|
attrs: n
|
|
1858
1898
|
}
|
|
1859
1899
|
})),
|
|
1860
|
-
C(r.linkCard.delete,
|
|
1900
|
+
C(r.linkCard.delete, gr, "markweave-link-card-delete", () => e.deleteNode())
|
|
1861
1901
|
]) : null,
|
|
1862
|
-
p.value && o.value ?
|
|
1902
|
+
p.value && o.value ? H("form", {
|
|
1863
1903
|
class: "markweave-link-card-editor",
|
|
1864
1904
|
"data-markweave-link-card-ui": "true",
|
|
1865
1905
|
"data-testid": "markweave-link-card-editor",
|
|
1866
1906
|
onSubmit: S
|
|
1867
1907
|
}, [
|
|
1868
|
-
|
|
1908
|
+
H("label", null, [H("span", null, r.linkCard.titleLabel), H("input", {
|
|
1869
1909
|
value: u.value,
|
|
1870
1910
|
placeholder: r.linkCard.titlePlaceholder,
|
|
1871
1911
|
"aria-label": r.linkCard.titleLabel,
|
|
@@ -1873,7 +1913,7 @@ var Or = J({
|
|
|
1873
1913
|
u.value = e.target.value;
|
|
1874
1914
|
}
|
|
1875
1915
|
})]),
|
|
1876
|
-
|
|
1916
|
+
H("label", null, [H("span", null, r.linkCard.addressLabel), H("input", {
|
|
1877
1917
|
value: f.value,
|
|
1878
1918
|
placeholder: r.linkCard.addressPlaceholder,
|
|
1879
1919
|
"aria-label": r.linkCard.addressLabel,
|
|
@@ -1881,16 +1921,16 @@ var Or = J({
|
|
|
1881
1921
|
f.value = e.target.value;
|
|
1882
1922
|
}
|
|
1883
1923
|
})]),
|
|
1884
|
-
|
|
1924
|
+
H("button", {
|
|
1885
1925
|
type: "submit",
|
|
1886
1926
|
disabled: !v(f.value),
|
|
1887
1927
|
"aria-label": r.linkCard.edit
|
|
1888
|
-
}, [
|
|
1928
|
+
}, [Er($n, r.linkCard.edit)])
|
|
1889
1929
|
]) : null
|
|
1890
1930
|
]);
|
|
1891
1931
|
};
|
|
1892
1932
|
}
|
|
1893
|
-
}),
|
|
1933
|
+
}), Fr = h.extend({
|
|
1894
1934
|
addOptions() {
|
|
1895
1935
|
return {
|
|
1896
1936
|
...this.parent?.(),
|
|
@@ -1899,32 +1939,33 @@ var Or = J({
|
|
|
1899
1939
|
};
|
|
1900
1940
|
},
|
|
1901
1941
|
addNodeView() {
|
|
1902
|
-
return typeof document > "u" ? null : c(
|
|
1942
|
+
return typeof document > "u" ? null : c(Pr, { stopEvent: ({ event: e }) => Tr(e.target) });
|
|
1903
1943
|
}
|
|
1904
1944
|
});
|
|
1905
1945
|
//#endregion
|
|
1906
1946
|
//#region src/create-editor-extensions.ts
|
|
1907
|
-
function
|
|
1947
|
+
function Ir(t = {}) {
|
|
1908
1948
|
return e({
|
|
1909
1949
|
lang: t.lang,
|
|
1910
1950
|
onImageUpload: t.onImageUpload,
|
|
1911
|
-
linkCardExtension:
|
|
1951
|
+
linkCardExtension: Fr.configure({
|
|
1912
1952
|
lang: t.lang,
|
|
1913
1953
|
messages: n(t.lang),
|
|
1914
1954
|
resolver: t.linkCardResolver
|
|
1915
1955
|
}),
|
|
1916
1956
|
mediaExtensions: i({
|
|
1917
|
-
image:
|
|
1918
|
-
video:
|
|
1957
|
+
image: Mr,
|
|
1958
|
+
video: Nr,
|
|
1919
1959
|
lang: t.lang,
|
|
1920
1960
|
onImageUpload: t.onImageUpload,
|
|
1921
|
-
onVideoUpload: t.onVideoUpload
|
|
1961
|
+
onVideoUpload: t.onVideoUpload,
|
|
1962
|
+
resolveMediaSource: t.resolveMediaSource
|
|
1922
1963
|
})
|
|
1923
1964
|
});
|
|
1924
1965
|
}
|
|
1925
1966
|
//#endregion
|
|
1926
1967
|
//#region src/MarkweaveEditor.ts
|
|
1927
|
-
var
|
|
1968
|
+
var Lr = {
|
|
1928
1969
|
active: !1,
|
|
1929
1970
|
mode: "outside",
|
|
1930
1971
|
activeCellPos: null,
|
|
@@ -1932,17 +1973,17 @@ var Fr = {
|
|
|
1932
1973
|
selectedCellCount: 0,
|
|
1933
1974
|
selectionFrom: 0,
|
|
1934
1975
|
selectionTo: 0
|
|
1935
|
-
},
|
|
1976
|
+
}, Rr = {
|
|
1936
1977
|
active: !1,
|
|
1937
1978
|
language: Fe.defaultLanguage,
|
|
1938
1979
|
mermaidPreviewMode: "code",
|
|
1939
1980
|
pos: null,
|
|
1940
1981
|
text: ""
|
|
1941
1982
|
};
|
|
1942
|
-
function
|
|
1983
|
+
function zr(e) {
|
|
1943
1984
|
return Gt.getState(e.state) ?? Wt;
|
|
1944
1985
|
}
|
|
1945
|
-
function
|
|
1986
|
+
function Br(e) {
|
|
1946
1987
|
if (!e || typeof window > "u") return null;
|
|
1947
1988
|
let t = e.parentElement;
|
|
1948
1989
|
for (; t;) {
|
|
@@ -1953,133 +1994,133 @@ function Rr(e) {
|
|
|
1953
1994
|
return null;
|
|
1954
1995
|
}
|
|
1955
1996
|
function Z(e, t, n = 18, r = 1.8) {
|
|
1956
|
-
return
|
|
1997
|
+
return H(e, {
|
|
1957
1998
|
size: n,
|
|
1958
1999
|
strokeWidth: r,
|
|
1959
2000
|
"aria-hidden": "true"
|
|
1960
2001
|
}, { default: () => t });
|
|
1961
2002
|
}
|
|
1962
|
-
function
|
|
1963
|
-
return e === "clipboard" ? [
|
|
2003
|
+
function Vr(e) {
|
|
2004
|
+
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", {
|
|
1964
2005
|
cx: "10",
|
|
1965
2006
|
cy: "10",
|
|
1966
2007
|
r: "5.5"
|
|
1967
|
-
}),
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2008
|
+
}), H("path", { d: "m14 14 4 4" })] : e === "check" ? [H("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
|
|
2009
|
+
H("path", { d: "M8 4H4v4" }),
|
|
2010
|
+
H("path", { d: "M4 4l5 5" }),
|
|
2011
|
+
H("path", { d: "M16 4h4v4" }),
|
|
2012
|
+
H("path", { d: "m20 4-5 5" }),
|
|
2013
|
+
H("path", { d: "M8 20H4v-4" }),
|
|
2014
|
+
H("path", { d: "m4 20 5-5" }),
|
|
2015
|
+
H("path", { d: "M16 20h4v-4" }),
|
|
2016
|
+
H("path", { d: "m20 20-5-5" })
|
|
1976
2017
|
] : e === "download" ? [
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
] : e === "close" ? [
|
|
1981
|
-
|
|
2018
|
+
H("path", { d: "M12 4v10" }),
|
|
2019
|
+
H("path", { d: "m8 10 4 4 4-4" }),
|
|
2020
|
+
H("path", { d: "M5 19h14" })
|
|
2021
|
+
] : e === "close" ? [H("path", { d: "M6 6l12 12" }), H("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
|
|
2022
|
+
H("circle", {
|
|
1982
2023
|
cx: "10",
|
|
1983
2024
|
cy: "10",
|
|
1984
2025
|
r: "5.25"
|
|
1985
2026
|
}),
|
|
1986
|
-
|
|
1987
|
-
|
|
2027
|
+
H("path", { d: "M7.5 10h5" }),
|
|
2028
|
+
H("path", { d: "m14 14 4 4" })
|
|
1988
2029
|
] : e === "zoomIn" ? [
|
|
1989
|
-
|
|
2030
|
+
H("circle", {
|
|
1990
2031
|
cx: "10",
|
|
1991
2032
|
cy: "10",
|
|
1992
2033
|
r: "5.25"
|
|
1993
2034
|
}),
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
] : e === "reset" ? [
|
|
2035
|
+
H("path", { d: "M7.5 10h5" }),
|
|
2036
|
+
H("path", { d: "M10 7.5v5" }),
|
|
2037
|
+
H("path", { d: "m14 14 4 4" })
|
|
2038
|
+
] : e === "reset" ? [H("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), H("path", { d: "M6.5 8.5H3.5v-3" })] : [H("path", { d: "m6 9 6 6 6-6" })];
|
|
1998
2039
|
}
|
|
1999
2040
|
function Q(e) {
|
|
2000
|
-
return
|
|
2041
|
+
return H("svg", {
|
|
2001
2042
|
viewBox: "0 0 24 24",
|
|
2002
2043
|
"aria-hidden": "true",
|
|
2003
2044
|
focusable: "false"
|
|
2004
|
-
},
|
|
2045
|
+
}, H("g", {
|
|
2005
2046
|
fill: "none",
|
|
2006
2047
|
stroke: "currentColor",
|
|
2007
2048
|
"stroke-linecap": "round",
|
|
2008
2049
|
"stroke-linejoin": "round",
|
|
2009
2050
|
"stroke-width": "1.8"
|
|
2010
|
-
},
|
|
2051
|
+
}, Vr(e)));
|
|
2011
2052
|
}
|
|
2012
2053
|
function $(e) {
|
|
2013
2054
|
e.preventDefault();
|
|
2014
2055
|
}
|
|
2015
|
-
function
|
|
2056
|
+
function Hr(e) {
|
|
2016
2057
|
let t = ft(e);
|
|
2017
2058
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
2018
2059
|
}
|
|
2019
|
-
var
|
|
2020
|
-
bold:
|
|
2021
|
-
italic:
|
|
2022
|
-
underline:
|
|
2023
|
-
strike:
|
|
2024
|
-
"inline-code":
|
|
2025
|
-
link:
|
|
2026
|
-
more:
|
|
2027
|
-
superscript:
|
|
2028
|
-
subscript:
|
|
2029
|
-
"inline-math":
|
|
2030
|
-
"align-left":
|
|
2031
|
-
"align-center":
|
|
2032
|
-
"align-right":
|
|
2033
|
-
"align-justify":
|
|
2034
|
-
"decrease-indent":
|
|
2035
|
-
"increase-indent":
|
|
2036
|
-
},
|
|
2037
|
-
type:
|
|
2038
|
-
"heading-1":
|
|
2039
|
-
"heading-2":
|
|
2040
|
-
"heading-3":
|
|
2041
|
-
"bullet-list":
|
|
2042
|
-
"ordered-list":
|
|
2043
|
-
"task-list":
|
|
2044
|
-
blockquote:
|
|
2045
|
-
"code-block":
|
|
2046
|
-
info:
|
|
2047
|
-
tip:
|
|
2048
|
-
warning:
|
|
2049
|
-
error:
|
|
2050
|
-
success:
|
|
2051
|
-
emoji:
|
|
2052
|
-
math:
|
|
2053
|
-
table:
|
|
2054
|
-
separator:
|
|
2055
|
-
image:
|
|
2056
|
-
video:
|
|
2057
|
-
attachment:
|
|
2060
|
+
var Ur = {
|
|
2061
|
+
bold: jn,
|
|
2062
|
+
italic: Zn,
|
|
2063
|
+
underline: vr,
|
|
2064
|
+
strike: dr,
|
|
2065
|
+
"inline-code": Rn,
|
|
2066
|
+
link: $n,
|
|
2067
|
+
more: ir,
|
|
2068
|
+
superscript: pr,
|
|
2069
|
+
subscript: fr,
|
|
2070
|
+
"inline-math": lr,
|
|
2071
|
+
"align-left": On,
|
|
2072
|
+
"align-center": En,
|
|
2073
|
+
"align-right": kn,
|
|
2074
|
+
"align-justify": Dn,
|
|
2075
|
+
"decrease-indent": Jn,
|
|
2076
|
+
"increase-indent": Yn
|
|
2077
|
+
}, Wr = {
|
|
2078
|
+
type: hr,
|
|
2079
|
+
"heading-1": Un,
|
|
2080
|
+
"heading-2": Wn,
|
|
2081
|
+
"heading-3": Gn,
|
|
2082
|
+
"bullet-list": er,
|
|
2083
|
+
"ordered-list": nr,
|
|
2084
|
+
"task-list": tr,
|
|
2085
|
+
blockquote: sr,
|
|
2086
|
+
"code-block": Mn,
|
|
2087
|
+
info: Xn,
|
|
2088
|
+
tip: Qn,
|
|
2089
|
+
warning: An,
|
|
2090
|
+
error: Ln,
|
|
2091
|
+
success: Pn,
|
|
2092
|
+
emoji: ur,
|
|
2093
|
+
math: lr,
|
|
2094
|
+
table: mr,
|
|
2095
|
+
separator: rr,
|
|
2096
|
+
image: Kn,
|
|
2097
|
+
video: br,
|
|
2098
|
+
attachment: ar
|
|
2058
2099
|
};
|
|
2059
|
-
function
|
|
2060
|
-
let t =
|
|
2061
|
-
return
|
|
2100
|
+
function Gr(e) {
|
|
2101
|
+
let t = Wr[e];
|
|
2102
|
+
return H(t, {
|
|
2062
2103
|
size: 18,
|
|
2063
2104
|
strokeWidth: 1.6,
|
|
2064
2105
|
absoluteStrokeWidth: !0,
|
|
2065
2106
|
"aria-hidden": "true"
|
|
2066
2107
|
});
|
|
2067
2108
|
}
|
|
2068
|
-
var
|
|
2069
|
-
paragraph:
|
|
2070
|
-
"heading-1":
|
|
2071
|
-
"heading-2":
|
|
2072
|
-
"heading-3":
|
|
2073
|
-
"bullet-list":
|
|
2074
|
-
"numbered-list":
|
|
2075
|
-
"todo-list":
|
|
2076
|
-
quote:
|
|
2077
|
-
"code-block":
|
|
2109
|
+
var Kr = {
|
|
2110
|
+
paragraph: _r,
|
|
2111
|
+
"heading-1": Un,
|
|
2112
|
+
"heading-2": Wn,
|
|
2113
|
+
"heading-3": Gn,
|
|
2114
|
+
"bullet-list": er,
|
|
2115
|
+
"numbered-list": nr,
|
|
2116
|
+
"todo-list": tr,
|
|
2117
|
+
quote: sr,
|
|
2118
|
+
"code-block": Mn
|
|
2078
2119
|
};
|
|
2079
|
-
function
|
|
2080
|
-
return
|
|
2120
|
+
function qr(e, t) {
|
|
2121
|
+
return se(e, t).label;
|
|
2081
2122
|
}
|
|
2082
|
-
var
|
|
2123
|
+
var Jr = Y({
|
|
2083
2124
|
name: "MarkweaveVueFloatingToolbar",
|
|
2084
2125
|
props: {
|
|
2085
2126
|
editor: {
|
|
@@ -2096,28 +2137,28 @@ var Kr = J({
|
|
|
2096
2137
|
}
|
|
2097
2138
|
},
|
|
2098
2139
|
setup(e) {
|
|
2099
|
-
let t =
|
|
2140
|
+
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) => [
|
|
2100
2141
|
e.id,
|
|
2101
2142
|
e.label,
|
|
2102
|
-
|
|
2103
|
-
])), f =
|
|
2143
|
+
Kr[e.id]
|
|
2144
|
+
])), f = G(() => ue(e.messages).map((e) => [
|
|
2104
2145
|
e.id,
|
|
2105
2146
|
e.value,
|
|
2106
2147
|
e.label
|
|
2107
|
-
])), p =
|
|
2148
|
+
])), p = G(() => ce(e.messages).map((e) => [
|
|
2108
2149
|
e.id,
|
|
2109
2150
|
e.value,
|
|
2110
2151
|
e.label
|
|
2111
|
-
])), m =
|
|
2152
|
+
])), m = G(() => le(e.messages).map((e) => e.id)), h = () => {
|
|
2112
2153
|
l.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: l.value }).run(), t.value = null);
|
|
2113
2154
|
}, g = () => {
|
|
2114
2155
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
2115
2156
|
}, _ = (r) => {
|
|
2116
2157
|
t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
|
|
2117
|
-
}, v =
|
|
2158
|
+
}, v = B(() => {
|
|
2118
2159
|
let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
2119
2160
|
if (!t.value || !n || !r) return;
|
|
2120
|
-
let s =
|
|
2161
|
+
let s = _e({
|
|
2121
2162
|
toolbarRect: n.getBoundingClientRect(),
|
|
2122
2163
|
popoverSize: r.getBoundingClientRect(),
|
|
2123
2164
|
viewport: {
|
|
@@ -2129,11 +2170,11 @@ var Kr = J({
|
|
|
2129
2170
|
});
|
|
2130
2171
|
a.value = s.placement;
|
|
2131
2172
|
});
|
|
2132
|
-
|
|
2133
|
-
e &&
|
|
2134
|
-
}),
|
|
2173
|
+
K(t, (e) => {
|
|
2174
|
+
e && J(v.schedule);
|
|
2175
|
+
}), Cn(() => {
|
|
2135
2176
|
window.addEventListener("resize", v.schedule), window.addEventListener("scroll", v.schedule, !0);
|
|
2136
|
-
}),
|
|
2177
|
+
}), q(() => {
|
|
2137
2178
|
v.cancel(), window.removeEventListener("resize", v.schedule), window.removeEventListener("scroll", v.schedule, !0);
|
|
2138
2179
|
});
|
|
2139
2180
|
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) => {
|
|
@@ -2147,7 +2188,7 @@ var Kr = J({
|
|
|
2147
2188
|
let e = r.value;
|
|
2148
2189
|
if (!e || t.value !== null) return null;
|
|
2149
2190
|
let n = u.value.buttons[e];
|
|
2150
|
-
return n ?
|
|
2191
|
+
return n ? H("div", {
|
|
2151
2192
|
class: "markweave-floating-toolbar-tooltip",
|
|
2152
2193
|
role: "tooltip",
|
|
2153
2194
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
@@ -2155,7 +2196,7 @@ var Kr = J({
|
|
|
2155
2196
|
"data-active": y(e),
|
|
2156
2197
|
style: i.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${i.value}px` }
|
|
2157
2198
|
}, n) : null;
|
|
2158
|
-
}, S = (n, i, a, o, s = !1, c) =>
|
|
2199
|
+
}, S = (n, i, a, o, s = !1, c) => H("button", {
|
|
2159
2200
|
type: "button",
|
|
2160
2201
|
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
2161
2202
|
"aria-label": i,
|
|
@@ -2174,13 +2215,13 @@ var Kr = J({
|
|
|
2174
2215
|
onMouseenter: (e) => b(n, e.currentTarget),
|
|
2175
2216
|
onMouseleave: () => b(null),
|
|
2176
2217
|
onClick: o
|
|
2177
|
-
}, n === "block-type" ? [
|
|
2218
|
+
}, n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, qr(e.editor, e.messages)), Z(t.value === "block-type" ? In : Fn, 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" ? In : Fn, i)])] : [Z(a, i)]), C = () => H("span", {
|
|
2178
2219
|
class: "markweave-floating-toolbar-divider",
|
|
2179
2220
|
"aria-hidden": "true"
|
|
2180
|
-
}), w = (n, r, i) =>
|
|
2221
|
+
}), w = (n, r, i) => H("section", {
|
|
2181
2222
|
class: "markweave-floating-toolbar-color-section",
|
|
2182
2223
|
"aria-label": n
|
|
2183
|
-
}, [
|
|
2224
|
+
}, [H("div", { class: "markweave-floating-toolbar-menu-title" }, n), H("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => H("button", {
|
|
2184
2225
|
key: `${r}-${n}`,
|
|
2185
2226
|
type: "button",
|
|
2186
2227
|
"aria-label": a,
|
|
@@ -2189,33 +2230,33 @@ var Kr = J({
|
|
|
2189
2230
|
onClick: () => {
|
|
2190
2231
|
r === "text" ? i ? e.editor.chain().focus().setColor(i).run() : e.editor.chain().focus().unsetColor().run() : i ? e.editor.chain().focus().toggleHighlight({ color: i }).run() : e.editor.chain().focus().unsetHighlight().run(), t.value = null;
|
|
2191
2232
|
}
|
|
2192
|
-
}, r === "text" ? [
|
|
2233
|
+
}, r === "text" ? [H("span", {
|
|
2193
2234
|
class: "markweave-floating-toolbar-text-swatch",
|
|
2194
2235
|
style: { color: i ?? "#646970" }
|
|
2195
|
-
}, "A")] : [
|
|
2236
|
+
}, "A")] : [H("span", {
|
|
2196
2237
|
class: "markweave-floating-toolbar-highlight-swatch",
|
|
2197
2238
|
style: { backgroundColor: i ?? "#ffffff" },
|
|
2198
2239
|
"aria-hidden": "true"
|
|
2199
|
-
})])))]), T = () => t.value === "block-type" ?
|
|
2240
|
+
})])))]), T = () => t.value === "block-type" ? H("div", {
|
|
2200
2241
|
ref: c,
|
|
2201
2242
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
|
|
2202
2243
|
"data-testid": "markweave-floating-toolbar-turn-menu"
|
|
2203
|
-
}, [
|
|
2244
|
+
}, [H("div", { class: "markweave-floating-toolbar-menu-title" }, u.value.turnIntoTitle), ...d.value.map(([n, r, i]) => H("button", {
|
|
2204
2245
|
key: n,
|
|
2205
2246
|
type: "button",
|
|
2206
2247
|
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
2207
2248
|
onMousedown: $,
|
|
2208
2249
|
onClick: () => {
|
|
2209
|
-
|
|
2250
|
+
pe(e.editor, n), t.value = null;
|
|
2210
2251
|
}
|
|
2211
|
-
}, [
|
|
2252
|
+
}, [H("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), H("span", null, r)]))]) : t.value === "link" ? H("form", {
|
|
2212
2253
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
2213
2254
|
ref: c,
|
|
2214
2255
|
"data-testid": "markweave-floating-toolbar-link-popover",
|
|
2215
2256
|
onSubmit: (e) => {
|
|
2216
2257
|
e.preventDefault(), h();
|
|
2217
2258
|
}
|
|
2218
|
-
}, [
|
|
2259
|
+
}, [H("input", {
|
|
2219
2260
|
value: n.value,
|
|
2220
2261
|
placeholder: u.value.linkPlaceholder,
|
|
2221
2262
|
"aria-label": u.value.linkUrlLabel,
|
|
@@ -2223,45 +2264,45 @@ var Kr = J({
|
|
|
2223
2264
|
onInput: (e) => {
|
|
2224
2265
|
n.value = e.target.value;
|
|
2225
2266
|
}
|
|
2226
|
-
}),
|
|
2227
|
-
|
|
2267
|
+
}), H("span", { class: "markweave-floating-toolbar-link-actions" }, [
|
|
2268
|
+
H("button", {
|
|
2228
2269
|
type: "submit",
|
|
2229
2270
|
disabled: !l.value,
|
|
2230
2271
|
"aria-label": u.value.applyLink,
|
|
2231
2272
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2232
2273
|
onMousedown: $
|
|
2233
|
-
}, [Z(
|
|
2234
|
-
|
|
2274
|
+
}, [Z(zn, u.value.applyLink)]),
|
|
2275
|
+
H("span", {
|
|
2235
2276
|
class: "markweave-floating-toolbar-link-divider",
|
|
2236
2277
|
"aria-hidden": "true"
|
|
2237
2278
|
}),
|
|
2238
|
-
|
|
2279
|
+
H("button", {
|
|
2239
2280
|
type: "button",
|
|
2240
2281
|
disabled: !l.value,
|
|
2241
2282
|
"aria-label": u.value.openLink,
|
|
2242
2283
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2243
2284
|
onMousedown: $,
|
|
2244
|
-
onClick: () =>
|
|
2245
|
-
}, [Z(
|
|
2246
|
-
|
|
2285
|
+
onClick: () => Hr(n.value)
|
|
2286
|
+
}, [Z(Hn, u.value.openLink)]),
|
|
2287
|
+
H("button", {
|
|
2247
2288
|
type: "button",
|
|
2248
2289
|
"aria-label": u.value.removeLink,
|
|
2249
2290
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2250
2291
|
onMousedown: $,
|
|
2251
2292
|
onClick: g
|
|
2252
|
-
}, [Z(
|
|
2253
|
-
])]) : t.value === "color" ?
|
|
2293
|
+
}, [Z(gr, u.value.removeLink)])
|
|
2294
|
+
])]) : t.value === "color" ? H("div", {
|
|
2254
2295
|
ref: c,
|
|
2255
2296
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
2256
2297
|
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
2257
|
-
}, [w(u.value.textColorTitle, "text", f.value), w(u.value.highlightColorTitle, "highlight", p.value)]) : t.value === "more" ?
|
|
2298
|
+
}, [w(u.value.textColorTitle, "text", f.value), w(u.value.highlightColorTitle, "highlight", p.value)]) : t.value === "more" ? H("div", {
|
|
2258
2299
|
ref: c,
|
|
2259
2300
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
2260
2301
|
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
2261
|
-
}, m.value.map((n) =>
|
|
2302
|
+
}, m.value.map((n) => H("span", {
|
|
2262
2303
|
key: n,
|
|
2263
2304
|
class: "markweave-floating-toolbar-more-item"
|
|
2264
|
-
}, [
|
|
2305
|
+
}, [H("button", {
|
|
2265
2306
|
type: "button",
|
|
2266
2307
|
"aria-label": u.value.moreActions[n],
|
|
2267
2308
|
"data-testid": `markweave-floating-toolbar-more-${n}`,
|
|
@@ -2274,43 +2315,43 @@ var Kr = J({
|
|
|
2274
2315
|
r.value = null;
|
|
2275
2316
|
},
|
|
2276
2317
|
onClick: () => {
|
|
2277
|
-
|
|
2318
|
+
fe(e.editor, n), t.value = null;
|
|
2278
2319
|
}
|
|
2279
|
-
}, [Z(
|
|
2320
|
+
}, [Z(Ur[n], u.value.moreActions[n])]), r.value === n ? H("div", {
|
|
2280
2321
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2281
2322
|
role: "tooltip"
|
|
2282
2323
|
}, u.value.moreActions[n]) : null]))) : null;
|
|
2283
|
-
return () =>
|
|
2324
|
+
return () => H(z, {
|
|
2284
2325
|
editor: e.editor,
|
|
2285
|
-
shouldShow: ({ editor: e }) => e.isEditable &&
|
|
2326
|
+
shouldShow: ({ editor: e }) => e.isEditable && be(ve(e)),
|
|
2286
2327
|
options: { placement: "top" }
|
|
2287
|
-
}, { default: () =>
|
|
2328
|
+
}, { default: () => H("div", {
|
|
2288
2329
|
ref: o,
|
|
2289
2330
|
class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
|
|
2290
2331
|
"data-popover-placement": t.value ? a.value : void 0,
|
|
2291
2332
|
"data-testid": "markweave-floating-toolbar"
|
|
2292
|
-
}, [
|
|
2333
|
+
}, [H("div", {
|
|
2293
2334
|
ref: s,
|
|
2294
2335
|
class: "markweave-floating-toolbar-content",
|
|
2295
2336
|
"data-menu": t.value ?? "none"
|
|
2296
2337
|
}, [
|
|
2297
|
-
S("block-type", u.value.buttons["block-type"],
|
|
2338
|
+
S("block-type", u.value.buttons["block-type"], _r, () => _("block-type"), t.value === "block-type"),
|
|
2298
2339
|
C(),
|
|
2299
|
-
S("bold", u.value.buttons.bold,
|
|
2300
|
-
S("italic", u.value.buttons.italic,
|
|
2301
|
-
S("underline", u.value.buttons.underline,
|
|
2302
|
-
S("strike", u.value.buttons.strike,
|
|
2303
|
-
S("inline-code", u.value.buttons["inline-code"],
|
|
2340
|
+
S("bold", u.value.buttons.bold, jn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2341
|
+
S("italic", u.value.buttons.italic, Zn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2342
|
+
S("underline", u.value.buttons.underline, vr, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2343
|
+
S("strike", u.value.buttons.strike, dr, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2344
|
+
S("inline-code", u.value.buttons["inline-code"], Rn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2304
2345
|
C(),
|
|
2305
|
-
S("link", u.value.buttons.link,
|
|
2306
|
-
S("color", u.value.buttons.color,
|
|
2346
|
+
S("link", u.value.buttons.link, $n, () => _("link"), e.editor.isActive("link")),
|
|
2347
|
+
S("color", u.value.buttons.color, _r, () => _("color"), t.value === "color"),
|
|
2307
2348
|
C(),
|
|
2308
|
-
S("more", u.value.buttons.more,
|
|
2349
|
+
S("more", u.value.buttons.more, ir, () => _("more"), t.value === "more"),
|
|
2309
2350
|
T(),
|
|
2310
2351
|
x()
|
|
2311
2352
|
])]) });
|
|
2312
2353
|
}
|
|
2313
|
-
}),
|
|
2354
|
+
}), Yr = Y({
|
|
2314
2355
|
name: "MarkweaveVueMathEditorPopover",
|
|
2315
2356
|
props: {
|
|
2316
2357
|
editor: {
|
|
@@ -2331,10 +2372,10 @@ var Kr = J({
|
|
|
2331
2372
|
}
|
|
2332
2373
|
},
|
|
2333
2374
|
setup(e) {
|
|
2334
|
-
let t =
|
|
2375
|
+
let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(_t(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
|
|
2335
2376
|
html: a.value,
|
|
2336
2377
|
error: !1
|
|
2337
|
-
} : xt(t.value, e.target.kind, e.editor)), s =
|
|
2378
|
+
} : xt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => gt(e.editor, e.target) ?? 1), u = () => {
|
|
2338
2379
|
if (typeof window > "u") return;
|
|
2339
2380
|
let r = ht(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2340
2381
|
if (!r || !i) {
|
|
@@ -2361,13 +2402,13 @@ var Kr = J({
|
|
|
2361
2402
|
let n = t.target;
|
|
2362
2403
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2363
2404
|
};
|
|
2364
|
-
return
|
|
2365
|
-
t.value = e.target.latex, a.value = _t(e.editor, e.target),
|
|
2366
|
-
}),
|
|
2367
|
-
St(e.editor, e.target, !0), u(),
|
|
2405
|
+
return K(() => [e.target.pos, e.target.latex], () => {
|
|
2406
|
+
t.value = e.target.latex, a.value = _t(e.editor, e.target), J(u);
|
|
2407
|
+
}), Cn(() => {
|
|
2408
|
+
St(e.editor, e.target, !0), u(), J(() => {
|
|
2368
2409
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2369
2410
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2370
|
-
}),
|
|
2411
|
+
}), q(() => {
|
|
2371
2412
|
St(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2372
2413
|
}), () => {
|
|
2373
2414
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
@@ -2381,7 +2422,7 @@ var Kr = J({
|
|
|
2381
2422
|
},
|
|
2382
2423
|
onKeydown: f
|
|
2383
2424
|
};
|
|
2384
|
-
return e.target.kind === "inline" ?
|
|
2425
|
+
return e.target.kind === "inline" ? H("form", {
|
|
2385
2426
|
ref: r,
|
|
2386
2427
|
class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
|
|
2387
2428
|
"aria-label": a,
|
|
@@ -2396,22 +2437,22 @@ var Kr = J({
|
|
|
2396
2437
|
onSubmit: (e) => {
|
|
2397
2438
|
e.preventDefault(), d();
|
|
2398
2439
|
}
|
|
2399
|
-
}, [
|
|
2440
|
+
}, [H("label", {
|
|
2400
2441
|
class: "markweave-math-inline-source",
|
|
2401
2442
|
"data-testid": "markweave-math-inline-source"
|
|
2402
2443
|
}, [
|
|
2403
|
-
|
|
2404
|
-
|
|
2444
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$"),
|
|
2445
|
+
H("input", {
|
|
2405
2446
|
...u,
|
|
2406
2447
|
"aria-label": c.value.latexLabel,
|
|
2407
2448
|
size: Math.max(t.value.length, 1)
|
|
2408
2449
|
}),
|
|
2409
|
-
|
|
2410
|
-
]),
|
|
2450
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$")
|
|
2451
|
+
]), H("div", {
|
|
2411
2452
|
class: "markweave-math-inline-preview",
|
|
2412
2453
|
"data-error": o.value.error ? "true" : "false",
|
|
2413
2454
|
"data-testid": "markweave-math-editor-preview"
|
|
2414
|
-
}, [
|
|
2455
|
+
}, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])]) : H("form", {
|
|
2415
2456
|
ref: r,
|
|
2416
2457
|
class: "markweave-math-editor-popover markweave-math-editor-popover--block",
|
|
2417
2458
|
"aria-label": a,
|
|
@@ -2427,39 +2468,39 @@ var Kr = J({
|
|
|
2427
2468
|
e.preventDefault(), d();
|
|
2428
2469
|
}
|
|
2429
2470
|
}, [
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
Z(
|
|
2433
|
-
|
|
2471
|
+
H("div", { class: "markweave-math-block-toolbar" }, [
|
|
2472
|
+
H("span", null, c.value.label),
|
|
2473
|
+
Z(Rn, c.value.label, 15, 1.75),
|
|
2474
|
+
H("button", {
|
|
2434
2475
|
type: "submit",
|
|
2435
2476
|
title: c.value.apply,
|
|
2436
2477
|
"aria-label": c.value.apply,
|
|
2437
2478
|
disabled: !s.value,
|
|
2438
2479
|
"data-testid": "markweave-math-editor-apply"
|
|
2439
|
-
}, [Z(
|
|
2480
|
+
}, [Z(Pn, c.value.apply, 16, 2)])
|
|
2440
2481
|
]),
|
|
2441
|
-
|
|
2482
|
+
H("label", {
|
|
2442
2483
|
class: "markweave-math-block-source",
|
|
2443
2484
|
"data-testid": "markweave-math-block-source"
|
|
2444
2485
|
}, [
|
|
2445
|
-
|
|
2446
|
-
|
|
2486
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$$"),
|
|
2487
|
+
H("textarea", {
|
|
2447
2488
|
...u,
|
|
2448
2489
|
"aria-label": c.value.latexLabel,
|
|
2449
2490
|
rows: 3
|
|
2450
2491
|
}),
|
|
2451
|
-
|
|
2492
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$$")
|
|
2452
2493
|
]),
|
|
2453
|
-
|
|
2494
|
+
H("div", {
|
|
2454
2495
|
class: "markweave-math-block-preview",
|
|
2455
2496
|
"data-error": o.value.error ? "true" : "false",
|
|
2456
2497
|
"data-math-number": String(l.value),
|
|
2457
2498
|
"data-testid": "markweave-math-editor-preview"
|
|
2458
|
-
}, [
|
|
2499
|
+
}, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])
|
|
2459
2500
|
]);
|
|
2460
2501
|
};
|
|
2461
2502
|
}
|
|
2462
|
-
}),
|
|
2503
|
+
}), Xr = Y({
|
|
2463
2504
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2464
2505
|
props: {
|
|
2465
2506
|
commands: {
|
|
@@ -2496,7 +2537,7 @@ var Kr = J({
|
|
|
2496
2537
|
}
|
|
2497
2538
|
},
|
|
2498
2539
|
setup(e) {
|
|
2499
|
-
let t =
|
|
2540
|
+
let t = U(""), n = U(null), r = U(null), i = U(!1), a = U(""), o = U(0), s = G(() => {
|
|
2500
2541
|
let t = a.value.trim().toLowerCase();
|
|
2501
2542
|
return (t ? e.messages.slash.emojiItems.filter((e) => [
|
|
2502
2543
|
e.emoji,
|
|
@@ -2518,13 +2559,13 @@ var Kr = J({
|
|
|
2518
2559
|
} : {
|
|
2519
2560
|
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
2520
2561
|
trigger: "slash-command",
|
|
2521
|
-
source:
|
|
2562
|
+
source: L(t.value)
|
|
2522
2563
|
};
|
|
2523
2564
|
if (!n.value && !t.value.trim()) {
|
|
2524
2565
|
r.value = e.messages.slash.uploadRequiredError;
|
|
2525
2566
|
return;
|
|
2526
2567
|
}
|
|
2527
|
-
let a = await
|
|
2568
|
+
let a = await R(i, e.onUpload);
|
|
2528
2569
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2529
2570
|
} catch (t) {
|
|
2530
2571
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -2551,32 +2592,32 @@ var Kr = J({
|
|
|
2551
2592
|
group: t,
|
|
2552
2593
|
commands: e.commands.filter((e) => e.group === t)
|
|
2553
2594
|
})).filter((e) => e.commands.length);
|
|
2554
|
-
return
|
|
2595
|
+
return H("div", {
|
|
2555
2596
|
class: "markweave-slash-layer",
|
|
2556
2597
|
style: { display: "contents" },
|
|
2557
2598
|
"data-testid": "markweave-slash-layer"
|
|
2558
|
-
}, [
|
|
2599
|
+
}, [H("div", {
|
|
2559
2600
|
class: "markweave-slash-trigger",
|
|
2560
2601
|
style: d,
|
|
2561
2602
|
"aria-hidden": "true",
|
|
2562
2603
|
"data-testid": "markweave-slash-trigger"
|
|
2563
|
-
}, [
|
|
2604
|
+
}, [H("span", null, "/"), H("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), H("div", {
|
|
2564
2605
|
class: "markweave-slash-menu",
|
|
2565
2606
|
style: u,
|
|
2566
2607
|
role: "listbox",
|
|
2567
2608
|
"aria-label": e.messages.slash.ariaLabel,
|
|
2568
2609
|
"data-placement": e.position.placement,
|
|
2569
2610
|
"data-testid": "markweave-slash-menu"
|
|
2570
|
-
}, [e.inputCommand?.inputKind === "emoji" ?
|
|
2611
|
+
}, [e.inputCommand?.inputKind === "emoji" ? H("div", {
|
|
2571
2612
|
class: "markweave-slash-subpanel",
|
|
2572
2613
|
"data-testid": "markweave-slash-emoji-picker"
|
|
2573
2614
|
}, [
|
|
2574
|
-
|
|
2615
|
+
H("div", { class: "markweave-slash-subpanel-header" }, [H("button", {
|
|
2575
2616
|
type: "button",
|
|
2576
2617
|
onMousedown: $,
|
|
2577
2618
|
onClick: () => e.onInputCommandChange(null)
|
|
2578
|
-
}, e.messages.common.back),
|
|
2579
|
-
|
|
2619
|
+
}, e.messages.common.back), H("span", null, e.messages.slash.emojiTitle)]),
|
|
2620
|
+
H("label", { class: "markweave-slash-input" }, [H("span", null, "/"), H("input", {
|
|
2580
2621
|
autofocus: !0,
|
|
2581
2622
|
value: a.value,
|
|
2582
2623
|
placeholder: e.messages.slash.emojiSearchPlaceholder,
|
|
@@ -2587,11 +2628,11 @@ var Kr = J({
|
|
|
2587
2628
|
t.key === "Escape" ? (t.preventDefault(), e.onInputCommandChange(null)) : t.key === "ArrowDown" ? (t.preventDefault(), o.value = s.value.length ? (o.value + 1) % s.value.length : 0) : t.key === "ArrowUp" ? (t.preventDefault(), o.value = s.value.length ? (o.value - 1 + s.value.length) % s.value.length : 0) : (t.key === "Enter" || t.key === "Tab") && (t.preventDefault(), l(o.value));
|
|
2588
2629
|
}
|
|
2589
2630
|
})]),
|
|
2590
|
-
|
|
2631
|
+
H("div", {
|
|
2591
2632
|
class: "markweave-slash-emoji-grid",
|
|
2592
2633
|
role: "listbox",
|
|
2593
2634
|
"aria-label": e.messages.slash.emojiTitle
|
|
2594
|
-
}, s.value.map((e, t) =>
|
|
2635
|
+
}, s.value.map((e, t) => H("button", {
|
|
2595
2636
|
key: `${e.emoji}-${e.label}`,
|
|
2596
2637
|
type: "button",
|
|
2597
2638
|
role: "option",
|
|
@@ -2600,17 +2641,17 @@ var Kr = J({
|
|
|
2600
2641
|
onMouseenter: () => o.value = t,
|
|
2601
2642
|
onMousedown: $,
|
|
2602
2643
|
onClick: () => l(t)
|
|
2603
|
-
}, [
|
|
2604
|
-
]) : e.inputCommand?.inputKind === "upload" ?
|
|
2644
|
+
}, [H("span", null, e.emoji), H("small", null, e.label)])))
|
|
2645
|
+
]) : e.inputCommand?.inputKind === "upload" ? H("div", {
|
|
2605
2646
|
class: "markweave-slash-subpanel",
|
|
2606
2647
|
"data-testid": "markweave-slash-upload-panel"
|
|
2607
2648
|
}, [
|
|
2608
|
-
|
|
2649
|
+
H("div", { class: "markweave-slash-upload-header" }, [H("button", {
|
|
2609
2650
|
type: "button",
|
|
2610
2651
|
onMousedown: $,
|
|
2611
2652
|
onClick: () => e.onInputCommandChange(null)
|
|
2612
|
-
}, e.messages.common.back),
|
|
2613
|
-
|
|
2653
|
+
}, e.messages.common.back), H("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
|
|
2654
|
+
H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.slash.uploadValueLabel), H("input", {
|
|
2614
2655
|
autofocus: !0,
|
|
2615
2656
|
value: t.value,
|
|
2616
2657
|
placeholder: e.messages.slash.uploadValuePlaceholder,
|
|
@@ -2621,32 +2662,32 @@ var Kr = J({
|
|
|
2621
2662
|
e.key === "Enter" && (e.preventDefault(), c());
|
|
2622
2663
|
}
|
|
2623
2664
|
})]),
|
|
2624
|
-
|
|
2665
|
+
H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.common.file), H("input", {
|
|
2625
2666
|
type: "file",
|
|
2626
2667
|
onChange: (e) => n.value = e.target.files?.[0] ?? null
|
|
2627
2668
|
})]),
|
|
2628
|
-
r.value ?
|
|
2669
|
+
r.value ? H("div", {
|
|
2629
2670
|
class: "markweave-slash-upload-error",
|
|
2630
2671
|
role: "alert"
|
|
2631
2672
|
}, r.value) : null,
|
|
2632
|
-
|
|
2673
|
+
H("div", { class: "markweave-slash-upload-actions" }, [H("button", {
|
|
2633
2674
|
type: "button",
|
|
2634
2675
|
onMousedown: $,
|
|
2635
2676
|
onClick: () => e.onInputCommandChange(null)
|
|
2636
|
-
}, e.messages.common.cancel),
|
|
2677
|
+
}, e.messages.common.cancel), H("button", {
|
|
2637
2678
|
type: "button",
|
|
2638
2679
|
"data-primary": "true",
|
|
2639
2680
|
disabled: i.value,
|
|
2640
2681
|
onMousedown: $,
|
|
2641
2682
|
onClick: c
|
|
2642
2683
|
}, e.messages.common.insert)])
|
|
2643
|
-
]) : e.commands.length ?
|
|
2684
|
+
]) : e.commands.length ? H("div", { class: "markweave-slash-command-list" }, f.map((t) => H("section", {
|
|
2644
2685
|
key: t.group,
|
|
2645
2686
|
class: "markweave-slash-group",
|
|
2646
2687
|
"aria-label": t.group
|
|
2647
|
-
}, [
|
|
2688
|
+
}, [H("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
2648
2689
|
let n = e.commands.indexOf(t) === e.state.activeIndex, r = jt(t);
|
|
2649
|
-
return
|
|
2690
|
+
return H("button", {
|
|
2650
2691
|
key: t.id,
|
|
2651
2692
|
type: "button",
|
|
2652
2693
|
role: "option",
|
|
@@ -2668,18 +2709,18 @@ var Kr = J({
|
|
|
2668
2709
|
}
|
|
2669
2710
|
}
|
|
2670
2711
|
}, [
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
t.disabledReason ?
|
|
2712
|
+
Gr(t.icon),
|
|
2713
|
+
H("span", null, t.label),
|
|
2714
|
+
t.disabledReason ? H("small", null, t.disabledReason) : null
|
|
2674
2715
|
]);
|
|
2675
|
-
})]))) :
|
|
2716
|
+
})]))) : H("div", {
|
|
2676
2717
|
class: "markweave-slash-menu__empty",
|
|
2677
2718
|
role: "option",
|
|
2678
2719
|
"aria-disabled": "true"
|
|
2679
2720
|
}, e.messages.slash.noResults)])]);
|
|
2680
2721
|
};
|
|
2681
2722
|
}
|
|
2682
|
-
}),
|
|
2723
|
+
}), Zr = Y({
|
|
2683
2724
|
name: "MarkweaveVueTableControls",
|
|
2684
2725
|
props: {
|
|
2685
2726
|
editor: {
|
|
@@ -2712,7 +2753,7 @@ var Kr = J({
|
|
|
2712
2753
|
}
|
|
2713
2754
|
},
|
|
2714
2755
|
setup(e) {
|
|
2715
|
-
let t =
|
|
2756
|
+
let t = U(null), n = U("row-edge"), r = U(null), 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(null), p = null, m = G(() => e.active ? Ht(e.editor.state) : Lr), h = G(() => en(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = G(() => en(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = G(() => Qt(e.editor)), v = G(() => _.value.length > 0), y = G(() => t.value ? an(e.editor, t.value) : []), b = () => {
|
|
2716
2757
|
p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
|
|
2717
2758
|
}, x = (e) => {
|
|
2718
2759
|
b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
|
|
@@ -2770,20 +2811,20 @@ var Kr = J({
|
|
|
2770
2811
|
}, w = () => {
|
|
2771
2812
|
S(), C();
|
|
2772
2813
|
}, T = () => {
|
|
2773
|
-
|
|
2814
|
+
J(w);
|
|
2774
2815
|
}, E = (e, r) => {
|
|
2775
2816
|
let i = t.value === e && n.value === r;
|
|
2776
2817
|
n.value = r, t.value = i ? null : e, T();
|
|
2777
|
-
},
|
|
2818
|
+
}, D = () => {
|
|
2778
2819
|
e.editor.view.dispatch(zt(e.editor.state.tr, null));
|
|
2779
|
-
},
|
|
2820
|
+
}, O = (t, n) => {
|
|
2780
2821
|
let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
2781
2822
|
r !== null && cn(e.editor, r, t, { visualIndex: i }), E(t, n);
|
|
2782
|
-
},
|
|
2783
|
-
|
|
2784
|
-
},
|
|
2823
|
+
}, k = () => {
|
|
2824
|
+
D(), E("selection", "selection-edge");
|
|
2825
|
+
}, A = (n = !1) => {
|
|
2785
2826
|
t.value = null, o.value = null, n && e.editor.view.focus();
|
|
2786
|
-
},
|
|
2827
|
+
}, j = async (n, r) => {
|
|
2787
2828
|
let i = await Yt({
|
|
2788
2829
|
editor: e.editor,
|
|
2789
2830
|
commandId: n,
|
|
@@ -2791,19 +2832,19 @@ var Kr = J({
|
|
|
2791
2832
|
messages: e.messages
|
|
2792
2833
|
});
|
|
2793
2834
|
return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
2794
|
-
},
|
|
2835
|
+
}, M = (t) => {
|
|
2795
2836
|
let n = tn(e.editor, t);
|
|
2796
|
-
n && e.onEditWithAi?.(n),
|
|
2797
|
-
}, M = (e) => {
|
|
2798
|
-
!t.value || e.key !== "Escape" || k(!0);
|
|
2837
|
+
n && e.onEditWithAi?.(n), A(!0);
|
|
2799
2838
|
}, N = (e) => {
|
|
2800
|
-
t.value
|
|
2839
|
+
!t.value || e.key !== "Escape" || A(!0);
|
|
2840
|
+
}, P = (e) => {
|
|
2841
|
+
t.value && (e.target instanceof Node && c.value?.contains(e.target) || A());
|
|
2801
2842
|
};
|
|
2802
|
-
|
|
2803
|
-
w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown",
|
|
2804
|
-
}),
|
|
2805
|
-
b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown",
|
|
2806
|
-
}),
|
|
2843
|
+
Cn(() => {
|
|
2844
|
+
w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", N), document.addEventListener("mousedown", P);
|
|
2845
|
+
}), q(() => {
|
|
2846
|
+
b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", N), document.removeEventListener("mousedown", P);
|
|
2847
|
+
}), K(() => [
|
|
2807
2848
|
e.active,
|
|
2808
2849
|
m.value.activeCellPos,
|
|
2809
2850
|
m.value.selectionFrom,
|
|
@@ -2814,7 +2855,7 @@ var Kr = J({
|
|
|
2814
2855
|
t.value,
|
|
2815
2856
|
n.value
|
|
2816
2857
|
], T, { flush: "post" });
|
|
2817
|
-
let
|
|
2858
|
+
let F = () => t.value ? H("div", {
|
|
2818
2859
|
ref: f,
|
|
2819
2860
|
class: "markweave-table-menu",
|
|
2820
2861
|
role: "menu",
|
|
@@ -2827,7 +2868,7 @@ var Kr = J({
|
|
|
2827
2868
|
} : void 0
|
|
2828
2869
|
}, y.value.map((n, r) => {
|
|
2829
2870
|
let i = nn(n), a = r === 0 ? i : nn(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Jt(e.editor, n.commandId), c = rn(n, e.messages);
|
|
2830
|
-
return
|
|
2871
|
+
return H("button", {
|
|
2831
2872
|
key: `${n.id}-${r}`,
|
|
2832
2873
|
type: "button",
|
|
2833
2874
|
role: "menuitem",
|
|
@@ -2842,15 +2883,15 @@ var Kr = J({
|
|
|
2842
2883
|
onClick: () => {
|
|
2843
2884
|
if (s) {
|
|
2844
2885
|
if (n.commandId === null) {
|
|
2845
|
-
|
|
2886
|
+
M(t.value === "row" || t.value === "column" ? t.value : "selection");
|
|
2846
2887
|
return;
|
|
2847
2888
|
}
|
|
2848
|
-
|
|
2889
|
+
j(n.commandId).finally(() => A());
|
|
2849
2890
|
}
|
|
2850
2891
|
}
|
|
2851
2892
|
}, c);
|
|
2852
2893
|
})) : null;
|
|
2853
|
-
return () => e.active ?
|
|
2894
|
+
return () => e.active ? H("div", {
|
|
2854
2895
|
ref: c,
|
|
2855
2896
|
class: "markweave-table-controls",
|
|
2856
2897
|
"data-testid": "markweave-table-controls",
|
|
@@ -2858,7 +2899,7 @@ var Kr = J({
|
|
|
2858
2899
|
"data-open-menu": t.value ?? "none",
|
|
2859
2900
|
"data-positioned": r.value || i.value || a.value ? "true" : "false"
|
|
2860
2901
|
}, [
|
|
2861
|
-
s.value ?
|
|
2902
|
+
s.value ? H("div", {
|
|
2862
2903
|
class: "markweave-table-copy-feedback",
|
|
2863
2904
|
role: "status",
|
|
2864
2905
|
"aria-live": "polite",
|
|
@@ -2867,7 +2908,7 @@ var Kr = J({
|
|
|
2867
2908
|
"data-text-length": s.value.textLength,
|
|
2868
2909
|
"data-html-length": s.value.htmlLength
|
|
2869
2910
|
}, Xt(s.value)) : null,
|
|
2870
|
-
r.value ?
|
|
2911
|
+
r.value ? H("button", {
|
|
2871
2912
|
ref: l,
|
|
2872
2913
|
type: "button",
|
|
2873
2914
|
class: "markweave-table-edge-handle markweave-table-edge-handle--row",
|
|
@@ -2885,9 +2926,9 @@ var Kr = J({
|
|
|
2885
2926
|
top: `${r.value.top}px`
|
|
2886
2927
|
},
|
|
2887
2928
|
onMousedown: $,
|
|
2888
|
-
onClick: () =>
|
|
2889
|
-
}, [
|
|
2890
|
-
i.value ?
|
|
2929
|
+
onClick: () => O("row", "row-edge")
|
|
2930
|
+
}, [H("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2931
|
+
i.value ? H("button", {
|
|
2891
2932
|
ref: u,
|
|
2892
2933
|
type: "button",
|
|
2893
2934
|
class: "markweave-table-edge-handle markweave-table-edge-handle--column",
|
|
@@ -2905,9 +2946,9 @@ var Kr = J({
|
|
|
2905
2946
|
top: `${i.value.top}px`
|
|
2906
2947
|
},
|
|
2907
2948
|
onMousedown: $,
|
|
2908
|
-
onClick: () =>
|
|
2909
|
-
}, [
|
|
2910
|
-
v.value && a.value ?
|
|
2949
|
+
onClick: () => O("column", "column-edge")
|
|
2950
|
+
}, [H("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2951
|
+
v.value && a.value ? H("button", {
|
|
2911
2952
|
ref: d,
|
|
2912
2953
|
type: "button",
|
|
2913
2954
|
class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
@@ -2921,12 +2962,12 @@ var Kr = J({
|
|
|
2921
2962
|
top: `${a.value.top}px`
|
|
2922
2963
|
},
|
|
2923
2964
|
onMousedown: $,
|
|
2924
|
-
onClick:
|
|
2925
|
-
}, [
|
|
2926
|
-
|
|
2965
|
+
onClick: k
|
|
2966
|
+
}, [H("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2967
|
+
F()
|
|
2927
2968
|
]) : null;
|
|
2928
2969
|
}
|
|
2929
|
-
}),
|
|
2970
|
+
}), Qr = Y({
|
|
2930
2971
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
2931
2972
|
props: {
|
|
2932
2973
|
editor: {
|
|
@@ -2939,18 +2980,18 @@ var Kr = J({
|
|
|
2939
2980
|
}
|
|
2940
2981
|
},
|
|
2941
2982
|
setup(e) {
|
|
2942
|
-
let t =
|
|
2983
|
+
let t = U(null), n = () => {
|
|
2943
2984
|
if (e.focusState.mode !== "cell-selection") {
|
|
2944
2985
|
t.value = null;
|
|
2945
2986
|
return;
|
|
2946
2987
|
}
|
|
2947
2988
|
t.value = sn(e.editor, Ut(e.editor.state));
|
|
2948
2989
|
};
|
|
2949
|
-
return
|
|
2990
|
+
return Cn(() => {
|
|
2950
2991
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
2951
|
-
}),
|
|
2992
|
+
}), q(() => {
|
|
2952
2993
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
2953
|
-
}),
|
|
2994
|
+
}), K(() => [
|
|
2954
2995
|
e.focusState.activeCellPos,
|
|
2955
2996
|
e.focusState.anchorCellPos,
|
|
2956
2997
|
e.focusState.mode,
|
|
@@ -2958,10 +2999,10 @@ var Kr = J({
|
|
|
2958
2999
|
e.focusState.selectionFrom,
|
|
2959
3000
|
e.focusState.selectionTo
|
|
2960
3001
|
], () => {
|
|
2961
|
-
|
|
3002
|
+
J(n);
|
|
2962
3003
|
}, { flush: "post" }), () => {
|
|
2963
3004
|
let e = t.value;
|
|
2964
|
-
return e ?
|
|
3005
|
+
return e ? H("div", {
|
|
2965
3006
|
"aria-hidden": "true",
|
|
2966
3007
|
class: "markweave-table-selection-overlay",
|
|
2967
3008
|
"data-anchor-cell-pos": e.anchorCellPos ?? "",
|
|
@@ -2982,7 +3023,7 @@ var Kr = J({
|
|
|
2982
3023
|
}) : null;
|
|
2983
3024
|
};
|
|
2984
3025
|
}
|
|
2985
|
-
}),
|
|
3026
|
+
}), $r = Y({
|
|
2986
3027
|
name: "MarkweaveVueCodeBlockControls",
|
|
2987
3028
|
props: {
|
|
2988
3029
|
editor: {
|
|
@@ -3011,46 +3052,46 @@ var Kr = J({
|
|
|
3011
3052
|
}
|
|
3012
3053
|
},
|
|
3013
3054
|
setup(e) {
|
|
3014
|
-
let t =
|
|
3055
|
+
let t = U(null), n = U(null), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U([]), l = U(null), u = U(!1), d = U(""), f = U(-1), p = U(null), m = U(!1), h = U(null), g = U(null), _ = U(!1), v = U({
|
|
3015
3056
|
active: !1,
|
|
3016
3057
|
lastX: 0,
|
|
3017
3058
|
lastY: 0
|
|
3018
|
-
}), y =
|
|
3059
|
+
}), y = U(0), b = U(0), x = U(0), S = null, C = G(() => (x.value, tt(e.editor, o.value))), w = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
3019
3060
|
...e.state,
|
|
3020
3061
|
pos: e.state.pos,
|
|
3021
3062
|
active: !0
|
|
3022
|
-
} : null), T =
|
|
3063
|
+
} : 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), j = G(() => T.value ? Je(T.value.language) : Je("text")), M = G(() => p.value?.status ?? "idle"), N = G(() => T.value?.mermaidPreviewMode ?? e.mermaidMode), P = G(() => D.value && N.value === "preview"), F = G(() => (x.value, y.value, b.value, it(e.editor))), I = G(() => `${b.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = G(() => Qe(d.value)), ee = G(() => T.value ? `${T.value.pos}:${T.value.language}:${T.value.text}` : "none"), R = () => {
|
|
3023
3064
|
S !== null && (window.clearTimeout(S), S = null);
|
|
3024
|
-
},
|
|
3025
|
-
|
|
3065
|
+
}, z = (e) => {
|
|
3066
|
+
R(), p.value = e, e && (S = window.setTimeout(() => {
|
|
3026
3067
|
p.value = null, S = null;
|
|
3027
3068
|
}, Ve));
|
|
3028
|
-
},
|
|
3069
|
+
}, te = () => {
|
|
3029
3070
|
h.value = null, g.value = null, _.value = !1, v.value = {
|
|
3030
3071
|
active: !1,
|
|
3031
3072
|
lastX: 0,
|
|
3032
3073
|
lastY: 0
|
|
3033
3074
|
}, e.editor.view.focus();
|
|
3034
|
-
},
|
|
3075
|
+
}, B = () => {
|
|
3035
3076
|
let n = t.value;
|
|
3036
3077
|
if (!n) return;
|
|
3037
|
-
if (!nt(n) ||
|
|
3078
|
+
if (!nt(n) || F.value.length === 0) {
|
|
3038
3079
|
c.value = [];
|
|
3039
3080
|
return;
|
|
3040
3081
|
}
|
|
3041
|
-
let r = n.getBoundingClientRect(), i =
|
|
3082
|
+
let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
|
|
3042
3083
|
let n = Ze(Xe(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
3043
3084
|
return n ? [Ke(t, n, r)] : [];
|
|
3044
3085
|
});
|
|
3045
|
-
c.value = st(c.value, i,
|
|
3046
|
-
},
|
|
3047
|
-
if (!
|
|
3086
|
+
c.value = st(c.value, i, F.value.map((e) => e.pos));
|
|
3087
|
+
}, V = () => {
|
|
3088
|
+
if (!k.value || !T.value) {
|
|
3048
3089
|
s.value = null, l.value = null;
|
|
3049
3090
|
return;
|
|
3050
3091
|
}
|
|
3051
3092
|
let r = t.value;
|
|
3052
3093
|
if (!r) return;
|
|
3053
|
-
let i = Xe(e.editor, T.value.pos,
|
|
3094
|
+
let i = Xe(e.editor, T.value.pos, N.value), a = r.getBoundingClientRect(), o = Ze(i, a);
|
|
3054
3095
|
if (!o) {
|
|
3055
3096
|
s.value = s.value?.pos === T.value.pos ? s.value : null, l.value = u.value ? l.value : null;
|
|
3056
3097
|
return;
|
|
@@ -3064,57 +3105,57 @@ var Kr = J({
|
|
|
3064
3105
|
windowHeight: window.innerHeight
|
|
3065
3106
|
});
|
|
3066
3107
|
}
|
|
3067
|
-
},
|
|
3108
|
+
}, re = async () => {
|
|
3068
3109
|
if (e.readOnly) {
|
|
3069
3110
|
if (!T.value) return;
|
|
3070
3111
|
let e = await He(T.value.text);
|
|
3071
|
-
|
|
3112
|
+
z(Pe(T.value, e ? "copied" : "failed"));
|
|
3072
3113
|
return;
|
|
3073
3114
|
}
|
|
3074
3115
|
if (!qe(e.editor, T.value)) return;
|
|
3075
3116
|
let t = await Me(e.editor);
|
|
3076
|
-
|
|
3077
|
-
},
|
|
3117
|
+
z(Pe(Ne(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
3118
|
+
}, ie = (t, n) => {
|
|
3078
3119
|
if (e.readOnly) {
|
|
3079
3120
|
Ot(e.editor, t.pos, n) && (b.value += 1, x.value += 1);
|
|
3080
3121
|
return;
|
|
3081
3122
|
}
|
|
3082
3123
|
let r = e.state.active && e.state.pos === t.pos;
|
|
3083
3124
|
Re(e.editor, t.pos, n) && (e.onMermaidModeChange(n), x.value += 1, r && e.editor.view.focus());
|
|
3084
|
-
},
|
|
3125
|
+
}, ae = (t) => {
|
|
3085
3126
|
if (e.readOnly || !T.value) return;
|
|
3086
3127
|
let n = e.state.active && e.state.pos === T.value.pos;
|
|
3087
3128
|
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());
|
|
3088
|
-
},
|
|
3089
|
-
u.value = !u.value, u.value && a.value === null && (a.value = Ue()), f.value = u.value ? rt(
|
|
3090
|
-
},
|
|
3129
|
+
}, oe = () => {
|
|
3130
|
+
u.value = !u.value, u.value && a.value === null && (a.value = Ue()), f.value = u.value ? rt(L.value, T.value?.language ?? null) : -1;
|
|
3131
|
+
}, se = (e) => {
|
|
3091
3132
|
let t = Qe(e);
|
|
3092
3133
|
d.value = e, f.value = rt(t, e.trim() ? null : T.value?.language ?? null);
|
|
3093
|
-
},
|
|
3134
|
+
}, ce = (t) => {
|
|
3094
3135
|
if (!t.isComposing) {
|
|
3095
3136
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
3096
|
-
t.preventDefault(), f.value = lt(f.value,
|
|
3137
|
+
t.preventDefault(), f.value = lt(f.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
3097
3138
|
return;
|
|
3098
3139
|
}
|
|
3099
3140
|
if (t.key === "Enter") {
|
|
3100
|
-
let e =
|
|
3101
|
-
e && (t.preventDefault(),
|
|
3141
|
+
let e = L.value[f.value];
|
|
3142
|
+
e && (t.preventDefault(), ae(e.language));
|
|
3102
3143
|
return;
|
|
3103
3144
|
}
|
|
3104
3145
|
t.key === "Escape" && (t.preventDefault(), u.value = !1, f.value = -1, e.editor.view.focus());
|
|
3105
3146
|
}
|
|
3106
|
-
},
|
|
3107
|
-
e.readOnly || !T.value || Ie(e.editor, T.value.pos, !
|
|
3108
|
-
},
|
|
3147
|
+
}, le = () => {
|
|
3148
|
+
e.readOnly || !T.value || Ie(e.editor, T.value.pos, !O.value) && (y.value += 1, x.value += 1, o.value = null);
|
|
3149
|
+
}, ue = () => {
|
|
3109
3150
|
if (!T.value) return;
|
|
3110
3151
|
let t = at(e.editor, T.value.pos);
|
|
3111
|
-
t &&
|
|
3152
|
+
t && ne({
|
|
3112
3153
|
data: new Blob([t], { type: "image/svg+xml" }),
|
|
3113
3154
|
fileName: "markweave-mermaid.svg",
|
|
3114
3155
|
onSettled: () => e.editor.view.focus(),
|
|
3115
3156
|
ownerDocument: document
|
|
3116
3157
|
});
|
|
3117
|
-
},
|
|
3158
|
+
}, de = () => {
|
|
3118
3159
|
if (!T.value) return;
|
|
3119
3160
|
let t = at(e.editor, T.value.pos);
|
|
3120
3161
|
t && (h.value = Ge(t), g.value = null, _.value = !1, v.value = {
|
|
@@ -3122,26 +3163,26 @@ var Kr = J({
|
|
|
3122
3163
|
lastX: 0,
|
|
3123
3164
|
lastY: 0
|
|
3124
3165
|
});
|
|
3125
|
-
},
|
|
3166
|
+
}, fe = (e) => {
|
|
3126
3167
|
h.value = h.value ? {
|
|
3127
3168
|
...h.value,
|
|
3128
3169
|
scale: Be(h.value.scale + e)
|
|
3129
3170
|
} : null;
|
|
3130
|
-
},
|
|
3171
|
+
}, pe = () => {
|
|
3131
3172
|
h.value = h.value ? Ge(h.value.svg) : null, v.value = {
|
|
3132
3173
|
active: !1,
|
|
3133
3174
|
lastX: 0,
|
|
3134
3175
|
lastY: 0
|
|
3135
3176
|
}, _.value = !1;
|
|
3136
|
-
},
|
|
3137
|
-
e.preventDefault(),
|
|
3138
|
-
},
|
|
3177
|
+
}, me = (e) => {
|
|
3178
|
+
e.preventDefault(), fe(e.deltaY < 0 ? ct : -ct);
|
|
3179
|
+
}, he = (e) => {
|
|
3139
3180
|
e.button === 0 && (e.preventDefault(), v.value = {
|
|
3140
3181
|
active: !0,
|
|
3141
3182
|
lastX: e.clientX,
|
|
3142
3183
|
lastY: e.clientY
|
|
3143
3184
|
}, _.value = !0);
|
|
3144
|
-
},
|
|
3185
|
+
}, ge = (e) => {
|
|
3145
3186
|
let t = v.value;
|
|
3146
3187
|
if (!t.active) return;
|
|
3147
3188
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
@@ -3150,52 +3191,52 @@ var Kr = J({
|
|
|
3150
3191
|
lastX: e.clientX,
|
|
3151
3192
|
lastY: e.clientY
|
|
3152
3193
|
}, h.value = ut(h.value, n, r);
|
|
3153
|
-
},
|
|
3194
|
+
}, _e = () => {
|
|
3154
3195
|
v.value = {
|
|
3155
3196
|
active: !1,
|
|
3156
3197
|
lastX: 0,
|
|
3157
3198
|
lastY: 0
|
|
3158
3199
|
}, _.value = !1;
|
|
3159
3200
|
};
|
|
3160
|
-
|
|
3201
|
+
K(() => e.readOnly, (e) => {
|
|
3161
3202
|
e && (u.value = !1, d.value = "");
|
|
3162
|
-
}),
|
|
3163
|
-
|
|
3164
|
-
}),
|
|
3203
|
+
}), K(ee, () => {
|
|
3204
|
+
z(null), u.value = !1, d.value = "", f.value = -1, h.value = null, g.value = null, _.value = !1;
|
|
3205
|
+
}), K(u, async (e) => {
|
|
3165
3206
|
if (!e) {
|
|
3166
3207
|
f.value = -1;
|
|
3167
3208
|
return;
|
|
3168
3209
|
}
|
|
3169
|
-
await
|
|
3170
|
-
}),
|
|
3210
|
+
await J(), V(), r.value?.focus({ preventScroll: !0 });
|
|
3211
|
+
}), K(() => [
|
|
3171
3212
|
u.value,
|
|
3172
3213
|
d.value,
|
|
3173
3214
|
f.value
|
|
3174
3215
|
], async () => {
|
|
3175
3216
|
if (!u.value || f.value < 0) return;
|
|
3176
|
-
await
|
|
3217
|
+
await J();
|
|
3177
3218
|
let e = i.value, t = e?.querySelector(`[data-language-index="${f.value}"]`);
|
|
3178
3219
|
e && t && dt(e, t);
|
|
3179
|
-
}, { flush: "post" }),
|
|
3180
|
-
|
|
3220
|
+
}, { flush: "post" }), K(() => [
|
|
3221
|
+
k.value,
|
|
3181
3222
|
y.value,
|
|
3182
3223
|
T.value?.pos ?? null,
|
|
3183
3224
|
u.value,
|
|
3184
|
-
|
|
3225
|
+
N.value
|
|
3185
3226
|
], async () => {
|
|
3186
|
-
await
|
|
3227
|
+
await J(), V();
|
|
3187
3228
|
}, {
|
|
3188
3229
|
flush: "post",
|
|
3189
3230
|
immediate: !0
|
|
3190
|
-
}),
|
|
3191
|
-
await
|
|
3231
|
+
}), K(I, async () => {
|
|
3232
|
+
await J(), B(), window.requestAnimationFrame(B);
|
|
3192
3233
|
}, {
|
|
3193
3234
|
flush: "post",
|
|
3194
3235
|
immediate: !0
|
|
3195
3236
|
});
|
|
3196
|
-
let
|
|
3197
|
-
return
|
|
3198
|
-
|
|
3237
|
+
let ve = null;
|
|
3238
|
+
return Cn(() => {
|
|
3239
|
+
J(() => {
|
|
3199
3240
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
3200
3241
|
if (n.target instanceof Node && t.value?.contains(n.target) || u.value) return;
|
|
3201
3242
|
let r = et(e.editor, n.target), i = tt(e.editor, r), a = i && !ot(e.editor, i) ? i.pos : null;
|
|
@@ -3205,7 +3246,7 @@ var Kr = J({
|
|
|
3205
3246
|
}, a = (t) => {
|
|
3206
3247
|
if (t.key === "Escape") {
|
|
3207
3248
|
if (h.value) {
|
|
3208
|
-
|
|
3249
|
+
te();
|
|
3209
3250
|
return;
|
|
3210
3251
|
}
|
|
3211
3252
|
u.value && (u.value = !1, f.value = -1, e.editor.view.focus());
|
|
@@ -3215,14 +3256,14 @@ var Kr = J({
|
|
|
3215
3256
|
}, c = ({ transaction: e }) => {
|
|
3216
3257
|
e.getMeta(je) && (y.value += 1), (e.docChanged || e.selectionSet || e.getMeta(je) || Tt(e)) && (x.value += 1);
|
|
3217
3258
|
};
|
|
3218
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize",
|
|
3219
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize",
|
|
3259
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", V), window.addEventListener("scroll", V, !0), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", s), e.editor.on("transaction", c), ve = () => {
|
|
3260
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", V), window.removeEventListener("scroll", V, !0), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", s), e.editor.off("transaction", c), R();
|
|
3220
3261
|
};
|
|
3221
3262
|
});
|
|
3222
|
-
}),
|
|
3223
|
-
|
|
3263
|
+
}), q(() => {
|
|
3264
|
+
ve?.(), ve = null, R();
|
|
3224
3265
|
}), () => {
|
|
3225
|
-
if (!
|
|
3266
|
+
if (!k.value && F.value.length === 0 && !h.value) return null;
|
|
3226
3267
|
let o = s.value ? {
|
|
3227
3268
|
top: `${s.value.top}px`,
|
|
3228
3269
|
right: `${s.value.right}px`
|
|
@@ -3230,15 +3271,15 @@ var Kr = J({
|
|
|
3230
3271
|
left: `${l.value.left}px`,
|
|
3231
3272
|
top: `${l.value.top}px`
|
|
3232
3273
|
} : void 0;
|
|
3233
|
-
return
|
|
3274
|
+
return H("div", {
|
|
3234
3275
|
ref: t,
|
|
3235
3276
|
class: "markweave-codeblock-overlay",
|
|
3236
3277
|
"data-testid": "markweave-codeblock-overlay",
|
|
3237
3278
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
3238
3279
|
}, [
|
|
3239
|
-
...
|
|
3280
|
+
...F.value.map((e) => {
|
|
3240
3281
|
let t = c.value.find((t) => t.pos === e.pos);
|
|
3241
|
-
return
|
|
3282
|
+
return H("div", {
|
|
3242
3283
|
key: e.pos,
|
|
3243
3284
|
class: "markweave-mermaid-tabs",
|
|
3244
3285
|
"data-testid": "markweave-mermaid-tabs",
|
|
@@ -3248,29 +3289,29 @@ var Kr = J({
|
|
|
3248
3289
|
top: `${t.top}px`,
|
|
3249
3290
|
left: `${t.left}px`
|
|
3250
3291
|
} : void 0
|
|
3251
|
-
}, ["code", "preview"].map((t) =>
|
|
3292
|
+
}, ["code", "preview"].map((t) => H("button", {
|
|
3252
3293
|
key: t,
|
|
3253
3294
|
type: "button",
|
|
3254
3295
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
3255
3296
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
3256
3297
|
onMousedown: $,
|
|
3257
|
-
onClick: () =>
|
|
3298
|
+
onClick: () => ie(e, t)
|
|
3258
3299
|
}, t === "code" ? "Code" : "Preview")));
|
|
3259
3300
|
}),
|
|
3260
|
-
|
|
3301
|
+
k.value && T.value ? H("div", {
|
|
3261
3302
|
class: "markweave-codeblock-controls",
|
|
3262
3303
|
"data-testid": "markweave-codeblock-controls",
|
|
3263
3304
|
"data-positioned": s.value ? "true" : "false",
|
|
3264
|
-
"data-collapsed":
|
|
3305
|
+
"data-collapsed": O.value ? "true" : "false",
|
|
3265
3306
|
"data-read-only": e.readOnly ? "true" : "false",
|
|
3266
3307
|
"aria-label": "Code block controls",
|
|
3267
3308
|
style: o
|
|
3268
3309
|
}, [
|
|
3269
|
-
e.readOnly ?
|
|
3310
|
+
e.readOnly ? H("span", {
|
|
3270
3311
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
3271
3312
|
"aria-label": "Code block language",
|
|
3272
3313
|
"data-testid": "markweave-codeblock-language"
|
|
3273
|
-
}, [
|
|
3314
|
+
}, [H("span", null, j.value)]) : H("button", {
|
|
3274
3315
|
ref: n,
|
|
3275
3316
|
type: "button",
|
|
3276
3317
|
class: "markweave-codeblock-language-button",
|
|
@@ -3279,24 +3320,24 @@ var Kr = J({
|
|
|
3279
3320
|
"aria-haspopup": "listbox",
|
|
3280
3321
|
"data-testid": "markweave-codeblock-language",
|
|
3281
3322
|
onMousedown: $,
|
|
3282
|
-
onClick:
|
|
3283
|
-
}, [
|
|
3284
|
-
|
|
3323
|
+
onClick: oe
|
|
3324
|
+
}, [H("span", null, j.value), Q("chevron")]),
|
|
3325
|
+
A.value ? H("button", {
|
|
3285
3326
|
type: "button",
|
|
3286
3327
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
3287
|
-
"aria-label":
|
|
3288
|
-
title:
|
|
3328
|
+
"aria-label": O.value ? "Expand code block" : "Collapse code block",
|
|
3329
|
+
title: O.value ? "Expand code block" : "Collapse code block",
|
|
3289
3330
|
"data-testid": "markweave-codeblock-collapse",
|
|
3290
|
-
"data-collapsed":
|
|
3331
|
+
"data-collapsed": O.value ? "true" : "false",
|
|
3291
3332
|
onMousedown: $,
|
|
3292
|
-
onClick:
|
|
3333
|
+
onClick: le
|
|
3293
3334
|
}, [Q("chevron")]) : null,
|
|
3294
|
-
|
|
3335
|
+
H("span", { class: "markweave-codeblock-copy-wrap" }, [H("button", {
|
|
3295
3336
|
type: "button",
|
|
3296
3337
|
class: "markweave-codeblock-icon-button",
|
|
3297
3338
|
"aria-label": "Copy to clipboard",
|
|
3298
3339
|
"data-testid": "markweave-codeblock-copy",
|
|
3299
|
-
"data-copy-state":
|
|
3340
|
+
"data-copy-state": M.value,
|
|
3300
3341
|
onMousedown: $,
|
|
3301
3342
|
onMouseenter: () => {
|
|
3302
3343
|
m.value = !0;
|
|
@@ -3311,63 +3352,63 @@ var Kr = J({
|
|
|
3311
3352
|
m.value = !1;
|
|
3312
3353
|
},
|
|
3313
3354
|
onClick: () => {
|
|
3314
|
-
|
|
3355
|
+
re();
|
|
3315
3356
|
}
|
|
3316
|
-
}, [Q(
|
|
3357
|
+
}, [Q(M.value === "copied" ? "check" : "clipboard")]), m.value ? H("span", {
|
|
3317
3358
|
class: "markweave-codeblock-tooltip",
|
|
3318
3359
|
role: "tooltip",
|
|
3319
3360
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
3320
3361
|
}, "Copy to clipboard") : null]),
|
|
3321
|
-
|
|
3362
|
+
D.value && N.value === "preview" ? H("div", {
|
|
3322
3363
|
class: "markweave-mermaid-preview-actions",
|
|
3323
3364
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
3324
|
-
}, [
|
|
3365
|
+
}, [H("button", {
|
|
3325
3366
|
type: "button",
|
|
3326
3367
|
class: "markweave-codeblock-icon-button",
|
|
3327
3368
|
"aria-label": "Fullscreen Mermaid preview",
|
|
3328
3369
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
3329
|
-
disabled: !
|
|
3370
|
+
disabled: !P.value,
|
|
3330
3371
|
onMousedown: $,
|
|
3331
|
-
onClick:
|
|
3332
|
-
}, [Q("expand")]),
|
|
3372
|
+
onClick: de
|
|
3373
|
+
}, [Q("expand")]), H("button", {
|
|
3333
3374
|
type: "button",
|
|
3334
3375
|
class: "markweave-codeblock-icon-button",
|
|
3335
3376
|
"aria-label": "Download Mermaid SVG",
|
|
3336
3377
|
"data-testid": "markweave-mermaid-download",
|
|
3337
|
-
disabled: !
|
|
3378
|
+
disabled: !P.value,
|
|
3338
3379
|
onMousedown: $,
|
|
3339
|
-
onClick:
|
|
3380
|
+
onClick: ue
|
|
3340
3381
|
}, [Q("download")])]) : null
|
|
3341
3382
|
]) : null,
|
|
3342
|
-
|
|
3383
|
+
A.value && k.value && u.value && T.value ? H("div", {
|
|
3343
3384
|
class: "markweave-codeblock-language-menu",
|
|
3344
3385
|
"data-testid": "markweave-codeblock-language-menu",
|
|
3345
3386
|
"data-positioned": l.value ? "true" : "false",
|
|
3346
3387
|
style: p
|
|
3347
|
-
}, [
|
|
3388
|
+
}, [H("label", { class: "markweave-codeblock-language-search" }, [H("input", {
|
|
3348
3389
|
ref: r,
|
|
3349
3390
|
role: "combobox",
|
|
3350
3391
|
"aria-autocomplete": "list",
|
|
3351
3392
|
"aria-controls": a.value ?? void 0,
|
|
3352
3393
|
"aria-expanded": "true",
|
|
3353
|
-
"aria-activedescendant": a.value &&
|
|
3394
|
+
"aria-activedescendant": a.value && L.value[f.value] ? $e(a.value, L.value[f.value].language) : void 0,
|
|
3354
3395
|
"aria-label": "Search code block languages",
|
|
3355
3396
|
value: d.value,
|
|
3356
3397
|
placeholder: "Search...",
|
|
3357
3398
|
"data-testid": "markweave-codeblock-language-search",
|
|
3358
3399
|
onInput: (e) => {
|
|
3359
|
-
|
|
3400
|
+
se(e.target.value);
|
|
3360
3401
|
},
|
|
3361
|
-
onKeydown:
|
|
3362
|
-
}), Q("search")]),
|
|
3402
|
+
onKeydown: ce
|
|
3403
|
+
}), Q("search")]), H("div", {
|
|
3363
3404
|
ref: i,
|
|
3364
3405
|
id: a.value ?? void 0,
|
|
3365
3406
|
class: "markweave-codeblock-language-list",
|
|
3366
3407
|
role: "listbox",
|
|
3367
3408
|
"aria-label": "Code block languages"
|
|
3368
|
-
},
|
|
3409
|
+
}, L.value.map((e, t) => {
|
|
3369
3410
|
let n = T.value?.language === e.language, r = t === f.value;
|
|
3370
|
-
return
|
|
3411
|
+
return H("button", {
|
|
3371
3412
|
key: e.language,
|
|
3372
3413
|
id: a.value ? $e(a.value, e.language) : void 0,
|
|
3373
3414
|
type: "button",
|
|
@@ -3381,21 +3422,21 @@ var Kr = J({
|
|
|
3381
3422
|
onMouseenter: () => {
|
|
3382
3423
|
f.value = t;
|
|
3383
3424
|
},
|
|
3384
|
-
onClick: () =>
|
|
3385
|
-
}, [
|
|
3425
|
+
onClick: () => ae(e.language)
|
|
3426
|
+
}, [H("span", null, e.label), n ? Q("check") : null]);
|
|
3386
3427
|
}))]) : null,
|
|
3387
|
-
h.value ?
|
|
3428
|
+
h.value ? H("div", {
|
|
3388
3429
|
class: "markweave-mermaid-fullscreen-layer",
|
|
3389
3430
|
role: "dialog",
|
|
3390
3431
|
"aria-modal": "true",
|
|
3391
3432
|
"aria-label": "Mermaid preview",
|
|
3392
3433
|
"data-testid": "markweave-mermaid-fullscreen-layer"
|
|
3393
3434
|
}, [
|
|
3394
|
-
|
|
3435
|
+
H("div", {
|
|
3395
3436
|
class: "markweave-mermaid-fullscreen-toolbar",
|
|
3396
3437
|
"data-testid": "markweave-mermaid-fullscreen-toolbar"
|
|
3397
3438
|
}, [
|
|
3398
|
-
|
|
3439
|
+
H("button", {
|
|
3399
3440
|
type: "button",
|
|
3400
3441
|
class: "markweave-mermaid-fullscreen-control",
|
|
3401
3442
|
"aria-label": "Zoom out",
|
|
@@ -3412,13 +3453,13 @@ var Kr = J({
|
|
|
3412
3453
|
onBlur: () => {
|
|
3413
3454
|
g.value = null;
|
|
3414
3455
|
},
|
|
3415
|
-
onClick: () =>
|
|
3456
|
+
onClick: () => fe(-ct)
|
|
3416
3457
|
}, [Q("zoomOut")]),
|
|
3417
|
-
|
|
3458
|
+
H("span", {
|
|
3418
3459
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3419
3460
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3420
3461
|
}, Ye(h.value.scale)),
|
|
3421
|
-
|
|
3462
|
+
H("button", {
|
|
3422
3463
|
type: "button",
|
|
3423
3464
|
class: "markweave-mermaid-fullscreen-control",
|
|
3424
3465
|
"aria-label": "Zoom in",
|
|
@@ -3435,9 +3476,9 @@ var Kr = J({
|
|
|
3435
3476
|
onBlur: () => {
|
|
3436
3477
|
g.value = null;
|
|
3437
3478
|
},
|
|
3438
|
-
onClick: () =>
|
|
3479
|
+
onClick: () => fe(ct)
|
|
3439
3480
|
}, [Q("zoomIn")]),
|
|
3440
|
-
|
|
3481
|
+
H("button", {
|
|
3441
3482
|
type: "button",
|
|
3442
3483
|
class: "markweave-mermaid-fullscreen-control",
|
|
3443
3484
|
"aria-label": "Reset zoom",
|
|
@@ -3454,31 +3495,31 @@ var Kr = J({
|
|
|
3454
3495
|
onBlur: () => {
|
|
3455
3496
|
g.value = null;
|
|
3456
3497
|
},
|
|
3457
|
-
onClick:
|
|
3498
|
+
onClick: pe
|
|
3458
3499
|
}, [Q("reset")]),
|
|
3459
|
-
g.value ?
|
|
3500
|
+
g.value ? H("span", {
|
|
3460
3501
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
3461
3502
|
role: "tooltip",
|
|
3462
3503
|
"data-testid": "markweave-mermaid-fullscreen-tooltip"
|
|
3463
3504
|
}, g.value === "zoom-out" ? "Zoom out" : g.value === "zoom-in" ? "Zoom in" : "Reset") : null
|
|
3464
3505
|
]),
|
|
3465
|
-
|
|
3506
|
+
H("button", {
|
|
3466
3507
|
type: "button",
|
|
3467
3508
|
class: "markweave-mermaid-fullscreen-close",
|
|
3468
3509
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
3469
3510
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3470
|
-
onClick:
|
|
3511
|
+
onClick: te
|
|
3471
3512
|
}, [Q("close")]),
|
|
3472
|
-
|
|
3513
|
+
H("div", {
|
|
3473
3514
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
3474
3515
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
3475
3516
|
"data-dragging": _.value ? "true" : "false",
|
|
3476
|
-
onWheel:
|
|
3477
|
-
onMousedown:
|
|
3478
|
-
onMousemove:
|
|
3479
|
-
onMouseup:
|
|
3480
|
-
onMouseleave:
|
|
3481
|
-
}, [
|
|
3517
|
+
onWheel: me,
|
|
3518
|
+
onMousedown: he,
|
|
3519
|
+
onMousemove: ge,
|
|
3520
|
+
onMouseup: _e,
|
|
3521
|
+
onMouseleave: _e
|
|
3522
|
+
}, [H("div", {
|
|
3482
3523
|
class: "markweave-mermaid-fullscreen-content",
|
|
3483
3524
|
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
3484
3525
|
"data-scale-percent": Math.round(h.value.scale * 100),
|
|
@@ -3494,7 +3535,7 @@ var Kr = J({
|
|
|
3494
3535
|
]);
|
|
3495
3536
|
};
|
|
3496
3537
|
}
|
|
3497
|
-
}),
|
|
3538
|
+
}), ei = Y({
|
|
3498
3539
|
name: "MarkweaveVueInnerToc",
|
|
3499
3540
|
props: {
|
|
3500
3541
|
editor: {
|
|
@@ -3519,22 +3560,22 @@ var Kr = J({
|
|
|
3519
3560
|
}
|
|
3520
3561
|
},
|
|
3521
3562
|
setup(e) {
|
|
3522
|
-
let t =
|
|
3563
|
+
let t = U(null), n, r = () => {
|
|
3523
3564
|
n?.(), n = e.placement === "container" && t.value ? ke(t.value) : void 0;
|
|
3524
3565
|
};
|
|
3525
|
-
return
|
|
3566
|
+
return Cn(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
|
|
3526
3567
|
ref: t,
|
|
3527
3568
|
class: "markweave-inner-toc",
|
|
3528
3569
|
"data-testid": "markweave-inner-toc",
|
|
3529
3570
|
"aria-label": e.messages.toc.ariaLabel
|
|
3530
|
-
}, [
|
|
3571
|
+
}, [H("div", {
|
|
3531
3572
|
class: "markweave-inner-toc-rail",
|
|
3532
3573
|
"aria-hidden": "true"
|
|
3533
|
-
}, e.state.items.map((e) =>
|
|
3574
|
+
}, e.state.items.map((e) => H("span", {
|
|
3534
3575
|
key: e.id,
|
|
3535
3576
|
"data-level": e.level,
|
|
3536
3577
|
"data-active": e.active ? "true" : "false"
|
|
3537
|
-
}))),
|
|
3578
|
+
}))), H("div", { class: "markweave-inner-toc-panel" }, [H("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => H("button", {
|
|
3538
3579
|
key: t.id,
|
|
3539
3580
|
type: "button",
|
|
3540
3581
|
class: "markweave-inner-toc-item",
|
|
@@ -3550,68 +3591,70 @@ var Kr = J({
|
|
|
3550
3591
|
}, t.text)))])]) : null;
|
|
3551
3592
|
}
|
|
3552
3593
|
});
|
|
3553
|
-
function
|
|
3554
|
-
let i = r(e.lang), o = n(i), s = t(i), c =
|
|
3555
|
-
function
|
|
3556
|
-
|
|
3594
|
+
function ti(e = {}) {
|
|
3595
|
+
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(Lt), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(Wt), x = U(null), S = U(!1), C = W(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
|
|
3596
|
+
function O() {
|
|
3597
|
+
D !== null && (window.clearTimeout(D), D = null), d.value += 1;
|
|
3557
3598
|
}
|
|
3558
|
-
function
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
},
|
|
3599
|
+
function k() {
|
|
3600
|
+
D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
|
|
3601
|
+
D = null, d.value += 1;
|
|
3602
|
+
}, ye);
|
|
3562
3603
|
}
|
|
3563
|
-
let
|
|
3564
|
-
|
|
3565
|
-
extensions:
|
|
3604
|
+
let A = e.onSlashCommandUpload, j = W(null);
|
|
3605
|
+
j.value = new a({
|
|
3606
|
+
extensions: Ir({
|
|
3566
3607
|
lang: i,
|
|
3567
3608
|
linkCardResolver: e.linkCardResolver,
|
|
3568
|
-
onImageUpload: (e) =>
|
|
3569
|
-
onVideoUpload: (e) =>
|
|
3609
|
+
onImageUpload: (e) => A?.(e) ?? ee(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3610
|
+
onVideoUpload: (e) => A?.(e) ?? ee(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3611
|
+
resolveMediaSource: e.resolveMediaSource
|
|
3570
3612
|
}),
|
|
3571
|
-
content:
|
|
3572
|
-
contentType:
|
|
3613
|
+
content: T,
|
|
3614
|
+
contentType: re(w),
|
|
3573
3615
|
editable: u.value,
|
|
3574
3616
|
autofocus: e.autofocus,
|
|
3575
3617
|
editorProps: {
|
|
3576
3618
|
attributes: {
|
|
3577
3619
|
class: "markweave-editor-surface",
|
|
3578
3620
|
"data-testid": "markweave-editor-surface",
|
|
3621
|
+
"data-markweave-large-document": E ? "true" : "false",
|
|
3579
3622
|
autocapitalize: "off",
|
|
3580
3623
|
autocorrect: "off",
|
|
3581
3624
|
spellcheck: "false",
|
|
3582
3625
|
translate: "no"
|
|
3583
3626
|
},
|
|
3584
3627
|
handleClick: (e, t, n) => {
|
|
3585
|
-
if (!u.value) return
|
|
3628
|
+
if (!u.value) return me(n);
|
|
3586
3629
|
let r = yt(e, n);
|
|
3587
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
3630
|
+
return r ? (n.preventDefault(), n.stopPropagation(), N(), Ct(e, r, !0), wt(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
3588
3631
|
},
|
|
3589
3632
|
handleDOMEvents: {
|
|
3590
3633
|
compositionstart: () => u.value ? (h.value = Rt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
3591
|
-
compositionend: (e) => (u.value && window.setTimeout(() =>
|
|
3634
|
+
compositionend: (e) => (u.value && window.setTimeout(() => P(e), 0), !1),
|
|
3592
3635
|
click: (e, t) => {
|
|
3593
|
-
if (!u.value) return
|
|
3636
|
+
if (!u.value) return me(t);
|
|
3594
3637
|
let n = yt(e, t);
|
|
3595
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
3638
|
+
return n ? (t.preventDefault(), t.stopPropagation(), N(), Ct(e, n, !0), wt(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
3596
3639
|
}
|
|
3597
3640
|
}
|
|
3598
3641
|
},
|
|
3599
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
3642
|
+
onSelectionUpdate: ({ editor: e }) => I(e),
|
|
3600
3643
|
onCreate: ({ editor: t }) => {
|
|
3601
3644
|
p(t, {
|
|
3602
3645
|
mode: c.value,
|
|
3603
3646
|
editable: u.value
|
|
3604
|
-
}), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Vt(t),
|
|
3647
|
+
}), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Vt(t), L(t), I(t), O();
|
|
3605
3648
|
},
|
|
3606
3649
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3607
|
-
if (
|
|
3650
|
+
if (L(e), (t.docChanged || Tt(t)) && k(), t.docChanged && y.value) {
|
|
3608
3651
|
let t = vt(e, y.value.pos);
|
|
3609
3652
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
3610
3653
|
}
|
|
3611
3654
|
},
|
|
3612
3655
|
onUpdate: ({ editor: t }) => {
|
|
3613
|
-
|
|
3614
|
-
let i =
|
|
3656
|
+
I(t), u.value && F(t), S.value || e.onUpdate?.(V(t, { onContentRead: (n, r) => {
|
|
3657
|
+
let i = oe(e.contentFormat);
|
|
3615
3658
|
e.content !== void 0 && n === i && (C.value = {
|
|
3616
3659
|
content: r,
|
|
3617
3660
|
format: n,
|
|
@@ -3620,11 +3663,11 @@ function $r(e = {}) {
|
|
|
3620
3663
|
} }));
|
|
3621
3664
|
}
|
|
3622
3665
|
});
|
|
3623
|
-
let
|
|
3624
|
-
function
|
|
3666
|
+
let M = G(() => j.value ?? null);
|
|
3667
|
+
function N() {
|
|
3625
3668
|
g.value = null, _.value = null, h.value = Lt;
|
|
3626
3669
|
}
|
|
3627
|
-
function
|
|
3670
|
+
function P(e) {
|
|
3628
3671
|
let t = It(e.state);
|
|
3629
3672
|
if (!t) {
|
|
3630
3673
|
h.value = h.value.name === "idle" ? h.value : Lt, g.value = null, _.value = null;
|
|
@@ -3636,67 +3679,67 @@ function $r(e = {}) {
|
|
|
3636
3679
|
triggerRect: r
|
|
3637
3680
|
}), h.value = Pt(h.value, t);
|
|
3638
3681
|
}
|
|
3639
|
-
function
|
|
3640
|
-
|
|
3682
|
+
function F(e) {
|
|
3683
|
+
P(e.view);
|
|
3641
3684
|
}
|
|
3642
|
-
function
|
|
3643
|
-
let t =
|
|
3644
|
-
|
|
3685
|
+
function I(e) {
|
|
3686
|
+
let t = ve(e);
|
|
3687
|
+
ge(m.value, t) || (m.value = t);
|
|
3645
3688
|
let n = bt(e);
|
|
3646
3689
|
n && (St(e, n, !0), y.value = n);
|
|
3647
3690
|
let r = Ne(e);
|
|
3648
3691
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
3649
3692
|
}
|
|
3650
|
-
function
|
|
3651
|
-
b.value =
|
|
3693
|
+
function L(e) {
|
|
3694
|
+
b.value = zr(e);
|
|
3652
3695
|
}
|
|
3653
|
-
let
|
|
3654
|
-
active:
|
|
3696
|
+
let R = G(() => M.value ? Ne(M.value) : Rr), z = G(() => M.value ? Ht(M.value.state) : Lr), ne = G(() => m.value?.currentNode === "codeBlock"), B = G(() => ne.value && R.value.language === "mermaid"), se = G(() => M.value ? kt({
|
|
3697
|
+
active: B.value,
|
|
3655
3698
|
mode: v.value,
|
|
3656
|
-
source:
|
|
3699
|
+
source: R.value.text
|
|
3657
3700
|
}) : kt({
|
|
3658
3701
|
active: !1,
|
|
3659
3702
|
mode: "code",
|
|
3660
3703
|
source: ""
|
|
3661
|
-
})),
|
|
3704
|
+
})), ce = G(() => M.value && e.onRuntimeStateChange ? Bt(M.value.state) : null), le = G(() => M.value ? Ee(M.value.state) : we.items), ue = G(() => De(le.value, x.value)), de = G(() => Ce(le.value, ue.value)), fe = G(() => At(h.value.query, s)), pe = G(() => he({
|
|
3662
3705
|
revision: d.value,
|
|
3663
3706
|
mode: c.value,
|
|
3664
3707
|
editable: u.value,
|
|
3665
|
-
toc:
|
|
3708
|
+
toc: de.value,
|
|
3666
3709
|
selection: m.value,
|
|
3667
3710
|
slash: h.value,
|
|
3668
|
-
table:
|
|
3711
|
+
table: z.value,
|
|
3669
3712
|
tableInteraction: b.value,
|
|
3670
|
-
codeBlock:
|
|
3671
|
-
mermaid:
|
|
3672
|
-
tableDebugSnapshot:
|
|
3673
|
-
})),
|
|
3674
|
-
closeSlashMenu:
|
|
3675
|
-
focusFirstTableBodyCell: () =>
|
|
3713
|
+
codeBlock: R.value,
|
|
3714
|
+
mermaid: se.value,
|
|
3715
|
+
tableDebugSnapshot: ce.value
|
|
3716
|
+
})), _e = {
|
|
3717
|
+
closeSlashMenu: N,
|
|
3718
|
+
focusFirstTableBodyCell: () => M.value ? Vt(M.value) : !1,
|
|
3676
3719
|
setContent: (e, t = {}) => {
|
|
3677
|
-
if (!
|
|
3678
|
-
let n =
|
|
3679
|
-
return
|
|
3680
|
-
contentType:
|
|
3720
|
+
if (!M.value) return !1;
|
|
3721
|
+
let n = oe(t.format);
|
|
3722
|
+
return M.value.commands.setContent(e, {
|
|
3723
|
+
contentType: re(n),
|
|
3681
3724
|
emitUpdate: t.emitUpdate ?? !1
|
|
3682
|
-
}), t.focusFirstTableBodyCell && Vt(
|
|
3725
|
+
}), t.focusFirstTableBodyCell && Vt(M.value), I(M.value), u.value && F(M.value), L(M.value), O(), !0;
|
|
3683
3726
|
}
|
|
3684
3727
|
};
|
|
3685
|
-
function
|
|
3686
|
-
if (!(!
|
|
3728
|
+
function be(e, t) {
|
|
3729
|
+
if (!(!M.value || !u.value || !jt(e))) {
|
|
3687
3730
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3688
3731
|
_.value = e;
|
|
3689
3732
|
return;
|
|
3690
3733
|
}
|
|
3691
|
-
Nt(
|
|
3734
|
+
Nt(M.value, h.value, e, t), h.value = Rt(h.value, { type: "execute" }), N();
|
|
3692
3735
|
}
|
|
3693
3736
|
}
|
|
3694
3737
|
function xe(e) {
|
|
3695
|
-
if (!
|
|
3696
|
-
let t = Mt(h.value,
|
|
3738
|
+
if (!M.value || _.value || !u.value) return;
|
|
3739
|
+
let t = Mt(h.value, fe.value, e.key, { isComposing: e.isComposing || te(M.value.state) });
|
|
3697
3740
|
if (t.type !== "ignore") {
|
|
3698
3741
|
if (e.preventDefault(), t.type === "close") {
|
|
3699
|
-
h.value = Rt(h.value, { type: "escape" }),
|
|
3742
|
+
h.value = Rt(h.value, { type: "escape" }), N();
|
|
3700
3743
|
return;
|
|
3701
3744
|
}
|
|
3702
3745
|
if (t.type === "move-active") {
|
|
@@ -3707,78 +3750,78 @@ function $r(e = {}) {
|
|
|
3707
3750
|
});
|
|
3708
3751
|
return;
|
|
3709
3752
|
}
|
|
3710
|
-
|
|
3753
|
+
be(t.command);
|
|
3711
3754
|
}
|
|
3712
3755
|
}
|
|
3713
|
-
|
|
3714
|
-
c.value = f(e.mode),
|
|
3756
|
+
K(() => [e.mode, e.editable], () => {
|
|
3757
|
+
c.value = f(e.mode), M.value && (M.value.setEditable(u.value), p(M.value, {
|
|
3715
3758
|
mode: c.value,
|
|
3716
3759
|
editable: u.value
|
|
3717
|
-
}), Dt(
|
|
3718
|
-
}, { immediate: !0 }),
|
|
3719
|
-
|
|
3720
|
-
}, { immediate: !0 }),
|
|
3721
|
-
let n =
|
|
3722
|
-
if (!(!
|
|
3723
|
-
if (
|
|
3760
|
+
}), Dt(M.value, u.value ? "live" : "view"), O(), u.value || N());
|
|
3761
|
+
}, { immediate: !0 }), K(() => e.theme, () => {
|
|
3762
|
+
M.value && Et(M.value, l.value);
|
|
3763
|
+
}, { immediate: !0 }), K(() => e.content, (t) => {
|
|
3764
|
+
let n = oe(e.contentFormat);
|
|
3765
|
+
if (!(!M.value || t === void 0)) {
|
|
3766
|
+
if (ae(M.value, C.value, t, n)) {
|
|
3724
3767
|
C.value = null;
|
|
3725
3768
|
return;
|
|
3726
3769
|
}
|
|
3727
|
-
C.value = null, !
|
|
3728
|
-
contentType:
|
|
3770
|
+
C.value = null, !ie(M.value, t, n) && (S.value = !0, M.value.commands.setContent(t, {
|
|
3771
|
+
contentType: re(n),
|
|
3729
3772
|
emitUpdate: !1
|
|
3730
|
-
}), S.value = !1,
|
|
3773
|
+
}), S.value = !1, I(M.value), u.value && F(M.value), L(M.value), O());
|
|
3731
3774
|
}
|
|
3732
|
-
}),
|
|
3775
|
+
}), K(pe, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(de, (t) => e.onTocChange?.(t), { immediate: !0 }), K(le, (e) => {
|
|
3733
3776
|
let t = De(e, x.value);
|
|
3734
3777
|
x.value !== t && (x.value = t);
|
|
3735
3778
|
});
|
|
3736
3779
|
let Oe = null;
|
|
3737
|
-
return
|
|
3738
|
-
|
|
3739
|
-
}),
|
|
3780
|
+
return q(() => {
|
|
3781
|
+
D !== null && window.clearTimeout(D);
|
|
3782
|
+
}), Cn(() => {
|
|
3740
3783
|
let e = () => {
|
|
3741
|
-
if (!
|
|
3784
|
+
if (!M.value || !le.value.length) {
|
|
3742
3785
|
x.value = null;
|
|
3743
3786
|
return;
|
|
3744
3787
|
}
|
|
3745
3788
|
let e = null;
|
|
3746
3789
|
try {
|
|
3747
|
-
e = Te(
|
|
3790
|
+
e = Te(M.value, le.value);
|
|
3748
3791
|
} catch {
|
|
3749
3792
|
return;
|
|
3750
3793
|
}
|
|
3751
3794
|
x.value !== e && (x.value = e);
|
|
3752
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
3795
|
+
}, t = () => window.requestAnimationFrame(e), n = Br(M.value?.view.dom ?? null);
|
|
3753
3796
|
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
|
|
3754
3797
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3755
3798
|
};
|
|
3756
|
-
}),
|
|
3799
|
+
}), q(() => {
|
|
3757
3800
|
Oe?.();
|
|
3758
|
-
let e =
|
|
3759
|
-
|
|
3801
|
+
let e = j.value;
|
|
3802
|
+
j.value = null, J(() => e?.destroy());
|
|
3760
3803
|
}), {
|
|
3761
|
-
editor:
|
|
3762
|
-
runtimeSnapshot:
|
|
3763
|
-
actions:
|
|
3804
|
+
editor: M,
|
|
3805
|
+
runtimeSnapshot: pe,
|
|
3806
|
+
actions: _e,
|
|
3764
3807
|
__render: {
|
|
3765
3808
|
messages: o,
|
|
3766
3809
|
effectiveEditable: u,
|
|
3767
|
-
tableFocusState:
|
|
3810
|
+
tableFocusState: z,
|
|
3768
3811
|
tableInteractionState: b,
|
|
3769
|
-
codeBlockState:
|
|
3770
|
-
isCodeBlockActive:
|
|
3812
|
+
codeBlockState: R,
|
|
3813
|
+
isCodeBlockActive: ne,
|
|
3771
3814
|
mermaidMode: v,
|
|
3772
3815
|
mathTarget: y,
|
|
3773
3816
|
setMermaidMode: (e) => {
|
|
3774
3817
|
v.value = e;
|
|
3775
3818
|
},
|
|
3776
|
-
tocState:
|
|
3777
|
-
filteredSlashCommands:
|
|
3819
|
+
tocState: de,
|
|
3820
|
+
filteredSlashCommands: fe,
|
|
3778
3821
|
slashState: h,
|
|
3779
3822
|
slashMenuPosition: g,
|
|
3780
3823
|
slashInputCommand: _,
|
|
3781
|
-
runSlashCommand:
|
|
3824
|
+
runSlashCommand: be,
|
|
3782
3825
|
handleEditorKeyDown: xe,
|
|
3783
3826
|
setSlashInputCommand: (e) => {
|
|
3784
3827
|
_.value = e;
|
|
@@ -3786,7 +3829,7 @@ function $r(e = {}) {
|
|
|
3786
3829
|
}
|
|
3787
3830
|
};
|
|
3788
3831
|
}
|
|
3789
|
-
var
|
|
3832
|
+
var ni = Y({
|
|
3790
3833
|
name: "MarkweaveEditor",
|
|
3791
3834
|
props: {
|
|
3792
3835
|
defaultContent: {
|
|
@@ -3849,6 +3892,10 @@ var ei = J({
|
|
|
3849
3892
|
type: Function,
|
|
3850
3893
|
default: void 0
|
|
3851
3894
|
},
|
|
3895
|
+
resolveMediaSource: {
|
|
3896
|
+
type: Function,
|
|
3897
|
+
default: void 0
|
|
3898
|
+
},
|
|
3852
3899
|
className: {
|
|
3853
3900
|
type: String,
|
|
3854
3901
|
default: void 0
|
|
@@ -3891,12 +3938,12 @@ var ei = J({
|
|
|
3891
3938
|
}
|
|
3892
3939
|
},
|
|
3893
3940
|
setup(e) {
|
|
3894
|
-
let t =
|
|
3941
|
+
let t = ti(e);
|
|
3895
3942
|
return () => {
|
|
3896
3943
|
let n = t.editor.value;
|
|
3897
3944
|
if (!n) return null;
|
|
3898
3945
|
let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a = xe(e.canvasColor);
|
|
3899
|
-
return
|
|
3946
|
+
return H("section", {
|
|
3900
3947
|
class: i,
|
|
3901
3948
|
"aria-label": e.ariaLabel ?? r.messages.common.editorAriaLabel,
|
|
3902
3949
|
"data-testid": "markweave-editor-frame",
|
|
@@ -3909,11 +3956,11 @@ var ei = J({
|
|
|
3909
3956
|
"data-table-focus-mode": r.tableFocusState.value.mode,
|
|
3910
3957
|
onKeydownCapture: r.handleEditorKeyDown
|
|
3911
3958
|
}, [
|
|
3912
|
-
r.effectiveEditable.value ?
|
|
3959
|
+
r.effectiveEditable.value ? H(Jr, {
|
|
3913
3960
|
editor: n,
|
|
3914
3961
|
messages: r.messages
|
|
3915
3962
|
}) : null,
|
|
3916
|
-
r.effectiveEditable.value ?
|
|
3963
|
+
r.effectiveEditable.value ? H(Xr, {
|
|
3917
3964
|
commands: r.filteredSlashCommands.value,
|
|
3918
3965
|
state: r.slashState.value,
|
|
3919
3966
|
position: r.slashMenuPosition.value,
|
|
@@ -3923,7 +3970,7 @@ var ei = J({
|
|
|
3923
3970
|
onInputCommandChange: r.setSlashInputCommand,
|
|
3924
3971
|
onUpload: e.onSlashCommandUpload
|
|
3925
3972
|
}) : null,
|
|
3926
|
-
r.effectiveEditable.value ?
|
|
3973
|
+
r.effectiveEditable.value ? H(Zr, {
|
|
3927
3974
|
editor: n,
|
|
3928
3975
|
active: r.tableFocusState.value.active,
|
|
3929
3976
|
interactionState: r.tableInteractionState.value,
|
|
@@ -3932,11 +3979,11 @@ var ei = J({
|
|
|
3932
3979
|
onCommandResult: e.onTableCommandResult,
|
|
3933
3980
|
onEditWithAi: e.onEditWithAi
|
|
3934
3981
|
}) : null,
|
|
3935
|
-
r.effectiveEditable.value ?
|
|
3982
|
+
r.effectiveEditable.value ? H(Qr, {
|
|
3936
3983
|
editor: n,
|
|
3937
3984
|
focusState: r.tableFocusState.value
|
|
3938
3985
|
}) : null,
|
|
3939
|
-
|
|
3986
|
+
H($r, {
|
|
3940
3987
|
editor: n,
|
|
3941
3988
|
state: r.codeBlockState.value,
|
|
3942
3989
|
active: r.effectiveEditable.value && r.isCodeBlockActive.value,
|
|
@@ -3944,23 +3991,23 @@ var ei = J({
|
|
|
3944
3991
|
onMermaidModeChange: r.setMermaidMode,
|
|
3945
3992
|
readOnly: !r.effectiveEditable.value
|
|
3946
3993
|
}),
|
|
3947
|
-
e.innerToc && r.tocState.value.items.length ?
|
|
3994
|
+
e.innerToc && r.tocState.value.items.length ? H(ei, {
|
|
3948
3995
|
editor: n,
|
|
3949
3996
|
state: r.tocState.value,
|
|
3950
3997
|
messages: r.messages,
|
|
3951
3998
|
editable: r.effectiveEditable.value,
|
|
3952
3999
|
placement: Oe(e.innerTocPlacement)
|
|
3953
4000
|
}) : null,
|
|
3954
|
-
r.effectiveEditable.value && r.mathTarget.value ?
|
|
4001
|
+
r.effectiveEditable.value && r.mathTarget.value ? H(Yr, {
|
|
3955
4002
|
editor: n,
|
|
3956
4003
|
messages: r.messages,
|
|
3957
4004
|
target: r.mathTarget.value,
|
|
3958
4005
|
onClose: () => r.mathTarget.value = null
|
|
3959
4006
|
}) : null,
|
|
3960
|
-
|
|
4007
|
+
H(o, { editor: n })
|
|
3961
4008
|
]);
|
|
3962
4009
|
};
|
|
3963
4010
|
}
|
|
3964
4011
|
});
|
|
3965
4012
|
//#endregion
|
|
3966
|
-
export {
|
|
4013
|
+
export { ni as MarkweaveEditor, Ir as createMarkweaveEditorExtensions, Ir as createMarkweaveVue2EditorExtensions, ti as useMarkweaveEditorController };
|