@pixerate/editor 0.235.0 → 0.236.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,
@@ -1870,250 +1870,6 @@ var Image2 = BaseImage.extend({
1870
1870
  }
1871
1871
  });
1872
1872
 
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
1873
  // src/extensions/document-compare.ts
2118
1874
  import { Extension as Extension7 } from "@tiptap/core";
2119
1875
  function trackChangesAuthor(state) {
@@ -2164,7 +1920,7 @@ var DocumentCompare = Extension7.create({
2164
1920
 
2165
1921
  // src/extensions/file-import.ts
2166
1922
  import { Extension as Extension8 } from "@tiptap/core";
2167
- import { Plugin as Plugin7, PluginKey as PluginKey4 } from "@tiptap/pm/state";
1923
+ import { Plugin as Plugin6, PluginKey as PluginKey3 } from "@tiptap/pm/state";
2168
1924
 
2169
1925
  // src/import/registry.ts
2170
1926
  var ImportError = class extends Error {
@@ -3709,7 +3465,7 @@ async function importFilesIntoEditor(target, files, options = {}) {
3709
3465
  }
3710
3466
 
3711
3467
  // src/extensions/file-import.ts
3712
- var fileImportPluginKey = new PluginKey4("fileImport");
3468
+ var fileImportPluginKey = new PluginKey3("fileImport");
3713
3469
  function getImportableFiles(files, registry) {
3714
3470
  const list = Array.from(files ?? []);
3715
3471
  if (list.length === 0) return null;
@@ -3749,7 +3505,7 @@ var FileImport = Extension8.create({
3749
3505
  });
3750
3506
  };
3751
3507
  return [
3752
- new Plugin7({
3508
+ new Plugin6({
3753
3509
  key: fileImportPluginKey,
3754
3510
  props: {
3755
3511
  handleDrop(view, event, _slice, moved) {
@@ -3776,8 +3532,8 @@ var FileImport = Extension8.create({
3776
3532
 
3777
3533
  // src/extensions/rich-clipboard.ts
3778
3534
  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");
3535
+ import { Plugin as Plugin7, PluginKey as PluginKey4 } from "@tiptap/pm/state";
3536
+ var richClipboardPluginKey = new PluginKey4("richClipboard");
3781
3537
  function writeRichClipboard(view, event, options = {}) {
3782
3538
  const { state } = view;
3783
3539
  if (state.selection.empty) return false;
@@ -3810,7 +3566,7 @@ var RichClipboard = Extension9.create({
3810
3566
  const mimeType = this.options.mimeType ?? PIXERATE_DOCUMENT_MIME;
3811
3567
  const storage = this.storage;
3812
3568
  return [
3813
- new Plugin8({
3569
+ new Plugin7({
3814
3570
  key: richClipboardPluginKey,
3815
3571
  props: {
3816
3572
  handleDOMEvents: {
@@ -3837,7 +3593,7 @@ var RichClipboard = Extension9.create({
3837
3593
  // src/extensions/autocorrect.ts
3838
3594
  import { Extension as Extension10 } from "@tiptap/core";
3839
3595
  import { closeHistory } from "@tiptap/pm/history";
3840
- import { Plugin as Plugin9, PluginKey as PluginKey6 } from "@tiptap/pm/state";
3596
+ import { Plugin as Plugin8, PluginKey as PluginKey5 } from "@tiptap/pm/state";
3841
3597
  var quoteOpener = /[\s ([{<—–‘“-]/;
3842
3598
  var smartQuoteRules = [
3843
3599
  {
@@ -3945,7 +3701,7 @@ var DEFAULT_AUTOCORRECT_EXCEPTIONS = [
3945
3701
  "MHz",
3946
3702
  "KHz"
3947
3703
  ];
3948
- var autocorrectPluginKey = new PluginKey6("autocorrect");
3704
+ var autocorrectPluginKey = new PluginKey5("autocorrect");
3949
3705
  var WHOLE_WORD_DELIMITER = /[\s.,;:!?]/;
3950
3706
  function findAutocorrection(textBefore, rules, context) {
3951
3707
  const ctx = { ...context, textBefore };
@@ -4122,7 +3878,7 @@ var Autocorrect = Extension10.create({
4122
3878
  return true;
4123
3879
  };
4124
3880
  return [
4125
- new Plugin9({
3881
+ new Plugin8({
4126
3882
  key: autocorrectPluginKey,
4127
3883
  state: {
4128
3884
  init: () => ({ last: null, closePending: false }),
@@ -4144,12 +3900,12 @@ var Autocorrect = Extension10.create({
4144
3900
  // src/extensions/document-structure/outline.ts
4145
3901
  import { Extension as Extension11 } from "@tiptap/core";
4146
3902
  import {
4147
- Plugin as Plugin10,
4148
- PluginKey as PluginKey7,
4149
- TextSelection as TextSelection2
3903
+ Plugin as Plugin9,
3904
+ PluginKey as PluginKey6,
3905
+ TextSelection
4150
3906
  } from "@tiptap/pm/state";
4151
- var outlinePluginKey = new PluginKey7("outline");
4152
- var outlineIdPluginKey = new PluginKey7("outlineIds");
3907
+ var outlinePluginKey = new PluginKey6("outline");
3908
+ var outlineIdPluginKey = new PluginKey6("outlineIds");
4153
3909
  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
3910
  function computeOutline(doc, types = ["heading"]) {
4155
3911
  const headings = [];
@@ -4267,7 +4023,7 @@ function navigateToHeading(editor, heading, options = {}) {
4267
4023
  if (!current) return false;
4268
4024
  const { focus = true, behavior = "smooth" } = options;
4269
4025
  if (focus) {
4270
- const tr = editor.state.tr.setSelection(TextSelection2.create(editor.state.doc, current.pos + 1)).scrollIntoView();
4026
+ const tr = editor.state.tr.setSelection(TextSelection.create(editor.state.doc, current.pos + 1)).scrollIntoView();
4271
4027
  editor.view.dispatch(tr);
4272
4028
  editor.view.focus();
4273
4029
  }
@@ -4329,7 +4085,7 @@ var Outline = Extension11.create({
4329
4085
  if (!heading) return false;
4330
4086
  if (dispatch) {
4331
4087
  if (options.focus !== false) {
4332
- tr.setSelection(TextSelection2.create(tr.doc, heading.pos + 1));
4088
+ tr.setSelection(TextSelection.create(tr.doc, heading.pos + 1));
4333
4089
  tr.scrollIntoView();
4334
4090
  view?.focus?.();
4335
4091
  }
@@ -4350,7 +4106,7 @@ var Outline = Extension11.create({
4350
4106
  const storage = this.storage;
4351
4107
  const onUpdate = () => this.options.onUpdate;
4352
4108
  return [
4353
- new Plugin10({
4109
+ new Plugin9({
4354
4110
  key: outlinePluginKey,
4355
4111
  state: {
4356
4112
  init: (_config, state) => {
@@ -4368,7 +4124,7 @@ var Outline = Extension11.create({
4368
4124
  }
4369
4125
  }
4370
4126
  }),
4371
- new Plugin10({
4127
+ new Plugin9({
4372
4128
  key: outlineIdPluginKey,
4373
4129
  appendTransaction: (transactions, _oldState, newState) => {
4374
4130
  if (!transactions.some((tr) => tr.docChanged)) return null;
@@ -4386,9 +4142,9 @@ var Outline = Extension11.create({
4386
4142
  // src/extensions/document-structure/table-of-contents.ts
4387
4143
  import { Node as Node3 } from "@tiptap/core";
4388
4144
  import {
4389
- Plugin as Plugin11,
4390
- PluginKey as PluginKey8,
4391
- TextSelection as TextSelection3
4145
+ Plugin as Plugin10,
4146
+ PluginKey as PluginKey7,
4147
+ TextSelection as TextSelection2
4392
4148
  } from "@tiptap/pm/state";
4393
4149
 
4394
4150
  // src/extensions/document-structure/markdown-it.ts
@@ -4519,7 +4275,7 @@ function mergeFootnoteSections(element) {
4519
4275
  }
4520
4276
 
4521
4277
  // src/extensions/document-structure/table-of-contents.ts
4522
- var tableOfContentsPluginKey = new PluginKey8("tableOfContents");
4278
+ var tableOfContentsPluginKey = new PluginKey7("tableOfContents");
4523
4279
  var sameEntry = (a, b) => a.id === b.id && a.level === b.level && a.text === b.text && a.depth === b.depth;
4524
4280
  function getTableOfContentsEntries(headings, minLevel = 1, maxLevel = 6) {
4525
4281
  const entries = [];
@@ -4670,7 +4426,7 @@ var TableOfContents = Node3.create({
4670
4426
  const { headingTypes } = this.options;
4671
4427
  const editor = this.editor;
4672
4428
  return [
4673
- new Plugin11({
4429
+ new Plugin10({
4674
4430
  key: tableOfContentsPluginKey,
4675
4431
  state: presenceStateSpec([this.name]),
4676
4432
  appendTransaction: (transactions, _oldState, newState) => {
@@ -4692,7 +4448,7 @@ var TableOfContents = Node3.create({
4692
4448
  if (!heading) return true;
4693
4449
  if (editor.isEditable) {
4694
4450
  view.dispatch(
4695
- view.state.tr.setSelection(TextSelection3.create(view.state.doc, heading.pos + 1)).scrollIntoView()
4451
+ view.state.tr.setSelection(TextSelection2.create(view.state.doc, heading.pos + 1)).scrollIntoView()
4696
4452
  );
4697
4453
  view.focus();
4698
4454
  }
@@ -4714,11 +4470,11 @@ var TableOfContents = Node3.create({
4714
4470
  import { Node as Node4 } from "@tiptap/core";
4715
4471
  import {
4716
4472
  NodeSelection,
4717
- Plugin as Plugin12,
4718
- PluginKey as PluginKey9,
4719
- TextSelection as TextSelection4
4473
+ Plugin as Plugin11,
4474
+ PluginKey as PluginKey8,
4475
+ TextSelection as TextSelection3
4720
4476
  } from "@tiptap/pm/state";
4721
- var footnotesPluginKey = new PluginKey9("footnotes");
4477
+ var footnotesPluginKey = new PluginKey8("footnotes");
4722
4478
  var REFERENCE = "footnoteReference";
4723
4479
  var LIST = "footnotes";
4724
4480
  var ITEM = "footnote";
@@ -4929,7 +4685,7 @@ var FootnoteReference = Node4.create({
4929
4685
  if (focusContent) {
4930
4686
  const footnote = findFootnote(tr.doc, id);
4931
4687
  if (footnote) {
4932
- tr.setSelection(TextSelection4.create(tr.doc, footnote.pos + 2));
4688
+ tr.setSelection(TextSelection3.create(tr.doc, footnote.pos + 2));
4933
4689
  }
4934
4690
  }
4935
4691
  tr.scrollIntoView();
@@ -4964,7 +4720,7 @@ var FootnoteReference = Node4.create({
4964
4720
  if (!footnote) return false;
4965
4721
  if (dispatch) {
4966
4722
  tr.setSelection(
4967
- TextSelection4.create(tr.doc, footnote.pos + footnote.node.nodeSize - 2)
4723
+ TextSelection3.create(tr.doc, footnote.pos + footnote.node.nodeSize - 2)
4968
4724
  );
4969
4725
  tr.scrollIntoView();
4970
4726
  scrollDomAtPos(view, footnote.pos);
@@ -4987,7 +4743,7 @@ var FootnoteReference = Node4.create({
4987
4743
  const generateId = this.options.generateId;
4988
4744
  const editor = this.editor;
4989
4745
  return [
4990
- new Plugin12({
4746
+ new Plugin11({
4991
4747
  key: footnotesPluginKey,
4992
4748
  state: presenceStateSpec([REFERENCE, LIST]),
4993
4749
  appendTransaction: (transactions, _oldState, newState) => {
@@ -5104,8 +4860,8 @@ var Footnote = Node4.create({
5104
4860
  });
5105
4861
 
5106
4862
  // src/extensions/document-structure/bookmarks.ts
5107
- import { Mark as Mark4 } from "@tiptap/core";
5108
- import { TextSelection as TextSelection5 } from "@tiptap/pm/state";
4863
+ import { Mark as Mark3 } from "@tiptap/core";
4864
+ import { TextSelection as TextSelection4 } from "@tiptap/pm/state";
5109
4865
  var BOOKMARK = "bookmark";
5110
4866
  function getBookmarks(doc) {
5111
4867
  const byId = /* @__PURE__ */ new Map();
@@ -5142,7 +4898,7 @@ function forEachBookmarkRange(doc, id, fn) {
5142
4898
  return false;
5143
4899
  });
5144
4900
  }
5145
- var Bookmark = Mark4.create({
4901
+ var Bookmark = Mark3.create({
5146
4902
  name: BOOKMARK,
5147
4903
  inclusive: false,
5148
4904
  excludes: "",
@@ -5232,7 +4988,7 @@ var Bookmark = Mark4.create({
5232
4988
  const bookmark = getBookmarks(state.doc).find((b) => b.id === id);
5233
4989
  if (!bookmark) return false;
5234
4990
  if (dispatch) {
5235
- tr.setSelection(TextSelection5.create(tr.doc, bookmark.from, bookmark.to));
4991
+ tr.setSelection(TextSelection4.create(tr.doc, bookmark.from, bookmark.to));
5236
4992
  tr.scrollIntoView();
5237
4993
  const domPos = state.doc.resolve(bookmark.from);
5238
4994
  scrollDomAtPos(view, domPos.before(domPos.depth));
@@ -5246,11 +5002,11 @@ var Bookmark = Mark4.create({
5246
5002
  // src/extensions/document-structure/cross-reference.ts
5247
5003
  import { Node as Node5 } from "@tiptap/core";
5248
5004
  import {
5249
- Plugin as Plugin13,
5250
- PluginKey as PluginKey10,
5251
- TextSelection as TextSelection6
5005
+ Plugin as Plugin12,
5006
+ PluginKey as PluginKey9,
5007
+ TextSelection as TextSelection5
5252
5008
  } from "@tiptap/pm/state";
5253
- var crossReferencePluginKey = new PluginKey10("crossReference");
5009
+ var crossReferencePluginKey = new PluginKey9("crossReference");
5254
5010
  var NAME = "crossReference";
5255
5011
  function getCrossReferenceTargets(doc, headingTypes = ["heading"]) {
5256
5012
  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 +5156,7 @@ var CrossReference = Node5.create({
5400
5156
  }
5401
5157
  if (!range) return false;
5402
5158
  if (dispatch) {
5403
- tr.setSelection(TextSelection6.create(tr.doc, range.from, range.to));
5159
+ tr.setSelection(TextSelection5.create(tr.doc, range.from, range.to));
5404
5160
  tr.scrollIntoView();
5405
5161
  scrollDomAtPos(view, range.blockPos);
5406
5162
  }
@@ -5412,7 +5168,7 @@ var CrossReference = Node5.create({
5412
5168
  const { headingTypes } = this.options;
5413
5169
  const editor = this.editor;
5414
5170
  return [
5415
- new Plugin13({
5171
+ new Plugin12({
5416
5172
  key: crossReferencePluginKey,
5417
5173
  state: presenceStateSpec([NAME]),
5418
5174
  appendTransaction: (transactions, _oldState, newState) => {
@@ -5491,8 +5247,8 @@ function getDocumentStructureCommandItems(editor, query = "") {
5491
5247
 
5492
5248
  // src/extensions/find-replace/extension.ts
5493
5249
  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";
5250
+ import { Plugin as Plugin13, PluginKey as PluginKey10, TextSelection as TextSelection6 } from "@tiptap/pm/state";
5251
+ import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@tiptap/pm/view";
5496
5252
  import { closeHistory as closeHistory2 } from "@tiptap/pm/history";
5497
5253
  var EMPTY_OPTIONS = Object.freeze({});
5498
5254
  var EMPTY_FIND_REPLACE_SNAPSHOT = Object.freeze({
@@ -5532,7 +5288,7 @@ var FindReplaceStore = class {
5532
5288
  });
5533
5289
  }
5534
5290
  };
5535
- var findReplacePluginKey = new PluginKey11("findReplace");
5291
+ var findReplacePluginKey = new PluginKey10("findReplace");
5536
5292
  function getFindReplaceState(source) {
5537
5293
  const state = source?.state ?? source;
5538
5294
  if (!state || typeof state.plugins === "undefined") return null;
@@ -5614,7 +5370,7 @@ var FindReplace = Extension12.create({
5614
5370
  const current = (state) => findReplacePluginKey.getState(state);
5615
5371
  const maxPrefill = () => this.options.maxPrefillLength;
5616
5372
  const select = (tr, match) => {
5617
- tr.setSelection(TextSelection7.create(tr.doc, match.from, match.to)).scrollIntoView();
5373
+ tr.setSelection(TextSelection6.create(tr.doc, match.from, match.to)).scrollIntoView();
5618
5374
  };
5619
5375
  return {
5620
5376
  setSearch: (params) => ({ tr, state, dispatch }) => {
@@ -5689,7 +5445,7 @@ var FindReplace = Extension12.create({
5689
5445
  if (dispatch) {
5690
5446
  closeHistory2(tr);
5691
5447
  const [end] = applyReplacements(tr, [s.matches[s.currentIndex]]);
5692
- tr.setSelection(TextSelection7.create(tr.doc, end)).scrollIntoView();
5448
+ tr.setSelection(TextSelection6.create(tr.doc, end)).scrollIntoView();
5693
5449
  meta(tr, { type: "replaced", anchor: end, count: 1 });
5694
5450
  }
5695
5451
  return true;
@@ -5746,16 +5502,16 @@ var FindReplace = Extension12.create({
5746
5502
  };
5747
5503
  };
5748
5504
  const decorate = (s, doc) => {
5749
- if (!s.active || !s.matches.length) return { ...s, decorations: DecorationSet4.empty };
5505
+ if (!s.active || !s.matches.length) return { ...s, decorations: DecorationSet3.empty };
5750
5506
  const decorations = s.matches.map(
5751
- (m, i) => Decoration4.inline(m.from, m.to, {
5507
+ (m, i) => Decoration3.inline(m.from, m.to, {
5752
5508
  class: i === s.currentIndex ? `${options.matchClass} ${options.currentMatchClass}` : options.matchClass
5753
5509
  })
5754
5510
  );
5755
- return { ...s, decorations: DecorationSet4.create(doc, decorations) };
5511
+ return { ...s, decorations: DecorationSet3.create(doc, decorations) };
5756
5512
  };
5757
5513
  return [
5758
- new Plugin14({
5514
+ new Plugin13({
5759
5515
  key: findReplacePluginKey,
5760
5516
  state: {
5761
5517
  init: () => ({
@@ -5772,7 +5528,7 @@ var FindReplace = Extension12.create({
5772
5528
  truncated: false,
5773
5529
  lastReplaceCount: null,
5774
5530
  focusRequest: 0,
5775
- decorations: DecorationSet4.empty
5531
+ decorations: DecorationSet3.empty
5776
5532
  }),
5777
5533
  apply: (tr, prev, _oldState, newState) => {
5778
5534
  const m = tr.getMeta(findReplacePluginKey);
@@ -5840,7 +5596,7 @@ var FindReplace = Extension12.create({
5840
5596
  }
5841
5597
  },
5842
5598
  props: {
5843
- decorations: (state) => findReplacePluginKey.getState(state)?.decorations ?? DecorationSet4.empty
5599
+ decorations: (state) => findReplacePluginKey.getState(state)?.decorations ?? DecorationSet3.empty
5844
5600
  },
5845
5601
  view: (view) => {
5846
5602
  const sync = () => {
@@ -5863,11 +5619,11 @@ function safeClipboard(get) {
5863
5619
  }
5864
5620
 
5865
5621
  // 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";
5622
+ import { Extension as Extension13, Mark as Mark4 } from "@tiptap/core";
5623
+ import { Plugin as Plugin14, PluginKey as PluginKey11 } from "@tiptap/pm/state";
5868
5624
  var STYLE_ID_ATTRIBUTE = "styleId";
5869
5625
  var CHARACTER_STYLE_MARK_NAME = "characterStyle";
5870
- var paragraphStylesPluginKey = new PluginKey12("paragraphStyles");
5626
+ var paragraphStylesPluginKey = new PluginKey11("paragraphStyles");
5871
5627
  function getStyleRegistry(editor) {
5872
5628
  return editor?.storage?.paragraphStyles?.registry ?? null;
5873
5629
  }
@@ -6007,7 +5763,7 @@ function nextStyleTransaction(transactions, oldState, newState, registry) {
6007
5763
  if (!applyStyleToBlock(out, $new.before(), next, registry)) return null;
6008
5764
  return out;
6009
5765
  }
6010
- var CharacterStyle = Mark5.create({
5766
+ var CharacterStyle = Mark4.create({
6011
5767
  name: CHARACTER_STYLE_MARK_NAME,
6012
5768
  addAttributes() {
6013
5769
  return {
@@ -6133,7 +5889,7 @@ var ParagraphStyles = Extension13.create({
6133
5889
  addProseMirrorPlugins() {
6134
5890
  const registry = this.storage.registry;
6135
5891
  return [
6136
- new Plugin15({
5892
+ new Plugin14({
6137
5893
  key: paragraphStylesPluginKey,
6138
5894
  appendTransaction: (transactions, oldState, newState) => nextStyleTransaction(transactions, oldState, newState, registry)
6139
5895
  })
@@ -6656,14 +6412,6 @@ export {
6656
6412
  removeImageNode,
6657
6413
  handleImageInsertion,
6658
6414
  Image2 as Image,
6659
- commentsPluginKey,
6660
- COMMENT_MARK_NAME,
6661
- findCommentRanges,
6662
- getCommentAnchors,
6663
- getCommentIdsAt,
6664
- getCommentStore,
6665
- Comments,
6666
- getCommentAuthor,
6667
6415
  compareInEditor,
6668
6416
  applyDocumentComparison,
6669
6417
  DocumentCompare,