@baishuyun/ui-base 6.19.0 → 6.19.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/Amap/index.js +1 -1
- package/dist/Calendar/{Calendar-DEr4d6DN.js → Calendar-DbAebHXs.js} +1 -1
- package/dist/Calendar/index.js +3 -3
- package/dist/Card/index.js +1 -1
- package/dist/CheckBox/index.js +1 -1
- package/dist/ColorPicker/index.js +1 -1
- package/dist/ConfigProvider/index.js +1 -1
- package/dist/DatePicker/{DatePicker-Bzvz3bI6.js → DatePicker-B6E5kERj.js} +1 -1
- package/dist/DatePicker/{DatePickerPanel-CaAOuWM_.js → DatePickerPanel-Ch2PMF9n.js} +1 -1
- package/dist/DatePicker/index.js +2 -2
- package/dist/DropDown/index.js +1 -1
- package/dist/Editor/index.js +532 -348
- package/dist/Gantt/index.js +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/InputTag/index.js +1 -1
- package/dist/Loading/index.js +1 -1
- package/dist/Modal/index.js +1 -1
- package/dist/NotFoundContent/index.js +1 -1
- package/dist/Overlay/index.js +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/ScrollBar/index.js +1 -1
- package/dist/Segmented/index.js +1 -1
- package/dist/Select/index.js +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/Tabs/index.js +1 -1
- package/dist/Tooltip/index.js +1 -1
- package/dist/Tree/index.js +1 -1
- package/dist/components/Editor/constants/portableEditorStyles.d.ts +0 -1
- package/dist/index.js +3 -3
- package/dist/style.css +1 -1
- package/dist/vendors/{version-Dt7Pnhic.js → version-TqGVVc-h.js} +1 -1
- package/package.json +1 -1
package/dist/Editor/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../vendors/version-
|
|
1
|
+
import "../vendors/version-TqGVVc-h.js";
|
|
2
2
|
import "../ScrollBar/style-D26azwz6.js";
|
|
3
3
|
import { t as e } from "../Icon/Icon-DrdQOEJE.js";
|
|
4
4
|
import "../vendors/LocaleContext-DXQoOKM2.js";
|
|
@@ -1791,7 +1791,7 @@ var Kr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
|
1791
1791
|
" - 需要扫读的关键词:给 span 加 background-color 浅底。对:<span style=\"background-color:#fff4cd\">关键词</span>。错:<p style=\"background-color:#f0f6ff\">整段</p>。",
|
|
1792
1792
|
" - 背景色只能写在 span 上(短语级),禁止写在 p / h1-h3 / ul / ol / li。",
|
|
1793
1793
|
" - 段落/标题缩进只用 padding-inline-start,且必须是 40px 的倍数(与编辑器「增加缩进」一致)。",
|
|
1794
|
-
" -
|
|
1794
|
+
" - 列表不要写 ul/ol/li 的 padding;标记槽由编辑器按字号处理。",
|
|
1795
1795
|
" - 颜色用任意合法 CSS 色值即可(#RGB、#RRGGBB、rgb())。同一篇里主色不超过 2 种强调色,正文保持深色可读。",
|
|
1796
1796
|
" - span 仅可用于 color / font-size / background-color。",
|
|
1797
1797
|
" - p / h1-h3 仅可用于 text-align / padding-inline-start。",
|
|
@@ -1859,29 +1859,49 @@ var Kr = ({ disabled: e, tooltip: t, showDisabledTooltip: n }) => {
|
|
|
1859
1859
|
t.style.removeProperty("background-color"), t.style.removeProperty("background"), t.getAttribute("style")?.trim() || t.removeAttribute("style");
|
|
1860
1860
|
}
|
|
1861
1861
|
return t.innerHTML;
|
|
1862
|
+
}, ui = "--listitem-marker-font-size", di = `max(24px, calc(var(${ui}, 1em) * 1.25))`, fi = new Set([
|
|
1863
|
+
"U",
|
|
1864
|
+
"I",
|
|
1865
|
+
"EM",
|
|
1866
|
+
"B",
|
|
1867
|
+
"STRONG"
|
|
1868
|
+
]), pi = (e) => e.startsWith("--listitem-marker-"), mi = (e) => {
|
|
1869
|
+
let t = e.style.fontSize;
|
|
1870
|
+
if (t) for (let n = e.parentElement; n; n = n.parentElement) fi.has(n.tagName) && !n.style.fontSize && (n.style.fontSize = t), n.tagName === "LI" && !n.classList.contains("editor-nested-listitem") && !n.style.getPropertyValue(ui) && n.style.setProperty(ui, t);
|
|
1871
|
+
}, hi = (e, t, n, r) => {
|
|
1872
|
+
if (!e) return;
|
|
1873
|
+
let i = e.shadowRoot ?? e.attachShadow({ mode: "open" }), a = document.createElement("div");
|
|
1874
|
+
a.className = "bsy-editor-html-preview__body", a.innerHTML = n(t);
|
|
1875
|
+
for (let e of Array.from(a.querySelectorAll("table"))) {
|
|
1876
|
+
if (e.parentElement?.classList.contains("editor-table-scrollable-wrapper")) continue;
|
|
1877
|
+
let t = document.createElement("div");
|
|
1878
|
+
t.className = "editor-table-scrollable-wrapper", e.replaceWith(t), t.append(e);
|
|
1879
|
+
}
|
|
1880
|
+
let o = document.createElement("style");
|
|
1881
|
+
o.textContent = r, i.replaceChildren(o, a);
|
|
1862
1882
|
};
|
|
1863
1883
|
//#endregion
|
|
1864
1884
|
//#region src/components/Editor/utils/htmlText.ts
|
|
1865
|
-
function
|
|
1885
|
+
function gi(e) {
|
|
1866
1886
|
return /<[^>]*$/.test(e.trim());
|
|
1867
1887
|
}
|
|
1868
|
-
function
|
|
1888
|
+
function _i(e) {
|
|
1869
1889
|
return e ? new DOMParser().parseFromString(e, "text/html").body.textContent ?? "" : "";
|
|
1870
1890
|
}
|
|
1871
1891
|
//#endregion
|
|
1872
1892
|
//#region src/components/Editor/utils/fillRootFromHtml.ts
|
|
1873
|
-
var
|
|
1893
|
+
var vi = [
|
|
1874
1894
|
"color",
|
|
1875
1895
|
"background-color",
|
|
1876
1896
|
"font-size",
|
|
1877
1897
|
"font-family",
|
|
1878
1898
|
"font-weight",
|
|
1879
1899
|
"text-decoration"
|
|
1880
|
-
],
|
|
1900
|
+
], yi = (e) => {
|
|
1881
1901
|
let t = e.body.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, td, th");
|
|
1882
1902
|
for (let n of Array.from(t)) {
|
|
1883
1903
|
let t = n, r = [];
|
|
1884
|
-
for (let e of
|
|
1904
|
+
for (let e of vi) {
|
|
1885
1905
|
let n = t.style.getPropertyValue(e);
|
|
1886
1906
|
n && (r.push(`${e}: ${n}`), t.style.removeProperty(e));
|
|
1887
1907
|
}
|
|
@@ -1899,11 +1919,11 @@ var fi = [
|
|
|
1899
1919
|
}
|
|
1900
1920
|
}
|
|
1901
1921
|
}
|
|
1902
|
-
},
|
|
1922
|
+
}, bi = (e, t) => {
|
|
1903
1923
|
let n = F();
|
|
1904
1924
|
if (n.clear(), t.trim()) {
|
|
1905
1925
|
let r = new DOMParser().parseFromString(t, "text/html");
|
|
1906
|
-
|
|
1926
|
+
yi(r);
|
|
1907
1927
|
let i = _e(e, r);
|
|
1908
1928
|
if (i.length) {
|
|
1909
1929
|
n.select(), Ee(i), Pe(null);
|
|
@@ -1915,12 +1935,12 @@ var fi = [
|
|
|
1915
1935
|
};
|
|
1916
1936
|
//#endregion
|
|
1917
1937
|
//#region src/components/Editor/utils/isEmptyEditorHtml.ts
|
|
1918
|
-
function
|
|
1938
|
+
function xi(e, t) {
|
|
1919
1939
|
return !t.trim() && (e === "<p><br></p>" || e === "<p></p>" || e === "" || /^<p>\s*<br>\s*<\/p>$/.test(e));
|
|
1920
1940
|
}
|
|
1921
1941
|
//#endregion
|
|
1922
1942
|
//#region src/components/Editor/utils/sanitizeEditorHtml.ts
|
|
1923
|
-
var
|
|
1943
|
+
var Si = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre.code.table.thead.tbody.tr.td.th.h1.h2.h3.h4.h5.h6".split("."), Ci = [
|
|
1924
1944
|
"href",
|
|
1925
1945
|
"src",
|
|
1926
1946
|
"alt",
|
|
@@ -1936,12 +1956,12 @@ var gi = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre
|
|
|
1936
1956
|
"style",
|
|
1937
1957
|
"width",
|
|
1938
1958
|
"height"
|
|
1939
|
-
],
|
|
1959
|
+
], wi = new Set(/* @__PURE__ */ "color.background-color.font-size.font-family.font-weight.font-style.text-decoration.text-align.max-width.display.vertical-align.width.height.border.margin.margin-inline-start.padding.padding-inline-start.line-height.list-style-type.list-style-position.list-style.border-collapse.table-layout.overflow-x.white-space.position.top.bottom.tab-size.border-radius.box-sizing.min-width.min-height.cursor".split(".")), Ti = /^(?:(?:(?:f|ht)tps?|mailto|blob):|data:image\/[a-z0-9.+-]+[;,].*|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i, Ei = new Set([
|
|
1940
1960
|
"pre",
|
|
1941
1961
|
"code",
|
|
1942
1962
|
"td",
|
|
1943
1963
|
"th"
|
|
1944
|
-
]),
|
|
1964
|
+
]), Di = new Set(["pre", "code"]), Oi = new Set(["sup", "sub"]), ki = (e, t) => pi(e) ? t === "li" : wi.has(e) ? e === "padding-inline-start" ? !0 : e === "padding" || e.startsWith("padding-") ? Ei.has(t) : e === "border-radius" ? Di.has(t) : e === "position" || e === "top" || e === "bottom" ? Oi.has(t) : !0 : !1, Ai = (e, t) => e.split(";").map((e) => e.trim()).filter(Boolean).map((e) => {
|
|
1945
1965
|
let n = e.indexOf(":");
|
|
1946
1966
|
if (n === -1) return null;
|
|
1947
1967
|
let r = e.slice(0, n).trim().toLowerCase(), i = e.slice(n + 1).trim();
|
|
@@ -1949,78 +1969,80 @@ var gi = /* @__PURE__ */ "p.br.strong.em.b.i.u.s.span.sub.sup.ul.ol.li.a.img.pre
|
|
|
1949
1969
|
if (/url\s*\(/i.test(i)) return null;
|
|
1950
1970
|
r = "background-color";
|
|
1951
1971
|
}
|
|
1952
|
-
return !
|
|
1953
|
-
}).filter((e) => e !== null).join("; "),
|
|
1954
|
-
|
|
1972
|
+
return !ki(r, t) || /expression|javascript:|url\s*\(\s*['"]?\s*javascript/i.test(i) ? null : `${r}: ${i}`;
|
|
1973
|
+
}).filter((e) => e !== null).join("; "), ji = !1, Mi = () => {
|
|
1974
|
+
ji ||= (Zt.addHook("uponSanitizeAttribute", (e, t) => {
|
|
1955
1975
|
if (t.attrName === "href" && /^data:/i.test(t.attrValue)) {
|
|
1956
1976
|
t.keepAttr = !1;
|
|
1957
1977
|
return;
|
|
1958
1978
|
}
|
|
1959
|
-
t.attrName === "style" && (t.attrValue =
|
|
1979
|
+
t.attrName === "style" && (t.attrValue = Ai(t.attrValue, e.nodeName.toLowerCase()), t.attrValue || (t.keepAttr = !1));
|
|
1960
1980
|
}), !0);
|
|
1961
1981
|
};
|
|
1962
1982
|
function X(e) {
|
|
1963
|
-
return e ? (
|
|
1964
|
-
ALLOWED_TAGS:
|
|
1965
|
-
ALLOWED_ATTR:
|
|
1983
|
+
return e ? (Mi(), Zt.sanitize(e, {
|
|
1984
|
+
ALLOWED_TAGS: Si,
|
|
1985
|
+
ALLOWED_ATTR: Ci,
|
|
1966
1986
|
ALLOW_DATA_ATTR: !1,
|
|
1967
1987
|
ADD_ATTR: [
|
|
1968
1988
|
"data-language",
|
|
1969
1989
|
"data-id",
|
|
1970
1990
|
"data-src"
|
|
1971
1991
|
],
|
|
1972
|
-
ALLOWED_URI_REGEXP:
|
|
1992
|
+
ALLOWED_URI_REGEXP: Ti
|
|
1973
1993
|
})) : "";
|
|
1974
1994
|
}
|
|
1975
1995
|
//#endregion
|
|
1976
1996
|
//#region src/components/Editor/constants/portableEditorStyles.ts
|
|
1977
|
-
var
|
|
1997
|
+
var Ni = {
|
|
1978
1998
|
margin: "0.6em 0 0.4em",
|
|
1979
1999
|
"font-weight": "600",
|
|
1980
2000
|
"line-height": "1.35"
|
|
1981
|
-
},
|
|
2001
|
+
}, Pi = {
|
|
1982
2002
|
h1: {
|
|
1983
|
-
...
|
|
2003
|
+
...Ni,
|
|
1984
2004
|
"font-size": "2em"
|
|
1985
2005
|
},
|
|
1986
2006
|
h2: {
|
|
1987
|
-
...
|
|
2007
|
+
...Ni,
|
|
1988
2008
|
"font-size": "1.5em"
|
|
1989
2009
|
},
|
|
1990
2010
|
h3: {
|
|
1991
|
-
...
|
|
2011
|
+
...Ni,
|
|
1992
2012
|
"font-size": "1.25em"
|
|
1993
2013
|
},
|
|
1994
2014
|
h4: {
|
|
1995
|
-
...
|
|
2015
|
+
...Ni,
|
|
1996
2016
|
"font-size": "1.125em"
|
|
1997
2017
|
},
|
|
1998
2018
|
h5: {
|
|
1999
|
-
...
|
|
2019
|
+
...Ni,
|
|
2000
2020
|
"font-size": "1em"
|
|
2001
2021
|
},
|
|
2002
2022
|
h6: {
|
|
2003
|
-
...
|
|
2023
|
+
...Ni,
|
|
2004
2024
|
"font-size": "0.875em"
|
|
2005
2025
|
}
|
|
2006
|
-
},
|
|
2026
|
+
}, Fi = {
|
|
2007
2027
|
color: "#0269ff",
|
|
2008
2028
|
cursor: "pointer"
|
|
2009
|
-
},
|
|
2029
|
+
}, Ii = {
|
|
2010
2030
|
margin: "0",
|
|
2011
|
-
"padding-inline-start": "
|
|
2031
|
+
"padding-inline-start": "0",
|
|
2012
2032
|
"list-style-position": "outside"
|
|
2013
|
-
},
|
|
2033
|
+
}, Li = [
|
|
2014
2034
|
"disc",
|
|
2015
2035
|
"circle",
|
|
2016
2036
|
"square"
|
|
2017
|
-
],
|
|
2037
|
+
], Ri = {
|
|
2018
2038
|
margin: "0",
|
|
2039
|
+
"margin-inline-start": di,
|
|
2019
2040
|
"list-style": "inherit"
|
|
2020
|
-
},
|
|
2041
|
+
}, zi = {
|
|
2021
2042
|
margin: "0",
|
|
2043
|
+
"margin-inline-start": "0",
|
|
2022
2044
|
"list-style-type": "none"
|
|
2023
|
-
},
|
|
2045
|
+
}, Bi = {
|
|
2024
2046
|
display: "block",
|
|
2025
2047
|
"box-sizing": "border-box",
|
|
2026
2048
|
"max-width": "100%",
|
|
@@ -2035,23 +2057,23 @@ var Di = {
|
|
|
2035
2057
|
"border-radius": "4px",
|
|
2036
2058
|
"background-color": "rgb(240, 242, 245)",
|
|
2037
2059
|
color: "#1f2328"
|
|
2038
|
-
},
|
|
2060
|
+
}, Vi = {
|
|
2039
2061
|
"border-collapse": "collapse",
|
|
2040
2062
|
"table-layout": "fixed",
|
|
2041
2063
|
width: "100%",
|
|
2042
2064
|
"overflow-x": "auto",
|
|
2043
2065
|
margin: "8px 0"
|
|
2044
|
-
},
|
|
2066
|
+
}, Hi = {
|
|
2045
2067
|
"box-sizing": "border-box",
|
|
2046
2068
|
"min-width": "75px",
|
|
2047
2069
|
"min-height": "32px",
|
|
2048
2070
|
padding: "4px 8px",
|
|
2049
2071
|
border: "1px solid #d9d9d9",
|
|
2050
2072
|
"vertical-align": "top"
|
|
2051
|
-
},
|
|
2073
|
+
}, Ui = {
|
|
2052
2074
|
"font-weight": "600",
|
|
2053
2075
|
"background-color": "#f2f3f5"
|
|
2054
|
-
},
|
|
2076
|
+
}, Wi = {
|
|
2055
2077
|
display: "inline-block",
|
|
2056
2078
|
position: "static",
|
|
2057
2079
|
top: "auto",
|
|
@@ -2060,38 +2082,39 @@ var Di = {
|
|
|
2060
2082
|
"line-height": "1"
|
|
2061
2083
|
}, Z = (e, t) => {
|
|
2062
2084
|
for (let [n, r] of Object.entries(t)) e.style.getPropertyValue(n) || e.style.setProperty(n, r);
|
|
2063
|
-
},
|
|
2085
|
+
}, Gi = (e) => {
|
|
2064
2086
|
let t = 0, n = e;
|
|
2065
2087
|
for (; n;) n.tagName === "UL" && (t += 1), n = n.parentElement;
|
|
2066
2088
|
return t;
|
|
2067
|
-
},
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2089
|
+
}, Ki = (e) => {
|
|
2090
|
+
let t = [...e.querySelectorAll("*")].filter((e) => e instanceof HTMLElement);
|
|
2091
|
+
for (let e of t) mi(e);
|
|
2092
|
+
for (let e of t) {
|
|
2093
|
+
let t = e.tagName.toLowerCase(), n = Pi[t];
|
|
2094
|
+
if (n && Z(e, n), t === "a" && Z(e, Fi), t === "ul") {
|
|
2095
|
+
let t = Math.min(Math.max(Gi(e), 1), Li.length);
|
|
2096
|
+
Z(e, {
|
|
2097
|
+
...Ii,
|
|
2098
|
+
"list-style-type": Li[t - 1]
|
|
2076
2099
|
});
|
|
2077
2100
|
}
|
|
2078
|
-
|
|
2079
|
-
...
|
|
2101
|
+
t === "ol" && Z(e, {
|
|
2102
|
+
...Ii,
|
|
2080
2103
|
"list-style-type": "decimal"
|
|
2081
|
-
}),
|
|
2082
|
-
...
|
|
2083
|
-
"vertical-align":
|
|
2084
|
-
}),
|
|
2085
|
-
for (let
|
|
2086
|
-
|
|
2104
|
+
}), t === "li" && Z(e, e.classList.contains("editor-nested-listitem") ? zi : Ri), t === "pre" && Z(e, Bi), (t === "sup" || t === "sub") && Z(e, {
|
|
2105
|
+
...Wi,
|
|
2106
|
+
"vertical-align": t === "sup" ? "super" : "sub"
|
|
2107
|
+
}), t === "table" && Z(e, Vi), (t === "td" || t === "th") && (Z(e, Hi), (t === "th" || e.classList.contains("editor-table-cell-header")) && Z(e, Ui)), e.classList.contains("editor-text-underline-strikethrough") ? Z(e, { "text-decoration": "underline line-through" }) : e.classList.contains("editor-text-underline") ? Z(e, { "text-decoration": "underline" }) : e.classList.contains("editor-text-strikethrough") && Z(e, { "text-decoration": "line-through" });
|
|
2108
|
+
for (let t of Array.from(e.classList)) t.startsWith("editor-") && e.classList.remove(t);
|
|
2109
|
+
e.classList.length === 0 && e.removeAttribute("class");
|
|
2087
2110
|
}
|
|
2088
|
-
},
|
|
2111
|
+
}, qi = (e) => {
|
|
2089
2112
|
let t = e.parentNode;
|
|
2090
2113
|
if (t) {
|
|
2091
2114
|
for (; e.firstChild;) t.insertBefore(e.firstChild, e);
|
|
2092
2115
|
t.removeChild(e);
|
|
2093
2116
|
}
|
|
2094
|
-
},
|
|
2117
|
+
}, Ji = (e) => {
|
|
2095
2118
|
let t = !0;
|
|
2096
2119
|
for (; t;) {
|
|
2097
2120
|
t = !1;
|
|
@@ -2099,34 +2122,34 @@ var Di = {
|
|
|
2099
2122
|
if (n.attributes.length > 0) continue;
|
|
2100
2123
|
let e = n.tagName.toLowerCase();
|
|
2101
2124
|
if (e === "span") {
|
|
2102
|
-
|
|
2125
|
+
qi(n), t = !0;
|
|
2103
2126
|
continue;
|
|
2104
2127
|
}
|
|
2105
2128
|
if (n.childElementCount !== 1 || n.childNodes.length !== 1) continue;
|
|
2106
2129
|
let r = n.firstElementChild;
|
|
2107
|
-
(e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (
|
|
2130
|
+
(e === "b" && r?.tagName === "STRONG" || e === "i" && r?.tagName === "EM") && (qi(n), t = !0);
|
|
2108
2131
|
}
|
|
2109
2132
|
}
|
|
2110
2133
|
};
|
|
2111
|
-
function
|
|
2134
|
+
function Yi(e) {
|
|
2112
2135
|
if (!e.trim()) return e;
|
|
2113
2136
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
2114
|
-
|
|
2137
|
+
Ki(t.body), Ji(t.body);
|
|
2115
2138
|
for (let e of Array.from(t.body.querySelectorAll("pre"))) e.textContent?.trim() || e.remove();
|
|
2116
2139
|
return t.body.innerHTML;
|
|
2117
2140
|
}
|
|
2118
2141
|
//#endregion
|
|
2119
2142
|
//#region src/components/Editor/utils/applyAiPolish.ts
|
|
2120
|
-
function
|
|
2143
|
+
function Xi(e) {
|
|
2121
2144
|
return e.join(`\n\n${ei}\n\n`);
|
|
2122
2145
|
}
|
|
2123
|
-
function
|
|
2146
|
+
function Zi(e) {
|
|
2124
2147
|
return e.includes("<!--bsy-block-->") ? e.split(ei).map((e) => e.trim()) : [e];
|
|
2125
2148
|
}
|
|
2126
|
-
function
|
|
2149
|
+
function Qi(e) {
|
|
2127
2150
|
return e.split(ei).join("").trim().length > 0;
|
|
2128
2151
|
}
|
|
2129
|
-
function
|
|
2152
|
+
function $i(e, t) {
|
|
2130
2153
|
let n = e.map(() => "");
|
|
2131
2154
|
if (e.length === 0) return n;
|
|
2132
2155
|
let r = [], i = [];
|
|
@@ -2140,7 +2163,7 @@ function qi(e, t) {
|
|
|
2140
2163
|
for (; d < c;) n[n.length - 1] += o[d], d += 1;
|
|
2141
2164
|
return n;
|
|
2142
2165
|
}
|
|
2143
|
-
var
|
|
2166
|
+
var ea = new Set(["PRE"]), ta = new Set([
|
|
2144
2167
|
"PRE",
|
|
2145
2168
|
"TABLE",
|
|
2146
2169
|
"THEAD",
|
|
@@ -2151,11 +2174,11 @@ var Ji = new Set(["PRE"]), Yi = new Set([
|
|
|
2151
2174
|
"IMG",
|
|
2152
2175
|
"BR"
|
|
2153
2176
|
]);
|
|
2154
|
-
function
|
|
2177
|
+
function na(e) {
|
|
2155
2178
|
let t = [], n = (e) => {
|
|
2156
2179
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
2157
2180
|
let t = e.tagName;
|
|
2158
|
-
if (
|
|
2181
|
+
if (ea.has(t)) return;
|
|
2159
2182
|
for (let t of Array.from(e.childNodes)) n(t);
|
|
2160
2183
|
return;
|
|
2161
2184
|
}
|
|
@@ -2163,31 +2186,31 @@ function Xi(e) {
|
|
|
2163
2186
|
};
|
|
2164
2187
|
return n(e), t;
|
|
2165
2188
|
}
|
|
2166
|
-
function
|
|
2189
|
+
function ra(e, t) {
|
|
2167
2190
|
let n = e;
|
|
2168
|
-
for (; n && n !== t && !
|
|
2191
|
+
for (; n && n !== t && !ta.has(n.tagName) && !(n.textContent ?? "").trim() && !n.querySelector("img, pre, table, br");) {
|
|
2169
2192
|
let e = n.parentElement;
|
|
2170
2193
|
n.remove(), n = e;
|
|
2171
2194
|
}
|
|
2172
2195
|
}
|
|
2173
|
-
function
|
|
2196
|
+
function ia(e) {
|
|
2174
2197
|
let t = e.tagName;
|
|
2175
2198
|
return t === "PRE" || t === "IMG" || t === "TABLE";
|
|
2176
2199
|
}
|
|
2177
|
-
function
|
|
2200
|
+
function aa(e) {
|
|
2178
2201
|
let t = ri(e);
|
|
2179
|
-
return t ? Array.from(t.children).filter((e) => !
|
|
2202
|
+
return t ? Array.from(t.children).filter((e) => !ia(e)).map((e) => e.textContent ?? "") : [];
|
|
2180
2203
|
}
|
|
2181
|
-
function
|
|
2182
|
-
return e.includes("<!--bsy-block-->") ? e :
|
|
2204
|
+
function oa(e) {
|
|
2205
|
+
return e.includes("<!--bsy-block-->") ? e : _i(e) || e;
|
|
2183
2206
|
}
|
|
2184
|
-
function
|
|
2185
|
-
let n =
|
|
2207
|
+
function sa(e, t) {
|
|
2208
|
+
let n = na(e);
|
|
2186
2209
|
if (n.length === 0) {
|
|
2187
2210
|
t && (e.querySelector("br")?.remove(), e.append(e.ownerDocument.createTextNode(t)));
|
|
2188
2211
|
return;
|
|
2189
2212
|
}
|
|
2190
|
-
let r =
|
|
2213
|
+
let r = $i(n.map((e) => e.textContent ?? ""), t);
|
|
2191
2214
|
for (let t = 0; t < n.length; t++) {
|
|
2192
2215
|
let i = r[t], a = n[t];
|
|
2193
2216
|
if (i) {
|
|
@@ -2195,36 +2218,36 @@ function ta(e, t) {
|
|
|
2195
2218
|
continue;
|
|
2196
2219
|
}
|
|
2197
2220
|
let o = a.parentElement;
|
|
2198
|
-
a.remove(),
|
|
2221
|
+
a.remove(), ra(o, e);
|
|
2199
2222
|
}
|
|
2200
2223
|
}
|
|
2201
|
-
function
|
|
2202
|
-
let n =
|
|
2203
|
-
if (!
|
|
2224
|
+
function ca(e, t) {
|
|
2225
|
+
let n = oa(t);
|
|
2226
|
+
if (!Qi(n) || !e.trim()) return "";
|
|
2204
2227
|
let r = ri(e);
|
|
2205
2228
|
if (!r) return "";
|
|
2206
|
-
let i = Array.from(r.children).filter((e) => !
|
|
2229
|
+
let i = Array.from(r.children).filter((e) => !ia(e));
|
|
2207
2230
|
if (i.length === 0) return "";
|
|
2208
|
-
let a =
|
|
2209
|
-
for (let e = 0; e < i.length; e++)
|
|
2231
|
+
let a = Zi(n), o = a.length === i.length ? a : $i(i.map((e) => e.textContent ?? ""), a.join(""));
|
|
2232
|
+
for (let e = 0; e < i.length; e++) sa(i[e], o[e] ?? "");
|
|
2210
2233
|
return r.innerHTML;
|
|
2211
2234
|
}
|
|
2212
|
-
function
|
|
2235
|
+
function la(e, t) {
|
|
2213
2236
|
let n = "";
|
|
2214
2237
|
e.getEditorState().read(() => {
|
|
2215
|
-
n =
|
|
2238
|
+
n = Yi(X(ge(e, null)));
|
|
2216
2239
|
}, { editor: e });
|
|
2217
|
-
let r = X(
|
|
2218
|
-
return !r.trim() ||
|
|
2219
|
-
|
|
2240
|
+
let r = X(ca(n, t));
|
|
2241
|
+
return !r.trim() || xi(r, _i(r)) ? !1 : (e.update(() => {
|
|
2242
|
+
bi(e, r), Dn(!0);
|
|
2220
2243
|
}, { discrete: !0 }), !0);
|
|
2221
2244
|
}
|
|
2222
2245
|
//#endregion
|
|
2223
2246
|
//#region src/components/Editor/utils/readEditorAiSnapshot.ts
|
|
2224
|
-
function
|
|
2247
|
+
function ua(e) {
|
|
2225
2248
|
let t = "", n = "", r = "";
|
|
2226
2249
|
e.getEditorState().read(() => {
|
|
2227
|
-
n = F().getTextContent(), t =
|
|
2250
|
+
n = F().getTextContent(), t = Yi(X(ge(e, null))), r = Xi(aa(t));
|
|
2228
2251
|
}, { editor: e });
|
|
2229
2252
|
let i = $r(t);
|
|
2230
2253
|
return {
|
|
@@ -2265,10 +2288,10 @@ var Q = {
|
|
|
2265
2288
|
"bsy-lexical-ai__footer": "_bsy-lexical-ai__footer_p7v4i_165",
|
|
2266
2289
|
"bsy-lexical-ai__error": "_bsy-lexical-ai__error_p7v4i_173",
|
|
2267
2290
|
"bsy-lexical-ai__preset": "_bsy-lexical-ai__preset_p7v4i_178"
|
|
2268
|
-
},
|
|
2291
|
+
}, da = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAADNBJREFUeAG1WuuvXUUV/619dqEPaG+pUFqg3AKFIoFWkKeKLWLRaKD6vVGMMcYQC8EPmBge/4A0fpEQEkmMz0QjH8CoIa3WUGwQ2o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vZPGDBdga508P7dGeVYeaQ5yxcndavPp1cEhjJVHWou5h4YAjbeIinyoPSP2nue/yFlpf9b/euXJ69DujDD/iy+1JkqHjoBeIfOMPtYElswTzq6av2s+//OHWwk4UCe4H5DJUqofpVwONXaEgo8YzOHqsYH4EtlnTgM0+COFl26gyD5hiLPIizPicP2fKkc4whGOcCjwKViIGaRSStOhAAAAAElFTkSuQmCC", pa = 16, ma = ({ disabled: t, tooltip: n, showDisabledTooltip: r }) => {
|
|
2269
2292
|
let [i] = R(), { typeset: o, polish: s, canTypeset: c, canPolish: l, aiOpen: u, setAiOpen: d, aiSessionRef: p } = mr(), { hasEditorText: m } = J(), { t: h } = a(), { iconSize: g } = K(), _ = t || !c || !m, x = t || !l || !m, S = t || !!u, C = T(() => {
|
|
2270
2293
|
if (t || !c || !o) return;
|
|
2271
|
-
let e =
|
|
2294
|
+
let e = ua(i);
|
|
2272
2295
|
e.text.trim() && (p.current = {
|
|
2273
2296
|
originalHtml: e.html,
|
|
2274
2297
|
codeBlocks: e.codeBlocks
|
|
@@ -2286,8 +2309,8 @@ var Q = {
|
|
|
2286
2309
|
o
|
|
2287
2310
|
]), w = T((e) => {
|
|
2288
2311
|
if (t || !l || !s) return;
|
|
2289
|
-
let n =
|
|
2290
|
-
|
|
2312
|
+
let n = ua(i);
|
|
2313
|
+
Qi(n.polishText) && (p.current = {
|
|
2291
2314
|
originalHtml: n.html,
|
|
2292
2315
|
originalText: n.polishText,
|
|
2293
2316
|
preset: e
|
|
@@ -2314,10 +2337,10 @@ var Q = {
|
|
|
2314
2337
|
label: h("editor.aiTypeset"),
|
|
2315
2338
|
disabled: _,
|
|
2316
2339
|
icon: /* @__PURE__ */ y("img", {
|
|
2317
|
-
src:
|
|
2340
|
+
src: da,
|
|
2318
2341
|
alt: "",
|
|
2319
|
-
width:
|
|
2320
|
-
height:
|
|
2342
|
+
width: pa,
|
|
2343
|
+
height: pa,
|
|
2321
2344
|
className: Q["bsy-lexical-ai__icon"],
|
|
2322
2345
|
draggable: !1
|
|
2323
2346
|
})
|
|
@@ -2326,10 +2349,10 @@ var Q = {
|
|
|
2326
2349
|
label: h("editor.aiPolish"),
|
|
2327
2350
|
disabled: x,
|
|
2328
2351
|
icon: /* @__PURE__ */ y("img", {
|
|
2329
|
-
src:
|
|
2352
|
+
src: fa,
|
|
2330
2353
|
alt: "",
|
|
2331
|
-
width:
|
|
2332
|
-
height:
|
|
2354
|
+
width: pa,
|
|
2355
|
+
height: pa,
|
|
2333
2356
|
className: Q["bsy-lexical-ai__icon"],
|
|
2334
2357
|
draggable: !1
|
|
2335
2358
|
}),
|
|
@@ -2345,10 +2368,10 @@ var Q = {
|
|
|
2345
2368
|
disabled: S,
|
|
2346
2369
|
icon: /* @__PURE__ */ b(v, { children: [
|
|
2347
2370
|
/* @__PURE__ */ y("img", {
|
|
2348
|
-
src:
|
|
2371
|
+
src: da,
|
|
2349
2372
|
alt: "",
|
|
2350
|
-
width:
|
|
2351
|
-
height:
|
|
2373
|
+
width: pa,
|
|
2374
|
+
height: pa,
|
|
2352
2375
|
className: Q["bsy-lexical-ai__icon"],
|
|
2353
2376
|
draggable: !1
|
|
2354
2377
|
}),
|
|
@@ -2375,12 +2398,12 @@ var Q = {
|
|
|
2375
2398
|
},
|
|
2376
2399
|
children: O
|
|
2377
2400
|
});
|
|
2378
|
-
},
|
|
2401
|
+
}, ha = /* @__PURE__ */ new Map(), ga = (e, t) => {
|
|
2379
2402
|
if (!e) throw Error("registerToolbarButton: name is required");
|
|
2380
|
-
|
|
2381
|
-
},
|
|
2382
|
-
|
|
2383
|
-
},
|
|
2403
|
+
ha.set(e, t);
|
|
2404
|
+
}, _a = (e) => {
|
|
2405
|
+
ha.delete(e);
|
|
2406
|
+
}, va = (e) => ha.get(e), ya = () => Array.from(ha.keys());
|
|
2384
2407
|
Object.entries({
|
|
2385
2408
|
undo: Or,
|
|
2386
2409
|
redo: kr,
|
|
@@ -2406,13 +2429,13 @@ Object.entries({
|
|
|
2406
2429
|
code: Lr,
|
|
2407
2430
|
table: Br,
|
|
2408
2431
|
source: Ur,
|
|
2409
|
-
ai:
|
|
2432
|
+
ai: ma
|
|
2410
2433
|
}).forEach(([e, t]) => {
|
|
2411
|
-
|
|
2434
|
+
ga(e, t);
|
|
2412
2435
|
});
|
|
2413
2436
|
//#endregion
|
|
2414
2437
|
//#region src/components/Editor/utils/getToolbarItems.ts
|
|
2415
|
-
var
|
|
2438
|
+
var ba = (e, t, n) => {
|
|
2416
2439
|
if (n) return [
|
|
2417
2440
|
{
|
|
2418
2441
|
kind: "button",
|
|
@@ -2470,10 +2493,10 @@ var ma = (e, t, n) => {
|
|
|
2470
2493
|
key: `divider-${t.key}`
|
|
2471
2494
|
});
|
|
2472
2495
|
}), r;
|
|
2473
|
-
},
|
|
2496
|
+
}, xa = Cn.map((e) => ({
|
|
2474
2497
|
key: e.id,
|
|
2475
2498
|
label: e.label
|
|
2476
|
-
})),
|
|
2499
|
+
})), Sa = () => {
|
|
2477
2500
|
let [t] = R(), { codeLanguage: n } = J(), { t: r } = a(), { iconSize: i } = K(), o = T((e) => {
|
|
2478
2501
|
let n = e.key;
|
|
2479
2502
|
G(t), t.update(() => {
|
|
@@ -2482,7 +2505,7 @@ var ma = (e, t, n) => {
|
|
|
2482
2505
|
});
|
|
2483
2506
|
}, [t]), s = wn[n].label;
|
|
2484
2507
|
return /* @__PURE__ */ y(f, {
|
|
2485
|
-
menus:
|
|
2508
|
+
menus: xa,
|
|
2486
2509
|
onClick: o,
|
|
2487
2510
|
activeKey: [n],
|
|
2488
2511
|
showSearch: !1,
|
|
@@ -2507,7 +2530,7 @@ var ma = (e, t, n) => {
|
|
|
2507
2530
|
})
|
|
2508
2531
|
})
|
|
2509
2532
|
});
|
|
2510
|
-
},
|
|
2533
|
+
}, Ca = {
|
|
2511
2534
|
initial: {
|
|
2512
2535
|
opacity: 0,
|
|
2513
2536
|
x: 6
|
|
@@ -2520,13 +2543,13 @@ var ma = (e, t, n) => {
|
|
|
2520
2543
|
opacity: 0,
|
|
2521
2544
|
x: -6
|
|
2522
2545
|
}
|
|
2523
|
-
},
|
|
2546
|
+
}, wa = (e) => {
|
|
2524
2547
|
if (e.kind === "divider") return /* @__PURE__ */ y("div", { className: W["bsy-lexical__toolbar-divider"] });
|
|
2525
|
-
if (e.kind === "language") return /* @__PURE__ */ y(
|
|
2526
|
-
let t =
|
|
2548
|
+
if (e.kind === "language") return /* @__PURE__ */ y(Sa, {});
|
|
2549
|
+
let t = va(e.name);
|
|
2527
2550
|
return t ? /* @__PURE__ */ y(t, { ...e.props }) : (console.warn(`[ToolbarPlugin] Button "${e.name}" is not registered.`), null);
|
|
2528
|
-
},
|
|
2529
|
-
let i =
|
|
2551
|
+
}, Ta = C(function({ item: e, motionProps: t, transition: n }, r) {
|
|
2552
|
+
let i = wa(e);
|
|
2530
2553
|
return i === null ? null : /* @__PURE__ */ y(se.div, {
|
|
2531
2554
|
ref: r,
|
|
2532
2555
|
"data-toolbar-item-key": e.key,
|
|
@@ -2536,8 +2559,8 @@ var ma = (e, t, n) => {
|
|
|
2536
2559
|
...t,
|
|
2537
2560
|
children: i
|
|
2538
2561
|
}, e.key);
|
|
2539
|
-
}),
|
|
2540
|
-
let { isCodeBlock: n } = J(), { isSourceMode: r } = Hr(), i = ce(), o = A(() =>
|
|
2562
|
+
}), Ea = ({ config: e, sizeToken: t }) => {
|
|
2563
|
+
let { isCodeBlock: n } = J(), { isSourceMode: r } = Hr(), i = ce(), o = A(() => ba(e, n, r), [
|
|
2541
2564
|
e,
|
|
2542
2565
|
n,
|
|
2543
2566
|
r
|
|
@@ -2554,7 +2577,7 @@ var ma = (e, t, n) => {
|
|
|
2554
2577
|
let [_, v] = M(!1), x = {
|
|
2555
2578
|
duration: i ? 0 : .16,
|
|
2556
2579
|
ease: "easeOut"
|
|
2557
|
-
}, S = i ? {} :
|
|
2580
|
+
}, S = i ? {} : Ca, C = T(() => {
|
|
2558
2581
|
let e = l.current;
|
|
2559
2582
|
if (!e || f.current && g.current !== o.length) return;
|
|
2560
2583
|
let t = getComputedStyle(e), n = Number.parseFloat(t.columnGap || t.gap) || 0, r = e.clientWidth, i = new Set(o.map((e) => e.key));
|
|
@@ -2602,7 +2625,7 @@ var ma = (e, t, n) => {
|
|
|
2602
2625
|
/* @__PURE__ */ y(oe, {
|
|
2603
2626
|
initial: !1,
|
|
2604
2627
|
mode: "popLayout",
|
|
2605
|
-
children: w.map((e) => /* @__PURE__ */ y(
|
|
2628
|
+
children: w.map((e) => /* @__PURE__ */ y(Ta, {
|
|
2606
2629
|
item: e,
|
|
2607
2630
|
motionProps: S,
|
|
2608
2631
|
transition: x
|
|
@@ -2631,7 +2654,7 @@ var ma = (e, t, n) => {
|
|
|
2631
2654
|
className: P(W["bsy-lexical__toolbar-overflow-row"], ee && W["bsy-lexical__toolbar-overflow-row--open"], i && W["bsy-lexical__toolbar-overflow-row--instant"]),
|
|
2632
2655
|
children: /* @__PURE__ */ y("div", {
|
|
2633
2656
|
className: W["bsy-lexical__toolbar-overflow-inner"],
|
|
2634
|
-
children: N.map((e) => /* @__PURE__ */ y(
|
|
2657
|
+
children: N.map((e) => /* @__PURE__ */ y(Ta, {
|
|
2635
2658
|
item: e,
|
|
2636
2659
|
motionProps: {},
|
|
2637
2660
|
transition: x
|
|
@@ -2639,7 +2662,7 @@ var ma = (e, t, n) => {
|
|
|
2639
2662
|
})
|
|
2640
2663
|
}) : null]
|
|
2641
2664
|
});
|
|
2642
|
-
},
|
|
2665
|
+
}, Da = (e) => {
|
|
2643
2666
|
let { config: t = [], style: n, theme: r, mode: i, floating: a, stickyOffset: o, size: s = sn } = e, { toolbarRef: c } = mr(), l = i === "floating", u = o !== void 0, d = ce(), f = {
|
|
2644
2667
|
duration: d ? 0 : .16,
|
|
2645
2668
|
ease: "easeOut"
|
|
@@ -2667,7 +2690,7 @@ var ma = (e, t, n) => {
|
|
|
2667
2690
|
...h,
|
|
2668
2691
|
..._
|
|
2669
2692
|
},
|
|
2670
|
-
children: /* @__PURE__ */ y(
|
|
2693
|
+
children: /* @__PURE__ */ y(Ea, {
|
|
2671
2694
|
config: t,
|
|
2672
2695
|
sizeToken: `${s}|${r?.itemHeight ?? ""}|${r?.iconSize ?? ""}`
|
|
2673
2696
|
})
|
|
@@ -2683,12 +2706,12 @@ var ma = (e, t, n) => {
|
|
|
2683
2706
|
"bsy-lexical-editor__content-editable": "_bsy-lexical-editor__content-editable_1l05x_28",
|
|
2684
2707
|
"bsy-lexical-editor__length-badge": "_bsy-lexical-editor__length-badge_1l05x_41",
|
|
2685
2708
|
"bsy-lexical-editor__length-badge--exceeded": "_bsy-lexical-editor__length-badge--exceeded_1l05x_53"
|
|
2686
|
-
},
|
|
2709
|
+
}, Oa = (e) => {
|
|
2687
2710
|
if (!(e === void 0 || e === "")) return typeof e == "number" ? `${e}px` : e;
|
|
2688
|
-
},
|
|
2711
|
+
}, ka = (e) => {
|
|
2689
2712
|
let t = {};
|
|
2690
|
-
return e ? (s(t, "--bsy-editor-container-border-color", e.borderColor), s(t, "--bsy-editor-container-border-width",
|
|
2691
|
-
},
|
|
2713
|
+
return e ? (s(t, "--bsy-editor-container-border-color", e.borderColor), s(t, "--bsy-editor-container-border-width", Oa(e.borderWidth)), s(t, "--bsy-editor-container-border-radius", Oa(e.borderRadius)), t) : t;
|
|
2714
|
+
}, Aa = class e extends rt {
|
|
2692
2715
|
constructor(e, t) {
|
|
2693
2716
|
super(e, t);
|
|
2694
2717
|
}
|
|
@@ -2703,42 +2726,42 @@ var ma = (e, t, n) => {
|
|
|
2703
2726
|
return {
|
|
2704
2727
|
...e,
|
|
2705
2728
|
code: () => ({
|
|
2706
|
-
conversion:
|
|
2729
|
+
conversion: Ma(e?.code),
|
|
2707
2730
|
priority: 1
|
|
2708
2731
|
}),
|
|
2709
2732
|
em: () => ({
|
|
2710
|
-
conversion:
|
|
2733
|
+
conversion: Ma(e?.em),
|
|
2711
2734
|
priority: 1
|
|
2712
2735
|
}),
|
|
2713
2736
|
span: () => ({
|
|
2714
|
-
conversion:
|
|
2737
|
+
conversion: Ma(e?.span),
|
|
2715
2738
|
priority: 1
|
|
2716
2739
|
}),
|
|
2717
2740
|
strong: () => ({
|
|
2718
|
-
conversion:
|
|
2741
|
+
conversion: Ma(e?.strong),
|
|
2719
2742
|
priority: 1
|
|
2720
2743
|
}),
|
|
2721
2744
|
sub: () => ({
|
|
2722
|
-
conversion:
|
|
2745
|
+
conversion: Ma(e?.sub),
|
|
2723
2746
|
priority: 1
|
|
2724
2747
|
}),
|
|
2725
2748
|
sup: () => ({
|
|
2726
|
-
conversion:
|
|
2749
|
+
conversion: Ma(e?.sup),
|
|
2727
2750
|
priority: 1
|
|
2728
2751
|
})
|
|
2729
2752
|
};
|
|
2730
2753
|
}
|
|
2731
2754
|
static importJSON(e) {
|
|
2732
|
-
return
|
|
2755
|
+
return ja().updateFromJSON(e);
|
|
2733
2756
|
}
|
|
2734
2757
|
isSimpleText() {
|
|
2735
2758
|
return this.__type === "extended-text" && this.__mode === 0;
|
|
2736
2759
|
}
|
|
2737
2760
|
};
|
|
2738
|
-
function
|
|
2739
|
-
return ve(new
|
|
2761
|
+
function ja(e = "") {
|
|
2762
|
+
return ve(new Aa(e));
|
|
2740
2763
|
}
|
|
2741
|
-
function
|
|
2764
|
+
function Ma(e) {
|
|
2742
2765
|
return (t) => {
|
|
2743
2766
|
let n = e?.(t);
|
|
2744
2767
|
if (!n) return null;
|
|
@@ -2767,38 +2790,38 @@ function Ea(e) {
|
|
|
2767
2790
|
}
|
|
2768
2791
|
//#endregion
|
|
2769
2792
|
//#region src/components/Editor/utils/stripInlineStyleProperty.ts
|
|
2770
|
-
function
|
|
2793
|
+
function Na(e, t) {
|
|
2771
2794
|
return e.split(";").map((e) => e.trim()).filter((e) => e && e.split(":")[0].trim().toLowerCase() !== t).join("; ");
|
|
2772
2795
|
}
|
|
2773
2796
|
//#endregion
|
|
2774
2797
|
//#region src/components/Editor/plugins/LinkColorPlugin.tsx
|
|
2775
|
-
function
|
|
2798
|
+
function Pa(e) {
|
|
2776
2799
|
if (!B(e, ut)) return;
|
|
2777
2800
|
let t = e.getStyle();
|
|
2778
2801
|
if (!t) return;
|
|
2779
|
-
let n =
|
|
2802
|
+
let n = Na(t, "color");
|
|
2780
2803
|
n !== t && e.setStyle(n);
|
|
2781
2804
|
}
|
|
2782
|
-
function
|
|
2805
|
+
function Fa() {
|
|
2783
2806
|
let [e] = R();
|
|
2784
|
-
return O(() => e.registerNodeTransform(
|
|
2807
|
+
return O(() => e.registerNodeTransform(Aa, Pa), [e]), null;
|
|
2785
2808
|
}
|
|
2786
2809
|
//#endregion
|
|
2787
2810
|
//#region src/components/Editor/plugins/ImagePlugin.tsx
|
|
2788
|
-
function
|
|
2811
|
+
function Ia() {
|
|
2789
2812
|
let [e] = R();
|
|
2790
2813
|
return O(() => e.registerCommand(Er, (e) => (Ee([rn(e)]), !0), Be), [e]), null;
|
|
2791
2814
|
}
|
|
2792
2815
|
//#endregion
|
|
2793
2816
|
//#region src/components/Editor/utils/stripImagesFromHtml.ts
|
|
2794
|
-
function
|
|
2817
|
+
function La(e) {
|
|
2795
2818
|
let t = new DOMParser().parseFromString(e, "text/html");
|
|
2796
2819
|
return t.querySelectorAll("img, picture").forEach((e) => e.remove()), t.body.innerHTML;
|
|
2797
2820
|
}
|
|
2798
2821
|
//#endregion
|
|
2799
2822
|
//#region src/components/Editor/plugins/PasteStripImagePlugin.tsx
|
|
2800
|
-
var
|
|
2801
|
-
function
|
|
2823
|
+
var Ra = /<img\b|<picture\b/i;
|
|
2824
|
+
function za() {
|
|
2802
2825
|
let [e] = R(), { isSourceModeRef: t } = Hr();
|
|
2803
2826
|
return O(() => {
|
|
2804
2827
|
let n = (n) => {
|
|
@@ -2806,13 +2829,13 @@ function Na() {
|
|
|
2806
2829
|
let r = "clipboardData" in n ? n.clipboardData : "dataTransfer" in n ? n.dataTransfer : null;
|
|
2807
2830
|
if (!r || r.getData("application/x-lexical-editor") || r.getData("application/x-lexical-drag")) return !1;
|
|
2808
2831
|
let i = r.getData("text/html");
|
|
2809
|
-
if (!(Array.from(r.files).some((e) => e.type.startsWith("image/")) || Array.from(r.items).some((e) => e.type.startsWith("image/")) ||
|
|
2832
|
+
if (!(Array.from(r.files).some((e) => e.type.startsWith("image/")) || Array.from(r.items).some((e) => e.type.startsWith("image/")) || Ra.test(i))) return !1;
|
|
2810
2833
|
n.preventDefault();
|
|
2811
2834
|
let a = r.getData("text/plain");
|
|
2812
|
-
return !
|
|
2835
|
+
return !Ra.test(i) && !a || e.update(() => {
|
|
2813
2836
|
let t = I();
|
|
2814
2837
|
if (t === null) return;
|
|
2815
|
-
let n = i ?
|
|
2838
|
+
let n = i ? La(i) : "", r = document.createElement("div");
|
|
2816
2839
|
if (r.innerHTML = n, n && r.textContent?.trim()) {
|
|
2817
2840
|
let t = _e(e, new DOMParser().parseFromString(n, "text/html"));
|
|
2818
2841
|
if (t.length) {
|
|
@@ -2828,7 +2851,7 @@ function Na() {
|
|
|
2828
2851
|
}
|
|
2829
2852
|
//#endregion
|
|
2830
2853
|
//#region src/components/Editor/plugins/EnterKeyPlugin.tsx
|
|
2831
|
-
function
|
|
2854
|
+
function Ba() {
|
|
2832
2855
|
let [e] = R(), t = j(0);
|
|
2833
2856
|
return O(() => e.registerCommand(Xe, (n) => {
|
|
2834
2857
|
let r = Date.now(), i = r - t.current;
|
|
@@ -2858,7 +2881,7 @@ function Pa() {
|
|
|
2858
2881
|
}
|
|
2859
2882
|
//#endregion
|
|
2860
2883
|
//#region src/components/Editor/utils/codeHighlighter.ts
|
|
2861
|
-
var
|
|
2884
|
+
var Va = {
|
|
2862
2885
|
css: () => import("@shikijs/langs/css"),
|
|
2863
2886
|
html: () => import("@shikijs/langs/html"),
|
|
2864
2887
|
xml: () => import("@shikijs/langs/xml"),
|
|
@@ -2879,36 +2902,36 @@ var Fa = {
|
|
|
2879
2902
|
bash: () => import("@shikijs/langs/shellscript"),
|
|
2880
2903
|
lua: () => import("@shikijs/langs/lua"),
|
|
2881
2904
|
markdown: () => import("@shikijs/langs/markdown")
|
|
2882
|
-
},
|
|
2905
|
+
}, Ha = (e) => e === "bash" ? "shellscript" : e, Ua = (e) => e in Va, Wa = null, Ga = null, Ka = /* @__PURE__ */ new Map(), qa = () => (Wa ||= Promise.all([import("@shikijs/core"), import("@shikijs/engine-javascript")]).then(([{ createHighlighterCoreSync: e }, { createJavaScriptRegexEngine: t }]) => e({
|
|
2883
2906
|
engine: t(),
|
|
2884
2907
|
langs: [],
|
|
2885
2908
|
themes: []
|
|
2886
2909
|
})).catch((e) => {
|
|
2887
|
-
throw
|
|
2888
|
-
}),
|
|
2889
|
-
let t =
|
|
2890
|
-
return t || (t =
|
|
2891
|
-
let n =
|
|
2910
|
+
throw Wa = null, e;
|
|
2911
|
+
}), Wa), Ja = (e, t) => Ua(t) && e.getLoadedLanguages().includes(Ha(t)), Ya = (e) => {
|
|
2912
|
+
let t = Ka.get(e);
|
|
2913
|
+
return t || (t = qa().then(async (t) => {
|
|
2914
|
+
let n = Ha(e);
|
|
2892
2915
|
if (!t.getLoadedLanguages().includes(n)) {
|
|
2893
|
-
let n = await
|
|
2916
|
+
let n = await Va[e]();
|
|
2894
2917
|
await t.loadLanguage(n.default);
|
|
2895
2918
|
}
|
|
2896
2919
|
return t;
|
|
2897
2920
|
}).catch((t) => {
|
|
2898
|
-
throw
|
|
2899
|
-
}),
|
|
2900
|
-
},
|
|
2921
|
+
throw Ka.delete(e), t;
|
|
2922
|
+
}), Ka.set(e, t)), t;
|
|
2923
|
+
}, Xa = () => (Ga ||= qa().then(async (e) => {
|
|
2901
2924
|
if (!e.getLoadedThemes().includes("github-light")) {
|
|
2902
2925
|
let t = await import("@shikijs/themes/github-light");
|
|
2903
2926
|
await e.loadTheme(t.default);
|
|
2904
2927
|
}
|
|
2905
2928
|
return e;
|
|
2906
2929
|
}).catch((e) => {
|
|
2907
|
-
throw
|
|
2908
|
-
}),
|
|
2930
|
+
throw Ga = null, e;
|
|
2931
|
+
}), Ga), Za = (e, t, n) => {
|
|
2909
2932
|
let r = e.getTextContent();
|
|
2910
|
-
if (e.getStyle() && e.setStyle(""), !n || !
|
|
2911
|
-
let i =
|
|
2933
|
+
if (e.getStyle() && e.setStyle(""), !n || !Ja(n, t)) return Tt(r);
|
|
2934
|
+
let i = Ha(t), a = n.codeToTokens(r, {
|
|
2912
2935
|
lang: i,
|
|
2913
2936
|
theme: Sn
|
|
2914
2937
|
}), o = [];
|
|
@@ -2921,7 +2944,7 @@ var Fa = {
|
|
|
2921
2944
|
});
|
|
2922
2945
|
});
|
|
2923
2946
|
}), o;
|
|
2924
|
-
},
|
|
2947
|
+
}, Qa = (e, t) => {
|
|
2925
2948
|
let n = we(e);
|
|
2926
2949
|
if (!z(n) || !n.isAttached()) return;
|
|
2927
2950
|
let r = I();
|
|
@@ -2950,11 +2973,11 @@ var Fa = {
|
|
|
2950
2973
|
return !1;
|
|
2951
2974
|
});
|
|
2952
2975
|
}
|
|
2953
|
-
},
|
|
2976
|
+
}, $a = (e, t) => wt(e) && wt(t) && e.__text === t.__text && e.__highlightType === t.__highlightType && e.__style === t.__style || Ae(e) && Ae(t) || Oe(e) && Oe(t), eo = (e, t) => {
|
|
2954
2977
|
let n = 0;
|
|
2955
|
-
for (; n < e.length &&
|
|
2978
|
+
for (; n < e.length && $a(e[n], t[n]);) n++;
|
|
2956
2979
|
let r = e.length, i = t.length, a = Math.min(r, i) - n, o = 0;
|
|
2957
|
-
for (; o < a;) if (o++,
|
|
2980
|
+
for (; o < a;) if (o++, !$a(e[r - o], t[i - o])) {
|
|
2958
2981
|
o--;
|
|
2959
2982
|
break;
|
|
2960
2983
|
}
|
|
@@ -2963,12 +2986,12 @@ var Fa = {
|
|
|
2963
2986
|
to: r - o,
|
|
2964
2987
|
nodesForReplacement: t.slice(n, i - o)
|
|
2965
2988
|
};
|
|
2966
|
-
},
|
|
2989
|
+
}, to = (e, t, n, r, i) => {
|
|
2967
2990
|
let a = i.getKey(), o = Tn(i.getLanguage());
|
|
2968
2991
|
if (i.getLanguage() !== o && i.setLanguage(o), o === "plaintext") i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1);
|
|
2969
2992
|
else {
|
|
2970
2993
|
i.getTheme() !== "github-light" && i.setTheme(Sn);
|
|
2971
|
-
let s = t ? t.getLoadedThemes().includes("github-light") ?
|
|
2994
|
+
let s = t ? t.getLoadedThemes().includes("github-light") ? Ua(o) && !Ja(t, o) ? Ya(o) : null : Xa() : qa();
|
|
2972
2995
|
if (s) {
|
|
2973
2996
|
i.getIsSyntaxHighlightSupported() && i.setIsSyntaxHighlightSupported(!1), n.pendingKeys.add(a), n.loading !== s && (n.loading = s, s.then((t) => {
|
|
2974
2997
|
r(t);
|
|
@@ -2987,17 +3010,17 @@ var Fa = {
|
|
|
2987
3010
|
}
|
|
2988
3011
|
n.nodesCurrentlyHighlighting.has(a) || (n.nodesCurrentlyHighlighting.add(a), n.didTransform || (n.didTransform = !0, Ne(() => {
|
|
2989
3012
|
n.didTransform = !1, n.nodesCurrentlyHighlighting.clear();
|
|
2990
|
-
})),
|
|
3013
|
+
})), Qa(a, () => {
|
|
2991
3014
|
let e = we(a);
|
|
2992
3015
|
if (!z(e) || !e.isAttached()) return !1;
|
|
2993
|
-
let n =
|
|
3016
|
+
let n = Za(e, Tn(e.getLanguage()), t), { from: r, to: i, nodesForReplacement: o } = eo(e.getChildren(), n);
|
|
2994
3017
|
return r !== i || o.length ? (e.splice(r, i - r, o), !0) : !1;
|
|
2995
3018
|
}));
|
|
2996
|
-
},
|
|
3019
|
+
}, no = (e, t, n, r, i) => {
|
|
2997
3020
|
let a = i.getParent();
|
|
2998
|
-
z(a) ?
|
|
3021
|
+
z(a) ? to(e, t, n, r, a) : wt(i) && i.replace(Se(i.__text));
|
|
2999
3022
|
};
|
|
3000
|
-
function
|
|
3023
|
+
function ro() {
|
|
3001
3024
|
let [e] = R();
|
|
3002
3025
|
return O(() => {
|
|
3003
3026
|
if (!e.hasNodes([Dt, Et])) throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");
|
|
@@ -3041,11 +3064,11 @@ function Za() {
|
|
|
3041
3064
|
t?.removeEventListener("mousedown", c, !0), t?.removeEventListener("mouseup", u, !0), t?.removeEventListener("dblclick", l, !0), e?.addEventListener("mousedown", c, !0), e?.addEventListener("mouseup", u, !0), e?.addEventListener("dblclick", l, !0);
|
|
3042
3065
|
};
|
|
3043
3066
|
return st(Ot(e), e.registerNodeTransform(Dt, (i) => {
|
|
3044
|
-
|
|
3067
|
+
to(e, t, n, r, i);
|
|
3045
3068
|
}), e.registerNodeTransform(rt, (i) => {
|
|
3046
|
-
|
|
3069
|
+
no(e, t, n, r, i);
|
|
3047
3070
|
}), e.registerNodeTransform(Et, (i) => {
|
|
3048
|
-
|
|
3071
|
+
no(e, t, n, r, i);
|
|
3049
3072
|
}), e.registerRootListener(d), () => {
|
|
3050
3073
|
d(null, e.getRootElement());
|
|
3051
3074
|
});
|
|
@@ -3053,7 +3076,7 @@ function Za() {
|
|
|
3053
3076
|
}
|
|
3054
3077
|
//#endregion
|
|
3055
3078
|
//#region src/components/Editor/plugins/TablePlugin.tsx
|
|
3056
|
-
function
|
|
3079
|
+
function io() {
|
|
3057
3080
|
let [e] = R();
|
|
3058
3081
|
return O(() => (Gt(e, !0), Xt(Ut(e), Wt(e, !1), Ht(e), e.registerNodeTransform(zt, (e) => {
|
|
3059
3082
|
e.getBackgroundColor() !== null && e.setBackgroundColor(null);
|
|
@@ -3087,8 +3110,8 @@ function Qa() {
|
|
|
3087
3110
|
}
|
|
3088
3111
|
//#endregion
|
|
3089
3112
|
//#region src/components/Editor/plugins/TabIndentPlugin.tsx
|
|
3090
|
-
var
|
|
3091
|
-
function
|
|
3113
|
+
var ao = "\xA0".repeat(4);
|
|
3114
|
+
function oo() {
|
|
3092
3115
|
let [e] = R();
|
|
3093
3116
|
return O(() => e.registerCommand(Ze, (t) => {
|
|
3094
3117
|
if (t.shiftKey) return !1;
|
|
@@ -3108,12 +3131,12 @@ function eo() {
|
|
|
3108
3131
|
return !0;
|
|
3109
3132
|
}
|
|
3110
3133
|
let a = r.getTopLevelElement(), o = n.focus.getNode().getTopLevelElement();
|
|
3111
|
-
return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(Ye, void 0) : (n.insertText(
|
|
3134
|
+
return !n.isCollapsed() && a && o && a !== o ? e.dispatchCommand(Ye, void 0) : (n.insertText(ao), !0);
|
|
3112
3135
|
}, Be), [e]), null;
|
|
3113
3136
|
}
|
|
3114
3137
|
//#endregion
|
|
3115
3138
|
//#region src/components/Editor/plugins/MaxLengthPlugin.tsx
|
|
3116
|
-
function
|
|
3139
|
+
function so({ maxLength: e, onMaxLengthExceed: t }) {
|
|
3117
3140
|
let [n] = R(), { isSourceModeRef: r } = Hr(), i = j(t);
|
|
3118
3141
|
return i.current = t, O(() => {
|
|
3119
3142
|
let t = null;
|
|
@@ -3142,18 +3165,18 @@ function to({ maxLength: e, onMaxLengthExceed: t }) {
|
|
|
3142
3165
|
}
|
|
3143
3166
|
//#endregion
|
|
3144
3167
|
//#region src/components/Editor/utils/textLength.ts
|
|
3145
|
-
function
|
|
3168
|
+
function co(e) {
|
|
3146
3169
|
return typeof e == "number" && Number.isFinite(e) && e > 0;
|
|
3147
3170
|
}
|
|
3148
|
-
function
|
|
3171
|
+
function lo(e, t) {
|
|
3149
3172
|
let n = F(), r = n.getTextContentSize();
|
|
3150
3173
|
if (r <= t) return !1;
|
|
3151
3174
|
let i = r - t;
|
|
3152
3175
|
n.selectEnd();
|
|
3153
3176
|
let a = I();
|
|
3154
|
-
return L(a) ? Mt(e, a.anchor, i) :
|
|
3177
|
+
return L(a) ? Mt(e, a.anchor, i) : uo(i), !0;
|
|
3155
3178
|
}
|
|
3156
|
-
function
|
|
3179
|
+
function uo(e) {
|
|
3157
3180
|
let t = e, n = F().getAllTextNodes();
|
|
3158
3181
|
for (let e = n.length - 1; e >= 0 && t > 0; e--) {
|
|
3159
3182
|
let r = n[e], i = r.getTextContent();
|
|
@@ -3162,7 +3185,7 @@ function io(e) {
|
|
|
3162
3185
|
}
|
|
3163
3186
|
//#endregion
|
|
3164
3187
|
//#region src/components/Editor/utils/formatEditorHtml.ts
|
|
3165
|
-
var
|
|
3188
|
+
var fo = new Set([
|
|
3166
3189
|
"area",
|
|
3167
3190
|
"base",
|
|
3168
3191
|
"br",
|
|
@@ -3177,37 +3200,37 @@ var ao = new Set([
|
|
|
3177
3200
|
"source",
|
|
3178
3201
|
"track",
|
|
3179
3202
|
"wbr"
|
|
3180
|
-
]),
|
|
3181
|
-
let r = e.tagName.toLowerCase(), i = `<${r}${
|
|
3182
|
-
if (
|
|
3183
|
-
let a = n || r === "pre", o =
|
|
3184
|
-
return a || !
|
|
3185
|
-
},
|
|
3203
|
+
]), po = new Set(/* @__PURE__ */ "address.article.aside.blockquote.div.dl.dt.dd.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hr.li.main.nav.ol.p.pre.section.table.tbody.td.tfoot.th.thead.tr.ul".split(".")), mo = 80, ho = (e) => e.replace(/&/g, "&").replace(/"/g, """), go = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), _o = (e) => Array.from(e.attributes).map((e) => ` ${e.name}="${ho(e.value)}"`).join(""), vo = (e) => " ".repeat(e), yo = (e, t, n) => {
|
|
3204
|
+
let r = e.tagName.toLowerCase(), i = `<${r}${_o(e)}>`;
|
|
3205
|
+
if (fo.has(r)) return i;
|
|
3206
|
+
let a = n || r === "pre", o = bo(e, t + 1, a), s = `</${r}>`;
|
|
3207
|
+
return a || !po.has(r) ? `${i}${o}${s}` : Array.from(e.children).some((e) => po.has(e.tagName.toLowerCase())) ? `${i}\n${bo(e, t + 1, !1, !0)}\n${vo(t)}${s}` : i.length + o.length + s.length > mo ? `${i}\n${vo(t + 1)}${o}\n${vo(t)}${s}` : `${i}${o}${s}`;
|
|
3208
|
+
}, bo = (e, t, n, r = !1) => {
|
|
3186
3209
|
let i = [];
|
|
3187
3210
|
for (let r of Array.from(e.childNodes)) {
|
|
3188
3211
|
if (r.nodeType === Node.TEXT_NODE) {
|
|
3189
3212
|
let e = r.textContent ?? "";
|
|
3190
3213
|
if (n) {
|
|
3191
|
-
i.push(
|
|
3214
|
+
i.push(go(e));
|
|
3192
3215
|
continue;
|
|
3193
3216
|
}
|
|
3194
|
-
e.trim() && i.push(
|
|
3217
|
+
e.trim() && i.push(go(e));
|
|
3195
3218
|
continue;
|
|
3196
3219
|
}
|
|
3197
3220
|
if (r.nodeType === Node.COMMENT_NODE) {
|
|
3198
3221
|
i.push(`<!--${r.data}-->`);
|
|
3199
3222
|
continue;
|
|
3200
3223
|
}
|
|
3201
|
-
r.nodeType === Node.ELEMENT_NODE && i.push(
|
|
3224
|
+
r.nodeType === Node.ELEMENT_NODE && i.push(yo(r, t, n));
|
|
3202
3225
|
}
|
|
3203
|
-
return n || !r ? i.join("") : i.map((e) => `${
|
|
3226
|
+
return n || !r ? i.join("") : i.map((e) => `${vo(t)}${e}`).join("\n");
|
|
3204
3227
|
};
|
|
3205
|
-
function
|
|
3206
|
-
return e.trim() ?
|
|
3228
|
+
function xo(e) {
|
|
3229
|
+
return e.trim() ? bo(new DOMParser().parseFromString(Yi(e), "text/html").body, 0, !1, !0).trimEnd() : e;
|
|
3207
3230
|
}
|
|
3208
3231
|
//#endregion
|
|
3209
3232
|
//#region src/components/Editor/utils/writeHtmlSource.ts
|
|
3210
|
-
function
|
|
3233
|
+
function So(e) {
|
|
3211
3234
|
F().clear();
|
|
3212
3235
|
let t = Ct("html");
|
|
3213
3236
|
if (F().append(t), !e) return;
|
|
@@ -3217,24 +3240,24 @@ function go(e) {
|
|
|
3217
3240
|
}
|
|
3218
3241
|
//#endregion
|
|
3219
3242
|
//#region src/components/Editor/plugins/SourceModePlugin.tsx
|
|
3220
|
-
function
|
|
3243
|
+
function Co({ children: e, maxLength: t, onMaxLengthExceed: n }) {
|
|
3221
3244
|
let [r] = R(), [i, a] = M(!1), o = j(!1), s = j(n);
|
|
3222
3245
|
s.current = n;
|
|
3223
|
-
let c =
|
|
3246
|
+
let c = co(t) ? t : void 0, l = T(() => {
|
|
3224
3247
|
if (o.current) return;
|
|
3225
3248
|
let e = "", t = "";
|
|
3226
3249
|
r.getEditorState().read(() => {
|
|
3227
3250
|
t = F().getTextContent(), e = ge(r, null);
|
|
3228
3251
|
}, { editor: r });
|
|
3229
|
-
let n =
|
|
3252
|
+
let n = xi(e, t) ? "" : X(e);
|
|
3230
3253
|
o.current = !0, a(!0), r.update(() => {
|
|
3231
|
-
|
|
3254
|
+
So(xo(n));
|
|
3232
3255
|
}), r.dispatchCommand(Re, void 0);
|
|
3233
3256
|
}, [r]), u = T(() => {
|
|
3234
3257
|
if (!o.current) return;
|
|
3235
3258
|
let e = !1;
|
|
3236
3259
|
o.current = !1, r.update(() => {
|
|
3237
|
-
|
|
3260
|
+
bi(r, X(F().getTextContent())), c !== void 0 && (e = lo(r, c)), Dn(!0);
|
|
3238
3261
|
}), a(!1), r.dispatchCommand(Re, void 0), e && s.current?.();
|
|
3239
3262
|
}, [r, c]), d = T(() => {
|
|
3240
3263
|
if (o.current) {
|
|
@@ -3260,7 +3283,7 @@ function _o({ children: e, maxLength: t, onMaxLengthExceed: n }) {
|
|
|
3260
3283
|
return Xt(r.registerNodeTransform(nt, () => {
|
|
3261
3284
|
if (!o.current) return;
|
|
3262
3285
|
let e = F(), t = e.getChildrenSize() === 1 ? e.getFirstChild() : null;
|
|
3263
|
-
z(t) && t.getLanguage() === "html" ||
|
|
3286
|
+
z(t) && t.getLanguage() === "html" || So(e.getTextContent());
|
|
3264
3287
|
}), r.registerCommand($e, e, ze), r.registerCommand(Ue, e, ze));
|
|
3265
3288
|
}, [r]);
|
|
3266
3289
|
let f = A(() => ({
|
|
@@ -3275,7 +3298,7 @@ function _o({ children: e, maxLength: t, onMaxLengthExceed: n }) {
|
|
|
3275
3298
|
}
|
|
3276
3299
|
//#endregion
|
|
3277
3300
|
//#region src/components/Editor/plugins/HeadingPlugin.tsx
|
|
3278
|
-
function
|
|
3301
|
+
function wo(e) {
|
|
3279
3302
|
let t = e.getTag();
|
|
3280
3303
|
if (t === "h4" || t === "h5" || t === "h6") {
|
|
3281
3304
|
e.replace(be(), !0);
|
|
@@ -3284,17 +3307,17 @@ function vo(e) {
|
|
|
3284
3307
|
for (let t of e.getAllTextNodes()) {
|
|
3285
3308
|
let e = t.getStyle();
|
|
3286
3309
|
if (!e) continue;
|
|
3287
|
-
let n =
|
|
3310
|
+
let n = Na(e, "font-size");
|
|
3288
3311
|
n !== e && t.setStyle(n);
|
|
3289
3312
|
}
|
|
3290
3313
|
}
|
|
3291
|
-
function
|
|
3314
|
+
function To() {
|
|
3292
3315
|
let [e] = R();
|
|
3293
|
-
return O(() => e.registerNodeTransform(Jt,
|
|
3316
|
+
return O(() => e.registerNodeTransform(Jt, wo), [e]), null;
|
|
3294
3317
|
}
|
|
3295
3318
|
//#endregion
|
|
3296
3319
|
//#region src/components/Editor/LengthBadge.tsx
|
|
3297
|
-
var
|
|
3320
|
+
var Eo = ({ current: e, maxLength: t }) => {
|
|
3298
3321
|
let n = e > t;
|
|
3299
3322
|
return /* @__PURE__ */ b("div", {
|
|
3300
3323
|
className: P($["bsy-lexical-editor__length-badge"], n && $["bsy-lexical-editor__length-badge--exceeded"]),
|
|
@@ -3306,33 +3329,33 @@ var bo = ({ current: e, maxLength: t }) => {
|
|
|
3306
3329
|
]
|
|
3307
3330
|
});
|
|
3308
3331
|
};
|
|
3309
|
-
|
|
3332
|
+
Eo.displayName = "BsyLexicalEditorLengthBadge";
|
|
3310
3333
|
//#endregion
|
|
3311
3334
|
//#region src/components/Editor/utils/unwrapTypesetFence.ts
|
|
3312
|
-
var
|
|
3335
|
+
var Do = /^\uFEFF/, Oo = /^ {0,3}`{1,3}[A-Za-z]*$/, ko = /^( {0,3})([^`<]*?)```[ \t]*([A-Za-z0-9_-]*)[ \t]*(.*)$/, Ao = /^ {0,3}```[ \t]*$/, jo = /<\/?[a-zA-Z]/, Mo = /<[a-zA-Z!]/, No = (e) => Mo.test(e), Po = (e) => jo.test(e), Fo = (e) => e.replace(Do, "").replace(/\r\n/g, "\n"), Io = (e) => {
|
|
3313
3336
|
let t = e.replace(/\n+$/, ""), n = t.lastIndexOf("\n"), r = n === -1 ? t : t.slice(n + 1);
|
|
3314
|
-
return
|
|
3337
|
+
return Oo.test(r) ? {
|
|
3315
3338
|
text: n === -1 ? "" : t.slice(0, n),
|
|
3316
3339
|
withheld: !0
|
|
3317
3340
|
} : {
|
|
3318
3341
|
text: e,
|
|
3319
3342
|
withheld: !1
|
|
3320
3343
|
};
|
|
3321
|
-
},
|
|
3322
|
-
let t =
|
|
3344
|
+
}, Lo = (e) => {
|
|
3345
|
+
let t = ko.exec(e);
|
|
3323
3346
|
return t ? { sameLineBody: t[4] ?? "" } : null;
|
|
3324
|
-
},
|
|
3347
|
+
}, Ro = (e) => {
|
|
3325
3348
|
let t = e.replace(/[ \t]*```[ \t]*$/, "");
|
|
3326
3349
|
return t === e ? e : t;
|
|
3327
|
-
},
|
|
3350
|
+
}, zo = (e) => No(e) ? e.replace(/^\n/, "") : "", Bo = (e) => {
|
|
3328
3351
|
let t = e.split("\n"), n = [], r = 0;
|
|
3329
3352
|
for (; r < t.length;) {
|
|
3330
|
-
let e = t[r], i =
|
|
3353
|
+
let e = t[r], i = Lo(e);
|
|
3331
3354
|
if (i) {
|
|
3332
3355
|
let e = i.sameLineBody;
|
|
3333
|
-
if (e !==
|
|
3334
|
-
e =
|
|
3335
|
-
let i =
|
|
3356
|
+
if (e !== Ro(e)) {
|
|
3357
|
+
e = Ro(e);
|
|
3358
|
+
let i = zo(t.slice(r + 1).join("\n"));
|
|
3336
3359
|
return [
|
|
3337
3360
|
...n,
|
|
3338
3361
|
e,
|
|
@@ -3340,38 +3363,38 @@ var xo = /^\uFEFF/, So = /^ {0,3}`{1,3}[A-Za-z]*$/, Co = /^( {0,3})([^`<]*?)```[
|
|
|
3340
3363
|
].filter(Boolean).join("\n");
|
|
3341
3364
|
}
|
|
3342
3365
|
let a = [];
|
|
3343
|
-
for (e && a.push(e), r += 1; r < t.length && !
|
|
3344
|
-
let o = r < t.length ?
|
|
3366
|
+
for (e && a.push(e), r += 1; r < t.length && !Ao.test(t[r]);) a.push(t[r]), r += 1;
|
|
3367
|
+
let o = r < t.length ? zo(t.slice(r + 1).join("\n")) : "";
|
|
3345
3368
|
return [
|
|
3346
3369
|
...n,
|
|
3347
3370
|
a.join("\n"),
|
|
3348
3371
|
o
|
|
3349
3372
|
].filter(Boolean).join("\n");
|
|
3350
3373
|
}
|
|
3351
|
-
if (
|
|
3352
|
-
|
|
3374
|
+
if (Po(e)) return Vo([...n, ...t.slice(r)].join("\n"));
|
|
3375
|
+
No(e) && n.push(e), r += 1;
|
|
3353
3376
|
}
|
|
3354
3377
|
return n.length ? n.join("\n") : null;
|
|
3355
|
-
},
|
|
3378
|
+
}, Vo = (e) => {
|
|
3356
3379
|
let t = e.split("\n");
|
|
3357
3380
|
if (!t.length) return e;
|
|
3358
|
-
let n =
|
|
3359
|
-
return n && !
|
|
3381
|
+
let n = Lo(t[0]);
|
|
3382
|
+
return n && !Po(t[0].slice(0, t[0].indexOf("```"))) && (t.shift(), n.sameLineBody && t.unshift(Ro(n.sameLineBody))), t.length && Ao.test(t[t.length - 1] ?? "") && t.pop(), t.join("\n");
|
|
3360
3383
|
};
|
|
3361
|
-
function
|
|
3384
|
+
function Ho(e) {
|
|
3362
3385
|
if (!e) return {
|
|
3363
3386
|
html: "",
|
|
3364
3387
|
pending: !1
|
|
3365
3388
|
};
|
|
3366
|
-
let { text: t, withheld: n } =
|
|
3389
|
+
let { text: t, withheld: n } = Io(Fo(e));
|
|
3367
3390
|
if (!t.trim()) return {
|
|
3368
3391
|
html: "",
|
|
3369
|
-
pending: n ||
|
|
3392
|
+
pending: n || Oo.test(Fo(e).trim())
|
|
3370
3393
|
};
|
|
3371
|
-
let r =
|
|
3394
|
+
let r = Bo(t) ?? t, i = Bo(r);
|
|
3372
3395
|
i !== null && i !== r && (r = i);
|
|
3373
3396
|
let a = r.trim();
|
|
3374
|
-
return
|
|
3397
|
+
return No(a) ? {
|
|
3375
3398
|
html: a,
|
|
3376
3399
|
pending: !1
|
|
3377
3400
|
} : {
|
|
@@ -3381,21 +3404,21 @@ function Io(e) {
|
|
|
3381
3404
|
}
|
|
3382
3405
|
//#endregion
|
|
3383
3406
|
//#region src/components/Editor/utils/prepareTypesetProposed.ts
|
|
3384
|
-
var
|
|
3385
|
-
let { html: n } =
|
|
3407
|
+
var Uo = (e, t) => {
|
|
3408
|
+
let { html: n } = Ho(e);
|
|
3386
3409
|
return n ? li(oi(n, t)) : "";
|
|
3387
3410
|
};
|
|
3388
3411
|
//#endregion
|
|
3389
3412
|
//#region src/components/Editor/utils/applyAiTypeset.ts
|
|
3390
|
-
function
|
|
3391
|
-
let i = X(
|
|
3392
|
-
if (!i.trim() ||
|
|
3413
|
+
function Wo(e, t, n, r) {
|
|
3414
|
+
let i = X(Uo(t, n));
|
|
3415
|
+
if (!i.trim() || xi(i, "")) return {
|
|
3393
3416
|
applied: !1,
|
|
3394
3417
|
truncated: !1
|
|
3395
3418
|
};
|
|
3396
3419
|
let a = !1;
|
|
3397
3420
|
return e.update(() => {
|
|
3398
|
-
|
|
3421
|
+
bi(e, i), co(r) && (a = lo(e, r)), Dn(!0);
|
|
3399
3422
|
}, { discrete: !0 }), {
|
|
3400
3423
|
applied: !0,
|
|
3401
3424
|
truncated: a
|
|
@@ -3403,11 +3426,11 @@ function Ro(e, t, n, r) {
|
|
|
3403
3426
|
}
|
|
3404
3427
|
//#endregion
|
|
3405
3428
|
//#region src/components/Editor/Preview/useAiPreviewHtml.ts
|
|
3406
|
-
var
|
|
3407
|
-
if (!e ||
|
|
3429
|
+
var Go = (e, t) => {
|
|
3430
|
+
if (!e || gi(e)) return e;
|
|
3408
3431
|
let n = X(e);
|
|
3409
|
-
return t === "ready" || t === "error" ?
|
|
3410
|
-
},
|
|
3432
|
+
return t === "ready" || t === "error" ? Yi(n) : n;
|
|
3433
|
+
}, Ko = ({ enabled: e, status: t, revision: n, compute: r }) => {
|
|
3411
3434
|
let [i, a] = M(""), o = j(r);
|
|
3412
3435
|
o.current = r;
|
|
3413
3436
|
let s = j(null);
|
|
@@ -3434,12 +3457,12 @@ var zo = (e, t) => {
|
|
|
3434
3457
|
]), O(() => () => {
|
|
3435
3458
|
s.current !== null && cancelAnimationFrame(s.current);
|
|
3436
3459
|
}, []), i;
|
|
3437
|
-
},
|
|
3460
|
+
}, qo = [
|
|
3438
3461
|
.26,
|
|
3439
3462
|
.02,
|
|
3440
3463
|
.23,
|
|
3441
3464
|
.94
|
|
3442
|
-
],
|
|
3465
|
+
], Jo = () => {
|
|
3443
3466
|
let e = `${ee().replace(/:/g, "")}g`;
|
|
3444
3467
|
return /* @__PURE__ */ y("span", {
|
|
3445
3468
|
className: Q["bsy-lexical-ai__think-icon"],
|
|
@@ -3478,7 +3501,7 @@ var zo = (e, t) => {
|
|
|
3478
3501
|
}) })]
|
|
3479
3502
|
})
|
|
3480
3503
|
});
|
|
3481
|
-
},
|
|
3504
|
+
}, Yo = (e, t) => {
|
|
3482
3505
|
let { t: n } = a(), r = e.status === "loading" && !t, [i, o] = M(!0), [s, c] = M(0), l = j(Date.now()), u = j(null), d = e.reasoning ?? "", f = r || i, p = (r || !!d) && !(e.status === "error" && !d);
|
|
3483
3506
|
return O(() => {
|
|
3484
3507
|
if (!r) {
|
|
@@ -3498,12 +3521,12 @@ var zo = (e, t) => {
|
|
|
3498
3521
|
reasoning: d,
|
|
3499
3522
|
toggle: () => o((e) => !e)
|
|
3500
3523
|
};
|
|
3501
|
-
},
|
|
3524
|
+
}, Xo = ({ model: t }) => t.visible ? /* @__PURE__ */ b("button", {
|
|
3502
3525
|
type: "button",
|
|
3503
3526
|
className: Q["bsy-lexical-ai__think-head"],
|
|
3504
3527
|
disabled: t.thinking,
|
|
3505
3528
|
onClick: t.toggle,
|
|
3506
|
-
children: [t.thinking ? /* @__PURE__ */ y(
|
|
3529
|
+
children: [t.thinking ? /* @__PURE__ */ y(Jo, {}) : /* @__PURE__ */ y(e, {
|
|
3507
3530
|
name: "arrow-down",
|
|
3508
3531
|
size: 12,
|
|
3509
3532
|
className: P(Q["bsy-lexical-ai__think-arrow"], t.open && Q["bsy-lexical-ai__think-arrow--open"])
|
|
@@ -3527,7 +3550,7 @@ var zo = (e, t) => {
|
|
|
3527
3550
|
},
|
|
3528
3551
|
transition: {
|
|
3529
3552
|
duration: .22,
|
|
3530
|
-
ease:
|
|
3553
|
+
ease: qo
|
|
3531
3554
|
},
|
|
3532
3555
|
children: /* @__PURE__ */ y("span", {
|
|
3533
3556
|
className: t.thinking ? Q["bsy-lexical-ai__think-label--shimmer"] : void 0,
|
|
@@ -3536,7 +3559,7 @@ var zo = (e, t) => {
|
|
|
3536
3559
|
}, t.label)
|
|
3537
3560
|
})
|
|
3538
3561
|
})]
|
|
3539
|
-
}) : null,
|
|
3562
|
+
}) : null, Zo = ({ model: e }) => {
|
|
3540
3563
|
let [t, n] = M(!0), r = D(e.reasoning);
|
|
3541
3564
|
if (O(() => {
|
|
3542
3565
|
e.open || n(!0);
|
|
@@ -3578,7 +3601,7 @@ var zo = (e, t) => {
|
|
|
3578
3601
|
children: i
|
|
3579
3602
|
}, "think-body") : null
|
|
3580
3603
|
});
|
|
3581
|
-
},
|
|
3604
|
+
}, Qo = 32, $o = .25, es = 2, ts = ({ viewportRef: e, enabled: t, revision: n }) => {
|
|
3582
3605
|
let r = j(!0), i = j(!1), a = j(0), o = T(() => e.current ?? void 0, [e]), s = T(() => {
|
|
3583
3606
|
let t = e.current;
|
|
3584
3607
|
return t?.closest("[data-overlayscrollbars]") ?? t ?? void 0;
|
|
@@ -3591,7 +3614,7 @@ var zo = (e, t) => {
|
|
|
3591
3614
|
t.scrollTop = n;
|
|
3592
3615
|
return;
|
|
3593
3616
|
}
|
|
3594
|
-
t.scrollTop += Math.max(i *
|
|
3617
|
+
t.scrollTop += Math.max(i * $o, Math.min(i, es)), a.current = requestAnimationFrame(c);
|
|
3595
3618
|
}, [e]), l = T(() => {
|
|
3596
3619
|
!a.current && r.current && (a.current = requestAnimationFrame(c));
|
|
3597
3620
|
}, [c]);
|
|
@@ -3618,7 +3641,7 @@ var zo = (e, t) => {
|
|
|
3618
3641
|
let u = () => {
|
|
3619
3642
|
let t = e.current;
|
|
3620
3643
|
if (!t) return;
|
|
3621
|
-
let n = t.scrollHeight - t.clientHeight - t.scrollTop <=
|
|
3644
|
+
let n = t.scrollHeight - t.clientHeight - t.scrollTop <= Qo;
|
|
3622
3645
|
i.current ? (i.current = !1, r.current = n, !n && a.current && (cancelAnimationFrame(a.current), a.current = 0)) : n && (r.current = !0);
|
|
3623
3646
|
}, d = () => {
|
|
3624
3647
|
i.current = !0;
|
|
@@ -3642,41 +3665,202 @@ var zo = (e, t) => {
|
|
|
3642
3665
|
passive: !0,
|
|
3643
3666
|
enable: t
|
|
3644
3667
|
}), { onScroll: u };
|
|
3645
|
-
},
|
|
3668
|
+
}, ns = `
|
|
3669
|
+
:host {
|
|
3670
|
+
all: initial;
|
|
3671
|
+
display: block;
|
|
3672
|
+
width: 100%;
|
|
3673
|
+
max-width: 100%;
|
|
3674
|
+
min-width: 0;
|
|
3675
|
+
}
|
|
3676
|
+
.bsy-editor-html-preview__body {
|
|
3677
|
+
color: #030303;
|
|
3678
|
+
font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
|
|
3679
|
+
font-size: 15px;
|
|
3680
|
+
line-height: 1.6;
|
|
3681
|
+
word-break: break-word;
|
|
3682
|
+
}
|
|
3683
|
+
.bsy-editor-html-preview__body p {
|
|
3684
|
+
margin: 0;
|
|
3685
|
+
}
|
|
3686
|
+
.bsy-editor-html-preview__body .editor-text-bold {
|
|
3687
|
+
font-weight: 700;
|
|
3688
|
+
}
|
|
3689
|
+
.bsy-editor-html-preview__body .editor-text-italic {
|
|
3690
|
+
font-style: italic;
|
|
3691
|
+
}
|
|
3692
|
+
.bsy-editor-html-preview__body .editor-text-underline {
|
|
3693
|
+
text-decoration: underline;
|
|
3694
|
+
}
|
|
3695
|
+
.bsy-editor-html-preview__body .editor-text-strikethrough {
|
|
3696
|
+
text-decoration: line-through;
|
|
3697
|
+
}
|
|
3698
|
+
.bsy-editor-html-preview__body .editor-text-underline-strikethrough {
|
|
3699
|
+
text-decoration: underline line-through;
|
|
3700
|
+
}
|
|
3701
|
+
.bsy-editor-html-preview__body sup,
|
|
3702
|
+
.bsy-editor-html-preview__body sub {
|
|
3703
|
+
display: inline-block;
|
|
3704
|
+
position: static;
|
|
3705
|
+
top: auto;
|
|
3706
|
+
bottom: auto;
|
|
3707
|
+
font-size: 0.75em;
|
|
3708
|
+
line-height: 1;
|
|
3709
|
+
}
|
|
3710
|
+
.bsy-editor-html-preview__body sup {
|
|
3711
|
+
vertical-align: super;
|
|
3712
|
+
}
|
|
3713
|
+
.bsy-editor-html-preview__body sub {
|
|
3714
|
+
vertical-align: sub;
|
|
3715
|
+
}
|
|
3716
|
+
.bsy-editor-html-preview__body .editor-heading-h1,
|
|
3717
|
+
.bsy-editor-html-preview__body .editor-heading-h2,
|
|
3718
|
+
.bsy-editor-html-preview__body .editor-heading-h3,
|
|
3719
|
+
.bsy-editor-html-preview__body .editor-heading-h4,
|
|
3720
|
+
.bsy-editor-html-preview__body .editor-heading-h5,
|
|
3721
|
+
.bsy-editor-html-preview__body .editor-heading-h6 {
|
|
3722
|
+
margin: 0.6em 0 0.4em;
|
|
3723
|
+
font-weight: 600;
|
|
3724
|
+
line-height: 1.35;
|
|
3725
|
+
}
|
|
3726
|
+
.bsy-editor-html-preview__body .editor-heading-h1 {
|
|
3727
|
+
font-size: 2em;
|
|
3728
|
+
}
|
|
3729
|
+
.bsy-editor-html-preview__body .editor-heading-h2 {
|
|
3730
|
+
font-size: 1.5em;
|
|
3731
|
+
}
|
|
3732
|
+
.bsy-editor-html-preview__body .editor-heading-h3 {
|
|
3733
|
+
font-size: 1.25em;
|
|
3734
|
+
}
|
|
3735
|
+
.bsy-editor-html-preview__body .editor-heading-h4 {
|
|
3736
|
+
font-size: 1.125em;
|
|
3737
|
+
}
|
|
3738
|
+
.bsy-editor-html-preview__body .editor-heading-h5 {
|
|
3739
|
+
font-size: 1em;
|
|
3740
|
+
}
|
|
3741
|
+
.bsy-editor-html-preview__body .editor-heading-h6 {
|
|
3742
|
+
font-size: 0.875em;
|
|
3743
|
+
}
|
|
3744
|
+
.bsy-editor-html-preview__body ul,
|
|
3745
|
+
.bsy-editor-html-preview__body ol,
|
|
3746
|
+
.bsy-editor-html-preview__body .editor-list-ul,
|
|
3747
|
+
.bsy-editor-html-preview__body .editor-list-ol {
|
|
3748
|
+
margin: 0;
|
|
3749
|
+
padding-inline-start: 0;
|
|
3750
|
+
list-style-position: outside;
|
|
3751
|
+
}
|
|
3752
|
+
.bsy-editor-html-preview__body .editor-list-ul {
|
|
3753
|
+
list-style-type: disc;
|
|
3754
|
+
}
|
|
3755
|
+
.bsy-editor-html-preview__body .editor-list-ol {
|
|
3756
|
+
list-style-type: decimal;
|
|
3757
|
+
}
|
|
3758
|
+
.bsy-editor-html-preview__body li,
|
|
3759
|
+
.bsy-editor-html-preview__body .editor-listitem {
|
|
3760
|
+
margin: 0;
|
|
3761
|
+
margin-inline-start: ${di};
|
|
3762
|
+
list-style: inherit;
|
|
3763
|
+
}
|
|
3764
|
+
.bsy-editor-html-preview__body .editor-nested-listitem {
|
|
3765
|
+
margin-inline-start: 0;
|
|
3766
|
+
list-style-type: none;
|
|
3767
|
+
}
|
|
3768
|
+
.bsy-editor-html-preview__body li::marker,
|
|
3769
|
+
.bsy-editor-html-preview__body .editor-listitem::marker {
|
|
3770
|
+
color: var(--listitem-marker-color);
|
|
3771
|
+
background-color: var(--listitem-marker-background-color);
|
|
3772
|
+
font-family: var(--listitem-marker-font-family);
|
|
3773
|
+
font-size: var(--listitem-marker-font-size);
|
|
3774
|
+
}
|
|
3775
|
+
.bsy-editor-html-preview__body .editor-list-ul .editor-list-ul {
|
|
3776
|
+
list-style-type: circle;
|
|
3777
|
+
}
|
|
3778
|
+
.bsy-editor-html-preview__body .editor-list-ul .editor-list-ul .editor-list-ul {
|
|
3779
|
+
list-style-type: square;
|
|
3780
|
+
}
|
|
3781
|
+
.bsy-editor-html-preview__body .editor-link,
|
|
3782
|
+
.bsy-editor-html-preview__body .editor-link:link,
|
|
3783
|
+
.bsy-editor-html-preview__body .editor-link:visited,
|
|
3784
|
+
.bsy-editor-html-preview__body .editor-link:hover,
|
|
3785
|
+
.bsy-editor-html-preview__body .editor-link:active,
|
|
3786
|
+
.bsy-editor-html-preview__body .editor-link:focus {
|
|
3787
|
+
color: #0269ff;
|
|
3788
|
+
cursor: pointer;
|
|
3789
|
+
}
|
|
3790
|
+
.bsy-editor-html-preview__body .editor-link * {
|
|
3791
|
+
color: #0269ff !important;
|
|
3792
|
+
}
|
|
3793
|
+
.bsy-editor-html-preview__body pre,
|
|
3794
|
+
.bsy-editor-html-preview__body .editor-code {
|
|
3795
|
+
display: block;
|
|
3796
|
+
box-sizing: border-box;
|
|
3797
|
+
max-width: 100%;
|
|
3798
|
+
margin: 8px 0;
|
|
3799
|
+
padding: 8px 12px;
|
|
3800
|
+
overflow-x: auto;
|
|
3801
|
+
border-radius: 4px;
|
|
3802
|
+
background: rgb(240, 242, 245);
|
|
3803
|
+
color: #1f2328;
|
|
3804
|
+
font-family: Menlo, Consolas, Monaco, monospace;
|
|
3805
|
+
font-size: 13px;
|
|
3806
|
+
line-height: 1.53;
|
|
3807
|
+
tab-size: 2;
|
|
3808
|
+
white-space: pre;
|
|
3809
|
+
}
|
|
3810
|
+
.bsy-editor-html-preview__body .editor-table-scrollable-wrapper {
|
|
3811
|
+
max-width: 100%;
|
|
3812
|
+
margin: 8px 0;
|
|
3813
|
+
overflow-x: auto;
|
|
3814
|
+
}
|
|
3815
|
+
.bsy-editor-html-preview__body table {
|
|
3816
|
+
width: max-content;
|
|
3817
|
+
min-width: 100%;
|
|
3818
|
+
margin: 0;
|
|
3819
|
+
border-collapse: collapse;
|
|
3820
|
+
table-layout: fixed;
|
|
3821
|
+
}
|
|
3822
|
+
.bsy-editor-html-preview__body td,
|
|
3823
|
+
.bsy-editor-html-preview__body th {
|
|
3824
|
+
box-sizing: border-box;
|
|
3825
|
+
min-width: 75px;
|
|
3826
|
+
min-height: 32px;
|
|
3827
|
+
padding: 4px 8px;
|
|
3828
|
+
border: 1px solid #d9d9d9;
|
|
3829
|
+
vertical-align: top;
|
|
3830
|
+
}
|
|
3831
|
+
.bsy-editor-html-preview__body th {
|
|
3832
|
+
background: #f2f3f5;
|
|
3833
|
+
font-weight: 600;
|
|
3834
|
+
}
|
|
3835
|
+
.bsy-editor-html-preview__body img {
|
|
3836
|
+
max-width: 100%;
|
|
3837
|
+
height: auto;
|
|
3838
|
+
vertical-align: baseline;
|
|
3839
|
+
}
|
|
3840
|
+
`, rs = ({ html: e }) => {
|
|
3646
3841
|
let t = j(null);
|
|
3647
3842
|
return te(() => {
|
|
3648
|
-
|
|
3649
|
-
if (!n) return;
|
|
3650
|
-
let r = n.shadowRoot ?? n.attachShadow({ mode: "open" }), i = document.createElement("div");
|
|
3651
|
-
i.className = "bsy-editor-html-preview__body", i.innerHTML = X(e);
|
|
3652
|
-
for (let e of Array.from(i.querySelectorAll("table"))) {
|
|
3653
|
-
if (e.parentElement?.classList.contains("editor-table-scrollable-wrapper")) continue;
|
|
3654
|
-
let t = document.createElement("div");
|
|
3655
|
-
t.className = "editor-table-scrollable-wrapper", e.replaceWith(t), t.append(e);
|
|
3656
|
-
}
|
|
3657
|
-
r.replaceChildren();
|
|
3658
|
-
let a = document.createElement("style");
|
|
3659
|
-
a.textContent = Xo, r.append(a, i);
|
|
3843
|
+
hi(t.current, e, X, ns);
|
|
3660
3844
|
}, [e]), /* @__PURE__ */ y("div", {
|
|
3661
3845
|
ref: t,
|
|
3662
3846
|
className: "bsy-editor-html-preview"
|
|
3663
3847
|
});
|
|
3664
|
-
},
|
|
3665
|
-
let [t, n] = M(() => e && !
|
|
3848
|
+
}, is = ({ html: e }) => {
|
|
3849
|
+
let [t, n] = M(() => e && !gi(e) ? e : "");
|
|
3666
3850
|
return O(() => {
|
|
3667
|
-
!e ||
|
|
3668
|
-
}, [e]), t ? /* @__PURE__ */ y(
|
|
3669
|
-
},
|
|
3851
|
+
!e || gi(e) || n(e);
|
|
3852
|
+
}, [e]), t ? /* @__PURE__ */ y(rs, { html: t }) : null;
|
|
3853
|
+
}, as = {
|
|
3670
3854
|
paddingAbsolute: !0,
|
|
3671
3855
|
overflow: {
|
|
3672
3856
|
x: "hidden",
|
|
3673
3857
|
y: "scroll"
|
|
3674
3858
|
}
|
|
3675
|
-
},
|
|
3676
|
-
let { t: p } = a(), m = gr(), [h, g] = M(!0), _ = j(null), v = !!o.trim(), x = t === "ready" && v, S =
|
|
3859
|
+
}, os = ({ status: t, errorMessage: n, originalHtml: i, proposedHtml: o, preset: s, onPresetChange: c, onCancel: l, onApply: d }) => {
|
|
3860
|
+
let { t: p } = a(), m = gr(), [h, g] = M(!0), _ = j(null), v = !!o.trim(), x = t === "ready" && v, S = Yo({
|
|
3677
3861
|
status: t,
|
|
3678
3862
|
reasoning: m
|
|
3679
|
-
}, v), C =
|
|
3863
|
+
}, v), C = ts({
|
|
3680
3864
|
viewportRef: _,
|
|
3681
3865
|
enabled: t === "loading",
|
|
3682
3866
|
revision: `${m ?? ""}\0${o}`
|
|
@@ -3702,8 +3886,8 @@ var zo = (e, t) => {
|
|
|
3702
3886
|
children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), p("editor.aiOriginal")]
|
|
3703
3887
|
}), /* @__PURE__ */ y(u, {
|
|
3704
3888
|
className: Q["bsy-lexical-ai__column-body"],
|
|
3705
|
-
options:
|
|
3706
|
-
children: /* @__PURE__ */ y(
|
|
3889
|
+
options: as,
|
|
3890
|
+
children: /* @__PURE__ */ y(is, { html: i })
|
|
3707
3891
|
})]
|
|
3708
3892
|
}), /* @__PURE__ */ b("div", {
|
|
3709
3893
|
className: Q["bsy-lexical-ai__column"],
|
|
@@ -3739,16 +3923,16 @@ var zo = (e, t) => {
|
|
|
3739
3923
|
className: Q["bsy-lexical-ai__column-stack"],
|
|
3740
3924
|
children: [S.visible ? /* @__PURE__ */ y("div", {
|
|
3741
3925
|
className: Q["bsy-lexical-ai__think-pin"],
|
|
3742
|
-
children: /* @__PURE__ */ y(
|
|
3926
|
+
children: /* @__PURE__ */ y(Xo, { model: S })
|
|
3743
3927
|
}) : null, /* @__PURE__ */ b(u, {
|
|
3744
3928
|
className: Q["bsy-lexical-ai__column-body"],
|
|
3745
|
-
options:
|
|
3929
|
+
options: as,
|
|
3746
3930
|
viewportRef: _,
|
|
3747
3931
|
onScroll: C.onScroll,
|
|
3748
3932
|
children: [t === "error" ? /* @__PURE__ */ y("div", {
|
|
3749
3933
|
className: Q["bsy-lexical-ai__error"],
|
|
3750
3934
|
children: n || p("editor.aiError")
|
|
3751
|
-
}) : /* @__PURE__ */ y(
|
|
3935
|
+
}) : /* @__PURE__ */ y(Zo, { model: S }), v ? /* @__PURE__ */ y(is, { html: o }) : null]
|
|
3752
3936
|
})]
|
|
3753
3937
|
})]
|
|
3754
3938
|
})]
|
|
@@ -3766,17 +3950,17 @@ var zo = (e, t) => {
|
|
|
3766
3950
|
})]
|
|
3767
3951
|
})
|
|
3768
3952
|
});
|
|
3769
|
-
},
|
|
3953
|
+
}, ss = {
|
|
3770
3954
|
paddingAbsolute: !0,
|
|
3771
3955
|
overflow: {
|
|
3772
3956
|
x: "hidden",
|
|
3773
3957
|
y: "scroll"
|
|
3774
3958
|
}
|
|
3775
|
-
},
|
|
3776
|
-
let { t: c } = a(), l = gr(), [d, f] = M(!0), p = j(null), m = !!i.trim(), h = e === "ready" && m, g =
|
|
3959
|
+
}, cs = ({ status: e, errorMessage: t, originalHtml: n, proposedHtml: i, onCancel: o, onApply: s }) => {
|
|
3960
|
+
let { t: c } = a(), l = gr(), [d, f] = M(!0), p = j(null), m = !!i.trim(), h = e === "ready" && m, g = Yo({
|
|
3777
3961
|
status: e,
|
|
3778
3962
|
reasoning: l
|
|
3779
|
-
}, m), _ =
|
|
3963
|
+
}, m), _ = ts({
|
|
3780
3964
|
viewportRef: p,
|
|
3781
3965
|
enabled: e === "loading",
|
|
3782
3966
|
revision: `${l ?? ""}\0${i}`
|
|
@@ -3799,8 +3983,8 @@ var zo = (e, t) => {
|
|
|
3799
3983
|
children: [/* @__PURE__ */ y("span", { className: Q["bsy-lexical-ai__column-dot"] }), c("editor.aiOriginal")]
|
|
3800
3984
|
}), /* @__PURE__ */ y(u, {
|
|
3801
3985
|
className: Q["bsy-lexical-ai__column-body"],
|
|
3802
|
-
options:
|
|
3803
|
-
children: /* @__PURE__ */ y(
|
|
3986
|
+
options: ss,
|
|
3987
|
+
children: /* @__PURE__ */ y(is, { html: n })
|
|
3804
3988
|
})]
|
|
3805
3989
|
}), /* @__PURE__ */ b("div", {
|
|
3806
3990
|
className: Q["bsy-lexical-ai__column"],
|
|
@@ -3811,16 +3995,16 @@ var zo = (e, t) => {
|
|
|
3811
3995
|
className: Q["bsy-lexical-ai__column-stack"],
|
|
3812
3996
|
children: [g.visible ? /* @__PURE__ */ y("div", {
|
|
3813
3997
|
className: Q["bsy-lexical-ai__think-pin"],
|
|
3814
|
-
children: /* @__PURE__ */ y(
|
|
3998
|
+
children: /* @__PURE__ */ y(Xo, { model: g })
|
|
3815
3999
|
}) : null, /* @__PURE__ */ b(u, {
|
|
3816
4000
|
className: Q["bsy-lexical-ai__column-body"],
|
|
3817
|
-
options:
|
|
4001
|
+
options: ss,
|
|
3818
4002
|
viewportRef: p,
|
|
3819
4003
|
onScroll: _.onScroll,
|
|
3820
4004
|
children: [e === "error" ? /* @__PURE__ */ y("div", {
|
|
3821
4005
|
className: Q["bsy-lexical-ai__error"],
|
|
3822
4006
|
children: t || c("editor.aiError")
|
|
3823
|
-
}) : /* @__PURE__ */ y(
|
|
4007
|
+
}) : /* @__PURE__ */ y(Zo, { model: g }), m ? /* @__PURE__ */ y(is, { html: i }) : null]
|
|
3824
4008
|
})]
|
|
3825
4009
|
})]
|
|
3826
4010
|
})]
|
|
@@ -3838,17 +4022,17 @@ var zo = (e, t) => {
|
|
|
3838
4022
|
})]
|
|
3839
4023
|
})
|
|
3840
4024
|
});
|
|
3841
|
-
},
|
|
3842
|
-
let [n] = R(), { aiOpen: r, setAiOpen: i, aiSessionRef: o, stop: s, polish: c } = mr(), { t: l } = a(), [u, d] = ie.useMessage(), f = o.current, { text: p, status: m, errorMessage: h } = hr(), g = !m || m === "idle" ? "loading" : m, _ = A(() => r ?
|
|
4025
|
+
}, ls = ({ maxLength: e, onMaxLengthExceed: t }) => {
|
|
4026
|
+
let [n] = R(), { aiOpen: r, setAiOpen: i, aiSessionRef: o, stop: s, polish: c } = mr(), { t: l } = a(), [u, d] = ie.useMessage(), f = o.current, { text: p, status: m, errorMessage: h } = hr(), g = !m || m === "idle" ? "loading" : m, _ = A(() => r ? Go(o.current?.originalHtml || "", "ready") : "", [r, o]), x = Ko({
|
|
3843
4027
|
enabled: r === "typeset",
|
|
3844
4028
|
status: g,
|
|
3845
4029
|
revision: p,
|
|
3846
|
-
compute: () =>
|
|
3847
|
-
}), S =
|
|
4030
|
+
compute: () => Go(Uo(p, f?.codeBlocks ?? []), g)
|
|
4031
|
+
}), S = Ko({
|
|
3848
4032
|
enabled: r === "polish",
|
|
3849
4033
|
status: g,
|
|
3850
4034
|
revision: p,
|
|
3851
|
-
compute: () =>
|
|
4035
|
+
compute: () => Go(ca(f?.originalHtml || "", p), g)
|
|
3852
4036
|
});
|
|
3853
4037
|
O(() => {
|
|
3854
4038
|
if (r) return n.setEditable(!1), n.update(() => {
|
|
@@ -3866,7 +4050,7 @@ var zo = (e, t) => {
|
|
|
3866
4050
|
]), w = T(() => {
|
|
3867
4051
|
if (r !== "typeset" || g !== "ready") return !1;
|
|
3868
4052
|
n.setEditable(!0);
|
|
3869
|
-
let { applied: i, truncated: a } =
|
|
4053
|
+
let { applied: i, truncated: a } = Wo(n, p, o.current?.codeBlocks ?? [], e);
|
|
3870
4054
|
return i ? (a && t?.(), !0) : (n.setEditable(!1), u.warning(l("editor.aiApplyEmpty")), !1);
|
|
3871
4055
|
}, [
|
|
3872
4056
|
r,
|
|
@@ -3878,7 +4062,7 @@ var zo = (e, t) => {
|
|
|
3878
4062
|
g,
|
|
3879
4063
|
l,
|
|
3880
4064
|
p
|
|
3881
|
-
]), E = T(() => r !== "polish" || g !== "ready" ? !1 :
|
|
4065
|
+
]), E = T(() => r !== "polish" || g !== "ready" ? !1 : la(n, p) ? !0 : (u.warning(l("editor.aiApplyEmpty")), !1), [
|
|
3882
4066
|
r,
|
|
3883
4067
|
n,
|
|
3884
4068
|
u,
|
|
@@ -3897,14 +4081,14 @@ var zo = (e, t) => {
|
|
|
3897
4081
|
c,
|
|
3898
4082
|
s
|
|
3899
4083
|
]);
|
|
3900
|
-
return r ? /* @__PURE__ */ b(v, { children: [d, r === "typeset" ? /* @__PURE__ */ y(
|
|
4084
|
+
return r ? /* @__PURE__ */ b(v, { children: [d, r === "typeset" ? /* @__PURE__ */ y(cs, {
|
|
3901
4085
|
status: g,
|
|
3902
4086
|
errorMessage: h,
|
|
3903
4087
|
originalHtml: _,
|
|
3904
4088
|
proposedHtml: x,
|
|
3905
4089
|
onCancel: C,
|
|
3906
4090
|
onApply: w
|
|
3907
|
-
}) : /* @__PURE__ */ y(
|
|
4091
|
+
}) : /* @__PURE__ */ y(os, {
|
|
3908
4092
|
status: g,
|
|
3909
4093
|
errorMessage: h,
|
|
3910
4094
|
originalHtml: _,
|
|
@@ -3914,10 +4098,10 @@ var zo = (e, t) => {
|
|
|
3914
4098
|
onCancel: C,
|
|
3915
4099
|
onApply: E
|
|
3916
4100
|
})] }) : d;
|
|
3917
|
-
},
|
|
4101
|
+
}, us = [], ds = (e) => {
|
|
3918
4102
|
let { height: t = "auto", minHeight: n, onChange: r, toolbar: i, theme: a, maxLength: o, onMaxLengthExceed: s, upload: c, ai: l } = e, [u] = R(), { isSourceMode: d, isSourceModeRef: f } = Hr(), p = j(null), m = j(null), h = j(/* @__PURE__ */ new Map()), g = j(null), _ = j(null), v = j(s);
|
|
3919
4103
|
v.current = s;
|
|
3920
|
-
let x =
|
|
4104
|
+
let x = co(o) ? o : void 0, [S, C] = M(0), [w, E] = M(null), D = i?.mode === "floating", ee = x !== void 0 && !d, k = j(l);
|
|
3921
4105
|
k.current = l;
|
|
3922
4106
|
let te = j(r);
|
|
3923
4107
|
te.current = r;
|
|
@@ -3958,7 +4142,7 @@ var zo = (e, t) => {
|
|
|
3958
4142
|
l?.errorMessage
|
|
3959
4143
|
]), se = T((e) => {
|
|
3960
4144
|
f.current || e.read(() => {
|
|
3961
|
-
let t = F().getTextContent(), n =
|
|
4145
|
+
let t = F().getTextContent(), n = Yi(X(ge(u, null))), r = xi(n, t) ? null : n;
|
|
3962
4146
|
_.current = r, x !== void 0 && C(t.length);
|
|
3963
4147
|
let i = Me(nn).map((e) => h.current.get(e.getSrc())).filter((e) => e !== void 0);
|
|
3964
4148
|
te.current({
|
|
@@ -3985,13 +4169,13 @@ var zo = (e, t) => {
|
|
|
3985
4169
|
if (f.current) {
|
|
3986
4170
|
let t = e.value?.trim() ? X(e.value) : "";
|
|
3987
4171
|
_.current = e.value, u.update(() => {
|
|
3988
|
-
|
|
4172
|
+
So(xo(t));
|
|
3989
4173
|
});
|
|
3990
4174
|
return;
|
|
3991
4175
|
}
|
|
3992
4176
|
let t = !1, n = _.current === null;
|
|
3993
4177
|
u.update(() => {
|
|
3994
|
-
|
|
4178
|
+
bi(u, e.value?.trim() ? X(e.value) : ""), x !== void 0 && (t = lo(u, x)), On(u);
|
|
3995
4179
|
}), n && u.dispatchCommand(Re, void 0), t && v.current?.();
|
|
3996
4180
|
}, [
|
|
3997
4181
|
e.value,
|
|
@@ -3999,7 +4183,7 @@ var zo = (e, t) => {
|
|
|
3999
4183
|
x,
|
|
4000
4184
|
f
|
|
4001
4185
|
]);
|
|
4002
|
-
let ce = i?.config?.length ? i.config :
|
|
4186
|
+
let ce = i?.config?.length ? i.config : us, le = T(() => {
|
|
4003
4187
|
v.current?.();
|
|
4004
4188
|
}, []);
|
|
4005
4189
|
return /* @__PURE__ */ y(dr.Provider, {
|
|
@@ -4008,7 +4192,7 @@ var zo = (e, t) => {
|
|
|
4008
4192
|
value: oe,
|
|
4009
4193
|
children: /* @__PURE__ */ b(pr.Provider, {
|
|
4010
4194
|
value: l?.reasoning,
|
|
4011
|
-
children: [/* @__PURE__ */ y(
|
|
4195
|
+
children: [/* @__PURE__ */ y(fs, {
|
|
4012
4196
|
containerRef: p,
|
|
4013
4197
|
isFloating: D,
|
|
4014
4198
|
toolbarConfig: ce,
|
|
@@ -4026,19 +4210,19 @@ var zo = (e, t) => {
|
|
|
4026
4210
|
validMaxLength: x,
|
|
4027
4211
|
onMaxLengthExceed: le,
|
|
4028
4212
|
onChange: se
|
|
4029
|
-
}), /* @__PURE__ */ y(
|
|
4213
|
+
}), /* @__PURE__ */ y(ls, {
|
|
4030
4214
|
maxLength: x,
|
|
4031
4215
|
onMaxLengthExceed: le
|
|
4032
4216
|
})]
|
|
4033
4217
|
})
|
|
4034
4218
|
})
|
|
4035
4219
|
});
|
|
4036
|
-
},
|
|
4220
|
+
}, fs = w(function({ containerRef: e, isFloating: t, toolbarConfig: n, toolbarTheme: r, containerTheme: i, toolbarStyle: a, toolbarSize: o, toolbarMode: s, toolbarFloating: c, toolbarStickyOffset: l, height: u, minHeight: d, showLengthBadge: f, textLength: p, validMaxLength: m, onMaxLengthExceed: h, onChange: g }) {
|
|
4037
4221
|
let [_] = R(), v = Qt(), x = typeof u == "number" ? u : void 0, S = !t && x === void 0 && l !== void 0, C = j(!1);
|
|
4038
4222
|
O(() => {
|
|
4039
4223
|
v && C.current && (C.current = !1, _.focus());
|
|
4040
4224
|
}, [v, _]);
|
|
4041
|
-
let w = A(() =>
|
|
4225
|
+
let w = A(() => ka(i), [i]);
|
|
4042
4226
|
return /* @__PURE__ */ b("div", {
|
|
4043
4227
|
ref: e,
|
|
4044
4228
|
className: P("bsy-lexical-editor", $["bsy-lexical-editor"], t && $["bsy-lexical-editor--floating"], S && $["bsy-lexical-editor--sticky-toolbar"]),
|
|
@@ -4048,7 +4232,7 @@ var zo = (e, t) => {
|
|
|
4048
4232
|
!t || !n || !t.contains(n) || _.isEditable() || (C.current = !0, _.setEditable(!0));
|
|
4049
4233
|
},
|
|
4050
4234
|
children: [
|
|
4051
|
-
n && n.length > 0 ? /* @__PURE__ */ y(
|
|
4235
|
+
n && n.length > 0 ? /* @__PURE__ */ y(Da, {
|
|
4052
4236
|
config: n,
|
|
4053
4237
|
theme: r,
|
|
4054
4238
|
style: a,
|
|
@@ -4072,22 +4256,22 @@ var zo = (e, t) => {
|
|
|
4072
4256
|
}),
|
|
4073
4257
|
ErrorBoundary: he
|
|
4074
4258
|
})
|
|
4075
|
-
}), f && m !== void 0 ? /* @__PURE__ */ y(
|
|
4259
|
+
}), f && m !== void 0 ? /* @__PURE__ */ y(Eo, {
|
|
4076
4260
|
current: p,
|
|
4077
4261
|
maxLength: m
|
|
4078
4262
|
}) : null]
|
|
4079
4263
|
}),
|
|
4080
4264
|
/* @__PURE__ */ y($t, {}),
|
|
4081
4265
|
/* @__PURE__ */ y(en, {}),
|
|
4082
|
-
/* @__PURE__ */ y(
|
|
4083
|
-
/* @__PURE__ */ y(
|
|
4084
|
-
/* @__PURE__ */ y(
|
|
4085
|
-
/* @__PURE__ */ y(
|
|
4086
|
-
/* @__PURE__ */ y(
|
|
4087
|
-
/* @__PURE__ */ y(
|
|
4088
|
-
/* @__PURE__ */ y(
|
|
4089
|
-
/* @__PURE__ */ y(
|
|
4090
|
-
f && m !== void 0 ? /* @__PURE__ */ y(
|
|
4266
|
+
/* @__PURE__ */ y(Fa, {}),
|
|
4267
|
+
/* @__PURE__ */ y(To, {}),
|
|
4268
|
+
/* @__PURE__ */ y(Ia, {}),
|
|
4269
|
+
/* @__PURE__ */ y(za, {}),
|
|
4270
|
+
/* @__PURE__ */ y(Ba, {}),
|
|
4271
|
+
/* @__PURE__ */ y(ro, {}),
|
|
4272
|
+
/* @__PURE__ */ y(io, {}),
|
|
4273
|
+
/* @__PURE__ */ y(oo, {}),
|
|
4274
|
+
f && m !== void 0 ? /* @__PURE__ */ y(so, {
|
|
4091
4275
|
maxLength: m,
|
|
4092
4276
|
onMaxLengthExceed: h
|
|
4093
4277
|
}) : null,
|
|
@@ -4099,15 +4283,15 @@ var zo = (e, t) => {
|
|
|
4099
4283
|
})
|
|
4100
4284
|
]
|
|
4101
4285
|
});
|
|
4102
|
-
}),
|
|
4286
|
+
}), ps = (e) => /* @__PURE__ */ y(Co, {
|
|
4103
4287
|
maxLength: e.maxLength,
|
|
4104
4288
|
onMaxLengthExceed: e.onMaxLengthExceed,
|
|
4105
|
-
children: /* @__PURE__ */ y(
|
|
4289
|
+
children: /* @__PURE__ */ y(ds, { ...e })
|
|
4106
4290
|
});
|
|
4107
|
-
|
|
4291
|
+
ps.displayName = "BsyLexicalEditorCore";
|
|
4108
4292
|
//#endregion
|
|
4109
4293
|
//#region src/components/Editor/nodes/ExtendedLinkNode.ts
|
|
4110
|
-
var
|
|
4294
|
+
var ms = class e extends pt {
|
|
4111
4295
|
constructor(e = "", t = {}, n) {
|
|
4112
4296
|
super(e, t, n);
|
|
4113
4297
|
}
|
|
@@ -4122,15 +4306,15 @@ var cs = class e extends pt {
|
|
|
4122
4306
|
}, t.__key);
|
|
4123
4307
|
}
|
|
4124
4308
|
static importJSON(e) {
|
|
4125
|
-
return
|
|
4309
|
+
return hs().updateFromJSON(e);
|
|
4126
4310
|
}
|
|
4127
4311
|
sanitizeUrl(e) {
|
|
4128
4312
|
return e.startsWith("@") ? e : super.sanitizeUrl(e);
|
|
4129
4313
|
}
|
|
4130
|
-
},
|
|
4314
|
+
}, hs = (e = "", t = {}) => ve(new ms(e, t)), gs = "1px solid #d9d9d9", _s = { export: new Map([[zt, (e, t) => {
|
|
4131
4315
|
let n = t.exportDOM(e);
|
|
4132
|
-
return ot(n.element) && (n.element.style.border =
|
|
4133
|
-
}]]) },
|
|
4316
|
+
return ot(n.element) && (n.element.style.border = gs), n;
|
|
4317
|
+
}]]) }, vs = (e) => {
|
|
4134
4318
|
let { autoFocus: t = !1 } = e;
|
|
4135
4319
|
return /* @__PURE__ */ y(ue, {
|
|
4136
4320
|
initialConfig: A(() => ({
|
|
@@ -4169,17 +4353,17 @@ var cs = class e extends pt {
|
|
|
4169
4353
|
tableRow: "editor-table-row",
|
|
4170
4354
|
tableScrollableWrapper: "editor-table-scrollable-wrapper"
|
|
4171
4355
|
},
|
|
4172
|
-
html:
|
|
4356
|
+
html: _s,
|
|
4173
4357
|
nodes: [
|
|
4174
|
-
|
|
4358
|
+
ms,
|
|
4175
4359
|
{
|
|
4176
4360
|
replace: pt,
|
|
4177
|
-
with: (e) => new
|
|
4361
|
+
with: (e) => new ms(e.__url, {
|
|
4178
4362
|
rel: e.__rel,
|
|
4179
4363
|
target: e.__target,
|
|
4180
4364
|
title: e.__title
|
|
4181
4365
|
}),
|
|
4182
|
-
withKlass:
|
|
4366
|
+
withKlass: ms
|
|
4183
4367
|
},
|
|
4184
4368
|
ft,
|
|
4185
4369
|
bt,
|
|
@@ -4191,17 +4375,17 @@ var cs = class e extends pt {
|
|
|
4191
4375
|
Vt,
|
|
4192
4376
|
zt,
|
|
4193
4377
|
nn,
|
|
4194
|
-
|
|
4378
|
+
Aa,
|
|
4195
4379
|
{
|
|
4196
4380
|
replace: rt,
|
|
4197
|
-
with: (e) => new
|
|
4198
|
-
withKlass:
|
|
4381
|
+
with: (e) => new Aa(e.__text),
|
|
4382
|
+
withKlass: Aa
|
|
4199
4383
|
}
|
|
4200
4384
|
]
|
|
4201
4385
|
}), [t]),
|
|
4202
|
-
children: /* @__PURE__ */ y(
|
|
4386
|
+
children: /* @__PURE__ */ y(ps, { ...e })
|
|
4203
4387
|
});
|
|
4204
4388
|
};
|
|
4205
|
-
|
|
4389
|
+
vs.displayName = "BsyLexicalEditor";
|
|
4206
4390
|
//#endregion
|
|
4207
|
-
export { Te as $getRoot, q as BaseButton,
|
|
4391
|
+
export { Te as $getRoot, q as BaseButton, rs as EditorHtmlPreview, vs as default, ya as listRegisteredToolbarButtons, ga as registerToolbarButton, _a as unregisterToolbarButton, ct as useLexicalComposerContext };
|