@dotit/editor 1.1.0 → 1.2.0
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/DocsToolbar.d.ts +12 -2
- package/dist/Ruler.d.ts +16 -2
- package/dist/TrustControl.d.ts +13 -0
- package/dist/index.cjs +22 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1806 -1324
- package/dist/index.mjs.map +1 -1
- package/dist/line-keymap.d.ts +2 -0
- package/dist/page-geometry.d.ts +7 -0
- package/dist/print.d.ts +3 -0
- package/dist/style.css +257 -0
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useEditor as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
const ln = vt.create({
|
|
1
|
+
import { jsxs as g, jsx as s, Fragment as J } from "react/jsx-runtime";
|
|
2
|
+
import { useState as z, useRef as U, useCallback as M, useEffect as W, useMemo as Q, useLayoutEffect as Me } from "react";
|
|
3
|
+
import { useEditor as Ee, EditorContent as ze } from "@tiptap/react";
|
|
4
|
+
import He from "@tiptap/starter-kit";
|
|
5
|
+
import Re from "@tiptap/extension-underline";
|
|
6
|
+
import { TextStyle as Pe } from "@tiptap/extension-text-style";
|
|
7
|
+
import Be from "@tiptap/extension-color";
|
|
8
|
+
import Ie from "@tiptap/extension-highlight";
|
|
9
|
+
import De from "@tiptap/extension-text-align";
|
|
10
|
+
import Oe from "@tiptap/extension-font-family";
|
|
11
|
+
import Fe from "@tiptap/extension-subscript";
|
|
12
|
+
import je from "@tiptap/extension-superscript";
|
|
13
|
+
import { Extension as vt, Node as Y, mergeAttributes as F } from "@tiptap/core";
|
|
14
|
+
import { Plugin as ue, PluginKey as pe, TextSelection as Wt } from "@tiptap/pm/state";
|
|
15
|
+
import { DecorationSet as xt, Decoration as Ht } from "@tiptap/pm/view";
|
|
16
|
+
import { parseIntentText as rt, listBuiltinThemes as Ue, renderPrint as We, cssContentValue as Ge, isSealed as Ye, signDocument as Ke, sealDocument as qe, unsealDocument as Ve, verifyDocument as fe, LANGUAGE_REGISTRY as Je, getBuiltinTheme as Qe, generateThemeCSS as Xe, documentStyleCSS as Ze, upsertMetaProperty as tn } from "@dotit/core";
|
|
17
|
+
import en from "@tiptap/extension-paragraph";
|
|
18
|
+
import { ChevronDown as yt, ShieldCheck as Gt, LockOpen as nn, PenTool as Ct, FileLock2 as Yt, Undo2 as rn, Redo2 as on, Download as sn, Printer as an, Droplets as cn, Minus as ln, Plus as Kt, Bold as dn, Italic as un, Underline as pn, Strikethrough as fn, Palette as gn, RemoveFormatting as qt, Highlighter as hn, Code as mn, AlignLeft as bn, AlignCenter as yn, AlignRight as vn, AlignJustify as kn, Rows3 as Sn, List as wn, ListOrdered as Tn, AlignHorizontalSpaceBetween as Vt } from "lucide-react";
|
|
19
|
+
const xn = vt.create({
|
|
21
20
|
name: "fontSize",
|
|
22
21
|
addOptions() {
|
|
23
22
|
return { types: ["textStyle"] };
|
|
@@ -42,30 +41,30 @@ const ln = vt.create({
|
|
|
42
41
|
unsetFontSize: () => ({ chain: t }) => t().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
|
|
43
42
|
};
|
|
44
43
|
}
|
|
45
|
-
}),
|
|
44
|
+
}), nt = 96 / 25.4, Tt = {
|
|
46
45
|
A4: [210, 297],
|
|
47
46
|
A5: [148, 210],
|
|
48
47
|
A3: [297, 420],
|
|
49
48
|
Letter: [215.9, 279.4],
|
|
50
49
|
Legal: [215.9, 355.6],
|
|
51
50
|
Tabloid: [279.4, 431.8]
|
|
52
|
-
},
|
|
51
|
+
}, Nn = {
|
|
53
52
|
A4: "cm",
|
|
54
53
|
A5: "cm",
|
|
55
54
|
A3: "cm",
|
|
56
55
|
LETTER: "in",
|
|
57
56
|
LEGAL: "in",
|
|
58
57
|
TABLOID: "in"
|
|
59
|
-
},
|
|
60
|
-
function
|
|
58
|
+
}, Ln = 20, An = 4, Cn = 120;
|
|
59
|
+
function Rt(t) {
|
|
61
60
|
const e = /^(-?\d+(?:\.\d+)?)\s*(mm|cm|in|px|pt)?$/.exec(t.trim());
|
|
62
61
|
if (!e) return null;
|
|
63
62
|
const n = parseFloat(e[1]);
|
|
64
63
|
switch (e[2] || "mm") {
|
|
65
64
|
case "mm":
|
|
66
|
-
return n *
|
|
65
|
+
return n * nt;
|
|
67
66
|
case "cm":
|
|
68
|
-
return n * 10 *
|
|
67
|
+
return n * 10 * nt;
|
|
69
68
|
case "in":
|
|
70
69
|
return n * 96;
|
|
71
70
|
case "pt":
|
|
@@ -76,62 +75,77 @@ function $t(t) {
|
|
|
76
75
|
return null;
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
|
-
function
|
|
80
|
-
const n = t.trim().split(/\s+/).map(
|
|
78
|
+
function $n(t, e) {
|
|
79
|
+
const n = t.trim().split(/\s+/).map(Rt);
|
|
81
80
|
if (n.some((o) => o === null) || n.length === 0)
|
|
82
81
|
return [e, e, e, e];
|
|
83
82
|
const r = n;
|
|
84
83
|
return r.length === 1 ? [r[0], r[0], r[0], r[0]] : r.length === 2 ? [r[0], r[1], r[0], r[1]] : r.length === 3 ? [r[0], r[1], r[2], r[1]] : [r[0], r[1], r[2], r[3]];
|
|
85
84
|
}
|
|
86
|
-
function
|
|
85
|
+
function Pt(t) {
|
|
87
86
|
let e = "A4", n, r = "", o = "";
|
|
88
87
|
try {
|
|
89
|
-
const
|
|
90
|
-
|
|
88
|
+
const T = rt(t), v = T.blocks.find((H) => H.type === "page")?.properties || {};
|
|
89
|
+
v.size && (e = String(v.size)), n = v.margin ?? v.margins, r = T.blocks.find((H) => H.type === "header")?.content || String(v.header || ""), o = T.blocks.find((H) => H.type === "footer")?.content || String(v.footer || "");
|
|
91
90
|
} catch {
|
|
92
91
|
}
|
|
93
|
-
let
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
96
|
-
|
|
92
|
+
let c = Tt.A4[0] * nt, a = Tt.A4[1] * nt, d = !1, i = "cm";
|
|
93
|
+
const m = Tt[e] || Tt[e.toUpperCase?.()];
|
|
94
|
+
if (m)
|
|
95
|
+
c = m[0] * nt, a = m[1] * nt, i = Nn[e.toUpperCase()] || "cm";
|
|
97
96
|
else {
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
d = !0,
|
|
97
|
+
const T = e.trim().split(/\s+/), y = T[0] ? Rt(T[0]) : null;
|
|
98
|
+
if (y && (c = y), /(\d)\s*in\b/.test(e) && (i = "in"), T[1] === "auto")
|
|
99
|
+
d = !0, a = 1 / 0;
|
|
101
100
|
else {
|
|
102
|
-
const
|
|
103
|
-
|
|
101
|
+
const v = T[1] ? Rt(T[1]) : null;
|
|
102
|
+
v && (a = v);
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
|
-
const
|
|
105
|
+
const u = (c <= Cn * nt ? An : Ln) * nt, [h, f, b, S] = n ? $n(n, u) : [u, u, u, u];
|
|
107
106
|
return {
|
|
108
|
-
width:
|
|
109
|
-
height:
|
|
107
|
+
width: c,
|
|
108
|
+
height: a,
|
|
110
109
|
autoHeight: d,
|
|
111
110
|
marginTop: h,
|
|
112
|
-
marginRight:
|
|
113
|
-
marginBottom:
|
|
114
|
-
marginLeft:
|
|
115
|
-
contentHeight: d ? 1 / 0 :
|
|
111
|
+
marginRight: f,
|
|
112
|
+
marginBottom: b,
|
|
113
|
+
marginLeft: S,
|
|
114
|
+
contentHeight: d ? 1 / 0 : a - h - b,
|
|
116
115
|
header: r,
|
|
117
116
|
footer: o,
|
|
118
|
-
unit:
|
|
117
|
+
unit: i
|
|
119
118
|
};
|
|
120
119
|
}
|
|
121
|
-
function
|
|
120
|
+
function _n(t, e) {
|
|
121
|
+
const n = t.split(`
|
|
122
|
+
`), r = n.findIndex((a) => /^\s*page\s*:/i.test(a));
|
|
123
|
+
if (r >= 0) {
|
|
124
|
+
let a = n[r].replace(/\s*\|\s*margins?\s*:[^|]*/gi, "").replace(/\s+$/, "");
|
|
125
|
+
return a = `${a} | margin: ${e}`, n[r] = a, n.join(`
|
|
126
|
+
`);
|
|
127
|
+
}
|
|
128
|
+
const o = n.findIndex(
|
|
129
|
+
(a) => a.trim() && !/^\s*(meta|title|summary)\s*:/i.test(a)
|
|
130
|
+
), c = `page: A4 | margin: ${e}`;
|
|
131
|
+
return o <= 0 ? `${c}
|
|
132
|
+
${t}` : (n.splice(o, 0, c), n.join(`
|
|
133
|
+
`));
|
|
134
|
+
}
|
|
135
|
+
function ge(t, e, n) {
|
|
122
136
|
return t.replace(/\{\{\s*page\s*\}\}/g, String(e)).replace(/\{\{\s*pages\s*\}\}/g, String(n));
|
|
123
137
|
}
|
|
124
|
-
const
|
|
125
|
-
function
|
|
126
|
-
const o =
|
|
138
|
+
const mt = new pe("pagination");
|
|
139
|
+
function $t(t, e, n, r) {
|
|
140
|
+
const o = ge(e, n, r);
|
|
127
141
|
return `<div class="docs-pb-${t}">
|
|
128
|
-
<span class="docs-pb-text">${
|
|
142
|
+
<span class="docs-pb-text">${Mn(o)}</span>
|
|
129
143
|
</div>`;
|
|
130
144
|
}
|
|
131
|
-
function
|
|
145
|
+
function Mn(t) {
|
|
132
146
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
133
147
|
}
|
|
134
|
-
const
|
|
148
|
+
const En = vt.create({
|
|
135
149
|
name: "pagination",
|
|
136
150
|
addOptions() {
|
|
137
151
|
return {
|
|
@@ -154,95 +168,95 @@ const mn = vt.create({
|
|
|
154
168
|
addProseMirrorPlugins() {
|
|
155
169
|
const t = this.options;
|
|
156
170
|
return [
|
|
157
|
-
new
|
|
158
|
-
key:
|
|
171
|
+
new ue({
|
|
172
|
+
key: mt,
|
|
159
173
|
state: {
|
|
160
|
-
init: () =>
|
|
174
|
+
init: () => xt.empty,
|
|
161
175
|
apply(e, n) {
|
|
162
|
-
const r = e.getMeta(
|
|
176
|
+
const r = e.getMeta(mt);
|
|
163
177
|
return r || n.map(e.mapping, e.doc);
|
|
164
178
|
}
|
|
165
179
|
},
|
|
166
180
|
props: {
|
|
167
181
|
decorations(e) {
|
|
168
|
-
return
|
|
182
|
+
return mt.getState(e);
|
|
169
183
|
}
|
|
170
184
|
},
|
|
171
185
|
view(e) {
|
|
172
186
|
let n = 0, r = "";
|
|
173
|
-
const o = (
|
|
174
|
-
const
|
|
175
|
-
return
|
|
176
|
-
<div class="docs-pb-fill" style="height:${
|
|
177
|
-
<div class="docs-pb-margin docs-pb-margin-bottom" style="height:${
|
|
178
|
-
${
|
|
187
|
+
const o = (i, m, u, h) => {
|
|
188
|
+
const f = document.createElement("div");
|
|
189
|
+
return f.className = "docs-page-spacer", f.contentEditable = "false", f.setAttribute("data-it-spacer", ""), f.style.setProperty("--pb-mx-l", `${i.marginLeft}px`), f.style.setProperty("--pb-mx-r", `${i.marginRight}px`), f.innerHTML = `
|
|
190
|
+
<div class="docs-pb-fill" style="height:${m}px"></div>
|
|
191
|
+
<div class="docs-pb-margin docs-pb-margin-bottom" style="height:${i.marginBottom}px">
|
|
192
|
+
${$t("footer", i.footer, u, h)}
|
|
179
193
|
</div>
|
|
180
194
|
<div class="docs-pb-gap" style="height:${t.gap}px"></div>
|
|
181
|
-
<div class="docs-pb-margin docs-pb-margin-top" style="height:${
|
|
182
|
-
${
|
|
183
|
-
</div>`,
|
|
184
|
-
},
|
|
185
|
-
const
|
|
186
|
-
return
|
|
187
|
-
<div class="docs-pb-fill" style="height:${
|
|
188
|
-
<div class="docs-pb-margin docs-pb-margin-bottom" style="height:${
|
|
189
|
-
${
|
|
190
|
-
</div>`,
|
|
191
|
-
},
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
195
|
+
<div class="docs-pb-margin docs-pb-margin-top" style="height:${i.marginTop}px">
|
|
196
|
+
${$t("header", i.header, u + 1, h)}
|
|
197
|
+
</div>`, f;
|
|
198
|
+
}, c = (i, m, u, h) => {
|
|
199
|
+
const f = document.createElement("div");
|
|
200
|
+
return f.className = "docs-page-spacer docs-page-tail", f.contentEditable = "false", f.setAttribute("data-it-spacer", ""), f.style.setProperty("--pb-mx-l", `${i.marginLeft}px`), f.style.setProperty("--pb-mx-r", `${i.marginRight}px`), f.innerHTML = `
|
|
201
|
+
<div class="docs-pb-fill" style="height:${m}px"></div>
|
|
202
|
+
<div class="docs-pb-margin docs-pb-margin-bottom" style="height:${i.marginBottom}px">
|
|
203
|
+
${$t("footer", i.footer, u, h)}
|
|
204
|
+
</div>`, f;
|
|
205
|
+
}, a = () => {
|
|
206
|
+
const i = t.geometry(), m = e.dom, u = e.state.doc;
|
|
207
|
+
if (i.autoHeight) {
|
|
194
208
|
r !== "auto" && (r = "auto", e.dispatch(
|
|
195
|
-
e.state.tr.setMeta(
|
|
209
|
+
e.state.tr.setMeta(mt, xt.empty)
|
|
196
210
|
), t.onPages?.(1));
|
|
197
211
|
return;
|
|
198
212
|
}
|
|
199
|
-
const h =
|
|
200
|
-
let
|
|
201
|
-
for (const
|
|
202
|
-
if (
|
|
203
|
-
|
|
213
|
+
const h = m.getBoundingClientRect().top, f = Array.from(m.children), b = [];
|
|
214
|
+
let S = 0;
|
|
215
|
+
for (const C of f) {
|
|
216
|
+
if (C.hasAttribute?.("data-it-spacer")) {
|
|
217
|
+
S += C.offsetHeight;
|
|
204
218
|
continue;
|
|
205
219
|
}
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
natTop:
|
|
209
|
-
natBottom:
|
|
220
|
+
const R = C.getBoundingClientRect();
|
|
221
|
+
b.push({
|
|
222
|
+
natTop: R.top - h - S,
|
|
223
|
+
natBottom: R.bottom - h - S
|
|
210
224
|
});
|
|
211
225
|
}
|
|
212
|
-
const
|
|
213
|
-
let
|
|
214
|
-
for (let
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
pos:
|
|
219
|
-
rest: Math.max(0,
|
|
220
|
-
}),
|
|
226
|
+
const T = [];
|
|
227
|
+
let y = 0, v = b.length ? b[0].natTop : 0, H = v;
|
|
228
|
+
for (let C = 0; C < b.length && C < u.childCount; C++) {
|
|
229
|
+
const R = b[C], V = u.child(C).nodeSize;
|
|
230
|
+
R.natTop > v && // never break before the page's first block
|
|
231
|
+
R.natBottom - v > i.contentHeight && (T.push({
|
|
232
|
+
pos: y,
|
|
233
|
+
rest: Math.max(0, i.contentHeight - (R.natTop - v))
|
|
234
|
+
}), v = R.natTop), H = R.natBottom, y += V;
|
|
221
235
|
}
|
|
222
|
-
const
|
|
236
|
+
const B = T.length + 1, j = Math.max(
|
|
223
237
|
0,
|
|
224
|
-
|
|
225
|
-
),
|
|
226
|
-
if (
|
|
227
|
-
r =
|
|
228
|
-
const
|
|
229
|
-
(
|
|
230
|
-
|
|
231
|
-
() => o(
|
|
232
|
-
{ side: -1, key: `pb-${
|
|
238
|
+
i.contentHeight - (H - v)
|
|
239
|
+
), P = T.map((C) => `${C.pos}:${Math.round(C.rest)}`).join(",") + `|${Math.round(j)}|${B}|${i.header}|${i.footer}|${Math.round(i.contentHeight)}`;
|
|
240
|
+
if (P === r) return;
|
|
241
|
+
r = P;
|
|
242
|
+
const I = T.map(
|
|
243
|
+
(C, R) => Ht.widget(
|
|
244
|
+
C.pos,
|
|
245
|
+
() => o(i, C.rest, R + 1, B),
|
|
246
|
+
{ side: -1, key: `pb-${R + 1}-${Math.round(C.rest)}` }
|
|
233
247
|
)
|
|
234
248
|
);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
() =>
|
|
239
|
-
{ side: 1, key: `pb-tail-${
|
|
249
|
+
I.push(
|
|
250
|
+
Ht.widget(
|
|
251
|
+
u.content.size,
|
|
252
|
+
() => c(i, j, B, B),
|
|
253
|
+
{ side: 1, key: `pb-tail-${B}-${Math.round(j)}` }
|
|
240
254
|
)
|
|
241
255
|
);
|
|
242
|
-
const
|
|
243
|
-
e.dispatch(e.state.tr.setMeta(
|
|
256
|
+
const X = xt.create(e.state.doc, I);
|
|
257
|
+
e.dispatch(e.state.tr.setMeta(mt, X)), t.onPages?.(B);
|
|
244
258
|
}, d = () => {
|
|
245
|
-
cancelAnimationFrame(n), n = requestAnimationFrame(
|
|
259
|
+
cancelAnimationFrame(n), n = requestAnimationFrame(a);
|
|
246
260
|
};
|
|
247
261
|
return d(), {
|
|
248
262
|
update: d,
|
|
@@ -252,28 +266,28 @@ const mn = vt.create({
|
|
|
252
266
|
})
|
|
253
267
|
];
|
|
254
268
|
}
|
|
255
|
-
}),
|
|
269
|
+
}), Jt = /* @__PURE__ */ new Set(["tip", "info", "warning", "danger", "success"]), zn = /* @__PURE__ */ new Set([
|
|
256
270
|
"page",
|
|
257
271
|
"meta",
|
|
258
272
|
"font",
|
|
259
273
|
"header",
|
|
260
274
|
"footer",
|
|
261
275
|
"watermark"
|
|
262
|
-
]),
|
|
276
|
+
]), Hn = /* @__PURE__ */ new Set([
|
|
263
277
|
"sign",
|
|
264
278
|
"seal",
|
|
265
279
|
"approve",
|
|
266
280
|
"freeze",
|
|
267
281
|
"amend",
|
|
268
282
|
"amendment"
|
|
269
|
-
]),
|
|
283
|
+
]), Qt = {
|
|
270
284
|
title: "itTitle",
|
|
271
285
|
section: "itSection",
|
|
272
286
|
sub: "itSub"
|
|
273
|
-
},
|
|
287
|
+
}, Rn = {
|
|
274
288
|
note: "text",
|
|
275
289
|
"body-text": "text"
|
|
276
|
-
},
|
|
290
|
+
}, Pn = /* @__PURE__ */ new Set([
|
|
277
291
|
"weight",
|
|
278
292
|
"italic",
|
|
279
293
|
"underline",
|
|
@@ -289,7 +303,7 @@ const mn = vt.create({
|
|
|
289
303
|
"font",
|
|
290
304
|
"bgcolor"
|
|
291
305
|
]);
|
|
292
|
-
function
|
|
306
|
+
function Bn(t) {
|
|
293
307
|
if (!t || t === "{}") return {};
|
|
294
308
|
try {
|
|
295
309
|
return typeof t == "string" ? JSON.parse(t) : t || {};
|
|
@@ -297,20 +311,20 @@ function wn(t) {
|
|
|
297
311
|
return {};
|
|
298
312
|
}
|
|
299
313
|
}
|
|
300
|
-
function
|
|
314
|
+
function q(t, e) {
|
|
301
315
|
const n = Object.entries(t).filter(
|
|
302
316
|
([r, o]) => o !== void 0 && o !== "" && (!e || !e.has(r))
|
|
303
317
|
);
|
|
304
318
|
return n.length === 0 ? "" : " | " + n.map(([r, o]) => `${r}: ${o}`).join(" | ");
|
|
305
319
|
}
|
|
306
|
-
function
|
|
320
|
+
function Bt(t) {
|
|
307
321
|
if (!t) return [];
|
|
308
322
|
const e = t.split("\\n"), n = [];
|
|
309
323
|
return e.forEach((r, o) => {
|
|
310
324
|
r && n.push({ type: "text", text: r }), o < e.length - 1 && n.push({ type: "hardBreak" });
|
|
311
325
|
}), n;
|
|
312
326
|
}
|
|
313
|
-
function
|
|
327
|
+
function In(t) {
|
|
314
328
|
switch (t.type) {
|
|
315
329
|
case "bold":
|
|
316
330
|
return [{ type: "bold" }];
|
|
@@ -330,7 +344,7 @@ function vn(t) {
|
|
|
330
344
|
return null;
|
|
331
345
|
}
|
|
332
346
|
}
|
|
333
|
-
const
|
|
347
|
+
const Dn = /* @__PURE__ */ new Set([
|
|
334
348
|
"text",
|
|
335
349
|
"bold",
|
|
336
350
|
"italic",
|
|
@@ -338,26 +352,26 @@ const Tn = /* @__PURE__ */ new Set([
|
|
|
338
352
|
"highlight",
|
|
339
353
|
"styled"
|
|
340
354
|
]);
|
|
341
|
-
function
|
|
342
|
-
if (!t || t.length === 0 || t.every((r) => r.type === "text") || !t.every((r) =>
|
|
343
|
-
return
|
|
355
|
+
function On(t, e) {
|
|
356
|
+
if (!t || t.length === 0 || t.every((r) => r.type === "text") || !t.every((r) => Dn.has(r.type)))
|
|
357
|
+
return Bt(e);
|
|
344
358
|
const n = [];
|
|
345
359
|
for (const r of t) {
|
|
346
|
-
const o =
|
|
347
|
-
|
|
348
|
-
d && n.push(o ? { type: "text", text: d, marks: o } : { type: "text", text: d }),
|
|
360
|
+
const o = In(r), a = (r.value ?? "").split("\\n");
|
|
361
|
+
a.forEach((d, i) => {
|
|
362
|
+
d && n.push(o ? { type: "text", text: d, marks: o } : { type: "text", text: d }), i < a.length - 1 && n.push({ type: "hardBreak" });
|
|
349
363
|
});
|
|
350
364
|
}
|
|
351
|
-
return n.length ? n :
|
|
365
|
+
return n.length ? n : Bt(e);
|
|
352
366
|
}
|
|
353
|
-
function
|
|
367
|
+
function Fn(t, e) {
|
|
354
368
|
if (!e || t.length === 0) return t;
|
|
355
|
-
const n = [], r = {}, o = e,
|
|
356
|
-
return String(o.weight || "").toLowerCase() === "bold" && n.push({ type: "bold" }), (String(o.italic || "") === "true" || String(o.style || "").toLowerCase() === "italic") && n.push({ type: "italic" }), String(o.underline || "") === "true" && n.push({ type: "underline" }), String(o.strike || "") === "true" && n.push({ type: "strike" }), String(o.valign || "") === "sub" && n.push({ type: "subscript" }), String(o.valign || "") === "super" && n.push({ type: "superscript" }), o.color && (r.color = String(o.color)),
|
|
369
|
+
const n = [], r = {}, o = e, c = o.family ?? o.font, a = o.bg ?? o.bgcolor;
|
|
370
|
+
return String(o.weight || "").toLowerCase() === "bold" && n.push({ type: "bold" }), (String(o.italic || "") === "true" || String(o.style || "").toLowerCase() === "italic") && n.push({ type: "italic" }), String(o.underline || "") === "true" && n.push({ type: "underline" }), String(o.strike || "") === "true" && n.push({ type: "strike" }), String(o.valign || "") === "sub" && n.push({ type: "subscript" }), String(o.valign || "") === "super" && n.push({ type: "superscript" }), o.color && (r.color = String(o.color)), c && (r.fontFamily = String(c)), o.size && (r.fontSize = String(o.size)), a && n.push({ type: "highlight", attrs: { color: String(a) } }), Object.keys(r).length > 0 && n.push({ type: "textStyle", attrs: r }), n.length === 0 ? t : t.map(
|
|
357
371
|
(d) => d.type === "text" ? { ...d, marks: [...d.marks || [], ...n] } : d
|
|
358
372
|
);
|
|
359
373
|
}
|
|
360
|
-
function
|
|
374
|
+
function he(t) {
|
|
361
375
|
const e = {};
|
|
362
376
|
for (const n of t || [])
|
|
363
377
|
switch (n.type) {
|
|
@@ -388,30 +402,30 @@ function ne(t) {
|
|
|
388
402
|
}
|
|
389
403
|
return e;
|
|
390
404
|
}
|
|
391
|
-
function
|
|
405
|
+
function jn(t) {
|
|
392
406
|
if (t.type === "hardBreak") return "\\n";
|
|
393
|
-
if (t.type !== "text") return
|
|
407
|
+
if (t.type !== "text") return Dt(t);
|
|
394
408
|
const e = t.text || "";
|
|
395
409
|
if (!e) return "";
|
|
396
410
|
const n = t.marks || [];
|
|
397
411
|
if (!n.length) return e;
|
|
398
412
|
const r = new Set(n.map((h) => h.type)), o = n.find((h) => h.type === "link");
|
|
399
413
|
if (o?.attrs?.href) return `[${e}](${o.attrs.href})`;
|
|
400
|
-
const
|
|
414
|
+
const c = n.find((h) => h.type === "textStyle")?.attrs || {}, a = n.find((h) => h.type === "highlight")?.attrs || {}, d = !!(c.color || c.fontFamily || c.fontSize || a.color), i = ["bold", "italic", "strike", "underline", "code"].filter(
|
|
401
415
|
(h) => r.has(h)
|
|
402
416
|
).length;
|
|
403
|
-
if (!d &&
|
|
417
|
+
if (!d && i === 1 && !r.has("underline")) {
|
|
404
418
|
if (r.has("bold")) return `*${e}*`;
|
|
405
419
|
if (r.has("italic")) return `_${e}_`;
|
|
406
420
|
if (r.has("strike")) return `~${e}~`;
|
|
407
421
|
if (r.has("code")) return `\`${e}\``;
|
|
408
422
|
}
|
|
409
|
-
if (!d &&
|
|
423
|
+
if (!d && i === 0 && r.has("highlight") && !a.color)
|
|
410
424
|
return `^${e}^`;
|
|
411
|
-
const
|
|
412
|
-
return
|
|
425
|
+
const m = he(n), u = [];
|
|
426
|
+
return m.color && u.push(`color: ${m.color}`), m.family && u.push(`family: ${m.family}`), m.size && u.push(`size: ${m.size}`), m.weight && u.push(`weight: ${m.weight}`), m.italic === "true" && u.push("italic: true"), m.underline && u.push("underline: true"), m.strike && u.push("strike: true"), m.bg && u.push(`bg: ${m.bg}`), m.valign && u.push(`valign: ${m.valign}`), u.length ? `[${e}]{ ${u.join("; ")} }` : e;
|
|
413
427
|
}
|
|
414
|
-
const
|
|
428
|
+
const Un = /* @__PURE__ */ new Set([
|
|
415
429
|
"bold",
|
|
416
430
|
"italic",
|
|
417
431
|
"underline",
|
|
@@ -423,237 +437,237 @@ const Cn = /* @__PURE__ */ new Set([
|
|
|
423
437
|
"subscript",
|
|
424
438
|
"superscript"
|
|
425
439
|
]);
|
|
426
|
-
function
|
|
440
|
+
function Wn(t) {
|
|
427
441
|
const e = /* @__PURE__ */ new Set(), n = (r) => {
|
|
428
442
|
for (const o of r.marks || [])
|
|
429
|
-
|
|
443
|
+
Un.has(o.type) || e.add(o.type);
|
|
430
444
|
for (const o of r.content || []) n(o);
|
|
431
445
|
};
|
|
432
446
|
return n(t), [...e].sort();
|
|
433
447
|
}
|
|
434
|
-
function
|
|
448
|
+
function It(t) {
|
|
435
449
|
const e = t.content || [], n = t.attrs?.textAlign && t.attrs.textAlign !== "left" ? { align: String(t.attrs.textAlign) } : {};
|
|
436
450
|
return e.length === 1 && e[0].type === "text" ? {
|
|
437
451
|
text: e[0].text || "",
|
|
438
|
-
props: { ...
|
|
439
|
-
} : { text: e.map(
|
|
452
|
+
props: { ...he(e[0].marks), ...n }
|
|
453
|
+
} : { text: e.map(jn).join(""), props: { ...n } };
|
|
440
454
|
}
|
|
441
|
-
function
|
|
442
|
-
return t.content ? t.content.map((e) => e.type === "text" ? e.text || "" : e.type === "hardBreak" ? "\\n" :
|
|
455
|
+
function Dt(t) {
|
|
456
|
+
return t.content ? t.content.map((e) => e.type === "text" ? e.text || "" : e.type === "hardBreak" ? "\\n" : Dt(e)).join("") : "";
|
|
443
457
|
}
|
|
444
|
-
function
|
|
445
|
-
const r =
|
|
446
|
-
for (const o of
|
|
458
|
+
function pt(t, e, n) {
|
|
459
|
+
const r = Bn(t);
|
|
460
|
+
for (const o of Pn) delete r[o];
|
|
447
461
|
if (n) for (const o of n) delete r[o];
|
|
448
462
|
return { ...r, ...e };
|
|
449
463
|
}
|
|
450
|
-
function
|
|
464
|
+
function Ot(t) {
|
|
451
465
|
const e = t.toLowerCase();
|
|
452
|
-
return
|
|
466
|
+
return Rn[e] || e;
|
|
453
467
|
}
|
|
454
|
-
function
|
|
468
|
+
function Xt(t) {
|
|
455
469
|
if (t === "---") return "divider";
|
|
456
470
|
const e = t.match(/^([a-zA-Z][\w-]*):/);
|
|
457
|
-
return e ?
|
|
471
|
+
return e ? Ot(e[1]) : null;
|
|
458
472
|
}
|
|
459
|
-
function
|
|
460
|
-
return
|
|
473
|
+
function ft(t) {
|
|
474
|
+
return Ot(t);
|
|
461
475
|
}
|
|
462
|
-
function
|
|
476
|
+
function gt(t, e) {
|
|
463
477
|
return !!(t === e || t === "info" && ["tip", "warning", "danger", "success"].includes(e) || e === "info" && ["tip", "warning", "danger", "success"].includes(t));
|
|
464
478
|
}
|
|
465
|
-
function
|
|
479
|
+
function Gn(t) {
|
|
466
480
|
if (!t) return { content: "", properties: {} };
|
|
467
481
|
const e = t.split(" | ");
|
|
468
482
|
let n = e[0] || "";
|
|
469
483
|
const r = {};
|
|
470
484
|
for (let o = 1; o < e.length; o++) {
|
|
471
|
-
const
|
|
472
|
-
if (!
|
|
473
|
-
n += ` | ${
|
|
485
|
+
const c = e[o], a = c.match(/^([a-zA-Z_][\w-]*)\s*:\s*(.*)$/);
|
|
486
|
+
if (!a) {
|
|
487
|
+
n += ` | ${c}`;
|
|
474
488
|
continue;
|
|
475
489
|
}
|
|
476
|
-
r[
|
|
490
|
+
r[a[1]] = a[2];
|
|
477
491
|
}
|
|
478
492
|
return { content: n, properties: r };
|
|
479
493
|
}
|
|
480
|
-
function
|
|
494
|
+
function Zt(t) {
|
|
481
495
|
if (t === "---") return { type: "divider" };
|
|
482
496
|
const e = t.match(/^([a-zA-Z][\w-]*):\s*(.*)$/);
|
|
483
497
|
if (!e) return null;
|
|
484
|
-
const n =
|
|
485
|
-
let
|
|
498
|
+
const n = Ot(e[1]), r = e[2] || "", { content: o, properties: c } = Gn(r);
|
|
499
|
+
let a;
|
|
486
500
|
try {
|
|
487
|
-
|
|
501
|
+
a = rt(`text: ${o}`).blocks[0]?.inline;
|
|
488
502
|
} catch {
|
|
489
|
-
|
|
503
|
+
a = void 0;
|
|
490
504
|
}
|
|
491
|
-
return { type: n, content: o, properties:
|
|
505
|
+
return { type: n, content: o, properties: c, inline: a };
|
|
492
506
|
}
|
|
493
|
-
function
|
|
507
|
+
function te(t) {
|
|
494
508
|
const e = t.match(/^[-*]\s+(.*)$/);
|
|
495
509
|
if (e) return { ordered: !1, text: e[1] };
|
|
496
510
|
const n = t.match(/^\d+\.\s+(.*)$/);
|
|
497
511
|
return n ? { ordered: !0, text: n[1] } : null;
|
|
498
512
|
}
|
|
499
|
-
function
|
|
513
|
+
function Yn(t) {
|
|
500
514
|
return {
|
|
501
515
|
type: "listItem",
|
|
502
|
-
content: [{ type: "paragraph", content:
|
|
516
|
+
content: [{ type: "paragraph", content: Bt(t) }]
|
|
503
517
|
};
|
|
504
518
|
}
|
|
505
|
-
function
|
|
519
|
+
function ee(t) {
|
|
506
520
|
if (!t.trim())
|
|
507
521
|
return {
|
|
508
522
|
type: "doc",
|
|
509
523
|
content: [{ type: "paragraph" }]
|
|
510
524
|
};
|
|
511
|
-
const e =
|
|
512
|
-
for (const
|
|
513
|
-
const d =
|
|
525
|
+
const e = rt(t), n = [];
|
|
526
|
+
for (const a of e.blocks) {
|
|
527
|
+
const d = _t(a);
|
|
514
528
|
d && n.push(d);
|
|
515
529
|
}
|
|
516
530
|
const r = t.split(`
|
|
517
531
|
`);
|
|
518
532
|
let o = 0;
|
|
519
|
-
const
|
|
520
|
-
for (let
|
|
521
|
-
const
|
|
522
|
-
if (!
|
|
533
|
+
const c = [];
|
|
534
|
+
for (let a = 0; a < r.length; a++) {
|
|
535
|
+
const i = r[a].trim();
|
|
536
|
+
if (!i) continue;
|
|
523
537
|
{
|
|
524
|
-
const
|
|
525
|
-
if (
|
|
526
|
-
|
|
527
|
-
const
|
|
528
|
-
|
|
538
|
+
const f = Xt(i);
|
|
539
|
+
if (f && zn.has(f)) {
|
|
540
|
+
c.push({ type: "itMeta", attrs: { raw: i } });
|
|
541
|
+
const b = e.blocks[o]?.type;
|
|
542
|
+
b && gt(f, ft(b)) && o++;
|
|
529
543
|
continue;
|
|
530
544
|
}
|
|
531
|
-
if (
|
|
532
|
-
|
|
533
|
-
const
|
|
534
|
-
|
|
545
|
+
if (f && Hn.has(f)) {
|
|
546
|
+
c.push({ type: "itTrust", attrs: { raw: i, keyword: f } });
|
|
547
|
+
const b = e.blocks[o]?.type;
|
|
548
|
+
b && gt(f, ft(b)) && o++;
|
|
535
549
|
continue;
|
|
536
550
|
}
|
|
537
|
-
if (
|
|
538
|
-
|
|
539
|
-
const
|
|
540
|
-
|
|
551
|
+
if (f === "metric") {
|
|
552
|
+
c.push({ type: "itMetric", attrs: { raw: i } });
|
|
553
|
+
const b = e.blocks[o]?.type;
|
|
554
|
+
b && gt(f, ft(b)) && o++;
|
|
541
555
|
continue;
|
|
542
556
|
}
|
|
543
|
-
if (
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
|
|
557
|
+
if (f === "style") {
|
|
558
|
+
c.push({ type: "itStyleRule", attrs: { raw: i } });
|
|
559
|
+
const b = e.blocks[o]?.type;
|
|
560
|
+
b && gt(f, ft(b)) && o++;
|
|
547
561
|
continue;
|
|
548
562
|
}
|
|
549
563
|
}
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
552
|
-
const
|
|
553
|
-
let
|
|
554
|
-
for (;
|
|
555
|
-
const
|
|
556
|
-
if (!
|
|
557
|
-
|
|
558
|
-
const
|
|
559
|
-
(
|
|
564
|
+
const m = te(i);
|
|
565
|
+
if (m) {
|
|
566
|
+
const f = m.ordered, b = [];
|
|
567
|
+
let S = a;
|
|
568
|
+
for (; S < r.length; ) {
|
|
569
|
+
const T = r[S].trim(), y = T ? te(T) : null;
|
|
570
|
+
if (!y || y.ordered !== f) break;
|
|
571
|
+
b.push(Yn(y.text));
|
|
572
|
+
const v = e.blocks[o]?.type;
|
|
573
|
+
(v === "list-item" || v === "step-item") && o++, S++;
|
|
560
574
|
}
|
|
561
|
-
|
|
562
|
-
type:
|
|
563
|
-
content:
|
|
564
|
-
}),
|
|
575
|
+
c.push({
|
|
576
|
+
type: f ? "orderedList" : "bulletList",
|
|
577
|
+
content: b
|
|
578
|
+
}), a = S - 1;
|
|
565
579
|
continue;
|
|
566
580
|
}
|
|
567
|
-
if (
|
|
568
|
-
const
|
|
569
|
-
let
|
|
570
|
-
for (;
|
|
571
|
-
const
|
|
572
|
-
if (!(
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
),
|
|
581
|
+
if (i.startsWith("|") && i.endsWith("|") && (i.match(/\|/g) || []).length >= 3) {
|
|
582
|
+
const f = [];
|
|
583
|
+
let b = a;
|
|
584
|
+
for (; b < r.length; ) {
|
|
585
|
+
const S = r[b].trim();
|
|
586
|
+
if (!(S.startsWith("|") && S.endsWith("|"))) break;
|
|
587
|
+
f.push(
|
|
588
|
+
S.slice(1, -1).split("|").map((T) => T.trim())
|
|
589
|
+
), b++;
|
|
576
590
|
}
|
|
577
|
-
|
|
591
|
+
c.push({ type: "itTable", attrs: { rows: JSON.stringify(f) } }), a = b - 1;
|
|
578
592
|
continue;
|
|
579
593
|
}
|
|
580
|
-
if (
|
|
581
|
-
|
|
594
|
+
if (i.startsWith("//")) {
|
|
595
|
+
c.push({
|
|
582
596
|
type: "itComment",
|
|
583
|
-
content:
|
|
597
|
+
content: i.slice(2).trim() ? [{ type: "text", text: i.slice(2).trim() }] : []
|
|
584
598
|
});
|
|
585
599
|
continue;
|
|
586
600
|
}
|
|
587
|
-
if (
|
|
588
|
-
const
|
|
589
|
-
if (
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
592
|
-
const
|
|
593
|
-
if (
|
|
594
|
-
const
|
|
595
|
-
|
|
601
|
+
if (i.startsWith("```")) continue;
|
|
602
|
+
const u = Xt(i);
|
|
603
|
+
if (u && (u === "text" || i.includes("{{"))) {
|
|
604
|
+
const f = Zt(i);
|
|
605
|
+
if (f) {
|
|
606
|
+
const b = _t(f);
|
|
607
|
+
if (b && c.push(b), o < e.blocks.length) {
|
|
608
|
+
const S = ft(e.blocks[o].type);
|
|
609
|
+
gt(u, S) && o++;
|
|
596
610
|
}
|
|
597
611
|
continue;
|
|
598
612
|
}
|
|
599
613
|
}
|
|
600
|
-
if (o < n.length &&
|
|
601
|
-
const
|
|
602
|
-
if (
|
|
603
|
-
|
|
614
|
+
if (o < n.length && u) {
|
|
615
|
+
const f = e.blocks[o], b = ft(f.type);
|
|
616
|
+
if (gt(u, b)) {
|
|
617
|
+
c.push(n[o]), o++;
|
|
604
618
|
continue;
|
|
605
619
|
}
|
|
606
620
|
}
|
|
607
|
-
const h =
|
|
621
|
+
const h = Zt(i);
|
|
608
622
|
if (h) {
|
|
609
|
-
const
|
|
610
|
-
|
|
623
|
+
const f = _t(h);
|
|
624
|
+
f && c.push(f);
|
|
611
625
|
continue;
|
|
612
626
|
}
|
|
613
|
-
o < n.length && (
|
|
627
|
+
o < n.length && (c.push(n[o]), o++);
|
|
614
628
|
}
|
|
615
629
|
for (; o < n.length; )
|
|
616
|
-
|
|
630
|
+
c.push(n[o]), o++;
|
|
617
631
|
return {
|
|
618
632
|
type: "doc",
|
|
619
|
-
content:
|
|
633
|
+
content: c.length > 0 ? c : [{ type: "paragraph" }]
|
|
620
634
|
};
|
|
621
635
|
}
|
|
622
|
-
function
|
|
623
|
-
const { type: e, content: n, properties: r, inline: o } = t,
|
|
624
|
-
let
|
|
625
|
-
|
|
636
|
+
function _t(t) {
|
|
637
|
+
const { type: e, content: n, properties: r, inline: o } = t, c = n || "";
|
|
638
|
+
let a = On(o, c);
|
|
639
|
+
a = Fn(a, r);
|
|
626
640
|
const d = r ? JSON.stringify(
|
|
627
641
|
Object.fromEntries(
|
|
628
|
-
Object.entries(r).map(([
|
|
642
|
+
Object.entries(r).map(([u, h]) => [u, String(h)])
|
|
629
643
|
)
|
|
630
|
-
) : "{}",
|
|
631
|
-
if (e in
|
|
644
|
+
) : "{}", i = r?.align ? String(r.align) : void 0;
|
|
645
|
+
if (e in Qt)
|
|
632
646
|
return {
|
|
633
|
-
type:
|
|
634
|
-
attrs: { props: d, ...
|
|
635
|
-
content:
|
|
647
|
+
type: Qt[e],
|
|
648
|
+
attrs: { props: d, ...i && { textAlign: i } },
|
|
649
|
+
content: a.length ? a : void 0
|
|
636
650
|
};
|
|
637
651
|
if (e === "summary")
|
|
638
652
|
return {
|
|
639
653
|
type: "itSummary",
|
|
640
|
-
attrs: { props: d, ...
|
|
641
|
-
content:
|
|
654
|
+
attrs: { props: d, ...i && { textAlign: i } },
|
|
655
|
+
content: a.length ? a : void 0
|
|
642
656
|
};
|
|
643
657
|
if (e === "text" || e === "body-text") {
|
|
644
|
-
const
|
|
645
|
-
return
|
|
658
|
+
const u = {};
|
|
659
|
+
return i && (u.textAlign = i), r?.end && (u.end = String(r.end)), r?.leading && (u.leading = String(r.leading)), r?.["space-before"] && (u.spaceBefore = String(r["space-before"])), r?.["space-after"] && (u.spaceAfter = String(r["space-after"])), {
|
|
646
660
|
type: "paragraph",
|
|
647
|
-
...Object.keys(
|
|
648
|
-
content:
|
|
661
|
+
...Object.keys(u).length && { attrs: u },
|
|
662
|
+
content: a.length ? a : void 0
|
|
649
663
|
};
|
|
650
664
|
}
|
|
651
|
-
if (
|
|
652
|
-
const
|
|
665
|
+
if (Jt.has(e)) {
|
|
666
|
+
const u = e === "info" ? String(r?.type || "info").toLowerCase() : e;
|
|
653
667
|
return {
|
|
654
668
|
type: "itCallout",
|
|
655
|
-
attrs: { variant:
|
|
656
|
-
content:
|
|
669
|
+
attrs: { variant: Jt.has(u) ? u : "info", props: d },
|
|
670
|
+
content: a.length ? a : void 0
|
|
657
671
|
};
|
|
658
672
|
}
|
|
659
673
|
if (e === "quote")
|
|
@@ -662,9 +676,9 @@ function Lt(t) {
|
|
|
662
676
|
attrs: {
|
|
663
677
|
by: r?.by ? String(r.by) : "",
|
|
664
678
|
props: d,
|
|
665
|
-
...
|
|
679
|
+
...i && { textAlign: i }
|
|
666
680
|
},
|
|
667
|
-
content:
|
|
681
|
+
content: a.length ? a : void 0
|
|
668
682
|
};
|
|
669
683
|
if (e === "code")
|
|
670
684
|
return {
|
|
@@ -673,81 +687,81 @@ function Lt(t) {
|
|
|
673
687
|
lang: r?.lang ? String(r.lang) : "",
|
|
674
688
|
props: d
|
|
675
689
|
},
|
|
676
|
-
content:
|
|
690
|
+
content: c ? [{ type: "text", text: c }] : void 0
|
|
677
691
|
};
|
|
678
692
|
if (e === "divider")
|
|
679
693
|
return { type: "itDivider" };
|
|
680
694
|
if (e === "break")
|
|
681
695
|
return { type: "itBreak" };
|
|
682
|
-
const
|
|
696
|
+
const m = r ? Object.entries(r).filter(([, u]) => u !== void 0 && u !== "").map(([u, h]) => `${u}: ${h}`).join(" | ") : "";
|
|
683
697
|
return {
|
|
684
698
|
type: "itGenericBlock",
|
|
685
|
-
attrs: { keyword: e, properties:
|
|
686
|
-
content:
|
|
699
|
+
attrs: { keyword: e, properties: m, props: d },
|
|
700
|
+
content: a.length ? a : void 0
|
|
687
701
|
};
|
|
688
702
|
}
|
|
689
|
-
function
|
|
703
|
+
function Kn(t) {
|
|
690
704
|
if (!t.content) return "";
|
|
691
705
|
const e = [];
|
|
692
706
|
for (const n of t.content)
|
|
693
|
-
e.push(...
|
|
707
|
+
e.push(...qn(n));
|
|
694
708
|
return e.join(`
|
|
695
709
|
`);
|
|
696
710
|
}
|
|
697
|
-
function
|
|
711
|
+
function qn(t) {
|
|
698
712
|
if (t.type === "bulletList" && t.content)
|
|
699
713
|
return t.content.flatMap((n) => n.content ? n.content.map((r) => {
|
|
700
|
-
const { text: o, props:
|
|
701
|
-
return `- ${o}${
|
|
714
|
+
const { text: o, props: c } = It(r);
|
|
715
|
+
return `- ${o}${q(c)}`;
|
|
702
716
|
}) : []);
|
|
703
717
|
if (t.type === "orderedList" && t.content) {
|
|
704
718
|
let n = 1;
|
|
705
719
|
return t.content.flatMap((r) => r.content ? r.content.map((o) => {
|
|
706
|
-
const { text:
|
|
707
|
-
return `${n++}. ${
|
|
720
|
+
const { text: c, props: a } = It(o);
|
|
721
|
+
return `${n++}. ${c}${q(a)}`;
|
|
708
722
|
}) : []);
|
|
709
723
|
}
|
|
710
|
-
const e =
|
|
724
|
+
const e = Vn(t);
|
|
711
725
|
return e !== null ? [e] : [];
|
|
712
726
|
}
|
|
713
|
-
function
|
|
714
|
-
const { text: e, props: n } =
|
|
727
|
+
function Vn(t) {
|
|
728
|
+
const { text: e, props: n } = It(t);
|
|
715
729
|
switch (t.type) {
|
|
716
730
|
case "itTitle": {
|
|
717
|
-
const r =
|
|
718
|
-
return `title: ${e}${
|
|
731
|
+
const r = pt(t.attrs?.props, n);
|
|
732
|
+
return `title: ${e}${q(r)}`;
|
|
719
733
|
}
|
|
720
734
|
case "itSummary": {
|
|
721
|
-
const r =
|
|
722
|
-
return `summary: ${e}${
|
|
735
|
+
const r = pt(t.attrs?.props, n);
|
|
736
|
+
return `summary: ${e}${q(r)}`;
|
|
723
737
|
}
|
|
724
738
|
case "itSection": {
|
|
725
|
-
const r =
|
|
726
|
-
return `section: ${e}${
|
|
739
|
+
const r = pt(t.attrs?.props, n);
|
|
740
|
+
return `section: ${e}${q(r)}`;
|
|
727
741
|
}
|
|
728
742
|
case "itSub": {
|
|
729
|
-
const r =
|
|
730
|
-
return `sub: ${e}${
|
|
743
|
+
const r = pt(t.attrs?.props, n);
|
|
744
|
+
return `sub: ${e}${q(r)}`;
|
|
731
745
|
}
|
|
732
746
|
case "paragraph": {
|
|
733
747
|
const r = t.attrs || {}, o = {};
|
|
734
|
-
return r.end && (o.end = String(r.end)), r.leading && (o.leading = String(r.leading)), r.spaceBefore && (o["space-before"] = String(r.spaceBefore)), r.spaceAfter && (o["space-after"] = String(r.spaceAfter)), `text: ${e}${
|
|
748
|
+
return r.end && (o.end = String(r.end)), r.leading && (o.leading = String(r.leading)), r.spaceBefore && (o["space-before"] = String(r.spaceBefore)), r.spaceAfter && (o["space-after"] = String(r.spaceAfter)), `text: ${e}${q({ ...o, ...n })}`;
|
|
735
749
|
}
|
|
736
750
|
case "itCallout": {
|
|
737
|
-
const r = t.attrs?.variant || "tip", o =
|
|
751
|
+
const r = t.attrs?.variant || "tip", o = pt(
|
|
738
752
|
t.attrs?.props,
|
|
739
753
|
n,
|
|
740
754
|
/* @__PURE__ */ new Set(["variant"])
|
|
741
755
|
);
|
|
742
|
-
return r === "info" ? `info: ${e}${
|
|
756
|
+
return r === "info" ? `info: ${e}${q(o)}` : `info: ${e} | type: ${r}${q(o, /* @__PURE__ */ new Set(["type"]))}`;
|
|
743
757
|
}
|
|
744
758
|
case "itQuote": {
|
|
745
|
-
const r = t.attrs?.by, o = r ? ` | by: ${r}` : "",
|
|
746
|
-
return `quote: ${e}${o}${
|
|
759
|
+
const r = t.attrs?.by, o = r ? ` | by: ${r}` : "", c = pt(t.attrs?.props, n, /* @__PURE__ */ new Set(["by"]));
|
|
760
|
+
return `quote: ${e}${o}${q(c)}`;
|
|
747
761
|
}
|
|
748
762
|
case "itCode":
|
|
749
763
|
return `\`\`\`${t.attrs?.lang || ""}
|
|
750
|
-
${
|
|
764
|
+
${Dt(t)}
|
|
751
765
|
\`\`\``;
|
|
752
766
|
case "itDivider":
|
|
753
767
|
return "divider:";
|
|
@@ -774,132 +788,132 @@ ${Ht(t)}
|
|
|
774
788
|
case "itComment":
|
|
775
789
|
return e ? `// ${e}` : "//";
|
|
776
790
|
case "itGenericBlock": {
|
|
777
|
-
const r = t.attrs?.keyword || "text", o =
|
|
778
|
-
return `${r}: ${e}${
|
|
791
|
+
const r = t.attrs?.keyword || "text", o = pt(t.attrs?.props, n);
|
|
792
|
+
return `${r}: ${e}${q(o)}`;
|
|
779
793
|
}
|
|
780
794
|
default:
|
|
781
|
-
return e ? `text: ${e}${
|
|
795
|
+
return e ? `text: ${e}${q(n)}` : null;
|
|
782
796
|
}
|
|
783
797
|
}
|
|
784
|
-
function
|
|
798
|
+
function l(t, e) {
|
|
785
799
|
return { property: t, css: e };
|
|
786
800
|
}
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
801
|
+
const Jn = [
|
|
802
|
+
l("align", "textAlign"),
|
|
803
|
+
l("color", "color"),
|
|
804
|
+
l("size", "fontSize"),
|
|
805
|
+
l("weight", "fontWeight"),
|
|
792
806
|
{ property: "style", css: "fontStyle" },
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
],
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
],
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
],
|
|
807
|
+
l("bgcolor", "backgroundColor"),
|
|
808
|
+
l("padding", "padding"),
|
|
809
|
+
l("indent", "paddingLeft"),
|
|
810
|
+
l("opacity", "opacity")
|
|
811
|
+
], bt = [
|
|
812
|
+
l("bgcolor", "backgroundColor"),
|
|
813
|
+
l("color", "color"),
|
|
814
|
+
l("border", "borderLeft")
|
|
815
|
+
], $ = [
|
|
816
|
+
l("color", "borderColor"),
|
|
817
|
+
l("bgcolor", "backgroundColor")
|
|
818
|
+
], Qn = {
|
|
805
819
|
// ── Identity ──
|
|
806
820
|
title: [
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
821
|
+
l("align", "textAlign"),
|
|
822
|
+
l("color", "color"),
|
|
823
|
+
l("size", "fontSize"),
|
|
824
|
+
l("weight", "fontWeight"),
|
|
825
|
+
l("font", "fontFamily")
|
|
812
826
|
],
|
|
813
827
|
summary: [
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
828
|
+
l("align", "textAlign"),
|
|
829
|
+
l("color", "color"),
|
|
830
|
+
l("size", "fontSize"),
|
|
817
831
|
{ property: "style", css: "fontStyle" }
|
|
818
832
|
],
|
|
819
833
|
// ── Structure ──
|
|
820
834
|
section: [
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
835
|
+
l("align", "textAlign"),
|
|
836
|
+
l("color", "color"),
|
|
837
|
+
l("size", "fontSize"),
|
|
838
|
+
l("weight", "fontWeight"),
|
|
839
|
+
l("border", "borderBottom"),
|
|
840
|
+
l("spacing", "marginTop")
|
|
827
841
|
],
|
|
828
842
|
sub: [
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
843
|
+
l("align", "textAlign"),
|
|
844
|
+
l("color", "color"),
|
|
845
|
+
l("size", "fontSize"),
|
|
846
|
+
l("weight", "fontWeight")
|
|
833
847
|
],
|
|
834
848
|
divider: [
|
|
835
849
|
{ property: "style", css: "borderStyle" },
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
850
|
+
l("color", "borderColor"),
|
|
851
|
+
l("width", "borderTopWidth"),
|
|
852
|
+
l("spacing", "margin")
|
|
839
853
|
],
|
|
840
854
|
// ── Content ──
|
|
841
|
-
text: [...
|
|
842
|
-
tip: [...
|
|
843
|
-
info: [...
|
|
844
|
-
warning: [...
|
|
845
|
-
danger: [...
|
|
846
|
-
success: [...
|
|
855
|
+
text: [...Jn],
|
|
856
|
+
tip: [...bt],
|
|
857
|
+
info: [...bt],
|
|
858
|
+
warning: [...bt],
|
|
859
|
+
danger: [...bt],
|
|
860
|
+
success: [...bt],
|
|
847
861
|
quote: [
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
862
|
+
l("align", "textAlign"),
|
|
863
|
+
l("color", "color"),
|
|
864
|
+
l("size", "fontSize"),
|
|
851
865
|
{ property: "style", css: "fontStyle" },
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
866
|
+
l("border", "borderLeft"),
|
|
867
|
+
l("padding", "paddingLeft"),
|
|
868
|
+
l("bgcolor", "backgroundColor")
|
|
855
869
|
],
|
|
856
870
|
cite: [
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
871
|
+
l("align", "textAlign"),
|
|
872
|
+
l("color", "color"),
|
|
873
|
+
l("size", "fontSize"),
|
|
860
874
|
{ property: "style", css: "fontStyle" }
|
|
861
875
|
],
|
|
862
876
|
def: [
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
877
|
+
l("color", "color"),
|
|
878
|
+
l("bgcolor", "backgroundColor"),
|
|
879
|
+
l("border", "borderLeft"),
|
|
880
|
+
l("padding", "paddingLeft")
|
|
867
881
|
],
|
|
868
882
|
caption: [
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
883
|
+
l("align", "textAlign"),
|
|
884
|
+
l("color", "color"),
|
|
885
|
+
l("size", "fontSize"),
|
|
872
886
|
{ property: "style", css: "fontStyle" }
|
|
873
887
|
],
|
|
874
|
-
footnote: [
|
|
888
|
+
footnote: [l("color", "color"), l("size", "fontSize")],
|
|
875
889
|
byline: [
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
890
|
+
l("align", "textAlign"),
|
|
891
|
+
l("color", "color"),
|
|
892
|
+
l("size", "fontSize"),
|
|
879
893
|
{ property: "style", css: "fontStyle" },
|
|
880
|
-
|
|
894
|
+
l("weight", "fontWeight")
|
|
881
895
|
],
|
|
882
896
|
epigraph: [
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
897
|
+
l("align", "textAlign"),
|
|
898
|
+
l("color", "color"),
|
|
899
|
+
l("size", "fontSize"),
|
|
886
900
|
{ property: "style", css: "fontStyle" },
|
|
887
|
-
|
|
901
|
+
l("padding", "padding")
|
|
888
902
|
],
|
|
889
903
|
dedication: [
|
|
890
|
-
|
|
891
|
-
|
|
904
|
+
l("align", "textAlign"),
|
|
905
|
+
l("color", "color"),
|
|
892
906
|
{ property: "style", css: "fontStyle" },
|
|
893
|
-
|
|
907
|
+
l("padding", "padding")
|
|
894
908
|
],
|
|
895
909
|
// ── Media ──
|
|
896
910
|
image: [
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
911
|
+
l("width", "width"),
|
|
912
|
+
l("height", "height"),
|
|
913
|
+
l("radius", "borderRadius"),
|
|
914
|
+
l("border", "border"),
|
|
915
|
+
l("opacity", "opacity"),
|
|
916
|
+
l("bgcolor", "backgroundColor"),
|
|
903
917
|
{
|
|
904
918
|
property: "shadow",
|
|
905
919
|
css: "boxShadow",
|
|
@@ -907,150 +921,150 @@ const Rn = [
|
|
|
907
921
|
}
|
|
908
922
|
],
|
|
909
923
|
figure: [
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
924
|
+
l("width", "width"),
|
|
925
|
+
l("align", "textAlign"),
|
|
926
|
+
l("border", "border"),
|
|
927
|
+
l("padding", "padding"),
|
|
928
|
+
l("bgcolor", "backgroundColor"),
|
|
915
929
|
{
|
|
916
930
|
property: "shadow",
|
|
917
931
|
css: "boxShadow",
|
|
918
932
|
transform: () => "0 4px 12px rgba(0,0,0,0.15)"
|
|
919
933
|
}
|
|
920
934
|
],
|
|
921
|
-
link: [
|
|
922
|
-
ref: [
|
|
935
|
+
link: [l("color", "color"), l("weight", "fontWeight")],
|
|
936
|
+
ref: [l("color", "color"), { property: "style", css: "fontStyle" }],
|
|
923
937
|
embed: [
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
938
|
+
l("width", "width"),
|
|
939
|
+
l("height", "height"),
|
|
940
|
+
l("border", "border"),
|
|
941
|
+
l("radius", "borderRadius")
|
|
928
942
|
],
|
|
929
943
|
// ── Data ──
|
|
930
944
|
metric: [
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
945
|
+
l("color", "color"),
|
|
946
|
+
l("size", "fontSize"),
|
|
947
|
+
l("align", "textAlign"),
|
|
948
|
+
l("bgcolor", "backgroundColor"),
|
|
949
|
+
l("border", "border"),
|
|
950
|
+
l("padding", "padding")
|
|
937
951
|
],
|
|
938
952
|
columns: [
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
953
|
+
l("border", "border"),
|
|
954
|
+
l("bgcolor", "backgroundColor"),
|
|
955
|
+
l("padding", "padding"),
|
|
956
|
+
l("size", "fontSize"),
|
|
957
|
+
l("align", "textAlign")
|
|
944
958
|
],
|
|
945
959
|
row: [
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
960
|
+
l("border", "border"),
|
|
961
|
+
l("bgcolor", "backgroundColor"),
|
|
962
|
+
l("padding", "padding"),
|
|
963
|
+
l("size", "fontSize"),
|
|
964
|
+
l("align", "textAlign")
|
|
951
965
|
],
|
|
952
966
|
input: [
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
967
|
+
l("color", "color"),
|
|
968
|
+
l("bgcolor", "backgroundColor"),
|
|
969
|
+
l("border", "borderLeft"),
|
|
970
|
+
l("size", "fontSize")
|
|
957
971
|
],
|
|
958
972
|
output: [
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
973
|
+
l("color", "color"),
|
|
974
|
+
l("bgcolor", "backgroundColor"),
|
|
975
|
+
l("border", "borderLeft"),
|
|
976
|
+
l("size", "fontSize")
|
|
963
977
|
],
|
|
964
978
|
// ── Code ──
|
|
965
979
|
code: [
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
980
|
+
l("size", "fontSize"),
|
|
981
|
+
l("bgcolor", "backgroundColor"),
|
|
982
|
+
l("color", "color"),
|
|
983
|
+
l("padding", "padding"),
|
|
984
|
+
l("radius", "borderRadius"),
|
|
985
|
+
l("border", "border")
|
|
972
986
|
],
|
|
973
987
|
// ── Contact ──
|
|
974
988
|
contact: [
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
989
|
+
l("color", "color"),
|
|
990
|
+
l("bgcolor", "backgroundColor"),
|
|
991
|
+
l("border", "border"),
|
|
992
|
+
l("padding", "padding"),
|
|
993
|
+
l("size", "fontSize")
|
|
980
994
|
],
|
|
981
995
|
deadline: [
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
996
|
+
l("color", "color"),
|
|
997
|
+
l("bgcolor", "backgroundColor"),
|
|
998
|
+
l("weight", "fontWeight"),
|
|
999
|
+
l("size", "fontSize")
|
|
986
1000
|
],
|
|
987
1001
|
// ── Agent workflow chips ──
|
|
988
|
-
step: [
|
|
989
|
-
decision: [
|
|
990
|
-
gate: [
|
|
991
|
-
trigger: [
|
|
992
|
-
loop: [
|
|
993
|
-
parallel: [
|
|
994
|
-
call: [
|
|
995
|
-
wait: [
|
|
996
|
-
checkpoint: [
|
|
997
|
-
error: [
|
|
998
|
-
result: [
|
|
999
|
-
audit: [
|
|
1000
|
-
signal: [
|
|
1001
|
-
handoff: [
|
|
1002
|
-
retry: [
|
|
1003
|
-
progress: [
|
|
1004
|
-
tool: [
|
|
1005
|
-
prompt: [
|
|
1006
|
-
memory: [
|
|
1007
|
-
policy: [
|
|
1008
|
-
context: [
|
|
1002
|
+
step: [...$],
|
|
1003
|
+
decision: [...$],
|
|
1004
|
+
gate: [...$],
|
|
1005
|
+
trigger: [...$],
|
|
1006
|
+
loop: [...$],
|
|
1007
|
+
parallel: [...$],
|
|
1008
|
+
call: [...$],
|
|
1009
|
+
wait: [...$],
|
|
1010
|
+
checkpoint: [...$],
|
|
1011
|
+
error: [...$],
|
|
1012
|
+
result: [...$],
|
|
1013
|
+
audit: [...$],
|
|
1014
|
+
signal: [...$],
|
|
1015
|
+
handoff: [...$],
|
|
1016
|
+
retry: [...$],
|
|
1017
|
+
progress: [...$],
|
|
1018
|
+
tool: [...$],
|
|
1019
|
+
prompt: [...$],
|
|
1020
|
+
memory: [...$],
|
|
1021
|
+
policy: [...$],
|
|
1022
|
+
context: [...$],
|
|
1009
1023
|
// ── Trust badges ──
|
|
1010
|
-
track: [
|
|
1011
|
-
approve: [
|
|
1012
|
-
sign: [
|
|
1013
|
-
freeze: [
|
|
1014
|
-
revision: [
|
|
1015
|
-
amendment: [
|
|
1016
|
-
history: [
|
|
1024
|
+
track: [...$],
|
|
1025
|
+
approve: [...$],
|
|
1026
|
+
sign: [...$],
|
|
1027
|
+
freeze: [...$],
|
|
1028
|
+
revision: [...$],
|
|
1029
|
+
amendment: [...$],
|
|
1030
|
+
history: [l("color", "borderColor")],
|
|
1017
1031
|
// ── v2.13 ──
|
|
1018
1032
|
assert: [
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1033
|
+
l("color", "borderColor"),
|
|
1034
|
+
l("bgcolor", "backgroundColor"),
|
|
1035
|
+
l("border", "borderLeft")
|
|
1022
1036
|
],
|
|
1023
1037
|
secret: [
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1038
|
+
l("color", "color"),
|
|
1039
|
+
l("bgcolor", "backgroundColor"),
|
|
1040
|
+
l("blur", "filter")
|
|
1027
1041
|
],
|
|
1028
1042
|
// ── Layout ──
|
|
1029
1043
|
watermark: [
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1044
|
+
l("color", "color"),
|
|
1045
|
+
l("size", "fontSize"),
|
|
1046
|
+
l("opacity", "opacity")
|
|
1033
1047
|
],
|
|
1034
|
-
signline: [
|
|
1048
|
+
signline: [l("color", "color"), l("width", "width")]
|
|
1035
1049
|
};
|
|
1036
|
-
function
|
|
1037
|
-
const n =
|
|
1050
|
+
function Xn(t, e) {
|
|
1051
|
+
const n = Qn[t];
|
|
1038
1052
|
if (!n) return {};
|
|
1039
1053
|
const r = {};
|
|
1040
1054
|
for (const o of n) {
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1055
|
+
const c = e[o.property];
|
|
1056
|
+
c && (o.transform ? r[o.css] = o.transform(c) : r[o.css] = c);
|
|
1043
1057
|
}
|
|
1044
1058
|
return r;
|
|
1045
1059
|
}
|
|
1046
|
-
function
|
|
1047
|
-
const n =
|
|
1060
|
+
function ot(t, e) {
|
|
1061
|
+
const n = Xn(t, e);
|
|
1048
1062
|
return e.leading && (n.lineHeight = e.leading), e["space-before"] && (n.marginTop = e["space-before"]), e["space-after"] && (n.marginBottom = e["space-after"]), Object.entries(n).map(([r, o]) => `${r.replace(/([A-Z])/g, "-$1").toLowerCase()}:${o}`).join(";");
|
|
1049
1063
|
}
|
|
1050
|
-
function
|
|
1064
|
+
function Ft(t) {
|
|
1051
1065
|
return t.end ? { "data-it-end": t.end } : {};
|
|
1052
1066
|
}
|
|
1053
|
-
const
|
|
1067
|
+
const Zn = Y.create({
|
|
1054
1068
|
name: "itTitle",
|
|
1055
1069
|
group: "block",
|
|
1056
1070
|
content: "inline*",
|
|
@@ -1067,15 +1081,15 @@ const Bn = E.create({
|
|
|
1067
1081
|
return [{ tag: 'h1[data-it-type="title"]' }];
|
|
1068
1082
|
},
|
|
1069
1083
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1070
|
-
const n =
|
|
1084
|
+
const n = dt(e.attrs.props), r = F(t, {
|
|
1071
1085
|
"data-it-type": "title",
|
|
1072
1086
|
class: "it-doc-title",
|
|
1073
|
-
style:
|
|
1074
|
-
...
|
|
1087
|
+
style: ot("title", n),
|
|
1088
|
+
...Ft(n)
|
|
1075
1089
|
});
|
|
1076
1090
|
return n.end ? ["h1", r, ["span", { class: "it-split-main" }, 0]] : ["h1", r, 0];
|
|
1077
1091
|
}
|
|
1078
|
-
}),
|
|
1092
|
+
}), tr = Y.create({
|
|
1079
1093
|
name: "itSummary",
|
|
1080
1094
|
group: "block",
|
|
1081
1095
|
content: "inline*",
|
|
@@ -1089,18 +1103,18 @@ const Bn = E.create({
|
|
|
1089
1103
|
return [{ tag: 'p[data-it-type="summary"]' }];
|
|
1090
1104
|
},
|
|
1091
1105
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1092
|
-
const n =
|
|
1106
|
+
const n = dt(e.attrs.props);
|
|
1093
1107
|
return [
|
|
1094
1108
|
"p",
|
|
1095
|
-
|
|
1109
|
+
F(t, {
|
|
1096
1110
|
"data-it-type": "summary",
|
|
1097
1111
|
class: "it-doc-summary",
|
|
1098
|
-
style:
|
|
1112
|
+
style: ot("summary", n)
|
|
1099
1113
|
}),
|
|
1100
1114
|
0
|
|
1101
1115
|
];
|
|
1102
1116
|
}
|
|
1103
|
-
}),
|
|
1117
|
+
}), er = Y.create({
|
|
1104
1118
|
name: "itSection",
|
|
1105
1119
|
group: "block",
|
|
1106
1120
|
content: "inline*",
|
|
@@ -1114,15 +1128,15 @@ const Bn = E.create({
|
|
|
1114
1128
|
return [{ tag: 'h2[data-it-type="section"]' }];
|
|
1115
1129
|
},
|
|
1116
1130
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1117
|
-
const n =
|
|
1131
|
+
const n = dt(e.attrs.props), r = F(t, {
|
|
1118
1132
|
"data-it-type": "section",
|
|
1119
1133
|
class: "it-doc-section",
|
|
1120
|
-
style:
|
|
1121
|
-
...
|
|
1134
|
+
style: ot("section", n),
|
|
1135
|
+
...Ft(n)
|
|
1122
1136
|
});
|
|
1123
1137
|
return n.end ? ["h2", r, ["span", { class: "it-split-main" }, 0]] : ["h2", r, 0];
|
|
1124
1138
|
}
|
|
1125
|
-
}),
|
|
1139
|
+
}), nr = Y.create({
|
|
1126
1140
|
name: "itSub",
|
|
1127
1141
|
group: "block",
|
|
1128
1142
|
content: "inline*",
|
|
@@ -1136,15 +1150,15 @@ const Bn = E.create({
|
|
|
1136
1150
|
return [{ tag: 'h3[data-it-type="sub"]' }];
|
|
1137
1151
|
},
|
|
1138
1152
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1139
|
-
const n =
|
|
1153
|
+
const n = dt(e.attrs.props), r = F(t, {
|
|
1140
1154
|
"data-it-type": "sub",
|
|
1141
1155
|
class: "it-doc-sub",
|
|
1142
|
-
style:
|
|
1143
|
-
...
|
|
1156
|
+
style: ot("sub", n),
|
|
1157
|
+
...Ft(n)
|
|
1144
1158
|
});
|
|
1145
1159
|
return n.end ? ["h3", r, ["span", { class: "it-split-main" }, 0]] : ["h3", r, 0];
|
|
1146
1160
|
}
|
|
1147
|
-
}),
|
|
1161
|
+
}), rr = Y.create({
|
|
1148
1162
|
name: "itCallout",
|
|
1149
1163
|
group: "block",
|
|
1150
1164
|
content: "inline*",
|
|
@@ -1163,7 +1177,7 @@ const Bn = E.create({
|
|
|
1163
1177
|
return [{ tag: 'div[data-it-type="callout"]' }];
|
|
1164
1178
|
},
|
|
1165
1179
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1166
|
-
const n = e.attrs.variant || "tip", r =
|
|
1180
|
+
const n = e.attrs.variant || "tip", r = dt(e.attrs.props), o = {
|
|
1167
1181
|
tip: "tip",
|
|
1168
1182
|
info: "info",
|
|
1169
1183
|
warning: "warning",
|
|
@@ -1172,11 +1186,11 @@ const Bn = E.create({
|
|
|
1172
1186
|
};
|
|
1173
1187
|
return [
|
|
1174
1188
|
"div",
|
|
1175
|
-
|
|
1189
|
+
F(t, {
|
|
1176
1190
|
"data-it-type": "callout",
|
|
1177
1191
|
"data-variant": n,
|
|
1178
1192
|
class: `it-doc-callout it-doc-callout-${n}`,
|
|
1179
|
-
style:
|
|
1193
|
+
style: ot(n, r)
|
|
1180
1194
|
}),
|
|
1181
1195
|
[
|
|
1182
1196
|
"span",
|
|
@@ -1189,7 +1203,7 @@ const Bn = E.create({
|
|
|
1189
1203
|
["span", { class: "it-doc-callout-text" }, 0]
|
|
1190
1204
|
];
|
|
1191
1205
|
}
|
|
1192
|
-
}),
|
|
1206
|
+
}), or = Y.create({
|
|
1193
1207
|
name: "itQuote",
|
|
1194
1208
|
group: "block",
|
|
1195
1209
|
content: "inline*",
|
|
@@ -1204,18 +1218,18 @@ const Bn = E.create({
|
|
|
1204
1218
|
return [{ tag: 'blockquote[data-it-type="quote"]' }];
|
|
1205
1219
|
},
|
|
1206
1220
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1207
|
-
const n =
|
|
1221
|
+
const n = dt(e.attrs.props);
|
|
1208
1222
|
return [
|
|
1209
1223
|
"blockquote",
|
|
1210
|
-
|
|
1224
|
+
F(t, {
|
|
1211
1225
|
"data-it-type": "quote",
|
|
1212
1226
|
class: "it-doc-quote",
|
|
1213
|
-
style:
|
|
1227
|
+
style: ot("quote", n)
|
|
1214
1228
|
}),
|
|
1215
1229
|
0
|
|
1216
1230
|
];
|
|
1217
1231
|
}
|
|
1218
|
-
}),
|
|
1232
|
+
}), sr = Y.create({
|
|
1219
1233
|
name: "itCode",
|
|
1220
1234
|
group: "block",
|
|
1221
1235
|
content: "text*",
|
|
@@ -1232,19 +1246,19 @@ const Bn = E.create({
|
|
|
1232
1246
|
return [{ tag: "pre" }];
|
|
1233
1247
|
},
|
|
1234
1248
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1235
|
-
const n =
|
|
1249
|
+
const n = dt(e.attrs.props);
|
|
1236
1250
|
return [
|
|
1237
1251
|
"pre",
|
|
1238
|
-
|
|
1252
|
+
F(t, {
|
|
1239
1253
|
"data-it-type": "code",
|
|
1240
1254
|
class: "it-doc-code",
|
|
1241
1255
|
"data-lang": e.attrs.lang || "",
|
|
1242
|
-
style:
|
|
1256
|
+
style: ot("code", n)
|
|
1243
1257
|
}),
|
|
1244
1258
|
["code", 0]
|
|
1245
1259
|
];
|
|
1246
1260
|
}
|
|
1247
|
-
}),
|
|
1261
|
+
}), ir = Y.create({
|
|
1248
1262
|
name: "itDivider",
|
|
1249
1263
|
group: "block",
|
|
1250
1264
|
atom: !0,
|
|
@@ -1252,9 +1266,9 @@ const Bn = E.create({
|
|
|
1252
1266
|
return [{ tag: "hr" }];
|
|
1253
1267
|
},
|
|
1254
1268
|
renderHTML({ HTMLAttributes: t }) {
|
|
1255
|
-
return ["hr",
|
|
1269
|
+
return ["hr", F(t, { class: "it-doc-divider" })];
|
|
1256
1270
|
}
|
|
1257
|
-
}),
|
|
1271
|
+
}), ar = Y.create({
|
|
1258
1272
|
name: "itMeta",
|
|
1259
1273
|
group: "block",
|
|
1260
1274
|
atom: !0,
|
|
@@ -1274,14 +1288,24 @@ const Bn = E.create({
|
|
|
1274
1288
|
const n = String(e.attrs.raw || "").replace(/\s*\|\s*/g, " · ");
|
|
1275
1289
|
return [
|
|
1276
1290
|
"div",
|
|
1277
|
-
|
|
1291
|
+
F(t, { "data-it-meta": "", class: "it-doc-meta" }),
|
|
1278
1292
|
`⚙ ${n}`
|
|
1279
1293
|
];
|
|
1280
1294
|
}
|
|
1281
|
-
})
|
|
1295
|
+
});
|
|
1296
|
+
function Mt(t) {
|
|
1297
|
+
try {
|
|
1298
|
+
const e = JSON.parse(t || "[]");
|
|
1299
|
+
return Array.isArray(e) ? e : [];
|
|
1300
|
+
} catch {
|
|
1301
|
+
return [];
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
const cr = Y.create({
|
|
1282
1305
|
name: "itTable",
|
|
1283
1306
|
group: "block",
|
|
1284
1307
|
atom: !0,
|
|
1308
|
+
selectable: !0,
|
|
1285
1309
|
addAttributes() {
|
|
1286
1310
|
return {
|
|
1287
1311
|
rows: {
|
|
@@ -1295,45 +1319,89 @@ const Bn = E.create({
|
|
|
1295
1319
|
return [{ tag: "table[data-it-table]" }];
|
|
1296
1320
|
},
|
|
1297
1321
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1298
|
-
|
|
1299
|
-
try {
|
|
1300
|
-
n = JSON.parse(e.attrs.rows || "[]");
|
|
1301
|
-
} catch {
|
|
1302
|
-
n = [];
|
|
1303
|
-
}
|
|
1304
|
-
const r = n[0] || [], o = n.slice(1);
|
|
1322
|
+
const n = Mt(e.attrs.rows), r = n[0] || [], o = n.slice(1);
|
|
1305
1323
|
return [
|
|
1306
1324
|
"table",
|
|
1307
|
-
|
|
1325
|
+
F(t, {
|
|
1308
1326
|
"data-it-table": "",
|
|
1309
1327
|
class: "it-doc-table"
|
|
1310
1328
|
}),
|
|
1311
1329
|
[
|
|
1312
1330
|
"thead",
|
|
1313
|
-
["tr", ...r.map((
|
|
1331
|
+
["tr", ...r.map((c) => ["th", ne(c), String(c)])]
|
|
1314
1332
|
],
|
|
1315
1333
|
[
|
|
1316
1334
|
"tbody",
|
|
1317
|
-
...o.map((
|
|
1335
|
+
...o.map((c) => [
|
|
1318
1336
|
"tr",
|
|
1319
|
-
...
|
|
1337
|
+
...c.map((a) => ["td", ne(a), String(a)])
|
|
1320
1338
|
])
|
|
1321
1339
|
]
|
|
1322
1340
|
];
|
|
1341
|
+
},
|
|
1342
|
+
addNodeView() {
|
|
1343
|
+
return ({ node: t, editor: e, getPos: n }) => {
|
|
1344
|
+
const r = document.createElement("table");
|
|
1345
|
+
r.className = "it-doc-table", r.setAttribute("data-it-table", "");
|
|
1346
|
+
const o = document.createElement("thead"), c = document.createElement("tbody");
|
|
1347
|
+
r.append(o, c);
|
|
1348
|
+
let a = Mt(t.attrs.rows);
|
|
1349
|
+
const d = () => {
|
|
1350
|
+
const u = [];
|
|
1351
|
+
r.querySelectorAll("tr").forEach((f) => {
|
|
1352
|
+
const b = [];
|
|
1353
|
+
f.querySelectorAll("th,td").forEach(
|
|
1354
|
+
(S) => b.push((S.textContent || "").trim())
|
|
1355
|
+
), u.push(b);
|
|
1356
|
+
});
|
|
1357
|
+
const h = JSON.stringify(u);
|
|
1358
|
+
if (h !== t.attrs.rows && (a = u, typeof n == "function")) {
|
|
1359
|
+
const f = n();
|
|
1360
|
+
if (f == null) return;
|
|
1361
|
+
const b = e.view.state.tr.setNodeAttribute(f, "rows", h);
|
|
1362
|
+
e.view.dispatch(b);
|
|
1363
|
+
}
|
|
1364
|
+
}, i = (u, h) => {
|
|
1365
|
+
const f = document.createElement(u);
|
|
1366
|
+
f.textContent = h;
|
|
1367
|
+
const b = e.isEditable;
|
|
1368
|
+
return f.contentEditable = b ? "true" : "false", /\{\{[^}]+\}\}|^each:/.test(String(h).trim()) && (f.className = "it-doc-var-cell"), f.addEventListener("blur", d), f.addEventListener("keydown", (S) => {
|
|
1369
|
+
S.key === "Enter" && (S.preventDefault(), S.target.blur());
|
|
1370
|
+
}), f;
|
|
1371
|
+
}, m = (u) => {
|
|
1372
|
+
o.innerHTML = "", c.innerHTML = "";
|
|
1373
|
+
const h = u[0] || [], f = document.createElement("tr");
|
|
1374
|
+
h.forEach((b) => f.appendChild(i("th", String(b)))), o.appendChild(f), u.slice(1).forEach((b) => {
|
|
1375
|
+
const S = document.createElement("tr");
|
|
1376
|
+
b.forEach((T) => S.appendChild(i("td", String(T)))), c.appendChild(S);
|
|
1377
|
+
});
|
|
1378
|
+
};
|
|
1379
|
+
return m(a), {
|
|
1380
|
+
dom: r,
|
|
1381
|
+
// Re-render only when the attr changed from OUTSIDE this view (e.g.
|
|
1382
|
+
// source-mode edit), not from our own commit, to keep the caret stable.
|
|
1383
|
+
update(u) {
|
|
1384
|
+
return u.type.name !== "itTable" ? !1 : (u.attrs.rows !== JSON.stringify(a) && (a = Mt(u.attrs.rows), m(a)), !0);
|
|
1385
|
+
},
|
|
1386
|
+
// The cells own the selection while editing; let ProseMirror ignore
|
|
1387
|
+
// mutations inside the contenteditable cells.
|
|
1388
|
+
ignoreMutation: () => !0
|
|
1389
|
+
};
|
|
1390
|
+
};
|
|
1323
1391
|
}
|
|
1324
1392
|
});
|
|
1325
|
-
function
|
|
1393
|
+
function ne(t) {
|
|
1326
1394
|
return /\{\{[^}]+\}\}|^each:/.test(String(t).trim()) ? { class: "it-doc-var-cell" } : {};
|
|
1327
1395
|
}
|
|
1328
|
-
function
|
|
1329
|
-
const e = t.indexOf(":"), n = (e >= 0 ? t.slice(0, e) : t).trim().toLowerCase(), o = (e >= 0 ? t.slice(e + 1).trim() : "").split("|").map((d) => d.trim()),
|
|
1396
|
+
function jt(t) {
|
|
1397
|
+
const e = t.indexOf(":"), n = (e >= 0 ? t.slice(0, e) : t).trim().toLowerCase(), o = (e >= 0 ? t.slice(e + 1).trim() : "").split("|").map((d) => d.trim()), c = o.shift() || "", a = {};
|
|
1330
1398
|
for (const d of o) {
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1399
|
+
const i = d.indexOf(":");
|
|
1400
|
+
i > 0 && (a[d.slice(0, i).trim().toLowerCase()] = d.slice(i + 1).trim());
|
|
1333
1401
|
}
|
|
1334
|
-
return { keyword: n, content:
|
|
1402
|
+
return { keyword: n, content: c, props: a };
|
|
1335
1403
|
}
|
|
1336
|
-
const
|
|
1404
|
+
const lr = Y.create({
|
|
1337
1405
|
name: "itTrust",
|
|
1338
1406
|
group: "block",
|
|
1339
1407
|
atom: !0,
|
|
@@ -1355,36 +1423,36 @@ const Kn = E.create({
|
|
|
1355
1423
|
return [{ tag: "div[data-it-trust]" }];
|
|
1356
1424
|
},
|
|
1357
1425
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1358
|
-
const { keyword: n, content: r, props: o } =
|
|
1426
|
+
const { keyword: n, content: r, props: o } = jt(
|
|
1359
1427
|
String(e.attrs.raw || "")
|
|
1360
|
-
),
|
|
1428
|
+
), c = o.role || o.title || "", a = (o.at || o.date || o.time || "").slice(0, 10), d = [];
|
|
1361
1429
|
if (n === "seal" || n === "freeze") {
|
|
1362
|
-
const
|
|
1363
|
-
d.push(["span", { class: "it-doc-trust__label" }, "Sealed document"]),
|
|
1430
|
+
const i = n === "seal" && r || o.hash || "";
|
|
1431
|
+
d.push(["span", { class: "it-doc-trust__label" }, "Sealed document"]), a && d.push(["span", { class: "it-doc-trust__date" }, a]), i && d.push([
|
|
1364
1432
|
"code",
|
|
1365
1433
|
{ class: "it-doc-trust__hash" },
|
|
1366
|
-
|
|
1434
|
+
i.length > 20 ? i.slice(0, 20) + "..." : i
|
|
1367
1435
|
]);
|
|
1368
1436
|
} else if (n === "approve") {
|
|
1369
|
-
const
|
|
1370
|
-
d.push(["span", { class: "it-doc-trust__label" }, "Approved"]),
|
|
1437
|
+
const i = o.by || r, m = o.by ? r : "";
|
|
1438
|
+
d.push(["span", { class: "it-doc-trust__label" }, "Approved"]), m && d.push(["span", { class: "it-doc-trust__what" }, m]), i && d.push([
|
|
1371
1439
|
"span",
|
|
1372
1440
|
{ class: "it-doc-trust__who" },
|
|
1373
|
-
|
|
1374
|
-
]),
|
|
1441
|
+
c ? `${i}, ${c}` : i
|
|
1442
|
+
]), a && d.push(["span", { class: "it-doc-trust__date" }, a]);
|
|
1375
1443
|
} else if (n === "amend" || n === "amendment")
|
|
1376
|
-
d.push(["span", { class: "it-doc-trust__label" }, "Amendment"]), r && d.push(["span", { class: "it-doc-trust__what" }, r]),
|
|
1444
|
+
d.push(["span", { class: "it-doc-trust__label" }, "Amendment"]), r && d.push(["span", { class: "it-doc-trust__what" }, r]), a && d.push(["span", { class: "it-doc-trust__date" }, a]);
|
|
1377
1445
|
else {
|
|
1378
|
-
const
|
|
1379
|
-
d.push(["span", { class: "it-doc-trust__name" },
|
|
1446
|
+
const i = r || o.by || "", m = !!o.hash;
|
|
1447
|
+
d.push(["span", { class: "it-doc-trust__name" }, i]), c && d.push(["span", { class: "it-doc-trust__role" }, c]), a && d.push(["span", { class: "it-doc-trust__date" }, a]), d.push([
|
|
1380
1448
|
"span",
|
|
1381
1449
|
{ class: "it-doc-trust__status" },
|
|
1382
|
-
|
|
1450
|
+
m ? "Signed · verified" : "Signed"
|
|
1383
1451
|
]);
|
|
1384
1452
|
}
|
|
1385
1453
|
return [
|
|
1386
1454
|
"div",
|
|
1387
|
-
|
|
1455
|
+
F(t, {
|
|
1388
1456
|
"data-it-trust": "",
|
|
1389
1457
|
"data-trust": n,
|
|
1390
1458
|
class: `it-doc-trust it-doc-trust--${n}`
|
|
@@ -1392,7 +1460,7 @@ const Kn = E.create({
|
|
|
1392
1460
|
...d
|
|
1393
1461
|
];
|
|
1394
1462
|
}
|
|
1395
|
-
}),
|
|
1463
|
+
}), dr = Y.create({
|
|
1396
1464
|
name: "itMetric",
|
|
1397
1465
|
group: "block",
|
|
1398
1466
|
atom: !0,
|
|
@@ -1409,22 +1477,22 @@ const Kn = E.create({
|
|
|
1409
1477
|
return [{ tag: "div[data-it-metric]" }];
|
|
1410
1478
|
},
|
|
1411
1479
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1412
|
-
const { content: n, props: r } =
|
|
1480
|
+
const { content: n, props: r } = jt(String(e.attrs.raw || "")), o = [r.value, r.unit].filter(Boolean).join(" "), c = /\b(total|balance due|amount due|grand)\b/i.test(n), a = /\{\{[^}]+\}\}/.test(o);
|
|
1413
1481
|
return [
|
|
1414
1482
|
"div",
|
|
1415
|
-
|
|
1483
|
+
F(t, {
|
|
1416
1484
|
"data-it-metric": "",
|
|
1417
|
-
class: `it-doc-metric${
|
|
1485
|
+
class: `it-doc-metric${c ? " it-doc-metric--total" : ""}`
|
|
1418
1486
|
}),
|
|
1419
1487
|
["span", { class: "it-doc-metric__label" }, n],
|
|
1420
1488
|
[
|
|
1421
1489
|
"span",
|
|
1422
|
-
{ class: `it-doc-metric__value${
|
|
1490
|
+
{ class: `it-doc-metric__value${a ? " it-doc-var" : ""}` },
|
|
1423
1491
|
o
|
|
1424
1492
|
]
|
|
1425
1493
|
];
|
|
1426
1494
|
}
|
|
1427
|
-
}),
|
|
1495
|
+
}), ur = Y.create({
|
|
1428
1496
|
name: "itStyleRule",
|
|
1429
1497
|
group: "block",
|
|
1430
1498
|
atom: !0,
|
|
@@ -1441,10 +1509,10 @@ const Kn = E.create({
|
|
|
1441
1509
|
return [{ tag: "div[data-it-style-rule]" }];
|
|
1442
1510
|
},
|
|
1443
1511
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1444
|
-
const { content: n, props: r } =
|
|
1512
|
+
const { content: n, props: r } = jt(String(e.attrs.raw || "")), o = Object.entries(r).map(([c, a]) => `${c}: ${a}`).join(" · ");
|
|
1445
1513
|
return [
|
|
1446
1514
|
"div",
|
|
1447
|
-
|
|
1515
|
+
F(t, {
|
|
1448
1516
|
"data-it-style-rule": "",
|
|
1449
1517
|
class: "it-doc-stylerule"
|
|
1450
1518
|
}),
|
|
@@ -1453,7 +1521,7 @@ const Kn = E.create({
|
|
|
1453
1521
|
["span", { class: "it-doc-stylerule__decl" }, o]
|
|
1454
1522
|
];
|
|
1455
1523
|
}
|
|
1456
|
-
}),
|
|
1524
|
+
}), pr = Y.create({
|
|
1457
1525
|
name: "itBreak",
|
|
1458
1526
|
group: "block",
|
|
1459
1527
|
atom: !0,
|
|
@@ -1463,13 +1531,13 @@ const Kn = E.create({
|
|
|
1463
1531
|
renderHTML({ HTMLAttributes: t }) {
|
|
1464
1532
|
return [
|
|
1465
1533
|
"div",
|
|
1466
|
-
|
|
1534
|
+
F(t, {
|
|
1467
1535
|
"data-it-type": "break",
|
|
1468
1536
|
class: "it-doc-break"
|
|
1469
1537
|
})
|
|
1470
1538
|
];
|
|
1471
1539
|
}
|
|
1472
|
-
}),
|
|
1540
|
+
}), fr = Y.create({
|
|
1473
1541
|
name: "itGenericBlock",
|
|
1474
1542
|
group: "block",
|
|
1475
1543
|
content: "inline*",
|
|
@@ -1485,16 +1553,16 @@ const Kn = E.create({
|
|
|
1485
1553
|
return [{ tag: '[data-it-type="generic"]' }];
|
|
1486
1554
|
},
|
|
1487
1555
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
1488
|
-
const n = e.attrs.keyword, r =
|
|
1556
|
+
const n = e.attrs.keyword, r = dt(e.attrs.props), o = String(
|
|
1489
1557
|
r.to || r.url || r.href || r.file || ""
|
|
1490
1558
|
).trim();
|
|
1491
1559
|
return (n === "link" || n === "ref") && o ? [
|
|
1492
1560
|
"p",
|
|
1493
|
-
|
|
1561
|
+
F(t, {
|
|
1494
1562
|
"data-it-type": "generic",
|
|
1495
1563
|
"data-keyword": n,
|
|
1496
1564
|
class: `it-doc-generic it-doc-kw-${n}`,
|
|
1497
|
-
style:
|
|
1565
|
+
style: ot(n, r)
|
|
1498
1566
|
}),
|
|
1499
1567
|
[
|
|
1500
1568
|
"a",
|
|
@@ -1508,16 +1576,16 @@ const Kn = E.create({
|
|
|
1508
1576
|
]
|
|
1509
1577
|
] : [
|
|
1510
1578
|
"p",
|
|
1511
|
-
|
|
1579
|
+
F(t, {
|
|
1512
1580
|
"data-it-type": "generic",
|
|
1513
1581
|
"data-keyword": n,
|
|
1514
1582
|
class: `it-doc-generic it-doc-kw-${n}`,
|
|
1515
|
-
style:
|
|
1583
|
+
style: ot(n, r)
|
|
1516
1584
|
}),
|
|
1517
1585
|
["span", { class: "it-doc-generic-content" }, 0]
|
|
1518
1586
|
];
|
|
1519
1587
|
}
|
|
1520
|
-
}),
|
|
1588
|
+
}), gr = Y.create({
|
|
1521
1589
|
name: "itComment",
|
|
1522
1590
|
group: "block",
|
|
1523
1591
|
content: "inline*",
|
|
@@ -1528,7 +1596,7 @@ const Kn = E.create({
|
|
|
1528
1596
|
renderHTML({ HTMLAttributes: t }) {
|
|
1529
1597
|
return [
|
|
1530
1598
|
"p",
|
|
1531
|
-
|
|
1599
|
+
F(t, {
|
|
1532
1600
|
"data-it-type": "comment",
|
|
1533
1601
|
class: "it-doc-comment"
|
|
1534
1602
|
}),
|
|
@@ -1536,19 +1604,19 @@ const Kn = E.create({
|
|
|
1536
1604
|
];
|
|
1537
1605
|
}
|
|
1538
1606
|
});
|
|
1539
|
-
function
|
|
1607
|
+
function dt(t) {
|
|
1540
1608
|
try {
|
|
1541
1609
|
return typeof t == "string" ? JSON.parse(t) : t || {};
|
|
1542
1610
|
} catch {
|
|
1543
1611
|
return {};
|
|
1544
1612
|
}
|
|
1545
1613
|
}
|
|
1546
|
-
const
|
|
1614
|
+
const me = {
|
|
1547
1615
|
leading: "leading",
|
|
1548
1616
|
"space-before": "spaceBefore",
|
|
1549
1617
|
"space-after": "spaceAfter",
|
|
1550
1618
|
end: "end"
|
|
1551
|
-
},
|
|
1619
|
+
}, hr = /* @__PURE__ */ new Set([
|
|
1552
1620
|
"itTitle",
|
|
1553
1621
|
"itSummary",
|
|
1554
1622
|
"itSection",
|
|
@@ -1556,18 +1624,18 @@ const re = {
|
|
|
1556
1624
|
"itQuote",
|
|
1557
1625
|
"itCallout",
|
|
1558
1626
|
"itGenericBlock"
|
|
1559
|
-
]),
|
|
1560
|
-
function
|
|
1627
|
+
]), mr = /* @__PURE__ */ new Set(["itTitle", "itSection", "itSub"]);
|
|
1628
|
+
function be(t) {
|
|
1561
1629
|
try {
|
|
1562
1630
|
return typeof t == "string" ? JSON.parse(t) : t || {};
|
|
1563
1631
|
} catch {
|
|
1564
1632
|
return {};
|
|
1565
1633
|
}
|
|
1566
1634
|
}
|
|
1567
|
-
function
|
|
1568
|
-
return t === "paragraph" ? !0 : e === "end" ?
|
|
1635
|
+
function ye(t, e) {
|
|
1636
|
+
return t === "paragraph" ? !0 : e === "end" ? mr.has(t) : hr.has(t);
|
|
1569
1637
|
}
|
|
1570
|
-
const
|
|
1638
|
+
const br = en.extend({
|
|
1571
1639
|
addAttributes() {
|
|
1572
1640
|
return {
|
|
1573
1641
|
...this.parent?.(),
|
|
@@ -1596,30 +1664,30 @@ const er = Ie.extend({
|
|
|
1596
1664
|
renderHTML({ node: t, HTMLAttributes: e }) {
|
|
1597
1665
|
return t.attrs.end ? [
|
|
1598
1666
|
"p",
|
|
1599
|
-
|
|
1667
|
+
F(e),
|
|
1600
1668
|
["span", { class: "it-split-main" }, 0]
|
|
1601
|
-
] : ["p",
|
|
1669
|
+
] : ["p", F(e), 0];
|
|
1602
1670
|
}
|
|
1603
|
-
}),
|
|
1671
|
+
}), yr = vt.create({
|
|
1604
1672
|
name: "blockProps",
|
|
1605
1673
|
addCommands() {
|
|
1606
1674
|
return {
|
|
1607
1675
|
setBlockProp: (t, e) => ({ state: n, tr: r, dispatch: o }) => {
|
|
1608
|
-
const { from:
|
|
1676
|
+
const { from: c, to: a } = n.selection;
|
|
1609
1677
|
let d = !1;
|
|
1610
|
-
return n.doc.nodesBetween(
|
|
1611
|
-
const
|
|
1612
|
-
if (
|
|
1613
|
-
if (!
|
|
1614
|
-
if (
|
|
1615
|
-
r.setNodeMarkup(
|
|
1616
|
-
...
|
|
1617
|
-
[
|
|
1678
|
+
return n.doc.nodesBetween(c, a, (i, m) => {
|
|
1679
|
+
const u = i.type.name;
|
|
1680
|
+
if (u === "bulletList" || u === "orderedList" || !i.isBlock || i.isAtom) return !1;
|
|
1681
|
+
if (!ye(u, t)) return !0;
|
|
1682
|
+
if (u === "paragraph")
|
|
1683
|
+
r.setNodeMarkup(m, void 0, {
|
|
1684
|
+
...i.attrs,
|
|
1685
|
+
[me[t]]: e
|
|
1618
1686
|
});
|
|
1619
1687
|
else {
|
|
1620
|
-
const h =
|
|
1621
|
-
e == null || e === "" ? delete h[t] : h[t] = e, r.setNodeMarkup(
|
|
1622
|
-
...
|
|
1688
|
+
const h = be(i.attrs.props);
|
|
1689
|
+
e == null || e === "" ? delete h[t] : h[t] = e, r.setNodeMarkup(m, void 0, {
|
|
1690
|
+
...i.attrs,
|
|
1623
1691
|
props: JSON.stringify(h)
|
|
1624
1692
|
});
|
|
1625
1693
|
}
|
|
@@ -1629,23 +1697,23 @@ const er = Ie.extend({
|
|
|
1629
1697
|
};
|
|
1630
1698
|
}
|
|
1631
1699
|
});
|
|
1632
|
-
function
|
|
1700
|
+
function ct(t, e) {
|
|
1633
1701
|
if (!t) return null;
|
|
1634
1702
|
const { state: n } = t, { from: r, to: o } = n.selection;
|
|
1635
|
-
let
|
|
1636
|
-
return n.doc.nodesBetween(r, o, (
|
|
1637
|
-
if (
|
|
1638
|
-
const d =
|
|
1639
|
-
if (!
|
|
1703
|
+
let c = null;
|
|
1704
|
+
return n.doc.nodesBetween(r, o, (a) => {
|
|
1705
|
+
if (c !== null) return !1;
|
|
1706
|
+
const d = a.type.name;
|
|
1707
|
+
if (!ye(d, e)) return !0;
|
|
1640
1708
|
if (d === "paragraph") {
|
|
1641
|
-
const
|
|
1642
|
-
|
|
1709
|
+
const i = a.attrs[me[e]];
|
|
1710
|
+
c = i != null ? String(i) : "";
|
|
1643
1711
|
} else
|
|
1644
|
-
|
|
1712
|
+
c = be(a.attrs.props)[e] ?? "";
|
|
1645
1713
|
return !1;
|
|
1646
|
-
}),
|
|
1714
|
+
}), c;
|
|
1647
1715
|
}
|
|
1648
|
-
const
|
|
1716
|
+
const re = {
|
|
1649
1717
|
identity: { label: "Identity", icon: "ID", color: "#3b82f6" },
|
|
1650
1718
|
content: { label: "Content", icon: "Tx", color: "#6b7280" },
|
|
1651
1719
|
structure: { label: "Structure", icon: "##", color: "#22c55e" },
|
|
@@ -1654,7 +1722,7 @@ const Kt = {
|
|
|
1654
1722
|
trust: { label: "Trust", icon: "Tr", color: "#eab308" },
|
|
1655
1723
|
layout: { label: "Layout", icon: "Pg", color: "#64748b" }
|
|
1656
1724
|
};
|
|
1657
|
-
function
|
|
1725
|
+
function vr(t) {
|
|
1658
1726
|
const e = document.createElement("iframe");
|
|
1659
1727
|
e.setAttribute("aria-hidden", "true"), e.style.cssText = "position:fixed;right:0;bottom:0;width:210mm;height:297mm;border:0;visibility:hidden;", document.body.appendChild(e);
|
|
1660
1728
|
let n = !1;
|
|
@@ -1672,87 +1740,308 @@ function rr(t) {
|
|
|
1672
1740
|
const o = e.contentWindow.document;
|
|
1673
1741
|
o.open(), o.write(t), o.close(), o.readyState === "complete" && window.setTimeout(r, 250);
|
|
1674
1742
|
}
|
|
1675
|
-
function
|
|
1743
|
+
function kr(t, e) {
|
|
1676
1744
|
return t.includes("</head>") ? t.replace("</head>", `<style>${e}</style></head>`) : t;
|
|
1677
1745
|
}
|
|
1678
|
-
const
|
|
1679
|
-
function
|
|
1746
|
+
const ve = ".it-doc-callout{background:none!important;border:1px solid #ccc!important}", oe = Ge;
|
|
1747
|
+
function Sr(t, e) {
|
|
1680
1748
|
const n = document.querySelector(".docs-page .tiptap");
|
|
1681
1749
|
if (!n) return null;
|
|
1682
1750
|
const r = n.cloneNode(!0);
|
|
1683
|
-
r.querySelectorAll("[data-it-spacer]").forEach((h) => h.remove());
|
|
1684
|
-
const o = r.innerHTML,
|
|
1751
|
+
r.querySelectorAll("[data-it-spacer]").forEach((h) => h.remove()), r.querySelectorAll('.it-doc-comment, [data-it-type="comment"]').forEach((h) => h.remove());
|
|
1752
|
+
const o = r.innerHTML, c = Array.from(
|
|
1685
1753
|
document.querySelectorAll('style, link[rel="stylesheet"]')
|
|
1686
1754
|
).map((h) => h.outerHTML).join(`
|
|
1687
|
-
`),
|
|
1688
|
-
let
|
|
1689
|
-
|
|
1690
|
-
const
|
|
1755
|
+
`), a = Pt(t), d = a.autoHeight ? `${a.width}px auto` : `${a.width}px ${a.height}px`, i = `${a.marginTop}px ${a.marginRight}px ${a.marginBottom}px ${a.marginLeft}px`;
|
|
1756
|
+
let m = `@page{size:${d};margin:${i};}`;
|
|
1757
|
+
a.header && (m += `@page{@top-center{content:${oe(a.header)};font:10px -apple-system,sans-serif;color:#9aa0a6;}}`), a.footer && (m += `@page{@bottom-center{content:${oe(a.footer)};font:10px -apple-system,sans-serif;color:#9aa0a6;}}`);
|
|
1758
|
+
const u = `
|
|
1691
1759
|
html,body{margin:0;background:#fff;}
|
|
1692
1760
|
.docs-page,.docs-page.docs-sheet{box-shadow:none;border-radius:0;margin:0;width:auto;min-height:0;padding:0;background:#fff;}
|
|
1693
1761
|
.docs-page .tiptap{padding:0;}
|
|
1694
1762
|
[data-it-spacer]{display:none!important;}
|
|
1695
|
-
${e === "minimal-ink" ?
|
|
1763
|
+
${e === "minimal-ink" ? ve : ""}
|
|
1696
1764
|
`;
|
|
1697
|
-
return `<!doctype html><html><head><meta charset="utf-8">${
|
|
1765
|
+
return `<!doctype html><html><head><meta charset="utf-8">${c}<style>${m}${u}</style></head><body><div class="docs-page docs-sheet"><div class="tiptap">${o}</div></div></body></html>`;
|
|
1698
1766
|
}
|
|
1699
|
-
function
|
|
1700
|
-
const r = new Blob([t], { type: n }), o = URL.createObjectURL(r),
|
|
1701
|
-
|
|
1767
|
+
function ke(t, e, n) {
|
|
1768
|
+
const r = new Blob([t], { type: n }), o = URL.createObjectURL(r), c = document.createElement("a");
|
|
1769
|
+
c.href = o, c.download = e, c.click(), URL.revokeObjectURL(o);
|
|
1702
1770
|
}
|
|
1703
|
-
function
|
|
1704
|
-
let r =
|
|
1771
|
+
function Se(t, e, n) {
|
|
1772
|
+
let r = Sr(t, n);
|
|
1705
1773
|
if (!r) {
|
|
1706
|
-
const o =
|
|
1707
|
-
r =
|
|
1774
|
+
const o = rt(t);
|
|
1775
|
+
r = We(o, { theme: e }), n === "minimal-ink" && (r = kr(r, ve));
|
|
1708
1776
|
}
|
|
1709
1777
|
return r;
|
|
1710
1778
|
}
|
|
1711
|
-
function
|
|
1779
|
+
function we(t, e, n = "normal") {
|
|
1712
1780
|
try {
|
|
1713
|
-
|
|
1781
|
+
vr(Se(t, e, n));
|
|
1782
|
+
} catch {
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
function wr(t, e) {
|
|
1786
|
+
try {
|
|
1787
|
+
let n = e;
|
|
1788
|
+
if (!n)
|
|
1789
|
+
try {
|
|
1790
|
+
const r = rt(t), c = r.blocks.find((i) => i.type === "meta")?.properties?.id, a = r.blocks.find((i) => i.type === "title")?.content || "";
|
|
1791
|
+
n = `${String(c || a || "document").trim().replace(/[^\w\-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || "document"}.it`;
|
|
1792
|
+
} catch {
|
|
1793
|
+
n = "document.it";
|
|
1794
|
+
}
|
|
1795
|
+
ke(t, n, "text/plain;charset=utf-8");
|
|
1714
1796
|
} catch {
|
|
1715
1797
|
}
|
|
1716
1798
|
}
|
|
1717
|
-
function
|
|
1799
|
+
function po(t, e, n = "normal") {
|
|
1718
1800
|
try {
|
|
1719
|
-
|
|
1720
|
-
|
|
1801
|
+
ke(
|
|
1802
|
+
Se(t, e, n),
|
|
1721
1803
|
"document.html",
|
|
1722
1804
|
"text/html"
|
|
1723
1805
|
);
|
|
1724
1806
|
} catch {
|
|
1725
1807
|
}
|
|
1726
1808
|
}
|
|
1727
|
-
function
|
|
1728
|
-
return
|
|
1809
|
+
function Tr() {
|
|
1810
|
+
return Ue();
|
|
1811
|
+
}
|
|
1812
|
+
const se = "dotit.editor.lastSigner", ie = "dotit.editor.lastRole";
|
|
1813
|
+
function xr({ content: t, onChange: e, trust: n, intact: r }) {
|
|
1814
|
+
const [o, c] = z(!1), [a, d] = z(!1), [i, m] = z(
|
|
1815
|
+
() => localStorage.getItem(se) || ""
|
|
1816
|
+
), [u, h] = z(() => localStorage.getItem(ie) || ""), [f, b] = z(!1), S = U(null), T = U(0), y = M((x) => {
|
|
1817
|
+
const _ = Date.now();
|
|
1818
|
+
_ - T.current < 400 || (T.current = _, x());
|
|
1819
|
+
}, []);
|
|
1820
|
+
W(() => {
|
|
1821
|
+
if (!o) return;
|
|
1822
|
+
const x = (_) => {
|
|
1823
|
+
S.current && !S.current.contains(_.target) && (c(!1), d(!1));
|
|
1824
|
+
};
|
|
1825
|
+
return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
|
|
1826
|
+
}, [o]);
|
|
1827
|
+
const v = n.isSealed || Ye(t), H = M(() => {
|
|
1828
|
+
const x = i.trim();
|
|
1829
|
+
if (x) {
|
|
1830
|
+
b(!0);
|
|
1831
|
+
try {
|
|
1832
|
+
const _ = Ke(t, {
|
|
1833
|
+
signer: x,
|
|
1834
|
+
role: u.trim() || void 0
|
|
1835
|
+
});
|
|
1836
|
+
_.source && _.source !== t && e(_.source), localStorage.setItem(se, x), u.trim() && localStorage.setItem(ie, u.trim());
|
|
1837
|
+
} finally {
|
|
1838
|
+
b(!1), d(!1), c(!1);
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
}, [t, e, i, u]), B = M(() => {
|
|
1842
|
+
const x = i.trim() || n.signatures[0]?.by || "Document owner";
|
|
1843
|
+
b(!0);
|
|
1844
|
+
try {
|
|
1845
|
+
const _ = qe(t, {
|
|
1846
|
+
signer: x,
|
|
1847
|
+
role: u.trim() || n.signatures[0]?.role || void 0
|
|
1848
|
+
});
|
|
1849
|
+
_.source && _.source !== t && !_.error && e(_.source);
|
|
1850
|
+
} finally {
|
|
1851
|
+
b(!1), c(!1);
|
|
1852
|
+
}
|
|
1853
|
+
}, [t, e, i, u, n.signatures]), j = M(() => {
|
|
1854
|
+
b(!0);
|
|
1855
|
+
try {
|
|
1856
|
+
const x = Ve(t);
|
|
1857
|
+
typeof x == "string" && x !== t && e(x);
|
|
1858
|
+
} finally {
|
|
1859
|
+
b(!1), c(!1);
|
|
1860
|
+
}
|
|
1861
|
+
}, [t, e]), [P, I] = z(null), X = M(() => {
|
|
1862
|
+
try {
|
|
1863
|
+
I(fe(t));
|
|
1864
|
+
} catch {
|
|
1865
|
+
I(null);
|
|
1866
|
+
}
|
|
1867
|
+
}, [t]);
|
|
1868
|
+
let C = /* @__PURE__ */ s(Ct, { size: 15 }), R = "Draft", V = "trust-face--draft";
|
|
1869
|
+
return v ? (C = /* @__PURE__ */ s(Yt, { size: 15 }), R = r === !1 ? "Sealed · changed!" : "Sealed", V = r === !1 ? "trust-face--broken" : "trust-face--sealed") : n.signatures.length > 0 && (C = /* @__PURE__ */ s(Gt, { size: 15 }), R = `Signed · ${n.signatures.length}`, V = "trust-face--signed"), /* @__PURE__ */ g("div", { className: "trust-control", ref: S, children: [
|
|
1870
|
+
/* @__PURE__ */ g(
|
|
1871
|
+
"button",
|
|
1872
|
+
{
|
|
1873
|
+
className: `docs-tb-btn trust-face ${V}`,
|
|
1874
|
+
onClick: () => {
|
|
1875
|
+
c((x) => !x), d(!1), v && X();
|
|
1876
|
+
},
|
|
1877
|
+
title: "Document trust — sign, seal, verify",
|
|
1878
|
+
children: [
|
|
1879
|
+
/* @__PURE__ */ s("span", { className: "trust-face__icon", children: C }),
|
|
1880
|
+
/* @__PURE__ */ s("span", { className: "ribbon-btn-text", children: R }),
|
|
1881
|
+
v && r === !0 && /* @__PURE__ */ s("span", { className: "trust-face__ok", title: "Hash verified", children: "✓" }),
|
|
1882
|
+
/* @__PURE__ */ s(yt, { size: 12 })
|
|
1883
|
+
]
|
|
1884
|
+
}
|
|
1885
|
+
),
|
|
1886
|
+
o && /* @__PURE__ */ g("div", { className: "trust-popover", children: [
|
|
1887
|
+
/* @__PURE__ */ s("div", { className: "trust-popover__state", children: v ? /* @__PURE__ */ g(J, { children: [
|
|
1888
|
+
/* @__PURE__ */ s("strong", { children: "🔒 Sealed — read-only" }),
|
|
1889
|
+
/* @__PURE__ */ g("div", { className: "trust-popover__meta", children: [
|
|
1890
|
+
n.sealedBy && /* @__PURE__ */ g(J, { children: [
|
|
1891
|
+
"by ",
|
|
1892
|
+
n.sealedBy
|
|
1893
|
+
] }),
|
|
1894
|
+
n.sealedAt && /* @__PURE__ */ g(J, { children: [
|
|
1895
|
+
" on ",
|
|
1896
|
+
n.sealedAt
|
|
1897
|
+
] })
|
|
1898
|
+
] })
|
|
1899
|
+
] }) : n.signatures.length > 0 ? /* @__PURE__ */ g(J, { children: [
|
|
1900
|
+
/* @__PURE__ */ s("strong", { children: "Signed" }),
|
|
1901
|
+
/* @__PURE__ */ s("div", { className: "trust-popover__meta", children: n.signatures.map((x) => x.role ? `${x.by} (${x.role})` : x.by).join(" · ") })
|
|
1902
|
+
] }) : /* @__PURE__ */ g(J, { children: [
|
|
1903
|
+
/* @__PURE__ */ s("strong", { children: "Draft" }),
|
|
1904
|
+
/* @__PURE__ */ s("div", { className: "trust-popover__meta", children: "Not signed or sealed yet." })
|
|
1905
|
+
] }) }),
|
|
1906
|
+
/* @__PURE__ */ s("div", { className: "trust-popover__divider" }),
|
|
1907
|
+
v ? /* @__PURE__ */ g(J, { children: [
|
|
1908
|
+
/* @__PURE__ */ g("div", { className: "trust-popover__verify", children: [
|
|
1909
|
+
P ? P.intact ? /* @__PURE__ */ s("span", { className: "trust-verify--ok", children: "✓ Verified — content matches the seal" }) : /* @__PURE__ */ s("span", { className: "trust-verify--bad", children: "⚠ Hash mismatch — content changed after sealing" }) : null,
|
|
1910
|
+
P?.hash && /* @__PURE__ */ g("details", { className: "trust-popover__hash", children: [
|
|
1911
|
+
/* @__PURE__ */ s("summary", { children: "Show hash" }),
|
|
1912
|
+
/* @__PURE__ */ s("code", { children: P.hash })
|
|
1913
|
+
] })
|
|
1914
|
+
] }),
|
|
1915
|
+
/* @__PURE__ */ g(
|
|
1916
|
+
"button",
|
|
1917
|
+
{
|
|
1918
|
+
className: "trust-popover__action",
|
|
1919
|
+
onClick: () => y(X),
|
|
1920
|
+
disabled: f,
|
|
1921
|
+
children: [
|
|
1922
|
+
/* @__PURE__ */ s(Gt, { size: 14 }),
|
|
1923
|
+
" Re-verify"
|
|
1924
|
+
]
|
|
1925
|
+
}
|
|
1926
|
+
),
|
|
1927
|
+
/* @__PURE__ */ g(
|
|
1928
|
+
"button",
|
|
1929
|
+
{
|
|
1930
|
+
className: "trust-popover__action trust-popover__action--warn",
|
|
1931
|
+
onClick: () => y(j),
|
|
1932
|
+
disabled: f,
|
|
1933
|
+
title: "Remove the freeze lock (keeps signatures) and make the document editable again",
|
|
1934
|
+
children: [
|
|
1935
|
+
/* @__PURE__ */ s(nn, { size: 14 }),
|
|
1936
|
+
" Unseal (make editable)"
|
|
1937
|
+
]
|
|
1938
|
+
}
|
|
1939
|
+
)
|
|
1940
|
+
] }) : a ? /* @__PURE__ */ g("div", { className: "trust-sign-form", children: [
|
|
1941
|
+
/* @__PURE__ */ s(
|
|
1942
|
+
"input",
|
|
1943
|
+
{
|
|
1944
|
+
className: "trust-sign-input",
|
|
1945
|
+
placeholder: "Your name",
|
|
1946
|
+
value: i,
|
|
1947
|
+
autoFocus: !0,
|
|
1948
|
+
onChange: (x) => m(x.target.value),
|
|
1949
|
+
onKeyDown: (x) => {
|
|
1950
|
+
x.key === "Enter" && H(), x.key === "Escape" && d(!1);
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
),
|
|
1954
|
+
/* @__PURE__ */ s(
|
|
1955
|
+
"input",
|
|
1956
|
+
{
|
|
1957
|
+
className: "trust-sign-input",
|
|
1958
|
+
placeholder: "Role (optional, e.g. CEO)",
|
|
1959
|
+
value: u,
|
|
1960
|
+
onChange: (x) => h(x.target.value),
|
|
1961
|
+
onKeyDown: (x) => {
|
|
1962
|
+
x.key === "Enter" && H(), x.key === "Escape" && d(!1);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
),
|
|
1966
|
+
/* @__PURE__ */ g("div", { className: "trust-sign-actions", children: [
|
|
1967
|
+
/* @__PURE__ */ g(
|
|
1968
|
+
"button",
|
|
1969
|
+
{
|
|
1970
|
+
className: "trust-popover__action trust-popover__action--primary",
|
|
1971
|
+
onClick: H,
|
|
1972
|
+
disabled: f || !i.trim(),
|
|
1973
|
+
children: [
|
|
1974
|
+
/* @__PURE__ */ s(Ct, { size: 14 }),
|
|
1975
|
+
" Add signature"
|
|
1976
|
+
]
|
|
1977
|
+
}
|
|
1978
|
+
),
|
|
1979
|
+
/* @__PURE__ */ s(
|
|
1980
|
+
"button",
|
|
1981
|
+
{
|
|
1982
|
+
className: "trust-popover__action",
|
|
1983
|
+
onClick: () => d(!1),
|
|
1984
|
+
children: "Cancel"
|
|
1985
|
+
}
|
|
1986
|
+
)
|
|
1987
|
+
] })
|
|
1988
|
+
] }) : /* @__PURE__ */ g(J, { children: [
|
|
1989
|
+
/* @__PURE__ */ g(
|
|
1990
|
+
"button",
|
|
1991
|
+
{
|
|
1992
|
+
className: "trust-popover__action",
|
|
1993
|
+
onClick: () => d(!0),
|
|
1994
|
+
disabled: f,
|
|
1995
|
+
title: "Add a signature line (does not freeze the document)",
|
|
1996
|
+
children: [
|
|
1997
|
+
/* @__PURE__ */ s(Ct, { size: 14 }),
|
|
1998
|
+
" Sign"
|
|
1999
|
+
]
|
|
2000
|
+
}
|
|
2001
|
+
),
|
|
2002
|
+
/* @__PURE__ */ g(
|
|
2003
|
+
"button",
|
|
2004
|
+
{
|
|
2005
|
+
className: "trust-popover__action trust-popover__action--primary",
|
|
2006
|
+
onClick: () => y(B),
|
|
2007
|
+
disabled: f,
|
|
2008
|
+
title: "Freeze the document with a tamper-evident hash. It becomes read-only until unsealed.",
|
|
2009
|
+
children: [
|
|
2010
|
+
/* @__PURE__ */ s(Yt, { size: 14 }),
|
|
2011
|
+
" Seal (freeze)"
|
|
2012
|
+
]
|
|
2013
|
+
}
|
|
2014
|
+
)
|
|
2015
|
+
] })
|
|
2016
|
+
] })
|
|
2017
|
+
] });
|
|
1729
2018
|
}
|
|
1730
|
-
const
|
|
2019
|
+
const Et = [
|
|
1731
2020
|
{ label: "Normal text", node: "paragraph" },
|
|
1732
2021
|
{ label: "Title", node: "itTitle" },
|
|
1733
2022
|
{ label: "Section", node: "itSection" },
|
|
1734
2023
|
{ label: "Subsection", node: "itSub" },
|
|
1735
2024
|
{ label: "Summary", node: "itSummary" },
|
|
1736
2025
|
{ label: "Quote", node: "itQuote" }
|
|
1737
|
-
],
|
|
2026
|
+
], Nr = /* @__PURE__ */ new Set([
|
|
1738
2027
|
"history",
|
|
1739
2028
|
"revision",
|
|
1740
2029
|
"track",
|
|
1741
2030
|
"freeze"
|
|
1742
|
-
]),
|
|
2031
|
+
]), Lr = /* @__PURE__ */ new Set([
|
|
1743
2032
|
"agent",
|
|
1744
2033
|
"model",
|
|
1745
2034
|
"meta",
|
|
1746
2035
|
"context",
|
|
1747
2036
|
"history"
|
|
1748
|
-
]),
|
|
2037
|
+
]), Ar = [
|
|
1749
2038
|
"identity",
|
|
1750
2039
|
"structure",
|
|
1751
2040
|
"content",
|
|
1752
2041
|
"data",
|
|
1753
2042
|
"trust",
|
|
1754
2043
|
"layout"
|
|
1755
|
-
],
|
|
2044
|
+
], ae = [
|
|
1756
2045
|
{ label: "Default", value: "" },
|
|
1757
2046
|
{ label: "Inter", value: "Inter" },
|
|
1758
2047
|
{ label: "Arial", value: "Arial" },
|
|
@@ -1761,7 +2050,7 @@ const At = [
|
|
|
1761
2050
|
{ label: "Courier New", value: "Courier New" },
|
|
1762
2051
|
{ label: "Verdana", value: "Verdana" },
|
|
1763
2052
|
{ label: "Trebuchet MS", value: "Trebuchet MS" }
|
|
1764
|
-
],
|
|
2053
|
+
], Cr = ["1", "1.15", "1.5", "2", "2.5", "3"], $r = "12px", _r = [
|
|
1765
2054
|
"#000000",
|
|
1766
2055
|
"#434343",
|
|
1767
2056
|
"#666666",
|
|
@@ -1812,7 +2101,7 @@ const At = [
|
|
|
1812
2101
|
"#6fa8dc",
|
|
1813
2102
|
"#8e7cc3",
|
|
1814
2103
|
"#c27ba0"
|
|
1815
|
-
],
|
|
2104
|
+
], Mr = [
|
|
1816
2105
|
"#ffffff",
|
|
1817
2106
|
"#cfe2f3",
|
|
1818
2107
|
"#d9ead3",
|
|
@@ -1824,14 +2113,14 @@ const At = [
|
|
|
1824
2113
|
"#d0e0e3",
|
|
1825
2114
|
"#e6b8af"
|
|
1826
2115
|
];
|
|
1827
|
-
function
|
|
2116
|
+
function E({
|
|
1828
2117
|
onClick: t,
|
|
1829
2118
|
active: e,
|
|
1830
2119
|
disabled: n,
|
|
1831
2120
|
title: r,
|
|
1832
2121
|
children: o
|
|
1833
2122
|
}) {
|
|
1834
|
-
return /* @__PURE__ */
|
|
2123
|
+
return /* @__PURE__ */ s(
|
|
1835
2124
|
"button",
|
|
1836
2125
|
{
|
|
1837
2126
|
className: `docs-tb-btn${e ? " active" : ""}`,
|
|
@@ -1842,12 +2131,12 @@ function $({
|
|
|
1842
2131
|
}
|
|
1843
2132
|
);
|
|
1844
2133
|
}
|
|
1845
|
-
function
|
|
2134
|
+
function et({
|
|
1846
2135
|
label: t,
|
|
1847
2136
|
children: e,
|
|
1848
2137
|
className: n = ""
|
|
1849
2138
|
}) {
|
|
1850
|
-
return /* @__PURE__ */
|
|
2139
|
+
return /* @__PURE__ */ s(
|
|
1851
2140
|
"div",
|
|
1852
2141
|
{
|
|
1853
2142
|
className: `ribbon-group ${n}`.trim(),
|
|
@@ -1857,283 +2146,317 @@ function dt({
|
|
|
1857
2146
|
}
|
|
1858
2147
|
);
|
|
1859
2148
|
}
|
|
1860
|
-
function
|
|
1861
|
-
return /* @__PURE__ */
|
|
2149
|
+
function lt() {
|
|
2150
|
+
return /* @__PURE__ */ s("div", { className: "ribbon-sep" });
|
|
1862
2151
|
}
|
|
1863
|
-
function
|
|
2152
|
+
function Er({
|
|
1864
2153
|
editor: t,
|
|
1865
2154
|
isRtl: e = !1,
|
|
1866
2155
|
onToggleRtl: n,
|
|
1867
2156
|
content: r,
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
2157
|
+
onChange: o,
|
|
2158
|
+
theme: c,
|
|
2159
|
+
onThemeChange: a,
|
|
2160
|
+
onTrustAction: d,
|
|
2161
|
+
trust: i,
|
|
2162
|
+
sealIntact: m = null,
|
|
2163
|
+
locked: u = !1
|
|
1872
2164
|
}) {
|
|
1873
|
-
const [
|
|
1874
|
-
|
|
1875
|
-
const
|
|
1876
|
-
const
|
|
1877
|
-
|
|
2165
|
+
const [h, f] = z(!1), [b, S] = z(!1), [T, y] = z(!1), [v, H] = z(!1), [B, j] = z(!1), [P, I] = z(!1), [X, C] = z(!1), R = U(null), V = U(null), x = U(null), _ = U(null), G = U(null), st = U(null);
|
|
2166
|
+
W(() => {
|
|
2167
|
+
const p = (A) => {
|
|
2168
|
+
const N = A.target;
|
|
2169
|
+
R.current && !R.current.contains(N) && f(!1), V.current && !V.current.contains(N) && S(!1), x.current && !x.current.contains(N) && y(!1), _.current && !_.current.contains(N) && H(!1), G.current && !G.current.contains(N) && j(!1), st.current && !st.current.contains(N) && I(!1);
|
|
1878
2170
|
};
|
|
1879
|
-
return document.addEventListener("mousedown",
|
|
2171
|
+
return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
|
|
1880
2172
|
}, []);
|
|
1881
|
-
const
|
|
1882
|
-
f(!1),
|
|
1883
|
-
},
|
|
2173
|
+
const D = () => {
|
|
2174
|
+
f(!1), S(!1), y(!1), H(!1), j(!1), I(!1);
|
|
2175
|
+
}, ut = M(() => {
|
|
1884
2176
|
if (!t) return "Normal text";
|
|
1885
|
-
for (const
|
|
1886
|
-
if (
|
|
1887
|
-
if (!
|
|
1888
|
-
(
|
|
1889
|
-
)) return
|
|
1890
|
-
} else if (t.isActive(
|
|
1891
|
-
return
|
|
2177
|
+
for (const p of Et)
|
|
2178
|
+
if (p.node === "paragraph" && t.isActive("paragraph")) {
|
|
2179
|
+
if (!Et.some(
|
|
2180
|
+
(N) => N.node !== "paragraph" && t.isActive(N.node)
|
|
2181
|
+
)) return p.label;
|
|
2182
|
+
} else if (t.isActive(p.node))
|
|
2183
|
+
return p.label;
|
|
1892
2184
|
return "Normal text";
|
|
1893
|
-
}, [t]),
|
|
2185
|
+
}, [t]), ht = M(() => {
|
|
1894
2186
|
if (!t) return "Default";
|
|
1895
|
-
const
|
|
1896
|
-
if (!
|
|
1897
|
-
const
|
|
1898
|
-
return
|
|
1899
|
-
}, [t]), [
|
|
1900
|
-
const
|
|
1901
|
-
for (const
|
|
1902
|
-
if (
|
|
1903
|
-
const
|
|
1904
|
-
|
|
1905
|
-
label:
|
|
1906
|
-
keyword:
|
|
1907
|
-
category:
|
|
1908
|
-
description:
|
|
1909
|
-
isReadOnly:
|
|
1910
|
-
}),
|
|
2187
|
+
const p = t.getAttributes("textStyle")?.fontFamily;
|
|
2188
|
+
if (!p) return "Default";
|
|
2189
|
+
const A = ae.find((N) => N.value === p);
|
|
2190
|
+
return A ? A.label : "Default";
|
|
2191
|
+
}, [t]), [it, k] = z(11), [, w] = z(0), L = Q(() => {
|
|
2192
|
+
const p = /* @__PURE__ */ new Map();
|
|
2193
|
+
for (const N of Je) {
|
|
2194
|
+
if (N.status !== "stable" || Lr.has(N.canonical) || N.category === "agent") continue;
|
|
2195
|
+
const at = N.category, wt = p.get(at) || [];
|
|
2196
|
+
wt.push({
|
|
2197
|
+
label: N.canonical,
|
|
2198
|
+
keyword: N.canonical,
|
|
2199
|
+
category: at,
|
|
2200
|
+
description: N.description,
|
|
2201
|
+
isReadOnly: Nr.has(N.canonical)
|
|
2202
|
+
}), p.set(at, wt);
|
|
1911
2203
|
}
|
|
1912
|
-
const
|
|
1913
|
-
for (const
|
|
1914
|
-
const
|
|
1915
|
-
!
|
|
1916
|
-
category:
|
|
1917
|
-
items:
|
|
2204
|
+
const A = [];
|
|
2205
|
+
for (const N of Ar) {
|
|
2206
|
+
const at = p.get(N);
|
|
2207
|
+
!at || at.length === 0 || (at.sort((wt, _e) => wt.keyword.localeCompare(_e.keyword)), A.push({
|
|
2208
|
+
category: re[N]?.label || N,
|
|
2209
|
+
items: at
|
|
1918
2210
|
}));
|
|
1919
2211
|
}
|
|
1920
|
-
return
|
|
2212
|
+
return A;
|
|
1921
2213
|
}, []);
|
|
1922
|
-
|
|
2214
|
+
W(() => {
|
|
1923
2215
|
if (!t) return;
|
|
1924
|
-
const
|
|
1925
|
-
const
|
|
1926
|
-
if (
|
|
1927
|
-
const
|
|
1928
|
-
isNaN(
|
|
2216
|
+
const p = () => {
|
|
2217
|
+
const A = t.getAttributes("textStyle");
|
|
2218
|
+
if (A?.fontSize) {
|
|
2219
|
+
const N = parseInt(A.fontSize, 10);
|
|
2220
|
+
isNaN(N) || k(N);
|
|
1929
2221
|
}
|
|
1930
|
-
|
|
2222
|
+
w((N) => N + 1);
|
|
1931
2223
|
};
|
|
1932
|
-
return t.on("selectionUpdate",
|
|
1933
|
-
t.off("selectionUpdate",
|
|
2224
|
+
return t.on("selectionUpdate", p), t.on("transaction", p), () => {
|
|
2225
|
+
t.off("selectionUpdate", p), t.off("transaction", p);
|
|
1934
2226
|
};
|
|
1935
2227
|
}, [t]);
|
|
1936
|
-
const
|
|
1937
|
-
(
|
|
1938
|
-
t && (
|
|
2228
|
+
const Z = M(
|
|
2229
|
+
(p) => {
|
|
2230
|
+
t && (p === "paragraph" ? t.chain().focus().setParagraph().run() : p === "itQuote" ? t.chain().focus().setNode("itQuote").run() : t.chain().focus().setNode(p).run(), D());
|
|
1939
2231
|
},
|
|
1940
2232
|
[t]
|
|
1941
|
-
),
|
|
1942
|
-
(
|
|
2233
|
+
), tt = M(
|
|
2234
|
+
(p) => {
|
|
1943
2235
|
if (!t) return;
|
|
1944
|
-
const
|
|
1945
|
-
|
|
2236
|
+
const A = t.chain().focus();
|
|
2237
|
+
p === "divider" ? A.setNode("itDivider").run() : p === "break" ? A.setNode("itBreak").run() : p === "code" ? A.setNode("itCode", { lang: "" }).run() : ["tip", "info", "warning", "danger", "success"].includes(p) ? A.setNode("itCallout", { variant: p }).run() : A.setNode("itGenericBlock", { keyword: p, properties: "" }).run(), D();
|
|
1946
2238
|
},
|
|
1947
2239
|
[t]
|
|
1948
|
-
),
|
|
1949
|
-
(
|
|
1950
|
-
const
|
|
1951
|
-
|
|
2240
|
+
), K = M(
|
|
2241
|
+
(p) => {
|
|
2242
|
+
const A = Math.min(96, Math.max(8, it + p));
|
|
2243
|
+
k(A), t?.chain().focus().setFontSize(`${A}pt`).run();
|
|
1952
2244
|
},
|
|
1953
|
-
[t,
|
|
1954
|
-
),
|
|
1955
|
-
(
|
|
1956
|
-
t?.chain().focus().setBlockProp("leading",
|
|
2245
|
+
[t, it]
|
|
2246
|
+
), kt = M(
|
|
2247
|
+
(p) => {
|
|
2248
|
+
t?.chain().focus().setBlockProp("leading", p).run(), D();
|
|
1957
2249
|
},
|
|
1958
2250
|
[t]
|
|
1959
|
-
),
|
|
1960
|
-
(
|
|
2251
|
+
), St = M(
|
|
2252
|
+
(p) => {
|
|
1961
2253
|
if (!t) return;
|
|
1962
|
-
const
|
|
1963
|
-
t.chain().focus().setBlockProp(
|
|
2254
|
+
const A = ct(t, p);
|
|
2255
|
+
t.chain().focus().setBlockProp(p, A ? null : $r).run(), D();
|
|
1964
2256
|
},
|
|
1965
2257
|
[t]
|
|
1966
|
-
),
|
|
2258
|
+
), Lt = M(() => {
|
|
1967
2259
|
if (!t) return;
|
|
1968
|
-
const
|
|
2260
|
+
const p = window.prompt(
|
|
1969
2261
|
"Space before block (e.g. 12px, 1em — empty for none):",
|
|
1970
|
-
|
|
2262
|
+
ct(t, "space-before") || ""
|
|
1971
2263
|
);
|
|
1972
|
-
if (
|
|
1973
|
-
const
|
|
2264
|
+
if (p === null) return;
|
|
2265
|
+
const A = window.prompt(
|
|
1974
2266
|
"Space after block (e.g. 12px, 1em — empty for none):",
|
|
1975
|
-
|
|
2267
|
+
ct(t, "space-after") || ""
|
|
1976
2268
|
);
|
|
1977
|
-
|
|
1978
|
-
}, [t]),
|
|
2269
|
+
A !== null && (t.chain().focus().setBlockProp("space-before", p.trim() || null).setBlockProp("space-after", A.trim() || null).run(), D());
|
|
2270
|
+
}, [t]), xe = M(() => {
|
|
1979
2271
|
if (!t) return;
|
|
1980
|
-
const
|
|
2272
|
+
const p = ct(t, "end"), A = window.prompt(
|
|
1981
2273
|
"Line-end text (shown at the end of the line — empty to remove):",
|
|
1982
|
-
|
|
2274
|
+
p || ""
|
|
1983
2275
|
);
|
|
1984
|
-
|
|
1985
|
-
}, [t]),
|
|
2276
|
+
A !== null && t.chain().focus().setBlockProp("end", A.trim() || null).run();
|
|
2277
|
+
}, [t]), Ne = M(() => {
|
|
1986
2278
|
t && (t.chain().focus().insertContent({
|
|
1987
2279
|
type: "paragraph",
|
|
1988
2280
|
attrs: { end: "End text" },
|
|
1989
2281
|
content: [{ type: "text", text: "Start text" }]
|
|
1990
|
-
}).run(),
|
|
1991
|
-
}, [t]),
|
|
1992
|
-
() =>
|
|
1993
|
-
[r,
|
|
1994
|
-
),
|
|
1995
|
-
() => cr(r, o, mt),
|
|
1996
|
-
[r, o, mt]
|
|
1997
|
-
);
|
|
2282
|
+
}).run(), D());
|
|
2283
|
+
}, [t]), Le = Q(() => Tr(), []), Ut = X ? "minimal-ink" : "normal", Ae = M(
|
|
2284
|
+
() => we(r, c, Ut),
|
|
2285
|
+
[r, c, Ut]
|
|
2286
|
+
), Ce = M(() => wr(r), [r]);
|
|
1998
2287
|
if (!t) return null;
|
|
1999
|
-
const
|
|
2000
|
-
return /* @__PURE__ */
|
|
2001
|
-
/* @__PURE__ */
|
|
2002
|
-
/* @__PURE__ */
|
|
2003
|
-
|
|
2288
|
+
const At = ct(t, "leading"), $e = !!ct(t, "end");
|
|
2289
|
+
return /* @__PURE__ */ g("div", { className: "docs-toolbar docs-ribbon", children: [
|
|
2290
|
+
/* @__PURE__ */ g(et, { label: "Edit", children: [
|
|
2291
|
+
/* @__PURE__ */ s(
|
|
2292
|
+
E,
|
|
2004
2293
|
{
|
|
2005
2294
|
onClick: () => t.chain().focus().undo().run(),
|
|
2006
|
-
disabled:
|
|
2295
|
+
disabled: u || !t.can().undo(),
|
|
2007
2296
|
title: "Undo (⌘Z)",
|
|
2008
|
-
children: /* @__PURE__ */
|
|
2297
|
+
children: /* @__PURE__ */ s(rn, { size: 16 })
|
|
2009
2298
|
}
|
|
2010
2299
|
),
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
|
|
2300
|
+
/* @__PURE__ */ s(
|
|
2301
|
+
E,
|
|
2013
2302
|
{
|
|
2014
2303
|
onClick: () => t.chain().focus().redo().run(),
|
|
2015
|
-
disabled:
|
|
2304
|
+
disabled: u || !t.can().redo(),
|
|
2016
2305
|
title: "Redo (⌘⇧Z)",
|
|
2017
|
-
children: /* @__PURE__ */
|
|
2306
|
+
children: /* @__PURE__ */ s(on, { size: 16 })
|
|
2018
2307
|
}
|
|
2019
2308
|
)
|
|
2020
2309
|
] }),
|
|
2021
|
-
/* @__PURE__ */
|
|
2022
|
-
/* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2025
|
-
/* @__PURE__ */
|
|
2310
|
+
/* @__PURE__ */ s(lt, {}),
|
|
2311
|
+
/* @__PURE__ */ g(et, { label: "File", children: [
|
|
2312
|
+
/* @__PURE__ */ g(E, { onClick: Ce, title: "Save / Download the .it file", children: [
|
|
2313
|
+
/* @__PURE__ */ s(sn, { size: 16 }),
|
|
2314
|
+
/* @__PURE__ */ s("span", { className: "ribbon-btn-text", children: "Save" })
|
|
2026
2315
|
] }),
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2316
|
+
/* @__PURE__ */ g(E, { onClick: Ae, title: "Export PDF (⌘P) — WYSIWYG", children: [
|
|
2317
|
+
/* @__PURE__ */ s(an, { size: 16 }),
|
|
2318
|
+
/* @__PURE__ */ s("span", { className: "ribbon-btn-text", children: "PDF" })
|
|
2030
2319
|
] }),
|
|
2031
|
-
/* @__PURE__ */
|
|
2032
|
-
|
|
2320
|
+
/* @__PURE__ */ s(
|
|
2321
|
+
E,
|
|
2033
2322
|
{
|
|
2034
|
-
onClick: () =>
|
|
2035
|
-
active:
|
|
2323
|
+
onClick: () => C((p) => !p),
|
|
2324
|
+
active: X,
|
|
2036
2325
|
title: "Minimal ink mode (plain callouts when printing)",
|
|
2037
|
-
children: /* @__PURE__ */
|
|
2326
|
+
children: /* @__PURE__ */ s(cn, { size: 16 })
|
|
2038
2327
|
}
|
|
2039
2328
|
),
|
|
2040
|
-
/* @__PURE__ */
|
|
2329
|
+
/* @__PURE__ */ s(
|
|
2041
2330
|
"select",
|
|
2042
2331
|
{
|
|
2043
2332
|
className: "ribbon-theme-select",
|
|
2044
|
-
value:
|
|
2045
|
-
onChange: (
|
|
2046
|
-
title: "Document theme (used
|
|
2047
|
-
children:
|
|
2333
|
+
value: c,
|
|
2334
|
+
onChange: (p) => a(p.target.value),
|
|
2335
|
+
title: "Document theme (used everywhere — canvas, print, export)",
|
|
2336
|
+
children: Le.map((p) => /* @__PURE__ */ s("option", { value: p, children: p.charAt(0).toUpperCase() + p.slice(1) }, p))
|
|
2048
2337
|
}
|
|
2049
2338
|
)
|
|
2050
2339
|
] }),
|
|
2051
|
-
/* @__PURE__ */
|
|
2052
|
-
/* @__PURE__ */
|
|
2053
|
-
/* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
|
|
2340
|
+
/* @__PURE__ */ s(lt, {}),
|
|
2341
|
+
/* @__PURE__ */ g("div", { className: u ? "ribbon-locked" : "ribbon-editing", children: [
|
|
2342
|
+
/* @__PURE__ */ s(et, { label: "Style", children: /* @__PURE__ */ g("div", { className: "docs-tb-dropdown", ref: R, children: [
|
|
2343
|
+
/* @__PURE__ */ g(
|
|
2344
|
+
"button",
|
|
2345
|
+
{
|
|
2346
|
+
className: "docs-tb-select docs-tb-paragraph-select",
|
|
2347
|
+
onClick: () => {
|
|
2348
|
+
D(), f(!h);
|
|
2349
|
+
},
|
|
2350
|
+
children: [
|
|
2351
|
+
/* @__PURE__ */ s("span", { className: "docs-tb-select-label", children: ut() }),
|
|
2352
|
+
/* @__PURE__ */ s(yt, { size: 14 })
|
|
2353
|
+
]
|
|
2354
|
+
}
|
|
2355
|
+
),
|
|
2356
|
+
h && /* @__PURE__ */ s("div", { className: "docs-tb-dropdown-menu docs-style-menu", children: Et.map((p) => /* @__PURE__ */ s(
|
|
2357
|
+
"button",
|
|
2358
|
+
{
|
|
2359
|
+
className: `docs-tb-dropdown-item${ut() === p.label ? " active" : ""}`,
|
|
2360
|
+
onClick: () => Z(p.node),
|
|
2361
|
+
children: /* @__PURE__ */ s(
|
|
2362
|
+
"span",
|
|
2363
|
+
{
|
|
2364
|
+
className: `docs-style-preview docs-style-${p.node}`,
|
|
2365
|
+
children: p.label
|
|
2366
|
+
}
|
|
2367
|
+
)
|
|
2368
|
+
},
|
|
2369
|
+
p.node
|
|
2370
|
+
)) })
|
|
2371
|
+
] }) }),
|
|
2372
|
+
/* @__PURE__ */ s(lt, {}),
|
|
2373
|
+
/* @__PURE__ */ g(et, { label: "Font", children: [
|
|
2374
|
+
/* @__PURE__ */ g("div", { className: "docs-tb-dropdown", ref: x, children: [
|
|
2375
|
+
/* @__PURE__ */ g(
|
|
2056
2376
|
"button",
|
|
2057
2377
|
{
|
|
2058
2378
|
className: "docs-tb-select docs-tb-font-select",
|
|
2059
2379
|
onClick: () => {
|
|
2060
|
-
|
|
2380
|
+
D(), y(!T);
|
|
2061
2381
|
},
|
|
2062
2382
|
children: [
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
/* @__PURE__ */
|
|
2383
|
+
/* @__PURE__ */ s("span", { className: "docs-tb-select-label", children: ht() }),
|
|
2384
|
+
/* @__PURE__ */ s(yt, { size: 14 })
|
|
2065
2385
|
]
|
|
2066
2386
|
}
|
|
2067
2387
|
),
|
|
2068
|
-
|
|
2388
|
+
T && /* @__PURE__ */ s("div", { className: "docs-tb-dropdown-menu docs-font-menu", children: ae.map((p) => /* @__PURE__ */ s(
|
|
2069
2389
|
"button",
|
|
2070
2390
|
{
|
|
2071
|
-
className: `docs-tb-dropdown-item${
|
|
2072
|
-
style: { fontFamily:
|
|
2391
|
+
className: `docs-tb-dropdown-item${ht() === p.label ? " active" : ""}`,
|
|
2392
|
+
style: { fontFamily: p.value || "inherit" },
|
|
2073
2393
|
onClick: () => {
|
|
2074
|
-
|
|
2394
|
+
p.value ? t.chain().focus().setFontFamily(p.value).run() : t.chain().focus().unsetFontFamily().run(), D();
|
|
2075
2395
|
},
|
|
2076
|
-
children:
|
|
2396
|
+
children: p.label
|
|
2077
2397
|
},
|
|
2078
|
-
|
|
2398
|
+
p.value || "default"
|
|
2079
2399
|
)) })
|
|
2080
2400
|
] }),
|
|
2081
|
-
/* @__PURE__ */
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2084
|
-
|
|
2085
|
-
|
|
2401
|
+
/* @__PURE__ */ s(E, { onClick: () => K(-1), title: "Decrease font size", children: /* @__PURE__ */ s(ln, { size: 14 }) }),
|
|
2402
|
+
/* @__PURE__ */ s("span", { className: "docs-tb-fontsize", children: it }),
|
|
2403
|
+
/* @__PURE__ */ s(E, { onClick: () => K(1), title: "Increase font size", children: /* @__PURE__ */ s(Kt, { size: 14 }) })
|
|
2404
|
+
] }),
|
|
2405
|
+
/* @__PURE__ */ s(lt, {}),
|
|
2406
|
+
/* @__PURE__ */ g(et, { label: "Text", children: [
|
|
2407
|
+
/* @__PURE__ */ s(
|
|
2408
|
+
E,
|
|
2086
2409
|
{
|
|
2087
2410
|
onClick: () => t.chain().focus().toggleBold().run(),
|
|
2088
2411
|
active: t.isActive("bold"),
|
|
2089
2412
|
title: "Bold (⌘B)",
|
|
2090
|
-
children: /* @__PURE__ */
|
|
2413
|
+
children: /* @__PURE__ */ s(dn, { size: 16 })
|
|
2091
2414
|
}
|
|
2092
2415
|
),
|
|
2093
|
-
/* @__PURE__ */
|
|
2094
|
-
|
|
2416
|
+
/* @__PURE__ */ s(
|
|
2417
|
+
E,
|
|
2095
2418
|
{
|
|
2096
2419
|
onClick: () => t.chain().focus().toggleItalic().run(),
|
|
2097
2420
|
active: t.isActive("italic"),
|
|
2098
2421
|
title: "Italic (⌘I)",
|
|
2099
|
-
children: /* @__PURE__ */
|
|
2422
|
+
children: /* @__PURE__ */ s(un, { size: 16 })
|
|
2100
2423
|
}
|
|
2101
2424
|
),
|
|
2102
|
-
/* @__PURE__ */
|
|
2103
|
-
|
|
2425
|
+
/* @__PURE__ */ s(
|
|
2426
|
+
E,
|
|
2104
2427
|
{
|
|
2105
2428
|
onClick: () => t.chain().focus().toggleUnderline().run(),
|
|
2106
2429
|
active: t.isActive("underline"),
|
|
2107
2430
|
title: "Underline (⌘U)",
|
|
2108
|
-
children: /* @__PURE__ */
|
|
2431
|
+
children: /* @__PURE__ */ s(pn, { size: 16 })
|
|
2109
2432
|
}
|
|
2110
2433
|
),
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
|
|
2434
|
+
/* @__PURE__ */ s(
|
|
2435
|
+
E,
|
|
2113
2436
|
{
|
|
2114
2437
|
onClick: () => t.chain().focus().toggleStrike().run(),
|
|
2115
2438
|
active: t.isActive("strike"),
|
|
2116
2439
|
title: "Strikethrough (⌘⇧X)",
|
|
2117
|
-
children: /* @__PURE__ */
|
|
2440
|
+
children: /* @__PURE__ */ s(fn, { size: 16 })
|
|
2118
2441
|
}
|
|
2119
2442
|
),
|
|
2120
|
-
/* @__PURE__ */
|
|
2443
|
+
/* @__PURE__ */ g(
|
|
2121
2444
|
"div",
|
|
2122
2445
|
{
|
|
2123
2446
|
className: "docs-tb-dropdown docs-tb-color-dropdown",
|
|
2124
|
-
ref:
|
|
2447
|
+
ref: _,
|
|
2125
2448
|
children: [
|
|
2126
|
-
/* @__PURE__ */
|
|
2449
|
+
/* @__PURE__ */ g(
|
|
2127
2450
|
"button",
|
|
2128
2451
|
{
|
|
2129
2452
|
className: "docs-tb-btn docs-tb-color-btn",
|
|
2130
2453
|
onClick: () => {
|
|
2131
|
-
|
|
2454
|
+
D(), H(!v);
|
|
2132
2455
|
},
|
|
2133
2456
|
title: "Text color",
|
|
2134
2457
|
children: [
|
|
2135
|
-
/* @__PURE__ */
|
|
2136
|
-
/* @__PURE__ */
|
|
2458
|
+
/* @__PURE__ */ s(gn, { size: 16 }),
|
|
2459
|
+
/* @__PURE__ */ s(
|
|
2137
2460
|
"span",
|
|
2138
2461
|
{
|
|
2139
2462
|
className: "docs-tb-color-indicator",
|
|
@@ -2145,29 +2468,29 @@ function br({
|
|
|
2145
2468
|
]
|
|
2146
2469
|
}
|
|
2147
2470
|
),
|
|
2148
|
-
|
|
2149
|
-
/* @__PURE__ */
|
|
2150
|
-
/* @__PURE__ */
|
|
2471
|
+
v && /* @__PURE__ */ g("div", { className: "docs-tb-dropdown-menu docs-color-grid-menu", children: [
|
|
2472
|
+
/* @__PURE__ */ s("div", { className: "docs-color-grid-label", children: "Text color" }),
|
|
2473
|
+
/* @__PURE__ */ s("div", { className: "docs-color-grid", children: _r.map((p) => /* @__PURE__ */ s(
|
|
2151
2474
|
"button",
|
|
2152
2475
|
{
|
|
2153
2476
|
className: "docs-color-swatch",
|
|
2154
|
-
style: { background:
|
|
2155
|
-
title:
|
|
2477
|
+
style: { background: p },
|
|
2478
|
+
title: p,
|
|
2156
2479
|
onClick: () => {
|
|
2157
|
-
t.chain().focus().setColor(
|
|
2480
|
+
t.chain().focus().setColor(p).run(), D();
|
|
2158
2481
|
}
|
|
2159
2482
|
},
|
|
2160
|
-
|
|
2483
|
+
p
|
|
2161
2484
|
)) }),
|
|
2162
|
-
/* @__PURE__ */
|
|
2485
|
+
/* @__PURE__ */ g(
|
|
2163
2486
|
"button",
|
|
2164
2487
|
{
|
|
2165
2488
|
className: "docs-tb-dropdown-item",
|
|
2166
2489
|
onClick: () => {
|
|
2167
|
-
t.chain().focus().unsetColor().run(),
|
|
2490
|
+
t.chain().focus().unsetColor().run(), D();
|
|
2168
2491
|
},
|
|
2169
2492
|
children: [
|
|
2170
|
-
/* @__PURE__ */
|
|
2493
|
+
/* @__PURE__ */ s(qt, { size: 14 }),
|
|
2171
2494
|
" Reset"
|
|
2172
2495
|
]
|
|
2173
2496
|
}
|
|
@@ -2176,23 +2499,23 @@ function br({
|
|
|
2176
2499
|
]
|
|
2177
2500
|
}
|
|
2178
2501
|
),
|
|
2179
|
-
/* @__PURE__ */
|
|
2502
|
+
/* @__PURE__ */ g(
|
|
2180
2503
|
"div",
|
|
2181
2504
|
{
|
|
2182
2505
|
className: "docs-tb-dropdown docs-tb-color-dropdown",
|
|
2183
|
-
ref:
|
|
2506
|
+
ref: G,
|
|
2184
2507
|
children: [
|
|
2185
|
-
/* @__PURE__ */
|
|
2508
|
+
/* @__PURE__ */ g(
|
|
2186
2509
|
"button",
|
|
2187
2510
|
{
|
|
2188
2511
|
className: "docs-tb-btn docs-tb-color-btn",
|
|
2189
2512
|
onClick: () => {
|
|
2190
|
-
|
|
2513
|
+
D(), j(!B);
|
|
2191
2514
|
},
|
|
2192
2515
|
title: "Highlight color",
|
|
2193
2516
|
children: [
|
|
2194
|
-
/* @__PURE__ */
|
|
2195
|
-
/* @__PURE__ */
|
|
2517
|
+
/* @__PURE__ */ s(hn, { size: 16 }),
|
|
2518
|
+
/* @__PURE__ */ s(
|
|
2196
2519
|
"span",
|
|
2197
2520
|
{
|
|
2198
2521
|
className: "docs-tb-color-indicator",
|
|
@@ -2204,117 +2527,87 @@ function br({
|
|
|
2204
2527
|
]
|
|
2205
2528
|
}
|
|
2206
2529
|
),
|
|
2207
|
-
|
|
2208
|
-
/* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2530
|
+
B && /* @__PURE__ */ g("div", { className: "docs-tb-dropdown-menu docs-color-grid-menu", children: [
|
|
2531
|
+
/* @__PURE__ */ s("div", { className: "docs-color-grid-label", children: "Highlight color" }),
|
|
2532
|
+
/* @__PURE__ */ s("div", { className: "docs-color-grid docs-highlight-grid", children: Mr.map((p) => /* @__PURE__ */ s(
|
|
2210
2533
|
"button",
|
|
2211
2534
|
{
|
|
2212
2535
|
className: "docs-color-swatch",
|
|
2213
|
-
style: { background:
|
|
2214
|
-
title:
|
|
2536
|
+
style: { background: p },
|
|
2537
|
+
title: p,
|
|
2215
2538
|
onClick: () => {
|
|
2216
|
-
|
|
2539
|
+
p === "#ffffff" ? t.chain().focus().unsetHighlight().run() : t.chain().focus().toggleHighlight({ color: p }).run(), D();
|
|
2217
2540
|
}
|
|
2218
2541
|
},
|
|
2219
|
-
|
|
2542
|
+
p
|
|
2220
2543
|
)) })
|
|
2221
2544
|
] })
|
|
2222
2545
|
]
|
|
2223
2546
|
}
|
|
2224
2547
|
),
|
|
2225
|
-
/* @__PURE__ */
|
|
2226
|
-
|
|
2548
|
+
/* @__PURE__ */ s(
|
|
2549
|
+
E,
|
|
2227
2550
|
{
|
|
2228
2551
|
onClick: () => t.chain().focus().toggleCode().run(),
|
|
2229
2552
|
active: t.isActive("code"),
|
|
2230
2553
|
title: "Inline code",
|
|
2231
|
-
children: /* @__PURE__ */
|
|
2554
|
+
children: /* @__PURE__ */ s(mn, { size: 16 })
|
|
2232
2555
|
}
|
|
2233
2556
|
),
|
|
2234
|
-
/* @__PURE__ */
|
|
2235
|
-
|
|
2557
|
+
/* @__PURE__ */ s(
|
|
2558
|
+
E,
|
|
2236
2559
|
{
|
|
2237
2560
|
onClick: () => t.chain().focus().unsetAllMarks().clearNodes().run(),
|
|
2238
2561
|
title: "Clear formatting",
|
|
2239
|
-
children: /* @__PURE__ */
|
|
2562
|
+
children: /* @__PURE__ */ s(qt, { size: 16 })
|
|
2240
2563
|
}
|
|
2241
2564
|
)
|
|
2242
2565
|
] }),
|
|
2243
|
-
/* @__PURE__ */
|
|
2244
|
-
/* @__PURE__ */
|
|
2245
|
-
/* @__PURE__ */
|
|
2246
|
-
|
|
2247
|
-
"button",
|
|
2248
|
-
{
|
|
2249
|
-
className: "docs-tb-select docs-tb-paragraph-select",
|
|
2250
|
-
onClick: () => {
|
|
2251
|
-
L(), f(!s);
|
|
2252
|
-
},
|
|
2253
|
-
children: [
|
|
2254
|
-
/* @__PURE__ */ a("span", { className: "docs-tb-select-label", children: st() }),
|
|
2255
|
-
/* @__PURE__ */ a(yt, { size: 14 })
|
|
2256
|
-
]
|
|
2257
|
-
}
|
|
2258
|
-
),
|
|
2259
|
-
s && /* @__PURE__ */ a("div", { className: "docs-tb-dropdown-menu docs-style-menu", children: At.map((u) => /* @__PURE__ */ a(
|
|
2260
|
-
"button",
|
|
2261
|
-
{
|
|
2262
|
-
className: `docs-tb-dropdown-item${st() === u.label ? " active" : ""}`,
|
|
2263
|
-
onClick: () => y(u.node),
|
|
2264
|
-
children: /* @__PURE__ */ a(
|
|
2265
|
-
"span",
|
|
2266
|
-
{
|
|
2267
|
-
className: `docs-style-preview docs-style-${u.node}`,
|
|
2268
|
-
children: u.label
|
|
2269
|
-
}
|
|
2270
|
-
)
|
|
2271
|
-
},
|
|
2272
|
-
u.node
|
|
2273
|
-
)) })
|
|
2274
|
-
] }),
|
|
2275
|
-
/* @__PURE__ */ a(
|
|
2276
|
-
$,
|
|
2566
|
+
/* @__PURE__ */ s(lt, {}),
|
|
2567
|
+
/* @__PURE__ */ g(et, { label: "Paragraph", children: [
|
|
2568
|
+
/* @__PURE__ */ s(
|
|
2569
|
+
E,
|
|
2277
2570
|
{
|
|
2278
2571
|
onClick: () => t.chain().focus().setTextAlign("left").run(),
|
|
2279
2572
|
active: t.isActive({ textAlign: "left" }),
|
|
2280
2573
|
title: "Align left",
|
|
2281
|
-
children: /* @__PURE__ */
|
|
2574
|
+
children: /* @__PURE__ */ s(bn, { size: 16 })
|
|
2282
2575
|
}
|
|
2283
2576
|
),
|
|
2284
|
-
/* @__PURE__ */
|
|
2285
|
-
|
|
2577
|
+
/* @__PURE__ */ s(
|
|
2578
|
+
E,
|
|
2286
2579
|
{
|
|
2287
2580
|
onClick: () => t.chain().focus().setTextAlign("center").run(),
|
|
2288
2581
|
active: t.isActive({ textAlign: "center" }),
|
|
2289
2582
|
title: "Align center",
|
|
2290
|
-
children: /* @__PURE__ */
|
|
2583
|
+
children: /* @__PURE__ */ s(yn, { size: 16 })
|
|
2291
2584
|
}
|
|
2292
2585
|
),
|
|
2293
|
-
/* @__PURE__ */
|
|
2294
|
-
|
|
2586
|
+
/* @__PURE__ */ s(
|
|
2587
|
+
E,
|
|
2295
2588
|
{
|
|
2296
2589
|
onClick: () => t.chain().focus().setTextAlign("right").run(),
|
|
2297
2590
|
active: t.isActive({ textAlign: "right" }),
|
|
2298
2591
|
title: "Align right",
|
|
2299
|
-
children: /* @__PURE__ */
|
|
2592
|
+
children: /* @__PURE__ */ s(vn, { size: 16 })
|
|
2300
2593
|
}
|
|
2301
2594
|
),
|
|
2302
|
-
/* @__PURE__ */
|
|
2303
|
-
|
|
2595
|
+
/* @__PURE__ */ s(
|
|
2596
|
+
E,
|
|
2304
2597
|
{
|
|
2305
2598
|
onClick: () => t.chain().focus().setTextAlign("justify").run(),
|
|
2306
2599
|
active: t.isActive({ textAlign: "justify" }),
|
|
2307
2600
|
title: "Justify",
|
|
2308
|
-
children: /* @__PURE__ */
|
|
2601
|
+
children: /* @__PURE__ */ s(kn, { size: 16 })
|
|
2309
2602
|
}
|
|
2310
2603
|
),
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
|
|
2604
|
+
/* @__PURE__ */ s(
|
|
2605
|
+
E,
|
|
2313
2606
|
{
|
|
2314
2607
|
onClick: () => n?.(),
|
|
2315
2608
|
active: e,
|
|
2316
2609
|
title: e ? "Switch to LTR (left-to-right)" : "Switch to RTL (right-to-left)",
|
|
2317
|
-
children: /* @__PURE__ */
|
|
2610
|
+
children: /* @__PURE__ */ s(
|
|
2318
2611
|
"span",
|
|
2319
2612
|
{
|
|
2320
2613
|
style: {
|
|
@@ -2328,323 +2621,457 @@ function br({
|
|
|
2328
2621
|
)
|
|
2329
2622
|
}
|
|
2330
2623
|
),
|
|
2331
|
-
/* @__PURE__ */
|
|
2332
|
-
/* @__PURE__ */
|
|
2624
|
+
/* @__PURE__ */ g("div", { className: "docs-tb-dropdown", ref: st, children: [
|
|
2625
|
+
/* @__PURE__ */ g(
|
|
2333
2626
|
"button",
|
|
2334
2627
|
{
|
|
2335
|
-
className: `docs-tb-btn${
|
|
2628
|
+
className: `docs-tb-btn${At ? " active" : ""}`,
|
|
2336
2629
|
onClick: () => {
|
|
2337
|
-
|
|
2630
|
+
D(), I(!P);
|
|
2338
2631
|
},
|
|
2339
2632
|
title: "Line & paragraph spacing",
|
|
2340
2633
|
children: [
|
|
2341
|
-
/* @__PURE__ */
|
|
2342
|
-
/* @__PURE__ */
|
|
2634
|
+
/* @__PURE__ */ s(Sn, { size: 16 }),
|
|
2635
|
+
/* @__PURE__ */ s(yt, { size: 12 })
|
|
2343
2636
|
]
|
|
2344
2637
|
}
|
|
2345
2638
|
),
|
|
2346
|
-
|
|
2347
|
-
/* @__PURE__ */
|
|
2348
|
-
/* @__PURE__ */
|
|
2639
|
+
P && /* @__PURE__ */ g("div", { className: "docs-tb-dropdown-menu docs-spacing-menu", children: [
|
|
2640
|
+
/* @__PURE__ */ s("div", { className: "docs-insert-category", children: "Line spacing" }),
|
|
2641
|
+
/* @__PURE__ */ s(
|
|
2349
2642
|
"button",
|
|
2350
2643
|
{
|
|
2351
|
-
className: `docs-tb-dropdown-item${
|
|
2352
|
-
onClick: () =>
|
|
2644
|
+
className: `docs-tb-dropdown-item${At ? "" : " active"}`,
|
|
2645
|
+
onClick: () => kt(null),
|
|
2353
2646
|
children: "Default"
|
|
2354
2647
|
}
|
|
2355
2648
|
),
|
|
2356
|
-
|
|
2649
|
+
Cr.map((p) => /* @__PURE__ */ s(
|
|
2357
2650
|
"button",
|
|
2358
2651
|
{
|
|
2359
|
-
className: `docs-tb-dropdown-item${
|
|
2360
|
-
onClick: () =>
|
|
2361
|
-
children:
|
|
2652
|
+
className: `docs-tb-dropdown-item${At === p ? " active" : ""}`,
|
|
2653
|
+
onClick: () => kt(p),
|
|
2654
|
+
children: p === "1" ? "Single" : p === "2" ? "Double" : p
|
|
2362
2655
|
},
|
|
2363
|
-
|
|
2656
|
+
p
|
|
2364
2657
|
)),
|
|
2365
|
-
/* @__PURE__ */
|
|
2366
|
-
/* @__PURE__ */
|
|
2367
|
-
/* @__PURE__ */
|
|
2658
|
+
/* @__PURE__ */ s("div", { className: "docs-insert-divider" }),
|
|
2659
|
+
/* @__PURE__ */ s("div", { className: "docs-insert-category", children: "Paragraph spacing" }),
|
|
2660
|
+
/* @__PURE__ */ s(
|
|
2368
2661
|
"button",
|
|
2369
2662
|
{
|
|
2370
2663
|
className: "docs-tb-dropdown-item",
|
|
2371
|
-
onClick: () =>
|
|
2372
|
-
children:
|
|
2664
|
+
onClick: () => St("space-before"),
|
|
2665
|
+
children: ct(t, "space-before") ? "Remove space before block" : "Add space before block"
|
|
2373
2666
|
}
|
|
2374
2667
|
),
|
|
2375
|
-
/* @__PURE__ */
|
|
2668
|
+
/* @__PURE__ */ s(
|
|
2376
2669
|
"button",
|
|
2377
2670
|
{
|
|
2378
2671
|
className: "docs-tb-dropdown-item",
|
|
2379
|
-
onClick: () =>
|
|
2380
|
-
children:
|
|
2672
|
+
onClick: () => St("space-after"),
|
|
2673
|
+
children: ct(t, "space-after") ? "Remove space after block" : "Add space after block"
|
|
2381
2674
|
}
|
|
2382
2675
|
),
|
|
2383
|
-
/* @__PURE__ */
|
|
2676
|
+
/* @__PURE__ */ s(
|
|
2384
2677
|
"button",
|
|
2385
2678
|
{
|
|
2386
2679
|
className: "docs-tb-dropdown-item",
|
|
2387
|
-
onClick:
|
|
2680
|
+
onClick: Lt,
|
|
2388
2681
|
children: "Custom spacing…"
|
|
2389
2682
|
}
|
|
2390
2683
|
)
|
|
2391
2684
|
] })
|
|
2392
2685
|
] }),
|
|
2393
|
-
/* @__PURE__ */
|
|
2394
|
-
|
|
2686
|
+
/* @__PURE__ */ s(
|
|
2687
|
+
E,
|
|
2395
2688
|
{
|
|
2396
2689
|
onClick: () => t.chain().focus().toggleBulletList().run(),
|
|
2397
2690
|
active: t.isActive("bulletList"),
|
|
2398
2691
|
title: "Bullet list",
|
|
2399
|
-
children: /* @__PURE__ */
|
|
2692
|
+
children: /* @__PURE__ */ s(wn, { size: 16 })
|
|
2400
2693
|
}
|
|
2401
2694
|
),
|
|
2402
|
-
/* @__PURE__ */
|
|
2403
|
-
|
|
2695
|
+
/* @__PURE__ */ s(
|
|
2696
|
+
E,
|
|
2404
2697
|
{
|
|
2405
2698
|
onClick: () => t.chain().focus().toggleOrderedList().run(),
|
|
2406
2699
|
active: t.isActive("orderedList"),
|
|
2407
2700
|
title: "Numbered list",
|
|
2408
|
-
children: /* @__PURE__ */
|
|
2701
|
+
children: /* @__PURE__ */ s(Tn, { size: 16 })
|
|
2409
2702
|
}
|
|
2410
2703
|
)
|
|
2411
2704
|
] }),
|
|
2412
|
-
/* @__PURE__ */
|
|
2413
|
-
/* @__PURE__ */
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2705
|
+
/* @__PURE__ */ s(lt, {}),
|
|
2706
|
+
/* @__PURE__ */ g(et, { label: "Insert", children: [
|
|
2707
|
+
/* @__PURE__ */ g("div", { className: "docs-tb-dropdown", ref: V, children: [
|
|
2708
|
+
/* @__PURE__ */ g(
|
|
2416
2709
|
"button",
|
|
2417
2710
|
{
|
|
2418
2711
|
className: "docs-tb-select docs-tb-insert-select",
|
|
2419
2712
|
onClick: () => {
|
|
2420
|
-
|
|
2713
|
+
D(), S(!b);
|
|
2421
2714
|
},
|
|
2422
2715
|
children: [
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2716
|
+
/* @__PURE__ */ s(Kt, { size: 15 }),
|
|
2717
|
+
/* @__PURE__ */ s("span", { children: "Insert" }),
|
|
2718
|
+
/* @__PURE__ */ s(yt, { size: 14 })
|
|
2426
2719
|
]
|
|
2427
2720
|
}
|
|
2428
2721
|
),
|
|
2429
|
-
|
|
2430
|
-
/* @__PURE__ */
|
|
2722
|
+
b && /* @__PURE__ */ g("div", { className: "docs-tb-dropdown-menu docs-insert-menu", children: [
|
|
2723
|
+
/* @__PURE__ */ g(
|
|
2431
2724
|
"button",
|
|
2432
2725
|
{
|
|
2433
2726
|
className: "docs-tb-dropdown-item docs-insert-item",
|
|
2434
|
-
onClick:
|
|
2727
|
+
onClick: Ne,
|
|
2435
2728
|
title: "Two-sided row — content at the line start, value at the line end (text: … | end: …)",
|
|
2436
2729
|
children: [
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ s("span", { className: "docs-insert-icon", children: /* @__PURE__ */ s(Vt, { size: 13 }) }),
|
|
2731
|
+
/* @__PURE__ */ s("span", { className: "docs-insert-label", children: "two-sided row" }),
|
|
2732
|
+
/* @__PURE__ */ s("span", { className: "docs-insert-kw", children: "end:" })
|
|
2440
2733
|
]
|
|
2441
2734
|
}
|
|
2442
2735
|
),
|
|
2443
|
-
/* @__PURE__ */
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
/* @__PURE__ */
|
|
2447
|
-
|
|
2736
|
+
/* @__PURE__ */ s("div", { className: "docs-insert-divider" }),
|
|
2737
|
+
L.map((p, A) => /* @__PURE__ */ g("div", { children: [
|
|
2738
|
+
A > 0 && /* @__PURE__ */ s("div", { className: "docs-insert-divider" }),
|
|
2739
|
+
/* @__PURE__ */ s("div", { className: "docs-insert-category", children: p.category }),
|
|
2740
|
+
p.items.map((N) => /* @__PURE__ */ g(
|
|
2448
2741
|
"button",
|
|
2449
2742
|
{
|
|
2450
2743
|
className: "docs-tb-dropdown-item docs-insert-item",
|
|
2451
|
-
onClick: () =>
|
|
2452
|
-
disabled:
|
|
2453
|
-
title:
|
|
2744
|
+
onClick: () => tt(N.keyword),
|
|
2745
|
+
disabled: N.isReadOnly,
|
|
2746
|
+
title: N.description,
|
|
2454
2747
|
children: [
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2457
|
-
/* @__PURE__ */
|
|
2748
|
+
/* @__PURE__ */ s("span", { className: "docs-insert-icon", children: re[N.category]?.icon || "•" }),
|
|
2749
|
+
/* @__PURE__ */ s("span", { className: "docs-insert-label", children: N.label }),
|
|
2750
|
+
/* @__PURE__ */ s("span", { className: "docs-insert-kw", children: N.isReadOnly ? "locked" : `.${N.keyword}` })
|
|
2458
2751
|
]
|
|
2459
2752
|
},
|
|
2460
|
-
|
|
2753
|
+
N.keyword
|
|
2461
2754
|
))
|
|
2462
|
-
] },
|
|
2755
|
+
] }, p.category))
|
|
2463
2756
|
] })
|
|
2464
2757
|
] }),
|
|
2465
|
-
/* @__PURE__ */
|
|
2466
|
-
|
|
2758
|
+
/* @__PURE__ */ s(
|
|
2759
|
+
E,
|
|
2467
2760
|
{
|
|
2468
|
-
onClick:
|
|
2469
|
-
active:
|
|
2761
|
+
onClick: xe,
|
|
2762
|
+
active: $e,
|
|
2470
2763
|
title: "Two-sided row — set the text shown at the END of this line (end: property)",
|
|
2471
|
-
children: /* @__PURE__ */
|
|
2764
|
+
children: /* @__PURE__ */ s(Vt, { size: 16 })
|
|
2472
2765
|
}
|
|
2473
2766
|
)
|
|
2474
2767
|
] })
|
|
2475
2768
|
] }),
|
|
2476
|
-
|
|
2477
|
-
/* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
$,
|
|
2769
|
+
i && o ? /* @__PURE__ */ g(J, { children: [
|
|
2770
|
+
/* @__PURE__ */ s(lt, {}),
|
|
2771
|
+
/* @__PURE__ */ s(et, { label: "Trust", children: /* @__PURE__ */ s(
|
|
2772
|
+
xr,
|
|
2773
|
+
{
|
|
2774
|
+
content: r,
|
|
2775
|
+
onChange: o,
|
|
2776
|
+
trust: i,
|
|
2777
|
+
intact: m
|
|
2778
|
+
}
|
|
2779
|
+
) })
|
|
2780
|
+
] }) : d && /* @__PURE__ */ g(J, { children: [
|
|
2781
|
+
/* @__PURE__ */ s(lt, {}),
|
|
2782
|
+
/* @__PURE__ */ g(et, { label: "Trust", children: [
|
|
2783
|
+
/* @__PURE__ */ s(
|
|
2784
|
+
E,
|
|
2493
2785
|
{
|
|
2494
|
-
onClick: () =>
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
/* @__PURE__ */ a("span", { className: "ribbon-btn-text", children: "Sign" })
|
|
2499
|
-
]
|
|
2786
|
+
onClick: () => d("seal"),
|
|
2787
|
+
disabled: u,
|
|
2788
|
+
title: "Seal — freeze the document with a tamper-evident hash",
|
|
2789
|
+
children: /* @__PURE__ */ s("span", { className: "ribbon-btn-text", children: "Seal" })
|
|
2500
2790
|
}
|
|
2501
2791
|
),
|
|
2502
|
-
/* @__PURE__ */
|
|
2503
|
-
|
|
2504
|
-
{
|
|
2505
|
-
onClick: () => c("verify"),
|
|
2506
|
-
title: "Verify — check the document hash and signatures",
|
|
2507
|
-
children: [
|
|
2508
|
-
/* @__PURE__ */ a(cn, { size: 16 }),
|
|
2509
|
-
/* @__PURE__ */ a("span", { className: "ribbon-btn-text", children: "Verify" })
|
|
2510
|
-
]
|
|
2511
|
-
}
|
|
2512
|
-
)
|
|
2792
|
+
/* @__PURE__ */ s(E, { onClick: () => d("sign"), title: "Sign", children: /* @__PURE__ */ s("span", { className: "ribbon-btn-text", children: "Sign" }) }),
|
|
2793
|
+
/* @__PURE__ */ s(E, { onClick: () => d("verify"), title: "Verify", children: /* @__PURE__ */ s("span", { className: "ribbon-btn-text", children: "Verify" }) })
|
|
2513
2794
|
] })
|
|
2514
2795
|
] })
|
|
2515
2796
|
] });
|
|
2516
2797
|
}
|
|
2517
|
-
const
|
|
2518
|
-
function
|
|
2519
|
-
const [r, o] =
|
|
2520
|
-
|
|
2521
|
-
const d =
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2798
|
+
const zr = { in: 96, cm: 96 / 2.54 }, Hr = { in: 0.25, cm: 0.5 };
|
|
2799
|
+
function Te(t, e) {
|
|
2800
|
+
const n = zr[e], r = Hr[e], o = [], c = t / n;
|
|
2801
|
+
for (let a = 0; a <= c + 1e-6; a += r) {
|
|
2802
|
+
const d = Math.abs(a - Math.round(a)) < 1e-6;
|
|
2803
|
+
o.push({
|
|
2804
|
+
x: a * n,
|
|
2805
|
+
kind: d ? "major" : "minor",
|
|
2806
|
+
label: d && a > 0 ? String(Math.round(a)) : void 0
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
return o;
|
|
2810
|
+
}
|
|
2811
|
+
function Rr({
|
|
2812
|
+
geometry: t,
|
|
2813
|
+
zoom: e,
|
|
2814
|
+
scrollEl: n,
|
|
2815
|
+
onMargins: r,
|
|
2816
|
+
locked: o = !1
|
|
2817
|
+
}) {
|
|
2818
|
+
const [c, a] = z(0), [d, i] = z(null), m = U(null);
|
|
2819
|
+
W(() => {
|
|
2820
|
+
const S = n.current;
|
|
2821
|
+
if (!S) return;
|
|
2822
|
+
const T = () => a(S.scrollLeft);
|
|
2823
|
+
return T(), S.addEventListener("scroll", T, { passive: !0 }), () => S.removeEventListener("scroll", T);
|
|
2525
2824
|
}, [n]);
|
|
2526
|
-
const
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
return
|
|
2537
|
-
|
|
2538
|
-
|
|
2825
|
+
const u = Q(
|
|
2826
|
+
() => Te(t.width, t.unit),
|
|
2827
|
+
[t.width, t.unit]
|
|
2828
|
+
), h = M(
|
|
2829
|
+
(S) => (T) => {
|
|
2830
|
+
!r || o || (T.preventDefault(), i(S));
|
|
2831
|
+
},
|
|
2832
|
+
[r, o]
|
|
2833
|
+
);
|
|
2834
|
+
W(() => {
|
|
2835
|
+
if (!d || !r) return;
|
|
2836
|
+
const S = (y) => {
|
|
2837
|
+
const v = m.current;
|
|
2838
|
+
if (!v) return;
|
|
2839
|
+
const H = v.getBoundingClientRect(), B = (y.clientX - H.left) / e;
|
|
2840
|
+
if (d === "left") {
|
|
2841
|
+
const j = Math.max(0, Math.min(B, t.width / 2));
|
|
2842
|
+
r({ left: j });
|
|
2843
|
+
} else {
|
|
2844
|
+
const j = Math.max(0, Math.min(t.width - B, t.width / 2));
|
|
2845
|
+
r({ right: j });
|
|
2846
|
+
}
|
|
2847
|
+
}, T = () => i(null);
|
|
2848
|
+
return window.addEventListener("pointermove", S), window.addEventListener("pointerup", T), () => {
|
|
2849
|
+
window.removeEventListener("pointermove", S), window.removeEventListener("pointerup", T);
|
|
2850
|
+
};
|
|
2851
|
+
}, [d, r, e, t.width]);
|
|
2852
|
+
const f = t.width * e, b = !!r && !o;
|
|
2853
|
+
return /* @__PURE__ */ s("div", { className: `docs-ruler${b ? " docs-ruler--draggable" : ""}`, children: /* @__PURE__ */ g(
|
|
2539
2854
|
"div",
|
|
2540
2855
|
{
|
|
2856
|
+
ref: m,
|
|
2541
2857
|
className: "docs-ruler-track",
|
|
2542
|
-
style: { width:
|
|
2858
|
+
style: { width: f, transform: `translateX(${-c}px)` },
|
|
2543
2859
|
children: [
|
|
2544
|
-
/* @__PURE__ */
|
|
2860
|
+
/* @__PURE__ */ s(
|
|
2545
2861
|
"div",
|
|
2546
2862
|
{
|
|
2547
2863
|
className: "docs-ruler-margin",
|
|
2548
2864
|
style: { left: 0, width: t.marginLeft * e }
|
|
2549
2865
|
}
|
|
2550
2866
|
),
|
|
2551
|
-
/* @__PURE__ */
|
|
2867
|
+
/* @__PURE__ */ s(
|
|
2552
2868
|
"div",
|
|
2553
2869
|
{
|
|
2554
2870
|
className: "docs-ruler-margin",
|
|
2555
2871
|
style: { right: 0, width: t.marginRight * e }
|
|
2556
2872
|
}
|
|
2557
2873
|
),
|
|
2558
|
-
|
|
2559
|
-
(
|
|
2874
|
+
u.map(
|
|
2875
|
+
(S, T) => S.label ? /* @__PURE__ */ s("span", { className: "docs-ruler-num", style: { left: S.x * e }, children: S.label }, T) : /* @__PURE__ */ s(
|
|
2560
2876
|
"span",
|
|
2561
2877
|
{
|
|
2562
|
-
className:
|
|
2563
|
-
style: { left:
|
|
2564
|
-
children: d.label
|
|
2878
|
+
className: `docs-ruler-tick docs-ruler-tick--${S.kind}`,
|
|
2879
|
+
style: { left: S.x * e }
|
|
2565
2880
|
},
|
|
2566
|
-
|
|
2567
|
-
)
|
|
2881
|
+
T
|
|
2882
|
+
)
|
|
2883
|
+
),
|
|
2884
|
+
b && /* @__PURE__ */ g(J, { children: [
|
|
2885
|
+
/* @__PURE__ */ s(
|
|
2568
2886
|
"span",
|
|
2569
2887
|
{
|
|
2570
|
-
className: `docs-ruler-
|
|
2571
|
-
style: { left:
|
|
2888
|
+
className: `docs-ruler-stop docs-ruler-stop--h${d === "left" ? " dragging" : ""}`,
|
|
2889
|
+
style: { left: t.marginLeft * e },
|
|
2890
|
+
onPointerDown: h("left"),
|
|
2891
|
+
title: "Drag to set the left margin"
|
|
2892
|
+
}
|
|
2893
|
+
),
|
|
2894
|
+
/* @__PURE__ */ s(
|
|
2895
|
+
"span",
|
|
2896
|
+
{
|
|
2897
|
+
className: `docs-ruler-stop docs-ruler-stop--h${d === "right" ? " dragging" : ""}`,
|
|
2898
|
+
style: { left: (t.width - t.marginRight) * e },
|
|
2899
|
+
onPointerDown: h("right"),
|
|
2900
|
+
title: "Drag to set the right margin"
|
|
2901
|
+
}
|
|
2902
|
+
)
|
|
2903
|
+
] })
|
|
2904
|
+
]
|
|
2905
|
+
}
|
|
2906
|
+
) });
|
|
2907
|
+
}
|
|
2908
|
+
function Pr({
|
|
2909
|
+
geometry: t,
|
|
2910
|
+
zoom: e,
|
|
2911
|
+
scrollEl: n,
|
|
2912
|
+
onMargins: r,
|
|
2913
|
+
locked: o = !1,
|
|
2914
|
+
/** Extra px between the top of the scroll area and the page sheet top. */
|
|
2915
|
+
topOffset: c = 0
|
|
2916
|
+
}) {
|
|
2917
|
+
const [a, d] = z(0), [i, m] = z(null), u = U(null);
|
|
2918
|
+
W(() => {
|
|
2919
|
+
const y = n.current;
|
|
2920
|
+
if (!y) return;
|
|
2921
|
+
const v = () => d(y.scrollTop);
|
|
2922
|
+
return v(), y.addEventListener("scroll", v, { passive: !0 }), () => y.removeEventListener("scroll", v);
|
|
2923
|
+
}, [n]);
|
|
2924
|
+
const h = t.autoHeight ? t.width * 1.414 : t.height, f = Q(
|
|
2925
|
+
() => Te(h, t.unit),
|
|
2926
|
+
[h, t.unit]
|
|
2927
|
+
), b = M(
|
|
2928
|
+
(y) => (v) => {
|
|
2929
|
+
!r || o || t.autoHeight || (v.preventDefault(), m(y));
|
|
2930
|
+
},
|
|
2931
|
+
[r, o, t.autoHeight]
|
|
2932
|
+
);
|
|
2933
|
+
W(() => {
|
|
2934
|
+
if (!i || !r) return;
|
|
2935
|
+
const y = (H) => {
|
|
2936
|
+
const B = u.current;
|
|
2937
|
+
if (!B) return;
|
|
2938
|
+
const j = B.getBoundingClientRect(), P = (H.clientY - j.left) / e;
|
|
2939
|
+
if (i === "top") {
|
|
2940
|
+
const I = Math.max(0, Math.min(P, h / 2));
|
|
2941
|
+
r({ top: I });
|
|
2942
|
+
} else {
|
|
2943
|
+
const I = Math.max(0, Math.min(h - P, h / 2));
|
|
2944
|
+
r({ bottom: I });
|
|
2945
|
+
}
|
|
2946
|
+
}, v = () => m(null);
|
|
2947
|
+
return window.addEventListener("pointermove", y), window.addEventListener("pointerup", v), () => {
|
|
2948
|
+
window.removeEventListener("pointermove", y), window.removeEventListener("pointerup", v);
|
|
2949
|
+
};
|
|
2950
|
+
}, [i, r, e, h]);
|
|
2951
|
+
const S = h * e, T = !!r && !o && !t.autoHeight;
|
|
2952
|
+
return /* @__PURE__ */ s("div", { className: "docs-ruler-v", children: /* @__PURE__ */ g(
|
|
2953
|
+
"div",
|
|
2954
|
+
{
|
|
2955
|
+
ref: u,
|
|
2956
|
+
className: "docs-ruler-v-track",
|
|
2957
|
+
style: { height: S, transform: `translateY(${c - a}px)` },
|
|
2958
|
+
children: [
|
|
2959
|
+
/* @__PURE__ */ s(
|
|
2960
|
+
"div",
|
|
2961
|
+
{
|
|
2962
|
+
className: "docs-ruler-margin docs-ruler-margin--v",
|
|
2963
|
+
style: { top: 0, height: t.marginTop * e }
|
|
2964
|
+
}
|
|
2965
|
+
),
|
|
2966
|
+
/* @__PURE__ */ s(
|
|
2967
|
+
"div",
|
|
2968
|
+
{
|
|
2969
|
+
className: "docs-ruler-margin docs-ruler-margin--v",
|
|
2970
|
+
style: { bottom: 0, height: t.marginBottom * e }
|
|
2971
|
+
}
|
|
2972
|
+
),
|
|
2973
|
+
f.map(
|
|
2974
|
+
(y, v) => y.label ? /* @__PURE__ */ s("span", { className: "docs-ruler-num docs-ruler-num--v", style: { top: y.x * e }, children: y.label }, v) : /* @__PURE__ */ s(
|
|
2975
|
+
"span",
|
|
2976
|
+
{
|
|
2977
|
+
className: `docs-ruler-tick docs-ruler-tick--v docs-ruler-tick--${y.kind}`,
|
|
2978
|
+
style: { top: y.x * e }
|
|
2572
2979
|
},
|
|
2573
|
-
|
|
2980
|
+
v
|
|
2574
2981
|
)
|
|
2575
|
-
)
|
|
2982
|
+
),
|
|
2983
|
+
T && /* @__PURE__ */ g(J, { children: [
|
|
2984
|
+
/* @__PURE__ */ s(
|
|
2985
|
+
"span",
|
|
2986
|
+
{
|
|
2987
|
+
className: `docs-ruler-stop docs-ruler-stop--v${i === "top" ? " dragging" : ""}`,
|
|
2988
|
+
style: { top: t.marginTop * e },
|
|
2989
|
+
onPointerDown: b("top"),
|
|
2990
|
+
title: "Drag to set the top margin"
|
|
2991
|
+
}
|
|
2992
|
+
),
|
|
2993
|
+
/* @__PURE__ */ s(
|
|
2994
|
+
"span",
|
|
2995
|
+
{
|
|
2996
|
+
className: `docs-ruler-stop docs-ruler-stop--v${i === "bottom" ? " dragging" : ""}`,
|
|
2997
|
+
style: { top: (h - t.marginBottom) * e },
|
|
2998
|
+
onPointerDown: b("bottom"),
|
|
2999
|
+
title: "Drag to set the bottom margin"
|
|
3000
|
+
}
|
|
3001
|
+
)
|
|
3002
|
+
] })
|
|
2576
3003
|
]
|
|
2577
3004
|
}
|
|
2578
3005
|
) });
|
|
2579
3006
|
}
|
|
2580
|
-
function
|
|
3007
|
+
function zt(t, e) {
|
|
2581
3008
|
return e ? `${t} (${e})` : t;
|
|
2582
3009
|
}
|
|
2583
|
-
function
|
|
3010
|
+
function Br({ trust: t, intact: e }) {
|
|
2584
3011
|
if (t.isSealed) {
|
|
2585
3012
|
const n = t.sealedBy || "unknown", r = t.signatures[t.signatures.length - 1]?.role;
|
|
2586
|
-
return /* @__PURE__ */
|
|
2587
|
-
/* @__PURE__ */
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
/* @__PURE__ */
|
|
3013
|
+
return /* @__PURE__ */ g("div", { className: "docs-trust-banner docs-trust-banner--sealed", role: "status", children: [
|
|
3014
|
+
/* @__PURE__ */ s("span", { className: "docs-trust-banner__icon", children: "🔒" }),
|
|
3015
|
+
/* @__PURE__ */ s("span", { className: "docs-trust-banner__title", children: "Sealed" }),
|
|
3016
|
+
/* @__PURE__ */ g("span", { className: "docs-trust-banner__text", children: [
|
|
2590
3017
|
"signed by ",
|
|
2591
|
-
|
|
3018
|
+
zt(n, r),
|
|
2592
3019
|
t.sealedAt ? ` on ${t.sealedAt}` : "",
|
|
2593
3020
|
" · read-only"
|
|
2594
3021
|
] }),
|
|
2595
|
-
e === !0 && /* @__PURE__ */
|
|
2596
|
-
e === !1 && /* @__PURE__ */
|
|
3022
|
+
e === !0 && /* @__PURE__ */ s("span", { className: "docs-trust-banner__verify docs-trust-banner__verify--ok", children: "hash verified ✓" }),
|
|
3023
|
+
e === !1 && /* @__PURE__ */ s("span", { className: "docs-trust-banner__verify docs-trust-banner__verify--bad", children: "⚠ hash mismatch — content changed after sealing" })
|
|
2597
3024
|
] });
|
|
2598
3025
|
}
|
|
2599
|
-
return t.signatures.length > 0 ? /* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2601
|
-
/* @__PURE__ */
|
|
2602
|
-
/* @__PURE__ */
|
|
3026
|
+
return t.signatures.length > 0 ? /* @__PURE__ */ g("div", { className: "docs-trust-banner docs-trust-banner--signed", role: "status", children: [
|
|
3027
|
+
/* @__PURE__ */ s("span", { className: "docs-trust-banner__icon", children: "✍" }),
|
|
3028
|
+
/* @__PURE__ */ s("span", { className: "docs-trust-banner__title", children: "Signed" }),
|
|
3029
|
+
/* @__PURE__ */ g("span", { className: "docs-trust-banner__text", children: [
|
|
2603
3030
|
"by",
|
|
2604
3031
|
" ",
|
|
2605
|
-
t.signatures.map((n) => `${
|
|
3032
|
+
t.signatures.map((n) => `${zt(n.by, n.role)}${n.at ? ` on ${n.at}` : ""}`).join(" · ")
|
|
2606
3033
|
] })
|
|
2607
|
-
] }) : t.approvals.length > 0 ? /* @__PURE__ */
|
|
3034
|
+
] }) : t.approvals.length > 0 ? /* @__PURE__ */ g(
|
|
2608
3035
|
"div",
|
|
2609
3036
|
{
|
|
2610
3037
|
className: "docs-trust-banner docs-trust-banner--approved",
|
|
2611
3038
|
role: "status",
|
|
2612
3039
|
children: [
|
|
2613
|
-
/* @__PURE__ */
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
/* @__PURE__ */
|
|
3040
|
+
/* @__PURE__ */ s("span", { className: "docs-trust-banner__icon", children: "✓" }),
|
|
3041
|
+
/* @__PURE__ */ s("span", { className: "docs-trust-banner__title", children: "Approved" }),
|
|
3042
|
+
/* @__PURE__ */ g("span", { className: "docs-trust-banner__text", children: [
|
|
2616
3043
|
"by",
|
|
2617
3044
|
" ",
|
|
2618
|
-
t.approvals.map((n) => `${
|
|
3045
|
+
t.approvals.map((n) => `${zt(n.by, n.role)}${n.at ? ` on ${n.at}` : ""}`).join(" · ")
|
|
2619
3046
|
] })
|
|
2620
3047
|
]
|
|
2621
3048
|
}
|
|
2622
3049
|
) : null;
|
|
2623
3050
|
}
|
|
2624
|
-
function
|
|
3051
|
+
function Ir(t) {
|
|
2625
3052
|
let e;
|
|
2626
3053
|
try {
|
|
2627
|
-
e =
|
|
3054
|
+
e = rt(t);
|
|
2628
3055
|
} catch {
|
|
2629
3056
|
return [];
|
|
2630
3057
|
}
|
|
2631
|
-
const n = [], r = (o,
|
|
2632
|
-
const
|
|
2633
|
-
|
|
3058
|
+
const n = [], r = (o, c) => {
|
|
3059
|
+
const a = c == null ? "" : String(c).trim();
|
|
3060
|
+
a && n.push({ key: o, value: a });
|
|
2634
3061
|
};
|
|
2635
3062
|
for (const o of e.blocks)
|
|
2636
3063
|
switch (o.type) {
|
|
2637
3064
|
case "meta":
|
|
2638
|
-
for (const [
|
|
3065
|
+
for (const [c, a] of Object.entries(o.properties || {})) r(c, a);
|
|
2639
3066
|
break;
|
|
2640
3067
|
case "track":
|
|
2641
3068
|
r("tracked", o.properties?.id ?? o.content);
|
|
2642
3069
|
break;
|
|
2643
3070
|
case "page": {
|
|
2644
|
-
const
|
|
3071
|
+
const c = o.properties?.orientation;
|
|
2645
3072
|
r(
|
|
2646
3073
|
"page",
|
|
2647
|
-
[o.content,
|
|
3074
|
+
[o.content, c].filter(Boolean).join(" · ")
|
|
2648
3075
|
);
|
|
2649
3076
|
break;
|
|
2650
3077
|
}
|
|
@@ -2669,36 +3096,36 @@ function vr(t) {
|
|
|
2669
3096
|
}
|
|
2670
3097
|
return n;
|
|
2671
3098
|
}
|
|
2672
|
-
function
|
|
2673
|
-
const [e, n] =
|
|
3099
|
+
function Dr({ source: t }) {
|
|
3100
|
+
const [e, n] = z(!1), r = Q(() => Ir(t), [t]);
|
|
2674
3101
|
if (r.length === 0) return null;
|
|
2675
|
-
const o = r.slice(0, 4).map((
|
|
2676
|
-
return /* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
3102
|
+
const o = r.slice(0, 4).map((c) => `${c.key}: ${c.value}`).join(" · ");
|
|
3103
|
+
return /* @__PURE__ */ g("div", { className: `docs-props-bar${e ? " open" : ""}`, children: [
|
|
3104
|
+
/* @__PURE__ */ g(
|
|
2678
3105
|
"button",
|
|
2679
3106
|
{
|
|
2680
3107
|
className: "docs-props-toggle",
|
|
2681
|
-
onClick: () => n((
|
|
3108
|
+
onClick: () => n((c) => !c),
|
|
2682
3109
|
title: e ? "Hide document properties" : "Show document properties",
|
|
2683
3110
|
children: [
|
|
2684
|
-
/* @__PURE__ */
|
|
3111
|
+
/* @__PURE__ */ s("span", { className: "docs-props-caret", children: e ? "▾" : "▸" }),
|
|
2685
3112
|
"Document properties",
|
|
2686
|
-
!e && /* @__PURE__ */
|
|
3113
|
+
!e && /* @__PURE__ */ s("span", { className: "docs-props-summary", children: o })
|
|
2687
3114
|
]
|
|
2688
3115
|
}
|
|
2689
3116
|
),
|
|
2690
|
-
e && /* @__PURE__ */
|
|
2691
|
-
/* @__PURE__ */
|
|
3117
|
+
e && /* @__PURE__ */ s("div", { className: "docs-props-chips", children: r.map((c, a) => /* @__PURE__ */ g("span", { className: "docs-props-chip", children: [
|
|
3118
|
+
/* @__PURE__ */ s("b", { children: c.key }),
|
|
2692
3119
|
" ",
|
|
2693
|
-
|
|
2694
|
-
] }, `${
|
|
3120
|
+
c.value
|
|
3121
|
+
] }, `${c.key}-${a}`)) })
|
|
2695
3122
|
] });
|
|
2696
3123
|
}
|
|
2697
|
-
function
|
|
3124
|
+
function O(t, e, n = "") {
|
|
2698
3125
|
const r = t?.properties?.[e];
|
|
2699
3126
|
return r != null ? String(r) : n;
|
|
2700
3127
|
}
|
|
2701
|
-
function
|
|
3128
|
+
function ce(t) {
|
|
2702
3129
|
const e = {
|
|
2703
3130
|
lifecycle: "draft",
|
|
2704
3131
|
isTracked: !1,
|
|
@@ -2712,104 +3139,140 @@ function Vt(t) {
|
|
|
2712
3139
|
amendments: []
|
|
2713
3140
|
};
|
|
2714
3141
|
if (!t) return e;
|
|
2715
|
-
const n = t.blocks, r = n.find((
|
|
3142
|
+
const n = t.blocks, r = n.find((i) => i.type === "track");
|
|
2716
3143
|
r && (e.isTracked = !0, e.lifecycle = "tracked", e.trackBlock = {
|
|
2717
|
-
id:
|
|
2718
|
-
by:
|
|
2719
|
-
at:
|
|
3144
|
+
id: O(r, "id", r.content ?? ""),
|
|
3145
|
+
by: O(r, "by"),
|
|
3146
|
+
at: O(r, "at")
|
|
2720
3147
|
});
|
|
2721
|
-
const o = n.filter((
|
|
2722
|
-
for (const
|
|
3148
|
+
const o = n.filter((i) => i.type === "approve");
|
|
3149
|
+
for (const i of o)
|
|
2723
3150
|
e.approvals.push({
|
|
2724
|
-
by:
|
|
2725
|
-
role:
|
|
2726
|
-
at:
|
|
2727
|
-
note:
|
|
3151
|
+
by: O(i, "by", i.content ?? ""),
|
|
3152
|
+
role: O(i, "role"),
|
|
3153
|
+
at: O(i, "at"),
|
|
3154
|
+
note: O(i, "note") || void 0
|
|
2728
3155
|
});
|
|
2729
3156
|
e.approvals.length > 0 && (e.lifecycle = "approved");
|
|
2730
|
-
const
|
|
2731
|
-
for (const
|
|
3157
|
+
const c = n.filter((i) => i.type === "sign");
|
|
3158
|
+
for (const i of c)
|
|
2732
3159
|
e.signatures.push({
|
|
2733
|
-
by:
|
|
2734
|
-
role:
|
|
2735
|
-
at:
|
|
3160
|
+
by: O(i, "by", i.content ?? ""),
|
|
3161
|
+
role: O(i, "role"),
|
|
3162
|
+
at: O(i, "at")
|
|
2736
3163
|
});
|
|
2737
3164
|
e.signatures.length > 0 && (e.lifecycle = "signed");
|
|
2738
|
-
const
|
|
2739
|
-
if (
|
|
3165
|
+
const a = n.find((i) => i.type === "freeze");
|
|
3166
|
+
if (a) {
|
|
2740
3167
|
e.isSealed = !0, e.lifecycle = "sealed";
|
|
2741
|
-
const
|
|
2742
|
-
e.sealedBy =
|
|
3168
|
+
const i = e.signatures[e.signatures.length - 1];
|
|
3169
|
+
e.sealedBy = i?.by || O(a, "by", a.content ?? ""), e.sealedAt = O(a, "at") || i?.at || "", e.sealHash = O(a, "hash");
|
|
2743
3170
|
}
|
|
2744
|
-
const d = n.filter((
|
|
2745
|
-
for (const
|
|
3171
|
+
const d = n.filter((i) => i.type === "amendment");
|
|
3172
|
+
for (const i of d)
|
|
2746
3173
|
e.amendments.push({
|
|
2747
|
-
section:
|
|
2748
|
-
was:
|
|
2749
|
-
now:
|
|
2750
|
-
by:
|
|
2751
|
-
ref:
|
|
2752
|
-
at:
|
|
3174
|
+
section: O(i, "section", i.content ?? ""),
|
|
3175
|
+
was: O(i, "was"),
|
|
3176
|
+
now: O(i, "now"),
|
|
3177
|
+
by: O(i, "by"),
|
|
3178
|
+
ref: O(i, "ref"),
|
|
3179
|
+
at: O(i, "at")
|
|
2753
3180
|
});
|
|
2754
3181
|
return e;
|
|
2755
3182
|
}
|
|
2756
|
-
const
|
|
2757
|
-
function
|
|
3183
|
+
const le = new pe("template-highlight"), Nt = /\{\{[^}]+\}\}/g;
|
|
3184
|
+
function de(t) {
|
|
2758
3185
|
const e = [];
|
|
2759
3186
|
return t.descendants((n, r) => {
|
|
2760
3187
|
if (!n.isText || !n.text) return;
|
|
2761
|
-
|
|
3188
|
+
Nt.lastIndex = 0;
|
|
2762
3189
|
let o;
|
|
2763
|
-
for (; o =
|
|
3190
|
+
for (; o = Nt.exec(n.text); )
|
|
2764
3191
|
e.push(
|
|
2765
|
-
|
|
3192
|
+
Ht.inline(r + o.index, r + o.index + o[0].length, {
|
|
2766
3193
|
class: "it-doc-var"
|
|
2767
3194
|
})
|
|
2768
3195
|
);
|
|
2769
|
-
}),
|
|
3196
|
+
}), xt.create(t, e);
|
|
2770
3197
|
}
|
|
2771
|
-
const
|
|
3198
|
+
const Or = vt.create({
|
|
2772
3199
|
name: "templateHighlight",
|
|
2773
3200
|
addProseMirrorPlugins() {
|
|
2774
3201
|
return [
|
|
2775
|
-
new
|
|
2776
|
-
key:
|
|
3202
|
+
new ue({
|
|
3203
|
+
key: le,
|
|
2777
3204
|
state: {
|
|
2778
|
-
init: (t, e) =>
|
|
2779
|
-
apply: (t, e) => t.docChanged ?
|
|
3205
|
+
init: (t, e) => de(e.doc),
|
|
3206
|
+
apply: (t, e) => t.docChanged ? de(t.doc) : e
|
|
2780
3207
|
},
|
|
2781
3208
|
props: {
|
|
2782
3209
|
decorations(t) {
|
|
2783
|
-
return
|
|
3210
|
+
return le.getState(t);
|
|
2784
3211
|
}
|
|
2785
3212
|
}
|
|
2786
3213
|
})
|
|
2787
3214
|
];
|
|
2788
3215
|
}
|
|
2789
3216
|
});
|
|
2790
|
-
function
|
|
3217
|
+
function fo(t) {
|
|
2791
3218
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
2792
|
-
|
|
3219
|
+
Nt.lastIndex = 0;
|
|
2793
3220
|
let r;
|
|
2794
|
-
for (; r =
|
|
3221
|
+
for (; r = Nt.exec(t); ) {
|
|
2795
3222
|
const o = r[0].slice(2, -2).trim();
|
|
2796
3223
|
/^(page|pages|date|time|year)$/i.test(o) || e.has(o) || (e.add(o), n.push(o));
|
|
2797
3224
|
}
|
|
2798
3225
|
return n;
|
|
2799
3226
|
}
|
|
2800
|
-
function
|
|
3227
|
+
function go(t) {
|
|
2801
3228
|
const e = {};
|
|
2802
3229
|
for (const n of t) {
|
|
2803
3230
|
const r = n.split(".");
|
|
2804
3231
|
let o = e;
|
|
2805
|
-
for (let
|
|
2806
|
-
const
|
|
2807
|
-
|
|
3232
|
+
for (let c = 0; c < r.length; c++) {
|
|
3233
|
+
const a = r[c];
|
|
3234
|
+
c === r.length - 1 ? a in o || (o[a] = "") : ((!(a in o) || typeof o[a] != "object" || o[a] === null) && (o[a] = {}), o = o[a]);
|
|
2808
3235
|
}
|
|
2809
3236
|
}
|
|
2810
3237
|
return e;
|
|
2811
3238
|
}
|
|
2812
|
-
|
|
3239
|
+
function Fr(t, e, n) {
|
|
3240
|
+
const r = t.coordsAtPos(e), o = r.top + 1, c = r.bottom - 1, a = n === "start" ? -1 : 1;
|
|
3241
|
+
let d = e, i = e;
|
|
3242
|
+
for (let m = 0; m < 1e5; m++) {
|
|
3243
|
+
const u = d + a;
|
|
3244
|
+
if (u < 0 || u > t.state.doc.content.size) break;
|
|
3245
|
+
let h;
|
|
3246
|
+
try {
|
|
3247
|
+
h = t.coordsAtPos(u);
|
|
3248
|
+
} catch {
|
|
3249
|
+
break;
|
|
3250
|
+
}
|
|
3251
|
+
if (h.bottom <= o || h.top >= c) break;
|
|
3252
|
+
d = u, i = u;
|
|
3253
|
+
}
|
|
3254
|
+
return i;
|
|
3255
|
+
}
|
|
3256
|
+
const jr = vt.create({
|
|
3257
|
+
name: "lineKeymap",
|
|
3258
|
+
addKeyboardShortcuts() {
|
|
3259
|
+
const t = (e, n) => {
|
|
3260
|
+
const { view: r } = this.editor, { state: o } = r, { selection: c } = o, a = c.head, d = Fr(r, a, e);
|
|
3261
|
+
if (d == null || d === a)
|
|
3262
|
+
return !1;
|
|
3263
|
+
const i = o.doc.resolve(d), m = n ? c.anchor : d, u = o.tr.setSelection(
|
|
3264
|
+
n ? Wt.between(o.doc.resolve(m), i) : Wt.near(i)
|
|
3265
|
+
);
|
|
3266
|
+
return r.dispatch(u.scrollIntoView()), !0;
|
|
3267
|
+
};
|
|
3268
|
+
return {
|
|
3269
|
+
Home: () => t("start", !1),
|
|
3270
|
+
End: () => t("end", !1),
|
|
3271
|
+
"Shift-Home": () => t("start", !0),
|
|
3272
|
+
"Shift-End": () => t("end", !0)
|
|
3273
|
+
};
|
|
3274
|
+
}
|
|
3275
|
+
}), Ur = 28, Wr = {
|
|
2813
3276
|
title: [".it-doc-title"],
|
|
2814
3277
|
summary: [".it-doc-summary"],
|
|
2815
3278
|
section: [".it-doc-section"],
|
|
@@ -2824,24 +3287,24 @@ const Lr = 28, Ar = {
|
|
|
2824
3287
|
contact: ['.it-doc-generic[data-keyword="contact"]'],
|
|
2825
3288
|
divider: [".it-doc-divider"]
|
|
2826
3289
|
};
|
|
2827
|
-
function
|
|
3290
|
+
function Gr({
|
|
2828
3291
|
value: t,
|
|
2829
3292
|
onChange: e,
|
|
2830
3293
|
theme: n,
|
|
2831
3294
|
onThemeChange: r,
|
|
2832
3295
|
readOnly: o = !1,
|
|
2833
|
-
showRibbon:
|
|
2834
|
-
showTrustBanner:
|
|
3296
|
+
showRibbon: c = !0,
|
|
3297
|
+
showTrustBanner: a = !0,
|
|
2835
3298
|
onTrustAction: d
|
|
2836
3299
|
}) {
|
|
2837
|
-
const
|
|
3300
|
+
const i = U(""), m = U(!1), u = U(!0), [h, f] = z([]), b = U(Pt("")), [S, T] = z(1), y = Ee({
|
|
2838
3301
|
extensions: [
|
|
2839
|
-
|
|
2840
|
-
geometry: () =>
|
|
2841
|
-
gap:
|
|
2842
|
-
onPages:
|
|
3302
|
+
En.configure({
|
|
3303
|
+
geometry: () => b.current,
|
|
3304
|
+
gap: Ur,
|
|
3305
|
+
onPages: T
|
|
2843
3306
|
}),
|
|
2844
|
-
|
|
3307
|
+
He.configure({
|
|
2845
3308
|
heading: !1,
|
|
2846
3309
|
codeBlock: !1,
|
|
2847
3310
|
blockquote: !1,
|
|
@@ -2849,47 +3312,43 @@ function Cr({
|
|
|
2849
3312
|
// Replaced by ITParagraph (core block props: end/leading/space-…).
|
|
2850
3313
|
paragraph: !1
|
|
2851
3314
|
}),
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
}),
|
|
2859
|
-
|
|
2860
|
-
Te,
|
|
2861
|
-
xe,
|
|
2862
|
-
Le.configure({ multicolor: !0 }),
|
|
2863
|
-
Ae.configure({
|
|
3315
|
+
br,
|
|
3316
|
+
yr,
|
|
3317
|
+
jr,
|
|
3318
|
+
Re,
|
|
3319
|
+
Pe,
|
|
3320
|
+
Be,
|
|
3321
|
+
Ie.configure({ multicolor: !0 }),
|
|
3322
|
+
De.configure({
|
|
2864
3323
|
types: ["paragraph", "itTitle", "itSummary", "itSection", "itSub"]
|
|
2865
3324
|
}),
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
Bn,
|
|
2871
|
-
In,
|
|
2872
|
-
On,
|
|
2873
|
-
Dn,
|
|
2874
|
-
Fn,
|
|
2875
|
-
jn,
|
|
2876
|
-
Wn,
|
|
2877
|
-
Gn,
|
|
2878
|
-
Yn,
|
|
2879
|
-
Un,
|
|
2880
|
-
Kn,
|
|
2881
|
-
qn,
|
|
2882
|
-
Jn,
|
|
2883
|
-
Vn,
|
|
2884
|
-
Qn,
|
|
3325
|
+
Oe,
|
|
3326
|
+
xn,
|
|
3327
|
+
Fe,
|
|
3328
|
+
je,
|
|
2885
3329
|
Zn,
|
|
2886
|
-
|
|
3330
|
+
tr,
|
|
3331
|
+
er,
|
|
3332
|
+
nr,
|
|
3333
|
+
rr,
|
|
3334
|
+
or,
|
|
3335
|
+
sr,
|
|
3336
|
+
ir,
|
|
3337
|
+
cr,
|
|
3338
|
+
ar,
|
|
3339
|
+
lr,
|
|
3340
|
+
dr,
|
|
3341
|
+
ur,
|
|
3342
|
+
pr,
|
|
3343
|
+
fr,
|
|
3344
|
+
gr,
|
|
3345
|
+
Or
|
|
2887
3346
|
],
|
|
2888
|
-
content:
|
|
2889
|
-
onUpdate: ({ editor:
|
|
2890
|
-
if (
|
|
2891
|
-
const
|
|
2892
|
-
|
|
3347
|
+
content: ee(t),
|
|
3348
|
+
onUpdate: ({ editor: k }) => {
|
|
3349
|
+
if (u.current) return;
|
|
3350
|
+
const w = k.getJSON(), L = Kn(w);
|
|
3351
|
+
i.current = L, m.current = !0, f(Wn(w)), e(L);
|
|
2893
3352
|
},
|
|
2894
3353
|
editorProps: {
|
|
2895
3354
|
attributes: {
|
|
@@ -2898,280 +3357,303 @@ function Cr({
|
|
|
2898
3357
|
}
|
|
2899
3358
|
}
|
|
2900
3359
|
});
|
|
2901
|
-
|
|
2902
|
-
const
|
|
2903
|
-
|
|
3360
|
+
W(() => {
|
|
3361
|
+
const k = window.setTimeout(() => {
|
|
3362
|
+
u.current = !1, i.current = t;
|
|
2904
3363
|
}, 0);
|
|
2905
|
-
return () => window.clearTimeout(
|
|
2906
|
-
}, []),
|
|
2907
|
-
if (
|
|
2908
|
-
if (
|
|
2909
|
-
|
|
3364
|
+
return () => window.clearTimeout(k);
|
|
3365
|
+
}, []), W(() => {
|
|
3366
|
+
if (y) {
|
|
3367
|
+
if (m.current) {
|
|
3368
|
+
m.current = !1;
|
|
2910
3369
|
return;
|
|
2911
3370
|
}
|
|
2912
|
-
if (t !==
|
|
2913
|
-
const
|
|
2914
|
-
|
|
3371
|
+
if (t !== i.current) {
|
|
3372
|
+
const k = ee(t);
|
|
3373
|
+
y.commands.setContent(k), i.current = t;
|
|
2915
3374
|
}
|
|
2916
3375
|
}
|
|
2917
|
-
}, [t,
|
|
2918
|
-
if (!
|
|
2919
|
-
const
|
|
2920
|
-
const
|
|
2921
|
-
|
|
3376
|
+
}, [t, y]), W(() => {
|
|
3377
|
+
if (!y) return;
|
|
3378
|
+
const k = (w) => {
|
|
3379
|
+
const L = w.detail;
|
|
3380
|
+
L && y.chain().focus().insertContent(L).run();
|
|
2922
3381
|
};
|
|
2923
|
-
return window.addEventListener("it-insert-text",
|
|
2924
|
-
}, [
|
|
2925
|
-
const
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
}, [
|
|
2929
|
-
const
|
|
3382
|
+
return window.addEventListener("it-insert-text", k), () => window.removeEventListener("it-insert-text", k);
|
|
3383
|
+
}, [y]);
|
|
3384
|
+
const v = Q(() => Pt(t), [t]);
|
|
3385
|
+
W(() => {
|
|
3386
|
+
b.current = v, y?.view.dispatch(y.state.tr);
|
|
3387
|
+
}, [v, y]);
|
|
3388
|
+
const H = U(null), B = M(() => y ? y.storage.characterCount?.words?.() ?? y.getText().split(/\s+/).filter(Boolean).length : 0, [y]), j = Q(() => {
|
|
2930
3389
|
if (!n) return "";
|
|
2931
3390
|
try {
|
|
2932
|
-
const
|
|
2933
|
-
return
|
|
3391
|
+
const k = Qe(n);
|
|
3392
|
+
return k ? Xe(k).replace(/:root\{/, ".docs-page{") : "";
|
|
2934
3393
|
} catch {
|
|
2935
3394
|
return "";
|
|
2936
3395
|
}
|
|
2937
|
-
}, [n]),
|
|
3396
|
+
}, [n]), P = Q(() => {
|
|
2938
3397
|
try {
|
|
2939
|
-
const
|
|
2940
|
-
return { header:
|
|
3398
|
+
const k = rt(t), w = k.blocks.find((K) => K.type === "header")?.content || "", L = k.blocks.find((K) => K.type === "footer")?.content || "", Z = k.blocks.find((K) => K.type === "meta"), tt = String(Z?.properties?.dir || "ltr").toLowerCase();
|
|
3399
|
+
return { header: w, footer: L, dir: tt };
|
|
2941
3400
|
} catch {
|
|
2942
3401
|
return { header: "", footer: "", dir: "ltr" };
|
|
2943
3402
|
}
|
|
2944
|
-
}, [t]),
|
|
3403
|
+
}, [t]), I = Q(() => {
|
|
2945
3404
|
try {
|
|
2946
|
-
return
|
|
3405
|
+
return ce(rt(t));
|
|
2947
3406
|
} catch {
|
|
2948
|
-
return
|
|
3407
|
+
return ce(null);
|
|
2949
3408
|
}
|
|
2950
|
-
}, [t]),
|
|
2951
|
-
if (!
|
|
3409
|
+
}, [t]), X = Q(() => {
|
|
3410
|
+
if (!I.isSealed) return null;
|
|
2952
3411
|
try {
|
|
2953
|
-
return
|
|
3412
|
+
return fe(t).intact;
|
|
2954
3413
|
} catch {
|
|
2955
3414
|
return null;
|
|
2956
3415
|
}
|
|
2957
|
-
}, [t,
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
}, [
|
|
2961
|
-
|
|
3416
|
+
}, [t, I.isSealed]), C = I.isSealed || o;
|
|
3417
|
+
W(() => {
|
|
3418
|
+
y && y.isEditable !== !C && y.setEditable(!C);
|
|
3419
|
+
}, [y, C]), W(() => {
|
|
3420
|
+
if (!y) return;
|
|
3421
|
+
y.view.dom.setAttribute("dir", P.dir === "rtl" ? "rtl" : "ltr");
|
|
3422
|
+
}, [y, P.dir]);
|
|
3423
|
+
const R = Q(() => {
|
|
2962
3424
|
try {
|
|
2963
|
-
return
|
|
2964
|
-
|
|
2965
|
-
|
|
3425
|
+
return Ze(
|
|
3426
|
+
rt(t),
|
|
3427
|
+
Wr,
|
|
2966
3428
|
".docs-page .tiptap "
|
|
2967
3429
|
);
|
|
2968
3430
|
} catch {
|
|
2969
3431
|
return "";
|
|
2970
3432
|
}
|
|
2971
3433
|
}, [t]);
|
|
2972
|
-
|
|
2973
|
-
let
|
|
3434
|
+
W(() => {
|
|
3435
|
+
let k = document.getElementById(
|
|
2974
3436
|
"it-doc-style-rules"
|
|
2975
3437
|
);
|
|
2976
|
-
|
|
2977
|
-
}, [
|
|
2978
|
-
const
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
let y = document.getElementById(m);
|
|
3002
|
-
y || (y = document.createElement("style"), y.id = m, document.head.appendChild(y)), y.textContent = K;
|
|
3003
|
-
}, [K]);
|
|
3004
|
-
const G = B(null), [L, st] = P(1), ut = B(L), V = B(null), pt = R(
|
|
3005
|
-
(m) => {
|
|
3006
|
-
const y = G.current;
|
|
3007
|
-
if (!y) return;
|
|
3008
|
-
const T = y.getBoundingClientRect();
|
|
3009
|
-
V.current = {
|
|
3010
|
-
cx: y.scrollLeft + (m.clientX - T.left),
|
|
3011
|
-
cy: y.scrollTop + (m.clientY - T.top)
|
|
3438
|
+
k || (k = document.createElement("style"), k.id = "it-doc-style-rules", document.head.appendChild(k)), k.textContent = R;
|
|
3439
|
+
}, [R]);
|
|
3440
|
+
const V = M(() => {
|
|
3441
|
+
const k = P.dir === "rtl";
|
|
3442
|
+
e(tn(t, "dir", k ? null : "rtl"));
|
|
3443
|
+
}, [t, e, P.dir]), x = M(
|
|
3444
|
+
(k) => {
|
|
3445
|
+
const w = b.current, L = (Lt) => Math.max(0, Math.round(Lt / nt * 10) / 10), Z = L(k.top ?? w.marginTop), tt = L(k.right ?? w.marginRight), K = L(k.bottom ?? w.marginBottom), kt = L(k.left ?? w.marginLeft), St = `${Z}mm ${tt}mm ${K}mm ${kt}mm`;
|
|
3446
|
+
e(_n(t, St));
|
|
3447
|
+
},
|
|
3448
|
+
[t, e]
|
|
3449
|
+
);
|
|
3450
|
+
W(() => {
|
|
3451
|
+
const k = "it-editor-theme-css";
|
|
3452
|
+
let w = document.getElementById(k);
|
|
3453
|
+
w || (w = document.createElement("style"), w.id = k, document.head.appendChild(w)), w.textContent = j;
|
|
3454
|
+
}, [j]);
|
|
3455
|
+
const _ = U(null), [G, st] = z(1), D = U(G), ut = U(null), ht = M(
|
|
3456
|
+
(k) => {
|
|
3457
|
+
const w = _.current;
|
|
3458
|
+
if (!w) return;
|
|
3459
|
+
const L = w.getBoundingClientRect();
|
|
3460
|
+
ut.current = {
|
|
3461
|
+
cx: w.scrollLeft + (k.clientX - L.left),
|
|
3462
|
+
cy: w.scrollTop + (k.clientY - L.top)
|
|
3012
3463
|
};
|
|
3013
3464
|
},
|
|
3014
3465
|
[]
|
|
3015
|
-
),
|
|
3016
|
-
const
|
|
3017
|
-
|
|
3018
|
-
cx:
|
|
3019
|
-
cy:
|
|
3466
|
+
), it = M(() => {
|
|
3467
|
+
const k = _.current;
|
|
3468
|
+
k && (ut.current = {
|
|
3469
|
+
cx: k.scrollLeft + k.clientWidth / 2,
|
|
3470
|
+
cy: k.scrollTop + k.clientHeight / 2
|
|
3020
3471
|
});
|
|
3021
3472
|
}, []);
|
|
3022
|
-
return
|
|
3023
|
-
const
|
|
3024
|
-
if (!
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3027
|
-
const
|
|
3028
|
-
|
|
3029
|
-
}, [
|
|
3030
|
-
const
|
|
3031
|
-
(
|
|
3473
|
+
return Me(() => {
|
|
3474
|
+
const k = _.current, w = ut.current, L = D.current;
|
|
3475
|
+
if (!k || !w || L === G) return;
|
|
3476
|
+
const Z = G / L;
|
|
3477
|
+
k.getBoundingClientRect();
|
|
3478
|
+
const tt = w.cx - k.scrollLeft, K = w.cy - k.scrollTop;
|
|
3479
|
+
k.scrollLeft = w.cx * Z - tt, k.scrollTop = w.cy * Z - K, ut.current = null, D.current = G;
|
|
3480
|
+
}, [G]), W(() => {
|
|
3481
|
+
const k = (w) => {
|
|
3482
|
+
if (w.metaKey || w.ctrlKey) {
|
|
3483
|
+
if (w.key === "p" || w.key === "P") {
|
|
3484
|
+
w.preventDefault(), we(t, n);
|
|
3485
|
+
return;
|
|
3486
|
+
}
|
|
3487
|
+
w.key === "=" || w.key === "+" ? (w.preventDefault(), it(), st((L) => Math.min(2, +(L + 0.1).toFixed(2)))) : w.key === "-" ? (w.preventDefault(), it(), st((L) => Math.max(0.25, +(L - 0.1).toFixed(2)))) : w.key === "0" && (w.preventDefault(), it(), st(1));
|
|
3488
|
+
}
|
|
3032
3489
|
};
|
|
3033
|
-
return window.addEventListener("keydown",
|
|
3034
|
-
}, [
|
|
3035
|
-
const
|
|
3036
|
-
if (!
|
|
3037
|
-
const
|
|
3038
|
-
if (
|
|
3039
|
-
|
|
3040
|
-
const
|
|
3041
|
-
|
|
3490
|
+
return window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k);
|
|
3491
|
+
}, [it, t, n]), W(() => {
|
|
3492
|
+
const k = _.current;
|
|
3493
|
+
if (!k) return;
|
|
3494
|
+
const w = (L) => {
|
|
3495
|
+
if (L.ctrlKey || L.metaKey) {
|
|
3496
|
+
L.preventDefault();
|
|
3497
|
+
const Z = L.deltaY > 0 ? -0.1 : 0.1;
|
|
3498
|
+
ht(L), st((tt) => Math.min(2, Math.max(0.25, +(tt + Z).toFixed(2))));
|
|
3042
3499
|
}
|
|
3043
3500
|
};
|
|
3044
|
-
return
|
|
3045
|
-
}, [
|
|
3046
|
-
|
|
3047
|
-
|
|
3501
|
+
return k.addEventListener("wheel", w, { passive: !1 }), () => k.removeEventListener("wheel", w);
|
|
3502
|
+
}, [ht]), /* @__PURE__ */ g("div", { className: "docs-container", children: [
|
|
3503
|
+
c && /* @__PURE__ */ s(
|
|
3504
|
+
Er,
|
|
3048
3505
|
{
|
|
3049
|
-
editor:
|
|
3050
|
-
isRtl:
|
|
3051
|
-
onToggleRtl:
|
|
3506
|
+
editor: y,
|
|
3507
|
+
isRtl: P.dir === "rtl",
|
|
3508
|
+
onToggleRtl: V,
|
|
3052
3509
|
content: t,
|
|
3510
|
+
onChange: e,
|
|
3053
3511
|
theme: n,
|
|
3054
3512
|
onThemeChange: r,
|
|
3055
3513
|
onTrustAction: d,
|
|
3056
|
-
|
|
3514
|
+
trust: I,
|
|
3515
|
+
sealIntact: X,
|
|
3516
|
+
locked: C
|
|
3057
3517
|
}
|
|
3058
3518
|
),
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
h.length > 0 && /* @__PURE__ */
|
|
3519
|
+
a && /* @__PURE__ */ s(Br, { trust: I, intact: X }),
|
|
3520
|
+
a && /* @__PURE__ */ s(Dr, { source: t }),
|
|
3521
|
+
h.length > 0 && /* @__PURE__ */ g("div", { className: "docs-fidelity-warning", role: "status", children: [
|
|
3062
3522
|
"⚠ Some formatting (",
|
|
3063
3523
|
h.join(", "),
|
|
3064
3524
|
") can’t be saved to",
|
|
3065
3525
|
" ",
|
|
3066
|
-
/* @__PURE__ */
|
|
3526
|
+
/* @__PURE__ */ s("code", { children: ".it" }),
|
|
3067
3527
|
" and won’t appear when printed through the template — remove it or use the toolbar’s color/size/style controls instead."
|
|
3068
3528
|
] }),
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3529
|
+
/* @__PURE__ */ s(
|
|
3530
|
+
Rr,
|
|
3531
|
+
{
|
|
3532
|
+
geometry: v,
|
|
3533
|
+
zoom: G,
|
|
3534
|
+
scrollEl: _,
|
|
3535
|
+
onMargins: x,
|
|
3536
|
+
locked: C
|
|
3537
|
+
}
|
|
3538
|
+
),
|
|
3539
|
+
/* @__PURE__ */ g("div", { className: "docs-canvas-row", children: [
|
|
3540
|
+
/* @__PURE__ */ s(
|
|
3541
|
+
Pr,
|
|
3073
3542
|
{
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
className: "docs-page-flow",
|
|
3080
|
-
dir: q.dir,
|
|
3081
|
-
style: {
|
|
3082
|
-
transform: L !== 1 ? `scale(${L})` : void 0,
|
|
3083
|
-
transformOrigin: "top left"
|
|
3084
|
-
},
|
|
3085
|
-
children: /* @__PURE__ */ b(
|
|
3086
|
-
"div",
|
|
3087
|
-
{
|
|
3088
|
-
className: "docs-page docs-sheet",
|
|
3089
|
-
ref: I,
|
|
3090
|
-
style: {
|
|
3091
|
-
width: w.width,
|
|
3092
|
-
minHeight: w.autoHeight ? w.width : void 0,
|
|
3093
|
-
"--page-mx-l": `${w.marginLeft}px`,
|
|
3094
|
-
"--page-mx-r": `${w.marginRight}px`
|
|
3095
|
-
},
|
|
3096
|
-
children: [
|
|
3097
|
-
/* @__PURE__ */ a(
|
|
3098
|
-
"div",
|
|
3099
|
-
{
|
|
3100
|
-
className: "docs-sheet-header",
|
|
3101
|
-
"data-it-spacer": "",
|
|
3102
|
-
style: { height: w.autoHeight ? void 0 : w.marginTop },
|
|
3103
|
-
children: /* @__PURE__ */ a("div", { className: "docs-pb-header", children: /* @__PURE__ */ a("span", { className: "docs-pb-text", children: w.autoHeight ? "" : ee(w.header, 1, M) }) })
|
|
3104
|
-
}
|
|
3105
|
-
),
|
|
3106
|
-
/* @__PURE__ */ a(ke, { editor: v })
|
|
3107
|
-
]
|
|
3108
|
-
}
|
|
3109
|
-
)
|
|
3110
|
-
}
|
|
3111
|
-
)
|
|
3543
|
+
geometry: v,
|
|
3544
|
+
zoom: G,
|
|
3545
|
+
scrollEl: _,
|
|
3546
|
+
onMargins: x,
|
|
3547
|
+
locked: C
|
|
3112
3548
|
}
|
|
3113
3549
|
),
|
|
3114
|
-
/* @__PURE__ */
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3550
|
+
/* @__PURE__ */ g("div", { className: "docs-canvas", ref: _, children: [
|
|
3551
|
+
/* @__PURE__ */ s(
|
|
3552
|
+
"div",
|
|
3553
|
+
{
|
|
3554
|
+
className: "docs-page-scaler",
|
|
3555
|
+
style: { width: v.width * G },
|
|
3556
|
+
children: /* @__PURE__ */ s(
|
|
3557
|
+
"div",
|
|
3558
|
+
{
|
|
3559
|
+
className: "docs-page-flow",
|
|
3560
|
+
dir: P.dir,
|
|
3561
|
+
style: {
|
|
3562
|
+
transform: G !== 1 ? `scale(${G})` : void 0,
|
|
3563
|
+
transformOrigin: "top left"
|
|
3564
|
+
},
|
|
3565
|
+
children: /* @__PURE__ */ g(
|
|
3566
|
+
"div",
|
|
3567
|
+
{
|
|
3568
|
+
className: "docs-page docs-sheet",
|
|
3569
|
+
ref: H,
|
|
3570
|
+
style: {
|
|
3571
|
+
width: v.width,
|
|
3572
|
+
minHeight: v.autoHeight ? v.width : void 0,
|
|
3573
|
+
"--page-mx-l": `${v.marginLeft}px`,
|
|
3574
|
+
"--page-mx-r": `${v.marginRight}px`
|
|
3575
|
+
},
|
|
3576
|
+
children: [
|
|
3577
|
+
/* @__PURE__ */ s(
|
|
3578
|
+
"div",
|
|
3579
|
+
{
|
|
3580
|
+
className: "docs-sheet-header",
|
|
3581
|
+
"data-it-spacer": "",
|
|
3582
|
+
style: { height: v.autoHeight ? void 0 : v.marginTop },
|
|
3583
|
+
children: /* @__PURE__ */ s("div", { className: "docs-pb-header", children: /* @__PURE__ */ s("span", { className: "docs-pb-text", children: v.autoHeight ? "" : ge(v.header, 1, S) }) })
|
|
3584
|
+
}
|
|
3585
|
+
),
|
|
3586
|
+
/* @__PURE__ */ s(ze, { editor: y })
|
|
3587
|
+
]
|
|
3588
|
+
}
|
|
3589
|
+
)
|
|
3590
|
+
}
|
|
3591
|
+
)
|
|
3592
|
+
}
|
|
3593
|
+
),
|
|
3594
|
+
/* @__PURE__ */ g("div", { className: "docs-page-footer", children: [
|
|
3595
|
+
S,
|
|
3123
3596
|
" ",
|
|
3124
|
-
"
|
|
3125
|
-
|
|
3126
|
-
"
|
|
3597
|
+
S === 1 ? "page" : "pages",
|
|
3598
|
+
" ·",
|
|
3599
|
+
" ",
|
|
3600
|
+
B(),
|
|
3601
|
+
" words",
|
|
3602
|
+
G !== 1 && /* @__PURE__ */ g("span", { className: "zoom-indicator", children: [
|
|
3603
|
+
" ",
|
|
3604
|
+
"· ",
|
|
3605
|
+
Math.round(G * 100),
|
|
3606
|
+
"%"
|
|
3607
|
+
] })
|
|
3127
3608
|
] })
|
|
3128
3609
|
] })
|
|
3129
3610
|
] })
|
|
3130
3611
|
] });
|
|
3131
3612
|
}
|
|
3132
|
-
const
|
|
3133
|
-
function
|
|
3613
|
+
const Yr = "corporate";
|
|
3614
|
+
function ho({
|
|
3134
3615
|
value: t,
|
|
3135
3616
|
onChange: e,
|
|
3136
3617
|
theme: n,
|
|
3137
3618
|
onThemeChange: r,
|
|
3138
3619
|
readOnly: o = !1,
|
|
3139
|
-
showRibbon:
|
|
3140
|
-
showTrustBanner:
|
|
3620
|
+
showRibbon: c = !0,
|
|
3621
|
+
showTrustBanner: a = !0,
|
|
3141
3622
|
onTrustAction: d
|
|
3142
3623
|
}) {
|
|
3143
|
-
const [
|
|
3144
|
-
(
|
|
3145
|
-
f
|
|
3624
|
+
const [i, m] = z(n ?? Yr), u = n ?? i, h = M(
|
|
3625
|
+
(f) => {
|
|
3626
|
+
m(f), r?.(f);
|
|
3146
3627
|
},
|
|
3147
3628
|
[r]
|
|
3148
3629
|
);
|
|
3149
|
-
return /* @__PURE__ */
|
|
3150
|
-
|
|
3630
|
+
return /* @__PURE__ */ s(
|
|
3631
|
+
Gr,
|
|
3151
3632
|
{
|
|
3152
3633
|
value: t,
|
|
3153
3634
|
onChange: e,
|
|
3154
|
-
theme:
|
|
3635
|
+
theme: u,
|
|
3155
3636
|
onThemeChange: h,
|
|
3156
3637
|
readOnly: o,
|
|
3157
|
-
showRibbon:
|
|
3158
|
-
showTrustBanner:
|
|
3638
|
+
showRibbon: c,
|
|
3639
|
+
showTrustBanner: a,
|
|
3159
3640
|
onTrustAction: d
|
|
3160
3641
|
}
|
|
3161
3642
|
);
|
|
3162
3643
|
}
|
|
3163
3644
|
export {
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3645
|
+
ho as IntentTextEditor,
|
|
3646
|
+
go as buildSampleSkeleton,
|
|
3647
|
+
Tr as builtinThemes,
|
|
3648
|
+
Kn as docToSource,
|
|
3649
|
+
wr as downloadItFile,
|
|
3650
|
+
po as exportDocumentHTML,
|
|
3651
|
+
we as exportDocumentPDF,
|
|
3652
|
+
fo as extractTemplateVariables,
|
|
3653
|
+
ce as extractTrustState,
|
|
3654
|
+
Pt as getPageGeometry,
|
|
3655
|
+
vr as printHtmlViaIframe,
|
|
3656
|
+
ge as resolvePageTokens,
|
|
3657
|
+
ee as sourceToDoc
|
|
3176
3658
|
};
|
|
3177
3659
|
//# sourceMappingURL=index.mjs.map
|