alinea 2.0.0-preview.0 → 2.0.0-preview.2

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.
Files changed (237) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/LICENSES.md +134 -80
  3. package/dist/adapter/next/DevRemote.d.ts +3 -0
  4. package/dist/adapter/next/DevRemote.js +37 -0
  5. package/dist/adapter/next/ForwardCredentials.d.ts +1 -0
  6. package/dist/adapter/next/ForwardCredentials.js +17 -0
  7. package/dist/adapter/next/cms.js +86 -38
  8. package/dist/adapter/next/context.d.ts +1 -1
  9. package/dist/adapter/next/context.js +11 -3
  10. package/dist/adapter/next/handler.d.ts +2 -0
  11. package/dist/adapter/next/handler.js +23 -16
  12. package/dist/adapter/next/with-alinea.js +18 -16
  13. package/dist/backend/Handler.d.ts +14 -13
  14. package/dist/backend/Handler.js +70 -36
  15. package/dist/backend/resolver/ParsePreview.d.ts +8 -4
  16. package/dist/backend/resolver/ParsePreview.js +40 -43
  17. package/dist/backend/router/Router.d.ts +1 -0
  18. package/dist/backend/router/Router.js +21 -15
  19. package/dist/bundled.d.ts +369 -99
  20. package/dist/chunks/chunk-6UT4N4CO.js +919 -0
  21. package/dist/chunks/{chunk-LUBOGJCG.js → chunk-6V4TAD2N.js} +1 -1
  22. package/dist/chunks/{chunk-TL7ZW6BX.js → chunk-A3XXZBOQ.js} +2535 -2999
  23. package/dist/chunks/chunk-AC5ATYI3.js +1434 -0
  24. package/dist/chunks/{chunk-7ORQ7BYK.js → chunk-KMLLLZ6X.js} +202 -269
  25. package/dist/chunks/{chunk-IWN3T3FL.js → chunk-O7XWTMCB.js} +1 -1
  26. package/dist/chunks/{chunk-53DZYORR.js → chunk-PAYSVIYI.js} +76 -176
  27. package/dist/chunks/{chunk-YK3OSMDM.js → chunk-S4AU6SRS.js} +188 -158
  28. package/dist/chunks/{chunk-EQ3TDHYD.js → chunk-UVOEM4AH.js} +6 -3
  29. package/dist/chunks/{chunk-I7X64JTZ.js → chunk-VXZM6V4P.js} +4 -4
  30. package/dist/cli/Generate.js +3 -13
  31. package/dist/cli/Serve.js +7 -3
  32. package/dist/cli/bin.js +8 -5
  33. package/dist/cli/generate/CompileConfig.js +3 -2
  34. package/dist/cli/generate/CopyStaticFiles.js +2 -3
  35. package/dist/cli/generate/DevDB.d.ts +1 -1
  36. package/dist/cli/generate/DevDB.js +3 -5
  37. package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
  38. package/dist/cli/serve/CreateLocalServer.js +3 -2
  39. package/dist/cli/serve/DevServer.d.ts +3 -2
  40. package/dist/cli/serve/DevServer.js +60 -3
  41. package/dist/cli/serve/ServeContext.d.ts +1 -0
  42. package/dist/cli/serve/StartServer.d.ts +1 -0
  43. package/dist/cli/serve/StartServer.js +6 -1
  44. package/dist/cli/util/EnsureLibs.js +2 -2
  45. package/dist/cli/util/EnsureNode.js +2 -2
  46. package/dist/cloud/CloudRemote.d.ts +2 -1
  47. package/dist/cloud/CloudRemote.js +3 -2
  48. package/dist/components/Breadcrumbs.js +8 -8
  49. package/dist/components/Button.js +6 -6
  50. package/dist/components/Calendar.js +11 -11
  51. package/dist/components/Checkbox.js +7 -7
  52. package/dist/components/CheckboxGroup.js +6 -6
  53. package/dist/components/ColorSwatch.js +6 -6
  54. package/dist/components/ColorSwatchPicker.js +6 -6
  55. package/dist/components/ComboBox.js +17 -17
  56. package/dist/components/DateField.js +9 -9
  57. package/dist/components/DatePicker.js +10 -10
  58. package/dist/components/DateRangePicker.js +14 -14
  59. package/dist/components/Dialog.js +6 -6
  60. package/dist/components/Disclosure.js +13 -13
  61. package/dist/components/DropZone.js +6 -6
  62. package/dist/components/Label.js +16 -16
  63. package/dist/components/Link.js +6 -6
  64. package/dist/components/List.js +34 -34
  65. package/dist/components/Menu.js +10 -10
  66. package/dist/components/Modal.js +8 -8
  67. package/dist/components/MultipleSelect.js +33 -33
  68. package/dist/components/NumberField.d.ts +2 -1
  69. package/dist/components/NumberField.js +21 -11
  70. package/dist/components/Popover.js +6 -6
  71. package/dist/components/ProgressCircle.js +10 -10
  72. package/dist/components/RadioGroup.js +6 -6
  73. package/dist/components/SearchField.js +11 -11
  74. package/dist/components/Select.js +13 -13
  75. package/dist/components/Surface.js +3 -3
  76. package/dist/components/Switch.js +6 -6
  77. package/dist/components/Table.js +13 -13
  78. package/dist/components/Tabs.js +8 -8
  79. package/dist/components/TagGroup.js +7 -7
  80. package/dist/components/TextField.js +10 -10
  81. package/dist/components/TimeField.js +6 -6
  82. package/dist/components/Toggle.js +6 -6
  83. package/dist/components/Toolbar.js +7 -7
  84. package/dist/components/Tooltip.js +10 -10
  85. package/dist/components/Tree.js +9 -9
  86. package/dist/core/BlobTransport.d.ts +5 -0
  87. package/dist/core/BlobTransport.js +79 -0
  88. package/dist/core/Client.d.ts +2 -1
  89. package/dist/core/Client.js +17 -12
  90. package/dist/core/Config.d.ts +4 -0
  91. package/dist/core/Config.js +6 -0
  92. package/dist/core/Connection.d.ts +4 -3
  93. package/dist/core/Connection.js +7 -0
  94. package/dist/core/Graph.d.ts +3 -4
  95. package/dist/core/ListRow.d.ts +2 -0
  96. package/dist/core/OrderBy.d.ts +7 -3
  97. package/dist/core/TextDoc.d.ts +11 -0
  98. package/dist/core/Trace.d.ts +8 -0
  99. package/dist/core/Trace.js +32 -0
  100. package/dist/core/Type.d.ts +7 -1
  101. package/dist/core/db/CommitRequest.d.ts +0 -3
  102. package/dist/core/db/CommitRequest.js +0 -9
  103. package/dist/core/db/EntryDB.js +1 -1
  104. package/dist/core/db/EntryIndex.d.ts +12 -2
  105. package/dist/core/db/EntryIndex.js +131 -22
  106. package/dist/core/db/EntryResolver.js +104 -29
  107. package/dist/core/db/EntryTransaction.d.ts +1 -2
  108. package/dist/core/db/EntryTransaction.js +29 -22
  109. package/dist/core/db/LocalDB.d.ts +5 -5
  110. package/dist/core/db/LocalDB.js +27 -12
  111. package/dist/core/field/RichTextField.d.ts +30 -3
  112. package/dist/core/field/RichTextField.js +124 -56
  113. package/dist/core/media/MediaAltField.d.ts +1 -0
  114. package/dist/core/media/MediaAltField.js +9 -1
  115. package/dist/core/media/MediaLocation.d.ts +5 -2
  116. package/dist/core/media/MediaLocation.js +6 -7
  117. package/dist/core/media/MediaTypes.js +11 -0
  118. package/dist/core/source/CombinedSource.d.ts +2 -2
  119. package/dist/core/source/CombinedSource.js +6 -3
  120. package/dist/core/source/FSSource.d.ts +4 -3
  121. package/dist/core/source/FSSource.js +59 -27
  122. package/dist/core/source/GithubSource.d.ts +2 -2
  123. package/dist/core/source/GithubSource.js +21 -9
  124. package/dist/core/source/IndexedDBSource.d.ts +2 -2
  125. package/dist/core/source/IndexedDBSource.js +3 -1
  126. package/dist/core/source/MemorySource.d.ts +2 -2
  127. package/dist/core/source/MemorySource.js +3 -1
  128. package/dist/core/source/OverlaySource.d.ts +12 -0
  129. package/dist/core/source/OverlaySource.js +50 -0
  130. package/dist/core/source/Source.d.ts +5 -2
  131. package/dist/core/source/Source.js +3 -3
  132. package/dist/core/util/Async.d.ts +8 -2
  133. package/dist/core/util/Async.js +67 -0
  134. package/dist/core/util/EntryFilenames.d.ts +2 -2
  135. package/dist/core/util/EntryFilenames.js +3 -3
  136. package/dist/dashboard/App.css +158 -0
  137. package/dist/dashboard/App.js +2 -2
  138. package/dist/dashboard/app/AccessDenied.js +3 -3
  139. package/dist/dashboard/app/ActivityStatus.js +15 -15
  140. package/dist/dashboard/app/AppShell.js +1 -1
  141. package/dist/dashboard/app/AuthView.js +11 -11
  142. package/dist/dashboard/app/CompactField.js +10 -10
  143. package/dist/dashboard/app/DashboardErrorBoundary.js +5 -5
  144. package/dist/dashboard/app/DashboardLayout.js +22 -19
  145. package/dist/dashboard/app/EntryHeader.js +12 -12
  146. package/dist/dashboard/app/EntryReferences.js +9 -9
  147. package/dist/dashboard/app/EntrySidebar.d.ts +1 -1
  148. package/dist/dashboard/app/EntrySidebar.js +17 -16
  149. package/dist/dashboard/app/EntrySidebarPreview.d.ts +1 -1
  150. package/dist/dashboard/app/EntrySidebarPreview.js +19 -14
  151. package/dist/dashboard/app/EntryTranslationBanner.js +7 -7
  152. package/dist/dashboard/app/Explorer.js +51 -43
  153. package/dist/dashboard/app/ExplorerCards.js +34 -34
  154. package/dist/dashboard/app/ExplorerFileCard.js +18 -18
  155. package/dist/dashboard/app/ExplorerList.js +13 -13
  156. package/dist/dashboard/app/ExplorerModal.js +3 -3
  157. package/dist/dashboard/app/ExplorerTable.js +76 -61
  158. package/dist/dashboard/app/ExternalLinkPicker.js +15 -4
  159. package/dist/dashboard/app/LinkPicker.js +8 -8
  160. package/dist/dashboard/app/LocaleMenu.js +12 -12
  161. package/dist/dashboard/app/SidebarLayout.d.ts +8 -0
  162. package/dist/dashboard/app/SidebarLayout.js +1169 -0
  163. package/dist/dashboard/app/SidebarTree.js +46 -46
  164. package/dist/dashboard/app/WorkspaceMenu.js +17 -17
  165. package/dist/dashboard/app/WorkspaceRoots.js +23 -23
  166. package/dist/dashboard/app/editor/FileEditor.d.ts +2 -1
  167. package/dist/dashboard/app/editor/FileEditor.js +41 -32
  168. package/dist/dashboard/app/editor/FilePreview.js +4 -4
  169. package/dist/dashboard/app/editor/MediaAltField.view.d.ts +1 -1
  170. package/dist/dashboard/app/editor/MediaAltField.view.js +6 -9
  171. package/dist/dashboard/app/modals/CreateEntry.js +4 -4
  172. package/dist/dashboard/app/pages/EntryPage.js +57 -31
  173. package/dist/dashboard/app/pages/UsersPage.js +33 -33
  174. package/dist/dashboard/app/ui/DashboardModal.js +23 -23
  175. package/dist/dashboard/app/ui/Rail.js +3 -3
  176. package/dist/dashboard/app/ui/Sidebar.js +2 -2
  177. package/dist/dashboard/atoms/auth.js +2 -0
  178. package/dist/dashboard/atoms/dashboard.d.ts +9 -0
  179. package/dist/dashboard/atoms/dashboard.js +17 -0
  180. package/dist/dashboard/atoms/editor.d.ts +7 -1
  181. package/dist/dashboard/atoms/editor.js +4 -1
  182. package/dist/dashboard/atoms/entry.d.ts +48 -2
  183. package/dist/dashboard/atoms/entry.js +222 -17
  184. package/dist/dashboard/atoms/explorer.js +4 -9
  185. package/dist/dashboard/atoms/preview.d.ts +3 -0
  186. package/dist/dashboard/atoms/preview.js +18 -1
  187. package/dist/dashboard/atoms/root.d.ts +4 -1
  188. package/dist/dashboard/atoms/root.js +96 -157
  189. package/dist/dashboard/hooks.d.ts +4 -2
  190. package/dist/dashboard/hooks.js +9 -5
  191. package/dist/dashboard/icons.d.ts +1 -0
  192. package/dist/dashboard/icons.js +10 -0
  193. package/dist/field/check/CheckField.view.js +2 -2
  194. package/dist/field/code/CodeField.view.js +12 -12
  195. package/dist/field/date/DateField.view.js +12 -2
  196. package/dist/field/link/FileLink.d.ts +2 -2
  197. package/dist/field/link/FileLink.js +5 -3
  198. package/dist/field/link/ImageLink.d.ts +1 -1
  199. package/dist/field/link/ImageLink.js +1 -1
  200. package/dist/field/link/Link.js +2 -2
  201. package/dist/field/link/LinkField.view.js +155 -128
  202. package/dist/field/list/ListField.view.js +22 -33
  203. package/dist/field/metadata/MetadataField.view.js +19 -19
  204. package/dist/field/number/NumberField.d.ts +2 -0
  205. package/dist/field/number/NumberField.view.js +4 -2
  206. package/dist/field/richtext/PickTextLink.d.ts +7 -0
  207. package/dist/field/richtext/PickTextLink.js +104 -2
  208. package/dist/field/richtext/ReferenceLink.d.ts +4 -1
  209. package/dist/field/richtext/ReferenceLink.js +18 -4
  210. package/dist/field/richtext/RichTextDocument.d.ts +7 -2
  211. package/dist/field/richtext/RichTextDocument.js +34 -5
  212. package/dist/field/richtext/RichTextExtensions.d.ts +3 -1
  213. package/dist/field/richtext/RichTextExtensions.js +2704 -7467
  214. package/dist/field/richtext/RichTextField.d.ts +4 -0
  215. package/dist/field/richtext/RichTextField.story.d.ts +4 -0
  216. package/dist/field/richtext/RichTextField.view.js +43 -20
  217. package/dist/field/richtext/RichTextInsertMenu.js +281 -495
  218. package/dist/field/richtext/RichTextToolbar.d.ts +5 -2
  219. package/dist/field/richtext/RichTextToolbar.js +38 -3
  220. package/dist/field/richtext/Toolbar.d.ts +19 -1
  221. package/dist/field/richtext/Toolbar.js +18 -13
  222. package/dist/field/richtext/extensions/Anchor.js +1 -1
  223. package/dist/field/richtext/extensions/Link.js +1 -1
  224. package/dist/field/richtext/extensions/Small.js +1 -1
  225. package/dist/field/select/SelectField.view.js +8 -6
  226. package/dist/index.css +227 -16
  227. package/dist/next.cjs +18 -16
  228. package/dist/next.d.ts +2 -1
  229. package/dist/next.edge.d.ts +2 -1
  230. package/dist/picker/entry/EntryPicker.js +9 -35
  231. package/dist/preview/PreviewPayload.js +35 -250
  232. package/dist/ui/RichText.d.ts +1 -0
  233. package/dist/ui/RichText.js +29 -2
  234. package/package.json +6 -3
  235. package/dist/cli/util/ExternalPlugin.d.ts +0 -2
  236. package/dist/cli/util/ExternalPlugin.js +0 -919
  237. package/dist/chunks/{chunk-JFROOUG6.js → chunk-NIVGVRDS.js} +17 -17
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Editor
3
- } from "./chunk-TL7ZW6BX.js";
3
+ } from "./chunk-A3XXZBOQ.js";
4
4
  import {
5
5
  require_shim
6
6
  } from "./chunk-RKDPDEF7.js";
@@ -19,18 +19,18 @@ var require_with_selector_production = __commonJS({
19
19
  return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
20
20
  }
21
21
  var objectIs = "function" === typeof Object.is ? Object.is : is;
22
- var useSyncExternalStore3 = shim.useSyncExternalStore;
22
+ var useSyncExternalStore2 = shim.useSyncExternalStore;
23
23
  var useRef2 = React2.useRef;
24
- var useEffect3 = React2.useEffect;
25
- var useMemo3 = React2.useMemo;
26
- var useDebugValue3 = React2.useDebugValue;
24
+ var useEffect2 = React2.useEffect;
25
+ var useMemo2 = React2.useMemo;
26
+ var useDebugValue2 = React2.useDebugValue;
27
27
  exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
28
28
  var instRef = useRef2(null);
29
29
  if (null === instRef.current) {
30
30
  var inst = { hasValue: false, value: null };
31
31
  instRef.current = inst;
32
32
  } else inst = instRef.current;
33
- instRef = useMemo3(
33
+ instRef = useMemo2(
34
34
  function() {
35
35
  function memoizedSelector(nextSnapshot) {
36
36
  if (!hasMemo) {
@@ -64,15 +64,15 @@ var require_with_selector_production = __commonJS({
64
64
  },
65
65
  [getSnapshot, getServerSnapshot, selector, isEqual]
66
66
  );
67
- var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
68
- useEffect3(
67
+ var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]);
68
+ useEffect2(
69
69
  function() {
70
70
  inst.hasValue = true;
71
71
  inst.value = value;
72
72
  },
73
73
  [value]
74
74
  );
75
- useDebugValue3(value);
75
+ useDebugValue2(value);
76
76
  return value;
77
77
  };
78
78
  }
@@ -87,14 +87,14 @@ var require_with_selector_development = __commonJS({
87
87
  return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
88
88
  }
89
89
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
90
- var React2 = __import_react2, shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef2 = React2.useRef, useEffect3 = React2.useEffect, useMemo3 = React2.useMemo, useDebugValue3 = React2.useDebugValue;
90
+ var React2 = __import_react2, shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef2 = React2.useRef, useEffect2 = React2.useEffect, useMemo2 = React2.useMemo, useDebugValue2 = React2.useDebugValue;
91
91
  exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
92
92
  var instRef = useRef2(null);
93
93
  if (null === instRef.current) {
94
94
  var inst = { hasValue: false, value: null };
95
95
  instRef.current = inst;
96
96
  } else inst = instRef.current;
97
- instRef = useMemo3(
97
+ instRef = useMemo2(
98
98
  function() {
99
99
  function memoizedSelector(nextSnapshot) {
100
100
  if (!hasMemo) {
@@ -129,15 +129,15 @@ var require_with_selector_development = __commonJS({
129
129
  },
130
130
  [getSnapshot, getServerSnapshot, selector, isEqual]
131
131
  );
132
- var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]);
133
- useEffect3(
132
+ var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]);
133
+ useEffect2(
134
134
  function() {
135
135
  inst.hasValue = true;
136
136
  inst.value = value;
137
137
  },
138
138
  [value]
139
139
  );
140
- useDebugValue3(value);
140
+ useDebugValue2(value);
141
141
  return value;
142
142
  };
143
143
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
@@ -159,12 +159,9 @@ var require_with_selector = __commonJS({
159
159
 
160
160
  // node_modules/@tiptap/react/dist/index.js
161
161
  var import_shim = __toESM(require_shim(), 1);
162
- import { createContext, useContext, useMemo } from "react";
163
- import React, { forwardRef } from "react";
164
- import ReactDOM from "react-dom";
162
+ import React, { createContext, createElement, createRef, forwardRef, memo, useContext, useDebugValue, useEffect, useLayoutEffect, useMemo, useRef, useState, version } from "react";
163
+ import ReactDOM, { flushSync } from "react-dom";
165
164
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
166
- var import_shim2 = __toESM(require_shim(), 1);
167
- import { useDebugValue as useDebugValue2, useEffect as useEffect2, useRef, useState as useState2 } from "react";
168
165
 
169
166
  // node_modules/fast-equals/dist/es/index.mjs
170
167
  var { getOwnPropertyNames, getOwnPropertySymbols } = Object;
@@ -606,48 +603,34 @@ function createCustomEqual(options = {}) {
606
603
 
607
604
  // node_modules/@tiptap/react/dist/index.js
608
605
  var import_with_selector = __toESM(require_with_selector(), 1);
609
- import { useDebugValue, useEffect, useLayoutEffect, useState } from "react";
610
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
611
- import { createContext as createContext2, createElement, useContext as useContext2 } from "react";
612
- import { jsx as jsx3 } from "react/jsx-runtime";
613
- import React3 from "react";
614
- import { jsx as jsx4 } from "react/jsx-runtime";
615
- import React4 from "react";
616
- import { version as reactVersion } from "react";
617
- import { flushSync } from "react-dom";
618
- import { jsx as jsx5 } from "react/jsx-runtime";
619
- import { jsx as jsx6 } from "react/jsx-runtime";
620
- import { createElement as createElement2, createRef, memo } from "react";
621
- import { jsx as jsx7 } from "react/jsx-runtime";
622
- import { createContext as createContext3, useContext as useContext3, useMemo as useMemo2 } from "react";
623
- import { jsx as jsx8 } from "react/jsx-runtime";
624
606
  var mergeRefs = (...refs) => {
625
607
  return (node) => {
626
608
  refs.forEach((ref) => {
627
- if (typeof ref === "function") {
628
- ref(node);
629
- } else if (ref) {
630
- ;
631
- ref.current = node;
632
- }
609
+ if (typeof ref === "function") ref(node);
610
+ else if (ref) ref.current = node;
633
611
  });
634
612
  };
635
613
  };
636
614
  var Portals = ({ contentComponent }) => {
637
- const renderers = (0, import_shim.useSyncExternalStore)(
638
- contentComponent.subscribe,
639
- contentComponent.getSnapshot,
640
- contentComponent.getServerSnapshot
641
- );
615
+ const renderers = (0, import_shim.useSyncExternalStore)(contentComponent.subscribe, contentComponent.getSnapshot, contentComponent.getServerSnapshot);
642
616
  return /* @__PURE__ */ jsx(Fragment, { children: Object.values(renderers) });
643
617
  };
644
- function getInstance() {
618
+ function createContentComponent() {
645
619
  const subscribers = /* @__PURE__ */ new Set();
646
620
  let renderers = {};
621
+ let isNotificationQueued = false;
622
+ const notifySubscribers = () => {
623
+ if (isNotificationQueued || !subscribers.size) return;
624
+ isNotificationQueued = true;
625
+ queueMicrotask(() => {
626
+ isNotificationQueued = false;
627
+ subscribers.forEach((subscriber) => subscriber());
628
+ });
629
+ };
647
630
  return {
648
631
  /**
649
- * Subscribe to the editor instance's changes.
650
- */
632
+ * Subscribe to the editor instance's changes.
633
+ */
651
634
  subscribe(callback) {
652
635
  subscribers.add(callback);
653
636
  return () => {
@@ -661,23 +644,23 @@ function getInstance() {
661
644
  return renderers;
662
645
  },
663
646
  /**
664
- * Adds a new NodeView Renderer to the editor.
665
- */
647
+ * Adds a new NodeView Renderer to the editor.
648
+ */
666
649
  setRenderer(id, renderer) {
667
650
  renderers = {
668
651
  ...renderers,
669
652
  [id]: ReactDOM.createPortal(renderer.reactElement, renderer.element, id)
670
653
  };
671
- subscribers.forEach((subscriber) => subscriber());
654
+ notifySubscribers();
672
655
  },
673
656
  /**
674
- * Removes a NodeView Renderer from the editor.
675
- */
657
+ * Removes a NodeView Renderer from the editor.
658
+ */
676
659
  removeRenderer(id) {
677
660
  const nextRenderers = { ...renderers };
678
661
  delete nextRenderers[id];
679
662
  renderers = nextRenderers;
680
- subscribers.forEach((subscriber) => subscriber());
663
+ notifySubscribers();
681
664
  }
682
665
  };
683
666
  }
@@ -693,68 +676,52 @@ var PureEditorContent = class extends React.Component {
693
676
  this.init();
694
677
  }
695
678
  init() {
696
- var _a;
679
+ var _editor$view$dom;
697
680
  const editor = this.props.editor;
698
- if (editor && !editor.isDestroyed && ((_a = editor.view.dom) == null ? void 0 : _a.parentNode)) {
699
- if (editor.contentComponent) {
700
- return;
701
- }
681
+ if (editor && !editor.isDestroyed && ((_editor$view$dom = editor.view.dom) === null || _editor$view$dom === void 0 ? void 0 : _editor$view$dom.parentNode)) {
682
+ if (editor.contentComponent) return;
702
683
  const element = this.editorContentRef.current;
703
684
  element.append(...editor.view.dom.parentNode.childNodes);
704
- editor.setOptions({
705
- element
706
- });
707
- editor.contentComponent = getInstance();
685
+ editor.setOptions({ element });
686
+ editor.contentComponent = createContentComponent();
708
687
  editor.createNodeViews();
709
688
  editor.isEditorContentInitialized = true;
710
689
  this.forceUpdate();
711
690
  }
712
691
  }
713
692
  componentWillUnmount() {
714
- var _a;
715
693
  const editor = this.props.editor;
716
- if (!editor) {
717
- return;
718
- }
694
+ if (!editor) return;
719
695
  editor.isEditorContentInitialized = false;
720
- if (!editor.isDestroyed) {
721
- editor.view.setProps({
722
- nodeViews: {}
723
- });
724
- }
696
+ if (!editor.isDestroyed) editor.view.setProps({ nodeViews: {} });
725
697
  editor.contentComponent = null;
726
698
  try {
727
- if (!((_a = editor.view.dom) == null ? void 0 : _a.parentNode)) {
728
- return;
729
- }
699
+ var _editor$view$dom2;
700
+ if (!((_editor$view$dom2 = editor.view.dom) === null || _editor$view$dom2 === void 0 ? void 0 : _editor$view$dom2.parentNode)) return;
730
701
  const newElement = document.createElement("div");
731
702
  newElement.append(...editor.view.dom.parentNode.childNodes);
732
- editor.setOptions({
733
- element: newElement
734
- });
703
+ editor.setOptions({ element: newElement });
735
704
  } catch {
736
705
  }
737
706
  }
738
707
  render() {
739
708
  const { editor, innerRef, ...rest } = this.props;
740
- return /* @__PURE__ */ jsxs(Fragment, { children: [
741
- /* @__PURE__ */ jsx("div", { ref: mergeRefs(innerRef, this.editorContentRef), ...rest }),
742
- (editor == null ? void 0 : editor.contentComponent) && /* @__PURE__ */ jsx(Portals, { contentComponent: editor.contentComponent })
743
- ] });
709
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
710
+ ref: mergeRefs(innerRef, this.editorContentRef),
711
+ ...rest
712
+ }), (editor === null || editor === void 0 ? void 0 : editor.contentComponent) && /* @__PURE__ */ jsx(Portals, { contentComponent: editor.contentComponent })] });
744
713
  }
745
714
  };
746
- var EditorContentWithKey = forwardRef(
747
- (props, ref) => {
748
- const key = React.useMemo(() => {
749
- return Math.floor(Math.random() * 4294967295).toString();
750
- }, [props.editor]);
751
- return React.createElement(PureEditorContent, {
752
- key,
753
- innerRef: ref,
754
- ...props
755
- });
756
- }
757
- );
715
+ var EditorContentWithKey = forwardRef((props, ref) => {
716
+ const key = React.useMemo(() => {
717
+ return Math.floor(Math.random() * 4294967295).toString();
718
+ }, [props.editor]);
719
+ return React.createElement(PureEditorContent, {
720
+ key,
721
+ innerRef: ref,
722
+ ...props
723
+ });
724
+ });
758
725
  var EditorContent = React.memo(EditorContentWithKey);
759
726
  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
760
727
  var EditorStateManager = class {
@@ -763,32 +730,39 @@ var EditorStateManager = class {
763
730
  this.lastTransactionNumber = 0;
764
731
  this.subscribers = /* @__PURE__ */ new Set();
765
732
  this.editor = initialEditor;
766
- this.lastSnapshot = { editor: initialEditor, transactionNumber: 0 };
733
+ this.lastSnapshot = {
734
+ editor: initialEditor,
735
+ transactionNumber: 0
736
+ };
767
737
  this.getSnapshot = this.getSnapshot.bind(this);
768
738
  this.getServerSnapshot = this.getServerSnapshot.bind(this);
769
739
  this.watch = this.watch.bind(this);
770
740
  this.subscribe = this.subscribe.bind(this);
771
741
  }
772
742
  /**
773
- * Get the current editor instance.
774
- */
743
+ * Get the current editor instance.
744
+ */
775
745
  getSnapshot() {
776
- if (this.transactionNumber === this.lastTransactionNumber) {
777
- return this.lastSnapshot;
778
- }
746
+ if (this.transactionNumber === this.lastTransactionNumber) return this.lastSnapshot;
779
747
  this.lastTransactionNumber = this.transactionNumber;
780
- this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber };
748
+ this.lastSnapshot = {
749
+ editor: this.editor,
750
+ transactionNumber: this.transactionNumber
751
+ };
781
752
  return this.lastSnapshot;
782
753
  }
783
754
  /**
784
- * Always disable the editor on the server-side.
785
- */
755
+ * Always disable the editor on the server-side.
756
+ */
786
757
  getServerSnapshot() {
787
- return { editor: null, transactionNumber: 0 };
758
+ return {
759
+ editor: null,
760
+ transactionNumber: 0
761
+ };
788
762
  }
789
763
  /**
790
- * Subscribe to the editor instance's changes.
791
- */
764
+ * Subscribe to the editor instance's changes.
765
+ */
792
766
  subscribe(callback) {
793
767
  this.subscribers.add(callback);
794
768
  return () => {
@@ -796,34 +770,32 @@ var EditorStateManager = class {
796
770
  };
797
771
  }
798
772
  /**
799
- * Watch the editor instance for changes.
800
- */
773
+ * Watch the editor instance for changes.
774
+ */
801
775
  watch(nextEditor) {
802
776
  this.editor = nextEditor;
803
777
  if (this.editor) {
804
- const fn = () => {
778
+ let lastTransaction;
779
+ const fn = (props) => {
780
+ if ((props === null || props === void 0 ? void 0 : props.transaction) !== void 0 && props.transaction === lastTransaction) return;
781
+ lastTransaction = props === null || props === void 0 ? void 0 : props.transaction;
805
782
  this.transactionNumber += 1;
806
783
  this.subscribers.forEach((callback) => callback());
807
784
  };
808
785
  const currentEditor = this.editor;
809
786
  currentEditor.on("transaction", fn);
787
+ currentEditor.on("update", fn);
810
788
  return () => {
811
789
  currentEditor.off("transaction", fn);
790
+ currentEditor.off("update", fn);
812
791
  };
813
792
  }
814
- return void 0;
815
793
  }
816
794
  };
817
795
  function useEditorState(options) {
818
- var _a;
796
+ var _options$equalityFn;
819
797
  const [editorStateManager] = useState(() => new EditorStateManager(options.editor));
820
- const selectedState = (0, import_with_selector.useSyncExternalStoreWithSelector)(
821
- editorStateManager.subscribe,
822
- editorStateManager.getSnapshot,
823
- editorStateManager.getServerSnapshot,
824
- options.selector,
825
- (_a = options.equalityFn) != null ? _a : deepEqual
826
- );
798
+ const selectedState = (0, import_with_selector.useSyncExternalStoreWithSelector)(editorStateManager.subscribe, editorStateManager.getSnapshot, editorStateManager.getServerSnapshot, options.selector, (_options$equalityFn = options.equalityFn) !== null && _options$equalityFn !== void 0 ? _options$equalityFn : deepEqual);
827
799
  useIsomorphicLayoutEffect(() => {
828
800
  return editorStateManager.watch(options.editor);
829
801
  }, [options.editor, editorStateManager]);
@@ -833,7 +805,7 @@ function useEditorState(options) {
833
805
  var isDev = process.env.NODE_ENV !== "production";
834
806
  var isSSR = typeof window === "undefined";
835
807
  var isNext = isSSR || Boolean(typeof window !== "undefined" && window.next);
836
- var EditorInstanceManager = class _EditorInstanceManager {
808
+ var EditorInstanceManager = class EditorInstanceManager2 {
837
809
  constructor(options) {
838
810
  this.editor = null;
839
811
  this.subscriptions = /* @__PURE__ */ new Set();
@@ -859,98 +831,96 @@ var EditorInstanceManager = class _EditorInstanceManager {
859
831
  }
860
832
  getInitialEditor() {
861
833
  const explicit = this.options.current.immediatelyRender;
862
- let immediatelyRender = explicit != null ? explicit : true;
834
+ let immediatelyRender = explicit !== null && explicit !== void 0 ? explicit : true;
863
835
  if (isSSR) {
864
- if (immediatelyRender && isDev) {
865
- console.warn(
866
- "SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"
867
- );
868
- }
836
+ if (immediatelyRender && isDev) console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches");
869
837
  immediatelyRender = false;
870
838
  } else if (isNext && explicit === void 0) {
871
839
  immediatelyRender = false;
872
- if (isDev) {
873
- console.warn(
874
- "Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client."
875
- );
876
- }
840
+ if (isDev) console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.");
877
841
  }
878
842
  return immediatelyRender ? this.createEditor() : null;
879
843
  }
880
844
  /**
881
- * Create a new editor instance. And attach event listeners.
882
- */
845
+ * Create a new editor instance. And attach event listeners.
846
+ */
883
847
  createEditor() {
884
848
  const optionsToApply = {
885
849
  ...this.options.current,
886
- // Always call the most recent version of the callback function by default
887
850
  onBeforeCreate: (...args) => {
888
- var _a, _b;
889
- return (_b = (_a = this.options.current).onBeforeCreate) == null ? void 0 : _b.call(_a, ...args);
851
+ var _this$options$current, _this$options$current2;
852
+ return (_this$options$current = (_this$options$current2 = this.options.current).onBeforeCreate) === null || _this$options$current === void 0 ? void 0 : _this$options$current.call(_this$options$current2, ...args);
890
853
  },
891
854
  onBlur: (...args) => {
892
- var _a, _b;
893
- return (_b = (_a = this.options.current).onBlur) == null ? void 0 : _b.call(_a, ...args);
855
+ var _this$options$current3, _this$options$current4;
856
+ return (_this$options$current3 = (_this$options$current4 = this.options.current).onBlur) === null || _this$options$current3 === void 0 ? void 0 : _this$options$current3.call(_this$options$current4, ...args);
894
857
  },
895
858
  onCreate: (...args) => {
896
- var _a, _b;
897
- return (_b = (_a = this.options.current).onCreate) == null ? void 0 : _b.call(_a, ...args);
859
+ var _this$options$current5, _this$options$current6;
860
+ return (_this$options$current5 = (_this$options$current6 = this.options.current).onCreate) === null || _this$options$current5 === void 0 ? void 0 : _this$options$current5.call(_this$options$current6, ...args);
898
861
  },
899
862
  onDestroy: (...args) => {
900
- var _a, _b;
901
- return (_b = (_a = this.options.current).onDestroy) == null ? void 0 : _b.call(_a, ...args);
863
+ var _this$options$current7, _this$options$current8;
864
+ return (_this$options$current7 = (_this$options$current8 = this.options.current).onDestroy) === null || _this$options$current7 === void 0 ? void 0 : _this$options$current7.call(_this$options$current8, ...args);
902
865
  },
903
866
  onFocus: (...args) => {
904
- var _a, _b;
905
- return (_b = (_a = this.options.current).onFocus) == null ? void 0 : _b.call(_a, ...args);
867
+ var _this$options$current9, _this$options$current10;
868
+ return (_this$options$current9 = (_this$options$current10 = this.options.current).onFocus) === null || _this$options$current9 === void 0 ? void 0 : _this$options$current9.call(_this$options$current10, ...args);
906
869
  },
907
870
  onSelectionUpdate: (...args) => {
908
- var _a, _b;
909
- return (_b = (_a = this.options.current).onSelectionUpdate) == null ? void 0 : _b.call(_a, ...args);
871
+ var _this$options$current11, _this$options$current12;
872
+ return (_this$options$current11 = (_this$options$current12 = this.options.current).onSelectionUpdate) === null || _this$options$current11 === void 0 ? void 0 : _this$options$current11.call(_this$options$current12, ...args);
910
873
  },
911
874
  onTransaction: (...args) => {
912
- var _a, _b;
913
- return (_b = (_a = this.options.current).onTransaction) == null ? void 0 : _b.call(_a, ...args);
875
+ var _this$options$current13, _this$options$current14;
876
+ return (_this$options$current13 = (_this$options$current14 = this.options.current).onTransaction) === null || _this$options$current13 === void 0 ? void 0 : _this$options$current13.call(_this$options$current14, ...args);
914
877
  },
915
878
  onUpdate: (...args) => {
916
- var _a, _b;
917
- return (_b = (_a = this.options.current).onUpdate) == null ? void 0 : _b.call(_a, ...args);
879
+ var _this$options$current15, _this$options$current16;
880
+ return (_this$options$current15 = (_this$options$current16 = this.options.current).onUpdate) === null || _this$options$current15 === void 0 ? void 0 : _this$options$current15.call(_this$options$current16, ...args);
918
881
  },
919
882
  onContentError: (...args) => {
920
- var _a, _b;
921
- return (_b = (_a = this.options.current).onContentError) == null ? void 0 : _b.call(_a, ...args);
883
+ var _this$options$current17, _this$options$current18;
884
+ return (_this$options$current17 = (_this$options$current18 = this.options.current).onContentError) === null || _this$options$current17 === void 0 ? void 0 : _this$options$current17.call(_this$options$current18, ...args);
922
885
  },
923
886
  onDrop: (...args) => {
924
- var _a, _b;
925
- return (_b = (_a = this.options.current).onDrop) == null ? void 0 : _b.call(_a, ...args);
887
+ var _this$options$current19, _this$options$current20;
888
+ return (_this$options$current19 = (_this$options$current20 = this.options.current).onDrop) === null || _this$options$current19 === void 0 ? void 0 : _this$options$current19.call(_this$options$current20, ...args);
926
889
  },
927
890
  onPaste: (...args) => {
928
- var _a, _b;
929
- return (_b = (_a = this.options.current).onPaste) == null ? void 0 : _b.call(_a, ...args);
891
+ var _this$options$current21, _this$options$current22;
892
+ return (_this$options$current21 = (_this$options$current22 = this.options.current).onPaste) === null || _this$options$current21 === void 0 ? void 0 : _this$options$current21.call(_this$options$current22, ...args);
930
893
  },
931
894
  onDelete: (...args) => {
932
- var _a, _b;
933
- return (_b = (_a = this.options.current).onDelete) == null ? void 0 : _b.call(_a, ...args);
895
+ var _this$options$current23, _this$options$current24;
896
+ return (_this$options$current23 = (_this$options$current24 = this.options.current).onDelete) === null || _this$options$current23 === void 0 ? void 0 : _this$options$current23.call(_this$options$current24, ...args);
897
+ },
898
+ onMount: (...args) => {
899
+ var _this$options$current25, _this$options$current26;
900
+ return (_this$options$current25 = (_this$options$current26 = this.options.current).onMount) === null || _this$options$current25 === void 0 ? void 0 : _this$options$current25.call(_this$options$current26, ...args);
901
+ },
902
+ onUnmount: (...args) => {
903
+ var _this$options$current27, _this$options$current28;
904
+ return (_this$options$current27 = (_this$options$current28 = this.options.current).onUnmount) === null || _this$options$current27 === void 0 ? void 0 : _this$options$current27.call(_this$options$current28, ...args);
934
905
  }
935
906
  };
936
- const editor = new Editor(optionsToApply);
937
- return editor;
907
+ return new Editor(optionsToApply);
938
908
  }
939
909
  /**
940
- * Get the current editor instance.
941
- */
910
+ * Get the current editor instance.
911
+ */
942
912
  getEditor() {
943
913
  return this.editor;
944
914
  }
945
915
  /**
946
- * Always disable the editor on the server-side.
947
- */
916
+ * Always disable the editor on the server-side.
917
+ */
948
918
  getServerSnapshot() {
949
919
  return null;
950
920
  }
951
921
  /**
952
- * Subscribe to the editor instance's changes.
953
- */
922
+ * Subscribe to the editor instance's changes.
923
+ */
954
924
  subscribe(onStoreChange) {
955
925
  this.subscriptions.add(onStoreChange);
956
926
  return () => {
@@ -971,46 +941,34 @@ var EditorInstanceManager = class _EditorInstanceManager {
971
941
  "onContentError",
972
942
  "onDrop",
973
943
  "onPaste"
974
- ].includes(key)) {
975
- return true;
976
- }
944
+ ].includes(key)) return true;
977
945
  if (key === "extensions" && a.extensions && b.extensions) {
978
- if (a.extensions.length !== b.extensions.length) {
979
- return false;
980
- }
946
+ if (a.extensions.length !== b.extensions.length) return false;
981
947
  return a.extensions.every((extension, index) => {
982
- var _a;
983
- if (extension !== ((_a = b.extensions) == null ? void 0 : _a[index])) {
984
- return false;
985
- }
948
+ var _b$extensions;
949
+ if (extension !== ((_b$extensions = b.extensions) === null || _b$extensions === void 0 ? void 0 : _b$extensions[index])) return false;
986
950
  return true;
987
951
  });
988
952
  }
989
- if (a[key] !== b[key]) {
990
- return false;
991
- }
953
+ if (a[key] !== b[key]) return false;
992
954
  return true;
993
955
  });
994
956
  }
995
957
  /**
996
- * On each render, we will create, update, or destroy the editor instance.
997
- * @param deps The dependencies to watch for changes
998
- * @returns A cleanup function
999
- */
958
+ * On each render, we will create, update, or destroy the editor instance.
959
+ * @param deps The dependencies to watch for changes
960
+ * @returns A cleanup function
961
+ */
1000
962
  onRender(deps) {
1001
963
  return () => {
1002
964
  this.isComponentMounted = true;
1003
965
  clearTimeout(this.scheduledDestructionTimeout);
1004
966
  if (this.editor && !this.editor.isDestroyed && deps.length === 0) {
1005
- if (!_EditorInstanceManager.compareOptions(this.options.current, this.editor.options)) {
1006
- this.editor.setOptions({
1007
- ...this.options.current,
1008
- editable: this.editor.isEditable
1009
- });
1010
- }
1011
- } else {
1012
- this.refreshEditorInstance(deps);
1013
- }
967
+ if (!EditorInstanceManager2.compareOptions(this.options.current, this.editor.options)) this.editor.setOptions({
968
+ ...this.options.current,
969
+ editable: this.editor.isEditable
970
+ });
971
+ } else this.refreshEditorInstance(deps);
1014
972
  return () => {
1015
973
  this.isComponentMounted = false;
1016
974
  this.scheduleDestroy();
@@ -1018,45 +976,36 @@ var EditorInstanceManager = class _EditorInstanceManager {
1018
976
  };
1019
977
  }
1020
978
  /**
1021
- * Recreate the editor instance if the dependencies have changed.
1022
- */
979
+ * Recreate the editor instance if the dependencies have changed.
980
+ */
1023
981
  refreshEditorInstance(deps) {
1024
982
  if (this.editor && !this.editor.isDestroyed) {
1025
983
  if (this.previousDeps === null) {
1026
984
  this.previousDeps = deps;
1027
985
  return;
1028
986
  }
1029
- const depsAreEqual = this.previousDeps.length === deps.length && this.previousDeps.every((dep, index) => dep === deps[index]);
1030
- if (depsAreEqual) {
1031
- return;
1032
- }
1033
- }
1034
- if (this.editor && !this.editor.isDestroyed) {
1035
- this.editor.destroy();
987
+ if (this.previousDeps.length === deps.length && this.previousDeps.every((dep, index) => dep === deps[index])) return;
1036
988
  }
989
+ if (this.editor && !this.editor.isDestroyed) this.editor.destroy();
1037
990
  this.setEditor(this.createEditor());
1038
991
  this.previousDeps = deps;
1039
992
  }
1040
993
  /**
1041
- * Schedule the destruction of the editor instance.
1042
- * This will only destroy the editor if it was not mounted on the next tick.
1043
- * This is to avoid destroying the editor instance when it's actually still mounted.
1044
- */
994
+ * Schedule the destruction of the editor instance.
995
+ * This will only destroy the editor if it was not mounted on the next tick.
996
+ * This is to avoid destroying the editor instance when it's actually still mounted.
997
+ */
1045
998
  scheduleDestroy() {
1046
999
  const currentInstanceId = this.instanceId;
1047
1000
  const currentEditor = this.editor;
1048
1001
  this.scheduledDestructionTimeout = setTimeout(() => {
1049
1002
  if (this.isComponentMounted && this.instanceId === currentInstanceId) {
1050
- if (currentEditor) {
1051
- currentEditor.setOptions(this.options.current);
1052
- }
1003
+ if (currentEditor) currentEditor.setOptions(this.options.current);
1053
1004
  return;
1054
1005
  }
1055
1006
  if (currentEditor && !currentEditor.isDestroyed) {
1056
1007
  currentEditor.destroy();
1057
- if (this.instanceId === currentInstanceId) {
1058
- this.setEditor(null);
1059
- }
1008
+ if (this.instanceId === currentInstanceId) this.setEditor(null);
1060
1009
  }
1061
1010
  }, 1);
1062
1011
  }
@@ -1064,95 +1013,79 @@ var EditorInstanceManager = class _EditorInstanceManager {
1064
1013
  function useEditor(options = {}, deps = []) {
1065
1014
  const mostRecentOptions = useRef(options);
1066
1015
  mostRecentOptions.current = options;
1067
- const [instanceManager] = useState2(() => new EditorInstanceManager(mostRecentOptions));
1068
- const editor = (0, import_shim2.useSyncExternalStore)(
1069
- instanceManager.subscribe,
1070
- instanceManager.getEditor,
1071
- instanceManager.getServerSnapshot
1072
- );
1073
- useDebugValue2(editor);
1074
- useEffect2(instanceManager.onRender(deps));
1016
+ const [instanceManager] = useState(() => new EditorInstanceManager(mostRecentOptions));
1017
+ const editor = (0, import_shim.useSyncExternalStore)(instanceManager.subscribe, instanceManager.getEditor, instanceManager.getServerSnapshot);
1018
+ useDebugValue(editor);
1019
+ useEffect(instanceManager.onRender(deps));
1075
1020
  useEditorState({
1076
1021
  editor,
1077
1022
  selector: ({ transactionNumber }) => {
1078
- if (options.shouldRerenderOnTransaction === false || options.shouldRerenderOnTransaction === void 0) {
1079
- return null;
1080
- }
1081
- if (options.immediatelyRender && transactionNumber === 0) {
1082
- return 0;
1083
- }
1023
+ if (options.shouldRerenderOnTransaction === false || options.shouldRerenderOnTransaction === void 0) return null;
1024
+ if (options.immediatelyRender && transactionNumber === 0) return 0;
1084
1025
  return transactionNumber + 1;
1085
1026
  }
1086
1027
  });
1087
1028
  return editor;
1088
1029
  }
1089
- var EditorContext = createContext({
1090
- editor: null
1091
- });
1030
+ var EditorContext = createContext({ editor: null });
1092
1031
  var EditorConsumer = EditorContext.Consumer;
1093
1032
  var useCurrentEditor = () => useContext(EditorContext);
1094
- var ReactNodeViewContext = createContext2({
1033
+ var ReactNodeViewContext = createContext({
1095
1034
  onDragStart: () => {
1096
1035
  },
1097
1036
  nodeViewContentChildren: void 0,
1098
1037
  nodeViewContentRef: () => {
1099
1038
  }
1100
1039
  });
1101
- var useReactNodeView = () => useContext2(ReactNodeViewContext);
1102
- var NodeViewWrapper = React3.forwardRef((props, ref) => {
1040
+ var useReactNodeView = () => useContext(ReactNodeViewContext);
1041
+ var NodeViewWrapper = React.forwardRef((props, ref) => {
1103
1042
  const { onDragStart } = useReactNodeView();
1104
1043
  const Tag = props.as || "div";
1105
- return (
1106
- // @ts-ignore
1107
- /* @__PURE__ */ jsx4(
1108
- Tag,
1109
- {
1110
- ...props,
1111
- ref,
1112
- "data-node-view-wrapper": "",
1113
- onDragStart,
1114
- style: {
1115
- whiteSpace: "normal",
1116
- ...props.style
1117
- }
1118
- }
1119
- )
1120
- );
1121
- });
1122
- var ReactMarkViewContext = React4.createContext({
1123
- markViewContentRef: () => {
1124
- }
1125
- });
1126
- var TiptapContext = createContext3({
1127
- get editor() {
1128
- throw new Error("useTiptap must be used within a <Tiptap> provider");
1129
- }
1044
+ return /* @__PURE__ */ jsx(Tag, {
1045
+ ...props,
1046
+ ref,
1047
+ "data-node-view-wrapper": "",
1048
+ onDragStart,
1049
+ style: {
1050
+ whiteSpace: "normal",
1051
+ ...props.style
1052
+ }
1053
+ });
1130
1054
  });
1055
+ var ReactMarkViewContext = React.createContext({ markViewContentRef: () => {
1056
+ } });
1057
+ var TiptapContext = createContext({ get editor() {
1058
+ throw new Error("useTiptap must be used within a <Tiptap> provider");
1059
+ } });
1131
1060
  TiptapContext.displayName = "TiptapContext";
1132
- var useTiptap = () => useContext3(TiptapContext);
1061
+ var useTiptap = () => useContext(TiptapContext);
1133
1062
  function TiptapWrapper({ children, ...props }) {
1134
1063
  const resolvedEditor = "editor" in props ? props.editor : props.instance;
1135
- if (!resolvedEditor) {
1136
- throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
1137
- }
1138
- const tiptapContextValue = useMemo2(
1139
- () => ({ editor: resolvedEditor }),
1140
- [resolvedEditor]
1141
- );
1142
- const legacyContextValue = useMemo2(() => ({ editor: resolvedEditor }), [resolvedEditor]);
1143
- return /* @__PURE__ */ jsx8(EditorContext.Provider, { value: legacyContextValue, children: /* @__PURE__ */ jsx8(TiptapContext.Provider, { value: tiptapContextValue, children }) });
1064
+ if (!resolvedEditor) throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");
1065
+ const tiptapContextValue = useMemo(() => ({ editor: resolvedEditor }), [resolvedEditor]);
1066
+ const legacyContextValue = useMemo(() => ({ editor: resolvedEditor }), [resolvedEditor]);
1067
+ return /* @__PURE__ */ jsx(EditorContext.Provider, {
1068
+ value: legacyContextValue,
1069
+ children: /* @__PURE__ */ jsx(TiptapContext.Provider, {
1070
+ value: tiptapContextValue,
1071
+ children
1072
+ })
1073
+ });
1144
1074
  }
1145
1075
  TiptapWrapper.displayName = "Tiptap";
1146
1076
  function TiptapContent({ ...rest }) {
1147
1077
  const { editor } = useTiptap();
1148
- return /* @__PURE__ */ jsx8(EditorContent, { editor, ...rest });
1078
+ return /* @__PURE__ */ jsx(EditorContent, {
1079
+ editor,
1080
+ ...rest
1081
+ });
1149
1082
  }
1150
1083
  TiptapContent.displayName = "Tiptap.Content";
1151
1084
  var Tiptap = Object.assign(TiptapWrapper, {
1152
1085
  /**
1153
- * The Tiptap Content component that renders the EditorContent with the editor instance from the context.
1154
- * @see TiptapContent
1155
- */
1086
+ * The Tiptap Content component that renders the EditorContent with the editor instance from the context.
1087
+ * @see TiptapContent
1088
+ */
1156
1089
  Content: TiptapContent
1157
1090
  });
1158
1091