@markweave/vue2 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +328 -323
- package/dist/types/MarkweaveEditor.d.ts +1 -0
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,8 +9,8 @@ import { openMarkweaveLinkCardComposer as g } from "markweave/internal/plugins/l
|
|
|
9
9
|
import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as v, replaceMarkweaveLinkCardWithLink as y } from "markweave/internal/plugins/link-card/link-card";
|
|
10
10
|
import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
|
|
11
11
|
import { MarkweaveCoreImage as x, MarkweaveCoreVideo as S, attrsFromMarkweaveImageUploadResult as C, attrsFromMarkweaveVideoUploadResult as w, attrsFromMarkweaveVideoUrl as T, clampMarkweaveImageWidth as E, createMarkweaveImageUploadRequest as ee, createMarkweaveVideoUploadRequest as D, downloadMarkweaveImage as O, markweaveVideoIframeAllow as k, normalizeMarkweaveCoreImageAlign as A, normalizeMarkweaveVideoEmbedUrl as j, numberAttribute as M, stringAttribute as N } from "markweave/internal/plugins/media/core-media-nodes";
|
|
12
|
-
import { detectUploadSource as P, getDirectUploadResult as
|
|
13
|
-
import { BubbleMenu as
|
|
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
14
|
import { isEditorComposing as L } from "markweave/internal/editor-core/composition-guard";
|
|
15
15
|
import { createMarkweaveFrameScheduler as R } from "markweave/internal/editor-core/frame-scheduler";
|
|
16
16
|
import { createMarkweaveEditorUpdatePayload as ne, getMarkweaveContentType as re, isEditorContentCurrent as ie, isMarkweaveControlledContentEchoCurrent as ae, normalizeMarkweaveContentFormat as oe } from "markweave/internal/editor-core/editor-content";
|
|
@@ -18,41 +18,41 @@ import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightCo
|
|
|
18
18
|
import { openMarkweaveReadonlyLinkFromEvent as pe } from "markweave/internal/editor-core/readonly-link";
|
|
19
19
|
import { createMarkweaveEditorRuntimeSnapshot as me } from "markweave/internal/editor-core/runtime-snapshot";
|
|
20
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 {
|
|
22
|
-
import { createMarkweaveTocState as
|
|
23
|
-
import { codeBlockCollapsePluginKey as
|
|
24
|
-
import { calculateCodeBlockLanguageMenuPosition as
|
|
25
|
-
import { normalizeMarkdownLinkHref as
|
|
26
|
-
import { applyMarkweaveMathLatex as
|
|
27
|
-
import { isMermaidInlinePreviewTransaction as
|
|
28
|
-
import { getMermaidPreviewState as
|
|
29
|
-
import { filterSlashCommands as
|
|
30
|
-
import { getSlashCommandKeyboardAction as
|
|
31
|
-
import { executeSlashCommand as
|
|
32
|
-
import { initialSlashCommandState as
|
|
33
|
-
import { setMarkweaveTableMenuAxisTarget as
|
|
34
|
-
import { getFirstTableDebugSnapshot as
|
|
35
|
-
import { focusFirstTableBodyCell as
|
|
36
|
-
import { getTableFocusState as
|
|
37
|
-
import { getTableSelectionOverlayState as
|
|
38
|
-
import { calculateAnchoredTableMenuPosition as
|
|
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";
|
|
39
39
|
//#region src/vue2-compat.ts
|
|
40
|
-
var
|
|
41
|
-
function
|
|
40
|
+
var an = l.default ?? l, on = null, sn = null, cn = null;
|
|
41
|
+
function ln(e) {
|
|
42
42
|
return !!(e && typeof e == "object" && "value" in e);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function un(e) {
|
|
45
45
|
let t = e.slice(2);
|
|
46
46
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function dn(e) {
|
|
49
49
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
50
50
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
51
51
|
if (o === "class" || o === "style" || o === "key") {
|
|
52
52
|
t[o] = s;
|
|
53
53
|
continue;
|
|
54
54
|
}
|
|
55
|
-
if (o === "ref" &&
|
|
55
|
+
if (o === "ref" && ln(s)) {
|
|
56
56
|
a.insert = (e) => {
|
|
57
57
|
s.value = e.elm;
|
|
58
58
|
}, a.destroy = () => {
|
|
@@ -61,7 +61,7 @@ function un(e) {
|
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
63
|
if (/^on[A-Z]/.test(o)) {
|
|
64
|
-
i[
|
|
64
|
+
i[un(o)] = s;
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -72,14 +72,14 @@ function un(e) {
|
|
|
72
72
|
}
|
|
73
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;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function fn(e) {
|
|
76
76
|
let t = {}, n = {}, r = {}, i = {};
|
|
77
77
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
78
78
|
if (a === "class" || a === "style" || a === "key") {
|
|
79
79
|
t[a] = o;
|
|
80
80
|
continue;
|
|
81
81
|
}
|
|
82
|
-
if (a === "ref" &&
|
|
82
|
+
if (a === "ref" && ln(o)) {
|
|
83
83
|
i.insert = (e) => {
|
|
84
84
|
o.value = e.componentInstance ?? e.elm;
|
|
85
85
|
}, i.destroy = () => {
|
|
@@ -95,25 +95,25 @@ function dn(e) {
|
|
|
95
95
|
}
|
|
96
96
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function pn(e) {
|
|
99
99
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function mn(e) {
|
|
102
102
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function hn(e) {
|
|
105
105
|
return e == null || Array.isArray(e) ? e : [e];
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
return typeof e == "function" ?
|
|
107
|
+
function gn(e) {
|
|
108
|
+
return typeof e == "function" ? hn(e()) : pn(e) ? hn(e.default()) : mn(e) ? [e] : e;
|
|
109
109
|
}
|
|
110
110
|
function B(e, t, n) {
|
|
111
|
-
if (!
|
|
112
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
113
|
-
return
|
|
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);
|
|
114
114
|
}
|
|
115
115
|
function V(e) {
|
|
116
|
-
return
|
|
116
|
+
return an.observable({ value: e });
|
|
117
117
|
}
|
|
118
118
|
var H = V;
|
|
119
119
|
function U(e) {
|
|
@@ -123,19 +123,19 @@ function U(e) {
|
|
|
123
123
|
}
|
|
124
124
|
function W(e, t, n) {
|
|
125
125
|
let r = typeof e == "function" ? e : () => e.value;
|
|
126
|
-
return
|
|
126
|
+
return on?.$watch ? on.$watch(r, t, n) : () => void 0;
|
|
127
127
|
}
|
|
128
128
|
function G(e) {
|
|
129
|
-
|
|
129
|
+
sn?.mounted.push(e);
|
|
130
130
|
}
|
|
131
131
|
function K(e) {
|
|
132
|
-
|
|
132
|
+
sn?.beforeUnmount.push(e);
|
|
133
133
|
}
|
|
134
134
|
function q(e) {
|
|
135
|
-
return
|
|
135
|
+
return an.nextTick(e);
|
|
136
136
|
}
|
|
137
137
|
function J(e) {
|
|
138
|
-
return
|
|
138
|
+
return an.extend({
|
|
139
139
|
name: e.name,
|
|
140
140
|
props: e.props,
|
|
141
141
|
created() {
|
|
@@ -143,12 +143,12 @@ function J(e) {
|
|
|
143
143
|
mounted: [],
|
|
144
144
|
beforeUnmount: []
|
|
145
145
|
};
|
|
146
|
-
|
|
146
|
+
on = this, sn = t;
|
|
147
147
|
try {
|
|
148
148
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
149
149
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
150
150
|
} finally {
|
|
151
|
-
|
|
151
|
+
on = null, sn = null;
|
|
152
152
|
}
|
|
153
153
|
},
|
|
154
154
|
mounted() {
|
|
@@ -158,19 +158,19 @@ function J(e) {
|
|
|
158
158
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
159
159
|
},
|
|
160
160
|
render(t) {
|
|
161
|
-
|
|
161
|
+
cn = t;
|
|
162
162
|
try {
|
|
163
163
|
let n = this.__markweaveVue2Render;
|
|
164
164
|
return n ? n() : e.render?.(t) ?? null;
|
|
165
165
|
} finally {
|
|
166
|
-
|
|
166
|
+
cn = null;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/vue2-icons.ts
|
|
173
|
-
var
|
|
173
|
+
var _n = {
|
|
174
174
|
AlignCenter: {
|
|
175
175
|
iconName: "text-align-center",
|
|
176
176
|
node: [
|
|
@@ -1035,7 +1035,7 @@ var gn = {
|
|
|
1035
1035
|
}]]
|
|
1036
1036
|
}
|
|
1037
1037
|
};
|
|
1038
|
-
function
|
|
1038
|
+
function vn(e) {
|
|
1039
1039
|
return e.map(([e, t]) => B(e, t));
|
|
1040
1040
|
}
|
|
1041
1041
|
function Y(e) {
|
|
@@ -1056,7 +1056,7 @@ function Y(e) {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
},
|
|
1058
1058
|
setup(t) {
|
|
1059
|
-
let n =
|
|
1059
|
+
let n = _n[e];
|
|
1060
1060
|
return () => B("svg", {
|
|
1061
1061
|
class: `lucide lucide-${n.iconName}`,
|
|
1062
1062
|
viewBox: "0 0 24 24",
|
|
@@ -1069,12 +1069,12 @@ function Y(e) {
|
|
|
1069
1069
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1070
1070
|
"aria-hidden": "true",
|
|
1071
1071
|
focusable: "false"
|
|
1072
|
-
},
|
|
1072
|
+
}, vn(n.node));
|
|
1073
1073
|
}
|
|
1074
1074
|
});
|
|
1075
1075
|
}
|
|
1076
|
-
var
|
|
1077
|
-
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) {
|
|
1078
1078
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1079
1079
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1080
1080
|
return n === "view" ? {
|
|
@@ -1096,16 +1096,16 @@ function mr(e) {
|
|
|
1096
1096
|
i(), a?.disconnect();
|
|
1097
1097
|
}), r;
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function gr(e) {
|
|
1100
1100
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1101
1101
|
}
|
|
1102
|
-
function
|
|
1102
|
+
function _r(e) {
|
|
1103
1103
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function vr(e) {
|
|
1106
1106
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1107
1107
|
}
|
|
1108
|
-
function
|
|
1108
|
+
function yr(e, t) {
|
|
1109
1109
|
return B(e, {
|
|
1110
1110
|
size: 18,
|
|
1111
1111
|
strokeWidth: 1.8,
|
|
@@ -1121,12 +1121,12 @@ function X(e) {
|
|
|
1121
1121
|
"data-active": e.active ? "true" : "false",
|
|
1122
1122
|
onMousedown: (e) => e.preventDefault(),
|
|
1123
1123
|
onClick: e.onClick
|
|
1124
|
-
}, [
|
|
1124
|
+
}, [yr(e.icon, e.label), B("span", {
|
|
1125
1125
|
class: "markweave-image-tooltip",
|
|
1126
1126
|
role: "tooltip"
|
|
1127
1127
|
}, e.label)]);
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function br(e) {
|
|
1130
1130
|
let t = V(null), n = e.messages.image;
|
|
1131
1131
|
return B("section", {
|
|
1132
1132
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1160,7 +1160,7 @@ function yr(e) {
|
|
|
1160
1160
|
B("div", {
|
|
1161
1161
|
class: "markweave-image-upload-icon",
|
|
1162
1162
|
"aria-hidden": "true"
|
|
1163
|
-
}, [B(
|
|
1163
|
+
}, [B(Bn, {
|
|
1164
1164
|
size: 46,
|
|
1165
1165
|
strokeWidth: 1.6
|
|
1166
1166
|
})]),
|
|
@@ -1185,7 +1185,7 @@ function yr(e) {
|
|
|
1185
1185
|
"data-testid": "markweave-image-upload-submit",
|
|
1186
1186
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1187
1187
|
onClick: e.onSubmit
|
|
1188
|
-
}, [B(
|
|
1188
|
+
}, [B(Bn, {
|
|
1189
1189
|
size: 16,
|
|
1190
1190
|
strokeWidth: 1.8
|
|
1191
1191
|
}), e.messages.common.insert]),
|
|
@@ -1201,7 +1201,7 @@ function yr(e) {
|
|
|
1201
1201
|
}, e.error) : null
|
|
1202
1202
|
]);
|
|
1203
1203
|
}
|
|
1204
|
-
function
|
|
1204
|
+
function xr(e) {
|
|
1205
1205
|
let t = V(null), n = e.messages.video;
|
|
1206
1206
|
return B("section", {
|
|
1207
1207
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1235,7 +1235,7 @@ function br(e) {
|
|
|
1235
1235
|
B("div", {
|
|
1236
1236
|
class: "markweave-video-upload-icon",
|
|
1237
1237
|
"aria-hidden": "true"
|
|
1238
|
-
}, [B(
|
|
1238
|
+
}, [B(pr, {
|
|
1239
1239
|
size: 46,
|
|
1240
1240
|
strokeWidth: 1.6
|
|
1241
1241
|
})]),
|
|
@@ -1260,7 +1260,7 @@ function br(e) {
|
|
|
1260
1260
|
"data-testid": "markweave-video-upload-submit",
|
|
1261
1261
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1262
1262
|
onClick: e.onSubmit
|
|
1263
|
-
}, [B(
|
|
1263
|
+
}, [B(fr, {
|
|
1264
1264
|
size: 16,
|
|
1265
1265
|
strokeWidth: 1.8
|
|
1266
1266
|
}), e.messages.common.insert]),
|
|
@@ -1276,7 +1276,7 @@ function br(e) {
|
|
|
1276
1276
|
}, e.error) : null
|
|
1277
1277
|
]);
|
|
1278
1278
|
}
|
|
1279
|
-
var
|
|
1279
|
+
var Sr = J({
|
|
1280
1280
|
name: "MarkweaveVueImageNodeView",
|
|
1281
1281
|
props: {
|
|
1282
1282
|
editor: {
|
|
@@ -1309,7 +1309,7 @@ var xr = J({
|
|
|
1309
1309
|
}
|
|
1310
1310
|
},
|
|
1311
1311
|
setup(e) {
|
|
1312
|
-
let t = V(null), r = V(!1), i = V(!1), a = V(!1), o = V(""), c = V(null), l = V(!1), u = U(() => e.node.attrs), f = V(!!N(u.value.caption)), p = V(N(u.value.caption) ?? ""), m =
|
|
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
1313
|
v.value && b({
|
|
1314
1314
|
src: v.value,
|
|
1315
1315
|
alt: N(u.value.alt) ?? "",
|
|
@@ -1340,7 +1340,7 @@ var xr = J({
|
|
|
1340
1340
|
let n = e.extension.options;
|
|
1341
1341
|
l.value = !0, c.value = null;
|
|
1342
1342
|
try {
|
|
1343
|
-
let r = await
|
|
1343
|
+
let r = await I(ee(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1344
1344
|
e.updateAttributes(C(u.value, r)), o.value = "", i.value = !1;
|
|
1345
1345
|
} catch (e) {
|
|
1346
1346
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
@@ -1353,13 +1353,13 @@ var xr = J({
|
|
|
1353
1353
|
return;
|
|
1354
1354
|
}
|
|
1355
1355
|
A(P(o.value));
|
|
1356
|
-
},
|
|
1356
|
+
}, F = (e) => {
|
|
1357
1357
|
A({
|
|
1358
1358
|
type: "file",
|
|
1359
1359
|
file: e,
|
|
1360
1360
|
mimeType: e.type || "image/*"
|
|
1361
1361
|
});
|
|
1362
|
-
},
|
|
1362
|
+
}, te = () => {
|
|
1363
1363
|
f.value = !f.value, f.value && (p.value = S.value ?? "");
|
|
1364
1364
|
}, L = (n, r) => {
|
|
1365
1365
|
if (!h.value || !v.value) return;
|
|
@@ -1382,7 +1382,7 @@ var xr = J({
|
|
|
1382
1382
|
"data-selected": "false",
|
|
1383
1383
|
"data-hovered": "false",
|
|
1384
1384
|
"data-empty": "true"
|
|
1385
|
-
}, () =>
|
|
1385
|
+
}, () => br({
|
|
1386
1386
|
messages: g.value,
|
|
1387
1387
|
inputValue: o.value,
|
|
1388
1388
|
error: c.value,
|
|
@@ -1391,7 +1391,7 @@ var xr = J({
|
|
|
1391
1391
|
onInputValue: (e) => {
|
|
1392
1392
|
o.value = e;
|
|
1393
1393
|
},
|
|
1394
|
-
onFile:
|
|
1394
|
+
onFile: F,
|
|
1395
1395
|
onSubmit: j,
|
|
1396
1396
|
onCancel: k,
|
|
1397
1397
|
onDragActive: (e) => {
|
|
@@ -1412,7 +1412,7 @@ var xr = J({
|
|
|
1412
1412
|
r.value = !1;
|
|
1413
1413
|
},
|
|
1414
1414
|
onMousedown: (e) => {
|
|
1415
|
-
h.value && !
|
|
1415
|
+
h.value && !gr(e.target) && D();
|
|
1416
1416
|
}
|
|
1417
1417
|
}, () => [
|
|
1418
1418
|
h.value ? B("div", {
|
|
@@ -1424,21 +1424,21 @@ var xr = J({
|
|
|
1424
1424
|
X({
|
|
1425
1425
|
testId: "markweave-image-align-left",
|
|
1426
1426
|
label: _.value.alignLeft,
|
|
1427
|
-
icon:
|
|
1427
|
+
icon: xn,
|
|
1428
1428
|
active: y.value === "left",
|
|
1429
1429
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1430
1430
|
}),
|
|
1431
1431
|
X({
|
|
1432
1432
|
testId: "markweave-image-align-center",
|
|
1433
1433
|
label: _.value.alignCenter,
|
|
1434
|
-
icon:
|
|
1434
|
+
icon: yn,
|
|
1435
1435
|
active: y.value === "center",
|
|
1436
1436
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1437
1437
|
}),
|
|
1438
1438
|
X({
|
|
1439
1439
|
testId: "markweave-image-align-right",
|
|
1440
1440
|
label: _.value.alignRight,
|
|
1441
|
-
icon:
|
|
1441
|
+
icon: Sn,
|
|
1442
1442
|
active: y.value === "right",
|
|
1443
1443
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1444
1444
|
}),
|
|
@@ -1449,20 +1449,20 @@ var xr = J({
|
|
|
1449
1449
|
X({
|
|
1450
1450
|
testId: "markweave-image-caption",
|
|
1451
1451
|
label: _.value.caption,
|
|
1452
|
-
icon:
|
|
1452
|
+
icon: En,
|
|
1453
1453
|
active: f.value || !!S.value,
|
|
1454
|
-
onClick:
|
|
1454
|
+
onClick: te
|
|
1455
1455
|
}),
|
|
1456
1456
|
X({
|
|
1457
1457
|
testId: "markweave-image-preview",
|
|
1458
1458
|
label: _.value.preview,
|
|
1459
|
-
icon:
|
|
1459
|
+
icon: Pn,
|
|
1460
1460
|
onClick: T
|
|
1461
1461
|
}),
|
|
1462
1462
|
X({
|
|
1463
1463
|
testId: "markweave-image-download",
|
|
1464
1464
|
label: _.value.download,
|
|
1465
|
-
icon:
|
|
1465
|
+
icon: Nn,
|
|
1466
1466
|
onClick: () => {
|
|
1467
1467
|
v.value && O(v.value);
|
|
1468
1468
|
}
|
|
@@ -1470,7 +1470,7 @@ var xr = J({
|
|
|
1470
1470
|
X({
|
|
1471
1471
|
testId: "markweave-image-replace",
|
|
1472
1472
|
label: _.value.replace,
|
|
1473
|
-
icon:
|
|
1473
|
+
icon: tr,
|
|
1474
1474
|
onClick: () => {
|
|
1475
1475
|
o.value = "", c.value = null, i.value = !0;
|
|
1476
1476
|
}
|
|
@@ -1482,7 +1482,7 @@ var xr = J({
|
|
|
1482
1482
|
X({
|
|
1483
1483
|
testId: "markweave-image-delete",
|
|
1484
1484
|
label: _.value.delete,
|
|
1485
|
-
icon:
|
|
1485
|
+
icon: lr,
|
|
1486
1486
|
onClick: () => e.deleteNode()
|
|
1487
1487
|
})
|
|
1488
1488
|
]) : null,
|
|
@@ -1511,7 +1511,7 @@ var xr = J({
|
|
|
1511
1511
|
title: _.value.preview,
|
|
1512
1512
|
onMousedown: (e) => e.preventDefault(),
|
|
1513
1513
|
onClick: T
|
|
1514
|
-
}, [B(
|
|
1514
|
+
}, [B(Pn, {
|
|
1515
1515
|
size: 16,
|
|
1516
1516
|
strokeWidth: 1.8
|
|
1517
1517
|
}), B("span", {
|
|
@@ -1556,7 +1556,7 @@ var xr = J({
|
|
|
1556
1556
|
}, S.value) : null
|
|
1557
1557
|
]);
|
|
1558
1558
|
}
|
|
1559
|
-
}),
|
|
1559
|
+
}), Cr = J({
|
|
1560
1560
|
name: "MarkweaveVueVideoNodeView",
|
|
1561
1561
|
props: {
|
|
1562
1562
|
editor: {
|
|
@@ -1589,14 +1589,14 @@ var xr = J({
|
|
|
1589
1589
|
}
|
|
1590
1590
|
},
|
|
1591
1591
|
setup(e) {
|
|
1592
|
-
let t = V(!1), r = V(""), i = V(null), a = V(!1), o =
|
|
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 = () => {
|
|
1593
1593
|
p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
|
|
1594
1594
|
}, b = async (n) => {
|
|
1595
1595
|
if (!c.value) return;
|
|
1596
1596
|
let o = e.extension.options;
|
|
1597
1597
|
a.value = !0, i.value = null;
|
|
1598
1598
|
try {
|
|
1599
|
-
let t = await
|
|
1599
|
+
let t = await I(D(n), o?.onUpload);
|
|
1600
1600
|
e.updateAttributes(w(t)), r.value = "";
|
|
1601
1601
|
} catch (e) {
|
|
1602
1602
|
i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
@@ -1630,7 +1630,7 @@ var xr = J({
|
|
|
1630
1630
|
"data-testid": "markweave-video-node",
|
|
1631
1631
|
"data-empty": "true",
|
|
1632
1632
|
"data-selected": "false"
|
|
1633
|
-
}, () =>
|
|
1633
|
+
}, () => xr({
|
|
1634
1634
|
messages: l.value,
|
|
1635
1635
|
inputValue: r.value,
|
|
1636
1636
|
error: i.value,
|
|
@@ -1657,7 +1657,7 @@ var xr = J({
|
|
|
1657
1657
|
onFocus: C,
|
|
1658
1658
|
onKeydown: E,
|
|
1659
1659
|
onMousedown: (e) => {
|
|
1660
|
-
c.value && !
|
|
1660
|
+
c.value && !_r(e.target) && (e.preventDefault(), C());
|
|
1661
1661
|
}
|
|
1662
1662
|
}, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
|
|
1663
1663
|
class: "markweave-video-iframe",
|
|
@@ -1695,7 +1695,7 @@ var xr = J({
|
|
|
1695
1695
|
"aria-hidden": "true"
|
|
1696
1696
|
})]);
|
|
1697
1697
|
}
|
|
1698
|
-
}),
|
|
1698
|
+
}), wr = x.extend({
|
|
1699
1699
|
addOptions() {
|
|
1700
1700
|
return {
|
|
1701
1701
|
...this.parent?.(),
|
|
@@ -1704,9 +1704,9 @@ var xr = J({
|
|
|
1704
1704
|
};
|
|
1705
1705
|
},
|
|
1706
1706
|
addNodeView() {
|
|
1707
|
-
return typeof document > "u" ? null : c(
|
|
1707
|
+
return typeof document > "u" ? null : c(Sr, { stopEvent: ({ event: e }) => gr(e.target) });
|
|
1708
1708
|
}
|
|
1709
|
-
}),
|
|
1709
|
+
}), Tr = S.extend({
|
|
1710
1710
|
addOptions() {
|
|
1711
1711
|
return {
|
|
1712
1712
|
...this.parent?.(),
|
|
@@ -1715,9 +1715,9 @@ var xr = J({
|
|
|
1715
1715
|
};
|
|
1716
1716
|
},
|
|
1717
1717
|
addNodeView() {
|
|
1718
|
-
return typeof document > "u" ? null : c(
|
|
1718
|
+
return typeof document > "u" ? null : c(Cr, { stopEvent: ({ event: e }) => _r(e.target) });
|
|
1719
1719
|
}
|
|
1720
|
-
}),
|
|
1720
|
+
}), Er = J({
|
|
1721
1721
|
name: "MarkweaveVueLinkCardNodeView",
|
|
1722
1722
|
props: {
|
|
1723
1723
|
editor: {
|
|
@@ -1750,7 +1750,7 @@ var xr = J({
|
|
|
1750
1750
|
}
|
|
1751
1751
|
},
|
|
1752
1752
|
setup(e) {
|
|
1753
|
-
let t = e.extension.options, r = t.messages ?? n("zh"), i =
|
|
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
1754
|
W(l, (e) => {
|
|
1755
1755
|
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
1756
1756
|
});
|
|
@@ -1785,7 +1785,7 @@ var xr = J({
|
|
|
1785
1785
|
"data-testid": n,
|
|
1786
1786
|
onMousedown: h,
|
|
1787
1787
|
onClick: r
|
|
1788
|
-
}, [
|
|
1788
|
+
}, [yr(t, e), B("span", { role: "tooltip" }, e)]);
|
|
1789
1789
|
return () => {
|
|
1790
1790
|
let n = l.value;
|
|
1791
1791
|
if (!n) return null;
|
|
@@ -1821,10 +1821,10 @@ var xr = J({
|
|
|
1821
1821
|
a.value = !1;
|
|
1822
1822
|
},
|
|
1823
1823
|
onMousedown: (e) => {
|
|
1824
|
-
|
|
1824
|
+
vr(e.target) || e.preventDefault();
|
|
1825
1825
|
},
|
|
1826
1826
|
onClick: (e) => {
|
|
1827
|
-
|
|
1827
|
+
vr(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
1828
1828
|
}
|
|
1829
1829
|
}, () => [
|
|
1830
1830
|
B("a", {
|
|
@@ -1844,9 +1844,9 @@ var xr = J({
|
|
|
1844
1844
|
"data-markweave-link-card-ui": "true",
|
|
1845
1845
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
1846
1846
|
}, [
|
|
1847
|
-
C(r.linkCard.convertToLink,
|
|
1848
|
-
C(r.linkCard.copyAddress,
|
|
1849
|
-
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({
|
|
1850
1850
|
anchor: i.currentTarget,
|
|
1851
1851
|
editor: e.editor,
|
|
1852
1852
|
messages: r,
|
|
@@ -1856,7 +1856,7 @@ var xr = J({
|
|
|
1856
1856
|
attrs: n
|
|
1857
1857
|
}
|
|
1858
1858
|
})),
|
|
1859
|
-
C(r.linkCard.delete,
|
|
1859
|
+
C(r.linkCard.delete, lr, "markweave-link-card-delete", () => e.deleteNode())
|
|
1860
1860
|
]) : null,
|
|
1861
1861
|
p.value && o.value ? B("form", {
|
|
1862
1862
|
class: "markweave-link-card-editor",
|
|
@@ -1884,12 +1884,12 @@ var xr = J({
|
|
|
1884
1884
|
type: "submit",
|
|
1885
1885
|
disabled: !v(f.value),
|
|
1886
1886
|
"aria-label": r.linkCard.edit
|
|
1887
|
-
}, [
|
|
1887
|
+
}, [yr(Kn, r.linkCard.edit)])
|
|
1888
1888
|
]) : null
|
|
1889
1889
|
]);
|
|
1890
1890
|
};
|
|
1891
1891
|
}
|
|
1892
|
-
}),
|
|
1892
|
+
}), Dr = h.extend({
|
|
1893
1893
|
addOptions() {
|
|
1894
1894
|
return {
|
|
1895
1895
|
...this.parent?.(),
|
|
@@ -1898,22 +1898,22 @@ var xr = J({
|
|
|
1898
1898
|
};
|
|
1899
1899
|
},
|
|
1900
1900
|
addNodeView() {
|
|
1901
|
-
return typeof document > "u" ? null : c(
|
|
1901
|
+
return typeof document > "u" ? null : c(Er, { stopEvent: ({ event: e }) => vr(e.target) });
|
|
1902
1902
|
}
|
|
1903
1903
|
});
|
|
1904
1904
|
//#endregion
|
|
1905
1905
|
//#region src/create-editor-extensions.ts
|
|
1906
|
-
function
|
|
1906
|
+
function Or(t = {}) {
|
|
1907
1907
|
return e({
|
|
1908
1908
|
lang: t.lang,
|
|
1909
|
-
linkCardExtension:
|
|
1909
|
+
linkCardExtension: Dr.configure({
|
|
1910
1910
|
lang: t.lang,
|
|
1911
1911
|
messages: n(t.lang),
|
|
1912
1912
|
resolver: t.linkCardResolver
|
|
1913
1913
|
}),
|
|
1914
1914
|
mediaExtensions: i({
|
|
1915
|
-
image:
|
|
1916
|
-
video:
|
|
1915
|
+
image: wr,
|
|
1916
|
+
video: Tr,
|
|
1917
1917
|
lang: t.lang,
|
|
1918
1918
|
onImageUpload: t.onImageUpload,
|
|
1919
1919
|
onVideoUpload: t.onVideoUpload
|
|
@@ -1922,7 +1922,7 @@ function Dr(t = {}) {
|
|
|
1922
1922
|
}
|
|
1923
1923
|
//#endregion
|
|
1924
1924
|
//#region src/MarkweaveEditor.ts
|
|
1925
|
-
var
|
|
1925
|
+
var kr = {
|
|
1926
1926
|
active: !1,
|
|
1927
1927
|
mode: "outside",
|
|
1928
1928
|
activeCellPos: null,
|
|
@@ -1930,17 +1930,17 @@ var Or = {
|
|
|
1930
1930
|
selectedCellCount: 0,
|
|
1931
1931
|
selectionFrom: 0,
|
|
1932
1932
|
selectionTo: 0
|
|
1933
|
-
},
|
|
1933
|
+
}, Ar = {
|
|
1934
1934
|
active: !1,
|
|
1935
|
-
language:
|
|
1935
|
+
language: Pe.defaultLanguage,
|
|
1936
1936
|
mermaidPreviewMode: "code",
|
|
1937
1937
|
pos: null,
|
|
1938
1938
|
text: ""
|
|
1939
1939
|
};
|
|
1940
|
-
function Ar(e) {
|
|
1941
|
-
return Rt.getState(e.state) ?? Lt;
|
|
1942
|
-
}
|
|
1943
1940
|
function jr(e) {
|
|
1941
|
+
return zt.getState(e.state) ?? Rt;
|
|
1942
|
+
}
|
|
1943
|
+
function Mr(e) {
|
|
1944
1944
|
if (!e || typeof window > "u") return null;
|
|
1945
1945
|
let t = e.parentElement;
|
|
1946
1946
|
for (; t;) {
|
|
@@ -1957,7 +1957,7 @@ function Z(e, t, n = 18, r = 1.8) {
|
|
|
1957
1957
|
"aria-hidden": "true"
|
|
1958
1958
|
}, { default: () => t });
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1960
|
+
function Nr(e) {
|
|
1961
1961
|
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", {
|
|
1962
1962
|
cx: "10",
|
|
1963
1963
|
cy: "10",
|
|
@@ -2005,57 +2005,57 @@ function Q(e) {
|
|
|
2005
2005
|
"stroke-linecap": "round",
|
|
2006
2006
|
"stroke-linejoin": "round",
|
|
2007
2007
|
"stroke-width": "1.8"
|
|
2008
|
-
},
|
|
2008
|
+
}, Nr(e)));
|
|
2009
2009
|
}
|
|
2010
2010
|
function $(e) {
|
|
2011
2011
|
e.preventDefault();
|
|
2012
2012
|
}
|
|
2013
|
-
function
|
|
2014
|
-
let t =
|
|
2013
|
+
function Pr(e) {
|
|
2014
|
+
let t = ot(e);
|
|
2015
2015
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
2016
2016
|
}
|
|
2017
|
-
var
|
|
2018
|
-
bold:
|
|
2019
|
-
italic:
|
|
2020
|
-
underline:
|
|
2021
|
-
strike:
|
|
2022
|
-
"inline-code":
|
|
2023
|
-
link:
|
|
2024
|
-
more:
|
|
2025
|
-
superscript:
|
|
2026
|
-
subscript:
|
|
2027
|
-
"inline-math":
|
|
2028
|
-
"align-left":
|
|
2029
|
-
"align-center":
|
|
2030
|
-
"align-right":
|
|
2031
|
-
"align-justify":
|
|
2032
|
-
"decrease-indent":
|
|
2033
|
-
"increase-indent":
|
|
2034
|
-
},
|
|
2035
|
-
type:
|
|
2036
|
-
"heading-1":
|
|
2037
|
-
"heading-2":
|
|
2038
|
-
"heading-3":
|
|
2039
|
-
"bullet-list":
|
|
2040
|
-
"ordered-list":
|
|
2041
|
-
"task-list":
|
|
2042
|
-
blockquote:
|
|
2043
|
-
"code-block":
|
|
2044
|
-
info:
|
|
2045
|
-
tip:
|
|
2046
|
-
warning:
|
|
2047
|
-
error:
|
|
2048
|
-
success:
|
|
2049
|
-
emoji:
|
|
2050
|
-
math:
|
|
2051
|
-
table:
|
|
2052
|
-
separator:
|
|
2053
|
-
image:
|
|
2054
|
-
video:
|
|
2055
|
-
attachment:
|
|
2017
|
+
var Fr = {
|
|
2018
|
+
bold: wn,
|
|
2019
|
+
italic: Wn,
|
|
2020
|
+
underline: dr,
|
|
2021
|
+
strike: ir,
|
|
2022
|
+
"inline-code": jn,
|
|
2023
|
+
link: Kn,
|
|
2024
|
+
more: Zn,
|
|
2025
|
+
superscript: or,
|
|
2026
|
+
subscript: ar,
|
|
2027
|
+
"inline-math": nr,
|
|
2028
|
+
"align-left": xn,
|
|
2029
|
+
"align-center": yn,
|
|
2030
|
+
"align-right": Sn,
|
|
2031
|
+
"align-justify": bn,
|
|
2032
|
+
"decrease-indent": Vn,
|
|
2033
|
+
"increase-indent": Hn
|
|
2034
|
+
}, Ir = {
|
|
2035
|
+
type: cr,
|
|
2036
|
+
"heading-1": In,
|
|
2037
|
+
"heading-2": Ln,
|
|
2038
|
+
"heading-3": Rn,
|
|
2039
|
+
"bullet-list": qn,
|
|
2040
|
+
"ordered-list": Yn,
|
|
2041
|
+
"task-list": Jn,
|
|
2042
|
+
blockquote: er,
|
|
2043
|
+
"code-block": Tn,
|
|
2044
|
+
info: Un,
|
|
2045
|
+
tip: Gn,
|
|
2046
|
+
warning: Cn,
|
|
2047
|
+
error: An,
|
|
2048
|
+
success: Dn,
|
|
2049
|
+
emoji: rr,
|
|
2050
|
+
math: nr,
|
|
2051
|
+
table: sr,
|
|
2052
|
+
separator: Xn,
|
|
2053
|
+
image: zn,
|
|
2054
|
+
video: pr,
|
|
2055
|
+
attachment: Qn
|
|
2056
2056
|
};
|
|
2057
|
-
function
|
|
2058
|
-
let t =
|
|
2057
|
+
function Lr(e) {
|
|
2058
|
+
let t = Ir[e];
|
|
2059
2059
|
return B(t, {
|
|
2060
2060
|
size: 18,
|
|
2061
2061
|
strokeWidth: 1.6,
|
|
@@ -2063,21 +2063,21 @@ function Ir(e) {
|
|
|
2063
2063
|
"aria-hidden": "true"
|
|
2064
2064
|
});
|
|
2065
2065
|
}
|
|
2066
|
-
var
|
|
2067
|
-
paragraph:
|
|
2068
|
-
"heading-1":
|
|
2069
|
-
"heading-2":
|
|
2070
|
-
"heading-3":
|
|
2071
|
-
"bullet-list":
|
|
2072
|
-
"numbered-list":
|
|
2073
|
-
"todo-list":
|
|
2074
|
-
quote:
|
|
2075
|
-
"code-block":
|
|
2066
|
+
var Rr = {
|
|
2067
|
+
paragraph: ur,
|
|
2068
|
+
"heading-1": In,
|
|
2069
|
+
"heading-2": Ln,
|
|
2070
|
+
"heading-3": Rn,
|
|
2071
|
+
"bullet-list": qn,
|
|
2072
|
+
"numbered-list": Yn,
|
|
2073
|
+
"todo-list": Jn,
|
|
2074
|
+
quote: er,
|
|
2075
|
+
"code-block": Tn
|
|
2076
2076
|
};
|
|
2077
|
-
function
|
|
2077
|
+
function zr(e, t) {
|
|
2078
2078
|
return se(e, t).label;
|
|
2079
2079
|
}
|
|
2080
|
-
var
|
|
2080
|
+
var Br = J({
|
|
2081
2081
|
name: "MarkweaveVueFloatingToolbar",
|
|
2082
2082
|
props: {
|
|
2083
2083
|
editor: {
|
|
@@ -2094,10 +2094,10 @@ var zr = J({
|
|
|
2094
2094
|
}
|
|
2095
2095
|
},
|
|
2096
2096
|
setup(e) {
|
|
2097
|
-
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(() =>
|
|
2097
|
+
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) => [
|
|
2098
2098
|
e.id,
|
|
2099
2099
|
e.label,
|
|
2100
|
-
|
|
2100
|
+
Rr[e.id]
|
|
2101
2101
|
])), f = U(() => z(e.messages).map((e) => [
|
|
2102
2102
|
e.id,
|
|
2103
2103
|
e.value,
|
|
@@ -2172,7 +2172,7 @@ var zr = J({
|
|
|
2172
2172
|
onMouseenter: (e) => b(n, e.currentTarget),
|
|
2173
2173
|
onMouseleave: () => b(null),
|
|
2174
2174
|
onClick: o
|
|
2175
|
-
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" },
|
|
2175
|
+
}, 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", {
|
|
2176
2176
|
class: "markweave-floating-toolbar-divider",
|
|
2177
2177
|
"aria-hidden": "true"
|
|
2178
2178
|
}), w = (n, r, i) => B("section", {
|
|
@@ -2228,7 +2228,7 @@ var zr = J({
|
|
|
2228
2228
|
"aria-label": u.value.applyLink,
|
|
2229
2229
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2230
2230
|
onMousedown: $
|
|
2231
|
-
}, [Z(
|
|
2231
|
+
}, [Z(Mn, u.value.applyLink)]),
|
|
2232
2232
|
B("span", {
|
|
2233
2233
|
class: "markweave-floating-toolbar-link-divider",
|
|
2234
2234
|
"aria-hidden": "true"
|
|
@@ -2239,15 +2239,15 @@ var zr = J({
|
|
|
2239
2239
|
"aria-label": u.value.openLink,
|
|
2240
2240
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2241
2241
|
onMousedown: $,
|
|
2242
|
-
onClick: () =>
|
|
2243
|
-
}, [Z(
|
|
2242
|
+
onClick: () => Pr(n.value)
|
|
2243
|
+
}, [Z(Fn, u.value.openLink)]),
|
|
2244
2244
|
B("button", {
|
|
2245
2245
|
type: "button",
|
|
2246
2246
|
"aria-label": u.value.removeLink,
|
|
2247
2247
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2248
2248
|
onMousedown: $,
|
|
2249
2249
|
onClick: g
|
|
2250
|
-
}, [Z(
|
|
2250
|
+
}, [Z(lr, u.value.removeLink)])
|
|
2251
2251
|
])]) : t.value === "color" ? B("div", {
|
|
2252
2252
|
ref: c,
|
|
2253
2253
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
@@ -2274,11 +2274,11 @@ var zr = J({
|
|
|
2274
2274
|
onClick: () => {
|
|
2275
2275
|
de(e.editor, n), t.value = null;
|
|
2276
2276
|
}
|
|
2277
|
-
}, [Z(
|
|
2277
|
+
}, [Z(Fr[n], u.value.moreActions[n])]), r.value === n ? B("div", {
|
|
2278
2278
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2279
2279
|
role: "tooltip"
|
|
2280
2280
|
}, u.value.moreActions[n]) : null]))) : null;
|
|
2281
|
-
return () => B(
|
|
2281
|
+
return () => B(te, {
|
|
2282
2282
|
editor: e.editor,
|
|
2283
2283
|
shouldShow: ({ editor: e }) => e.isEditable && ye(_e(e)),
|
|
2284
2284
|
options: { placement: "top" }
|
|
@@ -2292,23 +2292,23 @@ var zr = J({
|
|
|
2292
2292
|
class: "markweave-floating-toolbar-content",
|
|
2293
2293
|
"data-menu": t.value ?? "none"
|
|
2294
2294
|
}, [
|
|
2295
|
-
S("block-type", u.value.buttons["block-type"],
|
|
2295
|
+
S("block-type", u.value.buttons["block-type"], ur, () => _("block-type"), t.value === "block-type"),
|
|
2296
2296
|
C(),
|
|
2297
|
-
S("bold", u.value.buttons.bold,
|
|
2298
|
-
S("italic", u.value.buttons.italic,
|
|
2299
|
-
S("underline", u.value.buttons.underline,
|
|
2300
|
-
S("strike", u.value.buttons.strike,
|
|
2301
|
-
S("inline-code", u.value.buttons["inline-code"],
|
|
2297
|
+
S("bold", u.value.buttons.bold, wn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2298
|
+
S("italic", u.value.buttons.italic, Wn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2299
|
+
S("underline", u.value.buttons.underline, dr, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2300
|
+
S("strike", u.value.buttons.strike, ir, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2301
|
+
S("inline-code", u.value.buttons["inline-code"], jn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2302
2302
|
C(),
|
|
2303
|
-
S("link", u.value.buttons.link,
|
|
2304
|
-
S("color", u.value.buttons.color,
|
|
2303
|
+
S("link", u.value.buttons.link, Kn, () => _("link"), e.editor.isActive("link")),
|
|
2304
|
+
S("color", u.value.buttons.color, ur, () => _("color"), t.value === "color"),
|
|
2305
2305
|
C(),
|
|
2306
|
-
S("more", u.value.buttons.more,
|
|
2306
|
+
S("more", u.value.buttons.more, Zn, () => _("more"), t.value === "more"),
|
|
2307
2307
|
T(),
|
|
2308
2308
|
x()
|
|
2309
2309
|
])]) });
|
|
2310
2310
|
}
|
|
2311
|
-
}),
|
|
2311
|
+
}), Vr = J({
|
|
2312
2312
|
name: "MarkweaveVueMathEditorPopover",
|
|
2313
2313
|
props: {
|
|
2314
2314
|
editor: {
|
|
@@ -2329,17 +2329,17 @@ var zr = J({
|
|
|
2329
2329
|
}
|
|
2330
2330
|
},
|
|
2331
2331
|
setup(e) {
|
|
2332
|
-
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(
|
|
2332
|
+
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 ? {
|
|
2333
2333
|
html: a.value,
|
|
2334
2334
|
error: !1
|
|
2335
|
-
} :
|
|
2335
|
+
} : 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 = () => {
|
|
2336
2336
|
if (typeof window > "u") return;
|
|
2337
|
-
let r =
|
|
2337
|
+
let r = lt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2338
2338
|
if (!r || !i) {
|
|
2339
2339
|
e.onClose();
|
|
2340
2340
|
return;
|
|
2341
2341
|
}
|
|
2342
|
-
n.value =
|
|
2342
|
+
n.value = ct({
|
|
2343
2343
|
anchorRect: r,
|
|
2344
2344
|
frameRect: i,
|
|
2345
2345
|
kind: e.target.kind,
|
|
@@ -2348,7 +2348,7 @@ var zr = J({
|
|
|
2348
2348
|
viewportWidth: window.innerWidth
|
|
2349
2349
|
});
|
|
2350
2350
|
}, d = () => {
|
|
2351
|
-
s.value &&
|
|
2351
|
+
s.value && st(e.editor, e.target, t.value) && e.onClose();
|
|
2352
2352
|
}, f = (t) => {
|
|
2353
2353
|
if (t.key === "Escape") {
|
|
2354
2354
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -2360,13 +2360,13 @@ var zr = J({
|
|
|
2360
2360
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2361
2361
|
};
|
|
2362
2362
|
return W(() => [e.target.pos, e.target.latex], () => {
|
|
2363
|
-
t.value = e.target.latex, a.value =
|
|
2363
|
+
t.value = e.target.latex, a.value = dt(e.editor, e.target), q(u);
|
|
2364
2364
|
}), G(() => {
|
|
2365
|
-
|
|
2365
|
+
gt(e.editor, e.target, !0), u(), q(() => {
|
|
2366
2366
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2367
2367
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2368
2368
|
}), K(() => {
|
|
2369
|
-
|
|
2369
|
+
gt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2370
2370
|
}), () => {
|
|
2371
2371
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2372
2372
|
ref: i,
|
|
@@ -2427,14 +2427,14 @@ var zr = J({
|
|
|
2427
2427
|
}, [
|
|
2428
2428
|
B("div", { class: "markweave-math-block-toolbar" }, [
|
|
2429
2429
|
B("span", null, c.value.label),
|
|
2430
|
-
Z(
|
|
2430
|
+
Z(jn, c.value.label, 15, 1.75),
|
|
2431
2431
|
B("button", {
|
|
2432
2432
|
type: "submit",
|
|
2433
2433
|
title: c.value.apply,
|
|
2434
2434
|
"aria-label": c.value.apply,
|
|
2435
2435
|
disabled: !s.value,
|
|
2436
2436
|
"data-testid": "markweave-math-editor-apply"
|
|
2437
|
-
}, [Z(
|
|
2437
|
+
}, [Z(Dn, c.value.apply, 16, 2)])
|
|
2438
2438
|
]),
|
|
2439
2439
|
B("label", {
|
|
2440
2440
|
class: "markweave-math-block-source",
|
|
@@ -2457,7 +2457,7 @@ var zr = J({
|
|
|
2457
2457
|
]);
|
|
2458
2458
|
};
|
|
2459
2459
|
}
|
|
2460
|
-
}),
|
|
2460
|
+
}), Hr = J({
|
|
2461
2461
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2462
2462
|
props: {
|
|
2463
2463
|
commands: {
|
|
@@ -2522,7 +2522,7 @@ var zr = J({
|
|
|
2522
2522
|
r.value = e.messages.slash.uploadRequiredError;
|
|
2523
2523
|
return;
|
|
2524
2524
|
}
|
|
2525
|
-
let a = await
|
|
2525
|
+
let a = await I(i, e.onUpload);
|
|
2526
2526
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2527
2527
|
} catch (t) {
|
|
2528
2528
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -2643,7 +2643,7 @@ var zr = J({
|
|
|
2643
2643
|
class: "markweave-slash-group",
|
|
2644
2644
|
"aria-label": t.group
|
|
2645
2645
|
}, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
2646
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
2646
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = Tt(t);
|
|
2647
2647
|
return B("button", {
|
|
2648
2648
|
key: t.id,
|
|
2649
2649
|
type: "button",
|
|
@@ -2666,7 +2666,7 @@ var zr = J({
|
|
|
2666
2666
|
}
|
|
2667
2667
|
}
|
|
2668
2668
|
}, [
|
|
2669
|
-
|
|
2669
|
+
Lr(t.icon),
|
|
2670
2670
|
B("span", null, t.label),
|
|
2671
2671
|
t.disabledReason ? B("small", null, t.disabledReason) : null
|
|
2672
2672
|
]);
|
|
@@ -2677,7 +2677,7 @@ var zr = J({
|
|
|
2677
2677
|
}, e.messages.slash.noResults)])]);
|
|
2678
2678
|
};
|
|
2679
2679
|
}
|
|
2680
|
-
}),
|
|
2680
|
+
}), Ur = J({
|
|
2681
2681
|
name: "MarkweaveVueTableControls",
|
|
2682
2682
|
props: {
|
|
2683
2683
|
editor: {
|
|
@@ -2710,12 +2710,12 @@ var zr = J({
|
|
|
2710
2710
|
}
|
|
2711
2711
|
},
|
|
2712
2712
|
setup(e) {
|
|
2713
|
-
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 ?
|
|
2713
|
+
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 = () => {
|
|
2714
2714
|
p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
|
|
2715
2715
|
}, x = (e) => {
|
|
2716
2716
|
b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
|
|
2717
2717
|
s.value = null, p = null;
|
|
2718
|
-
},
|
|
2718
|
+
}, nn));
|
|
2719
2719
|
}, S = () => {
|
|
2720
2720
|
if (!e.active) {
|
|
2721
2721
|
r.value = null, i.value = null, a.value = null, x(null);
|
|
@@ -2726,16 +2726,16 @@ var zr = J({
|
|
|
2726
2726
|
r.value = null, i.value = null, a.value = null;
|
|
2727
2727
|
return;
|
|
2728
2728
|
}
|
|
2729
|
-
let s = o.getBoundingClientRect(), c = h.value ?
|
|
2730
|
-
c ? r.value =
|
|
2729
|
+
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;
|
|
2730
|
+
c ? r.value = Vt({
|
|
2731
2731
|
targetRect: c,
|
|
2732
2732
|
frameRect: s,
|
|
2733
2733
|
kind: "row"
|
|
2734
|
-
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value =
|
|
2734
|
+
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Vt({
|
|
2735
2735
|
targetRect: l,
|
|
2736
2736
|
frameRect: s,
|
|
2737
2737
|
kind: "column"
|
|
2738
|
-
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value =
|
|
2738
|
+
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Vt({
|
|
2739
2739
|
targetRect: u,
|
|
2740
2740
|
frameRect: s,
|
|
2741
2741
|
kind: "selection"
|
|
@@ -2750,13 +2750,13 @@ var zr = J({
|
|
|
2750
2750
|
o.value = null;
|
|
2751
2751
|
return;
|
|
2752
2752
|
}
|
|
2753
|
-
let a = i.getBoundingClientRect(), s = t.value === "row" ?
|
|
2753
|
+
let a = i.getBoundingClientRect(), s = t.value === "row" ? Gt(e.editor)?.getBoundingClientRect() : null, c = s ? {
|
|
2754
2754
|
left: a.left,
|
|
2755
2755
|
top: s.top,
|
|
2756
2756
|
width: a.width,
|
|
2757
2757
|
height: a.height
|
|
2758
2758
|
} : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
|
|
2759
|
-
o.value =
|
|
2759
|
+
o.value = Bt({
|
|
2760
2760
|
anchorRect: c,
|
|
2761
2761
|
frameRect: p,
|
|
2762
2762
|
menuSize: {
|
|
@@ -2773,16 +2773,16 @@ var zr = J({
|
|
|
2773
2773
|
let i = t.value === e && n.value === r;
|
|
2774
2774
|
n.value = r, t.value = i ? null : e, T();
|
|
2775
2775
|
}, ee = () => {
|
|
2776
|
-
e.editor.view.dispatch(
|
|
2776
|
+
e.editor.view.dispatch(Nt(e.editor.state.tr, null));
|
|
2777
2777
|
}, D = (t, n) => {
|
|
2778
2778
|
let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
2779
|
-
r !== null &&
|
|
2779
|
+
r !== null && tn(e.editor, r, t, { visualIndex: i }), E(t, n);
|
|
2780
2780
|
}, O = () => {
|
|
2781
2781
|
ee(), E("selection", "selection-edge");
|
|
2782
2782
|
}, k = (n = !1) => {
|
|
2783
2783
|
t.value = null, o.value = null, n && e.editor.view.focus();
|
|
2784
2784
|
}, A = async (n, r) => {
|
|
2785
|
-
let i = await
|
|
2785
|
+
let i = await Ut({
|
|
2786
2786
|
editor: e.editor,
|
|
2787
2787
|
commandId: n,
|
|
2788
2788
|
menu: r ?? t.value ?? "selection",
|
|
@@ -2790,7 +2790,7 @@ var zr = J({
|
|
|
2790
2790
|
});
|
|
2791
2791
|
return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
2792
2792
|
}, j = (t) => {
|
|
2793
|
-
let n =
|
|
2793
|
+
let n = Yt(e.editor, t);
|
|
2794
2794
|
n && e.onEditWithAi?.(n), k(!0);
|
|
2795
2795
|
}, M = (e) => {
|
|
2796
2796
|
!t.value || e.key !== "Escape" || k(!0);
|
|
@@ -2816,7 +2816,7 @@ var zr = J({
|
|
|
2816
2816
|
ref: f,
|
|
2817
2817
|
class: "markweave-table-menu",
|
|
2818
2818
|
role: "menu",
|
|
2819
|
-
"aria-label":
|
|
2819
|
+
"aria-label": rn(t.value, e.messages),
|
|
2820
2820
|
"data-testid": "markweave-table-menu",
|
|
2821
2821
|
"data-positioned": o.value ? "true" : "false",
|
|
2822
2822
|
style: o.value ? {
|
|
@@ -2824,7 +2824,7 @@ var zr = J({
|
|
|
2824
2824
|
top: `${o.value.top}px`
|
|
2825
2825
|
} : void 0
|
|
2826
2826
|
}, y.value.map((n, r) => {
|
|
2827
|
-
let i =
|
|
2827
|
+
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);
|
|
2828
2828
|
return B("button", {
|
|
2829
2829
|
key: `${n.id}-${r}`,
|
|
2830
2830
|
type: "button",
|
|
@@ -2864,7 +2864,7 @@ var zr = J({
|
|
|
2864
2864
|
"data-copy-kind": s.value.kind,
|
|
2865
2865
|
"data-text-length": s.value.textLength,
|
|
2866
2866
|
"data-html-length": s.value.htmlLength
|
|
2867
|
-
},
|
|
2867
|
+
}, Wt(s.value)) : null,
|
|
2868
2868
|
r.value ? B("button", {
|
|
2869
2869
|
ref: l,
|
|
2870
2870
|
type: "button",
|
|
@@ -2924,7 +2924,7 @@ var zr = J({
|
|
|
2924
2924
|
P()
|
|
2925
2925
|
]) : null;
|
|
2926
2926
|
}
|
|
2927
|
-
}),
|
|
2927
|
+
}), Wr = J({
|
|
2928
2928
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
2929
2929
|
props: {
|
|
2930
2930
|
editor: {
|
|
@@ -2942,7 +2942,7 @@ var zr = J({
|
|
|
2942
2942
|
t.value = null;
|
|
2943
2943
|
return;
|
|
2944
2944
|
}
|
|
2945
|
-
t.value =
|
|
2945
|
+
t.value = en(e.editor, Lt(e.editor.state));
|
|
2946
2946
|
};
|
|
2947
2947
|
return G(() => {
|
|
2948
2948
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
@@ -2980,7 +2980,7 @@ var zr = J({
|
|
|
2980
2980
|
}) : null;
|
|
2981
2981
|
};
|
|
2982
2982
|
}
|
|
2983
|
-
}),
|
|
2983
|
+
}), Gr = J({
|
|
2984
2984
|
name: "MarkweaveVueCodeBlockControls",
|
|
2985
2985
|
props: {
|
|
2986
2986
|
editor: {
|
|
@@ -3013,17 +3013,17 @@ var zr = J({
|
|
|
3013
3013
|
active: !1,
|
|
3014
3014
|
lastX: 0,
|
|
3015
3015
|
lastY: 0
|
|
3016
|
-
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value,
|
|
3016
|
+
}), 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 ? {
|
|
3017
3017
|
...e.state,
|
|
3018
3018
|
pos: e.state.pos,
|
|
3019
3019
|
active: !0
|
|
3020
|
-
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() =>
|
|
3020
|
+
} : 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 = () => {
|
|
3021
3021
|
y !== null && (window.clearTimeout(y), y = null);
|
|
3022
|
-
},
|
|
3023
|
-
|
|
3022
|
+
}, I = (e) => {
|
|
3023
|
+
F(), u.value = e, e && (y = window.setTimeout(() => {
|
|
3024
3024
|
u.value = null, y = null;
|
|
3025
|
-
},
|
|
3026
|
-
},
|
|
3025
|
+
}, Be));
|
|
3026
|
+
}, te = () => {
|
|
3027
3027
|
f.value = null, p.value = null, m.value = !1, h.value = {
|
|
3028
3028
|
active: !1,
|
|
3029
3029
|
lastX: 0,
|
|
@@ -3032,15 +3032,15 @@ var zr = J({
|
|
|
3032
3032
|
}, L = () => {
|
|
3033
3033
|
let n = t.value;
|
|
3034
3034
|
if (!n) return;
|
|
3035
|
-
if (
|
|
3035
|
+
if (!$e(n) || j.value.length === 0) {
|
|
3036
3036
|
o.value = [];
|
|
3037
3037
|
return;
|
|
3038
3038
|
}
|
|
3039
3039
|
let r = n.getBoundingClientRect(), i = j.value.flatMap((t) => {
|
|
3040
|
-
let n = Je(
|
|
3041
|
-
return n ? [
|
|
3040
|
+
let n = Ye(Je(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
3041
|
+
return n ? [We(t, n, r)] : [];
|
|
3042
3042
|
});
|
|
3043
|
-
o.value =
|
|
3043
|
+
o.value = rt(o.value, i, j.value.map((e) => e.pos));
|
|
3044
3044
|
}, R = () => {
|
|
3045
3045
|
if (!E.value || !S.value) {
|
|
3046
3046
|
a.value = null, s.value = null;
|
|
@@ -3048,14 +3048,14 @@ var zr = J({
|
|
|
3048
3048
|
}
|
|
3049
3049
|
let r = t.value;
|
|
3050
3050
|
if (!r) return;
|
|
3051
|
-
let i =
|
|
3051
|
+
let i = Je(e.editor, S.value.pos, k.value), o = r.getBoundingClientRect(), l = Ye(i, o);
|
|
3052
3052
|
if (!l) {
|
|
3053
3053
|
a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
|
|
3054
3054
|
return;
|
|
3055
3055
|
}
|
|
3056
|
-
if (a.value =
|
|
3056
|
+
if (a.value = He(S.value.pos, l, o), c.value && n.value) {
|
|
3057
3057
|
let e = n.value.getBoundingClientRect();
|
|
3058
|
-
s.value =
|
|
3058
|
+
s.value = Re({
|
|
3059
3059
|
overlayRect: o,
|
|
3060
3060
|
buttonRect: e,
|
|
3061
3061
|
windowWidth: window.innerWidth,
|
|
@@ -3065,36 +3065,36 @@ var zr = J({
|
|
|
3065
3065
|
}, ne = async () => {
|
|
3066
3066
|
if (e.readOnly) {
|
|
3067
3067
|
if (!S.value) return;
|
|
3068
|
-
let e = await
|
|
3069
|
-
|
|
3068
|
+
let e = await Ve(S.value.text);
|
|
3069
|
+
I(Ne(S.value, e ? "copied" : "failed"));
|
|
3070
3070
|
return;
|
|
3071
3071
|
}
|
|
3072
|
-
if (!
|
|
3073
|
-
let t = await
|
|
3074
|
-
|
|
3072
|
+
if (!Ge(e.editor, S.value)) return;
|
|
3073
|
+
let t = await je(e.editor);
|
|
3074
|
+
I(Ne(Me(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
3075
3075
|
}, re = (t, n) => {
|
|
3076
3076
|
if (e.readOnly) {
|
|
3077
|
-
|
|
3077
|
+
St(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
|
|
3078
3078
|
return;
|
|
3079
3079
|
}
|
|
3080
3080
|
let r = e.state.active && e.state.pos === t.pos;
|
|
3081
|
-
|
|
3081
|
+
Le(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
|
|
3082
3082
|
}, ie = (t) => {
|
|
3083
3083
|
if (e.readOnly || !S.value) return;
|
|
3084
3084
|
let n = e.state.active && e.state.pos === S.value.pos;
|
|
3085
|
-
|
|
3085
|
+
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());
|
|
3086
3086
|
}, ae = () => {
|
|
3087
|
-
e.readOnly || !S.value ||
|
|
3087
|
+
e.readOnly || !S.value || Fe(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
3088
3088
|
}, oe = () => {
|
|
3089
3089
|
if (!S.value) return;
|
|
3090
|
-
let t =
|
|
3090
|
+
let t = tt(e.editor, S.value.pos);
|
|
3091
3091
|
if (!t) return;
|
|
3092
3092
|
let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
3093
3093
|
i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
|
|
3094
3094
|
}, se = () => {
|
|
3095
3095
|
if (!S.value) return;
|
|
3096
|
-
let t =
|
|
3097
|
-
t && (f.value =
|
|
3096
|
+
let t = tt(e.editor, S.value.pos);
|
|
3097
|
+
t && (f.value = Ue(t), p.value = null, m.value = !1, h.value = {
|
|
3098
3098
|
active: !1,
|
|
3099
3099
|
lastX: 0,
|
|
3100
3100
|
lastY: 0
|
|
@@ -3102,16 +3102,16 @@ var zr = J({
|
|
|
3102
3102
|
}, ce = (e) => {
|
|
3103
3103
|
f.value = f.value ? {
|
|
3104
3104
|
...f.value,
|
|
3105
|
-
scale:
|
|
3105
|
+
scale: ze(f.value.scale + e)
|
|
3106
3106
|
} : null;
|
|
3107
3107
|
}, le = () => {
|
|
3108
|
-
f.value = f.value ?
|
|
3108
|
+
f.value = f.value ? Ue(f.value.svg) : null, h.value = {
|
|
3109
3109
|
active: !1,
|
|
3110
3110
|
lastX: 0,
|
|
3111
3111
|
lastY: 0
|
|
3112
3112
|
}, m.value = !1;
|
|
3113
3113
|
}, z = (e) => {
|
|
3114
|
-
e.preventDefault(), ce(e.deltaY < 0 ?
|
|
3114
|
+
e.preventDefault(), ce(e.deltaY < 0 ? it : -it);
|
|
3115
3115
|
}, ue = (e) => {
|
|
3116
3116
|
e.button === 0 && (e.preventDefault(), h.value = {
|
|
3117
3117
|
active: !0,
|
|
@@ -3126,7 +3126,7 @@ var zr = J({
|
|
|
3126
3126
|
active: !0,
|
|
3127
3127
|
lastX: e.clientX,
|
|
3128
3128
|
lastY: e.clientY
|
|
3129
|
-
}, f.value =
|
|
3129
|
+
}, f.value = at(f.value, n, r);
|
|
3130
3130
|
}, fe = () => {
|
|
3131
3131
|
h.value = {
|
|
3132
3132
|
active: !1,
|
|
@@ -3137,7 +3137,7 @@ var zr = J({
|
|
|
3137
3137
|
W(() => e.readOnly, (e) => {
|
|
3138
3138
|
e && (c.value = !1, l.value = "");
|
|
3139
3139
|
}), W(P, () => {
|
|
3140
|
-
|
|
3140
|
+
I(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
|
|
3141
3141
|
}), W(c, async (e) => {
|
|
3142
3142
|
e && (await q(), R(), r.value?.focus({ preventScroll: !0 }));
|
|
3143
3143
|
}), W(() => [
|
|
@@ -3162,14 +3162,14 @@ var zr = J({
|
|
|
3162
3162
|
q(() => {
|
|
3163
3163
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
3164
3164
|
if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
|
|
3165
|
-
let r =
|
|
3165
|
+
let r = Ze(e.editor, n.target), a = Qe(e.editor, r), o = a && !nt(e.editor, a) ? a.pos : null;
|
|
3166
3166
|
i.value = i.value === o ? i.value : o;
|
|
3167
3167
|
}, a = () => {
|
|
3168
3168
|
c.value || (i.value = null);
|
|
3169
3169
|
}, o = (t) => {
|
|
3170
3170
|
if (t.key === "Escape") {
|
|
3171
3171
|
if (f.value) {
|
|
3172
|
-
|
|
3172
|
+
te();
|
|
3173
3173
|
return;
|
|
3174
3174
|
}
|
|
3175
3175
|
c.value && (c.value = !1, e.editor.view.focus());
|
|
@@ -3177,14 +3177,14 @@ var zr = J({
|
|
|
3177
3177
|
}, s = (e) => {
|
|
3178
3178
|
c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
|
|
3179
3179
|
}, l = ({ transaction: e }) => {
|
|
3180
|
-
e.getMeta(
|
|
3180
|
+
e.getMeta(Ae) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Ae) || yt(e)) && (v.value += 1);
|
|
3181
3181
|
};
|
|
3182
3182
|
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 = () => {
|
|
3183
|
-
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),
|
|
3183
|
+
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();
|
|
3184
3184
|
};
|
|
3185
3185
|
});
|
|
3186
3186
|
}), K(() => {
|
|
3187
|
-
pe?.(), pe = null,
|
|
3187
|
+
pe?.(), pe = null, F();
|
|
3188
3188
|
}), () => {
|
|
3189
3189
|
if (!E.value && j.value.length === 0 && !f.value) return null;
|
|
3190
3190
|
let i = a.value ? {
|
|
@@ -3364,12 +3364,12 @@ var zr = J({
|
|
|
3364
3364
|
onBlur: () => {
|
|
3365
3365
|
p.value = null;
|
|
3366
3366
|
},
|
|
3367
|
-
onClick: () => ce(-
|
|
3367
|
+
onClick: () => ce(-it)
|
|
3368
3368
|
}, [Q("zoomOut")]),
|
|
3369
3369
|
B("span", {
|
|
3370
3370
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3371
3371
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3372
|
-
},
|
|
3372
|
+
}, qe(f.value.scale)),
|
|
3373
3373
|
B("button", {
|
|
3374
3374
|
type: "button",
|
|
3375
3375
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -3387,7 +3387,7 @@ var zr = J({
|
|
|
3387
3387
|
onBlur: () => {
|
|
3388
3388
|
p.value = null;
|
|
3389
3389
|
},
|
|
3390
|
-
onClick: () => ce(
|
|
3390
|
+
onClick: () => ce(it)
|
|
3391
3391
|
}, [Q("zoomIn")]),
|
|
3392
3392
|
B("button", {
|
|
3393
3393
|
type: "button",
|
|
@@ -3419,7 +3419,7 @@ var zr = J({
|
|
|
3419
3419
|
class: "markweave-mermaid-fullscreen-close",
|
|
3420
3420
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
3421
3421
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3422
|
-
onClick:
|
|
3422
|
+
onClick: te
|
|
3423
3423
|
}, [Q("close")]),
|
|
3424
3424
|
B("div", {
|
|
3425
3425
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
@@ -3446,7 +3446,7 @@ var zr = J({
|
|
|
3446
3446
|
]);
|
|
3447
3447
|
};
|
|
3448
3448
|
}
|
|
3449
|
-
}),
|
|
3449
|
+
}), Kr = J({
|
|
3450
3450
|
name: "MarkweaveVueInnerToc",
|
|
3451
3451
|
props: {
|
|
3452
3452
|
editor: {
|
|
@@ -3472,7 +3472,7 @@ var zr = J({
|
|
|
3472
3472
|
},
|
|
3473
3473
|
setup(e) {
|
|
3474
3474
|
let t = V(null), n, r = () => {
|
|
3475
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
3475
|
+
n?.(), n = e.placement === "container" && t.value ? Oe(t.value) : void 0;
|
|
3476
3476
|
};
|
|
3477
3477
|
return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
|
|
3478
3478
|
ref: t,
|
|
@@ -3495,15 +3495,15 @@ var zr = J({
|
|
|
3495
3495
|
"aria-current": t.active ? "location" : void 0,
|
|
3496
3496
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
3497
3497
|
title: t.text,
|
|
3498
|
-
onClick: () =>
|
|
3498
|
+
onClick: () => ke(e.editor, t, {
|
|
3499
3499
|
behavior: "smooth",
|
|
3500
3500
|
focus: e.editable
|
|
3501
3501
|
})
|
|
3502
3502
|
}, t.text)))])]) : null;
|
|
3503
3503
|
}
|
|
3504
3504
|
});
|
|
3505
|
-
function
|
|
3506
|
-
let i = r(e.lang), o = n(i), s = t(i), c = V(f(e.mode)), l = U(() =>
|
|
3505
|
+
function qr(e = {}) {
|
|
3506
|
+
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;
|
|
3507
3507
|
function E() {
|
|
3508
3508
|
T !== null && (window.clearTimeout(T), T = null), d.value += 1;
|
|
3509
3509
|
}
|
|
@@ -3514,11 +3514,11 @@ function Kr(e = {}) {
|
|
|
3514
3514
|
}
|
|
3515
3515
|
let D = e.onSlashCommandUpload, O = H(null);
|
|
3516
3516
|
O.value = new a({
|
|
3517
|
-
extensions:
|
|
3517
|
+
extensions: Or({
|
|
3518
3518
|
lang: i,
|
|
3519
3519
|
linkCardResolver: e.linkCardResolver,
|
|
3520
|
-
onImageUpload: (e) => D?.(e) ??
|
|
3521
|
-
onVideoUpload: (e) => D?.(e) ??
|
|
3520
|
+
onImageUpload: (e) => D?.(e) ?? F(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3521
|
+
onVideoUpload: (e) => D?.(e) ?? F(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
|
|
3522
3522
|
}),
|
|
3523
3523
|
content: e.content ?? e.defaultContent ?? "",
|
|
3524
3524
|
contentType: re(w),
|
|
@@ -3535,16 +3535,16 @@ function Kr(e = {}) {
|
|
|
3535
3535
|
},
|
|
3536
3536
|
handleClick: (e, t, n) => {
|
|
3537
3537
|
if (!u.value) return pe(n);
|
|
3538
|
-
let r =
|
|
3539
|
-
return r ? (n.preventDefault(), n.stopPropagation(), A(),
|
|
3538
|
+
let r = pt(e, n);
|
|
3539
|
+
return r ? (n.preventDefault(), n.stopPropagation(), A(), _t(e, r, !0), vt(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
3540
3540
|
},
|
|
3541
3541
|
handleDOMEvents: {
|
|
3542
|
-
compositionstart: () => u.value ? (h.value =
|
|
3542
|
+
compositionstart: () => u.value ? (h.value = Mt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
3543
3543
|
compositionend: (e) => (u.value && window.setTimeout(() => j(e), 0), !1),
|
|
3544
3544
|
click: (e, t) => {
|
|
3545
3545
|
if (!u.value) return pe(t);
|
|
3546
|
-
let n =
|
|
3547
|
-
return n ? (t.preventDefault(), t.stopPropagation(), A(),
|
|
3546
|
+
let n = pt(e, t);
|
|
3547
|
+
return n ? (t.preventDefault(), t.stopPropagation(), A(), _t(e, n, !0), vt(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
3548
3548
|
}
|
|
3549
3549
|
}
|
|
3550
3550
|
},
|
|
@@ -3553,11 +3553,11 @@ function Kr(e = {}) {
|
|
|
3553
3553
|
p(t, {
|
|
3554
3554
|
mode: c.value,
|
|
3555
3555
|
editable: u.value
|
|
3556
|
-
}),
|
|
3556
|
+
}), bt(t, l.value), xt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Ft(t), P(t), N(t), E();
|
|
3557
3557
|
},
|
|
3558
3558
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3559
|
-
if (P(e), (t.docChanged ||
|
|
3560
|
-
let t =
|
|
3559
|
+
if (P(e), (t.docChanged || yt(t)) && ee(), t.docChanged && y.value) {
|
|
3560
|
+
let t = ft(e, y.value.pos);
|
|
3561
3561
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
3562
3562
|
}
|
|
3563
3563
|
},
|
|
@@ -3574,19 +3574,19 @@ function Kr(e = {}) {
|
|
|
3574
3574
|
});
|
|
3575
3575
|
let k = U(() => O.value ?? null);
|
|
3576
3576
|
function A() {
|
|
3577
|
-
g.value = null, _.value = null, h.value =
|
|
3577
|
+
g.value = null, _.value = null, h.value = jt;
|
|
3578
3578
|
}
|
|
3579
3579
|
function j(e) {
|
|
3580
|
-
let t =
|
|
3580
|
+
let t = At(e.state);
|
|
3581
3581
|
if (!t) {
|
|
3582
|
-
h.value = h.value.name === "idle" ? h.value :
|
|
3582
|
+
h.value = h.value.name === "idle" ? h.value : jt, g.value = null, _.value = null;
|
|
3583
3583
|
return;
|
|
3584
3584
|
}
|
|
3585
3585
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3586
|
-
g.value =
|
|
3586
|
+
g.value = kt(n, {
|
|
3587
3587
|
frameRect: i,
|
|
3588
3588
|
triggerRect: r
|
|
3589
|
-
}), h.value =
|
|
3589
|
+
}), h.value = Ot(h.value, t);
|
|
3590
3590
|
}
|
|
3591
3591
|
function M(e) {
|
|
3592
3592
|
j(e.view);
|
|
@@ -3594,81 +3594,81 @@ function Kr(e = {}) {
|
|
|
3594
3594
|
function N(e) {
|
|
3595
3595
|
let t = _e(e);
|
|
3596
3596
|
he(m.value, t) || (m.value = t);
|
|
3597
|
-
let n =
|
|
3598
|
-
n && (
|
|
3599
|
-
let r =
|
|
3597
|
+
let n = mt(e);
|
|
3598
|
+
n && (gt(e, n, !0), y.value = n);
|
|
3599
|
+
let r = Me(e);
|
|
3600
3600
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
3601
3601
|
}
|
|
3602
3602
|
function P(e) {
|
|
3603
|
-
b.value =
|
|
3603
|
+
b.value = jr(e);
|
|
3604
3604
|
}
|
|
3605
|
-
let
|
|
3605
|
+
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({
|
|
3606
3606
|
active: se.value,
|
|
3607
3607
|
mode: v.value,
|
|
3608
|
-
source:
|
|
3609
|
-
}) :
|
|
3608
|
+
source: I.value.text
|
|
3609
|
+
}) : Ct({
|
|
3610
3610
|
active: !1,
|
|
3611
3611
|
mode: "code",
|
|
3612
3612
|
source: ""
|
|
3613
|
-
})), le = U(() => k.value ?
|
|
3613
|
+
})), 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({
|
|
3614
3614
|
revision: d.value,
|
|
3615
3615
|
mode: c.value,
|
|
3616
3616
|
editable: u.value,
|
|
3617
3617
|
toc: de.value,
|
|
3618
3618
|
selection: m.value,
|
|
3619
3619
|
slash: h.value,
|
|
3620
|
-
table:
|
|
3620
|
+
table: te.value,
|
|
3621
3621
|
tableInteraction: b.value,
|
|
3622
|
-
codeBlock:
|
|
3622
|
+
codeBlock: I.value,
|
|
3623
3623
|
mermaid: ce.value,
|
|
3624
3624
|
tableDebugSnapshot: le.value
|
|
3625
3625
|
})), ye = {
|
|
3626
3626
|
closeSlashMenu: A,
|
|
3627
|
-
focusFirstTableBodyCell: () => k.value ?
|
|
3627
|
+
focusFirstTableBodyCell: () => k.value ? Ft(k.value) : !1,
|
|
3628
3628
|
setContent: (e, t = {}) => {
|
|
3629
3629
|
if (!k.value) return !1;
|
|
3630
3630
|
let n = oe(t.format);
|
|
3631
3631
|
return k.value.commands.setContent(e, {
|
|
3632
3632
|
contentType: re(n),
|
|
3633
3633
|
emitUpdate: t.emitUpdate ?? !1
|
|
3634
|
-
}), t.focusFirstTableBodyCell &&
|
|
3634
|
+
}), t.focusFirstTableBodyCell && Ft(k.value), N(k.value), u.value && M(k.value), P(k.value), E(), !0;
|
|
3635
3635
|
}
|
|
3636
3636
|
};
|
|
3637
|
-
function
|
|
3638
|
-
if (!(!k.value || !u.value || !
|
|
3637
|
+
function be(e, t) {
|
|
3638
|
+
if (!(!k.value || !u.value || !Tt(e))) {
|
|
3639
3639
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3640
3640
|
_.value = e;
|
|
3641
3641
|
return;
|
|
3642
3642
|
}
|
|
3643
|
-
|
|
3643
|
+
Dt(k.value, h.value, e, t), h.value = Mt(h.value, { type: "execute" }), A();
|
|
3644
3644
|
}
|
|
3645
3645
|
}
|
|
3646
3646
|
function De(e) {
|
|
3647
3647
|
if (!k.value || _.value || !u.value) return;
|
|
3648
|
-
let t =
|
|
3648
|
+
let t = Et(h.value, fe.value, e.key, { isComposing: e.isComposing || L(k.value.state) });
|
|
3649
3649
|
if (t.type !== "ignore") {
|
|
3650
3650
|
if (e.preventDefault(), t.type === "close") {
|
|
3651
|
-
h.value =
|
|
3651
|
+
h.value = Mt(h.value, { type: "escape" }), A();
|
|
3652
3652
|
return;
|
|
3653
3653
|
}
|
|
3654
3654
|
if (t.type === "move-active") {
|
|
3655
|
-
h.value =
|
|
3655
|
+
h.value = Mt(h.value, {
|
|
3656
3656
|
type: "move-active",
|
|
3657
3657
|
delta: t.delta,
|
|
3658
3658
|
optionCount: t.optionCount
|
|
3659
3659
|
});
|
|
3660
3660
|
return;
|
|
3661
3661
|
}
|
|
3662
|
-
|
|
3662
|
+
be(t.command);
|
|
3663
3663
|
}
|
|
3664
3664
|
}
|
|
3665
3665
|
W(() => [e.mode, e.editable], () => {
|
|
3666
3666
|
c.value = f(e.mode), k.value && (k.value.setEditable(u.value), p(k.value, {
|
|
3667
3667
|
mode: c.value,
|
|
3668
3668
|
editable: u.value
|
|
3669
|
-
}),
|
|
3669
|
+
}), xt(k.value, u.value ? "live" : "view"), E(), u.value || A());
|
|
3670
3670
|
}, { immediate: !0 }), W(() => e.theme, () => {
|
|
3671
|
-
k.value &&
|
|
3671
|
+
k.value && bt(k.value, l.value);
|
|
3672
3672
|
}, { immediate: !0 }), W(() => e.content, (t) => {
|
|
3673
3673
|
let n = oe(e.contentFormat);
|
|
3674
3674
|
if (!(!k.value || t === void 0)) {
|
|
@@ -3682,7 +3682,7 @@ function Kr(e = {}) {
|
|
|
3682
3682
|
}), S.value = !1, N(k.value), u.value && M(k.value), P(k.value), E());
|
|
3683
3683
|
}
|
|
3684
3684
|
}), W(ge, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(de, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
|
|
3685
|
-
let t =
|
|
3685
|
+
let t = Ee(e, x.value);
|
|
3686
3686
|
x.value !== t && (x.value = t);
|
|
3687
3687
|
});
|
|
3688
3688
|
let Oe = null;
|
|
@@ -3696,12 +3696,12 @@ function Kr(e = {}) {
|
|
|
3696
3696
|
}
|
|
3697
3697
|
let e = null;
|
|
3698
3698
|
try {
|
|
3699
|
-
e =
|
|
3699
|
+
e = we(k.value, z.value);
|
|
3700
3700
|
} catch {
|
|
3701
3701
|
return;
|
|
3702
3702
|
}
|
|
3703
3703
|
x.value !== e && (x.value = e);
|
|
3704
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
3704
|
+
}, t = () => window.requestAnimationFrame(e), n = Mr(k.value?.view.dom ?? null);
|
|
3705
3705
|
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
|
|
3706
3706
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3707
3707
|
};
|
|
@@ -3716,9 +3716,9 @@ function Kr(e = {}) {
|
|
|
3716
3716
|
__render: {
|
|
3717
3717
|
messages: o,
|
|
3718
3718
|
effectiveEditable: u,
|
|
3719
|
-
tableFocusState:
|
|
3719
|
+
tableFocusState: te,
|
|
3720
3720
|
tableInteractionState: b,
|
|
3721
|
-
codeBlockState:
|
|
3721
|
+
codeBlockState: I,
|
|
3722
3722
|
isCodeBlockActive: R,
|
|
3723
3723
|
mermaidMode: v,
|
|
3724
3724
|
mathTarget: y,
|
|
@@ -3730,7 +3730,7 @@ function Kr(e = {}) {
|
|
|
3730
3730
|
slashState: h,
|
|
3731
3731
|
slashMenuPosition: g,
|
|
3732
3732
|
slashInputCommand: _,
|
|
3733
|
-
runSlashCommand:
|
|
3733
|
+
runSlashCommand: be,
|
|
3734
3734
|
handleEditorKeyDown: De,
|
|
3735
3735
|
setSlashInputCommand: (e) => {
|
|
3736
3736
|
_.value = e;
|
|
@@ -3738,7 +3738,7 @@ function Kr(e = {}) {
|
|
|
3738
3738
|
}
|
|
3739
3739
|
};
|
|
3740
3740
|
}
|
|
3741
|
-
var
|
|
3741
|
+
var Jr = J({
|
|
3742
3742
|
name: "MarkweaveEditor",
|
|
3743
3743
|
props: {
|
|
3744
3744
|
defaultContent: {
|
|
@@ -3769,6 +3769,10 @@ var qr = J({
|
|
|
3769
3769
|
type: String,
|
|
3770
3770
|
default: "light"
|
|
3771
3771
|
},
|
|
3772
|
+
canvasColor: {
|
|
3773
|
+
type: String,
|
|
3774
|
+
default: void 0
|
|
3775
|
+
},
|
|
3772
3776
|
innerToc: {
|
|
3773
3777
|
type: Boolean,
|
|
3774
3778
|
default: !0
|
|
@@ -3839,28 +3843,29 @@ var qr = J({
|
|
|
3839
3843
|
}
|
|
3840
3844
|
},
|
|
3841
3845
|
setup(e) {
|
|
3842
|
-
let t =
|
|
3846
|
+
let t = qr(e);
|
|
3843
3847
|
return () => {
|
|
3844
3848
|
let n = t.editor.value;
|
|
3845
3849
|
if (!n) return null;
|
|
3846
|
-
let r = t.__render;
|
|
3850
|
+
let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a = be(e.canvasColor);
|
|
3847
3851
|
return B("section", {
|
|
3848
|
-
class:
|
|
3852
|
+
class: i,
|
|
3849
3853
|
"aria-label": e.ariaLabel ?? r.messages.common.editorAriaLabel,
|
|
3850
3854
|
"data-testid": "markweave-editor-frame",
|
|
3851
3855
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
3852
|
-
"data-markweave-theme":
|
|
3856
|
+
"data-markweave-theme": xe(e.theme),
|
|
3857
|
+
style: a ? { "--markweave-canvas": a } : void 0,
|
|
3853
3858
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
3854
|
-
"data-markweave-inner-toc-placement":
|
|
3859
|
+
"data-markweave-inner-toc-placement": De(e.innerTocPlacement),
|
|
3855
3860
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
3856
3861
|
"data-table-focus-mode": r.tableFocusState.value.mode,
|
|
3857
3862
|
onKeydownCapture: r.handleEditorKeyDown
|
|
3858
3863
|
}, [
|
|
3859
|
-
r.effectiveEditable.value ? B(
|
|
3864
|
+
r.effectiveEditable.value ? B(Br, {
|
|
3860
3865
|
editor: n,
|
|
3861
3866
|
messages: r.messages
|
|
3862
3867
|
}) : null,
|
|
3863
|
-
r.effectiveEditable.value ? B(
|
|
3868
|
+
r.effectiveEditable.value ? B(Hr, {
|
|
3864
3869
|
commands: r.filteredSlashCommands.value,
|
|
3865
3870
|
state: r.slashState.value,
|
|
3866
3871
|
position: r.slashMenuPosition.value,
|
|
@@ -3870,7 +3875,7 @@ var qr = J({
|
|
|
3870
3875
|
onInputCommandChange: r.setSlashInputCommand,
|
|
3871
3876
|
onUpload: e.onSlashCommandUpload
|
|
3872
3877
|
}) : null,
|
|
3873
|
-
r.effectiveEditable.value ? B(
|
|
3878
|
+
r.effectiveEditable.value ? B(Ur, {
|
|
3874
3879
|
editor: n,
|
|
3875
3880
|
active: r.tableFocusState.value.active,
|
|
3876
3881
|
interactionState: r.tableInteractionState.value,
|
|
@@ -3879,11 +3884,11 @@ var qr = J({
|
|
|
3879
3884
|
onCommandResult: e.onTableCommandResult,
|
|
3880
3885
|
onEditWithAi: e.onEditWithAi
|
|
3881
3886
|
}) : null,
|
|
3882
|
-
r.effectiveEditable.value ? B(
|
|
3887
|
+
r.effectiveEditable.value ? B(Wr, {
|
|
3883
3888
|
editor: n,
|
|
3884
3889
|
focusState: r.tableFocusState.value
|
|
3885
3890
|
}) : null,
|
|
3886
|
-
B(
|
|
3891
|
+
B(Gr, {
|
|
3887
3892
|
editor: n,
|
|
3888
3893
|
state: r.codeBlockState.value,
|
|
3889
3894
|
active: r.effectiveEditable.value && r.isCodeBlockActive.value,
|
|
@@ -3891,14 +3896,14 @@ var qr = J({
|
|
|
3891
3896
|
onMermaidModeChange: r.setMermaidMode,
|
|
3892
3897
|
readOnly: !r.effectiveEditable.value
|
|
3893
3898
|
}),
|
|
3894
|
-
e.innerToc && r.tocState.value.items.length ? B(
|
|
3899
|
+
e.innerToc && r.tocState.value.items.length ? B(Kr, {
|
|
3895
3900
|
editor: n,
|
|
3896
3901
|
state: r.tocState.value,
|
|
3897
3902
|
messages: r.messages,
|
|
3898
3903
|
editable: r.effectiveEditable.value,
|
|
3899
|
-
placement:
|
|
3904
|
+
placement: De(e.innerTocPlacement)
|
|
3900
3905
|
}) : null,
|
|
3901
|
-
r.effectiveEditable.value && r.mathTarget.value ? B(
|
|
3906
|
+
r.effectiveEditable.value && r.mathTarget.value ? B(Vr, {
|
|
3902
3907
|
editor: n,
|
|
3903
3908
|
messages: r.messages,
|
|
3904
3909
|
target: r.mathTarget.value,
|
|
@@ -3910,4 +3915,4 @@ var qr = J({
|
|
|
3910
3915
|
}
|
|
3911
3916
|
});
|
|
3912
3917
|
//#endregion
|
|
3913
|
-
export {
|
|
3918
|
+
export { Jr as MarkweaveEditor, Or as createMarkweaveEditorExtensions, Or as createMarkweaveVue2EditorExtensions, qr as useMarkweaveEditorController };
|