@blocknote/core 0.11.0 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/blocknote.js CHANGED
@@ -1,14 +1,14 @@
1
1
  var pe = Object.defineProperty;
2
2
  var he = (n, t, e) => t in n ? pe(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
3
  var u = (n, t, e) => (he(n, typeof t != "symbol" ? t + "" : t, e), e);
4
- import { Slice as z, Fragment as H, DOMSerializer as ht, DOMParser as me, Node as fe } from "prosemirror-model";
5
- import Ot from "rehype-parse";
6
- import _t from "rehype-stringify";
4
+ import { Slice as R, Fragment as H, DOMSerializer as ht, DOMParser as me, Node as fe } from "prosemirror-model";
5
+ import _t from "rehype-parse";
6
+ import Rt from "rehype-stringify";
7
7
  import { unified as mt } from "unified";
8
- import { Extension as N, combineTransactionSteps as ge, getChangedRanges as be, findChildrenInRange as ke, Node as j, Mark as ft, InputRule as gt, callOrReturn as ye, getExtensionField as we, mergeAttributes as ve, isNodeSelection as Se, posToDOMRect as dt, getMarkRange as Ct, findParentNode as Ee, findChildren as Tt, extensions as X, Editor as Ce } from "@tiptap/core";
8
+ import { Extension as N, combineTransactionSteps as ge, getChangedRanges as be, findChildrenInRange as ke, Node as j, Mark as ft, InputRule as gt, callOrReturn as ye, getExtensionField as we, mergeAttributes as ve, isNodeSelection as Se, posToDOMRect as dt, getMarkRange as Tt, findParentNode as Ee, findChildren as Mt, extensions as X, Editor as Ce } from "@tiptap/core";
9
9
  import { Plugin as x, PluginKey as L, Selection as at, NodeSelection as rt, TextSelection as nt } from "prosemirror-state";
10
10
  import { v4 as Te } from "uuid";
11
- import { fromDom as Mt } from "hast-util-from-dom";
11
+ import { fromDom as xt } from "hast-util-from-dom";
12
12
  import Me from "@tiptap/extension-bold";
13
13
  import xe from "@tiptap/extension-code";
14
14
  import Be from "@tiptap/extension-italic";
@@ -19,7 +19,7 @@ import { TableHeader as Ne } from "@tiptap/extension-table-header";
19
19
  import { TableRow as Ae } from "@tiptap/extension-table-row";
20
20
  import { columnResizing as Pe, tableEditing as De } from "prosemirror-tables";
21
21
  import Oe from "rehype-remark";
22
- import Rt from "remark-gfm";
22
+ import zt from "remark-gfm";
23
23
  import _e from "remark-stringify";
24
24
  import Re from "remark-parse";
25
25
  import ze, { defaultHandlers as Ve } from "remark-rehype";
@@ -136,12 +136,12 @@ const Q = N.create({
136
136
  let v;
137
137
  const C = (v = a.doc.nodeAt(g)) === null || v === void 0 ? void 0 : v.attrs[c];
138
138
  if (C === null) {
139
- const F = o.doc.type.createAndFill().content;
140
- if (o.doc.content.findDiffStart(F) === null) {
141
- const _ = JSON.parse(
139
+ const V = o.doc.type.createAndFill().content;
140
+ if (o.doc.content.findDiffStart(V) === null) {
141
+ const F = JSON.parse(
142
142
  JSON.stringify(r.doc.toJSON())
143
143
  );
144
- if (_.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(_.content) === JSON.stringify(F.toJSON())) {
144
+ if (F.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(F.content) === JSON.stringify(V.toJSON())) {
145
145
  a.setNodeMarkup(g, void 0, {
146
146
  ...k.attrs,
147
147
  [c]: "initialBlockId"
@@ -216,7 +216,7 @@ const Q = N.create({
216
216
  a.push(c);
217
217
  }), H.from(a);
218
218
  };
219
- return t = !1, new z(
219
+ return t = !1, new R(
220
220
  i(e.content),
221
221
  e.openStart,
222
222
  e.openEnd
@@ -227,7 +227,7 @@ const Q = N.create({
227
227
  ];
228
228
  }
229
229
  });
230
- function zt(n) {
230
+ function Vt(n) {
231
231
  const t = n.attrs.id, e = n.firstChild, o = e.type, r = n.childCount === 2 ? n.lastChild.childCount : 0;
232
232
  return {
233
233
  id: t,
@@ -257,7 +257,7 @@ function w(n, t) {
257
257
  break;
258
258
  a -= 1, s = r.node(a);
259
259
  }
260
- const { id: l, contentNode: c, contentType: d, numChildBlocks: p } = zt(s), m = r.start(a), h = r.end(a);
260
+ const { id: l, contentNode: c, contentType: d, numChildBlocks: p } = Vt(s), m = r.start(a), h = r.end(a);
261
261
  return {
262
262
  id: l,
263
263
  node: s,
@@ -269,10 +269,10 @@ function w(n, t) {
269
269
  depth: a
270
270
  };
271
271
  }
272
- function xt(n) {
272
+ function Bt(n) {
273
273
  return n.type === "link";
274
274
  }
275
- function Vt(n) {
275
+ function Ft(n) {
276
276
  return typeof n != "string" && n.type === "link";
277
277
  }
278
278
  function Z(n) {
@@ -283,7 +283,7 @@ class A extends Error {
283
283
  super(`Unreachable case: ${t}`);
284
284
  }
285
285
  }
286
- function Bt(n, t, e) {
286
+ function It(n, t, e) {
287
287
  const o = [];
288
288
  for (const [r, i] of Object.entries(n.styles)) {
289
289
  const s = e[r];
@@ -317,25 +317,25 @@ function ut(n, t, e) {
317
317
  const o = [];
318
318
  if (typeof n == "string")
319
319
  return o.push(
320
- ...Bt(
320
+ ...It(
321
321
  { type: "text", text: n, styles: {} },
322
322
  t,
323
323
  e
324
324
  )
325
325
  ), o;
326
326
  for (const r of n)
327
- o.push(...Bt(r, t, e));
327
+ o.push(...It(r, t, e));
328
328
  return o;
329
329
  }
330
330
  function bt(n, t, e) {
331
331
  const o = [];
332
332
  for (const r of n)
333
- typeof r == "string" ? o.push(...ut(r, t, e)) : Vt(r) ? o.push(...Ye(r, t, e)) : Z(r) ? o.push(...ut([r], t, e)) : o.push(
334
- Ut(r, t, e)
333
+ typeof r == "string" ? o.push(...ut(r, t, e)) : Ft(r) ? o.push(...Ye(r, t, e)) : Z(r) ? o.push(...ut([r], t, e)) : o.push(
334
+ $t(r, t, e)
335
335
  );
336
336
  return o;
337
337
  }
338
- function Ft(n, t, e) {
338
+ function Ut(n, t, e) {
339
339
  const o = [];
340
340
  for (const r of n.rows) {
341
341
  const i = [];
@@ -357,7 +357,7 @@ function Ft(n, t, e) {
357
357
  }
358
358
  return o;
359
359
  }
360
- function Ut(n, t, e) {
360
+ function $t(n, t, e) {
361
361
  let o, r = n.type;
362
362
  if (r === void 0 && (r = "paragraph"), !t.nodes[r])
363
363
  throw new Error(`node type ${r} not found in schema`);
@@ -372,7 +372,7 @@ function Ut(n, t, e) {
372
372
  const i = bt(n.content, t, e);
373
373
  o = t.nodes[r].create(n.props, i);
374
374
  } else if (n.content.type === "tableContent") {
375
- const i = Ft(n.content, t, e);
375
+ const i = Ut(n.content, t, e);
376
376
  o = t.nodes[r].create(n.props, i);
377
377
  } else
378
378
  throw new A(n.content.type);
@@ -381,7 +381,7 @@ function Ut(n, t, e) {
381
381
  function O(n, t, e) {
382
382
  let o = n.id;
383
383
  o === void 0 && (o = Q.options.generateID());
384
- const r = Ut(
384
+ const r = $t(
385
385
  n,
386
386
  t,
387
387
  e
@@ -427,7 +427,7 @@ function kt(n, t, e) {
427
427
  if (Z(r))
428
428
  r.text += `
429
429
  `;
430
- else if (xt(r))
430
+ else if (Bt(r))
431
431
  r.content[r.content.length - 1].text += `
432
432
  `;
433
433
  else
@@ -443,7 +443,7 @@ function kt(n, t, e) {
443
443
  }
444
444
  if (i.type.name !== "link" && i.type.name !== "text" && t[i.type.name]) {
445
445
  r && (o.push(r), r = void 0), o.push(
446
- $t(i, t, e)
446
+ Gt(i, t, e)
447
447
  );
448
448
  return;
449
449
  }
@@ -477,7 +477,7 @@ function kt(n, t, e) {
477
477
  type: "text",
478
478
  text: i.textContent,
479
479
  styles: s
480
- }) : xt(r) && (a ? r.href === a.attrs.href ? JSON.stringify(
480
+ }) : Bt(r) && (a ? r.href === a.attrs.href ? JSON.stringify(
481
481
  r.content[r.content.length - 1].styles
482
482
  ) === JSON.stringify(s) ? r.content[r.content.length - 1].text += i.textContent : r.content.push({
483
483
  type: "text",
@@ -514,7 +514,7 @@ function kt(n, t, e) {
514
514
  };
515
515
  }), r && o.push(r), o;
516
516
  }
517
- function $t(n, t, e) {
517
+ function Gt(n, t, e) {
518
518
  if (n.type.name === "text" || n.type.name === "link")
519
519
  throw new Error("unexpected");
520
520
  const o = {}, r = t[n.type.name];
@@ -543,7 +543,7 @@ function M(n, t, e, o, r) {
543
543
  const i = r == null ? void 0 : r.get(n);
544
544
  if (i)
545
545
  return i;
546
- const s = zt(n);
546
+ const s = Vt(n);
547
547
  let a = s.id;
548
548
  a === null && (a = Q.options.generateID());
549
549
  const l = {};
@@ -599,7 +599,7 @@ function M(n, t, e, o, r) {
599
599
  function Qe(n) {
600
600
  return n.document || window.document;
601
601
  }
602
- const Gt = (n, t, e, o, r) => {
602
+ const jt = (n, t, e, o, r) => {
603
603
  if (!e.nodes[n.type.name])
604
604
  throw new Error("Serializer is missing a node type: " + n.type.name);
605
605
  const { dom: i, contentDOM: s } = ht.renderSpec(
@@ -642,7 +642,7 @@ const Gt = (n, t, e, o, r) => {
642
642
  e.serializeFragment(n.content, t, s);
643
643
  }
644
644
  return i;
645
- }, jt = (n, t) => {
645
+ }, Wt = (n, t) => {
646
646
  const e = t.serializeFragment(n), o = document.createElement("div");
647
647
  return o.appendChild(e), o.innerHTML;
648
648
  };
@@ -673,10 +673,10 @@ function tn(n) {
673
673
  a -= f, r -= f, i = void 0;
674
674
  }
675
675
  if (m) {
676
- i || (i = Mt(
676
+ i || (i = xt(
677
677
  document.createElement(h)
678
678
  ));
679
- const f = Mt(
679
+ const f = xt(
680
680
  document.createElement("li")
681
681
  );
682
682
  f.children.push(d.children[0]), p !== null && f.children.push(...p.children), i.children.push(f);
@@ -697,18 +697,18 @@ function tn(n) {
697
697
  }
698
698
  const st = (n, t) => {
699
699
  const e = ht.fromSchema(n);
700
- return e.serializeNodeInner = (o, r) => Gt(o, r, e, t, !0), e.exportProseMirrorFragment = (o) => mt().use(Ot, { fragment: !0 }).use(tn, {
700
+ return e.serializeNodeInner = (o, r) => jt(o, r, e, t, !0), e.exportProseMirrorFragment = (o) => mt().use(_t, { fragment: !0 }).use(tn, {
701
701
  orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
702
702
  unorderedListItemBlockTypes: /* @__PURE__ */ new Set(["bulletListItem"])
703
- }).use(_t).processSync(jt(o, e)).value, e.exportBlocks = (o) => {
703
+ }).use(Rt).processSync(Wt(o, e)).value, e.exportBlocks = (o) => {
704
704
  const r = o.map(
705
705
  (s) => O(s, n, t.styleSchema)
706
706
  ), i = n.nodes.blockGroup.create(null, r);
707
707
  return e.exportProseMirrorFragment(H.from(i));
708
708
  }, e;
709
- }, Wt = (n, t) => {
709
+ }, qt = (n, t) => {
710
710
  const e = ht.fromSchema(n);
711
- return e.serializeNodeInner = (o, r) => Gt(o, r, e, t, !1), e.serializeProseMirrorFragment = (o) => jt(o, e), e.serializeBlocks = (o) => {
711
+ return e.serializeNodeInner = (o, r) => jt(o, r, e, t, !1), e.serializeProseMirrorFragment = (o) => Wt(o, e), e.serializeBlocks = (o) => {
712
712
  const r = o.map(
713
713
  (s) => O(s, n, t.styleSchema)
714
714
  ), i = n.nodes.blockGroup.create(null, r);
@@ -727,19 +727,19 @@ const st = (n, t) => {
727
727
  function Mr(n) {
728
728
  return en() ? n.replace("Mod", "⌘") : n.replace("Mod", "Ctrl");
729
729
  }
730
- function V(...n) {
730
+ function z(...n) {
731
731
  return n.filter((t) => t).join(" ");
732
732
  }
733
733
  function tt(n, t, e, o) {
734
734
  const r = document.createElement("div");
735
- r.className = V(
735
+ r.className = z(
736
736
  "bn-block-content",
737
737
  e.class
738
738
  ), r.setAttribute("data-content-type", n);
739
739
  for (const [s, a] of Object.entries(e))
740
740
  s !== "class" && r.setAttribute(s, a);
741
741
  const i = document.createElement(t);
742
- i.className = V(
742
+ i.className = z(
743
743
  "bn-inline-content",
744
744
  o.class
745
745
  );
@@ -752,7 +752,7 @@ function tt(n, t, e, o) {
752
752
  contentDOM: i
753
753
  };
754
754
  }
755
- const It = (n, t) => {
755
+ const Lt = (n, t) => {
756
756
  const e = O(
757
757
  n,
758
758
  t._tiptapEditor.schema,
@@ -779,13 +779,13 @@ const It = (n, t) => {
779
779
  default: "left",
780
780
  values: ["left", "center", "right", "justify"]
781
781
  }
782
- }, qt = ["backgroundColor", "textColor"];
782
+ }, Kt = ["backgroundColor", "textColor"];
783
783
  function it(n) {
784
784
  return "data-" + n.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
785
785
  }
786
- function Kt(n) {
786
+ function Xt(n) {
787
787
  const t = {};
788
- return Object.entries(n).filter(([e, o]) => !qt.includes(e)).forEach(([e, o]) => {
788
+ return Object.entries(n).filter(([e, o]) => !Kt.includes(e)).forEach(([e, o]) => {
789
789
  t[e] = {
790
790
  default: o.default,
791
791
  keepOnSplit: !0,
@@ -825,13 +825,13 @@ function lt(n, t, e, o, r) {
825
825
  if (r !== void 0)
826
826
  for (const [s, a] of Object.entries(r))
827
827
  s !== "class" && i.setAttribute(s, a);
828
- i.className = V(
828
+ i.className = z(
829
829
  "bn-block-content",
830
830
  (r == null ? void 0 : r.class) || ""
831
831
  ), i.setAttribute("data-content-type", t);
832
832
  for (const [s, a] of Object.entries(e))
833
- !qt.includes(s) && a !== o[s].default && i.setAttribute(it(s), a);
834
- return i.appendChild(n.dom), n.contentDOM !== void 0 && (n.contentDOM.className = V(
833
+ !Kt.includes(s) && a !== o[s].default && i.setAttribute(it(s), a);
834
+ return i.appendChild(n.dom), n.contentDOM !== void 0 && (n.contentDOM.className = z(
835
835
  "bn-inline-content",
836
836
  n.contentDOM.className
837
837
  ), n.contentDOM.setAttribute("data-editable", "")), {
@@ -842,14 +842,14 @@ function lt(n, t, e, o, r) {
842
842
  function W(n) {
843
843
  return j.create(n);
844
844
  }
845
- function Xt(n, t) {
845
+ function Jt(n, t) {
846
846
  return {
847
847
  config: n,
848
848
  implementation: t
849
849
  };
850
850
  }
851
851
  function et(n, t, e) {
852
- return Xt(
852
+ return Jt(
853
853
  {
854
854
  type: n.name,
855
855
  content: n.config.content === "inline*" ? "inline" : n.config.content === "tableRow+" ? "table" : "none",
@@ -858,13 +858,13 @@ function et(n, t, e) {
858
858
  {
859
859
  node: n,
860
860
  requiredExtensions: e,
861
- toInternalHTML: It,
862
- toExternalHTML: It
861
+ toInternalHTML: Lt,
862
+ toExternalHTML: Lt
863
863
  // parse: () => undefined, // parse rules are in node already
864
864
  }
865
865
  );
866
866
  }
867
- function Jt(n) {
867
+ function Yt(n) {
868
868
  return Object.fromEntries(
869
869
  Object.entries(n).map(([t, e]) => [t, e.config])
870
870
  );
@@ -893,7 +893,7 @@ function rn(n, t) {
893
893
  group: "blockContent",
894
894
  selectable: !0,
895
895
  addAttributes() {
896
- return Kt(n.propSchema);
896
+ return Xt(n.propSchema);
897
897
  },
898
898
  parseHTML() {
899
899
  return on(n, t.parse);
@@ -927,7 +927,7 @@ function rn(n, t) {
927
927
  throw new Error(
928
928
  "Node name does not match block type. This is a bug in BlockNote."
929
929
  );
930
- return Xt(n, {
930
+ return Jt(n, {
931
931
  node: e,
932
932
  toInternalHTML: (o, r) => {
933
933
  var a;
@@ -987,7 +987,7 @@ function cn(n, t) {
987
987
  }
988
988
  );
989
989
  }
990
- function Yt(n) {
990
+ function Zt(n) {
991
991
  return Object.fromEntries(
992
992
  Object.entries(n).map(([t, e]) => [t, e.config])
993
993
  );
@@ -1012,7 +1012,7 @@ function xr(n, t) {
1012
1012
  atom: n.content === "none",
1013
1013
  content: n.content === "styled" ? "inline*" : "",
1014
1014
  addAttributes() {
1015
- return Kt(n.propSchema);
1015
+ return Xt(n.propSchema);
1016
1016
  },
1017
1017
  addKeyboardShortcuts() {
1018
1018
  return an(n);
@@ -1022,7 +1022,7 @@ function xr(n, t) {
1022
1022
  },
1023
1023
  renderHTML({ node: o }) {
1024
1024
  const r = this.options.editor, i = t.render(
1025
- $t(
1025
+ Gt(
1026
1026
  o,
1027
1027
  r.inlineContentSchema,
1028
1028
  r.styleSchema
@@ -1057,14 +1057,14 @@ function un(n) {
1057
1057
  function pn(n, t, e, o) {
1058
1058
  return n.dom.setAttribute("data-style-type", t), o === "string" && n.dom.setAttribute("data-value", e), n.contentDOM !== void 0 && n.contentDOM.setAttribute("data-editable", ""), n;
1059
1059
  }
1060
- function Zt(n, t) {
1060
+ function Qt(n, t) {
1061
1061
  return {
1062
1062
  config: n,
1063
1063
  implementation: t
1064
1064
  };
1065
1065
  }
1066
- function R(n, t) {
1067
- return Zt(
1066
+ function _(n, t) {
1067
+ return Qt(
1068
1068
  {
1069
1069
  type: n.name,
1070
1070
  propSchema: t
@@ -1074,7 +1074,7 @@ function R(n, t) {
1074
1074
  }
1075
1075
  );
1076
1076
  }
1077
- function Qt(n) {
1077
+ function te(n) {
1078
1078
  return Object.fromEntries(
1079
1079
  Object.entries(n).map(([t, e]) => [t, e.config])
1080
1080
  );
@@ -1115,7 +1115,7 @@ function Br(n, t) {
1115
1115
  );
1116
1116
  }
1117
1117
  });
1118
- return Zt(n, {
1118
+ return Qt(n, {
1119
1119
  mark: e
1120
1120
  });
1121
1121
  }
@@ -1145,7 +1145,7 @@ const mn = ft.create({
1145
1145
  renderHTML({ HTMLAttributes: n }) {
1146
1146
  return ["span", n, 0];
1147
1147
  }
1148
- }), fn = R(
1148
+ }), fn = _(
1149
1149
  mn,
1150
1150
  "string"
1151
1151
  ), gn = ft.create({
@@ -1172,7 +1172,7 @@ const mn = ft.create({
1172
1172
  renderHTML({ HTMLAttributes: n }) {
1173
1173
  return ["span", n, 0];
1174
1174
  }
1175
- }), bn = R(gn, "string"), kn = {
1175
+ }), bn = _(gn, "string"), kn = {
1176
1176
  ...B,
1177
1177
  level: { default: 1, values: [1, 2, 3] }
1178
1178
  }, yn = W({
@@ -1397,7 +1397,7 @@ const En = {
1397
1397
  width: {
1398
1398
  default: 512
1399
1399
  }
1400
- }, Lt = (n) => {
1400
+ }, Ht = (n) => {
1401
1401
  switch (n) {
1402
1402
  case "left":
1403
1403
  return "flex-start";
@@ -1408,9 +1408,9 @@ const En = {
1408
1408
  default:
1409
1409
  return "flex-start";
1410
1410
  }
1411
- }, Ht = 64, Cn = (n, t) => {
1411
+ }, Nt = 64, Cn = (n, t) => {
1412
1412
  const e = document.createElement("div");
1413
- e.className = "bn-image-block-content-wrapper", e.style.alignItems = Lt(
1413
+ e.className = "bn-image-block-content-wrapper", e.style.alignItems = Ht(
1414
1414
  n.props.textAlignment
1415
1415
  );
1416
1416
  const o = document.createElement("div");
@@ -1438,18 +1438,20 @@ const En = {
1438
1438
  var K;
1439
1439
  const b = ((K = t.getSelection()) == null ? void 0 : K.blocks) || [];
1440
1440
  [t.getTextCursorPosition().block, ...b].find(
1441
- (_) => _.id === n.id
1441
+ (F) => F.id === n.id
1442
1442
  ) !== void 0 ? (o.style.outline = "4px solid rgb(100, 160, 255)", s.style.outline = "4px solid rgb(100, 160, 255)") : (o.style.outline = "", s.style.outline = "");
1443
1443
  };
1444
1444
  t.onEditorContentChange(m), t.onEditorSelectionChange(m);
1445
1445
  let h;
1446
1446
  const f = (b) => {
1447
- if (!h)
1447
+ if (!h) {
1448
+ !t.isEditable && a.contains(c) && a.contains(d) && (a.removeChild(c), a.removeChild(d));
1448
1449
  return;
1450
+ }
1449
1451
  let T;
1450
- Lt(n.props.textAlignment) === "center" ? h.handleUsed === "left" ? T = h.initialWidth + (h.initialClientX - b.clientX) * 2 : T = h.initialWidth + (b.clientX - h.initialClientX) * 2 : h.handleUsed === "left" ? T = h.initialWidth + h.initialClientX - b.clientX : T = h.initialWidth + b.clientX - h.initialClientX, T < Ht ? l.style.width = `${Ht}px` : T > t.domElement.firstElementChild.clientWidth ? l.style.width = `${t.domElement.firstElementChild.clientWidth}px` : l.style.width = `${T}px`;
1452
+ Ht(n.props.textAlignment) === "center" ? h.handleUsed === "left" ? T = h.initialWidth + (h.initialClientX - b.clientX) * 2 : T = h.initialWidth + (b.clientX - h.initialClientX) * 2 : h.handleUsed === "left" ? T = h.initialWidth + h.initialClientX - b.clientX : T = h.initialWidth + b.clientX - h.initialClientX, T < Nt ? l.style.width = `${Nt}px` : T > t.domElement.firstElementChild.clientWidth ? l.style.width = `${t.domElement.firstElementChild.clientWidth}px` : l.style.width = `${T}px`;
1451
1453
  }, y = (b) => {
1452
- h && ((!b.target || !a.contains(b.target)) && a.contains(c) && a.contains(d) && (a.removeChild(c), a.removeChild(d)), h = void 0, t.updateBlock(n, {
1454
+ (!b.target || !a.contains(b.target) || !t.isEditable) && a.contains(c) && a.contains(d) && (a.removeChild(c), a.removeChild(d)), h && (h = void 0, t.updateBlock(n, {
1453
1455
  type: "image",
1454
1456
  props: {
1455
1457
  // Removes "px" from the end of the width string and converts to float.
@@ -1465,9 +1467,9 @@ const En = {
1465
1467
  })
1466
1468
  );
1467
1469
  }, k = () => {
1468
- t.isEditable ? (a.appendChild(c), a.appendChild(d)) : (a.removeChild(c), a.removeChild(d));
1470
+ t.isEditable && (a.appendChild(c), a.appendChild(d));
1469
1471
  }, g = (b) => {
1470
- b.relatedTarget === c || b.relatedTarget === d || h || (a.removeChild(c), a.removeChild(d));
1472
+ b.relatedTarget === c || b.relatedTarget === d || h || t.isEditable && a.contains(c) && a.contains(d) && (a.removeChild(c), a.removeChild(d));
1471
1473
  }, v = (b) => {
1472
1474
  b.preventDefault(), a.appendChild(c), a.appendChild(d), h = {
1473
1475
  handleUsed: "left",
@@ -1540,7 +1542,7 @@ const En = {
1540
1542
  };
1541
1543
  }
1542
1544
  }
1543
- ), te = (n) => {
1545
+ ), yt = (n) => {
1544
1546
  const { node: t, contentType: e } = w(
1545
1547
  n.state.doc,
1546
1548
  n.state.selection.from
@@ -1581,8 +1583,8 @@ const En = {
1581
1583
  },
1582
1584
  addKeyboardShortcuts() {
1583
1585
  return {
1584
- Enter: () => te(this.editor),
1585
- "Mod-Shift-7": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
1586
+ Enter: () => yt(this.editor),
1587
+ "Mod-Shift-8": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
1586
1588
  type: "bulletListItem",
1587
1589
  props: {}
1588
1590
  })
@@ -1700,8 +1702,8 @@ const En = {
1700
1702
  },
1701
1703
  addKeyboardShortcuts() {
1702
1704
  return {
1703
- Enter: () => te(this.editor),
1704
- "Mod-Shift-8": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
1705
+ Enter: () => yt(this.editor),
1706
+ "Mod-Shift-7": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
1705
1707
  type: "numberedListItem",
1706
1708
  props: {}
1707
1709
  })
@@ -1767,6 +1769,15 @@ const En = {
1767
1769
  name: "paragraph",
1768
1770
  content: "inline*",
1769
1771
  group: "blockContent",
1772
+ addKeyboardShortcuts() {
1773
+ return {
1774
+ Enter: () => yt(this.editor),
1775
+ "Mod-Alt-0": () => this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor, {
1776
+ type: "paragraph",
1777
+ props: {}
1778
+ })
1779
+ };
1780
+ },
1770
1781
  parseHTML() {
1771
1782
  return [
1772
1783
  { tag: "div[data-content-type=" + this.name + "]" },
@@ -1882,21 +1893,21 @@ const En = {
1882
1893
  numberedListItem: An,
1883
1894
  image: Tn,
1884
1895
  table: Fn
1885
- }, ne = Jt(ee), oe = {
1886
- bold: R(Me, "boolean"),
1887
- italic: R(Be, "boolean"),
1888
- underline: R(Le, "boolean"),
1889
- strike: R(Ie, "boolean"),
1890
- code: R(xe, "boolean"),
1896
+ }, ne = Yt(ee), oe = {
1897
+ bold: _(Me, "boolean"),
1898
+ italic: _(Be, "boolean"),
1899
+ underline: _(Le, "boolean"),
1900
+ strike: _(Ie, "boolean"),
1901
+ code: _(xe, "boolean"),
1891
1902
  textColor: bn,
1892
1903
  backgroundColor: fn
1893
- }, Ir = Qt(oe), re = {
1904
+ }, Ir = te(oe), re = {
1894
1905
  text: { config: "text", implementation: {} },
1895
1906
  link: { config: "link", implementation: {} }
1896
- }, Lr = Yt(
1907
+ }, Lr = Zt(
1897
1908
  re
1898
1909
  );
1899
- function yt(n, t) {
1910
+ function wt(n, t) {
1900
1911
  let e, o;
1901
1912
  if (t.firstChild.descendants((r, i) => e ? !1 : r.type.name !== "blockContainer" || r.attrs.id !== n ? !0 : (e = r, o = i + 1, !1)), e === void 0 || o === void 0)
1902
1913
  throw Error("Could not find block in the editor with matching ID.");
@@ -1911,7 +1922,7 @@ function Un(n, t, e = "before", o) {
1911
1922
  s.push(
1912
1923
  O(d, r.schema, o.styleSchema)
1913
1924
  );
1914
- const { node: a, posBeforeNode: l } = yt(i, r.state.doc);
1925
+ const { node: a, posBeforeNode: l } = wt(i, r.state.doc);
1915
1926
  if (e === "before" && r.view.dispatch(
1916
1927
  r.state.tr.insert(l, s)
1917
1928
  ), e === "after" && r.view.dispatch(
@@ -1942,7 +1953,7 @@ function Un(n, t, e = "before", o) {
1942
1953
  return c;
1943
1954
  }
1944
1955
  function $n(n, t, e) {
1945
- const o = e._tiptapEditor, r = typeof n == "string" ? n : n.id, { posBeforeNode: i } = yt(r, o.state.doc);
1956
+ const o = e._tiptapEditor, r = typeof n == "string" ? n : n.id, { posBeforeNode: i } = wt(r, o.state.doc);
1946
1957
  o.commands.BNUpdateBlock(i + 1, t);
1947
1958
  const s = o.state.doc.resolve(i + 1).node();
1948
1959
  return M(
@@ -2035,12 +2046,12 @@ function Wn() {
2035
2046
  };
2036
2047
  return n;
2037
2048
  }
2038
- function wt(n) {
2039
- return mt().use(Ot, { fragment: !0 }).use(Wn).use(Oe).use(Rt).use(_e).processSync(n).value;
2049
+ function vt(n) {
2050
+ return mt().use(_t, { fragment: !0 }).use(Wn).use(Oe).use(zt).use(_e).processSync(n).value;
2040
2051
  }
2041
2052
  function qn(n, t, e) {
2042
2053
  const r = st(t, e).exportBlocks(n);
2043
- return wt(r);
2054
+ return vt(r);
2044
2055
  }
2045
2056
  function Kn(n) {
2046
2057
  return Array.prototype.indexOf.call(n.parentElement.childNodes, n);
@@ -2108,12 +2119,12 @@ function Zn(n, t) {
2108
2119
  }, n.patch(t, r), r;
2109
2120
  }
2110
2121
  function Qn(n, t, e, o, r) {
2111
- const i = mt().use(Re).use(Rt).use(ze, {
2122
+ const i = mt().use(Re).use(zt).use(ze, {
2112
2123
  handlers: {
2113
2124
  ...Ve,
2114
2125
  code: Zn
2115
2126
  }
2116
- }).use(_t).processSync(n);
2127
+ }).use(Rt).processSync(n);
2117
2128
  return ae(
2118
2129
  i.value,
2119
2130
  t,
@@ -2137,7 +2148,7 @@ class to {
2137
2148
  this.preventShow = !1, setTimeout(() => this.update(this.pmView));
2138
2149
  });
2139
2150
  // For dragging the whole editor.
2140
- u(this, "dragstartHandler", () => {
2151
+ u(this, "dragHandler", () => {
2141
2152
  var t;
2142
2153
  (t = this.formattingToolbarState) != null && t.show && (this.formattingToolbarState.show = !1, this.updateFormattingToolbar());
2143
2154
  });
@@ -2165,7 +2176,7 @@ class to {
2165
2176
  "Attempting to update uninitialized formatting toolbar"
2166
2177
  );
2167
2178
  o(this.formattingToolbarState);
2168
- }, e.dom.addEventListener("mousedown", this.viewMousedownHandler), e.dom.addEventListener("mouseup", this.viewMouseupHandler), e.dom.addEventListener("dragstart", this.dragstartHandler), e.dom.addEventListener("focus", this.focusHandler), e.dom.addEventListener("blur", this.blurHandler), document.addEventListener("scroll", this.scrollHandler);
2179
+ }, e.dom.addEventListener("mousedown", this.viewMousedownHandler), e.dom.addEventListener("mouseup", this.viewMouseupHandler), e.dom.addEventListener("dragstart", this.dragHandler), e.dom.addEventListener("dragover", this.dragHandler), e.dom.addEventListener("focus", this.focusHandler), e.dom.addEventListener("blur", this.blurHandler), document.addEventListener("scroll", this.scrollHandler);
2169
2180
  }
2170
2181
  update(t, e) {
2171
2182
  var m, h;
@@ -2192,7 +2203,7 @@ class to {
2192
2203
  }
2193
2204
  }
2194
2205
  destroy() {
2195
- this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.dom.removeEventListener("mouseup", this.viewMouseupHandler), this.pmView.dom.removeEventListener("dragstart", this.dragstartHandler), this.pmView.dom.removeEventListener("focus", this.focusHandler), this.pmView.dom.removeEventListener("blur", this.blurHandler), document.removeEventListener("scroll", this.scrollHandler);
2206
+ 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), this.pmView.dom.removeEventListener("focus", this.focusHandler), this.pmView.dom.removeEventListener("blur", this.blurHandler), document.removeEventListener("scroll", this.scrollHandler);
2196
2207
  }
2197
2208
  getSelectionBoundingBox() {
2198
2209
  const { state: t } = this.pmView, { selection: e } = t, { ranges: o } = e, r = Math.min(...o.map((s) => s.$from.pos)), i = Math.max(...o.map((s) => s.$to.pos));
@@ -2243,7 +2254,7 @@ class oo {
2243
2254
  ), i = r.marks();
2244
2255
  for (const s of i)
2245
2256
  if (s.type.name === this.pmView.state.schema.mark("link").type.name) {
2246
- this.mouseHoveredHyperlinkMark = s, this.mouseHoveredHyperlinkMarkRange = Ct(
2257
+ this.mouseHoveredHyperlinkMark = s, this.mouseHoveredHyperlinkMarkRange = Tt(
2247
2258
  r,
2248
2259
  s.type,
2249
2260
  s.attrs
@@ -2311,7 +2322,7 @@ class oo {
2311
2322
  const o = this.pmView.state.selection.$from.marks();
2312
2323
  for (const r of o)
2313
2324
  if (r.type.name === this.pmView.state.schema.mark("link").type.name) {
2314
- this.keyboardHoveredHyperlinkMark = r, this.keyboardHoveredHyperlinkMarkRange = Ct(
2325
+ this.keyboardHoveredHyperlinkMark = r, this.keyboardHoveredHyperlinkMarkRange = Tt(
2315
2326
  this.pmView.state.selection.$from,
2316
2327
  r.type,
2317
2328
  r.attrs
@@ -2592,7 +2603,7 @@ const lo = (n, t, e, o, r = () => [], i = () => {
2592
2603
  });
2593
2604
  }
2594
2605
  };
2595
- }, vt = new L("SlashMenuPlugin");
2606
+ }, St = new L("SlashMenuPlugin");
2596
2607
  class co extends q {
2597
2608
  constructor(e, o) {
2598
2609
  super();
@@ -2603,7 +2614,7 @@ class co extends q {
2603
2614
  (i) => {
2604
2615
  this.emit("update", i);
2605
2616
  },
2606
- vt,
2617
+ St,
2607
2618
  "/",
2608
2619
  (i) => o.filter(
2609
2620
  ({ name: s, aliases: a }) => s.toLowerCase().startsWith(i.toLowerCase()) || a && a.filter(
@@ -2632,7 +2643,7 @@ class U extends at {
2632
2643
  return new U(e.resolve(o), e.resolve(r));
2633
2644
  }
2634
2645
  content() {
2635
- return new z(H.from(this.nodes), 0, 0);
2646
+ return new R(H.from(this.nodes), 0, 0);
2636
2647
  }
2637
2648
  eq(e) {
2638
2649
  if (!(e instanceof U) || this.nodes.length !== e.nodes.length || this.from !== e.from || this.to !== e.to)
@@ -2654,7 +2665,7 @@ class U extends at {
2654
2665
  }
2655
2666
  }
2656
2667
  let D;
2657
- function St(n, t) {
2668
+ function Et(n, t) {
2658
2669
  var r;
2659
2670
  if (!t.dom.isConnected)
2660
2671
  return;
@@ -2670,7 +2681,7 @@ function St(n, t) {
2670
2681
  }
2671
2682
  }
2672
2683
  function uo(n, t) {
2673
- const e = St(n, t);
2684
+ const e = Et(n, t);
2674
2685
  if (e && e.node.nodeType === 1) {
2675
2686
  const o = t.docView, r = o.nearestDesc(e.node, !0);
2676
2687
  return !r || r === o ? null : r.posBefore;
@@ -2687,7 +2698,7 @@ function po(n, t) {
2687
2698
  e = n.from, o = n.to;
2688
2699
  return { from: e, to: o };
2689
2700
  }
2690
- function Nt(n, t, e = t) {
2701
+ function At(n, t, e = t) {
2691
2702
  t === e && (e += n.state.doc.resolve(t + 1).node().nodeSize);
2692
2703
  const o = n.domAtPos(t).node.cloneNode(!0), r = n.domAtPos(t).node, i = (d, p) => Array.prototype.indexOf.call(d.children, p), s = i(
2693
2704
  r,
@@ -2721,14 +2732,14 @@ function ho(n, t) {
2721
2732
  const s = e.state.selection, a = e.state.doc, { from: l, to: c } = po(s, a), d = l <= i && i < c, p = s.$anchor.node() !== s.$head.node() || s instanceof U;
2722
2733
  d && p ? (e.dispatch(
2723
2734
  e.state.tr.setSelection(U.create(a, l, c))
2724
- ), Nt(e, l, c)) : (e.dispatch(
2735
+ ), At(e, l, c)) : (e.dispatch(
2725
2736
  e.state.tr.setSelection(rt.create(e.state.doc, i))
2726
- ), Nt(e, i));
2727
- const m = e.state.selection.content(), h = t._tiptapEditor.schema, y = Wt(h, t).serializeProseMirrorFragment(
2737
+ ), At(e, i));
2738
+ const m = e.state.selection.content(), h = t._tiptapEditor.schema, y = qt(h, t).serializeProseMirrorFragment(
2728
2739
  m.content
2729
2740
  ), E = st(h, t).exportProseMirrorFragment(
2730
2741
  m.content
2731
- ), k = wt(E);
2742
+ ), k = vt(E);
2732
2743
  n.dataTransfer.clearData(), n.dataTransfer.setData("blocknote/html", y), n.dataTransfer.setData("text/html", E), n.dataTransfer.setData("text/plain", k), n.dataTransfer.effectAllowed = "move", n.dataTransfer.setDragImage(D, 0, 0), e.dragging = { slice: m, move: !0 };
2733
2744
  }
2734
2745
  }
@@ -2810,7 +2821,7 @@ class mo {
2810
2821
  left: e.left + e.width / 2,
2811
2822
  // take middle of editor
2812
2823
  top: t.clientY
2813
- }, a = St(s, this.pmView);
2824
+ }, a = Et(s, this.pmView);
2814
2825
  if (!a || !this.editor.isEditable) {
2815
2826
  (d = this.sideMenuState) != null && d.show && (this.sideMenuState.show = !1, this.updateSideMenu(this.sideMenuState));
2816
2827
  return;
@@ -2869,13 +2880,13 @@ class mo {
2869
2880
  if (r === void 0)
2870
2881
  return;
2871
2882
  const { contentNode: i, startPos: s, endPos: a } = r;
2872
- if (i.textContent.length !== 0) {
2883
+ if (i.type.spec.content !== "inline*" || i.textContent.length !== 0) {
2873
2884
  const c = a + 1, d = c + 2;
2874
2885
  this.editor._tiptapEditor.chain().BNCreateBlock(c).BNUpdateBlock(d, { type: "paragraph", props: {} }).setTextSelection(d).run();
2875
2886
  } else
2876
2887
  this.editor._tiptapEditor.commands.setTextSelection(s + 1);
2877
2888
  this.pmView.focus(), this.pmView.dispatch(
2878
- this.pmView.state.tr.scrollIntoView().setMeta(vt, {
2889
+ this.pmView.state.tr.scrollIntoView().setMeta(St, {
2879
2890
  // TODO import suggestion plugin key
2880
2891
  activate: !0,
2881
2892
  type: "drag"
@@ -3034,7 +3045,7 @@ const ko = (n = ne) => {
3034
3045
  }), t;
3035
3046
  };
3036
3047
  let I;
3037
- function At() {
3048
+ function Pt() {
3038
3049
  I || (I = document.createElement("div"), I.innerHTML = "_", I.style.opacity = "0", I.style.height = "1px", I.style.width = "1px", document.body.appendChild(I));
3039
3050
  }
3040
3051
  function yo() {
@@ -3072,7 +3083,7 @@ class So {
3072
3083
  (c = this.state) != null && c.show && (this.state.show = !1, this.updateState());
3073
3084
  return;
3074
3085
  }
3075
- const o = ot(e), r = ot(e.parentElement), i = e.getBoundingClientRect(), s = e.parentElement.parentElement.getBoundingClientRect(), a = St(i, this.pmView);
3086
+ const o = ot(e), r = ot(e.parentElement), i = e.getBoundingClientRect(), s = e.parentElement.parentElement.getBoundingClientRect(), a = Et(i, this.pmView);
3076
3087
  if (!a)
3077
3088
  throw new Error(
3078
3089
  "Found table cell element, but could not find surrounding blockContent element."
@@ -3201,7 +3212,7 @@ class Eo extends q {
3201
3212
  newIndex: this.view.state.colIndex,
3202
3213
  tablePos: this.view.tablePos
3203
3214
  })
3204
- ), At(), e.dataTransfer.setDragImage(I, 0, 0), e.dataTransfer.effectAllowed = "move";
3215
+ ), Pt(), e.dataTransfer.setDragImage(I, 0, 0), e.dataTransfer.effectAllowed = "move";
3205
3216
  });
3206
3217
  /**
3207
3218
  * Callback that should be set on the `dragStart` event for whichever element
@@ -3223,7 +3234,7 @@ class Eo extends q {
3223
3234
  newIndex: this.view.state.rowIndex,
3224
3235
  tablePos: this.view.tablePos
3225
3236
  })
3226
- ), At(), e.dataTransfer.setDragImage(I, 0, 0), e.dataTransfer.effectAllowed = "copyMove";
3237
+ ), Pt(), e.dataTransfer.setDragImage(I, 0, 0), e.dataTransfer.effectAllowed = "copyMove";
3227
3238
  });
3228
3239
  /**
3229
3240
  * Callback that should be set on the `dragEnd` event for both the element
@@ -3303,14 +3314,14 @@ class Eo extends q {
3303
3314
  return this.on("update", e);
3304
3315
  }
3305
3316
  }
3306
- function Pt(n, t) {
3307
- const e = n.state.selection.content().content, r = Wt(
3317
+ function Dt(n, t) {
3318
+ const e = n.state.selection.content().content, r = qt(
3308
3319
  n.state.schema,
3309
3320
  t
3310
3321
  ).serializeProseMirrorFragment(e), s = st(
3311
3322
  n.state.schema,
3312
3323
  t
3313
- ).exportProseMirrorFragment(e), a = wt(s);
3324
+ ).exportProseMirrorFragment(e), a = vt(s);
3314
3325
  return { internalHTML: r, externalHTML: s, plainText: a };
3315
3326
  }
3316
3327
  const Co = (n) => N.create({
@@ -3328,7 +3339,7 @@ const Co = (n) => N.create({
3328
3339
  )
3329
3340
  )
3330
3341
  );
3331
- const { internalHTML: o, externalHTML: r, plainText: i } = Pt(t, n);
3342
+ const { internalHTML: o, externalHTML: r, plainText: i } = Dt(t, n);
3332
3343
  return e.clipboardData.setData("blocknote/html", o), e.clipboardData.setData("text/html", r), e.clipboardData.setData("text/plain", i), !0;
3333
3344
  },
3334
3345
  // This is for the use-case in which only a block without content
@@ -3344,7 +3355,7 @@ const Co = (n) => N.create({
3344
3355
  )
3345
3356
  )
3346
3357
  ), e.preventDefault(), e.dataTransfer.clearData();
3347
- const { internalHTML: o, externalHTML: r, plainText: i } = Pt(t, n);
3358
+ const { internalHTML: o, externalHTML: r, plainText: i } = Dt(t, n);
3348
3359
  return e.dataTransfer.setData("blocknote/html", o), e.dataTransfer.setData("text/html", r), e.dataTransfer.setData("text/plain", i), !0;
3349
3360
  }
3350
3361
  }
@@ -3422,7 +3433,7 @@ const Co = (n) => N.create({
3422
3433
  key: Bo,
3423
3434
  props: {
3424
3435
  decorations: (n) => {
3425
- const { doc: t, selection: e } = n, o = vt.getState(n), r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = e, s = [];
3436
+ const { doc: t, selection: e } = n, o = St.getState(n), r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = e, s = [];
3426
3437
  if (r)
3427
3438
  return t.descendants((a, l) => {
3428
3439
  const c = i >= l && i <= l + a.nodeSize, d = !a.isLeaf && !a.childCount;
@@ -3521,7 +3532,7 @@ const Co = (n) => N.create({
3521
3532
  "node" in n.state.selection && t.key.length === 1 && !t.ctrlKey && !t.altKey && !t.metaKey && !t.shiftKey && t.preventDefault();
3522
3533
  }
3523
3534
  }
3524
- }), Dt = new L("previous-blocks"), Do = {
3535
+ }), Ot = new L("previous-blocks"), Do = {
3525
3536
  // Numbered List Items
3526
3537
  index: "index",
3527
3538
  // Headings
@@ -3533,14 +3544,14 @@ const Co = (n) => N.create({
3533
3544
  }, Oo = () => {
3534
3545
  let n;
3535
3546
  return new x({
3536
- key: Dt,
3547
+ key: Ot,
3537
3548
  view(t) {
3538
3549
  return {
3539
3550
  update: async (e, o) => {
3540
3551
  var r;
3541
3552
  ((r = this.key) == null ? void 0 : r.getState(e.state).updatedBlocks.size) > 0 && (n = setTimeout(() => {
3542
3553
  e.dispatch(
3543
- e.state.tr.setMeta(Dt, { clearUpdate: !0 })
3554
+ e.state.tr.setMeta(Ot, { clearUpdate: !0 })
3544
3555
  );
3545
3556
  }, 0));
3546
3557
  },
@@ -3563,9 +3574,9 @@ const Co = (n) => N.create({
3563
3574
  apply(t, e, o, r) {
3564
3575
  if (e.currentTransactionOldBlockAttrs = {}, e.updatedBlocks.clear(), !t.docChanged || o.doc.eq(r.doc))
3565
3576
  return e;
3566
- const i = {}, s = Tt(o.doc, (c) => c.attrs.id), a = new Map(
3577
+ const i = {}, s = Mt(o.doc, (c) => c.attrs.id), a = new Map(
3567
3578
  s.map((c) => [c.node.attrs.id, c])
3568
- ), l = Tt(r.doc, (c) => c.attrs.id);
3579
+ ), l = Mt(r.doc, (c) => c.attrs.id);
3569
3580
  for (const c of l) {
3570
3581
  const d = a.get(c.node.attrs.id), p = d == null ? void 0 : d.node.firstChild, m = c.node.firstChild;
3571
3582
  if (d && p && m) {
@@ -3646,7 +3657,7 @@ const Co = (n) => N.create({
3646
3657
  ...((r = this.options.domAttributes) == null ? void 0 : r.blockContainer) || {},
3647
3658
  ...n
3648
3659
  }, o = document.createElement("div");
3649
- o.className = V("bn-block", e.class), o.setAttribute("data-node-type", this.name);
3660
+ o.className = z("bn-block", e.class), o.setAttribute("data-node-type", this.name);
3650
3661
  for (const [i, s] of Object.entries(e))
3651
3662
  i !== "class" && o.setAttribute(i, s);
3652
3663
  return t.appendChild(o), {
@@ -3689,7 +3700,7 @@ const Co = (n) => N.create({
3689
3700
  a.childCount === 2 ? e.tr.replace(
3690
3701
  i + l.nodeSize + 1,
3691
3702
  s - 1,
3692
- new z(H.from(m), 0, 0)
3703
+ new R(H.from(m), 0, 0)
3693
3704
  ) : e.tr.insert(
3694
3705
  i + l.nodeSize,
3695
3706
  e.schema.nodes.blockGroup.create({}, m)
@@ -3707,7 +3718,7 @@ const Co = (n) => N.create({
3707
3718
  this.options.editor.styleSchema
3708
3719
  );
3709
3720
  else if (t.content.type === "tableContent")
3710
- p = Ft(
3721
+ p = Ut(
3711
3722
  t.content,
3712
3723
  e.schema,
3713
3724
  this.options.editor.styleSchema
@@ -3788,7 +3799,7 @@ const Co = (n) => N.create({
3788
3799
  t.tr.deleteRange(l, l + a.nodeSize).replace(
3789
3800
  p - 1,
3790
3801
  l,
3791
- new z(a.content, 0, 0)
3802
+ new R(a.content, 0, 0)
3792
3803
  ).scrollIntoView()
3793
3804
  ), t.tr.setSelection(
3794
3805
  new nt(t.doc.resolve(p - 1))
@@ -3804,7 +3815,7 @@ const Co = (n) => N.create({
3804
3815
  return o && (e.tr.insert(h, m), e.tr.replace(
3805
3816
  f,
3806
3817
  f + 1,
3807
- p.content.size > 0 ? new z(
3818
+ p.content.size > 0 ? new R(
3808
3819
  H.from(p),
3809
3820
  c + 2,
3810
3821
  c + 2
@@ -3819,7 +3830,7 @@ const Co = (n) => N.create({
3819
3830
  ), e.tr.replace(
3820
3831
  a + 1,
3821
3832
  l - 1,
3822
- d.content.size > 0 ? new z(
3833
+ d.content.size > 0 ? new R(
3823
3834
  H.from(d),
3824
3835
  c + 2,
3825
3836
  c + 2
@@ -3923,10 +3934,7 @@ const Co = (n) => N.create({
3923
3934
  // Always returning true for tab key presses ensures they're not captured by the browser. Otherwise, they blur the
3924
3935
  // editor since the browser will try to use tab for keyboard navigation.
3925
3936
  Tab: () => (this.editor.commands.sinkListItem("blockContainer"), !0),
3926
- "Shift-Tab": () => (this.editor.commands.liftListItem("blockContainer"), !0),
3927
- "Mod-Alt-0": () => this.editor.commands.BNCreateBlock(
3928
- this.editor.state.selection.anchor + 2
3929
- )
3937
+ "Shift-Tab": () => (this.editor.commands.liftListItem("blockContainer"), !0)
3930
3938
  };
3931
3939
  }
3932
3940
  }), zo = j.create({
@@ -3947,7 +3955,7 @@ const Co = (n) => N.create({
3947
3955
  ...((o = this.options.domAttributes) == null ? void 0 : o.blockGroup) || {},
3948
3956
  ...n
3949
3957
  }, e = document.createElement("div");
3950
- e.className = V(
3958
+ e.className = z(
3951
3959
  "bn-block-group",
3952
3960
  t.class
3953
3961
  ), e.setAttribute("data-node-type", "blockGroup");
@@ -4070,7 +4078,7 @@ function $o(n, t) {
4070
4078
  );
4071
4079
  e = e.replaceChild(o, i);
4072
4080
  }
4073
- return new z(e, n.openStart, n.openEnd);
4081
+ return new R(e, n.openStart, n.openEnd);
4074
4082
  }
4075
4083
  const Go = {
4076
4084
  enableInputRules: !0,
@@ -4104,9 +4112,9 @@ class ce {
4104
4112
  inlineContentSpecs: t.inlineContentSpecs || re,
4105
4113
  ...t
4106
4114
  };
4107
- this.blockSchema = Jt(e.blockSpecs), this.inlineContentSchema = Yt(
4115
+ this.blockSchema = Yt(e.blockSpecs), this.inlineContentSchema = Zt(
4108
4116
  e.inlineContentSpecs
4109
- ), this.styleSchema = Qt(e.styleSpecs), this.blockImplementations = e.blockSpecs, this.inlineContentImplementations = e.inlineContentSpecs, this.styleImplementations = e.styleSpecs, this.sideMenu = new go(this), this.formattingToolbar = new no(this), this.slashMenu = new co(
4117
+ ), this.styleSchema = te(e.styleSpecs), this.blockImplementations = e.blockSpecs, this.inlineContentImplementations = e.inlineContentSpecs, this.styleImplementations = e.styleSpecs, this.sideMenu = new go(this), this.formattingToolbar = new no(this), this.slashMenu = new co(
4110
4118
  this,
4111
4119
  e.slashMenuItems || ko(this.blockSchema)
4112
4120
  ), this.hyperlinkToolbar = new io(this), this.imageToolbar = new Sn(this), this.blockSchema.table === ne.table && (this.tableHandles = new Eo(this));
@@ -4141,16 +4149,16 @@ class ce {
4141
4149
  ...Go,
4142
4150
  ...e._tiptapOptions,
4143
4151
  onBeforeCreate(k) {
4144
- var T, F;
4145
- (F = (T = e._tiptapOptions) == null ? void 0 : T.onBeforeCreate) == null || F.call(T, k);
4152
+ var T, V;
4153
+ (V = (T = e._tiptapOptions) == null ? void 0 : T.onBeforeCreate) == null || V.call(T, k);
4146
4154
  const g = k.editor.schema;
4147
4155
  let v;
4148
4156
  const C = g.nodes.doc.createAndFill;
4149
4157
  g.nodes.doc.createAndFill = (...K) => {
4150
4158
  if (v)
4151
4159
  return v;
4152
- const _ = C.apply(g.nodes.doc, K), Et = JSON.parse(JSON.stringify(_.toJSON()));
4153
- return Et.content[0].content[0].attrs.id = "initialBlockId", v = fe.fromJSON(g, Et), _;
4160
+ const F = C.apply(g.nodes.doc, K), Ct = JSON.parse(JSON.stringify(F.toJSON()));
4161
+ return Ct.content[0].content[0].attrs.id = "initialBlockId", v = fe.fromJSON(g, Ct), v;
4154
4162
  };
4155
4163
  const b = g.node(
4156
4164
  "doc",
@@ -4184,7 +4192,7 @@ class ce {
4184
4192
  attributes: {
4185
4193
  ...(f = (h = e._tiptapOptions) == null ? void 0 : h.editorProps) == null ? void 0 : f.attributes,
4186
4194
  ...(y = e.domAttributes) == null ? void 0 : y.editor,
4187
- class: V(
4195
+ class: z(
4188
4196
  "bn-root",
4189
4197
  "bn-editor",
4190
4198
  e.defaultStyles ? "bn-default-styles" : "",
@@ -4320,7 +4328,7 @@ class ce {
4320
4328
  * @param placement Whether the text cursor should be placed at the start or end of the block.
4321
4329
  */
4322
4330
  setTextCursorPosition(t, e = "start") {
4323
- const o = typeof t == "string" ? t : t.id, { posBeforeNode: r } = yt(o, this._tiptapEditor.state.doc), { startPos: i, contentNode: s } = w(
4331
+ const o = typeof t == "string" ? t : t.id, { posBeforeNode: r } = wt(o, this._tiptapEditor.state.doc), { startPos: i, contentNode: s } = w(
4324
4332
  this._tiptapEditor.state.doc,
4325
4333
  r + 2
4326
4334
  ), a = this.blockSchema[s.type.name].content;
@@ -4605,7 +4613,7 @@ function ct(n = "") {
4605
4613
  ] : n;
4606
4614
  }
4607
4615
  function de(n) {
4608
- return typeof n == "string" ? ct(n) : Array.isArray(n) ? n.flatMap((t) => typeof t == "string" ? ct(t) : Vt(t) ? {
4616
+ return typeof n == "string" ? ct(n) : Array.isArray(n) ? n.flatMap((t) => typeof t == "string" ? ct(t) : Ft(t) ? {
4609
4617
  ...t,
4610
4618
  content: ct(t.content)
4611
4619
  } : Z(t) ? t : {
@@ -4672,13 +4680,13 @@ export {
4672
4680
  st as createExternalHTMLExporter,
4673
4681
  xr as createInlineContentSpec,
4674
4682
  cn as createInlineContentSpecFromTipTapNode,
4675
- Xt as createInternalBlockSpec,
4676
- Wt as createInternalHTMLSerializer,
4683
+ Jt as createInternalBlockSpec,
4684
+ qt as createInternalHTMLSerializer,
4677
4685
  ln as createInternalInlineContentSpec,
4678
- Zt as createInternalStyleSpec,
4686
+ Qt as createInternalStyleSpec,
4679
4687
  W as createStronglyTypedTiptapNode,
4680
4688
  Br as createStyleSpec,
4681
- R as createStyleSpecFromTipTapMark,
4689
+ _ as createStyleSpecFromTipTapMark,
4682
4690
  ne as defaultBlockSchema,
4683
4691
  ee as defaultBlockSpecs,
4684
4692
  Lr as defaultInlineContentSchema,
@@ -4690,33 +4698,33 @@ export {
4690
4698
  eo as formattingToolbarPluginKey,
4691
4699
  nn as getBlockFromPos,
4692
4700
  Fo as getBlockNoteExtensions,
4693
- Jt as getBlockSchemaFromSpecs,
4701
+ Yt as getBlockSchemaFromSpecs,
4694
4702
  ko as getDefaultSlashMenuItems,
4695
- St as getDraggableBlockFromCoords,
4703
+ Et as getDraggableBlockFromCoords,
4696
4704
  dn as getInlineContentParseRules,
4697
- Yt as getInlineContentSchemaFromSpecs,
4705
+ Zt as getInlineContentSchemaFromSpecs,
4698
4706
  on as getParseRules,
4699
4707
  hn as getStyleParseRules,
4700
- Qt as getStyleSchemaFromSpecs,
4708
+ te as getStyleSchemaFromSpecs,
4701
4709
  ro as hyperlinkToolbarPluginKey,
4702
4710
  Y as imageToolbarPluginKey,
4703
- qt as inheritedProps,
4711
+ Kt as inheritedProps,
4704
4712
  bt as inlineContentToNodes,
4705
4713
  en as isAppleOS,
4706
- xt as isLinkInlineContent,
4707
- Vt as isPartialLinkInlineContent,
4714
+ Bt as isLinkInlineContent,
4715
+ Ft as isPartialLinkInlineContent,
4708
4716
  Z as isStyledTextInlineContent,
4709
- V as mergeCSSClasses,
4717
+ z as mergeCSSClasses,
4710
4718
  M as nodeToBlock,
4711
- $t as nodeToCustomInlineContent,
4719
+ Gt as nodeToCustomInlineContent,
4712
4720
  ue as partialBlockToBlockForTesting,
4713
4721
  Hr as partialBlocksToBlocksForTesting,
4714
- Kt as propsToAttributes,
4722
+ Xt as propsToAttributes,
4715
4723
  lo as setupSuggestionsMenu,
4716
4724
  fo as sideMenuPluginKey,
4717
- vt as slashMenuPluginKey,
4725
+ St as slashMenuPluginKey,
4718
4726
  un as stylePropsToAttributes,
4719
- Ft as tableContentToNodes,
4727
+ Ut as tableContentToNodes,
4720
4728
  J as tableHandlesPluginKey,
4721
4729
  Tr as uploadToTmpFilesDotOrg_DEV_ONLY,
4722
4730
  lt as wrapInBlockStructure