@markweave/vue2 0.3.7 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +388 -381
- package/dist/types/MarkweaveEditor.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10,14 +10,14 @@ import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as
|
|
|
10
10
|
import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
|
|
11
11
|
import { createMarkweaveLightweightImageNodeViewRenderer as x } from "markweave/internal/plugins/media/lightweight-image-node-view";
|
|
12
12
|
import { resolveMarkweaveMediaSource as S } from "markweave/internal/plugins/media/media-source";
|
|
13
|
-
import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as j, markweaveVideoIframeAllow as M, normalizeMarkweaveCoreImageAlign as
|
|
14
|
-
import { detectUploadSource as
|
|
15
|
-
import { createMarkweaveAiEditController as
|
|
16
|
-
import { BubbleMenu as
|
|
17
|
-
import { isEditorComposing as
|
|
18
|
-
import { saveMarkweaveBrowserFile as
|
|
19
|
-
import { createMarkweaveFrameScheduler as
|
|
20
|
-
import { createMarkweaveEditorUpdatePayload as
|
|
13
|
+
import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as j, markweaveVideoIframeAllow as M, normalizeMarkweaveCoreImageAlign as ee, normalizeMarkweaveVideoEmbedUrl as N, numberAttribute as P, stringAttribute as F } from "markweave/internal/plugins/media/core-media-nodes";
|
|
14
|
+
import { detectUploadSource as I, getDirectUploadResult as L, resolveMarkweaveUploadResult as te } from "markweave/internal/plugins/slash-command/upload";
|
|
15
|
+
import { createMarkweaveAiEditController as R } from "markweave";
|
|
16
|
+
import { BubbleMenu as z } from "@tiptap/vue-2/menus";
|
|
17
|
+
import { isEditorComposing as ne } from "markweave/internal/editor-core/composition-guard";
|
|
18
|
+
import { saveMarkweaveBrowserFile as re } from "markweave/internal/core/browser-file-save";
|
|
19
|
+
import { createMarkweaveFrameScheduler as B } from "markweave/internal/editor-core/frame-scheduler";
|
|
20
|
+
import { createMarkweaveEditorUpdatePayload as ie, getMarkweaveContentType as ae, isEditorContentCurrent as oe, isMarkweaveControlledContentEchoCurrent as se, normalizeMarkweaveContentFormat as V } from "markweave/internal/editor-core/editor-content";
|
|
21
21
|
import { getCurrentFloatingToolbarBlockType as ce, getFloatingToolbarHighlightColorOptions as le, getFloatingToolbarMoreActions as ue, getFloatingToolbarTextColorOptions as de, getFloatingToolbarTurnIntoOptions as fe, runFloatingToolbarMoreAction as pe, setFloatingToolbarTurnInto as me } from "markweave/internal/editor-core/floating-toolbar-model";
|
|
22
22
|
import { openMarkweaveReadonlyLinkFromEvent as he } from "markweave/internal/editor-core/readonly-link";
|
|
23
23
|
import { createMarkweaveEditorRuntimeSnapshot as ge } from "markweave/internal/editor-core/runtime-snapshot";
|
|
@@ -1536,7 +1536,7 @@ function X(e) {
|
|
|
1536
1536
|
}
|
|
1537
1537
|
});
|
|
1538
1538
|
}
|
|
1539
|
-
var ar = X("AlignCenter"), or = X("AlignJustify"), sr = X("AlignLeft"), cr = X("AlignRight"), lr = X("AlignVerticalJustifyCenter"), ur = X("AlignVerticalJustifyEnd"), dr = X("AlignVerticalJustifyStart"), fr = X("AlertTriangle"), pr = X("ArrowDown"), mr = X("ArrowDownAZ"), hr = X("ArrowLeft"), gr = X("ArrowRight"), _r = X("ArrowUp"), vr = X("ArrowUpZA"), yr = X("BetweenHorizontalEnd"), br = X("BetweenHorizontalStart"), xr = X("BetweenVerticalEnd"), Sr = X("BetweenVerticalStart"), Cr = X("Bold"), wr = X("Braces"), Tr = X("Captions"), Er = X("Check"), Dr = X("CheckCircle2"), Or = X("ChevronDown"), kr = X("ChevronRight"), Ar = X("ChevronUp"), jr = X("CircleX"), Mr = X("Code2"), Nr = X("CornerDownLeft"), Pr = X("Copy"), Fr = X("Download"), Ir = X("Eye"), Lr = X("ExternalLink"), Rr = X("Heading1"), zr = X("Heading2"), Br = X("Heading3"), Vr = X("Image"), Hr = X("ImageUp"), Ur = X("IndentDecrease"), Wr = X("IndentIncrease"), Gr = X("Info"), Kr = X("Italic"), qr = X("Lightbulb"), Jr = X("Link2"), Yr = X("List"), Xr = X("ListChecks"), Zr = X("ListOrdered"), Qr = X("Minus"), $r = X("MoreVertical"), ei = X("PaintBucket"), ti = X("Paperclip"), ni = X("PencilLine"), ri = X("Plus"), ii = X("Quote"), ai = X("Replace"), oi = X("RotateCcw"), si = X("Sigma"), ci = X("SmilePlus"), li = X("Sparkles"), ui = X("Square"), di = X("SquareX"), fi = X("Strikethrough"), pi = X("Subscript"), mi = X("Superscript"), hi = X("Table2"), gi = X("TableCellsMerge"), _i = X("TableCellsSplit"), vi = X("Text"), yi = X("Trash2"), bi = X("Type"), xi = X("Underline"), Si = X("Upload"), Ci = X("Video"), wi = X("X"), Ti =
|
|
1539
|
+
var ar = X("AlignCenter"), or = X("AlignJustify"), sr = X("AlignLeft"), cr = X("AlignRight"), lr = X("AlignVerticalJustifyCenter"), ur = X("AlignVerticalJustifyEnd"), dr = X("AlignVerticalJustifyStart"), fr = X("AlertTriangle"), pr = X("ArrowDown"), mr = X("ArrowDownAZ"), hr = X("ArrowLeft"), gr = X("ArrowRight"), _r = X("ArrowUp"), vr = X("ArrowUpZA"), yr = X("BetweenHorizontalEnd"), br = X("BetweenHorizontalStart"), xr = X("BetweenVerticalEnd"), Sr = X("BetweenVerticalStart"), Cr = X("Bold"), wr = X("Braces"), Tr = X("Captions"), Er = X("Check"), Dr = X("CheckCircle2"), Or = X("ChevronDown"), kr = X("ChevronRight"), Ar = X("ChevronUp"), jr = X("CircleX"), Mr = X("Code2"), Nr = X("CornerDownLeft"), Pr = X("Copy"), Fr = X("Download"), Ir = X("Eye"), Lr = X("ExternalLink"), Rr = X("Heading1"), zr = X("Heading2"), Br = X("Heading3"), Vr = X("Image"), Hr = X("ImageUp"), Ur = X("IndentDecrease"), Wr = X("IndentIncrease"), Gr = X("Info"), Kr = X("Italic"), qr = X("Lightbulb"), Jr = X("Link2"), Yr = X("List"), Xr = X("ListChecks"), Zr = X("ListOrdered"), Qr = X("Minus"), $r = X("MoreVertical"), ei = X("PaintBucket"), ti = X("Paperclip"), ni = X("PencilLine"), ri = X("Plus"), ii = X("Quote"), ai = X("Replace"), oi = X("RotateCcw"), si = X("Sigma"), ci = X("SmilePlus"), li = X("Sparkles"), ui = X("Square"), di = X("SquareX"), fi = X("Strikethrough"), pi = X("Subscript"), mi = X("Superscript"), hi = X("Table2"), gi = X("TableCellsMerge"), _i = X("TableCellsSplit"), vi = X("Text"), yi = X("Trash2"), bi = X("Type"), xi = X("Underline"), Si = X("Upload"), Ci = X("Video"), wi = X("X"), Ti = ee;
|
|
1540
1540
|
function Ei(e) {
|
|
1541
1541
|
let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
|
|
1542
1542
|
let n = t?.getAttribute("data-markweave-mode");
|
|
@@ -1772,7 +1772,7 @@ var Pi = Y({
|
|
|
1772
1772
|
}
|
|
1773
1773
|
},
|
|
1774
1774
|
setup(e) {
|
|
1775
|
-
let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!
|
|
1775
|
+
let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!F(u.value.caption)), p = U(F(u.value.caption) ?? ""), m = Ei(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => F(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
|
|
1776
1776
|
K(v, (t) => {
|
|
1777
1777
|
if (C?.abort(), C = null, !t) {
|
|
1778
1778
|
x.value = null;
|
|
@@ -1793,10 +1793,10 @@ var Pi = Y({
|
|
|
1793
1793
|
r.signal.aborted || (x.value = e);
|
|
1794
1794
|
});
|
|
1795
1795
|
}, { immediate: !0 }), q(() => C?.abort());
|
|
1796
|
-
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => Ti(u.value.align)), D = G(() =>
|
|
1796
|
+
let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => Ti(u.value.align)), D = G(() => P(u.value.width)), A = G(() => F(u.value.caption)), M = G(() => h.value && (!v.value || i.value)), ee = () => {
|
|
1797
1797
|
w.value && b({
|
|
1798
1798
|
src: w.value,
|
|
1799
|
-
alt:
|
|
1799
|
+
alt: F(u.value.alt) ?? "",
|
|
1800
1800
|
messages: {
|
|
1801
1801
|
dialogAriaLabel: _.value.previewDialogAriaLabel,
|
|
1802
1802
|
zoomOut: _.value.previewZoomOut,
|
|
@@ -1809,45 +1809,45 @@ var Pi = Y({
|
|
|
1809
1809
|
K(A, (e) => {
|
|
1810
1810
|
f.value || (p.value = e ?? "");
|
|
1811
1811
|
});
|
|
1812
|
-
let
|
|
1812
|
+
let N = () => {
|
|
1813
1813
|
if (!h.value) return;
|
|
1814
1814
|
let t = e.getPos();
|
|
1815
1815
|
typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
|
|
1816
|
-
},
|
|
1816
|
+
}, L = () => {
|
|
1817
1817
|
if (o.value = "", c.value = null, a.value = !1, v.value) {
|
|
1818
1818
|
i.value = !1;
|
|
1819
1819
|
return;
|
|
1820
1820
|
}
|
|
1821
1821
|
e.deleteNode();
|
|
1822
|
-
},
|
|
1822
|
+
}, R = async (t) => {
|
|
1823
1823
|
if (!h.value) return;
|
|
1824
1824
|
let n = e.extension.options;
|
|
1825
1825
|
l.value = !0, c.value = null;
|
|
1826
1826
|
try {
|
|
1827
|
-
let r = await
|
|
1827
|
+
let r = await te(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
|
|
1828
1828
|
e.updateAttributes(T(u.value, r)), o.value = "", i.value = !1;
|
|
1829
1829
|
} catch (e) {
|
|
1830
1830
|
c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
|
|
1831
1831
|
} finally {
|
|
1832
1832
|
l.value = !1, a.value = !1;
|
|
1833
1833
|
}
|
|
1834
|
-
},
|
|
1834
|
+
}, z = () => {
|
|
1835
1835
|
if (!o.value.trim()) {
|
|
1836
1836
|
c.value = _.value.uploadRequiredError;
|
|
1837
1837
|
return;
|
|
1838
1838
|
}
|
|
1839
|
-
|
|
1840
|
-
},
|
|
1841
|
-
|
|
1839
|
+
R(I(o.value));
|
|
1840
|
+
}, ne = (e) => {
|
|
1841
|
+
R({
|
|
1842
1842
|
type: "file",
|
|
1843
1843
|
file: e,
|
|
1844
1844
|
mimeType: e.type || "image/*"
|
|
1845
1845
|
});
|
|
1846
|
-
},
|
|
1846
|
+
}, re = () => {
|
|
1847
1847
|
f.value = !f.value, f.value && (p.value = A.value ?? "");
|
|
1848
|
-
},
|
|
1848
|
+
}, B = (n, r) => {
|
|
1849
1849
|
if (!h.value || !v.value) return;
|
|
1850
|
-
r.preventDefault(), r.stopPropagation(),
|
|
1850
|
+
r.preventDefault(), r.stopPropagation(), N();
|
|
1851
1851
|
let i = t.value;
|
|
1852
1852
|
if (!i) return;
|
|
1853
1853
|
let a = r.clientX, o = i.getBoundingClientRect().width || D.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
|
|
@@ -1875,9 +1875,9 @@ var Pi = Y({
|
|
|
1875
1875
|
onInputValue: (e) => {
|
|
1876
1876
|
o.value = e;
|
|
1877
1877
|
},
|
|
1878
|
-
onFile:
|
|
1879
|
-
onSubmit:
|
|
1880
|
-
onCancel:
|
|
1878
|
+
onFile: ne,
|
|
1879
|
+
onSubmit: z,
|
|
1880
|
+
onCancel: L,
|
|
1881
1881
|
onDragActive: (e) => {
|
|
1882
1882
|
a.value = e;
|
|
1883
1883
|
}
|
|
@@ -1896,7 +1896,7 @@ var Pi = Y({
|
|
|
1896
1896
|
r.value = !1;
|
|
1897
1897
|
},
|
|
1898
1898
|
onMousedown: (e) => {
|
|
1899
|
-
h.value && !Di(e.target) &&
|
|
1899
|
+
h.value && !Di(e.target) && N();
|
|
1900
1900
|
}
|
|
1901
1901
|
}, () => [
|
|
1902
1902
|
h.value ? H("div", {
|
|
@@ -1935,13 +1935,13 @@ var Pi = Y({
|
|
|
1935
1935
|
label: _.value.caption,
|
|
1936
1936
|
icon: Tr,
|
|
1937
1937
|
active: f.value || !!A.value,
|
|
1938
|
-
onClick:
|
|
1938
|
+
onClick: re
|
|
1939
1939
|
}),
|
|
1940
1940
|
ji({
|
|
1941
1941
|
testId: "markweave-image-preview",
|
|
1942
1942
|
label: _.value.preview,
|
|
1943
1943
|
icon: Ir,
|
|
1944
|
-
onClick:
|
|
1944
|
+
onClick: ee
|
|
1945
1945
|
}),
|
|
1946
1946
|
ji({
|
|
1947
1947
|
testId: "markweave-image-download",
|
|
@@ -1981,8 +1981,8 @@ var Pi = Y({
|
|
|
1981
1981
|
w.value ? H("img", {
|
|
1982
1982
|
class: "markweave-image",
|
|
1983
1983
|
src: w.value,
|
|
1984
|
-
alt:
|
|
1985
|
-
title:
|
|
1984
|
+
alt: F(u.value.alt) ?? "",
|
|
1985
|
+
title: F(u.value.title) ?? void 0,
|
|
1986
1986
|
draggable: !1,
|
|
1987
1987
|
loading: "lazy",
|
|
1988
1988
|
decoding: "async",
|
|
@@ -2001,7 +2001,7 @@ var Pi = Y({
|
|
|
2001
2001
|
"aria-label": _.value.preview,
|
|
2002
2002
|
title: _.value.preview,
|
|
2003
2003
|
onMousedown: (e) => e.preventDefault(),
|
|
2004
|
-
onClick:
|
|
2004
|
+
onClick: ee
|
|
2005
2005
|
}, [H(Ir, {
|
|
2006
2006
|
size: 16,
|
|
2007
2007
|
strokeWidth: 1.8
|
|
@@ -2016,7 +2016,7 @@ var Pi = Y({
|
|
|
2016
2016
|
"data-side": "left",
|
|
2017
2017
|
"aria-label": _.value.resizeLeft,
|
|
2018
2018
|
"data-markweave-image-ui": "true",
|
|
2019
|
-
onPointerdown: (e) =>
|
|
2019
|
+
onPointerdown: (e) => B("left", e)
|
|
2020
2020
|
}) : null,
|
|
2021
2021
|
h.value ? H("button", {
|
|
2022
2022
|
type: "button",
|
|
@@ -2025,7 +2025,7 @@ var Pi = Y({
|
|
|
2025
2025
|
"data-side": "right",
|
|
2026
2026
|
"aria-label": _.value.resizeRight,
|
|
2027
2027
|
"data-markweave-image-ui": "true",
|
|
2028
|
-
onPointerdown: (e) =>
|
|
2028
|
+
onPointerdown: (e) => B("right", e)
|
|
2029
2029
|
}) : null
|
|
2030
2030
|
]),
|
|
2031
2031
|
h.value && (f.value || A.value) ? H("input", {
|
|
@@ -2080,14 +2080,14 @@ var Pi = Y({
|
|
|
2080
2080
|
}
|
|
2081
2081
|
},
|
|
2082
2082
|
setup(e) {
|
|
2083
|
-
let t = U(!1), r = U(""), i = U(null), a = U(!1), o = Ei(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() =>
|
|
2083
|
+
let t = U(!1), r = U(""), i = U(null), a = U(!1), o = Ei(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => F(f.value.src)), m = G(() => F(f.value.embedUrl)), h = G(() => F(f.value.provider)), g = G(() => m.value ? N(m.value, h.value) : null), _ = G(() => F(f.value.mimeType)), v = G(() => F(f.value.title)), y = () => {
|
|
2084
2084
|
p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
|
|
2085
2085
|
}, b = async (n) => {
|
|
2086
2086
|
if (!c.value) return;
|
|
2087
2087
|
let o = e.extension.options;
|
|
2088
2088
|
a.value = !0, i.value = null;
|
|
2089
2089
|
try {
|
|
2090
|
-
let t = await
|
|
2090
|
+
let t = await te(A(n), o?.onUpload);
|
|
2091
2091
|
e.updateAttributes(E(t)), r.value = "";
|
|
2092
2092
|
} catch (e) {
|
|
2093
2093
|
i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
|
|
@@ -2204,7 +2204,7 @@ var Pi = Y({
|
|
|
2204
2204
|
onUpload: this.options.onUpload,
|
|
2205
2205
|
resolveMediaSource: t
|
|
2206
2206
|
});
|
|
2207
|
-
return (t) =>
|
|
2207
|
+
return (t) => F(t.node.attrs.src) ? r(t) : e(t);
|
|
2208
2208
|
}
|
|
2209
2209
|
}), Li = w.extend({
|
|
2210
2210
|
addOptions() {
|
|
@@ -2623,7 +2623,7 @@ var Qi = Y({
|
|
|
2623
2623
|
e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), p.value = "", t.value = null;
|
|
2624
2624
|
}, O = (n) => {
|
|
2625
2625
|
t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
|
|
2626
|
-
}, k =
|
|
2626
|
+
}, k = B(() => {
|
|
2627
2627
|
ze(e.editor, d), a.value = d;
|
|
2628
2628
|
}), A = (n = !0) => {
|
|
2629
2629
|
c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && Le(e.editor), Ae(e.editor), t.value = null, n && e.editor.commands.focus();
|
|
@@ -2661,13 +2661,13 @@ var Qi = Y({
|
|
|
2661
2661
|
}
|
|
2662
2662
|
ke(e.editor), o.value = t instanceof Te ? 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";
|
|
2663
2663
|
}
|
|
2664
|
-
},
|
|
2664
|
+
}, ee = () => {
|
|
2665
2665
|
if (!Ee(e.editor, a.value)) {
|
|
2666
2666
|
n.value = Pe(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
|
|
2667
2667
|
return;
|
|
2668
2668
|
}
|
|
2669
2669
|
t.value = null, window.setTimeout(() => Ae(e.editor), 560), e.editor.commands.focus();
|
|
2670
|
-
},
|
|
2670
|
+
}, N = B(() => {
|
|
2671
2671
|
let n = _.value, r = y.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
|
|
2672
2672
|
if (!t.value || !n || !r) return;
|
|
2673
2673
|
if (t.value === "ask-ai") {
|
|
@@ -2703,14 +2703,14 @@ var Qi = Y({
|
|
|
2703
2703
|
gap: t.value === "more" ? 8 : 6
|
|
2704
2704
|
});
|
|
2705
2705
|
g.value = a.placement;
|
|
2706
|
-
}),
|
|
2706
|
+
}), P = () => {
|
|
2707
2707
|
let l = Pe(e.editor);
|
|
2708
2708
|
if (l?.target.kind === "table" && l.status === "target" && t.value !== "ask-ai") {
|
|
2709
2709
|
s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus());
|
|
2710
2710
|
return;
|
|
2711
2711
|
}
|
|
2712
2712
|
t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(), k.cancel(), n.value = "conflict");
|
|
2713
|
-
},
|
|
2713
|
+
}, F = (e) => {
|
|
2714
2714
|
e.key !== "Escape" || t.value !== "ask-ai" || (e.preventDefault(), n.value === "generating" ? (c.value?.abort(), k.cancel(), n.value = "input") : A(!0));
|
|
2715
2715
|
};
|
|
2716
2716
|
K(() => [
|
|
@@ -2719,20 +2719,20 @@ var Qi = Y({
|
|
|
2719
2719
|
a.value,
|
|
2720
2720
|
o.value
|
|
2721
2721
|
], ([e]) => {
|
|
2722
|
-
e && J(
|
|
2722
|
+
e && J(N.schedule);
|
|
2723
2723
|
}), nr(() => {
|
|
2724
|
-
window.addEventListener("resize",
|
|
2724
|
+
window.addEventListener("resize", N.schedule), window.addEventListener("scroll", N.schedule, !0), e.editor.on("transaction", P), document.addEventListener("keydown", F, !0);
|
|
2725
2725
|
}), q(() => {
|
|
2726
|
-
|
|
2726
|
+
N.cancel(), k.cancel(), window.removeEventListener("resize", N.schedule), window.removeEventListener("scroll", N.schedule, !0), e.editor.off("transaction", P), document.removeEventListener("keydown", F, !0), c.value?.abort(), Ae(e.editor);
|
|
2727
2727
|
});
|
|
2728
|
-
let
|
|
2728
|
+
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) => {
|
|
2729
2729
|
if (m.value = e, !e || !(t instanceof HTMLElement) || !v.value) {
|
|
2730
2730
|
h.value = null;
|
|
2731
2731
|
return;
|
|
2732
2732
|
}
|
|
2733
2733
|
let n = t.getBoundingClientRect(), r = v.value.getBoundingClientRect();
|
|
2734
2734
|
h.value = n.left + n.width / 2 - r.left;
|
|
2735
|
-
},
|
|
2735
|
+
}, te = () => {
|
|
2736
2736
|
let e = m.value;
|
|
2737
2737
|
if (!e || t.value !== null) return null;
|
|
2738
2738
|
let n = x.value.buttons[e];
|
|
@@ -2741,10 +2741,10 @@ var Qi = Y({
|
|
|
2741
2741
|
role: "tooltip",
|
|
2742
2742
|
"data-testid": "markweave-floating-toolbar-tooltip",
|
|
2743
2743
|
"data-button-id": e,
|
|
2744
|
-
"data-active":
|
|
2744
|
+
"data-active": I(e),
|
|
2745
2745
|
style: h.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${h.value}px` }
|
|
2746
2746
|
}, n) : null;
|
|
2747
|
-
},
|
|
2747
|
+
}, R = (n, r, i, a, o = !1, s) => H("button", {
|
|
2748
2748
|
type: "button",
|
|
2749
2749
|
class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
|
|
2750
2750
|
"aria-label": r,
|
|
@@ -2758,16 +2758,16 @@ var Qi = Y({
|
|
|
2758
2758
|
"data-active": o || t.value === n,
|
|
2759
2759
|
"data-tooltip-active": m.value === n ? "true" : "false",
|
|
2760
2760
|
"data-testid": `markweave-floating-toolbar-button-${n}`,
|
|
2761
|
-
onBlur: () =>
|
|
2762
|
-
onFocus: (e) =>
|
|
2761
|
+
onBlur: () => L(null),
|
|
2762
|
+
onFocus: (e) => L(n, e.currentTarget),
|
|
2763
2763
|
onMousedown: $,
|
|
2764
|
-
onMouseenter: (e) =>
|
|
2765
|
-
onMouseleave: () =>
|
|
2764
|
+
onMouseenter: (e) => L(n, e.currentTarget),
|
|
2765
|
+
onMouseleave: () => L(null),
|
|
2766
2766
|
onClick: a
|
|
2767
|
-
}, n === "ask-ai" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [Z(i, r), H("span", null, s ?? r)])] : n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, Zi(e.editor, e.messages)), Z(t.value === "block-type" ? Ar : Or, r)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? Ar : Or, r)])] : [Z(i, r)]),
|
|
2767
|
+
}, n === "ask-ai" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [Z(i, r), H("span", null, s ?? r)])] : n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, Zi(e.editor, e.messages)), Z(t.value === "block-type" ? Ar : Or, r)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? Ar : Or, r)])] : [Z(i, r)]), ne = () => H("span", {
|
|
2768
2768
|
class: "markweave-floating-toolbar-divider",
|
|
2769
2769
|
"aria-hidden": "true"
|
|
2770
|
-
}),
|
|
2770
|
+
}), re = (n, r, i) => H("section", {
|
|
2771
2771
|
class: "markweave-floating-toolbar-color-section",
|
|
2772
2772
|
"aria-label": n
|
|
2773
2773
|
}, [H("div", { class: "markweave-floating-toolbar-menu-title" }, n), H("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => H("button", {
|
|
@@ -2786,7 +2786,7 @@ var Qi = Y({
|
|
|
2786
2786
|
class: "markweave-floating-toolbar-highlight-swatch",
|
|
2787
2787
|
style: { backgroundColor: i ?? "#ffffff" },
|
|
2788
2788
|
"aria-hidden": "true"
|
|
2789
|
-
})])))]),
|
|
2789
|
+
})])))]), ie = () => {
|
|
2790
2790
|
if (t.value === "ask-ai") {
|
|
2791
2791
|
let t = (e, t, n, r) => H("button", {
|
|
2792
2792
|
type: "button",
|
|
@@ -2852,7 +2852,7 @@ var Qi = Y({
|
|
|
2852
2852
|
}, "markweave-ask-ai-retry", oi),
|
|
2853
2853
|
H("span", { class: "markweave-ask-ai-action-spacer" }),
|
|
2854
2854
|
t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", wi),
|
|
2855
|
-
t(e.messages.askAi.accept,
|
|
2855
|
+
t(e.messages.askAi.accept, ee, "markweave-ask-ai-accept", Er)
|
|
2856
2856
|
]) : null,
|
|
2857
2857
|
n.value === "error" || n.value === "conflict" ? H("div", {
|
|
2858
2858
|
class: "markweave-ask-ai-error",
|
|
@@ -2924,7 +2924,7 @@ var Qi = Y({
|
|
|
2924
2924
|
ref: y,
|
|
2925
2925
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
|
|
2926
2926
|
"data-testid": "markweave-floating-toolbar-color-menu"
|
|
2927
|
-
}, [
|
|
2927
|
+
}, [re(x.value.textColorTitle, "text", C.value), re(x.value.highlightColorTitle, "highlight", w.value)]) : t.value === "more" ? H("div", {
|
|
2928
2928
|
ref: y,
|
|
2929
2929
|
class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
|
|
2930
2930
|
"data-testid": "markweave-floating-toolbar-more-menu"
|
|
@@ -2951,7 +2951,7 @@ var Qi = Y({
|
|
|
2951
2951
|
role: "tooltip"
|
|
2952
2952
|
}, x.value.moreActions[n]) : null]))) : null;
|
|
2953
2953
|
};
|
|
2954
|
-
return () => H(
|
|
2954
|
+
return () => H(z, {
|
|
2955
2955
|
editor: e.editor,
|
|
2956
2956
|
shouldShow: ({ editor: e }) => {
|
|
2957
2957
|
let t = Pe(e);
|
|
@@ -2976,22 +2976,22 @@ var Qi = Y({
|
|
|
2976
2976
|
class: "markweave-floating-toolbar-content",
|
|
2977
2977
|
"data-menu": t.value ?? "none"
|
|
2978
2978
|
}, [
|
|
2979
|
-
f.value && Ie(e.editor) ?
|
|
2980
|
-
f.value && Ie(e.editor) ?
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2979
|
+
f.value && Ie(e.editor) ? R("ask-ai", x.value.buttons["ask-ai"], li, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
|
|
2980
|
+
f.value && Ie(e.editor) ? ne() : null,
|
|
2981
|
+
R("block-type", x.value.buttons["block-type"], bi, () => O("block-type"), t.value === "block-type"),
|
|
2982
|
+
ne(),
|
|
2983
|
+
R("bold", x.value.buttons.bold, Cr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
|
|
2984
|
+
R("italic", x.value.buttons.italic, Kr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
|
|
2985
|
+
R("underline", x.value.buttons.underline, xi, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
|
|
2986
|
+
R("strike", x.value.buttons.strike, fi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
|
|
2987
|
+
R("inline-code", x.value.buttons["inline-code"], Mr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
|
|
2988
|
+
ne(),
|
|
2989
|
+
R("link", x.value.buttons.link, Jr, () => O("link"), e.editor.isActive("link")),
|
|
2990
|
+
R("color", x.value.buttons.color, bi, () => O("color"), t.value === "color"),
|
|
2991
|
+
ne(),
|
|
2992
|
+
R("more", x.value.buttons.more, $r, () => O("more"), t.value === "more"),
|
|
2993
|
+
ie(),
|
|
2994
|
+
te()
|
|
2995
2995
|
])]) });
|
|
2996
2996
|
}
|
|
2997
2997
|
}), $i = Y({
|
|
@@ -3202,13 +3202,13 @@ var Qi = Y({
|
|
|
3202
3202
|
} : {
|
|
3203
3203
|
kind: e.inputCommand.uploadKind ?? "attachment",
|
|
3204
3204
|
trigger: "slash-command",
|
|
3205
|
-
source:
|
|
3205
|
+
source: I(t.value)
|
|
3206
3206
|
};
|
|
3207
3207
|
if (!n.value && !t.value.trim()) {
|
|
3208
3208
|
r.value = e.messages.slash.uploadRequiredError;
|
|
3209
3209
|
return;
|
|
3210
3210
|
}
|
|
3211
|
-
let a = await
|
|
3211
|
+
let a = await te(i, e.onUpload);
|
|
3212
3212
|
e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
|
|
3213
3213
|
} catch (t) {
|
|
3214
3214
|
r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
|
|
@@ -3467,7 +3467,7 @@ var Qi = Y({
|
|
|
3467
3467
|
frameRect: l,
|
|
3468
3468
|
kind: "column"
|
|
3469
3469
|
}) : null;
|
|
3470
|
-
},
|
|
3470
|
+
}, ee = () => {
|
|
3471
3471
|
if (!e.active || !t.value) {
|
|
3472
3472
|
l.value = null;
|
|
3473
3473
|
return;
|
|
@@ -3493,7 +3493,7 @@ var Qi = Y({
|
|
|
3493
3493
|
},
|
|
3494
3494
|
kind: t.value
|
|
3495
3495
|
});
|
|
3496
|
-
},
|
|
3496
|
+
}, N = () => {
|
|
3497
3497
|
if (!e.active || !t.value || !n.value || !l.value) {
|
|
3498
3498
|
u.value = null;
|
|
3499
3499
|
return;
|
|
@@ -3513,23 +3513,23 @@ var Qi = Y({
|
|
|
3513
3513
|
height: o || 410
|
|
3514
3514
|
}
|
|
3515
3515
|
});
|
|
3516
|
+
}, P = () => {
|
|
3517
|
+
M(), ee(), N();
|
|
3516
3518
|
}, F = () => {
|
|
3517
|
-
|
|
3518
|
-
}, I = () => {
|
|
3519
|
-
J(F);
|
|
3520
|
-
}, L = (e, i) => {
|
|
3519
|
+
J(P);
|
|
3520
|
+
}, I = (e, i) => {
|
|
3521
3521
|
let a = t.value === e && r.value === i;
|
|
3522
|
-
r.value = i, t.value = a ? null : e, n.value = null, u.value = null,
|
|
3523
|
-
},
|
|
3522
|
+
r.value = i, t.value = a ? null : e, n.value = null, u.value = null, F();
|
|
3523
|
+
}, L = () => {
|
|
3524
3524
|
e.editor.view.dispatch(sn(e.editor.state.tr, null));
|
|
3525
|
-
},
|
|
3525
|
+
}, te = (t, n) => {
|
|
3526
3526
|
let r = e.interactionState.hoverCellPos ?? w.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
|
|
3527
|
-
r !== null && Ln(e.editor, r, t, { visualIndex: i }),
|
|
3528
|
-
},
|
|
3529
|
-
|
|
3530
|
-
},
|
|
3527
|
+
r !== null && Ln(e.editor, r, t, { visualIndex: i }), I(t, n);
|
|
3528
|
+
}, R = () => {
|
|
3529
|
+
L(), I("selection", "selection-edge");
|
|
3530
|
+
}, z = (r = !1) => {
|
|
3531
3531
|
t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
|
|
3532
|
-
},
|
|
3532
|
+
}, ne = async (n, r) => {
|
|
3533
3533
|
let i = await Sn({
|
|
3534
3534
|
editor: e.editor,
|
|
3535
3535
|
commandId: n,
|
|
@@ -3537,34 +3537,34 @@ var Qi = Y({
|
|
|
3537
3537
|
messages: e.messages
|
|
3538
3538
|
});
|
|
3539
3539
|
return i.copyFeedback ? (j(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : j(null), e.onCommandResult?.(i.commandResult), i.success;
|
|
3540
|
-
}, ne = (t) => {
|
|
3541
|
-
C.value && (Be(e.editor, t), te(!1));
|
|
3542
|
-
}, V = (e) => {
|
|
3543
|
-
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, I());
|
|
3544
3540
|
}, re = (t) => {
|
|
3541
|
+
C.value && (Be(e.editor, t), z(!1));
|
|
3542
|
+
}, B = (e) => {
|
|
3543
|
+
t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, F());
|
|
3544
|
+
}, ie = (t) => {
|
|
3545
3545
|
let n = t === "row" ? T.value : E.value, r = e.interactionState.hoverCellPos ?? w.value.activeCellPos;
|
|
3546
|
-
!n || r === null || Un(e.editor, r, t, { visualIndex: n.index }) &&
|
|
3547
|
-
},
|
|
3546
|
+
!n || r === null || Un(e.editor, r, t, { visualIndex: n.index }) && ne(t === "row" ? "add-row-after" : "add-column-after", t);
|
|
3547
|
+
}, ae = (e, t, n) => {
|
|
3548
3548
|
x = {
|
|
3549
3549
|
axis: e,
|
|
3550
3550
|
index: t
|
|
3551
3551
|
}, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
|
|
3552
|
-
},
|
|
3552
|
+
}, oe = (t) => {
|
|
3553
3553
|
if (!x) return;
|
|
3554
3554
|
let n = En(e.editor, x.axis, t.clientX, t.clientY);
|
|
3555
3555
|
n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
|
|
3556
|
-
},
|
|
3556
|
+
}, se = (t) => {
|
|
3557
3557
|
let n = x;
|
|
3558
3558
|
if (!n) return;
|
|
3559
3559
|
let r = En(e.editor, n.axis, t.clientX, t.clientY) ?? S;
|
|
3560
3560
|
t.preventDefault(), x = null, S = null, r !== null && In(e.editor, n.axis, n.index, r);
|
|
3561
|
-
},
|
|
3561
|
+
}, V = G(() => (f.value, t.value === "row" || t.value === "column" ? Dn(e.editor, t.value) : null)), ce = (e) => {
|
|
3562
3562
|
if (!(!t.value || e.key !== "Escape")) {
|
|
3563
3563
|
if (n.value) {
|
|
3564
3564
|
n.value = null;
|
|
3565
3565
|
return;
|
|
3566
3566
|
}
|
|
3567
|
-
|
|
3567
|
+
z(!0);
|
|
3568
3568
|
}
|
|
3569
3569
|
}, le = (e) => {
|
|
3570
3570
|
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
@@ -3573,12 +3573,12 @@ var Qi = Y({
|
|
|
3573
3573
|
let n = t.classList.contains("markweave-table-menu") ? t.querySelector(":scope > .markweave-table-menu-scroll") ?? t : t, r = Array.from(n.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), i = r.indexOf(document.activeElement), a = e.key === "ArrowDown" ? 1 : -1, o = i < 0 ? 0 : Math.min(r.length - 1, Math.max(0, i + a));
|
|
3574
3574
|
e.preventDefault(), e.stopPropagation(), r[o]?.focus();
|
|
3575
3575
|
}, ue = (e) => {
|
|
3576
|
-
t.value && (e.target instanceof Node && p.value?.contains(e.target) ||
|
|
3576
|
+
t.value && (e.target instanceof Node && p.value?.contains(e.target) || z());
|
|
3577
3577
|
};
|
|
3578
3578
|
nr(() => {
|
|
3579
|
-
|
|
3579
|
+
P(), window.addEventListener("resize", P), window.addEventListener("scroll", P, !0), document.addEventListener("keydown", ce), document.addEventListener("mousedown", ue), document.addEventListener("dragover", oe), document.addEventListener("drop", se);
|
|
3580
3580
|
}), q(() => {
|
|
3581
|
-
A(), window.removeEventListener("resize",
|
|
3581
|
+
A(), window.removeEventListener("resize", P), window.removeEventListener("scroll", P, !0), document.removeEventListener("keydown", ce), document.removeEventListener("mousedown", ue), document.removeEventListener("dragover", oe), document.removeEventListener("drop", se);
|
|
3582
3582
|
}), K(() => [
|
|
3583
3583
|
e.active,
|
|
3584
3584
|
w.value.activeCellPos,
|
|
@@ -3590,7 +3590,7 @@ var Qi = Y({
|
|
|
3590
3590
|
t.value,
|
|
3591
3591
|
n.value,
|
|
3592
3592
|
r.value
|
|
3593
|
-
],
|
|
3593
|
+
], F, { flush: "post" });
|
|
3594
3594
|
let de = () => {
|
|
3595
3595
|
if (!t.value) return null;
|
|
3596
3596
|
let r = k.value.map((r, i) => {
|
|
@@ -3611,7 +3611,7 @@ var Qi = Y({
|
|
|
3611
3611
|
"data-submenu-trigger": r.submenuId ?? void 0,
|
|
3612
3612
|
"data-testid": r.commandId ? `markweave-table-menu-command-${r.commandId}` : r.submenuId ? `markweave-table-menu-submenu-${r.submenuId}` : "markweave-table-menu-command-edit-with-ai",
|
|
3613
3613
|
onMousedown: (e) => {
|
|
3614
|
-
$(e), l && r.id === "edit-with-ai" &&
|
|
3614
|
+
$(e), l && r.id === "edit-with-ai" && re(c);
|
|
3615
3615
|
},
|
|
3616
3616
|
onMouseenter: () => {
|
|
3617
3617
|
n.value = r.submenuId;
|
|
@@ -3623,10 +3623,10 @@ var Qi = Y({
|
|
|
3623
3623
|
return;
|
|
3624
3624
|
}
|
|
3625
3625
|
if (r.commandId === null) {
|
|
3626
|
-
e.detail === 0 &&
|
|
3626
|
+
e.detail === 0 && re(c);
|
|
3627
3627
|
return;
|
|
3628
3628
|
}
|
|
3629
|
-
|
|
3629
|
+
ne(r.commandId).finally(() => z());
|
|
3630
3630
|
}
|
|
3631
3631
|
}
|
|
3632
3632
|
}, [
|
|
@@ -3669,11 +3669,11 @@ var Qi = Y({
|
|
|
3669
3669
|
key: `text-${t.id}`,
|
|
3670
3670
|
type: "button",
|
|
3671
3671
|
role: "menuitemradio",
|
|
3672
|
-
"aria-checked":
|
|
3673
|
-
"data-active":
|
|
3672
|
+
"aria-checked": V.value?.textColorId === t.id,
|
|
3673
|
+
"data-active": V.value?.textColorId === t.id ? "true" : "false",
|
|
3674
3674
|
"data-testid": `markweave-table-text-color-${t.id}`,
|
|
3675
3675
|
onMousedown: $,
|
|
3676
|
-
onClick: () =>
|
|
3676
|
+
onClick: () => B((n) => gn(e.editor, n, t.id))
|
|
3677
3677
|
}, [H("span", {
|
|
3678
3678
|
class: "markweave-table-color-swatch markweave-table-text-color-swatch",
|
|
3679
3679
|
"aria-hidden": "true",
|
|
@@ -3685,11 +3685,11 @@ var Qi = Y({
|
|
|
3685
3685
|
key: `background-${t.id}`,
|
|
3686
3686
|
type: "button",
|
|
3687
3687
|
role: "menuitemradio",
|
|
3688
|
-
"aria-checked":
|
|
3689
|
-
"data-active":
|
|
3688
|
+
"aria-checked": V.value?.backgroundColorId === t.id,
|
|
3689
|
+
"data-active": V.value?.backgroundColorId === t.id ? "true" : "false",
|
|
3690
3690
|
"data-testid": `markweave-table-background-color-${t.id}`,
|
|
3691
3691
|
onMousedown: $,
|
|
3692
|
-
onClick: () =>
|
|
3692
|
+
onClick: () => B((n) => hn(e.editor, n, t.id))
|
|
3693
3693
|
}, [H("span", {
|
|
3694
3694
|
class: "markweave-table-color-swatch",
|
|
3695
3695
|
"aria-hidden": "true",
|
|
@@ -3706,7 +3706,7 @@ var Qi = Y({
|
|
|
3706
3706
|
"data-active": n ? "true" : "false",
|
|
3707
3707
|
"data-testid": `markweave-table-alignment-${t}`,
|
|
3708
3708
|
onMousedown: $,
|
|
3709
|
-
onClick: () =>
|
|
3709
|
+
onClick: () => B((n) => mn(e.editor, n, t))
|
|
3710
3710
|
}, [H(r, {
|
|
3711
3711
|
size: 18,
|
|
3712
3712
|
strokeWidth: 1.8,
|
|
@@ -3728,9 +3728,9 @@ var Qi = Y({
|
|
|
3728
3728
|
} : void 0,
|
|
3729
3729
|
onKeydown: le
|
|
3730
3730
|
}, [
|
|
3731
|
-
...Bn.map((e) => t(e,
|
|
3731
|
+
...Bn.map((e) => t(e, V.value?.textAlign === e)),
|
|
3732
3732
|
H("div", { class: "markweave-table-submenu-separator" }),
|
|
3733
|
-
...Hn.map((e) => t(e,
|
|
3733
|
+
...Hn.map((e) => t(e, V.value?.verticalAlign === e))
|
|
3734
3734
|
]));
|
|
3735
3735
|
}
|
|
3736
3736
|
return H("div", {
|
|
@@ -3788,8 +3788,8 @@ var Qi = Y({
|
|
|
3788
3788
|
height: `${i.value.height}px`
|
|
3789
3789
|
},
|
|
3790
3790
|
onMousedown: $,
|
|
3791
|
-
onClick: () =>
|
|
3792
|
-
onDragstart: (e) =>
|
|
3791
|
+
onClick: () => te("row", "row-edge"),
|
|
3792
|
+
onDragstart: (e) => ae("row", T.value?.index ?? 0, e),
|
|
3793
3793
|
onDragend: () => {
|
|
3794
3794
|
x = null, S = null;
|
|
3795
3795
|
}
|
|
@@ -3818,8 +3818,8 @@ var Qi = Y({
|
|
|
3818
3818
|
height: `${a.value.height}px`
|
|
3819
3819
|
},
|
|
3820
3820
|
onMousedown: $,
|
|
3821
|
-
onClick: () =>
|
|
3822
|
-
onDragstart: (e) =>
|
|
3821
|
+
onClick: () => te("column", "column-edge"),
|
|
3822
|
+
onDragstart: (e) => ae("column", E.value?.index ?? 0, e),
|
|
3823
3823
|
onDragend: () => {
|
|
3824
3824
|
x = null, S = null;
|
|
3825
3825
|
}
|
|
@@ -3843,7 +3843,7 @@ var Qi = Y({
|
|
|
3843
3843
|
height: `${o.value.height}px`
|
|
3844
3844
|
},
|
|
3845
3845
|
onMousedown: $,
|
|
3846
|
-
onClick:
|
|
3846
|
+
onClick: R
|
|
3847
3847
|
}, [H($r, {
|
|
3848
3848
|
size: 14,
|
|
3849
3849
|
"aria-hidden": "true"
|
|
@@ -3861,7 +3861,7 @@ var Qi = Y({
|
|
|
3861
3861
|
height: `${s.value.height}px`
|
|
3862
3862
|
},
|
|
3863
3863
|
onMousedown: $,
|
|
3864
|
-
onClick: () =>
|
|
3864
|
+
onClick: () => ie("row")
|
|
3865
3865
|
}, [H(ri, {
|
|
3866
3866
|
size: 14,
|
|
3867
3867
|
"aria-hidden": "true"
|
|
@@ -3879,7 +3879,7 @@ var Qi = Y({
|
|
|
3879
3879
|
height: `${c.value.height}px`
|
|
3880
3880
|
},
|
|
3881
3881
|
onMousedown: $,
|
|
3882
|
-
onClick: () =>
|
|
3882
|
+
onClick: () => ie("column")
|
|
3883
3883
|
}, [H(ri, {
|
|
3884
3884
|
size: 14,
|
|
3885
3885
|
"aria-hidden": "true"
|
|
@@ -3973,22 +3973,22 @@ var Qi = Y({
|
|
|
3973
3973
|
}
|
|
3974
3974
|
},
|
|
3975
3975
|
setup(e) {
|
|
3976
|
-
let t = U(null), n = U(null), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U([]),
|
|
3976
|
+
let t = U(null), n = U(null), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U([]), u = U(null), d = U(!1), f = U(""), p = U(-1), m = U(null), h = U(!1), g = U(null), _ = U(null), v = U(!1), y = U({
|
|
3977
3977
|
active: !1,
|
|
3978
3978
|
lastX: 0,
|
|
3979
3979
|
lastY: 0
|
|
3980
|
-
}),
|
|
3980
|
+
}), b = U(0), x = U(0), S = U(0), C = null, w = G(() => (S.value, bt(e.editor, s.value))), T = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
|
|
3981
3981
|
...e.state,
|
|
3982
3982
|
pos: e.state.pos,
|
|
3983
3983
|
active: !0
|
|
3984
|
-
} : null),
|
|
3985
|
-
|
|
3984
|
+
} : null), E = G(() => w.value ?? T.value), D = G(() => E.value !== null), O = G(() => E.value?.language === "mermaid"), k = G(() => Tt(e.editor, E.value)), A = G(() => D.value && E.value !== null && !k.value), j = G(() => !e.readOnly), M = G(() => E.value ? pt(E.value.language) : pt("text")), ee = G(() => m.value?.status ?? "idle"), N = G(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), P = G(() => O.value && N.value === "preview"), F = G(() => (S.value, b.value, x.value, Ct(e.editor))), I = G(() => `${x.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = G(() => _t(f.value)), te = G(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), R = () => {
|
|
3985
|
+
C !== null && (window.clearTimeout(C), C = null);
|
|
3986
3986
|
}, z = (e) => {
|
|
3987
|
-
R(),
|
|
3988
|
-
|
|
3987
|
+
R(), m.value = e, e && (C = window.setTimeout(() => {
|
|
3988
|
+
m.value = null, C = null;
|
|
3989
3989
|
}, ot));
|
|
3990
|
-
},
|
|
3991
|
-
|
|
3990
|
+
}, ne = () => {
|
|
3991
|
+
g.value = null, _.value = null, v.value = !1, y.value = {
|
|
3992
3992
|
active: !1,
|
|
3993
3993
|
lastX: 0,
|
|
3994
3994
|
lastY: 0
|
|
@@ -3997,155 +3997,157 @@ var Qi = Y({
|
|
|
3997
3997
|
let n = t.value;
|
|
3998
3998
|
if (!n) return;
|
|
3999
3999
|
if (!xt(n) || F.value.length === 0) {
|
|
4000
|
-
|
|
4000
|
+
l.value = [];
|
|
4001
4001
|
return;
|
|
4002
4002
|
}
|
|
4003
4003
|
let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
|
|
4004
4004
|
let n = gt(ht(e.editor, t.pos, t.mermaidPreviewMode), r);
|
|
4005
4005
|
return n ? [dt(t, n, r)] : [];
|
|
4006
4006
|
});
|
|
4007
|
-
|
|
4008
|
-
},
|
|
4009
|
-
if (!
|
|
4010
|
-
|
|
4007
|
+
l.value = Et(l.value, i, F.value.map((e) => e.pos));
|
|
4008
|
+
}, ie = () => {
|
|
4009
|
+
if (!A.value || !E.value) {
|
|
4010
|
+
c.value = null, u.value = null;
|
|
4011
4011
|
return;
|
|
4012
4012
|
}
|
|
4013
|
-
let
|
|
4014
|
-
if (!
|
|
4015
|
-
let
|
|
4016
|
-
if (!
|
|
4017
|
-
|
|
4013
|
+
let i = t.value;
|
|
4014
|
+
if (!i) return;
|
|
4015
|
+
let a = ht(e.editor, E.value.pos, N.value), o = i.getBoundingClientRect(), s = gt(a, o);
|
|
4016
|
+
if (!s) {
|
|
4017
|
+
c.value = c.value?.pos === E.value.pos ? c.value : null, u.value = d.value ? u.value : null;
|
|
4018
4018
|
return;
|
|
4019
4019
|
}
|
|
4020
|
-
if (
|
|
4021
|
-
let e = n.value.getBoundingClientRect();
|
|
4022
|
-
|
|
4023
|
-
overlayRect:
|
|
4020
|
+
if (c.value = lt(E.value.pos, s, o), d.value && n.value) {
|
|
4021
|
+
let e = n.value.getBoundingClientRect(), t = r.value?.getBoundingClientRect().height;
|
|
4022
|
+
u.value = it({
|
|
4023
|
+
overlayRect: o,
|
|
4024
4024
|
buttonRect: e,
|
|
4025
|
+
menuHeight: t,
|
|
4025
4026
|
windowWidth: window.innerWidth,
|
|
4026
4027
|
windowHeight: window.innerHeight
|
|
4027
4028
|
});
|
|
4028
4029
|
}
|
|
4029
|
-
},
|
|
4030
|
+
}, ae = async () => {
|
|
4030
4031
|
if (e.readOnly) {
|
|
4031
|
-
if (!
|
|
4032
|
-
let e = await st(
|
|
4033
|
-
z($e(
|
|
4032
|
+
if (!E.value) return;
|
|
4033
|
+
let e = await st(E.value.text);
|
|
4034
|
+
z($e(E.value, e ? "copied" : "failed"));
|
|
4034
4035
|
return;
|
|
4035
4036
|
}
|
|
4036
|
-
if (!ft(e.editor,
|
|
4037
|
+
if (!ft(e.editor, E.value)) return;
|
|
4037
4038
|
let t = await Ze(e.editor);
|
|
4038
4039
|
z($e(Qe(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
|
|
4039
|
-
},
|
|
4040
|
+
}, oe = (t, n) => {
|
|
4040
4041
|
if (e.readOnly) {
|
|
4041
|
-
qt(e.editor, t.pos, n) && (
|
|
4042
|
+
qt(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
|
|
4042
4043
|
return;
|
|
4043
4044
|
}
|
|
4044
4045
|
let r = e.state.active && e.state.pos === t.pos;
|
|
4045
|
-
rt(e.editor, t.pos, n) && (e.onMermaidModeChange(n),
|
|
4046
|
-
},
|
|
4047
|
-
if (e.readOnly || !
|
|
4048
|
-
let n = e.state.active && e.state.pos ===
|
|
4049
|
-
nt(e.editor,
|
|
4050
|
-
},
|
|
4051
|
-
|
|
4052
|
-
},
|
|
4046
|
+
rt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
|
|
4047
|
+
}, se = (t) => {
|
|
4048
|
+
if (e.readOnly || !E.value) return;
|
|
4049
|
+
let n = e.state.active && e.state.pos === E.value.pos;
|
|
4050
|
+
nt(e.editor, E.value.pos, t) && (t === "mermaid" && rt(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());
|
|
4051
|
+
}, V = () => {
|
|
4052
|
+
d.value = !d.value, d.value && o.value === null && (o.value = ct()), p.value = d.value ? St(L.value, E.value?.language ?? null) : -1;
|
|
4053
|
+
}, ce = (e) => {
|
|
4053
4054
|
let t = _t(e);
|
|
4054
|
-
|
|
4055
|
-
},
|
|
4055
|
+
f.value = e, p.value = St(t, e.trim() ? null : E.value?.language ?? null);
|
|
4056
|
+
}, le = (t) => {
|
|
4056
4057
|
if (!t.isComposing) {
|
|
4057
4058
|
if (t.key === "ArrowDown" || t.key === "ArrowUp") {
|
|
4058
|
-
t.preventDefault(),
|
|
4059
|
+
t.preventDefault(), p.value = Ot(p.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
|
|
4059
4060
|
return;
|
|
4060
4061
|
}
|
|
4061
4062
|
if (t.key === "Enter") {
|
|
4062
|
-
let e = L.value[
|
|
4063
|
-
e && (t.preventDefault(),
|
|
4063
|
+
let e = L.value[p.value];
|
|
4064
|
+
e && (t.preventDefault(), se(e.language));
|
|
4064
4065
|
return;
|
|
4065
4066
|
}
|
|
4066
|
-
t.key === "Escape" && (t.preventDefault(),
|
|
4067
|
+
t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
|
|
4067
4068
|
}
|
|
4068
|
-
}, le = () => {
|
|
4069
|
-
e.readOnly || !T.value || tt(e.editor, T.value.pos, !O.value) && (y.value += 1, x.value += 1, o.value = null);
|
|
4070
4069
|
}, ue = () => {
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4070
|
+
e.readOnly || !E.value || tt(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
|
|
4071
|
+
}, de = () => {
|
|
4072
|
+
if (!E.value) return;
|
|
4073
|
+
let t = wt(e.editor, E.value.pos);
|
|
4074
|
+
t && re({
|
|
4074
4075
|
data: new Blob([t], { type: "image/svg+xml" }),
|
|
4075
4076
|
fileName: "markweave-mermaid.svg",
|
|
4076
4077
|
onSettled: () => e.editor.view.focus(),
|
|
4077
4078
|
ownerDocument: document
|
|
4078
4079
|
});
|
|
4079
|
-
},
|
|
4080
|
-
if (!
|
|
4081
|
-
let t = wt(e.editor,
|
|
4082
|
-
t && (
|
|
4080
|
+
}, fe = () => {
|
|
4081
|
+
if (!E.value) return;
|
|
4082
|
+
let t = wt(e.editor, E.value.pos);
|
|
4083
|
+
t && (g.value = ut(t), _.value = null, v.value = !1, y.value = {
|
|
4083
4084
|
active: !1,
|
|
4084
4085
|
lastX: 0,
|
|
4085
4086
|
lastY: 0
|
|
4086
4087
|
});
|
|
4087
|
-
},
|
|
4088
|
-
|
|
4089
|
-
...
|
|
4090
|
-
scale: at(
|
|
4088
|
+
}, pe = (e) => {
|
|
4089
|
+
g.value = g.value ? {
|
|
4090
|
+
...g.value,
|
|
4091
|
+
scale: at(g.value.scale + e)
|
|
4091
4092
|
} : null;
|
|
4092
|
-
},
|
|
4093
|
-
|
|
4093
|
+
}, me = () => {
|
|
4094
|
+
g.value = g.value ? ut(g.value.svg) : null, y.value = {
|
|
4094
4095
|
active: !1,
|
|
4095
4096
|
lastX: 0,
|
|
4096
4097
|
lastY: 0
|
|
4097
|
-
},
|
|
4098
|
-
}, me = (e) => {
|
|
4099
|
-
e.preventDefault(), fe(e.deltaY < 0 ? Dt : -Dt);
|
|
4098
|
+
}, v.value = !1;
|
|
4100
4099
|
}, he = (e) => {
|
|
4101
|
-
e.
|
|
4100
|
+
e.preventDefault(), pe(e.deltaY < 0 ? Dt : -Dt);
|
|
4101
|
+
}, ge = (e) => {
|
|
4102
|
+
e.button === 0 && (e.preventDefault(), y.value = {
|
|
4102
4103
|
active: !0,
|
|
4103
4104
|
lastX: e.clientX,
|
|
4104
4105
|
lastY: e.clientY
|
|
4105
|
-
},
|
|
4106
|
-
},
|
|
4107
|
-
let t =
|
|
4106
|
+
}, v.value = !0);
|
|
4107
|
+
}, _e = (e) => {
|
|
4108
|
+
let t = y.value;
|
|
4108
4109
|
if (!t.active) return;
|
|
4109
4110
|
let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
|
|
4110
|
-
|
|
4111
|
+
y.value = {
|
|
4111
4112
|
active: !0,
|
|
4112
4113
|
lastX: e.clientX,
|
|
4113
4114
|
lastY: e.clientY
|
|
4114
|
-
},
|
|
4115
|
-
},
|
|
4116
|
-
|
|
4115
|
+
}, g.value = kt(g.value, n, r);
|
|
4116
|
+
}, ve = () => {
|
|
4117
|
+
y.value = {
|
|
4117
4118
|
active: !1,
|
|
4118
4119
|
lastX: 0,
|
|
4119
4120
|
lastY: 0
|
|
4120
|
-
},
|
|
4121
|
+
}, v.value = !1;
|
|
4121
4122
|
};
|
|
4122
4123
|
K(() => e.readOnly, (e) => {
|
|
4123
|
-
e && (
|
|
4124
|
-
}), K(
|
|
4125
|
-
z(null),
|
|
4126
|
-
}), K(
|
|
4124
|
+
e && (d.value = !1, f.value = "");
|
|
4125
|
+
}), K(te, () => {
|
|
4126
|
+
z(null), d.value = !1, f.value = "", p.value = -1, g.value = null, _.value = null, v.value = !1;
|
|
4127
|
+
}), K(d, async (e) => {
|
|
4127
4128
|
if (!e) {
|
|
4128
|
-
|
|
4129
|
+
p.value = -1;
|
|
4129
4130
|
return;
|
|
4130
4131
|
}
|
|
4131
|
-
await J(),
|
|
4132
|
+
await J(), ie(), i.value?.focus({ preventScroll: !0 });
|
|
4132
4133
|
}), K(() => [
|
|
4133
|
-
u.value,
|
|
4134
4134
|
d.value,
|
|
4135
|
-
f.value
|
|
4135
|
+
f.value,
|
|
4136
|
+
p.value
|
|
4136
4137
|
], async () => {
|
|
4137
|
-
if (!
|
|
4138
|
+
if (!d.value || p.value < 0) return;
|
|
4138
4139
|
await J();
|
|
4139
|
-
let e =
|
|
4140
|
+
let e = a.value, t = e?.querySelector(`[data-language-index="${p.value}"]`);
|
|
4140
4141
|
e && t && At(e, t);
|
|
4141
4142
|
}, { flush: "post" }), K(() => [
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4143
|
+
A.value,
|
|
4144
|
+
b.value,
|
|
4145
|
+
E.value?.pos ?? null,
|
|
4146
|
+
L.value.length,
|
|
4147
|
+
d.value,
|
|
4146
4148
|
N.value
|
|
4147
4149
|
], async () => {
|
|
4148
|
-
await J(),
|
|
4150
|
+
await J(), ie();
|
|
4149
4151
|
}, {
|
|
4150
4152
|
flush: "post",
|
|
4151
4153
|
immediate: !0
|
|
@@ -4155,42 +4157,42 @@ var Qi = Y({
|
|
|
4155
4157
|
flush: "post",
|
|
4156
4158
|
immediate: !0
|
|
4157
4159
|
});
|
|
4158
|
-
let
|
|
4160
|
+
let ye = null;
|
|
4159
4161
|
return nr(() => {
|
|
4160
4162
|
J(() => {
|
|
4161
4163
|
let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
|
|
4162
|
-
if (n.target instanceof Node && t.value?.contains(n.target) ||
|
|
4164
|
+
if (n.target instanceof Node && t.value?.contains(n.target) || d.value) return;
|
|
4163
4165
|
let r = yt(e.editor, n.target), i = bt(e.editor, r), a = i && !Tt(e.editor, i) ? i.pos : null;
|
|
4164
|
-
|
|
4166
|
+
s.value = s.value === a ? s.value : a;
|
|
4165
4167
|
}, i = () => {
|
|
4166
|
-
|
|
4168
|
+
d.value || (s.value = null);
|
|
4167
4169
|
}, a = (t) => {
|
|
4168
4170
|
if (t.key === "Escape") {
|
|
4169
|
-
if (
|
|
4170
|
-
|
|
4171
|
+
if (g.value) {
|
|
4172
|
+
ne();
|
|
4171
4173
|
return;
|
|
4172
4174
|
}
|
|
4173
|
-
|
|
4175
|
+
d.value && (d.value = !1, p.value = -1, e.editor.view.focus());
|
|
4174
4176
|
}
|
|
4175
|
-
},
|
|
4176
|
-
|
|
4177
|
+
}, o = (e) => {
|
|
4178
|
+
d.value && (e.target instanceof Node && t.value?.contains(e.target) || (d.value = !1, p.value = -1));
|
|
4177
4179
|
}, c = ({ transaction: e }) => {
|
|
4178
|
-
e.getMeta(Xe) && (
|
|
4180
|
+
e.getMeta(Xe) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Xe) || Wt(e)) && (S.value += 1);
|
|
4179
4181
|
};
|
|
4180
|
-
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize",
|
|
4181
|
-
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize",
|
|
4182
|
+
n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", ie), window.addEventListener("scroll", ie, !0), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ye = () => {
|
|
4183
|
+
n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", ie), window.removeEventListener("scroll", ie, !0), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), R();
|
|
4182
4184
|
};
|
|
4183
4185
|
});
|
|
4184
4186
|
}), q(() => {
|
|
4185
|
-
|
|
4187
|
+
ye?.(), ye = null, R();
|
|
4186
4188
|
}), () => {
|
|
4187
|
-
if (!
|
|
4188
|
-
let
|
|
4189
|
-
top: `${
|
|
4190
|
-
right: `${
|
|
4191
|
-
} : void 0,
|
|
4192
|
-
left: `${
|
|
4193
|
-
top: `${
|
|
4189
|
+
if (!A.value && F.value.length === 0 && !g.value) return null;
|
|
4190
|
+
let s = c.value ? {
|
|
4191
|
+
top: `${c.value.top}px`,
|
|
4192
|
+
right: `${c.value.right}px`
|
|
4193
|
+
} : void 0, m = u.value ? {
|
|
4194
|
+
left: `${u.value.left}px`,
|
|
4195
|
+
top: `${u.value.top}px`
|
|
4194
4196
|
} : void 0;
|
|
4195
4197
|
return H("div", {
|
|
4196
4198
|
ref: t,
|
|
@@ -4199,7 +4201,7 @@ var Qi = Y({
|
|
|
4199
4201
|
"data-read-only": e.readOnly ? "true" : "false"
|
|
4200
4202
|
}, [
|
|
4201
4203
|
...F.value.map((e) => {
|
|
4202
|
-
let t =
|
|
4204
|
+
let t = l.value.find((t) => t.pos === e.pos);
|
|
4203
4205
|
return H("div", {
|
|
4204
4206
|
key: e.pos,
|
|
4205
4207
|
class: "markweave-mermaid-tabs",
|
|
@@ -4216,71 +4218,71 @@ var Qi = Y({
|
|
|
4216
4218
|
"data-testid": `markweave-mermaid-mode-${t}`,
|
|
4217
4219
|
"data-active": e.mermaidPreviewMode === t ? "true" : "false",
|
|
4218
4220
|
onMousedown: $,
|
|
4219
|
-
onClick: () =>
|
|
4221
|
+
onClick: () => oe(e, t)
|
|
4220
4222
|
}, t === "code" ? "Code" : "Preview")));
|
|
4221
4223
|
}),
|
|
4222
|
-
|
|
4224
|
+
A.value && E.value ? H("div", {
|
|
4223
4225
|
class: "markweave-codeblock-controls",
|
|
4224
4226
|
"data-testid": "markweave-codeblock-controls",
|
|
4225
|
-
"data-positioned":
|
|
4226
|
-
"data-collapsed":
|
|
4227
|
+
"data-positioned": c.value ? "true" : "false",
|
|
4228
|
+
"data-collapsed": k.value ? "true" : "false",
|
|
4227
4229
|
"data-read-only": e.readOnly ? "true" : "false",
|
|
4228
4230
|
"aria-label": "Code block controls",
|
|
4229
|
-
style:
|
|
4231
|
+
style: s
|
|
4230
4232
|
}, [
|
|
4231
4233
|
e.readOnly ? H("span", {
|
|
4232
4234
|
class: "markweave-codeblock-language-button markweave-codeblock-language-label",
|
|
4233
4235
|
"aria-label": "Code block language",
|
|
4234
4236
|
"data-testid": "markweave-codeblock-language"
|
|
4235
|
-
}, [H("span", null,
|
|
4237
|
+
}, [H("span", null, M.value)]) : H("button", {
|
|
4236
4238
|
ref: n,
|
|
4237
4239
|
type: "button",
|
|
4238
4240
|
class: "markweave-codeblock-language-button",
|
|
4239
4241
|
"aria-label": "Code block language",
|
|
4240
|
-
"aria-expanded":
|
|
4242
|
+
"aria-expanded": d.value ? "true" : "false",
|
|
4241
4243
|
"aria-haspopup": "listbox",
|
|
4242
4244
|
"data-testid": "markweave-codeblock-language",
|
|
4243
4245
|
onMousedown: $,
|
|
4244
|
-
onClick:
|
|
4245
|
-
}, [H("span", null,
|
|
4246
|
-
|
|
4246
|
+
onClick: V
|
|
4247
|
+
}, [H("span", null, M.value), Q("chevron")]),
|
|
4248
|
+
j.value ? H("button", {
|
|
4247
4249
|
type: "button",
|
|
4248
4250
|
class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
|
|
4249
|
-
"aria-label":
|
|
4250
|
-
title:
|
|
4251
|
+
"aria-label": k.value ? "Expand code block" : "Collapse code block",
|
|
4252
|
+
title: k.value ? "Expand code block" : "Collapse code block",
|
|
4251
4253
|
"data-testid": "markweave-codeblock-collapse",
|
|
4252
|
-
"data-collapsed":
|
|
4254
|
+
"data-collapsed": k.value ? "true" : "false",
|
|
4253
4255
|
onMousedown: $,
|
|
4254
|
-
onClick:
|
|
4256
|
+
onClick: ue
|
|
4255
4257
|
}, [Q("chevron")]) : null,
|
|
4256
4258
|
H("span", { class: "markweave-codeblock-copy-wrap" }, [H("button", {
|
|
4257
4259
|
type: "button",
|
|
4258
4260
|
class: "markweave-codeblock-icon-button",
|
|
4259
4261
|
"aria-label": "Copy to clipboard",
|
|
4260
4262
|
"data-testid": "markweave-codeblock-copy",
|
|
4261
|
-
"data-copy-state":
|
|
4263
|
+
"data-copy-state": ee.value,
|
|
4262
4264
|
onMousedown: $,
|
|
4263
4265
|
onMouseenter: () => {
|
|
4264
|
-
|
|
4266
|
+
h.value = !0;
|
|
4265
4267
|
},
|
|
4266
4268
|
onMouseleave: () => {
|
|
4267
|
-
|
|
4269
|
+
h.value = !1;
|
|
4268
4270
|
},
|
|
4269
4271
|
onFocus: () => {
|
|
4270
|
-
|
|
4272
|
+
h.value = !0;
|
|
4271
4273
|
},
|
|
4272
4274
|
onBlur: () => {
|
|
4273
|
-
|
|
4275
|
+
h.value = !1;
|
|
4274
4276
|
},
|
|
4275
4277
|
onClick: () => {
|
|
4276
|
-
|
|
4278
|
+
ae();
|
|
4277
4279
|
}
|
|
4278
|
-
}, [Q(
|
|
4280
|
+
}, [Q(ee.value === "copied" ? "check" : "clipboard")]), h.value ? H("span", {
|
|
4279
4281
|
class: "markweave-codeblock-tooltip",
|
|
4280
4282
|
role: "tooltip",
|
|
4281
4283
|
"data-testid": "markweave-codeblock-copy-tooltip"
|
|
4282
4284
|
}, "Copy to clipboard") : null]),
|
|
4283
|
-
|
|
4285
|
+
O.value && N.value === "preview" ? H("div", {
|
|
4284
4286
|
class: "markweave-mermaid-preview-actions",
|
|
4285
4287
|
"data-testid": "markweave-mermaid-preview-actions"
|
|
4286
4288
|
}, [H("button", {
|
|
@@ -4290,7 +4292,7 @@ var Qi = Y({
|
|
|
4290
4292
|
"data-testid": "markweave-mermaid-fullscreen",
|
|
4291
4293
|
disabled: !P.value,
|
|
4292
4294
|
onMousedown: $,
|
|
4293
|
-
onClick:
|
|
4295
|
+
onClick: fe
|
|
4294
4296
|
}, [Q("expand")]), H("button", {
|
|
4295
4297
|
type: "button",
|
|
4296
4298
|
class: "markweave-codeblock-icon-button",
|
|
@@ -4298,40 +4300,41 @@ var Qi = Y({
|
|
|
4298
4300
|
"data-testid": "markweave-mermaid-download",
|
|
4299
4301
|
disabled: !P.value,
|
|
4300
4302
|
onMousedown: $,
|
|
4301
|
-
onClick:
|
|
4303
|
+
onClick: de
|
|
4302
4304
|
}, [Q("download")])]) : null
|
|
4303
4305
|
]) : null,
|
|
4304
|
-
|
|
4306
|
+
j.value && A.value && d.value && E.value ? H("div", {
|
|
4307
|
+
ref: r,
|
|
4305
4308
|
class: "markweave-codeblock-language-menu",
|
|
4306
4309
|
"data-testid": "markweave-codeblock-language-menu",
|
|
4307
|
-
"data-positioned":
|
|
4308
|
-
style:
|
|
4310
|
+
"data-positioned": u.value ? "true" : "false",
|
|
4311
|
+
style: m
|
|
4309
4312
|
}, [H("label", { class: "markweave-codeblock-language-search" }, [H("input", {
|
|
4310
|
-
ref:
|
|
4313
|
+
ref: i,
|
|
4311
4314
|
role: "combobox",
|
|
4312
4315
|
"aria-autocomplete": "list",
|
|
4313
|
-
"aria-controls":
|
|
4316
|
+
"aria-controls": o.value ?? void 0,
|
|
4314
4317
|
"aria-expanded": "true",
|
|
4315
|
-
"aria-activedescendant":
|
|
4318
|
+
"aria-activedescendant": o.value && L.value[p.value] ? vt(o.value, L.value[p.value].language) : void 0,
|
|
4316
4319
|
"aria-label": "Search code block languages",
|
|
4317
|
-
value:
|
|
4320
|
+
value: f.value,
|
|
4318
4321
|
placeholder: "Search...",
|
|
4319
4322
|
"data-testid": "markweave-codeblock-language-search",
|
|
4320
4323
|
onInput: (e) => {
|
|
4321
|
-
|
|
4324
|
+
ce(e.target.value);
|
|
4322
4325
|
},
|
|
4323
|
-
onKeydown:
|
|
4326
|
+
onKeydown: le
|
|
4324
4327
|
}), Q("search")]), H("div", {
|
|
4325
|
-
ref:
|
|
4326
|
-
id:
|
|
4328
|
+
ref: a,
|
|
4329
|
+
id: o.value ?? void 0,
|
|
4327
4330
|
class: "markweave-codeblock-language-list",
|
|
4328
4331
|
role: "listbox",
|
|
4329
4332
|
"aria-label": "Code block languages"
|
|
4330
4333
|
}, L.value.map((e, t) => {
|
|
4331
|
-
let n =
|
|
4334
|
+
let n = E.value?.language === e.language, r = t === p.value;
|
|
4332
4335
|
return H("button", {
|
|
4333
4336
|
key: e.language,
|
|
4334
|
-
id:
|
|
4337
|
+
id: o.value ? vt(o.value, e.language) : void 0,
|
|
4335
4338
|
type: "button",
|
|
4336
4339
|
role: "option",
|
|
4337
4340
|
"aria-selected": n ? "true" : "false",
|
|
@@ -4341,12 +4344,12 @@ var Qi = Y({
|
|
|
4341
4344
|
"data-language-index": t,
|
|
4342
4345
|
onMousedown: $,
|
|
4343
4346
|
onMouseenter: () => {
|
|
4344
|
-
|
|
4347
|
+
p.value = t;
|
|
4345
4348
|
},
|
|
4346
|
-
onClick: () =>
|
|
4349
|
+
onClick: () => se(e.language)
|
|
4347
4350
|
}, [H("span", null, e.label), n ? Q("check") : null]);
|
|
4348
4351
|
}))]) : null,
|
|
4349
|
-
|
|
4352
|
+
g.value ? H("div", {
|
|
4350
4353
|
class: "markweave-mermaid-fullscreen-layer",
|
|
4351
4354
|
role: "dialog",
|
|
4352
4355
|
"aria-modal": "true",
|
|
@@ -4363,41 +4366,41 @@ var Qi = Y({
|
|
|
4363
4366
|
"aria-label": "Zoom out",
|
|
4364
4367
|
"data-testid": "markweave-mermaid-fullscreen-zoom-out",
|
|
4365
4368
|
onMouseenter: () => {
|
|
4366
|
-
|
|
4369
|
+
_.value = "zoom-out";
|
|
4367
4370
|
},
|
|
4368
4371
|
onMouseleave: () => {
|
|
4369
|
-
|
|
4372
|
+
_.value = null;
|
|
4370
4373
|
},
|
|
4371
4374
|
onFocus: () => {
|
|
4372
|
-
|
|
4375
|
+
_.value = "zoom-out";
|
|
4373
4376
|
},
|
|
4374
4377
|
onBlur: () => {
|
|
4375
|
-
|
|
4378
|
+
_.value = null;
|
|
4376
4379
|
},
|
|
4377
|
-
onClick: () =>
|
|
4380
|
+
onClick: () => pe(-Dt)
|
|
4378
4381
|
}, [Q("zoomOut")]),
|
|
4379
4382
|
H("span", {
|
|
4380
4383
|
class: "markweave-mermaid-fullscreen-zoom-label",
|
|
4381
4384
|
"data-testid": "markweave-mermaid-fullscreen-zoom-label"
|
|
4382
|
-
}, mt(
|
|
4385
|
+
}, mt(g.value.scale)),
|
|
4383
4386
|
H("button", {
|
|
4384
4387
|
type: "button",
|
|
4385
4388
|
class: "markweave-mermaid-fullscreen-control",
|
|
4386
4389
|
"aria-label": "Zoom in",
|
|
4387
4390
|
"data-testid": "markweave-mermaid-fullscreen-zoom-in",
|
|
4388
4391
|
onMouseenter: () => {
|
|
4389
|
-
|
|
4392
|
+
_.value = "zoom-in";
|
|
4390
4393
|
},
|
|
4391
4394
|
onMouseleave: () => {
|
|
4392
|
-
|
|
4395
|
+
_.value = null;
|
|
4393
4396
|
},
|
|
4394
4397
|
onFocus: () => {
|
|
4395
|
-
|
|
4398
|
+
_.value = "zoom-in";
|
|
4396
4399
|
},
|
|
4397
4400
|
onBlur: () => {
|
|
4398
|
-
|
|
4401
|
+
_.value = null;
|
|
4399
4402
|
},
|
|
4400
|
-
onClick: () =>
|
|
4403
|
+
onClick: () => pe(Dt)
|
|
4401
4404
|
}, [Q("zoomIn")]),
|
|
4402
4405
|
H("button", {
|
|
4403
4406
|
type: "button",
|
|
@@ -4405,52 +4408,52 @@ var Qi = Y({
|
|
|
4405
4408
|
"aria-label": "Reset zoom",
|
|
4406
4409
|
"data-testid": "markweave-mermaid-fullscreen-reset",
|
|
4407
4410
|
onMouseenter: () => {
|
|
4408
|
-
|
|
4411
|
+
_.value = "reset";
|
|
4409
4412
|
},
|
|
4410
4413
|
onMouseleave: () => {
|
|
4411
|
-
|
|
4414
|
+
_.value = null;
|
|
4412
4415
|
},
|
|
4413
4416
|
onFocus: () => {
|
|
4414
|
-
|
|
4417
|
+
_.value = "reset";
|
|
4415
4418
|
},
|
|
4416
4419
|
onBlur: () => {
|
|
4417
|
-
|
|
4420
|
+
_.value = null;
|
|
4418
4421
|
},
|
|
4419
|
-
onClick:
|
|
4422
|
+
onClick: me
|
|
4420
4423
|
}, [Q("reset")]),
|
|
4421
|
-
|
|
4424
|
+
_.value ? H("span", {
|
|
4422
4425
|
class: "markweave-mermaid-fullscreen-tooltip",
|
|
4423
4426
|
role: "tooltip",
|
|
4424
4427
|
"data-testid": "markweave-mermaid-fullscreen-tooltip"
|
|
4425
|
-
},
|
|
4428
|
+
}, _.value === "zoom-out" ? "Zoom out" : _.value === "zoom-in" ? "Zoom in" : "Reset") : null
|
|
4426
4429
|
]),
|
|
4427
4430
|
H("button", {
|
|
4428
4431
|
type: "button",
|
|
4429
4432
|
class: "markweave-mermaid-fullscreen-close",
|
|
4430
4433
|
"aria-label": "Close fullscreen Mermaid preview",
|
|
4431
4434
|
"data-testid": "markweave-mermaid-fullscreen-close",
|
|
4432
|
-
onClick:
|
|
4435
|
+
onClick: ne
|
|
4433
4436
|
}, [Q("close")]),
|
|
4434
4437
|
H("div", {
|
|
4435
4438
|
class: "markweave-mermaid-fullscreen-viewport",
|
|
4436
4439
|
"data-testid": "markweave-mermaid-fullscreen-viewport",
|
|
4437
|
-
"data-dragging":
|
|
4438
|
-
onWheel:
|
|
4439
|
-
onMousedown:
|
|
4440
|
-
onMousemove:
|
|
4441
|
-
onMouseup:
|
|
4442
|
-
onMouseleave:
|
|
4440
|
+
"data-dragging": v.value ? "true" : "false",
|
|
4441
|
+
onWheel: he,
|
|
4442
|
+
onMousedown: ge,
|
|
4443
|
+
onMousemove: _e,
|
|
4444
|
+
onMouseup: ve,
|
|
4445
|
+
onMouseleave: ve
|
|
4443
4446
|
}, [H("div", {
|
|
4444
4447
|
class: "markweave-mermaid-fullscreen-content",
|
|
4445
4448
|
"data-testid": "markweave-mermaid-fullscreen-content",
|
|
4446
|
-
"data-scale-percent": Math.round(
|
|
4447
|
-
"data-translate": `${Math.round(
|
|
4449
|
+
"data-scale-percent": Math.round(g.value.scale * 100),
|
|
4450
|
+
"data-translate": `${Math.round(g.value.translateX)},${Math.round(g.value.translateY)}`,
|
|
4448
4451
|
style: {
|
|
4449
|
-
width: `${
|
|
4450
|
-
height: `${
|
|
4451
|
-
transform: `translate(${
|
|
4452
|
+
width: `${g.value.width}px`,
|
|
4453
|
+
height: `${g.value.height}px`,
|
|
4454
|
+
transform: `translate(${g.value.translateX}px, ${g.value.translateY}px) scale(${g.value.scale})`
|
|
4452
4455
|
},
|
|
4453
|
-
innerHTML:
|
|
4456
|
+
innerHTML: g.value.svg
|
|
4454
4457
|
})])
|
|
4455
4458
|
]) : null
|
|
4456
4459
|
]);
|
|
@@ -4513,7 +4516,7 @@ var Qi = Y({
|
|
|
4513
4516
|
}
|
|
4514
4517
|
});
|
|
4515
4518
|
function sa(e = {}) {
|
|
4516
|
-
let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Ce(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(an), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(fn), x = U(null), S = U(!1), C = W(null), w =
|
|
4519
|
+
let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Ce(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(an), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(fn), x = U(null), S = U(!1), C = W(null), w = V(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
|
|
4517
4520
|
function O() {
|
|
4518
4521
|
D !== null && (window.clearTimeout(D), D = null), d.value += 1;
|
|
4519
4522
|
}
|
|
@@ -4527,12 +4530,12 @@ function sa(e = {}) {
|
|
|
4527
4530
|
extensions: Bi({
|
|
4528
4531
|
lang: i,
|
|
4529
4532
|
linkCardResolver: e.linkCardResolver,
|
|
4530
|
-
onImageUpload: (e) => A?.(e) ??
|
|
4531
|
-
onVideoUpload: (e) => A?.(e) ??
|
|
4533
|
+
onImageUpload: (e) => A?.(e) ?? L(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4534
|
+
onVideoUpload: (e) => A?.(e) ?? L(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
|
|
4532
4535
|
resolveMediaSource: e.resolveMediaSource
|
|
4533
4536
|
}),
|
|
4534
4537
|
content: T,
|
|
4535
|
-
contentType:
|
|
4538
|
+
contentType: ae(w),
|
|
4536
4539
|
editable: u.value,
|
|
4537
4540
|
autofocus: e.autofocus,
|
|
4538
4541
|
editorProps: {
|
|
@@ -4548,34 +4551,34 @@ function sa(e = {}) {
|
|
|
4548
4551
|
handleClick: (e, t, n) => {
|
|
4549
4552
|
if (!u.value) return he(n);
|
|
4550
4553
|
let r = Rt(e, n);
|
|
4551
|
-
return r ? (n.preventDefault(), n.stopPropagation(),
|
|
4554
|
+
return r ? (n.preventDefault(), n.stopPropagation(), I(), Ht(e, r, !0), Ut(e, r), y.value = r, !0) : (y.value = null, !1);
|
|
4552
4555
|
},
|
|
4553
4556
|
handleDOMEvents: {
|
|
4554
4557
|
compositionstart: () => u.value ? (h.value = on(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
|
|
4555
|
-
compositionend: (e) => (u.value && window.setTimeout(() =>
|
|
4558
|
+
compositionend: (e) => (u.value && window.setTimeout(() => te(e), 0), !1),
|
|
4556
4559
|
click: (e, t) => {
|
|
4557
4560
|
if (!u.value) return he(t);
|
|
4558
4561
|
let n = Rt(e, t);
|
|
4559
|
-
return n ? (t.preventDefault(), t.stopPropagation(),
|
|
4562
|
+
return n ? (t.preventDefault(), t.stopPropagation(), I(), Ht(e, n, !0), Ut(e, n), y.value = n, !0) : (y.value = null, !1);
|
|
4560
4563
|
}
|
|
4561
4564
|
}
|
|
4562
4565
|
},
|
|
4563
|
-
onSelectionUpdate: ({ editor: e }) =>
|
|
4566
|
+
onSelectionUpdate: ({ editor: e }) => z(e),
|
|
4564
4567
|
onCreate: ({ editor: t }) => {
|
|
4565
4568
|
p(t, {
|
|
4566
4569
|
mode: c.value,
|
|
4567
4570
|
editable: u.value
|
|
4568
|
-
}), Gt(t, l.value), Kt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && ln(t),
|
|
4571
|
+
}), Gt(t, l.value), Kt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && ln(t), re(t), z(t), O();
|
|
4569
4572
|
},
|
|
4570
4573
|
onTransaction: ({ editor: e, transaction: t }) => {
|
|
4571
|
-
if (
|
|
4574
|
+
if (re(e), (t.docChanged || Wt(t)) && k(), t.docChanged && y.value) {
|
|
4572
4575
|
let t = Lt(e, y.value.pos);
|
|
4573
4576
|
y.value = t?.kind === y.value.kind ? t : null;
|
|
4574
4577
|
}
|
|
4575
4578
|
},
|
|
4576
4579
|
onUpdate: ({ editor: t }) => {
|
|
4577
|
-
|
|
4578
|
-
let i =
|
|
4580
|
+
z(t), u.value && R(t), S.value || e.onUpdate?.(ie(t, { onContentRead: (n, r) => {
|
|
4581
|
+
let i = V(e.contentFormat);
|
|
4579
4582
|
e.content !== void 0 && n === i && (C.value = {
|
|
4580
4583
|
content: r,
|
|
4581
4584
|
format: n,
|
|
@@ -4583,12 +4586,16 @@ function sa(e = {}) {
|
|
|
4583
4586
|
});
|
|
4584
4587
|
} }));
|
|
4585
4588
|
}
|
|
4586
|
-
})
|
|
4587
|
-
let M =
|
|
4588
|
-
|
|
4589
|
+
});
|
|
4590
|
+
let M = j.value, ee = we(M), N = !1, P = !1;
|
|
4591
|
+
J(() => {
|
|
4592
|
+
N || j.value !== M || (P = !0, e.onAiEditControllerChange?.(ee));
|
|
4593
|
+
});
|
|
4594
|
+
let F = G(() => j.value ?? null);
|
|
4595
|
+
function I() {
|
|
4589
4596
|
g.value = null, _.value = null, h.value = an;
|
|
4590
4597
|
}
|
|
4591
|
-
function
|
|
4598
|
+
function te(e) {
|
|
4592
4599
|
let t = nn(e.state);
|
|
4593
4600
|
if (!t) {
|
|
4594
4601
|
h.value = h.value.name === "idle" ? h.value : an, g.value = null, _.value = null;
|
|
@@ -4596,7 +4603,7 @@ function sa(e = {}) {
|
|
|
4596
4603
|
}
|
|
4597
4604
|
let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
|
|
4598
4605
|
if (!rn(r, { frameRect: i })) {
|
|
4599
|
-
|
|
4606
|
+
I();
|
|
4600
4607
|
return;
|
|
4601
4608
|
}
|
|
4602
4609
|
let a = tn(n, {
|
|
@@ -4605,10 +4612,10 @@ function sa(e = {}) {
|
|
|
4605
4612
|
});
|
|
4606
4613
|
Qt(g.value, a) || (g.value = a), h.value = en(h.value, t);
|
|
4607
4614
|
}
|
|
4608
|
-
function
|
|
4609
|
-
|
|
4615
|
+
function R(e) {
|
|
4616
|
+
te(e.view);
|
|
4610
4617
|
}
|
|
4611
|
-
function
|
|
4618
|
+
function z(e) {
|
|
4612
4619
|
let t = ye(e);
|
|
4613
4620
|
_e(m.value, t) || (m.value = t);
|
|
4614
4621
|
let n = zt(e);
|
|
@@ -4616,56 +4623,56 @@ function sa(e = {}) {
|
|
|
4616
4623
|
let r = Qe(e);
|
|
4617
4624
|
r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
|
|
4618
4625
|
}
|
|
4619
|
-
function
|
|
4626
|
+
function re(e) {
|
|
4620
4627
|
b.value = Ui(e);
|
|
4621
4628
|
}
|
|
4622
|
-
let
|
|
4623
|
-
active:
|
|
4629
|
+
let ce = G(() => F.value ? Qe(F.value) : Hi), le = G(() => F.value ? un(F.value.state) : Vi), ue = G(() => m.value?.currentNode === "codeBlock"), de = G(() => ue.value && ce.value.language === "mermaid"), fe = G(() => F.value ? Jt({
|
|
4630
|
+
active: de.value,
|
|
4624
4631
|
mode: v.value,
|
|
4625
|
-
source:
|
|
4632
|
+
source: ce.value.text
|
|
4626
4633
|
}) : Jt({
|
|
4627
4634
|
active: !1,
|
|
4628
4635
|
mode: "code",
|
|
4629
4636
|
source: ""
|
|
4630
|
-
})),
|
|
4637
|
+
})), pe = G(() => F.value && e.onRuntimeStateChange ? cn(F.value.state) : null), me = G(() => F.value ? Ge(F.value.state) : Ue.items), ve = G(() => Ke(me.value, x.value)), xe = G(() => He(me.value, ve.value)), Se = G(() => Yt(h.value.query, s)), Te = G(() => ge({
|
|
4631
4638
|
revision: d.value,
|
|
4632
4639
|
mode: c.value,
|
|
4633
4640
|
editable: u.value,
|
|
4634
|
-
toc:
|
|
4641
|
+
toc: xe.value,
|
|
4635
4642
|
selection: m.value,
|
|
4636
4643
|
slash: h.value,
|
|
4637
|
-
table:
|
|
4644
|
+
table: le.value,
|
|
4638
4645
|
tableInteraction: b.value,
|
|
4639
|
-
codeBlock:
|
|
4640
|
-
mermaid:
|
|
4641
|
-
tableDebugSnapshot:
|
|
4642
|
-
})),
|
|
4643
|
-
closeSlashMenu:
|
|
4644
|
-
focusFirstTableBodyCell: () =>
|
|
4646
|
+
codeBlock: ce.value,
|
|
4647
|
+
mermaid: fe.value,
|
|
4648
|
+
tableDebugSnapshot: pe.value
|
|
4649
|
+
})), Ee = {
|
|
4650
|
+
closeSlashMenu: I,
|
|
4651
|
+
focusFirstTableBodyCell: () => F.value ? ln(F.value) : !1,
|
|
4645
4652
|
setContent: (e, t = {}) => {
|
|
4646
|
-
if (!
|
|
4647
|
-
let n =
|
|
4648
|
-
return
|
|
4649
|
-
contentType:
|
|
4653
|
+
if (!F.value) return !1;
|
|
4654
|
+
let n = V(t.format);
|
|
4655
|
+
return F.value.commands.setContent(e, {
|
|
4656
|
+
contentType: ae(n),
|
|
4650
4657
|
emitUpdate: t.emitUpdate ?? !1
|
|
4651
|
-
}), t.focusFirstTableBodyCell && ln(
|
|
4658
|
+
}), t.focusFirstTableBodyCell && ln(F.value), z(F.value), u.value && R(F.value), re(F.value), O(), !0;
|
|
4652
4659
|
}
|
|
4653
4660
|
};
|
|
4654
|
-
function
|
|
4655
|
-
if (!(!
|
|
4661
|
+
function De(e, t) {
|
|
4662
|
+
if (!(!F.value || !u.value || !Xt(e))) {
|
|
4656
4663
|
if (e.inputKind && !t?.emoji && !t?.uploadResult) {
|
|
4657
4664
|
_.value = e;
|
|
4658
4665
|
return;
|
|
4659
4666
|
}
|
|
4660
|
-
$t(
|
|
4667
|
+
$t(F.value, h.value, e, t), h.value = on(h.value, { type: "execute" }), I();
|
|
4661
4668
|
}
|
|
4662
4669
|
}
|
|
4663
|
-
function
|
|
4664
|
-
if (!
|
|
4665
|
-
let t = Zt(h.value,
|
|
4670
|
+
function Oe(e) {
|
|
4671
|
+
if (!F.value || _.value || !u.value) return;
|
|
4672
|
+
let t = Zt(h.value, Se.value, e.key, { isComposing: e.isComposing || ne(F.value.state) });
|
|
4666
4673
|
if (t.type !== "ignore") {
|
|
4667
4674
|
if (e.preventDefault(), t.type === "close") {
|
|
4668
|
-
h.value = on(h.value, { type: "escape" }),
|
|
4675
|
+
h.value = on(h.value, { type: "escape" }), I();
|
|
4669
4676
|
return;
|
|
4670
4677
|
}
|
|
4671
4678
|
if (t.type === "move-active") {
|
|
@@ -4676,91 +4683,91 @@ function sa(e = {}) {
|
|
|
4676
4683
|
});
|
|
4677
4684
|
return;
|
|
4678
4685
|
}
|
|
4679
|
-
|
|
4686
|
+
De(t.command);
|
|
4680
4687
|
}
|
|
4681
4688
|
}
|
|
4682
4689
|
K(() => [e.mode, e.editable], () => {
|
|
4683
|
-
c.value = f(e.mode),
|
|
4690
|
+
c.value = f(e.mode), F.value && (F.value.setEditable(u.value), p(F.value, {
|
|
4684
4691
|
mode: c.value,
|
|
4685
4692
|
editable: u.value
|
|
4686
|
-
}), Kt(
|
|
4693
|
+
}), Kt(F.value, u.value ? "live" : "view"), O(), u.value || I());
|
|
4687
4694
|
}, { immediate: !0 }), K(() => e.theme, () => {
|
|
4688
|
-
|
|
4695
|
+
F.value && Gt(F.value, l.value);
|
|
4689
4696
|
}, { immediate: !0 }), K(() => e.content, (t) => {
|
|
4690
|
-
let n =
|
|
4691
|
-
if (!(!
|
|
4692
|
-
if (
|
|
4697
|
+
let n = V(e.contentFormat);
|
|
4698
|
+
if (!(!F.value || t === void 0)) {
|
|
4699
|
+
if (se(F.value, C.value, t, n)) {
|
|
4693
4700
|
C.value = null;
|
|
4694
4701
|
return;
|
|
4695
4702
|
}
|
|
4696
|
-
C.value = null, !
|
|
4697
|
-
contentType:
|
|
4703
|
+
C.value = null, !oe(F.value, t, n) && (S.value = !0, F.value.commands.setContent(t, {
|
|
4704
|
+
contentType: ae(n),
|
|
4698
4705
|
emitUpdate: !1
|
|
4699
|
-
}), S.value = !1,
|
|
4706
|
+
}), S.value = !1, z(F.value), u.value && R(F.value), re(F.value), O());
|
|
4700
4707
|
}
|
|
4701
|
-
}), K(
|
|
4708
|
+
}), K(Te, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(xe, (t) => e.onTocChange?.(t), { immediate: !0 }), K(me, (e) => {
|
|
4702
4709
|
let t = Ke(e, x.value);
|
|
4703
4710
|
x.value !== t && (x.value = t);
|
|
4704
4711
|
});
|
|
4705
|
-
let
|
|
4706
|
-
|
|
4707
|
-
}),
|
|
4708
|
-
g.value &&
|
|
4712
|
+
let ke = B(() => {
|
|
4713
|
+
F.value && g.value && te(F.value.view);
|
|
4714
|
+
}), Ae = () => {
|
|
4715
|
+
g.value && ke.schedule();
|
|
4709
4716
|
};
|
|
4710
4717
|
K(g, (e) => {
|
|
4711
|
-
e ?
|
|
4718
|
+
e ? Ae() : ke.cancel();
|
|
4712
4719
|
}), nr(() => {
|
|
4713
|
-
window.addEventListener("resize",
|
|
4720
|
+
window.addEventListener("resize", Ae), window.addEventListener("scroll", Ae, !0);
|
|
4714
4721
|
}), q(() => {
|
|
4715
|
-
|
|
4722
|
+
ke.cancel(), window.removeEventListener("resize", Ae), window.removeEventListener("scroll", Ae, !0);
|
|
4716
4723
|
});
|
|
4717
|
-
let
|
|
4724
|
+
let je = null;
|
|
4718
4725
|
return q(() => {
|
|
4719
4726
|
D !== null && window.clearTimeout(D);
|
|
4720
4727
|
}), nr(() => {
|
|
4721
4728
|
let e = () => {
|
|
4722
|
-
if (!
|
|
4729
|
+
if (!F.value || !me.value.length) {
|
|
4723
4730
|
x.value = null;
|
|
4724
4731
|
return;
|
|
4725
4732
|
}
|
|
4726
4733
|
let e = null;
|
|
4727
4734
|
try {
|
|
4728
|
-
e = We(
|
|
4735
|
+
e = We(F.value, me.value);
|
|
4729
4736
|
} catch {
|
|
4730
4737
|
return;
|
|
4731
4738
|
}
|
|
4732
4739
|
x.value !== e && (x.value = e);
|
|
4733
|
-
}, t = () => window.requestAnimationFrame(e), n = Wi(
|
|
4734
|
-
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(),
|
|
4740
|
+
}, t = () => window.requestAnimationFrame(e), n = Wi(F.value?.view.dom ?? null);
|
|
4741
|
+
window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), je = () => {
|
|
4735
4742
|
window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
|
|
4736
4743
|
};
|
|
4737
4744
|
}), q(() => {
|
|
4738
|
-
|
|
4745
|
+
je?.(), N = !0, P && e.onAiEditControllerChange?.(null);
|
|
4739
4746
|
let t = j.value;
|
|
4740
4747
|
j.value = null, J(() => t?.destroy());
|
|
4741
4748
|
}), {
|
|
4742
|
-
editor:
|
|
4743
|
-
runtimeSnapshot:
|
|
4744
|
-
actions:
|
|
4749
|
+
editor: F,
|
|
4750
|
+
runtimeSnapshot: Te,
|
|
4751
|
+
actions: Ee,
|
|
4745
4752
|
__render: {
|
|
4746
4753
|
messages: o,
|
|
4747
4754
|
effectiveEditable: u,
|
|
4748
|
-
tableFocusState:
|
|
4755
|
+
tableFocusState: le,
|
|
4749
4756
|
tableInteractionState: b,
|
|
4750
|
-
codeBlockState:
|
|
4751
|
-
isCodeBlockActive:
|
|
4757
|
+
codeBlockState: ce,
|
|
4758
|
+
isCodeBlockActive: ue,
|
|
4752
4759
|
mermaidMode: v,
|
|
4753
4760
|
mathTarget: y,
|
|
4754
4761
|
setMermaidMode: (e) => {
|
|
4755
4762
|
v.value = e;
|
|
4756
4763
|
},
|
|
4757
|
-
tocState:
|
|
4758
|
-
filteredSlashCommands:
|
|
4764
|
+
tocState: xe,
|
|
4765
|
+
filteredSlashCommands: Se,
|
|
4759
4766
|
slashState: h,
|
|
4760
4767
|
slashMenuPosition: g,
|
|
4761
4768
|
slashInputCommand: _,
|
|
4762
|
-
runSlashCommand:
|
|
4763
|
-
handleEditorKeyDown:
|
|
4769
|
+
runSlashCommand: De,
|
|
4770
|
+
handleEditorKeyDown: Oe,
|
|
4764
4771
|
setSlashInputCommand: (e) => {
|
|
4765
4772
|
_.value = e;
|
|
4766
4773
|
}
|
|
@@ -4959,4 +4966,4 @@ var ca = Y({
|
|
|
4959
4966
|
}
|
|
4960
4967
|
});
|
|
4961
4968
|
//#endregion
|
|
4962
|
-
export { ca as MarkweaveEditor,
|
|
4969
|
+
export { ca as MarkweaveEditor, R as createMarkweaveAiEditController, Bi as createMarkweaveEditorExtensions, Bi as createMarkweaveVue2EditorExtensions, sa as useMarkweaveEditorController };
|