@markweave/vue2 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +38 -36
- package/dist/index.js +1061 -1048
- package/dist/types/MarkweaveEditor.d.ts +2 -0
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/create-editor-extensions.d.ts +2 -0
- 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/package.json +8 -6
package/dist/index.js
CHANGED
|
@@ -10,60 +10,61 @@ import { normalizeMarkweaveLinkCardAttrs as g, normalizeMarkweaveLinkCardHref as
|
|
|
10
10
|
import { openMarkweaveImagePreview as y } from "markweave/internal/plugins/media/image-preview";
|
|
11
11
|
import { createMarkweaveLightweightImageNodeViewRenderer as b } from "markweave/internal/plugins/media/lightweight-image-node-view";
|
|
12
12
|
import { resolveMarkweaveMediaSource as x } from "markweave/internal/plugins/media/media-source";
|
|
13
|
-
import { MarkweaveCoreImage as S, MarkweaveCoreVideo as C, attrsFromMarkweaveImageUploadResult as
|
|
14
|
-
import { activateMarkweaveAttachmentDownload as
|
|
15
|
-
import { MarkweaveAttachment as
|
|
16
|
-
import { detectUploadSource as
|
|
17
|
-
import { createMarkweaveAiEditController as
|
|
18
|
-
import { BubbleMenu as
|
|
19
|
-
import { isEditorComposing as
|
|
20
|
-
import { saveMarkweaveBrowserFile as
|
|
21
|
-
import { createMarkweaveFrameScheduler as
|
|
22
|
-
import { createMarkweaveEditorUpdatePayload as
|
|
23
|
-
import { getCurrentFloatingToolbarBlockType as
|
|
24
|
-
import { openMarkweaveReadonlyLinkFromEvent as
|
|
25
|
-
import { createMarkweaveEditorRuntimeSnapshot as
|
|
26
|
-
import { areEditorSelectionSnapshotsEquivalent as
|
|
27
|
-
import { normalizeMarkweaveCanvasColor as
|
|
28
|
-
import { createMarkweaveAiEditController as
|
|
29
|
-
import { MarkweaveAskAiError as
|
|
30
|
-
import { createMarkweaveTocState as
|
|
31
|
-
import { codeBlockCollapsePluginKey as
|
|
32
|
-
import { calculateCodeBlockLanguageMenuPosition as
|
|
33
|
-
import { normalizeMarkdownLinkHref as
|
|
34
|
-
import { applyMarkweaveMathLatex as
|
|
35
|
-
import { isMermaidInlinePreviewTransaction as
|
|
36
|
-
import { getMermaidPreviewState as
|
|
37
|
-
import { createResolvedSlashCommandSpecs as
|
|
38
|
-
import { getSlashCommandKeyboardAction as
|
|
39
|
-
import { scrollSlashCommandItemIntoView as
|
|
40
|
-
import { areSlashCommandMenuPositionsEquivalent as
|
|
41
|
-
import { createMarkweaveCommandController as
|
|
42
|
-
import { createMarkweaveCommandRegistry as
|
|
43
|
-
import { initialSlashCommandState as
|
|
44
|
-
import { setMarkweaveTableMenuAxisTarget as
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
13
|
+
import { MarkweaveCoreImage as S, MarkweaveCoreVideo as C, attrsFromMarkweaveImageUploadResult as ee, attrsFromMarkweaveVideoUploadResult as w, attrsFromMarkweaveVideoUrl as T, clampMarkweaveImageWidth as E, createMarkweaveImageUploadRequest as D, createMarkweaveVideoUploadRequest as O, downloadMarkweaveImage as k, markweaveVideoIframeAllow as A, normalizeMarkweaveCoreImageAlign as j, normalizeMarkweaveVideoEmbedUrl as te, numberAttribute as M, stringAttribute as N } from "markweave/internal/plugins/media/core-media-nodes";
|
|
14
|
+
import { activateMarkweaveAttachmentDownload as P, attrsFromMarkweaveAttachmentUploadResult as ne, createMarkweaveAttachmentRefFromAttrs as F, createMarkweaveAttachmentUploadRequest as I, formatMarkweaveAttachmentSize as L } from "markweave/internal/plugins/media/attachment-download";
|
|
15
|
+
import { MarkweaveAttachment as R } from "markweave/internal/plugins/media/media-nodes";
|
|
16
|
+
import { detectUploadSource as z, getDirectUploadResult as B, resolveMarkweaveUploadResult as V } from "markweave/internal/plugins/slash-command/upload";
|
|
17
|
+
import { createMarkweaveAiEditController as re } from "markweave";
|
|
18
|
+
import { BubbleMenu as ie } from "@tiptap/vue-2/menus";
|
|
19
|
+
import { isEditorComposing as ae } from "markweave/internal/editor-core/composition-guard";
|
|
20
|
+
import { saveMarkweaveBrowserFile as oe } from "markweave/internal/core/browser-file-save";
|
|
21
|
+
import { createMarkweaveFrameScheduler as se } from "markweave/internal/editor-core/frame-scheduler";
|
|
22
|
+
import { createMarkweaveEditorUpdatePayload as ce, getMarkweaveContentType as le, isEditorContentCurrent as ue, isMarkweaveControlledContentEchoCurrent as de, normalizeMarkweaveContentFormat as fe } from "markweave/internal/editor-core/editor-content";
|
|
23
|
+
import { getCurrentFloatingToolbarBlockType as pe, getFloatingToolbarHighlightColorOptions as me, getFloatingToolbarMoreActions as he, getFloatingToolbarTextColorOptions as ge, getFloatingToolbarTurnIntoOptions as _e, runFloatingToolbarMoreAction as ve, setFloatingToolbarTurnInto as ye } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
24
|
+
import { openMarkweaveReadonlyLinkFromEvent as be } from "markweave/internal/editor-core/readonly-link";
|
|
25
|
+
import { createMarkweaveEditorRuntimeSnapshot as xe } from "markweave/internal/editor-core/runtime-snapshot";
|
|
26
|
+
import { areEditorSelectionSnapshotsEquivalent as Se, calculateFloatingToolbarPopoverPlacement as Ce, createSelectionSnapshot as we, markweaveRuntimeProjectionDelayMs as Te, shouldShowFloatingToolbarForAiState as Ee } from "markweave/internal/editor-core/selection-state";
|
|
27
|
+
import { normalizeMarkweaveCanvasColor as De, normalizeMarkweaveTheme as Oe } from "markweave/internal/core/theme";
|
|
28
|
+
import { createMarkweaveAiEditController as ke } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
|
|
29
|
+
import { MarkweaveAskAiError as Ae, acceptMarkweaveAskAiResult as je, calculateMarkweaveAskAiPanelPosition as Me, canStartMarkweaveAskAiTableTarget as Ne, clearMarkweaveAskAiPreview as Pe, clearMarkweaveAskAiTarget as Fe, createMarkweaveAskAiRequest as Ie, getMappedMarkweaveAskAiSelection as Le, getMarkweaveAskAiSurfaceRect as Re, getMarkweaveAskAiTarget as ze, getMarkweaveAskAiTargetRect as Be, hasMarkweaveAskAiPreview as Ve, isMarkweaveAskAiSelectionEligible as He, restoreMarkweaveAskAiTargetSelection as Ue, runMarkweaveAskAiHandler as We, setMarkweaveAskAiPreview as Ge, startMarkweaveAskAiTableTarget as Ke, startMarkweaveAskAiTarget as qe } from "markweave/internal/plugins/ask-ai/ask-ai-session";
|
|
30
|
+
import { createMarkweaveTocState as Je, emptyMarkweaveTocState as Ye, getActiveMarkweaveTocId as Xe, getMarkweaveInnerTocRailHeight as Ze, getMarkweaveTocItemsFromState as Qe, getValidMarkweaveTocActiveId as $e, normalizeMarkweaveInnerTocPlacement as et, observeMarkweaveInnerTocContainerPosition as tt, observeMarkweaveInnerTocRailOverflow as nt, scrollToMarkweaveTocItem as rt } from "markweave/internal/core/toc-state";
|
|
31
|
+
import { codeBlockCollapsePluginKey as it, copyActiveCodeBlock as at, getActiveCodeBlockState as ot, getCodeBlockCopyFeedbackSnapshot as st, markweaveCodeBlockBehavior as ct, setCodeBlockCollapsedAtPosition as lt, setCodeBlockLanguageAtPosition as ut, setCodeBlockMermaidPreviewModeAtPosition as dt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
|
|
32
|
+
import { calculateCodeBlockLanguageMenuPosition as ft, clampFullscreenScale as pt, codeBlockCopyFeedbackTimeoutMs as mt, copyCodeBlockText as ht, createCodeBlockLanguageMenuDomId as gt, createCodeBlockOverlayPosition as _t, createMermaidFullscreenViewerState as vt, createMermaidTabPosition as yt, focusCodeBlockTarget as bt, formatCodeBlockLanguageLabel as xt, formatFullscreenZoom as St, getActiveCodeBlockElement as Ct, getAnchoredRect as wt, getCodeBlockLanguageItems as Tt, getCodeBlockLanguageOptionDomId as Et, getCodeBlockPositionFromEventTarget as Dt, getCodeBlockStateAtPosition as Ot, getFrameElement as kt, getInitialCodeBlockLanguageItemIndex as At, getMermaidCodeBlockTargets as jt, getMermaidSvgMarkup as Mt, isCodeBlockTargetCollapsed as Nt, mergeStableMermaidTabPositions as Pt, mermaidFullscreenZoomStep as Ft, moveCodeBlockLanguageItemIndex as It, moveMermaidFullscreenViewer as Lt, scrollCodeBlockLanguageItemIntoView as Rt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
|
|
33
|
+
import { normalizeMarkdownLinkHref as zt } from "markweave/internal/plugins/markdown/markdown-input";
|
|
34
|
+
import { applyMarkweaveMathLatex as Bt, calculateMarkweaveMathPopoverPosition as Vt, getMarkweaveMathAnchorRect as Ht, getMarkweaveMathBlockIndex as Ut, getMarkweaveMathRenderedHtml as Wt, getMarkweaveMathTargetAtPos as Gt, getMarkweaveMathTargetFromDomEvent as Kt, getMarkweaveMathTargetFromSelection as qt, renderMarkweaveMathPreview as Jt, setMarkweaveMathEditingDomState as Yt, setMarkweaveMathEditingDomStateInView as Xt, setMarkweaveMathSelectionInView as Zt } from "markweave/internal/plugins/math/math-ui-model";
|
|
35
|
+
import { isMermaidInlinePreviewTransaction as Qt, setMarkweaveMermaidTheme as $t, setMermaidInlinePreviewEditorMode as en, setReadonlyMermaidPreviewMode as tn } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
|
|
36
|
+
import { getMermaidPreviewState as nn } from "markweave/internal/plugins/mermaid/mermaid-renderer";
|
|
37
|
+
import { createResolvedSlashCommandSpecs as rn, getSlashCommandTextIconLength as an, isExecutableSlashCommand as on } from "markweave/internal/plugins/slash-command/command-spec";
|
|
38
|
+
import { getSlashCommandKeyboardAction as sn } from "markweave/internal/plugins/slash-command/slash-keyboard";
|
|
39
|
+
import { scrollSlashCommandItemIntoView as cn } from "markweave/internal/plugins/slash-command/slash-menu-scroll";
|
|
40
|
+
import { areSlashCommandMenuPositionsEquivalent as ln, getNextSlashCommandState as un, getSlashCommandAnchoredMenuPosition as dn, getSlashCommandContext as fn, isMarkweaveSlashMenuScrollTarget as pn, isSlashCommandAnchorVisible as mn } from "markweave/internal/plugins/slash-command/slash-runtime";
|
|
41
|
+
import { createMarkweaveCommandController as hn, executeMarkweaveSlashCommand as gn, setMarkweaveCommandContentFormat as _n, setMarkweaveCommandRegistry as vn } from "markweave/internal/commands/command-runtime";
|
|
42
|
+
import { createMarkweaveCommandRegistry as yn } from "markweave/internal/commands/command-registry";
|
|
43
|
+
import { initialSlashCommandState as bn, reduceSlashCommandState as xn } from "markweave/internal/plugins/slash-command/slash-state";
|
|
44
|
+
import { setMarkweaveTableMenuAxisTarget as Sn } from "markweave/internal/plugins/table/table-clipboard";
|
|
45
|
+
import { isMarkweaveTableCapabilityAllowed as Cn } from "markweave/internal/plugins/table/table-capabilities";
|
|
46
|
+
import { getFirstTableDebugSnapshot as wn } from "markweave/internal/plugins/table/table-debug-snapshot";
|
|
47
|
+
import { focusFirstTableBodyCell as Tn } from "markweave/internal/plugins/table/table-focus-position";
|
|
48
|
+
import { getTableFocusState as En } from "markweave/internal/plugins/table/table-focus-state";
|
|
49
|
+
import { getTableSelectionOverlayState as Dn, initialTableInteractionState as On, tableInteractionPluginKey as kn } from "markweave/internal/plugins/table/table-interaction-layer";
|
|
50
|
+
import { applyTableAxisAlignment as An, applyTableAxisBackgroundColor as jn, applyTableAxisTextColor as Mn, calculateAnchoredTableMenuPosition as Nn, calculateAnchoredTableSubmenuPosition as Pn, calculateTableAxisHandleLayout as Fn, calculateTableExtendButtonLayout as In, canRunTableCommand as Ln, executeTableMenuCommand as Rn, formatTableCopyFeedback as zn, getActiveTableElement as Bn, getAvailableCellMenuCommandSpecs as Vn, getTableAxisDropIndexAtPoint as Hn, getTableAxisFormattingState as Un, getTableAxisTargetRect as Wn, getTableControlAxisSelectionModel as Gn, getTableMenuBoundaryRect as Kn, getTableMenuItemGroup as qn, getTableMenuItemLabel as Jn, getTableMenuItems as Yn, getTableSelectionTargetRect as Xn, measureTableSelectionOverlay as Zn, moveTargetedTableAxis as Qn, selectTableAxisFromCell as $n, tableColorOptions as er, tableCopyFeedbackTimeoutMs as tr, tableHorizontalAlignmentOptions as nr, tableMenuLabel as rr, tableVerticalAlignmentOptions as ir, targetTableAxisFromCell as ar } from "markweave/internal/plugins/table/table-ui-model";
|
|
50
51
|
//#region src/vue2-compat.ts
|
|
51
|
-
var
|
|
52
|
-
function
|
|
52
|
+
var or = c.default ?? c, sr = null, cr = null, lr = null;
|
|
53
|
+
function ur(e) {
|
|
53
54
|
return !!(e && typeof e == "object" && "value" in e);
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function dr(e) {
|
|
56
57
|
let t = e.slice(2);
|
|
57
58
|
return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function fr(e) {
|
|
60
61
|
let t = {}, n = {}, r = {}, i = {}, a = {};
|
|
61
62
|
for (let [o, s] of Object.entries(e)) if (s !== void 0) {
|
|
62
63
|
if (o === "class" || o === "style" || o === "key") {
|
|
63
64
|
t[o] = s;
|
|
64
65
|
continue;
|
|
65
66
|
}
|
|
66
|
-
if (o === "ref" &&
|
|
67
|
+
if (o === "ref" && ur(s)) {
|
|
67
68
|
a.insert = (e) => {
|
|
68
69
|
s.value = e.elm;
|
|
69
70
|
}, a.destroy = () => {
|
|
@@ -72,7 +73,7 @@ function lr(e) {
|
|
|
72
73
|
continue;
|
|
73
74
|
}
|
|
74
75
|
if (/^on[A-Z]/.test(o)) {
|
|
75
|
-
i[
|
|
76
|
+
i[dr(o)] = s;
|
|
76
77
|
continue;
|
|
77
78
|
}
|
|
78
79
|
if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
|
|
@@ -83,14 +84,14 @@ function lr(e) {
|
|
|
83
84
|
}
|
|
84
85
|
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;
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
+
function pr(e) {
|
|
87
88
|
let t = {}, n = {}, r = {}, i = {};
|
|
88
89
|
for (let [a, o] of Object.entries(e)) if (o !== void 0) {
|
|
89
90
|
if (a === "class" || a === "style" || a === "key") {
|
|
90
91
|
t[a] = o;
|
|
91
92
|
continue;
|
|
92
93
|
}
|
|
93
|
-
if (a === "ref" &&
|
|
94
|
+
if (a === "ref" && ur(o)) {
|
|
94
95
|
i.insert = (e) => {
|
|
95
96
|
o.value = e.componentInstance ?? e.elm;
|
|
96
97
|
}, i.destroy = () => {
|
|
@@ -106,47 +107,47 @@ function ur(e) {
|
|
|
106
107
|
}
|
|
107
108
|
return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
+
function mr(e) {
|
|
110
111
|
return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
+
function hr(e) {
|
|
113
114
|
return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
+
function gr(e) {
|
|
116
117
|
return e == null || Array.isArray(e) ? e : [e];
|
|
117
118
|
}
|
|
118
|
-
function
|
|
119
|
-
return typeof e == "function" ?
|
|
119
|
+
function _r(e) {
|
|
120
|
+
return typeof e == "function" ? gr(e()) : mr(e) ? gr(e.default()) : hr(e) ? [e] : e;
|
|
120
121
|
}
|
|
121
|
-
function
|
|
122
|
-
if (!
|
|
123
|
-
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ?
|
|
124
|
-
return
|
|
122
|
+
function H(e, t, n) {
|
|
123
|
+
if (!lr) throw Error("Vue 2 render context is not available.");
|
|
124
|
+
let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? fr(r) : pr(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : _r(n);
|
|
125
|
+
return lr(e, i, a);
|
|
125
126
|
}
|
|
126
|
-
function
|
|
127
|
-
return
|
|
127
|
+
function U(e) {
|
|
128
|
+
return or.observable({ value: e });
|
|
128
129
|
}
|
|
129
|
-
var
|
|
130
|
-
function
|
|
130
|
+
var W = U;
|
|
131
|
+
function G(e) {
|
|
131
132
|
return { get value() {
|
|
132
133
|
return e();
|
|
133
134
|
} };
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function K(e, t, n) {
|
|
136
137
|
let r = typeof e == "function" ? e : () => e.value;
|
|
137
|
-
return
|
|
138
|
+
return sr?.$watch ? sr.$watch(r, t, n) : () => void 0;
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
-
|
|
140
|
+
function vr(e) {
|
|
141
|
+
cr?.mounted.push(e);
|
|
142
|
+
}
|
|
143
|
+
function q(e) {
|
|
144
|
+
cr?.beforeUnmount.push(e);
|
|
141
145
|
}
|
|
142
146
|
function J(e) {
|
|
143
|
-
|
|
147
|
+
return or.nextTick(e);
|
|
144
148
|
}
|
|
145
149
|
function Y(e) {
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
function X(e) {
|
|
149
|
-
return rr.extend({
|
|
150
|
+
return or.extend({
|
|
150
151
|
name: e.name,
|
|
151
152
|
props: e.props,
|
|
152
153
|
created() {
|
|
@@ -154,12 +155,12 @@ function X(e) {
|
|
|
154
155
|
mounted: [],
|
|
155
156
|
beforeUnmount: []
|
|
156
157
|
};
|
|
157
|
-
|
|
158
|
+
sr = this, cr = t;
|
|
158
159
|
try {
|
|
159
160
|
let n = e.setup?.(this.$props ?? this) ?? null;
|
|
160
161
|
this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
|
|
161
162
|
} finally {
|
|
162
|
-
|
|
163
|
+
sr = null, cr = null;
|
|
163
164
|
}
|
|
164
165
|
},
|
|
165
166
|
mounted() {
|
|
@@ -169,19 +170,19 @@ function X(e) {
|
|
|
169
170
|
this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
|
|
170
171
|
},
|
|
171
172
|
render(t) {
|
|
172
|
-
|
|
173
|
+
lr = t;
|
|
173
174
|
try {
|
|
174
175
|
let n = this.__markweaveVue2Render;
|
|
175
176
|
return n ? n() : e.render?.(t) ?? null;
|
|
176
177
|
} finally {
|
|
177
|
-
|
|
178
|
+
lr = null;
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
//#endregion
|
|
183
184
|
//#region src/vue2-icons.ts
|
|
184
|
-
var
|
|
185
|
+
var yr = {
|
|
185
186
|
AlignVerticalJustifyCenter: {
|
|
186
187
|
iconName: "align-vertical-justify-center",
|
|
187
188
|
node: [
|
|
@@ -1503,11 +1504,11 @@ var gr = {
|
|
|
1503
1504
|
}]]
|
|
1504
1505
|
}
|
|
1505
1506
|
};
|
|
1506
|
-
function
|
|
1507
|
-
return e.map(([e, t]) =>
|
|
1507
|
+
function br(e) {
|
|
1508
|
+
return e.map(([e, t]) => H(e, t));
|
|
1508
1509
|
}
|
|
1509
|
-
function
|
|
1510
|
-
return
|
|
1510
|
+
function X(e) {
|
|
1511
|
+
return Y({
|
|
1511
1512
|
name: `MarkweaveVue2Icon${e}`,
|
|
1512
1513
|
props: {
|
|
1513
1514
|
size: {
|
|
@@ -1524,8 +1525,8 @@ function Z(e) {
|
|
|
1524
1525
|
}
|
|
1525
1526
|
},
|
|
1526
1527
|
setup(t) {
|
|
1527
|
-
let n =
|
|
1528
|
-
return () =>
|
|
1528
|
+
let n = yr[e];
|
|
1529
|
+
return () => H("svg", {
|
|
1529
1530
|
class: `lucide lucide-${n.iconName}`,
|
|
1530
1531
|
viewBox: "0 0 24 24",
|
|
1531
1532
|
width: t.size,
|
|
@@ -1537,12 +1538,12 @@ function Z(e) {
|
|
|
1537
1538
|
"stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
|
|
1538
1539
|
"aria-hidden": "true",
|
|
1539
1540
|
focusable: "false"
|
|
1540
|
-
},
|
|
1541
|
+
}, br(n.node));
|
|
1541
1542
|
}
|
|
1542
1543
|
});
|
|
1543
1544
|
}
|
|
1544
|
-
var
|
|
1545
|
-
function
|
|
1545
|
+
var xr = X("AlignCenter"), Sr = X("AlignJustify"), Cr = X("AlignLeft"), wr = X("AlignRight"), Tr = X("AlignVerticalJustifyCenter"), Er = X("AlignVerticalJustifyEnd"), Dr = X("AlignVerticalJustifyStart"), Or = X("AlertTriangle"), kr = X("ArrowDown"), Ar = X("ArrowDownAZ"), jr = X("ArrowLeft"), Mr = X("ArrowRight"), Nr = X("ArrowUp"), Pr = X("ArrowUpZA"), Fr = X("BetweenHorizontalEnd"), Ir = X("BetweenHorizontalStart"), Lr = X("BetweenVerticalEnd"), Rr = X("BetweenVerticalStart"), zr = X("Bold"), Br = X("Braces"), Vr = X("Captions"), Hr = X("Check"), Ur = X("CheckCircle2"), Wr = X("ChevronDown"), Gr = X("ChevronRight"), Kr = X("ChevronUp"), qr = X("CircleX"), Jr = X("Code2"), Yr = X("CornerDownLeft"), Xr = X("Copy"), Zr = X("Download"), Qr = X("Eye"), $r = X("ExternalLink"), ei = X("Heading1"), ti = X("Heading2"), ni = X("Heading3"), ri = X("Image"), ii = X("ImageUp"), ai = X("IndentDecrease"), oi = X("IndentIncrease"), si = X("Info"), ci = X("Italic"), li = X("Lightbulb"), ui = X("Link2"), di = X("List"), fi = X("ListChecks"), pi = X("ListOrdered"), mi = X("Minus"), hi = X("MoreVertical"), gi = X("PaintBucket"), _i = X("Paperclip"), vi = X("PencilLine"), yi = X("Plus"), bi = X("Quote"), xi = X("Replace"), Si = X("RotateCcw"), Ci = X("Sigma"), wi = X("SmilePlus"), Ti = X("Sparkles"), Ei = X("Square"), Di = X("SquareX"), Oi = X("Strikethrough"), ki = X("Subscript"), Ai = X("Superscript"), ji = X("Table2"), Mi = X("TableCellsMerge"), Ni = X("TableCellsSplit"), Pi = X("Text"), Fi = X("Trash2"), Ii = X("Type"), Li = X("Underline"), Ri = X("Upload"), zi = X("Video"), Bi = X("X"), Vi = j;
|
|
1546
|
+
function Hi(e) {
|
|
1546
1547
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1547
1548
|
let n = t?.getAttribute("data-markweave-mode");
|
|
1548
1549
|
return n === "view" ? {
|
|
@@ -1552,7 +1553,7 @@ function zi(e) {
|
|
|
1552
1553
|
mode: "live",
|
|
1553
1554
|
editable: e.isEditable
|
|
1554
1555
|
} : l(e);
|
|
1555
|
-
}, r =
|
|
1556
|
+
}, r = U(n()), i = p(e, () => {
|
|
1556
1557
|
r.value = n();
|
|
1557
1558
|
}), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
|
|
1558
1559
|
r.value = n();
|
|
@@ -1560,28 +1561,28 @@ function zi(e) {
|
|
|
1560
1561
|
return a && t && a.observe(t, {
|
|
1561
1562
|
attributes: !0,
|
|
1562
1563
|
attributeFilter: ["data-markweave-mode"]
|
|
1563
|
-
}),
|
|
1564
|
+
}), q(() => {
|
|
1564
1565
|
i(), a?.disconnect();
|
|
1565
1566
|
}), r;
|
|
1566
1567
|
}
|
|
1567
|
-
function
|
|
1568
|
+
function Ui(e) {
|
|
1568
1569
|
return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
|
|
1569
1570
|
}
|
|
1570
|
-
function
|
|
1571
|
+
function Wi(e) {
|
|
1571
1572
|
return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
|
|
1572
1573
|
}
|
|
1573
|
-
function
|
|
1574
|
+
function Gi(e) {
|
|
1574
1575
|
return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
|
|
1575
1576
|
}
|
|
1576
|
-
function
|
|
1577
|
-
return
|
|
1577
|
+
function Ki(e, t) {
|
|
1578
|
+
return H(e, {
|
|
1578
1579
|
size: 18,
|
|
1579
1580
|
strokeWidth: 1.8,
|
|
1580
1581
|
"aria-hidden": "true"
|
|
1581
1582
|
}, { default: () => t });
|
|
1582
1583
|
}
|
|
1583
|
-
function
|
|
1584
|
-
return
|
|
1584
|
+
function qi(e) {
|
|
1585
|
+
return H("button", {
|
|
1585
1586
|
type: "button",
|
|
1586
1587
|
"aria-label": e.label,
|
|
1587
1588
|
title: e.label,
|
|
@@ -1589,14 +1590,14 @@ function Wi(e) {
|
|
|
1589
1590
|
"data-active": e.active ? "true" : "false",
|
|
1590
1591
|
onMousedown: (e) => e.preventDefault(),
|
|
1591
1592
|
onClick: e.onClick
|
|
1592
|
-
}, [
|
|
1593
|
+
}, [Ki(e.icon, e.label), H("span", {
|
|
1593
1594
|
class: "markweave-image-tooltip",
|
|
1594
1595
|
role: "tooltip"
|
|
1595
1596
|
}, e.label)]);
|
|
1596
1597
|
}
|
|
1597
|
-
function
|
|
1598
|
-
let t =
|
|
1599
|
-
return
|
|
1598
|
+
function Ji(e) {
|
|
1599
|
+
let t = U(null), n = e.messages.image;
|
|
1600
|
+
return H("section", {
|
|
1600
1601
|
class: "markweave-image-upload-placeholder",
|
|
1601
1602
|
"data-testid": "markweave-image-upload-placeholder",
|
|
1602
1603
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1614,7 +1615,7 @@ function Gi(e) {
|
|
|
1614
1615
|
n && e.onFile(n);
|
|
1615
1616
|
}
|
|
1616
1617
|
}, [
|
|
1617
|
-
|
|
1618
|
+
H("input", {
|
|
1618
1619
|
ref: t,
|
|
1619
1620
|
"data-testid": "markweave-image-file-input",
|
|
1620
1621
|
type: "file",
|
|
@@ -1625,7 +1626,7 @@ function Gi(e) {
|
|
|
1625
1626
|
r && e.onFile(r), n.value = "";
|
|
1626
1627
|
}
|
|
1627
1628
|
}),
|
|
1628
|
-
|
|
1629
|
+
H("button", {
|
|
1629
1630
|
type: "button",
|
|
1630
1631
|
class: "markweave-image-upload-trigger",
|
|
1631
1632
|
"data-testid": "markweave-image-upload-trigger",
|
|
@@ -1633,21 +1634,21 @@ function Gi(e) {
|
|
|
1633
1634
|
onMousedown: (e) => e.preventDefault(),
|
|
1634
1635
|
onClick: () => t.value?.click()
|
|
1635
1636
|
}, [
|
|
1636
|
-
|
|
1637
|
+
H("span", {
|
|
1637
1638
|
class: "markweave-image-upload-icon",
|
|
1638
1639
|
"aria-hidden": "true"
|
|
1639
|
-
}, [
|
|
1640
|
+
}, [H(ii, {
|
|
1640
1641
|
size: 16,
|
|
1641
1642
|
strokeWidth: 1.8
|
|
1642
1643
|
})]),
|
|
1643
|
-
|
|
1644
|
-
|
|
1644
|
+
H("span", { class: "markweave-image-upload-label" }, n.uploadLabel),
|
|
1645
|
+
H("span", {
|
|
1645
1646
|
class: "markweave-image-upload-tooltip",
|
|
1646
1647
|
role: "tooltip"
|
|
1647
1648
|
}, `${n.clickToUpload}${n.dragAndDrop}. ${n.uploadNote}`)
|
|
1648
1649
|
]),
|
|
1649
|
-
|
|
1650
|
-
|
|
1650
|
+
H("div", { class: "markweave-image-upload-row" }, [
|
|
1651
|
+
H("input", {
|
|
1651
1652
|
"data-testid": "markweave-image-url-input",
|
|
1652
1653
|
value: e.inputValue,
|
|
1653
1654
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1657,30 +1658,30 @@ function Gi(e) {
|
|
|
1657
1658
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1658
1659
|
}
|
|
1659
1660
|
}),
|
|
1660
|
-
|
|
1661
|
+
H("button", {
|
|
1661
1662
|
type: "button",
|
|
1662
1663
|
"data-testid": "markweave-image-upload-submit",
|
|
1663
1664
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1664
1665
|
onClick: e.onSubmit
|
|
1665
|
-
}, [
|
|
1666
|
+
}, [H(ii, {
|
|
1666
1667
|
size: 16,
|
|
1667
1668
|
strokeWidth: 1.8
|
|
1668
1669
|
}), e.messages.common.insert]),
|
|
1669
|
-
|
|
1670
|
+
H("button", {
|
|
1670
1671
|
type: "button",
|
|
1671
1672
|
"data-testid": "markweave-image-upload-cancel",
|
|
1672
1673
|
onClick: e.onCancel
|
|
1673
1674
|
}, e.messages.common.cancel)
|
|
1674
1675
|
]),
|
|
1675
|
-
e.error ?
|
|
1676
|
+
e.error ? H("div", {
|
|
1676
1677
|
class: "markweave-image-upload-error",
|
|
1677
1678
|
role: "alert"
|
|
1678
1679
|
}, e.error) : null
|
|
1679
1680
|
]);
|
|
1680
1681
|
}
|
|
1681
|
-
function
|
|
1682
|
-
let t =
|
|
1683
|
-
return
|
|
1682
|
+
function Yi(e) {
|
|
1683
|
+
let t = U(null), n = e.messages.video;
|
|
1684
|
+
return H("section", {
|
|
1684
1685
|
class: "markweave-video-upload-placeholder",
|
|
1685
1686
|
"data-testid": "markweave-video-upload-placeholder",
|
|
1686
1687
|
"data-drag-active": e.dragActive ? "true" : "false",
|
|
@@ -1698,7 +1699,7 @@ function Ki(e) {
|
|
|
1698
1699
|
n && e.onFile(n);
|
|
1699
1700
|
}
|
|
1700
1701
|
}, [
|
|
1701
|
-
|
|
1702
|
+
H("input", {
|
|
1702
1703
|
ref: t,
|
|
1703
1704
|
"data-testid": "markweave-video-file-input",
|
|
1704
1705
|
type: "file",
|
|
@@ -1709,7 +1710,7 @@ function Ki(e) {
|
|
|
1709
1710
|
r && e.onFile(r), n.value = "";
|
|
1710
1711
|
}
|
|
1711
1712
|
}),
|
|
1712
|
-
|
|
1713
|
+
H("button", {
|
|
1713
1714
|
type: "button",
|
|
1714
1715
|
class: "markweave-video-upload-trigger",
|
|
1715
1716
|
"data-testid": "markweave-video-upload-trigger",
|
|
@@ -1717,21 +1718,21 @@ function Ki(e) {
|
|
|
1717
1718
|
onMousedown: (e) => e.preventDefault(),
|
|
1718
1719
|
onClick: () => t.value?.click()
|
|
1719
1720
|
}, [
|
|
1720
|
-
|
|
1721
|
+
H("span", {
|
|
1721
1722
|
class: "markweave-video-upload-icon",
|
|
1722
1723
|
"aria-hidden": "true"
|
|
1723
|
-
}, [
|
|
1724
|
+
}, [H(zi, {
|
|
1724
1725
|
size: 16,
|
|
1725
1726
|
strokeWidth: 1.8
|
|
1726
1727
|
})]),
|
|
1727
|
-
|
|
1728
|
-
|
|
1728
|
+
H("span", { class: "markweave-video-upload-label" }, n.uploadLabel),
|
|
1729
|
+
H("span", {
|
|
1729
1730
|
class: "markweave-video-upload-tooltip",
|
|
1730
1731
|
role: "tooltip"
|
|
1731
1732
|
}, `${n.clickToUpload}${n.dragAndDrop}. ${n.uploadNote}`)
|
|
1732
1733
|
]),
|
|
1733
|
-
|
|
1734
|
-
|
|
1734
|
+
H("div", { class: "markweave-video-upload-row" }, [
|
|
1735
|
+
H("input", {
|
|
1735
1736
|
"data-testid": "markweave-video-url-input",
|
|
1736
1737
|
value: e.inputValue,
|
|
1737
1738
|
placeholder: n.uploadInputPlaceholder,
|
|
@@ -1741,28 +1742,28 @@ function Ki(e) {
|
|
|
1741
1742
|
t.key === "Enter" && (t.preventDefault(), e.onSubmit());
|
|
1742
1743
|
}
|
|
1743
1744
|
}),
|
|
1744
|
-
|
|
1745
|
+
H("button", {
|
|
1745
1746
|
type: "button",
|
|
1746
1747
|
"data-testid": "markweave-video-upload-submit",
|
|
1747
1748
|
disabled: e.isSubmitting || !e.inputValue.trim(),
|
|
1748
1749
|
onClick: e.onSubmit
|
|
1749
|
-
}, [
|
|
1750
|
+
}, [H(Ri, {
|
|
1750
1751
|
size: 16,
|
|
1751
1752
|
strokeWidth: 1.8
|
|
1752
1753
|
}), e.messages.common.insert]),
|
|
1753
|
-
|
|
1754
|
+
H("button", {
|
|
1754
1755
|
type: "button",
|
|
1755
1756
|
"data-testid": "markweave-video-upload-cancel",
|
|
1756
1757
|
onClick: e.onCancel
|
|
1757
1758
|
}, e.messages.common.cancel)
|
|
1758
1759
|
]),
|
|
1759
|
-
e.error ?
|
|
1760
|
+
e.error ? H("div", {
|
|
1760
1761
|
class: "markweave-video-upload-error",
|
|
1761
1762
|
role: "alert"
|
|
1762
1763
|
}, e.error) : null
|
|
1763
1764
|
]);
|
|
1764
1765
|
}
|
|
1765
|
-
var
|
|
1766
|
+
var Xi = Y({
|
|
1766
1767
|
name: "MarkweaveVueImageNodeView",
|
|
1767
1768
|
props: {
|
|
1768
1769
|
editor: {
|
|
@@ -1795,8 +1796,8 @@ var qi = X({
|
|
|
1795
1796
|
}
|
|
1796
1797
|
},
|
|
1797
1798
|
setup(e) {
|
|
1798
|
-
let n =
|
|
1799
|
-
|
|
1799
|
+
let n = U(null), r = U(!1), i = U(!1), a = U(!1), s = U(""), c = U(null), l = U(!1), d = G(() => e.node.attrs), f = U(!!N(d.value.caption)), p = U(N(d.value.caption) ?? ""), m = Hi(e.editor), h = G(() => u(m.value)), g = G(() => e.extension.options?.messages ?? t("zh")), _ = G(() => g.value.image), v = G(() => N(d.value.src)), b = G(() => e.extension.options?.resolveMediaSource), S = U(null), C = null;
|
|
1800
|
+
K(v, (t) => {
|
|
1800
1801
|
if (C?.abort(), C = null, !t) {
|
|
1801
1802
|
S.value = null;
|
|
1802
1803
|
return;
|
|
@@ -1815,11 +1816,11 @@ var qi = X({
|
|
|
1815
1816
|
}).then((e) => {
|
|
1816
1817
|
r.signal.aborted || (S.value = e);
|
|
1817
1818
|
});
|
|
1818
|
-
}, { immediate: !0 }),
|
|
1819
|
-
let
|
|
1820
|
-
|
|
1821
|
-
src:
|
|
1822
|
-
alt:
|
|
1819
|
+
}, { immediate: !0 }), q(() => C?.abort());
|
|
1820
|
+
let w = G(() => S.value?.src ?? (b.value ? null : v.value)), T = G(() => Vi(d.value.align)), O = G(() => M(d.value.width)), A = G(() => N(d.value.caption)), j = G(() => h.value && (!v.value || i.value)), te = () => {
|
|
1821
|
+
w.value && y({
|
|
1822
|
+
src: w.value,
|
|
1823
|
+
alt: N(d.value.alt) ?? "",
|
|
1823
1824
|
messages: {
|
|
1824
1825
|
dialogAriaLabel: _.value.previewDialogAriaLabel,
|
|
1825
1826
|
zoomOut: _.value.previewZoomOut,
|
|
@@ -1829,67 +1830,67 @@ var qi = X({
|
|
|
1829
1830
|
}
|
|
1830
1831
|
});
|
|
1831
1832
|
};
|
|
1832
|
-
|
|
1833
|
+
K(A, (e) => {
|
|
1833
1834
|
f.value || (p.value = e ?? "");
|
|
1834
1835
|
});
|
|
1835
|
-
let
|
|
1836
|
+
let P = () => {
|
|
1836
1837
|
if (!h.value) return;
|
|
1837
1838
|
let t = e.getPos();
|
|
1838
1839
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1839
|
-
},
|
|
1840
|
+
}, ne = () => {
|
|
1840
1841
|
if (s.value = "", c.value = null, a.value = !1, v.value) {
|
|
1841
1842
|
i.value = !1;
|
|
1842
1843
|
return;
|
|
1843
1844
|
}
|
|
1844
1845
|
e.deleteNode();
|
|
1845
|
-
},
|
|
1846
|
+
}, F = async (t) => {
|
|
1846
1847
|
if (!h.value) return;
|
|
1847
1848
|
let n = e.extension.options;
|
|
1848
1849
|
l.value = !0, c.value = null;
|
|
1849
1850
|
try {
|
|
1850
|
-
let r = await
|
|
1851
|
-
e.updateAttributes(
|
|
1851
|
+
let r = await V(D(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1852
|
+
e.updateAttributes(ee(d.value, r)), s.value = "", i.value = !1;
|
|
1852
1853
|
} catch (e) {
|
|
1853
1854
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
1854
1855
|
} finally {
|
|
1855
1856
|
l.value = !1, a.value = !1;
|
|
1856
1857
|
}
|
|
1857
|
-
},
|
|
1858
|
+
}, I = () => {
|
|
1858
1859
|
if (!s.value.trim()) {
|
|
1859
1860
|
c.value = _.value.uploadRequiredError;
|
|
1860
1861
|
return;
|
|
1861
1862
|
}
|
|
1862
|
-
|
|
1863
|
-
},
|
|
1864
|
-
|
|
1863
|
+
F(z(s.value));
|
|
1864
|
+
}, L = (e) => {
|
|
1865
|
+
F({
|
|
1865
1866
|
type: "file",
|
|
1866
1867
|
file: e,
|
|
1867
1868
|
mimeType: e.type || "image/*"
|
|
1868
1869
|
});
|
|
1869
|
-
},
|
|
1870
|
-
f.value = !f.value, f.value && (p.value =
|
|
1871
|
-
},
|
|
1870
|
+
}, R = () => {
|
|
1871
|
+
f.value = !f.value, f.value && (p.value = A.value ?? "");
|
|
1872
|
+
}, B = (t, r) => {
|
|
1872
1873
|
if (!h.value || !v.value) return;
|
|
1873
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1874
|
+
r.preventDefault(), r.stopPropagation(), P();
|
|
1874
1875
|
let i = n.value;
|
|
1875
1876
|
if (!i) return;
|
|
1876
|
-
let a = r.clientX, o = i.getBoundingClientRect().width ||
|
|
1877
|
+
let a = r.clientX, o = i.getBoundingClientRect().width || O.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (n) => {
|
|
1877
1878
|
let r = t === "right" ? n.clientX - a : a - n.clientX;
|
|
1878
|
-
e.updateAttributes({ width:
|
|
1879
|
+
e.updateAttributes({ width: E(o + r, s) });
|
|
1879
1880
|
}, l = () => {
|
|
1880
1881
|
window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
|
|
1881
1882
|
};
|
|
1882
1883
|
window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
|
|
1883
1884
|
};
|
|
1884
|
-
return () =>
|
|
1885
|
+
return () => j.value ? H(o, {
|
|
1885
1886
|
as: "figure",
|
|
1886
1887
|
class: "markweave-image-node",
|
|
1887
1888
|
"data-testid": "markweave-image-node",
|
|
1888
|
-
"data-align":
|
|
1889
|
+
"data-align": T.value,
|
|
1889
1890
|
"data-selected": "false",
|
|
1890
1891
|
"data-hovered": "false",
|
|
1891
1892
|
"data-empty": "true"
|
|
1892
|
-
}, () =>
|
|
1893
|
+
}, () => Ji({
|
|
1893
1894
|
messages: g.value,
|
|
1894
1895
|
inputValue: s.value,
|
|
1895
1896
|
error: c.value,
|
|
@@ -1898,17 +1899,17 @@ var qi = X({
|
|
|
1898
1899
|
onInputValue: (e) => {
|
|
1899
1900
|
s.value = e;
|
|
1900
1901
|
},
|
|
1901
|
-
onFile:
|
|
1902
|
-
onSubmit:
|
|
1903
|
-
onCancel:
|
|
1902
|
+
onFile: L,
|
|
1903
|
+
onSubmit: I,
|
|
1904
|
+
onCancel: ne,
|
|
1904
1905
|
onDragActive: (e) => {
|
|
1905
1906
|
a.value = e;
|
|
1906
1907
|
}
|
|
1907
|
-
})) :
|
|
1908
|
+
})) : H(o, {
|
|
1908
1909
|
as: "figure",
|
|
1909
1910
|
class: "markweave-image-node",
|
|
1910
1911
|
"data-testid": "markweave-image-node",
|
|
1911
|
-
"data-align":
|
|
1912
|
+
"data-align": T.value,
|
|
1912
1913
|
"data-selected": h.value && e.selected ? "true" : "false",
|
|
1913
1914
|
"data-hovered": r.value ? "true" : "false",
|
|
1914
1915
|
"data-empty": "false",
|
|
@@ -1919,104 +1920,104 @@ var qi = X({
|
|
|
1919
1920
|
r.value = !1;
|
|
1920
1921
|
},
|
|
1921
1922
|
onMousedown: (e) => {
|
|
1922
|
-
h.value && !
|
|
1923
|
+
h.value && !Ui(e.target) && P();
|
|
1923
1924
|
}
|
|
1924
1925
|
}, () => [
|
|
1925
|
-
h.value ?
|
|
1926
|
+
h.value ? H("div", {
|
|
1926
1927
|
class: "markweave-image-toolbar",
|
|
1927
1928
|
"data-testid": "markweave-image-toolbar",
|
|
1928
1929
|
"data-markweave-image-ui": "true",
|
|
1929
1930
|
"aria-label": _.value.toolsAriaLabel
|
|
1930
1931
|
}, [
|
|
1931
|
-
|
|
1932
|
+
qi({
|
|
1932
1933
|
testId: "markweave-image-align-left",
|
|
1933
1934
|
label: _.value.alignLeft,
|
|
1934
|
-
icon:
|
|
1935
|
-
active:
|
|
1935
|
+
icon: Cr,
|
|
1936
|
+
active: T.value === "left",
|
|
1936
1937
|
onClick: () => e.updateAttributes({ align: "left" })
|
|
1937
1938
|
}),
|
|
1938
|
-
|
|
1939
|
+
qi({
|
|
1939
1940
|
testId: "markweave-image-align-center",
|
|
1940
1941
|
label: _.value.alignCenter,
|
|
1941
|
-
icon:
|
|
1942
|
-
active:
|
|
1942
|
+
icon: xr,
|
|
1943
|
+
active: T.value === "center",
|
|
1943
1944
|
onClick: () => e.updateAttributes({ align: "center" })
|
|
1944
1945
|
}),
|
|
1945
|
-
|
|
1946
|
+
qi({
|
|
1946
1947
|
testId: "markweave-image-align-right",
|
|
1947
1948
|
label: _.value.alignRight,
|
|
1948
|
-
icon:
|
|
1949
|
-
active:
|
|
1949
|
+
icon: wr,
|
|
1950
|
+
active: T.value === "right",
|
|
1950
1951
|
onClick: () => e.updateAttributes({ align: "right" })
|
|
1951
1952
|
}),
|
|
1952
|
-
|
|
1953
|
+
H("span", {
|
|
1953
1954
|
class: "markweave-image-toolbar-divider",
|
|
1954
1955
|
"aria-hidden": "true"
|
|
1955
1956
|
}),
|
|
1956
|
-
|
|
1957
|
+
qi({
|
|
1957
1958
|
testId: "markweave-image-caption",
|
|
1958
1959
|
label: _.value.caption,
|
|
1959
|
-
icon:
|
|
1960
|
-
active: f.value || !!
|
|
1961
|
-
onClick:
|
|
1960
|
+
icon: Vr,
|
|
1961
|
+
active: f.value || !!A.value,
|
|
1962
|
+
onClick: R
|
|
1962
1963
|
}),
|
|
1963
|
-
|
|
1964
|
+
qi({
|
|
1964
1965
|
testId: "markweave-image-preview",
|
|
1965
1966
|
label: _.value.preview,
|
|
1966
|
-
icon:
|
|
1967
|
-
onClick:
|
|
1967
|
+
icon: Qr,
|
|
1968
|
+
onClick: te
|
|
1968
1969
|
}),
|
|
1969
|
-
|
|
1970
|
+
qi({
|
|
1970
1971
|
testId: "markweave-image-download",
|
|
1971
1972
|
label: _.value.download,
|
|
1972
|
-
icon:
|
|
1973
|
+
icon: Zr,
|
|
1973
1974
|
onClick: () => {
|
|
1974
|
-
|
|
1975
|
+
w.value && k(w.value);
|
|
1975
1976
|
}
|
|
1976
1977
|
}),
|
|
1977
|
-
|
|
1978
|
+
qi({
|
|
1978
1979
|
testId: "markweave-image-replace",
|
|
1979
1980
|
label: _.value.replace,
|
|
1980
|
-
icon:
|
|
1981
|
+
icon: xi,
|
|
1981
1982
|
onClick: () => {
|
|
1982
1983
|
s.value = "", c.value = null, i.value = !0;
|
|
1983
1984
|
}
|
|
1984
1985
|
}),
|
|
1985
|
-
|
|
1986
|
+
H("span", {
|
|
1986
1987
|
class: "markweave-image-toolbar-divider",
|
|
1987
1988
|
"aria-hidden": "true"
|
|
1988
1989
|
}),
|
|
1989
|
-
|
|
1990
|
+
qi({
|
|
1990
1991
|
testId: "markweave-image-delete",
|
|
1991
1992
|
label: _.value.delete,
|
|
1992
|
-
icon:
|
|
1993
|
+
icon: Fi,
|
|
1993
1994
|
onClick: () => e.deleteNode()
|
|
1994
1995
|
})
|
|
1995
1996
|
]) : null,
|
|
1996
|
-
|
|
1997
|
+
H("div", {
|
|
1997
1998
|
ref: n,
|
|
1998
1999
|
class: "markweave-image-box",
|
|
1999
2000
|
style: {
|
|
2000
|
-
...
|
|
2001
|
+
...O.value ? { width: `${Math.round(O.value)}px` } : {},
|
|
2001
2002
|
...S.value?.width && S.value.height ? { aspectRatio: `${S.value.width} / ${S.value.height}` } : {}
|
|
2002
2003
|
}
|
|
2003
2004
|
}, [
|
|
2004
|
-
|
|
2005
|
+
w.value ? H("img", {
|
|
2005
2006
|
class: "markweave-image",
|
|
2006
|
-
src:
|
|
2007
|
-
alt:
|
|
2008
|
-
title:
|
|
2007
|
+
src: w.value,
|
|
2008
|
+
alt: N(d.value.alt) ?? "",
|
|
2009
|
+
title: N(d.value.title) ?? void 0,
|
|
2009
2010
|
draggable: !1,
|
|
2010
2011
|
loading: "lazy",
|
|
2011
2012
|
decoding: "async",
|
|
2012
2013
|
width: S.value?.width,
|
|
2013
2014
|
height: S.value?.height
|
|
2014
|
-
}) :
|
|
2015
|
+
}) : H("div", {
|
|
2015
2016
|
class: "markweave-image-readonly-empty",
|
|
2016
2017
|
"data-testid": "markweave-image-readonly-empty",
|
|
2017
2018
|
"aria-hidden": "true"
|
|
2018
2019
|
}),
|
|
2019
|
-
!h.value &&
|
|
2020
|
+
!h.value && w.value ? H("button", {
|
|
2020
2021
|
type: "button",
|
|
2021
2022
|
class: "markweave-image-preview-trigger",
|
|
2022
2023
|
"data-testid": "markweave-image-preview",
|
|
@@ -2024,34 +2025,34 @@ var qi = X({
|
|
|
2024
2025
|
"aria-label": _.value.preview,
|
|
2025
2026
|
title: _.value.preview,
|
|
2026
2027
|
onMousedown: (e) => e.preventDefault(),
|
|
2027
|
-
onClick:
|
|
2028
|
-
}, [
|
|
2028
|
+
onClick: te
|
|
2029
|
+
}, [H(Qr, {
|
|
2029
2030
|
size: 16,
|
|
2030
2031
|
strokeWidth: 1.8
|
|
2031
|
-
}),
|
|
2032
|
+
}), H("span", {
|
|
2032
2033
|
class: "markweave-image-tooltip",
|
|
2033
2034
|
role: "tooltip"
|
|
2034
2035
|
}, _.value.preview)]) : null,
|
|
2035
|
-
h.value ?
|
|
2036
|
+
h.value ? H("button", {
|
|
2036
2037
|
type: "button",
|
|
2037
2038
|
class: "markweave-image-resize-handle",
|
|
2038
2039
|
"data-testid": "markweave-image-resize-left",
|
|
2039
2040
|
"data-side": "left",
|
|
2040
2041
|
"aria-label": _.value.resizeLeft,
|
|
2041
2042
|
"data-markweave-image-ui": "true",
|
|
2042
|
-
onPointerdown: (e) =>
|
|
2043
|
+
onPointerdown: (e) => B("left", e)
|
|
2043
2044
|
}) : null,
|
|
2044
|
-
h.value ?
|
|
2045
|
+
h.value ? H("button", {
|
|
2045
2046
|
type: "button",
|
|
2046
2047
|
class: "markweave-image-resize-handle",
|
|
2047
2048
|
"data-testid": "markweave-image-resize-right",
|
|
2048
2049
|
"data-side": "right",
|
|
2049
2050
|
"aria-label": _.value.resizeRight,
|
|
2050
2051
|
"data-markweave-image-ui": "true",
|
|
2051
|
-
onPointerdown: (e) =>
|
|
2052
|
+
onPointerdown: (e) => B("right", e)
|
|
2052
2053
|
}) : null
|
|
2053
2054
|
]),
|
|
2054
|
-
h.value && (f.value ||
|
|
2055
|
+
h.value && (f.value || A.value) ? H("input", {
|
|
2055
2056
|
class: "markweave-image-caption-input",
|
|
2056
2057
|
"data-testid": "markweave-image-caption-input",
|
|
2057
2058
|
"data-markweave-image-ui": "true",
|
|
@@ -2064,13 +2065,13 @@ var qi = X({
|
|
|
2064
2065
|
onKeydown: (e) => {
|
|
2065
2066
|
e.key === "Escape" && (e.preventDefault(), f.value = !1);
|
|
2066
2067
|
}
|
|
2067
|
-
}) :
|
|
2068
|
+
}) : A.value ? H("figcaption", {
|
|
2068
2069
|
class: "markweave-image-caption",
|
|
2069
2070
|
"data-testid": "markweave-image-caption"
|
|
2070
|
-
},
|
|
2071
|
+
}, A.value) : null
|
|
2071
2072
|
]);
|
|
2072
2073
|
}
|
|
2073
|
-
}),
|
|
2074
|
+
}), Zi = Y({
|
|
2074
2075
|
name: "MarkweaveVueVideoNodeView",
|
|
2075
2076
|
props: {
|
|
2076
2077
|
editor: {
|
|
@@ -2103,15 +2104,15 @@ var qi = X({
|
|
|
2103
2104
|
}
|
|
2104
2105
|
},
|
|
2105
2106
|
setup(e) {
|
|
2106
|
-
let n =
|
|
2107
|
+
let n = U(!1), r = U(""), i = U(null), a = U(!1), s = Hi(e.editor), c = G(() => u(s.value)), l = G(() => e.extension.options?.messages ?? t("zh")), d = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => N(f.value.src)), m = G(() => N(f.value.embedUrl)), h = G(() => N(f.value.provider)), g = G(() => m.value ? te(m.value, h.value) : null), _ = G(() => N(f.value.mimeType)), v = G(() => N(f.value.title)), y = () => {
|
|
2107
2108
|
p.value || e.deleteNode(), r.value = "", i.value = null, n.value = !1;
|
|
2108
2109
|
}, b = async (t) => {
|
|
2109
2110
|
if (!c.value) return;
|
|
2110
2111
|
let o = e.extension.options;
|
|
2111
2112
|
a.value = !0, i.value = null;
|
|
2112
2113
|
try {
|
|
2113
|
-
let n = await
|
|
2114
|
-
e.updateAttributes(
|
|
2114
|
+
let n = await V(O(t), o?.onUpload);
|
|
2115
|
+
e.updateAttributes(w(n)), r.value = "";
|
|
2115
2116
|
} catch (e) {
|
|
2116
2117
|
i.value = e instanceof Error ? e.message : d.value.uploadFailedError;
|
|
2117
2118
|
} finally {
|
|
@@ -2119,7 +2120,7 @@ var qi = X({
|
|
|
2119
2120
|
}
|
|
2120
2121
|
}, x = () => {
|
|
2121
2122
|
if (!c.value) return;
|
|
2122
|
-
let t =
|
|
2123
|
+
let t = T(r.value);
|
|
2123
2124
|
if (!t) {
|
|
2124
2125
|
i.value = d.value.unsupportedUrlError;
|
|
2125
2126
|
return;
|
|
@@ -2135,16 +2136,16 @@ var qi = X({
|
|
|
2135
2136
|
if (!c.value) return;
|
|
2136
2137
|
let t = e.getPos();
|
|
2137
2138
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
2138
|
-
},
|
|
2139
|
+
}, ee = (t) => {
|
|
2139
2140
|
c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
|
|
2140
2141
|
};
|
|
2141
|
-
return () => c.value && !p.value ?
|
|
2142
|
+
return () => c.value && !p.value ? H(o, {
|
|
2142
2143
|
as: "figure",
|
|
2143
2144
|
class: "markweave-video-node",
|
|
2144
2145
|
"data-testid": "markweave-video-node",
|
|
2145
2146
|
"data-empty": "true",
|
|
2146
2147
|
"data-selected": "false"
|
|
2147
|
-
}, () =>
|
|
2148
|
+
}, () => Yi({
|
|
2148
2149
|
messages: l.value,
|
|
2149
2150
|
inputValue: r.value,
|
|
2150
2151
|
error: i.value,
|
|
@@ -2159,7 +2160,7 @@ var qi = X({
|
|
|
2159
2160
|
onDragActive: (e) => {
|
|
2160
2161
|
n.value = e;
|
|
2161
2162
|
}
|
|
2162
|
-
})) :
|
|
2163
|
+
})) : H(o, {
|
|
2163
2164
|
as: "figure",
|
|
2164
2165
|
class: "markweave-video-node",
|
|
2165
2166
|
"data-testid": "markweave-video-node",
|
|
@@ -2169,27 +2170,27 @@ var qi = X({
|
|
|
2169
2170
|
"aria-label": d.value.nodeAriaLabel,
|
|
2170
2171
|
tabindex: c.value ? 0 : void 0,
|
|
2171
2172
|
onFocus: C,
|
|
2172
|
-
onKeydown:
|
|
2173
|
+
onKeydown: ee,
|
|
2173
2174
|
onMousedown: (e) => {
|
|
2174
|
-
c.value && !
|
|
2175
|
+
c.value && !Wi(e.target) && (e.preventDefault(), C());
|
|
2175
2176
|
}
|
|
2176
|
-
}, () => [g.value ?
|
|
2177
|
+
}, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
|
|
2177
2178
|
class: "markweave-video-iframe",
|
|
2178
2179
|
src: g.value,
|
|
2179
2180
|
title: v.value ?? `${h.value ?? "Video"} embed`,
|
|
2180
2181
|
"data-markweave-video-embed": "true",
|
|
2181
2182
|
"data-markweave-video-provider": h.value ?? void 0,
|
|
2182
2183
|
"data-markweave-video-src": p.value ?? void 0,
|
|
2183
|
-
allow:
|
|
2184
|
+
allow: A,
|
|
2184
2185
|
loading: "lazy",
|
|
2185
2186
|
allowfullscreen: "true"
|
|
2186
|
-
}), c.value ?
|
|
2187
|
+
}), c.value ? H("button", {
|
|
2187
2188
|
type: "button",
|
|
2188
2189
|
class: "markweave-video-selection-layer",
|
|
2189
2190
|
"data-testid": "markweave-video-selection-layer",
|
|
2190
2191
|
tabindex: -1,
|
|
2191
2192
|
"aria-label": d.value.selectAriaLabel
|
|
2192
|
-
}) : null]) : p.value ?
|
|
2193
|
+
}) : null]) : p.value ? H("div", { class: "markweave-video-box" }, [H("video", {
|
|
2193
2194
|
class: "markweave-video",
|
|
2194
2195
|
src: p.value,
|
|
2195
2196
|
title: v.value ?? void 0,
|
|
@@ -2197,19 +2198,19 @@ var qi = X({
|
|
|
2197
2198
|
controls: !0,
|
|
2198
2199
|
"data-markweave-video": "true",
|
|
2199
2200
|
"data-markweave-mime-type": _.value ?? void 0
|
|
2200
|
-
}), c.value ?
|
|
2201
|
+
}), c.value ? H("button", {
|
|
2201
2202
|
type: "button",
|
|
2202
2203
|
class: "markweave-video-selection-layer",
|
|
2203
2204
|
"data-testid": "markweave-video-selection-layer",
|
|
2204
2205
|
tabindex: -1,
|
|
2205
2206
|
"aria-label": d.value.selectAriaLabel
|
|
2206
|
-
}) : null]) :
|
|
2207
|
+
}) : null]) : H("div", {
|
|
2207
2208
|
class: "markweave-video-readonly-empty",
|
|
2208
2209
|
"data-testid": "markweave-video-readonly-empty",
|
|
2209
2210
|
"aria-hidden": "true"
|
|
2210
2211
|
})]);
|
|
2211
2212
|
}
|
|
2212
|
-
}),
|
|
2213
|
+
}), Qi = S.extend({
|
|
2213
2214
|
addOptions() {
|
|
2214
2215
|
return {
|
|
2215
2216
|
...this.parent?.(),
|
|
@@ -2220,16 +2221,16 @@ var qi = X({
|
|
|
2220
2221
|
},
|
|
2221
2222
|
addNodeView() {
|
|
2222
2223
|
if (typeof document > "u") return null;
|
|
2223
|
-
let e = s(
|
|
2224
|
+
let e = s(Xi, { stopEvent: ({ event: e }) => Ui(e.target) }), n = this.options.resolveMediaSource;
|
|
2224
2225
|
if (!n) return e;
|
|
2225
2226
|
let r = b({
|
|
2226
2227
|
messages: this.options.messages ?? t("zh"),
|
|
2227
2228
|
onUpload: this.options.onUpload,
|
|
2228
2229
|
resolveMediaSource: n
|
|
2229
2230
|
});
|
|
2230
|
-
return (t) =>
|
|
2231
|
+
return (t) => N(t.node.attrs.src) ? r(t) : e(t);
|
|
2231
2232
|
}
|
|
2232
|
-
}),
|
|
2233
|
+
}), $i = C.extend({
|
|
2233
2234
|
addOptions() {
|
|
2234
2235
|
return {
|
|
2235
2236
|
...this.parent?.(),
|
|
@@ -2239,16 +2240,16 @@ var qi = X({
|
|
|
2239
2240
|
};
|
|
2240
2241
|
},
|
|
2241
2242
|
addNodeView() {
|
|
2242
|
-
return typeof document > "u" ? null : s(
|
|
2243
|
+
return typeof document > "u" ? null : s(Zi, { stopEvent: ({ event: e }) => Wi(e.target) });
|
|
2243
2244
|
}
|
|
2244
2245
|
});
|
|
2245
|
-
function
|
|
2246
|
+
function ea(e) {
|
|
2246
2247
|
return e instanceof Element && !!e.closest("[data-markweave-attachment-ui=\"true\"], .markweave-attachment-upload-placeholder, .markweave-attachment-uploading");
|
|
2247
2248
|
}
|
|
2248
|
-
function
|
|
2249
|
+
function ta(e, t) {
|
|
2249
2250
|
return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? null : Math.max(0, Math.min(100, Math.round(e / t * 100)));
|
|
2250
2251
|
}
|
|
2251
|
-
var
|
|
2252
|
+
var na = Y({
|
|
2252
2253
|
name: "MarkweaveVueAttachmentNodeView",
|
|
2253
2254
|
props: {
|
|
2254
2255
|
editor: {
|
|
@@ -2281,7 +2282,7 @@ var $i = X({
|
|
|
2281
2282
|
}
|
|
2282
2283
|
},
|
|
2283
2284
|
setup(e) {
|
|
2284
|
-
let n =
|
|
2285
|
+
let n = G(() => e.extension.options), r = G(() => n.value?.messages ?? t("zh")), i = Hi(e.editor), a = G(() => u(i.value)), s = G(() => F(e.node.attrs ?? {})), c = G(() => s.value?.name ?? N(e.node.attrs?.src) ?? r.value.attachment.missingSrc), d = G(() => [N(e.node.attrs?.mimeType), L(typeof e.node.attrs?.size == "number" ? e.node.attrs.size : null)].filter(Boolean).join(" · ")), f = U(null), p = U(!1), m = U(!1), h = U(null), g = U(null), _ = U(null), v = U(null), y = () => {
|
|
2285
2286
|
if (!a.value) return;
|
|
2286
2287
|
let t = e.getPos();
|
|
2287
2288
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
@@ -2291,17 +2292,17 @@ var $i = X({
|
|
|
2291
2292
|
if (!(!a.value || !t || m.value)) {
|
|
2292
2293
|
h.value = null, m.value = !0, g.value = t.name, _.value = t.size, v.value = null;
|
|
2293
2294
|
try {
|
|
2294
|
-
let r = await
|
|
2295
|
-
...
|
|
2295
|
+
let r = await V({
|
|
2296
|
+
...I({
|
|
2296
2297
|
type: "file",
|
|
2297
2298
|
file: t,
|
|
2298
2299
|
mimeType: t.type || void 0
|
|
2299
2300
|
}),
|
|
2300
2301
|
onProgress: (e) => {
|
|
2301
|
-
v.value =
|
|
2302
|
+
v.value = ta(e.loaded, e.total);
|
|
2302
2303
|
}
|
|
2303
2304
|
}, n.value?.onUpload);
|
|
2304
|
-
e.updateAttributes(
|
|
2305
|
+
e.updateAttributes(ne(r));
|
|
2305
2306
|
} catch (e) {
|
|
2306
2307
|
h.value = e instanceof Error ? e.message : r.value.attachment.uploadFailedError;
|
|
2307
2308
|
} finally {
|
|
@@ -2309,16 +2310,16 @@ var $i = X({
|
|
|
2309
2310
|
}
|
|
2310
2311
|
}
|
|
2311
2312
|
}, S = (t) => {
|
|
2312
|
-
t.preventDefault(), t.stopPropagation(), s.value &&
|
|
2313
|
+
t.preventDefault(), t.stopPropagation(), s.value && P(s.value, {
|
|
2313
2314
|
mode: l(e.editor).mode,
|
|
2314
2315
|
event: t
|
|
2315
2316
|
}, n.value?.onDownload);
|
|
2316
2317
|
}, C = (e) => {
|
|
2317
|
-
|
|
2318
|
+
ea(e.target) || (e.preventDefault(), e.stopPropagation(), s.value && S(e));
|
|
2318
2319
|
};
|
|
2319
2320
|
return () => {
|
|
2320
|
-
let t = r.value.attachment, n = a.value && !s.value && !m.value, i = m.value, l = !!s.value && (p.value || e.selected), u = [
|
|
2321
|
-
return n ?
|
|
2321
|
+
let t = r.value.attachment, n = a.value && !s.value && !m.value, i = m.value, l = !!s.value && (p.value || e.selected), u = [L(_.value), v.value === null ? null : `${v.value}%`].filter(Boolean).join(" · ");
|
|
2322
|
+
return n ? H(o, {
|
|
2322
2323
|
as: "div",
|
|
2323
2324
|
class: "markweave-attachment markweave-attachment-upload-placeholder",
|
|
2324
2325
|
"data-markweave-attachment": "true",
|
|
@@ -2330,7 +2331,7 @@ var $i = X({
|
|
|
2330
2331
|
onKeydown: (t) => {
|
|
2331
2332
|
a.value && e.selected && (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), e.deleteNode());
|
|
2332
2333
|
}
|
|
2333
|
-
}, [
|
|
2334
|
+
}, [H("input", {
|
|
2334
2335
|
ref: f,
|
|
2335
2336
|
type: "file",
|
|
2336
2337
|
hidden: !0,
|
|
@@ -2338,7 +2339,7 @@ var $i = X({
|
|
|
2338
2339
|
onChange: (e) => {
|
|
2339
2340
|
x(e.target.files?.[0] ?? null);
|
|
2340
2341
|
}
|
|
2341
|
-
}),
|
|
2342
|
+
}), H("button", {
|
|
2342
2343
|
type: "button",
|
|
2343
2344
|
class: "markweave-attachment-upload-trigger",
|
|
2344
2345
|
"data-markweave-attachment-ui": "true",
|
|
@@ -2347,13 +2348,13 @@ var $i = X({
|
|
|
2347
2348
|
onMousedown: (e) => e.preventDefault(),
|
|
2348
2349
|
onClick: () => b()
|
|
2349
2350
|
}, [
|
|
2350
|
-
|
|
2351
|
+
H("span", {
|
|
2351
2352
|
class: "markweave-attachment-icon",
|
|
2352
2353
|
"aria-hidden": "true"
|
|
2353
|
-
}, [
|
|
2354
|
-
|
|
2355
|
-
h.value ?
|
|
2356
|
-
])]) : i ?
|
|
2354
|
+
}, [Ki(Ri, t.uploadLabel)]),
|
|
2355
|
+
H("span", { class: "markweave-attachment-upload-label" }, t.uploadLabel),
|
|
2356
|
+
h.value ? H("span", { class: "markweave-attachment-upload-error" }, h.value) : null
|
|
2357
|
+
])]) : i ? H(o, {
|
|
2357
2358
|
as: "div",
|
|
2358
2359
|
class: "markweave-attachment markweave-attachment-uploading",
|
|
2359
2360
|
"data-markweave-attachment": "true",
|
|
@@ -2369,13 +2370,13 @@ var $i = X({
|
|
|
2369
2370
|
onKeydown: (t) => {
|
|
2370
2371
|
a.value && e.selected && (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), e.deleteNode());
|
|
2371
2372
|
}
|
|
2372
|
-
}, [
|
|
2373
|
+
}, [H("span", {
|
|
2373
2374
|
class: "markweave-attachment-icon",
|
|
2374
2375
|
"aria-hidden": "true"
|
|
2375
|
-
}, [
|
|
2376
|
+
}, [Ki(Ri, t.uploading)]), H("span", { class: "markweave-attachment-body" }, [H("span", { class: "markweave-attachment-name" }, g.value ?? t.uploading), H("span", { class: "markweave-attachment-meta" }, [H("span", {
|
|
2376
2377
|
class: "markweave-attachment-spinner",
|
|
2377
2378
|
"aria-hidden": "true"
|
|
2378
|
-
}), u || t.uploading])])]) :
|
|
2379
|
+
}), u || t.uploading])])]) : H(o, {
|
|
2379
2380
|
as: "div",
|
|
2380
2381
|
class: "markweave-attachment",
|
|
2381
2382
|
"data-markweave-attachment": "true",
|
|
@@ -2391,22 +2392,22 @@ var $i = X({
|
|
|
2391
2392
|
p.value = !1;
|
|
2392
2393
|
},
|
|
2393
2394
|
onMousedown: (e) => {
|
|
2394
|
-
!a.value ||
|
|
2395
|
+
!a.value || ea(e.target) || (e.preventDefault(), y());
|
|
2395
2396
|
},
|
|
2396
2397
|
onKeydown: (t) => {
|
|
2397
2398
|
a.value && e.selected && (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), e.deleteNode());
|
|
2398
2399
|
},
|
|
2399
2400
|
onClick: C
|
|
2400
2401
|
}, [
|
|
2401
|
-
|
|
2402
|
+
H("span", {
|
|
2402
2403
|
class: "markweave-attachment-icon",
|
|
2403
2404
|
"aria-hidden": "true"
|
|
2404
|
-
}, [
|
|
2405
|
-
|
|
2406
|
-
l ?
|
|
2405
|
+
}, [Ki(_i, t.nodeAriaLabel)]),
|
|
2406
|
+
H("span", { class: "markweave-attachment-body" }, [H("span", { class: "markweave-attachment-name" }, c.value), d.value ? H("span", { class: "markweave-attachment-meta" }, d.value) : null]),
|
|
2407
|
+
l ? H("span", {
|
|
2407
2408
|
class: "markweave-attachment-actions",
|
|
2408
2409
|
"data-markweave-attachment-ui": "true"
|
|
2409
|
-
}, [
|
|
2410
|
+
}, [H("button", {
|
|
2410
2411
|
type: "button",
|
|
2411
2412
|
class: "markweave-attachment-download",
|
|
2412
2413
|
"data-markweave-attachment-ui": "true",
|
|
@@ -2414,10 +2415,10 @@ var $i = X({
|
|
|
2414
2415
|
"aria-label": t.downloadAriaLabel,
|
|
2415
2416
|
onMousedown: (e) => e.preventDefault(),
|
|
2416
2417
|
onClick: S
|
|
2417
|
-
}, [
|
|
2418
|
+
}, [Ki(Zr, t.download), H("span", {
|
|
2418
2419
|
class: "markweave-attachment-tooltip",
|
|
2419
2420
|
role: "tooltip"
|
|
2420
|
-
}, t.download)]), a.value ?
|
|
2421
|
+
}, t.download)]), a.value ? H("button", {
|
|
2421
2422
|
type: "button",
|
|
2422
2423
|
class: "markweave-attachment-delete",
|
|
2423
2424
|
"data-markweave-attachment-ui": "true",
|
|
@@ -2427,14 +2428,14 @@ var $i = X({
|
|
|
2427
2428
|
onClick: (t) => {
|
|
2428
2429
|
t.preventDefault(), t.stopPropagation(), e.deleteNode();
|
|
2429
2430
|
}
|
|
2430
|
-
}, [
|
|
2431
|
+
}, [Ki(Fi, t.delete), H("span", {
|
|
2431
2432
|
class: "markweave-attachment-tooltip",
|
|
2432
2433
|
role: "tooltip"
|
|
2433
2434
|
}, t.delete)]) : null]) : null
|
|
2434
2435
|
]);
|
|
2435
2436
|
};
|
|
2436
2437
|
}
|
|
2437
|
-
}),
|
|
2438
|
+
}), ra = R.extend({
|
|
2438
2439
|
addOptions() {
|
|
2439
2440
|
return {
|
|
2440
2441
|
...this.parent?.(),
|
|
@@ -2445,9 +2446,9 @@ var $i = X({
|
|
|
2445
2446
|
};
|
|
2446
2447
|
},
|
|
2447
2448
|
addNodeView() {
|
|
2448
|
-
return typeof document > "u" ? null : s(
|
|
2449
|
+
return typeof document > "u" ? null : s(na, { stopEvent: ({ event: e }) => ea(e.target) });
|
|
2449
2450
|
}
|
|
2450
|
-
}),
|
|
2451
|
+
}), ia = Y({
|
|
2451
2452
|
name: "MarkweaveVueLinkCardNodeView",
|
|
2452
2453
|
props: {
|
|
2453
2454
|
editor: {
|
|
@@ -2480,11 +2481,11 @@ var $i = X({
|
|
|
2480
2481
|
}
|
|
2481
2482
|
},
|
|
2482
2483
|
setup(e) {
|
|
2483
|
-
let n = e.extension.options, r = n.messages ?? t("zh"), i =
|
|
2484
|
-
|
|
2484
|
+
let n = e.extension.options, r = n.messages ?? t("zh"), i = Hi(e.editor), a = U(!1), s = U(!1), c = U(!1), l = G(() => g(e.node.attrs ?? {})), d = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
|
|
2485
|
+
K(l, (e) => {
|
|
2485
2486
|
d.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
|
|
2486
2487
|
});
|
|
2487
|
-
let p =
|
|
2488
|
+
let p = G(() => u(i.value)), m = G(() => {
|
|
2488
2489
|
try {
|
|
2489
2490
|
return new URL(l.value?.href ?? "").host;
|
|
2490
2491
|
} catch {
|
|
@@ -2508,18 +2509,18 @@ var $i = X({
|
|
|
2508
2509
|
...r,
|
|
2509
2510
|
...i
|
|
2510
2511
|
}) ?? r);
|
|
2511
|
-
}, C = (e, t, n, r) =>
|
|
2512
|
+
}, C = (e, t, n, r) => H("button", {
|
|
2512
2513
|
type: "button",
|
|
2513
2514
|
title: e,
|
|
2514
2515
|
"aria-label": e,
|
|
2515
2516
|
"data-testid": n,
|
|
2516
2517
|
onMousedown: y,
|
|
2517
2518
|
onClick: r
|
|
2518
|
-
}, [
|
|
2519
|
+
}, [Ki(t, e), H("span", { role: "tooltip" }, e)]);
|
|
2519
2520
|
return () => {
|
|
2520
2521
|
let t = l.value;
|
|
2521
2522
|
if (!t) return null;
|
|
2522
|
-
let i = !c.value && t.imageUrl ?
|
|
2523
|
+
let i = !c.value && t.imageUrl ? H("img", {
|
|
2523
2524
|
src: t.imageUrl,
|
|
2524
2525
|
alt: "",
|
|
2525
2526
|
loading: "lazy",
|
|
@@ -2527,7 +2528,7 @@ var $i = X({
|
|
|
2527
2528
|
onError: () => {
|
|
2528
2529
|
c.value = !0;
|
|
2529
2530
|
}
|
|
2530
|
-
}) : !c.value && t.faviconUrl ?
|
|
2531
|
+
}) : !c.value && t.faviconUrl ? H("img", {
|
|
2531
2532
|
class: "markweave-link-card-favicon",
|
|
2532
2533
|
src: t.faviconUrl,
|
|
2533
2534
|
alt: "",
|
|
@@ -2536,8 +2537,8 @@ var $i = X({
|
|
|
2536
2537
|
onError: () => {
|
|
2537
2538
|
c.value = !0;
|
|
2538
2539
|
}
|
|
2539
|
-
}) :
|
|
2540
|
-
return
|
|
2540
|
+
}) : H("b", null, m.value.slice(0, 1).toUpperCase());
|
|
2541
|
+
return H(o, {
|
|
2541
2542
|
as: "article",
|
|
2542
2543
|
class: "markweave-link-card",
|
|
2543
2544
|
"data-testid": "markweave-link-card",
|
|
@@ -2551,32 +2552,32 @@ var $i = X({
|
|
|
2551
2552
|
a.value = !1;
|
|
2552
2553
|
},
|
|
2553
2554
|
onMousedown: (e) => {
|
|
2554
|
-
|
|
2555
|
+
Gi(e.target) || e.preventDefault();
|
|
2555
2556
|
},
|
|
2556
2557
|
onClick: (e) => {
|
|
2557
|
-
|
|
2558
|
+
Gi(e.target) || (e.preventDefault(), t.href && window.open(t.href, "_blank", "noopener,noreferrer"));
|
|
2558
2559
|
}
|
|
2559
2560
|
}, () => [
|
|
2560
|
-
|
|
2561
|
+
H("a", {
|
|
2561
2562
|
class: "markweave-link-card-main",
|
|
2562
2563
|
href: t.href,
|
|
2563
2564
|
"aria-label": r.linkCard.open
|
|
2564
|
-
}, [
|
|
2565
|
-
|
|
2566
|
-
t.description ?
|
|
2567
|
-
|
|
2568
|
-
]),
|
|
2565
|
+
}, [H("span", { class: "markweave-link-card-copy" }, [
|
|
2566
|
+
H("strong", null, t.title),
|
|
2567
|
+
t.description ? H("span", null, t.description) : null,
|
|
2568
|
+
H("small", null, t.siteName ?? m.value)
|
|
2569
|
+
]), H("span", {
|
|
2569
2570
|
class: "markweave-link-card-media",
|
|
2570
2571
|
"aria-hidden": "true"
|
|
2571
2572
|
}, [i])]),
|
|
2572
|
-
p.value ?
|
|
2573
|
+
p.value ? H("div", {
|
|
2573
2574
|
class: "markweave-link-card-tools",
|
|
2574
2575
|
"data-markweave-link-card-ui": "true",
|
|
2575
2576
|
"aria-label": r.linkCard.toolsAriaLabel
|
|
2576
2577
|
}, [
|
|
2577
|
-
C(r.linkCard.convertToLink,
|
|
2578
|
-
C(r.linkCard.copyAddress,
|
|
2579
|
-
C(r.linkCard.edit,
|
|
2578
|
+
C(r.linkCard.convertToLink, ui, "markweave-link-card-convert", x),
|
|
2579
|
+
C(r.linkCard.copyAddress, Zr, "markweave-link-card-copy", () => b(t.href)),
|
|
2580
|
+
C(r.linkCard.edit, vi, "markweave-link-card-edit", (i) => h({
|
|
2580
2581
|
anchor: i.currentTarget,
|
|
2581
2582
|
editor: e.editor,
|
|
2582
2583
|
messages: r,
|
|
@@ -2586,15 +2587,15 @@ var $i = X({
|
|
|
2586
2587
|
attrs: t
|
|
2587
2588
|
}
|
|
2588
2589
|
})),
|
|
2589
|
-
C(r.linkCard.delete,
|
|
2590
|
+
C(r.linkCard.delete, Fi, "markweave-link-card-delete", () => e.deleteNode())
|
|
2590
2591
|
]) : null,
|
|
2591
|
-
p.value && s.value ?
|
|
2592
|
+
p.value && s.value ? H("form", {
|
|
2592
2593
|
class: "markweave-link-card-editor",
|
|
2593
2594
|
"data-markweave-link-card-ui": "true",
|
|
2594
2595
|
"data-testid": "markweave-link-card-editor",
|
|
2595
2596
|
onSubmit: S
|
|
2596
2597
|
}, [
|
|
2597
|
-
|
|
2598
|
+
H("label", null, [H("span", null, r.linkCard.titleLabel), H("input", {
|
|
2598
2599
|
value: d.value,
|
|
2599
2600
|
placeholder: r.linkCard.titlePlaceholder,
|
|
2600
2601
|
"aria-label": r.linkCard.titleLabel,
|
|
@@ -2602,7 +2603,7 @@ var $i = X({
|
|
|
2602
2603
|
d.value = e.target.value;
|
|
2603
2604
|
}
|
|
2604
2605
|
})]),
|
|
2605
|
-
|
|
2606
|
+
H("label", null, [H("span", null, r.linkCard.addressLabel), H("input", {
|
|
2606
2607
|
value: f.value,
|
|
2607
2608
|
placeholder: r.linkCard.addressPlaceholder,
|
|
2608
2609
|
"aria-label": r.linkCard.addressLabel,
|
|
@@ -2610,16 +2611,16 @@ var $i = X({
|
|
|
2610
2611
|
f.value = e.target.value;
|
|
2611
2612
|
}
|
|
2612
2613
|
})]),
|
|
2613
|
-
|
|
2614
|
+
H("button", {
|
|
2614
2615
|
type: "submit",
|
|
2615
2616
|
disabled: !_(f.value),
|
|
2616
2617
|
"aria-label": r.linkCard.edit
|
|
2617
|
-
}, [
|
|
2618
|
+
}, [Ki(ui, r.linkCard.edit)])
|
|
2618
2619
|
]) : null
|
|
2619
2620
|
]);
|
|
2620
2621
|
};
|
|
2621
2622
|
}
|
|
2622
|
-
}),
|
|
2623
|
+
}), aa = m.extend({
|
|
2623
2624
|
addOptions() {
|
|
2624
2625
|
return {
|
|
2625
2626
|
...this.parent?.(),
|
|
@@ -2628,24 +2629,25 @@ var $i = X({
|
|
|
2628
2629
|
};
|
|
2629
2630
|
},
|
|
2630
2631
|
addNodeView() {
|
|
2631
|
-
return typeof document > "u" ? null : s(
|
|
2632
|
+
return typeof document > "u" ? null : s(ia, { stopEvent: ({ event: e }) => Gi(e.target) });
|
|
2632
2633
|
}
|
|
2633
2634
|
});
|
|
2634
2635
|
//#endregion
|
|
2635
2636
|
//#region src/create-editor-extensions.ts
|
|
2636
|
-
function
|
|
2637
|
+
function oa(n = {}) {
|
|
2637
2638
|
return e({
|
|
2638
2639
|
lang: n.lang,
|
|
2639
2640
|
onImageUpload: n.onImageUpload,
|
|
2640
|
-
|
|
2641
|
+
tableCapabilities: n.tableCapabilities,
|
|
2642
|
+
linkCardExtension: aa.configure({
|
|
2641
2643
|
lang: n.lang,
|
|
2642
2644
|
messages: t(n.lang),
|
|
2643
2645
|
resolver: n.linkCardResolver
|
|
2644
2646
|
}),
|
|
2645
2647
|
mediaExtensions: r({
|
|
2646
|
-
image:
|
|
2647
|
-
video:
|
|
2648
|
-
attachment:
|
|
2648
|
+
image: Qi,
|
|
2649
|
+
video: $i,
|
|
2650
|
+
attachment: ra,
|
|
2649
2651
|
lang: n.lang,
|
|
2650
2652
|
onImageUpload: n.onImageUpload,
|
|
2651
2653
|
onVideoUpload: n.onVideoUpload,
|
|
@@ -2658,7 +2660,7 @@ function ra(n = {}) {
|
|
|
2658
2660
|
}
|
|
2659
2661
|
//#endregion
|
|
2660
2662
|
//#region src/MarkweaveEditor.ts
|
|
2661
|
-
var
|
|
2663
|
+
var sa = {
|
|
2662
2664
|
active: !1,
|
|
2663
2665
|
mode: "outside",
|
|
2664
2666
|
activeCellPos: null,
|
|
@@ -2666,17 +2668,17 @@ var ia = {
|
|
|
2666
2668
|
selectedCellCount: 0,
|
|
2667
2669
|
selectionFrom: 0,
|
|
2668
2670
|
selectionTo: 0
|
|
2669
|
-
},
|
|
2671
|
+
}, ca = {
|
|
2670
2672
|
active: !1,
|
|
2671
|
-
language:
|
|
2673
|
+
language: ct.defaultLanguage,
|
|
2672
2674
|
mermaidPreviewMode: "code",
|
|
2673
2675
|
pos: null,
|
|
2674
2676
|
text: ""
|
|
2675
2677
|
};
|
|
2676
|
-
function
|
|
2677
|
-
return
|
|
2678
|
+
function la(e) {
|
|
2679
|
+
return kn.getState(e.state) ?? On;
|
|
2678
2680
|
}
|
|
2679
|
-
function
|
|
2681
|
+
function ua(e) {
|
|
2680
2682
|
if (!e || typeof window > "u") return null;
|
|
2681
2683
|
let t = e.parentElement;
|
|
2682
2684
|
for (; t;) {
|
|
@@ -2686,141 +2688,142 @@ function sa(e) {
|
|
|
2686
2688
|
}
|
|
2687
2689
|
return null;
|
|
2688
2690
|
}
|
|
2689
|
-
function
|
|
2690
|
-
return
|
|
2691
|
+
function Z(e, t, n = 18, r = 1.8) {
|
|
2692
|
+
return H(e, {
|
|
2691
2693
|
size: n,
|
|
2692
2694
|
strokeWidth: r,
|
|
2693
2695
|
"aria-hidden": "true"
|
|
2694
2696
|
}, { default: () => t });
|
|
2695
2697
|
}
|
|
2696
|
-
function
|
|
2697
|
-
return e === "clipboard" ? [
|
|
2698
|
+
function da(e) {
|
|
2699
|
+
return e === "clipboard" ? [H("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" }), H("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" ? [H("circle", {
|
|
2698
2700
|
cx: "10",
|
|
2699
2701
|
cy: "10",
|
|
2700
2702
|
r: "5.5"
|
|
2701
|
-
}),
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2703
|
+
}), H("path", { d: "m14 14 4 4" })] : e === "check" ? [H("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
|
|
2704
|
+
H("path", { d: "M8 4H4v4" }),
|
|
2705
|
+
H("path", { d: "M4 4l5 5" }),
|
|
2706
|
+
H("path", { d: "M16 4h4v4" }),
|
|
2707
|
+
H("path", { d: "m20 4-5 5" }),
|
|
2708
|
+
H("path", { d: "M8 20H4v-4" }),
|
|
2709
|
+
H("path", { d: "m4 20 5-5" }),
|
|
2710
|
+
H("path", { d: "M16 20h4v-4" }),
|
|
2711
|
+
H("path", { d: "m20 20-5-5" })
|
|
2710
2712
|
] : e === "download" ? [
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
] : e === "close" ? [
|
|
2715
|
-
|
|
2713
|
+
H("path", { d: "M12 4v10" }),
|
|
2714
|
+
H("path", { d: "m8 10 4 4 4-4" }),
|
|
2715
|
+
H("path", { d: "M5 19h14" })
|
|
2716
|
+
] : e === "close" ? [H("path", { d: "M6 6l12 12" }), H("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
|
|
2717
|
+
H("circle", {
|
|
2716
2718
|
cx: "10",
|
|
2717
2719
|
cy: "10",
|
|
2718
2720
|
r: "5.25"
|
|
2719
2721
|
}),
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
+
H("path", { d: "M7.5 10h5" }),
|
|
2723
|
+
H("path", { d: "m14 14 4 4" })
|
|
2722
2724
|
] : e === "zoomIn" ? [
|
|
2723
|
-
|
|
2725
|
+
H("circle", {
|
|
2724
2726
|
cx: "10",
|
|
2725
2727
|
cy: "10",
|
|
2726
2728
|
r: "5.25"
|
|
2727
2729
|
}),
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
] : e === "reset" ? [
|
|
2730
|
+
H("path", { d: "M7.5 10h5" }),
|
|
2731
|
+
H("path", { d: "M10 7.5v5" }),
|
|
2732
|
+
H("path", { d: "m14 14 4 4" })
|
|
2733
|
+
] : e === "reset" ? [H("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), H("path", { d: "M6.5 8.5H3.5v-3" })] : [H("path", { d: "m6 9 6 6 6-6" })];
|
|
2732
2734
|
}
|
|
2733
|
-
function
|
|
2734
|
-
return
|
|
2735
|
+
function Q(e) {
|
|
2736
|
+
return H("svg", {
|
|
2735
2737
|
viewBox: "0 0 24 24",
|
|
2736
2738
|
"aria-hidden": "true",
|
|
2737
2739
|
focusable: "false"
|
|
2738
|
-
},
|
|
2740
|
+
}, H("g", {
|
|
2739
2741
|
fill: "none",
|
|
2740
2742
|
stroke: "currentColor",
|
|
2741
2743
|
"stroke-linecap": "round",
|
|
2742
2744
|
"stroke-linejoin": "round",
|
|
2743
2745
|
"stroke-width": "1.8"
|
|
2744
|
-
},
|
|
2746
|
+
}, da(e)));
|
|
2745
2747
|
}
|
|
2746
2748
|
function $(e) {
|
|
2747
2749
|
e.preventDefault();
|
|
2748
2750
|
}
|
|
2749
|
-
function
|
|
2750
|
-
let t =
|
|
2751
|
+
function fa(e) {
|
|
2752
|
+
let t = zt(e);
|
|
2751
2753
|
return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
|
|
2752
2754
|
}
|
|
2753
|
-
var
|
|
2754
|
-
bold:
|
|
2755
|
-
italic:
|
|
2756
|
-
underline:
|
|
2757
|
-
strike:
|
|
2758
|
-
"inline-code":
|
|
2759
|
-
link:
|
|
2760
|
-
more:
|
|
2761
|
-
superscript:
|
|
2762
|
-
subscript:
|
|
2763
|
-
"inline-math":
|
|
2764
|
-
"align-left":
|
|
2765
|
-
"align-center":
|
|
2766
|
-
"align-right":
|
|
2767
|
-
"align-justify":
|
|
2768
|
-
"decrease-indent":
|
|
2769
|
-
"increase-indent":
|
|
2770
|
-
},
|
|
2771
|
-
type:
|
|
2772
|
-
"heading-1":
|
|
2773
|
-
"heading-2":
|
|
2774
|
-
"heading-3":
|
|
2775
|
-
"bullet-list":
|
|
2776
|
-
"ordered-list":
|
|
2777
|
-
"task-list":
|
|
2778
|
-
blockquote:
|
|
2779
|
-
"code-block":
|
|
2780
|
-
info:
|
|
2781
|
-
tip:
|
|
2782
|
-
warning:
|
|
2783
|
-
error:
|
|
2784
|
-
success:
|
|
2785
|
-
emoji:
|
|
2786
|
-
math:
|
|
2787
|
-
table:
|
|
2788
|
-
separator:
|
|
2789
|
-
image:
|
|
2790
|
-
video:
|
|
2791
|
-
attachment:
|
|
2755
|
+
var pa = {
|
|
2756
|
+
bold: zr,
|
|
2757
|
+
italic: ci,
|
|
2758
|
+
underline: Li,
|
|
2759
|
+
strike: Oi,
|
|
2760
|
+
"inline-code": Jr,
|
|
2761
|
+
link: ui,
|
|
2762
|
+
more: hi,
|
|
2763
|
+
superscript: Ai,
|
|
2764
|
+
subscript: ki,
|
|
2765
|
+
"inline-math": Ci,
|
|
2766
|
+
"align-left": Cr,
|
|
2767
|
+
"align-center": xr,
|
|
2768
|
+
"align-right": wr,
|
|
2769
|
+
"align-justify": Sr,
|
|
2770
|
+
"decrease-indent": ai,
|
|
2771
|
+
"increase-indent": oi
|
|
2772
|
+
}, ma = {
|
|
2773
|
+
type: Pi,
|
|
2774
|
+
"heading-1": ei,
|
|
2775
|
+
"heading-2": ti,
|
|
2776
|
+
"heading-3": ni,
|
|
2777
|
+
"bullet-list": di,
|
|
2778
|
+
"ordered-list": pi,
|
|
2779
|
+
"task-list": fi,
|
|
2780
|
+
blockquote: bi,
|
|
2781
|
+
"code-block": Br,
|
|
2782
|
+
info: si,
|
|
2783
|
+
tip: li,
|
|
2784
|
+
warning: Or,
|
|
2785
|
+
error: qr,
|
|
2786
|
+
success: Ur,
|
|
2787
|
+
emoji: wi,
|
|
2788
|
+
math: Ci,
|
|
2789
|
+
table: ji,
|
|
2790
|
+
separator: mi,
|
|
2791
|
+
image: ri,
|
|
2792
|
+
video: zi,
|
|
2793
|
+
attachment: _i
|
|
2792
2794
|
};
|
|
2793
|
-
function
|
|
2795
|
+
function ha(e) {
|
|
2794
2796
|
if (typeof e != "string") {
|
|
2795
|
-
if (e.kind === "text") return
|
|
2797
|
+
if (e.kind === "text") return H("span", {
|
|
2796
2798
|
class: "markweave-slash-command-text-icon",
|
|
2799
|
+
"data-icon-length": an(e),
|
|
2797
2800
|
"aria-hidden": "true"
|
|
2798
2801
|
}, e.text);
|
|
2799
2802
|
e = e.name;
|
|
2800
2803
|
}
|
|
2801
|
-
let t =
|
|
2802
|
-
return
|
|
2804
|
+
let t = ma[e];
|
|
2805
|
+
return H(t, {
|
|
2803
2806
|
size: 18,
|
|
2804
2807
|
strokeWidth: 1.6,
|
|
2805
2808
|
absoluteStrokeWidth: !0,
|
|
2806
2809
|
"aria-hidden": "true"
|
|
2807
2810
|
});
|
|
2808
2811
|
}
|
|
2809
|
-
var
|
|
2810
|
-
paragraph:
|
|
2811
|
-
"heading-1":
|
|
2812
|
-
"heading-2":
|
|
2813
|
-
"heading-3":
|
|
2814
|
-
"bullet-list":
|
|
2815
|
-
"numbered-list":
|
|
2816
|
-
"todo-list":
|
|
2817
|
-
quote:
|
|
2818
|
-
"code-block":
|
|
2812
|
+
var ga = {
|
|
2813
|
+
paragraph: Ii,
|
|
2814
|
+
"heading-1": ei,
|
|
2815
|
+
"heading-2": ti,
|
|
2816
|
+
"heading-3": ni,
|
|
2817
|
+
"bullet-list": di,
|
|
2818
|
+
"numbered-list": pi,
|
|
2819
|
+
"todo-list": fi,
|
|
2820
|
+
quote: bi,
|
|
2821
|
+
"code-block": Br
|
|
2819
2822
|
};
|
|
2820
|
-
function
|
|
2821
|
-
return
|
|
2823
|
+
function _a(e, t) {
|
|
2824
|
+
return pe(e, t).label;
|
|
2822
2825
|
}
|
|
2823
|
-
var
|
|
2826
|
+
var va = Y({
|
|
2824
2827
|
name: "MarkweaveVueFloatingToolbar",
|
|
2825
2828
|
props: {
|
|
2826
2829
|
editor: {
|
|
@@ -2845,73 +2848,73 @@ var ga = X({
|
|
|
2845
2848
|
}
|
|
2846
2849
|
},
|
|
2847
2850
|
setup(e) {
|
|
2848
|
-
let t =
|
|
2851
|
+
let t = U(null), n = U("input"), r = U(""), i = U(""), a = U(""), o = U(""), s = W(null), c = W(null), l = U(null), u = U(null), d = "", f = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = U(""), m = U(null), h = U(null), g = U("bottom"), _ = U(null), v = U(null), y = U(null), b = G(() => zt(p.value.trim())), x = G(() => e.messages.floatingToolbar), S = G(() => _e(e.messages).map((e) => [
|
|
2849
2852
|
e.id,
|
|
2850
2853
|
e.label,
|
|
2851
|
-
|
|
2852
|
-
])), C =
|
|
2854
|
+
ga[e.id]
|
|
2855
|
+
])), C = G(() => ge(e.messages).map((e) => [
|
|
2853
2856
|
e.id,
|
|
2854
2857
|
e.value,
|
|
2855
2858
|
e.label
|
|
2856
|
-
])),
|
|
2859
|
+
])), ee = G(() => me(e.messages).map((e) => [
|
|
2857
2860
|
e.id,
|
|
2858
2861
|
e.value,
|
|
2859
2862
|
e.label
|
|
2860
|
-
])),
|
|
2863
|
+
])), w = G(() => he(e.messages).map((e) => e.id)), T = () => {
|
|
2861
2864
|
b.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: b.value }).run(), t.value = null);
|
|
2862
|
-
},
|
|
2865
|
+
}, E = () => {
|
|
2863
2866
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), p.value = "", t.value = null;
|
|
2864
|
-
},
|
|
2867
|
+
}, D = (n) => {
|
|
2865
2868
|
t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
|
|
2866
|
-
},
|
|
2867
|
-
|
|
2868
|
-
}),
|
|
2869
|
-
c.value?.abort(),
|
|
2870
|
-
},
|
|
2869
|
+
}, O = se(() => {
|
|
2870
|
+
Ge(e.editor, d), a.value = d;
|
|
2871
|
+
}), k = (n = !0) => {
|
|
2872
|
+
c.value?.abort(), O.cancel(), d = "", c.value = null, l.value = null, n && Ue(e.editor), Fe(e.editor), t.value = null, n && e.editor.commands.focus();
|
|
2873
|
+
}, A = () => {
|
|
2871
2874
|
if (!f.value) return;
|
|
2872
|
-
let r =
|
|
2873
|
-
r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai",
|
|
2874
|
-
},
|
|
2875
|
+
let r = qe(e.editor);
|
|
2876
|
+
r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus()));
|
|
2877
|
+
}, j = async (t) => {
|
|
2875
2878
|
if (!f.value || e.askAi?.enabled !== !0 || !s.value) return;
|
|
2876
2879
|
let u = (t ?? r.value).trim();
|
|
2877
2880
|
if (!u) {
|
|
2878
2881
|
o.value = e.messages.askAi.emptyPrompt, n.value = "error";
|
|
2879
2882
|
return;
|
|
2880
2883
|
}
|
|
2881
|
-
let p =
|
|
2884
|
+
let p = Le(e.editor, s.value);
|
|
2882
2885
|
if (!p) {
|
|
2883
2886
|
n.value = "conflict";
|
|
2884
2887
|
return;
|
|
2885
2888
|
}
|
|
2886
|
-
s.value = p, c.value?.abort(),
|
|
2887
|
-
let m = new AbortController(), h =
|
|
2888
|
-
c.value = m, l.value = h.id, i.value = u,
|
|
2889
|
+
s.value = p, c.value?.abort(), Pe(e.editor);
|
|
2890
|
+
let m = new AbortController(), h = Ie(p, u, e.lang, m.signal, void 0, ze(e.editor)?.target);
|
|
2891
|
+
c.value = m, l.value = h.id, i.value = u, O.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
|
|
2889
2892
|
try {
|
|
2890
|
-
let t = await
|
|
2891
|
-
l.value === h.id && !m.signal.aborted && (d = e,
|
|
2893
|
+
let t = await We(e.askAi.handler, h, (e) => {
|
|
2894
|
+
l.value === h.id && !m.signal.aborted && (d = e, O.schedule());
|
|
2892
2895
|
});
|
|
2893
2896
|
if (l.value !== h.id || m.signal.aborted) return;
|
|
2894
|
-
if (
|
|
2895
|
-
a.value = t, r.value = "", n.value =
|
|
2897
|
+
if (O.cancel(), d = t, !Ge(e.editor, t)) throw new Ae("invalid-output", "Ask AI output is incompatible with the selected content.");
|
|
2898
|
+
a.value = t, r.value = "", n.value = ze(e.editor)?.status === "target" ? "result" : "conflict";
|
|
2896
2899
|
} catch (t) {
|
|
2897
2900
|
if (l.value !== h.id) return;
|
|
2898
|
-
if (
|
|
2899
|
-
|
|
2901
|
+
if (O.cancel(), m.signal.aborted) {
|
|
2902
|
+
Pe(e.editor), n.value = ze(e.editor)?.status === "conflict" ? "conflict" : "input";
|
|
2900
2903
|
return;
|
|
2901
2904
|
}
|
|
2902
|
-
|
|
2905
|
+
Pe(e.editor), o.value = t instanceof Ae ? t.code === "empty-result" ? e.messages.askAi.emptyResult : e.messages.askAi.errorFallback : t instanceof Error && t.message ? t.message : e.messages.askAi.errorFallback, n.value = "error";
|
|
2903
2906
|
}
|
|
2904
|
-
},
|
|
2905
|
-
if (!
|
|
2906
|
-
n.value =
|
|
2907
|
+
}, te = () => {
|
|
2908
|
+
if (!je(e.editor, a.value)) {
|
|
2909
|
+
n.value = ze(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
|
|
2907
2910
|
return;
|
|
2908
2911
|
}
|
|
2909
|
-
t.value = null, window.setTimeout(() =>
|
|
2910
|
-
},
|
|
2912
|
+
t.value = null, window.setTimeout(() => Fe(e.editor), 560), e.editor.commands.focus();
|
|
2913
|
+
}, M = se(() => {
|
|
2911
2914
|
let n = _.value, r = y.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
2912
2915
|
if (!t.value || !n || !r) return;
|
|
2913
2916
|
if (t.value === "ask-ai") {
|
|
2914
|
-
let t =
|
|
2917
|
+
let t = Be(e.editor), n = v.value?.getBoundingClientRect();
|
|
2915
2918
|
if (!t || !n) return;
|
|
2916
2919
|
let a = {
|
|
2917
2920
|
anchorRect: n,
|
|
@@ -2921,18 +2924,18 @@ var ga = X({
|
|
|
2921
2924
|
height: window.innerHeight
|
|
2922
2925
|
},
|
|
2923
2926
|
frameRect: i?.getBoundingClientRect() ?? null,
|
|
2924
|
-
surfaceRect:
|
|
2925
|
-
}, o =
|
|
2927
|
+
surfaceRect: Re(e.editor.view.dom)
|
|
2928
|
+
}, o = Me({
|
|
2926
2929
|
...a,
|
|
2927
2930
|
panelSize: r.getBoundingClientRect()
|
|
2928
2931
|
}), s = `${o.width}px`;
|
|
2929
|
-
r.style.width !== s && (r.style.width = s, o =
|
|
2932
|
+
r.style.width !== s && (r.style.width = s, o = Me({
|
|
2930
2933
|
...a,
|
|
2931
2934
|
panelSize: r.getBoundingClientRect()
|
|
2932
2935
|
})), r.style.left = `${o.left}px`, r.style.top = `${o.top}px`, r.style.bottom = "auto", r.style.maxWidth = `${o.maxWidth}px`, r.style.maxHeight = `${Math.max(0, o.maxHeight)}px`, r.dataset.positioned = "true", g.value = o.placement;
|
|
2933
2936
|
return;
|
|
2934
2937
|
}
|
|
2935
|
-
let a =
|
|
2938
|
+
let a = Ce({
|
|
2936
2939
|
toolbarRect: n.getBoundingClientRect(),
|
|
2937
2940
|
popoverSize: r.getBoundingClientRect(),
|
|
2938
2941
|
viewport: {
|
|
@@ -2943,56 +2946,56 @@ var ga = X({
|
|
|
2943
2946
|
gap: t.value === "more" ? 8 : 6
|
|
2944
2947
|
});
|
|
2945
2948
|
g.value = a.placement;
|
|
2946
|
-
}),
|
|
2947
|
-
let l =
|
|
2949
|
+
}), N = () => {
|
|
2950
|
+
let l = ze(e.editor);
|
|
2948
2951
|
if (l?.target.kind === "table" && l.status === "target" && t.value !== "ask-ai") {
|
|
2949
|
-
s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai",
|
|
2952
|
+
s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus());
|
|
2950
2953
|
return;
|
|
2951
2954
|
}
|
|
2952
|
-
t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(),
|
|
2953
|
-
},
|
|
2954
|
-
e.key !== "Escape" || t.value !== "ask-ai" || (e.preventDefault(), n.value === "generating" ? (c.value?.abort(),
|
|
2955
|
-
},
|
|
2955
|
+
t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(), O.cancel(), n.value = "conflict");
|
|
2956
|
+
}, P = (e) => {
|
|
2957
|
+
e.key !== "Escape" || t.value !== "ask-ai" || (e.preventDefault(), n.value === "generating" ? (c.value?.abort(), O.cancel(), n.value = "input") : k(!0));
|
|
2958
|
+
}, ne = (e) => {
|
|
2956
2959
|
if (!(!t.value || v.value?.contains(e.target))) {
|
|
2957
2960
|
if (t.value === "ask-ai") {
|
|
2958
|
-
|
|
2961
|
+
k(!0);
|
|
2959
2962
|
return;
|
|
2960
2963
|
}
|
|
2961
2964
|
t.value = null;
|
|
2962
2965
|
}
|
|
2963
2966
|
};
|
|
2964
|
-
|
|
2967
|
+
K(() => [
|
|
2965
2968
|
t.value,
|
|
2966
2969
|
n.value,
|
|
2967
2970
|
a.value,
|
|
2968
2971
|
o.value
|
|
2969
2972
|
], ([e]) => {
|
|
2970
|
-
e &&
|
|
2971
|
-
}),
|
|
2972
|
-
window.addEventListener("resize",
|
|
2973
|
-
}),
|
|
2974
|
-
|
|
2973
|
+
e && J(M.schedule);
|
|
2974
|
+
}), vr(() => {
|
|
2975
|
+
window.addEventListener("resize", M.schedule), window.addEventListener("scroll", M.schedule, !0), e.editor.on("transaction", N), document.addEventListener("pointerdown", ne, !0), document.addEventListener("keydown", P, !0);
|
|
2976
|
+
}), q(() => {
|
|
2977
|
+
M.cancel(), O.cancel(), window.removeEventListener("resize", M.schedule), window.removeEventListener("scroll", M.schedule, !0), e.editor.off("transaction", N), document.removeEventListener("pointerdown", ne, !0), document.removeEventListener("keydown", P, !0), c.value?.abort(), Fe(e.editor);
|
|
2975
2978
|
});
|
|
2976
|
-
let
|
|
2979
|
+
let F = (n) => n === "block-type" || n === "color" || n === "more" ? t.value === n : n === "bold" ? e.editor.isActive("bold") : n === "italic" ? e.editor.isActive("italic") : n === "underline" ? e.editor.isActive("underline") : n === "strike" ? e.editor.isActive("strike") : n === "inline-code" ? e.editor.isActive("code") : n === "link" ? e.editor.isActive("link") : !1, I = (e, t) => {
|
|
2977
2980
|
if (m.value = e, !e || !(t instanceof HTMLElement) || !v.value) {
|
|
2978
2981
|
h.value = null;
|
|
2979
2982
|
return;
|
|
2980
2983
|
}
|
|
2981
2984
|
let n = t.getBoundingClientRect(), r = v.value.getBoundingClientRect();
|
|
2982
2985
|
h.value = n.left + n.width / 2 - r.left;
|
|
2983
|
-
},
|
|
2986
|
+
}, L = () => {
|
|
2984
2987
|
let e = m.value;
|
|
2985
2988
|
if (!e || t.value !== null) return null;
|
|
2986
2989
|
let n = x.value.buttons[e];
|
|
2987
|
-
return n ?
|
|
2990
|
+
return n ? H("div", {
|
|
2988
2991
|
class: "markweave-floating-toolbar-tooltip",
|
|
2989
2992
|
role: "tooltip",
|
|
2990
2993
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
2991
2994
|
"data-button-id": e,
|
|
2992
|
-
"data-active":
|
|
2995
|
+
"data-active": F(e),
|
|
2993
2996
|
style: h.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${h.value}px` }
|
|
2994
2997
|
}, n) : null;
|
|
2995
|
-
},
|
|
2998
|
+
}, R = (n, r, i, a, o = !1, s) => H("button", {
|
|
2996
2999
|
type: "button",
|
|
2997
3000
|
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
2998
3001
|
"aria-label": r,
|
|
@@ -3006,19 +3009,19 @@ var ga = X({
|
|
|
3006
3009
|
"data-active": o || t.value === n,
|
|
3007
3010
|
"data-tooltip-active": m.value === n ? "true" : "false",
|
|
3008
3011
|
"data-testid": `markweave-floating-toolbar-button-${n}`,
|
|
3009
|
-
onBlur: () =>
|
|
3010
|
-
onFocus: (e) =>
|
|
3012
|
+
onBlur: () => I(null),
|
|
3013
|
+
onFocus: (e) => I(n, e.currentTarget),
|
|
3011
3014
|
onMousedown: $,
|
|
3012
|
-
onMouseenter: (e) =>
|
|
3013
|
-
onMouseleave: () =>
|
|
3015
|
+
onMouseenter: (e) => I(n, e.currentTarget),
|
|
3016
|
+
onMouseleave: () => I(null),
|
|
3014
3017
|
onClick: a
|
|
3015
|
-
}, n === "ask-ai" ? [
|
|
3018
|
+
}, n === "ask-ai" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [Z(i, r), H("span", null, s ?? r)])] : n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, _a(e.editor, e.messages)), Z(t.value === "block-type" ? Kr : Wr, r)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? Kr : Wr, r)])] : [Z(i, r)]), z = () => H("span", {
|
|
3016
3019
|
class: "markweave-floating-toolbar-divider",
|
|
3017
3020
|
"aria-hidden": "true"
|
|
3018
|
-
}),
|
|
3021
|
+
}), B = (n, r, i) => H("section", {
|
|
3019
3022
|
class: "markweave-floating-toolbar-color-section",
|
|
3020
3023
|
"aria-label": n
|
|
3021
|
-
}, [
|
|
3024
|
+
}, [H("div", { class: "markweave-floating-toolbar-menu-title" }, n), H("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => H("button", {
|
|
3022
3025
|
key: `${r}-${n}`,
|
|
3023
3026
|
type: "button",
|
|
3024
3027
|
"aria-label": a,
|
|
@@ -3027,24 +3030,24 @@ var ga = X({
|
|
|
3027
3030
|
onClick: () => {
|
|
3028
3031
|
r === "text" ? i ? e.editor.chain().focus().setColor(i).run() : e.editor.chain().focus().unsetColor().run() : i ? e.editor.chain().focus().toggleHighlight({ color: i }).run() : e.editor.chain().focus().unsetHighlight().run(), t.value = null;
|
|
3029
3032
|
}
|
|
3030
|
-
}, r === "text" ? [
|
|
3033
|
+
}, r === "text" ? [H("span", {
|
|
3031
3034
|
class: "markweave-floating-toolbar-text-swatch",
|
|
3032
3035
|
style: { color: i ?? "#646970" }
|
|
3033
|
-
}, "A")] : [
|
|
3036
|
+
}, "A")] : [H("span", {
|
|
3034
3037
|
class: "markweave-floating-toolbar-highlight-swatch",
|
|
3035
3038
|
style: { backgroundColor: i ?? "#ffffff" },
|
|
3036
3039
|
"aria-hidden": "true"
|
|
3037
|
-
})])))]),
|
|
3040
|
+
})])))]), V = () => {
|
|
3038
3041
|
if (t.value === "ask-ai") {
|
|
3039
|
-
let t = (e, t, n, r) =>
|
|
3042
|
+
let t = (e, t, n, r) => H("button", {
|
|
3040
3043
|
type: "button",
|
|
3041
3044
|
class: n,
|
|
3042
3045
|
onMousedown: $,
|
|
3043
3046
|
onClick: t
|
|
3044
|
-
}, r ? [
|
|
3047
|
+
}, r ? [Z(r, e), H("span", null, e)] : e), s = n.value === "input" || n.value === "result" || n.value === "error" ? H("div", {
|
|
3045
3048
|
class: "markweave-ask-ai-composer",
|
|
3046
3049
|
"data-variant": n.value === "result" ? "follow-up" : "prompt"
|
|
3047
|
-
}, [
|
|
3050
|
+
}, [H("textarea", {
|
|
3048
3051
|
ref: u,
|
|
3049
3052
|
class: "markweave-ask-ai-input",
|
|
3050
3053
|
rows: 2,
|
|
@@ -3055,19 +3058,19 @@ var ga = X({
|
|
|
3055
3058
|
r.value = e.target.value;
|
|
3056
3059
|
},
|
|
3057
3060
|
onKeydown: (e) => {
|
|
3058
|
-
e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(),
|
|
3061
|
+
e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), j());
|
|
3059
3062
|
}
|
|
3060
|
-
}),
|
|
3063
|
+
}), H("button", {
|
|
3061
3064
|
type: "button",
|
|
3062
3065
|
class: "markweave-ask-ai-send",
|
|
3063
3066
|
"aria-label": e.messages.askAi.send,
|
|
3064
3067
|
disabled: !r.value.trim(),
|
|
3065
3068
|
onMousedown: $,
|
|
3066
3069
|
onClick: () => {
|
|
3067
|
-
|
|
3070
|
+
j();
|
|
3068
3071
|
}
|
|
3069
|
-
}, [
|
|
3070
|
-
return
|
|
3072
|
+
}, [Z(Nr, e.messages.askAi.send)])]) : null;
|
|
3073
|
+
return H("section", {
|
|
3071
3074
|
ref: y,
|
|
3072
3075
|
class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
|
|
3073
3076
|
"aria-label": e.messages.askAi.ariaLabel,
|
|
@@ -3075,65 +3078,65 @@ var ga = X({
|
|
|
3075
3078
|
"data-testid": "markweave-ask-ai-popover"
|
|
3076
3079
|
}, [
|
|
3077
3080
|
s,
|
|
3078
|
-
n.value === "generating" ?
|
|
3081
|
+
n.value === "generating" ? H("div", {
|
|
3079
3082
|
class: "markweave-ask-ai-progress markweave-ask-ai-generating",
|
|
3080
3083
|
role: "status"
|
|
3081
3084
|
}, [
|
|
3082
|
-
|
|
3085
|
+
H("span", {
|
|
3083
3086
|
class: "markweave-ask-ai-sparkles",
|
|
3084
3087
|
"aria-hidden": "true"
|
|
3085
|
-
}, [
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
+
}, [Z(Ti, "")]),
|
|
3089
|
+
H("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
|
|
3090
|
+
H("button", {
|
|
3088
3091
|
type: "button",
|
|
3089
3092
|
class: "markweave-ask-ai-stop",
|
|
3090
3093
|
"aria-label": e.messages.askAi.stop,
|
|
3091
3094
|
onMousedown: $,
|
|
3092
3095
|
onClick: () => {
|
|
3093
|
-
c.value?.abort(),
|
|
3096
|
+
c.value?.abort(), O.cancel(), Pe(e.editor), n.value = "input";
|
|
3094
3097
|
}
|
|
3095
|
-
}, [
|
|
3098
|
+
}, [Z(Ei, e.messages.askAi.stop)])
|
|
3096
3099
|
]) : null,
|
|
3097
|
-
n.value === "result" ?
|
|
3100
|
+
n.value === "result" ? H("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
3098
3101
|
t(e.messages.askAi.retry, () => {
|
|
3099
|
-
|
|
3100
|
-
}, "markweave-ask-ai-retry",
|
|
3101
|
-
|
|
3102
|
-
t(e.messages.askAi.discard, () =>
|
|
3103
|
-
t(e.messages.askAi.accept,
|
|
3102
|
+
j(i.value);
|
|
3103
|
+
}, "markweave-ask-ai-retry", Si),
|
|
3104
|
+
H("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
3105
|
+
t(e.messages.askAi.discard, () => k(!0), "markweave-ask-ai-discard", Bi),
|
|
3106
|
+
t(e.messages.askAi.accept, te, "markweave-ask-ai-accept", Hr)
|
|
3104
3107
|
]) : null,
|
|
3105
|
-
n.value === "error" || n.value === "conflict" ?
|
|
3108
|
+
n.value === "error" || n.value === "conflict" ? H("div", {
|
|
3106
3109
|
class: "markweave-ask-ai-error",
|
|
3107
3110
|
role: "alert"
|
|
3108
|
-
}, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback,
|
|
3111
|
+
}, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, H("div", { class: "markweave-ask-ai-action-bar" }, [
|
|
3109
3112
|
n.value === "error" ? t(e.messages.askAi.retry, () => {
|
|
3110
|
-
|
|
3111
|
-
}, "markweave-ask-ai-retry",
|
|
3112
|
-
|
|
3113
|
-
t(e.messages.askAi.discard, () =>
|
|
3113
|
+
j(i.value);
|
|
3114
|
+
}, "markweave-ask-ai-retry", Si) : null,
|
|
3115
|
+
H("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
3116
|
+
t(e.messages.askAi.discard, () => k(!0), "markweave-ask-ai-discard", Bi)
|
|
3114
3117
|
])]) : null
|
|
3115
3118
|
]);
|
|
3116
3119
|
}
|
|
3117
|
-
return t.value === "block-type" ?
|
|
3120
|
+
return t.value === "block-type" ? H("div", {
|
|
3118
3121
|
ref: y,
|
|
3119
3122
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
|
|
3120
3123
|
"data-testid": "markweave-floating-toolbar-turn-menu"
|
|
3121
|
-
}, [
|
|
3124
|
+
}, [H("div", { class: "markweave-floating-toolbar-menu-title" }, x.value.turnIntoTitle), ...S.value.map(([n, r, i]) => H("button", {
|
|
3122
3125
|
key: n,
|
|
3123
3126
|
type: "button",
|
|
3124
3127
|
"data-testid": `markweave-floating-toolbar-turn-${n}`,
|
|
3125
3128
|
onMousedown: $,
|
|
3126
3129
|
onClick: () => {
|
|
3127
|
-
|
|
3130
|
+
ye(e.editor, n), t.value = null;
|
|
3128
3131
|
}
|
|
3129
|
-
}, [
|
|
3132
|
+
}, [H("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), H("span", null, r)]))]) : t.value === "link" ? H("form", {
|
|
3130
3133
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
|
|
3131
3134
|
ref: y,
|
|
3132
3135
|
"data-testid": "markweave-floating-toolbar-link-popover",
|
|
3133
3136
|
onSubmit: (e) => {
|
|
3134
|
-
e.preventDefault(),
|
|
3137
|
+
e.preventDefault(), T();
|
|
3135
3138
|
}
|
|
3136
|
-
}, [
|
|
3139
|
+
}, [H("input", {
|
|
3137
3140
|
value: p.value,
|
|
3138
3141
|
placeholder: x.value.linkPlaceholder,
|
|
3139
3142
|
"aria-label": x.value.linkUrlLabel,
|
|
@@ -3141,45 +3144,45 @@ var ga = X({
|
|
|
3141
3144
|
onInput: (e) => {
|
|
3142
3145
|
p.value = e.target.value;
|
|
3143
3146
|
}
|
|
3144
|
-
}),
|
|
3145
|
-
|
|
3147
|
+
}), H("span", { class: "markweave-floating-toolbar-link-actions" }, [
|
|
3148
|
+
H("button", {
|
|
3146
3149
|
type: "submit",
|
|
3147
3150
|
disabled: !b.value,
|
|
3148
3151
|
"aria-label": x.value.applyLink,
|
|
3149
3152
|
"data-testid": "markweave-floating-toolbar-link-apply",
|
|
3150
3153
|
onMousedown: $
|
|
3151
|
-
}, [
|
|
3152
|
-
|
|
3154
|
+
}, [Z(Yr, x.value.applyLink)]),
|
|
3155
|
+
H("span", {
|
|
3153
3156
|
class: "markweave-floating-toolbar-link-divider",
|
|
3154
3157
|
"aria-hidden": "true"
|
|
3155
3158
|
}),
|
|
3156
|
-
|
|
3159
|
+
H("button", {
|
|
3157
3160
|
type: "button",
|
|
3158
3161
|
disabled: !b.value,
|
|
3159
3162
|
"aria-label": x.value.openLink,
|
|
3160
3163
|
"data-testid": "markweave-floating-toolbar-link-open",
|
|
3161
3164
|
onMousedown: $,
|
|
3162
|
-
onClick: () =>
|
|
3163
|
-
}, [
|
|
3164
|
-
|
|
3165
|
+
onClick: () => fa(p.value)
|
|
3166
|
+
}, [Z($r, x.value.openLink)]),
|
|
3167
|
+
H("button", {
|
|
3165
3168
|
type: "button",
|
|
3166
3169
|
"aria-label": x.value.removeLink,
|
|
3167
3170
|
"data-testid": "markweave-floating-toolbar-link-remove",
|
|
3168
3171
|
onMousedown: $,
|
|
3169
|
-
onClick:
|
|
3170
|
-
}, [
|
|
3171
|
-
])]) : t.value === "color" ?
|
|
3172
|
+
onClick: E
|
|
3173
|
+
}, [Z(Fi, x.value.removeLink)])
|
|
3174
|
+
])]) : t.value === "color" ? H("div", {
|
|
3172
3175
|
ref: y,
|
|
3173
3176
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
3174
3177
|
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
3175
|
-
}, [
|
|
3178
|
+
}, [B(x.value.textColorTitle, "text", C.value), B(x.value.highlightColorTitle, "highlight", ee.value)]) : t.value === "more" ? H("div", {
|
|
3176
3179
|
ref: y,
|
|
3177
3180
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
3178
3181
|
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
3179
|
-
},
|
|
3182
|
+
}, w.value.map((n) => H("span", {
|
|
3180
3183
|
key: n,
|
|
3181
3184
|
class: "markweave-floating-toolbar-more-item"
|
|
3182
|
-
}, [
|
|
3185
|
+
}, [H("button", {
|
|
3183
3186
|
type: "button",
|
|
3184
3187
|
"aria-label": x.value.moreActions[n],
|
|
3185
3188
|
"data-testid": `markweave-floating-toolbar-more-${n}`,
|
|
@@ -3192,61 +3195,61 @@ var ga = X({
|
|
|
3192
3195
|
m.value = null;
|
|
3193
3196
|
},
|
|
3194
3197
|
onClick: () => {
|
|
3195
|
-
|
|
3198
|
+
ve(e.editor, n), t.value = null;
|
|
3196
3199
|
}
|
|
3197
|
-
}, [
|
|
3200
|
+
}, [Z(pa[n], x.value.moreActions[n])]), m.value === n ? H("div", {
|
|
3198
3201
|
class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
|
|
3199
3202
|
role: "tooltip"
|
|
3200
3203
|
}, x.value.moreActions[n]) : null]))) : null;
|
|
3201
3204
|
};
|
|
3202
|
-
return () =>
|
|
3205
|
+
return () => H(ie, {
|
|
3203
3206
|
editor: e.editor,
|
|
3204
3207
|
shouldShow: ({ editor: e }) => {
|
|
3205
|
-
let t =
|
|
3206
|
-
return
|
|
3208
|
+
let t = ze(e);
|
|
3209
|
+
return Ee(we(e), {
|
|
3207
3210
|
editable: e.isEditable,
|
|
3208
|
-
hasAskAiPreview:
|
|
3211
|
+
hasAskAiPreview: Ve(e.state),
|
|
3209
3212
|
hasActiveAskAiTableTarget: t?.target.kind === "table" && t.status === "target"
|
|
3210
3213
|
});
|
|
3211
3214
|
},
|
|
3212
3215
|
getReferencedVirtualElement: () => {
|
|
3213
|
-
let t =
|
|
3216
|
+
let t = ze(e.editor)?.target.kind === "table" ? Be(e.editor) : null;
|
|
3214
3217
|
return t ? {
|
|
3215
3218
|
getBoundingClientRect: () => new DOMRect(t.left, t.top, t.width, t.height),
|
|
3216
3219
|
getClientRects: () => [new DOMRect(t.left, t.top, t.width, t.height)]
|
|
3217
3220
|
} : null;
|
|
3218
3221
|
},
|
|
3219
3222
|
options: { placement: "top" }
|
|
3220
|
-
}, { default: () =>
|
|
3223
|
+
}, { default: () => H("div", {
|
|
3221
3224
|
ref: _,
|
|
3222
3225
|
class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
|
|
3223
3226
|
"data-popover-placement": t.value ? g.value : void 0,
|
|
3224
3227
|
"data-ask-ai-session": t.value === "ask-ai" ? "open" : "closed",
|
|
3225
3228
|
"data-testid": "markweave-floating-toolbar"
|
|
3226
|
-
}, [
|
|
3229
|
+
}, [H("div", {
|
|
3227
3230
|
ref: v,
|
|
3228
3231
|
class: "markweave-floating-toolbar-content",
|
|
3229
3232
|
"data-menu": t.value ?? "none"
|
|
3230
3233
|
}, [
|
|
3231
|
-
f.value &&
|
|
3232
|
-
f.value &&
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3234
|
+
f.value && He(e.editor) ? R("ask-ai", x.value.buttons["ask-ai"], Ti, A, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
|
|
3235
|
+
f.value && He(e.editor) ? z() : null,
|
|
3236
|
+
R("block-type", x.value.buttons["block-type"], Ii, () => D("block-type"), t.value === "block-type"),
|
|
3237
|
+
z(),
|
|
3238
|
+
R("bold", x.value.buttons.bold, zr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
3239
|
+
R("italic", x.value.buttons.italic, ci, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
3240
|
+
R("underline", x.value.buttons.underline, Li, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
3241
|
+
R("strike", x.value.buttons.strike, Oi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
3242
|
+
R("inline-code", x.value.buttons["inline-code"], Jr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
3243
|
+
z(),
|
|
3244
|
+
R("link", x.value.buttons.link, ui, () => D("link"), e.editor.isActive("link")),
|
|
3245
|
+
R("color", x.value.buttons.color, Ii, () => D("color"), t.value === "color"),
|
|
3246
|
+
z(),
|
|
3247
|
+
R("more", x.value.buttons.more, hi, () => D("more"), t.value === "more"),
|
|
3248
|
+
V(),
|
|
3249
|
+
L()
|
|
3247
3250
|
])]) });
|
|
3248
3251
|
}
|
|
3249
|
-
}),
|
|
3252
|
+
}), ya = Y({
|
|
3250
3253
|
name: "MarkweaveVueMathEditorPopover",
|
|
3251
3254
|
props: {
|
|
3252
3255
|
editor: {
|
|
@@ -3267,17 +3270,17 @@ var ga = X({
|
|
|
3267
3270
|
}
|
|
3268
3271
|
},
|
|
3269
3272
|
setup(e) {
|
|
3270
|
-
let t =
|
|
3273
|
+
let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(Wt(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
|
|
3271
3274
|
html: a.value,
|
|
3272
3275
|
error: !1
|
|
3273
|
-
} :
|
|
3276
|
+
} : Jt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => Ut(e.editor, e.target) ?? 1), u = () => {
|
|
3274
3277
|
if (typeof window > "u") return;
|
|
3275
|
-
let r =
|
|
3278
|
+
let r = Ht(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
3276
3279
|
if (!r || !i) {
|
|
3277
3280
|
e.onClose();
|
|
3278
3281
|
return;
|
|
3279
3282
|
}
|
|
3280
|
-
n.value =
|
|
3283
|
+
n.value = Vt({
|
|
3281
3284
|
anchorRect: r,
|
|
3282
3285
|
frameRect: i,
|
|
3283
3286
|
kind: e.target.kind,
|
|
@@ -3286,7 +3289,7 @@ var ga = X({
|
|
|
3286
3289
|
viewportWidth: window.innerWidth
|
|
3287
3290
|
});
|
|
3288
3291
|
}, d = () => {
|
|
3289
|
-
s.value &&
|
|
3292
|
+
s.value && Bt(e.editor, e.target, t.value) && e.onClose();
|
|
3290
3293
|
}, f = (t) => {
|
|
3291
3294
|
if (t.key === "Escape") {
|
|
3292
3295
|
t.preventDefault(), e.onClose(), e.editor.commands.focus();
|
|
@@ -3297,14 +3300,14 @@ var ga = X({
|
|
|
3297
3300
|
let n = t.target;
|
|
3298
3301
|
n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
|
|
3299
3302
|
};
|
|
3300
|
-
return
|
|
3301
|
-
t.value = e.target.latex, a.value =
|
|
3302
|
-
}),
|
|
3303
|
-
|
|
3303
|
+
return K(() => [e.target.pos, e.target.latex], () => {
|
|
3304
|
+
t.value = e.target.latex, a.value = Wt(e.editor, e.target), J(u);
|
|
3305
|
+
}), vr(() => {
|
|
3306
|
+
Yt(e.editor, e.target, !0), u(), J(() => {
|
|
3304
3307
|
i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
|
|
3305
3308
|
}), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
|
|
3306
|
-
}),
|
|
3307
|
-
|
|
3309
|
+
}), q(() => {
|
|
3310
|
+
Yt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
|
|
3308
3311
|
}), () => {
|
|
3309
3312
|
let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
|
|
3310
3313
|
ref: i,
|
|
@@ -3317,7 +3320,7 @@ var ga = X({
|
|
|
3317
3320
|
},
|
|
3318
3321
|
onKeydown: f
|
|
3319
3322
|
};
|
|
3320
|
-
return e.target.kind === "inline" ?
|
|
3323
|
+
return e.target.kind === "inline" ? H("form", {
|
|
3321
3324
|
ref: r,
|
|
3322
3325
|
class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
|
|
3323
3326
|
"aria-label": a,
|
|
@@ -3332,22 +3335,22 @@ var ga = X({
|
|
|
3332
3335
|
onSubmit: (e) => {
|
|
3333
3336
|
e.preventDefault(), d();
|
|
3334
3337
|
}
|
|
3335
|
-
}, [
|
|
3338
|
+
}, [H("label", {
|
|
3336
3339
|
class: "markweave-math-inline-source",
|
|
3337
3340
|
"data-testid": "markweave-math-inline-source"
|
|
3338
3341
|
}, [
|
|
3339
|
-
|
|
3340
|
-
|
|
3342
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$"),
|
|
3343
|
+
H("input", {
|
|
3341
3344
|
...u,
|
|
3342
3345
|
"aria-label": c.value.latexLabel,
|
|
3343
3346
|
size: Math.max(t.value.length, 1)
|
|
3344
3347
|
}),
|
|
3345
|
-
|
|
3346
|
-
]),
|
|
3348
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$")
|
|
3349
|
+
]), H("div", {
|
|
3347
3350
|
class: "markweave-math-inline-preview",
|
|
3348
3351
|
"data-error": o.value.error ? "true" : "false",
|
|
3349
3352
|
"data-testid": "markweave-math-editor-preview"
|
|
3350
|
-
}, [
|
|
3353
|
+
}, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])]) : H("form", {
|
|
3351
3354
|
ref: r,
|
|
3352
3355
|
class: "markweave-math-editor-popover markweave-math-editor-popover--block",
|
|
3353
3356
|
"aria-label": a,
|
|
@@ -3363,39 +3366,39 @@ var ga = X({
|
|
|
3363
3366
|
e.preventDefault(), d();
|
|
3364
3367
|
}
|
|
3365
3368
|
}, [
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3369
|
+
H("div", { class: "markweave-math-block-toolbar" }, [
|
|
3370
|
+
H("span", null, c.value.label),
|
|
3371
|
+
Z(Jr, c.value.label, 15, 1.75),
|
|
3372
|
+
H("button", {
|
|
3370
3373
|
type: "submit",
|
|
3371
3374
|
title: c.value.apply,
|
|
3372
3375
|
"aria-label": c.value.apply,
|
|
3373
3376
|
disabled: !s.value,
|
|
3374
3377
|
"data-testid": "markweave-math-editor-apply"
|
|
3375
|
-
}, [
|
|
3378
|
+
}, [Z(Ur, c.value.apply, 16, 2)])
|
|
3376
3379
|
]),
|
|
3377
|
-
|
|
3380
|
+
H("label", {
|
|
3378
3381
|
class: "markweave-math-block-source",
|
|
3379
3382
|
"data-testid": "markweave-math-block-source"
|
|
3380
3383
|
}, [
|
|
3381
|
-
|
|
3382
|
-
|
|
3384
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$$"),
|
|
3385
|
+
H("textarea", {
|
|
3383
3386
|
...u,
|
|
3384
3387
|
"aria-label": c.value.latexLabel,
|
|
3385
3388
|
rows: 3
|
|
3386
3389
|
}),
|
|
3387
|
-
|
|
3390
|
+
H("span", { attrs: { "aria-hidden": "true" } }, "$$")
|
|
3388
3391
|
]),
|
|
3389
|
-
|
|
3392
|
+
H("div", {
|
|
3390
3393
|
class: "markweave-math-block-preview",
|
|
3391
3394
|
"data-error": o.value.error ? "true" : "false",
|
|
3392
3395
|
"data-math-number": String(l.value),
|
|
3393
3396
|
"data-testid": "markweave-math-editor-preview"
|
|
3394
|
-
}, [
|
|
3397
|
+
}, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])
|
|
3395
3398
|
]);
|
|
3396
3399
|
};
|
|
3397
3400
|
}
|
|
3398
|
-
}),
|
|
3401
|
+
}), ba = Y({
|
|
3399
3402
|
name: "MarkweaveVueSlashCommandMenu",
|
|
3400
3403
|
props: {
|
|
3401
3404
|
commands: {
|
|
@@ -3436,7 +3439,7 @@ var ga = X({
|
|
|
3436
3439
|
}
|
|
3437
3440
|
},
|
|
3438
3441
|
setup(e) {
|
|
3439
|
-
let t =
|
|
3442
|
+
let t = U(""), n = U(null), r = U(null), i = U(!1), a = U(""), o = U(0), s = U(null), c = G(() => {
|
|
3440
3443
|
let t = a.value.trim().toLowerCase();
|
|
3441
3444
|
return (t ? e.messages.slash.emojiItems.filter((e) => [
|
|
3442
3445
|
e.emoji,
|
|
@@ -3444,16 +3447,16 @@ var ga = X({
|
|
|
3444
3447
|
...e.terms
|
|
3445
3448
|
].join(" ").toLowerCase().includes(t)) : e.messages.slash.emojiItems).slice(0, 12);
|
|
3446
3449
|
});
|
|
3447
|
-
|
|
3450
|
+
K(() => [
|
|
3448
3451
|
e.state.name,
|
|
3449
3452
|
e.state.activeIndex,
|
|
3450
3453
|
e.commands.length,
|
|
3451
3454
|
e.inputCommand?.id ?? null
|
|
3452
3455
|
], async () => {
|
|
3453
3456
|
if (e.state.name !== "keyboard-selecting" || e.inputCommand || !e.commands.length) return;
|
|
3454
|
-
await
|
|
3457
|
+
await J();
|
|
3455
3458
|
let t = s.value, n = t?.querySelector("[data-active=\"true\"]");
|
|
3456
|
-
t && n &&
|
|
3459
|
+
t && n && cn(t, n);
|
|
3457
3460
|
}, { flush: "post" });
|
|
3458
3461
|
let l = async () => {
|
|
3459
3462
|
if (e.inputCommand) {
|
|
@@ -3470,13 +3473,13 @@ var ga = X({
|
|
|
3470
3473
|
} : {
|
|
3471
3474
|
kind: i,
|
|
3472
3475
|
trigger: i === "attachment" ? "attachment-insert" : "slash-command",
|
|
3473
|
-
source:
|
|
3476
|
+
source: z(t.value)
|
|
3474
3477
|
};
|
|
3475
3478
|
if (!n.value && !t.value.trim()) {
|
|
3476
3479
|
r.value = e.messages.slash.uploadRequiredError;
|
|
3477
3480
|
return;
|
|
3478
3481
|
}
|
|
3479
|
-
let o = await
|
|
3482
|
+
let o = await V(a, e.onUpload);
|
|
3480
3483
|
e.onSelect(e.inputCommand, { uploadResult: o }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
3481
3484
|
} catch (t) {
|
|
3482
3485
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -3506,18 +3509,18 @@ var ga = X({
|
|
|
3506
3509
|
group: e,
|
|
3507
3510
|
commands: t
|
|
3508
3511
|
}));
|
|
3509
|
-
return
|
|
3512
|
+
return H("div", {
|
|
3510
3513
|
class: "markweave-slash-layer",
|
|
3511
3514
|
style: { display: "contents" },
|
|
3512
3515
|
"data-testid": "markweave-slash-layer"
|
|
3513
3516
|
}, [
|
|
3514
|
-
|
|
3517
|
+
H("div", {
|
|
3515
3518
|
class: "markweave-slash-trigger",
|
|
3516
3519
|
style: f,
|
|
3517
3520
|
"aria-hidden": "true",
|
|
3518
3521
|
"data-testid": "markweave-slash-trigger"
|
|
3519
|
-
}, [
|
|
3520
|
-
|
|
3522
|
+
}, [H("span", null, "/"), H("em", null, e.state.query || e.messages.slash.filterPlaceholder)]),
|
|
3523
|
+
H("div", {
|
|
3521
3524
|
id: "markweave-slash-command-listbox",
|
|
3522
3525
|
class: "markweave-slash-menu",
|
|
3523
3526
|
style: d,
|
|
@@ -3526,16 +3529,16 @@ var ga = X({
|
|
|
3526
3529
|
"aria-busy": !1,
|
|
3527
3530
|
"data-placement": e.position.placement,
|
|
3528
3531
|
"data-testid": "markweave-slash-menu"
|
|
3529
|
-
}, [e.inputCommand?.inputKind === "emoji" ?
|
|
3532
|
+
}, [e.inputCommand?.inputKind === "emoji" ? H("div", {
|
|
3530
3533
|
class: "markweave-slash-subpanel",
|
|
3531
3534
|
"data-testid": "markweave-slash-emoji-picker"
|
|
3532
3535
|
}, [
|
|
3533
|
-
|
|
3536
|
+
H("div", { class: "markweave-slash-subpanel-header" }, [H("button", {
|
|
3534
3537
|
type: "button",
|
|
3535
3538
|
onMousedown: $,
|
|
3536
3539
|
onClick: () => e.onInputCommandChange(null)
|
|
3537
|
-
}, e.messages.common.back),
|
|
3538
|
-
|
|
3540
|
+
}, e.messages.common.back), H("span", null, e.messages.slash.emojiTitle)]),
|
|
3541
|
+
H("label", { class: "markweave-slash-input" }, [H("span", null, "/"), H("input", {
|
|
3539
3542
|
autofocus: !0,
|
|
3540
3543
|
value: a.value,
|
|
3541
3544
|
placeholder: e.messages.slash.emojiSearchPlaceholder,
|
|
@@ -3546,11 +3549,11 @@ var ga = X({
|
|
|
3546
3549
|
t.key === "Escape" ? (t.preventDefault(), e.onInputCommandChange(null)) : t.key === "ArrowDown" ? (t.preventDefault(), o.value = c.value.length ? (o.value + 1) % c.value.length : 0) : t.key === "ArrowUp" ? (t.preventDefault(), o.value = c.value.length ? (o.value - 1 + c.value.length) % c.value.length : 0) : (t.key === "Enter" || t.key === "Tab") && (t.preventDefault(), u(o.value));
|
|
3547
3550
|
}
|
|
3548
3551
|
})]),
|
|
3549
|
-
|
|
3552
|
+
H("div", {
|
|
3550
3553
|
class: "markweave-slash-emoji-grid",
|
|
3551
3554
|
role: "listbox",
|
|
3552
3555
|
"aria-label": e.messages.slash.emojiTitle
|
|
3553
|
-
}, c.value.map((e, t) =>
|
|
3556
|
+
}, c.value.map((e, t) => H("button", {
|
|
3554
3557
|
key: `${e.emoji}-${e.label}`,
|
|
3555
3558
|
type: "button",
|
|
3556
3559
|
role: "option",
|
|
@@ -3559,17 +3562,17 @@ var ga = X({
|
|
|
3559
3562
|
onMouseenter: () => o.value = t,
|
|
3560
3563
|
onMousedown: $,
|
|
3561
3564
|
onClick: () => u(t)
|
|
3562
|
-
}, [
|
|
3563
|
-
]) : e.inputCommand?.inputKind === "upload" ?
|
|
3565
|
+
}, [H("span", null, e.emoji), H("small", null, e.label)])))
|
|
3566
|
+
]) : e.inputCommand?.inputKind === "upload" ? H("div", {
|
|
3564
3567
|
class: "markweave-slash-subpanel",
|
|
3565
3568
|
"data-testid": "markweave-slash-upload-panel"
|
|
3566
3569
|
}, [
|
|
3567
|
-
|
|
3570
|
+
H("div", { class: "markweave-slash-upload-header" }, [H("button", {
|
|
3568
3571
|
type: "button",
|
|
3569
3572
|
onMousedown: $,
|
|
3570
3573
|
onClick: () => e.onInputCommandChange(null)
|
|
3571
|
-
}, e.messages.common.back),
|
|
3572
|
-
|
|
3574
|
+
}, e.messages.common.back), H("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
|
|
3575
|
+
H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.slash.uploadValueLabel), H("input", {
|
|
3573
3576
|
autofocus: !0,
|
|
3574
3577
|
value: t.value,
|
|
3575
3578
|
placeholder: e.messages.slash.uploadValuePlaceholder,
|
|
@@ -3580,35 +3583,35 @@ var ga = X({
|
|
|
3580
3583
|
e.key === "Enter" && (e.preventDefault(), l());
|
|
3581
3584
|
}
|
|
3582
3585
|
})]),
|
|
3583
|
-
|
|
3586
|
+
H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.common.file), H("input", {
|
|
3584
3587
|
type: "file",
|
|
3585
3588
|
onChange: (e) => n.value = e.target.files?.[0] ?? null
|
|
3586
3589
|
})]),
|
|
3587
|
-
r.value ?
|
|
3590
|
+
r.value ? H("div", {
|
|
3588
3591
|
class: "markweave-slash-upload-error",
|
|
3589
3592
|
role: "alert"
|
|
3590
3593
|
}, r.value) : null,
|
|
3591
|
-
|
|
3594
|
+
H("div", { class: "markweave-slash-upload-actions" }, [H("button", {
|
|
3592
3595
|
type: "button",
|
|
3593
3596
|
onMousedown: $,
|
|
3594
3597
|
onClick: () => e.onInputCommandChange(null)
|
|
3595
|
-
}, e.messages.common.cancel),
|
|
3598
|
+
}, e.messages.common.cancel), H("button", {
|
|
3596
3599
|
type: "button",
|
|
3597
3600
|
"data-primary": "true",
|
|
3598
3601
|
disabled: i.value,
|
|
3599
3602
|
onMousedown: $,
|
|
3600
3603
|
onClick: l
|
|
3601
3604
|
}, e.messages.common.insert)])
|
|
3602
|
-
]) : e.commands.length ?
|
|
3605
|
+
]) : e.commands.length ? H("div", {
|
|
3603
3606
|
ref: s,
|
|
3604
3607
|
class: "markweave-slash-command-list"
|
|
3605
|
-
}, p.map((t) =>
|
|
3608
|
+
}, p.map((t) => H("section", {
|
|
3606
3609
|
key: t.group,
|
|
3607
3610
|
class: "markweave-slash-group",
|
|
3608
3611
|
"aria-label": t.group
|
|
3609
|
-
}, [
|
|
3610
|
-
let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i =
|
|
3611
|
-
return
|
|
3612
|
+
}, [H("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
|
|
3613
|
+
let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i = on(t);
|
|
3614
|
+
return H("button", {
|
|
3612
3615
|
key: t.id,
|
|
3613
3616
|
id: `markweave-slash-command-option-${n}`,
|
|
3614
3617
|
type: "button",
|
|
@@ -3618,6 +3621,7 @@ var ga = X({
|
|
|
3618
3621
|
"data-active": r,
|
|
3619
3622
|
"data-disabled": t.disabled ? "true" : "false",
|
|
3620
3623
|
"data-execution-kind": t.executionKind,
|
|
3624
|
+
"data-text-icon-length": an(t.icon) ?? void 0,
|
|
3621
3625
|
"data-testid": `markweave-slash-command-${t.id}`,
|
|
3622
3626
|
title: t.disabledReason,
|
|
3623
3627
|
onMousedown: $,
|
|
@@ -3631,16 +3635,16 @@ var ga = X({
|
|
|
3631
3635
|
}
|
|
3632
3636
|
}
|
|
3633
3637
|
}, [
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
t.disabledReason ?
|
|
3638
|
+
ha(t.icon),
|
|
3639
|
+
H("span", null, t.label),
|
|
3640
|
+
t.disabledReason ? H("small", null, t.disabledReason) : null
|
|
3637
3641
|
]);
|
|
3638
|
-
})]))) :
|
|
3642
|
+
})]))) : H("div", {
|
|
3639
3643
|
class: "markweave-slash-menu__empty",
|
|
3640
3644
|
role: "option",
|
|
3641
3645
|
"aria-disabled": "true"
|
|
3642
3646
|
}, e.messages.slash.noResults)]),
|
|
3643
|
-
|
|
3647
|
+
H("div", {
|
|
3644
3648
|
class: "markweave-slash-command-live-region",
|
|
3645
3649
|
role: "status",
|
|
3646
3650
|
"aria-live": "polite",
|
|
@@ -3649,34 +3653,34 @@ var ga = X({
|
|
|
3649
3653
|
]);
|
|
3650
3654
|
};
|
|
3651
3655
|
}
|
|
3652
|
-
}),
|
|
3653
|
-
"ask-ai":
|
|
3654
|
-
"move-left":
|
|
3655
|
-
"move-right":
|
|
3656
|
-
"move-up":
|
|
3657
|
-
"move-down":
|
|
3658
|
-
"insert-left":
|
|
3659
|
-
"insert-right":
|
|
3660
|
-
"insert-above":
|
|
3661
|
-
"insert-below":
|
|
3662
|
-
"sort-asc":
|
|
3663
|
-
"sort-desc":
|
|
3664
|
-
color:
|
|
3665
|
-
alignment:
|
|
3666
|
-
clear:
|
|
3667
|
-
duplicate:
|
|
3668
|
-
copy:
|
|
3669
|
-
merge:
|
|
3670
|
-
split:
|
|
3671
|
-
delete:
|
|
3672
|
-
},
|
|
3673
|
-
left:
|
|
3674
|
-
center:
|
|
3675
|
-
right:
|
|
3676
|
-
top:
|
|
3677
|
-
middle:
|
|
3678
|
-
bottom:
|
|
3679
|
-
},
|
|
3656
|
+
}), xa = {
|
|
3657
|
+
"ask-ai": Ti,
|
|
3658
|
+
"move-left": jr,
|
|
3659
|
+
"move-right": Mr,
|
|
3660
|
+
"move-up": Nr,
|
|
3661
|
+
"move-down": kr,
|
|
3662
|
+
"insert-left": Rr,
|
|
3663
|
+
"insert-right": Lr,
|
|
3664
|
+
"insert-above": Ir,
|
|
3665
|
+
"insert-below": Fr,
|
|
3666
|
+
"sort-asc": Ar,
|
|
3667
|
+
"sort-desc": Pr,
|
|
3668
|
+
color: gi,
|
|
3669
|
+
alignment: Cr,
|
|
3670
|
+
clear: Di,
|
|
3671
|
+
duplicate: Xr,
|
|
3672
|
+
copy: Xr,
|
|
3673
|
+
merge: Mi,
|
|
3674
|
+
split: Ni,
|
|
3675
|
+
delete: Fi
|
|
3676
|
+
}, Sa = {
|
|
3677
|
+
left: Cr,
|
|
3678
|
+
center: xr,
|
|
3679
|
+
right: wr,
|
|
3680
|
+
top: Dr,
|
|
3681
|
+
middle: Tr,
|
|
3682
|
+
bottom: Er
|
|
3683
|
+
}, Ca = Y({
|
|
3680
3684
|
name: "MarkweaveVueTableControls",
|
|
3681
3685
|
props: {
|
|
3682
3686
|
editor: {
|
|
@@ -3713,13 +3717,13 @@ var ga = X({
|
|
|
3713
3717
|
}
|
|
3714
3718
|
},
|
|
3715
3719
|
setup(e) {
|
|
3716
|
-
let t =
|
|
3720
|
+
let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(null), f = U(0), p = U(null), m = U(null), h = U(null), g = U(null), _ = U(null), v = U(null), y = U(null), b = null, x = null, S = null, C = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), ee = () => Cn(e.editor.state, "structure"), w = G(() => e.active ? En(e.editor.state) : sa), T = G(() => Gn(e.editor, e.interactionState, "row", w.value.activeCellPos)), E = G(() => Gn(e.editor, e.interactionState, "column", w.value.activeCellPos)), D = G(() => Vn(e.editor)), O = G(() => (D.value, w.value.active && Yn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), k = G(() => t.value ? Yn(e.editor, t.value, { askAiEnabled: C.value }) : []), A = () => {
|
|
3717
3721
|
b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
|
|
3718
3722
|
}, j = (e) => {
|
|
3719
3723
|
A(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
|
|
3720
3724
|
d.value = null, b = null;
|
|
3721
|
-
},
|
|
3722
|
-
},
|
|
3725
|
+
}, tr));
|
|
3726
|
+
}, te = () => {
|
|
3723
3727
|
if (!e.active) {
|
|
3724
3728
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, j(null);
|
|
3725
3729
|
return;
|
|
@@ -3729,31 +3733,31 @@ var ga = X({
|
|
|
3729
3733
|
i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
|
|
3730
3734
|
return;
|
|
3731
3735
|
}
|
|
3732
|
-
let l = n.getBoundingClientRect(), u = T.value ?
|
|
3733
|
-
u ? i.value =
|
|
3736
|
+
let l = n.getBoundingClientRect(), u = T.value ? Wn(e.editor, T.value) : null, d = E.value ? Wn(e.editor, E.value) : null, f = O.value ? Xn(e.editor) : null, p = Bn(e.editor)?.getBoundingClientRect() ?? null;
|
|
3737
|
+
u ? i.value = Fn({
|
|
3734
3738
|
targetRect: u,
|
|
3735
3739
|
frameRect: l,
|
|
3736
3740
|
kind: "row"
|
|
3737
|
-
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value =
|
|
3741
|
+
}) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = Fn({
|
|
3738
3742
|
targetRect: d,
|
|
3739
3743
|
frameRect: l,
|
|
3740
3744
|
kind: "column"
|
|
3741
|
-
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value =
|
|
3745
|
+
}) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = Fn({
|
|
3742
3746
|
targetRect: f,
|
|
3743
3747
|
frameRect: l,
|
|
3744
3748
|
kind: "selection"
|
|
3745
3749
|
}) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
|
|
3746
3750
|
let m = e.interactionState.hoverCellPos !== null && !!(T.value && T.value.index === T.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(E.value && E.value.index === E.value.visualWidth - 1);
|
|
3747
|
-
s.value = p && m ?
|
|
3751
|
+
s.value = p && m ? In({
|
|
3748
3752
|
tableRect: p,
|
|
3749
3753
|
frameRect: l,
|
|
3750
3754
|
kind: "row"
|
|
3751
|
-
}) : null, c.value = p && h ?
|
|
3755
|
+
}) : null, c.value = p && h ? In({
|
|
3752
3756
|
tableRect: p,
|
|
3753
3757
|
frameRect: l,
|
|
3754
3758
|
kind: "column"
|
|
3755
3759
|
}) : null;
|
|
3756
|
-
},
|
|
3760
|
+
}, M = () => {
|
|
3757
3761
|
if (!e.active || !t.value) {
|
|
3758
3762
|
l.value = null;
|
|
3759
3763
|
return;
|
|
@@ -3763,16 +3767,16 @@ var ga = X({
|
|
|
3763
3767
|
l.value = null;
|
|
3764
3768
|
return;
|
|
3765
3769
|
}
|
|
3766
|
-
let a = i.getBoundingClientRect(), o = t.value === "row" ?
|
|
3770
|
+
let a = i.getBoundingClientRect(), o = t.value === "row" ? Bn(e.editor)?.getBoundingClientRect() : null, s = o ? {
|
|
3767
3771
|
left: a.left,
|
|
3768
3772
|
top: o.top,
|
|
3769
3773
|
width: a.width,
|
|
3770
3774
|
height: a.height
|
|
3771
3775
|
} : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
|
|
3772
|
-
l.value =
|
|
3776
|
+
l.value = Nn({
|
|
3773
3777
|
anchorRect: s,
|
|
3774
3778
|
frameRect: c,
|
|
3775
|
-
boundaryRect:
|
|
3779
|
+
boundaryRect: Kn(n),
|
|
3776
3780
|
menuSize: {
|
|
3777
3781
|
width: u.width || 254,
|
|
3778
3782
|
height: f || u.height || 410
|
|
@@ -3790,33 +3794,33 @@ var ga = X({
|
|
|
3790
3794
|
return;
|
|
3791
3795
|
}
|
|
3792
3796
|
let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
|
|
3793
|
-
u.value =
|
|
3797
|
+
u.value = Pn({
|
|
3794
3798
|
triggerRect: i.getBoundingClientRect(),
|
|
3795
3799
|
parentMenuRect: _.value.getBoundingClientRect(),
|
|
3796
|
-
boundaryRect:
|
|
3800
|
+
boundaryRect: Kn(r),
|
|
3797
3801
|
submenuSize: {
|
|
3798
3802
|
width: a.width || 238,
|
|
3799
3803
|
height: o || 410
|
|
3800
3804
|
}
|
|
3801
3805
|
});
|
|
3802
3806
|
}, P = () => {
|
|
3803
|
-
|
|
3804
|
-
},
|
|
3805
|
-
|
|
3806
|
-
},
|
|
3807
|
+
te(), M(), N();
|
|
3808
|
+
}, ne = () => {
|
|
3809
|
+
J(P);
|
|
3810
|
+
}, F = (e, i) => {
|
|
3807
3811
|
let a = t.value === e && r.value === i;
|
|
3808
|
-
r.value = i, t.value = a ? null : e, n.value = null, u.value = null,
|
|
3812
|
+
r.value = i, t.value = a ? null : e, n.value = null, u.value = null, ne();
|
|
3809
3813
|
}, I = () => {
|
|
3810
|
-
e.editor.view.dispatch(
|
|
3814
|
+
e.editor.view.dispatch(Sn(e.editor.state.tr, null));
|
|
3811
3815
|
}, L = (t, n) => {
|
|
3812
3816
|
let r = e.interactionState.hoverCellPos ?? w.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
3813
|
-
r !== null &&
|
|
3817
|
+
r !== null && $n(e.editor, r, t, { visualIndex: i }), F(t, n);
|
|
3814
3818
|
}, R = () => {
|
|
3815
|
-
I(),
|
|
3819
|
+
I(), F("selection", "selection-edge");
|
|
3816
3820
|
}, z = (r = !1) => {
|
|
3817
3821
|
t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
|
|
3818
3822
|
}, B = async (n, r) => {
|
|
3819
|
-
let i = await
|
|
3823
|
+
let i = await Rn({
|
|
3820
3824
|
editor: e.editor,
|
|
3821
3825
|
commandId: n,
|
|
3822
3826
|
menu: r ?? t.value ?? "selection",
|
|
@@ -3824,27 +3828,31 @@ var ga = X({
|
|
|
3824
3828
|
});
|
|
3825
3829
|
return i.copyFeedback ? (j(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : j(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
3826
3830
|
}, V = (t) => {
|
|
3827
|
-
C.value && (
|
|
3828
|
-
},
|
|
3829
|
-
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1,
|
|
3830
|
-
},
|
|
3831
|
+
C.value && (Ke(e.editor, t), z(!1));
|
|
3832
|
+
}, re = (e) => {
|
|
3833
|
+
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, ne());
|
|
3834
|
+
}, ie = (t) => {
|
|
3831
3835
|
let n = t === "row" ? T.value : E.value, r = e.interactionState.hoverCellPos ?? w.value.activeCellPos;
|
|
3832
|
-
!n || r === null ||
|
|
3833
|
-
},
|
|
3836
|
+
!n || r === null || ar(e.editor, r, t, { visualIndex: n.index }) && B(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
3837
|
+
}, ae = (e, t, n) => {
|
|
3838
|
+
if (!ee()) {
|
|
3839
|
+
n.preventDefault();
|
|
3840
|
+
return;
|
|
3841
|
+
}
|
|
3834
3842
|
x = {
|
|
3835
3843
|
axis: e,
|
|
3836
3844
|
index: t
|
|
3837
3845
|
}, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
|
|
3838
|
-
},
|
|
3846
|
+
}, oe = (t) => {
|
|
3839
3847
|
if (!x) return;
|
|
3840
|
-
let n =
|
|
3848
|
+
let n = Hn(e.editor, x.axis, t.clientX, t.clientY);
|
|
3841
3849
|
n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
|
|
3842
|
-
},
|
|
3850
|
+
}, se = (t) => {
|
|
3843
3851
|
let n = x;
|
|
3844
3852
|
if (!n) return;
|
|
3845
|
-
let r =
|
|
3846
|
-
t.preventDefault(), x = null, S = null, r !== null &&
|
|
3847
|
-
},
|
|
3853
|
+
let r = Hn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
|
|
3854
|
+
t.preventDefault(), x = null, S = null, r !== null && Qn(e.editor, n.axis, n.index, r);
|
|
3855
|
+
}, ce = G(() => (f.value, t.value === "row" || t.value === "column" ? Un(e.editor, t.value) : null)), le = (e) => {
|
|
3848
3856
|
if (!(!t.value || e.key !== "Escape")) {
|
|
3849
3857
|
if (n.value) {
|
|
3850
3858
|
n.value = null;
|
|
@@ -3852,20 +3860,20 @@ var ga = X({
|
|
|
3852
3860
|
}
|
|
3853
3861
|
z(!0);
|
|
3854
3862
|
}
|
|
3855
|
-
},
|
|
3863
|
+
}, ue = (e) => {
|
|
3856
3864
|
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
3857
3865
|
let t = e.currentTarget;
|
|
3858
3866
|
if (!(t instanceof HTMLElement)) return;
|
|
3859
3867
|
let n = t.classList.contains("markweave-table-menu") ? t.querySelector(":scope > .markweave-table-menu-scroll") ?? t : t, r = Array.from(n.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), i = r.indexOf(document.activeElement), a = e.key === "ArrowDown" ? 1 : -1, o = i < 0 ? 0 : Math.min(r.length - 1, Math.max(0, i + a));
|
|
3860
3868
|
e.preventDefault(), e.stopPropagation(), r[o]?.focus();
|
|
3861
|
-
},
|
|
3869
|
+
}, de = (e) => {
|
|
3862
3870
|
t.value && (e.target instanceof Node && p.value?.contains(e.target) || z());
|
|
3863
3871
|
};
|
|
3864
|
-
|
|
3865
|
-
P(), window.addEventListener("resize", P), window.addEventListener("scroll", P, !0), document.addEventListener("keydown",
|
|
3866
|
-
}),
|
|
3867
|
-
A(), window.removeEventListener("resize", P), window.removeEventListener("scroll", P, !0), document.removeEventListener("keydown",
|
|
3868
|
-
}),
|
|
3872
|
+
vr(() => {
|
|
3873
|
+
P(), window.addEventListener("resize", P), window.addEventListener("scroll", P, !0), document.addEventListener("keydown", le), document.addEventListener("mousedown", de), document.addEventListener("dragover", oe), document.addEventListener("drop", se);
|
|
3874
|
+
}), q(() => {
|
|
3875
|
+
A(), window.removeEventListener("resize", P), window.removeEventListener("scroll", P, !0), document.removeEventListener("keydown", le), document.removeEventListener("mousedown", de), document.removeEventListener("dragover", oe), document.removeEventListener("drop", se);
|
|
3876
|
+
}), K(() => [
|
|
3869
3877
|
e.active,
|
|
3870
3878
|
w.value.activeCellPos,
|
|
3871
3879
|
w.value.selectionFrom,
|
|
@@ -3876,12 +3884,12 @@ var ga = X({
|
|
|
3876
3884
|
t.value,
|
|
3877
3885
|
n.value,
|
|
3878
3886
|
r.value
|
|
3879
|
-
],
|
|
3880
|
-
let
|
|
3887
|
+
], ne, { flush: "post" });
|
|
3888
|
+
let fe = () => {
|
|
3881
3889
|
if (!t.value) return null;
|
|
3882
3890
|
let r = k.value.map((r, i) => {
|
|
3883
|
-
let a =
|
|
3884
|
-
return
|
|
3891
|
+
let a = qn(r), o = i === 0 ? a : qn(k.value[i - 1]), s = i > 0 && o !== a, c = t.value === "row" || t.value === "column" ? t.value : "selection", l = r.submenuId ? !0 : r.commandId === null ? C.value && Ne(e.editor, c) : Ln(e.editor, r.commandId), u = Jn(r, e.messages), d = xa[r.icon];
|
|
3892
|
+
return H("button", {
|
|
3885
3893
|
key: `${r.id}-${i}`,
|
|
3886
3894
|
type: "button",
|
|
3887
3895
|
role: "menuitem",
|
|
@@ -3916,26 +3924,26 @@ var ga = X({
|
|
|
3916
3924
|
}
|
|
3917
3925
|
}
|
|
3918
3926
|
}, [
|
|
3919
|
-
|
|
3927
|
+
H("span", {
|
|
3920
3928
|
class: "markweave-table-menu-item-icon",
|
|
3921
3929
|
"aria-hidden": "true"
|
|
3922
|
-
}, [
|
|
3930
|
+
}, [H(d, {
|
|
3923
3931
|
size: 18,
|
|
3924
3932
|
strokeWidth: 1.8
|
|
3925
3933
|
})]),
|
|
3926
|
-
|
|
3927
|
-
r.submenuId ?
|
|
3934
|
+
H("span", { class: "markweave-table-menu-item-label" }, u),
|
|
3935
|
+
r.submenuId ? H(Gr, {
|
|
3928
3936
|
class: "markweave-table-menu-chevron",
|
|
3929
3937
|
size: 16,
|
|
3930
3938
|
"aria-hidden": "true"
|
|
3931
3939
|
}) : null
|
|
3932
3940
|
]);
|
|
3933
|
-
}), i = [
|
|
3941
|
+
}), i = [H("div", {
|
|
3934
3942
|
ref: v,
|
|
3935
3943
|
class: "markweave-table-menu-scroll",
|
|
3936
3944
|
style: l.value ? { maxHeight: `${Math.max(1, l.value.maxHeight - 12)}px` } : void 0
|
|
3937
3945
|
}, r)];
|
|
3938
|
-
if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(
|
|
3946
|
+
if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(H("div", {
|
|
3939
3947
|
ref: y,
|
|
3940
3948
|
class: "markweave-table-submenu markweave-table-color-menu",
|
|
3941
3949
|
role: "menu",
|
|
@@ -3948,43 +3956,43 @@ var ga = X({
|
|
|
3948
3956
|
top: `${u.value.top}px`,
|
|
3949
3957
|
maxHeight: `${u.value.maxHeight}px`
|
|
3950
3958
|
} : void 0,
|
|
3951
|
-
onKeydown:
|
|
3959
|
+
onKeydown: ue
|
|
3952
3960
|
}, [
|
|
3953
|
-
|
|
3954
|
-
...
|
|
3961
|
+
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
|
|
3962
|
+
...er.map((t) => H("button", {
|
|
3955
3963
|
key: `text-${t.id}`,
|
|
3956
3964
|
type: "button",
|
|
3957
3965
|
role: "menuitemradio",
|
|
3958
|
-
"aria-checked":
|
|
3959
|
-
"data-active":
|
|
3966
|
+
"aria-checked": ce.value?.textColorId === t.id,
|
|
3967
|
+
"data-active": ce.value?.textColorId === t.id ? "true" : "false",
|
|
3960
3968
|
"data-testid": `markweave-table-text-color-${t.id}`,
|
|
3961
3969
|
onMousedown: $,
|
|
3962
|
-
onClick: () =>
|
|
3963
|
-
}, [
|
|
3970
|
+
onClick: () => re((n) => Mn(e.editor, n, t.id))
|
|
3971
|
+
}, [H("span", {
|
|
3964
3972
|
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3965
3973
|
"aria-hidden": "true",
|
|
3966
3974
|
style: { backgroundColor: t.textColor ?? "var(--markweave-text)" }
|
|
3967
|
-
}),
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
...
|
|
3975
|
+
}), H("span", null, e.messages.table.colors[t.id].text)])),
|
|
3976
|
+
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3977
|
+
H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
|
|
3978
|
+
...er.map((t) => H("button", {
|
|
3971
3979
|
key: `background-${t.id}`,
|
|
3972
3980
|
type: "button",
|
|
3973
3981
|
role: "menuitemradio",
|
|
3974
|
-
"aria-checked":
|
|
3975
|
-
"data-active":
|
|
3982
|
+
"aria-checked": ce.value?.backgroundColorId === t.id,
|
|
3983
|
+
"data-active": ce.value?.backgroundColorId === t.id ? "true" : "false",
|
|
3976
3984
|
"data-testid": `markweave-table-background-color-${t.id}`,
|
|
3977
3985
|
onMousedown: $,
|
|
3978
|
-
onClick: () =>
|
|
3979
|
-
}, [
|
|
3986
|
+
onClick: () => re((n) => jn(e.editor, n, t.id))
|
|
3987
|
+
}, [H("span", {
|
|
3980
3988
|
class: "markweave-table-color-swatch",
|
|
3981
3989
|
"aria-hidden": "true",
|
|
3982
3990
|
style: { backgroundColor: t.backgroundColor }
|
|
3983
|
-
}),
|
|
3991
|
+
}), H("span", null, e.messages.table.colors[t.id].background)]))
|
|
3984
3992
|
])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
|
|
3985
3993
|
let t = (t, n) => {
|
|
3986
|
-
let r =
|
|
3987
|
-
return
|
|
3994
|
+
let r = Sa[t];
|
|
3995
|
+
return H("button", {
|
|
3988
3996
|
key: t,
|
|
3989
3997
|
type: "button",
|
|
3990
3998
|
role: "menuitemradio",
|
|
@@ -3992,14 +4000,14 @@ var ga = X({
|
|
|
3992
4000
|
"data-active": n ? "true" : "false",
|
|
3993
4001
|
"data-testid": `markweave-table-alignment-${t}`,
|
|
3994
4002
|
onMousedown: $,
|
|
3995
|
-
onClick: () =>
|
|
3996
|
-
}, [
|
|
4003
|
+
onClick: () => re((n) => An(e.editor, n, t))
|
|
4004
|
+
}, [H(r, {
|
|
3997
4005
|
size: 18,
|
|
3998
4006
|
strokeWidth: 1.8,
|
|
3999
4007
|
"aria-hidden": "true"
|
|
4000
|
-
}),
|
|
4008
|
+
}), H("span", null, e.messages.table.alignments[t])]);
|
|
4001
4009
|
};
|
|
4002
|
-
i.push(
|
|
4010
|
+
i.push(H("div", {
|
|
4003
4011
|
ref: y,
|
|
4004
4012
|
class: "markweave-table-submenu markweave-table-alignment-menu",
|
|
4005
4013
|
role: "menu",
|
|
@@ -4012,18 +4020,18 @@ var ga = X({
|
|
|
4012
4020
|
top: `${u.value.top}px`,
|
|
4013
4021
|
maxHeight: `${u.value.maxHeight}px`
|
|
4014
4022
|
} : void 0,
|
|
4015
|
-
onKeydown:
|
|
4023
|
+
onKeydown: ue
|
|
4016
4024
|
}, [
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
...
|
|
4025
|
+
...nr.map((e) => t(e, ce.value?.textAlign === e)),
|
|
4026
|
+
H("div", { class: "markweave-table-submenu-separator" }),
|
|
4027
|
+
...ir.map((e) => t(e, ce.value?.verticalAlign === e))
|
|
4020
4028
|
]));
|
|
4021
4029
|
}
|
|
4022
|
-
return
|
|
4030
|
+
return H("div", {
|
|
4023
4031
|
ref: _,
|
|
4024
4032
|
class: "markweave-table-menu",
|
|
4025
4033
|
role: "menu",
|
|
4026
|
-
"aria-label":
|
|
4034
|
+
"aria-label": rr(t.value, e.messages),
|
|
4027
4035
|
"data-testid": "markweave-table-menu",
|
|
4028
4036
|
"data-positioned": l.value ? "true" : "false",
|
|
4029
4037
|
"data-placement": l.value?.placement,
|
|
@@ -4032,19 +4040,19 @@ var ga = X({
|
|
|
4032
4040
|
left: `${l.value.left}px`,
|
|
4033
4041
|
top: `${l.value.top}px`
|
|
4034
4042
|
} : void 0,
|
|
4035
|
-
onKeydown:
|
|
4043
|
+
onKeydown: ue
|
|
4036
4044
|
}, i);
|
|
4037
4045
|
};
|
|
4038
|
-
return () => e.active ?
|
|
4046
|
+
return () => e.active ? H("div", {
|
|
4039
4047
|
ref: p,
|
|
4040
4048
|
class: "markweave-table-controls",
|
|
4041
4049
|
"data-testid": "markweave-table-controls",
|
|
4042
4050
|
"aria-label": e.messages.table.controlsAriaLabel,
|
|
4043
4051
|
"data-open-menu": t.value ?? "none",
|
|
4044
4052
|
"data-positioned": i.value || a.value || o.value ? "true" : "false",
|
|
4045
|
-
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(
|
|
4053
|
+
onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(kn, { type: "clear-hover" }))
|
|
4046
4054
|
}, [
|
|
4047
|
-
d.value ?
|
|
4055
|
+
d.value ? H("div", {
|
|
4048
4056
|
class: "markweave-table-copy-feedback",
|
|
4049
4057
|
role: "status",
|
|
4050
4058
|
"aria-live": "polite",
|
|
@@ -4052,8 +4060,8 @@ var ga = X({
|
|
|
4052
4060
|
"data-copy-kind": d.value.kind,
|
|
4053
4061
|
"data-text-length": d.value.textLength,
|
|
4054
4062
|
"data-html-length": d.value.htmlLength
|
|
4055
|
-
},
|
|
4056
|
-
i.value ?
|
|
4063
|
+
}, zn(d.value)) : null,
|
|
4064
|
+
i.value ? H("button", {
|
|
4057
4065
|
ref: m,
|
|
4058
4066
|
type: "button",
|
|
4059
4067
|
draggable: !0,
|
|
@@ -4075,15 +4083,15 @@ var ga = X({
|
|
|
4075
4083
|
},
|
|
4076
4084
|
onMousedown: $,
|
|
4077
4085
|
onClick: () => L("row", "row-edge"),
|
|
4078
|
-
onDragstart: (e) =>
|
|
4086
|
+
onDragstart: (e) => ae("row", T.value?.index ?? 0, e),
|
|
4079
4087
|
onDragend: () => {
|
|
4080
4088
|
x = null, S = null;
|
|
4081
4089
|
}
|
|
4082
|
-
}, [
|
|
4090
|
+
}, [H(hi, {
|
|
4083
4091
|
size: 14,
|
|
4084
4092
|
"aria-hidden": "true"
|
|
4085
4093
|
})]) : null,
|
|
4086
|
-
a.value ?
|
|
4094
|
+
a.value ? H("button", {
|
|
4087
4095
|
ref: h,
|
|
4088
4096
|
type: "button",
|
|
4089
4097
|
draggable: !0,
|
|
@@ -4105,15 +4113,15 @@ var ga = X({
|
|
|
4105
4113
|
},
|
|
4106
4114
|
onMousedown: $,
|
|
4107
4115
|
onClick: () => L("column", "column-edge"),
|
|
4108
|
-
onDragstart: (e) =>
|
|
4116
|
+
onDragstart: (e) => ae("column", E.value?.index ?? 0, e),
|
|
4109
4117
|
onDragend: () => {
|
|
4110
4118
|
x = null, S = null;
|
|
4111
4119
|
}
|
|
4112
|
-
}, [
|
|
4120
|
+
}, [H(hi, {
|
|
4113
4121
|
size: 14,
|
|
4114
4122
|
"aria-hidden": "true"
|
|
4115
4123
|
})]) : null,
|
|
4116
|
-
O.value && o.value ?
|
|
4124
|
+
O.value && o.value ? H("button", {
|
|
4117
4125
|
ref: g,
|
|
4118
4126
|
type: "button",
|
|
4119
4127
|
class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
|
|
@@ -4130,11 +4138,11 @@ var ga = X({
|
|
|
4130
4138
|
},
|
|
4131
4139
|
onMousedown: $,
|
|
4132
4140
|
onClick: R
|
|
4133
|
-
}, [
|
|
4141
|
+
}, [H(hi, {
|
|
4134
4142
|
size: 14,
|
|
4135
4143
|
"aria-hidden": "true"
|
|
4136
4144
|
})]) : null,
|
|
4137
|
-
s.value ?
|
|
4145
|
+
ee() && s.value ? H("button", {
|
|
4138
4146
|
type: "button",
|
|
4139
4147
|
class: "markweave-table-extend-button markweave-table-extend-button--row",
|
|
4140
4148
|
"aria-label": e.messages.table.addRow,
|
|
@@ -4147,12 +4155,12 @@ var ga = X({
|
|
|
4147
4155
|
height: `${s.value.height}px`
|
|
4148
4156
|
},
|
|
4149
4157
|
onMousedown: $,
|
|
4150
|
-
onClick: () =>
|
|
4151
|
-
}, [
|
|
4158
|
+
onClick: () => ie("row")
|
|
4159
|
+
}, [H(yi, {
|
|
4152
4160
|
size: 14,
|
|
4153
4161
|
"aria-hidden": "true"
|
|
4154
4162
|
})]) : null,
|
|
4155
|
-
c.value ?
|
|
4163
|
+
ee() && c.value ? H("button", {
|
|
4156
4164
|
type: "button",
|
|
4157
4165
|
class: "markweave-table-extend-button markweave-table-extend-button--column",
|
|
4158
4166
|
"aria-label": e.messages.table.addColumn,
|
|
@@ -4165,15 +4173,15 @@ var ga = X({
|
|
|
4165
4173
|
height: `${c.value.height}px`
|
|
4166
4174
|
},
|
|
4167
4175
|
onMousedown: $,
|
|
4168
|
-
onClick: () =>
|
|
4169
|
-
}, [
|
|
4176
|
+
onClick: () => ie("column")
|
|
4177
|
+
}, [H(yi, {
|
|
4170
4178
|
size: 14,
|
|
4171
4179
|
"aria-hidden": "true"
|
|
4172
4180
|
})]) : null,
|
|
4173
|
-
|
|
4181
|
+
fe()
|
|
4174
4182
|
]) : null;
|
|
4175
4183
|
}
|
|
4176
|
-
}),
|
|
4184
|
+
}), wa = Y({
|
|
4177
4185
|
name: "MarkweaveVueTableSelectionOverlay",
|
|
4178
4186
|
props: {
|
|
4179
4187
|
editor: {
|
|
@@ -4186,18 +4194,18 @@ var ga = X({
|
|
|
4186
4194
|
}
|
|
4187
4195
|
},
|
|
4188
4196
|
setup(e) {
|
|
4189
|
-
let t =
|
|
4197
|
+
let t = U(null), n = () => {
|
|
4190
4198
|
if (e.focusState.mode !== "cell-selection") {
|
|
4191
4199
|
t.value = null;
|
|
4192
4200
|
return;
|
|
4193
4201
|
}
|
|
4194
|
-
t.value =
|
|
4202
|
+
t.value = Zn(e.editor, Dn(e.editor.state));
|
|
4195
4203
|
};
|
|
4196
|
-
return
|
|
4204
|
+
return vr(() => {
|
|
4197
4205
|
n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
|
|
4198
|
-
}),
|
|
4206
|
+
}), q(() => {
|
|
4199
4207
|
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
4200
|
-
}),
|
|
4208
|
+
}), K(() => [
|
|
4201
4209
|
e.focusState.activeCellPos,
|
|
4202
4210
|
e.focusState.anchorCellPos,
|
|
4203
4211
|
e.focusState.mode,
|
|
@@ -4205,10 +4213,10 @@ var ga = X({
|
|
|
4205
4213
|
e.focusState.selectionFrom,
|
|
4206
4214
|
e.focusState.selectionTo
|
|
4207
4215
|
], () => {
|
|
4208
|
-
|
|
4216
|
+
J(n);
|
|
4209
4217
|
}, { flush: "post" }), () => {
|
|
4210
4218
|
let e = t.value;
|
|
4211
|
-
return e ?
|
|
4219
|
+
return e ? H("div", {
|
|
4212
4220
|
"aria-hidden": "true",
|
|
4213
4221
|
class: "markweave-table-selection-overlay",
|
|
4214
4222
|
"data-axis-target": e.axisTarget ?? "none",
|
|
@@ -4230,7 +4238,7 @@ var ga = X({
|
|
|
4230
4238
|
}) : null;
|
|
4231
4239
|
};
|
|
4232
4240
|
}
|
|
4233
|
-
}),
|
|
4241
|
+
}), Ta = Y({
|
|
4234
4242
|
name: "MarkweaveVueCodeBlockControls",
|
|
4235
4243
|
props: {
|
|
4236
4244
|
editor: {
|
|
@@ -4259,53 +4267,53 @@ var ga = X({
|
|
|
4259
4267
|
}
|
|
4260
4268
|
},
|
|
4261
4269
|
setup(e) {
|
|
4262
|
-
let t =
|
|
4270
|
+
let t = U(null), n = U(null), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U([]), u = U(null), d = U(!1), f = U(""), p = U(-1), m = U(null), h = U(!1), g = U(null), _ = U(null), v = U(!1), y = U({
|
|
4263
4271
|
active: !1,
|
|
4264
4272
|
lastX: 0,
|
|
4265
4273
|
lastY: 0
|
|
4266
|
-
}), b =
|
|
4274
|
+
}), b = U(0), x = U(0), S = U(0), C = null, ee = G(() => (S.value, Ot(e.editor, s.value))), w = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
4267
4275
|
...e.state,
|
|
4268
4276
|
pos: e.state.pos,
|
|
4269
4277
|
active: !0
|
|
4270
|
-
} : null),
|
|
4278
|
+
} : null), T = G(() => ee.value ?? w.value), E = G(() => T.value !== null), D = G(() => T.value?.language === "mermaid"), O = G(() => Nt(e.editor, T.value)), k = G(() => E.value && T.value !== null && !O.value), A = G(() => !e.readOnly), j = G(() => T.value ? xt(T.value.language) : xt("text")), te = G(() => m.value?.status ?? "idle"), M = G(() => T.value?.mermaidPreviewMode ?? e.mermaidMode), N = G(() => D.value && M.value === "preview"), P = G(() => (S.value, b.value, x.value, jt(e.editor))), ne = G(() => `${x.value}|${P.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), F = G(() => Tt(f.value)), I = G(() => T.value ? `${T.value.pos}:${T.value.language}:${T.value.text}` : "none"), L = () => {
|
|
4271
4279
|
C !== null && (window.clearTimeout(C), C = null);
|
|
4272
|
-
},
|
|
4273
|
-
|
|
4280
|
+
}, R = (e) => {
|
|
4281
|
+
L(), m.value = e, e && (C = window.setTimeout(() => {
|
|
4274
4282
|
m.value = null, C = null;
|
|
4275
|
-
},
|
|
4276
|
-
},
|
|
4283
|
+
}, mt));
|
|
4284
|
+
}, z = () => {
|
|
4277
4285
|
g.value = null, _.value = null, v.value = !1, y.value = {
|
|
4278
4286
|
active: !1,
|
|
4279
4287
|
lastX: 0,
|
|
4280
4288
|
lastY: 0
|
|
4281
4289
|
}, e.editor.view.focus();
|
|
4282
|
-
},
|
|
4290
|
+
}, B = () => {
|
|
4283
4291
|
let n = t.value;
|
|
4284
4292
|
if (!n) return;
|
|
4285
|
-
if (!
|
|
4293
|
+
if (!kt(n) || P.value.length === 0) {
|
|
4286
4294
|
l.value = [];
|
|
4287
4295
|
return;
|
|
4288
4296
|
}
|
|
4289
|
-
let r = n.getBoundingClientRect(), i =
|
|
4290
|
-
let n = Ct(
|
|
4291
|
-
return n ? [
|
|
4297
|
+
let r = n.getBoundingClientRect(), i = P.value.flatMap((t) => {
|
|
4298
|
+
let n = wt(Ct(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
4299
|
+
return n ? [yt(t, n, r)] : [];
|
|
4292
4300
|
});
|
|
4293
|
-
l.value =
|
|
4294
|
-
},
|
|
4295
|
-
if (!
|
|
4301
|
+
l.value = Pt(l.value, i, P.value.map((e) => e.pos));
|
|
4302
|
+
}, V = () => {
|
|
4303
|
+
if (!k.value || !T.value) {
|
|
4296
4304
|
c.value = null, u.value = null;
|
|
4297
4305
|
return;
|
|
4298
4306
|
}
|
|
4299
4307
|
let i = t.value;
|
|
4300
4308
|
if (!i) return;
|
|
4301
|
-
let a =
|
|
4309
|
+
let a = Ct(e.editor, T.value.pos, M.value), o = i.getBoundingClientRect(), s = wt(a, o);
|
|
4302
4310
|
if (!s) {
|
|
4303
|
-
c.value = c.value?.pos ===
|
|
4311
|
+
c.value = c.value?.pos === T.value.pos ? c.value : null, u.value = d.value ? u.value : null;
|
|
4304
4312
|
return;
|
|
4305
4313
|
}
|
|
4306
|
-
if (c.value =
|
|
4314
|
+
if (c.value = _t(T.value.pos, s, o), d.value && n.value) {
|
|
4307
4315
|
let e = n.value.getBoundingClientRect(), t = r.value?.getBoundingClientRect().height;
|
|
4308
|
-
u.value =
|
|
4316
|
+
u.value = ft({
|
|
4309
4317
|
overlayRect: o,
|
|
4310
4318
|
buttonRect: e,
|
|
4311
4319
|
menuHeight: t,
|
|
@@ -4313,84 +4321,84 @@ var ga = X({
|
|
|
4313
4321
|
windowHeight: window.innerHeight
|
|
4314
4322
|
});
|
|
4315
4323
|
}
|
|
4316
|
-
},
|
|
4324
|
+
}, re = async () => {
|
|
4317
4325
|
if (e.readOnly) {
|
|
4318
|
-
if (!
|
|
4319
|
-
let e = await
|
|
4320
|
-
|
|
4326
|
+
if (!T.value) return;
|
|
4327
|
+
let e = await ht(T.value.text);
|
|
4328
|
+
R(st(T.value, e ? "copied" : "failed"));
|
|
4321
4329
|
return;
|
|
4322
4330
|
}
|
|
4323
|
-
if (!
|
|
4324
|
-
let t = await
|
|
4325
|
-
|
|
4326
|
-
},
|
|
4331
|
+
if (!bt(e.editor, T.value)) return;
|
|
4332
|
+
let t = await at(e.editor);
|
|
4333
|
+
R(st(ot(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
4334
|
+
}, ie = (t, n) => {
|
|
4327
4335
|
if (e.readOnly) {
|
|
4328
|
-
|
|
4336
|
+
tn(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
|
|
4329
4337
|
return;
|
|
4330
4338
|
}
|
|
4331
4339
|
let r = e.state.active && e.state.pos === t.pos;
|
|
4332
|
-
|
|
4333
|
-
},
|
|
4334
|
-
if (e.readOnly || !
|
|
4335
|
-
let n = e.state.active && e.state.pos ===
|
|
4336
|
-
|
|
4337
|
-
},
|
|
4338
|
-
d.value = !d.value, d.value && o.value === null && (o.value =
|
|
4339
|
-
},
|
|
4340
|
-
let t =
|
|
4341
|
-
f.value = e, p.value =
|
|
4342
|
-
},
|
|
4340
|
+
dt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
|
|
4341
|
+
}, ae = (t) => {
|
|
4342
|
+
if (e.readOnly || !T.value) return;
|
|
4343
|
+
let n = e.state.active && e.state.pos === T.value.pos;
|
|
4344
|
+
ut(e.editor, T.value.pos, t) && (t === "mermaid" && dt(e.editor, T.value.pos, "preview") && e.onMermaidModeChange("preview"), d.value = !1, f.value = "", p.value = -1, S.value += 1, n && e.editor.view.focus());
|
|
4345
|
+
}, se = () => {
|
|
4346
|
+
d.value = !d.value, d.value && o.value === null && (o.value = gt()), p.value = d.value ? At(F.value, T.value?.language ?? null) : -1;
|
|
4347
|
+
}, ce = (e) => {
|
|
4348
|
+
let t = Tt(e);
|
|
4349
|
+
f.value = e, p.value = At(t, e.trim() ? null : T.value?.language ?? null);
|
|
4350
|
+
}, le = (t) => {
|
|
4343
4351
|
if (!t.isComposing) {
|
|
4344
4352
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
4345
|
-
t.preventDefault(), p.value =
|
|
4353
|
+
t.preventDefault(), p.value = It(p.value, F.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
4346
4354
|
return;
|
|
4347
4355
|
}
|
|
4348
4356
|
if (t.key === "Enter") {
|
|
4349
|
-
let e =
|
|
4350
|
-
e && (t.preventDefault(),
|
|
4357
|
+
let e = F.value[p.value];
|
|
4358
|
+
e && (t.preventDefault(), ae(e.language));
|
|
4351
4359
|
return;
|
|
4352
4360
|
}
|
|
4353
4361
|
t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
|
|
4354
4362
|
}
|
|
4355
|
-
}, le = () => {
|
|
4356
|
-
e.readOnly || !E.value || ct(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
|
|
4357
4363
|
}, ue = () => {
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4364
|
+
e.readOnly || !T.value || lt(e.editor, T.value.pos, !O.value) && (b.value += 1, S.value += 1, s.value = null);
|
|
4365
|
+
}, de = () => {
|
|
4366
|
+
if (!T.value) return;
|
|
4367
|
+
let t = Mt(e.editor, T.value.pos);
|
|
4368
|
+
t && oe({
|
|
4361
4369
|
data: new Blob([t], { type: "image/svg+xml" }),
|
|
4362
4370
|
fileName: "markweave-mermaid.svg",
|
|
4363
4371
|
onSettled: () => e.editor.view.focus(),
|
|
4364
4372
|
ownerDocument: document
|
|
4365
4373
|
});
|
|
4366
|
-
},
|
|
4367
|
-
if (!
|
|
4368
|
-
let t =
|
|
4369
|
-
t && (g.value =
|
|
4374
|
+
}, fe = () => {
|
|
4375
|
+
if (!T.value) return;
|
|
4376
|
+
let t = Mt(e.editor, T.value.pos);
|
|
4377
|
+
t && (g.value = vt(t), _.value = null, v.value = !1, y.value = {
|
|
4370
4378
|
active: !1,
|
|
4371
4379
|
lastX: 0,
|
|
4372
4380
|
lastY: 0
|
|
4373
4381
|
});
|
|
4374
|
-
},
|
|
4382
|
+
}, pe = (e) => {
|
|
4375
4383
|
g.value = g.value ? {
|
|
4376
4384
|
...g.value,
|
|
4377
|
-
scale:
|
|
4385
|
+
scale: pt(g.value.scale + e)
|
|
4378
4386
|
} : null;
|
|
4379
|
-
},
|
|
4380
|
-
g.value = g.value ?
|
|
4387
|
+
}, me = () => {
|
|
4388
|
+
g.value = g.value ? vt(g.value.svg) : null, y.value = {
|
|
4381
4389
|
active: !1,
|
|
4382
4390
|
lastX: 0,
|
|
4383
4391
|
lastY: 0
|
|
4384
4392
|
}, v.value = !1;
|
|
4385
|
-
}, me = (e) => {
|
|
4386
|
-
e.preventDefault(), fe(e.deltaY < 0 ? Pt : -Pt);
|
|
4387
4393
|
}, he = (e) => {
|
|
4394
|
+
e.preventDefault(), pe(e.deltaY < 0 ? Ft : -Ft);
|
|
4395
|
+
}, ge = (e) => {
|
|
4388
4396
|
e.button === 0 && (e.preventDefault(), y.value = {
|
|
4389
4397
|
active: !0,
|
|
4390
4398
|
lastX: e.clientX,
|
|
4391
4399
|
lastY: e.clientY
|
|
4392
4400
|
}, v.value = !0);
|
|
4393
|
-
},
|
|
4401
|
+
}, _e = (e) => {
|
|
4394
4402
|
let t = y.value;
|
|
4395
4403
|
if (!t.active) return;
|
|
4396
4404
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
@@ -4398,64 +4406,64 @@ var ga = X({
|
|
|
4398
4406
|
active: !0,
|
|
4399
4407
|
lastX: e.clientX,
|
|
4400
4408
|
lastY: e.clientY
|
|
4401
|
-
}, g.value =
|
|
4402
|
-
},
|
|
4409
|
+
}, g.value = Lt(g.value, n, r);
|
|
4410
|
+
}, ve = () => {
|
|
4403
4411
|
y.value = {
|
|
4404
4412
|
active: !1,
|
|
4405
4413
|
lastX: 0,
|
|
4406
4414
|
lastY: 0
|
|
4407
4415
|
}, v.value = !1;
|
|
4408
4416
|
};
|
|
4409
|
-
|
|
4417
|
+
K(() => e.readOnly, (e) => {
|
|
4410
4418
|
e && (d.value = !1, f.value = "");
|
|
4411
|
-
}),
|
|
4412
|
-
|
|
4413
|
-
}),
|
|
4419
|
+
}), K(I, () => {
|
|
4420
|
+
R(null), d.value = !1, f.value = "", p.value = -1, g.value = null, _.value = null, v.value = !1;
|
|
4421
|
+
}), K(d, async (e) => {
|
|
4414
4422
|
if (!e) {
|
|
4415
4423
|
p.value = -1;
|
|
4416
4424
|
return;
|
|
4417
4425
|
}
|
|
4418
|
-
await
|
|
4419
|
-
}),
|
|
4426
|
+
await J(), V(), i.value?.focus({ preventScroll: !0 });
|
|
4427
|
+
}), K(() => [
|
|
4420
4428
|
d.value,
|
|
4421
4429
|
f.value,
|
|
4422
4430
|
p.value
|
|
4423
4431
|
], async () => {
|
|
4424
4432
|
if (!d.value || p.value < 0) return;
|
|
4425
|
-
await
|
|
4433
|
+
await J();
|
|
4426
4434
|
let e = a.value, t = e?.querySelector(`[data-language-index="${p.value}"]`);
|
|
4427
|
-
e && t &&
|
|
4428
|
-
}, { flush: "post" }),
|
|
4429
|
-
|
|
4435
|
+
e && t && Rt(e, t);
|
|
4436
|
+
}, { flush: "post" }), K(() => [
|
|
4437
|
+
k.value,
|
|
4430
4438
|
b.value,
|
|
4431
|
-
|
|
4432
|
-
|
|
4439
|
+
T.value?.pos ?? null,
|
|
4440
|
+
F.value.length,
|
|
4433
4441
|
d.value,
|
|
4434
|
-
|
|
4442
|
+
M.value
|
|
4435
4443
|
], async () => {
|
|
4436
|
-
await
|
|
4444
|
+
await J(), V();
|
|
4437
4445
|
}, {
|
|
4438
4446
|
flush: "post",
|
|
4439
4447
|
immediate: !0
|
|
4440
|
-
}),
|
|
4441
|
-
await
|
|
4448
|
+
}), K(ne, async () => {
|
|
4449
|
+
await J(), B(), window.requestAnimationFrame(B);
|
|
4442
4450
|
}, {
|
|
4443
4451
|
flush: "post",
|
|
4444
4452
|
immediate: !0
|
|
4445
4453
|
});
|
|
4446
|
-
let
|
|
4447
|
-
return
|
|
4448
|
-
|
|
4454
|
+
let ye = null;
|
|
4455
|
+
return vr(() => {
|
|
4456
|
+
J(() => {
|
|
4449
4457
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
4450
4458
|
if (n.target instanceof Node && t.value?.contains(n.target) || d.value) return;
|
|
4451
|
-
let r =
|
|
4459
|
+
let r = Dt(e.editor, n.target), i = Ot(e.editor, r), a = i && !Nt(e.editor, i) ? i.pos : null;
|
|
4452
4460
|
s.value = s.value === a ? s.value : a;
|
|
4453
4461
|
}, i = () => {
|
|
4454
4462
|
d.value || (s.value = null);
|
|
4455
4463
|
}, a = (t) => {
|
|
4456
4464
|
if (t.key === "Escape") {
|
|
4457
4465
|
if (g.value) {
|
|
4458
|
-
|
|
4466
|
+
z();
|
|
4459
4467
|
return;
|
|
4460
4468
|
}
|
|
4461
4469
|
d.value && (d.value = !1, p.value = -1, e.editor.view.focus());
|
|
@@ -4463,16 +4471,16 @@ var ga = X({
|
|
|
4463
4471
|
}, o = (e) => {
|
|
4464
4472
|
d.value && (e.target instanceof Node && t.value?.contains(e.target) || (d.value = !1, p.value = -1));
|
|
4465
4473
|
}, c = ({ transaction: e }) => {
|
|
4466
|
-
e.getMeta(
|
|
4474
|
+
e.getMeta(it) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(it) || Qt(e)) && (S.value += 1);
|
|
4467
4475
|
};
|
|
4468
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize",
|
|
4469
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize",
|
|
4476
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", V), window.addEventListener("scroll", V, !0), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ye = () => {
|
|
4477
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", V), window.removeEventListener("scroll", V, !0), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), L();
|
|
4470
4478
|
};
|
|
4471
4479
|
});
|
|
4472
|
-
}),
|
|
4473
|
-
|
|
4480
|
+
}), q(() => {
|
|
4481
|
+
ye?.(), ye = null, L();
|
|
4474
4482
|
}), () => {
|
|
4475
|
-
if (!
|
|
4483
|
+
if (!k.value && P.value.length === 0 && !g.value) return null;
|
|
4476
4484
|
let s = c.value ? {
|
|
4477
4485
|
top: `${c.value.top}px`,
|
|
4478
4486
|
right: `${c.value.right}px`
|
|
@@ -4480,15 +4488,15 @@ var ga = X({
|
|
|
4480
4488
|
left: `${u.value.left}px`,
|
|
4481
4489
|
top: `${u.value.top}px`
|
|
4482
4490
|
} : void 0;
|
|
4483
|
-
return
|
|
4491
|
+
return H("div", {
|
|
4484
4492
|
ref: t,
|
|
4485
4493
|
class: "markweave-codeblock-overlay",
|
|
4486
4494
|
"data-testid": "markweave-codeblock-overlay",
|
|
4487
4495
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
4488
4496
|
}, [
|
|
4489
|
-
...
|
|
4497
|
+
...P.value.map((e) => {
|
|
4490
4498
|
let t = l.value.find((t) => t.pos === e.pos);
|
|
4491
|
-
return
|
|
4499
|
+
return H("div", {
|
|
4492
4500
|
key: e.pos,
|
|
4493
4501
|
class: "markweave-mermaid-tabs",
|
|
4494
4502
|
"data-testid": "markweave-mermaid-tabs",
|
|
@@ -4498,29 +4506,29 @@ var ga = X({
|
|
|
4498
4506
|
top: `${t.top}px`,
|
|
4499
4507
|
left: `${t.left}px`
|
|
4500
4508
|
} : void 0
|
|
4501
|
-
}, ["code", "preview"].map((t) =>
|
|
4509
|
+
}, ["code", "preview"].map((t) => H("button", {
|
|
4502
4510
|
key: t,
|
|
4503
4511
|
type: "button",
|
|
4504
4512
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
4505
4513
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
4506
4514
|
onMousedown: $,
|
|
4507
|
-
onClick: () =>
|
|
4515
|
+
onClick: () => ie(e, t)
|
|
4508
4516
|
}, t === "code" ? "Code" : "Preview")));
|
|
4509
4517
|
}),
|
|
4510
|
-
|
|
4518
|
+
k.value && T.value ? H("div", {
|
|
4511
4519
|
class: "markweave-codeblock-controls",
|
|
4512
4520
|
"data-testid": "markweave-codeblock-controls",
|
|
4513
4521
|
"data-positioned": c.value ? "true" : "false",
|
|
4514
|
-
"data-collapsed":
|
|
4522
|
+
"data-collapsed": O.value ? "true" : "false",
|
|
4515
4523
|
"data-read-only": e.readOnly ? "true" : "false",
|
|
4516
4524
|
"aria-label": "Code block controls",
|
|
4517
4525
|
style: s
|
|
4518
4526
|
}, [
|
|
4519
|
-
e.readOnly ?
|
|
4527
|
+
e.readOnly ? H("span", {
|
|
4520
4528
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
4521
4529
|
"aria-label": "Code block language",
|
|
4522
4530
|
"data-testid": "markweave-codeblock-language"
|
|
4523
|
-
}, [
|
|
4531
|
+
}, [H("span", null, j.value)]) : H("button", {
|
|
4524
4532
|
ref: n,
|
|
4525
4533
|
type: "button",
|
|
4526
4534
|
class: "markweave-codeblock-language-button",
|
|
@@ -4529,24 +4537,24 @@ var ga = X({
|
|
|
4529
4537
|
"aria-haspopup": "listbox",
|
|
4530
4538
|
"data-testid": "markweave-codeblock-language",
|
|
4531
4539
|
onMousedown: $,
|
|
4532
|
-
onClick:
|
|
4533
|
-
}, [
|
|
4534
|
-
|
|
4540
|
+
onClick: se
|
|
4541
|
+
}, [H("span", null, j.value), Q("chevron")]),
|
|
4542
|
+
A.value ? H("button", {
|
|
4535
4543
|
type: "button",
|
|
4536
4544
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
4537
|
-
"aria-label":
|
|
4538
|
-
title:
|
|
4545
|
+
"aria-label": O.value ? "Expand code block" : "Collapse code block",
|
|
4546
|
+
title: O.value ? "Expand code block" : "Collapse code block",
|
|
4539
4547
|
"data-testid": "markweave-codeblock-collapse",
|
|
4540
|
-
"data-collapsed":
|
|
4548
|
+
"data-collapsed": O.value ? "true" : "false",
|
|
4541
4549
|
onMousedown: $,
|
|
4542
|
-
onClick:
|
|
4543
|
-
}, [
|
|
4544
|
-
|
|
4550
|
+
onClick: ue
|
|
4551
|
+
}, [Q("chevron")]) : null,
|
|
4552
|
+
H("span", { class: "markweave-codeblock-copy-wrap" }, [H("button", {
|
|
4545
4553
|
type: "button",
|
|
4546
4554
|
class: "markweave-codeblock-icon-button",
|
|
4547
4555
|
"aria-label": "Copy to clipboard",
|
|
4548
4556
|
"data-testid": "markweave-codeblock-copy",
|
|
4549
|
-
"data-copy-state":
|
|
4557
|
+
"data-copy-state": te.value,
|
|
4550
4558
|
onMousedown: $,
|
|
4551
4559
|
onMouseenter: () => {
|
|
4552
4560
|
h.value = !0;
|
|
@@ -4561,66 +4569,66 @@ var ga = X({
|
|
|
4561
4569
|
h.value = !1;
|
|
4562
4570
|
},
|
|
4563
4571
|
onClick: () => {
|
|
4564
|
-
|
|
4572
|
+
re();
|
|
4565
4573
|
}
|
|
4566
|
-
}, [
|
|
4574
|
+
}, [Q(te.value === "copied" ? "check" : "clipboard")]), h.value ? H("span", {
|
|
4567
4575
|
class: "markweave-codeblock-tooltip",
|
|
4568
4576
|
role: "tooltip",
|
|
4569
4577
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
4570
4578
|
}, "Copy to clipboard") : null]),
|
|
4571
|
-
|
|
4579
|
+
D.value && M.value === "preview" ? H("div", {
|
|
4572
4580
|
class: "markweave-mermaid-preview-actions",
|
|
4573
4581
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
4574
|
-
}, [
|
|
4582
|
+
}, [H("button", {
|
|
4575
4583
|
type: "button",
|
|
4576
4584
|
class: "markweave-codeblock-icon-button",
|
|
4577
4585
|
"aria-label": "Fullscreen Mermaid preview",
|
|
4578
4586
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
4579
|
-
disabled: !
|
|
4587
|
+
disabled: !N.value,
|
|
4580
4588
|
onMousedown: $,
|
|
4581
|
-
onClick:
|
|
4582
|
-
}, [
|
|
4589
|
+
onClick: fe
|
|
4590
|
+
}, [Q("expand")]), H("button", {
|
|
4583
4591
|
type: "button",
|
|
4584
4592
|
class: "markweave-codeblock-icon-button",
|
|
4585
4593
|
"aria-label": "Download Mermaid SVG",
|
|
4586
4594
|
"data-testid": "markweave-mermaid-download",
|
|
4587
|
-
disabled: !
|
|
4595
|
+
disabled: !N.value,
|
|
4588
4596
|
onMousedown: $,
|
|
4589
|
-
onClick:
|
|
4590
|
-
}, [
|
|
4597
|
+
onClick: de
|
|
4598
|
+
}, [Q("download")])]) : null
|
|
4591
4599
|
]) : null,
|
|
4592
|
-
|
|
4600
|
+
A.value && k.value && d.value && T.value ? H("div", {
|
|
4593
4601
|
ref: r,
|
|
4594
4602
|
class: "markweave-codeblock-language-menu",
|
|
4595
4603
|
"data-testid": "markweave-codeblock-language-menu",
|
|
4596
4604
|
"data-positioned": u.value ? "true" : "false",
|
|
4597
4605
|
style: m
|
|
4598
|
-
}, [
|
|
4606
|
+
}, [H("label", { class: "markweave-codeblock-language-search" }, [H("input", {
|
|
4599
4607
|
ref: i,
|
|
4600
4608
|
role: "combobox",
|
|
4601
4609
|
"aria-autocomplete": "list",
|
|
4602
4610
|
"aria-controls": o.value ?? void 0,
|
|
4603
4611
|
"aria-expanded": "true",
|
|
4604
|
-
"aria-activedescendant": o.value &&
|
|
4612
|
+
"aria-activedescendant": o.value && F.value[p.value] ? Et(o.value, F.value[p.value].language) : void 0,
|
|
4605
4613
|
"aria-label": "Search code block languages",
|
|
4606
4614
|
value: f.value,
|
|
4607
4615
|
placeholder: "Search...",
|
|
4608
4616
|
"data-testid": "markweave-codeblock-language-search",
|
|
4609
4617
|
onInput: (e) => {
|
|
4610
|
-
|
|
4618
|
+
ce(e.target.value);
|
|
4611
4619
|
},
|
|
4612
|
-
onKeydown:
|
|
4613
|
-
}),
|
|
4620
|
+
onKeydown: le
|
|
4621
|
+
}), Q("search")]), H("div", {
|
|
4614
4622
|
ref: a,
|
|
4615
4623
|
id: o.value ?? void 0,
|
|
4616
4624
|
class: "markweave-codeblock-language-list",
|
|
4617
4625
|
role: "listbox",
|
|
4618
4626
|
"aria-label": "Code block languages"
|
|
4619
|
-
},
|
|
4620
|
-
let n =
|
|
4621
|
-
return
|
|
4627
|
+
}, F.value.map((e, t) => {
|
|
4628
|
+
let n = T.value?.language === e.language, r = t === p.value;
|
|
4629
|
+
return H("button", {
|
|
4622
4630
|
key: e.language,
|
|
4623
|
-
id: o.value ?
|
|
4631
|
+
id: o.value ? Et(o.value, e.language) : void 0,
|
|
4624
4632
|
type: "button",
|
|
4625
4633
|
role: "option",
|
|
4626
4634
|
"aria-selected": n ? "true" : "false",
|
|
@@ -4632,21 +4640,21 @@ var ga = X({
|
|
|
4632
4640
|
onMouseenter: () => {
|
|
4633
4641
|
p.value = t;
|
|
4634
4642
|
},
|
|
4635
|
-
onClick: () =>
|
|
4636
|
-
}, [
|
|
4643
|
+
onClick: () => ae(e.language)
|
|
4644
|
+
}, [H("span", null, e.label), n ? Q("check") : null]);
|
|
4637
4645
|
}))]) : null,
|
|
4638
|
-
g.value ?
|
|
4646
|
+
g.value ? H("div", {
|
|
4639
4647
|
class: "markweave-mermaid-fullscreen-layer",
|
|
4640
4648
|
role: "dialog",
|
|
4641
4649
|
"aria-modal": "true",
|
|
4642
4650
|
"aria-label": "Mermaid preview",
|
|
4643
4651
|
"data-testid": "markweave-mermaid-fullscreen-layer"
|
|
4644
4652
|
}, [
|
|
4645
|
-
|
|
4653
|
+
H("div", {
|
|
4646
4654
|
class: "markweave-mermaid-fullscreen-toolbar",
|
|
4647
4655
|
"data-testid": "markweave-mermaid-fullscreen-toolbar"
|
|
4648
4656
|
}, [
|
|
4649
|
-
|
|
4657
|
+
H("button", {
|
|
4650
4658
|
type: "button",
|
|
4651
4659
|
class: "markweave-mermaid-fullscreen-control",
|
|
4652
4660
|
"aria-label": "Zoom out",
|
|
@@ -4663,13 +4671,13 @@ var ga = X({
|
|
|
4663
4671
|
onBlur: () => {
|
|
4664
4672
|
_.value = null;
|
|
4665
4673
|
},
|
|
4666
|
-
onClick: () =>
|
|
4667
|
-
}, [
|
|
4668
|
-
|
|
4674
|
+
onClick: () => pe(-Ft)
|
|
4675
|
+
}, [Q("zoomOut")]),
|
|
4676
|
+
H("span", {
|
|
4669
4677
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
4670
4678
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
4671
|
-
},
|
|
4672
|
-
|
|
4679
|
+
}, St(g.value.scale)),
|
|
4680
|
+
H("button", {
|
|
4673
4681
|
type: "button",
|
|
4674
4682
|
class: "markweave-mermaid-fullscreen-control",
|
|
4675
4683
|
"aria-label": "Zoom in",
|
|
@@ -4686,9 +4694,9 @@ var ga = X({
|
|
|
4686
4694
|
onBlur: () => {
|
|
4687
4695
|
_.value = null;
|
|
4688
4696
|
},
|
|
4689
|
-
onClick: () =>
|
|
4690
|
-
}, [
|
|
4691
|
-
|
|
4697
|
+
onClick: () => pe(Ft)
|
|
4698
|
+
}, [Q("zoomIn")]),
|
|
4699
|
+
H("button", {
|
|
4692
4700
|
type: "button",
|
|
4693
4701
|
class: "markweave-mermaid-fullscreen-control",
|
|
4694
4702
|
"aria-label": "Reset zoom",
|
|
@@ -4705,31 +4713,31 @@ var ga = X({
|
|
|
4705
4713
|
onBlur: () => {
|
|
4706
4714
|
_.value = null;
|
|
4707
4715
|
},
|
|
4708
|
-
onClick:
|
|
4709
|
-
}, [
|
|
4710
|
-
_.value ?
|
|
4716
|
+
onClick: me
|
|
4717
|
+
}, [Q("reset")]),
|
|
4718
|
+
_.value ? H("span", {
|
|
4711
4719
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
4712
4720
|
role: "tooltip",
|
|
4713
4721
|
"data-testid": "markweave-mermaid-fullscreen-tooltip"
|
|
4714
4722
|
}, _.value === "zoom-out" ? "Zoom out" : _.value === "zoom-in" ? "Zoom in" : "Reset") : null
|
|
4715
4723
|
]),
|
|
4716
|
-
|
|
4724
|
+
H("button", {
|
|
4717
4725
|
type: "button",
|
|
4718
4726
|
class: "markweave-mermaid-fullscreen-close",
|
|
4719
4727
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
4720
4728
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
4721
|
-
onClick:
|
|
4722
|
-
}, [
|
|
4723
|
-
|
|
4729
|
+
onClick: z
|
|
4730
|
+
}, [Q("close")]),
|
|
4731
|
+
H("div", {
|
|
4724
4732
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
4725
4733
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
4726
4734
|
"data-dragging": v.value ? "true" : "false",
|
|
4727
|
-
onWheel:
|
|
4728
|
-
onMousedown:
|
|
4729
|
-
onMousemove:
|
|
4730
|
-
onMouseup:
|
|
4731
|
-
onMouseleave:
|
|
4732
|
-
}, [
|
|
4735
|
+
onWheel: he,
|
|
4736
|
+
onMousedown: ge,
|
|
4737
|
+
onMousemove: _e,
|
|
4738
|
+
onMouseup: ve,
|
|
4739
|
+
onMouseleave: ve
|
|
4740
|
+
}, [H("div", {
|
|
4733
4741
|
class: "markweave-mermaid-fullscreen-content",
|
|
4734
4742
|
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
4735
4743
|
"data-scale-percent": Math.round(g.value.scale * 100),
|
|
@@ -4745,7 +4753,7 @@ var ga = X({
|
|
|
4745
4753
|
]);
|
|
4746
4754
|
};
|
|
4747
4755
|
}
|
|
4748
|
-
}),
|
|
4756
|
+
}), Ea = Y({
|
|
4749
4757
|
name: "MarkweaveVueInnerToc",
|
|
4750
4758
|
props: {
|
|
4751
4759
|
editor: {
|
|
@@ -4770,29 +4778,29 @@ var ga = X({
|
|
|
4770
4778
|
}
|
|
4771
4779
|
},
|
|
4772
4780
|
setup(e) {
|
|
4773
|
-
let t =
|
|
4774
|
-
n?.(), n = e.placement === "container" && t.value ?
|
|
4781
|
+
let t = U(null), n, r, i = () => {
|
|
4782
|
+
n?.(), n = e.placement === "container" && t.value ? tt(t.value) : void 0;
|
|
4775
4783
|
}, a = () => {
|
|
4776
|
-
r?.(), r = t.value && e.state.items.length ?
|
|
4784
|
+
r?.(), r = t.value && e.state.items.length ? nt(t.value, e.state.items.length) : void 0;
|
|
4777
4785
|
};
|
|
4778
|
-
return
|
|
4786
|
+
return vr(() => {
|
|
4779
4787
|
i(), a();
|
|
4780
|
-
}),
|
|
4788
|
+
}), q(() => {
|
|
4781
4789
|
n?.(), r?.();
|
|
4782
|
-
}),
|
|
4790
|
+
}), K(() => e.placement, i), K(() => e.state.items.length, a, { flush: "post" }), () => e.state.items.length ? H("nav", {
|
|
4783
4791
|
ref: t,
|
|
4784
4792
|
class: "markweave-inner-toc",
|
|
4785
4793
|
"data-testid": "markweave-inner-toc",
|
|
4786
4794
|
"aria-label": e.messages.toc.ariaLabel,
|
|
4787
|
-
style: { "--markweave-inner-toc-rail-height":
|
|
4788
|
-
}, [
|
|
4795
|
+
style: { "--markweave-inner-toc-rail-height": Ze(e.state.items.length) }
|
|
4796
|
+
}, [H("div", {
|
|
4789
4797
|
class: "markweave-inner-toc-rail",
|
|
4790
4798
|
"aria-hidden": "true"
|
|
4791
|
-
}, e.state.items.map((e) =>
|
|
4799
|
+
}, e.state.items.map((e) => H("span", {
|
|
4792
4800
|
key: e.id,
|
|
4793
4801
|
"data-level": e.level,
|
|
4794
4802
|
"data-active": e.active ? "true" : "false"
|
|
4795
|
-
}))),
|
|
4803
|
+
}))), H("div", { class: "markweave-inner-toc-panel" }, [H("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => H("button", {
|
|
4796
4804
|
key: t.id,
|
|
4797
4805
|
type: "button",
|
|
4798
4806
|
class: "markweave-inner-toc-item",
|
|
@@ -4801,87 +4809,88 @@ var ga = X({
|
|
|
4801
4809
|
"aria-current": t.active ? "location" : void 0,
|
|
4802
4810
|
"aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
|
|
4803
4811
|
title: t.text,
|
|
4804
|
-
onClick: () =>
|
|
4812
|
+
onClick: () => rt(e.editor, t, {
|
|
4805
4813
|
behavior: "smooth",
|
|
4806
4814
|
focus: e.editable
|
|
4807
4815
|
})
|
|
4808
4816
|
}, t.text)))])]) : null;
|
|
4809
4817
|
}
|
|
4810
4818
|
});
|
|
4811
|
-
function
|
|
4812
|
-
let r = n(e.lang), a = t(r), o =
|
|
4819
|
+
function Da(e = {}) {
|
|
4820
|
+
let r = n(e.lang), a = t(r), o = G(() => yn({
|
|
4813
4821
|
lang: r,
|
|
4814
4822
|
commandGroups: e.commandGroups,
|
|
4815
4823
|
commands: e.commands,
|
|
4816
4824
|
builtinCommands: e.builtinCommands
|
|
4817
|
-
})), s =
|
|
4818
|
-
function
|
|
4819
|
-
|
|
4825
|
+
})), s = U(d(e.mode)), c = G(() => Oe(e.theme)), l = G(() => s.value === "live" && e.editable !== !1), u = U(0), p = W(null), m = U(bn), h = W(null), g = W(null), _ = U(null), v = U("code"), y = W(null), b = W(On), x = U(null), S = U(!1), C = W(null), ee = fe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), w = e.content ?? e.defaultContent ?? "", T = typeof w == "string" && w.length >= 2e5, E = null;
|
|
4826
|
+
function D() {
|
|
4827
|
+
E !== null && (window.clearTimeout(E), E = null), u.value += 1;
|
|
4820
4828
|
}
|
|
4821
|
-
function
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
},
|
|
4829
|
+
function O() {
|
|
4830
|
+
E !== null && window.clearTimeout(E), E = window.setTimeout(() => {
|
|
4831
|
+
E = null, u.value += 1;
|
|
4832
|
+
}, Te);
|
|
4825
4833
|
}
|
|
4826
|
-
let
|
|
4827
|
-
|
|
4828
|
-
extensions:
|
|
4834
|
+
let k = e.onSlashCommandUpload, A = W(null), j = !1;
|
|
4835
|
+
A.value = new i({
|
|
4836
|
+
extensions: oa({
|
|
4829
4837
|
lang: r,
|
|
4830
4838
|
linkCardResolver: e.linkCardResolver,
|
|
4831
|
-
onImageUpload: (e) =>
|
|
4832
|
-
onVideoUpload: (e) =>
|
|
4833
|
-
onAttachmentUpload: (t) => e.onSlashCommandUpload?.(t) ??
|
|
4839
|
+
onImageUpload: (e) => k?.(e) ?? B(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4840
|
+
onVideoUpload: (e) => k?.(e) ?? B(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4841
|
+
onAttachmentUpload: (t) => e.onSlashCommandUpload?.(t) ?? B(t) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4834
4842
|
onAttachmentDownload: (t, n) => e.onAttachmentDownload?.(t, n),
|
|
4835
4843
|
resolveMediaSource: e.resolveMediaSource,
|
|
4844
|
+
tableCapabilities: (t) => e.tableCapabilities?.(t),
|
|
4836
4845
|
editorExtensions: e.editorExtensions
|
|
4837
4846
|
}),
|
|
4838
|
-
content:
|
|
4839
|
-
contentType:
|
|
4847
|
+
content: w,
|
|
4848
|
+
contentType: le(ee),
|
|
4840
4849
|
editable: l.value,
|
|
4841
4850
|
autofocus: e.autofocus,
|
|
4842
4851
|
editorProps: {
|
|
4843
4852
|
attributes: {
|
|
4844
4853
|
class: "markweave-editor-surface",
|
|
4845
4854
|
"data-testid": "markweave-editor-surface",
|
|
4846
|
-
"data-markweave-large-document":
|
|
4855
|
+
"data-markweave-large-document": T ? "true" : "false",
|
|
4847
4856
|
autocapitalize: "off",
|
|
4848
4857
|
autocorrect: "off",
|
|
4849
4858
|
spellcheck: "false",
|
|
4850
4859
|
translate: "no"
|
|
4851
4860
|
},
|
|
4852
4861
|
handleClick: (e, t, n) => {
|
|
4853
|
-
if (!l.value) return
|
|
4854
|
-
let r =
|
|
4855
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
4862
|
+
if (!l.value) return be(n);
|
|
4863
|
+
let r = Kt(e, n);
|
|
4864
|
+
return r ? (n.preventDefault(), n.stopPropagation(), I(), Xt(e, r, !0), Zt(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
4856
4865
|
},
|
|
4857
4866
|
handleDOMEvents: {
|
|
4858
|
-
compositionstart: () => l.value ? (m.value =
|
|
4859
|
-
compositionend: (e) => (l.value && window.setTimeout(() =>
|
|
4867
|
+
compositionstart: () => l.value ? (m.value = xn(m.value, { type: "composition-start" }), h.value = null, !1) : !1,
|
|
4868
|
+
compositionend: (e) => (l.value && window.setTimeout(() => L(e), 0), !1),
|
|
4860
4869
|
click: (e, t) => {
|
|
4861
|
-
if (!l.value) return
|
|
4862
|
-
let n =
|
|
4863
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
4870
|
+
if (!l.value) return be(t);
|
|
4871
|
+
let n = Kt(e, t);
|
|
4872
|
+
return n ? (t.preventDefault(), t.stopPropagation(), I(), Xt(e, n, !0), Zt(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
4864
4873
|
}
|
|
4865
4874
|
}
|
|
4866
4875
|
},
|
|
4867
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
4876
|
+
onSelectionUpdate: ({ editor: e }) => z(e),
|
|
4868
4877
|
onCreate: ({ editor: t }) => {
|
|
4869
|
-
|
|
4878
|
+
vn(t, o.value, (t) => {
|
|
4870
4879
|
_.value = t.message, e.onCommandError?.(t);
|
|
4871
|
-
}),
|
|
4880
|
+
}), _n(t, ee), j = !0, e.onCommandControllerChange?.(hn(t)), f(t, {
|
|
4872
4881
|
mode: s.value,
|
|
4873
4882
|
editable: l.value
|
|
4874
|
-
}),
|
|
4883
|
+
}), $t(t, c.value), en(t, l.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && l.value && Tn(t), V(t), z(t), D();
|
|
4875
4884
|
},
|
|
4876
4885
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
4877
|
-
if (
|
|
4878
|
-
let t =
|
|
4886
|
+
if (V(e), (t.docChanged || Qt(t)) && O(), t.docChanged && y.value) {
|
|
4887
|
+
let t = Gt(e, y.value.pos);
|
|
4879
4888
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
4880
4889
|
}
|
|
4881
4890
|
},
|
|
4882
4891
|
onUpdate: ({ editor: t }) => {
|
|
4883
|
-
|
|
4884
|
-
let i =
|
|
4892
|
+
z(t), l.value && R(t), S.value || e.onUpdate?.(ce(t, { onContentRead: (n, r) => {
|
|
4893
|
+
let i = fe(e.contentFormat);
|
|
4885
4894
|
e.content !== void 0 && n === i && (C.value = {
|
|
4886
4895
|
content: r,
|
|
4887
4896
|
format: n,
|
|
@@ -4890,126 +4899,126 @@ function Ta(e = {}) {
|
|
|
4890
4899
|
} }));
|
|
4891
4900
|
}
|
|
4892
4901
|
});
|
|
4893
|
-
let
|
|
4894
|
-
|
|
4902
|
+
let te = A.value;
|
|
4903
|
+
vn(te, o.value, (t) => {
|
|
4895
4904
|
_.value = t.message, e.onCommandError?.(t);
|
|
4896
|
-
}),
|
|
4897
|
-
|
|
4905
|
+
}), _n(te, ee), K(o, (t) => {
|
|
4906
|
+
A.value && vn(A.value, t, (t) => {
|
|
4898
4907
|
_.value = t.message, e.onCommandError?.(t);
|
|
4899
4908
|
});
|
|
4900
|
-
}),
|
|
4901
|
-
|
|
4909
|
+
}), K(() => [e.content === void 0 ? e.defaultContentFormat : e.contentFormat, e.content], () => {
|
|
4910
|
+
A.value && _n(A.value, fe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat));
|
|
4902
4911
|
});
|
|
4903
|
-
let
|
|
4904
|
-
|
|
4905
|
-
|
|
4912
|
+
let M = A.value, N = ke(M), P = !1, ne = !1;
|
|
4913
|
+
J(() => {
|
|
4914
|
+
P || A.value !== M || (ne = !0, e.onAiEditControllerChange?.(N));
|
|
4906
4915
|
});
|
|
4907
|
-
let
|
|
4908
|
-
function
|
|
4909
|
-
h.value = null, g.value = null, m.value =
|
|
4916
|
+
let F = G(() => A.value ?? null);
|
|
4917
|
+
function I() {
|
|
4918
|
+
h.value = null, g.value = null, m.value = bn;
|
|
4910
4919
|
}
|
|
4911
|
-
function
|
|
4912
|
-
let t =
|
|
4920
|
+
function L(e) {
|
|
4921
|
+
let t = fn(e.state);
|
|
4913
4922
|
if (!t) {
|
|
4914
|
-
m.value = m.value.name === "idle" ? m.value :
|
|
4923
|
+
m.value = m.value.name === "idle" ? m.value : bn, h.value = null, g.value = null;
|
|
4915
4924
|
return;
|
|
4916
4925
|
}
|
|
4917
4926
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
4918
|
-
if (!
|
|
4919
|
-
|
|
4927
|
+
if (!mn(r, { frameRect: i })) {
|
|
4928
|
+
I();
|
|
4920
4929
|
return;
|
|
4921
4930
|
}
|
|
4922
|
-
let a =
|
|
4931
|
+
let a = dn(n, {
|
|
4923
4932
|
frameRect: i,
|
|
4924
4933
|
triggerRect: r
|
|
4925
4934
|
});
|
|
4926
|
-
|
|
4935
|
+
ln(h.value, a) || (h.value = a), m.value = un(m.value, t);
|
|
4927
4936
|
}
|
|
4928
|
-
function
|
|
4929
|
-
|
|
4937
|
+
function R(e) {
|
|
4938
|
+
L(e.view);
|
|
4930
4939
|
}
|
|
4931
|
-
function
|
|
4932
|
-
let t =
|
|
4933
|
-
|
|
4934
|
-
let n =
|
|
4935
|
-
n && (
|
|
4936
|
-
let r =
|
|
4940
|
+
function z(e) {
|
|
4941
|
+
let t = we(e);
|
|
4942
|
+
Se(p.value, t) || (p.value = t);
|
|
4943
|
+
let n = qt(e);
|
|
4944
|
+
n && (Yt(e, n, !0), y.value = n);
|
|
4945
|
+
let r = ot(e);
|
|
4937
4946
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
4938
4947
|
}
|
|
4939
|
-
function
|
|
4940
|
-
b.value =
|
|
4948
|
+
function V(e) {
|
|
4949
|
+
b.value = la(e);
|
|
4941
4950
|
}
|
|
4942
|
-
let
|
|
4943
|
-
active:
|
|
4951
|
+
let re = G(() => F.value ? ot(F.value) : ca), ie = G(() => F.value ? En(F.value.state) : sa), oe = G(() => p.value?.currentNode === "codeBlock"), pe = G(() => oe.value && re.value.language === "mermaid"), me = G(() => F.value ? nn({
|
|
4952
|
+
active: pe.value,
|
|
4944
4953
|
mode: v.value,
|
|
4945
|
-
source:
|
|
4946
|
-
}) :
|
|
4954
|
+
source: re.value.text
|
|
4955
|
+
}) : nn({
|
|
4947
4956
|
active: !1,
|
|
4948
4957
|
mode: "code",
|
|
4949
4958
|
source: ""
|
|
4950
|
-
})),
|
|
4959
|
+
})), he = G(() => F.value && e.onRuntimeStateChange ? wn(F.value.state) : null), ge = G(() => F.value ? Qe(F.value.state) : Ye.items), _e = G(() => $e(ge.value, x.value)), ve = G(() => Je(ge.value, _e.value)), ye = G(() => {
|
|
4951
4960
|
u.value, p.value, l.value;
|
|
4952
|
-
let e =
|
|
4953
|
-
return
|
|
4961
|
+
let e = F.value;
|
|
4962
|
+
return rn(e ? hn(e).getCommands({
|
|
4954
4963
|
surface: "slash",
|
|
4955
4964
|
query: m.value.query
|
|
4956
4965
|
}) : o.value.commands, r);
|
|
4957
|
-
}),
|
|
4966
|
+
}), Ce = G(() => xe({
|
|
4958
4967
|
revision: u.value,
|
|
4959
4968
|
mode: s.value,
|
|
4960
4969
|
editable: l.value,
|
|
4961
|
-
toc:
|
|
4970
|
+
toc: ve.value,
|
|
4962
4971
|
selection: p.value,
|
|
4963
4972
|
slash: m.value,
|
|
4964
|
-
table:
|
|
4973
|
+
table: ie.value,
|
|
4965
4974
|
tableInteraction: b.value,
|
|
4966
|
-
codeBlock:
|
|
4967
|
-
mermaid:
|
|
4968
|
-
tableDebugSnapshot:
|
|
4969
|
-
})),
|
|
4970
|
-
closeSlashMenu:
|
|
4971
|
-
focusFirstTableBodyCell: () =>
|
|
4975
|
+
codeBlock: re.value,
|
|
4976
|
+
mermaid: me.value,
|
|
4977
|
+
tableDebugSnapshot: he.value
|
|
4978
|
+
})), Ee = {
|
|
4979
|
+
closeSlashMenu: I,
|
|
4980
|
+
focusFirstTableBodyCell: () => F.value ? Tn(F.value) : !1,
|
|
4972
4981
|
setContent: (e, t = {}) => {
|
|
4973
|
-
if (!
|
|
4974
|
-
let n =
|
|
4975
|
-
return
|
|
4976
|
-
contentType:
|
|
4982
|
+
if (!F.value) return !1;
|
|
4983
|
+
let n = fe(t.format);
|
|
4984
|
+
return F.value.commands.setContent(e, {
|
|
4985
|
+
contentType: le(n),
|
|
4977
4986
|
emitUpdate: t.emitUpdate ?? !1
|
|
4978
|
-
}), t.focusFirstTableBodyCell &&
|
|
4987
|
+
}), t.focusFirstTableBodyCell && Tn(F.value), z(F.value), l.value && R(F.value), V(F.value), D(), !0;
|
|
4979
4988
|
}
|
|
4980
4989
|
};
|
|
4981
|
-
function
|
|
4982
|
-
if (!
|
|
4990
|
+
function De(e, t) {
|
|
4991
|
+
if (!F.value || !l.value || !on(e)) return;
|
|
4983
4992
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
4984
4993
|
g.value = e;
|
|
4985
4994
|
return;
|
|
4986
4995
|
}
|
|
4987
|
-
let n =
|
|
4996
|
+
let n = fn(F.value.state);
|
|
4988
4997
|
if (!n) return;
|
|
4989
|
-
_.value = null, m.value =
|
|
4990
|
-
let r =
|
|
4991
|
-
|
|
4998
|
+
_.value = null, m.value = xn(m.value, { type: "execute" }), g.value = null;
|
|
4999
|
+
let r = F.value;
|
|
5000
|
+
gn(r, e.id, n, t).then((e) => {
|
|
4992
5001
|
if (e.ok && e.outcome === "applied") {
|
|
4993
|
-
|
|
5002
|
+
I();
|
|
4994
5003
|
return;
|
|
4995
5004
|
}
|
|
4996
|
-
e.ok || (_.value = e.message),
|
|
5005
|
+
e.ok || (_.value = e.message), R(r), r.commands.focus();
|
|
4997
5006
|
});
|
|
4998
5007
|
}
|
|
4999
|
-
function
|
|
5000
|
-
if (!
|
|
5008
|
+
function Ae(e) {
|
|
5009
|
+
if (!F.value || g.value || !l.value) return;
|
|
5001
5010
|
if (m.value.name === "executing" && e.key === "Escape") {
|
|
5002
|
-
e.preventDefault(),
|
|
5011
|
+
e.preventDefault(), hn(F.value).cancel(), I();
|
|
5003
5012
|
return;
|
|
5004
5013
|
}
|
|
5005
|
-
let t =
|
|
5014
|
+
let t = sn(m.value, ye.value, e.key, { isComposing: e.isComposing || ae(F.value.state) });
|
|
5006
5015
|
if (t.type !== "ignore") {
|
|
5007
5016
|
if (e.preventDefault(), t.type === "close") {
|
|
5008
|
-
|
|
5017
|
+
hn(F.value).cancel(), m.value = xn(m.value, { type: "escape" }), I();
|
|
5009
5018
|
return;
|
|
5010
5019
|
}
|
|
5011
5020
|
if (t.type === "move-active") {
|
|
5012
|
-
m.value =
|
|
5021
|
+
m.value = xn(m.value, {
|
|
5013
5022
|
type: "move-active",
|
|
5014
5023
|
delta: t.delta,
|
|
5015
5024
|
optionCount: t.optionCount
|
|
@@ -5017,102 +5026,102 @@ function Ta(e = {}) {
|
|
|
5017
5026
|
return;
|
|
5018
5027
|
}
|
|
5019
5028
|
if (t.type === "set-active") {
|
|
5020
|
-
m.value =
|
|
5029
|
+
m.value = xn(m.value, t);
|
|
5021
5030
|
return;
|
|
5022
5031
|
}
|
|
5023
|
-
|
|
5032
|
+
De(t.command);
|
|
5024
5033
|
}
|
|
5025
5034
|
}
|
|
5026
|
-
|
|
5027
|
-
s.value = d(e.mode),
|
|
5035
|
+
K(() => [e.mode, e.editable], () => {
|
|
5036
|
+
s.value = d(e.mode), F.value && (F.value.setEditable(l.value), f(F.value, {
|
|
5028
5037
|
mode: s.value,
|
|
5029
5038
|
editable: l.value
|
|
5030
|
-
}),
|
|
5031
|
-
}, { immediate: !0 }),
|
|
5032
|
-
|
|
5033
|
-
}, { immediate: !0 }),
|
|
5034
|
-
let n =
|
|
5035
|
-
if (!(!
|
|
5036
|
-
if (
|
|
5039
|
+
}), en(F.value, l.value ? "live" : "view"), D(), l.value || I());
|
|
5040
|
+
}, { immediate: !0 }), K(() => e.theme, () => {
|
|
5041
|
+
F.value && $t(F.value, c.value);
|
|
5042
|
+
}, { immediate: !0 }), K(() => e.content, (t) => {
|
|
5043
|
+
let n = fe(e.contentFormat);
|
|
5044
|
+
if (!(!F.value || t === void 0)) {
|
|
5045
|
+
if (de(F.value, C.value, t, n)) {
|
|
5037
5046
|
C.value = null;
|
|
5038
5047
|
return;
|
|
5039
5048
|
}
|
|
5040
|
-
C.value = null, !
|
|
5041
|
-
contentType:
|
|
5049
|
+
C.value = null, !ue(F.value, t, n) && (S.value = !0, F.value.commands.setContent(t, {
|
|
5050
|
+
contentType: le(n),
|
|
5042
5051
|
emitUpdate: !1
|
|
5043
|
-
}), S.value = !1,
|
|
5052
|
+
}), S.value = !1, z(F.value), l.value && R(F.value), V(F.value), D());
|
|
5044
5053
|
}
|
|
5045
|
-
}),
|
|
5046
|
-
let t =
|
|
5054
|
+
}), K(Ce, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(ve, (t) => e.onTocChange?.(t), { immediate: !0 }), K(ge, (e) => {
|
|
5055
|
+
let t = $e(e, x.value);
|
|
5047
5056
|
x.value !== t && (x.value = t);
|
|
5048
5057
|
});
|
|
5049
|
-
let
|
|
5050
|
-
|
|
5051
|
-
}),
|
|
5052
|
-
e?.type === "scroll" &&
|
|
5058
|
+
let je = se(() => {
|
|
5059
|
+
F.value && h.value && L(F.value.view);
|
|
5060
|
+
}), Me = (e) => {
|
|
5061
|
+
e?.type === "scroll" && pn(e.target) || h.value && je.schedule();
|
|
5053
5062
|
};
|
|
5054
|
-
|
|
5055
|
-
e ?
|
|
5056
|
-
}),
|
|
5057
|
-
window.addEventListener("resize",
|
|
5058
|
-
}),
|
|
5059
|
-
|
|
5063
|
+
K(h, (e) => {
|
|
5064
|
+
e ? Me() : je.cancel();
|
|
5065
|
+
}), vr(() => {
|
|
5066
|
+
window.addEventListener("resize", Me), window.addEventListener("scroll", Me, !0);
|
|
5067
|
+
}), q(() => {
|
|
5068
|
+
je.cancel(), window.removeEventListener("resize", Me), window.removeEventListener("scroll", Me, !0);
|
|
5060
5069
|
});
|
|
5061
|
-
let
|
|
5062
|
-
return
|
|
5063
|
-
|
|
5064
|
-
}),
|
|
5070
|
+
let Ne = null;
|
|
5071
|
+
return q(() => {
|
|
5072
|
+
E !== null && window.clearTimeout(E);
|
|
5073
|
+
}), vr(() => {
|
|
5065
5074
|
let e = () => {
|
|
5066
|
-
if (!
|
|
5075
|
+
if (!F.value || !ge.value.length) {
|
|
5067
5076
|
x.value = null;
|
|
5068
5077
|
return;
|
|
5069
5078
|
}
|
|
5070
5079
|
let e = null;
|
|
5071
5080
|
try {
|
|
5072
|
-
e =
|
|
5081
|
+
e = Xe(F.value, ge.value);
|
|
5073
5082
|
} catch {
|
|
5074
5083
|
return;
|
|
5075
5084
|
}
|
|
5076
5085
|
x.value !== e && (x.value = e);
|
|
5077
|
-
}, t = () => window.requestAnimationFrame(e), n =
|
|
5078
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
5086
|
+
}, t = () => window.requestAnimationFrame(e), n = ua(F.value?.view.dom ?? null);
|
|
5087
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Ne = () => {
|
|
5079
5088
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
5080
5089
|
};
|
|
5081
|
-
}),
|
|
5082
|
-
|
|
5083
|
-
let t =
|
|
5084
|
-
|
|
5090
|
+
}), q(() => {
|
|
5091
|
+
Ne?.(), P = !0, ne && e.onAiEditControllerChange?.(null), j && e.onCommandControllerChange?.(null);
|
|
5092
|
+
let t = A.value;
|
|
5093
|
+
A.value = null, J(() => t?.destroy());
|
|
5085
5094
|
}), {
|
|
5086
|
-
editor:
|
|
5087
|
-
runtimeSnapshot:
|
|
5088
|
-
actions:
|
|
5095
|
+
editor: F,
|
|
5096
|
+
runtimeSnapshot: Ce,
|
|
5097
|
+
actions: Ee,
|
|
5089
5098
|
__render: {
|
|
5090
5099
|
messages: a,
|
|
5091
5100
|
effectiveEditable: l,
|
|
5092
|
-
tableFocusState:
|
|
5101
|
+
tableFocusState: ie,
|
|
5093
5102
|
tableInteractionState: b,
|
|
5094
|
-
codeBlockState:
|
|
5095
|
-
isCodeBlockActive:
|
|
5103
|
+
codeBlockState: re,
|
|
5104
|
+
isCodeBlockActive: oe,
|
|
5096
5105
|
mermaidMode: v,
|
|
5097
5106
|
mathTarget: y,
|
|
5098
5107
|
setMermaidMode: (e) => {
|
|
5099
5108
|
v.value = e;
|
|
5100
5109
|
},
|
|
5101
|
-
tocState:
|
|
5102
|
-
filteredSlashCommands:
|
|
5110
|
+
tocState: ve,
|
|
5111
|
+
filteredSlashCommands: ye,
|
|
5103
5112
|
slashState: m,
|
|
5104
5113
|
slashMenuPosition: h,
|
|
5105
5114
|
slashInputCommand: g,
|
|
5106
5115
|
slashCommandError: _,
|
|
5107
|
-
runSlashCommand:
|
|
5108
|
-
handleEditorKeyDown:
|
|
5116
|
+
runSlashCommand: De,
|
|
5117
|
+
handleEditorKeyDown: Ae,
|
|
5109
5118
|
setSlashInputCommand: (e) => {
|
|
5110
5119
|
g.value = e;
|
|
5111
5120
|
}
|
|
5112
5121
|
}
|
|
5113
5122
|
};
|
|
5114
5123
|
}
|
|
5115
|
-
var
|
|
5124
|
+
var Oa = Y({
|
|
5116
5125
|
name: "MarkweaveEditor",
|
|
5117
5126
|
props: {
|
|
5118
5127
|
defaultContent: {
|
|
@@ -5219,6 +5228,10 @@ var Ea = X({
|
|
|
5219
5228
|
type: Function,
|
|
5220
5229
|
default: void 0
|
|
5221
5230
|
},
|
|
5231
|
+
tableCapabilities: {
|
|
5232
|
+
type: Function,
|
|
5233
|
+
default: void 0
|
|
5234
|
+
},
|
|
5222
5235
|
onRuntimeStateChange: {
|
|
5223
5236
|
type: Function,
|
|
5224
5237
|
default: void 0
|
|
@@ -5257,12 +5270,12 @@ var Ea = X({
|
|
|
5257
5270
|
}
|
|
5258
5271
|
},
|
|
5259
5272
|
setup(e) {
|
|
5260
|
-
let t =
|
|
5273
|
+
let t = Da(e);
|
|
5261
5274
|
return () => {
|
|
5262
5275
|
let r = t.editor.value;
|
|
5263
5276
|
if (!r) return null;
|
|
5264
|
-
let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s =
|
|
5265
|
-
return
|
|
5277
|
+
let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = De(e.canvasColor);
|
|
5278
|
+
return H("section", {
|
|
5266
5279
|
class: o,
|
|
5267
5280
|
role: "combobox",
|
|
5268
5281
|
"aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
|
|
@@ -5272,21 +5285,21 @@ var Ea = X({
|
|
|
5272
5285
|
"aria-busy": i.slashState.value.name === "executing",
|
|
5273
5286
|
"data-testid": "markweave-editor-frame",
|
|
5274
5287
|
"data-markweave-mode": t.runtimeSnapshot.value.mode,
|
|
5275
|
-
"data-markweave-theme":
|
|
5288
|
+
"data-markweave-theme": Oe(e.theme),
|
|
5276
5289
|
style: s ? { "--markweave-canvas": s } : void 0,
|
|
5277
5290
|
"data-markweave-inner-toc": e.innerToc ? "true" : "false",
|
|
5278
|
-
"data-markweave-inner-toc-placement":
|
|
5291
|
+
"data-markweave-inner-toc-placement": et(e.innerTocPlacement),
|
|
5279
5292
|
"data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
|
|
5280
5293
|
"data-table-focus-mode": i.tableFocusState.value.mode,
|
|
5281
5294
|
onKeydownCapture: i.handleEditorKeyDown
|
|
5282
5295
|
}, [
|
|
5283
|
-
i.effectiveEditable.value ?
|
|
5296
|
+
i.effectiveEditable.value ? H(va, {
|
|
5284
5297
|
editor: r,
|
|
5285
5298
|
lang: n(e.lang),
|
|
5286
5299
|
messages: i.messages,
|
|
5287
5300
|
askAi: e.askAi
|
|
5288
5301
|
}) : null,
|
|
5289
|
-
i.effectiveEditable.value ?
|
|
5302
|
+
i.effectiveEditable.value ? H(ba, {
|
|
5290
5303
|
commands: i.filteredSlashCommands.value,
|
|
5291
5304
|
state: i.slashState.value,
|
|
5292
5305
|
position: i.slashMenuPosition.value,
|
|
@@ -5297,7 +5310,7 @@ var Ea = X({
|
|
|
5297
5310
|
onInputCommandChange: i.setSlashInputCommand,
|
|
5298
5311
|
onUpload: e.onSlashCommandUpload
|
|
5299
5312
|
}) : null,
|
|
5300
|
-
i.effectiveEditable.value ?
|
|
5313
|
+
i.effectiveEditable.value ? H(Ca, {
|
|
5301
5314
|
editor: r,
|
|
5302
5315
|
active: i.tableFocusState.value.active,
|
|
5303
5316
|
interactionState: i.tableInteractionState.value,
|
|
@@ -5307,11 +5320,11 @@ var Ea = X({
|
|
|
5307
5320
|
onCommandResult: e.onTableCommandResult,
|
|
5308
5321
|
onEditWithAi: e.onEditWithAi
|
|
5309
5322
|
}) : null,
|
|
5310
|
-
i.effectiveEditable.value ?
|
|
5323
|
+
i.effectiveEditable.value ? H(wa, {
|
|
5311
5324
|
editor: r,
|
|
5312
5325
|
focusState: i.tableFocusState.value
|
|
5313
5326
|
}) : null,
|
|
5314
|
-
|
|
5327
|
+
H(Ta, {
|
|
5315
5328
|
editor: r,
|
|
5316
5329
|
state: i.codeBlockState.value,
|
|
5317
5330
|
active: i.effectiveEditable.value && i.isCodeBlockActive.value,
|
|
@@ -5319,23 +5332,23 @@ var Ea = X({
|
|
|
5319
5332
|
onMermaidModeChange: i.setMermaidMode,
|
|
5320
5333
|
readOnly: !i.effectiveEditable.value
|
|
5321
5334
|
}),
|
|
5322
|
-
e.innerToc && i.tocState.value.items.length ?
|
|
5335
|
+
e.innerToc && i.tocState.value.items.length ? H(Ea, {
|
|
5323
5336
|
editor: r,
|
|
5324
5337
|
state: i.tocState.value,
|
|
5325
5338
|
messages: i.messages,
|
|
5326
5339
|
editable: i.effectiveEditable.value,
|
|
5327
|
-
placement:
|
|
5340
|
+
placement: et(e.innerTocPlacement)
|
|
5328
5341
|
}) : null,
|
|
5329
|
-
i.effectiveEditable.value && i.mathTarget.value ?
|
|
5342
|
+
i.effectiveEditable.value && i.mathTarget.value ? H(ya, {
|
|
5330
5343
|
editor: r,
|
|
5331
5344
|
messages: i.messages,
|
|
5332
5345
|
target: i.mathTarget.value,
|
|
5333
5346
|
onClose: () => i.mathTarget.value = null
|
|
5334
5347
|
}) : null,
|
|
5335
|
-
|
|
5348
|
+
H(a, { editor: r })
|
|
5336
5349
|
]);
|
|
5337
5350
|
};
|
|
5338
5351
|
}
|
|
5339
5352
|
});
|
|
5340
5353
|
//#endregion
|
|
5341
|
-
export {
|
|
5354
|
+
export { Oa as MarkweaveEditor, re as createMarkweaveAiEditController, oa as createMarkweaveEditorExtensions, oa as createMarkweaveVue2EditorExtensions, Da as useMarkweaveEditorController };
|