@pixerate/editor 0.235.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/agent/index.cjs +286 -27
- package/dist/agent/index.d.cts +1 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +261 -2
- package/dist/agent/reviewTools.d.cts +16 -0
- package/dist/agent/reviewTools.d.ts +16 -0
- package/dist/{chunk-CZBRY4SW.cjs → chunk-CZWUDFR3.cjs} +214 -389
- package/dist/{chunk-PI2UYMZY.js → chunk-FSLKBQU7.js} +269 -15
- package/dist/{chunk-3MO3ZS7E.js → chunk-JVSX5QTS.js} +141 -316
- package/dist/{chunk-O7QXVGMP.cjs → chunk-WV5WTOC6.cjs} +295 -41
- package/dist/extensions/index.cjs +8 -6
- package/dist/extensions/index.js +12 -10
- package/dist/extensions/loading-node.d.cts +45 -1
- package/dist/extensions/loading-node.d.ts +45 -1
- package/dist/index.cjs +13 -11
- package/dist/index.js +12 -10
- package/package.json +1 -1
- package/skills/pixerate-rich-text/SKILL.md +28 -1
- package/skills/pixerate-rich-text-revise/SKILL.md +8 -1
|
@@ -34,7 +34,8 @@ var _chunkHMGWFXECcjs = require('./chunk-HMGWFXEC.cjs');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
var _chunkWV5WTOC6cjs = require('./chunk-WV5WTOC6.cjs');
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
var _chunkWRZ6C4TUcjs = require('./chunk-WRZ6C4TU.cjs');
|
|
@@ -59,7 +60,6 @@ var _chunkG43MNQ4Ccjs = require('./chunk-G43MNQ4C.cjs');
|
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
|
|
62
|
-
|
|
63
63
|
var _chunk34RQAGWIcjs = require('./chunk-34RQAGWI.cjs');
|
|
64
64
|
|
|
65
65
|
|
|
@@ -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();
|
|
@@ -1870,254 +1946,10 @@ var Image2 = BaseImage.extend({
|
|
|
1870
1946
|
}
|
|
1871
1947
|
});
|
|
1872
1948
|
|
|
1873
|
-
// src/extensions/comments.ts
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
var commentsPluginKey = new (0, _state.PluginKey)("comments");
|
|
1878
|
-
var COMMENT_MARK_NAME = "comment";
|
|
1879
|
-
function findCommentRanges(doc) {
|
|
1880
|
-
const result = /* @__PURE__ */ new Map();
|
|
1881
|
-
doc.descendants((node, pos) => {
|
|
1882
|
-
if (!node.isInline) return;
|
|
1883
|
-
node.marks.forEach((mark) => {
|
|
1884
|
-
if (mark.type.name !== COMMENT_MARK_NAME) return;
|
|
1885
|
-
const id = mark.attrs.commentId;
|
|
1886
|
-
if (!id) return;
|
|
1887
|
-
const ranges = _nullishCoalesce(result.get(id), () => ( []));
|
|
1888
|
-
const last = ranges[ranges.length - 1];
|
|
1889
|
-
const end = pos + node.nodeSize;
|
|
1890
|
-
if (last && last.to === pos) {
|
|
1891
|
-
last.to = end;
|
|
1892
|
-
} else {
|
|
1893
|
-
ranges.push({ from: pos, to: end });
|
|
1894
|
-
}
|
|
1895
|
-
result.set(id, ranges);
|
|
1896
|
-
});
|
|
1897
|
-
});
|
|
1898
|
-
return result;
|
|
1899
|
-
}
|
|
1900
|
-
function getCommentAnchors(doc) {
|
|
1901
|
-
const anchors = /* @__PURE__ */ new Map();
|
|
1902
|
-
findCommentRanges(doc).forEach((ranges, id) => {
|
|
1903
|
-
const from = ranges[0].from;
|
|
1904
|
-
const to = ranges[ranges.length - 1].to;
|
|
1905
|
-
anchors.set(id, {
|
|
1906
|
-
from,
|
|
1907
|
-
to,
|
|
1908
|
-
quote: ranges.map((r) => doc.textBetween(r.from, r.to, " ", " ")).join(" ")
|
|
1909
|
-
});
|
|
1910
|
-
});
|
|
1911
|
-
return anchors;
|
|
1912
|
-
}
|
|
1913
|
-
function getCommentIdsAt(state, pos = state.selection.from) {
|
|
1914
|
-
const $pos = state.doc.resolve(pos);
|
|
1915
|
-
const marks = [
|
|
1916
|
-
..._nullishCoalesce(_optionalChain([$pos, 'access', _62 => _62.nodeAfter, 'optionalAccess', _63 => _63.marks]), () => ( [])),
|
|
1917
|
-
..._nullishCoalesce(_optionalChain([$pos, 'access', _64 => _64.nodeBefore, 'optionalAccess', _65 => _65.marks]), () => ( []))
|
|
1918
|
-
];
|
|
1919
|
-
const ids = [];
|
|
1920
|
-
marks.forEach((m) => {
|
|
1921
|
-
if (m.type.name === COMMENT_MARK_NAME && m.attrs.commentId && !ids.includes(m.attrs.commentId)) {
|
|
1922
|
-
ids.push(m.attrs.commentId);
|
|
1923
|
-
}
|
|
1924
|
-
});
|
|
1925
|
-
return ids;
|
|
1926
|
-
}
|
|
1927
|
-
function getCommentStore(editor) {
|
|
1928
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _66 => _66.storage, 'optionalAccess', _67 => _67[COMMENT_MARK_NAME], 'optionalAccess', _68 => _68.store]), () => ( null));
|
|
1929
|
-
}
|
|
1930
|
-
function resolveAuthor(author) {
|
|
1931
|
-
return typeof author === "function" ? author() : author;
|
|
1932
|
-
}
|
|
1933
|
-
var Comments = _core.Mark.create({
|
|
1934
|
-
name: COMMENT_MARK_NAME,
|
|
1935
|
-
// Typing at the edge of a comment does not extend it.
|
|
1936
|
-
inclusive: false,
|
|
1937
|
-
// Allow several comment marks (different threads) on the same text.
|
|
1938
|
-
excludes: "",
|
|
1939
|
-
addOptions() {
|
|
1940
|
-
return {
|
|
1941
|
-
store: null,
|
|
1942
|
-
author: { id: "anonymous", name: "Anonymous" },
|
|
1943
|
-
HTMLAttributes: {},
|
|
1944
|
-
commentClass: "pixerate-comment bg-amber-100 border-b-2 border-amber-400 dark:bg-amber-500/20 cursor-pointer",
|
|
1945
|
-
activeClass: "pixerate-comment-active bg-amber-200 dark:bg-amber-500/40",
|
|
1946
|
-
resolvedClass: "",
|
|
1947
|
-
activateOnSelection: true
|
|
1948
|
-
};
|
|
1949
|
-
},
|
|
1950
|
-
addStorage() {
|
|
1951
|
-
return {
|
|
1952
|
-
store: _nullishCoalesce(this.options.store, () => ( new (0, _chunk34RQAGWIcjs.CommentStore)())),
|
|
1953
|
-
// tiptap-markdown: comments are not part of the exported markdown.
|
|
1954
|
-
markdown: { serialize: { open: "", close: "" }, parse: {} }
|
|
1955
|
-
};
|
|
1956
|
-
},
|
|
1957
|
-
addAttributes() {
|
|
1958
|
-
return {
|
|
1959
|
-
commentId: {
|
|
1960
|
-
default: null,
|
|
1961
|
-
parseHTML: (el) => el.getAttribute("data-comment-id"),
|
|
1962
|
-
renderHTML: (attrs) => attrs.commentId ? { "data-comment-id": attrs.commentId } : {}
|
|
1963
|
-
}
|
|
1964
|
-
};
|
|
1965
|
-
},
|
|
1966
|
-
parseHTML() {
|
|
1967
|
-
return [{ tag: "span[data-comment-id]" }];
|
|
1968
|
-
},
|
|
1969
|
-
renderHTML({ HTMLAttributes }) {
|
|
1970
|
-
return ["span", _chunk34RQAGWIcjs.safeMergeAttributes.call(void 0, this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
1971
|
-
},
|
|
1972
|
-
addCommands() {
|
|
1973
|
-
const store = () => this.storage.store;
|
|
1974
|
-
return {
|
|
1975
|
-
addComment: (options = {}) => ({ state, tr, dispatch }) => {
|
|
1976
|
-
const { from, to, empty } = state.selection;
|
|
1977
|
-
if (empty) return false;
|
|
1978
|
-
if (dispatch) {
|
|
1979
|
-
const id = _nullishCoalesce(options.id, () => ( _chunk34RQAGWIcjs.createReviewId.call(void 0, "comment")));
|
|
1980
|
-
tr.addMark(from, to, this.type.create({ commentId: id }));
|
|
1981
|
-
tr.setMeta(commentsPluginKey, "refresh");
|
|
1982
|
-
store().createThread({
|
|
1983
|
-
id,
|
|
1984
|
-
body: _nullishCoalesce(options.body, () => ( "")),
|
|
1985
|
-
author: _nullishCoalesce(options.author, () => ( resolveAuthor(this.options.author))),
|
|
1986
|
-
anchor: { from, to, quote: state.doc.textBetween(from, to, " ", " ") }
|
|
1987
|
-
});
|
|
1988
|
-
store().setActiveThread(id);
|
|
1989
|
-
}
|
|
1990
|
-
return true;
|
|
1991
|
-
},
|
|
1992
|
-
resolveComment: (id, resolved = true) => ({ tr, dispatch }) => {
|
|
1993
|
-
if (!store().getThread(id)) return false;
|
|
1994
|
-
if (dispatch) {
|
|
1995
|
-
store().resolveThread(id, resolved, resolveAuthor(this.options.author));
|
|
1996
|
-
tr.setMeta(commentsPluginKey, "refresh");
|
|
1997
|
-
}
|
|
1998
|
-
return true;
|
|
1999
|
-
},
|
|
2000
|
-
deleteComment: (id) => ({ state, tr, dispatch }) => {
|
|
2001
|
-
const ranges = _nullishCoalesce(findCommentRanges(state.doc).get(id), () => ( []));
|
|
2002
|
-
if (ranges.length === 0 && !store().getThread(id)) return false;
|
|
2003
|
-
if (dispatch) {
|
|
2004
|
-
ranges.forEach(({ from, to }) => {
|
|
2005
|
-
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
2006
|
-
const mark = node.marks.find(
|
|
2007
|
-
(m) => m.type === this.type && m.attrs.commentId === id
|
|
2008
|
-
);
|
|
2009
|
-
if (mark) {
|
|
2010
|
-
tr.removeMark(Math.max(pos, from), Math.min(pos + node.nodeSize, to), mark);
|
|
2011
|
-
}
|
|
2012
|
-
});
|
|
2013
|
-
});
|
|
2014
|
-
tr.setMeta(commentsPluginKey, "refresh");
|
|
2015
|
-
store().deleteThread(id);
|
|
2016
|
-
}
|
|
2017
|
-
return true;
|
|
2018
|
-
},
|
|
2019
|
-
setActiveComment: (id) => ({ tr, dispatch }) => {
|
|
2020
|
-
if (id !== null && !store().getThread(id)) return false;
|
|
2021
|
-
if (dispatch) {
|
|
2022
|
-
store().setActiveThread(id);
|
|
2023
|
-
tr.setMeta(commentsPluginKey, "refresh");
|
|
2024
|
-
}
|
|
2025
|
-
return true;
|
|
2026
|
-
},
|
|
2027
|
-
focusComment: (id) => ({ state, tr, dispatch }) => {
|
|
2028
|
-
const ranges = findCommentRanges(state.doc).get(id);
|
|
2029
|
-
if (!ranges || ranges.length === 0) return false;
|
|
2030
|
-
if (dispatch) {
|
|
2031
|
-
const from = ranges[0].from;
|
|
2032
|
-
const to = ranges[ranges.length - 1].to;
|
|
2033
|
-
tr.setSelection(_state.TextSelection.create(tr.doc, from, to)).scrollIntoView();
|
|
2034
|
-
store().setActiveThread(id);
|
|
2035
|
-
tr.setMeta(commentsPluginKey, "refresh");
|
|
2036
|
-
}
|
|
2037
|
-
return true;
|
|
2038
|
-
}
|
|
2039
|
-
};
|
|
2040
|
-
},
|
|
2041
|
-
addProseMirrorPlugins() {
|
|
2042
|
-
const store = this.storage.store;
|
|
2043
|
-
const options = this.options;
|
|
2044
|
-
let cache = null;
|
|
2045
|
-
const buildDecorations = (doc) => {
|
|
2046
|
-
const snapshot = store.getSnapshot();
|
|
2047
|
-
if (cache && cache.doc === doc && cache.snapshot === snapshot) return cache.set;
|
|
2048
|
-
const decorations = [];
|
|
2049
|
-
findCommentRanges(doc).forEach((ranges, id) => {
|
|
2050
|
-
const thread = store.getThread(id);
|
|
2051
|
-
const resolved = _nullishCoalesce(_optionalChain([thread, 'optionalAccess', _69 => _69.resolved]), () => ( false));
|
|
2052
|
-
const active = snapshot.activeThreadId === id;
|
|
2053
|
-
const cls = [
|
|
2054
|
-
resolved ? options.resolvedClass : options.commentClass,
|
|
2055
|
-
active ? options.activeClass : ""
|
|
2056
|
-
].filter(Boolean).join(" ");
|
|
2057
|
-
if (!cls) return;
|
|
2058
|
-
ranges.forEach(({ from, to }) => {
|
|
2059
|
-
decorations.push(_view2.Decoration.inline(from, to, { class: cls }));
|
|
2060
|
-
});
|
|
2061
|
-
});
|
|
2062
|
-
const set = _view2.DecorationSet.create(doc, decorations);
|
|
2063
|
-
cache = { doc, snapshot, set };
|
|
2064
|
-
return set;
|
|
2065
|
-
};
|
|
2066
|
-
return [
|
|
2067
|
-
new (0, _state.Plugin)({
|
|
2068
|
-
key: commentsPluginKey,
|
|
2069
|
-
props: {
|
|
2070
|
-
decorations: (state) => buildDecorations(state.doc)
|
|
2071
|
-
},
|
|
2072
|
-
view: (view) => {
|
|
2073
|
-
let destroyed = false;
|
|
2074
|
-
let scheduled = false;
|
|
2075
|
-
const sync = () => store.syncAnchors(getCommentAnchors(view.state.doc));
|
|
2076
|
-
sync();
|
|
2077
|
-
const unsubscribe = store.subscribe(() => {
|
|
2078
|
-
if (scheduled) return;
|
|
2079
|
-
scheduled = true;
|
|
2080
|
-
queueMicrotask(() => {
|
|
2081
|
-
scheduled = false;
|
|
2082
|
-
if (destroyed) return;
|
|
2083
|
-
sync();
|
|
2084
|
-
if (_optionalChain([cache, 'optionalAccess', _70 => _70.snapshot]) !== store.getSnapshot()) {
|
|
2085
|
-
view.dispatch(
|
|
2086
|
-
view.state.tr.setMeta(commentsPluginKey, "refresh").setMeta("addToHistory", false)
|
|
2087
|
-
);
|
|
2088
|
-
}
|
|
2089
|
-
});
|
|
2090
|
-
});
|
|
2091
|
-
return {
|
|
2092
|
-
update(view2, prevState) {
|
|
2093
|
-
if (!prevState.doc.eq(view2.state.doc)) sync();
|
|
2094
|
-
if (options.activateOnSelection && !prevState.selection.eq(view2.state.selection)) {
|
|
2095
|
-
const ids = getCommentIdsAt(view2.state);
|
|
2096
|
-
const active = store.getSnapshot().activeThreadId;
|
|
2097
|
-
if (!active || !ids.includes(active)) {
|
|
2098
|
-
store.setActiveThread(_nullishCoalesce(ids[0], () => ( null)));
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
},
|
|
2102
|
-
destroy() {
|
|
2103
|
-
destroyed = true;
|
|
2104
|
-
unsubscribe();
|
|
2105
|
-
}
|
|
2106
|
-
};
|
|
2107
|
-
}
|
|
2108
|
-
})
|
|
2109
|
-
];
|
|
2110
|
-
}
|
|
2111
|
-
});
|
|
2112
|
-
function getCommentAuthor(editor) {
|
|
2113
|
-
const ext = _optionalChain([editor, 'optionalAccess', _71 => _71.extensionManager, 'optionalAccess', _72 => _72.extensions, 'access', _73 => _73.find, 'call', _74 => _74((e) => e.name === COMMENT_MARK_NAME)]);
|
|
2114
|
-
return ext ? resolveAuthor(ext.options.author) : null;
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
1949
|
// src/extensions/document-compare.ts
|
|
2118
1950
|
|
|
2119
1951
|
function trackChangesAuthor(state) {
|
|
2120
|
-
return _optionalChain([_chunk34RQAGWIcjs.trackChangesPluginKey, 'access',
|
|
1952
|
+
return _optionalChain([_chunk34RQAGWIcjs.trackChangesPluginKey, 'access', _67 => _67.getState, 'call', _68 => _68(state), 'optionalAccess', _69 => _69.author]);
|
|
2121
1953
|
}
|
|
2122
1954
|
function compareInEditor(editor, original, revised, options = {}) {
|
|
2123
1955
|
return _chunkHMGWFXECcjs.compareDocuments.call(void 0, original, revised, {
|
|
@@ -2251,7 +2083,7 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
|
|
|
2251
2083
|
* wildcards, then higher `priority`, then the most recently registered.
|
|
2252
2084
|
*/
|
|
2253
2085
|
find(query) {
|
|
2254
|
-
const fileName = _nullishCoalesce(_optionalChain([query, 'access',
|
|
2086
|
+
const fileName = _nullishCoalesce(_optionalChain([query, 'access', _70 => _70.fileName, 'optionalAccess', _71 => _71.toLowerCase, 'call', _72 => _72()]), () => ( ""));
|
|
2255
2087
|
const mime = normalizeMimeType(query.mimeType);
|
|
2256
2088
|
let best;
|
|
2257
2089
|
let bestScore = 0;
|
|
@@ -2332,7 +2164,7 @@ var ImportAdapterRegistry = (_class = class {constructor() { _class.prototype.__
|
|
|
2332
2164
|
mimeType,
|
|
2333
2165
|
target: adapter.target,
|
|
2334
2166
|
registry: this,
|
|
2335
|
-
options: _optionalChain([options, 'access',
|
|
2167
|
+
options: _optionalChain([options, 'access', _73 => _73.adapterOptions, 'optionalAccess', _74 => _74[adapter.id]])
|
|
2336
2168
|
});
|
|
2337
2169
|
try {
|
|
2338
2170
|
const result = await adapter.import(input, context);
|
|
@@ -2402,7 +2234,7 @@ function descendants(el, localName) {
|
|
|
2402
2234
|
}
|
|
2403
2235
|
function toggle(el) {
|
|
2404
2236
|
if (!el) return void 0;
|
|
2405
|
-
const value = _optionalChain([attr, 'call',
|
|
2237
|
+
const value = _optionalChain([attr, 'call', _75 => _75(el, "val"), 'optionalAccess', _76 => _76.toLowerCase, 'call', _77 => _77()]);
|
|
2406
2238
|
return value === void 0 || !["0", "false", "off", "none"].includes(value);
|
|
2407
2239
|
}
|
|
2408
2240
|
function parseXml(Parser, xml, partName) {
|
|
@@ -2443,7 +2275,7 @@ async function readRelationships(zip, Parser, partPath) {
|
|
|
2443
2275
|
const id = attr(rel, "Id");
|
|
2444
2276
|
const target = _nullishCoalesce(attr(rel, "Target"), () => ( ""));
|
|
2445
2277
|
if (!id) return;
|
|
2446
|
-
const external = _optionalChain([attr, 'call',
|
|
2278
|
+
const external = _optionalChain([attr, 'call', _78 => _78(rel, "TargetMode"), 'optionalAccess', _79 => _79.toLowerCase, 'call', _80 => _80()]) === "external";
|
|
2447
2279
|
rels.set(id, {
|
|
2448
2280
|
type: _nullishCoalesce(attr(rel, "Type"), () => ( "")),
|
|
2449
2281
|
target: external ? target : resolvePartPath(baseDir, target),
|
|
@@ -2506,7 +2338,7 @@ async function loadImages(zip, root, rels, options) {
|
|
|
2506
2338
|
for (const id of ids) {
|
|
2507
2339
|
const rel = rels.get(id);
|
|
2508
2340
|
if (!rel || rel.external) continue;
|
|
2509
|
-
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()]), () => ( ""))];
|
|
2510
2342
|
const entry = zip.get(rel.target);
|
|
2511
2343
|
if (!mime || !entry || entry.size > maxSize) continue;
|
|
2512
2344
|
images.set(id, `data:${mime};base64,${toBase64(await zip.read(entry))}`);
|
|
@@ -2645,7 +2477,7 @@ function mapStyleIds(styles) {
|
|
|
2645
2477
|
});
|
|
2646
2478
|
return ids;
|
|
2647
2479
|
}
|
|
2648
|
-
var styleKind = (style) => _optionalChain([style, 'optionalAccess',
|
|
2480
|
+
var styleKind = (style) => _optionalChain([style, 'optionalAccess', _88 => _88.type]) === "character" ? "character" : "paragraph";
|
|
2649
2481
|
function styleDefinitions(styles, ids) {
|
|
2650
2482
|
const out = [];
|
|
2651
2483
|
styles.forEach((style, fileId) => {
|
|
@@ -2971,9 +2803,9 @@ function parseHyperlinkInstruction(instr) {
|
|
|
2971
2803
|
const match = /^\s*HYPERLINK\b(.*)$/i.exec(instr);
|
|
2972
2804
|
if (!match) return void 0;
|
|
2973
2805
|
const rest = match[1];
|
|
2974
|
-
const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access',
|
|
2806
|
+
const anchor = _optionalChain([/\\l\s+"([^"]*)"/, 'access', _89 => _89.exec, 'call', _90 => _90(rest), 'optionalAccess', _91 => _91[1]]);
|
|
2975
2807
|
const target = /^\s*(?:"([^"]*)"|([^\s\\]+))/.exec(rest);
|
|
2976
|
-
const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess',
|
|
2808
|
+
const url = _nullishCoalesce(_optionalChain([target, 'optionalAccess', _92 => _92[1]]), () => ( _optionalChain([target, 'optionalAccess', _93 => _93[2]])));
|
|
2977
2809
|
if (url) return anchor ? `${url}#${anchor}` : url;
|
|
2978
2810
|
return anchor ? `#${anchor}` : void 0;
|
|
2979
2811
|
}
|
|
@@ -3008,7 +2840,7 @@ var ParagraphRenderer = (_class2 = class {
|
|
|
3008
2840
|
else {
|
|
3009
2841
|
this.segments.shift();
|
|
3010
2842
|
const next = this.segments[0];
|
|
3011
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
2843
|
+
if (_optionalChain([next, 'optionalAccess', _94 => _94.kind]) === "text") {
|
|
3012
2844
|
next.text = next.text.replace(/^ /, "");
|
|
3013
2845
|
if (!next.text) this.segments.shift();
|
|
3014
2846
|
}
|
|
@@ -3106,7 +2938,7 @@ var ParagraphRenderer = (_class2 = class {
|
|
|
3106
2938
|
run(r, base) {
|
|
3107
2939
|
const rPr = wChild(r, "rPr");
|
|
3108
2940
|
const runStyle = this.ctx.styles.get(_nullishCoalesce(attr(wChild(rPr, "rStyle"), "val"), () => ( "")));
|
|
3109
|
-
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]), () => ( {}));
|
|
3110
2942
|
const own = readFormat(rPr);
|
|
3111
2943
|
const format = { ...base, ...styleFormat, ...own };
|
|
3112
2944
|
const rPrChange = wChild(rPr, "rPrChange");
|
|
@@ -3273,15 +3105,15 @@ function paragraphInfo(p, ctx) {
|
|
|
3273
3105
|
heading = styleHeadingLevel(ctx.styles, styleId);
|
|
3274
3106
|
}
|
|
3275
3107
|
let numPr = readNumPr(pPr);
|
|
3276
|
-
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]);
|
|
3277
3109
|
let list;
|
|
3278
3110
|
if (numPr && numPr.numId !== "0" && heading === void 0) {
|
|
3279
3111
|
const num = ctx.numbering.nums.get(numPr.numId);
|
|
3280
|
-
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;
|
|
3281
3113
|
list = {
|
|
3282
3114
|
level: Math.max(0, Math.min(numPr.ilvl, 8)),
|
|
3283
|
-
ordered: _nullishCoalesce(_optionalChain([def, 'optionalAccess',
|
|
3284
|
-
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))
|
|
3285
3117
|
};
|
|
3286
3118
|
}
|
|
3287
3119
|
const special = heading === void 0 && !list ? specialStyle(ctx.styles, styleId) : void 0;
|
|
@@ -3415,7 +3247,7 @@ function renderTable(tbl, ctx, part) {
|
|
|
3415
3247
|
if (cell.merge === "restart") {
|
|
3416
3248
|
for (let r = rowIndex + 1; r < rows.length; r++) {
|
|
3417
3249
|
const below = rows[r].find((c) => c.col === cell.col);
|
|
3418
|
-
if (_optionalChain([below, 'optionalAccess',
|
|
3250
|
+
if (_optionalChain([below, 'optionalAccess', _111 => _111.merge]) !== "continue") break;
|
|
3419
3251
|
rowspan++;
|
|
3420
3252
|
}
|
|
3421
3253
|
}
|
|
@@ -3428,7 +3260,7 @@ function renderTable(tbl, ctx, part) {
|
|
|
3428
3260
|
return `${html}</tbody></table>`;
|
|
3429
3261
|
}
|
|
3430
3262
|
function getDomParser(options) {
|
|
3431
|
-
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])));
|
|
3432
3264
|
if (typeof Parser !== "function") {
|
|
3433
3265
|
throw new ImportError(
|
|
3434
3266
|
"unsupported_environment",
|
|
@@ -3443,7 +3275,7 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3443
3275
|
try {
|
|
3444
3276
|
zip = await _chunkALNIFK5Gcjs.readZip.call(void 0, data, { maxTotalSize: 100 * 1024 * 1024, maxEntries: 5e3, ...options.zip });
|
|
3445
3277
|
} catch (error) {
|
|
3446
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
3278
|
+
if (_optionalChain([error, 'optionalAccess', _114 => _114.code]) === "invalid_archive") {
|
|
3447
3279
|
throw new ImportError("invalid_file", "Not a DOCX file (the file is not a ZIP package).", { cause: error });
|
|
3448
3280
|
}
|
|
3449
3281
|
throw error;
|
|
@@ -3463,7 +3295,7 @@ async function docxToDocumentImport(data, options = {}) {
|
|
|
3463
3295
|
throw new ImportError("invalid_file", "Not a Word document (no main document part with a body).");
|
|
3464
3296
|
}
|
|
3465
3297
|
const rels = await readRelationships(zip, Parser, mainPath);
|
|
3466
|
-
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]);
|
|
3467
3299
|
const baseDir = dirname(mainPath);
|
|
3468
3300
|
const stylesPath = _nullishCoalesce(partByType("styles"), () => ( `${baseDir}styles.xml`));
|
|
3469
3301
|
const numberingPath = _nullishCoalesce(partByType("numbering"), () => ( `${baseDir}numbering.xml`));
|
|
@@ -3628,7 +3460,7 @@ function getImportAccept(target) {
|
|
|
3628
3460
|
|
|
3629
3461
|
var toView = (target) => "state" in target && "dispatch" in target ? target : target.view;
|
|
3630
3462
|
function htmlToSlice(html, schema) {
|
|
3631
|
-
const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access',
|
|
3463
|
+
const Parser = _nullishCoalesce(globalThis.DOMParser, () => ( _optionalChain([globalThis, 'access', _120 => _120.window, 'optionalAccess', _121 => _121.DOMParser])));
|
|
3632
3464
|
if (!Parser) return null;
|
|
3633
3465
|
const body = new Parser().parseFromString(`<body>${html}</body>`, "text/html").body;
|
|
3634
3466
|
return new (0, _model.Slice)(_model.DOMParser.fromSchema(schema).parse(body).content, 0, 0);
|
|
@@ -3643,9 +3475,9 @@ function insertImportedDocument(target, content, options = {}) {
|
|
|
3643
3475
|
if (!htmlSlice && from === to && !state.doc.resolve(from).parent.inlineContent) {
|
|
3644
3476
|
from = to = _state.Selection.near(state.doc.resolve(from)).from;
|
|
3645
3477
|
}
|
|
3646
|
-
if (htmlSlice &&
|
|
3478
|
+
if (htmlSlice && _chunkWV5WTOC6cjs.sliceContainsTable.call(void 0, htmlSlice) && _chunkWV5WTOC6cjs.outermostTableDepth.call(void 0, state.doc.resolve(from)) >= 0) {
|
|
3647
3479
|
const tr2 = state.tr;
|
|
3648
|
-
const end2 =
|
|
3480
|
+
const end2 = _chunkWV5WTOC6cjs.insertSliceAfterTable.call(void 0, tr2, from, to, htmlSlice);
|
|
3649
3481
|
if (end2 !== null) {
|
|
3650
3482
|
if (options.at === void 0) tr2.setSelection(_state.Selection.near(tr2.doc.resolve(end2), -1));
|
|
3651
3483
|
view.dispatch(tr2.scrollIntoView().setMeta("uiEvent", "drop"));
|
|
@@ -3658,11 +3490,11 @@ function insertImportedDocument(target, content, options = {}) {
|
|
|
3658
3490
|
return end;
|
|
3659
3491
|
}
|
|
3660
3492
|
function applyImportedReviewData(editor, content) {
|
|
3661
|
-
const storage = _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
3493
|
+
const storage = _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _122 => _122.storage]), () => ( {}));
|
|
3662
3494
|
let comments = 0;
|
|
3663
3495
|
let styles = 0;
|
|
3664
|
-
const store = _optionalChain([storage, 'access',
|
|
3665
|
-
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]), () => ( []));
|
|
3666
3498
|
if (store && threads.length) {
|
|
3667
3499
|
const existing = store.toJSON().threads;
|
|
3668
3500
|
const fresh = threads.filter((thread) => !existing.some((t) => t.id === thread.id));
|
|
@@ -3671,7 +3503,7 @@ function applyImportedReviewData(editor, content) {
|
|
|
3671
3503
|
comments = fresh.length;
|
|
3672
3504
|
}
|
|
3673
3505
|
}
|
|
3674
|
-
const registry = _optionalChain([storage, 'access',
|
|
3506
|
+
const registry = _optionalChain([storage, 'access', _127 => _127.paragraphStyles, 'optionalAccess', _128 => _128.registry]);
|
|
3675
3507
|
if (registry && content.styles) {
|
|
3676
3508
|
for (const style of content.styles.list()) {
|
|
3677
3509
|
if (registry.get(style.id)) continue;
|
|
@@ -3698,7 +3530,7 @@ async function importFilesIntoEditor(target, files, options = {}) {
|
|
|
3698
3530
|
applyImportedReviewData(target, outcome.result);
|
|
3699
3531
|
}
|
|
3700
3532
|
outcomes.push(outcome);
|
|
3701
|
-
_optionalChain([options, 'access',
|
|
3533
|
+
_optionalChain([options, 'access', _129 => _129.onImport, 'optionalCall', _130 => _130(outcome, file)]);
|
|
3702
3534
|
} catch (error) {
|
|
3703
3535
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
3704
3536
|
if (options.onError) options.onError(err, file);
|
|
@@ -3717,7 +3549,7 @@ function getImportableFiles(files, registry) {
|
|
|
3717
3549
|
}
|
|
3718
3550
|
function dropPosition(view, event) {
|
|
3719
3551
|
try {
|
|
3720
|
-
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]);
|
|
3721
3553
|
} catch (e2) {
|
|
3722
3554
|
return void 0;
|
|
3723
3555
|
}
|
|
@@ -3754,7 +3586,7 @@ var FileImport = _core.Extension.create({
|
|
|
3754
3586
|
props: {
|
|
3755
3587
|
handleDrop(view, event, _slice, moved) {
|
|
3756
3588
|
if (!options.enableDrop || moved) return false;
|
|
3757
|
-
const files = getImportableFiles(_optionalChain([event, 'access',
|
|
3589
|
+
const files = getImportableFiles(_optionalChain([event, 'access', _134 => _134.dataTransfer, 'optionalAccess', _135 => _135.files]), registry());
|
|
3758
3590
|
if (!files) return false;
|
|
3759
3591
|
event.preventDefault();
|
|
3760
3592
|
run(view, files, dropPosition(view, event));
|
|
@@ -3762,7 +3594,7 @@ var FileImport = _core.Extension.create({
|
|
|
3762
3594
|
},
|
|
3763
3595
|
handlePaste(view, event) {
|
|
3764
3596
|
if (!options.enablePaste) return false;
|
|
3765
|
-
const files = getImportableFiles(_optionalChain([event, 'access',
|
|
3597
|
+
const files = getImportableFiles(_optionalChain([event, 'access', _136 => _136.clipboardData, 'optionalAccess', _137 => _137.files]), registry());
|
|
3766
3598
|
if (!files) return false;
|
|
3767
3599
|
event.preventDefault();
|
|
3768
3600
|
run(view, files);
|
|
@@ -3786,7 +3618,7 @@ function writeRichClipboard(view, event, options = {}) {
|
|
|
3786
3618
|
const slice = state.selection.content();
|
|
3787
3619
|
const { dom, text } = view.serializeForClipboard(slice);
|
|
3788
3620
|
event.preventDefault();
|
|
3789
|
-
_optionalChain([data, 'access',
|
|
3621
|
+
_optionalChain([data, 'access', _138 => _138.clearData, 'optionalCall', _139 => _139()]);
|
|
3790
3622
|
data.setData("text/html", dom.innerHTML);
|
|
3791
3623
|
data.setData("text/plain", text);
|
|
3792
3624
|
data.setData(_nullishCoalesce(options.mimeType, () => ( _chunk3AJMR7EGcjs.PIXERATE_DOCUMENT_MIME)), _chunk3AJMR7EGcjs.serializeRichClipboardPayload.call(void 0, slice, state.schema));
|
|
@@ -3822,7 +3654,7 @@ var RichClipboard = _core.Extension.create({
|
|
|
3822
3654
|
const slice = _chunk3AJMR7EGcjs.readRichClipboard.call(void 0, event, view.state.schema, mimeType);
|
|
3823
3655
|
if (!slice) return false;
|
|
3824
3656
|
event.preventDefault();
|
|
3825
|
-
if (
|
|
3657
|
+
if (_chunkWV5WTOC6cjs.handleTablePasteWithoutNesting.call(void 0, view, event, slice)) return true;
|
|
3826
3658
|
view.dispatch(
|
|
3827
3659
|
view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste")
|
|
3828
3660
|
);
|
|
@@ -4015,7 +3847,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
4015
3847
|
addCommands() {
|
|
4016
3848
|
return {
|
|
4017
3849
|
undoAutocorrect: () => ({ state, tr, dispatch }) => {
|
|
4018
|
-
const last = _optionalChain([autocorrectPluginKey, 'access',
|
|
3850
|
+
const last = _optionalChain([autocorrectPluginKey, 'access', _140 => _140.getState, 'call', _141 => _141(state), 'optionalAccess', _142 => _142.last]);
|
|
4019
3851
|
if (!last) return false;
|
|
4020
3852
|
if (state.doc.textBetween(last.from, last.to) !== last.replacement) return false;
|
|
4021
3853
|
if (dispatch) {
|
|
@@ -4065,7 +3897,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
4065
3897
|
}
|
|
4066
3898
|
const insertTyped = () => {
|
|
4067
3899
|
const tr2 = state.tr.insertText(text, from, to);
|
|
4068
|
-
if (_optionalChain([pluginState, 'optionalAccess',
|
|
3900
|
+
if (_optionalChain([pluginState, 'optionalAccess', _143 => _143.closePending])) _history.closeHistory.call(void 0, tr2);
|
|
4069
3901
|
view.dispatch(tr2);
|
|
4070
3902
|
};
|
|
4071
3903
|
if (isIgnored(state, from, to)) return false;
|
|
@@ -4073,7 +3905,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
4073
3905
|
if (extension.options.ignorePromptTokens && isInsidePromptToken(textBefore)) {
|
|
4074
3906
|
return false;
|
|
4075
3907
|
}
|
|
4076
|
-
const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access',
|
|
3908
|
+
const currentWord = _nullishCoalesce(_optionalChain([/\S*$/, 'access', _144 => _144.exec, 'call', _145 => _145(textBefore), 'optionalAccess', _146 => _146[0]]), () => ( ""));
|
|
4077
3909
|
if (/:\/\/|^www\./i.test(currentWord)) return false;
|
|
4078
3910
|
const exceptions = extension.storage.exceptions;
|
|
4079
3911
|
const found = findAutocorrection(textBefore, extension.options.rules, {
|
|
@@ -4081,7 +3913,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
4081
3913
|
isException: (value) => exceptions.has(value.toLowerCase())
|
|
4082
3914
|
});
|
|
4083
3915
|
if (!found) {
|
|
4084
|
-
if (!_optionalChain([pluginState, 'optionalAccess',
|
|
3916
|
+
if (!_optionalChain([pluginState, 'optionalAccess', _147 => _147.closePending])) return false;
|
|
4085
3917
|
insertTyped();
|
|
4086
3918
|
return true;
|
|
4087
3919
|
}
|
|
@@ -4118,7 +3950,7 @@ var Autocorrect = _core.Extension.create({
|
|
|
4118
3950
|
_history.closeHistory.call(void 0, tr);
|
|
4119
3951
|
tr.setMeta(autocorrectPluginKey, { correction });
|
|
4120
3952
|
view.dispatch(tr);
|
|
4121
|
-
_optionalChain([extension, 'access',
|
|
3953
|
+
_optionalChain([extension, 'access', _148 => _148.options, 'access', _149 => _149.onCorrection, 'optionalCall', _150 => _150(correction)]);
|
|
4122
3954
|
return true;
|
|
4123
3955
|
};
|
|
4124
3956
|
return [
|
|
@@ -4128,8 +3960,8 @@ var Autocorrect = _core.Extension.create({
|
|
|
4128
3960
|
init: () => ({ last: null, closePending: false }),
|
|
4129
3961
|
apply: (tr, prev) => {
|
|
4130
3962
|
const meta = tr.getMeta(autocorrectPluginKey);
|
|
4131
|
-
if (_optionalChain([meta, 'optionalAccess',
|
|
4132
|
-
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 };
|
|
4133
3965
|
if (!tr.docChanged) return prev;
|
|
4134
3966
|
if (!prev.last && !prev.closePending) return prev;
|
|
4135
3967
|
return { last: null, closePending: false };
|
|
@@ -4222,8 +4054,8 @@ function createOutlineStore(editor) {
|
|
|
4222
4054
|
const compute = () => {
|
|
4223
4055
|
if (!editor || editor.isDestroyed) return EMPTY_SNAPSHOT;
|
|
4224
4056
|
const headings = getOutline(editor);
|
|
4225
|
-
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call',
|
|
4226
|
-
const sameStructure =
|
|
4057
|
+
const activeId = _nullishCoalesce(_optionalChain([getActiveHeading, 'call', _153 => _153(editor, headings), 'optionalAccess', _154 => _154.id]), () => ( null));
|
|
4058
|
+
const sameStructure = _chunkWV5WTOC6cjs.arraysEqual.call(void 0, snapshot.headings, headings, sameHeading);
|
|
4227
4059
|
if (sameStructure && snapshot.activeId === activeId) return snapshot;
|
|
4228
4060
|
return {
|
|
4229
4061
|
headings: sameStructure ? snapshot.headings : headings,
|
|
@@ -4247,16 +4079,16 @@ function createOutlineStore(editor) {
|
|
|
4247
4079
|
subscribe(listener) {
|
|
4248
4080
|
if (!listeners.size) {
|
|
4249
4081
|
snapshot = compute();
|
|
4250
|
-
_optionalChain([editor, 'optionalAccess',
|
|
4082
|
+
_optionalChain([editor, 'optionalAccess', _155 => _155.on, 'call', _156 => _156("transaction", onTransaction)]);
|
|
4251
4083
|
}
|
|
4252
4084
|
listeners.add(listener);
|
|
4253
4085
|
return () => {
|
|
4254
4086
|
listeners.delete(listener);
|
|
4255
|
-
if (!listeners.size) _optionalChain([editor, 'optionalAccess',
|
|
4087
|
+
if (!listeners.size) _optionalChain([editor, 'optionalAccess', _157 => _157.off, 'call', _158 => _158("transaction", onTransaction)]);
|
|
4256
4088
|
};
|
|
4257
4089
|
},
|
|
4258
4090
|
destroy() {
|
|
4259
|
-
_optionalChain([editor, 'optionalAccess',
|
|
4091
|
+
_optionalChain([editor, 'optionalAccess', _159 => _159.off, 'call', _160 => _160("transaction", onTransaction)]);
|
|
4260
4092
|
listeners.clear();
|
|
4261
4093
|
}
|
|
4262
4094
|
};
|
|
@@ -4271,7 +4103,7 @@ function navigateToHeading(editor, heading, options = {}) {
|
|
|
4271
4103
|
editor.view.dispatch(tr);
|
|
4272
4104
|
editor.view.focus();
|
|
4273
4105
|
}
|
|
4274
|
-
|
|
4106
|
+
_chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, editor.view, current.pos, behavior);
|
|
4275
4107
|
return true;
|
|
4276
4108
|
}
|
|
4277
4109
|
function assignHeadingIds(state, types, generateId) {
|
|
@@ -4296,11 +4128,11 @@ function assignHeadingIds(state, types, generateId) {
|
|
|
4296
4128
|
}
|
|
4297
4129
|
var Outline = _core.Extension.create({
|
|
4298
4130
|
name: "outline",
|
|
4299
|
-
priority:
|
|
4131
|
+
priority: _chunkWV5WTOC6cjs.STRUCTURE_PRIORITY,
|
|
4300
4132
|
addOptions() {
|
|
4301
4133
|
return {
|
|
4302
4134
|
types: ["heading"],
|
|
4303
|
-
generateId: () =>
|
|
4135
|
+
generateId: () => _chunkWV5WTOC6cjs.generateStructureId.call(void 0, "h"),
|
|
4304
4136
|
onUpdate: void 0
|
|
4305
4137
|
};
|
|
4306
4138
|
},
|
|
@@ -4331,16 +4163,16 @@ var Outline = _core.Extension.create({
|
|
|
4331
4163
|
if (options.focus !== false) {
|
|
4332
4164
|
tr.setSelection(_state.TextSelection.create(tr.doc, heading.pos + 1));
|
|
4333
4165
|
tr.scrollIntoView();
|
|
4334
|
-
_optionalChain([view, 'optionalAccess',
|
|
4166
|
+
_optionalChain([view, 'optionalAccess', _161 => _161.focus, 'optionalCall', _162 => _162()]);
|
|
4335
4167
|
}
|
|
4336
|
-
|
|
4168
|
+
_chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
|
|
4337
4169
|
}
|
|
4338
4170
|
return true;
|
|
4339
4171
|
},
|
|
4340
4172
|
scrollToHeading: (id, options = {}) => ({ state, dispatch, view }) => {
|
|
4341
4173
|
const heading = findHeading(state, id);
|
|
4342
4174
|
if (!heading) return false;
|
|
4343
|
-
if (dispatch)
|
|
4175
|
+
if (dispatch) _chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, heading.pos, options.behavior);
|
|
4344
4176
|
return true;
|
|
4345
4177
|
}
|
|
4346
4178
|
};
|
|
@@ -4361,9 +4193,9 @@ var Outline = _core.Extension.create({
|
|
|
4361
4193
|
apply: (tr, prev, _oldState, newState) => {
|
|
4362
4194
|
if (!tr.docChanged) return prev;
|
|
4363
4195
|
const next = computeOutline(newState.doc, types);
|
|
4364
|
-
if (
|
|
4196
|
+
if (_chunkWV5WTOC6cjs.arraysEqual.call(void 0, prev, next, sameHeading)) return prev;
|
|
4365
4197
|
storage.headings = next;
|
|
4366
|
-
_optionalChain([onUpdate, 'call',
|
|
4198
|
+
_optionalChain([onUpdate, 'call', _163 => _163(), 'optionalCall', _164 => _164(next)]);
|
|
4367
4199
|
return next;
|
|
4368
4200
|
}
|
|
4369
4201
|
}
|
|
@@ -4379,7 +4211,7 @@ var Outline = _core.Extension.create({
|
|
|
4379
4211
|
},
|
|
4380
4212
|
onBeforeCreate() {
|
|
4381
4213
|
const { types, generateId } = this.options;
|
|
4382
|
-
|
|
4214
|
+
_chunkWV5WTOC6cjs.syncInitialContent.call(void 0, this.editor, (state) => assignHeadingIds(state, types, generateId));
|
|
4383
4215
|
}
|
|
4384
4216
|
});
|
|
4385
4217
|
|
|
@@ -4549,7 +4381,7 @@ function syncTableOfContents(state, headingTypes) {
|
|
|
4549
4381
|
node.attrs.minLevel,
|
|
4550
4382
|
node.attrs.maxLevel
|
|
4551
4383
|
);
|
|
4552
|
-
if (!
|
|
4384
|
+
if (!_chunkWV5WTOC6cjs.arraysEqual.call(void 0, _nullishCoalesce(node.attrs.entries, () => ( [])), entries, sameEntry)) {
|
|
4553
4385
|
tr = _nullishCoalesce(tr, () => ( state.tr));
|
|
4554
4386
|
tr.setNodeMarkup(pos, void 0, { ...node.attrs, entries });
|
|
4555
4387
|
}
|
|
@@ -4561,7 +4393,7 @@ function syncTableOfContents(state, headingTypes) {
|
|
|
4561
4393
|
}
|
|
4562
4394
|
var TableOfContents = _core.Node.create({
|
|
4563
4395
|
name: "tableOfContents",
|
|
4564
|
-
priority:
|
|
4396
|
+
priority: _chunkWV5WTOC6cjs.STRUCTURE_PRIORITY - 5,
|
|
4565
4397
|
group: "block",
|
|
4566
4398
|
atom: true,
|
|
4567
4399
|
selectable: true,
|
|
@@ -4672,7 +4504,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4672
4504
|
return [
|
|
4673
4505
|
new (0, _state.Plugin)({
|
|
4674
4506
|
key: tableOfContentsPluginKey,
|
|
4675
|
-
state:
|
|
4507
|
+
state: _chunkWV5WTOC6cjs.presenceStateSpec.call(void 0, [this.name]),
|
|
4676
4508
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
4677
4509
|
if (!transactions.some((tr) => tr.docChanged)) return null;
|
|
4678
4510
|
if (!tableOfContentsPluginKey.getState(newState)) return null;
|
|
@@ -4682,7 +4514,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4682
4514
|
handleDOMEvents: {
|
|
4683
4515
|
click: (view, event) => {
|
|
4684
4516
|
const target = event.target;
|
|
4685
|
-
const link = _optionalChain([target, 'optionalAccess',
|
|
4517
|
+
const link = _optionalChain([target, 'optionalAccess', _165 => _165.closest, 'optionalCall', _166 => _166(
|
|
4686
4518
|
'nav[data-type="table-of-contents"] a[data-heading-id]'
|
|
4687
4519
|
)]);
|
|
4688
4520
|
if (!link) return false;
|
|
@@ -4696,7 +4528,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4696
4528
|
);
|
|
4697
4529
|
view.focus();
|
|
4698
4530
|
}
|
|
4699
|
-
|
|
4531
|
+
_chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, heading.pos);
|
|
4700
4532
|
return true;
|
|
4701
4533
|
}
|
|
4702
4534
|
}
|
|
@@ -4706,7 +4538,7 @@ var TableOfContents = _core.Node.create({
|
|
|
4706
4538
|
},
|
|
4707
4539
|
onBeforeCreate() {
|
|
4708
4540
|
const { headingTypes } = this.options;
|
|
4709
|
-
|
|
4541
|
+
_chunkWV5WTOC6cjs.syncInitialContent.call(void 0, this.editor, (state) => syncTableOfContents(state, headingTypes));
|
|
4710
4542
|
}
|
|
4711
4543
|
});
|
|
4712
4544
|
|
|
@@ -4755,7 +4587,7 @@ function getFootnotes(doc) {
|
|
|
4755
4587
|
number: index + 1,
|
|
4756
4588
|
text: footnote ? footnoteText(footnote.node) : "",
|
|
4757
4589
|
referencePos: ref.pos,
|
|
4758
|
-
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess',
|
|
4590
|
+
footnotePos: _nullishCoalesce(_optionalChain([footnote, 'optionalAccess', _167 => _167.pos]), () => ( null))
|
|
4759
4591
|
};
|
|
4760
4592
|
});
|
|
4761
4593
|
}
|
|
@@ -4764,7 +4596,7 @@ function syncFootnotes(tr, options = {}) {
|
|
|
4764
4596
|
const listType = schema.nodes[LIST];
|
|
4765
4597
|
const itemType = schema.nodes[ITEM];
|
|
4766
4598
|
if (!listType || !itemType) return false;
|
|
4767
|
-
const generateId = _nullishCoalesce(options.generateId, () => ( (() =>
|
|
4599
|
+
const generateId = _nullishCoalesce(options.generateId, () => ( (() => _chunkWV5WTOC6cjs.generateStructureId.call(void 0, "fn"))));
|
|
4768
4600
|
const refs = [];
|
|
4769
4601
|
const lists = [];
|
|
4770
4602
|
const existing = /* @__PURE__ */ new Map();
|
|
@@ -4797,7 +4629,7 @@ function syncFootnotes(tr, options = {}) {
|
|
|
4797
4629
|
});
|
|
4798
4630
|
const desiredItems = desiredRefs.map(({ id, number, copyOf }) => {
|
|
4799
4631
|
const source = _nullishCoalesce(existing.get(id), () => ( (copyOf ? existing.get(copyOf) : void 0)));
|
|
4800
|
-
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]]), () => ( "")))));
|
|
4801
4633
|
if (source && source.attrs.id === id && source.attrs.number === number) {
|
|
4802
4634
|
return source;
|
|
4803
4635
|
}
|
|
@@ -4848,7 +4680,7 @@ function findReferences(doc, id) {
|
|
|
4848
4680
|
}
|
|
4849
4681
|
var FootnoteReference = _core.Node.create({
|
|
4850
4682
|
name: REFERENCE,
|
|
4851
|
-
priority:
|
|
4683
|
+
priority: _chunkWV5WTOC6cjs.STRUCTURE_PRIORITY - 5,
|
|
4852
4684
|
group: "inline",
|
|
4853
4685
|
inline: true,
|
|
4854
4686
|
atom: true,
|
|
@@ -4856,7 +4688,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4856
4688
|
addOptions() {
|
|
4857
4689
|
return {
|
|
4858
4690
|
HTMLAttributes: {},
|
|
4859
|
-
generateId: () =>
|
|
4691
|
+
generateId: () => _chunkWV5WTOC6cjs.generateStructureId.call(void 0, "fn")
|
|
4860
4692
|
};
|
|
4861
4693
|
},
|
|
4862
4694
|
addAttributes() {
|
|
@@ -4967,7 +4799,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4967
4799
|
_state.TextSelection.create(tr.doc, footnote.pos + footnote.node.nodeSize - 2)
|
|
4968
4800
|
);
|
|
4969
4801
|
tr.scrollIntoView();
|
|
4970
|
-
|
|
4802
|
+
_chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, footnote.pos);
|
|
4971
4803
|
}
|
|
4972
4804
|
return true;
|
|
4973
4805
|
},
|
|
@@ -4977,7 +4809,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4977
4809
|
if (dispatch) {
|
|
4978
4810
|
tr.setSelection(_state.NodeSelection.create(tr.doc, ref.pos));
|
|
4979
4811
|
tr.scrollIntoView();
|
|
4980
|
-
|
|
4812
|
+
_chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, ref.pos);
|
|
4981
4813
|
}
|
|
4982
4814
|
return true;
|
|
4983
4815
|
}
|
|
@@ -4989,7 +4821,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
4989
4821
|
return [
|
|
4990
4822
|
new (0, _state.Plugin)({
|
|
4991
4823
|
key: footnotesPluginKey,
|
|
4992
|
-
state:
|
|
4824
|
+
state: _chunkWV5WTOC6cjs.presenceStateSpec.call(void 0, [REFERENCE, LIST]),
|
|
4993
4825
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
4994
4826
|
if (!transactions.some((tr2) => tr2.docChanged)) return null;
|
|
4995
4827
|
if (!footnotesPluginKey.getState(newState)) return null;
|
|
@@ -5000,7 +4832,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
5000
4832
|
handleClickOn: (_view, _pos, node, _nodePos, event) => {
|
|
5001
4833
|
if (node.type.name !== REFERENCE || !node.attrs.id) return false;
|
|
5002
4834
|
const target = event.target;
|
|
5003
|
-
if (!_optionalChain([target, 'optionalAccess',
|
|
4835
|
+
if (!_optionalChain([target, 'optionalAccess', _171 => _171.closest, 'optionalCall', _172 => _172("a")])) return false;
|
|
5004
4836
|
event.preventDefault();
|
|
5005
4837
|
return editor.commands.goToFootnote(node.attrs.id);
|
|
5006
4838
|
}
|
|
@@ -5010,7 +4842,7 @@ var FootnoteReference = _core.Node.create({
|
|
|
5010
4842
|
},
|
|
5011
4843
|
onBeforeCreate() {
|
|
5012
4844
|
const { generateId } = this.options;
|
|
5013
|
-
|
|
4845
|
+
_chunkWV5WTOC6cjs.syncInitialContent.call(void 0, this.editor, (state) => {
|
|
5014
4846
|
const tr = state.tr;
|
|
5015
4847
|
return syncFootnotes(tr, { generateId }) ? tr : null;
|
|
5016
4848
|
});
|
|
@@ -5150,7 +4982,7 @@ var Bookmark = _core.Mark.create({
|
|
|
5150
4982
|
addOptions() {
|
|
5151
4983
|
return {
|
|
5152
4984
|
HTMLAttributes: {},
|
|
5153
|
-
generateId: () =>
|
|
4985
|
+
generateId: () => _chunkWV5WTOC6cjs.generateStructureId.call(void 0, "bm")
|
|
5154
4986
|
};
|
|
5155
4987
|
},
|
|
5156
4988
|
addAttributes() {
|
|
@@ -5198,7 +5030,7 @@ var Bookmark = _core.Mark.create({
|
|
|
5198
5030
|
}
|
|
5199
5031
|
if (!dispatch) return true;
|
|
5200
5032
|
const sameName = getBookmarks(state.doc).find((b) => b.name === name);
|
|
5201
|
-
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess',
|
|
5033
|
+
const bookmarkId = _nullishCoalesce(_nullishCoalesce(id, () => ( _optionalChain([sameName, 'optionalAccess', _173 => _173.id]))), () => ( this.options.generateId()));
|
|
5202
5034
|
if (sameName) {
|
|
5203
5035
|
forEachBookmarkRange(
|
|
5204
5036
|
tr.doc,
|
|
@@ -5235,7 +5067,7 @@ var Bookmark = _core.Mark.create({
|
|
|
5235
5067
|
tr.setSelection(_state.TextSelection.create(tr.doc, bookmark.from, bookmark.to));
|
|
5236
5068
|
tr.scrollIntoView();
|
|
5237
5069
|
const domPos = state.doc.resolve(bookmark.from);
|
|
5238
|
-
|
|
5070
|
+
_chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, domPos.before(domPos.depth));
|
|
5239
5071
|
}
|
|
5240
5072
|
return true;
|
|
5241
5073
|
}
|
|
@@ -5300,7 +5132,7 @@ function syncCrossReferences(state, headingTypes) {
|
|
|
5300
5132
|
}
|
|
5301
5133
|
var CrossReference = _core.Node.create({
|
|
5302
5134
|
name: NAME,
|
|
5303
|
-
priority:
|
|
5135
|
+
priority: _chunkWV5WTOC6cjs.STRUCTURE_PRIORITY - 5,
|
|
5304
5136
|
group: "inline",
|
|
5305
5137
|
inline: true,
|
|
5306
5138
|
atom: true,
|
|
@@ -5402,7 +5234,7 @@ var CrossReference = _core.Node.create({
|
|
|
5402
5234
|
if (dispatch) {
|
|
5403
5235
|
tr.setSelection(_state.TextSelection.create(tr.doc, range.from, range.to));
|
|
5404
5236
|
tr.scrollIntoView();
|
|
5405
|
-
|
|
5237
|
+
_chunkWV5WTOC6cjs.scrollDomAtPos.call(void 0, view, range.blockPos);
|
|
5406
5238
|
}
|
|
5407
5239
|
return true;
|
|
5408
5240
|
}
|
|
@@ -5414,7 +5246,7 @@ var CrossReference = _core.Node.create({
|
|
|
5414
5246
|
return [
|
|
5415
5247
|
new (0, _state.Plugin)({
|
|
5416
5248
|
key: crossReferencePluginKey,
|
|
5417
|
-
state:
|
|
5249
|
+
state: _chunkWV5WTOC6cjs.presenceStateSpec.call(void 0, [NAME]),
|
|
5418
5250
|
appendTransaction: (transactions, _oldState, newState) => {
|
|
5419
5251
|
if (!transactions.some((tr) => tr.docChanged)) return null;
|
|
5420
5252
|
if (!crossReferencePluginKey.getState(newState)) return null;
|
|
@@ -5433,14 +5265,14 @@ var CrossReference = _core.Node.create({
|
|
|
5433
5265
|
},
|
|
5434
5266
|
onBeforeCreate() {
|
|
5435
5267
|
const { headingTypes } = this.options;
|
|
5436
|
-
|
|
5268
|
+
_chunkWV5WTOC6cjs.syncInitialContent.call(void 0, this.editor, (state) => syncCrossReferences(state, headingTypes));
|
|
5437
5269
|
}
|
|
5438
5270
|
});
|
|
5439
5271
|
|
|
5440
5272
|
// src/extensions/document-structure/command-items.ts
|
|
5441
5273
|
var start = (editor, args) => {
|
|
5442
5274
|
const chain = editor.chain().focus();
|
|
5443
|
-
return _optionalChain([args, 'optionalAccess',
|
|
5275
|
+
return _optionalChain([args, 'optionalAccess', _174 => _174.range]) ? chain.deleteRange(args.range) : chain;
|
|
5444
5276
|
};
|
|
5445
5277
|
var documentStructureCommandItems = [
|
|
5446
5278
|
{
|
|
@@ -5457,7 +5289,7 @@ var documentStructureCommandItems = [
|
|
|
5457
5289
|
description: "Insert a numbered footnote",
|
|
5458
5290
|
keywords: ["footnote", "note", "fn", "citation"],
|
|
5459
5291
|
extension: "footnoteReference",
|
|
5460
|
-
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()
|
|
5461
5293
|
},
|
|
5462
5294
|
{
|
|
5463
5295
|
id: "bookmark",
|
|
@@ -5466,7 +5298,7 @@ var documentStructureCommandItems = [
|
|
|
5466
5298
|
keywords: ["bookmark", "anchor", "name"],
|
|
5467
5299
|
extension: "bookmark",
|
|
5468
5300
|
requires: "name",
|
|
5469
|
-
run: (editor, args) => !!_optionalChain([args, 'optionalAccess',
|
|
5301
|
+
run: (editor, args) => !!_optionalChain([args, 'optionalAccess', _176 => _176.name]) && start(editor, args).setBookmark({ name: args.name }).run()
|
|
5470
5302
|
},
|
|
5471
5303
|
{
|
|
5472
5304
|
id: "cross-reference",
|
|
@@ -5475,7 +5307,7 @@ var documentStructureCommandItems = [
|
|
|
5475
5307
|
keywords: ["cross", "reference", "xref", "link", "ref"],
|
|
5476
5308
|
extension: "crossReference",
|
|
5477
5309
|
requires: "target",
|
|
5478
|
-
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()
|
|
5479
5311
|
}
|
|
5480
5312
|
];
|
|
5481
5313
|
function getDocumentStructureCommandItems(editor, query = "") {
|
|
@@ -5534,13 +5366,13 @@ var FindReplaceStore = (_class3 = class {constructor() { _class3.prototype.__ini
|
|
|
5534
5366
|
}, _class3);
|
|
5535
5367
|
var findReplacePluginKey = new (0, _state.PluginKey)("findReplace");
|
|
5536
5368
|
function getFindReplaceState(source) {
|
|
5537
|
-
const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess',
|
|
5369
|
+
const state = _nullishCoalesce(_optionalChain([source, 'optionalAccess', _178 => _178.state]), () => ( source));
|
|
5538
5370
|
if (!state || typeof state.plugins === "undefined") return null;
|
|
5539
5371
|
const plugin = findReplacePluginKey.getState(state);
|
|
5540
5372
|
return plugin ? toSnapshot(plugin) : null;
|
|
5541
5373
|
}
|
|
5542
5374
|
function getFindReplaceStore(editor) {
|
|
5543
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
5375
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _179 => _179.storage, 'optionalAccess', _180 => _180.findReplace, 'optionalAccess', _181 => _181.store]), () => ( null));
|
|
5544
5376
|
}
|
|
5545
5377
|
var snapshotCache = /* @__PURE__ */ new WeakMap();
|
|
5546
5378
|
function toSnapshot(s) {
|
|
@@ -5688,7 +5520,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5688
5520
|
if (!s || !s.active || s.currentIndex < 0 || !s.matches[s.currentIndex]) return false;
|
|
5689
5521
|
if (dispatch) {
|
|
5690
5522
|
_history.closeHistory.call(void 0, tr);
|
|
5691
|
-
const [end] =
|
|
5523
|
+
const [end] = _chunkWV5WTOC6cjs.applyReplacements.call(void 0, tr, [s.matches[s.currentIndex]]);
|
|
5692
5524
|
tr.setSelection(_state.TextSelection.create(tr.doc, end)).scrollIntoView();
|
|
5693
5525
|
meta(tr, { type: "replaced", anchor: end, count: 1 });
|
|
5694
5526
|
}
|
|
@@ -5699,7 +5531,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5699
5531
|
if (!s || !s.active || !s.matches.length) return false;
|
|
5700
5532
|
if (dispatch) {
|
|
5701
5533
|
_history.closeHistory.call(void 0, tr);
|
|
5702
|
-
const ends =
|
|
5534
|
+
const ends = _chunkWV5WTOC6cjs.applyReplacements.call(void 0, tr, s.matches);
|
|
5703
5535
|
meta(tr, { type: "replaced", anchor: ends[ends.length - 1], count: s.matches.length });
|
|
5704
5536
|
}
|
|
5705
5537
|
return true;
|
|
@@ -5711,7 +5543,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5711
5543
|
const open = (mode) => () => this.editor.commands.openFindReplace({ mode });
|
|
5712
5544
|
const step = (forward) => () => {
|
|
5713
5545
|
const s = findReplacePluginKey.getState(this.editor.state);
|
|
5714
|
-
if (!_optionalChain([s, 'optionalAccess',
|
|
5546
|
+
if (!_optionalChain([s, 'optionalAccess', _182 => _182.active]) || !s.matches.length) return false;
|
|
5715
5547
|
return forward ? this.editor.commands.findNext() : this.editor.commands.findPrevious();
|
|
5716
5548
|
};
|
|
5717
5549
|
return {
|
|
@@ -5731,7 +5563,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5731
5563
|
if (!s.active || !s.query) {
|
|
5732
5564
|
return { ...s, matches: [], currentIndex: -1, error: null, truncated: false };
|
|
5733
5565
|
}
|
|
5734
|
-
const result =
|
|
5566
|
+
const result = _chunkWV5WTOC6cjs.searchDocument.call(void 0, doc, s.query, s.options, {
|
|
5735
5567
|
replacement: s.replacement,
|
|
5736
5568
|
clipboardText: safeClipboard(options.getClipboardText),
|
|
5737
5569
|
timeLimitMs: options.timeLimitMs,
|
|
@@ -5824,7 +5656,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5824
5656
|
s = {
|
|
5825
5657
|
...s,
|
|
5826
5658
|
currentIndex: m.index,
|
|
5827
|
-
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))
|
|
5828
5660
|
};
|
|
5829
5661
|
redecorate = true;
|
|
5830
5662
|
break;
|
|
@@ -5840,7 +5672,7 @@ var FindReplace = _core.Extension.create({
|
|
|
5840
5672
|
}
|
|
5841
5673
|
},
|
|
5842
5674
|
props: {
|
|
5843
|
-
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))
|
|
5844
5676
|
},
|
|
5845
5677
|
view: (view) => {
|
|
5846
5678
|
const sync = () => {
|
|
@@ -5869,11 +5701,11 @@ var STYLE_ID_ATTRIBUTE = "styleId";
|
|
|
5869
5701
|
var CHARACTER_STYLE_MARK_NAME = "characterStyle";
|
|
5870
5702
|
var paragraphStylesPluginKey = new (0, _state.PluginKey)("paragraphStyles");
|
|
5871
5703
|
function getStyleRegistry(editor) {
|
|
5872
|
-
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess',
|
|
5704
|
+
return _nullishCoalesce(_optionalChain([editor, 'optionalAccess', _189 => _189.storage, 'optionalAccess', _190 => _190.paragraphStyles, 'optionalAccess', _191 => _191.registry]), () => ( null));
|
|
5873
5705
|
}
|
|
5874
5706
|
function headingLevels(editor) {
|
|
5875
|
-
const heading = _optionalChain([editor, 'optionalAccess',
|
|
5876
|
-
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]);
|
|
5877
5709
|
return Array.isArray(levels) ? levels : null;
|
|
5878
5710
|
}
|
|
5879
5711
|
function isParagraphStyleAvailable(editor, registry, id) {
|
|
@@ -5883,7 +5715,7 @@ function isParagraphStyleAvailable(editor, registry, id) {
|
|
|
5883
5715
|
if (!editor.schema.nodes[block.type]) return false;
|
|
5884
5716
|
if (block.type === "heading") {
|
|
5885
5717
|
const levels = headingLevels(editor);
|
|
5886
|
-
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;
|
|
5887
5719
|
}
|
|
5888
5720
|
return true;
|
|
5889
5721
|
}
|
|
@@ -5923,7 +5755,7 @@ function captureSelectionFormat(state) {
|
|
|
5923
5755
|
if (name === "highlight") character.backgroundColor = mark.attrs.color || "#fef08a";
|
|
5924
5756
|
});
|
|
5925
5757
|
const paragraph = {};
|
|
5926
|
-
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]);
|
|
5927
5759
|
if (align && align !== "left") paragraph.textAlign = align;
|
|
5928
5760
|
return { paragraph, character };
|
|
5929
5761
|
}
|
|
@@ -6089,7 +5921,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
6089
5921
|
},
|
|
6090
5922
|
clearParagraphStyle: () => ({ commands }) => commands.setParagraphStyle(_chunkYN6JKAUEcjs.NORMAL_STYLE_ID),
|
|
6091
5923
|
setCharacterStyle: (id) => ({ commands }) => {
|
|
6092
|
-
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;
|
|
6093
5925
|
return commands.setMark(CHARACTER_STYLE_MARK_NAME, { [STYLE_ID_ATTRIBUTE]: id });
|
|
6094
5926
|
},
|
|
6095
5927
|
unsetCharacterStyle: () => ({ commands }) => commands.unsetMark(CHARACTER_STYLE_MARK_NAME),
|
|
@@ -6155,7 +5987,7 @@ var ParagraphStyles = _core.Extension.create({
|
|
|
6155
5987
|
};
|
|
6156
5988
|
},
|
|
6157
5989
|
onDestroy() {
|
|
6158
|
-
_optionalChain([this, 'access',
|
|
5990
|
+
_optionalChain([this, 'access', _209 => _209.storage, 'access', _210 => _210.cleanup, 'optionalCall', _211 => _211()]);
|
|
6159
5991
|
}
|
|
6160
5992
|
});
|
|
6161
5993
|
var EMPTY_STYLES = Object.freeze({
|
|
@@ -6193,8 +6025,8 @@ function createParagraphStylesStore(editor) {
|
|
|
6193
6025
|
}
|
|
6194
6026
|
};
|
|
6195
6027
|
const detach = () => {
|
|
6196
|
-
_optionalChain([editor, 'optionalAccess',
|
|
6197
|
-
_optionalChain([unsubscribeRegistry, 'optionalCall',
|
|
6028
|
+
_optionalChain([editor, 'optionalAccess', _212 => _212.off, 'call', _213 => _213("transaction", update)]);
|
|
6029
|
+
_optionalChain([unsubscribeRegistry, 'optionalCall', _214 => _214()]);
|
|
6198
6030
|
unsubscribeRegistry = null;
|
|
6199
6031
|
};
|
|
6200
6032
|
return {
|
|
@@ -6205,7 +6037,7 @@ function createParagraphStylesStore(editor) {
|
|
|
6205
6037
|
subscribe(listener) {
|
|
6206
6038
|
if (!listeners.size) {
|
|
6207
6039
|
snapshot = compute();
|
|
6208
|
-
_optionalChain([editor, 'optionalAccess',
|
|
6040
|
+
_optionalChain([editor, 'optionalAccess', _215 => _215.on, 'call', _216 => _216("transaction", update)]);
|
|
6209
6041
|
unsubscribeRegistry = registry ? registry.subscribe(update) : null;
|
|
6210
6042
|
}
|
|
6211
6043
|
listeners.add(listener);
|
|
@@ -6222,7 +6054,7 @@ function createParagraphStylesStore(editor) {
|
|
|
6222
6054
|
}
|
|
6223
6055
|
|
|
6224
6056
|
// src/extensions/rich-text-preset.ts
|
|
6225
|
-
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;
|
|
6226
6058
|
var StarterKit = resolveExt3(_StarterKit, "StarterKit");
|
|
6227
6059
|
var Color = resolveExt3(_Color, "Color");
|
|
6228
6060
|
var Highlight = resolveExt3(_Highlight, "Highlight");
|
|
@@ -6303,7 +6135,7 @@ function createRichTextPreset(options = {}) {
|
|
|
6303
6135
|
find: /^\s*(\[([ |x])?\])\s$/i,
|
|
6304
6136
|
type: this.type,
|
|
6305
6137
|
getAttributes: (match) => ({
|
|
6306
|
-
checked: _optionalChain([match, 'access',
|
|
6138
|
+
checked: _optionalChain([match, 'access', _223 => _223[2], 'optionalAccess', _224 => _224.toLowerCase, 'call', _225 => _225()]) === "x"
|
|
6307
6139
|
})
|
|
6308
6140
|
})
|
|
6309
6141
|
];
|
|
@@ -6318,7 +6150,7 @@ function createRichTextPreset(options = {}) {
|
|
|
6318
6150
|
})
|
|
6319
6151
|
];
|
|
6320
6152
|
if (options.table !== false) {
|
|
6321
|
-
extensions2.push(...
|
|
6153
|
+
extensions2.push(..._chunkWV5WTOC6cjs.createTableExtensions.call(void 0, optionObject(options.table)));
|
|
6322
6154
|
}
|
|
6323
6155
|
if (characterLimit) {
|
|
6324
6156
|
extensions2.push(
|
|
@@ -6375,7 +6207,7 @@ function createRichTextPreset(options = {}) {
|
|
|
6375
6207
|
}
|
|
6376
6208
|
if (options.comments) {
|
|
6377
6209
|
extensions2.push(
|
|
6378
|
-
typeof options.comments === "object" ? Comments.configure(options.comments) : Comments
|
|
6210
|
+
typeof options.comments === "object" ? _chunkWV5WTOC6cjs.Comments.configure(options.comments) : _chunkWV5WTOC6cjs.Comments
|
|
6379
6211
|
);
|
|
6380
6212
|
}
|
|
6381
6213
|
if (options.trackChanges) {
|
|
@@ -6425,8 +6257,8 @@ function createRichTextPreset(options = {}) {
|
|
|
6425
6257
|
}
|
|
6426
6258
|
if (options.chart) {
|
|
6427
6259
|
const { sparkline = true, ...chartOptions } = optionObject(options.chart);
|
|
6428
|
-
extensions2.push(
|
|
6429
|
-
if (sparkline) extensions2.push(
|
|
6260
|
+
extensions2.push(_chunkWV5WTOC6cjs.Chart.configure(chartOptions));
|
|
6261
|
+
if (sparkline) extensions2.push(_chunkWV5WTOC6cjs.Sparkline.configure(optionObject(sparkline)));
|
|
6430
6262
|
}
|
|
6431
6263
|
if (options.paragraphStyles) {
|
|
6432
6264
|
extensions2.push(ParagraphStyles.configure(optionObject(options.paragraphStyles)));
|
|
@@ -6479,7 +6311,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6479
6311
|
const hasMatches = () => {
|
|
6480
6312
|
const ok = usable(editor);
|
|
6481
6313
|
if (ok !== true) return ok;
|
|
6482
|
-
return _optionalChain([state, 'call',
|
|
6314
|
+
return _optionalChain([state, 'call', _226 => _226(), 'optionalAccess', _227 => _227.matches, 'access', _228 => _228.length]) ? true : "No matches.";
|
|
6483
6315
|
};
|
|
6484
6316
|
const apply = (params) => {
|
|
6485
6317
|
const split = splitParams(params);
|
|
@@ -6487,7 +6319,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6487
6319
|
};
|
|
6488
6320
|
const failIfInvalid = () => {
|
|
6489
6321
|
const s = state();
|
|
6490
|
-
if (_optionalChain([s, 'optionalAccess',
|
|
6322
|
+
if (_optionalChain([s, 'optionalAccess', _229 => _229.error])) throw new Error(s.error.message);
|
|
6491
6323
|
};
|
|
6492
6324
|
return [
|
|
6493
6325
|
{
|
|
@@ -6526,9 +6358,9 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6526
6358
|
failIfInvalid();
|
|
6527
6359
|
const s = state();
|
|
6528
6360
|
return {
|
|
6529
|
-
count: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
6530
|
-
truncated: _nullishCoalesce(_optionalChain([s, 'optionalAccess',
|
|
6531
|
-
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 }))
|
|
6532
6364
|
};
|
|
6533
6365
|
}
|
|
6534
6366
|
},
|
|
@@ -6555,11 +6387,11 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6555
6387
|
description: "Replaces every match (one undo step). Tracked when Track Changes is on.",
|
|
6556
6388
|
params: searchParams(true),
|
|
6557
6389
|
...scope,
|
|
6558
|
-
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess',
|
|
6390
|
+
enabled: (_ctx, params) => _optionalChain([params, 'optionalAccess', _234 => _234.query]) !== void 0 ? usable(editor) : hasMatches(),
|
|
6559
6391
|
run: (_ctx, params) => {
|
|
6560
6392
|
apply(params);
|
|
6561
6393
|
failIfInvalid();
|
|
6562
|
-
const count = _nullishCoalesce(_optionalChain([state, 'call',
|
|
6394
|
+
const count = _nullishCoalesce(_optionalChain([state, 'call', _235 => _235(), 'optionalAccess', _236 => _236.matches, 'access', _237 => _237.length]), () => ( 0));
|
|
6563
6395
|
if (count) editor.commands.replaceAll();
|
|
6564
6396
|
return { replaced: count };
|
|
6565
6397
|
}
|
|
@@ -6567,7 +6399,7 @@ function createFindReplaceCommands(editor, options = {}) {
|
|
|
6567
6399
|
];
|
|
6568
6400
|
}
|
|
6569
6401
|
function validateFindPattern(query, options = {}) {
|
|
6570
|
-
const result =
|
|
6402
|
+
const result = _chunkWV5WTOC6cjs.compileFindPattern.call(void 0, query, options);
|
|
6571
6403
|
return result.ok ? null : result.error;
|
|
6572
6404
|
}
|
|
6573
6405
|
|
|
@@ -6576,8 +6408,8 @@ var PARAMS = {
|
|
|
6576
6408
|
insertTable: {
|
|
6577
6409
|
type: "object",
|
|
6578
6410
|
properties: {
|
|
6579
|
-
rows: { type: "integer", minimum: 1, maximum:
|
|
6580
|
-
cols: { type: "integer", minimum: 1, maximum:
|
|
6411
|
+
rows: { type: "integer", minimum: 1, maximum: _chunkWV5WTOC6cjs.MAX_TABLE_ROWS, description: "Rows (default 3)." },
|
|
6412
|
+
cols: { type: "integer", minimum: 1, maximum: _chunkWV5WTOC6cjs.MAX_TABLE_COLUMNS, description: "Columns (default 3)." },
|
|
6581
6413
|
withHeaderRow: { type: "boolean", description: "Make the first row a header row (default true)." }
|
|
6582
6414
|
},
|
|
6583
6415
|
additionalProperties: false
|
|
@@ -6608,7 +6440,7 @@ function createTableCommands(editor, options = {}) {
|
|
|
6608
6440
|
const group = _nullishCoalesce(options.group, () => ( "Table"));
|
|
6609
6441
|
const scope = options.scope ? { scope: options.scope } : {};
|
|
6610
6442
|
const focus = _nullishCoalesce(options.focus, () => ( true));
|
|
6611
|
-
return
|
|
6443
|
+
return _chunkWV5WTOC6cjs.TABLE_ACTIONS.map(({ action, label, description, keywords }) => {
|
|
6612
6444
|
const params = PARAMS[action];
|
|
6613
6445
|
return {
|
|
6614
6446
|
id: `${prefix}${action}`,
|
|
@@ -6618,13 +6450,13 @@ function createTableCommands(editor, options = {}) {
|
|
|
6618
6450
|
description,
|
|
6619
6451
|
...params ? { params } : {},
|
|
6620
6452
|
...scope,
|
|
6621
|
-
enabled: (_ctx, p) =>
|
|
6453
|
+
enabled: (_ctx, p) => _chunkWV5WTOC6cjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {}))),
|
|
6622
6454
|
run: (_ctx, p) => {
|
|
6623
|
-
if (!
|
|
6624
|
-
const reason =
|
|
6455
|
+
if (!_chunkWV5WTOC6cjs.runTableAction.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})), { focus })) {
|
|
6456
|
+
const reason = _chunkWV5WTOC6cjs.getTableActionState.call(void 0, editor, action, _nullishCoalesce(p, () => ( {})));
|
|
6625
6457
|
throw new Error(reason === true ? `${label} did not change the document.` : reason);
|
|
6626
6458
|
}
|
|
6627
|
-
const state =
|
|
6459
|
+
const state = _chunkWV5WTOC6cjs.getTableState.call(void 0, editor);
|
|
6628
6460
|
return {
|
|
6629
6461
|
done: true,
|
|
6630
6462
|
table: state.inTable ? { rows: state.rows, columns: state.columns, row: state.row, column: state.column } : null
|
|
@@ -6748,11 +6580,4 @@ function createTableCommands(editor, options = {}) {
|
|
|
6748
6580
|
|
|
6749
6581
|
|
|
6750
6582
|
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
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;
|
|
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;
|