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