@pixerate/editor 0.236.0 → 0.237.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 +1 -1
- package/dist/{chunk-WPWHT4Z6.cjs → chunk-CZWUDFR3.cjs} +169 -92
- package/dist/{chunk-PHYOZK3B.js → chunk-JVSX5QTS.js} +82 -5
- package/dist/extensions/index.cjs +4 -2
- package/dist/extensions/index.js +3 -1
- package/dist/extensions/loading-node.d.cts +45 -1
- package/dist/extensions/loading-node.d.ts +45 -1
- package/dist/index.cjs +9 -7
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -411,12 +411,66 @@ var TemplateSuggestions = _core.Extension.create({
|
|
|
411
411
|
|
|
412
412
|
// src/extensions/loading-node.ts
|
|
413
413
|
|
|
414
|
+
var _model = require('@tiptap/pm/model');
|
|
415
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
416
|
+
function loadingSpinnerSpec() {
|
|
417
|
+
return [
|
|
418
|
+
`${SVG_NS} svg`,
|
|
419
|
+
{
|
|
420
|
+
width: "1em",
|
|
421
|
+
height: "1em",
|
|
422
|
+
viewBox: "0 0 24 24",
|
|
423
|
+
fill: "none",
|
|
424
|
+
"aria-hidden": "true",
|
|
425
|
+
focusable: "false",
|
|
426
|
+
"data-loading-indicator": ""
|
|
427
|
+
},
|
|
428
|
+
["circle", { cx: "12", cy: "12", r: "9", stroke: "currentColor", "stroke-width": "3", opacity: "0.25" }],
|
|
429
|
+
[
|
|
430
|
+
"path",
|
|
431
|
+
{ d: "M21 12a9 9 0 0 0-9-9", stroke: "currentColor", "stroke-width": "3", "stroke-linecap": "round" },
|
|
432
|
+
[
|
|
433
|
+
"animateTransform",
|
|
434
|
+
{
|
|
435
|
+
attributeName: "transform",
|
|
436
|
+
type: "rotate",
|
|
437
|
+
from: "0 12 12",
|
|
438
|
+
to: "360 12 12",
|
|
439
|
+
dur: "0.8s",
|
|
440
|
+
repeatCount: "indefinite"
|
|
441
|
+
}
|
|
442
|
+
]
|
|
443
|
+
]
|
|
444
|
+
];
|
|
445
|
+
}
|
|
446
|
+
var viewState = (node, options) => ({
|
|
447
|
+
id: _nullishCoalesce(node.attrs.id, () => ( null)),
|
|
448
|
+
label: options.label
|
|
449
|
+
});
|
|
450
|
+
var placeholderAttributes = (options, HTMLAttributes) => _chunk34RQAGWIcjs.safeMergeAttributes.call(void 0,
|
|
451
|
+
{
|
|
452
|
+
"data-type": "loading",
|
|
453
|
+
role: "status",
|
|
454
|
+
"aria-label": options.label,
|
|
455
|
+
class: "inline-flex items-center px-1.5 py-0.5 text-xs text-muted-foreground"
|
|
456
|
+
},
|
|
457
|
+
options.HTMLAttributes,
|
|
458
|
+
HTMLAttributes
|
|
459
|
+
);
|
|
414
460
|
var LoadingNode = _core.Node.create({
|
|
415
461
|
name: "loadingNode",
|
|
416
462
|
group: "inline",
|
|
417
463
|
inline: true,
|
|
418
464
|
selectable: true,
|
|
419
465
|
atom: true,
|
|
466
|
+
addOptions() {
|
|
467
|
+
return {
|
|
468
|
+
label: "Loading\u2026",
|
|
469
|
+
HTMLAttributes: {},
|
|
470
|
+
renderIndicator: null,
|
|
471
|
+
nodeView: null
|
|
472
|
+
};
|
|
473
|
+
},
|
|
420
474
|
addAttributes() {
|
|
421
475
|
return {
|
|
422
476
|
id: {
|
|
@@ -439,12 +493,34 @@ var LoadingNode = _core.Node.create({
|
|
|
439
493
|
renderHTML({ HTMLAttributes }) {
|
|
440
494
|
return [
|
|
441
495
|
"span",
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
class: "inline-flex items-center px-1.5 py-0.5 text-xs text-muted-foreground animate-pulse"
|
|
445
|
-
}),
|
|
446
|
-
"\u23F3"
|
|
496
|
+
placeholderAttributes(this.options, HTMLAttributes),
|
|
497
|
+
(_nullishCoalesce(this.options.renderIndicator, () => ( loadingSpinnerSpec)))()
|
|
447
498
|
];
|
|
499
|
+
},
|
|
500
|
+
addNodeView() {
|
|
501
|
+
const options = this.options;
|
|
502
|
+
return ({ node, HTMLAttributes }) => {
|
|
503
|
+
const mount = options.nodeView;
|
|
504
|
+
const { dom } = _model.DOMSerializer.renderSpec(document, [
|
|
505
|
+
"span",
|
|
506
|
+
placeholderAttributes(options, HTMLAttributes),
|
|
507
|
+
...mount ? [] : [(_nullishCoalesce(options.renderIndicator, () => ( loadingSpinnerSpec)))()]
|
|
508
|
+
]);
|
|
509
|
+
const element = dom;
|
|
510
|
+
const renderer = _nullishCoalesce(_optionalChain([mount, 'optionalCall', _31 => _31(element, viewState(node, options))]), () => ( null));
|
|
511
|
+
return {
|
|
512
|
+
dom: element,
|
|
513
|
+
update: (next) => {
|
|
514
|
+
if (next.type !== node.type) return false;
|
|
515
|
+
if (next.attrs.id) element.setAttribute("data-id", String(next.attrs.id));
|
|
516
|
+
else element.removeAttribute("data-id");
|
|
517
|
+
_optionalChain([renderer, 'optionalAccess', _32 => _32.update, 'call', _33 => _33(viewState(next, options))]);
|
|
518
|
+
return true;
|
|
519
|
+
},
|
|
520
|
+
ignoreMutation: () => true,
|
|
521
|
+
destroy: () => _optionalChain([renderer, 'optionalAccess', _34 => _34.destroy, 'call', _35 => _35()])
|
|
522
|
+
};
|
|
523
|
+
};
|
|
448
524
|
}
|
|
449
525
|
});
|
|
450
526
|
|
|
@@ -614,11 +690,11 @@ var _extensioncharactercount = require('@tiptap/extension-character-count'); var
|
|
|
614
690
|
|
|
615
691
|
|
|
616
692
|
var _extensionmention = require('@tiptap/extension-mention');
|
|
617
|
-
var BaseMention = _extensionmention.Mention || _optionalChain([_extensionmention.Mention, 'optionalAccess',
|
|
693
|
+
var BaseMention = _extensionmention.Mention || _optionalChain([_extensionmention.Mention, 'optionalAccess', _36 => _36.default, 'optionalAccess', _37 => _37.default]) || _optionalChain([_extensionmention.Mention, 'optionalAccess', _38 => _38.default]) || _extensionmention.Mention;
|
|
618
694
|
var Mention = BaseMention.extend({
|
|
619
695
|
addAttributes() {
|
|
620
696
|
return {
|
|
621
|
-
..._optionalChain([this, 'access',
|
|
697
|
+
..._optionalChain([this, 'access', _39 => _39.parent, 'optionalCall', _40 => _40()]),
|
|
622
698
|
type: {
|
|
623
699
|
default: null,
|
|
624
700
|
parseHTML: (element) => element.getAttribute("data-type-name") || element.getAttribute("data-entity-type"),
|
|
@@ -664,7 +740,7 @@ var MENTION_ROLE_PATTERN = /^[A-Za-z](?:[A-Za-z0-9_-]*[A-Za-z0-9])?$/;
|
|
|
664
740
|
function getMentionNodes(editor) {
|
|
665
741
|
const result = [];
|
|
666
742
|
editor.state.doc.descendants((node, pos) => {
|
|
667
|
-
if (_optionalChain([node, 'access',
|
|
743
|
+
if (_optionalChain([node, 'access', _41 => _41.type, 'optionalAccess', _42 => _42.name]) !== "mention") return;
|
|
668
744
|
result.push({
|
|
669
745
|
pos,
|
|
670
746
|
id: _nullishCoalesce(node.attrs.id, () => ( "")),
|
|
@@ -676,7 +752,7 @@ function getMentionNodes(editor) {
|
|
|
676
752
|
return result;
|
|
677
753
|
}
|
|
678
754
|
function setMentionRoleAt(editor, pos, role) {
|
|
679
|
-
const node = _optionalChain([editor, 'optionalAccess',
|
|
755
|
+
const node = _optionalChain([editor, 'optionalAccess', _43 => _43.state, 'optionalAccess', _44 => _44.doc, 'optionalAccess', _45 => _45.nodeAt, 'call', _46 => _46(pos)]);
|
|
680
756
|
if (!node || node.type.name !== "mention") return false;
|
|
681
757
|
if (role !== null && !MENTION_ROLE_PATTERN.test(role)) return false;
|
|
682
758
|
const tr = editor.state.tr.setNodeMarkup(pos, void 0, { ...node.attrs, assetRole: role });
|
|
@@ -698,7 +774,7 @@ function createMentionExtension(options = {}) {
|
|
|
698
774
|
|
|
699
775
|
var _prosemirrormarkdown = require('prosemirror-markdown');
|
|
700
776
|
var _markdownit = require('markdown-it'); var _markdownit2 = _interopRequireDefault(_markdownit);
|
|
701
|
-
|
|
777
|
+
|
|
702
778
|
var _markdownittasklists = require('markdown-it-task-lists'); var _markdownittasklists2 = _interopRequireDefault(_markdownittasklists);
|
|
703
779
|
|
|
704
780
|
var __defProp = Object.defineProperty;
|
|
@@ -1704,13 +1780,13 @@ var Markdown = _core.Extension.create({
|
|
|
1704
1780
|
});
|
|
1705
1781
|
|
|
1706
1782
|
// src/extensions/markdown.ts
|
|
1707
|
-
var resolveExt = (mod, name) => _optionalChain([mod, 'optionalAccess',
|
|
1783
|
+
var resolveExt = (mod, name) => _optionalChain([mod, 'optionalAccess', _47 => _47[name]]) || _optionalChain([mod, 'optionalAccess', _48 => _48.default, 'optionalAccess', _49 => _49[name]]) || _optionalChain([mod, 'optionalAccess', _50 => _50.default, 'optionalAccess', _51 => _51.default]) || _optionalChain([mod, 'optionalAccess', _52 => _52.default]) || mod;
|
|
1708
1784
|
var Markdown2 = resolveExt(Markdown, "Markdown");
|
|
1709
1785
|
|
|
1710
1786
|
// src/extensions/image.ts
|
|
1711
1787
|
var _extensionimage = require('@tiptap/extension-image'); var _Image = _interopRequireWildcard(_extensionimage);
|
|
1712
1788
|
|
|
1713
|
-
var resolveExt2 = (mod, name) => _optionalChain([mod, 'optionalAccess',
|
|
1789
|
+
var resolveExt2 = (mod, name) => _optionalChain([mod, 'optionalAccess', _53 => _53[name]]) || _optionalChain([mod, 'optionalAccess', _54 => _54.default, 'optionalAccess', _55 => _55[name]]) || _optionalChain([mod, 'optionalAccess', _56 => _56.default, 'optionalAccess', _57 => _57.default]) || _optionalChain([mod, 'optionalAccess', _58 => _58.default]) || mod;
|
|
1714
1790
|
var BaseImage = resolveExt2(_Image, "Image");
|
|
1715
1791
|
var imagePastePluginKey = new (0, _state.PluginKey)("imagePasteHandler");
|
|
1716
1792
|
function insertImageNode(view, src, alt) {
|
|
@@ -1817,7 +1893,7 @@ function handleImageInsertion(view, file, options) {
|
|
|
1817
1893
|
var Image2 = BaseImage.extend({
|
|
1818
1894
|
addOptions() {
|
|
1819
1895
|
return {
|
|
1820
|
-
..._optionalChain([this, 'access',
|
|
1896
|
+
..._optionalChain([this, 'access', _59 => _59.parent, 'optionalCall', _60 => _60()]),
|
|
1821
1897
|
allowBase64: true,
|
|
1822
1898
|
maxBase64Size: 65536,
|
|
1823
1899
|
enablePaste: true,
|
|
@@ -1830,7 +1906,7 @@ var Image2 = BaseImage.extend({
|
|
|
1830
1906
|
};
|
|
1831
1907
|
},
|
|
1832
1908
|
addProseMirrorPlugins() {
|
|
1833
|
-
const parentPlugins = _optionalChain([this, 'access',
|
|
1909
|
+
const parentPlugins = _optionalChain([this, 'access', _61 => _61.parent, 'optionalCall', _62 => _62()]) || [];
|
|
1834
1910
|
const options = this.options;
|
|
1835
1911
|
if (!options.enablePaste && !options.enableDrop) {
|
|
1836
1912
|
return parentPlugins;
|
|
@@ -1840,7 +1916,7 @@ var Image2 = BaseImage.extend({
|
|
|
1840
1916
|
props: {
|
|
1841
1917
|
handlePaste(view, event) {
|
|
1842
1918
|
if (!options.enablePaste) return false;
|
|
1843
|
-
const items = Array.from(_optionalChain([event, 'access',
|
|
1919
|
+
const items = Array.from(_optionalChain([event, 'access', _63 => _63.clipboardData, 'optionalAccess', _64 => _64.items]) || []);
|
|
1844
1920
|
const imageItems = items.filter(
|
|
1845
1921
|
(item) => item.kind === "file" && item.type.startsWith("image/")
|
|
1846
1922
|
);
|
|
@@ -1855,7 +1931,7 @@ var Image2 = BaseImage.extend({
|
|
|
1855
1931
|
},
|
|
1856
1932
|
handleDrop(view, event) {
|
|
1857
1933
|
if (!options.enableDrop) return false;
|
|
1858
|
-
const files = Array.from(_optionalChain([event, 'access',
|
|
1934
|
+
const files = Array.from(_optionalChain([event, 'access', _65 => _65.dataTransfer, 'optionalAccess', _66 => _66.files]) || []);
|
|
1859
1935
|
const imageFiles = files.filter((f) => f.type.startsWith("image/"));
|
|
1860
1936
|
if (imageFiles.length === 0) return false;
|
|
1861
1937
|
event.preventDefault();
|
|
@@ -1873,7 +1949,7 @@ var Image2 = BaseImage.extend({
|
|
|
1873
1949
|
// src/extensions/document-compare.ts
|
|
1874
1950
|
|
|
1875
1951
|
function trackChangesAuthor(state) {
|
|
1876
|
-
return _optionalChain([_chunk34RQAGWIcjs.trackChangesPluginKey, 'access',
|
|
1952
|
+
return _optionalChain([_chunk34RQAGWIcjs.trackChangesPluginKey, 'access', _67 => _67.getState, 'call', _68 => _68(state), 'optionalAccess', _69 => _69.author]);
|
|
1877
1953
|
}
|
|
1878
1954
|
function compareInEditor(editor, original, revised, options = {}) {
|
|
1879
1955
|
return _chunkHMGWFXECcjs.compareDocuments.call(void 0, original, revised, {
|
|
@@ -2007,7 +2083,7 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
|
|
|
2007
2083
|
* wildcards, then higher `priority`, then the most recently registered.
|
|
2008
2084
|
*/
|
|
2009
2085
|
find(query) {
|
|
2010
|
-
const fileName = _nullishCoalesce(_optionalChain([query, 'access',
|
|
2086
|
+
const fileName = _nullishCoalesce(_optionalChain([query, 'access', _70 => _70.fileName, 'optionalAccess', _71 => _71.toLowerCase, 'call', _72 => _72()]), () => ( ""));
|
|
2011
2087
|
const mime = normalizeMimeType(query.mimeType);
|
|
2012
2088
|
let best;
|
|
2013
2089
|
let bestScore = 0;
|
|
@@ -2088,7 +2164,7 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
|
|
|
2088
2164
|
mimeType,
|
|
2089
2165
|
target: adapter.target,
|
|
2090
2166
|
registry: this,
|
|
2091
|
-
options: _optionalChain([options, 'access',
|
|
2167
|
+
options: _optionalChain([options, 'access', _73 => _73.adapterOptions, 'optionalAccess', _74 => _74[adapter.id]])
|
|
2092
2168
|
});
|
|
2093
2169
|
try {
|
|
2094
2170
|
const result = await adapter.import(input, context);
|
|
@@ -2158,7 +2234,7 @@ function descendants(el, localName) {
|
|
|
2158
2234
|
}
|
|
2159
2235
|
function toggle(el) {
|
|
2160
2236
|
if (!el) return void 0;
|
|
2161
|
-
const value = _optionalChain([attr, 'call',
|
|
2237
|
+
const value = _optionalChain([attr, 'call', _75 => _75(el, "val"), 'optionalAccess', _76 => _76.toLowerCase, 'call', _77 => _77()]);
|
|
2162
2238
|
return value === void 0 || !["0", "false", "off", "none"].includes(value);
|
|
2163
2239
|
}
|
|
2164
2240
|
function parseXml(Parser, xml, partName) {
|
|
@@ -2199,7 +2275,7 @@ async function readRelationships(zip, Parser, partPath) {
|
|
|
2199
2275
|
const id = attr(rel, "Id");
|
|
2200
2276
|
const target = _nullishCoalesce(attr(rel, "Target"), () => ( ""));
|
|
2201
2277
|
if (!id) return;
|
|
2202
|
-
const external = _optionalChain([attr, 'call',
|
|
2278
|
+
const external = _optionalChain([attr, 'call', _78 => _78(rel, "TargetMode"), 'optionalAccess', _79 => _79.toLowerCase, 'call', _80 => _80()]) === "external";
|
|
2203
2279
|
rels.set(id, {
|
|
2204
2280
|
type: _nullishCoalesce(attr(rel, "Type"), () => ( "")),
|
|
2205
2281
|
target: external ? target : resolvePartPath(baseDir, target),
|
|
@@ -2262,7 +2338,7 @@ async function loadImages(zip, root, rels, options) {
|
|
|
2262
2338
|
for (const id of ids) {
|
|
2263
2339
|
const rel = rels.get(id);
|
|
2264
2340
|
if (!rel || rel.external) continue;
|
|
2265
|
-
const mime = IMAGE_MIME_TYPES[_nullishCoalesce(_optionalChain([rel, 'access',
|
|
2341
|
+
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()]), () => ( ""))];
|
|
2266
2342
|
const entry = zip.get(rel.target);
|
|
2267
2343
|
if (!mime || !entry || entry.size > maxSize) continue;
|
|
2268
2344
|
images.set(id, `data:${mime};base64,${toBase64(await zip.read(entry))}`);
|
|
@@ -2401,7 +2477,7 @@ function mapStyleIds(styles) {
|
|
|
2401
2477
|
});
|
|
2402
2478
|
return ids;
|
|
2403
2479
|
}
|
|
2404
|
-
var styleKind = (style) => _optionalChain([style, 'optionalAccess',
|
|
2480
|
+
var styleKind = (style) => _optionalChain([style, 'optionalAccess', _88 => _88.type]) === "character" ? "character" : "paragraph";
|
|
2405
2481
|
function styleDefinitions(styles, ids) {
|
|
2406
2482
|
const out = [];
|
|
2407
2483
|
styles.forEach((style, fileId) => {
|
|
@@ -2727,9 +2803,9 @@ function parseHyperlinkInstruction(instr) {
|
|
|
2727
2803
|
const match = /^\s*HYPERLINK\b(.*)$/i.exec(instr);
|
|
2728
2804
|
if (!match) return void 0;
|
|
2729
2805
|
const rest = match[1];
|
|
2730
|
-
const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access',
|
|
2806
|
+
const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _89 => _89.exec, 'call', _90 => _90(rest), 'optionalAccess', _91 => _91[1]]);
|
|
2731
2807
|
const target = /^\s*(?:"([^"]*)"|([^\s\\]+))/.exec(rest);
|
|
2732
|
-
const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
2808
|
+
const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _92 => _92[1]]), () => ( _optionalChain([target, 'optionalAccess', _93 => _93[2]])));
|
|
2733
2809
|
if (url) return anchor ? `${url}#${anchor}` : url;
|
|
2734
2810
|
return anchor ? `#${anchor}` : void 0;
|
|
2735
2811
|
}
|
|
@@ -2764,7 +2840,7 @@ var ParagraphRenderer = (_class2 = class {
|
|
|
2764
2840
|
else {
|
|
2765
2841
|
this.segments.shift();
|
|
2766
2842
|
const next = this.segments[0];
|
|
2767
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
2843
|
+
if (_optionalChain([next, 'optionalAccess', _94 => _94.kind]) === "text") {
|
|
2768
2844
|
next.text = next.text.replace(/^ /, "");
|
|
2769
2845
|
if (!next.text) this.segments.shift();
|
|
2770
2846
|
}
|
|
@@ -2862,7 +2938,7 @@ var ParagraphRenderer = (_class2 = class {
|
|
|
2862
2938
|
run(r, base) {
|
|
2863
2939
|
const rPr = wChild(r, "rPr");
|
|
2864
2940
|
const runStyle = this.ctx.styles.get(_nullishCoalesce(attr(wChild(rPr, "rStyle"), "val"), () => ( "")));
|
|
2865
|
-
const styleFormat = base.href && runStyle && /^hyperlink$/i.test(runStyle.name) ? {} : _nullishCoalesce(_optionalChain([runStyle, 'optionalAccess',
|
|
2941
|
+
const styleFormat = base.href && runStyle && /^hyperlink$/i.test(runStyle.name) ? {} : _nullishCoalesce(_optionalChain([runStyle, 'optionalAccess', _95 => _95.format]), () => ( {}));
|
|
2866
2942
|
const own = readFormat(rPr);
|
|
2867
2943
|
const format = { ...base, ...styleFormat, ...own };
|
|
2868
2944
|
const rPrChange = wChild(rPr, "rPrChange");
|
|
@@ -3029,15 +3105,15 @@ function paragraphInfo(p, ctx) {
|
|
|
3029
3105
|
heading = styleHeadingLevel(ctx.styles, styleId);
|
|
3030
3106
|
}
|
|
3031
3107
|
let numPr = readNumPr(pPr);
|
|
3032
|
-
if (!numPr) numPr = _optionalChain([styleChain, 'call',
|
|
3108
|
+
if (!numPr) numPr = _optionalChain([styleChain, 'call', _96 => _96(ctx.styles, styleId), 'access', _97 => _97.find, 'call', _98 => _98((style) => style.numPr), 'optionalAccess', _99 => _99.numPr]);
|
|
3033
3109
|
let list;
|
|
3034
3110
|
if (numPr && numPr.numId !== "0" && heading === void 0) {
|
|
3035
3111
|
const num = ctx.numbering.nums.get(numPr.numId);
|
|
3036
|
-
const def = num ? _optionalChain([ctx, 'access',
|
|
3112
|
+
const def = num ? _optionalChain([ctx, 'access', _100 => _100.numbering, 'access', _101 => _101.abstracts, 'access', _102 => _102.get, 'call', _103 => _103(num.abstractId), 'optionalAccess', _104 => _104.get, 'call', _105 => _105(numPr.ilvl)]) : void 0;
|
|
3037
3113
|
list = {
|
|
3038
3114
|
level: Math.max(0, Math.min(numPr.ilvl, 8)),
|
|
3039
|
-
ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess',
|
|
3040
|
-
start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess',
|
|
3115
|
+
ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _106 => _106.ordered]), () => ( false)),
|
|
3116
|
+
start: _nullishCoalesce(_nullishCoalesce(_optionalChain([num, 'optionalAccess', _107 => _107.starts, 'access', _108 => _108.get, 'call', _109 => _109(numPr.ilvl)]), () => ( _optionalChain([def, 'optionalAccess', _110 => _110.start]))), () => ( 1))
|
|
3041
3117
|
};
|
|
3042
3118
|
}
|
|
3043
3119
|
const special = heading === void 0 && !list ? specialStyle(ctx.styles, styleId) : void 0;
|
|
@@ -3171,7 +3247,7 @@ function renderTable(tbl, ctx, part) {
|
|
|
3171
3247
|
if (cell.merge === "restart") {
|
|
3172
3248
|
for (let r = rowIndex + 1; r < rows.length; r++) {
|
|
3173
3249
|
const below = rows[r].find((c) => c.col === cell.col);
|
|
3174
|
-
if (_optionalChain([below, 'optionalAccess',
|
|
3250
|
+
if (_optionalChain([below, 'optionalAccess', _111 => _111.merge]) !== "continue") break;
|
|
3175
3251
|
rowspan++;
|
|
3176
3252
|
}
|
|
3177
3253
|
}
|
|
@@ -3184,7 +3260,7 @@ function renderTable(tbl, ctx, part) {
|
|
|
3184
3260
|
return `${html}</tbody></table>`;
|
|
3185
3261
|
}
|
|
3186
3262
|
function getDomParser(options) {
|
|
3187
|
-
const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access',
|
|
3263
|
+
const Parser = _nullishCoalesce(_nullishCoalesce(options.DOMParser, () => ( globalThis.DOMParser)), () => ( _optionalChain([globalThis, 'access', _112 => _112.window, 'optionalAccess', _113 => _113.DOMParser])));
|
|
3188
3264
|
if (typeof Parser !== "function") {
|
|
3189
3265
|
throw new ImportError(
|
|
3190
3266
|
"unsupported_environment",
|
|
@@ -3199,7 +3275,7 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3199
3275
|
try {
|
|
3200
3276
|
zip = await _chunkALNIFK5Gcjs.readZip.call(void 0, data, { maxTotalSize: 100 * 1024 * 1024, maxEntries: 5e3, ...options.zip });
|
|
3201
3277
|
} catch (error) {
|
|
3202
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
3278
|
+
if (_optionalChain([error, 'optionalAccess', _114 => _114.code]) === "invalid_archive") {
|
|
3203
3279
|
throw new ImportError("invalid_file", "Not a DOCX file (the file is not a ZIP package).", { cause: error });
|
|
3204
3280
|
}
|
|
3205
3281
|
throw error;
|
|
@@ -3219,7 +3295,7 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3219
3295
|
throw new ImportError("invalid_file", "Not a Word document (no main document part with a body).");
|
|
3220
3296
|
}
|
|
3221
3297
|
const rels = await readRelationships(zip, Parser, mainPath);
|
|
3222
|
-
const partByType = (suffix) => _optionalChain([Array, 'access',
|
|
3298
|
+
const partByType = (suffix) => _optionalChain([Array, 'access', _115 => _115.from, 'call', _116 => _116(rels.values()), 'access', _117 => _117.find, 'call', _118 => _118((rel) => !rel.external && rel.type.endsWith(`/${suffix}`)), 'optionalAccess', _119 => _119.target]);
|
|
3223
3299
|
const baseDir = dirname(mainPath);
|
|
3224
3300
|
const stylesPath = _nullishCoalesce(partByType("styles"), () => ( `${baseDir}styles.xml`));
|
|
3225
3301
|
const numberingPath = _nullishCoalesce(partByType("numbering"), () => ( `${baseDir}numbering.xml`));
|
|
@@ -3384,7 +3460,7 @@ function getImportAccept(target) {
|
|
|
3384
3460
|
|
|
3385
3461
|
var toView = (target) => "state" in target && "dispatch" in target ? target : target.view;
|
|
3386
3462
|
function htmlToSlice(html, schema) {
|
|
3387
|
-
const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access',
|
|
3463
|
+
const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _120 => _120.window, 'optionalAccess', _121 => _121.DOMParser])));
|
|
3388
3464
|
if (!Parser) return null;
|
|
3389
3465
|
const body = new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
|
|
3390
3466
|
return new (0, _model.Slice)(_model.DOMParser.fromSchema(schema).parse(body).content, 0, 0);
|
|
@@ -3414,11 +3490,11 @@ function insertImportedDocument(target, content, options = {}) {
|
|
|
3414
3490
|
return end;
|
|
3415
3491
|
}
|
|
3416
3492
|
function applyImportedReviewData(editor, content) {
|
|
3417
|
-
const storage = _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
3493
|
+
const storage = _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _122 => _122.storage]), () => ( {}));
|
|
3418
3494
|
let comments = 0;
|
|
3419
3495
|
let styles = 0;
|
|
3420
|
-
const store = _optionalChain([storage, 'access',
|
|
3421
|
-
const threads = _nullishCoalesce(_optionalChain([content, 'access',
|
|
3496
|
+
const store = _optionalChain([storage, 'access', _123 => _123.comment, 'optionalAccess', _124 => _124.store]);
|
|
3497
|
+
const threads = _nullishCoalesce(_optionalChain([content, 'access', _125 => _125.comments, 'optionalAccess', _126 => _126.threads]), () => ( []));
|
|
3422
3498
|
if (store && threads.length) {
|
|
3423
3499
|
const existing = store.toJSON().threads;
|
|
3424
3500
|
const fresh = threads.filter((thread) => !existing.some((t) => t.id === thread.id));
|
|
@@ -3427,7 +3503,7 @@ function applyImportedReviewData(editor, content) {
|
|
|
3427
3503
|
comments = fresh.length;
|
|
3428
3504
|
}
|
|
3429
3505
|
}
|
|
3430
|
-
const registry = _optionalChain([storage, 'access',
|
|
3506
|
+
const registry = _optionalChain([storage, 'access', _127 => _127.paragraphStyles, 'optionalAccess', _128 => _128.registry]);
|
|
3431
3507
|
if (registry && content.styles) {
|
|
3432
3508
|
for (const style of content.styles.list()) {
|
|
3433
3509
|
if (registry.get(style.id)) continue;
|
|
@@ -3454,7 +3530,7 @@ async function importFilesIntoEditor(target, files, options = {}) {
|
|
|
3454
3530
|
applyImportedReviewData(target, outcome.result);
|
|
3455
3531
|
}
|
|
3456
3532
|
outcomes.push(outcome);
|
|
3457
|
-
_optionalChain([options, 'access',
|
|
3533
|
+
_optionalChain([options, 'access', _129 => _129.onImport, 'optionalCall', _130 => _130(outcome, file)]);
|
|
3458
3534
|
} catch (error) {
|
|
3459
3535
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3460
3536
|
if (options.onError) options.onError(err, file);
|
|
@@ -3473,7 +3549,7 @@ function getImportableFiles(files, registry) {
|
|
|
3473
3549
|
}
|
|
3474
3550
|
function dropPosition(view, event) {
|
|
3475
3551
|
try {
|
|
3476
|
-
return _optionalChain([view, 'access',
|
|
3552
|
+
return _optionalChain([view, 'access', _131 => _131.posAtCoords, 'call', _132 => _132({ left: event.clientX, top: event.clientY }), 'optionalAccess', _133 => _133.pos]);
|
|
3477
3553
|
} catch (e2) {
|
|
3478
3554
|
return void 0;
|
|
3479
3555
|
}
|
|
@@ -3510,7 +3586,7 @@ var FileImport = _core.Extension.create({
|
|
|
3510
3586
|
props: {
|
|
3511
3587
|
handleDrop(view, event, _slice, moved) {
|
|
3512
3588
|
if (!options.enableDrop || moved) return false;
|
|
3513
|
-
const files = getImportableFiles(_optionalChain([event, 'access',
|
|
3589
|
+
const files = getImportableFiles(_optionalChain([event, 'access', _134 => _134.dataTransfer, 'optionalAccess', _135 => _135.files]), registry());
|
|
3514
3590
|
if (!files) return false;
|
|
3515
3591
|
event.preventDefault();
|
|
3516
3592
|
run(view, files, dropPosition(view, event));
|
|
@@ -3518,7 +3594,7 @@ var FileImport = _core.Extension.create({
|
|
|
3518
3594
|
},
|
|
3519
3595
|
handlePaste(view, event) {
|
|
3520
3596
|
if (!options.enablePaste) return false;
|
|
3521
|
-
const files = getImportableFiles(_optionalChain([event, 'access',
|
|
3597
|
+
const files = getImportableFiles(_optionalChain([event, 'access', _136 => _136.clipboardData, 'optionalAccess', _137 => _137.files]), registry());
|
|
3522
3598
|
if (!files) return false;
|
|
3523
3599
|
event.preventDefault();
|
|
3524
3600
|
run(view, files);
|
|
@@ -3542,7 +3618,7 @@ function writeRichClipboard(view, event, options = {}) {
|
|
|
3542
3618
|
const slice = state.selection.content();
|
|
3543
3619
|
const { dom, text } = view.serializeForClipboard(slice);
|
|
3544
3620
|
event.preventDefault();
|
|
3545
|
-
_optionalChain([data, 'access',
|
|
3621
|
+
_optionalChain([data, 'access', _138 => _138.clearData, 'optionalCall', _139 => _139()]);
|
|
3546
3622
|
data.setData("text/html", dom.innerHTML);
|
|
3547
3623
|
data.setData("text/plain", text);
|
|
3548
3624
|
data.setData(_nullishCoalesce(options.mimeType, () => ( _chunk3AJMR7EGcjs.PIXERATE_DOCUMENT_MIME)), _chunk3AJMR7EGcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
|
|
@@ -3771,7 +3847,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3771
3847
|
addCommands() {
|
|
3772
3848
|
return {
|
|
3773
3849
|
undoAutocorrect: () => ({ state, tr, dispatch }) => {
|
|
3774
|
-
const last = _optionalChain([autocorrectPluginKey, 'access',
|
|
3850
|
+
const last = _optionalChain([autocorrectPluginKey, 'access', _140 => _140.getState, 'call', _141 => _141(state), 'optionalAccess', _142 => _142.last]);
|
|
3775
3851
|
if (!last) return false;
|
|
3776
3852
|
if (state.doc.textBetween(last.from, last.to) !== last.replacement) return false;
|
|
3777
3853
|
if (dispatch) {
|
|
@@ -3821,7 +3897,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3821
3897
|
}
|
|
3822
3898
|
const insertTyped = () => {
|
|
3823
3899
|
const tr2 = state.tr.insertText(text, from, to);
|
|
3824
|
-
if (_optionalChain([pluginState, 'optionalAccess',
|
|
3900
|
+
if (_optionalChain([pluginState, 'optionalAccess', _143 => _143.closePending])) _history.closeHistory.call(void 0, tr2);
|
|
3825
3901
|
view.dispatch(tr2);
|
|
3826
3902
|
};
|
|
3827
3903
|
if (isIgnored(state, from, to)) return false;
|
|
@@ -3829,7 +3905,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3829
3905
|
if (extension.options.ignorePromptTokens && isInsidePromptToken(textBefore)) {
|
|
3830
3906
|
return false;
|
|
3831
3907
|
}
|
|
3832
|
-
const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access',
|
|
3908
|
+
const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _144 => _144.exec, 'call', _145 => _145(textBefore), 'optionalAccess', _146 => _146[0]]), () => ( ""));
|
|
3833
3909
|
if (/:\/\/|^www\./i.test(currentWord)) return false;
|
|
3834
3910
|
const exceptions = extension.storage.exceptions;
|
|
3835
3911
|
const found = findAutocorrection(textBefore, extension.options.rules, {
|
|
@@ -3837,7 +3913,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3837
3913
|
isException: (value) => exceptions.has(value.toLowerCase())
|
|
3838
3914
|
});
|
|
3839
3915
|
if (!found) {
|
|
3840
|
-
if (!_optionalChain([pluginState, 'optionalAccess',
|
|
3916
|
+
if (!_optionalChain([pluginState, 'optionalAccess', _147 => _147.closePending])) return false;
|
|
3841
3917
|
insertTyped();
|
|
3842
3918
|
return true;
|
|
3843
3919
|
}
|
|
@@ -3874,7 +3950,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
3874
3950
|
_history.closeHistory.call(void 0, tr);
|
|
3875
3951
|
tr.setMeta(autocorrectPluginKey, { correction });
|
|
3876
3952
|
view.dispatch(tr);
|
|
3877
|
-
_optionalChain([extension, 'access',
|
|
3953
|
+
_optionalChain([extension, 'access', _148 => _148.options, 'access', _149 => _149.onCorrection, 'optionalCall', _150 => _150(correction)]);
|
|
3878
3954
|
return true;
|
|
3879
3955
|
};
|
|
3880
3956
|
return [
|
|
@@ -3884,8 +3960,8 @@ var Autocorrect = _core.Extension.create({
|
|
|
3884
3960
|
init: () => ({ last: null, closePending: false }),
|
|
3885
3961
|
apply: (tr, prev) => {
|
|
3886
3962
|
const meta = tr.getMeta(autocorrectPluginKey);
|
|
3887
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
3888
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
3963
|
+
if (_optionalChain([meta, 'optionalAccess', _151 => _151.correction])) return { last: meta.correction, closePending: true };
|
|
3964
|
+
if (_optionalChain([meta, 'optionalAccess', _152 => _152.undo])) return { last: null, closePending: true };
|
|
3889
3965
|
if (!tr.docChanged) return prev;
|
|
3890
3966
|
if (!prev.last && !prev.closePending) return prev;
|
|
3891
3967
|
return { last: null, closePending: false };
|
|
@@ -3978,7 +4054,7 @@ function createOutlineStore(editor) {
|
|
|
3978
4054
|
const compute = () => {
|
|
3979
4055
|
if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
|
|
3980
4056
|
const headings = getOutline(editor);
|
|
3981
|
-
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call',
|
|
4057
|
+
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _153 => _153(editor, headings), 'optionalAccess', _154 => _154.id]), () => ( null));
|
|
3982
4058
|
const sameStructure = _chunkWV5WTOC6cjs.arraysEqual.call(void 0, snapshot.headings, headings, sameHeading);
|
|
3983
4059
|
if (sameStructure && snapshot.activeId === activeId) return snapshot;
|
|
3984
4060
|
return {
|
|
@@ -4003,16 +4079,16 @@ function createOutlineStore(editor) {
|
|
|
4003
4079
|
subscribe(listener) {
|
|
4004
4080
|
if (!listeners.size) {
|
|
4005
4081
|
snapshot = compute();
|
|
4006
|
-
_optionalChain([editor, 'optionalAccess',
|
|
4082
|
+
_optionalChain([editor, 'optionalAccess', _155 => _155.on, 'call', _156 => _156("transaction", onTransaction)]);
|
|
4007
4083
|
}
|
|
4008
4084
|
listeners.add(listener);
|
|
4009
4085
|
return () => {
|
|
4010
4086
|
listeners.delete(listener);
|
|
4011
|
-
if (!listeners.size) _optionalChain([editor, 'optionalAccess',
|
|
4087
|
+
if (!listeners.size) _optionalChain([editor, 'optionalAccess', _157 => _157.off, 'call', _158 => _158("transaction", onTransaction)]);
|
|
4012
4088
|
};
|
|
4013
4089
|
},
|
|
4014
4090
|
destroy() {
|
|
4015
|
-
_optionalChain([editor, 'optionalAccess',
|
|
4091
|
+
_optionalChain([editor, 'optionalAccess', _159 => _159.off, 'call', _160 => _160("transaction", onTransaction)]);
|
|
4016
4092
|
listeners.clear();
|
|
4017
4093
|
}
|
|
4018
4094
|
};
|
|
@@ -4087,7 +4163,7 @@ var Outline = _core.Extension.create({
|
|
|
4087
4163
|
if (options.focus !== false) {
|
|
4088
4164
|
tr.setSelection(_state.TextSelection.create(tr.doc, heading.pos + 1));
|
|
4089
4165
|
tr.scrollIntoView();
|
|
4090
|
-
_optionalChain([view, 'optionalAccess',
|
|
4166
|
+
_optionalChain([view, 'optionalAccess', _161 => _161.focus, 'optionalCall', _162 => _162()]);
|
|
4091
4167
|
}
|
|
4092
4168
|
_chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
|
|
4093
4169
|
}
|
|
@@ -4119,7 +4195,7 @@ var Outline = _core.Extension.create({
|
|
|
4119
4195
|
const next = computeOutline(newState.doc, types);
|
|
4120
4196
|
if (_chunkWV5WTOC6cjs.arraysEqual.call(void 0, prev, next, sameHeading)) return prev;
|
|
4121
4197
|
storage.headings = next;
|
|
4122
|
-
_optionalChain([onUpdate, 'call',
|
|
4198
|
+
_optionalChain([onUpdate, 'call', _163 => _163(), 'optionalCall', _164 => _164(next)]);
|
|
4123
4199
|
return next;
|
|
4124
4200
|
}
|
|
4125
4201
|
}
|
|
@@ -4438,7 +4514,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4438
4514
|
handleDOMEvents: {
|
|
4439
4515
|
click: (view, event) => {
|
|
4440
4516
|
const target = event.target;
|
|
4441
|
-
const link = _optionalChain([target, 'optionalAccess',
|
|
4517
|
+
const link = _optionalChain([target, 'optionalAccess', _165 => _165.closest, 'optionalCall', _166 => _166(
|
|
4442
4518
|
'nav[data-type="table-of-contents"] a[data-heading-id]'
|
|
4443
4519
|
)]);
|
|
4444
4520
|
if (!link) return false;
|
|
@@ -4511,7 +4587,7 @@ function getFootnotes(doc) {
|
|
|
4511
4587
|
number: index + 1,
|
|
4512
4588
|
text: footnote ? footnoteText(footnote.node) : "",
|
|
4513
4589
|
referencePos: ref.pos,
|
|
4514
|
-
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess',
|
|
4590
|
+
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _167 => _167.pos]), () => ( null))
|
|
4515
4591
|
};
|
|
4516
4592
|
});
|
|
4517
4593
|
}
|
|
@@ -4553,7 +4629,7 @@ function syncFootnotes(tr, options = {}) {
|
|
|
4553
4629
|
});
|
|
4554
4630
|
const desiredItems = desiredRefs.map(({ id, number, copyOf }) => {
|
|
4555
4631
|
const source = _nullishCoalesce(existing.get(id), () => ( (copyOf ? existing.get(copyOf) : void 0)));
|
|
4556
|
-
const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
4632
|
+
const content = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _168 => _168.content]), () => ( paragraphsFromText(schema, _nullishCoalesce(_optionalChain([options, 'access', _169 => _169.contents, 'optionalAccess', _170 => _170[id]]), () => ( "")))));
|
|
4557
4633
|
if (source && source.attrs.id === id && source.attrs.number === number) {
|
|
4558
4634
|
return source;
|
|
4559
4635
|
}
|
|
@@ -4756,7 +4832,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4756
4832
|
handleClickOn: (_view, _pos, node, _nodePos, event) => {
|
|
4757
4833
|
if (node.type.name !== REFERENCE || !node.attrs.id) return false;
|
|
4758
4834
|
const target = event.target;
|
|
4759
|
-
if (!_optionalChain([target, 'optionalAccess',
|
|
4835
|
+
if (!_optionalChain([target, 'optionalAccess', _171 => _171.closest, 'optionalCall', _172 => _172("a")])) return false;
|
|
4760
4836
|
event.preventDefault();
|
|
4761
4837
|
return editor.commands.goToFootnote(node.attrs.id);
|
|
4762
4838
|
}
|
|
@@ -4954,7 +5030,7 @@ var Bookmark = _core.Mark.create({
|
|
|
4954
5030
|
}
|
|
4955
5031
|
if (!dispatch) return true;
|
|
4956
5032
|
const sameName = getBookmarks(state.doc).find((b) => b.name === name);
|
|
4957
|
-
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess',
|
|
5033
|
+
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _173 => _173.id]))), () => ( this.options.generateId()));
|
|
4958
5034
|
if (sameName) {
|
|
4959
5035
|
forEachBookmarkRange(
|
|
4960
5036
|
tr.doc,
|
|
@@ -5196,7 +5272,7 @@ var CrossReference = _core.Node.create({
|
|
|
5196
5272
|
// src/extensions/document-structure/command-items.ts
|
|
5197
5273
|
var start = (editor, args) => {
|
|
5198
5274
|
const chain = editor.chain().focus();
|
|
5199
|
-
return _optionalChain([args, 'optionalAccess',
|
|
5275
|
+
return _optionalChain([args, 'optionalAccess', _174 => _174.range]) ? chain.deleteRange(args.range) : chain;
|
|
5200
5276
|
};
|
|
5201
5277
|
var documentStructureCommandItems = [
|
|
5202
5278
|
{
|
|
@@ -5213,7 +5289,7 @@ var documentStructureCommandItems = [
|
|
|
5213
5289
|
description: "Insert a numbered footnote",
|
|
5214
5290
|
keywords: ["footnote", "note", "fn", "citation"],
|
|
5215
5291
|
extension: "footnoteReference",
|
|
5216
|
-
run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess',
|
|
5292
|
+
run: (editor, args) => start(editor, args).insertFootnote({ content: _optionalChain([args, 'optionalAccess', _175 => _175.content]) }).run()
|
|
5217
5293
|
},
|
|
5218
5294
|
{
|
|
5219
5295
|
id: "bookmark",
|
|
@@ -5222,7 +5298,7 @@ var documentStructureCommandItems = [
|
|
|
5222
5298
|
keywords: ["bookmark", "anchor", "name"],
|
|
5223
5299
|
extension: "bookmark",
|
|
5224
5300
|
requires: "name",
|
|
5225
|
-
run: (editor, args) => !!_optionalChain([args, 'optionalAccess',
|
|
5301
|
+
run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _176 => _176.name]) && start(editor, args).setBookmark({ name: args.name }).run()
|
|
5226
5302
|
},
|
|
5227
5303
|
{
|
|
5228
5304
|
id: "cross-reference",
|
|
@@ -5231,7 +5307,7 @@ var documentStructureCommandItems = [
|
|
|
5231
5307
|
keywords: ["cross", "reference", "xref", "link", "ref"],
|
|
5232
5308
|
extension: "crossReference",
|
|
5233
5309
|
requires: "target",
|
|
5234
|
-
run: (editor, args) => !!_optionalChain([args, 'optionalAccess',
|
|
5310
|
+
run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _177 => _177.targetType]) && !!args.targetId && start(editor, args).insertCrossReference({ targetType: args.targetType, targetId: args.targetId }).run()
|
|
5235
5311
|
}
|
|
5236
5312
|
];
|
|
5237
5313
|
function getDocumentStructureCommandItems(editor, query = "") {
|
|
@@ -5290,13 +5366,13 @@ var FindReplaceStore = (_class3 = class {constructor() { _class3.prototype.__ini
|
|
|
5290
5366
|
}, _class3);
|
|
5291
5367
|
var findReplacePluginKey = new (0, _state.PluginKey)("findReplace");
|
|
5292
5368
|
function getFindReplaceState(source) {
|
|
5293
|
-
const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
5369
|
+
const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _178 => _178.state]), () => ( source));
|
|
5294
5370
|
if (!state || typeof state.plugins === "undefined") return null;
|
|
5295
5371
|
const plugin = findReplacePluginKey.getState(state);
|
|
5296
5372
|
return plugin ? toSnapshot(plugin) : null;
|
|
5297
5373
|
}
|
|
5298
5374
|
function getFindReplaceStore(editor) {
|
|
5299
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
5375
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _179 => _179.storage, 'optionalAccess', _180 => _180.findReplace, 'optionalAccess', _181 => _181.store]), () => ( null));
|
|
5300
5376
|
}
|
|
5301
5377
|
var snapshotCache = /* @__PURE__ */ new WeakMap();
|
|
5302
5378
|
function toSnapshot(s) {
|
|
@@ -5467,7 +5543,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5467
5543
|
const open = (mode) => () => this.editor.commands.openFindReplace({ mode });
|
|
5468
5544
|
const step = (forward) => () => {
|
|
5469
5545
|
const s = findReplacePluginKey.getState(this.editor.state);
|
|
5470
|
-
if (!_optionalChain([s, 'optionalAccess',
|
|
5546
|
+
if (!_optionalChain([s, 'optionalAccess', _182 => _182.active]) || !s.matches.length) return false;
|
|
5471
5547
|
return forward ? this.editor.commands.findNext() : this.editor.commands.findPrevious();
|
|
5472
5548
|
};
|
|
5473
5549
|
return {
|
|
@@ -5580,7 +5656,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5580
5656
|
s = {
|
|
5581
5657
|
...s,
|
|
5582
5658
|
currentIndex: m.index,
|
|
5583
|
-
anchor: _nullishCoalesce(_optionalChain([s, 'access',
|
|
5659
|
+
anchor: _nullishCoalesce(_optionalChain([s, 'access', _183 => _183.matches, 'access', _184 => _184[m.index], 'optionalAccess', _185 => _185.from]), () => ( s.anchor))
|
|
5584
5660
|
};
|
|
5585
5661
|
redecorate = true;
|
|
5586
5662
|
break;
|
|
@@ -5596,7 +5672,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5596
5672
|
}
|
|
5597
5673
|
},
|
|
5598
5674
|
props: {
|
|
5599
|
-
decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access',
|
|
5675
|
+
decorations: (state) => _nullishCoalesce(_optionalChain([findReplacePluginKey, 'access', _186 => _186.getState, 'call', _187 => _187(state), 'optionalAccess', _188 => _188.decorations]), () => ( _view2.DecorationSet.empty))
|
|
5600
5676
|
},
|
|
5601
5677
|
view: (view) => {
|
|
5602
5678
|
const sync = () => {
|
|
@@ -5625,11 +5701,11 @@ var STYLE_ID_ATTRIBUTE = "styleId";
|
|
|
5625
5701
|
var CHARACTER_STYLE_MARK_NAME = "characterStyle";
|
|
5626
5702
|
var paragraphStylesPluginKey = new (0, _state.PluginKey)("paragraphStyles");
|
|
5627
5703
|
function getStyleRegistry(editor) {
|
|
5628
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
5704
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _189 => _189.storage, 'optionalAccess', _190 => _190.paragraphStyles, 'optionalAccess', _191 => _191.registry]), () => ( null));
|
|
5629
5705
|
}
|
|
5630
5706
|
function headingLevels(editor) {
|
|
5631
|
-
const heading = _optionalChain([editor, 'optionalAccess',
|
|
5632
|
-
const levels = _optionalChain([heading, 'optionalAccess',
|
|
5707
|
+
const heading = _optionalChain([editor, 'optionalAccess', _192 => _192.extensionManager, 'optionalAccess', _193 => _193.extensions, 'access', _194 => _194.find, 'call', _195 => _195((e) => e.name === "heading")]);
|
|
5708
|
+
const levels = _optionalChain([heading, 'optionalAccess', _196 => _196.options, 'optionalAccess', _197 => _197.levels]);
|
|
5633
5709
|
return Array.isArray(levels) ? levels : null;
|
|
5634
5710
|
}
|
|
5635
5711
|
function isParagraphStyleAvailable(editor, registry, id) {
|
|
@@ -5639,7 +5715,7 @@ function isParagraphStyleAvailable(editor, registry, id) {
|
|
|
5639
5715
|
if (!editor.schema.nodes[block.type]) return false;
|
|
5640
5716
|
if (block.type === "heading") {
|
|
5641
5717
|
const levels = headingLevels(editor);
|
|
5642
|
-
if (levels && !levels.includes(Number(_optionalChain([block, 'access',
|
|
5718
|
+
if (levels && !levels.includes(Number(_optionalChain([block, 'access', _198 => _198.attrs, 'optionalAccess', _199 => _199.level])))) return false;
|
|
5643
5719
|
}
|
|
5644
5720
|
return true;
|
|
5645
5721
|
}
|
|
@@ -5679,7 +5755,7 @@ function captureSelectionFormat(state) {
|
|
|
5679
5755
|
if (name === "highlight") character.backgroundColor = mark.attrs.color || "#fef08a";
|
|
5680
5756
|
});
|
|
5681
5757
|
const paragraph = {};
|
|
5682
|
-
const align = _optionalChain([state, 'access',
|
|
5758
|
+
const align = _optionalChain([state, 'access', _200 => _200.selection, 'access', _201 => _201.$from, 'access', _202 => _202.parent, 'access', _203 => _203.attrs, 'optionalAccess', _204 => _204.textAlign]);
|
|
5683
5759
|
if (align && align !== "left") paragraph.textAlign = align;
|
|
5684
5760
|
return { paragraph, character };
|
|
5685
5761
|
}
|
|
@@ -5845,7 +5921,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
5845
5921
|
},
|
|
5846
5922
|
clearParagraphStyle: () => ({ commands }) => commands.setParagraphStyle(_chunkYN6JKAUEcjs.NORMAL_STYLE_ID),
|
|
5847
5923
|
setCharacterStyle: (id) => ({ commands }) => {
|
|
5848
|
-
if (_optionalChain([registry, 'call',
|
|
5924
|
+
if (_optionalChain([registry, 'call', _205 => _205(), 'access', _206 => _206.get, 'call', _207 => _207(id), 'optionalAccess', _208 => _208.kind]) !== "character") return false;
|
|
5849
5925
|
return commands.setMark(CHARACTER_STYLE_MARK_NAME, { [STYLE_ID_ATTRIBUTE]: id });
|
|
5850
5926
|
},
|
|
5851
5927
|
unsetCharacterStyle: () => ({ commands }) => commands.unsetMark(CHARACTER_STYLE_MARK_NAME),
|
|
@@ -5911,7 +5987,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
5911
5987
|
};
|
|
5912
5988
|
},
|
|
5913
5989
|
onDestroy() {
|
|
5914
|
-
_optionalChain([this, 'access',
|
|
5990
|
+
_optionalChain([this, 'access', _209 => _209.storage, 'access', _210 => _210.cleanup, 'optionalCall', _211 => _211()]);
|
|
5915
5991
|
}
|
|
5916
5992
|
});
|
|
5917
5993
|
var EMPTY_STYLES = Object.freeze({
|
|
@@ -5949,8 +6025,8 @@ function createParagraphStylesStore(editor) {
|
|
|
5949
6025
|
}
|
|
5950
6026
|
};
|
|
5951
6027
|
const detach = () => {
|
|
5952
|
-
_optionalChain([editor, 'optionalAccess',
|
|
5953
|
-
_optionalChain([unsubscribeRegistry, 'optionalCall',
|
|
6028
|
+
_optionalChain([editor, 'optionalAccess', _212 => _212.off, 'call', _213 => _213("transaction", update)]);
|
|
6029
|
+
_optionalChain([unsubscribeRegistry, 'optionalCall', _214 => _214()]);
|
|
5954
6030
|
unsubscribeRegistry = null;
|
|
5955
6031
|
};
|
|
5956
6032
|
return {
|
|
@@ -5961,7 +6037,7 @@ function createParagraphStylesStore(editor) {
|
|
|
5961
6037
|
subscribe(listener) {
|
|
5962
6038
|
if (!listeners.size) {
|
|
5963
6039
|
snapshot = compute();
|
|
5964
|
-
_optionalChain([editor, 'optionalAccess',
|
|
6040
|
+
_optionalChain([editor, 'optionalAccess', _215 => _215.on, 'call', _216 => _216("transaction", update)]);
|
|
5965
6041
|
unsubscribeRegistry = registry ? registry.subscribe(update) : null;
|
|
5966
6042
|
}
|
|
5967
6043
|
listeners.add(listener);
|
|
@@ -5978,7 +6054,7 @@ function createParagraphStylesStore(editor) {
|
|
|
5978
6054
|
}
|
|
5979
6055
|
|
|
5980
6056
|
// src/extensions/rich-text-preset.ts
|
|
5981
|
-
var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess',
|
|
6057
|
+
var resolveExt3 = (mod, name) => _optionalChain([mod, 'optionalAccess', _217 => _217[name]]) || _optionalChain([mod, 'optionalAccess', _218 => _218.default, 'optionalAccess', _219 => _219[name]]) || _optionalChain([mod, 'optionalAccess', _220 => _220.default, 'optionalAccess', _221 => _221.default]) || _optionalChain([mod, 'optionalAccess', _222 => _222.default]) || mod;
|
|
5982
6058
|
var StarterKit = resolveExt3(_StarterKit, "StarterKit");
|
|
5983
6059
|
var Color = resolveExt3(_Color, "Color");
|
|
5984
6060
|
var Highlight = resolveExt3(_Highlight, "Highlight");
|
|
@@ -6059,7 +6135,7 @@ function createRichTextPreset(options = {}) {
|
|
|
6059
6135
|
find: /^\s*(\[([ |x])?\])\s$/i,
|
|
6060
6136
|
type: this.type,
|
|
6061
6137
|
getAttributes: (match) => ({
|
|
6062
|
-
checked: _optionalChain([match, 'access',
|
|
6138
|
+
checked: _optionalChain([match, 'access', _223 => _223[2], 'optionalAccess', _224 => _224.toLowerCase, 'call', _225 => _225()]) === "x"
|
|
6063
6139
|
})
|
|
6064
6140
|
})
|
|
6065
6141
|
];
|
|
@@ -6235,7 +6311,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6235
6311
|
const hasMatches = () => {
|
|
6236
6312
|
const ok = usable(editor);
|
|
6237
6313
|
if (ok !== true) return ok;
|
|
6238
|
-
return _optionalChain([state, 'call',
|
|
6314
|
+
return _optionalChain([state, 'call', _226 => _226(), 'optionalAccess', _227 => _227.matches, 'access', _228 => _228.length]) ? true : "No matches.";
|
|
6239
6315
|
};
|
|
6240
6316
|
const apply = (params) => {
|
|
6241
6317
|
const split = splitParams(params);
|
|
@@ -6243,7 +6319,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6243
6319
|
};
|
|
6244
6320
|
const failIfInvalid = () => {
|
|
6245
6321
|
const s = state();
|
|
6246
|
-
if (_optionalChain([s, 'optionalAccess',
|
|
6322
|
+
if (_optionalChain([s, 'optionalAccess', _229 => _229.error])) throw new Error(s.error.message);
|
|
6247
6323
|
};
|
|
6248
6324
|
return [
|
|
6249
6325
|
{
|
|
@@ -6282,9 +6358,9 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6282
6358
|
failIfInvalid();
|
|
6283
6359
|
const s = state();
|
|
6284
6360
|
return {
|
|
6285
|
-
count: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
6286
|
-
truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
6287
|
-
matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
6361
|
+
count: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _230 => _230.matches, 'access', _231 => _231.length]), () => ( 0)),
|
|
6362
|
+
truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess', _232 => _232.truncated]), () => ( false)),
|
|
6363
|
+
matches: (_nullishCoalesce(_optionalChain([s, 'optionalAccess', _233 => _233.matches]), () => ( []))).slice(0, 200).map(({ from, to, text }) => ({ from, to, text }))
|
|
6288
6364
|
};
|
|
6289
6365
|
}
|
|
6290
6366
|
},
|
|
@@ -6311,11 +6387,11 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6311
6387
|
description: "Replaces every match (one undo step). Tracked when Track Changes is on.",
|
|
6312
6388
|
params: searchParams(true),
|
|
6313
6389
|
...scope,
|
|
6314
|
-
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess',
|
|
6390
|
+
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _234 => _234.query]) !== void 0 ? usable(editor) : hasMatches(),
|
|
6315
6391
|
run: (_ctx, params) => {
|
|
6316
6392
|
apply(params);
|
|
6317
6393
|
failIfInvalid();
|
|
6318
|
-
const count = _nullishCoalesce(_optionalChain([state, 'call',
|
|
6394
|
+
const count = _nullishCoalesce(_optionalChain([state, 'call', _235 => _235(), 'optionalAccess', _236 => _236.matches, 'access', _237 => _237.length]), () => ( 0));
|
|
6319
6395
|
if (count) editor.commands.replaceAll();
|
|
6320
6396
|
return { replaced: count };
|
|
6321
6397
|
}
|
|
@@ -6503,4 +6579,5 @@ function createTableCommands(editor, options = {}) {
|
|
|
6503
6579
|
|
|
6504
6580
|
|
|
6505
6581
|
|
|
6506
|
-
|
|
6582
|
+
|
|
6583
|
+
exports.GradientText = GradientText; exports.SlashCommands = SlashCommands; exports.TemplateSuggestions = TemplateSuggestions; exports.loadingSpinnerSpec = loadingSpinnerSpec; 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.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;
|