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