@pixerate/editor 0.25.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/dist/agent/index.cjs +174 -11
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +18 -4
- package/dist/agent/index.d.ts +18 -4
- package/dist/agent/index.js +167 -4
- package/dist/agent/index.js.map +1 -1
- package/dist/{arrangeShortcuts-B8O3f8-P.d.cts → arrange-BICutYPk.d.cts} +243 -29
- package/dist/{arrangeShortcuts-sLlD2rSX.d.ts → arrange-BICutYPk.d.ts} +243 -29
- package/dist/builtins-CdPcLwwF.d.cts +176 -0
- package/dist/builtins-Chj6zv_O.d.ts +176 -0
- package/dist/canvas/index.cjs +3917 -19
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +1232 -7
- package/dist/canvas/index.d.ts +1232 -7
- package/dist/canvas/index.js +3916 -18
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-3CC7OPUQ.cjs +831 -0
- package/dist/chunk-3CC7OPUQ.cjs.map +1 -0
- package/dist/{chunk-7WISYZFO.cjs → chunk-66IMF6OD.cjs} +174 -67
- package/dist/chunk-66IMF6OD.cjs.map +1 -0
- package/dist/{chunk-AL6JMGWW.cjs → chunk-CS6NZWWA.cjs} +24 -24
- package/dist/{chunk-AL6JMGWW.cjs.map → chunk-CS6NZWWA.cjs.map} +1 -1
- package/dist/{chunk-C7P22VIP.cjs → chunk-EWCOFSCQ.cjs} +17 -6
- package/dist/chunk-EWCOFSCQ.cjs.map +1 -0
- package/dist/chunk-HDYMLS3X.cjs +409 -0
- package/dist/chunk-HDYMLS3X.cjs.map +1 -0
- package/dist/{chunk-V3CHHWOE.cjs → chunk-HNDSPZ5T.cjs} +4 -4
- package/dist/{chunk-V3CHHWOE.cjs.map → chunk-HNDSPZ5T.cjs.map} +1 -1
- package/dist/{chunk-X4N4WUKB.cjs → chunk-IFHKKVXH.cjs} +150 -38
- package/dist/chunk-IFHKKVXH.cjs.map +1 -0
- package/dist/chunk-KRGXUQ2Y.js +1696 -0
- package/dist/chunk-KRGXUQ2Y.js.map +1 -0
- package/dist/{chunk-PO6A6QQH.cjs → chunk-LN2POBHT.cjs} +742 -970
- package/dist/chunk-LN2POBHT.cjs.map +1 -0
- package/dist/chunk-MR2764X2.js +831 -0
- package/dist/chunk-MR2764X2.js.map +1 -0
- package/dist/{chunk-WSQKHXW7.cjs → chunk-NQF32I6Z.cjs} +1209 -457
- package/dist/chunk-NQF32I6Z.cjs.map +1 -0
- package/dist/{chunk-NAXVVS5I.js → chunk-QJSOZFCZ.js} +2 -2
- package/dist/{chunk-UAKDG62Z.js → chunk-SWE3NPOU.js} +116 -4
- package/dist/chunk-SWE3NPOU.js.map +1 -0
- package/dist/chunk-TXXNBDQX.cjs +1696 -0
- package/dist/chunk-TXXNBDQX.cjs.map +1 -0
- package/dist/chunk-UBCFIABU.js +409 -0
- package/dist/chunk-UBCFIABU.js.map +1 -0
- package/dist/{chunk-ECCCYKGL.js → chunk-UKI64KUD.js} +147 -40
- package/dist/chunk-UKI64KUD.js.map +1 -0
- package/dist/{chunk-QGYDWPRM.js → chunk-WON34HKM.js} +2 -2
- package/dist/{chunk-RR7F5GUM.js → chunk-X7HXL2SB.js} +941 -189
- package/dist/chunk-X7HXL2SB.js.map +1 -0
- package/dist/{chunk-IXHSYOVY.js → chunk-XQFHLT53.js} +638 -866
- package/dist/chunk-XQFHLT53.js.map +1 -0
- package/dist/{chunk-FH6F67DN.js → chunk-ZRNHGAQT.js} +17 -6
- package/dist/{chunk-FH6F67DN.js.map → chunk-ZRNHGAQT.js.map} +1 -1
- package/dist/commands/index.cjs +352 -4
- package/dist/commands/index.cjs.map +1 -1
- package/dist/commands/index.d.cts +37 -108
- package/dist/commands/index.d.ts +37 -108
- package/dist/commands/index.js +351 -3
- package/dist/commands/index.js.map +1 -1
- package/dist/compare/index.cjs +3 -3
- package/dist/compare/index.js +2 -2
- package/dist/{controller-BIJiNoVs.d.cts → controller-CxXGOEmy.d.cts} +209 -13
- package/dist/{controller-BIJiNoVs.d.ts → controller-CxXGOEmy.d.ts} +209 -13
- package/dist/export/index.cjs +36 -0
- package/dist/export/index.cjs.map +1 -0
- package/dist/export/index.d.cts +243 -0
- package/dist/export/index.d.ts +243 -0
- package/dist/export/index.js +36 -0
- package/dist/export/index.js.map +1 -0
- package/dist/extensions/index.cjs +54 -6
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +7 -2
- package/dist/extensions/index.d.ts +7 -2
- package/dist/extensions/index.js +59 -11
- package/dist/{index-7a6bHTLy.d.ts → index-B273Zllk.d.ts} +211 -207
- package/dist/{index-Csd5qI8u.d.cts → index-jcJwmBYt.d.cts} +211 -207
- package/dist/index.cjs +146 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -14
- package/dist/index.d.ts +50 -14
- package/dist/index.js +138 -24
- package/dist/index.js.map +1 -1
- package/dist/registry-CED5C0lA.d.cts +204 -0
- package/dist/registry-CED5C0lA.d.ts +204 -0
- package/dist/{registry-D32LpIc4.d.cts → registry-D0GADKc7.d.cts} +1 -1
- package/dist/{registry-evKTP4ls.d.ts → registry-DhVUZioj.d.ts} +1 -1
- package/dist/serializers/index.cjs +6 -4
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +15 -4
- package/dist/serializers/index.d.ts +15 -4
- package/dist/serializers/index.js +5 -3
- package/dist/spreadsheet/index.cjs +33 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +106 -3
- package/dist/spreadsheet/index.d.ts +106 -3
- package/dist/spreadsheet/index.js +32 -2
- package/package.json +10 -1
- package/dist/chunk-7WISYZFO.cjs.map +0 -1
- package/dist/chunk-C7P22VIP.cjs.map +0 -1
- package/dist/chunk-ECCCYKGL.js.map +0 -1
- package/dist/chunk-IXHSYOVY.js.map +0 -1
- package/dist/chunk-PO6A6QQH.cjs.map +0 -1
- package/dist/chunk-RR7F5GUM.js.map +0 -1
- package/dist/chunk-UAKDG62Z.js.map +0 -1
- package/dist/chunk-WSQKHXW7.cjs.map +0 -1
- package/dist/chunk-X4N4WUKB.cjs.map +0 -1
- package/dist/types-DX4Mh4SL.d.cts +0 -217
- package/dist/types-DX4Mh4SL.d.ts +0 -217
- /package/dist/{chunk-NAXVVS5I.js.map → chunk-QJSOZFCZ.js.map} +0 -0
- /package/dist/{chunk-QGYDWPRM.js.map → chunk-WON34HKM.js.map} +0 -0
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkCS6NZWWAcjs = require('./chunk-CS6NZWWA.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunk3CC7OPUQcjs = require('./chunk-3CC7OPUQ.cjs');
|
|
4
11
|
|
|
5
12
|
|
|
6
13
|
|
|
@@ -16,20 +23,29 @@ var _chunkMKA3AHLVcjs = require('./chunk-MKA3AHLV.cjs');
|
|
|
16
23
|
|
|
17
24
|
|
|
18
25
|
|
|
19
|
-
var
|
|
26
|
+
var _chunkHNDSPZ5Tcjs = require('./chunk-HNDSPZ5T.cjs');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
20
32
|
|
|
21
33
|
|
|
22
34
|
|
|
35
|
+
var _chunkHDYMLS3Xcjs = require('./chunk-HDYMLS3X.cjs');
|
|
23
36
|
|
|
24
37
|
|
|
25
|
-
var _chunk7WISYZFOcjs = require('./chunk-7WISYZFO.cjs');
|
|
26
38
|
|
|
27
39
|
|
|
28
40
|
|
|
41
|
+
var _chunk66IMF6ODcjs = require('./chunk-66IMF6OD.cjs');
|
|
29
42
|
|
|
30
43
|
|
|
31
44
|
|
|
32
|
-
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
var _chunkIFHKKVXHcjs = require('./chunk-IFHKKVXH.cjs');
|
|
33
49
|
|
|
34
50
|
// src/extensions/gradient-text.ts
|
|
35
51
|
var _core = require('@tiptap/core');
|
|
@@ -1908,7 +1924,7 @@ var Comments = _core.Mark.create({
|
|
|
1908
1924
|
},
|
|
1909
1925
|
addStorage() {
|
|
1910
1926
|
return {
|
|
1911
|
-
store: _nullishCoalesce(this.options.store, () => ( new (0,
|
|
1927
|
+
store: _nullishCoalesce(this.options.store, () => ( new (0, _chunkIFHKKVXHcjs.CommentStore)())),
|
|
1912
1928
|
// tiptap-markdown: comments are not part of the exported markdown.
|
|
1913
1929
|
markdown: { serialize: { open: "", close: "" }, parse: {} }
|
|
1914
1930
|
};
|
|
@@ -1935,7 +1951,7 @@ var Comments = _core.Mark.create({
|
|
|
1935
1951
|
const { from, to, empty } = state.selection;
|
|
1936
1952
|
if (empty) return false;
|
|
1937
1953
|
if (dispatch) {
|
|
1938
|
-
const id = _nullishCoalesce(options.id, () => (
|
|
1954
|
+
const id = _nullishCoalesce(options.id, () => ( _chunkIFHKKVXHcjs.createReviewId.call(void 0, "comment")));
|
|
1939
1955
|
tr.addMark(from, to, this.type.create({ commentId: id }));
|
|
1940
1956
|
tr.setMeta(commentsPluginKey, "refresh");
|
|
1941
1957
|
store().createThread({
|
|
@@ -2076,10 +2092,10 @@ function getCommentAuthor(editor) {
|
|
|
2076
2092
|
// src/extensions/document-compare.ts
|
|
2077
2093
|
|
|
2078
2094
|
function trackChangesAuthor(state) {
|
|
2079
|
-
return _optionalChain([
|
|
2095
|
+
return _optionalChain([_chunkIFHKKVXHcjs.trackChangesPluginKey, 'access', _75 => _75.getState, 'call', _76 => _76(state), 'optionalAccess', _77 => _77.author]);
|
|
2080
2096
|
}
|
|
2081
2097
|
function compareInEditor(editor, original, revised, options = {}) {
|
|
2082
|
-
return
|
|
2098
|
+
return _chunkCS6NZWWAcjs.compareDocuments.call(void 0, original, revised, {
|
|
2083
2099
|
...options,
|
|
2084
2100
|
author: _nullishCoalesce(options.author, () => ( trackChangesAuthor(editor.state))),
|
|
2085
2101
|
schema: editor.schema
|
|
@@ -2089,7 +2105,7 @@ function applyDocumentComparison(editor, original, revised, options = {}) {
|
|
|
2089
2105
|
const result = compareInEditor(editor, original, revised, options);
|
|
2090
2106
|
const { state } = editor;
|
|
2091
2107
|
const tr = state.tr.replaceWith(0, state.doc.content.size, result.doc.content);
|
|
2092
|
-
tr.setMeta(
|
|
2108
|
+
tr.setMeta(_chunkIFHKKVXHcjs.TRACK_CHANGES_SKIP_META, true);
|
|
2093
2109
|
editor.view.dispatch(tr);
|
|
2094
2110
|
return result;
|
|
2095
2111
|
}
|
|
@@ -2105,14 +2121,14 @@ var DocumentCompare = _core.Extension.create({
|
|
|
2105
2121
|
return {
|
|
2106
2122
|
setContentFromComparison: (original, revised, options = {}) => ({ state, tr, dispatch }) => {
|
|
2107
2123
|
const merged = { ...this.options.compare, ...options };
|
|
2108
|
-
const result =
|
|
2124
|
+
const result = _chunkCS6NZWWAcjs.compareDocuments.call(void 0, original, revised, {
|
|
2109
2125
|
...merged,
|
|
2110
2126
|
author: _nullishCoalesce(merged.author, () => ( trackChangesAuthor(state))),
|
|
2111
2127
|
schema: state.schema
|
|
2112
2128
|
});
|
|
2113
2129
|
if (dispatch) {
|
|
2114
2130
|
tr.replaceWith(0, tr.doc.content.size, result.doc.content);
|
|
2115
|
-
tr.setMeta(
|
|
2131
|
+
tr.setMeta(_chunkIFHKKVXHcjs.TRACK_CHANGES_SKIP_META, true);
|
|
2116
2132
|
this.storage.lastResult = result;
|
|
2117
2133
|
}
|
|
2118
2134
|
return true;
|
|
@@ -2310,319 +2326,6 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
|
|
|
2310
2326
|
}
|
|
2311
2327
|
}, _class);
|
|
2312
2328
|
|
|
2313
|
-
// src/import/zip.ts
|
|
2314
|
-
var ZipError = class extends Error {
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
constructor(code, message, details = {}) {
|
|
2318
|
-
super(message, details.cause !== void 0 ? { cause: details.cause } : void 0);
|
|
2319
|
-
this.name = "ZipError";
|
|
2320
|
-
this.code = code;
|
|
2321
|
-
this.entryName = details.entryName;
|
|
2322
|
-
}
|
|
2323
|
-
};
|
|
2324
|
-
var DEFAULT_ZIP_MAX_ENTRIES = 1e4;
|
|
2325
|
-
var DEFAULT_ZIP_MAX_TOTAL_SIZE = 256 * 1024 * 1024;
|
|
2326
|
-
var SIG_EOCD = 101010256;
|
|
2327
|
-
var SIG_ZIP64_EOCD = 101075792;
|
|
2328
|
-
var SIG_ZIP64_LOCATOR = 117853008;
|
|
2329
|
-
var SIG_CENTRAL = 33639248;
|
|
2330
|
-
var SIG_LOCAL = 67324752;
|
|
2331
|
-
var EOCD_SIZE = 22;
|
|
2332
|
-
var MAX_COMMENT = 65535;
|
|
2333
|
-
var crcTable = null;
|
|
2334
|
-
function zipCrc32(data) {
|
|
2335
|
-
if (!crcTable) {
|
|
2336
|
-
crcTable = new Uint32Array(256);
|
|
2337
|
-
for (let n = 0; n < 256; n++) {
|
|
2338
|
-
let c = n;
|
|
2339
|
-
for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
2340
|
-
crcTable[n] = c >>> 0;
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
let crc = 4294967295;
|
|
2344
|
-
for (let i = 0; i < data.length; i++) crc = crcTable[(crc ^ data[i]) & 255] ^ crc >>> 8;
|
|
2345
|
-
return (crc ^ 4294967295) >>> 0;
|
|
2346
|
-
}
|
|
2347
|
-
function toBytes(data) {
|
|
2348
|
-
if (ArrayBuffer.isView(data)) return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
2349
|
-
return new Uint8Array(data);
|
|
2350
|
-
}
|
|
2351
|
-
function isUnsafeZipPath(name) {
|
|
2352
|
-
if (!name || name.includes("\0")) return true;
|
|
2353
|
-
const normalized = name.replace(/\\/g, "/");
|
|
2354
|
-
if (normalized.startsWith("/") || /^[a-zA-Z]:/.test(normalized)) return true;
|
|
2355
|
-
return normalized.split("/").some((segment) => segment === "..");
|
|
2356
|
-
}
|
|
2357
|
-
var utf8 = new TextDecoder("utf-8");
|
|
2358
|
-
var CP437_HIGH = "\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0\xA0";
|
|
2359
|
-
function decodeName(bytes, isUtf8) {
|
|
2360
|
-
if (isUtf8 || bytes.every((b) => b < 128)) return utf8.decode(bytes);
|
|
2361
|
-
let out = "";
|
|
2362
|
-
for (const b of bytes) out += b < 128 ? String.fromCharCode(b) : CP437_HIGH[b - 128];
|
|
2363
|
-
return out;
|
|
2364
|
-
}
|
|
2365
|
-
var ZipArchive = (_class2 = class {
|
|
2366
|
-
constructor(bytes, entries, maxTotalSize) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);
|
|
2367
|
-
this.bytes = bytes;
|
|
2368
|
-
this.maxTotalSize = maxTotalSize;
|
|
2369
|
-
this.entries = entries;
|
|
2370
|
-
entries.forEach((entry) => {
|
|
2371
|
-
if (!this.byName.has(entry.name)) this.byName.set(entry.name, entry);
|
|
2372
|
-
});
|
|
2373
|
-
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
/** Entries in central-directory order. */
|
|
2377
|
-
|
|
2378
|
-
__init2() {this.byName = /* @__PURE__ */ new Map()}
|
|
2379
|
-
__init3() {this.extracted = 0}
|
|
2380
|
-
/** Looks up an entry by exact name (a leading `/` is ignored). */
|
|
2381
|
-
get(name) {
|
|
2382
|
-
return this.byName.get(name.replace(/^\/+/, ""));
|
|
2383
|
-
}
|
|
2384
|
-
has(name) {
|
|
2385
|
-
return !!this.get(name);
|
|
2386
|
-
}
|
|
2387
|
-
/** Uncompressed bytes extracted so far (counted against `maxTotalSize`). */
|
|
2388
|
-
get extractedSize() {
|
|
2389
|
-
return this.extracted;
|
|
2390
|
-
}
|
|
2391
|
-
/** Extracts an entry's data, verifying its size and CRC-32. */
|
|
2392
|
-
async read(entryOrName) {
|
|
2393
|
-
const entry = typeof entryOrName === "string" ? this.get(entryOrName) : entryOrName;
|
|
2394
|
-
if (!entry) {
|
|
2395
|
-
throw new ZipError("entry_not_found", `ZIP entry "${String(entryOrName)}" not found.`, {
|
|
2396
|
-
entryName: String(entryOrName)
|
|
2397
|
-
});
|
|
2398
|
-
}
|
|
2399
|
-
const name = entry.name;
|
|
2400
|
-
if (entry.encrypted) {
|
|
2401
|
-
throw new ZipError("encrypted", `ZIP entry "${name}" is encrypted; encrypted archives are not supported.`, {
|
|
2402
|
-
entryName: name
|
|
2403
|
-
});
|
|
2404
|
-
}
|
|
2405
|
-
if (entry.isDirectory) return new Uint8Array(0);
|
|
2406
|
-
const remaining = this.maxTotalSize - this.extracted;
|
|
2407
|
-
if (entry.size > remaining) {
|
|
2408
|
-
throw new ZipError(
|
|
2409
|
-
"too_large",
|
|
2410
|
-
`Extracting "${name}" (${entry.size} bytes) would exceed the ${this.maxTotalSize}-byte limit.`,
|
|
2411
|
-
{ entryName: name }
|
|
2412
|
-
);
|
|
2413
|
-
}
|
|
2414
|
-
const { bytes } = this;
|
|
2415
|
-
const offset = entry.localHeaderOffset;
|
|
2416
|
-
if (offset + 30 > bytes.length || readU32(bytes, offset) !== SIG_LOCAL) {
|
|
2417
|
-
throw new ZipError("corrupt_entry", `ZIP entry "${name}" has no valid local header.`, { entryName: name });
|
|
2418
|
-
}
|
|
2419
|
-
const dataStart = offset + 30 + readU16(bytes, offset + 26) + readU16(bytes, offset + 28);
|
|
2420
|
-
const dataEnd = dataStart + entry.compressedSize;
|
|
2421
|
-
if (dataEnd > bytes.length) {
|
|
2422
|
-
throw new ZipError("corrupt_entry", `ZIP entry "${name}" is truncated.`, { entryName: name });
|
|
2423
|
-
}
|
|
2424
|
-
const raw = bytes.subarray(dataStart, dataEnd);
|
|
2425
|
-
let data;
|
|
2426
|
-
if (entry.method === 0) {
|
|
2427
|
-
if (entry.compressedSize !== entry.size) {
|
|
2428
|
-
throw new ZipError("corrupt_entry", `Stored ZIP entry "${name}" has inconsistent sizes.`, { entryName: name });
|
|
2429
|
-
}
|
|
2430
|
-
data = raw.slice();
|
|
2431
|
-
} else if (entry.method === 8) {
|
|
2432
|
-
data = await inflateRaw(raw, entry.size, name);
|
|
2433
|
-
} else {
|
|
2434
|
-
throw new ZipError(
|
|
2435
|
-
"unsupported_feature",
|
|
2436
|
-
`ZIP entry "${name}" uses unsupported compression method ${entry.method}; only stored and deflate are supported.`,
|
|
2437
|
-
{ entryName: name }
|
|
2438
|
-
);
|
|
2439
|
-
}
|
|
2440
|
-
if (data.length !== entry.size) {
|
|
2441
|
-
throw new ZipError("corrupt_entry", `ZIP entry "${name}" size does not match the directory.`, { entryName: name });
|
|
2442
|
-
}
|
|
2443
|
-
this.extracted += data.length;
|
|
2444
|
-
if (zipCrc32(data) !== entry.crc32) {
|
|
2445
|
-
throw new ZipError("corrupt_entry", `ZIP entry "${name}" failed its CRC-32 check.`, { entryName: name });
|
|
2446
|
-
}
|
|
2447
|
-
return data;
|
|
2448
|
-
}
|
|
2449
|
-
/** Extracts an entry and decodes it as UTF-8 (a leading BOM is removed). */
|
|
2450
|
-
async readText(entryOrName) {
|
|
2451
|
-
const text = utf8.decode(await this.read(entryOrName));
|
|
2452
|
-
return text.charCodeAt(0) === 65279 ? text.slice(1) : text;
|
|
2453
|
-
}
|
|
2454
|
-
}, _class2);
|
|
2455
|
-
function readU16(bytes, offset) {
|
|
2456
|
-
return bytes[offset] | bytes[offset + 1] << 8;
|
|
2457
|
-
}
|
|
2458
|
-
function readU32(bytes, offset) {
|
|
2459
|
-
return (bytes[offset] | bytes[offset + 1] << 8 | bytes[offset + 2] << 16 | bytes[offset + 3] << 24) >>> 0;
|
|
2460
|
-
}
|
|
2461
|
-
function readU64(bytes, offset) {
|
|
2462
|
-
const value = readU32(bytes, offset) + readU32(bytes, offset + 4) * 4294967296;
|
|
2463
|
-
if (!Number.isSafeInteger(value)) {
|
|
2464
|
-
throw new ZipError("unsupported_feature", "ZIP64 value exceeds the supported range.");
|
|
2465
|
-
}
|
|
2466
|
-
return value;
|
|
2467
|
-
}
|
|
2468
|
-
async function inflateRaw(raw, limit, entryName) {
|
|
2469
|
-
const Stream = globalThis.DecompressionStream;
|
|
2470
|
-
if (typeof Stream !== "function") {
|
|
2471
|
-
throw new ZipError(
|
|
2472
|
-
"unsupported_environment",
|
|
2473
|
-
"Inflating ZIP entries needs DecompressionStream (modern browsers, Node 18+).",
|
|
2474
|
-
{ entryName }
|
|
2475
|
-
);
|
|
2476
|
-
}
|
|
2477
|
-
const stream = new Stream("deflate-raw");
|
|
2478
|
-
const writer = stream.writable.getWriter();
|
|
2479
|
-
const reader = stream.readable.getReader();
|
|
2480
|
-
const CHUNK = 64 * 1024;
|
|
2481
|
-
const feeding = (async () => {
|
|
2482
|
-
for (let i = 0; i < raw.length; i += CHUNK) await writer.write(raw.subarray(i, i + CHUNK));
|
|
2483
|
-
await writer.close();
|
|
2484
|
-
})();
|
|
2485
|
-
feeding.catch(() => {
|
|
2486
|
-
});
|
|
2487
|
-
const chunks = [];
|
|
2488
|
-
let total = 0;
|
|
2489
|
-
try {
|
|
2490
|
-
for (; ; ) {
|
|
2491
|
-
const { done, value } = await reader.read();
|
|
2492
|
-
if (done) break;
|
|
2493
|
-
total += value.length;
|
|
2494
|
-
if (total > limit) {
|
|
2495
|
-
throw new ZipError(
|
|
2496
|
-
"corrupt_entry",
|
|
2497
|
-
`ZIP entry "${entryName}" inflates beyond its declared size of ${limit} bytes.`,
|
|
2498
|
-
{ entryName }
|
|
2499
|
-
);
|
|
2500
|
-
}
|
|
2501
|
-
chunks.push(value);
|
|
2502
|
-
}
|
|
2503
|
-
} catch (error) {
|
|
2504
|
-
reader.cancel().catch(() => {
|
|
2505
|
-
});
|
|
2506
|
-
writer.abort().catch(() => {
|
|
2507
|
-
});
|
|
2508
|
-
if (error instanceof ZipError) throw error;
|
|
2509
|
-
throw new ZipError("corrupt_entry", `ZIP entry "${entryName}" has an invalid deflate stream.`, {
|
|
2510
|
-
entryName,
|
|
2511
|
-
cause: error
|
|
2512
|
-
});
|
|
2513
|
-
}
|
|
2514
|
-
await feeding.catch(() => {
|
|
2515
|
-
});
|
|
2516
|
-
const out = new Uint8Array(total);
|
|
2517
|
-
let pos = 0;
|
|
2518
|
-
for (const chunk of chunks) {
|
|
2519
|
-
out.set(chunk, pos);
|
|
2520
|
-
pos += chunk.length;
|
|
2521
|
-
}
|
|
2522
|
-
return out;
|
|
2523
|
-
}
|
|
2524
|
-
function findEndOfCentralDirectory(bytes) {
|
|
2525
|
-
const min = Math.max(0, bytes.length - EOCD_SIZE - MAX_COMMENT);
|
|
2526
|
-
for (let i = bytes.length - EOCD_SIZE; i >= min; i--) {
|
|
2527
|
-
if (readU32(bytes, i) === SIG_EOCD && i + EOCD_SIZE + readU16(bytes, i + 20) <= bytes.length) return i;
|
|
2528
|
-
}
|
|
2529
|
-
return -1;
|
|
2530
|
-
}
|
|
2531
|
-
async function readZip(data, options = {}) {
|
|
2532
|
-
const bytes = toBytes(data);
|
|
2533
|
-
const maxEntries = _nullishCoalesce(options.maxEntries, () => ( DEFAULT_ZIP_MAX_ENTRIES));
|
|
2534
|
-
const maxTotalSize = _nullishCoalesce(options.maxTotalSize, () => ( DEFAULT_ZIP_MAX_TOTAL_SIZE));
|
|
2535
|
-
const eocd = findEndOfCentralDirectory(bytes);
|
|
2536
|
-
if (eocd < 0) throw new ZipError("invalid_archive", "Not a ZIP archive (no end of central directory record).");
|
|
2537
|
-
let diskNumber = readU16(bytes, eocd + 4);
|
|
2538
|
-
let cdDisk = readU16(bytes, eocd + 6);
|
|
2539
|
-
let count = readU16(bytes, eocd + 10);
|
|
2540
|
-
let cdSize = readU32(bytes, eocd + 12);
|
|
2541
|
-
let cdOffset = readU32(bytes, eocd + 16);
|
|
2542
|
-
if (count === 65535 || cdSize === 4294967295 || cdOffset === 4294967295) {
|
|
2543
|
-
const locator = eocd - 20;
|
|
2544
|
-
if (locator < 0 || readU32(bytes, locator) !== SIG_ZIP64_LOCATOR) {
|
|
2545
|
-
throw new ZipError("invalid_archive", "ZIP64 archive is missing its end of central directory locator.");
|
|
2546
|
-
}
|
|
2547
|
-
const record = readU64(bytes, locator + 8);
|
|
2548
|
-
if (record + 56 > bytes.length || readU32(bytes, record) !== SIG_ZIP64_EOCD) {
|
|
2549
|
-
throw new ZipError("invalid_archive", "ZIP64 end of central directory record not found.");
|
|
2550
|
-
}
|
|
2551
|
-
diskNumber = readU32(bytes, record + 16);
|
|
2552
|
-
cdDisk = readU32(bytes, record + 20);
|
|
2553
|
-
count = readU64(bytes, record + 32);
|
|
2554
|
-
cdSize = readU64(bytes, record + 40);
|
|
2555
|
-
cdOffset = readU64(bytes, record + 48);
|
|
2556
|
-
}
|
|
2557
|
-
if (diskNumber !== 0 || cdDisk !== 0) {
|
|
2558
|
-
throw new ZipError("unsupported_feature", "Multi-disk (spanned) ZIP archives are not supported.");
|
|
2559
|
-
}
|
|
2560
|
-
if (count > maxEntries) {
|
|
2561
|
-
throw new ZipError("too_many_entries", `ZIP archive has ${count} entries; the limit is ${maxEntries}.`);
|
|
2562
|
-
}
|
|
2563
|
-
if (cdOffset + cdSize > bytes.length) {
|
|
2564
|
-
throw new ZipError("invalid_archive", "ZIP central directory lies outside the file.");
|
|
2565
|
-
}
|
|
2566
|
-
const entries = [];
|
|
2567
|
-
let p = cdOffset;
|
|
2568
|
-
for (let i = 0; i < count; i++) {
|
|
2569
|
-
if (p + 46 > bytes.length || readU32(bytes, p) !== SIG_CENTRAL) {
|
|
2570
|
-
throw new ZipError("invalid_archive", "ZIP central directory is corrupt.");
|
|
2571
|
-
}
|
|
2572
|
-
const flags = readU16(bytes, p + 8);
|
|
2573
|
-
const method = readU16(bytes, p + 10);
|
|
2574
|
-
const crc32 = readU32(bytes, p + 16);
|
|
2575
|
-
let compressedSize = readU32(bytes, p + 20);
|
|
2576
|
-
let size = readU32(bytes, p + 24);
|
|
2577
|
-
const nameLength = readU16(bytes, p + 28);
|
|
2578
|
-
const extraLength = readU16(bytes, p + 30);
|
|
2579
|
-
const commentLength = readU16(bytes, p + 32);
|
|
2580
|
-
let localHeaderOffset = readU32(bytes, p + 42);
|
|
2581
|
-
const nameStart = p + 46;
|
|
2582
|
-
const extraStart = nameStart + nameLength;
|
|
2583
|
-
const next = extraStart + extraLength + commentLength;
|
|
2584
|
-
if (next > bytes.length) throw new ZipError("invalid_archive", "ZIP central directory is truncated.");
|
|
2585
|
-
for (let e = extraStart; e + 4 <= extraStart + extraLength; ) {
|
|
2586
|
-
const id = readU16(bytes, e);
|
|
2587
|
-
const len = readU16(bytes, e + 2);
|
|
2588
|
-
if (id === 1) {
|
|
2589
|
-
let f = e + 4;
|
|
2590
|
-
const end = f + len;
|
|
2591
|
-
if (size === 4294967295 && f + 8 <= end) {
|
|
2592
|
-
size = readU64(bytes, f);
|
|
2593
|
-
f += 8;
|
|
2594
|
-
}
|
|
2595
|
-
if (compressedSize === 4294967295 && f + 8 <= end) {
|
|
2596
|
-
compressedSize = readU64(bytes, f);
|
|
2597
|
-
f += 8;
|
|
2598
|
-
}
|
|
2599
|
-
if (localHeaderOffset === 4294967295 && f + 8 <= end) localHeaderOffset = readU64(bytes, f);
|
|
2600
|
-
}
|
|
2601
|
-
e += 4 + len;
|
|
2602
|
-
}
|
|
2603
|
-
const rawName = decodeName(bytes.subarray(nameStart, extraStart), (flags & 2048) !== 0);
|
|
2604
|
-
const name = rawName.replace(/\\/g, "/");
|
|
2605
|
-
p = next;
|
|
2606
|
-
if (isUnsafeZipPath(rawName)) {
|
|
2607
|
-
if (options.unsafePaths === "skip") continue;
|
|
2608
|
-
throw new ZipError("unsafe_path", `ZIP entry name "${rawName}" is absolute or escapes the archive root.`, {
|
|
2609
|
-
entryName: rawName
|
|
2610
|
-
});
|
|
2611
|
-
}
|
|
2612
|
-
entries.push({
|
|
2613
|
-
name,
|
|
2614
|
-
isDirectory: name.endsWith("/"),
|
|
2615
|
-
encrypted: (flags & 1) !== 0,
|
|
2616
|
-
method,
|
|
2617
|
-
compressedSize,
|
|
2618
|
-
size,
|
|
2619
|
-
crc32,
|
|
2620
|
-
localHeaderOffset
|
|
2621
|
-
});
|
|
2622
|
-
}
|
|
2623
|
-
return new ZipArchive(bytes, entries, maxTotalSize);
|
|
2624
|
-
}
|
|
2625
|
-
|
|
2626
2329
|
// src/import/docx.ts
|
|
2627
2330
|
var DOCX_MIME_TYPES = [
|
|
2628
2331
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
@@ -2630,6 +2333,8 @@ var DOCX_MIME_TYPES = [
|
|
|
2630
2333
|
"application/vnd.ms-word.document.macroenabled.12"
|
|
2631
2334
|
];
|
|
2632
2335
|
var DEFAULT_DOCX_MAX_IMAGE_SIZE = 10 * 1024 * 1024;
|
|
2336
|
+
var MAX_COMMENTS = 5e3;
|
|
2337
|
+
var MAX_PARENT_CHAIN = 64;
|
|
2633
2338
|
var W_NAMESPACES = /* @__PURE__ */ new Set([
|
|
2634
2339
|
"http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
2635
2340
|
"http://purl.oclc.org/ooxml/wordprocessingml/main"
|
|
@@ -2642,6 +2347,7 @@ var IMAGE_MIME_TYPES = {
|
|
|
2642
2347
|
gif: "image/gif",
|
|
2643
2348
|
webp: "image/webp"
|
|
2644
2349
|
};
|
|
2350
|
+
var TASK_GLYPHS = { "\u2610": false, "\u2612": true, "\u2611": true };
|
|
2645
2351
|
function isW(node, localName) {
|
|
2646
2352
|
if (!node || node.nodeType !== 1) return false;
|
|
2647
2353
|
const el = node;
|
|
@@ -2778,6 +2484,65 @@ function readNumPr(pPr) {
|
|
|
2778
2484
|
if (numId === void 0) return void 0;
|
|
2779
2485
|
return { numId, ilvl: Number(_nullishCoalesce(attr(wChild(numPr, "ilvl"), "val"), () => ( 0))) || 0 };
|
|
2780
2486
|
}
|
|
2487
|
+
function twipsToCss(value) {
|
|
2488
|
+
const n = Number(value);
|
|
2489
|
+
return value !== void 0 && value !== "" && Number.isFinite(n) ? `${Math.round(n / 20 * 100) / 100}pt` : void 0;
|
|
2490
|
+
}
|
|
2491
|
+
var ALIGNMENTS = {
|
|
2492
|
+
left: "left",
|
|
2493
|
+
start: "left",
|
|
2494
|
+
center: "center",
|
|
2495
|
+
right: "right",
|
|
2496
|
+
end: "right",
|
|
2497
|
+
both: "justify",
|
|
2498
|
+
distribute: "justify"
|
|
2499
|
+
};
|
|
2500
|
+
function readParagraphFormat(pPr) {
|
|
2501
|
+
const format = {};
|
|
2502
|
+
if (!pPr) return format;
|
|
2503
|
+
const jc = attr(wChild(pPr, "jc"), "val");
|
|
2504
|
+
if (jc && ALIGNMENTS[jc]) format.textAlign = ALIGNMENTS[jc];
|
|
2505
|
+
const spacing = wChild(pPr, "spacing");
|
|
2506
|
+
const before = twipsToCss(attr(spacing, "before"));
|
|
2507
|
+
const after = twipsToCss(attr(spacing, "after"));
|
|
2508
|
+
if (before) format.spaceBefore = before;
|
|
2509
|
+
if (after) format.spaceAfter = after;
|
|
2510
|
+
const line = Number(attr(spacing, "line"));
|
|
2511
|
+
if (Number.isFinite(line) && line > 0) {
|
|
2512
|
+
const rule = _nullishCoalesce(attr(spacing, "lineRule"), () => ( "auto"));
|
|
2513
|
+
format.lineHeight = rule === "auto" ? String(Math.round(line / 240 * 100) / 100) : twipsToCss(String(line));
|
|
2514
|
+
}
|
|
2515
|
+
const ind = wChild(pPr, "ind");
|
|
2516
|
+
const left = twipsToCss(_nullishCoalesce(attr(ind, "left"), () => ( attr(ind, "start"))));
|
|
2517
|
+
const right = twipsToCss(_nullishCoalesce(attr(ind, "right"), () => ( attr(ind, "end"))));
|
|
2518
|
+
const first = attr(ind, "firstLine");
|
|
2519
|
+
const hanging = attr(ind, "hanging");
|
|
2520
|
+
if (left) format.indentLeft = left;
|
|
2521
|
+
if (right) format.indentRight = right;
|
|
2522
|
+
if (first !== void 0) format.indentFirstLine = twipsToCss(first);
|
|
2523
|
+
else if (hanging !== void 0 && Number.isFinite(Number(hanging))) format.indentFirstLine = twipsToCss(String(-Number(hanging)));
|
|
2524
|
+
return format;
|
|
2525
|
+
}
|
|
2526
|
+
function readCharacterFormat(rPr) {
|
|
2527
|
+
const format = {};
|
|
2528
|
+
if (!rPr) return format;
|
|
2529
|
+
const f = readFormat(rPr);
|
|
2530
|
+
if (f.b !== void 0) format.bold = f.b;
|
|
2531
|
+
if (f.i !== void 0) format.italic = f.i;
|
|
2532
|
+
if (f.u !== void 0) format.underline = f.u;
|
|
2533
|
+
if (f.s !== void 0) format.strike = f.s;
|
|
2534
|
+
const fonts = wChild(rPr, "rFonts");
|
|
2535
|
+
const font = _nullishCoalesce(attr(fonts, "ascii"), () => ( attr(fonts, "hAnsi")));
|
|
2536
|
+
if (font && /^[\w .-]{1,64}$/.test(font)) format.fontFamily = font;
|
|
2537
|
+
const size = Number(attr(wChild(rPr, "sz"), "val"));
|
|
2538
|
+
if (Number.isFinite(size) && size > 0 && size < 3300) format.fontSize = `${size / 2}pt`;
|
|
2539
|
+
const color = attr(wChild(rPr, "color"), "val");
|
|
2540
|
+
if (color && /^[0-9a-f]{6}$/i.test(color)) format.color = `#${color.toLowerCase()}`;
|
|
2541
|
+
if (toggle(wChild(rPr, "caps"))) format.textTransform = "uppercase";
|
|
2542
|
+
const smallCaps = toggle(wChild(rPr, "smallCaps"));
|
|
2543
|
+
if (smallCaps !== void 0) format.smallCaps = smallCaps;
|
|
2544
|
+
return format;
|
|
2545
|
+
}
|
|
2781
2546
|
function readStyles(doc) {
|
|
2782
2547
|
const styles = /* @__PURE__ */ new Map();
|
|
2783
2548
|
if (!doc) return styles;
|
|
@@ -2785,17 +2550,85 @@ function readStyles(doc) {
|
|
|
2785
2550
|
const id = attr(style, "styleId");
|
|
2786
2551
|
if (!id) return;
|
|
2787
2552
|
const pPr = wChild(style, "pPr");
|
|
2553
|
+
const rPr = wChild(style, "rPr");
|
|
2788
2554
|
const outline = attr(wChild(pPr, "outlineLvl"), "val");
|
|
2555
|
+
const priority = Number(attr(wChild(style, "uiPriority"), "val"));
|
|
2789
2556
|
styles.set(id, {
|
|
2790
2557
|
name: _nullishCoalesce(attr(wChild(style, "name"), "val"), () => ( id)),
|
|
2558
|
+
type: _nullishCoalesce(attr(style, "type"), () => ( "paragraph")),
|
|
2791
2559
|
basedOn: attr(wChild(style, "basedOn"), "val"),
|
|
2560
|
+
next: attr(wChild(style, "next"), "val"),
|
|
2561
|
+
link: attr(wChild(style, "link"), "val"),
|
|
2562
|
+
priority: Number.isFinite(priority) && attr(wChild(style, "uiPriority"), "val") !== void 0 ? priority : void 0,
|
|
2563
|
+
quick: toggle(wChild(style, "qFormat")),
|
|
2564
|
+
hidden: toggle(wChild(style, "semiHidden")) || toggle(wChild(style, "hidden")),
|
|
2792
2565
|
outlineLevel: outline !== void 0 ? Number(outline) : void 0,
|
|
2793
2566
|
numPr: readNumPr(pPr),
|
|
2794
|
-
format: readFormat(
|
|
2567
|
+
format: readFormat(rPr),
|
|
2568
|
+
paragraph: readParagraphFormat(pPr),
|
|
2569
|
+
character: readCharacterFormat(rPr)
|
|
2795
2570
|
});
|
|
2796
2571
|
});
|
|
2797
2572
|
return styles;
|
|
2798
2573
|
}
|
|
2574
|
+
function displayStyleName(name) {
|
|
2575
|
+
const heading = /^heading ([1-9])$/.exec(name);
|
|
2576
|
+
return heading ? `Heading ${heading[1]}` : name;
|
|
2577
|
+
}
|
|
2578
|
+
function mapStyleIds(styles) {
|
|
2579
|
+
const ids = /* @__PURE__ */ new Map();
|
|
2580
|
+
const used = /* @__PURE__ */ new Set();
|
|
2581
|
+
styles.forEach((style, fileId) => {
|
|
2582
|
+
if (style.type !== "paragraph" && style.type !== "character") return;
|
|
2583
|
+
let id = fileId.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 60);
|
|
2584
|
+
if (!/^[A-Za-z]/.test(id)) id = `S${id}`;
|
|
2585
|
+
let unique = id;
|
|
2586
|
+
for (let n = 2; used.has(unique); n++) unique = `${id}${n}`;
|
|
2587
|
+
if (!_chunk3CC7OPUQcjs.isValidStyleId.call(void 0, unique)) return;
|
|
2588
|
+
used.add(unique);
|
|
2589
|
+
ids.set(fileId, unique);
|
|
2590
|
+
});
|
|
2591
|
+
return ids;
|
|
2592
|
+
}
|
|
2593
|
+
var styleKind = (style) => _optionalChain([style, 'optionalAccess', _96 => _96.type]) === "character" ? "character" : "paragraph";
|
|
2594
|
+
function styleDefinitions(styles, ids) {
|
|
2595
|
+
const out = [];
|
|
2596
|
+
styles.forEach((style, fileId) => {
|
|
2597
|
+
const id = ids.get(fileId);
|
|
2598
|
+
if (!id) return;
|
|
2599
|
+
const kind = styleKind(style);
|
|
2600
|
+
const sameKind = (other) => other && ids.has(other) && styleKind(styles.get(other)) === kind ? ids.get(other) : void 0;
|
|
2601
|
+
const definition = { id, name: displayStyleName(style.name || fileId), kind };
|
|
2602
|
+
const basedOn = sameKind(style.basedOn);
|
|
2603
|
+
if (basedOn) definition.basedOn = basedOn;
|
|
2604
|
+
if (kind === "paragraph") {
|
|
2605
|
+
const next = sameKind(style.next);
|
|
2606
|
+
if (next) definition.next = next;
|
|
2607
|
+
}
|
|
2608
|
+
const linked = style.link ? ids.get(style.link) : void 0;
|
|
2609
|
+
if (linked) definition.linked = linked;
|
|
2610
|
+
if (kind === "paragraph" && Object.keys(style.paragraph).length) definition.paragraph = style.paragraph;
|
|
2611
|
+
if (Object.keys(style.character).length) definition.character = style.character;
|
|
2612
|
+
if (kind === "paragraph") {
|
|
2613
|
+
const heading = _nullishCoalesce(/^heading([1-6])$/i.exec(fileId), () => ( /^heading ([1-6])$/i.exec(style.name)));
|
|
2614
|
+
if (heading) definition.block = { type: "heading", attrs: { level: Number(heading[1]) } };
|
|
2615
|
+
else if (style.outlineLevel !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
2616
|
+
definition.block = { type: "heading", attrs: { level: style.outlineLevel + 1 } };
|
|
2617
|
+
} else if (id === "Code") definition.block = { type: "codeBlock" };
|
|
2618
|
+
else if (id === _chunk3CC7OPUQcjs.NORMAL_STYLE_ID) definition.block = { type: "paragraph" };
|
|
2619
|
+
}
|
|
2620
|
+
if (style.priority !== void 0) definition.priority = style.priority;
|
|
2621
|
+
if (style.quick) definition.quick = true;
|
|
2622
|
+
if (style.hidden) definition.hidden = true;
|
|
2623
|
+
const builtin = _chunk3CC7OPUQcjs.DEFAULT_STYLES.find((s) => s.id === id && s.kind === kind);
|
|
2624
|
+
if (builtin) {
|
|
2625
|
+
definition.builtin = true;
|
|
2626
|
+
definition.block ??= builtin.block;
|
|
2627
|
+
}
|
|
2628
|
+
out.push(definition);
|
|
2629
|
+
});
|
|
2630
|
+
return out;
|
|
2631
|
+
}
|
|
2799
2632
|
function styleChain(styles, id) {
|
|
2800
2633
|
const chain = [];
|
|
2801
2634
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -2821,6 +2654,16 @@ function styleHeadingLevel(styles, id) {
|
|
|
2821
2654
|
if (id && /^title$/i.test(id)) return 1;
|
|
2822
2655
|
return void 0;
|
|
2823
2656
|
}
|
|
2657
|
+
function specialStyle(styles, id) {
|
|
2658
|
+
if (!id) return void 0;
|
|
2659
|
+
for (const style of styleChain(styles, id)) {
|
|
2660
|
+
if (/^block ?text$/i.test(style.name)) return "quote";
|
|
2661
|
+
if (/^code$/i.test(style.name)) return "code";
|
|
2662
|
+
}
|
|
2663
|
+
if (/^blocktext$/i.test(id)) return "quote";
|
|
2664
|
+
if (id === "Code") return "code";
|
|
2665
|
+
return void 0;
|
|
2666
|
+
}
|
|
2824
2667
|
function readNumbering(doc) {
|
|
2825
2668
|
const numbering = { abstracts: /* @__PURE__ */ new Map(), nums: /* @__PURE__ */ new Map() };
|
|
2826
2669
|
if (!doc) return numbering;
|
|
@@ -2850,7 +2693,184 @@ function readNumbering(doc) {
|
|
|
2850
2693
|
});
|
|
2851
2694
|
return numbering;
|
|
2852
2695
|
}
|
|
2853
|
-
|
|
2696
|
+
function readPeople(doc) {
|
|
2697
|
+
const people = /* @__PURE__ */ new Map();
|
|
2698
|
+
if (!doc) return people;
|
|
2699
|
+
descendants(doc, "person").forEach((person) => {
|
|
2700
|
+
const author = attr(person, "author");
|
|
2701
|
+
const userId = attr(descendants(person, "presenceInfo")[0], "userId");
|
|
2702
|
+
if (author && userId && !people.has(author)) people.set(author, userId);
|
|
2703
|
+
});
|
|
2704
|
+
return people;
|
|
2705
|
+
}
|
|
2706
|
+
function dateOf(value) {
|
|
2707
|
+
const ms = value ? Date.parse(value) : NaN;
|
|
2708
|
+
return Number.isFinite(ms) ? ms : 0;
|
|
2709
|
+
}
|
|
2710
|
+
function authorOf(ctx, name) {
|
|
2711
|
+
const authorName = (_nullishCoalesce(name, () => ( ""))).trim() || "Unknown";
|
|
2712
|
+
return { id: _nullishCoalesce(ctx.people.get(authorName), () => ( authorName)), name: authorName };
|
|
2713
|
+
}
|
|
2714
|
+
function commentBody(comment) {
|
|
2715
|
+
const lines = [];
|
|
2716
|
+
const walk = (el, line) => {
|
|
2717
|
+
for (const child of childElements(el)) {
|
|
2718
|
+
if (!isW(child)) continue;
|
|
2719
|
+
switch (child.localName) {
|
|
2720
|
+
case "t":
|
|
2721
|
+
line.push(_nullishCoalesce(child.textContent, () => ( "")));
|
|
2722
|
+
break;
|
|
2723
|
+
case "tab":
|
|
2724
|
+
line.push(" ");
|
|
2725
|
+
break;
|
|
2726
|
+
case "br":
|
|
2727
|
+
case "cr":
|
|
2728
|
+
line.push("\n");
|
|
2729
|
+
break;
|
|
2730
|
+
case "delText":
|
|
2731
|
+
case "del":
|
|
2732
|
+
case "moveFrom":
|
|
2733
|
+
break;
|
|
2734
|
+
default:
|
|
2735
|
+
walk(child, line);
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
};
|
|
2739
|
+
for (const block of childElements(comment)) {
|
|
2740
|
+
if (!isW(block)) continue;
|
|
2741
|
+
const paragraphs = block.localName === "p" ? [block] : descendants(block, "p").filter((p) => isW(p));
|
|
2742
|
+
for (const p of paragraphs) {
|
|
2743
|
+
const line = [];
|
|
2744
|
+
walk(p, line);
|
|
2745
|
+
lines.push(line.join(""));
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
return lines.join("\n").trim();
|
|
2749
|
+
}
|
|
2750
|
+
function readComments(commentsXml, extendedXml, people) {
|
|
2751
|
+
const byFileId = /* @__PURE__ */ new Map();
|
|
2752
|
+
if (!commentsXml) return { threads: [], byFileId };
|
|
2753
|
+
const entries = /* @__PURE__ */ new Map();
|
|
2754
|
+
const byParaId = /* @__PURE__ */ new Map();
|
|
2755
|
+
for (const comment of descendants(commentsXml, "comment").filter((el) => isW(el))) {
|
|
2756
|
+
if (entries.size >= MAX_COMMENTS) break;
|
|
2757
|
+
const fileId = attr(comment, "id");
|
|
2758
|
+
if (fileId === void 0 || entries.has(fileId)) continue;
|
|
2759
|
+
entries.set(fileId, {
|
|
2760
|
+
fileId,
|
|
2761
|
+
author: authorOf({ people }, attr(comment, "author")),
|
|
2762
|
+
createdAt: dateOf(attr(comment, "date")),
|
|
2763
|
+
body: commentBody(comment),
|
|
2764
|
+
done: false
|
|
2765
|
+
});
|
|
2766
|
+
const paragraphs = descendants(comment, "p");
|
|
2767
|
+
const paraId = attr(paragraphs[paragraphs.length - 1], "paraId");
|
|
2768
|
+
if (paraId) byParaId.set(paraId, fileId);
|
|
2769
|
+
}
|
|
2770
|
+
if (extendedXml) {
|
|
2771
|
+
for (const ex of descendants(extendedXml, "commentEx")) {
|
|
2772
|
+
const fileId = byParaId.get(_nullishCoalesce(attr(ex, "paraId"), () => ( "")));
|
|
2773
|
+
const entry = fileId !== void 0 ? entries.get(fileId) : void 0;
|
|
2774
|
+
if (!entry) continue;
|
|
2775
|
+
const parent = byParaId.get(_nullishCoalesce(attr(ex, "paraIdParent"), () => ( "")));
|
|
2776
|
+
if (parent !== void 0 && parent !== fileId) entry.parent = parent;
|
|
2777
|
+
const done = attr(ex, "done");
|
|
2778
|
+
entry.done = done === "1" || done === "true";
|
|
2779
|
+
}
|
|
2780
|
+
}
|
|
2781
|
+
const rootOf = (entry) => {
|
|
2782
|
+
let current = entry;
|
|
2783
|
+
for (let i = 0; i < MAX_PARENT_CHAIN && current.parent !== void 0; i++) {
|
|
2784
|
+
const parent = entries.get(current.parent);
|
|
2785
|
+
if (!parent || parent === entry) break;
|
|
2786
|
+
current = parent;
|
|
2787
|
+
}
|
|
2788
|
+
return current;
|
|
2789
|
+
};
|
|
2790
|
+
const threads = /* @__PURE__ */ new Map();
|
|
2791
|
+
for (const entry of entries.values()) {
|
|
2792
|
+
if (rootOf(entry) !== entry) continue;
|
|
2793
|
+
const id = _chunkIFHKKVXHcjs.createReviewId.call(void 0, "comment");
|
|
2794
|
+
byFileId.set(entry.fileId, id);
|
|
2795
|
+
threads.set(entry.fileId, {
|
|
2796
|
+
id,
|
|
2797
|
+
anchor: null,
|
|
2798
|
+
author: entry.author,
|
|
2799
|
+
createdAt: entry.createdAt,
|
|
2800
|
+
body: entry.body,
|
|
2801
|
+
replies: [],
|
|
2802
|
+
resolved: entry.done,
|
|
2803
|
+
orphaned: false
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
for (const entry of entries.values()) {
|
|
2807
|
+
const root = rootOf(entry);
|
|
2808
|
+
if (root === entry) continue;
|
|
2809
|
+
const thread = threads.get(root.fileId);
|
|
2810
|
+
if (!thread) continue;
|
|
2811
|
+
byFileId.set(entry.fileId, thread.id);
|
|
2812
|
+
const reply = {
|
|
2813
|
+
id: _chunkIFHKKVXHcjs.createReviewId.call(void 0, "reply"),
|
|
2814
|
+
author: entry.author,
|
|
2815
|
+
body: entry.body,
|
|
2816
|
+
createdAt: entry.createdAt
|
|
2817
|
+
};
|
|
2818
|
+
thread.replies.push(reply);
|
|
2819
|
+
}
|
|
2820
|
+
return { threads: Array.from(threads.values()), byFileId };
|
|
2821
|
+
}
|
|
2822
|
+
function applyMarker(el, ctx) {
|
|
2823
|
+
switch (el.localName) {
|
|
2824
|
+
case "commentRangeStart": {
|
|
2825
|
+
const thread = ctx.commentThreads.get(_nullishCoalesce(attr(el, "id"), () => ( "")));
|
|
2826
|
+
if (thread) ctx.openComments.set(thread, (_nullishCoalesce(ctx.openComments.get(thread), () => ( 0))) + 1);
|
|
2827
|
+
return true;
|
|
2828
|
+
}
|
|
2829
|
+
case "commentRangeEnd": {
|
|
2830
|
+
const thread = ctx.commentThreads.get(_nullishCoalesce(attr(el, "id"), () => ( "")));
|
|
2831
|
+
const open = thread ? ctx.openComments.get(thread) : void 0;
|
|
2832
|
+
if (thread && open !== void 0) {
|
|
2833
|
+
if (open <= 1) ctx.openComments.delete(thread);
|
|
2834
|
+
else ctx.openComments.set(thread, open - 1);
|
|
2835
|
+
}
|
|
2836
|
+
return true;
|
|
2837
|
+
}
|
|
2838
|
+
case "moveFromRangeStart":
|
|
2839
|
+
case "moveToRangeStart": {
|
|
2840
|
+
const id = attr(el, "id");
|
|
2841
|
+
const name = _nullishCoalesce(attr(el, "name"), () => ( `range-${id}`));
|
|
2842
|
+
let moveId = ctx.moveIds.get(name);
|
|
2843
|
+
if (!moveId) {
|
|
2844
|
+
moveId = _chunkIFHKKVXHcjs.createReviewId.call(void 0, "move");
|
|
2845
|
+
ctx.moveIds.set(name, moveId);
|
|
2846
|
+
}
|
|
2847
|
+
if (id !== void 0) {
|
|
2848
|
+
ctx.moveRanges.delete(id);
|
|
2849
|
+
ctx.moveRanges.set(id, { moveId, to: el.localName === "moveToRangeStart" });
|
|
2850
|
+
}
|
|
2851
|
+
return true;
|
|
2852
|
+
}
|
|
2853
|
+
case "moveFromRangeEnd":
|
|
2854
|
+
case "moveToRangeEnd":
|
|
2855
|
+
ctx.moveRanges.delete(_nullishCoalesce(attr(el, "id"), () => ( "")));
|
|
2856
|
+
return true;
|
|
2857
|
+
default:
|
|
2858
|
+
return false;
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
var FORMAT_MARK_TYPES = [
|
|
2862
|
+
["b", "bold"],
|
|
2863
|
+
["i", "italic"],
|
|
2864
|
+
["u", "underline"],
|
|
2865
|
+
["s", "strike"],
|
|
2866
|
+
["sub", "subscript"],
|
|
2867
|
+
["sup", "superscript"]
|
|
2868
|
+
];
|
|
2869
|
+
var formatMarks = (f) => FORMAT_MARK_TYPES.filter(([key]) => f[key]).map(([, type]) => ({ type }));
|
|
2870
|
+
var formatKey = (f) => `${f.b ? 1 : 0}${f.i ? 1 : 0}${f.u ? 1 : 0}${f.s ? 1 : 0}${f.sup ? 1 : 0}${f.sub ? 1 : 0}|${_nullishCoalesce(f.href, () => ( ""))}` + (f.rev ? `|${f.rev.kind}:${f.rev.changeId}:${_nullishCoalesce(f.rev.moveId, () => ( ""))}` : "") + (f.fmt ? `|f:${f.fmt.changeId}` : "") + (f.comments ? `|c:${f.comments.join(",")}` : "");
|
|
2871
|
+
function changeAttrs(change) {
|
|
2872
|
+
return ` data-change-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, change.changeId)}" data-author-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, change.authorId)}" data-author-name="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, change.authorName)}" data-created-at="${change.createdAt}"`;
|
|
2873
|
+
}
|
|
2854
2874
|
function wrapFormat(inner, f) {
|
|
2855
2875
|
let html = inner;
|
|
2856
2876
|
if (f.sup) html = `<sup>${html}</sup>`;
|
|
@@ -2859,10 +2879,19 @@ function wrapFormat(inner, f) {
|
|
|
2859
2879
|
if (f.u) html = `<u>${html}</u>`;
|
|
2860
2880
|
if (f.i) html = `<em>${html}</em>`;
|
|
2861
2881
|
if (f.b) html = `<strong>${html}</strong>`;
|
|
2862
|
-
if (f.
|
|
2882
|
+
if (f.fmt) {
|
|
2883
|
+
html = `<span data-change-type="format"${changeAttrs(f.fmt)} data-format-before="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, JSON.stringify(f.fmt.before))}" data-format-after="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, JSON.stringify(f.fmt.after))}">${html}</span>`;
|
|
2884
|
+
}
|
|
2885
|
+
if (f.rev) {
|
|
2886
|
+
const tag = f.rev.kind === "insertion" ? "ins" : "del";
|
|
2887
|
+
const move = f.rev.moveId ? ` data-move-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, f.rev.moveId)}"` : "";
|
|
2888
|
+
html = `<${tag} data-change-type="${f.rev.kind}"${changeAttrs(f.rev)}${move}>${html}</${tag}>`;
|
|
2889
|
+
}
|
|
2890
|
+
for (const id of [..._nullishCoalesce(f.comments, () => ( []))].reverse()) html = `<span data-comment-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, id)}">${html}</span>`;
|
|
2891
|
+
if (f.href) html = `<a href="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, f.href)}">${html}</a>`;
|
|
2863
2892
|
return html;
|
|
2864
2893
|
}
|
|
2865
|
-
function renderSegments(segments) {
|
|
2894
|
+
function renderSegments(segments, code = false) {
|
|
2866
2895
|
let html = "";
|
|
2867
2896
|
let i = 0;
|
|
2868
2897
|
while (i < segments.length) {
|
|
@@ -2871,12 +2900,13 @@ function renderSegments(segments) {
|
|
|
2871
2900
|
let j = i;
|
|
2872
2901
|
for (; j < segments.length && formatKey(segments[j].format) === key; j++) {
|
|
2873
2902
|
const seg = segments[j];
|
|
2874
|
-
if (seg.kind === "text") inner +=
|
|
2875
|
-
else if (seg.kind === "br") inner += "<br>";
|
|
2876
|
-
else if (seg.kind === "img") inner += `<img src="${
|
|
2903
|
+
if (seg.kind === "text") inner += _chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.text);
|
|
2904
|
+
else if (seg.kind === "br") inner += code ? "\n" : "<br>";
|
|
2905
|
+
else if (seg.kind === "img") inner += code ? "" : `<img src="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.src)}" alt="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.alt)}">`;
|
|
2877
2906
|
else inner += `<sup>${seg.n}</sup>`;
|
|
2878
2907
|
}
|
|
2879
|
-
|
|
2908
|
+
const format = segments[i].format;
|
|
2909
|
+
html += wrapFormat(inner, code ? { rev: format.rev, comments: format.comments } : format);
|
|
2880
2910
|
i = j;
|
|
2881
2911
|
}
|
|
2882
2912
|
return html;
|
|
@@ -2885,25 +2915,49 @@ function parseHyperlinkInstruction(instr) {
|
|
|
2885
2915
|
const match = /^\s*HYPERLINK\b(.*)$/i.exec(instr);
|
|
2886
2916
|
if (!match) return void 0;
|
|
2887
2917
|
const rest = match[1];
|
|
2888
|
-
const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access',
|
|
2918
|
+
const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _97 => _97.exec, 'call', _98 => _98(rest), 'optionalAccess', _99 => _99[1]]);
|
|
2889
2919
|
const target = /^\s*(?:"([^"]*)"|([^\s\\]+))/.exec(rest);
|
|
2890
|
-
const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
2920
|
+
const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _100 => _100[1]]), () => ( _optionalChain([target, 'optionalAccess', _101 => _101[2]])));
|
|
2891
2921
|
if (url) return anchor ? `${url}#${anchor}` : url;
|
|
2892
2922
|
return anchor ? `#${anchor}` : void 0;
|
|
2893
2923
|
}
|
|
2894
|
-
var ParagraphRenderer = (
|
|
2895
|
-
constructor(ctx, part) {;
|
|
2924
|
+
var ParagraphRenderer = (_class2 = class {
|
|
2925
|
+
constructor(ctx, part) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);
|
|
2896
2926
|
this.ctx = ctx;
|
|
2897
2927
|
this.part = part;
|
|
2898
2928
|
}
|
|
2899
2929
|
|
|
2900
2930
|
|
|
2901
|
-
|
|
2931
|
+
__init2() {this.segments = []}
|
|
2902
2932
|
/** Open complex fields (`w:fldChar`), innermost last. */
|
|
2903
|
-
|
|
2904
|
-
|
|
2933
|
+
__init3() {this.fields = []}
|
|
2934
|
+
collect(p) {
|
|
2905
2935
|
this.walk(p, {});
|
|
2906
|
-
return
|
|
2936
|
+
return this;
|
|
2937
|
+
}
|
|
2938
|
+
render(p) {
|
|
2939
|
+
return this.collect(p).html();
|
|
2940
|
+
}
|
|
2941
|
+
html(code = false) {
|
|
2942
|
+
return renderSegments(this.segments, code);
|
|
2943
|
+
}
|
|
2944
|
+
/** Removes a leading task-list glyph (`☐ ` / `☒ `) and returns its checked state. */
|
|
2945
|
+
takeTaskGlyph() {
|
|
2946
|
+
const first = this.segments[0];
|
|
2947
|
+
if (!first || first.kind !== "text") return void 0;
|
|
2948
|
+
const glyph = first.text.charAt(0);
|
|
2949
|
+
if (!(glyph in TASK_GLYPHS)) return void 0;
|
|
2950
|
+
const rest = first.text.slice(1).replace(/^ /, "");
|
|
2951
|
+
if (rest) first.text = rest;
|
|
2952
|
+
else {
|
|
2953
|
+
this.segments.shift();
|
|
2954
|
+
const next = this.segments[0];
|
|
2955
|
+
if (_optionalChain([next, 'optionalAccess', _102 => _102.kind]) === "text") {
|
|
2956
|
+
next.text = next.text.replace(/^ /, "");
|
|
2957
|
+
if (!next.text) this.segments.shift();
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
return TASK_GLYPHS[glyph];
|
|
2907
2961
|
}
|
|
2908
2962
|
fieldHref() {
|
|
2909
2963
|
for (let i = this.fields.length - 1; i >= 0; i--) {
|
|
@@ -2914,8 +2968,38 @@ var ParagraphRenderer = (_class3 = class {
|
|
|
2914
2968
|
inFieldInstruction() {
|
|
2915
2969
|
return this.fields.some((field) => !field.separated);
|
|
2916
2970
|
}
|
|
2971
|
+
/** A tracked change id shared with the previous change when adjacent and by the same author at the same time. */
|
|
2972
|
+
changeId(key) {
|
|
2973
|
+
const last = this.ctx.lastChange;
|
|
2974
|
+
if (last && last.key === key && last.end === this.ctx.segmentCount) return last.changeId;
|
|
2975
|
+
return _chunkIFHKKVXHcjs.createReviewId.call(void 0, "change");
|
|
2976
|
+
}
|
|
2977
|
+
change(el, kind, extra = "") {
|
|
2978
|
+
const author = authorOf(this.ctx, attr(el, "author"));
|
|
2979
|
+
const createdAt = dateOf(attr(el, "date"));
|
|
2980
|
+
const key = `${kind}|${author.name}|${createdAt}|${extra}`;
|
|
2981
|
+
return {
|
|
2982
|
+
key,
|
|
2983
|
+
info: { changeId: this.changeId(key), authorId: author.id, authorName: author.name, createdAt }
|
|
2984
|
+
};
|
|
2985
|
+
}
|
|
2986
|
+
revision(el, kind) {
|
|
2987
|
+
let moveId;
|
|
2988
|
+
if (el.localName === "moveFrom" || el.localName === "moveTo") {
|
|
2989
|
+
const to = el.localName === "moveTo";
|
|
2990
|
+
for (const range of this.ctx.moveRanges.values()) if (range.to === to) moveId = range.moveId;
|
|
2991
|
+
moveId ??= _chunkIFHKKVXHcjs.createReviewId.call(void 0, "move");
|
|
2992
|
+
}
|
|
2993
|
+
const { info, key } = this.change(el, kind, _nullishCoalesce(moveId, () => ( "")));
|
|
2994
|
+
return { rev: { ...info, kind, ...moveId ? { moveId } : {} }, key };
|
|
2995
|
+
}
|
|
2996
|
+
walkChange(el, base, kind) {
|
|
2997
|
+
const { rev, key } = this.revision(el, kind);
|
|
2998
|
+
this.walk(el, { ...base, rev });
|
|
2999
|
+
this.ctx.lastChange = { key, changeId: rev.changeId, end: this.ctx.segmentCount };
|
|
3000
|
+
}
|
|
2917
3001
|
walk(el, base) {
|
|
2918
|
-
const
|
|
3002
|
+
const tracked = this.ctx.tracked;
|
|
2919
3003
|
for (const child of childElements(el)) {
|
|
2920
3004
|
if (!isW(child)) {
|
|
2921
3005
|
continue;
|
|
@@ -2939,11 +3023,13 @@ var ParagraphRenderer = (_class3 = class {
|
|
|
2939
3023
|
}
|
|
2940
3024
|
case "ins":
|
|
2941
3025
|
case "moveTo":
|
|
2942
|
-
if (accepted) this.walk(child, base);
|
|
3026
|
+
if (tracked === "accepted") this.walk(child, base);
|
|
3027
|
+
else if (tracked === "marks") this.walkChange(child, base, "insertion");
|
|
2943
3028
|
break;
|
|
2944
3029
|
case "del":
|
|
2945
3030
|
case "moveFrom":
|
|
2946
|
-
if (
|
|
3031
|
+
if (tracked === "original") this.walk(child, base);
|
|
3032
|
+
else if (tracked === "marks") this.walkChange(child, base, "deletion");
|
|
2947
3033
|
break;
|
|
2948
3034
|
case "sdt":
|
|
2949
3035
|
this.walk(_nullishCoalesce(wChild(child, "sdtContent"), () => ( child)), base);
|
|
@@ -2956,24 +3042,42 @@ var ParagraphRenderer = (_class3 = class {
|
|
|
2956
3042
|
this.walk(child, base);
|
|
2957
3043
|
break;
|
|
2958
3044
|
default:
|
|
3045
|
+
applyMarker(child, this.ctx);
|
|
2959
3046
|
break;
|
|
2960
3047
|
}
|
|
2961
3048
|
}
|
|
2962
3049
|
}
|
|
2963
3050
|
run(r, base) {
|
|
2964
3051
|
const rPr = wChild(r, "rPr");
|
|
2965
|
-
const
|
|
3052
|
+
const runStyle = this.ctx.styles.get(_nullishCoalesce(attr(wChild(rPr, "rStyle"), "val"), () => ( "")));
|
|
3053
|
+
const styleFormat = base.href && runStyle && /^hyperlink$/i.test(runStyle.name) ? {} : _nullishCoalesce(_optionalChain([runStyle, 'optionalAccess', _103 => _103.format]), () => ( {}));
|
|
2966
3054
|
const own = readFormat(rPr);
|
|
2967
3055
|
const format = { ...base, ...styleFormat, ...own };
|
|
3056
|
+
const rPrChange = wChild(rPr, "rPrChange");
|
|
3057
|
+
let changeKey;
|
|
3058
|
+
if (rPrChange && this.ctx.tracked === "marks") {
|
|
3059
|
+
const { info, key } = this.change(rPrChange, "format");
|
|
3060
|
+
const before = { ...styleFormat, ...readFormat(wChild(rPrChange, "rPr")) };
|
|
3061
|
+
format.fmt = { ...info, before: formatMarks(before), after: formatMarks(format) };
|
|
3062
|
+
changeKey = key;
|
|
3063
|
+
}
|
|
2968
3064
|
for (const child of childElements(r)) {
|
|
2969
3065
|
this.runChild(child, format);
|
|
2970
3066
|
}
|
|
3067
|
+
if (format.fmt && changeKey) {
|
|
3068
|
+
this.ctx.lastChange = { key: changeKey, changeId: format.fmt.changeId, end: this.ctx.segmentCount };
|
|
3069
|
+
}
|
|
2971
3070
|
}
|
|
2972
3071
|
runChild(child, format) {
|
|
2973
3072
|
const push = (segment) => {
|
|
2974
3073
|
if (this.inFieldInstruction()) return;
|
|
2975
3074
|
const href = _nullishCoalesce(format.href, () => ( this.fieldHref()));
|
|
2976
|
-
|
|
3075
|
+
let out = href && !format.href ? { ...segment, format: { ...format, href } } : segment;
|
|
3076
|
+
if (this.ctx.openComments.size) {
|
|
3077
|
+
out = { ...out, format: { ...out.format, comments: Array.from(this.ctx.openComments.keys()) } };
|
|
3078
|
+
}
|
|
3079
|
+
this.segments.push(out);
|
|
3080
|
+
this.ctx.segmentCount++;
|
|
2977
3081
|
};
|
|
2978
3082
|
if (child.localName === "AlternateContent") {
|
|
2979
3083
|
const branch = childElements(child).find(
|
|
@@ -2988,7 +3092,7 @@ var ParagraphRenderer = (_class3 = class {
|
|
|
2988
3092
|
push({ kind: "text", text: _nullishCoalesce(child.textContent, () => ( "")), format });
|
|
2989
3093
|
break;
|
|
2990
3094
|
case "delText":
|
|
2991
|
-
if (this.ctx.tracked
|
|
3095
|
+
if (this.ctx.tracked !== "accepted") push({ kind: "text", text: _nullishCoalesce(child.textContent, () => ( "")), format });
|
|
2992
3096
|
break;
|
|
2993
3097
|
case "tab":
|
|
2994
3098
|
case "ptab":
|
|
@@ -3051,9 +3155,17 @@ var ParagraphRenderer = (_class3 = class {
|
|
|
3051
3155
|
const alt = attr(docPr, "descr") || attr(docPr, "title") || attr(imageData, "title") || "";
|
|
3052
3156
|
push({ kind: "img", src, alt, format });
|
|
3053
3157
|
}
|
|
3054
|
-
},
|
|
3158
|
+
}, _class2);
|
|
3159
|
+
var MARKERS = /* @__PURE__ */ new Set([
|
|
3160
|
+
"commentRangeStart",
|
|
3161
|
+
"commentRangeEnd",
|
|
3162
|
+
"moveFromRangeStart",
|
|
3163
|
+
"moveFromRangeEnd",
|
|
3164
|
+
"moveToRangeStart",
|
|
3165
|
+
"moveToRangeEnd"
|
|
3166
|
+
]);
|
|
3055
3167
|
function flattenBlocks(container, ctx, out = []) {
|
|
3056
|
-
const
|
|
3168
|
+
const tracked = ctx.tracked;
|
|
3057
3169
|
for (const child of childElements(container)) {
|
|
3058
3170
|
if (!isW(child)) continue;
|
|
3059
3171
|
switch (child.localName) {
|
|
@@ -3070,13 +3182,14 @@ function flattenBlocks(container, ctx, out = []) {
|
|
|
3070
3182
|
break;
|
|
3071
3183
|
case "ins":
|
|
3072
3184
|
case "moveTo":
|
|
3073
|
-
if (
|
|
3185
|
+
if (tracked !== "original") flattenBlocks(child, ctx, out);
|
|
3074
3186
|
break;
|
|
3075
3187
|
case "del":
|
|
3076
3188
|
case "moveFrom":
|
|
3077
|
-
if (
|
|
3189
|
+
if (tracked !== "accepted") flattenBlocks(child, ctx, out);
|
|
3078
3190
|
break;
|
|
3079
3191
|
default:
|
|
3192
|
+
if (MARKERS.has(child.localName)) out.push(child);
|
|
3080
3193
|
break;
|
|
3081
3194
|
}
|
|
3082
3195
|
}
|
|
@@ -3094,20 +3207,41 @@ function paragraphInfo(p, ctx) {
|
|
|
3094
3207
|
heading = styleHeadingLevel(ctx.styles, styleId);
|
|
3095
3208
|
}
|
|
3096
3209
|
let numPr = readNumPr(pPr);
|
|
3097
|
-
if (!numPr) numPr = _optionalChain([styleChain, 'call',
|
|
3210
|
+
if (!numPr) numPr = _optionalChain([styleChain, 'call', _104 => _104(ctx.styles, styleId), 'access', _105 => _105.find, 'call', _106 => _106((style) => style.numPr), 'optionalAccess', _107 => _107.numPr]);
|
|
3098
3211
|
let list;
|
|
3099
3212
|
if (numPr && numPr.numId !== "0" && heading === void 0) {
|
|
3100
3213
|
const num = ctx.numbering.nums.get(numPr.numId);
|
|
3101
|
-
const def = num ? _optionalChain([ctx, 'access',
|
|
3214
|
+
const def = num ? _optionalChain([ctx, 'access', _108 => _108.numbering, 'access', _109 => _109.abstracts, 'access', _110 => _110.get, 'call', _111 => _111(num.abstractId), 'optionalAccess', _112 => _112.get, 'call', _113 => _113(numPr.ilvl)]) : void 0;
|
|
3102
3215
|
list = {
|
|
3103
3216
|
level: Math.max(0, Math.min(numPr.ilvl, 8)),
|
|
3104
|
-
ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess',
|
|
3105
|
-
start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess',
|
|
3217
|
+
ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _114 => _114.ordered]), () => ( false)),
|
|
3218
|
+
start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess', _115 => _115.starts, 'access', _116 => _116.get, 'call', _117 => _117(numPr.ilvl)]), () => ( _optionalChain([def, 'optionalAccess', _118 => _118.start]))), () => ( 1))
|
|
3106
3219
|
};
|
|
3107
3220
|
}
|
|
3108
|
-
|
|
3221
|
+
const special = heading === void 0 && !list ? specialStyle(ctx.styles, styleId) : void 0;
|
|
3222
|
+
return { heading, list, styleId, special, pPr };
|
|
3223
|
+
}
|
|
3224
|
+
function blockChangeAttr(pPr, ctx) {
|
|
3225
|
+
const change = wChild(pPr, "pPrChange");
|
|
3226
|
+
if (!change) return "";
|
|
3227
|
+
const oldPPr = wChild(change, "pPr");
|
|
3228
|
+
const oldStyle = attr(wChild(oldPPr, "pStyle"), "val");
|
|
3229
|
+
const oldOutline = attr(wChild(oldPPr, "outlineLvl"), "val");
|
|
3230
|
+
const level = oldOutline !== void 0 ? Number(oldOutline) >= 0 && Number(oldOutline) <= 5 ? Number(oldOutline) + 1 : void 0 : styleHeadingLevel(ctx.styles, oldStyle);
|
|
3231
|
+
const mappedStyle = oldStyle ? ctx.styleIds.get(oldStyle) : void 0;
|
|
3232
|
+
const previous = level !== void 0 ? { type: "heading", attrs: { level }, wrappers: [] } : specialStyle(ctx.styles, oldStyle) === "code" ? { type: "codeBlock", attrs: {}, wrappers: [] } : { type: "paragraph", attrs: mappedStyle && mappedStyle !== _chunk3CC7OPUQcjs.NORMAL_STYLE_ID ? { styleId: mappedStyle } : {}, wrappers: [] };
|
|
3233
|
+
const author = authorOf(ctx, attr(change, "author"));
|
|
3234
|
+
const record = {
|
|
3235
|
+
changeId: _chunkIFHKKVXHcjs.createReviewId.call(void 0, "change"),
|
|
3236
|
+
authorId: author.id,
|
|
3237
|
+
authorName: author.name,
|
|
3238
|
+
authorColor: null,
|
|
3239
|
+
createdAt: dateOf(attr(change, "date")),
|
|
3240
|
+
previous
|
|
3241
|
+
};
|
|
3242
|
+
return ` data-block-change="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, JSON.stringify(record))}"`;
|
|
3109
3243
|
}
|
|
3110
|
-
function renderBlocks(container, ctx, part) {
|
|
3244
|
+
function renderBlocks(container, ctx, part, topLevel = false) {
|
|
3111
3245
|
let html = "";
|
|
3112
3246
|
const stack = [];
|
|
3113
3247
|
const closeList = () => {
|
|
@@ -3117,34 +3251,62 @@ function renderBlocks(container, ctx, part) {
|
|
|
3117
3251
|
const closeAll = () => {
|
|
3118
3252
|
while (stack.length) closeList();
|
|
3119
3253
|
};
|
|
3254
|
+
let group = null;
|
|
3255
|
+
const flush = () => {
|
|
3256
|
+
if (!group) return;
|
|
3257
|
+
html += group.kind === "quote" ? `<blockquote>${group.parts.join("")}</blockquote>` : `<pre><code>${group.parts.join("\n")}</code></pre>`;
|
|
3258
|
+
group = null;
|
|
3259
|
+
};
|
|
3120
3260
|
for (const block of flattenBlocks(container, ctx)) {
|
|
3261
|
+
if (MARKERS.has(block.localName)) {
|
|
3262
|
+
applyMarker(block, ctx);
|
|
3263
|
+
continue;
|
|
3264
|
+
}
|
|
3121
3265
|
if (block.localName === "tbl") {
|
|
3122
3266
|
closeAll();
|
|
3267
|
+
flush();
|
|
3123
3268
|
html += renderTable(block, ctx, part);
|
|
3124
3269
|
continue;
|
|
3125
3270
|
}
|
|
3126
|
-
const { heading, list } = paragraphInfo(block, ctx);
|
|
3127
|
-
const
|
|
3128
|
-
|
|
3271
|
+
const { heading, list, styleId, special, pPr } = paragraphInfo(block, ctx);
|
|
3272
|
+
const renderer = new ParagraphRenderer(ctx, part).collect(block);
|
|
3273
|
+
if (special) {
|
|
3274
|
+
closeAll();
|
|
3275
|
+
if (group && group.kind !== special) flush();
|
|
3276
|
+
group ??= { kind: special, parts: [] };
|
|
3277
|
+
group.parts.push(special === "code" ? renderer.html(true) : `<p>${renderer.html()}</p>`);
|
|
3278
|
+
continue;
|
|
3279
|
+
}
|
|
3280
|
+
flush();
|
|
3281
|
+
const task = list && !list.ordered ? renderer.takeTaskGlyph() : void 0;
|
|
3282
|
+
const inner = renderer.html();
|
|
3283
|
+
const mappedStyle = styleId ? ctx.styleIds.get(styleId) : void 0;
|
|
3284
|
+
const styleAttr = !heading && !list && mappedStyle && mappedStyle !== _chunk3CC7OPUQcjs.NORMAL_STYLE_ID ? ` data-style="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, mappedStyle)}"` : "";
|
|
3285
|
+
const changeAttr = topLevel && !list && ctx.tracked === "marks" ? blockChangeAttr(pPr, ctx) : "";
|
|
3286
|
+
const blockHtml = heading ? `<h${heading}${changeAttr}>${inner}</h${heading}>` : `<p${styleAttr}${changeAttr}>${inner}</p>`;
|
|
3129
3287
|
if (!list) {
|
|
3130
3288
|
closeAll();
|
|
3131
3289
|
html += blockHtml;
|
|
3132
3290
|
continue;
|
|
3133
3291
|
}
|
|
3134
3292
|
const tag = list.ordered ? "ol" : "ul";
|
|
3293
|
+
const isTask = task !== void 0;
|
|
3294
|
+
const item = isTask ? `<li data-type="taskItem" data-checked="${task ? "true" : "false"}">` : "<li>";
|
|
3135
3295
|
while (stack.length && stack[stack.length - 1].level > list.level) closeList();
|
|
3136
3296
|
const top = stack[stack.length - 1];
|
|
3137
|
-
if (top && top.level === list.level && top.tag === tag) {
|
|
3138
|
-
html +=
|
|
3297
|
+
if (top && top.level === list.level && top.tag === tag && top.task === isTask) {
|
|
3298
|
+
html += `</li>${item}`;
|
|
3139
3299
|
} else {
|
|
3140
3300
|
if (top && top.level === list.level) closeList();
|
|
3141
3301
|
const start2 = tag === "ol" && list.start !== 1 ? ` start="${list.start}"` : "";
|
|
3142
|
-
|
|
3143
|
-
|
|
3302
|
+
const type = isTask ? ' data-type="taskList"' : "";
|
|
3303
|
+
html += `<${tag}${type}${start2}>${item}`;
|
|
3304
|
+
stack.push({ level: list.level, tag, task: isTask });
|
|
3144
3305
|
}
|
|
3145
3306
|
html += blockHtml;
|
|
3146
3307
|
}
|
|
3147
3308
|
closeAll();
|
|
3309
|
+
flush();
|
|
3148
3310
|
return html;
|
|
3149
3311
|
}
|
|
3150
3312
|
function renderTable(tbl, ctx, part) {
|
|
@@ -3186,7 +3348,7 @@ function renderTable(tbl, ctx, part) {
|
|
|
3186
3348
|
if (cell.merge === "restart") {
|
|
3187
3349
|
for (let r = rowIndex + 1; r < rows.length; r++) {
|
|
3188
3350
|
const below = rows[r].find((c) => c.col === cell.col);
|
|
3189
|
-
if (_optionalChain([below, 'optionalAccess',
|
|
3351
|
+
if (_optionalChain([below, 'optionalAccess', _119 => _119.merge]) !== "continue") break;
|
|
3190
3352
|
rowspan++;
|
|
3191
3353
|
}
|
|
3192
3354
|
}
|
|
@@ -3199,7 +3361,7 @@ function renderTable(tbl, ctx, part) {
|
|
|
3199
3361
|
return `${html}</tbody></table>`;
|
|
3200
3362
|
}
|
|
3201
3363
|
function getDomParser(options) {
|
|
3202
|
-
const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access',
|
|
3364
|
+
const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access', _120 => _120.window, 'optionalAccess', _121 => _121.DOMParser])));
|
|
3203
3365
|
if (typeof Parser !== "function") {
|
|
3204
3366
|
throw new ImportError(
|
|
3205
3367
|
"unsupported_environment",
|
|
@@ -3212,9 +3374,9 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3212
3374
|
const Parser = getDomParser(options);
|
|
3213
3375
|
let zip;
|
|
3214
3376
|
try {
|
|
3215
|
-
zip = await readZip(data, { maxTotalSize: 100 * 1024 * 1024, maxEntries: 5e3, ...options.zip });
|
|
3377
|
+
zip = await _chunk3CC7OPUQcjs.readZip.call(void 0, data, { maxTotalSize: 100 * 1024 * 1024, maxEntries: 5e3, ...options.zip });
|
|
3216
3378
|
} catch (error) {
|
|
3217
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
3379
|
+
if (_optionalChain([error, 'optionalAccess', _122 => _122.code]) === "invalid_archive") {
|
|
3218
3380
|
throw new ImportError("invalid_file", "Not a DOCX file (the file is not a ZIP package).", { cause: error });
|
|
3219
3381
|
}
|
|
3220
3382
|
throw error;
|
|
@@ -3234,16 +3396,42 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3234
3396
|
throw new ImportError("invalid_file", "Not a Word document (no main document part with a body).");
|
|
3235
3397
|
}
|
|
3236
3398
|
const rels = await readRelationships(zip, Parser, mainPath);
|
|
3237
|
-
const partByType = (suffix) => _optionalChain([Array, 'access',
|
|
3399
|
+
const partByType = (suffix) => _optionalChain([Array, 'access', _123 => _123.from, 'call', _124 => _124(rels.values()), 'access', _125 => _125.find, 'call', _126 => _126((rel) => !rel.external && rel.type.endsWith(`/${suffix}`)), 'optionalAccess', _127 => _127.target]);
|
|
3238
3400
|
const baseDir = dirname(mainPath);
|
|
3239
3401
|
const stylesPath = _nullishCoalesce(partByType("styles"), () => ( `${baseDir}styles.xml`));
|
|
3240
3402
|
const numberingPath = _nullishCoalesce(partByType("numbering"), () => ( `${baseDir}numbering.xml`));
|
|
3403
|
+
const styles = readStyles(await readXmlPart(zip, Parser, stylesPath));
|
|
3404
|
+
const useStyles = options.paragraphStyles !== false;
|
|
3405
|
+
const styleIds = useStyles ? mapStyleIds(styles) : /* @__PURE__ */ new Map();
|
|
3406
|
+
const peoplePath = partByType("people");
|
|
3407
|
+
const people = readPeople(peoplePath ? await readXmlPart(zip, Parser, peoplePath) : null);
|
|
3408
|
+
let threads = [];
|
|
3409
|
+
let commentThreads = /* @__PURE__ */ new Map();
|
|
3410
|
+
if (options.comments !== false) {
|
|
3411
|
+
const commentsPath = partByType("comments");
|
|
3412
|
+
const extendedPath = partByType("commentsExtended");
|
|
3413
|
+
const read = readComments(
|
|
3414
|
+
commentsPath ? await readXmlPart(zip, Parser, commentsPath) : null,
|
|
3415
|
+
extendedPath ? await readXmlPart(zip, Parser, extendedPath) : null,
|
|
3416
|
+
people
|
|
3417
|
+
);
|
|
3418
|
+
threads = read.threads;
|
|
3419
|
+
commentThreads = read.byFileId;
|
|
3420
|
+
}
|
|
3241
3421
|
const ctx = {
|
|
3242
|
-
styles
|
|
3422
|
+
styles,
|
|
3243
3423
|
numbering: readNumbering(await readXmlPart(zip, Parser, numberingPath)),
|
|
3244
3424
|
notes: /* @__PURE__ */ new Map(),
|
|
3245
3425
|
noteOrder: [],
|
|
3246
|
-
tracked: _nullishCoalesce(options.trackedChanges, () => ( "accepted"))
|
|
3426
|
+
tracked: _nullishCoalesce(options.trackedChanges, () => ( "accepted")),
|
|
3427
|
+
styleIds,
|
|
3428
|
+
people,
|
|
3429
|
+
commentThreads,
|
|
3430
|
+
openComments: /* @__PURE__ */ new Map(),
|
|
3431
|
+
moveRanges: /* @__PURE__ */ new Map(),
|
|
3432
|
+
moveIds: /* @__PURE__ */ new Map(),
|
|
3433
|
+
segmentCount: 0,
|
|
3434
|
+
lastChange: null
|
|
3247
3435
|
};
|
|
3248
3436
|
for (const kind of ["footnote", "endnote"]) {
|
|
3249
3437
|
const path = _nullishCoalesce(partByType(`${kind}s`), () => ( `${baseDir}${kind}s.xml`));
|
|
@@ -3258,7 +3446,7 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3258
3446
|
});
|
|
3259
3447
|
}
|
|
3260
3448
|
const part = { rels, images: await loadImages(zip, documentXml, rels, options) };
|
|
3261
|
-
let html = renderBlocks(body, ctx, part);
|
|
3449
|
+
let html = renderBlocks(body, ctx, part, true);
|
|
3262
3450
|
if (ctx.noteOrder.length) {
|
|
3263
3451
|
let notesHtml = "";
|
|
3264
3452
|
for (let i = 0; i < ctx.noteOrder.length; i++) {
|
|
@@ -3267,8 +3455,14 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3267
3455
|
}
|
|
3268
3456
|
html += `<hr><ol>${notesHtml}</ol>`;
|
|
3269
3457
|
}
|
|
3270
|
-
const sanitized =
|
|
3271
|
-
|
|
3458
|
+
const sanitized = _chunkHNDSPZ5Tcjs.sanitizeImportedHtml.call(void 0, html);
|
|
3459
|
+
const result = { html: sanitized, text: _chunk66IMF6ODcjs.htmlToPlainText.call(void 0, sanitized) };
|
|
3460
|
+
if (threads.length) result.comments = { version: 1, threads };
|
|
3461
|
+
if (useStyles) {
|
|
3462
|
+
const definitions = styleDefinitions(styles, styleIds);
|
|
3463
|
+
if (definitions.length) result.styles = _chunk3CC7OPUQcjs.createStyleRegistry.call(void 0, { styles: definitions });
|
|
3464
|
+
}
|
|
3465
|
+
return result;
|
|
3272
3466
|
}
|
|
3273
3467
|
function createDocxImportAdapter(options = {}) {
|
|
3274
3468
|
return {
|
|
@@ -3293,7 +3487,7 @@ var markdownImportAdapter = {
|
|
|
3293
3487
|
target: "document",
|
|
3294
3488
|
async import(_input, context) {
|
|
3295
3489
|
const text = await context.readText();
|
|
3296
|
-
return { html:
|
|
3490
|
+
return { html: _chunk66IMF6ODcjs.markdownToTipTapHtml.call(void 0, text), text };
|
|
3297
3491
|
}
|
|
3298
3492
|
};
|
|
3299
3493
|
var htmlImportAdapter = {
|
|
@@ -3303,8 +3497,8 @@ var htmlImportAdapter = {
|
|
|
3303
3497
|
extensions: [".html", ".htm", ".xhtml"],
|
|
3304
3498
|
target: "document",
|
|
3305
3499
|
async import(_input, context) {
|
|
3306
|
-
const html =
|
|
3307
|
-
return { html, text:
|
|
3500
|
+
const html = _chunkHNDSPZ5Tcjs.sanitizeImportedHtml.call(void 0, await context.readText());
|
|
3501
|
+
return { html, text: _chunk66IMF6ODcjs.htmlToPlainText.call(void 0, html) };
|
|
3308
3502
|
}
|
|
3309
3503
|
};
|
|
3310
3504
|
var plainTextImportAdapter = {
|
|
@@ -3315,7 +3509,7 @@ var plainTextImportAdapter = {
|
|
|
3315
3509
|
target: "document",
|
|
3316
3510
|
async import(_input, context) {
|
|
3317
3511
|
const text = (await context.readText()).replace(/\r\n?/g, "\n");
|
|
3318
|
-
return { html:
|
|
3512
|
+
return { html: _chunkHNDSPZ5Tcjs.plainTextToParagraphHtml.call(void 0, text), text };
|
|
3319
3513
|
}
|
|
3320
3514
|
};
|
|
3321
3515
|
var rtfImportAdapter = {
|
|
@@ -3325,8 +3519,8 @@ var rtfImportAdapter = {
|
|
|
3325
3519
|
extensions: [".rtf"],
|
|
3326
3520
|
target: "document",
|
|
3327
3521
|
async import(_input, context) {
|
|
3328
|
-
const text =
|
|
3329
|
-
return { html:
|
|
3522
|
+
const text = _chunkHNDSPZ5Tcjs.rtfToPlainText.call(void 0, await context.readText());
|
|
3523
|
+
return { html: _chunkHNDSPZ5Tcjs.plainTextToParagraphHtml.call(void 0, text), text };
|
|
3330
3524
|
}
|
|
3331
3525
|
};
|
|
3332
3526
|
var BUILT_IN_IMPORT_ADAPTERS = [
|
|
@@ -3365,7 +3559,7 @@ function getImportAccept(target) {
|
|
|
3365
3559
|
|
|
3366
3560
|
var toView = (target) => "state" in target && "dispatch" in target ? target : target.view;
|
|
3367
3561
|
function htmlToSlice(html, schema) {
|
|
3368
|
-
const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access',
|
|
3562
|
+
const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _128 => _128.window, 'optionalAccess', _129 => _129.DOMParser])));
|
|
3369
3563
|
if (!Parser) return null;
|
|
3370
3564
|
const body = new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
|
|
3371
3565
|
return new (0, _model.Slice)(_model.DOMParser.fromSchema(schema).parse(body).content, 0, 0);
|
|
@@ -3380,11 +3574,35 @@ function insertImportedDocument(target, content, options = {}) {
|
|
|
3380
3574
|
if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
|
|
3381
3575
|
from = to = _state.Selection.near(state.doc.resolve(from)).from;
|
|
3382
3576
|
}
|
|
3383
|
-
const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to,
|
|
3577
|
+
const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to, _chunk66IMF6ODcjs.plainTextToSlice.call(void 0, content.text, state.schema));
|
|
3384
3578
|
const end = tr.mapping.map(to, 1);
|
|
3385
3579
|
view.dispatch(tr.scrollIntoView().setMeta("uiEvent", "drop"));
|
|
3386
3580
|
return end;
|
|
3387
3581
|
}
|
|
3582
|
+
function applyImportedReviewData(editor, content) {
|
|
3583
|
+
const storage = _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _130 => _130.storage]), () => ( {}));
|
|
3584
|
+
let comments = 0;
|
|
3585
|
+
let styles = 0;
|
|
3586
|
+
const store = _optionalChain([storage, 'access', _131 => _131.comment, 'optionalAccess', _132 => _132.store]);
|
|
3587
|
+
const threads = _nullishCoalesce(_optionalChain([content, 'access', _133 => _133.comments, 'optionalAccess', _134 => _134.threads]), () => ( []));
|
|
3588
|
+
if (store && threads.length) {
|
|
3589
|
+
const existing = store.toJSON().threads;
|
|
3590
|
+
const fresh = threads.filter((thread) => !existing.some((t) => t.id === thread.id));
|
|
3591
|
+
if (fresh.length) {
|
|
3592
|
+
store.load({ version: 1, threads: [...existing, ...fresh] });
|
|
3593
|
+
comments = fresh.length;
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
const registry = _optionalChain([storage, 'access', _135 => _135.paragraphStyles, 'optionalAccess', _136 => _136.registry]);
|
|
3597
|
+
if (registry && content.styles) {
|
|
3598
|
+
for (const style of content.styles.list()) {
|
|
3599
|
+
if (registry.get(style.id)) continue;
|
|
3600
|
+
registry.upsert(style);
|
|
3601
|
+
styles++;
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
return { comments, styles };
|
|
3605
|
+
}
|
|
3388
3606
|
async function importFilesIntoEditor(target, files, options = {}) {
|
|
3389
3607
|
const registry = _nullishCoalesce(options.registry, () => ( defaultImportRegistry));
|
|
3390
3608
|
const outcomes = [];
|
|
@@ -3398,8 +3616,11 @@ async function importFilesIntoEditor(target, files, options = {}) {
|
|
|
3398
3616
|
const view = toView(target);
|
|
3399
3617
|
if (view.isDestroyed) break;
|
|
3400
3618
|
at = insertImportedDocument(view, outcome.result, { at, asPlainText: options.asPlainText });
|
|
3619
|
+
if (!options.asPlainText && "storage" in target) {
|
|
3620
|
+
applyImportedReviewData(target, outcome.result);
|
|
3621
|
+
}
|
|
3401
3622
|
outcomes.push(outcome);
|
|
3402
|
-
_optionalChain([options, 'access',
|
|
3623
|
+
_optionalChain([options, 'access', _137 => _137.onImport, 'optionalCall', _138 => _138(outcome, file)]);
|
|
3403
3624
|
} catch (error) {
|
|
3404
3625
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3405
3626
|
if (options.onError) options.onError(err, file);
|
|
@@ -3418,7 +3639,7 @@ function getImportableFiles(files, registry) {
|
|
|
3418
3639
|
}
|
|
3419
3640
|
function dropPosition(view, event) {
|
|
3420
3641
|
try {
|
|
3421
|
-
return _optionalChain([view, 'access',
|
|
3642
|
+
return _optionalChain([view, 'access', _139 => _139.posAtCoords, 'call', _140 => _140({ left: event.clientX, top: event.clientY }), 'optionalAccess', _141 => _141.pos]);
|
|
3422
3643
|
} catch (e2) {
|
|
3423
3644
|
return void 0;
|
|
3424
3645
|
}
|
|
@@ -3455,7 +3676,7 @@ var FileImport = _core.Extension.create({
|
|
|
3455
3676
|
props: {
|
|
3456
3677
|
handleDrop(view, event, _slice, moved) {
|
|
3457
3678
|
if (!options.enableDrop || moved) return false;
|
|
3458
|
-
const files = getImportableFiles(_optionalChain([event, 'access',
|
|
3679
|
+
const files = getImportableFiles(_optionalChain([event, 'access', _142 => _142.dataTransfer, 'optionalAccess', _143 => _143.files]), registry());
|
|
3459
3680
|
if (!files) return false;
|
|
3460
3681
|
event.preventDefault();
|
|
3461
3682
|
run(view, files, dropPosition(view, event));
|
|
@@ -3463,7 +3684,7 @@ var FileImport = _core.Extension.create({
|
|
|
3463
3684
|
},
|
|
3464
3685
|
handlePaste(view, event) {
|
|
3465
3686
|
if (!options.enablePaste) return false;
|
|
3466
|
-
const files = getImportableFiles(_optionalChain([event, 'access',
|
|
3687
|
+
const files = getImportableFiles(_optionalChain([event, 'access', _144 => _144.clipboardData, 'optionalAccess', _145 => _145.files]), registry());
|
|
3467
3688
|
if (!files) return false;
|
|
3468
3689
|
event.preventDefault();
|
|
3469
3690
|
run(view, files);
|
|
@@ -3482,15 +3703,15 @@ var richClipboardPluginKey = new (0, _state.PluginKey)("richClipboard");
|
|
|
3482
3703
|
function writeRichClipboard(view, event, options = {}) {
|
|
3483
3704
|
const { state } = view;
|
|
3484
3705
|
if (state.selection.empty) return false;
|
|
3485
|
-
const data =
|
|
3706
|
+
const data = _chunkHNDSPZ5Tcjs.getClipboardData.call(void 0, event);
|
|
3486
3707
|
if (!data || typeof data.setData !== "function") return false;
|
|
3487
3708
|
const slice = state.selection.content();
|
|
3488
3709
|
const { dom, text } = view.serializeForClipboard(slice);
|
|
3489
3710
|
event.preventDefault();
|
|
3490
|
-
_optionalChain([data, 'access',
|
|
3711
|
+
_optionalChain([data, 'access', _146 => _146.clearData, 'optionalCall', _147 => _147()]);
|
|
3491
3712
|
data.setData("text/html", dom.innerHTML);
|
|
3492
3713
|
data.setData("text/plain", text);
|
|
3493
|
-
data.setData(_nullishCoalesce(options.mimeType, () => (
|
|
3714
|
+
data.setData(_nullishCoalesce(options.mimeType, () => ( _chunkHNDSPZ5Tcjs.PIXERATE_DOCUMENT_MIME)), _chunkHNDSPZ5Tcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
|
|
3494
3715
|
if (options.cut && view.editable) {
|
|
3495
3716
|
view.dispatch(state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
|
|
3496
3717
|
}
|
|
@@ -3500,7 +3721,7 @@ var RichClipboard = _core.Extension.create({
|
|
|
3500
3721
|
name: "richClipboard",
|
|
3501
3722
|
addOptions() {
|
|
3502
3723
|
return {
|
|
3503
|
-
mimeType:
|
|
3724
|
+
mimeType: _chunkHNDSPZ5Tcjs.PIXERATE_DOCUMENT_MIME,
|
|
3504
3725
|
plainTextMode: false
|
|
3505
3726
|
};
|
|
3506
3727
|
},
|
|
@@ -3508,7 +3729,7 @@ var RichClipboard = _core.Extension.create({
|
|
|
3508
3729
|
return { plainTextMode: !!this.options.plainTextMode };
|
|
3509
3730
|
},
|
|
3510
3731
|
addProseMirrorPlugins() {
|
|
3511
|
-
const mimeType = _nullishCoalesce(this.options.mimeType, () => (
|
|
3732
|
+
const mimeType = _nullishCoalesce(this.options.mimeType, () => ( _chunkHNDSPZ5Tcjs.PIXERATE_DOCUMENT_MIME));
|
|
3512
3733
|
const storage = this.storage;
|
|
3513
3734
|
return [
|
|
3514
3735
|
new (0, _state.Plugin)({
|
|
@@ -3520,7 +3741,7 @@ var RichClipboard = _core.Extension.create({
|
|
|
3520
3741
|
},
|
|
3521
3742
|
handlePaste(view, event) {
|
|
3522
3743
|
if (storage.plainTextMode) return false;
|
|
3523
|
-
const slice =
|
|
3744
|
+
const slice = _chunkHNDSPZ5Tcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
|
|
3524
3745
|
if (!slice) return false;
|
|
3525
3746
|
event.preventDefault();
|
|
3526
3747
|
view.dispatch(
|
|
@@ -3715,7 +3936,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3715
3936
|
addCommands() {
|
|
3716
3937
|
return {
|
|
3717
3938
|
undoAutocorrect: () => ({ state, tr, dispatch }) => {
|
|
3718
|
-
const last = _optionalChain([autocorrectPluginKey, 'access',
|
|
3939
|
+
const last = _optionalChain([autocorrectPluginKey, 'access', _148 => _148.getState, 'call', _149 => _149(state), 'optionalAccess', _150 => _150.last]);
|
|
3719
3940
|
if (!last) return false;
|
|
3720
3941
|
if (state.doc.textBetween(last.from, last.to) !== last.replacement) return false;
|
|
3721
3942
|
if (dispatch) {
|
|
@@ -3765,7 +3986,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3765
3986
|
}
|
|
3766
3987
|
const insertTyped = () => {
|
|
3767
3988
|
const tr2 = state.tr.insertText(text, from, to);
|
|
3768
|
-
if (_optionalChain([pluginState, 'optionalAccess',
|
|
3989
|
+
if (_optionalChain([pluginState, 'optionalAccess', _151 => _151.closePending])) _history.closeHistory.call(void 0, tr2);
|
|
3769
3990
|
view.dispatch(tr2);
|
|
3770
3991
|
};
|
|
3771
3992
|
if (isIgnored(state, from, to)) return false;
|
|
@@ -3773,7 +3994,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3773
3994
|
if (extension.options.ignorePromptTokens && isInsidePromptToken(textBefore)) {
|
|
3774
3995
|
return false;
|
|
3775
3996
|
}
|
|
3776
|
-
const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access',
|
|
3997
|
+
const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _152 => _152.exec, 'call', _153 => _153(textBefore), 'optionalAccess', _154 => _154[0]]), () => ( ""));
|
|
3777
3998
|
if (/:\/\/|^www\./i.test(currentWord)) return false;
|
|
3778
3999
|
const exceptions = extension.storage.exceptions;
|
|
3779
4000
|
const found = findAutocorrection(textBefore, extension.options.rules, {
|
|
@@ -3781,7 +4002,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3781
4002
|
isException: (value) => exceptions.has(value.toLowerCase())
|
|
3782
4003
|
});
|
|
3783
4004
|
if (!found) {
|
|
3784
|
-
if (!_optionalChain([pluginState, 'optionalAccess',
|
|
4005
|
+
if (!_optionalChain([pluginState, 'optionalAccess', _155 => _155.closePending])) return false;
|
|
3785
4006
|
insertTyped();
|
|
3786
4007
|
return true;
|
|
3787
4008
|
}
|
|
@@ -3818,7 +4039,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3818
4039
|
_history.closeHistory.call(void 0, tr);
|
|
3819
4040
|
tr.setMeta(autocorrectPluginKey, { correction });
|
|
3820
4041
|
view.dispatch(tr);
|
|
3821
|
-
_optionalChain([extension, 'access',
|
|
4042
|
+
_optionalChain([extension, 'access', _156 => _156.options, 'access', _157 => _157.onCorrection, 'optionalCall', _158 => _158(correction)]);
|
|
3822
4043
|
return true;
|
|
3823
4044
|
};
|
|
3824
4045
|
return [
|
|
@@ -3828,8 +4049,8 @@ var Autocorrect = _core.Extension.create({
|
|
|
3828
4049
|
init: () => ({ last: null, closePending: false }),
|
|
3829
4050
|
apply: (tr, prev) => {
|
|
3830
4051
|
const meta = tr.getMeta(autocorrectPluginKey);
|
|
3831
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
3832
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
4052
|
+
if (_optionalChain([meta, 'optionalAccess', _159 => _159.correction])) return { last: meta.correction, closePending: true };
|
|
4053
|
+
if (_optionalChain([meta, 'optionalAccess', _160 => _160.undo])) return { last: null, closePending: true };
|
|
3833
4054
|
if (!tr.docChanged) return prev;
|
|
3834
4055
|
if (!prev.last && !prev.closePending) return prev;
|
|
3835
4056
|
return { last: null, closePending: false };
|
|
@@ -3910,7 +4131,7 @@ function arraysEqual(a, b, eq) {
|
|
|
3910
4131
|
}
|
|
3911
4132
|
function scrollDomAtPos(view, pos, behavior = "smooth") {
|
|
3912
4133
|
try {
|
|
3913
|
-
const dom = _optionalChain([view, 'optionalAccess',
|
|
4134
|
+
const dom = _optionalChain([view, 'optionalAccess', _161 => _161.nodeDOM, 'optionalCall', _162 => _162(pos)]);
|
|
3914
4135
|
if (dom && typeof dom.scrollIntoView === "function") {
|
|
3915
4136
|
dom.scrollIntoView({ block: "start", behavior });
|
|
3916
4137
|
}
|
|
@@ -3925,7 +4146,7 @@ function syncInitialContent(editor, sync) {
|
|
|
3925
4146
|
errorOnInvalidContent: false
|
|
3926
4147
|
});
|
|
3927
4148
|
const tr = sync(_state.EditorState.create({ doc }));
|
|
3928
|
-
if (_optionalChain([tr, 'optionalAccess',
|
|
4149
|
+
if (_optionalChain([tr, 'optionalAccess', _163 => _163.docChanged])) editor.options.content = tr.doc;
|
|
3929
4150
|
} catch (e4) {
|
|
3930
4151
|
}
|
|
3931
4152
|
}
|
|
@@ -4006,7 +4227,7 @@ function createOutlineStore(editor) {
|
|
|
4006
4227
|
const compute = () => {
|
|
4007
4228
|
if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
|
|
4008
4229
|
const headings = getOutline(editor);
|
|
4009
|
-
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call',
|
|
4230
|
+
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _164 => _164(editor, headings), 'optionalAccess', _165 => _165.id]), () => ( null));
|
|
4010
4231
|
const sameStructure = arraysEqual(snapshot.headings, headings, sameHeading);
|
|
4011
4232
|
if (sameStructure && snapshot.activeId === activeId) return snapshot;
|
|
4012
4233
|
return {
|
|
@@ -4031,16 +4252,16 @@ function createOutlineStore(editor) {
|
|
|
4031
4252
|
subscribe(listener) {
|
|
4032
4253
|
if (!listeners.size) {
|
|
4033
4254
|
snapshot = compute();
|
|
4034
|
-
_optionalChain([editor, 'optionalAccess',
|
|
4255
|
+
_optionalChain([editor, 'optionalAccess', _166 => _166.on, 'call', _167 => _167("transaction", onTransaction)]);
|
|
4035
4256
|
}
|
|
4036
4257
|
listeners.add(listener);
|
|
4037
4258
|
return () => {
|
|
4038
4259
|
listeners.delete(listener);
|
|
4039
|
-
if (!listeners.size) _optionalChain([editor, 'optionalAccess',
|
|
4260
|
+
if (!listeners.size) _optionalChain([editor, 'optionalAccess', _168 => _168.off, 'call', _169 => _169("transaction", onTransaction)]);
|
|
4040
4261
|
};
|
|
4041
4262
|
},
|
|
4042
4263
|
destroy() {
|
|
4043
|
-
_optionalChain([editor, 'optionalAccess',
|
|
4264
|
+
_optionalChain([editor, 'optionalAccess', _170 => _170.off, 'call', _171 => _171("transaction", onTransaction)]);
|
|
4044
4265
|
listeners.clear();
|
|
4045
4266
|
}
|
|
4046
4267
|
};
|
|
@@ -4115,7 +4336,7 @@ var Outline = _core.Extension.create({
|
|
|
4115
4336
|
if (options.focus !== false) {
|
|
4116
4337
|
tr.setSelection(_state.TextSelection.create(tr.doc, heading.pos + 1));
|
|
4117
4338
|
tr.scrollIntoView();
|
|
4118
|
-
_optionalChain([view, 'optionalAccess',
|
|
4339
|
+
_optionalChain([view, 'optionalAccess', _172 => _172.focus, 'optionalCall', _173 => _173()]);
|
|
4119
4340
|
}
|
|
4120
4341
|
scrollDomAtPos(view, heading.pos, options.behavior);
|
|
4121
4342
|
}
|
|
@@ -4147,7 +4368,7 @@ var Outline = _core.Extension.create({
|
|
|
4147
4368
|
const next = computeOutline(newState.doc, types);
|
|
4148
4369
|
if (arraysEqual(prev, next, sameHeading)) return prev;
|
|
4149
4370
|
storage.headings = next;
|
|
4150
|
-
_optionalChain([onUpdate, 'call',
|
|
4371
|
+
_optionalChain([onUpdate, 'call', _174 => _174(), 'optionalCall', _175 => _175(next)]);
|
|
4151
4372
|
return next;
|
|
4152
4373
|
}
|
|
4153
4374
|
}
|
|
@@ -4466,7 +4687,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4466
4687
|
handleDOMEvents: {
|
|
4467
4688
|
click: (view, event) => {
|
|
4468
4689
|
const target = event.target;
|
|
4469
|
-
const link = _optionalChain([target, 'optionalAccess',
|
|
4690
|
+
const link = _optionalChain([target, 'optionalAccess', _176 => _176.closest, 'optionalCall', _177 => _177(
|
|
4470
4691
|
'nav[data-type="table-of-contents"] a[data-heading-id]'
|
|
4471
4692
|
)]);
|
|
4472
4693
|
if (!link) return false;
|
|
@@ -4539,7 +4760,7 @@ function getFootnotes(doc) {
|
|
|
4539
4760
|
number: index + 1,
|
|
4540
4761
|
text: footnote ? footnoteText(footnote.node) : "",
|
|
4541
4762
|
referencePos: ref.pos,
|
|
4542
|
-
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess',
|
|
4763
|
+
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _178 => _178.pos]), () => ( null))
|
|
4543
4764
|
};
|
|
4544
4765
|
});
|
|
4545
4766
|
}
|
|
@@ -4581,7 +4802,7 @@ function syncFootnotes(tr, options = {}) {
|
|
|
4581
4802
|
});
|
|
4582
4803
|
const desiredItems = desiredRefs.map(({ id, number, copyOf }) => {
|
|
4583
4804
|
const source = _nullishCoalesce(existing.get(id), () => ( (copyOf ? existing.get(copyOf) : void 0)));
|
|
4584
|
-
const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
4805
|
+
const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _179 => _179.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _180 => _180.contents, 'optionalAccess', _181 => _181[id]]), () => ( "")))));
|
|
4585
4806
|
if (source && source.attrs.id === id && source.attrs.number === number) {
|
|
4586
4807
|
return source;
|
|
4587
4808
|
}
|
|
@@ -4784,7 +5005,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4784
5005
|
handleClickOn: (_view, _pos, node, _nodePos, event) => {
|
|
4785
5006
|
if (node.type.name !== REFERENCE || !node.attrs.id) return false;
|
|
4786
5007
|
const target = event.target;
|
|
4787
|
-
if (!_optionalChain([target, 'optionalAccess',
|
|
5008
|
+
if (!_optionalChain([target, 'optionalAccess', _182 => _182.closest, 'optionalCall', _183 => _183("a")])) return false;
|
|
4788
5009
|
event.preventDefault();
|
|
4789
5010
|
return editor.commands.goToFootnote(node.attrs.id);
|
|
4790
5011
|
}
|
|
@@ -4982,7 +5203,7 @@ var Bookmark = _core.Mark.create({
|
|
|
4982
5203
|
}
|
|
4983
5204
|
if (!dispatch) return true;
|
|
4984
5205
|
const sameName = getBookmarks(state.doc).find((b) => b.name === name);
|
|
4985
|
-
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess',
|
|
5206
|
+
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _184 => _184.id]))), () => ( this.options.generateId()));
|
|
4986
5207
|
if (sameName) {
|
|
4987
5208
|
forEachBookmarkRange(
|
|
4988
5209
|
tr.doc,
|
|
@@ -5224,7 +5445,7 @@ var CrossReference = _core.Node.create({
|
|
|
5224
5445
|
// src/extensions/document-structure/command-items.ts
|
|
5225
5446
|
var start = (editor, args) => {
|
|
5226
5447
|
const chain = editor.chain().focus();
|
|
5227
|
-
return _optionalChain([args, 'optionalAccess',
|
|
5448
|
+
return _optionalChain([args, 'optionalAccess', _185 => _185.range]) ? chain.deleteRange(args.range) : chain;
|
|
5228
5449
|
};
|
|
5229
5450
|
var documentStructureCommandItems = [
|
|
5230
5451
|
{
|
|
@@ -5241,7 +5462,7 @@ var documentStructureCommandItems = [
|
|
|
5241
5462
|
description: "Insert a numbered footnote",
|
|
5242
5463
|
keywords: ["footnote", "note", "fn", "citation"],
|
|
5243
5464
|
extension: "footnoteReference",
|
|
5244
|
-
run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess',
|
|
5465
|
+
run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _186 => _186.content]) }).run()
|
|
5245
5466
|
},
|
|
5246
5467
|
{
|
|
5247
5468
|
id: "bookmark",
|
|
@@ -5250,7 +5471,7 @@ var documentStructureCommandItems = [
|
|
|
5250
5471
|
keywords: ["bookmark", "anchor", "name"],
|
|
5251
5472
|
extension: "bookmark",
|
|
5252
5473
|
requires: "name",
|
|
5253
|
-
run: (editor, args) => !!_optionalChain([args, 'optionalAccess',
|
|
5474
|
+
run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _187 => _187.name]) && start(editor, args).setBookmark({ name: args.name }).run()
|
|
5254
5475
|
},
|
|
5255
5476
|
{
|
|
5256
5477
|
id: "cross-reference",
|
|
@@ -5259,7 +5480,7 @@ var documentStructureCommandItems = [
|
|
|
5259
5480
|
keywords: ["cross", "reference", "xref", "link", "ref"],
|
|
5260
5481
|
extension: "crossReference",
|
|
5261
5482
|
requires: "target",
|
|
5262
|
-
run: (editor, args) => !!_optionalChain([args, 'optionalAccess',
|
|
5483
|
+
run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _188 => _188.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
|
|
5263
5484
|
}
|
|
5264
5485
|
];
|
|
5265
5486
|
function getDocumentStructureCommandItems(editor, query = "") {
|
|
@@ -6163,17 +6384,17 @@ var EMPTY_FIND_REPLACE_SNAPSHOT = Object.freeze({
|
|
|
6163
6384
|
lastReplaceCount: null,
|
|
6164
6385
|
focusRequest: 0
|
|
6165
6386
|
});
|
|
6166
|
-
var FindReplaceStore = (
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6387
|
+
var FindReplaceStore = (_class3 = class {constructor() { _class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this); }
|
|
6388
|
+
__init4() {this.snapshot = EMPTY_FIND_REPLACE_SNAPSHOT}
|
|
6389
|
+
__init5() {this.listeners = /* @__PURE__ */ new Set()}
|
|
6390
|
+
__init6() {this.subscribe = (listener) => {
|
|
6170
6391
|
this.listeners.add(listener);
|
|
6171
6392
|
listener(this.snapshot);
|
|
6172
6393
|
return () => {
|
|
6173
6394
|
this.listeners.delete(listener);
|
|
6174
6395
|
};
|
|
6175
6396
|
}}
|
|
6176
|
-
|
|
6397
|
+
__init7() {this.getSnapshot = () => this.snapshot}
|
|
6177
6398
|
/** @internal Called by the extension's plugin view. */
|
|
6178
6399
|
set(snapshot) {
|
|
6179
6400
|
if (snapshot === this.snapshot) return;
|
|
@@ -6186,16 +6407,16 @@ var FindReplaceStore = (_class4 = class {constructor() { _class4.prototype.__ini
|
|
|
6186
6407
|
}
|
|
6187
6408
|
});
|
|
6188
6409
|
}
|
|
6189
|
-
},
|
|
6410
|
+
}, _class3);
|
|
6190
6411
|
var findReplacePluginKey = new (0, _state.PluginKey)("findReplace");
|
|
6191
6412
|
function getFindReplaceState(source) {
|
|
6192
|
-
const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
6413
|
+
const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _189 => _189.state]), () => ( source));
|
|
6193
6414
|
if (!state || typeof state.plugins === "undefined") return null;
|
|
6194
6415
|
const plugin = findReplacePluginKey.getState(state);
|
|
6195
6416
|
return plugin ? toSnapshot(plugin) : null;
|
|
6196
6417
|
}
|
|
6197
6418
|
function getFindReplaceStore(editor) {
|
|
6198
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
6419
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _190 => _190.storage, 'optionalAccess', _191 => _191.findReplace, 'optionalAccess', _192 => _192.store]), () => ( null));
|
|
6199
6420
|
}
|
|
6200
6421
|
var snapshotCache = /* @__PURE__ */ new WeakMap();
|
|
6201
6422
|
function toSnapshot(s) {
|
|
@@ -6366,7 +6587,7 @@ var FindReplace = _core.Extension.create({
|
|
|
6366
6587
|
const open = (mode) => () => this.editor.commands.openFindReplace({ mode });
|
|
6367
6588
|
const step = (forward) => () => {
|
|
6368
6589
|
const s = findReplacePluginKey.getState(this.editor.state);
|
|
6369
|
-
if (!_optionalChain([s, 'optionalAccess',
|
|
6590
|
+
if (!_optionalChain([s, 'optionalAccess', _193 => _193.active]) || !s.matches.length) return false;
|
|
6370
6591
|
return forward ? this.editor.commands.findNext() : this.editor.commands.findPrevious();
|
|
6371
6592
|
};
|
|
6372
6593
|
return {
|
|
@@ -6479,7 +6700,7 @@ var FindReplace = _core.Extension.create({
|
|
|
6479
6700
|
s = {
|
|
6480
6701
|
...s,
|
|
6481
6702
|
currentIndex: m.index,
|
|
6482
|
-
anchor: _nullishCoalesce(_optionalChain([s, 'access',
|
|
6703
|
+
anchor: _nullishCoalesce(_optionalChain([s, 'access', _194 => _194.matches, 'access', _195 => _195[m.index], 'optionalAccess', _196 => _196.from]), () => ( s.anchor))
|
|
6483
6704
|
};
|
|
6484
6705
|
redecorate = true;
|
|
6485
6706
|
break;
|
|
@@ -6495,7 +6716,7 @@ var FindReplace = _core.Extension.create({
|
|
|
6495
6716
|
}
|
|
6496
6717
|
},
|
|
6497
6718
|
props: {
|
|
6498
|
-
decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access',
|
|
6719
|
+
decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _197 => _197.getState, 'call', _198 => _198(state), 'optionalAccess', _199 => _199.decorations]), () => ( _view2.DecorationSet.empty))
|
|
6499
6720
|
},
|
|
6500
6721
|
view: (view) => {
|
|
6501
6722
|
const sync = () => {
|
|
@@ -6520,519 +6741,15 @@ function safeClipboard(get) {
|
|
|
6520
6741
|
// src/extensions/paragraph-styles/extension.ts
|
|
6521
6742
|
|
|
6522
6743
|
|
|
6523
|
-
|
|
6524
|
-
// src/extensions/paragraph-styles/registry.ts
|
|
6525
|
-
var MAX_CHAIN = 32;
|
|
6526
|
-
var STYLE_ID = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
6527
|
-
var UNSAFE_CSS = /[;{}<>\\]|\/\*|url\s*\(|expression\s*\(|@import|javascript:/i;
|
|
6528
|
-
var NORMAL_STYLE_ID = "Normal";
|
|
6529
|
-
var PREVIEW_PROPERTIES = /* @__PURE__ */ new Set([
|
|
6530
|
-
"font-family",
|
|
6531
|
-
"font-weight",
|
|
6532
|
-
"font-style",
|
|
6533
|
-
"color",
|
|
6534
|
-
"text-decoration-line",
|
|
6535
|
-
"text-transform",
|
|
6536
|
-
"letter-spacing",
|
|
6537
|
-
"font-variant-caps"
|
|
6538
|
-
]);
|
|
6539
|
-
function isValidStyleId(id) {
|
|
6540
|
-
return typeof id === "string" && STYLE_ID.test(id);
|
|
6541
|
-
}
|
|
6542
|
-
var MUTED = "var(--pixerate-style-muted, #6b7280)";
|
|
6543
|
-
var HEADING_SIZES = ["2em", "1.5em", "1.25em", "1.1em", "1em", "0.9em"];
|
|
6544
|
-
function builtinStyles() {
|
|
6545
|
-
const styles = [
|
|
6546
|
-
{
|
|
6547
|
-
id: NORMAL_STYLE_ID,
|
|
6548
|
-
name: "Normal",
|
|
6549
|
-
kind: "paragraph",
|
|
6550
|
-
block: { type: "paragraph" },
|
|
6551
|
-
priority: 0,
|
|
6552
|
-
quick: true,
|
|
6553
|
-
builtin: true
|
|
6554
|
-
},
|
|
6555
|
-
{
|
|
6556
|
-
id: "Title",
|
|
6557
|
-
name: "Title",
|
|
6558
|
-
kind: "paragraph",
|
|
6559
|
-
basedOn: NORMAL_STYLE_ID,
|
|
6560
|
-
next: NORMAL_STYLE_ID,
|
|
6561
|
-
linked: "TitleChar",
|
|
6562
|
-
paragraph: { spaceAfter: "0.25em", lineHeight: "1.15" },
|
|
6563
|
-
character: { fontSize: "2.5em", bold: true, letterSpacing: "-0.01em" },
|
|
6564
|
-
priority: 10,
|
|
6565
|
-
quick: true,
|
|
6566
|
-
builtin: true
|
|
6567
|
-
},
|
|
6568
|
-
{
|
|
6569
|
-
id: "Subtitle",
|
|
6570
|
-
name: "Subtitle",
|
|
6571
|
-
kind: "paragraph",
|
|
6572
|
-
basedOn: NORMAL_STYLE_ID,
|
|
6573
|
-
next: NORMAL_STYLE_ID,
|
|
6574
|
-
linked: "SubtitleChar",
|
|
6575
|
-
paragraph: { spaceAfter: "0.75em" },
|
|
6576
|
-
character: { fontSize: "1.25em", color: MUTED },
|
|
6577
|
-
priority: 11,
|
|
6578
|
-
quick: true,
|
|
6579
|
-
builtin: true
|
|
6580
|
-
}
|
|
6581
|
-
];
|
|
6582
|
-
HEADING_SIZES.forEach((fontSize, i) => {
|
|
6583
|
-
const level = i + 1;
|
|
6584
|
-
styles.push({
|
|
6585
|
-
id: `Heading${level}`,
|
|
6586
|
-
name: `Heading ${level}`,
|
|
6587
|
-
kind: "paragraph",
|
|
6588
|
-
basedOn: NORMAL_STYLE_ID,
|
|
6589
|
-
next: NORMAL_STYLE_ID,
|
|
6590
|
-
linked: `Heading${level}Char`,
|
|
6591
|
-
block: { type: "heading", attrs: { level } },
|
|
6592
|
-
paragraph: { spaceBefore: level <= 2 ? "1em" : "0.75em", spaceAfter: "0.25em" },
|
|
6593
|
-
character: { fontSize, bold: true },
|
|
6594
|
-
priority: 11 + level,
|
|
6595
|
-
quick: level <= 3,
|
|
6596
|
-
builtin: true
|
|
6597
|
-
});
|
|
6598
|
-
});
|
|
6599
|
-
styles.push(
|
|
6600
|
-
{
|
|
6601
|
-
id: "Quote",
|
|
6602
|
-
name: "Quote",
|
|
6603
|
-
kind: "paragraph",
|
|
6604
|
-
basedOn: NORMAL_STYLE_ID,
|
|
6605
|
-
next: NORMAL_STYLE_ID,
|
|
6606
|
-
linked: "QuoteChar",
|
|
6607
|
-
paragraph: { indentLeft: "1em", paddingLeft: "0.75em", borderLeft: "3px solid currentColor" },
|
|
6608
|
-
character: { italic: true, color: MUTED },
|
|
6609
|
-
priority: 29,
|
|
6610
|
-
quick: true,
|
|
6611
|
-
builtin: true
|
|
6612
|
-
},
|
|
6613
|
-
{
|
|
6614
|
-
id: "Code",
|
|
6615
|
-
name: "Code",
|
|
6616
|
-
kind: "paragraph",
|
|
6617
|
-
basedOn: NORMAL_STYLE_ID,
|
|
6618
|
-
next: NORMAL_STYLE_ID,
|
|
6619
|
-
block: { type: "codeBlock" },
|
|
6620
|
-
character: {
|
|
6621
|
-
fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
|
|
6622
|
-
fontSize: "0.9em"
|
|
6623
|
-
},
|
|
6624
|
-
priority: 30,
|
|
6625
|
-
quick: true,
|
|
6626
|
-
builtin: true
|
|
6627
|
-
},
|
|
6628
|
-
{
|
|
6629
|
-
id: "ListParagraph",
|
|
6630
|
-
name: "List Paragraph",
|
|
6631
|
-
kind: "paragraph",
|
|
6632
|
-
basedOn: NORMAL_STYLE_ID,
|
|
6633
|
-
paragraph: { indentLeft: "2em" },
|
|
6634
|
-
priority: 34,
|
|
6635
|
-
quick: true,
|
|
6636
|
-
builtin: true
|
|
6637
|
-
}
|
|
6638
|
-
);
|
|
6639
|
-
const linked = ["Title", "Subtitle", "Quote", ...HEADING_SIZES.map((_, i) => `Heading${i + 1}`)];
|
|
6640
|
-
linked.forEach((paragraphId) => {
|
|
6641
|
-
const name = styles.find((s) => s.id === paragraphId).name;
|
|
6642
|
-
styles.push({
|
|
6643
|
-
id: `${paragraphId}Char`,
|
|
6644
|
-
name: `${name} Char`,
|
|
6645
|
-
kind: "character",
|
|
6646
|
-
linked: paragraphId,
|
|
6647
|
-
priority: 99,
|
|
6648
|
-
hidden: true,
|
|
6649
|
-
builtin: true
|
|
6650
|
-
});
|
|
6651
|
-
});
|
|
6652
|
-
styles.push(
|
|
6653
|
-
{
|
|
6654
|
-
id: "Emphasis",
|
|
6655
|
-
name: "Emphasis",
|
|
6656
|
-
kind: "character",
|
|
6657
|
-
character: { italic: true },
|
|
6658
|
-
priority: 20,
|
|
6659
|
-
quick: true,
|
|
6660
|
-
builtin: true
|
|
6661
|
-
},
|
|
6662
|
-
{
|
|
6663
|
-
id: "Strong",
|
|
6664
|
-
name: "Strong",
|
|
6665
|
-
kind: "character",
|
|
6666
|
-
character: { bold: true },
|
|
6667
|
-
priority: 22,
|
|
6668
|
-
quick: true,
|
|
6669
|
-
builtin: true
|
|
6670
|
-
}
|
|
6671
|
-
);
|
|
6672
|
-
return styles;
|
|
6673
|
-
}
|
|
6674
|
-
var DEFAULT_STYLES = Object.freeze(builtinStyles());
|
|
6675
|
-
var clone = (value) => value === void 0 ? value : JSON.parse(JSON.stringify(value));
|
|
6676
|
-
function overlay(base, patch) {
|
|
6677
|
-
if (!patch) return base;
|
|
6678
|
-
const out = { ...base };
|
|
6679
|
-
Object.entries(patch).forEach(([key, value]) => {
|
|
6680
|
-
if (value !== void 0 && value !== null) out[key] = value;
|
|
6681
|
-
});
|
|
6682
|
-
return out;
|
|
6683
|
-
}
|
|
6684
|
-
function sameBlock(a, type, attrs) {
|
|
6685
|
-
if (a.type !== type) return false;
|
|
6686
|
-
return Object.entries(_nullishCoalesce(a.attrs, () => ( {}))).every(([key, value]) => attrs[key] === value);
|
|
6687
|
-
}
|
|
6688
|
-
var StyleRegistry = (_class5 = class {
|
|
6689
|
-
__init10() {this.styles = /* @__PURE__ */ new Map()}
|
|
6690
|
-
|
|
6691
|
-
__init11() {this.version = 0}
|
|
6692
|
-
__init12() {this.snapshot = null}
|
|
6693
|
-
__init13() {this.listeners = /* @__PURE__ */ new Set()}
|
|
6694
|
-
constructor(options = {}) {;_class5.prototype.__init10.call(this);_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);
|
|
6695
|
-
this.defaults = clone(_nullishCoalesce(options.defaults, () => ( {})));
|
|
6696
|
-
if (options.builtins !== false) DEFAULT_STYLES.forEach((style) => this.styles.set(style.id, clone(style)));
|
|
6697
|
-
(_nullishCoalesce(options.styles, () => ( []))).forEach((style) => this.put(style));
|
|
6698
|
-
}
|
|
6699
|
-
// -- Reading --------------------------------------------------------------
|
|
6700
|
-
get(id) {
|
|
6701
|
-
return id ? this.styles.get(id) : void 0;
|
|
6702
|
-
}
|
|
6703
|
-
/** Finds a style by id or display name (case-insensitive). */
|
|
6704
|
-
find(nameOrId) {
|
|
6705
|
-
const direct = this.styles.get(nameOrId);
|
|
6706
|
-
if (direct) return direct;
|
|
6707
|
-
const lower = nameOrId.toLowerCase();
|
|
6708
|
-
return this.list().find((style) => style.name.toLowerCase() === lower);
|
|
6709
|
-
}
|
|
6710
|
-
/** All styles (optionally of one kind) in gallery order. */
|
|
6711
|
-
list(kind) {
|
|
6712
|
-
return Array.from(this.styles.values()).filter((style) => !kind || style.kind === kind).sort((a, b) => (_nullishCoalesce(a.priority, () => ( 99))) - (_nullishCoalesce(b.priority, () => ( 99))) || a.name.localeCompare(b.name));
|
|
6713
|
-
}
|
|
6714
|
-
/** Styles shown in the gallery (`quick`, not hidden), paragraph styles by default. */
|
|
6715
|
-
gallery(kind = "paragraph") {
|
|
6716
|
-
return this.list(kind).filter((style) => style.quick && !style.hidden);
|
|
6717
|
-
}
|
|
6718
|
-
/** The `basedOn` chain from the root style down to `id` (cycle-safe, bounded). */
|
|
6719
|
-
chain(id) {
|
|
6720
|
-
const out = [];
|
|
6721
|
-
let current = this.styles.get(id);
|
|
6722
|
-
while (current && out.length < MAX_CHAIN && !out.includes(current)) {
|
|
6723
|
-
out.push(current);
|
|
6724
|
-
current = current.basedOn ? this.styles.get(current.basedOn) : void 0;
|
|
6725
|
-
}
|
|
6726
|
-
return out.reverse();
|
|
6727
|
-
}
|
|
6728
|
-
/**
|
|
6729
|
-
* Resolves a paragraph style: defaults, then each style of the chain (base
|
|
6730
|
-
* first). Unknown ids resolve to the defaults in a `paragraph` block.
|
|
6731
|
-
*/
|
|
6732
|
-
resolve(id) {
|
|
6733
|
-
let paragraph = overlay({}, this.defaults.paragraph);
|
|
6734
|
-
let character = overlay({}, this.defaults.character);
|
|
6735
|
-
let block = { type: "paragraph" };
|
|
6736
|
-
this.chain(id).forEach((style) => {
|
|
6737
|
-
if (style.kind !== "paragraph") return;
|
|
6738
|
-
paragraph = overlay(paragraph, style.paragraph);
|
|
6739
|
-
character = overlay(character, style.character);
|
|
6740
|
-
if (style.block) block = clone(style.block);
|
|
6741
|
-
});
|
|
6742
|
-
return { id, paragraph, character, block, next: this.nextStyleId(id) };
|
|
6743
|
-
}
|
|
6744
|
-
/** Character formatting a paragraph style's chain sets (without defaults). */
|
|
6745
|
-
paragraphCharacter(id) {
|
|
6746
|
-
let character = {};
|
|
6747
|
-
this.chain(id).forEach((style) => {
|
|
6748
|
-
if (style.kind === "paragraph") character = overlay(character, style.character);
|
|
6749
|
-
});
|
|
6750
|
-
return character;
|
|
6751
|
-
}
|
|
6752
|
-
/**
|
|
6753
|
-
* Character formatting of a character style's chain. A style linked to a
|
|
6754
|
-
* paragraph style takes that style's character formatting first.
|
|
6755
|
-
*/
|
|
6756
|
-
resolveCharacterStyle(id) {
|
|
6757
|
-
let character = {};
|
|
6758
|
-
this.chain(id).forEach((style) => {
|
|
6759
|
-
if (style.kind === "character" && style.linked && _optionalChain([this, 'access', _195 => _195.get, 'call', _196 => _196(style.linked), 'optionalAccess', _197 => _197.kind]) === "paragraph") {
|
|
6760
|
-
character = overlay(character, this.paragraphCharacter(style.linked));
|
|
6761
|
-
}
|
|
6762
|
-
character = overlay(character, style.character);
|
|
6763
|
-
});
|
|
6764
|
-
return character;
|
|
6765
|
-
}
|
|
6766
|
-
/**
|
|
6767
|
-
* Character formatting of text: defaults → paragraph style chain →
|
|
6768
|
-
* character style chain → direct formatting.
|
|
6769
|
-
*/
|
|
6770
|
-
resolveText(input) {
|
|
6771
|
-
let character = this.resolve(input.paragraphStyle || NORMAL_STYLE_ID).character;
|
|
6772
|
-
if (input.characterStyle) character = overlay(character, this.resolveCharacterStyle(input.characterStyle));
|
|
6773
|
-
return overlay(character, input.direct);
|
|
6774
|
-
}
|
|
6775
|
-
/** The style after Enter at the end of a paragraph of `id` (itself when unset or unknown). */
|
|
6776
|
-
nextStyleId(id) {
|
|
6777
|
-
const next = _optionalChain([this, 'access', _198 => _198.styles, 'access', _199 => _199.get, 'call', _200 => _200(id), 'optionalAccess', _201 => _201.next]);
|
|
6778
|
-
return next && _optionalChain([this, 'access', _202 => _202.styles, 'access', _203 => _203.get, 'call', _204 => _204(next), 'optionalAccess', _205 => _205.kind]) === "paragraph" ? next : id;
|
|
6779
|
-
}
|
|
6780
|
-
/** The linked character style of a paragraph style, if any. */
|
|
6781
|
-
linkedCharacterStyle(id) {
|
|
6782
|
-
const style = this.styles.get(id);
|
|
6783
|
-
const linked = _optionalChain([style, 'optionalAccess', _206 => _206.linked]) ? this.styles.get(style.linked) : void 0;
|
|
6784
|
-
return _optionalChain([style, 'optionalAccess', _207 => _207.kind]) === "paragraph" && _optionalChain([linked, 'optionalAccess', _208 => _208.kind]) === "character" ? linked : void 0;
|
|
6785
|
-
}
|
|
6786
|
-
/**
|
|
6787
|
-
* The style a block uses when it names none: Normal for paragraphs,
|
|
6788
|
-
* Heading N for headings of level N, Code for code blocks (the built-in
|
|
6789
|
-
* style whose own `block` matches).
|
|
6790
|
-
*/
|
|
6791
|
-
defaultStyleFor(type, attrs = {}) {
|
|
6792
|
-
if (type === "paragraph" && this.styles.get(NORMAL_STYLE_ID)) return NORMAL_STYLE_ID;
|
|
6793
|
-
const candidates = this.list("paragraph").filter(
|
|
6794
|
-
(style) => style.block && sameBlock(style.block, type, attrs)
|
|
6795
|
-
);
|
|
6796
|
-
return _nullishCoalesce(_optionalChain([(_nullishCoalesce(candidates.find((s) => s.builtin), () => ( candidates[0]))), 'optionalAccess', _209 => _209.id]), () => ( null));
|
|
6797
|
-
}
|
|
6798
|
-
/** The style of a block: its `styleId` when known, otherwise the block's default style. */
|
|
6799
|
-
styleOfBlock(type, attrs = {}) {
|
|
6800
|
-
const id = attrs.styleId;
|
|
6801
|
-
if (id && _optionalChain([this, 'access', _210 => _210.styles, 'access', _211 => _211.get, 'call', _212 => _212(id), 'optionalAccess', _213 => _213.kind]) === "paragraph") return id;
|
|
6802
|
-
return this.defaultStyleFor(type, attrs);
|
|
6803
|
-
}
|
|
6804
|
-
__init14() {this.getSnapshot = () => {
|
|
6805
|
-
if (!this.snapshot) {
|
|
6806
|
-
this.snapshot = Object.freeze({
|
|
6807
|
-
styles: Object.freeze(this.list()),
|
|
6808
|
-
defaults: this.defaults,
|
|
6809
|
-
version: this.version
|
|
6810
|
-
});
|
|
6811
|
-
}
|
|
6812
|
-
return this.snapshot;
|
|
6813
|
-
}}
|
|
6814
|
-
__init15() {this.subscribe = (listener) => {
|
|
6815
|
-
this.listeners.add(listener);
|
|
6816
|
-
listener(this.getSnapshot());
|
|
6817
|
-
return () => {
|
|
6818
|
-
this.listeners.delete(listener);
|
|
6819
|
-
};
|
|
6820
|
-
}}
|
|
6821
|
-
toJSON() {
|
|
6822
|
-
return { styles: clone(Array.from(this.styles.values())), defaults: clone(this.defaults) };
|
|
6823
|
-
}
|
|
6824
|
-
// -- Writing --------------------------------------------------------------
|
|
6825
|
-
/** Adds or replaces a style. Throws on an invalid id. */
|
|
6826
|
-
upsert(style) {
|
|
6827
|
-
const stored = this.put(style);
|
|
6828
|
-
this.changed();
|
|
6829
|
-
return stored;
|
|
6830
|
-
}
|
|
6831
|
-
/** Merges `patch` into a style (formats are merged key by key). Returns `undefined` for unknown ids. */
|
|
6832
|
-
update(id, patch) {
|
|
6833
|
-
const current = this.styles.get(id);
|
|
6834
|
-
if (!current) return void 0;
|
|
6835
|
-
const next = {
|
|
6836
|
-
...current,
|
|
6837
|
-
...patch,
|
|
6838
|
-
id,
|
|
6839
|
-
paragraph: patch.paragraph ? { ...current.paragraph, ...patch.paragraph } : current.paragraph,
|
|
6840
|
-
character: patch.character ? { ...current.character, ...patch.character } : current.character
|
|
6841
|
-
};
|
|
6842
|
-
return this.upsert(next);
|
|
6843
|
-
}
|
|
6844
|
-
/**
|
|
6845
|
-
* Removes a style and returns it. Built-in styles cannot be removed. Styles
|
|
6846
|
-
* based on it are rebased onto its own base, and `next`/`linked`
|
|
6847
|
-
* references to it are dropped.
|
|
6848
|
-
*/
|
|
6849
|
-
remove(id) {
|
|
6850
|
-
const gone = this.styles.get(id);
|
|
6851
|
-
if (!gone || gone.builtin) return void 0;
|
|
6852
|
-
this.styles.delete(id);
|
|
6853
|
-
this.styles.forEach((style, key) => {
|
|
6854
|
-
let changed = style;
|
|
6855
|
-
if (style.basedOn === id) {
|
|
6856
|
-
changed = { ...changed, basedOn: gone.basedOn && gone.basedOn !== key ? gone.basedOn : null };
|
|
6857
|
-
}
|
|
6858
|
-
if (style.next === id) changed = { ...changed, next: null };
|
|
6859
|
-
if (style.linked === id) changed = { ...changed, linked: null };
|
|
6860
|
-
if (changed !== style) this.styles.set(key, changed);
|
|
6861
|
-
});
|
|
6862
|
-
this.changed();
|
|
6863
|
-
return gone;
|
|
6864
|
-
}
|
|
6865
|
-
/** Replaces the document defaults. */
|
|
6866
|
-
setDefaults(defaults) {
|
|
6867
|
-
this.defaults = clone(defaults);
|
|
6868
|
-
this.changed();
|
|
6869
|
-
}
|
|
6870
|
-
/** An unused id derived from a display name (`My Style` → `MyStyle`, then `MyStyle1`, …). */
|
|
6871
|
-
newId(name) {
|
|
6872
|
-
let base = name.replace(/[^A-Za-z0-9_-]+/g, "").replace(/^[^A-Za-z]+/, "").slice(0, 56);
|
|
6873
|
-
if (!base) base = "Style";
|
|
6874
|
-
if (!this.styles.has(base)) return base;
|
|
6875
|
-
for (let i = 1; i < 1e5; i++) {
|
|
6876
|
-
const id = `${base}${i}`;
|
|
6877
|
-
if (!this.styles.has(id)) return id;
|
|
6878
|
-
}
|
|
6879
|
-
return `${base}${Date.now()}`;
|
|
6880
|
-
}
|
|
6881
|
-
// -- CSS --------------------------------------------------------------------
|
|
6882
|
-
/** CSS declarations (`property: value`) of a resolved paragraph or character style. */
|
|
6883
|
-
cssDeclarations(id) {
|
|
6884
|
-
const style = this.styles.get(id);
|
|
6885
|
-
if (_optionalChain([style, 'optionalAccess', _214 => _214.kind]) === "character") return characterCSS(this.resolveCharacterStyle(id));
|
|
6886
|
-
const resolved = this.resolve(id);
|
|
6887
|
-
return { ...paragraphCSS(resolved.paragraph), ...characterCSS(resolved.character) };
|
|
6888
|
-
}
|
|
6889
|
-
/**
|
|
6890
|
-
* Declarations for previewing a style in a menu or gallery: font family,
|
|
6891
|
-
* weight, style, color, decoration, case and letter spacing (no sizes,
|
|
6892
|
-
* margins or borders).
|
|
6893
|
-
*/
|
|
6894
|
-
previewDeclarations(id) {
|
|
6895
|
-
return Object.fromEntries(
|
|
6896
|
-
Object.entries(this.cssDeclarations(id)).filter(([property]) => PREVIEW_PROPERTIES.has(property))
|
|
6897
|
-
);
|
|
6898
|
-
}
|
|
6899
|
-
/**
|
|
6900
|
-
* A stylesheet for the styles: `[data-style="Id"]` rules for paragraph
|
|
6901
|
-
* styles (plus the plain element of blocks that use their default style,
|
|
6902
|
-
* e.g. `h2:not([data-style])`), `[data-char-style="Id"]` for character
|
|
6903
|
-
* styles and the defaults on the scope element.
|
|
6904
|
-
*/
|
|
6905
|
-
toCSS(options = {}) {
|
|
6906
|
-
const scope = _nullishCoalesce(options.scope, () => ( ".ProseMirror"));
|
|
6907
|
-
const tagFor = _nullishCoalesce(options.tagFor, () => ( defaultTagFor));
|
|
6908
|
-
const rules = [];
|
|
6909
|
-
const rule = (selectors, declarations) => {
|
|
6910
|
-
const body = Object.entries(declarations).map(([property, value]) => `${property}: ${value};`).join(" ");
|
|
6911
|
-
if (body) rules.push(`${selectors.join(", ")} { ${body} }`);
|
|
6912
|
-
};
|
|
6913
|
-
rule([scope], {
|
|
6914
|
-
...paragraphCSS(_nullishCoalesce(this.defaults.paragraph, () => ( {}))),
|
|
6915
|
-
...characterCSS(_nullishCoalesce(this.defaults.character, () => ( {})))
|
|
6916
|
-
});
|
|
6917
|
-
this.list().forEach((style) => {
|
|
6918
|
-
if (style.kind === "character") {
|
|
6919
|
-
rule([`${scope} [data-char-style="${style.id}"]`], this.cssDeclarations(style.id));
|
|
6920
|
-
return;
|
|
6921
|
-
}
|
|
6922
|
-
const selectors = [`${scope} [data-style="${style.id}"]`];
|
|
6923
|
-
const block = this.resolve(style.id).block;
|
|
6924
|
-
if (this.defaultStyleFor(block.type, _nullishCoalesce(block.attrs, () => ( {}))) === style.id) {
|
|
6925
|
-
const tag = tagFor(block);
|
|
6926
|
-
if (tag) selectors.push(`${scope} ${tag}:not([data-style])`);
|
|
6927
|
-
}
|
|
6928
|
-
const resolved = this.resolve(style.id);
|
|
6929
|
-
const own = {
|
|
6930
|
-
...paragraphCSS(withoutDefaults(resolved.paragraph, this.defaults.paragraph)),
|
|
6931
|
-
...characterCSS(withoutDefaults(resolved.character, this.defaults.character))
|
|
6932
|
-
};
|
|
6933
|
-
rule(selectors, own);
|
|
6934
|
-
});
|
|
6935
|
-
return rules.join("\n");
|
|
6936
|
-
}
|
|
6937
|
-
// -- Internals --------------------------------------------------------------
|
|
6938
|
-
put(style) {
|
|
6939
|
-
if (!isValidStyleId(style.id)) throw new Error(`Invalid style id: ${String(style.id)}`);
|
|
6940
|
-
if (style.kind !== "paragraph" && style.kind !== "character") {
|
|
6941
|
-
throw new Error(`Invalid style kind: ${String(style.kind)}`);
|
|
6942
|
-
}
|
|
6943
|
-
const stored = clone({ ...style, name: style.name || style.id });
|
|
6944
|
-
this.styles.set(style.id, stored);
|
|
6945
|
-
return stored;
|
|
6946
|
-
}
|
|
6947
|
-
changed() {
|
|
6948
|
-
this.version++;
|
|
6949
|
-
this.snapshot = null;
|
|
6950
|
-
const snapshot = this.getSnapshot();
|
|
6951
|
-
this.listeners.forEach((listener) => {
|
|
6952
|
-
try {
|
|
6953
|
-
listener(snapshot);
|
|
6954
|
-
} catch (err) {
|
|
6955
|
-
console.error("[StyleRegistry] Error in listener:", err);
|
|
6956
|
-
}
|
|
6957
|
-
});
|
|
6958
|
-
}
|
|
6959
|
-
}, _class5);
|
|
6960
|
-
function withoutDefaults(format, defaults) {
|
|
6961
|
-
if (!defaults) return format;
|
|
6962
|
-
const out = {};
|
|
6963
|
-
Object.entries(format).forEach(([key, value]) => {
|
|
6964
|
-
if (defaults[key] !== value) out[key] = value;
|
|
6965
|
-
});
|
|
6966
|
-
return out;
|
|
6967
|
-
}
|
|
6968
|
-
function defaultTagFor(block) {
|
|
6969
|
-
if (block.type === "paragraph") return "p";
|
|
6970
|
-
if (block.type === "heading") {
|
|
6971
|
-
const level = Number(_optionalChain([block, 'access', _215 => _215.attrs, 'optionalAccess', _216 => _216.level]));
|
|
6972
|
-
return level >= 1 && level <= 6 ? `h${level}` : null;
|
|
6973
|
-
}
|
|
6974
|
-
if (block.type === "codeBlock") return "pre";
|
|
6975
|
-
return null;
|
|
6976
|
-
}
|
|
6977
|
-
function safeCSSValue(value) {
|
|
6978
|
-
if (typeof value !== "string") return void 0;
|
|
6979
|
-
const trimmed = value.trim();
|
|
6980
|
-
if (!trimmed || trimmed.length > 200 || UNSAFE_CSS.test(trimmed)) return void 0;
|
|
6981
|
-
return trimmed;
|
|
6982
|
-
}
|
|
6983
|
-
function paragraphCSS(format) {
|
|
6984
|
-
const out = {};
|
|
6985
|
-
const set = (property, value) => {
|
|
6986
|
-
const safe = safeCSSValue(value);
|
|
6987
|
-
if (safe) out[property] = safe;
|
|
6988
|
-
};
|
|
6989
|
-
set("text-align", format.textAlign);
|
|
6990
|
-
set("line-height", format.lineHeight);
|
|
6991
|
-
set("margin-top", format.spaceBefore);
|
|
6992
|
-
set("margin-bottom", format.spaceAfter);
|
|
6993
|
-
set("margin-left", format.indentLeft);
|
|
6994
|
-
set("margin-right", format.indentRight);
|
|
6995
|
-
set("text-indent", format.indentFirstLine);
|
|
6996
|
-
set("border-left", format.borderLeft);
|
|
6997
|
-
set("padding-left", format.paddingLeft);
|
|
6998
|
-
set("background-color", format.backgroundColor);
|
|
6999
|
-
return out;
|
|
7000
|
-
}
|
|
7001
|
-
function characterCSS(format) {
|
|
7002
|
-
const out = {};
|
|
7003
|
-
const set = (property, value) => {
|
|
7004
|
-
const safe = safeCSSValue(value);
|
|
7005
|
-
if (safe) out[property] = safe;
|
|
7006
|
-
};
|
|
7007
|
-
set("font-family", format.fontFamily);
|
|
7008
|
-
set("font-size", format.fontSize);
|
|
7009
|
-
if (format.bold !== void 0) out["font-weight"] = format.bold ? "700" : "400";
|
|
7010
|
-
if (format.italic !== void 0) out["font-style"] = format.italic ? "italic" : "normal";
|
|
7011
|
-
const lines = [format.underline && "underline", format.strike && "line-through"].filter(Boolean);
|
|
7012
|
-
if (format.underline !== void 0 || format.strike !== void 0) {
|
|
7013
|
-
out["text-decoration-line"] = lines.length ? lines.join(" ") : "none";
|
|
7014
|
-
}
|
|
7015
|
-
set("color", format.color);
|
|
7016
|
-
set("background-color", format.backgroundColor);
|
|
7017
|
-
set("letter-spacing", format.letterSpacing);
|
|
7018
|
-
set("text-transform", format.textTransform);
|
|
7019
|
-
if (format.smallCaps !== void 0) out["font-variant-caps"] = format.smallCaps ? "small-caps" : "normal";
|
|
7020
|
-
return out;
|
|
7021
|
-
}
|
|
7022
|
-
function createStyleRegistry(options = {}) {
|
|
7023
|
-
return new StyleRegistry(options);
|
|
7024
|
-
}
|
|
7025
|
-
|
|
7026
|
-
// src/extensions/paragraph-styles/extension.ts
|
|
7027
6744
|
var STYLE_ID_ATTRIBUTE = "styleId";
|
|
7028
6745
|
var CHARACTER_STYLE_MARK_NAME = "characterStyle";
|
|
7029
6746
|
var paragraphStylesPluginKey = new (0, _state.PluginKey)("paragraphStyles");
|
|
7030
6747
|
function getStyleRegistry(editor) {
|
|
7031
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
6748
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _200 => _200.storage, 'optionalAccess', _201 => _201.paragraphStyles, 'optionalAccess', _202 => _202.registry]), () => ( null));
|
|
7032
6749
|
}
|
|
7033
6750
|
function headingLevels(editor) {
|
|
7034
|
-
const heading = _optionalChain([editor, 'optionalAccess',
|
|
7035
|
-
const levels = _optionalChain([heading, 'optionalAccess',
|
|
6751
|
+
const heading = _optionalChain([editor, 'optionalAccess', _203 => _203.extensionManager, 'optionalAccess', _204 => _204.extensions, 'access', _205 => _205.find, 'call', _206 => _206((e) => e.name === "heading")]);
|
|
6752
|
+
const levels = _optionalChain([heading, 'optionalAccess', _207 => _207.options, 'optionalAccess', _208 => _208.levels]);
|
|
7036
6753
|
return Array.isArray(levels) ? levels : null;
|
|
7037
6754
|
}
|
|
7038
6755
|
function isParagraphStyleAvailable(editor, registry, id) {
|
|
@@ -7042,7 +6759,7 @@ function isParagraphStyleAvailable(editor, registry, id) {
|
|
|
7042
6759
|
if (!editor.schema.nodes[block.type]) return false;
|
|
7043
6760
|
if (block.type === "heading") {
|
|
7044
6761
|
const levels = headingLevels(editor);
|
|
7045
|
-
if (levels && !levels.includes(Number(_optionalChain([block, 'access',
|
|
6762
|
+
if (levels && !levels.includes(Number(_optionalChain([block, 'access', _209 => _209.attrs, 'optionalAccess', _210 => _210.level])))) return false;
|
|
7046
6763
|
}
|
|
7047
6764
|
return true;
|
|
7048
6765
|
}
|
|
@@ -7082,7 +6799,7 @@ function captureSelectionFormat(state) {
|
|
|
7082
6799
|
if (name === "highlight") character.backgroundColor = mark.attrs.color || "#fef08a";
|
|
7083
6800
|
});
|
|
7084
6801
|
const paragraph = {};
|
|
7085
|
-
const align = _optionalChain([state, 'access',
|
|
6802
|
+
const align = _optionalChain([state, 'access', _211 => _211.selection, 'access', _212 => _212.$from, 'access', _213 => _213.parent, 'access', _214 => _214.attrs, 'optionalAccess', _215 => _215.textAlign]);
|
|
7086
6803
|
if (align && align !== "left") paragraph.textAlign = align;
|
|
7087
6804
|
return { paragraph, character };
|
|
7088
6805
|
}
|
|
@@ -7174,7 +6891,7 @@ var CharacterStyle = _core.Mark.create({
|
|
|
7174
6891
|
default: null,
|
|
7175
6892
|
parseHTML: (el) => {
|
|
7176
6893
|
const id = el.getAttribute("data-char-style");
|
|
7177
|
-
return isValidStyleId(id) ? id : null;
|
|
6894
|
+
return _chunk3CC7OPUQcjs.isValidStyleId.call(void 0, id) ? id : null;
|
|
7178
6895
|
},
|
|
7179
6896
|
renderHTML: (attrs) => attrs[STYLE_ID_ATTRIBUTE] ? { "data-char-style": attrs[STYLE_ID_ATTRIBUTE] } : {}
|
|
7180
6897
|
}
|
|
@@ -7200,7 +6917,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
7200
6917
|
};
|
|
7201
6918
|
},
|
|
7202
6919
|
addStorage() {
|
|
7203
|
-
return { registry: _nullishCoalesce(this.options.registry, () => ( createStyleRegistry())) };
|
|
6920
|
+
return { registry: _nullishCoalesce(this.options.registry, () => ( _chunk3CC7OPUQcjs.createStyleRegistry.call(void 0, ))) };
|
|
7204
6921
|
},
|
|
7205
6922
|
addExtensions() {
|
|
7206
6923
|
return [CharacterStyle];
|
|
@@ -7215,11 +6932,11 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
7215
6932
|
keepOnSplit: true,
|
|
7216
6933
|
parseHTML: (el) => {
|
|
7217
6934
|
const id = el.getAttribute("data-style");
|
|
7218
|
-
return isValidStyleId(id) ? id : null;
|
|
6935
|
+
return _chunk3CC7OPUQcjs.isValidStyleId.call(void 0, id) ? id : null;
|
|
7219
6936
|
},
|
|
7220
6937
|
renderHTML: (attrs) => {
|
|
7221
6938
|
const id = attrs[STYLE_ID_ATTRIBUTE];
|
|
7222
|
-
return isValidStyleId(id) ? { "data-style": id, class: `pixerate-style-${id}` } : {};
|
|
6939
|
+
return _chunk3CC7OPUQcjs.isValidStyleId.call(void 0, id) ? { "data-style": id, class: `pixerate-style-${id}` } : {};
|
|
7223
6940
|
}
|
|
7224
6941
|
}
|
|
7225
6942
|
}
|
|
@@ -7246,9 +6963,9 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
7246
6963
|
if (dispatch) setParagraphStyle(tr, state, id, reg);
|
|
7247
6964
|
return true;
|
|
7248
6965
|
},
|
|
7249
|
-
clearParagraphStyle: () => ({ commands }) => commands.setParagraphStyle(NORMAL_STYLE_ID),
|
|
6966
|
+
clearParagraphStyle: () => ({ commands }) => commands.setParagraphStyle(_chunk3CC7OPUQcjs.NORMAL_STYLE_ID),
|
|
7250
6967
|
setCharacterStyle: (id) => ({ commands }) => {
|
|
7251
|
-
if (_optionalChain([registry, 'call',
|
|
6968
|
+
if (_optionalChain([registry, 'call', _216 => _216(), 'access', _217 => _217.get, 'call', _218 => _218(id), 'optionalAccess', _219 => _219.kind]) !== "character") return false;
|
|
7252
6969
|
return commands.setMark(CHARACTER_STYLE_MARK_NAME, { [STYLE_ID_ATTRIBUTE]: id });
|
|
7253
6970
|
},
|
|
7254
6971
|
unsetCharacterStyle: () => ({ commands }) => commands.unsetMark(CHARACTER_STYLE_MARK_NAME),
|
|
@@ -7268,7 +6985,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
7268
6985
|
const trimmed = name.trim();
|
|
7269
6986
|
if (!trimmed) return false;
|
|
7270
6987
|
const id = _nullishCoalesce(options.id, () => ( reg.newId(trimmed)));
|
|
7271
|
-
if (!isValidStyleId(id) || reg.get(id)) return false;
|
|
6988
|
+
if (!_chunk3CC7OPUQcjs.isValidStyleId.call(void 0, id) || reg.get(id)) return false;
|
|
7272
6989
|
const basedOn = options.basedOn === void 0 ? getParagraphStyleAt(state, reg) : options.basedOn;
|
|
7273
6990
|
if (dispatch) {
|
|
7274
6991
|
const captured = captureSelectionFormat(state);
|
|
@@ -7276,7 +6993,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
7276
6993
|
id,
|
|
7277
6994
|
name: trimmed,
|
|
7278
6995
|
kind: "paragraph",
|
|
7279
|
-
basedOn: _nullishCoalesce(basedOn, () => ( NORMAL_STYLE_ID)),
|
|
6996
|
+
basedOn: _nullishCoalesce(basedOn, () => ( _chunk3CC7OPUQcjs.NORMAL_STYLE_ID)),
|
|
7280
6997
|
paragraph: captured.paragraph,
|
|
7281
6998
|
character: captured.character,
|
|
7282
6999
|
priority: 50,
|
|
@@ -7314,7 +7031,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
7314
7031
|
};
|
|
7315
7032
|
},
|
|
7316
7033
|
onDestroy() {
|
|
7317
|
-
_optionalChain([this, 'access',
|
|
7034
|
+
_optionalChain([this, 'access', _220 => _220.storage, 'access', _221 => _221.cleanup, 'optionalCall', _222 => _222()]);
|
|
7318
7035
|
}
|
|
7319
7036
|
});
|
|
7320
7037
|
var EMPTY_STYLES = Object.freeze({
|
|
@@ -7352,8 +7069,8 @@ function createParagraphStylesStore(editor) {
|
|
|
7352
7069
|
}
|
|
7353
7070
|
};
|
|
7354
7071
|
const detach = () => {
|
|
7355
|
-
_optionalChain([editor, 'optionalAccess',
|
|
7356
|
-
_optionalChain([unsubscribeRegistry, 'optionalCall',
|
|
7072
|
+
_optionalChain([editor, 'optionalAccess', _223 => _223.off, 'call', _224 => _224("transaction", update)]);
|
|
7073
|
+
_optionalChain([unsubscribeRegistry, 'optionalCall', _225 => _225()]);
|
|
7357
7074
|
unsubscribeRegistry = null;
|
|
7358
7075
|
};
|
|
7359
7076
|
return {
|
|
@@ -7364,7 +7081,7 @@ function createParagraphStylesStore(editor) {
|
|
|
7364
7081
|
subscribe(listener) {
|
|
7365
7082
|
if (!listeners.size) {
|
|
7366
7083
|
snapshot = compute();
|
|
7367
|
-
_optionalChain([editor, 'optionalAccess',
|
|
7084
|
+
_optionalChain([editor, 'optionalAccess', _226 => _226.on, 'call', _227 => _227("transaction", update)]);
|
|
7368
7085
|
unsubscribeRegistry = registry ? registry.subscribe(update) : null;
|
|
7369
7086
|
}
|
|
7370
7087
|
listeners.add(listener);
|
|
@@ -7381,7 +7098,7 @@ function createParagraphStylesStore(editor) {
|
|
|
7381
7098
|
}
|
|
7382
7099
|
|
|
7383
7100
|
// src/extensions/rich-text-preset.ts
|
|
7384
|
-
var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess',
|
|
7101
|
+
var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _228 => _228[name]]) || _optionalChain([mod, 'optionalAccess', _229 => _229.default, 'optionalAccess', _230 => _230[name]]) || _optionalChain([mod, 'optionalAccess', _231 => _231.default, 'optionalAccess', _232 => _232.default]) || _optionalChain([mod, 'optionalAccess', _233 => _233.default]) || mod;
|
|
7385
7102
|
var StarterKit = resolveExt3(_StarterKit, "StarterKit");
|
|
7386
7103
|
var Color = resolveExt3(_Color, "Color");
|
|
7387
7104
|
var Highlight = resolveExt3(_Highlight, "Highlight");
|
|
@@ -7462,7 +7179,7 @@ function createRichTextPreset(options = {}) {
|
|
|
7462
7179
|
find: /^\s*(\[([ |x])?\])\s$/i,
|
|
7463
7180
|
type: this.type,
|
|
7464
7181
|
getAttributes: (match) => ({
|
|
7465
|
-
checked: _optionalChain([match, 'access',
|
|
7182
|
+
checked: _optionalChain([match, 'access', _234 => _234[2], 'optionalAccess', _235 => _235.toLowerCase, 'call', _236 => _236()]) === "x"
|
|
7466
7183
|
})
|
|
7467
7184
|
})
|
|
7468
7185
|
];
|
|
@@ -7476,6 +7193,9 @@ function createRichTextPreset(options = {}) {
|
|
|
7476
7193
|
placeholder: typeof placeholder === "function" ? placeholder : () => placeholder
|
|
7477
7194
|
})
|
|
7478
7195
|
];
|
|
7196
|
+
if (options.table !== false) {
|
|
7197
|
+
extensions2.push(..._chunkHDYMLS3Xcjs.createTableExtensions.call(void 0, optionObject(options.table)));
|
|
7198
|
+
}
|
|
7479
7199
|
if (characterLimit) {
|
|
7480
7200
|
extensions2.push(
|
|
7481
7201
|
CharacterCount.configure({
|
|
@@ -7536,7 +7256,7 @@ function createRichTextPreset(options = {}) {
|
|
|
7536
7256
|
}
|
|
7537
7257
|
if (options.trackChanges) {
|
|
7538
7258
|
extensions2.push(
|
|
7539
|
-
typeof options.trackChanges === "object" ?
|
|
7259
|
+
typeof options.trackChanges === "object" ? _chunkIFHKKVXHcjs.TrackChanges.configure(options.trackChanges) : _chunkIFHKKVXHcjs.TrackChanges,
|
|
7540
7260
|
DocumentCompare
|
|
7541
7261
|
);
|
|
7542
7262
|
}
|
|
@@ -7630,7 +7350,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
7630
7350
|
const hasMatches = () => {
|
|
7631
7351
|
const ok = usable(editor);
|
|
7632
7352
|
if (ok !== true) return ok;
|
|
7633
|
-
return _optionalChain([state, 'call',
|
|
7353
|
+
return _optionalChain([state, 'call', _237 => _237(), 'optionalAccess', _238 => _238.matches, 'access', _239 => _239.length]) ? true : "No matches.";
|
|
7634
7354
|
};
|
|
7635
7355
|
const apply = (params) => {
|
|
7636
7356
|
const split = splitParams(params);
|
|
@@ -7638,7 +7358,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
7638
7358
|
};
|
|
7639
7359
|
const failIfInvalid = () => {
|
|
7640
7360
|
const s = state();
|
|
7641
|
-
if (_optionalChain([s, 'optionalAccess',
|
|
7361
|
+
if (_optionalChain([s, 'optionalAccess', _240 => _240.error])) throw new Error(s.error.message);
|
|
7642
7362
|
};
|
|
7643
7363
|
return [
|
|
7644
7364
|
{
|
|
@@ -7677,9 +7397,9 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
7677
7397
|
failIfInvalid();
|
|
7678
7398
|
const s = state();
|
|
7679
7399
|
return {
|
|
7680
|
-
count: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
7681
|
-
truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
7682
|
-
matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
7400
|
+
count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _241 => _241.matches, 'access', _242 => _242.length]), () => ( 0)),
|
|
7401
|
+
truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _243 => _243.truncated]), () => ( false)),
|
|
7402
|
+
matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _244 => _244.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
|
|
7683
7403
|
};
|
|
7684
7404
|
}
|
|
7685
7405
|
},
|
|
@@ -7706,11 +7426,11 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
7706
7426
|
description: "Replaces every match (one undo step). Tracked when Track Changes is on.",
|
|
7707
7427
|
params: searchParams(true),
|
|
7708
7428
|
...scope,
|
|
7709
|
-
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess',
|
|
7429
|
+
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _245 => _245.query]) !== void 0 ? usable(editor) : hasMatches(),
|
|
7710
7430
|
run: (_ctx, params) => {
|
|
7711
7431
|
apply(params);
|
|
7712
7432
|
failIfInvalid();
|
|
7713
|
-
const count = _nullishCoalesce(_optionalChain([state, 'call',
|
|
7433
|
+
const count = _nullishCoalesce(_optionalChain([state, 'call', _246 => _246(), 'optionalAccess', _247 => _247.matches, 'access', _248 => _248.length]), () => ( 0));
|
|
7714
7434
|
if (count) editor.commands.replaceAll();
|
|
7715
7435
|
return { replaced: count };
|
|
7716
7436
|
}
|
|
@@ -7722,6 +7442,68 @@ function validateFindPattern(query, options = {}) {
|
|
|
7722
7442
|
return result.ok ? null : result.error;
|
|
7723
7443
|
}
|
|
7724
7444
|
|
|
7445
|
+
// src/extensions/table/commands.ts
|
|
7446
|
+
var PARAMS = {
|
|
7447
|
+
insertTable: {
|
|
7448
|
+
type: "object",
|
|
7449
|
+
properties: {
|
|
7450
|
+
rows: { type: "integer", minimum: 1, maximum: _chunkHDYMLS3Xcjs.MAX_TABLE_ROWS, description: "Rows (default 3)." },
|
|
7451
|
+
cols: { type: "integer", minimum: 1, maximum: _chunkHDYMLS3Xcjs.MAX_TABLE_COLUMNS, description: "Columns (default 3)." },
|
|
7452
|
+
withHeaderRow: { type: "boolean", description: "Make the first row a header row (default true)." }
|
|
7453
|
+
},
|
|
7454
|
+
additionalProperties: false
|
|
7455
|
+
},
|
|
7456
|
+
setCellAlignment: {
|
|
7457
|
+
type: "object",
|
|
7458
|
+
properties: {
|
|
7459
|
+
align: {
|
|
7460
|
+
type: ["string", "null"],
|
|
7461
|
+
enum: ["left", "center", "right", "justify", null],
|
|
7462
|
+
description: "Horizontal alignment; null clears it."
|
|
7463
|
+
}
|
|
7464
|
+
},
|
|
7465
|
+
required: ["align"],
|
|
7466
|
+
additionalProperties: false
|
|
7467
|
+
},
|
|
7468
|
+
setCellBackground: {
|
|
7469
|
+
type: "object",
|
|
7470
|
+
properties: {
|
|
7471
|
+
color: { type: ["string", "null"], description: "CSS color (e.g. #fde68a); null clears it." }
|
|
7472
|
+
},
|
|
7473
|
+
required: ["color"],
|
|
7474
|
+
additionalProperties: false
|
|
7475
|
+
}
|
|
7476
|
+
};
|
|
7477
|
+
function createTableCommands(editor, options = {}) {
|
|
7478
|
+
const prefix = _nullishCoalesce(options.prefix, () => ( "table."));
|
|
7479
|
+
const group = _nullishCoalesce(options.group, () => ( "Table"));
|
|
7480
|
+
const scope = options.scope ? { scope: options.scope } : {};
|
|
7481
|
+
const focus = _nullishCoalesce(options.focus, () => ( true));
|
|
7482
|
+
return _chunkHDYMLS3Xcjs.TABLE_ACTIONS.map(({ action, label, description, keywords }) => {
|
|
7483
|
+
const params = PARAMS[action];
|
|
7484
|
+
return {
|
|
7485
|
+
id: `${prefix}${action}`,
|
|
7486
|
+
label,
|
|
7487
|
+
group,
|
|
7488
|
+
keywords: [...keywords],
|
|
7489
|
+
description,
|
|
7490
|
+
...params ? { params } : {},
|
|
7491
|
+
...scope,
|
|
7492
|
+
enabled: (_ctx, p) => _chunkHDYMLS3Xcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {}))),
|
|
7493
|
+
run: (_ctx, p) => {
|
|
7494
|
+
if (!_chunkHDYMLS3Xcjs.runTableAction.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})), { focus })) {
|
|
7495
|
+
const reason = _chunkHDYMLS3Xcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})));
|
|
7496
|
+
throw new Error(reason === true ? `${label} did not change the document.` : reason);
|
|
7497
|
+
}
|
|
7498
|
+
const state = _chunkHDYMLS3Xcjs.getTableState.call(void 0, editor);
|
|
7499
|
+
return {
|
|
7500
|
+
done: true,
|
|
7501
|
+
table: state.inTable ? { rows: state.rows, columns: state.columns, row: state.row, column: state.column } : null
|
|
7502
|
+
};
|
|
7503
|
+
}
|
|
7504
|
+
};
|
|
7505
|
+
});
|
|
7506
|
+
}
|
|
7725
7507
|
|
|
7726
7508
|
|
|
7727
7509
|
|
|
@@ -7854,15 +7636,5 @@ function validateFindPattern(query, options = {}) {
|
|
|
7854
7636
|
|
|
7855
7637
|
|
|
7856
7638
|
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
exports.GradientText = GradientText; exports.SlashCommands = SlashCommands; exports.TemplateSuggestions = TemplateSuggestions; exports.LoadingNode = LoadingNode; exports.SMILIE_REPLACEMENTS = SMILIE_REPLACEMENTS; exports.smilieAutocorrectRules = smilieAutocorrectRules; exports.SmilieReplacer = SmilieReplacer; exports.findHexColors = findHexColors; exports.ColorHighlighter = ColorHighlighter; exports.FontSize = FontSize; exports.Mention = Mention; exports.getMentionNodes = getMentionNodes; exports.setMentionRoleAt = setMentionRoleAt; exports.createMentionExtension = createMentionExtension; exports.Markdown = Markdown2; exports.imagePastePluginKey = imagePastePluginKey; exports.insertImageNode = insertImageNode; exports.updateImageSrc = updateImageSrc; exports.removeImageNode = removeImageNode; exports.handleImageInsertion = handleImageInsertion; exports.Image = Image2; exports.commentsPluginKey = commentsPluginKey; exports.COMMENT_MARK_NAME = COMMENT_MARK_NAME; exports.findCommentRanges = findCommentRanges; exports.getCommentAnchors = getCommentAnchors; exports.getCommentIdsAt = getCommentIdsAt; exports.getCommentStore = getCommentStore; exports.Comments = Comments; exports.getCommentAuthor = getCommentAuthor; exports.compareInEditor = compareInEditor; exports.applyDocumentComparison = applyDocumentComparison; exports.DocumentCompare = DocumentCompare; exports.ImportError = ImportError; exports.createImportContext = createImportContext; exports.ImportAdapterRegistry = ImportAdapterRegistry; exports.ZipError = ZipError; exports.DEFAULT_ZIP_MAX_ENTRIES = DEFAULT_ZIP_MAX_ENTRIES; exports.DEFAULT_ZIP_MAX_TOTAL_SIZE = DEFAULT_ZIP_MAX_TOTAL_SIZE; exports.zipCrc32 = zipCrc32; exports.isUnsafeZipPath = isUnsafeZipPath; exports.ZipArchive = ZipArchive; exports.readZip = readZip; exports.DOCX_MIME_TYPES = DOCX_MIME_TYPES; exports.DEFAULT_DOCX_MAX_IMAGE_SIZE = DEFAULT_DOCX_MAX_IMAGE_SIZE; exports.docxToDocumentImport = docxToDocumentImport; exports.createDocxImportAdapter = createDocxImportAdapter; exports.docxImportAdapter = docxImportAdapter; exports.markdownImportAdapter = markdownImportAdapter; exports.htmlImportAdapter = htmlImportAdapter; exports.plainTextImportAdapter = plainTextImportAdapter; exports.rtfImportAdapter = rtfImportAdapter; exports.BUILT_IN_IMPORT_ADAPTERS = BUILT_IN_IMPORT_ADAPTERS; exports.createImportAdapterRegistry = createImportAdapterRegistry; exports.defaultImportRegistry = defaultImportRegistry; exports.registerImportAdapter = registerImportAdapter; exports.unregisterImportAdapter = unregisterImportAdapter; exports.findImportAdapter = findImportAdapter; exports.importFile = importFile; exports.getImportAccept = getImportAccept; exports.htmlToSlice = htmlToSlice; exports.insertImportedDocument = insertImportedDocument; exports.importFilesIntoEditor = importFilesIntoEditor; exports.fileImportPluginKey = fileImportPluginKey; exports.FileImport = FileImport; exports.richClipboardPluginKey = richClipboardPluginKey; exports.writeRichClipboard = writeRichClipboard; exports.RichClipboard = RichClipboard; exports.smartQuoteRules = smartQuoteRules; exports.symbolRules = symbolRules; exports.fractionRules = fractionRules; exports.capitalizeSentenceRules = capitalizeSentenceRules; exports.twoInitialCapitalsRules = twoInitialCapitalsRules; exports.defaultAutocorrectRules = defaultAutocorrectRules; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.autocorrectPluginKey = autocorrectPluginKey; exports.findAutocorrection = findAutocorrection; exports.isInsidePromptToken = isInsidePromptToken; exports.Autocorrect = Autocorrect; exports.outlinePluginKey = outlinePluginKey; exports.computeOutline = computeOutline; exports.buildOutlineTree = buildOutlineTree; exports.getOutline = getOutline; exports.getActiveHeading = getActiveHeading; exports.createOutlineStore = createOutlineStore; exports.navigateToHeading = navigateToHeading; exports.Outline = Outline; exports.tableOfContentsMarkdownIt = tableOfContentsMarkdownIt; exports.footnotesMarkdownIt = footnotesMarkdownIt; exports.tableOfContentsPluginKey = tableOfContentsPluginKey; exports.getTableOfContentsEntries = getTableOfContentsEntries; exports.TableOfContents = TableOfContents; exports.footnotesPluginKey = footnotesPluginKey; exports.getFootnotes = getFootnotes; exports.syncFootnotes = syncFootnotes; exports.FootnoteReference = FootnoteReference; exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.getBookmarks = getBookmarks; exports.Bookmark = Bookmark; exports.crossReferencePluginKey = crossReferencePluginKey; exports.getCrossReferenceTargets = getCrossReferenceTargets; exports.CrossReference = CrossReference; exports.documentStructureCommandItems = documentStructureCommandItems; exports.getDocumentStructureCommandItems = getDocumentStructureCommandItems; exports.FIND_PARAGRAPH_MARK = FIND_PARAGRAPH_MARK; exports.MAX_FIND_PATTERN_LENGTH = MAX_FIND_PATTERN_LENGTH; exports.createSearchBudget = createSearchBudget; exports.foldCodePoint = foldCodePoint; exports.compileFindPattern = compileFindPattern; exports.findAllMatches = findAllMatches; exports.parseReplacement = parseReplacement; exports.expandReplacement = expandReplacement; exports.searchDocument = searchDocument; exports.applyReplacements = applyReplacements; exports.EMPTY_FIND_REPLACE_SNAPSHOT = EMPTY_FIND_REPLACE_SNAPSHOT; exports.FindReplaceStore = FindReplaceStore; exports.findReplacePluginKey = findReplacePluginKey; exports.getFindReplaceState = getFindReplaceState; exports.getFindReplaceStore = getFindReplaceStore; exports.FIND_OPTION_TOGGLES = FIND_OPTION_TOGGLES; exports.formatFindStatus = formatFindStatus; exports.FindReplace = FindReplace; exports.NORMAL_STYLE_ID = NORMAL_STYLE_ID; exports.isValidStyleId = isValidStyleId; exports.DEFAULT_STYLES = DEFAULT_STYLES; exports.StyleRegistry = StyleRegistry; exports.safeCSSValue = safeCSSValue; exports.createStyleRegistry = createStyleRegistry; exports.STYLE_ID_ATTRIBUTE = STYLE_ID_ATTRIBUTE; exports.CHARACTER_STYLE_MARK_NAME = CHARACTER_STYLE_MARK_NAME; exports.paragraphStylesPluginKey = paragraphStylesPluginKey; exports.getStyleRegistry = getStyleRegistry; exports.isParagraphStyleAvailable = isParagraphStyleAvailable; exports.getParagraphStyleAt = getParagraphStyleAt; exports.captureSelectionFormat = captureSelectionFormat; exports.CharacterStyle = CharacterStyle; exports.ParagraphStyles = ParagraphStyles; exports.createParagraphStylesStore = createParagraphStylesStore; exports.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern;
|
|
7868
|
-
//# sourceMappingURL=chunk-PO6A6QQH.cjs.map
|
|
7639
|
+
exports.GradientText = GradientText; exports.SlashCommands = SlashCommands; exports.TemplateSuggestions = TemplateSuggestions; exports.LoadingNode = LoadingNode; exports.SMILIE_REPLACEMENTS = SMILIE_REPLACEMENTS; exports.smilieAutocorrectRules = smilieAutocorrectRules; exports.SmilieReplacer = SmilieReplacer; exports.findHexColors = findHexColors; exports.ColorHighlighter = ColorHighlighter; exports.FontSize = FontSize; exports.Mention = Mention; exports.getMentionNodes = getMentionNodes; exports.setMentionRoleAt = setMentionRoleAt; exports.createMentionExtension = createMentionExtension; exports.Markdown = Markdown2; exports.imagePastePluginKey = imagePastePluginKey; exports.insertImageNode = insertImageNode; exports.updateImageSrc = updateImageSrc; exports.removeImageNode = removeImageNode; exports.handleImageInsertion = handleImageInsertion; exports.Image = Image2; exports.commentsPluginKey = commentsPluginKey; exports.COMMENT_MARK_NAME = COMMENT_MARK_NAME; exports.findCommentRanges = findCommentRanges; exports.getCommentAnchors = getCommentAnchors; exports.getCommentIdsAt = getCommentIdsAt; exports.getCommentStore = getCommentStore; exports.Comments = Comments; exports.getCommentAuthor = getCommentAuthor; exports.compareInEditor = compareInEditor; exports.applyDocumentComparison = applyDocumentComparison; exports.DocumentCompare = DocumentCompare; exports.ImportError = ImportError; exports.createImportContext = createImportContext; exports.ImportAdapterRegistry = ImportAdapterRegistry; exports.DOCX_MIME_TYPES = DOCX_MIME_TYPES; exports.DEFAULT_DOCX_MAX_IMAGE_SIZE = DEFAULT_DOCX_MAX_IMAGE_SIZE; exports.docxToDocumentImport = docxToDocumentImport; exports.createDocxImportAdapter = createDocxImportAdapter; exports.docxImportAdapter = docxImportAdapter; exports.markdownImportAdapter = markdownImportAdapter; exports.htmlImportAdapter = htmlImportAdapter; exports.plainTextImportAdapter = plainTextImportAdapter; exports.rtfImportAdapter = rtfImportAdapter; exports.BUILT_IN_IMPORT_ADAPTERS = BUILT_IN_IMPORT_ADAPTERS; exports.createImportAdapterRegistry = createImportAdapterRegistry; exports.defaultImportRegistry = defaultImportRegistry; exports.registerImportAdapter = registerImportAdapter; exports.unregisterImportAdapter = unregisterImportAdapter; exports.findImportAdapter = findImportAdapter; exports.importFile = importFile; exports.getImportAccept = getImportAccept; exports.htmlToSlice = htmlToSlice; exports.insertImportedDocument = insertImportedDocument; exports.applyImportedReviewData = applyImportedReviewData; exports.importFilesIntoEditor = importFilesIntoEditor; exports.fileImportPluginKey = fileImportPluginKey; exports.FileImport = FileImport; exports.richClipboardPluginKey = richClipboardPluginKey; exports.writeRichClipboard = writeRichClipboard; exports.RichClipboard = RichClipboard; exports.smartQuoteRules = smartQuoteRules; exports.symbolRules = symbolRules; exports.fractionRules = fractionRules; exports.capitalizeSentenceRules = capitalizeSentenceRules; exports.twoInitialCapitalsRules = twoInitialCapitalsRules; exports.defaultAutocorrectRules = defaultAutocorrectRules; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.autocorrectPluginKey = autocorrectPluginKey; exports.findAutocorrection = findAutocorrection; exports.isInsidePromptToken = isInsidePromptToken; exports.Autocorrect = Autocorrect; exports.outlinePluginKey = outlinePluginKey; exports.computeOutline = computeOutline; exports.buildOutlineTree = buildOutlineTree; exports.getOutline = getOutline; exports.getActiveHeading = getActiveHeading; exports.createOutlineStore = createOutlineStore; exports.navigateToHeading = navigateToHeading; exports.Outline = Outline; exports.tableOfContentsMarkdownIt = tableOfContentsMarkdownIt; exports.footnotesMarkdownIt = footnotesMarkdownIt; exports.tableOfContentsPluginKey = tableOfContentsPluginKey; exports.getTableOfContentsEntries = getTableOfContentsEntries; exports.TableOfContents = TableOfContents; exports.footnotesPluginKey = footnotesPluginKey; exports.getFootnotes = getFootnotes; exports.syncFootnotes = syncFootnotes; exports.FootnoteReference = FootnoteReference; exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.getBookmarks = getBookmarks; exports.Bookmark = Bookmark; exports.crossReferencePluginKey = crossReferencePluginKey; exports.getCrossReferenceTargets = getCrossReferenceTargets; exports.CrossReference = CrossReference; exports.documentStructureCommandItems = documentStructureCommandItems; exports.getDocumentStructureCommandItems = getDocumentStructureCommandItems; exports.FIND_PARAGRAPH_MARK = FIND_PARAGRAPH_MARK; exports.MAX_FIND_PATTERN_LENGTH = MAX_FIND_PATTERN_LENGTH; exports.createSearchBudget = createSearchBudget; exports.foldCodePoint = foldCodePoint; exports.compileFindPattern = compileFindPattern; exports.findAllMatches = findAllMatches; exports.parseReplacement = parseReplacement; exports.expandReplacement = expandReplacement; exports.searchDocument = searchDocument; exports.applyReplacements = applyReplacements; exports.EMPTY_FIND_REPLACE_SNAPSHOT = EMPTY_FIND_REPLACE_SNAPSHOT; exports.FindReplaceStore = FindReplaceStore; exports.findReplacePluginKey = findReplacePluginKey; exports.getFindReplaceState = getFindReplaceState; exports.getFindReplaceStore = getFindReplaceStore; exports.FIND_OPTION_TOGGLES = FIND_OPTION_TOGGLES; exports.formatFindStatus = formatFindStatus; exports.FindReplace = FindReplace; exports.STYLE_ID_ATTRIBUTE = STYLE_ID_ATTRIBUTE; exports.CHARACTER_STYLE_MARK_NAME = CHARACTER_STYLE_MARK_NAME; exports.paragraphStylesPluginKey = paragraphStylesPluginKey; exports.getStyleRegistry = getStyleRegistry; exports.isParagraphStyleAvailable = isParagraphStyleAvailable; exports.getParagraphStyleAt = getParagraphStyleAt; exports.captureSelectionFormat = captureSelectionFormat; exports.CharacterStyle = CharacterStyle; exports.ParagraphStyles = ParagraphStyles; exports.createParagraphStylesStore = createParagraphStylesStore; exports.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern; exports.createTableCommands = createTableCommands;
|
|
7640
|
+
//# sourceMappingURL=chunk-LN2POBHT.cjs.map
|