@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.
@@ -13,6 +13,7 @@ import {
13
13
  } from "./chunk-V5OOP74P.js";
14
14
  import {
15
15
  Chart,
16
+ Comments,
16
17
  MAX_TABLE_COLUMNS,
17
18
  MAX_TABLE_ROWS,
18
19
  STRUCTURE_PRIORITY,
@@ -34,7 +35,7 @@ import {
34
35
  searchDocument,
35
36
  sliceContainsTable,
36
37
  syncInitialContent
37
- } from "./chunk-PI2UYMZY.js";
38
+ } from "./chunk-FSLKBQU7.js";
38
39
  import {
39
40
  chartDataToTable
40
41
  } from "./chunk-6ZZKRH7R.js";
@@ -54,7 +55,6 @@ import {
54
55
  plainTextToSlice
55
56
  } from "./chunk-2INPJDNY.js";
56
57
  import {
57
- CommentStore,
58
58
  TRACK_CHANGES_SKIP_META,
59
59
  TrackChanges,
60
60
  createReviewId,
@@ -411,12 +411,66 @@ var TemplateSuggestions = Extension2.create({
411
411
 
412
412
  // src/extensions/loading-node.ts
413
413
  import { Node as Node2 } from "@tiptap/core";
414
+ import { DOMSerializer } from "@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: node.attrs.id ?? null,
448
+ label: options.label
449
+ });
450
+ var placeholderAttributes = (options, HTMLAttributes) => safeMergeAttributes(
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 = Node2.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 = Node2.create({
439
493
  renderHTML({ HTMLAttributes }) {
440
494
  return [
441
495
  "span",
442
- safeMergeAttributes(HTMLAttributes, {
443
- "data-type": "loading",
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
+ (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 } = DOMSerializer.renderSpec(document, [
505
+ "span",
506
+ placeholderAttributes(options, HTMLAttributes),
507
+ ...mount ? [] : [(options.renderIndicator ?? loadingSpinnerSpec)()]
508
+ ]);
509
+ const element = dom;
510
+ const renderer = mount?.(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
+ renderer?.update(viewState(next, options));
518
+ return true;
519
+ },
520
+ ignoreMutation: () => true,
521
+ destroy: () => renderer?.destroy()
522
+ };
523
+ };
448
524
  }
449
525
  });
450
526
 
@@ -1870,250 +1946,6 @@ var Image2 = BaseImage.extend({
1870
1946
  }
1871
1947
  });
1872
1948
 
1873
- // src/extensions/comments.ts
1874
- import { Mark as Mark3 } from "@tiptap/core";
1875
- import { Plugin as Plugin6, PluginKey as PluginKey3, TextSelection } from "@tiptap/pm/state";
1876
- import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@tiptap/pm/view";
1877
- var commentsPluginKey = new PluginKey3("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 = 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
- ...$pos.nodeAfter?.marks ?? [],
1917
- ...$pos.nodeBefore?.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 editor?.storage?.[COMMENT_MARK_NAME]?.store ?? null;
1929
- }
1930
- function resolveAuthor(author) {
1931
- return typeof author === "function" ? author() : author;
1932
- }
1933
- var Comments = Mark3.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: this.options.store ?? new 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", safeMergeAttributes(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 = options.id ?? createReviewId("comment");
1980
- tr.addMark(from, to, this.type.create({ commentId: id }));
1981
- tr.setMeta(commentsPluginKey, "refresh");
1982
- store().createThread({
1983
- id,
1984
- body: options.body ?? "",
1985
- author: 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 = 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(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 = thread?.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(Decoration3.inline(from, to, { class: cls }));
2060
- });
2061
- });
2062
- const set = DecorationSet3.create(doc, decorations);
2063
- cache = { doc, snapshot, set };
2064
- return set;
2065
- };
2066
- return [
2067
- new Plugin6({
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 (cache?.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(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 = editor?.extensionManager?.extensions.find((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
  import { Extension as Extension7 } from "@tiptap/core";
2119
1951
  function trackChangesAuthor(state) {
@@ -2164,7 +1996,7 @@ var DocumentCompare = Extension7.create({
2164
1996
 
2165
1997
  // src/extensions/file-import.ts
2166
1998
  import { Extension as Extension8 } from "@tiptap/core";
2167
- import { Plugin as Plugin7, PluginKey as PluginKey4 } from "@tiptap/pm/state";
1999
+ import { Plugin as Plugin6, PluginKey as PluginKey3 } from "@tiptap/pm/state";
2168
2000
 
2169
2001
  // src/import/registry.ts
2170
2002
  var ImportError = class extends Error {
@@ -3709,7 +3541,7 @@ async function importFilesIntoEditor(target, files, options = {}) {
3709
3541
  }
3710
3542
 
3711
3543
  // src/extensions/file-import.ts
3712
- var fileImportPluginKey = new PluginKey4("fileImport");
3544
+ var fileImportPluginKey = new PluginKey3("fileImport");
3713
3545
  function getImportableFiles(files, registry) {
3714
3546
  const list = Array.from(files ?? []);
3715
3547
  if (list.length === 0) return null;
@@ -3749,7 +3581,7 @@ var FileImport = Extension8.create({
3749
3581
  });
3750
3582
  };
3751
3583
  return [
3752
- new Plugin7({
3584
+ new Plugin6({
3753
3585
  key: fileImportPluginKey,
3754
3586
  props: {
3755
3587
  handleDrop(view, event, _slice, moved) {
@@ -3776,8 +3608,8 @@ var FileImport = Extension8.create({
3776
3608
 
3777
3609
  // src/extensions/rich-clipboard.ts
3778
3610
  import { Extension as Extension9 } from "@tiptap/core";
3779
- import { Plugin as Plugin8, PluginKey as PluginKey5 } from "@tiptap/pm/state";
3780
- var richClipboardPluginKey = new PluginKey5("richClipboard");
3611
+ import { Plugin as Plugin7, PluginKey as PluginKey4 } from "@tiptap/pm/state";
3612
+ var richClipboardPluginKey = new PluginKey4("richClipboard");
3781
3613
  function writeRichClipboard(view, event, options = {}) {
3782
3614
  const { state } = view;
3783
3615
  if (state.selection.empty) return false;
@@ -3810,7 +3642,7 @@ var RichClipboard = Extension9.create({
3810
3642
  const mimeType = this.options.mimeType ?? PIXERATE_DOCUMENT_MIME;
3811
3643
  const storage = this.storage;
3812
3644
  return [
3813
- new Plugin8({
3645
+ new Plugin7({
3814
3646
  key: richClipboardPluginKey,
3815
3647
  props: {
3816
3648
  handleDOMEvents: {
@@ -3837,7 +3669,7 @@ var RichClipboard = Extension9.create({
3837
3669
  // src/extensions/autocorrect.ts
3838
3670
  import { Extension as Extension10 } from "@tiptap/core";
3839
3671
  import { closeHistory } from "@tiptap/pm/history";
3840
- import { Plugin as Plugin9, PluginKey as PluginKey6 } from "@tiptap/pm/state";
3672
+ import { Plugin as Plugin8, PluginKey as PluginKey5 } from "@tiptap/pm/state";
3841
3673
  var quoteOpener = /[\s ([{<—–‘“-]/;
3842
3674
  var smartQuoteRules = [
3843
3675
  {
@@ -3945,7 +3777,7 @@ var DEFAULT_AUTOCORRECT_EXCEPTIONS = [
3945
3777
  "MHz",
3946
3778
  "KHz"
3947
3779
  ];
3948
- var autocorrectPluginKey = new PluginKey6("autocorrect");
3780
+ var autocorrectPluginKey = new PluginKey5("autocorrect");
3949
3781
  var WHOLE_WORD_DELIMITER = /[\s.,;:!?]/;
3950
3782
  function findAutocorrection(textBefore, rules, context) {
3951
3783
  const ctx = { ...context, textBefore };
@@ -4122,7 +3954,7 @@ var Autocorrect = Extension10.create({
4122
3954
  return true;
4123
3955
  };
4124
3956
  return [
4125
- new Plugin9({
3957
+ new Plugin8({
4126
3958
  key: autocorrectPluginKey,
4127
3959
  state: {
4128
3960
  init: () => ({ last: null, closePending: false }),
@@ -4144,12 +3976,12 @@ var Autocorrect = Extension10.create({
4144
3976
  // src/extensions/document-structure/outline.ts
4145
3977
  import { Extension as Extension11 } from "@tiptap/core";
4146
3978
  import {
4147
- Plugin as Plugin10,
4148
- PluginKey as PluginKey7,
4149
- TextSelection as TextSelection2
3979
+ Plugin as Plugin9,
3980
+ PluginKey as PluginKey6,
3981
+ TextSelection
4150
3982
  } from "@tiptap/pm/state";
4151
- var outlinePluginKey = new PluginKey7("outline");
4152
- var outlineIdPluginKey = new PluginKey7("outlineIds");
3983
+ var outlinePluginKey = new PluginKey6("outline");
3984
+ var outlineIdPluginKey = new PluginKey6("outlineIds");
4153
3985
  var sameHeading = (a, b) => a.id === b.id && a.level === b.level && a.text === b.text && a.pos === b.pos && a.depth === b.depth;
4154
3986
  function computeOutline(doc, types = ["heading"]) {
4155
3987
  const headings = [];
@@ -4267,7 +4099,7 @@ function navigateToHeading(editor, heading, options = {}) {
4267
4099
  if (!current) return false;
4268
4100
  const { focus = true, behavior = "smooth" } = options;
4269
4101
  if (focus) {
4270
- const tr = editor.state.tr.setSelection(TextSelection2.create(editor.state.doc, current.pos + 1)).scrollIntoView();
4102
+ const tr = editor.state.tr.setSelection(TextSelection.create(editor.state.doc, current.pos + 1)).scrollIntoView();
4271
4103
  editor.view.dispatch(tr);
4272
4104
  editor.view.focus();
4273
4105
  }
@@ -4329,7 +4161,7 @@ var Outline = Extension11.create({
4329
4161
  if (!heading) return false;
4330
4162
  if (dispatch) {
4331
4163
  if (options.focus !== false) {
4332
- tr.setSelection(TextSelection2.create(tr.doc, heading.pos + 1));
4164
+ tr.setSelection(TextSelection.create(tr.doc, heading.pos + 1));
4333
4165
  tr.scrollIntoView();
4334
4166
  view?.focus?.();
4335
4167
  }
@@ -4350,7 +4182,7 @@ var Outline = Extension11.create({
4350
4182
  const storage = this.storage;
4351
4183
  const onUpdate = () => this.options.onUpdate;
4352
4184
  return [
4353
- new Plugin10({
4185
+ new Plugin9({
4354
4186
  key: outlinePluginKey,
4355
4187
  state: {
4356
4188
  init: (_config, state) => {
@@ -4368,7 +4200,7 @@ var Outline = Extension11.create({
4368
4200
  }
4369
4201
  }
4370
4202
  }),
4371
- new Plugin10({
4203
+ new Plugin9({
4372
4204
  key: outlineIdPluginKey,
4373
4205
  appendTransaction: (transactions, _oldState, newState) => {
4374
4206
  if (!transactions.some((tr) => tr.docChanged)) return null;
@@ -4386,9 +4218,9 @@ var Outline = Extension11.create({
4386
4218
  // src/extensions/document-structure/table-of-contents.ts
4387
4219
  import { Node as Node3 } from "@tiptap/core";
4388
4220
  import {
4389
- Plugin as Plugin11,
4390
- PluginKey as PluginKey8,
4391
- TextSelection as TextSelection3
4221
+ Plugin as Plugin10,
4222
+ PluginKey as PluginKey7,
4223
+ TextSelection as TextSelection2
4392
4224
  } from "@tiptap/pm/state";
4393
4225
 
4394
4226
  // src/extensions/document-structure/markdown-it.ts
@@ -4519,7 +4351,7 @@ function mergeFootnoteSections(element) {
4519
4351
  }
4520
4352
 
4521
4353
  // src/extensions/document-structure/table-of-contents.ts
4522
- var tableOfContentsPluginKey = new PluginKey8("tableOfContents");
4354
+ var tableOfContentsPluginKey = new PluginKey7("tableOfContents");
4523
4355
  var sameEntry = (a, b) => a.id === b.id && a.level === b.level && a.text === b.text && a.depth === b.depth;
4524
4356
  function getTableOfContentsEntries(headings, minLevel = 1, maxLevel = 6) {
4525
4357
  const entries = [];
@@ -4670,7 +4502,7 @@ var TableOfContents = Node3.create({
4670
4502
  const { headingTypes } = this.options;
4671
4503
  const editor = this.editor;
4672
4504
  return [
4673
- new Plugin11({
4505
+ new Plugin10({
4674
4506
  key: tableOfContentsPluginKey,
4675
4507
  state: presenceStateSpec([this.name]),
4676
4508
  appendTransaction: (transactions, _oldState, newState) => {
@@ -4692,7 +4524,7 @@ var TableOfContents = Node3.create({
4692
4524
  if (!heading) return true;
4693
4525
  if (editor.isEditable) {
4694
4526
  view.dispatch(
4695
- view.state.tr.setSelection(TextSelection3.create(view.state.doc, heading.pos + 1)).scrollIntoView()
4527
+ view.state.tr.setSelection(TextSelection2.create(view.state.doc, heading.pos + 1)).scrollIntoView()
4696
4528
  );
4697
4529
  view.focus();
4698
4530
  }
@@ -4714,11 +4546,11 @@ var TableOfContents = Node3.create({
4714
4546
  import { Node as Node4 } from "@tiptap/core";
4715
4547
  import {
4716
4548
  NodeSelection,
4717
- Plugin as Plugin12,
4718
- PluginKey as PluginKey9,
4719
- TextSelection as TextSelection4
4549
+ Plugin as Plugin11,
4550
+ PluginKey as PluginKey8,
4551
+ TextSelection as TextSelection3
4720
4552
  } from "@tiptap/pm/state";
4721
- var footnotesPluginKey = new PluginKey9("footnotes");
4553
+ var footnotesPluginKey = new PluginKey8("footnotes");
4722
4554
  var REFERENCE = "footnoteReference";
4723
4555
  var LIST = "footnotes";
4724
4556
  var ITEM = "footnote";
@@ -4929,7 +4761,7 @@ var FootnoteReference = Node4.create({
4929
4761
  if (focusContent) {
4930
4762
  const footnote = findFootnote(tr.doc, id);
4931
4763
  if (footnote) {
4932
- tr.setSelection(TextSelection4.create(tr.doc, footnote.pos + 2));
4764
+ tr.setSelection(TextSelection3.create(tr.doc, footnote.pos + 2));
4933
4765
  }
4934
4766
  }
4935
4767
  tr.scrollIntoView();
@@ -4964,7 +4796,7 @@ var FootnoteReference = Node4.create({
4964
4796
  if (!footnote) return false;
4965
4797
  if (dispatch) {
4966
4798
  tr.setSelection(
4967
- TextSelection4.create(tr.doc, footnote.pos + footnote.node.nodeSize - 2)
4799
+ TextSelection3.create(tr.doc, footnote.pos + footnote.node.nodeSize - 2)
4968
4800
  );
4969
4801
  tr.scrollIntoView();
4970
4802
  scrollDomAtPos(view, footnote.pos);
@@ -4987,7 +4819,7 @@ var FootnoteReference = Node4.create({
4987
4819
  const generateId = this.options.generateId;
4988
4820
  const editor = this.editor;
4989
4821
  return [
4990
- new Plugin12({
4822
+ new Plugin11({
4991
4823
  key: footnotesPluginKey,
4992
4824
  state: presenceStateSpec([REFERENCE, LIST]),
4993
4825
  appendTransaction: (transactions, _oldState, newState) => {
@@ -5104,8 +4936,8 @@ var Footnote = Node4.create({
5104
4936
  });
5105
4937
 
5106
4938
  // src/extensions/document-structure/bookmarks.ts
5107
- import { Mark as Mark4 } from "@tiptap/core";
5108
- import { TextSelection as TextSelection5 } from "@tiptap/pm/state";
4939
+ import { Mark as Mark3 } from "@tiptap/core";
4940
+ import { TextSelection as TextSelection4 } from "@tiptap/pm/state";
5109
4941
  var BOOKMARK = "bookmark";
5110
4942
  function getBookmarks(doc) {
5111
4943
  const byId = /* @__PURE__ */ new Map();
@@ -5142,7 +4974,7 @@ function forEachBookmarkRange(doc, id, fn) {
5142
4974
  return false;
5143
4975
  });
5144
4976
  }
5145
- var Bookmark = Mark4.create({
4977
+ var Bookmark = Mark3.create({
5146
4978
  name: BOOKMARK,
5147
4979
  inclusive: false,
5148
4980
  excludes: "",
@@ -5232,7 +5064,7 @@ var Bookmark = Mark4.create({
5232
5064
  const bookmark = getBookmarks(state.doc).find((b) => b.id === id);
5233
5065
  if (!bookmark) return false;
5234
5066
  if (dispatch) {
5235
- tr.setSelection(TextSelection5.create(tr.doc, bookmark.from, bookmark.to));
5067
+ tr.setSelection(TextSelection4.create(tr.doc, bookmark.from, bookmark.to));
5236
5068
  tr.scrollIntoView();
5237
5069
  const domPos = state.doc.resolve(bookmark.from);
5238
5070
  scrollDomAtPos(view, domPos.before(domPos.depth));
@@ -5246,11 +5078,11 @@ var Bookmark = Mark4.create({
5246
5078
  // src/extensions/document-structure/cross-reference.ts
5247
5079
  import { Node as Node5 } from "@tiptap/core";
5248
5080
  import {
5249
- Plugin as Plugin13,
5250
- PluginKey as PluginKey10,
5251
- TextSelection as TextSelection6
5081
+ Plugin as Plugin12,
5082
+ PluginKey as PluginKey9,
5083
+ TextSelection as TextSelection5
5252
5084
  } from "@tiptap/pm/state";
5253
- var crossReferencePluginKey = new PluginKey10("crossReference");
5085
+ var crossReferencePluginKey = new PluginKey9("crossReference");
5254
5086
  var NAME = "crossReference";
5255
5087
  function getCrossReferenceTargets(doc, headingTypes = ["heading"]) {
5256
5088
  const headings = computeOutline(doc, headingTypes).filter((h) => !h.id.startsWith("outline-")).map((h) => ({ type: "heading", id: h.id, text: h.text, name: h.text, level: h.level }));
@@ -5400,7 +5232,7 @@ var CrossReference = Node5.create({
5400
5232
  }
5401
5233
  if (!range) return false;
5402
5234
  if (dispatch) {
5403
- tr.setSelection(TextSelection6.create(tr.doc, range.from, range.to));
5235
+ tr.setSelection(TextSelection5.create(tr.doc, range.from, range.to));
5404
5236
  tr.scrollIntoView();
5405
5237
  scrollDomAtPos(view, range.blockPos);
5406
5238
  }
@@ -5412,7 +5244,7 @@ var CrossReference = Node5.create({
5412
5244
  const { headingTypes } = this.options;
5413
5245
  const editor = this.editor;
5414
5246
  return [
5415
- new Plugin13({
5247
+ new Plugin12({
5416
5248
  key: crossReferencePluginKey,
5417
5249
  state: presenceStateSpec([NAME]),
5418
5250
  appendTransaction: (transactions, _oldState, newState) => {
@@ -5491,8 +5323,8 @@ function getDocumentStructureCommandItems(editor, query = "") {
5491
5323
 
5492
5324
  // src/extensions/find-replace/extension.ts
5493
5325
  import { Extension as Extension12 } from "@tiptap/core";
5494
- import { Plugin as Plugin14, PluginKey as PluginKey11, TextSelection as TextSelection7 } from "@tiptap/pm/state";
5495
- import { Decoration as Decoration4, DecorationSet as DecorationSet4 } from "@tiptap/pm/view";
5326
+ import { Plugin as Plugin13, PluginKey as PluginKey10, TextSelection as TextSelection6 } from "@tiptap/pm/state";
5327
+ import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@tiptap/pm/view";
5496
5328
  import { closeHistory as closeHistory2 } from "@tiptap/pm/history";
5497
5329
  var EMPTY_OPTIONS = Object.freeze({});
5498
5330
  var EMPTY_FIND_REPLACE_SNAPSHOT = Object.freeze({
@@ -5532,7 +5364,7 @@ var FindReplaceStore = class {
5532
5364
  });
5533
5365
  }
5534
5366
  };
5535
- var findReplacePluginKey = new PluginKey11("findReplace");
5367
+ var findReplacePluginKey = new PluginKey10("findReplace");
5536
5368
  function getFindReplaceState(source) {
5537
5369
  const state = source?.state ?? source;
5538
5370
  if (!state || typeof state.plugins === "undefined") return null;
@@ -5614,7 +5446,7 @@ var FindReplace = Extension12.create({
5614
5446
  const current = (state) => findReplacePluginKey.getState(state);
5615
5447
  const maxPrefill = () => this.options.maxPrefillLength;
5616
5448
  const select = (tr, match) => {
5617
- tr.setSelection(TextSelection7.create(tr.doc, match.from, match.to)).scrollIntoView();
5449
+ tr.setSelection(TextSelection6.create(tr.doc, match.from, match.to)).scrollIntoView();
5618
5450
  };
5619
5451
  return {
5620
5452
  setSearch: (params) => ({ tr, state, dispatch }) => {
@@ -5689,7 +5521,7 @@ var FindReplace = Extension12.create({
5689
5521
  if (dispatch) {
5690
5522
  closeHistory2(tr);
5691
5523
  const [end] = applyReplacements(tr, [s.matches[s.currentIndex]]);
5692
- tr.setSelection(TextSelection7.create(tr.doc, end)).scrollIntoView();
5524
+ tr.setSelection(TextSelection6.create(tr.doc, end)).scrollIntoView();
5693
5525
  meta(tr, { type: "replaced", anchor: end, count: 1 });
5694
5526
  }
5695
5527
  return true;
@@ -5746,16 +5578,16 @@ var FindReplace = Extension12.create({
5746
5578
  };
5747
5579
  };
5748
5580
  const decorate = (s, doc) => {
5749
- if (!s.active || !s.matches.length) return { ...s, decorations: DecorationSet4.empty };
5581
+ if (!s.active || !s.matches.length) return { ...s, decorations: DecorationSet3.empty };
5750
5582
  const decorations = s.matches.map(
5751
- (m, i) => Decoration4.inline(m.from, m.to, {
5583
+ (m, i) => Decoration3.inline(m.from, m.to, {
5752
5584
  class: i === s.currentIndex ? `${options.matchClass} ${options.currentMatchClass}` : options.matchClass
5753
5585
  })
5754
5586
  );
5755
- return { ...s, decorations: DecorationSet4.create(doc, decorations) };
5587
+ return { ...s, decorations: DecorationSet3.create(doc, decorations) };
5756
5588
  };
5757
5589
  return [
5758
- new Plugin14({
5590
+ new Plugin13({
5759
5591
  key: findReplacePluginKey,
5760
5592
  state: {
5761
5593
  init: () => ({
@@ -5772,7 +5604,7 @@ var FindReplace = Extension12.create({
5772
5604
  truncated: false,
5773
5605
  lastReplaceCount: null,
5774
5606
  focusRequest: 0,
5775
- decorations: DecorationSet4.empty
5607
+ decorations: DecorationSet3.empty
5776
5608
  }),
5777
5609
  apply: (tr, prev, _oldState, newState) => {
5778
5610
  const m = tr.getMeta(findReplacePluginKey);
@@ -5840,7 +5672,7 @@ var FindReplace = Extension12.create({
5840
5672
  }
5841
5673
  },
5842
5674
  props: {
5843
- decorations: (state) => findReplacePluginKey.getState(state)?.decorations ?? DecorationSet4.empty
5675
+ decorations: (state) => findReplacePluginKey.getState(state)?.decorations ?? DecorationSet3.empty
5844
5676
  },
5845
5677
  view: (view) => {
5846
5678
  const sync = () => {
@@ -5863,11 +5695,11 @@ function safeClipboard(get) {
5863
5695
  }
5864
5696
 
5865
5697
  // src/extensions/paragraph-styles/extension.ts
5866
- import { Extension as Extension13, Mark as Mark5 } from "@tiptap/core";
5867
- import { Plugin as Plugin15, PluginKey as PluginKey12 } from "@tiptap/pm/state";
5698
+ import { Extension as Extension13, Mark as Mark4 } from "@tiptap/core";
5699
+ import { Plugin as Plugin14, PluginKey as PluginKey11 } from "@tiptap/pm/state";
5868
5700
  var STYLE_ID_ATTRIBUTE = "styleId";
5869
5701
  var CHARACTER_STYLE_MARK_NAME = "characterStyle";
5870
- var paragraphStylesPluginKey = new PluginKey12("paragraphStyles");
5702
+ var paragraphStylesPluginKey = new PluginKey11("paragraphStyles");
5871
5703
  function getStyleRegistry(editor) {
5872
5704
  return editor?.storage?.paragraphStyles?.registry ?? null;
5873
5705
  }
@@ -6007,7 +5839,7 @@ function nextStyleTransaction(transactions, oldState, newState, registry) {
6007
5839
  if (!applyStyleToBlock(out, $new.before(), next, registry)) return null;
6008
5840
  return out;
6009
5841
  }
6010
- var CharacterStyle = Mark5.create({
5842
+ var CharacterStyle = Mark4.create({
6011
5843
  name: CHARACTER_STYLE_MARK_NAME,
6012
5844
  addAttributes() {
6013
5845
  return {
@@ -6133,7 +5965,7 @@ var ParagraphStyles = Extension13.create({
6133
5965
  addProseMirrorPlugins() {
6134
5966
  const registry = this.storage.registry;
6135
5967
  return [
6136
- new Plugin15({
5968
+ new Plugin14({
6137
5969
  key: paragraphStylesPluginKey,
6138
5970
  appendTransaction: (transactions, oldState, newState) => nextStyleTransaction(transactions, oldState, newState, registry)
6139
5971
  })
@@ -6638,6 +6470,7 @@ export {
6638
6470
  GradientText,
6639
6471
  SlashCommands,
6640
6472
  TemplateSuggestions,
6473
+ loadingSpinnerSpec,
6641
6474
  LoadingNode,
6642
6475
  SMILIE_REPLACEMENTS,
6643
6476
  smilieAutocorrectRules,
@@ -6656,14 +6489,6 @@ export {
6656
6489
  removeImageNode,
6657
6490
  handleImageInsertion,
6658
6491
  Image2 as Image,
6659
- commentsPluginKey,
6660
- COMMENT_MARK_NAME,
6661
- findCommentRanges,
6662
- getCommentAnchors,
6663
- getCommentIdsAt,
6664
- getCommentStore,
6665
- Comments,
6666
- getCommentAuthor,
6667
6492
  compareInEditor,
6668
6493
  applyDocumentComparison,
6669
6494
  DocumentCompare,