@blocknote/core 0.13.4 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/blocknote.js +526 -477
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +5 -5
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/webpack-stats.json +1 -1
  7. package/package.json +29 -29
  8. package/src/api/blockManipulation/__snapshots__/blockManipulation.test.ts.snap +98 -0
  9. package/src/api/blockManipulation/blockManipulation.test.ts +86 -7
  10. package/src/api/exporters/html/__snapshots__/customBlock/basic/external.html +1 -0
  11. package/src/api/exporters/html/__snapshots__/customBlock/basic/internal.html +1 -0
  12. package/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/external.html +1 -0
  13. package/src/api/exporters/html/__snapshots__/customParagraph/lineBreaks/internal.html +1 -0
  14. package/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/external.html +1 -0
  15. package/src/api/exporters/html/__snapshots__/paragraph/lineBreaks/internal.html +1 -0
  16. package/src/api/exporters/markdown/__snapshots__/customBlock/basic/markdown.md +5 -0
  17. package/src/api/exporters/markdown/__snapshots__/customParagraph/lineBreaks/markdown.md +1 -0
  18. package/src/api/exporters/markdown/__snapshots__/paragraph/lineBreaks/markdown.md +2 -0
  19. package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +566 -0
  20. package/src/api/nodeConversions/nodeConversions.test.ts +2 -0
  21. package/src/api/nodeConversions/nodeConversions.ts +2 -4
  22. package/src/api/parsers/html/__snapshots__/paste/parse-image-in-paragraph.json +16 -0
  23. package/src/api/parsers/html/parseHTML.test.ts +8 -0
  24. package/src/api/parsers/pasteExtension.ts +5 -0
  25. package/src/api/testUtil/cases/customBlocks.ts +9 -0
  26. package/src/api/testUtil/cases/defaultSchema.ts +9 -0
  27. package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +6 -6
  28. package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +7 -2
  29. package/src/blocks/TableBlockContent/TableBlockContent.ts +23 -1
  30. package/src/editor/Block.css +2 -3
  31. package/src/editor/BlockNoteEditor.ts +7 -6
  32. package/src/editor/BlockNoteExtensions.ts +10 -1
  33. package/src/editor/BlockNoteTipTapEditor.ts +1 -0
  34. package/src/extensions/FilePanel/FilePanelPlugin.ts +16 -12
  35. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +12 -15
  36. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +6 -2
  37. package/src/extensions/Placeholder/PlaceholderPlugin.ts +5 -1
  38. package/src/extensions/SideMenu/SideMenuPlugin.ts +157 -118
  39. package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +5 -2
  40. package/src/extensions/TableHandles/TableHandlesPlugin.ts +7 -4
  41. package/src/i18n/locales/pt.ts +1 -1
  42. package/src/i18n/locales/zh.ts +1 -1
  43. package/src/pm-nodes/BlockContainer.ts +11 -7
  44. package/src/schema/blocks/createSpec.ts +2 -2
  45. package/src/schema/inlineContent/createSpec.ts +2 -2
  46. package/types/src/editor/BlockNoteEditor.d.ts +1 -1
  47. package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +5 -5
  48. package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +0 -1
  49. package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +9 -8
  50. package/types/src/schema/blocks/createSpec.d.ts +2 -2
  51. package/types/src/schema/inlineContent/createSpec.d.ts +2 -2
package/dist/blocknote.js CHANGED
@@ -1,20 +1,20 @@
1
1
  var Et = Object.defineProperty;
2
2
  var Ct = (t, e, o) => e in t ? Et(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
3
  var c = (t, e, o) => (Ct(t, typeof e != "symbol" ? e + "" : e, o), o);
4
- import { Slice as U, Fragment as T, DOMSerializer as _e, DOMParser as St, Node as Mt } from "prosemirror-model";
5
- import Ke from "rehype-parse";
4
+ import { Slice as D, Fragment as T, DOMSerializer as ve, DOMParser as St, Node as Mt } from "prosemirror-model";
5
+ import $e from "rehype-parse";
6
6
  import qe from "rehype-stringify";
7
- import { unified as we } from "unified";
8
- import { Extension as B, combineTransactionSteps as Tt, getChangedRanges as Bt, findChildrenInRange as Lt, Node as W, Mark as xe, InputRule as Y, callOrReturn as It, getExtensionField as At, mergeAttributes as Nt, selectionToInsertionEnd as Pt, isTextSelection as Ht, isNodeSelection as Ut, posToDOMRect as ke, getMarkRange as Ne, findParentNode as Dt, findChildren as Pe, extensions as X, Editor as Ot, createDocument as Rt } from "@tiptap/core";
9
- import { Plugin as _, PluginKey as S, Selection as he, NodeSelection as oe, TextSelection as Z, EditorState as Vt } from "prosemirror-state";
7
+ import { unified as _e } from "unified";
8
+ import { Extension as B, combineTransactionSteps as Tt, getChangedRanges as Bt, findChildrenInRange as Lt, Node as $, Mark as xe, InputRule as ee, callOrReturn as It, getExtensionField as At, mergeAttributes as Nt, selectionToInsertionEnd as Pt, isTextSelection as Ht, isNodeSelection as Ut, posToDOMRect as ke, getMarkRange as Ne, findParentNode as Dt, findChildren as Pe, extensions as J, Editor as Ot, createDocument as Rt } from "@tiptap/core";
9
+ import { Plugin as v, PluginKey as S, Selection as he, NodeSelection as ne, TextSelection as Y, EditorState as Vt } from "prosemirror-state";
10
10
  import { v4 as jt } from "uuid";
11
11
  import { fromDom as ye } from "hast-util-from-dom";
12
12
  import zt from "@tiptap/extension-bold";
13
13
  import Ft from "@tiptap/extension-code";
14
14
  import Gt from "@tiptap/extension-italic";
15
15
  import Wt from "@tiptap/extension-strike";
16
- import $t from "@tiptap/extension-underline";
17
- import { TableCell as Kt } from "@tiptap/extension-table-cell";
16
+ import Kt from "@tiptap/extension-underline";
17
+ import { TableCell as $t } from "@tiptap/extension-table-cell";
18
18
  import { TableHeader as qt } from "@tiptap/extension-table-header";
19
19
  import { TableRow as Xt } from "@tiptap/extension-table-row";
20
20
  import { columnResizing as Zt, tableEditing as Jt } from "prosemirror-tables";
@@ -23,7 +23,7 @@ import Xe from "remark-gfm";
23
23
  import Qt from "remark-stringify";
24
24
  import eo from "remark-parse";
25
25
  import to, { defaultHandlers as oo } from "remark-rehype";
26
- import { DecorationSet as F, Decoration as G, EditorView as io } from "prosemirror-view";
26
+ import { DecorationSet as G, Decoration as W, EditorView as io } from "prosemirror-view";
27
27
  import no from "@tiptap/extension-collaboration";
28
28
  import ro from "@tiptap/extension-collaboration-cursor";
29
29
  import { Dropcursor as ao } from "@tiptap/extension-dropcursor";
@@ -2164,7 +2164,7 @@ const Ze = {
2164
2164
  "lista marcada",
2165
2165
  "caixa de seleção"
2166
2166
  ],
2167
- group: "Blocos básicos"
2167
+ group: "Blocos Básicos"
2168
2168
  },
2169
2169
  paragraph: {
2170
2170
  title: "Parágrafo",
@@ -2412,7 +2412,7 @@ const Ze = {
2412
2412
  generic: {
2413
2413
  ctrl_shortcut: "Ctrl"
2414
2414
  }
2415
- }, vo = {
2415
+ }, wo = {
2416
2416
  slash_menu: {
2417
2417
  heading: {
2418
2418
  title: "Tiêu đề H1",
@@ -2703,7 +2703,7 @@ const Ze = {
2703
2703
  generic: {
2704
2704
  ctrl_shortcut: "Ctrl"
2705
2705
  }
2706
- }, _o = {
2706
+ }, vo = {
2707
2707
  slash_menu: {
2708
2708
  heading: {
2709
2709
  title: "一级标题",
@@ -2764,7 +2764,7 @@ const Ze = {
2764
2764
  "勾选列表",
2765
2765
  "复选框"
2766
2766
  ],
2767
- group: "基本块"
2767
+ group: "基础"
2768
2768
  },
2769
2769
  paragraph: {
2770
2770
  title: "段落",
@@ -3037,10 +3037,10 @@ const Ze = {
3037
3037
  nl: bo,
3038
3038
  pl: ko,
3039
3039
  pt: yo,
3040
- vi: vo,
3041
- zh: _o
3040
+ vi: wo,
3041
+ zh: vo
3042
3042
  }, Symbol.toStringTag, { value: "Module" }));
3043
- function wo(t, e = JSON.stringify) {
3043
+ function _o(t, e = JSON.stringify) {
3044
3044
  const o = {};
3045
3045
  return t.filter((i) => {
3046
3046
  const n = e(i);
@@ -3051,9 +3051,9 @@ function xo(t) {
3051
3051
  const e = t.filter(
3052
3052
  (i, n) => t.indexOf(i) !== n
3053
3053
  );
3054
- return wo(e);
3054
+ return _o(e);
3055
3055
  }
3056
- const ee = B.create({
3056
+ const oe = B.create({
3057
3057
  name: "uniqueID",
3058
3058
  // we’ll set a very high priority to make sure this runs first
3059
3059
  // and is compatible with `appendTransaction` hooks of other extensions
@@ -3121,7 +3121,7 @@ const ee = B.create({
3121
3121
  addProseMirrorPlugins() {
3122
3122
  let t = null, e = !1;
3123
3123
  return [
3124
- new _({
3124
+ new v({
3125
3125
  key: new S("uniqueID"),
3126
3126
  appendTransaction: (o, i, n) => {
3127
3127
  const r = o.some((f) => f.docChanged) && !i.doc.eq(n.doc), a = this.options.filterTransaction && o.some((f) => {
@@ -3139,10 +3139,10 @@ const ee = B.create({
3139
3139
  n.doc,
3140
3140
  f,
3141
3141
  (M) => l.includes(M.type.name)
3142
- ), k = g.map(({ node: M }) => M.attrs[d]).filter((M) => M !== null), L = xo(k);
3143
- g.forEach(({ node: M, pos: q }) => {
3144
- let pe;
3145
- const Le = (pe = s.doc.nodeAt(q)) === null || pe === void 0 ? void 0 : pe.attrs[d];
3142
+ ), k = g.map(({ node: M }) => M.attrs[d]).filter((M) => M !== null), I = xo(k);
3143
+ g.forEach(({ node: M, pos: A }) => {
3144
+ let Z;
3145
+ const Le = (Z = s.doc.nodeAt(A)) === null || Z === void 0 ? void 0 : Z.attrs[d];
3146
3146
  if (Le === null) {
3147
3147
  const Ie = i.doc.type.createAndFill().content;
3148
3148
  if (i.doc.content.findDiffStart(Ie) === null) {
@@ -3150,21 +3150,21 @@ const ee = B.create({
3150
3150
  JSON.stringify(n.doc.toJSON())
3151
3151
  );
3152
3152
  if (Ae.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(Ae.content) === JSON.stringify(Ie.toJSON())) {
3153
- s.setNodeMarkup(q, void 0, {
3153
+ s.setNodeMarkup(A, void 0, {
3154
3154
  ...M.attrs,
3155
3155
  [d]: "initialBlockId"
3156
3156
  });
3157
3157
  return;
3158
3158
  }
3159
3159
  }
3160
- s.setNodeMarkup(q, void 0, {
3160
+ s.setNodeMarkup(A, void 0, {
3161
3161
  ...M.attrs,
3162
3162
  [d]: u()
3163
3163
  });
3164
3164
  return;
3165
3165
  }
3166
- const { deleted: xt } = h.invert().mapResult(q);
3167
- xt && L.includes(Le) && s.setNodeMarkup(q, void 0, {
3166
+ const { deleted: xt } = h.invert().mapResult(A);
3167
+ xt && I.includes(Le) && s.setNodeMarkup(A, void 0, {
3168
3168
  ...M.attrs,
3169
3169
  [d]: u()
3170
3170
  });
@@ -3224,7 +3224,7 @@ const ee = B.create({
3224
3224
  s.push(d);
3225
3225
  }), T.from(s);
3226
3226
  };
3227
- return e = !1, new U(
3227
+ return e = !1, new D(
3228
3228
  r(o.content),
3229
3229
  o.openStart,
3230
3230
  o.openEnd
@@ -3283,10 +3283,10 @@ function He(t) {
3283
3283
  function Ye(t) {
3284
3284
  return typeof t != "string" && t.type === "link";
3285
3285
  }
3286
- function Q(t) {
3286
+ function te(t) {
3287
3287
  return typeof t != "string" && t.type === "text";
3288
3288
  }
3289
- class I extends Error {
3289
+ class L extends Error {
3290
3290
  constructor(e) {
3291
3291
  super(`Unreachable case: ${e}`);
3292
3292
  }
@@ -3307,7 +3307,7 @@ function Ue(t, e, o) {
3307
3307
  else if (a.propSchema === "string")
3308
3308
  i.push(e.mark(n, { stringValue: r }));
3309
3309
  else
3310
- throw new I(a.propSchema);
3310
+ throw new L(a.propSchema);
3311
3311
  }
3312
3312
  return t.text.split(/(\n)/g).filter((n) => n.length > 0).map((n) => n === `
3313
3313
  ` ? e.nodes.hardBreak.create() : e.text(n, i));
@@ -3316,7 +3316,7 @@ function Eo(t, e, o) {
3316
3316
  const i = e.marks.link.create({
3317
3317
  href: t.href
3318
3318
  });
3319
- return ve(t.content, e, o).map(
3319
+ return we(t.content, e, o).map(
3320
3320
  (n) => {
3321
3321
  if (n.type.name === "text")
3322
3322
  return n.mark([...n.marks, i]);
@@ -3326,7 +3326,7 @@ function Eo(t, e, o) {
3326
3326
  }
3327
3327
  );
3328
3328
  }
3329
- function ve(t, e, o) {
3329
+ function we(t, e, o) {
3330
3330
  const i = [];
3331
3331
  if (typeof t == "string")
3332
3332
  return i.push(
@@ -3340,10 +3340,10 @@ function ve(t, e, o) {
3340
3340
  i.push(...Ue(n, e, o));
3341
3341
  return i;
3342
3342
  }
3343
- function ne(t, e, o) {
3343
+ function K(t, e, o) {
3344
3344
  const i = [];
3345
3345
  for (const n of t)
3346
- typeof n == "string" ? i.push(...ve(n, e, o)) : Ye(n) ? i.push(...Eo(n, e, o)) : Q(n) ? i.push(...ve([n], e, o)) : i.push(
3346
+ typeof n == "string" ? i.push(...we(n, e, o)) : Ye(n) ? i.push(...Eo(n, e, o)) : te(n) ? i.push(...we([n], e, o)) : i.push(
3347
3347
  et(n, e, o)
3348
3348
  );
3349
3349
  return i;
@@ -3359,7 +3359,7 @@ function Qe(t, e, o) {
3359
3359
  else if (typeof s == "string")
3360
3360
  l = e.nodes.tableParagraph.create({}, e.text(s));
3361
3361
  else {
3362
- const u = ne(s, e, o);
3362
+ const u = K(s, e, o);
3363
3363
  l = e.nodes.tableParagraph.create({}, u);
3364
3364
  }
3365
3365
  const d = e.nodes.tableCell.create({}, l);
@@ -3376,24 +3376,22 @@ function et(t, e, o) {
3376
3376
  throw new Error(`node type ${n} not found in schema`);
3377
3377
  if (!t.content)
3378
3378
  i = e.nodes[n].create(t.props);
3379
- else if (typeof t.content == "string")
3380
- i = e.nodes[n].create(
3381
- t.props,
3382
- e.text(t.content)
3383
- );
3384
- else if (Array.isArray(t.content)) {
3385
- const r = ne(t.content, e, o);
3379
+ else if (typeof t.content == "string") {
3380
+ const r = K([t.content], e, o);
3381
+ i = e.nodes[n].create(t.props, r);
3382
+ } else if (Array.isArray(t.content)) {
3383
+ const r = K(t.content, e, o);
3386
3384
  i = e.nodes[n].create(t.props, r);
3387
3385
  } else if (t.content.type === "tableContent") {
3388
3386
  const r = Qe(t.content, e, o);
3389
3387
  i = e.nodes[n].create(t.props, r);
3390
3388
  } else
3391
- throw new I(t.content.type);
3389
+ throw new L(t.content.type);
3392
3390
  return i;
3393
3391
  }
3394
- function N(t, e, o) {
3392
+ function P(t, e, o) {
3395
3393
  let i = t.id;
3396
- i === void 0 && (i = ee.options.generateID());
3394
+ i === void 0 && (i = oe.options.generateID());
3397
3395
  const n = et(
3398
3396
  t,
3399
3397
  e,
@@ -3401,7 +3399,7 @@ function N(t, e, o) {
3401
3399
  ), r = [];
3402
3400
  if (t.children)
3403
3401
  for (const s of t.children)
3404
- r.push(N(s, e, o));
3402
+ r.push(P(s, e, o));
3405
3403
  const a = e.nodes.blockGroup.create({}, r);
3406
3404
  return e.nodes.blockContainer.create(
3407
3405
  {
@@ -3437,7 +3435,7 @@ function Ee(t, e, o) {
3437
3435
  return t.content.forEach((r) => {
3438
3436
  if (r.type.name === "hardBreak") {
3439
3437
  if (n)
3440
- if (Q(n))
3438
+ if (te(n))
3441
3439
  n.text += `
3442
3440
  `;
3443
3441
  else if (He(n))
@@ -3474,9 +3472,9 @@ function Ee(t, e, o) {
3474
3472
  else if (d.propSchema === "string")
3475
3473
  a[d.type] = l.attrs.stringValue;
3476
3474
  else
3477
- throw new I(d.propSchema);
3475
+ throw new L(d.propSchema);
3478
3476
  }
3479
- n ? Q(n) ? s ? (i.push(n), n = {
3477
+ n ? te(n) ? s ? (i.push(n), n = {
3480
3478
  type: "link",
3481
3479
  href: s.attrs.href,
3482
3480
  content: [
@@ -3548,7 +3546,7 @@ function tt(t, e, o) {
3548
3546
  content: r
3549
3547
  };
3550
3548
  }
3551
- function v(t, e, o, i, n) {
3549
+ function w(t, e, o, i, n) {
3552
3550
  if (t.type.name !== "blockContainer")
3553
3551
  throw Error(
3554
3552
  "Node must be of type blockContainer, but is of type" + t.type.name + "."
@@ -3558,7 +3556,7 @@ function v(t, e, o, i, n) {
3558
3556
  return r;
3559
3557
  const a = Je(t);
3560
3558
  let s = a.id;
3561
- s === null && (s = ee.options.generateID());
3559
+ s === null && (s = oe.options.generateID());
3562
3560
  const l = {};
3563
3561
  for (const [m, f] of Object.entries({
3564
3562
  ...t.attrs,
@@ -3575,7 +3573,7 @@ function v(t, e, o, i, n) {
3575
3573
  const d = e[a.contentType.name], u = [];
3576
3574
  for (let m = 0; m < a.numChildBlocks; m++)
3577
3575
  u.push(
3578
- v(
3576
+ w(
3579
3577
  t.lastChild.child(m),
3580
3578
  e,
3581
3579
  o,
@@ -3599,7 +3597,7 @@ function v(t, e, o, i, n) {
3599
3597
  else if (d.content === "none")
3600
3598
  p = void 0;
3601
3599
  else
3602
- throw new I(d.content);
3600
+ throw new L(d.content);
3603
3601
  const h = {
3604
3602
  id: s,
3605
3603
  type: d.type,
@@ -3615,7 +3613,7 @@ function So(t) {
3615
3613
  const ot = (t, e, o, i, n) => {
3616
3614
  if (!o.nodes[t.type.name])
3617
3615
  throw new Error("Serializer is missing a node type: " + t.type.name);
3618
- const { dom: r, contentDOM: a } = _e.renderSpec(
3616
+ const { dom: r, contentDOM: a } = ve.renderSpec(
3619
3617
  So(e),
3620
3618
  o.nodes[t.type.name](t)
3621
3619
  );
@@ -3626,7 +3624,7 @@ const ot = (t, e, o, i, n) => {
3626
3624
  const s = t.childCount > 0 && t.firstChild.type.spec.group === "blockContent" ? t.firstChild : void 0, l = t.childCount > 0 && t.lastChild.type.spec.group === "blockGroup" ? t.lastChild : void 0;
3627
3625
  if (s !== void 0) {
3628
3626
  const d = i.blockImplementations[s.type.name].implementation, p = (n ? d.toExternalHTML : d.toInternalHTML)(
3629
- v(
3627
+ w(
3630
3628
  t,
3631
3629
  i.schema.blockSchema,
3632
3630
  i.schema.inlineContentSchema,
@@ -3708,9 +3706,9 @@ function Mo(t) {
3708
3706
  };
3709
3707
  return o;
3710
3708
  }
3711
- const re = (t, e) => {
3712
- const o = _e.fromSchema(t);
3713
- return o.serializeNodeInner = (i, n) => ot(i, n, o, e, !0), o.exportProseMirrorFragment = (i) => we().use(Ke, { fragment: !0 }).use(Mo, {
3709
+ const ae = (t, e) => {
3710
+ const o = ve.fromSchema(t);
3711
+ return o.serializeNodeInner = (i, n) => ot(i, n, o, e, !0), o.exportProseMirrorFragment = (i) => _e().use($e, { fragment: !0 }).use(Mo, {
3714
3712
  orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
3715
3713
  unorderedListItemBlockTypes: /* @__PURE__ */ new Set([
3716
3714
  "bulletListItem",
@@ -3718,36 +3716,36 @@ const re = (t, e) => {
3718
3716
  ])
3719
3717
  }).use(qe).processSync(it(i, o)).value, o.exportBlocks = (i) => {
3720
3718
  const n = i.map(
3721
- (a) => N(a, t, e.schema.styleSchema)
3719
+ (a) => P(a, t, e.schema.styleSchema)
3722
3720
  ), r = t.nodes.blockGroup.create(null, n);
3723
3721
  return o.exportProseMirrorFragment(T.from(r));
3724
3722
  }, o;
3725
3723
  }, nt = (t, e) => {
3726
- const o = _e.fromSchema(t);
3724
+ const o = ve.fromSchema(t);
3727
3725
  return o.serializeNodeInner = (i, n) => ot(i, n, o, e, !1), o.serializeProseMirrorFragment = (i) => it(i, o), o.serializeBlocks = (i) => {
3728
3726
  const n = i.map(
3729
- (a) => N(a, t, e.schema.styleSchema)
3727
+ (a) => P(a, t, e.schema.styleSchema)
3730
3728
  ), r = t.nodes.blockGroup.create(null, n);
3731
3729
  return o.serializeProseMirrorFragment(T.from(r));
3732
3730
  }, o;
3733
3731
  }, To = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
3734
- function P(t, e = "Ctrl") {
3732
+ function H(t, e = "Ctrl") {
3735
3733
  return To() ? t.replace("Mod", "⌘") : t.replace("Mod", e);
3736
3734
  }
3737
- function O(...t) {
3735
+ function R(...t) {
3738
3736
  return t.filter((e) => e).join(" ");
3739
3737
  }
3740
3738
  const Br = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
3741
- function R(t, e, o, i) {
3739
+ function V(t, e, o, i) {
3742
3740
  const n = document.createElement("div");
3743
- n.className = O(
3741
+ n.className = R(
3744
3742
  "bn-block-content",
3745
3743
  o.class
3746
3744
  ), n.setAttribute("data-content-type", t);
3747
3745
  for (const [a, s] of Object.entries(o))
3748
3746
  a !== "class" && n.setAttribute(a, s);
3749
3747
  const r = document.createElement(e);
3750
- r.className = O(
3748
+ r.className = R(
3751
3749
  "bn-inline-content",
3752
3750
  i.class
3753
3751
  );
@@ -3761,7 +3759,7 @@ function R(t, e, o, i) {
3761
3759
  };
3762
3760
  }
3763
3761
  const De = (t, e) => {
3764
- const o = N(
3762
+ const o = P(
3765
3763
  t,
3766
3764
  e._tiptapEditor.schema,
3767
3765
  e.schema.styleSchema
@@ -3788,7 +3786,7 @@ const De = (t, e) => {
3788
3786
  values: ["left", "center", "right", "justify"]
3789
3787
  }
3790
3788
  }, rt = ["backgroundColor", "textColor"];
3791
- function ie(t) {
3789
+ function re(t) {
3792
3790
  return "data-" + t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
3793
3791
  }
3794
3792
  function Lr(t) {
@@ -3806,7 +3804,7 @@ function at(t) {
3806
3804
  // value is the same as its default, we don't display an HTML
3807
3805
  // attribute for it.
3808
3806
  parseHTML: (n) => {
3809
- const r = n.getAttribute(ie(o));
3807
+ const r = n.getAttribute(re(o));
3810
3808
  if (r === null)
3811
3809
  return null;
3812
3810
  if (typeof i.default == "boolean")
@@ -3818,7 +3816,7 @@ function at(t) {
3818
3816
  return r;
3819
3817
  },
3820
3818
  renderHTML: (n) => n[o] !== i.default ? {
3821
- [ie(o)]: n[o]
3819
+ [re(o)]: n[o]
3822
3820
  } : {}
3823
3821
  };
3824
3822
  }), e;
@@ -3841,13 +3839,13 @@ function me(t, e, o, i, n = !1, r) {
3841
3839
  if (r !== void 0)
3842
3840
  for (const [s, l] of Object.entries(r))
3843
3841
  s !== "class" && a.setAttribute(s, l);
3844
- a.className = O(
3842
+ a.className = R(
3845
3843
  "bn-block-content",
3846
3844
  (r == null ? void 0 : r.class) || ""
3847
3845
  ), a.setAttribute("data-content-type", e);
3848
3846
  for (const [s, l] of Object.entries(o))
3849
- !rt.includes(s) && l !== i[s].default && a.setAttribute(ie(s), l);
3850
- return n && a.setAttribute("data-file-block", ""), a.appendChild(t.dom), t.contentDOM !== void 0 && (t.contentDOM.className = O(
3847
+ !rt.includes(s) && l !== i[s].default && a.setAttribute(re(s), l);
3848
+ return n && a.setAttribute("data-file-block", ""), a.appendChild(t.dom), t.contentDOM !== void 0 && (t.contentDOM.className = R(
3851
3849
  "bn-inline-content",
3852
3850
  t.contentDOM.className
3853
3851
  ), t.contentDOM.setAttribute("data-editable", "")), {
@@ -3855,8 +3853,8 @@ function me(t, e, o, i, n = !1, r) {
3855
3853
  dom: a
3856
3854
  };
3857
3855
  }
3858
- function j(t) {
3859
- return W.create(t);
3856
+ function z(t) {
3857
+ return $.create(t);
3860
3858
  }
3861
3859
  function st(t, e) {
3862
3860
  return {
@@ -3864,7 +3862,7 @@ function st(t, e) {
3864
3862
  implementation: e
3865
3863
  };
3866
3864
  }
3867
- function $(t, e, o) {
3865
+ function q(t, e, o) {
3868
3866
  return st(
3869
3867
  {
3870
3868
  type: t.name,
@@ -3902,8 +3900,8 @@ function Lo(t, e) {
3902
3900
  }
3903
3901
  }), o;
3904
3902
  }
3905
- function ae(t, e) {
3906
- const o = j({
3903
+ function se(t, e) {
3904
+ const o = z({
3907
3905
  name: t.type,
3908
3906
  content: t.content === "inline" ? "inline*" : "",
3909
3907
  group: "blockContent",
@@ -3976,7 +3974,7 @@ function ae(t, e) {
3976
3974
  });
3977
3975
  }
3978
3976
  function Io(t, e, o, i) {
3979
- return t.dom.setAttribute("data-inline-content-type", e), Object.entries(o).filter(([n, r]) => r !== i[n].default).map(([n, r]) => [ie(n), r]).forEach(([n, r]) => t.dom.setAttribute(n, r)), t.contentDOM !== void 0 && t.contentDOM.setAttribute("data-editable", ""), t;
3977
+ return t.dom.setAttribute("data-inline-content-type", e), Object.entries(o).filter(([n, r]) => r !== i[n].default).map(([n, r]) => [re(n), r]).forEach(([n, r]) => t.dom.setAttribute(n, r)), t.contentDOM !== void 0 && t.contentDOM.setAttribute("data-editable", ""), t;
3980
3978
  }
3981
3979
  function Ao(t) {
3982
3980
  return {
@@ -4021,7 +4019,7 @@ function Ho(t) {
4021
4019
  ];
4022
4020
  }
4023
4021
  function Ir(t, e) {
4024
- const o = W.create({
4022
+ const o = $.create({
4025
4023
  name: t.type,
4026
4024
  inline: !0,
4027
4025
  group: "inline",
@@ -4080,7 +4078,7 @@ function ct(t, e) {
4080
4078
  implementation: e
4081
4079
  };
4082
4080
  }
4083
- function H(t, e) {
4081
+ function U(t, e) {
4084
4082
  return ct(
4085
4083
  {
4086
4084
  type: t.name,
@@ -4123,7 +4121,7 @@ function Ar(t, e) {
4123
4121
  else if (t.propSchema === "string")
4124
4122
  n = e.render(i.attrs.stringValue);
4125
4123
  else
4126
- throw new I(t.propSchema);
4124
+ throw new L(t.propSchema);
4127
4125
  return Do(
4128
4126
  n,
4129
4127
  t.type,
@@ -4136,7 +4134,7 @@ function Ar(t, e) {
4136
4134
  mark: o
4137
4135
  });
4138
4136
  }
4139
- const se = (t) => {
4137
+ const le = (t) => {
4140
4138
  const e = document.createElement("div");
4141
4139
  e.className = "bn-file-default-preview";
4142
4140
  const o = document.createElement("div");
@@ -4145,14 +4143,14 @@ const se = (t) => {
4145
4143
  return i.className = "bn-file-default-preview-name", i.textContent = t.props.name || "", e.appendChild(o), e.appendChild(i), {
4146
4144
  dom: e
4147
4145
  };
4148
- }, V = (t, e) => {
4146
+ }, j = (t, e) => {
4149
4147
  const o = document.createElement("div");
4150
4148
  o.className = "bn-file-and-caption-wrapper";
4151
4149
  const i = document.createElement("p");
4152
4150
  return i.className = "bn-file-caption", i.textContent = t.props.caption, o.appendChild(e), o.appendChild(i), {
4153
4151
  dom: o
4154
4152
  };
4155
- }, le = (t, e, o, i) => {
4153
+ }, de = (t, e, o, i) => {
4156
4154
  const n = document.createElement("div");
4157
4155
  n.className = "bn-add-file-button";
4158
4156
  const r = document.createElement("div");
@@ -4186,7 +4184,7 @@ const se = (t) => {
4186
4184
  );
4187
4185
  }
4188
4186
  };
4189
- }, Oe = (t) => ({ url: t.src || void 0 }), de = (t, e) => {
4187
+ }, Oe = (t) => ({ url: t.src || void 0 }), ce = (t, e) => {
4190
4188
  const o = t.querySelector(
4191
4189
  e
4192
4190
  );
@@ -4194,7 +4192,7 @@ const se = (t) => {
4194
4192
  return;
4195
4193
  const i = t.querySelector("figcaption"), n = (i == null ? void 0 : i.textContent) ?? void 0;
4196
4194
  return { targetElement: o, caption: n };
4197
- }, ce = (t, e) => {
4195
+ }, ue = (t, e) => {
4198
4196
  const o = document.createElement("div"), i = document.createElement("p");
4199
4197
  return i.textContent = e, o.appendChild(t), o.appendChild(i), {
4200
4198
  dom: o
@@ -4219,8 +4217,8 @@ const se = (t) => {
4219
4217
  }
4220
4218
  let k;
4221
4219
  t.props.textAlignment === "center" ? l.handleUsed === "left" ? k = l.initialWidth + (l.initialClientX - g.clientX) * 2 : k = l.initialWidth + (g.clientX - l.initialClientX) * 2 : l.handleUsed === "left" ? k = l.initialWidth + l.initialClientX - g.clientX : k = l.initialWidth + g.clientX - l.initialClientX;
4222
- const L = 64;
4223
- k < L ? n(L) : k > e.domElement.firstElementChild.clientWidth ? n(e.domElement.firstElementChild.clientWidth) : n(k);
4220
+ const I = 64;
4221
+ k < I ? n(I) : k > e.domElement.firstElementChild.clientWidth ? n(e.domElement.firstElementChild.clientWidth) : n(k);
4224
4222
  }, u = (g) => {
4225
4223
  (!g.target || !r.contains(g.target) || !e.isEditable) && r.contains(a) && r.contains(s) && (r.removeChild(a), r.removeChild(s)), l && (l = void 0, e.updateBlock(t, {
4226
4224
  props: {
@@ -4284,13 +4282,13 @@ const se = (t) => {
4284
4282
  }, jo = (t, e) => {
4285
4283
  const o = document.createElement("div");
4286
4284
  if (o.className = "bn-file-block-content-wrapper", t.props.url === "") {
4287
- const i = le(t, e);
4285
+ const i = de(t, e);
4288
4286
  return o.appendChild(i.dom), {
4289
4287
  dom: o,
4290
4288
  destroy: i.destroy
4291
4289
  };
4292
4290
  } else {
4293
- const i = se(t).dom, n = V(t, i);
4291
+ const i = le(t).dom, n = j(t, i);
4294
4292
  return o.appendChild(n.dom), {
4295
4293
  dom: o
4296
4294
  };
@@ -4299,7 +4297,7 @@ const se = (t) => {
4299
4297
  if (t.tagName === "EMBED")
4300
4298
  return Oe(t);
4301
4299
  if (t.tagName === "FIGURE") {
4302
- const e = de(t, "embed");
4300
+ const e = ce(t, "embed");
4303
4301
  if (!e)
4304
4302
  return;
4305
4303
  const { targetElement: o, caption: i } = e;
@@ -4316,10 +4314,10 @@ const se = (t) => {
4316
4314
  };
4317
4315
  }
4318
4316
  const e = document.createElement("a");
4319
- return e.href = t.props.url, e.textContent = t.props.name || t.props.url, t.props.caption ? ce(e, t.props.caption) : {
4317
+ return e.href = t.props.url, e.textContent = t.props.name || t.props.url, t.props.caption ? ue(e, t.props.caption) : {
4320
4318
  dom: e
4321
4319
  };
4322
- }, Go = ae(Vo, {
4320
+ }, Go = se(Vo, {
4323
4321
  render: jo,
4324
4322
  parse: zo,
4325
4323
  toExternalHTML: Fo
@@ -4348,18 +4346,18 @@ const se = (t) => {
4348
4346
  previewWidth: {
4349
4347
  default: 512
4350
4348
  }
4351
- }, $o = {
4349
+ }, Ko = {
4352
4350
  type: "image",
4353
4351
  propSchema: Wo,
4354
4352
  content: "none",
4355
4353
  isFileBlock: !0,
4356
4354
  fileBlockAcceptMimeTypes: ["image/*"]
4357
- }, Ko = (t, e) => {
4355
+ }, $o = (t, e) => {
4358
4356
  const o = document.createElement("div");
4359
4357
  if (o.className = "bn-file-block-content-wrapper", t.props.url === "") {
4360
4358
  const i = document.createElement("div");
4361
4359
  i.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>';
4362
- const n = le(
4360
+ const n = de(
4363
4361
  t,
4364
4362
  e,
4365
4363
  e.dictionary.file_blocks.image.add_button_text,
@@ -4386,22 +4384,22 @@ const se = (t) => {
4386
4384
  i,
4387
4385
  () => i.width,
4388
4386
  (a) => i.width = a
4389
- ), r = V(t, n.dom);
4387
+ ), r = j(t, n.dom);
4390
4388
  return o.appendChild(r.dom), {
4391
4389
  dom: o,
4392
4390
  destroy: n.destroy
4393
4391
  };
4394
4392
  } else {
4395
- const i = se(t).dom;
4393
+ const i = le(t).dom;
4396
4394
  return {
4397
- dom: V(t, i).dom
4395
+ dom: j(t, i).dom
4398
4396
  };
4399
4397
  }
4400
4398
  }, qo = (t) => {
4401
4399
  if (t.tagName === "IMG")
4402
4400
  return Re(t);
4403
4401
  if (t.tagName === "FIGURE") {
4404
- const e = de(t, "img");
4402
+ const e = ce(t, "img");
4405
4403
  if (!e)
4406
4404
  return;
4407
4405
  const { targetElement: o, caption: i } = e;
@@ -4418,11 +4416,11 @@ const se = (t) => {
4418
4416
  };
4419
4417
  }
4420
4418
  let e;
4421
- return t.props.showPreview ? (e = document.createElement("img"), e.src = t.props.url, e.alt = t.props.name || t.props.caption || "BlockNote image", e.width = t.props.previewWidth) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? Ce(e, t.props.caption) : ce(e, t.props.caption) : {
4419
+ return t.props.showPreview ? (e = document.createElement("img"), e.src = t.props.url, e.alt = t.props.name || t.props.caption || "BlockNote image", e.width = t.props.previewWidth) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? Ce(e, t.props.caption) : ue(e, t.props.caption) : {
4422
4420
  dom: e
4423
4421
  };
4424
- }, Zo = ae($o, {
4425
- render: Ko,
4422
+ }, Zo = se(Ko, {
4423
+ render: $o,
4426
4424
  parse: qo,
4427
4425
  toExternalHTML: Xo
4428
4426
  }), Ve = (t) => {
@@ -4461,7 +4459,7 @@ const se = (t) => {
4461
4459
  if (o.className = "bn-file-block-content-wrapper", t.props.url === "") {
4462
4460
  const i = document.createElement("div");
4463
4461
  i.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>';
4464
- const n = le(
4462
+ const n = de(
4465
4463
  t,
4466
4464
  e,
4467
4465
  e.dictionary.file_blocks.video.add_button_text,
@@ -4486,22 +4484,22 @@ const se = (t) => {
4486
4484
  i,
4487
4485
  () => i.width,
4488
4486
  (a) => i.width = a
4489
- ), r = V(t, n.dom);
4487
+ ), r = j(t, n.dom);
4490
4488
  return o.appendChild(r.dom), {
4491
4489
  dom: o,
4492
4490
  destroy: n.destroy
4493
4491
  };
4494
4492
  } else {
4495
- const i = se(t).dom;
4493
+ const i = le(t).dom;
4496
4494
  return {
4497
- dom: V(t, i).dom
4495
+ dom: j(t, i).dom
4498
4496
  };
4499
4497
  }
4500
4498
  }, ei = (t) => {
4501
4499
  if (t.tagName === "VIDEO")
4502
4500
  return Ve(t);
4503
4501
  if (t.tagName === "FIGURE") {
4504
- const e = de(t, "video");
4502
+ const e = ce(t, "video");
4505
4503
  if (!e)
4506
4504
  return;
4507
4505
  const { targetElement: o, caption: i } = e;
@@ -4518,10 +4516,10 @@ const se = (t) => {
4518
4516
  };
4519
4517
  }
4520
4518
  let e;
4521
- return t.props.showPreview ? (e = document.createElement("video"), e.src = t.props.url, e.width = t.props.previewWidth) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? Ce(e, t.props.caption) : ce(e, t.props.caption) : {
4519
+ return t.props.showPreview ? (e = document.createElement("video"), e.src = t.props.url, e.width = t.props.previewWidth) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? Ce(e, t.props.caption) : ue(e, t.props.caption) : {
4522
4520
  dom: e
4523
4521
  };
4524
- }, oi = ae(Yo, {
4522
+ }, oi = se(Yo, {
4525
4523
  render: Qo,
4526
4524
  parse: ei,
4527
4525
  toExternalHTML: ti
@@ -4553,7 +4551,7 @@ const se = (t) => {
4553
4551
  if (o.className = "bn-file-block-content-wrapper", t.props.url === "") {
4554
4552
  const i = document.createElement("div");
4555
4553
  i.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>';
4556
- const n = le(
4554
+ const n = de(
4557
4555
  t,
4558
4556
  e,
4559
4557
  e.dictionary.file_blocks.audio.add_button_text,
@@ -4571,21 +4569,21 @@ const se = (t) => {
4571
4569
  i.className = "bn-audio", e.resolveFileUrl(t.props.url).then((r) => {
4572
4570
  i.src = r;
4573
4571
  }), i.controls = !0, i.contentEditable = "false", i.draggable = !1;
4574
- const n = V(t, i);
4572
+ const n = j(t, i);
4575
4573
  return o.appendChild(n.dom), {
4576
4574
  dom: o
4577
4575
  };
4578
4576
  } else {
4579
- const i = se(t).dom;
4577
+ const i = le(t).dom;
4580
4578
  return {
4581
- dom: V(t, i).dom
4579
+ dom: j(t, i).dom
4582
4580
  };
4583
4581
  }
4584
4582
  }, ai = (t) => {
4585
4583
  if (t.tagName === "AUDIO")
4586
4584
  return je(t);
4587
4585
  if (t.tagName === "FIGURE") {
4588
- const e = de(t, "audio");
4586
+ const e = ce(t, "audio");
4589
4587
  if (!e)
4590
4588
  return;
4591
4589
  const { targetElement: o, caption: i } = e;
@@ -4602,10 +4600,10 @@ const se = (t) => {
4602
4600
  };
4603
4601
  }
4604
4602
  let e;
4605
- return t.props.showPreview ? (e = document.createElement("audio"), e.src = t.props.url) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? Ce(e, t.props.caption) : ce(e, t.props.caption) : {
4603
+ return t.props.showPreview ? (e = document.createElement("audio"), e.src = t.props.url) : (e = document.createElement("a"), e.href = t.props.url, e.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? Ce(e, t.props.caption) : ue(e, t.props.caption) : {
4606
4604
  dom: e
4607
4605
  };
4608
- }, li = ae(ni, {
4606
+ }, li = se(ni, {
4609
4607
  render: ri,
4610
4608
  parse: ai,
4611
4609
  toExternalHTML: si
@@ -4644,7 +4642,7 @@ const se = (t) => {
4644
4642
  renderHTML({ HTMLAttributes: t }) {
4645
4643
  return ["span", t, 0];
4646
4644
  }
4647
- }), ci = H(
4645
+ }), ci = U(
4648
4646
  di,
4649
4647
  "string"
4650
4648
  ), ui = xe.create({
@@ -4671,7 +4669,7 @@ const se = (t) => {
4671
4669
  renderHTML({ HTMLAttributes: t }) {
4672
4670
  return ["span", t, 0];
4673
4671
  }
4674
- }), pi = H(ui, "string"), C = (t) => {
4672
+ }), pi = U(ui, "string"), C = (t) => {
4675
4673
  const { contentType: e } = b(
4676
4674
  t.state.doc,
4677
4675
  t.state.selection.from
@@ -4680,7 +4678,7 @@ const se = (t) => {
4680
4678
  }, hi = {
4681
4679
  ...y,
4682
4680
  level: { default: 1, values: [1, 2, 3] }
4683
- }, mi = j({
4681
+ }, mi = z({
4684
4682
  name: "heading",
4685
4683
  content: "inline*",
4686
4684
  group: "blockContent",
@@ -4702,7 +4700,7 @@ const se = (t) => {
4702
4700
  },
4703
4701
  addInputRules() {
4704
4702
  return [
4705
- ...[1, 2, 3].map((t) => new Y({
4703
+ ...[1, 2, 3].map((t) => new ee({
4706
4704
  find: new RegExp(`^(#{${t}})\\s$`),
4707
4705
  handler: ({ state: e, chain: o, range: i }) => {
4708
4706
  C(this.editor) === "inline*" && o().BNUpdateBlock(e.selection.from, {
@@ -4773,7 +4771,7 @@ const se = (t) => {
4773
4771
  },
4774
4772
  renderHTML({ node: t, HTMLAttributes: e }) {
4775
4773
  var o, i;
4776
- return R(
4774
+ return V(
4777
4775
  this.name,
4778
4776
  `h${t.attrs.level}`,
4779
4777
  {
@@ -4783,31 +4781,31 @@ const se = (t) => {
4783
4781
  ((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
4784
4782
  );
4785
4783
  }
4786
- }), fi = $(
4784
+ }), fi = q(
4787
4785
  mi,
4788
4786
  hi
4789
- ), ue = (t) => {
4790
- const { node: e, contentType: o } = b(
4787
+ ), Se = (t) => {
4788
+ const { contentNode: e, contentType: o } = b(
4791
4789
  t.state.doc,
4792
4790
  t.state.selection.from
4793
4791
  ), i = t.state.selection.anchor === t.state.selection.head;
4794
4792
  return !(o.name === "bulletListItem" || o.name === "numberedListItem" || o.name === "checkListItem") || !i ? !1 : t.commands.first(({ state: n, chain: r, commands: a }) => [
4795
4793
  () => (
4796
- // Changes list item block to a text block if the content is empty.
4797
- a.command(() => e.textContent.length === 0 ? a.BNUpdateBlock(n.selection.from, {
4794
+ // Changes list item block to a paragraph block if the content is empty.
4795
+ a.command(() => e.childCount === 0 ? a.BNUpdateBlock(n.selection.from, {
4798
4796
  type: "paragraph",
4799
4797
  props: {}
4800
4798
  }) : !1)
4801
4799
  ),
4802
4800
  () => (
4803
- // Splits the current block, moving content inside that's after the cursor to a new block of the same type
4804
- // below.
4805
- a.command(() => e.textContent.length > 0 ? (r().deleteSelection().BNSplitBlock(n.selection.from, !0).run(), !0) : !1)
4801
+ // Splits the current block, moving content inside that's after the cursor
4802
+ // to a new block of the same type below.
4803
+ a.command(() => e.childCount > 0 ? (r().deleteSelection().BNSplitBlock(n.selection.from, !0).run(), !0) : !1)
4806
4804
  )
4807
4805
  ]);
4808
4806
  }, gi = {
4809
4807
  ...y
4810
- }, bi = j({
4808
+ }, bi = z({
4811
4809
  name: "bulletListItem",
4812
4810
  content: "inline*",
4813
4811
  group: "blockContent",
@@ -4817,7 +4815,7 @@ const se = (t) => {
4817
4815
  addInputRules() {
4818
4816
  return [
4819
4817
  // Creates an unordered list when starting with "-", "+", or "*".
4820
- new Y({
4818
+ new ee({
4821
4819
  find: new RegExp("^[-+*]\\s$"),
4822
4820
  handler: ({ state: t, chain: e, range: o }) => {
4823
4821
  C(this.editor) === "inline*" && e().BNUpdateBlock(t.selection.from, {
@@ -4830,7 +4828,7 @@ const se = (t) => {
4830
4828
  },
4831
4829
  addKeyboardShortcuts() {
4832
4830
  return {
4833
- Enter: () => ue(this.editor),
4831
+ Enter: () => Se(this.editor),
4834
4832
  "Mod-Shift-8": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
4835
4833
  this.editor.state.selection.anchor,
4836
4834
  {
@@ -4873,7 +4871,7 @@ const se = (t) => {
4873
4871
  },
4874
4872
  renderHTML({ HTMLAttributes: t }) {
4875
4873
  var e, o;
4876
- return R(
4874
+ return V(
4877
4875
  this.name,
4878
4876
  // We use a <p> tag, because for <li> tags we'd need a <ul> element to put
4879
4877
  // them in to be semantically correct, which we can't have due to the
@@ -4886,10 +4884,10 @@ const se = (t) => {
4886
4884
  ((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
4887
4885
  );
4888
4886
  }
4889
- }), ki = $(
4887
+ }), ki = q(
4890
4888
  bi,
4891
4889
  gi
4892
- ), yi = new S("numbered-list-indexing"), vi = () => new _({
4890
+ ), yi = new S("numbered-list-indexing"), wi = () => new v({
4893
4891
  key: yi,
4894
4892
  appendTransaction: (t, e, o) => {
4895
4893
  const i = o.tr;
@@ -4908,8 +4906,8 @@ const se = (t) => {
4908
4906
  if (!(d.depth !== h.depth)) {
4909
4907
  const f = h.contentNode;
4910
4908
  if (h.contentType.name === "numberedListItem") {
4911
- const L = f.attrs.index;
4912
- s = (parseInt(L) + 1).toString();
4909
+ const I = f.attrs.index;
4910
+ s = (parseInt(I) + 1).toString();
4913
4911
  }
4914
4912
  }
4915
4913
  }
@@ -4919,9 +4917,9 @@ const se = (t) => {
4919
4917
  }
4920
4918
  }), n ? i : null;
4921
4919
  }
4922
- }), _i = {
4920
+ }), vi = {
4923
4921
  ...y
4924
- }, wi = j({
4922
+ }, _i = z({
4925
4923
  name: "numberedListItem",
4926
4924
  content: "inline*",
4927
4925
  group: "blockContent",
@@ -4940,7 +4938,7 @@ const se = (t) => {
4940
4938
  addInputRules() {
4941
4939
  return [
4942
4940
  // Creates an ordered list when starting with "1.".
4943
- new Y({
4941
+ new ee({
4944
4942
  find: new RegExp("^1\\.\\s$"),
4945
4943
  handler: ({ state: t, chain: e, range: o }) => {
4946
4944
  C(this.editor) === "inline*" && e().BNUpdateBlock(t.selection.from, {
@@ -4953,7 +4951,7 @@ const se = (t) => {
4953
4951
  },
4954
4952
  addKeyboardShortcuts() {
4955
4953
  return {
4956
- Enter: () => ue(this.editor),
4954
+ Enter: () => Se(this.editor),
4957
4955
  "Mod-Shift-7": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
4958
4956
  this.editor.state.selection.anchor,
4959
4957
  {
@@ -4964,7 +4962,7 @@ const se = (t) => {
4964
4962
  };
4965
4963
  },
4966
4964
  addProseMirrorPlugins() {
4967
- return [vi()];
4965
+ return [wi()];
4968
4966
  },
4969
4967
  parseHTML() {
4970
4968
  return [
@@ -5001,7 +4999,7 @@ const se = (t) => {
5001
4999
  },
5002
5000
  renderHTML({ HTMLAttributes: t }) {
5003
5001
  var e, o;
5004
- return R(
5002
+ return V(
5005
5003
  this.name,
5006
5004
  // We use a <p> tag, because for <li> tags we'd need an <ol> element to
5007
5005
  // put them in to be semantically correct, which we can't have due to the
@@ -5014,15 +5012,15 @@ const se = (t) => {
5014
5012
  ((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
5015
5013
  );
5016
5014
  }
5017
- }), xi = $(
5018
- wi,
5019
- _i
5015
+ }), xi = q(
5016
+ _i,
5017
+ vi
5020
5018
  ), Ei = {
5021
5019
  ...y,
5022
5020
  checked: {
5023
5021
  default: !1
5024
5022
  }
5025
- }, Ci = j({
5023
+ }, Ci = z({
5026
5024
  name: "checkListItem",
5027
5025
  content: "inline*",
5028
5026
  group: "blockContent",
@@ -5041,7 +5039,7 @@ const se = (t) => {
5041
5039
  addInputRules() {
5042
5040
  return [
5043
5041
  // Creates a checklist when starting with "[]" or "[X]".
5044
- new Y({
5042
+ new ee({
5045
5043
  find: new RegExp("\\[\\s*\\]\\s$"),
5046
5044
  handler: ({ state: t, chain: e, range: o }) => {
5047
5045
  C(this.editor) === "inline*" && e().BNUpdateBlock(t.selection.from, {
@@ -5052,7 +5050,7 @@ const se = (t) => {
5052
5050
  }).deleteRange({ from: o.from, to: o.to });
5053
5051
  }
5054
5052
  }),
5055
- new Y({
5053
+ new ee({
5056
5054
  find: new RegExp("\\[[Xx]\\]\\s$"),
5057
5055
  handler: ({ state: t, chain: e, range: o }) => {
5058
5056
  C(this.editor) === "inline*" && e().BNUpdateBlock(t.selection.from, {
@@ -5067,7 +5065,7 @@ const se = (t) => {
5067
5065
  },
5068
5066
  addKeyboardShortcuts() {
5069
5067
  return {
5070
- Enter: () => ue(this.editor),
5068
+ Enter: () => Se(this.editor),
5071
5069
  "Mod-Shift-9": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
5072
5070
  this.editor.state.selection.anchor,
5073
5071
  {
@@ -5119,7 +5117,7 @@ const se = (t) => {
5119
5117
  var r, a;
5120
5118
  const o = document.createElement("input");
5121
5119
  o.type = "checkbox", o.checked = t.attrs.checked, t.attrs.checked && o.setAttribute("checked", "");
5122
- const { dom: i, contentDOM: n } = R(
5120
+ const { dom: i, contentDOM: n } = V(
5123
5121
  this.name,
5124
5122
  "p",
5125
5123
  {
@@ -5152,7 +5150,7 @@ const se = (t) => {
5152
5150
  });
5153
5151
  };
5154
5152
  a.addEventListener("change", s);
5155
- const { dom: l, contentDOM: d } = R(
5153
+ const { dom: l, contentDOM: d } = V(
5156
5154
  this.name,
5157
5155
  "p",
5158
5156
  {
@@ -5174,18 +5172,17 @@ const se = (t) => {
5174
5172
  };
5175
5173
  };
5176
5174
  }
5177
- }), Si = $(
5175
+ }), Si = q(
5178
5176
  Ci,
5179
5177
  Ei
5180
5178
  ), Mi = {
5181
5179
  ...y
5182
- }, Ti = j({
5180
+ }, Ti = z({
5183
5181
  name: "paragraph",
5184
5182
  content: "inline*",
5185
5183
  group: "blockContent",
5186
5184
  addKeyboardShortcuts() {
5187
5185
  return {
5188
- Enter: () => ue(this.editor),
5189
5186
  "Mod-Alt-0": () => C(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
5190
5187
  this.editor.state.selection.anchor,
5191
5188
  {
@@ -5201,13 +5198,17 @@ const se = (t) => {
5201
5198
  {
5202
5199
  tag: "p",
5203
5200
  priority: 200,
5201
+ getAttrs: (t) => {
5202
+ var e;
5203
+ return typeof t == "string" || !((e = t.textContent) != null && e.trim()) ? !1 : {};
5204
+ },
5204
5205
  node: "paragraph"
5205
5206
  }
5206
5207
  ];
5207
5208
  },
5208
5209
  renderHTML({ HTMLAttributes: t }) {
5209
5210
  var e, o;
5210
- return R(
5211
+ return V(
5211
5212
  this.name,
5212
5213
  "p",
5213
5214
  {
@@ -5217,7 +5218,7 @@ const se = (t) => {
5217
5218
  ((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
5218
5219
  );
5219
5220
  }
5220
- }), Bi = $(
5221
+ }), Bi = q(
5221
5222
  Ti,
5222
5223
  Mi
5223
5224
  ), Li = B.create({
@@ -5254,7 +5255,7 @@ const se = (t) => {
5254
5255
  }
5255
5256
  }), Ii = {
5256
5257
  ...y
5257
- }, Ai = j({
5258
+ }, Ai = z({
5258
5259
  name: "table",
5259
5260
  content: "tableRow+",
5260
5261
  group: "blockContent",
@@ -5265,7 +5266,7 @@ const se = (t) => {
5265
5266
  },
5266
5267
  renderHTML({ HTMLAttributes: t }) {
5267
5268
  var e, o;
5268
- return R(
5269
+ return V(
5269
5270
  this.name,
5270
5271
  "table",
5271
5272
  {
@@ -5275,12 +5276,23 @@ const se = (t) => {
5275
5276
  ((o = this.options.domAttributes) == null ? void 0 : o.inlineContent) || {}
5276
5277
  );
5277
5278
  }
5278
- }), Ni = W.create({
5279
+ }), Ni = $.create({
5279
5280
  name: "tableParagraph",
5280
5281
  group: "tableContent",
5281
5282
  content: "inline*",
5282
5283
  parseHTML() {
5283
- return [{ tag: "p" }];
5284
+ return [
5285
+ { tag: "td" },
5286
+ {
5287
+ tag: "p",
5288
+ getAttrs: (t) => {
5289
+ if (typeof t == "string" || !t.textContent)
5290
+ return !1;
5291
+ const e = t.parentElement;
5292
+ return e === null ? !1 : e.tagName === "TD" ? {} : !1;
5293
+ }
5294
+ }
5295
+ ];
5284
5296
  },
5285
5297
  renderHTML({ HTMLAttributes: t }) {
5286
5298
  return [
@@ -5289,7 +5301,7 @@ const se = (t) => {
5289
5301
  0
5290
5302
  ];
5291
5303
  }
5292
- }), Pi = $(
5304
+ }), Pi = q(
5293
5305
  Ai,
5294
5306
  Ii,
5295
5307
  [
@@ -5298,7 +5310,7 @@ const se = (t) => {
5298
5310
  qt.extend({
5299
5311
  content: "tableContent"
5300
5312
  }),
5301
- Kt.extend({
5313
+ $t.extend({
5302
5314
  content: "tableContent"
5303
5315
  }),
5304
5316
  Xt
@@ -5315,11 +5327,11 @@ const se = (t) => {
5315
5327
  video: oi,
5316
5328
  audio: li
5317
5329
  }, Hi = lt(ht), mt = {
5318
- bold: H(zt, "boolean"),
5319
- italic: H(Gt, "boolean"),
5320
- underline: H($t, "boolean"),
5321
- strike: H(Wt, "boolean"),
5322
- code: H(Ft, "boolean"),
5330
+ bold: U(zt, "boolean"),
5331
+ italic: U(Gt, "boolean"),
5332
+ underline: U(Kt, "boolean"),
5333
+ strike: U(Wt, "boolean"),
5334
+ code: U(Ft, "boolean"),
5323
5335
  textColor: pi,
5324
5336
  backgroundColor: ci
5325
5337
  }, Pr = ut(mt), ft = {
@@ -5349,7 +5361,7 @@ function Di(t, e, o) {
5349
5361
  function Rr(t, e, o) {
5350
5362
  return Di(t, e.type, o);
5351
5363
  }
5352
- function Se(t, e) {
5364
+ function Me(t, e) {
5353
5365
  let o, i;
5354
5366
  if (e.firstChild.descendants((n, r) => o ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== t ? !0 : (o = n, i = r + 1, !1)), o === void 0 || i === void 0)
5355
5367
  throw Error("Could not find block in the editor with matching ID.");
@@ -5362,9 +5374,9 @@ function Oi(t, e, o = "before", i) {
5362
5374
  const n = i._tiptapEditor, r = typeof e == "string" ? e : e.id, a = [];
5363
5375
  for (const u of t)
5364
5376
  a.push(
5365
- N(u, n.schema, i.schema.styleSchema)
5377
+ P(u, n.schema, i.schema.styleSchema)
5366
5378
  );
5367
- const { node: s, posBeforeNode: l } = Se(r, n.state.doc);
5379
+ const { node: s, posBeforeNode: l } = Me(r, n.state.doc);
5368
5380
  if (o === "before" && n.view.dispatch(
5369
5381
  n.state.tr.insert(l, a)
5370
5382
  ), o === "after" && n.view.dispatch(
@@ -5384,7 +5396,7 @@ function Oi(t, e, o = "before", i) {
5384
5396
  const d = [];
5385
5397
  for (const u of a)
5386
5398
  d.push(
5387
- v(
5399
+ w(
5388
5400
  u,
5389
5401
  i.schema.blockSchema,
5390
5402
  i.schema.inlineContentSchema,
@@ -5395,10 +5407,10 @@ function Oi(t, e, o = "before", i) {
5395
5407
  return d;
5396
5408
  }
5397
5409
  function Ri(t, e, o) {
5398
- const i = o._tiptapEditor, n = typeof t == "string" ? t : t.id, { posBeforeNode: r } = Se(n, i.state.doc);
5410
+ const i = o._tiptapEditor, n = typeof t == "string" ? t : t.id, { posBeforeNode: r } = Me(n, i.state.doc);
5399
5411
  i.commands.BNUpdateBlock(r + 1, e);
5400
5412
  const a = i.state.doc.resolve(r + 1).node();
5401
- return v(
5413
+ return w(
5402
5414
  a,
5403
5415
  o.schema.blockSchema,
5404
5416
  o.schema.inlineContentSchema,
@@ -5419,7 +5431,7 @@ function gt(t, e, o) {
5419
5431
  if (l.type.name !== "blockContainer" || !r.has(l.attrs.id))
5420
5432
  return !0;
5421
5433
  a.push(
5422
- v(
5434
+ w(
5423
5435
  l,
5424
5436
  e.schema.blockSchema,
5425
5437
  e.schema.inlineContentSchema,
@@ -5447,7 +5459,7 @@ function ji(t, e, o) {
5447
5459
  const i = o._tiptapEditor, n = [];
5448
5460
  for (const l of e)
5449
5461
  n.push(
5450
- N(l, i.schema, o.schema.styleSchema)
5462
+ P(l, i.schema, o.schema.styleSchema)
5451
5463
  );
5452
5464
  const r = typeof t[0] == "string" ? t[0] : t[0].id, a = gt(
5453
5465
  t,
@@ -5464,7 +5476,7 @@ function ji(t, e, o) {
5464
5476
  ), s = [];
5465
5477
  for (const l of n)
5466
5478
  s.push(
5467
- v(
5479
+ w(
5468
5480
  l,
5469
5481
  o.schema.blockSchema,
5470
5482
  o.schema.inlineContentSchema,
@@ -5516,28 +5528,28 @@ function Gi() {
5516
5528
  };
5517
5529
  return t;
5518
5530
  }
5519
- function Me(t) {
5520
- return we().use(Ke, { fragment: !0 }).use(Fi).use(Gi).use(Yt).use(Xe).use(Qt).processSync(t).value;
5531
+ function Te(t) {
5532
+ return _e().use($e, { fragment: !0 }).use(Fi).use(Gi).use(Yt).use(Xe).use(Qt).processSync(t).value;
5521
5533
  }
5522
5534
  function Wi(t, e, o) {
5523
- const n = re(e, o).exportBlocks(t);
5524
- return Me(n);
5535
+ const n = ae(e, o).exportBlocks(t);
5536
+ return Te(n);
5525
5537
  }
5526
- function $i(t) {
5538
+ function Ki(t) {
5527
5539
  return Array.prototype.indexOf.call(t.parentElement.childNodes, t);
5528
5540
  }
5529
- function Ki(t) {
5541
+ function $i(t) {
5530
5542
  return t.nodeType === 3 && !/\S/.test(t.nodeValue || "");
5531
5543
  }
5532
5544
  function qi(t) {
5533
5545
  t.querySelectorAll("li > ul, li > ol").forEach((e) => {
5534
- const o = $i(e), i = e.parentElement, n = Array.from(i.childNodes).slice(
5546
+ const o = Ki(e), i = e.parentElement, n = Array.from(i.childNodes).slice(
5535
5547
  o + 1
5536
5548
  );
5537
5549
  e.remove(), n.forEach((r) => {
5538
5550
  r.remove();
5539
5551
  }), i.insertAdjacentElement("afterend", e), n.reverse().forEach((r) => {
5540
- if (Ki(r))
5552
+ if ($i(r))
5541
5553
  return;
5542
5554
  const a = document.createElement("li");
5543
5555
  a.append(r), e.insertAdjacentElement("afterend", a);
@@ -5571,7 +5583,7 @@ async function kt(t, e, o, i, n) {
5571
5583
  }), l = [];
5572
5584
  for (let d = 0; d < s.childCount; d++)
5573
5585
  l.push(
5574
- v(s.child(d), e, o, i)
5586
+ w(s.child(d), e, o, i)
5575
5587
  );
5576
5588
  return l;
5577
5589
  }
@@ -5593,7 +5605,7 @@ function Ji(t, e) {
5593
5605
  }, t.patch(e, n), n;
5594
5606
  }
5595
5607
  function Yi(t, e, o, i, n) {
5596
- const r = we().use(eo).use(Xe).use(to, {
5608
+ const r = _e().use(eo).use(Xe).use(to, {
5597
5609
  handlers: {
5598
5610
  ...oo,
5599
5611
  code: Ji
@@ -5607,7 +5619,7 @@ function Yi(t, e, o, i, n) {
5607
5619
  n
5608
5620
  );
5609
5621
  }
5610
- class K {
5622
+ class X {
5611
5623
  constructor() {
5612
5624
  // eslint-disable-next-line @typescript-eslint/ban-types
5613
5625
  c(this, "callbacks", {});
@@ -5628,10 +5640,9 @@ class K {
5628
5640
  }
5629
5641
  }
5630
5642
  class Qi {
5631
- constructor(e, o, i) {
5643
+ constructor(e, o, i, n) {
5632
5644
  c(this, "state");
5633
5645
  c(this, "emitUpdate");
5634
- c(this, "prevWasEditable", null);
5635
5646
  c(this, "mouseDownHandler", () => {
5636
5647
  var e;
5637
5648
  (e = this.state) != null && e.show && (this.state.show = !1, this.emitUpdate());
@@ -5654,16 +5665,16 @@ class Qi {
5654
5665
  var e;
5655
5666
  (e = this.state) != null && e.show && (this.state.show = !1, this.emitUpdate());
5656
5667
  });
5657
- this.pluginKey = e, this.pmView = o, this.emitUpdate = () => {
5668
+ this.editor = e, this.pluginKey = o, this.pmView = i, this.emitUpdate = () => {
5658
5669
  if (!this.state)
5659
5670
  throw new Error("Attempting to update uninitialized file panel");
5660
- i(this.state);
5661
- }, o.dom.addEventListener("mousedown", this.mouseDownHandler), o.dom.addEventListener("dragstart", this.dragstartHandler), document.addEventListener("scroll", this.scrollHandler);
5671
+ n(this.state);
5672
+ }, i.dom.addEventListener("mousedown", this.mouseDownHandler), i.dom.addEventListener("dragstart", this.dragstartHandler), document.addEventListener("scroll", this.scrollHandler, !0);
5662
5673
  }
5663
5674
  update(e, o) {
5664
5675
  var n, r;
5665
5676
  const i = this.pluginKey.getState(e.state);
5666
- if (!((n = this.state) != null && n.show) && i.block) {
5677
+ if (!((n = this.state) != null && n.show) && i.block && this.editor.isEditable) {
5667
5678
  const a = document.querySelector(
5668
5679
  `[data-node-type="blockContainer"][data-id="${i.block.id}"]`
5669
5680
  );
@@ -5674,23 +5685,23 @@ class Qi {
5674
5685
  }, this.emitUpdate();
5675
5686
  return;
5676
5687
  }
5677
- (!e.state.selection.eq(o.selection) || !e.state.doc.eq(o.doc)) && (r = this.state) != null && r.show && (this.state.show = !1, this.emitUpdate());
5688
+ (!e.state.selection.eq(o.selection) || !e.state.doc.eq(o.doc) || !this.editor.isEditable) && (r = this.state) != null && r.show && (this.state.show = !1, this.emitUpdate());
5678
5689
  }
5679
5690
  destroy() {
5680
- this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), document.removeEventListener("scroll", this.scrollHandler);
5691
+ this.pmView.dom.removeEventListener("mousedown", this.mouseDownHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), document.removeEventListener("scroll", this.scrollHandler, !0);
5681
5692
  }
5682
5693
  }
5683
5694
  const fe = new S("FilePanelPlugin");
5684
- class en extends K {
5695
+ class en extends X {
5685
5696
  constructor(o) {
5686
5697
  super();
5687
5698
  c(this, "view");
5688
5699
  c(this, "plugin");
5689
5700
  c(this, "closeMenu", () => this.view.closeMenu());
5690
- this.plugin = new _({
5701
+ this.plugin = new v({
5691
5702
  key: fe,
5692
5703
  view: (i) => (this.view = new Qi(
5693
- // editor,
5704
+ o,
5694
5705
  fe,
5695
5706
  i,
5696
5707
  (n) => {
@@ -5727,7 +5738,6 @@ class tn {
5727
5738
  c(this, "emitUpdate");
5728
5739
  c(this, "preventHide", !1);
5729
5740
  c(this, "preventShow", !1);
5730
- c(this, "prevWasEditable", null);
5731
5741
  c(this, "shouldShow", ({ state: e, from: o, to: i, view: n }) => {
5732
5742
  const { doc: r, selection: a } = e, { empty: s } = a, l = !r.textBetween(o, i).length && Ht(e.selection);
5733
5743
  return !(!n.hasFocus() || s || l);
@@ -5757,21 +5767,20 @@ class tn {
5757
5767
  "Attempting to update uninitialized formatting toolbar"
5758
5768
  );
5759
5769
  i(this.state);
5760
- }, o.dom.addEventListener("mousedown", this.viewMousedownHandler), o.dom.addEventListener("mouseup", this.viewMouseupHandler), o.dom.addEventListener("dragstart", this.dragHandler), o.dom.addEventListener("dragover", this.dragHandler), document.addEventListener("scroll", this.scrollHandler);
5770
+ }, o.dom.addEventListener("mousedown", this.viewMousedownHandler), o.dom.addEventListener("mouseup", this.viewMouseupHandler), o.dom.addEventListener("dragstart", this.dragHandler), o.dom.addEventListener("dragover", this.dragHandler), document.addEventListener("scroll", this.scrollHandler, !0);
5761
5771
  }
5762
5772
  update(e, o) {
5763
5773
  var h, m;
5764
5774
  const { state: i, composing: n } = e, { doc: r, selection: a } = i, s = o && o.doc.eq(r) && o.selection.eq(a);
5765
- if ((this.prevWasEditable === null || this.prevWasEditable === this.editor.isEditable) && (n || s))
5775
+ if (n || s)
5766
5776
  return;
5767
- this.prevWasEditable = this.editor.isEditable;
5768
5777
  const { ranges: l } = a, d = Math.min(...l.map((f) => f.$from.pos)), u = Math.max(...l.map((f) => f.$to.pos)), p = (h = this.shouldShow) == null ? void 0 : h.call(this, {
5769
5778
  view: e,
5770
5779
  state: i,
5771
5780
  from: d,
5772
5781
  to: u
5773
5782
  });
5774
- if (this.editor.isEditable && !this.preventShow && (p || this.preventHide)) {
5783
+ if (!this.preventShow && (p || this.preventHide)) {
5775
5784
  this.state = {
5776
5785
  show: !0,
5777
5786
  referencePos: this.getSelectionBoundingBox()
@@ -5784,7 +5793,7 @@ class tn {
5784
5793
  }
5785
5794
  }
5786
5795
  destroy() {
5787
- this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.pmView.dom.removeEventListener("dragstart", this.dragHandler), this.pmView.dom.removeEventListener("dragover", this.dragHandler), document.removeEventListener("scroll", this.scrollHandler);
5796
+ this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.pmView.dom.removeEventListener("dragstart", this.dragHandler), this.pmView.dom.removeEventListener("dragover", this.dragHandler), document.removeEventListener("scroll", this.scrollHandler, !0);
5788
5797
  }
5789
5798
  getSelectionBoundingBox() {
5790
5799
  const { state: e } = this.pmView, { selection: o } = e, { ranges: i } = o, n = Math.min(...i.map((a) => a.$from.pos)), r = Math.max(...i.map((a) => a.$to.pos));
@@ -5799,13 +5808,13 @@ class tn {
5799
5808
  const on = new S(
5800
5809
  "FormattingToolbarPlugin"
5801
5810
  );
5802
- class nn extends K {
5811
+ class nn extends X {
5803
5812
  constructor(o) {
5804
5813
  super();
5805
5814
  c(this, "view");
5806
5815
  c(this, "plugin");
5807
5816
  c(this, "closeMenu", () => this.view.closeMenu());
5808
- this.plugin = new _({
5817
+ this.plugin = new v({
5809
5818
  key: on,
5810
5819
  view: (i) => (this.view = new tn(o, i, (n) => {
5811
5820
  this.emit("update", n);
@@ -5875,7 +5884,7 @@ class rn {
5875
5884
  this.menuUpdateTimer = setTimeout(() => {
5876
5885
  this.update();
5877
5886
  }, 250);
5878
- }, this.stopMenuUpdateTimer = () => (this.menuUpdateTimer && (clearTimeout(this.menuUpdateTimer), this.menuUpdateTimer = void 0), !1), this.pmView.dom.addEventListener("mouseover", this.mouseOverHandler), document.addEventListener("click", this.clickHandler, !0), document.addEventListener("scroll", this.scrollHandler);
5887
+ }, this.stopMenuUpdateTimer = () => (this.menuUpdateTimer && (clearTimeout(this.menuUpdateTimer), this.menuUpdateTimer = void 0), !1), this.pmView.dom.addEventListener("mouseover", this.mouseOverHandler), document.addEventListener("click", this.clickHandler, !0), document.addEventListener("scroll", this.scrollHandler, !0);
5879
5888
  }
5880
5889
  editLink(e, o) {
5881
5890
  var n;
@@ -5939,11 +5948,11 @@ class rn {
5939
5948
  }
5940
5949
  }
5941
5950
  destroy() {
5942
- this.pmView.dom.removeEventListener("mouseover", this.mouseOverHandler), document.removeEventListener("scroll", this.scrollHandler), document.removeEventListener("click", this.clickHandler, !0);
5951
+ this.pmView.dom.removeEventListener("mouseover", this.mouseOverHandler), document.removeEventListener("scroll", this.scrollHandler, !0), document.removeEventListener("click", this.clickHandler, !0);
5943
5952
  }
5944
5953
  }
5945
5954
  const an = new S("LinkToolbarPlugin");
5946
- class sn extends K {
5955
+ class sn extends X {
5947
5956
  constructor(o) {
5948
5957
  super();
5949
5958
  c(this, "view");
@@ -5981,7 +5990,7 @@ class sn extends K {
5981
5990
  this.view.stopMenuUpdateTimer();
5982
5991
  });
5983
5992
  c(this, "closeMenu", () => this.view.closeMenu());
5984
- this.plugin = new _({
5993
+ this.plugin = new v({
5985
5994
  key: an,
5986
5995
  view: (i) => (this.view = new rn(o, i, (n) => {
5987
5996
  this.emit("update", n);
@@ -6017,7 +6026,7 @@ class dn {
6017
6026
  c(this, "closeMenu", () => {
6018
6027
  this.editor._tiptapEditor.view.dispatch(
6019
6028
  this.editor._tiptapEditor.view.state.tr.setMeta(
6020
- D,
6029
+ O,
6021
6030
  null
6022
6031
  )
6023
6032
  );
@@ -6032,10 +6041,10 @@ class dn {
6032
6041
  if (!this.state)
6033
6042
  throw new Error("Attempting to update uninitialized suggestions menu");
6034
6043
  o(i, this.state);
6035
- }, document.addEventListener("scroll", this.handleScroll);
6044
+ }, document.addEventListener("scroll", this.handleScroll, !0);
6036
6045
  }
6037
6046
  update(e, o) {
6038
- const i = D.getState(o), n = D.getState(
6047
+ const i = O.getState(o), n = O.getState(
6039
6048
  e.state
6040
6049
  ), r = i === void 0 && n !== void 0, a = i !== void 0 && n === void 0;
6041
6050
  if (!r && !(i !== void 0 && n !== void 0) && !a)
@@ -6054,11 +6063,11 @@ class dn {
6054
6063
  }, this.emitUpdate(this.pluginState.triggerCharacter));
6055
6064
  }
6056
6065
  destroy() {
6057
- document.removeEventListener("scroll", this.handleScroll);
6066
+ document.removeEventListener("scroll", this.handleScroll, !0);
6058
6067
  }
6059
6068
  }
6060
- const D = new S("SuggestionMenuPlugin");
6061
- class cn extends K {
6069
+ const O = new S("SuggestionMenuPlugin");
6070
+ class cn extends X {
6062
6071
  constructor(o) {
6063
6072
  super();
6064
6073
  c(this, "view");
@@ -6076,8 +6085,8 @@ class cn extends K {
6076
6085
  c(this, "closeMenu", () => this.view.closeMenu());
6077
6086
  c(this, "clearQuery", () => this.view.clearQuery());
6078
6087
  const i = this.triggerCharacters;
6079
- this.plugin = new _({
6080
- key: D,
6088
+ this.plugin = new v({
6089
+ key: O,
6081
6090
  view: () => (this.view = new dn(
6082
6091
  o,
6083
6092
  (n, r) => {
@@ -6092,7 +6101,7 @@ class cn extends K {
6092
6101
  apply(n, r, a, s) {
6093
6102
  if (n.getMeta("orderedListIndexing") !== void 0)
6094
6103
  return r;
6095
- const l = n.getMeta(D);
6104
+ const l = n.getMeta(O);
6096
6105
  if (typeof l == "object" && l !== null && r === void 0)
6097
6106
  return {
6098
6107
  triggerCharacter: l.triggerCharacter,
@@ -6123,7 +6132,7 @@ class cn extends K {
6123
6132
  handleTextInput(n, r, a, s) {
6124
6133
  const l = this.getState(n.state);
6125
6134
  return i.includes(s) && l === void 0 ? (n.dispatch(
6126
- n.state.tr.insertText(s).scrollIntoView().setMeta(D, {
6135
+ n.state.tr.insertText(s).scrollIntoView().setMeta(O, {
6127
6136
  triggerCharacter: s
6128
6137
  })
6129
6138
  ), !0) : !1;
@@ -6136,8 +6145,8 @@ class cn extends K {
6136
6145
  if (!r.fromUserInput) {
6137
6146
  const a = ln(n.selection);
6138
6147
  if (a)
6139
- return F.create(n.doc, [
6140
- G.node(
6148
+ return G.create(n.doc, [
6149
+ W.node(
6141
6150
  a.pos,
6142
6151
  a.pos + a.node.nodeSize,
6143
6152
  {
@@ -6148,8 +6157,8 @@ class cn extends K {
6148
6157
  )
6149
6158
  ]);
6150
6159
  }
6151
- return F.create(n.doc, [
6152
- G.inline(
6160
+ return G.create(n.doc, [
6161
+ W.inline(
6153
6162
  r.queryStartPos - r.triggerCharacter.length,
6154
6163
  r.queryStartPos,
6155
6164
  {
@@ -6174,7 +6183,7 @@ class cn extends K {
6174
6183
  function Vr(t, e) {
6175
6184
  t.suggestionMenus.addTriggerCharacter(e);
6176
6185
  }
6177
- class z extends he {
6186
+ class F extends he {
6178
6187
  constructor(o, i) {
6179
6188
  super(o, i);
6180
6189
  c(this, "nodes");
@@ -6185,13 +6194,13 @@ class z extends he {
6185
6194
  });
6186
6195
  }
6187
6196
  static create(o, i, n = i) {
6188
- return new z(o.resolve(i), o.resolve(n));
6197
+ return new F(o.resolve(i), o.resolve(n));
6189
6198
  }
6190
6199
  content() {
6191
- return new U(T.from(this.nodes), 0, 0);
6200
+ return new D(T.from(this.nodes), 0, 0);
6192
6201
  }
6193
6202
  eq(o) {
6194
- if (!(o instanceof z) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
6203
+ if (!(o instanceof F) || this.nodes.length !== o.nodes.length || this.from !== o.from || this.to !== o.to)
6195
6204
  return !1;
6196
6205
  for (let i = 0; i < this.nodes.length; i++)
6197
6206
  if (!this.nodes[i].eq(o.nodes[i]))
@@ -6200,7 +6209,7 @@ class z extends he {
6200
6209
  }
6201
6210
  map(o, i) {
6202
6211
  const n = i.mapResult(this.from), r = i.mapResult(this.to);
6203
- return r.deleted ? he.near(o.resolve(n.pos)) : n.deleted ? he.near(o.resolve(r.pos)) : new z(
6212
+ return r.deleted ? he.near(o.resolve(n.pos)) : n.deleted ? he.near(o.resolve(r.pos)) : new F(
6204
6213
  o.resolve(n.pos),
6205
6214
  o.resolve(r.pos)
6206
6215
  );
@@ -6209,24 +6218,16 @@ class z extends he {
6209
6218
  return { type: "node", anchor: this.anchor, head: this.head };
6210
6219
  }
6211
6220
  }
6212
- let A;
6213
- function Te(t, e) {
6214
- var n;
6215
- if (!e.dom.isConnected)
6216
- return;
6217
- const o = e.posAtCoords(t);
6218
- if (!o)
6219
- return;
6220
- let i = e.domAtPos(o.pos).node;
6221
- if (i !== e.dom) {
6222
- for (; i && i.parentNode && i.parentNode !== e.dom && !((n = i.hasAttribute) != null && n.call(i, "data-id")); )
6223
- i = i.parentNode;
6224
- if (i)
6225
- return { node: i, id: i.getAttribute("data-id") };
6226
- }
6221
+ let N;
6222
+ function pe(t, e) {
6223
+ var o;
6224
+ for (; t && t.parentElement && t.parentElement !== e.dom && !((o = t.hasAttribute) != null && o.call(t, "data-id")); )
6225
+ t = t.parentElement;
6226
+ if (t.hasAttribute("data-id"))
6227
+ return { node: t, id: t.getAttribute("data-id") };
6227
6228
  }
6228
6229
  function un(t, e) {
6229
- const o = Te(t, e);
6230
+ const o = pe(t, e);
6230
6231
  if (o && o.node.nodeType === 1) {
6231
6232
  const i = e.docView, n = i.nearestDesc(o.node, !0);
6232
6233
  return !n || n === i ? null : n.posBefore;
@@ -6256,14 +6257,14 @@ function Fe(t, e, o = e) {
6256
6257
  );
6257
6258
  for (let u = n.childElementCount - 1; u >= 0; u--)
6258
6259
  (u > s || u < a) && i.removeChild(i.children[u]);
6259
- yt(), A = i;
6260
+ yt(), N = i;
6260
6261
  const d = t.dom.className.split(" ").filter(
6261
6262
  (u) => u !== "ProseMirror" && u !== "bn-root" && u !== "bn-editor"
6262
6263
  ).join(" ");
6263
- A.className = A.className + " bn-drag-preview " + d, document.body.appendChild(A);
6264
+ N.className = N.className + " bn-drag-preview " + d, document.body.appendChild(N);
6264
6265
  }
6265
6266
  function yt() {
6266
- A !== void 0 && (document.body.removeChild(A), A = void 0);
6267
+ N !== void 0 && (document.body.removeChild(N), N = void 0);
6267
6268
  }
6268
6269
  function hn(t, e) {
6269
6270
  if (!t.dataTransfer)
@@ -6272,26 +6273,37 @@ function hn(t, e) {
6272
6273
  left: i.left + i.width / 2,
6273
6274
  // take middle of editor
6274
6275
  top: t.clientY
6275
- }, r = un(n, o);
6276
- if (r != null) {
6277
- const a = o.state.selection, s = o.state.doc, { from: l, to: d } = pn(a, s), u = l <= r && r < d, p = a.$anchor.node() !== a.$head.node() || a instanceof z;
6278
- u && p ? (o.dispatch(
6279
- o.state.tr.setSelection(z.create(s, l, d))
6280
- ), Fe(o, l, d)) : (o.dispatch(
6281
- o.state.tr.setSelection(oe.create(o.state.doc, r))
6282
- ), Fe(o, r));
6283
- const h = o.state.selection.content(), m = e._tiptapEditor.schema, g = nt(m, e).serializeProseMirrorFragment(
6284
- h.content
6285
- ), L = re(m, e).exportProseMirrorFragment(
6286
- h.content
6287
- ), M = Me(L);
6288
- t.dataTransfer.clearData(), t.dataTransfer.setData("blocknote/html", g), t.dataTransfer.setData("text/html", L), t.dataTransfer.setData("text/plain", M), t.dataTransfer.effectAllowed = "move", t.dataTransfer.setDragImage(A, 0, 0), o.dragging = { slice: h, move: !0 };
6276
+ }, r = document.elementsFromPoint(n.left, n.top);
6277
+ let a;
6278
+ for (const l of r)
6279
+ if (o.dom.contains(l)) {
6280
+ a = pe(l, o);
6281
+ break;
6282
+ }
6283
+ if (!a)
6284
+ return;
6285
+ const s = un(a.node, o);
6286
+ if (s != null) {
6287
+ const l = o.state.selection, d = o.state.doc, { from: u, to: p } = pn(l, d), h = u <= s && s < p, m = l.$anchor.node() !== l.$head.node() || l instanceof F;
6288
+ h && m ? (o.dispatch(
6289
+ o.state.tr.setSelection(F.create(d, u, p))
6290
+ ), Fe(o, u, p)) : (o.dispatch(
6291
+ o.state.tr.setSelection(ne.create(o.state.doc, s))
6292
+ ), Fe(o, s));
6293
+ const f = o.state.selection.content(), g = e._tiptapEditor.schema, I = nt(g, e).serializeProseMirrorFragment(
6294
+ f.content
6295
+ ), A = ae(g, e).exportProseMirrorFragment(
6296
+ f.content
6297
+ ), Z = Te(A);
6298
+ t.dataTransfer.clearData(), t.dataTransfer.setData("blocknote/html", I), t.dataTransfer.setData("text/html", A), t.dataTransfer.setData("text/plain", Z), t.dataTransfer.effectAllowed = "move", t.dataTransfer.setDragImage(N, 0, 0), o.dragging = { slice: f, move: !0 };
6289
6299
  }
6290
6300
  }
6291
6301
  class mn {
6292
6302
  constructor(e, o, i) {
6293
6303
  c(this, "state");
6294
6304
  c(this, "emitUpdate");
6305
+ c(this, "needUpdate", !1);
6306
+ c(this, "mousePos");
6295
6307
  // When true, the drag handle with be anchored at the same level as root elements
6296
6308
  // When false, the drag handle with be just to the left of the element
6297
6309
  // TODO: Is there any case where we want this to be false?
@@ -6301,6 +6313,47 @@ class mn {
6301
6313
  // Used to check if currently dragged content comes from this editor instance.
6302
6314
  c(this, "isDragging", !1);
6303
6315
  c(this, "menuFrozen", !1);
6316
+ c(this, "updateState", () => {
6317
+ var a, s, l, d;
6318
+ if (this.menuFrozen || !this.mousePos)
6319
+ return;
6320
+ const e = this.pmView.dom.firstChild.getBoundingClientRect();
6321
+ this.horizontalPosAnchor = e.x;
6322
+ const o = {
6323
+ left: e.left + e.width / 2,
6324
+ // take middle of editor
6325
+ top: this.mousePos.y
6326
+ }, i = document.elementsFromPoint(o.left, o.top);
6327
+ let n;
6328
+ for (const u of i)
6329
+ if (this.pmView.dom.contains(u)) {
6330
+ n = pe(u, this.pmView);
6331
+ break;
6332
+ }
6333
+ if (!n || !this.editor.isEditable) {
6334
+ (a = this.state) != null && a.show && (this.state.show = !1, this.needUpdate = !0);
6335
+ return;
6336
+ }
6337
+ if ((s = this.state) != null && s.show && ((l = this.hoveredBlock) != null && l.hasAttribute("data-id")) && ((d = this.hoveredBlock) == null ? void 0 : d.getAttribute("data-id")) === n.id)
6338
+ return;
6339
+ this.hoveredBlock = n.node;
6340
+ const r = n.node.firstChild;
6341
+ if (r && this.editor.isEditable) {
6342
+ const u = r.getBoundingClientRect();
6343
+ this.state = {
6344
+ show: !0,
6345
+ referencePos: new DOMRect(
6346
+ this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor : u.x,
6347
+ u.y,
6348
+ u.width,
6349
+ u.height
6350
+ ),
6351
+ block: this.editor.getBlock(
6352
+ this.hoveredBlock.getAttribute("data-id")
6353
+ )
6354
+ }, this.needUpdate = !0;
6355
+ }
6356
+ });
6304
6357
  /**
6305
6358
  * Sets isDragging when dragging text.
6306
6359
  */
@@ -6345,52 +6398,23 @@ class mn {
6345
6398
  var o;
6346
6399
  (o = this.state) != null && o.show && this.editor.isFocused() && (this.state.show = !1, this.emitUpdate(this.state), this.menuFrozen = !1);
6347
6400
  });
6348
- c(this, "onMouseDown", (e) => {
6349
- this.state && !this.state.show && (this.state.show = !0, this.emitUpdate(this.state)), this.menuFrozen = !1;
6401
+ c(this, "onMouseDown", () => {
6402
+ this.state && this.state.show && this.menuFrozen && (this.menuFrozen = !1, this.state.show = !1, this.emitUpdate(this.state));
6350
6403
  });
6351
6404
  c(this, "onMouseMove", (e) => {
6352
- var d, u, p, h, m;
6353
- if (this.menuFrozen)
6354
- return;
6355
- const o = this.pmView.dom.firstChild.getBoundingClientRect(), i = this.pmView.dom.getBoundingClientRect(), n = e.clientX >= i.left && e.clientX <= i.right && e.clientY >= i.top && e.clientY <= i.bottom, r = this.pmView.dom.parentElement;
6405
+ var r;
6406
+ this.mousePos = { x: e.clientX, y: e.clientY };
6407
+ const o = this.pmView.dom.getBoundingClientRect(), i = this.mousePos.x > o.left && this.mousePos.x < o.right && this.mousePos.y > o.top && this.mousePos.y < o.bottom, n = this.pmView.dom.parentElement;
6356
6408
  if (
6357
6409
  // Cursor is within the editor area
6358
- n && // An element is hovered
6410
+ i && // An element is hovered
6359
6411
  e && e.target && // Element is outside the editor
6360
- !(r === e.target || r.contains(e.target))
6412
+ !(n === e.target || n.contains(e.target))
6361
6413
  ) {
6362
- (d = this.state) != null && d.show && (this.state.show = !1, this.emitUpdate(this.state));
6363
- return;
6364
- }
6365
- this.horizontalPosAnchor = o.x;
6366
- const a = {
6367
- left: o.left + o.width / 2,
6368
- // take middle of editor
6369
- top: e.clientY
6370
- }, s = Te(a, this.pmView);
6371
- if (!s || !this.editor.isEditable) {
6372
- (u = this.state) != null && u.show && (this.state.show = !1, this.emitUpdate(this.state));
6373
- return;
6374
- }
6375
- if ((p = this.state) != null && p.show && ((h = this.hoveredBlock) != null && h.hasAttribute("data-id")) && ((m = this.hoveredBlock) == null ? void 0 : m.getAttribute("data-id")) === s.id)
6414
+ (r = this.state) != null && r.show && (this.state.show = !1, this.emitUpdate(this.state));
6376
6415
  return;
6377
- this.hoveredBlock = s.node;
6378
- const l = s.node.firstChild;
6379
- if (l && this.editor.isEditable) {
6380
- const f = l.getBoundingClientRect();
6381
- this.state = {
6382
- show: !0,
6383
- referencePos: new DOMRect(
6384
- this.horizontalPosAnchoredAtRoot ? this.horizontalPosAnchor : f.x,
6385
- f.y,
6386
- f.width,
6387
- f.height
6388
- ),
6389
- block: this.editor.getBlock(
6390
- this.hoveredBlock.getAttribute("data-id")
6391
- )
6392
- }, this.emitUpdate(this.state);
6393
6416
  }
6417
+ this.updateState(), this.needUpdate && (this.emitUpdate(this.state), this.needUpdate = !1);
6394
6418
  });
6395
6419
  c(this, "onScroll", () => {
6396
6420
  var e;
@@ -6408,15 +6432,27 @@ class mn {
6408
6432
  if (!this.state)
6409
6433
  throw new Error("Attempting to update uninitialized side menu");
6410
6434
  i(this.state);
6411
- }, this.horizontalPosAnchoredAtRoot = !0, this.horizontalPosAnchor = this.pmView.dom.firstChild.getBoundingClientRect().x, document.body.addEventListener("drop", this.onDrop, !0), document.body.addEventListener("dragover", this.onDragOver), this.pmView.dom.addEventListener("dragstart", this.onDragStart), document.body.addEventListener("mousemove", this.onMouseMove, !0), document.addEventListener("scroll", this.onScroll), document.body.addEventListener("mousedown", this.onMouseDown, !0), document.body.addEventListener("keydown", this.onKeyDown, !0);
6435
+ }, this.horizontalPosAnchoredAtRoot = !0, this.horizontalPosAnchor = this.pmView.dom.firstChild.getBoundingClientRect().x, document.body.addEventListener("drop", this.onDrop, !0), document.body.addEventListener("dragover", this.onDragOver), this.pmView.dom.addEventListener("dragstart", this.onDragStart), document.body.addEventListener("mousemove", this.onMouseMove, !0), this.pmView.dom.addEventListener("mousedown", this.onMouseDown), document.body.addEventListener("keydown", this.onKeyDown, !0), document.addEventListener("scroll", this.onScroll, !0);
6436
+ }
6437
+ // Needed in cases where the editor state updates without the mouse cursor
6438
+ // moving, as some state updates can require a side menu update. For example,
6439
+ // adding a button to the side menu which removes the block can cause the
6440
+ // block below to jump up into the place of the removed block when clicked,
6441
+ // allowing the user to click the button again without moving the cursor. This
6442
+ // would otherwise not update the side menu, and so clicking the button again
6443
+ // would attempt to remove the same block again, causing an error.
6444
+ update() {
6445
+ var o;
6446
+ const e = (o = this.state) == null ? void 0 : o.block.id;
6447
+ this.updateState(), this.needUpdate && this.state && e !== this.state.block.id && (this.emitUpdate(this.state), this.needUpdate = !1);
6412
6448
  }
6413
6449
  destroy() {
6414
6450
  var e;
6415
- (e = this.state) != null && e.show && (this.state.show = !1, this.emitUpdate(this.state)), document.body.removeEventListener("mousemove", this.onMouseMove, !0), document.body.removeEventListener("dragover", this.onDragOver), this.pmView.dom.removeEventListener("dragstart", this.onDragStart), document.body.removeEventListener("drop", this.onDrop, !0), document.removeEventListener("scroll", this.onScroll), document.body.removeEventListener("mousedown", this.onMouseDown, !0), document.body.removeEventListener("keydown", this.onKeyDown, !0);
6451
+ (e = this.state) != null && e.show && (this.state.show = !1, this.emitUpdate(this.state)), document.body.removeEventListener("mousemove", this.onMouseMove, !0), document.body.removeEventListener("dragover", this.onDragOver), this.pmView.dom.removeEventListener("dragstart", this.onDragStart), document.body.removeEventListener("drop", this.onDrop, !0), document.removeEventListener("scroll", this.onScroll, !0), this.pmView.dom.removeEventListener("mousedown", this.onMouseDown), document.body.removeEventListener("keydown", this.onKeyDown, !0);
6416
6452
  }
6417
6453
  addBlock() {
6418
6454
  var l;
6419
- (l = this.state) != null && l.show && (this.state.show = !1, this.emitUpdate(this.state)), this.menuFrozen = !0;
6455
+ (l = this.state) != null && l.show && (this.state.show = !1, this.emitUpdate(this.state));
6420
6456
  const o = this.hoveredBlock.firstChild.getBoundingClientRect(), i = this.pmView.posAtCoords({
6421
6457
  left: o.left + o.width / 2,
6422
6458
  top: o.top + o.height / 2
@@ -6436,7 +6472,7 @@ class mn {
6436
6472
  } else
6437
6473
  this.editor._tiptapEditor.commands.setTextSelection(a + 1);
6438
6474
  this.pmView.focus(), this.pmView.dispatch(
6439
- this.pmView.state.tr.scrollIntoView().setMeta(D, {
6475
+ this.pmView.state.tr.scrollIntoView().setMeta(O, {
6440
6476
  triggerCharacter: "/",
6441
6477
  fromUserInput: !1
6442
6478
  })
@@ -6444,7 +6480,7 @@ class mn {
6444
6480
  }
6445
6481
  }
6446
6482
  const fn = new S("SideMenuPlugin");
6447
- class gn extends K {
6483
+ class gn extends X {
6448
6484
  constructor(o) {
6449
6485
  super();
6450
6486
  c(this, "view");
@@ -6475,8 +6511,10 @@ class gn extends K {
6475
6511
  * attached to the same block regardless of which block is hovered by the
6476
6512
  * mouse cursor.
6477
6513
  */
6478
- c(this, "unfreezeMenu", () => this.view.menuFrozen = !1);
6479
- this.editor = o, this.plugin = new _({
6514
+ c(this, "unfreezeMenu", () => {
6515
+ this.view.menuFrozen = !1, this.view.state.show = !1, this.view.emitUpdate(this.view.state);
6516
+ });
6517
+ this.editor = o, this.plugin = new v({
6480
6518
  key: fn,
6481
6519
  view: (i) => (this.view = new mn(o, i, (n) => {
6482
6520
  this.emit("update", n);
@@ -6494,7 +6532,7 @@ function Ge() {
6494
6532
  function bn() {
6495
6533
  E && (document.body.removeChild(E), E = void 0);
6496
6534
  }
6497
- function te(t) {
6535
+ function ie(t) {
6498
6536
  return Array.prototype.indexOf.call(t.parentElement.childNodes, t);
6499
6537
  }
6500
6538
  function kn(t) {
@@ -6509,7 +6547,7 @@ function yn(t) {
6509
6547
  o[i].style.visibility = "hidden";
6510
6548
  });
6511
6549
  }
6512
- class vn {
6550
+ class wn {
6513
6551
  constructor(e, o, i) {
6514
6552
  c(this, "state");
6515
6553
  c(this, "emitUpdate");
@@ -6526,7 +6564,7 @@ class vn {
6526
6564
  (d = this.state) != null && d.show && (this.state.show = !1, this.emitUpdate());
6527
6565
  return;
6528
6566
  }
6529
- const i = te(o), n = te(o.parentElement), r = o.getBoundingClientRect(), a = o.parentElement.parentElement.getBoundingClientRect(), s = Te(r, this.pmView);
6567
+ const i = ie(o), n = ie(o.parentElement), r = o.getBoundingClientRect(), a = o.parentElement.parentElement.getBoundingClientRect(), s = pe(o, this.pmView);
6530
6568
  if (!s)
6531
6569
  return;
6532
6570
  let l;
@@ -6535,7 +6573,7 @@ class vn {
6535
6573
  return !1;
6536
6574
  if (u.type.name !== "blockContainer" || u.attrs.id !== s.id)
6537
6575
  return !0;
6538
- const h = v(
6576
+ const h = w(
6539
6577
  u,
6540
6578
  this.editor.schema.blockSchema,
6541
6579
  this.editor.schema.inlineContentSchema,
@@ -6581,11 +6619,11 @@ class vn {
6581
6619
  );
6582
6620
  const n = i[0];
6583
6621
  let r = !1;
6584
- const a = te(n.parentElement), s = te(n), l = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, u = (this.state.draggingState.draggedCellOrientation === "row" ? a : s) !== l;
6622
+ const a = ie(n.parentElement), s = ie(n), l = this.state.draggingState.draggedCellOrientation === "row" ? this.state.rowIndex : this.state.colIndex, u = (this.state.draggingState.draggedCellOrientation === "row" ? a : s) !== l;
6585
6623
  (this.state.rowIndex !== a || this.state.colIndex !== s) && (this.state.rowIndex = a, this.state.colIndex = s, this.state.referencePosCell = n.getBoundingClientRect(), r = !0);
6586
6624
  const p = this.state.draggingState.draggedCellOrientation === "row" ? o.top : o.left;
6587
6625
  this.state.draggingState.mousePos !== p && (this.state.draggingState.mousePos = p, r = !0), r && this.emitUpdate(), u && this.pmView.dispatch(
6588
- this.pmView.state.tr.setMeta(J, !0)
6626
+ this.pmView.state.tr.setMeta(Q, !0)
6589
6627
  );
6590
6628
  });
6591
6629
  c(this, "dropHandler", (e) => {
@@ -6627,14 +6665,14 @@ class vn {
6627
6665
  if (!this.state)
6628
6666
  throw new Error("Attempting to update uninitialized image toolbar");
6629
6667
  i(this.state);
6630
- }, o.dom.addEventListener("mousemove", this.mouseMoveHandler), document.addEventListener("dragover", this.dragOverHandler), document.addEventListener("drop", this.dropHandler), document.addEventListener("scroll", this.scrollHandler);
6668
+ }, o.dom.addEventListener("mousemove", this.mouseMoveHandler), document.addEventListener("dragover", this.dragOverHandler), document.addEventListener("drop", this.dropHandler), document.addEventListener("scroll", this.scrollHandler, !0);
6631
6669
  }
6632
6670
  destroy() {
6633
- this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler), document.removeEventListener("dragover", this.dragOverHandler), document.removeEventListener("drop", this.dropHandler), document.removeEventListener("scroll", this.scrollHandler);
6671
+ this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler), document.removeEventListener("dragover", this.dragOverHandler), document.removeEventListener("drop", this.dropHandler), document.removeEventListener("scroll", this.scrollHandler, !0);
6634
6672
  }
6635
6673
  }
6636
- const J = new S("TableHandlesPlugin");
6637
- class _n extends K {
6674
+ const Q = new S("TableHandlesPlugin");
6675
+ class vn extends X {
6638
6676
  constructor(o) {
6639
6677
  super();
6640
6678
  c(this, "view");
@@ -6653,7 +6691,7 @@ class _n extends K {
6653
6691
  originalIndex: this.view.state.colIndex,
6654
6692
  mousePos: o.clientX
6655
6693
  }, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
6656
- this.editor._tiptapEditor.state.tr.setMeta(J, {
6694
+ this.editor._tiptapEditor.state.tr.setMeta(Q, {
6657
6695
  draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
6658
6696
  originalIndex: this.view.state.colIndex,
6659
6697
  newIndex: this.view.state.colIndex,
@@ -6675,7 +6713,7 @@ class _n extends K {
6675
6713
  originalIndex: this.view.state.rowIndex,
6676
6714
  mousePos: o.clientY
6677
6715
  }, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
6678
- this.editor._tiptapEditor.state.tr.setMeta(J, {
6716
+ this.editor._tiptapEditor.state.tr.setMeta(Q, {
6679
6717
  draggedCellOrientation: this.view.state.draggingState.draggedCellOrientation,
6680
6718
  originalIndex: this.view.state.rowIndex,
6681
6719
  newIndex: this.view.state.rowIndex,
@@ -6693,7 +6731,7 @@ class _n extends K {
6693
6731
  "Attempted to drag table row, but no table block was hovered prior."
6694
6732
  );
6695
6733
  this.view.state.draggingState = void 0, this.view.emitUpdate(), this.editor._tiptapEditor.view.dispatch(
6696
- this.editor._tiptapEditor.state.tr.setMeta(J, null)
6734
+ this.editor._tiptapEditor.state.tr.setMeta(Q, null)
6697
6735
  ), bn();
6698
6736
  });
6699
6737
  /**
@@ -6710,9 +6748,9 @@ class _n extends K {
6710
6748
  c(this, "unfreezeHandles", () => {
6711
6749
  this.view.menuFrozen = !1;
6712
6750
  });
6713
- this.editor = o, this.plugin = new _({
6714
- key: J,
6715
- view: (i) => (this.view = new vn(o, i, (n) => {
6751
+ this.editor = o, this.plugin = new v({
6752
+ key: Q,
6753
+ view: (i) => (this.view = new wn(o, i, (n) => {
6716
6754
  this.emit("update", n);
6717
6755
  }), this.view),
6718
6756
  // We use decorations to render the drop cursor when dragging a table row
@@ -6723,7 +6761,7 @@ class _n extends K {
6723
6761
  return;
6724
6762
  const n = this.view.state.draggingState.draggedCellOrientation === "row" ? this.view.state.rowIndex : this.view.state.colIndex, r = [];
6725
6763
  if (n === this.view.state.draggingState.originalIndex)
6726
- return F.create(i.doc, r);
6764
+ return G.create(i.doc, r);
6727
6765
  const a = i.doc.resolve(this.view.tablePos + 1), s = a.node();
6728
6766
  if (this.view.state.draggingState.draggedCellOrientation === "row") {
6729
6767
  const l = i.doc.resolve(
@@ -6735,7 +6773,7 @@ class _n extends K {
6735
6773
  ), h = p.node(), m = p.pos + (n > this.view.state.draggingState.originalIndex ? h.nodeSize - 2 : 0);
6736
6774
  r.push(
6737
6775
  // The widget is a small bar which spans the width of the cell.
6738
- G.widget(m, () => {
6776
+ W.widget(m, () => {
6739
6777
  const f = document.createElement("div");
6740
6778
  return f.className = "bn-table-drop-cursor", f.style.left = "0", f.style.right = "0", n > this.view.state.draggingState.originalIndex ? f.style.bottom = "-2px" : f.style.top = "-3px", f.style.height = "4px", f;
6741
6779
  })
@@ -6750,13 +6788,13 @@ class _n extends K {
6750
6788
  ), p = u.node(), h = u.pos + (n > this.view.state.draggingState.originalIndex ? p.nodeSize - 2 : 0);
6751
6789
  r.push(
6752
6790
  // The widget is a small bar which spans the height of the cell.
6753
- G.widget(h, () => {
6791
+ W.widget(h, () => {
6754
6792
  const m = document.createElement("div");
6755
6793
  return m.className = "bn-table-drop-cursor", m.style.top = "0", m.style.bottom = "0", n > this.view.state.draggingState.originalIndex ? m.style.right = "-2px" : m.style.left = "-3px", m.style.width = "4px", m;
6756
6794
  })
6757
6795
  );
6758
6796
  }
6759
- return F.create(i.doc, r);
6797
+ return G.create(i.doc, r);
6760
6798
  }
6761
6799
  }
6762
6800
  });
@@ -6769,23 +6807,23 @@ function We(t, e) {
6769
6807
  const o = t.state.selection.content().content, n = nt(
6770
6808
  t.state.schema,
6771
6809
  e
6772
- ).serializeProseMirrorFragment(o), a = re(
6810
+ ).serializeProseMirrorFragment(o), a = ae(
6773
6811
  t.state.schema,
6774
6812
  e
6775
- ).exportProseMirrorFragment(o), s = Me(a);
6813
+ ).exportProseMirrorFragment(o), s = Te(a);
6776
6814
  return { internalHTML: n, externalHTML: a, plainText: s };
6777
6815
  }
6778
- const wn = (t) => B.create({
6816
+ const _n = (t) => B.create({
6779
6817
  name: "copyToClipboard",
6780
6818
  addProseMirrorPlugins() {
6781
6819
  return [
6782
- new _({
6820
+ new v({
6783
6821
  props: {
6784
6822
  handleDOMEvents: {
6785
6823
  copy(e, o) {
6786
6824
  o.preventDefault(), o.clipboardData.clearData(), "node" in e.state.selection && e.state.selection.node.type.spec.group === "blockContent" && e.dispatch(
6787
6825
  e.state.tr.setSelection(
6788
- new oe(
6826
+ new ne(
6789
6827
  e.state.doc.resolve(e.state.selection.from - 1)
6790
6828
  )
6791
6829
  )
@@ -6801,7 +6839,7 @@ const wn = (t) => B.create({
6801
6839
  return;
6802
6840
  e.dispatch(
6803
6841
  e.state.tr.setSelection(
6804
- new oe(
6842
+ new ne(
6805
6843
  e.state.doc.resolve(e.state.selection.from - 1)
6806
6844
  )
6807
6845
  )
@@ -6822,11 +6860,12 @@ const wn = (t) => B.create({
6822
6860
  name: "pasteFromClipboard",
6823
6861
  addProseMirrorPlugins() {
6824
6862
  return [
6825
- new _({
6863
+ new v({
6826
6864
  props: {
6827
6865
  handleDOMEvents: {
6828
6866
  paste(e, o) {
6829
- o.preventDefault();
6867
+ if (o.preventDefault(), !t.isEditable)
6868
+ return;
6830
6869
  let i = null;
6831
6870
  for (const n of xn)
6832
6871
  if (o.clipboardData.types.includes(n)) {
@@ -6913,7 +6952,7 @@ const wn = (t) => B.create({
6913
6952
  addProseMirrorPlugins() {
6914
6953
  const t = new S(this.name);
6915
6954
  return [
6916
- new _({
6955
+ new v({
6917
6956
  key: t,
6918
6957
  appendTransaction: (e, o, i) => {
6919
6958
  const { doc: n, tr: r, schema: a } = i, s = t.getState(i), l = n.content.size - 2, d = a.nodes.blockContainer, u = a.nodes.paragraph;
@@ -6943,7 +6982,7 @@ const wn = (t) => B.create({
6943
6982
  })
6944
6983
  ];
6945
6984
  }
6946
- }), Bn = new S("non-editable-block"), Ln = () => new _({
6985
+ }), Bn = new S("non-editable-block"), Ln = () => new v({
6947
6986
  key: Bn,
6948
6987
  props: {
6949
6988
  handleKeyDown: (t, e) => {
@@ -6959,7 +6998,7 @@ const wn = (t) => B.create({
6959
6998
  t.state.tr.selection.$to.after(),
6960
6999
  t.state.schema.nodes.paragraph.create()
6961
7000
  ).setSelection(
6962
- new Z(
7001
+ new Y(
6963
7002
  o.doc.resolve(t.state.tr.selection.$to.after() + 1)
6964
7003
  )
6965
7004
  )
@@ -6969,7 +7008,7 @@ const wn = (t) => B.create({
6969
7008
  return !1;
6970
7009
  }
6971
7010
  }
6972
- }), $e = new S("previous-blocks"), In = {
7011
+ }), Ke = new S("previous-blocks"), In = {
6973
7012
  // Numbered List Items
6974
7013
  index: "index",
6975
7014
  // Headings
@@ -6980,15 +7019,15 @@ const wn = (t) => B.create({
6980
7019
  "depth-change": "depth-change"
6981
7020
  }, An = () => {
6982
7021
  let t;
6983
- return new _({
6984
- key: $e,
7022
+ return new v({
7023
+ key: Ke,
6985
7024
  view(e) {
6986
7025
  return {
6987
7026
  update: async (o, i) => {
6988
7027
  var n;
6989
7028
  ((n = this.key) == null ? void 0 : n.getState(o.state).updatedBlocks.size) > 0 && (t = setTimeout(() => {
6990
7029
  o.dispatch(
6991
- o.state.tr.setMeta($e, { clearUpdate: !0 })
7030
+ o.state.tr.setMeta(Ke, { clearUpdate: !0 })
6992
7031
  );
6993
7032
  }, 0));
6994
7033
  },
@@ -7047,11 +7086,11 @@ const wn = (t) => B.create({
7047
7086
  const a = o.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
7048
7087
  for (const [d, u] of Object.entries(a))
7049
7088
  s["data-prev-" + In[d]] = u || "none";
7050
- const l = G.node(r, r + n.nodeSize, {
7089
+ const l = W.node(r, r + n.nodeSize, {
7051
7090
  ...s
7052
7091
  });
7053
7092
  i.push(l);
7054
- }), F.create(e.doc, i);
7093
+ }), G.create(e.doc, i);
7055
7094
  }
7056
7095
  }
7057
7096
  });
@@ -7061,7 +7100,7 @@ const wn = (t) => B.create({
7061
7100
  id: "data-id",
7062
7101
  depth: "data-depth",
7063
7102
  depthChange: "data-depth-change"
7064
- }, Pn = W.create({
7103
+ }, Pn = $.create({
7065
7104
  name: "blockContainer",
7066
7105
  group: "blockContainer",
7067
7106
  // A block always contains content, and optionally a blockGroup which contains nested blocks
@@ -7094,7 +7133,7 @@ const wn = (t) => B.create({
7094
7133
  ...((n = this.options.domAttributes) == null ? void 0 : n.block) || {},
7095
7134
  ...t
7096
7135
  }, i = document.createElement("div");
7097
- i.className = O("bn-block", o.class), i.setAttribute("data-node-type", this.name);
7136
+ i.className = R("bn-block", o.class), i.setAttribute("data-node-type", this.name);
7098
7137
  for (const [r, a] of Object.entries(o))
7099
7138
  r !== "class" && i.setAttribute(r, a);
7100
7139
  return e.appendChild(i), {
@@ -7128,7 +7167,7 @@ const wn = (t) => B.create({
7128
7167
  const h = [];
7129
7168
  for (const m of e.children)
7130
7169
  h.push(
7131
- N(
7170
+ P(
7132
7171
  m,
7133
7172
  o.schema,
7134
7173
  this.options.editor.schema.styleSchema
@@ -7137,7 +7176,7 @@ const wn = (t) => B.create({
7137
7176
  s.childCount === 2 ? o.tr.replace(
7138
7177
  r + l.nodeSize + 1,
7139
7178
  a - 1,
7140
- new U(T.from(h), 0, 0)
7179
+ new D(T.from(h), 0, 0)
7141
7180
  ) : o.tr.insert(
7142
7181
  r + l.nodeSize,
7143
7182
  o.schema.nodes.blockGroup.create({}, h)
@@ -7147,9 +7186,13 @@ const wn = (t) => B.create({
7147
7186
  let p = "keep";
7148
7187
  if (e.content)
7149
7188
  if (typeof e.content == "string")
7150
- p = [o.schema.text(e.content)];
7189
+ p = K(
7190
+ [e.content],
7191
+ o.schema,
7192
+ this.options.editor.schema.styleSchema
7193
+ );
7151
7194
  else if (Array.isArray(e.content))
7152
- p = ne(
7195
+ p = K(
7153
7196
  e.content,
7154
7197
  o.schema,
7155
7198
  this.options.editor.schema.styleSchema
@@ -7161,7 +7204,7 @@ const wn = (t) => B.create({
7161
7204
  this.options.editor.schema.styleSchema
7162
7205
  );
7163
7206
  else
7164
- throw new I(e.content.type);
7207
+ throw new L(e.content.type);
7165
7208
  else {
7166
7209
  const h = o.schema.nodes[d].spec.content, m = o.schema.nodes[u].spec.content;
7167
7210
  h === "" || m !== h && (p = []);
@@ -7184,11 +7227,11 @@ const wn = (t) => B.create({
7184
7227
  p
7185
7228
  )
7186
7229
  ).setSelection(
7187
- o.schema.nodes[u].spec.content === "" ? new oe(o.tr.doc.resolve(r)) : o.schema.nodes[u].spec.content === "inline*" ? new Z(o.tr.doc.resolve(r)) : (
7230
+ o.schema.nodes[u].spec.content === "" ? new ne(o.tr.doc.resolve(r)) : o.schema.nodes[u].spec.content === "inline*" ? new Y(o.tr.doc.resolve(r)) : (
7188
7231
  // Need to offset the position as we have to get through the
7189
7232
  // `tableRow` and `tableCell` nodes to get to the
7190
7233
  // `tableParagraph` node we want to set the selection in.
7191
- new Z(o.tr.doc.resolve(r + 4))
7234
+ new Y(o.tr.doc.resolve(r + 4))
7192
7235
  )
7193
7236
  ), o.tr.setNodeMarkup(r - 1, void 0, {
7194
7237
  ...s.attrs,
@@ -7236,10 +7279,10 @@ const wn = (t) => B.create({
7236
7279
  e.tr.deleteRange(l, l + s.nodeSize).replace(
7237
7280
  p - 1,
7238
7281
  l,
7239
- new U(s.content, 0, 0)
7282
+ new D(s.content, 0, 0)
7240
7283
  ).scrollIntoView()
7241
7284
  ), e.tr.setSelection(
7242
- new Z(e.doc.resolve(p - 1))
7285
+ new Y(e.doc.resolve(p - 1))
7243
7286
  )), !0;
7244
7287
  },
7245
7288
  // Splits a block at a given position. Content after the position is moved to a new block below, at the same
@@ -7256,7 +7299,7 @@ const wn = (t) => B.create({
7256
7299
  return n && (i.tr.insert(f, m), i.tr.replace(
7257
7300
  g,
7258
7301
  g + 1,
7259
- h.content.size > 0 ? new U(
7302
+ h.content.size > 0 ? new D(
7260
7303
  T.from(h),
7261
7304
  u + 2,
7262
7305
  u + 2
@@ -7267,11 +7310,11 @@ const wn = (t) => B.create({
7267
7310
  i.schema.node(s).type,
7268
7311
  o ? a.attrs : void 0
7269
7312
  ), i.tr.setSelection(
7270
- new Z(i.doc.resolve(g))
7313
+ new Y(i.doc.resolve(g))
7271
7314
  ), i.tr.replace(
7272
7315
  l + 1,
7273
7316
  d - 1,
7274
- p.content.size > 0 ? new U(
7317
+ p.content.size > 0 ? new D(
7275
7318
  T.from(p),
7276
7319
  u + 2,
7277
7320
  u + 2
@@ -7343,19 +7386,19 @@ const wn = (t) => B.create({
7343
7386
  // Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
7344
7387
  // of the block.
7345
7388
  () => i.command(({ state: n }) => {
7346
- const { node: r, depth: a } = b(
7389
+ const { contentNode: r, depth: a } = b(
7347
7390
  n.doc,
7348
7391
  n.selection.from
7349
- ), s = n.selection.$anchor.parentOffset === 0, l = n.selection.anchor === n.selection.head, d = r.textContent.length === 0, u = a > 2;
7392
+ ), s = n.selection.$anchor.parentOffset === 0, l = n.selection.anchor === n.selection.head, d = r.childCount === 0, u = a > 2;
7350
7393
  return s && l && d && u ? i.liftListItem("blockContainer") : !1;
7351
7394
  }),
7352
7395
  // Creates a new block and moves the selection to it if the current one is empty, while the selection is also
7353
7396
  // empty & at the start of the block.
7354
7397
  () => i.command(({ state: n, chain: r }) => {
7355
- const { node: a, endPos: s } = b(
7398
+ const { contentNode: a, endPos: s } = b(
7356
7399
  n.doc,
7357
7400
  n.selection.from
7358
- ), l = n.selection.$anchor.parentOffset === 0, d = n.selection.anchor === n.selection.head, u = a.textContent.length === 0;
7401
+ ), l = n.selection.$anchor.parentOffset === 0, d = n.selection.anchor === n.selection.head, u = a.childCount === 0;
7359
7402
  if (l && d && u) {
7360
7403
  const p = s + 1, h = p + 2;
7361
7404
  return r().BNCreateBlock(p).setTextSelection(h).run(), !0;
@@ -7365,11 +7408,11 @@ const wn = (t) => B.create({
7365
7408
  // Splits the current block, moving content inside that's after the cursor to a new text block below. Also
7366
7409
  // deletes the selection beforehand, if it's not empty.
7367
7410
  () => i.command(({ state: n, chain: r }) => {
7368
- const { node: a } = b(
7411
+ const { contentNode: a } = b(
7369
7412
  n.doc,
7370
7413
  n.selection.from
7371
7414
  ), s = n.selection.$anchor.parentOffset === 0;
7372
- return a.textContent.length === 0 ? !1 : (r().deleteSelection().BNSplitBlock(
7415
+ return a.childCount === 0 ? !1 : (r().deleteSelection().BNSplitBlock(
7373
7416
  n.selection.from,
7374
7417
  s,
7375
7418
  s
@@ -7388,7 +7431,7 @@ const wn = (t) => B.create({
7388
7431
  }
7389
7432
  };
7390
7433
  }
7391
- }), Hn = W.create({
7434
+ }), Hn = $.create({
7392
7435
  name: "blockGroup",
7393
7436
  group: "blockGroup",
7394
7437
  content: "blockContainer+",
@@ -7406,7 +7449,7 @@ const wn = (t) => B.create({
7406
7449
  ...((i = this.options.domAttributes) == null ? void 0 : i.blockGroup) || {},
7407
7450
  ...t
7408
7451
  }, o = document.createElement("div");
7409
- o.className = O(
7452
+ o.className = R(
7410
7453
  "bn-block-group",
7411
7454
  e.class
7412
7455
  ), o.setAttribute("data-node-type", "blockGroup");
@@ -7417,22 +7460,22 @@ const wn = (t) => B.create({
7417
7460
  contentDOM: o
7418
7461
  };
7419
7462
  }
7420
- }), Un = W.create({
7463
+ }), Un = $.create({
7421
7464
  name: "doc",
7422
7465
  topNode: !0,
7423
7466
  content: "blockGroup"
7424
7467
  }), Dn = (t) => {
7425
7468
  var o;
7426
7469
  const e = [
7427
- X.ClipboardTextSerializer,
7428
- X.Commands,
7429
- X.Editable,
7430
- X.FocusEvents,
7431
- X.Tabindex,
7470
+ J.ClipboardTextSerializer,
7471
+ J.Commands,
7472
+ J.Editable,
7473
+ J.FocusEvents,
7474
+ J.Tabindex,
7432
7475
  // DevTools,
7433
7476
  so,
7434
7477
  // DropCursor,
7435
- ee.configure({
7478
+ oe.configure({
7436
7479
  types: ["blockContainer"]
7437
7480
  }),
7438
7481
  lo.extend({ priority: 10 }),
@@ -7440,7 +7483,13 @@ const wn = (t) => B.create({
7440
7483
  // basics:
7441
7484
  po,
7442
7485
  // marks:
7443
- uo,
7486
+ uo.extend({
7487
+ addKeyboardShortcuts() {
7488
+ return {
7489
+ "Mod-k": () => (this.editor.commands.toggleLink({ href: "" }), !0)
7490
+ };
7491
+ }
7492
+ }),
7444
7493
  ...Object.values(t.styleSpecs).map((i) => i.implementation.mark),
7445
7494
  Mn,
7446
7495
  Cn,
@@ -7480,7 +7529,7 @@ const wn = (t) => B.create({
7480
7529
  domAttributes: t.domAttributes
7481
7530
  })
7482
7531
  ]),
7483
- wn(t.editor),
7532
+ _n(t.editor),
7484
7533
  En(t.editor),
7485
7534
  ao.configure({ width: 5, color: "#ddeeff" }),
7486
7535
  // This needs to be at the bottom of this list, because Key events (such as enter, when selecting a /command),
@@ -7534,7 +7583,7 @@ function Rn(t, e) {
7534
7583
  );
7535
7584
  o = o.replaceChild(i, r);
7536
7585
  }
7537
- return new U(o, t.openStart, t.openEnd);
7586
+ return new D(o, t.openStart, t.openEnd);
7538
7587
  }
7539
7588
  function ge(t) {
7540
7589
  return t && Object.fromEntries(
@@ -7585,7 +7634,7 @@ class Vn extends Ot {
7585
7634
  let s;
7586
7635
  try {
7587
7636
  const l = o == null ? void 0 : o.content.map(
7588
- (d) => N(d, this.schema, i).toJSON()
7637
+ (d) => P(d, this.schema, i).toJSON()
7589
7638
  );
7590
7639
  s = Rt(
7591
7640
  {
@@ -7641,27 +7690,27 @@ class Vn extends Ot {
7641
7690
  });
7642
7691
  }
7643
7692
  }
7644
- const jn = new S("blocknote-placeholder"), zn = (t, e) => new _({
7693
+ const jn = new S("blocknote-placeholder"), zn = (t, e) => new v({
7645
7694
  key: jn,
7646
7695
  view: () => {
7647
- const o = document.createElement("style");
7648
- document.head.appendChild(o);
7649
- const i = o.sheet, n = (a = "") => `.bn-block-content${a} .bn-inline-content:has(> .ProseMirror-trailingBreak):before`, r = (a, s = !0) => {
7650
- const l = s ? "[data-is-empty-and-focused]" : "";
7651
- if (a === "default")
7652
- return n(l);
7653
- const d = `[data-content-type="${a}"]`;
7654
- return n(l + d);
7696
+ const o = document.createElement("style"), i = t._tiptapEditor.options.injectNonce;
7697
+ i && o.setAttribute("nonce", i), document.head.appendChild(o);
7698
+ const n = o.sheet, r = (s = "") => `.bn-block-content${s} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`, a = (s, l = !0) => {
7699
+ const d = l ? "[data-is-empty-and-focused]" : "";
7700
+ if (s === "default")
7701
+ return r(d);
7702
+ const u = `[data-content-type="${s}"]`;
7703
+ return r(d + u);
7655
7704
  };
7656
- for (const [a, s] of Object.entries(e)) {
7657
- const l = a === "default";
7658
- i.insertRule(
7659
- `${r(a, l)}{ content: ${JSON.stringify(
7660
- s
7705
+ for (const [s, l] of Object.entries(e)) {
7706
+ const d = s === "default";
7707
+ n.insertRule(
7708
+ `${a(s, d)}{ content: ${JSON.stringify(
7709
+ l
7661
7710
  )}; }`
7662
- ), l || i.insertRule(
7663
- `${r(a, !0)}{ content: ${JSON.stringify(
7664
- s
7711
+ ), d || n.insertRule(
7712
+ `${a(s, !0)}{ content: ${JSON.stringify(
7713
+ l
7665
7714
  )}; }`
7666
7715
  );
7667
7716
  }
@@ -7680,10 +7729,10 @@ const jn = new S("blocknote-placeholder"), zn = (t, e) => new _({
7680
7729
  const r = n.$anchor, a = r.parent;
7681
7730
  if (a.content.size > 0)
7682
7731
  return null;
7683
- const s = r.before(), l = G.node(s, s + a.nodeSize, {
7732
+ const s = r.before(), l = W.node(s, s + a.nodeSize, {
7684
7733
  "data-is-empty-and-focused": "true"
7685
7734
  });
7686
- return F.create(i, [l]);
7735
+ return G.create(i, [l]);
7687
7736
  }
7688
7737
  }
7689
7738
  });
@@ -7692,7 +7741,7 @@ const Fn = {
7692
7741
  enablePasteRules: !0,
7693
7742
  enableCoreExtensions: !1
7694
7743
  };
7695
- class vt {
7744
+ class wt {
7696
7745
  constructor(e) {
7697
7746
  c(this, "_tiptapEditor");
7698
7747
  c(this, "blockCache", /* @__PURE__ */ new WeakMap());
@@ -7738,7 +7787,7 @@ class vt {
7738
7787
  ...e.placeholders
7739
7788
  }
7740
7789
  };
7741
- this.schema = i.schema, this.blockImplementations = i.schema.blockSpecs, this.inlineContentImplementations = i.schema.inlineContentSpecs, this.styleImplementations = i.schema.styleSpecs, this.formattingToolbar = new nn(this), this.linkToolbar = new sn(this), this.sideMenu = new gn(this), this.suggestionMenus = new cn(this), this.filePanel = new en(this), x("table", this) && (this.tableHandles = new _n(this));
7790
+ this.schema = i.schema, this.blockImplementations = i.schema.blockSpecs, this.inlineContentImplementations = i.schema.inlineContentSpecs, this.styleImplementations = i.schema.styleSpecs, this.formattingToolbar = new nn(this), this.linkToolbar = new sn(this), this.sideMenu = new gn(this), this.suggestionMenus = new cn(this), this.filePanel = new en(this), x("table", this) && (this.tableHandles = new vn(this));
7742
7791
  const n = Dn({
7743
7792
  editor: this,
7744
7793
  domAttributes: i.domAttributes || {},
@@ -7771,7 +7820,7 @@ class vt {
7771
7820
  ] : [
7772
7821
  {
7773
7822
  type: "paragraph",
7774
- id: ee.options.generateID()
7823
+ id: oe.options.generateID()
7775
7824
  }
7776
7825
  ]);
7777
7826
  if (!Array.isArray(a) || a.length === 0)
@@ -7788,7 +7837,7 @@ class vt {
7788
7837
  attributes: {
7789
7838
  ...(h = (p = i._tiptapOptions) == null ? void 0 : p.editorProps) == null ? void 0 : h.attributes,
7790
7839
  ...(m = i.domAttributes) == null ? void 0 : m.editor,
7791
- class: O(
7840
+ class: R(
7792
7841
  "bn-editor",
7793
7842
  i.defaultStyles ? "bn-default-styles" : "",
7794
7843
  ((g = (f = i.domAttributes) == null ? void 0 : f.editor) == null ? void 0 : g.class) || ""
@@ -7803,7 +7852,7 @@ class vt {
7803
7852
  );
7804
7853
  }
7805
7854
  static create(e = {}) {
7806
- return new vt(e);
7855
+ return new wt(e);
7807
7856
  }
7808
7857
  /**
7809
7858
  * Mount the editor to a parent DOM element. Call mount(undefined) to clean up
@@ -7838,7 +7887,7 @@ class vt {
7838
7887
  get document() {
7839
7888
  const e = [];
7840
7889
  return this._tiptapEditor.state.doc.firstChild.descendants((o) => (e.push(
7841
- v(
7890
+ w(
7842
7891
  o,
7843
7892
  this.schema.blockSchema,
7844
7893
  this.schema.inlineContentSchema,
@@ -7855,7 +7904,7 @@ class vt {
7855
7904
  getBlock(e) {
7856
7905
  const o = typeof e == "string" ? e : e.id;
7857
7906
  let i;
7858
- return this._tiptapEditor.state.doc.firstChild.descendants((n) => typeof i < "u" ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== o ? !0 : (i = v(
7907
+ return this._tiptapEditor.state.doc.firstChild.descendants((n) => typeof i < "u" ? !1 : n.type.name !== "blockContainer" || n.attrs.id !== o ? !0 : (i = w(
7859
7908
  n,
7860
7909
  this.schema.blockSchema,
7861
7910
  this.schema.inlineContentSchema,
@@ -7910,21 +7959,21 @@ class vt {
7910
7959
  r > 0 && (s = this._tiptapEditor.state.doc.resolve(i - 2).node());
7911
7960
  let l;
7912
7961
  return r < a - 1 && (l = this._tiptapEditor.state.doc.resolve(n + 2).node()), {
7913
- block: v(
7962
+ block: w(
7914
7963
  e,
7915
7964
  this.schema.blockSchema,
7916
7965
  this.schema.inlineContentSchema,
7917
7966
  this.schema.styleSchema,
7918
7967
  this.blockCache
7919
7968
  ),
7920
- prevBlock: s === void 0 ? void 0 : v(
7969
+ prevBlock: s === void 0 ? void 0 : w(
7921
7970
  s,
7922
7971
  this.schema.blockSchema,
7923
7972
  this.schema.inlineContentSchema,
7924
7973
  this.schema.styleSchema,
7925
7974
  this.blockCache
7926
7975
  ),
7927
- nextBlock: l === void 0 ? void 0 : v(
7976
+ nextBlock: l === void 0 ? void 0 : w(
7928
7977
  l,
7929
7978
  this.schema.blockSchema,
7930
7979
  this.schema.inlineContentSchema,
@@ -7940,7 +7989,7 @@ class vt {
7940
7989
  * @param placement Whether the text cursor should be placed at the start or end of the block.
7941
7990
  */
7942
7991
  setTextCursorPosition(e, o = "start") {
7943
- const i = typeof e == "string" ? e : e.id, { posBeforeNode: n } = Se(i, this._tiptapEditor.state.doc), { startPos: r, contentNode: a } = b(
7992
+ const i = typeof e == "string" ? e : e.id, { posBeforeNode: n } = Me(i, this._tiptapEditor.state.doc), { startPos: r, contentNode: a } = b(
7944
7993
  this._tiptapEditor.state.doc,
7945
7994
  n + 2
7946
7995
  ), s = this.schema.blockSchema[a.type.name].content;
@@ -7957,7 +8006,7 @@ class vt {
7957
8006
  r + a.nodeSize - 4
7958
8007
  );
7959
8008
  else
7960
- throw new I(s);
8009
+ throw new L(s);
7961
8010
  }
7962
8011
  /**
7963
8012
  * Gets a snapshot of the current selection.
@@ -7967,7 +8016,7 @@ class vt {
7967
8016
  return;
7968
8017
  const e = [];
7969
8018
  return this._tiptapEditor.state.doc.descendants((o, i) => o.type.spec.group !== "blockContent" || i + o.nodeSize < this._tiptapEditor.state.selection.from || i > this._tiptapEditor.state.selection.to ? !0 : (e.push(
7970
- v(
8019
+ w(
7971
8020
  this._tiptapEditor.state.doc.resolve(i).node(),
7972
8021
  this.schema.blockSchema,
7973
8022
  this.schema.inlineContentSchema,
@@ -8034,7 +8083,7 @@ class vt {
8034
8083
  * @param content can be a string, or array of partial inline content elements
8035
8084
  */
8036
8085
  insertInlineContent(e) {
8037
- const o = ne(
8086
+ const o = K(
8038
8087
  e,
8039
8088
  this._tiptapEditor.schema,
8040
8089
  this.schema.styleSchema
@@ -8056,7 +8105,7 @@ class vt {
8056
8105
  for (const i of o) {
8057
8106
  const n = this.schema.styleSchema[i.type.name];
8058
8107
  if (!n) {
8059
- console.warn("mark not found in styleschema", i.type.name);
8108
+ i.type.name !== "link" && console.warn("mark not found in styleschema", i.type.name);
8060
8109
  continue;
8061
8110
  }
8062
8111
  n.propSchema === "boolean" ? e[n.type] = !0 : e[n.type] = i.attrs.stringValue;
@@ -8077,7 +8126,7 @@ class vt {
8077
8126
  else if (n.propSchema === "string")
8078
8127
  this._tiptapEditor.commands.setMark(o, { stringValue: i });
8079
8128
  else
8080
- throw new I(n.propSchema);
8129
+ throw new L(n.propSchema);
8081
8130
  }
8082
8131
  }
8083
8132
  /**
@@ -8102,7 +8151,7 @@ class vt {
8102
8151
  else if (n.propSchema === "string")
8103
8152
  this._tiptapEditor.commands.toggleMark(o, { stringValue: i });
8104
8153
  else
8105
- throw new I(n.propSchema);
8154
+ throw new L(n.propSchema);
8106
8155
  }
8107
8156
  }
8108
8157
  /**
@@ -8175,7 +8224,7 @@ class vt {
8175
8224
  * @returns The blocks, serialized as an HTML string.
8176
8225
  */
8177
8226
  async blocksToHTMLLossy(e = this.document) {
8178
- return re(
8227
+ return ae(
8179
8228
  this._tiptapEditor.schema,
8180
8229
  this
8181
8230
  ).exportBlocks(e);
@@ -8265,11 +8314,11 @@ function Gn(t) {
8265
8314
  for (; o === "none"; )
8266
8315
  e = t.getTextCursorPosition().nextBlock, o = t.schema.blockSchema[e.type].content, t.setTextCursorPosition(e, "end");
8267
8316
  }
8268
- function w(t, e) {
8317
+ function _(t, e) {
8269
8318
  const o = t.getTextCursorPosition().block;
8270
8319
  if (o.content === void 0)
8271
8320
  throw new Error("Slash Menu open in a block that doesn't contain content.");
8272
- Array.isArray(o.content) && (o.content.length === 1 && Q(o.content[0]) && o.content[0].type === "text" && o.content[0].text === "/" || o.content.length === 0) ? t.updateBlock(o, e) : (t.insertBlocks([e], o, "after"), t.setTextCursorPosition(
8321
+ Array.isArray(o.content) && (o.content.length === 1 && te(o.content[0]) && o.content[0].type === "text" && o.content[0].text === "/" || o.content.length === 0) ? t.updateBlock(o, e) : (t.insertBlocks([e], o, "after"), t.setTextCursorPosition(
8273
8322
  t.getTextCursorPosition().nextBlock,
8274
8323
  "end"
8275
8324
  ));
@@ -8281,76 +8330,76 @@ function jr(t) {
8281
8330
  return x("heading", t) && e.push(
8282
8331
  {
8283
8332
  onItemClick: () => {
8284
- w(t, {
8333
+ _(t, {
8285
8334
  type: "heading",
8286
8335
  props: { level: 1 }
8287
8336
  });
8288
8337
  },
8289
- badge: P("Mod-Alt-1"),
8338
+ badge: H("Mod-Alt-1"),
8290
8339
  key: "heading",
8291
8340
  ...t.dictionary.slash_menu.heading
8292
8341
  },
8293
8342
  {
8294
8343
  onItemClick: () => {
8295
- w(t, {
8344
+ _(t, {
8296
8345
  type: "heading",
8297
8346
  props: { level: 2 }
8298
8347
  });
8299
8348
  },
8300
- badge: P("Mod-Alt-2"),
8349
+ badge: H("Mod-Alt-2"),
8301
8350
  key: "heading_2",
8302
8351
  ...t.dictionary.slash_menu.heading_2
8303
8352
  },
8304
8353
  {
8305
8354
  onItemClick: () => {
8306
- w(t, {
8355
+ _(t, {
8307
8356
  type: "heading",
8308
8357
  props: { level: 3 }
8309
8358
  });
8310
8359
  },
8311
- badge: P("Mod-Alt-3"),
8360
+ badge: H("Mod-Alt-3"),
8312
8361
  key: "heading_3",
8313
8362
  ...t.dictionary.slash_menu.heading_3
8314
8363
  }
8315
8364
  ), x("numberedListItem", t) && e.push({
8316
8365
  onItemClick: () => {
8317
- w(t, {
8366
+ _(t, {
8318
8367
  type: "numberedListItem"
8319
8368
  });
8320
8369
  },
8321
- badge: P("Mod-Shift-7"),
8370
+ badge: H("Mod-Shift-7"),
8322
8371
  key: "numbered_list",
8323
8372
  ...t.dictionary.slash_menu.numbered_list
8324
8373
  }), x("bulletListItem", t) && e.push({
8325
8374
  onItemClick: () => {
8326
- w(t, {
8375
+ _(t, {
8327
8376
  type: "bulletListItem"
8328
8377
  });
8329
8378
  },
8330
- badge: P("Mod-Shift-8"),
8379
+ badge: H("Mod-Shift-8"),
8331
8380
  key: "bullet_list",
8332
8381
  ...t.dictionary.slash_menu.bullet_list
8333
8382
  }), x("checkListItem", t) && e.push({
8334
8383
  onItemClick: () => {
8335
- w(t, {
8384
+ _(t, {
8336
8385
  type: "checkListItem"
8337
8386
  });
8338
8387
  },
8339
- badge: P("Mod-Shift-9"),
8388
+ badge: H("Mod-Shift-9"),
8340
8389
  key: "check_list",
8341
8390
  ...t.dictionary.slash_menu.check_list
8342
8391
  }), x("paragraph", t) && e.push({
8343
8392
  onItemClick: () => {
8344
- w(t, {
8393
+ _(t, {
8345
8394
  type: "paragraph"
8346
8395
  });
8347
8396
  },
8348
- badge: P("Mod-Alt-0"),
8397
+ badge: H("Mod-Alt-0"),
8349
8398
  key: "paragraph",
8350
8399
  ...t.dictionary.slash_menu.paragraph
8351
8400
  }), x("table", t) && e.push({
8352
8401
  onItemClick: () => {
8353
- w(t, {
8402
+ _(t, {
8354
8403
  type: "table",
8355
8404
  content: {
8356
8405
  type: "tableContent",
@@ -8370,7 +8419,7 @@ function jr(t) {
8370
8419
  ...t.dictionary.slash_menu.table
8371
8420
  }), x("image", t) && e.push({
8372
8421
  onItemClick: () => {
8373
- const o = w(t, {
8422
+ const o = _(t, {
8374
8423
  type: "image"
8375
8424
  });
8376
8425
  t.prosemirrorView.dispatch(
@@ -8383,7 +8432,7 @@ function jr(t) {
8383
8432
  ...t.dictionary.slash_menu.image
8384
8433
  }), x("video", t) && e.push({
8385
8434
  onItemClick: () => {
8386
- const o = w(t, {
8435
+ const o = _(t, {
8387
8436
  type: "video"
8388
8437
  });
8389
8438
  t.prosemirrorView.dispatch(
@@ -8396,7 +8445,7 @@ function jr(t) {
8396
8445
  ...t.dictionary.slash_menu.video
8397
8446
  }), x("audio", t) && e.push({
8398
8447
  onItemClick: () => {
8399
- const o = w(t, {
8448
+ const o = _(t, {
8400
8449
  type: "audio"
8401
8450
  });
8402
8451
  t.prosemirrorView.dispatch(
@@ -8409,7 +8458,7 @@ function jr(t) {
8409
8458
  ...t.dictionary.slash_menu.audio
8410
8459
  }), x("file", t) && e.push({
8411
8460
  onItemClick: () => {
8412
- const o = w(t, {
8461
+ const o = _(t, {
8413
8462
  type: "file"
8414
8463
  });
8415
8464
  t.prosemirrorView.dispatch(
@@ -8438,22 +8487,22 @@ function be(t = "") {
8438
8487
  }
8439
8488
  ] : t;
8440
8489
  }
8441
- function _t(t) {
8490
+ function vt(t) {
8442
8491
  return typeof t == "string" ? be(t) : Array.isArray(t) ? t.flatMap((e) => typeof e == "string" ? be(e) : Ye(e) ? {
8443
8492
  ...e,
8444
8493
  content: be(e.content)
8445
- } : Q(e) ? e : {
8494
+ } : te(e) ? e : {
8446
8495
  props: {},
8447
8496
  ...e,
8448
- content: _t(e.content)
8497
+ content: vt(e.content)
8449
8498
  }) : t;
8450
8499
  }
8451
8500
  function Fr(t, e) {
8452
8501
  return e.map(
8453
- (o) => wt(t, o)
8502
+ (o) => _t(t, o)
8454
8503
  );
8455
8504
  }
8456
- function wt(t, e) {
8505
+ function _t(t, e) {
8457
8506
  const o = {
8458
8507
  id: "",
8459
8508
  type: e.type,
@@ -8468,20 +8517,20 @@ function wt(t, e) {
8468
8517
  }
8469
8518
  ), {
8470
8519
  ...o,
8471
- content: _t(o.content),
8472
- children: o.children.map((i) => wt(t, i))
8520
+ content: vt(o.content),
8521
+ children: o.children.map((i) => _t(t, i))
8473
8522
  };
8474
8523
  }
8475
8524
  function Wn(t) {
8476
- t.id || (t.id = ee.options.generateID()), t.children && $n(t.children);
8525
+ t.id || (t.id = oe.options.generateID()), t.children && Kn(t.children);
8477
8526
  }
8478
- function $n(t) {
8527
+ function Kn(t) {
8479
8528
  for (const e of t)
8480
8529
  Wn(e);
8481
8530
  }
8482
8531
  export {
8483
8532
  li as AudioBlock,
8484
- vt as BlockNoteEditor,
8533
+ wt as BlockNoteEditor,
8485
8534
  Be as BlockNoteSchema,
8486
8535
  Go as FileBlock,
8487
8536
  en as FilePanelProsemirrorPlugin,
@@ -8493,13 +8542,13 @@ export {
8493
8542
  gn as SideMenuProsemirrorPlugin,
8494
8543
  mn as SideMenuView,
8495
8544
  cn as SuggestionMenuProseMirrorPlugin,
8496
- _n as TableHandlesProsemirrorPlugin,
8497
- vn as TableHandlesView,
8498
- ee as UniqueID,
8499
- I as UnreachableCaseError,
8545
+ vn as TableHandlesProsemirrorPlugin,
8546
+ wn as TableHandlesView,
8547
+ oe as UniqueID,
8548
+ L as UnreachableCaseError,
8500
8549
  oi as VideoBlock,
8501
8550
  Wn as addIdsToBlock,
8502
- $n as addIdsToBlocks,
8551
+ Kn as addIdsToBlocks,
8503
8552
  Io as addInlineContentAttributes,
8504
8553
  Ao as addInlineContentKeyboardShortcuts,
8505
8554
  Do as addStyleAttributes,
@@ -8509,8 +8558,8 @@ export {
8509
8558
  ii as audioPropSchema,
8510
8559
  ri as audioRender,
8511
8560
  si as audioToExternalHTML,
8512
- N as blockToNode,
8513
- ie as camelToDataKebab,
8561
+ P as blockToNode,
8562
+ re as camelToDataKebab,
8514
8563
  Rr as checkBlockHasDefaultProp,
8515
8564
  Ui as checkBlockIsDefaultType,
8516
8565
  Ur as checkBlockIsFileBlock,
@@ -8519,24 +8568,24 @@ export {
8519
8568
  Di as checkBlockTypeHasDefaultProp,
8520
8569
  x as checkDefaultBlockTypeInSchema,
8521
8570
  Ee as contentNodeToInlineContent,
8522
- le as createAddFileButton,
8523
- ae as createBlockSpec,
8524
- $ as createBlockSpecFromStronglyTypedTiptapNode,
8525
- se as createDefaultFilePreview,
8526
- re as createExternalHTMLExporter,
8571
+ de as createAddFileButton,
8572
+ se as createBlockSpec,
8573
+ q as createBlockSpecFromStronglyTypedTiptapNode,
8574
+ le as createDefaultFilePreview,
8575
+ ae as createExternalHTMLExporter,
8527
8576
  Ce as createFigureWithCaption,
8528
- V as createFileAndCaptionWrapper,
8577
+ j as createFileAndCaptionWrapper,
8529
8578
  Ir as createInlineContentSpec,
8530
8579
  Po as createInlineContentSpecFromTipTapNode,
8531
8580
  st as createInternalBlockSpec,
8532
8581
  nt as createInternalHTMLSerializer,
8533
8582
  No as createInternalInlineContentSpec,
8534
8583
  ct as createInternalStyleSpec,
8535
- ce as createLinkWithCaption,
8584
+ ue as createLinkWithCaption,
8536
8585
  pt as createResizeHandlesWrapper,
8537
- j as createStronglyTypedTiptapNode,
8586
+ z as createStronglyTypedTiptapNode,
8538
8587
  Ar as createStyleSpec,
8539
- H as createStyleSpecFromTipTapMark,
8588
+ U as createStyleSpecFromTipTapMark,
8540
8589
  Vr as createSuggestionMenu,
8541
8590
  Hi as defaultBlockSchema,
8542
8591
  ht as defaultBlockSpecs,
@@ -8552,47 +8601,47 @@ export {
8552
8601
  Fo as fileToExternalHTML,
8553
8602
  Lr as filenameFromURL,
8554
8603
  zr as filterSuggestionItems,
8555
- P as formatKeyboardShortcut,
8604
+ H as formatKeyboardShortcut,
8556
8605
  on as formattingToolbarPluginKey,
8557
8606
  Bo as getBlockFromPos,
8558
8607
  Dn as getBlockNoteExtensions,
8559
8608
  lt as getBlockSchemaFromSpecs,
8560
8609
  jr as getDefaultSlashMenuItems,
8561
- Te as getDraggableBlockFromCoords,
8610
+ pe as getDraggableBlockFromElement,
8562
8611
  Ho as getInlineContentParseRules,
8563
8612
  dt as getInlineContentSchemaFromSpecs,
8564
8613
  Lo as getParseRules,
8565
8614
  Oo as getStyleParseRules,
8566
8615
  ut as getStyleSchemaFromSpecs,
8567
- $o as imageBlockConfig,
8616
+ Ko as imageBlockConfig,
8568
8617
  qo as imageParse,
8569
8618
  Wo as imagePropSchema,
8570
- Ko as imageRender,
8619
+ $o as imageRender,
8571
8620
  Xo as imageToExternalHTML,
8572
8621
  rt as inheritedProps,
8573
- ne as inlineContentToNodes,
8574
- w as insertOrUpdateBlock,
8622
+ K as inlineContentToNodes,
8623
+ _ as insertOrUpdateBlock,
8575
8624
  To as isAppleOS,
8576
8625
  He as isLinkInlineContent,
8577
8626
  Ye as isPartialLinkInlineContent,
8578
8627
  Br as isSafari,
8579
- Q as isStyledTextInlineContent,
8628
+ te as isStyledTextInlineContent,
8580
8629
  an as linkToolbarPluginKey,
8581
8630
  Mr as locales,
8582
- O as mergeCSSClasses,
8583
- v as nodeToBlock,
8631
+ R as mergeCSSClasses,
8632
+ w as nodeToBlock,
8584
8633
  tt as nodeToCustomInlineContent,
8585
8634
  Oe as parseEmbedElement,
8586
- de as parseFigureElement,
8635
+ ce as parseFigureElement,
8587
8636
  Re as parseImageElement,
8588
- wt as partialBlockToBlockForTesting,
8637
+ _t as partialBlockToBlockForTesting,
8589
8638
  Fr as partialBlocksToBlocksForTesting,
8590
8639
  at as propsToAttributes,
8591
8640
  fn as sideMenuPluginKey,
8592
8641
  Uo as stylePropsToAttributes,
8593
- D as suggestionMenuPluginKey,
8642
+ O as suggestionMenuPluginKey,
8594
8643
  Qe as tableContentToNodes,
8595
- J as tableHandlesPluginKey,
8644
+ Q as tableHandlesPluginKey,
8596
8645
  Nr as uploadToTmpFilesDotOrg_DEV_ONLY,
8597
8646
  Yo as videoBlockConfig,
8598
8647
  ei as videoParse,