@blocknote/core 0.46.2 → 0.47.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/{BlockNoteSchema-DmFDeA0n.cjs → BlockNoteSchema-CwhtPpVC.cjs} +2 -2
- package/dist/{BlockNoteSchema-DmFDeA0n.cjs.map → BlockNoteSchema-CwhtPpVC.cjs.map} +1 -1
- package/dist/{BlockNoteSchema-BkXw8HJ6.js → BlockNoteSchema-dmbNkHA-.js} +2 -2
- package/dist/{BlockNoteSchema-BkXw8HJ6.js.map → BlockNoteSchema-dmbNkHA-.js.map} +1 -1
- package/dist/TrailingNode-DHOdUVUO.cjs +2 -0
- package/dist/TrailingNode-DHOdUVUO.cjs.map +1 -0
- package/dist/{TrailingNode-CxM966vN.js → TrailingNode-F9hX_UlQ.js} +451 -445
- package/dist/TrailingNode-F9hX_UlQ.js.map +1 -0
- package/dist/blocknote.cjs +4 -4
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +1624 -1370
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/{defaultBlocks-DosClM5E.cjs → defaultBlocks-CSB5GiAu.cjs} +4 -4
- package/dist/defaultBlocks-CSB5GiAu.cjs.map +1 -0
- package/dist/{defaultBlocks-DE5GNdJH.js → defaultBlocks-Caw1U1oV.js} +49 -46
- package/dist/defaultBlocks-Caw1U1oV.js.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +3 -3
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +813 -28
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +1 -1
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +30 -7
- package/src/blocks/ListItem/CheckListItem/block.test.ts +61 -0
- package/src/blocks/ListItem/CheckListItem/block.ts +4 -0
- package/src/editor/Block.css +2 -2
- package/src/editor/transformPasted.ts +69 -0
- package/src/extensions/Collaboration/YCursorPlugin.ts +3 -1
- package/src/extensions/SideMenu/SideMenu.ts +44 -0
- package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +191 -0
- package/src/extensions/SuggestionMenu/SuggestionMenu.ts +28 -11
- package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +470 -64
- package/src/i18n/locales/fa.ts +390 -0
- package/src/i18n/locales/index.ts +2 -0
- package/src/i18n/locales/uz.ts +421 -0
- package/src/schema/blocks/createSpec.ts +2 -0
- package/types/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.d.ts +5 -0
- package/types/src/blocks/ListItem/CheckListItem/block.test.d.ts +1 -0
- package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +12 -3
- package/types/src/extensions/SuggestionMenu/SuggestionMenu.test.d.ts +1 -0
- package/types/src/i18n/locales/fa.d.ts +320 -0
- package/types/src/i18n/locales/index.d.ts +2 -0
- package/types/src/i18n/locales/uz.d.ts +2 -0
- package/dist/TrailingNode-CxM966vN.js.map +0 -1
- package/dist/TrailingNode-D-CZ76FS.cjs +0 -2
- package/dist/TrailingNode-D-CZ76FS.cjs.map +0 -1
- package/dist/defaultBlocks-DE5GNdJH.js.map +0 -1
- package/dist/defaultBlocks-DosClM5E.cjs.map +0 -1
|
@@ -14,10 +14,10 @@ import at from "@tiptap/extension-code";
|
|
|
14
14
|
import st from "@tiptap/extension-italic";
|
|
15
15
|
import it from "@tiptap/extension-strike";
|
|
16
16
|
import ct from "@tiptap/extension-underline";
|
|
17
|
-
import { DOMParser as
|
|
17
|
+
import { DOMParser as Se, Fragment as lt, DOMSerializer as ie } from "@tiptap/pm/model";
|
|
18
18
|
import { createHighlightPlugin as dt } from "prosemirror-highlight";
|
|
19
19
|
import { createParser as ut } from "prosemirror-highlight/shiki";
|
|
20
|
-
import { Slice as
|
|
20
|
+
import { Slice as xe, Fragment as F, DOMParser as we } from "prosemirror-model";
|
|
21
21
|
import { Plugin as pt, PluginKey as ft } from "@tiptap/pm/state";
|
|
22
22
|
import { DecorationSet as ce, Decoration as ht } from "@tiptap/pm/view";
|
|
23
23
|
const mt = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
@@ -219,7 +219,7 @@ function Et(e, t) {
|
|
|
219
219
|
i,
|
|
220
220
|
(a = t.meta) != null && a.code ? `
|
|
221
221
|
` : "<br>"
|
|
222
|
-
),
|
|
222
|
+
), Se.fromSchema(r).parse(i, {
|
|
223
223
|
topNode: r.nodes.paragraph.create(),
|
|
224
224
|
preserveWhitespace: !0
|
|
225
225
|
}).content;
|
|
@@ -387,14 +387,14 @@ function bo(e) {
|
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function St(e, t) {
|
|
391
391
|
return {
|
|
392
392
|
config: e,
|
|
393
393
|
implementation: t
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
396
|
function Co(e, t, n) {
|
|
397
|
-
return
|
|
397
|
+
return St(
|
|
398
398
|
{
|
|
399
399
|
type: e.name,
|
|
400
400
|
propSchema: t,
|
|
@@ -406,7 +406,7 @@ function Co(e, t, n) {
|
|
|
406
406
|
}
|
|
407
407
|
);
|
|
408
408
|
}
|
|
409
|
-
function
|
|
409
|
+
function xt(e) {
|
|
410
410
|
return Object.fromEntries(
|
|
411
411
|
Object.entries(e).map(([t, n]) => [t, n.config])
|
|
412
412
|
);
|
|
@@ -650,7 +650,7 @@ function At(e, t, n, o, r, a, s) {
|
|
|
650
650
|
t.replace(
|
|
651
651
|
l,
|
|
652
652
|
u,
|
|
653
|
-
new
|
|
653
|
+
new xe(
|
|
654
654
|
F.from(c),
|
|
655
655
|
p - d - 1,
|
|
656
656
|
m - d - 1
|
|
@@ -678,7 +678,7 @@ function de(e, t, n) {
|
|
|
678
678
|
new ze(
|
|
679
679
|
n.childContainer.beforePos + 1,
|
|
680
680
|
n.childContainer.afterPos - 1,
|
|
681
|
-
new
|
|
681
|
+
new xe(F.from(r), 0, 0)
|
|
682
682
|
)
|
|
683
683
|
);
|
|
684
684
|
else {
|
|
@@ -711,10 +711,10 @@ function Pt(e) {
|
|
|
711
711
|
return null;
|
|
712
712
|
const n = e.doc.resolve(t.head);
|
|
713
713
|
let o = -1, r = -1;
|
|
714
|
-
for (let
|
|
715
|
-
const
|
|
716
|
-
if (o < 0 && (
|
|
717
|
-
r =
|
|
714
|
+
for (let x = n.depth; x >= 0; x--) {
|
|
715
|
+
const S = n.node(x).type.name;
|
|
716
|
+
if (o < 0 && (S === "tableCell" || S === "tableHeader") && (o = x), S === "table") {
|
|
717
|
+
r = x;
|
|
718
718
|
break;
|
|
719
719
|
}
|
|
720
720
|
}
|
|
@@ -730,15 +730,15 @@ function Pt(e) {
|
|
|
730
730
|
return { row: d, col: p, offset: E };
|
|
731
731
|
}
|
|
732
732
|
function Nt(e, t, n) {
|
|
733
|
-
var
|
|
733
|
+
var x;
|
|
734
734
|
if (t.blockNoteType !== "table")
|
|
735
735
|
return !1;
|
|
736
736
|
let o = -1;
|
|
737
737
|
if (t.isBlockContainer)
|
|
738
738
|
o = e.mapping.map(t.blockContent.beforePos);
|
|
739
739
|
else {
|
|
740
|
-
const
|
|
741
|
-
e.doc.nodesBetween(
|
|
740
|
+
const S = e.mapping.map(t.bnBlock.beforePos), P = S + (((x = e.doc.nodeAt(S)) == null ? void 0 : x.nodeSize) || 0);
|
|
741
|
+
e.doc.nodesBetween(S, P, (g, w) => g.type.name === "table" ? (o = w, !1) : !0);
|
|
742
742
|
}
|
|
743
743
|
const r = o >= 0 ? e.doc.nodeAt(o) : null;
|
|
744
744
|
if (!r || r.type.name !== "table")
|
|
@@ -847,13 +847,13 @@ const T = {
|
|
|
847
847
|
renderHTML: (t) => t[e] === h.backgroundColor.default ? {} : {
|
|
848
848
|
"data-background-color": t[e]
|
|
849
849
|
}
|
|
850
|
-
}),
|
|
850
|
+
}), So = (e = "textColor") => ({
|
|
851
851
|
default: h.textColor.default,
|
|
852
852
|
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color : h.textColor.default,
|
|
853
853
|
renderHTML: (t) => t[e] === h.textColor.default ? {} : {
|
|
854
854
|
"data-text-color": t[e]
|
|
855
855
|
}
|
|
856
|
-
}),
|
|
856
|
+
}), xo = (e = "textAlignment") => ({
|
|
857
857
|
default: h.textAlignment.default,
|
|
858
858
|
parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign : h.textAlignment.default,
|
|
859
859
|
renderHTML: (t) => t[e] === h.textAlignment.default ? {} : {
|
|
@@ -1100,7 +1100,7 @@ const Ut = ({ defaultLanguage: e = "text" }) => ({
|
|
|
1100
1100
|
return { language: n.getAttribute("data-language") || ((a = n.className.split(" ").find((s) => s.includes("language-"))) == null ? void 0 : a.replace("language-", "")) };
|
|
1101
1101
|
},
|
|
1102
1102
|
parseContent: ({ el: t, schema: n }) => {
|
|
1103
|
-
const o =
|
|
1103
|
+
const o = Se.fromSchema(n), r = t.firstElementChild;
|
|
1104
1104
|
return o.parse(r, {
|
|
1105
1105
|
preserveWhitespace: "full",
|
|
1106
1106
|
topNode: n.nodes.codeBlock.create()
|
|
@@ -1502,9 +1502,9 @@ const jt = () => ({
|
|
|
1502
1502
|
}));
|
|
1503
1503
|
}, E = () => {
|
|
1504
1504
|
t.isEditable && (o.appendChild(c), o.appendChild(l));
|
|
1505
|
-
}, S = (g) => {
|
|
1506
|
-
g.relatedTarget === c || g.relatedTarget === l || d || t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
1507
1505
|
}, x = (g) => {
|
|
1506
|
+
g.relatedTarget === c || g.relatedTarget === l || d || t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
1507
|
+
}, S = (g) => {
|
|
1508
1508
|
g.preventDefault(), i.contains(u) || i.appendChild(u);
|
|
1509
1509
|
const w = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
1510
1510
|
d = {
|
|
@@ -1521,12 +1521,12 @@ const jt = () => ({
|
|
|
1521
1521
|
initialClientX: w
|
|
1522
1522
|
};
|
|
1523
1523
|
};
|
|
1524
|
-
return window.addEventListener("mousemove", m), window.addEventListener("touchmove", m), window.addEventListener("mouseup", f), window.addEventListener("touchend", f), i.addEventListener("mouseenter", E), i.addEventListener("mouseleave",
|
|
1524
|
+
return window.addEventListener("mousemove", m), window.addEventListener("touchmove", m), window.addEventListener("mouseup", f), window.addEventListener("touchend", f), i.addEventListener("mouseenter", E), i.addEventListener("mouseleave", x), c.addEventListener(
|
|
1525
1525
|
"mousedown",
|
|
1526
|
-
|
|
1526
|
+
S
|
|
1527
1527
|
), c.addEventListener(
|
|
1528
1528
|
"touchstart",
|
|
1529
|
-
|
|
1529
|
+
S
|
|
1530
1530
|
), l.addEventListener(
|
|
1531
1531
|
"mousedown",
|
|
1532
1532
|
P
|
|
@@ -1536,12 +1536,12 @@ const jt = () => ({
|
|
|
1536
1536
|
), {
|
|
1537
1537
|
dom: i,
|
|
1538
1538
|
destroy: () => {
|
|
1539
|
-
s == null || s(), window.removeEventListener("mousemove", m), window.removeEventListener("touchmove", m), window.removeEventListener("mouseup", f), window.removeEventListener("touchend", f), i.removeEventListener("mouseenter", E), i.removeEventListener("mouseleave",
|
|
1539
|
+
s == null || s(), window.removeEventListener("mousemove", m), window.removeEventListener("touchmove", m), window.removeEventListener("mouseup", f), window.removeEventListener("touchend", f), i.removeEventListener("mouseenter", E), i.removeEventListener("mouseleave", x), c.removeEventListener(
|
|
1540
1540
|
"mousedown",
|
|
1541
|
-
|
|
1541
|
+
S
|
|
1542
1542
|
), c.removeEventListener(
|
|
1543
1543
|
"touchstart",
|
|
1544
|
-
|
|
1544
|
+
S
|
|
1545
1545
|
), l.removeEventListener(
|
|
1546
1546
|
"mousedown",
|
|
1547
1547
|
P
|
|
@@ -1800,8 +1800,8 @@ const sn = () => ({
|
|
|
1800
1800
|
parseContent: ({ el: e, schema: t }) => Y(e, t, "checkListItem"),
|
|
1801
1801
|
render(e, t) {
|
|
1802
1802
|
const n = document.createDocumentFragment(), o = document.createElement("input");
|
|
1803
|
-
o.type = "checkbox", o.checked = e.props.checked, e.props.checked && o.setAttribute("checked", ""), o.addEventListener("change", () => {
|
|
1804
|
-
t.updateBlock(e, { props: { checked: !e.props.checked } });
|
|
1803
|
+
o.type = "checkbox", o.checked = e.props.checked, e.props.checked && o.setAttribute("checked", ""), o.disabled = !t.isEditable, o.addEventListener("change", () => {
|
|
1804
|
+
t.isEditable && t.updateBlock(e, { props: { checked: !e.props.checked } });
|
|
1805
1805
|
});
|
|
1806
1806
|
const r = document.createElement("p"), a = document.createElement("div");
|
|
1807
1807
|
return a.contentEditable = "false", a.appendChild(o), n.appendChild(a), n.appendChild(r), {
|
|
@@ -2203,7 +2203,7 @@ const un = () => new pt({
|
|
|
2203
2203
|
}
|
|
2204
2204
|
}), En = {
|
|
2205
2205
|
textColor: h.textColor
|
|
2206
|
-
},
|
|
2206
|
+
}, Sn = N.create({
|
|
2207
2207
|
name: "tableHeader",
|
|
2208
2208
|
addOptions() {
|
|
2209
2209
|
return {
|
|
@@ -2254,7 +2254,7 @@ const un = () => new pt({
|
|
|
2254
2254
|
0
|
|
2255
2255
|
];
|
|
2256
2256
|
}
|
|
2257
|
-
}),
|
|
2257
|
+
}), xn = N.create({
|
|
2258
2258
|
name: "tableCell",
|
|
2259
2259
|
addOptions() {
|
|
2260
2260
|
return {
|
|
@@ -2430,8 +2430,8 @@ const Tn = () => vt(
|
|
|
2430
2430
|
tiptapExtensions: [
|
|
2431
2431
|
yn,
|
|
2432
2432
|
Mn,
|
|
2433
|
-
xn,
|
|
2434
2433
|
Sn,
|
|
2434
|
+
xn,
|
|
2435
2435
|
Ln
|
|
2436
2436
|
]
|
|
2437
2437
|
}),
|
|
@@ -2667,17 +2667,17 @@ class On {
|
|
|
2667
2667
|
}
|
|
2668
2668
|
}
|
|
2669
2669
|
const B = new Ze("SuggestionMenuPlugin"), _n = k(({ editor: e }) => {
|
|
2670
|
-
const t =
|
|
2670
|
+
const t = /* @__PURE__ */ new Map();
|
|
2671
2671
|
let n;
|
|
2672
2672
|
const o = ve(void 0);
|
|
2673
2673
|
return {
|
|
2674
2674
|
key: "suggestionMenu",
|
|
2675
2675
|
store: o,
|
|
2676
|
-
|
|
2677
|
-
t.
|
|
2676
|
+
addSuggestionMenu: (r) => {
|
|
2677
|
+
t.set(r.triggerCharacter, r);
|
|
2678
2678
|
},
|
|
2679
|
-
|
|
2680
|
-
t.
|
|
2679
|
+
removeSuggestionMenu: (r) => {
|
|
2680
|
+
t.delete(r);
|
|
2681
2681
|
},
|
|
2682
2682
|
closeMenu: () => {
|
|
2683
2683
|
n == null || n.closeMenu();
|
|
@@ -2760,14 +2760,17 @@ const B = new Ze("SuggestionMenuPlugin"), _n = k(({ editor: e }) => {
|
|
|
2760
2760
|
handleTextInput(r, a, s, i) {
|
|
2761
2761
|
if (a === s) {
|
|
2762
2762
|
const c = r.state.doc;
|
|
2763
|
-
for (const l of t) {
|
|
2764
|
-
const
|
|
2765
|
-
if (l ===
|
|
2763
|
+
for (const [l, u] of t) {
|
|
2764
|
+
const d = l.length > 1 ? c.textBetween(a - l.length, a) + i : i;
|
|
2765
|
+
if (l === d) {
|
|
2766
|
+
if (u.shouldOpen && !u.shouldOpen(r.state.tr))
|
|
2767
|
+
continue;
|
|
2766
2768
|
return r.dispatch(r.state.tr.insertText(i)), r.dispatch(
|
|
2767
2769
|
r.state.tr.setMeta(B, {
|
|
2768
|
-
triggerCharacter:
|
|
2770
|
+
triggerCharacter: d
|
|
2769
2771
|
}).scrollIntoView()
|
|
2770
2772
|
), !0;
|
|
2773
|
+
}
|
|
2771
2774
|
}
|
|
2772
2775
|
}
|
|
2773
2776
|
return !1;
|
|
@@ -3087,7 +3090,7 @@ const Po = {
|
|
|
3087
3090
|
}, No = Mt(Fn), $n = {
|
|
3088
3091
|
text: { config: "text", implementation: {} },
|
|
3089
3092
|
link: { config: "link", implementation: {} }
|
|
3090
|
-
}, Ho =
|
|
3093
|
+
}, Ho = xt(
|
|
3091
3094
|
$n
|
|
3092
3095
|
);
|
|
3093
3096
|
export {
|
|
@@ -3126,13 +3129,13 @@ export {
|
|
|
3126
3129
|
v as a3,
|
|
3127
3130
|
A as a4,
|
|
3128
3131
|
Eo as a5,
|
|
3129
|
-
|
|
3130
|
-
|
|
3132
|
+
So as a6,
|
|
3133
|
+
xo as a7,
|
|
3131
3134
|
I as a8,
|
|
3132
3135
|
_n as a9,
|
|
3133
3136
|
Z as aA,
|
|
3134
3137
|
vt as aB,
|
|
3135
|
-
|
|
3138
|
+
St as aC,
|
|
3136
3139
|
Lt as aD,
|
|
3137
3140
|
Le as aE,
|
|
3138
3141
|
wt as aF,
|
|
@@ -3150,7 +3153,7 @@ export {
|
|
|
3150
3153
|
Ao as ac,
|
|
3151
3154
|
ho as ad,
|
|
3152
3155
|
Mt as ae,
|
|
3153
|
-
|
|
3156
|
+
xt as af,
|
|
3154
3157
|
mo as ag,
|
|
3155
3158
|
y as ah,
|
|
3156
3159
|
Bt as ai,
|
|
@@ -3197,4 +3200,4 @@ export {
|
|
|
3197
3200
|
cn as y,
|
|
3198
3201
|
ln as z
|
|
3199
3202
|
};
|
|
3200
|
-
//# sourceMappingURL=defaultBlocks-
|
|
3203
|
+
//# sourceMappingURL=defaultBlocks-Caw1U1oV.js.map
|