@markweave/vue2 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +811 -606
- package/dist/types/MarkweaveEditor.d.ts +4 -0
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/create-editor-extensions.d.ts +4 -2
- package/dist/types/create-editor-extensions.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/media-nodeviews.d.ts +7 -0
- package/dist/types/media-nodeviews.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,54 +1,58 @@
|
|
|
1
1
|
import { createMarkweaveEditorExtensions as e } from "markweave/internal/editor-core/create-editor-extensions";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
2
|
+
import { getLocalizedSlashCommandSpecs as t, getMarkweaveMessages as n, normalizeMarkweaveLang as r } from "markweave/internal/i18n";
|
|
3
|
+
import { createMarkweaveAdapterMediaExtensions as i } from "markweave/internal/plugins/media/media-extension-factory";
|
|
4
|
+
import { Editor as a, EditorContent as o, NodeViewWrapper as s, VueNodeViewRenderer as c } from "@tiptap/vue-2";
|
|
5
|
+
import * as l from "vue";
|
|
6
|
+
import { getMarkweaveEditorModeState as u, isMarkweaveEditorLiveEditable as d, normalizeMarkweaveEditorMode as f, setMarkweaveEditorModeState as p, subscribeToMarkweaveEditorMode as m } from "markweave/internal/core/editor-mode-state";
|
|
7
|
+
import { MarkweaveLinkCard as h } from "markweave/internal/plugins/link-card/link-card-node";
|
|
8
|
+
import { openMarkweaveLinkCardComposer as g } from "markweave/internal/plugins/link-card/link-card-composer";
|
|
9
|
+
import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as v, replaceMarkweaveLinkCardWithLink as y } from "markweave/internal/plugins/link-card/link-card";
|
|
10
|
+
import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
|
|
11
|
+
import { MarkweaveCoreImage as x, MarkweaveCoreVideo as S, attrsFromMarkweaveImageUploadResult as C, attrsFromMarkweaveVideoUploadResult as w, attrsFromMarkweaveVideoUrl as T, clampMarkweaveImageWidth as E, createMarkweaveImageUploadRequest as ee, createMarkweaveVideoUploadRequest as D, downloadMarkweaveImage as O, markweaveVideoIframeAllow as k, normalizeMarkweaveCoreImageAlign as A, normalizeMarkweaveVideoEmbedUrl as j, numberAttribute as M, stringAttribute as N } from "markweave/internal/plugins/media/core-media-nodes";
|
|
12
|
+
import { detectUploadSource as P, getDirectUploadResult as te, resolveMarkweaveUploadResult as F } from "markweave/internal/plugins/slash-command/upload";
|
|
13
|
+
import { BubbleMenu as I } from "@tiptap/vue-2/menus";
|
|
14
|
+
import { isEditorComposing as L } from "markweave/internal/editor-core/composition-guard";
|
|
15
|
+
import { createMarkweaveFrameScheduler as R } from "markweave/internal/editor-core/frame-scheduler";
|
|
16
|
+
import { createMarkweaveEditorUpdatePayload as ne, getMarkweaveContentType as re, isEditorContentCurrent as ie, isMarkweaveControlledContentEchoCurrent as ae, normalizeMarkweaveContentFormat as oe } from "markweave/internal/editor-core/editor-content";
|
|
17
|
+
import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightColorOptions as ce, getFloatingToolbarMoreActions as le, getFloatingToolbarTextColorOptions as z, getFloatingToolbarTurnIntoOptions as ue, runFloatingToolbarMoreAction as de, setFloatingToolbarTurnInto as fe } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
18
|
+
import { openMarkweaveReadonlyLinkFromEvent as pe } from "markweave/internal/editor-core/readonly-link";
|
|
19
|
+
import { createMarkweaveEditorRuntimeSnapshot as me } from "markweave/internal/editor-core/runtime-snapshot";
|
|
20
|
+
import { areEditorSelectionSnapshotsEquivalent as he, calculateFloatingToolbarPopoverPlacement as ge, createSelectionSnapshot as _e, markweaveRuntimeProjectionDelayMs as ve, shouldShowFloatingToolbar as ye } from "markweave/internal/editor-core/selection-state";
|
|
21
|
+
import { normalizeMarkweaveTheme as be } from "markweave/internal/core/theme";
|
|
22
|
+
import { createMarkweaveTocState as xe, emptyMarkweaveTocState as Se, getActiveMarkweaveTocId as Ce, getMarkweaveTocItems as we, getValidMarkweaveTocActiveId as Te, normalizeMarkweaveInnerTocPlacement as Ee, observeMarkweaveInnerTocContainerPosition as De, scrollToMarkweaveTocItem as Oe } from "markweave/internal/core/toc-state";
|
|
23
|
+
import { codeBlockCollapsePluginKey as ke, copyActiveCodeBlock as Ae, getActiveCodeBlockState as je, getCodeBlockCopyFeedbackSnapshot as Me, markweaveCodeBlockBehavior as Ne, setCodeBlockCollapsedAtPosition as Pe, setCodeBlockLanguageAtPosition as Fe, setCodeBlockMermaidPreviewModeAtPosition as Ie } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
24
|
+
import { calculateCodeBlockLanguageMenuPosition as Le, clampFullscreenScale as Re, codeBlockCopyFeedbackTimeoutMs as ze, copyCodeBlockText as Be, createCodeBlockOverlayPosition as Ve, createMermaidFullscreenViewerState as He, createMermaidTabPosition as Ue, focusCodeBlockTarget as We, formatCodeBlockLanguageLabel as Ge, formatFullscreenZoom as Ke, getActiveCodeBlockElement as qe, getAnchoredRect as Je, getCodeBlockLanguageItems as Ye, getCodeBlockPositionFromEventTarget as Xe, getCodeBlockStateAtPosition as Ze, getFrameElement as Qe, getMermaidCodeBlockTargets as $e, getMermaidSvgMarkup as et, isCodeBlockTargetCollapsed as tt, mergeStableMermaidTabPositions as nt, mermaidFullscreenZoomStep as rt, moveMermaidFullscreenViewer as it } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
25
|
+
import { normalizeMarkdownLinkHref as at } from "markweave/internal/plugins/markdown/markdown-input";
|
|
26
|
+
import { applyMarkweaveMathLatex as ot, calculateMarkweaveMathPopoverPosition as st, getMarkweaveMathAnchorRect as ct, getMarkweaveMathBlockIndex as lt, getMarkweaveMathRenderedHtml as ut, getMarkweaveMathTargetAtPos as dt, getMarkweaveMathTargetFromDomEvent as ft, getMarkweaveMathTargetFromSelection as pt, renderMarkweaveMathPreview as mt, setMarkweaveMathEditingDomState as ht, setMarkweaveMathEditingDomStateInView as gt, setMarkweaveMathSelectionInView as _t } from "markweave/internal/plugins/math/math-ui-model";
|
|
27
|
+
import { isMermaidInlinePreviewTransaction as vt, setMarkweaveMermaidTheme as yt, setMermaidInlinePreviewEditorMode as bt, setReadonlyMermaidPreviewMode as xt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
28
|
+
import { getMermaidPreviewState as St } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
29
|
+
import { filterSlashCommands as Ct, isExecutableSlashCommand as wt } from "markweave/internal/plugins/slash-command/command-spec";
|
|
30
|
+
import { getSlashCommandKeyboardAction as Tt } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
31
|
+
import { executeSlashCommand as Et, getNextSlashCommandState as Dt, getSlashCommandAnchoredMenuPosition as Ot, getSlashCommandContext as kt } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
32
|
+
import { initialSlashCommandState as At, reduceSlashCommandState as jt } from "markweave/internal/plugins/slash-command/slash-state";
|
|
33
|
+
import { setMarkweaveTableMenuAxisTarget as Mt } from "markweave/internal/plugins/table/table-clipboard";
|
|
34
|
+
import { getFirstTableDebugSnapshot as Nt } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
35
|
+
import { focusFirstTableBodyCell as Pt } from "markweave/internal/plugins/table/table-focus-position";
|
|
36
|
+
import { getTableFocusState as Ft } from "markweave/internal/plugins/table/table-focus-state";
|
|
37
|
+
import { getTableSelectionOverlayState as It, initialTableInteractionState as Lt, tableInteractionPluginKey as Rt } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
38
|
+
import { calculateAnchoredTableMenuPosition as zt, calculateTableEdgeHandlePosition as Bt, canRunTableCommand as Vt, executeTableMenuCommand as Ht, formatTableCopyFeedback as Ut, getActiveTableElement as Wt, getAvailableCellMenuCommandSpecs as Gt, getTableAxisTargetRect as Kt, getTableControlAxisSelectionModel as qt, getTableEditWithAiRequest as Jt, getTableMenuItemGroup as Yt, getTableMenuItemLabel as Xt, getTableMenuItems as Zt, getTableSelectionTargetRect as Qt, measureTableSelectionOverlay as $t, selectTableAxisFromCell as en, tableCopyFeedbackTimeoutMs as tn, tableMenuLabel as nn } from "markweave/internal/plugins/table/table-ui-model";
|
|
35
39
|
//#region src/vue2-compat.ts
|
|
36
|
-
var
|
|
37
|
-
function
|
|
40
|
+
var rn = l.default ?? l, an = null, on = null, sn = null;
|
|
41
|
+
function cn(e) {
|
|
38
42
|
return !!(e && typeof e == "object" && "value" in e);
|
|
39
43
|
}
|
|
40
|
-
function
|
|
44
|
+
function ln(e) {
|
|
41
45
|
let t = e.slice(2);
|
|
42
46
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
43
47
|
}
|
|
44
|
-
function
|
|
48
|
+
function un(e) {
|
|
45
49
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
46
50
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
47
51
|
if (o === "class" || o === "style" || o === "key") {
|
|
48
52
|
t[o] = s;
|
|
49
53
|
continue;
|
|
50
54
|
}
|
|
51
|
-
if (o === "ref" &&
|
|
55
|
+
if (o === "ref" && cn(s)) {
|
|
52
56
|
a.insert = (e) => {
|
|
53
57
|
s.value = e.elm;
|
|
54
58
|
}, a.destroy = () => {
|
|
@@ -57,7 +61,7 @@ function nn(e) {
|
|
|
57
61
|
continue;
|
|
58
62
|
}
|
|
59
63
|
if (/^on[A-Z]/.test(o)) {
|
|
60
|
-
i[
|
|
64
|
+
i[ln(o)] = s;
|
|
61
65
|
continue;
|
|
62
66
|
}
|
|
63
67
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -68,14 +72,14 @@ function nn(e) {
|
|
|
68
72
|
}
|
|
69
73
|
return Object.keys(n).length && (t.attrs = n), Object.keys(r).length && (t.domProps = r), Object.keys(i).length && (t.on = i), Object.keys(a).length && (t.hook = a), t;
|
|
70
74
|
}
|
|
71
|
-
function
|
|
75
|
+
function dn(e) {
|
|
72
76
|
let t = {}, n = {}, r = {}, i = {};
|
|
73
77
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
74
78
|
if (a === "class" || a === "style" || a === "key") {
|
|
75
79
|
t[a] = o;
|
|
76
80
|
continue;
|
|
77
81
|
}
|
|
78
|
-
if (a === "ref" &&
|
|
82
|
+
if (a === "ref" && cn(o)) {
|
|
79
83
|
i.insert = (e) => {
|
|
80
84
|
o.value = e.componentInstance ?? e.elm;
|
|
81
85
|
}, i.destroy = () => {
|
|
@@ -91,25 +95,25 @@ function rn(e) {
|
|
|
91
95
|
}
|
|
92
96
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
93
97
|
}
|
|
94
|
-
function
|
|
98
|
+
function fn(e) {
|
|
95
99
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
96
100
|
}
|
|
97
|
-
function
|
|
101
|
+
function pn(e) {
|
|
98
102
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
99
103
|
}
|
|
100
|
-
function
|
|
104
|
+
function mn(e) {
|
|
101
105
|
return e == null || Array.isArray(e) ? e : [e];
|
|
102
106
|
}
|
|
103
|
-
function
|
|
104
|
-
return typeof e == "function" ?
|
|
107
|
+
function hn(e) {
|
|
108
|
+
return typeof e == "function" ? mn(e()) : fn(e) ? mn(e.default()) : pn(e) ? [e] : e;
|
|
105
109
|
}
|
|
106
110
|
function B(e, t, n) {
|
|
107
|
-
if (
|
|
108
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
109
|
-
return
|
|
111
|
+
if (!sn) throw Error("Vue 2 render context is not available.");
|
|
112
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? un(r) : dn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : hn(n);
|
|
113
|
+
return sn(e, i, a);
|
|
110
114
|
}
|
|
111
115
|
function V(e) {
|
|
112
|
-
return
|
|
116
|
+
return rn.observable({ value: e });
|
|
113
117
|
}
|
|
114
118
|
var H = V;
|
|
115
119
|
function U(e) {
|
|
@@ -119,19 +123,19 @@ function U(e) {
|
|
|
119
123
|
}
|
|
120
124
|
function W(e, t, n) {
|
|
121
125
|
let r = typeof e == "function" ? e : () => e.value;
|
|
122
|
-
return
|
|
126
|
+
return an?.$watch ? an.$watch(r, t, n) : () => void 0;
|
|
123
127
|
}
|
|
124
128
|
function G(e) {
|
|
125
|
-
|
|
129
|
+
on?.mounted.push(e);
|
|
126
130
|
}
|
|
127
131
|
function K(e) {
|
|
128
|
-
|
|
132
|
+
on?.beforeUnmount.push(e);
|
|
129
133
|
}
|
|
130
134
|
function q(e) {
|
|
131
|
-
return
|
|
135
|
+
return rn.nextTick(e);
|
|
132
136
|
}
|
|
133
137
|
function J(e) {
|
|
134
|
-
return
|
|
138
|
+
return rn.extend({
|
|
135
139
|
name: e.name,
|
|
136
140
|
props: e.props,
|
|
137
141
|
created() {
|
|
@@ -139,12 +143,12 @@ function J(e) {
|
|
|
139
143
|
mounted: [],
|
|
140
144
|
beforeUnmount: []
|
|
141
145
|
};
|
|
142
|
-
|
|
146
|
+
an = this, on = t;
|
|
143
147
|
try {
|
|
144
148
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
145
149
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
146
150
|
} finally {
|
|
147
|
-
|
|
151
|
+
an = null, on = null;
|
|
148
152
|
}
|
|
149
153
|
},
|
|
150
154
|
mounted() {
|
|
@@ -154,19 +158,19 @@ function J(e) {
|
|
|
154
158
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
155
159
|
},
|
|
156
160
|
render(t) {
|
|
157
|
-
|
|
161
|
+
sn = t;
|
|
158
162
|
try {
|
|
159
163
|
let n = this.__markweaveVue2Render;
|
|
160
164
|
return n ? n() : e.render?.(t) ?? null;
|
|
161
165
|
} finally {
|
|
162
|
-
|
|
166
|
+
sn = null;
|
|
163
167
|
}
|
|
164
168
|
}
|
|
165
169
|
});
|
|
166
170
|
}
|
|
167
171
|
//#endregion
|
|
168
172
|
//#region src/vue2-icons.ts
|
|
169
|
-
var
|
|
173
|
+
var gn = {
|
|
170
174
|
AlignCenter: {
|
|
171
175
|
iconName: "text-align-center",
|
|
172
176
|
node: [
|
|
@@ -1031,7 +1035,7 @@ var ln = {
|
|
|
1031
1035
|
}]]
|
|
1032
1036
|
}
|
|
1033
1037
|
};
|
|
1034
|
-
function
|
|
1038
|
+
function _n(e) {
|
|
1035
1039
|
return e.map(([e, t]) => B(e, t));
|
|
1036
1040
|
}
|
|
1037
1041
|
function Y(e) {
|
|
@@ -1052,7 +1056,7 @@ function Y(e) {
|
|
|
1052
1056
|
}
|
|
1053
1057
|
},
|
|
1054
1058
|
setup(t) {
|
|
1055
|
-
let n =
|
|
1059
|
+
let n = gn[e];
|
|
1056
1060
|
return () => B("svg", {
|
|
1057
1061
|
class: `lucide lucide-${n.iconName}`,
|
|
1058
1062
|
viewBox: "0 0 24 24",
|
|
@@ -1065,14 +1069,12 @@ function Y(e) {
|
|
|
1065
1069
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1066
1070
|
"aria-hidden": "true",
|
|
1067
1071
|
focusable: "false"
|
|
1068
|
-
},
|
|
1072
|
+
}, _n(n.node));
|
|
1069
1073
|
}
|
|
1070
1074
|
});
|
|
1071
1075
|
}
|
|
1072
|
-
var
|
|
1073
|
-
|
|
1074
|
-
var Gn = Y("Quote"), Kn = Y("Replace"), qn = Y("Sigma"), Jn = Y("SmilePlus"), Yn = Y("Strikethrough"), Xn = Y("Subscript"), Zn = Y("Superscript"), Qn = Y("Table2"), $n = Y("Text"), er = Y("Trash2"), tr = Y("Type"), nr = Y("Underline"), rr = Y("Upload"), ir = Y("Video"), ar = E;
|
|
1075
|
-
function or(e) {
|
|
1076
|
+
var vn = Y("AlignCenter"), yn = Y("AlignJustify"), bn = Y("AlignLeft"), xn = Y("AlignRight"), Sn = Y("AlertTriangle"), Cn = Y("Bold"), wn = Y("Braces"), Tn = Y("Captions"), En = Y("CheckCircle2"), Dn = Y("ChevronDown"), On = Y("ChevronUp"), kn = Y("CircleX"), An = Y("Code2"), jn = Y("CornerDownLeft"), Mn = Y("Download"), Nn = Y("Eye"), Pn = Y("ExternalLink"), Fn = Y("Heading1"), In = Y("Heading2"), Ln = Y("Heading3"), Rn = Y("Image"), zn = Y("ImageUp"), Bn = Y("IndentDecrease"), Vn = Y("IndentIncrease"), Hn = Y("Info"), Un = Y("Italic"), Wn = Y("Lightbulb"), Gn = Y("Link2"), Kn = Y("List"), qn = Y("ListChecks"), Jn = Y("ListOrdered"), Yn = Y("Minus"), Xn = Y("MoreVertical"), Zn = Y("Paperclip"), Qn = Y("PencilLine"), $n = Y("Quote"), er = Y("Replace"), tr = Y("Sigma"), nr = Y("SmilePlus"), rr = Y("Strikethrough"), ir = Y("Subscript"), ar = Y("Superscript"), or = Y("Table2"), sr = Y("Text"), cr = Y("Trash2"), lr = Y("Type"), ur = Y("Underline"), dr = Y("Upload"), fr = Y("Video"), pr = A;
|
|
1077
|
+
function mr(e) {
|
|
1076
1078
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1077
1079
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1078
1080
|
return n === "view" ? {
|
|
@@ -1081,8 +1083,8 @@ function or(e) {
|
|
|
1081
1083
|
} : n === "live" ? {
|
|
1082
1084
|
mode: "live",
|
|
1083
1085
|
editable: e.isEditable
|
|
1084
|
-
} :
|
|
1085
|
-
}, r = V(n()), i =
|
|
1086
|
+
} : u(e);
|
|
1087
|
+
}, r = V(n()), i = m(e, () => {
|
|
1086
1088
|
r.value = n();
|
|
1087
1089
|
}), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
|
|
1088
1090
|
r.value = n();
|
|
@@ -1094,13 +1096,16 @@ function or(e) {
|
|
|
1094
1096
|
i(), a?.disconnect();
|
|
1095
1097
|
}), r;
|
|
1096
1098
|
}
|
|
1097
|
-
function
|
|
1099
|
+
function hr(e) {
|
|
1098
1100
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1099
1101
|
}
|
|
1100
|
-
function
|
|
1102
|
+
function gr(e) {
|
|
1101
1103
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1102
1104
|
}
|
|
1103
|
-
function
|
|
1105
|
+
function _r(e) {
|
|
1106
|
+
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1107
|
+
}
|
|
1108
|
+
function vr(e, t) {
|
|
1104
1109
|
return B(e, {
|
|
1105
1110
|
size: 18,
|
|
1106
1111
|
strokeWidth: 1.8,
|
|
@@ -1116,12 +1121,12 @@ function X(e) {
|
|
|
1116
1121
|
"data-active": e.active ? "true" : "false",
|
|
1117
1122
|
onMousedown: (e) => e.preventDefault(),
|
|
1118
1123
|
onClick: e.onClick
|
|
1119
|
-
}, [
|
|
1124
|
+
}, [vr(e.icon, e.label), B("span", {
|
|
1120
1125
|
class: "markweave-image-tooltip",
|
|
1121
1126
|
role: "tooltip"
|
|
1122
1127
|
}, e.label)]);
|
|
1123
1128
|
}
|
|
1124
|
-
function
|
|
1129
|
+
function yr(e) {
|
|
1125
1130
|
let t = V(null), n = e.messages.image;
|
|
1126
1131
|
return B("section", {
|
|
1127
1132
|
class: "markweave-image-upload-placeholder",
|
|
@@ -1155,7 +1160,7 @@ function ur(e) {
|
|
|
1155
1160
|
B("div", {
|
|
1156
1161
|
class: "markweave-image-upload-icon",
|
|
1157
1162
|
"aria-hidden": "true"
|
|
1158
|
-
}, [B(
|
|
1163
|
+
}, [B(zn, {
|
|
1159
1164
|
size: 46,
|
|
1160
1165
|
strokeWidth: 1.6
|
|
1161
1166
|
})]),
|
|
@@ -1180,7 +1185,7 @@ function ur(e) {
|
|
|
1180
1185
|
"data-testid": "markweave-image-upload-submit",
|
|
1181
1186
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1182
1187
|
onClick: e.onSubmit
|
|
1183
|
-
}, [B(
|
|
1188
|
+
}, [B(zn, {
|
|
1184
1189
|
size: 16,
|
|
1185
1190
|
strokeWidth: 1.8
|
|
1186
1191
|
}), e.messages.common.insert]),
|
|
@@ -1196,7 +1201,7 @@ function ur(e) {
|
|
|
1196
1201
|
}, e.error) : null
|
|
1197
1202
|
]);
|
|
1198
1203
|
}
|
|
1199
|
-
function
|
|
1204
|
+
function br(e) {
|
|
1200
1205
|
let t = V(null), n = e.messages.video;
|
|
1201
1206
|
return B("section", {
|
|
1202
1207
|
class: "markweave-video-upload-placeholder",
|
|
@@ -1230,7 +1235,7 @@ function dr(e) {
|
|
|
1230
1235
|
B("div", {
|
|
1231
1236
|
class: "markweave-video-upload-icon",
|
|
1232
1237
|
"aria-hidden": "true"
|
|
1233
|
-
}, [B(
|
|
1238
|
+
}, [B(fr, {
|
|
1234
1239
|
size: 46,
|
|
1235
1240
|
strokeWidth: 1.6
|
|
1236
1241
|
})]),
|
|
@@ -1255,7 +1260,7 @@ function dr(e) {
|
|
|
1255
1260
|
"data-testid": "markweave-video-upload-submit",
|
|
1256
1261
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1257
1262
|
onClick: e.onSubmit
|
|
1258
|
-
}, [B(
|
|
1263
|
+
}, [B(dr, {
|
|
1259
1264
|
size: 16,
|
|
1260
1265
|
strokeWidth: 1.8
|
|
1261
1266
|
}), e.messages.common.insert]),
|
|
@@ -1271,7 +1276,7 @@ function dr(e) {
|
|
|
1271
1276
|
}, e.error) : null
|
|
1272
1277
|
]);
|
|
1273
1278
|
}
|
|
1274
|
-
var
|
|
1279
|
+
var xr = J({
|
|
1275
1280
|
name: "MarkweaveVueImageNodeView",
|
|
1276
1281
|
props: {
|
|
1277
1282
|
editor: {
|
|
@@ -1304,137 +1309,137 @@ var fr = J({
|
|
|
1304
1309
|
}
|
|
1305
1310
|
},
|
|
1306
1311
|
setup(e) {
|
|
1307
|
-
let t = V(null),
|
|
1308
|
-
|
|
1309
|
-
src:
|
|
1310
|
-
alt:
|
|
1312
|
+
let t = V(null), r = V(!1), i = V(!1), a = V(!1), o = V(""), c = V(null), l = V(!1), u = U(() => e.node.attrs), f = V(!!N(u.value.caption)), p = V(N(u.value.caption) ?? ""), m = mr(e.editor), h = U(() => d(m.value)), g = U(() => e.extension.options?.messages ?? n("zh")), _ = U(() => g.value.image), v = U(() => N(u.value.src)), y = U(() => pr(u.value.align)), x = U(() => M(u.value.width)), S = U(() => N(u.value.caption)), w = U(() => h.value && (!v.value || i.value)), T = () => {
|
|
1313
|
+
v.value && b({
|
|
1314
|
+
src: v.value,
|
|
1315
|
+
alt: N(u.value.alt) ?? "",
|
|
1311
1316
|
messages: {
|
|
1312
|
-
dialogAriaLabel:
|
|
1313
|
-
zoomOut:
|
|
1314
|
-
zoomIn:
|
|
1315
|
-
reset:
|
|
1316
|
-
close:
|
|
1317
|
+
dialogAriaLabel: _.value.previewDialogAriaLabel,
|
|
1318
|
+
zoomOut: _.value.previewZoomOut,
|
|
1319
|
+
zoomIn: _.value.previewZoomIn,
|
|
1320
|
+
reset: _.value.previewReset,
|
|
1321
|
+
close: _.value.previewClose
|
|
1317
1322
|
}
|
|
1318
1323
|
});
|
|
1319
1324
|
};
|
|
1320
|
-
W(
|
|
1321
|
-
|
|
1325
|
+
W(S, (e) => {
|
|
1326
|
+
f.value || (p.value = e ?? "");
|
|
1322
1327
|
});
|
|
1323
|
-
let
|
|
1324
|
-
if (!
|
|
1328
|
+
let D = () => {
|
|
1329
|
+
if (!h.value) return;
|
|
1325
1330
|
let t = e.getPos();
|
|
1326
1331
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1327
|
-
},
|
|
1328
|
-
if (o.value = "",
|
|
1329
|
-
|
|
1332
|
+
}, k = () => {
|
|
1333
|
+
if (o.value = "", c.value = null, a.value = !1, v.value) {
|
|
1334
|
+
i.value = !1;
|
|
1330
1335
|
return;
|
|
1331
1336
|
}
|
|
1332
1337
|
e.deleteNode();
|
|
1333
|
-
},
|
|
1334
|
-
if (!
|
|
1338
|
+
}, A = async (t) => {
|
|
1339
|
+
if (!h.value) return;
|
|
1335
1340
|
let n = e.extension.options;
|
|
1336
|
-
l.value = !0,
|
|
1341
|
+
l.value = !0, c.value = null;
|
|
1337
1342
|
try {
|
|
1338
|
-
let
|
|
1339
|
-
e.updateAttributes(
|
|
1343
|
+
let r = await F(ee(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1344
|
+
e.updateAttributes(C(u.value, r)), o.value = "", i.value = !1;
|
|
1340
1345
|
} catch (e) {
|
|
1341
|
-
|
|
1346
|
+
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
1342
1347
|
} finally {
|
|
1343
1348
|
l.value = !1, a.value = !1;
|
|
1344
1349
|
}
|
|
1345
|
-
},
|
|
1350
|
+
}, j = () => {
|
|
1346
1351
|
if (!o.value.trim()) {
|
|
1347
|
-
|
|
1352
|
+
c.value = _.value.uploadRequiredError;
|
|
1348
1353
|
return;
|
|
1349
1354
|
}
|
|
1350
|
-
P(
|
|
1351
|
-
},
|
|
1352
|
-
|
|
1355
|
+
A(P(o.value));
|
|
1356
|
+
}, te = (e) => {
|
|
1357
|
+
A({
|
|
1353
1358
|
type: "file",
|
|
1354
1359
|
file: e,
|
|
1355
1360
|
mimeType: e.type || "image/*"
|
|
1356
1361
|
});
|
|
1357
|
-
},
|
|
1358
|
-
|
|
1359
|
-
},
|
|
1360
|
-
if (!
|
|
1361
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1362
|
+
}, I = () => {
|
|
1363
|
+
f.value = !f.value, f.value && (p.value = S.value ?? "");
|
|
1364
|
+
}, L = (n, r) => {
|
|
1365
|
+
if (!h.value || !v.value) return;
|
|
1366
|
+
r.preventDefault(), r.stopPropagation(), D();
|
|
1362
1367
|
let i = t.value;
|
|
1363
1368
|
if (!i) return;
|
|
1364
|
-
let a = r.clientX, o = i.getBoundingClientRect().width ||
|
|
1369
|
+
let a = r.clientX, o = i.getBoundingClientRect().width || x.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
|
|
1365
1370
|
let r = n === "right" ? t.clientX - a : a - t.clientX;
|
|
1366
|
-
e.updateAttributes({ width:
|
|
1371
|
+
e.updateAttributes({ width: E(o + r, s) });
|
|
1367
1372
|
}, l = () => {
|
|
1368
1373
|
window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
|
|
1369
1374
|
};
|
|
1370
1375
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1371
1376
|
};
|
|
1372
|
-
return () =>
|
|
1377
|
+
return () => w.value ? B(s, {
|
|
1373
1378
|
as: "figure",
|
|
1374
1379
|
class: "markweave-image-node",
|
|
1375
1380
|
"data-testid": "markweave-image-node",
|
|
1376
|
-
"data-align":
|
|
1381
|
+
"data-align": y.value,
|
|
1377
1382
|
"data-selected": "false",
|
|
1378
1383
|
"data-hovered": "false",
|
|
1379
1384
|
"data-empty": "true"
|
|
1380
|
-
}, () =>
|
|
1381
|
-
messages:
|
|
1385
|
+
}, () => yr({
|
|
1386
|
+
messages: g.value,
|
|
1382
1387
|
inputValue: o.value,
|
|
1383
|
-
error:
|
|
1388
|
+
error: c.value,
|
|
1384
1389
|
dragActive: a.value,
|
|
1385
1390
|
isSubmitting: l.value,
|
|
1386
1391
|
onInputValue: (e) => {
|
|
1387
1392
|
o.value = e;
|
|
1388
1393
|
},
|
|
1389
|
-
onFile:
|
|
1390
|
-
onSubmit:
|
|
1391
|
-
onCancel:
|
|
1394
|
+
onFile: te,
|
|
1395
|
+
onSubmit: j,
|
|
1396
|
+
onCancel: k,
|
|
1392
1397
|
onDragActive: (e) => {
|
|
1393
1398
|
a.value = e;
|
|
1394
1399
|
}
|
|
1395
|
-
})) : B(
|
|
1400
|
+
})) : B(s, {
|
|
1396
1401
|
as: "figure",
|
|
1397
1402
|
class: "markweave-image-node",
|
|
1398
1403
|
"data-testid": "markweave-image-node",
|
|
1399
|
-
"data-align":
|
|
1400
|
-
"data-selected":
|
|
1401
|
-
"data-hovered":
|
|
1404
|
+
"data-align": y.value,
|
|
1405
|
+
"data-selected": h.value && e.selected ? "true" : "false",
|
|
1406
|
+
"data-hovered": r.value ? "true" : "false",
|
|
1402
1407
|
"data-empty": "false",
|
|
1403
1408
|
onMouseenter: () => {
|
|
1404
|
-
|
|
1409
|
+
r.value = !0;
|
|
1405
1410
|
},
|
|
1406
1411
|
onMouseleave: () => {
|
|
1407
|
-
|
|
1412
|
+
r.value = !1;
|
|
1408
1413
|
},
|
|
1409
1414
|
onMousedown: (e) => {
|
|
1410
|
-
|
|
1415
|
+
h.value && !hr(e.target) && D();
|
|
1411
1416
|
}
|
|
1412
1417
|
}, () => [
|
|
1413
|
-
|
|
1418
|
+
h.value ? B("div", {
|
|
1414
1419
|
class: "markweave-image-toolbar",
|
|
1415
1420
|
"data-testid": "markweave-image-toolbar",
|
|
1416
1421
|
"data-markweave-image-ui": "true",
|
|
1417
|
-
"aria-label":
|
|
1422
|
+
"aria-label": _.value.toolsAriaLabel
|
|
1418
1423
|
}, [
|
|
1419
1424
|
X({
|
|
1420
1425
|
testId: "markweave-image-align-left",
|
|
1421
|
-
label:
|
|
1422
|
-
icon:
|
|
1423
|
-
active:
|
|
1426
|
+
label: _.value.alignLeft,
|
|
1427
|
+
icon: bn,
|
|
1428
|
+
active: y.value === "left",
|
|
1424
1429
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1425
1430
|
}),
|
|
1426
1431
|
X({
|
|
1427
1432
|
testId: "markweave-image-align-center",
|
|
1428
|
-
label:
|
|
1429
|
-
icon:
|
|
1430
|
-
active:
|
|
1433
|
+
label: _.value.alignCenter,
|
|
1434
|
+
icon: vn,
|
|
1435
|
+
active: y.value === "center",
|
|
1431
1436
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1432
1437
|
}),
|
|
1433
1438
|
X({
|
|
1434
1439
|
testId: "markweave-image-align-right",
|
|
1435
|
-
label:
|
|
1436
|
-
icon:
|
|
1437
|
-
active:
|
|
1440
|
+
label: _.value.alignRight,
|
|
1441
|
+
icon: xn,
|
|
1442
|
+
active: y.value === "right",
|
|
1438
1443
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1439
1444
|
}),
|
|
1440
1445
|
B("span", {
|
|
@@ -1443,31 +1448,31 @@ var fr = J({
|
|
|
1443
1448
|
}),
|
|
1444
1449
|
X({
|
|
1445
1450
|
testId: "markweave-image-caption",
|
|
1446
|
-
label:
|
|
1447
|
-
icon:
|
|
1448
|
-
active:
|
|
1449
|
-
onClick:
|
|
1451
|
+
label: _.value.caption,
|
|
1452
|
+
icon: Tn,
|
|
1453
|
+
active: f.value || !!S.value,
|
|
1454
|
+
onClick: I
|
|
1450
1455
|
}),
|
|
1451
1456
|
X({
|
|
1452
1457
|
testId: "markweave-image-preview",
|
|
1453
|
-
label:
|
|
1454
|
-
icon:
|
|
1455
|
-
onClick:
|
|
1458
|
+
label: _.value.preview,
|
|
1459
|
+
icon: Nn,
|
|
1460
|
+
onClick: T
|
|
1456
1461
|
}),
|
|
1457
1462
|
X({
|
|
1458
1463
|
testId: "markweave-image-download",
|
|
1459
|
-
label:
|
|
1460
|
-
icon:
|
|
1464
|
+
label: _.value.download,
|
|
1465
|
+
icon: Mn,
|
|
1461
1466
|
onClick: () => {
|
|
1462
|
-
|
|
1467
|
+
v.value && O(v.value);
|
|
1463
1468
|
}
|
|
1464
1469
|
}),
|
|
1465
1470
|
X({
|
|
1466
1471
|
testId: "markweave-image-replace",
|
|
1467
|
-
label:
|
|
1468
|
-
icon:
|
|
1472
|
+
label: _.value.replace,
|
|
1473
|
+
icon: er,
|
|
1469
1474
|
onClick: () => {
|
|
1470
|
-
o.value = "",
|
|
1475
|
+
o.value = "", c.value = null, i.value = !0;
|
|
1471
1476
|
}
|
|
1472
1477
|
}),
|
|
1473
1478
|
B("span", {
|
|
@@ -1476,82 +1481,82 @@ var fr = J({
|
|
|
1476
1481
|
}),
|
|
1477
1482
|
X({
|
|
1478
1483
|
testId: "markweave-image-delete",
|
|
1479
|
-
label:
|
|
1480
|
-
icon:
|
|
1484
|
+
label: _.value.delete,
|
|
1485
|
+
icon: cr,
|
|
1481
1486
|
onClick: () => e.deleteNode()
|
|
1482
1487
|
})
|
|
1483
1488
|
]) : null,
|
|
1484
1489
|
B("div", {
|
|
1485
1490
|
ref: t,
|
|
1486
1491
|
class: "markweave-image-box",
|
|
1487
|
-
style:
|
|
1492
|
+
style: x.value ? { width: `${Math.round(x.value)}px` } : void 0
|
|
1488
1493
|
}, [
|
|
1489
|
-
|
|
1494
|
+
v.value ? B("img", {
|
|
1490
1495
|
class: "markweave-image",
|
|
1491
|
-
src:
|
|
1492
|
-
alt:
|
|
1493
|
-
title:
|
|
1496
|
+
src: v.value,
|
|
1497
|
+
alt: N(u.value.alt) ?? "",
|
|
1498
|
+
title: N(u.value.title) ?? void 0,
|
|
1494
1499
|
draggable: !1
|
|
1495
1500
|
}) : B("div", {
|
|
1496
1501
|
class: "markweave-image-readonly-empty",
|
|
1497
1502
|
"data-testid": "markweave-image-readonly-empty",
|
|
1498
1503
|
"aria-hidden": "true"
|
|
1499
1504
|
}),
|
|
1500
|
-
!
|
|
1505
|
+
!h.value && v.value ? B("button", {
|
|
1501
1506
|
type: "button",
|
|
1502
1507
|
class: "markweave-image-preview-trigger",
|
|
1503
1508
|
"data-testid": "markweave-image-preview",
|
|
1504
1509
|
"data-markweave-image-ui": "true",
|
|
1505
|
-
"aria-label":
|
|
1506
|
-
title:
|
|
1510
|
+
"aria-label": _.value.preview,
|
|
1511
|
+
title: _.value.preview,
|
|
1507
1512
|
onMousedown: (e) => e.preventDefault(),
|
|
1508
|
-
onClick:
|
|
1509
|
-
}, [B(
|
|
1513
|
+
onClick: T
|
|
1514
|
+
}, [B(Nn, {
|
|
1510
1515
|
size: 16,
|
|
1511
1516
|
strokeWidth: 1.8
|
|
1512
1517
|
}), B("span", {
|
|
1513
1518
|
class: "markweave-image-tooltip",
|
|
1514
1519
|
role: "tooltip"
|
|
1515
|
-
},
|
|
1516
|
-
|
|
1520
|
+
}, _.value.preview)]) : null,
|
|
1521
|
+
h.value ? B("button", {
|
|
1517
1522
|
type: "button",
|
|
1518
1523
|
class: "markweave-image-resize-handle",
|
|
1519
1524
|
"data-testid": "markweave-image-resize-left",
|
|
1520
1525
|
"data-side": "left",
|
|
1521
|
-
"aria-label":
|
|
1526
|
+
"aria-label": _.value.resizeLeft,
|
|
1522
1527
|
"data-markweave-image-ui": "true",
|
|
1523
|
-
onPointerdown: (e) =>
|
|
1528
|
+
onPointerdown: (e) => L("left", e)
|
|
1524
1529
|
}) : null,
|
|
1525
|
-
|
|
1530
|
+
h.value ? B("button", {
|
|
1526
1531
|
type: "button",
|
|
1527
1532
|
class: "markweave-image-resize-handle",
|
|
1528
1533
|
"data-testid": "markweave-image-resize-right",
|
|
1529
1534
|
"data-side": "right",
|
|
1530
|
-
"aria-label":
|
|
1535
|
+
"aria-label": _.value.resizeRight,
|
|
1531
1536
|
"data-markweave-image-ui": "true",
|
|
1532
|
-
onPointerdown: (e) =>
|
|
1537
|
+
onPointerdown: (e) => L("right", e)
|
|
1533
1538
|
}) : null
|
|
1534
1539
|
]),
|
|
1535
|
-
|
|
1540
|
+
h.value && (f.value || S.value) ? B("input", {
|
|
1536
1541
|
class: "markweave-image-caption-input",
|
|
1537
1542
|
"data-testid": "markweave-image-caption-input",
|
|
1538
1543
|
"data-markweave-image-ui": "true",
|
|
1539
|
-
value:
|
|
1540
|
-
placeholder:
|
|
1541
|
-
"aria-label":
|
|
1544
|
+
value: p.value,
|
|
1545
|
+
placeholder: _.value.captionPlaceholder,
|
|
1546
|
+
"aria-label": _.value.captionAriaLabel,
|
|
1542
1547
|
onInput: (t) => {
|
|
1543
|
-
|
|
1548
|
+
p.value = t.target.value, e.updateAttributes({ caption: p.value.trim() ? p.value : null });
|
|
1544
1549
|
},
|
|
1545
1550
|
onKeydown: (e) => {
|
|
1546
|
-
e.key === "Escape" && (e.preventDefault(),
|
|
1551
|
+
e.key === "Escape" && (e.preventDefault(), f.value = !1);
|
|
1547
1552
|
}
|
|
1548
|
-
}) :
|
|
1553
|
+
}) : S.value ? B("figcaption", {
|
|
1549
1554
|
class: "markweave-image-caption",
|
|
1550
1555
|
"data-testid": "markweave-image-caption"
|
|
1551
|
-
},
|
|
1556
|
+
}, S.value) : null
|
|
1552
1557
|
]);
|
|
1553
1558
|
}
|
|
1554
|
-
}),
|
|
1559
|
+
}), Sr = J({
|
|
1555
1560
|
name: "MarkweaveVueVideoNodeView",
|
|
1556
1561
|
props: {
|
|
1557
1562
|
editor: {
|
|
@@ -1584,75 +1589,75 @@ var fr = J({
|
|
|
1584
1589
|
}
|
|
1585
1590
|
},
|
|
1586
1591
|
setup(e) {
|
|
1587
|
-
let t = V(!1),
|
|
1588
|
-
|
|
1589
|
-
},
|
|
1590
|
-
if (!
|
|
1592
|
+
let t = V(!1), r = V(""), i = V(null), a = V(!1), o = mr(e.editor), c = U(() => d(o.value)), l = U(() => e.extension.options?.messages ?? n("zh")), u = U(() => l.value.video), f = U(() => e.node.attrs), p = U(() => N(f.value.src)), m = U(() => N(f.value.embedUrl)), h = U(() => N(f.value.provider)), g = U(() => m.value ? j(m.value, h.value) : null), _ = U(() => N(f.value.mimeType)), v = U(() => N(f.value.title)), y = () => {
|
|
1593
|
+
p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
|
|
1594
|
+
}, b = async (n) => {
|
|
1595
|
+
if (!c.value) return;
|
|
1591
1596
|
let o = e.extension.options;
|
|
1592
|
-
a.value = !0,
|
|
1597
|
+
a.value = !0, i.value = null;
|
|
1593
1598
|
try {
|
|
1594
|
-
let t = await
|
|
1595
|
-
e.updateAttributes(
|
|
1599
|
+
let t = await F(D(n), o?.onUpload);
|
|
1600
|
+
e.updateAttributes(w(t)), r.value = "";
|
|
1596
1601
|
} catch (e) {
|
|
1597
|
-
|
|
1602
|
+
i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
1598
1603
|
} finally {
|
|
1599
1604
|
a.value = !1, t.value = !1;
|
|
1600
1605
|
}
|
|
1601
|
-
},
|
|
1602
|
-
if (!
|
|
1603
|
-
let t =
|
|
1606
|
+
}, x = () => {
|
|
1607
|
+
if (!c.value) return;
|
|
1608
|
+
let t = T(r.value);
|
|
1604
1609
|
if (!t) {
|
|
1605
|
-
|
|
1610
|
+
i.value = u.value.unsupportedUrlError;
|
|
1606
1611
|
return;
|
|
1607
1612
|
}
|
|
1608
|
-
|
|
1609
|
-
},
|
|
1610
|
-
|
|
1613
|
+
i.value = null, e.updateAttributes(t), r.value = "";
|
|
1614
|
+
}, S = (e) => {
|
|
1615
|
+
b({
|
|
1611
1616
|
type: "file",
|
|
1612
1617
|
file: e,
|
|
1613
1618
|
mimeType: e.type || "video/*"
|
|
1614
1619
|
});
|
|
1615
|
-
},
|
|
1616
|
-
if (!
|
|
1620
|
+
}, C = () => {
|
|
1621
|
+
if (!c.value) return;
|
|
1617
1622
|
let t = e.getPos();
|
|
1618
1623
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1619
|
-
},
|
|
1620
|
-
|
|
1624
|
+
}, E = (t) => {
|
|
1625
|
+
c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
|
|
1621
1626
|
};
|
|
1622
|
-
return () =>
|
|
1627
|
+
return () => c.value && !p.value ? B(s, {
|
|
1623
1628
|
as: "figure",
|
|
1624
1629
|
class: "markweave-video-node",
|
|
1625
1630
|
"data-testid": "markweave-video-node",
|
|
1626
1631
|
"data-empty": "true",
|
|
1627
1632
|
"data-selected": "false"
|
|
1628
|
-
}, () =>
|
|
1633
|
+
}, () => br({
|
|
1629
1634
|
messages: l.value,
|
|
1630
|
-
inputValue:
|
|
1631
|
-
error:
|
|
1635
|
+
inputValue: r.value,
|
|
1636
|
+
error: i.value,
|
|
1632
1637
|
dragActive: t.value,
|
|
1633
1638
|
isSubmitting: a.value,
|
|
1634
1639
|
onInputValue: (e) => {
|
|
1635
|
-
|
|
1640
|
+
r.value = e;
|
|
1636
1641
|
},
|
|
1637
|
-
onFile:
|
|
1638
|
-
onSubmit:
|
|
1639
|
-
onCancel:
|
|
1642
|
+
onFile: S,
|
|
1643
|
+
onSubmit: x,
|
|
1644
|
+
onCancel: y,
|
|
1640
1645
|
onDragActive: (e) => {
|
|
1641
1646
|
t.value = e;
|
|
1642
1647
|
}
|
|
1643
|
-
})) : B(
|
|
1648
|
+
})) : B(s, {
|
|
1644
1649
|
as: "figure",
|
|
1645
1650
|
class: "markweave-video-node",
|
|
1646
1651
|
"data-testid": "markweave-video-node",
|
|
1647
1652
|
"data-provider": h.value ?? "file",
|
|
1648
|
-
"data-empty":
|
|
1649
|
-
"data-selected":
|
|
1653
|
+
"data-empty": p.value ? "false" : "true",
|
|
1654
|
+
"data-selected": c.value && e.selected ? "true" : "false",
|
|
1650
1655
|
"aria-label": u.value.nodeAriaLabel,
|
|
1651
|
-
tabindex:
|
|
1652
|
-
onFocus:
|
|
1653
|
-
onKeydown:
|
|
1656
|
+
tabindex: c.value ? 0 : void 0,
|
|
1657
|
+
onFocus: C,
|
|
1658
|
+
onKeydown: E,
|
|
1654
1659
|
onMousedown: (e) => {
|
|
1655
|
-
|
|
1660
|
+
c.value && !gr(e.target) && (e.preventDefault(), C());
|
|
1656
1661
|
}
|
|
1657
1662
|
}, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
|
|
1658
1663
|
class: "markweave-video-iframe",
|
|
@@ -1660,25 +1665,25 @@ var fr = J({
|
|
|
1660
1665
|
title: v.value ?? `${h.value ?? "Video"} embed`,
|
|
1661
1666
|
"data-markweave-video-embed": "true",
|
|
1662
1667
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
1663
|
-
"data-markweave-video-src":
|
|
1664
|
-
allow:
|
|
1668
|
+
"data-markweave-video-src": p.value ?? void 0,
|
|
1669
|
+
allow: k,
|
|
1665
1670
|
loading: "lazy",
|
|
1666
1671
|
allowfullscreen: "true"
|
|
1667
|
-
}),
|
|
1672
|
+
}), c.value ? B("button", {
|
|
1668
1673
|
type: "button",
|
|
1669
1674
|
class: "markweave-video-selection-layer",
|
|
1670
1675
|
"data-testid": "markweave-video-selection-layer",
|
|
1671
1676
|
tabindex: -1,
|
|
1672
1677
|
"aria-label": u.value.selectAriaLabel
|
|
1673
|
-
}) : null]) :
|
|
1678
|
+
}) : null]) : p.value ? B("div", { class: "markweave-video-box" }, [B("video", {
|
|
1674
1679
|
class: "markweave-video",
|
|
1675
|
-
src:
|
|
1680
|
+
src: p.value,
|
|
1676
1681
|
title: v.value ?? void 0,
|
|
1677
1682
|
preload: "metadata",
|
|
1678
1683
|
controls: !0,
|
|
1679
1684
|
"data-markweave-video": "true",
|
|
1680
1685
|
"data-markweave-mime-type": _.value ?? void 0
|
|
1681
|
-
}),
|
|
1686
|
+
}), c.value ? B("button", {
|
|
1682
1687
|
type: "button",
|
|
1683
1688
|
class: "markweave-video-selection-layer",
|
|
1684
1689
|
"data-testid": "markweave-video-selection-layer",
|
|
@@ -1690,46 +1695,234 @@ var fr = J({
|
|
|
1690
1695
|
"aria-hidden": "true"
|
|
1691
1696
|
})]);
|
|
1692
1697
|
}
|
|
1693
|
-
}),
|
|
1698
|
+
}), Cr = x.extend({
|
|
1694
1699
|
addOptions() {
|
|
1695
1700
|
return {
|
|
1696
1701
|
...this.parent?.(),
|
|
1697
|
-
messages:
|
|
1702
|
+
messages: n("zh"),
|
|
1698
1703
|
onUpload: void 0
|
|
1699
1704
|
};
|
|
1700
1705
|
},
|
|
1701
1706
|
addNodeView() {
|
|
1702
|
-
return typeof document > "u" ? null :
|
|
1707
|
+
return typeof document > "u" ? null : c(xr, { stopEvent: ({ event: e }) => hr(e.target) });
|
|
1703
1708
|
}
|
|
1704
|
-
}),
|
|
1709
|
+
}), wr = S.extend({
|
|
1705
1710
|
addOptions() {
|
|
1706
1711
|
return {
|
|
1707
1712
|
...this.parent?.(),
|
|
1708
|
-
messages:
|
|
1713
|
+
messages: n("zh"),
|
|
1709
1714
|
onUpload: void 0
|
|
1710
1715
|
};
|
|
1711
1716
|
},
|
|
1712
1717
|
addNodeView() {
|
|
1713
|
-
return typeof document > "u" ? null :
|
|
1718
|
+
return typeof document > "u" ? null : c(Sr, { stopEvent: ({ event: e }) => gr(e.target) });
|
|
1719
|
+
}
|
|
1720
|
+
}), Tr = J({
|
|
1721
|
+
name: "MarkweaveVueLinkCardNodeView",
|
|
1722
|
+
props: {
|
|
1723
|
+
editor: {
|
|
1724
|
+
type: Object,
|
|
1725
|
+
required: !0
|
|
1726
|
+
},
|
|
1727
|
+
extension: {
|
|
1728
|
+
type: Object,
|
|
1729
|
+
required: !0
|
|
1730
|
+
},
|
|
1731
|
+
node: {
|
|
1732
|
+
type: Object,
|
|
1733
|
+
required: !0
|
|
1734
|
+
},
|
|
1735
|
+
getPos: {
|
|
1736
|
+
type: Function,
|
|
1737
|
+
required: !0
|
|
1738
|
+
},
|
|
1739
|
+
deleteNode: {
|
|
1740
|
+
type: Function,
|
|
1741
|
+
required: !0
|
|
1742
|
+
},
|
|
1743
|
+
updateAttributes: {
|
|
1744
|
+
type: Function,
|
|
1745
|
+
required: !0
|
|
1746
|
+
},
|
|
1747
|
+
selected: {
|
|
1748
|
+
type: Boolean,
|
|
1749
|
+
required: !0
|
|
1750
|
+
}
|
|
1751
|
+
},
|
|
1752
|
+
setup(e) {
|
|
1753
|
+
let t = e.extension.options, r = t.messages ?? n("zh"), i = mr(e.editor), a = V(!1), o = V(!1), c = V(!1), l = U(() => _(e.node.attrs ?? {})), u = V(l.value?.title ?? ""), f = V(l.value?.href ?? "");
|
|
1754
|
+
W(l, (e) => {
|
|
1755
|
+
u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
1756
|
+
});
|
|
1757
|
+
let p = U(() => d(i.value)), m = U(() => {
|
|
1758
|
+
try {
|
|
1759
|
+
return new URL(l.value?.href ?? "").host;
|
|
1760
|
+
} catch {
|
|
1761
|
+
return l.value?.href ?? "";
|
|
1762
|
+
}
|
|
1763
|
+
}), h = (e) => e.preventDefault(), b = (e) => void navigator.clipboard?.writeText?.(e), x = () => y(e.editor, e.getPos()), S = async (n) => {
|
|
1764
|
+
n.preventDefault();
|
|
1765
|
+
let r = _({
|
|
1766
|
+
...l.value,
|
|
1767
|
+
title: u.value,
|
|
1768
|
+
href: f.value
|
|
1769
|
+
});
|
|
1770
|
+
if (!r) return;
|
|
1771
|
+
e.updateAttributes(r), o.value = !1;
|
|
1772
|
+
let i = await t.resolver?.({
|
|
1773
|
+
href: r.href,
|
|
1774
|
+
title: r.title,
|
|
1775
|
+
signal: new AbortController().signal
|
|
1776
|
+
}).catch(() => null);
|
|
1777
|
+
i && e.updateAttributes(_({
|
|
1778
|
+
...r,
|
|
1779
|
+
...i
|
|
1780
|
+
}) ?? r);
|
|
1781
|
+
}, C = (e, t, n, r) => B("button", {
|
|
1782
|
+
type: "button",
|
|
1783
|
+
title: e,
|
|
1784
|
+
"aria-label": e,
|
|
1785
|
+
"data-testid": n,
|
|
1786
|
+
onMousedown: h,
|
|
1787
|
+
onClick: r
|
|
1788
|
+
}, [vr(t, e), B("span", { role: "tooltip" }, e)]);
|
|
1789
|
+
return () => {
|
|
1790
|
+
let n = l.value;
|
|
1791
|
+
if (!n) return null;
|
|
1792
|
+
let i = !c.value && n.imageUrl ? B("img", {
|
|
1793
|
+
src: n.imageUrl,
|
|
1794
|
+
alt: "",
|
|
1795
|
+
loading: "lazy",
|
|
1796
|
+
referrerpolicy: "no-referrer",
|
|
1797
|
+
onError: () => {
|
|
1798
|
+
c.value = !0;
|
|
1799
|
+
}
|
|
1800
|
+
}) : !c.value && n.faviconUrl ? B("img", {
|
|
1801
|
+
class: "markweave-link-card-favicon",
|
|
1802
|
+
src: n.faviconUrl,
|
|
1803
|
+
alt: "",
|
|
1804
|
+
loading: "lazy",
|
|
1805
|
+
referrerpolicy: "no-referrer",
|
|
1806
|
+
onError: () => {
|
|
1807
|
+
c.value = !0;
|
|
1808
|
+
}
|
|
1809
|
+
}) : B("b", null, m.value.slice(0, 1).toUpperCase());
|
|
1810
|
+
return B(s, {
|
|
1811
|
+
as: "article",
|
|
1812
|
+
class: "markweave-link-card",
|
|
1813
|
+
"data-testid": "markweave-link-card",
|
|
1814
|
+
"data-markweave-link-card": "true",
|
|
1815
|
+
"data-hovered": a.value ? "true" : "false",
|
|
1816
|
+
"data-selected": e.selected ? "true" : "false",
|
|
1817
|
+
onMouseenter: () => {
|
|
1818
|
+
a.value = !0;
|
|
1819
|
+
},
|
|
1820
|
+
onMouseleave: () => {
|
|
1821
|
+
a.value = !1;
|
|
1822
|
+
},
|
|
1823
|
+
onMousedown: (e) => {
|
|
1824
|
+
_r(e.target) || e.preventDefault();
|
|
1825
|
+
},
|
|
1826
|
+
onClick: (e) => {
|
|
1827
|
+
_r(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
|
|
1828
|
+
}
|
|
1829
|
+
}, () => [
|
|
1830
|
+
B("a", {
|
|
1831
|
+
class: "markweave-link-card-main",
|
|
1832
|
+
href: n.href,
|
|
1833
|
+
"aria-label": r.linkCard.open
|
|
1834
|
+
}, [B("span", { class: "markweave-link-card-copy" }, [
|
|
1835
|
+
B("strong", null, n.title),
|
|
1836
|
+
n.description ? B("span", null, n.description) : null,
|
|
1837
|
+
B("small", null, n.siteName ?? m.value)
|
|
1838
|
+
]), B("span", {
|
|
1839
|
+
class: "markweave-link-card-media",
|
|
1840
|
+
"aria-hidden": "true"
|
|
1841
|
+
}, [i])]),
|
|
1842
|
+
p.value && a.value ? B("div", {
|
|
1843
|
+
class: "markweave-link-card-tools",
|
|
1844
|
+
"data-markweave-link-card-ui": "true",
|
|
1845
|
+
"aria-label": r.linkCard.toolsAriaLabel
|
|
1846
|
+
}, [
|
|
1847
|
+
C(r.linkCard.convertToLink, Gn, "markweave-link-card-convert", x),
|
|
1848
|
+
C(r.linkCard.copyAddress, Mn, "markweave-link-card-copy", () => b(n.href)),
|
|
1849
|
+
C(r.linkCard.edit, Qn, "markweave-link-card-edit", (i) => g({
|
|
1850
|
+
anchor: i.currentTarget,
|
|
1851
|
+
editor: e.editor,
|
|
1852
|
+
messages: r,
|
|
1853
|
+
resolver: t.resolver,
|
|
1854
|
+
card: {
|
|
1855
|
+
pos: e.getPos(),
|
|
1856
|
+
attrs: n
|
|
1857
|
+
}
|
|
1858
|
+
})),
|
|
1859
|
+
C(r.linkCard.delete, cr, "markweave-link-card-delete", () => e.deleteNode())
|
|
1860
|
+
]) : null,
|
|
1861
|
+
p.value && o.value ? B("form", {
|
|
1862
|
+
class: "markweave-link-card-editor",
|
|
1863
|
+
"data-markweave-link-card-ui": "true",
|
|
1864
|
+
"data-testid": "markweave-link-card-editor",
|
|
1865
|
+
onSubmit: S
|
|
1866
|
+
}, [
|
|
1867
|
+
B("label", null, [B("span", null, r.linkCard.titleLabel), B("input", {
|
|
1868
|
+
value: u.value,
|
|
1869
|
+
placeholder: r.linkCard.titlePlaceholder,
|
|
1870
|
+
"aria-label": r.linkCard.titleLabel,
|
|
1871
|
+
onInput: (e) => {
|
|
1872
|
+
u.value = e.target.value;
|
|
1873
|
+
}
|
|
1874
|
+
})]),
|
|
1875
|
+
B("label", null, [B("span", null, r.linkCard.addressLabel), B("input", {
|
|
1876
|
+
value: f.value,
|
|
1877
|
+
placeholder: r.linkCard.addressPlaceholder,
|
|
1878
|
+
"aria-label": r.linkCard.addressLabel,
|
|
1879
|
+
onInput: (e) => {
|
|
1880
|
+
f.value = e.target.value;
|
|
1881
|
+
}
|
|
1882
|
+
})]),
|
|
1883
|
+
B("button", {
|
|
1884
|
+
type: "submit",
|
|
1885
|
+
disabled: !v(f.value),
|
|
1886
|
+
"aria-label": r.linkCard.edit
|
|
1887
|
+
}, [vr(Gn, r.linkCard.edit)])
|
|
1888
|
+
]) : null
|
|
1889
|
+
]);
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
}), Er = h.extend({
|
|
1893
|
+
addOptions() {
|
|
1894
|
+
return {
|
|
1895
|
+
...this.parent?.(),
|
|
1896
|
+
messages: n("zh"),
|
|
1897
|
+
resolver: void 0
|
|
1898
|
+
};
|
|
1899
|
+
},
|
|
1900
|
+
addNodeView() {
|
|
1901
|
+
return typeof document > "u" ? null : c(Tr, { stopEvent: ({ event: e }) => _r(e.target) });
|
|
1714
1902
|
}
|
|
1715
1903
|
});
|
|
1716
1904
|
//#endregion
|
|
1717
1905
|
//#region src/create-editor-extensions.ts
|
|
1718
|
-
function
|
|
1906
|
+
function Dr(t = {}) {
|
|
1719
1907
|
return e({
|
|
1720
|
-
lang:
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1908
|
+
lang: t.lang,
|
|
1909
|
+
linkCardExtension: Er.configure({
|
|
1910
|
+
lang: t.lang,
|
|
1911
|
+
messages: n(t.lang),
|
|
1912
|
+
resolver: t.linkCardResolver
|
|
1913
|
+
}),
|
|
1914
|
+
mediaExtensions: i({
|
|
1915
|
+
image: Cr,
|
|
1916
|
+
video: wr,
|
|
1917
|
+
lang: t.lang,
|
|
1918
|
+
onImageUpload: t.onImageUpload,
|
|
1919
|
+
onVideoUpload: t.onVideoUpload
|
|
1727
1920
|
})
|
|
1728
1921
|
});
|
|
1729
1922
|
}
|
|
1730
1923
|
//#endregion
|
|
1731
1924
|
//#region src/MarkweaveEditor.ts
|
|
1732
|
-
var
|
|
1925
|
+
var Or = {
|
|
1733
1926
|
active: !1,
|
|
1734
1927
|
mode: "outside",
|
|
1735
1928
|
activeCellPos: null,
|
|
@@ -1737,17 +1930,17 @@ var _r = {
|
|
|
1737
1930
|
selectedCellCount: 0,
|
|
1738
1931
|
selectionFrom: 0,
|
|
1739
1932
|
selectionTo: 0
|
|
1740
|
-
},
|
|
1933
|
+
}, kr = {
|
|
1741
1934
|
active: !1,
|
|
1742
|
-
language:
|
|
1935
|
+
language: Ne.defaultLanguage,
|
|
1743
1936
|
mermaidPreviewMode: "code",
|
|
1744
1937
|
pos: null,
|
|
1745
1938
|
text: ""
|
|
1746
1939
|
};
|
|
1747
|
-
function
|
|
1748
|
-
return
|
|
1940
|
+
function Ar(e) {
|
|
1941
|
+
return Rt.getState(e.state) ?? Lt;
|
|
1749
1942
|
}
|
|
1750
|
-
function
|
|
1943
|
+
function jr(e) {
|
|
1751
1944
|
if (!e || typeof window > "u") return null;
|
|
1752
1945
|
let t = e.parentElement;
|
|
1753
1946
|
for (; t;) {
|
|
@@ -1764,7 +1957,7 @@ function Z(e, t, n = 18, r = 1.8) {
|
|
|
1764
1957
|
"aria-hidden": "true"
|
|
1765
1958
|
}, { default: () => t });
|
|
1766
1959
|
}
|
|
1767
|
-
function
|
|
1960
|
+
function Mr(e) {
|
|
1768
1961
|
return e === "clipboard" ? [B("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), B("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] : e === "search" ? [B("circle", {
|
|
1769
1962
|
cx: "10",
|
|
1770
1963
|
cy: "10",
|
|
@@ -1812,57 +2005,57 @@ function Q(e) {
|
|
|
1812
2005
|
"stroke-linecap": "round",
|
|
1813
2006
|
"stroke-linejoin": "round",
|
|
1814
2007
|
"stroke-width": "1.8"
|
|
1815
|
-
},
|
|
2008
|
+
}, Mr(e)));
|
|
1816
2009
|
}
|
|
1817
2010
|
function $(e) {
|
|
1818
2011
|
e.preventDefault();
|
|
1819
2012
|
}
|
|
1820
|
-
function
|
|
1821
|
-
let t =
|
|
2013
|
+
function Nr(e) {
|
|
2014
|
+
let t = at(e);
|
|
1822
2015
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
1823
2016
|
}
|
|
1824
|
-
var
|
|
1825
|
-
bold:
|
|
1826
|
-
italic:
|
|
1827
|
-
underline:
|
|
1828
|
-
strike:
|
|
1829
|
-
"inline-code":
|
|
1830
|
-
link:
|
|
1831
|
-
more:
|
|
1832
|
-
superscript:
|
|
1833
|
-
subscript:
|
|
1834
|
-
"inline-math":
|
|
1835
|
-
"align-left":
|
|
1836
|
-
"align-center":
|
|
1837
|
-
"align-right":
|
|
1838
|
-
"align-justify":
|
|
1839
|
-
"decrease-indent":
|
|
1840
|
-
"increase-indent":
|
|
1841
|
-
},
|
|
1842
|
-
type:
|
|
1843
|
-
"heading-1":
|
|
1844
|
-
"heading-2":
|
|
1845
|
-
"heading-3":
|
|
1846
|
-
"bullet-list":
|
|
1847
|
-
"ordered-list":
|
|
1848
|
-
"task-list":
|
|
1849
|
-
blockquote:
|
|
1850
|
-
"code-block":
|
|
1851
|
-
info:
|
|
1852
|
-
tip:
|
|
1853
|
-
warning:
|
|
1854
|
-
error:
|
|
1855
|
-
success:
|
|
1856
|
-
emoji:
|
|
1857
|
-
math:
|
|
1858
|
-
table:
|
|
1859
|
-
separator:
|
|
1860
|
-
image:
|
|
1861
|
-
video:
|
|
1862
|
-
attachment:
|
|
2017
|
+
var Pr = {
|
|
2018
|
+
bold: Cn,
|
|
2019
|
+
italic: Un,
|
|
2020
|
+
underline: ur,
|
|
2021
|
+
strike: rr,
|
|
2022
|
+
"inline-code": An,
|
|
2023
|
+
link: Gn,
|
|
2024
|
+
more: Xn,
|
|
2025
|
+
superscript: ar,
|
|
2026
|
+
subscript: ir,
|
|
2027
|
+
"inline-math": tr,
|
|
2028
|
+
"align-left": bn,
|
|
2029
|
+
"align-center": vn,
|
|
2030
|
+
"align-right": xn,
|
|
2031
|
+
"align-justify": yn,
|
|
2032
|
+
"decrease-indent": Bn,
|
|
2033
|
+
"increase-indent": Vn
|
|
2034
|
+
}, Fr = {
|
|
2035
|
+
type: sr,
|
|
2036
|
+
"heading-1": Fn,
|
|
2037
|
+
"heading-2": In,
|
|
2038
|
+
"heading-3": Ln,
|
|
2039
|
+
"bullet-list": Kn,
|
|
2040
|
+
"ordered-list": Jn,
|
|
2041
|
+
"task-list": qn,
|
|
2042
|
+
blockquote: $n,
|
|
2043
|
+
"code-block": wn,
|
|
2044
|
+
info: Hn,
|
|
2045
|
+
tip: Wn,
|
|
2046
|
+
warning: Sn,
|
|
2047
|
+
error: kn,
|
|
2048
|
+
success: En,
|
|
2049
|
+
emoji: nr,
|
|
2050
|
+
math: tr,
|
|
2051
|
+
table: or,
|
|
2052
|
+
separator: Yn,
|
|
2053
|
+
image: Rn,
|
|
2054
|
+
video: fr,
|
|
2055
|
+
attachment: Zn
|
|
1863
2056
|
};
|
|
1864
|
-
function
|
|
1865
|
-
let t =
|
|
2057
|
+
function Ir(e) {
|
|
2058
|
+
let t = Fr[e];
|
|
1866
2059
|
return B(t, {
|
|
1867
2060
|
size: 18,
|
|
1868
2061
|
strokeWidth: 1.6,
|
|
@@ -1870,21 +2063,21 @@ function Tr(e) {
|
|
|
1870
2063
|
"aria-hidden": "true"
|
|
1871
2064
|
});
|
|
1872
2065
|
}
|
|
1873
|
-
var
|
|
1874
|
-
paragraph:
|
|
1875
|
-
"heading-1":
|
|
1876
|
-
"heading-2":
|
|
1877
|
-
"heading-3":
|
|
1878
|
-
"bullet-list":
|
|
1879
|
-
"numbered-list":
|
|
1880
|
-
"todo-list":
|
|
1881
|
-
quote:
|
|
1882
|
-
"code-block":
|
|
2066
|
+
var Lr = {
|
|
2067
|
+
paragraph: lr,
|
|
2068
|
+
"heading-1": Fn,
|
|
2069
|
+
"heading-2": In,
|
|
2070
|
+
"heading-3": Ln,
|
|
2071
|
+
"bullet-list": Kn,
|
|
2072
|
+
"numbered-list": Jn,
|
|
2073
|
+
"todo-list": qn,
|
|
2074
|
+
quote: $n,
|
|
2075
|
+
"code-block": wn
|
|
1883
2076
|
};
|
|
1884
|
-
function
|
|
1885
|
-
return
|
|
2077
|
+
function Rr(e, t) {
|
|
2078
|
+
return se(e, t).label;
|
|
1886
2079
|
}
|
|
1887
|
-
var
|
|
2080
|
+
var zr = J({
|
|
1888
2081
|
name: "MarkweaveVueFloatingToolbar",
|
|
1889
2082
|
props: {
|
|
1890
2083
|
editor: {
|
|
@@ -1901,28 +2094,28 @@ var Or = J({
|
|
|
1901
2094
|
}
|
|
1902
2095
|
},
|
|
1903
2096
|
setup(e) {
|
|
1904
|
-
let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() =>
|
|
2097
|
+
let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() => at(n.value.trim())), u = U(() => e.messages.floatingToolbar), d = U(() => ue(e.messages).map((e) => [
|
|
1905
2098
|
e.id,
|
|
1906
2099
|
e.label,
|
|
1907
|
-
|
|
1908
|
-
])), f = U(() =>
|
|
2100
|
+
Lr[e.id]
|
|
2101
|
+
])), f = U(() => z(e.messages).map((e) => [
|
|
1909
2102
|
e.id,
|
|
1910
2103
|
e.value,
|
|
1911
2104
|
e.label
|
|
1912
|
-
])), p = U(() =>
|
|
2105
|
+
])), p = U(() => ce(e.messages).map((e) => [
|
|
1913
2106
|
e.id,
|
|
1914
2107
|
e.value,
|
|
1915
2108
|
e.label
|
|
1916
|
-
])), m = U(() =>
|
|
2109
|
+
])), m = U(() => le(e.messages).map((e) => e.id)), h = () => {
|
|
1917
2110
|
l.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: l.value }).run(), t.value = null);
|
|
1918
2111
|
}, g = () => {
|
|
1919
2112
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
|
|
1920
2113
|
}, _ = (r) => {
|
|
1921
2114
|
t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
|
|
1922
|
-
}, v =
|
|
2115
|
+
}, v = R(() => {
|
|
1923
2116
|
let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
1924
2117
|
if (!t.value || !n || !r) return;
|
|
1925
|
-
let s =
|
|
2118
|
+
let s = ge({
|
|
1926
2119
|
toolbarRect: n.getBoundingClientRect(),
|
|
1927
2120
|
popoverSize: r.getBoundingClientRect(),
|
|
1928
2121
|
viewport: {
|
|
@@ -1979,7 +2172,7 @@ var Or = J({
|
|
|
1979
2172
|
onMouseenter: (e) => b(n, e.currentTarget),
|
|
1980
2173
|
onMouseleave: () => b(null),
|
|
1981
2174
|
onClick: o
|
|
1982
|
-
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" },
|
|
2175
|
+
}, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, Rr(e.editor, e.messages)), Z(t.value === "block-type" ? On : Dn, 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" ? On : Dn, i)])] : [Z(a, i)]), C = () => B("span", {
|
|
1983
2176
|
class: "markweave-floating-toolbar-divider",
|
|
1984
2177
|
"aria-hidden": "true"
|
|
1985
2178
|
}), w = (n, r, i) => B("section", {
|
|
@@ -2011,7 +2204,7 @@ var Or = J({
|
|
|
2011
2204
|
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
2012
2205
|
onMousedown: $,
|
|
2013
2206
|
onClick: () => {
|
|
2014
|
-
|
|
2207
|
+
fe(e.editor, n), t.value = null;
|
|
2015
2208
|
}
|
|
2016
2209
|
}, [B("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), B("span", null, r)]))]) : t.value === "link" ? B("form", {
|
|
2017
2210
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
@@ -2035,7 +2228,7 @@ var Or = J({
|
|
|
2035
2228
|
"aria-label": u.value.applyLink,
|
|
2036
2229
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
2037
2230
|
onMousedown: $
|
|
2038
|
-
}, [Z(
|
|
2231
|
+
}, [Z(jn, u.value.applyLink)]),
|
|
2039
2232
|
B("span", {
|
|
2040
2233
|
class: "markweave-floating-toolbar-link-divider",
|
|
2041
2234
|
"aria-hidden": "true"
|
|
@@ -2046,15 +2239,15 @@ var Or = J({
|
|
|
2046
2239
|
"aria-label": u.value.openLink,
|
|
2047
2240
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
2048
2241
|
onMousedown: $,
|
|
2049
|
-
onClick: () =>
|
|
2050
|
-
}, [Z(
|
|
2242
|
+
onClick: () => Nr(n.value)
|
|
2243
|
+
}, [Z(Pn, u.value.openLink)]),
|
|
2051
2244
|
B("button", {
|
|
2052
2245
|
type: "button",
|
|
2053
2246
|
"aria-label": u.value.removeLink,
|
|
2054
2247
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
2055
2248
|
onMousedown: $,
|
|
2056
2249
|
onClick: g
|
|
2057
|
-
}, [Z(
|
|
2250
|
+
}, [Z(cr, u.value.removeLink)])
|
|
2058
2251
|
])]) : t.value === "color" ? B("div", {
|
|
2059
2252
|
ref: c,
|
|
2060
2253
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
@@ -2079,15 +2272,15 @@ var Or = J({
|
|
|
2079
2272
|
r.value = null;
|
|
2080
2273
|
},
|
|
2081
2274
|
onClick: () => {
|
|
2082
|
-
|
|
2275
|
+
de(e.editor, n), t.value = null;
|
|
2083
2276
|
}
|
|
2084
|
-
}, [Z(
|
|
2277
|
+
}, [Z(Pr[n], u.value.moreActions[n])]), r.value === n ? B("div", {
|
|
2085
2278
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
2086
2279
|
role: "tooltip"
|
|
2087
2280
|
}, u.value.moreActions[n]) : null]))) : null;
|
|
2088
|
-
return () => B(
|
|
2281
|
+
return () => B(I, {
|
|
2089
2282
|
editor: e.editor,
|
|
2090
|
-
shouldShow: ({ editor: e }) => e.isEditable &&
|
|
2283
|
+
shouldShow: ({ editor: e }) => e.isEditable && ye(_e(e)),
|
|
2091
2284
|
options: { placement: "top" }
|
|
2092
2285
|
}, { default: () => B("div", {
|
|
2093
2286
|
ref: o,
|
|
@@ -2099,23 +2292,23 @@ var Or = J({
|
|
|
2099
2292
|
class: "markweave-floating-toolbar-content",
|
|
2100
2293
|
"data-menu": t.value ?? "none"
|
|
2101
2294
|
}, [
|
|
2102
|
-
S("block-type", u.value.buttons["block-type"],
|
|
2295
|
+
S("block-type", u.value.buttons["block-type"], lr, () => _("block-type"), t.value === "block-type"),
|
|
2103
2296
|
C(),
|
|
2104
|
-
S("bold", u.value.buttons.bold,
|
|
2105
|
-
S("italic", u.value.buttons.italic,
|
|
2106
|
-
S("underline", u.value.buttons.underline,
|
|
2107
|
-
S("strike", u.value.buttons.strike,
|
|
2108
|
-
S("inline-code", u.value.buttons["inline-code"],
|
|
2297
|
+
S("bold", u.value.buttons.bold, Cn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2298
|
+
S("italic", u.value.buttons.italic, Un, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2299
|
+
S("underline", u.value.buttons.underline, ur, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2300
|
+
S("strike", u.value.buttons.strike, rr, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2301
|
+
S("inline-code", u.value.buttons["inline-code"], An, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2109
2302
|
C(),
|
|
2110
|
-
S("link", u.value.buttons.link,
|
|
2111
|
-
S("color", u.value.buttons.color,
|
|
2303
|
+
S("link", u.value.buttons.link, Gn, () => _("link"), e.editor.isActive("link")),
|
|
2304
|
+
S("color", u.value.buttons.color, lr, () => _("color"), t.value === "color"),
|
|
2112
2305
|
C(),
|
|
2113
|
-
S("more", u.value.buttons.more,
|
|
2306
|
+
S("more", u.value.buttons.more, Xn, () => _("more"), t.value === "more"),
|
|
2114
2307
|
T(),
|
|
2115
2308
|
x()
|
|
2116
2309
|
])]) });
|
|
2117
2310
|
}
|
|
2118
|
-
}),
|
|
2311
|
+
}), Br = J({
|
|
2119
2312
|
name: "MarkweaveVueMathEditorPopover",
|
|
2120
2313
|
props: {
|
|
2121
2314
|
editor: {
|
|
@@ -2136,17 +2329,17 @@ var Or = J({
|
|
|
2136
2329
|
}
|
|
2137
2330
|
},
|
|
2138
2331
|
setup(e) {
|
|
2139
|
-
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(
|
|
2332
|
+
let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(ut(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
|
|
2140
2333
|
html: a.value,
|
|
2141
2334
|
error: !1
|
|
2142
|
-
} :
|
|
2335
|
+
} : mt(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => lt(e.editor, e.target) ?? 1), u = () => {
|
|
2143
2336
|
if (typeof window > "u") return;
|
|
2144
|
-
let r =
|
|
2337
|
+
let r = ct(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
2145
2338
|
if (!r || !i) {
|
|
2146
2339
|
e.onClose();
|
|
2147
2340
|
return;
|
|
2148
2341
|
}
|
|
2149
|
-
n.value =
|
|
2342
|
+
n.value = st({
|
|
2150
2343
|
anchorRect: r,
|
|
2151
2344
|
frameRect: i,
|
|
2152
2345
|
kind: e.target.kind,
|
|
@@ -2155,7 +2348,7 @@ var Or = J({
|
|
|
2155
2348
|
viewportWidth: window.innerWidth
|
|
2156
2349
|
});
|
|
2157
2350
|
}, d = () => {
|
|
2158
|
-
s.value &&
|
|
2351
|
+
s.value && ot(e.editor, e.target, t.value) && e.onClose();
|
|
2159
2352
|
}, f = (t) => {
|
|
2160
2353
|
if (t.key === "Escape") {
|
|
2161
2354
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -2167,13 +2360,13 @@ var Or = J({
|
|
|
2167
2360
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
2168
2361
|
};
|
|
2169
2362
|
return W(() => [e.target.pos, e.target.latex], () => {
|
|
2170
|
-
t.value = e.target.latex, a.value =
|
|
2363
|
+
t.value = e.target.latex, a.value = ut(e.editor, e.target), q(u);
|
|
2171
2364
|
}), G(() => {
|
|
2172
|
-
|
|
2365
|
+
ht(e.editor, e.target, !0), u(), q(() => {
|
|
2173
2366
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
2174
2367
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
2175
2368
|
}), K(() => {
|
|
2176
|
-
|
|
2369
|
+
ht(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
2177
2370
|
}), () => {
|
|
2178
2371
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
2179
2372
|
ref: i,
|
|
@@ -2234,14 +2427,14 @@ var Or = J({
|
|
|
2234
2427
|
}, [
|
|
2235
2428
|
B("div", { class: "markweave-math-block-toolbar" }, [
|
|
2236
2429
|
B("span", null, c.value.label),
|
|
2237
|
-
Z(
|
|
2430
|
+
Z(An, c.value.label, 15, 1.75),
|
|
2238
2431
|
B("button", {
|
|
2239
2432
|
type: "submit",
|
|
2240
2433
|
title: c.value.apply,
|
|
2241
2434
|
"aria-label": c.value.apply,
|
|
2242
2435
|
disabled: !s.value,
|
|
2243
2436
|
"data-testid": "markweave-math-editor-apply"
|
|
2244
|
-
}, [Z(
|
|
2437
|
+
}, [Z(En, c.value.apply, 16, 2)])
|
|
2245
2438
|
]),
|
|
2246
2439
|
B("label", {
|
|
2247
2440
|
class: "markweave-math-block-source",
|
|
@@ -2264,7 +2457,7 @@ var Or = J({
|
|
|
2264
2457
|
]);
|
|
2265
2458
|
};
|
|
2266
2459
|
}
|
|
2267
|
-
}),
|
|
2460
|
+
}), Vr = J({
|
|
2268
2461
|
name: "MarkweaveVueSlashCommandMenu",
|
|
2269
2462
|
props: {
|
|
2270
2463
|
commands: {
|
|
@@ -2323,13 +2516,13 @@ var Or = J({
|
|
|
2323
2516
|
} : {
|
|
2324
2517
|
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
2325
2518
|
trigger: "slash-command",
|
|
2326
|
-
source:
|
|
2519
|
+
source: P(t.value)
|
|
2327
2520
|
};
|
|
2328
2521
|
if (!n.value && !t.value.trim()) {
|
|
2329
2522
|
r.value = e.messages.slash.uploadRequiredError;
|
|
2330
2523
|
return;
|
|
2331
2524
|
}
|
|
2332
|
-
let a = await
|
|
2525
|
+
let a = await F(i, e.onUpload);
|
|
2333
2526
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
2334
2527
|
} catch (t) {
|
|
2335
2528
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -2450,7 +2643,7 @@ var Or = J({
|
|
|
2450
2643
|
class: "markweave-slash-group",
|
|
2451
2644
|
"aria-label": t.group
|
|
2452
2645
|
}, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
2453
|
-
let n = e.commands.indexOf(t) === e.state.activeIndex, r =
|
|
2646
|
+
let n = e.commands.indexOf(t) === e.state.activeIndex, r = wt(t);
|
|
2454
2647
|
return B("button", {
|
|
2455
2648
|
key: t.id,
|
|
2456
2649
|
type: "button",
|
|
@@ -2473,7 +2666,7 @@ var Or = J({
|
|
|
2473
2666
|
}
|
|
2474
2667
|
}
|
|
2475
2668
|
}, [
|
|
2476
|
-
|
|
2669
|
+
Ir(t.icon),
|
|
2477
2670
|
B("span", null, t.label),
|
|
2478
2671
|
t.disabledReason ? B("small", null, t.disabledReason) : null
|
|
2479
2672
|
]);
|
|
@@ -2484,7 +2677,7 @@ var Or = J({
|
|
|
2484
2677
|
}, e.messages.slash.noResults)])]);
|
|
2485
2678
|
};
|
|
2486
2679
|
}
|
|
2487
|
-
}),
|
|
2680
|
+
}), Hr = J({
|
|
2488
2681
|
name: "MarkweaveVueTableControls",
|
|
2489
2682
|
props: {
|
|
2490
2683
|
editor: {
|
|
@@ -2517,12 +2710,12 @@ var Or = J({
|
|
|
2517
2710
|
}
|
|
2518
2711
|
},
|
|
2519
2712
|
setup(e) {
|
|
2520
|
-
let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ?
|
|
2713
|
+
let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ? Ft(e.editor.state) : Or), h = U(() => qt(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => qt(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Gt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? Zt(e.editor, t.value) : []), b = () => {
|
|
2521
2714
|
p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
|
|
2522
2715
|
}, x = (e) => {
|
|
2523
2716
|
b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
|
|
2524
2717
|
s.value = null, p = null;
|
|
2525
|
-
},
|
|
2718
|
+
}, tn));
|
|
2526
2719
|
}, S = () => {
|
|
2527
2720
|
if (!e.active) {
|
|
2528
2721
|
r.value = null, i.value = null, a.value = null, x(null);
|
|
@@ -2533,16 +2726,16 @@ var Or = J({
|
|
|
2533
2726
|
r.value = null, i.value = null, a.value = null;
|
|
2534
2727
|
return;
|
|
2535
2728
|
}
|
|
2536
|
-
let s = o.getBoundingClientRect(), c = h.value ?
|
|
2537
|
-
c ? r.value =
|
|
2729
|
+
let s = o.getBoundingClientRect(), c = h.value ? Kt(e.editor, h.value) : null, l = g.value ? Kt(e.editor, g.value) : null, u = v.value ? Qt(e.editor) : null;
|
|
2730
|
+
c ? r.value = Bt({
|
|
2538
2731
|
targetRect: c,
|
|
2539
2732
|
frameRect: s,
|
|
2540
2733
|
kind: "row"
|
|
2541
|
-
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value =
|
|
2734
|
+
}) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Bt({
|
|
2542
2735
|
targetRect: l,
|
|
2543
2736
|
frameRect: s,
|
|
2544
2737
|
kind: "column"
|
|
2545
|
-
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value =
|
|
2738
|
+
}) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Bt({
|
|
2546
2739
|
targetRect: u,
|
|
2547
2740
|
frameRect: s,
|
|
2548
2741
|
kind: "selection"
|
|
@@ -2557,13 +2750,13 @@ var Or = J({
|
|
|
2557
2750
|
o.value = null;
|
|
2558
2751
|
return;
|
|
2559
2752
|
}
|
|
2560
|
-
let a = i.getBoundingClientRect(), s = t.value === "row" ?
|
|
2753
|
+
let a = i.getBoundingClientRect(), s = t.value === "row" ? Wt(e.editor)?.getBoundingClientRect() : null, c = s ? {
|
|
2561
2754
|
left: a.left,
|
|
2562
2755
|
top: s.top,
|
|
2563
2756
|
width: a.width,
|
|
2564
2757
|
height: a.height
|
|
2565
2758
|
} : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
|
|
2566
|
-
o.value =
|
|
2759
|
+
o.value = zt({
|
|
2567
2760
|
anchorRect: c,
|
|
2568
2761
|
frameRect: p,
|
|
2569
2762
|
menuSize: {
|
|
@@ -2579,35 +2772,35 @@ var Or = J({
|
|
|
2579
2772
|
}, E = (e, r) => {
|
|
2580
2773
|
let i = t.value === e && n.value === r;
|
|
2581
2774
|
n.value = r, t.value = i ? null : e, T();
|
|
2582
|
-
},
|
|
2583
|
-
e.editor.view.dispatch(
|
|
2584
|
-
},
|
|
2775
|
+
}, ee = () => {
|
|
2776
|
+
e.editor.view.dispatch(Mt(e.editor.state.tr, null));
|
|
2777
|
+
}, D = (t, n) => {
|
|
2585
2778
|
let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
2586
|
-
r !== null &&
|
|
2587
|
-
},
|
|
2588
|
-
|
|
2589
|
-
},
|
|
2779
|
+
r !== null && en(e.editor, r, t, { visualIndex: i }), E(t, n);
|
|
2780
|
+
}, O = () => {
|
|
2781
|
+
ee(), E("selection", "selection-edge");
|
|
2782
|
+
}, k = (n = !1) => {
|
|
2590
2783
|
t.value = null, o.value = null, n && e.editor.view.focus();
|
|
2591
|
-
},
|
|
2592
|
-
let i = await
|
|
2784
|
+
}, A = async (n, r) => {
|
|
2785
|
+
let i = await Ht({
|
|
2593
2786
|
editor: e.editor,
|
|
2594
2787
|
commandId: n,
|
|
2595
2788
|
menu: r ?? t.value ?? "selection",
|
|
2596
2789
|
messages: e.messages
|
|
2597
2790
|
});
|
|
2598
2791
|
return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
2599
|
-
},
|
|
2600
|
-
let n =
|
|
2601
|
-
n && e.onEditWithAi?.(n),
|
|
2792
|
+
}, j = (t) => {
|
|
2793
|
+
let n = Jt(e.editor, t);
|
|
2794
|
+
n && e.onEditWithAi?.(n), k(!0);
|
|
2795
|
+
}, M = (e) => {
|
|
2796
|
+
!t.value || e.key !== "Escape" || k(!0);
|
|
2602
2797
|
}, N = (e) => {
|
|
2603
|
-
|
|
2604
|
-
}, ee = (e) => {
|
|
2605
|
-
t.value && (e.target instanceof Node && c.value?.contains(e.target) || A());
|
|
2798
|
+
t.value && (e.target instanceof Node && c.value?.contains(e.target) || k());
|
|
2606
2799
|
};
|
|
2607
2800
|
G(() => {
|
|
2608
|
-
w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown",
|
|
2801
|
+
w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", M), document.addEventListener("mousedown", N);
|
|
2609
2802
|
}), K(() => {
|
|
2610
|
-
b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown",
|
|
2803
|
+
b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", M), document.removeEventListener("mousedown", N);
|
|
2611
2804
|
}), W(() => [
|
|
2612
2805
|
e.active,
|
|
2613
2806
|
m.value.activeCellPos,
|
|
@@ -2623,7 +2816,7 @@ var Or = J({
|
|
|
2623
2816
|
ref: f,
|
|
2624
2817
|
class: "markweave-table-menu",
|
|
2625
2818
|
role: "menu",
|
|
2626
|
-
"aria-label":
|
|
2819
|
+
"aria-label": nn(t.value, e.messages),
|
|
2627
2820
|
"data-testid": "markweave-table-menu",
|
|
2628
2821
|
"data-positioned": o.value ? "true" : "false",
|
|
2629
2822
|
style: o.value ? {
|
|
@@ -2631,7 +2824,7 @@ var Or = J({
|
|
|
2631
2824
|
top: `${o.value.top}px`
|
|
2632
2825
|
} : void 0
|
|
2633
2826
|
}, y.value.map((n, r) => {
|
|
2634
|
-
let i =
|
|
2827
|
+
let i = Yt(n), a = r === 0 ? i : Yt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Vt(e.editor, n.commandId), c = Xt(n, e.messages);
|
|
2635
2828
|
return B("button", {
|
|
2636
2829
|
key: `${n.id}-${r}`,
|
|
2637
2830
|
type: "button",
|
|
@@ -2647,10 +2840,10 @@ var Or = J({
|
|
|
2647
2840
|
onClick: () => {
|
|
2648
2841
|
if (s) {
|
|
2649
2842
|
if (n.commandId === null) {
|
|
2650
|
-
|
|
2843
|
+
j(t.value === "row" || t.value === "column" ? t.value : "selection");
|
|
2651
2844
|
return;
|
|
2652
2845
|
}
|
|
2653
|
-
|
|
2846
|
+
A(n.commandId).finally(() => k());
|
|
2654
2847
|
}
|
|
2655
2848
|
}
|
|
2656
2849
|
}, c);
|
|
@@ -2671,7 +2864,7 @@ var Or = J({
|
|
|
2671
2864
|
"data-copy-kind": s.value.kind,
|
|
2672
2865
|
"data-text-length": s.value.textLength,
|
|
2673
2866
|
"data-html-length": s.value.htmlLength
|
|
2674
|
-
},
|
|
2867
|
+
}, Ut(s.value)) : null,
|
|
2675
2868
|
r.value ? B("button", {
|
|
2676
2869
|
ref: l,
|
|
2677
2870
|
type: "button",
|
|
@@ -2690,7 +2883,7 @@ var Or = J({
|
|
|
2690
2883
|
top: `${r.value.top}px`
|
|
2691
2884
|
},
|
|
2692
2885
|
onMousedown: $,
|
|
2693
|
-
onClick: () =>
|
|
2886
|
+
onClick: () => D("row", "row-edge")
|
|
2694
2887
|
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2695
2888
|
i.value ? B("button", {
|
|
2696
2889
|
ref: u,
|
|
@@ -2710,7 +2903,7 @@ var Or = J({
|
|
|
2710
2903
|
top: `${i.value.top}px`
|
|
2711
2904
|
},
|
|
2712
2905
|
onMousedown: $,
|
|
2713
|
-
onClick: () =>
|
|
2906
|
+
onClick: () => D("column", "column-edge")
|
|
2714
2907
|
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2715
2908
|
v.value && a.value ? B("button", {
|
|
2716
2909
|
ref: d,
|
|
@@ -2726,12 +2919,12 @@ var Or = J({
|
|
|
2726
2919
|
top: `${a.value.top}px`
|
|
2727
2920
|
},
|
|
2728
2921
|
onMousedown: $,
|
|
2729
|
-
onClick:
|
|
2922
|
+
onClick: O
|
|
2730
2923
|
}, [B("span", { "aria-hidden": "true" }, "...")]) : null,
|
|
2731
2924
|
P()
|
|
2732
2925
|
]) : null;
|
|
2733
2926
|
}
|
|
2734
|
-
}),
|
|
2927
|
+
}), Ur = J({
|
|
2735
2928
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
2736
2929
|
props: {
|
|
2737
2930
|
editor: {
|
|
@@ -2749,7 +2942,7 @@ var Or = J({
|
|
|
2749
2942
|
t.value = null;
|
|
2750
2943
|
return;
|
|
2751
2944
|
}
|
|
2752
|
-
t.value =
|
|
2945
|
+
t.value = $t(e.editor, It(e.editor.state));
|
|
2753
2946
|
};
|
|
2754
2947
|
return G(() => {
|
|
2755
2948
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
@@ -2787,7 +2980,7 @@ var Or = J({
|
|
|
2787
2980
|
}) : null;
|
|
2788
2981
|
};
|
|
2789
2982
|
}
|
|
2790
|
-
}),
|
|
2983
|
+
}), Wr = J({
|
|
2791
2984
|
name: "MarkweaveVueCodeBlockControls",
|
|
2792
2985
|
props: {
|
|
2793
2986
|
editor: {
|
|
@@ -2820,88 +3013,88 @@ var Or = J({
|
|
|
2820
3013
|
active: !1,
|
|
2821
3014
|
lastX: 0,
|
|
2822
3015
|
lastY: 0
|
|
2823
|
-
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value,
|
|
3016
|
+
}), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, Ze(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
2824
3017
|
...e.state,
|
|
2825
3018
|
pos: e.state.pos,
|
|
2826
3019
|
active: !0
|
|
2827
|
-
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() =>
|
|
3020
|
+
} : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => tt(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), ee = U(() => !e.readOnly), D = U(() => S.value ? Ge(S.value.language) : Ge("text")), O = U(() => u.value?.status ?? "idle"), k = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), A = U(() => w.value && k.value === "preview"), j = U(() => (v.value, g.value, _.value, $e(e.editor))), M = U(() => `${_.value}|${j.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), N = U(() => Ye(l.value)), P = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), te = () => {
|
|
2828
3021
|
y !== null && (window.clearTimeout(y), y = null);
|
|
2829
3022
|
}, F = (e) => {
|
|
2830
3023
|
te(), u.value = e, e && (y = window.setTimeout(() => {
|
|
2831
3024
|
u.value = null, y = null;
|
|
2832
|
-
},
|
|
2833
|
-
},
|
|
3025
|
+
}, ze));
|
|
3026
|
+
}, I = () => {
|
|
2834
3027
|
f.value = null, p.value = null, m.value = !1, h.value = {
|
|
2835
3028
|
active: !1,
|
|
2836
3029
|
lastX: 0,
|
|
2837
3030
|
lastY: 0
|
|
2838
3031
|
}, e.editor.view.focus();
|
|
2839
|
-
},
|
|
3032
|
+
}, L = () => {
|
|
2840
3033
|
let n = t.value;
|
|
2841
3034
|
if (!n) return;
|
|
2842
|
-
if (!
|
|
3035
|
+
if (!Qe(n) || j.value.length === 0) {
|
|
2843
3036
|
o.value = [];
|
|
2844
3037
|
return;
|
|
2845
3038
|
}
|
|
2846
|
-
let r = n.getBoundingClientRect(), i =
|
|
2847
|
-
let n =
|
|
2848
|
-
return n ? [
|
|
3039
|
+
let r = n.getBoundingClientRect(), i = j.value.flatMap((t) => {
|
|
3040
|
+
let n = Je(qe(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
3041
|
+
return n ? [Ue(t, n, r)] : [];
|
|
2849
3042
|
});
|
|
2850
|
-
o.value =
|
|
2851
|
-
},
|
|
3043
|
+
o.value = nt(o.value, i, j.value.map((e) => e.pos));
|
|
3044
|
+
}, R = () => {
|
|
2852
3045
|
if (!E.value || !S.value) {
|
|
2853
3046
|
a.value = null, s.value = null;
|
|
2854
3047
|
return;
|
|
2855
3048
|
}
|
|
2856
3049
|
let r = t.value;
|
|
2857
3050
|
if (!r) return;
|
|
2858
|
-
let i =
|
|
3051
|
+
let i = qe(e.editor, S.value.pos, k.value), o = r.getBoundingClientRect(), l = Je(i, o);
|
|
2859
3052
|
if (!l) {
|
|
2860
3053
|
a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
|
|
2861
3054
|
return;
|
|
2862
3055
|
}
|
|
2863
|
-
if (a.value =
|
|
3056
|
+
if (a.value = Ve(S.value.pos, l, o), c.value && n.value) {
|
|
2864
3057
|
let e = n.value.getBoundingClientRect();
|
|
2865
|
-
s.value =
|
|
3058
|
+
s.value = Le({
|
|
2866
3059
|
overlayRect: o,
|
|
2867
3060
|
buttonRect: e,
|
|
2868
3061
|
windowWidth: window.innerWidth,
|
|
2869
3062
|
windowHeight: window.innerHeight
|
|
2870
3063
|
});
|
|
2871
3064
|
}
|
|
2872
|
-
},
|
|
3065
|
+
}, ne = async () => {
|
|
2873
3066
|
if (e.readOnly) {
|
|
2874
3067
|
if (!S.value) return;
|
|
2875
|
-
let e = await
|
|
2876
|
-
F(
|
|
3068
|
+
let e = await Be(S.value.text);
|
|
3069
|
+
F(Me(S.value, e ? "copied" : "failed"));
|
|
2877
3070
|
return;
|
|
2878
3071
|
}
|
|
2879
|
-
if (!
|
|
2880
|
-
let t = await
|
|
2881
|
-
F(
|
|
3072
|
+
if (!We(e.editor, S.value)) return;
|
|
3073
|
+
let t = await Ae(e.editor);
|
|
3074
|
+
F(Me(je(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
2882
3075
|
}, re = (t, n) => {
|
|
2883
3076
|
if (e.readOnly) {
|
|
2884
|
-
|
|
3077
|
+
xt(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
|
|
2885
3078
|
return;
|
|
2886
3079
|
}
|
|
2887
3080
|
let r = e.state.active && e.state.pos === t.pos;
|
|
2888
|
-
|
|
3081
|
+
Ie(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
|
|
2889
3082
|
}, ie = (t) => {
|
|
2890
3083
|
if (e.readOnly || !S.value) return;
|
|
2891
3084
|
let n = e.state.active && e.state.pos === S.value.pos;
|
|
2892
|
-
|
|
3085
|
+
Fe(e.editor, S.value.pos, t) && (t === "mermaid" && Ie(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
|
|
2893
3086
|
}, ae = () => {
|
|
2894
|
-
e.readOnly || !S.value ||
|
|
3087
|
+
e.readOnly || !S.value || Pe(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
|
|
2895
3088
|
}, oe = () => {
|
|
2896
3089
|
if (!S.value) return;
|
|
2897
|
-
let t =
|
|
3090
|
+
let t = et(e.editor, S.value.pos);
|
|
2898
3091
|
if (!t) return;
|
|
2899
3092
|
let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
2900
3093
|
i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
|
|
2901
3094
|
}, se = () => {
|
|
2902
3095
|
if (!S.value) return;
|
|
2903
|
-
let t =
|
|
2904
|
-
t && (f.value =
|
|
3096
|
+
let t = et(e.editor, S.value.pos);
|
|
3097
|
+
t && (f.value = He(t), p.value = null, m.value = !1, h.value = {
|
|
2905
3098
|
active: !1,
|
|
2906
3099
|
lastX: 0,
|
|
2907
3100
|
lastY: 0
|
|
@@ -2909,23 +3102,23 @@ var Or = J({
|
|
|
2909
3102
|
}, ce = (e) => {
|
|
2910
3103
|
f.value = f.value ? {
|
|
2911
3104
|
...f.value,
|
|
2912
|
-
scale:
|
|
3105
|
+
scale: Re(f.value.scale + e)
|
|
2913
3106
|
} : null;
|
|
2914
3107
|
}, le = () => {
|
|
2915
|
-
f.value = f.value ?
|
|
3108
|
+
f.value = f.value ? He(f.value.svg) : null, h.value = {
|
|
2916
3109
|
active: !1,
|
|
2917
3110
|
lastX: 0,
|
|
2918
3111
|
lastY: 0
|
|
2919
3112
|
}, m.value = !1;
|
|
3113
|
+
}, z = (e) => {
|
|
3114
|
+
e.preventDefault(), ce(e.deltaY < 0 ? rt : -rt);
|
|
2920
3115
|
}, ue = (e) => {
|
|
2921
|
-
e.preventDefault(), ce(e.deltaY < 0 ? Ze : -Ze);
|
|
2922
|
-
}, de = (e) => {
|
|
2923
3116
|
e.button === 0 && (e.preventDefault(), h.value = {
|
|
2924
3117
|
active: !0,
|
|
2925
3118
|
lastX: e.clientX,
|
|
2926
3119
|
lastY: e.clientY
|
|
2927
3120
|
}, m.value = !0);
|
|
2928
|
-
},
|
|
3121
|
+
}, de = (e) => {
|
|
2929
3122
|
let t = h.value;
|
|
2930
3123
|
if (!t.active) return;
|
|
2931
3124
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
@@ -2933,7 +3126,7 @@ var Or = J({
|
|
|
2933
3126
|
active: !0,
|
|
2934
3127
|
lastX: e.clientX,
|
|
2935
3128
|
lastY: e.clientY
|
|
2936
|
-
}, f.value =
|
|
3129
|
+
}, f.value = it(f.value, n, r);
|
|
2937
3130
|
}, fe = () => {
|
|
2938
3131
|
h.value = {
|
|
2939
3132
|
active: !1,
|
|
@@ -2946,20 +3139,20 @@ var Or = J({
|
|
|
2946
3139
|
}), W(P, () => {
|
|
2947
3140
|
F(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
|
|
2948
3141
|
}), W(c, async (e) => {
|
|
2949
|
-
e && (await q(),
|
|
3142
|
+
e && (await q(), R(), r.value?.focus({ preventScroll: !0 }));
|
|
2950
3143
|
}), W(() => [
|
|
2951
3144
|
E.value,
|
|
2952
3145
|
g.value,
|
|
2953
3146
|
S.value?.pos ?? null,
|
|
2954
3147
|
c.value,
|
|
2955
|
-
|
|
3148
|
+
k.value
|
|
2956
3149
|
], async () => {
|
|
2957
|
-
await q(),
|
|
3150
|
+
await q(), R();
|
|
2958
3151
|
}, {
|
|
2959
3152
|
flush: "post",
|
|
2960
3153
|
immediate: !0
|
|
2961
|
-
}), W(
|
|
2962
|
-
await q(),
|
|
3154
|
+
}), W(M, async () => {
|
|
3155
|
+
await q(), L(), window.requestAnimationFrame(L);
|
|
2963
3156
|
}, {
|
|
2964
3157
|
flush: "post",
|
|
2965
3158
|
immediate: !0
|
|
@@ -2969,14 +3162,14 @@ var Or = J({
|
|
|
2969
3162
|
q(() => {
|
|
2970
3163
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
2971
3164
|
if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
|
|
2972
|
-
let r =
|
|
3165
|
+
let r = Xe(e.editor, n.target), a = Ze(e.editor, r), o = a && !tt(e.editor, a) ? a.pos : null;
|
|
2973
3166
|
i.value = i.value === o ? i.value : o;
|
|
2974
3167
|
}, a = () => {
|
|
2975
3168
|
c.value || (i.value = null);
|
|
2976
3169
|
}, o = (t) => {
|
|
2977
3170
|
if (t.key === "Escape") {
|
|
2978
3171
|
if (f.value) {
|
|
2979
|
-
|
|
3172
|
+
I();
|
|
2980
3173
|
return;
|
|
2981
3174
|
}
|
|
2982
3175
|
c.value && (c.value = !1, e.editor.view.focus());
|
|
@@ -2984,16 +3177,16 @@ var Or = J({
|
|
|
2984
3177
|
}, s = (e) => {
|
|
2985
3178
|
c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
|
|
2986
3179
|
}, l = ({ transaction: e }) => {
|
|
2987
|
-
e.getMeta(
|
|
3180
|
+
e.getMeta(ke) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(ke) || vt(e)) && (v.value += 1);
|
|
2988
3181
|
};
|
|
2989
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize",
|
|
2990
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize",
|
|
3182
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", R), window.addEventListener("scroll", R, !0), window.addEventListener("resize", L), window.addEventListener("scroll", L, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), pe = () => {
|
|
3183
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", R), window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", L), window.removeEventListener("scroll", L, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), te();
|
|
2991
3184
|
};
|
|
2992
3185
|
});
|
|
2993
3186
|
}), K(() => {
|
|
2994
3187
|
pe?.(), pe = null, te();
|
|
2995
3188
|
}), () => {
|
|
2996
|
-
if (!E.value &&
|
|
3189
|
+
if (!E.value && j.value.length === 0 && !f.value) return null;
|
|
2997
3190
|
let i = a.value ? {
|
|
2998
3191
|
top: `${a.value.top}px`,
|
|
2999
3192
|
right: `${a.value.right}px`
|
|
@@ -3007,7 +3200,7 @@ var Or = J({
|
|
|
3007
3200
|
"data-testid": "markweave-codeblock-overlay",
|
|
3008
3201
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
3009
3202
|
}, [
|
|
3010
|
-
...
|
|
3203
|
+
...j.value.map((e) => {
|
|
3011
3204
|
let t = o.value.find((t) => t.pos === e.pos);
|
|
3012
3205
|
return B("div", {
|
|
3013
3206
|
key: e.pos,
|
|
@@ -3041,7 +3234,7 @@ var Or = J({
|
|
|
3041
3234
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
3042
3235
|
"aria-label": "Code block language",
|
|
3043
3236
|
"data-testid": "markweave-codeblock-language"
|
|
3044
|
-
}, [B("span", null,
|
|
3237
|
+
}, [B("span", null, D.value)]) : B("button", {
|
|
3045
3238
|
ref: n,
|
|
3046
3239
|
type: "button",
|
|
3047
3240
|
class: "markweave-codeblock-language-button",
|
|
@@ -3053,8 +3246,8 @@ var Or = J({
|
|
|
3053
3246
|
onClick: () => {
|
|
3054
3247
|
c.value = !c.value;
|
|
3055
3248
|
}
|
|
3056
|
-
}, [B("span", null,
|
|
3057
|
-
|
|
3249
|
+
}, [B("span", null, D.value), Q("chevron")]),
|
|
3250
|
+
ee.value ? B("button", {
|
|
3058
3251
|
type: "button",
|
|
3059
3252
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
3060
3253
|
"aria-label": T.value ? "Expand code block" : "Collapse code block",
|
|
@@ -3069,7 +3262,7 @@ var Or = J({
|
|
|
3069
3262
|
class: "markweave-codeblock-icon-button",
|
|
3070
3263
|
"aria-label": "Copy to clipboard",
|
|
3071
3264
|
"data-testid": "markweave-codeblock-copy",
|
|
3072
|
-
"data-copy-state":
|
|
3265
|
+
"data-copy-state": O.value,
|
|
3073
3266
|
onMousedown: $,
|
|
3074
3267
|
onMouseenter: () => {
|
|
3075
3268
|
d.value = !0;
|
|
@@ -3084,14 +3277,14 @@ var Or = J({
|
|
|
3084
3277
|
d.value = !1;
|
|
3085
3278
|
},
|
|
3086
3279
|
onClick: () => {
|
|
3087
|
-
|
|
3280
|
+
ne();
|
|
3088
3281
|
}
|
|
3089
|
-
}, [Q(
|
|
3282
|
+
}, [Q(O.value === "copied" ? "check" : "clipboard")]), d.value ? B("span", {
|
|
3090
3283
|
class: "markweave-codeblock-tooltip",
|
|
3091
3284
|
role: "tooltip",
|
|
3092
3285
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
3093
3286
|
}, "Copy to clipboard") : null]),
|
|
3094
|
-
w.value &&
|
|
3287
|
+
w.value && k.value === "preview" ? B("div", {
|
|
3095
3288
|
class: "markweave-mermaid-preview-actions",
|
|
3096
3289
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
3097
3290
|
}, [B("button", {
|
|
@@ -3099,7 +3292,7 @@ var Or = J({
|
|
|
3099
3292
|
class: "markweave-codeblock-icon-button",
|
|
3100
3293
|
"aria-label": "Fullscreen Mermaid preview",
|
|
3101
3294
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
3102
|
-
disabled: !
|
|
3295
|
+
disabled: !A.value,
|
|
3103
3296
|
onMousedown: $,
|
|
3104
3297
|
onClick: se
|
|
3105
3298
|
}, [Q("expand")]), B("button", {
|
|
@@ -3107,12 +3300,12 @@ var Or = J({
|
|
|
3107
3300
|
class: "markweave-codeblock-icon-button",
|
|
3108
3301
|
"aria-label": "Download Mermaid SVG",
|
|
3109
3302
|
"data-testid": "markweave-mermaid-download",
|
|
3110
|
-
disabled: !
|
|
3303
|
+
disabled: !A.value,
|
|
3111
3304
|
onMousedown: $,
|
|
3112
3305
|
onClick: oe
|
|
3113
3306
|
}, [Q("download")])]) : null
|
|
3114
3307
|
]) : null,
|
|
3115
|
-
|
|
3308
|
+
ee.value && E.value && c.value && S.value ? B("div", {
|
|
3116
3309
|
class: "markweave-codeblock-language-menu",
|
|
3117
3310
|
role: "listbox",
|
|
3118
3311
|
"aria-label": "Code block languages",
|
|
@@ -3130,7 +3323,7 @@ var Or = J({
|
|
|
3130
3323
|
onKeydown: (t) => {
|
|
3131
3324
|
t.key === "Escape" && (t.preventDefault(), c.value = !1, e.editor.view.focus());
|
|
3132
3325
|
}
|
|
3133
|
-
}), Q("search")]), B("div", { class: "markweave-codeblock-language-list" },
|
|
3326
|
+
}), Q("search")]), B("div", { class: "markweave-codeblock-language-list" }, N.value.map((e) => {
|
|
3134
3327
|
let t = S.value?.language === e.language;
|
|
3135
3328
|
return B("button", {
|
|
3136
3329
|
key: e.language,
|
|
@@ -3171,12 +3364,12 @@ var Or = J({
|
|
|
3171
3364
|
onBlur: () => {
|
|
3172
3365
|
p.value = null;
|
|
3173
3366
|
},
|
|
3174
|
-
onClick: () => ce(-
|
|
3367
|
+
onClick: () => ce(-rt)
|
|
3175
3368
|
}, [Q("zoomOut")]),
|
|
3176
3369
|
B("span", {
|
|
3177
3370
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
3178
3371
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
3179
|
-
},
|
|
3372
|
+
}, Ke(f.value.scale)),
|
|
3180
3373
|
B("button", {
|
|
3181
3374
|
type: "button",
|
|
3182
3375
|
class: "markweave-mermaid-fullscreen-control",
|
|
@@ -3194,7 +3387,7 @@ var Or = J({
|
|
|
3194
3387
|
onBlur: () => {
|
|
3195
3388
|
p.value = null;
|
|
3196
3389
|
},
|
|
3197
|
-
onClick: () => ce(
|
|
3390
|
+
onClick: () => ce(rt)
|
|
3198
3391
|
}, [Q("zoomIn")]),
|
|
3199
3392
|
B("button", {
|
|
3200
3393
|
type: "button",
|
|
@@ -3226,15 +3419,15 @@ var Or = J({
|
|
|
3226
3419
|
class: "markweave-mermaid-fullscreen-close",
|
|
3227
3420
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
3228
3421
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
3229
|
-
onClick:
|
|
3422
|
+
onClick: I
|
|
3230
3423
|
}, [Q("close")]),
|
|
3231
3424
|
B("div", {
|
|
3232
3425
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
3233
3426
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
3234
3427
|
"data-dragging": m.value ? "true" : "false",
|
|
3235
|
-
onWheel:
|
|
3236
|
-
onMousedown:
|
|
3237
|
-
onMousemove:
|
|
3428
|
+
onWheel: z,
|
|
3429
|
+
onMousedown: ue,
|
|
3430
|
+
onMousemove: de,
|
|
3238
3431
|
onMouseup: fe,
|
|
3239
3432
|
onMouseleave: fe
|
|
3240
3433
|
}, [B("div", {
|
|
@@ -3253,7 +3446,7 @@ var Or = J({
|
|
|
3253
3446
|
]);
|
|
3254
3447
|
};
|
|
3255
3448
|
}
|
|
3256
|
-
}),
|
|
3449
|
+
}), Gr = J({
|
|
3257
3450
|
name: "MarkweaveVueInnerToc",
|
|
3258
3451
|
props: {
|
|
3259
3452
|
editor: {
|
|
@@ -3279,7 +3472,7 @@ var Or = J({
|
|
|
3279
3472
|
},
|
|
3280
3473
|
setup(e) {
|
|
3281
3474
|
let t = V(null), n, r = () => {
|
|
3282
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
3475
|
+
n?.(), n = e.placement === "container" && t.value ? De(t.value) : void 0;
|
|
3283
3476
|
};
|
|
3284
3477
|
return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
|
|
3285
3478
|
ref: t,
|
|
@@ -3302,33 +3495,34 @@ var Or = J({
|
|
|
3302
3495
|
"aria-current": t.active ? "location" : void 0,
|
|
3303
3496
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
3304
3497
|
title: t.text,
|
|
3305
|
-
onClick: () =>
|
|
3498
|
+
onClick: () => Oe(e.editor, t, {
|
|
3306
3499
|
behavior: "smooth",
|
|
3307
3500
|
focus: e.editable
|
|
3308
3501
|
})
|
|
3309
3502
|
}, t.text)))])]) : null;
|
|
3310
3503
|
}
|
|
3311
3504
|
});
|
|
3312
|
-
function
|
|
3313
|
-
let
|
|
3314
|
-
function T() {
|
|
3315
|
-
w !== null && (window.clearTimeout(w), w = null), s.value += 1;
|
|
3316
|
-
}
|
|
3505
|
+
function Kr(e = {}) {
|
|
3506
|
+
let i = r(e.lang), o = n(i), s = t(i), c = V(f(e.mode)), l = U(() => be(e.theme)), u = U(() => c.value === "live" && e.editable !== !1), d = V(0), m = H(null), h = V(At), g = H(null), _ = H(null), v = V("code"), y = H(null), b = H(Lt), x = V(null), S = V(!1), C = H(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = null;
|
|
3317
3507
|
function E() {
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3508
|
+
T !== null && (window.clearTimeout(T), T = null), d.value += 1;
|
|
3509
|
+
}
|
|
3510
|
+
function ee() {
|
|
3511
|
+
T !== null && window.clearTimeout(T), T = window.setTimeout(() => {
|
|
3512
|
+
T = null, d.value += 1;
|
|
3513
|
+
}, ve);
|
|
3321
3514
|
}
|
|
3322
3515
|
let D = e.onSlashCommandUpload, O = H(null);
|
|
3323
|
-
O.value = new
|
|
3324
|
-
extensions:
|
|
3325
|
-
lang:
|
|
3326
|
-
|
|
3327
|
-
|
|
3516
|
+
O.value = new a({
|
|
3517
|
+
extensions: Dr({
|
|
3518
|
+
lang: i,
|
|
3519
|
+
linkCardResolver: e.linkCardResolver,
|
|
3520
|
+
onImageUpload: (e) => D?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
3521
|
+
onVideoUpload: (e) => D?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
|
|
3328
3522
|
}),
|
|
3329
3523
|
content: e.content ?? e.defaultContent ?? "",
|
|
3330
|
-
contentType:
|
|
3331
|
-
editable:
|
|
3524
|
+
contentType: re(w),
|
|
3525
|
+
editable: u.value,
|
|
3332
3526
|
autofocus: e.autofocus,
|
|
3333
3527
|
editorProps: {
|
|
3334
3528
|
attributes: {
|
|
@@ -3340,37 +3534,37 @@ function Fr(e = {}) {
|
|
|
3340
3534
|
translate: "no"
|
|
3341
3535
|
},
|
|
3342
3536
|
handleClick: (e, t, n) => {
|
|
3343
|
-
if (!
|
|
3344
|
-
let r =
|
|
3345
|
-
return r ? (n.preventDefault(), n.stopPropagation(), A(),
|
|
3537
|
+
if (!u.value) return pe(n);
|
|
3538
|
+
let r = ft(e, n);
|
|
3539
|
+
return r ? (n.preventDefault(), n.stopPropagation(), A(), gt(e, r, !0), _t(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
3346
3540
|
},
|
|
3347
3541
|
handleDOMEvents: {
|
|
3348
|
-
compositionstart: () =>
|
|
3349
|
-
compositionend: (e) => (
|
|
3542
|
+
compositionstart: () => u.value ? (h.value = jt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
3543
|
+
compositionend: (e) => (u.value && window.setTimeout(() => j(e), 0), !1),
|
|
3350
3544
|
click: (e, t) => {
|
|
3351
|
-
if (!
|
|
3352
|
-
let n =
|
|
3353
|
-
return n ? (t.preventDefault(), t.stopPropagation(), A(),
|
|
3545
|
+
if (!u.value) return pe(t);
|
|
3546
|
+
let n = ft(e, t);
|
|
3547
|
+
return n ? (t.preventDefault(), t.stopPropagation(), A(), gt(e, n, !0), _t(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
3354
3548
|
}
|
|
3355
3549
|
}
|
|
3356
3550
|
},
|
|
3357
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
3551
|
+
onSelectionUpdate: ({ editor: e }) => N(e),
|
|
3358
3552
|
onCreate: ({ editor: t }) => {
|
|
3359
|
-
|
|
3360
|
-
mode:
|
|
3361
|
-
editable:
|
|
3362
|
-
}),
|
|
3553
|
+
p(t, {
|
|
3554
|
+
mode: c.value,
|
|
3555
|
+
editable: u.value
|
|
3556
|
+
}), yt(t, l.value), bt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Pt(t), P(t), N(t), E();
|
|
3363
3557
|
},
|
|
3364
3558
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
3365
|
-
if (
|
|
3366
|
-
let t =
|
|
3367
|
-
|
|
3559
|
+
if (P(e), (t.docChanged || vt(t)) && ee(), t.docChanged && y.value) {
|
|
3560
|
+
let t = dt(e, y.value.pos);
|
|
3561
|
+
y.value = t?.kind === y.value.kind ? t : null;
|
|
3368
3562
|
}
|
|
3369
3563
|
},
|
|
3370
3564
|
onUpdate: ({ editor: t }) => {
|
|
3371
|
-
|
|
3372
|
-
let i =
|
|
3373
|
-
e.content !== void 0 && n === i && (
|
|
3565
|
+
N(t), u.value && M(t), S.value || e.onUpdate?.(ne(t, { onContentRead: (n, r) => {
|
|
3566
|
+
let i = oe(e.contentFormat);
|
|
3567
|
+
e.content !== void 0 && n === i && (C.value = {
|
|
3374
3568
|
content: r,
|
|
3375
3569
|
format: n,
|
|
3376
3570
|
doc: t.state.doc
|
|
@@ -3380,169 +3574,171 @@ function Fr(e = {}) {
|
|
|
3380
3574
|
});
|
|
3381
3575
|
let k = U(() => O.value ?? null);
|
|
3382
3576
|
function A() {
|
|
3383
|
-
|
|
3577
|
+
g.value = null, _.value = null, h.value = At;
|
|
3384
3578
|
}
|
|
3385
|
-
function
|
|
3386
|
-
let t =
|
|
3579
|
+
function j(e) {
|
|
3580
|
+
let t = kt(e.state);
|
|
3387
3581
|
if (!t) {
|
|
3388
|
-
|
|
3582
|
+
h.value = h.value.name === "idle" ? h.value : At, g.value = null, _.value = null;
|
|
3389
3583
|
return;
|
|
3390
3584
|
}
|
|
3391
3585
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3392
|
-
|
|
3586
|
+
g.value = Ot(n, {
|
|
3393
3587
|
frameRect: i,
|
|
3394
3588
|
triggerRect: r
|
|
3395
|
-
}),
|
|
3589
|
+
}), h.value = Dt(h.value, t);
|
|
3590
|
+
}
|
|
3591
|
+
function M(e) {
|
|
3592
|
+
j(e.view);
|
|
3396
3593
|
}
|
|
3397
3594
|
function N(e) {
|
|
3398
|
-
|
|
3595
|
+
let t = _e(e);
|
|
3596
|
+
he(m.value, t) || (m.value = t);
|
|
3597
|
+
let n = pt(e);
|
|
3598
|
+
n && (ht(e, n, !0), y.value = n);
|
|
3599
|
+
let r = je(e);
|
|
3600
|
+
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
3399
3601
|
}
|
|
3400
3602
|
function P(e) {
|
|
3401
|
-
|
|
3402
|
-
de(c.value, t) || (c.value = t);
|
|
3403
|
-
let n = st(e);
|
|
3404
|
-
n && (lt(e, n, !0), v.value = n);
|
|
3405
|
-
let r = Te(e);
|
|
3406
|
-
r.active && r.language === "mermaid" && (_.value = r.mermaidPreviewMode);
|
|
3407
|
-
}
|
|
3408
|
-
function R(e) {
|
|
3409
|
-
y.value = yr(e);
|
|
3603
|
+
b.value = Ar(e);
|
|
3410
3604
|
}
|
|
3411
|
-
let
|
|
3412
|
-
active:
|
|
3413
|
-
mode:
|
|
3414
|
-
source:
|
|
3415
|
-
}) :
|
|
3605
|
+
let F = U(() => k.value ? je(k.value) : kr), I = U(() => k.value ? Ft(k.value.state) : Or), R = U(() => m.value?.currentNode === "codeBlock"), se = U(() => R.value && F.value.language === "mermaid"), ce = U(() => k.value ? St({
|
|
3606
|
+
active: se.value,
|
|
3607
|
+
mode: v.value,
|
|
3608
|
+
source: F.value.text
|
|
3609
|
+
}) : St({
|
|
3416
3610
|
active: !1,
|
|
3417
3611
|
mode: "code",
|
|
3418
3612
|
source: ""
|
|
3419
|
-
})),
|
|
3420
|
-
revision:
|
|
3421
|
-
mode:
|
|
3422
|
-
editable:
|
|
3423
|
-
toc:
|
|
3424
|
-
selection:
|
|
3425
|
-
slash:
|
|
3426
|
-
table:
|
|
3427
|
-
tableInteraction:
|
|
3428
|
-
codeBlock:
|
|
3429
|
-
mermaid:
|
|
3430
|
-
tableDebugSnapshot:
|
|
3431
|
-
})),
|
|
3613
|
+
})), le = U(() => k.value ? Nt(k.value.state) : null), z = U(() => k.value ? we(k.value.state.doc) : Se.items), ue = U(() => Te(z.value, x.value)), de = U(() => xe(z.value, ue.value)), fe = U(() => Ct(h.value.query, s)), ge = U(() => me({
|
|
3614
|
+
revision: d.value,
|
|
3615
|
+
mode: c.value,
|
|
3616
|
+
editable: u.value,
|
|
3617
|
+
toc: de.value,
|
|
3618
|
+
selection: m.value,
|
|
3619
|
+
slash: h.value,
|
|
3620
|
+
table: I.value,
|
|
3621
|
+
tableInteraction: b.value,
|
|
3622
|
+
codeBlock: F.value,
|
|
3623
|
+
mermaid: ce.value,
|
|
3624
|
+
tableDebugSnapshot: le.value
|
|
3625
|
+
})), ye = {
|
|
3432
3626
|
closeSlashMenu: A,
|
|
3433
|
-
focusFirstTableBodyCell: () => k.value ?
|
|
3627
|
+
focusFirstTableBodyCell: () => k.value ? Pt(k.value) : !1,
|
|
3434
3628
|
setContent: (e, t = {}) => {
|
|
3435
3629
|
if (!k.value) return !1;
|
|
3436
|
-
let n =
|
|
3630
|
+
let n = oe(t.format);
|
|
3437
3631
|
return k.value.commands.setContent(e, {
|
|
3438
|
-
contentType:
|
|
3632
|
+
contentType: re(n),
|
|
3439
3633
|
emitUpdate: t.emitUpdate ?? !1
|
|
3440
|
-
}), t.focusFirstTableBodyCell &&
|
|
3634
|
+
}), t.focusFirstTableBodyCell && Pt(k.value), N(k.value), u.value && M(k.value), P(k.value), E(), !0;
|
|
3441
3635
|
}
|
|
3442
3636
|
};
|
|
3443
|
-
function
|
|
3444
|
-
if (!(!k.value || !
|
|
3637
|
+
function Ee(e, t) {
|
|
3638
|
+
if (!(!k.value || !u.value || !wt(e))) {
|
|
3445
3639
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
3446
|
-
|
|
3640
|
+
_.value = e;
|
|
3447
3641
|
return;
|
|
3448
3642
|
}
|
|
3449
|
-
|
|
3643
|
+
Et(k.value, h.value, e, t), h.value = jt(h.value, { type: "execute" }), A();
|
|
3450
3644
|
}
|
|
3451
3645
|
}
|
|
3452
|
-
function
|
|
3453
|
-
if (!k.value ||
|
|
3454
|
-
let t =
|
|
3646
|
+
function De(e) {
|
|
3647
|
+
if (!k.value || _.value || !u.value) return;
|
|
3648
|
+
let t = Tt(h.value, fe.value, e.key, { isComposing: e.isComposing || L(k.value.state) });
|
|
3455
3649
|
if (t.type !== "ignore") {
|
|
3456
3650
|
if (e.preventDefault(), t.type === "close") {
|
|
3457
|
-
|
|
3651
|
+
h.value = jt(h.value, { type: "escape" }), A();
|
|
3458
3652
|
return;
|
|
3459
3653
|
}
|
|
3460
3654
|
if (t.type === "move-active") {
|
|
3461
|
-
|
|
3655
|
+
h.value = jt(h.value, {
|
|
3462
3656
|
type: "move-active",
|
|
3463
3657
|
delta: t.delta,
|
|
3464
3658
|
optionCount: t.optionCount
|
|
3465
3659
|
});
|
|
3466
3660
|
return;
|
|
3467
3661
|
}
|
|
3468
|
-
|
|
3662
|
+
Ee(t.command);
|
|
3469
3663
|
}
|
|
3470
3664
|
}
|
|
3471
3665
|
W(() => [e.mode, e.editable], () => {
|
|
3472
|
-
|
|
3473
|
-
mode:
|
|
3474
|
-
editable:
|
|
3475
|
-
}),
|
|
3666
|
+
c.value = f(e.mode), k.value && (k.value.setEditable(u.value), p(k.value, {
|
|
3667
|
+
mode: c.value,
|
|
3668
|
+
editable: u.value
|
|
3669
|
+
}), bt(k.value, u.value ? "live" : "view"), E(), u.value || A());
|
|
3670
|
+
}, { immediate: !0 }), W(() => e.theme, () => {
|
|
3671
|
+
k.value && yt(k.value, l.value);
|
|
3476
3672
|
}, { immediate: !0 }), W(() => e.content, (t) => {
|
|
3477
|
-
let n =
|
|
3673
|
+
let n = oe(e.contentFormat);
|
|
3478
3674
|
if (!(!k.value || t === void 0)) {
|
|
3479
|
-
if (
|
|
3480
|
-
|
|
3675
|
+
if (ae(k.value, C.value, t, n)) {
|
|
3676
|
+
C.value = null;
|
|
3481
3677
|
return;
|
|
3482
3678
|
}
|
|
3483
|
-
|
|
3484
|
-
contentType:
|
|
3679
|
+
C.value = null, !ie(k.value, t, n) && (S.value = !0, k.value.commands.setContent(t, {
|
|
3680
|
+
contentType: re(n),
|
|
3485
3681
|
emitUpdate: !1
|
|
3486
|
-
}),
|
|
3682
|
+
}), S.value = !1, N(k.value), u.value && M(k.value), P(k.value), E());
|
|
3487
3683
|
}
|
|
3488
|
-
}), W(
|
|
3489
|
-
let t =
|
|
3490
|
-
|
|
3684
|
+
}), W(ge, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(de, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
|
|
3685
|
+
let t = Te(e, x.value);
|
|
3686
|
+
x.value !== t && (x.value = t);
|
|
3491
3687
|
});
|
|
3492
|
-
let
|
|
3688
|
+
let Oe = null;
|
|
3493
3689
|
return K(() => {
|
|
3494
|
-
|
|
3690
|
+
T !== null && window.clearTimeout(T);
|
|
3495
3691
|
}), G(() => {
|
|
3496
3692
|
let e = () => {
|
|
3497
3693
|
if (!k.value || !z.value.length) {
|
|
3498
|
-
|
|
3694
|
+
x.value = null;
|
|
3499
3695
|
return;
|
|
3500
3696
|
}
|
|
3501
3697
|
let e = null;
|
|
3502
3698
|
try {
|
|
3503
|
-
e =
|
|
3699
|
+
e = Ce(k.value, z.value);
|
|
3504
3700
|
} catch {
|
|
3505
3701
|
return;
|
|
3506
3702
|
}
|
|
3507
|
-
|
|
3508
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
3509
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
3703
|
+
x.value !== e && (x.value = e);
|
|
3704
|
+
}, t = () => window.requestAnimationFrame(e), n = jr(k.value?.view.dom ?? null);
|
|
3705
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
|
|
3510
3706
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
3511
3707
|
};
|
|
3512
3708
|
}), K(() => {
|
|
3513
|
-
|
|
3709
|
+
Oe?.();
|
|
3514
3710
|
let e = O.value;
|
|
3515
3711
|
O.value = null, q(() => e?.destroy());
|
|
3516
3712
|
}), {
|
|
3517
3713
|
editor: k,
|
|
3518
|
-
runtimeSnapshot:
|
|
3519
|
-
actions:
|
|
3714
|
+
runtimeSnapshot: ge,
|
|
3715
|
+
actions: ye,
|
|
3520
3716
|
__render: {
|
|
3521
|
-
messages:
|
|
3522
|
-
effectiveEditable:
|
|
3523
|
-
tableFocusState:
|
|
3524
|
-
tableInteractionState:
|
|
3525
|
-
codeBlockState:
|
|
3526
|
-
isCodeBlockActive:
|
|
3527
|
-
mermaidMode:
|
|
3528
|
-
mathTarget:
|
|
3717
|
+
messages: o,
|
|
3718
|
+
effectiveEditable: u,
|
|
3719
|
+
tableFocusState: I,
|
|
3720
|
+
tableInteractionState: b,
|
|
3721
|
+
codeBlockState: F,
|
|
3722
|
+
isCodeBlockActive: R,
|
|
3723
|
+
mermaidMode: v,
|
|
3724
|
+
mathTarget: y,
|
|
3529
3725
|
setMermaidMode: (e) => {
|
|
3530
|
-
|
|
3726
|
+
v.value = e;
|
|
3531
3727
|
},
|
|
3532
|
-
tocState:
|
|
3533
|
-
filteredSlashCommands:
|
|
3534
|
-
slashState:
|
|
3535
|
-
slashMenuPosition:
|
|
3536
|
-
slashInputCommand:
|
|
3537
|
-
runSlashCommand:
|
|
3538
|
-
handleEditorKeyDown:
|
|
3728
|
+
tocState: de,
|
|
3729
|
+
filteredSlashCommands: fe,
|
|
3730
|
+
slashState: h,
|
|
3731
|
+
slashMenuPosition: g,
|
|
3732
|
+
slashInputCommand: _,
|
|
3733
|
+
runSlashCommand: Ee,
|
|
3734
|
+
handleEditorKeyDown: De,
|
|
3539
3735
|
setSlashInputCommand: (e) => {
|
|
3540
|
-
|
|
3736
|
+
_.value = e;
|
|
3541
3737
|
}
|
|
3542
3738
|
}
|
|
3543
3739
|
};
|
|
3544
3740
|
}
|
|
3545
|
-
var
|
|
3741
|
+
var qr = J({
|
|
3546
3742
|
name: "MarkweaveEditor",
|
|
3547
3743
|
props: {
|
|
3548
3744
|
defaultContent: {
|
|
@@ -3569,6 +3765,10 @@ var Ir = J({
|
|
|
3569
3765
|
type: String,
|
|
3570
3766
|
default: "live"
|
|
3571
3767
|
},
|
|
3768
|
+
theme: {
|
|
3769
|
+
type: String,
|
|
3770
|
+
default: "light"
|
|
3771
|
+
},
|
|
3572
3772
|
innerToc: {
|
|
3573
3773
|
type: Boolean,
|
|
3574
3774
|
default: !0
|
|
@@ -3593,6 +3793,10 @@ var Ir = J({
|
|
|
3593
3793
|
type: Boolean,
|
|
3594
3794
|
default: !1
|
|
3595
3795
|
},
|
|
3796
|
+
linkCardResolver: {
|
|
3797
|
+
type: Function,
|
|
3798
|
+
default: void 0
|
|
3799
|
+
},
|
|
3596
3800
|
className: {
|
|
3597
3801
|
type: String,
|
|
3598
3802
|
default: void 0
|
|
@@ -3635,74 +3839,75 @@ var Ir = J({
|
|
|
3635
3839
|
}
|
|
3636
3840
|
},
|
|
3637
3841
|
setup(e) {
|
|
3638
|
-
let t =
|
|
3842
|
+
let t = Kr(e);
|
|
3639
3843
|
return () => {
|
|
3640
3844
|
let n = t.editor.value;
|
|
3641
3845
|
if (!n) return null;
|
|
3642
|
-
let
|
|
3846
|
+
let r = t.__render;
|
|
3643
3847
|
return B("section", {
|
|
3644
3848
|
class: ["markweave-editor-frame", e.className].filter(Boolean).join(" "),
|
|
3645
|
-
"aria-label": e.ariaLabel ??
|
|
3849
|
+
"aria-label": e.ariaLabel ?? r.messages.common.editorAriaLabel,
|
|
3646
3850
|
"data-testid": "markweave-editor-frame",
|
|
3647
3851
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
3852
|
+
"data-markweave-theme": be(e.theme),
|
|
3648
3853
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
3649
|
-
"data-markweave-inner-toc-placement":
|
|
3854
|
+
"data-markweave-inner-toc-placement": Ee(e.innerTocPlacement),
|
|
3650
3855
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
3651
|
-
"data-table-focus-mode":
|
|
3652
|
-
onKeydownCapture:
|
|
3856
|
+
"data-table-focus-mode": r.tableFocusState.value.mode,
|
|
3857
|
+
onKeydownCapture: r.handleEditorKeyDown
|
|
3653
3858
|
}, [
|
|
3654
|
-
|
|
3859
|
+
r.effectiveEditable.value ? B(zr, {
|
|
3655
3860
|
editor: n,
|
|
3656
|
-
messages:
|
|
3861
|
+
messages: r.messages
|
|
3657
3862
|
}) : null,
|
|
3658
|
-
|
|
3659
|
-
commands:
|
|
3660
|
-
state:
|
|
3661
|
-
position:
|
|
3662
|
-
inputCommand:
|
|
3663
|
-
messages:
|
|
3664
|
-
onSelect:
|
|
3665
|
-
onInputCommandChange:
|
|
3863
|
+
r.effectiveEditable.value ? B(Vr, {
|
|
3864
|
+
commands: r.filteredSlashCommands.value,
|
|
3865
|
+
state: r.slashState.value,
|
|
3866
|
+
position: r.slashMenuPosition.value,
|
|
3867
|
+
inputCommand: r.slashInputCommand.value,
|
|
3868
|
+
messages: r.messages,
|
|
3869
|
+
onSelect: r.runSlashCommand,
|
|
3870
|
+
onInputCommandChange: r.setSlashInputCommand,
|
|
3666
3871
|
onUpload: e.onSlashCommandUpload
|
|
3667
3872
|
}) : null,
|
|
3668
|
-
|
|
3873
|
+
r.effectiveEditable.value ? B(Hr, {
|
|
3669
3874
|
editor: n,
|
|
3670
|
-
active:
|
|
3671
|
-
interactionState:
|
|
3672
|
-
messages:
|
|
3875
|
+
active: r.tableFocusState.value.active,
|
|
3876
|
+
interactionState: r.tableInteractionState.value,
|
|
3877
|
+
messages: r.messages,
|
|
3673
3878
|
onCopyPayload: e.onTableCopyPayload,
|
|
3674
3879
|
onCommandResult: e.onTableCommandResult,
|
|
3675
3880
|
onEditWithAi: e.onEditWithAi
|
|
3676
3881
|
}) : null,
|
|
3677
|
-
|
|
3882
|
+
r.effectiveEditable.value ? B(Ur, {
|
|
3678
3883
|
editor: n,
|
|
3679
|
-
focusState:
|
|
3884
|
+
focusState: r.tableFocusState.value
|
|
3680
3885
|
}) : null,
|
|
3681
|
-
B(
|
|
3886
|
+
B(Wr, {
|
|
3682
3887
|
editor: n,
|
|
3683
|
-
state:
|
|
3684
|
-
active:
|
|
3685
|
-
mermaidMode:
|
|
3686
|
-
onMermaidModeChange:
|
|
3687
|
-
readOnly: !
|
|
3888
|
+
state: r.codeBlockState.value,
|
|
3889
|
+
active: r.effectiveEditable.value && r.isCodeBlockActive.value,
|
|
3890
|
+
mermaidMode: r.mermaidMode.value,
|
|
3891
|
+
onMermaidModeChange: r.setMermaidMode,
|
|
3892
|
+
readOnly: !r.effectiveEditable.value
|
|
3688
3893
|
}),
|
|
3689
|
-
e.innerToc &&
|
|
3894
|
+
e.innerToc && r.tocState.value.items.length ? B(Gr, {
|
|
3690
3895
|
editor: n,
|
|
3691
|
-
state:
|
|
3692
|
-
messages:
|
|
3693
|
-
editable:
|
|
3694
|
-
placement:
|
|
3896
|
+
state: r.tocState.value,
|
|
3897
|
+
messages: r.messages,
|
|
3898
|
+
editable: r.effectiveEditable.value,
|
|
3899
|
+
placement: Ee(e.innerTocPlacement)
|
|
3695
3900
|
}) : null,
|
|
3696
|
-
|
|
3901
|
+
r.effectiveEditable.value && r.mathTarget.value ? B(Br, {
|
|
3697
3902
|
editor: n,
|
|
3698
|
-
messages:
|
|
3699
|
-
target:
|
|
3700
|
-
onClose: () =>
|
|
3903
|
+
messages: r.messages,
|
|
3904
|
+
target: r.mathTarget.value,
|
|
3905
|
+
onClose: () => r.mathTarget.value = null
|
|
3701
3906
|
}) : null,
|
|
3702
|
-
B(
|
|
3907
|
+
B(o, { editor: n })
|
|
3703
3908
|
]);
|
|
3704
3909
|
};
|
|
3705
3910
|
}
|
|
3706
3911
|
});
|
|
3707
3912
|
//#endregion
|
|
3708
|
-
export {
|
|
3913
|
+
export { qr as MarkweaveEditor, Dr as createMarkweaveEditorExtensions, Dr as createMarkweaveVue2EditorExtensions, Kr as useMarkweaveEditorController };
|