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