@pixerate/editor 0.46.1 → 0.48.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/THIRD_PARTY_NOTICES.md +20 -0
- package/dist/agent/index.cjs +252 -34
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +19 -7
- package/dist/agent/index.d.ts +19 -7
- package/dist/agent/index.js +228 -10
- package/dist/agent/index.js.map +1 -1
- package/dist/{builtins-CZW-aYKS.d.cts → builtins-1kqwLUnb.d.cts} +2 -2
- package/dist/{builtins-DghNQbT-.d.ts → builtins-BKYlHH1s.d.ts} +2 -2
- package/dist/chart/index.cjs +1596 -1849
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +760 -548
- package/dist/chart/index.d.ts +760 -548
- package/dist/chart/index.js +1499 -1752
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-3RPOW4CS.js → chunk-2CJ3LPYQ.js} +12 -10
- package/dist/{chunk-3RPOW4CS.js.map → chunk-2CJ3LPYQ.js.map} +1 -1
- package/dist/{chunk-PQM5W7ZN.js → chunk-4FX5ACVG.js} +29 -2
- package/dist/{chunk-PQM5W7ZN.js.map → chunk-4FX5ACVG.js.map} +1 -1
- package/dist/{chunk-HHQ4XJWT.js → chunk-AMWXSYCI.js} +2 -2
- package/dist/chunk-EKYHKQPG.js +1895 -0
- package/dist/chunk-EKYHKQPG.js.map +1 -0
- package/dist/chunk-HXUL3LS7.js +113 -0
- package/dist/chunk-HXUL3LS7.js.map +1 -0
- package/dist/{chunk-ZRNHGAQT.js → chunk-JQ3BB3E6.js} +43 -1891
- package/dist/chunk-JQ3BB3E6.js.map +1 -0
- package/dist/chunk-LTUM52X6.js +4074 -0
- package/dist/chunk-LTUM52X6.js.map +1 -0
- package/dist/{chunk-J3R2OWOE.cjs → chunk-MUCYWI6W.cjs} +608 -15
- package/dist/chunk-MUCYWI6W.cjs.map +1 -0
- package/dist/chunk-PIMCHMZE.cjs +521 -0
- package/dist/chunk-PIMCHMZE.cjs.map +1 -0
- package/dist/{chunk-TK2XZK6Z.js → chunk-PKBWLEL7.js} +594 -1
- package/dist/chunk-PKBWLEL7.js.map +1 -0
- package/dist/chunk-PRSJJZBS.cjs +4074 -0
- package/dist/chunk-PRSJJZBS.cjs.map +1 -0
- package/dist/{chunk-EFDCLENW.cjs → chunk-RIWPYSKU.cjs} +29 -2
- package/dist/chunk-RIWPYSKU.cjs.map +1 -0
- package/dist/chunk-U6IZKC7B.cjs +113 -0
- package/dist/chunk-U6IZKC7B.cjs.map +1 -0
- package/dist/{chunk-EWCOFSCQ.cjs → chunk-UN33YOXW.cjs} +252 -2100
- package/dist/chunk-UN33YOXW.cjs.map +1 -0
- package/dist/{chunk-Q25ZS4F7.js → chunk-VKPEPWKZ.js} +72 -92
- package/dist/chunk-VKPEPWKZ.js.map +1 -0
- package/dist/{chunk-N4MLNJPO.cjs → chunk-WXEHCVJQ.cjs} +160 -180
- package/dist/chunk-WXEHCVJQ.cjs.map +1 -0
- package/dist/{chunk-K2LVZ4FA.cjs → chunk-XFYUFVAX.cjs} +3 -3
- package/dist/{chunk-K2LVZ4FA.cjs.map → chunk-XFYUFVAX.cjs.map} +1 -1
- package/dist/chunk-XP5IUZUO.cjs +1895 -0
- package/dist/chunk-XP5IUZUO.cjs.map +1 -0
- package/dist/chunk-XUUD43OV.js +521 -0
- package/dist/chunk-XUUD43OV.js.map +1 -0
- package/dist/{chunk-U7VGDSNY.cjs → chunk-YU4WQE5M.cjs} +101 -99
- package/dist/chunk-YU4WQE5M.cjs.map +1 -0
- package/dist/commands/index.cjs +93 -11
- package/dist/commands/index.cjs.map +1 -1
- package/dist/commands/index.d.cts +9 -7
- package/dist/commands/index.d.ts +9 -7
- package/dist/commands/index.js +92 -10
- package/dist/commands/index.js.map +1 -1
- package/dist/controller-ChjCCMLl.d.cts +822 -0
- package/dist/controller-DtbEo3om.d.ts +822 -0
- package/dist/extensions/index.cjs +32 -3
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +5 -2
- package/dist/extensions/index.d.ts +5 -2
- package/dist/extensions/index.js +31 -2
- package/dist/generation/index.cjs +2 -2
- package/dist/generation/index.js +1 -1
- package/dist/{index-CfOQf70b.d.cts → index-DoHqT1mq.d.cts} +222 -5
- package/dist/{index-jwJ_onWf.d.ts → index-YLZ0fKqE.d.ts} +222 -5
- package/dist/index.cjs +38 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +52 -24
- package/dist/index.js.map +1 -1
- package/dist/parameters/index.d.cts +1 -1
- package/dist/parameters/index.d.ts +1 -1
- package/dist/{registry-vz6HOiiy.d.cts → registry-CaR7LC6W.d.cts} +2 -0
- package/dist/{registry-BfVD-vVg.d.ts → registry-rVtFJjRM.d.ts} +2 -0
- package/dist/spreadsheet/index.cjs +5 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.js +24 -22
- package/dist/tools/index.cjs +3 -3
- package/dist/tools/index.js +2 -2
- package/dist/vector/index.d.cts +1 -1
- package/dist/vector/index.d.ts +1 -1
- package/package.json +2 -1
- package/dist/chunk-EFDCLENW.cjs.map +0 -1
- package/dist/chunk-EWCOFSCQ.cjs.map +0 -1
- package/dist/chunk-J3R2OWOE.cjs.map +0 -1
- package/dist/chunk-N4MLNJPO.cjs.map +0 -1
- package/dist/chunk-Q25ZS4F7.js.map +0 -1
- package/dist/chunk-TK2XZK6Z.js.map +0 -1
- package/dist/chunk-U7VGDSNY.cjs.map +0 -1
- package/dist/chunk-ZRNHGAQT.js.map +0 -1
- /package/dist/{chunk-HHQ4XJWT.js.map → chunk-AMWXSYCI.js.map} +0 -0
|
@@ -8,6 +8,7 @@ var _chunk3CC7OPUQcjs = require('./chunk-3CC7OPUQ.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
var _chunkPIMCHMZEcjs = require('./chunk-PIMCHMZE.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
|
|
@@ -20,7 +21,21 @@ var _chunk3CC7OPUQcjs = require('./chunk-3CC7OPUQ.cjs');
|
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
var _chunkMUCYWI6Wcjs = require('./chunk-MUCYWI6W.cjs');
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
var _chunkPRSJJZBScjs = require('./chunk-PRSJJZBS.cjs');
|
|
24
39
|
|
|
25
40
|
|
|
26
41
|
var _chunkCS6NZWWAcjs = require('./chunk-CS6NZWWA.cjs');
|
|
@@ -2442,6 +2457,36 @@ function toBase64(bytes) {
|
|
|
2442
2457
|
}
|
|
2443
2458
|
return btoa(binary);
|
|
2444
2459
|
}
|
|
2460
|
+
async function loadCharts(zip, Parser, root, rels, options) {
|
|
2461
|
+
const charts = /* @__PURE__ */ new Map();
|
|
2462
|
+
if (options.charts === false) return charts;
|
|
2463
|
+
for (const el of descendants(root, "chart")) {
|
|
2464
|
+
if (el.namespaceURI !== _chunkPIMCHMZEcjs.CHART_OOXML_NS) continue;
|
|
2465
|
+
const id = attr(el, "id");
|
|
2466
|
+
const rel = id ? rels.get(id) : void 0;
|
|
2467
|
+
if (!id || !rel || rel.external || charts.has(id)) continue;
|
|
2468
|
+
const entry = zip.get(rel.target);
|
|
2469
|
+
if (!entry) continue;
|
|
2470
|
+
const read = _chunkPIMCHMZEcjs.chartFromOoxml.call(void 0, await zip.readText(entry), { DOMParser: Parser });
|
|
2471
|
+
charts.set(id, {
|
|
2472
|
+
id: `chart-${charts.size + 1}`,
|
|
2473
|
+
path: rel.target,
|
|
2474
|
+
title: read.spec.title,
|
|
2475
|
+
spec: read.spec,
|
|
2476
|
+
issues: read.issues.map((i) => i.message),
|
|
2477
|
+
unsupported: read.unsupported,
|
|
2478
|
+
lossless: read.lossless
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
return charts;
|
|
2482
|
+
}
|
|
2483
|
+
function chartBlockHtml(chart) {
|
|
2484
|
+
const [head, ...rows] = _chunkPRSJJZBScjs.chartDataToTable.call(void 0, chart.spec);
|
|
2485
|
+
const cell = (v, tag) => `<${tag}><p>${_chunk66IMF6ODcjs.escapeHtml.call(void 0, v === null || v === void 0 ? "" : String(v))}</p></${tag}>`;
|
|
2486
|
+
const table = `<table><tbody><tr>${head.map((h) => cell(h, "th")).join("")}</tr>${rows.map((r) => `<tr>${r.map((v, i) => cell(v, i ? "td" : "th")).join("")}</tr>`).join("")}</tbody></table>`;
|
|
2487
|
+
const caption = `<p>${_chunk66IMF6ODcjs.escapeHtml.call(void 0, `[Chart: ${chart.title || "untitled"}]`)}</p>`;
|
|
2488
|
+
return `<div data-type="chart" data-chart-id="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, chart.id)}" data-chart="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, JSON.stringify(chart.spec))}">${caption}${table}</div>`;
|
|
2489
|
+
}
|
|
2445
2490
|
async function loadImages(zip, root, rels, options) {
|
|
2446
2491
|
const images = /* @__PURE__ */ new Map();
|
|
2447
2492
|
if (options.images === false) return images;
|
|
@@ -2910,6 +2955,7 @@ function renderSegments(segments, code = false) {
|
|
|
2910
2955
|
if (seg.kind === "text") inner += _chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.text);
|
|
2911
2956
|
else if (seg.kind === "br") inner += code ? "\n" : "<br>";
|
|
2912
2957
|
else if (seg.kind === "img") inner += code ? "" : `<img src="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.src)}" alt="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, seg.alt)}">`;
|
|
2958
|
+
else if (seg.kind === "chart") inner += code ? _chunk66IMF6ODcjs.escapeHtml.call(void 0, `[Chart: ${seg.chart.title || "untitled"}]`) : "";
|
|
2913
2959
|
else inner += `<sup>${seg.n}</sup>`;
|
|
2914
2960
|
}
|
|
2915
2961
|
const format = segments[i].format;
|
|
@@ -2929,7 +2975,7 @@ function parseHyperlinkInstruction(instr) {
|
|
|
2929
2975
|
return anchor ? `#${anchor}` : void 0;
|
|
2930
2976
|
}
|
|
2931
2977
|
var ParagraphRenderer = (_class2 = class {
|
|
2932
|
-
constructor(ctx, part) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);
|
|
2978
|
+
constructor(ctx, part) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);
|
|
2933
2979
|
this.ctx = ctx;
|
|
2934
2980
|
this.part = part;
|
|
2935
2981
|
}
|
|
@@ -3088,7 +3134,7 @@ var ParagraphRenderer = (_class2 = class {
|
|
|
3088
3134
|
};
|
|
3089
3135
|
if (child.localName === "AlternateContent") {
|
|
3090
3136
|
const branch = childElements(child).find(
|
|
3091
|
-
(b) => descendants(b, "blip").length || descendants(b, "imagedata").length
|
|
3137
|
+
(b) => descendants(b, "blip").length || descendants(b, "imagedata").length || descendants(b, "chart").some((el) => el.namespaceURI === _chunkPIMCHMZEcjs.CHART_OOXML_NS)
|
|
3092
3138
|
);
|
|
3093
3139
|
if (branch) this.image(branch, format, push);
|
|
3094
3140
|
return;
|
|
@@ -3152,7 +3198,17 @@ var ParagraphRenderer = (_class2 = class {
|
|
|
3152
3198
|
break;
|
|
3153
3199
|
}
|
|
3154
3200
|
}
|
|
3201
|
+
/** Charts this paragraph contains, in order. */
|
|
3202
|
+
__init4() {this.charts = []}
|
|
3155
3203
|
image(container, format, push) {
|
|
3204
|
+
const chartRef = descendants(container, "chart").find((el) => el.namespaceURI === _chunkPIMCHMZEcjs.CHART_OOXML_NS);
|
|
3205
|
+
const chart = chartRef ? this.part.charts.get(_nullishCoalesce(attr(chartRef, "id"), () => ( ""))) : void 0;
|
|
3206
|
+
if (chart) {
|
|
3207
|
+
if (!this.ctx.charts.includes(chart)) this.ctx.charts.push(chart);
|
|
3208
|
+
this.charts.push(chart);
|
|
3209
|
+
push({ kind: "chart", chart, format });
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3156
3212
|
const blip = descendants(container, "blip")[0];
|
|
3157
3213
|
const imageData = descendants(container, "imagedata")[0];
|
|
3158
3214
|
const id = blip ? attr(blip, "embed") : attr(imageData, "id");
|
|
@@ -3290,7 +3346,8 @@ function renderBlocks(container, ctx, part, topLevel = false) {
|
|
|
3290
3346
|
const mappedStyle = styleId ? ctx.styleIds.get(styleId) : void 0;
|
|
3291
3347
|
const styleAttr = !heading && !list && mappedStyle && mappedStyle !== _chunk3CC7OPUQcjs.NORMAL_STYLE_ID ? ` data-style="${_chunk66IMF6ODcjs.escapeHtml.call(void 0, mappedStyle)}"` : "";
|
|
3292
3348
|
const changeAttr = topLevel && !list && ctx.tracked === "marks" ? blockChangeAttr(pPr, ctx) : "";
|
|
3293
|
-
const
|
|
3349
|
+
const charts = renderer.charts.map(chartBlockHtml).join("");
|
|
3350
|
+
const blockHtml = (charts && !inner && !heading ? "" : heading ? `<h${heading}${changeAttr}>${inner}</h${heading}>` : `<p${styleAttr}${changeAttr}>${inner}</p>`) + charts;
|
|
3294
3351
|
if (!list) {
|
|
3295
3352
|
closeAll();
|
|
3296
3353
|
html += blockHtml;
|
|
@@ -3438,21 +3495,22 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3438
3495
|
moveRanges: /* @__PURE__ */ new Map(),
|
|
3439
3496
|
moveIds: /* @__PURE__ */ new Map(),
|
|
3440
3497
|
segmentCount: 0,
|
|
3441
|
-
lastChange: null
|
|
3498
|
+
lastChange: null,
|
|
3499
|
+
charts: []
|
|
3442
3500
|
};
|
|
3443
3501
|
for (const kind of ["footnote", "endnote"]) {
|
|
3444
3502
|
const path = _nullishCoalesce(partByType(`${kind}s`), () => ( `${baseDir}${kind}s.xml`));
|
|
3445
3503
|
const notesXml = await readXmlPart(zip, Parser, path);
|
|
3446
3504
|
if (!notesXml) continue;
|
|
3447
3505
|
const noteRels = await readRelationships(zip, Parser, path);
|
|
3448
|
-
const part2 = { rels: noteRels, images: await loadImages(zip, notesXml, noteRels, options) };
|
|
3506
|
+
const part2 = { rels: noteRels, images: await loadImages(zip, notesXml, noteRels, options), charts: await loadCharts(zip, Parser, notesXml, noteRels, options) };
|
|
3449
3507
|
descendants(notesXml, kind).filter((note) => isW(note)).forEach((note) => {
|
|
3450
3508
|
const type = attr(note, "type");
|
|
3451
3509
|
if (type && type !== "normal") return;
|
|
3452
3510
|
ctx.notes.set(`${kind}:${attr(note, "id")}`, { element: note, part: part2 });
|
|
3453
3511
|
});
|
|
3454
3512
|
}
|
|
3455
|
-
const part = { rels, images: await loadImages(zip, documentXml, rels, options) };
|
|
3513
|
+
const part = { rels, images: await loadImages(zip, documentXml, rels, options), charts: await loadCharts(zip, Parser, documentXml, rels, options) };
|
|
3456
3514
|
let html = renderBlocks(body, ctx, part, true);
|
|
3457
3515
|
if (ctx.noteOrder.length) {
|
|
3458
3516
|
let notesHtml = "";
|
|
@@ -3465,6 +3523,7 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3465
3523
|
const sanitized = _chunkHNDSPZ5Tcjs.sanitizeImportedHtml.call(void 0, html);
|
|
3466
3524
|
const result = { html: sanitized, text: _chunk66IMF6ODcjs.htmlToPlainText.call(void 0, sanitized) };
|
|
3467
3525
|
if (threads.length) result.comments = { version: 1, threads };
|
|
3526
|
+
if (ctx.charts.length) result.charts = ctx.charts;
|
|
3468
3527
|
if (useStyles) {
|
|
3469
3528
|
const definitions = styleDefinitions(styles, styleIds);
|
|
3470
3529
|
if (definitions.length) result.styles = _chunk3CC7OPUQcjs.createStyleRegistry.call(void 0, { styles: definitions });
|
|
@@ -3581,9 +3640,9 @@ function insertImportedDocument(target, content, options = {}) {
|
|
|
3581
3640
|
if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
|
|
3582
3641
|
from = to = _state.Selection.near(state.doc.resolve(from)).from;
|
|
3583
3642
|
}
|
|
3584
|
-
if (htmlSlice &&
|
|
3643
|
+
if (htmlSlice && _chunkMUCYWI6Wcjs.sliceContainsTable.call(void 0, htmlSlice) && _chunkMUCYWI6Wcjs.outermostTableDepth.call(void 0, state.doc.resolve(from)) >= 0) {
|
|
3585
3644
|
const tr2 = state.tr;
|
|
3586
|
-
const end2 =
|
|
3645
|
+
const end2 = _chunkMUCYWI6Wcjs.insertSliceAfterTable.call(void 0, tr2, from, to, htmlSlice);
|
|
3587
3646
|
if (end2 !== null) {
|
|
3588
3647
|
if (options.at === void 0) tr2.setSelection(_state.Selection.near(tr2.doc.resolve(end2), -1));
|
|
3589
3648
|
view.dispatch(tr2.scrollIntoView().setMeta("uiEvent", "drop"));
|
|
@@ -3760,7 +3819,7 @@ var RichClipboard = _core.Extension.create({
|
|
|
3760
3819
|
const slice = _chunkHNDSPZ5Tcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
|
|
3761
3820
|
if (!slice) return false;
|
|
3762
3821
|
event.preventDefault();
|
|
3763
|
-
if (
|
|
3822
|
+
if (_chunkMUCYWI6Wcjs.handleTablePasteWithoutNesting.call(void 0, view, event, slice)) return true;
|
|
3764
3823
|
view.dispatch(
|
|
3765
3824
|
view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste")
|
|
3766
3825
|
);
|
|
@@ -4086,90 +4145,6 @@ var Autocorrect = _core.Extension.create({
|
|
|
4086
4145
|
|
|
4087
4146
|
|
|
4088
4147
|
|
|
4089
|
-
|
|
4090
|
-
// src/extensions/document-structure/utils.ts
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
var _transform = require('@tiptap/pm/transform');
|
|
4094
|
-
var idCounter = 0;
|
|
4095
|
-
function generateStructureId(prefix) {
|
|
4096
|
-
idCounter = (idCounter + 1) % 1296;
|
|
4097
|
-
const random = Math.random().toString(36).slice(2, 8).padEnd(6, "0");
|
|
4098
|
-
return `${prefix}-${random}${idCounter.toString(36).padStart(2, "0")}`;
|
|
4099
|
-
}
|
|
4100
|
-
function transactionsInsert(transactions, typeNames) {
|
|
4101
|
-
for (const tr of transactions) {
|
|
4102
|
-
for (const step of tr.steps) {
|
|
4103
|
-
if (!(step instanceof _transform.ReplaceStep || step instanceof _transform.ReplaceAroundStep)) {
|
|
4104
|
-
const mark = step.mark;
|
|
4105
|
-
if (mark && typeNames.includes(mark.type.name)) return true;
|
|
4106
|
-
continue;
|
|
4107
|
-
}
|
|
4108
|
-
let found = false;
|
|
4109
|
-
step.slice.content.descendants((node) => {
|
|
4110
|
-
if (found) return false;
|
|
4111
|
-
if (typeNames.includes(node.type.name) || node.marks.some((m) => typeNames.includes(m.type.name))) {
|
|
4112
|
-
found = true;
|
|
4113
|
-
}
|
|
4114
|
-
return !found;
|
|
4115
|
-
});
|
|
4116
|
-
if (found) return true;
|
|
4117
|
-
}
|
|
4118
|
-
}
|
|
4119
|
-
return false;
|
|
4120
|
-
}
|
|
4121
|
-
function docContains(doc, typeNames) {
|
|
4122
|
-
let found = false;
|
|
4123
|
-
doc.descendants((node) => {
|
|
4124
|
-
if (found) return false;
|
|
4125
|
-
if (typeNames.includes(node.type.name) || node.marks.some((m) => typeNames.includes(m.type.name))) {
|
|
4126
|
-
found = true;
|
|
4127
|
-
}
|
|
4128
|
-
return !found;
|
|
4129
|
-
});
|
|
4130
|
-
return found;
|
|
4131
|
-
}
|
|
4132
|
-
function presenceStateSpec(typeNames) {
|
|
4133
|
-
return {
|
|
4134
|
-
init: (_config, state) => docContains(state.doc, typeNames),
|
|
4135
|
-
apply: (tr, present, _oldState, newState) => {
|
|
4136
|
-
if (!tr.docChanged) return present;
|
|
4137
|
-
if (!present && !transactionsInsert([tr], typeNames)) return false;
|
|
4138
|
-
return docContains(newState.doc, typeNames);
|
|
4139
|
-
}
|
|
4140
|
-
};
|
|
4141
|
-
}
|
|
4142
|
-
function arraysEqual(a, b, eq) {
|
|
4143
|
-
if (a.length !== b.length) return false;
|
|
4144
|
-
for (let i = 0; i < a.length; i++) {
|
|
4145
|
-
if (!eq(a[i], b[i])) return false;
|
|
4146
|
-
}
|
|
4147
|
-
return true;
|
|
4148
|
-
}
|
|
4149
|
-
function scrollDomAtPos(view, pos, behavior = "smooth") {
|
|
4150
|
-
try {
|
|
4151
|
-
const dom = _optionalChain([view, 'optionalAccess', _161 => _161.nodeDOM, 'optionalCall', _162 => _162(pos)]);
|
|
4152
|
-
if (dom && typeof dom.scrollIntoView === "function") {
|
|
4153
|
-
dom.scrollIntoView({ block: "start", behavior });
|
|
4154
|
-
}
|
|
4155
|
-
} catch (e3) {
|
|
4156
|
-
}
|
|
4157
|
-
}
|
|
4158
|
-
function syncInitialContent(editor, sync) {
|
|
4159
|
-
const { content } = editor.options;
|
|
4160
|
-
if (content == null || content === "") return;
|
|
4161
|
-
try {
|
|
4162
|
-
const doc = _core.createDocument.call(void 0, content, editor.schema, editor.options.parseOptions, {
|
|
4163
|
-
errorOnInvalidContent: false
|
|
4164
|
-
});
|
|
4165
|
-
const tr = sync(_state.EditorState.create({ doc }));
|
|
4166
|
-
if (_optionalChain([tr, 'optionalAccess', _163 => _163.docChanged])) editor.options.content = tr.doc;
|
|
4167
|
-
} catch (e4) {
|
|
4168
|
-
}
|
|
4169
|
-
}
|
|
4170
|
-
var STRUCTURE_PRIORITY = 45;
|
|
4171
|
-
|
|
4172
|
-
// src/extensions/document-structure/outline.ts
|
|
4173
4148
|
var outlinePluginKey = new (0, _state.PluginKey)("outline");
|
|
4174
4149
|
var outlineIdPluginKey = new (0, _state.PluginKey)("outlineIds");
|
|
4175
4150
|
var sameHeading = (a, b) => a.id === b.id && a.level === b.level && a.text === b.text && a.pos === b.pos && a.depth === b.depth;
|
|
@@ -4244,8 +4219,8 @@ function createOutlineStore(editor) {
|
|
|
4244
4219
|
const compute = () => {
|
|
4245
4220
|
if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
|
|
4246
4221
|
const headings = getOutline(editor);
|
|
4247
|
-
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call',
|
|
4248
|
-
const sameStructure = arraysEqual(snapshot.headings, headings, sameHeading);
|
|
4222
|
+
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _161 => _161(editor, headings), 'optionalAccess', _162 => _162.id]), () => ( null));
|
|
4223
|
+
const sameStructure = _chunkMUCYWI6Wcjs.arraysEqual.call(void 0, snapshot.headings, headings, sameHeading);
|
|
4249
4224
|
if (sameStructure && snapshot.activeId === activeId) return snapshot;
|
|
4250
4225
|
return {
|
|
4251
4226
|
headings: sameStructure ? snapshot.headings : headings,
|
|
@@ -4269,16 +4244,16 @@ function createOutlineStore(editor) {
|
|
|
4269
4244
|
subscribe(listener) {
|
|
4270
4245
|
if (!listeners.size) {
|
|
4271
4246
|
snapshot = compute();
|
|
4272
|
-
_optionalChain([editor, 'optionalAccess',
|
|
4247
|
+
_optionalChain([editor, 'optionalAccess', _163 => _163.on, 'call', _164 => _164("transaction", onTransaction)]);
|
|
4273
4248
|
}
|
|
4274
4249
|
listeners.add(listener);
|
|
4275
4250
|
return () => {
|
|
4276
4251
|
listeners.delete(listener);
|
|
4277
|
-
if (!listeners.size) _optionalChain([editor, 'optionalAccess',
|
|
4252
|
+
if (!listeners.size) _optionalChain([editor, 'optionalAccess', _165 => _165.off, 'call', _166 => _166("transaction", onTransaction)]);
|
|
4278
4253
|
};
|
|
4279
4254
|
},
|
|
4280
4255
|
destroy() {
|
|
4281
|
-
_optionalChain([editor, 'optionalAccess',
|
|
4256
|
+
_optionalChain([editor, 'optionalAccess', _167 => _167.off, 'call', _168 => _168("transaction", onTransaction)]);
|
|
4282
4257
|
listeners.clear();
|
|
4283
4258
|
}
|
|
4284
4259
|
};
|
|
@@ -4293,7 +4268,7 @@ function navigateToHeading(editor, heading, options = {}) {
|
|
|
4293
4268
|
editor.view.dispatch(tr);
|
|
4294
4269
|
editor.view.focus();
|
|
4295
4270
|
}
|
|
4296
|
-
scrollDomAtPos(editor.view, current.pos, behavior);
|
|
4271
|
+
_chunkMUCYWI6Wcjs.scrollDomAtPos.call(void 0, editor.view, current.pos, behavior);
|
|
4297
4272
|
return true;
|
|
4298
4273
|
}
|
|
4299
4274
|
function assignHeadingIds(state, types, generateId) {
|
|
@@ -4318,11 +4293,11 @@ function assignHeadingIds(state, types, generateId) {
|
|
|
4318
4293
|
}
|
|
4319
4294
|
var Outline = _core.Extension.create({
|
|
4320
4295
|
name: "outline",
|
|
4321
|
-
priority: STRUCTURE_PRIORITY,
|
|
4296
|
+
priority: _chunkMUCYWI6Wcjs.STRUCTURE_PRIORITY,
|
|
4322
4297
|
addOptions() {
|
|
4323
4298
|
return {
|
|
4324
4299
|
types: ["heading"],
|
|
4325
|
-
generateId: () => generateStructureId("h"),
|
|
4300
|
+
generateId: () => _chunkMUCYWI6Wcjs.generateStructureId.call(void 0, "h"),
|
|
4326
4301
|
onUpdate: void 0
|
|
4327
4302
|
};
|
|
4328
4303
|
},
|
|
@@ -4353,16 +4328,16 @@ var Outline = _core.Extension.create({
|
|
|
4353
4328
|
if (options.focus !== false) {
|
|
4354
4329
|
tr.setSelection(_state.TextSelection.create(tr.doc, heading.pos + 1));
|
|
4355
4330
|
tr.scrollIntoView();
|
|
4356
|
-
_optionalChain([view, 'optionalAccess',
|
|
4331
|
+
_optionalChain([view, 'optionalAccess', _169 => _169.focus, 'optionalCall', _170 => _170()]);
|
|
4357
4332
|
}
|
|
4358
|
-
scrollDomAtPos(view, heading.pos, options.behavior);
|
|
4333
|
+
_chunkMUCYWI6Wcjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
|
|
4359
4334
|
}
|
|
4360
4335
|
return true;
|
|
4361
4336
|
},
|
|
4362
4337
|
scrollToHeading: (id, options = {}) => ({ state, dispatch, view }) => {
|
|
4363
4338
|
const heading = findHeading(state, id);
|
|
4364
4339
|
if (!heading) return false;
|
|
4365
|
-
if (dispatch) scrollDomAtPos(view, heading.pos, options.behavior);
|
|
4340
|
+
if (dispatch) _chunkMUCYWI6Wcjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
|
|
4366
4341
|
return true;
|
|
4367
4342
|
}
|
|
4368
4343
|
};
|
|
@@ -4383,9 +4358,9 @@ var Outline = _core.Extension.create({
|
|
|
4383
4358
|
apply: (tr, prev, _oldState, newState) => {
|
|
4384
4359
|
if (!tr.docChanged) return prev;
|
|
4385
4360
|
const next = computeOutline(newState.doc, types);
|
|
4386
|
-
if (arraysEqual(prev, next, sameHeading)) return prev;
|
|
4361
|
+
if (_chunkMUCYWI6Wcjs.arraysEqual.call(void 0, prev, next, sameHeading)) return prev;
|
|
4387
4362
|
storage.headings = next;
|
|
4388
|
-
_optionalChain([onUpdate, 'call',
|
|
4363
|
+
_optionalChain([onUpdate, 'call', _171 => _171(), 'optionalCall', _172 => _172(next)]);
|
|
4389
4364
|
return next;
|
|
4390
4365
|
}
|
|
4391
4366
|
}
|
|
@@ -4401,7 +4376,7 @@ var Outline = _core.Extension.create({
|
|
|
4401
4376
|
},
|
|
4402
4377
|
onBeforeCreate() {
|
|
4403
4378
|
const { types, generateId } = this.options;
|
|
4404
|
-
syncInitialContent(this.editor, (state) => assignHeadingIds(state, types, generateId));
|
|
4379
|
+
_chunkMUCYWI6Wcjs.syncInitialContent.call(void 0, this.editor, (state) => assignHeadingIds(state, types, generateId));
|
|
4405
4380
|
}
|
|
4406
4381
|
});
|
|
4407
4382
|
|
|
@@ -4571,7 +4546,7 @@ function syncTableOfContents(state, headingTypes) {
|
|
|
4571
4546
|
node.attrs.minLevel,
|
|
4572
4547
|
node.attrs.maxLevel
|
|
4573
4548
|
);
|
|
4574
|
-
if (!arraysEqual(_nullishCoalesce(node.attrs.entries, () => ( [])), entries, sameEntry)) {
|
|
4549
|
+
if (!_chunkMUCYWI6Wcjs.arraysEqual.call(void 0, _nullishCoalesce(node.attrs.entries, () => ( [])), entries, sameEntry)) {
|
|
4575
4550
|
tr = _nullishCoalesce(tr, () => ( state.tr));
|
|
4576
4551
|
tr.setNodeMarkup(pos, void 0, { ...node.attrs, entries });
|
|
4577
4552
|
}
|
|
@@ -4583,7 +4558,7 @@ function syncTableOfContents(state, headingTypes) {
|
|
|
4583
4558
|
}
|
|
4584
4559
|
var TableOfContents = _core.Node.create({
|
|
4585
4560
|
name: "tableOfContents",
|
|
4586
|
-
priority: STRUCTURE_PRIORITY - 5,
|
|
4561
|
+
priority: _chunkMUCYWI6Wcjs.STRUCTURE_PRIORITY - 5,
|
|
4587
4562
|
group: "block",
|
|
4588
4563
|
atom: true,
|
|
4589
4564
|
selectable: true,
|
|
@@ -4694,7 +4669,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4694
4669
|
return [
|
|
4695
4670
|
new (0, _state.Plugin)({
|
|
4696
4671
|
key: tableOfContentsPluginKey,
|
|
4697
|
-
state: presenceStateSpec([this.name]),
|
|
4672
|
+
state: _chunkMUCYWI6Wcjs.presenceStateSpec.call(void 0, [this.name]),
|
|
4698
4673
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
4699
4674
|
if (!transactions.some((tr) => tr.docChanged)) return null;
|
|
4700
4675
|
if (!tableOfContentsPluginKey.getState(newState)) return null;
|
|
@@ -4704,7 +4679,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4704
4679
|
handleDOMEvents: {
|
|
4705
4680
|
click: (view, event) => {
|
|
4706
4681
|
const target = event.target;
|
|
4707
|
-
const link = _optionalChain([target, 'optionalAccess',
|
|
4682
|
+
const link = _optionalChain([target, 'optionalAccess', _173 => _173.closest, 'optionalCall', _174 => _174(
|
|
4708
4683
|
'nav[data-type="table-of-contents"] a[data-heading-id]'
|
|
4709
4684
|
)]);
|
|
4710
4685
|
if (!link) return false;
|
|
@@ -4718,7 +4693,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4718
4693
|
);
|
|
4719
4694
|
view.focus();
|
|
4720
4695
|
}
|
|
4721
|
-
scrollDomAtPos(view, heading.pos);
|
|
4696
|
+
_chunkMUCYWI6Wcjs.scrollDomAtPos.call(void 0, view, heading.pos);
|
|
4722
4697
|
return true;
|
|
4723
4698
|
}
|
|
4724
4699
|
}
|
|
@@ -4728,7 +4703,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4728
4703
|
},
|
|
4729
4704
|
onBeforeCreate() {
|
|
4730
4705
|
const { headingTypes } = this.options;
|
|
4731
|
-
syncInitialContent(this.editor, (state) => syncTableOfContents(state, headingTypes));
|
|
4706
|
+
_chunkMUCYWI6Wcjs.syncInitialContent.call(void 0, this.editor, (state) => syncTableOfContents(state, headingTypes));
|
|
4732
4707
|
}
|
|
4733
4708
|
});
|
|
4734
4709
|
|
|
@@ -4777,7 +4752,7 @@ function getFootnotes(doc) {
|
|
|
4777
4752
|
number: index + 1,
|
|
4778
4753
|
text: footnote ? footnoteText(footnote.node) : "",
|
|
4779
4754
|
referencePos: ref.pos,
|
|
4780
|
-
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess',
|
|
4755
|
+
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _175 => _175.pos]), () => ( null))
|
|
4781
4756
|
};
|
|
4782
4757
|
});
|
|
4783
4758
|
}
|
|
@@ -4786,7 +4761,7 @@ function syncFootnotes(tr, options = {}) {
|
|
|
4786
4761
|
const listType = schema.nodes[LIST];
|
|
4787
4762
|
const itemType = schema.nodes[ITEM];
|
|
4788
4763
|
if (!listType || !itemType) return false;
|
|
4789
|
-
const generateId = _nullishCoalesce(options.generateId, () => ( (() => generateStructureId("fn"))));
|
|
4764
|
+
const generateId = _nullishCoalesce(options.generateId, () => ( (() => _chunkMUCYWI6Wcjs.generateStructureId.call(void 0, "fn"))));
|
|
4790
4765
|
const refs = [];
|
|
4791
4766
|
const lists = [];
|
|
4792
4767
|
const existing = /* @__PURE__ */ new Map();
|
|
@@ -4819,7 +4794,7 @@ function syncFootnotes(tr, options = {}) {
|
|
|
4819
4794
|
});
|
|
4820
4795
|
const desiredItems = desiredRefs.map(({ id, number, copyOf }) => {
|
|
4821
4796
|
const source = _nullishCoalesce(existing.get(id), () => ( (copyOf ? existing.get(copyOf) : void 0)));
|
|
4822
|
-
const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
4797
|
+
const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _176 => _176.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _177 => _177.contents, 'optionalAccess', _178 => _178[id]]), () => ( "")))));
|
|
4823
4798
|
if (source && source.attrs.id === id && source.attrs.number === number) {
|
|
4824
4799
|
return source;
|
|
4825
4800
|
}
|
|
@@ -4870,7 +4845,7 @@ function findReferences(doc, id) {
|
|
|
4870
4845
|
}
|
|
4871
4846
|
var FootnoteReference = _core.Node.create({
|
|
4872
4847
|
name: REFERENCE,
|
|
4873
|
-
priority: STRUCTURE_PRIORITY - 5,
|
|
4848
|
+
priority: _chunkMUCYWI6Wcjs.STRUCTURE_PRIORITY - 5,
|
|
4874
4849
|
group: "inline",
|
|
4875
4850
|
inline: true,
|
|
4876
4851
|
atom: true,
|
|
@@ -4878,7 +4853,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4878
4853
|
addOptions() {
|
|
4879
4854
|
return {
|
|
4880
4855
|
HTMLAttributes: {},
|
|
4881
|
-
generateId: () => generateStructureId("fn")
|
|
4856
|
+
generateId: () => _chunkMUCYWI6Wcjs.generateStructureId.call(void 0, "fn")
|
|
4882
4857
|
};
|
|
4883
4858
|
},
|
|
4884
4859
|
addAttributes() {
|
|
@@ -4989,7 +4964,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4989
4964
|
_state.TextSelection.create(tr.doc, footnote.pos + footnote.node.nodeSize - 2)
|
|
4990
4965
|
);
|
|
4991
4966
|
tr.scrollIntoView();
|
|
4992
|
-
scrollDomAtPos(view, footnote.pos);
|
|
4967
|
+
_chunkMUCYWI6Wcjs.scrollDomAtPos.call(void 0, view, footnote.pos);
|
|
4993
4968
|
}
|
|
4994
4969
|
return true;
|
|
4995
4970
|
},
|
|
@@ -4999,7 +4974,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4999
4974
|
if (dispatch) {
|
|
5000
4975
|
tr.setSelection(_state.NodeSelection.create(tr.doc, ref.pos));
|
|
5001
4976
|
tr.scrollIntoView();
|
|
5002
|
-
scrollDomAtPos(view, ref.pos);
|
|
4977
|
+
_chunkMUCYWI6Wcjs.scrollDomAtPos.call(void 0, view, ref.pos);
|
|
5003
4978
|
}
|
|
5004
4979
|
return true;
|
|
5005
4980
|
}
|
|
@@ -5011,7 +4986,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
5011
4986
|
return [
|
|
5012
4987
|
new (0, _state.Plugin)({
|
|
5013
4988
|
key: footnotesPluginKey,
|
|
5014
|
-
state: presenceStateSpec([REFERENCE, LIST]),
|
|
4989
|
+
state: _chunkMUCYWI6Wcjs.presenceStateSpec.call(void 0, [REFERENCE, LIST]),
|
|
5015
4990
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
5016
4991
|
if (!transactions.some((tr2) => tr2.docChanged)) return null;
|
|
5017
4992
|
if (!footnotesPluginKey.getState(newState)) return null;
|
|
@@ -5022,7 +4997,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
5022
4997
|
handleClickOn: (_view, _pos, node, _nodePos, event) => {
|
|
5023
4998
|
if (node.type.name !== REFERENCE || !node.attrs.id) return false;
|
|
5024
4999
|
const target = event.target;
|
|
5025
|
-
if (!_optionalChain([target, 'optionalAccess',
|
|
5000
|
+
if (!_optionalChain([target, 'optionalAccess', _179 => _179.closest, 'optionalCall', _180 => _180("a")])) return false;
|
|
5026
5001
|
event.preventDefault();
|
|
5027
5002
|
return editor.commands.goToFootnote(node.attrs.id);
|
|
5028
5003
|
}
|
|
@@ -5032,7 +5007,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
5032
5007
|
},
|
|
5033
5008
|
onBeforeCreate() {
|
|
5034
5009
|
const { generateId } = this.options;
|
|
5035
|
-
syncInitialContent(this.editor, (state) => {
|
|
5010
|
+
_chunkMUCYWI6Wcjs.syncInitialContent.call(void 0, this.editor, (state) => {
|
|
5036
5011
|
const tr = state.tr;
|
|
5037
5012
|
return syncFootnotes(tr, { generateId }) ? tr : null;
|
|
5038
5013
|
});
|
|
@@ -5172,7 +5147,7 @@ var Bookmark = _core.Mark.create({
|
|
|
5172
5147
|
addOptions() {
|
|
5173
5148
|
return {
|
|
5174
5149
|
HTMLAttributes: {},
|
|
5175
|
-
generateId: () => generateStructureId("bm")
|
|
5150
|
+
generateId: () => _chunkMUCYWI6Wcjs.generateStructureId.call(void 0, "bm")
|
|
5176
5151
|
};
|
|
5177
5152
|
},
|
|
5178
5153
|
addAttributes() {
|
|
@@ -5220,7 +5195,7 @@ var Bookmark = _core.Mark.create({
|
|
|
5220
5195
|
}
|
|
5221
5196
|
if (!dispatch) return true;
|
|
5222
5197
|
const sameName = getBookmarks(state.doc).find((b) => b.name === name);
|
|
5223
|
-
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess',
|
|
5198
|
+
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _181 => _181.id]))), () => ( this.options.generateId()));
|
|
5224
5199
|
if (sameName) {
|
|
5225
5200
|
forEachBookmarkRange(
|
|
5226
5201
|
tr.doc,
|
|
@@ -5257,7 +5232,7 @@ var Bookmark = _core.Mark.create({
|
|
|
5257
5232
|
tr.setSelection(_state.TextSelection.create(tr.doc, bookmark.from, bookmark.to));
|
|
5258
5233
|
tr.scrollIntoView();
|
|
5259
5234
|
const domPos = state.doc.resolve(bookmark.from);
|
|
5260
|
-
scrollDomAtPos(view, domPos.before(domPos.depth));
|
|
5235
|
+
_chunkMUCYWI6Wcjs.scrollDomAtPos.call(void 0, view, domPos.before(domPos.depth));
|
|
5261
5236
|
}
|
|
5262
5237
|
return true;
|
|
5263
5238
|
}
|
|
@@ -5322,7 +5297,7 @@ function syncCrossReferences(state, headingTypes) {
|
|
|
5322
5297
|
}
|
|
5323
5298
|
var CrossReference = _core.Node.create({
|
|
5324
5299
|
name: NAME,
|
|
5325
|
-
priority: STRUCTURE_PRIORITY - 5,
|
|
5300
|
+
priority: _chunkMUCYWI6Wcjs.STRUCTURE_PRIORITY - 5,
|
|
5326
5301
|
group: "inline",
|
|
5327
5302
|
inline: true,
|
|
5328
5303
|
atom: true,
|
|
@@ -5424,7 +5399,7 @@ var CrossReference = _core.Node.create({
|
|
|
5424
5399
|
if (dispatch) {
|
|
5425
5400
|
tr.setSelection(_state.TextSelection.create(tr.doc, range.from, range.to));
|
|
5426
5401
|
tr.scrollIntoView();
|
|
5427
|
-
scrollDomAtPos(view, range.blockPos);
|
|
5402
|
+
_chunkMUCYWI6Wcjs.scrollDomAtPos.call(void 0, view, range.blockPos);
|
|
5428
5403
|
}
|
|
5429
5404
|
return true;
|
|
5430
5405
|
}
|
|
@@ -5436,7 +5411,7 @@ var CrossReference = _core.Node.create({
|
|
|
5436
5411
|
return [
|
|
5437
5412
|
new (0, _state.Plugin)({
|
|
5438
5413
|
key: crossReferencePluginKey,
|
|
5439
|
-
state: presenceStateSpec([NAME]),
|
|
5414
|
+
state: _chunkMUCYWI6Wcjs.presenceStateSpec.call(void 0, [NAME]),
|
|
5440
5415
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
5441
5416
|
if (!transactions.some((tr) => tr.docChanged)) return null;
|
|
5442
5417
|
if (!crossReferencePluginKey.getState(newState)) return null;
|
|
@@ -5455,14 +5430,14 @@ var CrossReference = _core.Node.create({
|
|
|
5455
5430
|
},
|
|
5456
5431
|
onBeforeCreate() {
|
|
5457
5432
|
const { headingTypes } = this.options;
|
|
5458
|
-
syncInitialContent(this.editor, (state) => syncCrossReferences(state, headingTypes));
|
|
5433
|
+
_chunkMUCYWI6Wcjs.syncInitialContent.call(void 0, this.editor, (state) => syncCrossReferences(state, headingTypes));
|
|
5459
5434
|
}
|
|
5460
5435
|
});
|
|
5461
5436
|
|
|
5462
5437
|
// src/extensions/document-structure/command-items.ts
|
|
5463
5438
|
var start = (editor, args) => {
|
|
5464
5439
|
const chain = editor.chain().focus();
|
|
5465
|
-
return _optionalChain([args, 'optionalAccess',
|
|
5440
|
+
return _optionalChain([args, 'optionalAccess', _182 => _182.range]) ? chain.deleteRange(args.range) : chain;
|
|
5466
5441
|
};
|
|
5467
5442
|
var documentStructureCommandItems = [
|
|
5468
5443
|
{
|
|
@@ -5479,7 +5454,7 @@ var documentStructureCommandItems = [
|
|
|
5479
5454
|
description: "Insert a numbered footnote",
|
|
5480
5455
|
keywords: ["footnote", "note", "fn", "citation"],
|
|
5481
5456
|
extension: "footnoteReference",
|
|
5482
|
-
run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess',
|
|
5457
|
+
run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _183 => _183.content]) }).run()
|
|
5483
5458
|
},
|
|
5484
5459
|
{
|
|
5485
5460
|
id: "bookmark",
|
|
@@ -5488,7 +5463,7 @@ var documentStructureCommandItems = [
|
|
|
5488
5463
|
keywords: ["bookmark", "anchor", "name"],
|
|
5489
5464
|
extension: "bookmark",
|
|
5490
5465
|
requires: "name",
|
|
5491
|
-
run: (editor, args) => !!_optionalChain([args, 'optionalAccess',
|
|
5466
|
+
run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _184 => _184.name]) && start(editor, args).setBookmark({ name: args.name }).run()
|
|
5492
5467
|
},
|
|
5493
5468
|
{
|
|
5494
5469
|
id: "cross-reference",
|
|
@@ -5497,7 +5472,7 @@ var documentStructureCommandItems = [
|
|
|
5497
5472
|
keywords: ["cross", "reference", "xref", "link", "ref"],
|
|
5498
5473
|
extension: "crossReference",
|
|
5499
5474
|
requires: "target",
|
|
5500
|
-
run: (editor, args) => !!_optionalChain([args, 'optionalAccess',
|
|
5475
|
+
run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _185 => _185.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
|
|
5501
5476
|
}
|
|
5502
5477
|
];
|
|
5503
5478
|
function getDocumentStructureCommandItems(editor, query = "") {
|
|
@@ -5530,17 +5505,17 @@ var EMPTY_FIND_REPLACE_SNAPSHOT = Object.freeze({
|
|
|
5530
5505
|
lastReplaceCount: null,
|
|
5531
5506
|
focusRequest: 0
|
|
5532
5507
|
});
|
|
5533
|
-
var FindReplaceStore = (_class3 = class {constructor() { _class3.prototype.
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5508
|
+
var FindReplaceStore = (_class3 = class {constructor() { _class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this); }
|
|
5509
|
+
__init5() {this.snapshot = EMPTY_FIND_REPLACE_SNAPSHOT}
|
|
5510
|
+
__init6() {this.listeners = /* @__PURE__ */ new Set()}
|
|
5511
|
+
__init7() {this.subscribe = (listener) => {
|
|
5537
5512
|
this.listeners.add(listener);
|
|
5538
5513
|
listener(this.snapshot);
|
|
5539
5514
|
return () => {
|
|
5540
5515
|
this.listeners.delete(listener);
|
|
5541
5516
|
};
|
|
5542
5517
|
}}
|
|
5543
|
-
|
|
5518
|
+
__init8() {this.getSnapshot = () => this.snapshot}
|
|
5544
5519
|
/** @internal Called by the extension's plugin view. */
|
|
5545
5520
|
set(snapshot) {
|
|
5546
5521
|
if (snapshot === this.snapshot) return;
|
|
@@ -5556,13 +5531,13 @@ var FindReplaceStore = (_class3 = class {constructor() { _class3.prototype.__ini
|
|
|
5556
5531
|
}, _class3);
|
|
5557
5532
|
var findReplacePluginKey = new (0, _state.PluginKey)("findReplace");
|
|
5558
5533
|
function getFindReplaceState(source) {
|
|
5559
|
-
const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
5534
|
+
const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _186 => _186.state]), () => ( source));
|
|
5560
5535
|
if (!state || typeof state.plugins === "undefined") return null;
|
|
5561
5536
|
const plugin = findReplacePluginKey.getState(state);
|
|
5562
5537
|
return plugin ? toSnapshot(plugin) : null;
|
|
5563
5538
|
}
|
|
5564
5539
|
function getFindReplaceStore(editor) {
|
|
5565
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
5540
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _187 => _187.storage, 'optionalAccess', _188 => _188.findReplace, 'optionalAccess', _189 => _189.store]), () => ( null));
|
|
5566
5541
|
}
|
|
5567
5542
|
var snapshotCache = /* @__PURE__ */ new WeakMap();
|
|
5568
5543
|
function toSnapshot(s) {
|
|
@@ -5710,7 +5685,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5710
5685
|
if (!s || !s.active || s.currentIndex < 0 || !s.matches[s.currentIndex]) return false;
|
|
5711
5686
|
if (dispatch) {
|
|
5712
5687
|
_history.closeHistory.call(void 0, tr);
|
|
5713
|
-
const [end] =
|
|
5688
|
+
const [end] = _chunkMUCYWI6Wcjs.applyReplacements.call(void 0, tr, [s.matches[s.currentIndex]]);
|
|
5714
5689
|
tr.setSelection(_state.TextSelection.create(tr.doc, end)).scrollIntoView();
|
|
5715
5690
|
meta(tr, { type: "replaced", anchor: end, count: 1 });
|
|
5716
5691
|
}
|
|
@@ -5721,7 +5696,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5721
5696
|
if (!s || !s.active || !s.matches.length) return false;
|
|
5722
5697
|
if (dispatch) {
|
|
5723
5698
|
_history.closeHistory.call(void 0, tr);
|
|
5724
|
-
const ends =
|
|
5699
|
+
const ends = _chunkMUCYWI6Wcjs.applyReplacements.call(void 0, tr, s.matches);
|
|
5725
5700
|
meta(tr, { type: "replaced", anchor: ends[ends.length - 1], count: s.matches.length });
|
|
5726
5701
|
}
|
|
5727
5702
|
return true;
|
|
@@ -5733,7 +5708,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5733
5708
|
const open = (mode) => () => this.editor.commands.openFindReplace({ mode });
|
|
5734
5709
|
const step = (forward) => () => {
|
|
5735
5710
|
const s = findReplacePluginKey.getState(this.editor.state);
|
|
5736
|
-
if (!_optionalChain([s, 'optionalAccess',
|
|
5711
|
+
if (!_optionalChain([s, 'optionalAccess', _190 => _190.active]) || !s.matches.length) return false;
|
|
5737
5712
|
return forward ? this.editor.commands.findNext() : this.editor.commands.findPrevious();
|
|
5738
5713
|
};
|
|
5739
5714
|
return {
|
|
@@ -5753,7 +5728,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5753
5728
|
if (!s.active || !s.query) {
|
|
5754
5729
|
return { ...s, matches: [], currentIndex: -1, error: null, truncated: false };
|
|
5755
5730
|
}
|
|
5756
|
-
const result =
|
|
5731
|
+
const result = _chunkMUCYWI6Wcjs.searchDocument.call(void 0, doc, s.query, s.options, {
|
|
5757
5732
|
replacement: s.replacement,
|
|
5758
5733
|
clipboardText: safeClipboard(options.getClipboardText),
|
|
5759
5734
|
timeLimitMs: options.timeLimitMs,
|
|
@@ -5846,7 +5821,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5846
5821
|
s = {
|
|
5847
5822
|
...s,
|
|
5848
5823
|
currentIndex: m.index,
|
|
5849
|
-
anchor: _nullishCoalesce(_optionalChain([s, 'access',
|
|
5824
|
+
anchor: _nullishCoalesce(_optionalChain([s, 'access', _191 => _191.matches, 'access', _192 => _192[m.index], 'optionalAccess', _193 => _193.from]), () => ( s.anchor))
|
|
5850
5825
|
};
|
|
5851
5826
|
redecorate = true;
|
|
5852
5827
|
break;
|
|
@@ -5862,7 +5837,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5862
5837
|
}
|
|
5863
5838
|
},
|
|
5864
5839
|
props: {
|
|
5865
|
-
decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access',
|
|
5840
|
+
decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _194 => _194.getState, 'call', _195 => _195(state), 'optionalAccess', _196 => _196.decorations]), () => ( _view2.DecorationSet.empty))
|
|
5866
5841
|
},
|
|
5867
5842
|
view: (view) => {
|
|
5868
5843
|
const sync = () => {
|
|
@@ -5879,7 +5854,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5879
5854
|
function safeClipboard(get) {
|
|
5880
5855
|
try {
|
|
5881
5856
|
return String(_nullishCoalesce(get(), () => ( "")));
|
|
5882
|
-
} catch (
|
|
5857
|
+
} catch (e3) {
|
|
5883
5858
|
return "";
|
|
5884
5859
|
}
|
|
5885
5860
|
}
|
|
@@ -5891,11 +5866,11 @@ var STYLE_ID_ATTRIBUTE = "styleId";
|
|
|
5891
5866
|
var CHARACTER_STYLE_MARK_NAME = "characterStyle";
|
|
5892
5867
|
var paragraphStylesPluginKey = new (0, _state.PluginKey)("paragraphStyles");
|
|
5893
5868
|
function getStyleRegistry(editor) {
|
|
5894
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
5869
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _197 => _197.storage, 'optionalAccess', _198 => _198.paragraphStyles, 'optionalAccess', _199 => _199.registry]), () => ( null));
|
|
5895
5870
|
}
|
|
5896
5871
|
function headingLevels(editor) {
|
|
5897
|
-
const heading = _optionalChain([editor, 'optionalAccess',
|
|
5898
|
-
const levels = _optionalChain([heading, 'optionalAccess',
|
|
5872
|
+
const heading = _optionalChain([editor, 'optionalAccess', _200 => _200.extensionManager, 'optionalAccess', _201 => _201.extensions, 'access', _202 => _202.find, 'call', _203 => _203((e) => e.name === "heading")]);
|
|
5873
|
+
const levels = _optionalChain([heading, 'optionalAccess', _204 => _204.options, 'optionalAccess', _205 => _205.levels]);
|
|
5899
5874
|
return Array.isArray(levels) ? levels : null;
|
|
5900
5875
|
}
|
|
5901
5876
|
function isParagraphStyleAvailable(editor, registry, id) {
|
|
@@ -5905,7 +5880,7 @@ function isParagraphStyleAvailable(editor, registry, id) {
|
|
|
5905
5880
|
if (!editor.schema.nodes[block.type]) return false;
|
|
5906
5881
|
if (block.type === "heading") {
|
|
5907
5882
|
const levels = headingLevels(editor);
|
|
5908
|
-
if (levels && !levels.includes(Number(_optionalChain([block, 'access',
|
|
5883
|
+
if (levels && !levels.includes(Number(_optionalChain([block, 'access', _206 => _206.attrs, 'optionalAccess', _207 => _207.level])))) return false;
|
|
5909
5884
|
}
|
|
5910
5885
|
return true;
|
|
5911
5886
|
}
|
|
@@ -5945,7 +5920,7 @@ function captureSelectionFormat(state) {
|
|
|
5945
5920
|
if (name === "highlight") character.backgroundColor = mark.attrs.color || "#fef08a";
|
|
5946
5921
|
});
|
|
5947
5922
|
const paragraph = {};
|
|
5948
|
-
const align = _optionalChain([state, 'access',
|
|
5923
|
+
const align = _optionalChain([state, 'access', _208 => _208.selection, 'access', _209 => _209.$from, 'access', _210 => _210.parent, 'access', _211 => _211.attrs, 'optionalAccess', _212 => _212.textAlign]);
|
|
5949
5924
|
if (align && align !== "left") paragraph.textAlign = align;
|
|
5950
5925
|
return { paragraph, character };
|
|
5951
5926
|
}
|
|
@@ -5970,10 +5945,10 @@ function applyStyleToBlock(tr, pos, id, registry) {
|
|
|
5970
5945
|
if (node.type === type && Object.entries(attrs).every(([k, v]) => node.attrs[k] === v)) return false;
|
|
5971
5946
|
try {
|
|
5972
5947
|
tr.setNodeMarkup(pos, type, attrs);
|
|
5973
|
-
} catch (
|
|
5948
|
+
} catch (e4) {
|
|
5974
5949
|
try {
|
|
5975
5950
|
tr.setBlockType(pos + 1, pos + 1, type, attrs);
|
|
5976
|
-
} catch (
|
|
5951
|
+
} catch (e5) {
|
|
5977
5952
|
return false;
|
|
5978
5953
|
}
|
|
5979
5954
|
}
|
|
@@ -6111,7 +6086,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
6111
6086
|
},
|
|
6112
6087
|
clearParagraphStyle: () => ({ commands }) => commands.setParagraphStyle(_chunk3CC7OPUQcjs.NORMAL_STYLE_ID),
|
|
6113
6088
|
setCharacterStyle: (id) => ({ commands }) => {
|
|
6114
|
-
if (_optionalChain([registry, 'call',
|
|
6089
|
+
if (_optionalChain([registry, 'call', _213 => _213(), 'access', _214 => _214.get, 'call', _215 => _215(id), 'optionalAccess', _216 => _216.kind]) !== "character") return false;
|
|
6115
6090
|
return commands.setMark(CHARACTER_STYLE_MARK_NAME, { [STYLE_ID_ATTRIBUTE]: id });
|
|
6116
6091
|
},
|
|
6117
6092
|
unsetCharacterStyle: () => ({ commands }) => commands.unsetMark(CHARACTER_STYLE_MARK_NAME),
|
|
@@ -6177,7 +6152,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
6177
6152
|
};
|
|
6178
6153
|
},
|
|
6179
6154
|
onDestroy() {
|
|
6180
|
-
_optionalChain([this, 'access',
|
|
6155
|
+
_optionalChain([this, 'access', _217 => _217.storage, 'access', _218 => _218.cleanup, 'optionalCall', _219 => _219()]);
|
|
6181
6156
|
}
|
|
6182
6157
|
});
|
|
6183
6158
|
var EMPTY_STYLES = Object.freeze({
|
|
@@ -6215,8 +6190,8 @@ function createParagraphStylesStore(editor) {
|
|
|
6215
6190
|
}
|
|
6216
6191
|
};
|
|
6217
6192
|
const detach = () => {
|
|
6218
|
-
_optionalChain([editor, 'optionalAccess',
|
|
6219
|
-
_optionalChain([unsubscribeRegistry, 'optionalCall',
|
|
6193
|
+
_optionalChain([editor, 'optionalAccess', _220 => _220.off, 'call', _221 => _221("transaction", update)]);
|
|
6194
|
+
_optionalChain([unsubscribeRegistry, 'optionalCall', _222 => _222()]);
|
|
6220
6195
|
unsubscribeRegistry = null;
|
|
6221
6196
|
};
|
|
6222
6197
|
return {
|
|
@@ -6227,7 +6202,7 @@ function createParagraphStylesStore(editor) {
|
|
|
6227
6202
|
subscribe(listener) {
|
|
6228
6203
|
if (!listeners.size) {
|
|
6229
6204
|
snapshot = compute();
|
|
6230
|
-
_optionalChain([editor, 'optionalAccess',
|
|
6205
|
+
_optionalChain([editor, 'optionalAccess', _223 => _223.on, 'call', _224 => _224("transaction", update)]);
|
|
6231
6206
|
unsubscribeRegistry = registry ? registry.subscribe(update) : null;
|
|
6232
6207
|
}
|
|
6233
6208
|
listeners.add(listener);
|
|
@@ -6244,7 +6219,7 @@ function createParagraphStylesStore(editor) {
|
|
|
6244
6219
|
}
|
|
6245
6220
|
|
|
6246
6221
|
// src/extensions/rich-text-preset.ts
|
|
6247
|
-
var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess',
|
|
6222
|
+
var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _225 => _225[name]]) || _optionalChain([mod, 'optionalAccess', _226 => _226.default, 'optionalAccess', _227 => _227[name]]) || _optionalChain([mod, 'optionalAccess', _228 => _228.default, 'optionalAccess', _229 => _229.default]) || _optionalChain([mod, 'optionalAccess', _230 => _230.default]) || mod;
|
|
6248
6223
|
var StarterKit = resolveExt3(_StarterKit, "StarterKit");
|
|
6249
6224
|
var Color = resolveExt3(_Color, "Color");
|
|
6250
6225
|
var Highlight = resolveExt3(_Highlight, "Highlight");
|
|
@@ -6325,7 +6300,7 @@ function createRichTextPreset(options = {}) {
|
|
|
6325
6300
|
find: /^\s*(\[([ |x])?\])\s$/i,
|
|
6326
6301
|
type: this.type,
|
|
6327
6302
|
getAttributes: (match) => ({
|
|
6328
|
-
checked: _optionalChain([match, 'access',
|
|
6303
|
+
checked: _optionalChain([match, 'access', _231 => _231[2], 'optionalAccess', _232 => _232.toLowerCase, 'call', _233 => _233()]) === "x"
|
|
6329
6304
|
})
|
|
6330
6305
|
})
|
|
6331
6306
|
];
|
|
@@ -6340,7 +6315,7 @@ function createRichTextPreset(options = {}) {
|
|
|
6340
6315
|
})
|
|
6341
6316
|
];
|
|
6342
6317
|
if (options.table !== false) {
|
|
6343
|
-
extensions2.push(...
|
|
6318
|
+
extensions2.push(..._chunkMUCYWI6Wcjs.createTableExtensions.call(void 0, optionObject(options.table)));
|
|
6344
6319
|
}
|
|
6345
6320
|
if (characterLimit) {
|
|
6346
6321
|
extensions2.push(
|
|
@@ -6445,6 +6420,11 @@ function createRichTextPreset(options = {}) {
|
|
|
6445
6420
|
if (options.findReplace) {
|
|
6446
6421
|
extensions2.push(FindReplace.configure(optionObject(options.findReplace)));
|
|
6447
6422
|
}
|
|
6423
|
+
if (options.chart) {
|
|
6424
|
+
const { sparkline = true, ...chartOptions } = optionObject(options.chart);
|
|
6425
|
+
extensions2.push(_chunkMUCYWI6Wcjs.Chart.configure(chartOptions));
|
|
6426
|
+
if (sparkline) extensions2.push(_chunkMUCYWI6Wcjs.Sparkline.configure(optionObject(sparkline)));
|
|
6427
|
+
}
|
|
6448
6428
|
if (options.paragraphStyles) {
|
|
6449
6429
|
extensions2.push(ParagraphStyles.configure(optionObject(options.paragraphStyles)));
|
|
6450
6430
|
}
|
|
@@ -6496,7 +6476,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6496
6476
|
const hasMatches = () => {
|
|
6497
6477
|
const ok = usable(editor);
|
|
6498
6478
|
if (ok !== true) return ok;
|
|
6499
|
-
return _optionalChain([state, 'call',
|
|
6479
|
+
return _optionalChain([state, 'call', _234 => _234(), 'optionalAccess', _235 => _235.matches, 'access', _236 => _236.length]) ? true : "No matches.";
|
|
6500
6480
|
};
|
|
6501
6481
|
const apply = (params) => {
|
|
6502
6482
|
const split = splitParams(params);
|
|
@@ -6504,7 +6484,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6504
6484
|
};
|
|
6505
6485
|
const failIfInvalid = () => {
|
|
6506
6486
|
const s = state();
|
|
6507
|
-
if (_optionalChain([s, 'optionalAccess',
|
|
6487
|
+
if (_optionalChain([s, 'optionalAccess', _237 => _237.error])) throw new Error(s.error.message);
|
|
6508
6488
|
};
|
|
6509
6489
|
return [
|
|
6510
6490
|
{
|
|
@@ -6543,9 +6523,9 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6543
6523
|
failIfInvalid();
|
|
6544
6524
|
const s = state();
|
|
6545
6525
|
return {
|
|
6546
|
-
count: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
6547
|
-
truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
6548
|
-
matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
6526
|
+
count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _238 => _238.matches, 'access', _239 => _239.length]), () => ( 0)),
|
|
6527
|
+
truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _240 => _240.truncated]), () => ( false)),
|
|
6528
|
+
matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _241 => _241.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
|
|
6549
6529
|
};
|
|
6550
6530
|
}
|
|
6551
6531
|
},
|
|
@@ -6572,11 +6552,11 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6572
6552
|
description: "Replaces every match (one undo step). Tracked when Track Changes is on.",
|
|
6573
6553
|
params: searchParams(true),
|
|
6574
6554
|
...scope,
|
|
6575
|
-
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess',
|
|
6555
|
+
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _242 => _242.query]) !== void 0 ? usable(editor) : hasMatches(),
|
|
6576
6556
|
run: (_ctx, params) => {
|
|
6577
6557
|
apply(params);
|
|
6578
6558
|
failIfInvalid();
|
|
6579
|
-
const count = _nullishCoalesce(_optionalChain([state, 'call',
|
|
6559
|
+
const count = _nullishCoalesce(_optionalChain([state, 'call', _243 => _243(), 'optionalAccess', _244 => _244.matches, 'access', _245 => _245.length]), () => ( 0));
|
|
6580
6560
|
if (count) editor.commands.replaceAll();
|
|
6581
6561
|
return { replaced: count };
|
|
6582
6562
|
}
|
|
@@ -6584,7 +6564,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6584
6564
|
];
|
|
6585
6565
|
}
|
|
6586
6566
|
function validateFindPattern(query, options = {}) {
|
|
6587
|
-
const result =
|
|
6567
|
+
const result = _chunkMUCYWI6Wcjs.compileFindPattern.call(void 0, query, options);
|
|
6588
6568
|
return result.ok ? null : result.error;
|
|
6589
6569
|
}
|
|
6590
6570
|
|
|
@@ -6593,8 +6573,8 @@ var PARAMS = {
|
|
|
6593
6573
|
insertTable: {
|
|
6594
6574
|
type: "object",
|
|
6595
6575
|
properties: {
|
|
6596
|
-
rows: { type: "integer", minimum: 1, maximum:
|
|
6597
|
-
cols: { type: "integer", minimum: 1, maximum:
|
|
6576
|
+
rows: { type: "integer", minimum: 1, maximum: _chunkMUCYWI6Wcjs.MAX_TABLE_ROWS, description: "Rows (default 3)." },
|
|
6577
|
+
cols: { type: "integer", minimum: 1, maximum: _chunkMUCYWI6Wcjs.MAX_TABLE_COLUMNS, description: "Columns (default 3)." },
|
|
6598
6578
|
withHeaderRow: { type: "boolean", description: "Make the first row a header row (default true)." }
|
|
6599
6579
|
},
|
|
6600
6580
|
additionalProperties: false
|
|
@@ -6625,7 +6605,7 @@ function createTableCommands(editor, options = {}) {
|
|
|
6625
6605
|
const group = _nullishCoalesce(options.group, () => ( "Table"));
|
|
6626
6606
|
const scope = options.scope ? { scope: options.scope } : {};
|
|
6627
6607
|
const focus = _nullishCoalesce(options.focus, () => ( true));
|
|
6628
|
-
return
|
|
6608
|
+
return _chunkMUCYWI6Wcjs.TABLE_ACTIONS.map(({ action, label, description, keywords }) => {
|
|
6629
6609
|
const params = PARAMS[action];
|
|
6630
6610
|
return {
|
|
6631
6611
|
id: `${prefix}${action}`,
|
|
@@ -6635,13 +6615,13 @@ function createTableCommands(editor, options = {}) {
|
|
|
6635
6615
|
description,
|
|
6636
6616
|
...params ? { params } : {},
|
|
6637
6617
|
...scope,
|
|
6638
|
-
enabled: (_ctx, p) =>
|
|
6618
|
+
enabled: (_ctx, p) => _chunkMUCYWI6Wcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {}))),
|
|
6639
6619
|
run: (_ctx, p) => {
|
|
6640
|
-
if (!
|
|
6641
|
-
const reason =
|
|
6620
|
+
if (!_chunkMUCYWI6Wcjs.runTableAction.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})), { focus })) {
|
|
6621
|
+
const reason = _chunkMUCYWI6Wcjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})));
|
|
6642
6622
|
throw new Error(reason === true ? `${label} did not change the document.` : reason);
|
|
6643
6623
|
}
|
|
6644
|
-
const state =
|
|
6624
|
+
const state = _chunkMUCYWI6Wcjs.getTableState.call(void 0, editor);
|
|
6645
6625
|
return {
|
|
6646
6626
|
done: true,
|
|
6647
6627
|
table: state.inTable ? { rows: state.rows, columns: state.columns, row: state.row, column: state.column } : null
|
|
@@ -6773,4 +6753,4 @@ function createTableCommands(editor, options = {}) {
|
|
|
6773
6753
|
|
|
6774
6754
|
|
|
6775
6755
|
exports.GradientText = GradientText; exports.SlashCommands = SlashCommands; exports.TemplateSuggestions = TemplateSuggestions; exports.LoadingNode = LoadingNode; exports.SMILIE_REPLACEMENTS = SMILIE_REPLACEMENTS; exports.smilieAutocorrectRules = smilieAutocorrectRules; exports.SmilieReplacer = SmilieReplacer; exports.findHexColors = findHexColors; exports.ColorHighlighter = ColorHighlighter; exports.FontSize = FontSize; exports.Mention = Mention; exports.getMentionNodes = getMentionNodes; exports.setMentionRoleAt = setMentionRoleAt; exports.createMentionExtension = createMentionExtension; exports.Markdown = Markdown2; exports.imagePastePluginKey = imagePastePluginKey; exports.insertImageNode = insertImageNode; exports.updateImageSrc = updateImageSrc; exports.removeImageNode = removeImageNode; exports.handleImageInsertion = handleImageInsertion; exports.Image = Image2; exports.commentsPluginKey = commentsPluginKey; exports.COMMENT_MARK_NAME = COMMENT_MARK_NAME; exports.findCommentRanges = findCommentRanges; exports.getCommentAnchors = getCommentAnchors; exports.getCommentIdsAt = getCommentIdsAt; exports.getCommentStore = getCommentStore; exports.Comments = Comments; exports.getCommentAuthor = getCommentAuthor; exports.compareInEditor = compareInEditor; exports.applyDocumentComparison = applyDocumentComparison; exports.DocumentCompare = DocumentCompare; exports.ImportError = ImportError; exports.createImportContext = createImportContext; exports.ImportAdapterRegistry = ImportAdapterRegistry; exports.DOCX_MIME_TYPES = DOCX_MIME_TYPES; exports.DEFAULT_DOCX_MAX_IMAGE_SIZE = DEFAULT_DOCX_MAX_IMAGE_SIZE; exports.docxToDocumentImport = docxToDocumentImport; exports.createDocxImportAdapter = createDocxImportAdapter; exports.docxImportAdapter = docxImportAdapter; exports.markdownImportAdapter = markdownImportAdapter; exports.htmlImportAdapter = htmlImportAdapter; exports.plainTextImportAdapter = plainTextImportAdapter; exports.rtfImportAdapter = rtfImportAdapter; exports.BUILT_IN_IMPORT_ADAPTERS = BUILT_IN_IMPORT_ADAPTERS; exports.createImportAdapterRegistry = createImportAdapterRegistry; exports.defaultImportRegistry = defaultImportRegistry; exports.registerImportAdapter = registerImportAdapter; exports.unregisterImportAdapter = unregisterImportAdapter; exports.findImportAdapter = findImportAdapter; exports.importFile = importFile; exports.getImportAccept = getImportAccept; exports.htmlToSlice = htmlToSlice; exports.insertImportedDocument = insertImportedDocument; exports.applyImportedReviewData = applyImportedReviewData; exports.importFilesIntoEditor = importFilesIntoEditor; exports.fileImportPluginKey = fileImportPluginKey; exports.FileImport = FileImport; exports.richClipboardPluginKey = richClipboardPluginKey; exports.writeRichClipboard = writeRichClipboard; exports.RichClipboard = RichClipboard; exports.smartQuoteRules = smartQuoteRules; exports.symbolRules = symbolRules; exports.fractionRules = fractionRules; exports.capitalizeSentenceRules = capitalizeSentenceRules; exports.twoInitialCapitalsRules = twoInitialCapitalsRules; exports.defaultAutocorrectRules = defaultAutocorrectRules; exports.DEFAULT_AUTOCORRECT_EXCEPTIONS = DEFAULT_AUTOCORRECT_EXCEPTIONS; exports.autocorrectPluginKey = autocorrectPluginKey; exports.findAutocorrection = findAutocorrection; exports.isInsidePromptToken = isInsidePromptToken; exports.Autocorrect = Autocorrect; exports.outlinePluginKey = outlinePluginKey; exports.computeOutline = computeOutline; exports.buildOutlineTree = buildOutlineTree; exports.getOutline = getOutline; exports.getActiveHeading = getActiveHeading; exports.createOutlineStore = createOutlineStore; exports.navigateToHeading = navigateToHeading; exports.Outline = Outline; exports.tableOfContentsMarkdownIt = tableOfContentsMarkdownIt; exports.footnotesMarkdownIt = footnotesMarkdownIt; exports.tableOfContentsPluginKey = tableOfContentsPluginKey; exports.getTableOfContentsEntries = getTableOfContentsEntries; exports.TableOfContents = TableOfContents; exports.footnotesPluginKey = footnotesPluginKey; exports.getFootnotes = getFootnotes; exports.syncFootnotes = syncFootnotes; exports.FootnoteReference = FootnoteReference; exports.Footnotes = Footnotes; exports.Footnote = Footnote; exports.getBookmarks = getBookmarks; exports.Bookmark = Bookmark; exports.crossReferencePluginKey = crossReferencePluginKey; exports.getCrossReferenceTargets = getCrossReferenceTargets; exports.CrossReference = CrossReference; exports.documentStructureCommandItems = documentStructureCommandItems; exports.getDocumentStructureCommandItems = getDocumentStructureCommandItems; exports.EMPTY_FIND_REPLACE_SNAPSHOT = EMPTY_FIND_REPLACE_SNAPSHOT; exports.FindReplaceStore = FindReplaceStore; exports.findReplacePluginKey = findReplacePluginKey; exports.getFindReplaceState = getFindReplaceState; exports.getFindReplaceStore = getFindReplaceStore; exports.FIND_OPTION_TOGGLES = FIND_OPTION_TOGGLES; exports.formatFindStatus = formatFindStatus; exports.FindReplace = FindReplace; exports.STYLE_ID_ATTRIBUTE = STYLE_ID_ATTRIBUTE; exports.CHARACTER_STYLE_MARK_NAME = CHARACTER_STYLE_MARK_NAME; exports.paragraphStylesPluginKey = paragraphStylesPluginKey; exports.getStyleRegistry = getStyleRegistry; exports.isParagraphStyleAvailable = isParagraphStyleAvailable; exports.getParagraphStyleAt = getParagraphStyleAt; exports.captureSelectionFormat = captureSelectionFormat; exports.CharacterStyle = CharacterStyle; exports.ParagraphStyles = ParagraphStyles; exports.createParagraphStylesStore = createParagraphStylesStore; exports.createRichTextPreset = createRichTextPreset; exports.createFindReplaceCommands = createFindReplaceCommands; exports.validateFindPattern = validateFindPattern; exports.createTableCommands = createTableCommands;
|
|
6776
|
-
//# sourceMappingURL=chunk-
|
|
6756
|
+
//# sourceMappingURL=chunk-WXEHCVJQ.cjs.map
|