@clevertask/scribe 0.0.12 → 0.0.14

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 (69) hide show
  1. package/README.md +80 -4
  2. package/dist/assets/index.css +1 -1
  3. package/dist/components/Menu/BarMenu.d.ts +3 -2
  4. package/dist/components/Menu/BarMenu.d.ts.map +1 -0
  5. package/dist/components/Menu/BarMenu.js +21 -21
  6. package/dist/components/Menu/BubbleMenu.d.ts +3 -2
  7. package/dist/components/Menu/BubbleMenu.d.ts.map +1 -0
  8. package/dist/components/Menu/BubbleMenu.js +1 -1
  9. package/dist/components/Menu/Mobile/ListOptionBar.d.ts +2 -1
  10. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -0
  11. package/dist/components/Menu/Mobile/ListOptionBar.js +35 -38
  12. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts +2 -1
  13. package/dist/components/Scribe/extension/emoji/EmojiList.d.ts.map +1 -0
  14. package/dist/components/Scribe/extension/emoji/suggest.d.ts +1 -0
  15. package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -0
  16. package/dist/components/Scribe/extension/emoji/suggest.js +5 -6
  17. package/dist/components/Scribe/extension/extension-link.d.ts +2 -1
  18. package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -0
  19. package/dist/components/Scribe/extension/extension-link.js +2 -2
  20. package/dist/components/Scribe/extension/extension-selectedText.d.ts +2 -1
  21. package/dist/components/Scribe/extension/extension-selectedText.d.ts.map +1 -0
  22. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  23. package/dist/components/Scribe/extension/index.d.ts +3 -2
  24. package/dist/components/Scribe/extension/index.d.ts.map +1 -0
  25. package/dist/components/Scribe/extension/index.js +2 -2
  26. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts +3 -2
  27. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.d.ts.map +1 -0
  28. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +4 -4
  29. package/dist/components/Scribe/extension/slashCommand/index.d.ts +3 -2
  30. package/dist/components/Scribe/extension/slashCommand/index.d.ts.map +1 -0
  31. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  32. package/dist/components/Scribe/extension/slashCommand/items.d.ts +3 -2
  33. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -0
  34. package/dist/components/Scribe/extension/slashCommand/items.js +6 -7
  35. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts +2 -1
  36. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -0
  37. package/dist/components/Scribe/extension/slashCommand/renderItems.js +10 -11
  38. package/dist/components/Scribe/index.d.ts +6 -4
  39. package/dist/components/Scribe/index.d.ts.map +1 -0
  40. package/dist/components/Scribe/index.js +78 -79
  41. package/dist/index-BfaHEr44.js +159 -0
  42. package/dist/{index-VneQGVTd.js → index-Bvgjhwaj.js} +11 -47
  43. package/dist/{index-CCS9HOYd.js → index-DAuPG8ME.js} +5313 -5425
  44. package/dist/{index-DoNRu1rY.js → index-flsxByQS.js} +17 -17
  45. package/dist/main.d.ts +4 -3
  46. package/dist/main.d.ts.map +1 -0
  47. package/dist/main.js +8 -6
  48. package/dist/marked.esm-H7n4rMcO.js +1554 -0
  49. package/dist/{purify.es-BGaRrCfO.js → purify.es-BRDuGiV2.js} +114 -115
  50. package/dist/utils/convert-legacy-math-delimiters.d.ts +2 -0
  51. package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -0
  52. package/dist/utils/convert-legacy-math-delimiters.js +13 -0
  53. package/dist/utils/create-scribe-editor.d.ts +2 -1
  54. package/dist/utils/create-scribe-editor.d.ts.map +1 -0
  55. package/dist/utils/create-scribe-editor.js +3 -3
  56. package/dist/utils/html-to-markdown.d.ts +1 -0
  57. package/dist/utils/html-to-markdown.d.ts.map +1 -0
  58. package/dist/utils/html-to-markdown.js +1 -1
  59. package/dist/utils/index.d.ts +6 -4
  60. package/dist/utils/index.d.ts.map +1 -0
  61. package/dist/utils/index.js +8 -6
  62. package/dist/utils/is-in-viewport.d.ts +1 -0
  63. package/dist/utils/is-in-viewport.d.ts.map +1 -0
  64. package/dist/utils/markdown-to-html.d.ts +1 -0
  65. package/dist/utils/markdown-to-html.d.ts.map +1 -0
  66. package/dist/utils/markdown-to-html.js +2 -2
  67. package/package.json +46 -46
  68. package/dist/index-B0pieAxt.js +0 -160
  69. package/dist/marked.esm-BS_MmRZC.js +0 -1566
@@ -1,111 +1,110 @@
1
- import { jsx as s, jsxs as O } from "react/jsx-runtime";
2
- import R from "../Menu/BarMenu.js";
3
- import { c as f } from "../../clsx-OuTLNxxd.js";
4
- import { html2md as g } from "../../utils/html-to-markdown.js";
5
- import "../../marked.esm-BS_MmRZC.js";
6
- import "../../purify.es-BGaRrCfO.js";
7
- import { E as T } from "../../index-DoNRu1rY.js";
8
- import { initExtensions as z } from "./extension/index.js";
9
- import { E as J } from "../../index-VneQGVTd.js";
10
- import { forwardRef as P, useRef as D, useCallback as a, useImperativeHandle as F, useEffect as c } from "react";
1
+ import { jsx as n, jsxs as P } from "react/jsx-runtime";
2
+ import O from "../Menu/BarMenu.js";
3
+ import { c as l } from "../../clsx-OuTLNxxd.js";
4
+ import { html2md as b } from "../../utils/html-to-markdown.js";
5
+ import "../../marked.esm-H7n4rMcO.js";
6
+ import "../../purify.es-BRDuGiV2.js";
7
+ import { E as R } from "../../index-flsxByQS.js";
8
+ import { initExtensions as T } from "./extension/index.js";
9
+ import { E as z } from "../../index-Bvgjhwaj.js";
10
+ import { forwardRef as J, useRef as D, useCallback as s, useImperativeHandle as F, useEffect as i } from "react";
11
11
  import { ListOptionBar as I } from "../Menu/Mobile/ListOptionBar.js";
12
- import '../../assets/index.css';const _ = P((C, x) => {
12
+ import '../../assets/index.css';const _ = J((p, g) => {
13
13
  const {
14
- autoFocus: d = !1,
15
- content: E,
16
- editable: e = !0,
17
- editorProps: r,
18
- extensions: h,
19
- onContentChange: i,
20
- showBarMenu: w = !0,
21
- editorContentStyle: y,
22
- editorContentClassName: M,
23
- mainContainerStyle: N,
24
- mainContainerClassName: j,
25
- onKeyDown: k,
26
- externalEditor: v,
27
- darkMode: l,
28
- mobile: S
29
- } = C, p = D(v || null), u = a(
30
- ({ editor: n }) => {
31
- const o = n.getHTML(), m = n.getJSON(), L = !e;
32
- i && i({
33
- jsonContent: n.isEmpty ? "" : m,
34
- htmlContent: n.isEmpty ? "" : o,
35
- markdownContent: n.isEmpty ? "" : g(o),
14
+ autoFocus: u = !1,
15
+ content: f,
16
+ editable: o = !0,
17
+ editorProps: C,
18
+ extensions: x,
19
+ onContentChange: m,
20
+ showBarMenu: h = !0,
21
+ editorContentStyle: w,
22
+ editorContentClassName: y,
23
+ mainContainerStyle: M,
24
+ mainContainerClassName: N,
25
+ onKeyDown: j,
26
+ externalEditor: k,
27
+ darkMode: a,
28
+ mobile: v
29
+ } = p, c = D(k || null), d = s(
30
+ ({ editor: e }) => {
31
+ const r = e.getHTML(), H = e.getJSON(), L = !o;
32
+ m && m({
33
+ jsonContent: e.isEmpty ? "" : H,
34
+ htmlContent: e.isEmpty ? "" : r,
35
+ markdownContent: e.isEmpty ? "" : b(r),
36
36
  source: L ? "programmatic" : "user"
37
37
  });
38
38
  },
39
- [e, i]
39
+ [o, m]
40
40
  );
41
- p.current || (p.current = new T({
42
- ...r,
43
- editable: e,
44
- extensions: [...z(C), ...h ?? []],
41
+ c.current || (c.current = new R({
42
+ ...C,
43
+ editable: o,
44
+ extensions: [...T(p), ...x ?? []],
45
45
  editorProps: {
46
46
  attributes: {
47
47
  class: "scribe"
48
48
  },
49
- ...r == null ? void 0 : r.editorProps
49
+ ...C?.editorProps
50
50
  }
51
51
  }));
52
- const t = p.current, b = a(() => {
53
- t == null || t.commands.setContent("");
54
- }, []), B = a(
55
- (n) => {
56
- var m;
57
- const o = {
58
- html: () => t == null ? void 0 : t.getHTML(),
59
- json: () => t == null ? void 0 : t.getJSON(),
60
- markdown: () => g((t == null ? void 0 : t.getHTML()) || "")
52
+ const t = c.current, E = s(() => {
53
+ t?.commands.setContent("");
54
+ }, []), S = s(
55
+ (e) => {
56
+ const r = {
57
+ html: () => t?.getHTML(),
58
+ json: () => t?.getJSON(),
59
+ markdown: () => b(t?.getHTML() || "")
61
60
  };
62
- return t != null && t.isEmpty ? "" : (m = o[n]) == null ? void 0 : m.call(o);
61
+ return t?.isEmpty ? "" : r[e]?.();
63
62
  },
64
63
  []
65
- ), H = a((n) => {
66
- t == null || t.commands.setContent(n);
64
+ ), B = s((e) => {
65
+ t?.commands.setContent(e);
67
66
  }, []);
68
- return F(x, () => ({
69
- resetContent: b,
70
- setContent: H,
71
- getContent: B,
67
+ return F(g, () => ({
68
+ resetContent: E,
69
+ setContent: B,
70
+ getContent: S,
72
71
  editor: t
73
- }), [b]), c(() => {
74
- t == null || t.commands.setContent(E || "");
75
- }, [E]), c(() => {
76
- t == null || t.setEditable(!!e);
77
- }, [e]), c(() => (t.off("update"), t.on("update", u), () => {
78
- t.off("update", u);
79
- }), [u]), c(() => {
80
- d && (t == null || t.commands.focus("end"));
81
- }, [d]), /* @__PURE__ */ s(
72
+ }), [E]), i(() => {
73
+ t?.commands.setContent(f || "");
74
+ }, [f]), i(() => {
75
+ t?.setEditable(!!o);
76
+ }, [o]), i(() => (t.off("update"), t.on("update", d), () => {
77
+ t.off("update", d);
78
+ }), [d]), i(() => {
79
+ u && t?.commands.focus("end");
80
+ }, [u]), /* @__PURE__ */ n(
82
81
  "div",
83
82
  {
84
- className: f("scribe-wrapper", j),
85
- style: N,
86
- children: /* @__PURE__ */ O(
83
+ className: l("scribe-wrapper", N),
84
+ style: M,
85
+ children: /* @__PURE__ */ P(
87
86
  "div",
88
87
  {
89
- className: f(
90
- e && "rounded-lg border",
91
- l ? "border-zinc-700" : "border-zinc-200"
88
+ className: l(
89
+ o && "rounded-lg border",
90
+ a ? "border-zinc-700" : "border-zinc-200"
92
91
  ),
93
92
  children: [
94
- t && w && /* @__PURE__ */ s(R, { editor: t, darkMode: !!l }),
95
- /* @__PURE__ */ s(
93
+ t && h && /* @__PURE__ */ n(O, { editor: t, darkMode: !!a }),
94
+ /* @__PURE__ */ n(
96
95
  "div",
97
96
  {
98
- className: f(
97
+ className: l(
99
98
  "prose max-w-none",
100
- e && "w-full p-[16px]",
101
- l && "prose-invert",
102
- M
99
+ o && "w-full p-[16px]",
100
+ a && "prose-invert",
101
+ y
103
102
  ),
104
- style: y,
105
- children: /* @__PURE__ */ s(J, { editor: t, onKeyDown: k })
103
+ style: w,
104
+ children: /* @__PURE__ */ n(z, { editor: t, onKeyDown: j })
106
105
  }
107
106
  ),
108
- S && /* @__PURE__ */ s(I, { editor: t })
107
+ v && /* @__PURE__ */ n(I, { editor: t })
109
108
  ]
110
109
  }
111
110
  )
@@ -0,0 +1,159 @@
1
+ import { P as L, b as U, D as z, c as G, e as H, a as J } from "./index-flsxByQS.js";
2
+ function Q(y) {
3
+ var i;
4
+ const { char: f, allowSpaces: D, allowToIncludeChar: I, allowedPrefixes: v, startOfLine: K, $position: g } = y, P = D && !I, m = H(f), B = new RegExp(`\\s${m}$`), C = K ? "^" : "", M = I ? "" : m, S = P ? new RegExp(`${C}${m}.*?(?=\\s${M}|$)`, "gm") : new RegExp(`${C}(?:^)?${m}[^\\s${M}]*`, "gm"), p = ((i = g.nodeBefore) === null || i === void 0 ? void 0 : i.isText) && g.nodeBefore.text;
5
+ if (!p)
6
+ return null;
7
+ const k = g.pos - p.length, n = Array.from(p.matchAll(S)).pop();
8
+ if (!n || n.input === void 0 || n.index === void 0)
9
+ return null;
10
+ const e = n.input.slice(Math.max(0, n.index - 1), n.index), $ = new RegExp(`^[${v?.join("")}\0]?$`).test(e);
11
+ if (v !== null && !$)
12
+ return null;
13
+ const o = k + n.index;
14
+ let a = o + n[0].length;
15
+ return P && B.test(p.slice(a - 1, a + 1)) && (n[0] += " ", a += 1), o < g.pos && a >= g.pos ? {
16
+ range: {
17
+ from: o,
18
+ to: a
19
+ },
20
+ query: n[0].slice(f.length),
21
+ text: n[0]
22
+ } : null;
23
+ }
24
+ const V = new L("suggestion");
25
+ function W({ pluginKey: y = V, editor: i, char: f = "@", allowSpaces: D = !1, allowToIncludeChar: I = !1, allowedPrefixes: v = [" "], startOfLine: K = !1, decorationTag: g = "span", decorationClass: P = "suggestion", decorationContent: m = "", decorationEmptyClass: B = "is-empty", command: C = () => null, items: M = () => [], render: S = () => ({}), allow: p = () => !0, findSuggestionMatch: k = Q }) {
26
+ let n;
27
+ const e = S?.(), $ = new U({
28
+ key: y,
29
+ view() {
30
+ return {
31
+ update: async (o, a) => {
32
+ var l, c, r, u, d, w, h;
33
+ const t = (l = this.key) === null || l === void 0 ? void 0 : l.getState(a), s = (c = this.key) === null || c === void 0 ? void 0 : c.getState(o.state), q = t.active && s.active && t.range.from !== s.range.from, b = !t.active && s.active, j = t.active && !s.active, A = !b && !j && t.query !== s.query, _ = b || q && A, R = A || q, N = j || q && A;
34
+ if (!_ && !R && !N)
35
+ return;
36
+ const x = N && !_ ? t : s, F = o.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`);
37
+ n = {
38
+ editor: i,
39
+ range: x.range,
40
+ query: x.query,
41
+ text: x.text,
42
+ items: [],
43
+ command: (E) => C({
44
+ editor: i,
45
+ range: x.range,
46
+ props: E
47
+ }),
48
+ decorationNode: F,
49
+ // virtual node for popper.js or tippy.js
50
+ // this can be used for building popups without a DOM node
51
+ clientRect: F ? () => {
52
+ var E;
53
+ const { decorationId: T } = (E = this.key) === null || E === void 0 ? void 0 : E.getState(i.state), O = o.dom.querySelector(`[data-decoration-id="${T}"]`);
54
+ return O?.getBoundingClientRect() || null;
55
+ } : null
56
+ }, _ && ((r = e?.onBeforeStart) === null || r === void 0 || r.call(e, n)), R && ((u = e?.onBeforeUpdate) === null || u === void 0 || u.call(e, n)), (R || _) && (n.items = await M({
57
+ editor: i,
58
+ query: x.query
59
+ })), N && ((d = e?.onExit) === null || d === void 0 || d.call(e, n)), R && ((w = e?.onUpdate) === null || w === void 0 || w.call(e, n)), _ && ((h = e?.onStart) === null || h === void 0 || h.call(e, n));
60
+ },
61
+ destroy: () => {
62
+ var o;
63
+ n && ((o = e?.onExit) === null || o === void 0 || o.call(e, n));
64
+ }
65
+ };
66
+ },
67
+ state: {
68
+ // Initialize the plugin's internal state.
69
+ init() {
70
+ return {
71
+ active: !1,
72
+ range: {
73
+ from: 0,
74
+ to: 0
75
+ },
76
+ query: null,
77
+ text: null,
78
+ composing: !1
79
+ };
80
+ },
81
+ // Apply changes to the plugin state from a view transaction.
82
+ apply(o, a, l, c) {
83
+ const { isEditable: r } = i, { composing: u } = i.view, { selection: d } = o, { empty: w, from: h } = d, t = { ...a };
84
+ if (t.composing = u, r && (w || i.view.composing)) {
85
+ (h < a.range.from || h > a.range.to) && !u && !a.composing && (t.active = !1);
86
+ const s = k({
87
+ char: f,
88
+ allowSpaces: D,
89
+ allowToIncludeChar: I,
90
+ allowedPrefixes: v,
91
+ startOfLine: K,
92
+ $position: d.$from
93
+ }), q = `id_${Math.floor(Math.random() * 4294967295)}`;
94
+ s && p({
95
+ editor: i,
96
+ state: c,
97
+ range: s.range,
98
+ isActive: a.active
99
+ }) ? (t.active = !0, t.decorationId = a.decorationId ? a.decorationId : q, t.range = s.range, t.query = s.query, t.text = s.text) : t.active = !1;
100
+ } else
101
+ t.active = !1;
102
+ return t.active || (t.decorationId = null, t.range = { from: 0, to: 0 }, t.query = null, t.text = null), t;
103
+ }
104
+ },
105
+ props: {
106
+ // Call the keydown hook if suggestion is active.
107
+ handleKeyDown(o, a) {
108
+ var l;
109
+ const { active: c, range: r } = $.getState(o.state);
110
+ return c && ((l = e?.onKeyDown) === null || l === void 0 ? void 0 : l.call(e, { view: o, event: a, range: r })) || !1;
111
+ },
112
+ // Setup decorator on the currently active suggestion.
113
+ decorations(o) {
114
+ const { active: a, range: l, decorationId: c, query: r } = $.getState(o);
115
+ if (!a)
116
+ return null;
117
+ const u = !r?.length, d = [P];
118
+ return u && d.push(B), z.create(o.doc, [
119
+ G.inline(l.from, l.to, {
120
+ nodeName: g,
121
+ class: d.join(" "),
122
+ "data-decoration-id": c,
123
+ "data-decoration-content": m
124
+ })
125
+ ]);
126
+ }
127
+ }
128
+ });
129
+ return $;
130
+ }
131
+ const X = new L("slashSuggestion"), Z = J.create({
132
+ name: "slashCommand",
133
+ addOptions() {
134
+ return {
135
+ ...this.parent?.(),
136
+ slashSuggestion: {
137
+ char: "/",
138
+ startOfLine: !0,
139
+ command: ({ editor: y, range: i, props: f }) => {
140
+ f.command({ editor: y, range: i, props: f });
141
+ }
142
+ }
143
+ };
144
+ },
145
+ addProseMirrorPlugins() {
146
+ return [
147
+ W({
148
+ pluginKey: X,
149
+ ...this.options.slashSuggestion,
150
+ editor: this.editor
151
+ })
152
+ ];
153
+ }
154
+ });
155
+ export {
156
+ Z as S,
157
+ W as a,
158
+ X as s
159
+ };
@@ -1,4 +1,4 @@
1
- import { b as Wr, P as kr, H as Fr, A as Ur, J as qr, a as zr } from "./index-DoNRu1rY.js";
1
+ import { b as Wr, P as kr, H as Fr, A as Ur, J as qr, a as zr } from "./index-flsxByQS.js";
2
2
  import B, { forwardRef as Kr, useState as ur, useDebugValue as Gr, version as Pt, useLayoutEffect as Yr, useEffect as cr, useContext as fr, createContext as lr } from "react";
3
3
  import Xr, { flushSync as Jr } from "react-dom";
4
4
  var k = "top", G = "bottom", Y = "right", F = "left", Dt = "auto", Fe = [k, G, Y, F], De = "start", Ie = "end", Qr = "clippingParents", pr = "viewport", je = "popper", Zr = "reference", Bt = /* @__PURE__ */ Fe.reduce(function(e, t) {
@@ -692,11 +692,11 @@ function qn(e) {
692
692
  var V, H = i === "y" ? k : F, $ = i === "y" ? G : Y, j = i === "y" ? "height" : "width", P = p[i], I = P + w[H], J = P - w[$], Q = h ? -_[j] / 2 : 0, pe = D === De ? x[j] : _[j], Z = D === De ? -_[j] : -x[j], de = t.elements.arrow, ne = h && de ? Ct(de) : {
693
693
  width: 0,
694
694
  height: 0
695
- }, X = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : yr(), ie = X[H], be = X[$], oe = Pe(0, x[j], ne[j]), we = O ? x[j] / 2 - Q - oe - ie - R.mainAxis : pe - oe - ie - R.mainAxis, ce = O ? -x[j] / 2 + Q + oe + be + R.mainAxis : Z + oe + be + R.mainAxis, Oe = t.elements.arrow && Ue(t.elements.arrow), ze = Oe ? i === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Le = (V = N == null ? void 0 : N[i]) != null ? V : 0, Ke = P + we - Le - ze, Ge = P + ce - Le, Re = Pe(h ? at(I, Ke) : I, P, h ? ye(J, Ge) : J);
695
+ }, X = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : yr(), ie = X[H], be = X[$], oe = Pe(0, x[j], ne[j]), we = O ? x[j] / 2 - Q - oe - ie - R.mainAxis : pe - oe - ie - R.mainAxis, ce = O ? -x[j] / 2 + Q + oe + be + R.mainAxis : Z + oe + be + R.mainAxis, Oe = t.elements.arrow && Ue(t.elements.arrow), ze = Oe ? i === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Le = (V = N?.[i]) != null ? V : 0, Ke = P + we - Le - ze, Ge = P + ce - Le, Re = Pe(h ? at(I, Ke) : I, P, h ? ye(J, Ge) : J);
696
696
  p[i] = Re, M[i] = Re - P;
697
697
  }
698
698
  if (u) {
699
- var Me, Ye = i === "x" ? k : F, Xe = i === "x" ? G : Y, ae = p[E], fe = E === "y" ? "height" : "width", Ve = ae + w[Ye], ve = ae - w[Xe], Ne = [k, F].indexOf(T) !== -1, Je = (Me = N == null ? void 0 : N[E]) != null ? Me : 0, Qe = Ne ? Ve : ae - x[fe] - _[fe] - Je + R.altAxis, Ze = Ne ? ae + x[fe] + _[fe] - Je - R.altAxis : ve, et = h && Ne ? hn(Qe, ae, Ze) : Pe(h ? Qe : Ve, ae, h ? Ze : ve);
699
+ var Me, Ye = i === "x" ? k : F, Xe = i === "x" ? G : Y, ae = p[E], fe = E === "y" ? "height" : "width", Ve = ae + w[Ye], ve = ae - w[Xe], Ne = [k, F].indexOf(T) !== -1, Je = (Me = N?.[E]) != null ? Me : 0, Qe = Ne ? Ve : ae - x[fe] - _[fe] - Je + R.altAxis, Ze = Ne ? ae + x[fe] + _[fe] - Je - R.altAxis : ve, et = h && Ne ? hn(Qe, ae, Ze) : Pe(h ? Qe : Ve, ae, h ? Ze : ve);
700
700
  p[E] = et, M[E] = et - ae;
701
701
  }
702
702
  t.modifiersData[n] = M;
@@ -1547,7 +1547,7 @@ function Ri(e, t) {
1547
1547
  element: z,
1548
1548
  padding: 3
1549
1549
  }
1550
- }), he.push.apply(he, (g == null ? void 0 : g.modifiers) || []), i.popperInstance = ni(Ee, p, Object.assign({}, g, {
1550
+ }), he.push.apply(he, g?.modifiers || []), i.popperInstance = ni(Ee, p, Object.assign({}, g, {
1551
1551
  placement: S,
1552
1552
  onFirstUpdate: y,
1553
1553
  modifiers: he
@@ -1726,11 +1726,11 @@ class Mi {
1726
1726
  this.preventHide = !1;
1727
1727
  return;
1728
1728
  }
1729
- u != null && u.relatedTarget && (!((s = this.element.parentNode) === null || s === void 0) && s.contains(u.relatedTarget)) || (u == null ? void 0 : u.relatedTarget) !== this.editor.view.dom && this.hide();
1729
+ u?.relatedTarget && (!((s = this.element.parentNode) === null || s === void 0) && s.contains(u.relatedTarget)) || u?.relatedTarget !== this.editor.view.dom && this.hide();
1730
1730
  }, this.tippyBlurHandler = (u) => {
1731
1731
  this.blurHandler({ event: u });
1732
1732
  }, this.handleDebouncedUpdate = (u, s) => {
1733
- const d = !(s != null && s.selection.eq(u.state.selection)), l = !(s != null && s.doc.eq(u.state.doc));
1733
+ const d = !s?.selection.eq(u.state.selection), l = !s?.doc.eq(u.state.doc);
1734
1734
  !d && !l || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
1735
1735
  this.updateHandler(u, d, l, s);
1736
1736
  }, this.updateDelay));
@@ -1787,7 +1787,7 @@ class Mi {
1787
1787
  this.handleDebouncedUpdate(t, r);
1788
1788
  return;
1789
1789
  }
1790
- const a = !(r != null && r.selection.eq(t.state.selection)), c = !(r != null && r.doc.eq(t.state.doc));
1790
+ const a = !r?.selection.eq(t.state.selection), c = !r?.doc.eq(t.state.doc);
1791
1791
  this.updateHandler(t, a, c, r);
1792
1792
  }
1793
1793
  show() {
@@ -1835,15 +1835,6 @@ function Vi(e) {
1835
1835
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1836
1836
  }
1837
1837
  var xt = { exports: {} }, ht = {};
1838
- /**
1839
- * @license React
1840
- * use-sync-external-store-shim.production.min.js
1841
- *
1842
- * Copyright (c) Facebook, Inc. and its affiliates.
1843
- *
1844
- * This source code is licensed under the MIT license found in the
1845
- * LICENSE file in the root directory of this source tree.
1846
- */
1847
1838
  var rr;
1848
1839
  function Ni() {
1849
1840
  if (rr) return ht;
@@ -1880,15 +1871,6 @@ function Ni() {
1880
1871
  return ht.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : l, ht;
1881
1872
  }
1882
1873
  var mt = {};
1883
- /**
1884
- * @license React
1885
- * use-sync-external-store-shim.development.js
1886
- *
1887
- * Copyright (c) Facebook, Inc. and its affiliates.
1888
- *
1889
- * This source code is licensed under the MIT license found in the
1890
- * LICENSE file in the root directory of this source tree.
1891
- */
1892
1874
  var nr;
1893
1875
  function ji() {
1894
1876
  return nr || (nr = 1, process.env.NODE_ENV !== "production" && (function() {
@@ -2051,7 +2033,7 @@ class Ii extends B.Component {
2051
2033
  B.Fragment,
2052
2034
  null,
2053
2035
  B.createElement("div", { ref: Pi(r, this.editorContentRef), ...n }),
2054
- (t == null ? void 0 : t.contentComponent) && B.createElement(Bi, { contentComponent: t.contentComponent })
2036
+ t?.contentComponent && B.createElement(Bi, { contentComponent: t.contentComponent })
2055
2037
  );
2056
2038
  }
2057
2039
  }
@@ -2109,15 +2091,6 @@ var Wi = function e(t, r) {
2109
2091
  }
2110
2092
  return t !== t && r !== r;
2111
2093
  }, ki = /* @__PURE__ */ Vi(Wi), Tt = { exports: {} }, yt = {};
2112
- /**
2113
- * @license React
2114
- * use-sync-external-store-shim/with-selector.production.min.js
2115
- *
2116
- * Copyright (c) Facebook, Inc. and its affiliates.
2117
- *
2118
- * This source code is licensed under the MIT license found in the
2119
- * LICENSE file in the root directory of this source tree.
2120
- */
2121
2094
  var ir;
2122
2095
  function Fi() {
2123
2096
  if (ir) return yt;
@@ -2160,15 +2133,6 @@ function Fi() {
2160
2133
  }, yt;
2161
2134
  }
2162
2135
  var gt = {};
2163
- /**
2164
- * @license React
2165
- * use-sync-external-store-shim/with-selector.development.js
2166
- *
2167
- * Copyright (c) Facebook, Inc. and its affiliates.
2168
- *
2169
- * This source code is licensed under the MIT license found in the
2170
- * LICENSE file in the root directory of this source tree.
2171
- */
2172
2136
  var or;
2173
2137
  function Ui() {
2174
2138
  return or || (or = 1, process.env.NODE_ENV !== "production" && (function() {
@@ -2270,7 +2234,7 @@ const Gi = () => fr(Nr), oo = (e) => {
2270
2234
  const [t, r] = ur(null), { editor: n } = Gi();
2271
2235
  return cr(() => {
2272
2236
  var o;
2273
- if (!t || !((o = e.editor) === null || o === void 0) && o.isDestroyed || n != null && n.isDestroyed)
2237
+ if (!t || !((o = e.editor) === null || o === void 0) && o.isDestroyed || n?.isDestroyed)
2274
2238
  return;
2275
2239
  const { pluginKey: a = "bubbleMenu", editor: c, tippyOptions: u = {}, updateDelay: s, shouldShow: d = null } = e, l = c || n;
2276
2240
  if (!l) {
@@ -2348,7 +2312,7 @@ class ao {
2348
2312
  const r = this.component, n = this.props, o = this.editor, a = Zi(), c = Qi(r), u = { ...n };
2349
2313
  u.ref && !(a || c) && delete u.ref, !u.ref && (a || c) && (u.ref = (s) => {
2350
2314
  this.ref = s;
2351
- }), this.reactElement = B.createElement(r, { ...u }), (t = o == null ? void 0 : o.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
2315
+ }), this.reactElement = B.createElement(r, { ...u }), (t = o?.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
2352
2316
  }
2353
2317
  /**
2354
2318
  * Re-renders the React component with new props.
@@ -2365,7 +2329,7 @@ class ao {
2365
2329
  destroy() {
2366
2330
  var t;
2367
2331
  const r = this.editor;
2368
- (t = r == null ? void 0 : r.contentComponent) === null || t === void 0 || t.removeRenderer(this.id);
2332
+ (t = r?.contentComponent) === null || t === void 0 || t.removeRenderer(this.id);
2369
2333
  }
2370
2334
  /**
2371
2335
  * Update the attributes of the element that holds the React component.