@toantranmei/editor 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{css-Cf_w91Fs.js → css-B-tIYjEV.js} +23 -7
- package/dist/css-B-tIYjEV.js.map +1 -0
- package/dist/index.js +984 -835
- package/dist/index.js.map +1 -1
- package/dist/nuxt.js +1 -1
- package/dist/render.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/TableControls.vue.d.ts +2 -1
- package/dist/types/extensions/handle-gutter.d.ts +17 -0
- package/dist/types/theme/tokens.d.ts +32 -3
- package/package.json +1 -1
- package/dist/css-Cf_w91Fs.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as g, u as _, v, x as y, y as b } from "./date-utils-CevhhRfQ.js";
|
|
2
|
-
import { a as x, c as S, d as
|
|
3
|
-
import { t as
|
|
4
|
-
import { Fragment as
|
|
2
|
+
import { a as x, c as S, d as C, f as w, i as T, l as E, n as D, r as O, s as k, u as A } from "./css-B-tIYjEV.js";
|
|
3
|
+
import { t as j } from "./block-names-QblT9TgF.js";
|
|
4
|
+
import { Fragment as M, Teleport as ee, computed as N, createBlock as P, createCommentVNode as F, createElementBlock as I, createElementVNode as L, createTextVNode as R, createVNode as z, defineComponent as B, inject as te, mergeProps as V, nextTick as ne, normalizeClass as H, normalizeStyle as U, onBeforeUnmount as W, onMounted as re, openBlock as G, reactive as ie, readonly as ae, ref as K, renderList as q, resolveDynamicComponent as J, shallowReactive as oe, shallowRef as se, toDisplayString as Y, toRaw as ce, unref as X, useId as le, vModelText as ue, watch as Z, watchEffect as de, withCtx as fe, withDirectives as pe, withKeys as me, withModifiers as Q } from "vue";
|
|
5
5
|
import { Editor as he, EditorContent as ge, NodeViewContent as _e, NodeViewWrapper as ve, VueNodeViewRenderer as ye, VueRenderer as be, nodeViewProps as xe } from "@tiptap/vue-3";
|
|
6
6
|
import { DragHandle as Se } from "@tiptap/extension-drag-handle-vue-3";
|
|
7
7
|
import { AlignCenter as Ce, AlignLeft as we, AlignRight as Te, ArrowDown as Ee, ArrowDownToLine as De, ArrowLeft as Oe, ArrowLeftToLine as ke, ArrowRight as Ae, ArrowRightToLine as je, ArrowUp as Me, ArrowUpToLine as Ne, AtSign as Pe, AudioLines as Fe, Baseline as Ie, Bold as Le, Calendar as Re, Captions as ze, Check as Be, ChevronDown as Ve, ChevronLeft as He, ChevronRight as Ue, CircleQuestionMark as We, Code as Ge, CodeXml as Ke, Columns2 as qe, Columns3 as Je, Columns4 as Ye, Copy as Xe, Crop as Ze, Download as Qe, Ellipsis as $e, Eraser as et, ExternalLink as tt, Eye as nt, File as rt, FileText as it, Film as at, GripHorizontal as ot, GripVertical as st, Heading1 as ct, Heading2 as lt, Heading3 as ut, Heading4 as dt, Image as ft, Italic as pt, Lightbulb as mt, Link as ht, Link2 as gt, List as _t, ListCollapse as vt, ListOrdered as yt, ListTodo as bt, Maximize2 as xt, Minus as St, Palette as Ct, PanelLeft as wt, PanelTop as Tt, Plus as Et, Pointer as Dt, Quote as Ot, Radical as kt, RefreshCw as At, Repeat2 as jt, Search as Mt, Sigma as Nt, Strikethrough as Pt, Table as Ft, TableCellsMerge as It, TableCellsSplit as Lt, TableOfContents as Rt, Trash as zt, Type as Bt, Underline as Vt, Unlink as Ht, Upload as Ut, User as Wt, Video as Gt, Workflow as Kt, X as qt, ZoomIn as Jt } from "@lucide/vue";
|
|
@@ -1397,7 +1397,7 @@ var Gi = Xt.create({
|
|
|
1397
1397
|
});
|
|
1398
1398
|
// src/composables/useScope.ts
|
|
1399
1399
|
function $i(e) {
|
|
1400
|
-
return
|
|
1400
|
+
return N(() => e()?.storage.meiConfig?.scope ?? {
|
|
1401
1401
|
class: ["me-scope"],
|
|
1402
1402
|
"data-me-id": ""
|
|
1403
1403
|
});
|
|
@@ -1430,7 +1430,7 @@ var ta = { class: "me-menu-label" }, na = [
|
|
|
1430
1430
|
}, la = {
|
|
1431
1431
|
key: 1,
|
|
1432
1432
|
class: "me-menu-empty"
|
|
1433
|
-
}, ua = /* @__PURE__ */
|
|
1433
|
+
}, ua = /* @__PURE__ */ B({
|
|
1434
1434
|
__name: "SlashMenu",
|
|
1435
1435
|
props: {
|
|
1436
1436
|
editor: {},
|
|
@@ -1439,7 +1439,7 @@ var ta = { class: "me-menu-label" }, na = [
|
|
|
1439
1439
|
command: { type: Function }
|
|
1440
1440
|
},
|
|
1441
1441
|
setup(e, { expose: t }) {
|
|
1442
|
-
let n = e, r = K(0), i = K(null), a =
|
|
1442
|
+
let n = e, r = K(0), i = K(null), a = N(() => n.editor.storage.meiConfig.messages), o = $i(() => n.editor), s = N(() => {
|
|
1443
1443
|
if (n.query.trim()) return [[a.value.slash.results, n.items.map((e, t) => ({
|
|
1444
1444
|
item: e,
|
|
1445
1445
|
index: t
|
|
@@ -1453,7 +1453,7 @@ var ta = { class: "me-menu-label" }, na = [
|
|
|
1453
1453
|
}), [...e.entries()];
|
|
1454
1454
|
});
|
|
1455
1455
|
Z(() => n.items, () => r.value = 0), Z(r, async (e) => {
|
|
1456
|
-
await
|
|
1456
|
+
await ne(), i.value?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({ block: "nearest" });
|
|
1457
1457
|
});
|
|
1458
1458
|
function c(e) {
|
|
1459
1459
|
let t = n.items[e];
|
|
@@ -1465,25 +1465,25 @@ var ta = { class: "me-menu-label" }, na = [
|
|
|
1465
1465
|
}
|
|
1466
1466
|
t({ onKeyDown: l });
|
|
1467
1467
|
let u = ea();
|
|
1468
|
-
return (t, n) => (G(),
|
|
1468
|
+
return (t, n) => (G(), I("div", V({
|
|
1469
1469
|
ref_key: "listEl",
|
|
1470
1470
|
ref: i
|
|
1471
|
-
}, X(o), { class: "me-popover me-menu" }), [e.items.length ? (G(!0),
|
|
1471
|
+
}, X(o), { class: "me-popover me-menu" }), [e.items.length ? (G(!0), I(M, { key: 0 }, q(s.value, ([e, t]) => (G(), I("div", { key: e }, [L("div", ta, Y(e), 1), (G(!0), I(M, null, q(t, ({ item: e, index: t }) => (G(), I("button", {
|
|
1472
1472
|
key: e.key,
|
|
1473
1473
|
type: "button",
|
|
1474
1474
|
"data-index": t,
|
|
1475
|
-
class:
|
|
1475
|
+
class: H(["me-menu-item", { "is-active": t === r.value }]),
|
|
1476
1476
|
onMousemove: (e) => X(u)(e) && (r.value = t),
|
|
1477
1477
|
onMousedown: Q((e) => c(t), ["prevent"])
|
|
1478
1478
|
}, [
|
|
1479
|
-
e.swatch ? (G(),
|
|
1479
|
+
e.swatch ? (G(), I("span", {
|
|
1480
1480
|
key: 0,
|
|
1481
|
-
class:
|
|
1481
|
+
class: H(["me-menu-icon", e.swatch.kind === "text" ? "me-swatch--text" : "me-swatch--bg"]),
|
|
1482
1482
|
"data-color": e.swatch.color
|
|
1483
|
-
}, "A", 10, ra)) : (G(),
|
|
1484
|
-
|
|
1485
|
-
e.shortcut ? (G(),
|
|
1486
|
-
], 42, na))), 128))]))), 128)) : (G(),
|
|
1483
|
+
}, "A", 10, ra)) : (G(), I("span", ia, [(G(), P(J(e.icon)))])),
|
|
1484
|
+
L("span", aa, [L("span", oa, Y(e.title), 1), e.description ? (G(), I("span", sa, Y(e.description), 1)) : F("", !0)]),
|
|
1485
|
+
e.shortcut ? (G(), I("span", ca, Y(e.shortcut), 1)) : F("", !0)
|
|
1486
|
+
], 42, na))), 128))]))), 128)) : (G(), I("div", la, Y(a.value.slash.empty), 1))], 16));
|
|
1487
1487
|
}
|
|
1488
1488
|
}), da = "mei-editor:recent", fa = 5;
|
|
1489
1489
|
function pa() {
|
|
@@ -1556,7 +1556,7 @@ function ba(e) {
|
|
|
1556
1556
|
}
|
|
1557
1557
|
function xa(e) {
|
|
1558
1558
|
let t = e.storage.meiConfig.messages;
|
|
1559
|
-
return ["text", "bg"].flatMap((e) =>
|
|
1559
|
+
return ["text", "bg"].flatMap((e) => k.map((n) => {
|
|
1560
1560
|
let r = t.colors[n] ?? n, i = e === "text" ? t.slash.textColor(r) : t.slash.bgColor(r);
|
|
1561
1561
|
return {
|
|
1562
1562
|
key: `color-${e}-${n}`,
|
|
@@ -1607,7 +1607,7 @@ function Sa(e, t) {
|
|
|
1607
1607
|
function Ca(e, t, n = 0) {
|
|
1608
1608
|
if (!e || typeof getComputedStyle > "u") return n;
|
|
1609
1609
|
let r = document.createElement("div");
|
|
1610
|
-
r.style.cssText = `position:absolute;visibility:hidden;width:var(${
|
|
1610
|
+
r.style.cssText = `position:absolute;visibility:hidden;width:var(${w(t)})`, e.appendChild(r);
|
|
1611
1611
|
let i = r.getBoundingClientRect().width;
|
|
1612
1612
|
return r.remove(), i || n;
|
|
1613
1613
|
}
|
|
@@ -1878,7 +1878,7 @@ function Ua(e) {
|
|
|
1878
1878
|
let t = K(e.isEditable), n = () => {
|
|
1879
1879
|
t.value !== e.isEditable && (t.value = e.isEditable);
|
|
1880
1880
|
};
|
|
1881
|
-
return e.on("update", n),
|
|
1881
|
+
return e.on("update", n), W(() => e.off("update", n)), ae(t);
|
|
1882
1882
|
}
|
|
1883
1883
|
// src/composables/useClickOutside.ts
|
|
1884
1884
|
function Wa(e, t, n) {
|
|
@@ -1887,7 +1887,7 @@ function Wa(e, t, n) {
|
|
|
1887
1887
|
let i = e.value, a = i instanceof Element ? i : i?.$el;
|
|
1888
1888
|
a instanceof Element && !a.contains(r.target) && n();
|
|
1889
1889
|
};
|
|
1890
|
-
|
|
1890
|
+
re(() => document.addEventListener("pointerdown", r, !0)), W(() => document.removeEventListener("pointerdown", r, !0));
|
|
1891
1891
|
}
|
|
1892
1892
|
// src/nodeviews/CalloutView.vue?vue&type=script&setup=true&lang.ts
|
|
1893
1893
|
var Ga = ["title", "disabled"], Ka = {
|
|
@@ -1897,7 +1897,7 @@ var Ga = ["title", "disabled"], Ka = {
|
|
|
1897
1897
|
"data-color",
|
|
1898
1898
|
"title",
|
|
1899
1899
|
"onClick"
|
|
1900
|
-
], $a = /* @__PURE__ */
|
|
1900
|
+
], $a = /* @__PURE__ */ B({
|
|
1901
1901
|
__name: "CalloutView",
|
|
1902
1902
|
props: xe,
|
|
1903
1903
|
setup(e) {
|
|
@@ -1916,7 +1916,7 @@ var Ga = ["title", "disabled"], Ka = {
|
|
|
1916
1916
|
"🎯"
|
|
1917
1917
|
], i = K(!1), a = K(null);
|
|
1918
1918
|
Wa(a, i, () => i.value = !1);
|
|
1919
|
-
let o =
|
|
1919
|
+
let o = N(() => t.editor.storage.meiConfig.messages), s = K(null), c = K(null), l = K(0);
|
|
1920
1920
|
function u() {
|
|
1921
1921
|
let e = s.value?.$el.querySelector(".me-callout-content"), t = e?.firstElementChild;
|
|
1922
1922
|
if (!e || !(t instanceof HTMLElement) || !c.value) return;
|
|
@@ -1924,25 +1924,25 @@ var Ga = ["title", "disabled"], Ka = {
|
|
|
1924
1924
|
l.value = Math.round(r - c.value.offsetHeight / 2);
|
|
1925
1925
|
}
|
|
1926
1926
|
let d = null;
|
|
1927
|
-
return
|
|
1927
|
+
return re(() => {
|
|
1928
1928
|
if (u(), typeof ResizeObserver < "u") {
|
|
1929
1929
|
d = new ResizeObserver(() => u());
|
|
1930
1930
|
let e = s.value?.$el.querySelector(".me-callout-content");
|
|
1931
1931
|
e && d.observe(e);
|
|
1932
1932
|
}
|
|
1933
|
-
}), Z(() => t.node, () =>
|
|
1933
|
+
}), Z(() => t.node, () => ne(u)), W(() => d?.disconnect()), (e, t) => (G(), P(X(ve), {
|
|
1934
1934
|
ref_key: "root",
|
|
1935
1935
|
ref: s,
|
|
1936
1936
|
class: "me-callout",
|
|
1937
1937
|
"data-color": e.node.attrs.color
|
|
1938
1938
|
}, {
|
|
1939
|
-
default: fe(() => [
|
|
1939
|
+
default: fe(() => [L("div", {
|
|
1940
1940
|
ref_key: "pickerEl",
|
|
1941
1941
|
ref: a,
|
|
1942
1942
|
class: "me-callout-icon-wrap",
|
|
1943
1943
|
contenteditable: "false",
|
|
1944
|
-
style:
|
|
1945
|
-
}, [
|
|
1944
|
+
style: U({ marginTop: `${l.value}px` })
|
|
1945
|
+
}, [L("button", {
|
|
1946
1946
|
ref_key: "iconEl",
|
|
1947
1947
|
ref: c,
|
|
1948
1948
|
type: "button",
|
|
@@ -1950,9 +1950,9 @@ var Ga = ["title", "disabled"], Ka = {
|
|
|
1950
1950
|
title: o.value.callout.change,
|
|
1951
1951
|
disabled: !X(n),
|
|
1952
1952
|
onClick: t[0] ||= (e) => i.value = !i.value
|
|
1953
|
-
}, Y(e.node.attrs.icon), 9, Ga), i.value ? (G(),
|
|
1954
|
-
|
|
1955
|
-
|
|
1953
|
+
}, Y(e.node.attrs.icon), 9, Ga), i.value ? (G(), I("div", Ka, [
|
|
1954
|
+
L("div", qa, Y(o.value.callout.icon), 1),
|
|
1955
|
+
L("div", Ja, [(G(), I(M, null, q(r, (t) => L("button", {
|
|
1956
1956
|
key: t,
|
|
1957
1957
|
type: "button",
|
|
1958
1958
|
class: "me-emoji",
|
|
@@ -1960,16 +1960,16 @@ var Ga = ["title", "disabled"], Ka = {
|
|
|
1960
1960
|
e.updateAttributes({ icon: t }), i.value = !1;
|
|
1961
1961
|
}
|
|
1962
1962
|
}, Y(t), 9, Ya)), 64))]),
|
|
1963
|
-
|
|
1964
|
-
|
|
1963
|
+
L("div", Xa, Y(o.value.callout.background), 1),
|
|
1964
|
+
L("div", Za, [(G(!0), I(M, null, q(X(k), (t) => (G(), I("button", {
|
|
1965
1965
|
key: t,
|
|
1966
1966
|
type: "button",
|
|
1967
|
-
class:
|
|
1967
|
+
class: H(["me-swatch-btn", { "is-active": e.node.attrs.color === t }]),
|
|
1968
1968
|
"data-color": t,
|
|
1969
1969
|
title: o.value.colors[t],
|
|
1970
1970
|
onClick: (n) => e.updateAttributes({ color: t })
|
|
1971
1971
|
}, null, 10, Qa))), 128))])
|
|
1972
|
-
])) :
|
|
1972
|
+
])) : F("", !0)], 4), z(X(_e), { class: "me-callout-content" })]),
|
|
1973
1973
|
_: 1
|
|
1974
1974
|
}, 8, ["data-color"]));
|
|
1975
1975
|
}
|
|
@@ -2021,7 +2021,7 @@ function io() {
|
|
|
2021
2021
|
var ao = ["aria-label"], oo = ["innerHTML"], so = {
|
|
2022
2022
|
key: 1,
|
|
2023
2023
|
class: "me-error"
|
|
2024
|
-
}, co = 0, lo = () => `me-mermaid-${++co}`, uo = /* @__PURE__ */
|
|
2024
|
+
}, co = 0, lo = () => `me-mermaid-${++co}`, uo = /* @__PURE__ */ B({
|
|
2025
2025
|
__name: "MermaidDiagram",
|
|
2026
2026
|
props: {
|
|
2027
2027
|
code: {},
|
|
@@ -2063,54 +2063,54 @@ var ao = ["aria-label"], oo = ["innerHTML"], so = {
|
|
|
2063
2063
|
}
|
|
2064
2064
|
Z(() => [t.code, t.dark], () => {
|
|
2065
2065
|
clearTimeout(i), i = setTimeout(o, 300);
|
|
2066
|
-
}, { immediate: !0 }),
|
|
2067
|
-
let s =
|
|
2068
|
-
return (e, t) => (G(),
|
|
2066
|
+
}, { immediate: !0 }), W(() => clearTimeout(i));
|
|
2067
|
+
let s = N(() => t.messages.mermaid.preview);
|
|
2068
|
+
return (e, t) => (G(), I("div", {
|
|
2069
2069
|
class: "me-mermaid",
|
|
2070
2070
|
contenteditable: "false",
|
|
2071
2071
|
"aria-label": s.value
|
|
2072
|
-
}, [n.value ? (G(),
|
|
2072
|
+
}, [n.value ? (G(), I("div", {
|
|
2073
2073
|
key: 0,
|
|
2074
2074
|
class: "me-mermaid-svg",
|
|
2075
2075
|
innerHTML: n.value
|
|
2076
|
-
}, null, 8, oo)) :
|
|
2076
|
+
}, null, 8, oo)) : F("", !0), r.value ? (G(), I("p", so, Y(r.value), 1)) : F("", !0)], 8, ao));
|
|
2077
2077
|
}
|
|
2078
2078
|
}), fo = {
|
|
2079
2079
|
class: "me-block-bar me-code-toolbar",
|
|
2080
2080
|
contenteditable: "false"
|
|
2081
|
-
}, po = { class: "me-code-lang" }, mo = ["value", "disabled"], ho = ["value"], go = /* @__PURE__ */
|
|
2081
|
+
}, po = { class: "me-code-lang" }, mo = ["value", "disabled"], ho = ["value"], go = /* @__PURE__ */ B({
|
|
2082
2082
|
__name: "CodeBlockView",
|
|
2083
2083
|
props: xe,
|
|
2084
2084
|
setup(e) {
|
|
2085
|
-
let t = e, n = Ua(t.editor), r =
|
|
2085
|
+
let t = e, n = Ua(t.editor), r = N(() => t.editor.storage.meiConfig.messages.code), i = N(() => !!t.editor.extensionManager.extensions.find((e) => e.name === "mermaidPreview")), a = N(() => {
|
|
2086
2086
|
let e = i.value ? [...yo, "mermaid"] : yo, n = t.node.attrs.language;
|
|
2087
2087
|
return n && !e.includes(n) ? [...e, n] : e;
|
|
2088
|
-
}), o = K(!1), s =
|
|
2088
|
+
}), o = K(!1), s = N(() => t.node.attrs.language === "mermaid" && i.value), c = N(() => {
|
|
2089
2089
|
let e = t.editor.storage.meiConfig.scope.class;
|
|
2090
2090
|
return e.includes("me-dark") || !e.includes("me-light") && document.documentElement.classList.contains("dark");
|
|
2091
2091
|
});
|
|
2092
2092
|
async function l() {
|
|
2093
2093
|
await navigator.clipboard.writeText(t.node.textContent), o.value = !0, setTimeout(() => o.value = !1, 1500);
|
|
2094
2094
|
}
|
|
2095
|
-
return (e, t) => (G(),
|
|
2095
|
+
return (e, t) => (G(), P(X(ve), { class: "me-code-block" }, {
|
|
2096
2096
|
default: fe(() => [
|
|
2097
|
-
|
|
2097
|
+
L("div", fo, [L("label", po, [L("select", {
|
|
2098
2098
|
value: e.node.attrs.language || "plaintext",
|
|
2099
2099
|
disabled: !X(n),
|
|
2100
2100
|
onChange: t[0] ||= (t) => e.updateAttributes({ language: t.target.value })
|
|
2101
|
-
}, [(G(!0),
|
|
2101
|
+
}, [(G(!0), I(M, null, q(a.value, (e) => (G(), I("option", {
|
|
2102
2102
|
key: e,
|
|
2103
2103
|
value: e
|
|
2104
|
-
}, Y(e), 9, ho))), 128))], 40, mo),
|
|
2104
|
+
}, Y(e), 9, ho))), 128))], 40, mo), z(X(Ve))]), L("button", {
|
|
2105
2105
|
type: "button",
|
|
2106
2106
|
class: "me-tool-btn me-code-copy",
|
|
2107
2107
|
onClick: l
|
|
2108
|
-
}, [(G(),
|
|
2109
|
-
|
|
2108
|
+
}, [(G(), P(J(o.value ? X(Be) : X(Xe)))), R(" " + Y(o.value ? r.value.copied : r.value.copy), 1)])]),
|
|
2109
|
+
L("pre", null, [z(X(_e), {
|
|
2110
2110
|
as: "code",
|
|
2111
|
-
class:
|
|
2111
|
+
class: H(`hljs language-${e.node.attrs.language || "plaintext"}`)
|
|
2112
2112
|
}, null, 8, ["class"])]),
|
|
2113
|
-
s.value ? (G(),
|
|
2113
|
+
s.value ? (G(), P(uo, {
|
|
2114
2114
|
key: 0,
|
|
2115
2115
|
code: e.node.textContent,
|
|
2116
2116
|
messages: e.editor.storage.meiConfig.messages,
|
|
@@ -2119,7 +2119,7 @@ var ao = ["aria-label"], oo = ["innerHTML"], so = {
|
|
|
2119
2119
|
"code",
|
|
2120
2120
|
"messages",
|
|
2121
2121
|
"dark"
|
|
2122
|
-
])) :
|
|
2122
|
+
])) : F("", !0)
|
|
2123
2123
|
]),
|
|
2124
2124
|
_: 1
|
|
2125
2125
|
}));
|
|
@@ -2291,7 +2291,10 @@ var wo = wn.extend({
|
|
|
2291
2291
|
}
|
|
2292
2292
|
}), Ao = [
|
|
2293
2293
|
On.configure({
|
|
2294
|
-
table: {
|
|
2294
|
+
table: {
|
|
2295
|
+
resizable: !0,
|
|
2296
|
+
allowTableNodeSelection: !0
|
|
2297
|
+
},
|
|
2295
2298
|
tableCell: !1,
|
|
2296
2299
|
tableHeader: !1
|
|
2297
2300
|
}),
|
|
@@ -2661,11 +2664,11 @@ var wo = wn.extend({
|
|
|
2661
2664
|
}, ts = ["src", "height"], ns = {
|
|
2662
2665
|
key: 0,
|
|
2663
2666
|
class: "me-embed-overlay"
|
|
2664
|
-
}, rs = /* @__PURE__ */
|
|
2667
|
+
}, rs = /* @__PURE__ */ B({
|
|
2665
2668
|
__name: "EmbedView",
|
|
2666
2669
|
props: xe,
|
|
2667
2670
|
setup(e) {
|
|
2668
|
-
let t = e, n = Ua(t.editor), r =
|
|
2671
|
+
let t = e, n = Ua(t.editor), r = N(() => t.editor.storage.meiConfig.messages.embed), i = K(""), a = K(""), o = K(!1), c = N(() => t.node.attrs.src ? s(t.node.attrs.src) : null);
|
|
2669
2672
|
function l() {
|
|
2670
2673
|
let e = s(i.value);
|
|
2671
2674
|
e ? t.updateAttributes({ src: e }) : a.value = r.value.invalid;
|
|
@@ -2679,39 +2682,39 @@ var wo = wn.extend({
|
|
|
2679
2682
|
};
|
|
2680
2683
|
window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
|
|
2681
2684
|
}
|
|
2682
|
-
return (e, t) => (G(),
|
|
2683
|
-
default: fe(() => [c.value ? (G(),
|
|
2685
|
+
return (e, t) => (G(), P(X(ve), { class: H(["me-media", { "is-readonly-empty": !X(n) && !c.value }]) }, {
|
|
2686
|
+
default: fe(() => [c.value ? (G(), I("div", {
|
|
2684
2687
|
key: 1,
|
|
2685
|
-
class:
|
|
2688
|
+
class: H(["me-embed", { "is-selected": e.selected }]),
|
|
2686
2689
|
contenteditable: "false"
|
|
2687
2690
|
}, [
|
|
2688
|
-
|
|
2691
|
+
L("iframe", {
|
|
2689
2692
|
src: c.value,
|
|
2690
2693
|
height: e.node.attrs.height,
|
|
2691
2694
|
class: "me-embed-frame",
|
|
2692
2695
|
allowfullscreen: "",
|
|
2693
2696
|
sandbox: "allow-scripts allow-same-origin allow-popups allow-presentation"
|
|
2694
2697
|
}, null, 8, ts),
|
|
2695
|
-
o.value ? (G(),
|
|
2696
|
-
X(n) ? (G(),
|
|
2698
|
+
o.value ? (G(), I("div", ns)) : F("", !0),
|
|
2699
|
+
X(n) ? (G(), I("span", {
|
|
2697
2700
|
key: 1,
|
|
2698
2701
|
class: "me-embed-resize",
|
|
2699
2702
|
onPointerdown: u
|
|
2700
|
-
}, null, 32)) :
|
|
2701
|
-
], 2)) : (G(),
|
|
2703
|
+
}, null, 32)) : F("", !0)
|
|
2704
|
+
], 2)) : (G(), I("form", {
|
|
2702
2705
|
key: 0,
|
|
2703
2706
|
class: "me-media-empty",
|
|
2704
2707
|
contenteditable: "false",
|
|
2705
2708
|
onSubmit: Q(l, ["prevent"])
|
|
2706
2709
|
}, [
|
|
2707
|
-
|
|
2708
|
-
|
|
2710
|
+
L("div", Xo, Y(r.value.hint), 1),
|
|
2711
|
+
L("div", Zo, [pe(L("input", {
|
|
2709
2712
|
"onUpdate:modelValue": t[0] ||= (e) => i.value = e,
|
|
2710
2713
|
class: "me-input",
|
|
2711
2714
|
placeholder: r.value.placeholder,
|
|
2712
2715
|
onKeydown: t[1] ||= Q(() => {}, ["stop"])
|
|
2713
|
-
}, null, 40, Qo), [[ue, i.value]]),
|
|
2714
|
-
a.value ? (G(),
|
|
2716
|
+
}, null, 40, Qo), [[ue, i.value]]), L("button", $o, Y(r.value.submit), 1)]),
|
|
2717
|
+
a.value ? (G(), I("p", es, Y(a.value), 1)) : F("", !0)
|
|
2715
2718
|
], 32))]),
|
|
2716
2719
|
_: 1
|
|
2717
2720
|
}, 8, ["class"]));
|
|
@@ -2757,7 +2760,7 @@ var wo = wn.extend({
|
|
|
2757
2760
|
addNodeView() {
|
|
2758
2761
|
return Ha(rs);
|
|
2759
2762
|
}
|
|
2760
|
-
}), as = { class: "me-cropper" }, os = ["src", "alt"], ss = { class: "me-cropper-shade" }, cs = ["data-handle", "onPointerdown"], ls = { class: "me-cropper-actions" }, us = .05, ds = /* @__PURE__ */
|
|
2763
|
+
}), as = { class: "me-cropper" }, os = ["src", "alt"], ss = { class: "me-cropper-shade" }, cs = ["data-handle", "onPointerdown"], ls = { class: "me-cropper-actions" }, us = .05, ds = /* @__PURE__ */ B({
|
|
2761
2764
|
__name: "ImageCropper",
|
|
2762
2765
|
props: {
|
|
2763
2766
|
src: {},
|
|
@@ -2821,14 +2824,14 @@ var wo = wn.extend({
|
|
|
2821
2824
|
else return;
|
|
2822
2825
|
e.preventDefault(), e.stopPropagation();
|
|
2823
2826
|
}
|
|
2824
|
-
|
|
2827
|
+
re(() => window.addEventListener("keydown", f, !0)), W(() => window.removeEventListener("keydown", f, !0));
|
|
2825
2828
|
let p = (e) => `${e * 100}%`;
|
|
2826
|
-
return (t, n) => (G(),
|
|
2829
|
+
return (t, n) => (G(), I("div", as, [L("div", {
|
|
2827
2830
|
ref_key: "stage",
|
|
2828
2831
|
ref: a,
|
|
2829
2832
|
class: "me-cropper-stage"
|
|
2830
2833
|
}, [
|
|
2831
|
-
|
|
2834
|
+
L("img", {
|
|
2832
2835
|
ref_key: "img",
|
|
2833
2836
|
ref: o,
|
|
2834
2837
|
class: "me-figure-img",
|
|
@@ -2836,50 +2839,50 @@ var wo = wn.extend({
|
|
|
2836
2839
|
alt: e.alt || "",
|
|
2837
2840
|
draggable: "false"
|
|
2838
2841
|
}, null, 8, os),
|
|
2839
|
-
|
|
2842
|
+
L("div", ss, [L("div", {
|
|
2840
2843
|
class: "me-cropper-hole",
|
|
2841
|
-
style:
|
|
2844
|
+
style: U({
|
|
2842
2845
|
left: p(i.value.x),
|
|
2843
2846
|
top: p(i.value.y),
|
|
2844
2847
|
width: p(i.value.w),
|
|
2845
2848
|
height: p(i.value.h)
|
|
2846
2849
|
})
|
|
2847
2850
|
}, null, 4)]),
|
|
2848
|
-
|
|
2851
|
+
L("div", {
|
|
2849
2852
|
class: "me-cropper-box",
|
|
2850
|
-
style:
|
|
2853
|
+
style: U({
|
|
2851
2854
|
left: p(i.value.x),
|
|
2852
2855
|
top: p(i.value.y),
|
|
2853
2856
|
width: p(i.value.w),
|
|
2854
2857
|
height: p(i.value.h)
|
|
2855
2858
|
}),
|
|
2856
2859
|
onPointerdown: n[0] ||= (e) => l(e, "move")
|
|
2857
|
-
}, [(G(),
|
|
2860
|
+
}, [(G(), I(M, null, q(s, (e) => L("span", {
|
|
2858
2861
|
key: e,
|
|
2859
2862
|
class: "me-cropper-handle",
|
|
2860
2863
|
"data-handle": e,
|
|
2861
2864
|
onPointerdown: (t) => l(t, e)
|
|
2862
2865
|
}, null, 40, cs)), 64))], 36)
|
|
2863
|
-
], 512),
|
|
2864
|
-
|
|
2866
|
+
], 512), L("div", ls, [
|
|
2867
|
+
L("button", {
|
|
2865
2868
|
type: "button",
|
|
2866
2869
|
class: "me-btn",
|
|
2867
2870
|
onClick: d
|
|
2868
2871
|
}, Y(e.messages.cropReset), 1),
|
|
2869
|
-
n[2] ||=
|
|
2870
|
-
|
|
2872
|
+
n[2] ||= L("span", { class: "me-cropper-spacer" }, null, -1),
|
|
2873
|
+
L("button", {
|
|
2871
2874
|
type: "button",
|
|
2872
2875
|
class: "me-btn",
|
|
2873
2876
|
onClick: n[1] ||= (e) => r("cancel")
|
|
2874
2877
|
}, Y(e.messages.cropCancel), 1),
|
|
2875
|
-
|
|
2878
|
+
L("button", {
|
|
2876
2879
|
type: "button",
|
|
2877
2880
|
class: "me-btn me-btn--primary",
|
|
2878
2881
|
onClick: u
|
|
2879
2882
|
}, Y(e.messages.cropDone), 1)
|
|
2880
2883
|
])]));
|
|
2881
2884
|
}
|
|
2882
|
-
}), fs = ["src", "alt"], ps = ["title", "disabled"], ms = ["title"], hs = ["title", "disabled"], gs = ["title"], _s = ["title"], vs = .25, ys = 8, bs = /* @__PURE__ */
|
|
2885
|
+
}), fs = ["src", "alt"], ps = ["title", "disabled"], ms = ["title"], hs = ["title", "disabled"], gs = ["title"], _s = ["title"], vs = .25, ys = 8, bs = /* @__PURE__ */ B({
|
|
2883
2886
|
__name: "ImageLightbox",
|
|
2884
2887
|
props: {
|
|
2885
2888
|
src: {},
|
|
@@ -2892,7 +2895,7 @@ var wo = wn.extend({
|
|
|
2892
2895
|
let n = t, r = K(1), i = K({
|
|
2893
2896
|
x: 0,
|
|
2894
2897
|
y: 0
|
|
2895
|
-
}), a =
|
|
2898
|
+
}), a = N(() => `${Math.round(r.value * 100)}%`);
|
|
2896
2899
|
function o(e) {
|
|
2897
2900
|
r.value = Math.min(ys, Math.max(vs, Math.round(e * 100) / 100)), r.value <= 1 && (i.value = {
|
|
2898
2901
|
x: 0,
|
|
@@ -2929,63 +2932,63 @@ var wo = wn.extend({
|
|
|
2929
2932
|
else return;
|
|
2930
2933
|
e.preventDefault(), e.stopPropagation();
|
|
2931
2934
|
}
|
|
2932
|
-
return
|
|
2935
|
+
return re(() => window.addEventListener("keydown", g, !0)), W(() => window.removeEventListener("keydown", g, !0)), (t, d) => (G(), P(ee, { to: "body" }, [L("div", V(e.scope, {
|
|
2933
2936
|
class: "me-lightbox",
|
|
2934
2937
|
role: "dialog",
|
|
2935
2938
|
"aria-modal": "true",
|
|
2936
2939
|
onMousedown: d[4] ||= Q((e) => n("close"), ["self"]),
|
|
2937
2940
|
onWheel: u
|
|
2938
|
-
}), [
|
|
2939
|
-
class:
|
|
2941
|
+
}), [L("img", {
|
|
2942
|
+
class: H(["me-lightbox-img", {
|
|
2940
2943
|
"is-zoomed": r.value > 1,
|
|
2941
2944
|
"is-dragging": f.value
|
|
2942
2945
|
}]),
|
|
2943
2946
|
src: e.src,
|
|
2944
2947
|
alt: e.alt || "",
|
|
2945
2948
|
draggable: "false",
|
|
2946
|
-
style:
|
|
2949
|
+
style: U({ transform: `translate(${i.value.x}px, ${i.value.y}px) scale(${r.value})` }),
|
|
2947
2950
|
onDblclick: d[0] ||= (e) => r.value > 1 ? l() : o(2),
|
|
2948
2951
|
onPointerdown: p,
|
|
2949
2952
|
onPointermove: m,
|
|
2950
2953
|
onPointerup: h,
|
|
2951
2954
|
onPointercancel: h
|
|
2952
|
-
}, null, 46, fs),
|
|
2955
|
+
}, null, 46, fs), L("div", {
|
|
2953
2956
|
class: "me-popover me-toolbar me-lightbox-toolbar",
|
|
2954
2957
|
onMousedown: d[3] ||= Q(() => {}, ["stop"])
|
|
2955
2958
|
}, [
|
|
2956
|
-
|
|
2959
|
+
L("button", {
|
|
2957
2960
|
type: "button",
|
|
2958
2961
|
class: "me-tool-btn",
|
|
2959
2962
|
title: e.messages.zoomOut,
|
|
2960
2963
|
disabled: r.value <= vs,
|
|
2961
2964
|
onClick: c
|
|
2962
|
-
}, [
|
|
2963
|
-
|
|
2965
|
+
}, [z(X(St))], 8, ps),
|
|
2966
|
+
L("button", {
|
|
2964
2967
|
type: "button",
|
|
2965
2968
|
class: "me-tool-btn me-lightbox-percent",
|
|
2966
2969
|
title: e.messages.zoomReset,
|
|
2967
2970
|
onClick: l
|
|
2968
2971
|
}, Y(a.value), 9, ms),
|
|
2969
|
-
|
|
2972
|
+
L("button", {
|
|
2970
2973
|
type: "button",
|
|
2971
2974
|
class: "me-tool-btn",
|
|
2972
2975
|
title: e.messages.zoomIn,
|
|
2973
2976
|
disabled: r.value >= ys,
|
|
2974
2977
|
onClick: s
|
|
2975
|
-
}, [
|
|
2976
|
-
d[5] ||=
|
|
2977
|
-
|
|
2978
|
+
}, [z(X(Et))], 8, hs),
|
|
2979
|
+
d[5] ||= L("span", { class: "me-toolbar-divider" }, null, -1),
|
|
2980
|
+
L("button", {
|
|
2978
2981
|
type: "button",
|
|
2979
2982
|
class: "me-tool-btn",
|
|
2980
2983
|
title: e.messages.download,
|
|
2981
2984
|
onClick: d[1] ||= (e) => n("download")
|
|
2982
|
-
}, [
|
|
2983
|
-
|
|
2985
|
+
}, [z(X(Qe))], 8, gs),
|
|
2986
|
+
L("button", {
|
|
2984
2987
|
type: "button",
|
|
2985
2988
|
class: "me-tool-btn",
|
|
2986
2989
|
title: e.messages.close,
|
|
2987
2990
|
onClick: d[2] ||= (e) => n("close")
|
|
2988
|
-
}, [
|
|
2991
|
+
}, [z(X(qt))], 8, _s)
|
|
2989
2992
|
], 32)], 16)]));
|
|
2990
2993
|
}
|
|
2991
2994
|
});
|
|
@@ -2993,12 +2996,12 @@ var wo = wn.extend({
|
|
|
2993
2996
|
function xs(e, t) {
|
|
2994
2997
|
let n = K(Date.now()), r = null, i = () => {
|
|
2995
2998
|
r && clearTimeout(r), r = null;
|
|
2996
|
-
}, a =
|
|
2999
|
+
}, a = N(() => ni(e, t().attrs.uploadId)), o = N(() => Wr(e, t().attrs, n.value));
|
|
2997
3000
|
return de(() => {
|
|
2998
3001
|
if (i(), o.value !== "remote") return;
|
|
2999
3002
|
let a = Gr(e, t().attrs, n.value);
|
|
3000
3003
|
r = setTimeout(() => n.value = Date.now(), Math.max(0, a - n.value) + 50);
|
|
3001
|
-
}),
|
|
3004
|
+
}), W(i), {
|
|
3002
3005
|
pending: a,
|
|
3003
3006
|
state: o
|
|
3004
3007
|
};
|
|
@@ -3035,11 +3038,11 @@ var Ss = ["src", "alt"], Cs = {
|
|
|
3035
3038
|
], ic = {
|
|
3036
3039
|
key: 3,
|
|
3037
3040
|
class: "me-error"
|
|
3038
|
-
}, ac = /* @__PURE__ */
|
|
3041
|
+
}, ac = /* @__PURE__ */ B({
|
|
3039
3042
|
__name: "ImageView",
|
|
3040
3043
|
props: xe,
|
|
3041
3044
|
setup(e) {
|
|
3042
|
-
let t = e, n = Ua(t.editor), r =
|
|
3045
|
+
let t = e, n = Ua(t.editor), r = N(() => t.editor.storage.meiConfig), i = N(() => r.value.messages.image), a = K("upload"), o = K(""), s = K(""), c = K(!1), l = K(null), u = K(null), d = $i(() => t.editor), { pending: f, state: p } = xs(t.editor, () => t.node), m = N(() => t.node.attrs.error), h = N(() => !t.node.attrs.src && (!!t.node.attrs.uploading || !!m.value)), g = N(() => `${Math.round((f.value?.progress ?? 0) * 100)}%`), _ = N(() => {
|
|
3043
3046
|
let e = m.value;
|
|
3044
3047
|
return e === "tooLarge" ? i.value.tooLarge(r.value.maxImageSize) : e === "badType" ? i.value.badType : i.value.uploadFailed;
|
|
3045
3048
|
}), v = (e) => new Promise((t, n) => {
|
|
@@ -3083,43 +3086,43 @@ var Ss = ["src", "alt"], Cs = {
|
|
|
3083
3086
|
s.value = i.value.invalidLink;
|
|
3084
3087
|
}
|
|
3085
3088
|
}
|
|
3086
|
-
function
|
|
3089
|
+
function C(e, n) {
|
|
3087
3090
|
let r = u.value?.parentElement;
|
|
3088
3091
|
if (!r) return;
|
|
3089
3092
|
e.preventDefault();
|
|
3090
3093
|
let i = e.clientX, a = t.node.attrs.width, o = r.getBoundingClientRect().width, s = (e) => {
|
|
3091
|
-
let r =
|
|
3094
|
+
let r = w.value === "center" ? 2 : 1, s = (e.clientX - i) * n * r / o * 100;
|
|
3092
3095
|
t.updateAttributes({ width: Math.round(Math.min(100, Math.max(15, a + s))) });
|
|
3093
3096
|
}, c = () => {
|
|
3094
3097
|
window.removeEventListener("pointermove", s), window.removeEventListener("pointerup", c);
|
|
3095
3098
|
};
|
|
3096
3099
|
window.addEventListener("pointermove", s), window.addEventListener("pointerup", c);
|
|
3097
3100
|
}
|
|
3098
|
-
let
|
|
3101
|
+
let w = N(() => t.node.attrs.align ?? "center"), T = {
|
|
3099
3102
|
left: we,
|
|
3100
3103
|
center: Ce,
|
|
3101
3104
|
right: Te
|
|
3102
|
-
},
|
|
3103
|
-
Wa(
|
|
3104
|
-
let
|
|
3105
|
-
function
|
|
3106
|
-
t.updateAttributes({ align: e }),
|
|
3105
|
+
}, E = N(() => t.node.attrs.crop), D = N(() => t.node.attrs.showCaption ?? !!t.node.attrs.caption), O = N(() => _i(t.node.attrs.src, "image")), k = N(() => !!O.value && yi(O.value)), A = N(() => k.value && !vi(O.value)), j = K(null), ee = K(null);
|
|
3106
|
+
Wa(ee, N(() => j.value !== null), () => j.value = null);
|
|
3107
|
+
let B = K(null), te = K(!1), V = K(!1), W = K(!1);
|
|
3108
|
+
function re(e) {
|
|
3109
|
+
t.updateAttributes({ align: e }), j.value = null;
|
|
3107
3110
|
}
|
|
3108
3111
|
function ie() {
|
|
3109
|
-
let e = !
|
|
3110
|
-
t.updateAttributes({ showCaption: e }), e &&
|
|
3112
|
+
let e = !D.value;
|
|
3113
|
+
t.updateAttributes({ showCaption: e }), e && ne(() => B.value?.focus());
|
|
3111
3114
|
}
|
|
3112
3115
|
function ae(e) {
|
|
3113
|
-
t.updateAttributes({ crop: e }),
|
|
3116
|
+
t.updateAttributes({ crop: e }), te.value = !1;
|
|
3114
3117
|
}
|
|
3115
3118
|
async function oe() {
|
|
3116
|
-
let e =
|
|
3119
|
+
let e = O.value;
|
|
3117
3120
|
if (!e) return;
|
|
3118
3121
|
let n = t.node.attrs.alt || "image", r = (e) => {
|
|
3119
3122
|
let t = document.createElement("a");
|
|
3120
3123
|
t.href = e, t.download = n, t.click();
|
|
3121
3124
|
};
|
|
3122
|
-
if (!
|
|
3125
|
+
if (!A.value) return r(e);
|
|
3123
3126
|
try {
|
|
3124
3127
|
let t = await (await fetch(e)).blob(), n = URL.createObjectURL(t);
|
|
3125
3128
|
r(n), setTimeout(() => URL.revokeObjectURL(n), 1e3);
|
|
@@ -3128,213 +3131,213 @@ var Ss = ["src", "alt"], Cs = {
|
|
|
3128
3131
|
}
|
|
3129
3132
|
}
|
|
3130
3133
|
async function se() {
|
|
3131
|
-
|
|
3134
|
+
O.value && (await navigator.clipboard?.writeText(new URL(O.value, location.href).href), W.value = !0, setTimeout(() => W.value = !1, 1500), j.value = null);
|
|
3132
3135
|
}
|
|
3133
3136
|
function ce() {
|
|
3134
|
-
|
|
3137
|
+
j.value = null, l.value?.click();
|
|
3135
3138
|
}
|
|
3136
3139
|
function le() {
|
|
3137
|
-
|
|
3140
|
+
j.value = null, O.value && window.open(O.value, "_blank", "noopener");
|
|
3138
3141
|
}
|
|
3139
3142
|
function Z() {
|
|
3140
|
-
|
|
3143
|
+
j.value = null, t.deleteNode();
|
|
3141
3144
|
}
|
|
3142
|
-
let de =
|
|
3143
|
-
let e =
|
|
3145
|
+
let de = N(() => {
|
|
3146
|
+
let e = E.value;
|
|
3144
3147
|
if (e) return {
|
|
3145
3148
|
width: `${100 / e.w}%`,
|
|
3146
3149
|
left: `${-e.x / e.w * 100}%`,
|
|
3147
3150
|
top: `${-e.y / e.h * 100}%`
|
|
3148
3151
|
};
|
|
3149
3152
|
});
|
|
3150
|
-
return (e, t) => (G(),
|
|
3151
|
-
default: fe(() => [h.value ? (G(),
|
|
3153
|
+
return (e, t) => (G(), P(X(ve), { class: H(["me-media", { "is-readonly-empty": !X(n) && !e.node.attrs.src && !h.value }]) }, {
|
|
3154
|
+
default: fe(() => [h.value ? (G(), I("div", {
|
|
3152
3155
|
key: 0,
|
|
3153
|
-
class:
|
|
3156
|
+
class: H(["me-media-pending", { "is-failed": !!m.value || X(p) === "interrupted" }]),
|
|
3154
3157
|
contenteditable: "false"
|
|
3155
|
-
}, [X(f)?.preview ? (G(),
|
|
3158
|
+
}, [X(f)?.preview ? (G(), I("img", {
|
|
3156
3159
|
key: 0,
|
|
3157
3160
|
src: X(f).preview,
|
|
3158
3161
|
alt: e.node.attrs.alt || "",
|
|
3159
3162
|
class: "me-media-preview",
|
|
3160
3163
|
draggable: "false"
|
|
3161
|
-
}, null, 8, Ss)) :
|
|
3164
|
+
}, null, 8, Ss)) : F("", !0), L("div", Cs, [X(p) === "interrupted" ? (G(), I(M, { key: 0 }, [L("span", ws, Y(i.value.uploadInterrupted), 1), X(n) ? (G(), I("button", {
|
|
3162
3165
|
key: 0,
|
|
3163
3166
|
type: "button",
|
|
3164
3167
|
class: "me-btn",
|
|
3165
3168
|
onClick: t[0] ||= (t) => e.deleteNode()
|
|
3166
|
-
}, [
|
|
3167
|
-
|
|
3168
|
-
X(n) && X(f) && m.value === "failed" ? (G(),
|
|
3169
|
+
}, [z(X(zt)), R(" " + Y(i.value.delete), 1)])) : F("", !0)], 64)) : m.value ? (G(), I(M, { key: 2 }, [
|
|
3170
|
+
L("span", Es, Y(_.value), 1),
|
|
3171
|
+
X(n) && X(f) && m.value === "failed" ? (G(), I("button", {
|
|
3169
3172
|
key: 0,
|
|
3170
3173
|
type: "button",
|
|
3171
3174
|
class: "me-btn",
|
|
3172
3175
|
onClick: t[2] ||= (t) => X(oi)(e.editor, e.node.attrs.uploadId)
|
|
3173
|
-
}, [
|
|
3174
|
-
X(n) ? (G(),
|
|
3176
|
+
}, [z(X(At)), R(" " + Y(i.value.retry), 1)])) : F("", !0),
|
|
3177
|
+
X(n) ? (G(), I("button", {
|
|
3175
3178
|
key: 1,
|
|
3176
3179
|
type: "button",
|
|
3177
3180
|
class: "me-btn",
|
|
3178
3181
|
onClick: t[3] ||= (t) => e.deleteNode()
|
|
3179
|
-
}, [
|
|
3180
|
-
], 64)) : (G(),
|
|
3181
|
-
|
|
3182
|
-
X(f) ? (G(),
|
|
3182
|
+
}, [z(X(zt)), R(" " + Y(i.value.delete), 1)])) : F("", !0)
|
|
3183
|
+
], 64)) : (G(), I(M, { key: 1 }, [
|
|
3184
|
+
L("span", null, Y(i.value.uploading), 1),
|
|
3185
|
+
X(f) ? (G(), I("span", Ts, [L("span", {
|
|
3183
3186
|
class: "me-media-progress-bar",
|
|
3184
|
-
style:
|
|
3185
|
-
}, null, 4)])) :
|
|
3186
|
-
X(n) && X(f) ? (G(),
|
|
3187
|
+
style: U({ width: g.value })
|
|
3188
|
+
}, null, 4)])) : F("", !0),
|
|
3189
|
+
X(n) && X(f) ? (G(), I("button", {
|
|
3187
3190
|
key: 1,
|
|
3188
3191
|
type: "button",
|
|
3189
3192
|
class: "me-btn",
|
|
3190
3193
|
onClick: t[1] ||= (t) => e.deleteNode()
|
|
3191
|
-
}, [
|
|
3192
|
-
], 64))])], 2)) : e.node.attrs.src ? (G(),
|
|
3194
|
+
}, [z(X(zt)), R(" " + Y(i.value.delete), 1)])) : F("", !0)
|
|
3195
|
+
], 64))])], 2)) : e.node.attrs.src ? (G(), I("figure", {
|
|
3193
3196
|
key: 2,
|
|
3194
3197
|
ref_key: "figure",
|
|
3195
3198
|
ref: u,
|
|
3196
|
-
class:
|
|
3197
|
-
style:
|
|
3199
|
+
class: H(["me-figure", `me-figure--${w.value}`]),
|
|
3200
|
+
style: U({ width: `${e.node.attrs.width}%` })
|
|
3198
3201
|
}, [
|
|
3199
|
-
|
|
3202
|
+
te.value && O.value ? (G(), P(ds, {
|
|
3200
3203
|
key: 0,
|
|
3201
|
-
src:
|
|
3204
|
+
src: O.value,
|
|
3202
3205
|
alt: e.node.attrs.alt,
|
|
3203
|
-
crop:
|
|
3206
|
+
crop: E.value,
|
|
3204
3207
|
messages: i.value,
|
|
3205
3208
|
onDone: ae,
|
|
3206
|
-
onCancel: t[8] ||= (e) =>
|
|
3209
|
+
onCancel: t[8] ||= (e) => te.value = !1
|
|
3207
3210
|
}, null, 8, [
|
|
3208
3211
|
"src",
|
|
3209
3212
|
"alt",
|
|
3210
3213
|
"crop",
|
|
3211
3214
|
"messages"
|
|
3212
|
-
])) : (G(),
|
|
3215
|
+
])) : (G(), I("div", {
|
|
3213
3216
|
key: 1,
|
|
3214
|
-
class:
|
|
3217
|
+
class: H(["me-figure-frame", {
|
|
3215
3218
|
"is-selected": e.selected,
|
|
3216
|
-
"is-menu-open":
|
|
3219
|
+
"is-menu-open": j.value !== null
|
|
3217
3220
|
}])
|
|
3218
3221
|
}, [
|
|
3219
|
-
|
|
3220
|
-
class:
|
|
3221
|
-
style:
|
|
3222
|
-
}, [
|
|
3222
|
+
L("div", {
|
|
3223
|
+
class: H(["me-figure-media", { "is-cropped": !!E.value }]),
|
|
3224
|
+
style: U(E.value ? { aspectRatio: String(E.value.ratio) } : void 0)
|
|
3225
|
+
}, [O.value ? (G(), I("img", {
|
|
3223
3226
|
key: 0,
|
|
3224
|
-
src:
|
|
3227
|
+
src: O.value,
|
|
3225
3228
|
alt: e.node.attrs.alt || "",
|
|
3226
3229
|
class: "me-figure-img",
|
|
3227
|
-
style:
|
|
3230
|
+
style: U(de.value),
|
|
3228
3231
|
draggable: "false",
|
|
3229
|
-
onDblclick: t[9] ||= (e) =>
|
|
3230
|
-
}, null, 44, Ps)) : (G(),
|
|
3231
|
-
|
|
3232
|
+
onDblclick: t[9] ||= (e) => V.value = !0
|
|
3233
|
+
}, null, 44, Ps)) : (G(), I("p", Fs, Y(i.value.invalidLink), 1))], 6),
|
|
3234
|
+
L("div", {
|
|
3232
3235
|
ref_key: "toolbar",
|
|
3233
|
-
ref:
|
|
3236
|
+
ref: ee,
|
|
3234
3237
|
class: "me-popover me-toolbar me-image-toolbar",
|
|
3235
3238
|
contenteditable: "false",
|
|
3236
3239
|
onMousedown: t[14] ||= Q(() => {}, ["stop"])
|
|
3237
3240
|
}, [
|
|
3238
|
-
X(n) ? (G(),
|
|
3239
|
-
|
|
3241
|
+
X(n) ? (G(), I(M, { key: 0 }, [
|
|
3242
|
+
L("div", Is, [L("button", {
|
|
3240
3243
|
type: "button",
|
|
3241
3244
|
class: "me-tool-btn",
|
|
3242
3245
|
title: i.value.align,
|
|
3243
|
-
onClick: t[10] ||= (e) =>
|
|
3244
|
-
}, [(G(),
|
|
3246
|
+
onClick: t[10] ||= (e) => j.value = j.value === "align" ? null : "align"
|
|
3247
|
+
}, [(G(), P(J(T[w.value])))], 8, Ls), j.value === "align" ? (G(), I("div", Rs, [(G(), I(M, null, q([
|
|
3245
3248
|
"left",
|
|
3246
3249
|
"center",
|
|
3247
3250
|
"right"
|
|
3248
|
-
], (e) =>
|
|
3251
|
+
], (e) => L("button", {
|
|
3249
3252
|
key: e,
|
|
3250
3253
|
type: "button",
|
|
3251
3254
|
class: "me-menu-item",
|
|
3252
|
-
onClick: (t) =>
|
|
3255
|
+
onClick: (t) => re(e)
|
|
3253
3256
|
}, [
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
+
L("span", Bs, [(G(), P(J(T[e])))]),
|
|
3258
|
+
L("span", Vs, Y(i.value.alignments[e]), 1),
|
|
3259
|
+
w.value === e ? (G(), P(X(Be), {
|
|
3257
3260
|
key: 0,
|
|
3258
3261
|
class: "me-menu-check"
|
|
3259
|
-
})) :
|
|
3260
|
-
], 8, zs)), 64))])) :
|
|
3261
|
-
|
|
3262
|
+
})) : F("", !0)
|
|
3263
|
+
], 8, zs)), 64))])) : F("", !0)]),
|
|
3264
|
+
L("button", {
|
|
3262
3265
|
type: "button",
|
|
3263
|
-
class:
|
|
3266
|
+
class: H(["me-tool-btn", { "is-active": D.value }]),
|
|
3264
3267
|
title: i.value.captionToggle,
|
|
3265
3268
|
onClick: ie
|
|
3266
|
-
}, [
|
|
3267
|
-
|
|
3269
|
+
}, [z(X(ze))], 10, Hs),
|
|
3270
|
+
L("button", {
|
|
3268
3271
|
type: "button",
|
|
3269
|
-
class:
|
|
3272
|
+
class: H(["me-tool-btn", { "is-active": !!E.value }]),
|
|
3270
3273
|
title: i.value.crop,
|
|
3271
|
-
onClick: t[11] ||= (e) =>
|
|
3272
|
-
}, [
|
|
3273
|
-
], 64)) :
|
|
3274
|
-
|
|
3274
|
+
onClick: t[11] ||= (e) => te.value = !0
|
|
3275
|
+
}, [z(X(Ze))], 10, Us)
|
|
3276
|
+
], 64)) : F("", !0),
|
|
3277
|
+
L("button", {
|
|
3275
3278
|
type: "button",
|
|
3276
3279
|
class: "me-tool-btn",
|
|
3277
3280
|
title: i.value.zoom,
|
|
3278
|
-
onClick: t[12] ||= (e) =>
|
|
3279
|
-
}, [
|
|
3280
|
-
|
|
3281
|
+
onClick: t[12] ||= (e) => V.value = !0
|
|
3282
|
+
}, [z(X(Jt))], 8, Ws),
|
|
3283
|
+
L("button", {
|
|
3281
3284
|
type: "button",
|
|
3282
3285
|
class: "me-tool-btn",
|
|
3283
3286
|
title: i.value.download,
|
|
3284
3287
|
onClick: oe
|
|
3285
|
-
}, [
|
|
3286
|
-
|
|
3288
|
+
}, [z(X(Qe))], 8, Gs),
|
|
3289
|
+
L("div", Ks, [L("button", {
|
|
3287
3290
|
type: "button",
|
|
3288
3291
|
class: "me-tool-btn",
|
|
3289
3292
|
title: i.value.more,
|
|
3290
|
-
onClick: t[13] ||= (e) =>
|
|
3291
|
-
}, [
|
|
3292
|
-
X(n) ? (G(),
|
|
3293
|
+
onClick: t[13] ||= (e) => j.value = j.value === "more" ? null : "more"
|
|
3294
|
+
}, [z(X($e))], 8, qs), j.value === "more" ? (G(), I("div", Js, [
|
|
3295
|
+
X(n) ? (G(), I("button", {
|
|
3293
3296
|
key: 0,
|
|
3294
3297
|
type: "button",
|
|
3295
3298
|
class: "me-menu-item",
|
|
3296
3299
|
onClick: ce
|
|
3297
|
-
}, [
|
|
3298
|
-
|
|
3300
|
+
}, [L("span", Ys, [z(X(At))]), L("span", Xs, Y(i.value.replace), 1)])) : F("", !0),
|
|
3301
|
+
k.value ? (G(), I("button", {
|
|
3299
3302
|
key: 1,
|
|
3300
3303
|
type: "button",
|
|
3301
3304
|
class: "me-menu-item",
|
|
3302
3305
|
onClick: se
|
|
3303
|
-
}, [
|
|
3304
|
-
|
|
3306
|
+
}, [L("span", Zs, [(G(), P(J(W.value ? X(Be) : X(Xe))))]), L("span", Qs, Y(W.value ? i.value.linkCopied : i.value.copyLink), 1)])) : F("", !0),
|
|
3307
|
+
k.value ? (G(), I("button", {
|
|
3305
3308
|
key: 2,
|
|
3306
3309
|
type: "button",
|
|
3307
3310
|
class: "me-menu-item",
|
|
3308
3311
|
onClick: le
|
|
3309
|
-
}, [
|
|
3310
|
-
X(n) ? (G(),
|
|
3312
|
+
}, [L("span", $s, [z(X(tt))]), L("span", ec, Y(i.value.original), 1)])) : F("", !0),
|
|
3313
|
+
X(n) ? (G(), I("button", {
|
|
3311
3314
|
key: 3,
|
|
3312
3315
|
type: "button",
|
|
3313
3316
|
class: "me-menu-item is-danger",
|
|
3314
3317
|
onClick: Z
|
|
3315
|
-
}, [
|
|
3316
|
-
])) :
|
|
3318
|
+
}, [L("span", tc, [z(X(zt))]), L("span", nc, Y(i.value.delete), 1)])) : F("", !0)
|
|
3319
|
+
])) : F("", !0)])
|
|
3317
3320
|
], 544),
|
|
3318
|
-
X(n) ? (G(),
|
|
3321
|
+
X(n) ? (G(), I(M, { key: 0 }, [L("span", {
|
|
3319
3322
|
class: "me-resize-handle me-resize-handle--left",
|
|
3320
|
-
onPointerdown: t[15] ||= (e) =>
|
|
3321
|
-
}, null, 32),
|
|
3323
|
+
onPointerdown: t[15] ||= (e) => C(e, -1)
|
|
3324
|
+
}, null, 32), L("span", {
|
|
3322
3325
|
class: "me-resize-handle me-resize-handle--right",
|
|
3323
|
-
onPointerdown: t[16] ||= (e) =>
|
|
3324
|
-
}, null, 32)], 64)) :
|
|
3326
|
+
onPointerdown: t[16] ||= (e) => C(e, 1)
|
|
3327
|
+
}, null, 32)], 64)) : F("", !0)
|
|
3325
3328
|
], 2)),
|
|
3326
|
-
|
|
3329
|
+
D.value && !te.value ? (G(), I("input", {
|
|
3327
3330
|
key: 2,
|
|
3328
3331
|
ref_key: "captionInput",
|
|
3329
|
-
ref:
|
|
3332
|
+
ref: B,
|
|
3330
3333
|
class: "me-caption",
|
|
3331
3334
|
value: e.node.attrs.caption,
|
|
3332
3335
|
readonly: !X(n),
|
|
3333
3336
|
placeholder: X(n) ? i.value.caption : "",
|
|
3334
3337
|
onInput: t[17] ||= (t) => e.updateAttributes({ caption: t.target.value }),
|
|
3335
3338
|
onKeydown: t[18] ||= Q(() => {}, ["stop"])
|
|
3336
|
-
}, null, 40, rc)) :
|
|
3337
|
-
|
|
3339
|
+
}, null, 40, rc)) : F("", !0),
|
|
3340
|
+
L("input", {
|
|
3338
3341
|
ref_key: "fileInput",
|
|
3339
3342
|
ref: l,
|
|
3340
3343
|
type: "file",
|
|
@@ -3342,29 +3345,29 @@ var Ss = ["src", "alt"], Cs = {
|
|
|
3342
3345
|
hidden: "",
|
|
3343
3346
|
onChange: b
|
|
3344
3347
|
}, null, 544),
|
|
3345
|
-
s.value ? (G(),
|
|
3346
|
-
], 6)) : (G(),
|
|
3348
|
+
s.value ? (G(), I("p", ic, Y(s.value), 1)) : F("", !0)
|
|
3349
|
+
], 6)) : (G(), I("div", {
|
|
3347
3350
|
key: 1,
|
|
3348
3351
|
class: "me-media-empty",
|
|
3349
3352
|
contenteditable: "false",
|
|
3350
3353
|
onDragover: t[7] ||= Q(() => {}, ["prevent"]),
|
|
3351
3354
|
onDrop: x
|
|
3352
3355
|
}, [
|
|
3353
|
-
|
|
3356
|
+
L("div", Ds, [(G(), I(M, null, q(["upload", "link"], (e) => L("button", {
|
|
3354
3357
|
key: e,
|
|
3355
3358
|
type: "button",
|
|
3356
|
-
class:
|
|
3359
|
+
class: H(["me-tab", { "is-active": a.value === e }]),
|
|
3357
3360
|
onClick: (t) => a.value = e
|
|
3358
|
-
}, [(G(),
|
|
3359
|
-
a.value === "upload" ? (G(),
|
|
3360
|
-
|
|
3361
|
+
}, [(G(), P(J(X(e === "upload" ? Ut : ht)))), R(" " + Y(e === "upload" ? i.value.upload : i.value.link), 1)], 10, Os)), 64))]),
|
|
3362
|
+
a.value === "upload" ? (G(), I("div", ks, [
|
|
3363
|
+
L("button", {
|
|
3361
3364
|
type: "button",
|
|
3362
3365
|
class: "me-btn",
|
|
3363
3366
|
disabled: c.value,
|
|
3364
3367
|
onClick: t[4] ||= (e) => l.value?.click()
|
|
3365
|
-
}, [
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
+
}, [z(X(ft)), R(" " + Y(c.value ? i.value.uploading : i.value.choose), 1)], 8, As),
|
|
3369
|
+
L("p", js, Y(i.value.dropHint(r.value.maxImageSize)), 1),
|
|
3370
|
+
L("input", {
|
|
3368
3371
|
ref_key: "fileInput",
|
|
3369
3372
|
ref: l,
|
|
3370
3373
|
type: "file",
|
|
@@ -3372,31 +3375,31 @@ var Ss = ["src", "alt"], Cs = {
|
|
|
3372
3375
|
hidden: "",
|
|
3373
3376
|
onChange: b
|
|
3374
3377
|
}, null, 544)
|
|
3375
|
-
])) : (G(),
|
|
3378
|
+
])) : (G(), I("form", {
|
|
3376
3379
|
key: 1,
|
|
3377
3380
|
class: "me-inline-form",
|
|
3378
3381
|
onSubmit: Q(S, ["prevent"])
|
|
3379
|
-
}, [pe(
|
|
3382
|
+
}, [pe(L("input", {
|
|
3380
3383
|
"onUpdate:modelValue": t[5] ||= (e) => o.value = e,
|
|
3381
3384
|
class: "me-input",
|
|
3382
3385
|
placeholder: "https://...",
|
|
3383
3386
|
onKeydown: t[6] ||= Q(() => {}, ["stop"])
|
|
3384
|
-
}, null, 544), [[ue, o.value]]),
|
|
3385
|
-
s.value ? (G(),
|
|
3386
|
-
], 32)),
|
|
3387
|
+
}, null, 544), [[ue, o.value]]), L("button", Ms, Y(i.value.insert), 1)], 32)),
|
|
3388
|
+
s.value ? (G(), I("p", Ns, Y(s.value), 1)) : F("", !0)
|
|
3389
|
+
], 32)), V.value && O.value ? (G(), P(bs, {
|
|
3387
3390
|
key: 3,
|
|
3388
|
-
src:
|
|
3391
|
+
src: O.value,
|
|
3389
3392
|
alt: e.node.attrs.alt,
|
|
3390
3393
|
messages: i.value,
|
|
3391
3394
|
scope: X(d),
|
|
3392
|
-
onClose: t[19] ||= (e) =>
|
|
3395
|
+
onClose: t[19] ||= (e) => V.value = !1,
|
|
3393
3396
|
onDownload: oe
|
|
3394
3397
|
}, null, 8, [
|
|
3395
3398
|
"src",
|
|
3396
3399
|
"alt",
|
|
3397
3400
|
"messages",
|
|
3398
3401
|
"scope"
|
|
3399
|
-
])) :
|
|
3402
|
+
])) : F("", !0)]),
|
|
3400
3403
|
_: 1
|
|
3401
3404
|
}, 8, ["class"]));
|
|
3402
3405
|
}
|
|
@@ -3523,12 +3526,12 @@ var sc = Vn.extend({
|
|
|
3523
3526
|
insert: (e) => e.setEmbed({ src: null }),
|
|
3524
3527
|
matches: Mr("embed")
|
|
3525
3528
|
}]
|
|
3526
|
-
}), uc = ["hidden"], dc = { class: "me-emoji-menu-grid" }, fc = [
|
|
3529
|
+
}), uc = ["hidden"], dc = { class: "me-emoji-menu-grid me-popover-scroll" }, fc = [
|
|
3527
3530
|
"data-index",
|
|
3528
3531
|
"title",
|
|
3529
3532
|
"onMousemove",
|
|
3530
3533
|
"onMousedown"
|
|
3531
|
-
], pc = { class: "me-menu-desc me-emoji-menu-label" }, mc = 8, hc = /* @__PURE__ */
|
|
3534
|
+
], pc = { class: "me-menu-desc me-emoji-menu-label" }, mc = 8, hc = /* @__PURE__ */ B({
|
|
3532
3535
|
__name: "EmojiMenu",
|
|
3533
3536
|
props: {
|
|
3534
3537
|
editor: {},
|
|
@@ -3538,7 +3541,7 @@ var sc = Vn.extend({
|
|
|
3538
3541
|
setup(e, { expose: t }) {
|
|
3539
3542
|
let n = e, r = $i(() => n.editor), i = K(0), a = K(null);
|
|
3540
3543
|
Z(() => n.items, () => i.value = 0), Z(i, async (e) => {
|
|
3541
|
-
await
|
|
3544
|
+
await ne(), a.value?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({ block: "nearest" });
|
|
3542
3545
|
});
|
|
3543
3546
|
function o(e) {
|
|
3544
3547
|
let t = n.items.length;
|
|
@@ -3558,21 +3561,21 @@ var sc = Vn.extend({
|
|
|
3558
3561
|
}
|
|
3559
3562
|
t({ onKeyDown: o });
|
|
3560
3563
|
let s = ea();
|
|
3561
|
-
return (t, n) => (G(),
|
|
3564
|
+
return (t, n) => (G(), I("div", V({
|
|
3562
3565
|
ref_key: "root",
|
|
3563
3566
|
ref: a
|
|
3564
3567
|
}, X(r), {
|
|
3565
3568
|
class: "me-popover me-emoji-menu",
|
|
3566
3569
|
hidden: !e.items.length
|
|
3567
|
-
}), [
|
|
3570
|
+
}), [L("div", dc, [(G(!0), I(M, null, q(e.items, (t, n) => (G(), I("button", {
|
|
3568
3571
|
key: t.unicode,
|
|
3569
3572
|
type: "button",
|
|
3570
|
-
class:
|
|
3573
|
+
class: H(["me-emoji", { "is-active": n === i.value }]),
|
|
3571
3574
|
"data-index": n,
|
|
3572
3575
|
title: t.label,
|
|
3573
3576
|
onMousemove: (e) => X(s)(e) && (i.value = n),
|
|
3574
3577
|
onMousedown: Q((n) => e.command(t), ["prevent"])
|
|
3575
|
-
}, Y(t.unicode), 43, fc))), 128))]),
|
|
3578
|
+
}, Y(t.unicode), 43, fc))), 128))]), L("div", pc, Y(e.items[i.value]?.label), 1)], 16, uc));
|
|
3576
3579
|
}
|
|
3577
3580
|
}), gc = (e) => e.normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/đ/g, "d").toLowerCase(), _c = {
|
|
3578
3581
|
vi: () => import("emojibase-data/vi/compact.json"),
|
|
@@ -3648,19 +3651,19 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
3648
3651
|
"href",
|
|
3649
3652
|
"download",
|
|
3650
3653
|
"title"
|
|
3651
|
-
], Gc = /* @__PURE__ */
|
|
3654
|
+
], Gc = /* @__PURE__ */ B({
|
|
3652
3655
|
__name: "FileView",
|
|
3653
3656
|
props: xe,
|
|
3654
3657
|
setup(e) {
|
|
3655
|
-
let t = e, n = Ua(t.editor), r =
|
|
3658
|
+
let t = e, n = Ua(t.editor), r = N(() => t.extension.options), i = N(() => t.node.attrs.kind ?? "file"), a = N(() => t.editor.storage.meiConfig.messages.file), o = K("upload"), s = K(""), c = K(""), l = K(!1), u = K(null), d = N(() => _i(t.node.attrs.src, "any")), f = N(() => ({
|
|
3656
3659
|
file: "",
|
|
3657
3660
|
audio: "audio/*",
|
|
3658
3661
|
video: "video/*"
|
|
3659
|
-
})[i.value]), p =
|
|
3662
|
+
})[i.value]), p = N(() => ({
|
|
3660
3663
|
file: rt,
|
|
3661
3664
|
audio: Fe,
|
|
3662
3665
|
video: at
|
|
3663
|
-
})[i.value]), m =
|
|
3666
|
+
})[i.value]), m = N(() => ({
|
|
3664
3667
|
file: a.value.chooseFile,
|
|
3665
3668
|
audio: a.value.chooseAudio,
|
|
3666
3669
|
video: a.value.chooseVideo
|
|
@@ -3702,10 +3705,10 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
3702
3705
|
c.value = a.value.invalidLink;
|
|
3703
3706
|
}
|
|
3704
3707
|
}
|
|
3705
|
-
let { pending: y, state: b } = xs(t.editor, () => t.node), x =
|
|
3708
|
+
let { pending: y, state: b } = xs(t.editor, () => t.node), x = N(() => t.node.attrs.error), S = N(() => !t.node.attrs.src && (!!t.node.attrs.uploading || !!x.value)), C = N(() => `${Math.round((y.value?.progress ?? 0) * 100)}%`), w = N(() => {
|
|
3706
3709
|
let e = x.value;
|
|
3707
3710
|
return e === "tooLarge" ? a.value.tooLarge(r.value.maxSize) : e === "badType" ? a.value.wrongType : a.value.uploadFailed;
|
|
3708
|
-
}),
|
|
3711
|
+
}), T = N(() => {
|
|
3709
3712
|
let e = Number(t.node.attrs.size);
|
|
3710
3713
|
if (!e) return "";
|
|
3711
3714
|
let n = [
|
|
@@ -3716,70 +3719,70 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
3716
3719
|
], r = Math.min(n.length - 1, Math.floor(Math.log(e) / Math.log(1024)));
|
|
3717
3720
|
return `${(e / 1024 ** r).toFixed(+!!r)} ${n[r]}`;
|
|
3718
3721
|
});
|
|
3719
|
-
return (e, t) => (G(),
|
|
3720
|
-
default: fe(() => [S.value ? (G(),
|
|
3722
|
+
return (e, t) => (G(), P(X(ve), { class: H(["me-media", { "is-readonly-empty": !X(n) && !e.node.attrs.src && !S.value }]) }, {
|
|
3723
|
+
default: fe(() => [S.value ? (G(), I("div", {
|
|
3721
3724
|
key: 0,
|
|
3722
|
-
class:
|
|
3725
|
+
class: H(["me-file me-file--pending", {
|
|
3723
3726
|
"is-failed": !!x.value || X(b) === "interrupted",
|
|
3724
3727
|
"is-selected": e.selected
|
|
3725
3728
|
}]),
|
|
3726
3729
|
contenteditable: "false"
|
|
3727
|
-
}, [
|
|
3728
|
-
(G(),
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
]),
|
|
3730
|
+
}, [L("div", wc, [
|
|
3731
|
+
(G(), P(J(p.value), { class: "me-file-icon" })),
|
|
3732
|
+
L("span", Tc, Y(e.node.attrs.name), 1),
|
|
3733
|
+
T.value ? (G(), I("span", Ec, Y(T.value), 1)) : F("", !0)
|
|
3734
|
+
]), L("div", Dc, [X(b) === "interrupted" ? (G(), I(M, { key: 0 }, [L("span", Oc, Y(a.value.uploadInterrupted), 1), X(n) ? (G(), I("button", {
|
|
3732
3735
|
key: 0,
|
|
3733
3736
|
type: "button",
|
|
3734
3737
|
class: "me-btn",
|
|
3735
3738
|
onClick: t[0] ||= (t) => e.deleteNode()
|
|
3736
|
-
}, [
|
|
3737
|
-
|
|
3738
|
-
X(n) && X(y) && x.value === "failed" ? (G(),
|
|
3739
|
+
}, [z(X(zt)), R(" " + Y(a.value.delete), 1)])) : F("", !0)], 64)) : x.value ? (G(), I(M, { key: 2 }, [
|
|
3740
|
+
L("span", Ac, Y(w.value), 1),
|
|
3741
|
+
X(n) && X(y) && x.value === "failed" ? (G(), I("button", {
|
|
3739
3742
|
key: 0,
|
|
3740
3743
|
type: "button",
|
|
3741
3744
|
class: "me-btn",
|
|
3742
3745
|
onClick: t[2] ||= (t) => X(oi)(e.editor, e.node.attrs.uploadId)
|
|
3743
|
-
}, [
|
|
3744
|
-
X(n) ? (G(),
|
|
3746
|
+
}, [z(X(At)), R(" " + Y(a.value.retry), 1)])) : F("", !0),
|
|
3747
|
+
X(n) ? (G(), I("button", {
|
|
3745
3748
|
key: 1,
|
|
3746
3749
|
type: "button",
|
|
3747
3750
|
class: "me-btn",
|
|
3748
3751
|
onClick: t[3] ||= (t) => e.deleteNode()
|
|
3749
|
-
}, [
|
|
3750
|
-
], 64)) : (G(),
|
|
3751
|
-
|
|
3752
|
-
X(y) ? (G(),
|
|
3752
|
+
}, [z(X(zt)), R(" " + Y(a.value.delete), 1)])) : F("", !0)
|
|
3753
|
+
], 64)) : (G(), I(M, { key: 1 }, [
|
|
3754
|
+
L("span", null, Y(a.value.uploading), 1),
|
|
3755
|
+
X(y) ? (G(), I("span", kc, [L("span", {
|
|
3753
3756
|
class: "me-media-progress-bar",
|
|
3754
|
-
style:
|
|
3755
|
-
}, null, 4)])) :
|
|
3756
|
-
X(n) && X(y) ? (G(),
|
|
3757
|
+
style: U({ width: C.value })
|
|
3758
|
+
}, null, 4)])) : F("", !0),
|
|
3759
|
+
X(n) && X(y) ? (G(), I("button", {
|
|
3757
3760
|
key: 1,
|
|
3758
3761
|
type: "button",
|
|
3759
3762
|
class: "me-btn",
|
|
3760
3763
|
onClick: t[1] ||= (t) => e.deleteNode()
|
|
3761
|
-
}, [
|
|
3762
|
-
], 64))])], 2)) : e.node.attrs.src ? (G(),
|
|
3764
|
+
}, [z(X(zt)), R(" " + Y(a.value.delete), 1)])) : F("", !0)
|
|
3765
|
+
], 64))])], 2)) : e.node.attrs.src ? (G(), I("div", {
|
|
3763
3766
|
key: 2,
|
|
3764
|
-
class:
|
|
3767
|
+
class: H(["me-file", [`me-file--${i.value}`, { "is-selected": e.selected }]]),
|
|
3765
3768
|
contenteditable: "false"
|
|
3766
|
-
}, [i.value === "audio" && d.value ? (G(),
|
|
3769
|
+
}, [i.value === "audio" && d.value ? (G(), I("audio", {
|
|
3767
3770
|
key: 0,
|
|
3768
3771
|
class: "me-file-player",
|
|
3769
3772
|
src: d.value,
|
|
3770
3773
|
controls: "",
|
|
3771
3774
|
preload: "metadata"
|
|
3772
|
-
}, null, 8, zc)) : i.value === "video" && d.value ? (G(),
|
|
3775
|
+
}, null, 8, zc)) : i.value === "video" && d.value ? (G(), I("video", {
|
|
3773
3776
|
key: 1,
|
|
3774
3777
|
class: "me-file-player",
|
|
3775
3778
|
src: d.value,
|
|
3776
3779
|
controls: "",
|
|
3777
3780
|
preload: "metadata"
|
|
3778
|
-
}, null, 8, Bc)) :
|
|
3779
|
-
(G(),
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
d.value ? (G(),
|
|
3781
|
+
}, null, 8, Bc)) : F("", !0), L("div", Vc, [
|
|
3782
|
+
(G(), P(J(p.value), { class: "me-file-icon" })),
|
|
3783
|
+
L("span", Hc, Y(e.node.attrs.name || e.node.attrs.src), 1),
|
|
3784
|
+
T.value ? (G(), I("span", Uc, Y(T.value), 1)) : F("", !0),
|
|
3785
|
+
d.value ? (G(), I("a", {
|
|
3783
3786
|
key: 1,
|
|
3784
3787
|
class: "me-tool-btn",
|
|
3785
3788
|
href: d.value,
|
|
@@ -3787,29 +3790,29 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
3787
3790
|
target: "_blank",
|
|
3788
3791
|
rel: "noopener noreferrer",
|
|
3789
3792
|
title: a.value.download
|
|
3790
|
-
}, [
|
|
3791
|
-
])], 2)) : (G(),
|
|
3793
|
+
}, [z(X(Qe))], 8, Wc)) : F("", !0)
|
|
3794
|
+
])], 2)) : (G(), I("div", {
|
|
3792
3795
|
key: 1,
|
|
3793
3796
|
class: "me-media-empty",
|
|
3794
3797
|
contenteditable: "false",
|
|
3795
3798
|
onDragover: t[8] ||= Q(() => {}, ["prevent"]),
|
|
3796
3799
|
onDrop: _
|
|
3797
3800
|
}, [
|
|
3798
|
-
|
|
3801
|
+
L("div", jc, [(G(), I(M, null, q(["upload", "link"], (e) => L("button", {
|
|
3799
3802
|
key: e,
|
|
3800
3803
|
type: "button",
|
|
3801
|
-
class:
|
|
3804
|
+
class: H(["me-tab", { "is-active": o.value === e }]),
|
|
3802
3805
|
onClick: (t) => o.value = e
|
|
3803
|
-
}, [(G(),
|
|
3804
|
-
o.value === "upload" ? (G(),
|
|
3805
|
-
|
|
3806
|
+
}, [(G(), P(J(X(e === "upload" ? Ut : ht)))), R(" " + Y(e === "upload" ? a.value.upload : a.value.link), 1)], 10, Mc)), 64))]),
|
|
3807
|
+
o.value === "upload" ? (G(), I("div", Nc, [
|
|
3808
|
+
L("button", {
|
|
3806
3809
|
type: "button",
|
|
3807
3810
|
class: "me-btn",
|
|
3808
3811
|
disabled: l.value,
|
|
3809
3812
|
onClick: t[4] ||= (e) => u.value?.click()
|
|
3810
|
-
}, [(G(),
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
+
}, [(G(), P(J(p.value))), R(" " + Y(l.value ? a.value.uploading : m.value), 1)], 8, Pc),
|
|
3814
|
+
L("p", Fc, Y(a.value.dropHint(r.value.maxSize)), 1),
|
|
3815
|
+
L("input", {
|
|
3813
3816
|
ref_key: "fileInput",
|
|
3814
3817
|
ref: u,
|
|
3815
3818
|
type: "file",
|
|
@@ -3817,17 +3820,17 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
3817
3820
|
hidden: "",
|
|
3818
3821
|
onChange: t[5] ||= (e) => e.target.files?.[0] && g(e.target.files[0])
|
|
3819
3822
|
}, null, 40, Ic)
|
|
3820
|
-
])) : (G(),
|
|
3823
|
+
])) : (G(), I("form", {
|
|
3821
3824
|
key: 1,
|
|
3822
3825
|
class: "me-inline-form",
|
|
3823
3826
|
onSubmit: Q(v, ["prevent"])
|
|
3824
|
-
}, [pe(
|
|
3827
|
+
}, [pe(L("input", {
|
|
3825
3828
|
"onUpdate:modelValue": t[6] ||= (e) => s.value = e,
|
|
3826
3829
|
class: "me-input",
|
|
3827
3830
|
placeholder: "https://...",
|
|
3828
3831
|
onKeydown: t[7] ||= Q(() => {}, ["stop"])
|
|
3829
|
-
}, null, 544), [[ue, s.value]]),
|
|
3830
|
-
c.value ? (G(),
|
|
3832
|
+
}, null, 544), [[ue, s.value]]), L("button", Lc, Y(a.value.embed), 1)], 32)),
|
|
3833
|
+
c.value ? (G(), I("p", Rc, Y(c.value), 1)) : F("", !0)
|
|
3831
3834
|
], 32))]),
|
|
3832
3835
|
_: 1
|
|
3833
3836
|
}, 8, ["class"]));
|
|
@@ -3881,17 +3884,17 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
3881
3884
|
}, rl = { class: "me-hint" }, il = ["srcdoc", "title"], al = ["innerHTML"], ol = ["placeholder"], sl = {
|
|
3882
3885
|
key: 4,
|
|
3883
3886
|
class: "me-embed-overlay"
|
|
3884
|
-
}, cl = { class: "me-html-modal-panel" }, ll = { class: "me-block-bar me-html-bar" }, ul = { class: "me-html-name" }, dl = ["title"], fl = ["srcdoc", "title"], pl = "allow-scripts allow-forms allow-modals allow-popups allow-pointer-lock allow-downloads", ml = /* @__PURE__ */
|
|
3887
|
+
}, cl = { class: "me-html-modal-panel" }, ll = { class: "me-block-bar me-html-bar" }, ul = { class: "me-html-name" }, dl = ["title"], fl = ["srcdoc", "title"], pl = "allow-scripts allow-forms allow-modals allow-popups allow-pointer-lock allow-downloads", ml = /* @__PURE__ */ B({
|
|
3885
3888
|
__name: "HtmlView",
|
|
3886
3889
|
props: xe,
|
|
3887
3890
|
setup(e) {
|
|
3888
|
-
let t = e, n = $i(() => t.editor), r = Ua(t.editor), i =
|
|
3891
|
+
let t = e, n = $i(() => t.editor), r = Ua(t.editor), i = N(() => t.editor.storage.meiConfig.messages.html), o = N(() => t.extension.options), s = N(() => t.node.attrs.code ?? ""), c = N(() => t.node.attrs.height ?? o.value.defaultHeight), l = N(() => t.node.attrs.fileName || i.value.title), d = N(() => u(s.value, o.value.network)), f = K("preview"), p = K(!1), m = K(!1), h = K(null);
|
|
3889
3892
|
Wa(h, p, () => p.value = !1);
|
|
3890
3893
|
function g() {
|
|
3891
|
-
|
|
3894
|
+
j.value = "", f.value = "code", p.value = !1, ne(() => y.value?.focus());
|
|
3892
3895
|
}
|
|
3893
3896
|
function _() {
|
|
3894
|
-
|
|
3897
|
+
j.value = "", S(), f.value = "preview";
|
|
3895
3898
|
}
|
|
3896
3899
|
Z(r, (e) => {
|
|
3897
3900
|
!e && f.value === "code" && _();
|
|
@@ -3904,106 +3907,106 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
3904
3907
|
function S() {
|
|
3905
3908
|
clearTimeout(x), v.value !== s.value && t.updateAttributes({ code: v.value });
|
|
3906
3909
|
}
|
|
3907
|
-
function
|
|
3910
|
+
function C() {
|
|
3908
3911
|
clearTimeout(x), x = setTimeout(S, 400);
|
|
3909
3912
|
}
|
|
3910
|
-
function
|
|
3913
|
+
function w(e) {
|
|
3911
3914
|
if (e.key === "Tab") {
|
|
3912
3915
|
e.preventDefault();
|
|
3913
3916
|
let t = e.target;
|
|
3914
|
-
t.setRangeText(" ", t.selectionStart, t.selectionEnd, "end"), v.value = t.value,
|
|
3917
|
+
t.setRangeText(" ", t.selectionStart, t.selectionEnd, "end"), v.value = t.value, C();
|
|
3915
3918
|
} else (e.key === "Escape" || e.key === "Enter" && (e.metaKey || e.ctrlKey)) && (e.preventDefault(), _());
|
|
3916
3919
|
}
|
|
3917
|
-
function
|
|
3920
|
+
function T() {
|
|
3918
3921
|
b.value && y.value && (b.value.scrollTop = y.value.scrollTop, b.value.scrollLeft = y.value.scrollLeft);
|
|
3919
3922
|
}
|
|
3920
|
-
let
|
|
3923
|
+
let E = K(!1);
|
|
3921
3924
|
Z(f, (e) => {
|
|
3922
|
-
e === "code" && !
|
|
3925
|
+
e === "code" && !E.value && Promise.all([
|
|
3923
3926
|
"xml",
|
|
3924
3927
|
"css",
|
|
3925
3928
|
"javascript"
|
|
3926
|
-
].map(xo)).then(() =>
|
|
3929
|
+
].map(xo)).then(() => E.value = !0);
|
|
3927
3930
|
}, { immediate: !0 });
|
|
3928
|
-
let
|
|
3929
|
-
function
|
|
3930
|
-
if (e.type === "text") return
|
|
3931
|
-
let t = (e.children ?? []).map(
|
|
3931
|
+
let D = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
3932
|
+
function O(e) {
|
|
3933
|
+
if (e.type === "text") return D(e.value ?? "");
|
|
3934
|
+
let t = (e.children ?? []).map(O).join("");
|
|
3932
3935
|
return e.type === "element" ? `<span class="${(e.properties?.className ?? []).join(" ")}">${t}</span>` : t;
|
|
3933
3936
|
}
|
|
3934
|
-
let
|
|
3937
|
+
let k = N(() => {
|
|
3935
3938
|
let e = `${v.value}\n`;
|
|
3936
|
-
return !
|
|
3937
|
-
}),
|
|
3938
|
-
async function
|
|
3939
|
+
return !E.value || !_o.registered("xml") ? D(e) : O(_o.highlight("xml", e));
|
|
3940
|
+
}), A = K(null), j = K("");
|
|
3941
|
+
async function M(e) {
|
|
3939
3942
|
let n = e.target, r = n.files?.[0];
|
|
3940
3943
|
if (n.value = "", !r) return;
|
|
3941
3944
|
if (!/\.html?$/i.test(r.name) && r.type !== "text/html") {
|
|
3942
|
-
|
|
3945
|
+
j.value = i.value.wrongType;
|
|
3943
3946
|
return;
|
|
3944
3947
|
}
|
|
3945
3948
|
if (r.size > o.value.maxSize * 1024) {
|
|
3946
|
-
|
|
3949
|
+
j.value = i.value.tooLarge(o.value.maxSize);
|
|
3947
3950
|
return;
|
|
3948
3951
|
}
|
|
3949
|
-
|
|
3952
|
+
j.value = "";
|
|
3950
3953
|
let a = await r.text();
|
|
3951
3954
|
v.value = a, t.updateAttributes({
|
|
3952
3955
|
code: a,
|
|
3953
3956
|
fileName: r.name
|
|
3954
3957
|
}), f.value = "preview";
|
|
3955
3958
|
}
|
|
3956
|
-
let
|
|
3957
|
-
function
|
|
3958
|
-
e.preventDefault(),
|
|
3959
|
+
let B = K(!1);
|
|
3960
|
+
function te(e) {
|
|
3961
|
+
e.preventDefault(), B.value = !0;
|
|
3959
3962
|
let n = e.clientY, r = c.value, i = (e) => {
|
|
3960
3963
|
t.updateAttributes({ height: Math.round(Math.min(a, Math.max(120, r + e.clientY - n))) });
|
|
3961
3964
|
}, o = () => {
|
|
3962
|
-
|
|
3965
|
+
B.value = !1, window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o);
|
|
3963
3966
|
};
|
|
3964
3967
|
window.addEventListener("pointermove", i), window.addEventListener("pointerup", o);
|
|
3965
3968
|
}
|
|
3966
|
-
function
|
|
3969
|
+
function re(e) {
|
|
3967
3970
|
e.key === "Escape" && (m.value = !1);
|
|
3968
3971
|
}
|
|
3969
3972
|
return Z(m, (e) => {
|
|
3970
|
-
e ? window.addEventListener("keydown",
|
|
3971
|
-
}),
|
|
3972
|
-
S(), window.removeEventListener("keydown",
|
|
3973
|
-
}), (e, t) => (G(),
|
|
3973
|
+
e ? window.addEventListener("keydown", re) : window.removeEventListener("keydown", re);
|
|
3974
|
+
}), W(() => {
|
|
3975
|
+
S(), window.removeEventListener("keydown", re);
|
|
3976
|
+
}), (e, t) => (G(), P(X(ve), { class: H(["me-html", {
|
|
3974
3977
|
"is-selected": e.selected,
|
|
3975
3978
|
"is-readonly-empty": !X(r) && !s.value
|
|
3976
3979
|
}]) }, {
|
|
3977
|
-
default: fe(() => [
|
|
3980
|
+
default: fe(() => [L("div", {
|
|
3978
3981
|
ref_key: "root",
|
|
3979
3982
|
ref: h,
|
|
3980
3983
|
class: "me-html-frame",
|
|
3981
3984
|
contenteditable: "false"
|
|
3982
3985
|
}, [
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
X(r) ? (G(),
|
|
3986
|
+
L("div", qc, [
|
|
3987
|
+
z(X(Ke)),
|
|
3988
|
+
L("span", Jc, Y(l.value), 1),
|
|
3989
|
+
X(r) ? (G(), I("div", Yc, [L("button", {
|
|
3987
3990
|
type: "button",
|
|
3988
|
-
class:
|
|
3991
|
+
class: H(["me-tab", { "is-active": f.value === "code" }]),
|
|
3989
3992
|
role: "tab",
|
|
3990
3993
|
"aria-selected": f.value === "code",
|
|
3991
3994
|
onClick: g
|
|
3992
|
-
}, [
|
|
3995
|
+
}, [z(X(Ge)), R(" " + Y(i.value.code), 1)], 10, Xc), L("button", {
|
|
3993
3996
|
type: "button",
|
|
3994
|
-
class:
|
|
3997
|
+
class: H(["me-tab", { "is-active": f.value === "preview" }]),
|
|
3995
3998
|
role: "tab",
|
|
3996
3999
|
"aria-selected": f.value === "preview",
|
|
3997
4000
|
onClick: _
|
|
3998
|
-
}, [
|
|
3999
|
-
X(r) ? (G(),
|
|
4001
|
+
}, [z(X(nt)), R(" " + Y(i.value.preview), 1)], 10, Zc)])) : F("", !0),
|
|
4002
|
+
X(r) ? (G(), I("button", {
|
|
4000
4003
|
key: 1,
|
|
4001
4004
|
type: "button",
|
|
4002
4005
|
class: "me-tool-btn",
|
|
4003
4006
|
title: i.value.upload,
|
|
4004
|
-
onClick: t[0] ||= (e) =>
|
|
4005
|
-
}, [
|
|
4006
|
-
s.value ? (G(),
|
|
4007
|
+
onClick: t[0] ||= (e) => A.value?.click()
|
|
4008
|
+
}, [z(X(Ut))], 8, Qc)) : F("", !0),
|
|
4009
|
+
s.value ? (G(), I("button", {
|
|
4007
4010
|
key: 2,
|
|
4008
4011
|
type: "button",
|
|
4009
4012
|
class: "me-tool-btn",
|
|
@@ -4011,55 +4014,55 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4011
4014
|
onClick: t[1] ||= (e) => {
|
|
4012
4015
|
S(), m.value = !0;
|
|
4013
4016
|
}
|
|
4014
|
-
}, [
|
|
4015
|
-
|
|
4017
|
+
}, [z(X(xt))], 8, $c)) : F("", !0),
|
|
4018
|
+
L("input", {
|
|
4016
4019
|
ref_key: "fileInput",
|
|
4017
|
-
ref:
|
|
4020
|
+
ref: A,
|
|
4018
4021
|
type: "file",
|
|
4019
4022
|
accept: ".html,.htm,text/html",
|
|
4020
4023
|
hidden: "",
|
|
4021
|
-
onChange:
|
|
4024
|
+
onChange: M
|
|
4022
4025
|
}, null, 544)
|
|
4023
4026
|
]),
|
|
4024
|
-
|
|
4025
|
-
f.value === "preview" && !s.value ? (G(),
|
|
4027
|
+
j.value ? (G(), I("p", el, Y(j.value), 1)) : F("", !0),
|
|
4028
|
+
f.value === "preview" && !s.value ? (G(), I("div", tl, [X(r) ? (G(), I("div", nl, [L("button", {
|
|
4026
4029
|
type: "button",
|
|
4027
4030
|
class: "me-btn",
|
|
4028
4031
|
onClick: g
|
|
4029
|
-
}, [
|
|
4032
|
+
}, [z(X(Ge)), R(" " + Y(i.value.write), 1)]), L("button", {
|
|
4030
4033
|
type: "button",
|
|
4031
4034
|
class: "me-btn",
|
|
4032
|
-
onClick: t[2] ||= (e) =>
|
|
4033
|
-
}, [
|
|
4035
|
+
onClick: t[2] ||= (e) => A.value?.click()
|
|
4036
|
+
}, [z(X(Ut)), R(" " + Y(i.value.uploadFile), 1)])])) : F("", !0), L("p", rl, Y(i.value.emptyHint), 1)])) : f.value === "preview" ? (G(), I("div", {
|
|
4034
4037
|
key: 2,
|
|
4035
4038
|
class: "me-html-body",
|
|
4036
|
-
style:
|
|
4037
|
-
}, [
|
|
4038
|
-
class:
|
|
4039
|
+
style: U({ height: `${c.value}px` })
|
|
4040
|
+
}, [L("iframe", {
|
|
4041
|
+
class: H(["me-html-iframe", { "is-live": p.value }]),
|
|
4039
4042
|
srcdoc: d.value,
|
|
4040
4043
|
sandbox: pl,
|
|
4041
4044
|
title: l.value,
|
|
4042
4045
|
loading: "lazy",
|
|
4043
4046
|
referrerpolicy: "no-referrer"
|
|
4044
|
-
}, null, 10, il), p.value ?
|
|
4047
|
+
}, null, 10, il), p.value ? F("", !0) : (G(), I("div", {
|
|
4045
4048
|
key: 0,
|
|
4046
4049
|
class: "me-html-cover",
|
|
4047
4050
|
onDblclick: t[4] ||= (e) => p.value = !0
|
|
4048
|
-
}, [
|
|
4051
|
+
}, [L("button", {
|
|
4049
4052
|
type: "button",
|
|
4050
4053
|
class: "me-btn me-btn--floating",
|
|
4051
4054
|
onClick: t[3] ||= (e) => p.value = !0
|
|
4052
|
-
}, [
|
|
4055
|
+
}, [z(X(Dt)), R(" " + Y(i.value.interact), 1)])], 32))], 4)) : (G(), I("div", {
|
|
4053
4056
|
key: 3,
|
|
4054
4057
|
class: "me-html-editor",
|
|
4055
|
-
style:
|
|
4056
|
-
}, [
|
|
4058
|
+
style: U({ height: `${c.value}px` })
|
|
4059
|
+
}, [L("div", {
|
|
4057
4060
|
ref_key: "highlightEl",
|
|
4058
4061
|
ref: b,
|
|
4059
4062
|
class: "me-html-highlight",
|
|
4060
4063
|
"aria-hidden": "true",
|
|
4061
|
-
innerHTML:
|
|
4062
|
-
}, null, 8, al), pe(
|
|
4064
|
+
innerHTML: k.value
|
|
4065
|
+
}, null, 8, al), pe(L("textarea", {
|
|
4063
4066
|
ref_key: "textarea",
|
|
4064
4067
|
ref: y,
|
|
4065
4068
|
"onUpdate:modelValue": t[5] ||= (e) => v.value = e,
|
|
@@ -4069,36 +4072,36 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4069
4072
|
autocapitalize: "off",
|
|
4070
4073
|
autocomplete: "off",
|
|
4071
4074
|
placeholder: i.value.placeholder,
|
|
4072
|
-
onInput:
|
|
4075
|
+
onInput: C,
|
|
4073
4076
|
onBlur: S,
|
|
4074
|
-
onScroll:
|
|
4075
|
-
onKeydown:
|
|
4077
|
+
onScroll: T,
|
|
4078
|
+
onKeydown: w
|
|
4076
4079
|
}, null, 40, ol), [[ue, v.value]])], 4)),
|
|
4077
|
-
|
|
4078
|
-
X(r) ? (G(),
|
|
4080
|
+
B.value ? (G(), I("div", sl)) : F("", !0),
|
|
4081
|
+
X(r) ? (G(), I("span", {
|
|
4079
4082
|
key: 5,
|
|
4080
4083
|
class: "me-embed-resize",
|
|
4081
|
-
onPointerdown:
|
|
4082
|
-
}, null, 32)) :
|
|
4083
|
-
], 512), (G(),
|
|
4084
|
+
onPointerdown: te
|
|
4085
|
+
}, null, 32)) : F("", !0)
|
|
4086
|
+
], 512), (G(), P(ee, { to: "body" }, [m.value ? (G(), I("div", V({ key: 0 }, X(n), {
|
|
4084
4087
|
class: "me-html-modal",
|
|
4085
4088
|
onMousedown: t[7] ||= Q((e) => m.value = !1, ["self"])
|
|
4086
|
-
}), [
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4089
|
+
}), [L("div", cl, [L("div", ll, [
|
|
4090
|
+
z(X(Ke)),
|
|
4091
|
+
L("span", ul, Y(l.value), 1),
|
|
4092
|
+
L("button", {
|
|
4090
4093
|
type: "button",
|
|
4091
4094
|
class: "me-tool-btn",
|
|
4092
4095
|
title: i.value.close,
|
|
4093
4096
|
onClick: t[6] ||= (e) => m.value = !1
|
|
4094
|
-
}, [
|
|
4095
|
-
]),
|
|
4097
|
+
}, [z(X(qt))], 8, dl)
|
|
4098
|
+
]), L("iframe", {
|
|
4096
4099
|
class: "me-html-iframe is-live",
|
|
4097
4100
|
srcdoc: d.value,
|
|
4098
4101
|
sandbox: pl,
|
|
4099
4102
|
title: l.value,
|
|
4100
4103
|
referrerpolicy: "no-referrer"
|
|
4101
|
-
}, null, 8, fl)])], 16)) :
|
|
4104
|
+
}, null, 8, fl)])], 16)) : F("", !0)]))]),
|
|
4102
4105
|
_: 1
|
|
4103
4106
|
}, 8, ["class"]));
|
|
4104
4107
|
}
|
|
@@ -4156,11 +4159,11 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4156
4159
|
}, vl = {
|
|
4157
4160
|
key: 3,
|
|
4158
4161
|
class: "me-popover me-math-editor"
|
|
4159
|
-
}, yl = ["rows", "placeholder"], bl = { class: "me-hint" }, xl = /* @__PURE__ */
|
|
4162
|
+
}, yl = ["rows", "placeholder"], bl = { class: "me-hint" }, xl = /* @__PURE__ */ B({
|
|
4160
4163
|
__name: "MathView",
|
|
4161
4164
|
props: xe,
|
|
4162
4165
|
setup(e) {
|
|
4163
|
-
let t = e, n = Ua(t.editor), r =
|
|
4166
|
+
let t = e, n = Ua(t.editor), r = N(() => t.editor.storage.meiConfig.messages.math), i = N(() => t.node.type.name === "mathInline"), a = K(""), o = K(""), s = K(!1), c = K(t.node.attrs.latex), l = K(null), u = K(null);
|
|
4164
4167
|
async function d(e) {
|
|
4165
4168
|
if (!e.trim()) a.value = "";
|
|
4166
4169
|
else try {
|
|
@@ -4175,7 +4178,7 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4175
4178
|
}
|
|
4176
4179
|
Z(() => t.node.attrs.latex, (e) => d(e), { immediate: !0 }), Z(c, (e) => d(e));
|
|
4177
4180
|
function f() {
|
|
4178
|
-
t.editor.isEditable && (c.value = t.node.attrs.latex, s.value = !0,
|
|
4181
|
+
t.editor.isEditable && (c.value = t.node.attrs.latex, s.value = !0, ne(() => u.value?.focus()));
|
|
4179
4182
|
}
|
|
4180
4183
|
function p() {
|
|
4181
4184
|
s.value && (s.value = !1, c.value !== t.node.attrs.latex && t.updateAttributes({ latex: c.value }), !c.value.trim() && i.value && t.deleteNode());
|
|
@@ -4185,13 +4188,13 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4185
4188
|
}
|
|
4186
4189
|
return Wa(l, s, p), Z(n, (e) => {
|
|
4187
4190
|
!e && s.value && (s.value = !1, c.value !== t.node.attrs.latex && t.updateAttributes({ latex: c.value }));
|
|
4188
|
-
}),
|
|
4191
|
+
}), re(() => {
|
|
4189
4192
|
t.node.attrs.latex || f();
|
|
4190
|
-
}),
|
|
4193
|
+
}), W(p), (e, t) => (G(), P(X(ve), {
|
|
4191
4194
|
ref_key: "root",
|
|
4192
4195
|
ref: l,
|
|
4193
4196
|
as: i.value ? "span" : "div",
|
|
4194
|
-
class:
|
|
4197
|
+
class: H([i.value ? "me-math-inline" : "me-math-block", {
|
|
4195
4198
|
"is-selected": e.selected,
|
|
4196
4199
|
"is-editing": s.value,
|
|
4197
4200
|
"is-readonly-empty": !X(n) && !e.node.attrs.latex
|
|
@@ -4199,18 +4202,18 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4199
4202
|
contenteditable: "false"
|
|
4200
4203
|
}, {
|
|
4201
4204
|
default: fe(() => [
|
|
4202
|
-
a.value ? (G(),
|
|
4205
|
+
a.value ? (G(), I("span", {
|
|
4203
4206
|
key: 0,
|
|
4204
4207
|
class: "me-math-render",
|
|
4205
4208
|
onClick: f,
|
|
4206
4209
|
innerHTML: a.value
|
|
4207
|
-
}, null, 8, gl)) : (G(),
|
|
4210
|
+
}, null, 8, gl)) : (G(), I("span", {
|
|
4208
4211
|
key: 1,
|
|
4209
4212
|
class: "me-math-empty",
|
|
4210
4213
|
onClick: f
|
|
4211
4214
|
}, Y(r.value.placeholder), 1)),
|
|
4212
|
-
o.value ? (G(),
|
|
4213
|
-
s.value ? (G(),
|
|
4215
|
+
o.value ? (G(), I("span", _l, Y(o.value), 1)) : F("", !0),
|
|
4216
|
+
s.value ? (G(), I("span", vl, [pe(L("textarea", {
|
|
4214
4217
|
ref_key: "input",
|
|
4215
4218
|
ref: u,
|
|
4216
4219
|
"onUpdate:modelValue": t[0] ||= (e) => c.value = e,
|
|
@@ -4219,7 +4222,7 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4219
4222
|
placeholder: r.value.inputPlaceholder,
|
|
4220
4223
|
spellcheck: "false",
|
|
4221
4224
|
onKeydown: m
|
|
4222
|
-
}, null, 40, yl), [[ue, c.value]]),
|
|
4225
|
+
}, null, 40, yl), [[ue, c.value]]), L("span", bl, Y(i.value ? r.value.hintInline : r.value.hintBlock), 1)])) : F("", !0)
|
|
4223
4226
|
]),
|
|
4224
4227
|
_: 1
|
|
4225
4228
|
}, 8, ["as", "class"]));
|
|
@@ -4288,7 +4291,7 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4288
4291
|
}, Ml = {
|
|
4289
4292
|
key: 0,
|
|
4290
4293
|
class: "me-menu-empty"
|
|
4291
|
-
}, Nl = /* @__PURE__ */
|
|
4294
|
+
}, Nl = /* @__PURE__ */ B({
|
|
4292
4295
|
__name: "MentionMenu",
|
|
4293
4296
|
props: {
|
|
4294
4297
|
editor: {},
|
|
@@ -4296,11 +4299,11 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4296
4299
|
command: { type: Function }
|
|
4297
4300
|
},
|
|
4298
4301
|
setup(e, { expose: t }) {
|
|
4299
|
-
let n = e, r = $i(() => n.editor), i =
|
|
4302
|
+
let n = e, r = $i(() => n.editor), i = N(() => n.editor.storage.meiConfig.messages.mention), a = K(0), o = K(null), s = {
|
|
4300
4303
|
user: Wt,
|
|
4301
4304
|
page: it,
|
|
4302
4305
|
date: Re
|
|
4303
|
-
}, c =
|
|
4306
|
+
}, c = N(() => {
|
|
4304
4307
|
let e = [
|
|
4305
4308
|
"user",
|
|
4306
4309
|
"page",
|
|
@@ -4320,7 +4323,7 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4320
4323
|
})).filter((e) => e.entries.length);
|
|
4321
4324
|
});
|
|
4322
4325
|
Z(() => n.items, () => a.value = 0), Z(a, async (e) => {
|
|
4323
|
-
await
|
|
4326
|
+
await ne(), o.value?.querySelector(`[data-index="${e}"]`)?.scrollIntoView({ block: "nearest" });
|
|
4324
4327
|
});
|
|
4325
4328
|
function l(e) {
|
|
4326
4329
|
let t = n.items.length;
|
|
@@ -4334,22 +4337,22 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4334
4337
|
}
|
|
4335
4338
|
t({ onKeyDown: l });
|
|
4336
4339
|
let u = ea();
|
|
4337
|
-
return (t, n) => (G(),
|
|
4340
|
+
return (t, n) => (G(), I("div", V({
|
|
4338
4341
|
ref_key: "root",
|
|
4339
4342
|
ref: o
|
|
4340
|
-
}, X(r), { class: "me-popover me-menu" }), [(G(!0),
|
|
4343
|
+
}, X(r), { class: "me-popover me-menu" }), [(G(!0), I(M, null, q(c.value, (t) => (G(), I("div", { key: t.kind }, [L("div", Tl, Y(t.label), 1), (G(!0), I(M, null, q(t.entries, ({ item: t, index: n }) => (G(), I("button", {
|
|
4341
4344
|
key: `${t.kind}-${t.id}`,
|
|
4342
4345
|
type: "button",
|
|
4343
|
-
class:
|
|
4346
|
+
class: H(["me-menu-item", { "is-active": n === a.value }]),
|
|
4344
4347
|
"data-index": n,
|
|
4345
4348
|
onMousemove: (e) => X(u)(e) && (a.value = n),
|
|
4346
4349
|
onMousedown: Q((n) => e.command(t), ["prevent"])
|
|
4347
|
-
}, [t.avatar ? (G(),
|
|
4350
|
+
}, [t.avatar ? (G(), I("img", {
|
|
4348
4351
|
key: 0,
|
|
4349
4352
|
class: "me-menu-icon me-avatar",
|
|
4350
4353
|
src: t.avatar,
|
|
4351
4354
|
alt: ""
|
|
4352
|
-
}, null, 8, Dl)) : (G(),
|
|
4355
|
+
}, null, 8, Dl)) : (G(), I("span", Ol, [(G(), P(J(s[t.kind])))])), L("span", kl, [L("span", Al, Y(t.label), 1), t.description ? (G(), I("span", jl, Y(t.description), 1)) : F("", !0)])], 42, El))), 128))]))), 128)), e.items.length ? F("", !0) : (G(), I("div", Ml, Y(i.value.empty), 1))], 16));
|
|
4353
4356
|
}
|
|
4354
4357
|
}), Pl = { class: "me-datepicker-head" }, Fl = { class: "me-datepicker-month" }, Il = ["title"], Ll = ["title"], Rl = { class: "me-datepicker-grid" }, zl = ["onClick"], Bl = { class: "me-datepicker-options" }, Vl = { class: "me-menu-title me-menu-text" }, Hl = ["aria-checked"], Ul = { class: "me-menu-title me-menu-text" }, Wl = { class: "me-menu-shortcut" }, Gl = {
|
|
4355
4358
|
key: 0,
|
|
@@ -4360,7 +4363,7 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4360
4363
|
}, $l = ["onClick"], eu = { class: "me-menu-title me-menu-text" }, tu = { class: "me-menu-title me-menu-text" }, nu = { class: "me-menu-shortcut" }, ru = {
|
|
4361
4364
|
key: 0,
|
|
4362
4365
|
class: "me-popover me-submenu"
|
|
4363
|
-
}, iu = ["onClick"], au = { class: "me-menu-title me-menu-text" }, ou = { class: "me-datepicker-options" }, su = { class: "me-menu-title me-menu-text" }, cu = ["href"], lu = { class: "me-menu-title me-menu-text" }, uu = /* @__PURE__ */
|
|
4366
|
+
}, iu = ["onClick"], au = { class: "me-menu-title me-menu-text" }, ou = { class: "me-datepicker-options" }, su = { class: "me-menu-title me-menu-text" }, cu = ["href"], lu = { class: "me-menu-title me-menu-text" }, uu = /* @__PURE__ */ B({
|
|
4364
4367
|
__name: "DatePicker",
|
|
4365
4368
|
props: {
|
|
4366
4369
|
value: {},
|
|
@@ -4371,7 +4374,7 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4371
4374
|
},
|
|
4372
4375
|
emits: ["change", "clear"],
|
|
4373
4376
|
setup(e, { emit: t }) {
|
|
4374
|
-
let n = e, i = t, a =
|
|
4377
|
+
let n = e, i = t, a = N(() => n.messages), o = N(() => n.value), s = (e) => i("change", {
|
|
4375
4378
|
...n.value,
|
|
4376
4379
|
...e
|
|
4377
4380
|
}), u = K("start"), p = (e) => e ? c(e, n.locale, "short") : "", v = K({
|
|
@@ -4402,17 +4405,17 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4402
4405
|
let x = (e) => {
|
|
4403
4406
|
let t = l(e) ?? /* @__PURE__ */ new Date();
|
|
4404
4407
|
return new Date(t.getFullYear(), t.getMonth(), 1);
|
|
4405
|
-
}, S = K(x(n.value.start)),
|
|
4408
|
+
}, S = K(x(n.value.start)), C = h(/* @__PURE__ */ new Date()), w = N(() => {
|
|
4406
4409
|
if (/^(zh|ja|ko)/.test(n.locale)) return new Intl.DateTimeFormat(n.locale, {
|
|
4407
4410
|
year: "numeric",
|
|
4408
4411
|
month: "long"
|
|
4409
4412
|
}).format(S.value);
|
|
4410
4413
|
let e = new Intl.DateTimeFormat(n.locale, { month: n.locale.startsWith("en") ? "short" : "long" }).format(S.value);
|
|
4411
4414
|
return `${e.charAt(0).toUpperCase()}${e.slice(1)} ${S.value.getFullYear()}`;
|
|
4412
|
-
}),
|
|
4415
|
+
}), T = N(() => {
|
|
4413
4416
|
let e = new Intl.DateTimeFormat(n.locale, { weekday: /^(vi|zh)/.test(n.locale) ? "narrow" : "short" });
|
|
4414
4417
|
return Array.from({ length: 7 }, (t, n) => e.format(new Date(2023, 0, 2 + n)).slice(0, 2));
|
|
4415
|
-
}),
|
|
4418
|
+
}), E = N(() => {
|
|
4416
4419
|
let e = S.value, t = (e.getDay() + 6) % 7;
|
|
4417
4420
|
return Array.from({ length: 42 }, (n, r) => {
|
|
4418
4421
|
let i = new Date(e.getFullYear(), e.getMonth(), 1 - t + r);
|
|
@@ -4422,8 +4425,8 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4422
4425
|
inMonth: i.getMonth() === e.getMonth()
|
|
4423
4426
|
};
|
|
4424
4427
|
});
|
|
4425
|
-
}),
|
|
4426
|
-
function
|
|
4428
|
+
}), D = (e) => !!o.value.end && e > o.value.start && e < o.value.end;
|
|
4429
|
+
function O(e) {
|
|
4427
4430
|
!o.value.end || u.value === "start" ? (o.value.end && e > o.value.end ? s({
|
|
4428
4431
|
start: e,
|
|
4429
4432
|
end: e
|
|
@@ -4432,11 +4435,11 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4432
4435
|
end: o.value.start
|
|
4433
4436
|
}) : s({ end: e }), u.value = "start");
|
|
4434
4437
|
}
|
|
4435
|
-
function
|
|
4436
|
-
S.value = x(
|
|
4438
|
+
function k() {
|
|
4439
|
+
S.value = x(C);
|
|
4437
4440
|
}
|
|
4438
|
-
let
|
|
4439
|
-
function
|
|
4441
|
+
let A = K(null), j = N(() => o.value.time ? m : d), ee = (e) => a.value.formats[e];
|
|
4442
|
+
function R() {
|
|
4440
4443
|
o.value.end ? s({
|
|
4441
4444
|
end: null,
|
|
4442
4445
|
endTime: null
|
|
@@ -4445,7 +4448,7 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4445
4448
|
endTime: o.value.time ?? null
|
|
4446
4449
|
}), u.value = "end");
|
|
4447
4450
|
}
|
|
4448
|
-
function
|
|
4451
|
+
function B() {
|
|
4449
4452
|
let e = o.value.remind && o.value.remind !== "none" ? null : o.value.remind;
|
|
4450
4453
|
o.value.time ? s({
|
|
4451
4454
|
time: null,
|
|
@@ -4457,180 +4460,180 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4457
4460
|
remind: e
|
|
4458
4461
|
});
|
|
4459
4462
|
}
|
|
4460
|
-
function
|
|
4461
|
-
s({ format: e }),
|
|
4463
|
+
function te(e) {
|
|
4464
|
+
s({ format: e }), A.value = null;
|
|
4462
4465
|
}
|
|
4463
|
-
function
|
|
4464
|
-
s({ timeFormat: e }),
|
|
4466
|
+
function V(e) {
|
|
4467
|
+
s({ timeFormat: e }), A.value = null;
|
|
4465
4468
|
}
|
|
4466
|
-
function
|
|
4467
|
-
s({ remind: e === "none" ? null : e }),
|
|
4469
|
+
function ne(e) {
|
|
4470
|
+
s({ remind: e === "none" ? null : e }), A.value = null;
|
|
4468
4471
|
}
|
|
4469
|
-
return (t, n) => (G(),
|
|
4472
|
+
return (t, n) => (G(), I("div", {
|
|
4470
4473
|
class: "me-datepicker",
|
|
4471
|
-
onMouseleave: n[26] ||= (e) =>
|
|
4474
|
+
onMouseleave: n[26] ||= (e) => A.value = null
|
|
4472
4475
|
}, [
|
|
4473
|
-
|
|
4476
|
+
L("div", { class: H(["me-datepicker-inputs", { "is-split": !!e.value.end && !e.value.time }]) }, [L("div", { class: H(["me-datepicker-field", { "is-active": u.value === "start" && !!e.value.end }]) }, [pe(L("input", {
|
|
4474
4477
|
"onUpdate:modelValue": n[0] ||= (e) => v.value.start = e,
|
|
4475
4478
|
class: "me-datepicker-input",
|
|
4476
4479
|
onFocus: n[1] ||= (e) => u.value = "start",
|
|
4477
4480
|
onKeydown: n[2] ||= me(Q((e) => y("start"), ["prevent"]), ["enter"]),
|
|
4478
4481
|
onBlur: n[3] ||= (e) => y("start")
|
|
4479
|
-
}, null, 544), [[ue, v.value.start]]), e.value.time ? pe((G(),
|
|
4482
|
+
}, null, 544), [[ue, v.value.start]]), e.value.time ? pe((G(), I("input", {
|
|
4480
4483
|
key: 0,
|
|
4481
4484
|
"onUpdate:modelValue": n[4] ||= (e) => v.value.time = e,
|
|
4482
4485
|
class: "me-datepicker-input me-datepicker-time",
|
|
4483
4486
|
onKeydown: n[5] ||= me(Q((e) => b("time"), ["prevent"]), ["enter"]),
|
|
4484
4487
|
onBlur: n[6] ||= (e) => b("time")
|
|
4485
|
-
}, null, 544)), [[ue, v.value.time]]) :
|
|
4488
|
+
}, null, 544)), [[ue, v.value.time]]) : F("", !0)], 2), e.value.end ? (G(), I("div", {
|
|
4486
4489
|
key: 0,
|
|
4487
|
-
class:
|
|
4488
|
-
}, [pe(
|
|
4490
|
+
class: H(["me-datepicker-field", { "is-active": u.value === "end" }])
|
|
4491
|
+
}, [pe(L("input", {
|
|
4489
4492
|
"onUpdate:modelValue": n[7] ||= (e) => v.value.end = e,
|
|
4490
4493
|
class: "me-datepicker-input",
|
|
4491
4494
|
onFocus: n[8] ||= (e) => u.value = "end",
|
|
4492
4495
|
onKeydown: n[9] ||= me(Q((e) => y("end"), ["prevent"]), ["enter"]),
|
|
4493
4496
|
onBlur: n[10] ||= (e) => y("end")
|
|
4494
|
-
}, null, 544), [[ue, v.value.end]]), e.value.time ? pe((G(),
|
|
4497
|
+
}, null, 544), [[ue, v.value.end]]), e.value.time ? pe((G(), I("input", {
|
|
4495
4498
|
key: 0,
|
|
4496
4499
|
"onUpdate:modelValue": n[11] ||= (e) => v.value.endTime = e,
|
|
4497
4500
|
class: "me-datepicker-input me-datepicker-time",
|
|
4498
4501
|
onKeydown: n[12] ||= me(Q((e) => b("endTime"), ["prevent"]), ["enter"]),
|
|
4499
4502
|
onBlur: n[13] ||= (e) => b("endTime")
|
|
4500
|
-
}, null, 544)), [[ue, v.value.endTime]]) :
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4503
|
+
}, null, 544)), [[ue, v.value.endTime]]) : F("", !0)], 2)) : F("", !0)], 2),
|
|
4504
|
+
L("div", Pl, [
|
|
4505
|
+
L("span", Fl, Y(w.value), 1),
|
|
4506
|
+
L("button", {
|
|
4504
4507
|
type: "button",
|
|
4505
4508
|
class: "me-datepicker-today",
|
|
4506
|
-
onClick:
|
|
4509
|
+
onClick: k
|
|
4507
4510
|
}, Y(e.relative.today), 1),
|
|
4508
|
-
|
|
4511
|
+
L("button", {
|
|
4509
4512
|
type: "button",
|
|
4510
4513
|
class: "me-tool-btn",
|
|
4511
4514
|
title: a.value.prevMonth,
|
|
4512
4515
|
onClick: n[14] ||= (e) => S.value = new Date(S.value.getFullYear(), S.value.getMonth() - 1, 1)
|
|
4513
|
-
}, [
|
|
4514
|
-
|
|
4516
|
+
}, [z(X(He))], 8, Il),
|
|
4517
|
+
L("button", {
|
|
4515
4518
|
type: "button",
|
|
4516
4519
|
class: "me-tool-btn",
|
|
4517
4520
|
title: a.value.nextMonth,
|
|
4518
4521
|
onClick: n[15] ||= (e) => S.value = new Date(S.value.getFullYear(), S.value.getMonth() + 1, 1)
|
|
4519
|
-
}, [
|
|
4522
|
+
}, [z(X(Ue))], 8, Ll)
|
|
4520
4523
|
]),
|
|
4521
|
-
|
|
4524
|
+
L("div", Rl, [(G(!0), I(M, null, q(T.value, (e, t) => (G(), I("span", {
|
|
4522
4525
|
key: t,
|
|
4523
4526
|
class: "me-datepicker-weekday"
|
|
4524
|
-
}, Y(e), 1))), 128)), (G(!0),
|
|
4527
|
+
}, Y(e), 1))), 128)), (G(!0), I(M, null, q(E.value, (t) => (G(), I("button", {
|
|
4525
4528
|
key: t.id,
|
|
4526
4529
|
type: "button",
|
|
4527
|
-
class:
|
|
4530
|
+
class: H(["me-datepicker-day", {
|
|
4528
4531
|
"is-outside": !t.inMonth,
|
|
4529
|
-
"is-today": t.id === X(
|
|
4532
|
+
"is-today": t.id === X(C),
|
|
4530
4533
|
"is-selected": t.id === e.value.start || t.id === e.value.end,
|
|
4531
|
-
"is-in-range":
|
|
4534
|
+
"is-in-range": D(t.id)
|
|
4532
4535
|
}]),
|
|
4533
|
-
onClick: (e) =>
|
|
4536
|
+
onClick: (e) => O(t.id)
|
|
4534
4537
|
}, Y(t.day), 11, zl))), 128))]),
|
|
4535
|
-
|
|
4536
|
-
|
|
4538
|
+
L("div", Bl, [
|
|
4539
|
+
L("button", {
|
|
4537
4540
|
type: "button",
|
|
4538
4541
|
class: "me-menu-item",
|
|
4539
|
-
onClick:
|
|
4540
|
-
onMouseenter: n[16] ||= (e) =>
|
|
4541
|
-
}, [
|
|
4542
|
-
class:
|
|
4542
|
+
onClick: R,
|
|
4543
|
+
onMouseenter: n[16] ||= (e) => A.value = null
|
|
4544
|
+
}, [L("span", Vl, Y(a.value.endDate), 1), L("span", {
|
|
4545
|
+
class: H(["me-switch", { "is-on": !!e.value.end }]),
|
|
4543
4546
|
role: "switch",
|
|
4544
4547
|
"aria-checked": !!e.value.end
|
|
4545
4548
|
}, null, 10, Hl)], 32),
|
|
4546
|
-
|
|
4549
|
+
L("div", {
|
|
4547
4550
|
class: "me-submenu-anchor",
|
|
4548
|
-
onMouseenter: n[18] ||= (e) =>
|
|
4549
|
-
}, [
|
|
4551
|
+
onMouseenter: n[18] ||= (e) => A.value = "format"
|
|
4552
|
+
}, [L("button", {
|
|
4550
4553
|
type: "button",
|
|
4551
|
-
class:
|
|
4552
|
-
onClick: n[17] ||= (e) =>
|
|
4554
|
+
class: H(["me-menu-item", { "is-active": A.value === "format" }]),
|
|
4555
|
+
onClick: n[17] ||= (e) => A.value = "format"
|
|
4553
4556
|
}, [
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
], 2),
|
|
4557
|
+
L("span", Ul, Y(a.value.dateFormat), 1),
|
|
4558
|
+
L("span", Wl, Y(ee(e.value.format ?? "relative")), 1),
|
|
4559
|
+
z(X(Ue), { class: "me-menu-chevron" })
|
|
4560
|
+
], 2), A.value === "format" ? (G(), I("div", Gl, [(G(!0), I(M, null, q(X(g), (t) => (G(), I("button", {
|
|
4558
4561
|
key: t,
|
|
4559
4562
|
type: "button",
|
|
4560
4563
|
class: "me-menu-item",
|
|
4561
|
-
onClick: (e) =>
|
|
4562
|
-
}, [
|
|
4564
|
+
onClick: (e) => te(t)
|
|
4565
|
+
}, [L("span", ql, Y(ee(t)), 1), (e.value.format ?? "relative") === t ? (G(), P(X(Be), {
|
|
4563
4566
|
key: 0,
|
|
4564
4567
|
class: "me-menu-check"
|
|
4565
|
-
})) :
|
|
4566
|
-
|
|
4568
|
+
})) : F("", !0)], 8, Kl))), 128))])) : F("", !0)], 32),
|
|
4569
|
+
L("button", {
|
|
4567
4570
|
type: "button",
|
|
4568
4571
|
class: "me-menu-item",
|
|
4569
|
-
onClick:
|
|
4570
|
-
onMouseenter: n[19] ||= (e) =>
|
|
4571
|
-
}, [
|
|
4572
|
-
class:
|
|
4572
|
+
onClick: B,
|
|
4573
|
+
onMouseenter: n[19] ||= (e) => A.value = null
|
|
4574
|
+
}, [L("span", Jl, Y(a.value.includeTime), 1), L("span", {
|
|
4575
|
+
class: H(["me-switch", { "is-on": !!e.value.time }]),
|
|
4573
4576
|
role: "switch",
|
|
4574
4577
|
"aria-checked": !!e.value.time
|
|
4575
4578
|
}, null, 10, Yl)], 32),
|
|
4576
|
-
e.value.time ? (G(),
|
|
4579
|
+
e.value.time ? (G(), I("div", {
|
|
4577
4580
|
key: 0,
|
|
4578
4581
|
class: "me-submenu-anchor",
|
|
4579
|
-
onMouseenter: n[21] ||= (e) =>
|
|
4580
|
-
}, [
|
|
4582
|
+
onMouseenter: n[21] ||= (e) => A.value = "timeFormat"
|
|
4583
|
+
}, [L("button", {
|
|
4581
4584
|
type: "button",
|
|
4582
|
-
class:
|
|
4583
|
-
onClick: n[20] ||= (e) =>
|
|
4585
|
+
class: H(["me-menu-item", { "is-active": A.value === "timeFormat" }]),
|
|
4586
|
+
onClick: n[20] ||= (e) => A.value = "timeFormat"
|
|
4584
4587
|
}, [
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
], 2),
|
|
4588
|
+
L("span", Xl, Y(a.value.timeFormat), 1),
|
|
4589
|
+
L("span", Zl, Y((e.value.timeFormat ?? "24") === "12" ? a.value.hour12 : a.value.hour24), 1),
|
|
4590
|
+
z(X(Ue), { class: "me-menu-chevron" })
|
|
4591
|
+
], 2), A.value === "timeFormat" ? (G(), I("div", Ql, [(G(), I(M, null, q(["12", "24"], (t) => L("button", {
|
|
4589
4592
|
key: t,
|
|
4590
4593
|
type: "button",
|
|
4591
4594
|
class: "me-menu-item",
|
|
4592
|
-
onClick: (e) =>
|
|
4593
|
-
}, [
|
|
4595
|
+
onClick: (e) => V(t)
|
|
4596
|
+
}, [L("span", eu, Y(t === "12" ? a.value.hour12 : a.value.hour24), 1), (e.value.timeFormat ?? "24") === t ? (G(), P(X(Be), {
|
|
4594
4597
|
key: 0,
|
|
4595
4598
|
class: "me-menu-check"
|
|
4596
|
-
})) :
|
|
4597
|
-
|
|
4599
|
+
})) : F("", !0)], 8, $l)), 64))])) : F("", !0)], 32)) : F("", !0),
|
|
4600
|
+
L("div", {
|
|
4598
4601
|
class: "me-submenu-anchor",
|
|
4599
|
-
onMouseenter: n[23] ||= (e) =>
|
|
4600
|
-
}, [
|
|
4602
|
+
onMouseenter: n[23] ||= (e) => A.value = "remind"
|
|
4603
|
+
}, [L("button", {
|
|
4601
4604
|
type: "button",
|
|
4602
|
-
class:
|
|
4603
|
-
onClick: n[22] ||= (e) =>
|
|
4605
|
+
class: H(["me-menu-item", { "is-active": A.value === "remind" }]),
|
|
4606
|
+
onClick: n[22] ||= (e) => A.value = "remind"
|
|
4604
4607
|
}, [
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
], 2),
|
|
4608
|
+
L("span", tu, Y(a.value.remind), 1),
|
|
4609
|
+
L("span", nu, Y(a.value.reminders[e.value.remind ?? "none"] ?? a.value.reminders.none), 1),
|
|
4610
|
+
z(X(Ue), { class: "me-menu-chevron" })
|
|
4611
|
+
], 2), A.value === "remind" ? (G(), I("div", ru, [(G(!0), I(M, null, q(j.value, (t) => (G(), I("button", {
|
|
4609
4612
|
key: t,
|
|
4610
4613
|
type: "button",
|
|
4611
4614
|
class: "me-menu-item",
|
|
4612
|
-
onClick: (e) =>
|
|
4613
|
-
}, [
|
|
4615
|
+
onClick: (e) => ne(t)
|
|
4616
|
+
}, [L("span", au, Y(a.value.reminders[t]), 1), (e.value.remind ?? "none") === t ? (G(), P(X(Be), {
|
|
4614
4617
|
key: 0,
|
|
4615
4618
|
class: "me-menu-check"
|
|
4616
|
-
})) :
|
|
4619
|
+
})) : F("", !0)], 8, iu))), 128))])) : F("", !0)], 32)
|
|
4617
4620
|
]),
|
|
4618
|
-
|
|
4621
|
+
L("div", ou, [L("button", {
|
|
4619
4622
|
type: "button",
|
|
4620
4623
|
class: "me-menu-item",
|
|
4621
4624
|
onClick: n[24] ||= (e) => i("clear"),
|
|
4622
|
-
onMouseenter: n[25] ||= (e) =>
|
|
4623
|
-
}, [
|
|
4624
|
-
e.helpUrl ? (G(),
|
|
4625
|
+
onMouseenter: n[25] ||= (e) => A.value = null
|
|
4626
|
+
}, [L("span", su, Y(a.value.clear), 1)], 32)]),
|
|
4627
|
+
e.helpUrl ? (G(), I("a", {
|
|
4625
4628
|
key: 0,
|
|
4626
4629
|
class: "me-menu-item me-datepicker-help",
|
|
4627
4630
|
href: e.helpUrl,
|
|
4628
4631
|
target: "_blank",
|
|
4629
4632
|
rel: "noopener noreferrer"
|
|
4630
|
-
}, [
|
|
4633
|
+
}, [z(X(We), { class: "me-menu-chevron" }), L("span", lu, Y(a.value.learnReminders), 1)], 8, cu)) : F("", !0)
|
|
4631
4634
|
], 32));
|
|
4632
4635
|
}
|
|
4633
|
-
}), du = ["data-kind"], fu = ["src"], pu = ["placeholder"], mu = { class: "me-mention-results" }, hu = ["onMouseenter", "onClick"], gu = ["src"], _u = {
|
|
4636
|
+
}), du = ["data-kind"], fu = ["src"], pu = ["placeholder"], mu = { class: "me-mention-results me-popover-scroll" }, hu = ["onMouseenter", "onClick"], gu = ["src"], _u = {
|
|
4634
4637
|
key: 1,
|
|
4635
4638
|
class: "me-menu-icon"
|
|
4636
4639
|
}, vu = { class: "me-menu-text" }, yu = { class: "me-menu-title" }, bu = {
|
|
@@ -4639,11 +4642,11 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4639
4642
|
}, xu = {
|
|
4640
4643
|
key: 0,
|
|
4641
4644
|
class: "me-menu-empty"
|
|
4642
|
-
}, Su = ["href"], Cu = { class: "me-menu-icon" }, wu = { class: "me-menu-title me-menu-text" }, Tu = /* @__PURE__ */
|
|
4645
|
+
}, Su = ["href"], Cu = { class: "me-menu-icon" }, wu = { class: "me-menu-title me-menu-text" }, Tu = /* @__PURE__ */ B({
|
|
4643
4646
|
__name: "MentionView",
|
|
4644
4647
|
props: xe,
|
|
4645
4648
|
setup(e) {
|
|
4646
|
-
let n = e, r = $i(() => n.editor), a =
|
|
4649
|
+
let n = e, r = $i(() => n.editor), a = N(() => n.editor.storage.meiConfig), o = N(() => a.value.messages.mention), s = N(() => n.extension.options), c = N(() => n.node.attrs.kind ?? "user"), l = N(() => {
|
|
4647
4650
|
let e = n.node.attrs;
|
|
4648
4651
|
return {
|
|
4649
4652
|
start: e.id,
|
|
@@ -4654,13 +4657,13 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4654
4657
|
timeFormat: e.timeFormat,
|
|
4655
4658
|
remind: e.remind
|
|
4656
4659
|
};
|
|
4657
|
-
}), u =
|
|
4660
|
+
}), u = N(() => c.value === "date" ? t(l.value, a.value.locale, o.value) : n.node.attrs.label ?? n.node.attrs.id), d = K(!1), f = K(null), p = K(null), m = null;
|
|
4658
4661
|
function h(e) {
|
|
4659
4662
|
if (!d.value) return;
|
|
4660
4663
|
let t = e.target;
|
|
4661
4664
|
p.value?.contains(t) || f.value?.contains(t) || b();
|
|
4662
4665
|
}
|
|
4663
|
-
|
|
4666
|
+
re(() => document.addEventListener("pointerdown", h, !0));
|
|
4664
4667
|
function g() {
|
|
4665
4668
|
let e = p.value, t = f.value;
|
|
4666
4669
|
if (!e || !t) return;
|
|
@@ -4680,12 +4683,12 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4680
4683
|
}));
|
|
4681
4684
|
});
|
|
4682
4685
|
}
|
|
4683
|
-
let _ =
|
|
4686
|
+
let _ = N(() => _i(n.node.attrs.href)), v = N(() => _i(n.node.attrs.avatar, "image"));
|
|
4684
4687
|
function y(e) {
|
|
4685
4688
|
if (n.editor.isEditable) {
|
|
4686
4689
|
if (e.preventDefault(), d.value) return b();
|
|
4687
|
-
d.value = !0,
|
|
4688
|
-
g(),
|
|
4690
|
+
d.value = !0, w.value = "", ne(() => {
|
|
4691
|
+
g(), D.value?.focus();
|
|
4689
4692
|
});
|
|
4690
4693
|
} else {
|
|
4691
4694
|
let e = n.node.attrs;
|
|
@@ -4722,16 +4725,16 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4722
4725
|
} : null, e);
|
|
4723
4726
|
}
|
|
4724
4727
|
}
|
|
4725
|
-
function
|
|
4728
|
+
function C() {
|
|
4726
4729
|
b(), n.deleteNode(), n.editor.commands.focus();
|
|
4727
4730
|
}
|
|
4728
|
-
let
|
|
4729
|
-
Z([
|
|
4731
|
+
let w = K(""), T = se([]), E = K(0), D = K(null), O = 0;
|
|
4732
|
+
Z([w, d], async () => {
|
|
4730
4733
|
if (!d.value || c.value === "date") return;
|
|
4731
|
-
let e = ++
|
|
4732
|
-
e ===
|
|
4734
|
+
let e = ++O, t = s.value.search ? await s.value.search(w.value) : [];
|
|
4735
|
+
e === O && (T.value = t.filter((e) => e.kind !== "date"), E.value = 0);
|
|
4733
4736
|
});
|
|
4734
|
-
function
|
|
4737
|
+
function k(e) {
|
|
4735
4738
|
x({
|
|
4736
4739
|
id: e.id,
|
|
4737
4740
|
label: e.label,
|
|
@@ -4740,40 +4743,40 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4740
4743
|
avatar: e.avatar ?? null
|
|
4741
4744
|
});
|
|
4742
4745
|
}
|
|
4743
|
-
function
|
|
4746
|
+
function A(e) {
|
|
4744
4747
|
e.stopPropagation();
|
|
4745
|
-
let t =
|
|
4746
|
-
e.key === "Escape" ? (b(), n.editor.commands.focus()) : t && (e.key === "ArrowDown" || e.key === "ArrowUp") ? (e.preventDefault(),
|
|
4748
|
+
let t = T.value.length;
|
|
4749
|
+
e.key === "Escape" ? (b(), n.editor.commands.focus()) : t && (e.key === "ArrowDown" || e.key === "ArrowUp") ? (e.preventDefault(), E.value = (E.value + (e.key === "ArrowDown" ? 1 : t - 1)) % t) : e.key === "Enter" && T.value[E.value] && (e.preventDefault(), k(T.value[E.value]));
|
|
4747
4750
|
}
|
|
4748
|
-
let
|
|
4751
|
+
let j = {
|
|
4749
4752
|
user: Wt,
|
|
4750
4753
|
page: it,
|
|
4751
4754
|
date: Re
|
|
4752
4755
|
};
|
|
4753
|
-
return
|
|
4756
|
+
return W(() => {
|
|
4754
4757
|
m?.(), document.removeEventListener("pointerdown", h, !0);
|
|
4755
|
-
}), (e, t) => (G(),
|
|
4758
|
+
}), (e, t) => (G(), P(X(ve), {
|
|
4756
4759
|
as: "span",
|
|
4757
4760
|
class: "me-mention-wrap"
|
|
4758
4761
|
}, {
|
|
4759
|
-
default: fe(() => [
|
|
4762
|
+
default: fe(() => [L("span", {
|
|
4760
4763
|
ref_key: "chip",
|
|
4761
4764
|
ref: f,
|
|
4762
|
-
class:
|
|
4765
|
+
class: H(["me-mention", [`me-mention--${c.value}`, {
|
|
4763
4766
|
"is-selected": e.selected,
|
|
4764
4767
|
"is-open": d.value
|
|
4765
4768
|
}]]),
|
|
4766
4769
|
"data-kind": c.value,
|
|
4767
4770
|
onClick: y
|
|
4768
|
-
}, [c.value === "user" && v.value ? (G(),
|
|
4771
|
+
}, [c.value === "user" && v.value ? (G(), I("img", {
|
|
4769
4772
|
key: 0,
|
|
4770
4773
|
class: "me-mention-avatar",
|
|
4771
4774
|
src: v.value,
|
|
4772
4775
|
alt: ""
|
|
4773
|
-
}, null, 8, fu)) : c.value === "page" ? (G(),
|
|
4776
|
+
}, null, 8, fu)) : c.value === "page" ? (G(), P(X(it), {
|
|
4774
4777
|
key: 1,
|
|
4775
4778
|
class: "me-mention-icon"
|
|
4776
|
-
})) :
|
|
4779
|
+
})) : F("", !0), L("span", null, Y(c.value === "page" ? "" : "@") + Y(u.value), 1)], 10, du), (G(), P(ee, { to: "body" }, [d.value ? (G(), I("div", V({
|
|
4777
4780
|
key: 0,
|
|
4778
4781
|
ref_key: "panel",
|
|
4779
4782
|
ref: p
|
|
@@ -4781,8 +4784,8 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4781
4784
|
class: ["me-popover me-mention-popover", { "me-mention-popover--date": c.value === "date" }],
|
|
4782
4785
|
contenteditable: "false",
|
|
4783
4786
|
onMousedown: t[1] ||= Q(() => {}, ["stop"]),
|
|
4784
|
-
onKeydown:
|
|
4785
|
-
}), [c.value === "date" ? (G(),
|
|
4787
|
+
onKeydown: A
|
|
4788
|
+
}), [c.value === "date" ? (G(), P(uu, {
|
|
4786
4789
|
key: 0,
|
|
4787
4790
|
value: l.value,
|
|
4788
4791
|
locale: a.value.locale,
|
|
@@ -4790,44 +4793,44 @@ var Sc = new on("emoji"), Cc = Xt.create({
|
|
|
4790
4793
|
relative: o.value,
|
|
4791
4794
|
"help-url": s.value.reminderHelpUrl,
|
|
4792
4795
|
onChange: S,
|
|
4793
|
-
onClear:
|
|
4796
|
+
onClear: C
|
|
4794
4797
|
}, null, 8, [
|
|
4795
4798
|
"value",
|
|
4796
4799
|
"locale",
|
|
4797
4800
|
"messages",
|
|
4798
4801
|
"relative",
|
|
4799
4802
|
"help-url"
|
|
4800
|
-
])) : (G(),
|
|
4801
|
-
pe(
|
|
4803
|
+
])) : (G(), I(M, { key: 1 }, [
|
|
4804
|
+
pe(L("input", {
|
|
4802
4805
|
ref_key: "searchInput",
|
|
4803
|
-
ref:
|
|
4804
|
-
"onUpdate:modelValue": t[0] ||= (e) =>
|
|
4806
|
+
ref: D,
|
|
4807
|
+
"onUpdate:modelValue": t[0] ||= (e) => w.value = e,
|
|
4805
4808
|
class: "me-input me-mention-search",
|
|
4806
4809
|
placeholder: o.value.searchPlaceholder
|
|
4807
|
-
}, null, 8, pu), [[ue,
|
|
4808
|
-
|
|
4810
|
+
}, null, 8, pu), [[ue, w.value]]),
|
|
4811
|
+
L("div", mu, [(G(!0), I(M, null, q(T.value, (t, n) => (G(), I("button", {
|
|
4809
4812
|
key: `${t.kind}-${t.id}`,
|
|
4810
4813
|
type: "button",
|
|
4811
|
-
class:
|
|
4812
|
-
"is-active": n ===
|
|
4814
|
+
class: H(["me-menu-item", {
|
|
4815
|
+
"is-active": n === E.value,
|
|
4813
4816
|
"is-current": t.id === e.node.attrs.id
|
|
4814
4817
|
}]),
|
|
4815
|
-
onMouseenter: (e) =>
|
|
4816
|
-
onClick: (e) =>
|
|
4817
|
-
}, [X(_i)(t.avatar, "image") ? (G(),
|
|
4818
|
+
onMouseenter: (e) => E.value = n,
|
|
4819
|
+
onClick: (e) => k(t)
|
|
4820
|
+
}, [X(_i)(t.avatar, "image") ? (G(), I("img", {
|
|
4818
4821
|
key: 0,
|
|
4819
4822
|
class: "me-menu-icon me-avatar",
|
|
4820
4823
|
src: X(_i)(t.avatar, "image"),
|
|
4821
4824
|
alt: ""
|
|
4822
|
-
}, null, 8, gu)) : (G(),
|
|
4823
|
-
c.value === "page" && _.value ? (G(),
|
|
4825
|
+
}, null, 8, gu)) : (G(), I("span", _u, [(G(), P(J(j[t.kind])))])), L("span", vu, [L("span", yu, Y(t.label), 1), t.description ? (G(), I("span", bu, Y(t.description), 1)) : F("", !0)])], 42, hu))), 128)), T.value.length ? F("", !0) : (G(), I("div", xu, Y(s.value.search ? o.value.empty : o.value.noSearch), 1))]),
|
|
4826
|
+
c.value === "page" && _.value ? (G(), I("a", {
|
|
4824
4827
|
key: 0,
|
|
4825
4828
|
class: "me-menu-item me-mention-open",
|
|
4826
4829
|
href: _.value,
|
|
4827
4830
|
target: "_blank",
|
|
4828
4831
|
rel: "noopener noreferrer"
|
|
4829
|
-
}, [
|
|
4830
|
-
], 64))], 16)) :
|
|
4832
|
+
}, [L("span", Cu, [z(X(tt))]), L("span", wu, Y(o.value.openPage), 1)], 8, Su)) : F("", !0)
|
|
4833
|
+
], 64))], 16)) : F("", !0)]))]),
|
|
4831
4834
|
_: 1
|
|
4832
4835
|
}));
|
|
4833
4836
|
}
|
|
@@ -4941,11 +4944,11 @@ function Au() {
|
|
|
4941
4944
|
var ju = Xt.create({ name: "mermaidPreview" }), Mu = "flowchart LR\n A[Ý tưởng] --> B{Duyệt?}\n B -- Có --> C[Làm]\n B -- Không --> A", Nu = ["data-depth", "onClick"], Pu = {
|
|
4942
4945
|
key: 0,
|
|
4943
4946
|
class: "me-hint"
|
|
4944
|
-
}, Fu = /* @__PURE__ */
|
|
4947
|
+
}, Fu = /* @__PURE__ */ B({
|
|
4945
4948
|
__name: "TocView",
|
|
4946
4949
|
props: xe,
|
|
4947
4950
|
setup(e) {
|
|
4948
|
-
let t = e, n =
|
|
4951
|
+
let t = e, n = N(() => t.editor.storage.meiConfig.messages.toc), r = se([]);
|
|
4949
4952
|
function i() {
|
|
4950
4953
|
let e = [];
|
|
4951
4954
|
t.editor.state.doc.descendants((t, n) => (t.type.name === "heading" ? e.push({
|
|
@@ -4958,8 +4961,8 @@ var ju = Xt.create({ name: "mermaidPreview" }), Mu = "flowchart LR\n A[Ý tư
|
|
|
4958
4961
|
text: t.firstChild?.textContent ?? ""
|
|
4959
4962
|
}), t.type.name !== "heading")), r.value = e;
|
|
4960
4963
|
}
|
|
4961
|
-
i(), t.editor.on("update", i),
|
|
4962
|
-
let a =
|
|
4964
|
+
i(), t.editor.on("update", i), W(() => t.editor.off("update", i));
|
|
4965
|
+
let a = N(() => Math.min(...r.value.map((e) => e.level), 4));
|
|
4963
4966
|
function o(e) {
|
|
4964
4967
|
let { view: n } = t.editor;
|
|
4965
4968
|
n.nodeDOM(e.pos)?.scrollIntoView({
|
|
@@ -4967,17 +4970,17 @@ var ju = Xt.create({ name: "mermaidPreview" }), Mu = "flowchart LR\n A[Ý tư
|
|
|
4967
4970
|
block: "start"
|
|
4968
4971
|
}), n.dispatch(n.state.tr.setSelection(cn.near(n.state.doc.resolve(e.pos + 1)))), n.focus();
|
|
4969
4972
|
}
|
|
4970
|
-
return (e, t) => (G(),
|
|
4971
|
-
class:
|
|
4973
|
+
return (e, t) => (G(), P(X(ve), {
|
|
4974
|
+
class: H(["me-toc", { "is-selected": e.selected }]),
|
|
4972
4975
|
contenteditable: "false"
|
|
4973
4976
|
}, {
|
|
4974
|
-
default: fe(() => [(G(!0),
|
|
4977
|
+
default: fe(() => [(G(!0), I(M, null, q(r.value, (e) => (G(), I("button", {
|
|
4975
4978
|
key: e.pos,
|
|
4976
4979
|
type: "button",
|
|
4977
4980
|
class: "me-toc-item",
|
|
4978
4981
|
"data-depth": e.level - a.value,
|
|
4979
4982
|
onClick: (t) => o(e)
|
|
4980
|
-
}, Y(e.text || n.value.untitled), 9, Nu))), 128)), r.value.length ?
|
|
4983
|
+
}, Y(e.text || n.value.untitled), 9, Nu))), 128)), r.value.length ? F("", !0) : (G(), I("p", Pu, Y(n.value.empty), 1))]),
|
|
4981
4984
|
_: 1
|
|
4982
4985
|
}, 8, ["class"]));
|
|
4983
4986
|
}
|
|
@@ -5255,7 +5258,7 @@ function Xu(e) {
|
|
|
5255
5258
|
} : e;
|
|
5256
5259
|
}
|
|
5257
5260
|
// src/theme/index.ts
|
|
5258
|
-
var Zu = (e) => e, Qu = ["default", ...
|
|
5261
|
+
var Zu = (e) => e, Qu = ["default", ...k], $u = {
|
|
5259
5262
|
key: 0,
|
|
5260
5263
|
class: "me-menu-label"
|
|
5261
5264
|
}, ed = [
|
|
@@ -5282,7 +5285,7 @@ function rd(e) {
|
|
|
5282
5285
|
];
|
|
5283
5286
|
}
|
|
5284
5287
|
// src/components/ColorList.vue
|
|
5285
|
-
var id = /* @__PURE__ */
|
|
5288
|
+
var id = /* @__PURE__ */ B({
|
|
5286
5289
|
__name: "ColorList",
|
|
5287
5290
|
props: {
|
|
5288
5291
|
messages: {},
|
|
@@ -5292,7 +5295,7 @@ var id = /* @__PURE__ */ z({
|
|
|
5292
5295
|
},
|
|
5293
5296
|
emits: ["pick", "hover"],
|
|
5294
5297
|
setup(e) {
|
|
5295
|
-
let t = e, n =
|
|
5298
|
+
let t = e, n = N(() => rd(t.recent)), r = (e) => ({
|
|
5296
5299
|
recent: t.messages.blockMenu.recent,
|
|
5297
5300
|
text: t.messages.blockMenu.textColor,
|
|
5298
5301
|
bg: t.messages.blockMenu.backgroundColor
|
|
@@ -5300,22 +5303,22 @@ var id = /* @__PURE__ */ z({
|
|
|
5300
5303
|
let n = t.messages.colors[e.color] ?? e.color;
|
|
5301
5304
|
return e.section === "recent" ? e.kind === "text" ? t.messages.slash.textColor(n) : t.messages.slash.bgColor(n) : n;
|
|
5302
5305
|
};
|
|
5303
|
-
return (t, s) => (G(!0),
|
|
5306
|
+
return (t, s) => (G(!0), I(M, null, q(n.value, (s, c) => (G(), I(M, { key: `${s.section}-${s.kind}-${s.color}` }, [c === 0 || n.value[c - 1].section !== s.section ? (G(), I("div", $u, Y(r(s.section)), 1)) : F("", !0), L("button", {
|
|
5304
5307
|
type: "button",
|
|
5305
|
-
class:
|
|
5308
|
+
class: H(["me-menu-item", { "is-active": c === e.activeIndex }]),
|
|
5306
5309
|
"data-index": c,
|
|
5307
5310
|
onMouseenter: (e) => t.$emit("hover", c),
|
|
5308
5311
|
onClick: (e) => t.$emit("pick", s.kind, s.color)
|
|
5309
5312
|
}, [
|
|
5310
|
-
|
|
5311
|
-
class:
|
|
5313
|
+
L("span", {
|
|
5314
|
+
class: H(["me-menu-icon", s.kind === "text" ? "me-swatch--text" : "me-swatch--bg"]),
|
|
5312
5315
|
"data-color": i(s.color)
|
|
5313
5316
|
}, "A", 10, td),
|
|
5314
|
-
|
|
5315
|
-
a(s) ? (G(),
|
|
5317
|
+
L("span", nd, Y(o(s)), 1),
|
|
5318
|
+
a(s) ? (G(), P(X(Be), {
|
|
5316
5319
|
key: 0,
|
|
5317
5320
|
class: "me-menu-check"
|
|
5318
|
-
})) :
|
|
5321
|
+
})) : F("", !0)
|
|
5319
5322
|
], 42, ed)], 64))), 128));
|
|
5320
5323
|
}
|
|
5321
5324
|
}), ad = { class: "me-menu-search" }, od = ["placeholder"], sd = {
|
|
@@ -5336,7 +5339,7 @@ var id = /* @__PURE__ */ z({
|
|
|
5336
5339
|
}, yd = {
|
|
5337
5340
|
key: 1,
|
|
5338
5341
|
class: "me-menu-empty"
|
|
5339
|
-
}, bd = /* @__PURE__ */
|
|
5342
|
+
}, bd = /* @__PURE__ */ B({
|
|
5340
5343
|
__name: "BlockMenu",
|
|
5341
5344
|
props: {
|
|
5342
5345
|
editor: {},
|
|
@@ -5347,10 +5350,10 @@ var id = /* @__PURE__ */ z({
|
|
|
5347
5350
|
setup(e, { emit: t }) {
|
|
5348
5351
|
let n = e, r = t, i = K(null), a = K(null);
|
|
5349
5352
|
Wa(i, K(!0), () => r("close"));
|
|
5350
|
-
let o =
|
|
5353
|
+
let o = N(() => n.editor.storage.meiConfig.messages), s = $i(() => n.editor), c = N(() => nr(n.editor.state.doc, n.range)), l = N(() => Nr(n.editor)), u = N(() => {
|
|
5351
5354
|
let e = c.value.map((e) => l.value.find((t) => t.matches?.(e.node))?.id);
|
|
5352
5355
|
return e.every((t) => t && t === e[0]) ? l.value.find((t) => t.id === e[0]) : void 0;
|
|
5353
|
-
}), d =
|
|
5356
|
+
}), d = N(() => c.value.every((e) => l.value.some((t) => t.matches?.(e.node)) || e.node.type.name === "callout")), f = N(() => c.value.some((e) => e.node.textContent.length > 0 || e.node.isTextblock)), p = N(() => pr(n.editor.state, n.range)), m = N(() => c.value.length === 1 ? c.value[0].node.attrs.id : void 0);
|
|
5354
5357
|
function h(e) {
|
|
5355
5358
|
r("close"), e();
|
|
5356
5359
|
}
|
|
@@ -5364,7 +5367,7 @@ var id = /* @__PURE__ */ z({
|
|
|
5364
5367
|
color: t
|
|
5365
5368
|
}), h(() => fr(n.editor, n.range, e, t));
|
|
5366
5369
|
}
|
|
5367
|
-
let y =
|
|
5370
|
+
let y = N(() => [
|
|
5368
5371
|
{
|
|
5369
5372
|
key: "delete",
|
|
5370
5373
|
label: o.value.blockMenu.delete,
|
|
@@ -5411,7 +5414,7 @@ var id = /* @__PURE__ */ z({
|
|
|
5411
5414
|
icon: Ct,
|
|
5412
5415
|
submenu: "color"
|
|
5413
5416
|
}] : []
|
|
5414
|
-
]), b =
|
|
5417
|
+
]), b = N(() => l.value.map((e) => ({
|
|
5415
5418
|
key: `turn-${e.id}`,
|
|
5416
5419
|
label: Pr(o.value, e),
|
|
5417
5420
|
icon: e.icon,
|
|
@@ -5419,10 +5422,10 @@ var id = /* @__PURE__ */ z({
|
|
|
5419
5422
|
checked: u.value?.id === e.id,
|
|
5420
5423
|
group: o.value.blockMenu.turnInto,
|
|
5421
5424
|
run: () => _(e)
|
|
5422
|
-
}))), x =
|
|
5423
|
-
let e =
|
|
5425
|
+
}))), x = N(() => rd(ma.value.colors)), S = K(""), C = (e) => e.normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/đ/g, "d").toLowerCase(), w = N(() => {
|
|
5426
|
+
let e = C(S.value.trim());
|
|
5424
5427
|
if (!e) return y.value;
|
|
5425
|
-
let t = (t) =>
|
|
5428
|
+
let t = (t) => C(`${t.group ?? ""} ${t.label}`).includes(e), n = f.value ? x.value.filter((e) => e.section !== "recent").map((e) => ({
|
|
5426
5429
|
key: `color-${e.kind}-${e.color}`,
|
|
5427
5430
|
label: e.kind === "text" ? o.value.slash.textColor(o.value.colors[e.color] ?? e.color) : o.value.slash.bgColor(o.value.colors[e.color] ?? e.color),
|
|
5428
5431
|
swatch: {
|
|
@@ -5440,138 +5443,138 @@ var id = /* @__PURE__ */ z({
|
|
|
5440
5443
|
...d.value ? b.value : [],
|
|
5441
5444
|
...n
|
|
5442
5445
|
].filter(t);
|
|
5443
|
-
}),
|
|
5446
|
+
}), T = K(0), E = K(null), D = K(-1), O = N(() => E.value === "turn" ? b.value.length : E.value === "color" ? x.value.length : 0);
|
|
5444
5447
|
Z(S, () => {
|
|
5445
|
-
|
|
5448
|
+
T.value = 0, E.value = null;
|
|
5446
5449
|
});
|
|
5447
|
-
function
|
|
5448
|
-
|
|
5450
|
+
function k() {
|
|
5451
|
+
ne(() => i.value?.querySelector(".me-menu-item.is-active:not(.has-submenu-open), .me-submenu .me-menu-item.is-active")?.scrollIntoView({ block: "nearest" }));
|
|
5449
5452
|
}
|
|
5450
|
-
function
|
|
5451
|
-
|
|
5453
|
+
function A(e, t = !1) {
|
|
5454
|
+
E.value = e, D.value = t ? 0 : -1;
|
|
5452
5455
|
}
|
|
5453
|
-
function
|
|
5456
|
+
function j(e) {
|
|
5454
5457
|
if (e) {
|
|
5455
|
-
if (e.submenu) return
|
|
5458
|
+
if (e.submenu) return A(e.submenu, !0);
|
|
5456
5459
|
e.run?.();
|
|
5457
5460
|
}
|
|
5458
5461
|
}
|
|
5459
|
-
function
|
|
5460
|
-
if (
|
|
5462
|
+
function R(e) {
|
|
5463
|
+
if (E.value === "turn") return j(b.value[e]);
|
|
5461
5464
|
let t = x.value[e];
|
|
5462
5465
|
t && v(t.kind, t.color);
|
|
5463
5466
|
}
|
|
5464
|
-
function
|
|
5465
|
-
let t =
|
|
5466
|
-
e.preventDefault(), i && (t ?
|
|
5467
|
+
function B(e) {
|
|
5468
|
+
let t = E.value && D.value >= 0, i = t ? O.value : w.value.length, a = (n) => {
|
|
5469
|
+
e.preventDefault(), i && (t ? D.value = (D.value + n + i) % i : T.value = (T.value + n + i) % i, k());
|
|
5467
5470
|
};
|
|
5468
5471
|
if (e.key === "ArrowDown") return a(1);
|
|
5469
5472
|
if (e.key === "ArrowUp" && !e.shiftKey && !za(e)) return a(-1);
|
|
5470
|
-
if (e.key === "ArrowRight" && !t &&
|
|
5471
|
-
if ((e.key === "ArrowLeft" || e.key === "Escape") &&
|
|
5473
|
+
if (e.key === "ArrowRight" && !t && w.value[T.value]?.submenu) return e.preventDefault(), A(w.value[T.value].submenu, !0);
|
|
5474
|
+
if ((e.key === "ArrowLeft" || e.key === "Escape") && E.value) e.preventDefault(), E.value = null;
|
|
5472
5475
|
else {
|
|
5473
5476
|
if (e.key === "Escape") return e.preventDefault(), r("close");
|
|
5474
|
-
if (e.key === "Enter") return e.preventDefault(), t ?
|
|
5477
|
+
if (e.key === "Enter") return e.preventDefault(), t ? R(D.value) : j(w.value[T.value]);
|
|
5475
5478
|
if ((e.key === "Delete" || e.key === "Backspace") && !S.value) return e.preventDefault(), h(() => sr(n.editor, n.range));
|
|
5476
5479
|
if (za(e) && e.key.toLowerCase() === "d") return e.preventDefault(), h(() => cr(n.editor, n.range));
|
|
5477
5480
|
if (za(e) && e.shiftKey && (e.key === "ArrowUp" || e.key === "ArrowDown")) return e.preventDefault(), h(() => lr(n.editor, n.range, e.key === "ArrowUp" ? "up" : "down"));
|
|
5478
5481
|
}
|
|
5479
5482
|
}
|
|
5480
|
-
let
|
|
5481
|
-
function
|
|
5482
|
-
|
|
5483
|
-
let t =
|
|
5484
|
-
t !==
|
|
5485
|
-
t ?
|
|
5483
|
+
let te;
|
|
5484
|
+
function U(e) {
|
|
5485
|
+
T.value = e, clearTimeout(te);
|
|
5486
|
+
let t = w.value[e]?.submenu ?? null;
|
|
5487
|
+
t !== E.value && (te = setTimeout(() => {
|
|
5488
|
+
t ? A(t) : E.value = null;
|
|
5486
5489
|
}, 150));
|
|
5487
5490
|
}
|
|
5488
|
-
let ie = () => clearTimeout(
|
|
5491
|
+
let ie = () => clearTimeout(te), ae = Ca(n.editor.view.dom, "popover.offset"), oe = N(() => {
|
|
5489
5492
|
let e = Math.min(n.anchor.bottom + ae, window.innerHeight - 420);
|
|
5490
5493
|
return {
|
|
5491
5494
|
left: `${Math.max(ae, n.anchor.left)}px`,
|
|
5492
5495
|
top: `${Math.max(ae, e)}px`
|
|
5493
5496
|
};
|
|
5494
|
-
}), se =
|
|
5497
|
+
}), se = N(() => {
|
|
5495
5498
|
let e = n.editor.view.dom, t = Ca(e, "menu.width") + Ca(e, "menu.submenuWidth") + ae * 2;
|
|
5496
5499
|
return n.anchor.left + t > window.innerWidth;
|
|
5497
5500
|
});
|
|
5498
|
-
return
|
|
5501
|
+
return re(() => a.value?.focus({ preventScroll: !0 })), W(() => clearTimeout(te)), (e, t) => (G(), P(ee, { to: "body" }, [L("div", V({
|
|
5499
5502
|
ref_key: "root",
|
|
5500
5503
|
ref: i
|
|
5501
5504
|
}, X(s), {
|
|
5502
5505
|
class: ["me-popover me-floating me-block-menu", { "is-flipped": se.value }],
|
|
5503
5506
|
style: oe.value,
|
|
5504
|
-
onKeydown:
|
|
5507
|
+
onKeydown: B
|
|
5505
5508
|
}), [
|
|
5506
|
-
|
|
5509
|
+
L("label", ad, [z(X(Mt)), pe(L("input", {
|
|
5507
5510
|
ref_key: "input",
|
|
5508
5511
|
ref: a,
|
|
5509
5512
|
"onUpdate:modelValue": t[0] ||= (e) => S.value = e,
|
|
5510
5513
|
class: "me-menu-search-input",
|
|
5511
5514
|
placeholder: o.value.blockMenu.search
|
|
5512
5515
|
}, null, 8, od), [[ue, S.value]])]),
|
|
5513
|
-
c.value.length > 1 ? (G(),
|
|
5514
|
-
|
|
5516
|
+
c.value.length > 1 ? (G(), I("div", sd, Y(o.value.blockMenu.selected(c.value.length)), 1)) : F("", !0),
|
|
5517
|
+
L("div", { class: H(["me-block-menu-list", { "is-scroll me-popover-scroll": S.value }]) }, [(G(!0), I(M, null, q(w.value, (e, n) => (G(), I(M, { key: e.key }, [S.value && e.group && (n === 0 || w.value[n - 1].group !== e.group) ? (G(), I("div", cd, Y(e.group), 1)) : F("", !0), L("div", {
|
|
5515
5518
|
class: "me-submenu-anchor",
|
|
5516
|
-
onMouseenter: (e) =>
|
|
5517
|
-
}, [
|
|
5519
|
+
onMouseenter: (e) => U(n)
|
|
5520
|
+
}, [L("button", {
|
|
5518
5521
|
type: "button",
|
|
5519
|
-
class:
|
|
5520
|
-
"is-active": n ===
|
|
5521
|
-
"has-submenu-open": e.submenu &&
|
|
5522
|
+
class: H(["me-menu-item", {
|
|
5523
|
+
"is-active": n === T.value,
|
|
5524
|
+
"has-submenu-open": e.submenu && E.value === e.submenu
|
|
5522
5525
|
}]),
|
|
5523
5526
|
onMousedown: t[1] ||= Q(() => {}, ["prevent"]),
|
|
5524
|
-
onClick: (t) =>
|
|
5527
|
+
onClick: (t) => j(e)
|
|
5525
5528
|
}, [
|
|
5526
|
-
e.swatch ? (G(),
|
|
5529
|
+
e.swatch ? (G(), I("span", {
|
|
5527
5530
|
key: 0,
|
|
5528
|
-
class:
|
|
5531
|
+
class: H(["me-menu-icon", e.swatch.kind === "text" ? "me-swatch--text" : "me-swatch--bg"]),
|
|
5529
5532
|
"data-color": e.swatch.color === "default" ? void 0 : e.swatch.color
|
|
5530
|
-
}, "A", 10, dd)) : (G(),
|
|
5531
|
-
|
|
5532
|
-
e.checked ? (G(),
|
|
5533
|
+
}, "A", 10, dd)) : (G(), I("span", fd, [(G(), P(J(e.icon)))])),
|
|
5534
|
+
L("span", pd, Y(e.label), 1),
|
|
5535
|
+
e.checked ? (G(), P(X(Be), {
|
|
5533
5536
|
key: 2,
|
|
5534
5537
|
class: "me-menu-check"
|
|
5535
|
-
})) :
|
|
5536
|
-
e.hint ? (G(),
|
|
5537
|
-
e.submenu ? (G(),
|
|
5538
|
+
})) : F("", !0),
|
|
5539
|
+
e.hint ? (G(), I("span", md, Y(e.hint), 1)) : F("", !0),
|
|
5540
|
+
e.submenu ? (G(), P(X(Ue), {
|
|
5538
5541
|
key: 4,
|
|
5539
5542
|
class: "me-menu-chevron"
|
|
5540
|
-
})) :
|
|
5541
|
-
], 42, ud), e.submenu &&
|
|
5543
|
+
})) : F("", !0)
|
|
5544
|
+
], 42, ud), e.submenu && E.value === e.submenu ? (G(), I("div", {
|
|
5542
5545
|
key: 0,
|
|
5543
5546
|
class: "me-popover me-submenu",
|
|
5544
5547
|
onMouseenter: ie,
|
|
5545
5548
|
onMousedown: t[3] ||= Q(() => {}, ["prevent"])
|
|
5546
|
-
}, [e.submenu === "turn" ? (G(!0),
|
|
5549
|
+
}, [e.submenu === "turn" ? (G(!0), I(M, { key: 0 }, q(b.value, (e, t) => (G(), I("button", {
|
|
5547
5550
|
key: e.key,
|
|
5548
5551
|
type: "button",
|
|
5549
|
-
class:
|
|
5550
|
-
onMouseenter: (e) =>
|
|
5552
|
+
class: H(["me-menu-item", { "is-active": t === D.value }]),
|
|
5553
|
+
onMouseenter: (e) => D.value = t,
|
|
5551
5554
|
onClick: (t) => e.run?.()
|
|
5552
5555
|
}, [
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
e.checked ? (G(),
|
|
5556
|
+
L("span", gd, [(G(), P(J(e.icon)))]),
|
|
5557
|
+
L("span", _d, Y(e.label), 1),
|
|
5558
|
+
e.checked ? (G(), P(X(Be), {
|
|
5556
5559
|
key: 0,
|
|
5557
5560
|
class: "me-menu-check"
|
|
5558
|
-
})) :
|
|
5559
|
-
e.hint ? (G(),
|
|
5560
|
-
], 42, hd))), 128)) : (G(),
|
|
5561
|
+
})) : F("", !0),
|
|
5562
|
+
e.hint ? (G(), I("span", vd, Y(e.hint), 1)) : F("", !0)
|
|
5563
|
+
], 42, hd))), 128)) : (G(), P(id, {
|
|
5561
5564
|
key: 1,
|
|
5562
5565
|
messages: o.value,
|
|
5563
5566
|
recent: X(ma).colors,
|
|
5564
5567
|
current: p.value,
|
|
5565
|
-
"active-index":
|
|
5566
|
-
onHover: t[2] ||= (e) =>
|
|
5568
|
+
"active-index": D.value,
|
|
5569
|
+
onHover: t[2] ||= (e) => D.value = e,
|
|
5567
5570
|
onPick: v
|
|
5568
5571
|
}, null, 8, [
|
|
5569
5572
|
"messages",
|
|
5570
5573
|
"recent",
|
|
5571
5574
|
"current",
|
|
5572
5575
|
"active-index"
|
|
5573
|
-
]))], 32)) :
|
|
5574
|
-
|
|
5576
|
+
]))], 32)) : F("", !0)], 40, ld)], 64))), 128))], 2),
|
|
5577
|
+
w.value.length ? F("", !0) : (G(), I("div", yd, Y(o.value.blockMenu.noResults), 1))
|
|
5575
5578
|
], 16)]));
|
|
5576
5579
|
}
|
|
5577
5580
|
}), xd = ["title", "onClick"], Sd = ["title", "onClick"], Cd = ["title"], wd = ["title"], Td = ["title", "onClick"], Ed = {
|
|
@@ -5583,18 +5586,18 @@ var id = /* @__PURE__ */ z({
|
|
|
5583
5586
|
}, Md = ["title"], Nd = {
|
|
5584
5587
|
key: 4,
|
|
5585
5588
|
class: "me-popover me-toolbar-panel me-toolbar-panel--end me-menu"
|
|
5586
|
-
}, Pd = /* @__PURE__ */
|
|
5589
|
+
}, Pd = /* @__PURE__ */ B({
|
|
5587
5590
|
__name: "FormatMenu",
|
|
5588
5591
|
props: { editor: {} },
|
|
5589
5592
|
setup(e) {
|
|
5590
|
-
let t = e, n = K(null), r = K(""), i = K(null), a =
|
|
5593
|
+
let t = e, n = K(null), r = K(""), i = K(null), a = N(() => t.editor.storage.meiConfig.messages), o = $i(() => t.editor), s = Ca(t.editor.view.dom, "popover.offset"), c = (e) => (e.storage.meiConfig?.formatActions ?? []).filter((t) => (e.isEditable || t.readOnly) && (t.isVisible?.(e) ?? !0)), l = ({ editor: e, state: t, from: n, to: r }) => n === r || !e.isEditable && !c(e).length || t.selection instanceof rn || t.selection instanceof Wn || er(t) || e.isActive("codeBlock") ? !1 : t.doc.textBetween(n, r).length > 0, u = N(() => (t.editor.state, t.editor.isEditable)), d = N(() => (t.editor.state.selection, c(t.editor))), f = (e) => typeof e.title == "function" ? e.title(t.editor) : e.title;
|
|
5591
5594
|
function p(e) {
|
|
5592
5595
|
n.value = null, e.run(t.editor);
|
|
5593
5596
|
}
|
|
5594
|
-
let m =
|
|
5597
|
+
let m = N(() => Nr(t.editor)), h = N(() => {
|
|
5595
5598
|
let e = tr(t.editor.state), n = e && nr(t.editor.state.doc, e)[0];
|
|
5596
5599
|
return n ? m.value.find((e) => e.matches?.(n.node)) : void 0;
|
|
5597
|
-
}), g =
|
|
5600
|
+
}), g = N(() => [
|
|
5598
5601
|
{
|
|
5599
5602
|
name: "bold",
|
|
5600
5603
|
icon: Le,
|
|
@@ -5627,7 +5630,7 @@ var id = /* @__PURE__ */ z({
|
|
|
5627
5630
|
}
|
|
5628
5631
|
]);
|
|
5629
5632
|
function _(e) {
|
|
5630
|
-
n.value = n.value === e ? null : e, e === "link" && n.value === "link" && (r.value = t.editor.getAttributes("link").href ?? "",
|
|
5633
|
+
n.value = n.value === e ? null : e, e === "link" && n.value === "link" && (r.value = t.editor.getAttributes("link").href ?? "", ne(() => i.value?.focus()));
|
|
5631
5634
|
}
|
|
5632
5635
|
function v(e) {
|
|
5633
5636
|
let r = tr(t.editor.state), i = m.value.find((t) => t.id === e);
|
|
@@ -5645,15 +5648,15 @@ var id = /* @__PURE__ */ z({
|
|
|
5645
5648
|
let i = t.editor.chain().focus();
|
|
5646
5649
|
(e === "text" ? i.setTextColor(r) : i.setBgColor(r)).run(), n.value = null;
|
|
5647
5650
|
}
|
|
5648
|
-
let x =
|
|
5651
|
+
let x = N(() => {
|
|
5649
5652
|
let { from: e, to: n } = t.editor.state.selection;
|
|
5650
5653
|
return pr(t.editor.state, {
|
|
5651
5654
|
from: e,
|
|
5652
5655
|
to: n,
|
|
5653
5656
|
depth: 0
|
|
5654
5657
|
});
|
|
5655
|
-
}), S =
|
|
5656
|
-
return (t, c) => (G(),
|
|
5658
|
+
}), S = N(() => t.editor.getAttributes("textColor").color);
|
|
5659
|
+
return (t, c) => (G(), P(X(Un), {
|
|
5657
5660
|
editor: e.editor,
|
|
5658
5661
|
"should-show": l,
|
|
5659
5662
|
options: {
|
|
@@ -5663,64 +5666,64 @@ var id = /* @__PURE__ */ z({
|
|
|
5663
5666
|
},
|
|
5664
5667
|
"plugin-key": "formatMenu"
|
|
5665
5668
|
}, {
|
|
5666
|
-
default: fe(() => [
|
|
5669
|
+
default: fe(() => [L("div", V(X(o), {
|
|
5667
5670
|
class: "me-popover me-toolbar",
|
|
5668
5671
|
onMousedown: c[7] ||= (e) => n.value !== "link" && e.preventDefault()
|
|
5669
|
-
}), [u.value ? (G(),
|
|
5670
|
-
h.value ? (G(),
|
|
5672
|
+
}), [u.value ? (G(), I(M, { key: 1 }, [
|
|
5673
|
+
h.value ? (G(), I(M, { key: 0 }, [L("button", {
|
|
5671
5674
|
type: "button",
|
|
5672
5675
|
class: "me-tool-btn",
|
|
5673
5676
|
onClick: c[0] ||= (e) => _("turn")
|
|
5674
|
-
}, [
|
|
5675
|
-
(G(!0),
|
|
5677
|
+
}, [R(Y(X(Pr)(a.value, h.value)) + " ", 1), z(X(Ve), { class: "me-chevron" })]), c[8] ||= L("span", { class: "me-toolbar-divider" }, null, -1)], 64)) : F("", !0),
|
|
5678
|
+
(G(!0), I(M, null, q(g.value, (t) => (G(), I("button", {
|
|
5676
5679
|
key: t.name,
|
|
5677
5680
|
type: "button",
|
|
5678
|
-
class:
|
|
5681
|
+
class: H(["me-tool-btn", { "is-active": e.editor.isActive(t.name) }]),
|
|
5679
5682
|
title: t.title,
|
|
5680
5683
|
onClick: t.run
|
|
5681
|
-
}, [(G(),
|
|
5682
|
-
c[10] ||=
|
|
5683
|
-
|
|
5684
|
+
}, [(G(), P(J(t.icon)))], 10, Sd))), 128)),
|
|
5685
|
+
c[10] ||= L("span", { class: "me-toolbar-divider" }, null, -1),
|
|
5686
|
+
L("button", {
|
|
5684
5687
|
type: "button",
|
|
5685
|
-
class:
|
|
5688
|
+
class: H(["me-tool-btn", { "is-active": e.editor.isActive("link") }]),
|
|
5686
5689
|
title: a.value.format.link,
|
|
5687
5690
|
onClick: c[1] ||= (e) => _("link")
|
|
5688
|
-
}, [
|
|
5689
|
-
|
|
5691
|
+
}, [z(X(ht))], 10, Cd),
|
|
5692
|
+
L("button", {
|
|
5690
5693
|
type: "button",
|
|
5691
5694
|
class: "me-tool-btn",
|
|
5692
5695
|
title: a.value.format.color,
|
|
5693
5696
|
onClick: c[2] ||= (e) => _("color")
|
|
5694
|
-
}, [
|
|
5697
|
+
}, [z(X(Ie), {
|
|
5695
5698
|
class: "me-swatch--text",
|
|
5696
5699
|
"data-color": S.value
|
|
5697
|
-
}, null, 8, ["data-color"]),
|
|
5698
|
-
d.value.length ? (G(),
|
|
5700
|
+
}, null, 8, ["data-color"]), z(X(Ve), { class: "me-chevron" })], 8, wd),
|
|
5701
|
+
d.value.length ? (G(), I(M, { key: 1 }, [c[9] ||= L("span", { class: "me-toolbar-divider" }, null, -1), (G(!0), I(M, null, q(d.value, (e) => (G(), I("button", {
|
|
5699
5702
|
key: e.id,
|
|
5700
5703
|
type: "button",
|
|
5701
5704
|
class: "me-tool-btn",
|
|
5702
5705
|
title: f(e),
|
|
5703
5706
|
onClick: (t) => p(e)
|
|
5704
|
-
}, [(G(),
|
|
5705
|
-
n.value === "turn" ? (G(),
|
|
5707
|
+
}, [(G(), P(J(e.icon))), R(" " + Y(f(e)), 1)], 8, Td))), 128))], 64)) : F("", !0),
|
|
5708
|
+
n.value === "turn" ? (G(), I("div", Ed, [(G(!0), I(M, null, q(m.value, (e) => (G(), I("button", {
|
|
5706
5709
|
key: e.id,
|
|
5707
5710
|
type: "button",
|
|
5708
5711
|
class: "me-menu-item",
|
|
5709
5712
|
onClick: (t) => v(e.id)
|
|
5710
5713
|
}, [
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
h.value?.id === e.id ? (G(),
|
|
5714
|
+
L("span", Od, [(G(), P(J(e.icon)))]),
|
|
5715
|
+
L("span", kd, Y(X(Pr)(a.value, e)), 1),
|
|
5716
|
+
h.value?.id === e.id ? (G(), P(X(Be), {
|
|
5714
5717
|
key: 0,
|
|
5715
5718
|
class: "me-menu-check"
|
|
5716
|
-
})) :
|
|
5717
|
-
], 8, Dd))), 128))])) :
|
|
5718
|
-
n.value === "link" ? (G(),
|
|
5719
|
+
})) : F("", !0)
|
|
5720
|
+
], 8, Dd))), 128))])) : F("", !0),
|
|
5721
|
+
n.value === "link" ? (G(), I("form", {
|
|
5719
5722
|
key: 3,
|
|
5720
5723
|
class: "me-popover me-toolbar-panel me-link-form",
|
|
5721
5724
|
onSubmit: c[6] ||= Q((e) => y(), ["prevent"])
|
|
5722
5725
|
}, [
|
|
5723
|
-
pe(
|
|
5726
|
+
pe(L("input", {
|
|
5724
5727
|
ref_key: "linkInput",
|
|
5725
5728
|
ref: i,
|
|
5726
5729
|
"onUpdate:modelValue": c[3] ||= (e) => r.value = e,
|
|
@@ -5728,16 +5731,16 @@ var id = /* @__PURE__ */ z({
|
|
|
5728
5731
|
placeholder: a.value.format.linkPlaceholder,
|
|
5729
5732
|
onKeydown: c[4] ||= me((e) => n.value = null, ["esc"])
|
|
5730
5733
|
}, null, 40, Ad), [[ue, r.value]]),
|
|
5731
|
-
|
|
5732
|
-
e.editor.isActive("link") ? (G(),
|
|
5734
|
+
L("button", jd, Y(a.value.format.apply), 1),
|
|
5735
|
+
e.editor.isActive("link") ? (G(), I("button", {
|
|
5733
5736
|
key: 0,
|
|
5734
5737
|
type: "button",
|
|
5735
5738
|
class: "me-btn",
|
|
5736
5739
|
title: a.value.format.removeLink,
|
|
5737
5740
|
onClick: c[5] ||= (e) => y("")
|
|
5738
|
-
}, [
|
|
5739
|
-
], 32)) :
|
|
5740
|
-
n.value === "color" ? (G(),
|
|
5741
|
+
}, [z(X(Ht))], 8, Md)) : F("", !0)
|
|
5742
|
+
], 32)) : F("", !0),
|
|
5743
|
+
n.value === "color" ? (G(), I("div", Nd, [z(id, {
|
|
5741
5744
|
messages: a.value,
|
|
5742
5745
|
recent: X(ma).colors,
|
|
5743
5746
|
current: x.value,
|
|
@@ -5746,21 +5749,21 @@ var id = /* @__PURE__ */ z({
|
|
|
5746
5749
|
"messages",
|
|
5747
5750
|
"recent",
|
|
5748
5751
|
"current"
|
|
5749
|
-
])])) :
|
|
5750
|
-
], 64)) : (G(!0),
|
|
5752
|
+
])])) : F("", !0)
|
|
5753
|
+
], 64)) : (G(!0), I(M, { key: 0 }, q(d.value, (e) => (G(), I("button", {
|
|
5751
5754
|
key: e.id,
|
|
5752
5755
|
type: "button",
|
|
5753
5756
|
class: "me-tool-btn",
|
|
5754
5757
|
title: f(e),
|
|
5755
5758
|
onClick: (t) => p(e)
|
|
5756
|
-
}, [(G(),
|
|
5759
|
+
}, [(G(), P(J(e.icon))), R(" " + Y(f(e)), 1)], 8, xd))), 128))], 16)]),
|
|
5757
5760
|
_: 1
|
|
5758
5761
|
}, 8, ["editor", "options"]));
|
|
5759
5762
|
}
|
|
5760
5763
|
}), Fd = ["aria-label"], Id = ["data-depth"], Ld = {
|
|
5761
5764
|
key: 0,
|
|
5762
5765
|
class: "me-popover me-outline-panel"
|
|
5763
|
-
}, Rd = ["data-depth", "onClick"], zd = /* @__PURE__ */
|
|
5766
|
+
}, Rd = ["data-depth", "onClick"], zd = /* @__PURE__ */ B({
|
|
5764
5767
|
__name: "MeiOutline",
|
|
5765
5768
|
props: {
|
|
5766
5769
|
editor: {},
|
|
@@ -5774,7 +5777,7 @@ var id = /* @__PURE__ */ z({
|
|
|
5774
5777
|
r.value = e.at(-1)?.isIntersecting ?? !0;
|
|
5775
5778
|
}), i.observe(e));
|
|
5776
5779
|
}, { immediate: !0 });
|
|
5777
|
-
let a = se([]), o = K(-1), s = K(!1), c =
|
|
5780
|
+
let a = se([]), o = K(-1), s = K(!1), c = N(() => t.editor.storage.meiConfig.messages.toc);
|
|
5778
5781
|
function l() {
|
|
5779
5782
|
let e = [];
|
|
5780
5783
|
t.editor.state.doc.forEach((t, n) => {
|
|
@@ -5813,36 +5816,36 @@ var id = /* @__PURE__ */ z({
|
|
|
5813
5816
|
block: "start"
|
|
5814
5817
|
}), n.dispatch(n.state.tr.setSelection(cn.near(n.state.doc.resolve(e.pos + 1)))), n.focus(), s.value = !1;
|
|
5815
5818
|
}
|
|
5816
|
-
let g =
|
|
5819
|
+
let g = N(() => Math.min(...a.value.map((e) => e.level), 4)), _ = N(() => r.value && a.value.length >= t.minHeadings), v;
|
|
5817
5820
|
function y() {
|
|
5818
5821
|
clearTimeout(v), s.value = !0;
|
|
5819
5822
|
}
|
|
5820
5823
|
function b() {
|
|
5821
5824
|
clearTimeout(v), v = setTimeout(() => s.value = !1, 150);
|
|
5822
5825
|
}
|
|
5823
|
-
return
|
|
5826
|
+
return re(() => {
|
|
5824
5827
|
l(), t.editor.on("update", d), window.addEventListener("scroll", m, {
|
|
5825
5828
|
passive: !0,
|
|
5826
5829
|
capture: !0
|
|
5827
5830
|
}), window.addEventListener("resize", m, { passive: !0 });
|
|
5828
|
-
}),
|
|
5831
|
+
}), W(() => {
|
|
5829
5832
|
i?.disconnect(), t.editor.off("update", d), window.removeEventListener("scroll", m, { capture: !0 }), window.removeEventListener("resize", m), cancelAnimationFrame(u), cancelAnimationFrame(p), clearTimeout(v);
|
|
5830
|
-
}), (e, t) => (G(),
|
|
5833
|
+
}), (e, t) => (G(), P(ee, { to: "body" }, [_.value ? (G(), I("nav", V({ key: 0 }, X(n), {
|
|
5831
5834
|
class: "me-outline",
|
|
5832
5835
|
"aria-label": c.value.title,
|
|
5833
5836
|
onMouseenter: y,
|
|
5834
5837
|
onMouseleave: b
|
|
5835
|
-
}), [
|
|
5838
|
+
}), [L("div", { class: H(["me-outline-bars", { "is-hidden": s.value }]) }, [(G(!0), I(M, null, q(a.value, (e, t) => (G(), I("span", {
|
|
5836
5839
|
key: e.pos,
|
|
5837
|
-
class:
|
|
5840
|
+
class: H(["me-outline-bar", { "is-active": t === o.value }]),
|
|
5838
5841
|
"data-depth": e.level - g.value
|
|
5839
|
-
}, null, 10, Id))), 128))], 2), s.value ? (G(),
|
|
5842
|
+
}, null, 10, Id))), 128))], 2), s.value ? (G(), I("div", Ld, [(G(!0), I(M, null, q(a.value, (e, t) => (G(), I("button", {
|
|
5840
5843
|
key: e.pos,
|
|
5841
5844
|
type: "button",
|
|
5842
|
-
class:
|
|
5845
|
+
class: H(["me-outline-item", { "is-active": t === o.value }]),
|
|
5843
5846
|
"data-depth": e.level - g.value,
|
|
5844
5847
|
onClick: (t) => h(e)
|
|
5845
|
-
}, Y(e.text || c.value.untitled), 11, Rd))), 128))])) :
|
|
5848
|
+
}, Y(e.text || c.value.untitled), 11, Rd))), 128))])) : F("", !0)], 16, Fd)) : F("", !0)]));
|
|
5846
5849
|
}
|
|
5847
5850
|
});
|
|
5848
5851
|
// src/table-ops.ts
|
|
@@ -5941,17 +5944,17 @@ function rf(e, t, n) {
|
|
|
5941
5944
|
Hd(e, t, 0, 0), e.chain().focus()[n === "row" ? "toggleHeaderRow" : "toggleHeaderColumn"]().run();
|
|
5942
5945
|
}
|
|
5943
5946
|
// src/components/TableControls.vue?vue&type=script&setup=true&lang.ts
|
|
5944
|
-
var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMouseenter"], uf = ["disabled", "onClick"], df = { class: "me-menu-icon" }, ff = { class: "me-menu-title me-menu-text" }, pf = {
|
|
5947
|
+
var af = ["title", "aria-label"], of = ["title", "aria-label"], sf = ["title"], cf = ["title"], lf = ["onMouseenter"], uf = ["disabled", "onClick"], df = { class: "me-menu-icon" }, ff = { class: "me-menu-title me-menu-text" }, pf = {
|
|
5945
5948
|
key: 0,
|
|
5946
5949
|
class: "me-popover me-submenu"
|
|
5947
5950
|
}, mf = ["onClick"], hf = ["data-color"], gf = { class: "me-menu-title me-menu-text" }, _f = ["title"], vf = ["title"], yf = { class: "me-submenu-anchor" }, bf = ["title"], xf = {
|
|
5948
5951
|
key: 0,
|
|
5949
5952
|
class: "me-popover me-toolbar-panel me-menu"
|
|
5950
|
-
}, Sf = ["onClick"], Cf = ["data-color"], wf = { class: "me-menu-title me-menu-text" }, Tf = ["title"], Ef = /* @__PURE__ */
|
|
5953
|
+
}, Sf = ["onClick"], Cf = ["data-color"], wf = { class: "me-menu-title me-menu-text" }, Tf = ["title"], Ef = 4, Df = /* @__PURE__ */ B({
|
|
5951
5954
|
__name: "TableControls",
|
|
5952
5955
|
props: { editor: {} },
|
|
5953
5956
|
setup(e) {
|
|
5954
|
-
let t = e, n = $i(() => t.editor), r =
|
|
5957
|
+
let t = e, n = $i(() => t.editor), r = N(() => t.editor.storage.meiConfig.messages.table), i = N(() => t.editor.storage.meiConfig.messages.colors), a = K(null), o = se(null), s, c = 0;
|
|
5955
5958
|
function l(e) {
|
|
5956
5959
|
let t = a.value.getBoundingClientRect();
|
|
5957
5960
|
return new DOMRect(e.left - t.left, e.top - t.top, e.width, e.height);
|
|
@@ -5976,39 +5979,107 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
5976
5979
|
};
|
|
5977
5980
|
}
|
|
5978
5981
|
function d(e) {
|
|
5979
|
-
if (h.value || !t.editor.isEditable) return;
|
|
5982
|
+
if (T.value || h.value || !t.editor.isEditable) return;
|
|
5980
5983
|
let n = e.target;
|
|
5981
5984
|
n?.closest(".me-table-controls-ui") ? clearTimeout(s) : (cancelAnimationFrame(c), c = requestAnimationFrame(() => {
|
|
5982
5985
|
let e = n?.closest("td, th");
|
|
5983
5986
|
e && t.editor.view.dom.contains(e) ? (clearTimeout(s), o.value = u(e)) : o.value && (clearTimeout(s), s = setTimeout(() => o.value = null, 250));
|
|
5984
5987
|
}));
|
|
5985
5988
|
}
|
|
5986
|
-
let f =
|
|
5989
|
+
let f = N(() => (p.value, o.value ? Bd(t.editor, o.value.tablePos) : null)), p = K(0), m = () => {
|
|
5987
5990
|
p.value++, o.value && !Bd(t.editor, o.value.tablePos) && (o.value = null);
|
|
5988
|
-
}, h = se(null), g =
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
+
}, h = se(null), g = null, _ = !1;
|
|
5992
|
+
function v(e, t, n) {
|
|
5993
|
+
if (t === "row") return [...e.rows].map((e) => {
|
|
5994
|
+
let t = e.getBoundingClientRect();
|
|
5995
|
+
return [t.top, t.bottom];
|
|
5996
|
+
});
|
|
5997
|
+
let r = [];
|
|
5998
|
+
for (let t of [...e.rows[0]?.cells ?? []]) {
|
|
5999
|
+
let e = t.getBoundingClientRect(), n = Math.max(1, t.colSpan);
|
|
6000
|
+
for (let t = 0; t < n; t++) r.push([e.left + e.width * t / n, e.left + e.width * (t + 1) / n]);
|
|
6001
|
+
}
|
|
6002
|
+
return r.slice(0, n);
|
|
6003
|
+
}
|
|
6004
|
+
function y(e, n) {
|
|
6005
|
+
let r = o.value;
|
|
6006
|
+
if (n.button !== 0 || !r) return;
|
|
6007
|
+
n.preventDefault();
|
|
6008
|
+
let i = t.editor.view.nodeDOM(r.tablePos), a = i instanceof HTMLElement ? i.matches("table") ? i : i.querySelector("table") : null;
|
|
6009
|
+
a instanceof HTMLTableElement && (g = {
|
|
6010
|
+
kind: e,
|
|
6011
|
+
x: n.clientX,
|
|
6012
|
+
y: n.clientY,
|
|
6013
|
+
from: e === "row" ? r.row : r.col,
|
|
6014
|
+
tablePos: r.tablePos,
|
|
6015
|
+
table: a
|
|
6016
|
+
}, _ = !1, document.addEventListener("pointermove", b), document.addEventListener("pointerup", x), document.addEventListener("keydown", S, !0));
|
|
6017
|
+
}
|
|
6018
|
+
function b(e) {
|
|
6019
|
+
let n = g;
|
|
6020
|
+
if (!n) return;
|
|
6021
|
+
if (!h.value) {
|
|
6022
|
+
if (Math.hypot(e.clientX - n.x, e.clientY - n.y) < Ef) return;
|
|
6023
|
+
let r = Bd(t.editor, n.tablePos);
|
|
6024
|
+
if (!r) return C();
|
|
6025
|
+
_ = !0, n.kind === "row" ? Ud(t.editor, r, n.from) : Wd(t.editor, r, n.from), document.documentElement.classList.add("me-table-dragging"), h.value = {
|
|
6026
|
+
kind: n.kind,
|
|
6027
|
+
from: n.from,
|
|
6028
|
+
tablePos: n.tablePos,
|
|
6029
|
+
to: n.from,
|
|
6030
|
+
line: null
|
|
6031
|
+
};
|
|
6032
|
+
}
|
|
6033
|
+
let r = Bd(t.editor, n.tablePos);
|
|
6034
|
+
if (!r) return C();
|
|
6035
|
+
let i = v(n.table, n.kind, n.kind === "row" ? r.map.height : r.map.width), a = n.kind === "row" ? e.clientY : e.clientX, o = i.findIndex(([e, t]) => a >= e && a < t);
|
|
6036
|
+
o < 0 && (o = a < (i[0]?.[0] ?? 0) ? 0 : i.length - 1);
|
|
6037
|
+
let s = i[o], c = n.table.getBoundingClientRect(), u = o < n.from ? s[0] : s[1], d = o === n.from ? null : n.kind === "row" ? l(new DOMRect(c.left, u, c.width, 0)) : l(new DOMRect(u, c.top, 0, c.height));
|
|
6038
|
+
(h.value.to !== o || !!h.value.line != !!d) && (h.value = {
|
|
6039
|
+
...h.value,
|
|
6040
|
+
to: o,
|
|
6041
|
+
line: d
|
|
6042
|
+
});
|
|
6043
|
+
}
|
|
6044
|
+
function x() {
|
|
6045
|
+
let e = h.value;
|
|
6046
|
+
if (C(), !e || e.to === e.from) return;
|
|
6047
|
+
let n = Bd(t.editor, e.tablePos);
|
|
6048
|
+
n && (e.kind === "row" ? Yd(t.editor, n, e.from, e.to) : Xd(t.editor, n, e.from, e.to), t.editor.commands.focus());
|
|
6049
|
+
}
|
|
6050
|
+
function S(e) {
|
|
6051
|
+
e.key === "Escape" && h.value && (e.preventDefault(), e.stopPropagation(), C());
|
|
6052
|
+
}
|
|
6053
|
+
function C() {
|
|
6054
|
+
g = null, h.value = null, document.documentElement.classList.remove("me-table-dragging"), document.removeEventListener("pointermove", b), document.removeEventListener("pointerup", x), document.removeEventListener("keydown", S, !0);
|
|
6055
|
+
}
|
|
6056
|
+
function w(e, t) {
|
|
6057
|
+
_ ? _ = !1 : O(e, t);
|
|
6058
|
+
}
|
|
6059
|
+
let T = se(null), E = K(!1), D = K(null);
|
|
6060
|
+
Wa(D, N(() => !!T.value), () => k());
|
|
6061
|
+
function O(e, n) {
|
|
5991
6062
|
let r = o.value, i = f.value;
|
|
5992
6063
|
if (!r || !i) return;
|
|
5993
6064
|
e === "row" ? Ud(t.editor, i, r.row) : Wd(t.editor, i, r.col);
|
|
5994
6065
|
let a = n.currentTarget.getBoundingClientRect(), s = l(a), c = a.bottom + 360 > window.innerHeight;
|
|
5995
|
-
|
|
6066
|
+
T.value = {
|
|
5996
6067
|
kind: e,
|
|
5997
6068
|
index: e === "row" ? r.row : r.col,
|
|
5998
6069
|
tablePos: r.tablePos,
|
|
5999
6070
|
x: s.left,
|
|
6000
6071
|
y: s.bottom + 4,
|
|
6001
6072
|
above: c
|
|
6002
|
-
},
|
|
6073
|
+
}, E.value = !1, ne(() => D.value?.focus({ preventScroll: !0 }));
|
|
6003
6074
|
}
|
|
6004
|
-
function
|
|
6005
|
-
|
|
6075
|
+
function k() {
|
|
6076
|
+
T.value = null, E.value = !1;
|
|
6006
6077
|
}
|
|
6007
|
-
function
|
|
6008
|
-
e(),
|
|
6078
|
+
function A(e) {
|
|
6079
|
+
e(), k(), t.editor.commands.focus();
|
|
6009
6080
|
}
|
|
6010
|
-
let
|
|
6011
|
-
let e =
|
|
6081
|
+
let j = N(() => {
|
|
6082
|
+
let e = T.value;
|
|
6012
6083
|
p.value;
|
|
6013
6084
|
let n = e && Bd(t.editor, e.tablePos);
|
|
6014
6085
|
if (!e || !n) return [];
|
|
@@ -6133,22 +6204,22 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6133
6204
|
}
|
|
6134
6205
|
];
|
|
6135
6206
|
});
|
|
6136
|
-
function
|
|
6137
|
-
e.key === "Escape" &&
|
|
6207
|
+
function ee(e) {
|
|
6208
|
+
e.key === "Escape" && k();
|
|
6138
6209
|
}
|
|
6139
|
-
function
|
|
6210
|
+
function B() {
|
|
6140
6211
|
let e = f.value;
|
|
6141
6212
|
e && Gd(t.editor, e, e.map.height - 1, "after");
|
|
6142
6213
|
}
|
|
6143
|
-
function
|
|
6214
|
+
function te() {
|
|
6144
6215
|
let e = f.value;
|
|
6145
6216
|
e && Kd(t.editor, e, e.map.width - 1, "after");
|
|
6146
6217
|
}
|
|
6147
|
-
let
|
|
6148
|
-
function
|
|
6218
|
+
let ie = se(null), ae = K(!1);
|
|
6219
|
+
function oe() {
|
|
6149
6220
|
let e = t.editor.state.selection;
|
|
6150
|
-
if (!(e instanceof Wn) ||
|
|
6151
|
-
|
|
6221
|
+
if (!(e instanceof Wn) || T.value || !a.value) {
|
|
6222
|
+
ie.value = null, ae.value = !1;
|
|
6152
6223
|
return;
|
|
6153
6224
|
}
|
|
6154
6225
|
let n = Infinity, r = Infinity;
|
|
@@ -6158,173 +6229,241 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6158
6229
|
let e = l(a.getBoundingClientRect());
|
|
6159
6230
|
n = Math.min(n, e.top), r = Math.min(r, e.left);
|
|
6160
6231
|
}
|
|
6161
|
-
}), Number.isFinite(n) && (
|
|
6232
|
+
}), Number.isFinite(n) && (ie.value = {
|
|
6162
6233
|
x: r,
|
|
6163
6234
|
y: n,
|
|
6164
6235
|
canMerge: t.editor.can().mergeCells(),
|
|
6165
6236
|
canSplit: t.editor.can().splitCell()
|
|
6166
6237
|
});
|
|
6167
6238
|
}
|
|
6168
|
-
let
|
|
6169
|
-
return
|
|
6170
|
-
document.addEventListener("mousemove", d), t.editor.on("update", m), t.editor.on("selectionUpdate",
|
|
6171
|
-
}),
|
|
6172
|
-
document.removeEventListener("mousemove", d), t.editor.off("update", m), t.editor.off("selectionUpdate",
|
|
6173
|
-
}), (t, s) => (G(),
|
|
6239
|
+
let ce = Qu;
|
|
6240
|
+
return re(() => {
|
|
6241
|
+
document.addEventListener("mousemove", d), t.editor.on("update", m), t.editor.on("selectionUpdate", oe);
|
|
6242
|
+
}), W(() => {
|
|
6243
|
+
document.removeEventListener("mousemove", d), t.editor.off("update", m), t.editor.off("selectionUpdate", oe), clearTimeout(s), cancelAnimationFrame(c), C();
|
|
6244
|
+
}), (t, s) => (G(), I("div", {
|
|
6174
6245
|
ref_key: "layer",
|
|
6175
6246
|
ref: a,
|
|
6176
6247
|
class: "me-table-controls"
|
|
6177
6248
|
}, [
|
|
6178
|
-
o.value && f.value && !
|
|
6179
|
-
I("button", {
|
|
6249
|
+
o.value && f.value && !T.value ? (G(), I(M, { key: 0 }, [
|
|
6250
|
+
!h.value || h.value.kind === "row" ? (G(), I("button", {
|
|
6251
|
+
key: 0,
|
|
6180
6252
|
type: "button",
|
|
6181
|
-
class: "me-table-controls-ui me-table-grip me-table-grip--row",
|
|
6182
|
-
style:
|
|
6253
|
+
class: H(["me-table-controls-ui me-table-grip me-table-grip--row", { "is-active": h.value?.kind === "row" }]),
|
|
6254
|
+
style: U({
|
|
6183
6255
|
left: `${o.value.table.left}px`,
|
|
6184
|
-
top: `${o.value.rowRect.top}px
|
|
6185
|
-
height: `${o.value.rowRect.height}px`
|
|
6256
|
+
top: `${o.value.rowRect.top + o.value.rowRect.height / 2}px`
|
|
6186
6257
|
}),
|
|
6187
6258
|
title: r.value.rowMenu,
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6259
|
+
"aria-label": r.value.rowMenu,
|
|
6260
|
+
"data-table-grip": "row",
|
|
6261
|
+
onPointerdown: s[0] ||= (e) => y("row", e),
|
|
6262
|
+
onClick: s[1] ||= (e) => w("row", e)
|
|
6263
|
+
}, [z(X(st))], 46, af)) : F("", !0),
|
|
6264
|
+
!h.value || h.value.kind === "col" ? (G(), I("button", {
|
|
6265
|
+
key: 1,
|
|
6192
6266
|
type: "button",
|
|
6193
|
-
class: "me-table-controls-ui me-table-grip me-table-grip--col",
|
|
6194
|
-
style:
|
|
6195
|
-
left: `${o.value.colRect.left}px`,
|
|
6196
|
-
top: `${o.value.table.top}px
|
|
6197
|
-
width: `${o.value.colRect.width}px`
|
|
6267
|
+
class: H(["me-table-controls-ui me-table-grip me-table-grip--col", { "is-active": h.value?.kind === "col" }]),
|
|
6268
|
+
style: U({
|
|
6269
|
+
left: `${o.value.colRect.left + o.value.colRect.width / 2}px`,
|
|
6270
|
+
top: `${o.value.table.top}px`
|
|
6198
6271
|
}),
|
|
6199
6272
|
title: r.value.columnMenu,
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6273
|
+
"aria-label": r.value.columnMenu,
|
|
6274
|
+
"data-table-grip": "col",
|
|
6275
|
+
onPointerdown: s[2] ||= (e) => y("col", e),
|
|
6276
|
+
onClick: s[3] ||= (e) => w("col", e)
|
|
6277
|
+
}, [z(X(ot))], 46, of)) : F("", !0),
|
|
6278
|
+
h.value?.line ? (G(), I("div", {
|
|
6279
|
+
key: 2,
|
|
6280
|
+
class: H(["me-table-drop-line", h.value.kind === "row" ? "is-row" : "is-col"]),
|
|
6281
|
+
style: U(h.value.kind === "row" ? {
|
|
6282
|
+
left: `${h.value.line.left}px`,
|
|
6283
|
+
top: `${h.value.line.top}px`,
|
|
6284
|
+
width: `${h.value.line.width}px`
|
|
6285
|
+
} : {
|
|
6286
|
+
left: `${h.value.line.left}px`,
|
|
6287
|
+
top: `${h.value.line.top}px`,
|
|
6288
|
+
height: `${h.value.line.height}px`
|
|
6289
|
+
}),
|
|
6290
|
+
"data-table-drop-line": ""
|
|
6291
|
+
}, null, 6)) : F("", !0),
|
|
6292
|
+
h.value ? F("", !0) : (G(), I("button", {
|
|
6293
|
+
key: 3,
|
|
6204
6294
|
type: "button",
|
|
6205
6295
|
class: "me-table-controls-ui me-table-add me-table-add--row",
|
|
6206
|
-
style:
|
|
6296
|
+
style: U({
|
|
6207
6297
|
left: `${o.value.visible.left}px`,
|
|
6208
6298
|
top: `${o.value.table.top + o.value.table.height}px`,
|
|
6209
6299
|
width: `${o.value.visible.width}px`
|
|
6210
6300
|
}),
|
|
6211
6301
|
title: r.value.addRow,
|
|
6212
6302
|
onMousedown: s[4] ||= Q(() => {}, ["prevent"]),
|
|
6213
|
-
onClick:
|
|
6214
|
-
}, [
|
|
6215
|
-
I("button", {
|
|
6303
|
+
onClick: B
|
|
6304
|
+
}, [z(X(Et))], 44, sf)),
|
|
6305
|
+
h.value ? F("", !0) : (G(), I("button", {
|
|
6306
|
+
key: 4,
|
|
6216
6307
|
type: "button",
|
|
6217
6308
|
class: "me-table-controls-ui me-table-add me-table-add--col",
|
|
6218
|
-
style:
|
|
6309
|
+
style: U({
|
|
6219
6310
|
left: `${o.value.visible.left + o.value.visible.width}px`,
|
|
6220
6311
|
top: `${o.value.table.top}px`,
|
|
6221
6312
|
height: `${o.value.table.height}px`
|
|
6222
6313
|
}),
|
|
6223
6314
|
title: r.value.addColumn,
|
|
6224
6315
|
onMousedown: s[5] ||= Q(() => {}, ["prevent"]),
|
|
6225
|
-
onClick:
|
|
6226
|
-
}, [
|
|
6227
|
-
], 64)) :
|
|
6228
|
-
|
|
6316
|
+
onClick: te
|
|
6317
|
+
}, [z(X(Et))], 44, cf))
|
|
6318
|
+
], 64)) : F("", !0),
|
|
6319
|
+
T.value ? (G(), I("div", V({
|
|
6229
6320
|
key: 1,
|
|
6230
6321
|
ref_key: "menuEl",
|
|
6231
|
-
ref:
|
|
6322
|
+
ref: D
|
|
6232
6323
|
}, X(n), {
|
|
6233
|
-
class: ["me-table-controls-ui me-popover me-block-menu me-table-menu", { "is-above":
|
|
6324
|
+
class: ["me-table-controls-ui me-popover me-block-menu me-table-menu", { "is-above": T.value.above }],
|
|
6234
6325
|
style: {
|
|
6235
|
-
left: `${
|
|
6236
|
-
top: `${
|
|
6326
|
+
left: `${T.value.x}px`,
|
|
6327
|
+
top: `${T.value.y}px`
|
|
6237
6328
|
},
|
|
6238
6329
|
tabindex: "-1",
|
|
6239
|
-
onKeydown:
|
|
6330
|
+
onKeydown: ee,
|
|
6240
6331
|
onMousedown: s[6] ||= Q(() => {}, ["prevent"])
|
|
6241
|
-
}), [(G(!0),
|
|
6332
|
+
}), [(G(!0), I(M, null, q(j.value, (t) => (G(), I("div", {
|
|
6242
6333
|
key: t.key,
|
|
6243
6334
|
class: "me-submenu-anchor",
|
|
6244
|
-
onMouseenter: (e) =>
|
|
6245
|
-
}, [
|
|
6335
|
+
onMouseenter: (e) => E.value = !!t.submenu
|
|
6336
|
+
}, [L("button", {
|
|
6246
6337
|
type: "button",
|
|
6247
|
-
class:
|
|
6338
|
+
class: H(["me-menu-item", {
|
|
6248
6339
|
"is-danger": t.danger,
|
|
6249
|
-
"is-active": t.submenu &&
|
|
6340
|
+
"is-active": t.submenu && E.value
|
|
6250
6341
|
}]),
|
|
6251
6342
|
disabled: t.disabled,
|
|
6252
|
-
onClick: (e) => t.submenu ?
|
|
6343
|
+
onClick: (e) => t.submenu ? E.value = !E.value : A(t.run)
|
|
6253
6344
|
}, [
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
t.checked ? (G(),
|
|
6345
|
+
L("span", df, [(G(), P(J(t.icon)))]),
|
|
6346
|
+
L("span", ff, Y(t.label), 1),
|
|
6347
|
+
t.checked ? (G(), P(X(Be), {
|
|
6257
6348
|
key: 0,
|
|
6258
6349
|
class: "me-menu-check"
|
|
6259
|
-
})) :
|
|
6260
|
-
t.submenu ? (G(),
|
|
6350
|
+
})) : F("", !0),
|
|
6351
|
+
t.submenu ? (G(), P(X(Ue), {
|
|
6261
6352
|
key: 1,
|
|
6262
6353
|
class: "me-menu-chevron"
|
|
6263
|
-
})) :
|
|
6264
|
-
], 10, uf), t.submenu &&
|
|
6354
|
+
})) : F("", !0)
|
|
6355
|
+
], 10, uf), t.submenu && E.value ? (G(), I("div", pf, [(G(!0), I(M, null, q(X(ce), (t) => (G(), I("button", {
|
|
6265
6356
|
key: t,
|
|
6266
6357
|
type: "button",
|
|
6267
6358
|
class: "me-menu-item",
|
|
6268
|
-
onClick: (n) =>
|
|
6269
|
-
}, [
|
|
6359
|
+
onClick: (n) => A(() => X(ef)(e.editor, t))
|
|
6360
|
+
}, [L("span", {
|
|
6270
6361
|
class: "me-menu-icon me-swatch--bg",
|
|
6271
6362
|
"data-color": t === "default" ? void 0 : t
|
|
6272
|
-
}, "A", 8, hf),
|
|
6273
|
-
|
|
6363
|
+
}, "A", 8, hf), L("span", gf, Y(i.value[t]), 1)], 8, mf))), 128))])) : F("", !0)], 40, lf))), 128))], 16)) : F("", !0),
|
|
6364
|
+
ie.value && !T.value && !h.value ? (G(), I("div", V({ key: 2 }, X(n), {
|
|
6274
6365
|
class: "me-table-controls-ui me-popover me-toolbar me-table-toolbar",
|
|
6275
6366
|
style: {
|
|
6276
|
-
left: `${
|
|
6277
|
-
top: `${
|
|
6367
|
+
left: `${ie.value.x}px`,
|
|
6368
|
+
top: `${ie.value.y}px`
|
|
6278
6369
|
},
|
|
6279
6370
|
onMousedown: s[11] ||= Q(() => {}, ["prevent"])
|
|
6280
6371
|
}), [
|
|
6281
|
-
|
|
6372
|
+
ie.value.canMerge ? (G(), I("button", {
|
|
6282
6373
|
key: 0,
|
|
6283
6374
|
type: "button",
|
|
6284
6375
|
class: "me-tool-btn",
|
|
6285
6376
|
title: r.value.merge,
|
|
6286
6377
|
onClick: s[7] ||= (t) => e.editor.chain().focus().mergeCells().run()
|
|
6287
|
-
}, [
|
|
6288
|
-
|
|
6378
|
+
}, [z(X(It)), R(" " + Y(r.value.merge), 1)], 8, _f)) : F("", !0),
|
|
6379
|
+
ie.value.canSplit ? (G(), I("button", {
|
|
6289
6380
|
key: 1,
|
|
6290
6381
|
type: "button",
|
|
6291
6382
|
class: "me-tool-btn",
|
|
6292
6383
|
title: r.value.split,
|
|
6293
6384
|
onClick: s[8] ||= (t) => e.editor.chain().focus().splitCell().run()
|
|
6294
|
-
}, [
|
|
6295
|
-
|
|
6385
|
+
}, [z(X(Lt)), R(" " + Y(r.value.split), 1)], 8, vf)) : F("", !0),
|
|
6386
|
+
L("span", yf, [L("button", {
|
|
6296
6387
|
type: "button",
|
|
6297
6388
|
class: "me-tool-btn",
|
|
6298
6389
|
title: r.value.color,
|
|
6299
|
-
onClick: s[9] ||= (e) =>
|
|
6300
|
-
}, [
|
|
6390
|
+
onClick: s[9] ||= (e) => ae.value = !ae.value
|
|
6391
|
+
}, [z(X(Ct))], 8, bf), ae.value ? (G(), I("div", xf, [(G(!0), I(M, null, q(X(ce), (t) => (G(), I("button", {
|
|
6301
6392
|
key: t,
|
|
6302
6393
|
type: "button",
|
|
6303
6394
|
class: "me-menu-item",
|
|
6304
6395
|
onClick: (n) => {
|
|
6305
|
-
X(ef)(e.editor, t),
|
|
6396
|
+
X(ef)(e.editor, t), ae.value = !1;
|
|
6306
6397
|
}
|
|
6307
|
-
}, [
|
|
6398
|
+
}, [L("span", {
|
|
6308
6399
|
class: "me-menu-icon me-swatch--bg",
|
|
6309
6400
|
"data-color": t === "default" ? void 0 : t
|
|
6310
|
-
}, "A", 8, Cf),
|
|
6311
|
-
|
|
6401
|
+
}, "A", 8, Cf), L("span", wf, Y(i.value[t]), 1)], 8, Sf))), 128))])) : F("", !0)]),
|
|
6402
|
+
L("button", {
|
|
6312
6403
|
type: "button",
|
|
6313
6404
|
class: "me-tool-btn",
|
|
6314
6405
|
title: r.value.clear,
|
|
6315
6406
|
onClick: s[10] ||= (t) => X($d)(e.editor)
|
|
6316
|
-
}, [
|
|
6317
|
-
], 16)) :
|
|
6407
|
+
}, [z(X(et))], 8, Tf)
|
|
6408
|
+
], 16)) : F("", !0)
|
|
6318
6409
|
], 512));
|
|
6319
6410
|
}
|
|
6320
|
-
}),
|
|
6411
|
+
}), Of = Xt.create({
|
|
6412
|
+
name: "handleGutter",
|
|
6413
|
+
priority: 1e3,
|
|
6414
|
+
addOptions() {
|
|
6415
|
+
return {
|
|
6416
|
+
block: () => null,
|
|
6417
|
+
handle: () => null,
|
|
6418
|
+
locked: () => !1
|
|
6419
|
+
};
|
|
6420
|
+
},
|
|
6421
|
+
addProseMirrorPlugins() {
|
|
6422
|
+
let { options: e, editor: t } = this;
|
|
6423
|
+
function n() {
|
|
6424
|
+
let t = e.block(), n = e.handle();
|
|
6425
|
+
if (!t?.isConnected || !n || n.style.visibility === "hidden") return null;
|
|
6426
|
+
let r = t.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
6427
|
+
return {
|
|
6428
|
+
left: i.left,
|
|
6429
|
+
right: r.right,
|
|
6430
|
+
top: Math.min(r.top, i.top),
|
|
6431
|
+
bottom: Math.max(r.bottom, i.bottom)
|
|
6432
|
+
};
|
|
6433
|
+
}
|
|
6434
|
+
function r(e) {
|
|
6435
|
+
let t = n();
|
|
6436
|
+
return !!t && e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
|
|
6437
|
+
}
|
|
6438
|
+
let i = !1;
|
|
6439
|
+
function a() {
|
|
6440
|
+
i && (i = !1, document.removeEventListener("mousemove", s, !0), document.removeEventListener("mouseout", c, !0));
|
|
6441
|
+
}
|
|
6442
|
+
function o() {
|
|
6443
|
+
a(), t.isDestroyed || t.view.dispatch(t.state.tr.setMeta("hideDragHandle", !0));
|
|
6444
|
+
}
|
|
6445
|
+
function s(i) {
|
|
6446
|
+
if (e.locked() || t.isDestroyed || t.view.dom.contains(i.target) || !n()) return a();
|
|
6447
|
+
r(i) || o();
|
|
6448
|
+
}
|
|
6449
|
+
function c(e) {
|
|
6450
|
+
e.relatedTarget || o();
|
|
6451
|
+
}
|
|
6452
|
+
return [new an({
|
|
6453
|
+
props: { handleDOMEvents: { mouseleave(t, n) {
|
|
6454
|
+
return e.locked() || !r(n) ? !1 : (i || (i = !0, document.addEventListener("mousemove", s, !0), document.addEventListener("mouseout", c, !0)), !0);
|
|
6455
|
+
} } },
|
|
6456
|
+
view: () => ({ destroy: a })
|
|
6457
|
+
})];
|
|
6458
|
+
}
|
|
6459
|
+
}), kf = { class: "me-handle" }, Af = { class: "me-content-error-slot" }, jf = {
|
|
6321
6460
|
key: 0,
|
|
6322
6461
|
class: "me-content-error",
|
|
6323
6462
|
role: "alert"
|
|
6324
|
-
},
|
|
6463
|
+
}, Mf = { class: "me-tooltip-verb" }, Nf = {
|
|
6325
6464
|
key: 0,
|
|
6326
6465
|
class: "me-tooltip-hint"
|
|
6327
|
-
},
|
|
6466
|
+
}, Pf = /* @__PURE__ */ B({
|
|
6328
6467
|
__name: "MeiEditor",
|
|
6329
6468
|
props: {
|
|
6330
6469
|
modelValue: { default: null },
|
|
@@ -6358,16 +6497,16 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6358
6497
|
"content-error"
|
|
6359
6498
|
],
|
|
6360
6499
|
setup(e, { expose: t, emit: n }) {
|
|
6361
|
-
let r = e, i = n, a = K(!1), o =
|
|
6362
|
-
|
|
6363
|
-
let f = `me-${le()}`, p =
|
|
6500
|
+
let r = e, i = n, a = K(!1), o = te(Va, void 0), s = [Ho, ...r.blocks ?? o ?? Gu].filter((e, t, n) => n.findIndex((t) => t.name === e.name) === t), c = K(null), l = N(() => typeof r.outline == "object" ? r.outline.minHeadings ?? 2 : 2), u = N(() => !!y.value?.schema.nodes.table), d = N(() => b(r.locale, ...s.map((e) => e.messages?.[r.locale]), r.messages));
|
|
6501
|
+
T();
|
|
6502
|
+
let f = `me-${le()}`, p = te(Ba, void 0), m = N(() => ({
|
|
6364
6503
|
class: ["me-scope", r.theme === "light" ? "me-light" : r.theme === "dark" ? "me-dark" : ""].filter(Boolean),
|
|
6365
6504
|
"data-me-id": f
|
|
6366
6505
|
}));
|
|
6367
6506
|
de(() => {
|
|
6368
6507
|
let e = [x(p?.value, `.me-scope[data-me-id="${f}"]`), x(r.tokens, `.me-scope[data-me-id="${f}"]`)].filter(Boolean).join("\n");
|
|
6369
|
-
|
|
6370
|
-
}),
|
|
6508
|
+
O(`mei-editor-${f}`, e);
|
|
6509
|
+
}), W(() => O(`mei-editor-${f}`, ""));
|
|
6371
6510
|
function h(e, t) {
|
|
6372
6511
|
let n = t.extensionManager.extensions.find((e) => e.name === "blockId")?.options.types ?? [], r = [];
|
|
6373
6512
|
try {
|
|
@@ -6390,7 +6529,7 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6390
6529
|
n !== void 0 && e.commands.setContent(n ?? "", { emitUpdate: !1 }), e.setEditable(r.editable && !a.value);
|
|
6391
6530
|
}
|
|
6392
6531
|
let _ = null, v = r.collaboration ? ce(r.collaboration) : void 0, y = se(), S = !1;
|
|
6393
|
-
function
|
|
6532
|
+
function C(e) {
|
|
6394
6533
|
let t = {
|
|
6395
6534
|
extensions: [
|
|
6396
6535
|
...Aa({
|
|
@@ -6402,6 +6541,14 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6402
6541
|
scope: m.value,
|
|
6403
6542
|
undoRedo: !v
|
|
6404
6543
|
}),
|
|
6544
|
+
Of.configure({
|
|
6545
|
+
block: () => {
|
|
6546
|
+
let e = k === null ? null : y.value?.view.nodeDOM(k);
|
|
6547
|
+
return e instanceof HTMLElement ? e : null;
|
|
6548
|
+
},
|
|
6549
|
+
handle: () => c.value?.querySelector(".me-drag-handle") ?? null,
|
|
6550
|
+
locked: () => ne
|
|
6551
|
+
}),
|
|
6405
6552
|
...e,
|
|
6406
6553
|
...r.extensions ?? []
|
|
6407
6554
|
],
|
|
@@ -6421,10 +6568,10 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6421
6568
|
};
|
|
6422
6569
|
y.value = new he(t);
|
|
6423
6570
|
}
|
|
6424
|
-
|
|
6571
|
+
re(() => {
|
|
6425
6572
|
v ? import("./collaboration.js").then(({ collaborationExtensions: e }) => {
|
|
6426
|
-
S ||
|
|
6427
|
-
}).catch((e) => console.error("[MeiEditor] Collaboration could not be loaded:", e)) :
|
|
6573
|
+
S || C(e(v));
|
|
6574
|
+
}).catch((e) => console.error("[MeiEditor] Collaboration could not be loaded:", e)) : C([]);
|
|
6428
6575
|
}), Z(() => r.modelValue, (e) => {
|
|
6429
6576
|
let t = y.value, n = e ? ce(e) : null;
|
|
6430
6577
|
t && !v && n !== _ && (n && JSON.stringify(n) === JSON.stringify(Xu(t.getJSON())) || g(t, n));
|
|
@@ -6438,78 +6585,80 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6438
6585
|
let e = y.value?.storage.meiConfig;
|
|
6439
6586
|
e && (e.messages = d.value, e.locale = r.locale, e.uploadImage = r.uploadImage ?? null, e.maxImageSize = r.maxImageSize, e.scope = m.value);
|
|
6440
6587
|
}), t({ editor: y });
|
|
6441
|
-
let
|
|
6588
|
+
let w = {
|
|
6442
6589
|
defaultRules: !1,
|
|
6443
6590
|
edgeDetection: "none",
|
|
6444
6591
|
rules: [{
|
|
6445
6592
|
id: "blockLevelOnly",
|
|
6446
6593
|
evaluate: ({ node: e, parent: t }) => !t || e.type.name === "column" ? 1e3 : ["doc", "column"].includes(t.type.name) ? 0 : 1e3
|
|
6447
6594
|
}]
|
|
6448
|
-
},
|
|
6449
|
-
function
|
|
6450
|
-
|
|
6595
|
+
}, E = se(null), D = se(null), k = null;
|
|
6596
|
+
function A({ node: e, pos: t }) {
|
|
6597
|
+
k = e ? t : null, !D.value && (E.value = e ? {
|
|
6451
6598
|
node: e,
|
|
6452
6599
|
pos: t
|
|
6453
6600
|
} : null);
|
|
6454
6601
|
}
|
|
6455
|
-
let
|
|
6602
|
+
let j = {
|
|
6456
6603
|
placement: "left-start",
|
|
6457
6604
|
strategy: "absolute",
|
|
6458
6605
|
middleware: [{
|
|
6459
6606
|
name: "meAlignToLine",
|
|
6460
6607
|
fn({ y: e, rects: t }) {
|
|
6461
|
-
let n = y.value, r = n &&
|
|
6608
|
+
let n = y.value, r = n && k !== null ? n.view.nodeDOM(k) : null;
|
|
6462
6609
|
if (!(r instanceof HTMLElement)) return {};
|
|
6463
6610
|
let i = ja(r), a = i.top + i.height / 2 - r.getBoundingClientRect().top;
|
|
6464
6611
|
return { y: Number.isFinite(a) ? t.reference.y + a - t.floating.height / 2 : e };
|
|
6465
6612
|
}
|
|
6466
6613
|
}]
|
|
6467
6614
|
};
|
|
6468
|
-
function
|
|
6615
|
+
function B() {
|
|
6469
6616
|
let e = y.value?.storage.blockDrop;
|
|
6470
6617
|
e && (e.active = !0);
|
|
6471
6618
|
}
|
|
6472
|
-
|
|
6619
|
+
let ne = !1;
|
|
6620
|
+
function H(e) {
|
|
6621
|
+
ne = e;
|
|
6473
6622
|
let t = y.value;
|
|
6474
6623
|
t && !t.isDestroyed && t.view.dispatch(t.state.tr.setMeta("lockDragHandle", e));
|
|
6475
6624
|
}
|
|
6476
|
-
function
|
|
6625
|
+
function U(e, t) {
|
|
6477
6626
|
let n = y.value;
|
|
6478
|
-
n && (
|
|
6627
|
+
n && (be(), ir(n, e), D.value = {
|
|
6479
6628
|
range: e,
|
|
6480
6629
|
anchor: t
|
|
6481
|
-
},
|
|
6630
|
+
}, H(!0));
|
|
6482
6631
|
}
|
|
6483
|
-
function
|
|
6632
|
+
function ie(e) {
|
|
6484
6633
|
let t = y.value;
|
|
6485
|
-
if (!t || !
|
|
6634
|
+
if (!t || !E.value) return;
|
|
6486
6635
|
let n = Qn({
|
|
6487
|
-
...
|
|
6488
|
-
depth: t.state.doc.resolve(
|
|
6636
|
+
...E.value,
|
|
6637
|
+
depth: t.state.doc.resolve(E.value.pos).depth
|
|
6489
6638
|
}), r = er(t.state) ? tr(t.state) : null;
|
|
6490
|
-
|
|
6639
|
+
U(r && n.from >= r.from && n.to <= r.to ? r : n, e.currentTarget.getBoundingClientRect());
|
|
6491
6640
|
}
|
|
6492
|
-
function
|
|
6641
|
+
function ae(e) {
|
|
6493
6642
|
let t = y.value?.view.nodeDOM(e.from);
|
|
6494
6643
|
if (!(t instanceof HTMLElement)) return;
|
|
6495
6644
|
let n = t.getBoundingClientRect();
|
|
6496
|
-
|
|
6645
|
+
U(e, new DOMRect(n.left, n.top, 0, Math.min(n.height, 24)));
|
|
6497
6646
|
}
|
|
6498
|
-
function
|
|
6499
|
-
|
|
6647
|
+
function J() {
|
|
6648
|
+
D.value = null, H(!1), y.value?.view.focus();
|
|
6500
6649
|
}
|
|
6501
|
-
let
|
|
6502
|
-
function
|
|
6503
|
-
|
|
6650
|
+
let oe = K(""), ue;
|
|
6651
|
+
function pe(e) {
|
|
6652
|
+
oe.value = e, clearTimeout(ue), ue = setTimeout(() => oe.value = "", 1800);
|
|
6504
6653
|
}
|
|
6505
|
-
async function
|
|
6654
|
+
async function me(e) {
|
|
6506
6655
|
let t = r.blockLink?.(e) ?? `${location.href.split("#")[0]}#${e}`;
|
|
6507
6656
|
try {
|
|
6508
6657
|
await navigator.clipboard.writeText(t);
|
|
6509
6658
|
} catch {}
|
|
6510
|
-
|
|
6659
|
+
pe(d.value.blockMenu.linkCopied);
|
|
6511
6660
|
}
|
|
6512
|
-
function
|
|
6661
|
+
function Q() {
|
|
6513
6662
|
let e = y.value, t = decodeURIComponent(location.hash.slice(1));
|
|
6514
6663
|
if (!e || !t) return;
|
|
6515
6664
|
let n = null;
|
|
@@ -6522,22 +6671,22 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6522
6671
|
});
|
|
6523
6672
|
}), n && (ir(e, n), e.view.nodeDOM(n.from)?.scrollIntoView({ block: "center" }));
|
|
6524
6673
|
}
|
|
6525
|
-
let
|
|
6526
|
-
function
|
|
6674
|
+
let _e = se(null), ve;
|
|
6675
|
+
function ye(e, t) {
|
|
6527
6676
|
let n = e.currentTarget.getBoundingClientRect(), r = d.value.handle, i = t === "add" ? [[r.clickVerb, r.add], [r.altClickVerb, r.addAbove]] : [[r.dragVerb, r.drag], [r.clickVerb, r.menu]];
|
|
6528
|
-
clearTimeout(
|
|
6677
|
+
clearTimeout(ve), ve = setTimeout(() => _e.value = {
|
|
6529
6678
|
lines: i,
|
|
6530
6679
|
hint: t === "grip" ? Ra("Mod-/") : void 0,
|
|
6531
6680
|
rect: n
|
|
6532
6681
|
}, 500);
|
|
6533
6682
|
}
|
|
6534
|
-
function
|
|
6535
|
-
clearTimeout(
|
|
6683
|
+
function be() {
|
|
6684
|
+
clearTimeout(ve), _e.value = null;
|
|
6536
6685
|
}
|
|
6537
|
-
function
|
|
6686
|
+
function xe(e) {
|
|
6538
6687
|
let t = y.value;
|
|
6539
|
-
if (!t || !
|
|
6540
|
-
let { node: n, pos: r } =
|
|
6688
|
+
if (!t || !E.value) return;
|
|
6689
|
+
let { node: n, pos: r } = E.value;
|
|
6541
6690
|
if (n.type.name === "paragraph" && n.content.size === 0) {
|
|
6542
6691
|
t.chain().focus().setTextSelection(r + 1).insertContent("/").run();
|
|
6543
6692
|
return;
|
|
@@ -6551,54 +6700,54 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6551
6700
|
}]
|
|
6552
6701
|
}).setTextSelection(i + 2).focus().run();
|
|
6553
6702
|
}
|
|
6554
|
-
function
|
|
6703
|
+
function Ce() {
|
|
6555
6704
|
let e = y.value;
|
|
6556
6705
|
if (!e || !e.isEditable) return;
|
|
6557
6706
|
let t = e.state.doc.lastChild;
|
|
6558
6707
|
t?.type.name === "paragraph" && t.content.size === 0 ? e.commands.focus("end") : e.chain().insertContentAt(e.state.doc.content.size, { type: "paragraph" }).focus("end").run();
|
|
6559
6708
|
}
|
|
6560
6709
|
return Z(y, (e) => {
|
|
6561
|
-
e && (e.storage.blockSelection.openMenu =
|
|
6562
|
-
}, { immediate: !0 }),
|
|
6563
|
-
S = !0, window.removeEventListener("hashchange",
|
|
6564
|
-
}), (t, n) => y.value ? (G(),
|
|
6710
|
+
e && (e.storage.blockSelection.openMenu = ae, Q());
|
|
6711
|
+
}, { immediate: !0 }), re(() => window.addEventListener("hashchange", Q)), W(() => {
|
|
6712
|
+
S = !0, window.removeEventListener("hashchange", Q), clearTimeout(ue), clearTimeout(ve), y.value?.destroy();
|
|
6713
|
+
}), (t, n) => y.value ? (G(), I("div", V({
|
|
6565
6714
|
key: 0,
|
|
6566
6715
|
ref_key: "rootEl",
|
|
6567
6716
|
ref: c
|
|
6568
6717
|
}, m.value, { class: "me-root" }), [
|
|
6569
|
-
|
|
6718
|
+
z(X(Se), {
|
|
6570
6719
|
editor: y.value,
|
|
6571
|
-
nested:
|
|
6572
|
-
"on-node-change":
|
|
6573
|
-
"on-element-drag-start":
|
|
6574
|
-
"compute-position-config":
|
|
6720
|
+
nested: w,
|
|
6721
|
+
"on-node-change": A,
|
|
6722
|
+
"on-element-drag-start": B,
|
|
6723
|
+
"compute-position-config": j,
|
|
6575
6724
|
class: "me-drag-handle"
|
|
6576
6725
|
}, {
|
|
6577
|
-
default: fe(() => [
|
|
6726
|
+
default: fe(() => [L("div", kf, [L("button", {
|
|
6578
6727
|
type: "button",
|
|
6579
6728
|
class: "me-handle-btn",
|
|
6580
|
-
onClick:
|
|
6581
|
-
onMouseenter: n[0] ||= (e) =>
|
|
6582
|
-
onMouseleave:
|
|
6583
|
-
onMousedown:
|
|
6584
|
-
}, [
|
|
6729
|
+
onClick: xe,
|
|
6730
|
+
onMouseenter: n[0] ||= (e) => ye(e, "add"),
|
|
6731
|
+
onMouseleave: be,
|
|
6732
|
+
onMousedown: be
|
|
6733
|
+
}, [z(X(Et))], 32), L("button", {
|
|
6585
6734
|
type: "button",
|
|
6586
6735
|
class: "me-handle-btn me-handle-btn--grab",
|
|
6587
|
-
onClick:
|
|
6588
|
-
onMouseenter: n[1] ||= (e) =>
|
|
6589
|
-
onMouseleave:
|
|
6590
|
-
onMousedown:
|
|
6591
|
-
}, [
|
|
6736
|
+
onClick: ie,
|
|
6737
|
+
onMouseenter: n[1] ||= (e) => ye(e, "grip"),
|
|
6738
|
+
onMouseleave: be,
|
|
6739
|
+
onMousedown: be
|
|
6740
|
+
}, [z(X(st))], 32)])]),
|
|
6592
6741
|
_: 1
|
|
6593
6742
|
}, 8, ["editor"]),
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
u.value && e.editable ? (G(),
|
|
6743
|
+
L("div", Af, [a.value ? (G(), I("div", jf, Y(d.value.contentError), 1)) : F("", !0)]),
|
|
6744
|
+
z(Pd, { editor: y.value }, null, 8, ["editor"]),
|
|
6745
|
+
z(X(ge), { editor: y.value }, null, 8, ["editor"]),
|
|
6746
|
+
u.value && e.editable ? (G(), P(Df, {
|
|
6598
6747
|
key: 0,
|
|
6599
6748
|
editor: y.value
|
|
6600
|
-
}, null, 8, ["editor"])) :
|
|
6601
|
-
e.outline ? (G(),
|
|
6749
|
+
}, null, 8, ["editor"])) : F("", !0),
|
|
6750
|
+
e.outline ? (G(), P(zd, {
|
|
6602
6751
|
key: 1,
|
|
6603
6752
|
editor: y.value,
|
|
6604
6753
|
"min-headings": l.value,
|
|
@@ -6607,36 +6756,36 @@ var af = ["title"], of = ["title"], sf = ["title"], cf = ["title"], lf = ["onMou
|
|
|
6607
6756
|
"editor",
|
|
6608
6757
|
"min-headings",
|
|
6609
6758
|
"root"
|
|
6610
|
-
])) :
|
|
6611
|
-
e.editable ? (G(),
|
|
6759
|
+
])) : F("", !0),
|
|
6760
|
+
e.editable ? (G(), I("div", {
|
|
6612
6761
|
key: 2,
|
|
6613
6762
|
class: "me-editor-tail",
|
|
6614
|
-
onClick:
|
|
6615
|
-
})) :
|
|
6616
|
-
|
|
6763
|
+
onClick: Ce
|
|
6764
|
+
})) : F("", !0),
|
|
6765
|
+
D.value ? (G(), P(bd, {
|
|
6617
6766
|
key: 3,
|
|
6618
6767
|
editor: y.value,
|
|
6619
|
-
range:
|
|
6620
|
-
anchor:
|
|
6621
|
-
onClose:
|
|
6622
|
-
onCopyLink:
|
|
6768
|
+
range: D.value.range,
|
|
6769
|
+
anchor: D.value.anchor,
|
|
6770
|
+
onClose: J,
|
|
6771
|
+
onCopyLink: me
|
|
6623
6772
|
}, null, 8, [
|
|
6624
6773
|
"editor",
|
|
6625
6774
|
"range",
|
|
6626
6775
|
"anchor"
|
|
6627
|
-
])) :
|
|
6628
|
-
(G(),
|
|
6776
|
+
])) : F("", !0),
|
|
6777
|
+
(G(), P(ee, { to: "body" }, [_e.value ? (G(), I("div", V({ key: 0 }, m.value, {
|
|
6629
6778
|
class: "me-tooltip",
|
|
6630
6779
|
style: {
|
|
6631
|
-
left: `${
|
|
6632
|
-
top: `${
|
|
6780
|
+
left: `${_e.value.rect.left + _e.value.rect.width / 2}px`,
|
|
6781
|
+
top: `${_e.value.rect.top}px`
|
|
6633
6782
|
}
|
|
6634
|
-
}), [(G(!0),
|
|
6635
|
-
], 16)) :
|
|
6783
|
+
}), [(G(!0), I(M, null, q(_e.value.lines, ([e, t]) => (G(), I("div", { key: e }, [L("strong", Mf, Y(e), 1), R(" " + Y(t), 1)]))), 128)), _e.value.hint ? (G(), I("div", Nf, Y(_e.value.hint), 1)) : F("", !0)], 16)) : F("", !0), oe.value ? (G(), I("div", V({ key: 1 }, m.value, { class: "me-toast" }), Y(oe.value), 17)) : F("", !0)]))
|
|
6784
|
+
], 16)) : F("", !0);
|
|
6636
6785
|
}
|
|
6637
|
-
}),
|
|
6638
|
-
t.component !== !1 && e.component(t.componentName ?? "MeiEditor",
|
|
6786
|
+
}), Ff = { install(e, t = {}) {
|
|
6787
|
+
t.component !== !1 && e.component(t.componentName ?? "MeiEditor", Pf), e.provide(Ba, K(t.tokens)), t.blocks && e.provide(Va, t.blocks);
|
|
6639
6788
|
} };
|
|
6640
|
-
export {
|
|
6789
|
+
export { j as BLOCK_NAMES, Xi as BgColor, Qi as BlockColor, Tr as BlockDrop, Br as BlockSelection, yo as CODE_LANGUAGES, Zi as COLORABLE_BLOCKS, Qu as COLORS, eo as Callout, wo as CodeBlock, To as Column, Eo as Columns, Ku as ContentError, is as Embed, Cc as EmojiSuggestion, Kc as FileBlock, gi as FileDrop, Va as GLOBAL_BLOCKS_KEY, Ba as GLOBAL_TOKENS_KEY, hl as HtmlBlock, sc as ImageBlock, Cl as MathBlock, wl as MathInline, Jn as MeiConfig, Pf as MeiEditor, Ff as MeiEditorPlugin, ku as MentionNode, ju as MermaidPreview, k as PALETTE_NAMES, Ea as SlashCommand, Rr as TURN_INTO_SHORTCUTS, Iu as TableOfContents, Yi as TextColor, jo as ToggleDetails, Oa as UnknownBlock, ka as UnknownInline, D as baseTokensCss, Zn as blockAt, Ha as blockNodeView, Go as bulletList, Po as callout, No as codeBlock, Yn as collectExtensions, fr as colorBlocks, Vo as columns, S as componentTokens, Aa as createExtensions, tr as currentRange, Gu as defaultBlocks, $ as defineBlock, Zu as defineTokens, sr as deleteBlocks, Yo as divider, cr as duplicateBlocks, lc as embed, Bu as emoji, e as en, Hu as file, Lr as filterBlocks, Wo as heading, Wu as html, p as htmlBlockCsp, cc as image, Mr as isNode, vi as isSameOrigin, yi as isWebUrl, xo as loadLanguage, v as locales, _o as lowlight, Ru as math, Uu as mention, zu as mermaid, lr as moveBlocks, Ko as orderedList, x as overridesCss, ni as pendingUpload, E as primitiveTokens, Jo as quote, b as resolveMessages, oi as runUpload, _i as safeUrl, Yu as sanitizeContent, ir as selectBlocks, A as semanticDarkTokens, C as semanticLightTokens, zo as table, qo as taskList, Ho as text, s as toEmbedUrl, Lu as toc, Fo as toggle, Ro as toggleHeading, dr as turnBlocksInto, Xu as unwrapUnknown, ai as uploadsSettled, Wa as useClickOutside, Ua as useEditable, $i as useScope, n as vi, qu as wrapUnknown, y as zh };
|
|
6641
6790
|
|
|
6642
6791
|
//# sourceMappingURL=index.js.map
|