patent-editor 0.1.9 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib.css +1 -1
- package/dist/lib.js +531 -547
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/lib.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var On = (e, t, n) => t in e ?
|
|
3
|
-
var
|
|
1
|
+
var Mn = Object.defineProperty;
|
|
2
|
+
var On = (e, t, n) => t in e ? Mn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var Oe = (e, t, n) => On(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsx as f, jsxs as L, Fragment as Se } from "react/jsx-runtime";
|
|
5
|
-
import
|
|
5
|
+
import $e, { forwardRef as qt, useState as z, useEffect as B, useCallback as de, useImperativeHandle as Vt, useRef as X, useMemo as Ee } from "react";
|
|
6
6
|
import { Extension as Ze, ReactRenderer as $n, Node as ee, mergeAttributes as se, NodeViewWrapper as Fn, ReactNodeViewRenderer as Kt, useEditorState as zn, EditorContent as Bn, useEditor as Hn } from "@tiptap/react";
|
|
7
7
|
import Un from "@tiptap/extension-document";
|
|
8
8
|
import jn from "@tiptap/extension-paragraph";
|
|
@@ -26,11 +26,11 @@ import ir from "@tiptap/extension-history";
|
|
|
26
26
|
import { dropCursor as or } from "prosemirror-dropcursor";
|
|
27
27
|
import { gapCursor as cr } from "prosemirror-gapcursor";
|
|
28
28
|
import lr from "@tiptap/extension-text-align";
|
|
29
|
-
import { PluginKey as
|
|
29
|
+
import { PluginKey as Ae, Plugin as et, TextSelection as Ge } from "@tiptap/pm/state";
|
|
30
30
|
import dr from "@tiptap/suggestion";
|
|
31
31
|
import ur from "tippy.js";
|
|
32
32
|
import { create as mr } from "zustand";
|
|
33
|
-
import { DecorationSet as
|
|
33
|
+
import { DecorationSet as _e, Decoration as le } from "@tiptap/pm/view";
|
|
34
34
|
import { diff_match_patch as Jt } from "diff-match-patch";
|
|
35
35
|
import fr from "@tiptap/extension-bold";
|
|
36
36
|
import gr from "@tiptap/extension-italic";
|
|
@@ -49,12 +49,12 @@ import "mathlive";
|
|
|
49
49
|
import { findWrapping as Ir } from "@tiptap/pm/transform";
|
|
50
50
|
import { Slice as Er, Fragment as Nr } from "@tiptap/pm/model";
|
|
51
51
|
import { createPortal as _r } from "react-dom";
|
|
52
|
-
import { Undo2 as kr, Redo2 as Ar, Bold as Xt, Italic as Yt, Underline as Qt, Strikethrough as Zt, Code as en, Superscript as tn, Subscript as nn, Pilcrow as Lr, Heading1 as Pr, Heading2 as
|
|
52
|
+
import { Undo2 as kr, Redo2 as Ar, Bold as Xt, Italic as Yt, Underline as Qt, Strikethrough as Zt, Code as en, Superscript as tn, Subscript as nn, Pilcrow as Lr, Heading1 as Pr, Heading2 as Rr, Heading3 as Dr, AlignLeft as Mr, AlignCenter as Or, AlignRight as $r, AlignJustify as Fr, List as zr, ListOrdered as Br, Quote as Hr, FileCode2 as Ur, Table as jr, Minus as Wr, CheckSquare as Gr, Image as rn, Link2 as vt, FileText as an, Box as qr, Workflow as Vr, FunctionSquare as Kr, Sigma as Jr, GitGraph as Xr, Square as _t, Download as Yr, ChevronDown as sn, Trash2 as Qr, Highlighter as Zr, Sparkles as ea, CaseSensitive as ta, ChevronUp as na, Replace as kt, X as ra, ReplaceAll as aa, PanelLeft as sa, PanelLeftClose as ia } from "lucide-react";
|
|
53
53
|
import ae from "clsx";
|
|
54
54
|
import { convertMillimetersToTwip as Ie, Document as oa, Packer as ca, Paragraph as tt, AlignmentType as Ct, TextRun as nt } from "docx";
|
|
55
55
|
import { saveAs as la } from "file-saver";
|
|
56
56
|
import { BubbleMenu as da } from "@tiptap/react/menus";
|
|
57
|
-
const ua = new
|
|
57
|
+
const ua = new Ae("slashCommand"), ma = Ze.create({
|
|
58
58
|
name: "slashCommand",
|
|
59
59
|
addOptions() {
|
|
60
60
|
return {
|
|
@@ -83,7 +83,7 @@ const ua = new Le("slashCommand"), ma = Ze.create({
|
|
|
83
83
|
regenerate: !1,
|
|
84
84
|
chatReferences: [],
|
|
85
85
|
pendingChatMessage: null
|
|
86
|
-
},
|
|
86
|
+
}, _ = mr((e) => ({
|
|
87
87
|
editor: null,
|
|
88
88
|
document: null,
|
|
89
89
|
selection: null,
|
|
@@ -301,7 +301,7 @@ function ga(e) {
|
|
|
301
301
|
description: t ? "插入权利要求条目 (Ctrl+Shift+C)" : "Insert a patent claim block (Ctrl+Shift+C)",
|
|
302
302
|
icon: "§",
|
|
303
303
|
command: ({ editor: n, range: r }) => {
|
|
304
|
-
n.chain().focus().deleteRange(r).run(),
|
|
304
|
+
n.chain().focus().deleteRange(r).run(), Le(n).execCommand("insertClaim");
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
];
|
|
@@ -310,7 +310,7 @@ function pa() {
|
|
|
310
310
|
return {
|
|
311
311
|
char: "/",
|
|
312
312
|
items: ({ query: e }) => {
|
|
313
|
-
const t =
|
|
313
|
+
const t = _.getState().editorLanguage, n = ga(t);
|
|
314
314
|
if (!e) return n;
|
|
315
315
|
const r = e.toLowerCase();
|
|
316
316
|
return n.filter(
|
|
@@ -351,8 +351,8 @@ function pa() {
|
|
|
351
351
|
}
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
|
-
const ha = new
|
|
355
|
-
function
|
|
354
|
+
const ha = new Ae("searchReplace");
|
|
355
|
+
function Fe(e, t, n) {
|
|
356
356
|
if (!t) return [];
|
|
357
357
|
const r = [], a = e.textBetween(0, e.content.size, `
|
|
358
358
|
`, "\0"), s = n ? t : t.toLowerCase(), i = n ? a : a.toLowerCase();
|
|
@@ -365,9 +365,9 @@ function ze(e, t, n) {
|
|
|
365
365
|
if (o !== -1 && u !== -1) return !1;
|
|
366
366
|
if (m.isText) {
|
|
367
367
|
const g = m.text || "";
|
|
368
|
-
for (let
|
|
369
|
-
if (d === c && (o = p +
|
|
370
|
-
return u = p +
|
|
368
|
+
for (let h = 0; h < g.length; h++) {
|
|
369
|
+
if (d === c && (o = p + h), d === c + s.length)
|
|
370
|
+
return u = p + h, !1;
|
|
371
371
|
d++;
|
|
372
372
|
}
|
|
373
373
|
d === c + s.length && u === -1 && (u = p + g.length);
|
|
@@ -390,9 +390,9 @@ const ya = Ze.create({
|
|
|
390
390
|
},
|
|
391
391
|
addCommands() {
|
|
392
392
|
return {
|
|
393
|
-
setSearchTerm: (e) => ({ editor: t }) => (this.storage.searchTerm = e, this.storage.results =
|
|
393
|
+
setSearchTerm: (e) => ({ editor: t }) => (this.storage.searchTerm = e, this.storage.results = Fe(t.state.doc, e, this.storage.caseSensitive), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
|
|
394
394
|
setReplaceTerm: (e) => () => (this.storage.replaceTerm = e, !0),
|
|
395
|
-
setCaseSensitive: (e) => ({ editor: t }) => (this.storage.caseSensitive = e, this.storage.results =
|
|
395
|
+
setCaseSensitive: (e) => ({ editor: t }) => (this.storage.caseSensitive = e, this.storage.results = Fe(t.state.doc, this.storage.searchTerm, e), this.storage.currentIndex = this.storage.results.length > 0 ? 0 : -1, t.view.dispatch(t.state.tr), !0),
|
|
396
396
|
nextSearchResult: () => ({ editor: e }) => {
|
|
397
397
|
if (this.storage.results.length === 0) return !1;
|
|
398
398
|
this.storage.currentIndex = (this.storage.currentIndex + 1) % this.storage.results.length;
|
|
@@ -408,12 +408,12 @@ const ya = Ze.create({
|
|
|
408
408
|
replaceCurrent: () => ({ editor: e }) => {
|
|
409
409
|
if (this.storage.results.length === 0 || this.storage.currentIndex < 0) return !1;
|
|
410
410
|
const t = this.storage.results[this.storage.currentIndex];
|
|
411
|
-
return t ? (e.chain().focus().insertContentAt(t, this.storage.replaceTerm).run(), this.storage.results =
|
|
411
|
+
return t ? (e.chain().focus().insertContentAt(t, this.storage.replaceTerm).run(), this.storage.results = Fe(e.state.doc, this.storage.searchTerm, this.storage.caseSensitive), this.storage.currentIndex >= this.storage.results.length && (this.storage.currentIndex = 0), e.view.dispatch(e.state.tr), !0) : !1;
|
|
412
412
|
},
|
|
413
413
|
replaceAll: () => ({ editor: e }) => {
|
|
414
414
|
if (this.storage.results.length === 0) return !1;
|
|
415
415
|
const { searchTerm: t, replaceTerm: n, caseSensitive: r } = this.storage;
|
|
416
|
-
let a =
|
|
416
|
+
let a = Fe(e.state.doc, t, r);
|
|
417
417
|
const s = e.state.tr;
|
|
418
418
|
let i = 0;
|
|
419
419
|
for (const l of a) {
|
|
@@ -445,12 +445,12 @@ const ya = Ze.create({
|
|
|
445
445
|
props: {
|
|
446
446
|
decorations: (t) => {
|
|
447
447
|
if (!e.searchTerm || e.results.length === 0)
|
|
448
|
-
return
|
|
448
|
+
return _e.empty;
|
|
449
449
|
const n = e.results.map((r, a) => {
|
|
450
450
|
const s = a === e.currentIndex ? "search-highlight search-highlight--current" : "search-highlight";
|
|
451
451
|
return le.inline(r.from, r.to, { class: s });
|
|
452
452
|
});
|
|
453
|
-
return
|
|
453
|
+
return _e.create(t.doc, n);
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
})
|
|
@@ -471,7 +471,7 @@ let st = null;
|
|
|
471
471
|
function Ca() {
|
|
472
472
|
return st || (st = new Jt()), st;
|
|
473
473
|
}
|
|
474
|
-
const cn = new
|
|
474
|
+
const cn = new Ae("patchDiff");
|
|
475
475
|
function wa(e, t) {
|
|
476
476
|
let n = null;
|
|
477
477
|
return e.state.doc.descendants((r, a) => n ? !1 : r.type.name === "patent_section" && r.attrs.sectionType === t ? (n = { from: a + 1, to: a + r.nodeSize - 1 }, !1) : !0), n;
|
|
@@ -486,7 +486,7 @@ function ln(e, t, n) {
|
|
|
486
486
|
} else i.isLeaf ? (a += "\0", s = !1) : !s && i.isBlock && (a += "\0", s = !0);
|
|
487
487
|
}), { text: a, segments: r };
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function Ne(e, t) {
|
|
490
490
|
for (const n of e)
|
|
491
491
|
if (t >= n.textIdx && t <= n.textIdx + n.len)
|
|
492
492
|
return n.docPos + (t - n.textIdx);
|
|
@@ -498,7 +498,7 @@ function Pt(e, t, n, r, a) {
|
|
|
498
498
|
for (; l <= s.length - t.length; ) {
|
|
499
499
|
const c = s.indexOf(t, l);
|
|
500
500
|
if (c === -1) return null;
|
|
501
|
-
const d =
|
|
501
|
+
const d = Ne(i, c), o = Ne(i, c + t.length);
|
|
502
502
|
if (d >= 0 && o >= 0 && !(a && a.has(d)))
|
|
503
503
|
return { from: d, to: o };
|
|
504
504
|
l = c + 1;
|
|
@@ -652,7 +652,7 @@ function Ta() {
|
|
|
652
652
|
props: {
|
|
653
653
|
decorations(e) {
|
|
654
654
|
const t = q.filter((r) => r.status === "pending");
|
|
655
|
-
if (t.length === 0) return
|
|
655
|
+
if (t.length === 0) return _e.empty;
|
|
656
656
|
const n = [];
|
|
657
657
|
for (const r of t) {
|
|
658
658
|
if (r.type === "replace") {
|
|
@@ -689,7 +689,7 @@ function Ta() {
|
|
|
689
689
|
})
|
|
690
690
|
);
|
|
691
691
|
}
|
|
692
|
-
return
|
|
692
|
+
return _e.create(e.doc, n);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
695
|
});
|
|
@@ -818,7 +818,7 @@ const Ia = ee.create({
|
|
|
818
818
|
];
|
|
819
819
|
class La {
|
|
820
820
|
constructor() {
|
|
821
|
-
|
|
821
|
+
Oe(this, "commands", /* @__PURE__ */ new Map());
|
|
822
822
|
}
|
|
823
823
|
normalizeCommand(t) {
|
|
824
824
|
return typeof t == "function" ? {
|
|
@@ -856,23 +856,23 @@ class La {
|
|
|
856
856
|
durationMs: Date.now() - s
|
|
857
857
|
}), !1;
|
|
858
858
|
try {
|
|
859
|
-
const
|
|
860
|
-
!
|
|
861
|
-
const
|
|
859
|
+
const h = !!await d.execute(n, r);
|
|
860
|
+
!h && c && l && n.editor.commands.setContent(c);
|
|
861
|
+
const b = {
|
|
862
862
|
name: t,
|
|
863
|
-
success:
|
|
863
|
+
success: h,
|
|
864
864
|
durationMs: Date.now() - s
|
|
865
865
|
};
|
|
866
|
-
return (m = a.onComplete) == null || m.call(a,
|
|
866
|
+
return (m = a.onComplete) == null || m.call(a, b), h;
|
|
867
867
|
} catch (g) {
|
|
868
868
|
c && l && n.editor.commands.setContent(c);
|
|
869
|
-
const
|
|
869
|
+
const h = {
|
|
870
870
|
name: t,
|
|
871
871
|
success: !1,
|
|
872
872
|
durationMs: Date.now() - s,
|
|
873
873
|
error: g
|
|
874
874
|
};
|
|
875
|
-
return (p = a.onComplete) == null || p.call(a,
|
|
875
|
+
return (p = a.onComplete) == null || p.call(a, h), !1;
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
878
|
getCommand(t) {
|
|
@@ -885,8 +885,8 @@ class La {
|
|
|
885
885
|
const pe = new La();
|
|
886
886
|
class Pa {
|
|
887
887
|
constructor() {
|
|
888
|
-
|
|
889
|
-
|
|
888
|
+
Oe(this, "plugins", /* @__PURE__ */ new Map());
|
|
889
|
+
Oe(this, "lifecycleOrder", ["register", "init", "stateSync", "destroy"]);
|
|
890
890
|
}
|
|
891
891
|
logLifecycle(t, n) {
|
|
892
892
|
t !== "stateSync" && console.info(`[PluginManager:${t}] ${n}`);
|
|
@@ -968,7 +968,7 @@ class Pa {
|
|
|
968
968
|
});
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
|
-
const G = new Pa(),
|
|
971
|
+
const G = new Pa(), Rt = {
|
|
972
972
|
zh: {
|
|
973
973
|
language: "语言",
|
|
974
974
|
bold: "加粗",
|
|
@@ -1135,13 +1135,13 @@ const G = new Pa(), Dt = {
|
|
|
1135
1135
|
autoSaveSaved: "Saved",
|
|
1136
1136
|
autoSaveError: "Save failed"
|
|
1137
1137
|
}
|
|
1138
|
-
}, j = (e) => e === "en" ?
|
|
1139
|
-
let
|
|
1140
|
-
const
|
|
1138
|
+
}, j = (e) => e === "en" ? Rt.en : Rt.zh, ye = (e, t, n, r) => e === "en" ? t === "forward_reference" ? `Claim ${n} references later claim ${r}.` : t === "self_reference" ? `Claim ${n} references itself.` : `Claim ${n} has circular dependency.` : t === "forward_reference" ? `权利要求${n}引用了后置项权利要求${r}。` : t === "self_reference" ? `权利要求${n}引用了自身。` : `权利要求${n}存在循环依赖。`;
|
|
1139
|
+
let ze = 0;
|
|
1140
|
+
const Be = () => {
|
|
1141
1141
|
document.querySelectorAll('body > svg[id^="standalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
|
|
1142
1142
|
(e.id.startsWith("dmermaid") || e.id.startsWith("dstandalone")) && e.remove();
|
|
1143
1143
|
}), document.querySelectorAll('body > div[id^="dstandalone-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > div[id^="dmermaid"]').forEach((e) => e.remove()), document.querySelectorAll('body > div[id^="standalone-mermaid-"]').forEach((e) => e.remove());
|
|
1144
|
-
},
|
|
1144
|
+
}, Ra = ee.create({
|
|
1145
1145
|
name: "mermaid",
|
|
1146
1146
|
group: "block",
|
|
1147
1147
|
atom: !0,
|
|
@@ -1179,86 +1179,86 @@ const He = () => {
|
|
|
1179
1179
|
p.className = "mermaid-cancel-btn", p.type = "button";
|
|
1180
1180
|
const g = document.createElement("button");
|
|
1181
1181
|
g.className = "mermaid-save-btn", g.type = "button", u.append(m, p, g), d.append(o, u), s.append(i, d);
|
|
1182
|
-
const
|
|
1183
|
-
const
|
|
1184
|
-
typeof
|
|
1182
|
+
const h = (y) => {
|
|
1183
|
+
const I = typeof n == "function" ? n() : null;
|
|
1184
|
+
typeof I == "number" && e.commands.command(({ tr: k, dispatch: D }) => (k.setNodeMarkup(I, void 0, { ...r.attrs, ...y }), D && D(k), !0));
|
|
1185
1185
|
};
|
|
1186
|
-
let
|
|
1187
|
-
const
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1190
|
-
if (!
|
|
1191
|
-
l.innerHTML = "",
|
|
1186
|
+
let b = "";
|
|
1187
|
+
const v = async (y) => {
|
|
1188
|
+
const I = y.trim();
|
|
1189
|
+
if (I !== b) {
|
|
1190
|
+
if (!I) {
|
|
1191
|
+
l.innerHTML = "", b = "";
|
|
1192
1192
|
return;
|
|
1193
1193
|
}
|
|
1194
1194
|
try {
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1197
|
-
const
|
|
1198
|
-
l.innerHTML =
|
|
1195
|
+
const k = await import("mermaid");
|
|
1196
|
+
k.default.initialize({ startOnLoad: !1, theme: "default" }), ze += 1;
|
|
1197
|
+
const D = `standalone-mermaid-${ze}`, { svg: M } = await k.default.render(D, I);
|
|
1198
|
+
l.innerHTML = M, b = I;
|
|
1199
1199
|
} catch {
|
|
1200
|
-
l.innerHTML = "",
|
|
1200
|
+
l.innerHTML = "", b = "";
|
|
1201
1201
|
} finally {
|
|
1202
|
-
|
|
1202
|
+
Be();
|
|
1203
1203
|
}
|
|
1204
1204
|
}
|
|
1205
|
-
},
|
|
1206
|
-
a || (a = !0, o.value = typeof r.attrs.code == "string" ? r.attrs.code : "", m.textContent = "", m.style.display = "none",
|
|
1205
|
+
}, w = () => {
|
|
1206
|
+
a || (a = !0, o.value = typeof r.attrs.code == "string" ? r.attrs.code : "", m.textContent = "", m.style.display = "none", T(), requestAnimationFrame(() => o.focus()));
|
|
1207
1207
|
}, C = () => {
|
|
1208
|
-
a = !1,
|
|
1209
|
-
},
|
|
1210
|
-
const
|
|
1208
|
+
a = !1, T();
|
|
1209
|
+
}, S = async () => {
|
|
1210
|
+
const y = o.value;
|
|
1211
1211
|
m.textContent = "", m.style.display = "none";
|
|
1212
|
-
const
|
|
1213
|
-
if (
|
|
1212
|
+
const I = y.trim();
|
|
1213
|
+
if (I)
|
|
1214
1214
|
try {
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1217
|
-
const
|
|
1218
|
-
l.innerHTML =
|
|
1215
|
+
const k = await import("mermaid");
|
|
1216
|
+
k.default.initialize({ startOnLoad: !1, theme: "default" }), ze += 1;
|
|
1217
|
+
const D = `standalone-mermaid-${ze}`, { svg: M } = await k.default.render(D, I);
|
|
1218
|
+
l.innerHTML = M, b = I, Be();
|
|
1219
1219
|
} catch {
|
|
1220
|
-
|
|
1221
|
-
const
|
|
1222
|
-
m.textContent =
|
|
1220
|
+
Be();
|
|
1221
|
+
const k = _.getState().editorLanguage;
|
|
1222
|
+
m.textContent = k === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", m.style.display = "inline";
|
|
1223
1223
|
return;
|
|
1224
1224
|
}
|
|
1225
|
-
|
|
1225
|
+
h({ code: y }), a = !1, T();
|
|
1226
1226
|
};
|
|
1227
|
-
i.addEventListener("dblclick", (
|
|
1228
|
-
|
|
1229
|
-
}), g.addEventListener("click", (
|
|
1230
|
-
|
|
1231
|
-
}), p.addEventListener("click", (
|
|
1232
|
-
|
|
1233
|
-
}), o.addEventListener("mousedown", (
|
|
1234
|
-
const
|
|
1235
|
-
const
|
|
1236
|
-
i.style.display = a ? "none" : "block", d.style.display = a ? "block" : "none", g.textContent =
|
|
1237
|
-
const
|
|
1238
|
-
a || (
|
|
1227
|
+
i.addEventListener("dblclick", (y) => {
|
|
1228
|
+
y.preventDefault(), y.stopPropagation(), w();
|
|
1229
|
+
}), g.addEventListener("click", (y) => {
|
|
1230
|
+
y.stopPropagation(), S();
|
|
1231
|
+
}), p.addEventListener("click", (y) => {
|
|
1232
|
+
y.stopPropagation(), C();
|
|
1233
|
+
}), o.addEventListener("mousedown", (y) => y.stopPropagation()), o.addEventListener("keydown", (y) => y.stopPropagation()), o.addEventListener("keypress", (y) => y.stopPropagation());
|
|
1234
|
+
const T = () => {
|
|
1235
|
+
const y = _.getState().editorLanguage, I = j(y), k = typeof r.attrs.code == "string" ? r.attrs.code : "";
|
|
1236
|
+
i.style.display = a ? "none" : "block", d.style.display = a ? "block" : "none", g.textContent = I.mermaidSaveAndRender || "保存并渲染", p.textContent = I.mermaidCancel || "取消";
|
|
1237
|
+
const D = k.trim().length > 0, M = l.querySelector("svg") !== null;
|
|
1238
|
+
a || (D && M ? (c.textContent = I.mermaidDoubleClickToEdit || "双击编辑", c.className = "mermaid-view-hint mermaid-view-hint--subtle") : (c.textContent = I.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", c.className = "mermaid-view-hint mermaid-view-hint--empty")), !a && k.trim() !== b && v(k);
|
|
1239
1239
|
};
|
|
1240
|
-
let A =
|
|
1241
|
-
const P =
|
|
1242
|
-
|
|
1240
|
+
let A = _.getState().editorLanguage;
|
|
1241
|
+
const P = _.subscribe((y) => {
|
|
1242
|
+
y.editorLanguage !== A && (A = y.editorLanguage, T());
|
|
1243
1243
|
});
|
|
1244
|
-
return
|
|
1244
|
+
return T(), {
|
|
1245
1245
|
dom: s,
|
|
1246
|
-
stopEvent: (
|
|
1247
|
-
const
|
|
1248
|
-
return !!(
|
|
1246
|
+
stopEvent: (y) => {
|
|
1247
|
+
const I = y.target;
|
|
1248
|
+
return !!(I === o || d.contains(I));
|
|
1249
1249
|
},
|
|
1250
1250
|
ignoreMutation: () => !0,
|
|
1251
|
-
update: (
|
|
1251
|
+
update: (y) => y.type.name !== "mermaid" ? !1 : (r = y, T(), !0),
|
|
1252
1252
|
destroy: () => {
|
|
1253
|
-
P(),
|
|
1253
|
+
P(), Be();
|
|
1254
1254
|
}
|
|
1255
1255
|
};
|
|
1256
1256
|
};
|
|
1257
1257
|
}
|
|
1258
|
-
}),
|
|
1258
|
+
}), Da = {
|
|
1259
1259
|
name: "mermaid",
|
|
1260
1260
|
version: "1.0.0",
|
|
1261
|
-
extensions: [
|
|
1261
|
+
extensions: [Ra],
|
|
1262
1262
|
toolbarItems: [
|
|
1263
1263
|
{
|
|
1264
1264
|
id: "mermaid-insert",
|
|
@@ -1282,7 +1282,7 @@ const He = () => {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
1284
1284
|
}
|
|
1285
|
-
},
|
|
1285
|
+
}, Ma = ee.create({
|
|
1286
1286
|
name: "drawio",
|
|
1287
1287
|
group: "block",
|
|
1288
1288
|
atom: !0,
|
|
@@ -1309,71 +1309,71 @@ const He = () => {
|
|
|
1309
1309
|
l.className = "drawio-preview-img", l.style.display = "none";
|
|
1310
1310
|
const c = document.createElement("div");
|
|
1311
1311
|
c.className = "drawio-view-hint", i.append(l, c), s.append(i);
|
|
1312
|
-
const d = (
|
|
1312
|
+
const d = (w) => {
|
|
1313
1313
|
const C = typeof n == "function" ? n() : null;
|
|
1314
|
-
typeof C == "number" && e.commands.command(({ tr:
|
|
1314
|
+
typeof C == "number" && e.commands.command(({ tr: S, dispatch: T }) => (S.setNodeMarkup(C, void 0, { ...r.attrs, ...w }), T && T(S), !0));
|
|
1315
1315
|
};
|
|
1316
1316
|
let o = null, u = null, m = null;
|
|
1317
1317
|
const p = () => {
|
|
1318
1318
|
if (a) return;
|
|
1319
1319
|
a = !0, u = document.createElement("div"), u.className = "drawio-modal-overlay";
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1320
|
+
const w = document.createElement("div");
|
|
1321
|
+
w.className = "drawio-modal-content";
|
|
1322
1322
|
const C = document.createElement("div");
|
|
1323
1323
|
C.className = "drawio-modal-header";
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1324
|
+
const S = _.getState().editorLanguage, T = document.createElement("span");
|
|
1325
|
+
T.textContent = S === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", T.className = "drawio-modal-title";
|
|
1326
1326
|
const A = document.createElement("button");
|
|
1327
|
-
A.className = "drawio-modal-close-btn", A.textContent = "✕", A.type = "button", A.addEventListener("click", () => g()), C.append(
|
|
1328
|
-
const P =
|
|
1327
|
+
A.className = "drawio-modal-close-btn", A.textContent = "✕", A.type = "button", A.addEventListener("click", () => g()), C.append(T, A), m = document.createElement("iframe"), m.className = "drawio-modal-iframe", m.setAttribute("frameborder", "0"), w.append(C, m), u.appendChild(w), document.body.appendChild(u);
|
|
1328
|
+
const P = S === "en" ? "en" : "zh";
|
|
1329
1329
|
m.src = `https://embed.diagrams.net/?embed=1&proto=json&spin=1&lang=${P}`;
|
|
1330
|
-
const
|
|
1331
|
-
o = (
|
|
1332
|
-
var
|
|
1333
|
-
if (!
|
|
1334
|
-
let
|
|
1330
|
+
const y = m;
|
|
1331
|
+
o = (I) => {
|
|
1332
|
+
var D, M;
|
|
1333
|
+
if (!y || I.source !== y.contentWindow) return;
|
|
1334
|
+
let k;
|
|
1335
1335
|
try {
|
|
1336
|
-
|
|
1336
|
+
k = typeof I.data == "string" ? JSON.parse(I.data) : I.data;
|
|
1337
1337
|
} catch {
|
|
1338
1338
|
return;
|
|
1339
1339
|
}
|
|
1340
|
-
if (
|
|
1340
|
+
if (k.event === "init") {
|
|
1341
1341
|
const Q = typeof r.attrs.xml == "string" ? r.attrs.xml : "";
|
|
1342
|
-
(
|
|
1342
|
+
(D = y.contentWindow) == null || D.postMessage(
|
|
1343
1343
|
JSON.stringify({ action: "load", autosave: 0, xml: Q || "" }),
|
|
1344
1344
|
"*"
|
|
1345
1345
|
);
|
|
1346
|
-
} else if (
|
|
1347
|
-
const Q =
|
|
1348
|
-
(
|
|
1346
|
+
} else if (k.event === "save") {
|
|
1347
|
+
const Q = k.xml || "";
|
|
1348
|
+
(M = y.contentWindow) == null || M.postMessage(
|
|
1349
1349
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1350
1350
|
"*"
|
|
1351
1351
|
), d({ xml: Q });
|
|
1352
|
-
} else if (
|
|
1353
|
-
const Q =
|
|
1352
|
+
} else if (k.event === "export") {
|
|
1353
|
+
const Q = k.data || "";
|
|
1354
1354
|
d({ svg: Q }), g();
|
|
1355
|
-
} else
|
|
1355
|
+
} else k.event === "exit" && g();
|
|
1356
1356
|
}, window.addEventListener("message", o);
|
|
1357
1357
|
}, g = () => {
|
|
1358
|
-
a = !1, o && (window.removeEventListener("message", o), o = null), m && (m.src = "about:blank", m = null), u && (u.remove(), u = null),
|
|
1358
|
+
a = !1, o && (window.removeEventListener("message", o), o = null), m && (m.src = "about:blank", m = null), u && (u.remove(), u = null), h();
|
|
1359
1359
|
};
|
|
1360
|
-
i.addEventListener("dblclick", (
|
|
1361
|
-
|
|
1360
|
+
i.addEventListener("dblclick", (w) => {
|
|
1361
|
+
w.preventDefault(), w.stopPropagation(), p();
|
|
1362
1362
|
});
|
|
1363
|
-
const
|
|
1364
|
-
const
|
|
1365
|
-
|
|
1363
|
+
const h = () => {
|
|
1364
|
+
const w = _.getState().editorLanguage, C = j(w), S = typeof r.attrs.svg == "string" ? r.attrs.svg : "";
|
|
1365
|
+
S ? (l.src = S, l.style.display = "block") : (l.src = "", l.style.display = "none"), S ? (c.textContent = C.mermaidDoubleClickToEdit || "双击编辑", c.className = "drawio-view-hint drawio-view-hint--subtle") : (c.textContent = C.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", c.className = "drawio-view-hint drawio-view-hint--empty");
|
|
1366
1366
|
};
|
|
1367
|
-
let
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1367
|
+
let b = _.getState().editorLanguage;
|
|
1368
|
+
const v = _.subscribe((w) => {
|
|
1369
|
+
w.editorLanguage !== b && (b = w.editorLanguage, h());
|
|
1370
1370
|
});
|
|
1371
|
-
return
|
|
1371
|
+
return h(), {
|
|
1372
1372
|
dom: s,
|
|
1373
1373
|
ignoreMutation: () => !0,
|
|
1374
|
-
update: (
|
|
1374
|
+
update: (w) => w.type.name !== "drawio" ? !1 : (r = w, h(), !0),
|
|
1375
1375
|
destroy: () => {
|
|
1376
|
-
|
|
1376
|
+
v(), o && (window.removeEventListener("message", o), o = null), m && (m.src = "about:blank", m = null), u && (u.remove(), u = null);
|
|
1377
1377
|
}
|
|
1378
1378
|
};
|
|
1379
1379
|
};
|
|
@@ -1381,7 +1381,7 @@ const He = () => {
|
|
|
1381
1381
|
}), Oa = {
|
|
1382
1382
|
name: "drawio",
|
|
1383
1383
|
version: "1.0.0",
|
|
1384
|
-
extensions: [
|
|
1384
|
+
extensions: [Ma],
|
|
1385
1385
|
toolbarItems: [
|
|
1386
1386
|
{
|
|
1387
1387
|
id: "drawio-insert",
|
|
@@ -1420,38 +1420,38 @@ const He = () => {
|
|
|
1420
1420
|
const u = de(() => {
|
|
1421
1421
|
c.current || (c.current = !0, i(!0));
|
|
1422
1422
|
}, []), m = de(() => {
|
|
1423
|
-
var
|
|
1423
|
+
var h, b;
|
|
1424
1424
|
if (!c.current) return;
|
|
1425
1425
|
c.current = !1;
|
|
1426
|
-
const g = ((
|
|
1427
|
-
d.current({ latex: g }), i(!1), (
|
|
1426
|
+
const g = ((h = a.current) == null ? void 0 : h.value) ?? o.current;
|
|
1427
|
+
d.current({ latex: g }), i(!1), (b = globalThis.mathVirtualKeyboard) == null || b.hide({ animate: !0 });
|
|
1428
1428
|
}, []);
|
|
1429
1429
|
B(() => {
|
|
1430
|
-
var
|
|
1431
|
-
const g = !!((
|
|
1430
|
+
var h, b, v;
|
|
1431
|
+
const g = !!((v = (b = (h = r == null ? void 0 : r.view) == null ? void 0 : h.state) == null ? void 0 : b.selection) != null && v.empty);
|
|
1432
1432
|
n && g && u();
|
|
1433
1433
|
}, [n, u]), B(() => {
|
|
1434
1434
|
s && requestAnimationFrame(() => {
|
|
1435
|
-
var
|
|
1435
|
+
var h;
|
|
1436
1436
|
const g = a.current;
|
|
1437
|
-
g && (g.virtualKeyboardMode = "onfocus", (
|
|
1437
|
+
g && (g.virtualKeyboardMode = "onfocus", (h = g.focus) == null || h.call(g));
|
|
1438
1438
|
});
|
|
1439
1439
|
}, [s]), B(() => {
|
|
1440
1440
|
if (!s) return;
|
|
1441
1441
|
const g = a.current;
|
|
1442
1442
|
if (!g) return;
|
|
1443
|
-
const
|
|
1443
|
+
const h = () => {
|
|
1444
1444
|
setTimeout(() => {
|
|
1445
|
-
var
|
|
1445
|
+
var w, C, S;
|
|
1446
1446
|
if (!c.current) return;
|
|
1447
|
-
const
|
|
1448
|
-
(
|
|
1447
|
+
const v = document.activeElement;
|
|
1448
|
+
(v == null ? void 0 : v.tagName) === "MATH-FIELD" || (w = v == null ? void 0 : v.closest) != null && w.call(v, "math-field") || (C = v == null ? void 0 : v.closest) != null && C.call(v, ".ML__keyboard") || (S = document.querySelector(".ML__keyboard")) != null && S.contains(v) || m();
|
|
1449
1449
|
}, 300);
|
|
1450
|
-
},
|
|
1451
|
-
|
|
1450
|
+
}, b = (v) => {
|
|
1451
|
+
v.key === "Escape" && m();
|
|
1452
1452
|
};
|
|
1453
|
-
return g.addEventListener("focusout",
|
|
1454
|
-
g.removeEventListener("focusout",
|
|
1453
|
+
return g.addEventListener("focusout", h), g.addEventListener("keydown", b), () => {
|
|
1454
|
+
g.removeEventListener("focusout", h), g.removeEventListener("keydown", b);
|
|
1455
1455
|
};
|
|
1456
1456
|
}, [s, m]), B(() => {
|
|
1457
1457
|
!s && a.current && a.current.value !== e.attrs.latex && (a.current.value = e.attrs.latex ?? "");
|
|
@@ -1684,7 +1684,7 @@ const He = () => {
|
|
|
1684
1684
|
addKeyboardShortcuts() {
|
|
1685
1685
|
return {
|
|
1686
1686
|
Enter: () => {
|
|
1687
|
-
const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection, a =
|
|
1687
|
+
const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection, a = Dt(n);
|
|
1688
1688
|
if (a === null) return !1;
|
|
1689
1689
|
const s = n.node(a), l = n.before(a) + s.nodeSize;
|
|
1690
1690
|
if (!r || n.pos !== l - 1) return !1;
|
|
@@ -1699,19 +1699,19 @@ const He = () => {
|
|
|
1699
1699
|
dependsOnClaimIds: []
|
|
1700
1700
|
}
|
|
1701
1701
|
), u = e.tr.insert(c, o), m = c + 1;
|
|
1702
|
-
return u.setSelection(
|
|
1702
|
+
return u.setSelection(Ge.create(u.doc, m)), t(u), !0;
|
|
1703
1703
|
},
|
|
1704
1704
|
Backspace: () => {
|
|
1705
1705
|
const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection;
|
|
1706
1706
|
if (!r) return !1;
|
|
1707
|
-
const a =
|
|
1707
|
+
const a = Dt(n);
|
|
1708
1708
|
if (a === null) return !1;
|
|
1709
1709
|
const s = n.node(a);
|
|
1710
1710
|
if (s.content.size > 0) return !1;
|
|
1711
1711
|
let i = 0;
|
|
1712
1712
|
if (e.doc.descendants((m) => (m.type.name === "claim" && i++, !0)), i <= 1) return !1;
|
|
1713
1713
|
const l = n.before(a), c = l + s.nodeSize, d = e.tr.delete(l, c), o = Math.min(l, d.doc.content.size), u = d.doc.resolve(o);
|
|
1714
|
-
return d.setSelection(
|
|
1714
|
+
return d.setSelection(Ge.near(u)), t(d), !0;
|
|
1715
1715
|
}
|
|
1716
1716
|
};
|
|
1717
1717
|
},
|
|
@@ -1725,11 +1725,11 @@ const He = () => {
|
|
|
1725
1725
|
const i = document.createElement("span");
|
|
1726
1726
|
i.className = "claim-body";
|
|
1727
1727
|
const l = () => {
|
|
1728
|
-
const o =
|
|
1728
|
+
const o = _.getState().editorLanguage, u = j(o), m = Number(r.attrs.number || 1);
|
|
1729
1729
|
s.textContent = `${u.claimLabel(m)}. `, r.content.size > 0 ? (i.removeAttribute("data-placeholder"), a.classList.remove("claim-line--empty")) : (i.setAttribute("data-placeholder", o === "en" ? "Type claim content... (Enter to add next)" : "输入权利要求内容… (Enter 添加下一条)"), a.classList.add("claim-line--empty"));
|
|
1730
1730
|
};
|
|
1731
|
-
let c =
|
|
1732
|
-
const d =
|
|
1731
|
+
let c = _.getState().editorLanguage;
|
|
1732
|
+
const d = _.subscribe((o) => {
|
|
1733
1733
|
o.editorLanguage !== c && (c = o.editorLanguage, l());
|
|
1734
1734
|
});
|
|
1735
1735
|
return a.addEventListener("mousedown", (o) => {
|
|
@@ -1737,7 +1737,7 @@ const He = () => {
|
|
|
1737
1737
|
if (!(u instanceof HTMLElement) || u === i || i.contains(u)) return;
|
|
1738
1738
|
const m = typeof n == "function" ? n() : null;
|
|
1739
1739
|
if (typeof m != "number") return;
|
|
1740
|
-
const p = m + r.nodeSize - 1, g =
|
|
1740
|
+
const p = m + r.nodeSize - 1, g = Ge.create(e.state.doc, p);
|
|
1741
1741
|
e.view.dispatch(e.state.tr.setSelection(g));
|
|
1742
1742
|
}), a.append(s, i), l(), {
|
|
1743
1743
|
dom: a,
|
|
@@ -1748,15 +1748,15 @@ const He = () => {
|
|
|
1748
1748
|
};
|
|
1749
1749
|
}
|
|
1750
1750
|
});
|
|
1751
|
-
function
|
|
1751
|
+
function Dt(e) {
|
|
1752
1752
|
for (let t = e.depth; t >= 0; t--)
|
|
1753
1753
|
if (e.node(t).type.name === "claim") return t;
|
|
1754
1754
|
return null;
|
|
1755
1755
|
}
|
|
1756
|
-
let
|
|
1756
|
+
let He = 0;
|
|
1757
1757
|
const ft = [];
|
|
1758
|
-
let
|
|
1759
|
-
const qa = 2e4,
|
|
1758
|
+
let Ue = !1;
|
|
1759
|
+
const qa = 2e4, Mt = 6e4;
|
|
1760
1760
|
let U = null, Ve = !1, ce = null, Te = null;
|
|
1761
1761
|
const gt = /* @__PURE__ */ new Map();
|
|
1762
1762
|
function Ot() {
|
|
@@ -1771,17 +1771,17 @@ function Va(e, t) {
|
|
|
1771
1771
|
ft.push({ xml: e, callback: t }), pt();
|
|
1772
1772
|
}
|
|
1773
1773
|
function pt() {
|
|
1774
|
-
if (
|
|
1775
|
-
|
|
1774
|
+
if (Ue || ft.length === 0) return;
|
|
1775
|
+
Ue = !0, Te && (clearTimeout(Te), Te = null);
|
|
1776
1776
|
const { xml: e, callback: t } = ft.shift(), n = gt.get(e);
|
|
1777
1777
|
if (n) {
|
|
1778
|
-
t(n),
|
|
1778
|
+
t(n), Ue = !1, Te = setTimeout(Ot, Mt), pt();
|
|
1779
1779
|
return;
|
|
1780
1780
|
}
|
|
1781
1781
|
ce && (window.removeEventListener("message", ce), ce = null);
|
|
1782
1782
|
let r = null;
|
|
1783
1783
|
const a = (i) => {
|
|
1784
|
-
r && (clearTimeout(r), r = null), i && gt.set(e, i), t(i),
|
|
1784
|
+
r && (clearTimeout(r), r = null), i && gt.set(e, i), t(i), Ue = !1, Te = setTimeout(Ot, Mt), pt();
|
|
1785
1785
|
}, s = () => {
|
|
1786
1786
|
var i;
|
|
1787
1787
|
(i = U.contentWindow) == null || i.postMessage(
|
|
@@ -1803,10 +1803,10 @@ function pt() {
|
|
|
1803
1803
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1804
1804
|
"*"
|
|
1805
1805
|
);
|
|
1806
|
-
},
|
|
1807
|
-
}, window.addEventListener("message", ce), r = setTimeout(() => a(""), qa), U ? Ve && s() : (U = document.createElement("iframe"), U.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:
|
|
1806
|
+
}, 1500) : l.event === "export" && a(l.data || "");
|
|
1807
|
+
}, window.addEventListener("message", ce), r = setTimeout(() => a(""), qa), U ? Ve && s() : (U = document.createElement("iframe"), U.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:1920px;height:1080px;opacity:0;pointer-events:none;", document.body.appendChild(U), Ve = !1, U.src = "https://embed.diagrams.net/?embed=1&proto=json&spin=0&chrome=0");
|
|
1808
1808
|
}
|
|
1809
|
-
const
|
|
1809
|
+
const je = () => {
|
|
1810
1810
|
document.querySelectorAll('body > svg[id^="fig-mermaid-"]').forEach((e) => e.remove()), document.querySelectorAll('body > svg[id^="d"]').forEach((e) => {
|
|
1811
1811
|
(e.id.startsWith("dmermaid") || e.id.startsWith("dfi")) && e.remove();
|
|
1812
1812
|
}), document.querySelectorAll("body > #dmermaid-svg").forEach((e) => e.remove()), document.querySelectorAll("body > style[data-mermaid-style]").forEach((e) => e.remove());
|
|
@@ -1857,43 +1857,43 @@ const We = () => {
|
|
|
1857
1857
|
p.className = "figure-mermaid-view", p.contentEditable = "false", p.setAttribute("spellcheck", "false");
|
|
1858
1858
|
const g = document.createElement("div");
|
|
1859
1859
|
g.className = "figure-mermaid-preview", g.contentEditable = "false";
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1860
|
+
const h = document.createElement("div");
|
|
1861
|
+
h.className = "figure-mermaid-view-hint", p.append(g, h);
|
|
1862
|
+
const b = document.createElement("div");
|
|
1863
|
+
b.className = "figure-mermaid-edit";
|
|
1864
|
+
const v = document.createElement("textarea");
|
|
1865
|
+
v.className = "figure-mermaid-editor", v.spellcheck = !1;
|
|
1862
1866
|
const w = document.createElement("div");
|
|
1863
|
-
w.className = "figure-mermaid-
|
|
1864
|
-
const b = document.createElement("textarea");
|
|
1865
|
-
b.className = "figure-mermaid-editor", b.spellcheck = !1;
|
|
1866
|
-
const v = document.createElement("div");
|
|
1867
|
-
v.className = "figure-mermaid-toolbar";
|
|
1867
|
+
w.className = "figure-mermaid-toolbar";
|
|
1868
1868
|
const C = document.createElement("button");
|
|
1869
1869
|
C.className = "figure-mermaid-save-btn", C.type = "button";
|
|
1870
|
-
const
|
|
1871
|
-
|
|
1872
|
-
const
|
|
1873
|
-
|
|
1870
|
+
const S = document.createElement("button");
|
|
1871
|
+
S.className = "figure-mermaid-cancel-btn", S.type = "button";
|
|
1872
|
+
const T = document.createElement("span");
|
|
1873
|
+
T.className = "figure-mermaid-error-inline", w.append(T, S, C), b.append(v, w);
|
|
1874
1874
|
const A = document.createElement("div");
|
|
1875
1875
|
A.className = "figure-drawio-view", A.contentEditable = "false";
|
|
1876
1876
|
const P = document.createElement("img");
|
|
1877
1877
|
P.className = "figure-drawio-preview-img", P.style.display = "none";
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1882
|
-
const
|
|
1883
|
-
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
const
|
|
1887
|
-
const
|
|
1888
|
-
typeof
|
|
1878
|
+
const y = document.createElement("div");
|
|
1879
|
+
y.className = "figure-drawio-view-hint", A.append(P, y), l.append(c, d, m), l.append(p, b), l.append(A);
|
|
1880
|
+
const I = document.createElement("figcaption");
|
|
1881
|
+
I.className = "figure-caption";
|
|
1882
|
+
const k = document.createElement("span");
|
|
1883
|
+
k.className = "figure-id-label", k.contentEditable = "false";
|
|
1884
|
+
const D = document.createElement("span");
|
|
1885
|
+
D.className = "figure-caption-content", I.append(k, D), i.append(l, I);
|
|
1886
|
+
const M = (E) => {
|
|
1887
|
+
const N = typeof n == "function" ? n() : null;
|
|
1888
|
+
typeof N == "number" && e.commands.command(({ tr: R, dispatch: W }) => (R.setNodeMarkup(N, void 0, { ...r.attrs, ...E }), W && W(R), !0));
|
|
1889
1889
|
}, Q = (E) => {
|
|
1890
1890
|
if (!E || E.length === 0) return;
|
|
1891
|
-
const
|
|
1892
|
-
if (!
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
typeof
|
|
1896
|
-
},
|
|
1891
|
+
const N = E[0];
|
|
1892
|
+
if (!N.type.startsWith("image/")) return;
|
|
1893
|
+
const R = new FileReader();
|
|
1894
|
+
R.onload = () => {
|
|
1895
|
+
typeof R.result == "string" && M({ imageSrc: R.result });
|
|
1896
|
+
}, R.readAsDataURL(N);
|
|
1897
1897
|
};
|
|
1898
1898
|
u.addEventListener("change", () => Q(u.files)), d.addEventListener("click", () => u.click()), m.addEventListener("click", (E) => {
|
|
1899
1899
|
E.stopPropagation(), u.click();
|
|
@@ -1902,55 +1902,55 @@ const We = () => {
|
|
|
1902
1902
|
}), l.addEventListener("dragleave", () => {
|
|
1903
1903
|
d.classList.remove("figure-upload-area--dragover");
|
|
1904
1904
|
}), l.addEventListener("drop", (E) => {
|
|
1905
|
-
var
|
|
1906
|
-
d.classList.remove("figure-upload-area--dragover"), r.attrs.contentType === "image" && (E.preventDefault(), E.stopPropagation(), Q(((
|
|
1905
|
+
var N;
|
|
1906
|
+
d.classList.remove("figure-upload-area--dragover"), r.attrs.contentType === "image" && (E.preventDefault(), E.stopPropagation(), Q(((N = E.dataTransfer) == null ? void 0 : N.files) ?? null));
|
|
1907
1907
|
});
|
|
1908
|
-
const
|
|
1909
|
-
a || (a = !0,
|
|
1910
|
-
},
|
|
1908
|
+
const Pe = () => {
|
|
1909
|
+
a || (a = !0, v.value = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "", T.textContent = "", T.style.display = "none", te(), requestAnimationFrame(() => v.focus()));
|
|
1910
|
+
}, x = () => {
|
|
1911
1911
|
a = !1, te();
|
|
1912
1912
|
}, H = async () => {
|
|
1913
|
-
const E =
|
|
1914
|
-
|
|
1915
|
-
const
|
|
1916
|
-
if (
|
|
1913
|
+
const E = v.value;
|
|
1914
|
+
T.textContent = "", T.style.display = "none";
|
|
1915
|
+
const N = E.trim();
|
|
1916
|
+
if (N)
|
|
1917
1917
|
try {
|
|
1918
|
-
const
|
|
1919
|
-
|
|
1920
|
-
const W = `fig-mermaid-${
|
|
1921
|
-
g.innerHTML = F,
|
|
1918
|
+
const R = await import("mermaid");
|
|
1919
|
+
R.default.initialize({ startOnLoad: !1, theme: "default" }), He += 1;
|
|
1920
|
+
const W = `fig-mermaid-${He}`, { svg: F } = await R.default.render(W, N);
|
|
1921
|
+
g.innerHTML = F, je();
|
|
1922
1922
|
} catch {
|
|
1923
|
-
|
|
1924
|
-
const
|
|
1925
|
-
|
|
1923
|
+
je();
|
|
1924
|
+
const R = _.getState().editorLanguage;
|
|
1925
|
+
T.textContent = R === "en" ? "Mermaid syntax error, please fix and retry" : "Mermaid 语法错误,请修正后重试", T.style.display = "inline";
|
|
1926
1926
|
return;
|
|
1927
1927
|
}
|
|
1928
|
-
|
|
1928
|
+
M({ mermaidCode: E }), a = !1, te();
|
|
1929
1929
|
};
|
|
1930
1930
|
p.addEventListener("dblclick", (E) => {
|
|
1931
|
-
E.preventDefault(), E.stopPropagation(),
|
|
1931
|
+
E.preventDefault(), E.stopPropagation(), Pe();
|
|
1932
1932
|
}), C.addEventListener("click", (E) => {
|
|
1933
1933
|
E.stopPropagation(), H();
|
|
1934
|
-
}),
|
|
1935
|
-
E.stopPropagation(),
|
|
1936
|
-
}),
|
|
1934
|
+
}), S.addEventListener("click", (E) => {
|
|
1935
|
+
E.stopPropagation(), x();
|
|
1936
|
+
}), v.addEventListener("mousedown", (E) => E.stopPropagation()), v.addEventListener("keydown", (E) => E.stopPropagation()), v.addEventListener("keypress", (E) => E.stopPropagation());
|
|
1937
1937
|
let O = null, $ = null, K = null;
|
|
1938
1938
|
const Nn = () => {
|
|
1939
1939
|
if (s) return;
|
|
1940
1940
|
s = !0, te(), $ = document.createElement("div"), $.className = "drawio-modal-overlay";
|
|
1941
1941
|
const E = document.createElement("div");
|
|
1942
1942
|
E.className = "drawio-modal-content";
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1945
|
-
const
|
|
1946
|
-
|
|
1943
|
+
const N = document.createElement("div");
|
|
1944
|
+
N.className = "drawio-modal-header";
|
|
1945
|
+
const R = document.createElement("span"), W = _.getState().editorLanguage;
|
|
1946
|
+
R.textContent = W === "en" ? "Edit Draw.io Diagram" : "编辑 Draw.io 图表", R.className = "drawio-modal-title";
|
|
1947
1947
|
const F = document.createElement("button");
|
|
1948
|
-
F.className = "drawio-modal-close-btn", F.textContent = "✕", F.type = "button", F.addEventListener("click", () => at()),
|
|
1948
|
+
F.className = "drawio-modal-close-btn", F.textContent = "✕", F.type = "button", F.addEventListener("click", () => at()), N.append(R, F), K = document.createElement("iframe"), K.className = "drawio-modal-iframe", K.setAttribute("frameborder", "0"), E.append(N, K), $.appendChild(E), document.body.appendChild($);
|
|
1949
1949
|
const xe = W === "en" ? "en" : "zh";
|
|
1950
1950
|
K.src = `https://embed.diagrams.net/?embed=1&proto=json&spin=1&lang=${xe}`;
|
|
1951
1951
|
const ne = K;
|
|
1952
1952
|
O = (re) => {
|
|
1953
|
-
var me,
|
|
1953
|
+
var me, Me;
|
|
1954
1954
|
if (!ne || re.source !== ne.contentWindow) return;
|
|
1955
1955
|
let J;
|
|
1956
1956
|
try {
|
|
@@ -1966,13 +1966,13 @@ const We = () => {
|
|
|
1966
1966
|
);
|
|
1967
1967
|
} else if (J.event === "save") {
|
|
1968
1968
|
const fe = J.xml || "";
|
|
1969
|
-
(
|
|
1969
|
+
(Me = ne.contentWindow) == null || Me.postMessage(
|
|
1970
1970
|
JSON.stringify({ action: "export", format: "svg" }),
|
|
1971
1971
|
"*"
|
|
1972
|
-
),
|
|
1972
|
+
), M({ drawioXml: fe });
|
|
1973
1973
|
} else if (J.event === "export") {
|
|
1974
1974
|
const fe = J.data || "";
|
|
1975
|
-
|
|
1975
|
+
M({ drawioSvg: fe }), at();
|
|
1976
1976
|
} else J.event === "exit" && at();
|
|
1977
1977
|
}, window.addEventListener("message", O);
|
|
1978
1978
|
}, at = () => {
|
|
@@ -1981,72 +1981,72 @@ const We = () => {
|
|
|
1981
1981
|
A.addEventListener("dblclick", (E) => {
|
|
1982
1982
|
E.preventDefault(), E.stopPropagation(), Nn();
|
|
1983
1983
|
}), i.addEventListener("mousedown", (E) => {
|
|
1984
|
-
const
|
|
1985
|
-
if (!(
|
|
1986
|
-
const
|
|
1987
|
-
if (typeof
|
|
1988
|
-
const W =
|
|
1984
|
+
const N = E.target;
|
|
1985
|
+
if (!(N instanceof HTMLElement) || N === D || D.contains(N) || N === v || b.contains(N) || N === d || d.contains(N) || N === m || N === u || p.contains(N) || A.contains(N)) return;
|
|
1986
|
+
const R = typeof n == "function" ? n() : null;
|
|
1987
|
+
if (typeof R != "number") return;
|
|
1988
|
+
const W = R + r.nodeSize - 1, F = Ge.create(e.state.doc, W);
|
|
1989
1989
|
e.view.dispatch(e.state.tr.setSelection(F));
|
|
1990
1990
|
});
|
|
1991
|
-
let
|
|
1991
|
+
let Re = !1, ue = null, Ce = null, De = 0;
|
|
1992
1992
|
const _n = 2, kn = 1500, An = 3e3;
|
|
1993
1993
|
let we = "";
|
|
1994
1994
|
const Ln = async (E) => {
|
|
1995
|
-
const
|
|
1996
|
-
if (
|
|
1997
|
-
if (!
|
|
1995
|
+
const N = E.trim();
|
|
1996
|
+
if (N !== we) {
|
|
1997
|
+
if (!N) {
|
|
1998
1998
|
g.innerHTML = "", we = "";
|
|
1999
1999
|
return;
|
|
2000
2000
|
}
|
|
2001
2001
|
try {
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2004
|
-
const W = `fig-mermaid-${
|
|
2005
|
-
g.innerHTML = F, we =
|
|
2002
|
+
const R = await import("mermaid");
|
|
2003
|
+
R.default.initialize({ startOnLoad: !1, theme: "default" }), He += 1;
|
|
2004
|
+
const W = `fig-mermaid-${He}`, { svg: F } = await R.default.render(W, N);
|
|
2005
|
+
g.innerHTML = F, we = N;
|
|
2006
2006
|
} catch {
|
|
2007
2007
|
g.innerHTML = "", we = "";
|
|
2008
2008
|
} finally {
|
|
2009
|
-
|
|
2009
|
+
je();
|
|
2010
2010
|
}
|
|
2011
2011
|
}
|
|
2012
2012
|
}, te = () => {
|
|
2013
|
-
const E =
|
|
2014
|
-
W ? (
|
|
2015
|
-
const ne =
|
|
2016
|
-
c.style.display = ne && F ? "block" : "none", d.style.display = ne && !F ? "flex" : "none", m.style.display = ne && F ? "block" : "none", p.style.display = re && !a ? "block" : "none",
|
|
2013
|
+
const E = _.getState().editorLanguage, N = j(E), R = ["image", "mermaid", "drawio"].includes(r.attrs.contentType) ? r.attrs.contentType : "image", W = typeof r.attrs.id == "string" ? r.attrs.id.trim() : "", F = typeof r.attrs.imageSrc == "string" ? r.attrs.imageSrc : "", xe = typeof r.attrs.mermaidCode == "string" ? r.attrs.mermaidCode : "";
|
|
2014
|
+
W ? (k.textContent = `[${W}] `, k.style.display = "inline") : (k.textContent = "", k.style.display = "none");
|
|
2015
|
+
const ne = R === "image", re = R === "mermaid", J = R === "drawio";
|
|
2016
|
+
c.style.display = ne && F ? "block" : "none", d.style.display = ne && !F ? "flex" : "none", m.style.display = ne && F ? "block" : "none", p.style.display = re && !a ? "block" : "none", b.style.display = re && a ? "block" : "none", A.style.display = J ? "flex" : "none", ne && F && (c.src = F);
|
|
2017
2017
|
const me = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
|
|
2018
|
-
J && (me ? (P.src = me, P.style.display = "block") : (P.src = "", P.style.display = "none")), o.textContent =
|
|
2019
|
-
const
|
|
2020
|
-
re && !a && (
|
|
2021
|
-
const
|
|
2022
|
-
J &&
|
|
2018
|
+
J && (me ? (P.src = me, P.style.display = "block") : (P.src = "", P.style.display = "none")), o.textContent = N.figureUploadHint || "点击上传或拖拽图片", m.textContent = N.figureReplaceImage || "更换图片", C.textContent = N.mermaidSaveAndRender || "保存并渲染", S.textContent = N.mermaidCancel || "取消";
|
|
2019
|
+
const Me = xe.trim().length > 0, fe = g.querySelector("svg") !== null;
|
|
2020
|
+
re && !a && (Me && fe ? (h.textContent = N.mermaidDoubleClickToEdit || "双击编辑", h.className = "figure-mermaid-view-hint figure-mermaid-view-hint--subtle") : (h.textContent = N.mermaidDoubleClickToCreate || "双击编辑 Mermaid 图表", h.className = "figure-mermaid-view-hint figure-mermaid-view-hint--empty")), J && !s && (me ? (y.textContent = N.mermaidDoubleClickToEdit || "双击编辑", y.className = "figure-drawio-view-hint figure-mermaid-view-hint--subtle") : (y.textContent = N.drawioDoubleClickToEdit || "双击编辑 Draw.io 图表", y.className = "figure-drawio-view-hint figure-mermaid-view-hint--empty")), re && !a && xe.trim() !== we && Ln(xe);
|
|
2021
|
+
const Rn = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "";
|
|
2022
|
+
J && Rn && !me && !Re && !s && (ue && clearTimeout(ue), ue = setTimeout(() => {
|
|
2023
2023
|
ue = null;
|
|
2024
|
-
const Et = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "",
|
|
2025
|
-
!Et ||
|
|
2026
|
-
|
|
2024
|
+
const Et = typeof r.attrs.drawioXml == "string" ? r.attrs.drawioXml : "", Dn = typeof r.attrs.drawioSvg == "string" ? r.attrs.drawioSvg : "";
|
|
2025
|
+
!Et || Dn || Re || (Re = !0, Va(Et, (Nt) => {
|
|
2026
|
+
Re = !1, Nt ? (De = 0, M({ drawioSvg: Nt })) : De < _n && (De++, Ce = setTimeout(() => {
|
|
2027
2027
|
Ce = null, te();
|
|
2028
|
-
}, An *
|
|
2028
|
+
}, An * De));
|
|
2029
2029
|
}));
|
|
2030
2030
|
}, kn));
|
|
2031
2031
|
};
|
|
2032
|
-
let It =
|
|
2033
|
-
const Pn =
|
|
2032
|
+
let It = _.getState().editorLanguage;
|
|
2033
|
+
const Pn = _.subscribe((E) => {
|
|
2034
2034
|
E.editorLanguage !== It && (It = E.editorLanguage, te());
|
|
2035
2035
|
});
|
|
2036
2036
|
return te(), {
|
|
2037
2037
|
dom: i,
|
|
2038
|
-
contentDOM:
|
|
2038
|
+
contentDOM: D,
|
|
2039
2039
|
stopEvent: (E) => {
|
|
2040
|
-
const
|
|
2041
|
-
return !!(
|
|
2040
|
+
const N = E.target;
|
|
2041
|
+
return !!(N === v || b.contains(N) || N === u);
|
|
2042
2042
|
},
|
|
2043
2043
|
ignoreMutation: (E) => {
|
|
2044
|
-
const
|
|
2045
|
-
return !!(l.contains(
|
|
2044
|
+
const N = E.target;
|
|
2045
|
+
return !!(l.contains(N) || k.contains(N));
|
|
2046
2046
|
},
|
|
2047
2047
|
update: (E) => E.type.name !== "figure" ? !1 : (r = E, te(), !0),
|
|
2048
2048
|
destroy: () => {
|
|
2049
|
-
ue && (clearTimeout(ue), ue = null), Ce && (clearTimeout(Ce), Ce = null), Pn(),
|
|
2049
|
+
ue && (clearTimeout(ue), ue = null), Ce && (clearTimeout(Ce), Ce = null), Pn(), je(), O && (window.removeEventListener("message", O), O = null), K && (K.src = "about:blank", K = null), $ && ($.remove(), $ = null);
|
|
2050
2050
|
}
|
|
2051
2051
|
};
|
|
2052
2052
|
};
|
|
@@ -2207,31 +2207,31 @@ const We = () => {
|
|
|
2207
2207
|
const l = document.createElement("h1");
|
|
2208
2208
|
l.className = "pt-title-content", a.append(s, i, l);
|
|
2209
2209
|
const c = () => {
|
|
2210
|
-
const
|
|
2211
|
-
return typeof
|
|
2210
|
+
const h = typeof n == "function" ? n() : null;
|
|
2211
|
+
return typeof h == "number" ? h : null;
|
|
2212
2212
|
}, d = () => {
|
|
2213
|
-
const
|
|
2214
|
-
|
|
2213
|
+
const h = c();
|
|
2214
|
+
h !== null && _.getState().setActiveSection("patent_title", h);
|
|
2215
2215
|
}, o = () => {
|
|
2216
|
-
const
|
|
2217
|
-
|
|
2216
|
+
const h = c();
|
|
2217
|
+
h !== null && (_.getState().openDraftingPanel("patent_title", h), e.commands.focus(h + 1));
|
|
2218
2218
|
};
|
|
2219
2219
|
i.addEventListener("click", o), l.addEventListener("focusin", d), l.addEventListener("click", d);
|
|
2220
2220
|
const u = () => {
|
|
2221
|
-
const
|
|
2222
|
-
s.textContent =
|
|
2223
|
-
const C = Tt(r),
|
|
2224
|
-
i.textContent = `[${
|
|
2221
|
+
const h = _.getState(), b = j(h.editorLanguage), v = typeof b.bookTitle_description == "string" ? b.bookTitle_description : "说明书", w = typeof b.patentTitlePlaceholder == "string" ? b.patentTitlePlaceholder : "专利名称";
|
|
2222
|
+
s.textContent = v;
|
|
2223
|
+
const C = Tt(r), S = h.rightPanel.activeSectionPos === c();
|
|
2224
|
+
i.textContent = `[${w}]`, i.style.display = C ? "none" : "", i.classList.toggle("ps-placeholder--active", S && !C), l.classList.toggle("pt-title-content--has-content", C);
|
|
2225
2225
|
};
|
|
2226
|
-
let m =
|
|
2227
|
-
const g =
|
|
2228
|
-
const
|
|
2229
|
-
m =
|
|
2226
|
+
let m = _.getState().editorLanguage, p = _.getState().rightPanel.activeSectionPos;
|
|
2227
|
+
const g = _.subscribe((h) => {
|
|
2228
|
+
const b = h.editorLanguage !== m, v = h.rightPanel.activeSectionPos !== p;
|
|
2229
|
+
m = h.editorLanguage, p = h.rightPanel.activeSectionPos, (b || v) && u();
|
|
2230
2230
|
});
|
|
2231
2231
|
return u(), {
|
|
2232
2232
|
dom: a,
|
|
2233
2233
|
contentDOM: l,
|
|
2234
|
-
update: (
|
|
2234
|
+
update: (h) => h.type.name !== "patent_title" ? !1 : (r = h, u(), !0),
|
|
2235
2235
|
destroy: () => {
|
|
2236
2236
|
g(), i.removeEventListener("click", o), l.removeEventListener("focusin", d), l.removeEventListener("click", d);
|
|
2237
2237
|
}
|
|
@@ -2274,7 +2274,7 @@ const We = () => {
|
|
|
2274
2274
|
};
|
|
2275
2275
|
return [
|
|
2276
2276
|
new et({
|
|
2277
|
-
key: new
|
|
2277
|
+
key: new Ae("patentSectionLock"),
|
|
2278
2278
|
props: {
|
|
2279
2279
|
transformPasted: (t) => {
|
|
2280
2280
|
const n = e(t.content);
|
|
@@ -2308,51 +2308,35 @@ const We = () => {
|
|
|
2308
2308
|
const l = document.createElement("div");
|
|
2309
2309
|
l.className = "ps-placeholder", l.contentEditable = "false";
|
|
2310
2310
|
const c = document.createElement("div");
|
|
2311
|
-
c.className = "ps-content";
|
|
2312
|
-
const d =
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2311
|
+
c.className = "ps-content", i.append(l, c), a.append(s, i);
|
|
2312
|
+
const d = () => {
|
|
2313
|
+
const b = typeof n == "function" ? n() : null;
|
|
2314
|
+
return typeof b == "number" ? b : null;
|
|
2315
|
+
}, o = () => {
|
|
2316
|
+
const b = d();
|
|
2317
|
+
if (b === null) return;
|
|
2318
|
+
_.getState().setActiveSection(r.attrs.sectionType, b);
|
|
2317
2319
|
}, u = () => {
|
|
2318
|
-
const
|
|
2319
|
-
if (
|
|
2320
|
-
|
|
2321
|
-
}, m = () => {
|
|
2322
|
-
const v = o();
|
|
2323
|
-
if (v === null) return;
|
|
2324
|
-
k.getState().openDraftingPanel(r.attrs.sectionType, v), e.commands.focus(v + 1);
|
|
2325
|
-
}, p = (v) => {
|
|
2326
|
-
v.preventDefault(), v.stopPropagation();
|
|
2327
|
-
const C = `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
2328
|
-
let x = 0;
|
|
2329
|
-
e.state.doc.descendants((N) => (N.type.name === "claim" && x++, !0));
|
|
2330
|
-
const I = o();
|
|
2331
|
-
if (I === null) return;
|
|
2332
|
-
const A = I + r.nodeSize - 1, P = e.state.schema.nodes.claim.create({
|
|
2333
|
-
number: x + 1,
|
|
2334
|
-
claimId: C,
|
|
2335
|
-
dependsOn: [],
|
|
2336
|
-
dependsOnClaimIds: []
|
|
2337
|
-
}), h = e.state.tr.insert(A, P), T = A + 1;
|
|
2338
|
-
h.setSelection(Ne.create(h.doc, T)), e.view.dispatch(h), e.view.focus();
|
|
2320
|
+
const b = d();
|
|
2321
|
+
if (b === null) return;
|
|
2322
|
+
_.getState().openDraftingPanel(r.attrs.sectionType, b), e.commands.focus(b + 1);
|
|
2339
2323
|
};
|
|
2340
|
-
l.addEventListener("click",
|
|
2341
|
-
const
|
|
2342
|
-
const
|
|
2343
|
-
a.className = `ps${
|
|
2324
|
+
l.addEventListener("click", u), c.addEventListener("focusin", o), c.addEventListener("click", o);
|
|
2325
|
+
const m = () => {
|
|
2326
|
+
const b = _.getState(), v = j(b.editorLanguage), w = Object.keys($t).includes(r.attrs.sectionType) ? r.attrs.sectionType : "technical_field", C = Xa.has(w), S = Ya.has(w), T = $t[w], A = typeof v[T] == "string" ? v[T] : w, P = Tt(r), y = b.rightPanel.activeSectionPos === d();
|
|
2327
|
+
a.className = `ps${P ? "" : " ps--empty"}${S ? " ps--sub" : ""}`, a.setAttribute("data-section-type", w), s.className = C ? "pb-heading" : "ps-heading ps-heading--sub", s.textContent = A, l.textContent = `[${A}]`, l.style.display = P ? "none" : "", l.classList.toggle("ps-placeholder--active", y && !P), c.classList.toggle("ps-content--has-content", P);
|
|
2344
2328
|
};
|
|
2345
|
-
let
|
|
2346
|
-
const
|
|
2347
|
-
const
|
|
2348
|
-
|
|
2329
|
+
let p = _.getState().editorLanguage, g = _.getState().rightPanel.activeSectionPos;
|
|
2330
|
+
const h = _.subscribe((b) => {
|
|
2331
|
+
const v = b.editorLanguage !== p, w = b.rightPanel.activeSectionPos !== g;
|
|
2332
|
+
p = b.editorLanguage, g = b.rightPanel.activeSectionPos, (v || w) && m();
|
|
2349
2333
|
});
|
|
2350
|
-
return
|
|
2334
|
+
return m(), {
|
|
2351
2335
|
dom: a,
|
|
2352
2336
|
contentDOM: c,
|
|
2353
|
-
update: (
|
|
2337
|
+
update: (b) => b.type.name !== "patent_section" ? !1 : (r = b, m(), !0),
|
|
2354
2338
|
destroy: () => {
|
|
2355
|
-
|
|
2339
|
+
h(), l.removeEventListener("click", u), c.removeEventListener("focusin", o), c.removeEventListener("click", o);
|
|
2356
2340
|
}
|
|
2357
2341
|
};
|
|
2358
2342
|
};
|
|
@@ -2405,9 +2389,9 @@ const We = () => {
|
|
|
2405
2389
|
lastClaimGraphSignature: "",
|
|
2406
2390
|
invalidReferenceHandler: null,
|
|
2407
2391
|
claimGraphHandler: null
|
|
2408
|
-
}, ge = (e) => xt(e, (t) => t.type.name === "claim"),
|
|
2409
|
-
const n =
|
|
2410
|
-
|
|
2392
|
+
}, ge = (e) => xt(e, (t) => t.type.name === "claim"), ke = (e) => xt(e, (t) => t.type.name === "figure"), hn = () => `claim_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`, Z = (e) => typeof e != "string" ? "" : e.trim(), zt = (e) => {
|
|
2393
|
+
const n = _.getState().editorLanguage === "en" ? "Fig." : "图", r = /* @__PURE__ */ new Set();
|
|
2394
|
+
ke(e).forEach((s) => {
|
|
2411
2395
|
const i = Z(s.node.attrs.id);
|
|
2412
2396
|
i && r.add(i);
|
|
2413
2397
|
});
|
|
@@ -2416,7 +2400,7 @@ const We = () => {
|
|
|
2416
2400
|
a += 1;
|
|
2417
2401
|
return `${n}${a}`;
|
|
2418
2402
|
}, is = /^(Fig\.|图)(\d+)$/, os = (e) => {
|
|
2419
|
-
const n =
|
|
2403
|
+
const n = _.getState().editorLanguage === "en" ? "Fig." : "图", r = ke(e);
|
|
2420
2404
|
if (r.length === 0) return;
|
|
2421
2405
|
const a = [];
|
|
2422
2406
|
let s = 1;
|
|
@@ -2453,7 +2437,7 @@ const We = () => {
|
|
|
2453
2437
|
}, ht = (e, t, n, r, a) => {
|
|
2454
2438
|
const s = j(e);
|
|
2455
2439
|
return a ? t === "figure" ? s.invalidFigureReference : s.invalidClaimReference : t === "figure" ? r || (e === "en" ? "Figure ?" : "附图?") : typeof n != "number" ? s.invalidClaimReference : s.claimLabel(n);
|
|
2456
|
-
}, Qe = () =>
|
|
2440
|
+
}, Qe = () => _.getState().editorLanguage === "en" ? "en" : "zh", cs = (e) => {
|
|
2457
2441
|
const t = [], n = Qe(), r = new Map(e.map((d) => [d.claimId, d.number]));
|
|
2458
2442
|
e.forEach((d) => {
|
|
2459
2443
|
d.dependsOnClaimIds.forEach((o) => {
|
|
@@ -2499,25 +2483,25 @@ const We = () => {
|
|
|
2499
2483
|
a.set(o.number, o.claimId), s.set(o.claimId, o.number);
|
|
2500
2484
|
});
|
|
2501
2485
|
const i = r.map((o) => {
|
|
2502
|
-
const u = it(o.node.attrs.dependsOnClaimIds), p = Je(o.node.attrs.dependsOn).map((
|
|
2486
|
+
const u = it(o.node.attrs.dependsOnClaimIds), p = Je(o.node.attrs.dependsOn).map((w) => a.get(w)).filter((w) => typeof w == "string"), h = (u.length > 0 ? u : p).filter((w, C, S) => S.indexOf(w) === C).filter((w) => w !== o.claimId && s.has(w)), b = h.map((w) => s.get(w)).filter((w) => typeof w == "number").sort((w, C) => w - C), v = {
|
|
2503
2487
|
...o.node.attrs,
|
|
2504
2488
|
claimId: o.claimId,
|
|
2505
2489
|
number: o.number,
|
|
2506
|
-
dependsOn:
|
|
2507
|
-
dependsOnClaimIds:
|
|
2490
|
+
dependsOn: b,
|
|
2491
|
+
dependsOnClaimIds: h
|
|
2508
2492
|
};
|
|
2509
|
-
return { claimId: o.claimId, number: o.number, dependsOnClaimIds:
|
|
2493
|
+
return { claimId: o.claimId, number: o.number, dependsOnClaimIds: h, pos: o.pos, attrs: v };
|
|
2510
2494
|
}), l = cs(i), c = e.commands.command(({ tr: o, dispatch: u }) => {
|
|
2511
2495
|
let m = !1;
|
|
2512
2496
|
return i.forEach((p) => {
|
|
2513
2497
|
const g = e.state.doc.nodeAt(p.pos);
|
|
2514
2498
|
if (!g || g.type.name !== "claim")
|
|
2515
2499
|
return;
|
|
2516
|
-
const
|
|
2517
|
-
(g.attrs.number !==
|
|
2500
|
+
const h = { ...p.attrs };
|
|
2501
|
+
(g.attrs.number !== h.number || g.attrs.claimId !== h.claimId || !Bt(Je(g.attrs.dependsOn), Je(h.dependsOn)) || !Bt(
|
|
2518
2502
|
it(g.attrs.dependsOnClaimIds),
|
|
2519
|
-
it(
|
|
2520
|
-
)) && (o.setNodeMarkup(p.pos, void 0,
|
|
2503
|
+
it(h.dependsOnClaimIds)
|
|
2504
|
+
)) && (o.setNodeMarkup(p.pos, void 0, h), m = !0);
|
|
2521
2505
|
}), m && u && u(o), !0;
|
|
2522
2506
|
}), d = l.map((o) => `${o.claimId}:${o.code}`).join("|");
|
|
2523
2507
|
return d !== V.lastClaimGraphSignature && (V.lastClaimGraphSignature = d, V.claimGraphHandler && V.claimGraphHandler({ issues: l }), l.length > 0 && console.warn(`Claim graph validation found ${l.length} issue(s).`)), c;
|
|
@@ -2533,7 +2517,7 @@ const We = () => {
|
|
|
2533
2517
|
}), t;
|
|
2534
2518
|
}, bn = (e) => {
|
|
2535
2519
|
const t = /* @__PURE__ */ new Map();
|
|
2536
|
-
return
|
|
2520
|
+
return ke(e).forEach((n) => {
|
|
2537
2521
|
const r = Z(n.node.attrs.id);
|
|
2538
2522
|
r && t.set(r, {
|
|
2539
2523
|
id: r,
|
|
@@ -2547,21 +2531,21 @@ const We = () => {
|
|
|
2547
2531
|
return c.doc.descendants((u, m) => {
|
|
2548
2532
|
if (u.type.name !== "reference")
|
|
2549
2533
|
return !0;
|
|
2550
|
-
const p = u.attrs.targetType === "figure" ? "figure" : "claim", g = typeof u.attrs.targetClaimId == "string" && u.attrs.targetClaimId ? u.attrs.targetClaimId : null,
|
|
2534
|
+
const p = u.attrs.targetType === "figure" ? "figure" : "claim", g = typeof u.attrs.targetClaimId == "string" && u.attrs.targetClaimId ? u.attrs.targetClaimId : null, h = typeof u.attrs.targetFigureId == "string" && u.attrs.targetFigureId ? Z(u.attrs.targetFigureId) : null, b = p === "claim" && g ? t.get(g) : void 0, v = p === "figure" && h ? n.get(h) : void 0, w = b ? b.number : null, C = v ? v.id : null, S = p === "figure" ? !v : !b, T = ht(a, p, w, C, S), A = p === "figure" ? C || u.attrs.target || h || null : b ? String(b.number) : u.attrs.target || g || null, P = {
|
|
2551
2535
|
...u.attrs,
|
|
2552
2536
|
targetType: p,
|
|
2553
2537
|
targetClaimId: g,
|
|
2554
|
-
targetFigureId:
|
|
2555
|
-
resolvedNumber:
|
|
2538
|
+
targetFigureId: h,
|
|
2539
|
+
resolvedNumber: w,
|
|
2556
2540
|
resolvedFigureId: C,
|
|
2557
|
-
invalid:
|
|
2541
|
+
invalid: S,
|
|
2558
2542
|
lang: a,
|
|
2559
|
-
displayText:
|
|
2543
|
+
displayText: T,
|
|
2560
2544
|
target: A
|
|
2561
2545
|
};
|
|
2562
2546
|
return Object.keys(P).some(
|
|
2563
|
-
(
|
|
2564
|
-
) && (l.setNodeMarkup(m, void 0, P), o = !0),
|
|
2547
|
+
(I) => P[I] !== u.attrs[I]
|
|
2548
|
+
) && (l.setNodeMarkup(m, void 0, P), o = !0), S && r.push({ targetType: p, targetClaimId: g, targetFigureId: h, position: m }), !0;
|
|
2565
2549
|
}), o && d && d(l), !0;
|
|
2566
2550
|
}))
|
|
2567
2551
|
return !1;
|
|
@@ -2687,7 +2671,7 @@ const We = () => {
|
|
|
2687
2671
|
if (!(n != null && n.lang))
|
|
2688
2672
|
return !1;
|
|
2689
2673
|
const r = n.lang === "en" ? "en" : "zh";
|
|
2690
|
-
|
|
2674
|
+
_.getState().setEditorLanguage(r);
|
|
2691
2675
|
const s = (n.scope || "all") === "current" ? be(e, "reference") : null;
|
|
2692
2676
|
return e.commands.command(({ tr: l, state: c, dispatch: d }) => {
|
|
2693
2677
|
let o = !1;
|
|
@@ -2746,7 +2730,7 @@ const We = () => {
|
|
|
2746
2730
|
if (!s || s.type.name !== "figure")
|
|
2747
2731
|
return !1;
|
|
2748
2732
|
const l = (typeof n.id == "string" ? Z(n.id) : Z(s.attrs.id)) || zt(e);
|
|
2749
|
-
if (
|
|
2733
|
+
if (ke(e).some((o) => o.pos === a ? !1 : Z(o.node.attrs.id) === l))
|
|
2750
2734
|
return !1;
|
|
2751
2735
|
const d = { id: l };
|
|
2752
2736
|
return typeof n.contentType == "string" && ["image", "mermaid", "drawio"].includes(n.contentType) && (d.contentType = n.contentType), typeof n.imageSrc == "string" && (d.imageSrc = n.imageSrc), typeof n.mermaidCode == "string" && (d.mermaidCode = n.mermaidCode), typeof n.drawioXml == "string" && (d.drawioXml = n.drawioXml), he(e, {
|
|
@@ -2762,7 +2746,7 @@ const We = () => {
|
|
|
2762
2746
|
execute: ({ editor: e }) => {
|
|
2763
2747
|
const t = /* @__PURE__ */ new Set();
|
|
2764
2748
|
let n = !1;
|
|
2765
|
-
return
|
|
2749
|
+
return ke(e).forEach((r) => {
|
|
2766
2750
|
const a = Z(r.node.attrs.id);
|
|
2767
2751
|
if (a) {
|
|
2768
2752
|
if (t.has(a)) {
|
|
@@ -2902,7 +2886,7 @@ const We = () => {
|
|
|
2902
2886
|
onSelectionChange: (e) => {
|
|
2903
2887
|
Ht(e);
|
|
2904
2888
|
}
|
|
2905
|
-
}, ms = [
|
|
2889
|
+
}, ms = [Da, Oa, za, us];
|
|
2906
2890
|
ms.forEach((e) => G.register(e));
|
|
2907
2891
|
const fs = (e = {}) => {
|
|
2908
2892
|
const t = [
|
|
@@ -2919,9 +2903,9 @@ const fs = (e = {}) => {
|
|
|
2919
2903
|
return {
|
|
2920
2904
|
editor: e,
|
|
2921
2905
|
selection: { from: t, to: n },
|
|
2922
|
-
store:
|
|
2906
|
+
store: _.getState()
|
|
2923
2907
|
};
|
|
2924
|
-
},
|
|
2908
|
+
}, Le = (e) => ({
|
|
2925
2909
|
execCommand: (t, n, r) => G.executeCommand(t, ct(e), n, r),
|
|
2926
2910
|
canExecCommand: (t, n) => G.canExecuteCommand(t, ct(e), n),
|
|
2927
2911
|
isCommandActive: (t) => G.isCommandActive(t, ct(e)),
|
|
@@ -3123,10 +3107,10 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3123
3107
|
collapsibleGroups: n = !0,
|
|
3124
3108
|
defaultCollapsedGroups: r = []
|
|
3125
3109
|
}) => {
|
|
3126
|
-
const [a, s] = z(() => new Set(r)), { editorLanguage: i, setEditorLanguage: l } =
|
|
3110
|
+
const [a, s] = z(() => new Set(r)), { editorLanguage: i, setEditorLanguage: l } = _(), c = j(i);
|
|
3127
3111
|
if (!e)
|
|
3128
3112
|
return null;
|
|
3129
|
-
const d =
|
|
3113
|
+
const d = Le(e), o = i === "zh", u = [
|
|
3130
3114
|
{
|
|
3131
3115
|
id: "core-undo",
|
|
3132
3116
|
label: "Undo",
|
|
@@ -3263,7 +3247,7 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3263
3247
|
id: "core-heading2",
|
|
3264
3248
|
label: "H2",
|
|
3265
3249
|
group: "structure",
|
|
3266
|
-
icon:
|
|
3250
|
+
icon: Rr,
|
|
3267
3251
|
tooltip: "Heading 2",
|
|
3268
3252
|
isActive: e.isActive("heading", { level: 2 }),
|
|
3269
3253
|
disabled: !1,
|
|
@@ -3275,7 +3259,7 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3275
3259
|
id: "core-heading3",
|
|
3276
3260
|
label: "H3",
|
|
3277
3261
|
group: "structure",
|
|
3278
|
-
icon:
|
|
3262
|
+
icon: Dr,
|
|
3279
3263
|
tooltip: "Heading 3",
|
|
3280
3264
|
isActive: e.isActive("heading", { level: 3 }),
|
|
3281
3265
|
disabled: !1,
|
|
@@ -3287,7 +3271,7 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3287
3271
|
id: "core-align-left",
|
|
3288
3272
|
label: o ? "左对齐" : "Align Left",
|
|
3289
3273
|
group: "format",
|
|
3290
|
-
icon:
|
|
3274
|
+
icon: Mr,
|
|
3291
3275
|
tooltip: o ? "左对齐" : "Align Left",
|
|
3292
3276
|
isActive: e.isActive({ textAlign: "left" }),
|
|
3293
3277
|
disabled: !1,
|
|
@@ -3424,18 +3408,18 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3424
3408
|
FileText: an,
|
|
3425
3409
|
Link2: vt,
|
|
3426
3410
|
Image: rn
|
|
3427
|
-
}, p = G.getToolbarItems().map((
|
|
3428
|
-
const
|
|
3411
|
+
}, p = G.getToolbarItems().map((y) => {
|
|
3412
|
+
const I = G.getCommandMeta(y.command), k = y.tooltip || (I == null ? void 0 : I.description) || y.label, D = y.shortcut || (I == null ? void 0 : I.shortcut), M = D ? `${k} (${D})` : k;
|
|
3429
3413
|
return {
|
|
3430
|
-
id:
|
|
3431
|
-
label:
|
|
3432
|
-
group:
|
|
3433
|
-
icon:
|
|
3434
|
-
isActive: d.isCommandActive(
|
|
3435
|
-
disabled: !d.canExecCommand(
|
|
3436
|
-
tooltip:
|
|
3414
|
+
id: y.id,
|
|
3415
|
+
label: y.label,
|
|
3416
|
+
group: y.group || "technical",
|
|
3417
|
+
icon: y.icon ? m[y.icon] || _t : _t,
|
|
3418
|
+
isActive: d.isCommandActive(y.command),
|
|
3419
|
+
disabled: !d.canExecCommand(y.command),
|
|
3420
|
+
tooltip: M,
|
|
3437
3421
|
run: () => {
|
|
3438
|
-
d.execCommand(
|
|
3422
|
+
d.execCommand(y.command);
|
|
3439
3423
|
}
|
|
3440
3424
|
};
|
|
3441
3425
|
}), g = {
|
|
@@ -3447,18 +3431,18 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3447
3431
|
isActive: !1,
|
|
3448
3432
|
disabled: !1,
|
|
3449
3433
|
run: () => void Wt(e, i)
|
|
3450
|
-
},
|
|
3434
|
+
}, h = [
|
|
3451
3435
|
{ label: o ? "导出 Word (.docx)" : "Export Word (.docx)", onClick: () => void Wt(e, i) },
|
|
3452
3436
|
{ label: o ? "导出 PDF (打印)" : "Export PDF (Print)", onClick: () => void vs() }
|
|
3453
|
-
],
|
|
3454
|
-
group:
|
|
3455
|
-
items:
|
|
3456
|
-
})).filter((
|
|
3457
|
-
s((
|
|
3458
|
-
const
|
|
3459
|
-
return
|
|
3437
|
+
], b = [...u, ...p, g], v = b.map((y) => y.group).filter((y, I, k) => k.indexOf(y) === I && !t.includes(y)), C = [...t, ...v].map((y) => ({
|
|
3438
|
+
group: y,
|
|
3439
|
+
items: b.filter((I) => I.group === y)
|
|
3440
|
+
})).filter((y) => y.items.length > 0), S = (y) => {
|
|
3441
|
+
s((I) => {
|
|
3442
|
+
const k = new Set(I);
|
|
3443
|
+
return k.has(y) ? k.delete(y) : k.add(y), k;
|
|
3460
3444
|
});
|
|
3461
|
-
},
|
|
3445
|
+
}, T = [
|
|
3462
3446
|
{ label: o ? "插入表格 3×3" : "Insert Table 3×3", onClick: () => e.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: !0 }).run() },
|
|
3463
3447
|
{ label: o ? "上方插入行" : "Add Row Before", onClick: () => e.chain().focus().addRowBefore().run() },
|
|
3464
3448
|
{ label: o ? "下方插入行" : "Add Row After", onClick: () => e.chain().focus().addRowAfter().run() },
|
|
@@ -3474,20 +3458,20 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3474
3458
|
{ label: c.insertImageFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "image" }) },
|
|
3475
3459
|
{ label: c.insertMermaidFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "mermaid" }) },
|
|
3476
3460
|
{ label: c.insertDrawioFigure, onClick: () => void d.execCommand("patent.insertFigure", { contentType: "drawio" }) }
|
|
3477
|
-
], P = (
|
|
3461
|
+
], P = (y) => y.id === "core-table" ? /* @__PURE__ */ f(ut, { btn: y, items: T }, y.id) : y.id === "core-export" ? /* @__PURE__ */ f(ut, { btn: y, items: h }, y.id) : y.id === "patent-figure-insert" ? /* @__PURE__ */ f(ut, { btn: y, items: A }, y.id) : /* @__PURE__ */ f(
|
|
3478
3462
|
"button",
|
|
3479
3463
|
{
|
|
3480
|
-
onClick:
|
|
3481
|
-
disabled:
|
|
3464
|
+
onClick: y.run,
|
|
3465
|
+
disabled: y.disabled,
|
|
3482
3466
|
className: ae(
|
|
3483
3467
|
"p-2 rounded transition-colors",
|
|
3484
|
-
|
|
3485
|
-
|
|
3468
|
+
y.disabled ? "text-gray-400 cursor-not-allowed bg-gray-100" : "hover:bg-gray-200",
|
|
3469
|
+
y.isActive ? "bg-gray-300 text-blue-600" : "text-gray-700"
|
|
3486
3470
|
),
|
|
3487
|
-
title:
|
|
3488
|
-
children: /* @__PURE__ */ f(
|
|
3471
|
+
title: y.tooltip,
|
|
3472
|
+
children: /* @__PURE__ */ f(y.icon, { size: 18 })
|
|
3489
3473
|
},
|
|
3490
|
-
|
|
3474
|
+
y.id
|
|
3491
3475
|
);
|
|
3492
3476
|
return /* @__PURE__ */ f("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: [
|
|
3493
3477
|
/* @__PURE__ */ L("div", { className: "flex items-center gap-1 pr-2 mr-2 border-r border-gray-200", children: [
|
|
@@ -3496,8 +3480,8 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3496
3480
|
"select",
|
|
3497
3481
|
{
|
|
3498
3482
|
value: i,
|
|
3499
|
-
onChange: (
|
|
3500
|
-
l(
|
|
3483
|
+
onChange: (y) => {
|
|
3484
|
+
l(y.target.value === "en" ? "en" : "zh");
|
|
3501
3485
|
},
|
|
3502
3486
|
className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white text-gray-700",
|
|
3503
3487
|
children: [
|
|
@@ -3507,37 +3491,37 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3507
3491
|
}
|
|
3508
3492
|
)
|
|
3509
3493
|
] }),
|
|
3510
|
-
C.map((
|
|
3511
|
-
const
|
|
3494
|
+
C.map((y) => {
|
|
3495
|
+
const I = a.has(y.group);
|
|
3512
3496
|
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: [
|
|
3513
3497
|
n && /* @__PURE__ */ f(
|
|
3514
3498
|
"button",
|
|
3515
3499
|
{
|
|
3516
3500
|
onClick: () => {
|
|
3517
|
-
|
|
3501
|
+
S(y.group);
|
|
3518
3502
|
},
|
|
3519
3503
|
className: "px-2 py-1 text-xs rounded bg-gray-200 text-gray-700 hover:bg-gray-300",
|
|
3520
|
-
title:
|
|
3521
|
-
children: dt(
|
|
3504
|
+
title: I ? `Expand ${dt(y.group)}` : `Collapse ${dt(y.group)}`,
|
|
3505
|
+
children: dt(y.group)
|
|
3522
3506
|
}
|
|
3523
3507
|
),
|
|
3524
|
-
(!n || !
|
|
3525
|
-
] },
|
|
3508
|
+
(!n || !I) && y.items.map(P)
|
|
3509
|
+
] }, y.group);
|
|
3526
3510
|
})
|
|
3527
3511
|
] }) });
|
|
3528
3512
|
}, xs = ({ editor: e }) => {
|
|
3529
|
-
const [t, n] = z(0), [r, a] = z(""), [s, i] = z(""), l =
|
|
3513
|
+
const [t, n] = z(0), [r, a] = z(""), [s, i] = z(""), l = _((x) => x.editorLanguage), c = j(l);
|
|
3530
3514
|
if (B(() => {
|
|
3531
3515
|
if (!e) return;
|
|
3532
|
-
const
|
|
3533
|
-
return e.on("selectionUpdate",
|
|
3534
|
-
e.off("selectionUpdate",
|
|
3516
|
+
const x = () => n((H) => H + 1);
|
|
3517
|
+
return e.on("selectionUpdate", x), e.on("update", x), () => {
|
|
3518
|
+
e.off("selectionUpdate", x), e.off("update", x);
|
|
3535
3519
|
};
|
|
3536
3520
|
}, [e]), !e) return null;
|
|
3537
|
-
const d =
|
|
3538
|
-
e.state.doc.descendants((
|
|
3539
|
-
if (
|
|
3540
|
-
const H = typeof
|
|
3521
|
+
const d = Le(e), o = [];
|
|
3522
|
+
e.state.doc.descendants((x) => {
|
|
3523
|
+
if (x.type.name !== "claim") return !0;
|
|
3524
|
+
const H = typeof x.attrs.claimId == "string" ? x.attrs.claimId : "", O = Number(x.attrs.number);
|
|
3541
3525
|
return !H || !Number.isFinite(O) || o.push({
|
|
3542
3526
|
id: H,
|
|
3543
3527
|
number: O,
|
|
@@ -3545,30 +3529,30 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3545
3529
|
}), !0;
|
|
3546
3530
|
});
|
|
3547
3531
|
const u = [];
|
|
3548
|
-
e.state.doc.descendants((
|
|
3549
|
-
if (
|
|
3550
|
-
const H = typeof
|
|
3532
|
+
e.state.doc.descendants((x) => {
|
|
3533
|
+
if (x.type.name !== "figure") return !0;
|
|
3534
|
+
const H = typeof x.attrs.id == "string" ? x.attrs.id.trim() : "";
|
|
3551
3535
|
return H && u.push({ id: H, label: H }), !0;
|
|
3552
3536
|
});
|
|
3553
|
-
const m = d.findAncestorNode("claim"), p = m && typeof m.node.attrs.claimId == "string" ? m.node.attrs.claimId : "", g = Number(m == null ? void 0 : m.node.attrs.number),
|
|
3554
|
-
(
|
|
3555
|
-
),
|
|
3556
|
-
if (!
|
|
3557
|
-
const H =
|
|
3537
|
+
const m = d.findAncestorNode("claim"), p = m && typeof m.node.attrs.claimId == "string" ? m.node.attrs.claimId : "", g = Number(m == null ? void 0 : m.node.attrs.number), h = Array.isArray(m == null ? void 0 : m.node.attrs.dependsOn) ? m.node.attrs.dependsOn.map((x) => Number(x)).filter((x) => Number.isFinite(x)) : [], b = o.filter(
|
|
3538
|
+
(x) => Number.isFinite(g) && x.number < g
|
|
3539
|
+
), v = new Set(h), w = !!p, C = (x) => {
|
|
3540
|
+
if (!w) return;
|
|
3541
|
+
const H = v.has(x) ? h.filter((O) => O !== x) : [...h, x].sort((O, $) => O - $);
|
|
3558
3542
|
d.execCommand("patent.setClaimDependency", { dependsOn: H });
|
|
3559
|
-
},
|
|
3560
|
-
|
|
3561
|
-
const Q = (
|
|
3562
|
-
|
|
3563
|
-
position:
|
|
3564
|
-
contentType:
|
|
3543
|
+
}, S = d.findAncestorNode("figure"), T = !!S, A = S && typeof S.node.attrs.id == "string" ? S.node.attrs.id.trim() : "", P = S && typeof S.node.attrs.contentType == "string" ? S.node.attrs.contentType : "image", [y, I] = z(""), k = X(null), D = X(null), M = (S == null ? void 0 : S.pos) ?? null;
|
|
3544
|
+
M !== D.current && (D.current = M, T && A !== y && I(A));
|
|
3545
|
+
const Q = (x) => {
|
|
3546
|
+
S && d.execCommand("patent.updateFigure", {
|
|
3547
|
+
position: S.pos,
|
|
3548
|
+
contentType: x
|
|
3565
3549
|
});
|
|
3566
|
-
},
|
|
3567
|
-
if (!
|
|
3568
|
-
const
|
|
3569
|
-
|
|
3570
|
-
position:
|
|
3571
|
-
id:
|
|
3550
|
+
}, Pe = () => {
|
|
3551
|
+
if (!S) return;
|
|
3552
|
+
const x = y.trim();
|
|
3553
|
+
x !== A && d.execCommand("patent.updateFigure", {
|
|
3554
|
+
position: S.pos,
|
|
3555
|
+
id: x
|
|
3572
3556
|
});
|
|
3573
3557
|
};
|
|
3574
3558
|
return /* @__PURE__ */ f("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: [
|
|
@@ -3578,11 +3562,11 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3578
3562
|
"select",
|
|
3579
3563
|
{
|
|
3580
3564
|
value: r || "__none__",
|
|
3581
|
-
onChange: (
|
|
3565
|
+
onChange: (x) => a(x.target.value === "__none__" ? "" : x.target.value),
|
|
3582
3566
|
className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white",
|
|
3583
3567
|
children: [
|
|
3584
3568
|
/* @__PURE__ */ f("option", { value: "__none__", children: c.referenceTargetPlaceholder }),
|
|
3585
|
-
o.map((
|
|
3569
|
+
o.map((x) => /* @__PURE__ */ f("option", { value: x.id, children: x.label }, x.id))
|
|
3586
3570
|
]
|
|
3587
3571
|
}
|
|
3588
3572
|
),
|
|
@@ -3607,11 +3591,11 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3607
3591
|
"select",
|
|
3608
3592
|
{
|
|
3609
3593
|
value: s || "__none__",
|
|
3610
|
-
onChange: (
|
|
3594
|
+
onChange: (x) => i(x.target.value === "__none__" ? "" : x.target.value),
|
|
3611
3595
|
className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white",
|
|
3612
3596
|
children: [
|
|
3613
3597
|
/* @__PURE__ */ f("option", { value: "__none__", children: c.figureReferenceTargetPlaceholder }),
|
|
3614
|
-
u.map((
|
|
3598
|
+
u.map((x) => /* @__PURE__ */ f("option", { value: x.id, children: x.label }, x.id))
|
|
3615
3599
|
]
|
|
3616
3600
|
}
|
|
3617
3601
|
),
|
|
@@ -3631,19 +3615,19 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3631
3615
|
)
|
|
3632
3616
|
] }),
|
|
3633
3617
|
/* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
|
|
3634
|
-
|
|
3618
|
+
T && /* @__PURE__ */ L(Se, { children: [
|
|
3635
3619
|
/* @__PURE__ */ f("span", { className: "text-xs font-medium text-gray-700", children: c.currentFigure }),
|
|
3636
3620
|
/* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.figureId }),
|
|
3637
3621
|
/* @__PURE__ */ f(
|
|
3638
3622
|
"input",
|
|
3639
3623
|
{
|
|
3640
|
-
ref:
|
|
3624
|
+
ref: k,
|
|
3641
3625
|
type: "text",
|
|
3642
|
-
value:
|
|
3643
|
-
onChange: (
|
|
3644
|
-
onBlur:
|
|
3645
|
-
onKeyDown: (
|
|
3646
|
-
|
|
3626
|
+
value: y,
|
|
3627
|
+
onChange: (x) => I(x.target.value),
|
|
3628
|
+
onBlur: Pe,
|
|
3629
|
+
onKeyDown: (x) => {
|
|
3630
|
+
x.key === "Enter" && (Pe(), x.target.blur());
|
|
3647
3631
|
},
|
|
3648
3632
|
className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white w-20",
|
|
3649
3633
|
placeholder: l === "en" ? "Fig.1" : "图1"
|
|
@@ -3654,7 +3638,7 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3654
3638
|
"select",
|
|
3655
3639
|
{
|
|
3656
3640
|
value: P,
|
|
3657
|
-
onChange: (
|
|
3641
|
+
onChange: (x) => Q(x.target.value),
|
|
3658
3642
|
className: "text-xs border border-gray-200 rounded px-2 py-1 bg-white",
|
|
3659
3643
|
children: [
|
|
3660
3644
|
/* @__PURE__ */ f("option", { value: "image", children: c.figureContentTypeImage }),
|
|
@@ -3681,29 +3665,29 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3681
3665
|
/* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" })
|
|
3682
3666
|
] });
|
|
3683
3667
|
})(),
|
|
3684
|
-
|
|
3668
|
+
w ? /* @__PURE__ */ L(Se, { children: [
|
|
3685
3669
|
/* @__PURE__ */ f("span", { className: "text-xs font-medium text-gray-700", children: c.currentClaim(g) }),
|
|
3686
|
-
|
|
3670
|
+
b.length > 0 && /* @__PURE__ */ L("div", { className: "flex flex-wrap gap-1 items-center", children: [
|
|
3687
3671
|
/* @__PURE__ */ f("span", { className: "text-xs text-gray-500", children: c.dependsOn }),
|
|
3688
|
-
|
|
3672
|
+
b.map((x) => /* @__PURE__ */ f(
|
|
3689
3673
|
"button",
|
|
3690
3674
|
{
|
|
3691
|
-
onClick: () => C(
|
|
3692
|
-
className: `text-xs px-2 py-0.5 rounded border ${
|
|
3693
|
-
children:
|
|
3675
|
+
onClick: () => C(x.number),
|
|
3676
|
+
className: `text-xs px-2 py-0.5 rounded border ${v.has(x.number) ? "bg-blue-50 text-blue-700 border-blue-200" : "bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,
|
|
3677
|
+
children: x.number
|
|
3694
3678
|
},
|
|
3695
|
-
|
|
3679
|
+
x.id
|
|
3696
3680
|
))
|
|
3697
3681
|
] })
|
|
3698
|
-
] }) :
|
|
3682
|
+
] }) : T ? null : /* @__PURE__ */ f("span", { className: "text-xs text-gray-400", children: c.placeCursorToEditDependencies }),
|
|
3699
3683
|
/* @__PURE__ */ f("div", { className: "h-6 w-px bg-gray-200 mx-1" }),
|
|
3700
3684
|
/* @__PURE__ */ f(
|
|
3701
3685
|
"button",
|
|
3702
3686
|
{
|
|
3703
3687
|
onClick: async () => {
|
|
3704
|
-
if (
|
|
3705
|
-
const { from:
|
|
3706
|
-
|
|
3688
|
+
if (w && await d.execCommand("patent.deleteClaim") || e.chain().focus().deleteSelection().run()) return;
|
|
3689
|
+
const { from: x } = e.state.selection;
|
|
3690
|
+
x > 1 && e.chain().focus().deleteRange({ from: x - 1, to: x }).run();
|
|
3707
3691
|
},
|
|
3708
3692
|
className: "p-2 hover:bg-red-50 text-red-600 rounded",
|
|
3709
3693
|
title: c.deleteSelection,
|
|
@@ -3805,11 +3789,11 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3805
3789
|
}), e.forEach((o) => {
|
|
3806
3790
|
if (o.dependsOn.length > 1) {
|
|
3807
3791
|
const u = o.dependsOn, m = u.some((g) => {
|
|
3808
|
-
const
|
|
3809
|
-
return
|
|
3792
|
+
const h = e.find((b) => b.number === g);
|
|
3793
|
+
return h && h.dependsOn.length === 0;
|
|
3810
3794
|
}), p = u.some((g) => {
|
|
3811
|
-
const
|
|
3812
|
-
return
|
|
3795
|
+
const h = e.find((b) => b.number === g);
|
|
3796
|
+
return h && h.dependsOn.length > 0;
|
|
3813
3797
|
});
|
|
3814
3798
|
m && p && n.push({
|
|
3815
3799
|
claimId: o.claimId,
|
|
@@ -3837,11 +3821,11 @@ const Cs = ["history", "text", "structure", "format", "technical", "patent"], dt
|
|
|
3837
3821
|
claimId: o,
|
|
3838
3822
|
number: m.number,
|
|
3839
3823
|
depth: u
|
|
3840
|
-
}), (n.get(o) || []).map((g) => i.get(g)).filter((g) => !!g).sort((g,
|
|
3824
|
+
}), (n.get(o) || []).map((g) => i.get(g)).filter((g) => !!g).sort((g, h) => g.number - h.number).map((g) => g.claimId).forEach((g) => d(g, u + 1));
|
|
3841
3825
|
};
|
|
3842
3826
|
return s.forEach((o) => d(o, 0)), l;
|
|
3843
3827
|
}, ks = ({ editor: e }) => {
|
|
3844
|
-
const [t, n] = z(!1), r =
|
|
3828
|
+
const [t, n] = z(!1), r = _((o) => o.editorLanguage), a = j(r), s = zn({
|
|
3845
3829
|
editor: e,
|
|
3846
3830
|
selector: (o) => Es(o.editor)
|
|
3847
3831
|
}), i = Ee(
|
|
@@ -3956,7 +3940,7 @@ function Ls(e, t) {
|
|
|
3956
3940
|
}).filter((s) => s !== null && s.content.length > 0);
|
|
3957
3941
|
}
|
|
3958
3942
|
function fo(e, t = {}) {
|
|
3959
|
-
const n =
|
|
3943
|
+
const n = _.getState().editorLanguage, { from: r, to: a } = e.state.selection, s = r !== a ? e.state.doc.textBetween(r, a, " ", "\0") : void 0;
|
|
3960
3944
|
let i = t.sectionType, l = t.targetSectionPos;
|
|
3961
3945
|
if (!i) {
|
|
3962
3946
|
const u = wn(e);
|
|
@@ -3965,8 +3949,8 @@ function fo(e, t = {}) {
|
|
|
3965
3949
|
const c = t.scope || (i ? "section" : s ? "selection" : "document"), d = i ? Ls(e, i) : void 0;
|
|
3966
3950
|
let o;
|
|
3967
3951
|
if (c === "selection" && r !== a) {
|
|
3968
|
-
const m = Math.max(0, r - 200), p = Math.min(e.state.doc.content.size, a + 200), g = e.state.doc.textBetween(m, r, " ", "\0"),
|
|
3969
|
-
o = `...${g}[SELECTED]${
|
|
3952
|
+
const m = Math.max(0, r - 200), p = Math.min(e.state.doc.content.size, a + 200), g = e.state.doc.textBetween(m, r, " ", "\0"), h = e.state.doc.textBetween(a, p, " ", "\0");
|
|
3953
|
+
o = `...${g}[SELECTED]${h}...`;
|
|
3970
3954
|
}
|
|
3971
3955
|
return {
|
|
3972
3956
|
scope: c,
|
|
@@ -3980,7 +3964,7 @@ function fo(e, t = {}) {
|
|
|
3980
3964
|
};
|
|
3981
3965
|
}
|
|
3982
3966
|
const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
3983
|
-
const { addChatReference: n, openChatPanel: r, editorLanguage: a } =
|
|
3967
|
+
const { addChatReference: n, openChatPanel: r, editorLanguage: a } = _(), s = a === "zh", i = (d) => ae(
|
|
3984
3968
|
"p-1.5 rounded transition-colors",
|
|
3985
3969
|
d ? "bg-blue-100 text-blue-600" : "text-gray-600 hover:bg-gray-100"
|
|
3986
3970
|
), l = () => {
|
|
@@ -4100,35 +4084,35 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4100
4084
|
] })
|
|
4101
4085
|
}
|
|
4102
4086
|
);
|
|
4103
|
-
},
|
|
4104
|
-
var
|
|
4105
|
-
const [t, n] = z(!1), [r, a] = z(!1), [s, i] = z(""), [l, c] = z(""), [d, o] = z(!1), u = X(null), m = e.extensionStorage.searchReplace, p = ((
|
|
4087
|
+
}, Rs = ({ editor: e }) => {
|
|
4088
|
+
var w;
|
|
4089
|
+
const [t, n] = z(!1), [r, a] = z(!1), [s, i] = z(""), [l, c] = z(""), [d, o] = z(!1), u = X(null), m = e.extensionStorage.searchReplace, p = ((w = m == null ? void 0 : m.results) == null ? void 0 : w.length) ?? 0, g = (m == null ? void 0 : m.currentIndex) ?? -1;
|
|
4106
4090
|
B(() => {
|
|
4107
|
-
const C = (
|
|
4091
|
+
const C = (S) => {
|
|
4108
4092
|
n(!0);
|
|
4109
|
-
const
|
|
4110
|
-
|
|
4093
|
+
const T = S.detail;
|
|
4094
|
+
T != null && T.replace && a(!0), requestAnimationFrame(() => {
|
|
4111
4095
|
var A;
|
|
4112
4096
|
return (A = u.current) == null ? void 0 : A.focus();
|
|
4113
4097
|
});
|
|
4114
4098
|
};
|
|
4115
4099
|
return window.addEventListener("editor:toggleSearch", C), () => window.removeEventListener("editor:toggleSearch", C);
|
|
4116
4100
|
}, []);
|
|
4117
|
-
const
|
|
4101
|
+
const h = de(
|
|
4118
4102
|
(C) => {
|
|
4119
4103
|
i(C), e.commands.setSearchTerm(C);
|
|
4120
4104
|
},
|
|
4121
4105
|
[e]
|
|
4122
|
-
),
|
|
4106
|
+
), b = de(() => {
|
|
4123
4107
|
n(!1), e.commands.clearSearch(), e.commands.focus();
|
|
4124
4108
|
}, [e]);
|
|
4125
4109
|
B(() => {
|
|
4126
|
-
const C = (
|
|
4127
|
-
|
|
4110
|
+
const C = (S) => {
|
|
4111
|
+
S.key === "Escape" && t && b();
|
|
4128
4112
|
};
|
|
4129
4113
|
return window.addEventListener("keydown", C), () => window.removeEventListener("keydown", C);
|
|
4130
|
-
}, [t,
|
|
4131
|
-
const
|
|
4114
|
+
}, [t, b]);
|
|
4115
|
+
const v = () => {
|
|
4132
4116
|
const C = !d;
|
|
4133
4117
|
o(C), e.commands.setCaseSensitive(C);
|
|
4134
4118
|
};
|
|
@@ -4141,7 +4125,7 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4141
4125
|
ref: u,
|
|
4142
4126
|
type: "text",
|
|
4143
4127
|
value: s,
|
|
4144
|
-
onChange: (C) =>
|
|
4128
|
+
onChange: (C) => h(C.target.value),
|
|
4145
4129
|
onKeyDown: (C) => {
|
|
4146
4130
|
C.key === "Enter" && (C.shiftKey ? e.commands.previousSearchResult() : e.commands.nextSearchResult());
|
|
4147
4131
|
},
|
|
@@ -4154,7 +4138,7 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4154
4138
|
/* @__PURE__ */ f(
|
|
4155
4139
|
"button",
|
|
4156
4140
|
{
|
|
4157
|
-
onClick:
|
|
4141
|
+
onClick: v,
|
|
4158
4142
|
className: ae("find-replace-btn", d && "find-replace-btn--active"),
|
|
4159
4143
|
title: "Case Sensitive",
|
|
4160
4144
|
children: /* @__PURE__ */ f(ta, { size: 15 })
|
|
@@ -4171,7 +4155,7 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4171
4155
|
children: /* @__PURE__ */ f(kt, { size: 15 })
|
|
4172
4156
|
}
|
|
4173
4157
|
),
|
|
4174
|
-
/* @__PURE__ */ f("button", { onClick:
|
|
4158
|
+
/* @__PURE__ */ f("button", { onClick: b, className: "find-replace-btn", title: "Close (Esc)", children: /* @__PURE__ */ f(ra, { size: 15 }) })
|
|
4175
4159
|
] }),
|
|
4176
4160
|
r && /* @__PURE__ */ L("div", { className: "find-replace-row", children: [
|
|
4177
4161
|
/* @__PURE__ */ f(
|
|
@@ -4193,8 +4177,8 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4193
4177
|
/* @__PURE__ */ f("button", { onClick: () => e.commands.replaceAll(), className: "find-replace-btn", title: "Replace All", children: /* @__PURE__ */ f(aa, { size: 15 }) })
|
|
4194
4178
|
] })
|
|
4195
4179
|
] }) : null;
|
|
4196
|
-
},
|
|
4197
|
-
const { editorLanguage: t } =
|
|
4180
|
+
}, Ds = ({ editor: e }) => {
|
|
4181
|
+
const { editorLanguage: t } = _(), n = t === "zh", r = Ee(() => {
|
|
4198
4182
|
const a = e.state, i = a.doc.textBetween(0, a.doc.content.size, " ", "\0").replace(/\s/g, "").length, { from: l, to: c } = a.selection;
|
|
4199
4183
|
let d = 0;
|
|
4200
4184
|
return l !== c && (d = a.doc.textBetween(l, c, " ", "\0").replace(/\s/g, "").length), { charCount: i, selectionCount: d };
|
|
@@ -4211,7 +4195,7 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4211
4195
|
r.selectionCount
|
|
4212
4196
|
] })
|
|
4213
4197
|
] });
|
|
4214
|
-
},
|
|
4198
|
+
}, Ms = {
|
|
4215
4199
|
empty: "○",
|
|
4216
4200
|
filled: "●"
|
|
4217
4201
|
}, Os = {
|
|
@@ -4224,7 +4208,7 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4224
4208
|
"drawing_description",
|
|
4225
4209
|
"detailed_description"
|
|
4226
4210
|
]), Fs = ({ editor: e }) => {
|
|
4227
|
-
const { editorLanguage: t } =
|
|
4211
|
+
const { editorLanguage: t } = _(), n = j(t), [r, a] = z(!1), [s, i] = z(0);
|
|
4228
4212
|
B(() => {
|
|
4229
4213
|
const c = () => i((d) => d + 1);
|
|
4230
4214
|
return e.on("update", c), () => {
|
|
@@ -4237,11 +4221,11 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4237
4221
|
return e.state.doc.descendants((o, u) => {
|
|
4238
4222
|
if (o.type.name === "patent_title") {
|
|
4239
4223
|
if (!d) {
|
|
4240
|
-
const
|
|
4224
|
+
const h = typeof n.bookTitle_description == "string" ? n.bookTitle_description : "说明书";
|
|
4241
4225
|
c.push({
|
|
4242
4226
|
type: "book-group",
|
|
4243
4227
|
pos: u,
|
|
4244
|
-
title:
|
|
4228
|
+
title: h,
|
|
4245
4229
|
charCount: 0
|
|
4246
4230
|
}), d = !0;
|
|
4247
4231
|
}
|
|
@@ -4256,13 +4240,13 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4256
4240
|
}), !1;
|
|
4257
4241
|
}
|
|
4258
4242
|
if (o.type.name === "patent_section") {
|
|
4259
|
-
const m = o.attrs.sectionType, p = $s.has(m), g = `sectionTitle_${m}`,
|
|
4243
|
+
const m = o.attrs.sectionType, p = $s.has(m), g = `sectionTitle_${m}`, h = typeof n[g] == "string" ? n[g] : m, b = o.textContent || "", v = b.trim().length > 0;
|
|
4260
4244
|
return c.push({
|
|
4261
4245
|
type: "section",
|
|
4262
4246
|
pos: u,
|
|
4263
|
-
title:
|
|
4264
|
-
state:
|
|
4265
|
-
charCount:
|
|
4247
|
+
title: h,
|
|
4248
|
+
state: v ? "filled" : "empty",
|
|
4249
|
+
charCount: b.replace(/\s/g, "").length,
|
|
4266
4250
|
indent: p
|
|
4267
4251
|
}), !1;
|
|
4268
4252
|
}
|
|
@@ -4319,7 +4303,7 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4319
4303
|
}));
|
|
4320
4304
|
},
|
|
4321
4305
|
children: [
|
|
4322
|
-
c.type === "section" && c.state && /* @__PURE__ */ f("span", { className: ae("outline-item-state", Os[c.state]), children:
|
|
4306
|
+
c.type === "section" && c.state && /* @__PURE__ */ f("span", { className: ae("outline-item-state", Os[c.state]), children: Ms[c.state] || "○" }),
|
|
4323
4307
|
/* @__PURE__ */ f("span", { className: "outline-item-title", children: c.title }),
|
|
4324
4308
|
c.type !== "book-group" && /* @__PURE__ */ f("span", { className: "outline-item-count", children: c.charCount })
|
|
4325
4309
|
]
|
|
@@ -4360,7 +4344,7 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4360
4344
|
onEditorReady: s,
|
|
4361
4345
|
onSelectionOptimize: i
|
|
4362
4346
|
}) => {
|
|
4363
|
-
const { setEditor: l, setDocument: c, editorLanguage: d, autoSaveStatus: o, ai: u } =
|
|
4347
|
+
const { setEditor: l, setDocument: c, editorLanguage: d, autoSaveStatus: o, ai: u } = _(), { setAutoSaveStatus: m, setLastSavedAt: p } = _(), g = X(null), h = e || (t ? null : Hs()) || {
|
|
4364
4348
|
type: "doc",
|
|
4365
4349
|
content: [
|
|
4366
4350
|
{
|
|
@@ -4368,26 +4352,26 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4368
4352
|
content: [{ type: "text", text: "" }]
|
|
4369
4353
|
}
|
|
4370
4354
|
]
|
|
4371
|
-
},
|
|
4355
|
+
}, b = de((T) => {
|
|
4372
4356
|
try {
|
|
4373
|
-
m("saving"), localStorage.setItem(xn, JSON.stringify(
|
|
4357
|
+
m("saving"), localStorage.setItem(xn, JSON.stringify(T)), m("saved"), p(/* @__PURE__ */ new Date());
|
|
4374
4358
|
} catch {
|
|
4375
4359
|
m("error");
|
|
4376
4360
|
}
|
|
4377
|
-
}, [m, p]),
|
|
4361
|
+
}, [m, p]), v = Hn(
|
|
4378
4362
|
fs({
|
|
4379
|
-
content:
|
|
4380
|
-
onUpdate: ({ editor:
|
|
4381
|
-
const A =
|
|
4382
|
-
c(A), G.notifyStateChange(
|
|
4383
|
-
|
|
4363
|
+
content: h,
|
|
4364
|
+
onUpdate: ({ editor: T }) => {
|
|
4365
|
+
const A = T.getJSON();
|
|
4366
|
+
c(A), G.notifyStateChange(T), t && t(A), t || (g.current && clearTimeout(g.current), g.current = setTimeout(() => {
|
|
4367
|
+
b(A);
|
|
4384
4368
|
}, Bs));
|
|
4385
4369
|
},
|
|
4386
|
-
onCreate: ({ editor:
|
|
4387
|
-
l(
|
|
4370
|
+
onCreate: ({ editor: T }) => {
|
|
4371
|
+
l(T), s == null || s(T), G.initializePlugins(T), Le(T).execCommand("patent.normalizeClaims"), G.notifyStateChange(T);
|
|
4388
4372
|
},
|
|
4389
|
-
onSelectionUpdate: ({ editor:
|
|
4390
|
-
G.notifySelectionChange(
|
|
4373
|
+
onSelectionUpdate: ({ editor: T }) => {
|
|
4374
|
+
G.notifySelectionChange(T);
|
|
4391
4375
|
},
|
|
4392
4376
|
editorProps: {
|
|
4393
4377
|
attributes: {
|
|
@@ -4395,42 +4379,42 @@ const Ps = ({ editor: e, onSelectionOptimize: t }) => {
|
|
|
4395
4379
|
}
|
|
4396
4380
|
}
|
|
4397
4381
|
})
|
|
4398
|
-
),
|
|
4382
|
+
), w = X(!1);
|
|
4399
4383
|
if (B(() => {
|
|
4400
|
-
if (!(!
|
|
4401
|
-
if (!
|
|
4402
|
-
|
|
4384
|
+
if (!(!v || !e)) {
|
|
4385
|
+
if (!w.current) {
|
|
4386
|
+
w.current = !0;
|
|
4403
4387
|
return;
|
|
4404
4388
|
}
|
|
4405
|
-
|
|
4389
|
+
v.commands.setContent(e);
|
|
4406
4390
|
}
|
|
4407
|
-
}, [
|
|
4408
|
-
g.current && clearTimeout(g.current),
|
|
4409
|
-
}, [
|
|
4410
|
-
|
|
4411
|
-
}, [
|
|
4391
|
+
}, [v, e]), B(() => () => {
|
|
4392
|
+
g.current && clearTimeout(g.current), v && (G.destroyPlugins(v), v.destroy());
|
|
4393
|
+
}, [v]), B(() => {
|
|
4394
|
+
v && G.notifyStateChange(v);
|
|
4395
|
+
}, [v, d]), !v)
|
|
4412
4396
|
return null;
|
|
4413
|
-
const C = j(d),
|
|
4397
|
+
const C = j(d), S = o === "saving" ? C.autoSaveSaving : o === "saved" ? C.autoSaveSaved : o === "error" ? C.autoSaveError : "";
|
|
4414
4398
|
return /* @__PURE__ */ L("div", { className: `editor-container flex flex-col h-full ${n}`, children: [
|
|
4415
4399
|
!r && /* @__PURE__ */ L("div", { className: "flex items-center", children: [
|
|
4416
|
-
/* @__PURE__ */ f(ws, { editor:
|
|
4417
|
-
|
|
4400
|
+
/* @__PURE__ */ f(ws, { editor: v }),
|
|
4401
|
+
S && /* @__PURE__ */ f("span", { className: `auto-save-indicator auto-save-indicator--${o} ml-2`, children: S })
|
|
4418
4402
|
] }),
|
|
4419
|
-
!r &&
|
|
4420
|
-
!r &&
|
|
4421
|
-
!r &&
|
|
4422
|
-
!r &&
|
|
4403
|
+
!r && v && /* @__PURE__ */ f(xs, { editor: v }),
|
|
4404
|
+
!r && v && /* @__PURE__ */ f(ks, { editor: v }),
|
|
4405
|
+
!r && v && /* @__PURE__ */ f(Ps, { editor: v, onSelectionOptimize: i }),
|
|
4406
|
+
!r && v && /* @__PURE__ */ f(Rs, { editor: v }),
|
|
4423
4407
|
/* @__PURE__ */ L("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
4424
|
-
!r &&
|
|
4408
|
+
!r && v && /* @__PURE__ */ f(Fs, { editor: v }),
|
|
4425
4409
|
/* @__PURE__ */ f("div", { className: "flex-1 overflow-y-auto bg-white p-4 relative", children: /* @__PURE__ */ f(
|
|
4426
4410
|
zs,
|
|
4427
4411
|
{
|
|
4428
|
-
editor:
|
|
4412
|
+
editor: v,
|
|
4429
4413
|
mode: r || !a || u.status === "streaming" && u.activeSectionType === "claims" ? "readonly" : "edit"
|
|
4430
4414
|
}
|
|
4431
4415
|
) })
|
|
4432
4416
|
] }),
|
|
4433
|
-
!r && /* @__PURE__ */ f(
|
|
4417
|
+
!r && /* @__PURE__ */ f(Ds, { editor: v })
|
|
4434
4418
|
] });
|
|
4435
4419
|
};
|
|
4436
4420
|
function Sn(e) {
|
|
@@ -4563,39 +4547,39 @@ function Ws(e, t) {
|
|
|
4563
4547
|
}
|
|
4564
4548
|
const Gs = qt(
|
|
4565
4549
|
({ initialContent: e, patentType: t, onChange: n, className: r, readOnly: a = !1, editable: s = !0, language: i, aiService: l, chatSessionAPI: c, aiBaseUrl: d, aiHeaders: o, onSelectionOptimize: u }, m) => {
|
|
4566
|
-
const { setEditorLanguage: p, setAIService: g, setChatSessionAPI:
|
|
4567
|
-
|
|
4568
|
-
}, []),
|
|
4550
|
+
const { setEditorLanguage: p, setAIService: g, setChatSessionAPI: h } = _(), b = X(null), v = de((C) => {
|
|
4551
|
+
b.current = C;
|
|
4552
|
+
}, []), w = $e.useMemo(() => {
|
|
4569
4553
|
if (e) return e;
|
|
4570
4554
|
if (t) return pn(t);
|
|
4571
4555
|
}, [e, t]);
|
|
4572
|
-
return
|
|
4556
|
+
return $e.useEffect(() => {
|
|
4573
4557
|
i && p(i);
|
|
4574
|
-
}, [i, p]),
|
|
4558
|
+
}, [i, p]), $e.useEffect(() => {
|
|
4575
4559
|
l ? g(l) : d && g(js(d, o));
|
|
4576
|
-
}, [l, d, o, g]),
|
|
4577
|
-
c ?
|
|
4578
|
-
}, [c, d, o,
|
|
4560
|
+
}, [l, d, o, g]), $e.useEffect(() => {
|
|
4561
|
+
c ? h(c) : d && h(Ws(d, o));
|
|
4562
|
+
}, [c, d, o, h]), Vt(m, () => ({
|
|
4579
4563
|
getContent: () => {
|
|
4580
4564
|
var C;
|
|
4581
|
-
return ((C =
|
|
4565
|
+
return ((C = b.current) == null ? void 0 : C.getJSON()) ?? null;
|
|
4582
4566
|
},
|
|
4583
4567
|
setContent: (C) => {
|
|
4584
|
-
var
|
|
4585
|
-
(
|
|
4568
|
+
var S;
|
|
4569
|
+
(S = b.current) == null || S.commands.setContent(C);
|
|
4586
4570
|
},
|
|
4587
|
-
getEditor: () =>
|
|
4588
|
-
execCommand: async (C,
|
|
4571
|
+
getEditor: () => b.current,
|
|
4572
|
+
execCommand: async (C, S) => b.current ? Le(b.current).execCommand(C, S) : null,
|
|
4589
4573
|
focus: () => {
|
|
4590
4574
|
var C;
|
|
4591
|
-
(C =
|
|
4575
|
+
(C = b.current) == null || C.commands.focus();
|
|
4592
4576
|
}
|
|
4593
4577
|
})), /* @__PURE__ */ f(
|
|
4594
4578
|
Us,
|
|
4595
4579
|
{
|
|
4596
|
-
initialContent:
|
|
4580
|
+
initialContent: w,
|
|
4597
4581
|
onChange: n,
|
|
4598
|
-
onEditorReady:
|
|
4582
|
+
onEditorReady: v,
|
|
4599
4583
|
className: r,
|
|
4600
4584
|
readOnly: a,
|
|
4601
4585
|
editable: s,
|
|
@@ -4639,26 +4623,26 @@ async function po(e, t, n, r) {
|
|
|
4639
4623
|
throw new Error(`HTTP ${p.status}: ${p.statusText}`);
|
|
4640
4624
|
const g = (i = p.body) == null ? void 0 : i.getReader();
|
|
4641
4625
|
if (!g) throw new Error("No response body");
|
|
4642
|
-
const
|
|
4643
|
-
let
|
|
4626
|
+
const h = new TextDecoder();
|
|
4627
|
+
let b = Tn(e, r), v = "";
|
|
4644
4628
|
for (; ; ) {
|
|
4645
|
-
const { done:
|
|
4646
|
-
if (
|
|
4647
|
-
|
|
4648
|
-
const
|
|
4629
|
+
const { done: w, value: C } = await g.read();
|
|
4630
|
+
if (w) break;
|
|
4631
|
+
v += h.decode(C, { stream: !0 });
|
|
4632
|
+
const S = v.split(`
|
|
4649
4633
|
`);
|
|
4650
|
-
|
|
4651
|
-
for (const
|
|
4652
|
-
if (!
|
|
4653
|
-
const A =
|
|
4634
|
+
v = S.pop() || "";
|
|
4635
|
+
for (const T of S) {
|
|
4636
|
+
if (!T.startsWith("data: ")) continue;
|
|
4637
|
+
const A = T.slice(6).trim();
|
|
4654
4638
|
if (A === "[DONE]")
|
|
4655
4639
|
return r.mode === "section" && typeof r.targetSectionPos == "number" && yt(e, r.targetSectionPos), (l = r.onComplete) == null || l.call(r), { abort: () => a.abort() };
|
|
4656
4640
|
try {
|
|
4657
|
-
const P = JSON.parse(A),
|
|
4658
|
-
if (!
|
|
4659
|
-
(d = r.onChunk) == null || d.call(r,
|
|
4660
|
-
const
|
|
4661
|
-
e.view.dispatch(
|
|
4641
|
+
const P = JSON.parse(A), y = P.content || P.text || ((c = P.delta) == null ? void 0 : c.content) || "";
|
|
4642
|
+
if (!y) continue;
|
|
4643
|
+
(d = r.onChunk) == null || d.call(r, y);
|
|
4644
|
+
const I = e.state.tr.insertText(y, b);
|
|
4645
|
+
e.view.dispatch(I), b = I.mapping.map(b, 1);
|
|
4662
4646
|
} catch {
|
|
4663
4647
|
}
|
|
4664
4648
|
}
|
|
@@ -4776,7 +4760,7 @@ S103:局部实时避障控制。采用模型预测控制(MPC)策略,以
|
|
|
4776
4760
|
S104:安全验证。对计算得到的控制指令进行轨迹传播仿真,验证机动后轨迹在未来72小时内不会与TLE目录中的已知空间目标产生碰撞风险(miss distance > 1km)。`,
|
|
4777
4761
|
en: "The technical solution of the embodiments of the present invention will be described clearly and completely below with reference to the drawings."
|
|
4778
4762
|
}
|
|
4779
|
-
},
|
|
4763
|
+
}, We = {
|
|
4780
4764
|
"help-draft": {
|
|
4781
4765
|
zh: `当然可以帮你撰写技术方案!请先描述以下信息:
|
|
4782
4766
|
|
|
@@ -4869,7 +4853,7 @@ function Xe(e, t) {
|
|
|
4869
4853
|
function Vs(e, t, n) {
|
|
4870
4854
|
const r = n === "zh", a = [];
|
|
4871
4855
|
let s;
|
|
4872
|
-
if (e.includes("技术方案") || e.includes("draft") ? s =
|
|
4856
|
+
if (e.includes("技术方案") || e.includes("draft") ? s = We["help-draft"][r ? "zh" : "en"] : e.includes("审查") || e.includes("review") || e.includes("Review") ? s = We.review[r ? "zh" : "en"] : e.includes("权利要求") || e.includes("claims") || e.includes("Optimize") ? s = We.claims[r ? "zh" : "en"] : s = We.default[r ? "zh" : "en"], t.length > 0) {
|
|
4873
4857
|
const i = r ? `正在分析引用的 ${t.length} 段文本并生成优化建议...
|
|
4874
4858
|
|
|
4875
4859
|
` : `Analyzing ${t.length} referenced text(s) and generating suggestions...
|
|
@@ -5062,7 +5046,7 @@ function bo(e) {
|
|
|
5062
5046
|
content: n.text ? [{ type: "text", text: n.text }] : void 0
|
|
5063
5047
|
}));
|
|
5064
5048
|
}
|
|
5065
|
-
const Ys = -1, Qs = 1, Zs = 0, En = new
|
|
5049
|
+
const Ys = -1, Qs = 1, Zs = 0, En = new Ae("docDiff");
|
|
5066
5050
|
let mt = null;
|
|
5067
5051
|
function ei() {
|
|
5068
5052
|
return mt || (mt = new Jt()), mt;
|
|
@@ -5079,7 +5063,7 @@ function ti(e, t, n) {
|
|
|
5079
5063
|
}
|
|
5080
5064
|
function vo(e, t) {
|
|
5081
5065
|
const n = e.state.doc, r = n.content.size, { text: a, segments: s } = ln(e, 0, r), i = ei(), l = i.diff_main(t, a);
|
|
5082
|
-
i.
|
|
5066
|
+
i.diff_cleanupEfficiency(l);
|
|
5083
5067
|
const c = [];
|
|
5084
5068
|
let d = 0;
|
|
5085
5069
|
for (const [m, p] of l)
|
|
@@ -5090,33 +5074,33 @@ function vo(e, t) {
|
|
|
5090
5074
|
for (; g < p.length; ) {
|
|
5091
5075
|
for (; g < p.length && p[g] === "\0"; ) g++;
|
|
5092
5076
|
if (g >= p.length) break;
|
|
5093
|
-
const
|
|
5077
|
+
const h = g;
|
|
5094
5078
|
for (; g < p.length && p[g] !== "\0"; ) g++;
|
|
5095
|
-
const
|
|
5096
|
-
if (
|
|
5097
|
-
for (const
|
|
5079
|
+
const b = Ne(s, d + h), v = Ne(s, d + g);
|
|
5080
|
+
if (b >= 0 && v >= 0 && v > b)
|
|
5081
|
+
for (const w of ti(n, b, v))
|
|
5098
5082
|
c.push(
|
|
5099
|
-
le.inline(
|
|
5083
|
+
le.inline(w.from, w.to, { class: "patch-diff-insert-inline" })
|
|
5100
5084
|
);
|
|
5101
5085
|
}
|
|
5102
5086
|
d += p.length;
|
|
5103
5087
|
} else if (m === Ys) {
|
|
5104
|
-
const g =
|
|
5088
|
+
const g = Ne(s, d);
|
|
5105
5089
|
if (g >= 0) {
|
|
5106
|
-
const
|
|
5090
|
+
const h = p.replace(/\0/g, " ");
|
|
5107
5091
|
c.push(
|
|
5108
5092
|
le.widget(
|
|
5109
5093
|
g,
|
|
5110
5094
|
() => {
|
|
5111
|
-
const
|
|
5112
|
-
return
|
|
5095
|
+
const b = document.createElement("span");
|
|
5096
|
+
return b.className = "patch-diff-delete", b.textContent = h, b;
|
|
5113
5097
|
},
|
|
5114
5098
|
{ side: -1 }
|
|
5115
5099
|
)
|
|
5116
5100
|
);
|
|
5117
5101
|
}
|
|
5118
5102
|
}
|
|
5119
|
-
const o =
|
|
5103
|
+
const o = _e.create(n, c), u = new et({
|
|
5120
5104
|
key: En,
|
|
5121
5105
|
props: {
|
|
5122
5106
|
decorations() {
|
|
@@ -5206,7 +5190,7 @@ export {
|
|
|
5206
5190
|
pn as buildPatentDocument,
|
|
5207
5191
|
io as clearPatches,
|
|
5208
5192
|
Ws as createChatSessionAPI,
|
|
5209
|
-
|
|
5193
|
+
Le as createCommandExecutor,
|
|
5210
5194
|
fs as createEditorConfig,
|
|
5211
5195
|
ho as createMockAIService,
|
|
5212
5196
|
yo as createMockChatSessionAPI,
|
|
@@ -5226,7 +5210,7 @@ export {
|
|
|
5226
5210
|
no as resolvePatchTarget,
|
|
5227
5211
|
Cn as sectionContextDeps,
|
|
5228
5212
|
so as setPatches,
|
|
5229
|
-
|
|
5213
|
+
_ as useEditorStore,
|
|
5230
5214
|
wo as validatePatentDocument,
|
|
5231
5215
|
go as writeStream,
|
|
5232
5216
|
po as writeStreamFromSSE
|