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