@markweave/vue2 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +25 -25
- package/dist/index.js +562 -515
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,50 +9,51 @@ import { openMarkweaveLinkCardComposer as g } from "markweave/internal/plugins/l
|
|
|
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
11
|
import { MarkweaveCoreImage as x, MarkweaveCoreVideo as S, attrsFromMarkweaveImageUploadResult as C, attrsFromMarkweaveVideoUploadResult as w, attrsFromMarkweaveVideoUrl as T, clampMarkweaveImageWidth as E, createMarkweaveImageUploadRequest as ee, createMarkweaveVideoUploadRequest as D, downloadMarkweaveImage as O, markweaveVideoIframeAllow as k, normalizeMarkweaveCoreImageAlign as A, normalizeMarkweaveVideoEmbedUrl as j, numberAttribute as M, stringAttribute as N } from "markweave/internal/plugins/media/core-media-nodes";
|
|
12
|
-
import { detectUploadSource as P, getDirectUploadResult as
|
|
13
|
-
import { BubbleMenu as
|
|
14
|
-
import { isEditorComposing as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
12
|
+
import { detectUploadSource as P, getDirectUploadResult as te, resolveMarkweaveUploadResult as F } from "markweave/internal/plugins/slash-command/upload";
|
|
13
|
+
import { BubbleMenu as ne } from "@tiptap/vue-2/menus";
|
|
14
|
+
import { isEditorComposing as re } from "markweave/internal/editor-core/composition-guard";
|
|
15
|
+
import { saveMarkweaveBrowserFile as ie } from "markweave/internal/core/browser-file-save";
|
|
16
|
+
import { createMarkweaveFrameScheduler as ae } from "markweave/internal/editor-core/frame-scheduler";
|
|
17
|
+
import { createMarkweaveEditorUpdatePayload as oe, getMarkweaveContentType as I, isEditorContentCurrent as L, isMarkweaveControlledContentEchoCurrent as se, normalizeMarkweaveContentFormat as ce } from "markweave/internal/editor-core/editor-content";
|
|
18
|
+
import { getCurrentFloatingToolbarBlockType as le, getFloatingToolbarHighlightColorOptions as ue, getFloatingToolbarMoreActions as R, getFloatingToolbarTextColorOptions as de, getFloatingToolbarTurnIntoOptions as fe, runFloatingToolbarMoreAction as pe, setFloatingToolbarTurnInto as me } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
19
|
+
import { openMarkweaveReadonlyLinkFromEvent as he } from "markweave/internal/editor-core/readonly-link";
|
|
20
|
+
import { createMarkweaveEditorRuntimeSnapshot as ge } from "markweave/internal/editor-core/runtime-snapshot";
|
|
21
|
+
import { areEditorSelectionSnapshotsEquivalent as _e, calculateFloatingToolbarPopoverPlacement as ve, createSelectionSnapshot as ye, markweaveRuntimeProjectionDelayMs as be, shouldShowFloatingToolbar as z } from "markweave/internal/editor-core/selection-state";
|
|
22
|
+
import { normalizeMarkweaveCanvasColor as xe, normalizeMarkweaveTheme as Se } from "markweave/internal/core/theme";
|
|
23
|
+
import { createMarkweaveTocState as Ce, emptyMarkweaveTocState as we, getActiveMarkweaveTocId as Te, getMarkweaveTocItems as Ee, getValidMarkweaveTocActiveId as De, normalizeMarkweaveInnerTocPlacement as Oe, observeMarkweaveInnerTocContainerPosition as ke, scrollToMarkweaveTocItem as Ae } from "markweave/internal/core/toc-state";
|
|
24
|
+
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
|
+
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
|
+
import { normalizeMarkdownLinkHref as ft } from "markweave/internal/plugins/markdown/markdown-input";
|
|
27
|
+
import { applyMarkweaveMathLatex as pt, calculateMarkweaveMathPopoverPosition as mt, getMarkweaveMathAnchorRect as ht, getMarkweaveMathBlockIndex as gt, getMarkweaveMathRenderedHtml as _t, getMarkweaveMathTargetAtPos as vt, getMarkweaveMathTargetFromDomEvent as yt, getMarkweaveMathTargetFromSelection as bt, renderMarkweaveMathPreview as xt, setMarkweaveMathEditingDomState as St, setMarkweaveMathEditingDomStateInView as Ct, setMarkweaveMathSelectionInView as wt } from "markweave/internal/plugins/math/math-ui-model";
|
|
28
|
+
import { isMermaidInlinePreviewTransaction as Tt, setMarkweaveMermaidTheme as Et, setMermaidInlinePreviewEditorMode as Dt, setReadonlyMermaidPreviewMode as Ot } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
29
|
+
import { getMermaidPreviewState as kt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
30
|
+
import { filterSlashCommands as At, isExecutableSlashCommand as jt } from "markweave/internal/plugins/slash-command/command-spec";
|
|
31
|
+
import { getSlashCommandKeyboardAction as Mt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
32
|
+
import { executeSlashCommand as Nt, getNextSlashCommandState as Pt, getSlashCommandAnchoredMenuPosition as Ft, getSlashCommandContext as It } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
33
|
+
import { initialSlashCommandState as Lt, reduceSlashCommandState as Rt } from "markweave/internal/plugins/slash-command/slash-state";
|
|
34
|
+
import { setMarkweaveTableMenuAxisTarget as zt } from "markweave/internal/plugins/table/table-clipboard";
|
|
35
|
+
import { getFirstTableDebugSnapshot as Bt } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
36
|
+
import { focusFirstTableBodyCell as Vt } from "markweave/internal/plugins/table/table-focus-position";
|
|
37
|
+
import { getTableFocusState as Ht } from "markweave/internal/plugins/table/table-focus-state";
|
|
38
|
+
import { getTableSelectionOverlayState as Ut, initialTableInteractionState as Wt, tableInteractionPluginKey as Gt } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
39
|
+
import { calculateAnchoredTableMenuPosition as Kt, calculateTableEdgeHandlePosition as qt, canRunTableCommand as Jt, executeTableMenuCommand as Yt, formatTableCopyFeedback as Xt, getActiveTableElement as Zt, getAvailableCellMenuCommandSpecs as Qt, getTableAxisTargetRect as $t, getTableControlAxisSelectionModel as en, getTableEditWithAiRequest as tn, getTableMenuItemGroup as nn, getTableMenuItemLabel as rn, getTableMenuItems as an, getTableSelectionTargetRect as on, measureTableSelectionOverlay as sn, selectTableAxisFromCell as cn, tableCopyFeedbackTimeoutMs as ln, tableMenuLabel as un } from "markweave/internal/plugins/table/table-ui-model";
|
|
39
40
|
//#region src/vue2-compat.ts
|
|
40
|
-
var
|
|
41
|
-
function
|
|
41
|
+
var dn = l.default ?? l, fn = null, pn = null, mn = null;
|
|
42
|
+
function hn(e) {
|
|
42
43
|
return !!(e && typeof e == "object" && "value" in e);
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function gn(e) {
|
|
45
46
|
let t = e.slice(2);
|
|
46
47
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function _n(e) {
|
|
49
50
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
50
51
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
51
52
|
if (o === "class" || o === "style" || o === "key") {
|
|
52
53
|
t[o] = s;
|
|
53
54
|
continue;
|
|
54
55
|
}
|
|
55
|
-
if (o === "ref" &&
|
|
56
|
+
if (o === "ref" && hn(s)) {
|
|
56
57
|
a.insert = (e) => {
|
|
57
58
|
s.value = e.elm;
|
|
58
59
|
}, a.destroy = () => {
|
|
@@ -61,7 +62,7 @@ function dn(e) {
|
|
|
61
62
|
continue;
|
|
62
63
|
}
|
|
63
64
|
if (/^on[A-Z]/.test(o)) {
|
|
64
|
-
i[
|
|
65
|
+
i[gn(o)] = s;
|
|
65
66
|
continue;
|
|
66
67
|
}
|
|
67
68
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -72,14 +73,14 @@ function dn(e) {
|
|
|
72
73
|
}
|
|
73
74
|
return Object.keys(n).length && (t.attrs = n), Object.keys(r).length && (t.domProps = r), Object.keys(i).length && (t.on = i), Object.keys(a).length && (t.hook = a), t;
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function vn(e) {
|
|
76
77
|
let t = {}, n = {}, r = {}, i = {};
|
|
77
78
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
78
79
|
if (a === "class" || a === "style" || a === "key") {
|
|
79
80
|
t[a] = o;
|
|
80
81
|
continue;
|
|
81
82
|
}
|
|
82
|
-
if (a === "ref" &&
|
|
83
|
+
if (a === "ref" && hn(o)) {
|
|
83
84
|
i.insert = (e) => {
|
|
84
85
|
o.value = e.componentInstance ?? e.elm;
|
|
85
86
|
}, i.destroy = () => {
|
|
@@ -95,25 +96,25 @@ function fn(e) {
|
|
|
95
96
|
}
|
|
96
97
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
97
98
|
}
|
|
98
|
-
function
|
|
99
|
+
function yn(e) {
|
|
99
100
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
+
function bn(e) {
|
|
102
103
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
+
function xn(e) {
|
|
105
106
|
return e == null || Array.isArray(e) ? e : [e];
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
-
return typeof e == "function" ?
|
|
108
|
+
function Sn(e) {
|
|
109
|
+
return typeof e == "function" ? xn(e()) : yn(e) ? xn(e.default()) : bn(e) ? [e] : e;
|
|
109
110
|
}
|
|
110
111
|
function B(e, t, n) {
|
|
111
|
-
if (!
|
|
112
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
113
|
-
return
|
|
112
|
+
if (!mn) throw Error("Vue 2 render context is not available.");
|
|
113
|
+
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
|
+
return mn(e, i, a);
|
|
114
115
|
}
|
|
115
116
|
function V(e) {
|
|
116
|
-
return
|
|
117
|
+
return dn.observable({ value: e });
|
|
117
118
|
}
|
|
118
119
|
var H = V;
|
|
119
120
|
function U(e) {
|
|
@@ -123,19 +124,19 @@ function U(e) {
|
|
|
123
124
|
}
|
|
124
125
|
function W(e, t, n) {
|
|
125
126
|
let r = typeof e == "function" ? e : () => e.value;
|
|
126
|
-
return
|
|
127
|
+
return fn?.$watch ? fn.$watch(r, t, n) : () => void 0;
|
|
127
128
|
}
|
|
128
129
|
function G(e) {
|
|
129
|
-
|
|
130
|
+
pn?.mounted.push(e);
|
|
130
131
|
}
|
|
131
132
|
function K(e) {
|
|
132
|
-
|
|
133
|
+
pn?.beforeUnmount.push(e);
|
|
133
134
|
}
|
|
134
135
|
function q(e) {
|
|
135
|
-
return
|
|
136
|
+
return dn.nextTick(e);
|
|
136
137
|
}
|
|
137
138
|
function J(e) {
|
|
138
|
-
return
|
|
139
|
+
return dn.extend({
|
|
139
140
|
name: e.name,
|
|
140
141
|
props: e.props,
|
|
141
142
|
created() {
|
|
@@ -143,12 +144,12 @@ function J(e) {
|
|
|
143
144
|
mounted: [],
|
|
144
145
|
beforeUnmount: []
|
|
145
146
|
};
|
|
146
|
-
|
|
147
|
+
fn = this, pn = t;
|
|
147
148
|
try {
|
|
148
149
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
149
150
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
150
151
|
} finally {
|
|
151
|
-
|
|
152
|
+
fn = null, pn = null;
|
|
152
153
|
}
|
|
153
154
|
},
|
|
154
155
|
mounted() {
|
|
@@ -158,19 +159,19 @@ function J(e) {
|
|
|
158
159
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
159
160
|
},
|
|
160
161
|
render(t) {
|
|
161
|
-
|
|
162
|
+
mn = t;
|
|
162
163
|
try {
|
|
163
164
|
let n = this.__markweaveVue2Render;
|
|
164
165
|
return n ? n() : e.render?.(t) ?? null;
|
|
165
166
|
} finally {
|
|
166
|
-
|
|
167
|
+
mn = null;
|
|
167
168
|
}
|
|
168
169
|
}
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
172
|
//#endregion
|
|
172
173
|
//#region src/vue2-icons.ts
|
|
173
|
-
var
|
|
174
|
+
var Cn = {
|
|
174
175
|
AlignCenter: {
|
|
175
176
|
iconName: "text-align-center",
|
|
176
177
|
node: [
|
|
@@ -1035,7 +1036,7 @@ var _n = {
|
|
|
1035
1036
|
}]]
|
|
1036
1037
|
}
|
|
1037
1038
|
};
|
|
1038
|
-
function
|
|
1039
|
+
function wn(e) {
|
|
1039
1040
|
return e.map(([e, t]) => B(e, t));
|
|
1040
1041
|
}
|
|
1041
1042
|
function Y(e) {
|
|
@@ -1056,7 +1057,7 @@ function Y(e) {
|
|
|
1056
1057
|
}
|
|
1057
1058
|
},
|
|
1058
1059
|
setup(t) {
|
|
1059
|
-
let n =
|
|
1060
|
+
let n = Cn[e];
|
|
1060
1061
|
return () => B("svg", {
|
|
1061
1062
|
class: `lucide lucide-${n.iconName}`,
|
|
1062
1063
|
viewBox: "0 0 24 24",
|
|
@@ -1069,12 +1070,12 @@ function Y(e) {
|
|
|
1069
1070
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1070
1071
|
"aria-hidden": "true",
|
|
1071
1072
|
focusable: "false"
|
|
1072
|
-
},
|
|
1073
|
+
}, wn(n.node));
|
|
1073
1074
|
}
|
|
1074
1075
|
});
|
|
1075
1076
|
}
|
|
1076
|
-
var
|
|
1077
|
-
function
|
|
1077
|
+
var Tn = Y("AlignCenter"), En = Y("AlignJustify"), Dn = Y("AlignLeft"), On = Y("AlignRight"), kn = Y("AlertTriangle"), An = Y("Bold"), jn = Y("Braces"), Mn = Y("Captions"), Nn = Y("CheckCircle2"), Pn = Y("ChevronDown"), Fn = Y("ChevronUp"), In = Y("CircleX"), Ln = Y("Code2"), Rn = Y("CornerDownLeft"), zn = Y("Download"), Bn = Y("Eye"), Vn = Y("ExternalLink"), Hn = Y("Heading1"), Un = Y("Heading2"), Wn = Y("Heading3"), Gn = Y("Image"), Kn = Y("ImageUp"), qn = Y("IndentDecrease"), Jn = Y("IndentIncrease"), Yn = Y("Info"), Xn = Y("Italic"), Zn = Y("Lightbulb"), Qn = Y("Link2"), $n = Y("List"), er = Y("ListChecks"), tr = Y("ListOrdered"), nr = Y("Minus"), rr = Y("MoreVertical"), ir = Y("Paperclip"), ar = Y("PencilLine"), or = Y("Quote"), sr = Y("Replace"), cr = Y("Sigma"), lr = Y("SmilePlus"), ur = Y("Strikethrough"), dr = Y("Subscript"), fr = Y("Superscript"), pr = Y("Table2"), mr = Y("Text"), hr = Y("Trash2"), gr = Y("Type"), _r = Y("Underline"), vr = Y("Upload"), yr = Y("Video"), br = A;
|
|
1078
|
+
function xr(e) {
|
|
1078
1079
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1079
1080
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1080
1081
|
return n === "view" ? {
|
|
@@ -1096,16 +1097,16 @@ function hr(e) {
|
|
|
1096
1097
|
i(), a?.disconnect();
|
|
1097
1098
|
}), r;
|
|
1098
1099
|
}
|
|
1099
|
-
function
|
|
1100
|
+
function Sr(e) {
|
|
1100
1101
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1101
1102
|
}
|
|
1102
|
-
function
|
|
1103
|
+
function Cr(e) {
|
|
1103
1104
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1104
1105
|
}
|
|
1105
|
-
function
|
|
1106
|
+
function wr(e) {
|
|
1106
1107
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1107
1108
|
}
|
|
1108
|
-
function
|
|
1109
|
+
function Tr(e, t) {
|
|
1109
1110
|
return B(e, {
|
|
1110
1111
|
size: 18,
|
|
1111
1112
|
strokeWidth: 1.8,
|
|
@@ -1121,12 +1122,12 @@ function X(e) {
|
|
|
1121
1122
|
"data-active": e.active ? "true" : "false",
|
|
1122
1123
|
onMousedown: (e) => e.preventDefault(),
|
|
1123
1124
|
onClick: e.onClick
|
|
1124
|
-
}, [
|
|
1125
|
+
}, [Tr(e.icon, e.label), B("span", {
|
|
1125
1126
|
class: "markweave-image-tooltip",
|
|
1126
1127
|
role: "tooltip"
|
|
1127
1128
|
}, e.label)]);
|
|
1128
1129
|
}
|
|
1129
|
-
function
|
|
1130
|
+
function Er(e) {
|
|
1130
1131
|
let t = V(null), n = e.messages.image;
|
|
1131
1132
|
return B("section", {
|
|
1132
1133
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1160,7 +1161,7 @@ function br(e) {
|
|
|
1160
1161
|
B("div", {
|
|
1161
1162
|
class: "markweave-image-upload-icon",
|
|
1162
1163
|
"aria-hidden": "true"
|
|
1163
|
-
}, [B(
|
|
1164
|
+
}, [B(Kn, {
|
|
1164
1165
|
size: 46,
|
|
1165
1166
|
strokeWidth: 1.6
|
|
1166
1167
|
})]),
|
|
@@ -1185,7 +1186,7 @@ function br(e) {
|
|
|
1185
1186
|
"data-testid": "markweave-image-upload-submit",
|
|
1186
1187
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1187
1188
|
onClick: e.onSubmit
|
|
1188
|
-
}, [B(
|
|
1189
|
+
}, [B(Kn, {
|
|
1189
1190
|
size: 16,
|
|
1190
1191
|
strokeWidth: 1.8
|
|
1191
1192
|
}), e.messages.common.insert]),
|
|
@@ -1201,7 +1202,7 @@ function br(e) {
|
|
|
1201
1202
|
}, e.error) : null
|
|
1202
1203
|
]);
|
|
1203
1204
|
}
|
|
1204
|
-
function
|
|
1205
|
+
function Dr(e) {
|
|
1205
1206
|
let t = V(null), n = e.messages.video;
|
|
1206
1207
|
return B("section", {
|
|
1207
1208
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1235,7 +1236,7 @@ function xr(e) {
|
|
|
1235
1236
|
B("div", {
|
|
1236
1237
|
class: "markweave-video-upload-icon",
|
|
1237
1238
|
"aria-hidden": "true"
|
|
1238
|
-
}, [B(
|
|
1239
|
+
}, [B(yr, {
|
|
1239
1240
|
size: 46,
|
|
1240
1241
|
strokeWidth: 1.6
|
|
1241
1242
|
})]),
|
|
@@ -1260,7 +1261,7 @@ function xr(e) {
|
|
|
1260
1261
|
"data-testid": "markweave-video-upload-submit",
|
|
1261
1262
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1262
1263
|
onClick: e.onSubmit
|
|
1263
|
-
}, [B(
|
|
1264
|
+
}, [B(vr, {
|
|
1264
1265
|
size: 16,
|
|
1265
1266
|
strokeWidth: 1.8
|
|
1266
1267
|
}), e.messages.common.insert]),
|
|
@@ -1276,7 +1277,7 @@ function xr(e) {
|
|
|
1276
1277
|
}, e.error) : null
|
|
1277
1278
|
]);
|
|
1278
1279
|
}
|
|
1279
|
-
var
|
|
1280
|
+
var Or = J({
|
|
1280
1281
|
name: "MarkweaveVueImageNodeView",
|
|
1281
1282
|
props: {
|
|
1282
1283
|
editor: {
|
|
@@ -1309,7 +1310,7 @@ var Sr = J({
|
|
|
1309
1310
|
}
|
|
1310
1311
|
},
|
|
1311
1312
|
setup(e) {
|
|
1312
|
-
let t = V(null), r = V(!1), i = V(!1), a = V(!1), o = V(""), c = V(null), l = V(!1), u = U(() => e.node.attrs), f = V(!!N(u.value.caption)), p = V(N(u.value.caption) ?? ""), m =
|
|
1313
|
+
let t = V(null), r = V(!1), i = V(!1), a = V(!1), o = V(""), c = V(null), l = V(!1), u = U(() => e.node.attrs), f = V(!!N(u.value.caption)), p = V(N(u.value.caption) ?? ""), m = xr(e.editor), h = U(() => d(m.value)), g = U(() => e.extension.options?.messages ?? n("zh")), _ = U(() => g.value.image), v = U(() => N(u.value.src)), y = U(() => br(u.value.align)), x = U(() => M(u.value.width)), S = U(() => N(u.value.caption)), w = U(() => h.value && (!v.value || i.value)), T = () => {
|
|
1313
1314
|
v.value && b({
|
|
1314
1315
|
src: v.value,
|
|
1315
1316
|
alt: N(u.value.alt) ?? "",
|
|
@@ -1340,7 +1341,7 @@ var Sr = J({
|
|
|
1340
1341
|
let n = e.extension.options;
|
|
1341
1342
|
l.value = !0, c.value = null;
|
|
1342
1343
|
try {
|
|
1343
|
-
let r = await
|
|
1344
|
+
let r = await F(ee(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1344
1345
|
e.updateAttributes(C(u.value, r)), o.value = "", i.value = !1;
|
|
1345
1346
|
} catch (e) {
|
|
1346
1347
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
@@ -1353,15 +1354,15 @@ var Sr = J({
|
|
|
1353
1354
|
return;
|
|
1354
1355
|
}
|
|
1355
1356
|
A(P(o.value));
|
|
1356
|
-
},
|
|
1357
|
+
}, te = (e) => {
|
|
1357
1358
|
A({
|
|
1358
1359
|
type: "file",
|
|
1359
1360
|
file: e,
|
|
1360
1361
|
mimeType: e.type || "image/*"
|
|
1361
1362
|
});
|
|
1362
|
-
},
|
|
1363
|
+
}, ne = () => {
|
|
1363
1364
|
f.value = !f.value, f.value && (p.value = S.value ?? "");
|
|
1364
|
-
},
|
|
1365
|
+
}, re = (n, r) => {
|
|
1365
1366
|
if (!h.value || !v.value) return;
|
|
1366
1367
|
r.preventDefault(), r.stopPropagation(), D();
|
|
1367
1368
|
let i = t.value;
|
|
@@ -1382,7 +1383,7 @@ var Sr = J({
|
|
|
1382
1383
|
"data-selected": "false",
|
|
1383
1384
|
"data-hovered": "false",
|
|
1384
1385
|
"data-empty": "true"
|
|
1385
|
-
}, () =>
|
|
1386
|
+
}, () => Er({
|
|
1386
1387
|
messages: g.value,
|
|
1387
1388
|
inputValue: o.value,
|
|
1388
1389
|
error: c.value,
|
|
@@ -1391,7 +1392,7 @@ var Sr = J({
|
|
|
1391
1392
|
onInputValue: (e) => {
|
|
1392
1393
|
o.value = e;
|
|
1393
1394
|
},
|
|
1394
|
-
onFile:
|
|
1395
|
+
onFile: te,
|
|
1395
1396
|
onSubmit: j,
|
|
1396
1397
|
onCancel: k,
|
|
1397
1398
|
onDragActive: (e) => {
|
|
@@ -1412,7 +1413,7 @@ var Sr = J({
|
|
|
1412
1413
|
r.value = !1;
|
|
1413
1414
|
},
|
|
1414
1415
|
onMousedown: (e) => {
|
|
1415
|
-
h.value && !
|
|
1416
|
+
h.value && !Sr(e.target) && D();
|
|
1416
1417
|
}
|
|
1417
1418
|
}, () => [
|
|
1418
1419
|
h.value ? B("div", {
|
|
@@ -1424,21 +1425,21 @@ var Sr = J({
|
|
|
1424
1425
|
X({
|
|
1425
1426
|
testId: "markweave-image-align-left",
|
|
1426
1427
|
label: _.value.alignLeft,
|
|
1427
|
-
icon:
|
|
1428
|
+
icon: Dn,
|
|
1428
1429
|
active: y.value === "left",
|
|
1429
1430
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1430
1431
|
}),
|
|
1431
1432
|
X({
|
|
1432
1433
|
testId: "markweave-image-align-center",
|
|
1433
1434
|
label: _.value.alignCenter,
|
|
1434
|
-
icon:
|
|
1435
|
+
icon: Tn,
|
|
1435
1436
|
active: y.value === "center",
|
|
1436
1437
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1437
1438
|
}),
|
|
1438
1439
|
X({
|
|
1439
1440
|
testId: "markweave-image-align-right",
|
|
1440
1441
|
label: _.value.alignRight,
|
|
1441
|
-
icon:
|
|
1442
|
+
icon: On,
|
|
1442
1443
|
active: y.value === "right",
|
|
1443
1444
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1444
1445
|
}),
|
|
@@ -1449,20 +1450,20 @@ var Sr = J({
|
|
|
1449
1450
|
X({
|
|
1450
1451
|
testId: "markweave-image-caption",
|
|
1451
1452
|
label: _.value.caption,
|
|
1452
|
-
icon:
|
|
1453
|
+
icon: Mn,
|
|
1453
1454
|
active: f.value || !!S.value,
|
|
1454
|
-
onClick:
|
|
1455
|
+
onClick: ne
|
|
1455
1456
|
}),
|
|
1456
1457
|
X({
|
|
1457
1458
|
testId: "markweave-image-preview",
|
|
1458
1459
|
label: _.value.preview,
|
|
1459
|
-
icon:
|
|
1460
|
+
icon: Bn,
|
|
1460
1461
|
onClick: T
|
|
1461
1462
|
}),
|
|
1462
1463
|
X({
|
|
1463
1464
|
testId: "markweave-image-download",
|
|
1464
1465
|
label: _.value.download,
|
|
1465
|
-
icon:
|
|
1466
|
+
icon: zn,
|
|
1466
1467
|
onClick: () => {
|
|
1467
1468
|
v.value && O(v.value);
|
|
1468
1469
|
}
|
|
@@ -1470,7 +1471,7 @@ var Sr = J({
|
|
|
1470
1471
|
X({
|
|
1471
1472
|
testId: "markweave-image-replace",
|
|
1472
1473
|
label: _.value.replace,
|
|
1473
|
-
icon:
|
|
1474
|
+
icon: sr,
|
|
1474
1475
|
onClick: () => {
|
|
1475
1476
|
o.value = "", c.value = null, i.value = !0;
|
|
1476
1477
|
}
|
|
@@ -1482,7 +1483,7 @@ var Sr = J({
|
|
|
1482
1483
|
X({
|
|
1483
1484
|
testId: "markweave-image-delete",
|
|
1484
1485
|
label: _.value.delete,
|
|
1485
|
-
icon:
|
|
1486
|
+
icon: hr,
|
|
1486
1487
|
onClick: () => e.deleteNode()
|
|
1487
1488
|
})
|
|
1488
1489
|
]) : null,
|
|
@@ -1511,7 +1512,7 @@ var Sr = J({
|
|
|
1511
1512
|
title: _.value.preview,
|
|
1512
1513
|
onMousedown: (e) => e.preventDefault(),
|
|
1513
1514
|
onClick: T
|
|
1514
|
-
}, [B(
|
|
1515
|
+
}, [B(Bn, {
|
|
1515
1516
|
size: 16,
|
|
1516
1517
|
strokeWidth: 1.8
|
|
1517
1518
|
}), B("span", {
|
|
@@ -1525,7 +1526,7 @@ var Sr = J({
|
|
|
1525
1526
|
"data-side": "left",
|
|
1526
1527
|
"aria-label": _.value.resizeLeft,
|
|
1527
1528
|
"data-markweave-image-ui": "true",
|
|
1528
|
-
onPointerdown: (e) =>
|
|
1529
|
+
onPointerdown: (e) => re("left", e)
|
|
1529
1530
|
}) : null,
|
|
1530
1531
|
h.value ? B("button", {
|
|
1531
1532
|
type: "button",
|
|
@@ -1534,7 +1535,7 @@ var Sr = J({
|
|
|
1534
1535
|
"data-side": "right",
|
|
1535
1536
|
"aria-label": _.value.resizeRight,
|
|
1536
1537
|
"data-markweave-image-ui": "true",
|
|
1537
|
-
onPointerdown: (e) =>
|
|
1538
|
+
onPointerdown: (e) => re("right", e)
|
|
1538
1539
|
}) : null
|
|
1539
1540
|
]),
|
|
1540
1541
|
h.value && (f.value || S.value) ? B("input", {
|
|
@@ -1556,7 +1557,7 @@ var Sr = J({
|
|
|
1556
1557
|
}, S.value) : null
|
|
1557
1558
|
]);
|
|
1558
1559
|
}
|
|
1559
|
-
}),
|
|
1560
|
+
}), kr = J({
|
|
1560
1561
|
name: "MarkweaveVueVideoNodeView",
|
|
1561
1562
|
props: {
|
|
1562
1563
|
editor: {
|
|
@@ -1589,14 +1590,14 @@ var Sr = J({
|
|
|
1589
1590
|
}
|
|
1590
1591
|
},
|
|
1591
1592
|
setup(e) {
|
|
1592
|
-
let t = V(!1), r = V(""), i = V(null), a = V(!1), o =
|
|
1593
|
+
let t = V(!1), r = V(""), i = V(null), a = V(!1), o = xr(e.editor), c = U(() => d(o.value)), l = U(() => e.extension.options?.messages ?? n("zh")), u = U(() => l.value.video), f = U(() => e.node.attrs), p = U(() => N(f.value.src)), m = U(() => N(f.value.embedUrl)), h = U(() => N(f.value.provider)), g = U(() => m.value ? j(m.value, h.value) : null), _ = U(() => N(f.value.mimeType)), v = U(() => N(f.value.title)), y = () => {
|
|
1593
1594
|
p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
|
|
1594
1595
|
}, b = async (n) => {
|
|
1595
1596
|
if (!c.value) return;
|
|
1596
1597
|
let o = e.extension.options;
|
|
1597
1598
|
a.value = !0, i.value = null;
|
|
1598
1599
|
try {
|
|
1599
|
-
let t = await
|
|
1600
|
+
let t = await F(D(n), o?.onUpload);
|
|
1600
1601
|
e.updateAttributes(w(t)), r.value = "";
|
|
1601
1602
|
} catch (e) {
|
|
1602
1603
|
i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
@@ -1630,7 +1631,7 @@ var Sr = J({
|
|
|
1630
1631
|
"data-testid": "markweave-video-node",
|
|
1631
1632
|
"data-empty": "true",
|
|
1632
1633
|
"data-selected": "false"
|
|
1633
|
-
}, () =>
|
|
1634
|
+
}, () => Dr({
|
|
1634
1635
|
messages: l.value,
|
|
1635
1636
|
inputValue: r.value,
|
|
1636
1637
|
error: i.value,
|
|
@@ -1657,7 +1658,7 @@ var Sr = J({
|
|
|
1657
1658
|
onFocus: C,
|
|
1658
1659
|
onKeydown: E,
|
|
1659
1660
|
onMousedown: (e) => {
|
|
1660
|
-
c.value && !
|
|
1661
|
+
c.value && !Cr(e.target) && (e.preventDefault(), C());
|
|
1661
1662
|
}
|
|
1662
1663
|
}, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
|
|
1663
1664
|
class: "markweave-video-iframe",
|
|
@@ -1695,7 +1696,7 @@ var Sr = J({
|
|
|
1695
1696
|
"aria-hidden": "true"
|
|
1696
1697
|
})]);
|
|
1697
1698
|
}
|
|
1698
|
-
}),
|
|
1699
|
+
}), Ar = x.extend({
|
|
1699
1700
|
addOptions() {
|
|
1700
1701
|
return {
|
|
1701
1702
|
...this.parent?.(),
|
|
@@ -1704,9 +1705,9 @@ var Sr = J({
|
|
|
1704
1705
|
};
|
|
1705
1706
|
},
|
|
1706
1707
|
addNodeView() {
|
|
1707
|
-
return typeof document > "u" ? null : c(
|
|
1708
|
+
return typeof document > "u" ? null : c(Or, { stopEvent: ({ event: e }) => Sr(e.target) });
|
|
1708
1709
|
}
|
|
1709
|
-
}),
|
|
1710
|
+
}), jr = S.extend({
|
|
1710
1711
|
addOptions() {
|
|
1711
1712
|
return {
|
|
1712
1713
|
...this.parent?.(),
|
|
@@ -1715,9 +1716,9 @@ var Sr = J({
|
|
|
1715
1716
|
};
|
|
1716
1717
|
},
|
|
1717
1718
|
addNodeView() {
|
|
1718
|
-
return typeof document > "u" ? null : c(
|
|
1719
|
+
return typeof document > "u" ? null : c(kr, { stopEvent: ({ event: e }) => Cr(e.target) });
|
|
1719
1720
|
}
|
|
1720
|
-
}),
|
|
1721
|
+
}), Mr = J({
|
|
1721
1722
|
name: "MarkweaveVueLinkCardNodeView",
|
|
1722
1723
|
props: {
|
|
1723
1724
|
editor: {
|
|
@@ -1750,7 +1751,7 @@ var Sr = J({
|
|
|
1750
1751
|
}
|
|
1751
1752
|
},
|
|
1752
1753
|
setup(e) {
|
|
1753
|
-
let t = e.extension.options, r = t.messages ?? n("zh"), i =
|
|
1754
|
+
let t = e.extension.options, r = t.messages ?? n("zh"), i = xr(e.editor), a = V(!1), o = V(!1), c = V(!1), l = U(() => _(e.node.attrs ?? {})), u = V(l.value?.title ?? ""), f = V(l.value?.href ?? "");
|
|
1754
1755
|
W(l, (e) => {
|
|
1755
1756
|
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
1756
1757
|
});
|
|
@@ -1785,7 +1786,7 @@ var Sr = J({
|
|
|
1785
1786
|
"data-testid": n,
|
|
1786
1787
|
onMousedown: h,
|
|
1787
1788
|
onClick: r
|
|
1788
|
-
}, [
|
|
1789
|
+
}, [Tr(t, e), B("span", { role: "tooltip" }, e)]);
|
|
1789
1790
|
return () => {
|
|
1790
1791
|
let n = l.value;
|
|
1791
1792
|
if (!n) return null;
|
|
@@ -1821,10 +1822,10 @@ var Sr = J({
|
|
|
1821
1822
|
a.value = !1;
|
|
1822
1823
|
},
|
|
1823
1824
|
onMousedown: (e) => {
|
|
1824
|
-
|
|
1825
|
+
wr(e.target) || e.preventDefault();
|
|
1825
1826
|
},
|
|
1826
1827
|
onClick: (e) => {
|
|
1827
|
-
|
|
1828
|
+
wr(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
1828
1829
|
}
|
|
1829
1830
|
}, () => [
|
|
1830
1831
|
B("a", {
|
|
@@ -1844,9 +1845,9 @@ var Sr = J({
|
|
|
1844
1845
|
"data-markweave-link-card-ui": "true",
|
|
1845
1846
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
1846
1847
|
}, [
|
|
1847
|
-
C(r.linkCard.convertToLink,
|
|
1848
|
-
C(r.linkCard.copyAddress,
|
|
1849
|
-
C(r.linkCard.edit,
|
|
1848
|
+
C(r.linkCard.convertToLink, Qn, "markweave-link-card-convert", x),
|
|
1849
|
+
C(r.linkCard.copyAddress, zn, "markweave-link-card-copy", () => b(n.href)),
|
|
1850
|
+
C(r.linkCard.edit, ar, "markweave-link-card-edit", (i) => g({
|
|
1850
1851
|
anchor: i.currentTarget,
|
|
1851
1852
|
editor: e.editor,
|
|
1852
1853
|
messages: r,
|
|
@@ -1856,7 +1857,7 @@ var Sr = J({
|
|
|
1856
1857
|
attrs: n
|
|
1857
1858
|
}
|
|
1858
1859
|
})),
|
|
1859
|
-
C(r.linkCard.delete,
|
|
1860
|
+
C(r.linkCard.delete, hr, "markweave-link-card-delete", () => e.deleteNode())
|
|
1860
1861
|
]) : null,
|
|
1861
1862
|
p.value && o.value ? B("form", {
|
|
1862
1863
|
class: "markweave-link-card-editor",
|
|
@@ -1884,12 +1885,12 @@ var Sr = J({
|
|
|
1884
1885
|
type: "submit",
|
|
1885
1886
|
disabled: !v(f.value),
|
|
1886
1887
|
"aria-label": r.linkCard.edit
|
|
1887
|
-
}, [
|
|
1888
|
+
}, [Tr(Qn, r.linkCard.edit)])
|
|
1888
1889
|
]) : null
|
|
1889
1890
|
]);
|
|
1890
1891
|
};
|
|
1891
1892
|
}
|
|
1892
|
-
}),
|
|
1893
|
+
}), Nr = h.extend({
|
|
1893
1894
|
addOptions() {
|
|
1894
1895
|
return {
|
|
1895
1896
|
...this.parent?.(),
|
|
@@ -1898,23 +1899,23 @@ var Sr = J({
|
|
|
1898
1899
|
};
|
|
1899
1900
|
},
|
|
1900
1901
|
addNodeView() {
|
|
1901
|
-
return typeof document > "u" ? null : c(
|
|
1902
|
+
return typeof document > "u" ? null : c(Mr, { stopEvent: ({ event: e }) => wr(e.target) });
|
|
1902
1903
|
}
|
|
1903
1904
|
});
|
|
1904
1905
|
//#endregion
|
|
1905
1906
|
//#region src/create-editor-extensions.ts
|
|
1906
|
-
function
|
|
1907
|
+
function Pr(t = {}) {
|
|
1907
1908
|
return e({
|
|
1908
1909
|
lang: t.lang,
|
|
1909
1910
|
onImageUpload: t.onImageUpload,
|
|
1910
|
-
linkCardExtension:
|
|
1911
|
+
linkCardExtension: Nr.configure({
|
|
1911
1912
|
lang: t.lang,
|
|
1912
1913
|
messages: n(t.lang),
|
|
1913
1914
|
resolver: t.linkCardResolver
|
|
1914
1915
|
}),
|
|
1915
1916
|
mediaExtensions: i({
|
|
1916
|
-
image:
|
|
1917
|
-
video:
|
|
1917
|
+
image: Ar,
|
|
1918
|
+
video: jr,
|
|
1918
1919
|
lang: t.lang,
|
|
1919
1920
|
onImageUpload: t.onImageUpload,
|
|
1920
1921
|
onVideoUpload: t.onVideoUpload
|
|
@@ -1923,7 +1924,7 @@ function Or(t = {}) {
|
|
|
1923
1924
|
}
|
|
1924
1925
|
//#endregion
|
|
1925
1926
|
//#region src/MarkweaveEditor.ts
|
|
1926
|
-
var
|
|
1927
|
+
var Fr = {
|
|
1927
1928
|
active: !1,
|
|
1928
1929
|
mode: "outside",
|
|
1929
1930
|
activeCellPos: null,
|
|
@@ -1931,17 +1932,17 @@ var kr = {
|
|
|
1931
1932
|
selectedCellCount: 0,
|
|
1932
1933
|
selectionFrom: 0,
|
|
1933
1934
|
selectionTo: 0
|
|
1934
|
-
},
|
|
1935
|
+
}, Ir = {
|
|
1935
1936
|
active: !1,
|
|
1936
|
-
language:
|
|
1937
|
+
language: Fe.defaultLanguage,
|
|
1937
1938
|
mermaidPreviewMode: "code",
|
|
1938
1939
|
pos: null,
|
|
1939
1940
|
text: ""
|
|
1940
1941
|
};
|
|
1941
|
-
function
|
|
1942
|
-
return
|
|
1942
|
+
function Lr(e) {
|
|
1943
|
+
return Gt.getState(e.state) ?? Wt;
|
|
1943
1944
|
}
|
|
1944
|
-
function
|
|
1945
|
+
function Rr(e) {
|
|
1945
1946
|
if (!e || typeof window > "u") return null;
|
|
1946
1947
|
let t = e.parentElement;
|
|
1947
1948
|
for (; t;) {
|
|
@@ -1958,7 +1959,7 @@ function Z(e, t, n = 18, r = 1.8) {
|
|
|
1958
1959
|
"aria-hidden": "true"
|
|
1959
1960
|
}, { default: () => t });
|
|
1960
1961
|
}
|
|
1961
|
-
function
|
|
1962
|
+
function zr(e) {
|
|
1962
1963
|
return e === "clipboard" ? [B("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), B("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] : e === "search" ? [B("circle", {
|
|
1963
1964
|
cx: "10",
|
|
1964
1965
|
cy: "10",
|
|
@@ -2006,57 +2007,57 @@ function Q(e) {
|
|
|
2006
2007
|
"stroke-linecap": "round",
|
|
2007
2008
|
"stroke-linejoin": "round",
|
|
2008
2009
|
"stroke-width": "1.8"
|
|
2009
|
-
},
|
|
2010
|
+
}, zr(e)));
|
|
2010
2011
|
}
|
|
2011
2012
|
function $(e) {
|
|
2012
2013
|
e.preventDefault();
|
|
2013
2014
|
}
|
|
2014
|
-
function
|
|
2015
|
-
let t =
|
|
2015
|
+
function Br(e) {
|
|
2016
|
+
let t = ft(e);
|
|
2016
2017
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
2017
2018
|
}
|
|
2018
|
-
var
|
|
2019
|
-
bold:
|
|
2020
|
-
italic:
|
|
2021
|
-
underline:
|
|
2022
|
-
strike:
|
|
2023
|
-
"inline-code":
|
|
2024
|
-
link:
|
|
2025
|
-
more:
|
|
2026
|
-
superscript:
|
|
2027
|
-
subscript:
|
|
2028
|
-
"inline-math":
|
|
2029
|
-
"align-left":
|
|
2030
|
-
"align-center":
|
|
2031
|
-
"align-right":
|
|
2032
|
-
"align-justify":
|
|
2033
|
-
"decrease-indent":
|
|
2034
|
-
"increase-indent":
|
|
2035
|
-
},
|
|
2036
|
-
type:
|
|
2037
|
-
"heading-1":
|
|
2038
|
-
"heading-2":
|
|
2039
|
-
"heading-3":
|
|
2040
|
-
"bullet-list":
|
|
2041
|
-
"ordered-list":
|
|
2042
|
-
"task-list":
|
|
2043
|
-
blockquote:
|
|
2044
|
-
"code-block":
|
|
2045
|
-
info:
|
|
2046
|
-
tip:
|
|
2047
|
-
warning:
|
|
2048
|
-
error:
|
|
2049
|
-
success:
|
|
2050
|
-
emoji:
|
|
2051
|
-
math:
|
|
2052
|
-
table:
|
|
2053
|
-
separator:
|
|
2054
|
-
image:
|
|
2055
|
-
video:
|
|
2056
|
-
attachment:
|
|
2019
|
+
var Vr = {
|
|
2020
|
+
bold: An,
|
|
2021
|
+
italic: Xn,
|
|
2022
|
+
underline: _r,
|
|
2023
|
+
strike: ur,
|
|
2024
|
+
"inline-code": Ln,
|
|
2025
|
+
link: Qn,
|
|
2026
|
+
more: rr,
|
|
2027
|
+
superscript: fr,
|
|
2028
|
+
subscript: dr,
|
|
2029
|
+
"inline-math": cr,
|
|
2030
|
+
"align-left": Dn,
|
|
2031
|
+
"align-center": Tn,
|
|
2032
|
+
"align-right": On,
|
|
2033
|
+
"align-justify": En,
|
|
2034
|
+
"decrease-indent": qn,
|
|
2035
|
+
"increase-indent": Jn
|
|
2036
|
+
}, Hr = {
|
|
2037
|
+
type: mr,
|
|
2038
|
+
"heading-1": Hn,
|
|
2039
|
+
"heading-2": Un,
|
|
2040
|
+
"heading-3": Wn,
|
|
2041
|
+
"bullet-list": $n,
|
|
2042
|
+
"ordered-list": tr,
|
|
2043
|
+
"task-list": er,
|
|
2044
|
+
blockquote: or,
|
|
2045
|
+
"code-block": jn,
|
|
2046
|
+
info: Yn,
|
|
2047
|
+
tip: Zn,
|
|
2048
|
+
warning: kn,
|
|
2049
|
+
error: In,
|
|
2050
|
+
success: Nn,
|
|
2051
|
+
emoji: lr,
|
|
2052
|
+
math: cr,
|
|
2053
|
+
table: pr,
|
|
2054
|
+
separator: nr,
|
|
2055
|
+
image: Gn,
|
|
2056
|
+
video: yr,
|
|
2057
|
+
attachment: ir
|
|
2057
2058
|
};
|
|
2058
|
-
function
|
|
2059
|
-
let t =
|
|
2059
|
+
function Ur(e) {
|
|
2060
|
+
let t = Hr[e];
|
|
2060
2061
|
return B(t, {
|
|
2061
2062
|
size: 18,
|
|
2062
2063
|
strokeWidth: 1.6,
|
|
@@ -2064,21 +2065,21 @@ function Lr(e) {
|
|
|
2064
2065
|
"aria-hidden": "true"
|
|
2065
2066
|
});
|
|
2066
2067
|
}
|
|
2067
|
-
var
|
|
2068
|
-
paragraph:
|
|
2069
|
-
"heading-1":
|
|
2070
|
-
"heading-2":
|
|
2071
|
-
"heading-3":
|
|
2072
|
-
"bullet-list":
|
|
2073
|
-
"numbered-list":
|
|
2074
|
-
"todo-list":
|
|
2075
|
-
quote:
|
|
2076
|
-
"code-block":
|
|
2068
|
+
var Wr = {
|
|
2069
|
+
paragraph: gr,
|
|
2070
|
+
"heading-1": Hn,
|
|
2071
|
+
"heading-2": Un,
|
|
2072
|
+
"heading-3": Wn,
|
|
2073
|
+
"bullet-list": $n,
|
|
2074
|
+
"numbered-list": tr,
|
|
2075
|
+
"todo-list": er,
|
|
2076
|
+
quote: or,
|
|
2077
|
+
"code-block": jn
|
|
2077
2078
|
};
|
|
2078
|
-
function
|
|
2079
|
-
return
|
|
2079
|
+
function Gr(e, t) {
|
|
2080
|
+
return le(e, t).label;
|
|
2080
2081
|
}
|
|
2081
|
-
var
|
|
2082
|
+
var Kr = J({
|
|
2082
2083
|
name: "MarkweaveVueFloatingToolbar",
|
|
2083
2084
|
props: {
|
|
2084
2085
|
editor: {
|
|
@@ -2095,28 +2096,28 @@ var Br = J({
|
|
|
2095
2096
|
}
|
|
2096
2097
|
},
|
|
2097
2098
|
setup(e) {
|
|
2098
|
-
let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() =>
|
|
2099
|
+
let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() => ft(n.value.trim())), u = U(() => e.messages.floatingToolbar), d = U(() => fe(e.messages).map((e) => [
|
|
2099
2100
|
e.id,
|
|
2100
2101
|
e.label,
|
|
2101
|
-
|
|
2102
|
-
])), f = U(() =>
|
|
2102
|
+
Wr[e.id]
|
|
2103
|
+
])), f = U(() => de(e.messages).map((e) => [
|
|
2103
2104
|
e.id,
|
|
2104
2105
|
e.value,
|
|
2105
2106
|
e.label
|
|
2106
|
-
])), p = U(() =>
|
|
2107
|
+
])), p = U(() => ue(e.messages).map((e) => [
|
|
2107
2108
|
e.id,
|
|
2108
2109
|
e.value,
|
|
2109
2110
|
e.label
|
|
2110
|
-
])), m = U(() =>
|
|
2111
|
+
])), m = U(() => R(e.messages).map((e) => e.id)), h = () => {
|
|
2111
2112
|
l.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: l.value }).run(), t.value = null);
|
|
2112
2113
|
}, g = () => {
|
|
2113
2114
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
2114
2115
|
}, _ = (r) => {
|
|
2115
2116
|
t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
|
|
2116
|
-
}, v =
|
|
2117
|
+
}, v = ae(() => {
|
|
2117
2118
|
let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
2118
2119
|
if (!t.value || !n || !r) return;
|
|
2119
|
-
let s =
|
|
2120
|
+
let s = ve({
|
|
2120
2121
|
toolbarRect: n.getBoundingClientRect(),
|
|
2121
2122
|
popoverSize: r.getBoundingClientRect(),
|
|
2122
2123
|
viewport: {
|
|
@@ -2173,7 +2174,7 @@ var Br = J({
|
|
|
2173
2174
|
onMouseenter: (e) => b(n, e.currentTarget),
|
|
2174
2175
|
onMouseleave: () => b(null),
|
|
2175
2176
|
onClick: o
|
|
2176
|
-
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" },
|
|
2177
|
+
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, Gr(e.editor, e.messages)), Z(t.value === "block-type" ? Fn : Pn, i)])] : n === "color" ? [B("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [B("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? Fn : Pn, i)])] : [Z(a, i)]), C = () => B("span", {
|
|
2177
2178
|
class: "markweave-floating-toolbar-divider",
|
|
2178
2179
|
"aria-hidden": "true"
|
|
2179
2180
|
}), w = (n, r, i) => B("section", {
|
|
@@ -2205,7 +2206,7 @@ var Br = J({
|
|
|
2205
2206
|
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
2206
2207
|
onMousedown: $,
|
|
2207
2208
|
onClick: () => {
|
|
2208
|
-
|
|
2209
|
+
me(e.editor, n), t.value = null;
|
|
2209
2210
|
}
|
|
2210
2211
|
}, [B("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), B("span", null, r)]))]) : t.value === "link" ? B("form", {
|
|
2211
2212
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
@@ -2229,7 +2230,7 @@ var Br = J({
|
|
|
2229
2230
|
"aria-label": u.value.applyLink,
|
|
2230
2231
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2231
2232
|
onMousedown: $
|
|
2232
|
-
}, [Z(
|
|
2233
|
+
}, [Z(Rn, u.value.applyLink)]),
|
|
2233
2234
|
B("span", {
|
|
2234
2235
|
class: "markweave-floating-toolbar-link-divider",
|
|
2235
2236
|
"aria-hidden": "true"
|
|
@@ -2240,15 +2241,15 @@ var Br = J({
|
|
|
2240
2241
|
"aria-label": u.value.openLink,
|
|
2241
2242
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2242
2243
|
onMousedown: $,
|
|
2243
|
-
onClick: () =>
|
|
2244
|
-
}, [Z(
|
|
2244
|
+
onClick: () => Br(n.value)
|
|
2245
|
+
}, [Z(Vn, u.value.openLink)]),
|
|
2245
2246
|
B("button", {
|
|
2246
2247
|
type: "button",
|
|
2247
2248
|
"aria-label": u.value.removeLink,
|
|
2248
2249
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2249
2250
|
onMousedown: $,
|
|
2250
2251
|
onClick: g
|
|
2251
|
-
}, [Z(
|
|
2252
|
+
}, [Z(hr, u.value.removeLink)])
|
|
2252
2253
|
])]) : t.value === "color" ? B("div", {
|
|
2253
2254
|
ref: c,
|
|
2254
2255
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
@@ -2273,15 +2274,15 @@ var Br = J({
|
|
|
2273
2274
|
r.value = null;
|
|
2274
2275
|
},
|
|
2275
2276
|
onClick: () => {
|
|
2276
|
-
|
|
2277
|
+
pe(e.editor, n), t.value = null;
|
|
2277
2278
|
}
|
|
2278
|
-
}, [Z(
|
|
2279
|
+
}, [Z(Vr[n], u.value.moreActions[n])]), r.value === n ? B("div", {
|
|
2279
2280
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2280
2281
|
role: "tooltip"
|
|
2281
2282
|
}, u.value.moreActions[n]) : null]))) : null;
|
|
2282
|
-
return () => B(
|
|
2283
|
+
return () => B(ne, {
|
|
2283
2284
|
editor: e.editor,
|
|
2284
|
-
shouldShow: ({ editor: e }) => e.isEditable && ye(
|
|
2285
|
+
shouldShow: ({ editor: e }) => e.isEditable && z(ye(e)),
|
|
2285
2286
|
options: { placement: "top" }
|
|
2286
2287
|
}, { default: () => B("div", {
|
|
2287
2288
|
ref: o,
|
|
@@ -2293,23 +2294,23 @@ var Br = J({
|
|
|
2293
2294
|
class: "markweave-floating-toolbar-content",
|
|
2294
2295
|
"data-menu": t.value ?? "none"
|
|
2295
2296
|
}, [
|
|
2296
|
-
S("block-type", u.value.buttons["block-type"],
|
|
2297
|
+
S("block-type", u.value.buttons["block-type"], gr, () => _("block-type"), t.value === "block-type"),
|
|
2297
2298
|
C(),
|
|
2298
|
-
S("bold", u.value.buttons.bold,
|
|
2299
|
-
S("italic", u.value.buttons.italic,
|
|
2300
|
-
S("underline", u.value.buttons.underline,
|
|
2301
|
-
S("strike", u.value.buttons.strike,
|
|
2302
|
-
S("inline-code", u.value.buttons["inline-code"],
|
|
2299
|
+
S("bold", u.value.buttons.bold, An, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2300
|
+
S("italic", u.value.buttons.italic, Xn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2301
|
+
S("underline", u.value.buttons.underline, _r, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2302
|
+
S("strike", u.value.buttons.strike, ur, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2303
|
+
S("inline-code", u.value.buttons["inline-code"], Ln, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2303
2304
|
C(),
|
|
2304
|
-
S("link", u.value.buttons.link,
|
|
2305
|
-
S("color", u.value.buttons.color,
|
|
2305
|
+
S("link", u.value.buttons.link, Qn, () => _("link"), e.editor.isActive("link")),
|
|
2306
|
+
S("color", u.value.buttons.color, gr, () => _("color"), t.value === "color"),
|
|
2306
2307
|
C(),
|
|
2307
|
-
S("more", u.value.buttons.more,
|
|
2308
|
+
S("more", u.value.buttons.more, rr, () => _("more"), t.value === "more"),
|
|
2308
2309
|
T(),
|
|
2309
2310
|
x()
|
|
2310
2311
|
])]) });
|
|
2311
2312
|
}
|
|
2312
|
-
}),
|
|
2313
|
+
}), qr = J({
|
|
2313
2314
|
name: "MarkweaveVueMathEditorPopover",
|
|
2314
2315
|
props: {
|
|
2315
2316
|
editor: {
|
|
@@ -2330,17 +2331,17 @@ var Br = J({
|
|
|
2330
2331
|
}
|
|
2331
2332
|
},
|
|
2332
2333
|
setup(e) {
|
|
2333
|
-
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(
|
|
2334
|
+
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(_t(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
|
|
2334
2335
|
html: a.value,
|
|
2335
2336
|
error: !1
|
|
2336
|
-
} :
|
|
2337
|
+
} : xt(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => gt(e.editor, e.target) ?? 1), u = () => {
|
|
2337
2338
|
if (typeof window > "u") return;
|
|
2338
|
-
let r =
|
|
2339
|
+
let r = ht(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2339
2340
|
if (!r || !i) {
|
|
2340
2341
|
e.onClose();
|
|
2341
2342
|
return;
|
|
2342
2343
|
}
|
|
2343
|
-
n.value =
|
|
2344
|
+
n.value = mt({
|
|
2344
2345
|
anchorRect: r,
|
|
2345
2346
|
frameRect: i,
|
|
2346
2347
|
kind: e.target.kind,
|
|
@@ -2349,7 +2350,7 @@ var Br = J({
|
|
|
2349
2350
|
viewportWidth: window.innerWidth
|
|
2350
2351
|
});
|
|
2351
2352
|
}, d = () => {
|
|
2352
|
-
s.value &&
|
|
2353
|
+
s.value && pt(e.editor, e.target, t.value) && e.onClose();
|
|
2353
2354
|
}, f = (t) => {
|
|
2354
2355
|
if (t.key === "Escape") {
|
|
2355
2356
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -2361,13 +2362,13 @@ var Br = J({
|
|
|
2361
2362
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2362
2363
|
};
|
|
2363
2364
|
return W(() => [e.target.pos, e.target.latex], () => {
|
|
2364
|
-
t.value = e.target.latex, a.value =
|
|
2365
|
+
t.value = e.target.latex, a.value = _t(e.editor, e.target), q(u);
|
|
2365
2366
|
}), G(() => {
|
|
2366
|
-
|
|
2367
|
+
St(e.editor, e.target, !0), u(), q(() => {
|
|
2367
2368
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2368
2369
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2369
2370
|
}), K(() => {
|
|
2370
|
-
|
|
2371
|
+
St(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2371
2372
|
}), () => {
|
|
2372
2373
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2373
2374
|
ref: i,
|
|
@@ -2428,14 +2429,14 @@ var Br = J({
|
|
|
2428
2429
|
}, [
|
|
2429
2430
|
B("div", { class: "markweave-math-block-toolbar" }, [
|
|
2430
2431
|
B("span", null, c.value.label),
|
|
2431
|
-
Z(
|
|
2432
|
+
Z(Ln, c.value.label, 15, 1.75),
|
|
2432
2433
|
B("button", {
|
|
2433
2434
|
type: "submit",
|
|
2434
2435
|
title: c.value.apply,
|
|
2435
2436
|
"aria-label": c.value.apply,
|
|
2436
2437
|
disabled: !s.value,
|
|
2437
2438
|
"data-testid": "markweave-math-editor-apply"
|
|
2438
|
-
}, [Z(
|
|
2439
|
+
}, [Z(Nn, c.value.apply, 16, 2)])
|
|
2439
2440
|
]),
|
|
2440
2441
|
B("label", {
|
|
2441
2442
|
class: "markweave-math-block-source",
|
|
@@ -2458,7 +2459,7 @@ var Br = J({
|
|
|
2458
2459
|
]);
|
|
2459
2460
|
};
|
|
2460
2461
|
}
|
|
2461
|
-
}),
|
|
2462
|
+
}), Jr = J({
|
|
2462
2463
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2463
2464
|
props: {
|
|
2464
2465
|
commands: {
|
|
@@ -2523,7 +2524,7 @@ var Br = J({
|
|
|
2523
2524
|
r.value = e.messages.slash.uploadRequiredError;
|
|
2524
2525
|
return;
|
|
2525
2526
|
}
|
|
2526
|
-
let a = await
|
|
2527
|
+
let a = await F(i, e.onUpload);
|
|
2527
2528
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2528
2529
|
} catch (t) {
|
|
2529
2530
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -2644,7 +2645,7 @@ var Br = J({
|
|
|
2644
2645
|
class: "markweave-slash-group",
|
|
2645
2646
|
"aria-label": t.group
|
|
2646
2647
|
}, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
2647
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
2648
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = jt(t);
|
|
2648
2649
|
return B("button", {
|
|
2649
2650
|
key: t.id,
|
|
2650
2651
|
type: "button",
|
|
@@ -2667,7 +2668,7 @@ var Br = J({
|
|
|
2667
2668
|
}
|
|
2668
2669
|
}
|
|
2669
2670
|
}, [
|
|
2670
|
-
|
|
2671
|
+
Ur(t.icon),
|
|
2671
2672
|
B("span", null, t.label),
|
|
2672
2673
|
t.disabledReason ? B("small", null, t.disabledReason) : null
|
|
2673
2674
|
]);
|
|
@@ -2678,7 +2679,7 @@ var Br = J({
|
|
|
2678
2679
|
}, e.messages.slash.noResults)])]);
|
|
2679
2680
|
};
|
|
2680
2681
|
}
|
|
2681
|
-
}),
|
|
2682
|
+
}), Yr = J({
|
|
2682
2683
|
name: "MarkweaveVueTableControls",
|
|
2683
2684
|
props: {
|
|
2684
2685
|
editor: {
|
|
@@ -2711,12 +2712,12 @@ var Br = J({
|
|
|
2711
2712
|
}
|
|
2712
2713
|
},
|
|
2713
2714
|
setup(e) {
|
|
2714
|
-
let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ?
|
|
2715
|
+
let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ? Ht(e.editor.state) : Fr), h = U(() => en(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => en(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Qt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? an(e.editor, t.value) : []), b = () => {
|
|
2715
2716
|
p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
|
|
2716
2717
|
}, x = (e) => {
|
|
2717
2718
|
b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
|
|
2718
2719
|
s.value = null, p = null;
|
|
2719
|
-
},
|
|
2720
|
+
}, ln));
|
|
2720
2721
|
}, S = () => {
|
|
2721
2722
|
if (!e.active) {
|
|
2722
2723
|
r.value = null, i.value = null, a.value = null, x(null);
|
|
@@ -2727,16 +2728,16 @@ var Br = J({
|
|
|
2727
2728
|
r.value = null, i.value = null, a.value = null;
|
|
2728
2729
|
return;
|
|
2729
2730
|
}
|
|
2730
|
-
let s = o.getBoundingClientRect(), c = h.value ?
|
|
2731
|
-
c ? r.value =
|
|
2731
|
+
let s = o.getBoundingClientRect(), c = h.value ? $t(e.editor, h.value) : null, l = g.value ? $t(e.editor, g.value) : null, u = v.value ? on(e.editor) : null;
|
|
2732
|
+
c ? r.value = qt({
|
|
2732
2733
|
targetRect: c,
|
|
2733
2734
|
frameRect: s,
|
|
2734
2735
|
kind: "row"
|
|
2735
|
-
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value =
|
|
2736
|
+
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = qt({
|
|
2736
2737
|
targetRect: l,
|
|
2737
2738
|
frameRect: s,
|
|
2738
2739
|
kind: "column"
|
|
2739
|
-
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value =
|
|
2740
|
+
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = qt({
|
|
2740
2741
|
targetRect: u,
|
|
2741
2742
|
frameRect: s,
|
|
2742
2743
|
kind: "selection"
|
|
@@ -2751,13 +2752,13 @@ var Br = J({
|
|
|
2751
2752
|
o.value = null;
|
|
2752
2753
|
return;
|
|
2753
2754
|
}
|
|
2754
|
-
let a = i.getBoundingClientRect(), s = t.value === "row" ?
|
|
2755
|
+
let a = i.getBoundingClientRect(), s = t.value === "row" ? Zt(e.editor)?.getBoundingClientRect() : null, c = s ? {
|
|
2755
2756
|
left: a.left,
|
|
2756
2757
|
top: s.top,
|
|
2757
2758
|
width: a.width,
|
|
2758
2759
|
height: a.height
|
|
2759
2760
|
} : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
|
|
2760
|
-
o.value =
|
|
2761
|
+
o.value = Kt({
|
|
2761
2762
|
anchorRect: c,
|
|
2762
2763
|
frameRect: p,
|
|
2763
2764
|
menuSize: {
|
|
@@ -2774,16 +2775,16 @@ var Br = J({
|
|
|
2774
2775
|
let i = t.value === e && n.value === r;
|
|
2775
2776
|
n.value = r, t.value = i ? null : e, T();
|
|
2776
2777
|
}, ee = () => {
|
|
2777
|
-
e.editor.view.dispatch(
|
|
2778
|
+
e.editor.view.dispatch(zt(e.editor.state.tr, null));
|
|
2778
2779
|
}, D = (t, n) => {
|
|
2779
2780
|
let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
2780
|
-
r !== null &&
|
|
2781
|
+
r !== null && cn(e.editor, r, t, { visualIndex: i }), E(t, n);
|
|
2781
2782
|
}, O = () => {
|
|
2782
2783
|
ee(), E("selection", "selection-edge");
|
|
2783
2784
|
}, k = (n = !1) => {
|
|
2784
2785
|
t.value = null, o.value = null, n && e.editor.view.focus();
|
|
2785
2786
|
}, A = async (n, r) => {
|
|
2786
|
-
let i = await
|
|
2787
|
+
let i = await Yt({
|
|
2787
2788
|
editor: e.editor,
|
|
2788
2789
|
commandId: n,
|
|
2789
2790
|
menu: r ?? t.value ?? "selection",
|
|
@@ -2791,7 +2792,7 @@ var Br = J({
|
|
|
2791
2792
|
});
|
|
2792
2793
|
return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
2793
2794
|
}, j = (t) => {
|
|
2794
|
-
let n =
|
|
2795
|
+
let n = tn(e.editor, t);
|
|
2795
2796
|
n && e.onEditWithAi?.(n), k(!0);
|
|
2796
2797
|
}, M = (e) => {
|
|
2797
2798
|
!t.value || e.key !== "Escape" || k(!0);
|
|
@@ -2817,7 +2818,7 @@ var Br = J({
|
|
|
2817
2818
|
ref: f,
|
|
2818
2819
|
class: "markweave-table-menu",
|
|
2819
2820
|
role: "menu",
|
|
2820
|
-
"aria-label":
|
|
2821
|
+
"aria-label": un(t.value, e.messages),
|
|
2821
2822
|
"data-testid": "markweave-table-menu",
|
|
2822
2823
|
"data-positioned": o.value ? "true" : "false",
|
|
2823
2824
|
style: o.value ? {
|
|
@@ -2825,7 +2826,7 @@ var Br = J({
|
|
|
2825
2826
|
top: `${o.value.top}px`
|
|
2826
2827
|
} : void 0
|
|
2827
2828
|
}, y.value.map((n, r) => {
|
|
2828
|
-
let i =
|
|
2829
|
+
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);
|
|
2829
2830
|
return B("button", {
|
|
2830
2831
|
key: `${n.id}-${r}`,
|
|
2831
2832
|
type: "button",
|
|
@@ -2865,7 +2866,7 @@ var Br = J({
|
|
|
2865
2866
|
"data-copy-kind": s.value.kind,
|
|
2866
2867
|
"data-text-length": s.value.textLength,
|
|
2867
2868
|
"data-html-length": s.value.htmlLength
|
|
2868
|
-
},
|
|
2869
|
+
}, Xt(s.value)) : null,
|
|
2869
2870
|
r.value ? B("button", {
|
|
2870
2871
|
ref: l,
|
|
2871
2872
|
type: "button",
|
|
@@ -2925,7 +2926,7 @@ var Br = J({
|
|
|
2925
2926
|
P()
|
|
2926
2927
|
]) : null;
|
|
2927
2928
|
}
|
|
2928
|
-
}),
|
|
2929
|
+
}), Xr = J({
|
|
2929
2930
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
2930
2931
|
props: {
|
|
2931
2932
|
editor: {
|
|
@@ -2943,7 +2944,7 @@ var Br = J({
|
|
|
2943
2944
|
t.value = null;
|
|
2944
2945
|
return;
|
|
2945
2946
|
}
|
|
2946
|
-
t.value =
|
|
2947
|
+
t.value = sn(e.editor, Ut(e.editor.state));
|
|
2947
2948
|
};
|
|
2948
2949
|
return G(() => {
|
|
2949
2950
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
@@ -2981,7 +2982,7 @@ var Br = J({
|
|
|
2981
2982
|
}) : null;
|
|
2982
2983
|
};
|
|
2983
2984
|
}
|
|
2984
|
-
}),
|
|
2985
|
+
}), Zr = J({
|
|
2985
2986
|
name: "MarkweaveVueCodeBlockControls",
|
|
2986
2987
|
props: {
|
|
2987
2988
|
editor: {
|
|
@@ -3010,190 +3011,224 @@ var Br = J({
|
|
|
3010
3011
|
}
|
|
3011
3012
|
},
|
|
3012
3013
|
setup(e) {
|
|
3013
|
-
let t = V(null), n = V(null), r = V(null), i = V(null), a = V(null), o = V(
|
|
3014
|
+
let t = V(null), n = V(null), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V([]), l = V(null), u = V(!1), d = V(""), f = V(-1), p = V(null), m = V(!1), h = V(null), g = V(null), _ = V(!1), v = V({
|
|
3014
3015
|
active: !1,
|
|
3015
3016
|
lastX: 0,
|
|
3016
3017
|
lastY: 0
|
|
3017
|
-
}),
|
|
3018
|
+
}), y = V(0), b = V(0), x = V(0), S = null, C = U(() => (x.value, tt(e.editor, o.value))), w = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
3018
3019
|
...e.state,
|
|
3019
3020
|
pos: e.state.pos,
|
|
3020
3021
|
active: !0
|
|
3021
|
-
} : null),
|
|
3022
|
-
|
|
3023
|
-
},
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
},
|
|
3027
|
-
},
|
|
3028
|
-
|
|
3022
|
+
} : null), T = U(() => C.value ?? w.value), E = U(() => T.value !== null), ee = U(() => T.value?.language === "mermaid"), D = U(() => ot(e.editor, T.value)), O = U(() => E.value && T.value !== null && !D.value), k = U(() => !e.readOnly), A = U(() => T.value ? Je(T.value.language) : Je("text")), j = U(() => p.value?.status ?? "idle"), M = U(() => T.value?.mermaidPreviewMode ?? e.mermaidMode), N = U(() => ee.value && M.value === "preview"), P = U(() => (x.value, y.value, b.value, it(e.editor))), te = U(() => `${b.value}|${P.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), F = U(() => Qe(d.value)), ne = U(() => T.value ? `${T.value.pos}:${T.value.language}:${T.value.text}` : "none"), re = () => {
|
|
3023
|
+
S !== null && (window.clearTimeout(S), S = null);
|
|
3024
|
+
}, ae = (e) => {
|
|
3025
|
+
re(), p.value = e, e && (S = window.setTimeout(() => {
|
|
3026
|
+
p.value = null, S = null;
|
|
3027
|
+
}, Ve));
|
|
3028
|
+
}, oe = () => {
|
|
3029
|
+
h.value = null, g.value = null, _.value = !1, v.value = {
|
|
3029
3030
|
active: !1,
|
|
3030
3031
|
lastX: 0,
|
|
3031
3032
|
lastY: 0
|
|
3032
3033
|
}, e.editor.view.focus();
|
|
3033
|
-
},
|
|
3034
|
+
}, I = () => {
|
|
3034
3035
|
let n = t.value;
|
|
3035
3036
|
if (!n) return;
|
|
3036
|
-
if (
|
|
3037
|
-
|
|
3037
|
+
if (!nt(n) || P.value.length === 0) {
|
|
3038
|
+
c.value = [];
|
|
3038
3039
|
return;
|
|
3039
3040
|
}
|
|
3040
|
-
let r = n.getBoundingClientRect(), i =
|
|
3041
|
-
let n =
|
|
3042
|
-
return n ? [
|
|
3041
|
+
let r = n.getBoundingClientRect(), i = P.value.flatMap((t) => {
|
|
3042
|
+
let n = Ze(Xe(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
3043
|
+
return n ? [Ke(t, n, r)] : [];
|
|
3043
3044
|
});
|
|
3044
|
-
|
|
3045
|
-
},
|
|
3046
|
-
if (!
|
|
3047
|
-
|
|
3045
|
+
c.value = st(c.value, i, P.value.map((e) => e.pos));
|
|
3046
|
+
}, L = () => {
|
|
3047
|
+
if (!O.value || !T.value) {
|
|
3048
|
+
s.value = null, l.value = null;
|
|
3048
3049
|
return;
|
|
3049
3050
|
}
|
|
3050
3051
|
let r = t.value;
|
|
3051
3052
|
if (!r) return;
|
|
3052
|
-
let i =
|
|
3053
|
-
if (!
|
|
3054
|
-
|
|
3053
|
+
let i = Xe(e.editor, T.value.pos, M.value), a = r.getBoundingClientRect(), o = Ze(i, a);
|
|
3054
|
+
if (!o) {
|
|
3055
|
+
s.value = s.value?.pos === T.value.pos ? s.value : null, l.value = u.value ? l.value : null;
|
|
3055
3056
|
return;
|
|
3056
3057
|
}
|
|
3057
|
-
if (
|
|
3058
|
+
if (s.value = We(T.value.pos, o, a), u.value && n.value) {
|
|
3058
3059
|
let e = n.value.getBoundingClientRect();
|
|
3059
|
-
|
|
3060
|
-
overlayRect:
|
|
3060
|
+
l.value = ze({
|
|
3061
|
+
overlayRect: a,
|
|
3061
3062
|
buttonRect: e,
|
|
3062
3063
|
windowWidth: window.innerWidth,
|
|
3063
3064
|
windowHeight: window.innerHeight
|
|
3064
3065
|
});
|
|
3065
3066
|
}
|
|
3066
|
-
},
|
|
3067
|
+
}, se = async () => {
|
|
3067
3068
|
if (e.readOnly) {
|
|
3068
|
-
if (!
|
|
3069
|
-
let e = await
|
|
3070
|
-
|
|
3069
|
+
if (!T.value) return;
|
|
3070
|
+
let e = await He(T.value.text);
|
|
3071
|
+
ae(Pe(T.value, e ? "copied" : "failed"));
|
|
3071
3072
|
return;
|
|
3072
3073
|
}
|
|
3073
|
-
if (!
|
|
3074
|
-
let t = await
|
|
3075
|
-
|
|
3076
|
-
},
|
|
3074
|
+
if (!qe(e.editor, T.value)) return;
|
|
3075
|
+
let t = await Me(e.editor);
|
|
3076
|
+
ae(Pe(Ne(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
3077
|
+
}, ce = (t, n) => {
|
|
3077
3078
|
if (e.readOnly) {
|
|
3078
|
-
|
|
3079
|
+
Ot(e.editor, t.pos, n) && (b.value += 1, x.value += 1);
|
|
3079
3080
|
return;
|
|
3080
3081
|
}
|
|
3081
3082
|
let r = e.state.active && e.state.pos === t.pos;
|
|
3082
|
-
|
|
3083
|
-
},
|
|
3084
|
-
if (e.readOnly || !
|
|
3085
|
-
let n = e.state.active && e.state.pos ===
|
|
3086
|
-
|
|
3087
|
-
},
|
|
3088
|
-
|
|
3089
|
-
},
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3083
|
+
Re(e.editor, t.pos, n) && (e.onMermaidModeChange(n), x.value += 1, r && e.editor.view.focus());
|
|
3084
|
+
}, le = (t) => {
|
|
3085
|
+
if (e.readOnly || !T.value) return;
|
|
3086
|
+
let n = e.state.active && e.state.pos === T.value.pos;
|
|
3087
|
+
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
|
+
}, ue = () => {
|
|
3089
|
+
u.value = !u.value, u.value && a.value === null && (a.value = Ue()), f.value = u.value ? rt(F.value, T.value?.language ?? null) : -1;
|
|
3090
|
+
}, R = (e) => {
|
|
3091
|
+
let t = Qe(e);
|
|
3092
|
+
d.value = e, f.value = rt(t, e.trim() ? null : T.value?.language ?? null);
|
|
3093
|
+
}, de = (t) => {
|
|
3094
|
+
if (!t.isComposing) {
|
|
3095
|
+
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
3096
|
+
t.preventDefault(), f.value = lt(f.value, F.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
3097
|
+
return;
|
|
3098
|
+
}
|
|
3099
|
+
if (t.key === "Enter") {
|
|
3100
|
+
let e = F.value[f.value];
|
|
3101
|
+
e && (t.preventDefault(), le(e.language));
|
|
3102
|
+
return;
|
|
3103
|
+
}
|
|
3104
|
+
t.key === "Escape" && (t.preventDefault(), u.value = !1, f.value = -1, e.editor.view.focus());
|
|
3105
|
+
}
|
|
3106
|
+
}, fe = () => {
|
|
3107
|
+
e.readOnly || !T.value || Ie(e.editor, T.value.pos, !D.value) && (y.value += 1, x.value += 1, o.value = null);
|
|
3108
|
+
}, pe = () => {
|
|
3109
|
+
if (!T.value) return;
|
|
3110
|
+
let t = at(e.editor, T.value.pos);
|
|
3111
|
+
t && ie({
|
|
3112
|
+
data: new Blob([t], { type: "image/svg+xml" }),
|
|
3113
|
+
fileName: "markweave-mermaid.svg",
|
|
3114
|
+
onSettled: () => e.editor.view.focus(),
|
|
3115
|
+
ownerDocument: document
|
|
3116
|
+
});
|
|
3117
|
+
}, me = () => {
|
|
3118
|
+
if (!T.value) return;
|
|
3119
|
+
let t = at(e.editor, T.value.pos);
|
|
3120
|
+
t && (h.value = Ge(t), g.value = null, _.value = !1, v.value = {
|
|
3099
3121
|
active: !1,
|
|
3100
3122
|
lastX: 0,
|
|
3101
3123
|
lastY: 0
|
|
3102
3124
|
});
|
|
3103
|
-
},
|
|
3104
|
-
|
|
3105
|
-
...
|
|
3106
|
-
scale:
|
|
3125
|
+
}, he = (e) => {
|
|
3126
|
+
h.value = h.value ? {
|
|
3127
|
+
...h.value,
|
|
3128
|
+
scale: Be(h.value.scale + e)
|
|
3107
3129
|
} : null;
|
|
3108
|
-
},
|
|
3109
|
-
|
|
3130
|
+
}, ge = () => {
|
|
3131
|
+
h.value = h.value ? Ge(h.value.svg) : null, v.value = {
|
|
3110
3132
|
active: !1,
|
|
3111
3133
|
lastX: 0,
|
|
3112
3134
|
lastY: 0
|
|
3113
|
-
},
|
|
3114
|
-
},
|
|
3115
|
-
e.preventDefault(),
|
|
3116
|
-
},
|
|
3117
|
-
e.button === 0 && (e.preventDefault(),
|
|
3135
|
+
}, _.value = !1;
|
|
3136
|
+
}, _e = (e) => {
|
|
3137
|
+
e.preventDefault(), he(e.deltaY < 0 ? ct : -ct);
|
|
3138
|
+
}, ve = (e) => {
|
|
3139
|
+
e.button === 0 && (e.preventDefault(), v.value = {
|
|
3118
3140
|
active: !0,
|
|
3119
3141
|
lastX: e.clientX,
|
|
3120
3142
|
lastY: e.clientY
|
|
3121
|
-
},
|
|
3122
|
-
},
|
|
3123
|
-
let t =
|
|
3143
|
+
}, _.value = !0);
|
|
3144
|
+
}, ye = (e) => {
|
|
3145
|
+
let t = v.value;
|
|
3124
3146
|
if (!t.active) return;
|
|
3125
3147
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
3126
|
-
|
|
3148
|
+
v.value = {
|
|
3127
3149
|
active: !0,
|
|
3128
3150
|
lastX: e.clientX,
|
|
3129
3151
|
lastY: e.clientY
|
|
3130
|
-
},
|
|
3131
|
-
},
|
|
3132
|
-
|
|
3152
|
+
}, h.value = ut(h.value, n, r);
|
|
3153
|
+
}, be = () => {
|
|
3154
|
+
v.value = {
|
|
3133
3155
|
active: !1,
|
|
3134
3156
|
lastX: 0,
|
|
3135
3157
|
lastY: 0
|
|
3136
|
-
},
|
|
3158
|
+
}, _.value = !1;
|
|
3137
3159
|
};
|
|
3138
3160
|
W(() => e.readOnly, (e) => {
|
|
3139
|
-
e && (
|
|
3140
|
-
}), W(
|
|
3141
|
-
|
|
3142
|
-
}), W(
|
|
3143
|
-
|
|
3161
|
+
e && (u.value = !1, d.value = "");
|
|
3162
|
+
}), W(ne, () => {
|
|
3163
|
+
ae(null), u.value = !1, d.value = "", f.value = -1, h.value = null, g.value = null, _.value = !1;
|
|
3164
|
+
}), W(u, async (e) => {
|
|
3165
|
+
if (!e) {
|
|
3166
|
+
f.value = -1;
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3169
|
+
await q(), L(), r.value?.focus({ preventScroll: !0 });
|
|
3144
3170
|
}), W(() => [
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3171
|
+
u.value,
|
|
3172
|
+
d.value,
|
|
3173
|
+
f.value
|
|
3174
|
+
], async () => {
|
|
3175
|
+
if (!u.value || f.value < 0) return;
|
|
3176
|
+
await q();
|
|
3177
|
+
let e = i.value, t = e?.querySelector(`[data-language-index="${f.value}"]`);
|
|
3178
|
+
e && t && dt(e, t);
|
|
3179
|
+
}, { flush: "post" }), W(() => [
|
|
3180
|
+
O.value,
|
|
3181
|
+
y.value,
|
|
3182
|
+
T.value?.pos ?? null,
|
|
3183
|
+
u.value,
|
|
3184
|
+
M.value
|
|
3150
3185
|
], async () => {
|
|
3151
|
-
await q(),
|
|
3186
|
+
await q(), L();
|
|
3152
3187
|
}, {
|
|
3153
3188
|
flush: "post",
|
|
3154
3189
|
immediate: !0
|
|
3155
|
-
}), W(
|
|
3156
|
-
await q(),
|
|
3190
|
+
}), W(te, async () => {
|
|
3191
|
+
await q(), I(), window.requestAnimationFrame(I);
|
|
3157
3192
|
}, {
|
|
3158
3193
|
flush: "post",
|
|
3159
3194
|
immediate: !0
|
|
3160
3195
|
});
|
|
3161
|
-
let
|
|
3196
|
+
let z = null;
|
|
3162
3197
|
return G(() => {
|
|
3163
3198
|
q(() => {
|
|
3164
3199
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
3165
|
-
if (n.target instanceof Node && t.value?.contains(n.target) ||
|
|
3166
|
-
let r =
|
|
3167
|
-
|
|
3168
|
-
},
|
|
3169
|
-
|
|
3170
|
-
},
|
|
3200
|
+
if (n.target instanceof Node && t.value?.contains(n.target) || u.value) return;
|
|
3201
|
+
let r = et(e.editor, n.target), i = tt(e.editor, r), a = i && !ot(e.editor, i) ? i.pos : null;
|
|
3202
|
+
o.value = o.value === a ? o.value : a;
|
|
3203
|
+
}, i = () => {
|
|
3204
|
+
u.value || (o.value = null);
|
|
3205
|
+
}, a = (t) => {
|
|
3171
3206
|
if (t.key === "Escape") {
|
|
3172
|
-
if (
|
|
3173
|
-
|
|
3207
|
+
if (h.value) {
|
|
3208
|
+
oe();
|
|
3174
3209
|
return;
|
|
3175
3210
|
}
|
|
3176
|
-
|
|
3211
|
+
u.value && (u.value = !1, f.value = -1, e.editor.view.focus());
|
|
3177
3212
|
}
|
|
3178
3213
|
}, s = (e) => {
|
|
3179
|
-
|
|
3180
|
-
},
|
|
3181
|
-
e.getMeta(
|
|
3214
|
+
u.value && (e.target instanceof Node && t.value?.contains(e.target) || (u.value = !1, f.value = -1));
|
|
3215
|
+
}, c = ({ transaction: e }) => {
|
|
3216
|
+
e.getMeta(je) && (y.value += 1), (e.docChanged || e.selectionSet || e.getMeta(je) || Tt(e)) && (x.value += 1);
|
|
3182
3217
|
};
|
|
3183
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave",
|
|
3184
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave",
|
|
3218
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", L), window.addEventListener("scroll", L, !0), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", s), e.editor.on("transaction", c), z = () => {
|
|
3219
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", L), window.removeEventListener("scroll", L, !0), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", s), e.editor.off("transaction", c), re();
|
|
3185
3220
|
};
|
|
3186
3221
|
});
|
|
3187
3222
|
}), K(() => {
|
|
3188
|
-
|
|
3223
|
+
z?.(), z = null, re();
|
|
3189
3224
|
}), () => {
|
|
3190
|
-
if (!
|
|
3191
|
-
let
|
|
3192
|
-
top: `${
|
|
3193
|
-
right: `${
|
|
3194
|
-
} : void 0,
|
|
3195
|
-
left: `${
|
|
3196
|
-
top: `${
|
|
3225
|
+
if (!O.value && P.value.length === 0 && !h.value) return null;
|
|
3226
|
+
let o = s.value ? {
|
|
3227
|
+
top: `${s.value.top}px`,
|
|
3228
|
+
right: `${s.value.right}px`
|
|
3229
|
+
} : void 0, p = l.value ? {
|
|
3230
|
+
left: `${l.value.left}px`,
|
|
3231
|
+
top: `${l.value.top}px`
|
|
3197
3232
|
} : void 0;
|
|
3198
3233
|
return B("div", {
|
|
3199
3234
|
ref: t,
|
|
@@ -3201,8 +3236,8 @@ var Br = J({
|
|
|
3201
3236
|
"data-testid": "markweave-codeblock-overlay",
|
|
3202
3237
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
3203
3238
|
}, [
|
|
3204
|
-
...
|
|
3205
|
-
let t =
|
|
3239
|
+
...P.value.map((e) => {
|
|
3240
|
+
let t = c.value.find((t) => t.pos === e.pos);
|
|
3206
3241
|
return B("div", {
|
|
3207
3242
|
key: e.pos,
|
|
3208
3243
|
class: "markweave-mermaid-tabs",
|
|
@@ -3219,73 +3254,71 @@ var Br = J({
|
|
|
3219
3254
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
3220
3255
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
3221
3256
|
onMousedown: $,
|
|
3222
|
-
onClick: () =>
|
|
3257
|
+
onClick: () => ce(e, t)
|
|
3223
3258
|
}, t === "code" ? "Code" : "Preview")));
|
|
3224
3259
|
}),
|
|
3225
|
-
|
|
3260
|
+
O.value && T.value ? B("div", {
|
|
3226
3261
|
class: "markweave-codeblock-controls",
|
|
3227
3262
|
"data-testid": "markweave-codeblock-controls",
|
|
3228
|
-
"data-positioned":
|
|
3229
|
-
"data-collapsed":
|
|
3263
|
+
"data-positioned": s.value ? "true" : "false",
|
|
3264
|
+
"data-collapsed": D.value ? "true" : "false",
|
|
3230
3265
|
"data-read-only": e.readOnly ? "true" : "false",
|
|
3231
3266
|
"aria-label": "Code block controls",
|
|
3232
|
-
style:
|
|
3267
|
+
style: o
|
|
3233
3268
|
}, [
|
|
3234
3269
|
e.readOnly ? B("span", {
|
|
3235
3270
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
3236
3271
|
"aria-label": "Code block language",
|
|
3237
3272
|
"data-testid": "markweave-codeblock-language"
|
|
3238
|
-
}, [B("span", null,
|
|
3273
|
+
}, [B("span", null, A.value)]) : B("button", {
|
|
3239
3274
|
ref: n,
|
|
3240
3275
|
type: "button",
|
|
3241
3276
|
class: "markweave-codeblock-language-button",
|
|
3242
3277
|
"aria-label": "Code block language",
|
|
3243
|
-
"aria-expanded":
|
|
3278
|
+
"aria-expanded": u.value ? "true" : "false",
|
|
3244
3279
|
"aria-haspopup": "listbox",
|
|
3245
3280
|
"data-testid": "markweave-codeblock-language",
|
|
3246
3281
|
onMousedown: $,
|
|
3247
|
-
onClick:
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
}, [B("span", null, D.value), Q("chevron")]),
|
|
3251
|
-
ee.value ? B("button", {
|
|
3282
|
+
onClick: ue
|
|
3283
|
+
}, [B("span", null, A.value), Q("chevron")]),
|
|
3284
|
+
k.value ? B("button", {
|
|
3252
3285
|
type: "button",
|
|
3253
3286
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
3254
|
-
"aria-label":
|
|
3255
|
-
title:
|
|
3287
|
+
"aria-label": D.value ? "Expand code block" : "Collapse code block",
|
|
3288
|
+
title: D.value ? "Expand code block" : "Collapse code block",
|
|
3256
3289
|
"data-testid": "markweave-codeblock-collapse",
|
|
3257
|
-
"data-collapsed":
|
|
3290
|
+
"data-collapsed": D.value ? "true" : "false",
|
|
3258
3291
|
onMousedown: $,
|
|
3259
|
-
onClick:
|
|
3292
|
+
onClick: fe
|
|
3260
3293
|
}, [Q("chevron")]) : null,
|
|
3261
3294
|
B("span", { class: "markweave-codeblock-copy-wrap" }, [B("button", {
|
|
3262
3295
|
type: "button",
|
|
3263
3296
|
class: "markweave-codeblock-icon-button",
|
|
3264
3297
|
"aria-label": "Copy to clipboard",
|
|
3265
3298
|
"data-testid": "markweave-codeblock-copy",
|
|
3266
|
-
"data-copy-state":
|
|
3299
|
+
"data-copy-state": j.value,
|
|
3267
3300
|
onMousedown: $,
|
|
3268
3301
|
onMouseenter: () => {
|
|
3269
|
-
|
|
3302
|
+
m.value = !0;
|
|
3270
3303
|
},
|
|
3271
3304
|
onMouseleave: () => {
|
|
3272
|
-
|
|
3305
|
+
m.value = !1;
|
|
3273
3306
|
},
|
|
3274
3307
|
onFocus: () => {
|
|
3275
|
-
|
|
3308
|
+
m.value = !0;
|
|
3276
3309
|
},
|
|
3277
3310
|
onBlur: () => {
|
|
3278
|
-
|
|
3311
|
+
m.value = !1;
|
|
3279
3312
|
},
|
|
3280
3313
|
onClick: () => {
|
|
3281
|
-
|
|
3314
|
+
se();
|
|
3282
3315
|
}
|
|
3283
|
-
}, [Q(
|
|
3316
|
+
}, [Q(j.value === "copied" ? "check" : "clipboard")]), m.value ? B("span", {
|
|
3284
3317
|
class: "markweave-codeblock-tooltip",
|
|
3285
3318
|
role: "tooltip",
|
|
3286
3319
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
3287
3320
|
}, "Copy to clipboard") : null]),
|
|
3288
|
-
|
|
3321
|
+
ee.value && M.value === "preview" ? B("div", {
|
|
3289
3322
|
class: "markweave-mermaid-preview-actions",
|
|
3290
3323
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
3291
3324
|
}, [B("button", {
|
|
@@ -3293,51 +3326,65 @@ var Br = J({
|
|
|
3293
3326
|
class: "markweave-codeblock-icon-button",
|
|
3294
3327
|
"aria-label": "Fullscreen Mermaid preview",
|
|
3295
3328
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
3296
|
-
disabled: !
|
|
3329
|
+
disabled: !N.value,
|
|
3297
3330
|
onMousedown: $,
|
|
3298
|
-
onClick:
|
|
3331
|
+
onClick: me
|
|
3299
3332
|
}, [Q("expand")]), B("button", {
|
|
3300
3333
|
type: "button",
|
|
3301
3334
|
class: "markweave-codeblock-icon-button",
|
|
3302
3335
|
"aria-label": "Download Mermaid SVG",
|
|
3303
3336
|
"data-testid": "markweave-mermaid-download",
|
|
3304
|
-
disabled: !
|
|
3337
|
+
disabled: !N.value,
|
|
3305
3338
|
onMousedown: $,
|
|
3306
|
-
onClick:
|
|
3339
|
+
onClick: pe
|
|
3307
3340
|
}, [Q("download")])]) : null
|
|
3308
3341
|
]) : null,
|
|
3309
|
-
|
|
3342
|
+
k.value && O.value && u.value && T.value ? B("div", {
|
|
3310
3343
|
class: "markweave-codeblock-language-menu",
|
|
3311
|
-
role: "listbox",
|
|
3312
|
-
"aria-label": "Code block languages",
|
|
3313
3344
|
"data-testid": "markweave-codeblock-language-menu",
|
|
3314
|
-
"data-positioned":
|
|
3315
|
-
style:
|
|
3345
|
+
"data-positioned": l.value ? "true" : "false",
|
|
3346
|
+
style: p
|
|
3316
3347
|
}, [B("label", { class: "markweave-codeblock-language-search" }, [B("input", {
|
|
3317
3348
|
ref: r,
|
|
3318
|
-
|
|
3349
|
+
role: "combobox",
|
|
3350
|
+
"aria-autocomplete": "list",
|
|
3351
|
+
"aria-controls": a.value ?? void 0,
|
|
3352
|
+
"aria-expanded": "true",
|
|
3353
|
+
"aria-activedescendant": a.value && F.value[f.value] ? $e(a.value, F.value[f.value].language) : void 0,
|
|
3354
|
+
"aria-label": "Search code block languages",
|
|
3355
|
+
value: d.value,
|
|
3319
3356
|
placeholder: "Search...",
|
|
3320
3357
|
"data-testid": "markweave-codeblock-language-search",
|
|
3321
3358
|
onInput: (e) => {
|
|
3322
|
-
|
|
3359
|
+
R(e.target.value);
|
|
3323
3360
|
},
|
|
3324
|
-
onKeydown:
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3361
|
+
onKeydown: de
|
|
3362
|
+
}), Q("search")]), B("div", {
|
|
3363
|
+
ref: i,
|
|
3364
|
+
id: a.value ?? void 0,
|
|
3365
|
+
class: "markweave-codeblock-language-list",
|
|
3366
|
+
role: "listbox",
|
|
3367
|
+
"aria-label": "Code block languages"
|
|
3368
|
+
}, F.value.map((e, t) => {
|
|
3369
|
+
let n = T.value?.language === e.language, r = t === f.value;
|
|
3329
3370
|
return B("button", {
|
|
3330
3371
|
key: e.language,
|
|
3372
|
+
id: a.value ? $e(a.value, e.language) : void 0,
|
|
3331
3373
|
type: "button",
|
|
3332
3374
|
role: "option",
|
|
3333
|
-
"aria-selected":
|
|
3375
|
+
"aria-selected": n ? "true" : "false",
|
|
3334
3376
|
"data-testid": `markweave-codeblock-language-option-${e.language}`,
|
|
3335
|
-
"data-active":
|
|
3377
|
+
"data-active": n ? "true" : "false",
|
|
3378
|
+
"data-highlighted": r ? "true" : "false",
|
|
3379
|
+
"data-language-index": t,
|
|
3336
3380
|
onMousedown: $,
|
|
3337
|
-
|
|
3338
|
-
|
|
3381
|
+
onMouseenter: () => {
|
|
3382
|
+
f.value = t;
|
|
3383
|
+
},
|
|
3384
|
+
onClick: () => le(e.language)
|
|
3385
|
+
}, [B("span", null, e.label), n ? Q("check") : null]);
|
|
3339
3386
|
}))]) : null,
|
|
3340
|
-
|
|
3387
|
+
h.value ? B("div", {
|
|
3341
3388
|
class: "markweave-mermaid-fullscreen-layer",
|
|
3342
3389
|
role: "dialog",
|
|
3343
3390
|
"aria-modal": "true",
|
|
@@ -3354,41 +3401,41 @@ var Br = J({
|
|
|
3354
3401
|
"aria-label": "Zoom out",
|
|
3355
3402
|
"data-testid": "markweave-mermaid-fullscreen-zoom-out",
|
|
3356
3403
|
onMouseenter: () => {
|
|
3357
|
-
|
|
3404
|
+
g.value = "zoom-out";
|
|
3358
3405
|
},
|
|
3359
3406
|
onMouseleave: () => {
|
|
3360
|
-
|
|
3407
|
+
g.value = null;
|
|
3361
3408
|
},
|
|
3362
3409
|
onFocus: () => {
|
|
3363
|
-
|
|
3410
|
+
g.value = "zoom-out";
|
|
3364
3411
|
},
|
|
3365
3412
|
onBlur: () => {
|
|
3366
|
-
|
|
3413
|
+
g.value = null;
|
|
3367
3414
|
},
|
|
3368
|
-
onClick: () =>
|
|
3415
|
+
onClick: () => he(-ct)
|
|
3369
3416
|
}, [Q("zoomOut")]),
|
|
3370
3417
|
B("span", {
|
|
3371
3418
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3372
3419
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3373
|
-
},
|
|
3420
|
+
}, Ye(h.value.scale)),
|
|
3374
3421
|
B("button", {
|
|
3375
3422
|
type: "button",
|
|
3376
3423
|
class: "markweave-mermaid-fullscreen-control",
|
|
3377
3424
|
"aria-label": "Zoom in",
|
|
3378
3425
|
"data-testid": "markweave-mermaid-fullscreen-zoom-in",
|
|
3379
3426
|
onMouseenter: () => {
|
|
3380
|
-
|
|
3427
|
+
g.value = "zoom-in";
|
|
3381
3428
|
},
|
|
3382
3429
|
onMouseleave: () => {
|
|
3383
|
-
|
|
3430
|
+
g.value = null;
|
|
3384
3431
|
},
|
|
3385
3432
|
onFocus: () => {
|
|
3386
|
-
|
|
3433
|
+
g.value = "zoom-in";
|
|
3387
3434
|
},
|
|
3388
3435
|
onBlur: () => {
|
|
3389
|
-
|
|
3436
|
+
g.value = null;
|
|
3390
3437
|
},
|
|
3391
|
-
onClick: () =>
|
|
3438
|
+
onClick: () => he(ct)
|
|
3392
3439
|
}, [Q("zoomIn")]),
|
|
3393
3440
|
B("button", {
|
|
3394
3441
|
type: "button",
|
|
@@ -3396,58 +3443,58 @@ var Br = J({
|
|
|
3396
3443
|
"aria-label": "Reset zoom",
|
|
3397
3444
|
"data-testid": "markweave-mermaid-fullscreen-reset",
|
|
3398
3445
|
onMouseenter: () => {
|
|
3399
|
-
|
|
3446
|
+
g.value = "reset";
|
|
3400
3447
|
},
|
|
3401
3448
|
onMouseleave: () => {
|
|
3402
|
-
|
|
3449
|
+
g.value = null;
|
|
3403
3450
|
},
|
|
3404
3451
|
onFocus: () => {
|
|
3405
|
-
|
|
3452
|
+
g.value = "reset";
|
|
3406
3453
|
},
|
|
3407
3454
|
onBlur: () => {
|
|
3408
|
-
|
|
3455
|
+
g.value = null;
|
|
3409
3456
|
},
|
|
3410
|
-
onClick:
|
|
3457
|
+
onClick: ge
|
|
3411
3458
|
}, [Q("reset")]),
|
|
3412
|
-
|
|
3459
|
+
g.value ? B("span", {
|
|
3413
3460
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
3414
3461
|
role: "tooltip",
|
|
3415
3462
|
"data-testid": "markweave-mermaid-fullscreen-tooltip"
|
|
3416
|
-
},
|
|
3463
|
+
}, g.value === "zoom-out" ? "Zoom out" : g.value === "zoom-in" ? "Zoom in" : "Reset") : null
|
|
3417
3464
|
]),
|
|
3418
3465
|
B("button", {
|
|
3419
3466
|
type: "button",
|
|
3420
3467
|
class: "markweave-mermaid-fullscreen-close",
|
|
3421
3468
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
3422
3469
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3423
|
-
onClick:
|
|
3470
|
+
onClick: oe
|
|
3424
3471
|
}, [Q("close")]),
|
|
3425
3472
|
B("div", {
|
|
3426
3473
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
3427
3474
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
3428
|
-
"data-dragging":
|
|
3429
|
-
onWheel:
|
|
3430
|
-
onMousedown:
|
|
3431
|
-
onMousemove:
|
|
3432
|
-
onMouseup:
|
|
3433
|
-
onMouseleave:
|
|
3475
|
+
"data-dragging": _.value ? "true" : "false",
|
|
3476
|
+
onWheel: _e,
|
|
3477
|
+
onMousedown: ve,
|
|
3478
|
+
onMousemove: ye,
|
|
3479
|
+
onMouseup: be,
|
|
3480
|
+
onMouseleave: be
|
|
3434
3481
|
}, [B("div", {
|
|
3435
3482
|
class: "markweave-mermaid-fullscreen-content",
|
|
3436
3483
|
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
3437
|
-
"data-scale-percent": Math.round(
|
|
3438
|
-
"data-translate": `${Math.round(
|
|
3484
|
+
"data-scale-percent": Math.round(h.value.scale * 100),
|
|
3485
|
+
"data-translate": `${Math.round(h.value.translateX)},${Math.round(h.value.translateY)}`,
|
|
3439
3486
|
style: {
|
|
3440
|
-
width: `${
|
|
3441
|
-
height: `${
|
|
3442
|
-
transform: `translate(${
|
|
3487
|
+
width: `${h.value.width}px`,
|
|
3488
|
+
height: `${h.value.height}px`,
|
|
3489
|
+
transform: `translate(${h.value.translateX}px, ${h.value.translateY}px) scale(${h.value.scale})`
|
|
3443
3490
|
},
|
|
3444
|
-
innerHTML:
|
|
3491
|
+
innerHTML: h.value.svg
|
|
3445
3492
|
})])
|
|
3446
3493
|
]) : null
|
|
3447
3494
|
]);
|
|
3448
3495
|
};
|
|
3449
3496
|
}
|
|
3450
|
-
}),
|
|
3497
|
+
}), Qr = J({
|
|
3451
3498
|
name: "MarkweaveVueInnerToc",
|
|
3452
3499
|
props: {
|
|
3453
3500
|
editor: {
|
|
@@ -3473,7 +3520,7 @@ var Br = J({
|
|
|
3473
3520
|
},
|
|
3474
3521
|
setup(e) {
|
|
3475
3522
|
let t = V(null), n, r = () => {
|
|
3476
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
3523
|
+
n?.(), n = e.placement === "container" && t.value ? ke(t.value) : void 0;
|
|
3477
3524
|
};
|
|
3478
3525
|
return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
|
|
3479
3526
|
ref: t,
|
|
@@ -3496,33 +3543,33 @@ var Br = J({
|
|
|
3496
3543
|
"aria-current": t.active ? "location" : void 0,
|
|
3497
3544
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
3498
3545
|
title: t.text,
|
|
3499
|
-
onClick: () =>
|
|
3546
|
+
onClick: () => Ae(e.editor, t, {
|
|
3500
3547
|
behavior: "smooth",
|
|
3501
3548
|
focus: e.editable
|
|
3502
3549
|
})
|
|
3503
3550
|
}, t.text)))])]) : null;
|
|
3504
3551
|
}
|
|
3505
3552
|
});
|
|
3506
|
-
function
|
|
3507
|
-
let i = r(e.lang), o = n(i), s = t(i), c = V(f(e.mode)), l = U(() =>
|
|
3553
|
+
function $r(e = {}) {
|
|
3554
|
+
let i = r(e.lang), o = n(i), s = t(i), c = V(f(e.mode)), l = U(() => Se(e.theme)), u = U(() => c.value === "live" && e.editable !== !1), d = V(0), m = H(null), h = V(Lt), g = H(null), _ = H(null), v = V("code"), y = H(null), b = H(Wt), x = V(null), S = V(!1), C = H(null), w = ce(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = null;
|
|
3508
3555
|
function E() {
|
|
3509
3556
|
T !== null && (window.clearTimeout(T), T = null), d.value += 1;
|
|
3510
3557
|
}
|
|
3511
3558
|
function ee() {
|
|
3512
3559
|
T !== null && window.clearTimeout(T), T = window.setTimeout(() => {
|
|
3513
3560
|
T = null, d.value += 1;
|
|
3514
|
-
},
|
|
3561
|
+
}, be);
|
|
3515
3562
|
}
|
|
3516
3563
|
let D = e.onSlashCommandUpload, O = H(null);
|
|
3517
3564
|
O.value = new a({
|
|
3518
|
-
extensions:
|
|
3565
|
+
extensions: Pr({
|
|
3519
3566
|
lang: i,
|
|
3520
3567
|
linkCardResolver: e.linkCardResolver,
|
|
3521
|
-
onImageUpload: (e) => D?.(e) ??
|
|
3522
|
-
onVideoUpload: (e) => D?.(e) ??
|
|
3568
|
+
onImageUpload: (e) => D?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3569
|
+
onVideoUpload: (e) => D?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
|
|
3523
3570
|
}),
|
|
3524
3571
|
content: e.content ?? e.defaultContent ?? "",
|
|
3525
|
-
contentType:
|
|
3572
|
+
contentType: I(w),
|
|
3526
3573
|
editable: u.value,
|
|
3527
3574
|
autofocus: e.autofocus,
|
|
3528
3575
|
editorProps: {
|
|
@@ -3535,17 +3582,17 @@ function qr(e = {}) {
|
|
|
3535
3582
|
translate: "no"
|
|
3536
3583
|
},
|
|
3537
3584
|
handleClick: (e, t, n) => {
|
|
3538
|
-
if (!u.value) return
|
|
3539
|
-
let r =
|
|
3540
|
-
return r ? (n.preventDefault(), n.stopPropagation(), A(),
|
|
3585
|
+
if (!u.value) return he(n);
|
|
3586
|
+
let r = yt(e, n);
|
|
3587
|
+
return r ? (n.preventDefault(), n.stopPropagation(), A(), Ct(e, r, !0), wt(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
3541
3588
|
},
|
|
3542
3589
|
handleDOMEvents: {
|
|
3543
|
-
compositionstart: () => u.value ? (h.value =
|
|
3590
|
+
compositionstart: () => u.value ? (h.value = Rt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
3544
3591
|
compositionend: (e) => (u.value && window.setTimeout(() => j(e), 0), !1),
|
|
3545
3592
|
click: (e, t) => {
|
|
3546
|
-
if (!u.value) return
|
|
3547
|
-
let n =
|
|
3548
|
-
return n ? (t.preventDefault(), t.stopPropagation(), A(),
|
|
3593
|
+
if (!u.value) return he(t);
|
|
3594
|
+
let n = yt(e, t);
|
|
3595
|
+
return n ? (t.preventDefault(), t.stopPropagation(), A(), Ct(e, n, !0), wt(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
3549
3596
|
}
|
|
3550
3597
|
}
|
|
3551
3598
|
},
|
|
@@ -3554,17 +3601,17 @@ function qr(e = {}) {
|
|
|
3554
3601
|
p(t, {
|
|
3555
3602
|
mode: c.value,
|
|
3556
3603
|
editable: u.value
|
|
3557
|
-
}),
|
|
3604
|
+
}), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Vt(t), P(t), N(t), E();
|
|
3558
3605
|
},
|
|
3559
3606
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3560
|
-
if (P(e), (t.docChanged ||
|
|
3561
|
-
let t =
|
|
3607
|
+
if (P(e), (t.docChanged || Tt(t)) && ee(), t.docChanged && y.value) {
|
|
3608
|
+
let t = vt(e, y.value.pos);
|
|
3562
3609
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
3563
3610
|
}
|
|
3564
3611
|
},
|
|
3565
3612
|
onUpdate: ({ editor: t }) => {
|
|
3566
|
-
N(t), u.value && M(t), S.value || e.onUpdate?.(
|
|
3567
|
-
let i =
|
|
3613
|
+
N(t), u.value && M(t), S.value || e.onUpdate?.(oe(t, { onContentRead: (n, r) => {
|
|
3614
|
+
let i = ce(e.contentFormat);
|
|
3568
3615
|
e.content !== void 0 && n === i && (C.value = {
|
|
3569
3616
|
content: r,
|
|
3570
3617
|
format: n,
|
|
@@ -3575,115 +3622,115 @@ function qr(e = {}) {
|
|
|
3575
3622
|
});
|
|
3576
3623
|
let k = U(() => O.value ?? null);
|
|
3577
3624
|
function A() {
|
|
3578
|
-
g.value = null, _.value = null, h.value =
|
|
3625
|
+
g.value = null, _.value = null, h.value = Lt;
|
|
3579
3626
|
}
|
|
3580
3627
|
function j(e) {
|
|
3581
|
-
let t =
|
|
3628
|
+
let t = It(e.state);
|
|
3582
3629
|
if (!t) {
|
|
3583
|
-
h.value = h.value.name === "idle" ? h.value :
|
|
3630
|
+
h.value = h.value.name === "idle" ? h.value : Lt, g.value = null, _.value = null;
|
|
3584
3631
|
return;
|
|
3585
3632
|
}
|
|
3586
3633
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3587
|
-
g.value =
|
|
3634
|
+
g.value = Ft(n, {
|
|
3588
3635
|
frameRect: i,
|
|
3589
3636
|
triggerRect: r
|
|
3590
|
-
}), h.value =
|
|
3637
|
+
}), h.value = Pt(h.value, t);
|
|
3591
3638
|
}
|
|
3592
3639
|
function M(e) {
|
|
3593
3640
|
j(e.view);
|
|
3594
3641
|
}
|
|
3595
3642
|
function N(e) {
|
|
3596
|
-
let t =
|
|
3597
|
-
|
|
3598
|
-
let n =
|
|
3599
|
-
n && (
|
|
3600
|
-
let r =
|
|
3643
|
+
let t = ye(e);
|
|
3644
|
+
_e(m.value, t) || (m.value = t);
|
|
3645
|
+
let n = bt(e);
|
|
3646
|
+
n && (St(e, n, !0), y.value = n);
|
|
3647
|
+
let r = Ne(e);
|
|
3601
3648
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
3602
3649
|
}
|
|
3603
3650
|
function P(e) {
|
|
3604
|
-
b.value =
|
|
3651
|
+
b.value = Lr(e);
|
|
3605
3652
|
}
|
|
3606
|
-
let
|
|
3607
|
-
active:
|
|
3653
|
+
let F = U(() => k.value ? Ne(k.value) : Ir), ne = U(() => k.value ? Ht(k.value.state) : Fr), ie = U(() => m.value?.currentNode === "codeBlock"), ae = U(() => ie.value && F.value.language === "mermaid"), le = U(() => k.value ? kt({
|
|
3654
|
+
active: ae.value,
|
|
3608
3655
|
mode: v.value,
|
|
3609
|
-
source:
|
|
3610
|
-
}) :
|
|
3656
|
+
source: F.value.text
|
|
3657
|
+
}) : kt({
|
|
3611
3658
|
active: !1,
|
|
3612
3659
|
mode: "code",
|
|
3613
3660
|
source: ""
|
|
3614
|
-
})),
|
|
3661
|
+
})), ue = U(() => k.value ? Bt(k.value.state) : null), R = U(() => k.value ? Ee(k.value.state.doc) : we.items), de = U(() => De(R.value, x.value)), fe = U(() => Ce(R.value, de.value)), pe = U(() => At(h.value.query, s)), me = U(() => ge({
|
|
3615
3662
|
revision: d.value,
|
|
3616
3663
|
mode: c.value,
|
|
3617
3664
|
editable: u.value,
|
|
3618
|
-
toc:
|
|
3665
|
+
toc: fe.value,
|
|
3619
3666
|
selection: m.value,
|
|
3620
3667
|
slash: h.value,
|
|
3621
|
-
table:
|
|
3668
|
+
table: ne.value,
|
|
3622
3669
|
tableInteraction: b.value,
|
|
3623
|
-
codeBlock:
|
|
3624
|
-
mermaid:
|
|
3625
|
-
tableDebugSnapshot:
|
|
3626
|
-
})),
|
|
3670
|
+
codeBlock: F.value,
|
|
3671
|
+
mermaid: le.value,
|
|
3672
|
+
tableDebugSnapshot: ue.value
|
|
3673
|
+
})), ve = {
|
|
3627
3674
|
closeSlashMenu: A,
|
|
3628
|
-
focusFirstTableBodyCell: () => k.value ?
|
|
3675
|
+
focusFirstTableBodyCell: () => k.value ? Vt(k.value) : !1,
|
|
3629
3676
|
setContent: (e, t = {}) => {
|
|
3630
3677
|
if (!k.value) return !1;
|
|
3631
|
-
let n =
|
|
3678
|
+
let n = ce(t.format);
|
|
3632
3679
|
return k.value.commands.setContent(e, {
|
|
3633
|
-
contentType:
|
|
3680
|
+
contentType: I(n),
|
|
3634
3681
|
emitUpdate: t.emitUpdate ?? !1
|
|
3635
|
-
}), t.focusFirstTableBodyCell &&
|
|
3682
|
+
}), t.focusFirstTableBodyCell && Vt(k.value), N(k.value), u.value && M(k.value), P(k.value), E(), !0;
|
|
3636
3683
|
}
|
|
3637
3684
|
};
|
|
3638
|
-
function
|
|
3639
|
-
if (!(!k.value || !u.value || !
|
|
3685
|
+
function z(e, t) {
|
|
3686
|
+
if (!(!k.value || !u.value || !jt(e))) {
|
|
3640
3687
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3641
3688
|
_.value = e;
|
|
3642
3689
|
return;
|
|
3643
3690
|
}
|
|
3644
|
-
|
|
3691
|
+
Nt(k.value, h.value, e, t), h.value = Rt(h.value, { type: "execute" }), A();
|
|
3645
3692
|
}
|
|
3646
3693
|
}
|
|
3647
|
-
function
|
|
3694
|
+
function xe(e) {
|
|
3648
3695
|
if (!k.value || _.value || !u.value) return;
|
|
3649
|
-
let t =
|
|
3696
|
+
let t = Mt(h.value, pe.value, e.key, { isComposing: e.isComposing || re(k.value.state) });
|
|
3650
3697
|
if (t.type !== "ignore") {
|
|
3651
3698
|
if (e.preventDefault(), t.type === "close") {
|
|
3652
|
-
h.value =
|
|
3699
|
+
h.value = Rt(h.value, { type: "escape" }), A();
|
|
3653
3700
|
return;
|
|
3654
3701
|
}
|
|
3655
3702
|
if (t.type === "move-active") {
|
|
3656
|
-
h.value =
|
|
3703
|
+
h.value = Rt(h.value, {
|
|
3657
3704
|
type: "move-active",
|
|
3658
3705
|
delta: t.delta,
|
|
3659
3706
|
optionCount: t.optionCount
|
|
3660
3707
|
});
|
|
3661
3708
|
return;
|
|
3662
3709
|
}
|
|
3663
|
-
|
|
3710
|
+
z(t.command);
|
|
3664
3711
|
}
|
|
3665
3712
|
}
|
|
3666
3713
|
W(() => [e.mode, e.editable], () => {
|
|
3667
3714
|
c.value = f(e.mode), k.value && (k.value.setEditable(u.value), p(k.value, {
|
|
3668
3715
|
mode: c.value,
|
|
3669
3716
|
editable: u.value
|
|
3670
|
-
}),
|
|
3717
|
+
}), Dt(k.value, u.value ? "live" : "view"), E(), u.value || A());
|
|
3671
3718
|
}, { immediate: !0 }), W(() => e.theme, () => {
|
|
3672
|
-
k.value &&
|
|
3719
|
+
k.value && Et(k.value, l.value);
|
|
3673
3720
|
}, { immediate: !0 }), W(() => e.content, (t) => {
|
|
3674
|
-
let n =
|
|
3721
|
+
let n = ce(e.contentFormat);
|
|
3675
3722
|
if (!(!k.value || t === void 0)) {
|
|
3676
|
-
if (
|
|
3723
|
+
if (se(k.value, C.value, t, n)) {
|
|
3677
3724
|
C.value = null;
|
|
3678
3725
|
return;
|
|
3679
3726
|
}
|
|
3680
|
-
C.value = null, !
|
|
3681
|
-
contentType:
|
|
3727
|
+
C.value = null, !L(k.value, t, n) && (S.value = !0, k.value.commands.setContent(t, {
|
|
3728
|
+
contentType: I(n),
|
|
3682
3729
|
emitUpdate: !1
|
|
3683
3730
|
}), S.value = !1, N(k.value), u.value && M(k.value), P(k.value), E());
|
|
3684
3731
|
}
|
|
3685
|
-
}), W(
|
|
3686
|
-
let t =
|
|
3732
|
+
}), W(me, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(fe, (t) => e.onTocChange?.(t), { immediate: !0 }), W(R, (e) => {
|
|
3733
|
+
let t = De(e, x.value);
|
|
3687
3734
|
x.value !== t && (x.value = t);
|
|
3688
3735
|
});
|
|
3689
3736
|
let Oe = null;
|
|
@@ -3691,18 +3738,18 @@ function qr(e = {}) {
|
|
|
3691
3738
|
T !== null && window.clearTimeout(T);
|
|
3692
3739
|
}), G(() => {
|
|
3693
3740
|
let e = () => {
|
|
3694
|
-
if (!k.value || !
|
|
3741
|
+
if (!k.value || !R.value.length) {
|
|
3695
3742
|
x.value = null;
|
|
3696
3743
|
return;
|
|
3697
3744
|
}
|
|
3698
3745
|
let e = null;
|
|
3699
3746
|
try {
|
|
3700
|
-
e =
|
|
3747
|
+
e = Te(k.value, R.value);
|
|
3701
3748
|
} catch {
|
|
3702
3749
|
return;
|
|
3703
3750
|
}
|
|
3704
3751
|
x.value !== e && (x.value = e);
|
|
3705
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
3752
|
+
}, t = () => window.requestAnimationFrame(e), n = Rr(k.value?.view.dom ?? null);
|
|
3706
3753
|
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
|
|
3707
3754
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3708
3755
|
};
|
|
@@ -3712,34 +3759,34 @@ function qr(e = {}) {
|
|
|
3712
3759
|
O.value = null, q(() => e?.destroy());
|
|
3713
3760
|
}), {
|
|
3714
3761
|
editor: k,
|
|
3715
|
-
runtimeSnapshot:
|
|
3716
|
-
actions:
|
|
3762
|
+
runtimeSnapshot: me,
|
|
3763
|
+
actions: ve,
|
|
3717
3764
|
__render: {
|
|
3718
3765
|
messages: o,
|
|
3719
3766
|
effectiveEditable: u,
|
|
3720
|
-
tableFocusState:
|
|
3767
|
+
tableFocusState: ne,
|
|
3721
3768
|
tableInteractionState: b,
|
|
3722
|
-
codeBlockState:
|
|
3723
|
-
isCodeBlockActive:
|
|
3769
|
+
codeBlockState: F,
|
|
3770
|
+
isCodeBlockActive: ie,
|
|
3724
3771
|
mermaidMode: v,
|
|
3725
3772
|
mathTarget: y,
|
|
3726
3773
|
setMermaidMode: (e) => {
|
|
3727
3774
|
v.value = e;
|
|
3728
3775
|
},
|
|
3729
|
-
tocState:
|
|
3730
|
-
filteredSlashCommands:
|
|
3776
|
+
tocState: fe,
|
|
3777
|
+
filteredSlashCommands: pe,
|
|
3731
3778
|
slashState: h,
|
|
3732
3779
|
slashMenuPosition: g,
|
|
3733
3780
|
slashInputCommand: _,
|
|
3734
|
-
runSlashCommand:
|
|
3735
|
-
handleEditorKeyDown:
|
|
3781
|
+
runSlashCommand: z,
|
|
3782
|
+
handleEditorKeyDown: xe,
|
|
3736
3783
|
setSlashInputCommand: (e) => {
|
|
3737
3784
|
_.value = e;
|
|
3738
3785
|
}
|
|
3739
3786
|
}
|
|
3740
3787
|
};
|
|
3741
3788
|
}
|
|
3742
|
-
var
|
|
3789
|
+
var ei = J({
|
|
3743
3790
|
name: "MarkweaveEditor",
|
|
3744
3791
|
props: {
|
|
3745
3792
|
defaultContent: {
|
|
@@ -3844,29 +3891,29 @@ var Jr = J({
|
|
|
3844
3891
|
}
|
|
3845
3892
|
},
|
|
3846
3893
|
setup(e) {
|
|
3847
|
-
let t =
|
|
3894
|
+
let t = $r(e);
|
|
3848
3895
|
return () => {
|
|
3849
3896
|
let n = t.editor.value;
|
|
3850
3897
|
if (!n) return null;
|
|
3851
|
-
let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a =
|
|
3898
|
+
let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a = xe(e.canvasColor);
|
|
3852
3899
|
return B("section", {
|
|
3853
3900
|
class: i,
|
|
3854
3901
|
"aria-label": e.ariaLabel ?? r.messages.common.editorAriaLabel,
|
|
3855
3902
|
"data-testid": "markweave-editor-frame",
|
|
3856
3903
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
3857
|
-
"data-markweave-theme":
|
|
3904
|
+
"data-markweave-theme": Se(e.theme),
|
|
3858
3905
|
style: a ? { "--markweave-canvas": a } : void 0,
|
|
3859
3906
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
3860
|
-
"data-markweave-inner-toc-placement":
|
|
3907
|
+
"data-markweave-inner-toc-placement": Oe(e.innerTocPlacement),
|
|
3861
3908
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
3862
3909
|
"data-table-focus-mode": r.tableFocusState.value.mode,
|
|
3863
3910
|
onKeydownCapture: r.handleEditorKeyDown
|
|
3864
3911
|
}, [
|
|
3865
|
-
r.effectiveEditable.value ? B(
|
|
3912
|
+
r.effectiveEditable.value ? B(Kr, {
|
|
3866
3913
|
editor: n,
|
|
3867
3914
|
messages: r.messages
|
|
3868
3915
|
}) : null,
|
|
3869
|
-
r.effectiveEditable.value ? B(
|
|
3916
|
+
r.effectiveEditable.value ? B(Jr, {
|
|
3870
3917
|
commands: r.filteredSlashCommands.value,
|
|
3871
3918
|
state: r.slashState.value,
|
|
3872
3919
|
position: r.slashMenuPosition.value,
|
|
@@ -3876,7 +3923,7 @@ var Jr = J({
|
|
|
3876
3923
|
onInputCommandChange: r.setSlashInputCommand,
|
|
3877
3924
|
onUpload: e.onSlashCommandUpload
|
|
3878
3925
|
}) : null,
|
|
3879
|
-
r.effectiveEditable.value ? B(
|
|
3926
|
+
r.effectiveEditable.value ? B(Yr, {
|
|
3880
3927
|
editor: n,
|
|
3881
3928
|
active: r.tableFocusState.value.active,
|
|
3882
3929
|
interactionState: r.tableInteractionState.value,
|
|
@@ -3885,11 +3932,11 @@ var Jr = J({
|
|
|
3885
3932
|
onCommandResult: e.onTableCommandResult,
|
|
3886
3933
|
onEditWithAi: e.onEditWithAi
|
|
3887
3934
|
}) : null,
|
|
3888
|
-
r.effectiveEditable.value ? B(
|
|
3935
|
+
r.effectiveEditable.value ? B(Xr, {
|
|
3889
3936
|
editor: n,
|
|
3890
3937
|
focusState: r.tableFocusState.value
|
|
3891
3938
|
}) : null,
|
|
3892
|
-
B(
|
|
3939
|
+
B(Zr, {
|
|
3893
3940
|
editor: n,
|
|
3894
3941
|
state: r.codeBlockState.value,
|
|
3895
3942
|
active: r.effectiveEditable.value && r.isCodeBlockActive.value,
|
|
@@ -3897,14 +3944,14 @@ var Jr = J({
|
|
|
3897
3944
|
onMermaidModeChange: r.setMermaidMode,
|
|
3898
3945
|
readOnly: !r.effectiveEditable.value
|
|
3899
3946
|
}),
|
|
3900
|
-
e.innerToc && r.tocState.value.items.length ? B(
|
|
3947
|
+
e.innerToc && r.tocState.value.items.length ? B(Qr, {
|
|
3901
3948
|
editor: n,
|
|
3902
3949
|
state: r.tocState.value,
|
|
3903
3950
|
messages: r.messages,
|
|
3904
3951
|
editable: r.effectiveEditable.value,
|
|
3905
|
-
placement:
|
|
3952
|
+
placement: Oe(e.innerTocPlacement)
|
|
3906
3953
|
}) : null,
|
|
3907
|
-
r.effectiveEditable.value && r.mathTarget.value ? B(
|
|
3954
|
+
r.effectiveEditable.value && r.mathTarget.value ? B(qr, {
|
|
3908
3955
|
editor: n,
|
|
3909
3956
|
messages: r.messages,
|
|
3910
3957
|
target: r.mathTarget.value,
|
|
@@ -3916,4 +3963,4 @@ var Jr = J({
|
|
|
3916
3963
|
}
|
|
3917
3964
|
});
|
|
3918
3965
|
//#endregion
|
|
3919
|
-
export {
|
|
3966
|
+
export { ei as MarkweaveEditor, Pr as createMarkweaveEditorExtensions, Pr as createMarkweaveVue2EditorExtensions, $r as useMarkweaveEditorController };
|