@markweave/vue2 0.1.6 → 0.1.7
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
CHANGED
|
@@ -5,50 +5,51 @@ 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
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
|
|
9
|
-
import { detectUploadSource as
|
|
10
|
-
import { BubbleMenu as
|
|
11
|
-
import { isEditorComposing as
|
|
12
|
-
import { createMarkweaveFrameScheduler as
|
|
13
|
-
import { createMarkweaveEditorUpdatePayload as
|
|
14
|
-
import { getCurrentFloatingToolbarBlockType as
|
|
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 ee, numberAttribute as D, stringAttribute as O } from "markweave/internal/plugins/media/core-media-nodes";
|
|
9
|
+
import { detectUploadSource as k, getDirectUploadResult as A, resolveMarkweaveUploadResult as j } from "markweave/internal/plugins/slash-command/upload";
|
|
10
|
+
import { BubbleMenu as M } from "@tiptap/vue-2/menus";
|
|
11
|
+
import { isEditorComposing as te } from "markweave/internal/editor-core/composition-guard";
|
|
12
|
+
import { createMarkweaveFrameScheduler as N } from "markweave/internal/editor-core/frame-scheduler";
|
|
13
|
+
import { createMarkweaveEditorUpdatePayload as ne, getMarkweaveContentType as P, isEditorContentCurrent as re, isMarkweaveControlledContentEchoCurrent as F, normalizeMarkweaveContentFormat as I } from "markweave/internal/editor-core/editor-content";
|
|
14
|
+
import { getCurrentFloatingToolbarBlockType as L, getFloatingToolbarHighlightColorOptions as R, getFloatingToolbarMoreActions as ie, getFloatingToolbarTextColorOptions as ae, getFloatingToolbarTurnIntoOptions as oe, runFloatingToolbarMoreAction as se, setFloatingToolbarTurnInto as ce } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
15
15
|
import { openMarkweaveReadonlyLinkFromEvent as le } from "markweave/internal/editor-core/readonly-link";
|
|
16
16
|
import { createMarkweaveEditorRuntimeSnapshot as ue } from "markweave/internal/editor-core/runtime-snapshot";
|
|
17
|
-
import { areEditorSelectionSnapshotsEquivalent as de, calculateFloatingToolbarPopoverPlacement as
|
|
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 {
|
|
17
|
+
import { areEditorSelectionSnapshotsEquivalent as de, calculateFloatingToolbarPopoverPlacement as fe, createSelectionSnapshot as pe, markweaveRuntimeProjectionDelayMs as me, shouldShowFloatingToolbar as z } from "markweave/internal/editor-core/selection-state";
|
|
18
|
+
import { normalizeMarkweaveTheme as he } from "markweave/internal/core/theme";
|
|
19
|
+
import { createMarkweaveTocState as ge, emptyMarkweaveTocState as _e, getActiveMarkweaveTocId as ve, getMarkweaveTocItems as ye, getValidMarkweaveTocActiveId as be, normalizeMarkweaveInnerTocPlacement as xe, observeMarkweaveInnerTocContainerPosition as Se, scrollToMarkweaveTocItem as Ce } from "markweave/internal/core/toc-state";
|
|
20
|
+
import { codeBlockCollapsePluginKey as we, copyActiveCodeBlock as Te, getActiveCodeBlockState as Ee, getCodeBlockCopyFeedbackSnapshot as De, markweaveCodeBlockBehavior as Oe, setCodeBlockCollapsedAtPosition as ke, setCodeBlockLanguageAtPosition as Ae, setCodeBlockMermaidPreviewModeAtPosition as je } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
21
|
+
import { calculateCodeBlockLanguageMenuPosition as Me, clampFullscreenScale as Ne, codeBlockCopyFeedbackTimeoutMs as Pe, copyCodeBlockText as Fe, createCodeBlockOverlayPosition as Ie, createMermaidFullscreenViewerState as Le, createMermaidTabPosition as Re, focusCodeBlockTarget as ze, formatCodeBlockLanguageLabel as Be, formatFullscreenZoom as Ve, getActiveCodeBlockElement as He, getAnchoredRect as Ue, getCodeBlockLanguageItems as We, getCodeBlockPositionFromEventTarget as Ge, getCodeBlockStateAtPosition as Ke, getFrameElement as qe, getMermaidCodeBlockTargets as Je, getMermaidSvgMarkup as Ye, isCodeBlockTargetCollapsed as Xe, mergeStableMermaidTabPositions as Ze, mermaidFullscreenZoomStep as Qe, moveMermaidFullscreenViewer as $e } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
22
|
+
import { normalizeMarkdownLinkHref as et } from "markweave/internal/plugins/markdown/markdown-input";
|
|
23
|
+
import { applyMarkweaveMathLatex as tt, calculateMarkweaveMathPopoverPosition as nt, getMarkweaveMathAnchorRect as rt, getMarkweaveMathBlockIndex as it, getMarkweaveMathRenderedHtml as at, getMarkweaveMathTargetAtPos as ot, getMarkweaveMathTargetFromDomEvent as st, getMarkweaveMathTargetFromSelection as ct, renderMarkweaveMathPreview as lt, setMarkweaveMathEditingDomState as ut, setMarkweaveMathEditingDomStateInView as dt, setMarkweaveMathSelectionInView as ft } from "markweave/internal/plugins/math/math-ui-model";
|
|
24
|
+
import { isMermaidInlinePreviewTransaction as pt, setMarkweaveMermaidTheme as mt, setMermaidInlinePreviewEditorMode as ht, setReadonlyMermaidPreviewMode as gt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
25
|
+
import { getMermaidPreviewState as _t } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
26
|
+
import { filterSlashCommands as vt, isExecutableSlashCommand as yt } from "markweave/internal/plugins/slash-command/command-spec";
|
|
27
|
+
import { getSlashCommandKeyboardAction as bt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
28
|
+
import { executeSlashCommand as xt, getNextSlashCommandState as St, getSlashCommandAnchoredMenuPosition as Ct, getSlashCommandContext as wt } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
29
|
+
import { initialSlashCommandState as Tt, reduceSlashCommandState as Et } from "markweave/internal/plugins/slash-command/slash-state";
|
|
30
|
+
import { setMarkweaveTableMenuAxisTarget as Dt } from "markweave/internal/plugins/table/table-clipboard";
|
|
31
|
+
import { getFirstTableDebugSnapshot as Ot } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
32
|
+
import { focusFirstTableBodyCell as kt } from "markweave/internal/plugins/table/table-focus-position";
|
|
33
|
+
import { getTableFocusState as At } from "markweave/internal/plugins/table/table-focus-state";
|
|
34
|
+
import { getTableSelectionOverlayState as jt, initialTableInteractionState as Mt, tableInteractionPluginKey as Nt } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
35
|
+
import { calculateAnchoredTableMenuPosition as Pt, calculateTableEdgeHandlePosition as Ft, canRunTableCommand as It, executeTableMenuCommand as Lt, formatTableCopyFeedback as Rt, getActiveTableElement as zt, getAvailableCellMenuCommandSpecs as Bt, getTableAxisTargetRect as Vt, getTableControlAxisSelectionModel as Ht, getTableEditWithAiRequest as Ut, getTableMenuItemGroup as Wt, getTableMenuItemLabel as Gt, getTableMenuItems as Kt, getTableSelectionTargetRect as qt, measureTableSelectionOverlay as Jt, selectTableAxisFromCell as Yt, tableCopyFeedbackTimeoutMs as Xt, tableMenuLabel as Zt } from "markweave/internal/plugins/table/table-ui-model";
|
|
35
36
|
//#region src/vue2-compat.ts
|
|
36
|
-
var
|
|
37
|
-
function
|
|
37
|
+
var Qt = o.default ?? o, $t = null, en = null, tn = null;
|
|
38
|
+
function nn(e) {
|
|
38
39
|
return !!(e && typeof e == "object" && "value" in e);
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function rn(e) {
|
|
41
42
|
let t = e.slice(2);
|
|
42
43
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function an(e) {
|
|
45
46
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
46
47
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
47
48
|
if (o === "class" || o === "style" || o === "key") {
|
|
48
49
|
t[o] = s;
|
|
49
50
|
continue;
|
|
50
51
|
}
|
|
51
|
-
if (o === "ref" &&
|
|
52
|
+
if (o === "ref" && nn(s)) {
|
|
52
53
|
a.insert = (e) => {
|
|
53
54
|
s.value = e.elm;
|
|
54
55
|
}, a.destroy = () => {
|
|
@@ -57,7 +58,7 @@ function nn(e) {
|
|
|
57
58
|
continue;
|
|
58
59
|
}
|
|
59
60
|
if (/^on[A-Z]/.test(o)) {
|
|
60
|
-
i[
|
|
61
|
+
i[rn(o)] = s;
|
|
61
62
|
continue;
|
|
62
63
|
}
|
|
63
64
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -68,14 +69,14 @@ function nn(e) {
|
|
|
68
69
|
}
|
|
69
70
|
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;
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
+
function on(e) {
|
|
72
73
|
let t = {}, n = {}, r = {}, i = {};
|
|
73
74
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
74
75
|
if (a === "class" || a === "style" || a === "key") {
|
|
75
76
|
t[a] = o;
|
|
76
77
|
continue;
|
|
77
78
|
}
|
|
78
|
-
if (a === "ref" &&
|
|
79
|
+
if (a === "ref" && nn(o)) {
|
|
79
80
|
i.insert = (e) => {
|
|
80
81
|
o.value = e.componentInstance ?? e.elm;
|
|
81
82
|
}, i.destroy = () => {
|
|
@@ -91,25 +92,25 @@ function rn(e) {
|
|
|
91
92
|
}
|
|
92
93
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
+
function sn(e) {
|
|
95
96
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
+
function cn(e) {
|
|
98
99
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
+
function ln(e) {
|
|
101
102
|
return e == null || Array.isArray(e) ? e : [e];
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
-
return typeof e == "function" ?
|
|
104
|
+
function un(e) {
|
|
105
|
+
return typeof e == "function" ? ln(e()) : sn(e) ? ln(e.default()) : cn(e) ? [e] : e;
|
|
105
106
|
}
|
|
106
107
|
function B(e, t, n) {
|
|
107
|
-
if (
|
|
108
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
109
|
-
return
|
|
108
|
+
if (!tn) throw Error("Vue 2 render context is not available.");
|
|
109
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? an(r) : on(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : un(n);
|
|
110
|
+
return tn(e, i, a);
|
|
110
111
|
}
|
|
111
112
|
function V(e) {
|
|
112
|
-
return
|
|
113
|
+
return Qt.observable({ value: e });
|
|
113
114
|
}
|
|
114
115
|
var H = V;
|
|
115
116
|
function U(e) {
|
|
@@ -119,19 +120,19 @@ function U(e) {
|
|
|
119
120
|
}
|
|
120
121
|
function W(e, t, n) {
|
|
121
122
|
let r = typeof e == "function" ? e : () => e.value;
|
|
122
|
-
return
|
|
123
|
+
return $t?.$watch ? $t.$watch(r, t, n) : () => void 0;
|
|
123
124
|
}
|
|
124
125
|
function G(e) {
|
|
125
|
-
|
|
126
|
+
en?.mounted.push(e);
|
|
126
127
|
}
|
|
127
128
|
function K(e) {
|
|
128
|
-
|
|
129
|
+
en?.beforeUnmount.push(e);
|
|
129
130
|
}
|
|
130
131
|
function q(e) {
|
|
131
|
-
return
|
|
132
|
+
return Qt.nextTick(e);
|
|
132
133
|
}
|
|
133
134
|
function J(e) {
|
|
134
|
-
return
|
|
135
|
+
return Qt.extend({
|
|
135
136
|
name: e.name,
|
|
136
137
|
props: e.props,
|
|
137
138
|
created() {
|
|
@@ -139,12 +140,12 @@ function J(e) {
|
|
|
139
140
|
mounted: [],
|
|
140
141
|
beforeUnmount: []
|
|
141
142
|
};
|
|
142
|
-
|
|
143
|
+
$t = this, en = t;
|
|
143
144
|
try {
|
|
144
145
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
145
146
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
146
147
|
} finally {
|
|
147
|
-
|
|
148
|
+
$t = null, en = null;
|
|
148
149
|
}
|
|
149
150
|
},
|
|
150
151
|
mounted() {
|
|
@@ -154,19 +155,19 @@ function J(e) {
|
|
|
154
155
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
155
156
|
},
|
|
156
157
|
render(t) {
|
|
157
|
-
|
|
158
|
+
tn = t;
|
|
158
159
|
try {
|
|
159
160
|
let n = this.__markweaveVue2Render;
|
|
160
161
|
return n ? n() : e.render?.(t) ?? null;
|
|
161
162
|
} finally {
|
|
162
|
-
|
|
163
|
+
tn = null;
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
168
|
//#endregion
|
|
168
169
|
//#region src/vue2-icons.ts
|
|
169
|
-
var
|
|
170
|
+
var dn = {
|
|
170
171
|
AlignCenter: {
|
|
171
172
|
iconName: "text-align-center",
|
|
172
173
|
node: [
|
|
@@ -1031,7 +1032,7 @@ var ln = {
|
|
|
1031
1032
|
}]]
|
|
1032
1033
|
}
|
|
1033
1034
|
};
|
|
1034
|
-
function
|
|
1035
|
+
function fn(e) {
|
|
1035
1036
|
return e.map(([e, t]) => B(e, t));
|
|
1036
1037
|
}
|
|
1037
1038
|
function Y(e) {
|
|
@@ -1052,7 +1053,7 @@ function Y(e) {
|
|
|
1052
1053
|
}
|
|
1053
1054
|
},
|
|
1054
1055
|
setup(t) {
|
|
1055
|
-
let n =
|
|
1056
|
+
let n = dn[e];
|
|
1056
1057
|
return () => B("svg", {
|
|
1057
1058
|
class: `lucide lucide-${n.iconName}`,
|
|
1058
1059
|
viewBox: "0 0 24 24",
|
|
@@ -1065,14 +1066,14 @@ function Y(e) {
|
|
|
1065
1066
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1066
1067
|
"aria-hidden": "true",
|
|
1067
1068
|
focusable: "false"
|
|
1068
|
-
},
|
|
1069
|
+
}, fn(n.node));
|
|
1069
1070
|
}
|
|
1070
1071
|
});
|
|
1071
1072
|
}
|
|
1072
|
-
var
|
|
1073
|
+
var pn = Y("AlignCenter"), mn = Y("AlignJustify"), hn = Y("AlignLeft"), gn = Y("AlignRight"), _n = Y("AlertTriangle"), vn = Y("Bold"), yn = Y("Braces"), bn = Y("Captions"), xn = Y("CheckCircle2"), Sn = Y("ChevronDown"), Cn = Y("ChevronUp"), wn = Y("CircleX"), Tn = Y("Code2"), En = Y("CornerDownLeft"), Dn = Y("Download"), On = Y("Eye"), kn = Y("ExternalLink"), An = Y("Heading1"), jn = Y("Heading2"), Mn = Y("Heading3"), Nn = Y("Image"), Pn = Y("ImageUp"), Fn = Y("IndentDecrease"), In = Y("IndentIncrease"), Ln = Y("Info"), Rn = Y("Italic"), zn = Y("Lightbulb"), Bn = Y("Link2"), Vn = Y("List"), Hn = Y("ListChecks"), Un = Y("ListOrdered"), Wn = Y("Minus"), Gn = Y("MoreVertical"), Kn = Y("Paperclip");
|
|
1073
1074
|
Y("PencilLine");
|
|
1074
|
-
var
|
|
1075
|
-
function
|
|
1075
|
+
var qn = Y("Quote"), Jn = Y("Replace"), Yn = Y("Sigma"), Xn = Y("SmilePlus"), Zn = Y("Strikethrough"), Qn = Y("Subscript"), $n = Y("Superscript"), er = Y("Table2"), tr = Y("Text"), nr = Y("Trash2"), rr = Y("Type"), ir = Y("Underline"), ar = Y("Upload"), or = Y("Video"), sr = E;
|
|
1076
|
+
function cr(e) {
|
|
1076
1077
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1077
1078
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1078
1079
|
return n === "view" ? {
|
|
@@ -1094,13 +1095,13 @@ function or(e) {
|
|
|
1094
1095
|
i(), a?.disconnect();
|
|
1095
1096
|
}), r;
|
|
1096
1097
|
}
|
|
1097
|
-
function
|
|
1098
|
+
function lr(e) {
|
|
1098
1099
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1099
1100
|
}
|
|
1100
|
-
function
|
|
1101
|
+
function ur(e) {
|
|
1101
1102
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1102
1103
|
}
|
|
1103
|
-
function
|
|
1104
|
+
function dr(e, t) {
|
|
1104
1105
|
return B(e, {
|
|
1105
1106
|
size: 18,
|
|
1106
1107
|
strokeWidth: 1.8,
|
|
@@ -1116,12 +1117,12 @@ function X(e) {
|
|
|
1116
1117
|
"data-active": e.active ? "true" : "false",
|
|
1117
1118
|
onMousedown: (e) => e.preventDefault(),
|
|
1118
1119
|
onClick: e.onClick
|
|
1119
|
-
}, [
|
|
1120
|
+
}, [dr(e.icon, e.label), B("span", {
|
|
1120
1121
|
class: "markweave-image-tooltip",
|
|
1121
1122
|
role: "tooltip"
|
|
1122
1123
|
}, e.label)]);
|
|
1123
1124
|
}
|
|
1124
|
-
function
|
|
1125
|
+
function fr(e) {
|
|
1125
1126
|
let t = V(null), n = e.messages.image;
|
|
1126
1127
|
return B("section", {
|
|
1127
1128
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1155,7 +1156,7 @@ function ur(e) {
|
|
|
1155
1156
|
B("div", {
|
|
1156
1157
|
class: "markweave-image-upload-icon",
|
|
1157
1158
|
"aria-hidden": "true"
|
|
1158
|
-
}, [B(
|
|
1159
|
+
}, [B(Pn, {
|
|
1159
1160
|
size: 46,
|
|
1160
1161
|
strokeWidth: 1.6
|
|
1161
1162
|
})]),
|
|
@@ -1180,7 +1181,7 @@ function ur(e) {
|
|
|
1180
1181
|
"data-testid": "markweave-image-upload-submit",
|
|
1181
1182
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1182
1183
|
onClick: e.onSubmit
|
|
1183
|
-
}, [B(
|
|
1184
|
+
}, [B(Pn, {
|
|
1184
1185
|
size: 16,
|
|
1185
1186
|
strokeWidth: 1.8
|
|
1186
1187
|
}), e.messages.common.insert]),
|
|
@@ -1196,7 +1197,7 @@ function ur(e) {
|
|
|
1196
1197
|
}, e.error) : null
|
|
1197
1198
|
]);
|
|
1198
1199
|
}
|
|
1199
|
-
function
|
|
1200
|
+
function pr(e) {
|
|
1200
1201
|
let t = V(null), n = e.messages.video;
|
|
1201
1202
|
return B("section", {
|
|
1202
1203
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1230,7 +1231,7 @@ function dr(e) {
|
|
|
1230
1231
|
B("div", {
|
|
1231
1232
|
class: "markweave-video-upload-icon",
|
|
1232
1233
|
"aria-hidden": "true"
|
|
1233
|
-
}, [B(
|
|
1234
|
+
}, [B(or, {
|
|
1234
1235
|
size: 46,
|
|
1235
1236
|
strokeWidth: 1.6
|
|
1236
1237
|
})]),
|
|
@@ -1255,7 +1256,7 @@ function dr(e) {
|
|
|
1255
1256
|
"data-testid": "markweave-video-upload-submit",
|
|
1256
1257
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1257
1258
|
onClick: e.onSubmit
|
|
1258
|
-
}, [B(
|
|
1259
|
+
}, [B(ar, {
|
|
1259
1260
|
size: 16,
|
|
1260
1261
|
strokeWidth: 1.8
|
|
1261
1262
|
}), e.messages.common.insert]),
|
|
@@ -1271,7 +1272,7 @@ function dr(e) {
|
|
|
1271
1272
|
}, e.error) : null
|
|
1272
1273
|
]);
|
|
1273
1274
|
}
|
|
1274
|
-
var
|
|
1275
|
+
var mr = J({
|
|
1275
1276
|
name: "MarkweaveVueImageNodeView",
|
|
1276
1277
|
props: {
|
|
1277
1278
|
editor: {
|
|
@@ -1304,10 +1305,10 @@ var fr = J({
|
|
|
1304
1305
|
}
|
|
1305
1306
|
},
|
|
1306
1307
|
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
|
+
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(!!O(u.value.caption)), f = V(O(u.value.caption) ?? ""), m = cr(e.editor), g = U(() => c(m.value)), _ = U(() => e.extension.options?.messages ?? p("zh")), y = U(() => _.value.image), b = U(() => O(u.value.src)), C = U(() => sr(u.value.align)), T = U(() => D(u.value.width)), E = U(() => O(u.value.caption)), ee = U(() => g.value && (!b.value || r.value)), A = () => {
|
|
1308
1309
|
b.value && h({
|
|
1309
1310
|
src: b.value,
|
|
1310
|
-
alt:
|
|
1311
|
+
alt: O(u.value.alt) ?? "",
|
|
1311
1312
|
messages: {
|
|
1312
1313
|
dialogAriaLabel: y.value.previewDialogAriaLabel,
|
|
1313
1314
|
zoomOut: y.value.previewZoomOut,
|
|
@@ -1320,45 +1321,45 @@ var fr = J({
|
|
|
1320
1321
|
W(E, (e) => {
|
|
1321
1322
|
d.value || (f.value = e ?? "");
|
|
1322
1323
|
});
|
|
1323
|
-
let
|
|
1324
|
+
let M = () => {
|
|
1324
1325
|
if (!g.value) return;
|
|
1325
1326
|
let t = e.getPos();
|
|
1326
1327
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1327
|
-
},
|
|
1328
|
+
}, te = () => {
|
|
1328
1329
|
if (o.value = "", s.value = null, a.value = !1, b.value) {
|
|
1329
1330
|
r.value = !1;
|
|
1330
1331
|
return;
|
|
1331
1332
|
}
|
|
1332
1333
|
e.deleteNode();
|
|
1333
|
-
},
|
|
1334
|
+
}, N = async (t) => {
|
|
1334
1335
|
if (!g.value) return;
|
|
1335
1336
|
let n = e.extension.options;
|
|
1336
1337
|
l.value = !0, s.value = null;
|
|
1337
1338
|
try {
|
|
1338
|
-
let i = await
|
|
1339
|
+
let i = await j(S(t, b.value && r.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1339
1340
|
e.updateAttributes(v(u.value, i)), o.value = "", r.value = !1;
|
|
1340
1341
|
} catch (e) {
|
|
1341
1342
|
s.value = e instanceof Error ? e.message : y.value.uploadFailedError;
|
|
1342
1343
|
} finally {
|
|
1343
1344
|
l.value = !1, a.value = !1;
|
|
1344
1345
|
}
|
|
1345
|
-
},
|
|
1346
|
+
}, ne = () => {
|
|
1346
1347
|
if (!o.value.trim()) {
|
|
1347
1348
|
s.value = y.value.uploadRequiredError;
|
|
1348
1349
|
return;
|
|
1349
1350
|
}
|
|
1350
|
-
|
|
1351
|
-
},
|
|
1352
|
-
|
|
1351
|
+
N(k(o.value));
|
|
1352
|
+
}, P = (e) => {
|
|
1353
|
+
N({
|
|
1353
1354
|
type: "file",
|
|
1354
1355
|
file: e,
|
|
1355
1356
|
mimeType: e.type || "image/*"
|
|
1356
1357
|
});
|
|
1357
|
-
},
|
|
1358
|
+
}, re = () => {
|
|
1358
1359
|
d.value = !d.value, d.value && (f.value = E.value ?? "");
|
|
1359
|
-
},
|
|
1360
|
+
}, F = (n, r) => {
|
|
1360
1361
|
if (!g.value || !b.value) return;
|
|
1361
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1362
|
+
r.preventDefault(), r.stopPropagation(), M();
|
|
1362
1363
|
let i = t.value;
|
|
1363
1364
|
if (!i) return;
|
|
1364
1365
|
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) => {
|
|
@@ -1369,7 +1370,7 @@ var fr = J({
|
|
|
1369
1370
|
};
|
|
1370
1371
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1371
1372
|
};
|
|
1372
|
-
return () =>
|
|
1373
|
+
return () => ee.value ? B(i, {
|
|
1373
1374
|
as: "figure",
|
|
1374
1375
|
class: "markweave-image-node",
|
|
1375
1376
|
"data-testid": "markweave-image-node",
|
|
@@ -1377,7 +1378,7 @@ var fr = J({
|
|
|
1377
1378
|
"data-selected": "false",
|
|
1378
1379
|
"data-hovered": "false",
|
|
1379
1380
|
"data-empty": "true"
|
|
1380
|
-
}, () =>
|
|
1381
|
+
}, () => fr({
|
|
1381
1382
|
messages: _.value,
|
|
1382
1383
|
inputValue: o.value,
|
|
1383
1384
|
error: s.value,
|
|
@@ -1386,9 +1387,9 @@ var fr = J({
|
|
|
1386
1387
|
onInputValue: (e) => {
|
|
1387
1388
|
o.value = e;
|
|
1388
1389
|
},
|
|
1389
|
-
onFile:
|
|
1390
|
-
onSubmit:
|
|
1391
|
-
onCancel:
|
|
1390
|
+
onFile: P,
|
|
1391
|
+
onSubmit: ne,
|
|
1392
|
+
onCancel: te,
|
|
1392
1393
|
onDragActive: (e) => {
|
|
1393
1394
|
a.value = e;
|
|
1394
1395
|
}
|
|
@@ -1407,7 +1408,7 @@ var fr = J({
|
|
|
1407
1408
|
n.value = !1;
|
|
1408
1409
|
},
|
|
1409
1410
|
onMousedown: (e) => {
|
|
1410
|
-
g.value && !
|
|
1411
|
+
g.value && !lr(e.target) && M();
|
|
1411
1412
|
}
|
|
1412
1413
|
}, () => [
|
|
1413
1414
|
g.value ? B("div", {
|
|
@@ -1419,21 +1420,21 @@ var fr = J({
|
|
|
1419
1420
|
X({
|
|
1420
1421
|
testId: "markweave-image-align-left",
|
|
1421
1422
|
label: y.value.alignLeft,
|
|
1422
|
-
icon:
|
|
1423
|
+
icon: hn,
|
|
1423
1424
|
active: C.value === "left",
|
|
1424
1425
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1425
1426
|
}),
|
|
1426
1427
|
X({
|
|
1427
1428
|
testId: "markweave-image-align-center",
|
|
1428
1429
|
label: y.value.alignCenter,
|
|
1429
|
-
icon:
|
|
1430
|
+
icon: pn,
|
|
1430
1431
|
active: C.value === "center",
|
|
1431
1432
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1432
1433
|
}),
|
|
1433
1434
|
X({
|
|
1434
1435
|
testId: "markweave-image-align-right",
|
|
1435
1436
|
label: y.value.alignRight,
|
|
1436
|
-
icon:
|
|
1437
|
+
icon: gn,
|
|
1437
1438
|
active: C.value === "right",
|
|
1438
1439
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1439
1440
|
}),
|
|
@@ -1444,20 +1445,20 @@ var fr = J({
|
|
|
1444
1445
|
X({
|
|
1445
1446
|
testId: "markweave-image-caption",
|
|
1446
1447
|
label: y.value.caption,
|
|
1447
|
-
icon:
|
|
1448
|
+
icon: bn,
|
|
1448
1449
|
active: d.value || !!E.value,
|
|
1449
|
-
onClick:
|
|
1450
|
+
onClick: re
|
|
1450
1451
|
}),
|
|
1451
1452
|
X({
|
|
1452
1453
|
testId: "markweave-image-preview",
|
|
1453
1454
|
label: y.value.preview,
|
|
1454
|
-
icon:
|
|
1455
|
-
onClick:
|
|
1455
|
+
icon: On,
|
|
1456
|
+
onClick: A
|
|
1456
1457
|
}),
|
|
1457
1458
|
X({
|
|
1458
1459
|
testId: "markweave-image-download",
|
|
1459
1460
|
label: y.value.download,
|
|
1460
|
-
icon:
|
|
1461
|
+
icon: Dn,
|
|
1461
1462
|
onClick: () => {
|
|
1462
1463
|
b.value && w(b.value);
|
|
1463
1464
|
}
|
|
@@ -1465,7 +1466,7 @@ var fr = J({
|
|
|
1465
1466
|
X({
|
|
1466
1467
|
testId: "markweave-image-replace",
|
|
1467
1468
|
label: y.value.replace,
|
|
1468
|
-
icon:
|
|
1469
|
+
icon: Jn,
|
|
1469
1470
|
onClick: () => {
|
|
1470
1471
|
o.value = "", s.value = null, r.value = !0;
|
|
1471
1472
|
}
|
|
@@ -1477,7 +1478,7 @@ var fr = J({
|
|
|
1477
1478
|
X({
|
|
1478
1479
|
testId: "markweave-image-delete",
|
|
1479
1480
|
label: y.value.delete,
|
|
1480
|
-
icon:
|
|
1481
|
+
icon: nr,
|
|
1481
1482
|
onClick: () => e.deleteNode()
|
|
1482
1483
|
})
|
|
1483
1484
|
]) : null,
|
|
@@ -1489,8 +1490,8 @@ var fr = J({
|
|
|
1489
1490
|
b.value ? B("img", {
|
|
1490
1491
|
class: "markweave-image",
|
|
1491
1492
|
src: b.value,
|
|
1492
|
-
alt:
|
|
1493
|
-
title:
|
|
1493
|
+
alt: O(u.value.alt) ?? "",
|
|
1494
|
+
title: O(u.value.title) ?? void 0,
|
|
1494
1495
|
draggable: !1
|
|
1495
1496
|
}) : B("div", {
|
|
1496
1497
|
class: "markweave-image-readonly-empty",
|
|
@@ -1505,8 +1506,8 @@ var fr = J({
|
|
|
1505
1506
|
"aria-label": y.value.preview,
|
|
1506
1507
|
title: y.value.preview,
|
|
1507
1508
|
onMousedown: (e) => e.preventDefault(),
|
|
1508
|
-
onClick:
|
|
1509
|
-
}, [B(
|
|
1509
|
+
onClick: A
|
|
1510
|
+
}, [B(On, {
|
|
1510
1511
|
size: 16,
|
|
1511
1512
|
strokeWidth: 1.8
|
|
1512
1513
|
}), B("span", {
|
|
@@ -1520,7 +1521,7 @@ var fr = J({
|
|
|
1520
1521
|
"data-side": "left",
|
|
1521
1522
|
"aria-label": y.value.resizeLeft,
|
|
1522
1523
|
"data-markweave-image-ui": "true",
|
|
1523
|
-
onPointerdown: (e) =>
|
|
1524
|
+
onPointerdown: (e) => F("left", e)
|
|
1524
1525
|
}) : null,
|
|
1525
1526
|
g.value ? B("button", {
|
|
1526
1527
|
type: "button",
|
|
@@ -1529,7 +1530,7 @@ var fr = J({
|
|
|
1529
1530
|
"data-side": "right",
|
|
1530
1531
|
"aria-label": y.value.resizeRight,
|
|
1531
1532
|
"data-markweave-image-ui": "true",
|
|
1532
|
-
onPointerdown: (e) =>
|
|
1533
|
+
onPointerdown: (e) => F("right", e)
|
|
1533
1534
|
}) : null
|
|
1534
1535
|
]),
|
|
1535
1536
|
g.value && (d.value || E.value) ? B("input", {
|
|
@@ -1551,7 +1552,7 @@ var fr = J({
|
|
|
1551
1552
|
}, E.value) : null
|
|
1552
1553
|
]);
|
|
1553
1554
|
}
|
|
1554
|
-
}),
|
|
1555
|
+
}), hr = J({
|
|
1555
1556
|
name: "MarkweaveVueVideoNodeView",
|
|
1556
1557
|
props: {
|
|
1557
1558
|
editor: {
|
|
@@ -1584,14 +1585,14 @@ var fr = J({
|
|
|
1584
1585
|
}
|
|
1585
1586
|
},
|
|
1586
1587
|
setup(e) {
|
|
1587
|
-
let t = V(!1), n = V(""), r = V(null), a = V(!1), o =
|
|
1588
|
+
let t = V(!1), n = V(""), r = V(null), a = V(!1), o = cr(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(() => O(d.value.src)), m = U(() => O(d.value.embedUrl)), h = U(() => O(d.value.provider)), g = U(() => m.value ? ee(m.value, h.value) : null), _ = U(() => O(d.value.mimeType)), v = U(() => O(d.value.title)), x = () => {
|
|
1588
1589
|
f.value || e.deleteNode(), n.value = "", r.value = null, t.value = !1;
|
|
1589
1590
|
}, S = async (i) => {
|
|
1590
1591
|
if (!s.value) return;
|
|
1591
1592
|
let o = e.extension.options;
|
|
1592
1593
|
a.value = !0, r.value = null;
|
|
1593
1594
|
try {
|
|
1594
|
-
let t = await
|
|
1595
|
+
let t = await j(C(i), o?.onUpload);
|
|
1595
1596
|
e.updateAttributes(y(t)), n.value = "";
|
|
1596
1597
|
} catch (e) {
|
|
1597
1598
|
r.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
@@ -1612,11 +1613,11 @@ var fr = J({
|
|
|
1612
1613
|
file: e,
|
|
1613
1614
|
mimeType: e.type || "video/*"
|
|
1614
1615
|
});
|
|
1615
|
-
},
|
|
1616
|
+
}, D = () => {
|
|
1616
1617
|
if (!s.value) return;
|
|
1617
1618
|
let t = e.getPos();
|
|
1618
1619
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1619
|
-
},
|
|
1620
|
+
}, k = (t) => {
|
|
1620
1621
|
s.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
|
|
1621
1622
|
};
|
|
1622
1623
|
return () => s.value && !f.value ? B(i, {
|
|
@@ -1625,7 +1626,7 @@ var fr = J({
|
|
|
1625
1626
|
"data-testid": "markweave-video-node",
|
|
1626
1627
|
"data-empty": "true",
|
|
1627
1628
|
"data-selected": "false"
|
|
1628
|
-
}, () =>
|
|
1629
|
+
}, () => pr({
|
|
1629
1630
|
messages: l.value,
|
|
1630
1631
|
inputValue: n.value,
|
|
1631
1632
|
error: r.value,
|
|
@@ -1649,10 +1650,10 @@ var fr = J({
|
|
|
1649
1650
|
"data-selected": s.value && e.selected ? "true" : "false",
|
|
1650
1651
|
"aria-label": u.value.nodeAriaLabel,
|
|
1651
1652
|
tabindex: s.value ? 0 : void 0,
|
|
1652
|
-
onFocus:
|
|
1653
|
-
onKeydown:
|
|
1653
|
+
onFocus: D,
|
|
1654
|
+
onKeydown: k,
|
|
1654
1655
|
onMousedown: (e) => {
|
|
1655
|
-
s.value && !
|
|
1656
|
+
s.value && !ur(e.target) && (e.preventDefault(), D());
|
|
1656
1657
|
}
|
|
1657
1658
|
}, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
|
|
1658
1659
|
class: "markweave-video-iframe",
|
|
@@ -1690,7 +1691,7 @@ var fr = J({
|
|
|
1690
1691
|
"aria-hidden": "true"
|
|
1691
1692
|
})]);
|
|
1692
1693
|
}
|
|
1693
|
-
}),
|
|
1694
|
+
}), gr = g.extend({
|
|
1694
1695
|
addOptions() {
|
|
1695
1696
|
return {
|
|
1696
1697
|
...this.parent?.(),
|
|
@@ -1699,9 +1700,9 @@ var fr = J({
|
|
|
1699
1700
|
};
|
|
1700
1701
|
},
|
|
1701
1702
|
addNodeView() {
|
|
1702
|
-
return typeof document > "u" ? null : a(
|
|
1703
|
+
return typeof document > "u" ? null : a(mr, { stopEvent: ({ event: e }) => lr(e.target) });
|
|
1703
1704
|
}
|
|
1704
|
-
}),
|
|
1705
|
+
}), _r = _.extend({
|
|
1705
1706
|
addOptions() {
|
|
1706
1707
|
return {
|
|
1707
1708
|
...this.parent?.(),
|
|
@@ -1710,17 +1711,17 @@ var fr = J({
|
|
|
1710
1711
|
};
|
|
1711
1712
|
},
|
|
1712
1713
|
addNodeView() {
|
|
1713
|
-
return typeof document > "u" ? null : a(
|
|
1714
|
+
return typeof document > "u" ? null : a(hr, { stopEvent: ({ event: e }) => ur(e.target) });
|
|
1714
1715
|
}
|
|
1715
1716
|
});
|
|
1716
1717
|
//#endregion
|
|
1717
1718
|
//#region src/create-editor-extensions.ts
|
|
1718
|
-
function
|
|
1719
|
+
function vr(n = {}) {
|
|
1719
1720
|
return e({
|
|
1720
1721
|
lang: n.lang,
|
|
1721
1722
|
mediaExtensions: t({
|
|
1722
|
-
image:
|
|
1723
|
-
video:
|
|
1723
|
+
image: gr,
|
|
1724
|
+
video: _r,
|
|
1724
1725
|
lang: n.lang,
|
|
1725
1726
|
onImageUpload: n.onImageUpload,
|
|
1726
1727
|
onVideoUpload: n.onVideoUpload
|
|
@@ -1729,7 +1730,7 @@ function gr(n = {}) {
|
|
|
1729
1730
|
}
|
|
1730
1731
|
//#endregion
|
|
1731
1732
|
//#region src/MarkweaveEditor.ts
|
|
1732
|
-
var
|
|
1733
|
+
var yr = {
|
|
1733
1734
|
active: !1,
|
|
1734
1735
|
mode: "outside",
|
|
1735
1736
|
activeCellPos: null,
|
|
@@ -1737,17 +1738,17 @@ var _r = {
|
|
|
1737
1738
|
selectedCellCount: 0,
|
|
1738
1739
|
selectionFrom: 0,
|
|
1739
1740
|
selectionTo: 0
|
|
1740
|
-
},
|
|
1741
|
+
}, br = {
|
|
1741
1742
|
active: !1,
|
|
1742
|
-
language:
|
|
1743
|
+
language: Oe.defaultLanguage,
|
|
1743
1744
|
mermaidPreviewMode: "code",
|
|
1744
1745
|
pos: null,
|
|
1745
1746
|
text: ""
|
|
1746
1747
|
};
|
|
1747
|
-
function
|
|
1748
|
-
return
|
|
1748
|
+
function xr(e) {
|
|
1749
|
+
return Nt.getState(e.state) ?? Mt;
|
|
1749
1750
|
}
|
|
1750
|
-
function
|
|
1751
|
+
function Sr(e) {
|
|
1751
1752
|
if (!e || typeof window > "u") return null;
|
|
1752
1753
|
let t = e.parentElement;
|
|
1753
1754
|
for (; t;) {
|
|
@@ -1764,7 +1765,7 @@ function Z(e, t, n = 18, r = 1.8) {
|
|
|
1764
1765
|
"aria-hidden": "true"
|
|
1765
1766
|
}, { default: () => t });
|
|
1766
1767
|
}
|
|
1767
|
-
function
|
|
1768
|
+
function Cr(e) {
|
|
1768
1769
|
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", {
|
|
1769
1770
|
cx: "10",
|
|
1770
1771
|
cy: "10",
|
|
@@ -1812,57 +1813,57 @@ function Q(e) {
|
|
|
1812
1813
|
"stroke-linecap": "round",
|
|
1813
1814
|
"stroke-linejoin": "round",
|
|
1814
1815
|
"stroke-width": "1.8"
|
|
1815
|
-
},
|
|
1816
|
+
}, Cr(e)));
|
|
1816
1817
|
}
|
|
1817
1818
|
function $(e) {
|
|
1818
1819
|
e.preventDefault();
|
|
1819
1820
|
}
|
|
1820
|
-
function
|
|
1821
|
-
let t =
|
|
1821
|
+
function wr(e) {
|
|
1822
|
+
let t = et(e);
|
|
1822
1823
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
1823
1824
|
}
|
|
1824
|
-
var
|
|
1825
|
-
bold:
|
|
1826
|
-
italic:
|
|
1827
|
-
underline:
|
|
1828
|
-
strike:
|
|
1829
|
-
"inline-code":
|
|
1830
|
-
link:
|
|
1831
|
-
more:
|
|
1832
|
-
superscript:
|
|
1833
|
-
subscript:
|
|
1834
|
-
"inline-math":
|
|
1835
|
-
"align-left":
|
|
1836
|
-
"align-center":
|
|
1837
|
-
"align-right":
|
|
1838
|
-
"align-justify":
|
|
1839
|
-
"decrease-indent":
|
|
1840
|
-
"increase-indent":
|
|
1841
|
-
},
|
|
1842
|
-
type:
|
|
1843
|
-
"heading-1":
|
|
1844
|
-
"heading-2":
|
|
1845
|
-
"heading-3":
|
|
1846
|
-
"bullet-list":
|
|
1847
|
-
"ordered-list":
|
|
1848
|
-
"task-list":
|
|
1849
|
-
blockquote:
|
|
1850
|
-
"code-block":
|
|
1851
|
-
info:
|
|
1852
|
-
tip:
|
|
1853
|
-
warning:
|
|
1854
|
-
error:
|
|
1855
|
-
success:
|
|
1856
|
-
emoji:
|
|
1857
|
-
math:
|
|
1858
|
-
table:
|
|
1859
|
-
separator:
|
|
1860
|
-
image:
|
|
1861
|
-
video:
|
|
1862
|
-
attachment:
|
|
1825
|
+
var Tr = {
|
|
1826
|
+
bold: vn,
|
|
1827
|
+
italic: Rn,
|
|
1828
|
+
underline: ir,
|
|
1829
|
+
strike: Zn,
|
|
1830
|
+
"inline-code": Tn,
|
|
1831
|
+
link: Bn,
|
|
1832
|
+
more: Gn,
|
|
1833
|
+
superscript: $n,
|
|
1834
|
+
subscript: Qn,
|
|
1835
|
+
"inline-math": Yn,
|
|
1836
|
+
"align-left": hn,
|
|
1837
|
+
"align-center": pn,
|
|
1838
|
+
"align-right": gn,
|
|
1839
|
+
"align-justify": mn,
|
|
1840
|
+
"decrease-indent": Fn,
|
|
1841
|
+
"increase-indent": In
|
|
1842
|
+
}, Er = {
|
|
1843
|
+
type: tr,
|
|
1844
|
+
"heading-1": An,
|
|
1845
|
+
"heading-2": jn,
|
|
1846
|
+
"heading-3": Mn,
|
|
1847
|
+
"bullet-list": Vn,
|
|
1848
|
+
"ordered-list": Un,
|
|
1849
|
+
"task-list": Hn,
|
|
1850
|
+
blockquote: qn,
|
|
1851
|
+
"code-block": yn,
|
|
1852
|
+
info: Ln,
|
|
1853
|
+
tip: zn,
|
|
1854
|
+
warning: _n,
|
|
1855
|
+
error: wn,
|
|
1856
|
+
success: xn,
|
|
1857
|
+
emoji: Xn,
|
|
1858
|
+
math: Yn,
|
|
1859
|
+
table: er,
|
|
1860
|
+
separator: Wn,
|
|
1861
|
+
image: Nn,
|
|
1862
|
+
video: or,
|
|
1863
|
+
attachment: Kn
|
|
1863
1864
|
};
|
|
1864
|
-
function
|
|
1865
|
-
let t =
|
|
1865
|
+
function Dr(e) {
|
|
1866
|
+
let t = Er[e];
|
|
1866
1867
|
return B(t, {
|
|
1867
1868
|
size: 18,
|
|
1868
1869
|
strokeWidth: 1.6,
|
|
@@ -1870,21 +1871,21 @@ function Tr(e) {
|
|
|
1870
1871
|
"aria-hidden": "true"
|
|
1871
1872
|
});
|
|
1872
1873
|
}
|
|
1873
|
-
var
|
|
1874
|
-
paragraph:
|
|
1875
|
-
"heading-1":
|
|
1876
|
-
"heading-2":
|
|
1877
|
-
"heading-3":
|
|
1878
|
-
"bullet-list":
|
|
1879
|
-
"numbered-list":
|
|
1880
|
-
"todo-list":
|
|
1881
|
-
quote:
|
|
1882
|
-
"code-block":
|
|
1874
|
+
var Or = {
|
|
1875
|
+
paragraph: rr,
|
|
1876
|
+
"heading-1": An,
|
|
1877
|
+
"heading-2": jn,
|
|
1878
|
+
"heading-3": Mn,
|
|
1879
|
+
"bullet-list": Vn,
|
|
1880
|
+
"numbered-list": Un,
|
|
1881
|
+
"todo-list": Hn,
|
|
1882
|
+
quote: qn,
|
|
1883
|
+
"code-block": yn
|
|
1883
1884
|
};
|
|
1884
|
-
function
|
|
1885
|
-
return
|
|
1885
|
+
function kr(e, t) {
|
|
1886
|
+
return L(e, t).label;
|
|
1886
1887
|
}
|
|
1887
|
-
var
|
|
1888
|
+
var Ar = J({
|
|
1888
1889
|
name: "MarkweaveVueFloatingToolbar",
|
|
1889
1890
|
props: {
|
|
1890
1891
|
editor: {
|
|
@@ -1901,15 +1902,15 @@ var Or = J({
|
|
|
1901
1902
|
}
|
|
1902
1903
|
},
|
|
1903
1904
|
setup(e) {
|
|
1904
|
-
let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() =>
|
|
1905
|
+
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(() => et(n.value.trim())), u = U(() => e.messages.floatingToolbar), d = U(() => oe(e.messages).map((e) => [
|
|
1905
1906
|
e.id,
|
|
1906
1907
|
e.label,
|
|
1907
|
-
|
|
1908
|
+
Or[e.id]
|
|
1908
1909
|
])), f = U(() => ae(e.messages).map((e) => [
|
|
1909
1910
|
e.id,
|
|
1910
1911
|
e.value,
|
|
1911
1912
|
e.label
|
|
1912
|
-
])), p = U(() =>
|
|
1913
|
+
])), p = U(() => R(e.messages).map((e) => [
|
|
1913
1914
|
e.id,
|
|
1914
1915
|
e.value,
|
|
1915
1916
|
e.label
|
|
@@ -1919,10 +1920,10 @@ var Or = J({
|
|
|
1919
1920
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
1920
1921
|
}, _ = (r) => {
|
|
1921
1922
|
t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
|
|
1922
|
-
}, v =
|
|
1923
|
+
}, v = N(() => {
|
|
1923
1924
|
let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
1924
1925
|
if (!t.value || !n || !r) return;
|
|
1925
|
-
let s =
|
|
1926
|
+
let s = fe({
|
|
1926
1927
|
toolbarRect: n.getBoundingClientRect(),
|
|
1927
1928
|
popoverSize: r.getBoundingClientRect(),
|
|
1928
1929
|
viewport: {
|
|
@@ -1979,7 +1980,7 @@ var Or = J({
|
|
|
1979
1980
|
onMouseenter: (e) => b(n, e.currentTarget),
|
|
1980
1981
|
onMouseleave: () => b(null),
|
|
1981
1982
|
onClick: o
|
|
1982
|
-
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" },
|
|
1983
|
+
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, kr(e.editor, e.messages)), Z(t.value === "block-type" ? Cn : Sn, 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" ? Cn : Sn, i)])] : [Z(a, i)]), C = () => B("span", {
|
|
1983
1984
|
class: "markweave-floating-toolbar-divider",
|
|
1984
1985
|
"aria-hidden": "true"
|
|
1985
1986
|
}), w = (n, r, i) => B("section", {
|
|
@@ -2035,7 +2036,7 @@ var Or = J({
|
|
|
2035
2036
|
"aria-label": u.value.applyLink,
|
|
2036
2037
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2037
2038
|
onMousedown: $
|
|
2038
|
-
}, [Z(
|
|
2039
|
+
}, [Z(En, u.value.applyLink)]),
|
|
2039
2040
|
B("span", {
|
|
2040
2041
|
class: "markweave-floating-toolbar-link-divider",
|
|
2041
2042
|
"aria-hidden": "true"
|
|
@@ -2046,15 +2047,15 @@ var Or = J({
|
|
|
2046
2047
|
"aria-label": u.value.openLink,
|
|
2047
2048
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2048
2049
|
onMousedown: $,
|
|
2049
|
-
onClick: () =>
|
|
2050
|
-
}, [Z(
|
|
2050
|
+
onClick: () => wr(n.value)
|
|
2051
|
+
}, [Z(kn, u.value.openLink)]),
|
|
2051
2052
|
B("button", {
|
|
2052
2053
|
type: "button",
|
|
2053
2054
|
"aria-label": u.value.removeLink,
|
|
2054
2055
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2055
2056
|
onMousedown: $,
|
|
2056
2057
|
onClick: g
|
|
2057
|
-
}, [Z(
|
|
2058
|
+
}, [Z(nr, u.value.removeLink)])
|
|
2058
2059
|
])]) : t.value === "color" ? B("div", {
|
|
2059
2060
|
ref: c,
|
|
2060
2061
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
@@ -2081,13 +2082,13 @@ var Or = J({
|
|
|
2081
2082
|
onClick: () => {
|
|
2082
2083
|
se(e.editor, n), t.value = null;
|
|
2083
2084
|
}
|
|
2084
|
-
}, [Z(
|
|
2085
|
+
}, [Z(Tr[n], u.value.moreActions[n])]), r.value === n ? B("div", {
|
|
2085
2086
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2086
2087
|
role: "tooltip"
|
|
2087
2088
|
}, u.value.moreActions[n]) : null]))) : null;
|
|
2088
|
-
return () => B(
|
|
2089
|
+
return () => B(M, {
|
|
2089
2090
|
editor: e.editor,
|
|
2090
|
-
shouldShow: ({ editor: e }) => e.isEditable &&
|
|
2091
|
+
shouldShow: ({ editor: e }) => e.isEditable && z(pe(e)),
|
|
2091
2092
|
options: { placement: "top" }
|
|
2092
2093
|
}, { default: () => B("div", {
|
|
2093
2094
|
ref: o,
|
|
@@ -2099,23 +2100,23 @@ var Or = J({
|
|
|
2099
2100
|
class: "markweave-floating-toolbar-content",
|
|
2100
2101
|
"data-menu": t.value ?? "none"
|
|
2101
2102
|
}, [
|
|
2102
|
-
S("block-type", u.value.buttons["block-type"],
|
|
2103
|
+
S("block-type", u.value.buttons["block-type"], rr, () => _("block-type"), t.value === "block-type"),
|
|
2103
2104
|
C(),
|
|
2104
|
-
S("bold", u.value.buttons.bold,
|
|
2105
|
-
S("italic", u.value.buttons.italic,
|
|
2106
|
-
S("underline", u.value.buttons.underline,
|
|
2107
|
-
S("strike", u.value.buttons.strike,
|
|
2108
|
-
S("inline-code", u.value.buttons["inline-code"],
|
|
2105
|
+
S("bold", u.value.buttons.bold, vn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2106
|
+
S("italic", u.value.buttons.italic, Rn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2107
|
+
S("underline", u.value.buttons.underline, ir, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2108
|
+
S("strike", u.value.buttons.strike, Zn, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2109
|
+
S("inline-code", u.value.buttons["inline-code"], Tn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2109
2110
|
C(),
|
|
2110
|
-
S("link", u.value.buttons.link,
|
|
2111
|
-
S("color", u.value.buttons.color,
|
|
2111
|
+
S("link", u.value.buttons.link, Bn, () => _("link"), e.editor.isActive("link")),
|
|
2112
|
+
S("color", u.value.buttons.color, rr, () => _("color"), t.value === "color"),
|
|
2112
2113
|
C(),
|
|
2113
|
-
S("more", u.value.buttons.more,
|
|
2114
|
+
S("more", u.value.buttons.more, Gn, () => _("more"), t.value === "more"),
|
|
2114
2115
|
T(),
|
|
2115
2116
|
x()
|
|
2116
2117
|
])]) });
|
|
2117
2118
|
}
|
|
2118
|
-
}),
|
|
2119
|
+
}), jr = J({
|
|
2119
2120
|
name: "MarkweaveVueMathEditorPopover",
|
|
2120
2121
|
props: {
|
|
2121
2122
|
editor: {
|
|
@@ -2136,17 +2137,17 @@ var Or = J({
|
|
|
2136
2137
|
}
|
|
2137
2138
|
},
|
|
2138
2139
|
setup(e) {
|
|
2139
|
-
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(
|
|
2140
|
+
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(at(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
|
|
2140
2141
|
html: a.value,
|
|
2141
2142
|
error: !1
|
|
2142
|
-
} :
|
|
2143
|
+
} : lt(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => it(e.editor, e.target) ?? 1), u = () => {
|
|
2143
2144
|
if (typeof window > "u") return;
|
|
2144
|
-
let r =
|
|
2145
|
+
let r = rt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2145
2146
|
if (!r || !i) {
|
|
2146
2147
|
e.onClose();
|
|
2147
2148
|
return;
|
|
2148
2149
|
}
|
|
2149
|
-
n.value =
|
|
2150
|
+
n.value = nt({
|
|
2150
2151
|
anchorRect: r,
|
|
2151
2152
|
frameRect: i,
|
|
2152
2153
|
kind: e.target.kind,
|
|
@@ -2155,7 +2156,7 @@ var Or = J({
|
|
|
2155
2156
|
viewportWidth: window.innerWidth
|
|
2156
2157
|
});
|
|
2157
2158
|
}, d = () => {
|
|
2158
|
-
s.value &&
|
|
2159
|
+
s.value && tt(e.editor, e.target, t.value) && e.onClose();
|
|
2159
2160
|
}, f = (t) => {
|
|
2160
2161
|
if (t.key === "Escape") {
|
|
2161
2162
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -2167,13 +2168,13 @@ var Or = J({
|
|
|
2167
2168
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2168
2169
|
};
|
|
2169
2170
|
return W(() => [e.target.pos, e.target.latex], () => {
|
|
2170
|
-
t.value = e.target.latex, a.value =
|
|
2171
|
+
t.value = e.target.latex, a.value = at(e.editor, e.target), q(u);
|
|
2171
2172
|
}), G(() => {
|
|
2172
|
-
|
|
2173
|
+
ut(e.editor, e.target, !0), u(), q(() => {
|
|
2173
2174
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2174
2175
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2175
2176
|
}), K(() => {
|
|
2176
|
-
|
|
2177
|
+
ut(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2177
2178
|
}), () => {
|
|
2178
2179
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2179
2180
|
ref: i,
|
|
@@ -2234,14 +2235,14 @@ var Or = J({
|
|
|
2234
2235
|
}, [
|
|
2235
2236
|
B("div", { class: "markweave-math-block-toolbar" }, [
|
|
2236
2237
|
B("span", null, c.value.label),
|
|
2237
|
-
Z(
|
|
2238
|
+
Z(Tn, c.value.label, 15, 1.75),
|
|
2238
2239
|
B("button", {
|
|
2239
2240
|
type: "submit",
|
|
2240
2241
|
title: c.value.apply,
|
|
2241
2242
|
"aria-label": c.value.apply,
|
|
2242
2243
|
disabled: !s.value,
|
|
2243
2244
|
"data-testid": "markweave-math-editor-apply"
|
|
2244
|
-
}, [Z(
|
|
2245
|
+
}, [Z(xn, c.value.apply, 16, 2)])
|
|
2245
2246
|
]),
|
|
2246
2247
|
B("label", {
|
|
2247
2248
|
class: "markweave-math-block-source",
|
|
@@ -2264,7 +2265,7 @@ var Or = J({
|
|
|
2264
2265
|
]);
|
|
2265
2266
|
};
|
|
2266
2267
|
}
|
|
2267
|
-
}),
|
|
2268
|
+
}), Mr = J({
|
|
2268
2269
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2269
2270
|
props: {
|
|
2270
2271
|
commands: {
|
|
@@ -2323,13 +2324,13 @@ var Or = J({
|
|
|
2323
2324
|
} : {
|
|
2324
2325
|
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
2325
2326
|
trigger: "slash-command",
|
|
2326
|
-
source:
|
|
2327
|
+
source: k(t.value)
|
|
2327
2328
|
};
|
|
2328
2329
|
if (!n.value && !t.value.trim()) {
|
|
2329
2330
|
r.value = e.messages.slash.uploadRequiredError;
|
|
2330
2331
|
return;
|
|
2331
2332
|
}
|
|
2332
|
-
let a = await
|
|
2333
|
+
let a = await j(i, e.onUpload);
|
|
2333
2334
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2334
2335
|
} catch (t) {
|
|
2335
2336
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -2450,7 +2451,7 @@ var Or = J({
|
|
|
2450
2451
|
class: "markweave-slash-group",
|
|
2451
2452
|
"aria-label": t.group
|
|
2452
2453
|
}, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
2453
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
2454
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = yt(t);
|
|
2454
2455
|
return B("button", {
|
|
2455
2456
|
key: t.id,
|
|
2456
2457
|
type: "button",
|
|
@@ -2473,7 +2474,7 @@ var Or = J({
|
|
|
2473
2474
|
}
|
|
2474
2475
|
}
|
|
2475
2476
|
}, [
|
|
2476
|
-
|
|
2477
|
+
Dr(t.icon),
|
|
2477
2478
|
B("span", null, t.label),
|
|
2478
2479
|
t.disabledReason ? B("small", null, t.disabledReason) : null
|
|
2479
2480
|
]);
|
|
@@ -2484,7 +2485,7 @@ var Or = J({
|
|
|
2484
2485
|
}, e.messages.slash.noResults)])]);
|
|
2485
2486
|
};
|
|
2486
2487
|
}
|
|
2487
|
-
}),
|
|
2488
|
+
}), Nr = J({
|
|
2488
2489
|
name: "MarkweaveVueTableControls",
|
|
2489
2490
|
props: {
|
|
2490
2491
|
editor: {
|
|
@@ -2517,12 +2518,12 @@ var Or = J({
|
|
|
2517
2518
|
}
|
|
2518
2519
|
},
|
|
2519
2520
|
setup(e) {
|
|
2520
|
-
let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ?
|
|
2521
|
+
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 ? At(e.editor.state) : yr), h = U(() => Ht(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => Ht(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Bt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? Kt(e.editor, t.value) : []), b = () => {
|
|
2521
2522
|
p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
|
|
2522
2523
|
}, x = (e) => {
|
|
2523
2524
|
b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
|
|
2524
2525
|
s.value = null, p = null;
|
|
2525
|
-
},
|
|
2526
|
+
}, Xt));
|
|
2526
2527
|
}, S = () => {
|
|
2527
2528
|
if (!e.active) {
|
|
2528
2529
|
r.value = null, i.value = null, a.value = null, x(null);
|
|
@@ -2533,16 +2534,16 @@ var Or = J({
|
|
|
2533
2534
|
r.value = null, i.value = null, a.value = null;
|
|
2534
2535
|
return;
|
|
2535
2536
|
}
|
|
2536
|
-
let s = o.getBoundingClientRect(), c = h.value ?
|
|
2537
|
-
c ? r.value =
|
|
2537
|
+
let s = o.getBoundingClientRect(), c = h.value ? Vt(e.editor, h.value) : null, l = g.value ? Vt(e.editor, g.value) : null, u = v.value ? qt(e.editor) : null;
|
|
2538
|
+
c ? r.value = Ft({
|
|
2538
2539
|
targetRect: c,
|
|
2539
2540
|
frameRect: s,
|
|
2540
2541
|
kind: "row"
|
|
2541
|
-
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value =
|
|
2542
|
+
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Ft({
|
|
2542
2543
|
targetRect: l,
|
|
2543
2544
|
frameRect: s,
|
|
2544
2545
|
kind: "column"
|
|
2545
|
-
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value =
|
|
2546
|
+
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Ft({
|
|
2546
2547
|
targetRect: u,
|
|
2547
2548
|
frameRect: s,
|
|
2548
2549
|
kind: "selection"
|
|
@@ -2557,13 +2558,13 @@ var Or = J({
|
|
|
2557
2558
|
o.value = null;
|
|
2558
2559
|
return;
|
|
2559
2560
|
}
|
|
2560
|
-
let a = i.getBoundingClientRect(), s = t.value === "row" ?
|
|
2561
|
+
let a = i.getBoundingClientRect(), s = t.value === "row" ? zt(e.editor)?.getBoundingClientRect() : null, c = s ? {
|
|
2561
2562
|
left: a.left,
|
|
2562
2563
|
top: s.top,
|
|
2563
2564
|
width: a.width,
|
|
2564
2565
|
height: a.height
|
|
2565
2566
|
} : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
|
|
2566
|
-
o.value =
|
|
2567
|
+
o.value = Pt({
|
|
2567
2568
|
anchorRect: c,
|
|
2568
2569
|
frameRect: p,
|
|
2569
2570
|
menuSize: {
|
|
@@ -2579,35 +2580,35 @@ var Or = J({
|
|
|
2579
2580
|
}, E = (e, r) => {
|
|
2580
2581
|
let i = t.value === e && n.value === r;
|
|
2581
2582
|
n.value = r, t.value = i ? null : e, T();
|
|
2582
|
-
},
|
|
2583
|
-
e.editor.view.dispatch(
|
|
2584
|
-
},
|
|
2583
|
+
}, ee = () => {
|
|
2584
|
+
e.editor.view.dispatch(Dt(e.editor.state.tr, null));
|
|
2585
|
+
}, D = (t, n) => {
|
|
2585
2586
|
let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
2586
|
-
r !== null &&
|
|
2587
|
-
},
|
|
2588
|
-
|
|
2589
|
-
},
|
|
2587
|
+
r !== null && Yt(e.editor, r, t, { visualIndex: i }), E(t, n);
|
|
2588
|
+
}, O = () => {
|
|
2589
|
+
ee(), E("selection", "selection-edge");
|
|
2590
|
+
}, k = (n = !1) => {
|
|
2590
2591
|
t.value = null, o.value = null, n && e.editor.view.focus();
|
|
2591
|
-
},
|
|
2592
|
-
let i = await
|
|
2592
|
+
}, A = async (n, r) => {
|
|
2593
|
+
let i = await Lt({
|
|
2593
2594
|
editor: e.editor,
|
|
2594
2595
|
commandId: n,
|
|
2595
2596
|
menu: r ?? t.value ?? "selection",
|
|
2596
2597
|
messages: e.messages
|
|
2597
2598
|
});
|
|
2598
2599
|
return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
2599
|
-
},
|
|
2600
|
-
let n =
|
|
2601
|
-
n && e.onEditWithAi?.(n),
|
|
2602
|
-
},
|
|
2603
|
-
!t.value || e.key !== "Escape" ||
|
|
2604
|
-
},
|
|
2605
|
-
t.value && (e.target instanceof Node && c.value?.contains(e.target) ||
|
|
2600
|
+
}, j = (t) => {
|
|
2601
|
+
let n = Ut(e.editor, t);
|
|
2602
|
+
n && e.onEditWithAi?.(n), k(!0);
|
|
2603
|
+
}, M = (e) => {
|
|
2604
|
+
!t.value || e.key !== "Escape" || k(!0);
|
|
2605
|
+
}, te = (e) => {
|
|
2606
|
+
t.value && (e.target instanceof Node && c.value?.contains(e.target) || k());
|
|
2606
2607
|
};
|
|
2607
2608
|
G(() => {
|
|
2608
|
-
w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown",
|
|
2609
|
+
w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", M), document.addEventListener("mousedown", te);
|
|
2609
2610
|
}), K(() => {
|
|
2610
|
-
b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown",
|
|
2611
|
+
b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", M), document.removeEventListener("mousedown", te);
|
|
2611
2612
|
}), W(() => [
|
|
2612
2613
|
e.active,
|
|
2613
2614
|
m.value.activeCellPos,
|
|
@@ -2619,11 +2620,11 @@ var Or = J({
|
|
|
2619
2620
|
t.value,
|
|
2620
2621
|
n.value
|
|
2621
2622
|
], T, { flush: "post" });
|
|
2622
|
-
let
|
|
2623
|
+
let N = () => t.value ? B("div", {
|
|
2623
2624
|
ref: f,
|
|
2624
2625
|
class: "markweave-table-menu",
|
|
2625
2626
|
role: "menu",
|
|
2626
|
-
"aria-label":
|
|
2627
|
+
"aria-label": Zt(t.value, e.messages),
|
|
2627
2628
|
"data-testid": "markweave-table-menu",
|
|
2628
2629
|
"data-positioned": o.value ? "true" : "false",
|
|
2629
2630
|
style: o.value ? {
|
|
@@ -2631,7 +2632,7 @@ var Or = J({
|
|
|
2631
2632
|
top: `${o.value.top}px`
|
|
2632
2633
|
} : void 0
|
|
2633
2634
|
}, y.value.map((n, r) => {
|
|
2634
|
-
let i =
|
|
2635
|
+
let i = Wt(n), a = r === 0 ? i : Wt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : It(e.editor, n.commandId), c = Gt(n, e.messages);
|
|
2635
2636
|
return B("button", {
|
|
2636
2637
|
key: `${n.id}-${r}`,
|
|
2637
2638
|
type: "button",
|
|
@@ -2647,10 +2648,10 @@ var Or = J({
|
|
|
2647
2648
|
onClick: () => {
|
|
2648
2649
|
if (s) {
|
|
2649
2650
|
if (n.commandId === null) {
|
|
2650
|
-
|
|
2651
|
+
j(t.value === "row" || t.value === "column" ? t.value : "selection");
|
|
2651
2652
|
return;
|
|
2652
2653
|
}
|
|
2653
|
-
|
|
2654
|
+
A(n.commandId).finally(() => k());
|
|
2654
2655
|
}
|
|
2655
2656
|
}
|
|
2656
2657
|
}, c);
|
|
@@ -2671,7 +2672,7 @@ var Or = J({
|
|
|
2671
2672
|
"data-copy-kind": s.value.kind,
|
|
2672
2673
|
"data-text-length": s.value.textLength,
|
|
2673
2674
|
"data-html-length": s.value.htmlLength
|
|
2674
|
-
},
|
|
2675
|
+
}, Rt(s.value)) : null,
|
|
2675
2676
|
r.value ? B("button", {
|
|
2676
2677
|
ref: l,
|
|
2677
2678
|
type: "button",
|
|
@@ -2690,7 +2691,7 @@ var Or = J({
|
|
|
2690
2691
|
top: `${r.value.top}px`
|
|
2691
2692
|
},
|
|
2692
2693
|
onMousedown: $,
|
|
2693
|
-
onClick: () =>
|
|
2694
|
+
onClick: () => D("row", "row-edge")
|
|
2694
2695
|
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2695
2696
|
i.value ? B("button", {
|
|
2696
2697
|
ref: u,
|
|
@@ -2710,7 +2711,7 @@ var Or = J({
|
|
|
2710
2711
|
top: `${i.value.top}px`
|
|
2711
2712
|
},
|
|
2712
2713
|
onMousedown: $,
|
|
2713
|
-
onClick: () =>
|
|
2714
|
+
onClick: () => D("column", "column-edge")
|
|
2714
2715
|
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2715
2716
|
v.value && a.value ? B("button", {
|
|
2716
2717
|
ref: d,
|
|
@@ -2726,12 +2727,12 @@ var Or = J({
|
|
|
2726
2727
|
top: `${a.value.top}px`
|
|
2727
2728
|
},
|
|
2728
2729
|
onMousedown: $,
|
|
2729
|
-
onClick:
|
|
2730
|
+
onClick: O
|
|
2730
2731
|
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2731
|
-
|
|
2732
|
+
N()
|
|
2732
2733
|
]) : null;
|
|
2733
2734
|
}
|
|
2734
|
-
}),
|
|
2735
|
+
}), Pr = J({
|
|
2735
2736
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
2736
2737
|
props: {
|
|
2737
2738
|
editor: {
|
|
@@ -2749,7 +2750,7 @@ var Or = J({
|
|
|
2749
2750
|
t.value = null;
|
|
2750
2751
|
return;
|
|
2751
2752
|
}
|
|
2752
|
-
t.value =
|
|
2753
|
+
t.value = Jt(e.editor, jt(e.editor.state));
|
|
2753
2754
|
};
|
|
2754
2755
|
return G(() => {
|
|
2755
2756
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
@@ -2787,7 +2788,7 @@ var Or = J({
|
|
|
2787
2788
|
}) : null;
|
|
2788
2789
|
};
|
|
2789
2790
|
}
|
|
2790
|
-
}),
|
|
2791
|
+
}), Fr = J({
|
|
2791
2792
|
name: "MarkweaveVueCodeBlockControls",
|
|
2792
2793
|
props: {
|
|
2793
2794
|
editor: {
|
|
@@ -2820,88 +2821,88 @@ var Or = J({
|
|
|
2820
2821
|
active: !1,
|
|
2821
2822
|
lastX: 0,
|
|
2822
2823
|
lastY: 0
|
|
2823
|
-
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value,
|
|
2824
|
+
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, Ke(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
2824
2825
|
...e.state,
|
|
2825
2826
|
pos: e.state.pos,
|
|
2826
2827
|
active: !0
|
|
2827
|
-
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() =>
|
|
2828
|
+
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => Xe(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), ee = U(() => !e.readOnly), D = U(() => S.value ? Be(S.value.language) : Be("text")), O = U(() => u.value?.status ?? "idle"), k = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), A = U(() => w.value && k.value === "preview"), j = U(() => (v.value, g.value, _.value, Je(e.editor))), M = U(() => `${_.value}|${j.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), te = U(() => We(l.value)), N = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), ne = () => {
|
|
2828
2829
|
y !== null && (window.clearTimeout(y), y = null);
|
|
2829
|
-
},
|
|
2830
|
-
|
|
2830
|
+
}, P = (e) => {
|
|
2831
|
+
ne(), u.value = e, e && (y = window.setTimeout(() => {
|
|
2831
2832
|
u.value = null, y = null;
|
|
2832
|
-
},
|
|
2833
|
-
},
|
|
2833
|
+
}, Pe));
|
|
2834
|
+
}, re = () => {
|
|
2834
2835
|
f.value = null, p.value = null, m.value = !1, h.value = {
|
|
2835
2836
|
active: !1,
|
|
2836
2837
|
lastX: 0,
|
|
2837
2838
|
lastY: 0
|
|
2838
2839
|
}, e.editor.view.focus();
|
|
2839
|
-
},
|
|
2840
|
+
}, F = () => {
|
|
2840
2841
|
let n = t.value;
|
|
2841
2842
|
if (!n) return;
|
|
2842
|
-
if (!
|
|
2843
|
+
if (!qe(n) || j.value.length === 0) {
|
|
2843
2844
|
o.value = [];
|
|
2844
2845
|
return;
|
|
2845
2846
|
}
|
|
2846
|
-
let r = n.getBoundingClientRect(), i =
|
|
2847
|
-
let n = He(
|
|
2848
|
-
return n ? [
|
|
2847
|
+
let r = n.getBoundingClientRect(), i = j.value.flatMap((t) => {
|
|
2848
|
+
let n = Ue(He(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
2849
|
+
return n ? [Re(t, n, r)] : [];
|
|
2849
2850
|
});
|
|
2850
|
-
o.value =
|
|
2851
|
-
},
|
|
2851
|
+
o.value = Ze(o.value, i, j.value.map((e) => e.pos));
|
|
2852
|
+
}, I = () => {
|
|
2852
2853
|
if (!E.value || !S.value) {
|
|
2853
2854
|
a.value = null, s.value = null;
|
|
2854
2855
|
return;
|
|
2855
2856
|
}
|
|
2856
2857
|
let r = t.value;
|
|
2857
2858
|
if (!r) return;
|
|
2858
|
-
let i =
|
|
2859
|
+
let i = He(e.editor, S.value.pos, k.value), o = r.getBoundingClientRect(), l = Ue(i, o);
|
|
2859
2860
|
if (!l) {
|
|
2860
2861
|
a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
|
|
2861
2862
|
return;
|
|
2862
2863
|
}
|
|
2863
|
-
if (a.value =
|
|
2864
|
+
if (a.value = Ie(S.value.pos, l, o), c.value && n.value) {
|
|
2864
2865
|
let e = n.value.getBoundingClientRect();
|
|
2865
|
-
s.value =
|
|
2866
|
+
s.value = Me({
|
|
2866
2867
|
overlayRect: o,
|
|
2867
2868
|
buttonRect: e,
|
|
2868
2869
|
windowWidth: window.innerWidth,
|
|
2869
2870
|
windowHeight: window.innerHeight
|
|
2870
2871
|
});
|
|
2871
2872
|
}
|
|
2872
|
-
},
|
|
2873
|
+
}, L = async () => {
|
|
2873
2874
|
if (e.readOnly) {
|
|
2874
2875
|
if (!S.value) return;
|
|
2875
|
-
let e = await
|
|
2876
|
-
|
|
2876
|
+
let e = await Fe(S.value.text);
|
|
2877
|
+
P(De(S.value, e ? "copied" : "failed"));
|
|
2877
2878
|
return;
|
|
2878
2879
|
}
|
|
2879
|
-
if (!
|
|
2880
|
-
let t = await
|
|
2881
|
-
|
|
2882
|
-
},
|
|
2880
|
+
if (!ze(e.editor, S.value)) return;
|
|
2881
|
+
let t = await Te(e.editor);
|
|
2882
|
+
P(De(Ee(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
2883
|
+
}, R = (t, n) => {
|
|
2883
2884
|
if (e.readOnly) {
|
|
2884
|
-
|
|
2885
|
+
gt(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
|
|
2885
2886
|
return;
|
|
2886
2887
|
}
|
|
2887
2888
|
let r = e.state.active && e.state.pos === t.pos;
|
|
2888
|
-
|
|
2889
|
+
je(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
|
|
2889
2890
|
}, ie = (t) => {
|
|
2890
2891
|
if (e.readOnly || !S.value) return;
|
|
2891
2892
|
let n = e.state.active && e.state.pos === S.value.pos;
|
|
2892
|
-
|
|
2893
|
+
Ae(e.editor, S.value.pos, t) && (t === "mermaid" && je(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
|
|
2893
2894
|
}, ae = () => {
|
|
2894
|
-
e.readOnly || !S.value ||
|
|
2895
|
+
e.readOnly || !S.value || ke(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
2895
2896
|
}, oe = () => {
|
|
2896
2897
|
if (!S.value) return;
|
|
2897
|
-
let t =
|
|
2898
|
+
let t = Ye(e.editor, S.value.pos);
|
|
2898
2899
|
if (!t) return;
|
|
2899
2900
|
let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
2900
2901
|
i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
|
|
2901
2902
|
}, se = () => {
|
|
2902
2903
|
if (!S.value) return;
|
|
2903
|
-
let t =
|
|
2904
|
-
t && (f.value =
|
|
2904
|
+
let t = Ye(e.editor, S.value.pos);
|
|
2905
|
+
t && (f.value = Le(t), p.value = null, m.value = !1, h.value = {
|
|
2905
2906
|
active: !1,
|
|
2906
2907
|
lastX: 0,
|
|
2907
2908
|
lastY: 0
|
|
@@ -2909,23 +2910,23 @@ var Or = J({
|
|
|
2909
2910
|
}, ce = (e) => {
|
|
2910
2911
|
f.value = f.value ? {
|
|
2911
2912
|
...f.value,
|
|
2912
|
-
scale:
|
|
2913
|
+
scale: Ne(f.value.scale + e)
|
|
2913
2914
|
} : null;
|
|
2914
2915
|
}, le = () => {
|
|
2915
|
-
f.value = f.value ?
|
|
2916
|
+
f.value = f.value ? Le(f.value.svg) : null, h.value = {
|
|
2916
2917
|
active: !1,
|
|
2917
2918
|
lastX: 0,
|
|
2918
2919
|
lastY: 0
|
|
2919
2920
|
}, m.value = !1;
|
|
2920
2921
|
}, ue = (e) => {
|
|
2921
|
-
e.preventDefault(), ce(e.deltaY < 0 ?
|
|
2922
|
+
e.preventDefault(), ce(e.deltaY < 0 ? Qe : -Qe);
|
|
2922
2923
|
}, de = (e) => {
|
|
2923
2924
|
e.button === 0 && (e.preventDefault(), h.value = {
|
|
2924
2925
|
active: !0,
|
|
2925
2926
|
lastX: e.clientX,
|
|
2926
2927
|
lastY: e.clientY
|
|
2927
2928
|
}, m.value = !0);
|
|
2928
|
-
},
|
|
2929
|
+
}, fe = (e) => {
|
|
2929
2930
|
let t = h.value;
|
|
2930
2931
|
if (!t.active) return;
|
|
2931
2932
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
@@ -2933,8 +2934,8 @@ var Or = J({
|
|
|
2933
2934
|
active: !0,
|
|
2934
2935
|
lastX: e.clientX,
|
|
2935
2936
|
lastY: e.clientY
|
|
2936
|
-
}, f.value =
|
|
2937
|
-
},
|
|
2937
|
+
}, f.value = $e(f.value, n, r);
|
|
2938
|
+
}, pe = () => {
|
|
2938
2939
|
h.value = {
|
|
2939
2940
|
active: !1,
|
|
2940
2941
|
lastX: 0,
|
|
@@ -2943,40 +2944,40 @@ var Or = J({
|
|
|
2943
2944
|
};
|
|
2944
2945
|
W(() => e.readOnly, (e) => {
|
|
2945
2946
|
e && (c.value = !1, l.value = "");
|
|
2946
|
-
}), W(
|
|
2947
|
-
|
|
2947
|
+
}), W(N, () => {
|
|
2948
|
+
P(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
|
|
2948
2949
|
}), W(c, async (e) => {
|
|
2949
|
-
e && (await q(),
|
|
2950
|
+
e && (await q(), I(), r.value?.focus({ preventScroll: !0 }));
|
|
2950
2951
|
}), W(() => [
|
|
2951
2952
|
E.value,
|
|
2952
2953
|
g.value,
|
|
2953
2954
|
S.value?.pos ?? null,
|
|
2954
2955
|
c.value,
|
|
2955
|
-
|
|
2956
|
+
k.value
|
|
2956
2957
|
], async () => {
|
|
2957
|
-
await q(),
|
|
2958
|
+
await q(), I();
|
|
2958
2959
|
}, {
|
|
2959
2960
|
flush: "post",
|
|
2960
2961
|
immediate: !0
|
|
2961
|
-
}), W(
|
|
2962
|
-
await q(),
|
|
2962
|
+
}), W(M, async () => {
|
|
2963
|
+
await q(), F(), window.requestAnimationFrame(F);
|
|
2963
2964
|
}, {
|
|
2964
2965
|
flush: "post",
|
|
2965
2966
|
immediate: !0
|
|
2966
2967
|
});
|
|
2967
|
-
let
|
|
2968
|
+
let me = null;
|
|
2968
2969
|
return G(() => {
|
|
2969
2970
|
q(() => {
|
|
2970
2971
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
2971
2972
|
if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
|
|
2972
|
-
let r =
|
|
2973
|
+
let r = Ge(e.editor, n.target), a = Ke(e.editor, r), o = a && !Xe(e.editor, a) ? a.pos : null;
|
|
2973
2974
|
i.value = i.value === o ? i.value : o;
|
|
2974
2975
|
}, a = () => {
|
|
2975
2976
|
c.value || (i.value = null);
|
|
2976
2977
|
}, o = (t) => {
|
|
2977
2978
|
if (t.key === "Escape") {
|
|
2978
2979
|
if (f.value) {
|
|
2979
|
-
|
|
2980
|
+
re();
|
|
2980
2981
|
return;
|
|
2981
2982
|
}
|
|
2982
2983
|
c.value && (c.value = !1, e.editor.view.focus());
|
|
@@ -2984,16 +2985,16 @@ var Or = J({
|
|
|
2984
2985
|
}, s = (e) => {
|
|
2985
2986
|
c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
|
|
2986
2987
|
}, l = ({ transaction: e }) => {
|
|
2987
|
-
e.getMeta(
|
|
2988
|
+
e.getMeta(we) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(we) || pt(e)) && (v.value += 1);
|
|
2988
2989
|
};
|
|
2989
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize",
|
|
2990
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize",
|
|
2990
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), window.addEventListener("resize", F), window.addEventListener("scroll", F, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), me = () => {
|
|
2991
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", F), window.removeEventListener("scroll", F, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), ne();
|
|
2991
2992
|
};
|
|
2992
2993
|
});
|
|
2993
2994
|
}), K(() => {
|
|
2994
|
-
|
|
2995
|
+
me?.(), me = null, ne();
|
|
2995
2996
|
}), () => {
|
|
2996
|
-
if (!E.value &&
|
|
2997
|
+
if (!E.value && j.value.length === 0 && !f.value) return null;
|
|
2997
2998
|
let i = a.value ? {
|
|
2998
2999
|
top: `${a.value.top}px`,
|
|
2999
3000
|
right: `${a.value.right}px`
|
|
@@ -3007,7 +3008,7 @@ var Or = J({
|
|
|
3007
3008
|
"data-testid": "markweave-codeblock-overlay",
|
|
3008
3009
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
3009
3010
|
}, [
|
|
3010
|
-
...
|
|
3011
|
+
...j.value.map((e) => {
|
|
3011
3012
|
let t = o.value.find((t) => t.pos === e.pos);
|
|
3012
3013
|
return B("div", {
|
|
3013
3014
|
key: e.pos,
|
|
@@ -3025,7 +3026,7 @@ var Or = J({
|
|
|
3025
3026
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
3026
3027
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
3027
3028
|
onMousedown: $,
|
|
3028
|
-
onClick: () =>
|
|
3029
|
+
onClick: () => R(e, t)
|
|
3029
3030
|
}, t === "code" ? "Code" : "Preview")));
|
|
3030
3031
|
}),
|
|
3031
3032
|
E.value && S.value ? B("div", {
|
|
@@ -3041,7 +3042,7 @@ var Or = J({
|
|
|
3041
3042
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
3042
3043
|
"aria-label": "Code block language",
|
|
3043
3044
|
"data-testid": "markweave-codeblock-language"
|
|
3044
|
-
}, [B("span", null,
|
|
3045
|
+
}, [B("span", null, D.value)]) : B("button", {
|
|
3045
3046
|
ref: n,
|
|
3046
3047
|
type: "button",
|
|
3047
3048
|
class: "markweave-codeblock-language-button",
|
|
@@ -3053,8 +3054,8 @@ var Or = J({
|
|
|
3053
3054
|
onClick: () => {
|
|
3054
3055
|
c.value = !c.value;
|
|
3055
3056
|
}
|
|
3056
|
-
}, [B("span", null,
|
|
3057
|
-
|
|
3057
|
+
}, [B("span", null, D.value), Q("chevron")]),
|
|
3058
|
+
ee.value ? B("button", {
|
|
3058
3059
|
type: "button",
|
|
3059
3060
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
3060
3061
|
"aria-label": T.value ? "Expand code block" : "Collapse code block",
|
|
@@ -3069,7 +3070,7 @@ var Or = J({
|
|
|
3069
3070
|
class: "markweave-codeblock-icon-button",
|
|
3070
3071
|
"aria-label": "Copy to clipboard",
|
|
3071
3072
|
"data-testid": "markweave-codeblock-copy",
|
|
3072
|
-
"data-copy-state":
|
|
3073
|
+
"data-copy-state": O.value,
|
|
3073
3074
|
onMousedown: $,
|
|
3074
3075
|
onMouseenter: () => {
|
|
3075
3076
|
d.value = !0;
|
|
@@ -3084,14 +3085,14 @@ var Or = J({
|
|
|
3084
3085
|
d.value = !1;
|
|
3085
3086
|
},
|
|
3086
3087
|
onClick: () => {
|
|
3087
|
-
|
|
3088
|
+
L();
|
|
3088
3089
|
}
|
|
3089
|
-
}, [Q(
|
|
3090
|
+
}, [Q(O.value === "copied" ? "check" : "clipboard")]), d.value ? B("span", {
|
|
3090
3091
|
class: "markweave-codeblock-tooltip",
|
|
3091
3092
|
role: "tooltip",
|
|
3092
3093
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
3093
3094
|
}, "Copy to clipboard") : null]),
|
|
3094
|
-
w.value &&
|
|
3095
|
+
w.value && k.value === "preview" ? B("div", {
|
|
3095
3096
|
class: "markweave-mermaid-preview-actions",
|
|
3096
3097
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
3097
3098
|
}, [B("button", {
|
|
@@ -3099,7 +3100,7 @@ var Or = J({
|
|
|
3099
3100
|
class: "markweave-codeblock-icon-button",
|
|
3100
3101
|
"aria-label": "Fullscreen Mermaid preview",
|
|
3101
3102
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
3102
|
-
disabled: !
|
|
3103
|
+
disabled: !A.value,
|
|
3103
3104
|
onMousedown: $,
|
|
3104
3105
|
onClick: se
|
|
3105
3106
|
}, [Q("expand")]), B("button", {
|
|
@@ -3107,12 +3108,12 @@ var Or = J({
|
|
|
3107
3108
|
class: "markweave-codeblock-icon-button",
|
|
3108
3109
|
"aria-label": "Download Mermaid SVG",
|
|
3109
3110
|
"data-testid": "markweave-mermaid-download",
|
|
3110
|
-
disabled: !
|
|
3111
|
+
disabled: !A.value,
|
|
3111
3112
|
onMousedown: $,
|
|
3112
3113
|
onClick: oe
|
|
3113
3114
|
}, [Q("download")])]) : null
|
|
3114
3115
|
]) : null,
|
|
3115
|
-
|
|
3116
|
+
ee.value && E.value && c.value && S.value ? B("div", {
|
|
3116
3117
|
class: "markweave-codeblock-language-menu",
|
|
3117
3118
|
role: "listbox",
|
|
3118
3119
|
"aria-label": "Code block languages",
|
|
@@ -3130,7 +3131,7 @@ var Or = J({
|
|
|
3130
3131
|
onKeydown: (t) => {
|
|
3131
3132
|
t.key === "Escape" && (t.preventDefault(), c.value = !1, e.editor.view.focus());
|
|
3132
3133
|
}
|
|
3133
|
-
}), Q("search")]), B("div", { class: "markweave-codeblock-language-list" },
|
|
3134
|
+
}), Q("search")]), B("div", { class: "markweave-codeblock-language-list" }, te.value.map((e) => {
|
|
3134
3135
|
let t = S.value?.language === e.language;
|
|
3135
3136
|
return B("button", {
|
|
3136
3137
|
key: e.language,
|
|
@@ -3171,12 +3172,12 @@ var Or = J({
|
|
|
3171
3172
|
onBlur: () => {
|
|
3172
3173
|
p.value = null;
|
|
3173
3174
|
},
|
|
3174
|
-
onClick: () => ce(-
|
|
3175
|
+
onClick: () => ce(-Qe)
|
|
3175
3176
|
}, [Q("zoomOut")]),
|
|
3176
3177
|
B("span", {
|
|
3177
3178
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3178
3179
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3179
|
-
},
|
|
3180
|
+
}, Ve(f.value.scale)),
|
|
3180
3181
|
B("button", {
|
|
3181
3182
|
type: "button",
|
|
3182
3183
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -3194,7 +3195,7 @@ var Or = J({
|
|
|
3194
3195
|
onBlur: () => {
|
|
3195
3196
|
p.value = null;
|
|
3196
3197
|
},
|
|
3197
|
-
onClick: () => ce(
|
|
3198
|
+
onClick: () => ce(Qe)
|
|
3198
3199
|
}, [Q("zoomIn")]),
|
|
3199
3200
|
B("button", {
|
|
3200
3201
|
type: "button",
|
|
@@ -3226,7 +3227,7 @@ var Or = J({
|
|
|
3226
3227
|
class: "markweave-mermaid-fullscreen-close",
|
|
3227
3228
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
3228
3229
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3229
|
-
onClick:
|
|
3230
|
+
onClick: re
|
|
3230
3231
|
}, [Q("close")]),
|
|
3231
3232
|
B("div", {
|
|
3232
3233
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
@@ -3234,9 +3235,9 @@ var Or = J({
|
|
|
3234
3235
|
"data-dragging": m.value ? "true" : "false",
|
|
3235
3236
|
onWheel: ue,
|
|
3236
3237
|
onMousedown: de,
|
|
3237
|
-
onMousemove:
|
|
3238
|
-
onMouseup:
|
|
3239
|
-
onMouseleave:
|
|
3238
|
+
onMousemove: fe,
|
|
3239
|
+
onMouseup: pe,
|
|
3240
|
+
onMouseleave: pe
|
|
3240
3241
|
}, [B("div", {
|
|
3241
3242
|
class: "markweave-mermaid-fullscreen-content",
|
|
3242
3243
|
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
@@ -3253,7 +3254,7 @@ var Or = J({
|
|
|
3253
3254
|
]);
|
|
3254
3255
|
};
|
|
3255
3256
|
}
|
|
3256
|
-
}),
|
|
3257
|
+
}), Ir = J({
|
|
3257
3258
|
name: "MarkweaveVueInnerToc",
|
|
3258
3259
|
props: {
|
|
3259
3260
|
editor: {
|
|
@@ -3279,7 +3280,7 @@ var Or = J({
|
|
|
3279
3280
|
},
|
|
3280
3281
|
setup(e) {
|
|
3281
3282
|
let t = V(null), n, r = () => {
|
|
3282
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
3283
|
+
n?.(), n = e.placement === "container" && t.value ? Se(t.value) : void 0;
|
|
3283
3284
|
};
|
|
3284
3285
|
return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
|
|
3285
3286
|
ref: t,
|
|
@@ -3302,33 +3303,33 @@ var Or = J({
|
|
|
3302
3303
|
"aria-current": t.active ? "location" : void 0,
|
|
3303
3304
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
3304
3305
|
title: t.text,
|
|
3305
|
-
onClick: () =>
|
|
3306
|
+
onClick: () => Ce(e.editor, t, {
|
|
3306
3307
|
behavior: "smooth",
|
|
3307
3308
|
focus: e.editable
|
|
3308
3309
|
})
|
|
3309
3310
|
}, t.text)))])]) : null;
|
|
3310
3311
|
}
|
|
3311
3312
|
});
|
|
3312
|
-
function
|
|
3313
|
-
let t = m(e.lang), r = p(t), i = f(t), a = V(l(e.mode)), o = U(() => a.value === "live" && e.editable !== !1),
|
|
3314
|
-
function T() {
|
|
3315
|
-
w !== null && (window.clearTimeout(w), w = null), s.value += 1;
|
|
3316
|
-
}
|
|
3313
|
+
function Lr(e = {}) {
|
|
3314
|
+
let t = m(e.lang), r = p(t), i = f(t), a = V(l(e.mode)), o = U(() => he(e.theme)), s = U(() => a.value === "live" && e.editable !== !1), c = V(0), d = H(null), h = V(Tt), g = H(null), _ = H(null), v = V("code"), y = H(null), b = H(Mt), x = V(null), S = V(!1), C = H(null), w = I(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = null;
|
|
3317
3315
|
function E() {
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3316
|
+
T !== null && (window.clearTimeout(T), T = null), c.value += 1;
|
|
3317
|
+
}
|
|
3318
|
+
function ee() {
|
|
3319
|
+
T !== null && window.clearTimeout(T), T = window.setTimeout(() => {
|
|
3320
|
+
T = null, c.value += 1;
|
|
3321
|
+
}, me);
|
|
3321
3322
|
}
|
|
3322
3323
|
let D = e.onSlashCommandUpload, O = H(null);
|
|
3323
3324
|
O.value = new n({
|
|
3324
|
-
extensions:
|
|
3325
|
+
extensions: vr({
|
|
3325
3326
|
lang: t,
|
|
3326
|
-
onImageUpload: (e) => D?.(e) ??
|
|
3327
|
-
onVideoUpload: (e) => D?.(e) ??
|
|
3327
|
+
onImageUpload: (e) => D?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3328
|
+
onVideoUpload: (e) => D?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
|
|
3328
3329
|
}),
|
|
3329
3330
|
content: e.content ?? e.defaultContent ?? "",
|
|
3330
|
-
contentType:
|
|
3331
|
-
editable:
|
|
3331
|
+
contentType: P(w),
|
|
3332
|
+
editable: s.value,
|
|
3332
3333
|
autofocus: e.autofocus,
|
|
3333
3334
|
editorProps: {
|
|
3334
3335
|
attributes: {
|
|
@@ -3340,37 +3341,37 @@ function Fr(e = {}) {
|
|
|
3340
3341
|
translate: "no"
|
|
3341
3342
|
},
|
|
3342
3343
|
handleClick: (e, t, n) => {
|
|
3343
|
-
if (!
|
|
3344
|
-
let r =
|
|
3345
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
3344
|
+
if (!s.value) return le(n);
|
|
3345
|
+
let r = st(e, n);
|
|
3346
|
+
return r ? (n.preventDefault(), n.stopPropagation(), j(), dt(e, r, !0), ft(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
3346
3347
|
},
|
|
3347
3348
|
handleDOMEvents: {
|
|
3348
|
-
compositionstart: () =>
|
|
3349
|
-
compositionend: (e) => (
|
|
3349
|
+
compositionstart: () => s.value ? (h.value = Et(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
3350
|
+
compositionend: (e) => (s.value && window.setTimeout(() => M(e), 0), !1),
|
|
3350
3351
|
click: (e, t) => {
|
|
3351
|
-
if (!
|
|
3352
|
-
let n =
|
|
3353
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
3352
|
+
if (!s.value) return le(t);
|
|
3353
|
+
let n = st(e, t);
|
|
3354
|
+
return n ? (t.preventDefault(), t.stopPropagation(), j(), dt(e, n, !0), ft(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
3354
3355
|
}
|
|
3355
3356
|
}
|
|
3356
3357
|
},
|
|
3357
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
3358
|
+
onSelectionUpdate: ({ editor: e }) => L(e),
|
|
3358
3359
|
onCreate: ({ editor: t }) => {
|
|
3359
3360
|
u(t, {
|
|
3360
3361
|
mode: a.value,
|
|
3361
|
-
editable:
|
|
3362
|
-
}),
|
|
3362
|
+
editable: s.value
|
|
3363
|
+
}), mt(t, o.value), ht(t, s.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && s.value && kt(t), R(t), L(t), E();
|
|
3363
3364
|
},
|
|
3364
3365
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3365
|
-
if (R(e), (t.docChanged ||
|
|
3366
|
-
let t =
|
|
3367
|
-
|
|
3366
|
+
if (R(e), (t.docChanged || pt(t)) && ee(), t.docChanged && y.value) {
|
|
3367
|
+
let t = ot(e, y.value.pos);
|
|
3368
|
+
y.value = t?.kind === y.value.kind ? t : null;
|
|
3368
3369
|
}
|
|
3369
3370
|
},
|
|
3370
3371
|
onUpdate: ({ editor: t }) => {
|
|
3371
|
-
|
|
3372
|
-
let i =
|
|
3373
|
-
e.content !== void 0 && n === i && (
|
|
3372
|
+
L(t), s.value && N(t), S.value || e.onUpdate?.(ne(t, { onContentRead: (n, r) => {
|
|
3373
|
+
let i = I(e.contentFormat);
|
|
3374
|
+
e.content !== void 0 && n === i && (C.value = {
|
|
3374
3375
|
content: r,
|
|
3375
3376
|
format: n,
|
|
3376
3377
|
doc: t.state.doc
|
|
@@ -3379,170 +3380,172 @@ function Fr(e = {}) {
|
|
|
3379
3380
|
}
|
|
3380
3381
|
});
|
|
3381
3382
|
let k = U(() => O.value ?? null);
|
|
3382
|
-
function
|
|
3383
|
-
|
|
3383
|
+
function j() {
|
|
3384
|
+
g.value = null, _.value = null, h.value = Tt;
|
|
3384
3385
|
}
|
|
3385
3386
|
function M(e) {
|
|
3386
|
-
let t =
|
|
3387
|
+
let t = wt(e.state);
|
|
3387
3388
|
if (!t) {
|
|
3388
|
-
|
|
3389
|
+
h.value = h.value.name === "idle" ? h.value : Tt, g.value = null, _.value = null;
|
|
3389
3390
|
return;
|
|
3390
3391
|
}
|
|
3391
3392
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3392
|
-
|
|
3393
|
+
g.value = Ct(n, {
|
|
3393
3394
|
frameRect: i,
|
|
3394
3395
|
triggerRect: r
|
|
3395
|
-
}),
|
|
3396
|
+
}), h.value = St(h.value, t);
|
|
3396
3397
|
}
|
|
3397
3398
|
function N(e) {
|
|
3398
3399
|
M(e.view);
|
|
3399
3400
|
}
|
|
3400
|
-
function
|
|
3401
|
-
let t =
|
|
3402
|
-
de(
|
|
3403
|
-
let n =
|
|
3404
|
-
n && (
|
|
3405
|
-
let r =
|
|
3406
|
-
r.active && r.language === "mermaid" && (
|
|
3401
|
+
function L(e) {
|
|
3402
|
+
let t = pe(e);
|
|
3403
|
+
de(d.value, t) || (d.value = t);
|
|
3404
|
+
let n = ct(e);
|
|
3405
|
+
n && (ut(e, n, !0), y.value = n);
|
|
3406
|
+
let r = Ee(e);
|
|
3407
|
+
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
3407
3408
|
}
|
|
3408
3409
|
function R(e) {
|
|
3409
|
-
|
|
3410
|
+
b.value = xr(e);
|
|
3410
3411
|
}
|
|
3411
|
-
let
|
|
3412
|
-
active:
|
|
3413
|
-
mode:
|
|
3414
|
-
source:
|
|
3415
|
-
}) :
|
|
3412
|
+
let ie = U(() => k.value ? Ee(k.value) : br), ae = U(() => k.value ? At(k.value.state) : yr), oe = U(() => d.value?.currentNode === "codeBlock"), se = U(() => oe.value && ie.value.language === "mermaid"), ce = U(() => k.value ? _t({
|
|
3413
|
+
active: se.value,
|
|
3414
|
+
mode: v.value,
|
|
3415
|
+
source: ie.value.text
|
|
3416
|
+
}) : _t({
|
|
3416
3417
|
active: !1,
|
|
3417
3418
|
mode: "code",
|
|
3418
3419
|
source: ""
|
|
3419
|
-
})),
|
|
3420
|
-
revision:
|
|
3420
|
+
})), fe = U(() => k.value ? Ot(k.value.state) : null), z = U(() => k.value ? ye(k.value.state.doc) : _e.items), xe = U(() => be(z.value, x.value)), Se = U(() => ge(z.value, xe.value)), Ce = U(() => vt(h.value.query, i)), we = U(() => ue({
|
|
3421
|
+
revision: c.value,
|
|
3421
3422
|
mode: a.value,
|
|
3422
|
-
editable:
|
|
3423
|
-
toc:
|
|
3424
|
-
selection:
|
|
3425
|
-
slash:
|
|
3426
|
-
table:
|
|
3427
|
-
tableInteraction:
|
|
3428
|
-
codeBlock:
|
|
3429
|
-
mermaid:
|
|
3430
|
-
tableDebugSnapshot:
|
|
3431
|
-
})),
|
|
3432
|
-
closeSlashMenu:
|
|
3433
|
-
focusFirstTableBodyCell: () => k.value ?
|
|
3423
|
+
editable: s.value,
|
|
3424
|
+
toc: Se.value,
|
|
3425
|
+
selection: d.value,
|
|
3426
|
+
slash: h.value,
|
|
3427
|
+
table: ae.value,
|
|
3428
|
+
tableInteraction: b.value,
|
|
3429
|
+
codeBlock: ie.value,
|
|
3430
|
+
mermaid: ce.value,
|
|
3431
|
+
tableDebugSnapshot: fe.value
|
|
3432
|
+
})), Te = {
|
|
3433
|
+
closeSlashMenu: j,
|
|
3434
|
+
focusFirstTableBodyCell: () => k.value ? kt(k.value) : !1,
|
|
3434
3435
|
setContent: (e, t = {}) => {
|
|
3435
3436
|
if (!k.value) return !1;
|
|
3436
|
-
let n =
|
|
3437
|
+
let n = I(t.format);
|
|
3437
3438
|
return k.value.commands.setContent(e, {
|
|
3438
|
-
contentType:
|
|
3439
|
+
contentType: P(n),
|
|
3439
3440
|
emitUpdate: t.emitUpdate ?? !1
|
|
3440
|
-
}), t.focusFirstTableBodyCell &&
|
|
3441
|
+
}), t.focusFirstTableBodyCell && kt(k.value), L(k.value), s.value && N(k.value), R(k.value), E(), !0;
|
|
3441
3442
|
}
|
|
3442
3443
|
};
|
|
3443
|
-
function
|
|
3444
|
-
if (!(!k.value || !
|
|
3444
|
+
function De(e, t) {
|
|
3445
|
+
if (!(!k.value || !s.value || !yt(e))) {
|
|
3445
3446
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3446
|
-
|
|
3447
|
+
_.value = e;
|
|
3447
3448
|
return;
|
|
3448
3449
|
}
|
|
3449
|
-
|
|
3450
|
+
xt(k.value, h.value, e, t), h.value = Et(h.value, { type: "execute" }), j();
|
|
3450
3451
|
}
|
|
3451
3452
|
}
|
|
3452
|
-
function
|
|
3453
|
-
if (!k.value ||
|
|
3454
|
-
let t =
|
|
3453
|
+
function Oe(e) {
|
|
3454
|
+
if (!k.value || _.value || !s.value) return;
|
|
3455
|
+
let t = bt(h.value, Ce.value, e.key, { isComposing: e.isComposing || te(k.value.state) });
|
|
3455
3456
|
if (t.type !== "ignore") {
|
|
3456
3457
|
if (e.preventDefault(), t.type === "close") {
|
|
3457
|
-
|
|
3458
|
+
h.value = Et(h.value, { type: "escape" }), j();
|
|
3458
3459
|
return;
|
|
3459
3460
|
}
|
|
3460
3461
|
if (t.type === "move-active") {
|
|
3461
|
-
|
|
3462
|
+
h.value = Et(h.value, {
|
|
3462
3463
|
type: "move-active",
|
|
3463
3464
|
delta: t.delta,
|
|
3464
3465
|
optionCount: t.optionCount
|
|
3465
3466
|
});
|
|
3466
3467
|
return;
|
|
3467
3468
|
}
|
|
3468
|
-
|
|
3469
|
+
De(t.command);
|
|
3469
3470
|
}
|
|
3470
3471
|
}
|
|
3471
3472
|
W(() => [e.mode, e.editable], () => {
|
|
3472
|
-
a.value = l(e.mode), k.value && (k.value.setEditable(
|
|
3473
|
+
a.value = l(e.mode), k.value && (k.value.setEditable(s.value), u(k.value, {
|
|
3473
3474
|
mode: a.value,
|
|
3474
|
-
editable:
|
|
3475
|
-
}),
|
|
3475
|
+
editable: s.value
|
|
3476
|
+
}), ht(k.value, s.value ? "live" : "view"), E(), s.value || j());
|
|
3477
|
+
}, { immediate: !0 }), W(() => e.theme, () => {
|
|
3478
|
+
k.value && mt(k.value, o.value);
|
|
3476
3479
|
}, { immediate: !0 }), W(() => e.content, (t) => {
|
|
3477
|
-
let n =
|
|
3480
|
+
let n = I(e.contentFormat);
|
|
3478
3481
|
if (!(!k.value || t === void 0)) {
|
|
3479
|
-
if (
|
|
3480
|
-
|
|
3482
|
+
if (F(k.value, C.value, t, n)) {
|
|
3483
|
+
C.value = null;
|
|
3481
3484
|
return;
|
|
3482
3485
|
}
|
|
3483
|
-
|
|
3484
|
-
contentType:
|
|
3486
|
+
C.value = null, !re(k.value, t, n) && (S.value = !0, k.value.commands.setContent(t, {
|
|
3487
|
+
contentType: P(n),
|
|
3485
3488
|
emitUpdate: !1
|
|
3486
|
-
}),
|
|
3489
|
+
}), S.value = !1, L(k.value), s.value && N(k.value), R(k.value), E());
|
|
3487
3490
|
}
|
|
3488
|
-
}), W(
|
|
3489
|
-
let t =
|
|
3490
|
-
|
|
3491
|
+
}), W(we, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(Se, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
|
|
3492
|
+
let t = be(e, x.value);
|
|
3493
|
+
x.value !== t && (x.value = t);
|
|
3491
3494
|
});
|
|
3492
|
-
let
|
|
3495
|
+
let ke = null;
|
|
3493
3496
|
return K(() => {
|
|
3494
|
-
|
|
3497
|
+
T !== null && window.clearTimeout(T);
|
|
3495
3498
|
}), G(() => {
|
|
3496
3499
|
let e = () => {
|
|
3497
3500
|
if (!k.value || !z.value.length) {
|
|
3498
|
-
|
|
3501
|
+
x.value = null;
|
|
3499
3502
|
return;
|
|
3500
3503
|
}
|
|
3501
3504
|
let e = null;
|
|
3502
3505
|
try {
|
|
3503
|
-
e =
|
|
3506
|
+
e = ve(k.value, z.value);
|
|
3504
3507
|
} catch {
|
|
3505
3508
|
return;
|
|
3506
3509
|
}
|
|
3507
|
-
|
|
3508
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
3509
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
3510
|
+
x.value !== e && (x.value = e);
|
|
3511
|
+
}, t = () => window.requestAnimationFrame(e), n = Sr(k.value?.view.dom ?? null);
|
|
3512
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), ke = () => {
|
|
3510
3513
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3511
3514
|
};
|
|
3512
3515
|
}), K(() => {
|
|
3513
|
-
|
|
3516
|
+
ke?.();
|
|
3514
3517
|
let e = O.value;
|
|
3515
3518
|
O.value = null, q(() => e?.destroy());
|
|
3516
3519
|
}), {
|
|
3517
3520
|
editor: k,
|
|
3518
|
-
runtimeSnapshot:
|
|
3519
|
-
actions:
|
|
3521
|
+
runtimeSnapshot: we,
|
|
3522
|
+
actions: Te,
|
|
3520
3523
|
__render: {
|
|
3521
3524
|
messages: r,
|
|
3522
|
-
effectiveEditable:
|
|
3523
|
-
tableFocusState:
|
|
3524
|
-
tableInteractionState:
|
|
3525
|
-
codeBlockState:
|
|
3526
|
-
isCodeBlockActive:
|
|
3527
|
-
mermaidMode:
|
|
3528
|
-
mathTarget:
|
|
3525
|
+
effectiveEditable: s,
|
|
3526
|
+
tableFocusState: ae,
|
|
3527
|
+
tableInteractionState: b,
|
|
3528
|
+
codeBlockState: ie,
|
|
3529
|
+
isCodeBlockActive: oe,
|
|
3530
|
+
mermaidMode: v,
|
|
3531
|
+
mathTarget: y,
|
|
3529
3532
|
setMermaidMode: (e) => {
|
|
3530
|
-
|
|
3533
|
+
v.value = e;
|
|
3531
3534
|
},
|
|
3532
|
-
tocState:
|
|
3533
|
-
filteredSlashCommands:
|
|
3534
|
-
slashState:
|
|
3535
|
-
slashMenuPosition:
|
|
3536
|
-
slashInputCommand:
|
|
3537
|
-
runSlashCommand:
|
|
3538
|
-
handleEditorKeyDown:
|
|
3535
|
+
tocState: Se,
|
|
3536
|
+
filteredSlashCommands: Ce,
|
|
3537
|
+
slashState: h,
|
|
3538
|
+
slashMenuPosition: g,
|
|
3539
|
+
slashInputCommand: _,
|
|
3540
|
+
runSlashCommand: De,
|
|
3541
|
+
handleEditorKeyDown: Oe,
|
|
3539
3542
|
setSlashInputCommand: (e) => {
|
|
3540
|
-
|
|
3543
|
+
_.value = e;
|
|
3541
3544
|
}
|
|
3542
3545
|
}
|
|
3543
3546
|
};
|
|
3544
3547
|
}
|
|
3545
|
-
var
|
|
3548
|
+
var Rr = J({
|
|
3546
3549
|
name: "MarkweaveEditor",
|
|
3547
3550
|
props: {
|
|
3548
3551
|
defaultContent: {
|
|
@@ -3569,6 +3572,10 @@ var Ir = J({
|
|
|
3569
3572
|
type: String,
|
|
3570
3573
|
default: "live"
|
|
3571
3574
|
},
|
|
3575
|
+
theme: {
|
|
3576
|
+
type: String,
|
|
3577
|
+
default: "light"
|
|
3578
|
+
},
|
|
3572
3579
|
innerToc: {
|
|
3573
3580
|
type: Boolean,
|
|
3574
3581
|
default: !0
|
|
@@ -3635,7 +3642,7 @@ var Ir = J({
|
|
|
3635
3642
|
}
|
|
3636
3643
|
},
|
|
3637
3644
|
setup(e) {
|
|
3638
|
-
let t =
|
|
3645
|
+
let t = Lr(e);
|
|
3639
3646
|
return () => {
|
|
3640
3647
|
let n = t.editor.value;
|
|
3641
3648
|
if (!n) return null;
|
|
@@ -3645,17 +3652,18 @@ var Ir = J({
|
|
|
3645
3652
|
"aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
|
|
3646
3653
|
"data-testid": "markweave-editor-frame",
|
|
3647
3654
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
3655
|
+
"data-markweave-theme": he(e.theme),
|
|
3648
3656
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
3649
|
-
"data-markweave-inner-toc-placement":
|
|
3657
|
+
"data-markweave-inner-toc-placement": xe(e.innerTocPlacement),
|
|
3650
3658
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
3651
3659
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
3652
3660
|
onKeydownCapture: i.handleEditorKeyDown
|
|
3653
3661
|
}, [
|
|
3654
|
-
i.effectiveEditable.value ? B(
|
|
3662
|
+
i.effectiveEditable.value ? B(Ar, {
|
|
3655
3663
|
editor: n,
|
|
3656
3664
|
messages: i.messages
|
|
3657
3665
|
}) : null,
|
|
3658
|
-
i.effectiveEditable.value ? B(
|
|
3666
|
+
i.effectiveEditable.value ? B(Mr, {
|
|
3659
3667
|
commands: i.filteredSlashCommands.value,
|
|
3660
3668
|
state: i.slashState.value,
|
|
3661
3669
|
position: i.slashMenuPosition.value,
|
|
@@ -3665,7 +3673,7 @@ var Ir = J({
|
|
|
3665
3673
|
onInputCommandChange: i.setSlashInputCommand,
|
|
3666
3674
|
onUpload: e.onSlashCommandUpload
|
|
3667
3675
|
}) : null,
|
|
3668
|
-
i.effectiveEditable.value ? B(
|
|
3676
|
+
i.effectiveEditable.value ? B(Nr, {
|
|
3669
3677
|
editor: n,
|
|
3670
3678
|
active: i.tableFocusState.value.active,
|
|
3671
3679
|
interactionState: i.tableInteractionState.value,
|
|
@@ -3674,11 +3682,11 @@ var Ir = J({
|
|
|
3674
3682
|
onCommandResult: e.onTableCommandResult,
|
|
3675
3683
|
onEditWithAi: e.onEditWithAi
|
|
3676
3684
|
}) : null,
|
|
3677
|
-
i.effectiveEditable.value ? B(
|
|
3685
|
+
i.effectiveEditable.value ? B(Pr, {
|
|
3678
3686
|
editor: n,
|
|
3679
3687
|
focusState: i.tableFocusState.value
|
|
3680
3688
|
}) : null,
|
|
3681
|
-
B(
|
|
3689
|
+
B(Fr, {
|
|
3682
3690
|
editor: n,
|
|
3683
3691
|
state: i.codeBlockState.value,
|
|
3684
3692
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -3686,14 +3694,14 @@ var Ir = J({
|
|
|
3686
3694
|
onMermaidModeChange: i.setMermaidMode,
|
|
3687
3695
|
readOnly: !i.effectiveEditable.value
|
|
3688
3696
|
}),
|
|
3689
|
-
e.innerToc && i.tocState.value.items.length ? B(
|
|
3697
|
+
e.innerToc && i.tocState.value.items.length ? B(Ir, {
|
|
3690
3698
|
editor: n,
|
|
3691
3699
|
state: i.tocState.value,
|
|
3692
3700
|
messages: i.messages,
|
|
3693
3701
|
editable: i.effectiveEditable.value,
|
|
3694
|
-
placement:
|
|
3702
|
+
placement: xe(e.innerTocPlacement)
|
|
3695
3703
|
}) : null,
|
|
3696
|
-
i.effectiveEditable.value && i.mathTarget.value ? B(
|
|
3704
|
+
i.effectiveEditable.value && i.mathTarget.value ? B(jr, {
|
|
3697
3705
|
editor: n,
|
|
3698
3706
|
messages: i.messages,
|
|
3699
3707
|
target: i.mathTarget.value,
|
|
@@ -3705,4 +3713,4 @@ var Ir = J({
|
|
|
3705
3713
|
}
|
|
3706
3714
|
});
|
|
3707
3715
|
//#endregion
|
|
3708
|
-
export {
|
|
3716
|
+
export { Rr as MarkweaveEditor, vr as createMarkweaveEditorExtensions, vr as createMarkweaveVue2EditorExtensions, Lr as useMarkweaveEditorController };
|