patent-editor 0.2.7 → 0.2.8
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/lib.d.ts +4 -0
- package/dist/lib.js +484 -479
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/lib.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Sn = Object.defineProperty;
|
|
2
2
|
var En = (e, t, n) => t in e ? Sn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var Se = (e, t, n) => En(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { jsx as
|
|
4
|
+
import { jsx as g, jsxs as L, Fragment as je } from "react/jsx-runtime";
|
|
5
5
|
import Ee, { forwardRef as It, useState as $, useEffect as M, useCallback as ae, useImperativeHandle as Nt, useRef as W, useMemo as At } from "react";
|
|
6
6
|
import { Extension as Oe, ReactRenderer as kn, Node as Z, mergeAttributes as ie, NodeViewWrapper as _n, ReactNodeViewRenderer as Lt, EditorContent as In, useEditor as Nn } from "@tiptap/react";
|
|
7
7
|
import An from "@tiptap/extension-document";
|
|
@@ -177,22 +177,22 @@ const Qr = new we("slashCommand"), ea = Oe.create({
|
|
|
177
177
|
);
|
|
178
178
|
return Nt(n, () => ({
|
|
179
179
|
onKeyDown: ({ event: o }) => o.key === "ArrowUp" ? (a((c) => (c + e.length - 1) % e.length), !0) : o.key === "ArrowDown" ? (a((c) => (c + 1) % e.length), !0) : o.key === "Enter" ? (i(r), !0) : !1
|
|
180
|
-
})), e.length ? /* @__PURE__ */
|
|
180
|
+
})), e.length ? /* @__PURE__ */ g("div", { className: "slash-menu", children: e.map((o, c) => /* @__PURE__ */ L(
|
|
181
181
|
"button",
|
|
182
182
|
{
|
|
183
183
|
className: `slash-menu-item ${c === r ? "slash-menu-item--active" : ""}`,
|
|
184
184
|
onClick: () => i(c),
|
|
185
185
|
onMouseEnter: () => a(c),
|
|
186
186
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ g("span", { className: "slash-menu-icon", children: o.icon }),
|
|
188
188
|
/* @__PURE__ */ L("div", { className: "slash-menu-text", children: [
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ g("span", { className: "slash-menu-title", children: o.title }),
|
|
190
|
+
/* @__PURE__ */ g("span", { className: "slash-menu-desc", children: o.description })
|
|
191
191
|
] })
|
|
192
192
|
]
|
|
193
193
|
},
|
|
194
194
|
o.title
|
|
195
|
-
)) }) : /* @__PURE__ */
|
|
195
|
+
)) }) : /* @__PURE__ */ g("div", { className: "slash-menu", children: /* @__PURE__ */ g("div", { className: "slash-menu-empty", children: "No results" }) });
|
|
196
196
|
}
|
|
197
197
|
);
|
|
198
198
|
Wt.displayName = "SlashMenuList";
|
|
@@ -352,20 +352,20 @@ function ke(e, t, n) {
|
|
|
352
352
|
for (; c < o.length; ) {
|
|
353
353
|
const s = o.indexOf(i, c);
|
|
354
354
|
if (s === -1) break;
|
|
355
|
-
let l = 0, d = -1,
|
|
355
|
+
let l = 0, d = -1, m = -1;
|
|
356
356
|
e.descendants((u, f) => {
|
|
357
|
-
if (d !== -1 &&
|
|
357
|
+
if (d !== -1 && m !== -1) return !1;
|
|
358
358
|
if (u.isText) {
|
|
359
359
|
const p = u.text || "";
|
|
360
|
-
for (let
|
|
361
|
-
if (l === s && (d = f +
|
|
362
|
-
return
|
|
360
|
+
for (let y = 0; y < p.length; y++) {
|
|
361
|
+
if (l === s && (d = f + y), l === s + i.length)
|
|
362
|
+
return m = f + y, !1;
|
|
363
363
|
l++;
|
|
364
364
|
}
|
|
365
|
-
l === s + i.length &&
|
|
365
|
+
l === s + i.length && m === -1 && (m = f + p.length);
|
|
366
366
|
} else u.isBlock && l > 0 && (l === s && (d = f), l++);
|
|
367
367
|
return !0;
|
|
368
|
-
}), d !== -1 &&
|
|
368
|
+
}), d !== -1 && m !== -1 && r.push({ from: d, to: m }), c = s + 1;
|
|
369
369
|
}
|
|
370
370
|
return r;
|
|
371
371
|
}
|
|
@@ -473,8 +473,8 @@ function Gt(e, t, n) {
|
|
|
473
473
|
let a = "", i = !0;
|
|
474
474
|
return e.state.doc.nodesBetween(t, n, (o, c) => {
|
|
475
475
|
if (o.isText) {
|
|
476
|
-
const s = c, l = Math.max(t, s) - s, d = Math.min(n, s + o.nodeSize) - s,
|
|
477
|
-
r.push({ textIdx: a.length, docPos: s + l, len:
|
|
476
|
+
const s = c, l = Math.max(t, s) - s, d = Math.min(n, s + o.nodeSize) - s, m = o.text.slice(l, d);
|
|
477
|
+
r.push({ textIdx: a.length, docPos: s + l, len: m.length }), a += m, i = !1;
|
|
478
478
|
} else o.isLeaf ? (a += "\0", i = !1) : !i && o.isBlock && (a += "\0", i = !0);
|
|
479
479
|
}), { text: a, segments: r };
|
|
480
480
|
}
|
|
@@ -743,8 +743,11 @@ const ga = Z.create({
|
|
|
743
743
|
}
|
|
744
744
|
}), pa = Oe.create({
|
|
745
745
|
name: "patchDiff",
|
|
746
|
+
addOptions() {
|
|
747
|
+
return { editorId: "default" };
|
|
748
|
+
},
|
|
746
749
|
addProseMirrorPlugins() {
|
|
747
|
-
return [ma()];
|
|
750
|
+
return [ma(this.options.editorId)];
|
|
748
751
|
}
|
|
749
752
|
}), ha = [
|
|
750
753
|
An,
|
|
@@ -796,8 +799,7 @@ const ga = Z.create({
|
|
|
796
799
|
Yn.configure({
|
|
797
800
|
types: ["heading", "paragraph"],
|
|
798
801
|
defaultAlignment: "left"
|
|
799
|
-
})
|
|
800
|
-
pa
|
|
802
|
+
})
|
|
801
803
|
], ya = [
|
|
802
804
|
nr,
|
|
803
805
|
rr,
|
|
@@ -841,7 +843,7 @@ class va {
|
|
|
841
843
|
return !r || !r.isActive ? !1 : r.isActive(n);
|
|
842
844
|
}
|
|
843
845
|
async execute(t, n, r, a = {}) {
|
|
844
|
-
var d,
|
|
846
|
+
var d, m, u, f;
|
|
845
847
|
const i = Date.now(), o = a.transaction ?? !0, c = a.rollbackOnFail ?? !0, s = o ? n.editor.getJSON() : null, l = this.commands.get(t);
|
|
846
848
|
if (!l)
|
|
847
849
|
return console.warn(`Command "${t}" not found.`), (d = a.onComplete) == null || d.call(a, {
|
|
@@ -850,29 +852,29 @@ class va {
|
|
|
850
852
|
durationMs: Date.now() - i
|
|
851
853
|
}), !1;
|
|
852
854
|
if (!this.canExecute(t, n, r))
|
|
853
|
-
return (
|
|
855
|
+
return (m = a.onComplete) == null || m.call(a, {
|
|
854
856
|
name: t,
|
|
855
857
|
success: !1,
|
|
856
858
|
durationMs: Date.now() - i
|
|
857
859
|
}), !1;
|
|
858
860
|
try {
|
|
859
|
-
const
|
|
860
|
-
!
|
|
861
|
-
const
|
|
861
|
+
const y = !!await l.execute(n, r);
|
|
862
|
+
!y && s && c && n.editor.commands.setContent(s);
|
|
863
|
+
const b = {
|
|
862
864
|
name: t,
|
|
863
|
-
success:
|
|
865
|
+
success: y,
|
|
864
866
|
durationMs: Date.now() - i
|
|
865
867
|
};
|
|
866
|
-
return (u = a.onComplete) == null || u.call(a,
|
|
868
|
+
return (u = a.onComplete) == null || u.call(a, b), y;
|
|
867
869
|
} catch (p) {
|
|
868
870
|
s && c && n.editor.commands.setContent(s);
|
|
869
|
-
const
|
|
871
|
+
const y = {
|
|
870
872
|
name: t,
|
|
871
873
|
success: !1,
|
|
872
874
|
durationMs: Date.now() - i,
|
|
873
875
|
error: p
|
|
874
876
|
};
|
|
875
|
-
return (f = a.onComplete) == null || f.call(a,
|
|
877
|
+
return (f = a.onComplete) == null || f.call(a, y), !1;
|
|
876
878
|
}
|
|
877
879
|
}
|
|
878
880
|
getCommand(t) {
|
|
@@ -1251,84 +1253,84 @@ const Ie = () => {
|
|
|
1251
1253
|
l.className = "mermaid-edit";
|
|
1252
1254
|
const d = document.createElement("textarea");
|
|
1253
1255
|
d.className = "mermaid-editor-textarea", d.spellcheck = !1;
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1256
|
+
const m = document.createElement("div");
|
|
1257
|
+
m.className = "mermaid-edit-toolbar";
|
|
1256
1258
|
const u = document.createElement("span");
|
|
1257
1259
|
u.className = "mermaid-error-msg";
|
|
1258
1260
|
const f = document.createElement("button");
|
|
1259
1261
|
f.className = "mermaid-cancel-btn", f.type = "button";
|
|
1260
1262
|
const p = document.createElement("button");
|
|
1261
|
-
p.className = "mermaid-save-btn", p.type = "button",
|
|
1262
|
-
const
|
|
1263
|
+
p.className = "mermaid-save-btn", p.type = "button", m.append(u, f, p), l.append(d, m), i.append(o, l);
|
|
1264
|
+
const y = (T) => {
|
|
1263
1265
|
const N = typeof n == "function" ? n() : null;
|
|
1264
|
-
typeof N == "number" && e.commands.command(({ tr: A, dispatch: D }) => (A.setNodeMarkup(N, void 0, { ...r.attrs, ...
|
|
1266
|
+
typeof N == "number" && e.commands.command(({ tr: A, dispatch: D }) => (A.setNodeMarkup(N, void 0, { ...r.attrs, ...T }), D && D(A), !0));
|
|
1265
1267
|
};
|
|
1266
|
-
let
|
|
1267
|
-
const
|
|
1268
|
-
const N =
|
|
1269
|
-
if (N !==
|
|
1268
|
+
let b = "";
|
|
1269
|
+
const w = async (T) => {
|
|
1270
|
+
const N = T.trim();
|
|
1271
|
+
if (N !== b) {
|
|
1270
1272
|
if (!N) {
|
|
1271
|
-
c.innerHTML = "",
|
|
1273
|
+
c.innerHTML = "", b = "";
|
|
1272
1274
|
return;
|
|
1273
1275
|
}
|
|
1274
1276
|
try {
|
|
1275
1277
|
const A = await import("mermaid");
|
|
1276
1278
|
A.default.initialize({ startOnLoad: !1, theme: "default" }), _e += 1;
|
|
1277
1279
|
const D = `standalone-mermaid-${_e}`, { svg: z } = await A.default.render(D, N);
|
|
1278
|
-
c.innerHTML = z,
|
|
1280
|
+
c.innerHTML = z, b = N;
|
|
1279
1281
|
} catch {
|
|
1280
|
-
c.innerHTML = "",
|
|
1282
|
+
c.innerHTML = "", b = "";
|
|
1281
1283
|
} finally {
|
|
1282
1284
|
Ie();
|
|
1283
1285
|
}
|
|
1284
1286
|
}
|
|
1285
|
-
}, E = () => {
|
|
1286
|
-
a || (a = !0, d.value = typeof r.attrs.code == "string" ? r.attrs.code : "", u.textContent = "", u.style.display = "none", T(), requestAnimationFrame(() => d.focus()));
|
|
1287
1287
|
}, x = () => {
|
|
1288
|
-
a = !
|
|
1289
|
-
},
|
|
1290
|
-
|
|
1288
|
+
a || (a = !0, d.value = typeof r.attrs.code == "string" ? r.attrs.code : "", u.textContent = "", u.style.display = "none", E(), requestAnimationFrame(() => d.focus()));
|
|
1289
|
+
}, C = () => {
|
|
1290
|
+
a = !1, E();
|
|
1291
|
+
}, v = async () => {
|
|
1292
|
+
const T = d.value;
|
|
1291
1293
|
u.textContent = "", u.style.display = "none";
|
|
1292
|
-
const N =
|
|
1294
|
+
const N = T.trim();
|
|
1293
1295
|
if (N)
|
|
1294
1296
|
try {
|
|
1295
1297
|
const A = await import("mermaid");
|
|
1296
1298
|
A.default.initialize({ startOnLoad: !1, theme: "default" }), _e += 1;
|
|
1297
1299
|
const D = `standalone-mermaid-${_e}`, { svg: z } = await A.default.render(D, N);
|
|
1298
|
-
c.innerHTML = z,
|
|
1300
|
+
c.innerHTML = z, b = N, Ie();
|
|
1299
1301
|
} catch {
|
|
1300
1302
|
Ie();
|
|
1301
1303
|
const A = I.getState().editorLanguage;
|
|
1302
1304
|
u.textContent = A === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", u.style.display = "inline";
|
|
1303
1305
|
return;
|
|
1304
1306
|
}
|
|
1305
|
-
|
|
1307
|
+
y({ code: T }), a = !1, E();
|
|
1306
1308
|
};
|
|
1307
|
-
o.addEventListener("dblclick", (
|
|
1308
|
-
|
|
1309
|
-
}), p.addEventListener("click", (
|
|
1310
|
-
|
|
1311
|
-
}), f.addEventListener("click", (
|
|
1312
|
-
|
|
1313
|
-
}), d.addEventListener("mousedown", (
|
|
1314
|
-
const
|
|
1315
|
-
const
|
|
1309
|
+
o.addEventListener("dblclick", (T) => {
|
|
1310
|
+
T.preventDefault(), T.stopPropagation(), x();
|
|
1311
|
+
}), p.addEventListener("click", (T) => {
|
|
1312
|
+
T.stopPropagation(), v();
|
|
1313
|
+
}), f.addEventListener("click", (T) => {
|
|
1314
|
+
T.stopPropagation(), C();
|
|
1315
|
+
}), d.addEventListener("mousedown", (T) => T.stopPropagation()), d.addEventListener("keydown", (T) => T.stopPropagation()), d.addEventListener("keypress", (T) => T.stopPropagation());
|
|
1316
|
+
const E = () => {
|
|
1317
|
+
const T = I.getState().editorLanguage, N = H(T), A = typeof r.attrs.code == "string" ? r.attrs.code : "";
|
|
1316
1318
|
o.style.display = a ? "none" : "block", l.style.display = a ? "block" : "none", p.textContent = N.mermaidSaveAndRender || "保存并渲染", f.textContent = N.mermaidCancel || "取消";
|
|
1317
1319
|
const D = A.trim().length > 0, z = c.querySelector("svg") !== null;
|
|
1318
|
-
a || (D && z ? (s.textContent = N.mermaidDoubleClickToEdit || "双击编辑", s.className = "mermaid-view-hint mermaid-view-hint--subtle") : (s.textContent = N.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", s.className = "mermaid-view-hint mermaid-view-hint--empty")), !a && A.trim() !==
|
|
1320
|
+
a || (D && z ? (s.textContent = N.mermaidDoubleClickToEdit || "双击编辑", s.className = "mermaid-view-hint mermaid-view-hint--subtle") : (s.textContent = N.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", s.className = "mermaid-view-hint mermaid-view-hint--empty")), !a && A.trim() !== b && w(A);
|
|
1319
1321
|
};
|
|
1320
|
-
let
|
|
1321
|
-
const _ = I.subscribe((
|
|
1322
|
-
|
|
1322
|
+
let h = I.getState().editorLanguage;
|
|
1323
|
+
const _ = I.subscribe((T) => {
|
|
1324
|
+
T.editorLanguage !== h && (h = T.editorLanguage, E());
|
|
1323
1325
|
});
|
|
1324
|
-
return
|
|
1326
|
+
return E(), {
|
|
1325
1327
|
dom: i,
|
|
1326
|
-
stopEvent: (
|
|
1327
|
-
const N =
|
|
1328
|
+
stopEvent: (T) => {
|
|
1329
|
+
const N = T.target;
|
|
1328
1330
|
return !!(N === d || l.contains(N));
|
|
1329
1331
|
},
|
|
1330
1332
|
ignoreMutation: () => !0,
|
|
1331
|
-
update: (
|
|
1333
|
+
update: (T) => T.type.name !== "mermaid" ? !1 : (r = T, E(), !0),
|
|
1332
1334
|
destroy: () => {
|
|
1333
1335
|
_(), Ie();
|
|
1334
1336
|
}
|
|
@@ -1390,28 +1392,28 @@ const Ie = () => {
|
|
|
1390
1392
|
c.className = "drawio-preview-img", c.style.display = "none";
|
|
1391
1393
|
const s = document.createElement("div");
|
|
1392
1394
|
s.className = "drawio-view-hint", o.append(c, s), i.append(o);
|
|
1393
|
-
const l = (
|
|
1394
|
-
const
|
|
1395
|
-
typeof
|
|
1395
|
+
const l = (x) => {
|
|
1396
|
+
const C = typeof n == "function" ? n() : null;
|
|
1397
|
+
typeof C == "number" && e.commands.command(({ tr: v, dispatch: E }) => (v.setNodeMarkup(C, void 0, { ...r.attrs, ...x }), E && E(v), !0));
|
|
1396
1398
|
};
|
|
1397
|
-
let d = null,
|
|
1399
|
+
let d = null, m = null, u = null;
|
|
1398
1400
|
const f = () => {
|
|
1399
1401
|
if (a) return;
|
|
1400
|
-
a = !0,
|
|
1401
|
-
const E = document.createElement("div");
|
|
1402
|
-
E.className = "drawio-modal-content";
|
|
1402
|
+
a = !0, m = document.createElement("div"), m.className = "drawio-modal-overlay";
|
|
1403
1403
|
const x = document.createElement("div");
|
|
1404
|
-
x.className = "drawio-modal-
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
const v = document.createElement("
|
|
1408
|
-
|
|
1409
|
-
const
|
|
1404
|
+
x.className = "drawio-modal-content";
|
|
1405
|
+
const C = document.createElement("div");
|
|
1406
|
+
C.className = "drawio-modal-header";
|
|
1407
|
+
const v = I.getState().editorLanguage, E = document.createElement("span");
|
|
1408
|
+
E.textContent = v === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", E.className = "drawio-modal-title";
|
|
1409
|
+
const h = document.createElement("button");
|
|
1410
|
+
h.className = "drawio-modal-close-btn", h.textContent = "✕", h.type = "button", h.addEventListener("click", () => p()), C.append(E, h), u = document.createElement("iframe"), u.className = "drawio-modal-iframe", u.setAttribute("frameborder", "0"), x.append(C, u), m.appendChild(x), document.body.appendChild(m);
|
|
1411
|
+
const _ = v === "en" ? "en" : "zh";
|
|
1410
1412
|
u.src = `${Ve}/?embed=1&proto=json&spin=1&lang=${_}`;
|
|
1411
|
-
const
|
|
1413
|
+
const T = u;
|
|
1412
1414
|
d = (N) => {
|
|
1413
1415
|
var D, z;
|
|
1414
|
-
if (!
|
|
1416
|
+
if (!T || N.source !== T.contentWindow) return;
|
|
1415
1417
|
let A;
|
|
1416
1418
|
try {
|
|
1417
1419
|
A = typeof N.data == "string" ? JSON.parse(N.data) : N.data;
|
|
@@ -1420,13 +1422,13 @@ const Ie = () => {
|
|
|
1420
1422
|
}
|
|
1421
1423
|
if (A.event === "init") {
|
|
1422
1424
|
const Q = typeof r.attrs.xml == "string" ? r.attrs.xml : "";
|
|
1423
|
-
(D =
|
|
1425
|
+
(D = T.contentWindow) == null || D.postMessage(
|
|
1424
1426
|
JSON.stringify({ action: "load", autosave: 0, xml: Q || "" }),
|
|
1425
1427
|
Ve
|
|
1426
1428
|
);
|
|
1427
1429
|
} else if (A.event === "save") {
|
|
1428
1430
|
const Q = A.xml || "";
|
|
1429
|
-
(z =
|
|
1431
|
+
(z = T.contentWindow) == null || z.postMessage(
|
|
1430
1432
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1431
1433
|
Ve
|
|
1432
1434
|
), l({ xml: Q });
|
|
@@ -1436,25 +1438,25 @@ const Ie = () => {
|
|
|
1436
1438
|
} else A.event === "exit" && p();
|
|
1437
1439
|
}, window.addEventListener("message", d);
|
|
1438
1440
|
}, p = () => {
|
|
1439
|
-
a = !1, d && (window.removeEventListener("message", d), d = null), u && (u.src = "about:blank", u = null),
|
|
1441
|
+
a = !1, d && (window.removeEventListener("message", d), d = null), u && (u.src = "about:blank", u = null), m && (m.remove(), m = null), y();
|
|
1440
1442
|
};
|
|
1441
|
-
o.addEventListener("dblclick", (
|
|
1442
|
-
|
|
1443
|
+
o.addEventListener("dblclick", (x) => {
|
|
1444
|
+
x.preventDefault(), x.stopPropagation(), f();
|
|
1443
1445
|
});
|
|
1444
|
-
const
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1446
|
+
const y = () => {
|
|
1447
|
+
const x = I.getState().editorLanguage, C = H(x), v = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
|
|
1448
|
+
v ? (c.src = v, c.style.display = "block") : (c.src = "", c.style.display = "none"), v ? (s.textContent = C.mermaidDoubleClickToEdit || "双击编辑", s.className = "drawio-view-hint drawio-view-hint--subtle") : (s.textContent = C.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", s.className = "drawio-view-hint drawio-view-hint--empty");
|
|
1447
1449
|
};
|
|
1448
|
-
let
|
|
1449
|
-
const
|
|
1450
|
-
|
|
1450
|
+
let b = I.getState().editorLanguage;
|
|
1451
|
+
const w = I.subscribe((x) => {
|
|
1452
|
+
x.editorLanguage !== b && (b = x.editorLanguage, y());
|
|
1451
1453
|
});
|
|
1452
|
-
return
|
|
1454
|
+
return y(), {
|
|
1453
1455
|
dom: i,
|
|
1454
1456
|
ignoreMutation: () => !0,
|
|
1455
|
-
update: (
|
|
1457
|
+
update: (x) => x.type.name !== "drawio" ? !1 : (r = x, y(), !0),
|
|
1456
1458
|
destroy: () => {
|
|
1457
|
-
|
|
1459
|
+
w(), d && (window.removeEventListener("message", d), d = null), u && (u.src = "about:blank", u = null), m && (m.remove(), m = null);
|
|
1458
1460
|
}
|
|
1459
1461
|
};
|
|
1460
1462
|
};
|
|
@@ -1499,41 +1501,41 @@ const Ie = () => {
|
|
|
1499
1501
|
}, [t]), M(() => {
|
|
1500
1502
|
d.current = e.attrs.latex ?? "";
|
|
1501
1503
|
}, [e.attrs.latex]);
|
|
1502
|
-
const
|
|
1504
|
+
const m = ae(() => {
|
|
1503
1505
|
s.current || (s.current = !0, o(!0));
|
|
1504
1506
|
}, []), u = ae(() => {
|
|
1505
|
-
var
|
|
1507
|
+
var y, b;
|
|
1506
1508
|
if (!s.current) return;
|
|
1507
1509
|
s.current = !1;
|
|
1508
|
-
const p = ((
|
|
1509
|
-
l.current({ latex: p }), o(!1), (
|
|
1510
|
+
const p = ((y = a.current) == null ? void 0 : y.value) ?? d.current;
|
|
1511
|
+
l.current({ latex: p }), o(!1), (b = globalThis.mathVirtualKeyboard) == null || b.hide({ animate: !0 });
|
|
1510
1512
|
}, []);
|
|
1511
1513
|
M(() => {
|
|
1512
|
-
var
|
|
1513
|
-
const p = !!((
|
|
1514
|
-
n && p &&
|
|
1515
|
-
}, [n,
|
|
1514
|
+
var y, b, w;
|
|
1515
|
+
const p = !!((w = (b = (y = r == null ? void 0 : r.view) == null ? void 0 : y.state) == null ? void 0 : b.selection) != null && w.empty);
|
|
1516
|
+
n && p && m();
|
|
1517
|
+
}, [n, m]), M(() => {
|
|
1516
1518
|
i && requestAnimationFrame(() => {
|
|
1517
|
-
var
|
|
1519
|
+
var y;
|
|
1518
1520
|
const p = a.current;
|
|
1519
|
-
p && (p.virtualKeyboardMode = "onfocus", (
|
|
1521
|
+
p && (p.virtualKeyboardMode = "onfocus", (y = p.focus) == null || y.call(p));
|
|
1520
1522
|
});
|
|
1521
1523
|
}, [i]), M(() => {
|
|
1522
1524
|
if (!i) return;
|
|
1523
1525
|
const p = a.current;
|
|
1524
1526
|
if (!p) return;
|
|
1525
|
-
const
|
|
1527
|
+
const y = () => {
|
|
1526
1528
|
setTimeout(() => {
|
|
1527
|
-
var
|
|
1529
|
+
var x, C, v;
|
|
1528
1530
|
if (!s.current) return;
|
|
1529
|
-
const
|
|
1530
|
-
(
|
|
1531
|
+
const w = document.activeElement;
|
|
1532
|
+
(w == null ? void 0 : w.tagName) === "MATH-FIELD" || (x = w == null ? void 0 : w.closest) != null && x.call(w, "math-field") || (C = w == null ? void 0 : w.closest) != null && C.call(w, ".ML__keyboard") || (v = document.querySelector(".ML__keyboard")) != null && v.contains(w) || u();
|
|
1531
1533
|
}, 300);
|
|
1532
|
-
},
|
|
1533
|
-
|
|
1534
|
+
}, b = (w) => {
|
|
1535
|
+
w.key === "Escape" && u();
|
|
1534
1536
|
};
|
|
1535
|
-
return p.addEventListener("focusout",
|
|
1536
|
-
p.removeEventListener("focusout",
|
|
1537
|
+
return p.addEventListener("focusout", y), p.addEventListener("keydown", b), () => {
|
|
1538
|
+
p.removeEventListener("focusout", y), p.removeEventListener("keydown", b);
|
|
1537
1539
|
};
|
|
1538
1540
|
}, [i, u]), M(() => {
|
|
1539
1541
|
!i && a.current && a.current.value !== e.attrs.latex && (a.current.value = e.attrs.latex ?? "");
|
|
@@ -1547,21 +1549,21 @@ const Ie = () => {
|
|
|
1547
1549
|
} catch {
|
|
1548
1550
|
f = e.attrs.latex || "";
|
|
1549
1551
|
}
|
|
1550
|
-
return /* @__PURE__ */
|
|
1552
|
+
return /* @__PURE__ */ g(
|
|
1551
1553
|
_n,
|
|
1552
1554
|
{
|
|
1553
1555
|
as: c ? "div" : "span",
|
|
1554
1556
|
className: c ? "math-block" : "math-inline",
|
|
1555
|
-
children: i ? /* @__PURE__ */
|
|
1557
|
+
children: i ? /* @__PURE__ */ g(
|
|
1556
1558
|
"math-field",
|
|
1557
1559
|
{
|
|
1558
1560
|
ref: a,
|
|
1559
1561
|
className: c ? "math-live-field math-live-field--block" : "math-live-field",
|
|
1560
1562
|
children: e.attrs.latex
|
|
1561
1563
|
}
|
|
1562
|
-
) : /* @__PURE__ */ L("span", { className: "math-preview", onClick:
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1564
|
+
) : /* @__PURE__ */ L("span", { className: "math-preview", onClick: m, children: [
|
|
1565
|
+
/* @__PURE__ */ g("span", { dangerouslySetInnerHTML: { __html: f } }),
|
|
1566
|
+
/* @__PURE__ */ g("span", { className: "math-tooltip", children: "点击编辑" })
|
|
1565
1567
|
] })
|
|
1566
1568
|
}
|
|
1567
1569
|
);
|
|
@@ -1839,34 +1841,34 @@ const Le = () => {
|
|
|
1839
1841
|
l.className = "figure-upload-area";
|
|
1840
1842
|
const d = document.createElement("span");
|
|
1841
1843
|
d.className = "figure-upload-hint";
|
|
1842
|
-
const
|
|
1843
|
-
|
|
1844
|
+
const m = document.createElement("input");
|
|
1845
|
+
m.type = "file", m.accept = "image/*", m.style.display = "none";
|
|
1844
1846
|
const u = document.createElement("button");
|
|
1845
|
-
u.className = "figure-replace-btn", l.append(d,
|
|
1847
|
+
u.className = "figure-replace-btn", l.append(d, m);
|
|
1846
1848
|
const f = document.createElement("div");
|
|
1847
1849
|
f.className = "figure-mermaid-view", f.contentEditable = "false", f.setAttribute("spellcheck", "false");
|
|
1848
1850
|
const p = document.createElement("div");
|
|
1849
1851
|
p.className = "figure-mermaid-preview", p.contentEditable = "false";
|
|
1852
|
+
const y = document.createElement("div");
|
|
1853
|
+
y.className = "figure-mermaid-view-hint", f.append(p, y);
|
|
1850
1854
|
const b = document.createElement("div");
|
|
1851
|
-
b.className = "figure-mermaid-
|
|
1855
|
+
b.className = "figure-mermaid-edit";
|
|
1856
|
+
const w = document.createElement("textarea");
|
|
1857
|
+
w.className = "figure-mermaid-editor", w.spellcheck = !1;
|
|
1858
|
+
const x = document.createElement("div");
|
|
1859
|
+
x.className = "figure-mermaid-toolbar";
|
|
1860
|
+
const C = document.createElement("button");
|
|
1861
|
+
C.className = "figure-mermaid-save-btn", C.type = "button";
|
|
1862
|
+
const v = document.createElement("button");
|
|
1863
|
+
v.className = "figure-mermaid-cancel-btn", v.type = "button";
|
|
1864
|
+
const E = document.createElement("span");
|
|
1865
|
+
E.className = "figure-mermaid-error-inline", x.append(E, v, C), b.append(w, x);
|
|
1852
1866
|
const h = document.createElement("div");
|
|
1853
|
-
h.className = "figure-
|
|
1854
|
-
const y = document.createElement("textarea");
|
|
1855
|
-
y.className = "figure-mermaid-editor", y.spellcheck = !1;
|
|
1856
|
-
const E = document.createElement("div");
|
|
1857
|
-
E.className = "figure-mermaid-toolbar";
|
|
1858
|
-
const x = document.createElement("button");
|
|
1859
|
-
x.className = "figure-mermaid-save-btn", x.type = "button";
|
|
1860
|
-
const w = document.createElement("button");
|
|
1861
|
-
w.className = "figure-mermaid-cancel-btn", w.type = "button";
|
|
1862
|
-
const T = document.createElement("span");
|
|
1863
|
-
T.className = "figure-mermaid-error-inline", E.append(T, w, x), h.append(y, E);
|
|
1864
|
-
const v = document.createElement("div");
|
|
1865
|
-
v.className = "figure-drawio-view", v.contentEditable = "false";
|
|
1867
|
+
h.className = "figure-drawio-view", h.contentEditable = "false";
|
|
1866
1868
|
const _ = document.createElement("img");
|
|
1867
1869
|
_.className = "figure-drawio-preview-img", _.style.display = "none";
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1870
|
+
const T = document.createElement("div");
|
|
1871
|
+
T.className = "figure-drawio-view-hint", h.append(_, T), c.append(s, l, u), c.append(f, b), c.append(h);
|
|
1870
1872
|
const N = document.createElement("figcaption");
|
|
1871
1873
|
N.className = "figure-caption";
|
|
1872
1874
|
const A = document.createElement("span");
|
|
@@ -1885,8 +1887,8 @@ const Le = () => {
|
|
|
1885
1887
|
typeof P.result == "string" && z({ imageSrc: P.result });
|
|
1886
1888
|
}, P.readAsDataURL(k);
|
|
1887
1889
|
};
|
|
1888
|
-
|
|
1889
|
-
S.stopPropagation(),
|
|
1890
|
+
m.addEventListener("change", () => Q(m.files)), l.addEventListener("click", () => m.click()), u.addEventListener("click", (S) => {
|
|
1891
|
+
S.stopPropagation(), m.click();
|
|
1890
1892
|
}), c.addEventListener("dragover", (S) => {
|
|
1891
1893
|
r.attrs.contentType === "image" && (S.preventDefault(), S.stopPropagation(), l.classList.add("figure-upload-area--dragover"));
|
|
1892
1894
|
}), c.addEventListener("dragleave", () => {
|
|
@@ -1896,12 +1898,12 @@ const Le = () => {
|
|
|
1896
1898
|
l.classList.remove("figure-upload-area--dragover"), r.attrs.contentType === "image" && (S.preventDefault(), S.stopPropagation(), Q(((k = S.dataTransfer) == null ? void 0 : k.files) ?? null));
|
|
1897
1899
|
});
|
|
1898
1900
|
const gn = () => {
|
|
1899
|
-
a || (a = !0,
|
|
1901
|
+
a || (a = !0, w.value = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "", E.textContent = "", E.style.display = "none", J(), requestAnimationFrame(() => w.focus()));
|
|
1900
1902
|
}, fn = () => {
|
|
1901
1903
|
a = !1, J();
|
|
1902
1904
|
}, pn = async () => {
|
|
1903
|
-
const S =
|
|
1904
|
-
|
|
1905
|
+
const S = w.value;
|
|
1906
|
+
E.textContent = "", E.style.display = "none";
|
|
1905
1907
|
const k = S.trim();
|
|
1906
1908
|
if (k)
|
|
1907
1909
|
try {
|
|
@@ -1912,18 +1914,18 @@ const Le = () => {
|
|
|
1912
1914
|
} catch {
|
|
1913
1915
|
Le();
|
|
1914
1916
|
const P = I.getState().editorLanguage;
|
|
1915
|
-
|
|
1917
|
+
E.textContent = P === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", E.style.display = "inline";
|
|
1916
1918
|
return;
|
|
1917
1919
|
}
|
|
1918
1920
|
z({ mermaidCode: S }), a = !1, J();
|
|
1919
1921
|
};
|
|
1920
1922
|
f.addEventListener("dblclick", (S) => {
|
|
1921
1923
|
S.preventDefault(), S.stopPropagation(), gn();
|
|
1922
|
-
}),
|
|
1924
|
+
}), C.addEventListener("click", (S) => {
|
|
1923
1925
|
S.stopPropagation(), pn();
|
|
1924
|
-
}),
|
|
1926
|
+
}), v.addEventListener("click", (S) => {
|
|
1925
1927
|
S.stopPropagation(), fn();
|
|
1926
|
-
}),
|
|
1928
|
+
}), w.addEventListener("mousedown", (S) => S.stopPropagation()), w.addEventListener("keydown", (S) => S.stopPropagation()), w.addEventListener("keypress", (S) => S.stopPropagation());
|
|
1927
1929
|
let ee = null, G = null, q = null;
|
|
1928
1930
|
const hn = () => {
|
|
1929
1931
|
if (i) return;
|
|
@@ -1968,11 +1970,11 @@ const Le = () => {
|
|
|
1968
1970
|
}, We = () => {
|
|
1969
1971
|
i = !1, ee && (window.removeEventListener("message", ee), ee = null), q && (q.src = "about:blank", q = null), G && (G.remove(), G = null), J();
|
|
1970
1972
|
};
|
|
1971
|
-
|
|
1973
|
+
h.addEventListener("dblclick", (S) => {
|
|
1972
1974
|
S.preventDefault(), S.stopPropagation(), hn();
|
|
1973
1975
|
}), o.addEventListener("mousedown", (S) => {
|
|
1974
1976
|
const k = S.target;
|
|
1975
|
-
if (!(k instanceof HTMLElement) || k === D || D.contains(k) || k ===
|
|
1977
|
+
if (!(k instanceof HTMLElement) || k === D || D.contains(k) || k === w || b.contains(k) || k === l || l.contains(k) || k === u || k === m || f.contains(k) || h.contains(k)) return;
|
|
1976
1978
|
const P = typeof n == "function" ? n() : null;
|
|
1977
1979
|
if (typeof P != "number") return;
|
|
1978
1980
|
const O = P + r.nodeSize - 1, R = Zn.create(e.state.doc, O);
|
|
@@ -2003,11 +2005,11 @@ const Le = () => {
|
|
|
2003
2005
|
const S = I.getState().editorLanguage, k = H(S), P = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", O = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", R = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "", fe = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "";
|
|
2004
2006
|
O ? (A.textContent = `[${O}] `, A.style.display = "inline") : (A.textContent = "", A.style.display = "none");
|
|
2005
2007
|
const K = P === "image", X = P === "mermaid", U = P === "drawio";
|
|
2006
|
-
s.style.display = K && R ? "block" : "none", l.style.display = K && !R ? "flex" : "none", u.style.display = K && R ? "block" : "none", f.style.display = X && !a ? "block" : "none",
|
|
2008
|
+
s.style.display = K && R ? "block" : "none", l.style.display = K && !R ? "flex" : "none", u.style.display = K && R ? "block" : "none", f.style.display = X && !a ? "block" : "none", b.style.display = X && a ? "block" : "none", h.style.display = U ? "flex" : "none", K && R && (s.src = R);
|
|
2007
2009
|
const oe = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
|
|
2008
|
-
U && (oe ? (_.src = oe, _.style.display = "block") : (_.src = "", _.style.display = "none")), d.textContent = k.figureUploadHint || "点击上传或拖拽图片", u.textContent = k.figureReplaceImage || "更换图片",
|
|
2010
|
+
U && (oe ? (_.src = oe, _.style.display = "block") : (_.src = "", _.style.display = "none")), d.textContent = k.figureUploadHint || "点击上传或拖拽图片", u.textContent = k.figureReplaceImage || "更换图片", C.textContent = k.mermaidSaveAndRender || "保存并渲染", v.textContent = k.mermaidCancel || "取消";
|
|
2009
2011
|
const Te = fe.trim().length > 0, ce = p.querySelector("svg") !== null;
|
|
2010
|
-
X && !a && (Te && ce ? (
|
|
2012
|
+
X && !a && (Te && ce ? (y.textContent = k.mermaidDoubleClickToEdit || "双击编辑", y.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (y.textContent = k.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", y.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), U && !i && (oe ? (T.textContent = k.mermaidDoubleClickToEdit || "双击编辑", T.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (T.textContent = k.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", T.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), X && !a && fe.trim() !== ge && wn(fe);
|
|
2011
2013
|
const Cn = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
|
|
2012
2014
|
U && Cn && !oe && !xe && !i && (se && clearTimeout(se), se = setTimeout(() => {
|
|
2013
2015
|
se = null;
|
|
@@ -2028,7 +2030,7 @@ const Le = () => {
|
|
|
2028
2030
|
contentDOM: D,
|
|
2029
2031
|
stopEvent: (S) => {
|
|
2030
2032
|
const k = S.target;
|
|
2031
|
-
return !!(k ===
|
|
2033
|
+
return !!(k === w || b.contains(k) || k === m);
|
|
2032
2034
|
},
|
|
2033
2035
|
ignoreMutation: (S) => {
|
|
2034
2036
|
const k = S.target;
|
|
@@ -2102,8 +2104,8 @@ const Le = () => {
|
|
|
2102
2104
|
return ({ node: e, editor: t }) => {
|
|
2103
2105
|
let n = e;
|
|
2104
2106
|
const r = document.createElement("span"), a = () => {
|
|
2105
|
-
const i = n.attrs.lang === "en" ? "en" : "zh", o = H(i), c = n.attrs.targetType === "figure" ? "figure" : "claim", s = Number(n.attrs.resolvedNumber), l = typeof n.attrs.resolvedFigureId == "string" && n.attrs.resolvedFigureId ? n.attrs.resolvedFigureId : null, d = c === "figure" ? l || (i === "en" ? "Figure ?" : "附图?") : Number.isFinite(s) ? o.claimLabel(s) : i === "en" ? "Claim ?" : "权利要求?",
|
|
2106
|
-
r.textContent =
|
|
2107
|
+
const i = n.attrs.lang === "en" ? "en" : "zh", o = H(i), c = n.attrs.targetType === "figure" ? "figure" : "claim", s = Number(n.attrs.resolvedNumber), l = typeof n.attrs.resolvedFigureId == "string" && n.attrs.resolvedFigureId ? n.attrs.resolvedFigureId : null, d = c === "figure" ? l || (i === "en" ? "Figure ?" : "附图?") : Number.isFinite(s) ? o.claimLabel(s) : i === "en" ? "Claim ?" : "权利要求?", m = n.attrs.displayText || d;
|
|
2108
|
+
r.textContent = m, r.className = `reference-link${n.attrs.invalid ? " reference-link-invalid" : ""}`, r.setAttribute("data-type", "reference"), r.setAttribute("data-highlight", n.attrs.highlight ? "true" : "false"), r.title = n.attrs.invalid ? o.referenceNavigateDisabledTitle : c === "figure" ? o.figureReferenceNavigateTitle : o.referenceNavigateTitle;
|
|
2107
2109
|
};
|
|
2108
2110
|
return a(), r.addEventListener("click", () => {
|
|
2109
2111
|
const i = n.attrs.targetType === "figure" ? "figure" : "claim";
|
|
@@ -2200,31 +2202,31 @@ const Le = () => {
|
|
|
2200
2202
|
const c = document.createElement("h1");
|
|
2201
2203
|
c.className = "pt-title-content", a.append(i, o, c);
|
|
2202
2204
|
const s = () => {
|
|
2203
|
-
const
|
|
2204
|
-
return typeof
|
|
2205
|
+
const y = typeof n == "function" ? n() : null;
|
|
2206
|
+
return typeof y == "number" ? y : null;
|
|
2205
2207
|
}, l = () => {
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2208
|
+
const y = s();
|
|
2209
|
+
y !== null && I.getState().setActiveSection("patent_title", y);
|
|
2208
2210
|
}, d = () => {
|
|
2209
|
-
const
|
|
2210
|
-
|
|
2211
|
+
const y = s();
|
|
2212
|
+
y !== null && (I.getState().openDraftingPanel("patent_title", y), e.commands.focus(y + 1));
|
|
2211
2213
|
};
|
|
2212
2214
|
o.addEventListener("click", d), c.addEventListener("focusin", l), c.addEventListener("click", l);
|
|
2213
|
-
const
|
|
2214
|
-
const
|
|
2215
|
-
i.textContent =
|
|
2216
|
-
const
|
|
2217
|
-
o.textContent = `[${
|
|
2215
|
+
const m = () => {
|
|
2216
|
+
const y = I.getState(), b = H(y.editorLanguage), w = typeof b.bookTitle_description == "string" ? b.bookTitle_description : "说明书", x = typeof b.patentTitlePlaceholder == "string" ? b.patentTitlePlaceholder : "专利名称";
|
|
2217
|
+
i.textContent = w;
|
|
2218
|
+
const C = ot(r), v = y.rightPanel.activeSectionPos === s();
|
|
2219
|
+
o.textContent = `[${x}]`, o.style.display = C ? "none" : "", o.classList.toggle("ps-placeholder--active", v && !C), c.classList.toggle("pt-title-content--has-content", C);
|
|
2218
2220
|
};
|
|
2219
2221
|
let u = I.getState().editorLanguage, f = I.getState().rightPanel.activeSectionPos;
|
|
2220
|
-
const p = I.subscribe((
|
|
2221
|
-
const
|
|
2222
|
-
u =
|
|
2222
|
+
const p = I.subscribe((y) => {
|
|
2223
|
+
const b = y.editorLanguage !== u, w = y.rightPanel.activeSectionPos !== f;
|
|
2224
|
+
u = y.editorLanguage, f = y.rightPanel.activeSectionPos, (b || w) && m();
|
|
2223
2225
|
});
|
|
2224
|
-
return
|
|
2226
|
+
return m(), {
|
|
2225
2227
|
dom: a,
|
|
2226
2228
|
contentDOM: c,
|
|
2227
|
-
update: (
|
|
2229
|
+
update: (y) => y.type.name !== "patent_title" ? !1 : (r = y, m(), !0),
|
|
2228
2230
|
destroy: () => {
|
|
2229
2231
|
p(), o.removeEventListener("click", d), c.removeEventListener("focusin", l), c.removeEventListener("click", l);
|
|
2230
2232
|
}
|
|
@@ -2303,33 +2305,33 @@ const Le = () => {
|
|
|
2303
2305
|
const s = document.createElement("div");
|
|
2304
2306
|
s.className = "ps-content", o.append(c, s), a.append(i, o);
|
|
2305
2307
|
const l = () => {
|
|
2306
|
-
const
|
|
2307
|
-
return typeof
|
|
2308
|
+
const b = typeof n == "function" ? n() : null;
|
|
2309
|
+
return typeof b == "number" ? b : null;
|
|
2308
2310
|
}, d = () => {
|
|
2309
|
-
const
|
|
2310
|
-
if (
|
|
2311
|
-
I.getState().setActiveSection(r.attrs.sectionType,
|
|
2312
|
-
},
|
|
2313
|
-
const
|
|
2314
|
-
if (
|
|
2315
|
-
I.getState().openDraftingPanel(r.attrs.sectionType,
|
|
2311
|
+
const b = l();
|
|
2312
|
+
if (b === null) return;
|
|
2313
|
+
I.getState().setActiveSection(r.attrs.sectionType, b);
|
|
2314
|
+
}, m = () => {
|
|
2315
|
+
const b = l();
|
|
2316
|
+
if (b === null) return;
|
|
2317
|
+
I.getState().openDraftingPanel(r.attrs.sectionType, b), e.commands.focus(b + 1);
|
|
2316
2318
|
};
|
|
2317
|
-
c.addEventListener("click",
|
|
2319
|
+
c.addEventListener("click", m), s.addEventListener("focusin", d), s.addEventListener("click", d);
|
|
2318
2320
|
const u = () => {
|
|
2319
|
-
const
|
|
2320
|
-
a.className = `ps${_ ? "" : " ps--empty"}${
|
|
2321
|
+
const b = I.getState(), w = H(b.editorLanguage), x = Object.keys(wt).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", C = Fa.has(x), v = $a.has(x), E = wt[x], h = typeof w[E] == "string" ? w[E] : x, _ = ot(r), T = b.rightPanel.activeSectionPos === l();
|
|
2322
|
+
a.className = `ps${_ ? "" : " ps--empty"}${v ? " ps--sub" : ""}`, a.setAttribute("data-section-type", x), i.className = C ? "pb-heading" : "ps-heading ps-heading--sub", i.textContent = h, c.textContent = `[${h}]`, c.style.display = _ ? "none" : "", c.classList.toggle("ps-placeholder--active", T && !_), s.classList.toggle("ps-content--has-content", _);
|
|
2321
2323
|
};
|
|
2322
2324
|
let f = I.getState().editorLanguage, p = I.getState().rightPanel.activeSectionPos;
|
|
2323
|
-
const
|
|
2324
|
-
const
|
|
2325
|
-
f =
|
|
2325
|
+
const y = I.subscribe((b) => {
|
|
2326
|
+
const w = b.editorLanguage !== f, x = b.rightPanel.activeSectionPos !== p;
|
|
2327
|
+
f = b.editorLanguage, p = b.rightPanel.activeSectionPos, (w || x) && u();
|
|
2326
2328
|
});
|
|
2327
2329
|
return u(), {
|
|
2328
2330
|
dom: a,
|
|
2329
2331
|
contentDOM: s,
|
|
2330
|
-
update: (
|
|
2332
|
+
update: (b) => b.type.name !== "patent_section" ? !1 : (r = b, u(), !0),
|
|
2331
2333
|
destroy: () => {
|
|
2332
|
-
|
|
2334
|
+
y(), c.removeEventListener("click", m), s.removeEventListener("focusin", d), s.removeEventListener("click", d);
|
|
2333
2335
|
}
|
|
2334
2336
|
};
|
|
2335
2337
|
};
|
|
@@ -2423,18 +2425,18 @@ const Le = () => {
|
|
|
2423
2425
|
return a.doc.descendants((c, s) => {
|
|
2424
2426
|
if (c.type.name !== "reference" || c.attrs.targetType !== "figure")
|
|
2425
2427
|
return !0;
|
|
2426
|
-
const l = typeof c.attrs.targetFigureId == "string" && c.attrs.targetFigureId ? V(c.attrs.targetFigureId) : null, d = l ? t.get(l) : void 0,
|
|
2428
|
+
const l = typeof c.attrs.targetFigureId == "string" && c.attrs.targetFigureId ? V(c.attrs.targetFigureId) : null, d = l ? t.get(l) : void 0, m = d ? d.id : null, u = !d, f = an(n, m, u), p = {
|
|
2427
2429
|
...c.attrs,
|
|
2428
2430
|
targetType: "figure",
|
|
2429
2431
|
targetFigureId: l,
|
|
2430
|
-
resolvedFigureId:
|
|
2432
|
+
resolvedFigureId: m,
|
|
2431
2433
|
invalid: u,
|
|
2432
2434
|
lang: n,
|
|
2433
2435
|
displayText: f,
|
|
2434
|
-
target:
|
|
2436
|
+
target: m || c.attrs.target || l || null
|
|
2435
2437
|
};
|
|
2436
2438
|
return Object.keys(p).some(
|
|
2437
|
-
(
|
|
2439
|
+
(b) => p[b] !== c.attrs[b]
|
|
2438
2440
|
) && (r.setNodeMarkup(s, void 0, p), o = !0), !0;
|
|
2439
2441
|
}), o && i && i(r), !0;
|
|
2440
2442
|
});
|
|
@@ -2467,8 +2469,8 @@ const Le = () => {
|
|
|
2467
2469
|
const i = (n.scope || "all") === "current" ? Re(e, "reference") : null;
|
|
2468
2470
|
return e.commands.command(({ tr: c, state: s, dispatch: l }) => {
|
|
2469
2471
|
let d = !1;
|
|
2470
|
-
return s.doc.descendants((
|
|
2471
|
-
...
|
|
2472
|
+
return s.doc.descendants((m, u) => (m.type.name !== "reference" || i && u !== i.pos || m.attrs.lang !== r && (c.setNodeMarkup(u, void 0, {
|
|
2473
|
+
...m.attrs,
|
|
2472
2474
|
lang: r
|
|
2473
2475
|
}), d = !0), !0)), d && l && l(c), !0;
|
|
2474
2476
|
}) ? (Je(e), !0) : !1;
|
|
@@ -2644,16 +2646,16 @@ const Xa = (e = {}) => {
|
|
|
2644
2646
|
return M(() => {
|
|
2645
2647
|
if (!n) return;
|
|
2646
2648
|
s();
|
|
2647
|
-
const l = (
|
|
2649
|
+
const l = (m) => {
|
|
2648
2650
|
var f, p;
|
|
2649
|
-
const u =
|
|
2651
|
+
const u = m.target;
|
|
2650
2652
|
(f = a.current) != null && f.contains(u) || (p = i.current) != null && p.contains(u) || r(!1);
|
|
2651
2653
|
}, d = () => s();
|
|
2652
2654
|
return document.addEventListener("mousedown", l), window.addEventListener("scroll", d, !0), () => {
|
|
2653
2655
|
document.removeEventListener("mousedown", l), window.removeEventListener("scroll", d, !0);
|
|
2654
2656
|
};
|
|
2655
2657
|
}, [n, s]), /* @__PURE__ */ L("div", { className: "flex items-center", children: [
|
|
2656
|
-
/* @__PURE__ */
|
|
2658
|
+
/* @__PURE__ */ g(
|
|
2657
2659
|
"button",
|
|
2658
2660
|
{
|
|
2659
2661
|
onClick: e.run,
|
|
@@ -2664,10 +2666,10 @@ const Xa = (e = {}) => {
|
|
|
2664
2666
|
e.isActive ? "bg-gray-300 text-blue-600" : "text-gray-700"
|
|
2665
2667
|
),
|
|
2666
2668
|
title: e.tooltip,
|
|
2667
|
-
children: /* @__PURE__ */
|
|
2669
|
+
children: /* @__PURE__ */ g(e.icon, { size: 18 })
|
|
2668
2670
|
}
|
|
2669
2671
|
),
|
|
2670
|
-
/* @__PURE__ */
|
|
2672
|
+
/* @__PURE__ */ g(
|
|
2671
2673
|
"button",
|
|
2672
2674
|
{
|
|
2673
2675
|
ref: a,
|
|
@@ -2677,17 +2679,17 @@ const Xa = (e = {}) => {
|
|
|
2677
2679
|
e.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200 text-gray-500"
|
|
2678
2680
|
),
|
|
2679
2681
|
disabled: e.disabled,
|
|
2680
|
-
children: /* @__PURE__ */
|
|
2682
|
+
children: /* @__PURE__ */ g(Ut, { size: 12 })
|
|
2681
2683
|
}
|
|
2682
2684
|
),
|
|
2683
2685
|
n && yr(
|
|
2684
|
-
/* @__PURE__ */
|
|
2686
|
+
/* @__PURE__ */ g(
|
|
2685
2687
|
"div",
|
|
2686
2688
|
{
|
|
2687
2689
|
ref: i,
|
|
2688
2690
|
className: "bg-white border border-gray-200 rounded shadow-lg min-w-[160px] py-1",
|
|
2689
2691
|
style: { position: "fixed", top: o.top, left: o.left, zIndex: 9999 },
|
|
2690
|
-
children: t.map((l, d) => /* @__PURE__ */
|
|
2692
|
+
children: t.map((l, d) => /* @__PURE__ */ g(
|
|
2691
2693
|
"button",
|
|
2692
2694
|
{
|
|
2693
2695
|
onClick: () => {
|
|
@@ -2712,7 +2714,7 @@ const Xa = (e = {}) => {
|
|
|
2712
2714
|
const [a, i] = $(() => new Set(r)), { editorLanguage: o, setEditorLanguage: c } = I(), s = H(o);
|
|
2713
2715
|
if (!e)
|
|
2714
2716
|
return null;
|
|
2715
|
-
const l = ct(e), d = o === "zh",
|
|
2717
|
+
const l = ct(e), d = o === "zh", m = [
|
|
2716
2718
|
{
|
|
2717
2719
|
id: "core-undo",
|
|
2718
2720
|
label: s.undo,
|
|
@@ -3010,29 +3012,29 @@ const Xa = (e = {}) => {
|
|
|
3010
3012
|
FileText: qt,
|
|
3011
3013
|
Link2: Ht,
|
|
3012
3014
|
Image: Bt
|
|
3013
|
-
}, f = B.getToolbarItems().map((
|
|
3014
|
-
const _ = B.getCommandMeta(
|
|
3015
|
+
}, f = B.getToolbarItems().map((h) => {
|
|
3016
|
+
const _ = B.getCommandMeta(h.command), T = d && h.tooltipZh ? h.tooltipZh : h.tooltip || (_ == null ? void 0 : _.description) || h.label, N = h.shortcut || (_ == null ? void 0 : _.shortcut), A = N ? `${T} (${N})` : T;
|
|
3015
3017
|
return {
|
|
3016
|
-
id:
|
|
3017
|
-
label:
|
|
3018
|
-
group:
|
|
3019
|
-
icon:
|
|
3020
|
-
isActive: l.isCommandActive(
|
|
3021
|
-
disabled: !l.canExecCommand(
|
|
3018
|
+
id: h.id,
|
|
3019
|
+
label: h.label,
|
|
3020
|
+
group: h.group || "technical",
|
|
3021
|
+
icon: h.icon ? u[h.icon] || mt : mt,
|
|
3022
|
+
isActive: l.isCommandActive(h.command),
|
|
3023
|
+
disabled: !l.canExecCommand(h.command),
|
|
3022
3024
|
tooltip: A,
|
|
3023
3025
|
run: () => {
|
|
3024
|
-
l.execCommand(
|
|
3026
|
+
l.execCommand(h.command);
|
|
3025
3027
|
}
|
|
3026
3028
|
};
|
|
3027
|
-
}), p = [...
|
|
3028
|
-
group:
|
|
3029
|
-
items: p.filter((_) => _.group ===
|
|
3030
|
-
})).filter((
|
|
3029
|
+
}), p = [...m, ...f], y = p.map((h) => h.group).filter((h, _, T) => T.indexOf(h) === _ && !t.includes(h)), w = [...t, ...y].map((h) => ({
|
|
3030
|
+
group: h,
|
|
3031
|
+
items: p.filter((_) => _.group === h)
|
|
3032
|
+
})).filter((h) => h.items.length > 0), x = (h) => {
|
|
3031
3033
|
i((_) => {
|
|
3032
|
-
const
|
|
3033
|
-
return
|
|
3034
|
+
const T = new Set(_);
|
|
3035
|
+
return T.has(h) ? T.delete(h) : T.add(h), T;
|
|
3034
3036
|
});
|
|
3035
|
-
},
|
|
3037
|
+
}, C = [
|
|
3036
3038
|
{ label: d ? "插入表格 3×3" : "Insert Table 3×3", onClick: () => e.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run() },
|
|
3037
3039
|
{ label: d ? "上方插入行" : "Add Row Before", onClick: () => e.chain().focus().addRowBefore().run() },
|
|
3038
3040
|
{ label: d ? "下方插入行" : "Add Row After", onClick: () => e.chain().focus().addRowAfter().run() },
|
|
@@ -3044,107 +3046,107 @@ const Xa = (e = {}) => {
|
|
|
3044
3046
|
{ label: d ? "拆分单元格" : "Split Cell", onClick: () => e.chain().focus().splitCell().run() },
|
|
3045
3047
|
{ label: d ? "切换表头" : "Toggle Header Row", onClick: () => e.chain().focus().toggleHeaderRow().run() },
|
|
3046
3048
|
{ label: d ? "删除表格" : "Delete Table", onClick: () => e.chain().focus().deleteTable().run() }
|
|
3047
|
-
],
|
|
3049
|
+
], v = [
|
|
3048
3050
|
{ label: s.insertImageFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "image" }) },
|
|
3049
3051
|
{ label: s.insertMermaidFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "mermaid" }) },
|
|
3050
3052
|
{ label: s.insertDrawioFigure, onClick: () => void l.execCommand("patent.insertFigure", { contentType: "drawio" }) }
|
|
3051
|
-
],
|
|
3053
|
+
], E = (h) => h.id === "core-table" ? /* @__PURE__ */ g(Ct, { btn: h, items: C }, h.id) : h.id === "patent-figure-insert" ? /* @__PURE__ */ g(Ct, { btn: h, items: v }, h.id) : /* @__PURE__ */ g(
|
|
3052
3054
|
"button",
|
|
3053
3055
|
{
|
|
3054
|
-
onClick:
|
|
3055
|
-
disabled:
|
|
3056
|
+
onClick: h.run,
|
|
3057
|
+
disabled: h.disabled,
|
|
3056
3058
|
className: Y(
|
|
3057
3059
|
"p-2 rounded transition-colors",
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
+
h.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200",
|
|
3061
|
+
h.isActive ? "bg-gray-300 text-blue-600" : "text-gray-700"
|
|
3060
3062
|
),
|
|
3061
|
-
title:
|
|
3062
|
-
children: /* @__PURE__ */
|
|
3063
|
+
title: h.tooltip,
|
|
3064
|
+
children: /* @__PURE__ */ g(h.icon, { size: 18 })
|
|
3063
3065
|
},
|
|
3064
|
-
|
|
3066
|
+
h.id
|
|
3065
3067
|
);
|
|
3066
|
-
return /* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ g("div", { className: "border-b border-gray-200 bg-gray-50 sticky top-0 z-10 overflow-x-auto", children: /* @__PURE__ */ L("div", { className: "flex flex-nowrap md:flex-wrap gap-2 p-2 min-w-max md:min-w-0", children: [
|
|
3067
3069
|
/* @__PURE__ */ L("div", { className: "flex items-center gap-1 pr-2 mr-2 border-r border-gray-200", children: [
|
|
3068
|
-
/* @__PURE__ */
|
|
3070
|
+
/* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: s.language }),
|
|
3069
3071
|
/* @__PURE__ */ L(
|
|
3070
3072
|
"select",
|
|
3071
3073
|
{
|
|
3072
3074
|
value: o,
|
|
3073
|
-
onChange: (
|
|
3074
|
-
c(
|
|
3075
|
+
onChange: (h) => {
|
|
3076
|
+
c(h.target.value === "en" ? "en" : "zh");
|
|
3075
3077
|
},
|
|
3076
3078
|
className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white text-gray-700",
|
|
3077
3079
|
children: [
|
|
3078
|
-
/* @__PURE__ */
|
|
3079
|
-
/* @__PURE__ */
|
|
3080
|
+
/* @__PURE__ */ g("option", { value: "zh", children: "中文" }),
|
|
3081
|
+
/* @__PURE__ */ g("option", { value: "en", children: "English" })
|
|
3080
3082
|
]
|
|
3081
3083
|
}
|
|
3082
3084
|
)
|
|
3083
3085
|
] }),
|
|
3084
|
-
|
|
3085
|
-
const _ = a.has(
|
|
3086
|
+
w.map((h) => {
|
|
3087
|
+
const _ = a.has(h.group);
|
|
3086
3088
|
return /* @__PURE__ */ L("div", { className: "flex items-center gap-1 pr-2 mr-2 border-r border-gray-200 last:border-r-0 last:mr-0 last:pr-0", children: [
|
|
3087
|
-
n && /* @__PURE__ */
|
|
3089
|
+
n && /* @__PURE__ */ g(
|
|
3088
3090
|
"button",
|
|
3089
3091
|
{
|
|
3090
3092
|
onClick: () => {
|
|
3091
|
-
|
|
3093
|
+
x(h.group);
|
|
3092
3094
|
},
|
|
3093
3095
|
className: "px-2 py-1 text-xs rounded bg-gray-200 text-gray-700 hover:bg-gray-300",
|
|
3094
|
-
title: _ ? `${s.expand} ${Xe(
|
|
3095
|
-
children: Xe(
|
|
3096
|
+
title: _ ? `${s.expand} ${Xe(h.group, s)}` : `${s.collapse} ${Xe(h.group, s)}`,
|
|
3097
|
+
children: Xe(h.group, s)
|
|
3096
3098
|
}
|
|
3097
3099
|
),
|
|
3098
|
-
(!n || !_) &&
|
|
3099
|
-
] },
|
|
3100
|
+
(!n || !_) && h.items.map(E)
|
|
3101
|
+
] }, h.group);
|
|
3100
3102
|
})
|
|
3101
3103
|
] }) });
|
|
3102
3104
|
}, ei = ({ editor: e }) => {
|
|
3103
|
-
const [t, n] = $(0), [r, a] = $(""), i = I((
|
|
3105
|
+
const [t, n] = $(0), [r, a] = $(""), i = I((v) => v.editorLanguage), o = H(i);
|
|
3104
3106
|
if (M(() => {
|
|
3105
3107
|
if (!e) return;
|
|
3106
|
-
const
|
|
3107
|
-
return e.on("selectionUpdate",
|
|
3108
|
-
e.off("selectionUpdate",
|
|
3108
|
+
const v = () => n((E) => E + 1);
|
|
3109
|
+
return e.on("selectionUpdate", v), e.on("update", v), () => {
|
|
3110
|
+
e.off("selectionUpdate", v), e.off("update", v);
|
|
3109
3111
|
};
|
|
3110
3112
|
}, [e]), !e) return null;
|
|
3111
3113
|
const c = ct(e), s = [];
|
|
3112
|
-
e.state.doc.descendants((
|
|
3113
|
-
if (
|
|
3114
|
-
const
|
|
3115
|
-
return
|
|
3114
|
+
e.state.doc.descendants((v) => {
|
|
3115
|
+
if (v.type.name !== "figure") return !0;
|
|
3116
|
+
const E = typeof v.attrs.id == "string" ? v.attrs.id.trim() : "";
|
|
3117
|
+
return E && s.push({ id: E, label: E }), !0;
|
|
3116
3118
|
});
|
|
3117
|
-
const l = c.findAncestorNode("figure"), d = !!l,
|
|
3118
|
-
|
|
3119
|
-
const
|
|
3119
|
+
const l = c.findAncestorNode("figure"), d = !!l, m = l && typeof l.node.attrs.id == "string" ? l.node.attrs.id.trim() : "", u = l && typeof l.node.attrs.contentType == "string" ? l.node.attrs.contentType : "image", [f, p] = $(""), y = W(null), b = W(null), w = (l == null ? void 0 : l.pos) ?? null;
|
|
3120
|
+
w !== b.current && (b.current = w, d && m !== f && p(m));
|
|
3121
|
+
const x = (v) => {
|
|
3120
3122
|
l && c.execCommand("patent.updateFigure", {
|
|
3121
3123
|
position: l.pos,
|
|
3122
|
-
contentType:
|
|
3124
|
+
contentType: v
|
|
3123
3125
|
});
|
|
3124
|
-
},
|
|
3126
|
+
}, C = () => {
|
|
3125
3127
|
if (!l) return;
|
|
3126
|
-
const
|
|
3127
|
-
|
|
3128
|
+
const v = f.trim();
|
|
3129
|
+
v !== m && c.execCommand("patent.updateFigure", {
|
|
3128
3130
|
position: l.pos,
|
|
3129
|
-
id:
|
|
3131
|
+
id: v
|
|
3130
3132
|
});
|
|
3131
3133
|
};
|
|
3132
|
-
return /* @__PURE__ */
|
|
3134
|
+
return /* @__PURE__ */ g("div", { className: "border-b border-gray-200 bg-gray-50 p-2", children: /* @__PURE__ */ L("div", { className: "bg-white border border-gray-200 rounded-md px-2 py-2 flex flex-wrap items-center gap-2", children: [
|
|
3133
3135
|
s.length > 0 && /* @__PURE__ */ L(je, { children: [
|
|
3134
|
-
/* @__PURE__ */
|
|
3136
|
+
/* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: o.figureReferenceTarget }),
|
|
3135
3137
|
/* @__PURE__ */ L(
|
|
3136
3138
|
"select",
|
|
3137
3139
|
{
|
|
3138
3140
|
value: r || "__none__",
|
|
3139
|
-
onChange: (
|
|
3141
|
+
onChange: (v) => a(v.target.value === "__none__" ? "" : v.target.value),
|
|
3140
3142
|
className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white",
|
|
3141
3143
|
children: [
|
|
3142
|
-
/* @__PURE__ */
|
|
3143
|
-
s.map((
|
|
3144
|
+
/* @__PURE__ */ g("option", { value: "__none__", children: o.figureReferenceTargetPlaceholder }),
|
|
3145
|
+
s.map((v) => /* @__PURE__ */ g("option", { value: v.id, children: v.label }, v.id))
|
|
3144
3146
|
]
|
|
3145
3147
|
}
|
|
3146
3148
|
),
|
|
3147
|
-
/* @__PURE__ */
|
|
3149
|
+
/* @__PURE__ */ g(
|
|
3148
3150
|
"button",
|
|
3149
3151
|
{
|
|
3150
3152
|
onClick: () => {
|
|
@@ -3155,72 +3157,72 @@ const Xa = (e = {}) => {
|
|
|
3155
3157
|
},
|
|
3156
3158
|
className: "p-2 hover:bg-blue-50 text-blue-600 rounded",
|
|
3157
3159
|
title: o.insertFigureReference,
|
|
3158
|
-
children: /* @__PURE__ */
|
|
3160
|
+
children: /* @__PURE__ */ g(Bt, { size: 16 })
|
|
3159
3161
|
}
|
|
3160
3162
|
)
|
|
3161
3163
|
] }),
|
|
3162
|
-
/* @__PURE__ */
|
|
3164
|
+
/* @__PURE__ */ g("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
|
|
3163
3165
|
d && /* @__PURE__ */ L(je, { children: [
|
|
3164
|
-
/* @__PURE__ */
|
|
3165
|
-
/* @__PURE__ */
|
|
3166
|
-
/* @__PURE__ */
|
|
3166
|
+
/* @__PURE__ */ g("span", { className: "text-xs font-medium text-gray-700", children: o.currentFigure }),
|
|
3167
|
+
/* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: o.figureId }),
|
|
3168
|
+
/* @__PURE__ */ g(
|
|
3167
3169
|
"input",
|
|
3168
3170
|
{
|
|
3169
|
-
ref:
|
|
3171
|
+
ref: y,
|
|
3170
3172
|
type: "text",
|
|
3171
3173
|
value: f,
|
|
3172
|
-
onChange: (
|
|
3173
|
-
onBlur:
|
|
3174
|
-
onKeyDown: (
|
|
3175
|
-
|
|
3174
|
+
onChange: (v) => p(v.target.value),
|
|
3175
|
+
onBlur: C,
|
|
3176
|
+
onKeyDown: (v) => {
|
|
3177
|
+
v.key === "Enter" && (C(), v.target.blur());
|
|
3176
3178
|
},
|
|
3177
3179
|
className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white w-20",
|
|
3178
3180
|
placeholder: i === "en" ? "Fig.1" : "图1"
|
|
3179
3181
|
}
|
|
3180
3182
|
),
|
|
3181
|
-
/* @__PURE__ */
|
|
3183
|
+
/* @__PURE__ */ g("span", { className: "text-xs text-gray-500", children: o.switchFigureType }),
|
|
3182
3184
|
/* @__PURE__ */ L(
|
|
3183
3185
|
"select",
|
|
3184
3186
|
{
|
|
3185
3187
|
value: u,
|
|
3186
|
-
onChange: (
|
|
3188
|
+
onChange: (v) => x(v.target.value),
|
|
3187
3189
|
className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white",
|
|
3188
3190
|
children: [
|
|
3189
|
-
/* @__PURE__ */
|
|
3190
|
-
/* @__PURE__ */
|
|
3191
|
-
/* @__PURE__ */
|
|
3191
|
+
/* @__PURE__ */ g("option", { value: "image", children: o.figureContentTypeImage }),
|
|
3192
|
+
/* @__PURE__ */ g("option", { value: "mermaid", children: o.figureContentTypeMermaid }),
|
|
3193
|
+
/* @__PURE__ */ g("option", { value: "drawio", children: o.figureContentTypeDrawio })
|
|
3192
3194
|
]
|
|
3193
3195
|
}
|
|
3194
3196
|
),
|
|
3195
|
-
/* @__PURE__ */
|
|
3197
|
+
/* @__PURE__ */ g("div", { className: "h-6 w-px bg-gray-200 mx-1" })
|
|
3196
3198
|
] }),
|
|
3197
3199
|
e.isActive("image") && (() => {
|
|
3198
|
-
const
|
|
3200
|
+
const E = e.getAttributes("image").width || "";
|
|
3199
3201
|
return /* @__PURE__ */ L(je, { children: [
|
|
3200
|
-
/* @__PURE__ */
|
|
3201
|
-
["25%", "50%", "75%", "100%"].map((_) => /* @__PURE__ */
|
|
3202
|
+
/* @__PURE__ */ g("span", { className: "text-xs font-medium text-gray-700", children: i === "zh" ? "图片" : "Image" }),
|
|
3203
|
+
["25%", "50%", "75%", "100%"].map((_) => /* @__PURE__ */ g(
|
|
3202
3204
|
"button",
|
|
3203
3205
|
{
|
|
3204
3206
|
onClick: () => e.chain().focus().updateAttributes("image", { width: _ }).run(),
|
|
3205
|
-
className: `text-xs px-2 py-0.5 rounded border ${
|
|
3207
|
+
className: `text-xs px-2 py-0.5 rounded border ${E === _ ? "bg-blue-50 text-blue-700 border-blue-200" : "bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,
|
|
3206
3208
|
children: _
|
|
3207
3209
|
},
|
|
3208
3210
|
_
|
|
3209
3211
|
)),
|
|
3210
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ g("div", { className: "h-6 w-px bg-gray-200 mx-1" })
|
|
3211
3213
|
] });
|
|
3212
3214
|
})(),
|
|
3213
|
-
/* @__PURE__ */
|
|
3215
|
+
/* @__PURE__ */ g(
|
|
3214
3216
|
"button",
|
|
3215
3217
|
{
|
|
3216
3218
|
onClick: async () => {
|
|
3217
3219
|
if (e.chain().focus().deleteSelection().run()) return;
|
|
3218
|
-
const { from:
|
|
3219
|
-
|
|
3220
|
+
const { from: v } = e.state.selection;
|
|
3221
|
+
v > 1 && e.chain().focus().deleteRange({ from: v - 1, to: v }).run();
|
|
3220
3222
|
},
|
|
3221
3223
|
className: "p-2 hover:bg-red-50 text-red-600 rounded",
|
|
3222
3224
|
title: o.deleteSelection,
|
|
3223
|
-
children: /* @__PURE__ */
|
|
3225
|
+
children: /* @__PURE__ */ g(Br, { size: 16 })
|
|
3224
3226
|
}
|
|
3225
3227
|
)
|
|
3226
3228
|
] }) });
|
|
@@ -3292,14 +3294,14 @@ function Ws(e, t = {}) {
|
|
|
3292
3294
|
const n = I.getState().editorLanguage, { from: r, to: a } = e.state.selection, i = r !== a ? e.state.doc.textBetween(r, a, " ", "\0") : void 0;
|
|
3293
3295
|
let o = t.sectionType, c = t.targetSectionPos;
|
|
3294
3296
|
if (!o) {
|
|
3295
|
-
const
|
|
3296
|
-
|
|
3297
|
+
const m = on(e);
|
|
3298
|
+
m && (o = m.sectionType, c = m.pos);
|
|
3297
3299
|
}
|
|
3298
3300
|
const s = t.scope || (o ? "section" : i ? "selection" : "document"), l = o ? ni(e, o) : void 0;
|
|
3299
3301
|
let d;
|
|
3300
3302
|
if (s === "selection" && r !== a) {
|
|
3301
|
-
const u = Math.max(0, r - 200), f = Math.min(e.state.doc.content.size, a + 200), p = e.state.doc.textBetween(u, r, " ", "\0"),
|
|
3302
|
-
d = `...${p}[SELECTED]${
|
|
3303
|
+
const u = Math.max(0, r - 200), f = Math.min(e.state.doc.content.size, a + 200), p = e.state.doc.textBetween(u, r, " ", "\0"), y = e.state.doc.textBetween(a, f, " ", "\0");
|
|
3304
|
+
d = `...${p}[SELECTED]${y}...`;
|
|
3303
3305
|
}
|
|
3304
3306
|
return {
|
|
3305
3307
|
scope: s,
|
|
@@ -3319,211 +3321,211 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3319
3321
|
), c = () => {
|
|
3320
3322
|
const { from: l, to: d } = e.state.selection;
|
|
3321
3323
|
if (l === d) return;
|
|
3322
|
-
const
|
|
3324
|
+
const m = e.state.doc.textBetween(l, d, " "), u = on(e);
|
|
3323
3325
|
if (t) {
|
|
3324
|
-
t({ text:
|
|
3326
|
+
t({ text: m, from: l, to: d, sectionType: u == null ? void 0 : u.sectionType });
|
|
3325
3327
|
return;
|
|
3326
3328
|
}
|
|
3327
|
-
n({ text:
|
|
3329
|
+
n({ text: m, from: l, to: d, sectionType: u == null ? void 0 : u.sectionType }), r();
|
|
3328
3330
|
}, s = () => {
|
|
3329
3331
|
const l = e.getAttributes("link").href, d = window.prompt("URL", l || "https://");
|
|
3330
3332
|
d !== null && (d === "" ? e.chain().focus().extendMarkRange("link").unsetLink().run() : e.chain().focus().extendMarkRange("link").setLink({ href: d }).run());
|
|
3331
3333
|
};
|
|
3332
|
-
return /* @__PURE__ */
|
|
3334
|
+
return /* @__PURE__ */ g(
|
|
3333
3335
|
Kr,
|
|
3334
3336
|
{
|
|
3335
3337
|
editor: e,
|
|
3336
3338
|
shouldShow: ({ editor: l, state: d }) => {
|
|
3337
|
-
const { from:
|
|
3338
|
-
return !(
|
|
3339
|
+
const { from: m, to: u } = d.selection;
|
|
3340
|
+
return !(m === u || l.isActive("codeBlock"));
|
|
3339
3341
|
},
|
|
3340
3342
|
children: /* @__PURE__ */ L("div", { className: "bubble-menu", children: [
|
|
3341
|
-
/* @__PURE__ */
|
|
3343
|
+
/* @__PURE__ */ g(
|
|
3342
3344
|
"button",
|
|
3343
3345
|
{
|
|
3344
3346
|
onClick: () => e.chain().focus().toggleBold().run(),
|
|
3345
3347
|
className: o(e.isActive("bold")),
|
|
3346
3348
|
title: "Bold",
|
|
3347
|
-
children: /* @__PURE__ */
|
|
3349
|
+
children: /* @__PURE__ */ g(Dt, { size: 15 })
|
|
3348
3350
|
}
|
|
3349
3351
|
),
|
|
3350
|
-
/* @__PURE__ */
|
|
3352
|
+
/* @__PURE__ */ g(
|
|
3351
3353
|
"button",
|
|
3352
3354
|
{
|
|
3353
3355
|
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
3354
3356
|
className: o(e.isActive("italic")),
|
|
3355
3357
|
title: "Italic",
|
|
3356
|
-
children: /* @__PURE__ */
|
|
3358
|
+
children: /* @__PURE__ */ g(Rt, { size: 15 })
|
|
3357
3359
|
}
|
|
3358
3360
|
),
|
|
3359
|
-
/* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ g(
|
|
3360
3362
|
"button",
|
|
3361
3363
|
{
|
|
3362
3364
|
onClick: () => e.chain().focus().toggleUnderline().run(),
|
|
3363
3365
|
className: o(e.isActive("underline")),
|
|
3364
3366
|
title: "Underline",
|
|
3365
|
-
children: /* @__PURE__ */
|
|
3367
|
+
children: /* @__PURE__ */ g(Mt, { size: 15 })
|
|
3366
3368
|
}
|
|
3367
3369
|
),
|
|
3368
|
-
/* @__PURE__ */
|
|
3370
|
+
/* @__PURE__ */ g(
|
|
3369
3371
|
"button",
|
|
3370
3372
|
{
|
|
3371
3373
|
onClick: () => e.chain().focus().toggleStrike().run(),
|
|
3372
3374
|
className: o(e.isActive("strike")),
|
|
3373
3375
|
title: "Strikethrough",
|
|
3374
|
-
children: /* @__PURE__ */
|
|
3376
|
+
children: /* @__PURE__ */ g(Ft, { size: 15 })
|
|
3375
3377
|
}
|
|
3376
3378
|
),
|
|
3377
|
-
/* @__PURE__ */
|
|
3379
|
+
/* @__PURE__ */ g(
|
|
3378
3380
|
"button",
|
|
3379
3381
|
{
|
|
3380
3382
|
onClick: () => e.chain().focus().toggleCode().run(),
|
|
3381
3383
|
className: o(e.isActive("code")),
|
|
3382
3384
|
title: "Code",
|
|
3383
|
-
children: /* @__PURE__ */
|
|
3385
|
+
children: /* @__PURE__ */ g($t, { size: 15 })
|
|
3384
3386
|
}
|
|
3385
3387
|
),
|
|
3386
|
-
/* @__PURE__ */
|
|
3388
|
+
/* @__PURE__ */ g(
|
|
3387
3389
|
"button",
|
|
3388
3390
|
{
|
|
3389
3391
|
onClick: () => e.chain().focus().toggleSuperscript().run(),
|
|
3390
3392
|
className: o(e.isActive("superscript")),
|
|
3391
3393
|
title: "Superscript",
|
|
3392
|
-
children: /* @__PURE__ */
|
|
3394
|
+
children: /* @__PURE__ */ g(zt, { size: 15 })
|
|
3393
3395
|
}
|
|
3394
3396
|
),
|
|
3395
|
-
/* @__PURE__ */
|
|
3397
|
+
/* @__PURE__ */ g(
|
|
3396
3398
|
"button",
|
|
3397
3399
|
{
|
|
3398
3400
|
onClick: () => e.chain().focus().toggleSubscript().run(),
|
|
3399
3401
|
className: o(e.isActive("subscript")),
|
|
3400
3402
|
title: "Subscript",
|
|
3401
|
-
children: /* @__PURE__ */
|
|
3403
|
+
children: /* @__PURE__ */ g(Ot, { size: 15 })
|
|
3402
3404
|
}
|
|
3403
3405
|
),
|
|
3404
|
-
/* @__PURE__ */
|
|
3405
|
-
/* @__PURE__ */
|
|
3406
|
+
/* @__PURE__ */ g("div", { className: "bubble-menu-divider" }),
|
|
3407
|
+
/* @__PURE__ */ g(
|
|
3406
3408
|
"button",
|
|
3407
3409
|
{
|
|
3408
3410
|
onClick: () => e.chain().focus().toggleHighlight().run(),
|
|
3409
3411
|
className: o(e.isActive("highlight")),
|
|
3410
3412
|
title: "Highlight",
|
|
3411
|
-
children: /* @__PURE__ */
|
|
3413
|
+
children: /* @__PURE__ */ g(Hr, { size: 15 })
|
|
3412
3414
|
}
|
|
3413
3415
|
),
|
|
3414
|
-
/* @__PURE__ */
|
|
3416
|
+
/* @__PURE__ */ g(
|
|
3415
3417
|
"button",
|
|
3416
3418
|
{
|
|
3417
3419
|
onClick: s,
|
|
3418
3420
|
className: o(e.isActive("link")),
|
|
3419
3421
|
title: "Link",
|
|
3420
|
-
children: /* @__PURE__ */
|
|
3422
|
+
children: /* @__PURE__ */ g(Ht, { size: 15 })
|
|
3421
3423
|
}
|
|
3422
3424
|
),
|
|
3423
|
-
/* @__PURE__ */
|
|
3424
|
-
/* @__PURE__ */
|
|
3425
|
+
/* @__PURE__ */ g("div", { className: "bubble-menu-divider" }),
|
|
3426
|
+
/* @__PURE__ */ g(
|
|
3425
3427
|
"button",
|
|
3426
3428
|
{
|
|
3427
3429
|
onClick: c,
|
|
3428
3430
|
className: "p-1.5 rounded transition-colors text-purple-500 hover:bg-purple-50",
|
|
3429
3431
|
title: i ? "AI 优化" : "AI Optimize",
|
|
3430
|
-
children: /* @__PURE__ */
|
|
3432
|
+
children: /* @__PURE__ */ g(qr, { size: 15 })
|
|
3431
3433
|
}
|
|
3432
3434
|
)
|
|
3433
3435
|
] })
|
|
3434
3436
|
}
|
|
3435
3437
|
);
|
|
3436
3438
|
}, ai = ({ editor: e }) => {
|
|
3437
|
-
var
|
|
3438
|
-
const [t, n] = $(!1), [r, a] = $(!1), [i, o] = $(""), [c, s] = $(""), [l, d] = $(!1),
|
|
3439
|
+
var x;
|
|
3440
|
+
const [t, n] = $(!1), [r, a] = $(!1), [i, o] = $(""), [c, s] = $(""), [l, d] = $(!1), m = W(null), u = e.extensionStorage.searchReplace, f = ((x = u == null ? void 0 : u.results) == null ? void 0 : x.length) ?? 0, p = (u == null ? void 0 : u.currentIndex) ?? -1;
|
|
3439
3441
|
M(() => {
|
|
3440
|
-
const
|
|
3442
|
+
const C = (v) => {
|
|
3441
3443
|
n(!0);
|
|
3442
|
-
const
|
|
3443
|
-
|
|
3444
|
-
var
|
|
3445
|
-
return (
|
|
3444
|
+
const E = v.detail;
|
|
3445
|
+
E != null && E.replace && a(!0), requestAnimationFrame(() => {
|
|
3446
|
+
var h;
|
|
3447
|
+
return (h = m.current) == null ? void 0 : h.focus();
|
|
3446
3448
|
});
|
|
3447
3449
|
};
|
|
3448
|
-
return window.addEventListener("editor:toggleSearch",
|
|
3450
|
+
return window.addEventListener("editor:toggleSearch", C), () => window.removeEventListener("editor:toggleSearch", C);
|
|
3449
3451
|
}, []);
|
|
3450
|
-
const
|
|
3451
|
-
(
|
|
3452
|
-
o(
|
|
3452
|
+
const y = ae(
|
|
3453
|
+
(C) => {
|
|
3454
|
+
o(C), e.commands.setSearchTerm(C);
|
|
3453
3455
|
},
|
|
3454
3456
|
[e]
|
|
3455
|
-
),
|
|
3457
|
+
), b = ae(() => {
|
|
3456
3458
|
n(!1), e.commands.clearSearch(), e.commands.focus();
|
|
3457
3459
|
}, [e]);
|
|
3458
3460
|
M(() => {
|
|
3459
|
-
const
|
|
3460
|
-
|
|
3461
|
+
const C = (v) => {
|
|
3462
|
+
v.key === "Escape" && t && b();
|
|
3461
3463
|
};
|
|
3462
|
-
return window.addEventListener("keydown",
|
|
3463
|
-
}, [t,
|
|
3464
|
-
const
|
|
3465
|
-
const
|
|
3466
|
-
d(
|
|
3464
|
+
return window.addEventListener("keydown", C), () => window.removeEventListener("keydown", C);
|
|
3465
|
+
}, [t, b]);
|
|
3466
|
+
const w = () => {
|
|
3467
|
+
const C = !l;
|
|
3468
|
+
d(C), e.commands.setCaseSensitive(C);
|
|
3467
3469
|
};
|
|
3468
3470
|
return t ? /* @__PURE__ */ L("div", { className: "find-replace-bar", children: [
|
|
3469
3471
|
/* @__PURE__ */ L("div", { className: "find-replace-row", children: [
|
|
3470
3472
|
/* @__PURE__ */ L("div", { className: "find-replace-input-group", children: [
|
|
3471
|
-
/* @__PURE__ */
|
|
3473
|
+
/* @__PURE__ */ g(
|
|
3472
3474
|
"input",
|
|
3473
3475
|
{
|
|
3474
|
-
ref:
|
|
3476
|
+
ref: m,
|
|
3475
3477
|
type: "text",
|
|
3476
3478
|
value: i,
|
|
3477
|
-
onChange: (
|
|
3478
|
-
onKeyDown: (
|
|
3479
|
-
|
|
3479
|
+
onChange: (C) => y(C.target.value),
|
|
3480
|
+
onKeyDown: (C) => {
|
|
3481
|
+
C.key === "Enter" && (C.shiftKey ? e.commands.previousSearchResult() : e.commands.nextSearchResult());
|
|
3480
3482
|
},
|
|
3481
3483
|
placeholder: "Find...",
|
|
3482
3484
|
className: "find-replace-input"
|
|
3483
3485
|
}
|
|
3484
3486
|
),
|
|
3485
|
-
/* @__PURE__ */
|
|
3487
|
+
/* @__PURE__ */ g("span", { className: "find-replace-count", children: f > 0 ? `${p + 1}/${f}` : i ? "0" : "" })
|
|
3486
3488
|
] }),
|
|
3487
|
-
/* @__PURE__ */
|
|
3489
|
+
/* @__PURE__ */ g(
|
|
3488
3490
|
"button",
|
|
3489
3491
|
{
|
|
3490
|
-
onClick:
|
|
3492
|
+
onClick: w,
|
|
3491
3493
|
className: Y("find-replace-btn", l && "find-replace-btn--active"),
|
|
3492
3494
|
title: "Case Sensitive",
|
|
3493
|
-
children: /* @__PURE__ */
|
|
3495
|
+
children: /* @__PURE__ */ g(Ur, { size: 15 })
|
|
3494
3496
|
}
|
|
3495
3497
|
),
|
|
3496
|
-
/* @__PURE__ */
|
|
3497
|
-
/* @__PURE__ */
|
|
3498
|
-
/* @__PURE__ */
|
|
3498
|
+
/* @__PURE__ */ g("button", { onClick: () => e.commands.previousSearchResult(), className: "find-replace-btn", title: "Previous", children: /* @__PURE__ */ g(Wr, { size: 15 }) }),
|
|
3499
|
+
/* @__PURE__ */ g("button", { onClick: () => e.commands.nextSearchResult(), className: "find-replace-btn", title: "Next", children: /* @__PURE__ */ g(Ut, { size: 15 }) }),
|
|
3500
|
+
/* @__PURE__ */ g(
|
|
3499
3501
|
"button",
|
|
3500
3502
|
{
|
|
3501
|
-
onClick: () => a((
|
|
3503
|
+
onClick: () => a((C) => !C),
|
|
3502
3504
|
className: Y("find-replace-btn", r && "find-replace-btn--active"),
|
|
3503
3505
|
title: "Toggle Replace",
|
|
3504
|
-
children: /* @__PURE__ */
|
|
3506
|
+
children: /* @__PURE__ */ g(gt, { size: 15 })
|
|
3505
3507
|
}
|
|
3506
3508
|
),
|
|
3507
|
-
/* @__PURE__ */
|
|
3509
|
+
/* @__PURE__ */ g("button", { onClick: b, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ g(jr, { size: 15 }) })
|
|
3508
3510
|
] }),
|
|
3509
3511
|
r && /* @__PURE__ */ L("div", { className: "find-replace-row", children: [
|
|
3510
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ g(
|
|
3511
3513
|
"input",
|
|
3512
3514
|
{
|
|
3513
3515
|
type: "text",
|
|
3514
3516
|
value: c,
|
|
3515
|
-
onChange: (
|
|
3516
|
-
s(
|
|
3517
|
+
onChange: (C) => {
|
|
3518
|
+
s(C.target.value), e.commands.setReplaceTerm(C.target.value);
|
|
3517
3519
|
},
|
|
3518
|
-
onKeyDown: (
|
|
3519
|
-
|
|
3520
|
+
onKeyDown: (C) => {
|
|
3521
|
+
C.key === "Enter" && e.commands.replaceCurrent();
|
|
3520
3522
|
},
|
|
3521
3523
|
placeholder: "Replace...",
|
|
3522
3524
|
className: "find-replace-input"
|
|
3523
3525
|
}
|
|
3524
3526
|
),
|
|
3525
|
-
/* @__PURE__ */
|
|
3526
|
-
/* @__PURE__ */
|
|
3527
|
+
/* @__PURE__ */ g("button", { onClick: () => e.commands.replaceCurrent(), className: "find-replace-btn", title: "Replace", children: /* @__PURE__ */ g(gt, { size: 15 }) }),
|
|
3528
|
+
/* @__PURE__ */ g("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ g(Gr, { size: 15 }) })
|
|
3527
3529
|
] })
|
|
3528
3530
|
] }) : null;
|
|
3529
3531
|
}, ii = ({ editor: e }) => {
|
|
@@ -3567,21 +3569,21 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3567
3569
|
const c = At(() => {
|
|
3568
3570
|
const s = [];
|
|
3569
3571
|
let l = !1;
|
|
3570
|
-
return e.state.doc.descendants((d,
|
|
3572
|
+
return e.state.doc.descendants((d, m) => {
|
|
3571
3573
|
if (d.type.name === "patent_title") {
|
|
3572
3574
|
if (!l) {
|
|
3573
|
-
const
|
|
3575
|
+
const y = typeof n.bookTitle_description == "string" ? n.bookTitle_description : "说明书";
|
|
3574
3576
|
s.push({
|
|
3575
3577
|
type: "book-group",
|
|
3576
|
-
pos:
|
|
3577
|
-
title:
|
|
3578
|
+
pos: m,
|
|
3579
|
+
title: y,
|
|
3578
3580
|
charCount: 0
|
|
3579
3581
|
}), l = !0;
|
|
3580
3582
|
}
|
|
3581
3583
|
const u = d.textContent || "", f = u.trim().length > 0, p = typeof n.patentTitlePlaceholder == "string" ? n.patentTitlePlaceholder : "Patent Title";
|
|
3582
3584
|
return s.push({
|
|
3583
3585
|
type: "section",
|
|
3584
|
-
pos:
|
|
3586
|
+
pos: m,
|
|
3585
3587
|
title: f ? u.trim() : p,
|
|
3586
3588
|
state: f ? "filled" : "empty",
|
|
3587
3589
|
charCount: u.replace(/\s/g, "").length,
|
|
@@ -3589,13 +3591,13 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3589
3591
|
}), !1;
|
|
3590
3592
|
}
|
|
3591
3593
|
if (d.type.name === "patent_section") {
|
|
3592
|
-
const u = d.attrs.sectionType, f = ci.has(u), p = `sectionTitle_${u}`,
|
|
3594
|
+
const u = d.attrs.sectionType, f = ci.has(u), p = `sectionTitle_${u}`, y = typeof n[p] == "string" ? n[p] : u, b = d.textContent || "", w = b.trim().length > 0;
|
|
3593
3595
|
return s.push({
|
|
3594
3596
|
type: "section",
|
|
3595
|
-
pos:
|
|
3596
|
-
title:
|
|
3597
|
-
state:
|
|
3598
|
-
charCount:
|
|
3597
|
+
pos: m,
|
|
3598
|
+
title: y,
|
|
3599
|
+
state: w ? "filled" : "empty",
|
|
3600
|
+
charCount: b.replace(/\s/g, "").length,
|
|
3599
3601
|
indent: f
|
|
3600
3602
|
}), !1;
|
|
3601
3603
|
}
|
|
@@ -3603,7 +3605,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3603
3605
|
const u = d.attrs.level, f = d.textContent || "";
|
|
3604
3606
|
return f.trim() && s.push({
|
|
3605
3607
|
type: "heading",
|
|
3606
|
-
pos:
|
|
3608
|
+
pos: m,
|
|
3607
3609
|
title: f,
|
|
3608
3610
|
level: u,
|
|
3609
3611
|
charCount: f.replace(/\s/g, "").length
|
|
@@ -3612,30 +3614,30 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3612
3614
|
return !0;
|
|
3613
3615
|
}), s;
|
|
3614
3616
|
}, [e, i, n]);
|
|
3615
|
-
return r ? /* @__PURE__ */
|
|
3617
|
+
return r ? /* @__PURE__ */ g("div", { className: "outline-panel outline-panel--collapsed", children: /* @__PURE__ */ g(
|
|
3616
3618
|
"button",
|
|
3617
3619
|
{
|
|
3618
3620
|
onClick: () => a(!1),
|
|
3619
3621
|
className: "outline-panel-toggle",
|
|
3620
3622
|
title: t === "zh" ? "展开大纲" : "Expand Outline",
|
|
3621
|
-
children: /* @__PURE__ */
|
|
3623
|
+
children: /* @__PURE__ */ g(Vr, { size: 16 })
|
|
3622
3624
|
}
|
|
3623
3625
|
) }) : /* @__PURE__ */ L("div", { className: "outline-panel", children: [
|
|
3624
3626
|
/* @__PURE__ */ L("div", { className: "outline-panel-header", children: [
|
|
3625
|
-
/* @__PURE__ */
|
|
3626
|
-
/* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
3627
|
+
/* @__PURE__ */ g(qt, { size: 14 }),
|
|
3628
|
+
/* @__PURE__ */ g("span", { children: t === "zh" ? "文档大纲" : "Outline" }),
|
|
3629
|
+
/* @__PURE__ */ g(
|
|
3628
3630
|
"button",
|
|
3629
3631
|
{
|
|
3630
3632
|
onClick: () => a(!0),
|
|
3631
3633
|
className: "outline-panel-toggle ml-auto",
|
|
3632
3634
|
title: t === "zh" ? "收起大纲" : "Collapse Outline",
|
|
3633
|
-
children: /* @__PURE__ */
|
|
3635
|
+
children: /* @__PURE__ */ g(Jr, { size: 14 })
|
|
3634
3636
|
}
|
|
3635
3637
|
)
|
|
3636
3638
|
] }),
|
|
3637
3639
|
/* @__PURE__ */ L("div", { className: "outline-panel-list", children: [
|
|
3638
|
-
c.length === 0 && /* @__PURE__ */
|
|
3640
|
+
c.length === 0 && /* @__PURE__ */ g("div", { className: "outline-panel-empty", children: t === "zh" ? "暂无章节" : "No sections yet" }),
|
|
3639
3641
|
c.map((s, l) => /* @__PURE__ */ L(
|
|
3640
3642
|
"button",
|
|
3641
3643
|
{
|
|
@@ -3652,9 +3654,9 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3652
3654
|
}));
|
|
3653
3655
|
},
|
|
3654
3656
|
children: [
|
|
3655
|
-
s.type === "section" && s.state && /* @__PURE__ */
|
|
3656
|
-
/* @__PURE__ */
|
|
3657
|
-
s.type !== "book-group" && /* @__PURE__ */
|
|
3657
|
+
s.type === "section" && s.state && /* @__PURE__ */ g("span", { className: Y("outline-item-state", oi[s.state]), children: si[s.state] || "○" }),
|
|
3658
|
+
/* @__PURE__ */ g("span", { className: "outline-item-title", children: s.title }),
|
|
3659
|
+
s.type !== "book-group" && /* @__PURE__ */ g("span", { className: "outline-item-count", children: s.charCount })
|
|
3658
3660
|
]
|
|
3659
3661
|
},
|
|
3660
3662
|
`${s.pos}-${l}`
|
|
@@ -3667,7 +3669,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3667
3669
|
className: n
|
|
3668
3670
|
}) => (M(() => {
|
|
3669
3671
|
e.setEditable(t === "edit");
|
|
3670
|
-
}, [e, t]), /* @__PURE__ */
|
|
3672
|
+
}, [e, t]), /* @__PURE__ */ g(
|
|
3671
3673
|
"div",
|
|
3672
3674
|
{
|
|
3673
3675
|
className: Y(
|
|
@@ -3675,7 +3677,7 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3675
3677
|
t === "readonly" ? "cursor-default" : "cursor-text",
|
|
3676
3678
|
n
|
|
3677
3679
|
),
|
|
3678
|
-
children: /* @__PURE__ */
|
|
3680
|
+
children: /* @__PURE__ */ g(In, { editor: e, className: "h-full" })
|
|
3679
3681
|
}
|
|
3680
3682
|
)), cn = "patent-editor-draft", ui = 1500, mi = () => {
|
|
3681
3683
|
try {
|
|
@@ -3691,9 +3693,10 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3691
3693
|
readOnly: r = !1,
|
|
3692
3694
|
editable: a = !0,
|
|
3693
3695
|
onEditorReady: i,
|
|
3694
|
-
onSelectionOptimize: o
|
|
3696
|
+
onSelectionOptimize: o,
|
|
3697
|
+
patchEditorId: c = "default"
|
|
3695
3698
|
}) => {
|
|
3696
|
-
const { setEditor:
|
|
3699
|
+
const { setEditor: s, setDocument: l, editorLanguage: d, autoSaveStatus: m, ai: u } = I(), { setAutoSaveStatus: f, setLastSavedAt: p } = I(), y = W(null), b = e || (t ? null : mi()) || {
|
|
3697
3700
|
type: "doc",
|
|
3698
3701
|
content: [
|
|
3699
3702
|
{
|
|
@@ -3701,26 +3704,27 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3701
3704
|
content: [{ type: "text", text: "" }]
|
|
3702
3705
|
}
|
|
3703
3706
|
]
|
|
3704
|
-
},
|
|
3707
|
+
}, w = ae((h) => {
|
|
3705
3708
|
try {
|
|
3706
|
-
|
|
3709
|
+
f("saving"), localStorage.setItem(cn, JSON.stringify(h)), f("saved"), p(/* @__PURE__ */ new Date());
|
|
3707
3710
|
} catch {
|
|
3708
|
-
|
|
3711
|
+
f("error");
|
|
3709
3712
|
}
|
|
3710
|
-
}, [
|
|
3713
|
+
}, [f, p]), x = Nn(
|
|
3711
3714
|
Xa({
|
|
3715
|
+
extensions: [pa.configure({ editorId: c })],
|
|
3712
3716
|
content: b,
|
|
3713
|
-
onUpdate: ({ editor:
|
|
3714
|
-
const
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
+
onUpdate: ({ editor: h }) => {
|
|
3718
|
+
const _ = h.getJSON();
|
|
3719
|
+
l(_), B.notifyStateChange(h), t && t(_), t || (y.current && clearTimeout(y.current), y.current = setTimeout(() => {
|
|
3720
|
+
w(_);
|
|
3717
3721
|
}, ui));
|
|
3718
3722
|
},
|
|
3719
|
-
onCreate: ({ editor:
|
|
3720
|
-
|
|
3723
|
+
onCreate: ({ editor: h }) => {
|
|
3724
|
+
s(h), i == null || i(h), B.initializePlugins(h), B.notifyStateChange(h);
|
|
3721
3725
|
},
|
|
3722
|
-
onSelectionUpdate: ({ editor:
|
|
3723
|
-
B.notifySelectionChange(
|
|
3726
|
+
onSelectionUpdate: ({ editor: h }) => {
|
|
3727
|
+
B.notifySelectionChange(h);
|
|
3724
3728
|
},
|
|
3725
3729
|
editorProps: {
|
|
3726
3730
|
attributes: {
|
|
@@ -3728,41 +3732,41 @@ const ri = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
3728
3732
|
}
|
|
3729
3733
|
}
|
|
3730
3734
|
})
|
|
3731
|
-
),
|
|
3735
|
+
), C = W(!1);
|
|
3732
3736
|
if (M(() => {
|
|
3733
|
-
if (!(!
|
|
3734
|
-
if (!
|
|
3735
|
-
|
|
3737
|
+
if (!(!x || !e)) {
|
|
3738
|
+
if (!C.current) {
|
|
3739
|
+
C.current = !0;
|
|
3736
3740
|
return;
|
|
3737
3741
|
}
|
|
3738
|
-
|
|
3742
|
+
x.commands.setContent(e);
|
|
3739
3743
|
}
|
|
3740
|
-
}, [
|
|
3741
|
-
|
|
3742
|
-
}, [
|
|
3743
|
-
|
|
3744
|
-
}, [
|
|
3744
|
+
}, [x, e]), M(() => () => {
|
|
3745
|
+
y.current && clearTimeout(y.current), x && (B.destroyPlugins(x), x.destroy());
|
|
3746
|
+
}, [x]), M(() => {
|
|
3747
|
+
x && B.notifyStateChange(x);
|
|
3748
|
+
}, [x, d]), !x)
|
|
3745
3749
|
return null;
|
|
3746
|
-
const
|
|
3750
|
+
const v = H(d), E = m === "saving" ? v.autoSaveSaving : m === "saved" ? v.autoSaveSaved : m === "error" ? v.autoSaveError : "";
|
|
3747
3751
|
return /* @__PURE__ */ L("div", { className: `editor-container flex flex-col h-full ${n}`, children: [
|
|
3748
3752
|
!r && /* @__PURE__ */ L("div", { className: "flex items-center", children: [
|
|
3749
|
-
/* @__PURE__ */
|
|
3750
|
-
|
|
3753
|
+
/* @__PURE__ */ g(Qa, { editor: x }),
|
|
3754
|
+
E && /* @__PURE__ */ g("span", { className: `auto-save-indicator auto-save-indicator--${m} ml-2`, children: E })
|
|
3751
3755
|
] }),
|
|
3752
|
-
!r &&
|
|
3753
|
-
!r &&
|
|
3754
|
-
!r &&
|
|
3756
|
+
!r && x && /* @__PURE__ */ g(ei, { editor: x }),
|
|
3757
|
+
!r && x && /* @__PURE__ */ g(ri, { editor: x, onSelectionOptimize: o }),
|
|
3758
|
+
!r && x && /* @__PURE__ */ g(ai, { editor: x }),
|
|
3755
3759
|
/* @__PURE__ */ L("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
3756
|
-
!r &&
|
|
3757
|
-
/* @__PURE__ */
|
|
3760
|
+
!r && x && /* @__PURE__ */ g(li, { editor: x }),
|
|
3761
|
+
/* @__PURE__ */ g("div", { className: "flex-1 overflow-y-auto bg-white p-4 relative", children: /* @__PURE__ */ g(
|
|
3758
3762
|
di,
|
|
3759
3763
|
{
|
|
3760
|
-
editor:
|
|
3761
|
-
mode: r || !a ||
|
|
3764
|
+
editor: x,
|
|
3765
|
+
mode: r || !a || u.status === "streaming" && u.activeSectionType === "claims" ? "readonly" : "edit"
|
|
3762
3766
|
}
|
|
3763
3767
|
) })
|
|
3764
3768
|
] }),
|
|
3765
|
-
!r && /* @__PURE__ */
|
|
3769
|
+
!r && /* @__PURE__ */ g(ii, { editor: x })
|
|
3766
3770
|
] });
|
|
3767
3771
|
};
|
|
3768
3772
|
function ln(e) {
|
|
@@ -3788,13 +3792,13 @@ function ln(e) {
|
|
|
3788
3792
|
continue;
|
|
3789
3793
|
}
|
|
3790
3794
|
if (!d.startsWith("data: ")) continue;
|
|
3791
|
-
const
|
|
3792
|
-
if (
|
|
3795
|
+
const m = d.slice(6).trim();
|
|
3796
|
+
if (m === "[DONE]") {
|
|
3793
3797
|
a.enqueue({ type: "done" }), a.close();
|
|
3794
3798
|
return;
|
|
3795
3799
|
}
|
|
3796
3800
|
try {
|
|
3797
|
-
const u = JSON.parse(
|
|
3801
|
+
const u = JSON.parse(m), f = l || u.type;
|
|
3798
3802
|
if (f === "delta" || !f && u.content != null)
|
|
3799
3803
|
a.enqueue({
|
|
3800
3804
|
type: "delta",
|
|
@@ -3894,44 +3898,45 @@ function pi(e, t) {
|
|
|
3894
3898
|
};
|
|
3895
3899
|
}
|
|
3896
3900
|
const hi = It(
|
|
3897
|
-
({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, editable: i = !0, language: o, aiService: c, chatSessionAPI: s, aiBaseUrl: l, aiHeaders: d, onSelectionOptimize:
|
|
3898
|
-
const { setEditorLanguage:
|
|
3899
|
-
|
|
3900
|
-
}, []),
|
|
3901
|
+
({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, editable: i = !0, language: o, aiService: c, chatSessionAPI: s, aiBaseUrl: l, aiHeaders: d, onSelectionOptimize: m, patchEditorId: u }, f) => {
|
|
3902
|
+
const { setEditorLanguage: p, setAIService: y, setChatSessionAPI: b } = I(), w = W(null), x = ae((v) => {
|
|
3903
|
+
w.current = v;
|
|
3904
|
+
}, []), C = Ee.useMemo(() => {
|
|
3901
3905
|
if (e) return e;
|
|
3902
3906
|
if (t) return tn(t);
|
|
3903
3907
|
}, [e, t]);
|
|
3904
3908
|
return Ee.useEffect(() => {
|
|
3905
|
-
o &&
|
|
3906
|
-
}, [o,
|
|
3907
|
-
c ?
|
|
3908
|
-
}, [c, l, d,
|
|
3909
|
+
o && p(o);
|
|
3910
|
+
}, [o, p]), Ee.useEffect(() => {
|
|
3911
|
+
c ? y(c) : l && y(fi(l, d));
|
|
3912
|
+
}, [c, l, d, y]), Ee.useEffect(() => {
|
|
3909
3913
|
s ? b(s) : l && b(pi(l, d));
|
|
3910
|
-
}, [s, l, d, b]), Nt(
|
|
3914
|
+
}, [s, l, d, b]), Nt(f, () => ({
|
|
3911
3915
|
getContent: () => {
|
|
3912
|
-
var
|
|
3913
|
-
return ((
|
|
3916
|
+
var v;
|
|
3917
|
+
return ((v = w.current) == null ? void 0 : v.getJSON()) ?? null;
|
|
3914
3918
|
},
|
|
3915
|
-
setContent: (
|
|
3916
|
-
var
|
|
3917
|
-
(
|
|
3919
|
+
setContent: (v) => {
|
|
3920
|
+
var E;
|
|
3921
|
+
(E = w.current) == null || E.commands.setContent(v);
|
|
3918
3922
|
},
|
|
3919
|
-
getEditor: () =>
|
|
3920
|
-
execCommand: async (
|
|
3923
|
+
getEditor: () => w.current,
|
|
3924
|
+
execCommand: async (v, E) => w.current ? ct(w.current).execCommand(v, E) : null,
|
|
3921
3925
|
focus: () => {
|
|
3922
|
-
var
|
|
3923
|
-
(
|
|
3926
|
+
var v;
|
|
3927
|
+
(v = w.current) == null || v.commands.focus();
|
|
3924
3928
|
}
|
|
3925
|
-
})), /* @__PURE__ */
|
|
3929
|
+
})), /* @__PURE__ */ g(
|
|
3926
3930
|
gi,
|
|
3927
3931
|
{
|
|
3928
|
-
initialContent:
|
|
3932
|
+
initialContent: C,
|
|
3929
3933
|
onChange: n,
|
|
3930
|
-
onEditorReady:
|
|
3934
|
+
onEditorReady: x,
|
|
3931
3935
|
className: r,
|
|
3932
3936
|
readOnly: a,
|
|
3933
3937
|
editable: i,
|
|
3934
|
-
onSelectionOptimize:
|
|
3938
|
+
onSelectionOptimize: m,
|
|
3939
|
+
patchEditorId: u
|
|
3935
3940
|
}
|
|
3936
3941
|
);
|
|
3937
3942
|
}
|
|
@@ -3948,8 +3953,8 @@ async function js(e, t, n) {
|
|
|
3948
3953
|
if (l) break;
|
|
3949
3954
|
if (!d) continue;
|
|
3950
3955
|
(i = n.onChunk) == null || i.call(n, d);
|
|
3951
|
-
const
|
|
3952
|
-
e.view.dispatch(
|
|
3956
|
+
const m = e.state.tr.insertText(d, s);
|
|
3957
|
+
e.view.dispatch(m), s = m.mapping.map(s, 1);
|
|
3953
3958
|
}
|
|
3954
3959
|
n.mode === "section" && typeof n.targetSectionPos == "number" && nt(e, n.targetSectionPos), (o = n.onComplete) == null || o.call(n);
|
|
3955
3960
|
} catch (s) {
|
|
@@ -3957,7 +3962,7 @@ async function js(e, t, n) {
|
|
|
3957
3962
|
}
|
|
3958
3963
|
}
|
|
3959
3964
|
async function Gs(e, t, n, r) {
|
|
3960
|
-
var i, o, c, s, l, d,
|
|
3965
|
+
var i, o, c, s, l, d, m, u;
|
|
3961
3966
|
const a = new AbortController();
|
|
3962
3967
|
(i = r.onStart) == null || i.call(r), r.mode === "section" && typeof r.targetSectionPos == "number" && un(e, r.targetSectionPos);
|
|
3963
3968
|
try {
|
|
@@ -3971,33 +3976,33 @@ async function Gs(e, t, n, r) {
|
|
|
3971
3976
|
throw new Error(`HTTP ${f.status}: ${f.statusText}`);
|
|
3972
3977
|
const p = (o = f.body) == null ? void 0 : o.getReader();
|
|
3973
3978
|
if (!p) throw new Error("No response body");
|
|
3974
|
-
const
|
|
3975
|
-
let
|
|
3979
|
+
const y = new TextDecoder();
|
|
3980
|
+
let b = dn(e, r), w = "";
|
|
3976
3981
|
for (; ; ) {
|
|
3977
|
-
const { done:
|
|
3978
|
-
if (
|
|
3979
|
-
|
|
3980
|
-
const
|
|
3982
|
+
const { done: x, value: C } = await p.read();
|
|
3983
|
+
if (x) break;
|
|
3984
|
+
w += y.decode(C, { stream: !0 });
|
|
3985
|
+
const v = w.split(`
|
|
3981
3986
|
`);
|
|
3982
|
-
|
|
3983
|
-
for (const
|
|
3984
|
-
if (!
|
|
3985
|
-
const
|
|
3986
|
-
if (
|
|
3987
|
+
w = v.pop() || "";
|
|
3988
|
+
for (const E of v) {
|
|
3989
|
+
if (!E.startsWith("data: ")) continue;
|
|
3990
|
+
const h = E.slice(6).trim();
|
|
3991
|
+
if (h === "[DONE]")
|
|
3987
3992
|
return r.mode === "section" && typeof r.targetSectionPos == "number" && nt(e, r.targetSectionPos), (c = r.onComplete) == null || c.call(r), { abort: () => a.abort() };
|
|
3988
3993
|
try {
|
|
3989
|
-
const _ = JSON.parse(
|
|
3990
|
-
if (!
|
|
3991
|
-
(l = r.onChunk) == null || l.call(r,
|
|
3992
|
-
const N = e.state.tr.insertText(
|
|
3993
|
-
e.view.dispatch(N),
|
|
3994
|
+
const _ = JSON.parse(h), T = _.content || _.text || ((s = _.delta) == null ? void 0 : s.content) || "";
|
|
3995
|
+
if (!T) continue;
|
|
3996
|
+
(l = r.onChunk) == null || l.call(r, T);
|
|
3997
|
+
const N = e.state.tr.insertText(T, b);
|
|
3998
|
+
e.view.dispatch(N), b = N.mapping.map(b, 1);
|
|
3994
3999
|
} catch {
|
|
3995
4000
|
}
|
|
3996
4001
|
}
|
|
3997
4002
|
}
|
|
3998
4003
|
r.mode === "section" && typeof r.targetSectionPos == "number" && nt(e, r.targetSectionPos), (d = r.onComplete) == null || d.call(r);
|
|
3999
4004
|
} catch (f) {
|
|
4000
|
-
f.name === "AbortError" ? (
|
|
4005
|
+
f.name === "AbortError" ? (m = r.onAbort) == null || m.call(r) : (u = r.onError) == null || u.call(r, f instanceof Error ? f : new Error(String(f)));
|
|
4001
4006
|
}
|
|
4002
4007
|
return { abort: () => a.abort() };
|
|
4003
4008
|
}
|
|
@@ -4358,8 +4363,8 @@ function vi(e) {
|
|
|
4358
4363
|
if (a.length === 0)
|
|
4359
4364
|
return t.push({ number: 1, text: n, dependsOn: [] }), t;
|
|
4360
4365
|
for (let o = 0; o < a.length; o++) {
|
|
4361
|
-
const c = a[o].index + a[o].matchLength, s = o + 1 < a.length ? a[o + 1].index : n.length, l = n.slice(c, s).trim(), d = a[o].number,
|
|
4362
|
-
t.push({ number: d, text: l, dependsOn:
|
|
4366
|
+
const c = a[o].index + a[o].matchLength, s = o + 1 < a.length ? a[o + 1].index : n.length, l = n.slice(c, s).trim(), d = a[o].number, m = wi(l, d);
|
|
4367
|
+
t.push({ number: d, text: l, dependsOn: m });
|
|
4363
4368
|
}
|
|
4364
4369
|
return t;
|
|
4365
4370
|
}
|
|
@@ -4413,33 +4418,33 @@ function Xs(e, t) {
|
|
|
4413
4418
|
for (; p < f.length; ) {
|
|
4414
4419
|
for (; p < f.length && f[p] === "\0"; ) p++;
|
|
4415
4420
|
if (p >= f.length) break;
|
|
4416
|
-
const
|
|
4421
|
+
const y = p;
|
|
4417
4422
|
for (; p < f.length && f[p] !== "\0"; ) p++;
|
|
4418
|
-
const
|
|
4419
|
-
if (
|
|
4420
|
-
for (const
|
|
4423
|
+
const b = ye(i, l + y), w = ye(i, l + p);
|
|
4424
|
+
if (b >= 0 && w >= 0 && w > b)
|
|
4425
|
+
for (const x of Ei(n, b, w))
|
|
4421
4426
|
s.push(
|
|
4422
|
-
re.inline(
|
|
4427
|
+
re.inline(x.from, x.to, { class: "patch-diff-insert-inline" })
|
|
4423
4428
|
);
|
|
4424
4429
|
}
|
|
4425
4430
|
l += f.length;
|
|
4426
4431
|
} else if (u === xi) {
|
|
4427
4432
|
const p = ye(i, l);
|
|
4428
4433
|
if (p >= 0) {
|
|
4429
|
-
const
|
|
4434
|
+
const y = f.replace(/\0/g, " ");
|
|
4430
4435
|
s.push(
|
|
4431
4436
|
re.widget(
|
|
4432
4437
|
p,
|
|
4433
4438
|
() => {
|
|
4434
|
-
const
|
|
4435
|
-
return
|
|
4439
|
+
const b = document.createElement("span");
|
|
4440
|
+
return b.className = "patch-diff-delete", b.textContent = y, b;
|
|
4436
4441
|
},
|
|
4437
4442
|
{ side: -1 }
|
|
4438
4443
|
)
|
|
4439
4444
|
);
|
|
4440
4445
|
}
|
|
4441
4446
|
}
|
|
4442
|
-
const d = be.create(n, s),
|
|
4447
|
+
const d = be.create(n, s), m = new Be({
|
|
4443
4448
|
key: at,
|
|
4444
4449
|
state: {
|
|
4445
4450
|
init: () => d,
|
|
@@ -4451,7 +4456,7 @@ function Xs(e, t) {
|
|
|
4451
4456
|
}
|
|
4452
4457
|
}
|
|
4453
4458
|
});
|
|
4454
|
-
e.registerPlugin(
|
|
4459
|
+
e.registerPlugin(m);
|
|
4455
4460
|
}
|
|
4456
4461
|
function Ys(e) {
|
|
4457
4462
|
e.unregisterPlugin(at);
|
|
@@ -4623,15 +4628,15 @@ function eo(e, t) {
|
|
|
4623
4628
|
}
|
|
4624
4629
|
if (s === "claims") {
|
|
4625
4630
|
const d = /^(\d+)\s*[.、]/;
|
|
4626
|
-
o.forEach((
|
|
4627
|
-
if (
|
|
4628
|
-
const f =
|
|
4631
|
+
o.forEach((m, u) => {
|
|
4632
|
+
if (m.type.name !== "paragraph") return;
|
|
4633
|
+
const f = m.textContent.trim(), p = d.exec(f);
|
|
4629
4634
|
if (!p) return;
|
|
4630
|
-
const
|
|
4635
|
+
const y = p[1];
|
|
4631
4636
|
f.length > 0 && !f.endsWith("。") && !f.endsWith(".") && n.push({
|
|
4632
4637
|
id: i(),
|
|
4633
4638
|
severity: "warning",
|
|
4634
|
-
message: r ? `权利要求${
|
|
4639
|
+
message: r ? `权利要求${y}末尾应以句号结束` : `Claim ${y} should end with a period`,
|
|
4635
4640
|
pos: c + 1 + u
|
|
4636
4641
|
});
|
|
4637
4642
|
});
|