@markweave/vue2 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +451 -418
- package/dist/types/media-nodeviews.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,49 +4,50 @@ import { Editor as n, EditorContent as r, NodeViewWrapper as i, VueNodeViewRende
|
|
|
4
4
|
import * as o from "vue";
|
|
5
5
|
import { getMarkweaveEditorModeState as s, isMarkweaveEditorLiveEditable as c, normalizeMarkweaveEditorMode as l, setMarkweaveEditorModeState as u, subscribeToMarkweaveEditorMode as d } from "markweave/internal/core/editor-mode-state";
|
|
6
6
|
import { getLocalizedSlashCommandSpecs as f, getMarkweaveMessages as p, normalizeMarkweaveLang as m } from "markweave/internal/i18n";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
7
|
+
import { openMarkweaveImagePreview as h } from "markweave/internal/plugins/media/image-preview";
|
|
8
|
+
import { MarkweaveCoreImage as g, MarkweaveCoreVideo as _, attrsFromMarkweaveImageUploadResult as v, attrsFromMarkweaveVideoUploadResult as y, attrsFromMarkweaveVideoUrl as b, clampMarkweaveImageWidth as x, createMarkweaveImageUploadRequest as S, createMarkweaveVideoUploadRequest as C, downloadMarkweaveImage as w, markweaveVideoIframeAllow as T, normalizeMarkweaveCoreImageAlign as E, normalizeMarkweaveVideoEmbedUrl as D, numberAttribute as O, stringAttribute as k } from "markweave/internal/plugins/media/core-media-nodes";
|
|
9
|
+
import { detectUploadSource as A, getDirectUploadResult as j, resolveMarkweaveUploadResult as M } from "markweave/internal/plugins/slash-command/upload";
|
|
10
|
+
import { BubbleMenu as N } from "@tiptap/vue-2/menus";
|
|
11
|
+
import { isEditorComposing as ee } from "markweave/internal/editor-core/composition-guard";
|
|
12
|
+
import { createMarkweaveEditorUpdatePayload as te, getMarkweaveContentType as P, isEditorContentCurrent as F, normalizeMarkweaveContentFormat as I } from "markweave/internal/editor-core/editor-content";
|
|
13
|
+
import { getCurrentFloatingToolbarBlockType as L, getFloatingToolbarHighlightColorOptions as R, getFloatingToolbarMoreActions as ne, getFloatingToolbarTextColorOptions as re, getFloatingToolbarTurnIntoOptions as z, runFloatingToolbarMoreAction as ie, setFloatingToolbarTurnInto as ae } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
13
14
|
import { openMarkweaveReadonlyLinkFromEvent as oe } from "markweave/internal/editor-core/readonly-link";
|
|
14
15
|
import { createMarkweaveEditorRuntimeSnapshot as se } from "markweave/internal/editor-core/runtime-snapshot";
|
|
15
|
-
import { createSelectionSnapshot as
|
|
16
|
-
import { createMarkweaveTocState as
|
|
17
|
-
import { codeBlockCollapsePluginKey as
|
|
18
|
-
import { calculateCodeBlockLanguageMenuPosition as
|
|
19
|
-
import { normalizeMarkdownLinkHref as
|
|
20
|
-
import { applyMarkweaveMathLatex as
|
|
21
|
-
import { isMermaidInlinePreviewTransaction as
|
|
22
|
-
import { getMermaidPreviewState as
|
|
23
|
-
import { filterSlashCommands as
|
|
24
|
-
import { getSlashCommandKeyboardAction as
|
|
25
|
-
import { executeSlashCommand as
|
|
26
|
-
import { initialSlashCommandState as
|
|
27
|
-
import { setMarkweaveTableMenuAxisTarget as
|
|
28
|
-
import { getFirstTableDebugSnapshot as
|
|
29
|
-
import { focusFirstTableBodyCell as
|
|
30
|
-
import { getTableFocusState as
|
|
31
|
-
import { getTableSelectionOverlayState as
|
|
32
|
-
import { calculateAnchoredTableMenuPosition as
|
|
16
|
+
import { createSelectionSnapshot as ce, shouldShowFloatingToolbar as le } from "markweave/internal/editor-core/selection-state";
|
|
17
|
+
import { createMarkweaveTocState as ue, emptyMarkweaveTocState as de, getActiveMarkweaveTocId as fe, getMarkweaveTocItems as pe, getValidMarkweaveTocActiveId as me, normalizeMarkweaveInnerTocPlacement as he, observeMarkweaveInnerTocContainerPosition as ge, scrollToMarkweaveTocItem as _e } from "markweave/internal/core/toc-state";
|
|
18
|
+
import { codeBlockCollapsePluginKey as ve, copyActiveCodeBlock as ye, getActiveCodeBlockState as be, getCodeBlockCopyFeedbackSnapshot as xe, markweaveCodeBlockBehavior as Se, setCodeBlockCollapsedAtPosition as Ce, setCodeBlockLanguageAtPosition as we, setCodeBlockMermaidPreviewModeAtPosition as Te } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
19
|
+
import { calculateCodeBlockLanguageMenuPosition as Ee, clampFullscreenScale as De, codeBlockCopyFeedbackTimeoutMs as Oe, copyCodeBlockText as ke, createCodeBlockOverlayPosition as Ae, createMermaidFullscreenViewerState as je, createMermaidTabPosition as Me, focusCodeBlockTarget as Ne, formatCodeBlockLanguageLabel as Pe, formatFullscreenZoom as Fe, getActiveCodeBlockElement as Ie, getAnchoredRect as Le, getCodeBlockLanguageItems as Re, getCodeBlockPositionFromEventTarget as ze, getCodeBlockStateAtPosition as Be, getFrameElement as Ve, getMermaidCodeBlockTargets as He, getMermaidSvgMarkup as Ue, isCodeBlockTargetCollapsed as We, mergeStableMermaidTabPositions as Ge, mermaidFullscreenZoomStep as Ke, moveMermaidFullscreenViewer as qe } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
20
|
+
import { normalizeMarkdownLinkHref as Je } from "markweave/internal/plugins/markdown/markdown-input";
|
|
21
|
+
import { applyMarkweaveMathLatex as Ye, calculateMarkweaveMathPopoverPosition as Xe, getMarkweaveMathAnchorRect as Ze, getMarkweaveMathBlockIndex as Qe, getMarkweaveMathRenderedHtml as $e, getMarkweaveMathTargetAtPos as et, getMarkweaveMathTargetFromDomEvent as tt, getMarkweaveMathTargetFromSelection as nt, renderMarkweaveMathPreview as rt, setMarkweaveMathEditingDomState as it, setMarkweaveMathEditingDomStateInView as at, setMarkweaveMathSelectionInView as ot } from "markweave/internal/plugins/math/math-ui-model";
|
|
22
|
+
import { isMermaidInlinePreviewTransaction as st, setMermaidInlinePreviewEditorMode as ct, setReadonlyMermaidPreviewMode as lt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
23
|
+
import { getMermaidPreviewState as ut } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
24
|
+
import { filterSlashCommands as dt, isExecutableSlashCommand as ft } from "markweave/internal/plugins/slash-command/command-spec";
|
|
25
|
+
import { getSlashCommandKeyboardAction as pt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
26
|
+
import { executeSlashCommand as mt, getNextSlashCommandState as ht, getSlashCommandAnchoredMenuPosition as gt, getSlashCommandContext as _t } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
27
|
+
import { initialSlashCommandState as vt, reduceSlashCommandState as yt } from "markweave/internal/plugins/slash-command/slash-state";
|
|
28
|
+
import { setMarkweaveTableMenuAxisTarget as bt } from "markweave/internal/plugins/table/table-clipboard";
|
|
29
|
+
import { getFirstTableDebugSnapshot as xt } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
30
|
+
import { focusFirstTableBodyCell as St } from "markweave/internal/plugins/table/table-focus-position";
|
|
31
|
+
import { getTableFocusState as Ct } from "markweave/internal/plugins/table/table-focus-state";
|
|
32
|
+
import { getTableSelectionOverlayState as wt, initialTableInteractionState as Tt, tableInteractionPluginKey as Et } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
33
|
+
import { calculateAnchoredTableMenuPosition as Dt, calculateTableEdgeHandlePosition as Ot, canRunTableCommand as kt, executeTableMenuCommand as At, formatTableCopyFeedback as jt, getActiveTableElement as Mt, getAvailableCellMenuCommandSpecs as Nt, getTableAxisTargetRect as Pt, getTableControlAxisSelectionModel as Ft, getTableEditWithAiRequest as It, getTableMenuItemGroup as Lt, getTableMenuItemLabel as Rt, getTableMenuItems as zt, getTableSelectionTargetRect as Bt, measureTableSelectionOverlay as Vt, selectTableAxisFromCell as Ht, tableCopyFeedbackTimeoutMs as Ut, tableMenuLabel as Wt } from "markweave/internal/plugins/table/table-ui-model";
|
|
33
34
|
//#region src/vue2-compat.ts
|
|
34
|
-
var
|
|
35
|
-
function
|
|
35
|
+
var Gt = o.default ?? o, Kt = null, qt = null, Jt = null;
|
|
36
|
+
function Yt(e) {
|
|
36
37
|
return !!(e && typeof e == "object" && "value" in e);
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function Xt(e) {
|
|
39
40
|
let t = e.slice(2);
|
|
40
41
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
+
function Zt(e) {
|
|
43
44
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
44
45
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
45
46
|
if (o === "class" || o === "style" || o === "key") {
|
|
46
47
|
t[o] = s;
|
|
47
48
|
continue;
|
|
48
49
|
}
|
|
49
|
-
if (o === "ref" &&
|
|
50
|
+
if (o === "ref" && Yt(s)) {
|
|
50
51
|
a.insert = (e) => {
|
|
51
52
|
s.value = e.elm;
|
|
52
53
|
}, a.destroy = () => {
|
|
@@ -55,7 +56,7 @@ function Xt(e) {
|
|
|
55
56
|
continue;
|
|
56
57
|
}
|
|
57
58
|
if (/^on[A-Z]/.test(o)) {
|
|
58
|
-
i[
|
|
59
|
+
i[Xt(o)] = s;
|
|
59
60
|
continue;
|
|
60
61
|
}
|
|
61
62
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -66,14 +67,14 @@ function Xt(e) {
|
|
|
66
67
|
}
|
|
67
68
|
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;
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function Qt(e) {
|
|
70
71
|
let t = {}, n = {}, r = {}, i = {};
|
|
71
72
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
72
73
|
if (a === "class" || a === "style" || a === "key") {
|
|
73
74
|
t[a] = o;
|
|
74
75
|
continue;
|
|
75
76
|
}
|
|
76
|
-
if (a === "ref" &&
|
|
77
|
+
if (a === "ref" && Yt(o)) {
|
|
77
78
|
i.insert = (e) => {
|
|
78
79
|
o.value = e.componentInstance ?? e.elm;
|
|
79
80
|
}, i.destroy = () => {
|
|
@@ -89,25 +90,25 @@ function Zt(e) {
|
|
|
89
90
|
}
|
|
90
91
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
+
function $t(e) {
|
|
93
94
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
+
function en(e) {
|
|
96
97
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
97
98
|
}
|
|
98
|
-
function
|
|
99
|
+
function tn(e) {
|
|
99
100
|
return e == null || Array.isArray(e) ? e : [e];
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
-
return typeof e == "function" ?
|
|
102
|
+
function nn(e) {
|
|
103
|
+
return typeof e == "function" ? tn(e()) : $t(e) ? tn(e.default()) : en(e) ? [e] : e;
|
|
103
104
|
}
|
|
104
105
|
function B(e, t, n) {
|
|
105
|
-
if (!
|
|
106
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
107
|
-
return
|
|
106
|
+
if (!Jt) throw Error("Vue 2 render context is not available.");
|
|
107
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Zt(r) : Qt(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : nn(n);
|
|
108
|
+
return Jt(e, i, a);
|
|
108
109
|
}
|
|
109
110
|
function V(e) {
|
|
110
|
-
return
|
|
111
|
+
return Gt.observable({ value: e });
|
|
111
112
|
}
|
|
112
113
|
var H = V;
|
|
113
114
|
function U(e) {
|
|
@@ -117,19 +118,19 @@ function U(e) {
|
|
|
117
118
|
}
|
|
118
119
|
function W(e, t, n) {
|
|
119
120
|
let r = typeof e == "function" ? e : () => e.value;
|
|
120
|
-
return
|
|
121
|
+
return Kt?.$watch ? Kt.$watch(r, t, n) : () => void 0;
|
|
121
122
|
}
|
|
122
123
|
function G(e) {
|
|
123
|
-
|
|
124
|
+
qt?.mounted.push(e);
|
|
124
125
|
}
|
|
125
126
|
function K(e) {
|
|
126
|
-
|
|
127
|
+
qt?.beforeUnmount.push(e);
|
|
127
128
|
}
|
|
128
129
|
function q(e) {
|
|
129
|
-
return
|
|
130
|
+
return Gt.nextTick(e);
|
|
130
131
|
}
|
|
131
132
|
function J(e) {
|
|
132
|
-
return
|
|
133
|
+
return Gt.extend({
|
|
133
134
|
name: e.name,
|
|
134
135
|
props: e.props,
|
|
135
136
|
created() {
|
|
@@ -137,12 +138,12 @@ function J(e) {
|
|
|
137
138
|
mounted: [],
|
|
138
139
|
beforeUnmount: []
|
|
139
140
|
};
|
|
140
|
-
|
|
141
|
+
Kt = this, qt = t;
|
|
141
142
|
try {
|
|
142
143
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
143
144
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
144
145
|
} finally {
|
|
145
|
-
|
|
146
|
+
Kt = null, qt = null;
|
|
146
147
|
}
|
|
147
148
|
},
|
|
148
149
|
mounted() {
|
|
@@ -152,19 +153,19 @@ function J(e) {
|
|
|
152
153
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
153
154
|
},
|
|
154
155
|
render(t) {
|
|
155
|
-
|
|
156
|
+
Jt = t;
|
|
156
157
|
try {
|
|
157
158
|
let n = this.__markweaveVue2Render;
|
|
158
159
|
return n ? n() : e.render?.(t) ?? null;
|
|
159
160
|
} finally {
|
|
160
|
-
|
|
161
|
+
Jt = null;
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
});
|
|
164
165
|
}
|
|
165
166
|
//#endregion
|
|
166
167
|
//#region src/vue2-icons.ts
|
|
167
|
-
var
|
|
168
|
+
var rn = {
|
|
168
169
|
AlignCenter: {
|
|
169
170
|
iconName: "text-align-center",
|
|
170
171
|
node: [
|
|
@@ -1029,7 +1030,7 @@ var nn = {
|
|
|
1029
1030
|
}]]
|
|
1030
1031
|
}
|
|
1031
1032
|
};
|
|
1032
|
-
function
|
|
1033
|
+
function an(e) {
|
|
1033
1034
|
return e.map(([e, t]) => B(e, t));
|
|
1034
1035
|
}
|
|
1035
1036
|
function Y(e) {
|
|
@@ -1050,7 +1051,7 @@ function Y(e) {
|
|
|
1050
1051
|
}
|
|
1051
1052
|
},
|
|
1052
1053
|
setup(t) {
|
|
1053
|
-
let n =
|
|
1054
|
+
let n = rn[e];
|
|
1054
1055
|
return () => B("svg", {
|
|
1055
1056
|
class: `lucide lucide-${n.iconName}`,
|
|
1056
1057
|
viewBox: "0 0 24 24",
|
|
@@ -1063,16 +1064,14 @@ function Y(e) {
|
|
|
1063
1064
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1064
1065
|
"aria-hidden": "true",
|
|
1065
1066
|
focusable: "false"
|
|
1066
|
-
},
|
|
1067
|
+
}, an(n.node));
|
|
1067
1068
|
}
|
|
1068
1069
|
});
|
|
1069
1070
|
}
|
|
1070
|
-
var
|
|
1071
|
-
Y("Eye");
|
|
1072
|
-
var bn = Y("ExternalLink"), xn = Y("Heading1"), Sn = Y("Heading2"), Cn = Y("Heading3"), wn = Y("Image"), Tn = Y("ImageUp"), En = Y("IndentDecrease"), Dn = Y("IndentIncrease"), On = Y("Info"), kn = Y("Italic"), An = Y("Lightbulb"), jn = Y("Link2"), Mn = Y("List"), Nn = Y("ListChecks"), Pn = Y("ListOrdered"), Fn = Y("Minus"), In = Y("MoreVertical"), Ln = Y("Paperclip");
|
|
1071
|
+
var on = Y("AlignCenter"), sn = Y("AlignJustify"), cn = Y("AlignLeft"), ln = Y("AlignRight"), un = Y("AlertTriangle"), dn = Y("Bold"), fn = Y("Braces"), pn = Y("Captions"), mn = Y("CheckCircle2"), hn = Y("ChevronDown"), gn = Y("ChevronUp"), _n = Y("CircleX"), vn = Y("Code2"), yn = Y("CornerDownLeft"), bn = Y("Download"), xn = Y("Eye"), Sn = Y("ExternalLink"), Cn = Y("Heading1"), wn = Y("Heading2"), Tn = Y("Heading3"), En = Y("Image"), Dn = Y("ImageUp"), On = Y("IndentDecrease"), kn = Y("IndentIncrease"), An = Y("Info"), jn = Y("Italic"), Mn = Y("Lightbulb"), Nn = Y("Link2"), Pn = Y("List"), Fn = Y("ListChecks"), In = Y("ListOrdered"), Ln = Y("Minus"), Rn = Y("MoreVertical"), zn = Y("Paperclip");
|
|
1073
1072
|
Y("PencilLine");
|
|
1074
|
-
var
|
|
1075
|
-
function
|
|
1073
|
+
var Bn = Y("Quote"), Vn = Y("Replace"), Hn = Y("Sigma"), Un = Y("SmilePlus"), Wn = Y("Strikethrough"), Gn = Y("Subscript"), Kn = Y("Superscript"), qn = Y("Table2"), Jn = Y("Text"), Yn = Y("Trash2"), Xn = Y("Type"), Zn = Y("Underline"), Qn = Y("Upload"), $n = Y("Video"), er = E;
|
|
1074
|
+
function tr(e) {
|
|
1076
1075
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1077
1076
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1078
1077
|
return n === "view" ? {
|
|
@@ -1094,13 +1093,13 @@ function $n(e) {
|
|
|
1094
1093
|
i(), a?.disconnect();
|
|
1095
1094
|
}), r;
|
|
1096
1095
|
}
|
|
1097
|
-
function
|
|
1096
|
+
function nr(e) {
|
|
1098
1097
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1099
1098
|
}
|
|
1100
|
-
function
|
|
1099
|
+
function rr(e) {
|
|
1101
1100
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1102
1101
|
}
|
|
1103
|
-
function
|
|
1102
|
+
function ir(e, t) {
|
|
1104
1103
|
return B(e, {
|
|
1105
1104
|
size: 18,
|
|
1106
1105
|
strokeWidth: 1.8,
|
|
@@ -1116,12 +1115,12 @@ function X(e) {
|
|
|
1116
1115
|
"data-active": e.active ? "true" : "false",
|
|
1117
1116
|
onMousedown: (e) => e.preventDefault(),
|
|
1118
1117
|
onClick: e.onClick
|
|
1119
|
-
}, [
|
|
1118
|
+
}, [ir(e.icon, e.label), B("span", {
|
|
1120
1119
|
class: "markweave-image-tooltip",
|
|
1121
1120
|
role: "tooltip"
|
|
1122
1121
|
}, e.label)]);
|
|
1123
1122
|
}
|
|
1124
|
-
function
|
|
1123
|
+
function ar(e) {
|
|
1125
1124
|
let t = V(null), n = e.messages.image;
|
|
1126
1125
|
return B("section", {
|
|
1127
1126
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1155,7 +1154,7 @@ function rr(e) {
|
|
|
1155
1154
|
B("div", {
|
|
1156
1155
|
class: "markweave-image-upload-icon",
|
|
1157
1156
|
"aria-hidden": "true"
|
|
1158
|
-
}, [B(
|
|
1157
|
+
}, [B(Dn, {
|
|
1159
1158
|
size: 46,
|
|
1160
1159
|
strokeWidth: 1.6
|
|
1161
1160
|
})]),
|
|
@@ -1180,7 +1179,7 @@ function rr(e) {
|
|
|
1180
1179
|
"data-testid": "markweave-image-upload-submit",
|
|
1181
1180
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1182
1181
|
onClick: e.onSubmit
|
|
1183
|
-
}, [B(
|
|
1182
|
+
}, [B(Dn, {
|
|
1184
1183
|
size: 16,
|
|
1185
1184
|
strokeWidth: 1.8
|
|
1186
1185
|
}), e.messages.common.insert]),
|
|
@@ -1196,7 +1195,7 @@ function rr(e) {
|
|
|
1196
1195
|
}, e.error) : null
|
|
1197
1196
|
]);
|
|
1198
1197
|
}
|
|
1199
|
-
function
|
|
1198
|
+
function or(e) {
|
|
1200
1199
|
let t = V(null), n = e.messages.video;
|
|
1201
1200
|
return B("section", {
|
|
1202
1201
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1230,7 +1229,7 @@ function ir(e) {
|
|
|
1230
1229
|
B("div", {
|
|
1231
1230
|
class: "markweave-video-upload-icon",
|
|
1232
1231
|
"aria-hidden": "true"
|
|
1233
|
-
}, [B(
|
|
1232
|
+
}, [B($n, {
|
|
1234
1233
|
size: 46,
|
|
1235
1234
|
strokeWidth: 1.6
|
|
1236
1235
|
})]),
|
|
@@ -1255,7 +1254,7 @@ function ir(e) {
|
|
|
1255
1254
|
"data-testid": "markweave-video-upload-submit",
|
|
1256
1255
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1257
1256
|
onClick: e.onSubmit
|
|
1258
|
-
}, [B(
|
|
1257
|
+
}, [B(Qn, {
|
|
1259
1258
|
size: 16,
|
|
1260
1259
|
strokeWidth: 1.8
|
|
1261
1260
|
}), e.messages.common.insert]),
|
|
@@ -1271,7 +1270,7 @@ function ir(e) {
|
|
|
1271
1270
|
}, e.error) : null
|
|
1272
1271
|
]);
|
|
1273
1272
|
}
|
|
1274
|
-
var
|
|
1273
|
+
var sr = J({
|
|
1275
1274
|
name: "MarkweaveVueImageNodeView",
|
|
1276
1275
|
props: {
|
|
1277
1276
|
editor: {
|
|
@@ -1304,69 +1303,81 @@ var ar = J({
|
|
|
1304
1303
|
}
|
|
1305
1304
|
},
|
|
1306
1305
|
setup(e) {
|
|
1307
|
-
let t = V(null), n = V(!1), r = V(!1), a = V(!1), o = V(""), s = V(null), l = V(!1), u = U(() => e.node.attrs), d = V(!!
|
|
1308
|
-
|
|
1306
|
+
let t = V(null), n = V(!1), r = V(!1), a = V(!1), o = V(""), s = V(null), l = V(!1), u = U(() => e.node.attrs), d = V(!!k(u.value.caption)), f = V(k(u.value.caption) ?? ""), m = tr(e.editor), g = U(() => c(m.value)), _ = U(() => e.extension.options?.messages ?? p("zh")), y = U(() => _.value.image), b = U(() => k(u.value.src)), C = U(() => er(u.value.align)), T = U(() => O(u.value.width)), E = U(() => k(u.value.caption)), D = U(() => g.value && (!b.value || r.value)), j = () => {
|
|
1307
|
+
b.value && h({
|
|
1308
|
+
src: b.value,
|
|
1309
|
+
alt: k(u.value.alt) ?? "",
|
|
1310
|
+
messages: {
|
|
1311
|
+
dialogAriaLabel: y.value.previewDialogAriaLabel,
|
|
1312
|
+
zoomOut: y.value.previewZoomOut,
|
|
1313
|
+
zoomIn: y.value.previewZoomIn,
|
|
1314
|
+
reset: y.value.previewReset,
|
|
1315
|
+
close: y.value.previewClose
|
|
1316
|
+
}
|
|
1317
|
+
});
|
|
1318
|
+
};
|
|
1319
|
+
W(E, (e) => {
|
|
1309
1320
|
d.value || (f.value = e ?? "");
|
|
1310
1321
|
});
|
|
1311
|
-
let
|
|
1312
|
-
if (!
|
|
1322
|
+
let N = () => {
|
|
1323
|
+
if (!g.value) return;
|
|
1313
1324
|
let t = e.getPos();
|
|
1314
1325
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1315
|
-
},
|
|
1316
|
-
if (o.value = "", s.value = null, a.value = !1,
|
|
1326
|
+
}, ee = () => {
|
|
1327
|
+
if (o.value = "", s.value = null, a.value = !1, b.value) {
|
|
1317
1328
|
r.value = !1;
|
|
1318
1329
|
return;
|
|
1319
1330
|
}
|
|
1320
1331
|
e.deleteNode();
|
|
1321
|
-
},
|
|
1322
|
-
if (!
|
|
1332
|
+
}, te = async (t) => {
|
|
1333
|
+
if (!g.value) return;
|
|
1323
1334
|
let n = e.extension.options;
|
|
1324
1335
|
l.value = !0, s.value = null;
|
|
1325
1336
|
try {
|
|
1326
|
-
let i = await
|
|
1327
|
-
e.updateAttributes(
|
|
1337
|
+
let i = await M(S(t, b.value && r.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1338
|
+
e.updateAttributes(v(u.value, i)), o.value = "", r.value = !1;
|
|
1328
1339
|
} catch (e) {
|
|
1329
|
-
s.value = e instanceof Error ? e.message :
|
|
1340
|
+
s.value = e instanceof Error ? e.message : y.value.uploadFailedError;
|
|
1330
1341
|
} finally {
|
|
1331
1342
|
l.value = !1, a.value = !1;
|
|
1332
1343
|
}
|
|
1333
|
-
},
|
|
1344
|
+
}, P = () => {
|
|
1334
1345
|
if (!o.value.trim()) {
|
|
1335
|
-
s.value =
|
|
1346
|
+
s.value = y.value.uploadRequiredError;
|
|
1336
1347
|
return;
|
|
1337
1348
|
}
|
|
1338
|
-
|
|
1339
|
-
},
|
|
1340
|
-
|
|
1349
|
+
te(A(o.value));
|
|
1350
|
+
}, F = (e) => {
|
|
1351
|
+
te({
|
|
1341
1352
|
type: "file",
|
|
1342
1353
|
file: e,
|
|
1343
1354
|
mimeType: e.type || "image/*"
|
|
1344
1355
|
});
|
|
1345
|
-
},
|
|
1346
|
-
d.value = !d.value, d.value && (f.value =
|
|
1347
|
-
},
|
|
1348
|
-
if (!
|
|
1349
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1356
|
+
}, I = () => {
|
|
1357
|
+
d.value = !d.value, d.value && (f.value = E.value ?? "");
|
|
1358
|
+
}, L = (n, r) => {
|
|
1359
|
+
if (!g.value || !b.value) return;
|
|
1360
|
+
r.preventDefault(), r.stopPropagation(), N();
|
|
1350
1361
|
let i = t.value;
|
|
1351
1362
|
if (!i) return;
|
|
1352
|
-
let a = r.clientX, o = i.getBoundingClientRect().width ||
|
|
1363
|
+
let a = r.clientX, o = i.getBoundingClientRect().width || T.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
|
|
1353
1364
|
let r = n === "right" ? t.clientX - a : a - t.clientX;
|
|
1354
|
-
e.updateAttributes({ width:
|
|
1365
|
+
e.updateAttributes({ width: x(o + r, s) });
|
|
1355
1366
|
}, l = () => {
|
|
1356
1367
|
window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
|
|
1357
1368
|
};
|
|
1358
1369
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1359
1370
|
};
|
|
1360
|
-
return () =>
|
|
1371
|
+
return () => D.value ? B(i, {
|
|
1361
1372
|
as: "figure",
|
|
1362
1373
|
class: "markweave-image-node",
|
|
1363
1374
|
"data-testid": "markweave-image-node",
|
|
1364
|
-
"data-align":
|
|
1375
|
+
"data-align": C.value,
|
|
1365
1376
|
"data-selected": "false",
|
|
1366
1377
|
"data-hovered": "false",
|
|
1367
1378
|
"data-empty": "true"
|
|
1368
|
-
}, () =>
|
|
1369
|
-
messages:
|
|
1379
|
+
}, () => ar({
|
|
1380
|
+
messages: _.value,
|
|
1370
1381
|
inputValue: o.value,
|
|
1371
1382
|
error: s.value,
|
|
1372
1383
|
dragActive: a.value,
|
|
@@ -1374,9 +1385,9 @@ var ar = J({
|
|
|
1374
1385
|
onInputValue: (e) => {
|
|
1375
1386
|
o.value = e;
|
|
1376
1387
|
},
|
|
1377
|
-
onFile:
|
|
1378
|
-
onSubmit:
|
|
1379
|
-
onCancel:
|
|
1388
|
+
onFile: F,
|
|
1389
|
+
onSubmit: P,
|
|
1390
|
+
onCancel: ee,
|
|
1380
1391
|
onDragActive: (e) => {
|
|
1381
1392
|
a.value = e;
|
|
1382
1393
|
}
|
|
@@ -1384,9 +1395,9 @@ var ar = J({
|
|
|
1384
1395
|
as: "figure",
|
|
1385
1396
|
class: "markweave-image-node",
|
|
1386
1397
|
"data-testid": "markweave-image-node",
|
|
1387
|
-
"data-align":
|
|
1388
|
-
"data-selected":
|
|
1389
|
-
"data-hovered":
|
|
1398
|
+
"data-align": C.value,
|
|
1399
|
+
"data-selected": g.value && e.selected ? "true" : "false",
|
|
1400
|
+
"data-hovered": n.value ? "true" : "false",
|
|
1390
1401
|
"data-empty": "false",
|
|
1391
1402
|
onMouseenter: () => {
|
|
1392
1403
|
n.value = !0;
|
|
@@ -1395,34 +1406,34 @@ var ar = J({
|
|
|
1395
1406
|
n.value = !1;
|
|
1396
1407
|
},
|
|
1397
1408
|
onMousedown: (e) => {
|
|
1398
|
-
|
|
1409
|
+
g.value && !nr(e.target) && N();
|
|
1399
1410
|
}
|
|
1400
1411
|
}, () => [
|
|
1401
|
-
|
|
1412
|
+
g.value ? B("div", {
|
|
1402
1413
|
class: "markweave-image-toolbar",
|
|
1403
1414
|
"data-testid": "markweave-image-toolbar",
|
|
1404
1415
|
"data-markweave-image-ui": "true",
|
|
1405
|
-
"aria-label":
|
|
1416
|
+
"aria-label": y.value.toolsAriaLabel
|
|
1406
1417
|
}, [
|
|
1407
1418
|
X({
|
|
1408
1419
|
testId: "markweave-image-align-left",
|
|
1409
|
-
label:
|
|
1410
|
-
icon:
|
|
1411
|
-
active:
|
|
1420
|
+
label: y.value.alignLeft,
|
|
1421
|
+
icon: cn,
|
|
1422
|
+
active: C.value === "left",
|
|
1412
1423
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1413
1424
|
}),
|
|
1414
1425
|
X({
|
|
1415
1426
|
testId: "markweave-image-align-center",
|
|
1416
|
-
label:
|
|
1417
|
-
icon:
|
|
1418
|
-
active:
|
|
1427
|
+
label: y.value.alignCenter,
|
|
1428
|
+
icon: on,
|
|
1429
|
+
active: C.value === "center",
|
|
1419
1430
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1420
1431
|
}),
|
|
1421
1432
|
X({
|
|
1422
1433
|
testId: "markweave-image-align-right",
|
|
1423
|
-
label:
|
|
1424
|
-
icon:
|
|
1425
|
-
active:
|
|
1434
|
+
label: y.value.alignRight,
|
|
1435
|
+
icon: ln,
|
|
1436
|
+
active: C.value === "right",
|
|
1426
1437
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1427
1438
|
}),
|
|
1428
1439
|
B("span", {
|
|
@@ -1431,23 +1442,29 @@ var ar = J({
|
|
|
1431
1442
|
}),
|
|
1432
1443
|
X({
|
|
1433
1444
|
testId: "markweave-image-caption",
|
|
1434
|
-
label:
|
|
1435
|
-
icon:
|
|
1436
|
-
active: d.value || !!
|
|
1437
|
-
onClick:
|
|
1445
|
+
label: y.value.caption,
|
|
1446
|
+
icon: pn,
|
|
1447
|
+
active: d.value || !!E.value,
|
|
1448
|
+
onClick: I
|
|
1449
|
+
}),
|
|
1450
|
+
X({
|
|
1451
|
+
testId: "markweave-image-preview",
|
|
1452
|
+
label: y.value.preview,
|
|
1453
|
+
icon: xn,
|
|
1454
|
+
onClick: j
|
|
1438
1455
|
}),
|
|
1439
1456
|
X({
|
|
1440
1457
|
testId: "markweave-image-download",
|
|
1441
|
-
label:
|
|
1442
|
-
icon:
|
|
1458
|
+
label: y.value.download,
|
|
1459
|
+
icon: bn,
|
|
1443
1460
|
onClick: () => {
|
|
1444
|
-
|
|
1461
|
+
b.value && w(b.value);
|
|
1445
1462
|
}
|
|
1446
1463
|
}),
|
|
1447
1464
|
X({
|
|
1448
1465
|
testId: "markweave-image-replace",
|
|
1449
|
-
label:
|
|
1450
|
-
icon:
|
|
1466
|
+
label: y.value.replace,
|
|
1467
|
+
icon: Vn,
|
|
1451
1468
|
onClick: () => {
|
|
1452
1469
|
o.value = "", s.value = null, r.value = !0;
|
|
1453
1470
|
}
|
|
@@ -1458,66 +1475,82 @@ var ar = J({
|
|
|
1458
1475
|
}),
|
|
1459
1476
|
X({
|
|
1460
1477
|
testId: "markweave-image-delete",
|
|
1461
|
-
label:
|
|
1462
|
-
icon:
|
|
1478
|
+
label: y.value.delete,
|
|
1479
|
+
icon: Yn,
|
|
1463
1480
|
onClick: () => e.deleteNode()
|
|
1464
1481
|
})
|
|
1465
1482
|
]) : null,
|
|
1466
1483
|
B("div", {
|
|
1467
1484
|
ref: t,
|
|
1468
1485
|
class: "markweave-image-box",
|
|
1469
|
-
style:
|
|
1486
|
+
style: T.value ? { width: `${Math.round(T.value)}px` } : void 0
|
|
1470
1487
|
}, [
|
|
1471
|
-
|
|
1488
|
+
b.value ? B("img", {
|
|
1472
1489
|
class: "markweave-image",
|
|
1473
|
-
src:
|
|
1474
|
-
alt:
|
|
1475
|
-
title:
|
|
1490
|
+
src: b.value,
|
|
1491
|
+
alt: k(u.value.alt) ?? "",
|
|
1492
|
+
title: k(u.value.title) ?? void 0,
|
|
1476
1493
|
draggable: !1
|
|
1477
1494
|
}) : B("div", {
|
|
1478
1495
|
class: "markweave-image-readonly-empty",
|
|
1479
1496
|
"data-testid": "markweave-image-readonly-empty",
|
|
1480
1497
|
"aria-hidden": "true"
|
|
1481
1498
|
}),
|
|
1482
|
-
|
|
1499
|
+
!g.value && b.value ? B("button", {
|
|
1500
|
+
type: "button",
|
|
1501
|
+
class: "markweave-image-preview-trigger",
|
|
1502
|
+
"data-testid": "markweave-image-preview",
|
|
1503
|
+
"data-markweave-image-ui": "true",
|
|
1504
|
+
"aria-label": y.value.preview,
|
|
1505
|
+
title: y.value.preview,
|
|
1506
|
+
onMousedown: (e) => e.preventDefault(),
|
|
1507
|
+
onClick: j
|
|
1508
|
+
}, [B(xn, {
|
|
1509
|
+
size: 16,
|
|
1510
|
+
strokeWidth: 1.8
|
|
1511
|
+
}), B("span", {
|
|
1512
|
+
class: "markweave-image-tooltip",
|
|
1513
|
+
role: "tooltip"
|
|
1514
|
+
}, y.value.preview)]) : null,
|
|
1515
|
+
g.value ? B("button", {
|
|
1483
1516
|
type: "button",
|
|
1484
1517
|
class: "markweave-image-resize-handle",
|
|
1485
1518
|
"data-testid": "markweave-image-resize-left",
|
|
1486
1519
|
"data-side": "left",
|
|
1487
|
-
"aria-label":
|
|
1520
|
+
"aria-label": y.value.resizeLeft,
|
|
1488
1521
|
"data-markweave-image-ui": "true",
|
|
1489
|
-
onPointerdown: (e) =>
|
|
1522
|
+
onPointerdown: (e) => L("left", e)
|
|
1490
1523
|
}) : null,
|
|
1491
|
-
|
|
1524
|
+
g.value ? B("button", {
|
|
1492
1525
|
type: "button",
|
|
1493
1526
|
class: "markweave-image-resize-handle",
|
|
1494
1527
|
"data-testid": "markweave-image-resize-right",
|
|
1495
1528
|
"data-side": "right",
|
|
1496
|
-
"aria-label":
|
|
1529
|
+
"aria-label": y.value.resizeRight,
|
|
1497
1530
|
"data-markweave-image-ui": "true",
|
|
1498
|
-
onPointerdown: (e) =>
|
|
1531
|
+
onPointerdown: (e) => L("right", e)
|
|
1499
1532
|
}) : null
|
|
1500
1533
|
]),
|
|
1501
|
-
|
|
1534
|
+
g.value && (d.value || E.value) ? B("input", {
|
|
1502
1535
|
class: "markweave-image-caption-input",
|
|
1503
1536
|
"data-testid": "markweave-image-caption-input",
|
|
1504
1537
|
"data-markweave-image-ui": "true",
|
|
1505
1538
|
value: f.value,
|
|
1506
|
-
placeholder:
|
|
1507
|
-
"aria-label":
|
|
1539
|
+
placeholder: y.value.captionPlaceholder,
|
|
1540
|
+
"aria-label": y.value.captionAriaLabel,
|
|
1508
1541
|
onInput: (t) => {
|
|
1509
1542
|
f.value = t.target.value, e.updateAttributes({ caption: f.value.trim() ? f.value : null });
|
|
1510
1543
|
},
|
|
1511
1544
|
onKeydown: (e) => {
|
|
1512
1545
|
e.key === "Escape" && (e.preventDefault(), d.value = !1);
|
|
1513
1546
|
}
|
|
1514
|
-
}) :
|
|
1547
|
+
}) : E.value ? B("figcaption", {
|
|
1515
1548
|
class: "markweave-image-caption",
|
|
1516
1549
|
"data-testid": "markweave-image-caption"
|
|
1517
|
-
},
|
|
1550
|
+
}, E.value) : null
|
|
1518
1551
|
]);
|
|
1519
1552
|
}
|
|
1520
|
-
}),
|
|
1553
|
+
}), cr = J({
|
|
1521
1554
|
name: "MarkweaveVueVideoNodeView",
|
|
1522
1555
|
props: {
|
|
1523
1556
|
editor: {
|
|
@@ -1550,35 +1583,35 @@ var ar = J({
|
|
|
1550
1583
|
}
|
|
1551
1584
|
},
|
|
1552
1585
|
setup(e) {
|
|
1553
|
-
let t = V(!1), n = V(""), r = V(null), a = V(!1), o =
|
|
1586
|
+
let t = V(!1), n = V(""), r = V(null), a = V(!1), o = tr(e.editor), s = U(() => c(o.value)), l = U(() => e.extension.options?.messages ?? p("zh")), u = U(() => l.value.video), d = U(() => e.node.attrs), f = U(() => k(d.value.src)), m = U(() => k(d.value.embedUrl)), h = U(() => k(d.value.provider)), g = U(() => m.value ? D(m.value, h.value) : null), _ = U(() => k(d.value.mimeType)), v = U(() => k(d.value.title)), x = () => {
|
|
1554
1587
|
f.value || e.deleteNode(), n.value = "", r.value = null, t.value = !1;
|
|
1555
|
-
},
|
|
1588
|
+
}, S = async (i) => {
|
|
1556
1589
|
if (!s.value) return;
|
|
1557
1590
|
let o = e.extension.options;
|
|
1558
1591
|
a.value = !0, r.value = null;
|
|
1559
1592
|
try {
|
|
1560
|
-
let t = await
|
|
1561
|
-
e.updateAttributes(
|
|
1593
|
+
let t = await M(C(i), o?.onUpload);
|
|
1594
|
+
e.updateAttributes(y(t)), n.value = "";
|
|
1562
1595
|
} catch (e) {
|
|
1563
1596
|
r.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
1564
1597
|
} finally {
|
|
1565
1598
|
a.value = !1, t.value = !1;
|
|
1566
1599
|
}
|
|
1567
|
-
},
|
|
1600
|
+
}, w = () => {
|
|
1568
1601
|
if (!s.value) return;
|
|
1569
|
-
let t =
|
|
1602
|
+
let t = b(n.value);
|
|
1570
1603
|
if (!t) {
|
|
1571
1604
|
r.value = u.value.unsupportedUrlError;
|
|
1572
1605
|
return;
|
|
1573
1606
|
}
|
|
1574
1607
|
r.value = null, e.updateAttributes(t), n.value = "";
|
|
1575
|
-
},
|
|
1576
|
-
|
|
1608
|
+
}, E = (e) => {
|
|
1609
|
+
S({
|
|
1577
1610
|
type: "file",
|
|
1578
1611
|
file: e,
|
|
1579
1612
|
mimeType: e.type || "video/*"
|
|
1580
1613
|
});
|
|
1581
|
-
},
|
|
1614
|
+
}, O = () => {
|
|
1582
1615
|
if (!s.value) return;
|
|
1583
1616
|
let t = e.getPos();
|
|
1584
1617
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
@@ -1591,7 +1624,7 @@ var ar = J({
|
|
|
1591
1624
|
"data-testid": "markweave-video-node",
|
|
1592
1625
|
"data-empty": "true",
|
|
1593
1626
|
"data-selected": "false"
|
|
1594
|
-
}, () =>
|
|
1627
|
+
}, () => or({
|
|
1595
1628
|
messages: l.value,
|
|
1596
1629
|
inputValue: n.value,
|
|
1597
1630
|
error: r.value,
|
|
@@ -1600,8 +1633,8 @@ var ar = J({
|
|
|
1600
1633
|
onInputValue: (e) => {
|
|
1601
1634
|
n.value = e;
|
|
1602
1635
|
},
|
|
1603
|
-
onFile:
|
|
1604
|
-
onSubmit:
|
|
1636
|
+
onFile: E,
|
|
1637
|
+
onSubmit: w,
|
|
1605
1638
|
onCancel: x,
|
|
1606
1639
|
onDragActive: (e) => {
|
|
1607
1640
|
t.value = e;
|
|
@@ -1615,19 +1648,19 @@ var ar = J({
|
|
|
1615
1648
|
"data-selected": s.value && e.selected ? "true" : "false",
|
|
1616
1649
|
"aria-label": u.value.nodeAriaLabel,
|
|
1617
1650
|
tabindex: s.value ? 0 : void 0,
|
|
1618
|
-
onFocus:
|
|
1651
|
+
onFocus: O,
|
|
1619
1652
|
onKeydown: A,
|
|
1620
1653
|
onMousedown: (e) => {
|
|
1621
|
-
s.value && !
|
|
1654
|
+
s.value && !rr(e.target) && (e.preventDefault(), O());
|
|
1622
1655
|
}
|
|
1623
1656
|
}, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
|
|
1624
1657
|
class: "markweave-video-iframe",
|
|
1625
1658
|
src: g.value,
|
|
1626
|
-
title:
|
|
1659
|
+
title: v.value ?? `${h.value ?? "Video"} embed`,
|
|
1627
1660
|
"data-markweave-video-embed": "true",
|
|
1628
1661
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
1629
1662
|
"data-markweave-video-src": f.value ?? void 0,
|
|
1630
|
-
allow:
|
|
1663
|
+
allow: T,
|
|
1631
1664
|
allowfullscreen: "true"
|
|
1632
1665
|
}), s.value ? B("button", {
|
|
1633
1666
|
type: "button",
|
|
@@ -1638,7 +1671,7 @@ var ar = J({
|
|
|
1638
1671
|
}) : null]) : f.value ? B("div", { class: "markweave-video-box" }, [B("video", {
|
|
1639
1672
|
class: "markweave-video",
|
|
1640
1673
|
src: f.value,
|
|
1641
|
-
title:
|
|
1674
|
+
title: v.value ?? void 0,
|
|
1642
1675
|
controls: !0,
|
|
1643
1676
|
"data-markweave-video": "true",
|
|
1644
1677
|
"data-markweave-mime-type": _.value ?? void 0
|
|
@@ -1654,7 +1687,7 @@ var ar = J({
|
|
|
1654
1687
|
"aria-hidden": "true"
|
|
1655
1688
|
})]);
|
|
1656
1689
|
}
|
|
1657
|
-
}),
|
|
1690
|
+
}), lr = g.extend({
|
|
1658
1691
|
addOptions() {
|
|
1659
1692
|
return {
|
|
1660
1693
|
...this.parent?.(),
|
|
@@ -1663,9 +1696,9 @@ var ar = J({
|
|
|
1663
1696
|
};
|
|
1664
1697
|
},
|
|
1665
1698
|
addNodeView() {
|
|
1666
|
-
return typeof document > "u" ? null : a(
|
|
1699
|
+
return typeof document > "u" ? null : a(sr, { stopEvent: ({ event: e }) => nr(e.target) });
|
|
1667
1700
|
}
|
|
1668
|
-
}),
|
|
1701
|
+
}), ur = _.extend({
|
|
1669
1702
|
addOptions() {
|
|
1670
1703
|
return {
|
|
1671
1704
|
...this.parent?.(),
|
|
@@ -1674,17 +1707,17 @@ var ar = J({
|
|
|
1674
1707
|
};
|
|
1675
1708
|
},
|
|
1676
1709
|
addNodeView() {
|
|
1677
|
-
return typeof document > "u" ? null : a(
|
|
1710
|
+
return typeof document > "u" ? null : a(cr, { stopEvent: ({ event: e }) => rr(e.target) });
|
|
1678
1711
|
}
|
|
1679
1712
|
});
|
|
1680
1713
|
//#endregion
|
|
1681
1714
|
//#region src/create-editor-extensions.ts
|
|
1682
|
-
function
|
|
1715
|
+
function dr(n = {}) {
|
|
1683
1716
|
return e({
|
|
1684
1717
|
lang: n.lang,
|
|
1685
1718
|
mediaExtensions: t({
|
|
1686
|
-
image:
|
|
1687
|
-
video:
|
|
1719
|
+
image: lr,
|
|
1720
|
+
video: ur,
|
|
1688
1721
|
lang: n.lang,
|
|
1689
1722
|
onImageUpload: n.onImageUpload,
|
|
1690
1723
|
onVideoUpload: n.onVideoUpload
|
|
@@ -1693,7 +1726,7 @@ function lr(n = {}) {
|
|
|
1693
1726
|
}
|
|
1694
1727
|
//#endregion
|
|
1695
1728
|
//#region src/MarkweaveEditor.ts
|
|
1696
|
-
var
|
|
1729
|
+
var fr = {
|
|
1697
1730
|
active: !1,
|
|
1698
1731
|
mode: "outside",
|
|
1699
1732
|
activeCellPos: null,
|
|
@@ -1701,17 +1734,17 @@ var ur = {
|
|
|
1701
1734
|
selectedCellCount: 0,
|
|
1702
1735
|
selectionFrom: 0,
|
|
1703
1736
|
selectionTo: 0
|
|
1704
|
-
},
|
|
1737
|
+
}, pr = {
|
|
1705
1738
|
active: !1,
|
|
1706
|
-
language:
|
|
1739
|
+
language: Se.defaultLanguage,
|
|
1707
1740
|
mermaidPreviewMode: "code",
|
|
1708
1741
|
pos: null,
|
|
1709
1742
|
text: ""
|
|
1710
1743
|
};
|
|
1711
|
-
function
|
|
1712
|
-
return
|
|
1744
|
+
function mr(e) {
|
|
1745
|
+
return Et.getState(e.state) ?? Tt;
|
|
1713
1746
|
}
|
|
1714
|
-
function
|
|
1747
|
+
function hr(e) {
|
|
1715
1748
|
if (!e || typeof window > "u") return null;
|
|
1716
1749
|
let t = e.parentElement;
|
|
1717
1750
|
for (; t;) {
|
|
@@ -1728,7 +1761,7 @@ function Z(e, t, n = 18, r = 1.8) {
|
|
|
1728
1761
|
"aria-hidden": "true"
|
|
1729
1762
|
}, { default: () => t });
|
|
1730
1763
|
}
|
|
1731
|
-
function
|
|
1764
|
+
function gr(e) {
|
|
1732
1765
|
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", {
|
|
1733
1766
|
cx: "10",
|
|
1734
1767
|
cy: "10",
|
|
@@ -1776,57 +1809,57 @@ function Q(e) {
|
|
|
1776
1809
|
"stroke-linecap": "round",
|
|
1777
1810
|
"stroke-linejoin": "round",
|
|
1778
1811
|
"stroke-width": "1.8"
|
|
1779
|
-
},
|
|
1812
|
+
}, gr(e)));
|
|
1780
1813
|
}
|
|
1781
1814
|
function $(e) {
|
|
1782
1815
|
e.preventDefault();
|
|
1783
1816
|
}
|
|
1784
|
-
function
|
|
1785
|
-
let t =
|
|
1817
|
+
function _r(e) {
|
|
1818
|
+
let t = Je(e);
|
|
1786
1819
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
1787
1820
|
}
|
|
1788
|
-
var
|
|
1789
|
-
bold:
|
|
1790
|
-
italic:
|
|
1791
|
-
underline:
|
|
1792
|
-
strike:
|
|
1793
|
-
"inline-code":
|
|
1794
|
-
link:
|
|
1795
|
-
more:
|
|
1796
|
-
superscript:
|
|
1797
|
-
subscript:
|
|
1798
|
-
"inline-math":
|
|
1799
|
-
"align-left":
|
|
1800
|
-
"align-center":
|
|
1801
|
-
"align-right":
|
|
1802
|
-
"align-justify":
|
|
1803
|
-
"decrease-indent":
|
|
1804
|
-
"increase-indent":
|
|
1805
|
-
},
|
|
1806
|
-
type:
|
|
1807
|
-
"heading-1":
|
|
1808
|
-
"heading-2":
|
|
1809
|
-
"heading-3":
|
|
1810
|
-
"bullet-list":
|
|
1811
|
-
"ordered-list":
|
|
1812
|
-
"task-list":
|
|
1813
|
-
blockquote:
|
|
1814
|
-
"code-block":
|
|
1815
|
-
info:
|
|
1816
|
-
tip:
|
|
1817
|
-
warning:
|
|
1818
|
-
error:
|
|
1819
|
-
success:
|
|
1820
|
-
emoji:
|
|
1821
|
-
math:
|
|
1822
|
-
table:
|
|
1823
|
-
separator:
|
|
1824
|
-
image:
|
|
1825
|
-
video:
|
|
1826
|
-
attachment:
|
|
1821
|
+
var vr = {
|
|
1822
|
+
bold: dn,
|
|
1823
|
+
italic: jn,
|
|
1824
|
+
underline: Zn,
|
|
1825
|
+
strike: Wn,
|
|
1826
|
+
"inline-code": vn,
|
|
1827
|
+
link: Nn,
|
|
1828
|
+
more: Rn,
|
|
1829
|
+
superscript: Kn,
|
|
1830
|
+
subscript: Gn,
|
|
1831
|
+
"inline-math": Hn,
|
|
1832
|
+
"align-left": cn,
|
|
1833
|
+
"align-center": on,
|
|
1834
|
+
"align-right": ln,
|
|
1835
|
+
"align-justify": sn,
|
|
1836
|
+
"decrease-indent": On,
|
|
1837
|
+
"increase-indent": kn
|
|
1838
|
+
}, yr = {
|
|
1839
|
+
type: Jn,
|
|
1840
|
+
"heading-1": Cn,
|
|
1841
|
+
"heading-2": wn,
|
|
1842
|
+
"heading-3": Tn,
|
|
1843
|
+
"bullet-list": Pn,
|
|
1844
|
+
"ordered-list": In,
|
|
1845
|
+
"task-list": Fn,
|
|
1846
|
+
blockquote: Bn,
|
|
1847
|
+
"code-block": fn,
|
|
1848
|
+
info: An,
|
|
1849
|
+
tip: Mn,
|
|
1850
|
+
warning: un,
|
|
1851
|
+
error: _n,
|
|
1852
|
+
success: mn,
|
|
1853
|
+
emoji: Un,
|
|
1854
|
+
math: Hn,
|
|
1855
|
+
table: qn,
|
|
1856
|
+
separator: Ln,
|
|
1857
|
+
image: En,
|
|
1858
|
+
video: $n,
|
|
1859
|
+
attachment: zn
|
|
1827
1860
|
};
|
|
1828
|
-
function
|
|
1829
|
-
let t =
|
|
1861
|
+
function br(e) {
|
|
1862
|
+
let t = yr[e];
|
|
1830
1863
|
return B(t, {
|
|
1831
1864
|
size: 18,
|
|
1832
1865
|
strokeWidth: 1.6,
|
|
@@ -1834,21 +1867,21 @@ function vr(e) {
|
|
|
1834
1867
|
"aria-hidden": "true"
|
|
1835
1868
|
});
|
|
1836
1869
|
}
|
|
1837
|
-
var
|
|
1838
|
-
paragraph:
|
|
1839
|
-
"heading-1":
|
|
1840
|
-
"heading-2":
|
|
1841
|
-
"heading-3":
|
|
1842
|
-
"bullet-list":
|
|
1843
|
-
"numbered-list":
|
|
1844
|
-
"todo-list":
|
|
1845
|
-
quote:
|
|
1846
|
-
"code-block":
|
|
1870
|
+
var xr = {
|
|
1871
|
+
paragraph: Xn,
|
|
1872
|
+
"heading-1": Cn,
|
|
1873
|
+
"heading-2": wn,
|
|
1874
|
+
"heading-3": Tn,
|
|
1875
|
+
"bullet-list": Pn,
|
|
1876
|
+
"numbered-list": In,
|
|
1877
|
+
"todo-list": Fn,
|
|
1878
|
+
quote: Bn,
|
|
1879
|
+
"code-block": fn
|
|
1847
1880
|
};
|
|
1848
|
-
function
|
|
1849
|
-
return
|
|
1881
|
+
function Sr(e, t) {
|
|
1882
|
+
return L(e, t).label;
|
|
1850
1883
|
}
|
|
1851
|
-
var
|
|
1884
|
+
var Cr = J({
|
|
1852
1885
|
name: "MarkweaveVueFloatingToolbar",
|
|
1853
1886
|
props: {
|
|
1854
1887
|
editor: {
|
|
@@ -1865,19 +1898,19 @@ var xr = J({
|
|
|
1865
1898
|
}
|
|
1866
1899
|
},
|
|
1867
1900
|
setup(e) {
|
|
1868
|
-
let t = V(null), n = V(""), r = V(null), i = V(null), a = V(null), o = U(() =>
|
|
1901
|
+
let t = V(null), n = V(""), r = V(null), i = V(null), a = V(null), o = U(() => Je(n.value.trim())), s = U(() => e.messages.floatingToolbar), c = U(() => z(e.messages).map((e) => [
|
|
1869
1902
|
e.id,
|
|
1870
1903
|
e.label,
|
|
1871
|
-
|
|
1904
|
+
xr[e.id]
|
|
1872
1905
|
])), l = U(() => re(e.messages).map((e) => [
|
|
1873
1906
|
e.id,
|
|
1874
1907
|
e.value,
|
|
1875
1908
|
e.label
|
|
1876
|
-
])), u = U(() =>
|
|
1909
|
+
])), u = U(() => R(e.messages).map((e) => [
|
|
1877
1910
|
e.id,
|
|
1878
1911
|
e.value,
|
|
1879
1912
|
e.label
|
|
1880
|
-
])), d = U(() =>
|
|
1913
|
+
])), d = U(() => ne(e.messages).map((e) => e.id)), f = () => {
|
|
1881
1914
|
o.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: o.value }).run(), t.value = null);
|
|
1882
1915
|
}, p = () => {
|
|
1883
1916
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
@@ -1921,7 +1954,7 @@ var xr = J({
|
|
|
1921
1954
|
onMouseenter: (e) => g(n, e.currentTarget),
|
|
1922
1955
|
onMouseleave: () => g(null),
|
|
1923
1956
|
onClick: o
|
|
1924
|
-
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" },
|
|
1957
|
+
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, Sr(e.editor, e.messages)), Z(t.value === "block-type" ? gn : hn, 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" ? gn : hn, i)])] : [Z(a, i)]), y = () => B("span", {
|
|
1925
1958
|
class: "markweave-floating-toolbar-divider",
|
|
1926
1959
|
"aria-hidden": "true"
|
|
1927
1960
|
}), b = (n, r, i) => B("section", {
|
|
@@ -1975,7 +2008,7 @@ var xr = J({
|
|
|
1975
2008
|
"aria-label": s.value.applyLink,
|
|
1976
2009
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
1977
2010
|
onMousedown: $
|
|
1978
|
-
}, [Z(
|
|
2011
|
+
}, [Z(yn, s.value.applyLink)]),
|
|
1979
2012
|
B("span", {
|
|
1980
2013
|
class: "markweave-floating-toolbar-link-divider",
|
|
1981
2014
|
"aria-hidden": "true"
|
|
@@ -1986,15 +2019,15 @@ var xr = J({
|
|
|
1986
2019
|
"aria-label": s.value.openLink,
|
|
1987
2020
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
1988
2021
|
onMousedown: $,
|
|
1989
|
-
onClick: () =>
|
|
1990
|
-
}, [Z(
|
|
2022
|
+
onClick: () => _r(n.value)
|
|
2023
|
+
}, [Z(Sn, s.value.openLink)]),
|
|
1991
2024
|
B("button", {
|
|
1992
2025
|
type: "button",
|
|
1993
2026
|
"aria-label": s.value.removeLink,
|
|
1994
2027
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
1995
2028
|
onMousedown: $,
|
|
1996
2029
|
onClick: p
|
|
1997
|
-
}, [Z(
|
|
2030
|
+
}, [Z(Yn, s.value.removeLink)])
|
|
1998
2031
|
])]) : t.value === "color" ? B("div", {
|
|
1999
2032
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
2000
2033
|
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
@@ -2017,15 +2050,15 @@ var xr = J({
|
|
|
2017
2050
|
r.value = null;
|
|
2018
2051
|
},
|
|
2019
2052
|
onClick: () => {
|
|
2020
|
-
|
|
2053
|
+
ie(e.editor, n), t.value = null;
|
|
2021
2054
|
}
|
|
2022
|
-
}, [Z(
|
|
2055
|
+
}, [Z(vr[n], s.value.moreActions[n])]), r.value === n ? B("div", {
|
|
2023
2056
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2024
2057
|
role: "tooltip"
|
|
2025
2058
|
}, s.value.moreActions[n]) : null]))) : null;
|
|
2026
|
-
return () => B(
|
|
2059
|
+
return () => B(N, {
|
|
2027
2060
|
editor: e.editor,
|
|
2028
|
-
shouldShow: ({ editor: e }) => e.isEditable && ce(
|
|
2061
|
+
shouldShow: ({ editor: e }) => e.isEditable && le(ce(e)),
|
|
2029
2062
|
options: { placement: "top" }
|
|
2030
2063
|
}, { default: () => B("div", {
|
|
2031
2064
|
class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
|
|
@@ -2035,23 +2068,23 @@ var xr = J({
|
|
|
2035
2068
|
class: "markweave-floating-toolbar-content",
|
|
2036
2069
|
"data-menu": t.value ?? "none"
|
|
2037
2070
|
}, [
|
|
2038
|
-
v("block-type", s.value.buttons["block-type"],
|
|
2071
|
+
v("block-type", s.value.buttons["block-type"], Xn, () => m("block-type"), t.value === "block-type"),
|
|
2039
2072
|
y(),
|
|
2040
|
-
v("bold", s.value.buttons.bold,
|
|
2041
|
-
v("italic", s.value.buttons.italic,
|
|
2042
|
-
v("underline", s.value.buttons.underline,
|
|
2043
|
-
v("strike", s.value.buttons.strike,
|
|
2044
|
-
v("inline-code", s.value.buttons["inline-code"],
|
|
2073
|
+
v("bold", s.value.buttons.bold, dn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2074
|
+
v("italic", s.value.buttons.italic, jn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2075
|
+
v("underline", s.value.buttons.underline, Zn, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2076
|
+
v("strike", s.value.buttons.strike, Wn, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2077
|
+
v("inline-code", s.value.buttons["inline-code"], vn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2045
2078
|
y(),
|
|
2046
|
-
v("link", s.value.buttons.link,
|
|
2047
|
-
v("color", s.value.buttons.color,
|
|
2079
|
+
v("link", s.value.buttons.link, Nn, () => m("link"), e.editor.isActive("link")),
|
|
2080
|
+
v("color", s.value.buttons.color, Xn, () => m("color"), t.value === "color"),
|
|
2048
2081
|
y(),
|
|
2049
|
-
v("more", s.value.buttons.more,
|
|
2082
|
+
v("more", s.value.buttons.more, Rn, () => m("more"), t.value === "more"),
|
|
2050
2083
|
x(),
|
|
2051
2084
|
_()
|
|
2052
2085
|
])]) });
|
|
2053
2086
|
}
|
|
2054
|
-
}),
|
|
2087
|
+
}), wr = J({
|
|
2055
2088
|
name: "MarkweaveVueMathEditorPopover",
|
|
2056
2089
|
props: {
|
|
2057
2090
|
editor: {
|
|
@@ -2072,17 +2105,17 @@ var xr = J({
|
|
|
2072
2105
|
}
|
|
2073
2106
|
},
|
|
2074
2107
|
setup(e) {
|
|
2075
|
-
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(
|
|
2108
|
+
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H($e(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
|
|
2076
2109
|
html: a.value,
|
|
2077
2110
|
error: !1
|
|
2078
|
-
} :
|
|
2111
|
+
} : rt(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => Qe(e.editor, e.target) ?? 1), u = () => {
|
|
2079
2112
|
if (typeof window > "u") return;
|
|
2080
|
-
let r =
|
|
2113
|
+
let r = Ze(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2081
2114
|
if (!r || !i) {
|
|
2082
2115
|
e.onClose();
|
|
2083
2116
|
return;
|
|
2084
2117
|
}
|
|
2085
|
-
n.value =
|
|
2118
|
+
n.value = Xe({
|
|
2086
2119
|
anchorRect: r,
|
|
2087
2120
|
frameRect: i,
|
|
2088
2121
|
kind: e.target.kind,
|
|
@@ -2091,7 +2124,7 @@ var xr = J({
|
|
|
2091
2124
|
viewportWidth: window.innerWidth
|
|
2092
2125
|
});
|
|
2093
2126
|
}, d = () => {
|
|
2094
|
-
s.value &&
|
|
2127
|
+
s.value && Ye(e.editor, e.target, t.value) && e.onClose();
|
|
2095
2128
|
}, f = (t) => {
|
|
2096
2129
|
if (t.key === "Escape") {
|
|
2097
2130
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -2103,13 +2136,13 @@ var xr = J({
|
|
|
2103
2136
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2104
2137
|
};
|
|
2105
2138
|
return W(() => [e.target.pos, e.target.latex], () => {
|
|
2106
|
-
t.value = e.target.latex, a.value =
|
|
2139
|
+
t.value = e.target.latex, a.value = $e(e.editor, e.target), q(u);
|
|
2107
2140
|
}), G(() => {
|
|
2108
|
-
|
|
2141
|
+
it(e.editor, e.target, !0), u(), q(() => {
|
|
2109
2142
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2110
2143
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2111
2144
|
}), K(() => {
|
|
2112
|
-
|
|
2145
|
+
it(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2113
2146
|
}), () => {
|
|
2114
2147
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2115
2148
|
ref: i,
|
|
@@ -2170,14 +2203,14 @@ var xr = J({
|
|
|
2170
2203
|
}, [
|
|
2171
2204
|
B("div", { class: "markweave-math-block-toolbar" }, [
|
|
2172
2205
|
B("span", null, c.value.label),
|
|
2173
|
-
Z(
|
|
2206
|
+
Z(vn, c.value.label, 15, 1.75),
|
|
2174
2207
|
B("button", {
|
|
2175
2208
|
type: "submit",
|
|
2176
2209
|
title: c.value.apply,
|
|
2177
2210
|
"aria-label": c.value.apply,
|
|
2178
2211
|
disabled: !s.value,
|
|
2179
2212
|
"data-testid": "markweave-math-editor-apply"
|
|
2180
|
-
}, [Z(
|
|
2213
|
+
}, [Z(mn, c.value.apply, 16, 2)])
|
|
2181
2214
|
]),
|
|
2182
2215
|
B("label", {
|
|
2183
2216
|
class: "markweave-math-block-source",
|
|
@@ -2200,7 +2233,7 @@ var xr = J({
|
|
|
2200
2233
|
]);
|
|
2201
2234
|
};
|
|
2202
2235
|
}
|
|
2203
|
-
}),
|
|
2236
|
+
}), Tr = J({
|
|
2204
2237
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2205
2238
|
props: {
|
|
2206
2239
|
commands: {
|
|
@@ -2259,13 +2292,13 @@ var xr = J({
|
|
|
2259
2292
|
} : {
|
|
2260
2293
|
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
2261
2294
|
trigger: "slash-command",
|
|
2262
|
-
source:
|
|
2295
|
+
source: A(t.value)
|
|
2263
2296
|
};
|
|
2264
2297
|
if (!n.value && !t.value.trim()) {
|
|
2265
2298
|
r.value = e.messages.slash.uploadRequiredError;
|
|
2266
2299
|
return;
|
|
2267
2300
|
}
|
|
2268
|
-
let a = await
|
|
2301
|
+
let a = await M(i, e.onUpload);
|
|
2269
2302
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2270
2303
|
} catch (t) {
|
|
2271
2304
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -2386,7 +2419,7 @@ var xr = J({
|
|
|
2386
2419
|
class: "markweave-slash-group",
|
|
2387
2420
|
"aria-label": t.group
|
|
2388
2421
|
}, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
2389
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
2422
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = ft(t);
|
|
2390
2423
|
return B("button", {
|
|
2391
2424
|
key: t.id,
|
|
2392
2425
|
type: "button",
|
|
@@ -2409,7 +2442,7 @@ var xr = J({
|
|
|
2409
2442
|
}
|
|
2410
2443
|
}
|
|
2411
2444
|
}, [
|
|
2412
|
-
|
|
2445
|
+
br(t.icon),
|
|
2413
2446
|
B("span", null, t.label),
|
|
2414
2447
|
t.disabledReason ? B("small", null, t.disabledReason) : null
|
|
2415
2448
|
]);
|
|
@@ -2420,7 +2453,7 @@ var xr = J({
|
|
|
2420
2453
|
}, e.messages.slash.noResults)])]);
|
|
2421
2454
|
};
|
|
2422
2455
|
}
|
|
2423
|
-
}),
|
|
2456
|
+
}), Er = J({
|
|
2424
2457
|
name: "MarkweaveVueTableControls",
|
|
2425
2458
|
props: {
|
|
2426
2459
|
editor: {
|
|
@@ -2453,12 +2486,12 @@ var xr = J({
|
|
|
2453
2486
|
}
|
|
2454
2487
|
},
|
|
2455
2488
|
setup(e) {
|
|
2456
|
-
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 ?
|
|
2489
|
+
let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ? Ct(e.editor.state) : fr), h = U(() => Ft(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => Ft(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Nt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? zt(e.editor, t.value) : []), b = () => {
|
|
2457
2490
|
p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
|
|
2458
2491
|
}, x = (e) => {
|
|
2459
2492
|
b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
|
|
2460
2493
|
s.value = null, p = null;
|
|
2461
|
-
},
|
|
2494
|
+
}, Ut));
|
|
2462
2495
|
}, S = () => {
|
|
2463
2496
|
if (!e.active) {
|
|
2464
2497
|
r.value = null, i.value = null, a.value = null, x(null);
|
|
@@ -2469,16 +2502,16 @@ var xr = J({
|
|
|
2469
2502
|
r.value = null, i.value = null, a.value = null;
|
|
2470
2503
|
return;
|
|
2471
2504
|
}
|
|
2472
|
-
let s = o.getBoundingClientRect(), c = h.value ?
|
|
2473
|
-
c ? r.value =
|
|
2505
|
+
let s = o.getBoundingClientRect(), c = h.value ? Pt(e.editor, h.value) : null, l = g.value ? Pt(e.editor, g.value) : null, u = v.value ? Bt(e.editor) : null;
|
|
2506
|
+
c ? r.value = Ot({
|
|
2474
2507
|
targetRect: c,
|
|
2475
2508
|
frameRect: s,
|
|
2476
2509
|
kind: "row"
|
|
2477
|
-
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value =
|
|
2510
|
+
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Ot({
|
|
2478
2511
|
targetRect: l,
|
|
2479
2512
|
frameRect: s,
|
|
2480
2513
|
kind: "column"
|
|
2481
|
-
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value =
|
|
2514
|
+
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Ot({
|
|
2482
2515
|
targetRect: u,
|
|
2483
2516
|
frameRect: s,
|
|
2484
2517
|
kind: "selection"
|
|
@@ -2493,13 +2526,13 @@ var xr = J({
|
|
|
2493
2526
|
o.value = null;
|
|
2494
2527
|
return;
|
|
2495
2528
|
}
|
|
2496
|
-
let a = i.getBoundingClientRect(), s = t.value === "row" ?
|
|
2529
|
+
let a = i.getBoundingClientRect(), s = t.value === "row" ? Mt(e.editor)?.getBoundingClientRect() : null, c = s ? {
|
|
2497
2530
|
left: a.left,
|
|
2498
2531
|
top: s.top,
|
|
2499
2532
|
width: a.width,
|
|
2500
2533
|
height: a.height
|
|
2501
2534
|
} : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
|
|
2502
|
-
o.value =
|
|
2535
|
+
o.value = Dt({
|
|
2503
2536
|
anchorRect: c,
|
|
2504
2537
|
frameRect: p,
|
|
2505
2538
|
menuSize: {
|
|
@@ -2516,16 +2549,16 @@ var xr = J({
|
|
|
2516
2549
|
let i = t.value === e && n.value === r;
|
|
2517
2550
|
n.value = r, t.value = i ? null : e, T();
|
|
2518
2551
|
}, D = () => {
|
|
2519
|
-
e.editor.view.dispatch(
|
|
2552
|
+
e.editor.view.dispatch(bt(e.editor.state.tr, null));
|
|
2520
2553
|
}, O = (t, n) => {
|
|
2521
2554
|
let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
2522
|
-
r !== null &&
|
|
2555
|
+
r !== null && Ht(e.editor, r, t, { visualIndex: i }), E(t, n);
|
|
2523
2556
|
}, k = () => {
|
|
2524
2557
|
D(), E("selection", "selection-edge");
|
|
2525
2558
|
}, A = (n = !1) => {
|
|
2526
2559
|
t.value = null, o.value = null, n && e.editor.view.focus();
|
|
2527
2560
|
}, j = async (n, r) => {
|
|
2528
|
-
let i = await
|
|
2561
|
+
let i = await At({
|
|
2529
2562
|
editor: e.editor,
|
|
2530
2563
|
commandId: n,
|
|
2531
2564
|
menu: r ?? t.value ?? "selection",
|
|
@@ -2533,7 +2566,7 @@ var xr = J({
|
|
|
2533
2566
|
});
|
|
2534
2567
|
return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
2535
2568
|
}, M = (t) => {
|
|
2536
|
-
let n =
|
|
2569
|
+
let n = It(e.editor, t);
|
|
2537
2570
|
n && e.onEditWithAi?.(n), A(!0);
|
|
2538
2571
|
}, N = (e) => {
|
|
2539
2572
|
!t.value || e.key !== "Escape" || A(!0);
|
|
@@ -2555,11 +2588,11 @@ var xr = J({
|
|
|
2555
2588
|
t.value,
|
|
2556
2589
|
n.value
|
|
2557
2590
|
], T, { flush: "post" });
|
|
2558
|
-
let
|
|
2591
|
+
let te = () => t.value ? B("div", {
|
|
2559
2592
|
ref: f,
|
|
2560
2593
|
class: "markweave-table-menu",
|
|
2561
2594
|
role: "menu",
|
|
2562
|
-
"aria-label":
|
|
2595
|
+
"aria-label": Wt(t.value, e.messages),
|
|
2563
2596
|
"data-testid": "markweave-table-menu",
|
|
2564
2597
|
"data-positioned": o.value ? "true" : "false",
|
|
2565
2598
|
style: o.value ? {
|
|
@@ -2567,7 +2600,7 @@ var xr = J({
|
|
|
2567
2600
|
top: `${o.value.top}px`
|
|
2568
2601
|
} : void 0
|
|
2569
2602
|
}, y.value.map((n, r) => {
|
|
2570
|
-
let i =
|
|
2603
|
+
let i = Lt(n), a = r === 0 ? i : Lt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : kt(e.editor, n.commandId), c = Rt(n, e.messages);
|
|
2571
2604
|
return B("button", {
|
|
2572
2605
|
key: `${n.id}-${r}`,
|
|
2573
2606
|
type: "button",
|
|
@@ -2607,7 +2640,7 @@ var xr = J({
|
|
|
2607
2640
|
"data-copy-kind": s.value.kind,
|
|
2608
2641
|
"data-text-length": s.value.textLength,
|
|
2609
2642
|
"data-html-length": s.value.htmlLength
|
|
2610
|
-
},
|
|
2643
|
+
}, jt(s.value)) : null,
|
|
2611
2644
|
r.value ? B("button", {
|
|
2612
2645
|
ref: l,
|
|
2613
2646
|
type: "button",
|
|
@@ -2664,10 +2697,10 @@ var xr = J({
|
|
|
2664
2697
|
onMousedown: $,
|
|
2665
2698
|
onClick: k
|
|
2666
2699
|
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2667
|
-
|
|
2700
|
+
te()
|
|
2668
2701
|
]) : null;
|
|
2669
2702
|
}
|
|
2670
|
-
}),
|
|
2703
|
+
}), Dr = J({
|
|
2671
2704
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
2672
2705
|
props: {
|
|
2673
2706
|
editor: {
|
|
@@ -2685,7 +2718,7 @@ var xr = J({
|
|
|
2685
2718
|
t.value = null;
|
|
2686
2719
|
return;
|
|
2687
2720
|
}
|
|
2688
|
-
t.value =
|
|
2721
|
+
t.value = Vt(e.editor, wt(e.editor.state));
|
|
2689
2722
|
};
|
|
2690
2723
|
return G(() => {
|
|
2691
2724
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
@@ -2723,7 +2756,7 @@ var xr = J({
|
|
|
2723
2756
|
}) : null;
|
|
2724
2757
|
};
|
|
2725
2758
|
}
|
|
2726
|
-
}),
|
|
2759
|
+
}), Or = J({
|
|
2727
2760
|
name: "MarkweaveVueCodeBlockControls",
|
|
2728
2761
|
props: {
|
|
2729
2762
|
editor: {
|
|
@@ -2756,105 +2789,105 @@ var xr = J({
|
|
|
2756
2789
|
active: !1,
|
|
2757
2790
|
lastX: 0,
|
|
2758
2791
|
lastY: 0
|
|
2759
|
-
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value,
|
|
2792
|
+
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, Be(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
2760
2793
|
...e.state,
|
|
2761
2794
|
pos: e.state.pos,
|
|
2762
2795
|
active: !0
|
|
2763
|
-
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() =>
|
|
2796
|
+
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => We(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), D = U(() => !e.readOnly), O = U(() => S.value ? Pe(S.value.language) : Pe("text")), k = U(() => u.value?.status ?? "idle"), A = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), j = U(() => w.value && A.value === "preview"), M = U(() => (v.value, g.value, _.value, He(e.editor))), N = U(() => `${_.value}|${M.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), ee = U(() => Re(l.value)), te = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), P = () => {
|
|
2764
2797
|
y !== null && (window.clearTimeout(y), y = null);
|
|
2765
2798
|
}, F = (e) => {
|
|
2766
|
-
|
|
2799
|
+
P(), u.value = e, e && (y = window.setTimeout(() => {
|
|
2767
2800
|
u.value = null, y = null;
|
|
2768
|
-
},
|
|
2769
|
-
},
|
|
2801
|
+
}, Oe));
|
|
2802
|
+
}, I = () => {
|
|
2770
2803
|
f.value = null, p.value = null, m.value = !1, h.value = {
|
|
2771
2804
|
active: !1,
|
|
2772
2805
|
lastX: 0,
|
|
2773
2806
|
lastY: 0
|
|
2774
2807
|
}, e.editor.view.focus();
|
|
2775
|
-
},
|
|
2808
|
+
}, L = () => {
|
|
2776
2809
|
let n = t.value;
|
|
2777
2810
|
if (!n) return;
|
|
2778
|
-
if (!
|
|
2811
|
+
if (!Ve(n) || M.value.length === 0) {
|
|
2779
2812
|
o.value = [];
|
|
2780
2813
|
return;
|
|
2781
2814
|
}
|
|
2782
2815
|
let r = n.getBoundingClientRect(), i = M.value.flatMap((t) => {
|
|
2783
|
-
let n = Ie(
|
|
2784
|
-
return n ? [
|
|
2816
|
+
let n = Le(Ie(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
2817
|
+
return n ? [Me(t, n, r)] : [];
|
|
2785
2818
|
});
|
|
2786
|
-
o.value =
|
|
2787
|
-
},
|
|
2819
|
+
o.value = Ge(o.value, i, M.value.map((e) => e.pos));
|
|
2820
|
+
}, R = () => {
|
|
2788
2821
|
if (!E.value || !S.value) {
|
|
2789
2822
|
a.value = null, s.value = null;
|
|
2790
2823
|
return;
|
|
2791
2824
|
}
|
|
2792
2825
|
let r = t.value;
|
|
2793
2826
|
if (!r) return;
|
|
2794
|
-
let i =
|
|
2827
|
+
let i = Ie(e.editor, S.value.pos, A.value), o = r.getBoundingClientRect(), l = Le(i, o);
|
|
2795
2828
|
if (!l) {
|
|
2796
2829
|
a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
|
|
2797
2830
|
return;
|
|
2798
2831
|
}
|
|
2799
|
-
if (a.value =
|
|
2832
|
+
if (a.value = Ae(S.value.pos, l, o), c.value && n.value) {
|
|
2800
2833
|
let e = n.value.getBoundingClientRect();
|
|
2801
|
-
s.value =
|
|
2834
|
+
s.value = Ee({
|
|
2802
2835
|
overlayRect: o,
|
|
2803
2836
|
buttonRect: e,
|
|
2804
2837
|
windowWidth: window.innerWidth,
|
|
2805
2838
|
windowHeight: window.innerHeight
|
|
2806
2839
|
});
|
|
2807
2840
|
}
|
|
2808
|
-
},
|
|
2841
|
+
}, ne = async () => {
|
|
2809
2842
|
if (e.readOnly) {
|
|
2810
2843
|
if (!S.value) return;
|
|
2811
|
-
let e = await
|
|
2812
|
-
F(
|
|
2844
|
+
let e = await ke(S.value.text);
|
|
2845
|
+
F(xe(S.value, e ? "copied" : "failed"));
|
|
2813
2846
|
return;
|
|
2814
2847
|
}
|
|
2815
|
-
if (!
|
|
2816
|
-
let t = await
|
|
2817
|
-
F(be(
|
|
2818
|
-
},
|
|
2848
|
+
if (!Ne(e.editor, S.value)) return;
|
|
2849
|
+
let t = await ye(e.editor);
|
|
2850
|
+
F(xe(be(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
2851
|
+
}, re = (t, n) => {
|
|
2819
2852
|
if (e.readOnly) {
|
|
2820
|
-
|
|
2853
|
+
lt(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
|
|
2821
2854
|
return;
|
|
2822
2855
|
}
|
|
2823
2856
|
let r = e.state.active && e.state.pos === t.pos;
|
|
2824
|
-
|
|
2825
|
-
},
|
|
2857
|
+
Te(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
|
|
2858
|
+
}, z = (t) => {
|
|
2826
2859
|
if (e.readOnly || !S.value) return;
|
|
2827
2860
|
let n = e.state.active && e.state.pos === S.value.pos;
|
|
2828
|
-
|
|
2861
|
+
we(e.editor, S.value.pos, t) && (t === "mermaid" && Te(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
|
|
2862
|
+
}, ie = () => {
|
|
2863
|
+
e.readOnly || !S.value || Ce(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
2829
2864
|
}, ae = () => {
|
|
2830
|
-
e.readOnly || !S.value || Se(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
2831
|
-
}, oe = () => {
|
|
2832
2865
|
if (!S.value) return;
|
|
2833
|
-
let t =
|
|
2866
|
+
let t = Ue(e.editor, S.value.pos);
|
|
2834
2867
|
if (!t) return;
|
|
2835
2868
|
let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
2836
2869
|
i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
|
|
2837
|
-
},
|
|
2870
|
+
}, oe = () => {
|
|
2838
2871
|
if (!S.value) return;
|
|
2839
|
-
let t =
|
|
2840
|
-
t && (f.value =
|
|
2872
|
+
let t = Ue(e.editor, S.value.pos);
|
|
2873
|
+
t && (f.value = je(t), p.value = null, m.value = !1, h.value = {
|
|
2841
2874
|
active: !1,
|
|
2842
2875
|
lastX: 0,
|
|
2843
2876
|
lastY: 0
|
|
2844
2877
|
});
|
|
2845
|
-
},
|
|
2878
|
+
}, se = (e) => {
|
|
2846
2879
|
f.value = f.value ? {
|
|
2847
2880
|
...f.value,
|
|
2848
|
-
scale:
|
|
2881
|
+
scale: De(f.value.scale + e)
|
|
2849
2882
|
} : null;
|
|
2850
2883
|
}, ce = () => {
|
|
2851
|
-
f.value = f.value ?
|
|
2884
|
+
f.value = f.value ? je(f.value.svg) : null, h.value = {
|
|
2852
2885
|
active: !1,
|
|
2853
2886
|
lastX: 0,
|
|
2854
2887
|
lastY: 0
|
|
2855
2888
|
}, m.value = !1;
|
|
2856
2889
|
}, le = (e) => {
|
|
2857
|
-
e.preventDefault(),
|
|
2890
|
+
e.preventDefault(), se(e.deltaY < 0 ? Ke : -Ke);
|
|
2858
2891
|
}, ue = (e) => {
|
|
2859
2892
|
e.button === 0 && (e.preventDefault(), h.value = {
|
|
2860
2893
|
active: !0,
|
|
@@ -2869,7 +2902,7 @@ var xr = J({
|
|
|
2869
2902
|
active: !0,
|
|
2870
2903
|
lastX: e.clientX,
|
|
2871
2904
|
lastY: e.clientY
|
|
2872
|
-
}, f.value =
|
|
2905
|
+
}, f.value = qe(f.value, n, r);
|
|
2873
2906
|
}, fe = () => {
|
|
2874
2907
|
h.value = {
|
|
2875
2908
|
active: !1,
|
|
@@ -2879,10 +2912,10 @@ var xr = J({
|
|
|
2879
2912
|
};
|
|
2880
2913
|
W(() => e.readOnly, (e) => {
|
|
2881
2914
|
e && (c.value = !1, l.value = "");
|
|
2882
|
-
}), W(
|
|
2915
|
+
}), W(te, () => {
|
|
2883
2916
|
F(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
|
|
2884
2917
|
}), W(c, async (e) => {
|
|
2885
|
-
e && (await q(),
|
|
2918
|
+
e && (await q(), R(), r.value?.focus({ preventScroll: !0 }));
|
|
2886
2919
|
}), W(() => [
|
|
2887
2920
|
E.value,
|
|
2888
2921
|
g.value,
|
|
@@ -2890,12 +2923,12 @@ var xr = J({
|
|
|
2890
2923
|
c.value,
|
|
2891
2924
|
A.value
|
|
2892
2925
|
], async () => {
|
|
2893
|
-
await q(),
|
|
2926
|
+
await q(), R();
|
|
2894
2927
|
}, {
|
|
2895
2928
|
flush: "post",
|
|
2896
2929
|
immediate: !0
|
|
2897
2930
|
}), W(N, async () => {
|
|
2898
|
-
await q(),
|
|
2931
|
+
await q(), L(), window.requestAnimationFrame(L);
|
|
2899
2932
|
}, {
|
|
2900
2933
|
flush: "post",
|
|
2901
2934
|
immediate: !0
|
|
@@ -2905,14 +2938,14 @@ var xr = J({
|
|
|
2905
2938
|
q(() => {
|
|
2906
2939
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
2907
2940
|
if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
|
|
2908
|
-
let r =
|
|
2941
|
+
let r = ze(e.editor, n.target), a = Be(e.editor, r), o = a && !We(e.editor, a) ? a.pos : null;
|
|
2909
2942
|
i.value = i.value === o ? i.value : o;
|
|
2910
2943
|
}, a = () => {
|
|
2911
2944
|
c.value || (i.value = null);
|
|
2912
2945
|
}, o = (t) => {
|
|
2913
2946
|
if (t.key === "Escape") {
|
|
2914
2947
|
if (f.value) {
|
|
2915
|
-
|
|
2948
|
+
I();
|
|
2916
2949
|
return;
|
|
2917
2950
|
}
|
|
2918
2951
|
c.value && (c.value = !1, e.editor.view.focus());
|
|
@@ -2920,14 +2953,14 @@ var xr = J({
|
|
|
2920
2953
|
}, s = (e) => {
|
|
2921
2954
|
c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
|
|
2922
2955
|
}, l = ({ transaction: e }) => {
|
|
2923
|
-
e.getMeta(
|
|
2956
|
+
e.getMeta(ve) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(ve) || st(e)) && (v.value += 1);
|
|
2924
2957
|
};
|
|
2925
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize",
|
|
2926
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize",
|
|
2958
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", R), window.addEventListener("scroll", R, !0), window.addEventListener("resize", L), window.addEventListener("scroll", L, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), pe = () => {
|
|
2959
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", R), window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", L), window.removeEventListener("scroll", L, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), P();
|
|
2927
2960
|
};
|
|
2928
2961
|
});
|
|
2929
2962
|
}), K(() => {
|
|
2930
|
-
pe?.(), pe = null,
|
|
2963
|
+
pe?.(), pe = null, P();
|
|
2931
2964
|
}), () => {
|
|
2932
2965
|
if (!E.value && M.value.length === 0 && !f.value) return null;
|
|
2933
2966
|
let i = a.value ? {
|
|
@@ -2961,7 +2994,7 @@ var xr = J({
|
|
|
2961
2994
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
2962
2995
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
2963
2996
|
onMousedown: $,
|
|
2964
|
-
onClick: () =>
|
|
2997
|
+
onClick: () => re(e, t)
|
|
2965
2998
|
}, t === "code" ? "Code" : "Preview")));
|
|
2966
2999
|
}),
|
|
2967
3000
|
E.value && S.value ? B("div", {
|
|
@@ -2998,7 +3031,7 @@ var xr = J({
|
|
|
2998
3031
|
"data-testid": "markweave-codeblock-collapse",
|
|
2999
3032
|
"data-collapsed": T.value ? "true" : "false",
|
|
3000
3033
|
onMousedown: $,
|
|
3001
|
-
onClick:
|
|
3034
|
+
onClick: ie
|
|
3002
3035
|
}, [Q("chevron")]) : null,
|
|
3003
3036
|
B("span", { class: "markweave-codeblock-copy-wrap" }, [B("button", {
|
|
3004
3037
|
type: "button",
|
|
@@ -3020,7 +3053,7 @@ var xr = J({
|
|
|
3020
3053
|
d.value = !1;
|
|
3021
3054
|
},
|
|
3022
3055
|
onClick: () => {
|
|
3023
|
-
|
|
3056
|
+
ne();
|
|
3024
3057
|
}
|
|
3025
3058
|
}, [Q(k.value === "copied" ? "check" : "clipboard")]), d.value ? B("span", {
|
|
3026
3059
|
class: "markweave-codeblock-tooltip",
|
|
@@ -3037,7 +3070,7 @@ var xr = J({
|
|
|
3037
3070
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
3038
3071
|
disabled: !j.value,
|
|
3039
3072
|
onMousedown: $,
|
|
3040
|
-
onClick:
|
|
3073
|
+
onClick: oe
|
|
3041
3074
|
}, [Q("expand")]), B("button", {
|
|
3042
3075
|
type: "button",
|
|
3043
3076
|
class: "markweave-codeblock-icon-button",
|
|
@@ -3045,7 +3078,7 @@ var xr = J({
|
|
|
3045
3078
|
"data-testid": "markweave-mermaid-download",
|
|
3046
3079
|
disabled: !j.value,
|
|
3047
3080
|
onMousedown: $,
|
|
3048
|
-
onClick:
|
|
3081
|
+
onClick: ae
|
|
3049
3082
|
}, [Q("download")])]) : null
|
|
3050
3083
|
]) : null,
|
|
3051
3084
|
D.value && E.value && c.value && S.value ? B("div", {
|
|
@@ -3076,7 +3109,7 @@ var xr = J({
|
|
|
3076
3109
|
"data-testid": `markweave-codeblock-language-option-${e.language}`,
|
|
3077
3110
|
"data-active": t ? "true" : "false",
|
|
3078
3111
|
onMousedown: $,
|
|
3079
|
-
onClick: () =>
|
|
3112
|
+
onClick: () => z(e.language)
|
|
3080
3113
|
}, [B("span", null, e.label), t ? Q("check") : null]);
|
|
3081
3114
|
}))]) : null,
|
|
3082
3115
|
f.value ? B("div", {
|
|
@@ -3107,12 +3140,12 @@ var xr = J({
|
|
|
3107
3140
|
onBlur: () => {
|
|
3108
3141
|
p.value = null;
|
|
3109
3142
|
},
|
|
3110
|
-
onClick: () =>
|
|
3143
|
+
onClick: () => se(-Ke)
|
|
3111
3144
|
}, [Q("zoomOut")]),
|
|
3112
3145
|
B("span", {
|
|
3113
3146
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3114
3147
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3115
|
-
},
|
|
3148
|
+
}, Fe(f.value.scale)),
|
|
3116
3149
|
B("button", {
|
|
3117
3150
|
type: "button",
|
|
3118
3151
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -3130,7 +3163,7 @@ var xr = J({
|
|
|
3130
3163
|
onBlur: () => {
|
|
3131
3164
|
p.value = null;
|
|
3132
3165
|
},
|
|
3133
|
-
onClick: () =>
|
|
3166
|
+
onClick: () => se(Ke)
|
|
3134
3167
|
}, [Q("zoomIn")]),
|
|
3135
3168
|
B("button", {
|
|
3136
3169
|
type: "button",
|
|
@@ -3162,7 +3195,7 @@ var xr = J({
|
|
|
3162
3195
|
class: "markweave-mermaid-fullscreen-close",
|
|
3163
3196
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
3164
3197
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3165
|
-
onClick:
|
|
3198
|
+
onClick: I
|
|
3166
3199
|
}, [Q("close")]),
|
|
3167
3200
|
B("div", {
|
|
3168
3201
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
@@ -3189,7 +3222,7 @@ var xr = J({
|
|
|
3189
3222
|
]);
|
|
3190
3223
|
};
|
|
3191
3224
|
}
|
|
3192
|
-
}),
|
|
3225
|
+
}), kr = J({
|
|
3193
3226
|
name: "MarkweaveVueInnerToc",
|
|
3194
3227
|
props: {
|
|
3195
3228
|
editor: {
|
|
@@ -3215,7 +3248,7 @@ var xr = J({
|
|
|
3215
3248
|
},
|
|
3216
3249
|
setup(e) {
|
|
3217
3250
|
let t = V(null), n, r = () => {
|
|
3218
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
3251
|
+
n?.(), n = e.placement === "container" && t.value ? ge(t.value) : void 0;
|
|
3219
3252
|
};
|
|
3220
3253
|
return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
|
|
3221
3254
|
ref: t,
|
|
@@ -3238,20 +3271,20 @@ var xr = J({
|
|
|
3238
3271
|
"aria-current": t.active ? "location" : void 0,
|
|
3239
3272
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
3240
3273
|
title: t.text,
|
|
3241
|
-
onClick: () =>
|
|
3274
|
+
onClick: () => _e(e.editor, t, {
|
|
3242
3275
|
behavior: "smooth",
|
|
3243
3276
|
focus: e.editable
|
|
3244
3277
|
})
|
|
3245
3278
|
}, t.text)))])]) : null;
|
|
3246
3279
|
}
|
|
3247
3280
|
});
|
|
3248
|
-
function
|
|
3249
|
-
let t = m(e.lang), r = p(t), i = f(t), a = V(l(e.mode)), o = U(() => a.value === "live" && e.editable !== !1), s = V(0), c = H(null), d = V(
|
|
3281
|
+
function Ar(e = {}) {
|
|
3282
|
+
let t = m(e.lang), r = p(t), i = f(t), a = V(l(e.mode)), o = U(() => a.value === "live" && e.editable !== !1), s = V(0), c = H(null), d = V(vt), h = H(null), g = H(null), _ = V("code"), v = H(null), y = H(Tt), b = V(null), x = V(!1), S = I(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), C = e.onSlashCommandUpload, w = H(null);
|
|
3250
3283
|
w.value = new n({
|
|
3251
|
-
extensions:
|
|
3284
|
+
extensions: dr({
|
|
3252
3285
|
lang: t,
|
|
3253
|
-
onImageUpload: (e) => C?.(e) ??
|
|
3254
|
-
onVideoUpload: (e) => C?.(e) ??
|
|
3286
|
+
onImageUpload: (e) => C?.(e) ?? j(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3287
|
+
onVideoUpload: (e) => C?.(e) ?? j(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
|
|
3255
3288
|
}),
|
|
3256
3289
|
content: e.content ?? e.defaultContent ?? "",
|
|
3257
3290
|
contentType: P(S),
|
|
@@ -3268,16 +3301,16 @@ function Or(e = {}) {
|
|
|
3268
3301
|
},
|
|
3269
3302
|
handleClick: (e, t, n) => {
|
|
3270
3303
|
if (!o.value) return oe(n);
|
|
3271
|
-
let r =
|
|
3272
|
-
return r ? (n.preventDefault(), n.stopPropagation(), E(),
|
|
3304
|
+
let r = tt(e, n);
|
|
3305
|
+
return r ? (n.preventDefault(), n.stopPropagation(), E(), at(e, r, !0), ot(e, r), v.value = r, !0) : (v.value = null, !1);
|
|
3273
3306
|
},
|
|
3274
3307
|
handleDOMEvents: {
|
|
3275
|
-
compositionstart: () => o.value ? (d.value =
|
|
3308
|
+
compositionstart: () => o.value ? (d.value = yt(d.value, { type: "composition-start" }), h.value = null, !1) : !1,
|
|
3276
3309
|
compositionend: (e) => (o.value && window.setTimeout(() => D(e), 0), !1),
|
|
3277
3310
|
click: (e, t) => {
|
|
3278
3311
|
if (!o.value) return oe(t);
|
|
3279
|
-
let n =
|
|
3280
|
-
return n ? (t.preventDefault(), t.stopPropagation(), E(),
|
|
3312
|
+
let n = tt(e, t);
|
|
3313
|
+
return n ? (t.preventDefault(), t.stopPropagation(), E(), at(e, n, !0), ot(e, n), v.value = n, !0) : (v.value = null, !1);
|
|
3281
3314
|
}
|
|
3282
3315
|
}
|
|
3283
3316
|
},
|
|
@@ -3286,98 +3319,98 @@ function Or(e = {}) {
|
|
|
3286
3319
|
u(t, {
|
|
3287
3320
|
mode: a.value,
|
|
3288
3321
|
editable: o.value
|
|
3289
|
-
}),
|
|
3322
|
+
}), ct(t, o.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && o.value && St(t), A(t), k(t), s.value += 1;
|
|
3290
3323
|
},
|
|
3291
3324
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3292
|
-
if (
|
|
3293
|
-
let t =
|
|
3325
|
+
if (A(e), (t.docChanged || st(t)) && (s.value += 1), t.docChanged && v.value) {
|
|
3326
|
+
let t = et(e, v.value.pos);
|
|
3294
3327
|
v.value = t?.kind === v.value.kind ? t : null;
|
|
3295
3328
|
}
|
|
3296
3329
|
},
|
|
3297
3330
|
onUpdate: ({ editor: t }) => {
|
|
3298
|
-
k(t), o.value && O(t), x.value || e.onUpdate?.(
|
|
3331
|
+
k(t), o.value && O(t), x.value || e.onUpdate?.(te(t));
|
|
3299
3332
|
}
|
|
3300
3333
|
});
|
|
3301
3334
|
let T = U(() => w.value ?? null);
|
|
3302
3335
|
function E() {
|
|
3303
|
-
h.value = null, g.value = null, d.value =
|
|
3336
|
+
h.value = null, g.value = null, d.value = vt;
|
|
3304
3337
|
}
|
|
3305
3338
|
function D(e) {
|
|
3306
|
-
let t =
|
|
3339
|
+
let t = _t(e.state);
|
|
3307
3340
|
if (!t) {
|
|
3308
|
-
d.value = d.value.name === "idle" ? d.value :
|
|
3341
|
+
d.value = d.value.name === "idle" ? d.value : vt, h.value = null, g.value = null;
|
|
3309
3342
|
return;
|
|
3310
3343
|
}
|
|
3311
3344
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3312
|
-
h.value =
|
|
3345
|
+
h.value = gt(n, {
|
|
3313
3346
|
frameRect: i,
|
|
3314
3347
|
triggerRect: r
|
|
3315
|
-
}), d.value =
|
|
3348
|
+
}), d.value = ht(d.value, t);
|
|
3316
3349
|
}
|
|
3317
3350
|
function O(e) {
|
|
3318
3351
|
D(e.view);
|
|
3319
3352
|
}
|
|
3320
3353
|
function k(e) {
|
|
3321
|
-
c.value =
|
|
3322
|
-
let t =
|
|
3323
|
-
t && (
|
|
3324
|
-
let n =
|
|
3354
|
+
c.value = ce(e);
|
|
3355
|
+
let t = nt(e);
|
|
3356
|
+
t && (it(e, t, !0), v.value = t);
|
|
3357
|
+
let n = be(e);
|
|
3325
3358
|
n.active && n.language === "mermaid" && (_.value = n.mermaidPreviewMode);
|
|
3326
3359
|
}
|
|
3327
|
-
function
|
|
3328
|
-
y.value =
|
|
3360
|
+
function A(e) {
|
|
3361
|
+
y.value = mr(e);
|
|
3329
3362
|
}
|
|
3330
|
-
let M = U(() => T.value ?
|
|
3331
|
-
active:
|
|
3363
|
+
let M = U(() => T.value ? be(T.value) : pr), N = U(() => T.value ? Ct(T.value.state) : fr), L = U(() => c.value?.currentNode === "codeBlock"), R = U(() => L.value && M.value.language === "mermaid"), ne = U(() => T.value ? ut({
|
|
3364
|
+
active: R.value,
|
|
3332
3365
|
mode: _.value,
|
|
3333
3366
|
source: M.value.text
|
|
3334
|
-
}) :
|
|
3367
|
+
}) : ut({
|
|
3335
3368
|
active: !1,
|
|
3336
3369
|
mode: "code",
|
|
3337
3370
|
source: ""
|
|
3338
|
-
})),
|
|
3371
|
+
})), re = U(() => T.value ? xt(T.value.state) : null), z = U(() => T.value ? pe(T.value.state.doc) : de.items), ie = U(() => me(z.value, b.value)), ae = U(() => ue(z.value, ie.value)), le = U(() => dt(d.value.query, i)), he = U(() => se({
|
|
3339
3372
|
revision: s.value,
|
|
3340
3373
|
mode: a.value,
|
|
3341
3374
|
editable: o.value,
|
|
3342
|
-
toc:
|
|
3375
|
+
toc: ae.value,
|
|
3343
3376
|
selection: c.value,
|
|
3344
3377
|
slash: d.value,
|
|
3345
|
-
table:
|
|
3378
|
+
table: N.value,
|
|
3346
3379
|
tableInteraction: y.value,
|
|
3347
3380
|
codeBlock: M.value,
|
|
3348
|
-
mermaid:
|
|
3349
|
-
tableDebugSnapshot:
|
|
3381
|
+
mermaid: ne.value,
|
|
3382
|
+
tableDebugSnapshot: re.value
|
|
3350
3383
|
})), ge = {
|
|
3351
3384
|
closeSlashMenu: E,
|
|
3352
|
-
focusFirstTableBodyCell: () => T.value ?
|
|
3385
|
+
focusFirstTableBodyCell: () => T.value ? St(T.value) : !1,
|
|
3353
3386
|
setContent: (e, t = {}) => {
|
|
3354
3387
|
if (!T.value) return !1;
|
|
3355
|
-
let n =
|
|
3388
|
+
let n = I(t.format);
|
|
3356
3389
|
return T.value.commands.setContent(e, {
|
|
3357
3390
|
contentType: P(n),
|
|
3358
3391
|
emitUpdate: t.emitUpdate ?? !1
|
|
3359
|
-
}), t.focusFirstTableBodyCell &&
|
|
3392
|
+
}), t.focusFirstTableBodyCell && St(T.value), k(T.value), o.value && O(T.value), A(T.value), s.value += 1, !0;
|
|
3360
3393
|
}
|
|
3361
3394
|
};
|
|
3362
3395
|
function _e(e, t) {
|
|
3363
|
-
if (!(!T.value || !o.value || !
|
|
3396
|
+
if (!(!T.value || !o.value || !ft(e))) {
|
|
3364
3397
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3365
3398
|
g.value = e;
|
|
3366
3399
|
return;
|
|
3367
3400
|
}
|
|
3368
|
-
|
|
3401
|
+
mt(T.value, d.value, e, t), d.value = yt(d.value, { type: "execute" }), E();
|
|
3369
3402
|
}
|
|
3370
3403
|
}
|
|
3371
3404
|
function ve(e) {
|
|
3372
3405
|
if (!T.value || g.value || !o.value) return;
|
|
3373
|
-
let t =
|
|
3406
|
+
let t = pt(d.value, le.value, e.key, { isComposing: e.isComposing || ee(T.value.state) });
|
|
3374
3407
|
if (t.type !== "ignore") {
|
|
3375
3408
|
if (e.preventDefault(), t.type === "close") {
|
|
3376
|
-
d.value =
|
|
3409
|
+
d.value = yt(d.value, { type: "escape" }), E();
|
|
3377
3410
|
return;
|
|
3378
3411
|
}
|
|
3379
3412
|
if (t.type === "move-active") {
|
|
3380
|
-
d.value =
|
|
3413
|
+
d.value = yt(d.value, {
|
|
3381
3414
|
type: "move-active",
|
|
3382
3415
|
delta: t.delta,
|
|
3383
3416
|
optionCount: t.optionCount
|
|
@@ -3391,36 +3424,36 @@ function Or(e = {}) {
|
|
|
3391
3424
|
a.value = l(e.mode), T.value && (T.value.setEditable(o.value), u(T.value, {
|
|
3392
3425
|
mode: a.value,
|
|
3393
3426
|
editable: o.value
|
|
3394
|
-
}),
|
|
3427
|
+
}), ct(T.value, o.value ? "live" : "view"), o.value || E());
|
|
3395
3428
|
}, { immediate: !0 }), W(() => e.content, (t) => {
|
|
3396
|
-
!T.value || t === void 0 ||
|
|
3397
|
-
contentType: P(
|
|
3429
|
+
!T.value || t === void 0 || F(T.value, t, I(e.contentFormat)) || (x.value = !0, T.value.commands.setContent(t, {
|
|
3430
|
+
contentType: P(I(e.contentFormat)),
|
|
3398
3431
|
emitUpdate: !1
|
|
3399
|
-
}), x.value = !1, k(T.value), o.value && O(T.value),
|
|
3400
|
-
}), W(he, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(
|
|
3401
|
-
let t =
|
|
3432
|
+
}), x.value = !1, k(T.value), o.value && O(T.value), A(T.value), s.value += 1);
|
|
3433
|
+
}), W(he, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(ae, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
|
|
3434
|
+
let t = me(e, b.value);
|
|
3402
3435
|
b.value !== t && (b.value = t);
|
|
3403
3436
|
});
|
|
3404
|
-
let
|
|
3437
|
+
let ye = null;
|
|
3405
3438
|
return G(() => {
|
|
3406
3439
|
let e = () => {
|
|
3407
|
-
if (!T.value || !
|
|
3440
|
+
if (!T.value || !z.value.length) {
|
|
3408
3441
|
b.value = null;
|
|
3409
3442
|
return;
|
|
3410
3443
|
}
|
|
3411
3444
|
let e = null;
|
|
3412
3445
|
try {
|
|
3413
|
-
e =
|
|
3446
|
+
e = fe(T.value, z.value);
|
|
3414
3447
|
} catch {
|
|
3415
3448
|
return;
|
|
3416
3449
|
}
|
|
3417
3450
|
b.value !== e && (b.value = e);
|
|
3418
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
3419
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
3451
|
+
}, t = () => window.requestAnimationFrame(e), n = hr(T.value?.view.dom ?? null);
|
|
3452
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), ye = () => {
|
|
3420
3453
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3421
3454
|
};
|
|
3422
3455
|
}), K(() => {
|
|
3423
|
-
|
|
3456
|
+
ye?.(), w.value?.destroy(), w.value = null;
|
|
3424
3457
|
}), {
|
|
3425
3458
|
editor: T,
|
|
3426
3459
|
runtimeSnapshot: he,
|
|
@@ -3428,17 +3461,17 @@ function Or(e = {}) {
|
|
|
3428
3461
|
__render: {
|
|
3429
3462
|
messages: r,
|
|
3430
3463
|
effectiveEditable: o,
|
|
3431
|
-
tableFocusState:
|
|
3464
|
+
tableFocusState: N,
|
|
3432
3465
|
tableInteractionState: y,
|
|
3433
3466
|
codeBlockState: M,
|
|
3434
|
-
isCodeBlockActive:
|
|
3467
|
+
isCodeBlockActive: L,
|
|
3435
3468
|
mermaidMode: _,
|
|
3436
3469
|
mathTarget: v,
|
|
3437
3470
|
setMermaidMode: (e) => {
|
|
3438
3471
|
_.value = e;
|
|
3439
3472
|
},
|
|
3440
|
-
tocState:
|
|
3441
|
-
filteredSlashCommands:
|
|
3473
|
+
tocState: ae,
|
|
3474
|
+
filteredSlashCommands: le,
|
|
3442
3475
|
slashState: d,
|
|
3443
3476
|
slashMenuPosition: h,
|
|
3444
3477
|
slashInputCommand: g,
|
|
@@ -3450,7 +3483,7 @@ function Or(e = {}) {
|
|
|
3450
3483
|
}
|
|
3451
3484
|
};
|
|
3452
3485
|
}
|
|
3453
|
-
var
|
|
3486
|
+
var jr = J({
|
|
3454
3487
|
name: "MarkweaveEditor",
|
|
3455
3488
|
props: {
|
|
3456
3489
|
defaultContent: {
|
|
@@ -3543,7 +3576,7 @@ var kr = J({
|
|
|
3543
3576
|
}
|
|
3544
3577
|
},
|
|
3545
3578
|
setup(e) {
|
|
3546
|
-
let t =
|
|
3579
|
+
let t = Ar(e);
|
|
3547
3580
|
return () => {
|
|
3548
3581
|
let n = t.editor.value;
|
|
3549
3582
|
if (!n) return null;
|
|
@@ -3554,16 +3587,16 @@ var kr = J({
|
|
|
3554
3587
|
"data-testid": "markweave-editor-frame",
|
|
3555
3588
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
3556
3589
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
3557
|
-
"data-markweave-inner-toc-placement":
|
|
3590
|
+
"data-markweave-inner-toc-placement": he(e.innerTocPlacement),
|
|
3558
3591
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
3559
3592
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
3560
3593
|
onKeydownCapture: i.handleEditorKeyDown
|
|
3561
3594
|
}, [
|
|
3562
|
-
i.effectiveEditable.value ? B(
|
|
3595
|
+
i.effectiveEditable.value ? B(Cr, {
|
|
3563
3596
|
editor: n,
|
|
3564
3597
|
messages: i.messages
|
|
3565
3598
|
}) : null,
|
|
3566
|
-
i.effectiveEditable.value ? B(
|
|
3599
|
+
i.effectiveEditable.value ? B(Tr, {
|
|
3567
3600
|
commands: i.filteredSlashCommands.value,
|
|
3568
3601
|
state: i.slashState.value,
|
|
3569
3602
|
position: i.slashMenuPosition.value,
|
|
@@ -3573,7 +3606,7 @@ var kr = J({
|
|
|
3573
3606
|
onInputCommandChange: i.setSlashInputCommand,
|
|
3574
3607
|
onUpload: e.onSlashCommandUpload
|
|
3575
3608
|
}) : null,
|
|
3576
|
-
i.effectiveEditable.value ? B(
|
|
3609
|
+
i.effectiveEditable.value ? B(Er, {
|
|
3577
3610
|
editor: n,
|
|
3578
3611
|
active: i.tableFocusState.value.active,
|
|
3579
3612
|
interactionState: i.tableInteractionState.value,
|
|
@@ -3582,11 +3615,11 @@ var kr = J({
|
|
|
3582
3615
|
onCommandResult: e.onTableCommandResult,
|
|
3583
3616
|
onEditWithAi: e.onEditWithAi
|
|
3584
3617
|
}) : null,
|
|
3585
|
-
i.effectiveEditable.value ? B(
|
|
3618
|
+
i.effectiveEditable.value ? B(Dr, {
|
|
3586
3619
|
editor: n,
|
|
3587
3620
|
focusState: i.tableFocusState.value
|
|
3588
3621
|
}) : null,
|
|
3589
|
-
B(
|
|
3622
|
+
B(Or, {
|
|
3590
3623
|
editor: n,
|
|
3591
3624
|
state: i.codeBlockState.value,
|
|
3592
3625
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -3594,14 +3627,14 @@ var kr = J({
|
|
|
3594
3627
|
onMermaidModeChange: i.setMermaidMode,
|
|
3595
3628
|
readOnly: !i.effectiveEditable.value
|
|
3596
3629
|
}),
|
|
3597
|
-
e.innerToc && i.tocState.value.items.length ? B(
|
|
3630
|
+
e.innerToc && i.tocState.value.items.length ? B(kr, {
|
|
3598
3631
|
editor: n,
|
|
3599
3632
|
state: i.tocState.value,
|
|
3600
3633
|
messages: i.messages,
|
|
3601
3634
|
editable: i.effectiveEditable.value,
|
|
3602
|
-
placement:
|
|
3635
|
+
placement: he(e.innerTocPlacement)
|
|
3603
3636
|
}) : null,
|
|
3604
|
-
i.effectiveEditable.value && i.mathTarget.value ? B(
|
|
3637
|
+
i.effectiveEditable.value && i.mathTarget.value ? B(wr, {
|
|
3605
3638
|
editor: n,
|
|
3606
3639
|
messages: i.messages,
|
|
3607
3640
|
target: i.mathTarget.value,
|
|
@@ -3613,4 +3646,4 @@ var kr = J({
|
|
|
3613
3646
|
}
|
|
3614
3647
|
});
|
|
3615
3648
|
//#endregion
|
|
3616
|
-
export {
|
|
3649
|
+
export { jr as MarkweaveEditor, dr as createMarkweaveEditorExtensions, dr as createMarkweaveVue2EditorExtensions, Ar as useMarkweaveEditorController };
|