@blocknote/core 0.4.6-alpha.1 → 0.4.6-alpha.3

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
@@ -4,9 +4,9 @@ var h = (o, e, t) => (Be(o, typeof e != "symbol" ? e + "" : e, t), t);
4
4
  import { Extension as C, findChildren as q, combineTransactionSteps as Te, getChangedRanges as we, findChildrenInRange as Me, Mark as ne, Node as E, mergeAttributes as x, InputRule as j, findParentNode as xe, isTextSelection as Ee, isNodeSelection as Ie, posToDOMRect as re, getMarkRange as X, extensions as N, Editor as Se } from "@tiptap/core";
5
5
  import { Slice as A, Fragment as P, DOMSerializer as Ae, DOMParser as Pe } from "prosemirror-model";
6
6
  import { Plugin as B, PluginKey as v, TextSelection as Q, Selection as U, NodeSelection as Ne } from "prosemirror-state";
7
- import { v4 as He } from "uuid";
7
+ import { v4 as Le } from "uuid";
8
8
  import ie from "rehype-parse";
9
- import Le from "rehype-remark";
9
+ import He from "rehype-remark";
10
10
  import se from "rehype-stringify";
11
11
  import ae from "remark-gfm";
12
12
  import Oe from "remark-parse";
@@ -88,7 +88,7 @@ const W = C.create({
88
88
  return {
89
89
  attributeName: "id",
90
90
  types: [],
91
- generateID: () => window.__TEST_OPTIONS ? (window.__TEST_OPTIONS.mockID === void 0 ? window.__TEST_OPTIONS.mockID = 0 : window.__TEST_OPTIONS.mockID++, parseInt(window.__TEST_OPTIONS.mockID)) : He(),
91
+ generateID: () => window.__TEST_OPTIONS ? (window.__TEST_OPTIONS.mockID === void 0 ? window.__TEST_OPTIONS.mockID = 0 : window.__TEST_OPTIONS.mockID++, parseInt(window.__TEST_OPTIONS.mockID)) : Le(),
92
92
  filterTransaction: null
93
93
  };
94
94
  },
@@ -144,18 +144,18 @@ const W = C.create({
144
144
  m,
145
145
  (T) => a.includes(T.type.name)
146
146
  ), g = y.map(({ node: T }) => T.attrs[l]).filter((T) => T !== null), R = Je(g);
147
- y.forEach(({ node: T, pos: L }) => {
147
+ y.forEach(({ node: T, pos: H }) => {
148
148
  var z;
149
- const J = (z = s.doc.nodeAt(L)) === null || z === void 0 ? void 0 : z.attrs[l];
149
+ const J = (z = s.doc.nodeAt(H)) === null || z === void 0 ? void 0 : z.attrs[l];
150
150
  if (J === null) {
151
- s.setNodeMarkup(L, void 0, {
151
+ s.setNodeMarkup(H, void 0, {
152
152
  ...T.attrs,
153
153
  [l]: c()
154
154
  });
155
155
  return;
156
156
  }
157
- const { deleted: ve } = f.invert().mapResult(L);
158
- ve && R.includes(J) && s.setNodeMarkup(L, void 0, {
157
+ const { deleted: ve } = f.invert().mapResult(H);
158
+ ve && R.includes(J) && s.setNodeMarkup(H, void 0, {
159
159
  ...T.attrs,
160
160
  [l]: c()
161
161
  });
@@ -511,7 +511,7 @@ async function ke(o, e) {
511
511
  return i;
512
512
  }
513
513
  async function it(o, e) {
514
- return (await Y().use(ie, { fragment: !0 }).use(nt).use(Le).use(ae).use(De).process(await me(o, e))).value;
514
+ return (await Y().use(ie, { fragment: !0 }).use(nt).use(He).use(ae).use(De).process(await me(o, e))).value;
515
515
  }
516
516
  async function st(o, e) {
517
517
  const t = await Y().use(Oe).use(ae).use(_e).use(se).process(o);
@@ -989,7 +989,7 @@ const at = C.create({
989
989
  {
990
990
  tag: "p",
991
991
  priority: 200,
992
- node: "blockContainer"
992
+ node: "paragraph"
993
993
  }
994
994
  ];
995
995
  },
@@ -1039,17 +1039,17 @@ const at = C.create({
1039
1039
  {
1040
1040
  tag: "h1",
1041
1041
  attrs: { level: "1" },
1042
- node: "blockContainer"
1042
+ node: "heading"
1043
1043
  },
1044
1044
  {
1045
1045
  tag: "h2",
1046
1046
  attrs: { level: "2" },
1047
- node: "blockContainer"
1047
+ node: "heading"
1048
1048
  },
1049
1049
  {
1050
1050
  tag: "h3",
1051
1051
  attrs: { level: "3" },
1052
- node: "blockContainer"
1052
+ node: "heading"
1053
1053
  }
1054
1054
  ];
1055
1055
  },
@@ -1116,7 +1116,7 @@ const at = C.create({
1116
1116
  const e = o.parentElement;
1117
1117
  return e === null ? !1 : e.tagName === "UL" ? {} : !1;
1118
1118
  },
1119
- node: "blockContainer"
1119
+ node: "bulletListItem"
1120
1120
  },
1121
1121
  // Case for BlockNote list structure.
1122
1122
  {
@@ -1128,7 +1128,7 @@ const at = C.create({
1128
1128
  return e === null ? !1 : e.getAttribute("data-content-type") === "bulletListItem" ? {} : !1;
1129
1129
  },
1130
1130
  priority: 300,
1131
- node: "blockContainer"
1131
+ node: "bulletListItem"
1132
1132
  }
1133
1133
  ];
1134
1134
  },
@@ -1221,7 +1221,7 @@ const at = C.create({
1221
1221
  const e = o.parentElement;
1222
1222
  return e === null ? !1 : e.tagName === "OL" ? {} : !1;
1223
1223
  },
1224
- node: "blockContainer"
1224
+ node: "numberedListItem"
1225
1225
  },
1226
1226
  // Case for BlockNote list structure.
1227
1227
  // (e.g.: when pasting from blocknote)
@@ -1234,7 +1234,7 @@ const at = C.create({
1234
1234
  return e === null ? !1 : e.getAttribute("data-content-type") === "numberedListItem" ? {} : !1;
1235
1235
  },
1236
1236
  priority: 300,
1237
- node: "blockContainer"
1237
+ node: "numberedListItem"
1238
1238
  }
1239
1239
  ];
1240
1240
  },
@@ -1329,7 +1329,7 @@ class Nt {
1329
1329
  };
1330
1330
  }
1331
1331
  }
1332
- function Ht({
1332
+ function Lt({
1333
1333
  pluginKey: o,
1334
1334
  editor: e,
1335
1335
  defaultTriggerCharacter: t,
@@ -1472,7 +1472,7 @@ function Ht({
1472
1472
  }
1473
1473
  });
1474
1474
  }
1475
- const K = new v("suggestions-slash-commands"), Lt = C.create({
1475
+ const K = new v("suggestions-slash-commands"), Ht = C.create({
1476
1476
  name: "slash-command",
1477
1477
  addOptions() {
1478
1478
  return {
@@ -1486,7 +1486,7 @@ const K = new v("suggestions-slash-commands"), Lt = C.create({
1486
1486
  throw new Error("required args not defined for SlashMenuExtension");
1487
1487
  const o = this.options.commands;
1488
1488
  return [
1489
- Ht({
1489
+ Lt({
1490
1490
  pluginKey: K,
1491
1491
  editor: this.options.editor,
1492
1492
  defaultTriggerCharacter: "/",
@@ -1499,7 +1499,7 @@ const K = new v("suggestions-slash-commands"), Lt = C.create({
1499
1499
  ];
1500
1500
  }
1501
1501
  });
1502
- class H extends U {
1502
+ class L extends U {
1503
1503
  constructor(t, n) {
1504
1504
  super(t, n);
1505
1505
  h(this, "nodes");
@@ -1510,13 +1510,13 @@ class H extends U {
1510
1510
  });
1511
1511
  }
1512
1512
  static create(t, n, r = n) {
1513
- return new H(t.resolve(n), t.resolve(r));
1513
+ return new L(t.resolve(n), t.resolve(r));
1514
1514
  }
1515
1515
  content() {
1516
1516
  return new A(P.from(this.nodes), 0, 0);
1517
1517
  }
1518
1518
  eq(t) {
1519
- if (!(t instanceof H) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
1519
+ if (!(t instanceof L) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to)
1520
1520
  return !1;
1521
1521
  for (let n = 0; n < this.nodes.length; n++)
1522
1522
  if (!this.nodes[n].eq(t.nodes[n]))
@@ -1525,7 +1525,7 @@ class H extends U {
1525
1525
  }
1526
1526
  map(t, n) {
1527
1527
  let r = n.mapResult(this.from), i = n.mapResult(this.to);
1528
- return i.deleted ? U.near(t.resolve(r.pos)) : r.deleted ? U.near(t.resolve(i.pos)) : new H(
1528
+ return i.deleted ? U.near(t.resolve(r.pos)) : r.deleted ? U.near(t.resolve(i.pos)) : new L(
1529
1529
  t.resolve(r.pos),
1530
1530
  t.resolve(i.pos)
1531
1531
  );
@@ -1598,7 +1598,7 @@ function Ft(o, e) {
1598
1598
  if (r != null) {
1599
1599
  const i = e.state.selection, d = e.state.doc, { from: s, to: a } = Dt(i, d), l = s <= r && r < a, c = !i.$anchor.node().eq(i.$head.node());
1600
1600
  l && c ? (e.dispatch(
1601
- e.state.tr.setSelection(H.create(d, s, a))
1601
+ e.state.tr.setSelection(L.create(d, s, a))
1602
1602
  ), oe(e, s, a)) : (e.dispatch(
1603
1603
  e.state.tr.setSelection(Ne.create(e.state.doc, r))
1604
1604
  ), oe(e, r));
@@ -2495,7 +2495,7 @@ const Qt = [
2495
2495
  hyperlinkToolbarFactory: o.uiFactories.hyperlinkToolbarFactory
2496
2496
  })
2497
2497
  ) : e.push(de), o.uiFactories.slashMenuFactory && e.push(
2498
- Lt.configure({
2498
+ Ht.configure({
2499
2499
  editor: o.editor,
2500
2500
  commands: o.slashCommands,
2501
2501
  slashMenuFactory: o.uiFactories.slashMenuFactory
@@ -2506,7 +2506,7 @@ const Qt = [
2506
2506
  enablePasteRules: !0,
2507
2507
  enableCoreExtensions: !1
2508
2508
  };
2509
- class Ho {
2509
+ class Lo {
2510
2510
  constructor(e = {}) {
2511
2511
  h(this, "_tiptapEditor");
2512
2512
  h(this, "blockCache", /* @__PURE__ */ new WeakMap());
@@ -2522,7 +2522,7 @@ class Ho {
2522
2522
  ...e._tiptapOptions,
2523
2523
  onCreate: () => {
2524
2524
  var a;
2525
- (a = e.onEditorCreate) == null || a.call(e, this);
2525
+ (a = e.onEditorReady) == null || a.call(e, this);
2526
2526
  },
2527
2527
  onUpdate: () => {
2528
2528
  var a;
@@ -2695,7 +2695,7 @@ class Ho {
2695
2695
  }
2696
2696
  export {
2697
2697
  I as BaseSlashMenuItem,
2698
- Ho as BlockNoteEditor,
2698
+ Lo as BlockNoteEditor,
2699
2699
  ee as blockProps,
2700
2700
  Qt as defaultSlashMenuItems,
2701
2701
  no as getBlockNoteExtensions,