@blocknote/core 0.4.6-alpha.0 → 0.4.6-alpha.1
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
|
@@ -5,14 +5,14 @@ import { Extension as C, findChildren as q, combineTransactionSteps as Te, getCh
|
|
|
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
7
|
import { v4 as He } from "uuid";
|
|
8
|
-
import { unified as Y } from "unified";
|
|
9
8
|
import ie from "rehype-parse";
|
|
10
|
-
import se from "rehype-stringify";
|
|
11
9
|
import Le from "rehype-remark";
|
|
10
|
+
import se from "rehype-stringify";
|
|
12
11
|
import ae from "remark-gfm";
|
|
13
|
-
import Oe from "remark-
|
|
14
|
-
import _e from "remark-
|
|
15
|
-
import De from "remark-
|
|
12
|
+
import Oe from "remark-parse";
|
|
13
|
+
import _e from "remark-rehype";
|
|
14
|
+
import De from "remark-stringify";
|
|
15
|
+
import { unified as Y } from "unified";
|
|
16
16
|
import { fromDom as Z } from "hast-util-from-dom";
|
|
17
17
|
import { Bold as Fe } from "@tiptap/extension-bold";
|
|
18
18
|
import { Code as Re } from "@tiptap/extension-code";
|
|
@@ -431,7 +431,23 @@ function fe(o, e) {
|
|
|
431
431
|
function ot(o, e, t) {
|
|
432
432
|
pe(e, o[0], "before", t), fe(o, t);
|
|
433
433
|
}
|
|
434
|
-
function nt(
|
|
434
|
+
function nt() {
|
|
435
|
+
const o = (e) => {
|
|
436
|
+
let t = e.children.length;
|
|
437
|
+
for (let n = 0; n < t; n++) {
|
|
438
|
+
const r = e.children[n];
|
|
439
|
+
if (r.type === "element" && (o(r), r.tagName === "u"))
|
|
440
|
+
if (r.children.length > 0) {
|
|
441
|
+
e.children.splice(n, 1, ...r.children);
|
|
442
|
+
const i = r.children.length - 1;
|
|
443
|
+
t += i, n += i;
|
|
444
|
+
} else
|
|
445
|
+
e.children.splice(n, 1), t--, n--;
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
return o;
|
|
449
|
+
}
|
|
450
|
+
function rt(o) {
|
|
435
451
|
const e = /* @__PURE__ */ new Set([
|
|
436
452
|
...o.orderedListItemBlockTypes,
|
|
437
453
|
...o.unorderedListItemBlockTypes
|
|
@@ -475,29 +491,13 @@ function nt(o) {
|
|
|
475
491
|
};
|
|
476
492
|
return t;
|
|
477
493
|
}
|
|
478
|
-
function rt() {
|
|
479
|
-
const o = (e) => {
|
|
480
|
-
let t = e.children.length;
|
|
481
|
-
for (let n = 0; n < t; n++) {
|
|
482
|
-
const r = e.children[n];
|
|
483
|
-
if (r.type === "element" && (o(r), r.tagName === "u"))
|
|
484
|
-
if (r.children.length > 0) {
|
|
485
|
-
e.children.splice(n, 1, ...r.children);
|
|
486
|
-
const i = r.children.length - 1;
|
|
487
|
-
t += i, n += i;
|
|
488
|
-
} else
|
|
489
|
-
e.children.splice(n, 1), t--, n--;
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
return o;
|
|
493
|
-
}
|
|
494
494
|
async function me(o, e) {
|
|
495
495
|
const t = document.createElement("div"), n = Ae.fromSchema(e);
|
|
496
496
|
for (const i of o) {
|
|
497
497
|
const d = F(i, e), s = n.serializeNode(d);
|
|
498
498
|
t.appendChild(s);
|
|
499
499
|
}
|
|
500
|
-
return (await Y().use(ie, { fragment: !0 }).use(
|
|
500
|
+
return (await Y().use(ie, { fragment: !0 }).use(rt, {
|
|
501
501
|
orderedListItemBlockTypes: /* @__PURE__ */ new Set(["numberedListItem"]),
|
|
502
502
|
unorderedListItemBlockTypes: /* @__PURE__ */ new Set(["bulletListItem"])
|
|
503
503
|
}).use(se).process(t.innerHTML)).value;
|
|
@@ -511,10 +511,10 @@ 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(
|
|
514
|
+
return (await Y().use(ie, { fragment: !0 }).use(nt).use(Le).use(ae).use(De).process(await me(o, e))).value;
|
|
515
515
|
}
|
|
516
516
|
async function st(o, e) {
|
|
517
|
-
const t = await Y().use(
|
|
517
|
+
const t = await Y().use(Oe).use(ae).use(_e).use(se).process(o);
|
|
518
518
|
return ke(t.value, e);
|
|
519
519
|
}
|
|
520
520
|
const at = C.create({
|