@pixerate/editor 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -2
- package/THIRD_PARTY_NOTICES.md +139 -0
- package/dist/agent/index.cjs +87 -111
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +70 -211
- package/dist/agent/index.d.ts +70 -211
- package/dist/agent/index.js +78 -102
- package/dist/agent/index.js.map +1 -1
- package/dist/arrangeShortcuts-B8O3f8-P.d.cts +184 -0
- package/dist/arrangeShortcuts-sLlD2rSX.d.ts +184 -0
- package/dist/canvas/index.cjs +2075 -86
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +608 -186
- package/dist/canvas/index.d.ts +608 -186
- package/dist/canvas/index.js +2060 -71
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-26BVFKHU.cjs +453 -0
- package/dist/chunk-26BVFKHU.cjs.map +1 -0
- package/dist/chunk-2H7ZHPEJ.js +762 -0
- package/dist/chunk-2H7ZHPEJ.js.map +1 -0
- package/dist/{chunk-DENSCKFC.js → chunk-3CN2WD3X.js} +1730 -189
- package/dist/chunk-3CN2WD3X.js.map +1 -0
- package/dist/{chunk-JJDLPEWL.js → chunk-3LV6RRPH.js} +2 -2
- package/dist/{chunk-MJZBNWG7.js → chunk-5S3Z4PPF.js} +78 -557
- package/dist/chunk-5S3Z4PPF.js.map +1 -0
- package/dist/chunk-664LQYFJ.js +115 -0
- package/dist/chunk-664LQYFJ.js.map +1 -0
- package/dist/chunk-7DWMJCAT.js +453 -0
- package/dist/chunk-7DWMJCAT.js.map +1 -0
- package/dist/chunk-ARRTP33I.js +101 -0
- package/dist/chunk-ARRTP33I.js.map +1 -0
- package/dist/chunk-CPOKFNBG.cjs +101 -0
- package/dist/chunk-CPOKFNBG.cjs.map +1 -0
- package/dist/{chunk-AA4ZEVCC.cjs → chunk-D27YFC46.cjs} +101 -580
- package/dist/chunk-D27YFC46.cjs.map +1 -0
- package/dist/chunk-D6FH2YAX.cjs +131 -0
- package/dist/chunk-D6FH2YAX.cjs.map +1 -0
- package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
- package/dist/chunk-FD4LPFAE.cjs.map +1 -0
- package/dist/chunk-FODNLX5N.js +749 -0
- package/dist/chunk-FODNLX5N.js.map +1 -0
- package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
- package/dist/chunk-FPENXAEJ.js.map +1 -0
- package/dist/chunk-G2I4QJOT.cjs +762 -0
- package/dist/chunk-G2I4QJOT.cjs.map +1 -0
- package/dist/chunk-HLIMTC6N.js +1 -0
- package/dist/chunk-HLIMTC6N.js.map +1 -0
- package/dist/{chunk-QGHGJ56O.js → chunk-ITBSKI26.js} +1483 -19
- package/dist/chunk-ITBSKI26.js.map +1 -0
- package/dist/{chunk-6M3BCTBD.cjs → chunk-MA2F5KHF.cjs} +470 -242
- package/dist/chunk-MA2F5KHF.cjs.map +1 -0
- package/dist/{chunk-SAZRENEZ.cjs → chunk-MCSJFWAO.cjs} +1733 -192
- package/dist/chunk-MCSJFWAO.cjs.map +1 -0
- package/dist/chunk-MKA3AHLV.cjs +256 -0
- package/dist/chunk-MKA3AHLV.cjs.map +1 -0
- package/dist/chunk-OLZJXL4R.cjs +749 -0
- package/dist/chunk-OLZJXL4R.cjs.map +1 -0
- package/dist/chunk-OXSV64JX.js +689 -0
- package/dist/chunk-OXSV64JX.js.map +1 -0
- package/dist/chunk-P3RQ5UJE.cjs +689 -0
- package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
- package/dist/chunk-P6ODPZ4W.js +256 -0
- package/dist/chunk-P6ODPZ4W.js.map +1 -0
- package/dist/chunk-PGNZKFQS.js +685 -0
- package/dist/chunk-PGNZKFQS.js.map +1 -0
- package/dist/chunk-PL4JB3BF.cjs +1 -0
- package/dist/chunk-PL4JB3BF.cjs.map +1 -0
- package/dist/{chunk-GVSMRPHB.cjs → chunk-SBCZ6RN5.cjs} +1568 -104
- package/dist/chunk-SBCZ6RN5.cjs.map +1 -0
- package/dist/{chunk-CL37JGFW.cjs → chunk-SML64VJG.cjs} +4 -4
- package/dist/{chunk-CL37JGFW.cjs.map → chunk-SML64VJG.cjs.map} +1 -1
- package/dist/chunk-TNNJXF46.cjs +115 -0
- package/dist/chunk-TNNJXF46.cjs.map +1 -0
- package/dist/chunk-U5HZSFCS.js +131 -0
- package/dist/chunk-U5HZSFCS.js.map +1 -0
- package/dist/{chunk-RU52I7QO.js → chunk-U5KWZU4X.js} +388 -160
- package/dist/chunk-U5KWZU4X.js.map +1 -0
- package/dist/chunk-XNORY7M6.cjs +685 -0
- package/dist/chunk-XNORY7M6.cjs.map +1 -0
- package/dist/commands/index.cjs +860 -0
- package/dist/commands/index.cjs.map +1 -0
- package/dist/commands/index.d.cts +244 -0
- package/dist/commands/index.d.ts +244 -0
- package/dist/commands/index.js +860 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/comment-store-BEMgVlAA.d.cts +135 -0
- package/dist/comment-store-BEMgVlAA.d.ts +135 -0
- package/dist/compare/index.cjs +15 -0
- package/dist/compare/index.cjs.map +1 -0
- package/dist/compare/index.d.cts +58 -0
- package/dist/compare/index.d.ts +58 -0
- package/dist/compare/index.js +15 -0
- package/dist/compare/index.js.map +1 -0
- package/dist/{controller-B7GIybc4.d.cts → controller-BhLLAoi8.d.cts} +119 -5
- package/dist/{controller-B7GIybc4.d.ts → controller-BhLLAoi8.d.ts} +119 -5
- package/dist/documents-BQjzJNe2.d.ts +76 -0
- package/dist/documents-KRTPhvst.d.cts +76 -0
- package/dist/extensions/index.cjs +53 -5
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +7 -3
- package/dist/extensions/index.d.ts +7 -3
- package/dist/extensions/index.js +52 -4
- package/dist/generation/index.cjs +1373 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +554 -0
- package/dist/generation/index.d.ts +554 -0
- package/dist/generation/index.js +1373 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/grammar/index.cjs +48 -3
- package/dist/grammar/index.cjs.map +1 -1
- package/dist/grammar/index.d.cts +322 -100
- package/dist/grammar/index.d.ts +322 -100
- package/dist/grammar/index.js +54 -9
- package/dist/history/index.cjs +12 -2
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +211 -7
- package/dist/history/index.d.ts +211 -7
- package/dist/history/index.js +13 -3
- package/dist/image-editor/index.cjs +2244 -38
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +742 -4
- package/dist/image-editor/index.d.ts +742 -4
- package/dist/image-editor/index.js +2222 -16
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{index-CCr_z9kF.d.cts → index-BhJBSm2d.d.cts} +370 -4
- package/dist/{index-Ck6ajwXh.d.ts → index-fJrlkJCd.d.ts} +370 -4
- package/dist/index.cjs +193 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -48
- package/dist/index.d.ts +17 -48
- package/dist/index.js +198 -103
- package/dist/index.js.map +1 -1
- package/dist/migrate-iTlm3a8h.d.cts +112 -0
- package/dist/migrate-iTlm3a8h.d.ts +112 -0
- package/dist/persistence/index.cjs +676 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +347 -0
- package/dist/persistence/index.d.ts +347 -0
- package/dist/persistence/index.js +676 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/registry-BDe-vlv3.d.ts +171 -0
- package/dist/registry-D32LpIc4.d.cts +354 -0
- package/dist/registry-DnzpgY27.d.cts +171 -0
- package/dist/registry-evKTP4ls.d.ts +354 -0
- package/dist/schema-DYDGdYL9.d.cts +41 -0
- package/dist/schema-DYDGdYL9.d.ts +41 -0
- package/dist/serializers/index.cjs +4 -3
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +2 -1
- package/dist/serializers/index.d.ts +2 -1
- package/dist/serializers/index.js +3 -2
- package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
- package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
- package/dist/spreadsheet/index.cjs +53 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +247 -18
- package/dist/spreadsheet/index.d.ts +247 -18
- package/dist/spreadsheet/index.js +58 -8
- package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
- package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
- package/dist/{track-changes-BSF58RK0.d.cts → track-changes-BK5sVf4_.d.cts} +18 -136
- package/dist/{track-changes-BSF58RK0.d.ts → track-changes-CDjCrwKe.d.ts} +18 -136
- package/dist/{types-CJ4U-HHI.d.ts → types-DX4Mh4SL.d.cts} +1 -1
- package/dist/{types-CJ4U-HHI.d.cts → types-DX4Mh4SL.d.ts} +1 -1
- package/dist/types-GT5a5YAX.d.cts +86 -0
- package/dist/types-GT5a5YAX.d.ts +86 -0
- package/package.json +23 -2
- package/dist/chunk-2TWGLC5K.cjs +0 -262
- package/dist/chunk-2TWGLC5K.cjs.map +0 -1
- package/dist/chunk-4SUNJZWB.cjs.map +0 -1
- package/dist/chunk-6M3BCTBD.cjs.map +0 -1
- package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
- package/dist/chunk-AXV2ZW34.cjs +0 -118
- package/dist/chunk-AXV2ZW34.cjs.map +0 -1
- package/dist/chunk-B2ZRLN4S.js +0 -118
- package/dist/chunk-B2ZRLN4S.js.map +0 -1
- package/dist/chunk-DENSCKFC.js.map +0 -1
- package/dist/chunk-GVSMRPHB.cjs.map +0 -1
- package/dist/chunk-KAADNAPF.js +0 -262
- package/dist/chunk-KAADNAPF.js.map +0 -1
- package/dist/chunk-MJZBNWG7.js.map +0 -1
- package/dist/chunk-OYXSKQFR.js.map +0 -1
- package/dist/chunk-QGHGJ56O.js.map +0 -1
- package/dist/chunk-RU52I7QO.js.map +0 -1
- package/dist/chunk-SAZRENEZ.cjs.map +0 -1
- package/dist/types-BZgcDsC5.d.cts +0 -42
- package/dist/types-BZgcDsC5.d.ts +0 -42
- /package/dist/{chunk-JJDLPEWL.js.map → chunk-3LV6RRPH.js.map} +0 -0
|
@@ -1,28 +1,35 @@
|
|
|
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; var _class4;
|
|
2
2
|
|
|
3
|
+
var _chunkOLZJXL4Rcjs = require('./chunk-OLZJXL4R.cjs');
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
var _chunkAXV2ZW34cjs = require('./chunk-AXV2ZW34.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
var _chunkMKA3AHLVcjs = require('./chunk-MKA3AHLV.cjs');
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
var _chunkCL37JGFWcjs = require('./chunk-CL37JGFW.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
var _chunkSML64VJGcjs = require('./chunk-SML64VJG.cjs');
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
var _chunkXNORY7M6cjs = require('./chunk-XNORY7M6.cjs');
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
var _chunkD27YFC46cjs = require('./chunk-D27YFC46.cjs');
|
|
26
33
|
|
|
27
34
|
// src/extensions/gradient-text.ts
|
|
28
35
|
var _core = require('@tiptap/core');
|
|
@@ -37,7 +44,7 @@ var createGradientDecorations = (doc, options) => {
|
|
|
37
44
|
if (node.isText) {
|
|
38
45
|
const text = node.text || "";
|
|
39
46
|
let match;
|
|
40
|
-
const tmplRegex = new RegExp(
|
|
47
|
+
const tmplRegex = new RegExp(_chunkMKA3AHLVcjs.TEMPLATE_REGEX.source, _chunkMKA3AHLVcjs.TEMPLATE_REGEX.flags);
|
|
41
48
|
while ((match = tmplRegex.exec(text)) !== null) {
|
|
42
49
|
const templateName = match[1].trim();
|
|
43
50
|
const colors = _optionalChain([options, 'access', _2 => _2.templateColorMap, 'optionalAccess', _3 => _3.get, 'call', _4 => _4(templateName)]);
|
|
@@ -56,8 +63,8 @@ var createGradientDecorations = (doc, options) => {
|
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
const instRegex = new RegExp(
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
_chunkMKA3AHLVcjs.INSTRUCTION_REGEX.source,
|
|
67
|
+
_chunkMKA3AHLVcjs.INSTRUCTION_REGEX.flags
|
|
61
68
|
);
|
|
62
69
|
while ((match = instRegex.exec(text)) !== null) {
|
|
63
70
|
const content = match[1].trim();
|
|
@@ -77,11 +84,11 @@ var createGradientDecorations = (doc, options) => {
|
|
|
77
84
|
);
|
|
78
85
|
}
|
|
79
86
|
const varRegex = new RegExp(
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
_chunkMKA3AHLVcjs.VARIABLE_REGEX.source,
|
|
88
|
+
_chunkMKA3AHLVcjs.VARIABLE_REGEX.flags
|
|
82
89
|
);
|
|
83
90
|
while ((match = varRegex.exec(text)) !== null) {
|
|
84
|
-
const parsed =
|
|
91
|
+
const parsed = _chunkMKA3AHLVcjs.parseVariableBody.call(void 0, match[1]);
|
|
85
92
|
const start2 = pos + match.index;
|
|
86
93
|
const end = start2 + match[0].length;
|
|
87
94
|
if (parsed.kind === "conditional") {
|
|
@@ -115,7 +122,7 @@ var createGradientDecorations = (doc, options) => {
|
|
|
115
122
|
}
|
|
116
123
|
}
|
|
117
124
|
});
|
|
118
|
-
|
|
125
|
+
_chunkMKA3AHLVcjs.matchConditionalTags.call(void 0, conditionalTags).forEach((result, i) => {
|
|
119
126
|
const tag = conditionalTags[i];
|
|
120
127
|
decorations.push(
|
|
121
128
|
_view2.Decoration.inline(
|
|
@@ -124,11 +131,12 @@ var createGradientDecorations = (doc, options) => {
|
|
|
124
131
|
result.error ? {
|
|
125
132
|
class: "underline decoration-wavy decoration-red-500 text-red-600 dark:text-red-400",
|
|
126
133
|
"data-conditional-error": result.error,
|
|
127
|
-
title: result.error === "unclosed-section" ? `Section "${tag.name}" is never closed with {/${tag.name}}` : `{/${tag.name}} does not close any open section`
|
|
134
|
+
title: result.error === "invalid-condition" ? `Invalid condition: ${_nullishCoalesce(_optionalChain([result, 'access', _10 => _10.comparison, 'optionalAccess', _11 => _11.error]), () => ( tag.name))}` : result.error === "unclosed-section" ? `Section "${tag.name}" is never closed with {/${tag.name}}` : `{/${tag.name}} does not close any open section`
|
|
128
135
|
} : {
|
|
129
136
|
class: "bg-amber-400/30 text-amber-700 dark:text-amber-300 font-medium px-0.5 rounded-xs",
|
|
130
137
|
"data-conditional": tag.conditional,
|
|
131
|
-
|
|
138
|
+
// A comparison (`{?amount>100}`) names its subject variable.
|
|
139
|
+
"data-variable-condition": _nullishCoalesce(_optionalChain([result, 'access', _12 => _12.comparison, 'optionalAccess', _13 => _13.subject]), () => ( tag.name))
|
|
132
140
|
}
|
|
133
141
|
)
|
|
134
142
|
);
|
|
@@ -203,7 +211,7 @@ var GradientText = _core.Mark.create({
|
|
|
203
211
|
const decorations = decorationSet.find(pos, pos + 1);
|
|
204
212
|
for (const decoration of decorations) {
|
|
205
213
|
const decorationWithAttrs = decoration;
|
|
206
|
-
const templateName = _optionalChain([decorationWithAttrs, 'access',
|
|
214
|
+
const templateName = _optionalChain([decorationWithAttrs, 'access', _14 => _14.type, 'optionalAccess', _15 => _15.attrs, 'optionalAccess', _16 => _16["data-template"]]);
|
|
207
215
|
if (templateName) {
|
|
208
216
|
if (markOptions.onTemplateClick) {
|
|
209
217
|
markOptions.onTemplateClick(templateName, event);
|
|
@@ -253,7 +261,7 @@ var SlashCommands = _core.Extension.create({
|
|
|
253
261
|
const { selection } = state;
|
|
254
262
|
const { $from } = selection;
|
|
255
263
|
if (!$from.parent.isTextblock) {
|
|
256
|
-
_optionalChain([opts, 'access',
|
|
264
|
+
_optionalChain([opts, 'access', _17 => _17.onClear, 'optionalCall', _18 => _18()]);
|
|
257
265
|
return;
|
|
258
266
|
}
|
|
259
267
|
const textBeforeCursor = $from.parent.textBetween(
|
|
@@ -287,7 +295,7 @@ var SlashCommands = _core.Extension.create({
|
|
|
287
295
|
};
|
|
288
296
|
}
|
|
289
297
|
}
|
|
290
|
-
_optionalChain([opts, 'access',
|
|
298
|
+
_optionalChain([opts, 'access', _19 => _19.onMatch, 'optionalCall', _20 => _20({
|
|
291
299
|
match: slashMatch,
|
|
292
300
|
query: slashMatch[1] || "",
|
|
293
301
|
from: matchFrom,
|
|
@@ -295,7 +303,7 @@ var SlashCommands = _core.Extension.create({
|
|
|
295
303
|
coords: relativeCoords
|
|
296
304
|
})]);
|
|
297
305
|
} else {
|
|
298
|
-
_optionalChain([opts, 'access',
|
|
306
|
+
_optionalChain([opts, 'access', _21 => _21.onClear, 'optionalCall', _22 => _22()]);
|
|
299
307
|
}
|
|
300
308
|
}
|
|
301
309
|
};
|
|
@@ -333,13 +341,13 @@ var TemplateSuggestions = _core.Extension.create({
|
|
|
333
341
|
render: () => {
|
|
334
342
|
return {
|
|
335
343
|
onStart: (props) => {
|
|
336
|
-
_optionalChain([opts, 'access',
|
|
344
|
+
_optionalChain([opts, 'access', _23 => _23.onSuggestion, 'optionalCall', _24 => _24(props)]);
|
|
337
345
|
},
|
|
338
346
|
onUpdate: (props) => {
|
|
339
|
-
_optionalChain([opts, 'access',
|
|
347
|
+
_optionalChain([opts, 'access', _25 => _25.onSuggestion, 'optionalCall', _26 => _26(props)]);
|
|
340
348
|
},
|
|
341
349
|
onExit: () => {
|
|
342
|
-
_optionalChain([opts, 'access',
|
|
350
|
+
_optionalChain([opts, 'access', _27 => _27.onSuggestion, 'optionalCall', _28 => _28({
|
|
343
351
|
query: "",
|
|
344
352
|
range: { from: 0, to: 0 },
|
|
345
353
|
items: [],
|
|
@@ -350,7 +358,7 @@ var TemplateSuggestions = _core.Extension.create({
|
|
|
350
358
|
};
|
|
351
359
|
}
|
|
352
360
|
};
|
|
353
|
-
const SuggestionFn = typeof _suggestion2.default === "function" ? _suggestion2.default : _optionalChain([_suggestion2.default, 'optionalAccess',
|
|
361
|
+
const SuggestionFn = typeof _suggestion2.default === "function" ? _suggestion2.default : _optionalChain([_suggestion2.default, 'optionalAccess', _29 => _29.default]) || _optionalChain([_suggestion2.default, 'optionalAccess', _30 => _30.Suggestion]);
|
|
354
362
|
return [
|
|
355
363
|
SuggestionFn({
|
|
356
364
|
editor: this.editor,
|
|
@@ -565,11 +573,11 @@ var _extensioncharactercount = require('@tiptap/extension-character-count'); var
|
|
|
565
573
|
|
|
566
574
|
|
|
567
575
|
var _extensionmention = require('@tiptap/extension-mention');
|
|
568
|
-
var BaseMention = _extensionmention.Mention || _optionalChain([_extensionmention.Mention, 'optionalAccess',
|
|
576
|
+
var BaseMention = _extensionmention.Mention || _optionalChain([_extensionmention.Mention, 'optionalAccess', _31 => _31.default, 'optionalAccess', _32 => _32.default]) || _optionalChain([_extensionmention.Mention, 'optionalAccess', _33 => _33.default]) || _extensionmention.Mention;
|
|
569
577
|
var Mention = BaseMention.extend({
|
|
570
578
|
addAttributes() {
|
|
571
579
|
return {
|
|
572
|
-
..._optionalChain([this, 'access',
|
|
580
|
+
..._optionalChain([this, 'access', _34 => _34.parent, 'optionalCall', _35 => _35()]),
|
|
573
581
|
type: {
|
|
574
582
|
default: null,
|
|
575
583
|
parseHTML: (element) => element.getAttribute("data-type-name") || element.getAttribute("data-entity-type"),
|
|
@@ -1618,13 +1626,13 @@ var Markdown = _core.Extension.create({
|
|
|
1618
1626
|
});
|
|
1619
1627
|
|
|
1620
1628
|
// src/extensions/markdown.ts
|
|
1621
|
-
var resolveExt = (mod, name) => _optionalChain([mod, 'optionalAccess',
|
|
1629
|
+
var resolveExt = (mod, name) => _optionalChain([mod, 'optionalAccess', _36 => _36[name]]) || _optionalChain([mod, 'optionalAccess', _37 => _37.default, 'optionalAccess', _38 => _38[name]]) || _optionalChain([mod, 'optionalAccess', _39 => _39.default, 'optionalAccess', _40 => _40.default]) || _optionalChain([mod, 'optionalAccess', _41 => _41.default]) || mod;
|
|
1622
1630
|
var Markdown2 = resolveExt(Markdown, "Markdown");
|
|
1623
1631
|
|
|
1624
1632
|
// src/extensions/image.ts
|
|
1625
1633
|
var _extensionimage = require('@tiptap/extension-image'); var _Image = _interopRequireWildcard(_extensionimage);
|
|
1626
1634
|
|
|
1627
|
-
var resolveExt2 = (mod, name) => _optionalChain([mod, 'optionalAccess',
|
|
1635
|
+
var resolveExt2 = (mod, name) => _optionalChain([mod, 'optionalAccess', _42 => _42[name]]) || _optionalChain([mod, 'optionalAccess', _43 => _43.default, 'optionalAccess', _44 => _44[name]]) || _optionalChain([mod, 'optionalAccess', _45 => _45.default, 'optionalAccess', _46 => _46.default]) || _optionalChain([mod, 'optionalAccess', _47 => _47.default]) || mod;
|
|
1628
1636
|
var BaseImage = resolveExt2(_Image, "Image");
|
|
1629
1637
|
var imagePastePluginKey = new (0, _state.PluginKey)("imagePasteHandler");
|
|
1630
1638
|
function insertImageNode(view, src, alt) {
|
|
@@ -1731,7 +1739,7 @@ function handleImageInsertion(view, file, options) {
|
|
|
1731
1739
|
var Image2 = BaseImage.extend({
|
|
1732
1740
|
addOptions() {
|
|
1733
1741
|
return {
|
|
1734
|
-
..._optionalChain([this, 'access',
|
|
1742
|
+
..._optionalChain([this, 'access', _48 => _48.parent, 'optionalCall', _49 => _49()]),
|
|
1735
1743
|
allowBase64: true,
|
|
1736
1744
|
maxBase64Size: 65536,
|
|
1737
1745
|
enablePaste: true,
|
|
@@ -1744,7 +1752,7 @@ var Image2 = BaseImage.extend({
|
|
|
1744
1752
|
};
|
|
1745
1753
|
},
|
|
1746
1754
|
addProseMirrorPlugins() {
|
|
1747
|
-
const parentPlugins = _optionalChain([this, 'access',
|
|
1755
|
+
const parentPlugins = _optionalChain([this, 'access', _50 => _50.parent, 'optionalCall', _51 => _51()]) || [];
|
|
1748
1756
|
const options = this.options;
|
|
1749
1757
|
if (!options.enablePaste && !options.enableDrop) {
|
|
1750
1758
|
return parentPlugins;
|
|
@@ -1754,7 +1762,7 @@ var Image2 = BaseImage.extend({
|
|
|
1754
1762
|
props: {
|
|
1755
1763
|
handlePaste(view, event) {
|
|
1756
1764
|
if (!options.enablePaste) return false;
|
|
1757
|
-
const items = Array.from(_optionalChain([event, 'access',
|
|
1765
|
+
const items = Array.from(_optionalChain([event, 'access', _52 => _52.clipboardData, 'optionalAccess', _53 => _53.items]) || []);
|
|
1758
1766
|
const imageItems = items.filter(
|
|
1759
1767
|
(item) => item.kind === "file" && item.type.startsWith("image/")
|
|
1760
1768
|
);
|
|
@@ -1769,7 +1777,7 @@ var Image2 = BaseImage.extend({
|
|
|
1769
1777
|
},
|
|
1770
1778
|
handleDrop(view, event) {
|
|
1771
1779
|
if (!options.enableDrop) return false;
|
|
1772
|
-
const files = Array.from(_optionalChain([event, 'access',
|
|
1780
|
+
const files = Array.from(_optionalChain([event, 'access', _54 => _54.dataTransfer, 'optionalAccess', _55 => _55.files]) || []);
|
|
1773
1781
|
const imageFiles = files.filter((f) => f.type.startsWith("image/"));
|
|
1774
1782
|
if (imageFiles.length === 0) return false;
|
|
1775
1783
|
event.preventDefault();
|
|
@@ -1827,8 +1835,8 @@ function getCommentAnchors(doc) {
|
|
|
1827
1835
|
function getCommentIdsAt(state, pos = state.selection.from) {
|
|
1828
1836
|
const $pos = state.doc.resolve(pos);
|
|
1829
1837
|
const marks = [
|
|
1830
|
-
..._nullishCoalesce(_optionalChain([$pos, 'access',
|
|
1831
|
-
..._nullishCoalesce(_optionalChain([$pos, 'access',
|
|
1838
|
+
..._nullishCoalesce(_optionalChain([$pos, 'access', _56 => _56.nodeAfter, 'optionalAccess', _57 => _57.marks]), () => ( [])),
|
|
1839
|
+
..._nullishCoalesce(_optionalChain([$pos, 'access', _58 => _58.nodeBefore, 'optionalAccess', _59 => _59.marks]), () => ( []))
|
|
1832
1840
|
];
|
|
1833
1841
|
const ids = [];
|
|
1834
1842
|
marks.forEach((m) => {
|
|
@@ -1839,7 +1847,7 @@ function getCommentIdsAt(state, pos = state.selection.from) {
|
|
|
1839
1847
|
return ids;
|
|
1840
1848
|
}
|
|
1841
1849
|
function getCommentStore(editor) {
|
|
1842
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
1850
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _60 => _60.storage, 'optionalAccess', _61 => _61[COMMENT_MARK_NAME], 'optionalAccess', _62 => _62.store]), () => ( null));
|
|
1843
1851
|
}
|
|
1844
1852
|
function resolveAuthor(author) {
|
|
1845
1853
|
return typeof author === "function" ? author() : author;
|
|
@@ -1863,7 +1871,7 @@ var Comments = _core.Mark.create({
|
|
|
1863
1871
|
},
|
|
1864
1872
|
addStorage() {
|
|
1865
1873
|
return {
|
|
1866
|
-
store: _nullishCoalesce(this.options.store, () => ( new (0,
|
|
1874
|
+
store: _nullishCoalesce(this.options.store, () => ( new (0, _chunkD27YFC46cjs.CommentStore)())),
|
|
1867
1875
|
// tiptap-markdown: comments are not part of the exported markdown.
|
|
1868
1876
|
markdown: { serialize: { open: "", close: "" }, parse: {} }
|
|
1869
1877
|
};
|
|
@@ -1890,7 +1898,7 @@ var Comments = _core.Mark.create({
|
|
|
1890
1898
|
const { from, to, empty } = state.selection;
|
|
1891
1899
|
if (empty) return false;
|
|
1892
1900
|
if (dispatch) {
|
|
1893
|
-
const id = _nullishCoalesce(options.id, () => (
|
|
1901
|
+
const id = _nullishCoalesce(options.id, () => ( _chunkD27YFC46cjs.createReviewId.call(void 0, "comment")));
|
|
1894
1902
|
tr.addMark(from, to, this.type.create({ commentId: id }));
|
|
1895
1903
|
tr.setMeta(commentsPluginKey, "refresh");
|
|
1896
1904
|
store().createThread({
|
|
@@ -1962,7 +1970,7 @@ var Comments = _core.Mark.create({
|
|
|
1962
1970
|
const decorations = [];
|
|
1963
1971
|
findCommentRanges(doc).forEach((ranges, id) => {
|
|
1964
1972
|
const thread = store.getThread(id);
|
|
1965
|
-
const resolved = _nullishCoalesce(_optionalChain([thread, 'optionalAccess',
|
|
1973
|
+
const resolved = _nullishCoalesce(_optionalChain([thread, 'optionalAccess', _63 => _63.resolved]), () => ( false));
|
|
1966
1974
|
const active = snapshot.activeThreadId === id;
|
|
1967
1975
|
const cls = [
|
|
1968
1976
|
resolved ? options.resolvedClass : options.commentClass,
|
|
@@ -1995,7 +2003,7 @@ var Comments = _core.Mark.create({
|
|
|
1995
2003
|
scheduled = false;
|
|
1996
2004
|
if (destroyed) return;
|
|
1997
2005
|
sync();
|
|
1998
|
-
if (_optionalChain([cache, 'optionalAccess',
|
|
2006
|
+
if (_optionalChain([cache, 'optionalAccess', _64 => _64.snapshot]) !== store.getSnapshot()) {
|
|
1999
2007
|
view.dispatch(
|
|
2000
2008
|
view.state.tr.setMeta(commentsPluginKey, "refresh").setMeta("addToHistory", false)
|
|
2001
2009
|
);
|
|
@@ -2024,10 +2032,58 @@ var Comments = _core.Mark.create({
|
|
|
2024
2032
|
}
|
|
2025
2033
|
});
|
|
2026
2034
|
function getCommentAuthor(editor) {
|
|
2027
|
-
const ext = _optionalChain([editor, 'optionalAccess',
|
|
2035
|
+
const ext = _optionalChain([editor, 'optionalAccess', _65 => _65.extensionManager, 'optionalAccess', _66 => _66.extensions, 'access', _67 => _67.find, 'call', _68 => _68((e) => e.name === COMMENT_MARK_NAME)]);
|
|
2028
2036
|
return ext ? resolveAuthor(ext.options.author) : null;
|
|
2029
2037
|
}
|
|
2030
2038
|
|
|
2039
|
+
// src/extensions/document-compare.ts
|
|
2040
|
+
|
|
2041
|
+
function trackChangesAuthor(state) {
|
|
2042
|
+
return _optionalChain([_chunkD27YFC46cjs.trackChangesPluginKey, 'access', _69 => _69.getState, 'call', _70 => _70(state), 'optionalAccess', _71 => _71.author]);
|
|
2043
|
+
}
|
|
2044
|
+
function compareInEditor(editor, original, revised, options = {}) {
|
|
2045
|
+
return _chunkOLZJXL4Rcjs.compareDocuments.call(void 0, original, revised, {
|
|
2046
|
+
...options,
|
|
2047
|
+
author: _nullishCoalesce(options.author, () => ( trackChangesAuthor(editor.state))),
|
|
2048
|
+
schema: editor.schema
|
|
2049
|
+
});
|
|
2050
|
+
}
|
|
2051
|
+
function applyDocumentComparison(editor, original, revised, options = {}) {
|
|
2052
|
+
const result = compareInEditor(editor, original, revised, options);
|
|
2053
|
+
const { state } = editor;
|
|
2054
|
+
const tr = state.tr.replaceWith(0, state.doc.content.size, result.doc.content);
|
|
2055
|
+
tr.setMeta(_chunkD27YFC46cjs.TRACK_CHANGES_SKIP_META, true);
|
|
2056
|
+
editor.view.dispatch(tr);
|
|
2057
|
+
return result;
|
|
2058
|
+
}
|
|
2059
|
+
var DocumentCompare = _core.Extension.create({
|
|
2060
|
+
name: "documentCompare",
|
|
2061
|
+
addOptions() {
|
|
2062
|
+
return { compare: {} };
|
|
2063
|
+
},
|
|
2064
|
+
addStorage() {
|
|
2065
|
+
return { lastResult: null };
|
|
2066
|
+
},
|
|
2067
|
+
addCommands() {
|
|
2068
|
+
return {
|
|
2069
|
+
setContentFromComparison: (original, revised, options = {}) => ({ state, tr, dispatch }) => {
|
|
2070
|
+
const merged = { ...this.options.compare, ...options };
|
|
2071
|
+
const result = _chunkOLZJXL4Rcjs.compareDocuments.call(void 0, original, revised, {
|
|
2072
|
+
...merged,
|
|
2073
|
+
author: _nullishCoalesce(merged.author, () => ( trackChangesAuthor(state))),
|
|
2074
|
+
schema: state.schema
|
|
2075
|
+
});
|
|
2076
|
+
if (dispatch) {
|
|
2077
|
+
tr.replaceWith(0, tr.doc.content.size, result.doc.content);
|
|
2078
|
+
tr.setMeta(_chunkD27YFC46cjs.TRACK_CHANGES_SKIP_META, true);
|
|
2079
|
+
this.storage.lastResult = result;
|
|
2080
|
+
}
|
|
2081
|
+
return true;
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
}
|
|
2085
|
+
});
|
|
2086
|
+
|
|
2031
2087
|
// src/extensions/file-import.ts
|
|
2032
2088
|
|
|
2033
2089
|
|
|
@@ -2117,7 +2173,7 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
|
|
|
2117
2173
|
* wildcards, then higher `priority`, then the most recently registered.
|
|
2118
2174
|
*/
|
|
2119
2175
|
find(query) {
|
|
2120
|
-
const fileName = _nullishCoalesce(_optionalChain([query, 'access',
|
|
2176
|
+
const fileName = _nullishCoalesce(_optionalChain([query, 'access', _72 => _72.fileName, 'optionalAccess', _73 => _73.toLowerCase, 'call', _74 => _74()]), () => ( ""));
|
|
2121
2177
|
const mime = normalizeMimeType(query.mimeType);
|
|
2122
2178
|
let best;
|
|
2123
2179
|
let bestScore = 0;
|
|
@@ -2572,7 +2628,7 @@ function descendants(el, localName) {
|
|
|
2572
2628
|
}
|
|
2573
2629
|
function toggle(el) {
|
|
2574
2630
|
if (!el) return void 0;
|
|
2575
|
-
const value = _optionalChain([attr, 'call',
|
|
2631
|
+
const value = _optionalChain([attr, 'call', _75 => _75(el, "val"), 'optionalAccess', _76 => _76.toLowerCase, 'call', _77 => _77()]);
|
|
2576
2632
|
return value === void 0 || !["0", "false", "off", "none"].includes(value);
|
|
2577
2633
|
}
|
|
2578
2634
|
function parseXml(Parser, xml, partName) {
|
|
@@ -2613,7 +2669,7 @@ async function readRelationships(zip, Parser, partPath) {
|
|
|
2613
2669
|
const id = attr(rel, "Id");
|
|
2614
2670
|
const target = _nullishCoalesce(attr(rel, "Target"), () => ( ""));
|
|
2615
2671
|
if (!id) return;
|
|
2616
|
-
const external = _optionalChain([attr, 'call',
|
|
2672
|
+
const external = _optionalChain([attr, 'call', _78 => _78(rel, "TargetMode"), 'optionalAccess', _79 => _79.toLowerCase, 'call', _80 => _80()]) === "external";
|
|
2617
2673
|
rels.set(id, {
|
|
2618
2674
|
type: _nullishCoalesce(attr(rel, "Type"), () => ( "")),
|
|
2619
2675
|
target: external ? target : resolvePartPath(baseDir, target),
|
|
@@ -2646,7 +2702,7 @@ async function loadImages(zip, root, rels, options) {
|
|
|
2646
2702
|
for (const id of ids) {
|
|
2647
2703
|
const rel = rels.get(id);
|
|
2648
2704
|
if (!rel || rel.external) continue;
|
|
2649
|
-
const mime = IMAGE_MIME_TYPES[_nullishCoalesce(_optionalChain([rel, 'access',
|
|
2705
|
+
const mime = IMAGE_MIME_TYPES[_nullishCoalesce(_optionalChain([rel, 'access', _81 => _81.target, 'access', _82 => _82.split, 'call', _83 => _83("."), 'access', _84 => _84.pop, 'call', _85 => _85(), 'optionalAccess', _86 => _86.toLowerCase, 'call', _87 => _87()]), () => ( ""))];
|
|
2650
2706
|
const entry = zip.get(rel.target);
|
|
2651
2707
|
if (!mime || !entry || entry.size > maxSize) continue;
|
|
2652
2708
|
images.set(id, `data:${mime};base64,${toBase64(await zip.read(entry))}`);
|
|
@@ -2760,7 +2816,7 @@ function wrapFormat(inner, f) {
|
|
|
2760
2816
|
if (f.u) html = `<u>${html}</u>`;
|
|
2761
2817
|
if (f.i) html = `<em>${html}</em>`;
|
|
2762
2818
|
if (f.b) html = `<strong>${html}</strong>`;
|
|
2763
|
-
if (f.href) html = `<a href="${
|
|
2819
|
+
if (f.href) html = `<a href="${_chunkXNORY7M6cjs.escapeHtml.call(void 0, f.href)}">${html}</a>`;
|
|
2764
2820
|
return html;
|
|
2765
2821
|
}
|
|
2766
2822
|
function renderSegments(segments) {
|
|
@@ -2772,9 +2828,9 @@ function renderSegments(segments) {
|
|
|
2772
2828
|
let j = i;
|
|
2773
2829
|
for (; j < segments.length && formatKey(segments[j].format) === key; j++) {
|
|
2774
2830
|
const seg = segments[j];
|
|
2775
|
-
if (seg.kind === "text") inner +=
|
|
2831
|
+
if (seg.kind === "text") inner += _chunkXNORY7M6cjs.escapeHtml.call(void 0, seg.text);
|
|
2776
2832
|
else if (seg.kind === "br") inner += "<br>";
|
|
2777
|
-
else if (seg.kind === "img") inner += `<img src="${
|
|
2833
|
+
else if (seg.kind === "img") inner += `<img src="${_chunkXNORY7M6cjs.escapeHtml.call(void 0, seg.src)}" alt="${_chunkXNORY7M6cjs.escapeHtml.call(void 0, seg.alt)}">`;
|
|
2778
2834
|
else inner += `<sup>${seg.n}</sup>`;
|
|
2779
2835
|
}
|
|
2780
2836
|
html += wrapFormat(inner, segments[i].format);
|
|
@@ -2786,9 +2842,9 @@ function parseHyperlinkInstruction(instr) {
|
|
|
2786
2842
|
const match = /^\s*HYPERLINK\b(.*)$/i.exec(instr);
|
|
2787
2843
|
if (!match) return void 0;
|
|
2788
2844
|
const rest = match[1];
|
|
2789
|
-
const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access',
|
|
2845
|
+
const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _88 => _88.exec, 'call', _89 => _89(rest), 'optionalAccess', _90 => _90[1]]);
|
|
2790
2846
|
const target = /^\s*(?:"([^"]*)"|([^\s\\]+))/.exec(rest);
|
|
2791
|
-
const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
2847
|
+
const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _91 => _91[1]]), () => ( _optionalChain([target, 'optionalAccess', _92 => _92[2]])));
|
|
2792
2848
|
if (url) return anchor ? `${url}#${anchor}` : url;
|
|
2793
2849
|
return anchor ? `#${anchor}` : void 0;
|
|
2794
2850
|
}
|
|
@@ -2863,7 +2919,7 @@ var ParagraphRenderer = (_class3 = class {
|
|
|
2863
2919
|
}
|
|
2864
2920
|
run(r, base) {
|
|
2865
2921
|
const rPr = wChild(r, "rPr");
|
|
2866
|
-
const styleFormat = _nullishCoalesce(_optionalChain([this, 'access',
|
|
2922
|
+
const styleFormat = _nullishCoalesce(_optionalChain([this, 'access', _93 => _93.ctx, 'access', _94 => _94.styles, 'access', _95 => _95.get, 'call', _96 => _96(_nullishCoalesce(attr(wChild(rPr, "rStyle"), "val"), () => ( ""))), 'optionalAccess', _97 => _97.format]), () => ( {}));
|
|
2867
2923
|
const own = readFormat(rPr);
|
|
2868
2924
|
const format = { ...base, ...styleFormat, ...own };
|
|
2869
2925
|
for (const child of childElements(r)) {
|
|
@@ -2995,15 +3051,15 @@ function paragraphInfo(p, ctx) {
|
|
|
2995
3051
|
heading = styleHeadingLevel(ctx.styles, styleId);
|
|
2996
3052
|
}
|
|
2997
3053
|
let numPr = readNumPr(pPr);
|
|
2998
|
-
if (!numPr) numPr = _optionalChain([styleChain, 'call',
|
|
3054
|
+
if (!numPr) numPr = _optionalChain([styleChain, 'call', _98 => _98(ctx.styles, styleId), 'access', _99 => _99.find, 'call', _100 => _100((style) => style.numPr), 'optionalAccess', _101 => _101.numPr]);
|
|
2999
3055
|
let list;
|
|
3000
3056
|
if (numPr && numPr.numId !== "0" && heading === void 0) {
|
|
3001
3057
|
const num = ctx.numbering.nums.get(numPr.numId);
|
|
3002
|
-
const def = num ? _optionalChain([ctx, 'access',
|
|
3058
|
+
const def = num ? _optionalChain([ctx, 'access', _102 => _102.numbering, 'access', _103 => _103.abstracts, 'access', _104 => _104.get, 'call', _105 => _105(num.abstractId), 'optionalAccess', _106 => _106.get, 'call', _107 => _107(numPr.ilvl)]) : void 0;
|
|
3003
3059
|
list = {
|
|
3004
3060
|
level: Math.max(0, Math.min(numPr.ilvl, 8)),
|
|
3005
|
-
ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess',
|
|
3006
|
-
start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess',
|
|
3061
|
+
ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _108 => _108.ordered]), () => ( false)),
|
|
3062
|
+
start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess', _109 => _109.starts, 'access', _110 => _110.get, 'call', _111 => _111(numPr.ilvl)]), () => ( _optionalChain([def, 'optionalAccess', _112 => _112.start]))), () => ( 1))
|
|
3007
3063
|
};
|
|
3008
3064
|
}
|
|
3009
3065
|
return { heading, list };
|
|
@@ -3087,7 +3143,7 @@ function renderTable(tbl, ctx, part) {
|
|
|
3087
3143
|
if (cell.merge === "restart") {
|
|
3088
3144
|
for (let r = rowIndex + 1; r < rows.length; r++) {
|
|
3089
3145
|
const below = rows[r].find((c) => c.col === cell.col);
|
|
3090
|
-
if (_optionalChain([below, 'optionalAccess',
|
|
3146
|
+
if (_optionalChain([below, 'optionalAccess', _113 => _113.merge]) !== "continue") break;
|
|
3091
3147
|
rowspan++;
|
|
3092
3148
|
}
|
|
3093
3149
|
}
|
|
@@ -3100,7 +3156,7 @@ function renderTable(tbl, ctx, part) {
|
|
|
3100
3156
|
return `${html}</tbody></table>`;
|
|
3101
3157
|
}
|
|
3102
3158
|
function getDomParser(options) {
|
|
3103
|
-
const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access',
|
|
3159
|
+
const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access', _114 => _114.window, 'optionalAccess', _115 => _115.DOMParser])));
|
|
3104
3160
|
if (typeof Parser !== "function") {
|
|
3105
3161
|
throw new ImportError(
|
|
3106
3162
|
"unsupported_environment",
|
|
@@ -3115,7 +3171,7 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3115
3171
|
try {
|
|
3116
3172
|
zip = await readZip(data, { maxTotalSize: 100 * 1024 * 1024, maxEntries: 5e3, ...options.zip });
|
|
3117
3173
|
} catch (error) {
|
|
3118
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
3174
|
+
if (_optionalChain([error, 'optionalAccess', _116 => _116.code]) === "invalid_archive") {
|
|
3119
3175
|
throw new ImportError("invalid_file", "Not a DOCX file (the file is not a ZIP package).", { cause: error });
|
|
3120
3176
|
}
|
|
3121
3177
|
throw error;
|
|
@@ -3135,7 +3191,7 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3135
3191
|
throw new ImportError("invalid_file", "Not a Word document (no main document part with a body).");
|
|
3136
3192
|
}
|
|
3137
3193
|
const rels = await readRelationships(zip, Parser, mainPath);
|
|
3138
|
-
const partByType = (suffix) => _optionalChain([Array, 'access',
|
|
3194
|
+
const partByType = (suffix) => _optionalChain([Array, 'access', _117 => _117.from, 'call', _118 => _118(rels.values()), 'access', _119 => _119.find, 'call', _120 => _120((rel) => !rel.external && rel.type.endsWith(`/${suffix}`)), 'optionalAccess', _121 => _121.target]);
|
|
3139
3195
|
const baseDir = dirname(mainPath);
|
|
3140
3196
|
const stylesPath = _nullishCoalesce(partByType("styles"), () => ( `${baseDir}styles.xml`));
|
|
3141
3197
|
const numberingPath = _nullishCoalesce(partByType("numbering"), () => ( `${baseDir}numbering.xml`));
|
|
@@ -3168,8 +3224,8 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3168
3224
|
}
|
|
3169
3225
|
html += `<hr><ol>${notesHtml}</ol>`;
|
|
3170
3226
|
}
|
|
3171
|
-
const sanitized =
|
|
3172
|
-
return { html: sanitized, text:
|
|
3227
|
+
const sanitized = _chunkSML64VJGcjs.sanitizeImportedHtml.call(void 0, html);
|
|
3228
|
+
return { html: sanitized, text: _chunkXNORY7M6cjs.htmlToPlainText.call(void 0, sanitized) };
|
|
3173
3229
|
}
|
|
3174
3230
|
function createDocxImportAdapter(options = {}) {
|
|
3175
3231
|
return {
|
|
@@ -3194,7 +3250,7 @@ var markdownImportAdapter = {
|
|
|
3194
3250
|
target: "document",
|
|
3195
3251
|
async import(_input, context) {
|
|
3196
3252
|
const text = await context.readText();
|
|
3197
|
-
return { html:
|
|
3253
|
+
return { html: _chunkXNORY7M6cjs.markdownToTipTapHtml.call(void 0, text), text };
|
|
3198
3254
|
}
|
|
3199
3255
|
};
|
|
3200
3256
|
var htmlImportAdapter = {
|
|
@@ -3204,8 +3260,8 @@ var htmlImportAdapter = {
|
|
|
3204
3260
|
extensions: [".html", ".htm", ".xhtml"],
|
|
3205
3261
|
target: "document",
|
|
3206
3262
|
async import(_input, context) {
|
|
3207
|
-
const html =
|
|
3208
|
-
return { html, text:
|
|
3263
|
+
const html = _chunkSML64VJGcjs.sanitizeImportedHtml.call(void 0, await context.readText());
|
|
3264
|
+
return { html, text: _chunkXNORY7M6cjs.htmlToPlainText.call(void 0, html) };
|
|
3209
3265
|
}
|
|
3210
3266
|
};
|
|
3211
3267
|
var plainTextImportAdapter = {
|
|
@@ -3216,7 +3272,7 @@ var plainTextImportAdapter = {
|
|
|
3216
3272
|
target: "document",
|
|
3217
3273
|
async import(_input, context) {
|
|
3218
3274
|
const text = (await context.readText()).replace(/\r\n?/g, "\n");
|
|
3219
|
-
return { html:
|
|
3275
|
+
return { html: _chunkSML64VJGcjs.plainTextToParagraphHtml.call(void 0, text), text };
|
|
3220
3276
|
}
|
|
3221
3277
|
};
|
|
3222
3278
|
var rtfImportAdapter = {
|
|
@@ -3226,8 +3282,8 @@ var rtfImportAdapter = {
|
|
|
3226
3282
|
extensions: [".rtf"],
|
|
3227
3283
|
target: "document",
|
|
3228
3284
|
async import(_input, context) {
|
|
3229
|
-
const text =
|
|
3230
|
-
return { html:
|
|
3285
|
+
const text = _chunkSML64VJGcjs.rtfToPlainText.call(void 0, await context.readText());
|
|
3286
|
+
return { html: _chunkSML64VJGcjs.plainTextToParagraphHtml.call(void 0, text), text };
|
|
3231
3287
|
}
|
|
3232
3288
|
};
|
|
3233
3289
|
var BUILT_IN_IMPORT_ADAPTERS = [
|
|
@@ -3266,7 +3322,7 @@ function getImportAccept(target) {
|
|
|
3266
3322
|
|
|
3267
3323
|
var toView = (target) => "state" in target && "dispatch" in target ? target : target.view;
|
|
3268
3324
|
function htmlToSlice(html, schema) {
|
|
3269
|
-
const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access',
|
|
3325
|
+
const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _122 => _122.window, 'optionalAccess', _123 => _123.DOMParser])));
|
|
3270
3326
|
if (!Parser) return null;
|
|
3271
3327
|
const body = new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
|
|
3272
3328
|
return new (0, _model.Slice)(_model.DOMParser.fromSchema(schema).parse(body).content, 0, 0);
|
|
@@ -3281,7 +3337,7 @@ function insertImportedDocument(target, content, options = {}) {
|
|
|
3281
3337
|
if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
|
|
3282
3338
|
from = to = _state.Selection.near(state.doc.resolve(from)).from;
|
|
3283
3339
|
}
|
|
3284
|
-
const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to,
|
|
3340
|
+
const tr = htmlSlice ? state.tr.replaceRange(from, to, htmlSlice) : state.tr.replace(from, to, _chunkXNORY7M6cjs.plainTextToSlice.call(void 0, content.text, state.schema));
|
|
3285
3341
|
const end = tr.mapping.map(to, 1);
|
|
3286
3342
|
view.dispatch(tr.scrollIntoView().setMeta("uiEvent", "drop"));
|
|
3287
3343
|
return end;
|
|
@@ -3297,7 +3353,7 @@ async function importFilesIntoEditor(target, files, options = {}) {
|
|
|
3297
3353
|
if (view.isDestroyed) break;
|
|
3298
3354
|
at = insertImportedDocument(view, outcome.result, { at, asPlainText: options.asPlainText });
|
|
3299
3355
|
outcomes.push(outcome);
|
|
3300
|
-
_optionalChain([options, 'access',
|
|
3356
|
+
_optionalChain([options, 'access', _124 => _124.onImport, 'optionalCall', _125 => _125(outcome, file)]);
|
|
3301
3357
|
} catch (error) {
|
|
3302
3358
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3303
3359
|
if (options.onError) options.onError(err, file);
|
|
@@ -3316,7 +3372,7 @@ function getImportableFiles(files, registry) {
|
|
|
3316
3372
|
}
|
|
3317
3373
|
function dropPosition(view, event) {
|
|
3318
3374
|
try {
|
|
3319
|
-
return _optionalChain([view, 'access',
|
|
3375
|
+
return _optionalChain([view, 'access', _126 => _126.posAtCoords, 'call', _127 => _127({ left: event.clientX, top: event.clientY }), 'optionalAccess', _128 => _128.pos]);
|
|
3320
3376
|
} catch (e2) {
|
|
3321
3377
|
return void 0;
|
|
3322
3378
|
}
|
|
@@ -3351,7 +3407,7 @@ var FileImport = _core.Extension.create({
|
|
|
3351
3407
|
props: {
|
|
3352
3408
|
handleDrop(view, event, _slice, moved) {
|
|
3353
3409
|
if (!options.enableDrop || moved) return false;
|
|
3354
|
-
const files = getImportableFiles(_optionalChain([event, 'access',
|
|
3410
|
+
const files = getImportableFiles(_optionalChain([event, 'access', _129 => _129.dataTransfer, 'optionalAccess', _130 => _130.files]), registry());
|
|
3355
3411
|
if (!files) return false;
|
|
3356
3412
|
event.preventDefault();
|
|
3357
3413
|
run(view, files, dropPosition(view, event));
|
|
@@ -3359,7 +3415,7 @@ var FileImport = _core.Extension.create({
|
|
|
3359
3415
|
},
|
|
3360
3416
|
handlePaste(view, event) {
|
|
3361
3417
|
if (!options.enablePaste) return false;
|
|
3362
|
-
const files = getImportableFiles(_optionalChain([event, 'access',
|
|
3418
|
+
const files = getImportableFiles(_optionalChain([event, 'access', _131 => _131.clipboardData, 'optionalAccess', _132 => _132.files]), registry());
|
|
3363
3419
|
if (!files) return false;
|
|
3364
3420
|
event.preventDefault();
|
|
3365
3421
|
run(view, files);
|
|
@@ -3378,15 +3434,15 @@ var richClipboardPluginKey = new (0, _state.PluginKey)("richClipboard");
|
|
|
3378
3434
|
function writeRichClipboard(view, event, options = {}) {
|
|
3379
3435
|
const { state } = view;
|
|
3380
3436
|
if (state.selection.empty) return false;
|
|
3381
|
-
const data =
|
|
3437
|
+
const data = _chunkSML64VJGcjs.getClipboardData.call(void 0, event);
|
|
3382
3438
|
if (!data || typeof data.setData !== "function") return false;
|
|
3383
3439
|
const slice = state.selection.content();
|
|
3384
3440
|
const { dom, text } = view.serializeForClipboard(slice);
|
|
3385
3441
|
event.preventDefault();
|
|
3386
|
-
_optionalChain([data, 'access',
|
|
3442
|
+
_optionalChain([data, 'access', _133 => _133.clearData, 'optionalCall', _134 => _134()]);
|
|
3387
3443
|
data.setData("text/html", dom.innerHTML);
|
|
3388
3444
|
data.setData("text/plain", text);
|
|
3389
|
-
data.setData(_nullishCoalesce(options.mimeType, () => (
|
|
3445
|
+
data.setData(_nullishCoalesce(options.mimeType, () => ( _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME)), _chunkSML64VJGcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
|
|
3390
3446
|
if (options.cut && view.editable) {
|
|
3391
3447
|
view.dispatch(state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
|
|
3392
3448
|
}
|
|
@@ -3396,7 +3452,7 @@ var RichClipboard = _core.Extension.create({
|
|
|
3396
3452
|
name: "richClipboard",
|
|
3397
3453
|
addOptions() {
|
|
3398
3454
|
return {
|
|
3399
|
-
mimeType:
|
|
3455
|
+
mimeType: _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME,
|
|
3400
3456
|
plainTextMode: false
|
|
3401
3457
|
};
|
|
3402
3458
|
},
|
|
@@ -3404,7 +3460,7 @@ var RichClipboard = _core.Extension.create({
|
|
|
3404
3460
|
return { plainTextMode: !!this.options.plainTextMode };
|
|
3405
3461
|
},
|
|
3406
3462
|
addProseMirrorPlugins() {
|
|
3407
|
-
const mimeType = _nullishCoalesce(this.options.mimeType, () => (
|
|
3463
|
+
const mimeType = _nullishCoalesce(this.options.mimeType, () => ( _chunkSML64VJGcjs.PIXERATE_DOCUMENT_MIME));
|
|
3408
3464
|
const storage = this.storage;
|
|
3409
3465
|
return [
|
|
3410
3466
|
new (0, _state.Plugin)({
|
|
@@ -3416,7 +3472,7 @@ var RichClipboard = _core.Extension.create({
|
|
|
3416
3472
|
},
|
|
3417
3473
|
handlePaste(view, event) {
|
|
3418
3474
|
if (storage.plainTextMode) return false;
|
|
3419
|
-
const slice =
|
|
3475
|
+
const slice = _chunkSML64VJGcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
|
|
3420
3476
|
if (!slice) return false;
|
|
3421
3477
|
event.preventDefault();
|
|
3422
3478
|
view.dispatch(
|
|
@@ -3611,7 +3667,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3611
3667
|
addCommands() {
|
|
3612
3668
|
return {
|
|
3613
3669
|
undoAutocorrect: () => ({ state, tr, dispatch }) => {
|
|
3614
|
-
const last = _optionalChain([autocorrectPluginKey, 'access',
|
|
3670
|
+
const last = _optionalChain([autocorrectPluginKey, 'access', _135 => _135.getState, 'call', _136 => _136(state), 'optionalAccess', _137 => _137.last]);
|
|
3615
3671
|
if (!last) return false;
|
|
3616
3672
|
if (state.doc.textBetween(last.from, last.to) !== last.replacement) return false;
|
|
3617
3673
|
if (dispatch) {
|
|
@@ -3661,7 +3717,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3661
3717
|
}
|
|
3662
3718
|
const insertTyped = () => {
|
|
3663
3719
|
const tr2 = state.tr.insertText(text, from, to);
|
|
3664
|
-
if (_optionalChain([pluginState, 'optionalAccess',
|
|
3720
|
+
if (_optionalChain([pluginState, 'optionalAccess', _138 => _138.closePending])) _history.closeHistory.call(void 0, tr2);
|
|
3665
3721
|
view.dispatch(tr2);
|
|
3666
3722
|
};
|
|
3667
3723
|
if (isIgnored(state, from, to)) return false;
|
|
@@ -3669,7 +3725,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3669
3725
|
if (extension.options.ignorePromptTokens && isInsidePromptToken(textBefore)) {
|
|
3670
3726
|
return false;
|
|
3671
3727
|
}
|
|
3672
|
-
const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access',
|
|
3728
|
+
const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _139 => _139.exec, 'call', _140 => _140(textBefore), 'optionalAccess', _141 => _141[0]]), () => ( ""));
|
|
3673
3729
|
if (/:\/\/|^www\./i.test(currentWord)) return false;
|
|
3674
3730
|
const exceptions = extension.storage.exceptions;
|
|
3675
3731
|
const found = findAutocorrection(textBefore, extension.options.rules, {
|
|
@@ -3677,7 +3733,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3677
3733
|
isException: (value) => exceptions.has(value.toLowerCase())
|
|
3678
3734
|
});
|
|
3679
3735
|
if (!found) {
|
|
3680
|
-
if (!_optionalChain([pluginState, 'optionalAccess',
|
|
3736
|
+
if (!_optionalChain([pluginState, 'optionalAccess', _142 => _142.closePending])) return false;
|
|
3681
3737
|
insertTyped();
|
|
3682
3738
|
return true;
|
|
3683
3739
|
}
|
|
@@ -3714,7 +3770,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3714
3770
|
_history.closeHistory.call(void 0, tr);
|
|
3715
3771
|
tr.setMeta(autocorrectPluginKey, { correction });
|
|
3716
3772
|
view.dispatch(tr);
|
|
3717
|
-
_optionalChain([extension, 'access',
|
|
3773
|
+
_optionalChain([extension, 'access', _143 => _143.options, 'access', _144 => _144.onCorrection, 'optionalCall', _145 => _145(correction)]);
|
|
3718
3774
|
return true;
|
|
3719
3775
|
};
|
|
3720
3776
|
return [
|
|
@@ -3724,8 +3780,8 @@ var Autocorrect = _core.Extension.create({
|
|
|
3724
3780
|
init: () => ({ last: null, closePending: false }),
|
|
3725
3781
|
apply: (tr, prev) => {
|
|
3726
3782
|
const meta = tr.getMeta(autocorrectPluginKey);
|
|
3727
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
3728
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
3783
|
+
if (_optionalChain([meta, 'optionalAccess', _146 => _146.correction])) return { last: meta.correction, closePending: true };
|
|
3784
|
+
if (_optionalChain([meta, 'optionalAccess', _147 => _147.undo])) return { last: null, closePending: true };
|
|
3729
3785
|
if (!tr.docChanged) return prev;
|
|
3730
3786
|
if (!prev.last && !prev.closePending) return prev;
|
|
3731
3787
|
return { last: null, closePending: false };
|
|
@@ -3806,7 +3862,7 @@ function arraysEqual(a, b, eq) {
|
|
|
3806
3862
|
}
|
|
3807
3863
|
function scrollDomAtPos(view, pos, behavior = "smooth") {
|
|
3808
3864
|
try {
|
|
3809
|
-
const dom = _optionalChain([view, 'optionalAccess',
|
|
3865
|
+
const dom = _optionalChain([view, 'optionalAccess', _148 => _148.nodeDOM, 'optionalCall', _149 => _149(pos)]);
|
|
3810
3866
|
if (dom && typeof dom.scrollIntoView === "function") {
|
|
3811
3867
|
dom.scrollIntoView({ block: "start", behavior });
|
|
3812
3868
|
}
|
|
@@ -3821,7 +3877,7 @@ function syncInitialContent(editor, sync) {
|
|
|
3821
3877
|
errorOnInvalidContent: false
|
|
3822
3878
|
});
|
|
3823
3879
|
const tr = sync(_state.EditorState.create({ doc }));
|
|
3824
|
-
if (_optionalChain([tr, 'optionalAccess',
|
|
3880
|
+
if (_optionalChain([tr, 'optionalAccess', _150 => _150.docChanged])) editor.options.content = tr.doc;
|
|
3825
3881
|
} catch (e4) {
|
|
3826
3882
|
}
|
|
3827
3883
|
}
|
|
@@ -3902,7 +3958,7 @@ function createOutlineStore(editor) {
|
|
|
3902
3958
|
const compute = () => {
|
|
3903
3959
|
if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
|
|
3904
3960
|
const headings = getOutline(editor);
|
|
3905
|
-
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call',
|
|
3961
|
+
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _151 => _151(editor, headings), 'optionalAccess', _152 => _152.id]), () => ( null));
|
|
3906
3962
|
const sameStructure = arraysEqual(snapshot.headings, headings, sameHeading);
|
|
3907
3963
|
if (sameStructure && snapshot.activeId === activeId) return snapshot;
|
|
3908
3964
|
return {
|
|
@@ -3927,16 +3983,16 @@ function createOutlineStore(editor) {
|
|
|
3927
3983
|
subscribe(listener) {
|
|
3928
3984
|
if (!listeners.size) {
|
|
3929
3985
|
snapshot = compute();
|
|
3930
|
-
_optionalChain([editor, 'optionalAccess',
|
|
3986
|
+
_optionalChain([editor, 'optionalAccess', _153 => _153.on, 'call', _154 => _154("transaction", onTransaction)]);
|
|
3931
3987
|
}
|
|
3932
3988
|
listeners.add(listener);
|
|
3933
3989
|
return () => {
|
|
3934
3990
|
listeners.delete(listener);
|
|
3935
|
-
if (!listeners.size) _optionalChain([editor, 'optionalAccess',
|
|
3991
|
+
if (!listeners.size) _optionalChain([editor, 'optionalAccess', _155 => _155.off, 'call', _156 => _156("transaction", onTransaction)]);
|
|
3936
3992
|
};
|
|
3937
3993
|
},
|
|
3938
3994
|
destroy() {
|
|
3939
|
-
_optionalChain([editor, 'optionalAccess',
|
|
3995
|
+
_optionalChain([editor, 'optionalAccess', _157 => _157.off, 'call', _158 => _158("transaction", onTransaction)]);
|
|
3940
3996
|
listeners.clear();
|
|
3941
3997
|
}
|
|
3942
3998
|
};
|
|
@@ -4011,7 +4067,7 @@ var Outline = _core.Extension.create({
|
|
|
4011
4067
|
if (options.focus !== false) {
|
|
4012
4068
|
tr.setSelection(_state.TextSelection.create(tr.doc, heading.pos + 1));
|
|
4013
4069
|
tr.scrollIntoView();
|
|
4014
|
-
_optionalChain([view, 'optionalAccess',
|
|
4070
|
+
_optionalChain([view, 'optionalAccess', _159 => _159.focus, 'optionalCall', _160 => _160()]);
|
|
4015
4071
|
}
|
|
4016
4072
|
scrollDomAtPos(view, heading.pos, options.behavior);
|
|
4017
4073
|
}
|
|
@@ -4043,7 +4099,7 @@ var Outline = _core.Extension.create({
|
|
|
4043
4099
|
const next = computeOutline(newState.doc, types);
|
|
4044
4100
|
if (arraysEqual(prev, next, sameHeading)) return prev;
|
|
4045
4101
|
storage.headings = next;
|
|
4046
|
-
_optionalChain([onUpdate, 'call',
|
|
4102
|
+
_optionalChain([onUpdate, 'call', _161 => _161(), 'optionalCall', _162 => _162(next)]);
|
|
4047
4103
|
return next;
|
|
4048
4104
|
}
|
|
4049
4105
|
}
|
|
@@ -4362,7 +4418,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4362
4418
|
handleDOMEvents: {
|
|
4363
4419
|
click: (view, event) => {
|
|
4364
4420
|
const target = event.target;
|
|
4365
|
-
const link = _optionalChain([target, 'optionalAccess',
|
|
4421
|
+
const link = _optionalChain([target, 'optionalAccess', _163 => _163.closest, 'optionalCall', _164 => _164(
|
|
4366
4422
|
'nav[data-type="table-of-contents"] a[data-heading-id]'
|
|
4367
4423
|
)]);
|
|
4368
4424
|
if (!link) return false;
|
|
@@ -4435,7 +4491,7 @@ function getFootnotes(doc) {
|
|
|
4435
4491
|
number: index + 1,
|
|
4436
4492
|
text: footnote ? footnoteText(footnote.node) : "",
|
|
4437
4493
|
referencePos: ref.pos,
|
|
4438
|
-
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess',
|
|
4494
|
+
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _165 => _165.pos]), () => ( null))
|
|
4439
4495
|
};
|
|
4440
4496
|
});
|
|
4441
4497
|
}
|
|
@@ -4477,7 +4533,7 @@ function syncFootnotes(tr, options = {}) {
|
|
|
4477
4533
|
});
|
|
4478
4534
|
const desiredItems = desiredRefs.map(({ id, number, copyOf }) => {
|
|
4479
4535
|
const source = _nullishCoalesce(existing.get(id), () => ( (copyOf ? existing.get(copyOf) : void 0)));
|
|
4480
|
-
const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
4536
|
+
const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _166 => _166.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _167 => _167.contents, 'optionalAccess', _168 => _168[id]]), () => ( "")))));
|
|
4481
4537
|
if (source && source.attrs.id === id && source.attrs.number === number) {
|
|
4482
4538
|
return source;
|
|
4483
4539
|
}
|
|
@@ -4680,7 +4736,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4680
4736
|
handleClickOn: (_view, _pos, node, _nodePos, event) => {
|
|
4681
4737
|
if (node.type.name !== REFERENCE || !node.attrs.id) return false;
|
|
4682
4738
|
const target = event.target;
|
|
4683
|
-
if (!_optionalChain([target, 'optionalAccess',
|
|
4739
|
+
if (!_optionalChain([target, 'optionalAccess', _169 => _169.closest, 'optionalCall', _170 => _170("a")])) return false;
|
|
4684
4740
|
event.preventDefault();
|
|
4685
4741
|
return editor.commands.goToFootnote(node.attrs.id);
|
|
4686
4742
|
}
|
|
@@ -4878,7 +4934,7 @@ var Bookmark = _core.Mark.create({
|
|
|
4878
4934
|
}
|
|
4879
4935
|
if (!dispatch) return true;
|
|
4880
4936
|
const sameName = getBookmarks(state.doc).find((b) => b.name === name);
|
|
4881
|
-
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess',
|
|
4937
|
+
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _171 => _171.id]))), () => ( this.options.generateId()));
|
|
4882
4938
|
if (sameName) {
|
|
4883
4939
|
forEachBookmarkRange(
|
|
4884
4940
|
tr.doc,
|
|
@@ -5120,7 +5176,7 @@ var CrossReference = _core.Node.create({
|
|
|
5120
5176
|
// src/extensions/document-structure/command-items.ts
|
|
5121
5177
|
var start = (editor, args) => {
|
|
5122
5178
|
const chain = editor.chain().focus();
|
|
5123
|
-
return _optionalChain([args, 'optionalAccess',
|
|
5179
|
+
return _optionalChain([args, 'optionalAccess', _172 => _172.range]) ? chain.deleteRange(args.range) : chain;
|
|
5124
5180
|
};
|
|
5125
5181
|
var documentStructureCommandItems = [
|
|
5126
5182
|
{
|
|
@@ -5137,7 +5193,7 @@ var documentStructureCommandItems = [
|
|
|
5137
5193
|
description: "Insert a numbered footnote",
|
|
5138
5194
|
keywords: ["footnote", "note", "fn", "citation"],
|
|
5139
5195
|
extension: "footnoteReference",
|
|
5140
|
-
run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess',
|
|
5196
|
+
run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _173 => _173.content]) }).run()
|
|
5141
5197
|
},
|
|
5142
5198
|
{
|
|
5143
5199
|
id: "bookmark",
|
|
@@ -5146,7 +5202,7 @@ var documentStructureCommandItems = [
|
|
|
5146
5202
|
keywords: ["bookmark", "anchor", "name"],
|
|
5147
5203
|
extension: "bookmark",
|
|
5148
5204
|
requires: "name",
|
|
5149
|
-
run: (editor, args) => !!_optionalChain([args, 'optionalAccess',
|
|
5205
|
+
run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _174 => _174.name]) && start(editor, args).setBookmark({ name: args.name }).run()
|
|
5150
5206
|
},
|
|
5151
5207
|
{
|
|
5152
5208
|
id: "cross-reference",
|
|
@@ -5155,7 +5211,7 @@ var documentStructureCommandItems = [
|
|
|
5155
5211
|
keywords: ["cross", "reference", "xref", "link", "ref"],
|
|
5156
5212
|
extension: "crossReference",
|
|
5157
5213
|
requires: "target",
|
|
5158
|
-
run: (editor, args) => !!_optionalChain([args, 'optionalAccess',
|
|
5214
|
+
run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _175 => _175.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
|
|
5159
5215
|
}
|
|
5160
5216
|
];
|
|
5161
5217
|
function getDocumentStructureCommandItems(editor, query = "") {
|
|
@@ -5169,8 +5225,1252 @@ function getDocumentStructureCommandItems(editor, query = "") {
|
|
|
5169
5225
|
);
|
|
5170
5226
|
}
|
|
5171
5227
|
|
|
5228
|
+
// src/extensions/find-replace/extension.ts
|
|
5229
|
+
|
|
5230
|
+
|
|
5231
|
+
|
|
5232
|
+
|
|
5233
|
+
|
|
5234
|
+
// src/extensions/find-replace/pattern.ts
|
|
5235
|
+
var FIND_PARAGRAPH_MARK = "\r";
|
|
5236
|
+
var MAX_FIND_PATTERN_LENGTH = 1024;
|
|
5237
|
+
var MAX_COUNT = 1e3;
|
|
5238
|
+
var MAX_PROGRAM_SIZE = 2e4;
|
|
5239
|
+
var now = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
5240
|
+
function createSearchBudget(options = {}) {
|
|
5241
|
+
return {
|
|
5242
|
+
deadline: now() + (_nullishCoalesce(options.timeLimitMs, () => ( 250))),
|
|
5243
|
+
steps: _nullishCoalesce(options.maxSteps, () => ( 5e7)),
|
|
5244
|
+
exhausted: false
|
|
5245
|
+
};
|
|
5246
|
+
}
|
|
5247
|
+
var PARA = 13;
|
|
5248
|
+
var ANY = (cp) => cp !== PARA;
|
|
5249
|
+
var LETTER = /\p{L}/u;
|
|
5250
|
+
var PUNCT = /\p{P}/u;
|
|
5251
|
+
var WORD = /[\p{L}\p{M}\p{Nd}\p{Pc}]/u;
|
|
5252
|
+
var foldCache = /* @__PURE__ */ new Map();
|
|
5253
|
+
function foldCodePoint(cp) {
|
|
5254
|
+
if (cp < 128) return cp >= 65 && cp <= 90 ? cp + 32 : cp;
|
|
5255
|
+
const cached = foldCache.get(cp);
|
|
5256
|
+
if (cached !== void 0) return cached;
|
|
5257
|
+
const lower = String.fromCodePoint(cp).toLowerCase();
|
|
5258
|
+
const folded = [...lower].length === 1 ? lower.codePointAt(0) : cp;
|
|
5259
|
+
if (foldCache.size < 4096) foldCache.set(cp, folded);
|
|
5260
|
+
return folded;
|
|
5261
|
+
}
|
|
5262
|
+
function isWordChar(cp) {
|
|
5263
|
+
if (cp < 0) return false;
|
|
5264
|
+
if (cp < 128) {
|
|
5265
|
+
return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 95;
|
|
5266
|
+
}
|
|
5267
|
+
return WORD.test(String.fromCodePoint(cp));
|
|
5268
|
+
}
|
|
5269
|
+
var isLetter = (cp) => cp < 128 ? cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 : LETTER.test(String.fromCodePoint(cp));
|
|
5270
|
+
function isPunct(cp) {
|
|
5271
|
+
if (cp < 128) {
|
|
5272
|
+
return cp >= 33 && cp <= 47 || cp >= 58 && cp <= 64 || cp >= 91 && cp <= 96 || cp >= 123 && cp <= 126;
|
|
5273
|
+
}
|
|
5274
|
+
return cp >= 8208 && cp <= 8231 || cp === 161 || cp === 191 || cp === 171 || cp === 187 || PUNCT.test(String.fromCodePoint(cp));
|
|
5275
|
+
}
|
|
5276
|
+
var isSpace = (cp) => cp === 32 || cp === 9 || cp === 160;
|
|
5277
|
+
function cpBefore(hay, pos) {
|
|
5278
|
+
if (pos <= 0) return -1;
|
|
5279
|
+
const low = hay.charCodeAt(pos - 1);
|
|
5280
|
+
if (low >= 56320 && low <= 57343 && pos >= 2) {
|
|
5281
|
+
const high = hay.charCodeAt(pos - 2);
|
|
5282
|
+
if (high >= 55296 && high <= 56319) return hay.codePointAt(pos - 2);
|
|
5283
|
+
}
|
|
5284
|
+
return low;
|
|
5285
|
+
}
|
|
5286
|
+
var cpAt = (hay, pos) => pos < hay.length ? hay.codePointAt(pos) : -1;
|
|
5287
|
+
var PatternError = class extends Error {
|
|
5288
|
+
constructor(code, message) {
|
|
5289
|
+
super(message);
|
|
5290
|
+
this.code = code;
|
|
5291
|
+
}
|
|
5292
|
+
|
|
5293
|
+
};
|
|
5294
|
+
var charNode = (test) => ({ k: "char", test });
|
|
5295
|
+
var exact = (cp) => charNode((c) => c === cp);
|
|
5296
|
+
var literalNode = (cp, caseInsensitive) => {
|
|
5297
|
+
if (!caseInsensitive) return exact(cp);
|
|
5298
|
+
const f = foldCodePoint(cp);
|
|
5299
|
+
return charNode((_c, folded) => folded === f);
|
|
5300
|
+
};
|
|
5301
|
+
var star = (body, lazy) => ({ k: "rep", body, min: 0, max: -1, lazy });
|
|
5302
|
+
function findCode(c) {
|
|
5303
|
+
switch (c) {
|
|
5304
|
+
case "p":
|
|
5305
|
+
return exact(PARA);
|
|
5306
|
+
case "t":
|
|
5307
|
+
return exact(9);
|
|
5308
|
+
case "?":
|
|
5309
|
+
return charNode(ANY);
|
|
5310
|
+
case "#":
|
|
5311
|
+
return charNode((cp) => cp >= 48 && cp <= 57);
|
|
5312
|
+
case "$":
|
|
5313
|
+
return charNode((cp) => isLetter(cp));
|
|
5314
|
+
case "^":
|
|
5315
|
+
return exact(94);
|
|
5316
|
+
case "l":
|
|
5317
|
+
return exact(10);
|
|
5318
|
+
case "m":
|
|
5319
|
+
return exact(12);
|
|
5320
|
+
case "n":
|
|
5321
|
+
return exact(14);
|
|
5322
|
+
case "+":
|
|
5323
|
+
return exact(8212);
|
|
5324
|
+
case "=":
|
|
5325
|
+
return exact(8211);
|
|
5326
|
+
case "s":
|
|
5327
|
+
return exact(160);
|
|
5328
|
+
case "~":
|
|
5329
|
+
return exact(8209);
|
|
5330
|
+
case "-":
|
|
5331
|
+
return exact(173);
|
|
5332
|
+
case "w":
|
|
5333
|
+
return { k: "rep", body: charNode((cp) => isSpace(cp)), min: 1, max: -1, lazy: false };
|
|
5334
|
+
case "g":
|
|
5335
|
+
return exact(65532);
|
|
5336
|
+
case "%":
|
|
5337
|
+
return exact(167);
|
|
5338
|
+
case "v":
|
|
5339
|
+
return exact(182);
|
|
5340
|
+
default:
|
|
5341
|
+
return null;
|
|
5342
|
+
}
|
|
5343
|
+
}
|
|
5344
|
+
function replaceCode(c) {
|
|
5345
|
+
switch (c) {
|
|
5346
|
+
case "p":
|
|
5347
|
+
return FIND_PARAGRAPH_MARK;
|
|
5348
|
+
case "t":
|
|
5349
|
+
return " ";
|
|
5350
|
+
case "^":
|
|
5351
|
+
return "^";
|
|
5352
|
+
case "l":
|
|
5353
|
+
return "\n";
|
|
5354
|
+
case "m":
|
|
5355
|
+
return "\f";
|
|
5356
|
+
case "n":
|
|
5357
|
+
return "";
|
|
5358
|
+
case "+":
|
|
5359
|
+
return "\u2014";
|
|
5360
|
+
case "=":
|
|
5361
|
+
return "\u2013";
|
|
5362
|
+
case "s":
|
|
5363
|
+
return "\xA0";
|
|
5364
|
+
case "~":
|
|
5365
|
+
return "\u2011";
|
|
5366
|
+
case "-":
|
|
5367
|
+
return "\xAD";
|
|
5368
|
+
case "%":
|
|
5369
|
+
return "\xA7";
|
|
5370
|
+
case "v":
|
|
5371
|
+
return "\xB6";
|
|
5372
|
+
default:
|
|
5373
|
+
return null;
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
function codeChar(n) {
|
|
5377
|
+
switch (n) {
|
|
5378
|
+
case 13:
|
|
5379
|
+
return PARA;
|
|
5380
|
+
case 11:
|
|
5381
|
+
return 10;
|
|
5382
|
+
case 12:
|
|
5383
|
+
return 12;
|
|
5384
|
+
case 14:
|
|
5385
|
+
return 14;
|
|
5386
|
+
case 30:
|
|
5387
|
+
return 8209;
|
|
5388
|
+
case 31:
|
|
5389
|
+
return 173;
|
|
5390
|
+
}
|
|
5391
|
+
if (n > 1114111 || n >= 55296 && n <= 57343) return null;
|
|
5392
|
+
if (n < 32 && n !== 9 || n >= 127 && n < 160) return null;
|
|
5393
|
+
return n;
|
|
5394
|
+
}
|
|
5395
|
+
function numericCode(chars, i) {
|
|
5396
|
+
const unicode = chars[i] === "u";
|
|
5397
|
+
const start2 = unicode ? i + 1 : i;
|
|
5398
|
+
const max = unicode ? 5 : 4;
|
|
5399
|
+
let digits = "";
|
|
5400
|
+
for (let j = start2; j < chars.length && digits.length < max && /[0-9]/.test(chars[j]); j++) digits += chars[j];
|
|
5401
|
+
if (!digits) return null;
|
|
5402
|
+
const cp = codeChar(parseInt(digits, 10));
|
|
5403
|
+
return cp === null ? null : { cp, used: start2 - i + digits.length };
|
|
5404
|
+
}
|
|
5405
|
+
var toChars = (s) => Array.from(s);
|
|
5406
|
+
var cpOf = (ch) => ch.codePointAt(0);
|
|
5407
|
+
function parseSpecial(query, o, caseInsensitive) {
|
|
5408
|
+
const chars = toChars(query);
|
|
5409
|
+
const atoms = [];
|
|
5410
|
+
let spans = false;
|
|
5411
|
+
let i = 0;
|
|
5412
|
+
while (i < chars.length) {
|
|
5413
|
+
const c = chars[i++];
|
|
5414
|
+
if (c === "^" && !o.literal && i < chars.length) {
|
|
5415
|
+
const n = chars[i];
|
|
5416
|
+
const code = findCode(n);
|
|
5417
|
+
if (code) {
|
|
5418
|
+
if (n === "p") spans = true;
|
|
5419
|
+
atoms.push(code);
|
|
5420
|
+
i++;
|
|
5421
|
+
continue;
|
|
5422
|
+
}
|
|
5423
|
+
const num = numericCode(chars, i);
|
|
5424
|
+
if (num) {
|
|
5425
|
+
if (num.cp === PARA) spans = true;
|
|
5426
|
+
atoms.push(literalNode(num.cp, caseInsensitive));
|
|
5427
|
+
i += num.used;
|
|
5428
|
+
continue;
|
|
5429
|
+
}
|
|
5430
|
+
}
|
|
5431
|
+
const cp = cpOf(c);
|
|
5432
|
+
if (o.ignorePunctuation && isPunct(cp) || o.ignoreWhitespace && isSpace(cp)) continue;
|
|
5433
|
+
atoms.push(literalNode(cp, caseInsensitive));
|
|
5434
|
+
}
|
|
5435
|
+
const filler = o.ignorePunctuation && o.ignoreWhitespace ? (cp) => isPunct(cp) || isSpace(cp) : o.ignorePunctuation ? (cp) => isPunct(cp) : o.ignoreWhitespace ? (cp) => isSpace(cp) : null;
|
|
5436
|
+
const items = [];
|
|
5437
|
+
atoms.forEach((atom, index) => {
|
|
5438
|
+
if (index > 0 && filler) items.push(star(charNode(filler), false));
|
|
5439
|
+
items.push(atom);
|
|
5440
|
+
});
|
|
5441
|
+
return { node: { k: "cat", items }, spans };
|
|
5442
|
+
}
|
|
5443
|
+
function parseCount(body) {
|
|
5444
|
+
const bad = () => new PatternError("invalid_pattern", `{${body}} is not a valid count`);
|
|
5445
|
+
const num = (s) => {
|
|
5446
|
+
const t = s.trim();
|
|
5447
|
+
if (!t) return null;
|
|
5448
|
+
if (!/^[0-9]+$/.test(t)) throw bad();
|
|
5449
|
+
const n = parseInt(t, 10);
|
|
5450
|
+
if (n > MAX_COUNT) throw new PatternError("invalid_pattern", `counts go up to ${MAX_COUNT}`);
|
|
5451
|
+
return n;
|
|
5452
|
+
};
|
|
5453
|
+
const sep = body.search(/[,;]/);
|
|
5454
|
+
if (sep < 0) {
|
|
5455
|
+
const n = num(body);
|
|
5456
|
+
if (n === null) throw bad();
|
|
5457
|
+
return { min: n, max: n };
|
|
5458
|
+
}
|
|
5459
|
+
const a = _nullishCoalesce(num(body.slice(0, sep)), () => ( 0));
|
|
5460
|
+
const b = num(body.slice(sep + 1));
|
|
5461
|
+
if (b !== null && b < a) throw bad();
|
|
5462
|
+
return { min: a, max: _nullishCoalesce(b, () => ( -1)) };
|
|
5463
|
+
}
|
|
5464
|
+
function parseClass(inner) {
|
|
5465
|
+
let negated = false;
|
|
5466
|
+
if (inner[0] === "!") {
|
|
5467
|
+
negated = true;
|
|
5468
|
+
inner = inner.slice(1);
|
|
5469
|
+
}
|
|
5470
|
+
if (inner.length === 0) throw new PatternError("invalid_pattern", "[ ] needs at least one character");
|
|
5471
|
+
const singles = /* @__PURE__ */ new Set();
|
|
5472
|
+
const ranges = [];
|
|
5473
|
+
let i = 0;
|
|
5474
|
+
while (i < inner.length) {
|
|
5475
|
+
let c = inner[i];
|
|
5476
|
+
if (c === "\\" && i + 1 < inner.length) c = inner[++i];
|
|
5477
|
+
i++;
|
|
5478
|
+
if (inner[i] === "-" && i + 1 < inner.length) {
|
|
5479
|
+
const hi = inner[i + 1];
|
|
5480
|
+
if (cpOf(hi) < cpOf(c)) throw new PatternError("invalid_pattern", `[${c}-${hi}] is not in ascending order`);
|
|
5481
|
+
ranges.push([cpOf(c), cpOf(hi)]);
|
|
5482
|
+
i += 2;
|
|
5483
|
+
} else {
|
|
5484
|
+
singles.add(cpOf(c));
|
|
5485
|
+
}
|
|
5486
|
+
}
|
|
5487
|
+
const inSet = (cp) => singles.has(cp) || ranges.some(([lo, hi]) => cp >= lo && cp <= hi);
|
|
5488
|
+
return negated ? (cp) => cp !== PARA && !inSet(cp) : (cp) => inSet(cp);
|
|
5489
|
+
}
|
|
5490
|
+
function parseWildcards(query) {
|
|
5491
|
+
const chars = toChars(query);
|
|
5492
|
+
const stack = [{ items: [], group: 0 }];
|
|
5493
|
+
let groups = 0;
|
|
5494
|
+
let spans = false;
|
|
5495
|
+
const top = () => stack[stack.length - 1].items;
|
|
5496
|
+
const quantify = (min, max, what) => {
|
|
5497
|
+
const items = top();
|
|
5498
|
+
const last = items[items.length - 1];
|
|
5499
|
+
if (!last || last.k === "assert" || last.k === "rep") {
|
|
5500
|
+
throw new PatternError("invalid_pattern", `${what} needs something to repeat before it`);
|
|
5501
|
+
}
|
|
5502
|
+
items[items.length - 1] = { k: "rep", body: last, min, max, lazy: false };
|
|
5503
|
+
};
|
|
5504
|
+
let i = 0;
|
|
5505
|
+
while (i < chars.length) {
|
|
5506
|
+
const c = chars[i++];
|
|
5507
|
+
switch (c) {
|
|
5508
|
+
case "?":
|
|
5509
|
+
top().push(charNode(ANY));
|
|
5510
|
+
break;
|
|
5511
|
+
case "*":
|
|
5512
|
+
top().push(star(charNode(ANY), true));
|
|
5513
|
+
break;
|
|
5514
|
+
case "@":
|
|
5515
|
+
quantify(1, -1, "@");
|
|
5516
|
+
break;
|
|
5517
|
+
case "<":
|
|
5518
|
+
top().push({ k: "assert", kind: "wordStart" });
|
|
5519
|
+
break;
|
|
5520
|
+
case ">":
|
|
5521
|
+
top().push({ k: "assert", kind: "wordEnd" });
|
|
5522
|
+
break;
|
|
5523
|
+
case "(":
|
|
5524
|
+
stack.push({ items: [], group: ++groups });
|
|
5525
|
+
break;
|
|
5526
|
+
case ")": {
|
|
5527
|
+
if (stack.length === 1) throw new PatternError("invalid_pattern", "a ) has no opening (");
|
|
5528
|
+
const frame = stack.pop();
|
|
5529
|
+
top().push({ k: "group", index: frame.group, body: { k: "cat", items: frame.items } });
|
|
5530
|
+
break;
|
|
5531
|
+
}
|
|
5532
|
+
case "{": {
|
|
5533
|
+
const end = chars.indexOf("}", i);
|
|
5534
|
+
if (end < 0) throw new PatternError("invalid_pattern", "a { needs a closing }");
|
|
5535
|
+
const { min, max } = parseCount(chars.slice(i, end).join(""));
|
|
5536
|
+
quantify(min, max, `{${chars.slice(i, end).join("")}}`);
|
|
5537
|
+
i = end + 1;
|
|
5538
|
+
break;
|
|
5539
|
+
}
|
|
5540
|
+
case "[": {
|
|
5541
|
+
const end = chars.indexOf("]", i);
|
|
5542
|
+
if (end < 0) throw new PatternError("invalid_pattern", "a [ needs a closing ]");
|
|
5543
|
+
top().push(charNode(parseClass(chars.slice(i, end))));
|
|
5544
|
+
i = end + 1;
|
|
5545
|
+
break;
|
|
5546
|
+
}
|
|
5547
|
+
case "\\": {
|
|
5548
|
+
if (i >= chars.length) {
|
|
5549
|
+
top().push(exact(92));
|
|
5550
|
+
} else if (/[0-9]/.test(chars[i])) {
|
|
5551
|
+
throw new PatternError("invalid_pattern", "back-references (\\1) work in Replace with, not in Find what");
|
|
5552
|
+
} else {
|
|
5553
|
+
top().push(exact(cpOf(chars[i++])));
|
|
5554
|
+
}
|
|
5555
|
+
break;
|
|
5556
|
+
}
|
|
5557
|
+
case "^": {
|
|
5558
|
+
if (i >= chars.length) {
|
|
5559
|
+
top().push(exact(94));
|
|
5560
|
+
break;
|
|
5561
|
+
}
|
|
5562
|
+
const n = chars[i];
|
|
5563
|
+
const code = findCode(n);
|
|
5564
|
+
if (code) {
|
|
5565
|
+
if (n === "p") spans = true;
|
|
5566
|
+
top().push(code);
|
|
5567
|
+
i++;
|
|
5568
|
+
break;
|
|
5569
|
+
}
|
|
5570
|
+
const num = numericCode(chars, i);
|
|
5571
|
+
if (num) {
|
|
5572
|
+
if (num.cp === PARA) spans = true;
|
|
5573
|
+
top().push(exact(num.cp));
|
|
5574
|
+
i += num.used;
|
|
5575
|
+
} else {
|
|
5576
|
+
top().push(exact(94));
|
|
5577
|
+
}
|
|
5578
|
+
break;
|
|
5579
|
+
}
|
|
5580
|
+
default:
|
|
5581
|
+
top().push(exact(cpOf(c)));
|
|
5582
|
+
}
|
|
5583
|
+
}
|
|
5584
|
+
if (stack.length > 1) throw new PatternError("invalid_pattern", "a ( needs a closing )");
|
|
5585
|
+
return { node: { k: "cat", items: stack[0].items }, spans, groups };
|
|
5586
|
+
}
|
|
5587
|
+
function compileProgram(node) {
|
|
5588
|
+
const prog = [];
|
|
5589
|
+
const push = (inst) => {
|
|
5590
|
+
if (prog.length >= MAX_PROGRAM_SIZE) {
|
|
5591
|
+
throw new PatternError("too_complex", "the pattern is too complex (too many repeats)");
|
|
5592
|
+
}
|
|
5593
|
+
prog.push(inst);
|
|
5594
|
+
return prog.length - 1;
|
|
5595
|
+
};
|
|
5596
|
+
const emit = (n) => {
|
|
5597
|
+
switch (n.k) {
|
|
5598
|
+
case "char":
|
|
5599
|
+
push({ op: 0 /* Char */, test: n.test });
|
|
5600
|
+
return;
|
|
5601
|
+
case "cat":
|
|
5602
|
+
n.items.forEach(emit);
|
|
5603
|
+
return;
|
|
5604
|
+
case "group":
|
|
5605
|
+
push({ op: 3 /* Save */, n: 2 * n.index });
|
|
5606
|
+
emit(n.body);
|
|
5607
|
+
push({ op: 3 /* Save */, n: 2 * n.index + 1 });
|
|
5608
|
+
return;
|
|
5609
|
+
case "assert":
|
|
5610
|
+
push({ op: 4 /* Assert */, kind: n.kind });
|
|
5611
|
+
return;
|
|
5612
|
+
case "rep": {
|
|
5613
|
+
for (let k = 0; k < n.min; k++) emit(n.body);
|
|
5614
|
+
if (n.max < 0) {
|
|
5615
|
+
const split = push({ op: 1 /* Split */, x: 0, y: 0 });
|
|
5616
|
+
emit(n.body);
|
|
5617
|
+
push({ op: 2 /* Jmp */, x: split });
|
|
5618
|
+
const exit2 = prog.length;
|
|
5619
|
+
const inst = prog[split];
|
|
5620
|
+
inst.x = n.lazy ? exit2 : split + 1;
|
|
5621
|
+
inst.y = n.lazy ? split + 1 : exit2;
|
|
5622
|
+
return;
|
|
5623
|
+
}
|
|
5624
|
+
const splits = [];
|
|
5625
|
+
for (let k = n.min; k < n.max; k++) {
|
|
5626
|
+
splits.push(push({ op: 1 /* Split */, x: 0, y: 0 }));
|
|
5627
|
+
emit(n.body);
|
|
5628
|
+
}
|
|
5629
|
+
const exit = prog.length;
|
|
5630
|
+
for (const s of splits) {
|
|
5631
|
+
const inst = prog[s];
|
|
5632
|
+
inst.x = n.lazy ? exit : s + 1;
|
|
5633
|
+
inst.y = n.lazy ? s + 1 : exit;
|
|
5634
|
+
}
|
|
5635
|
+
return;
|
|
5636
|
+
}
|
|
5637
|
+
}
|
|
5638
|
+
};
|
|
5639
|
+
push({ op: 3 /* Save */, n: 0 });
|
|
5640
|
+
emit(node);
|
|
5641
|
+
push({ op: 3 /* Save */, n: 1 });
|
|
5642
|
+
push({ op: 5 /* Match */ });
|
|
5643
|
+
return prog;
|
|
5644
|
+
}
|
|
5645
|
+
function checkAssert(kind, hay, pos) {
|
|
5646
|
+
const before = isWordChar(cpBefore(hay, pos));
|
|
5647
|
+
const after = isWordChar(cpAt(hay, pos));
|
|
5648
|
+
switch (kind) {
|
|
5649
|
+
case "boundary":
|
|
5650
|
+
return before !== after;
|
|
5651
|
+
case "wordStart":
|
|
5652
|
+
return !before && after;
|
|
5653
|
+
case "wordEnd":
|
|
5654
|
+
return before && !after;
|
|
5655
|
+
}
|
|
5656
|
+
}
|
|
5657
|
+
function pikeExec(prog, groupCount, caseInsensitive, hay, start2, end, budget) {
|
|
5658
|
+
const ncap = 2 * (groupCount + 1);
|
|
5659
|
+
const mark = new Int32Array(prog.length);
|
|
5660
|
+
let gen = 1;
|
|
5661
|
+
let clistPc = [];
|
|
5662
|
+
let clistCaps = [];
|
|
5663
|
+
let nlistPc = [];
|
|
5664
|
+
let nlistCaps = [];
|
|
5665
|
+
const stackPc = [];
|
|
5666
|
+
const stackCaps = [];
|
|
5667
|
+
let matched = null;
|
|
5668
|
+
const initial = new Int32Array(ncap).fill(-1);
|
|
5669
|
+
const add = (listPc, listCaps, pc0, caps0, pos) => {
|
|
5670
|
+
stackPc.push(pc0);
|
|
5671
|
+
stackCaps.push(caps0);
|
|
5672
|
+
while (stackPc.length) {
|
|
5673
|
+
const pc = stackPc.pop();
|
|
5674
|
+
const caps = stackCaps.pop();
|
|
5675
|
+
if (mark[pc] === gen) continue;
|
|
5676
|
+
mark[pc] = gen;
|
|
5677
|
+
const inst = prog[pc];
|
|
5678
|
+
switch (inst.op) {
|
|
5679
|
+
case 2 /* Jmp */:
|
|
5680
|
+
stackPc.push(inst.x);
|
|
5681
|
+
stackCaps.push(caps);
|
|
5682
|
+
break;
|
|
5683
|
+
case 1 /* Split */:
|
|
5684
|
+
stackPc.push(inst.y, inst.x);
|
|
5685
|
+
stackCaps.push(caps, caps);
|
|
5686
|
+
break;
|
|
5687
|
+
case 3 /* Save */: {
|
|
5688
|
+
const next = caps.slice();
|
|
5689
|
+
next[inst.n] = pos;
|
|
5690
|
+
stackPc.push(pc + 1);
|
|
5691
|
+
stackCaps.push(next);
|
|
5692
|
+
break;
|
|
5693
|
+
}
|
|
5694
|
+
case 4 /* Assert */:
|
|
5695
|
+
if (checkAssert(inst.kind, hay, pos)) {
|
|
5696
|
+
stackPc.push(pc + 1);
|
|
5697
|
+
stackCaps.push(caps);
|
|
5698
|
+
}
|
|
5699
|
+
break;
|
|
5700
|
+
default:
|
|
5701
|
+
listPc.push(pc);
|
|
5702
|
+
listCaps.push(caps);
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5705
|
+
};
|
|
5706
|
+
let i = start2;
|
|
5707
|
+
if (budget.steps <= 0 || now() > budget.deadline) {
|
|
5708
|
+
budget.exhausted = true;
|
|
5709
|
+
return "budget";
|
|
5710
|
+
}
|
|
5711
|
+
let steps = 0;
|
|
5712
|
+
for (; ; ) {
|
|
5713
|
+
if (!matched) add(clistPc, clistCaps, 0, initial, i);
|
|
5714
|
+
const cp = i < end ? hay.codePointAt(i) : -1;
|
|
5715
|
+
const width = cp > 65535 ? 2 : 1;
|
|
5716
|
+
if (clistPc.length === 0) {
|
|
5717
|
+
if (matched || i >= end) break;
|
|
5718
|
+
gen++;
|
|
5719
|
+
i += width;
|
|
5720
|
+
continue;
|
|
5721
|
+
}
|
|
5722
|
+
const folded = cp >= 0 && caseInsensitive ? foldCodePoint(cp) : cp;
|
|
5723
|
+
gen++;
|
|
5724
|
+
nlistPc = [];
|
|
5725
|
+
nlistCaps = [];
|
|
5726
|
+
for (let t = 0; t < clistPc.length; t++) {
|
|
5727
|
+
if (++steps >= 4096) {
|
|
5728
|
+
budget.steps -= steps;
|
|
5729
|
+
steps = 0;
|
|
5730
|
+
if (budget.steps <= 0 || now() > budget.deadline) {
|
|
5731
|
+
budget.exhausted = true;
|
|
5732
|
+
return "budget";
|
|
5733
|
+
}
|
|
5734
|
+
}
|
|
5735
|
+
const inst = prog[clistPc[t]];
|
|
5736
|
+
if (inst.op === 0 /* Char */) {
|
|
5737
|
+
if (cp >= 0 && inst.test(cp, folded)) add(nlistPc, nlistCaps, clistPc[t] + 1, clistCaps[t], i + width);
|
|
5738
|
+
} else if (inst.op === 5 /* Match */) {
|
|
5739
|
+
matched = clistCaps[t];
|
|
5740
|
+
break;
|
|
5741
|
+
}
|
|
5742
|
+
}
|
|
5743
|
+
clistPc = nlistPc;
|
|
5744
|
+
clistCaps = nlistCaps;
|
|
5745
|
+
if (i >= end) break;
|
|
5746
|
+
i += width;
|
|
5747
|
+
}
|
|
5748
|
+
budget.steps -= steps;
|
|
5749
|
+
if (!matched) return null;
|
|
5750
|
+
const groups = [];
|
|
5751
|
+
for (let g = 0; g <= groupCount; g++) {
|
|
5752
|
+
const a = matched[2 * g];
|
|
5753
|
+
const b = matched[2 * g + 1];
|
|
5754
|
+
groups.push(a >= 0 && b >= 0 ? hay.slice(a, b) : void 0);
|
|
5755
|
+
}
|
|
5756
|
+
return { start: matched[0], end: matched[1], groups };
|
|
5757
|
+
}
|
|
5758
|
+
var WORD_CLASS = "[\\p{L}\\p{M}\\p{Nd}\\p{Pc}]";
|
|
5759
|
+
var REGEX_BOUNDARY = `(?:(?<=${WORD_CLASS})(?!${WORD_CLASS})|(?<!${WORD_CLASS})(?=${WORD_CLASS}))`;
|
|
5760
|
+
function hasNestedRepeat(source) {
|
|
5761
|
+
const quantifierAt = (i) => {
|
|
5762
|
+
const c = source[i];
|
|
5763
|
+
if (c === "*" || c === "+") return { repeats: true, many: true };
|
|
5764
|
+
if (c === "{") {
|
|
5765
|
+
const m = /^\{(\d*)(,?)(\d*)\}/.exec(source.slice(i));
|
|
5766
|
+
if (m) {
|
|
5767
|
+
const max = m[2] ? m[3] ? Number(m[3]) : Infinity : Number(m[1]);
|
|
5768
|
+
return { repeats: max > 1, many: max > 1 };
|
|
5769
|
+
}
|
|
5770
|
+
}
|
|
5771
|
+
return { repeats: false, many: false };
|
|
5772
|
+
};
|
|
5773
|
+
const stack = [];
|
|
5774
|
+
let inClass = false;
|
|
5775
|
+
for (let i = 0; i < source.length; i++) {
|
|
5776
|
+
const c = source[i];
|
|
5777
|
+
if (c === "\\") {
|
|
5778
|
+
i++;
|
|
5779
|
+
continue;
|
|
5780
|
+
}
|
|
5781
|
+
if (inClass) {
|
|
5782
|
+
if (c === "]") inClass = false;
|
|
5783
|
+
continue;
|
|
5784
|
+
}
|
|
5785
|
+
if (c === "[") {
|
|
5786
|
+
inClass = true;
|
|
5787
|
+
} else if (c === "(") {
|
|
5788
|
+
stack.push(false);
|
|
5789
|
+
} else if (c === ")") {
|
|
5790
|
+
const inner = _nullishCoalesce(stack.pop(), () => ( false));
|
|
5791
|
+
const q = quantifierAt(i + 1);
|
|
5792
|
+
if (inner && q.many) return true;
|
|
5793
|
+
if (stack.length && (inner || q.repeats)) stack[stack.length - 1] = true;
|
|
5794
|
+
} else if (stack.length && quantifierAt(i).repeats) {
|
|
5795
|
+
stack[stack.length - 1] = true;
|
|
5796
|
+
}
|
|
5797
|
+
}
|
|
5798
|
+
return false;
|
|
5799
|
+
}
|
|
5800
|
+
function compileRegex(query, o) {
|
|
5801
|
+
if (hasNestedRepeat(query)) {
|
|
5802
|
+
throw new PatternError(
|
|
5803
|
+
"too_complex",
|
|
5804
|
+
"a repeated group containing a repeat, like (a+)+, can take exponential time; rewrite it without nesting"
|
|
5805
|
+
);
|
|
5806
|
+
}
|
|
5807
|
+
let source = query;
|
|
5808
|
+
if (o.wholeWord || o.matchPrefix && o.matchSuffix) source = `${REGEX_BOUNDARY}(?:${query})${REGEX_BOUNDARY}`;
|
|
5809
|
+
else if (o.matchPrefix) source = `${REGEX_BOUNDARY}(?:${query})`;
|
|
5810
|
+
else if (o.matchSuffix) source = `(?:${query})${REGEX_BOUNDARY}`;
|
|
5811
|
+
let re;
|
|
5812
|
+
try {
|
|
5813
|
+
re = new RegExp(source, o.matchCase ? "gu" : "giu");
|
|
5814
|
+
} catch (error) {
|
|
5815
|
+
throw new PatternError("invalid_pattern", `bad pattern: ${error instanceof Error ? error.message : String(error)}`);
|
|
5816
|
+
}
|
|
5817
|
+
let slicedFor = null;
|
|
5818
|
+
return {
|
|
5819
|
+
mode: "regex",
|
|
5820
|
+
spansParagraphs: false,
|
|
5821
|
+
caseInsensitive: !o.matchCase,
|
|
5822
|
+
groupCount: 0,
|
|
5823
|
+
exec(hay, start2, end, budget) {
|
|
5824
|
+
if (now() > budget.deadline) {
|
|
5825
|
+
budget.exhausted = true;
|
|
5826
|
+
return "budget";
|
|
5827
|
+
}
|
|
5828
|
+
let text = hay;
|
|
5829
|
+
if (end < hay.length) {
|
|
5830
|
+
if (!slicedFor || slicedFor.hay !== hay || slicedFor.end !== end) {
|
|
5831
|
+
slicedFor = { hay, end, text: hay.slice(0, end) };
|
|
5832
|
+
}
|
|
5833
|
+
text = slicedFor.text;
|
|
5834
|
+
}
|
|
5835
|
+
re.lastIndex = start2;
|
|
5836
|
+
const m = re.exec(text);
|
|
5837
|
+
if (!m) return null;
|
|
5838
|
+
return { start: m.index, end: m.index + m[0].length, groups: Array.from(m) };
|
|
5839
|
+
}
|
|
5840
|
+
};
|
|
5841
|
+
}
|
|
5842
|
+
function compileFindPattern(query, options = {}) {
|
|
5843
|
+
try {
|
|
5844
|
+
if (Array.from(query).length > MAX_FIND_PATTERN_LENGTH) {
|
|
5845
|
+
throw new PatternError("too_long", `the Find what text is longer than ${MAX_FIND_PATTERN_LENGTH} characters`);
|
|
5846
|
+
}
|
|
5847
|
+
if (options.regex) return { ok: true, pattern: compileRegex(query, options) };
|
|
5848
|
+
const wildcards = !!options.wildcards && !options.literal;
|
|
5849
|
+
const caseInsensitive = !options.matchCase && !wildcards;
|
|
5850
|
+
let node;
|
|
5851
|
+
let spans;
|
|
5852
|
+
let groups = 0;
|
|
5853
|
+
if (wildcards) {
|
|
5854
|
+
({ node, spans, groups } = parseWildcards(query));
|
|
5855
|
+
} else {
|
|
5856
|
+
({ node, spans } = parseSpecial(query, options, caseInsensitive));
|
|
5857
|
+
const before = options.wholeWord || options.matchPrefix;
|
|
5858
|
+
const after = options.wholeWord || options.matchSuffix;
|
|
5859
|
+
if (before || after) {
|
|
5860
|
+
const items = [];
|
|
5861
|
+
if (before) items.push({ k: "assert", kind: "boundary" });
|
|
5862
|
+
items.push(node);
|
|
5863
|
+
if (after) items.push({ k: "assert", kind: "boundary" });
|
|
5864
|
+
node = { k: "cat", items };
|
|
5865
|
+
}
|
|
5866
|
+
}
|
|
5867
|
+
const prog = compileProgram(node);
|
|
5868
|
+
return {
|
|
5869
|
+
ok: true,
|
|
5870
|
+
pattern: {
|
|
5871
|
+
mode: wildcards ? "wildcards" : "special",
|
|
5872
|
+
spansParagraphs: spans,
|
|
5873
|
+
caseInsensitive,
|
|
5874
|
+
groupCount: groups,
|
|
5875
|
+
exec: (hay, start2, end, budget) => pikeExec(prog, groups, caseInsensitive, hay, start2, end, budget)
|
|
5876
|
+
}
|
|
5877
|
+
};
|
|
5878
|
+
} catch (error) {
|
|
5879
|
+
if (error instanceof PatternError) return { ok: false, error: { code: error.code, message: error.message } };
|
|
5880
|
+
return { ok: false, error: { code: "invalid_pattern", message: error instanceof Error ? error.message : String(error) } };
|
|
5881
|
+
}
|
|
5882
|
+
}
|
|
5883
|
+
function findAllMatches(pattern, hay, options = {}) {
|
|
5884
|
+
const budget = _nullishCoalesce(options.budget, () => ( createSearchBudget()));
|
|
5885
|
+
const maxMatches = _nullishCoalesce(options.maxMatches, () => ( 1e4));
|
|
5886
|
+
const cuts = [..._nullishCoalesce(options.cuts, () => ( [])), hay.length].sort((a, b) => a - b);
|
|
5887
|
+
const matches = [];
|
|
5888
|
+
let from = 0;
|
|
5889
|
+
for (const cut of cuts) {
|
|
5890
|
+
if (cut <= from) continue;
|
|
5891
|
+
let pos = from;
|
|
5892
|
+
from = cut;
|
|
5893
|
+
for (; ; ) {
|
|
5894
|
+
const m = pattern.exec(hay, pos, cut, budget);
|
|
5895
|
+
if (m === "budget") return { matches, truncated: true };
|
|
5896
|
+
if (!m) break;
|
|
5897
|
+
const empty = m.end === m.start;
|
|
5898
|
+
const next = empty ? m.end + (cpAt(hay, m.end) > 65535 ? 2 : 1) : m.end;
|
|
5899
|
+
if (next > cut) break;
|
|
5900
|
+
pos = next;
|
|
5901
|
+
if (empty) continue;
|
|
5902
|
+
matches.push(m);
|
|
5903
|
+
if (matches.length >= maxMatches) return { matches, truncated: true };
|
|
5904
|
+
}
|
|
5905
|
+
}
|
|
5906
|
+
return { matches, truncated: false };
|
|
5907
|
+
}
|
|
5908
|
+
function parseReplacement(replacement, options = {}) {
|
|
5909
|
+
if (options.literal || options.regex) return replacement ? [{ type: "text", text: replacement }] : [];
|
|
5910
|
+
const chars = toChars(replacement);
|
|
5911
|
+
const out = [];
|
|
5912
|
+
let cur = "";
|
|
5913
|
+
const flush = () => {
|
|
5914
|
+
if (cur) out.push({ type: "text", text: cur });
|
|
5915
|
+
cur = "";
|
|
5916
|
+
};
|
|
5917
|
+
let i = 0;
|
|
5918
|
+
while (i < chars.length) {
|
|
5919
|
+
const c = chars[i++];
|
|
5920
|
+
if (c === "\\" && options.wildcards && i < chars.length) {
|
|
5921
|
+
const d = chars[i];
|
|
5922
|
+
if (/[1-9]/.test(d)) {
|
|
5923
|
+
flush();
|
|
5924
|
+
out.push({ type: "group", index: Number(d) });
|
|
5925
|
+
} else {
|
|
5926
|
+
cur += d;
|
|
5927
|
+
}
|
|
5928
|
+
i++;
|
|
5929
|
+
continue;
|
|
5930
|
+
}
|
|
5931
|
+
if (c === "^" && i < chars.length) {
|
|
5932
|
+
const n = chars[i];
|
|
5933
|
+
if (n === "&" || n === "c") {
|
|
5934
|
+
flush();
|
|
5935
|
+
out.push(n === "&" ? { type: "found" } : { type: "clipboard" });
|
|
5936
|
+
i++;
|
|
5937
|
+
continue;
|
|
5938
|
+
}
|
|
5939
|
+
const code = replaceCode(n);
|
|
5940
|
+
if (code !== null) {
|
|
5941
|
+
cur += code;
|
|
5942
|
+
i++;
|
|
5943
|
+
continue;
|
|
5944
|
+
}
|
|
5945
|
+
const num = numericCode(chars, i);
|
|
5946
|
+
if (num) {
|
|
5947
|
+
cur += String.fromCodePoint(num.cp);
|
|
5948
|
+
i += num.used;
|
|
5949
|
+
continue;
|
|
5950
|
+
}
|
|
5951
|
+
}
|
|
5952
|
+
cur += c;
|
|
5953
|
+
}
|
|
5954
|
+
flush();
|
|
5955
|
+
return out;
|
|
5956
|
+
}
|
|
5957
|
+
function expandReplacement(pieces, match, clipboardText = "") {
|
|
5958
|
+
let out = "";
|
|
5959
|
+
for (const piece of pieces) {
|
|
5960
|
+
switch (piece.type) {
|
|
5961
|
+
case "text":
|
|
5962
|
+
out += piece.text;
|
|
5963
|
+
break;
|
|
5964
|
+
case "found":
|
|
5965
|
+
out += _nullishCoalesce(match.groups[0], () => ( ""));
|
|
5966
|
+
break;
|
|
5967
|
+
case "group":
|
|
5968
|
+
out += _nullishCoalesce(match.groups[piece.index], () => ( ""));
|
|
5969
|
+
break;
|
|
5970
|
+
case "clipboard":
|
|
5971
|
+
out += clipboardText.replace(/\r\n/g, "\r").replace(/\n/g, "\r");
|
|
5972
|
+
break;
|
|
5973
|
+
}
|
|
5974
|
+
}
|
|
5975
|
+
return out;
|
|
5976
|
+
}
|
|
5977
|
+
|
|
5978
|
+
// src/extensions/find-replace/search.ts
|
|
5979
|
+
var DELETION_MARK = "deletion";
|
|
5980
|
+
var DROPPED_REPLACEMENT_MARKS = /* @__PURE__ */ new Set([DELETION_MARK, "formatChange"]);
|
|
5981
|
+
var OBJECT_CHAR = "\uFFFC";
|
|
5982
|
+
function searchDocument(doc, query, options = {}, searchOptions = {}) {
|
|
5983
|
+
if (!query) return { matches: [], truncated: false, error: null };
|
|
5984
|
+
const compiled = compileFindPattern(query, options);
|
|
5985
|
+
if (!compiled.ok) return { matches: [], truncated: false, error: compiled.error };
|
|
5986
|
+
const pattern = compiled.pattern;
|
|
5987
|
+
const pieces = parseReplacement(_nullishCoalesce(searchOptions.replacement, () => ( "")), options);
|
|
5988
|
+
const budget = createSearchBudget({ timeLimitMs: searchOptions.timeLimitMs });
|
|
5989
|
+
const maxMatches = _nullishCoalesce(searchOptions.maxMatches, () => ( 1e4));
|
|
5990
|
+
const blocks = [];
|
|
5991
|
+
doc.descendants((node, pos, parent, index) => {
|
|
5992
|
+
if (!node.isTextblock) return true;
|
|
5993
|
+
blocks.push({ node, pos, parent, index });
|
|
5994
|
+
return false;
|
|
5995
|
+
});
|
|
5996
|
+
const chunks = [];
|
|
5997
|
+
blocks.forEach((block, i) => {
|
|
5998
|
+
const prev = blocks[i - 1];
|
|
5999
|
+
const joins = pattern.spansParagraphs && prev && prev.parent === block.parent && prev.index + 1 === block.index;
|
|
6000
|
+
if (joins) chunks[chunks.length - 1].push(block);
|
|
6001
|
+
else chunks.push([block]);
|
|
6002
|
+
});
|
|
6003
|
+
const matches = [];
|
|
6004
|
+
let truncated = false;
|
|
6005
|
+
for (const chunk of chunks) {
|
|
6006
|
+
let hay = "";
|
|
6007
|
+
const posOf = [];
|
|
6008
|
+
const endOf = [];
|
|
6009
|
+
const cuts = [];
|
|
6010
|
+
chunk.forEach((block, k) => {
|
|
6011
|
+
const contentStart = block.pos + 1;
|
|
6012
|
+
block.node.forEach((child, offset) => {
|
|
6013
|
+
const at = contentStart + offset;
|
|
6014
|
+
if (child.marks.some((m) => m.type.name === DELETION_MARK)) {
|
|
6015
|
+
if (cuts[cuts.length - 1] !== hay.length) cuts.push(hay.length);
|
|
6016
|
+
return;
|
|
6017
|
+
}
|
|
6018
|
+
if (child.isText) {
|
|
6019
|
+
const text = _nullishCoalesce(child.text, () => ( ""));
|
|
6020
|
+
for (let j = 0; j < text.length; j++) {
|
|
6021
|
+
posOf.push(at + j);
|
|
6022
|
+
endOf.push(at + j + 1);
|
|
6023
|
+
}
|
|
6024
|
+
hay += text;
|
|
6025
|
+
} else {
|
|
6026
|
+
posOf.push(at);
|
|
6027
|
+
endOf.push(at + child.nodeSize);
|
|
6028
|
+
hay += child.type.name === "hardBreak" ? "\n" : OBJECT_CHAR;
|
|
6029
|
+
}
|
|
6030
|
+
});
|
|
6031
|
+
const next = chunk[k + 1];
|
|
6032
|
+
if (next) {
|
|
6033
|
+
posOf.push(contentStart + block.node.content.size);
|
|
6034
|
+
endOf.push(next.pos + 1);
|
|
6035
|
+
hay += FIND_PARAGRAPH_MARK;
|
|
6036
|
+
}
|
|
6037
|
+
});
|
|
6038
|
+
if (!hay) continue;
|
|
6039
|
+
const result = findAllMatches(pattern, hay, {
|
|
6040
|
+
cuts,
|
|
6041
|
+
budget,
|
|
6042
|
+
maxMatches: maxMatches - matches.length
|
|
6043
|
+
});
|
|
6044
|
+
for (const m of result.matches) {
|
|
6045
|
+
matches.push({
|
|
6046
|
+
from: posOf[m.start],
|
|
6047
|
+
to: endOf[m.end - 1],
|
|
6048
|
+
text: _nullishCoalesce(m.groups[0], () => ( hay.slice(m.start, m.end))),
|
|
6049
|
+
replacement: expandReplacement(pieces, m, _nullishCoalesce(searchOptions.clipboardText, () => ( "")))
|
|
6050
|
+
});
|
|
6051
|
+
}
|
|
6052
|
+
if (result.truncated) {
|
|
6053
|
+
truncated = true;
|
|
6054
|
+
break;
|
|
6055
|
+
}
|
|
6056
|
+
}
|
|
6057
|
+
return { matches, truncated, error: null };
|
|
6058
|
+
}
|
|
6059
|
+
function replacementMarks(doc, from, to) {
|
|
6060
|
+
const $from = doc.resolve(from);
|
|
6061
|
+
const node = from < to ? $from.nodeAfter : null;
|
|
6062
|
+
const marks = node ? node.marks : $from.marks();
|
|
6063
|
+
return marks.filter((m) => !DROPPED_REPLACEMENT_MARKS.has(m.type.name));
|
|
6064
|
+
}
|
|
6065
|
+
function inlineContent(schema, text, marks) {
|
|
6066
|
+
const nodes = [];
|
|
6067
|
+
const hardBreak = schema.nodes.hardBreak;
|
|
6068
|
+
const parts = hardBreak ? text.split("\n") : [text];
|
|
6069
|
+
parts.forEach((part, i) => {
|
|
6070
|
+
if (i > 0) nodes.push(hardBreak.create(null, null, marks));
|
|
6071
|
+
if (part) nodes.push(schema.text(part, marks));
|
|
6072
|
+
});
|
|
6073
|
+
return nodes;
|
|
6074
|
+
}
|
|
6075
|
+
function applyReplacements(tr, matches) {
|
|
6076
|
+
const ends = new Array(matches.length);
|
|
6077
|
+
const schema = tr.doc.type.schema;
|
|
6078
|
+
for (let i = matches.length - 1; i >= 0; i--) {
|
|
6079
|
+
const { from, to, replacement } = matches[i];
|
|
6080
|
+
const marks = replacementMarks(tr.doc, from, to);
|
|
6081
|
+
const parts = replacement.split(/[\r\u2029]/);
|
|
6082
|
+
const stepsBefore = tr.steps.length;
|
|
6083
|
+
const first = inlineContent(schema, parts[0], marks);
|
|
6084
|
+
if (first.length) tr.replaceWith(from, to, first);
|
|
6085
|
+
else if (to > from) tr.delete(from, to);
|
|
6086
|
+
let pos = tr.mapping.slice(stepsBefore).map(to, 1);
|
|
6087
|
+
for (let k = 1; k < parts.length; k++) {
|
|
6088
|
+
tr.split(pos);
|
|
6089
|
+
pos += 2;
|
|
6090
|
+
const content = inlineContent(schema, parts[k], marks);
|
|
6091
|
+
if (content.length) {
|
|
6092
|
+
tr.insert(pos, content);
|
|
6093
|
+
pos += content.reduce((size, node) => size + node.nodeSize, 0);
|
|
6094
|
+
}
|
|
6095
|
+
}
|
|
6096
|
+
const map = tr.mapping.slice(stepsBefore);
|
|
6097
|
+
for (let j = i + 1; j < matches.length; j++) ends[j] = map.map(ends[j], 1);
|
|
6098
|
+
ends[i] = pos;
|
|
6099
|
+
}
|
|
6100
|
+
return ends;
|
|
6101
|
+
}
|
|
6102
|
+
|
|
6103
|
+
// src/extensions/find-replace/extension.ts
|
|
6104
|
+
var EMPTY_OPTIONS = Object.freeze({});
|
|
6105
|
+
var EMPTY_FIND_REPLACE_SNAPSHOT = Object.freeze({
|
|
6106
|
+
open: false,
|
|
6107
|
+
mode: "find",
|
|
6108
|
+
query: "",
|
|
6109
|
+
replacement: "",
|
|
6110
|
+
options: EMPTY_OPTIONS,
|
|
6111
|
+
matches: Object.freeze([]),
|
|
6112
|
+
currentIndex: -1,
|
|
6113
|
+
error: null,
|
|
6114
|
+
truncated: false,
|
|
6115
|
+
lastReplaceCount: null,
|
|
6116
|
+
focusRequest: 0
|
|
6117
|
+
});
|
|
6118
|
+
var FindReplaceStore = (_class4 = class {constructor() { _class4.prototype.__init6.call(this);_class4.prototype.__init7.call(this);_class4.prototype.__init8.call(this);_class4.prototype.__init9.call(this); }
|
|
6119
|
+
__init6() {this.snapshot = EMPTY_FIND_REPLACE_SNAPSHOT}
|
|
6120
|
+
__init7() {this.listeners = /* @__PURE__ */ new Set()}
|
|
6121
|
+
__init8() {this.subscribe = (listener) => {
|
|
6122
|
+
this.listeners.add(listener);
|
|
6123
|
+
listener(this.snapshot);
|
|
6124
|
+
return () => {
|
|
6125
|
+
this.listeners.delete(listener);
|
|
6126
|
+
};
|
|
6127
|
+
}}
|
|
6128
|
+
__init9() {this.getSnapshot = () => this.snapshot}
|
|
6129
|
+
/** @internal Called by the extension's plugin view. */
|
|
6130
|
+
set(snapshot) {
|
|
6131
|
+
if (snapshot === this.snapshot) return;
|
|
6132
|
+
this.snapshot = snapshot;
|
|
6133
|
+
this.listeners.forEach((listener) => {
|
|
6134
|
+
try {
|
|
6135
|
+
listener(snapshot);
|
|
6136
|
+
} catch (err) {
|
|
6137
|
+
console.error("[FindReplaceStore] Error in listener:", err);
|
|
6138
|
+
}
|
|
6139
|
+
});
|
|
6140
|
+
}
|
|
6141
|
+
}, _class4);
|
|
6142
|
+
var findReplacePluginKey = new (0, _state.PluginKey)("findReplace");
|
|
6143
|
+
function getFindReplaceState(source) {
|
|
6144
|
+
const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _176 => _176.state]), () => ( source));
|
|
6145
|
+
if (!state || typeof state.plugins === "undefined") return null;
|
|
6146
|
+
const plugin = findReplacePluginKey.getState(state);
|
|
6147
|
+
return plugin ? toSnapshot(plugin) : null;
|
|
6148
|
+
}
|
|
6149
|
+
function getFindReplaceStore(editor) {
|
|
6150
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _177 => _177.storage, 'optionalAccess', _178 => _178.findReplace, 'optionalAccess', _179 => _179.store]), () => ( null));
|
|
6151
|
+
}
|
|
6152
|
+
var snapshotCache = /* @__PURE__ */ new WeakMap();
|
|
6153
|
+
function toSnapshot(s) {
|
|
6154
|
+
let snapshot = snapshotCache.get(s);
|
|
6155
|
+
if (!snapshot) {
|
|
6156
|
+
snapshot = Object.freeze({
|
|
6157
|
+
open: s.open,
|
|
6158
|
+
mode: s.mode,
|
|
6159
|
+
query: s.query,
|
|
6160
|
+
replacement: s.replacement,
|
|
6161
|
+
options: s.options,
|
|
6162
|
+
matches: s.active ? s.matches : EMPTY_FIND_REPLACE_SNAPSHOT.matches,
|
|
6163
|
+
currentIndex: s.active ? s.currentIndex : -1,
|
|
6164
|
+
error: s.error,
|
|
6165
|
+
truncated: s.truncated,
|
|
6166
|
+
lastReplaceCount: s.lastReplaceCount,
|
|
6167
|
+
focusRequest: s.focusRequest
|
|
6168
|
+
});
|
|
6169
|
+
snapshotCache.set(s, snapshot);
|
|
6170
|
+
}
|
|
6171
|
+
return snapshot;
|
|
6172
|
+
}
|
|
6173
|
+
var FIND_OPTION_TOGGLES = Object.freeze([
|
|
6174
|
+
{ key: "matchCase", label: "Match case", short: "Aa", advanced: false },
|
|
6175
|
+
{ key: "wholeWord", label: "Whole words only", short: "ab", advanced: false },
|
|
6176
|
+
{ key: "wildcards", label: "Use wildcards", short: "*?", advanced: false },
|
|
6177
|
+
{ key: "regex", label: "Regular expression", short: ".*", advanced: false },
|
|
6178
|
+
{ key: "matchPrefix", label: "Match prefix", short: "ab-", advanced: true },
|
|
6179
|
+
{ key: "matchSuffix", label: "Match suffix", short: "-ab", advanced: true },
|
|
6180
|
+
{ key: "ignorePunctuation", label: "Ignore punctuation", short: ".,", advanced: true },
|
|
6181
|
+
{ key: "ignoreWhitespace", label: "Ignore white space", short: "_", advanced: true },
|
|
6182
|
+
{ key: "literal", label: "No special characters (^)", short: "^", advanced: true }
|
|
6183
|
+
]);
|
|
6184
|
+
function formatFindStatus(s) {
|
|
6185
|
+
if (!s.query) return "";
|
|
6186
|
+
if (s.error) return s.error.message;
|
|
6187
|
+
const n = s.matches.length;
|
|
6188
|
+
if (n === 0) return "No results";
|
|
6189
|
+
const total = s.truncated ? `${n}+` : `${n}`;
|
|
6190
|
+
return s.currentIndex >= 0 ? `${s.currentIndex + 1} of ${total}` : `${total} results`;
|
|
6191
|
+
}
|
|
6192
|
+
function indexFrom(matches, pos) {
|
|
6193
|
+
if (!matches.length) return -1;
|
|
6194
|
+
const i = matches.findIndex((m) => m.from >= pos);
|
|
6195
|
+
return i < 0 ? 0 : i;
|
|
6196
|
+
}
|
|
6197
|
+
function selectedQuery(state, maxLength) {
|
|
6198
|
+
const { from, to, $from, $to } = state.selection;
|
|
6199
|
+
if (from === to || !$from.sameParent($to)) return void 0;
|
|
6200
|
+
const text = state.doc.textBetween(from, to, "", "");
|
|
6201
|
+
return text && text.length <= maxLength && !/[\r\n]/.test(text) ? text : void 0;
|
|
6202
|
+
}
|
|
6203
|
+
var FindReplace = _core.Extension.create({
|
|
6204
|
+
name: "findReplace",
|
|
6205
|
+
addOptions() {
|
|
6206
|
+
return {
|
|
6207
|
+
shortcuts: true,
|
|
6208
|
+
matchClass: "pixerate-find-match",
|
|
6209
|
+
currentMatchClass: "pixerate-find-match-current",
|
|
6210
|
+
timeLimitMs: 250,
|
|
6211
|
+
maxMatches: 1e4,
|
|
6212
|
+
getClipboardText: () => "",
|
|
6213
|
+
maxPrefillLength: 256
|
|
6214
|
+
};
|
|
6215
|
+
},
|
|
6216
|
+
addStorage() {
|
|
6217
|
+
return { store: new FindReplaceStore() };
|
|
6218
|
+
},
|
|
6219
|
+
addCommands() {
|
|
6220
|
+
const meta = (tr, value) => tr.setMeta(findReplacePluginKey, value);
|
|
6221
|
+
const current = (state) => findReplacePluginKey.getState(state);
|
|
6222
|
+
const maxPrefill = () => this.options.maxPrefillLength;
|
|
6223
|
+
const select = (tr, match) => {
|
|
6224
|
+
tr.setSelection(_state.TextSelection.create(tr.doc, match.from, match.to)).scrollIntoView();
|
|
6225
|
+
};
|
|
6226
|
+
return {
|
|
6227
|
+
setSearch: (params) => ({ tr, state, dispatch }) => {
|
|
6228
|
+
if (!current(state)) return false;
|
|
6229
|
+
if (dispatch) meta(tr, { type: "set", params, anchor: state.selection.from });
|
|
6230
|
+
return true;
|
|
6231
|
+
},
|
|
6232
|
+
openFindReplace: (params = {}) => ({ tr, state, dispatch }) => {
|
|
6233
|
+
if (!current(state)) return false;
|
|
6234
|
+
if (dispatch) {
|
|
6235
|
+
meta(tr, {
|
|
6236
|
+
type: "open",
|
|
6237
|
+
mode: _nullishCoalesce(params.mode, () => ( "find")),
|
|
6238
|
+
query: _nullishCoalesce(params.query, () => ( selectedQuery(state, maxPrefill()))),
|
|
6239
|
+
anchor: state.selection.from
|
|
6240
|
+
});
|
|
6241
|
+
}
|
|
6242
|
+
return true;
|
|
6243
|
+
},
|
|
6244
|
+
closeFindReplace: () => ({ tr, state, dispatch }) => {
|
|
6245
|
+
if (!current(state)) return false;
|
|
6246
|
+
if (dispatch) meta(tr, { type: "close" });
|
|
6247
|
+
return true;
|
|
6248
|
+
},
|
|
6249
|
+
clearSearch: () => ({ tr, state, dispatch }) => {
|
|
6250
|
+
if (!current(state)) return false;
|
|
6251
|
+
if (dispatch) meta(tr, { type: "clear" });
|
|
6252
|
+
return true;
|
|
6253
|
+
},
|
|
6254
|
+
findNext: () => ({ tr, state, dispatch }) => {
|
|
6255
|
+
const s = current(state);
|
|
6256
|
+
if (!s || !s.active || !s.matches.length) return false;
|
|
6257
|
+
const { from, to } = state.selection;
|
|
6258
|
+
const cur = s.matches[s.currentIndex];
|
|
6259
|
+
const onCurrent = cur && cur.from === from && cur.to === to;
|
|
6260
|
+
const index = onCurrent ? (s.currentIndex + 1) % s.matches.length : indexFrom(s.matches, to);
|
|
6261
|
+
if (dispatch) {
|
|
6262
|
+
meta(tr, { type: "current", index });
|
|
6263
|
+
select(tr, s.matches[index]);
|
|
6264
|
+
}
|
|
6265
|
+
return true;
|
|
6266
|
+
},
|
|
6267
|
+
findPrevious: () => ({ tr, state, dispatch }) => {
|
|
6268
|
+
const s = current(state);
|
|
6269
|
+
if (!s || !s.active || !s.matches.length) return false;
|
|
6270
|
+
const { from, to } = state.selection;
|
|
6271
|
+
const n = s.matches.length;
|
|
6272
|
+
const cur = s.matches[s.currentIndex];
|
|
6273
|
+
const onCurrent = cur && cur.from === from && cur.to === to;
|
|
6274
|
+
let index;
|
|
6275
|
+
if (onCurrent) {
|
|
6276
|
+
index = (s.currentIndex - 1 + n) % n;
|
|
6277
|
+
} else {
|
|
6278
|
+
index = -1;
|
|
6279
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
6280
|
+
if (s.matches[i].to <= from) {
|
|
6281
|
+
index = i;
|
|
6282
|
+
break;
|
|
6283
|
+
}
|
|
6284
|
+
}
|
|
6285
|
+
if (index < 0) index = n - 1;
|
|
6286
|
+
}
|
|
6287
|
+
if (dispatch) {
|
|
6288
|
+
meta(tr, { type: "current", index });
|
|
6289
|
+
select(tr, s.matches[index]);
|
|
6290
|
+
}
|
|
6291
|
+
return true;
|
|
6292
|
+
},
|
|
6293
|
+
replaceCurrent: () => ({ tr, state, dispatch }) => {
|
|
6294
|
+
const s = current(state);
|
|
6295
|
+
if (!s || !s.active || s.currentIndex < 0 || !s.matches[s.currentIndex]) return false;
|
|
6296
|
+
if (dispatch) {
|
|
6297
|
+
_history.closeHistory.call(void 0, tr);
|
|
6298
|
+
const [end] = applyReplacements(tr, [s.matches[s.currentIndex]]);
|
|
6299
|
+
tr.setSelection(_state.TextSelection.create(tr.doc, end)).scrollIntoView();
|
|
6300
|
+
meta(tr, { type: "replaced", anchor: end, count: 1 });
|
|
6301
|
+
}
|
|
6302
|
+
return true;
|
|
6303
|
+
},
|
|
6304
|
+
replaceAll: () => ({ tr, state, dispatch }) => {
|
|
6305
|
+
const s = current(state);
|
|
6306
|
+
if (!s || !s.active || !s.matches.length) return false;
|
|
6307
|
+
if (dispatch) {
|
|
6308
|
+
_history.closeHistory.call(void 0, tr);
|
|
6309
|
+
const ends = applyReplacements(tr, s.matches);
|
|
6310
|
+
meta(tr, { type: "replaced", anchor: ends[ends.length - 1], count: s.matches.length });
|
|
6311
|
+
}
|
|
6312
|
+
return true;
|
|
6313
|
+
}
|
|
6314
|
+
};
|
|
6315
|
+
},
|
|
6316
|
+
addKeyboardShortcuts() {
|
|
6317
|
+
if (!this.options.shortcuts) return {};
|
|
6318
|
+
const open = (mode) => () => this.editor.commands.openFindReplace({ mode });
|
|
6319
|
+
const step = (forward) => () => {
|
|
6320
|
+
const s = findReplacePluginKey.getState(this.editor.state);
|
|
6321
|
+
if (!_optionalChain([s, 'optionalAccess', _180 => _180.active]) || !s.matches.length) return false;
|
|
6322
|
+
return forward ? this.editor.commands.findNext() : this.editor.commands.findPrevious();
|
|
6323
|
+
};
|
|
6324
|
+
return {
|
|
6325
|
+
"Mod-f": open("find"),
|
|
6326
|
+
"Mod-h": open("replace"),
|
|
6327
|
+
"Mod-Shift-h": open("replace"),
|
|
6328
|
+
F3: step(true),
|
|
6329
|
+
"Shift-F3": step(false),
|
|
6330
|
+
"Mod-g": step(true),
|
|
6331
|
+
"Mod-Shift-g": step(false)
|
|
6332
|
+
};
|
|
6333
|
+
},
|
|
6334
|
+
addProseMirrorPlugins() {
|
|
6335
|
+
const options = this.options;
|
|
6336
|
+
const store = this.storage.store;
|
|
6337
|
+
const search = (s, doc) => {
|
|
6338
|
+
if (!s.active || !s.query) {
|
|
6339
|
+
return { ...s, matches: [], currentIndex: -1, error: null, truncated: false };
|
|
6340
|
+
}
|
|
6341
|
+
const result = searchDocument(doc, s.query, s.options, {
|
|
6342
|
+
replacement: s.replacement,
|
|
6343
|
+
clipboardText: safeClipboard(options.getClipboardText),
|
|
6344
|
+
timeLimitMs: options.timeLimitMs,
|
|
6345
|
+
maxMatches: options.maxMatches
|
|
6346
|
+
});
|
|
6347
|
+
return {
|
|
6348
|
+
...s,
|
|
6349
|
+
matches: result.matches,
|
|
6350
|
+
currentIndex: indexFrom(result.matches, s.anchor),
|
|
6351
|
+
error: result.error,
|
|
6352
|
+
truncated: result.truncated
|
|
6353
|
+
};
|
|
6354
|
+
};
|
|
6355
|
+
const decorate = (s, doc) => {
|
|
6356
|
+
if (!s.active || !s.matches.length) return { ...s, decorations: _view2.DecorationSet.empty };
|
|
6357
|
+
const decorations = s.matches.map(
|
|
6358
|
+
(m, i) => _view2.Decoration.inline(m.from, m.to, {
|
|
6359
|
+
class: i === s.currentIndex ? `${options.matchClass} ${options.currentMatchClass}` : options.matchClass
|
|
6360
|
+
})
|
|
6361
|
+
);
|
|
6362
|
+
return { ...s, decorations: _view2.DecorationSet.create(doc, decorations) };
|
|
6363
|
+
};
|
|
6364
|
+
return [
|
|
6365
|
+
new (0, _state.Plugin)({
|
|
6366
|
+
key: findReplacePluginKey,
|
|
6367
|
+
state: {
|
|
6368
|
+
init: () => ({
|
|
6369
|
+
active: false,
|
|
6370
|
+
open: false,
|
|
6371
|
+
mode: "find",
|
|
6372
|
+
query: "",
|
|
6373
|
+
replacement: "",
|
|
6374
|
+
options: EMPTY_OPTIONS,
|
|
6375
|
+
matches: [],
|
|
6376
|
+
currentIndex: -1,
|
|
6377
|
+
anchor: 0,
|
|
6378
|
+
error: null,
|
|
6379
|
+
truncated: false,
|
|
6380
|
+
lastReplaceCount: null,
|
|
6381
|
+
focusRequest: 0,
|
|
6382
|
+
decorations: _view2.DecorationSet.empty
|
|
6383
|
+
}),
|
|
6384
|
+
apply: (tr, prev, _oldState, newState) => {
|
|
6385
|
+
const m = tr.getMeta(findReplacePluginKey);
|
|
6386
|
+
if (!m && !tr.docChanged) return prev;
|
|
6387
|
+
let s = prev;
|
|
6388
|
+
let research = false;
|
|
6389
|
+
let redecorate = false;
|
|
6390
|
+
if (tr.docChanged) {
|
|
6391
|
+
s = { ...s, anchor: tr.mapping.map(s.anchor) };
|
|
6392
|
+
research = s.active;
|
|
6393
|
+
}
|
|
6394
|
+
if (m) {
|
|
6395
|
+
switch (m.type) {
|
|
6396
|
+
case "set": {
|
|
6397
|
+
const p = m.params;
|
|
6398
|
+
s = {
|
|
6399
|
+
...s,
|
|
6400
|
+
active: true,
|
|
6401
|
+
query: _nullishCoalesce(p.query, () => ( s.query)),
|
|
6402
|
+
replacement: _nullishCoalesce(p.replacement, () => ( s.replacement)),
|
|
6403
|
+
options: p.options ? Object.freeze({ ...s.options, ...p.options }) : s.options,
|
|
6404
|
+
anchor: m.anchor,
|
|
6405
|
+
lastReplaceCount: null
|
|
6406
|
+
};
|
|
6407
|
+
research = true;
|
|
6408
|
+
break;
|
|
6409
|
+
}
|
|
6410
|
+
case "open":
|
|
6411
|
+
s = {
|
|
6412
|
+
...s,
|
|
6413
|
+
active: true,
|
|
6414
|
+
open: true,
|
|
6415
|
+
mode: m.mode,
|
|
6416
|
+
query: _nullishCoalesce(m.query, () => ( s.query)),
|
|
6417
|
+
anchor: m.anchor,
|
|
6418
|
+
focusRequest: s.focusRequest + 1
|
|
6419
|
+
};
|
|
6420
|
+
research = true;
|
|
6421
|
+
break;
|
|
6422
|
+
case "close":
|
|
6423
|
+
s = { ...s, open: false, active: false };
|
|
6424
|
+
research = true;
|
|
6425
|
+
break;
|
|
6426
|
+
case "clear":
|
|
6427
|
+
s = { ...s, active: false, query: "", lastReplaceCount: null };
|
|
6428
|
+
research = true;
|
|
6429
|
+
break;
|
|
6430
|
+
case "current":
|
|
6431
|
+
s = {
|
|
6432
|
+
...s,
|
|
6433
|
+
currentIndex: m.index,
|
|
6434
|
+
anchor: _nullishCoalesce(_optionalChain([s, 'access', _181 => _181.matches, 'access', _182 => _182[m.index], 'optionalAccess', _183 => _183.from]), () => ( s.anchor))
|
|
6435
|
+
};
|
|
6436
|
+
redecorate = true;
|
|
6437
|
+
break;
|
|
6438
|
+
case "replaced":
|
|
6439
|
+
s = { ...s, anchor: m.anchor, lastReplaceCount: m.count };
|
|
6440
|
+
research = true;
|
|
6441
|
+
break;
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
if (research) s = search(s, newState.doc);
|
|
6445
|
+
if (research || redecorate) s = decorate(s, newState.doc);
|
|
6446
|
+
return s;
|
|
6447
|
+
}
|
|
6448
|
+
},
|
|
6449
|
+
props: {
|
|
6450
|
+
decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _184 => _184.getState, 'call', _185 => _185(state), 'optionalAccess', _186 => _186.decorations]), () => ( _view2.DecorationSet.empty))
|
|
6451
|
+
},
|
|
6452
|
+
view: (view) => {
|
|
6453
|
+
const sync = () => {
|
|
6454
|
+
const s = findReplacePluginKey.getState(view.state);
|
|
6455
|
+
if (s) store.set(toSnapshot(s));
|
|
6456
|
+
};
|
|
6457
|
+
sync();
|
|
6458
|
+
return { update: sync };
|
|
6459
|
+
}
|
|
6460
|
+
})
|
|
6461
|
+
];
|
|
6462
|
+
}
|
|
6463
|
+
});
|
|
6464
|
+
function safeClipboard(get) {
|
|
6465
|
+
try {
|
|
6466
|
+
return String(_nullishCoalesce(get(), () => ( "")));
|
|
6467
|
+
} catch (e5) {
|
|
6468
|
+
return "";
|
|
6469
|
+
}
|
|
6470
|
+
}
|
|
6471
|
+
|
|
5172
6472
|
// src/extensions/rich-text-preset.ts
|
|
5173
|
-
var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess',
|
|
6473
|
+
var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _187 => _187[name]]) || _optionalChain([mod, 'optionalAccess', _188 => _188.default, 'optionalAccess', _189 => _189[name]]) || _optionalChain([mod, 'optionalAccess', _190 => _190.default, 'optionalAccess', _191 => _191.default]) || _optionalChain([mod, 'optionalAccess', _192 => _192.default]) || mod;
|
|
5174
6474
|
var StarterKit = resolveExt3(_StarterKit, "StarterKit");
|
|
5175
6475
|
var Color = resolveExt3(_Color, "Color");
|
|
5176
6476
|
var Highlight = resolveExt3(_Highlight, "Highlight");
|
|
@@ -5251,7 +6551,7 @@ function createRichTextPreset(options = {}) {
|
|
|
5251
6551
|
find: /^\s*(\[([ |x])?\])\s$/i,
|
|
5252
6552
|
type: this.type,
|
|
5253
6553
|
getAttributes: (match) => ({
|
|
5254
|
-
checked: _optionalChain([match, 'access',
|
|
6554
|
+
checked: _optionalChain([match, 'access', _193 => _193[2], 'optionalAccess', _194 => _194.toLowerCase, 'call', _195 => _195()]) === "x"
|
|
5255
6555
|
})
|
|
5256
6556
|
})
|
|
5257
6557
|
];
|
|
@@ -5325,7 +6625,8 @@ function createRichTextPreset(options = {}) {
|
|
|
5325
6625
|
}
|
|
5326
6626
|
if (options.trackChanges) {
|
|
5327
6627
|
extensions2.push(
|
|
5328
|
-
typeof options.trackChanges === "object" ?
|
|
6628
|
+
typeof options.trackChanges === "object" ? _chunkD27YFC46cjs.TrackChanges.configure(options.trackChanges) : _chunkD27YFC46cjs.TrackChanges,
|
|
6629
|
+
DocumentCompare
|
|
5329
6630
|
);
|
|
5330
6631
|
}
|
|
5331
6632
|
if (options.fileImport) {
|
|
@@ -5364,9 +6665,172 @@ function createRichTextPreset(options = {}) {
|
|
|
5364
6665
|
if (options.crossReferences) {
|
|
5365
6666
|
extensions2.push(CrossReference.configure(optionObject(options.crossReferences)));
|
|
5366
6667
|
}
|
|
6668
|
+
if (options.findReplace) {
|
|
6669
|
+
extensions2.push(FindReplace.configure(optionObject(options.findReplace)));
|
|
6670
|
+
}
|
|
5367
6671
|
return extensions2;
|
|
5368
6672
|
}
|
|
5369
6673
|
|
|
6674
|
+
// src/extensions/find-replace/commands.ts
|
|
6675
|
+
var OPTION_KEYS = [
|
|
6676
|
+
"matchCase",
|
|
6677
|
+
"wholeWord",
|
|
6678
|
+
"matchPrefix",
|
|
6679
|
+
"matchSuffix",
|
|
6680
|
+
"ignorePunctuation",
|
|
6681
|
+
"ignoreWhitespace",
|
|
6682
|
+
"wildcards",
|
|
6683
|
+
"regex",
|
|
6684
|
+
"literal"
|
|
6685
|
+
];
|
|
6686
|
+
var searchParams = (withReplacement) => ({
|
|
6687
|
+
type: "object",
|
|
6688
|
+
properties: {
|
|
6689
|
+
query: { type: "string", description: "Find what. Word ^ codes (^p, ^t, ^#) unless literal." },
|
|
6690
|
+
...withReplacement ? {
|
|
6691
|
+
replacement: {
|
|
6692
|
+
type: "string",
|
|
6693
|
+
description: "Replace with. ^& is the found text; with wildcards, \\1-\\9 are groups."
|
|
6694
|
+
}
|
|
6695
|
+
} : {},
|
|
6696
|
+
...Object.fromEntries(OPTION_KEYS.map((key) => [key, { type: "boolean" }]))
|
|
6697
|
+
},
|
|
6698
|
+
additionalProperties: false
|
|
6699
|
+
});
|
|
6700
|
+
function splitParams(params) {
|
|
6701
|
+
if (!params) return null;
|
|
6702
|
+
const options = {};
|
|
6703
|
+
for (const key of OPTION_KEYS) if (params[key] !== void 0) options[key] = params[key];
|
|
6704
|
+
return {
|
|
6705
|
+
...params.query !== void 0 ? { query: params.query } : {},
|
|
6706
|
+
...params.replacement !== void 0 ? { replacement: params.replacement } : {},
|
|
6707
|
+
options
|
|
6708
|
+
};
|
|
6709
|
+
}
|
|
6710
|
+
var usable = (editor) => !editor.isDestroyed && findReplacePluginKey.getState(editor.state) ? true : "Find and Replace is not available.";
|
|
6711
|
+
function createFindReplaceCommands(editor, options = {}) {
|
|
6712
|
+
const prefix = _nullishCoalesce(options.prefix, () => ( "findReplace."));
|
|
6713
|
+
const group = _nullishCoalesce(options.group, () => ( "Edit"));
|
|
6714
|
+
const scope = options.scope ? { scope: options.scope } : {};
|
|
6715
|
+
const state = () => getFindReplaceState(editor);
|
|
6716
|
+
const hasMatches = () => {
|
|
6717
|
+
const ok = usable(editor);
|
|
6718
|
+
if (ok !== true) return ok;
|
|
6719
|
+
return _optionalChain([state, 'call', _196 => _196(), 'optionalAccess', _197 => _197.matches, 'access', _198 => _198.length]) ? true : "No matches.";
|
|
6720
|
+
};
|
|
6721
|
+
const apply = (params) => {
|
|
6722
|
+
const split = splitParams(params);
|
|
6723
|
+
if (split) editor.commands.setSearch(split);
|
|
6724
|
+
};
|
|
6725
|
+
const failIfInvalid = () => {
|
|
6726
|
+
const s = state();
|
|
6727
|
+
if (_optionalChain([s, 'optionalAccess', _199 => _199.error])) throw new Error(s.error.message);
|
|
6728
|
+
};
|
|
6729
|
+
return [
|
|
6730
|
+
{
|
|
6731
|
+
id: `${prefix}open`,
|
|
6732
|
+
label: "Find",
|
|
6733
|
+
group,
|
|
6734
|
+
keywords: ["search", "find"],
|
|
6735
|
+
description: "Shows the find bar.",
|
|
6736
|
+
...options.shortcuts ? { shortcut: "Mod+F" } : {},
|
|
6737
|
+
...scope,
|
|
6738
|
+
enabled: () => usable(editor),
|
|
6739
|
+
run: () => editor.commands.openFindReplace({ mode: "find" })
|
|
6740
|
+
},
|
|
6741
|
+
{
|
|
6742
|
+
id: `${prefix}openReplace`,
|
|
6743
|
+
label: "Replace",
|
|
6744
|
+
group,
|
|
6745
|
+
keywords: ["search", "substitute"],
|
|
6746
|
+
description: "Shows the find bar with the replace field.",
|
|
6747
|
+
...options.shortcuts ? { shortcut: "Mod+H" } : {},
|
|
6748
|
+
...scope,
|
|
6749
|
+
enabled: () => usable(editor),
|
|
6750
|
+
run: () => editor.commands.openFindReplace({ mode: "replace" })
|
|
6751
|
+
},
|
|
6752
|
+
{
|
|
6753
|
+
id: `${prefix}find`,
|
|
6754
|
+
label: "Find text",
|
|
6755
|
+
group,
|
|
6756
|
+
description: "Searches the document and returns the number of matches.",
|
|
6757
|
+
params: searchParams(false),
|
|
6758
|
+
readOnly: true,
|
|
6759
|
+
...scope,
|
|
6760
|
+
enabled: () => usable(editor),
|
|
6761
|
+
run: (_ctx, params) => {
|
|
6762
|
+
apply(params);
|
|
6763
|
+
failIfInvalid();
|
|
6764
|
+
const s = state();
|
|
6765
|
+
return {
|
|
6766
|
+
count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _200 => _200.matches, 'access', _201 => _201.length]), () => ( 0)),
|
|
6767
|
+
truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _202 => _202.truncated]), () => ( false)),
|
|
6768
|
+
matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _203 => _203.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
|
|
6769
|
+
};
|
|
6770
|
+
}
|
|
6771
|
+
},
|
|
6772
|
+
{
|
|
6773
|
+
id: `${prefix}next`,
|
|
6774
|
+
label: "Find next",
|
|
6775
|
+
group,
|
|
6776
|
+
...scope,
|
|
6777
|
+
enabled: hasMatches,
|
|
6778
|
+
run: () => editor.commands.findNext()
|
|
6779
|
+
},
|
|
6780
|
+
{
|
|
6781
|
+
id: `${prefix}previous`,
|
|
6782
|
+
label: "Find previous",
|
|
6783
|
+
group,
|
|
6784
|
+
...scope,
|
|
6785
|
+
enabled: hasMatches,
|
|
6786
|
+
run: () => editor.commands.findPrevious()
|
|
6787
|
+
},
|
|
6788
|
+
{
|
|
6789
|
+
id: `${prefix}replaceAll`,
|
|
6790
|
+
label: "Replace all",
|
|
6791
|
+
group,
|
|
6792
|
+
description: "Replaces every match (one undo step). Tracked when Track Changes is on.",
|
|
6793
|
+
params: searchParams(true),
|
|
6794
|
+
...scope,
|
|
6795
|
+
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _204 => _204.query]) !== void 0 ? usable(editor) : hasMatches(),
|
|
6796
|
+
run: (_ctx, params) => {
|
|
6797
|
+
apply(params);
|
|
6798
|
+
failIfInvalid();
|
|
6799
|
+
const count = _nullishCoalesce(_optionalChain([state, 'call', _205 => _205(), 'optionalAccess', _206 => _206.matches, 'access', _207 => _207.length]), () => ( 0));
|
|
6800
|
+
if (count) editor.commands.replaceAll();
|
|
6801
|
+
return { replaced: count };
|
|
6802
|
+
}
|
|
6803
|
+
}
|
|
6804
|
+
];
|
|
6805
|
+
}
|
|
6806
|
+
function validateFindPattern(query, options = {}) {
|
|
6807
|
+
const result = compileFindPattern(query, options);
|
|
6808
|
+
return result.ok ? null : result.error;
|
|
6809
|
+
}
|
|
6810
|
+
|
|
6811
|
+
|
|
6812
|
+
|
|
6813
|
+
|
|
6814
|
+
|
|
6815
|
+
|
|
6816
|
+
|
|
6817
|
+
|
|
6818
|
+
|
|
6819
|
+
|
|
6820
|
+
|
|
6821
|
+
|
|
6822
|
+
|
|
6823
|
+
|
|
6824
|
+
|
|
6825
|
+
|
|
6826
|
+
|
|
6827
|
+
|
|
6828
|
+
|
|
6829
|
+
|
|
6830
|
+
|
|
6831
|
+
|
|
6832
|
+
|
|
6833
|
+
|
|
5370
6834
|
|
|
5371
6835
|
|
|
5372
6836
|
|
|
@@ -5468,5 +6932,5 @@ function createRichTextPreset(options = {}) {
|
|
|
5468
6932
|
|
|
5469
6933
|
|
|
5470
6934
|
|
|
5471
|
-
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.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.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.createRichTextPreset = createRichTextPreset;
|
|
5472
|
-
//# sourceMappingURL=chunk-
|
|
6935
|
+
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.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.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern;
|
|
6936
|
+
//# sourceMappingURL=chunk-SBCZ6RN5.cjs.map
|