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