@clevertask/scribe 0.1.19 → 0.1.20

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 (40) hide show
  1. package/README.md +2 -2
  2. package/dist/{BarMenu-C9tCdvyV.js → BarMenu-sZGqMjQr.js} +1 -1
  3. package/dist/components/Menu/BarMenu.js +1 -1
  4. package/dist/components/Menu/BubbleMenu.js +2 -2
  5. package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
  6. package/dist/components/Menu/LinkBubbleMenu.js +2 -2
  7. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  8. package/dist/components/Menu/TableBubbleMenu.js +2 -2
  9. package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
  10. package/dist/components/Scribe/extension/callout.js +1 -1
  11. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  12. package/dist/components/Scribe/extension/extension-link.js +1 -1
  13. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  14. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  15. package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
  16. package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
  17. package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
  18. package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
  19. package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
  20. package/dist/components/Scribe/extension/index.js +1 -1
  21. package/dist/components/Scribe/extension/resizable-table.js +1 -1
  22. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  23. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  24. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  25. package/dist/components/Scribe/index.js +3 -3
  26. package/dist/{dist-CzXFZHMF.js → dist-Bm6rBIf2.js} +55 -39
  27. package/dist/{dist-DRPH9MfF.js → dist-BrbZZTdj.js} +21 -9
  28. package/dist/{dist-CkWsQ5Lj.js → dist-jjH04EIX.js} +585 -798
  29. package/dist/{extension-CKcvyrIW.js → extension-BNjzWzJi.js} +2 -2
  30. package/dist/{extension-link-yMrg9JOz.js → extension-link-7ta0X4tP.js} +2 -2
  31. package/dist/main.js +1 -1
  32. package/dist/{markdown-to-html-COv0iaxr.js → markdown-to-html-BSuSwB4B.js} +37 -9
  33. package/dist/{menus-D1cst_3I.js → menus-i0cEakC3.js} +48 -46
  34. package/dist/{resizable-table-D0mls3aB.js → resizable-table-DFTyMlVu.js} +27 -30
  35. package/dist/{schema-extensions-ChhE6XCo.js → schema-extensions-B-U6SbYg.js} +206 -211
  36. package/dist/schema-extensions.js +1 -1
  37. package/dist/schema.js +1 -1
  38. package/dist/utils/index.js +3 -3
  39. package/dist/utils/markdown-to-html.js +1 -1
  40. package/package.json +51 -51
package/README.md CHANGED
@@ -39,7 +39,7 @@ A versatile, block-based rich text editor for diverse applications, built with T
39
39
  ## Installation
40
40
 
41
41
  ```bash
42
- npm install --save-exact @clevertask/scribe @tiptap/pm@3.30.2
42
+ npm install --save-exact @clevertask/scribe @tiptap/pm@3.30.5
43
43
  ```
44
44
 
45
45
  Scribe shares this exact ProseMirror runtime with consumer extensions. Keeping one
@@ -51,7 +51,7 @@ Use the schema subpath when a server or migration tool must parse Scribe content
51
51
  the React editor or Scribe's stylesheet:
52
52
 
53
53
  ```bash
54
- npm install --save-exact @clevertask/scribe @tiptap/core@3.30.2 @tiptap/html@3.30.2 @tiptap/pm@3.30.2
54
+ npm install --save-exact @clevertask/scribe @tiptap/core@3.30.5 @tiptap/html@3.30.5 @tiptap/pm@3.30.5
55
55
  ```
56
56
 
57
57
  ```ts
@@ -1,4 +1,4 @@
1
- import { s as e } from "./dist-DRPH9MfF.js";
1
+ import { s as e } from "./dist-BrbZZTdj.js";
2
2
  import { getPopupMountTarget as t } from "./components/Scribe/extension/getPopupMountTarget.js";
3
3
  import n from "./components/Menu/LinkEditor.js";
4
4
  import { hideLinkBubbleMenu as r } from "./components/Menu/linkBubbleMenuPlugin.js";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../BarMenu-C9tCdvyV.js";
1
+ import { t as e } from "../../BarMenu-sZGqMjQr.js";
2
2
  export { e as default };
@@ -1,6 +1,6 @@
1
- import { s as e } from "../../dist-DRPH9MfF.js";
1
+ import { s as e } from "../../dist-BrbZZTdj.js";
2
2
  import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
3
- import { t as n } from "../../menus-D1cst_3I.js";
3
+ import { t as n } from "../../menus-i0cEakC3.js";
4
4
  import { Flex as r, IconButton as i } from "@radix-ui/themes";
5
5
  import { useCallback as a } from "react";
6
6
  import { jsx as o } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  import { CALLOUT_VARIANTS as e, CALLOUT_VARIANT_LABELS as t, isCalloutVariant as n } from "../Scribe/extension/callout.js";
2
- import { s as r } from "../../dist-DRPH9MfF.js";
2
+ import { s as r } from "../../dist-BrbZZTdj.js";
3
3
  import { getPopupMountTarget as i } from "../Scribe/extension/getPopupMountTarget.js";
4
- import { t as a } from "../../menus-D1cst_3I.js";
4
+ import { t as a } from "../../menus-i0cEakC3.js";
5
5
  import { CalloutIcon as o, RemoveCalloutIcon as s } from "../../icons/CalloutIcon.js";
6
6
  import { calloutBubbleMenuPluginKey as c, getSelectionCalloutContext as l } from "./calloutBubbleMenuPlugin.js";
7
7
  import { getSelectionContextualMenuOwner as u } from "./contextualMenuOwner.js";
@@ -1,9 +1,9 @@
1
1
  import { getExternalLinkPreviewHostname as e } from "../Scribe/extension/external-link-preview/attributes.js";
2
- import { s as t } from "../../dist-DRPH9MfF.js";
2
+ import { s as t } from "../../dist-BrbZZTdj.js";
3
3
  import { getPopupMountTarget as n } from "../Scribe/extension/getPopupMountTarget.js";
4
4
  import r from "./LinkEditor.js";
5
5
  import { consumeLinkBubbleMenuFocusTarget as i, getPlainLinkContextAtPosition as a, getSelectionLinkContext as o, hideLinkBubbleMenu as s, linkBubbleMenuPluginKey as c, showLinkBubbleMenu as l } from "./linkBubbleMenuPlugin.js";
6
- import { t as u } from "../../menus-D1cst_3I.js";
6
+ import { t as u } from "../../menus-i0cEakC3.js";
7
7
  import { getSelectionContextualMenuOwner as d } from "./contextualMenuOwner.js";
8
8
  import { getExternalLinkPreviewResolutionStatus as f } from "../Scribe/extension/external-link-preview/resolver.js";
9
9
  import { Box as p } from "@radix-ui/themes";
@@ -1,4 +1,4 @@
1
- import { s as e } from "../../../dist-DRPH9MfF.js";
1
+ import { s as e } from "../../../dist-BrbZZTdj.js";
2
2
  import { Button as t, Flex as n } from "@radix-ui/themes";
3
3
  import { useCallback as r } from "react";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
@@ -1,6 +1,6 @@
1
- import { s as e } from "../../dist-DRPH9MfF.js";
1
+ import { s as e } from "../../dist-BrbZZTdj.js";
2
2
  import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
3
- import { t as n } from "../../menus-D1cst_3I.js";
3
+ import { t as n } from "../../menus-i0cEakC3.js";
4
4
  import { getSelectionTableContext as r, tableBubbleMenuPluginKey as i } from "./tableBubbleMenuPlugin.js";
5
5
  import { getSelectionContextualMenuOwner as a } from "./contextualMenuOwner.js";
6
6
  import { Flex as o, IconButton as s, Separator as c } from "@radix-ui/themes";
@@ -1,4 +1,4 @@
1
- import { v as e } from "../../dist-CkWsQ5Lj.js";
1
+ import { v as e } from "../../dist-jjH04EIX.js";
2
2
  import { normalizeExternalLinkPreviewAttributes as t } from "../Scribe/extension/external-link-preview/attributes.js";
3
3
  import { NodeSelection as n, PluginKey as r } from "@tiptap/pm/state";
4
4
  //#region lib/components/Menu/linkBubbleMenuPlugin.ts
@@ -1,4 +1,4 @@
1
- import { A as e, L as t, a as n } from "../../../dist-CkWsQ5Lj.js";
1
+ import { A as e, L as t, a as n } from "../../../dist-jjH04EIX.js";
2
2
  import { TextSelection as r } from "@tiptap/pm/state";
3
3
  //#region lib/components/Scribe/extension/callout.ts
4
4
  var i = [
@@ -1,4 +1,4 @@
1
- import { i as e } from "../../../../dist-DRPH9MfF.js";
1
+ import { i as e } from "../../../../dist-BrbZZTdj.js";
2
2
  import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
3
3
  import { t as n } from "../../../../tippy.esm-DOXqN1Qm.js";
4
4
  import { EmojiList as r } from "./EmojiList.js";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../extension-link-yMrg9JOz.js";
1
+ import { t as e } from "../../../extension-link-7ta0X4tP.js";
2
2
  export { e as default };
@@ -1,5 +1,5 @@
1
- import { n as e } from "../../../dist-CkWsQ5Lj.js";
2
- import { n as t, t as n } from "../../../markdown-to-html-COv0iaxr.js";
1
+ import { n as e } from "../../../dist-jjH04EIX.js";
2
+ import { n as t, t as n } from "../../../markdown-to-html-BSuSwB4B.js";
3
3
  import { Plugin as r, PluginKey as i } from "@tiptap/pm/state";
4
4
  //#region lib/components/Scribe/extension/extension-markdown-paste.ts
5
5
  var a = new i("markdownPaste"), o = /* @__PURE__ */ new Set([
@@ -1,4 +1,4 @@
1
- import { n as e } from "../../../dist-CkWsQ5Lj.js";
1
+ import { n as e } from "../../../dist-jjH04EIX.js";
2
2
  //#region lib/components/Scribe/extension/extension-selectedText.ts
3
3
  var t = e.create({
4
4
  name: "SelectedText",
@@ -1,4 +1,4 @@
1
- import { v as e } from "../../../../dist-CkWsQ5Lj.js";
1
+ import { v as e } from "../../../../dist-jjH04EIX.js";
2
2
  import { EXTERNAL_LINK_PREVIEW_NODE_NAME as t, hasExternalLinkPreviewMetadata as n, normalizeExternalLinkPreviewAttributes as r, normalizeExternalLinkPreviewHref as i } from "./attributes.js";
3
3
  import { normalizeLinkUrl as a } from "../../../Menu/linkUrl.js";
4
4
  import { startExternalLinkPreviewResolution as o } from "./resolver.js";
@@ -1,7 +1,7 @@
1
1
  import { EXTERNAL_LINK_PREVIEW_DISPLAYS as e } from "./types.js";
2
2
  import { EXTERNAL_LINK_PREVIEW_NODE_NAME as t } from "./attributes.js";
3
3
  import { ExternalLinkPreviewSchema as n } from "./schema.js";
4
- import { r } from "../../../../dist-DRPH9MfF.js";
4
+ import { r } from "../../../../dist-BrbZZTdj.js";
5
5
  import { createExternalLinkPreviewResolverPlugin as i } from "./resolver.js";
6
6
  import { createExternalLinkPreviewCommands as a } from "./commands.js";
7
7
  import { ExternalLinkPreviewNodeView as o } from "./node-view.js";
@@ -1,5 +1,5 @@
1
1
  import { getExternalLinkPreviewHostname as e, getExternalLinkPreviewTitle as t, normalizeExternalLinkPreviewAttributes as n } from "./attributes.js";
2
- import { n as r, s as i } from "../../../../dist-DRPH9MfF.js";
2
+ import { n as r, s as i } from "../../../../dist-BrbZZTdj.js";
3
3
  import { showLinkBubbleMenu as a } from "../../../Menu/linkBubbleMenuPlugin.js";
4
4
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
5
  //#region lib/components/Scribe/extension/external-link-preview/node-view.tsx
@@ -1,4 +1,4 @@
1
- import { L as e } from "../../../../dist-CkWsQ5Lj.js";
1
+ import { L as e } from "../../../../dist-jjH04EIX.js";
2
2
  import { getExternalLinkPreviewHostname as t, getExternalLinkPreviewTitle as n } from "./attributes.js";
3
3
  import { getExternalLinkPreviewDataAttributes as r } from "./serialization.js";
4
4
  //#region lib/components/Scribe/extension/external-link-preview/render-html.ts
@@ -1,4 +1,4 @@
1
- import { a as e } from "../../../../dist-CkWsQ5Lj.js";
1
+ import { a as e } from "../../../../dist-jjH04EIX.js";
2
2
  import { EXTERNAL_LINK_PREVIEW_NODE_NAME as t, isExternalLinkPreviewDisplay as n, normalizeExternalLinkPreviewAttributes as r, normalizeExternalLinkPreviewHref as i, normalizeExternalLinkPreviewLinkText as a, normalizeExternalLinkPreviewMediaUrl as o, normalizeExternalLinkPreviewMetadata as s } from "./attributes.js";
3
3
  import { getExternalLinkPreviewAttributesFromElement as c } from "./serialization.js";
4
4
  import { renderExternalLinkPreviewHTML as l } from "./render-html.js";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../extension-CKcvyrIW.js";
1
+ import { t as e } from "../../../extension-BNjzWzJi.js";
2
2
  export { e as initExtensions };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../resizable-table-D0mls3aB.js";
1
+ import { t as e } from "../../../resizable-table-DFTyMlVu.js";
2
2
  export { e as ScribeTable };
@@ -1,5 +1,5 @@
1
- import { n as e } from "../../../../dist-CkWsQ5Lj.js";
2
- import { n as t } from "../../../../dist-CzXFZHMF.js";
1
+ import { n as e } from "../../../../dist-jjH04EIX.js";
2
+ import { n as t } from "../../../../dist-Bm6rBIf2.js";
3
3
  import { PluginKey as n } from "@tiptap/pm/state";
4
4
  //#region lib/components/Scribe/extension/slashCommand/index.ts
5
5
  var r = new n("slashSuggestion"), i = e.create({
@@ -1,4 +1,4 @@
1
- import { i as e } from "../../../../dist-DRPH9MfF.js";
1
+ import { i as e } from "../../../../dist-BrbZZTdj.js";
2
2
  import { getPopupMountTarget as t } from "../getPopupMountTarget.js";
3
3
  import { t as n } from "../../../../tippy.esm-DOXqN1Qm.js";
4
4
  import { SlashCommandList as r } from "./SlashCommandList.js";
@@ -1,4 +1,4 @@
1
- import { n as e } from "../../../dist-CkWsQ5Lj.js";
1
+ import { n as e } from "../../../dist-jjH04EIX.js";
2
2
  import { Plugin as t, PluginKey as n } from "@tiptap/pm/state";
3
3
  //#region lib/components/Scribe/extension/tableOfContents.ts
4
4
  var r = "scribeTableOfContents", i = new n("scribeTableOfContents"), a = 10, o = (e) => e.trim().toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "heading", s = (e, t) => {
@@ -1,10 +1,10 @@
1
- import { n as e, t } from "../../BarMenu-C9tCdvyV.js";
2
- import { o as n, t as r } from "../../dist-DRPH9MfF.js";
1
+ import { n as e, t } from "../../BarMenu-sZGqMjQr.js";
2
+ import { o as n, t as r } from "../../dist-BrbZZTdj.js";
3
3
  import i from "../Menu/CalloutBubbleMenu.js";
4
4
  import a from "../Menu/LinkBubbleMenu.js";
5
5
  import o from "../Menu/TableBubbleMenu.js";
6
6
  import { t as s } from "../../html-to-markdown-pY8ngCXa.js";
7
- import { t as c } from "../../extension-CKcvyrIW.js";
7
+ import { t as c } from "../../extension-BNjzWzJi.js";
8
8
  import { SuggestionItemType as l } from "./extension/slashCommand/items.js";
9
9
  import "./extension/tableOfContents.js";
10
10
  import "../../utils/index.js";
@@ -1,8 +1,8 @@
1
- import { f as e } from "./dist-CkWsQ5Lj.js";
1
+ import { f as e } from "./dist-jjH04EIX.js";
2
2
  import { a as t, c as n, i as r, r as i } from "./floating-ui.dom-CmJ6iBdh.js";
3
3
  import { Plugin as a, PluginKey as o } from "@tiptap/pm/state";
4
4
  import { Decoration as s, DecorationSet as c } from "@tiptap/pm/view";
5
- //#region node_modules/.pnpm/@tiptap+suggestion@3.30.2_@floating-ui+dom@1.8.0_@tiptap+core@3.30.2_@tiptap+pm@3.30.2__@tiptap+pm@3.30.2/node_modules/@tiptap/suggestion/dist/index.js
5
+ //#region node_modules/.pnpm/@tiptap+suggestion@3.30.5_@floating-ui+dom@1.8.0_@tiptap+core@3.30.5_@tiptap+pm@3.30.5__@tiptap+pm@3.30.5/node_modules/@tiptap/suggestion/dist/index.js
6
6
  function l(t) {
7
7
  let { char: n, allowSpaces: r, allowToIncludeChar: i, allowedPrefixes: a, startOfLine: o, $position: s } = t, c = r && !i, l = e(n), u = RegExp(`\\s${l}$`), d = o ? "^" : "", f = i ? "" : l, p = RegExp(c ? `${d}${l}.*?(?=\\s${f}|$)` : `${d}(?:^)?${l}[^\\s${f}]*`, "gm"), m = s.nodeBefore?.isText && s.nodeBefore.text;
8
8
  if (!m) return null;
@@ -63,15 +63,20 @@ function h({ pluginKey: e, decorationTag: t, decorationClass: n, decorationConte
63
63
  handleKeyDown(t, n) {
64
64
  var r;
65
65
  let i = e.getState(t.state);
66
- return i.active ? n.key === "Escape" || n.key === "Esc" ? ((r = a?.onKeyDown) == null || r.call(a, {
67
- view: t,
68
- event: n,
69
- range: i.range
70
- }), o(t), !0) : (a?.onKeyDown)?.call(a, {
66
+ if (!i.active) return !1;
67
+ if (n.key === "Escape" || n.key === "Esc") {
68
+ var s;
69
+ return a == null || (s = a.onKeyDown) == null || s.call(a, {
70
+ view: t,
71
+ event: n,
72
+ range: i.range
73
+ }), o(t), !0;
74
+ }
75
+ return (a == null || (r = a.onKeyDown) == null ? void 0 : r.call(a, {
71
76
  view: t,
72
77
  event: n,
73
78
  range: i.range
74
- }) || !1 : !1;
79
+ })) || !1;
75
80
  },
76
81
  decorations(a) {
77
82
  let { active: o, range: l, decorationId: u, query: d } = e.getState(a);
@@ -180,14 +185,15 @@ function _({ editor: e, items: t }) {
180
185
  };
181
186
  }
182
187
  function v({ placement: e, offset: r, flip: i, floatingUi: a }) {
183
- let o = [n({
188
+ var o;
189
+ let s = [n({
184
190
  mainAxis: r.mainAxis ?? 4,
185
191
  crossAxis: r.crossAxis ?? 0
186
192
  })];
187
- return i && o.push(t()), a?.middleware?.length && o.push(...a.middleware), {
193
+ return i && s.push(t()), a != null && (o = a.middleware) != null && o.length && s.push(...a.middleware), {
188
194
  placement: e,
189
195
  strategy: a?.strategy ?? "absolute",
190
- middleware: o
196
+ middleware: s
191
197
  };
192
198
  }
193
199
  function y(e) {
@@ -248,42 +254,44 @@ function x({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i,
248
254
  floatingUi: d
249
255
  });
250
256
  function S(e, t) {
251
- var n, i, a;
252
257
  switch (e) {
253
258
  case "started":
254
- (n = r?.onStart) == null || n.call(r, t);
259
+ var n;
260
+ r == null || (n = r.onStart) == null || n.call(r, t);
255
261
  break;
256
262
  case "updated":
257
- (i = r?.onUpdate) == null || i.call(r, t);
263
+ var i;
264
+ r == null || (i = r.onUpdate) == null || i.call(r, t);
258
265
  break;
259
- case "stopped": (a = r?.onExit) == null || a.call(r, t);
266
+ case "stopped":
267
+ var a;
268
+ r == null || (a = r.onExit) == null || a.call(r, t);
260
269
  }
261
270
  }
262
271
  return {
263
272
  update: async (n, d) => {
264
- var _, v;
265
- let C = t.getState(d), w = t.getState(n.state);
266
- if (!C || !w) return;
267
- let T = null, E = C.query !== w.query, D = C.text !== w.text, O = C.range.from !== w.range.from || C.range.to !== w.range.to, k = E || D || O;
268
- if (!C.active && w.active) T = "started";
269
- else if (C.active && !w.active) T = "stopped";
270
- else if (w.active && k) T = "updated";
273
+ let _ = t.getState(d), v = t.getState(n.state);
274
+ if (!_ || !v) return;
275
+ let C = null, w = _.query !== v.query, T = _.text !== v.text, E = _.range.from !== v.range.from || _.range.to !== v.range.to, D = w || T || E;
276
+ if (!_.active && v.active) C = "started";
277
+ else if (_.active && !v.active) C = "stopped";
278
+ else if (v.active && D) C = "updated";
271
279
  else return;
272
- let A = T === "stopped" ? C : w, j = n.dom.querySelector(`[data-decoration-id="${A.decorationId}"]`), M = m(n, j), N = i === 0 || (A.query ? A.query.length >= i : !1), P = (T === "started" || T === "updated") && N;
280
+ let O = C === "stopped" ? _ : v, k = n.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`), A = m(n, k), j = i === 0 || (O.query ? O.query.length >= i : !1), M = (C === "started" || C === "updated") && j;
273
281
  if (g = {
274
282
  editor: e,
275
- range: A.range,
276
- query: A.query || "",
277
- text: A.text || "",
283
+ range: O.range,
284
+ query: O.query || "",
285
+ text: O.text || "",
278
286
  items: o ?? [],
279
287
  command: (t) => p({
280
288
  editor: e,
281
- range: A.range,
289
+ range: O.range,
282
290
  props: t
283
291
  }),
284
- decorationNode: j,
285
- clientRect: M,
286
- loading: P,
292
+ decorationNode: k,
293
+ clientRect: A,
294
+ loading: M,
287
295
  placement: s,
288
296
  offset: {
289
297
  mainAxis: c.mainAxis ?? 4,
@@ -293,15 +301,23 @@ function x({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i,
293
301
  flip: u,
294
302
  floatingUi: x,
295
303
  mount: b({
296
- getReferenceRect: M,
304
+ getReferenceRect: A,
297
305
  contextElement: n.dom,
298
306
  config: x,
299
307
  container: l,
300
308
  dismissOnOutsideClick: f,
301
309
  dismiss: () => h(e.view)
302
310
  })
303
- }, T === "started" && ((_ = r?.onBeforeStart) == null || _.call(r, g)), T === "updated" && ((v = r?.onBeforeUpdate) == null || v.call(r, g)), T === "started" && S(T, g), T === "started" || T === "updated") {
304
- if (!P) y.abort(), g = {
311
+ }, C === "started") {
312
+ var N;
313
+ r == null || (N = r.onBeforeStart) == null || N.call(r, g);
314
+ }
315
+ if (C === "updated") {
316
+ var P;
317
+ r == null || (P = r.onBeforeUpdate) == null || P.call(r, g);
318
+ }
319
+ if (C === "started" && S(C, g), C === "started" || C === "updated") {
320
+ if (!M) y.abort(), g = {
305
321
  ...g,
306
322
  items: o ?? [],
307
323
  loading: !1
@@ -311,8 +327,8 @@ function x({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i,
311
327
  ...g,
312
328
  items: o ?? [],
313
329
  loading: !0
314
- }, T = "updated", S(T, g);
315
- let e = await y.fetch(A.query || "", a);
330
+ }, C = "updated", S(C, g);
331
+ let e = await y.fetch(O.query || "", a);
316
332
  if (e.status === "aborted") return;
317
333
  if (!t.getState(n.state)?.active) {
318
334
  y.abort();
@@ -328,15 +344,15 @@ function x({ editor: e, pluginKey: t, items: n, renderer: r, minQueryLength: i,
328
344
  };
329
345
  }
330
346
  }
331
- if (T === "stopped") {
332
- y.abort(), S(T, g), g = void 0;
347
+ if (C === "stopped") {
348
+ y.abort(), S(C, g), g = void 0;
333
349
  return;
334
350
  }
335
- T === "updated" && S(T, g);
351
+ C === "updated" && S(C, g);
336
352
  },
337
353
  destroy: () => {
338
354
  var e;
339
- y.abort(), g && ((e = r?.onExit) == null || e.call(r, g));
355
+ y.abort(), g && (r == null || (e = r.onExit) == null || e.call(r, g));
340
356
  }
341
357
  };
342
358
  }
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./rolldown-runtime-CtkjhSXr.js";
2
- import { C as t, N as n, o as r, t as i } from "./dist-CkWsQ5Lj.js";
2
+ import { C as t, N as n, o as r, t as i } from "./dist-jjH04EIX.js";
3
3
  import * as a from "react";
4
4
  import o, { createContext as s, createElement as c, createRef as l, forwardRef as u, memo as d, useContext as f, useDebugValue as p, useEffect as m, useLayoutEffect as h, useMemo as g, useRef as _, useState as v, version as y } from "react";
5
5
  import b, { flushSync as ee } from "react-dom";
@@ -764,7 +764,7 @@ var X = class {
764
764
  let t = this.component, n = this.props, r = this.editor, i = rt(), a = nt(t), o = { ...n };
765
765
  o.ref && !(i || a) && delete o.ref, !o.ref && (i || a) && (o.ref = (e) => {
766
766
  this.ref = e;
767
- }), this.reactElement = /* @__PURE__ */ S(t, { ...o }), (e = r?.contentComponent) == null || e.setRenderer(this.id, this);
767
+ }), this.reactElement = /* @__PURE__ */ S(t, { ...o }), r == null || (e = r.contentComponent) == null || e.setRenderer(this.id, this);
768
768
  }
769
769
  updateProps(e = {}) {
770
770
  if (this.destroyed) return;
@@ -783,7 +783,9 @@ var X = class {
783
783
  }
784
784
  destroy() {
785
785
  var e;
786
- this.destroyed = !0, (e = this.editor?.contentComponent) == null || e.removeRenderer(this.id);
786
+ this.destroyed = !0;
787
+ let t = this.editor;
788
+ t == null || (e = t.contentComponent) == null || e.removeRenderer(this.id);
787
789
  try {
788
790
  this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
789
791
  } catch {}
@@ -796,12 +798,13 @@ var X = class {
796
798
  };
797
799
  o.createContext({ markViewContentRef: () => {} });
798
800
  function it(e) {
799
- let t = e.getRootNode(), n = typeof t.getSelection == "function" ? t.getSelection() : (e.ownerDocument?.defaultView)?.getSelection();
800
- if (!n || n.rangeCount === 0) return null;
801
- let { anchorNode: r, anchorOffset: i, focusNode: a, focusOffset: o } = n;
802
- return !r || !a || !e.contains(r) || !e.contains(a) ? null : () => {
801
+ var t;
802
+ let n = e.getRootNode(), r = typeof n.getSelection == "function" ? n.getSelection() : (t = e.ownerDocument) == null || (t = t.defaultView) == null ? void 0 : t.getSelection();
803
+ if (!r || r.rangeCount === 0) return null;
804
+ let { anchorNode: i, anchorOffset: a, focusNode: o, focusOffset: s } = r;
805
+ return !i || !o || !e.contains(i) || !e.contains(o) ? null : () => {
803
806
  try {
804
- n.setBaseAndExtent(r, i, a, o);
807
+ r.setBaseAndExtent(i, a, o, s);
805
808
  } catch {}
806
809
  };
807
810
  }
@@ -953,7 +956,16 @@ var at = class extends r {
953
956
  }
954
957
  };
955
958
  function ot(e, t) {
956
- return (n) => n.editor.contentComponent ? new at(e, n, t) : {};
959
+ return (n) => n.editor.contentComponent ? new at(e, n, t) : {
960
+ dom: document.createElement("span"),
961
+ contentDOM: null,
962
+ update: () => !1,
963
+ destroy: () => {},
964
+ selectNode: () => {},
965
+ deselectNode: () => {},
966
+ stopEvent: () => !1,
967
+ ignoreMutation: () => !0
968
+ };
957
969
  }
958
970
  var Z = s({ get editor() {
959
971
  throw Error("useTiptap must be used within a <Tiptap> provider");