rhua-chatgpt-web 1.0.90 → 1.0.92
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/{api_chain-ndbj9N9y.cjs → api_chain-Bs8HpDtx.cjs} +1 -1
- package/dist/{api_chain-C-0jZvv9.js → api_chain-DxPDMwtJ.js} +2 -2
- package/dist/{combine_docs_chain-BV3YQBdx.js → combine_docs_chain-CeeUc79G.js} +2 -2
- package/dist/{combine_docs_chain-DQTvoBRZ.cjs → combine_docs_chain-fjjQqm3y.cjs} +1 -1
- package/dist/{few_shot-CKQd-oWZ.js → few_shot-Cq0fQRie.js} +1 -1
- package/dist/{few_shot-B5sleOZV.cjs → few_shot-_naNBcYn.cjs} +1 -1
- package/dist/{index-DwuY6VJ2.js → index-0V-Agbf4.js} +1 -1
- package/dist/{index-vPFPFNIK.cjs → index-B382FZMI.cjs} +1 -1
- package/dist/{index-CHlurisP.js → index-B4raOCHT.js} +1 -1
- package/dist/{index-Cpx0aWjC.cjs → index-BMRDC6vG.cjs} +1 -1
- package/dist/{index-HO_HGmtl.js → index-BXlSzDec.js} +406 -30
- package/dist/{index-CL5dD4QL.js → index-Bc01rI6H.js} +1 -1
- package/dist/{index-kQX1nE2W.js → index-BizrRIYC.js} +1 -1
- package/dist/index-BsuzxemZ.js +4 -0
- package/dist/{index-DkbGwcKs.cjs → index-BwUwhm-3.cjs} +1 -1
- package/dist/index-C1TGA2tr.js +4 -0
- package/dist/{index---9AxgqH.cjs → index-CRgtq22N.cjs} +1 -1
- package/dist/{index-BC6UWh7M.js → index-CWyxo3Rj.js} +1 -1
- package/dist/index-CiVIUf6O.js +4 -0
- package/dist/{index-D2l1IPLs.cjs → index-CmUWpa1F.cjs} +1 -1
- package/dist/{index-ScWV43Ya.cjs → index-D2MqA5Ot.cjs} +10 -10
- package/dist/{index-BP3ZLGza.cjs → index-DEUZZnNC.cjs} +1 -1
- package/dist/{index-DbyUBV_n.js → index-DKHwiy00.js} +2 -2
- package/dist/{index-Btsunyw4.js → index-DX00UPm6.js} +2 -2
- package/dist/{index-B7SLuAnl.cjs → index-DoXR_-rB.cjs} +1 -1
- package/dist/{index-C-punTJk.cjs → index-DwoUs76b.cjs} +1 -1
- package/dist/{index-BDwOxjJB.cjs → index-FbT4xyvN.cjs} +1 -1
- package/dist/index-Z-_GOl6e.js +4 -0
- package/dist/{index-i1kcSW4p.cjs → index-aKYAt0Kk.cjs} +1 -1
- package/dist/{index-C3tkG9PE.cjs → index-gWVDzkrS.cjs} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-pbdKKw38.cjs → index.es-DBMp_6cm.cjs} +3 -3
- package/dist/{index.es-CUW_2i1O.js → index.es-tZmnPNqG.js} +1233 -1153
- package/dist/index.esm.js +1 -1
- package/dist/{llm_chain-Cp-fdIHU.js → llm_chain-D_mUrq1S.js} +1 -1
- package/dist/{llm_chain-BKOS6WwS.cjs → llm_chain-DspRhkD8.cjs} +1 -1
- package/dist/{sequential_chain-DTZBsSxs.cjs → sequential_chain-DJXIBCRm.cjs} +1 -1
- package/dist/{sequential_chain-B9xFRCud.js → sequential_chain-DZXcdvKj.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{vector_db_qa-ClnOaOPx.cjs → vector_db_qa-DOgRNEyj.cjs} +1 -1
- package/dist/{vector_db_qa-dNJ2CIeL.js → vector_db_qa-DdeBuCEV.js} +3 -3
- package/package.json +2 -2
- package/dist/index-6ysrd1Ya.js +0 -4
- package/dist/index-BQHT54Oj.js +0 -4
- package/dist/index-BngGbFgs.js +0 -4
- package/dist/index-M9STV34q.js +0 -4
|
@@ -3,7 +3,7 @@ import * as ReactDOM from "react-dom";
|
|
|
3
3
|
import ReactDOM__default, { flushSync, createPortal } from "react-dom";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import React__default, { useLayoutEffect, useEffect, useRef, useContext, createRef, memo, createContext, createElement, version, forwardRef, useMemo, useState, useCallback, useImperativeHandle, useSyncExternalStore, Fragment as Fragment$1, useId as useId$2, cloneElement, Children } from "react";
|
|
6
|
-
import { Z as getDefaultExportFromCjs, _ as jsxRuntimeExports } from "./index-
|
|
6
|
+
import { Z as getDefaultExportFromCjs, _ as jsxRuntimeExports } from "./index-BXlSzDec.js";
|
|
7
7
|
function hasWindow() {
|
|
8
8
|
return typeof window !== "undefined";
|
|
9
9
|
}
|
|
@@ -35637,7 +35637,7 @@ const Ge$1 = Extension.create({
|
|
|
35637
35637
|
];
|
|
35638
35638
|
}
|
|
35639
35639
|
});
|
|
35640
|
-
function Ot$
|
|
35640
|
+
function Ot$2(e) {
|
|
35641
35641
|
return e.type === "link";
|
|
35642
35642
|
}
|
|
35643
35643
|
function fn(e) {
|
|
@@ -35646,7 +35646,7 @@ function fn(e) {
|
|
|
35646
35646
|
function ue(e) {
|
|
35647
35647
|
return typeof e != "string" && e.type === "text";
|
|
35648
35648
|
}
|
|
35649
|
-
function at$
|
|
35649
|
+
function at$2(e) {
|
|
35650
35650
|
var n, t2, o, r2, s;
|
|
35651
35651
|
return wt$2(e) ? { ...e } : Ce$1(e) ? {
|
|
35652
35652
|
type: "tableCell",
|
|
@@ -35764,7 +35764,7 @@ const P = {
|
|
|
35764
35764
|
values: ["left", "center", "right", "justify"]
|
|
35765
35765
|
}
|
|
35766
35766
|
}, mn = ["backgroundColor", "textColor"];
|
|
35767
|
-
function Fe$
|
|
35767
|
+
function Fe$2(e) {
|
|
35768
35768
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
35769
35769
|
}
|
|
35770
35770
|
function Wc(e) {
|
|
@@ -35782,7 +35782,7 @@ function xe$1(e) {
|
|
|
35782
35782
|
// value is the same as its default, we don't display an HTML
|
|
35783
35783
|
// attribute for it.
|
|
35784
35784
|
parseHTML: (r2) => {
|
|
35785
|
-
const s = r2.getAttribute(Fe$
|
|
35785
|
+
const s = r2.getAttribute(Fe$2(t2));
|
|
35786
35786
|
if (s === null)
|
|
35787
35787
|
return null;
|
|
35788
35788
|
if (o.default === void 0 && o.type === "boolean" || o.default !== void 0 && typeof o.default == "boolean")
|
|
@@ -35794,7 +35794,7 @@ function xe$1(e) {
|
|
|
35794
35794
|
return s;
|
|
35795
35795
|
},
|
|
35796
35796
|
renderHTML: (r2) => r2[t2] !== o.default ? {
|
|
35797
|
-
[Fe$
|
|
35797
|
+
[Fe$2(t2)]: r2[t2]
|
|
35798
35798
|
} : {}
|
|
35799
35799
|
};
|
|
35800
35800
|
}), n;
|
|
@@ -35812,7 +35812,7 @@ function yt$2(e, n, t2, o) {
|
|
|
35812
35812
|
throw new Error("Block type does not match");
|
|
35813
35813
|
return a;
|
|
35814
35814
|
}
|
|
35815
|
-
function Ne$
|
|
35815
|
+
function Ne$2(e, n, t2, o, r2 = false, s) {
|
|
35816
35816
|
const i = document.createElement("div");
|
|
35817
35817
|
if (s !== void 0)
|
|
35818
35818
|
for (const [a, c] of Object.entries(s))
|
|
@@ -35823,7 +35823,7 @@ function Ne$1(e, n, t2, o, r2 = false, s) {
|
|
|
35823
35823
|
), i.setAttribute("data-content-type", n);
|
|
35824
35824
|
for (const [a, c] of Object.entries(t2)) {
|
|
35825
35825
|
const d = o[a].default;
|
|
35826
|
-
!mn.includes(a) && c !== d && i.setAttribute(Fe$
|
|
35826
|
+
!mn.includes(a) && c !== d && i.setAttribute(Fe$2(a), c);
|
|
35827
35827
|
}
|
|
35828
35828
|
return r2 && i.setAttribute("data-file-block", ""), i.appendChild(e.dom), e.contentDOM !== void 0 && (e.contentDOM.className = te(
|
|
35829
35829
|
"bn-inline-content",
|
|
@@ -35900,7 +35900,7 @@ function Me(e, n) {
|
|
|
35900
35900
|
},
|
|
35901
35901
|
renderHTML({ HTMLAttributes: o }) {
|
|
35902
35902
|
const r2 = document.createElement("div");
|
|
35903
|
-
return Ne$
|
|
35903
|
+
return Ne$2(
|
|
35904
35904
|
{
|
|
35905
35905
|
dom: r2,
|
|
35906
35906
|
contentDOM: e.content === "inline" ? r2 : void 0
|
|
@@ -35920,7 +35920,7 @@ function Me(e, n) {
|
|
|
35920
35920
|
r2,
|
|
35921
35921
|
this.editor,
|
|
35922
35922
|
e.type
|
|
35923
|
-
), i = ((l = this.options.domAttributes) == null ? void 0 : l.blockContent) || {}, a = n.render(s, r2), c = Ne$
|
|
35923
|
+
), i = ((l = this.options.domAttributes) == null ? void 0 : l.blockContent) || {}, a = n.render(s, r2), c = Ne$2(
|
|
35924
35924
|
a,
|
|
35925
35925
|
s.type,
|
|
35926
35926
|
s.props,
|
|
@@ -35941,7 +35941,7 @@ function Me(e, n) {
|
|
|
35941
35941
|
toInternalHTML: (o, r2) => {
|
|
35942
35942
|
var a;
|
|
35943
35943
|
const s = ((a = t2.options.domAttributes) == null ? void 0 : a.blockContent) || {}, i = n.render(o, r2);
|
|
35944
|
-
return Ne$
|
|
35944
|
+
return Ne$2(
|
|
35945
35945
|
i,
|
|
35946
35946
|
o.type,
|
|
35947
35947
|
o.props,
|
|
@@ -35960,7 +35960,7 @@ function Me(e, n) {
|
|
|
35960
35960
|
o,
|
|
35961
35961
|
r2
|
|
35962
35962
|
);
|
|
35963
|
-
return i === void 0 && (i = n.render(o, r2)), Ne$
|
|
35963
|
+
return i === void 0 && (i = n.render(o, r2)), Ne$2(
|
|
35964
35964
|
i,
|
|
35965
35965
|
o.type,
|
|
35966
35966
|
o.props,
|
|
@@ -36064,7 +36064,7 @@ function v(e) {
|
|
|
36064
36064
|
const n = Z(e.doc, e.selection.anchor);
|
|
36065
36065
|
return ne$1(n);
|
|
36066
36066
|
}
|
|
36067
|
-
function qe$
|
|
36067
|
+
function qe$3(e) {
|
|
36068
36068
|
const n = Z(e.doc, e.selection.anchor);
|
|
36069
36069
|
return ne$1(n);
|
|
36070
36070
|
}
|
|
@@ -36080,7 +36080,7 @@ function Te(e) {
|
|
|
36080
36080
|
function vt$2(e) {
|
|
36081
36081
|
return Te(e).blockSchema;
|
|
36082
36082
|
}
|
|
36083
|
-
function St$
|
|
36083
|
+
function St$3(e) {
|
|
36084
36084
|
return Te(e).inlineContentSchema;
|
|
36085
36085
|
}
|
|
36086
36086
|
function ke(e) {
|
|
@@ -36143,7 +36143,7 @@ function Ke$2(e, n, t2) {
|
|
|
36143
36143
|
if (ue(r2))
|
|
36144
36144
|
r2.text += `
|
|
36145
36145
|
`;
|
|
36146
|
-
else if (Ot$
|
|
36146
|
+
else if (Ot$2(r2))
|
|
36147
36147
|
r2.content[r2.content.length - 1].text += `
|
|
36148
36148
|
`;
|
|
36149
36149
|
else
|
|
@@ -36200,7 +36200,7 @@ function Ke$2(e, n, t2) {
|
|
|
36200
36200
|
type: "text",
|
|
36201
36201
|
text: s.textContent,
|
|
36202
36202
|
styles: i
|
|
36203
|
-
}) : Ot$
|
|
36203
|
+
}) : Ot$2(r2) && (a ? r2.href === a.attrs.href ? JSON.stringify(
|
|
36204
36204
|
r2.content[r2.content.length - 1].styles
|
|
36205
36205
|
) === JSON.stringify(i) ? r2.content[r2.content.length - 1].text += s.textContent : r2.content.push({
|
|
36206
36206
|
type: "text",
|
|
@@ -36258,7 +36258,7 @@ function lt$1(e, n, t2) {
|
|
|
36258
36258
|
content: s
|
|
36259
36259
|
};
|
|
36260
36260
|
}
|
|
36261
|
-
function E(e, n, t2 = vt$2(n), o = St$
|
|
36261
|
+
function E(e, n, t2 = vt$2(n), o = St$3(n), r2 = ke(n), s = Et$1(n)) {
|
|
36262
36262
|
var g;
|
|
36263
36263
|
if (!e.type.isInGroup("bnBlock"))
|
|
36264
36264
|
throw Error("Node should be a bnBlock, but is instead: " + e.type.name);
|
|
@@ -36322,7 +36322,7 @@ function E(e, n, t2 = vt$2(n), o = St$2(n), r2 = ke(n), s = Et$1(n)) {
|
|
|
36322
36322
|
};
|
|
36323
36323
|
return s == null || s.set(e, m2), m2;
|
|
36324
36324
|
}
|
|
36325
|
-
function mr$1(e, n, t2 = vt$2(n), o = St$
|
|
36325
|
+
function mr$1(e, n, t2 = vt$2(n), o = St$3(n), r2 = ke(n), s = Et$1(n)) {
|
|
36326
36326
|
const i = [];
|
|
36327
36327
|
return e.firstChild.descendants((a) => (i.push(
|
|
36328
36328
|
E(
|
|
@@ -36335,7 +36335,7 @@ function mr$1(e, n, t2 = vt$2(n), o = St$2(n), r2 = ke(n), s = Et$1(n)) {
|
|
|
36335
36335
|
)
|
|
36336
36336
|
), false)), i;
|
|
36337
36337
|
}
|
|
36338
|
-
function gr$1(e, n, t2 = vt$2(n), o = St$
|
|
36338
|
+
function gr$1(e, n, t2 = vt$2(n), o = St$3(n), r2 = ke(n), s = Et$1(n)) {
|
|
36339
36339
|
function i(a, c, l) {
|
|
36340
36340
|
if (a.type.name !== "blockGroup")
|
|
36341
36341
|
throw new Error("unexpected");
|
|
@@ -36430,7 +36430,7 @@ function vn(e) {
|
|
|
36430
36430
|
);
|
|
36431
36431
|
}
|
|
36432
36432
|
function se$2(e) {
|
|
36433
|
-
const { height: n, width: t2 } = Bt$
|
|
36433
|
+
const { height: n, width: t2 } = Bt$2(e), o = new Array(n).fill(false).map(() => new Array(t2).fill(null)), r2 = (s, i) => {
|
|
36434
36434
|
for (let a = s; a < n; a++)
|
|
36435
36435
|
for (let c = i; c < t2; c++)
|
|
36436
36436
|
if (!o[a][c])
|
|
@@ -36441,7 +36441,7 @@ function se$2(e) {
|
|
|
36441
36441
|
};
|
|
36442
36442
|
for (let s = 0; s < e.content.rows.length; s++)
|
|
36443
36443
|
for (let i = 0; i < e.content.rows[s].cells.length; i++) {
|
|
36444
|
-
const a = at$
|
|
36444
|
+
const a = at$2(e.content.rows[s].cells[i]), c = ct$1(a), l = ve$1(a), { row: d, col: u } = r2(s, i);
|
|
36445
36445
|
for (let p2 = d; p2 < d + c; p2++)
|
|
36446
36446
|
for (let f = u; f < u + l; f++) {
|
|
36447
36447
|
if (o[p2][f])
|
|
@@ -36459,7 +36459,7 @@ function se$2(e) {
|
|
|
36459
36459
|
}
|
|
36460
36460
|
return o;
|
|
36461
36461
|
}
|
|
36462
|
-
function Se
|
|
36462
|
+
function Se(e) {
|
|
36463
36463
|
const n = /* @__PURE__ */ new Set();
|
|
36464
36464
|
return e.map((t2) => ({
|
|
36465
36465
|
cells: t2.map((o) => n.has(o.row + ":" + o.col) ? false : (n.add(o.row + ":" + o.col), o.cell)).filter((o) => o !== false)
|
|
@@ -36476,7 +36476,7 @@ function he(e, n, t2 = se$2(n)) {
|
|
|
36476
36476
|
`Unable to resolve relative table cell indices for table, cell at ${e.row},${e.col} is not occupied`
|
|
36477
36477
|
);
|
|
36478
36478
|
}
|
|
36479
|
-
function Bt$
|
|
36479
|
+
function Bt$2(e) {
|
|
36480
36480
|
const n = e.content.rows.length;
|
|
36481
36481
|
let t2 = 0;
|
|
36482
36482
|
return e.content.rows.forEach((o) => {
|
|
@@ -36557,7 +36557,7 @@ function Er$1(e, n, t2, o = se$2(e)) {
|
|
|
36557
36557
|
return o.forEach((i) => {
|
|
36558
36558
|
const [a] = i.splice(r2, 1);
|
|
36559
36559
|
i.splice(s, 0, a);
|
|
36560
|
-
}), Se
|
|
36560
|
+
}), Se(o);
|
|
36561
36561
|
}
|
|
36562
36562
|
function Br$1(e, n, t2, o = se$2(e)) {
|
|
36563
36563
|
const { row: r2 } = he(
|
|
@@ -36575,7 +36575,7 @@ function Br$1(e, n, t2, o = se$2(e)) {
|
|
|
36575
36575
|
e,
|
|
36576
36576
|
o
|
|
36577
36577
|
), [i] = o.splice(r2, 1);
|
|
36578
|
-
return o.splice(s, 0, i), Se
|
|
36578
|
+
return o.splice(s, 0, i), Se(o);
|
|
36579
36579
|
}
|
|
36580
36580
|
function ht$1(e) {
|
|
36581
36581
|
return e ? Ce$1(e) ? ht$1(e.content) : typeof e == "string" ? e.length === 0 : Array.isArray(e) ? e.every(
|
|
@@ -36596,7 +36596,7 @@ function xr$1(e, n, t2 = se$2(e)) {
|
|
|
36596
36596
|
);
|
|
36597
36597
|
t2[i] = t2[i].slice(0, a);
|
|
36598
36598
|
}
|
|
36599
|
-
return Se
|
|
36599
|
+
return Se(t2);
|
|
36600
36600
|
}
|
|
36601
36601
|
let o = 0;
|
|
36602
36602
|
for (let s = t2.length - 1; s >= 0 && t2[s].every(
|
|
@@ -36604,10 +36604,10 @@ function xr$1(e, n, t2 = se$2(e)) {
|
|
|
36604
36604
|
); s--)
|
|
36605
36605
|
o++;
|
|
36606
36606
|
const r2 = Math.min(o, t2.length - 1);
|
|
36607
|
-
return t2.splice(t2.length - r2, r2), Se
|
|
36607
|
+
return t2.splice(t2.length - r2, r2), Se(t2);
|
|
36608
36608
|
}
|
|
36609
36609
|
function Mr$1(e, n, t2, o = se$2(e)) {
|
|
36610
|
-
const { width: r2, height: s } = Bt$
|
|
36610
|
+
const { width: r2, height: s } = Bt$2(e);
|
|
36611
36611
|
if (n === "columns")
|
|
36612
36612
|
o.forEach((i, a) => {
|
|
36613
36613
|
if (t2 >= 0)
|
|
@@ -36617,7 +36617,7 @@ function Mr$1(e, n, t2, o = se$2(e)) {
|
|
|
36617
36617
|
col: Math.max(...i.map((l) => l.col)) + 1,
|
|
36618
36618
|
rowspan: 1,
|
|
36619
36619
|
colspan: 1,
|
|
36620
|
-
cell: at$
|
|
36620
|
+
cell: at$2("")
|
|
36621
36621
|
});
|
|
36622
36622
|
else
|
|
36623
36623
|
i.splice(r2 + t2, -1 * t2);
|
|
@@ -36629,12 +36629,12 @@ function Mr$1(e, n, t2, o = se$2(e)) {
|
|
|
36629
36629
|
col: l,
|
|
36630
36630
|
rowspan: 1,
|
|
36631
36631
|
colspan: 1,
|
|
36632
|
-
cell: at$
|
|
36632
|
+
cell: at$2("")
|
|
36633
36633
|
}));
|
|
36634
36634
|
o.push(a);
|
|
36635
36635
|
}
|
|
36636
36636
|
else t2 < 0 && o.splice(s + t2, -1 * t2);
|
|
36637
|
-
return Se
|
|
36637
|
+
return Se(o);
|
|
36638
36638
|
}
|
|
36639
36639
|
function En(e, n, t2) {
|
|
36640
36640
|
const o = dt$1(e, t2);
|
|
@@ -37152,7 +37152,7 @@ const In = (e, n, t2, o, r2, s, i) => {
|
|
|
37152
37152
|
r2,
|
|
37153
37153
|
s
|
|
37154
37154
|
), a;
|
|
37155
|
-
}, Xe$
|
|
37155
|
+
}, Xe$3 = (e, n) => {
|
|
37156
37156
|
const t2 = DOMSerializer.fromSchema(e);
|
|
37157
37157
|
return {
|
|
37158
37158
|
exportBlocks: (o, r2) => {
|
|
@@ -37278,7 +37278,7 @@ function $r$1(e) {
|
|
|
37278
37278
|
type: e.getMeta("history$").redo ? "redo" : "undo"
|
|
37279
37279
|
} : e.getMeta("y-sync$") ? e.getMeta("y-sync$").isUndoRedoOperation ? { type: "undo-redo" } : { type: "yjs-remote" } : { type: "local" };
|
|
37280
37280
|
}
|
|
37281
|
-
function Ft$
|
|
37281
|
+
function Ft$2(e) {
|
|
37282
37282
|
const n = "__root__", t2 = {}, o = {}, r2 = N(e);
|
|
37283
37283
|
return e.descendants((s, i) => {
|
|
37284
37284
|
if (!xt$2(s))
|
|
@@ -37325,9 +37325,9 @@ function Nn(e, n = []) {
|
|
|
37325
37325
|
const t2 = $r$1(e), o = combineTransactionSteps(e.before, [
|
|
37326
37326
|
e,
|
|
37327
37327
|
...n
|
|
37328
|
-
]), r2 = Ft$
|
|
37328
|
+
]), r2 = Ft$2(
|
|
37329
37329
|
o.before
|
|
37330
|
-
), s = Ft$
|
|
37330
|
+
), s = Ft$2(
|
|
37331
37331
|
o.doc
|
|
37332
37332
|
), i = [], a = /* @__PURE__ */ new Set();
|
|
37333
37333
|
Object.keys(s.byId).filter((f) => !(f in r2.byId)).forEach((f) => {
|
|
@@ -37387,7 +37387,7 @@ function Nn(e, n = []) {
|
|
|
37387
37387
|
});
|
|
37388
37388
|
}), i;
|
|
37389
37389
|
}
|
|
37390
|
-
const Je$
|
|
37390
|
+
const Je$2 = (e, n) => {
|
|
37391
37391
|
const t2 = e.querySelector(
|
|
37392
37392
|
n
|
|
37393
37393
|
);
|
|
@@ -37484,7 +37484,7 @@ const Je$3 = (e, n) => {
|
|
|
37484
37484
|
return o.textContent = n, t2.appendChild(e), t2.appendChild(o), {
|
|
37485
37485
|
dom: t2
|
|
37486
37486
|
};
|
|
37487
|
-
}, zt = (e) => ({ url: e.src || void 0 }), Gr$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>', qr$1 = {
|
|
37487
|
+
}, zt$1 = (e) => ({ url: e.src || void 0 }), Gr$1 = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>', qr$1 = {
|
|
37488
37488
|
backgroundColor: P.backgroundColor,
|
|
37489
37489
|
// File name.
|
|
37490
37490
|
name: {
|
|
@@ -37522,14 +37522,14 @@ const Je$3 = (e, n) => {
|
|
|
37522
37522
|
);
|
|
37523
37523
|
}, Xr$1 = (e) => {
|
|
37524
37524
|
if (e.tagName === "AUDIO")
|
|
37525
|
-
return e.closest("figure") ? void 0 : zt(e);
|
|
37525
|
+
return e.closest("figure") ? void 0 : zt$1(e);
|
|
37526
37526
|
if (e.tagName === "FIGURE") {
|
|
37527
|
-
const n = Je$
|
|
37527
|
+
const n = Je$2(e, "audio");
|
|
37528
37528
|
if (!n)
|
|
37529
37529
|
return;
|
|
37530
37530
|
const { targetElement: t2, caption: o } = n;
|
|
37531
37531
|
return {
|
|
37532
|
-
...zt(t2),
|
|
37532
|
+
...zt$1(t2),
|
|
37533
37533
|
caption: o
|
|
37534
37534
|
};
|
|
37535
37535
|
}
|
|
@@ -37794,7 +37794,7 @@ const ns = Mark2.create({
|
|
|
37794
37794
|
renderHTML({ HTMLAttributes: e }) {
|
|
37795
37795
|
return ["span", e, 0];
|
|
37796
37796
|
}
|
|
37797
|
-
}), ss = ae$2(rs, "string"), jt
|
|
37797
|
+
}), ss = ae$2(rs, "string"), jt = (e) => ({ url: e.src || void 0 }), is = {
|
|
37798
37798
|
backgroundColor: P.backgroundColor,
|
|
37799
37799
|
// File name.
|
|
37800
37800
|
name: {
|
|
@@ -37815,14 +37815,14 @@ const ns = Mark2.create({
|
|
|
37815
37815
|
isFileBlock: true
|
|
37816
37816
|
}, cs = (e, n) => Mt$2(e, n), ls = (e) => {
|
|
37817
37817
|
if (e.tagName === "EMBED")
|
|
37818
|
-
return e.closest("figure") ? void 0 : jt
|
|
37818
|
+
return e.closest("figure") ? void 0 : jt(e);
|
|
37819
37819
|
if (e.tagName === "FIGURE") {
|
|
37820
|
-
const n = Je$
|
|
37820
|
+
const n = Je$2(e, "embed");
|
|
37821
37821
|
if (!n)
|
|
37822
37822
|
return;
|
|
37823
37823
|
const { targetElement: t2, caption: o } = n;
|
|
37824
37824
|
return {
|
|
37825
|
-
...jt
|
|
37825
|
+
...jt(t2),
|
|
37826
37826
|
caption: o
|
|
37827
37827
|
};
|
|
37828
37828
|
}
|
|
@@ -38126,7 +38126,7 @@ const ns = Mark2.create({
|
|
|
38126
38126
|
if (e.tagName === "IMG")
|
|
38127
38127
|
return e.closest("figure") ? void 0 : Gt(e);
|
|
38128
38128
|
if (e.tagName === "FIGURE") {
|
|
38129
|
-
const n = Je$
|
|
38129
|
+
const n = Je$2(e, "img");
|
|
38130
38130
|
if (!n)
|
|
38131
38131
|
return;
|
|
38132
38132
|
const { targetElement: t2, caption: o } = n;
|
|
@@ -38171,9 +38171,9 @@ const ns = Mark2.create({
|
|
|
38171
38171
|
}
|
|
38172
38172
|
];
|
|
38173
38173
|
return r2 && o.tr.split(e, 2, a), true;
|
|
38174
|
-
}, Qe$
|
|
38174
|
+
}, Qe$3 = (e) => {
|
|
38175
38175
|
const { blockInfo: n, selectionEmpty: t2 } = e.transact((s) => ({
|
|
38176
|
-
blockInfo: qe$
|
|
38176
|
+
blockInfo: qe$3(s),
|
|
38177
38177
|
selectionEmpty: s.selection.anchor === s.selection.head
|
|
38178
38178
|
}));
|
|
38179
38179
|
if (!n.isBlockContainer)
|
|
@@ -38206,7 +38206,7 @@ const ns = Mark2.create({
|
|
|
38206
38206
|
priority: 90,
|
|
38207
38207
|
addKeyboardShortcuts() {
|
|
38208
38208
|
return {
|
|
38209
|
-
Enter: () => Qe$
|
|
38209
|
+
Enter: () => Qe$3(this.options.editor),
|
|
38210
38210
|
"Mod-Shift-6": () => {
|
|
38211
38211
|
const e = v(this.editor.state);
|
|
38212
38212
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? true : this.editor.commands.command(
|
|
@@ -38325,7 +38325,7 @@ const xs = {
|
|
|
38325
38325
|
},
|
|
38326
38326
|
addKeyboardShortcuts() {
|
|
38327
38327
|
return {
|
|
38328
|
-
Enter: () => Qe$
|
|
38328
|
+
Enter: () => Qe$3(this.options.editor),
|
|
38329
38329
|
"Mod-Shift-8": () => {
|
|
38330
38330
|
const e = v(this.editor.state);
|
|
38331
38331
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? true : this.editor.commands.command(
|
|
@@ -38426,7 +38426,7 @@ const xs = {
|
|
|
38426
38426
|
},
|
|
38427
38427
|
addKeyboardShortcuts() {
|
|
38428
38428
|
return {
|
|
38429
|
-
Enter: () => Qe$
|
|
38429
|
+
Enter: () => Qe$3(this.options.editor),
|
|
38430
38430
|
"Mod-Shift-9": () => {
|
|
38431
38431
|
const e = v(this.editor.state);
|
|
38432
38432
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? true : this.editor.commands.command(
|
|
@@ -38646,7 +38646,7 @@ const xs = {
|
|
|
38646
38646
|
},
|
|
38647
38647
|
addKeyboardShortcuts() {
|
|
38648
38648
|
return {
|
|
38649
|
-
Enter: () => Qe$
|
|
38649
|
+
Enter: () => Qe$3(this.options.editor),
|
|
38650
38650
|
"Mod-Shift-7": () => {
|
|
38651
38651
|
const e = v(this.editor.state);
|
|
38652
38652
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? true : this.editor.commands.command(
|
|
@@ -38994,7 +38994,7 @@ const xs = {
|
|
|
38994
38994
|
];
|
|
38995
38995
|
}
|
|
38996
38996
|
});
|
|
38997
|
-
function qt
|
|
38997
|
+
function qt(e, n) {
|
|
38998
38998
|
const o = DOMParser$1.fromSchema(n).parse(e, {
|
|
38999
38999
|
topNode: n.nodes.blockGroup.create()
|
|
39000
39000
|
}), r2 = [];
|
|
@@ -39024,7 +39024,7 @@ const qs = Q(
|
|
|
39024
39024
|
tag: "th",
|
|
39025
39025
|
// As `th` elements can contain multiple paragraphs, we need to merge their contents
|
|
39026
39026
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
39027
|
-
getContent: (e, n) => qt
|
|
39027
|
+
getContent: (e, n) => qt(e, n)
|
|
39028
39028
|
}
|
|
39029
39029
|
];
|
|
39030
39030
|
}
|
|
@@ -39037,7 +39037,7 @@ const qs = Q(
|
|
|
39037
39037
|
tag: "td",
|
|
39038
39038
|
// As `td` elements can contain multiple paragraphs, we need to merge their contents
|
|
39039
39039
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
39040
|
-
getContent: (e, n) => qt
|
|
39040
|
+
getContent: (e, n) => qt(e, n)
|
|
39041
39041
|
}
|
|
39042
39042
|
];
|
|
39043
39043
|
}
|
|
@@ -39096,7 +39096,7 @@ const qs = Q(
|
|
|
39096
39096
|
if (e.tagName === "VIDEO")
|
|
39097
39097
|
return e.closest("figure") ? void 0 : Kt(e);
|
|
39098
39098
|
if (e.tagName === "FIGURE") {
|
|
39099
|
-
const n = Je$
|
|
39099
|
+
const n = Je$2(e, "video");
|
|
39100
39100
|
if (!n)
|
|
39101
39101
|
return;
|
|
39102
39102
|
const { targetElement: t2, caption: o } = n;
|
|
@@ -39648,13 +39648,13 @@ function ki$1(e) {
|
|
|
39648
39648
|
}
|
|
39649
39649
|
function wi$1(e) {
|
|
39650
39650
|
return e.transact((n) => {
|
|
39651
|
-
const { bnBlock: t2 } = qe$
|
|
39651
|
+
const { bnBlock: t2 } = qe$3(n);
|
|
39652
39652
|
return n.doc.resolve(t2.beforePos).nodeBefore !== null;
|
|
39653
39653
|
});
|
|
39654
39654
|
}
|
|
39655
39655
|
function yi$1(e) {
|
|
39656
39656
|
return e.transact((n) => {
|
|
39657
|
-
const { bnBlock: t2 } = qe$
|
|
39657
|
+
const { bnBlock: t2 } = qe$3(n);
|
|
39658
39658
|
return n.doc.resolve(t2.beforePos).depth > 1;
|
|
39659
39659
|
});
|
|
39660
39660
|
}
|
|
@@ -39797,7 +39797,7 @@ function Pi(e) {
|
|
|
39797
39797
|
};
|
|
39798
39798
|
}
|
|
39799
39799
|
function Ti$1(e) {
|
|
39800
|
-
const { bnBlock: n } = qe$
|
|
39800
|
+
const { bnBlock: n } = qe$3(e), t2 = N(e.doc), o = e.doc.resolve(n.beforePos), r2 = o.nodeBefore, s = e.doc.resolve(n.afterPos).nodeAfter;
|
|
39801
39801
|
let i;
|
|
39802
39802
|
return o.depth > 1 && (i = o.node(), i.type.isInGroup("bnBlock") || (i = o.node(o.depth - 1))), {
|
|
39803
39803
|
block: E(n.node, t2),
|
|
@@ -39841,16 +39841,16 @@ async function et$2() {
|
|
|
39841
39841
|
if (fe$1)
|
|
39842
39842
|
return fe$1;
|
|
39843
39843
|
const e = await Promise.all([
|
|
39844
|
-
import("./index-
|
|
39845
|
-
import("./index-
|
|
39846
|
-
import("./index-
|
|
39847
|
-
import("./index-
|
|
39848
|
-
import("./index-
|
|
39849
|
-
import("./index-
|
|
39850
|
-
import("./index-
|
|
39851
|
-
import("./index-
|
|
39852
|
-
import("./index-
|
|
39853
|
-
import("./index-
|
|
39844
|
+
import("./index-Bc01rI6H.js"),
|
|
39845
|
+
import("./index-BizrRIYC.js"),
|
|
39846
|
+
import("./index-CiVIUf6O.js"),
|
|
39847
|
+
import("./index-BsuzxemZ.js"),
|
|
39848
|
+
import("./index-DKHwiy00.js"),
|
|
39849
|
+
import("./index-Z-_GOl6e.js"),
|
|
39850
|
+
import("./index-B4raOCHT.js"),
|
|
39851
|
+
import("./index-C1TGA2tr.js"),
|
|
39852
|
+
import("./index-0V-Agbf4.js"),
|
|
39853
|
+
import("./index-DX00UPm6.js")
|
|
39854
39854
|
]);
|
|
39855
39855
|
return fe$1 = {
|
|
39856
39856
|
rehypeParse: e[0],
|
|
@@ -39915,7 +39915,7 @@ function It$1(e) {
|
|
|
39915
39915
|
}
|
|
39916
39916
|
async function Ai(e, n, t2, o) {
|
|
39917
39917
|
await et$2();
|
|
39918
|
-
const s = Xe$
|
|
39918
|
+
const s = Xe$3(n, t2).exportBlocks(e, o);
|
|
39919
39919
|
return It$1(s);
|
|
39920
39920
|
}
|
|
39921
39921
|
function Ni(e) {
|
|
@@ -39949,9 +39949,9 @@ function Oi(e) {
|
|
|
39949
39949
|
r2.append(o.nextElementSibling);
|
|
39950
39950
|
});
|
|
39951
39951
|
}
|
|
39952
|
-
let Xt
|
|
39952
|
+
let Xt = null;
|
|
39953
39953
|
function Ri() {
|
|
39954
|
-
return Xt
|
|
39954
|
+
return Xt || (Xt = document.implementation.createHTMLDocument("title"));
|
|
39955
39955
|
}
|
|
39956
39956
|
function Jn$1(e) {
|
|
39957
39957
|
if (typeof e == "string") {
|
|
@@ -40216,7 +40216,7 @@ const sa = (e, n) => Extension.create({
|
|
|
40216
40216
|
];
|
|
40217
40217
|
}
|
|
40218
40218
|
});
|
|
40219
|
-
function to$
|
|
40219
|
+
function to$2(e) {
|
|
40220
40220
|
const n = [];
|
|
40221
40221
|
return e.descendants((t2) => {
|
|
40222
40222
|
var r2, s;
|
|
@@ -40243,7 +40243,7 @@ function ia(e, n, t2) {
|
|
|
40243
40243
|
) === void 0, o && (n = c);
|
|
40244
40244
|
}
|
|
40245
40245
|
let s;
|
|
40246
|
-
const i = Xe$
|
|
40246
|
+
const i = Xe$3(
|
|
40247
40247
|
e.state.schema,
|
|
40248
40248
|
t2
|
|
40249
40249
|
);
|
|
@@ -40266,7 +40266,7 @@ function ia(e, n, t2) {
|
|
|
40266
40266
|
);
|
|
40267
40267
|
s = i.exportInlineContent(c, {});
|
|
40268
40268
|
} else {
|
|
40269
|
-
const c = to$
|
|
40269
|
+
const c = to$2(n);
|
|
40270
40270
|
s = i.exportBlocks(c, {});
|
|
40271
40271
|
}
|
|
40272
40272
|
return s;
|
|
@@ -40297,7 +40297,7 @@ const Zt$2 = () => {
|
|
|
40297
40297
|
n = n.parentElement;
|
|
40298
40298
|
}
|
|
40299
40299
|
return false;
|
|
40300
|
-
}, Qt
|
|
40300
|
+
}, Qt = (e, n, t2) => {
|
|
40301
40301
|
t2.preventDefault(), t2.clipboardData.clearData();
|
|
40302
40302
|
const { clipboardHTML: o, externalHTML: r2, markdown: s } = no$1(
|
|
40303
40303
|
n,
|
|
@@ -40312,10 +40312,10 @@ const Zt$2 = () => {
|
|
|
40312
40312
|
props: {
|
|
40313
40313
|
handleDOMEvents: {
|
|
40314
40314
|
copy(n, t2) {
|
|
40315
|
-
return Zt$2() || Qt
|
|
40315
|
+
return Zt$2() || Qt(e, n, t2), true;
|
|
40316
40316
|
},
|
|
40317
40317
|
cut(n, t2) {
|
|
40318
|
-
return Zt$2() || (Qt
|
|
40318
|
+
return Zt$2() || (Qt(e, n, t2), n.editable && n.dispatch(n.state.tr.deleteSelection())), true;
|
|
40319
40319
|
},
|
|
40320
40320
|
// This is for the use-case in which only a block without content
|
|
40321
40321
|
// is selected, e.g. an image block, and dragged (not using the
|
|
@@ -40505,7 +40505,7 @@ h(me, "defaultCursorRender", (t2) => {
|
|
|
40505
40505
|
`background-color: ${t2.color}; color: ${me.isDarkColor(t2.color) ? "white" : "black"}`
|
|
40506
40506
|
), s.insertBefore(document.createTextNode(t2.name), null), r2.insertBefore(s, null), o.insertBefore(document.createTextNode(""), null), o.insertBefore(r2, null), o.insertBefore(document.createTextNode(""), null), o;
|
|
40507
40507
|
});
|
|
40508
|
-
let ze$
|
|
40508
|
+
let ze$1 = me;
|
|
40509
40509
|
let mt$1 = class mt extends L$1 {
|
|
40510
40510
|
static key() {
|
|
40511
40511
|
return "ySyncPlugin";
|
|
@@ -41913,7 +41913,7 @@ function so$1(e, n) {
|
|
|
41913
41913
|
if (((o = e.getAttribute) == null ? void 0 : o.call(e, "data-node-type")) === "blockContainer")
|
|
41914
41914
|
return { node: e, id: e.getAttribute("data-id") };
|
|
41915
41915
|
}
|
|
41916
|
-
let ce$
|
|
41916
|
+
let ce$1 = class ce extends Selection {
|
|
41917
41917
|
constructor(t2, o) {
|
|
41918
41918
|
super(t2, o);
|
|
41919
41919
|
h(this, "nodes");
|
|
@@ -41948,7 +41948,7 @@ let ce$2 = class ce extends Selection {
|
|
|
41948
41948
|
return { type: "multiple-node", anchor: this.anchor, head: this.head };
|
|
41949
41949
|
}
|
|
41950
41950
|
};
|
|
41951
|
-
Selection.jsonID("multiple-node", ce$
|
|
41951
|
+
Selection.jsonID("multiple-node", ce$1);
|
|
41952
41952
|
let j;
|
|
41953
41953
|
function Da(e, n) {
|
|
41954
41954
|
let t2, o;
|
|
@@ -41998,13 +41998,13 @@ function Oa(e, n, t2) {
|
|
|
41998
41998
|
throw new Error(`Block with ID ${n.id} not found`);
|
|
41999
41999
|
const s = r2.posBeforeNode;
|
|
42000
42000
|
if (s != null) {
|
|
42001
|
-
const i = o.state.selection, a = o.state.doc, { from: c, to: l } = Da(i, a), d = c <= s && s < l, u = i.$anchor.node() !== i.$head.node() || i instanceof ce$
|
|
42001
|
+
const i = o.state.selection, a = o.state.doc, { from: c, to: l } = Da(i, a), d = c <= s && s < l, u = i.$anchor.node() !== i.$head.node() || i instanceof ce$1;
|
|
42002
42002
|
d && u ? (o.dispatch(
|
|
42003
|
-
o.state.tr.setSelection(ce$
|
|
42003
|
+
o.state.tr.setSelection(ce$1.create(a, c, l))
|
|
42004
42004
|
), rn(o, c, l)) : (o.dispatch(
|
|
42005
42005
|
o.state.tr.setSelection(NodeSelection.create(o.state.doc, s))
|
|
42006
42006
|
), rn(o, s));
|
|
42007
|
-
const p2 = o.state.selection.content(), f = t2.pmSchema, m2 = o.serializeForClipboard(p2).dom.innerHTML, g = Xe$
|
|
42007
|
+
const p2 = o.state.selection.content(), f = t2.pmSchema, m2 = o.serializeForClipboard(p2).dom.innerHTML, g = Xe$3(f, t2), b = to$2(p2.content), k2 = g.exportBlocks(b, {}), w = It$1(k2);
|
|
42008
42008
|
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", m2), e.dataTransfer.setData("text/html", k2), e.dataTransfer.setData("text/plain", w), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(j, 0, 0);
|
|
42009
42009
|
}
|
|
42010
42010
|
}
|
|
@@ -42708,7 +42708,7 @@ function an(e) {
|
|
|
42708
42708
|
function Ya(e) {
|
|
42709
42709
|
V && (e instanceof Document ? e.body.removeChild(V) : e.removeChild(V), V = void 0);
|
|
42710
42710
|
}
|
|
42711
|
-
function Oe$
|
|
42711
|
+
function Oe$2(e) {
|
|
42712
42712
|
return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
|
|
42713
42713
|
}
|
|
42714
42714
|
function Xa(e) {
|
|
@@ -42804,7 +42804,7 @@ class Za {
|
|
|
42804
42804
|
referencePosCell: w || (g = this.state) == null ? void 0 : g.referencePosCell
|
|
42805
42805
|
};
|
|
42806
42806
|
} else {
|
|
42807
|
-
const b = Oe$
|
|
42807
|
+
const b = Oe$2(t3.domNode), k2 = Oe$2(t3.domNode.parentElement), w = t3.domNode.getBoundingClientRect();
|
|
42808
42808
|
if (this.state !== void 0 && this.state.show && this.tableId === r2.id && this.state.rowIndex === k2 && this.state.colIndex === b)
|
|
42809
42809
|
return;
|
|
42810
42810
|
this.state = {
|
|
@@ -42846,7 +42846,7 @@ class Za {
|
|
|
42846
42846
|
return;
|
|
42847
42847
|
const r2 = o2[0];
|
|
42848
42848
|
let s = false;
|
|
42849
|
-
const i = Oe$
|
|
42849
|
+
const i = Oe$2(r2.parentElement), a = Oe$2(r2), c = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, d = (this.state.draggingState.draggedCellOrientation === "row" ? i : a) !== c;
|
|
42850
42850
|
(this.state.rowIndex !== i || this.state.colIndex !== a) && (this.state.rowIndex = i, this.state.colIndex = a, this.state.referencePosCell = r2.getBoundingClientRect(), s = true);
|
|
42851
42851
|
const u = this.state.draggingState.draggedCellOrientation === "row" ? t3.top : t3.left;
|
|
42852
42852
|
this.state.draggingState.mousePos !== u && (this.state.draggingState.mousePos = u, s = true), s && this.emitUpdate(), d && this.editor.transact((f) => f.setMeta(ye$1, true));
|
|
@@ -42925,7 +42925,7 @@ class Za {
|
|
|
42925
42925
|
this.state.show = false, this.state.showAddOrRemoveRowsButton = false, this.state.showAddOrRemoveColumnsButton = false, this.emitUpdate();
|
|
42926
42926
|
return;
|
|
42927
42927
|
}
|
|
42928
|
-
const { height: n, width: t2 } = Bt$
|
|
42928
|
+
const { height: n, width: t2 } = Bt$2(
|
|
42929
42929
|
this.state.block
|
|
42930
42930
|
);
|
|
42931
42931
|
this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= n && (this.state.rowIndex = n - 1), this.state.colIndex >= t2 && (this.state.colIndex = t2 - 1));
|
|
@@ -43419,7 +43419,7 @@ class ac extends L$1 {
|
|
|
43419
43419
|
return;
|
|
43420
43420
|
this.editor._tiptapEditor.unregisterPlugin(ySyncPluginKey), this.editor._tiptapEditor.unregisterPlugin(yUndoPluginKey);
|
|
43421
43421
|
const { originalFragment: o, forkedFragment: r2, undoStack: s } = this.forkedState;
|
|
43422
|
-
if (this.editor.extensions.ySyncPlugin = new mt$1(o), this.editor.extensions.yCursorPlugin = new ze$
|
|
43422
|
+
if (this.editor.extensions.ySyncPlugin = new mt$1(o), this.editor.extensions.yCursorPlugin = new ze$1(
|
|
43423
43423
|
this.collaboration
|
|
43424
43424
|
), this.editor.extensions.yUndoPlugin = new gt$1({
|
|
43425
43425
|
editor: this.editor
|
|
@@ -43446,7 +43446,7 @@ const cc = (e) => {
|
|
|
43446
43446
|
const n = {}, t2 = lc(e);
|
|
43447
43447
|
for (const s of t2)
|
|
43448
43448
|
n[s.name] = s;
|
|
43449
|
-
e.collaboration && (n.ySyncPlugin = new mt$1(e.collaboration.fragment), n.yUndoPlugin = new gt$1({ editor: e.editor }), (r2 = e.collaboration.provider) != null && r2.awareness && (n.yCursorPlugin = new ze$
|
|
43449
|
+
e.collaboration && (n.ySyncPlugin = new mt$1(e.collaboration.fragment), n.yUndoPlugin = new gt$1({ editor: e.editor }), (r2 = e.collaboration.provider) != null && r2.awareness && (n.yCursorPlugin = new ze$1(e.collaboration)), n.forkYDocPlugin = new ac({
|
|
43450
43450
|
editor: e.editor,
|
|
43451
43451
|
collaboration: e.collaboration
|
|
43452
43452
|
})), n.formattingToolbar = new ka(
|
|
@@ -43617,7 +43617,7 @@ function pc(e, n) {
|
|
|
43617
43617
|
}
|
|
43618
43618
|
return true;
|
|
43619
43619
|
}
|
|
43620
|
-
const je$
|
|
43620
|
+
const je$2 = class je extends Editor {
|
|
43621
43621
|
constructor(t2, o) {
|
|
43622
43622
|
super({ ...t2, content: void 0 });
|
|
43623
43623
|
h(this, "_state");
|
|
@@ -43752,18 +43752,18 @@ const je$1 = class je extends Editor {
|
|
|
43752
43752
|
), this.emit("create", { editor: this }), this.isInitialized = true;
|
|
43753
43753
|
}
|
|
43754
43754
|
};
|
|
43755
|
-
h(je$
|
|
43755
|
+
h(je$2, "create", (t2, o) => {
|
|
43756
43756
|
var s, i;
|
|
43757
43757
|
const r2 = (s = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : s.setTimeout;
|
|
43758
43758
|
typeof ((i = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : i.setTimeout) < "u" && (globalThis.window.setTimeout = () => 0);
|
|
43759
43759
|
try {
|
|
43760
|
-
return new je$
|
|
43760
|
+
return new je$2(t2, o);
|
|
43761
43761
|
} finally {
|
|
43762
43762
|
r2 && (globalThis.window.setTimeout = r2);
|
|
43763
43763
|
}
|
|
43764
43764
|
});
|
|
43765
|
-
let We$
|
|
43766
|
-
We$
|
|
43765
|
+
let We$3 = je$2;
|
|
43766
|
+
We$3.prototype.createView = function() {
|
|
43767
43767
|
this.options.onPaste = this.options.onDrop = void 0;
|
|
43768
43768
|
};
|
|
43769
43769
|
const fc = {
|
|
@@ -43971,7 +43971,7 @@ let ao$1 = class ao extends At {
|
|
|
43971
43971
|
transformPasted: hc
|
|
43972
43972
|
}
|
|
43973
43973
|
};
|
|
43974
|
-
this.headless ? this.pmSchema = getSchema(c.extensions) : (this._tiptapEditor = We$
|
|
43974
|
+
this.headless ? this.pmSchema = getSchema(c.extensions) : (this._tiptapEditor = We$3.create(
|
|
43975
43975
|
c,
|
|
43976
43976
|
this.schema.styleSchema
|
|
43977
43977
|
), this.pmSchema = this._tiptapEditor.schema), this.pmSchema.cached.blockNoteEditor = this, this.emit("create");
|
|
@@ -44486,7 +44486,7 @@ let ao$1 = class ao extends At {
|
|
|
44486
44486
|
* @returns The blocks, serialized as an HTML string.
|
|
44487
44487
|
*/
|
|
44488
44488
|
async blocksToHTMLLossy(t2 = this.document) {
|
|
44489
|
-
return Xe$
|
|
44489
|
+
return Xe$3(this.pmSchema, this).exportBlocks(t2, {});
|
|
44490
44490
|
}
|
|
44491
44491
|
/**
|
|
44492
44492
|
* Serializes blocks into an HTML string in the format that would normally be rendered by the editor.
|
|
@@ -45678,7 +45678,7 @@ const Ie$1 = (e) => {
|
|
|
45678
45678
|
),
|
|
45679
45679
|
// disable default props on paragraph (such as textalignment and colors)
|
|
45680
45680
|
{}
|
|
45681
|
-
), { textColor: $i, backgroundColor: Ki, ...jn } = Fn, Ne = Ie$2.create({
|
|
45681
|
+
), { textColor: $i, backgroundColor: Ki, ...jn } = Fn, Ne$1 = Ie$2.create({
|
|
45682
45682
|
blockSpecs: {
|
|
45683
45683
|
paragraph: zn
|
|
45684
45684
|
},
|
|
@@ -45696,7 +45696,7 @@ function Wn() {
|
|
|
45696
45696
|
emptyDocument: o.placeholders.new_comment
|
|
45697
45697
|
}
|
|
45698
45698
|
},
|
|
45699
|
-
schema: Ne
|
|
45699
|
+
schema: Ne$1
|
|
45700
45700
|
});
|
|
45701
45701
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(n.Comments.Card, { className: "bn-thread", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45702
45702
|
Ie$1,
|
|
@@ -45771,7 +45771,7 @@ var bt$1 = {
|
|
|
45771
45771
|
className: void 0,
|
|
45772
45772
|
style: void 0,
|
|
45773
45773
|
attr: void 0
|
|
45774
|
-
}, We$
|
|
45774
|
+
}, We$2 = React__default.createContext && /* @__PURE__ */ React__default.createContext(bt$1), $n = ["attr", "size", "title"];
|
|
45775
45775
|
function Kn(e, t2) {
|
|
45776
45776
|
if (e == null) return {};
|
|
45777
45777
|
var n = Xn(e, t2), o, r2;
|
|
@@ -45802,7 +45802,7 @@ function ie$1() {
|
|
|
45802
45802
|
return e;
|
|
45803
45803
|
}, ie$1.apply(this, arguments);
|
|
45804
45804
|
}
|
|
45805
|
-
function qe$
|
|
45805
|
+
function qe$2(e, t2) {
|
|
45806
45806
|
var n = Object.keys(e);
|
|
45807
45807
|
if (Object.getOwnPropertySymbols) {
|
|
45808
45808
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -45815,9 +45815,9 @@ function qe$1(e, t2) {
|
|
|
45815
45815
|
function le(e) {
|
|
45816
45816
|
for (var t2 = 1; t2 < arguments.length; t2++) {
|
|
45817
45817
|
var n = arguments[t2] != null ? arguments[t2] : {};
|
|
45818
|
-
t2 % 2 ? qe$
|
|
45818
|
+
t2 % 2 ? qe$2(Object(n), true).forEach(function(o) {
|
|
45819
45819
|
Yn(e, o, n[o]);
|
|
45820
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : qe$
|
|
45820
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : qe$2(Object(n)).forEach(function(o) {
|
|
45821
45821
|
Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(n, o));
|
|
45822
45822
|
});
|
|
45823
45823
|
}
|
|
@@ -45871,9 +45871,9 @@ function eo(e) {
|
|
|
45871
45871
|
xmlns: "http://www.w3.org/2000/svg"
|
|
45872
45872
|
}), l && /* @__PURE__ */ React__default.createElement("title", null, l), e.children);
|
|
45873
45873
|
};
|
|
45874
|
-
return We$
|
|
45874
|
+
return We$2 !== void 0 ? /* @__PURE__ */ React__default.createElement(We$2.Consumer, null, (n) => t2(n)) : t2(bt$1);
|
|
45875
45875
|
}
|
|
45876
|
-
function to(e) {
|
|
45876
|
+
function to$1(e) {
|
|
45877
45877
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z" }, child: [] }] })(e);
|
|
45878
45878
|
}
|
|
45879
45879
|
function pt$1(e) {
|
|
@@ -45909,7 +45909,7 @@ function so(e) {
|
|
|
45909
45909
|
function $e$1(e) {
|
|
45910
45910
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M5.55397 22H3.3999L10.9999 3H12.9999L20.5999 22H18.4458L16.0458 16H7.95397L5.55397 22ZM8.75397 14H15.2458L11.9999 5.88517L8.75397 14Z" }, child: [] }] })(e);
|
|
45911
45911
|
}
|
|
45912
|
-
function
|
|
45912
|
+
function ce2(e) {
|
|
45913
45913
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z" }, child: [] }] })(e);
|
|
45914
45914
|
}
|
|
45915
45915
|
function ae$1(e) {
|
|
@@ -45960,7 +45960,7 @@ function fo(e) {
|
|
|
45960
45960
|
function bo(e) {
|
|
45961
45961
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M21 20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20C20.5523 3 21 3.44772 21 4V20ZM19 11V5H13.001V7H15L12 10L9 7H11V5H5V11H7V13H5V19H11V17H9L12 14L15 17H13.001V19H19V13H17V11H19ZM11 13H9V11H11V13ZM15 13H13V11H15V13Z" }, child: [] }] })(e);
|
|
45962
45962
|
}
|
|
45963
|
-
function Vt
|
|
45963
|
+
function Vt(e) {
|
|
45964
45964
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M21 4H3V6H21V4ZM21 11H8V13H21V11ZM21 18H8V20H21V18ZM5 11H3V20H5V11Z" }, child: [] }] })(e);
|
|
45965
45965
|
}
|
|
45966
45966
|
function Co(e) {
|
|
@@ -45978,7 +45978,7 @@ function ko(e) {
|
|
|
45978
45978
|
function wo(e) {
|
|
45979
45979
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z" }, child: [] }] })(e);
|
|
45980
45980
|
}
|
|
45981
|
-
function Bt(e) {
|
|
45981
|
+
function Bt$1(e) {
|
|
45982
45982
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z" }, child: [] }] })(e);
|
|
45983
45983
|
}
|
|
45984
45984
|
function vo(e) {
|
|
@@ -45993,7 +45993,7 @@ function Tt$1(e) {
|
|
|
45993
45993
|
function Mo(e) {
|
|
45994
45994
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M3 3.9934C3 3.44476 3.44495 3 3.9934 3H20.0066C20.5552 3 21 3.44495 21 3.9934V20.0066C21 20.5552 20.5551 21 20.0066 21H3.9934C3.44476 21 3 20.5551 3 20.0066V3.9934ZM10.6219 8.41459C10.5562 8.37078 10.479 8.34741 10.4 8.34741C10.1791 8.34741 10 8.52649 10 8.74741V15.2526C10 15.3316 10.0234 15.4088 10.0672 15.4745C10.1897 15.6583 10.4381 15.708 10.6219 15.5854L15.5008 12.3328C15.5447 12.3035 15.5824 12.2658 15.6117 12.2219C15.7343 12.0381 15.6846 11.7897 15.5008 11.6672L10.6219 8.41459Z" }, child: [] }] })(e);
|
|
45995
45995
|
}
|
|
45996
|
-
function St$
|
|
45996
|
+
function St$2(e) {
|
|
45997
45997
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z" }, child: [] }] })(e);
|
|
45998
45998
|
}
|
|
45999
45999
|
function yo(e) {
|
|
@@ -46020,7 +46020,7 @@ function Lo(e) {
|
|
|
46020
46020
|
function _o(e) {
|
|
46021
46021
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13H8ZM8 11C8.82843 11 9.5 10.3284 9.5 9.5C9.5 8.67157 8.82843 8 8 8C7.17157 8 6.5 8.67157 6.5 9.5C6.5 10.3284 7.17157 11 8 11ZM16 11C16.8284 11 17.5 10.3284 17.5 9.5C17.5 8.67157 16.8284 8 16 8C15.1716 8 14.5 8.67157 14.5 9.5C14.5 10.3284 15.1716 11 16 11Z" }, child: [] }] })(e);
|
|
46022
46022
|
}
|
|
46023
|
-
function Xe$
|
|
46023
|
+
function Xe$2(e) {
|
|
46024
46024
|
return k({ attr: { viewBox: "0 0 24 24", fill: "currentColor" }, child: [{ tag: "path", attr: { d: "M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z" }, child: [] }] })(e);
|
|
46025
46025
|
}
|
|
46026
46026
|
let oe$1;
|
|
@@ -46148,7 +46148,7 @@ const No = (e) => {
|
|
|
46148
46148
|
emptyDocument: o.placeholders.edit_comment
|
|
46149
46149
|
}
|
|
46150
46150
|
},
|
|
46151
|
-
schema: Ne
|
|
46151
|
+
schema: Ne$1
|
|
46152
46152
|
},
|
|
46153
46153
|
[e.body]
|
|
46154
46154
|
), l = p(), [c, s] = useState(false), d = C();
|
|
@@ -46215,7 +46215,7 @@ const No = (e) => {
|
|
|
46215
46215
|
{
|
|
46216
46216
|
mainTooltip: o.comments.actions.add_reaction,
|
|
46217
46217
|
variant: "compact",
|
|
46218
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Xe$
|
|
46218
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Xe$2, { size: 16 })
|
|
46219
46219
|
},
|
|
46220
46220
|
"add-reaction"
|
|
46221
46221
|
)
|
|
@@ -46227,7 +46227,7 @@ const No = (e) => {
|
|
|
46227
46227
|
mainTooltip: "Re-open",
|
|
46228
46228
|
variant: "compact",
|
|
46229
46229
|
onClick: B,
|
|
46230
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(to, { size: 16 })
|
|
46230
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(to$1, { size: 16 })
|
|
46231
46231
|
},
|
|
46232
46232
|
"reopen"
|
|
46233
46233
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -46325,7 +46325,7 @@ const No = (e) => {
|
|
|
46325
46325
|
"bn-comment-add-reaction"
|
|
46326
46326
|
),
|
|
46327
46327
|
text: "+",
|
|
46328
|
-
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Xe$
|
|
46328
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Xe$2, { size: 16 }),
|
|
46329
46329
|
mainTooltip: o.comments.actions.add_reaction
|
|
46330
46330
|
}
|
|
46331
46331
|
)
|
|
@@ -46444,7 +46444,7 @@ const No = (e) => {
|
|
|
46444
46444
|
emptyDocument: d.placeholders.comment_reply
|
|
46445
46445
|
}
|
|
46446
46446
|
},
|
|
46447
|
-
schema: Ne
|
|
46447
|
+
schema: Ne$1
|
|
46448
46448
|
}), m2 = useCallback(async () => {
|
|
46449
46449
|
await u.threadStore.addComment({
|
|
46450
46450
|
comment: {
|
|
@@ -46808,7 +46808,7 @@ const re$1 = (e) => {
|
|
|
46808
46808
|
children: "A"
|
|
46809
46809
|
}
|
|
46810
46810
|
);
|
|
46811
|
-
}, Je$
|
|
46811
|
+
}, Je$1 = [
|
|
46812
46812
|
"default",
|
|
46813
46813
|
"gray",
|
|
46814
46814
|
"brown",
|
|
@@ -46824,7 +46824,7 @@ const re$1 = (e) => {
|
|
|
46824
46824
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
46825
46825
|
/* @__PURE__ */ jsxRuntimeExports.jsx(() => e.text ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
46826
46826
|
/* @__PURE__ */ jsxRuntimeExports.jsx(t2.Generic.Menu.Label, { children: n.color_picker.text_title }),
|
|
46827
|
-
Je$
|
|
46827
|
+
Je$1.map((l) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46828
46828
|
t2.Generic.Menu.Item,
|
|
46829
46829
|
{
|
|
46830
46830
|
onClick: () => {
|
|
@@ -46840,7 +46840,7 @@ const re$1 = (e) => {
|
|
|
46840
46840
|
] }) : null, {}),
|
|
46841
46841
|
/* @__PURE__ */ jsxRuntimeExports.jsx(() => e.background ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
46842
46842
|
/* @__PURE__ */ jsxRuntimeExports.jsx(t2.Generic.Menu.Label, { children: n.color_picker.background_title }),
|
|
46843
|
-
Je$
|
|
46843
|
+
Je$1.map((l) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46844
46844
|
t2.Generic.Menu.Item,
|
|
46845
46845
|
{
|
|
46846
46846
|
onClick: () => {
|
|
@@ -46856,11 +46856,11 @@ const re$1 = (e) => {
|
|
|
46856
46856
|
] }) : null, {})
|
|
46857
46857
|
] });
|
|
46858
46858
|
};
|
|
46859
|
-
function Qe$
|
|
46859
|
+
function Qe$2(e, t2) {
|
|
46860
46860
|
return `${e}Color` in t2.schema.styleSchema && t2.schema.styleSchema[`${e}Color`].type === `${e}Color` && t2.schema.styleSchema[`${e}Color`].propSchema === "string";
|
|
46861
46861
|
}
|
|
46862
46862
|
const Wo = () => {
|
|
46863
|
-
const e = p(), t2 = x(), n = C(), o = Qe$
|
|
46863
|
+
const e = p(), t2 = x(), n = C(), o = Qe$2("text", n), r2 = Qe$2("background", n), l = R(n), [c, s] = useState(
|
|
46864
46864
|
o && n.getActiveStyles().textColor || "default"
|
|
46865
46865
|
), [d, a] = useState(
|
|
46866
46866
|
r2 && n.getActiveStyles().backgroundColor || "default"
|
|
@@ -47276,7 +47276,7 @@ const $o = () => {
|
|
|
47276
47276
|
name: e.slash_menu.heading.title,
|
|
47277
47277
|
type: "heading",
|
|
47278
47278
|
props: { level: 1 },
|
|
47279
|
-
icon:
|
|
47279
|
+
icon: ce2,
|
|
47280
47280
|
isSelected: (t2) => t2.type === "heading" && "level" in t2.props && t2.props.level === 1
|
|
47281
47281
|
},
|
|
47282
47282
|
{
|
|
@@ -47318,7 +47318,7 @@ const $o = () => {
|
|
|
47318
47318
|
name: e.slash_menu.toggle_heading.title,
|
|
47319
47319
|
type: "heading",
|
|
47320
47320
|
props: { level: 1, isToggleable: true },
|
|
47321
|
-
icon:
|
|
47321
|
+
icon: ce2,
|
|
47322
47322
|
isSelected: (t2) => t2.type === "heading" && "level" in t2.props && t2.props.level === 1 && "isToggleable" in t2.props && t2.props.isToggleable
|
|
47323
47323
|
},
|
|
47324
47324
|
{
|
|
@@ -47338,7 +47338,7 @@ const $o = () => {
|
|
|
47338
47338
|
{
|
|
47339
47339
|
name: e.slash_menu.quote.title,
|
|
47340
47340
|
type: "quote",
|
|
47341
|
-
icon: Vt
|
|
47341
|
+
icon: Vt,
|
|
47342
47342
|
isSelected: (t2) => t2.type === "quote"
|
|
47343
47343
|
},
|
|
47344
47344
|
{
|
|
@@ -47529,7 +47529,7 @@ const ir = () => {
|
|
|
47529
47529
|
if (!h2)
|
|
47530
47530
|
return;
|
|
47531
47531
|
const m2 = h2.cells.map(
|
|
47532
|
-
({ row: H2, col: b }) => at$
|
|
47532
|
+
({ row: H2, col: b }) => at$2(
|
|
47533
47533
|
a.content.rows[H2].cells[b]
|
|
47534
47534
|
).props.textAlignment
|
|
47535
47535
|
), g = m2[0];
|
|
@@ -47552,7 +47552,7 @@ const ir = () => {
|
|
|
47552
47552
|
const g = h2.content.rows.map(
|
|
47553
47553
|
(H2) => ({
|
|
47554
47554
|
...H2,
|
|
47555
|
-
cells: H2.cells.map((b) => at$
|
|
47555
|
+
cells: H2.cells.map((b) => at$2(b))
|
|
47556
47556
|
})
|
|
47557
47557
|
);
|
|
47558
47558
|
m2.cells.forEach(({ row: H2, col: b }) => {
|
|
@@ -47811,7 +47811,7 @@ const Cr = (e) => {
|
|
|
47811
47811
|
}
|
|
47812
47812
|
);
|
|
47813
47813
|
};
|
|
47814
|
-
function Nt$
|
|
47814
|
+
function Nt$1(e) {
|
|
47815
47815
|
return k({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { fill: "none", d: "M0 0h24v24H0V0z" }, child: [] }, { tag: "path", attr: { d: "M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }, child: [] }] })(e);
|
|
47816
47816
|
}
|
|
47817
47817
|
function pr(e) {
|
|
@@ -47951,7 +47951,7 @@ const kr = (e) => {
|
|
|
47951
47951
|
onDragStart: (r2) => e.blockDragStart(r2, e.block),
|
|
47952
47952
|
onDragEnd: e.blockDragEnd,
|
|
47953
47953
|
className: "bn-button",
|
|
47954
|
-
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Nt$
|
|
47954
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Nt$1, { size: 24, "data-test": "dragHandle" })
|
|
47955
47955
|
}
|
|
47956
47956
|
) }),
|
|
47957
47957
|
/* @__PURE__ */ jsxRuntimeExports.jsx(o, { block: e.block, children: e.children })
|
|
@@ -48356,25 +48356,25 @@ function Pr(e) {
|
|
|
48356
48356
|
);
|
|
48357
48357
|
}
|
|
48358
48358
|
const Zr = {
|
|
48359
|
-
heading:
|
|
48359
|
+
heading: ce2,
|
|
48360
48360
|
heading_2: ae$1,
|
|
48361
48361
|
heading_3: se$1,
|
|
48362
48362
|
heading_4: kt$1,
|
|
48363
48363
|
heading_5: wt$1,
|
|
48364
48364
|
heading_6: vt$1,
|
|
48365
|
-
toggle_heading:
|
|
48365
|
+
toggle_heading: ce2,
|
|
48366
48366
|
toggle_heading_2: ae$1,
|
|
48367
48367
|
toggle_heading_3: se$1,
|
|
48368
|
-
quote: Vt
|
|
48368
|
+
quote: Vt,
|
|
48369
48369
|
toggle_list: Tt$1,
|
|
48370
48370
|
numbered_list: yt$1,
|
|
48371
48371
|
bullet_list: xt$1,
|
|
48372
48372
|
check_list: Mt$1,
|
|
48373
48373
|
paragraph: Ze$1,
|
|
48374
48374
|
table: po,
|
|
48375
|
-
image: Bt,
|
|
48375
|
+
image: Bt$1,
|
|
48376
48376
|
video: wo,
|
|
48377
|
-
audio: St$
|
|
48377
|
+
audio: St$2,
|
|
48378
48378
|
file: Pe,
|
|
48379
48379
|
emoji: _o,
|
|
48380
48380
|
code_block: so
|
|
@@ -48576,7 +48576,7 @@ const Fr = (e, t2 = 0.3) => {
|
|
|
48576
48576
|
const t2 = p(), n = x(), o = C(), r2 = o.tableHandles, l = useMemo(() => !r2 || !e.block ? [] : e.orientation === "row" ? r2.getCellsAtRowHandle(e.block, e.index) : r2.getCellsAtColumnHandle(e.block, e.index), [e.block, e.index, e.orientation, r2]), c = (d, a) => {
|
|
48577
48577
|
const u = e.block.content.rows.map((h2) => ({
|
|
48578
48578
|
...h2,
|
|
48579
|
-
cells: h2.cells.map((m2) => at$
|
|
48579
|
+
cells: h2.cells.map((m2) => at$2(m2))
|
|
48580
48580
|
}));
|
|
48581
48581
|
l.forEach(({ row: h2, col: m2 }) => {
|
|
48582
48582
|
a === "text" ? u[h2].cells[m2].props.textColor = d : u[h2].cells[m2].props.backgroundColor = d;
|
|
@@ -48590,7 +48590,7 @@ const Fr = (e, t2 = 0.3) => {
|
|
|
48590
48590
|
};
|
|
48591
48591
|
if (!l || !l[0] || !r2 || o.settings.tables.cellTextColor === false && o.settings.tables.cellBackgroundColor === false)
|
|
48592
48592
|
return null;
|
|
48593
|
-
const s = at$
|
|
48593
|
+
const s = at$2(l[0].cell);
|
|
48594
48594
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(t2.Generic.Menu.Root, { position: "right", sub: true, children: [
|
|
48595
48595
|
/* @__PURE__ */ jsxRuntimeExports.jsx(t2.Generic.Menu.Trigger, { sub: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48596
48596
|
t2.Generic.Menu.Item,
|
|
@@ -48758,7 +48758,7 @@ const Fr = (e, t2 = 0.3) => {
|
|
|
48758
48758
|
e.dragEnd(), o(false);
|
|
48759
48759
|
},
|
|
48760
48760
|
style: e.orientation === "column" ? { transform: "rotate(0.25turn)" } : void 0,
|
|
48761
|
-
children: e.children || /* @__PURE__ */ jsxRuntimeExports.jsx(Nt$
|
|
48761
|
+
children: e.children || /* @__PURE__ */ jsxRuntimeExports.jsx(Nt$1, { size: 24, "data-test": "tableHandle" })
|
|
48762
48762
|
}
|
|
48763
48763
|
) }),
|
|
48764
48764
|
createPortal(
|
|
@@ -48930,7 +48930,7 @@ const Qr = (e) => {
|
|
|
48930
48930
|
const t2 = p(), n = x(), o = C(), r2 = (d, a) => {
|
|
48931
48931
|
const u = e.block.content.rows.map((h2) => ({
|
|
48932
48932
|
...h2,
|
|
48933
|
-
cells: h2.cells.map((m2) => at$
|
|
48933
|
+
cells: h2.cells.map((m2) => at$2(m2))
|
|
48934
48934
|
}));
|
|
48935
48935
|
a === "text" ? u[e.rowIndex].cells[e.colIndex].props.textColor = d : u[e.rowIndex].cells[e.colIndex].props.backgroundColor = d, o.updateBlock(e.block, {
|
|
48936
48936
|
type: "table",
|
|
@@ -49447,7 +49447,7 @@ function He$1(e) {
|
|
|
49447
49447
|
Object.entries(e.blockProps).filter(([n, o]) => {
|
|
49448
49448
|
const r2 = e.propSchema[n];
|
|
49449
49449
|
return !mn.includes(n) && o !== r2.default;
|
|
49450
|
-
}).map(([n, o]) => [Fe$
|
|
49450
|
+
}).map(([n, o]) => [Fe$2(n), o])
|
|
49451
49451
|
),
|
|
49452
49452
|
"data-file-block": e.isFileBlock === true || void 0,
|
|
49453
49453
|
children: e.children
|
|
@@ -49470,7 +49470,7 @@ function Ce(e, t2) {
|
|
|
49470
49470
|
},
|
|
49471
49471
|
renderHTML({ HTMLAttributes: o }) {
|
|
49472
49472
|
const r2 = document.createElement("div");
|
|
49473
|
-
return Ne$
|
|
49473
|
+
return Ne$2(
|
|
49474
49474
|
{
|
|
49475
49475
|
dom: r2,
|
|
49476
49476
|
contentDOM: e.content === "inline" ? r2 : void 0
|
|
@@ -49587,7 +49587,7 @@ function Ce(e, t2) {
|
|
|
49587
49587
|
}
|
|
49588
49588
|
});
|
|
49589
49589
|
}
|
|
49590
|
-
function Oe(e) {
|
|
49590
|
+
function Oe$1(e) {
|
|
49591
49591
|
const t2 = C(), [n, o] = useState("loading"), [r2, l] = useState();
|
|
49592
49592
|
if (useEffect(() => {
|
|
49593
49593
|
let c = true;
|
|
@@ -49615,7 +49615,7 @@ function Oe(e) {
|
|
|
49615
49615
|
downloadUrl: r2
|
|
49616
49616
|
};
|
|
49617
49617
|
}
|
|
49618
|
-
const Fe = (e) => /* @__PURE__ */ jsxRuntimeExports.jsxs("figure", { children: [
|
|
49618
|
+
const Fe$1 = (e) => /* @__PURE__ */ jsxRuntimeExports.jsxs("figure", { children: [
|
|
49619
49619
|
e.children,
|
|
49620
49620
|
/* @__PURE__ */ jsxRuntimeExports.jsx("figcaption", { children: e.caption })
|
|
49621
49621
|
] });
|
|
@@ -49627,7 +49627,7 @@ function fi(e) {
|
|
|
49627
49627
|
const t2 = C();
|
|
49628
49628
|
useEffect(() => t2.onUploadStart(e), [e, t2]);
|
|
49629
49629
|
}
|
|
49630
|
-
function Ot$
|
|
49630
|
+
function Ot$1(e) {
|
|
49631
49631
|
const [t2, n] = useState(false);
|
|
49632
49632
|
return fi((o) => {
|
|
49633
49633
|
o === e && n(true);
|
|
@@ -49672,7 +49672,7 @@ const bi = (e) => {
|
|
|
49672
49672
|
]
|
|
49673
49673
|
}
|
|
49674
49674
|
), Ae$1 = (e) => {
|
|
49675
|
-
const t2 = Ot$
|
|
49675
|
+
const t2 = Ot$1(e.block.id);
|
|
49676
49676
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
49677
49677
|
"div",
|
|
49678
49678
|
{
|
|
@@ -49706,7 +49706,7 @@ const bi = (e) => {
|
|
|
49706
49706
|
e.children,
|
|
49707
49707
|
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: e.caption })
|
|
49708
49708
|
] }), pi = (e) => {
|
|
49709
|
-
const t2 = Oe(e.block.props.url);
|
|
49709
|
+
const t2 = Oe$1(e.block.props.url);
|
|
49710
49710
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
49711
49711
|
"audio",
|
|
49712
49712
|
{
|
|
@@ -49721,13 +49721,13 @@ const bi = (e) => {
|
|
|
49721
49721
|
if (!e.block.props.url)
|
|
49722
49722
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Add audio" });
|
|
49723
49723
|
const t2 = e.block.props.showPreview ? /* @__PURE__ */ jsxRuntimeExports.jsx("audio", { src: e.block.props.url }) : /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: e.block.props.url, children: e.block.props.name || e.block.props.url });
|
|
49724
|
-
return e.block.props.caption ? e.block.props.showPreview ? /* @__PURE__ */ jsxRuntimeExports.jsx(Fe, { caption: e.block.props.caption, children: t2 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(pe, { caption: e.block.props.caption, children: t2 }) : t2;
|
|
49724
|
+
return e.block.props.caption ? e.block.props.showPreview ? /* @__PURE__ */ jsxRuntimeExports.jsx(Fe$1, { caption: e.block.props.caption, children: t2 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(pe, { caption: e.block.props.caption, children: t2 }) : t2;
|
|
49725
49725
|
}, wi = (e) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
49726
49726
|
Ae$1,
|
|
49727
49727
|
{
|
|
49728
49728
|
...e,
|
|
49729
49729
|
buttonText: e.editor.dictionary.file_blocks.audio.add_button_text,
|
|
49730
|
-
buttonIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(St$
|
|
49730
|
+
buttonIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(St$2, { size: 24 }),
|
|
49731
49731
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(pi, { ...e })
|
|
49732
49732
|
}
|
|
49733
49733
|
);
|
|
@@ -49747,7 +49747,7 @@ Ce(as, {
|
|
|
49747
49747
|
parse: ls,
|
|
49748
49748
|
toExternalHTML: vi
|
|
49749
49749
|
});
|
|
49750
|
-
const Ft$
|
|
49750
|
+
const Ft$1 = (e) => {
|
|
49751
49751
|
const [t2, n] = useState(void 0), [o, r2] = useState(
|
|
49752
49752
|
e.block.props.previewWidth
|
|
49753
49753
|
), [l, c] = useState(false), s = useRef(null);
|
|
@@ -49794,7 +49794,7 @@ const Ft$2 = (e) => {
|
|
|
49794
49794
|
});
|
|
49795
49795
|
},
|
|
49796
49796
|
[]
|
|
49797
|
-
), m2 = Ot$
|
|
49797
|
+
), m2 = Ot$1(e.block.id);
|
|
49798
49798
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
49799
49799
|
Ae$1,
|
|
49800
49800
|
{
|
|
@@ -49828,7 +49828,7 @@ const Ft$2 = (e) => {
|
|
|
49828
49828
|
}
|
|
49829
49829
|
);
|
|
49830
49830
|
}, Mi = (e) => {
|
|
49831
|
-
const t2 = Oe(e.block.props.url);
|
|
49831
|
+
const t2 = Oe$1(e.block.props.url);
|
|
49832
49832
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
49833
49833
|
"img",
|
|
49834
49834
|
{
|
|
@@ -49850,13 +49850,13 @@ const Ft$2 = (e) => {
|
|
|
49850
49850
|
width: e.block.props.previewWidth
|
|
49851
49851
|
}
|
|
49852
49852
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: e.block.props.url, children: e.block.props.name || e.block.props.url });
|
|
49853
|
-
return e.block.props.caption ? e.block.props.showPreview ? /* @__PURE__ */ jsxRuntimeExports.jsx(Fe, { caption: e.block.props.caption, children: t2 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(pe, { caption: e.block.props.caption, children: t2 }) : t2;
|
|
49853
|
+
return e.block.props.caption ? e.block.props.showPreview ? /* @__PURE__ */ jsxRuntimeExports.jsx(Fe$1, { caption: e.block.props.caption, children: t2 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(pe, { caption: e.block.props.caption, children: t2 }) : t2;
|
|
49854
49854
|
}, xi = (e) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
49855
|
-
Ft$
|
|
49855
|
+
Ft$1,
|
|
49856
49856
|
{
|
|
49857
49857
|
...e,
|
|
49858
49858
|
buttonText: e.editor.dictionary.file_blocks.image.add_button_text,
|
|
49859
|
-
buttonIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(Bt, { size: 24 }),
|
|
49859
|
+
buttonIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(Bt$1, { size: 24 }),
|
|
49860
49860
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Mi, { ...e })
|
|
49861
49861
|
}
|
|
49862
49862
|
);
|
|
@@ -49866,7 +49866,7 @@ Ce(ks, {
|
|
|
49866
49866
|
toExternalHTML: yi
|
|
49867
49867
|
});
|
|
49868
49868
|
const Ti = (e) => {
|
|
49869
|
-
const t2 = Oe(e.block.props.url);
|
|
49869
|
+
const t2 = Oe$1(e.block.props.url);
|
|
49870
49870
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
49871
49871
|
"video",
|
|
49872
49872
|
{
|
|
@@ -49881,9 +49881,9 @@ const Ti = (e) => {
|
|
|
49881
49881
|
if (!e.block.props.url)
|
|
49882
49882
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Add video" });
|
|
49883
49883
|
const t2 = e.block.props.showPreview ? /* @__PURE__ */ jsxRuntimeExports.jsx("video", { src: e.block.props.url }) : /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: e.block.props.url, children: e.block.props.name || e.block.props.url });
|
|
49884
|
-
return e.block.props.caption ? e.block.props.showPreview ? /* @__PURE__ */ jsxRuntimeExports.jsx(Fe, { caption: e.block.props.caption, children: t2 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(pe, { caption: e.block.props.caption, children: t2 }) : t2;
|
|
49884
|
+
return e.block.props.caption ? e.block.props.showPreview ? /* @__PURE__ */ jsxRuntimeExports.jsx(Fe$1, { caption: e.block.props.caption, children: t2 }) : /* @__PURE__ */ jsxRuntimeExports.jsx(pe, { caption: e.block.props.caption, children: t2 }) : t2;
|
|
49885
49885
|
}, Li = (e) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
49886
|
-
Ft$
|
|
49886
|
+
Ft$1,
|
|
49887
49887
|
{
|
|
49888
49888
|
...e,
|
|
49889
49889
|
buttonText: e.editor.dictionary.file_blocks.video.add_button_text,
|
|
@@ -57681,7 +57681,7 @@ const ne = (e, n, t2 = false) => {
|
|
|
57681
57681
|
children: C2
|
|
57682
57682
|
}
|
|
57683
57683
|
);
|
|
57684
|
-
}), Be
|
|
57684
|
+
}), Be = forwardRef((e, n) => {
|
|
57685
57685
|
const { className: t2, children: o, ...r2 } = e;
|
|
57686
57686
|
return Fc(r2), /* @__PURE__ */ jsxRuntimeExports.jsx(Group, { className: t2, ref: n, children: o });
|
|
57687
57687
|
}), Ee = forwardRef((e, n) => {
|
|
@@ -57717,10 +57717,10 @@ const ne = (e, n, t2 = false) => {
|
|
|
57717
57717
|
]
|
|
57718
57718
|
}
|
|
57719
57719
|
);
|
|
57720
|
-
}), ze
|
|
57720
|
+
}), ze = forwardRef((e, n) => {
|
|
57721
57721
|
const { className: t2, children: o, ...r2 } = e;
|
|
57722
57722
|
return Fc(r2, false), /* @__PURE__ */ jsxRuntimeExports.jsx(Card.Section, { className: t2, ref: n, children: o });
|
|
57723
|
-
}),
|
|
57723
|
+
}), je$1 = forwardRef((e, n) => {
|
|
57724
57724
|
const { className: t2, children: o, ...r2 } = e;
|
|
57725
57725
|
return Fc(r2, false), /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
57726
57726
|
Divider,
|
|
@@ -57788,7 +57788,7 @@ const ne = (e, n, t2 = false) => {
|
|
|
57788
57788
|
Fc(u, false);
|
|
57789
57789
|
const c = O$1();
|
|
57790
57790
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
57791
|
-
Ot
|
|
57791
|
+
Ot,
|
|
57792
57792
|
{
|
|
57793
57793
|
autoFocus: o,
|
|
57794
57794
|
className: t2,
|
|
@@ -57910,17 +57910,17 @@ function O(e) {
|
|
|
57910
57910
|
for (var n = 1; n < arguments.length; n++) {
|
|
57911
57911
|
var t2 = arguments[n] != null ? arguments[n] : {};
|
|
57912
57912
|
n % 2 ? K(Object(t2), true).forEach(function(o) {
|
|
57913
|
-
We(e, o, t2[o]);
|
|
57913
|
+
We$1(e, o, t2[o]);
|
|
57914
57914
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t2)) : K(Object(t2)).forEach(function(o) {
|
|
57915
57915
|
Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(t2, o));
|
|
57916
57916
|
});
|
|
57917
57917
|
}
|
|
57918
57918
|
return e;
|
|
57919
57919
|
}
|
|
57920
|
-
function We(e, n, t2) {
|
|
57921
|
-
return n = qe(n), n in e ? Object.defineProperty(e, n, { value: t2, enumerable: true, configurable: true, writable: true }) : e[n] = t2, e;
|
|
57920
|
+
function We$1(e, n, t2) {
|
|
57921
|
+
return n = qe$1(n), n in e ? Object.defineProperty(e, n, { value: t2, enumerable: true, configurable: true, writable: true }) : e[n] = t2, e;
|
|
57922
57922
|
}
|
|
57923
|
-
function qe(e) {
|
|
57923
|
+
function qe$1(e) {
|
|
57924
57924
|
var n = Ze(e, "string");
|
|
57925
57925
|
return typeof n == "symbol" ? n : n + "";
|
|
57926
57926
|
}
|
|
@@ -57940,11 +57940,11 @@ function se(e) {
|
|
|
57940
57940
|
}, n.attr), se(n.child)));
|
|
57941
57941
|
}
|
|
57942
57942
|
function ie(e) {
|
|
57943
|
-
return (n) => /* @__PURE__ */ React__default.createElement(Je
|
|
57943
|
+
return (n) => /* @__PURE__ */ React__default.createElement(Je, F({
|
|
57944
57944
|
attr: O({}, e.attr)
|
|
57945
57945
|
}, n), se(e.child));
|
|
57946
57946
|
}
|
|
57947
|
-
function Je
|
|
57947
|
+
function Je(e) {
|
|
57948
57948
|
var n = (t2) => {
|
|
57949
57949
|
var {
|
|
57950
57950
|
attr: o,
|
|
@@ -57967,10 +57967,10 @@ function Je$1(e) {
|
|
|
57967
57967
|
};
|
|
57968
57968
|
return H !== void 0 ? /* @__PURE__ */ React__default.createElement(H.Consumer, null, (t2) => n(t2)) : n(re);
|
|
57969
57969
|
}
|
|
57970
|
-
function Qe(e) {
|
|
57970
|
+
function Qe$1(e) {
|
|
57971
57971
|
return ie({ attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", clipRule: "evenodd" }, child: [] }] })(e);
|
|
57972
57972
|
}
|
|
57973
|
-
function Xe(e) {
|
|
57973
|
+
function Xe$1(e) {
|
|
57974
57974
|
return ie({ attr: { viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" }, child: [] }] })(e);
|
|
57975
57975
|
}
|
|
57976
57976
|
const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
@@ -58048,7 +58048,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58048
58048
|
...u,
|
|
58049
58049
|
children: [
|
|
58050
58050
|
o,
|
|
58051
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Xe, { size: 15 })
|
|
58051
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Xe$1, { size: 15 })
|
|
58052
58052
|
]
|
|
58053
58053
|
}
|
|
58054
58054
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -58137,7 +58137,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58137
58137
|
children: o
|
|
58138
58138
|
}
|
|
58139
58139
|
);
|
|
58140
|
-
}), at = forwardRef((e, n) => {
|
|
58140
|
+
}), at$1 = forwardRef((e, n) => {
|
|
58141
58141
|
const {
|
|
58142
58142
|
className: t2,
|
|
58143
58143
|
tabs: o,
|
|
@@ -58299,7 +58299,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58299
58299
|
}), vt = forwardRef((e, n) => {
|
|
58300
58300
|
const { className: t2, children: o, ...r2 } = e;
|
|
58301
58301
|
return Fc(r2), /* @__PURE__ */ jsxRuntimeExports.jsx(Group, { className: t2, ref: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Group, { className: "bn-mt-suggestion-menu-item-title", children: o }) });
|
|
58302
|
-
}), St = forwardRef((e, n) => {
|
|
58302
|
+
}), St$1 = forwardRef((e, n) => {
|
|
58303
58303
|
const { className: t2, isSelected: o, onClick: r2, item: i, id: l, ...a } = e;
|
|
58304
58304
|
Fc(a);
|
|
58305
58305
|
const u = useRef(null);
|
|
@@ -58401,7 +58401,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58401
58401
|
children: i.icon
|
|
58402
58402
|
}
|
|
58403
58403
|
);
|
|
58404
|
-
}), Nt
|
|
58404
|
+
}), Nt = forwardRef((e, n) => {
|
|
58405
58405
|
const {
|
|
58406
58406
|
className: t2,
|
|
58407
58407
|
children: o,
|
|
@@ -58502,7 +58502,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58502
58502
|
zc() && a.currentTarget.focus();
|
|
58503
58503
|
},
|
|
58504
58504
|
leftSection: l.icon,
|
|
58505
|
-
rightSection: /* @__PURE__ */ jsxRuntimeExports.jsx(Qe, {}),
|
|
58505
|
+
rightSection: /* @__PURE__ */ jsxRuntimeExports.jsx(Qe$1, {}),
|
|
58506
58506
|
size: "xs",
|
|
58507
58507
|
variant: "subtle",
|
|
58508
58508
|
disabled: r2,
|
|
@@ -58533,7 +58533,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58533
58533
|
Select: L2
|
|
58534
58534
|
},
|
|
58535
58535
|
FilePanel: {
|
|
58536
|
-
Root: at,
|
|
58536
|
+
Root: at$1,
|
|
58537
58537
|
Button: lt,
|
|
58538
58538
|
FileInput: ct,
|
|
58539
58539
|
TabPanel: ut,
|
|
@@ -58543,7 +58543,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58543
58543
|
Root: Ct,
|
|
58544
58544
|
Item: Tt,
|
|
58545
58545
|
EmptyItem: wt,
|
|
58546
|
-
Loader: Nt
|
|
58546
|
+
Loader: Nt
|
|
58547
58547
|
},
|
|
58548
58548
|
LinkToolbar: {
|
|
58549
58549
|
Root: I,
|
|
@@ -58556,7 +58556,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58556
58556
|
},
|
|
58557
58557
|
SuggestionMenu: {
|
|
58558
58558
|
Root: pt,
|
|
58559
|
-
Item: St,
|
|
58559
|
+
Item: St$1,
|
|
58560
58560
|
EmptyItem: vt,
|
|
58561
58561
|
Label: yt,
|
|
58562
58562
|
Loader: xt
|
|
@@ -58568,7 +58568,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58568
58568
|
Generic: {
|
|
58569
58569
|
Badge: {
|
|
58570
58570
|
Root: Le,
|
|
58571
|
-
Group: Be
|
|
58571
|
+
Group: Be
|
|
58572
58572
|
},
|
|
58573
58573
|
Form: {
|
|
58574
58574
|
Root: (e) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: e.children }),
|
|
@@ -58598,13 +58598,13 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58598
58598
|
Comment: Ae,
|
|
58599
58599
|
Editor: _e,
|
|
58600
58600
|
Card: Ee,
|
|
58601
|
-
CardSection: ze
|
|
58602
|
-
ExpandSectionsPrompt:
|
|
58601
|
+
CardSection: ze,
|
|
58602
|
+
ExpandSectionsPrompt: je$1
|
|
58603
58603
|
}
|
|
58604
|
-
}, Ft
|
|
58604
|
+
}, Ft = {
|
|
58605
58605
|
// Removes button press effect
|
|
58606
58606
|
activeClassName: ""
|
|
58607
|
-
}, Ot
|
|
58607
|
+
}, Ot = (e) => {
|
|
58608
58608
|
const { className: n, theme: t2, ...o } = e, r2 = O$1(), i = ii(), l = (r2 == null ? void 0 : r2.colorSchemePreference) || i, a = useCallback(
|
|
58609
58609
|
(c) => {
|
|
58610
58610
|
if (c && (Ie2(c), typeof t2 == "object")) {
|
|
@@ -58624,7 +58624,7 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58624
58624
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Un.Provider, { value: Mt, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
58625
58625
|
MantineProvider,
|
|
58626
58626
|
{
|
|
58627
|
-
theme: Ft
|
|
58627
|
+
theme: Ft,
|
|
58628
58628
|
cssVariablesSelector: ".bn-mantine",
|
|
58629
58629
|
getRootElement: () => {
|
|
58630
58630
|
},
|
|
@@ -58641,21 +58641,21 @@ const ae = createContext(void 0), Ye = forwardRef((e, n) => {
|
|
|
58641
58641
|
}
|
|
58642
58642
|
) });
|
|
58643
58643
|
};
|
|
58644
|
-
var
|
|
58644
|
+
var zt, St = ReactDOM__default;
|
|
58645
58645
|
if (process.env.NODE_ENV === "production")
|
|
58646
|
-
|
|
58646
|
+
zt = St.createRoot, St.hydrateRoot;
|
|
58647
58647
|
else {
|
|
58648
|
-
var
|
|
58649
|
-
|
|
58650
|
-
|
|
58648
|
+
var Zt = St.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
58649
|
+
zt = function(ot2, pt2) {
|
|
58650
|
+
Zt.usingClientEntryPoint = true;
|
|
58651
58651
|
try {
|
|
58652
|
-
return
|
|
58652
|
+
return St.createRoot(ot2, pt2);
|
|
58653
58653
|
} finally {
|
|
58654
|
-
|
|
58654
|
+
Zt.usingClientEntryPoint = false;
|
|
58655
58655
|
}
|
|
58656
58656
|
};
|
|
58657
58657
|
}
|
|
58658
|
-
const
|
|
58658
|
+
const Oe = {
|
|
58659
58659
|
slash_menu: {
|
|
58660
58660
|
heading: {
|
|
58661
58661
|
title: "一级标题",
|
|
@@ -59091,13 +59091,13 @@ const Vt = {
|
|
|
59091
59091
|
},
|
|
59092
59092
|
sidebar: {
|
|
59093
59093
|
marked_as_resolved: "标记为已解决",
|
|
59094
|
-
more_replies: (
|
|
59094
|
+
more_replies: (ot2) => `还有 ${ot2} 条回复`
|
|
59095
59095
|
}
|
|
59096
59096
|
},
|
|
59097
59097
|
generic: {
|
|
59098
59098
|
ctrl_shortcut: "Ctrl"
|
|
59099
59099
|
}
|
|
59100
|
-
},
|
|
59100
|
+
}, Fe = { class: "blocknote-editor-wrapper" }, at = "#9cc1e9", Ne = "#fff", Bt = "data-ai-highlight", je2 = /* @__PURE__ */ defineComponent({
|
|
59101
59101
|
__name: "index",
|
|
59102
59102
|
props: {
|
|
59103
59103
|
defaultContent: {},
|
|
@@ -59106,8 +59106,8 @@ const Vt = {
|
|
|
59106
59106
|
theme: {}
|
|
59107
59107
|
},
|
|
59108
59108
|
emits: ["content-change", "editor-ready", "editor-error", "handle-ai-assistant"],
|
|
59109
|
-
setup(
|
|
59110
|
-
const
|
|
59109
|
+
setup(ot2, { expose: pt2, emit: wt2 }) {
|
|
59110
|
+
const Tt2 = Ce(
|
|
59111
59111
|
{
|
|
59112
59112
|
type: "insertedText",
|
|
59113
59113
|
propSchema: {
|
|
@@ -59127,8 +59127,8 @@ const Vt = {
|
|
|
59127
59127
|
content: "inline"
|
|
59128
59128
|
},
|
|
59129
59129
|
{
|
|
59130
|
-
render: (
|
|
59131
|
-
const { block: n } =
|
|
59130
|
+
render: (t2) => {
|
|
59131
|
+
const { block: n } = t2, o = n.props.text || "", r2 = n.props.isHighlighted, s = n.props.highlightId;
|
|
59132
59132
|
return React__default.createElement(
|
|
59133
59133
|
"div",
|
|
59134
59134
|
{
|
|
@@ -59154,7 +59154,7 @@ const Vt = {
|
|
|
59154
59154
|
wordBreak: "break-word"
|
|
59155
59155
|
}
|
|
59156
59156
|
},
|
|
59157
|
-
|
|
59157
|
+
o
|
|
59158
59158
|
),
|
|
59159
59159
|
// 顶部操作按钮(定位在块上方)
|
|
59160
59160
|
r2 && React__default.createElement(
|
|
@@ -59215,8 +59215,8 @@ const Vt = {
|
|
|
59215
59215
|
]
|
|
59216
59216
|
);
|
|
59217
59217
|
},
|
|
59218
|
-
toExternalHTML: (
|
|
59219
|
-
const { block: n } =
|
|
59218
|
+
toExternalHTML: (t2) => {
|
|
59219
|
+
const { block: n } = t2, o = n.props.text || "", r2 = n.props.isHighlighted;
|
|
59220
59220
|
return React__default.createElement(
|
|
59221
59221
|
"div",
|
|
59222
59222
|
{
|
|
@@ -59231,21 +59231,21 @@ const Vt = {
|
|
|
59231
59231
|
boxShadow: r2 ? "0 2px 8px rgba(255, 193, 7, 0.2)" : "none"
|
|
59232
59232
|
}
|
|
59233
59233
|
},
|
|
59234
|
-
|
|
59234
|
+
o
|
|
59235
59235
|
);
|
|
59236
59236
|
},
|
|
59237
|
-
parse: (
|
|
59238
|
-
if (
|
|
59239
|
-
const n =
|
|
59237
|
+
parse: (t2) => {
|
|
59238
|
+
if (t2.classList.contains("inserted-text-block")) {
|
|
59239
|
+
const n = t2.textContent || "", o = t2.style.backgroundColor === "#fff3cd", r2 = t2.getAttribute("data-highlight-id") || "";
|
|
59240
59240
|
return {
|
|
59241
59241
|
text: n,
|
|
59242
59242
|
highlightId: r2,
|
|
59243
|
-
isHighlighted:
|
|
59243
|
+
isHighlighted: o
|
|
59244
59244
|
};
|
|
59245
59245
|
}
|
|
59246
59246
|
}
|
|
59247
59247
|
}
|
|
59248
|
-
),
|
|
59248
|
+
), Ct2 = Ce(
|
|
59249
59249
|
{
|
|
59250
59250
|
type: "actionButtons",
|
|
59251
59251
|
propSchema: {
|
|
@@ -59257,8 +59257,8 @@ const Vt = {
|
|
|
59257
59257
|
content: "none"
|
|
59258
59258
|
},
|
|
59259
59259
|
{
|
|
59260
|
-
render: (
|
|
59261
|
-
const { block: n } =
|
|
59260
|
+
render: (t2) => {
|
|
59261
|
+
const { block: n } = t2, o = n.props.highlightId;
|
|
59262
59262
|
return React__default.createElement(
|
|
59263
59263
|
"div",
|
|
59264
59264
|
{
|
|
@@ -59302,7 +59302,7 @@ const Vt = {
|
|
|
59302
59302
|
r2.target.style.backgroundColor = "#10b981";
|
|
59303
59303
|
},
|
|
59304
59304
|
onClick: () => {
|
|
59305
|
-
window.acceptInsertion && window.acceptInsertion(
|
|
59305
|
+
window.acceptInsertion && window.acceptInsertion(o);
|
|
59306
59306
|
},
|
|
59307
59307
|
title: "接受"
|
|
59308
59308
|
},
|
|
@@ -59333,7 +59333,7 @@ const Vt = {
|
|
|
59333
59333
|
r2.target.style.backgroundColor = "#ef4444";
|
|
59334
59334
|
},
|
|
59335
59335
|
onClick: () => {
|
|
59336
|
-
window.cancelInsertion && window.cancelInsertion(
|
|
59336
|
+
window.cancelInsertion && window.cancelInsertion(o);
|
|
59337
59337
|
},
|
|
59338
59338
|
title: "取消"
|
|
59339
59339
|
},
|
|
@@ -59342,13 +59342,13 @@ const Vt = {
|
|
|
59342
59342
|
]
|
|
59343
59343
|
);
|
|
59344
59344
|
},
|
|
59345
|
-
toExternalHTML: (
|
|
59346
|
-
const { block: n } =
|
|
59345
|
+
toExternalHTML: (t2) => {
|
|
59346
|
+
const { block: n } = t2, o = n.props.highlightId;
|
|
59347
59347
|
return React__default.createElement(
|
|
59348
59348
|
"div",
|
|
59349
59349
|
{
|
|
59350
59350
|
className: "action-buttons-block",
|
|
59351
|
-
"data-highlight-id":
|
|
59351
|
+
"data-highlight-id": o,
|
|
59352
59352
|
style: {
|
|
59353
59353
|
display: "flex",
|
|
59354
59354
|
gap: "8px",
|
|
@@ -59394,14 +59394,14 @@ const Vt = {
|
|
|
59394
59394
|
]
|
|
59395
59395
|
);
|
|
59396
59396
|
},
|
|
59397
|
-
parse: (
|
|
59398
|
-
if (
|
|
59397
|
+
parse: (t2) => {
|
|
59398
|
+
if (t2.classList.contains("action-buttons-block"))
|
|
59399
59399
|
return {
|
|
59400
|
-
highlightId:
|
|
59400
|
+
highlightId: t2.getAttribute("data-highlight-id") || ""
|
|
59401
59401
|
};
|
|
59402
59402
|
}
|
|
59403
59403
|
}
|
|
59404
|
-
),
|
|
59404
|
+
), Qt2 = Ce(
|
|
59405
59405
|
{
|
|
59406
59406
|
type: "heading",
|
|
59407
59407
|
// 使用原生 heading 类型
|
|
@@ -59423,8 +59423,8 @@ const Vt = {
|
|
|
59423
59423
|
content: "inline"
|
|
59424
59424
|
},
|
|
59425
59425
|
{
|
|
59426
|
-
render: (
|
|
59427
|
-
const { block: n, contentRef:
|
|
59426
|
+
render: (t2) => {
|
|
59427
|
+
const { block: n, contentRef: o } = t2, r2 = n.props.level || 1, s = `h${r2}`;
|
|
59428
59428
|
return React__default.createElement(
|
|
59429
59429
|
"div",
|
|
59430
59430
|
{
|
|
@@ -59468,13 +59468,13 @@ const Vt = {
|
|
|
59468
59468
|
fontWeight: "bold",
|
|
59469
59469
|
lineHeight: 1.2
|
|
59470
59470
|
},
|
|
59471
|
-
ref:
|
|
59471
|
+
ref: o
|
|
59472
59472
|
})
|
|
59473
59473
|
]
|
|
59474
59474
|
);
|
|
59475
59475
|
},
|
|
59476
|
-
toExternalHTML: (
|
|
59477
|
-
const { block: n, contentRef:
|
|
59476
|
+
toExternalHTML: (t2) => {
|
|
59477
|
+
const { block: n, contentRef: o } = t2, r2 = n.props.level || 1, s = `h${r2}`;
|
|
59478
59478
|
return React__default.createElement(
|
|
59479
59479
|
"div",
|
|
59480
59480
|
{
|
|
@@ -59516,17 +59516,17 @@ const Vt = {
|
|
|
59516
59516
|
fontWeight: "bold",
|
|
59517
59517
|
lineHeight: 1.2
|
|
59518
59518
|
},
|
|
59519
|
-
ref:
|
|
59519
|
+
ref: o
|
|
59520
59520
|
})
|
|
59521
59521
|
]
|
|
59522
59522
|
);
|
|
59523
59523
|
},
|
|
59524
|
-
parse: (
|
|
59525
|
-
const n =
|
|
59524
|
+
parse: (t2) => {
|
|
59525
|
+
const n = t2.tagName.toLowerCase();
|
|
59526
59526
|
if (n.match(/^h[1-6]$/)) {
|
|
59527
|
-
const
|
|
59527
|
+
const o = parseInt(n.charAt(1)), r2 = t2.querySelector("[data-agent-id]"), s = (r2 == null ? void 0 : r2.getAttribute("data-agent-id")) || void 0;
|
|
59528
59528
|
return {
|
|
59529
|
-
level:
|
|
59529
|
+
level: o,
|
|
59530
59530
|
textAlignment: "left",
|
|
59531
59531
|
textColor: "default",
|
|
59532
59532
|
backgroundColor: "default",
|
|
@@ -59535,218 +59535,218 @@ const Vt = {
|
|
|
59535
59535
|
}
|
|
59536
59536
|
}
|
|
59537
59537
|
}
|
|
59538
|
-
),
|
|
59539
|
-
let
|
|
59540
|
-
const
|
|
59541
|
-
if (!
|
|
59538
|
+
), nt2 = ot2, ft2 = wt2, W2 = ref(null);
|
|
59539
|
+
let ht2 = null, e = null, tt2 = null, ct2 = null, yt2 = null;
|
|
59540
|
+
const lt2 = (t2) => {
|
|
59541
|
+
if (!t2)
|
|
59542
59542
|
return;
|
|
59543
|
-
const n =
|
|
59544
|
-
|
|
59545
|
-
},
|
|
59546
|
-
const
|
|
59547
|
-
if (!
|
|
59543
|
+
const n = t2.getAttribute("data-background-color") || at;
|
|
59544
|
+
t2.style.setProperty("background-color", n, "important"), t2.setAttribute(Bt, "true"), window.getComputedStyle(t2).display === "none" && t2.style.setProperty("display", "inline", "important");
|
|
59545
|
+
}, mt3 = () => {
|
|
59546
|
+
const t2 = W2.value;
|
|
59547
|
+
if (!t2)
|
|
59548
59548
|
return;
|
|
59549
|
-
|
|
59550
|
-
|
|
59549
|
+
t2.querySelectorAll("[data-background-color]").forEach((o) => {
|
|
59550
|
+
lt2(o);
|
|
59551
59551
|
});
|
|
59552
|
-
},
|
|
59553
|
-
if (!
|
|
59552
|
+
}, te2 = (t2) => {
|
|
59553
|
+
if (!tt2)
|
|
59554
59554
|
return false;
|
|
59555
|
-
if (!
|
|
59556
|
-
return console.warn("视图状态无效,无法恢复高亮选区"),
|
|
59555
|
+
if (!t2 || !t2.state || !t2.state.doc)
|
|
59556
|
+
return console.warn("视图状态无效,无法恢复高亮选区"), rt2(t2), false;
|
|
59557
59557
|
try {
|
|
59558
|
-
const { fromPos: n, toPos:
|
|
59558
|
+
const { fromPos: n, toPos: o } = tt2, r2 = t2.state.doc.content.size;
|
|
59559
59559
|
if (r2 <= 0)
|
|
59560
|
-
return console.warn("文档为空,无法恢复高亮选区"),
|
|
59561
|
-
const s = Math.max(1, Math.min(n,
|
|
59560
|
+
return console.warn("文档为空,无法恢复高亮选区"), rt2(t2), false;
|
|
59561
|
+
const s = Math.max(1, Math.min(n, o, r2 - 1)), c = Math.max(s + 1, Math.min(Math.max(n, o), r2));
|
|
59562
59562
|
if (!(s < c && s >= 1 && c <= r2))
|
|
59563
|
-
return console.warn("位置范围无效,清除高亮:", { normalizedFrom: s, normalizedTo: c, docSize: r2 }),
|
|
59563
|
+
return console.warn("位置范围无效,清除高亮:", { normalizedFrom: s, normalizedTo: c, docSize: r2 }), rt2(t2), false;
|
|
59564
59564
|
try {
|
|
59565
|
-
const d =
|
|
59566
|
-
if (!d && !
|
|
59567
|
-
return console.warn("无法在指定位置找到有效节点"),
|
|
59565
|
+
const d = t2.state.doc.nodeAt(s), x2 = t2.state.doc.nodeAt(c - 1);
|
|
59566
|
+
if (!d && !x2)
|
|
59567
|
+
return console.warn("无法在指定位置找到有效节点"), rt2(t2), false;
|
|
59568
59568
|
} catch (d) {
|
|
59569
59569
|
console.warn("验证节点时出错:", d);
|
|
59570
59570
|
}
|
|
59571
|
-
const
|
|
59572
|
-
if (!
|
|
59573
|
-
return console.warn("无法获取选择器构造函数"),
|
|
59574
|
-
const p2 =
|
|
59571
|
+
const k2 = t2.state.selection.constructor;
|
|
59572
|
+
if (!k2)
|
|
59573
|
+
return console.warn("无法获取选择器构造函数"), rt2(t2), false;
|
|
59574
|
+
const p2 = k2.create(t2.state.doc, s, c);
|
|
59575
59575
|
if (!p2)
|
|
59576
|
-
return console.warn("无法创建选择"),
|
|
59577
|
-
const l =
|
|
59578
|
-
return l ? (
|
|
59576
|
+
return console.warn("无法创建选择"), rt2(t2), false;
|
|
59577
|
+
const l = t2.state.tr.setSelection(p2);
|
|
59578
|
+
return l ? (t2.dispatch(l.scrollIntoView()), t2.focus(), requestAnimationFrame(() => {
|
|
59579
59579
|
try {
|
|
59580
|
-
|
|
59580
|
+
bt2(t2, s, c);
|
|
59581
59581
|
} catch (d) {
|
|
59582
59582
|
console.warn("刷新高亮视觉效果失败:", d);
|
|
59583
59583
|
}
|
|
59584
|
-
}), true) : (console.warn("无法创建事务"),
|
|
59584
|
+
}), true) : (console.warn("无法创建事务"), rt2(t2), false);
|
|
59585
59585
|
} catch (n) {
|
|
59586
|
-
return console.warn("恢复高亮选区失败:", n),
|
|
59586
|
+
return console.warn("恢复高亮选区失败:", n), rt2(t2), false;
|
|
59587
59587
|
}
|
|
59588
|
-
},
|
|
59588
|
+
}, ee2 = (t2) => {
|
|
59589
59589
|
try {
|
|
59590
|
-
const n =
|
|
59591
|
-
return !n || !n.state || !n.state.doc ? (console.warn("编辑器视图不可用"), false) : (
|
|
59590
|
+
const n = e == null ? void 0 : e.prosemirrorView;
|
|
59591
|
+
return !n || !n.state || !n.state.doc ? (console.warn("编辑器视图不可用"), false) : (yt2 = t2, te2(n));
|
|
59592
59592
|
} catch (n) {
|
|
59593
59593
|
return console.warn("选择高亮元素范围失败:", n), false;
|
|
59594
59594
|
}
|
|
59595
|
-
},
|
|
59595
|
+
}, Lt2 = (t2) => {
|
|
59596
59596
|
try {
|
|
59597
59597
|
const n = W2.value;
|
|
59598
59598
|
if (!n)
|
|
59599
59599
|
return;
|
|
59600
|
-
const
|
|
59601
|
-
if (!
|
|
59600
|
+
const o = t2.target;
|
|
59601
|
+
if (!o)
|
|
59602
59602
|
return;
|
|
59603
|
-
const r2 =
|
|
59603
|
+
const r2 = o.closest("[data-ai-highlight],[data-background-color]");
|
|
59604
59604
|
if (!r2 || !n.contains(r2))
|
|
59605
59605
|
return;
|
|
59606
|
-
if (!
|
|
59606
|
+
if (!e || !(e != null && e.prosemirrorView)) {
|
|
59607
59607
|
console.warn("编辑器未初始化,无法处理高亮点击");
|
|
59608
59608
|
return;
|
|
59609
59609
|
}
|
|
59610
|
-
|
|
59610
|
+
ee2(r2) && (t2.preventDefault(), t2.stopPropagation());
|
|
59611
59611
|
} catch (n) {
|
|
59612
59612
|
console.warn("处理高亮元素点击失败:", n);
|
|
59613
59613
|
}
|
|
59614
|
-
},
|
|
59614
|
+
}, Ht2 = (t2) => (t2.metaKey || t2.ctrlKey) && (t2.key === "z" || t2.key === "Z") ? (t2.preventDefault(), t2.stopPropagation(), false) : true, bt2 = (t2, n, o) => {
|
|
59615
59615
|
try {
|
|
59616
|
-
if (!
|
|
59616
|
+
if (!t2 || !t2.state || !t2.state.doc) {
|
|
59617
59617
|
console.warn("视图状态无效,无法刷新高亮视觉效果");
|
|
59618
59618
|
return;
|
|
59619
59619
|
}
|
|
59620
|
-
const r2 =
|
|
59621
|
-
if (n < 1 ||
|
|
59622
|
-
console.warn("位置范围无效,无法刷新高亮视觉效果:", { fromPos: n, toPos:
|
|
59620
|
+
const r2 = t2.state.doc.content.size;
|
|
59621
|
+
if (n < 1 || o > r2 || n >= o) {
|
|
59622
|
+
console.warn("位置范围无效,无法刷新高亮视觉效果:", { fromPos: n, toPos: o, docSize: r2 });
|
|
59623
59623
|
return;
|
|
59624
59624
|
}
|
|
59625
|
-
|
|
59625
|
+
se2(t2, n, o), mt3();
|
|
59626
59626
|
} catch (r2) {
|
|
59627
59627
|
console.warn("刷新高亮视觉效果失败:", r2);
|
|
59628
59628
|
}
|
|
59629
|
-
},
|
|
59630
|
-
if (!
|
|
59629
|
+
}, oe2 = (t2, n, o) => {
|
|
59630
|
+
if (!t2)
|
|
59631
59631
|
return null;
|
|
59632
59632
|
try {
|
|
59633
|
-
const r2 =
|
|
59633
|
+
const r2 = t2.spec;
|
|
59634
59634
|
if (r2 != null && r2.attrs && typeof r2.attrs == "object") {
|
|
59635
59635
|
const s = Object.keys(r2.attrs);
|
|
59636
|
-
for (const c of
|
|
59636
|
+
for (const c of o)
|
|
59637
59637
|
if (s.includes(c))
|
|
59638
|
-
return
|
|
59638
|
+
return t2.create({ [c]: n });
|
|
59639
59639
|
}
|
|
59640
|
-
return
|
|
59640
|
+
return t2.create({ [o[0]]: n });
|
|
59641
59641
|
} catch (r2) {
|
|
59642
59642
|
return console.warn("创建颜色 mark 失败:", r2), null;
|
|
59643
59643
|
}
|
|
59644
|
-
}, $
|
|
59645
|
-
console.log("applyDomHighlightFallback",
|
|
59644
|
+
}, $t2 = (t2, n, o, r2 = 0) => {
|
|
59645
|
+
console.log("applyDomHighlightFallback", t2, n, o, "retry:", r2);
|
|
59646
59646
|
const s = () => {
|
|
59647
59647
|
try {
|
|
59648
|
-
const
|
|
59648
|
+
const k2 = t2.domAtPos(n), p2 = t2.domAtPos(o), l = k2.node, d = p2.node, x2 = () => {
|
|
59649
59649
|
try {
|
|
59650
|
-
const
|
|
59651
|
-
|
|
59650
|
+
const h2 = document.createRange();
|
|
59651
|
+
h2.setStart(l, k2.offset), h2.setEnd(d, p2.offset);
|
|
59652
59652
|
const u = document.createTreeWalker(
|
|
59653
|
-
|
|
59653
|
+
h2.commonAncestorContainer,
|
|
59654
59654
|
NodeFilter.SHOW_TEXT,
|
|
59655
59655
|
{
|
|
59656
|
-
acceptNode: (
|
|
59656
|
+
acceptNode: (_) => h2.intersectsNode(_) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
|
|
59657
59657
|
}
|
|
59658
59658
|
);
|
|
59659
59659
|
let m2;
|
|
59660
|
-
const
|
|
59661
|
-
let
|
|
59660
|
+
const a = /* @__PURE__ */ new Set();
|
|
59661
|
+
let D2 = 0;
|
|
59662
59662
|
for (; m2 = u.nextNode(); )
|
|
59663
59663
|
if (m2.nodeType === Node.TEXT_NODE) {
|
|
59664
|
-
const
|
|
59665
|
-
|
|
59664
|
+
const _ = m2.parentElement;
|
|
59665
|
+
_ && !a.has(_) && (a.add(_), _.hasAttribute(Bt) || (lt2(_), D2++));
|
|
59666
59666
|
}
|
|
59667
|
-
return console.log("DOM 高亮已应用到多个节点,数量:",
|
|
59668
|
-
} catch (
|
|
59669
|
-
console.warn("创建 range 失败,使用简单方式:",
|
|
59667
|
+
return console.log("DOM 高亮已应用到多个节点,数量:", D2, "已高亮节点:", a.size), D2 > 0 && mt3(), D2 > 0;
|
|
59668
|
+
} catch (h2) {
|
|
59669
|
+
console.warn("创建 range 失败,使用简单方式:", h2);
|
|
59670
59670
|
let u = false;
|
|
59671
59671
|
if (l.nodeType === Node.TEXT_NODE) {
|
|
59672
59672
|
const m2 = l.parentElement;
|
|
59673
|
-
m2 && (
|
|
59673
|
+
m2 && (lt2(m2), u = true);
|
|
59674
59674
|
}
|
|
59675
59675
|
if (d.nodeType === Node.TEXT_NODE && d !== l) {
|
|
59676
59676
|
const m2 = d.parentElement;
|
|
59677
|
-
m2 && (
|
|
59677
|
+
m2 && (lt2(m2), u = true);
|
|
59678
59678
|
}
|
|
59679
|
-
return u &&
|
|
59679
|
+
return u && mt3(), u;
|
|
59680
59680
|
}
|
|
59681
59681
|
};
|
|
59682
59682
|
if (l === d && l.nodeType === Node.TEXT_NODE) {
|
|
59683
|
-
const
|
|
59684
|
-
if (
|
|
59685
|
-
return
|
|
59683
|
+
const h2 = l.parentElement;
|
|
59684
|
+
if (h2)
|
|
59685
|
+
return lt2(h2), console.log("DOM 高亮已应用到单节点"), mt3(), true;
|
|
59686
59686
|
} else
|
|
59687
|
-
return
|
|
59688
|
-
} catch (
|
|
59689
|
-
return console.warn("通过 DOM 应用高亮失败:",
|
|
59687
|
+
return x2();
|
|
59688
|
+
} catch (k2) {
|
|
59689
|
+
return console.warn("通过 DOM 应用高亮失败:", k2), false;
|
|
59690
59690
|
}
|
|
59691
59691
|
}, c = r2 === 0 ? 80 : 150 * (r2 + 1);
|
|
59692
59692
|
setTimeout(() => {
|
|
59693
|
-
const
|
|
59694
|
-
!
|
|
59695
|
-
|
|
59693
|
+
const k2 = s();
|
|
59694
|
+
!k2 && r2 < 2 ? $t2(t2, n, o, r2 + 1) : k2 && setTimeout(() => {
|
|
59695
|
+
mt3();
|
|
59696
59696
|
}, 50);
|
|
59697
59697
|
try {
|
|
59698
|
-
const p2 =
|
|
59699
|
-
|
|
59700
|
-
p2.tr.setSelection(l.create(p2.doc, n,
|
|
59701
|
-
), typeof
|
|
59702
|
-
backgroundColor:
|
|
59698
|
+
const p2 = t2.state, l = p2.selection.constructor;
|
|
59699
|
+
t2.dispatch(
|
|
59700
|
+
p2.tr.setSelection(l.create(p2.doc, n, o)).scrollIntoView()
|
|
59701
|
+
), typeof e.addStyles == "function" && (e.addStyles({
|
|
59702
|
+
backgroundColor: at
|
|
59703
59703
|
}), console.log("使用 BlockNote addStyles API 作为兜底"));
|
|
59704
59704
|
} catch (p2) {
|
|
59705
59705
|
console.warn("addStyles API 失败:", p2);
|
|
59706
59706
|
}
|
|
59707
59707
|
}, c);
|
|
59708
|
-
},
|
|
59708
|
+
}, Vt2 = async (t2, n, o) => {
|
|
59709
59709
|
var l;
|
|
59710
|
-
if (!
|
|
59710
|
+
if (!t2 || typeof n != "number" || typeof o != "number" || n >= o)
|
|
59711
59711
|
return false;
|
|
59712
|
-
const r2 =
|
|
59713
|
-
let c = r2.tr,
|
|
59714
|
-
const p2 =
|
|
59712
|
+
const r2 = t2.state, s = (l = r2.schema.marks) == null ? void 0 : l.backgroundColor;
|
|
59713
|
+
let c = r2.tr, k2 = false;
|
|
59714
|
+
const p2 = oe2(s, at, [
|
|
59715
59715
|
"stringValue",
|
|
59716
59716
|
"color",
|
|
59717
59717
|
"backgroundColor"
|
|
59718
59718
|
]);
|
|
59719
|
-
return p2 && (c = c.addMark(n,
|
|
59720
|
-
},
|
|
59721
|
-
const
|
|
59722
|
-
if (!
|
|
59719
|
+
return p2 && (c = c.addMark(n, o, p2), k2 = true), k2 && c.steps.length > 0 && (t2.dispatch(c.scrollIntoView()), await nextTick(), await new Promise((d) => setTimeout(d, 50))), tt2 = { fromPos: n, toPos: o }, bt2(t2, n, o), $t2(t2, n, o), k2;
|
|
59720
|
+
}, ne2 = () => {
|
|
59721
|
+
const t2 = W2.value;
|
|
59722
|
+
if (!t2)
|
|
59723
59723
|
return;
|
|
59724
|
-
|
|
59725
|
-
const r2 =
|
|
59726
|
-
r2.style.removeProperty("background-color"), r2.style.removeProperty("color"), r2.style.removeProperty("display"), r2.removeAttribute(
|
|
59724
|
+
t2.querySelectorAll(`[${Bt}]`).forEach((o) => {
|
|
59725
|
+
const r2 = o;
|
|
59726
|
+
r2.style.removeProperty("background-color"), r2.style.removeProperty("color"), r2.style.removeProperty("display"), r2.removeAttribute(Bt);
|
|
59727
59727
|
});
|
|
59728
|
-
},
|
|
59729
|
-
|
|
59730
|
-
},
|
|
59731
|
-
const
|
|
59732
|
-
return
|
|
59733
|
-
n.preventDefault(), n.stopPropagation(),
|
|
59734
|
-
})),
|
|
59735
|
-
},
|
|
59728
|
+
}, ut2 = () => {
|
|
59729
|
+
ct2 && (ct2.style.display = "none"), tt2 = null;
|
|
59730
|
+
}, re2 = () => {
|
|
59731
|
+
const t2 = W2.value;
|
|
59732
|
+
return t2 ? (ct2 || (ct2 = document.createElement("div"), ct2.className = "ai-highlight-cancel-badge", ct2.innerHTML = "×", ct2.addEventListener("click", (n) => {
|
|
59733
|
+
n.preventDefault(), n.stopPropagation(), rt2();
|
|
59734
|
+
})), t2.contains(ct2) || t2.appendChild(ct2), ct2) : null;
|
|
59735
|
+
}, se2 = (t2, n, o) => {
|
|
59736
59736
|
try {
|
|
59737
|
-
if (!
|
|
59737
|
+
if (!t2 || !t2.state || !t2.state.doc) {
|
|
59738
59738
|
console.warn("视图状态无效,无法显示高亮角标");
|
|
59739
59739
|
return;
|
|
59740
59740
|
}
|
|
59741
|
-
const r2 =
|
|
59741
|
+
const r2 = re2(), s = W2.value;
|
|
59742
59742
|
if (!r2 || !s)
|
|
59743
59743
|
return;
|
|
59744
|
-
const c = s.getBoundingClientRect(),
|
|
59744
|
+
const c = s.getBoundingClientRect(), k2 = (p2) => {
|
|
59745
59745
|
const l = p2.top - c.top + s.scrollTop - 12, d = p2.left - c.left + s.scrollLeft - 12;
|
|
59746
59746
|
r2.style.top = `${Math.max(l, 0)}px`, r2.style.left = `${Math.max(d, 0)}px`, r2.style.display = "flex";
|
|
59747
59747
|
};
|
|
59748
59748
|
try {
|
|
59749
|
-
const p2 =
|
|
59749
|
+
const p2 = t2.state.doc.content.size;
|
|
59750
59750
|
if (p2 <= 0) {
|
|
59751
59751
|
console.warn("文档为空,无法定位高亮角标");
|
|
59752
59752
|
return;
|
|
@@ -59756,73 +59756,73 @@ const Vt = {
|
|
|
59756
59756
|
console.warn("位置无效,无法定位高亮角标:", { normalizedFrom: l, docSize: p2 });
|
|
59757
59757
|
return;
|
|
59758
59758
|
}
|
|
59759
|
-
const d =
|
|
59759
|
+
const d = t2.coordsAtPos(l);
|
|
59760
59760
|
if (d)
|
|
59761
|
-
|
|
59761
|
+
k2({ top: d.top, left: d.left });
|
|
59762
59762
|
else
|
|
59763
59763
|
throw new Error("无法获取坐标");
|
|
59764
59764
|
} catch (p2) {
|
|
59765
59765
|
console.warn("高亮角标定位失败:", p2);
|
|
59766
|
-
const l = (
|
|
59766
|
+
const l = (yt2 && s.contains(yt2) ? yt2 : s.querySelector("[data-ai-highlight]")) || null;
|
|
59767
59767
|
if (l) {
|
|
59768
59768
|
const d = l.getBoundingClientRect();
|
|
59769
|
-
|
|
59769
|
+
k2({ top: d.top, left: d.left });
|
|
59770
59770
|
}
|
|
59771
59771
|
}
|
|
59772
59772
|
} catch (r2) {
|
|
59773
59773
|
console.warn("显示高亮角标失败:", r2);
|
|
59774
59774
|
}
|
|
59775
|
-
},
|
|
59776
|
-
var
|
|
59777
|
-
const n =
|
|
59778
|
-
if (n &&
|
|
59779
|
-
const { fromPos: s, toPos: c } =
|
|
59775
|
+
}, rt2 = (t2) => {
|
|
59776
|
+
var o, r2;
|
|
59777
|
+
const n = t2 || (e == null ? void 0 : e.prosemirrorView);
|
|
59778
|
+
if (n && tt2) {
|
|
59779
|
+
const { fromPos: s, toPos: c } = tt2, k2 = (o = n.state.schema.marks) == null ? void 0 : o.backgroundColor, p2 = (r2 = n.state.schema.marks) == null ? void 0 : r2.textColor;
|
|
59780
59780
|
let l = n.state.tr, d = false;
|
|
59781
|
-
|
|
59781
|
+
k2 && (l = l.removeMark(s, c, k2), d = true), p2 && (l = l.removeMark(s, c, p2), d = true), d && n.dispatch(l.scrollIntoView());
|
|
59782
59782
|
}
|
|
59783
|
-
|
|
59784
|
-
},
|
|
59785
|
-
if (!
|
|
59783
|
+
ne2(), ut2(), tt2 = null, yt2 = null;
|
|
59784
|
+
}, le2 = () => tt2 ? { ...tt2 } : null, Ot$12 = () => {
|
|
59785
|
+
if (!tt2)
|
|
59786
59786
|
return;
|
|
59787
|
-
const
|
|
59788
|
-
|
|
59789
|
-
},
|
|
59787
|
+
const t2 = e == null ? void 0 : e.prosemirrorView;
|
|
59788
|
+
t2 && bt2(t2, tt2.fromPos, tt2.toPos);
|
|
59789
|
+
}, Ft2 = (t2, n) => {
|
|
59790
59790
|
try {
|
|
59791
|
-
const
|
|
59792
|
-
if (!
|
|
59791
|
+
const o = W2.value;
|
|
59792
|
+
if (!o)
|
|
59793
59793
|
return;
|
|
59794
59794
|
let r2 = null;
|
|
59795
|
-
if (
|
|
59795
|
+
if (t2 && (r2 = o.querySelector(`[data-node-id="${t2}"]`) || o.querySelector(`[data-block-id="${t2}"]`) || o.querySelector(`[data-id="${t2}"]`) || document.querySelector(`[data-node-id="${t2}"]`) || document.querySelector(`[data-block-id="${t2}"]`) || document.querySelector(`[data-id="${t2}"]`)), r2) {
|
|
59796
59796
|
let s = r2, c = 0;
|
|
59797
|
-
for (; s && s !==
|
|
59797
|
+
for (; s && s !== o; )
|
|
59798
59798
|
c += s.offsetTop, s = s.offsetParent;
|
|
59799
|
-
const
|
|
59800
|
-
|
|
59801
|
-
} else if (typeof n == "number" && (
|
|
59799
|
+
const k2 = Math.max(0, c - 60);
|
|
59800
|
+
o.scrollTo({ top: k2, behavior: "smooth" });
|
|
59801
|
+
} else if (typeof n == "number" && (e != null && e.prosemirrorView))
|
|
59802
59802
|
try {
|
|
59803
|
-
const c =
|
|
59804
|
-
|
|
59803
|
+
const c = e.prosemirrorView.coordsAtPos(n), k2 = o.getBoundingClientRect(), p2 = c.top - k2.top + o.scrollTop - 60;
|
|
59804
|
+
o.scrollTo({ top: Math.max(0, p2), behavior: "smooth" });
|
|
59805
59805
|
} catch {
|
|
59806
59806
|
}
|
|
59807
59807
|
} catch {
|
|
59808
59808
|
}
|
|
59809
|
-
},
|
|
59810
|
-
if (!
|
|
59809
|
+
}, ce3 = (t2, n) => {
|
|
59810
|
+
if (!t2 || typeof t2 != "object")
|
|
59811
59811
|
return null;
|
|
59812
|
-
if (!
|
|
59813
|
-
const
|
|
59812
|
+
if (!t2.id || typeof t2.id != "string") {
|
|
59813
|
+
const o = `block-${Date.now()}-${n}-${Math.random().toString(36).substr(2, 9)}`;
|
|
59814
59814
|
return {
|
|
59815
|
-
...
|
|
59816
|
-
id:
|
|
59815
|
+
...t2,
|
|
59816
|
+
id: o
|
|
59817
59817
|
};
|
|
59818
59818
|
}
|
|
59819
|
-
return
|
|
59820
|
-
},
|
|
59821
|
-
if (!Array.isArray(
|
|
59819
|
+
return t2;
|
|
59820
|
+
}, _t2 = (t2, n = "root") => {
|
|
59821
|
+
if (!Array.isArray(t2))
|
|
59822
59822
|
return [];
|
|
59823
|
-
const
|
|
59824
|
-
for (let r2 = 0; r2 <
|
|
59825
|
-
const s =
|
|
59823
|
+
const o = [];
|
|
59824
|
+
for (let r2 = 0; r2 < t2.length; r2++) {
|
|
59825
|
+
const s = t2[r2];
|
|
59826
59826
|
if (!s || typeof s != "object") {
|
|
59827
59827
|
console.warn(`[${n}][${r2}] 项无效(非对象或为空),已忽略`);
|
|
59828
59828
|
continue;
|
|
@@ -59831,45 +59831,45 @@ const Vt = {
|
|
|
59831
59831
|
console.warn(`[${n}][${r2}] 项缺少有效的 type 字段,已忽略`);
|
|
59832
59832
|
continue;
|
|
59833
59833
|
}
|
|
59834
|
-
const c =
|
|
59835
|
-
c && (Array.isArray(c.children) && (c.children =
|
|
59834
|
+
const c = ce3(s, r2);
|
|
59835
|
+
c && (Array.isArray(c.children) && (c.children = _t2(c.children, `${n}[${r2}].children`)), Array.isArray(c.content) && (c.content = c.content.filter((k2) => k2 && typeof k2 == "object")), o.push(c));
|
|
59836
59836
|
}
|
|
59837
|
-
return
|
|
59838
|
-
},
|
|
59839
|
-
if (!Array.isArray(
|
|
59837
|
+
return o;
|
|
59838
|
+
}, It$12 = (t2) => {
|
|
59839
|
+
if (!Array.isArray(t2))
|
|
59840
59840
|
return [];
|
|
59841
59841
|
try {
|
|
59842
|
-
console.log("开始验证内容数据,原始长度:",
|
|
59843
|
-
const n =
|
|
59842
|
+
console.log("开始验证内容数据,原始长度:", t2.length);
|
|
59843
|
+
const n = _t2(t2, "root");
|
|
59844
59844
|
return console.log("验证完成,保留条目数:", n.length), n;
|
|
59845
59845
|
} catch (n) {
|
|
59846
59846
|
return console.warn("验证内容数据时出错,回退为空数组:", n), [];
|
|
59847
59847
|
}
|
|
59848
|
-
},
|
|
59848
|
+
}, Nt2 = async () => {
|
|
59849
59849
|
if (W2.value)
|
|
59850
59850
|
try {
|
|
59851
|
-
console.log("开始渲染 BlockNote 编辑器..."),
|
|
59852
|
-
const
|
|
59853
|
-
const
|
|
59854
|
-
|
|
59851
|
+
console.log("开始渲染 BlockNote 编辑器..."), ht2 = zt(W2.value);
|
|
59852
|
+
const t2 = () => {
|
|
59853
|
+
const o = C(), r2 = p(), [s, c] = React__default.useState(false), [k2, p$1] = React__default.useState(
|
|
59854
|
+
o.getActiveStyles().backgroundColor === "yellow"
|
|
59855
59855
|
), [l, d] = React__default.useState({
|
|
59856
59856
|
top: "100%",
|
|
59857
59857
|
bottom: "auto",
|
|
59858
59858
|
direction: "down"
|
|
59859
59859
|
});
|
|
59860
59860
|
R(), z(() => {
|
|
59861
|
-
p$1(
|
|
59862
|
-
},
|
|
59863
|
-
const
|
|
59864
|
-
const
|
|
59865
|
-
if (!
|
|
59861
|
+
p$1(o.getActiveStyles().backgroundColor === "yellow");
|
|
59862
|
+
}, o);
|
|
59863
|
+
const x2 = React__default.useCallback(() => {
|
|
59864
|
+
const a = document.querySelector(".bn-formatting-toolbar");
|
|
59865
|
+
if (!a)
|
|
59866
59866
|
return {
|
|
59867
59867
|
top: "100%",
|
|
59868
59868
|
bottom: "auto",
|
|
59869
59869
|
direction: "down"
|
|
59870
59870
|
};
|
|
59871
|
-
const
|
|
59872
|
-
return
|
|
59871
|
+
const D2 = a.getBoundingClientRect(), _ = window.innerHeight, i = 271, g = 10;
|
|
59872
|
+
return _ - D2.bottom < i + g ? {
|
|
59873
59873
|
top: "auto",
|
|
59874
59874
|
bottom: "100%",
|
|
59875
59875
|
direction: "up"
|
|
@@ -59881,86 +59881,86 @@ const Vt = {
|
|
|
59881
59881
|
}, []);
|
|
59882
59882
|
React__default.useEffect(() => {
|
|
59883
59883
|
if (s) {
|
|
59884
|
-
const
|
|
59885
|
-
const
|
|
59886
|
-
d(
|
|
59887
|
-
},
|
|
59888
|
-
const
|
|
59889
|
-
d(
|
|
59884
|
+
const a = () => {
|
|
59885
|
+
const _ = x2();
|
|
59886
|
+
d(_);
|
|
59887
|
+
}, D2 = () => {
|
|
59888
|
+
const _ = x2();
|
|
59889
|
+
d(_);
|
|
59890
59890
|
};
|
|
59891
|
-
return window.addEventListener("resize",
|
|
59892
|
-
window.removeEventListener("resize",
|
|
59891
|
+
return window.addEventListener("resize", a), window.addEventListener("scroll", D2, true), () => {
|
|
59892
|
+
window.removeEventListener("resize", a), window.removeEventListener("scroll", D2, true);
|
|
59893
59893
|
};
|
|
59894
59894
|
}
|
|
59895
|
-
}, [s,
|
|
59896
|
-
let
|
|
59895
|
+
}, [s, x2]);
|
|
59896
|
+
let h2 = [];
|
|
59897
59897
|
try {
|
|
59898
|
-
|
|
59898
|
+
h2 = R(), h2 = Array.isArray(h2) ? h2.filter((a) => {
|
|
59899
59899
|
try {
|
|
59900
|
-
return
|
|
59900
|
+
return a && typeof a == "object" && a.content !== void 0;
|
|
59901
59901
|
} catch {
|
|
59902
59902
|
return false;
|
|
59903
59903
|
}
|
|
59904
59904
|
}) : [];
|
|
59905
|
-
} catch (
|
|
59906
|
-
console.warn("获取选中块失败(可能跨多个block):",
|
|
59905
|
+
} catch (a) {
|
|
59906
|
+
console.warn("获取选中块失败(可能跨多个block):", a), h2 = [];
|
|
59907
59907
|
}
|
|
59908
|
-
if (
|
|
59908
|
+
if (h2.length === 0)
|
|
59909
59909
|
return null;
|
|
59910
|
-
const u = (
|
|
59911
|
-
var
|
|
59912
|
-
let
|
|
59910
|
+
const u = (a, D2) => {
|
|
59911
|
+
var L3, E2, z2, S, w, I2, b, T2;
|
|
59912
|
+
let _ = null;
|
|
59913
59913
|
try {
|
|
59914
|
-
const
|
|
59915
|
-
if (
|
|
59916
|
-
const { selection:
|
|
59917
|
-
if (
|
|
59918
|
-
const F2 =
|
|
59914
|
+
const y = e == null ? void 0 : e.prosemirrorView, v2 = (e == null ? void 0 : e.prosemirrorState) || (y == null ? void 0 : y.state);
|
|
59915
|
+
if (y && v2) {
|
|
59916
|
+
const { selection: A } = v2;
|
|
59917
|
+
if (A && A.from !== A.to) {
|
|
59918
|
+
const F2 = A.from, j2 = A.to;
|
|
59919
59919
|
let Z2 = "";
|
|
59920
59920
|
try {
|
|
59921
|
-
Z2 =
|
|
59921
|
+
Z2 = v2.doc.textBetween(F2, j2, `
|
|
59922
59922
|
`);
|
|
59923
59923
|
} catch {
|
|
59924
59924
|
Z2 = "";
|
|
59925
59925
|
}
|
|
59926
|
-
Z2 && (
|
|
59926
|
+
Z2 && (_ = {
|
|
59927
59927
|
from: F2,
|
|
59928
59928
|
to: j2,
|
|
59929
59929
|
text: Z2
|
|
59930
59930
|
});
|
|
59931
59931
|
}
|
|
59932
59932
|
}
|
|
59933
|
-
} catch (
|
|
59934
|
-
console.warn("保存选区信息失败:",
|
|
59933
|
+
} catch (y) {
|
|
59934
|
+
console.warn("保存选区信息失败:", y);
|
|
59935
59935
|
}
|
|
59936
|
-
if (
|
|
59936
|
+
if (D2.preventDefault(), D2.stopPropagation(), console.log("handleMenuClick", a), c(false), _)
|
|
59937
59937
|
try {
|
|
59938
|
-
const
|
|
59939
|
-
if (!
|
|
59938
|
+
const y = e == null ? void 0 : e.prosemirrorView;
|
|
59939
|
+
if (!y)
|
|
59940
59940
|
console.warn("无法获取 ProseMirror 视图");
|
|
59941
59941
|
else {
|
|
59942
|
-
|
|
59943
|
-
const { from:
|
|
59942
|
+
rt2(y);
|
|
59943
|
+
const { from: v2, to: A, text: F2 } = _, j2 = y.state, Z2 = ((L3 = j2.schema.marks) == null ? void 0 : L3.textStyle) || ((E2 = j2.schema.marks) == null ? void 0 : E2.style) || null, K2 = (z2 = j2.schema.marks) == null ? void 0 : z2.backgroundColor, f = (S = j2.schema.marks) == null ? void 0 : S.textColor;
|
|
59944
59944
|
console.log("准备应用样式", {
|
|
59945
|
-
from:
|
|
59946
|
-
to:
|
|
59945
|
+
from: v2,
|
|
59946
|
+
to: A,
|
|
59947
59947
|
text: F2,
|
|
59948
59948
|
textStyle: Z2,
|
|
59949
|
-
backgroundColorMark:
|
|
59949
|
+
backgroundColorMark: K2,
|
|
59950
59950
|
textColorMark: f
|
|
59951
59951
|
});
|
|
59952
|
-
const
|
|
59952
|
+
const C2 = v2, P2 = A;
|
|
59953
59953
|
try {
|
|
59954
|
-
let
|
|
59955
|
-
|
|
59956
|
-
} catch (
|
|
59957
|
-
console.warn("移除旧样式失败:",
|
|
59954
|
+
let R2 = j2.tr;
|
|
59955
|
+
K2 && (R2 = R2.removeMark(C2, P2, K2)), f && (R2 = R2.removeMark(C2, P2, f)), R2.steps.length > 0 && (y.dispatch(R2), console.log("已移除旧样式"));
|
|
59956
|
+
} catch (R2) {
|
|
59957
|
+
console.warn("移除旧样式失败:", R2);
|
|
59958
59958
|
}
|
|
59959
59959
|
try {
|
|
59960
|
-
let
|
|
59961
|
-
if (
|
|
59960
|
+
let R2 = y.state.tr, N2 = false;
|
|
59961
|
+
if (K2)
|
|
59962
59962
|
try {
|
|
59963
|
-
const H2 =
|
|
59963
|
+
const H2 = K2.spec;
|
|
59964
59964
|
console.log(
|
|
59965
59965
|
"backgroundColorMark spec:",
|
|
59966
59966
|
H2,
|
|
@@ -59970,21 +59970,21 @@ const Vt = {
|
|
|
59970
59970
|
let $2 = null;
|
|
59971
59971
|
if (H2.attrs && typeof H2.attrs == "object") {
|
|
59972
59972
|
const Y2 = Object.keys(H2.attrs);
|
|
59973
|
-
console.log("backgroundColorMark attrs keys:", Y2), Y2.includes("stringValue") ? $2 =
|
|
59974
|
-
backgroundColor:
|
|
59975
|
-
}) : $2 =
|
|
59973
|
+
console.log("backgroundColorMark attrs keys:", Y2), Y2.includes("stringValue") ? $2 = K2.create({ stringValue: at }) : Y2.includes("color") ? $2 = K2.create({ color: at }) : Y2.includes("backgroundColor") ? $2 = K2.create({
|
|
59974
|
+
backgroundColor: at
|
|
59975
|
+
}) : $2 = K2.create({ stringValue: at });
|
|
59976
59976
|
} else
|
|
59977
|
-
$2 =
|
|
59978
|
-
$2 && (console.log("创建背景色 mark 成功", $2, "attrs:", $2.attrs),
|
|
59977
|
+
$2 = K2.create({ stringValue: at });
|
|
59978
|
+
$2 && (console.log("创建背景色 mark 成功", $2, "attrs:", $2.attrs), R2 = R2.addMark(C2, P2, $2), N2 = true);
|
|
59979
59979
|
} catch (H2) {
|
|
59980
59980
|
console.error("创建背景色 mark 失败:", H2);
|
|
59981
59981
|
}
|
|
59982
59982
|
if (N2) {
|
|
59983
|
-
|
|
59983
|
+
y.dispatch(R2.scrollIntoView()), console.log("样式 marks 已应用", { fromPos: C2, toPos: P2 }), tt2 = { fromPos: C2, toPos: P2 }, bt2(y, C2, P2);
|
|
59984
59984
|
try {
|
|
59985
|
-
|
|
59985
|
+
y.state.doc.nodesBetween(C2, P2, ($2, Y2) => {
|
|
59986
59986
|
if ($2.isText) {
|
|
59987
|
-
const U2 = $2.marks || [], q2 = U2.find((
|
|
59987
|
+
const U2 = $2.marks || [], q2 = U2.find((J) => J.type.name === "backgroundColor"), G2 = U2.find((J) => J.type.name === "textColor");
|
|
59988
59988
|
(q2 || G2) && console.log("确认 marks 在文档中:", {
|
|
59989
59989
|
pos: Y2,
|
|
59990
59990
|
text: $2.text,
|
|
@@ -59998,40 +59998,40 @@ const Vt = {
|
|
|
59998
59998
|
}
|
|
59999
59999
|
setTimeout(() => {
|
|
60000
60000
|
try {
|
|
60001
|
-
const H2 =
|
|
60001
|
+
const H2 = y.domAtPos(C2), $2 = y.domAtPos(P2);
|
|
60002
60002
|
(() => {
|
|
60003
60003
|
try {
|
|
60004
60004
|
const U2 = H2.node, q2 = $2.node;
|
|
60005
60005
|
if (U2 === q2 && U2.nodeType === Node.TEXT_NODE) {
|
|
60006
60006
|
const G2 = U2.parentElement;
|
|
60007
|
-
G2 && (
|
|
60007
|
+
G2 && (lt2(G2), console.log("已修复单个节点的样式"));
|
|
60008
60008
|
} else {
|
|
60009
60009
|
const G2 = document.createRange();
|
|
60010
60010
|
try {
|
|
60011
60011
|
G2.setStart(U2, H2.offset), G2.setEnd(q2, $2.offset);
|
|
60012
|
-
const
|
|
60012
|
+
const J = document.createTreeWalker(
|
|
60013
60013
|
G2.commonAncestorContainer,
|
|
60014
60014
|
NodeFilter.SHOW_TEXT,
|
|
60015
60015
|
{
|
|
60016
|
-
acceptNode: (
|
|
60016
|
+
acceptNode: (gt3) => G2.intersectsNode(gt3) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
|
|
60017
60017
|
}
|
|
60018
60018
|
), X = [];
|
|
60019
60019
|
let Q2;
|
|
60020
|
-
for (; Q2 =
|
|
60020
|
+
for (; Q2 = J.nextNode(); )
|
|
60021
60021
|
Q2.nodeType === Node.TEXT_NODE && X.push(Q2);
|
|
60022
|
-
const
|
|
60023
|
-
X.forEach((
|
|
60024
|
-
const
|
|
60025
|
-
|
|
60026
|
-
}), console.log("已修复多个节点的样式",
|
|
60027
|
-
} catch (
|
|
60028
|
-
if (console.warn("使用 Range 失败,尝试简单方法:",
|
|
60022
|
+
const st2 = /* @__PURE__ */ new Set();
|
|
60023
|
+
X.forEach((gt3) => {
|
|
60024
|
+
const dt2 = gt3.parentElement;
|
|
60025
|
+
dt2 && !st2.has(dt2) && (st2.add(dt2), lt2(dt2));
|
|
60026
|
+
}), console.log("已修复多个节点的样式", st2.size);
|
|
60027
|
+
} catch (J) {
|
|
60028
|
+
if (console.warn("使用 Range 失败,尝试简单方法:", J), U2.nodeType === Node.TEXT_NODE) {
|
|
60029
60029
|
const X = U2.parentElement;
|
|
60030
|
-
X &&
|
|
60030
|
+
X && lt2(X);
|
|
60031
60031
|
}
|
|
60032
60032
|
if (q2.nodeType === Node.TEXT_NODE && q2 !== U2) {
|
|
60033
60033
|
const X = q2.parentElement;
|
|
60034
|
-
X &&
|
|
60034
|
+
X && lt2(X);
|
|
60035
60035
|
}
|
|
60036
60036
|
}
|
|
60037
60037
|
}
|
|
@@ -60044,10 +60044,10 @@ const Vt = {
|
|
|
60044
60044
|
}
|
|
60045
60045
|
}, 50);
|
|
60046
60046
|
try {
|
|
60047
|
-
|
|
60047
|
+
y.state.doc.nodesBetween(C2, P2, ($2, Y2) => {
|
|
60048
60048
|
if ($2.isText) {
|
|
60049
|
-
const U2 = Y2, q2 = Y2 + $2.text.length, G2 = Math.max(
|
|
60050
|
-
if (G2 <
|
|
60049
|
+
const U2 = Y2, q2 = Y2 + $2.text.length, G2 = Math.max(C2, U2), J = Math.min(P2, q2);
|
|
60050
|
+
if (G2 < J) {
|
|
60051
60051
|
const X = $2.marks || [];
|
|
60052
60052
|
console.log(
|
|
60053
60053
|
"文本节点的 marks:",
|
|
@@ -60063,125 +60063,125 @@ const Vt = {
|
|
|
60063
60063
|
console.warn("检查 marks 失败:", H2);
|
|
60064
60064
|
}
|
|
60065
60065
|
try {
|
|
60066
|
-
|
|
60066
|
+
y.updateState(y.state), console.log("视图已强制更新");
|
|
60067
60067
|
try {
|
|
60068
|
-
const H2 =
|
|
60069
|
-
|
|
60068
|
+
const H2 = y.state.tr;
|
|
60069
|
+
y.dispatch(H2), console.log("已触发空 transaction 强制重新渲染");
|
|
60070
60070
|
} catch (H2) {
|
|
60071
60071
|
console.warn("触发空 transaction 失败:", H2);
|
|
60072
60072
|
}
|
|
60073
|
-
typeof
|
|
60073
|
+
typeof e.updateContent == "function" && (e.updateContent(), console.log("已调用 BlockNote updateContent"));
|
|
60074
60074
|
} catch (H2) {
|
|
60075
60075
|
console.warn("强制更新视图失败:", H2);
|
|
60076
60076
|
}
|
|
60077
60077
|
}
|
|
60078
|
-
} catch (
|
|
60079
|
-
console.error("应用样式失败:",
|
|
60078
|
+
} catch (R2) {
|
|
60079
|
+
console.error("应用样式失败:", R2);
|
|
60080
60080
|
}
|
|
60081
60081
|
setTimeout(() => {
|
|
60082
60082
|
try {
|
|
60083
|
-
const
|
|
60083
|
+
const R2 = y.state, N2 = y.domAtPos(C2), H2 = y.domAtPos(P2);
|
|
60084
60084
|
console.log("DOM 位置信息:", { start: N2, end: H2 });
|
|
60085
60085
|
let $2 = false, Y2 = false;
|
|
60086
|
-
if (
|
|
60086
|
+
if (R2.doc.nodesBetween(C2, P2, (q2, G2) => {
|
|
60087
60087
|
q2.isText && (q2.marks || []).forEach((X) => {
|
|
60088
|
-
X.type.name === "backgroundColor" && X.attrs.stringValue ===
|
|
60088
|
+
X.type.name === "backgroundColor" && X.attrs.stringValue === at && ($2 = true, console.log("找到背景色 mark:", X)), X.type.name === "textColor" && X.attrs.stringValue === Ne && (Y2 = true, console.log("找到文字颜色 mark:", X));
|
|
60089
60089
|
});
|
|
60090
60090
|
}), console.log("Marks 检查结果:", { foundBgMark: $2, foundTextMark: Y2 }), $2 || Y2)
|
|
60091
60091
|
try {
|
|
60092
|
-
const q2 =
|
|
60093
|
-
if (
|
|
60094
|
-
let Q2 =
|
|
60092
|
+
const q2 = y.domAtPos(C2), G2 = y.domAtPos(P2), J = q2.node, X = G2.node;
|
|
60093
|
+
if (J && J === X && J.nodeType === Node.TEXT_NODE) {
|
|
60094
|
+
let Q2 = J.parentElement;
|
|
60095
60095
|
if (Q2) {
|
|
60096
|
-
const
|
|
60096
|
+
const st2 = window.getComputedStyle(Q2);
|
|
60097
60097
|
console.log("父元素当前样式:", {
|
|
60098
|
-
backgroundColor:
|
|
60099
|
-
color:
|
|
60100
|
-
}), (
|
|
60098
|
+
backgroundColor: st2.backgroundColor,
|
|
60099
|
+
color: st2.color
|
|
60100
|
+
}), (st2.backgroundColor === "rgba(0, 0, 0, 0)" || st2.backgroundColor === "transparent") && (lt2(Q2), console.log("已手动修复 DOM 样式"));
|
|
60101
60101
|
}
|
|
60102
60102
|
} else {
|
|
60103
60103
|
const Q2 = document.createRange();
|
|
60104
60104
|
try {
|
|
60105
|
-
if (
|
|
60106
|
-
Q2.setStart(
|
|
60105
|
+
if (J && X)
|
|
60106
|
+
Q2.setStart(J, q2.offset), Q2.setEnd(X, G2.offset);
|
|
60107
60107
|
else
|
|
60108
60108
|
throw new Error("节点为空");
|
|
60109
|
-
const
|
|
60109
|
+
const st2 = document.createTreeWalker(
|
|
60110
60110
|
Q2.commonAncestorContainer,
|
|
60111
60111
|
NodeFilter.SHOW_TEXT,
|
|
60112
60112
|
{
|
|
60113
|
-
acceptNode: (
|
|
60113
|
+
acceptNode: (Mt2) => Q2.intersectsNode(Mt2) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT
|
|
60114
60114
|
}
|
|
60115
|
-
),
|
|
60116
|
-
let
|
|
60117
|
-
for (;
|
|
60118
|
-
|
|
60119
|
-
|
|
60120
|
-
const
|
|
60121
|
-
|
|
60122
|
-
}), console.log("已手动修复多个节点的 DOM 样式",
|
|
60123
|
-
} catch (
|
|
60124
|
-
console.warn("创建 range 失败:",
|
|
60115
|
+
), gt3 = [];
|
|
60116
|
+
let dt2;
|
|
60117
|
+
for (; dt2 = st2.nextNode(); )
|
|
60118
|
+
dt2.nodeType === Node.TEXT_NODE && gt3.push(dt2);
|
|
60119
|
+
gt3.forEach((Mt2) => {
|
|
60120
|
+
const Kt2 = Mt2.parentElement;
|
|
60121
|
+
Kt2 && lt2(Kt2);
|
|
60122
|
+
}), console.log("已手动修复多个节点的 DOM 样式", gt3.length);
|
|
60123
|
+
} catch (st2) {
|
|
60124
|
+
console.warn("创建 range 失败:", st2);
|
|
60125
60125
|
}
|
|
60126
60126
|
}
|
|
60127
60127
|
} catch (q2) {
|
|
60128
60128
|
console.warn("手动修复 DOM 失败:", q2);
|
|
60129
60129
|
}
|
|
60130
|
-
const U2 =
|
|
60131
|
-
|
|
60132
|
-
|
|
60133
|
-
), typeof
|
|
60134
|
-
backgroundColor:
|
|
60130
|
+
const U2 = R2.selection.constructor;
|
|
60131
|
+
y.dispatch(
|
|
60132
|
+
R2.tr.setSelection(U2.create(R2.doc, C2, P2)).scrollIntoView()
|
|
60133
|
+
), typeof e.addStyles == "function" && (e.addStyles({
|
|
60134
|
+
backgroundColor: at
|
|
60135
60135
|
}), console.log("使用 BlockNote addStyles API 作为兜底"));
|
|
60136
|
-
} catch (
|
|
60137
|
-
console.warn("兜底方案失败:",
|
|
60136
|
+
} catch (R2) {
|
|
60137
|
+
console.warn("兜底方案失败:", R2);
|
|
60138
60138
|
}
|
|
60139
|
-
}, 50), console.log("样式应用完成", { fromPos:
|
|
60139
|
+
}, 50), console.log("样式应用完成", { fromPos: C2, toPos: P2, text: F2 });
|
|
60140
60140
|
}
|
|
60141
|
-
} catch (
|
|
60142
|
-
console.error("应用样式失败:",
|
|
60141
|
+
} catch (y) {
|
|
60142
|
+
console.error("应用样式失败:", y);
|
|
60143
60143
|
}
|
|
60144
60144
|
else
|
|
60145
60145
|
console.warn("没有保存的选区信息");
|
|
60146
|
-
const
|
|
60147
|
-
let
|
|
60146
|
+
const i = (_ == null ? void 0 : _.text) || jt2();
|
|
60147
|
+
let g = null;
|
|
60148
60148
|
try {
|
|
60149
|
-
typeof
|
|
60150
|
-
} catch (
|
|
60151
|
-
console.warn("获取选中块失败(可能跨多个block):",
|
|
60149
|
+
typeof e.getSelection == "function" && (g = e.getSelection());
|
|
60150
|
+
} catch (y) {
|
|
60151
|
+
console.warn("获取选中块失败(可能跨多个block):", y);
|
|
60152
60152
|
}
|
|
60153
|
-
let
|
|
60153
|
+
let M;
|
|
60154
60154
|
try {
|
|
60155
|
-
const
|
|
60155
|
+
const y = ((w = g == null ? void 0 : g.blocks) == null ? void 0 : w.filter((v2) => {
|
|
60156
60156
|
try {
|
|
60157
|
-
return
|
|
60157
|
+
return v2 && (v2.id || v2.type) && typeof v2 == "object";
|
|
60158
60158
|
} catch {
|
|
60159
60159
|
return false;
|
|
60160
60160
|
}
|
|
60161
60161
|
})) || [];
|
|
60162
|
-
if (
|
|
60163
|
-
var
|
|
60164
|
-
return (
|
|
60162
|
+
if (y.length > 0 && y.find((v2) => {
|
|
60163
|
+
var A;
|
|
60164
|
+
return (A = v2 == null ? void 0 : v2.props) == null ? void 0 : A.agentId;
|
|
60165
60165
|
})) {
|
|
60166
|
-
const
|
|
60166
|
+
const v2 = y.find((A) => {
|
|
60167
60167
|
var F2;
|
|
60168
|
-
return (F2 =
|
|
60168
|
+
return (F2 = A == null ? void 0 : A.props) == null ? void 0 : F2.agentId;
|
|
60169
60169
|
});
|
|
60170
|
-
|
|
60171
|
-
} else if (
|
|
60172
|
-
const
|
|
60170
|
+
M = (I2 = v2 == null ? void 0 : v2.props) == null ? void 0 : I2.agentId;
|
|
60171
|
+
} else if (y.length > 0) {
|
|
60172
|
+
const v2 = Array.isArray(e.topLevelBlocks) ? e.topLevelBlocks.filter((F2) => {
|
|
60173
60173
|
try {
|
|
60174
60174
|
return F2 && (F2.id || F2.type) && typeof F2 == "object";
|
|
60175
60175
|
} catch {
|
|
60176
60176
|
return false;
|
|
60177
60177
|
}
|
|
60178
|
-
}) : [],
|
|
60179
|
-
if ((
|
|
60180
|
-
|
|
60181
|
-
else if (
|
|
60182
|
-
const F2 =
|
|
60178
|
+
}) : [], A = y[0];
|
|
60179
|
+
if ((b = A == null ? void 0 : A.props) != null && b.agentId)
|
|
60180
|
+
M = A.props.agentId;
|
|
60181
|
+
else if (A != null && A.id) {
|
|
60182
|
+
const F2 = v2.findIndex((j2) => {
|
|
60183
60183
|
try {
|
|
60184
|
-
return (j2 == null ? void 0 : j2.id) ===
|
|
60184
|
+
return (j2 == null ? void 0 : j2.id) === A.id;
|
|
60185
60185
|
} catch {
|
|
60186
60186
|
return false;
|
|
60187
60187
|
}
|
|
@@ -60189,9 +60189,9 @@ const Vt = {
|
|
|
60189
60189
|
if (F2 > -1)
|
|
60190
60190
|
for (let j2 = F2 - 1; j2 >= 0; j2--)
|
|
60191
60191
|
try {
|
|
60192
|
-
const Z2 =
|
|
60193
|
-
if ((
|
|
60194
|
-
|
|
60192
|
+
const Z2 = v2[j2];
|
|
60193
|
+
if ((T2 = Z2 == null ? void 0 : Z2.props) != null && T2.agentId) {
|
|
60194
|
+
M = Z2.props.agentId;
|
|
60195
60195
|
break;
|
|
60196
60196
|
}
|
|
60197
60197
|
} catch {
|
|
@@ -60199,10 +60199,10 @@ const Vt = {
|
|
|
60199
60199
|
}
|
|
60200
60200
|
}
|
|
60201
60201
|
}
|
|
60202
|
-
} catch (
|
|
60203
|
-
console.warn("查找 agentId 失败:",
|
|
60202
|
+
} catch (y) {
|
|
60203
|
+
console.warn("查找 agentId 失败:", y);
|
|
60204
60204
|
}
|
|
60205
|
-
switch (
|
|
60205
|
+
switch (ft2("handle-ai-assistant", i, a, M), a) {
|
|
60206
60206
|
case "rewrite":
|
|
60207
60207
|
break;
|
|
60208
60208
|
case "continue":
|
|
@@ -60218,7 +60218,7 @@ const Vt = {
|
|
|
60218
60218
|
}, m2 = () => {
|
|
60219
60219
|
if (!s)
|
|
60220
60220
|
return null;
|
|
60221
|
-
const
|
|
60221
|
+
const a = [
|
|
60222
60222
|
{
|
|
60223
60223
|
icon: "✏️",
|
|
60224
60224
|
title: "改写",
|
|
@@ -60263,26 +60263,26 @@ const Vt = {
|
|
|
60263
60263
|
marginBottom: l.direction === "up" ? "4px" : "0"
|
|
60264
60264
|
}
|
|
60265
60265
|
},
|
|
60266
|
-
|
|
60267
|
-
(
|
|
60266
|
+
a.map(
|
|
60267
|
+
(D2, _) => React__default.createElement(
|
|
60268
60268
|
"div",
|
|
60269
60269
|
{
|
|
60270
|
-
key:
|
|
60270
|
+
key: D2.action,
|
|
60271
60271
|
style: {
|
|
60272
60272
|
display: "flex",
|
|
60273
60273
|
alignItems: "center",
|
|
60274
60274
|
padding: "12px 16px",
|
|
60275
60275
|
cursor: "pointer",
|
|
60276
|
-
borderBottom:
|
|
60276
|
+
borderBottom: _ < a.length - 1 ? "1px solid #f0f0f0" : "none",
|
|
60277
60277
|
transition: "background-color 0.2s"
|
|
60278
60278
|
},
|
|
60279
|
-
onMouseEnter: (
|
|
60280
|
-
|
|
60279
|
+
onMouseEnter: (i) => {
|
|
60280
|
+
i.target.style.backgroundColor = "#f5f5f5";
|
|
60281
60281
|
},
|
|
60282
|
-
onMouseLeave: (
|
|
60283
|
-
|
|
60282
|
+
onMouseLeave: (i) => {
|
|
60283
|
+
i.target.style.backgroundColor = "transparent";
|
|
60284
60284
|
},
|
|
60285
|
-
onClick: (
|
|
60285
|
+
onClick: (i) => u(D2.action, i)
|
|
60286
60286
|
},
|
|
60287
60287
|
[
|
|
60288
60288
|
// 左侧图标
|
|
@@ -60297,7 +60297,7 @@ const Vt = {
|
|
|
60297
60297
|
textAlign: "center"
|
|
60298
60298
|
}
|
|
60299
60299
|
},
|
|
60300
|
-
|
|
60300
|
+
D2.icon
|
|
60301
60301
|
),
|
|
60302
60302
|
// 主要内容
|
|
60303
60303
|
React__default.createElement(
|
|
@@ -60320,7 +60320,7 @@ const Vt = {
|
|
|
60320
60320
|
marginBottom: "2px"
|
|
60321
60321
|
}
|
|
60322
60322
|
},
|
|
60323
|
-
|
|
60323
|
+
D2.title
|
|
60324
60324
|
),
|
|
60325
60325
|
React__default.createElement(
|
|
60326
60326
|
"div",
|
|
@@ -60331,7 +60331,7 @@ const Vt = {
|
|
|
60331
60331
|
color: "#666"
|
|
60332
60332
|
}
|
|
60333
60333
|
},
|
|
60334
|
-
|
|
60334
|
+
D2.subtitle
|
|
60335
60335
|
)
|
|
60336
60336
|
]
|
|
60337
60337
|
)
|
|
@@ -60356,12 +60356,12 @@ const Vt = {
|
|
|
60356
60356
|
mainTooltip: "ai助手",
|
|
60357
60357
|
onClick: () => {
|
|
60358
60358
|
if (!s) {
|
|
60359
|
-
const
|
|
60360
|
-
d(
|
|
60359
|
+
const a = x2();
|
|
60360
|
+
d(a);
|
|
60361
60361
|
}
|
|
60362
60362
|
c(!s);
|
|
60363
60363
|
},
|
|
60364
|
-
isSelected:
|
|
60364
|
+
isSelected: k2
|
|
60365
60365
|
},
|
|
60366
60366
|
"🤖 ai助手"
|
|
60367
60367
|
),
|
|
@@ -60369,47 +60369,47 @@ const Vt = {
|
|
|
60369
60369
|
]
|
|
60370
60370
|
);
|
|
60371
60371
|
}, n = () => {
|
|
60372
|
-
let
|
|
60373
|
-
if (
|
|
60372
|
+
let o = [];
|
|
60373
|
+
if (nt2.defaultContent && Array.isArray(nt2.defaultContent))
|
|
60374
60374
|
try {
|
|
60375
|
-
const l = toRaw(unref(
|
|
60376
|
-
Array.isArray(l) && l.length > 0 && (
|
|
60375
|
+
const l = toRaw(unref(nt2.defaultContent));
|
|
60376
|
+
Array.isArray(l) && l.length > 0 && (o = It$12(l), o.length === 0 && (o = [
|
|
60377
60377
|
{
|
|
60378
60378
|
type: "paragraph",
|
|
60379
|
-
content: [{ type: "text", text:
|
|
60379
|
+
content: [{ type: "text", text: nt2.placeholder || "", styles: {} }]
|
|
60380
60380
|
}
|
|
60381
|
-
]), console.log("处理后的内容:",
|
|
60381
|
+
]), console.log("处理后的内容:", o));
|
|
60382
60382
|
} catch (l) {
|
|
60383
|
-
console.warn("处理默认内容时出错:", l),
|
|
60383
|
+
console.warn("处理默认内容时出错:", l), o = [
|
|
60384
60384
|
{
|
|
60385
60385
|
type: "paragraph",
|
|
60386
|
-
content: [{ type: "text", text:
|
|
60386
|
+
content: [{ type: "text", text: nt2.placeholder || "", styles: {} }]
|
|
60387
60387
|
}
|
|
60388
60388
|
];
|
|
60389
60389
|
}
|
|
60390
|
-
|
|
60390
|
+
o.length === 0 && (o = [
|
|
60391
60391
|
{
|
|
60392
60392
|
type: "paragraph",
|
|
60393
|
-
content: [{ type: "text", text:
|
|
60393
|
+
content: [{ type: "text", text: nt2.placeholder || "", styles: {} }]
|
|
60394
60394
|
}
|
|
60395
|
-
]), console.log("准备创建编辑器,initialContent:",
|
|
60396
|
-
let r2 = Array.isArray(
|
|
60395
|
+
]), console.log("准备创建编辑器,initialContent:", o), console.log("initialContent 类型:", typeof o), console.log("initialContent 是否为数组:", Array.isArray(o));
|
|
60396
|
+
let r2 = Array.isArray(o) && o.length > 0 ? o : [
|
|
60397
60397
|
{
|
|
60398
60398
|
type: "paragraph",
|
|
60399
|
-
content: [{ type: "text", text:
|
|
60399
|
+
content: [{ type: "text", text: nt2.placeholder || "", styles: {} }]
|
|
60400
60400
|
}
|
|
60401
60401
|
];
|
|
60402
|
-
r2 =
|
|
60402
|
+
r2 = It$12(r2);
|
|
60403
60403
|
const s = Ie$2.create({
|
|
60404
60404
|
blockSpecs: {
|
|
60405
60405
|
// 包含所有默认块,但用扩展的 heading 替换原生的
|
|
60406
60406
|
...$n$1,
|
|
60407
60407
|
// 用扩展的 heading 块替换原生的 heading 块
|
|
60408
|
-
heading:
|
|
60408
|
+
heading: Qt2,
|
|
60409
60409
|
// 添加插入文本块
|
|
60410
|
-
insertedText:
|
|
60410
|
+
insertedText: Tt2,
|
|
60411
60411
|
// 添加操作按钮块
|
|
60412
|
-
actionButtons:
|
|
60412
|
+
actionButtons: Ct2
|
|
60413
60413
|
}
|
|
60414
60414
|
});
|
|
60415
60415
|
let c;
|
|
@@ -60418,7 +60418,7 @@ const Vt = {
|
|
|
60418
60418
|
schema: s,
|
|
60419
60419
|
initialContent: r2,
|
|
60420
60420
|
dictionary: {
|
|
60421
|
-
...
|
|
60421
|
+
...Oe
|
|
60422
60422
|
}
|
|
60423
60423
|
}), console.log("编辑器创建成功:", c);
|
|
60424
60424
|
} catch (l) {
|
|
@@ -60426,49 +60426,49 @@ const Vt = {
|
|
|
60426
60426
|
}
|
|
60427
60427
|
React__default.useEffect(() => c.onChange((d) => {
|
|
60428
60428
|
try {
|
|
60429
|
-
const
|
|
60430
|
-
|
|
60431
|
-
} catch (
|
|
60432
|
-
console.warn("获取编辑器内容时出错:",
|
|
60429
|
+
const x2 = d.topLevelBlocks, h2 = _t2(x2 || [], "onChange");
|
|
60430
|
+
h2.length !== ((x2 == null ? void 0 : x2.length) || 0) && console.warn("检测到没有 id 的 blocks,已修复"), ft2("content-change", h2.length > 0 ? h2 : x2);
|
|
60431
|
+
} catch (x2) {
|
|
60432
|
+
console.warn("获取编辑器内容时出错:", x2);
|
|
60433
60433
|
}
|
|
60434
60434
|
}), [c]), React__default.useEffect(() => {
|
|
60435
|
-
|
|
60435
|
+
e = c, ft2("editor-ready", c);
|
|
60436
60436
|
try {
|
|
60437
60437
|
const l = c == null ? void 0 : c.prosemirrorView;
|
|
60438
60438
|
if (l) {
|
|
60439
60439
|
const d = l.updateState.bind(l);
|
|
60440
|
-
l.updateState = function(
|
|
60440
|
+
l.updateState = function(h2) {
|
|
60441
60441
|
var u;
|
|
60442
60442
|
try {
|
|
60443
|
-
if (!
|
|
60443
|
+
if (!h2 || !h2.doc) {
|
|
60444
60444
|
console.warn("无效的 ProseMirror state,跳过更新");
|
|
60445
60445
|
return;
|
|
60446
60446
|
}
|
|
60447
|
-
return d(
|
|
60447
|
+
return d(h2);
|
|
60448
60448
|
} catch (m2) {
|
|
60449
|
-
const
|
|
60450
|
-
if (
|
|
60451
|
-
console.warn("ProseMirror 视图更新错误已捕获(已静默处理):",
|
|
60449
|
+
const a = (m2 == null ? void 0 : m2.message) || "";
|
|
60450
|
+
if (a.includes("Cannot read properties of undefined") || a.includes("reading 'children'") || (u = m2 == null ? void 0 : m2.stack) != null && u.includes("ViewTreeUpdater")) {
|
|
60451
|
+
console.warn("ProseMirror 视图更新错误已捕获(已静默处理):", a);
|
|
60452
60452
|
return;
|
|
60453
60453
|
}
|
|
60454
60454
|
throw m2;
|
|
60455
60455
|
}
|
|
60456
60456
|
};
|
|
60457
|
-
const
|
|
60458
|
-
l.dispatch = function(
|
|
60457
|
+
const x2 = l.dispatch.bind(l);
|
|
60458
|
+
l.dispatch = function(h2) {
|
|
60459
60459
|
var u;
|
|
60460
60460
|
try {
|
|
60461
|
-
if (!
|
|
60462
|
-
return
|
|
60463
|
-
if (!
|
|
60461
|
+
if (!h2 || !h2.steps || h2.steps.length === 0)
|
|
60462
|
+
return x2(h2);
|
|
60463
|
+
if (!h2.doc) {
|
|
60464
60464
|
console.warn("无效的 transaction,跳过 dispatch");
|
|
60465
60465
|
return;
|
|
60466
60466
|
}
|
|
60467
|
-
return
|
|
60467
|
+
return x2(h2);
|
|
60468
60468
|
} catch (m2) {
|
|
60469
|
-
const
|
|
60470
|
-
if (
|
|
60471
|
-
console.warn("ProseMirror dispatch 错误已捕获(已静默处理):",
|
|
60469
|
+
const a = (m2 == null ? void 0 : m2.message) || "";
|
|
60470
|
+
if (a.includes("Cannot read properties of undefined") || a.includes("reading 'children'") || (u = m2 == null ? void 0 : m2.stack) != null && u.includes("ViewTreeUpdater")) {
|
|
60471
|
+
console.warn("ProseMirror dispatch 错误已捕获(已静默处理):", a);
|
|
60472
60472
|
return;
|
|
60473
60473
|
}
|
|
60474
60474
|
throw m2;
|
|
@@ -60479,21 +60479,21 @@ const Vt = {
|
|
|
60479
60479
|
console.warn("添加 ProseMirror 错误保护失败:", l);
|
|
60480
60480
|
}
|
|
60481
60481
|
}, [c]);
|
|
60482
|
-
class
|
|
60482
|
+
class k2 extends React__default.Component {
|
|
60483
60483
|
constructor(d) {
|
|
60484
60484
|
super(d), this.state = { hasError: false, error: null };
|
|
60485
60485
|
}
|
|
60486
60486
|
static getDerivedStateFromError(d) {
|
|
60487
|
-
const
|
|
60488
|
-
return
|
|
60487
|
+
const x2 = d.message || "", h2 = d.stack || "";
|
|
60488
|
+
return x2.includes("Block doesn't have id") || x2.includes("Block type does not match") || x2.includes("Invalid block") || x2.includes("Cannot read properties of undefined") || x2.includes("reading 'children'") || h2.includes("ViewTreeUpdater") || h2.includes("_NodeViewDesc") || h2.includes("preMatch") ? (console.warn("捕获到 BlockNote/ProseMirror 渲染错误(已处理):", x2), null) : { hasError: true, error: d };
|
|
60489
60489
|
}
|
|
60490
|
-
componentDidCatch(d,
|
|
60491
|
-
const
|
|
60492
|
-
if (
|
|
60493
|
-
console.warn("BlockNote/ProseMirror 渲染错误已捕获:",
|
|
60490
|
+
componentDidCatch(d, x2) {
|
|
60491
|
+
const h2 = d.message || "", u = d.stack || "";
|
|
60492
|
+
if (h2.includes("Block doesn't have id") || h2.includes("Block type does not match") || h2.includes("Invalid block") || h2.includes("Cannot read properties of undefined") || h2.includes("reading 'children'") || u.includes("ViewTreeUpdater") || u.includes("_NodeViewDesc") || u.includes("preMatch")) {
|
|
60493
|
+
console.warn("BlockNote/ProseMirror 渲染错误已捕获:", h2);
|
|
60494
60494
|
return;
|
|
60495
60495
|
}
|
|
60496
|
-
console.error("编辑器渲染错误:", d,
|
|
60496
|
+
console.error("编辑器渲染错误:", d, x2);
|
|
60497
60497
|
}
|
|
60498
60498
|
render() {
|
|
60499
60499
|
return this.state.hasError ? React__default.createElement(
|
|
@@ -60510,10 +60510,10 @@ const Vt = {
|
|
|
60510
60510
|
}
|
|
60511
60511
|
}
|
|
60512
60512
|
const p2 = React__default.createElement(
|
|
60513
|
-
Ot
|
|
60513
|
+
Ot,
|
|
60514
60514
|
{
|
|
60515
60515
|
editor: c,
|
|
60516
|
-
theme:
|
|
60516
|
+
theme: nt2.theme || "light",
|
|
60517
60517
|
formattingToolbar: false
|
|
60518
60518
|
// 禁用默认工具栏
|
|
60519
60519
|
},
|
|
@@ -60567,36 +60567,36 @@ const Vt = {
|
|
|
60567
60567
|
React__default.createElement(Qo, { key: "nestBlockButton" }),
|
|
60568
60568
|
React__default.createElement(er, { key: "unnestBlockButton" }),
|
|
60569
60569
|
// 自定义按钮
|
|
60570
|
-
React__default.createElement(
|
|
60570
|
+
React__default.createElement(t2, { key: "AiAssistantButton" })
|
|
60571
60571
|
])
|
|
60572
60572
|
})
|
|
60573
60573
|
]
|
|
60574
60574
|
);
|
|
60575
|
-
return React__default.createElement(
|
|
60575
|
+
return React__default.createElement(k2, { children: p2 });
|
|
60576
60576
|
};
|
|
60577
|
-
|
|
60578
|
-
} catch (
|
|
60579
|
-
console.error("❌ BlockNote 编辑器渲染失败:",
|
|
60577
|
+
ht2.render(React__default.createElement(n)), console.log("✅ BlockNote 编辑器渲染成功"), ft2("editor-error", null);
|
|
60578
|
+
} catch (t2) {
|
|
60579
|
+
console.error("❌ BlockNote 编辑器渲染失败:", t2), ft2("editor-error", t2), W2.value && (W2.value.innerHTML = `
|
|
60580
60580
|
<div style="padding: 20px; border: 2px solid #ff4444; border-radius: 8px; background-color: #fff5f5; color: #ff4444;">
|
|
60581
60581
|
<h3>编辑器加载失败</h3>
|
|
60582
|
-
<p>错误信息: ${
|
|
60582
|
+
<p>错误信息: ${t2}</p>
|
|
60583
60583
|
<p>请检查控制台获取更多信息</p>
|
|
60584
60584
|
</div>
|
|
60585
60585
|
`);
|
|
60586
60586
|
}
|
|
60587
|
-
},
|
|
60588
|
-
var
|
|
60589
|
-
if (!(!
|
|
60587
|
+
}, ae2 = async (t2, n) => {
|
|
60588
|
+
var o, r2;
|
|
60589
|
+
if (!(!e || !t2))
|
|
60590
60590
|
try {
|
|
60591
|
-
const s = await
|
|
60591
|
+
const s = await e.tryParseMarkdownToBlocks(t2);
|
|
60592
60592
|
if (!Array.isArray(s) || s.length === 0)
|
|
60593
60593
|
return;
|
|
60594
|
-
const c =
|
|
60595
|
-
let
|
|
60594
|
+
const c = e.topLevelBlocks || [];
|
|
60595
|
+
let k2 = [];
|
|
60596
60596
|
try {
|
|
60597
|
-
if (typeof
|
|
60598
|
-
const p2 =
|
|
60599
|
-
|
|
60597
|
+
if (typeof e.getSelectedBlocks == "function") {
|
|
60598
|
+
const p2 = e.getSelectedBlocks();
|
|
60599
|
+
k2 = Array.isArray(p2) ? p2.filter((l) => {
|
|
60600
60600
|
try {
|
|
60601
60601
|
return l && (l.id || l.type) && typeof l == "object";
|
|
60602
60602
|
} catch {
|
|
@@ -60605,13 +60605,13 @@ const Vt = {
|
|
|
60605
60605
|
}) : [];
|
|
60606
60606
|
}
|
|
60607
60607
|
} catch (p2) {
|
|
60608
|
-
console.warn("获取选中块失败(可能跨多个block):", p2),
|
|
60608
|
+
console.warn("获取选中块失败(可能跨多个block):", p2), k2 = [];
|
|
60609
60609
|
}
|
|
60610
|
-
if (Array.isArray(
|
|
60611
|
-
const p2 =
|
|
60610
|
+
if (Array.isArray(k2) && k2.length > 0) {
|
|
60611
|
+
const p2 = k2[k2.length - 1];
|
|
60612
60612
|
if (p2 && (p2.id || p2.type))
|
|
60613
60613
|
try {
|
|
60614
|
-
|
|
60614
|
+
e.insertBlocks(s, p2, "after"), (o = e.focus) == null || o.call(e);
|
|
60615
60615
|
return;
|
|
60616
60616
|
} catch (l) {
|
|
60617
60617
|
console.warn("插入块失败:", l);
|
|
@@ -60619,32 +60619,32 @@ const Vt = {
|
|
|
60619
60619
|
}
|
|
60620
60620
|
if (Array.isArray(c) && c.length > 0 && !n) {
|
|
60621
60621
|
const p2 = c[c.length - 1];
|
|
60622
|
-
|
|
60622
|
+
e.insertBlocks(s, p2, "after");
|
|
60623
60623
|
} else
|
|
60624
|
-
|
|
60625
|
-
(r2 =
|
|
60624
|
+
e.replaceBlocks(c, s);
|
|
60625
|
+
(r2 = e.focus) == null || r2.call(e);
|
|
60626
60626
|
} catch (s) {
|
|
60627
60627
|
console.warn("粘贴 Markdown 失败:", s);
|
|
60628
60628
|
}
|
|
60629
|
-
},
|
|
60630
|
-
var
|
|
60631
|
-
if (!(!
|
|
60629
|
+
}, ie2 = async (t2, n) => {
|
|
60630
|
+
var o, r2;
|
|
60631
|
+
if (!(!e || !Array.isArray(t2) || t2.length === 0))
|
|
60632
60632
|
try {
|
|
60633
60633
|
const s = [];
|
|
60634
|
-
for (const p2 of
|
|
60635
|
-
const { contentText: l, agentId: d, title:
|
|
60634
|
+
for (const p2 of t2) {
|
|
60635
|
+
const { contentText: l, agentId: d, title: x2 } = p2;
|
|
60636
60636
|
if (!l || typeof l != "string") {
|
|
60637
60637
|
console.warn("跳过无效的 contentText:", l);
|
|
60638
60638
|
continue;
|
|
60639
60639
|
}
|
|
60640
|
-
const
|
|
60641
|
-
if (!Array.isArray(
|
|
60640
|
+
const h2 = await e.tryParseMarkdownToBlocks(l);
|
|
60641
|
+
if (!Array.isArray(h2) || h2.length === 0)
|
|
60642
60642
|
continue;
|
|
60643
|
-
const u =
|
|
60643
|
+
const u = h2.map((m2) => {
|
|
60644
60644
|
if (m2.type === "heading" && d) {
|
|
60645
|
-
let
|
|
60646
|
-
if (
|
|
60647
|
-
return console.log(`匹配成功,为标题 "${
|
|
60645
|
+
let a = At2(m2.content);
|
|
60646
|
+
if (a = `${"#".repeat(m2.props.level)} ${a}`, console.log(`检查标题匹配: "${a}" === "${x2}"`), a === x2)
|
|
60647
|
+
return console.log(`匹配成功,为标题 "${x2}" 添加 agentId: ${d}`), {
|
|
60648
60648
|
...m2,
|
|
60649
60649
|
props: {
|
|
60650
60650
|
...m2.props,
|
|
@@ -60659,35 +60659,35 @@ const Vt = {
|
|
|
60659
60659
|
}
|
|
60660
60660
|
if (s.length === 0)
|
|
60661
60661
|
return;
|
|
60662
|
-
const c =
|
|
60663
|
-
if (Array.isArray(
|
|
60664
|
-
const p2 =
|
|
60665
|
-
|
|
60662
|
+
const c = e.topLevelBlocks || [], k2 = typeof e.getSelectedBlocks == "function" ? e.getSelectedBlocks() : [];
|
|
60663
|
+
if (Array.isArray(k2) && k2.length > 0) {
|
|
60664
|
+
const p2 = k2[k2.length - 1];
|
|
60665
|
+
e.insertBlocks(s, p2, "after"), (o = e.focus) == null || o.call(e);
|
|
60666
60666
|
return;
|
|
60667
60667
|
}
|
|
60668
60668
|
if (Array.isArray(c) && c.length > 0 && !n) {
|
|
60669
60669
|
const p2 = c[c.length - 1];
|
|
60670
|
-
|
|
60670
|
+
e.insertBlocks(s, p2, "after");
|
|
60671
60671
|
} else
|
|
60672
|
-
|
|
60673
|
-
(r2 =
|
|
60672
|
+
e.replaceBlocks(c, s);
|
|
60673
|
+
(r2 = e.focus) == null || r2.call(e);
|
|
60674
60674
|
} catch (s) {
|
|
60675
60675
|
console.warn("粘贴带 agentId 的 Markdown 失败:", s);
|
|
60676
60676
|
}
|
|
60677
|
-
},
|
|
60678
|
-
if (!Array.isArray(
|
|
60677
|
+
}, At2 = (t2) => {
|
|
60678
|
+
if (!Array.isArray(t2))
|
|
60679
60679
|
return "";
|
|
60680
60680
|
let n = "";
|
|
60681
|
-
return
|
|
60682
|
-
|
|
60681
|
+
return t2.forEach((o) => {
|
|
60682
|
+
o && typeof o == "object" && (o.type === "text" ? n += o.text || "" : (o.type === "link" && o.content || o.content) && (n += At2(o.content)));
|
|
60683
60683
|
}), n;
|
|
60684
|
-
},
|
|
60685
|
-
if (!
|
|
60684
|
+
}, jt2 = () => {
|
|
60685
|
+
if (!e || !e.prosemirrorState)
|
|
60686
60686
|
return "";
|
|
60687
|
-
const
|
|
60687
|
+
const t2 = e.prosemirrorState, { selection: n } = t2;
|
|
60688
60688
|
if (n && n.from !== n.to)
|
|
60689
60689
|
try {
|
|
60690
|
-
return
|
|
60690
|
+
return t2.doc.textBetween(
|
|
60691
60691
|
n.from,
|
|
60692
60692
|
// 选区起始位置
|
|
60693
60693
|
n.to,
|
|
@@ -60696,11 +60696,11 @@ const Vt = {
|
|
|
60696
60696
|
`
|
|
60697
60697
|
// 换行符替换(处理多行选区)
|
|
60698
60698
|
);
|
|
60699
|
-
} catch (
|
|
60700
|
-
return console.warn("获取选中文本时出错:",
|
|
60699
|
+
} catch (o) {
|
|
60700
|
+
return console.warn("获取选中文本时出错:", o), "";
|
|
60701
60701
|
}
|
|
60702
60702
|
return console.log("没有文本选区"), "";
|
|
60703
|
-
},
|
|
60703
|
+
}, it2 = ref(/* @__PURE__ */ new Map()), et2 = ref({
|
|
60704
60704
|
isInserting: false,
|
|
60705
60705
|
insertedText: "",
|
|
60706
60706
|
originalText: void 0,
|
|
@@ -60710,197 +60710,219 @@ const Vt = {
|
|
|
60710
60710
|
inlineFromPos: void 0,
|
|
60711
60711
|
inlineToPos: void 0,
|
|
60712
60712
|
originalHighlightRange: null
|
|
60713
|
-
}),
|
|
60713
|
+
}), de2 = (t2) => {
|
|
60714
60714
|
const n = [];
|
|
60715
|
-
let
|
|
60715
|
+
let o = "", r2 = 0;
|
|
60716
60716
|
const s = /\*\*(.+?)\*\*/g;
|
|
60717
60717
|
let c;
|
|
60718
|
-
for (; (c = s.exec(
|
|
60719
|
-
|
|
60720
|
-
const
|
|
60721
|
-
|
|
60722
|
-
const l =
|
|
60718
|
+
for (; (c = s.exec(t2)) !== null; ) {
|
|
60719
|
+
o += t2.slice(r2, c.index);
|
|
60720
|
+
const k2 = c[1], p2 = o.length;
|
|
60721
|
+
o += k2;
|
|
60722
|
+
const l = o.length;
|
|
60723
60723
|
n.push({ start: p2, end: l }), r2 = c.index + c[0].length;
|
|
60724
60724
|
}
|
|
60725
|
-
return
|
|
60726
|
-
},
|
|
60725
|
+
return o += t2.slice(r2), { plainText: o, boldRanges: n };
|
|
60726
|
+
}, qt2 = (t2) => {
|
|
60727
|
+
try {
|
|
60728
|
+
return JSON.parse(JSON.stringify(t2 || []));
|
|
60729
|
+
} catch {
|
|
60730
|
+
return Array.isArray(t2) ? t2.slice() : [];
|
|
60731
|
+
}
|
|
60732
|
+
}, ue2 = (t2, n, o, r2) => {
|
|
60727
60733
|
var l;
|
|
60728
|
-
if (!
|
|
60734
|
+
if (!t2)
|
|
60729
60735
|
return null;
|
|
60730
|
-
const { plainText: s, boldRanges: c } =
|
|
60731
|
-
let
|
|
60732
|
-
|
|
60733
|
-
const p2 = (l =
|
|
60736
|
+
const { plainText: s, boldRanges: c } = de2(n);
|
|
60737
|
+
let k2 = t2.state.tr.insertText(s, o, r2).scrollIntoView();
|
|
60738
|
+
t2.dispatch(k2);
|
|
60739
|
+
const p2 = (l = t2.state.schema.marks) == null ? void 0 : l.strong;
|
|
60734
60740
|
if (p2 && c.length > 0) {
|
|
60735
|
-
let d =
|
|
60736
|
-
c.forEach((
|
|
60737
|
-
d = d.addMark(
|
|
60738
|
-
}),
|
|
60739
|
-
}
|
|
60740
|
-
return
|
|
60741
|
-
},
|
|
60742
|
-
if (!(!
|
|
60741
|
+
let d = t2.state.tr;
|
|
60742
|
+
c.forEach((x2) => {
|
|
60743
|
+
d = d.addMark(o + x2.start, o + x2.end, p2.create());
|
|
60744
|
+
}), t2.dispatch(d);
|
|
60745
|
+
}
|
|
60746
|
+
return ut2(), { fromPos: o, toPos: o + s.length };
|
|
60747
|
+
}, vt2 = (t2) => {
|
|
60748
|
+
if (!(!t2 || !t2.state))
|
|
60743
60749
|
try {
|
|
60744
|
-
const n =
|
|
60745
|
-
|
|
60746
|
-
|
|
60750
|
+
const n = t2.state.selection.constructor, o = t2.state.doc.content.size;
|
|
60751
|
+
t2.dispatch(
|
|
60752
|
+
t2.state.tr.setSelection(n.create(t2.state.doc, o, o)).scrollIntoView()
|
|
60747
60753
|
);
|
|
60748
60754
|
} catch (n) {
|
|
60749
60755
|
console.warn("移动光标到文档末尾失败:", n);
|
|
60750
60756
|
}
|
|
60751
|
-
},
|
|
60752
|
-
const n =
|
|
60753
|
-
if (!n || !
|
|
60757
|
+
}, Xt2 = (t2) => {
|
|
60758
|
+
const n = le2();
|
|
60759
|
+
if (!n || !t2 || !t2.state)
|
|
60754
60760
|
return null;
|
|
60755
|
-
const
|
|
60761
|
+
const o = t2.state.doc.content.size, r2 = Math.max(0, Math.min(n.fromPos, o)), s = Math.max(0, Math.min(n.toPos, o));
|
|
60756
60762
|
return r2 >= s ? null : { fromPos: r2, toPos: s };
|
|
60757
|
-
},
|
|
60758
|
-
var c,
|
|
60759
|
-
if (!
|
|
60763
|
+
}, Wt2 = async (t2, n) => {
|
|
60764
|
+
var c, k2, p2, l;
|
|
60765
|
+
if (!e || !t2)
|
|
60760
60766
|
return;
|
|
60761
|
-
const
|
|
60762
|
-
let r2 = (
|
|
60763
|
-
const s =
|
|
60767
|
+
const o = e == null ? void 0 : e.prosemirrorView;
|
|
60768
|
+
let r2 = (e == null ? void 0 : e.prosemirrorState) || (o == null ? void 0 : o.state);
|
|
60769
|
+
const s = o ? Xt2(o) : null;
|
|
60764
60770
|
try {
|
|
60765
60771
|
if (n === "rewrite") {
|
|
60766
|
-
if (!
|
|
60772
|
+
if (!o || !r2)
|
|
60767
60773
|
return;
|
|
60768
60774
|
const d = r2.selection;
|
|
60769
|
-
let
|
|
60770
|
-
if (
|
|
60775
|
+
let x2 = d ? d.from : null, h2 = d ? d.to : null;
|
|
60776
|
+
if (o && (!d || d.from === d.to) && s && s.fromPos !== s.toPos)
|
|
60771
60777
|
try {
|
|
60772
60778
|
const u = r2.selection.constructor;
|
|
60773
|
-
|
|
60774
|
-
|
|
60779
|
+
o.dispatch(
|
|
60780
|
+
o.state.tr.setSelection(
|
|
60775
60781
|
u.create(
|
|
60776
|
-
|
|
60782
|
+
o.state.doc,
|
|
60777
60783
|
s.fromPos,
|
|
60778
60784
|
s.toPos
|
|
60779
60785
|
)
|
|
60780
60786
|
).scrollIntoView()
|
|
60781
|
-
), r2 =
|
|
60787
|
+
), r2 = o.state, x2 = s.fromPos, h2 = s.toPos;
|
|
60782
60788
|
} catch (u) {
|
|
60783
60789
|
console.warn("根据高亮范围恢复选区失败:", u);
|
|
60784
60790
|
}
|
|
60785
|
-
if (r2 && typeof
|
|
60791
|
+
if (r2 && typeof x2 == "number" && typeof h2 == "number" && x2 !== h2) {
|
|
60792
|
+
try {
|
|
60793
|
+
let S = false, w = 0;
|
|
60794
|
+
if (r2.doc.nodesBetween(x2, h2, (I2) => {
|
|
60795
|
+
var b;
|
|
60796
|
+
if (I2.isBlock && (w++, ((b = I2.type) == null ? void 0 : b.name) === "heading" && (S = true), w > 1 || S))
|
|
60797
|
+
return false;
|
|
60798
|
+
}), S || w > 1) {
|
|
60799
|
+
console.warn(
|
|
60800
|
+
"rewrite 选区包含标题或跨多个块,退化为 continue 行为以避免破坏标题结构与高亮状态。"
|
|
60801
|
+
), await Wt2(t2, "continue");
|
|
60802
|
+
return;
|
|
60803
|
+
}
|
|
60804
|
+
} catch (S) {
|
|
60805
|
+
console.warn("检查 rewrite 选区是否包含标题/多块失败,按原逻辑继续:", S);
|
|
60806
|
+
}
|
|
60786
60807
|
let u = null;
|
|
60787
60808
|
try {
|
|
60788
|
-
typeof (
|
|
60809
|
+
typeof (e == null ? void 0 : e.getSelection) == "function" && (u = e.getSelection(), u && Array.isArray(u.blocks) && (u.blocks = u.blocks.filter((S) => {
|
|
60789
60810
|
try {
|
|
60790
|
-
return
|
|
60811
|
+
return S && (S.id || S.type) && typeof S == "object";
|
|
60791
60812
|
} catch {
|
|
60792
60813
|
return false;
|
|
60793
60814
|
}
|
|
60794
60815
|
})));
|
|
60795
|
-
} catch (
|
|
60796
|
-
console.warn("获取当前选择失败(可能跨多个block):",
|
|
60816
|
+
} catch (S) {
|
|
60817
|
+
console.warn("获取当前选择失败(可能跨多个block):", S);
|
|
60797
60818
|
}
|
|
60798
60819
|
const m2 = u && Array.isArray(u.blocks) ? {
|
|
60799
|
-
|
|
60820
|
+
// 深拷贝 block,避免后续编辑时原始快照被就地修改(否则撤销时无法恢复标题块等结构)
|
|
60821
|
+
blocks: qt2(u.blocks),
|
|
60800
60822
|
textCursorPosition: u.textCursorPosition
|
|
60801
|
-
} : null,
|
|
60802
|
-
let
|
|
60823
|
+
} : null, a = `highlight-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
60824
|
+
let D2 = "";
|
|
60803
60825
|
try {
|
|
60804
|
-
|
|
60826
|
+
D2 = r2.doc.textBetween(x2, h2, `
|
|
60805
60827
|
`);
|
|
60806
60828
|
} catch {
|
|
60807
60829
|
}
|
|
60808
|
-
const
|
|
60809
|
-
const
|
|
60810
|
-
let
|
|
60811
|
-
const
|
|
60812
|
-
let
|
|
60813
|
-
for (; (
|
|
60814
|
-
const
|
|
60815
|
-
|
|
60816
|
-
const j2 =
|
|
60817
|
-
|
|
60818
|
-
const
|
|
60819
|
-
|
|
60830
|
+
const _ = (S) => {
|
|
60831
|
+
const w = [];
|
|
60832
|
+
let I2 = "", b = 0, T2 = 0;
|
|
60833
|
+
const y = /\*\*(.+?)\*\*/g;
|
|
60834
|
+
let v2;
|
|
60835
|
+
for (; (v2 = y.exec(S)) !== null; ) {
|
|
60836
|
+
const A = v2.index, F2 = v2.index + v2[0].length;
|
|
60837
|
+
I2 += S.slice(b, A);
|
|
60838
|
+
const j2 = v2[1], Z2 = I2.length;
|
|
60839
|
+
I2 += j2;
|
|
60840
|
+
const K2 = I2.length;
|
|
60841
|
+
w.push({ start: Z2, end: K2 }), b = F2, T2 += 4;
|
|
60820
60842
|
}
|
|
60821
|
-
return
|
|
60822
|
-
}, { plainText:
|
|
60823
|
-
let
|
|
60824
|
-
|
|
60825
|
-
const
|
|
60843
|
+
return I2 += S.slice(b), { plainText: I2, boldRanges: w };
|
|
60844
|
+
}, { plainText: i, boldRanges: g } = _(t2);
|
|
60845
|
+
let M = r2.tr.insertText(i, x2, h2).scrollIntoView();
|
|
60846
|
+
o.dispatch(M);
|
|
60847
|
+
const L3 = x2 + i.length;
|
|
60826
60848
|
try {
|
|
60827
|
-
const
|
|
60828
|
-
if (
|
|
60829
|
-
let
|
|
60830
|
-
for (const
|
|
60831
|
-
|
|
60832
|
-
|
|
60849
|
+
const S = (c = r2.schema.marks) == null ? void 0 : c.strong;
|
|
60850
|
+
if (S && Array.isArray(g) && g.length > 0) {
|
|
60851
|
+
let w = o.state.tr;
|
|
60852
|
+
for (const I2 of g)
|
|
60853
|
+
w = w.addMark(x2 + I2.start, x2 + I2.end, S.create());
|
|
60854
|
+
o.dispatch(w);
|
|
60833
60855
|
}
|
|
60834
60856
|
} catch {
|
|
60835
60857
|
}
|
|
60836
60858
|
try {
|
|
60837
|
-
const
|
|
60838
|
-
if (
|
|
60839
|
-
let
|
|
60840
|
-
|
|
60859
|
+
const S = ((k2 = r2.schema.marks) == null ? void 0 : k2.textStyle) || ((p2 = r2.schema.marks) == null ? void 0 : p2.style) || null;
|
|
60860
|
+
if (S) {
|
|
60861
|
+
let w = o.state.tr.addMark(x2, L3, S.create({ backgroundColor: "yellow" })).scrollIntoView();
|
|
60862
|
+
o.dispatch(w);
|
|
60841
60863
|
}
|
|
60842
60864
|
} catch {
|
|
60843
60865
|
}
|
|
60844
60866
|
try {
|
|
60845
|
-
const
|
|
60846
|
-
|
|
60847
|
-
|
|
60848
|
-
), typeof
|
|
60867
|
+
const S = o.state.selection.constructor;
|
|
60868
|
+
o.dispatch(
|
|
60869
|
+
o.state.tr.setSelection(S.create(o.state.doc, x2, L3)).scrollIntoView()
|
|
60870
|
+
), typeof e.addStyles == "function" && e.addStyles({ backgroundColor: "yellow" });
|
|
60849
60871
|
} catch {
|
|
60850
60872
|
}
|
|
60851
60873
|
try {
|
|
60852
|
-
let
|
|
60874
|
+
let S = null;
|
|
60853
60875
|
try {
|
|
60854
|
-
|
|
60876
|
+
S = ((l = e.getTextCursorPosition()) == null ? void 0 : l.block) || null;
|
|
60855
60877
|
} catch {
|
|
60856
|
-
|
|
60878
|
+
S = null;
|
|
60857
60879
|
}
|
|
60858
|
-
if (!
|
|
60859
|
-
const
|
|
60860
|
-
|
|
60880
|
+
if (!S) {
|
|
60881
|
+
const w = e.topLevelBlocks || [];
|
|
60882
|
+
S = Array.isArray(w) && w.length > 0 ? w[w.length - 1] : null;
|
|
60861
60883
|
}
|
|
60862
|
-
if (
|
|
60863
|
-
const
|
|
60884
|
+
if (S) {
|
|
60885
|
+
const w = {
|
|
60864
60886
|
type: "actionButtons",
|
|
60865
60887
|
props: {
|
|
60866
|
-
highlightId:
|
|
60888
|
+
highlightId: a
|
|
60867
60889
|
},
|
|
60868
60890
|
content: []
|
|
60869
60891
|
};
|
|
60870
|
-
|
|
60892
|
+
e.insertBlocks([w], S, "after");
|
|
60871
60893
|
}
|
|
60872
60894
|
await nextTick();
|
|
60873
60895
|
try {
|
|
60874
|
-
|
|
60896
|
+
o.dispatch(o.state.tr.scrollIntoView());
|
|
60875
60897
|
} catch {
|
|
60876
60898
|
}
|
|
60877
60899
|
} catch {
|
|
60878
60900
|
}
|
|
60879
|
-
const
|
|
60901
|
+
const E2 = s ? { fromPos: s.fromPos, toPos: s.toPos } : null, z2 = {
|
|
60880
60902
|
isInserting: true,
|
|
60881
|
-
insertedText:
|
|
60882
|
-
originalText:
|
|
60903
|
+
insertedText: t2,
|
|
60904
|
+
originalText: D2,
|
|
60883
60905
|
originalSelection: m2,
|
|
60884
60906
|
insertedBlocks: [],
|
|
60885
|
-
highlightId:
|
|
60886
|
-
inlineFromPos:
|
|
60887
|
-
inlineToPos:
|
|
60888
|
-
originalHighlightRange:
|
|
60907
|
+
highlightId: a,
|
|
60908
|
+
inlineFromPos: x2,
|
|
60909
|
+
inlineToPos: L3,
|
|
60910
|
+
originalHighlightRange: E2
|
|
60889
60911
|
};
|
|
60890
|
-
|
|
60912
|
+
it2.value.set(a, z2), et2.value = z2, ut2();
|
|
60891
60913
|
return;
|
|
60892
60914
|
}
|
|
60893
60915
|
}
|
|
60894
60916
|
if (n === "continue") {
|
|
60895
|
-
if (
|
|
60917
|
+
if (o && r2) {
|
|
60896
60918
|
if (s) {
|
|
60897
60919
|
const d = {
|
|
60898
60920
|
fromPos: s.fromPos,
|
|
60899
60921
|
toPos: s.toPos
|
|
60900
60922
|
};
|
|
60901
|
-
let
|
|
60923
|
+
let x2 = "";
|
|
60902
60924
|
try {
|
|
60903
|
-
|
|
60925
|
+
x2 = r2.doc.textBetween(
|
|
60904
60926
|
s.fromPos,
|
|
60905
60927
|
s.toPos,
|
|
60906
60928
|
`
|
|
@@ -60909,11 +60931,11 @@ const Vt = {
|
|
|
60909
60931
|
} catch {
|
|
60910
60932
|
}
|
|
60911
60933
|
try {
|
|
60912
|
-
const u =
|
|
60913
|
-
|
|
60914
|
-
|
|
60934
|
+
const u = o.state.selection.constructor;
|
|
60935
|
+
o.dispatch(
|
|
60936
|
+
o.state.tr.setSelection(
|
|
60915
60937
|
u.create(
|
|
60916
|
-
|
|
60938
|
+
o.state.doc,
|
|
60917
60939
|
s.toPos,
|
|
60918
60940
|
s.toPos
|
|
60919
60941
|
)
|
|
@@ -60922,53 +60944,53 @@ const Vt = {
|
|
|
60922
60944
|
} catch (u) {
|
|
60923
60945
|
console.warn("设置续写插入位置失败:", u);
|
|
60924
60946
|
}
|
|
60925
|
-
|
|
60926
|
-
const
|
|
60927
|
-
await
|
|
60947
|
+
rt2(o);
|
|
60948
|
+
const h2 = `highlight-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
60949
|
+
await kt2(t2, {
|
|
60928
60950
|
forceInline: true,
|
|
60929
60951
|
insertAt: s.toPos,
|
|
60930
|
-
highlightId:
|
|
60952
|
+
highlightId: h2,
|
|
60931
60953
|
originalHighlightRange: d,
|
|
60932
|
-
originalText:
|
|
60954
|
+
originalText: x2
|
|
60933
60955
|
});
|
|
60934
60956
|
return;
|
|
60935
60957
|
}
|
|
60936
|
-
|
|
60958
|
+
vt2(o), await kt2(t2, {
|
|
60937
60959
|
forceInline: true,
|
|
60938
60960
|
insertAt: r2.doc.content.size
|
|
60939
60961
|
});
|
|
60940
60962
|
return;
|
|
60941
60963
|
}
|
|
60942
|
-
await
|
|
60964
|
+
await kt2(t2, { forceInline: true });
|
|
60943
60965
|
return;
|
|
60944
60966
|
}
|
|
60945
|
-
if (
|
|
60967
|
+
if (o && r2) {
|
|
60946
60968
|
if (s) {
|
|
60947
|
-
|
|
60969
|
+
ue2(
|
|
60970
|
+
o,
|
|
60948
60971
|
t2,
|
|
60949
|
-
e,
|
|
60950
60972
|
s.fromPos,
|
|
60951
60973
|
s.toPos
|
|
60952
|
-
),
|
|
60974
|
+
), rt2(o), ut2();
|
|
60953
60975
|
return;
|
|
60954
60976
|
}
|
|
60955
|
-
|
|
60977
|
+
vt2(o), ut2();
|
|
60956
60978
|
}
|
|
60957
|
-
await
|
|
60979
|
+
await kt2(t2, { forceInline: true }), ut2();
|
|
60958
60980
|
} catch (d) {
|
|
60959
60981
|
console.warn("insertContentReplaceSelected 执行失败:", d);
|
|
60960
60982
|
}
|
|
60961
|
-
},
|
|
60962
|
-
var p2, l, d,
|
|
60963
|
-
if (!
|
|
60983
|
+
}, kt2 = async (t2, n) => {
|
|
60984
|
+
var p2, l, d, x2, h2;
|
|
60985
|
+
if (!e || !t2)
|
|
60964
60986
|
return;
|
|
60965
|
-
const
|
|
60987
|
+
const o = !!(n != null && n.forceInline), r2 = typeof (n == null ? void 0 : n.insertAt) == "number" ? Math.max(0, n.insertAt) : void 0, s = n == null ? void 0 : n.highlightId, c = n == null ? void 0 : n.originalHighlightRange, k2 = n == null ? void 0 : n.originalText;
|
|
60966
60988
|
try {
|
|
60967
|
-
if (!
|
|
60989
|
+
if (!o && await ge2(t2, r2))
|
|
60968
60990
|
return;
|
|
60969
60991
|
let u = null;
|
|
60970
60992
|
try {
|
|
60971
|
-
typeof (
|
|
60993
|
+
typeof (e == null ? void 0 : e.getSelection) == "function" && (u = e.getSelection(), u && Array.isArray(u.blocks) && (u.blocks = u.blocks.filter((f) => {
|
|
60972
60994
|
try {
|
|
60973
60995
|
return f && (f.id || f.type) && typeof f == "object";
|
|
60974
60996
|
} catch {
|
|
@@ -60979,124 +61001,125 @@ const Vt = {
|
|
|
60979
61001
|
console.warn("获取当前选择失败(可能跨多个block):", f);
|
|
60980
61002
|
}
|
|
60981
61003
|
const m2 = u && Array.isArray(u.blocks) ? {
|
|
60982
|
-
|
|
61004
|
+
// 深拷贝 block,避免后续编辑时原始快照被就地修改
|
|
61005
|
+
blocks: qt2(u.blocks),
|
|
60983
61006
|
textCursorPosition: u.textCursorPosition
|
|
60984
|
-
} : null,
|
|
60985
|
-
if (!
|
|
61007
|
+
} : null, a = e == null ? void 0 : e.prosemirrorView, D2 = (e == null ? void 0 : e.prosemirrorState) || (a == null ? void 0 : a.state);
|
|
61008
|
+
if (!a || !D2)
|
|
60986
61009
|
return;
|
|
60987
|
-
const
|
|
60988
|
-
let
|
|
61010
|
+
const _ = a ? Xt2(a) : null, i = c !== void 0 ? c : _ ? { fromPos: _.fromPos, toPos: _.toPos } : null;
|
|
61011
|
+
let g = false;
|
|
60989
61012
|
try {
|
|
60990
|
-
|
|
61013
|
+
g = !!((p2 = e.getTextCursorPosition()) != null && p2.block);
|
|
60991
61014
|
} catch {
|
|
60992
|
-
|
|
61015
|
+
g = false;
|
|
60993
61016
|
}
|
|
60994
|
-
const
|
|
60995
|
-
let
|
|
60996
|
-
if (typeof r2 != "number" && !
|
|
61017
|
+
const M = D2.doc, L3 = D2.selection;
|
|
61018
|
+
let E2 = typeof r2 == "number" ? Math.min(r2, M.content.size) : g && L3 ? L3.to : M.content.size;
|
|
61019
|
+
if (typeof r2 != "number" && !g) {
|
|
60997
61020
|
console.log("无光标111");
|
|
60998
61021
|
try {
|
|
60999
|
-
const f =
|
|
61000
|
-
|
|
61001
|
-
|
|
61002
|
-
),
|
|
61022
|
+
const f = a.state.selection.constructor;
|
|
61023
|
+
a.dispatch(
|
|
61024
|
+
a.state.tr.setSelection(f.create(M, M.content.size, M.content.size))
|
|
61025
|
+
), E2 = M.content.size;
|
|
61003
61026
|
} catch {
|
|
61004
61027
|
}
|
|
61005
61028
|
}
|
|
61006
|
-
const
|
|
61007
|
-
const
|
|
61008
|
-
let V2 = "",
|
|
61009
|
-
const
|
|
61029
|
+
const z2 = s || `highlight-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, S = (f) => {
|
|
61030
|
+
const C2 = [];
|
|
61031
|
+
let V2 = "", P2 = 0;
|
|
61032
|
+
const R2 = /\*\*(.+?)\*\*/g;
|
|
61010
61033
|
let N2;
|
|
61011
|
-
for (; (N2 =
|
|
61034
|
+
for (; (N2 = R2.exec(f)) !== null; ) {
|
|
61012
61035
|
const H2 = N2.index, $2 = N2.index + N2[0].length;
|
|
61013
|
-
V2 += f.slice(
|
|
61036
|
+
V2 += f.slice(P2, H2);
|
|
61014
61037
|
const Y2 = N2[1], U2 = V2.length;
|
|
61015
61038
|
V2 += Y2;
|
|
61016
61039
|
const q2 = V2.length;
|
|
61017
|
-
|
|
61040
|
+
C2.push({ start: U2, end: q2 }), P2 = $2;
|
|
61018
61041
|
}
|
|
61019
|
-
return V2 += f.slice(
|
|
61020
|
-
}, { plainText:
|
|
61021
|
-
if (!
|
|
61022
|
-
console.warn("处理后的文本为空,无法插入,原始文本:",
|
|
61042
|
+
return V2 += f.slice(P2), { plainText: V2, boldRanges: C2 };
|
|
61043
|
+
}, { plainText: w, boldRanges: I2 } = S(t2);
|
|
61044
|
+
if (!w || w.length === 0) {
|
|
61045
|
+
console.warn("处理后的文本为空,无法插入,原始文本:", t2);
|
|
61023
61046
|
return;
|
|
61024
61047
|
}
|
|
61025
|
-
let
|
|
61048
|
+
let b = E2, T2 = E2 + w.length;
|
|
61026
61049
|
if (console.log(
|
|
61027
61050
|
"准备插入文本,位置:",
|
|
61028
|
-
|
|
61051
|
+
b,
|
|
61029
61052
|
"到",
|
|
61030
|
-
|
|
61053
|
+
T2,
|
|
61031
61054
|
"文本长度:",
|
|
61032
|
-
|
|
61055
|
+
w.length,
|
|
61033
61056
|
"原始文本:",
|
|
61034
|
-
|
|
61035
|
-
),
|
|
61057
|
+
t2
|
|
61058
|
+
), M.content.size === 0)
|
|
61036
61059
|
try {
|
|
61037
61060
|
const f = {
|
|
61038
61061
|
type: "paragraph",
|
|
61039
61062
|
content: []
|
|
61040
61063
|
};
|
|
61041
|
-
|
|
61064
|
+
e.insertBlocks([f], void 0, "after"), await nextTick(), E2 = a.state.doc.content.size, console.log("文档为空,已创建段落,新插入位置:", E2);
|
|
61042
61065
|
} catch (f) {
|
|
61043
61066
|
console.warn("创建段落失败:", f);
|
|
61044
61067
|
}
|
|
61045
61068
|
if (typeof r2 == "number")
|
|
61046
61069
|
try {
|
|
61047
|
-
const f =
|
|
61048
|
-
|
|
61049
|
-
|
|
61070
|
+
const f = a.state.selection.constructor, C2 = Math.min(r2, a.state.doc.content.size);
|
|
61071
|
+
a.dispatch(
|
|
61072
|
+
a.state.tr.setSelection(f.create(a.state.doc, C2, C2)).scrollIntoView()
|
|
61050
61073
|
);
|
|
61051
61074
|
} catch (f) {
|
|
61052
61075
|
console.warn("设置指定插入位置失败:", f);
|
|
61053
61076
|
}
|
|
61054
61077
|
else
|
|
61055
|
-
|
|
61078
|
+
vt2(a);
|
|
61056
61079
|
await nextTick();
|
|
61057
|
-
const
|
|
61058
|
-
let
|
|
61059
|
-
typeof r2 == "number" ?
|
|
61060
|
-
let F2 =
|
|
61080
|
+
const y = a.state, v2 = y.doc.content.size;
|
|
61081
|
+
let A;
|
|
61082
|
+
typeof r2 == "number" ? A = Math.min(r2, v2) : (A = y.selection.to, A < v2 && (A = v2), E2 > v2 && (E2 = v2), A = Math.min(A, v2)), b = A;
|
|
61083
|
+
let F2 = A + w.length;
|
|
61061
61084
|
console.log(
|
|
61062
61085
|
"实际插入位置:",
|
|
61063
|
-
C2,
|
|
61064
|
-
"文档大小:",
|
|
61065
61086
|
A,
|
|
61087
|
+
"文档大小:",
|
|
61088
|
+
v2,
|
|
61066
61089
|
"光标位置:",
|
|
61067
|
-
|
|
61090
|
+
y.selection.to
|
|
61068
61091
|
);
|
|
61069
61092
|
let j2 = false;
|
|
61070
61093
|
if (typeof r2 == "number")
|
|
61071
61094
|
try {
|
|
61072
|
-
let f =
|
|
61073
|
-
|
|
61095
|
+
let f = y.tr.insertText(w, A, A).scrollIntoView();
|
|
61096
|
+
a.dispatch(f), await nextTick(), a.state.doc.content.size > v2 ? (b = A, T2 = A + w.length, F2 = T2, j2 = true, console.log("在指定位置插入成功,位置:", b, "到", T2)) : console.warn("在指定位置插入失败,文档大小未改变");
|
|
61074
61097
|
} catch (f) {
|
|
61075
61098
|
console.warn("在指定位置插入异常:", f);
|
|
61076
61099
|
}
|
|
61077
61100
|
else
|
|
61078
61101
|
try {
|
|
61079
|
-
let f = -1,
|
|
61080
|
-
if (
|
|
61102
|
+
let f = -1, C2 = -1;
|
|
61103
|
+
if (y.doc.nodesBetween(0, v2, (V2, P2) => {
|
|
61081
61104
|
if (V2.isTextblock) {
|
|
61082
|
-
const
|
|
61083
|
-
|
|
61105
|
+
const R2 = P2 + V2.nodeSize;
|
|
61106
|
+
P2 > f && (f = P2, C2 = R2);
|
|
61084
61107
|
}
|
|
61085
|
-
}), f >= 0 &&
|
|
61086
|
-
const
|
|
61108
|
+
}), f >= 0 && C2 > f) {
|
|
61109
|
+
const P2 = C2 - 1;
|
|
61087
61110
|
console.log(
|
|
61088
61111
|
"找到文本块,尝试在块内插入,位置:",
|
|
61089
|
-
|
|
61112
|
+
P2,
|
|
61090
61113
|
"块范围:",
|
|
61091
61114
|
f,
|
|
61092
61115
|
"-",
|
|
61093
|
-
|
|
61116
|
+
C2
|
|
61094
61117
|
);
|
|
61095
61118
|
try {
|
|
61096
|
-
let
|
|
61097
|
-
|
|
61098
|
-
} catch (
|
|
61099
|
-
console.warn("在文本块内插入异常:",
|
|
61119
|
+
let R2 = y.tr.insertText(w, P2, P2).scrollIntoView();
|
|
61120
|
+
a.dispatch(R2), await nextTick(), a.state.doc.content.size > v2 ? (b = P2, T2 = P2 + w.length, A = b, F2 = T2, j2 = true, console.log("在文本块内插入成功,位置:", b, "到", T2)) : console.warn("在文本块内插入失败,文档大小未改变");
|
|
61121
|
+
} catch (R2) {
|
|
61122
|
+
console.warn("在文本块内插入异常:", R2);
|
|
61100
61123
|
}
|
|
61101
61124
|
}
|
|
61102
61125
|
} catch (f) {
|
|
@@ -61104,65 +61127,65 @@ const Vt = {
|
|
|
61104
61127
|
}
|
|
61105
61128
|
if (!j2) {
|
|
61106
61129
|
console.log("内联插入失败,使用块插入方式");
|
|
61107
|
-
const f =
|
|
61130
|
+
const f = e.topLevelBlocks || [];
|
|
61108
61131
|
if (f.length > 0) {
|
|
61109
|
-
const
|
|
61132
|
+
const C2 = f[f.length - 1], V2 = {
|
|
61110
61133
|
type: "paragraph",
|
|
61111
|
-
content: [{ type: "text", text:
|
|
61134
|
+
content: [{ type: "text", text: w }]
|
|
61112
61135
|
};
|
|
61113
|
-
|
|
61114
|
-
const
|
|
61115
|
-
|
|
61136
|
+
e.insertBlocks([V2], C2, "after"), await nextTick();
|
|
61137
|
+
const R2 = a.state.doc.content.size;
|
|
61138
|
+
b = R2 - w.length, T2 = R2, A = b, F2 = T2, console.log("块插入成功,位置:", b, "到", T2, "新文档大小:", R2);
|
|
61116
61139
|
} else {
|
|
61117
61140
|
console.error("没有找到任何块,无法插入");
|
|
61118
61141
|
return;
|
|
61119
61142
|
}
|
|
61120
61143
|
}
|
|
61121
|
-
await nextTick(),
|
|
61122
|
-
const Z2 =
|
|
61123
|
-
console.log("插入后文档大小:", Z2, "预期结束位置:",
|
|
61144
|
+
await nextTick(), T2 = F2, b = A;
|
|
61145
|
+
const Z2 = a.state.doc.content.size;
|
|
61146
|
+
console.log("插入后文档大小:", Z2, "预期结束位置:", T2, "fromPos:", b);
|
|
61124
61147
|
try {
|
|
61125
|
-
const f =
|
|
61126
|
-
if (
|
|
61148
|
+
const f = a.state, C2 = (l = f.schema.marks) == null ? void 0 : l.strong;
|
|
61149
|
+
if (C2 && Array.isArray(I2) && I2.length > 0) {
|
|
61127
61150
|
let V2 = f.tr;
|
|
61128
|
-
for (const
|
|
61129
|
-
V2 = V2.addMark(
|
|
61130
|
-
|
|
61151
|
+
for (const P2 of I2)
|
|
61152
|
+
V2 = V2.addMark(b + P2.start, b + P2.end, C2.create());
|
|
61153
|
+
a.dispatch(V2);
|
|
61131
61154
|
}
|
|
61132
61155
|
} catch {
|
|
61133
61156
|
}
|
|
61134
61157
|
try {
|
|
61135
|
-
const f =
|
|
61136
|
-
if (
|
|
61137
|
-
let V2 = f.tr.addMark(
|
|
61138
|
-
|
|
61158
|
+
const f = a.state, C2 = ((d = f.schema.marks) == null ? void 0 : d.textStyle) || ((x2 = f.schema.marks) == null ? void 0 : x2.style) || null;
|
|
61159
|
+
if (C2) {
|
|
61160
|
+
let V2 = f.tr.addMark(b, T2, C2.create({ backgroundColor: "yellow" })).scrollIntoView();
|
|
61161
|
+
a.dispatch(V2), console.log("已应用高亮,位置:", b, "到", T2);
|
|
61139
61162
|
} else
|
|
61140
61163
|
console.warn("找不到 textStyle mark");
|
|
61141
61164
|
} catch (f) {
|
|
61142
61165
|
console.warn("为插入文本添加背景高亮失败:", f);
|
|
61143
61166
|
}
|
|
61144
61167
|
try {
|
|
61145
|
-
const f =
|
|
61146
|
-
|
|
61147
|
-
|
|
61148
|
-
), typeof
|
|
61168
|
+
const f = a.state.selection.constructor;
|
|
61169
|
+
a.dispatch(
|
|
61170
|
+
a.state.tr.setSelection(f.create(a.state.doc, b, T2)).scrollIntoView()
|
|
61171
|
+
), typeof e.addStyles == "function" && e.addStyles({ backgroundColor: "yellow" });
|
|
61149
61172
|
} catch {
|
|
61150
61173
|
}
|
|
61151
61174
|
setTimeout(() => {
|
|
61152
61175
|
try {
|
|
61153
|
-
const f =
|
|
61176
|
+
const f = e == null ? void 0 : e.prosemirrorView;
|
|
61154
61177
|
if (f) {
|
|
61155
|
-
const
|
|
61156
|
-
if (
|
|
61157
|
-
const N2 =
|
|
61178
|
+
const C2 = f.domAtPos(b), V2 = f.domAtPos(T2), P2 = C2.node, R2 = V2.node;
|
|
61179
|
+
if (P2 === R2 && P2.nodeType === Node.TEXT_NODE) {
|
|
61180
|
+
const N2 = P2.parentElement;
|
|
61158
61181
|
N2 && (N2.style.backgroundColor = "yellow", console.log("DOM 高亮已应用(单节点)"));
|
|
61159
61182
|
} else {
|
|
61160
|
-
if (
|
|
61161
|
-
const N2 =
|
|
61183
|
+
if (P2.nodeType === Node.TEXT_NODE) {
|
|
61184
|
+
const N2 = P2.parentElement;
|
|
61162
61185
|
N2 && (N2.style.backgroundColor = "yellow");
|
|
61163
61186
|
}
|
|
61164
|
-
if (
|
|
61165
|
-
const N2 =
|
|
61187
|
+
if (R2.nodeType === Node.TEXT_NODE && R2 !== P2) {
|
|
61188
|
+
const N2 = R2.parentElement;
|
|
61166
61189
|
N2 && (N2.style.backgroundColor = "yellow");
|
|
61167
61190
|
}
|
|
61168
61191
|
console.log("DOM 高亮已应用(多节点)");
|
|
@@ -61176,117 +61199,117 @@ const Vt = {
|
|
|
61176
61199
|
await nextTick();
|
|
61177
61200
|
let f = null;
|
|
61178
61201
|
try {
|
|
61179
|
-
if (f = ((
|
|
61202
|
+
if (f = ((h2 = e.getTextCursorPosition()) == null ? void 0 : h2.block) || null, !f && a && D2)
|
|
61180
61203
|
try {
|
|
61181
|
-
let
|
|
61182
|
-
|
|
61183
|
-
Math.max(0,
|
|
61184
|
-
Math.min(
|
|
61185
|
-
(V2,
|
|
61186
|
-
var
|
|
61187
|
-
if (V2.isBlock &&
|
|
61188
|
-
const N2 = (
|
|
61204
|
+
let C2 = null;
|
|
61205
|
+
D2.doc.nodesBetween(
|
|
61206
|
+
Math.max(0, b - 1),
|
|
61207
|
+
Math.min(D2.doc.content.size, T2 + 1),
|
|
61208
|
+
(V2, P2) => {
|
|
61209
|
+
var R2;
|
|
61210
|
+
if (V2.isBlock && P2 <= b && P2 + V2.nodeSize >= T2) {
|
|
61211
|
+
const N2 = (R2 = V2.attrs) == null ? void 0 : R2.id;
|
|
61189
61212
|
if (N2)
|
|
61190
61213
|
try {
|
|
61191
|
-
const H2 =
|
|
61214
|
+
const H2 = e.getBlock(N2);
|
|
61192
61215
|
if (H2)
|
|
61193
|
-
return
|
|
61216
|
+
return C2 = H2, false;
|
|
61194
61217
|
} catch {
|
|
61195
61218
|
}
|
|
61196
61219
|
}
|
|
61197
61220
|
}
|
|
61198
|
-
), f =
|
|
61221
|
+
), f = C2;
|
|
61199
61222
|
} catch {
|
|
61200
61223
|
}
|
|
61201
61224
|
if (!f) {
|
|
61202
|
-
const
|
|
61203
|
-
f = Array.isArray(
|
|
61225
|
+
const C2 = e.topLevelBlocks || [];
|
|
61226
|
+
f = Array.isArray(C2) && C2.length > 0 ? C2[C2.length - 1] : null;
|
|
61204
61227
|
}
|
|
61205
61228
|
} catch {
|
|
61206
|
-
const
|
|
61207
|
-
f = Array.isArray(
|
|
61229
|
+
const C2 = e.topLevelBlocks || [];
|
|
61230
|
+
f = Array.isArray(C2) && C2.length > 0 ? C2[C2.length - 1] : null;
|
|
61208
61231
|
}
|
|
61209
61232
|
if (f) {
|
|
61210
|
-
const
|
|
61233
|
+
const C2 = {
|
|
61211
61234
|
type: "actionButtons",
|
|
61212
61235
|
props: {
|
|
61213
|
-
highlightId:
|
|
61236
|
+
highlightId: z2
|
|
61214
61237
|
},
|
|
61215
61238
|
content: []
|
|
61216
61239
|
};
|
|
61217
|
-
|
|
61240
|
+
e.insertBlocks([C2], f, "after");
|
|
61218
61241
|
}
|
|
61219
|
-
await nextTick(),
|
|
61242
|
+
await nextTick(), Ft2(f == null ? void 0 : f.id, T2);
|
|
61220
61243
|
} catch (f) {
|
|
61221
61244
|
console.warn("插入按钮块失败:", f);
|
|
61222
61245
|
}
|
|
61223
|
-
const
|
|
61246
|
+
const K2 = {
|
|
61224
61247
|
isInserting: true,
|
|
61225
|
-
insertedText:
|
|
61226
|
-
originalText:
|
|
61248
|
+
insertedText: t2,
|
|
61249
|
+
originalText: k2 !== void 0 ? k2 : "",
|
|
61227
61250
|
originalSelection: m2,
|
|
61228
61251
|
insertedBlocks: [],
|
|
61229
|
-
highlightId:
|
|
61230
|
-
inlineFromPos:
|
|
61231
|
-
inlineToPos:
|
|
61232
|
-
originalHighlightRange:
|
|
61252
|
+
highlightId: z2,
|
|
61253
|
+
inlineFromPos: b,
|
|
61254
|
+
inlineToPos: T2,
|
|
61255
|
+
originalHighlightRange: i
|
|
61233
61256
|
};
|
|
61234
|
-
|
|
61257
|
+
it2.value.set(z2, K2), et2.value = K2, i && ut2(), await nextTick();
|
|
61235
61258
|
try {
|
|
61236
|
-
|
|
61259
|
+
a.dispatch(a.state.tr.scrollIntoView());
|
|
61237
61260
|
} catch {
|
|
61238
61261
|
}
|
|
61239
61262
|
} catch (u) {
|
|
61240
61263
|
console.error("插入内容失败:", u);
|
|
61241
61264
|
}
|
|
61242
|
-
},
|
|
61243
|
-
var
|
|
61265
|
+
}, ge2 = async (t2, n) => {
|
|
61266
|
+
var o, r2, s, c;
|
|
61244
61267
|
try {
|
|
61245
|
-
if (!
|
|
61268
|
+
if (!e || !t2 || !(/(^|\n)(#{1,6}\s*|```|(-|\*)\s*|\d+\.\s*|>\s*|\|.+\|)/m.test(t2) || t2.includes(`
|
|
61246
61269
|
`)))
|
|
61247
61270
|
return false;
|
|
61248
|
-
const
|
|
61249
|
-
let g = String(
|
|
61271
|
+
const p2 = (i) => {
|
|
61272
|
+
let g = String(i ?? "");
|
|
61250
61273
|
return g = g.replace(/\r\n?/g, `
|
|
61251
61274
|
`), g = g.replace(/[\u00A0\u2002-\u200B\u202F\u205F\u3000]/g, " "), g = g.split(`
|
|
61252
|
-
`).map((
|
|
61275
|
+
`).map((L3) => L3.replace(/\s+$/g, "").replace(/^\s+$/g, "")).join(`
|
|
61253
61276
|
`), g.endsWith(`
|
|
61254
61277
|
`) || (g += `
|
|
61255
61278
|
`), (g.match(/```/g) || []).length % 2 === 1 && (g += "```\n"), g;
|
|
61256
|
-
},
|
|
61257
|
-
|
|
61258
|
-
const
|
|
61279
|
+
}, l = [], d = p2(t2);
|
|
61280
|
+
l.push(d);
|
|
61281
|
+
const x2 = d.replace(/([^\n])\n(?!\n)/g, `$1
|
|
61259
61282
|
|
|
61260
61283
|
`);
|
|
61261
|
-
|
|
61262
|
-
const
|
|
61284
|
+
l.push(x2);
|
|
61285
|
+
const h2 = d.replace(/\n(\|.*\|)\n/g, (i) => `
|
|
61263
61286
|
|
|
61264
|
-
${
|
|
61287
|
+
${i}
|
|
61265
61288
|
`);
|
|
61266
|
-
|
|
61267
|
-
let
|
|
61268
|
-
for (const
|
|
61289
|
+
l.push(h2);
|
|
61290
|
+
let u = null;
|
|
61291
|
+
for (const i of l)
|
|
61269
61292
|
try {
|
|
61270
|
-
const g = await
|
|
61293
|
+
const g = await e.tryParseMarkdownToBlocks(i);
|
|
61271
61294
|
if (Array.isArray(g) && g.length > 0) {
|
|
61272
|
-
|
|
61295
|
+
u = g;
|
|
61273
61296
|
break;
|
|
61274
61297
|
}
|
|
61275
61298
|
} catch {
|
|
61276
61299
|
}
|
|
61277
|
-
if (!Array.isArray(
|
|
61278
|
-
const
|
|
61279
|
-
if (Array.isArray(
|
|
61280
|
-
|
|
61300
|
+
if (!Array.isArray(u) || u.length === 0) {
|
|
61301
|
+
const i = he2(d);
|
|
61302
|
+
if (Array.isArray(i) && i.length > 0)
|
|
61303
|
+
u = i;
|
|
61281
61304
|
else
|
|
61282
61305
|
return false;
|
|
61283
61306
|
}
|
|
61284
|
-
const
|
|
61285
|
-
let
|
|
61307
|
+
const m2 = e.topLevelBlocks || [];
|
|
61308
|
+
let a = [];
|
|
61286
61309
|
try {
|
|
61287
|
-
if (typeof
|
|
61288
|
-
const
|
|
61289
|
-
|
|
61310
|
+
if (typeof e.getSelectedBlocks == "function") {
|
|
61311
|
+
const i = e.getSelectedBlocks();
|
|
61312
|
+
a = Array.isArray(i) ? i.filter((g) => {
|
|
61290
61313
|
try {
|
|
61291
61314
|
return g && (g.id || g.type) && typeof g == "object";
|
|
61292
61315
|
} catch {
|
|
@@ -61294,30 +61317,62 @@ ${h2}
|
|
|
61294
61317
|
}
|
|
61295
61318
|
}) : [];
|
|
61296
61319
|
}
|
|
61297
|
-
} catch (
|
|
61298
|
-
console.warn("获取选中块失败(可能跨多个block):",
|
|
61320
|
+
} catch (i) {
|
|
61321
|
+
console.warn("获取选中块失败(可能跨多个block):", i), a = [];
|
|
61299
61322
|
}
|
|
61300
|
-
const
|
|
61301
|
-
let
|
|
61323
|
+
const D2 = `highlight-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
61324
|
+
let _ = [];
|
|
61302
61325
|
try {
|
|
61303
|
-
|
|
61304
|
-
|
|
61305
|
-
|
|
61306
|
-
|
|
61307
|
-
|
|
61308
|
-
|
|
61309
|
-
|
|
61326
|
+
let i = null;
|
|
61327
|
+
if (typeof n == "number")
|
|
61328
|
+
try {
|
|
61329
|
+
const g = e == null ? void 0 : e.prosemirrorView, M = (e == null ? void 0 : e.prosemirrorState) || (g == null ? void 0 : g.state);
|
|
61330
|
+
if (g && M) {
|
|
61331
|
+
const L3 = M.doc.content.size, E2 = Math.max(0, Math.min(n, L3));
|
|
61332
|
+
M.doc.nodesBetween(
|
|
61333
|
+
Math.max(0, E2 - 1),
|
|
61334
|
+
Math.min(L3, E2 + 1),
|
|
61335
|
+
(z2, S) => {
|
|
61336
|
+
var w;
|
|
61337
|
+
if (z2.isBlock && S <= E2 && S + z2.nodeSize >= E2) {
|
|
61338
|
+
const I2 = (w = z2.attrs) == null ? void 0 : w.id;
|
|
61339
|
+
if (I2)
|
|
61340
|
+
try {
|
|
61341
|
+
const b = e.getBlock(I2);
|
|
61342
|
+
if (b)
|
|
61343
|
+
return i = b, false;
|
|
61344
|
+
} catch {
|
|
61345
|
+
}
|
|
61346
|
+
}
|
|
61347
|
+
}
|
|
61348
|
+
);
|
|
61349
|
+
}
|
|
61350
|
+
} catch (g) {
|
|
61351
|
+
console.warn("根据 anchorPos 查找块失败:", g);
|
|
61352
|
+
}
|
|
61353
|
+
if (!i && Array.isArray(a) && a.length > 0) {
|
|
61354
|
+
const g = a[a.length - 1];
|
|
61355
|
+
g && (g.id || g.type) && (i = g);
|
|
61356
|
+
}
|
|
61357
|
+
try {
|
|
61358
|
+
if (i)
|
|
61359
|
+
e.insertBlocks(u, i, "after"), _ = u;
|
|
61360
|
+
else if (Array.isArray(m2) && m2.length > 0) {
|
|
61361
|
+
const g = m2[m2.length - 1];
|
|
61362
|
+
g && (g.id || g.type) ? (e.insertBlocks(u, g, "after"), _ = u) : (e.replaceBlocks(m2, u), _ = u);
|
|
61310
61363
|
} else
|
|
61311
|
-
|
|
61312
|
-
}
|
|
61313
|
-
|
|
61314
|
-
|
|
61315
|
-
|
|
61316
|
-
|
|
61317
|
-
|
|
61318
|
-
|
|
61364
|
+
e.replaceBlocks(m2, u), _ = u;
|
|
61365
|
+
} catch (g) {
|
|
61366
|
+
console.warn("插入块失败:", g);
|
|
61367
|
+
try {
|
|
61368
|
+
e.replaceBlocks(m2, u), _ = u;
|
|
61369
|
+
} catch {
|
|
61370
|
+
}
|
|
61371
|
+
}
|
|
61372
|
+
} catch (i) {
|
|
61373
|
+
console.warn("插入块失败:", i);
|
|
61319
61374
|
try {
|
|
61320
|
-
|
|
61375
|
+
e.replaceBlocks(m2, u), _ = u;
|
|
61321
61376
|
} catch (g) {
|
|
61322
61377
|
console.error("替换块也失败:", g);
|
|
61323
61378
|
}
|
|
@@ -61325,37 +61380,37 @@ ${h2}
|
|
|
61325
61380
|
await nextTick();
|
|
61326
61381
|
try {
|
|
61327
61382
|
await nextTick();
|
|
61328
|
-
const
|
|
61329
|
-
if (
|
|
61330
|
-
const
|
|
61331
|
-
let
|
|
61383
|
+
const i = e == null ? void 0 : e.prosemirrorView, g = (e == null ? void 0 : e.prosemirrorState) || (i == null ? void 0 : i.state);
|
|
61384
|
+
if (i && g && Array.isArray(_) && _.length > 0) {
|
|
61385
|
+
const M = i.state, L3 = M.doc.content.size;
|
|
61386
|
+
let E2 = null, z2 = null;
|
|
61332
61387
|
try {
|
|
61333
|
-
const
|
|
61334
|
-
|
|
61335
|
-
var
|
|
61336
|
-
const
|
|
61337
|
-
|
|
61388
|
+
const S = _.map((w) => w == null ? void 0 : w.id).filter((w) => w);
|
|
61389
|
+
S.length > 0 && M.doc.nodesBetween(0, L3, (w, I2) => {
|
|
61390
|
+
var T2;
|
|
61391
|
+
const b = (T2 = w.attrs) == null ? void 0 : T2.id;
|
|
61392
|
+
b && S.includes(b) && (E2 === null && (E2 = I2 + 1), z2 = I2 + w.nodeSize - 1);
|
|
61338
61393
|
});
|
|
61339
|
-
} catch (
|
|
61340
|
-
console.warn("通过块ID查找位置失败:",
|
|
61394
|
+
} catch (S) {
|
|
61395
|
+
console.warn("通过块ID查找位置失败:", S);
|
|
61341
61396
|
}
|
|
61342
|
-
if (
|
|
61343
|
-
const
|
|
61344
|
-
|
|
61397
|
+
if (E2 === null || z2 === null) {
|
|
61398
|
+
const S = L3 - t2.length;
|
|
61399
|
+
E2 = Math.max(0, S), z2 = L3, console.log("使用文档末尾位置:", E2, "到", z2);
|
|
61345
61400
|
}
|
|
61346
|
-
if (console.log("块级插入高亮位置:",
|
|
61347
|
-
const
|
|
61348
|
-
if (
|
|
61401
|
+
if (console.log("块级插入高亮位置:", E2, "到", z2, "文档大小:", L3), E2 !== null && z2 !== null && E2 < z2 && z2 <= L3) {
|
|
61402
|
+
const S = ((o = M.schema.marks) == null ? void 0 : o.textStyle) || ((r2 = M.schema.marks) == null ? void 0 : r2.style) || null;
|
|
61403
|
+
if (S)
|
|
61349
61404
|
try {
|
|
61350
|
-
|
|
61351
|
-
|
|
61405
|
+
i.dispatch(
|
|
61406
|
+
M.tr.addMark(E2, z2, S.create({ backgroundColor: "yellow" })).scrollIntoView()
|
|
61352
61407
|
), console.log("块级高亮已应用");
|
|
61353
61408
|
} catch (w) {
|
|
61354
61409
|
console.warn("应用块级高亮失败:", w);
|
|
61355
61410
|
}
|
|
61356
61411
|
setTimeout(() => {
|
|
61357
61412
|
try {
|
|
61358
|
-
for (const w of
|
|
61413
|
+
for (const w of _)
|
|
61359
61414
|
if (w != null && w.id) {
|
|
61360
61415
|
const I2 = document.querySelector(`[data-node-id="${w.id}"]`) || document.querySelector(`[data-block-id="${w.id}"]`) || document.querySelector(`[data-id="${w.id}"]`);
|
|
61361
61416
|
I2 && (I2.style.backgroundColor = "yellow", console.log("DOM高亮已应用到块:", w.id));
|
|
@@ -61366,34 +61421,34 @@ ${h2}
|
|
|
61366
61421
|
}, 300);
|
|
61367
61422
|
}
|
|
61368
61423
|
}
|
|
61369
|
-
} catch (
|
|
61370
|
-
console.warn("为块级插入内容添加高亮失败:",
|
|
61424
|
+
} catch (i) {
|
|
61425
|
+
console.warn("为块级插入内容添加高亮失败:", i);
|
|
61371
61426
|
}
|
|
61372
61427
|
try {
|
|
61373
61428
|
await nextTick();
|
|
61374
|
-
let
|
|
61375
|
-
const g =
|
|
61376
|
-
if (Array.isArray(g) && g.length > 0 && (
|
|
61377
|
-
const
|
|
61429
|
+
let i = null;
|
|
61430
|
+
const g = e.topLevelBlocks || [];
|
|
61431
|
+
if (Array.isArray(g) && g.length > 0 && (i = g[g.length - 1]), i) {
|
|
61432
|
+
const M = {
|
|
61378
61433
|
type: "actionButtons",
|
|
61379
61434
|
props: {
|
|
61380
|
-
highlightId:
|
|
61435
|
+
highlightId: D2
|
|
61381
61436
|
},
|
|
61382
61437
|
content: []
|
|
61383
61438
|
};
|
|
61384
|
-
|
|
61439
|
+
e.insertBlocks([M], i, "after");
|
|
61385
61440
|
}
|
|
61386
|
-
} catch (
|
|
61387
|
-
console.warn("插入按钮块失败:",
|
|
61441
|
+
} catch (i) {
|
|
61442
|
+
console.warn("插入按钮块失败:", i);
|
|
61388
61443
|
}
|
|
61389
61444
|
try {
|
|
61390
61445
|
await nextTick();
|
|
61391
|
-
const
|
|
61392
|
-
if (Array.isArray(
|
|
61393
|
-
const
|
|
61394
|
-
for (let
|
|
61395
|
-
const
|
|
61396
|
-
if (
|
|
61446
|
+
const i = e.topLevelBlocks || [], g = [];
|
|
61447
|
+
if (Array.isArray(i) && i.length > 0) {
|
|
61448
|
+
const L3 = _.length, E2 = i.slice(-L3 - 1);
|
|
61449
|
+
for (let z2 = E2.length - 1; z2 >= 0; z2--) {
|
|
61450
|
+
const S = E2[z2];
|
|
61451
|
+
if (S && S.type !== "actionButtons" && (g.unshift(S), g.length >= L3))
|
|
61397
61452
|
break;
|
|
61398
61453
|
}
|
|
61399
61454
|
}
|
|
@@ -61401,66 +61456,66 @@ ${h2}
|
|
|
61401
61456
|
"保存插入状态,块数量:",
|
|
61402
61457
|
g.length,
|
|
61403
61458
|
"原始块数量:",
|
|
61404
|
-
|
|
61459
|
+
_.length
|
|
61405
61460
|
);
|
|
61406
|
-
const
|
|
61461
|
+
const M = {
|
|
61407
61462
|
isInserting: true,
|
|
61408
|
-
insertedText:
|
|
61463
|
+
insertedText: t2,
|
|
61409
61464
|
originalSelection: null,
|
|
61410
|
-
insertedBlocks: g.length > 0 ? g :
|
|
61411
|
-
highlightId:
|
|
61465
|
+
insertedBlocks: g.length > 0 ? g : _,
|
|
61466
|
+
highlightId: D2,
|
|
61412
61467
|
inlineFromPos: void 0,
|
|
61413
61468
|
inlineToPos: void 0
|
|
61414
61469
|
};
|
|
61415
|
-
|
|
61416
|
-
} catch (
|
|
61417
|
-
console.warn("创建插入状态失败:",
|
|
61470
|
+
it2.value.set(D2, M), et2.value = M;
|
|
61471
|
+
} catch (i) {
|
|
61472
|
+
console.warn("创建插入状态失败:", i);
|
|
61418
61473
|
}
|
|
61419
61474
|
try {
|
|
61420
|
-
const
|
|
61421
|
-
await nextTick(),
|
|
61475
|
+
const i = Array.isArray(_) && _.length > 0 && ((s = _[0]) == null ? void 0 : s.id) || void 0;
|
|
61476
|
+
await nextTick(), Ft2(i);
|
|
61422
61477
|
} catch {
|
|
61423
61478
|
}
|
|
61424
|
-
return (
|
|
61425
|
-
} catch (
|
|
61426
|
-
return console.warn("按 Markdown 块插入失败,回退为内联文本:",
|
|
61479
|
+
return (c = e.focus) == null || c.call(e), true;
|
|
61480
|
+
} catch (k2) {
|
|
61481
|
+
return console.warn("按 Markdown 块插入失败,回退为内联文本:", k2), false;
|
|
61427
61482
|
}
|
|
61428
|
-
},
|
|
61483
|
+
}, he2 = (t2) => {
|
|
61429
61484
|
try {
|
|
61430
|
-
let n = String(
|
|
61485
|
+
let n = String(t2 ?? "");
|
|
61431
61486
|
n = n.replace(/\r\n?/g, `
|
|
61432
61487
|
`);
|
|
61433
|
-
const
|
|
61488
|
+
const o = n.split(`
|
|
61434
61489
|
`), r2 = [];
|
|
61435
61490
|
let s = 0;
|
|
61436
|
-
for (; s <
|
|
61437
|
-
let c =
|
|
61491
|
+
for (; s < o.length; ) {
|
|
61492
|
+
let c = o[s];
|
|
61438
61493
|
if (!c || /^\s*$/.test(c)) {
|
|
61439
61494
|
s++;
|
|
61440
61495
|
continue;
|
|
61441
61496
|
}
|
|
61442
|
-
const
|
|
61443
|
-
if (
|
|
61444
|
-
const m2 =
|
|
61497
|
+
const k2 = c.match(/^```\s*(\w+)?\s*$/);
|
|
61498
|
+
if (k2) {
|
|
61499
|
+
const m2 = k2[1] || "";
|
|
61445
61500
|
s++;
|
|
61446
|
-
const
|
|
61447
|
-
for (; s <
|
|
61448
|
-
|
|
61449
|
-
s <
|
|
61501
|
+
const a = [];
|
|
61502
|
+
for (; s < o.length && !/^```\s*$/.test(o[s]); )
|
|
61503
|
+
a.push(o[s]), s++;
|
|
61504
|
+
s < o.length && /^```\s*$/.test(o[s]) && s++, r2.push({
|
|
61450
61505
|
type: "codeBlock",
|
|
61451
61506
|
props: { language: m2 },
|
|
61452
|
-
content: [{ type: "text", text:
|
|
61507
|
+
content: [{ type: "text", text: a.join(`
|
|
61453
61508
|
`) }]
|
|
61454
61509
|
});
|
|
61455
61510
|
continue;
|
|
61456
61511
|
}
|
|
61457
61512
|
const p2 = c.match(/^(#{1,6})\s+(.+)$/);
|
|
61458
61513
|
if (p2) {
|
|
61459
|
-
const m2 = Math.min(6, Math.max(1, p2[1].length)),
|
|
61514
|
+
const m2 = Math.min(6, Math.max(1, p2[1].length)), a = p2[2].trim();
|
|
61460
61515
|
r2.push({
|
|
61461
61516
|
type: "heading",
|
|
61462
61517
|
props: { level: m2 },
|
|
61463
|
-
content: [{ type: "text", text:
|
|
61518
|
+
content: [{ type: "text", text: a }]
|
|
61464
61519
|
}), s++;
|
|
61465
61520
|
continue;
|
|
61466
61521
|
}
|
|
@@ -61476,9 +61531,9 @@ ${h2}
|
|
|
61476
61531
|
r2.push({ type: "numberedListItem", content: [{ type: "text", text: m2 }] }), s++;
|
|
61477
61532
|
continue;
|
|
61478
61533
|
}
|
|
61479
|
-
const
|
|
61480
|
-
if (
|
|
61481
|
-
const m2 =
|
|
61534
|
+
const x2 = c.match(/^(-|\*)\s+(.+)$/);
|
|
61535
|
+
if (x2) {
|
|
61536
|
+
const m2 = x2[2].trim();
|
|
61482
61537
|
r2.push({ type: "bulletListItem", content: [{ type: "text", text: m2 }] }), s++;
|
|
61483
61538
|
continue;
|
|
61484
61539
|
}
|
|
@@ -61486,10 +61541,10 @@ ${h2}
|
|
|
61486
61541
|
r2.push({ type: "paragraph", content: [{ type: "text", text: "" }] }), s++;
|
|
61487
61542
|
continue;
|
|
61488
61543
|
}
|
|
61489
|
-
const
|
|
61490
|
-
for (s++; s <
|
|
61491
|
-
|
|
61492
|
-
const u =
|
|
61544
|
+
const h2 = [c];
|
|
61545
|
+
for (s++; s < o.length && !/^\s*$/.test(o[s]); )
|
|
61546
|
+
h2.push(o[s]), s++;
|
|
61547
|
+
const u = h2.join(`
|
|
61493
61548
|
`).trim();
|
|
61494
61549
|
u && r2.push({ type: "paragraph", content: [{ type: "text", text: u }] });
|
|
61495
61550
|
}
|
|
@@ -61497,39 +61552,39 @@ ${h2}
|
|
|
61497
61552
|
} catch {
|
|
61498
61553
|
return [];
|
|
61499
61554
|
}
|
|
61500
|
-
},
|
|
61555
|
+
}, Ut2 = (t2) => {
|
|
61501
61556
|
var r2, s, c;
|
|
61502
|
-
const n =
|
|
61503
|
-
if (!(!
|
|
61557
|
+
const n = t2 || et2.value.highlightId, o = it2.value.get(n);
|
|
61558
|
+
if (!(!e || !o))
|
|
61504
61559
|
try {
|
|
61505
|
-
const { inlineFromPos:
|
|
61506
|
-
if (l && d && typeof
|
|
61560
|
+
const { inlineFromPos: k2, inlineToPos: p2 } = o, l = e == null ? void 0 : e.prosemirrorView, d = (e == null ? void 0 : e.prosemirrorState) || (l == null ? void 0 : l.state);
|
|
61561
|
+
if (l && d && typeof k2 == "number" && typeof p2 == "number") {
|
|
61507
61562
|
let u = d.tr;
|
|
61508
61563
|
const m2 = (r2 = d.schema.marks) == null ? void 0 : r2.strong;
|
|
61509
|
-
m2 && (u = u.removeMark(
|
|
61510
|
-
const
|
|
61511
|
-
|
|
61564
|
+
m2 && (u = u.removeMark(k2, p2, m2));
|
|
61565
|
+
const a = ((s = d.schema.marks) == null ? void 0 : s.textStyle) || ((c = d.schema.marks) == null ? void 0 : c.style) || null;
|
|
61566
|
+
a && (u = u.removeMark(k2, p2, a));
|
|
61512
61567
|
try {
|
|
61513
|
-
u = u.removeMark(
|
|
61568
|
+
u = u.removeMark(k2, p2);
|
|
61514
61569
|
} catch {
|
|
61515
61570
|
}
|
|
61516
61571
|
try {
|
|
61517
|
-
const
|
|
61518
|
-
u = u.setSelection(
|
|
61572
|
+
const i = l.state.selection.constructor;
|
|
61573
|
+
u = u.setSelection(i.create(l.state.doc, k2, p2));
|
|
61519
61574
|
} catch {
|
|
61520
61575
|
}
|
|
61521
61576
|
l.dispatch(u);
|
|
61522
61577
|
try {
|
|
61523
|
-
typeof
|
|
61578
|
+
typeof e.addStyles == "function" && e.addStyles({ backgroundColor: "default" });
|
|
61524
61579
|
} catch {
|
|
61525
61580
|
}
|
|
61526
|
-
const
|
|
61527
|
-
(
|
|
61528
|
-
var
|
|
61529
|
-
return !(
|
|
61581
|
+
const D2 = e.topLevelBlocks || [], _ = D2.filter(
|
|
61582
|
+
(i) => {
|
|
61583
|
+
var g;
|
|
61584
|
+
return !(i.type === "actionButtons" && ((g = i.props) == null ? void 0 : g.highlightId) === n);
|
|
61530
61585
|
}
|
|
61531
61586
|
);
|
|
61532
|
-
|
|
61587
|
+
e.replaceBlocks(D2, _), it2.value.delete(n), et2.value.highlightId === n && (et2.value = {
|
|
61533
61588
|
isInserting: false,
|
|
61534
61589
|
insertedText: "",
|
|
61535
61590
|
originalSelection: null,
|
|
@@ -61540,7 +61595,7 @@ ${h2}
|
|
|
61540
61595
|
});
|
|
61541
61596
|
return;
|
|
61542
61597
|
}
|
|
61543
|
-
const
|
|
61598
|
+
const x2 = e.topLevelBlocks || [], h2 = x2.map((u) => {
|
|
61544
61599
|
var m2;
|
|
61545
61600
|
return u.type === "insertedText" && ((m2 = u.props) == null ? void 0 : m2.highlightId) === n ? {
|
|
61546
61601
|
...u,
|
|
@@ -61555,80 +61610,105 @@ ${h2}
|
|
|
61555
61610
|
return !(u.type === "actionButtons" && ((m2 = u.props) == null ? void 0 : m2.highlightId) === n);
|
|
61556
61611
|
}
|
|
61557
61612
|
);
|
|
61558
|
-
|
|
61613
|
+
e.replaceBlocks(x2, h2), it2.value.delete(n), et2.value.highlightId === n && (et2.value = {
|
|
61559
61614
|
isInserting: false,
|
|
61560
61615
|
insertedText: "",
|
|
61561
61616
|
originalSelection: null,
|
|
61562
61617
|
insertedBlocks: [],
|
|
61563
61618
|
highlightId: ""
|
|
61564
61619
|
}), console.log("已接受插入内容,高亮已移除");
|
|
61565
|
-
} catch (
|
|
61566
|
-
console.error("接受插入内容失败:",
|
|
61620
|
+
} catch (k2) {
|
|
61621
|
+
console.error("接受插入内容失败:", k2);
|
|
61567
61622
|
}
|
|
61568
|
-
},
|
|
61569
|
-
var r2, s, c,
|
|
61570
|
-
const n =
|
|
61571
|
-
if (!(!
|
|
61623
|
+
}, Gt2 = async (t2) => {
|
|
61624
|
+
var r2, s, c, k2;
|
|
61625
|
+
const n = t2 || et2.value.highlightId, o = it2.value.get(n);
|
|
61626
|
+
if (!(!e || !o))
|
|
61572
61627
|
try {
|
|
61573
|
-
const { originalSelection: p2, inlineFromPos: l, inlineToPos: d, originalHighlightRange:
|
|
61574
|
-
if (
|
|
61575
|
-
let
|
|
61628
|
+
const { originalSelection: p2, inlineFromPos: l, inlineToPos: d, originalHighlightRange: x2 } = o, h2 = e == null ? void 0 : e.prosemirrorView, u = (e == null ? void 0 : e.prosemirrorState) || (h2 == null ? void 0 : h2.state);
|
|
61629
|
+
if (h2 && u && typeof l == "number" && typeof d == "number") {
|
|
61630
|
+
let i = null;
|
|
61576
61631
|
console.log("取消插入,原始位置:", l, "到", d);
|
|
61577
|
-
const
|
|
61578
|
-
let
|
|
61579
|
-
|
|
61580
|
-
const
|
|
61581
|
-
if (console.log("当前文档大小:",
|
|
61632
|
+
const g = o.originalText;
|
|
61633
|
+
let M = false;
|
|
61634
|
+
h2 && typeof g == "string" && g.length > 0 && (x2 ? Math.abs(l - x2.toPos) <= 1 ? (M = false, console.log("continue 类型,原始文本还在,不需要恢复")) : (M = true, console.log("rewrite 类型,需要恢复原始文本")) : M = true);
|
|
61635
|
+
const L3 = h2.state, E2 = L3.doc.content.size;
|
|
61636
|
+
if (console.log("当前文档大小:", E2, "保存的位置范围:", l, "-", d), l < d && d <= E2) {
|
|
61582
61637
|
try {
|
|
61583
|
-
let
|
|
61584
|
-
|
|
61585
|
-
} catch (
|
|
61586
|
-
console.error("删除文本失败:",
|
|
61638
|
+
let I2 = L3.tr.delete(l, d);
|
|
61639
|
+
h2.dispatch(I2), console.log("已删除文本,位置:", l, "到", d);
|
|
61640
|
+
} catch (I2) {
|
|
61641
|
+
console.error("删除文本失败:", I2);
|
|
61587
61642
|
try {
|
|
61588
|
-
const
|
|
61589
|
-
if (
|
|
61590
|
-
let
|
|
61591
|
-
|
|
61643
|
+
const b = d - l, T2 = E2, y = Math.max(0, E2 - b);
|
|
61644
|
+
if (y < T2) {
|
|
61645
|
+
let v2 = h2.state.tr.delete(y, T2);
|
|
61646
|
+
h2.dispatch(v2), console.log("使用备用位置删除文本:", y, "到", T2);
|
|
61592
61647
|
}
|
|
61593
|
-
} catch (
|
|
61594
|
-
console.error("备用删除也失败:",
|
|
61648
|
+
} catch (b) {
|
|
61649
|
+
console.error("备用删除也失败:", b);
|
|
61595
61650
|
}
|
|
61596
61651
|
}
|
|
61597
61652
|
await nextTick();
|
|
61598
61653
|
try {
|
|
61599
|
-
const
|
|
61600
|
-
let
|
|
61654
|
+
const I2 = h2.state, b = Math.min(l, I2.doc.content.size);
|
|
61655
|
+
let T2 = I2.tr;
|
|
61601
61656
|
try {
|
|
61602
|
-
const
|
|
61603
|
-
|
|
61657
|
+
const y = I2.selection.constructor;
|
|
61658
|
+
T2 = T2.setSelection(y.create(I2.doc, b, b));
|
|
61604
61659
|
} catch {
|
|
61605
61660
|
}
|
|
61606
|
-
|
|
61661
|
+
h2.dispatch(T2);
|
|
61607
61662
|
try {
|
|
61608
|
-
typeof
|
|
61663
|
+
typeof e.addStyles == "function" && e.addStyles({ backgroundColor: "default" });
|
|
61609
61664
|
} catch {
|
|
61610
61665
|
}
|
|
61611
61666
|
} catch {
|
|
61612
61667
|
}
|
|
61613
61668
|
}
|
|
61614
|
-
if (
|
|
61669
|
+
if (M && g) {
|
|
61670
|
+
let I2 = false;
|
|
61615
61671
|
try {
|
|
61616
|
-
|
|
61617
|
-
|
|
61618
|
-
|
|
61619
|
-
|
|
61620
|
-
|
|
61621
|
-
|
|
61622
|
-
|
|
61623
|
-
|
|
61672
|
+
if (p2 && Array.isArray(p2.blocks) && p2.blocks.length > 0) {
|
|
61673
|
+
const b = p2.blocks, T2 = [];
|
|
61674
|
+
for (const y of b)
|
|
61675
|
+
if (!(!y || typeof y != "object" || !y.id))
|
|
61676
|
+
try {
|
|
61677
|
+
e.updateBlock(y.id, {
|
|
61678
|
+
type: y.type,
|
|
61679
|
+
props: y.props,
|
|
61680
|
+
content: y.content
|
|
61681
|
+
}), T2.push(y.id);
|
|
61682
|
+
} catch (v2) {
|
|
61683
|
+
console.warn("根据原始块快照恢复单个块失败:", v2, y);
|
|
61684
|
+
}
|
|
61685
|
+
T2.length > 0 && (I2 = true, i = x2 || null, console.log(
|
|
61686
|
+
"已通过 originalSelection.blocks 恢复原始块结构,更新块数量:",
|
|
61687
|
+
T2.length
|
|
61688
|
+
));
|
|
61689
|
+
}
|
|
61690
|
+
} catch (b) {
|
|
61691
|
+
console.warn("通过原始块结构恢复内容失败,将退回到文本方式恢复:", b);
|
|
61624
61692
|
}
|
|
61625
|
-
|
|
61626
|
-
|
|
61627
|
-
|
|
61628
|
-
|
|
61693
|
+
if (!I2)
|
|
61694
|
+
try {
|
|
61695
|
+
const b = h2.state, T2 = Math.max(0, Math.min(l, b.doc.content.size));
|
|
61696
|
+
let y = b.tr.insertText(g, T2, T2);
|
|
61697
|
+
h2.dispatch(y), await nextTick(), i = {
|
|
61698
|
+
fromPos: T2,
|
|
61699
|
+
toPos: T2 + g.length
|
|
61700
|
+
}, console.log("已恢复原始文本内容,长度:", g.length);
|
|
61701
|
+
} catch (b) {
|
|
61702
|
+
console.warn("恢复原始文本失败:", b);
|
|
61703
|
+
}
|
|
61704
|
+
}
|
|
61705
|
+
const z2 = e.topLevelBlocks || [], S = z2.filter(
|
|
61706
|
+
(I2) => {
|
|
61707
|
+
var b;
|
|
61708
|
+
return !(I2.type === "actionButtons" && ((b = I2.props) == null ? void 0 : b.highlightId) === n);
|
|
61629
61709
|
}
|
|
61630
61710
|
);
|
|
61631
|
-
|
|
61711
|
+
e.replaceBlocks(z2, S), it2.value.delete(n), et2.value.highlightId === n && (et2.value = {
|
|
61632
61712
|
isInserting: false,
|
|
61633
61713
|
insertedText: "",
|
|
61634
61714
|
originalSelection: null,
|
|
@@ -61638,73 +61718,73 @@ ${h2}
|
|
|
61638
61718
|
inlineToPos: void 0,
|
|
61639
61719
|
originalHighlightRange: null
|
|
61640
61720
|
});
|
|
61641
|
-
const
|
|
61642
|
-
if (
|
|
61721
|
+
const w = x2 || i;
|
|
61722
|
+
if (w && h2) {
|
|
61643
61723
|
await nextTick();
|
|
61644
61724
|
try {
|
|
61645
|
-
const
|
|
61646
|
-
|
|
61647
|
-
Math.min(
|
|
61725
|
+
const I2 = h2.state.doc.content.size, b = Math.max(0, Math.min(w.fromPos, I2)), T2 = Math.max(
|
|
61726
|
+
b + 1,
|
|
61727
|
+
Math.min(w.toPos, I2)
|
|
61648
61728
|
);
|
|
61649
|
-
if (
|
|
61729
|
+
if (b < T2 && T2 <= I2) {
|
|
61650
61730
|
try {
|
|
61651
|
-
const
|
|
61652
|
-
let
|
|
61653
|
-
|
|
61654
|
-
} catch (
|
|
61655
|
-
console.warn("移除旧高亮样式失败:",
|
|
61731
|
+
const y = (r2 = h2.state.schema.marks) == null ? void 0 : r2.backgroundColor, v2 = (s = h2.state.schema.marks) == null ? void 0 : s.textColor;
|
|
61732
|
+
let A = h2.state.tr;
|
|
61733
|
+
y && (A = A.removeMark(b, T2, y)), v2 && (A = A.removeMark(b, T2, v2)), A.steps.length > 0 && (h2.dispatch(A), await nextTick());
|
|
61734
|
+
} catch (y) {
|
|
61735
|
+
console.warn("移除旧高亮样式失败:", y);
|
|
61656
61736
|
}
|
|
61657
|
-
await
|
|
61737
|
+
await Vt2(h2, b, T2);
|
|
61658
61738
|
} else
|
|
61659
|
-
console.warn("高亮范围无效,无法恢复:",
|
|
61660
|
-
} catch (
|
|
61661
|
-
console.warn("恢复高亮失败:",
|
|
61739
|
+
console.warn("高亮范围无效,无法恢复:", b, T2, I2);
|
|
61740
|
+
} catch (I2) {
|
|
61741
|
+
console.warn("恢复高亮失败:", I2);
|
|
61662
61742
|
}
|
|
61663
61743
|
}
|
|
61664
61744
|
return;
|
|
61665
61745
|
}
|
|
61666
|
-
const m2 =
|
|
61746
|
+
const m2 = e.topLevelBlocks || [];
|
|
61667
61747
|
console.log("取消插入,当前块数量:", m2.length, "highlightId:", n);
|
|
61668
|
-
const
|
|
61669
|
-
Array.isArray(
|
|
61670
|
-
|
|
61671
|
-
}), console.log("需要删除的块ID:", Array.from(
|
|
61672
|
-
const
|
|
61673
|
-
var
|
|
61674
|
-
return !(
|
|
61748
|
+
const a = o.insertedBlocks || [], D2 = /* @__PURE__ */ new Set();
|
|
61749
|
+
Array.isArray(a) && a.length > 0 && a.forEach((i) => {
|
|
61750
|
+
i != null && i.id && D2.add(i.id);
|
|
61751
|
+
}), console.log("需要删除的块ID:", Array.from(D2));
|
|
61752
|
+
const _ = m2.filter((i) => {
|
|
61753
|
+
var g, M;
|
|
61754
|
+
return !(i.type === "actionButtons" && ((g = i.props) == null ? void 0 : g.highlightId) === n || i != null && i.id && D2.has(i.id) || i.type === "insertedText" && ((M = i.props) == null ? void 0 : M.highlightId) === n);
|
|
61675
61755
|
});
|
|
61676
|
-
if (console.log("删除后块数量:",
|
|
61756
|
+
if (console.log("删除后块数量:", _.length), _.length !== m2.length ? (e.replaceBlocks(m2, _), console.log("已删除插入的块")) : console.warn("没有找到需要删除的块"), p2 && p2.blocks)
|
|
61677
61757
|
try {
|
|
61678
|
-
|
|
61679
|
-
} catch (
|
|
61680
|
-
console.warn("恢复选择状态失败:",
|
|
61758
|
+
e.setSelection(p2);
|
|
61759
|
+
} catch (i) {
|
|
61760
|
+
console.warn("恢复选择状态失败:", i);
|
|
61681
61761
|
}
|
|
61682
|
-
if (
|
|
61683
|
-
const
|
|
61684
|
-
if (
|
|
61762
|
+
if (x2) {
|
|
61763
|
+
const i = e == null ? void 0 : e.prosemirrorView;
|
|
61764
|
+
if (i) {
|
|
61685
61765
|
await nextTick();
|
|
61686
61766
|
try {
|
|
61687
|
-
const
|
|
61688
|
-
|
|
61689
|
-
Math.min(
|
|
61767
|
+
const g = i.state, M = g.doc.content.size, L3 = Math.max(0, Math.min(x2.fromPos, M)), E2 = Math.max(
|
|
61768
|
+
L3 + 1,
|
|
61769
|
+
Math.min(x2.toPos, M)
|
|
61690
61770
|
);
|
|
61691
|
-
if (
|
|
61771
|
+
if (L3 < E2 && E2 <= M) {
|
|
61692
61772
|
try {
|
|
61693
|
-
const
|
|
61694
|
-
let
|
|
61695
|
-
|
|
61696
|
-
} catch (
|
|
61697
|
-
console.warn("移除旧高亮样式失败:",
|
|
61773
|
+
const z2 = (c = g.schema.marks) == null ? void 0 : c.backgroundColor, S = (k2 = g.schema.marks) == null ? void 0 : k2.textColor;
|
|
61774
|
+
let w = g.tr;
|
|
61775
|
+
z2 && (w = w.removeMark(L3, E2, z2)), S && (w = w.removeMark(L3, E2, S)), w.steps.length > 0 && (i.dispatch(w), await nextTick());
|
|
61776
|
+
} catch (z2) {
|
|
61777
|
+
console.warn("移除旧高亮样式失败:", z2);
|
|
61698
61778
|
}
|
|
61699
|
-
await
|
|
61779
|
+
await Vt2(i, L3, E2);
|
|
61700
61780
|
} else
|
|
61701
|
-
console.warn("高亮范围无效,无法恢复:",
|
|
61702
|
-
} catch (
|
|
61703
|
-
console.warn("恢复高亮失败:",
|
|
61781
|
+
console.warn("高亮范围无效,无法恢复:", L3, E2, M);
|
|
61782
|
+
} catch (g) {
|
|
61783
|
+
console.warn("恢复高亮失败:", g);
|
|
61704
61784
|
}
|
|
61705
61785
|
}
|
|
61706
61786
|
}
|
|
61707
|
-
|
|
61787
|
+
et2.value = {
|
|
61708
61788
|
isInserting: false,
|
|
61709
61789
|
insertedText: "",
|
|
61710
61790
|
originalSelection: null,
|
|
@@ -61717,65 +61797,65 @@ ${h2}
|
|
|
61717
61797
|
}
|
|
61718
61798
|
};
|
|
61719
61799
|
watch(
|
|
61720
|
-
() => [
|
|
61800
|
+
() => [nt2.defaultContent, nt2.readOnly, nt2.theme],
|
|
61721
61801
|
async () => {
|
|
61722
|
-
await nextTick(),
|
|
61802
|
+
await nextTick(), ht2 && await Nt2();
|
|
61723
61803
|
},
|
|
61724
61804
|
{ deep: false }
|
|
61725
61805
|
);
|
|
61726
|
-
const
|
|
61806
|
+
const Jt2 = (t2) => {
|
|
61727
61807
|
var r2;
|
|
61728
|
-
const n =
|
|
61729
|
-
return n.includes("Block type does not match") || n.includes("Block doesn't have id") || n.includes("Invalid block") || n.includes("Cannot read properties of undefined") || n.includes("reading 'children'") ||
|
|
61808
|
+
const n = t2.message || "", o = ((r2 = t2.error) == null ? void 0 : r2.stack) || "";
|
|
61809
|
+
return n.includes("Block type does not match") || n.includes("Block doesn't have id") || n.includes("Invalid block") || n.includes("Cannot read properties of undefined") || n.includes("reading 'children'") || o.includes("ViewTreeUpdater") || o.includes("_NodeViewDesc") || o.includes("preMatch") ? (console.warn("捕获到 BlockNote/ProseMirror 内部错误(已静默处理):", n), t2.preventDefault(), t2.stopPropagation(), true) : false;
|
|
61730
61810
|
};
|
|
61731
61811
|
return onMounted(async () => {
|
|
61732
|
-
window.acceptInsertion =
|
|
61812
|
+
window.acceptInsertion = Ut2, window.cancelInsertion = Gt2, window.addEventListener("error", Jt2, true), await nextTick(), await Nt2(), W2.value && (W2.value.addEventListener("scroll", Ot$12), W2.value.addEventListener("click", Lt2, true), W2.value.addEventListener("keydown", Ht2, true));
|
|
61733
61813
|
}), onUnmounted(() => {
|
|
61734
|
-
delete window.acceptInsertion, delete window.cancelInsertion, window.removeEventListener("error",
|
|
61735
|
-
}),
|
|
61736
|
-
getEditor: () =>
|
|
61814
|
+
delete window.acceptInsertion, delete window.cancelInsertion, window.removeEventListener("error", Jt2, true), ht2 && (ht2.unmount(), ht2 = null), e = null, W2.value && (W2.value.removeEventListener("scroll", Ot$12), W2.value.removeEventListener("click", Lt2, true), W2.value.removeEventListener("keydown", Ht2, true));
|
|
61815
|
+
}), pt2({
|
|
61816
|
+
getEditor: () => e,
|
|
61737
61817
|
getContent: () => {
|
|
61738
61818
|
try {
|
|
61739
|
-
return
|
|
61740
|
-
} catch (
|
|
61741
|
-
return console.warn("获取编辑器内容时出错:",
|
|
61819
|
+
return e && e.document ? e.document || [] : [];
|
|
61820
|
+
} catch (t2) {
|
|
61821
|
+
return console.warn("获取编辑器内容时出错:", t2), [];
|
|
61742
61822
|
}
|
|
61743
61823
|
},
|
|
61744
|
-
setContent: (
|
|
61745
|
-
if (
|
|
61824
|
+
setContent: (t2) => {
|
|
61825
|
+
if (e)
|
|
61746
61826
|
try {
|
|
61747
|
-
const n =
|
|
61748
|
-
console.log("设置编辑器内容:", n),
|
|
61827
|
+
const n = It$12(t2);
|
|
61828
|
+
console.log("设置编辑器内容:", n), e.replaceBlocks(e.topLevelBlocks, n);
|
|
61749
61829
|
} catch (n) {
|
|
61750
61830
|
console.warn("设置编辑器内容时出错:", n);
|
|
61751
61831
|
}
|
|
61752
61832
|
},
|
|
61753
|
-
focus: () =>
|
|
61833
|
+
focus: () => e == null ? void 0 : e.focus(),
|
|
61754
61834
|
clear: () => {
|
|
61755
|
-
if (
|
|
61835
|
+
if (e)
|
|
61756
61836
|
try {
|
|
61757
|
-
const
|
|
61837
|
+
const t2 = [
|
|
61758
61838
|
{
|
|
61759
61839
|
type: "paragraph",
|
|
61760
|
-
content: [{ type: "text", text:
|
|
61840
|
+
content: [{ type: "text", text: nt2.placeholder || "", styles: {} }]
|
|
61761
61841
|
}
|
|
61762
61842
|
];
|
|
61763
|
-
|
|
61764
|
-
} catch (
|
|
61765
|
-
console.warn("清空编辑器内容时出错:",
|
|
61843
|
+
e.replaceBlocks(e.topLevelBlocks, t2);
|
|
61844
|
+
} catch (t2) {
|
|
61845
|
+
console.warn("清空编辑器内容时出错:", t2);
|
|
61766
61846
|
}
|
|
61767
61847
|
},
|
|
61768
|
-
pasteMarkdown:
|
|
61769
|
-
pasteMarkdownWithAgentId:
|
|
61770
|
-
getSelectedText:
|
|
61771
|
-
insertContent:
|
|
61772
|
-
insertContentReplaceSelected:
|
|
61773
|
-
acceptInsertion:
|
|
61774
|
-
cancelInsertion:
|
|
61775
|
-
getInsertState: () =>
|
|
61848
|
+
pasteMarkdown: ae2,
|
|
61849
|
+
pasteMarkdownWithAgentId: ie2,
|
|
61850
|
+
getSelectedText: jt2,
|
|
61851
|
+
insertContent: kt2,
|
|
61852
|
+
insertContentReplaceSelected: Wt2,
|
|
61853
|
+
acceptInsertion: Ut2,
|
|
61854
|
+
cancelInsertion: Gt2,
|
|
61855
|
+
getInsertState: () => et2.value,
|
|
61776
61856
|
// 是否存在未确认的插入内容(含并发插入场景)
|
|
61777
|
-
hasPendingInsertions: () =>
|
|
61778
|
-
}), (
|
|
61857
|
+
hasPendingInsertions: () => it2.value.size > 0
|
|
61858
|
+
}), (t2, n) => (openBlock(), createElementBlock("div", Fe, [
|
|
61779
61859
|
createBaseVNode("div", {
|
|
61780
61860
|
ref_key: "editorContainer",
|
|
61781
61861
|
ref: W2,
|
|
@@ -61784,21 +61864,21 @@ ${h2}
|
|
|
61784
61864
|
]));
|
|
61785
61865
|
}
|
|
61786
61866
|
});
|
|
61787
|
-
const
|
|
61788
|
-
const
|
|
61789
|
-
for (const [
|
|
61790
|
-
|
|
61791
|
-
return
|
|
61792
|
-
},
|
|
61793
|
-
|
|
61794
|
-
},
|
|
61795
|
-
installBlockNoteEditor(
|
|
61796
|
-
},
|
|
61797
|
-
install:
|
|
61867
|
+
const qe = (ot2, pt2) => {
|
|
61868
|
+
const wt2 = ot2.__vccOpts || ot2;
|
|
61869
|
+
for (const [Tt2, Ct2] of pt2)
|
|
61870
|
+
wt2[Tt2] = Ct2;
|
|
61871
|
+
return wt2;
|
|
61872
|
+
}, Xe = /* @__PURE__ */ qe(je2, [["__scopeId", "data-v-81689c85"]]), Qe = (ot2) => {
|
|
61873
|
+
ot2.component("BlockNoteEditor", Xe);
|
|
61874
|
+
}, We = (ot2) => {
|
|
61875
|
+
installBlockNoteEditor(ot2);
|
|
61876
|
+
}, to = {
|
|
61877
|
+
install: We
|
|
61798
61878
|
};
|
|
61799
61879
|
export {
|
|
61800
|
-
|
|
61801
|
-
|
|
61802
|
-
|
|
61803
|
-
|
|
61880
|
+
Xe as BlockNoteEditor,
|
|
61881
|
+
to as default,
|
|
61882
|
+
We as install,
|
|
61883
|
+
Qe as installBlockNoteEditor
|
|
61804
61884
|
};
|