@markweave/vue2 0.1.0 → 0.1.1
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 +27 -23
- package/dist/index.js +560 -546
- package/dist/types/MarkweaveEditor.d.ts +2 -1
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9,44 +9,44 @@ import { detectUploadSource as k, getDirectUploadResult as A, resolveMarkweaveUp
|
|
|
9
9
|
import { BubbleMenu as M } from "@tiptap/vue-2/menus";
|
|
10
10
|
import { isEditorComposing as N } from "markweave/internal/editor-core/composition-guard";
|
|
11
11
|
import { createMarkweaveEditorUpdatePayload as ee, getMarkweaveContentType as P, isEditorContentCurrent as te, normalizeMarkweaveContentFormat as F } from "markweave/internal/editor-core/editor-content";
|
|
12
|
-
import { getCurrentFloatingToolbarBlockType as
|
|
13
|
-
import { openMarkweaveReadonlyLinkFromEvent as
|
|
14
|
-
import { createMarkweaveEditorRuntimeSnapshot as
|
|
15
|
-
import { createSelectionSnapshot as
|
|
16
|
-
import { createMarkweaveTocState as
|
|
17
|
-
import { codeBlockCollapsePluginKey as
|
|
18
|
-
import { calculateCodeBlockLanguageMenuPosition as
|
|
19
|
-
import { normalizeMarkdownLinkHref as
|
|
20
|
-
import { applyMarkweaveMathLatex as
|
|
21
|
-
import { isMermaidInlinePreviewTransaction as
|
|
22
|
-
import { getMermaidPreviewState as
|
|
23
|
-
import { filterSlashCommands as
|
|
24
|
-
import { getSlashCommandKeyboardAction as
|
|
25
|
-
import { executeSlashCommand as
|
|
26
|
-
import { initialSlashCommandState as
|
|
27
|
-
import { setMarkweaveTableMenuAxisTarget as
|
|
28
|
-
import { getFirstTableDebugSnapshot as
|
|
29
|
-
import { focusFirstTableBodyCell as
|
|
30
|
-
import { getTableFocusState as
|
|
31
|
-
import { getTableSelectionOverlayState as
|
|
32
|
-
import { calculateAnchoredTableMenuPosition as
|
|
12
|
+
import { getCurrentFloatingToolbarBlockType as ne, getFloatingToolbarHighlightColorOptions as I, getFloatingToolbarMoreActions as L, getFloatingToolbarTextColorOptions as re, getFloatingToolbarTurnIntoOptions as ie, runFloatingToolbarMoreAction as R, setFloatingToolbarTurnInto as ae } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
13
|
+
import { openMarkweaveReadonlyLinkFromEvent as oe } from "markweave/internal/editor-core/readonly-link";
|
|
14
|
+
import { createMarkweaveEditorRuntimeSnapshot as se } from "markweave/internal/editor-core/runtime-snapshot";
|
|
15
|
+
import { createSelectionSnapshot as z, shouldShowFloatingToolbar as ce } from "markweave/internal/editor-core/selection-state";
|
|
16
|
+
import { createMarkweaveTocState as le, emptyMarkweaveTocState as ue, getActiveMarkweaveTocId as de, getMarkweaveTocItems as fe, getValidMarkweaveTocActiveId as pe, normalizeMarkweaveInnerTocPlacement as me, observeMarkweaveInnerTocContainerPosition as he, scrollToMarkweaveTocItem as ge } from "markweave/internal/core/toc-state";
|
|
17
|
+
import { codeBlockCollapsePluginKey as _e, copyActiveCodeBlock as ve, getActiveCodeBlockState as ye, getCodeBlockCopyFeedbackSnapshot as be, markweaveCodeBlockBehavior as xe, setCodeBlockCollapsedAtPosition as Se, setCodeBlockLanguageAtPosition as Ce, setCodeBlockMermaidPreviewModeAtPosition as we } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
18
|
+
import { calculateCodeBlockLanguageMenuPosition as Te, clampFullscreenScale as Ee, codeBlockCopyFeedbackTimeoutMs as De, copyCodeBlockText as Oe, createCodeBlockOverlayPosition as ke, createMermaidFullscreenViewerState as Ae, createMermaidTabPosition as je, focusCodeBlockTarget as Me, formatCodeBlockLanguageLabel as Ne, formatFullscreenZoom as Pe, getActiveCodeBlockElement as Fe, getAnchoredRect as Ie, getCodeBlockLanguageItems as Le, getCodeBlockPositionFromEventTarget as Re, getCodeBlockStateAtPosition as ze, getFrameElement as Be, getMermaidCodeBlockTargets as Ve, getMermaidSvgMarkup as He, isCodeBlockTargetCollapsed as Ue, mergeStableMermaidTabPositions as We, mermaidFullscreenZoomStep as Ge, moveMermaidFullscreenViewer as Ke } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
19
|
+
import { normalizeMarkdownLinkHref as qe } from "markweave/internal/plugins/markdown/markdown-input";
|
|
20
|
+
import { applyMarkweaveMathLatex as Je, calculateMarkweaveMathPopoverPosition as Ye, getMarkweaveMathAnchorRect as Xe, getMarkweaveMathBlockIndex as Ze, getMarkweaveMathRenderedHtml as Qe, getMarkweaveMathTargetAtPos as $e, getMarkweaveMathTargetFromDomEvent as et, getMarkweaveMathTargetFromSelection as tt, renderMarkweaveMathPreview as nt, setMarkweaveMathEditingDomState as rt, setMarkweaveMathEditingDomStateInView as it, setMarkweaveMathSelectionInView as at } from "markweave/internal/plugins/math/math-ui-model";
|
|
21
|
+
import { isMermaidInlinePreviewTransaction as ot, setMermaidInlinePreviewEditorMode as st, setReadonlyMermaidPreviewMode as ct } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
22
|
+
import { getMermaidPreviewState as lt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
23
|
+
import { filterSlashCommands as ut, isExecutableSlashCommand as dt } from "markweave/internal/plugins/slash-command/command-spec";
|
|
24
|
+
import { getSlashCommandKeyboardAction as ft } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
25
|
+
import { executeSlashCommand as pt, getNextSlashCommandState as mt, getSlashCommandAnchoredMenuPosition as ht, getSlashCommandContext as gt } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
26
|
+
import { initialSlashCommandState as _t, reduceSlashCommandState as vt } from "markweave/internal/plugins/slash-command/slash-state";
|
|
27
|
+
import { setMarkweaveTableMenuAxisTarget as yt } from "markweave/internal/plugins/table/table-clipboard";
|
|
28
|
+
import { getFirstTableDebugSnapshot as bt } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
29
|
+
import { focusFirstTableBodyCell as xt } from "markweave/internal/plugins/table/table-focus-position";
|
|
30
|
+
import { getTableFocusState as St } from "markweave/internal/plugins/table/table-focus-state";
|
|
31
|
+
import { getTableSelectionOverlayState as Ct, initialTableInteractionState as wt, tableInteractionPluginKey as Tt } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
32
|
+
import { calculateAnchoredTableMenuPosition as Et, calculateTableEdgeHandlePosition as Dt, canRunTableCommand as Ot, executeTableMenuCommand as kt, formatTableCopyFeedback as At, getActiveTableElement as jt, getAvailableCellMenuCommandSpecs as Mt, getTableAxisTargetRect as Nt, getTableControlAxisSelectionModel as Pt, getTableEditWithAiRequest as Ft, getTableMenuItemGroup as It, getTableMenuItemLabel as Lt, getTableMenuItems as Rt, getTableSelectionTargetRect as zt, measureTableSelectionOverlay as Bt, selectTableAxisFromCell as Vt, tableCopyFeedbackTimeoutMs as Ht, tableMenuLabel as Ut } from "markweave/internal/plugins/table/table-ui-model";
|
|
33
33
|
//#region src/vue2-compat.ts
|
|
34
|
-
var
|
|
35
|
-
function
|
|
34
|
+
var Wt = o.default ?? o, Gt = null, Kt = null, qt = null;
|
|
35
|
+
function Jt(e) {
|
|
36
36
|
return !!(e && typeof e == "object" && "value" in e);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Yt(e) {
|
|
39
39
|
let t = e.slice(2);
|
|
40
40
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function Xt(e) {
|
|
43
43
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
44
44
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
45
45
|
if (o === "class" || o === "style" || o === "key") {
|
|
46
46
|
t[o] = s;
|
|
47
47
|
continue;
|
|
48
48
|
}
|
|
49
|
-
if (o === "ref" &&
|
|
49
|
+
if (o === "ref" && Jt(s)) {
|
|
50
50
|
a.insert = (e) => {
|
|
51
51
|
s.value = e.elm;
|
|
52
52
|
}, a.destroy = () => {
|
|
@@ -55,7 +55,7 @@ function qt(e) {
|
|
|
55
55
|
continue;
|
|
56
56
|
}
|
|
57
57
|
if (/^on[A-Z]/.test(o)) {
|
|
58
|
-
i[
|
|
58
|
+
i[Yt(o)] = s;
|
|
59
59
|
continue;
|
|
60
60
|
}
|
|
61
61
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -66,14 +66,14 @@ function qt(e) {
|
|
|
66
66
|
}
|
|
67
67
|
return Object.keys(n).length && (t.attrs = n), Object.keys(r).length && (t.domProps = r), Object.keys(i).length && (t.on = i), Object.keys(a).length && (t.hook = a), t;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function Zt(e) {
|
|
70
70
|
let t = {}, n = {}, r = {}, i = {};
|
|
71
71
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
72
72
|
if (a === "class" || a === "style" || a === "key") {
|
|
73
73
|
t[a] = o;
|
|
74
74
|
continue;
|
|
75
75
|
}
|
|
76
|
-
if (a === "ref" &&
|
|
76
|
+
if (a === "ref" && Jt(o)) {
|
|
77
77
|
i.insert = (e) => {
|
|
78
78
|
o.value = e.componentInstance ?? e.elm;
|
|
79
79
|
}, i.destroy = () => {
|
|
@@ -89,47 +89,47 @@ function Jt(e) {
|
|
|
89
89
|
}
|
|
90
90
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function Qt(e) {
|
|
93
93
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function $t(e) {
|
|
96
96
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function en(e) {
|
|
99
99
|
return e == null || Array.isArray(e) ? e : [e];
|
|
100
100
|
}
|
|
101
|
-
function
|
|
102
|
-
return typeof e == "function" ?
|
|
101
|
+
function tn(e) {
|
|
102
|
+
return typeof e == "function" ? en(e()) : Qt(e) ? en(e.default()) : $t(e) ? [e] : e;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
if (!
|
|
106
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
107
|
-
return
|
|
104
|
+
function B(e, t, n) {
|
|
105
|
+
if (!qt) throw Error("Vue 2 render context is not available.");
|
|
106
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Xt(r) : Zt(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : tn(n);
|
|
107
|
+
return qt(e, i, a);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
return
|
|
109
|
+
function V(e) {
|
|
110
|
+
return Wt.observable({ value: e });
|
|
111
111
|
}
|
|
112
|
-
var
|
|
113
|
-
function
|
|
112
|
+
var H = V;
|
|
113
|
+
function U(e) {
|
|
114
114
|
return { get value() {
|
|
115
115
|
return e();
|
|
116
116
|
} };
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function W(e, t, n) {
|
|
119
119
|
let r = typeof e == "function" ? e : () => e.value;
|
|
120
|
-
return
|
|
120
|
+
return Gt?.$watch ? Gt.$watch(r, t, n) : () => void 0;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
122
|
+
function G(e) {
|
|
123
|
+
Kt?.mounted.push(e);
|
|
124
124
|
}
|
|
125
125
|
function K(e) {
|
|
126
|
-
|
|
126
|
+
Kt?.beforeUnmount.push(e);
|
|
127
127
|
}
|
|
128
128
|
function q(e) {
|
|
129
|
-
return
|
|
129
|
+
return Wt.nextTick(e);
|
|
130
130
|
}
|
|
131
131
|
function J(e) {
|
|
132
|
-
return
|
|
132
|
+
return Wt.extend({
|
|
133
133
|
name: e.name,
|
|
134
134
|
props: e.props,
|
|
135
135
|
created() {
|
|
@@ -137,12 +137,12 @@ function J(e) {
|
|
|
137
137
|
mounted: [],
|
|
138
138
|
beforeUnmount: []
|
|
139
139
|
};
|
|
140
|
-
|
|
140
|
+
Gt = this, Kt = t;
|
|
141
141
|
try {
|
|
142
142
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
143
143
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
144
144
|
} finally {
|
|
145
|
-
|
|
145
|
+
Gt = null, Kt = null;
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
mounted() {
|
|
@@ -152,19 +152,19 @@ function J(e) {
|
|
|
152
152
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
153
153
|
},
|
|
154
154
|
render(t) {
|
|
155
|
-
|
|
155
|
+
qt = t;
|
|
156
156
|
try {
|
|
157
157
|
let n = this.__markweaveVue2Render;
|
|
158
158
|
return n ? n() : e.render?.(t) ?? null;
|
|
159
159
|
} finally {
|
|
160
|
-
|
|
160
|
+
qt = null;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
//#endregion
|
|
166
166
|
//#region src/vue2-icons.ts
|
|
167
|
-
var
|
|
167
|
+
var nn = {
|
|
168
168
|
AlignCenter: {
|
|
169
169
|
iconName: "text-align-center",
|
|
170
170
|
node: [
|
|
@@ -1029,8 +1029,8 @@ var en = {
|
|
|
1029
1029
|
}]]
|
|
1030
1030
|
}
|
|
1031
1031
|
};
|
|
1032
|
-
function
|
|
1033
|
-
return e.map(([e, t]) =>
|
|
1032
|
+
function rn(e) {
|
|
1033
|
+
return e.map(([e, t]) => B(e, t));
|
|
1034
1034
|
}
|
|
1035
1035
|
function Y(e) {
|
|
1036
1036
|
return J({
|
|
@@ -1050,8 +1050,8 @@ function Y(e) {
|
|
|
1050
1050
|
}
|
|
1051
1051
|
},
|
|
1052
1052
|
setup(t) {
|
|
1053
|
-
let n =
|
|
1054
|
-
return () =>
|
|
1053
|
+
let n = nn[e];
|
|
1054
|
+
return () => B("svg", {
|
|
1055
1055
|
class: `lucide lucide-${n.iconName}`,
|
|
1056
1056
|
viewBox: "0 0 24 24",
|
|
1057
1057
|
width: t.size,
|
|
@@ -1063,16 +1063,16 @@ function Y(e) {
|
|
|
1063
1063
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1064
1064
|
"aria-hidden": "true",
|
|
1065
1065
|
focusable: "false"
|
|
1066
|
-
},
|
|
1066
|
+
}, rn(n.node));
|
|
1067
1067
|
}
|
|
1068
1068
|
});
|
|
1069
1069
|
}
|
|
1070
|
-
var
|
|
1070
|
+
var an = Y("AlignCenter"), on = Y("AlignJustify"), sn = Y("AlignLeft"), cn = Y("AlignRight"), ln = Y("AlertTriangle"), un = Y("Bold"), dn = Y("Braces"), fn = Y("Captions"), pn = Y("CheckCircle2"), mn = Y("ChevronDown"), hn = Y("ChevronUp"), gn = Y("CircleX"), _n = Y("Code2"), vn = Y("CornerDownLeft"), yn = Y("Download");
|
|
1071
1071
|
Y("Eye");
|
|
1072
|
-
var
|
|
1072
|
+
var bn = Y("ExternalLink"), xn = Y("Heading1"), Sn = Y("Heading2"), Cn = Y("Heading3"), wn = Y("Image"), Tn = Y("ImageUp"), En = Y("IndentDecrease"), Dn = Y("IndentIncrease"), On = Y("Info"), kn = Y("Italic"), An = Y("Lightbulb"), jn = Y("Link2"), Mn = Y("List"), Nn = Y("ListChecks"), Pn = Y("ListOrdered"), Fn = Y("Minus"), In = Y("MoreVertical"), Ln = Y("Paperclip");
|
|
1073
1073
|
Y("PencilLine");
|
|
1074
|
-
var
|
|
1075
|
-
function
|
|
1074
|
+
var Rn = Y("Quote"), zn = Y("Replace"), Bn = Y("Sigma"), Vn = Y("SmilePlus"), Hn = Y("Strikethrough"), Un = Y("Subscript"), Wn = Y("Superscript"), Gn = Y("Table2"), Kn = Y("Text"), qn = Y("Trash2"), Jn = Y("Type"), Yn = Y("Underline"), Xn = Y("Upload"), Zn = Y("Video"), Qn = T;
|
|
1075
|
+
function $n(e) {
|
|
1076
1076
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1077
1077
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1078
1078
|
return n === "view" ? {
|
|
@@ -1082,7 +1082,7 @@ function Zn(e) {
|
|
|
1082
1082
|
mode: "live",
|
|
1083
1083
|
editable: e.isEditable
|
|
1084
1084
|
} : s(e);
|
|
1085
|
-
}, r =
|
|
1085
|
+
}, r = V(n()), i = d(e, () => {
|
|
1086
1086
|
r.value = n();
|
|
1087
1087
|
}), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
|
|
1088
1088
|
r.value = n();
|
|
@@ -1094,21 +1094,21 @@ function Zn(e) {
|
|
|
1094
1094
|
i(), a?.disconnect();
|
|
1095
1095
|
}), r;
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1097
|
+
function er(e) {
|
|
1098
1098
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1100
|
+
function tr(e) {
|
|
1101
1101
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1102
1102
|
}
|
|
1103
|
-
function
|
|
1104
|
-
return
|
|
1103
|
+
function nr(e, t) {
|
|
1104
|
+
return B(e, {
|
|
1105
1105
|
size: 18,
|
|
1106
1106
|
strokeWidth: 1.8,
|
|
1107
1107
|
"aria-hidden": "true"
|
|
1108
1108
|
}, { default: () => t });
|
|
1109
1109
|
}
|
|
1110
1110
|
function X(e) {
|
|
1111
|
-
return
|
|
1111
|
+
return B("button", {
|
|
1112
1112
|
type: "button",
|
|
1113
1113
|
"aria-label": e.label,
|
|
1114
1114
|
title: e.label,
|
|
@@ -1116,14 +1116,14 @@ function X(e) {
|
|
|
1116
1116
|
"data-active": e.active ? "true" : "false",
|
|
1117
1117
|
onMousedown: (e) => e.preventDefault(),
|
|
1118
1118
|
onClick: e.onClick
|
|
1119
|
-
}, [
|
|
1119
|
+
}, [nr(e.icon, e.label), B("span", {
|
|
1120
1120
|
class: "markweave-image-tooltip",
|
|
1121
1121
|
role: "tooltip"
|
|
1122
1122
|
}, e.label)]);
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
let t =
|
|
1126
|
-
return
|
|
1124
|
+
function rr(e) {
|
|
1125
|
+
let t = V(null), n = e.messages.image;
|
|
1126
|
+
return B("section", {
|
|
1127
1127
|
class: "markweave-image-upload-placeholder",
|
|
1128
1128
|
"data-testid": "markweave-image-upload-placeholder",
|
|
1129
1129
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1141,7 +1141,7 @@ function tr(e) {
|
|
|
1141
1141
|
n && e.onFile(n);
|
|
1142
1142
|
}
|
|
1143
1143
|
}, [
|
|
1144
|
-
|
|
1144
|
+
B("input", {
|
|
1145
1145
|
ref: t,
|
|
1146
1146
|
"data-testid": "markweave-image-file-input",
|
|
1147
1147
|
type: "file",
|
|
@@ -1152,20 +1152,20 @@ function tr(e) {
|
|
|
1152
1152
|
r && e.onFile(r), n.value = "";
|
|
1153
1153
|
}
|
|
1154
1154
|
}),
|
|
1155
|
-
|
|
1155
|
+
B("div", {
|
|
1156
1156
|
class: "markweave-image-upload-icon",
|
|
1157
1157
|
"aria-hidden": "true"
|
|
1158
|
-
}, [
|
|
1158
|
+
}, [B(Tn, {
|
|
1159
1159
|
size: 46,
|
|
1160
1160
|
strokeWidth: 1.6
|
|
1161
1161
|
})]),
|
|
1162
|
-
|
|
1162
|
+
B("div", { class: "markweave-image-upload-copy" }, [B("button", {
|
|
1163
1163
|
type: "button",
|
|
1164
1164
|
onClick: () => t.value?.click()
|
|
1165
|
-
}, n.clickToUpload),
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1165
|
+
}, n.clickToUpload), B("span", null, n.dragAndDrop)]),
|
|
1166
|
+
B("div", { class: "markweave-image-upload-note" }, n.uploadNote),
|
|
1167
|
+
B("div", { class: "markweave-image-upload-row" }, [
|
|
1168
|
+
B("input", {
|
|
1169
1169
|
"data-testid": "markweave-image-url-input",
|
|
1170
1170
|
value: e.inputValue,
|
|
1171
1171
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1175,30 +1175,30 @@ function tr(e) {
|
|
|
1175
1175
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1176
1176
|
}
|
|
1177
1177
|
}),
|
|
1178
|
-
|
|
1178
|
+
B("button", {
|
|
1179
1179
|
type: "button",
|
|
1180
1180
|
"data-testid": "markweave-image-upload-submit",
|
|
1181
1181
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1182
1182
|
onClick: e.onSubmit
|
|
1183
|
-
}, [
|
|
1183
|
+
}, [B(Tn, {
|
|
1184
1184
|
size: 16,
|
|
1185
1185
|
strokeWidth: 1.8
|
|
1186
1186
|
}), e.messages.common.insert]),
|
|
1187
|
-
|
|
1187
|
+
B("button", {
|
|
1188
1188
|
type: "button",
|
|
1189
1189
|
"data-testid": "markweave-image-upload-cancel",
|
|
1190
1190
|
onClick: e.onCancel
|
|
1191
1191
|
}, e.messages.common.cancel)
|
|
1192
1192
|
]),
|
|
1193
|
-
e.error ?
|
|
1193
|
+
e.error ? B("div", {
|
|
1194
1194
|
class: "markweave-image-upload-error",
|
|
1195
1195
|
role: "alert"
|
|
1196
1196
|
}, e.error) : null
|
|
1197
1197
|
]);
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1200
|
-
let t =
|
|
1201
|
-
return
|
|
1199
|
+
function ir(e) {
|
|
1200
|
+
let t = V(null), n = e.messages.video;
|
|
1201
|
+
return B("section", {
|
|
1202
1202
|
class: "markweave-video-upload-placeholder",
|
|
1203
1203
|
"data-testid": "markweave-video-upload-placeholder",
|
|
1204
1204
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1216,7 +1216,7 @@ function nr(e) {
|
|
|
1216
1216
|
n && e.onFile(n);
|
|
1217
1217
|
}
|
|
1218
1218
|
}, [
|
|
1219
|
-
|
|
1219
|
+
B("input", {
|
|
1220
1220
|
ref: t,
|
|
1221
1221
|
"data-testid": "markweave-video-file-input",
|
|
1222
1222
|
type: "file",
|
|
@@ -1227,20 +1227,20 @@ function nr(e) {
|
|
|
1227
1227
|
r && e.onFile(r), n.value = "";
|
|
1228
1228
|
}
|
|
1229
1229
|
}),
|
|
1230
|
-
|
|
1230
|
+
B("div", {
|
|
1231
1231
|
class: "markweave-video-upload-icon",
|
|
1232
1232
|
"aria-hidden": "true"
|
|
1233
|
-
}, [
|
|
1233
|
+
}, [B(Zn, {
|
|
1234
1234
|
size: 46,
|
|
1235
1235
|
strokeWidth: 1.6
|
|
1236
1236
|
})]),
|
|
1237
|
-
|
|
1237
|
+
B("div", { class: "markweave-video-upload-copy" }, [B("button", {
|
|
1238
1238
|
type: "button",
|
|
1239
1239
|
onClick: () => t.value?.click()
|
|
1240
|
-
}, n.clickToUpload),
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1240
|
+
}, n.clickToUpload), B("span", null, n.dragAndDrop)]),
|
|
1241
|
+
B("div", { class: "markweave-video-upload-note" }, n.uploadNote),
|
|
1242
|
+
B("div", { class: "markweave-video-upload-row" }, [
|
|
1243
|
+
B("input", {
|
|
1244
1244
|
"data-testid": "markweave-video-url-input",
|
|
1245
1245
|
value: e.inputValue,
|
|
1246
1246
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1250,28 +1250,28 @@ function nr(e) {
|
|
|
1250
1250
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1251
1251
|
}
|
|
1252
1252
|
}),
|
|
1253
|
-
|
|
1253
|
+
B("button", {
|
|
1254
1254
|
type: "button",
|
|
1255
1255
|
"data-testid": "markweave-video-upload-submit",
|
|
1256
1256
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1257
1257
|
onClick: e.onSubmit
|
|
1258
|
-
}, [
|
|
1258
|
+
}, [B(Xn, {
|
|
1259
1259
|
size: 16,
|
|
1260
1260
|
strokeWidth: 1.8
|
|
1261
1261
|
}), e.messages.common.insert]),
|
|
1262
|
-
|
|
1262
|
+
B("button", {
|
|
1263
1263
|
type: "button",
|
|
1264
1264
|
"data-testid": "markweave-video-upload-cancel",
|
|
1265
1265
|
onClick: e.onCancel
|
|
1266
1266
|
}, e.messages.common.cancel)
|
|
1267
1267
|
]),
|
|
1268
|
-
e.error ?
|
|
1268
|
+
e.error ? B("div", {
|
|
1269
1269
|
class: "markweave-video-upload-error",
|
|
1270
1270
|
role: "alert"
|
|
1271
1271
|
}, e.error) : null
|
|
1272
1272
|
]);
|
|
1273
1273
|
}
|
|
1274
|
-
var
|
|
1274
|
+
var ar = J({
|
|
1275
1275
|
name: "MarkweaveVueImageNodeView",
|
|
1276
1276
|
props: {
|
|
1277
1277
|
editor: {
|
|
@@ -1304,8 +1304,8 @@ var rr = J({
|
|
|
1304
1304
|
}
|
|
1305
1305
|
},
|
|
1306
1306
|
setup(e) {
|
|
1307
|
-
let t =
|
|
1308
|
-
|
|
1307
|
+
let t = V(null), n = V(!1), r = V(!1), a = V(!1), o = V(""), s = V(null), l = V(!1), u = U(() => e.node.attrs), d = V(!!O(u.value.caption)), f = V(O(u.value.caption) ?? ""), m = $n(e.editor), h = U(() => c(m.value)), g = U(() => e.extension.options?.messages ?? p("zh")), v = U(() => g.value.image), y = U(() => O(u.value.src)), S = U(() => Qn(u.value.align)), w = U(() => D(u.value.width)), T = U(() => O(u.value.caption)), E = U(() => h.value && (!y.value || r.value));
|
|
1308
|
+
W(T, (e) => {
|
|
1309
1309
|
d.value || (f.value = e ?? "");
|
|
1310
1310
|
});
|
|
1311
1311
|
let A = () => {
|
|
@@ -1357,7 +1357,7 @@ var rr = J({
|
|
|
1357
1357
|
};
|
|
1358
1358
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1359
1359
|
};
|
|
1360
|
-
return () => E.value ?
|
|
1360
|
+
return () => E.value ? B(i, {
|
|
1361
1361
|
as: "figure",
|
|
1362
1362
|
class: "markweave-image-node",
|
|
1363
1363
|
"data-testid": "markweave-image-node",
|
|
@@ -1365,7 +1365,7 @@ var rr = J({
|
|
|
1365
1365
|
"data-selected": "false",
|
|
1366
1366
|
"data-hovered": "false",
|
|
1367
1367
|
"data-empty": "true"
|
|
1368
|
-
}, () =>
|
|
1368
|
+
}, () => rr({
|
|
1369
1369
|
messages: g.value,
|
|
1370
1370
|
inputValue: o.value,
|
|
1371
1371
|
error: s.value,
|
|
@@ -1380,7 +1380,7 @@ var rr = J({
|
|
|
1380
1380
|
onDragActive: (e) => {
|
|
1381
1381
|
a.value = e;
|
|
1382
1382
|
}
|
|
1383
|
-
})) :
|
|
1383
|
+
})) : B(i, {
|
|
1384
1384
|
as: "figure",
|
|
1385
1385
|
class: "markweave-image-node",
|
|
1386
1386
|
"data-testid": "markweave-image-node",
|
|
@@ -1395,10 +1395,10 @@ var rr = J({
|
|
|
1395
1395
|
n.value = !1;
|
|
1396
1396
|
},
|
|
1397
1397
|
onMousedown: (e) => {
|
|
1398
|
-
h.value && !
|
|
1398
|
+
h.value && !er(e.target) && A();
|
|
1399
1399
|
}
|
|
1400
1400
|
}, () => [
|
|
1401
|
-
h.value ?
|
|
1401
|
+
h.value ? B("div", {
|
|
1402
1402
|
class: "markweave-image-toolbar",
|
|
1403
1403
|
"data-testid": "markweave-image-toolbar",
|
|
1404
1404
|
"data-markweave-image-ui": "true",
|
|
@@ -1407,39 +1407,39 @@ var rr = J({
|
|
|
1407
1407
|
X({
|
|
1408
1408
|
testId: "markweave-image-align-left",
|
|
1409
1409
|
label: v.value.alignLeft,
|
|
1410
|
-
icon:
|
|
1410
|
+
icon: sn,
|
|
1411
1411
|
active: S.value === "left",
|
|
1412
1412
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1413
1413
|
}),
|
|
1414
1414
|
X({
|
|
1415
1415
|
testId: "markweave-image-align-center",
|
|
1416
1416
|
label: v.value.alignCenter,
|
|
1417
|
-
icon:
|
|
1417
|
+
icon: an,
|
|
1418
1418
|
active: S.value === "center",
|
|
1419
1419
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1420
1420
|
}),
|
|
1421
1421
|
X({
|
|
1422
1422
|
testId: "markweave-image-align-right",
|
|
1423
1423
|
label: v.value.alignRight,
|
|
1424
|
-
icon:
|
|
1424
|
+
icon: cn,
|
|
1425
1425
|
active: S.value === "right",
|
|
1426
1426
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1427
1427
|
}),
|
|
1428
|
-
|
|
1428
|
+
B("span", {
|
|
1429
1429
|
class: "markweave-image-toolbar-divider",
|
|
1430
1430
|
"aria-hidden": "true"
|
|
1431
1431
|
}),
|
|
1432
1432
|
X({
|
|
1433
1433
|
testId: "markweave-image-caption",
|
|
1434
1434
|
label: v.value.caption,
|
|
1435
|
-
icon:
|
|
1435
|
+
icon: fn,
|
|
1436
1436
|
active: d.value || !!T.value,
|
|
1437
1437
|
onClick: te
|
|
1438
1438
|
}),
|
|
1439
1439
|
X({
|
|
1440
1440
|
testId: "markweave-image-download",
|
|
1441
1441
|
label: v.value.download,
|
|
1442
|
-
icon:
|
|
1442
|
+
icon: yn,
|
|
1443
1443
|
onClick: () => {
|
|
1444
1444
|
y.value && C(y.value);
|
|
1445
1445
|
}
|
|
@@ -1447,39 +1447,39 @@ var rr = J({
|
|
|
1447
1447
|
X({
|
|
1448
1448
|
testId: "markweave-image-replace",
|
|
1449
1449
|
label: v.value.replace,
|
|
1450
|
-
icon:
|
|
1450
|
+
icon: zn,
|
|
1451
1451
|
onClick: () => {
|
|
1452
1452
|
o.value = "", s.value = null, r.value = !0;
|
|
1453
1453
|
}
|
|
1454
1454
|
}),
|
|
1455
|
-
|
|
1455
|
+
B("span", {
|
|
1456
1456
|
class: "markweave-image-toolbar-divider",
|
|
1457
1457
|
"aria-hidden": "true"
|
|
1458
1458
|
}),
|
|
1459
1459
|
X({
|
|
1460
1460
|
testId: "markweave-image-delete",
|
|
1461
1461
|
label: v.value.delete,
|
|
1462
|
-
icon:
|
|
1462
|
+
icon: qn,
|
|
1463
1463
|
onClick: () => e.deleteNode()
|
|
1464
1464
|
})
|
|
1465
1465
|
]) : null,
|
|
1466
|
-
|
|
1466
|
+
B("div", {
|
|
1467
1467
|
ref: t,
|
|
1468
1468
|
class: "markweave-image-box",
|
|
1469
1469
|
style: w.value ? { width: `${Math.round(w.value)}px` } : void 0
|
|
1470
1470
|
}, [
|
|
1471
|
-
y.value ?
|
|
1471
|
+
y.value ? B("img", {
|
|
1472
1472
|
class: "markweave-image",
|
|
1473
1473
|
src: y.value,
|
|
1474
1474
|
alt: O(u.value.alt) ?? "",
|
|
1475
1475
|
title: O(u.value.title) ?? void 0,
|
|
1476
1476
|
draggable: !1
|
|
1477
|
-
}) :
|
|
1477
|
+
}) : B("div", {
|
|
1478
1478
|
class: "markweave-image-readonly-empty",
|
|
1479
1479
|
"data-testid": "markweave-image-readonly-empty",
|
|
1480
1480
|
"aria-hidden": "true"
|
|
1481
1481
|
}),
|
|
1482
|
-
h.value ?
|
|
1482
|
+
h.value ? B("button", {
|
|
1483
1483
|
type: "button",
|
|
1484
1484
|
class: "markweave-image-resize-handle",
|
|
1485
1485
|
"data-testid": "markweave-image-resize-left",
|
|
@@ -1488,7 +1488,7 @@ var rr = J({
|
|
|
1488
1488
|
"data-markweave-image-ui": "true",
|
|
1489
1489
|
onPointerdown: (e) => F("left", e)
|
|
1490
1490
|
}) : null,
|
|
1491
|
-
h.value ?
|
|
1491
|
+
h.value ? B("button", {
|
|
1492
1492
|
type: "button",
|
|
1493
1493
|
class: "markweave-image-resize-handle",
|
|
1494
1494
|
"data-testid": "markweave-image-resize-right",
|
|
@@ -1498,7 +1498,7 @@ var rr = J({
|
|
|
1498
1498
|
onPointerdown: (e) => F("right", e)
|
|
1499
1499
|
}) : null
|
|
1500
1500
|
]),
|
|
1501
|
-
h.value && (d.value || T.value) ?
|
|
1501
|
+
h.value && (d.value || T.value) ? B("input", {
|
|
1502
1502
|
class: "markweave-image-caption-input",
|
|
1503
1503
|
"data-testid": "markweave-image-caption-input",
|
|
1504
1504
|
"data-markweave-image-ui": "true",
|
|
@@ -1511,13 +1511,13 @@ var rr = J({
|
|
|
1511
1511
|
onKeydown: (e) => {
|
|
1512
1512
|
e.key === "Escape" && (e.preventDefault(), d.value = !1);
|
|
1513
1513
|
}
|
|
1514
|
-
}) : T.value ?
|
|
1514
|
+
}) : T.value ? B("figcaption", {
|
|
1515
1515
|
class: "markweave-image-caption",
|
|
1516
1516
|
"data-testid": "markweave-image-caption"
|
|
1517
1517
|
}, T.value) : null
|
|
1518
1518
|
]);
|
|
1519
1519
|
}
|
|
1520
|
-
}),
|
|
1520
|
+
}), or = J({
|
|
1521
1521
|
name: "MarkweaveVueVideoNodeView",
|
|
1522
1522
|
props: {
|
|
1523
1523
|
editor: {
|
|
@@ -1550,7 +1550,7 @@ var rr = J({
|
|
|
1550
1550
|
}
|
|
1551
1551
|
},
|
|
1552
1552
|
setup(e) {
|
|
1553
|
-
let t =
|
|
1553
|
+
let t = V(!1), n = V(""), r = V(null), a = V(!1), o = $n(e.editor), s = U(() => c(o.value)), l = U(() => e.extension.options?.messages ?? p("zh")), u = U(() => l.value.video), d = U(() => e.node.attrs), f = U(() => O(d.value.src)), m = U(() => O(d.value.embedUrl)), h = U(() => O(d.value.provider)), g = U(() => m.value ? E(m.value, h.value) : null), _ = U(() => O(d.value.mimeType)), b = U(() => O(d.value.title)), x = () => {
|
|
1554
1554
|
f.value || e.deleteNode(), n.value = "", r.value = null, t.value = !1;
|
|
1555
1555
|
}, C = async (i) => {
|
|
1556
1556
|
if (!s.value) return;
|
|
@@ -1585,13 +1585,13 @@ var rr = J({
|
|
|
1585
1585
|
}, A = (t) => {
|
|
1586
1586
|
s.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
|
|
1587
1587
|
};
|
|
1588
|
-
return () => s.value && !f.value ?
|
|
1588
|
+
return () => s.value && !f.value ? B(i, {
|
|
1589
1589
|
as: "figure",
|
|
1590
1590
|
class: "markweave-video-node",
|
|
1591
1591
|
"data-testid": "markweave-video-node",
|
|
1592
1592
|
"data-empty": "true",
|
|
1593
1593
|
"data-selected": "false"
|
|
1594
|
-
}, () =>
|
|
1594
|
+
}, () => ir({
|
|
1595
1595
|
messages: l.value,
|
|
1596
1596
|
inputValue: n.value,
|
|
1597
1597
|
error: r.value,
|
|
@@ -1606,7 +1606,7 @@ var rr = J({
|
|
|
1606
1606
|
onDragActive: (e) => {
|
|
1607
1607
|
t.value = e;
|
|
1608
1608
|
}
|
|
1609
|
-
})) :
|
|
1609
|
+
})) : B(i, {
|
|
1610
1610
|
as: "figure",
|
|
1611
1611
|
class: "markweave-video-node",
|
|
1612
1612
|
"data-testid": "markweave-video-node",
|
|
@@ -1618,9 +1618,9 @@ var rr = J({
|
|
|
1618
1618
|
onFocus: k,
|
|
1619
1619
|
onKeydown: A,
|
|
1620
1620
|
onMousedown: (e) => {
|
|
1621
|
-
s.value &&
|
|
1621
|
+
s.value && !tr(e.target) && (e.preventDefault(), k());
|
|
1622
1622
|
}
|
|
1623
|
-
}, () => [g.value ?
|
|
1623
|
+
}, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
|
|
1624
1624
|
class: "markweave-video-iframe",
|
|
1625
1625
|
src: g.value,
|
|
1626
1626
|
title: b.value ?? `${h.value ?? "Video"} embed`,
|
|
@@ -1629,32 +1629,32 @@ var rr = J({
|
|
|
1629
1629
|
"data-markweave-video-src": f.value ?? void 0,
|
|
1630
1630
|
allow: w,
|
|
1631
1631
|
allowfullscreen: "true"
|
|
1632
|
-
}), s.value ?
|
|
1632
|
+
}), s.value ? B("button", {
|
|
1633
1633
|
type: "button",
|
|
1634
1634
|
class: "markweave-video-selection-layer",
|
|
1635
1635
|
"data-testid": "markweave-video-selection-layer",
|
|
1636
1636
|
tabindex: -1,
|
|
1637
1637
|
"aria-label": u.value.selectAriaLabel
|
|
1638
|
-
}) : null]) : f.value ?
|
|
1638
|
+
}) : null]) : f.value ? B("div", { class: "markweave-video-box" }, [B("video", {
|
|
1639
1639
|
class: "markweave-video",
|
|
1640
1640
|
src: f.value,
|
|
1641
1641
|
title: b.value ?? void 0,
|
|
1642
1642
|
controls: !0,
|
|
1643
1643
|
"data-markweave-video": "true",
|
|
1644
1644
|
"data-markweave-mime-type": _.value ?? void 0
|
|
1645
|
-
}), s.value ?
|
|
1645
|
+
}), s.value ? B("button", {
|
|
1646
1646
|
type: "button",
|
|
1647
1647
|
class: "markweave-video-selection-layer",
|
|
1648
1648
|
"data-testid": "markweave-video-selection-layer",
|
|
1649
1649
|
tabindex: -1,
|
|
1650
1650
|
"aria-label": u.value.selectAriaLabel
|
|
1651
|
-
}) : null]) :
|
|
1651
|
+
}) : null]) : B("div", {
|
|
1652
1652
|
class: "markweave-video-readonly-empty",
|
|
1653
1653
|
"data-testid": "markweave-video-readonly-empty",
|
|
1654
1654
|
"aria-hidden": "true"
|
|
1655
1655
|
})]);
|
|
1656
1656
|
}
|
|
1657
|
-
}),
|
|
1657
|
+
}), sr = h.extend({
|
|
1658
1658
|
addOptions() {
|
|
1659
1659
|
return {
|
|
1660
1660
|
...this.parent?.(),
|
|
@@ -1663,9 +1663,9 @@ var rr = J({
|
|
|
1663
1663
|
};
|
|
1664
1664
|
},
|
|
1665
1665
|
addNodeView() {
|
|
1666
|
-
return typeof document > "u" ? null : a(
|
|
1666
|
+
return typeof document > "u" ? null : a(ar, { stopEvent: ({ event: e }) => er(e.target) });
|
|
1667
1667
|
}
|
|
1668
|
-
}),
|
|
1668
|
+
}), cr = g.extend({
|
|
1669
1669
|
addOptions() {
|
|
1670
1670
|
return {
|
|
1671
1671
|
...this.parent?.(),
|
|
@@ -1674,17 +1674,17 @@ var rr = J({
|
|
|
1674
1674
|
};
|
|
1675
1675
|
},
|
|
1676
1676
|
addNodeView() {
|
|
1677
|
-
return typeof document > "u" ? null : a(
|
|
1677
|
+
return typeof document > "u" ? null : a(or, { stopEvent: ({ event: e }) => tr(e.target) });
|
|
1678
1678
|
}
|
|
1679
1679
|
});
|
|
1680
1680
|
//#endregion
|
|
1681
1681
|
//#region src/create-editor-extensions.ts
|
|
1682
|
-
function
|
|
1682
|
+
function lr(n = {}) {
|
|
1683
1683
|
return e({
|
|
1684
1684
|
lang: n.lang,
|
|
1685
1685
|
mediaExtensions: t({
|
|
1686
|
-
image:
|
|
1687
|
-
video:
|
|
1686
|
+
image: sr,
|
|
1687
|
+
video: cr,
|
|
1688
1688
|
lang: n.lang,
|
|
1689
1689
|
onImageUpload: n.onImageUpload,
|
|
1690
1690
|
onVideoUpload: n.onVideoUpload
|
|
@@ -1693,7 +1693,7 @@ function sr(n = {}) {
|
|
|
1693
1693
|
}
|
|
1694
1694
|
//#endregion
|
|
1695
1695
|
//#region src/MarkweaveEditor.ts
|
|
1696
|
-
var
|
|
1696
|
+
var ur = {
|
|
1697
1697
|
active: !1,
|
|
1698
1698
|
mode: "outside",
|
|
1699
1699
|
activeCellPos: null,
|
|
@@ -1701,17 +1701,17 @@ var cr = {
|
|
|
1701
1701
|
selectedCellCount: 0,
|
|
1702
1702
|
selectionFrom: 0,
|
|
1703
1703
|
selectionTo: 0
|
|
1704
|
-
},
|
|
1704
|
+
}, dr = {
|
|
1705
1705
|
active: !1,
|
|
1706
|
-
language:
|
|
1706
|
+
language: xe.defaultLanguage,
|
|
1707
1707
|
mermaidPreviewMode: "code",
|
|
1708
1708
|
pos: null,
|
|
1709
1709
|
text: ""
|
|
1710
1710
|
};
|
|
1711
|
-
function
|
|
1712
|
-
return
|
|
1711
|
+
function fr(e) {
|
|
1712
|
+
return Tt.getState(e.state) ?? wt;
|
|
1713
1713
|
}
|
|
1714
|
-
function
|
|
1714
|
+
function pr(e) {
|
|
1715
1715
|
if (!e || typeof window > "u") return null;
|
|
1716
1716
|
let t = e.parentElement;
|
|
1717
1717
|
for (; t;) {
|
|
@@ -1722,133 +1722,133 @@ function dr(e) {
|
|
|
1722
1722
|
return null;
|
|
1723
1723
|
}
|
|
1724
1724
|
function Z(e, t, n = 18, r = 1.8) {
|
|
1725
|
-
return
|
|
1725
|
+
return B(e, {
|
|
1726
1726
|
size: n,
|
|
1727
1727
|
strokeWidth: r,
|
|
1728
1728
|
"aria-hidden": "true"
|
|
1729
1729
|
}, { default: () => t });
|
|
1730
1730
|
}
|
|
1731
|
-
function
|
|
1732
|
-
return e === "clipboard" ? [
|
|
1731
|
+
function mr(e) {
|
|
1732
|
+
return e === "clipboard" ? [B("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), B("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] : e === "search" ? [B("circle", {
|
|
1733
1733
|
cx: "10",
|
|
1734
1734
|
cy: "10",
|
|
1735
1735
|
r: "5.5"
|
|
1736
|
-
}),
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1736
|
+
}), B("path", { d: "m14 14 4 4" })] : e === "check" ? [B("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
|
|
1737
|
+
B("path", { d: "M8 4H4v4" }),
|
|
1738
|
+
B("path", { d: "M4 4l5 5" }),
|
|
1739
|
+
B("path", { d: "M16 4h4v4" }),
|
|
1740
|
+
B("path", { d: "m20 4-5 5" }),
|
|
1741
|
+
B("path", { d: "M8 20H4v-4" }),
|
|
1742
|
+
B("path", { d: "m4 20 5-5" }),
|
|
1743
|
+
B("path", { d: "M16 20h4v-4" }),
|
|
1744
|
+
B("path", { d: "m20 20-5-5" })
|
|
1745
1745
|
] : e === "download" ? [
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
] : e === "close" ? [
|
|
1750
|
-
|
|
1746
|
+
B("path", { d: "M12 4v10" }),
|
|
1747
|
+
B("path", { d: "m8 10 4 4 4-4" }),
|
|
1748
|
+
B("path", { d: "M5 19h14" })
|
|
1749
|
+
] : e === "close" ? [B("path", { d: "M6 6l12 12" }), B("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
|
|
1750
|
+
B("circle", {
|
|
1751
1751
|
cx: "10",
|
|
1752
1752
|
cy: "10",
|
|
1753
1753
|
r: "5.25"
|
|
1754
1754
|
}),
|
|
1755
|
-
|
|
1756
|
-
|
|
1755
|
+
B("path", { d: "M7.5 10h5" }),
|
|
1756
|
+
B("path", { d: "m14 14 4 4" })
|
|
1757
1757
|
] : e === "zoomIn" ? [
|
|
1758
|
-
|
|
1758
|
+
B("circle", {
|
|
1759
1759
|
cx: "10",
|
|
1760
1760
|
cy: "10",
|
|
1761
1761
|
r: "5.25"
|
|
1762
1762
|
}),
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
] : e === "reset" ? [
|
|
1763
|
+
B("path", { d: "M7.5 10h5" }),
|
|
1764
|
+
B("path", { d: "M10 7.5v5" }),
|
|
1765
|
+
B("path", { d: "m14 14 4 4" })
|
|
1766
|
+
] : 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" })];
|
|
1767
1767
|
}
|
|
1768
1768
|
function Q(e) {
|
|
1769
|
-
return
|
|
1769
|
+
return B("svg", {
|
|
1770
1770
|
viewBox: "0 0 24 24",
|
|
1771
1771
|
"aria-hidden": "true",
|
|
1772
1772
|
focusable: "false"
|
|
1773
|
-
},
|
|
1773
|
+
}, B("g", {
|
|
1774
1774
|
fill: "none",
|
|
1775
1775
|
stroke: "currentColor",
|
|
1776
1776
|
"stroke-linecap": "round",
|
|
1777
1777
|
"stroke-linejoin": "round",
|
|
1778
1778
|
"stroke-width": "1.8"
|
|
1779
|
-
},
|
|
1779
|
+
}, mr(e)));
|
|
1780
1780
|
}
|
|
1781
1781
|
function $(e) {
|
|
1782
1782
|
e.preventDefault();
|
|
1783
1783
|
}
|
|
1784
|
-
function
|
|
1785
|
-
let t =
|
|
1784
|
+
function hr(e) {
|
|
1785
|
+
let t = qe(e);
|
|
1786
1786
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
1787
1787
|
}
|
|
1788
|
-
var
|
|
1789
|
-
bold:
|
|
1790
|
-
italic:
|
|
1791
|
-
underline:
|
|
1792
|
-
strike:
|
|
1793
|
-
"inline-code":
|
|
1794
|
-
link:
|
|
1795
|
-
more:
|
|
1796
|
-
superscript:
|
|
1797
|
-
subscript:
|
|
1798
|
-
"inline-math":
|
|
1799
|
-
"align-left":
|
|
1800
|
-
"align-center":
|
|
1801
|
-
"align-right":
|
|
1802
|
-
"align-justify":
|
|
1803
|
-
"decrease-indent":
|
|
1804
|
-
"increase-indent":
|
|
1805
|
-
},
|
|
1806
|
-
type:
|
|
1807
|
-
"heading-1":
|
|
1808
|
-
"heading-2":
|
|
1809
|
-
"heading-3":
|
|
1810
|
-
"bullet-list":
|
|
1811
|
-
"ordered-list":
|
|
1812
|
-
"task-list":
|
|
1813
|
-
blockquote:
|
|
1814
|
-
"code-block":
|
|
1815
|
-
info:
|
|
1816
|
-
tip:
|
|
1817
|
-
warning:
|
|
1818
|
-
error:
|
|
1819
|
-
success:
|
|
1820
|
-
emoji:
|
|
1821
|
-
math:
|
|
1822
|
-
table:
|
|
1823
|
-
separator:
|
|
1824
|
-
image:
|
|
1825
|
-
video:
|
|
1826
|
-
attachment:
|
|
1788
|
+
var gr = {
|
|
1789
|
+
bold: un,
|
|
1790
|
+
italic: kn,
|
|
1791
|
+
underline: Yn,
|
|
1792
|
+
strike: Hn,
|
|
1793
|
+
"inline-code": _n,
|
|
1794
|
+
link: jn,
|
|
1795
|
+
more: In,
|
|
1796
|
+
superscript: Wn,
|
|
1797
|
+
subscript: Un,
|
|
1798
|
+
"inline-math": Bn,
|
|
1799
|
+
"align-left": sn,
|
|
1800
|
+
"align-center": an,
|
|
1801
|
+
"align-right": cn,
|
|
1802
|
+
"align-justify": on,
|
|
1803
|
+
"decrease-indent": En,
|
|
1804
|
+
"increase-indent": Dn
|
|
1805
|
+
}, _r = {
|
|
1806
|
+
type: Kn,
|
|
1807
|
+
"heading-1": xn,
|
|
1808
|
+
"heading-2": Sn,
|
|
1809
|
+
"heading-3": Cn,
|
|
1810
|
+
"bullet-list": Mn,
|
|
1811
|
+
"ordered-list": Pn,
|
|
1812
|
+
"task-list": Nn,
|
|
1813
|
+
blockquote: Rn,
|
|
1814
|
+
"code-block": dn,
|
|
1815
|
+
info: On,
|
|
1816
|
+
tip: An,
|
|
1817
|
+
warning: ln,
|
|
1818
|
+
error: gn,
|
|
1819
|
+
success: pn,
|
|
1820
|
+
emoji: Vn,
|
|
1821
|
+
math: Bn,
|
|
1822
|
+
table: Gn,
|
|
1823
|
+
separator: Fn,
|
|
1824
|
+
image: wn,
|
|
1825
|
+
video: Zn,
|
|
1826
|
+
attachment: Ln
|
|
1827
1827
|
};
|
|
1828
|
-
function
|
|
1829
|
-
let t =
|
|
1830
|
-
return
|
|
1828
|
+
function vr(e) {
|
|
1829
|
+
let t = _r[e];
|
|
1830
|
+
return B(t, {
|
|
1831
1831
|
size: 18,
|
|
1832
1832
|
strokeWidth: 1.6,
|
|
1833
1833
|
absoluteStrokeWidth: !0,
|
|
1834
1834
|
"aria-hidden": "true"
|
|
1835
1835
|
});
|
|
1836
1836
|
}
|
|
1837
|
-
var
|
|
1838
|
-
paragraph:
|
|
1839
|
-
"heading-1":
|
|
1840
|
-
"heading-2":
|
|
1841
|
-
"heading-3":
|
|
1842
|
-
"bullet-list":
|
|
1843
|
-
"numbered-list":
|
|
1844
|
-
"todo-list":
|
|
1845
|
-
quote:
|
|
1846
|
-
"code-block":
|
|
1837
|
+
var yr = {
|
|
1838
|
+
paragraph: Jn,
|
|
1839
|
+
"heading-1": xn,
|
|
1840
|
+
"heading-2": Sn,
|
|
1841
|
+
"heading-3": Cn,
|
|
1842
|
+
"bullet-list": Mn,
|
|
1843
|
+
"numbered-list": Pn,
|
|
1844
|
+
"todo-list": Nn,
|
|
1845
|
+
quote: Rn,
|
|
1846
|
+
"code-block": dn
|
|
1847
1847
|
};
|
|
1848
|
-
function
|
|
1849
|
-
return
|
|
1848
|
+
function br(e, t) {
|
|
1849
|
+
return ne(e, t).label;
|
|
1850
1850
|
}
|
|
1851
|
-
var
|
|
1851
|
+
var xr = J({
|
|
1852
1852
|
name: "MarkweaveVueFloatingToolbar",
|
|
1853
1853
|
props: {
|
|
1854
1854
|
editor: {
|
|
@@ -1865,19 +1865,19 @@ var yr = J({
|
|
|
1865
1865
|
}
|
|
1866
1866
|
},
|
|
1867
1867
|
setup(e) {
|
|
1868
|
-
let t =
|
|
1868
|
+
let t = V(null), n = V(""), r = V(null), i = V(null), a = V(null), o = U(() => qe(n.value.trim())), s = U(() => e.messages.floatingToolbar), c = U(() => ie(e.messages).map((e) => [
|
|
1869
1869
|
e.id,
|
|
1870
1870
|
e.label,
|
|
1871
|
-
|
|
1872
|
-
])), l =
|
|
1871
|
+
yr[e.id]
|
|
1872
|
+
])), l = U(() => re(e.messages).map((e) => [
|
|
1873
1873
|
e.id,
|
|
1874
1874
|
e.value,
|
|
1875
1875
|
e.label
|
|
1876
|
-
])), u =
|
|
1876
|
+
])), u = U(() => I(e.messages).map((e) => [
|
|
1877
1877
|
e.id,
|
|
1878
1878
|
e.value,
|
|
1879
1879
|
e.label
|
|
1880
|
-
])), d =
|
|
1880
|
+
])), d = U(() => L(e.messages).map((e) => e.id)), f = () => {
|
|
1881
1881
|
o.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: o.value }).run(), t.value = null);
|
|
1882
1882
|
}, p = () => {
|
|
1883
1883
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
@@ -1894,7 +1894,7 @@ var yr = J({
|
|
|
1894
1894
|
let e = r.value;
|
|
1895
1895
|
if (!e || t.value !== null) return null;
|
|
1896
1896
|
let n = s.value.buttons[e];
|
|
1897
|
-
return n ?
|
|
1897
|
+
return n ? B("div", {
|
|
1898
1898
|
class: "markweave-floating-toolbar-tooltip",
|
|
1899
1899
|
role: "tooltip",
|
|
1900
1900
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
@@ -1902,7 +1902,7 @@ var yr = J({
|
|
|
1902
1902
|
"data-active": h(e),
|
|
1903
1903
|
style: i.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${i.value}px` }
|
|
1904
1904
|
}, n) : null;
|
|
1905
|
-
}, v = (n, i, a, o, s = !1, c) =>
|
|
1905
|
+
}, v = (n, i, a, o, s = !1, c) => B("button", {
|
|
1906
1906
|
type: "button",
|
|
1907
1907
|
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
1908
1908
|
"aria-label": i,
|
|
@@ -1921,13 +1921,13 @@ var yr = J({
|
|
|
1921
1921
|
onMouseenter: (e) => g(n, e.currentTarget),
|
|
1922
1922
|
onMouseleave: () => g(null),
|
|
1923
1923
|
onClick: o
|
|
1924
|
-
}, n === "block-type" ? [
|
|
1924
|
+
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, br(e.editor, e.messages)), Z(t.value === "block-type" ? hn : mn, 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" ? hn : mn, i)])] : [Z(a, i)]), y = () => B("span", {
|
|
1925
1925
|
class: "markweave-floating-toolbar-divider",
|
|
1926
1926
|
"aria-hidden": "true"
|
|
1927
|
-
}), b = (n, r, i) =>
|
|
1927
|
+
}), b = (n, r, i) => B("section", {
|
|
1928
1928
|
class: "markweave-floating-toolbar-color-section",
|
|
1929
1929
|
"aria-label": n
|
|
1930
|
-
}, [
|
|
1930
|
+
}, [B("div", { class: "markweave-floating-toolbar-menu-title" }, n), B("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => B("button", {
|
|
1931
1931
|
key: `${r}-${n}`,
|
|
1932
1932
|
type: "button",
|
|
1933
1933
|
"aria-label": a,
|
|
@@ -1936,31 +1936,31 @@ var yr = J({
|
|
|
1936
1936
|
onClick: () => {
|
|
1937
1937
|
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;
|
|
1938
1938
|
}
|
|
1939
|
-
}, r === "text" ? [
|
|
1939
|
+
}, r === "text" ? [B("span", {
|
|
1940
1940
|
class: "markweave-floating-toolbar-text-swatch",
|
|
1941
1941
|
style: { color: i ?? "#646970" }
|
|
1942
|
-
}, "A")] : [
|
|
1942
|
+
}, "A")] : [B("span", {
|
|
1943
1943
|
class: "markweave-floating-toolbar-highlight-swatch",
|
|
1944
1944
|
style: { backgroundColor: i ?? "#ffffff" },
|
|
1945
1945
|
"aria-hidden": "true"
|
|
1946
|
-
})])))]), x = () => t.value === "block-type" ?
|
|
1946
|
+
})])))]), x = () => t.value === "block-type" ? B("div", {
|
|
1947
1947
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
|
|
1948
1948
|
"data-testid": "markweave-floating-toolbar-turn-menu"
|
|
1949
|
-
}, [
|
|
1949
|
+
}, [B("div", { class: "markweave-floating-toolbar-menu-title" }, s.value.turnIntoTitle), ...c.value.map(([n, r, i]) => B("button", {
|
|
1950
1950
|
key: n,
|
|
1951
1951
|
type: "button",
|
|
1952
1952
|
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
1953
1953
|
onMousedown: $,
|
|
1954
1954
|
onClick: () => {
|
|
1955
|
-
|
|
1955
|
+
ae(e.editor, n), t.value = null;
|
|
1956
1956
|
}
|
|
1957
|
-
}, [
|
|
1957
|
+
}, [B("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), B("span", null, r)]))]) : t.value === "link" ? B("form", {
|
|
1958
1958
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
1959
1959
|
"data-testid": "markweave-floating-toolbar-link-popover",
|
|
1960
1960
|
onSubmit: (e) => {
|
|
1961
1961
|
e.preventDefault(), f();
|
|
1962
1962
|
}
|
|
1963
|
-
}, [
|
|
1963
|
+
}, [B("input", {
|
|
1964
1964
|
value: n.value,
|
|
1965
1965
|
placeholder: s.value.linkPlaceholder,
|
|
1966
1966
|
"aria-label": s.value.linkUrlLabel,
|
|
@@ -1968,43 +1968,43 @@ var yr = J({
|
|
|
1968
1968
|
onInput: (e) => {
|
|
1969
1969
|
n.value = e.target.value;
|
|
1970
1970
|
}
|
|
1971
|
-
}),
|
|
1972
|
-
|
|
1971
|
+
}), B("span", { class: "markweave-floating-toolbar-link-actions" }, [
|
|
1972
|
+
B("button", {
|
|
1973
1973
|
type: "submit",
|
|
1974
1974
|
disabled: !o.value,
|
|
1975
1975
|
"aria-label": s.value.applyLink,
|
|
1976
1976
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
1977
1977
|
onMousedown: $
|
|
1978
|
-
}, [Z(
|
|
1979
|
-
|
|
1978
|
+
}, [Z(vn, s.value.applyLink)]),
|
|
1979
|
+
B("span", {
|
|
1980
1980
|
class: "markweave-floating-toolbar-link-divider",
|
|
1981
1981
|
"aria-hidden": "true"
|
|
1982
1982
|
}),
|
|
1983
|
-
|
|
1983
|
+
B("button", {
|
|
1984
1984
|
type: "button",
|
|
1985
1985
|
disabled: !o.value,
|
|
1986
1986
|
"aria-label": s.value.openLink,
|
|
1987
1987
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
1988
1988
|
onMousedown: $,
|
|
1989
|
-
onClick: () =>
|
|
1990
|
-
}, [Z(
|
|
1991
|
-
|
|
1989
|
+
onClick: () => hr(n.value)
|
|
1990
|
+
}, [Z(bn, s.value.openLink)]),
|
|
1991
|
+
B("button", {
|
|
1992
1992
|
type: "button",
|
|
1993
1993
|
"aria-label": s.value.removeLink,
|
|
1994
1994
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
1995
1995
|
onMousedown: $,
|
|
1996
1996
|
onClick: p
|
|
1997
|
-
}, [Z(
|
|
1998
|
-
])]) : t.value === "color" ?
|
|
1997
|
+
}, [Z(qn, s.value.removeLink)])
|
|
1998
|
+
])]) : t.value === "color" ? B("div", {
|
|
1999
1999
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
2000
2000
|
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
2001
|
-
}, [b(s.value.textColorTitle, "text", l.value), b(s.value.highlightColorTitle, "highlight", u.value)]) : t.value === "more" ?
|
|
2001
|
+
}, [b(s.value.textColorTitle, "text", l.value), b(s.value.highlightColorTitle, "highlight", u.value)]) : t.value === "more" ? B("div", {
|
|
2002
2002
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
2003
2003
|
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
2004
|
-
}, d.value.map((n) =>
|
|
2004
|
+
}, d.value.map((n) => B("span", {
|
|
2005
2005
|
key: n,
|
|
2006
2006
|
class: "markweave-floating-toolbar-more-item"
|
|
2007
|
-
}, [
|
|
2007
|
+
}, [B("button", {
|
|
2008
2008
|
type: "button",
|
|
2009
2009
|
"aria-label": s.value.moreActions[n],
|
|
2010
2010
|
"data-testid": `markweave-floating-toolbar-more-${n}`,
|
|
@@ -2017,41 +2017,41 @@ var yr = J({
|
|
|
2017
2017
|
r.value = null;
|
|
2018
2018
|
},
|
|
2019
2019
|
onClick: () => {
|
|
2020
|
-
|
|
2020
|
+
R(e.editor, n), t.value = null;
|
|
2021
2021
|
}
|
|
2022
|
-
}, [Z(
|
|
2022
|
+
}, [Z(gr[n], s.value.moreActions[n])]), r.value === n ? B("div", {
|
|
2023
2023
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2024
2024
|
role: "tooltip"
|
|
2025
2025
|
}, s.value.moreActions[n]) : null]))) : null;
|
|
2026
|
-
return () =>
|
|
2026
|
+
return () => B(M, {
|
|
2027
2027
|
editor: e.editor,
|
|
2028
|
-
shouldShow: ({ editor: e }) => e.isEditable &&
|
|
2028
|
+
shouldShow: ({ editor: e }) => e.isEditable && ce(z(e)),
|
|
2029
2029
|
options: { placement: "top" }
|
|
2030
|
-
}, { default: () =>
|
|
2030
|
+
}, { default: () => B("div", {
|
|
2031
2031
|
class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
|
|
2032
2032
|
"data-testid": "markweave-floating-toolbar"
|
|
2033
|
-
}, [
|
|
2033
|
+
}, [B("div", {
|
|
2034
2034
|
ref: a,
|
|
2035
2035
|
class: "markweave-floating-toolbar-content",
|
|
2036
2036
|
"data-menu": t.value ?? "none"
|
|
2037
2037
|
}, [
|
|
2038
|
-
v("block-type", s.value.buttons["block-type"],
|
|
2038
|
+
v("block-type", s.value.buttons["block-type"], Jn, () => m("block-type"), t.value === "block-type"),
|
|
2039
2039
|
y(),
|
|
2040
|
-
v("bold", s.value.buttons.bold,
|
|
2041
|
-
v("italic", s.value.buttons.italic,
|
|
2042
|
-
v("underline", s.value.buttons.underline,
|
|
2043
|
-
v("strike", s.value.buttons.strike,
|
|
2044
|
-
v("inline-code", s.value.buttons["inline-code"],
|
|
2040
|
+
v("bold", s.value.buttons.bold, un, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2041
|
+
v("italic", s.value.buttons.italic, kn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2042
|
+
v("underline", s.value.buttons.underline, Yn, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2043
|
+
v("strike", s.value.buttons.strike, Hn, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2044
|
+
v("inline-code", s.value.buttons["inline-code"], _n, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2045
2045
|
y(),
|
|
2046
|
-
v("link", s.value.buttons.link,
|
|
2047
|
-
v("color", s.value.buttons.color,
|
|
2046
|
+
v("link", s.value.buttons.link, jn, () => m("link"), e.editor.isActive("link")),
|
|
2047
|
+
v("color", s.value.buttons.color, Jn, () => m("color"), t.value === "color"),
|
|
2048
2048
|
y(),
|
|
2049
|
-
v("more", s.value.buttons.more,
|
|
2049
|
+
v("more", s.value.buttons.more, In, () => m("more"), t.value === "more"),
|
|
2050
2050
|
x(),
|
|
2051
2051
|
_()
|
|
2052
2052
|
])]) });
|
|
2053
2053
|
}
|
|
2054
|
-
}),
|
|
2054
|
+
}), Sr = J({
|
|
2055
2055
|
name: "MarkweaveVueMathEditorPopover",
|
|
2056
2056
|
props: {
|
|
2057
2057
|
editor: {
|
|
@@ -2072,17 +2072,17 @@ var yr = J({
|
|
|
2072
2072
|
}
|
|
2073
2073
|
},
|
|
2074
2074
|
setup(e) {
|
|
2075
|
-
let t =
|
|
2075
|
+
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(Qe(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
|
|
2076
2076
|
html: a.value,
|
|
2077
2077
|
error: !1
|
|
2078
|
-
} :
|
|
2078
|
+
} : nt(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => Ze(e.editor, e.target) ?? 1), u = () => {
|
|
2079
2079
|
if (typeof window > "u") return;
|
|
2080
|
-
let r =
|
|
2080
|
+
let r = Xe(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2081
2081
|
if (!r || !i) {
|
|
2082
2082
|
e.onClose();
|
|
2083
2083
|
return;
|
|
2084
2084
|
}
|
|
2085
|
-
n.value =
|
|
2085
|
+
n.value = Ye({
|
|
2086
2086
|
anchorRect: r,
|
|
2087
2087
|
frameRect: i,
|
|
2088
2088
|
kind: e.target.kind,
|
|
@@ -2091,7 +2091,7 @@ var yr = J({
|
|
|
2091
2091
|
viewportWidth: window.innerWidth
|
|
2092
2092
|
});
|
|
2093
2093
|
}, d = () => {
|
|
2094
|
-
s.value &&
|
|
2094
|
+
s.value && Je(e.editor, e.target, t.value) && e.onClose();
|
|
2095
2095
|
}, f = (t) => {
|
|
2096
2096
|
if (t.key === "Escape") {
|
|
2097
2097
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -2102,14 +2102,14 @@ var yr = J({
|
|
|
2102
2102
|
let n = t.target;
|
|
2103
2103
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2104
2104
|
};
|
|
2105
|
-
return
|
|
2106
|
-
t.value = e.target.latex, a.value =
|
|
2107
|
-
}),
|
|
2108
|
-
|
|
2105
|
+
return W(() => [e.target.pos, e.target.latex], () => {
|
|
2106
|
+
t.value = e.target.latex, a.value = Qe(e.editor, e.target), q(u);
|
|
2107
|
+
}), G(() => {
|
|
2108
|
+
rt(e.editor, e.target, !0), u(), q(() => {
|
|
2109
2109
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2110
2110
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2111
2111
|
}), K(() => {
|
|
2112
|
-
|
|
2112
|
+
rt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2113
2113
|
}), () => {
|
|
2114
2114
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2115
2115
|
ref: i,
|
|
@@ -2122,7 +2122,7 @@ var yr = J({
|
|
|
2122
2122
|
},
|
|
2123
2123
|
onKeydown: f
|
|
2124
2124
|
};
|
|
2125
|
-
return e.target.kind === "inline" ?
|
|
2125
|
+
return e.target.kind === "inline" ? B("form", {
|
|
2126
2126
|
ref: r,
|
|
2127
2127
|
class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
|
|
2128
2128
|
"aria-label": a,
|
|
@@ -2137,22 +2137,22 @@ var yr = J({
|
|
|
2137
2137
|
onSubmit: (e) => {
|
|
2138
2138
|
e.preventDefault(), d();
|
|
2139
2139
|
}
|
|
2140
|
-
}, [
|
|
2140
|
+
}, [B("label", {
|
|
2141
2141
|
class: "markweave-math-inline-source",
|
|
2142
2142
|
"data-testid": "markweave-math-inline-source"
|
|
2143
2143
|
}, [
|
|
2144
|
-
|
|
2145
|
-
|
|
2144
|
+
B("span", { attrs: { "aria-hidden": "true" } }, "$"),
|
|
2145
|
+
B("input", {
|
|
2146
2146
|
...u,
|
|
2147
2147
|
"aria-label": c.value.latexLabel,
|
|
2148
2148
|
size: Math.max(t.value.length, 1)
|
|
2149
2149
|
}),
|
|
2150
|
-
|
|
2151
|
-
]),
|
|
2150
|
+
B("span", { attrs: { "aria-hidden": "true" } }, "$")
|
|
2151
|
+
]), B("div", {
|
|
2152
2152
|
class: "markweave-math-inline-preview",
|
|
2153
2153
|
"data-error": o.value.error ? "true" : "false",
|
|
2154
2154
|
"data-testid": "markweave-math-editor-preview"
|
|
2155
|
-
}, [
|
|
2155
|
+
}, [B("div", { innerHTML: o.value.html || " " }), o.value.error ? B("small", null, c.value.invalidPreview) : null])]) : B("form", {
|
|
2156
2156
|
ref: r,
|
|
2157
2157
|
class: "markweave-math-editor-popover markweave-math-editor-popover--block",
|
|
2158
2158
|
"aria-label": a,
|
|
@@ -2168,39 +2168,39 @@ var yr = J({
|
|
|
2168
2168
|
e.preventDefault(), d();
|
|
2169
2169
|
}
|
|
2170
2170
|
}, [
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
Z(
|
|
2174
|
-
|
|
2171
|
+
B("div", { class: "markweave-math-block-toolbar" }, [
|
|
2172
|
+
B("span", null, c.value.label),
|
|
2173
|
+
Z(_n, c.value.label, 15, 1.75),
|
|
2174
|
+
B("button", {
|
|
2175
2175
|
type: "submit",
|
|
2176
2176
|
title: c.value.apply,
|
|
2177
2177
|
"aria-label": c.value.apply,
|
|
2178
2178
|
disabled: !s.value,
|
|
2179
2179
|
"data-testid": "markweave-math-editor-apply"
|
|
2180
|
-
}, [Z(
|
|
2180
|
+
}, [Z(pn, c.value.apply, 16, 2)])
|
|
2181
2181
|
]),
|
|
2182
|
-
|
|
2182
|
+
B("label", {
|
|
2183
2183
|
class: "markweave-math-block-source",
|
|
2184
2184
|
"data-testid": "markweave-math-block-source"
|
|
2185
2185
|
}, [
|
|
2186
|
-
|
|
2187
|
-
|
|
2186
|
+
B("span", { attrs: { "aria-hidden": "true" } }, "$$"),
|
|
2187
|
+
B("textarea", {
|
|
2188
2188
|
...u,
|
|
2189
2189
|
"aria-label": c.value.latexLabel,
|
|
2190
2190
|
rows: 3
|
|
2191
2191
|
}),
|
|
2192
|
-
|
|
2192
|
+
B("span", { attrs: { "aria-hidden": "true" } }, "$$")
|
|
2193
2193
|
]),
|
|
2194
|
-
|
|
2194
|
+
B("div", {
|
|
2195
2195
|
class: "markweave-math-block-preview",
|
|
2196
2196
|
"data-error": o.value.error ? "true" : "false",
|
|
2197
2197
|
"data-math-number": String(l.value),
|
|
2198
2198
|
"data-testid": "markweave-math-editor-preview"
|
|
2199
|
-
}, [
|
|
2199
|
+
}, [B("div", { innerHTML: o.value.html || " " }), o.value.error ? B("small", null, c.value.invalidPreview) : null])
|
|
2200
2200
|
]);
|
|
2201
2201
|
};
|
|
2202
2202
|
}
|
|
2203
|
-
}),
|
|
2203
|
+
}), Cr = J({
|
|
2204
2204
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2205
2205
|
props: {
|
|
2206
2206
|
commands: {
|
|
@@ -2237,7 +2237,7 @@ var yr = J({
|
|
|
2237
2237
|
}
|
|
2238
2238
|
},
|
|
2239
2239
|
setup(e) {
|
|
2240
|
-
let t =
|
|
2240
|
+
let t = V(""), n = V(null), r = V(null), i = V(!1), a = V(""), o = V(0), s = U(() => {
|
|
2241
2241
|
let t = a.value.trim().toLowerCase();
|
|
2242
2242
|
return (t ? e.messages.slash.emojiItems.filter((e) => [
|
|
2243
2243
|
e.emoji,
|
|
@@ -2292,32 +2292,32 @@ var yr = J({
|
|
|
2292
2292
|
group: t,
|
|
2293
2293
|
commands: e.commands.filter((e) => e.group === t)
|
|
2294
2294
|
})).filter((e) => e.commands.length);
|
|
2295
|
-
return
|
|
2295
|
+
return B("div", {
|
|
2296
2296
|
class: "markweave-slash-layer",
|
|
2297
2297
|
style: { display: "contents" },
|
|
2298
2298
|
"data-testid": "markweave-slash-layer"
|
|
2299
|
-
}, [
|
|
2299
|
+
}, [B("div", {
|
|
2300
2300
|
class: "markweave-slash-trigger",
|
|
2301
2301
|
style: d,
|
|
2302
2302
|
"aria-hidden": "true",
|
|
2303
2303
|
"data-testid": "markweave-slash-trigger"
|
|
2304
|
-
}, [
|
|
2304
|
+
}, [B("span", null, "/"), B("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), B("div", {
|
|
2305
2305
|
class: "markweave-slash-menu",
|
|
2306
2306
|
style: u,
|
|
2307
2307
|
role: "listbox",
|
|
2308
2308
|
"aria-label": e.messages.slash.ariaLabel,
|
|
2309
2309
|
"data-placement": e.position.placement,
|
|
2310
2310
|
"data-testid": "markweave-slash-menu"
|
|
2311
|
-
}, [e.inputCommand?.inputKind === "emoji" ?
|
|
2311
|
+
}, [e.inputCommand?.inputKind === "emoji" ? B("div", {
|
|
2312
2312
|
class: "markweave-slash-subpanel",
|
|
2313
2313
|
"data-testid": "markweave-slash-emoji-picker"
|
|
2314
2314
|
}, [
|
|
2315
|
-
|
|
2315
|
+
B("div", { class: "markweave-slash-subpanel-header" }, [B("button", {
|
|
2316
2316
|
type: "button",
|
|
2317
2317
|
onMousedown: $,
|
|
2318
2318
|
onClick: () => e.onInputCommandChange(null)
|
|
2319
|
-
}, e.messages.common.back),
|
|
2320
|
-
|
|
2319
|
+
}, e.messages.common.back), B("span", null, e.messages.slash.emojiTitle)]),
|
|
2320
|
+
B("label", { class: "markweave-slash-input" }, [B("span", null, "/"), B("input", {
|
|
2321
2321
|
autofocus: !0,
|
|
2322
2322
|
value: a.value,
|
|
2323
2323
|
placeholder: e.messages.slash.emojiSearchPlaceholder,
|
|
@@ -2328,11 +2328,11 @@ var yr = J({
|
|
|
2328
2328
|
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));
|
|
2329
2329
|
}
|
|
2330
2330
|
})]),
|
|
2331
|
-
|
|
2331
|
+
B("div", {
|
|
2332
2332
|
class: "markweave-slash-emoji-grid",
|
|
2333
2333
|
role: "listbox",
|
|
2334
2334
|
"aria-label": e.messages.slash.emojiTitle
|
|
2335
|
-
}, s.value.map((e, t) =>
|
|
2335
|
+
}, s.value.map((e, t) => B("button", {
|
|
2336
2336
|
key: `${e.emoji}-${e.label}`,
|
|
2337
2337
|
type: "button",
|
|
2338
2338
|
role: "option",
|
|
@@ -2341,17 +2341,17 @@ var yr = J({
|
|
|
2341
2341
|
onMouseenter: () => o.value = t,
|
|
2342
2342
|
onMousedown: $,
|
|
2343
2343
|
onClick: () => l(t)
|
|
2344
|
-
}, [
|
|
2345
|
-
]) : e.inputCommand?.inputKind === "upload" ?
|
|
2344
|
+
}, [B("span", null, e.emoji), B("small", null, e.label)])))
|
|
2345
|
+
]) : e.inputCommand?.inputKind === "upload" ? B("div", {
|
|
2346
2346
|
class: "markweave-slash-subpanel",
|
|
2347
2347
|
"data-testid": "markweave-slash-upload-panel"
|
|
2348
2348
|
}, [
|
|
2349
|
-
|
|
2349
|
+
B("div", { class: "markweave-slash-upload-header" }, [B("button", {
|
|
2350
2350
|
type: "button",
|
|
2351
2351
|
onMousedown: $,
|
|
2352
2352
|
onClick: () => e.onInputCommandChange(null)
|
|
2353
|
-
}, e.messages.common.back),
|
|
2354
|
-
|
|
2353
|
+
}, e.messages.common.back), B("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
|
|
2354
|
+
B("label", { class: "markweave-slash-upload-field" }, [B("span", null, e.messages.slash.uploadValueLabel), B("input", {
|
|
2355
2355
|
autofocus: !0,
|
|
2356
2356
|
value: t.value,
|
|
2357
2357
|
placeholder: e.messages.slash.uploadValuePlaceholder,
|
|
@@ -2362,32 +2362,32 @@ var yr = J({
|
|
|
2362
2362
|
e.key === "Enter" && (e.preventDefault(), c());
|
|
2363
2363
|
}
|
|
2364
2364
|
})]),
|
|
2365
|
-
|
|
2365
|
+
B("label", { class: "markweave-slash-upload-field" }, [B("span", null, e.messages.common.file), B("input", {
|
|
2366
2366
|
type: "file",
|
|
2367
2367
|
onChange: (e) => n.value = e.target.files?.[0] ?? null
|
|
2368
2368
|
})]),
|
|
2369
|
-
r.value ?
|
|
2369
|
+
r.value ? B("div", {
|
|
2370
2370
|
class: "markweave-slash-upload-error",
|
|
2371
2371
|
role: "alert"
|
|
2372
2372
|
}, r.value) : null,
|
|
2373
|
-
|
|
2373
|
+
B("div", { class: "markweave-slash-upload-actions" }, [B("button", {
|
|
2374
2374
|
type: "button",
|
|
2375
2375
|
onMousedown: $,
|
|
2376
2376
|
onClick: () => e.onInputCommandChange(null)
|
|
2377
|
-
}, e.messages.common.cancel),
|
|
2377
|
+
}, e.messages.common.cancel), B("button", {
|
|
2378
2378
|
type: "button",
|
|
2379
2379
|
"data-primary": "true",
|
|
2380
2380
|
disabled: i.value,
|
|
2381
2381
|
onMousedown: $,
|
|
2382
2382
|
onClick: c
|
|
2383
2383
|
}, e.messages.common.insert)])
|
|
2384
|
-
]) : e.commands.length ?
|
|
2384
|
+
]) : e.commands.length ? B("div", { class: "markweave-slash-command-list" }, f.map((t) => B("section", {
|
|
2385
2385
|
key: t.group,
|
|
2386
2386
|
class: "markweave-slash-group",
|
|
2387
2387
|
"aria-label": t.group
|
|
2388
|
-
}, [
|
|
2389
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
2390
|
-
return
|
|
2388
|
+
}, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
2389
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = dt(t);
|
|
2390
|
+
return B("button", {
|
|
2391
2391
|
key: t.id,
|
|
2392
2392
|
type: "button",
|
|
2393
2393
|
role: "option",
|
|
@@ -2409,18 +2409,18 @@ var yr = J({
|
|
|
2409
2409
|
}
|
|
2410
2410
|
}
|
|
2411
2411
|
}, [
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
t.disabledReason ?
|
|
2412
|
+
vr(t.icon),
|
|
2413
|
+
B("span", null, t.label),
|
|
2414
|
+
t.disabledReason ? B("small", null, t.disabledReason) : null
|
|
2415
2415
|
]);
|
|
2416
|
-
})]))) :
|
|
2416
|
+
})]))) : B("div", {
|
|
2417
2417
|
class: "markweave-slash-menu__empty",
|
|
2418
2418
|
role: "option",
|
|
2419
2419
|
"aria-disabled": "true"
|
|
2420
2420
|
}, e.messages.slash.noResults)])]);
|
|
2421
2421
|
};
|
|
2422
2422
|
}
|
|
2423
|
-
}),
|
|
2423
|
+
}), wr = J({
|
|
2424
2424
|
name: "MarkweaveVueTableControls",
|
|
2425
2425
|
props: {
|
|
2426
2426
|
editor: {
|
|
@@ -2453,12 +2453,12 @@ var yr = J({
|
|
|
2453
2453
|
}
|
|
2454
2454
|
},
|
|
2455
2455
|
setup(e) {
|
|
2456
|
-
let t =
|
|
2456
|
+
let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ? St(e.editor.state) : ur), h = U(() => Pt(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => Pt(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Mt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? Rt(e.editor, t.value) : []), b = () => {
|
|
2457
2457
|
p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
|
|
2458
2458
|
}, x = (e) => {
|
|
2459
2459
|
b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
|
|
2460
2460
|
s.value = null, p = null;
|
|
2461
|
-
},
|
|
2461
|
+
}, Ht));
|
|
2462
2462
|
}, S = () => {
|
|
2463
2463
|
if (!e.active) {
|
|
2464
2464
|
r.value = null, i.value = null, a.value = null, x(null);
|
|
@@ -2469,16 +2469,16 @@ var yr = J({
|
|
|
2469
2469
|
r.value = null, i.value = null, a.value = null;
|
|
2470
2470
|
return;
|
|
2471
2471
|
}
|
|
2472
|
-
let s = o.getBoundingClientRect(), c = h.value ?
|
|
2473
|
-
c ? r.value =
|
|
2472
|
+
let s = o.getBoundingClientRect(), c = h.value ? Nt(e.editor, h.value) : null, l = g.value ? Nt(e.editor, g.value) : null, u = v.value ? zt(e.editor) : null;
|
|
2473
|
+
c ? r.value = Dt({
|
|
2474
2474
|
targetRect: c,
|
|
2475
2475
|
frameRect: s,
|
|
2476
2476
|
kind: "row"
|
|
2477
|
-
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value =
|
|
2477
|
+
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Dt({
|
|
2478
2478
|
targetRect: l,
|
|
2479
2479
|
frameRect: s,
|
|
2480
2480
|
kind: "column"
|
|
2481
|
-
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value =
|
|
2481
|
+
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Dt({
|
|
2482
2482
|
targetRect: u,
|
|
2483
2483
|
frameRect: s,
|
|
2484
2484
|
kind: "selection"
|
|
@@ -2493,13 +2493,13 @@ var yr = J({
|
|
|
2493
2493
|
o.value = null;
|
|
2494
2494
|
return;
|
|
2495
2495
|
}
|
|
2496
|
-
let a = i.getBoundingClientRect(), s = t.value === "row" ?
|
|
2496
|
+
let a = i.getBoundingClientRect(), s = t.value === "row" ? jt(e.editor)?.getBoundingClientRect() : null, c = s ? {
|
|
2497
2497
|
left: a.left,
|
|
2498
2498
|
top: s.top,
|
|
2499
2499
|
width: a.width,
|
|
2500
2500
|
height: a.height
|
|
2501
2501
|
} : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
|
|
2502
|
-
o.value =
|
|
2502
|
+
o.value = Et({
|
|
2503
2503
|
anchorRect: c,
|
|
2504
2504
|
frameRect: p,
|
|
2505
2505
|
menuSize: {
|
|
@@ -2516,16 +2516,16 @@ var yr = J({
|
|
|
2516
2516
|
let i = t.value === e && n.value === r;
|
|
2517
2517
|
n.value = r, t.value = i ? null : e, T();
|
|
2518
2518
|
}, D = () => {
|
|
2519
|
-
e.editor.view.dispatch(
|
|
2519
|
+
e.editor.view.dispatch(yt(e.editor.state.tr, null));
|
|
2520
2520
|
}, O = (t, n) => {
|
|
2521
2521
|
let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
2522
|
-
r !== null &&
|
|
2522
|
+
r !== null && Vt(e.editor, r, t, { visualIndex: i }), E(t, n);
|
|
2523
2523
|
}, k = () => {
|
|
2524
2524
|
D(), E("selection", "selection-edge");
|
|
2525
2525
|
}, A = (n = !1) => {
|
|
2526
2526
|
t.value = null, o.value = null, n && e.editor.view.focus();
|
|
2527
2527
|
}, j = async (n, r) => {
|
|
2528
|
-
let i = await
|
|
2528
|
+
let i = await kt({
|
|
2529
2529
|
editor: e.editor,
|
|
2530
2530
|
commandId: n,
|
|
2531
2531
|
menu: r ?? t.value ?? "selection",
|
|
@@ -2533,18 +2533,18 @@ var yr = J({
|
|
|
2533
2533
|
});
|
|
2534
2534
|
return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
2535
2535
|
}, M = (t) => {
|
|
2536
|
-
let n =
|
|
2536
|
+
let n = Ft(e.editor, t);
|
|
2537
2537
|
n && e.onEditWithAi?.(n), A(!0);
|
|
2538
2538
|
}, N = (e) => {
|
|
2539
2539
|
!t.value || e.key !== "Escape" || A(!0);
|
|
2540
2540
|
}, ee = (e) => {
|
|
2541
2541
|
t.value && (e.target instanceof Node && c.value?.contains(e.target) || A());
|
|
2542
2542
|
};
|
|
2543
|
-
|
|
2543
|
+
G(() => {
|
|
2544
2544
|
w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", N), document.addEventListener("mousedown", ee);
|
|
2545
2545
|
}), K(() => {
|
|
2546
2546
|
b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", N), document.removeEventListener("mousedown", ee);
|
|
2547
|
-
}),
|
|
2547
|
+
}), W(() => [
|
|
2548
2548
|
e.active,
|
|
2549
2549
|
m.value.activeCellPos,
|
|
2550
2550
|
m.value.selectionFrom,
|
|
@@ -2555,11 +2555,11 @@ var yr = J({
|
|
|
2555
2555
|
t.value,
|
|
2556
2556
|
n.value
|
|
2557
2557
|
], T, { flush: "post" });
|
|
2558
|
-
let P = () => t.value ?
|
|
2558
|
+
let P = () => t.value ? B("div", {
|
|
2559
2559
|
ref: f,
|
|
2560
2560
|
class: "markweave-table-menu",
|
|
2561
2561
|
role: "menu",
|
|
2562
|
-
"aria-label":
|
|
2562
|
+
"aria-label": Ut(t.value, e.messages),
|
|
2563
2563
|
"data-testid": "markweave-table-menu",
|
|
2564
2564
|
"data-positioned": o.value ? "true" : "false",
|
|
2565
2565
|
style: o.value ? {
|
|
@@ -2567,8 +2567,8 @@ var yr = J({
|
|
|
2567
2567
|
top: `${o.value.top}px`
|
|
2568
2568
|
} : void 0
|
|
2569
2569
|
}, y.value.map((n, r) => {
|
|
2570
|
-
let i =
|
|
2571
|
-
return
|
|
2570
|
+
let i = It(n), a = r === 0 ? i : It(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Ot(e.editor, n.commandId), c = Lt(n, e.messages);
|
|
2571
|
+
return B("button", {
|
|
2572
2572
|
key: `${n.id}-${r}`,
|
|
2573
2573
|
type: "button",
|
|
2574
2574
|
role: "menuitem",
|
|
@@ -2591,7 +2591,7 @@ var yr = J({
|
|
|
2591
2591
|
}
|
|
2592
2592
|
}, c);
|
|
2593
2593
|
})) : null;
|
|
2594
|
-
return () => e.active ?
|
|
2594
|
+
return () => e.active ? B("div", {
|
|
2595
2595
|
ref: c,
|
|
2596
2596
|
class: "markweave-table-controls",
|
|
2597
2597
|
"data-testid": "markweave-table-controls",
|
|
@@ -2599,7 +2599,7 @@ var yr = J({
|
|
|
2599
2599
|
"data-open-menu": t.value ?? "none",
|
|
2600
2600
|
"data-positioned": r.value || i.value || a.value ? "true" : "false"
|
|
2601
2601
|
}, [
|
|
2602
|
-
s.value ?
|
|
2602
|
+
s.value ? B("div", {
|
|
2603
2603
|
class: "markweave-table-copy-feedback",
|
|
2604
2604
|
role: "status",
|
|
2605
2605
|
"aria-live": "polite",
|
|
@@ -2607,8 +2607,8 @@ var yr = J({
|
|
|
2607
2607
|
"data-copy-kind": s.value.kind,
|
|
2608
2608
|
"data-text-length": s.value.textLength,
|
|
2609
2609
|
"data-html-length": s.value.htmlLength
|
|
2610
|
-
},
|
|
2611
|
-
r.value ?
|
|
2610
|
+
}, At(s.value)) : null,
|
|
2611
|
+
r.value ? B("button", {
|
|
2612
2612
|
ref: l,
|
|
2613
2613
|
type: "button",
|
|
2614
2614
|
class: "markweave-table-edge-handle markweave-table-edge-handle--row",
|
|
@@ -2627,8 +2627,8 @@ var yr = J({
|
|
|
2627
2627
|
},
|
|
2628
2628
|
onMousedown: $,
|
|
2629
2629
|
onClick: () => O("row", "row-edge")
|
|
2630
|
-
}, [
|
|
2631
|
-
i.value ?
|
|
2630
|
+
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2631
|
+
i.value ? B("button", {
|
|
2632
2632
|
ref: u,
|
|
2633
2633
|
type: "button",
|
|
2634
2634
|
class: "markweave-table-edge-handle markweave-table-edge-handle--column",
|
|
@@ -2647,8 +2647,8 @@ var yr = J({
|
|
|
2647
2647
|
},
|
|
2648
2648
|
onMousedown: $,
|
|
2649
2649
|
onClick: () => O("column", "column-edge")
|
|
2650
|
-
}, [
|
|
2651
|
-
v.value && a.value ?
|
|
2650
|
+
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2651
|
+
v.value && a.value ? B("button", {
|
|
2652
2652
|
ref: d,
|
|
2653
2653
|
type: "button",
|
|
2654
2654
|
class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
@@ -2663,11 +2663,11 @@ var yr = J({
|
|
|
2663
2663
|
},
|
|
2664
2664
|
onMousedown: $,
|
|
2665
2665
|
onClick: k
|
|
2666
|
-
}, [
|
|
2666
|
+
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2667
2667
|
P()
|
|
2668
2668
|
]) : null;
|
|
2669
2669
|
}
|
|
2670
|
-
}),
|
|
2670
|
+
}), Tr = J({
|
|
2671
2671
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
2672
2672
|
props: {
|
|
2673
2673
|
editor: {
|
|
@@ -2680,18 +2680,18 @@ var yr = J({
|
|
|
2680
2680
|
}
|
|
2681
2681
|
},
|
|
2682
2682
|
setup(e) {
|
|
2683
|
-
let t =
|
|
2683
|
+
let t = V(null), n = () => {
|
|
2684
2684
|
if (e.focusState.mode !== "cell-selection") {
|
|
2685
2685
|
t.value = null;
|
|
2686
2686
|
return;
|
|
2687
2687
|
}
|
|
2688
|
-
t.value =
|
|
2688
|
+
t.value = Bt(e.editor, Ct(e.editor.state));
|
|
2689
2689
|
};
|
|
2690
|
-
return
|
|
2690
|
+
return G(() => {
|
|
2691
2691
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
2692
2692
|
}), K(() => {
|
|
2693
2693
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
2694
|
-
}),
|
|
2694
|
+
}), W(() => [
|
|
2695
2695
|
e.focusState.activeCellPos,
|
|
2696
2696
|
e.focusState.anchorCellPos,
|
|
2697
2697
|
e.focusState.mode,
|
|
@@ -2702,7 +2702,7 @@ var yr = J({
|
|
|
2702
2702
|
q(n);
|
|
2703
2703
|
}, { flush: "post" }), () => {
|
|
2704
2704
|
let e = t.value;
|
|
2705
|
-
return e ?
|
|
2705
|
+
return e ? B("div", {
|
|
2706
2706
|
"aria-hidden": "true",
|
|
2707
2707
|
class: "markweave-table-selection-overlay",
|
|
2708
2708
|
"data-anchor-cell-pos": e.anchorCellPos ?? "",
|
|
@@ -2723,7 +2723,7 @@ var yr = J({
|
|
|
2723
2723
|
}) : null;
|
|
2724
2724
|
};
|
|
2725
2725
|
}
|
|
2726
|
-
}),
|
|
2726
|
+
}), Er = J({
|
|
2727
2727
|
name: "MarkweaveVueCodeBlockControls",
|
|
2728
2728
|
props: {
|
|
2729
2729
|
editor: {
|
|
@@ -2752,116 +2752,116 @@ var yr = J({
|
|
|
2752
2752
|
}
|
|
2753
2753
|
},
|
|
2754
2754
|
setup(e) {
|
|
2755
|
-
let t =
|
|
2755
|
+
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({
|
|
2756
2756
|
active: !1,
|
|
2757
2757
|
lastX: 0,
|
|
2758
2758
|
lastY: 0
|
|
2759
|
-
}), g =
|
|
2759
|
+
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, ze(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
2760
2760
|
...e.state,
|
|
2761
2761
|
pos: e.state.pos,
|
|
2762
2762
|
active: !0
|
|
2763
|
-
} : null), S =
|
|
2763
|
+
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => Ue(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), D = U(() => !e.readOnly), O = U(() => S.value ? Ne(S.value.language) : Ne("text")), k = U(() => u.value?.status ?? "idle"), A = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), j = U(() => w.value && A.value === "preview"), M = U(() => (v.value, g.value, _.value, Ve(e.editor))), N = U(() => `${_.value}|${M.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), ee = U(() => Le(l.value)), P = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), te = () => {
|
|
2764
2764
|
y !== null && (window.clearTimeout(y), y = null);
|
|
2765
2765
|
}, F = (e) => {
|
|
2766
2766
|
te(), u.value = e, e && (y = window.setTimeout(() => {
|
|
2767
2767
|
u.value = null, y = null;
|
|
2768
|
-
},
|
|
2769
|
-
},
|
|
2768
|
+
}, De));
|
|
2769
|
+
}, ne = () => {
|
|
2770
2770
|
f.value = null, p.value = null, m.value = !1, h.value = {
|
|
2771
2771
|
active: !1,
|
|
2772
2772
|
lastX: 0,
|
|
2773
2773
|
lastY: 0
|
|
2774
2774
|
}, e.editor.view.focus();
|
|
2775
|
-
},
|
|
2775
|
+
}, I = () => {
|
|
2776
2776
|
let n = t.value;
|
|
2777
2777
|
if (!n) return;
|
|
2778
|
-
if (!
|
|
2778
|
+
if (!Be(n) || M.value.length === 0) {
|
|
2779
2779
|
o.value = [];
|
|
2780
2780
|
return;
|
|
2781
2781
|
}
|
|
2782
2782
|
let r = n.getBoundingClientRect(), i = M.value.flatMap((t) => {
|
|
2783
|
-
let n =
|
|
2784
|
-
return n ? [
|
|
2783
|
+
let n = Ie(Fe(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
2784
|
+
return n ? [je(t, n, r)] : [];
|
|
2785
2785
|
});
|
|
2786
|
-
o.value =
|
|
2787
|
-
},
|
|
2786
|
+
o.value = We(o.value, i, M.value.map((e) => e.pos));
|
|
2787
|
+
}, L = () => {
|
|
2788
2788
|
if (!E.value || !S.value) {
|
|
2789
2789
|
a.value = null, s.value = null;
|
|
2790
2790
|
return;
|
|
2791
2791
|
}
|
|
2792
2792
|
let r = t.value;
|
|
2793
2793
|
if (!r) return;
|
|
2794
|
-
let i =
|
|
2794
|
+
let i = Fe(e.editor, S.value.pos, A.value), o = r.getBoundingClientRect(), l = Ie(i, o);
|
|
2795
2795
|
if (!l) {
|
|
2796
2796
|
a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
|
|
2797
2797
|
return;
|
|
2798
2798
|
}
|
|
2799
|
-
if (a.value =
|
|
2799
|
+
if (a.value = ke(S.value.pos, l, o), c.value && n.value) {
|
|
2800
2800
|
let e = n.value.getBoundingClientRect();
|
|
2801
|
-
s.value =
|
|
2801
|
+
s.value = Te({
|
|
2802
2802
|
overlayRect: o,
|
|
2803
2803
|
buttonRect: e,
|
|
2804
2804
|
windowWidth: window.innerWidth,
|
|
2805
2805
|
windowHeight: window.innerHeight
|
|
2806
2806
|
});
|
|
2807
2807
|
}
|
|
2808
|
-
},
|
|
2808
|
+
}, re = async () => {
|
|
2809
2809
|
if (e.readOnly) {
|
|
2810
2810
|
if (!S.value) return;
|
|
2811
|
-
let e = await
|
|
2812
|
-
F(
|
|
2811
|
+
let e = await Oe(S.value.text);
|
|
2812
|
+
F(be(S.value, e ? "copied" : "failed"));
|
|
2813
2813
|
return;
|
|
2814
2814
|
}
|
|
2815
|
-
if (!
|
|
2816
|
-
let t = await
|
|
2817
|
-
F(
|
|
2818
|
-
},
|
|
2815
|
+
if (!Me(e.editor, S.value)) return;
|
|
2816
|
+
let t = await ve(e.editor);
|
|
2817
|
+
F(be(ye(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
2818
|
+
}, ie = (t, n) => {
|
|
2819
2819
|
if (e.readOnly) {
|
|
2820
|
-
|
|
2820
|
+
ct(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
|
|
2821
2821
|
return;
|
|
2822
2822
|
}
|
|
2823
2823
|
let r = e.state.active && e.state.pos === t.pos;
|
|
2824
|
-
|
|
2825
|
-
},
|
|
2824
|
+
we(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
|
|
2825
|
+
}, R = (t) => {
|
|
2826
2826
|
if (e.readOnly || !S.value) return;
|
|
2827
2827
|
let n = e.state.active && e.state.pos === S.value.pos;
|
|
2828
|
-
|
|
2829
|
-
}, ie = () => {
|
|
2830
|
-
e.readOnly || !S.value || ye(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
2828
|
+
Ce(e.editor, S.value.pos, t) && (t === "mermaid" && we(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
|
|
2831
2829
|
}, ae = () => {
|
|
2830
|
+
e.readOnly || !S.value || Se(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
2831
|
+
}, oe = () => {
|
|
2832
2832
|
if (!S.value) return;
|
|
2833
|
-
let t =
|
|
2833
|
+
let t = He(e.editor, S.value.pos);
|
|
2834
2834
|
if (!t) return;
|
|
2835
2835
|
let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
2836
2836
|
i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
|
|
2837
|
-
},
|
|
2837
|
+
}, se = () => {
|
|
2838
2838
|
if (!S.value) return;
|
|
2839
|
-
let t =
|
|
2840
|
-
t && (f.value =
|
|
2839
|
+
let t = He(e.editor, S.value.pos);
|
|
2840
|
+
t && (f.value = Ae(t), p.value = null, m.value = !1, h.value = {
|
|
2841
2841
|
active: !1,
|
|
2842
2842
|
lastX: 0,
|
|
2843
2843
|
lastY: 0
|
|
2844
2844
|
});
|
|
2845
|
-
},
|
|
2845
|
+
}, z = (e) => {
|
|
2846
2846
|
f.value = f.value ? {
|
|
2847
2847
|
...f.value,
|
|
2848
|
-
scale:
|
|
2848
|
+
scale: Ee(f.value.scale + e)
|
|
2849
2849
|
} : null;
|
|
2850
|
-
},
|
|
2851
|
-
f.value = f.value ?
|
|
2850
|
+
}, ce = () => {
|
|
2851
|
+
f.value = f.value ? Ae(f.value.svg) : null, h.value = {
|
|
2852
2852
|
active: !1,
|
|
2853
2853
|
lastX: 0,
|
|
2854
2854
|
lastY: 0
|
|
2855
2855
|
}, m.value = !1;
|
|
2856
|
-
}, ce = (e) => {
|
|
2857
|
-
e.preventDefault(), B(e.deltaY < 0 ? He : -He);
|
|
2858
2856
|
}, le = (e) => {
|
|
2857
|
+
e.preventDefault(), z(e.deltaY < 0 ? Ge : -Ge);
|
|
2858
|
+
}, ue = (e) => {
|
|
2859
2859
|
e.button === 0 && (e.preventDefault(), h.value = {
|
|
2860
2860
|
active: !0,
|
|
2861
2861
|
lastX: e.clientX,
|
|
2862
2862
|
lastY: e.clientY
|
|
2863
2863
|
}, m.value = !0);
|
|
2864
|
-
},
|
|
2864
|
+
}, de = (e) => {
|
|
2865
2865
|
let t = h.value;
|
|
2866
2866
|
if (!t.active) return;
|
|
2867
2867
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
@@ -2869,50 +2869,50 @@ var yr = J({
|
|
|
2869
2869
|
active: !0,
|
|
2870
2870
|
lastX: e.clientX,
|
|
2871
2871
|
lastY: e.clientY
|
|
2872
|
-
}, f.value =
|
|
2873
|
-
},
|
|
2872
|
+
}, f.value = Ke(f.value, n, r);
|
|
2873
|
+
}, fe = () => {
|
|
2874
2874
|
h.value = {
|
|
2875
2875
|
active: !1,
|
|
2876
2876
|
lastX: 0,
|
|
2877
2877
|
lastY: 0
|
|
2878
2878
|
}, m.value = !1;
|
|
2879
2879
|
};
|
|
2880
|
-
|
|
2880
|
+
W(() => e.readOnly, (e) => {
|
|
2881
2881
|
e && (c.value = !1, l.value = "");
|
|
2882
|
-
}),
|
|
2882
|
+
}), W(P, () => {
|
|
2883
2883
|
F(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
|
|
2884
|
-
}),
|
|
2885
|
-
e && (await q(),
|
|
2886
|
-
}),
|
|
2884
|
+
}), W(c, async (e) => {
|
|
2885
|
+
e && (await q(), L(), r.value?.focus({ preventScroll: !0 }));
|
|
2886
|
+
}), W(() => [
|
|
2887
2887
|
E.value,
|
|
2888
2888
|
g.value,
|
|
2889
2889
|
S.value?.pos ?? null,
|
|
2890
2890
|
c.value,
|
|
2891
2891
|
A.value
|
|
2892
2892
|
], async () => {
|
|
2893
|
-
await q(),
|
|
2893
|
+
await q(), L();
|
|
2894
2894
|
}, {
|
|
2895
2895
|
flush: "post",
|
|
2896
2896
|
immediate: !0
|
|
2897
|
-
}),
|
|
2898
|
-
await q(),
|
|
2897
|
+
}), W(N, async () => {
|
|
2898
|
+
await q(), I(), window.requestAnimationFrame(I);
|
|
2899
2899
|
}, {
|
|
2900
2900
|
flush: "post",
|
|
2901
2901
|
immediate: !0
|
|
2902
2902
|
});
|
|
2903
|
-
let
|
|
2904
|
-
return
|
|
2903
|
+
let pe = null;
|
|
2904
|
+
return G(() => {
|
|
2905
2905
|
q(() => {
|
|
2906
2906
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
2907
2907
|
if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
|
|
2908
|
-
let r =
|
|
2908
|
+
let r = Re(e.editor, n.target), a = ze(e.editor, r), o = a && !Ue(e.editor, a) ? a.pos : null;
|
|
2909
2909
|
i.value = i.value === o ? i.value : o;
|
|
2910
2910
|
}, a = () => {
|
|
2911
2911
|
c.value || (i.value = null);
|
|
2912
2912
|
}, o = (t) => {
|
|
2913
2913
|
if (t.key === "Escape") {
|
|
2914
2914
|
if (f.value) {
|
|
2915
|
-
|
|
2915
|
+
ne();
|
|
2916
2916
|
return;
|
|
2917
2917
|
}
|
|
2918
2918
|
c.value && (c.value = !1, e.editor.view.focus());
|
|
@@ -2920,14 +2920,14 @@ var yr = J({
|
|
|
2920
2920
|
}, s = (e) => {
|
|
2921
2921
|
c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
|
|
2922
2922
|
}, l = ({ transaction: e }) => {
|
|
2923
|
-
e.getMeta(
|
|
2923
|
+
e.getMeta(_e) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(_e) || ot(e)) && (v.value += 1);
|
|
2924
2924
|
};
|
|
2925
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize",
|
|
2926
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize",
|
|
2925
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", L), window.addEventListener("scroll", L, !0), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), pe = () => {
|
|
2926
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", L), window.removeEventListener("scroll", L, !0), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), te();
|
|
2927
2927
|
};
|
|
2928
2928
|
});
|
|
2929
2929
|
}), K(() => {
|
|
2930
|
-
|
|
2930
|
+
pe?.(), pe = null, te();
|
|
2931
2931
|
}), () => {
|
|
2932
2932
|
if (!E.value && M.value.length === 0 && !f.value) return null;
|
|
2933
2933
|
let i = a.value ? {
|
|
@@ -2937,7 +2937,7 @@ var yr = J({
|
|
|
2937
2937
|
left: `${s.value.left}px`,
|
|
2938
2938
|
top: `${s.value.top}px`
|
|
2939
2939
|
} : void 0;
|
|
2940
|
-
return
|
|
2940
|
+
return B("div", {
|
|
2941
2941
|
ref: t,
|
|
2942
2942
|
class: "markweave-codeblock-overlay",
|
|
2943
2943
|
"data-testid": "markweave-codeblock-overlay",
|
|
@@ -2945,7 +2945,7 @@ var yr = J({
|
|
|
2945
2945
|
}, [
|
|
2946
2946
|
...M.value.map((e) => {
|
|
2947
2947
|
let t = o.value.find((t) => t.pos === e.pos);
|
|
2948
|
-
return
|
|
2948
|
+
return B("div", {
|
|
2949
2949
|
key: e.pos,
|
|
2950
2950
|
class: "markweave-mermaid-tabs",
|
|
2951
2951
|
"data-testid": "markweave-mermaid-tabs",
|
|
@@ -2955,16 +2955,16 @@ var yr = J({
|
|
|
2955
2955
|
top: `${t.top}px`,
|
|
2956
2956
|
left: `${t.left}px`
|
|
2957
2957
|
} : void 0
|
|
2958
|
-
}, ["code", "preview"].map((t) =>
|
|
2958
|
+
}, ["code", "preview"].map((t) => B("button", {
|
|
2959
2959
|
key: t,
|
|
2960
2960
|
type: "button",
|
|
2961
2961
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
2962
2962
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
2963
2963
|
onMousedown: $,
|
|
2964
|
-
onClick: () =>
|
|
2964
|
+
onClick: () => ie(e, t)
|
|
2965
2965
|
}, t === "code" ? "Code" : "Preview")));
|
|
2966
2966
|
}),
|
|
2967
|
-
E.value && S.value ?
|
|
2967
|
+
E.value && S.value ? B("div", {
|
|
2968
2968
|
class: "markweave-codeblock-controls",
|
|
2969
2969
|
"data-testid": "markweave-codeblock-controls",
|
|
2970
2970
|
"data-positioned": a.value ? "true" : "false",
|
|
@@ -2973,11 +2973,11 @@ var yr = J({
|
|
|
2973
2973
|
"aria-label": "Code block controls",
|
|
2974
2974
|
style: i
|
|
2975
2975
|
}, [
|
|
2976
|
-
e.readOnly ?
|
|
2976
|
+
e.readOnly ? B("span", {
|
|
2977
2977
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
2978
2978
|
"aria-label": "Code block language",
|
|
2979
2979
|
"data-testid": "markweave-codeblock-language"
|
|
2980
|
-
}, [
|
|
2980
|
+
}, [B("span", null, O.value)]) : B("button", {
|
|
2981
2981
|
ref: n,
|
|
2982
2982
|
type: "button",
|
|
2983
2983
|
class: "markweave-codeblock-language-button",
|
|
@@ -2989,8 +2989,8 @@ var yr = J({
|
|
|
2989
2989
|
onClick: () => {
|
|
2990
2990
|
c.value = !c.value;
|
|
2991
2991
|
}
|
|
2992
|
-
}, [
|
|
2993
|
-
D.value ?
|
|
2992
|
+
}, [B("span", null, O.value), Q("chevron")]),
|
|
2993
|
+
D.value ? B("button", {
|
|
2994
2994
|
type: "button",
|
|
2995
2995
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
2996
2996
|
"aria-label": T.value ? "Expand code block" : "Collapse code block",
|
|
@@ -2998,9 +2998,9 @@ var yr = J({
|
|
|
2998
2998
|
"data-testid": "markweave-codeblock-collapse",
|
|
2999
2999
|
"data-collapsed": T.value ? "true" : "false",
|
|
3000
3000
|
onMousedown: $,
|
|
3001
|
-
onClick:
|
|
3001
|
+
onClick: ae
|
|
3002
3002
|
}, [Q("chevron")]) : null,
|
|
3003
|
-
|
|
3003
|
+
B("span", { class: "markweave-codeblock-copy-wrap" }, [B("button", {
|
|
3004
3004
|
type: "button",
|
|
3005
3005
|
class: "markweave-codeblock-icon-button",
|
|
3006
3006
|
"aria-label": "Copy to clipboard",
|
|
@@ -3020,42 +3020,42 @@ var yr = J({
|
|
|
3020
3020
|
d.value = !1;
|
|
3021
3021
|
},
|
|
3022
3022
|
onClick: () => {
|
|
3023
|
-
|
|
3023
|
+
re();
|
|
3024
3024
|
}
|
|
3025
|
-
}, [Q(k.value === "copied" ? "check" : "clipboard")]), d.value ?
|
|
3025
|
+
}, [Q(k.value === "copied" ? "check" : "clipboard")]), d.value ? B("span", {
|
|
3026
3026
|
class: "markweave-codeblock-tooltip",
|
|
3027
3027
|
role: "tooltip",
|
|
3028
3028
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
3029
3029
|
}, "Copy to clipboard") : null]),
|
|
3030
|
-
w.value && A.value === "preview" ?
|
|
3030
|
+
w.value && A.value === "preview" ? B("div", {
|
|
3031
3031
|
class: "markweave-mermaid-preview-actions",
|
|
3032
3032
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
3033
|
-
}, [
|
|
3033
|
+
}, [B("button", {
|
|
3034
3034
|
type: "button",
|
|
3035
3035
|
class: "markweave-codeblock-icon-button",
|
|
3036
3036
|
"aria-label": "Fullscreen Mermaid preview",
|
|
3037
3037
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
3038
3038
|
disabled: !j.value,
|
|
3039
3039
|
onMousedown: $,
|
|
3040
|
-
onClick:
|
|
3041
|
-
}, [Q("expand")]),
|
|
3040
|
+
onClick: se
|
|
3041
|
+
}, [Q("expand")]), B("button", {
|
|
3042
3042
|
type: "button",
|
|
3043
3043
|
class: "markweave-codeblock-icon-button",
|
|
3044
3044
|
"aria-label": "Download Mermaid SVG",
|
|
3045
3045
|
"data-testid": "markweave-mermaid-download",
|
|
3046
3046
|
disabled: !j.value,
|
|
3047
3047
|
onMousedown: $,
|
|
3048
|
-
onClick:
|
|
3048
|
+
onClick: oe
|
|
3049
3049
|
}, [Q("download")])]) : null
|
|
3050
3050
|
]) : null,
|
|
3051
|
-
D.value && E.value && c.value && S.value ?
|
|
3051
|
+
D.value && E.value && c.value && S.value ? B("div", {
|
|
3052
3052
|
class: "markweave-codeblock-language-menu",
|
|
3053
3053
|
role: "listbox",
|
|
3054
3054
|
"aria-label": "Code block languages",
|
|
3055
3055
|
"data-testid": "markweave-codeblock-language-menu",
|
|
3056
3056
|
"data-positioned": s.value ? "true" : "false",
|
|
3057
3057
|
style: u
|
|
3058
|
-
}, [
|
|
3058
|
+
}, [B("label", { class: "markweave-codeblock-language-search" }, [B("input", {
|
|
3059
3059
|
ref: r,
|
|
3060
3060
|
value: l.value,
|
|
3061
3061
|
placeholder: "Search...",
|
|
@@ -3066,9 +3066,9 @@ var yr = J({
|
|
|
3066
3066
|
onKeydown: (t) => {
|
|
3067
3067
|
t.key === "Escape" && (t.preventDefault(), c.value = !1, e.editor.view.focus());
|
|
3068
3068
|
}
|
|
3069
|
-
}), Q("search")]),
|
|
3069
|
+
}), Q("search")]), B("div", { class: "markweave-codeblock-language-list" }, ee.value.map((e) => {
|
|
3070
3070
|
let t = S.value?.language === e.language;
|
|
3071
|
-
return
|
|
3071
|
+
return B("button", {
|
|
3072
3072
|
key: e.language,
|
|
3073
3073
|
type: "button",
|
|
3074
3074
|
role: "option",
|
|
@@ -3076,21 +3076,21 @@ var yr = J({
|
|
|
3076
3076
|
"data-testid": `markweave-codeblock-language-option-${e.language}`,
|
|
3077
3077
|
"data-active": t ? "true" : "false",
|
|
3078
3078
|
onMousedown: $,
|
|
3079
|
-
onClick: () =>
|
|
3080
|
-
}, [
|
|
3079
|
+
onClick: () => R(e.language)
|
|
3080
|
+
}, [B("span", null, e.label), t ? Q("check") : null]);
|
|
3081
3081
|
}))]) : null,
|
|
3082
|
-
f.value ?
|
|
3082
|
+
f.value ? B("div", {
|
|
3083
3083
|
class: "markweave-mermaid-fullscreen-layer",
|
|
3084
3084
|
role: "dialog",
|
|
3085
3085
|
"aria-modal": "true",
|
|
3086
3086
|
"aria-label": "Mermaid preview",
|
|
3087
3087
|
"data-testid": "markweave-mermaid-fullscreen-layer"
|
|
3088
3088
|
}, [
|
|
3089
|
-
|
|
3089
|
+
B("div", {
|
|
3090
3090
|
class: "markweave-mermaid-fullscreen-toolbar",
|
|
3091
3091
|
"data-testid": "markweave-mermaid-fullscreen-toolbar"
|
|
3092
3092
|
}, [
|
|
3093
|
-
|
|
3093
|
+
B("button", {
|
|
3094
3094
|
type: "button",
|
|
3095
3095
|
class: "markweave-mermaid-fullscreen-control",
|
|
3096
3096
|
"aria-label": "Zoom out",
|
|
@@ -3107,13 +3107,13 @@ var yr = J({
|
|
|
3107
3107
|
onBlur: () => {
|
|
3108
3108
|
p.value = null;
|
|
3109
3109
|
},
|
|
3110
|
-
onClick: () =>
|
|
3110
|
+
onClick: () => z(-Ge)
|
|
3111
3111
|
}, [Q("zoomOut")]),
|
|
3112
|
-
|
|
3112
|
+
B("span", {
|
|
3113
3113
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3114
3114
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3115
|
-
},
|
|
3116
|
-
|
|
3115
|
+
}, Pe(f.value.scale)),
|
|
3116
|
+
B("button", {
|
|
3117
3117
|
type: "button",
|
|
3118
3118
|
class: "markweave-mermaid-fullscreen-control",
|
|
3119
3119
|
"aria-label": "Zoom in",
|
|
@@ -3130,9 +3130,9 @@ var yr = J({
|
|
|
3130
3130
|
onBlur: () => {
|
|
3131
3131
|
p.value = null;
|
|
3132
3132
|
},
|
|
3133
|
-
onClick: () =>
|
|
3133
|
+
onClick: () => z(Ge)
|
|
3134
3134
|
}, [Q("zoomIn")]),
|
|
3135
|
-
|
|
3135
|
+
B("button", {
|
|
3136
3136
|
type: "button",
|
|
3137
3137
|
class: "markweave-mermaid-fullscreen-control",
|
|
3138
3138
|
"aria-label": "Reset zoom",
|
|
@@ -3149,31 +3149,31 @@ var yr = J({
|
|
|
3149
3149
|
onBlur: () => {
|
|
3150
3150
|
p.value = null;
|
|
3151
3151
|
},
|
|
3152
|
-
onClick:
|
|
3152
|
+
onClick: ce
|
|
3153
3153
|
}, [Q("reset")]),
|
|
3154
|
-
p.value ?
|
|
3154
|
+
p.value ? B("span", {
|
|
3155
3155
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
3156
3156
|
role: "tooltip",
|
|
3157
3157
|
"data-testid": "markweave-mermaid-fullscreen-tooltip"
|
|
3158
3158
|
}, p.value === "zoom-out" ? "Zoom out" : p.value === "zoom-in" ? "Zoom in" : "Reset") : null
|
|
3159
3159
|
]),
|
|
3160
|
-
|
|
3160
|
+
B("button", {
|
|
3161
3161
|
type: "button",
|
|
3162
3162
|
class: "markweave-mermaid-fullscreen-close",
|
|
3163
3163
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
3164
3164
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3165
|
-
onClick:
|
|
3165
|
+
onClick: ne
|
|
3166
3166
|
}, [Q("close")]),
|
|
3167
|
-
|
|
3167
|
+
B("div", {
|
|
3168
3168
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
3169
3169
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
3170
3170
|
"data-dragging": m.value ? "true" : "false",
|
|
3171
|
-
onWheel:
|
|
3172
|
-
onMousedown:
|
|
3173
|
-
onMousemove:
|
|
3174
|
-
onMouseup:
|
|
3175
|
-
onMouseleave:
|
|
3176
|
-
}, [
|
|
3171
|
+
onWheel: le,
|
|
3172
|
+
onMousedown: ue,
|
|
3173
|
+
onMousemove: de,
|
|
3174
|
+
onMouseup: fe,
|
|
3175
|
+
onMouseleave: fe
|
|
3176
|
+
}, [B("div", {
|
|
3177
3177
|
class: "markweave-mermaid-fullscreen-content",
|
|
3178
3178
|
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
3179
3179
|
"data-scale-percent": Math.round(f.value.scale * 100),
|
|
@@ -3189,7 +3189,7 @@ var yr = J({
|
|
|
3189
3189
|
]);
|
|
3190
3190
|
};
|
|
3191
3191
|
}
|
|
3192
|
-
}),
|
|
3192
|
+
}), Dr = J({
|
|
3193
3193
|
name: "MarkweaveVueInnerToc",
|
|
3194
3194
|
props: {
|
|
3195
3195
|
editor: {
|
|
@@ -3207,21 +3207,29 @@ var yr = J({
|
|
|
3207
3207
|
editable: {
|
|
3208
3208
|
type: Boolean,
|
|
3209
3209
|
required: !0
|
|
3210
|
+
},
|
|
3211
|
+
placement: {
|
|
3212
|
+
type: String,
|
|
3213
|
+
required: !0
|
|
3210
3214
|
}
|
|
3211
3215
|
},
|
|
3212
3216
|
setup(e) {
|
|
3213
|
-
|
|
3217
|
+
let t = V(null), n, r = () => {
|
|
3218
|
+
n?.(), n = e.placement === "container" && t.value ? he(t.value) : void 0;
|
|
3219
|
+
};
|
|
3220
|
+
return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
|
|
3221
|
+
ref: t,
|
|
3214
3222
|
class: "markweave-inner-toc",
|
|
3215
3223
|
"data-testid": "markweave-inner-toc",
|
|
3216
3224
|
"aria-label": e.messages.toc.ariaLabel
|
|
3217
|
-
}, [
|
|
3225
|
+
}, [B("div", {
|
|
3218
3226
|
class: "markweave-inner-toc-rail",
|
|
3219
3227
|
"aria-hidden": "true"
|
|
3220
|
-
}, e.state.items.map((e) =>
|
|
3228
|
+
}, e.state.items.map((e) => B("span", {
|
|
3221
3229
|
key: e.id,
|
|
3222
3230
|
"data-level": e.level,
|
|
3223
3231
|
"data-active": e.active ? "true" : "false"
|
|
3224
|
-
}))),
|
|
3232
|
+
}))), B("div", { class: "markweave-inner-toc-panel" }, [B("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => B("button", {
|
|
3225
3233
|
key: t.id,
|
|
3226
3234
|
type: "button",
|
|
3227
3235
|
class: "markweave-inner-toc-item",
|
|
@@ -3230,17 +3238,17 @@ var yr = J({
|
|
|
3230
3238
|
"aria-current": t.active ? "location" : void 0,
|
|
3231
3239
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
3232
3240
|
title: t.text,
|
|
3233
|
-
onClick: () =>
|
|
3241
|
+
onClick: () => ge(e.editor, t, {
|
|
3234
3242
|
behavior: "smooth",
|
|
3235
3243
|
focus: e.editable
|
|
3236
3244
|
})
|
|
3237
3245
|
}, t.text)))])]) : null;
|
|
3238
3246
|
}
|
|
3239
3247
|
});
|
|
3240
|
-
function
|
|
3241
|
-
let t = m(e.lang), r = p(t), i = f(t), a =
|
|
3248
|
+
function Or(e = {}) {
|
|
3249
|
+
let t = m(e.lang), r = p(t), i = f(t), a = V(l(e.mode)), o = U(() => a.value === "live" && e.editable !== !1), s = V(0), c = H(null), d = V(_t), h = H(null), g = H(null), _ = V("code"), v = H(null), y = H(wt), b = V(null), x = V(!1), S = F(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), C = e.onSlashCommandUpload, w = H(null);
|
|
3242
3250
|
w.value = new n({
|
|
3243
|
-
extensions:
|
|
3251
|
+
extensions: lr({
|
|
3244
3252
|
lang: t,
|
|
3245
3253
|
onImageUpload: (e) => C?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3246
3254
|
onVideoUpload: (e) => C?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
|
|
@@ -3259,17 +3267,17 @@ function Er(e = {}) {
|
|
|
3259
3267
|
translate: "no"
|
|
3260
3268
|
},
|
|
3261
3269
|
handleClick: (e, t, n) => {
|
|
3262
|
-
if (!o.value) return
|
|
3263
|
-
let r =
|
|
3264
|
-
return r ? (n.preventDefault(), n.stopPropagation(), E(),
|
|
3270
|
+
if (!o.value) return oe(n);
|
|
3271
|
+
let r = et(e, n);
|
|
3272
|
+
return r ? (n.preventDefault(), n.stopPropagation(), E(), it(e, r, !0), at(e, r), v.value = r, !0) : (v.value = null, !1);
|
|
3265
3273
|
},
|
|
3266
3274
|
handleDOMEvents: {
|
|
3267
|
-
compositionstart: () => o.value ? (d.value =
|
|
3275
|
+
compositionstart: () => o.value ? (d.value = vt(d.value, { type: "composition-start" }), h.value = null, !1) : !1,
|
|
3268
3276
|
compositionend: (e) => (o.value && window.setTimeout(() => D(e), 0), !1),
|
|
3269
3277
|
click: (e, t) => {
|
|
3270
|
-
if (!o.value) return
|
|
3271
|
-
let n =
|
|
3272
|
-
return n ? (t.preventDefault(), t.stopPropagation(), E(),
|
|
3278
|
+
if (!o.value) return oe(t);
|
|
3279
|
+
let n = et(e, t);
|
|
3280
|
+
return n ? (t.preventDefault(), t.stopPropagation(), E(), it(e, n, !0), at(e, n), v.value = n, !0) : (v.value = null, !1);
|
|
3273
3281
|
}
|
|
3274
3282
|
}
|
|
3275
3283
|
},
|
|
@@ -3278,11 +3286,11 @@ function Er(e = {}) {
|
|
|
3278
3286
|
u(t, {
|
|
3279
3287
|
mode: a.value,
|
|
3280
3288
|
editable: o.value
|
|
3281
|
-
}),
|
|
3289
|
+
}), st(t, o.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && o.value && xt(t), j(t), k(t), s.value += 1;
|
|
3282
3290
|
},
|
|
3283
3291
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3284
|
-
if (j(e), (t.docChanged ||
|
|
3285
|
-
let t =
|
|
3292
|
+
if (j(e), (t.docChanged || ot(t)) && (s.value += 1), t.docChanged && v.value) {
|
|
3293
|
+
let t = $e(e, v.value.pos);
|
|
3286
3294
|
v.value = t?.kind === v.value.kind ? t : null;
|
|
3287
3295
|
}
|
|
3288
3296
|
},
|
|
@@ -3290,86 +3298,86 @@ function Er(e = {}) {
|
|
|
3290
3298
|
k(t), o.value && O(t), x.value || e.onUpdate?.(ee(t));
|
|
3291
3299
|
}
|
|
3292
3300
|
});
|
|
3293
|
-
let T =
|
|
3301
|
+
let T = U(() => w.value ?? null);
|
|
3294
3302
|
function E() {
|
|
3295
|
-
h.value = null, g.value = null, d.value =
|
|
3303
|
+
h.value = null, g.value = null, d.value = _t;
|
|
3296
3304
|
}
|
|
3297
3305
|
function D(e) {
|
|
3298
|
-
let t =
|
|
3306
|
+
let t = gt(e.state);
|
|
3299
3307
|
if (!t) {
|
|
3300
|
-
d.value = d.value.name === "idle" ? d.value :
|
|
3308
|
+
d.value = d.value.name === "idle" ? d.value : _t, h.value = null, g.value = null;
|
|
3301
3309
|
return;
|
|
3302
3310
|
}
|
|
3303
3311
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3304
|
-
h.value =
|
|
3312
|
+
h.value = ht(n, {
|
|
3305
3313
|
frameRect: i,
|
|
3306
3314
|
triggerRect: r
|
|
3307
|
-
}), d.value =
|
|
3315
|
+
}), d.value = mt(d.value, t);
|
|
3308
3316
|
}
|
|
3309
3317
|
function O(e) {
|
|
3310
3318
|
D(e.view);
|
|
3311
3319
|
}
|
|
3312
3320
|
function k(e) {
|
|
3313
|
-
c.value =
|
|
3314
|
-
let t =
|
|
3315
|
-
t && (
|
|
3316
|
-
let n =
|
|
3321
|
+
c.value = z(e);
|
|
3322
|
+
let t = tt(e);
|
|
3323
|
+
t && (rt(e, t, !0), v.value = t);
|
|
3324
|
+
let n = ye(e);
|
|
3317
3325
|
n.active && n.language === "mermaid" && (_.value = n.mermaidPreviewMode);
|
|
3318
3326
|
}
|
|
3319
3327
|
function j(e) {
|
|
3320
|
-
y.value =
|
|
3328
|
+
y.value = fr(e);
|
|
3321
3329
|
}
|
|
3322
|
-
let M =
|
|
3323
|
-
active:
|
|
3330
|
+
let M = U(() => T.value ? ye(T.value) : dr), ne = U(() => T.value ? St(T.value.state) : ur), I = U(() => c.value?.currentNode === "codeBlock"), L = U(() => I.value && M.value.language === "mermaid"), re = U(() => T.value ? lt({
|
|
3331
|
+
active: L.value,
|
|
3324
3332
|
mode: _.value,
|
|
3325
3333
|
source: M.value.text
|
|
3326
|
-
}) :
|
|
3334
|
+
}) : lt({
|
|
3327
3335
|
active: !1,
|
|
3328
3336
|
mode: "code",
|
|
3329
3337
|
source: ""
|
|
3330
|
-
})),
|
|
3338
|
+
})), ie = U(() => T.value ? bt(T.value.state) : null), R = U(() => T.value ? fe(T.value.state.doc) : ue.items), ae = U(() => pe(R.value, b.value)), ce = U(() => le(R.value, ae.value)), me = U(() => ut(d.value.query, i)), he = U(() => se({
|
|
3331
3339
|
revision: s.value,
|
|
3332
3340
|
mode: a.value,
|
|
3333
3341
|
editable: o.value,
|
|
3334
|
-
toc:
|
|
3342
|
+
toc: ce.value,
|
|
3335
3343
|
selection: c.value,
|
|
3336
3344
|
slash: d.value,
|
|
3337
|
-
table:
|
|
3345
|
+
table: ne.value,
|
|
3338
3346
|
tableInteraction: y.value,
|
|
3339
3347
|
codeBlock: M.value,
|
|
3340
|
-
mermaid:
|
|
3341
|
-
tableDebugSnapshot:
|
|
3342
|
-
})),
|
|
3348
|
+
mermaid: re.value,
|
|
3349
|
+
tableDebugSnapshot: ie.value
|
|
3350
|
+
})), ge = {
|
|
3343
3351
|
closeSlashMenu: E,
|
|
3344
|
-
focusFirstTableBodyCell: () => T.value ?
|
|
3352
|
+
focusFirstTableBodyCell: () => T.value ? xt(T.value) : !1,
|
|
3345
3353
|
setContent: (e, t = {}) => {
|
|
3346
3354
|
if (!T.value) return !1;
|
|
3347
3355
|
let n = F(t.format);
|
|
3348
3356
|
return T.value.commands.setContent(e, {
|
|
3349
3357
|
contentType: P(n),
|
|
3350
3358
|
emitUpdate: t.emitUpdate ?? !1
|
|
3351
|
-
}), t.focusFirstTableBodyCell &&
|
|
3359
|
+
}), t.focusFirstTableBodyCell && xt(T.value), k(T.value), o.value && O(T.value), j(T.value), s.value += 1, !0;
|
|
3352
3360
|
}
|
|
3353
3361
|
};
|
|
3354
3362
|
function _e(e, t) {
|
|
3355
|
-
if (!(!T.value || !o.value || !
|
|
3363
|
+
if (!(!T.value || !o.value || !dt(e))) {
|
|
3356
3364
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3357
3365
|
g.value = e;
|
|
3358
3366
|
return;
|
|
3359
3367
|
}
|
|
3360
|
-
|
|
3368
|
+
pt(T.value, d.value, e, t), d.value = vt(d.value, { type: "execute" }), E();
|
|
3361
3369
|
}
|
|
3362
3370
|
}
|
|
3363
3371
|
function ve(e) {
|
|
3364
3372
|
if (!T.value || g.value || !o.value) return;
|
|
3365
|
-
let t =
|
|
3373
|
+
let t = ft(d.value, me.value, e.key, { isComposing: e.isComposing || N(T.value.state) });
|
|
3366
3374
|
if (t.type !== "ignore") {
|
|
3367
3375
|
if (e.preventDefault(), t.type === "close") {
|
|
3368
|
-
d.value =
|
|
3376
|
+
d.value = vt(d.value, { type: "escape" }), E();
|
|
3369
3377
|
return;
|
|
3370
3378
|
}
|
|
3371
3379
|
if (t.type === "move-active") {
|
|
3372
|
-
d.value =
|
|
3380
|
+
d.value = vt(d.value, {
|
|
3373
3381
|
type: "move-active",
|
|
3374
3382
|
delta: t.delta,
|
|
3375
3383
|
optionCount: t.optionCount
|
|
@@ -3379,58 +3387,58 @@ function Er(e = {}) {
|
|
|
3379
3387
|
_e(t.command);
|
|
3380
3388
|
}
|
|
3381
3389
|
}
|
|
3382
|
-
|
|
3390
|
+
W(() => [e.mode, e.editable], () => {
|
|
3383
3391
|
a.value = l(e.mode), T.value && (T.value.setEditable(o.value), u(T.value, {
|
|
3384
3392
|
mode: a.value,
|
|
3385
3393
|
editable: o.value
|
|
3386
|
-
}),
|
|
3387
|
-
}, { immediate: !0 }),
|
|
3394
|
+
}), st(T.value, o.value ? "live" : "view"), o.value || E());
|
|
3395
|
+
}, { immediate: !0 }), W(() => e.content, (t) => {
|
|
3388
3396
|
!T.value || t === void 0 || te(T.value, t, F(e.contentFormat)) || (x.value = !0, T.value.commands.setContent(t, {
|
|
3389
3397
|
contentType: P(F(e.contentFormat)),
|
|
3390
3398
|
emitUpdate: !1
|
|
3391
3399
|
}), x.value = !1, k(T.value), o.value && O(T.value), j(T.value), s.value += 1);
|
|
3392
|
-
}),
|
|
3393
|
-
let t =
|
|
3400
|
+
}), W(he, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(ce, (t) => e.onTocChange?.(t), { immediate: !0 }), W(R, (e) => {
|
|
3401
|
+
let t = pe(e, b.value);
|
|
3394
3402
|
b.value !== t && (b.value = t);
|
|
3395
3403
|
});
|
|
3396
|
-
let
|
|
3397
|
-
return
|
|
3404
|
+
let be = null;
|
|
3405
|
+
return G(() => {
|
|
3398
3406
|
let e = () => {
|
|
3399
|
-
if (!T.value || !
|
|
3407
|
+
if (!T.value || !R.value.length) {
|
|
3400
3408
|
b.value = null;
|
|
3401
3409
|
return;
|
|
3402
3410
|
}
|
|
3403
3411
|
let e = null;
|
|
3404
3412
|
try {
|
|
3405
|
-
e =
|
|
3413
|
+
e = de(T.value, R.value);
|
|
3406
3414
|
} catch {
|
|
3407
3415
|
return;
|
|
3408
3416
|
}
|
|
3409
3417
|
b.value !== e && (b.value = e);
|
|
3410
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
3411
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
3418
|
+
}, t = () => window.requestAnimationFrame(e), n = pr(T.value?.view.dom ?? null);
|
|
3419
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), be = () => {
|
|
3412
3420
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3413
3421
|
};
|
|
3414
3422
|
}), K(() => {
|
|
3415
|
-
|
|
3423
|
+
be?.(), w.value?.destroy(), w.value = null;
|
|
3416
3424
|
}), {
|
|
3417
3425
|
editor: T,
|
|
3418
|
-
runtimeSnapshot:
|
|
3419
|
-
actions:
|
|
3426
|
+
runtimeSnapshot: he,
|
|
3427
|
+
actions: ge,
|
|
3420
3428
|
__render: {
|
|
3421
3429
|
messages: r,
|
|
3422
3430
|
effectiveEditable: o,
|
|
3423
|
-
tableFocusState:
|
|
3431
|
+
tableFocusState: ne,
|
|
3424
3432
|
tableInteractionState: y,
|
|
3425
3433
|
codeBlockState: M,
|
|
3426
|
-
isCodeBlockActive:
|
|
3434
|
+
isCodeBlockActive: I,
|
|
3427
3435
|
mermaidMode: _,
|
|
3428
3436
|
mathTarget: v,
|
|
3429
3437
|
setMermaidMode: (e) => {
|
|
3430
3438
|
_.value = e;
|
|
3431
3439
|
},
|
|
3432
|
-
tocState:
|
|
3433
|
-
filteredSlashCommands:
|
|
3440
|
+
tocState: ce,
|
|
3441
|
+
filteredSlashCommands: me,
|
|
3434
3442
|
slashState: d,
|
|
3435
3443
|
slashMenuPosition: h,
|
|
3436
3444
|
slashInputCommand: g,
|
|
@@ -3442,7 +3450,7 @@ function Er(e = {}) {
|
|
|
3442
3450
|
}
|
|
3443
3451
|
};
|
|
3444
3452
|
}
|
|
3445
|
-
var
|
|
3453
|
+
var kr = J({
|
|
3446
3454
|
name: "MarkweaveEditor",
|
|
3447
3455
|
props: {
|
|
3448
3456
|
defaultContent: {
|
|
@@ -3473,6 +3481,10 @@ var Dr = J({
|
|
|
3473
3481
|
type: Boolean,
|
|
3474
3482
|
default: !0
|
|
3475
3483
|
},
|
|
3484
|
+
innerTocPlacement: {
|
|
3485
|
+
type: String,
|
|
3486
|
+
default: "container"
|
|
3487
|
+
},
|
|
3476
3488
|
autofocus: {
|
|
3477
3489
|
type: Boolean,
|
|
3478
3490
|
default: !1
|
|
@@ -3531,26 +3543,27 @@ var Dr = J({
|
|
|
3531
3543
|
}
|
|
3532
3544
|
},
|
|
3533
3545
|
setup(e) {
|
|
3534
|
-
let t =
|
|
3546
|
+
let t = Or(e);
|
|
3535
3547
|
return () => {
|
|
3536
3548
|
let n = t.editor.value;
|
|
3537
3549
|
if (!n) return null;
|
|
3538
3550
|
let i = t.__render;
|
|
3539
|
-
return
|
|
3551
|
+
return B("section", {
|
|
3540
3552
|
class: ["markweave-editor-frame", e.className].filter(Boolean).join(" "),
|
|
3541
3553
|
"aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
|
|
3542
3554
|
"data-testid": "markweave-editor-frame",
|
|
3543
3555
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
3544
3556
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
3557
|
+
"data-markweave-inner-toc-placement": me(e.innerTocPlacement),
|
|
3545
3558
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
3546
3559
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
3547
3560
|
onKeydownCapture: i.handleEditorKeyDown
|
|
3548
3561
|
}, [
|
|
3549
|
-
i.effectiveEditable.value ?
|
|
3562
|
+
i.effectiveEditable.value ? B(xr, {
|
|
3550
3563
|
editor: n,
|
|
3551
3564
|
messages: i.messages
|
|
3552
3565
|
}) : null,
|
|
3553
|
-
i.effectiveEditable.value ?
|
|
3566
|
+
i.effectiveEditable.value ? B(Cr, {
|
|
3554
3567
|
commands: i.filteredSlashCommands.value,
|
|
3555
3568
|
state: i.slashState.value,
|
|
3556
3569
|
position: i.slashMenuPosition.value,
|
|
@@ -3560,7 +3573,7 @@ var Dr = J({
|
|
|
3560
3573
|
onInputCommandChange: i.setSlashInputCommand,
|
|
3561
3574
|
onUpload: e.onSlashCommandUpload
|
|
3562
3575
|
}) : null,
|
|
3563
|
-
i.effectiveEditable.value ?
|
|
3576
|
+
i.effectiveEditable.value ? B(wr, {
|
|
3564
3577
|
editor: n,
|
|
3565
3578
|
active: i.tableFocusState.value.active,
|
|
3566
3579
|
interactionState: i.tableInteractionState.value,
|
|
@@ -3569,11 +3582,11 @@ var Dr = J({
|
|
|
3569
3582
|
onCommandResult: e.onTableCommandResult,
|
|
3570
3583
|
onEditWithAi: e.onEditWithAi
|
|
3571
3584
|
}) : null,
|
|
3572
|
-
i.effectiveEditable.value ?
|
|
3585
|
+
i.effectiveEditable.value ? B(Tr, {
|
|
3573
3586
|
editor: n,
|
|
3574
3587
|
focusState: i.tableFocusState.value
|
|
3575
3588
|
}) : null,
|
|
3576
|
-
|
|
3589
|
+
B(Er, {
|
|
3577
3590
|
editor: n,
|
|
3578
3591
|
state: i.codeBlockState.value,
|
|
3579
3592
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -3581,22 +3594,23 @@ var Dr = J({
|
|
|
3581
3594
|
onMermaidModeChange: i.setMermaidMode,
|
|
3582
3595
|
readOnly: !i.effectiveEditable.value
|
|
3583
3596
|
}),
|
|
3584
|
-
e.innerToc && i.tocState.value.items.length ?
|
|
3597
|
+
e.innerToc && i.tocState.value.items.length ? B(Dr, {
|
|
3585
3598
|
editor: n,
|
|
3586
3599
|
state: i.tocState.value,
|
|
3587
3600
|
messages: i.messages,
|
|
3588
|
-
editable: i.effectiveEditable.value
|
|
3601
|
+
editable: i.effectiveEditable.value,
|
|
3602
|
+
placement: me(e.innerTocPlacement)
|
|
3589
3603
|
}) : null,
|
|
3590
|
-
i.effectiveEditable.value && i.mathTarget.value ?
|
|
3604
|
+
i.effectiveEditable.value && i.mathTarget.value ? B(Sr, {
|
|
3591
3605
|
editor: n,
|
|
3592
3606
|
messages: i.messages,
|
|
3593
3607
|
target: i.mathTarget.value,
|
|
3594
3608
|
onClose: () => i.mathTarget.value = null
|
|
3595
3609
|
}) : null,
|
|
3596
|
-
|
|
3610
|
+
B(r, { editor: n })
|
|
3597
3611
|
]);
|
|
3598
3612
|
};
|
|
3599
3613
|
}
|
|
3600
3614
|
});
|
|
3601
3615
|
//#endregion
|
|
3602
|
-
export {
|
|
3616
|
+
export { kr as MarkweaveEditor, lr as createMarkweaveEditorExtensions, lr as createMarkweaveVue2EditorExtensions, Or as useMarkweaveEditorController };
|