@clevertask/scribe 0.1.17 → 0.1.19

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 (58) hide show
  1. package/README.md +29 -1
  2. package/dist/{BarMenu-x4sf3ECS.js → BarMenu-C9tCdvyV.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 +64 -64
  6. package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
  7. package/dist/components/Menu/LinkBubbleMenu.js +16 -16
  8. package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
  9. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  10. package/dist/components/Menu/TableBubbleMenu.js +2 -2
  11. package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
  12. package/dist/components/Scribe/extension/callout.js +2 -5
  13. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  14. package/dist/components/Scribe/extension/extension-link.js +1 -1
  15. package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
  16. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  17. package/dist/components/Scribe/extension/external-link-preview/commands.js +38 -38
  18. package/dist/components/Scribe/extension/external-link-preview/index.d.ts +1 -2
  19. package/dist/components/Scribe/extension/external-link-preview/index.d.ts.map +1 -1
  20. package/dist/components/Scribe/extension/external-link-preview/index.js +20 -113
  21. package/dist/components/Scribe/extension/external-link-preview/node-view.js +6 -6
  22. package/dist/components/Scribe/extension/external-link-preview/paste.js +5 -5
  23. package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
  24. package/dist/components/Scribe/extension/external-link-preview/schema.d.ts +8 -0
  25. package/dist/components/Scribe/extension/external-link-preview/schema.d.ts.map +1 -0
  26. package/dist/components/Scribe/extension/external-link-preview/schema.js +100 -0
  27. package/dist/components/Scribe/extension/index.d.ts +2 -2
  28. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  29. package/dist/components/Scribe/extension/index.js +1 -1
  30. package/dist/components/Scribe/extension/resizable-table.js +1 -1
  31. package/dist/components/Scribe/extension/slashCommand/index.js +32 -2
  32. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  33. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  34. package/dist/components/Scribe/index.d.ts.map +1 -1
  35. package/dist/components/Scribe/index.js +4 -4
  36. package/dist/{dist-tNcpTcFT.js → dist-CkWsQ5Lj.js} +197 -185
  37. package/dist/{slashCommand-CtvgnL0Z.js → dist-CzXFZHMF.js} +56 -81
  38. package/dist/{dist-DDjaA1Pn.js → dist-DRPH9MfF.js} +1 -1
  39. package/dist/extension-CKcvyrIW.js +57 -0
  40. package/dist/{extension-link-RYtPpHwt.js → extension-link-yMrg9JOz.js} +2 -2
  41. package/dist/{html-to-markdown-nbQ6qHyO.js → html-to-markdown-pY8ngCXa.js} +14 -14
  42. package/dist/main.js +6 -6
  43. package/dist/{markdown-to-html-B-KKCZRs.js → markdown-to-html-COv0iaxr.js} +14 -15
  44. package/dist/{menus-U2HdvQnu.js → menus-D1cst_3I.js} +107 -107
  45. package/dist/purify.es-DGv0-Lid.js +805 -0
  46. package/dist/{resizable-table-m0AzovsZ.js → resizable-table-D0mls3aB.js} +2 -2
  47. package/dist/{extension-CwuvxVkr.js → schema-extensions-ChhE6XCo.js} +51921 -51948
  48. package/dist/schema-extensions.d.ts +20 -0
  49. package/dist/schema-extensions.d.ts.map +1 -0
  50. package/dist/schema-extensions.js +2 -0
  51. package/dist/schema.d.ts +17 -0
  52. package/dist/schema.d.ts.map +1 -0
  53. package/dist/schema.js +5 -0
  54. package/dist/utils/html-to-markdown.js +1 -1
  55. package/dist/utils/index.js +4 -4
  56. package/dist/utils/markdown-to-html.js +1 -1
  57. package/package.json +58 -52
  58. package/dist/purify.es-BES4pJF7.js +0 -774
@@ -1,17 +1,17 @@
1
- import { a as e } from "./dist-DDjaA1Pn.js";
2
- import { B as t, E as n, P as r, T as i, n as a } from "./dist-tNcpTcFT.js";
3
- import { a as o, c as s, i as c, l, n as u, o as d, s as f, t as p, u as m } from "./floating-ui.dom-CmJ6iBdh.js";
4
- import h, { useEffect as g, useLayoutEffect as _, useRef as v, useState as y } from "react";
5
- import { createPortal as b } from "react-dom";
6
- import { NodeSelection as x, Plugin as S, PluginKey as C } from "@tiptap/pm/state";
7
- import { CellSelection as w } from "@tiptap/pm/tables";
8
- //#region node_modules/.pnpm/@tiptap+extension-bubble-menu@3.30.1_@tiptap+core@3.30.1_@tiptap+pm@3.30.1__@tiptap+pm@3.30.1/node_modules/@tiptap/extension-bubble-menu/dist/index.js
1
+ import { B as e, E as t, P as n, T as r, n as i } from "./dist-CkWsQ5Lj.js";
2
+ import { a, c as o, i as s, l as c, n as l, o as u, s as d, t as f, u as p } from "./floating-ui.dom-CmJ6iBdh.js";
3
+ import { a as m } from "./dist-DRPH9MfF.js";
4
+ import { NodeSelection as h, Plugin as g, PluginKey as _ } from "@tiptap/pm/state";
5
+ import { CellSelection as v } from "@tiptap/pm/tables";
6
+ import y, { useEffect as b, useLayoutEffect as x, useRef as S, useState as C } from "react";
7
+ import { createPortal as w } from "react-dom";
8
+ //#region node_modules/.pnpm/@tiptap+extension-bubble-menu@3.30.2_@tiptap+core@3.30.2_@tiptap+pm@3.30.2__@tiptap+pm@3.30.2/node_modules/@tiptap/extension-bubble-menu/dist/index.js
9
9
  function T(e, t) {
10
10
  let n = Math.min(e.top, t.top), r = Math.max(e.bottom, t.bottom), i = Math.min(e.left, t.left), a = Math.max(e.right, t.right) - i, o = r - n;
11
11
  return new DOMRect(i, n, a, o);
12
12
  }
13
13
  var E = class {
14
- constructor({ editor: e, element: t, view: n, pluginKey: i = "bubbleMenu", updateDelay: a = 250, resizeDelay: o = 60, shouldShow: s, appendTo: c, getReferencedVirtualElement: l, options: u }) {
14
+ constructor({ editor: e, element: t, view: r, pluginKey: i = "bubbleMenu", updateDelay: a = 250, resizeDelay: o = 60, shouldShow: s, appendTo: c, getReferencedVirtualElement: l, options: u }) {
15
15
  this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
16
16
  strategy: "absolute",
17
17
  placement: "top",
@@ -27,8 +27,8 @@ var E = class {
27
27
  onHide: void 0,
28
28
  onUpdate: void 0,
29
29
  onDestroy: void 0
30
- }, this.shouldShow = ({ view: e, state: t, from: n, to: i }) => {
31
- let { doc: a, selection: o } = t, { empty: s } = o, c = !a.textBetween(n, i).length && r(t.selection), l = this.element.contains(document.activeElement);
30
+ }, this.shouldShow = ({ view: e, state: t, from: r, to: i }) => {
31
+ let { doc: a, selection: o } = t, { empty: s } = o, c = !a.textBetween(r, i).length && n(t.selection), l = this.element.contains(document.activeElement);
32
32
  return !(!(e.hasFocus() || l) || s || c || !this.editor.isEditable);
33
33
  }, this.mousedownHandler = () => {
34
34
  this.preventHide = !0;
@@ -67,32 +67,32 @@ var E = class {
67
67
  }, this.transactionHandler = ({ transaction: e }) => {
68
68
  let t = e.getMeta(this.pluginKey);
69
69
  t === "updatePosition" ? this.updatePosition() : t && typeof t == "object" && t.type === "updateOptions" ? this.updateOptions(t.options) : t === "hide" ? this.hide() : t === "show" && (this.updatePosition(), this.show());
70
- }, this.editor = e, this.element = t, this.view = n, this.pluginKey = i, this.updateDelay = a, this.resizeDelay = o, this.appendTo = c, this.scrollTarget = u?.scrollTarget ?? window, this.getReferencedVirtualElement = l, this.floatingUIOptions = {
70
+ }, this.editor = e, this.element = t, this.view = r, this.pluginKey = i, this.updateDelay = a, this.resizeDelay = o, this.appendTo = c, this.scrollTarget = u?.scrollTarget ?? window, this.getReferencedVirtualElement = l, this.floatingUIOptions = {
71
71
  ...this.floatingUIOptions,
72
72
  ...u
73
- }, this.element.tabIndex = 0, s && (this.shouldShow = s), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
73
+ }, this.element.tabIndex = 0, s && (this.shouldShow = s), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(r, r.state), this.getShouldShow() && (this.show(), this.updatePosition());
74
74
  }
75
75
  get middlewares() {
76
76
  let e = [];
77
- return this.floatingUIOptions.flip && e.push(o(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(l(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(s(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(p(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(m(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(u(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(d(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(f(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
77
+ return this.floatingUIOptions.flip && e.push(a(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(c(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(o(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(f(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(p(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(l(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(u(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(d(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
78
78
  }
79
79
  get virtualElement() {
80
- let { selection: e } = this.editor.state, n = this.getReferencedVirtualElement?.call(this);
80
+ let { selection: t } = this.editor.state, n = this.getReferencedVirtualElement?.call(this);
81
81
  if (n) return n;
82
82
  if (!this.view?.dom?.parentNode) return;
83
- let r = t(this.view, e.from, e.to), i = {
83
+ let r = e(this.view, t.from, t.to), i = {
84
84
  getBoundingClientRect: () => r,
85
85
  getClientRects: () => [r]
86
86
  };
87
- if (e instanceof x) {
88
- let t = this.view.nodeDOM(e.from), n = t.dataset.nodeViewWrapper ? t : t.querySelector("[data-node-view-wrapper]");
89
- n && (t = n), t && (i = {
90
- getBoundingClientRect: () => t.getBoundingClientRect(),
91
- getClientRects: () => [t.getBoundingClientRect()]
87
+ if (t instanceof h) {
88
+ let e = this.view.nodeDOM(t.from), n = e.dataset.nodeViewWrapper ? e : e.querySelector("[data-node-view-wrapper]");
89
+ n && (e = n), e && (i = {
90
+ getBoundingClientRect: () => e.getBoundingClientRect(),
91
+ getClientRects: () => [e.getBoundingClientRect()]
92
92
  });
93
93
  }
94
- if (e instanceof w) {
95
- let { $anchorCell: t, $headCell: n } = e, r = t ? t.pos : n.pos, a = n ? n.pos : t.pos, o = this.view.nodeDOM(r), s = this.view.nodeDOM(a);
94
+ if (t instanceof v) {
95
+ let { $anchorCell: e, $headCell: n } = t, r = e ? e.pos : n.pos, a = n ? n.pos : e.pos, o = this.view.nodeDOM(r), s = this.view.nodeDOM(a);
96
96
  if (!o || !s) return;
97
97
  let c = o === s ? o.getBoundingClientRect() : T(o.getBoundingClientRect(), s.getBoundingClientRect());
98
98
  i = {
@@ -105,7 +105,7 @@ var E = class {
105
105
  updatePosition() {
106
106
  if (!this.isVisible) return;
107
107
  let e = this.virtualElement;
108
- e && c(e, this.element, {
108
+ e && s(e, this.element, {
109
109
  placement: this.floatingUIOptions.placement,
110
110
  strategy: this.floatingUIOptions.strategy,
111
111
  middleware: this.middlewares
@@ -159,14 +159,14 @@ var E = class {
159
159
  destroy() {
160
160
  this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
161
161
  }
162
- }, D = (e) => new S({
163
- key: typeof e.pluginKey == "string" ? new C(e.pluginKey) : e.pluginKey,
162
+ }, D = (e) => new g({
163
+ key: typeof e.pluginKey == "string" ? new _(e.pluginKey) : e.pluginKey,
164
164
  view: (t) => new E({
165
165
  view: t,
166
166
  ...e
167
167
  })
168
168
  });
169
- a.create({
169
+ i.create({
170
170
  name: "bubbleMenu",
171
171
  addOptions() {
172
172
  return {
@@ -191,7 +191,7 @@ a.create({
191
191
  }
192
192
  });
193
193
  //#endregion
194
- //#region node_modules/.pnpm/@tiptap+extension-floating-menu@3.30.1_@floating-ui+dom@1.8.0_@tiptap+core@3.30.1_@tiptap+pm@3.30.1__@tiptap+pm@3.30.1/node_modules/@tiptap/extension-floating-menu/dist/index.js
194
+ //#region node_modules/.pnpm/@tiptap+extension-floating-menu@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/extension-floating-menu/dist/index.js
195
195
  var O = class {
196
196
  constructor({ editor: e, element: t, view: n, pluginKey: r = "floatingMenu", updateDelay: i = 250, resizeDelay: a = 60, options: o, appendTo: s, shouldShow: c }) {
197
197
  this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.shouldShow = ({ view: e, state: t }) => {
@@ -240,11 +240,11 @@ var O = class {
240
240
  }, this.element.tabIndex = 0, c && (this.shouldShow = c), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
241
241
  }
242
242
  getTextContent(e) {
243
- return i(e, { textSerializers: n(this.editor.schema) });
243
+ return r(e, { textSerializers: t(this.editor.schema) });
244
244
  }
245
245
  get middlewares() {
246
246
  let e = [];
247
- return this.floatingUIOptions.flip && e.push(o(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(l(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(s(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(p(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(m(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(u(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(d(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(f(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
247
+ return this.floatingUIOptions.flip && e.push(a(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(c(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(o(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(f(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(p(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(l(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(u(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(d(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
248
248
  }
249
249
  getShouldShow(e) {
250
250
  let { state: t } = this.view, { selection: n } = t, { ranges: r } = n, i = Math.min(...r.map((e) => e.$from.pos)), a = Math.max(...r.map((e) => e.$to.pos));
@@ -268,8 +268,8 @@ var O = class {
268
268
  }
269
269
  updatePosition() {
270
270
  if (!this.view?.dom?.parentNode) return;
271
- let { selection: e } = this.editor.state, n = t(this.view, e.from, e.to);
272
- c({
271
+ let { selection: t } = this.editor.state, n = e(this.view, t.from, t.to);
272
+ s({
273
273
  getBoundingClientRect: () => n,
274
274
  getClientRects: () => [n]
275
275
  }, this.element, {
@@ -298,14 +298,14 @@ var O = class {
298
298
  destroy() {
299
299
  this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
300
300
  }
301
- }, k = (e) => new S({
302
- key: typeof e.pluginKey == "string" ? new C(e.pluginKey) : e.pluginKey,
301
+ }, k = (e) => new g({
302
+ key: typeof e.pluginKey == "string" ? new _(e.pluginKey) : e.pluginKey,
303
303
  view: (t) => new O({
304
304
  view: t,
305
305
  ...e
306
306
  })
307
307
  });
308
- a.create({
308
+ i.create({
309
309
  name: "floatingMenu",
310
310
  addOptions() {
311
311
  return {
@@ -335,11 +335,11 @@ a.create({
335
335
  }
336
336
  });
337
337
  //#endregion
338
- //#region node_modules/.pnpm/@tiptap+react@3.30.1_@floating-ui+dom@1.8.0_@tiptap+core@3.30.1_@tiptap+pm@3.30.1__@tip_11778a9e3ce7f1a067932c0c4f0a2645/node_modules/@tiptap/react/dist/menus/index.js
338
+ //#region node_modules/.pnpm/@tiptap+react@3.30.2_@floating-ui+dom@1.8.0_@tiptap+core@3.30.2_@tiptap+pm@3.30.2__@tip_864597464ea99af6963241e56e6f20f3/node_modules/@tiptap/react/dist/menus/index.js
339
339
  function A(e, t) {
340
- return e ?? new C(t);
340
+ return e ?? new _(t);
341
341
  }
342
- var j = typeof window < "u" ? _ : g, M = /* @__PURE__ */ new Set([
342
+ var j = typeof window < "u" ? x : b, M = /* @__PURE__ */ new Set([
343
343
  "left",
344
344
  "opacity",
345
345
  "position",
@@ -507,7 +507,7 @@ function Q(e, t, n) {
507
507
  }), r;
508
508
  }
509
509
  function $(e, t) {
510
- let n = v({}), r = v([]);
510
+ let n = S({}), r = S([]);
511
511
  j(() => {
512
512
  let i = n.current;
513
513
  return X(e, i.className, t.className), Z(e, i.style, t.style), Y(e, i, t), r.current = Q(e, r.current, t), n.current = t, () => {
@@ -517,117 +517,117 @@ function $(e, t) {
517
517
  };
518
518
  }, [e, t]);
519
519
  }
520
- var te = h.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i, appendTo: a, shouldShow: o = null, getReferencedVirtualElement: s, options: c, children: l, ...u }, d) => {
521
- let f = v(document.createElement("div")), p = v(A(t, "bubbleMenu")).current;
522
- $(f.current, u), typeof d == "function" ? d(f.current) : d && (d.current = f.current);
523
- let { editor: m } = e(), h = n || m, _ = {
524
- updateDelay: r,
525
- resizeDelay: i,
526
- appendTo: a,
527
- pluginKey: p,
528
- shouldShow: o,
529
- getReferencedVirtualElement: s,
530
- options: c
531
- }, x = v(_);
532
- x.current = _;
533
- let [S, C] = y(!1), w = v(!0);
534
- return g(() => {
520
+ var te = y.forwardRef(({ pluginKey: e, editor: t, updateDelay: n, resizeDelay: r, appendTo: i, shouldShow: a = null, getReferencedVirtualElement: o, options: s, children: c, ...l }, u) => {
521
+ let d = S(document.createElement("div")), f = S(A(e, "bubbleMenu")).current;
522
+ $(d.current, l), typeof u == "function" ? u(d.current) : u && (u.current = d.current);
523
+ let { editor: p } = m(), h = t || p, g = {
524
+ updateDelay: n,
525
+ resizeDelay: r,
526
+ appendTo: i,
527
+ pluginKey: f,
528
+ shouldShow: a,
529
+ getReferencedVirtualElement: o,
530
+ options: s
531
+ }, _ = S(g);
532
+ _.current = g;
533
+ let [v, y] = C(!1), x = S(!0);
534
+ return b(() => {
535
535
  if (h?.isDestroyed) return;
536
536
  if (!h) {
537
537
  console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
538
538
  return;
539
539
  }
540
- let e = f.current;
540
+ let e = d.current;
541
541
  e.style.visibility = "hidden", e.style.position = "absolute";
542
542
  let t = D({
543
- ...x.current,
543
+ ..._.current,
544
544
  editor: h,
545
545
  element: e
546
546
  });
547
547
  h.registerPlugin(t);
548
- let n = x.current.pluginKey;
549
- return w.current = !0, C(!0), () => {
550
- C(!1), h.unregisterPlugin(n), window.requestAnimationFrame(() => {
548
+ let n = _.current.pluginKey;
549
+ return x.current = !0, y(!0), () => {
550
+ y(!1), h.unregisterPlugin(n), window.requestAnimationFrame(() => {
551
551
  e.parentNode && e.parentNode.removeChild(e);
552
552
  });
553
553
  };
554
- }, [h]), g(() => {
555
- if (!(!S || !h || h.isDestroyed)) {
556
- if (w.current) {
557
- w.current = !1;
554
+ }, [h]), b(() => {
555
+ if (!(!v || !h || h.isDestroyed)) {
556
+ if (x.current) {
557
+ x.current = !1;
558
558
  return;
559
559
  }
560
- h.view.dispatch(h.state.tr.setMeta(p, {
560
+ h.view.dispatch(h.state.tr.setMeta(f, {
561
561
  type: "updateOptions",
562
- options: x.current
562
+ options: _.current
563
563
  }));
564
564
  }
565
565
  }, [
566
- S,
566
+ v,
567
567
  h,
568
+ n,
568
569
  r,
569
- i,
570
- o,
571
- c,
572
570
  a,
573
571
  s,
574
- p
575
- ]), b(l, f.current);
572
+ i,
573
+ o,
574
+ f
575
+ ]), w(c, d.current);
576
576
  });
577
- h.forwardRef(({ pluginKey: t, editor: n, updateDelay: r, resizeDelay: i, appendTo: a, shouldShow: o = null, options: s, children: c, ...l }, u) => {
578
- let d = v(document.createElement("div")), f = v(A(t, "floatingMenu")).current;
579
- $(d.current, l), typeof u == "function" ? u(d.current) : u && (u.current = d.current);
580
- let { editor: p } = e(), m = n || p, h = {
581
- updateDelay: r,
582
- resizeDelay: i,
583
- appendTo: a,
584
- pluginKey: f,
585
- shouldShow: o,
586
- options: s
587
- }, _ = v(h);
588
- _.current = h;
589
- let [x, S] = y(!1), C = v(!0);
590
- return g(() => {
591
- if (m?.isDestroyed) return;
592
- if (!m) {
577
+ y.forwardRef(({ pluginKey: e, editor: t, updateDelay: n, resizeDelay: r, appendTo: i, shouldShow: a = null, options: o, children: s, ...c }, l) => {
578
+ let u = S(document.createElement("div")), d = S(A(e, "floatingMenu")).current;
579
+ $(u.current, c), typeof l == "function" ? l(u.current) : l && (l.current = u.current);
580
+ let { editor: f } = m(), p = t || f, h = {
581
+ updateDelay: n,
582
+ resizeDelay: r,
583
+ appendTo: i,
584
+ pluginKey: d,
585
+ shouldShow: a,
586
+ options: o
587
+ }, g = S(h);
588
+ g.current = h;
589
+ let [_, v] = C(!1), y = S(!0);
590
+ return b(() => {
591
+ if (p?.isDestroyed) return;
592
+ if (!p) {
593
593
  console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");
594
594
  return;
595
595
  }
596
- let e = d.current;
596
+ let e = u.current;
597
597
  e.style.visibility = "hidden", e.style.position = "absolute";
598
598
  let t = k({
599
- ..._.current,
600
- editor: m,
599
+ ...g.current,
600
+ editor: p,
601
601
  element: e
602
602
  });
603
- m.registerPlugin(t);
604
- let n = _.current.pluginKey;
605
- return C.current = !0, S(!0), () => {
606
- S(!1), m.unregisterPlugin(n), window.requestAnimationFrame(() => {
603
+ p.registerPlugin(t);
604
+ let n = g.current.pluginKey;
605
+ return y.current = !0, v(!0), () => {
606
+ v(!1), p.unregisterPlugin(n), window.requestAnimationFrame(() => {
607
607
  e.parentNode && e.parentNode.removeChild(e);
608
608
  });
609
609
  };
610
- }, [m]), g(() => {
611
- if (!(!x || !m || m.isDestroyed)) {
612
- if (C.current) {
613
- C.current = !1;
610
+ }, [p]), b(() => {
611
+ if (!(!_ || !p || p.isDestroyed)) {
612
+ if (y.current) {
613
+ y.current = !1;
614
614
  return;
615
615
  }
616
- m.view.dispatch(m.state.tr.setMeta(f, {
616
+ p.view.dispatch(p.state.tr.setMeta(d, {
617
617
  type: "updateOptions",
618
- options: _.current
618
+ options: g.current
619
619
  }));
620
620
  }
621
621
  }, [
622
- x,
623
- m,
622
+ _,
623
+ p,
624
+ n,
624
625
  r,
625
- i,
626
- o,
627
- s,
628
626
  a,
629
- f
630
- ]), b(c, d.current);
627
+ o,
628
+ i,
629
+ d
630
+ ]), w(s, u.current);
631
631
  });
632
632
  //#endregion
633
633
  export { te as t };