@blocknote/core 0.44.2 → 0.46.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.
- package/dist/BlockNoteExtension-BWw0r8Gy.cjs.map +1 -1
- package/dist/BlockNoteExtension-C2X7LW-V.js.map +1 -1
- package/dist/{BlockNoteSchema-BsTi0fNS.js → BlockNoteSchema-DsMVJZv4.js} +2 -2
- package/dist/{BlockNoteSchema-BsTi0fNS.js.map → BlockNoteSchema-DsMVJZv4.js.map} +1 -1
- package/dist/{BlockNoteSchema-CBNkNhkw.cjs → BlockNoteSchema-qt4Czo0-.cjs} +2 -2
- package/dist/{BlockNoteSchema-CBNkNhkw.cjs.map → BlockNoteSchema-qt4Czo0-.cjs.map} +1 -1
- package/dist/ShowSelection-B0ch3unP.js +51 -0
- package/dist/ShowSelection-B0ch3unP.js.map +1 -0
- package/dist/ShowSelection-BxnbRvy4.cjs +2 -0
- package/dist/ShowSelection-BxnbRvy4.cjs.map +1 -0
- package/dist/{TrailingNode-CG2a-HDA.js → TrailingNode-C-Kyrtf1.js} +715 -709
- package/dist/TrailingNode-C-Kyrtf1.js.map +1 -0
- package/dist/TrailingNode-W7GJVng5.cjs +2 -0
- package/dist/TrailingNode-W7GJVng5.cjs.map +1 -0
- package/dist/{blockToNode-DBNbhwwC.js → blockToNode-BNoNIXU7.js} +2 -2
- package/dist/{blockToNode-DBNbhwwC.js.map → blockToNode-BNoNIXU7.js.map} +1 -1
- package/dist/{blockToNode-w7H99R6p.cjs → blockToNode-CumVjgem.cjs} +2 -2
- package/dist/{blockToNode-w7H99R6p.cjs.map → blockToNode-CumVjgem.cjs.map} +1 -1
- package/dist/blocknote.cjs +4 -4
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +1118 -1077
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/comments.cjs +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js +3 -3
- package/dist/comments.js.map +1 -1
- package/dist/{defaultBlocks-B63ufZ5N.js → defaultBlocks-CXOCngjC.js} +273 -312
- package/dist/defaultBlocks-CXOCngjC.js.map +1 -0
- package/dist/defaultBlocks-IsUGVZIq.cjs +6 -0
- package/dist/defaultBlocks-IsUGVZIq.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +4 -4
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.js +1 -1
- package/package.json +18 -18
- package/src/api/blockManipulation/selections/selection.ts +9 -4
- package/src/api/blockManipulation/tables/tables.test.ts +140 -0
- package/src/api/blockManipulation/tables/tables.ts +1 -1
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +17 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +11 -0
- package/src/blocks/ListItem/BulletListItem/block.ts +1 -1
- package/src/blocks/ListItem/CheckListItem/block.ts +6 -4
- package/src/blocks/ListItem/NumberedListItem/block.ts +6 -2
- package/src/comments/extension.ts +6 -2
- package/src/editor/Block.css +1 -1
- package/src/editor/BlockNoteEditor.test.ts +0 -1
- package/src/editor/BlockNoteEditor.ts +9 -39
- package/src/editor/BlockNoteExtension.ts +5 -0
- package/src/editor/managers/EventManager.ts +1 -1
- package/src/editor/managers/ExtensionManager/extensions.ts +3 -13
- package/src/editor/managers/ExtensionManager/index.ts +7 -2
- package/src/editor/managers/SelectionManager.ts +10 -10
- package/src/extensions/BlockChange/BlockChange.ts +2 -2
- package/src/extensions/Collaboration/Collaboration.ts +55 -0
- package/src/extensions/Collaboration/ForkYDoc.ts +4 -9
- package/src/extensions/Collaboration/YCursorPlugin.ts +56 -60
- package/src/extensions/Collaboration/YSync.ts +2 -2
- package/src/extensions/Collaboration/YUndo.ts +2 -2
- package/src/extensions/LinkToolbar/LinkToolbar.ts +1 -1
- package/src/extensions/ShowSelection/ShowSelection.ts +14 -4
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +40 -68
- package/src/extensions/TableHandles/TableHandles.ts +9 -5
- package/src/index.ts +2 -1
- package/src/schema/blocks/createSpec.ts +3 -0
- package/src/util/expandToWords.ts +38 -0
- package/types/src/api/blockManipulation/selections/selection.d.ts +1 -1
- package/types/src/editor/BlockNoteEditor.d.ts +5 -34
- package/types/src/editor/BlockNoteExtension.d.ts +4 -0
- package/types/src/editor/managers/SelectionManager.d.ts +4 -4
- package/types/src/extensions/Collaboration/Collaboration.d.ts +76 -0
- package/types/src/extensions/Collaboration/ForkYDoc.d.ts +2 -11
- package/types/src/extensions/Collaboration/YCursorPlugin.d.ts +3 -11
- package/types/src/extensions/Collaboration/YSync.d.ts +2 -4
- package/types/src/extensions/Collaboration/YUndo.d.ts +1 -1
- package/types/src/extensions/ShowSelection/ShowSelection.d.ts +10 -4
- package/types/src/index.d.ts +2 -1
- package/types/src/util/expandToWords.d.ts +13 -0
- package/dist/ShowSelection-BW37oJ6h.cjs +0 -2
- package/dist/ShowSelection-BW37oJ6h.cjs.map +0 -1
- package/dist/ShowSelection-Dz-NEase.js +0 -43
- package/dist/ShowSelection-Dz-NEase.js.map +0 -1
- package/dist/TrailingNode-CG2a-HDA.js.map +0 -1
- package/dist/TrailingNode-Du4SNHun.cjs +0 -2
- package/dist/TrailingNode-Du4SNHun.cjs.map +0 -1
- package/dist/defaultBlocks-B63ufZ5N.js.map +0 -1
- package/dist/defaultBlocks-BX6UxQa8.cjs +0 -6
- package/dist/defaultBlocks-BX6UxQa8.cjs.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var Oe = Object.defineProperty;
|
|
2
2
|
var _e = (e, t, n) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
-
var
|
|
4
|
-
import { TableMap as be, goToNextCell as ne, columnResizing as Ve, tableEditing as
|
|
3
|
+
var M = (e, t, n) => _e(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { TableMap as be, goToNextCell as ne, columnResizing as Ve, tableEditing as We, CellSelection as Ce, TableView as Re } from "prosemirror-tables";
|
|
5
5
|
import { Node as N, Mark as Fe, Extension as $e, callOrReturn as Ue, getExtensionField as qe, mergeAttributes as z, findParentNode as je } from "@tiptap/core";
|
|
6
6
|
import { TextSelection as ke, Plugin as Ge, PluginKey as Ze } from "prosemirror-state";
|
|
7
7
|
import { DecorationSet as oe, Decoration as re } from "prosemirror-view";
|
|
8
8
|
import { ReplaceStep as ze, Mapping as Xe } from "prosemirror-transform";
|
|
9
9
|
import { ySyncPluginKey as ae, absolutePositionToRelativePosition as Ke, relativePositionToAbsolutePosition as Qe } from "y-prosemirror";
|
|
10
|
-
import { c as k, a as
|
|
11
|
-
import { b as X, v as Je, g as O, a as
|
|
10
|
+
import { c as k, a as ve } from "./BlockNoteExtension-C2X7LW-V.js";
|
|
11
|
+
import { b as X, v as Je, g as O, a as ye, i as se, t as Ye, U as et, q as tt, A as G, r as nt, w as Ee, J as ot } from "./blockToNode-BNoNIXU7.js";
|
|
12
12
|
import rt from "@tiptap/extension-bold";
|
|
13
13
|
import at from "@tiptap/extension-code";
|
|
14
14
|
import st from "@tiptap/extension-italic";
|
|
@@ -17,12 +17,12 @@ import ct from "@tiptap/extension-underline";
|
|
|
17
17
|
import { DOMParser as xe, 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 Se, Fragment as F, DOMParser as we } from "prosemirror-model";
|
|
21
21
|
import { Plugin as pt, PluginKey as ft } from "@tiptap/pm/state";
|
|
22
|
-
import { DecorationSet as ce, Decoration as
|
|
23
|
-
const
|
|
24
|
-
function
|
|
25
|
-
return
|
|
22
|
+
import { DecorationSet as ce, Decoration as ht } from "@tiptap/pm/view";
|
|
23
|
+
const mt = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
24
|
+
function L(e, t = "Ctrl") {
|
|
25
|
+
return mt() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
26
26
|
}
|
|
27
27
|
function D(...e) {
|
|
28
28
|
return [
|
|
@@ -33,7 +33,7 @@ function D(...e) {
|
|
|
33
33
|
].join(" ");
|
|
34
34
|
}
|
|
35
35
|
const uo = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
36
|
-
function
|
|
36
|
+
function gt(e, t, n, o) {
|
|
37
37
|
const r = document.createElement("div");
|
|
38
38
|
r.className = D(
|
|
39
39
|
"bn-block-content",
|
|
@@ -80,7 +80,7 @@ function bt(e, t = "<br>") {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function R(e) {
|
|
84
84
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
85
85
|
}
|
|
86
86
|
function po(e) {
|
|
@@ -118,7 +118,7 @@ function Ct(e) {
|
|
|
118
118
|
// value is the same as its default, we don't display an HTML
|
|
119
119
|
// attribute for it.
|
|
120
120
|
parseHTML: (r) => {
|
|
121
|
-
const a = r.getAttribute(
|
|
121
|
+
const a = r.getAttribute(R(n));
|
|
122
122
|
if (a === null)
|
|
123
123
|
return null;
|
|
124
124
|
if (o.default === void 0 && o.type === "boolean" || o.default !== void 0 && typeof o.default == "boolean")
|
|
@@ -130,7 +130,7 @@ function Ct(e) {
|
|
|
130
130
|
return a;
|
|
131
131
|
},
|
|
132
132
|
renderHTML: (r) => r[n] !== o.default ? {
|
|
133
|
-
[
|
|
133
|
+
[R(n)]: r[n]
|
|
134
134
|
} : {}
|
|
135
135
|
};
|
|
136
136
|
}), t;
|
|
@@ -158,7 +158,7 @@ function Z(e, t, n, o, r = !1, a) {
|
|
|
158
158
|
), s.setAttribute("data-content-type", t);
|
|
159
159
|
for (const [i, c] of Object.entries(n)) {
|
|
160
160
|
const u = o[i].default;
|
|
161
|
-
c !== u && s.setAttribute(
|
|
161
|
+
c !== u && s.setAttribute(R(i), c);
|
|
162
162
|
}
|
|
163
163
|
return r && s.setAttribute("data-file-block", ""), s.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = D(
|
|
164
164
|
"bn-inline-content",
|
|
@@ -168,7 +168,7 @@ function Z(e, t, n, o, r = !1, a) {
|
|
|
168
168
|
dom: s
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function vt(e, t, n) {
|
|
172
172
|
return {
|
|
173
173
|
config: {
|
|
174
174
|
type: e.type,
|
|
@@ -183,7 +183,7 @@ function yt(e, t, n) {
|
|
|
183
183
|
extensions: n
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function yt(e, t) {
|
|
187
187
|
e.stopEvent = (n) => (n.type === "mousedown" && setTimeout(() => {
|
|
188
188
|
t.view.dom.blur();
|
|
189
189
|
}, 10), !0);
|
|
@@ -204,6 +204,8 @@ function Et(e, t) {
|
|
|
204
204
|
const r = (a = t.parse) == null ? void 0 : a.call(t, o);
|
|
205
205
|
return r === void 0 ? !1 : r;
|
|
206
206
|
},
|
|
207
|
+
// Because we do the parsing ourselves, we want to preserve whitespace for content we've parsed
|
|
208
|
+
preserveWhitespace: !0,
|
|
207
209
|
getContent: e.content === "inline" || e.content === "none" ? (o, r) => {
|
|
208
210
|
var a;
|
|
209
211
|
if (t.parseContent)
|
|
@@ -218,14 +220,15 @@ function Et(e, t) {
|
|
|
218
220
|
(a = t.meta) != null && a.code ? `
|
|
219
221
|
` : "<br>"
|
|
220
222
|
), xe.fromSchema(r).parse(i, {
|
|
221
|
-
topNode: r.nodes.paragraph.create()
|
|
223
|
+
topNode: r.nodes.paragraph.create(),
|
|
224
|
+
preserveWhitespace: !0
|
|
222
225
|
}).content;
|
|
223
226
|
}
|
|
224
227
|
return lt.empty;
|
|
225
228
|
} : void 0
|
|
226
229
|
}), n;
|
|
227
230
|
}
|
|
228
|
-
function
|
|
231
|
+
function ho(e, t, n, o) {
|
|
229
232
|
var a, s, i, c;
|
|
230
233
|
const r = t.node || N.create({
|
|
231
234
|
name: e.type,
|
|
@@ -265,12 +268,12 @@ function go(e, t, n, o) {
|
|
|
265
268
|
u,
|
|
266
269
|
this.editor,
|
|
267
270
|
e.type
|
|
268
|
-
), p = ((f = this.options.domAttributes) == null ? void 0 : f.blockContent) || {},
|
|
271
|
+
), p = ((f = this.options.domAttributes) == null ? void 0 : f.blockContent) || {}, m = t.render.call(
|
|
269
272
|
{ blockContentDOMAttributes: p, props: l, renderType: "nodeView" },
|
|
270
273
|
d,
|
|
271
274
|
u
|
|
272
275
|
);
|
|
273
|
-
return ((E = t.meta) == null ? void 0 : E.selectable) === !1 &&
|
|
276
|
+
return ((E = t.meta) == null ? void 0 : E.selectable) === !1 && yt(m, this.editor), m;
|
|
274
277
|
};
|
|
275
278
|
}
|
|
276
279
|
});
|
|
@@ -299,9 +302,9 @@ function go(e, t, n, o) {
|
|
|
299
302
|
// TODO: this should not have wrapInBlockStructure and generally be a lot simpler
|
|
300
303
|
// post-processing in externalHTMLExporter should not be necessary
|
|
301
304
|
toExternalHTML: (l, u) => {
|
|
302
|
-
var p,
|
|
305
|
+
var p, m;
|
|
303
306
|
const d = ((p = r.options.domAttributes) == null ? void 0 : p.blockContent) || {};
|
|
304
|
-
return ((
|
|
307
|
+
return ((m = t.toExternalHTML) == null ? void 0 : m.call(
|
|
305
308
|
{ blockContentDOMAttributes: d },
|
|
306
309
|
l,
|
|
307
310
|
u
|
|
@@ -315,10 +318,10 @@ function go(e, t, n, o) {
|
|
|
315
318
|
extensions: n
|
|
316
319
|
};
|
|
317
320
|
}
|
|
318
|
-
function
|
|
321
|
+
function mo(e) {
|
|
319
322
|
return e;
|
|
320
323
|
}
|
|
321
|
-
function
|
|
324
|
+
function y(e, t, n) {
|
|
322
325
|
return (o = {}) => {
|
|
323
326
|
const r = typeof e == "function" ? e(o) : e, a = typeof t == "function" ? t(o) : t, s = n ? typeof n == "function" ? n(o) : n : void 0;
|
|
324
327
|
return {
|
|
@@ -368,11 +371,11 @@ function v(e, t, n) {
|
|
|
368
371
|
};
|
|
369
372
|
};
|
|
370
373
|
}
|
|
371
|
-
function
|
|
374
|
+
function go(e, t, n, o) {
|
|
372
375
|
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([r, a]) => {
|
|
373
376
|
const s = o[r];
|
|
374
377
|
return a !== s.default;
|
|
375
|
-
}).map(([r, a]) => [
|
|
378
|
+
}).map(([r, a]) => [R(r), a]).forEach(([r, a]) => e.dom.setAttribute(r, a)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
376
379
|
}
|
|
377
380
|
function bo(e) {
|
|
378
381
|
return {
|
|
@@ -401,12 +404,12 @@ function Co(e, t, n) {
|
|
|
401
404
|
}
|
|
402
405
|
);
|
|
403
406
|
}
|
|
404
|
-
function
|
|
407
|
+
function St(e) {
|
|
405
408
|
return Object.fromEntries(
|
|
406
409
|
Object.entries(e).map(([t, n]) => [t, n.config])
|
|
407
410
|
);
|
|
408
411
|
}
|
|
409
|
-
function
|
|
412
|
+
function wt(e) {
|
|
410
413
|
return e === "boolean" ? {} : {
|
|
411
414
|
stringValue: {
|
|
412
415
|
default: void 0,
|
|
@@ -507,7 +510,7 @@ function Le(e, t) {
|
|
|
507
510
|
const n = Fe.create({
|
|
508
511
|
name: e.type,
|
|
509
512
|
addAttributes() {
|
|
510
|
-
return
|
|
513
|
+
return wt(e.propSchema);
|
|
511
514
|
},
|
|
512
515
|
parseHTML() {
|
|
513
516
|
return Lt(e, t.parse);
|
|
@@ -593,7 +596,7 @@ function K(e, t, n, o, r) {
|
|
|
593
596
|
} else if (!a.isBlockContainer && l.isInGroup("bnBlock"))
|
|
594
597
|
de(n, e, a);
|
|
595
598
|
else {
|
|
596
|
-
const d =
|
|
599
|
+
const d = ye(a.bnBlock.node, i);
|
|
597
600
|
e.replaceWith(
|
|
598
601
|
a.bnBlock.beforePos,
|
|
599
602
|
a.bnBlock.afterPos,
|
|
@@ -641,14 +644,14 @@ function At(e, t, n, o, r, a, s) {
|
|
|
641
644
|
...r.blockContent.node.attrs,
|
|
642
645
|
...e.props
|
|
643
646
|
});
|
|
644
|
-
const l = r.blockContent.beforePos + 1 + (a ?? 0), u = r.blockContent.beforePos + 1 + (s ?? r.blockContent.node.content.size), d = t.doc.resolve(r.blockContent.beforePos).depth, p = t.doc.resolve(l).depth,
|
|
647
|
+
const l = r.blockContent.beforePos + 1 + (a ?? 0), u = r.blockContent.beforePos + 1 + (s ?? r.blockContent.node.content.size), d = t.doc.resolve(r.blockContent.beforePos).depth, p = t.doc.resolve(l).depth, m = t.doc.resolve(u).depth;
|
|
645
648
|
t.replace(
|
|
646
649
|
l,
|
|
647
650
|
u,
|
|
648
|
-
new
|
|
651
|
+
new Se(
|
|
649
652
|
F.from(c),
|
|
650
653
|
p - d - 1,
|
|
651
|
-
|
|
654
|
+
m - d - 1
|
|
652
655
|
)
|
|
653
656
|
);
|
|
654
657
|
} else
|
|
@@ -673,7 +676,7 @@ function de(e, t, n) {
|
|
|
673
676
|
new ze(
|
|
674
677
|
n.childContainer.beforePos + 1,
|
|
675
678
|
n.childContainer.afterPos - 1,
|
|
676
|
-
new
|
|
679
|
+
new Se(F.from(r), 0, 0)
|
|
677
680
|
)
|
|
678
681
|
);
|
|
679
682
|
else {
|
|
@@ -686,7 +689,7 @@ function de(e, t, n) {
|
|
|
686
689
|
}
|
|
687
690
|
}
|
|
688
691
|
}
|
|
689
|
-
function
|
|
692
|
+
function vo(e, t, n, o, r) {
|
|
690
693
|
const a = typeof t == "string" ? t : t.id, s = Tt(a, e.doc);
|
|
691
694
|
if (!s)
|
|
692
695
|
throw new Error(`Block with ID ${a} not found`);
|
|
@@ -698,7 +701,7 @@ function yo(e, t, n, o, r) {
|
|
|
698
701
|
r
|
|
699
702
|
);
|
|
700
703
|
const i = e.doc.resolve(s.posBeforeNode + 1).node(), c = O(e);
|
|
701
|
-
return
|
|
704
|
+
return ye(i, c);
|
|
702
705
|
}
|
|
703
706
|
function Pt(e) {
|
|
704
707
|
const t = "selection" in e ? e.selection : null;
|
|
@@ -706,10 +709,10 @@ function Pt(e) {
|
|
|
706
709
|
return null;
|
|
707
710
|
const n = e.doc.resolve(t.head);
|
|
708
711
|
let o = -1, r = -1;
|
|
709
|
-
for (let
|
|
710
|
-
const x = n.node(
|
|
711
|
-
if (o < 0 && (x === "tableCell" || x === "tableHeader") && (o =
|
|
712
|
-
r =
|
|
712
|
+
for (let S = n.depth; S >= 0; S--) {
|
|
713
|
+
const x = n.node(S).type.name;
|
|
714
|
+
if (o < 0 && (x === "tableCell" || x === "tableHeader") && (o = S), x === "table") {
|
|
715
|
+
r = S;
|
|
713
716
|
break;
|
|
714
717
|
}
|
|
715
718
|
}
|
|
@@ -725,15 +728,15 @@ function Pt(e) {
|
|
|
725
728
|
return { row: d, col: p, offset: E };
|
|
726
729
|
}
|
|
727
730
|
function Nt(e, t, n) {
|
|
728
|
-
var
|
|
731
|
+
var S;
|
|
729
732
|
if (t.blockNoteType !== "table")
|
|
730
733
|
return !1;
|
|
731
734
|
let o = -1;
|
|
732
735
|
if (t.isBlockContainer)
|
|
733
736
|
o = e.mapping.map(t.blockContent.beforePos);
|
|
734
737
|
else {
|
|
735
|
-
const x = e.mapping.map(t.bnBlock.beforePos), P = x + (((
|
|
736
|
-
e.doc.nodesBetween(x, P, (
|
|
738
|
+
const x = e.mapping.map(t.bnBlock.beforePos), P = x + (((S = e.doc.nodeAt(x)) == null ? void 0 : S.nodeSize) || 0);
|
|
739
|
+
e.doc.nodesBetween(x, P, (g, w) => g.type.name === "table" ? (o = w, !1) : !0);
|
|
737
740
|
}
|
|
738
741
|
const r = o >= 0 ? e.doc.nodeAt(o) : null;
|
|
739
742
|
if (!r || r.type.name !== "table")
|
|
@@ -741,7 +744,7 @@ function Nt(e, t, n) {
|
|
|
741
744
|
const a = be.get(r), s = Math.max(0, Math.min(n.row, a.height - 1)), i = Math.max(0, Math.min(n.col, a.width - 1)), c = s * a.width + i, l = a.map[c];
|
|
742
745
|
if (l == null)
|
|
743
746
|
return !1;
|
|
744
|
-
const d = o + 1 + l + 1, p = e.doc.nodeAt(d),
|
|
747
|
+
const d = o + 1 + l + 1, p = e.doc.nodeAt(d), m = d + 1, f = p ? p.content.size : 0, E = m + Math.max(0, Math.min(n.offset, f));
|
|
745
748
|
return "selection" in e && e.setSelection(ke.create(e.doc, E)), !0;
|
|
746
749
|
}
|
|
747
750
|
const T = {
|
|
@@ -781,7 +784,7 @@ const T = {
|
|
|
781
784
|
text: "#ad1a72",
|
|
782
785
|
background: "#f4dfeb"
|
|
783
786
|
}
|
|
784
|
-
},
|
|
787
|
+
}, yo = {
|
|
785
788
|
gray: {
|
|
786
789
|
text: "#bebdb8",
|
|
787
790
|
background: "#9b9a97"
|
|
@@ -818,7 +821,7 @@ const T = {
|
|
|
818
821
|
text: "#da208f",
|
|
819
822
|
background: "#ad1a72"
|
|
820
823
|
}
|
|
821
|
-
},
|
|
824
|
+
}, h = {
|
|
822
825
|
backgroundColor: {
|
|
823
826
|
default: "default"
|
|
824
827
|
},
|
|
@@ -829,29 +832,29 @@ const T = {
|
|
|
829
832
|
default: "left",
|
|
830
833
|
values: ["left", "center", "right", "justify"]
|
|
831
834
|
}
|
|
832
|
-
},
|
|
835
|
+
}, v = (e) => {
|
|
833
836
|
const t = {};
|
|
834
|
-
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment =
|
|
837
|
+
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = h.textAlignment.values.includes(
|
|
835
838
|
e.style.textAlign
|
|
836
839
|
) ? e.style.textAlign : void 0, t;
|
|
837
840
|
}, A = (e, t) => {
|
|
838
|
-
e.backgroundColor && e.backgroundColor !==
|
|
841
|
+
e.backgroundColor && e.backgroundColor !== h.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in T ? T[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== h.textColor.default && (t.style.color = e.textColor in T ? T[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== h.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
839
842
|
}, Eo = (e = "backgroundColor") => ({
|
|
840
|
-
default:
|
|
841
|
-
parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : t.style.backgroundColor ? t.style.backgroundColor :
|
|
842
|
-
renderHTML: (t) => t[e] ===
|
|
843
|
+
default: h.backgroundColor.default,
|
|
844
|
+
parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : t.style.backgroundColor ? t.style.backgroundColor : h.backgroundColor.default,
|
|
845
|
+
renderHTML: (t) => t[e] === h.backgroundColor.default ? {} : {
|
|
843
846
|
"data-background-color": t[e]
|
|
844
847
|
}
|
|
845
848
|
}), xo = (e = "textColor") => ({
|
|
846
|
-
default:
|
|
847
|
-
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color :
|
|
848
|
-
renderHTML: (t) => t[e] ===
|
|
849
|
+
default: h.textColor.default,
|
|
850
|
+
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color : h.textColor.default,
|
|
851
|
+
renderHTML: (t) => t[e] === h.textColor.default ? {} : {
|
|
849
852
|
"data-text-color": t[e]
|
|
850
853
|
}
|
|
851
|
-
}),
|
|
852
|
-
default:
|
|
853
|
-
parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign :
|
|
854
|
-
renderHTML: (t) => t[e] ===
|
|
854
|
+
}), So = (e = "textAlignment") => ({
|
|
855
|
+
default: h.textAlignment.default,
|
|
856
|
+
parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign : h.textAlignment.default,
|
|
857
|
+
renderHTML: (t) => t[e] === h.textAlignment.default ? {} : {
|
|
855
858
|
"data-text-alignment": t[e]
|
|
856
859
|
}
|
|
857
860
|
}), $ = (e, t) => {
|
|
@@ -863,7 +866,7 @@ const T = {
|
|
|
863
866
|
const o = e.querySelector("figcaption"), r = (o == null ? void 0 : o.textContent) ?? void 0;
|
|
864
867
|
return { targetElement: n, caption: r };
|
|
865
868
|
}, I = k(({ editor: e }) => {
|
|
866
|
-
const t =
|
|
869
|
+
const t = ve(void 0);
|
|
867
870
|
function n() {
|
|
868
871
|
t.setState(void 0);
|
|
869
872
|
}
|
|
@@ -973,7 +976,7 @@ const T = {
|
|
|
973
976
|
}, ue = (e) => ({ url: e.src || void 0 }), Ot = '<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>', _t = (e) => ({
|
|
974
977
|
type: "audio",
|
|
975
978
|
propSchema: {
|
|
976
|
-
backgroundColor:
|
|
979
|
+
backgroundColor: h.backgroundColor,
|
|
977
980
|
// File name.
|
|
978
981
|
name: {
|
|
979
982
|
default: ""
|
|
@@ -995,7 +998,7 @@ const T = {
|
|
|
995
998
|
if (t.tagName === "AUDIO") {
|
|
996
999
|
if (t.closest("figure"))
|
|
997
1000
|
return;
|
|
998
|
-
const { backgroundColor: n } =
|
|
1001
|
+
const { backgroundColor: n } = v(t);
|
|
999
1002
|
return {
|
|
1000
1003
|
...ue(t),
|
|
1001
1004
|
backgroundColor: n
|
|
@@ -1005,14 +1008,14 @@ const T = {
|
|
|
1005
1008
|
const n = $(t, "audio");
|
|
1006
1009
|
if (!n)
|
|
1007
1010
|
return;
|
|
1008
|
-
const { targetElement: o, caption: r } = n, { backgroundColor: a } =
|
|
1011
|
+
const { targetElement: o, caption: r } = n, { backgroundColor: a } = v(t);
|
|
1009
1012
|
return {
|
|
1010
1013
|
...ue(o),
|
|
1011
1014
|
backgroundColor: a,
|
|
1012
1015
|
caption: r
|
|
1013
1016
|
};
|
|
1014
1017
|
}
|
|
1015
|
-
},
|
|
1018
|
+
}, Wt = (e = {}) => (t, n) => {
|
|
1016
1019
|
const o = document.createElement("div");
|
|
1017
1020
|
o.innerHTML = e.icon ?? Ot;
|
|
1018
1021
|
const r = document.createElement("audio");
|
|
@@ -1024,7 +1027,7 @@ const T = {
|
|
|
1024
1027
|
{ dom: r },
|
|
1025
1028
|
o.firstElementChild
|
|
1026
1029
|
);
|
|
1027
|
-
},
|
|
1030
|
+
}, Rt = (e = {}) => (t, n) => {
|
|
1028
1031
|
if (!t.props.url) {
|
|
1029
1032
|
const r = document.createElement("p");
|
|
1030
1033
|
return r.textContent = "Add audio", {
|
|
@@ -1035,15 +1038,15 @@ const T = {
|
|
|
1035
1038
|
return t.props.showPreview ? (o = document.createElement("audio"), o.src = t.props.url) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? J(o, t.props.caption) : U(o, t.props.caption) : {
|
|
1036
1039
|
dom: o
|
|
1037
1040
|
};
|
|
1038
|
-
}, Ft =
|
|
1041
|
+
}, Ft = y(
|
|
1039
1042
|
_t,
|
|
1040
1043
|
(e) => ({
|
|
1041
1044
|
meta: {
|
|
1042
1045
|
fileBlockAccept: ["audio/*"]
|
|
1043
1046
|
},
|
|
1044
1047
|
parse: Vt(e),
|
|
1045
|
-
render:
|
|
1046
|
-
toExternalHTML:
|
|
1048
|
+
render: Wt(e),
|
|
1049
|
+
toExternalHTML: Rt(e),
|
|
1047
1050
|
runsBefore: ["file"]
|
|
1048
1051
|
})
|
|
1049
1052
|
), pe = Symbol.for("blocknote.shikiParser"), j = Symbol.for(
|
|
@@ -1079,7 +1082,7 @@ const Ut = ({ defaultLanguage: e = "text" }) => ({
|
|
|
1079
1082
|
}
|
|
1080
1083
|
},
|
|
1081
1084
|
content: "inline"
|
|
1082
|
-
}), qt =
|
|
1085
|
+
}), qt = y(
|
|
1083
1086
|
Ut,
|
|
1084
1087
|
(e) => ({
|
|
1085
1088
|
meta: {
|
|
@@ -1219,7 +1222,7 @@ const jt = () => ({
|
|
|
1219
1222
|
type: "divider",
|
|
1220
1223
|
propSchema: {},
|
|
1221
1224
|
content: "none"
|
|
1222
|
-
}), Gt =
|
|
1225
|
+
}), Gt = y(
|
|
1223
1226
|
jt,
|
|
1224
1227
|
{
|
|
1225
1228
|
meta: {
|
|
@@ -1251,7 +1254,7 @@ const jt = () => ({
|
|
|
1251
1254
|
), fe = (e) => ({ url: e.src || void 0 }), Zt = () => ({
|
|
1252
1255
|
type: "file",
|
|
1253
1256
|
propSchema: {
|
|
1254
|
-
backgroundColor:
|
|
1257
|
+
backgroundColor: h.backgroundColor,
|
|
1255
1258
|
// File name.
|
|
1256
1259
|
name: {
|
|
1257
1260
|
default: ""
|
|
@@ -1270,7 +1273,7 @@ const jt = () => ({
|
|
|
1270
1273
|
if (e.tagName === "EMBED") {
|
|
1271
1274
|
if (e.closest("figure"))
|
|
1272
1275
|
return;
|
|
1273
|
-
const { backgroundColor: t } =
|
|
1276
|
+
const { backgroundColor: t } = v(e);
|
|
1274
1277
|
return {
|
|
1275
1278
|
...fe(e),
|
|
1276
1279
|
backgroundColor: t
|
|
@@ -1280,14 +1283,14 @@ const jt = () => ({
|
|
|
1280
1283
|
const t = $(e, "embed");
|
|
1281
1284
|
if (!t)
|
|
1282
1285
|
return;
|
|
1283
|
-
const { targetElement: n, caption: o } = t, { backgroundColor: r } =
|
|
1286
|
+
const { targetElement: n, caption: o } = t, { backgroundColor: r } = v(e);
|
|
1284
1287
|
return {
|
|
1285
1288
|
...fe(n),
|
|
1286
1289
|
backgroundColor: r,
|
|
1287
1290
|
caption: o
|
|
1288
1291
|
};
|
|
1289
1292
|
}
|
|
1290
|
-
}, Xt =
|
|
1293
|
+
}, Xt = y(Zt, {
|
|
1291
1294
|
meta: {
|
|
1292
1295
|
fileBlockAccept: ["*/*"]
|
|
1293
1296
|
},
|
|
@@ -1348,7 +1351,7 @@ const jt = () => ({
|
|
|
1348
1351
|
};
|
|
1349
1352
|
l.addEventListener("click", d), r.appendChild(a);
|
|
1350
1353
|
let p = e.children.length;
|
|
1351
|
-
const
|
|
1354
|
+
const m = t.onChange(() => {
|
|
1352
1355
|
var E;
|
|
1353
1356
|
const f = ((E = t.getBlock(e)) == null ? void 0 : E.children.length) ?? 0;
|
|
1354
1357
|
f > p ? (a.getAttribute("data-show-children") === "false" && (a.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0)), r.contains(l) && r.removeChild(l)) : f === 0 && f < p && (a.getAttribute("data-show-children") === "true" && (a.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1)), r.contains(l) && r.removeChild(l)), p = f;
|
|
@@ -1367,7 +1370,7 @@ const jt = () => ({
|
|
|
1367
1370
|
), l.removeEventListener(
|
|
1368
1371
|
"click",
|
|
1369
1372
|
d
|
|
1370
|
-
),
|
|
1373
|
+
), m == null || m();
|
|
1371
1374
|
}
|
|
1372
1375
|
};
|
|
1373
1376
|
}, Ae = [1, 2, 3, 4, 5, 6], Qt = (e) => ({ editor: t }) => {
|
|
@@ -1383,12 +1386,12 @@ const jt = () => ({
|
|
|
1383
1386
|
} = {}) => ({
|
|
1384
1387
|
type: "heading",
|
|
1385
1388
|
propSchema: {
|
|
1386
|
-
...
|
|
1389
|
+
...h,
|
|
1387
1390
|
level: { default: e, values: t },
|
|
1388
1391
|
...n ? { isToggleable: { default: !1, optional: !0 } } : {}
|
|
1389
1392
|
},
|
|
1390
1393
|
content: "inline"
|
|
1391
|
-
}), Yt =
|
|
1394
|
+
}), Yt = y(
|
|
1392
1395
|
Jt,
|
|
1393
1396
|
({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
1394
1397
|
meta: {
|
|
@@ -1419,7 +1422,7 @@ const jt = () => ({
|
|
|
1419
1422
|
return;
|
|
1420
1423
|
}
|
|
1421
1424
|
return {
|
|
1422
|
-
...
|
|
1425
|
+
...v(t),
|
|
1423
1426
|
level: n
|
|
1424
1427
|
};
|
|
1425
1428
|
},
|
|
@@ -1475,46 +1478,46 @@ const jt = () => ({
|
|
|
1475
1478
|
const u = document.createElement("div");
|
|
1476
1479
|
u.style.position = "absolute", u.style.height = "100%", u.style.width = "100%";
|
|
1477
1480
|
let d, p = e.props.previewWidth;
|
|
1478
|
-
const
|
|
1481
|
+
const m = (g) => {
|
|
1479
1482
|
var ee, te;
|
|
1480
1483
|
if (!d) {
|
|
1481
1484
|
!t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
1482
1485
|
return;
|
|
1483
1486
|
}
|
|
1484
|
-
let
|
|
1485
|
-
const _ = "touches" in
|
|
1486
|
-
e.props.textAlignment === "center" ? d.handleUsed === "left" ?
|
|
1487
|
-
Math.max(
|
|
1487
|
+
let w;
|
|
1488
|
+
const _ = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
1489
|
+
e.props.textAlignment === "center" ? d.handleUsed === "left" ? w = d.initialWidth + (d.initialClientX - _) * 2 : w = d.initialWidth + (_ - d.initialClientX) * 2 : d.handleUsed === "left" ? w = d.initialWidth + d.initialClientX - _ : w = d.initialWidth + _ - d.initialClientX, p = Math.min(
|
|
1490
|
+
Math.max(w, 64),
|
|
1488
1491
|
((te = (ee = t.domElement) == null ? void 0 : ee.firstElementChild) == null ? void 0 : te.clientWidth) || Number.MAX_VALUE
|
|
1489
1492
|
), i.style.width = `${p}px`;
|
|
1490
|
-
}, f = (
|
|
1491
|
-
(!
|
|
1493
|
+
}, f = (g) => {
|
|
1494
|
+
(!g.target || !i.contains(g.target) || !t.isEditable) && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l)), d && (d = void 0, i.contains(u) && i.removeChild(u), t.updateBlock(e, {
|
|
1492
1495
|
props: {
|
|
1493
1496
|
previewWidth: p
|
|
1494
1497
|
}
|
|
1495
1498
|
}));
|
|
1496
1499
|
}, E = () => {
|
|
1497
1500
|
t.isEditable && (o.appendChild(c), o.appendChild(l));
|
|
1498
|
-
},
|
|
1499
|
-
|
|
1500
|
-
}, x = (
|
|
1501
|
-
|
|
1502
|
-
const
|
|
1501
|
+
}, S = (g) => {
|
|
1502
|
+
g.relatedTarget === c || g.relatedTarget === l || d || t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
1503
|
+
}, x = (g) => {
|
|
1504
|
+
g.preventDefault(), i.contains(u) || i.appendChild(u);
|
|
1505
|
+
const w = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
1503
1506
|
d = {
|
|
1504
1507
|
handleUsed: "left",
|
|
1505
1508
|
initialWidth: i.clientWidth,
|
|
1506
|
-
initialClientX:
|
|
1509
|
+
initialClientX: w
|
|
1507
1510
|
};
|
|
1508
|
-
}, P = (
|
|
1509
|
-
|
|
1510
|
-
const
|
|
1511
|
+
}, P = (g) => {
|
|
1512
|
+
g.preventDefault(), i.contains(u) || i.appendChild(u);
|
|
1513
|
+
const w = "touches" in g ? g.touches[0].clientX : g.clientX;
|
|
1511
1514
|
d = {
|
|
1512
1515
|
handleUsed: "right",
|
|
1513
1516
|
initialWidth: i.clientWidth,
|
|
1514
|
-
initialClientX:
|
|
1517
|
+
initialClientX: w
|
|
1515
1518
|
};
|
|
1516
1519
|
};
|
|
1517
|
-
return window.addEventListener("mousemove",
|
|
1520
|
+
return window.addEventListener("mousemove", m), window.addEventListener("touchmove", m), window.addEventListener("mouseup", f), window.addEventListener("touchend", f), i.addEventListener("mouseenter", E), i.addEventListener("mouseleave", S), c.addEventListener(
|
|
1518
1521
|
"mousedown",
|
|
1519
1522
|
x
|
|
1520
1523
|
), c.addEventListener(
|
|
@@ -1529,7 +1532,7 @@ const jt = () => ({
|
|
|
1529
1532
|
), {
|
|
1530
1533
|
dom: i,
|
|
1531
1534
|
destroy: () => {
|
|
1532
|
-
s == null || s(), window.removeEventListener("mousemove",
|
|
1535
|
+
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", S), c.removeEventListener(
|
|
1533
1536
|
"mousedown",
|
|
1534
1537
|
x
|
|
1535
1538
|
), c.removeEventListener(
|
|
@@ -1544,14 +1547,14 @@ const jt = () => ({
|
|
|
1544
1547
|
);
|
|
1545
1548
|
}
|
|
1546
1549
|
};
|
|
1547
|
-
},
|
|
1550
|
+
}, he = (e) => {
|
|
1548
1551
|
const t = e.src || void 0, n = e.width || void 0, o = e.alt || void 0;
|
|
1549
1552
|
return { url: t, previewWidth: n, name: o };
|
|
1550
1553
|
}, en = '<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>', tn = (e = {}) => ({
|
|
1551
1554
|
type: "image",
|
|
1552
1555
|
propSchema: {
|
|
1553
|
-
textAlignment:
|
|
1554
|
-
backgroundColor:
|
|
1556
|
+
textAlignment: h.textAlignment,
|
|
1557
|
+
backgroundColor: h.backgroundColor,
|
|
1555
1558
|
// File name.
|
|
1556
1559
|
name: {
|
|
1557
1560
|
default: ""
|
|
@@ -1578,9 +1581,9 @@ const jt = () => ({
|
|
|
1578
1581
|
if (t.tagName === "IMG") {
|
|
1579
1582
|
if (t.closest("figure"))
|
|
1580
1583
|
return;
|
|
1581
|
-
const { backgroundColor: n } =
|
|
1584
|
+
const { backgroundColor: n } = v(t);
|
|
1582
1585
|
return {
|
|
1583
|
-
...
|
|
1586
|
+
...he(t),
|
|
1584
1587
|
backgroundColor: n
|
|
1585
1588
|
};
|
|
1586
1589
|
}
|
|
@@ -1588,9 +1591,9 @@ const jt = () => ({
|
|
|
1588
1591
|
const n = $(t, "img");
|
|
1589
1592
|
if (!n)
|
|
1590
1593
|
return;
|
|
1591
|
-
const { targetElement: o, caption: r } = n, { backgroundColor: a } =
|
|
1594
|
+
const { targetElement: o, caption: r } = n, { backgroundColor: a } = v(t);
|
|
1592
1595
|
return {
|
|
1593
|
-
...
|
|
1596
|
+
...he(o),
|
|
1594
1597
|
backgroundColor: a,
|
|
1595
1598
|
caption: r
|
|
1596
1599
|
};
|
|
@@ -1621,7 +1624,7 @@ const jt = () => ({
|
|
|
1621
1624
|
return t.props.showPreview ? (o = document.createElement("img"), o.src = t.props.url, o.alt = t.props.name || t.props.caption || "BlockNote image", t.props.previewWidth && (o.width = t.props.previewWidth)) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? J(o, t.props.caption) : U(o, t.props.caption) : {
|
|
1622
1625
|
dom: o
|
|
1623
1626
|
};
|
|
1624
|
-
}, an =
|
|
1627
|
+
}, an = y(
|
|
1625
1628
|
tn,
|
|
1626
1629
|
(e) => ({
|
|
1627
1630
|
meta: {
|
|
@@ -1632,7 +1635,7 @@ const jt = () => ({
|
|
|
1632
1635
|
toExternalHTML: rn(e),
|
|
1633
1636
|
runsBefore: ["file"]
|
|
1634
1637
|
})
|
|
1635
|
-
),
|
|
1638
|
+
), wo = (e, t, n) => ({
|
|
1636
1639
|
state: o,
|
|
1637
1640
|
dispatch: r
|
|
1638
1641
|
}) => r ? Ne(o.tr, e, t, n) : !0, Ne = (e, t, n, o) => {
|
|
@@ -1667,8 +1670,8 @@ const jt = () => ({
|
|
|
1667
1670
|
}), !0) : a.node.childCount > 0 ? e.transact((s) => (s.deleteSelection(), Ne(s, s.selection.from, !0))) : !1;
|
|
1668
1671
|
};
|
|
1669
1672
|
function Y(e, t, n) {
|
|
1670
|
-
var d, p,
|
|
1671
|
-
const o =
|
|
1673
|
+
var d, p, m;
|
|
1674
|
+
const o = we.fromSchema(t), r = e, a = document.createElement("div");
|
|
1672
1675
|
a.setAttribute("data-node-type", "blockGroup");
|
|
1673
1676
|
for (const f of Array.from(r.childNodes))
|
|
1674
1677
|
a.appendChild(f.cloneNode(!0));
|
|
@@ -1680,7 +1683,7 @@ function Y(e, t, n) {
|
|
|
1680
1683
|
s.firstChild.firstChild.nodeSize + 2
|
|
1681
1684
|
)
|
|
1682
1685
|
));
|
|
1683
|
-
const i = (
|
|
1686
|
+
const i = (m = s.firstChild) == null ? void 0 : m.firstChild;
|
|
1684
1687
|
if (!(i != null && i.isTextblock))
|
|
1685
1688
|
return F.from(s);
|
|
1686
1689
|
const c = t.nodes[n].create(
|
|
@@ -1699,10 +1702,10 @@ function Y(e, t, n) {
|
|
|
1699
1702
|
const sn = () => ({
|
|
1700
1703
|
type: "bulletListItem",
|
|
1701
1704
|
propSchema: {
|
|
1702
|
-
...
|
|
1705
|
+
...h
|
|
1703
1706
|
},
|
|
1704
1707
|
content: "inline"
|
|
1705
|
-
}), cn =
|
|
1708
|
+
}), cn = y(
|
|
1706
1709
|
sn,
|
|
1707
1710
|
{
|
|
1708
1711
|
meta: {
|
|
@@ -1714,7 +1717,7 @@ const sn = () => ({
|
|
|
1714
1717
|
return;
|
|
1715
1718
|
const t = e.parentElement;
|
|
1716
1719
|
if (t !== null && (t.tagName === "UL" || t.tagName === "DIV" && ((n = t.parentElement) == null ? void 0 : n.tagName) === "UL"))
|
|
1717
|
-
return
|
|
1720
|
+
return v(e);
|
|
1718
1721
|
},
|
|
1719
1722
|
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
1720
1723
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
@@ -1749,7 +1752,7 @@ const sn = () => ({
|
|
|
1749
1752
|
},
|
|
1750
1753
|
inputRules: [
|
|
1751
1754
|
{
|
|
1752
|
-
find:
|
|
1755
|
+
find: /^\s?[-+*]\s$/,
|
|
1753
1756
|
replace({ editor: e }) {
|
|
1754
1757
|
if (Ee(
|
|
1755
1758
|
e.prosemirrorState
|
|
@@ -1766,11 +1769,11 @@ const sn = () => ({
|
|
|
1766
1769
|
), ln = () => ({
|
|
1767
1770
|
type: "checkListItem",
|
|
1768
1771
|
propSchema: {
|
|
1769
|
-
...
|
|
1772
|
+
...h,
|
|
1770
1773
|
checked: { default: !1, type: "boolean" }
|
|
1771
1774
|
},
|
|
1772
1775
|
content: "inline"
|
|
1773
|
-
}), dn =
|
|
1776
|
+
}), dn = y(
|
|
1774
1777
|
ln,
|
|
1775
1778
|
{
|
|
1776
1779
|
meta: {
|
|
@@ -1785,7 +1788,7 @@ const sn = () => ({
|
|
|
1785
1788
|
const t = e.parentElement;
|
|
1786
1789
|
if (t !== null && (t.tagName === "UL" || t.tagName === "DIV" && ((n = t.parentElement) == null ? void 0 : n.tagName) === "UL")) {
|
|
1787
1790
|
const o = e.querySelector("input[type=checkbox]") || null;
|
|
1788
|
-
return o === null ? void 0 : { ...
|
|
1791
|
+
return o === null ? void 0 : { ...v(e), checked: o.checked };
|
|
1789
1792
|
}
|
|
1790
1793
|
},
|
|
1791
1794
|
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
@@ -1796,8 +1799,8 @@ const sn = () => ({
|
|
|
1796
1799
|
o.type = "checkbox", o.checked = e.props.checked, e.props.checked && o.setAttribute("checked", ""), o.addEventListener("change", () => {
|
|
1797
1800
|
t.updateBlock(e, { props: { checked: !e.props.checked } });
|
|
1798
1801
|
});
|
|
1799
|
-
const r = document.createElement("p");
|
|
1800
|
-
return
|
|
1802
|
+
const r = document.createElement("p"), a = document.createElement("div");
|
|
1803
|
+
return a.contentEditable = "false", a.appendChild(o), n.appendChild(a), n.appendChild(r), {
|
|
1801
1804
|
dom: n,
|
|
1802
1805
|
contentDOM: r
|
|
1803
1806
|
};
|
|
@@ -1828,19 +1831,18 @@ const sn = () => ({
|
|
|
1828
1831
|
},
|
|
1829
1832
|
inputRules: [
|
|
1830
1833
|
{
|
|
1831
|
-
find:
|
|
1834
|
+
find: /^\s?\[\s*\]\s$/,
|
|
1832
1835
|
replace() {
|
|
1833
1836
|
return {
|
|
1834
1837
|
type: "checkListItem",
|
|
1835
1838
|
props: {
|
|
1836
1839
|
checked: !1
|
|
1837
|
-
}
|
|
1838
|
-
content: []
|
|
1840
|
+
}
|
|
1839
1841
|
};
|
|
1840
1842
|
}
|
|
1841
1843
|
},
|
|
1842
1844
|
{
|
|
1843
|
-
find:
|
|
1845
|
+
find: /^\s?\[[Xx]\]\s$/,
|
|
1844
1846
|
replace() {
|
|
1845
1847
|
return {
|
|
1846
1848
|
type: "checkListItem",
|
|
@@ -1873,7 +1875,7 @@ function He(e, t, n, o) {
|
|
|
1873
1875
|
o
|
|
1874
1876
|
).index + 1, a = !1), o.set(e, r), { index: r, isFirst: a, hasStart: s };
|
|
1875
1877
|
}
|
|
1876
|
-
function
|
|
1878
|
+
function me(e, t) {
|
|
1877
1879
|
const n = /* @__PURE__ */ new Map(), o = t.decorations.map(
|
|
1878
1880
|
e.mapping,
|
|
1879
1881
|
e.doc
|
|
@@ -1894,7 +1896,7 @@ function he(e, t) {
|
|
|
1894
1896
|
const p = e.doc.nodeAt(i + 1);
|
|
1895
1897
|
r.push(
|
|
1896
1898
|
// move in by 1 to account for the block container
|
|
1897
|
-
|
|
1899
|
+
ht.node(i + 1, i + 1 + p.nodeSize, {
|
|
1898
1900
|
"data-index": c.toString()
|
|
1899
1901
|
})
|
|
1900
1902
|
);
|
|
@@ -1912,12 +1914,12 @@ const un = () => new pt({
|
|
|
1912
1914
|
key: new ft("numbered-list-indexing-decorations"),
|
|
1913
1915
|
state: {
|
|
1914
1916
|
init(e, t) {
|
|
1915
|
-
return
|
|
1917
|
+
return me(t.tr, {
|
|
1916
1918
|
decorations: ce.empty
|
|
1917
1919
|
});
|
|
1918
1920
|
},
|
|
1919
1921
|
apply(e, t) {
|
|
1920
|
-
return !e.docChanged && !e.selectionSet && t.decorations ? t :
|
|
1922
|
+
return !e.docChanged && !e.selectionSet && t.decorations ? t : me(e, t);
|
|
1921
1923
|
}
|
|
1922
1924
|
},
|
|
1923
1925
|
props: {
|
|
@@ -1929,11 +1931,11 @@ const un = () => new pt({
|
|
|
1929
1931
|
}), pn = () => ({
|
|
1930
1932
|
type: "numberedListItem",
|
|
1931
1933
|
propSchema: {
|
|
1932
|
-
...
|
|
1934
|
+
...h,
|
|
1933
1935
|
start: { default: void 0, type: "number" }
|
|
1934
1936
|
},
|
|
1935
1937
|
content: "inline"
|
|
1936
|
-
}), fn =
|
|
1938
|
+
}), fn = y(
|
|
1937
1939
|
pn,
|
|
1938
1940
|
{
|
|
1939
1941
|
meta: {
|
|
@@ -1945,10 +1947,10 @@ const un = () => new pt({
|
|
|
1945
1947
|
return;
|
|
1946
1948
|
const t = e.parentElement;
|
|
1947
1949
|
if (t !== null && (t.tagName === "OL" || t.tagName === "DIV" && ((n = t.parentElement) == null ? void 0 : n.tagName) === "OL")) {
|
|
1948
|
-
const o = parseInt(t.getAttribute("start") || "1");
|
|
1949
|
-
return {
|
|
1950
|
-
...
|
|
1951
|
-
start:
|
|
1950
|
+
const o = parseInt(t.getAttribute("start") || "1"), r = v(e);
|
|
1951
|
+
return e.previousElementSibling || o === 1 ? r : {
|
|
1952
|
+
...r,
|
|
1953
|
+
start: o
|
|
1952
1954
|
};
|
|
1953
1955
|
}
|
|
1954
1956
|
},
|
|
@@ -1975,7 +1977,7 @@ const un = () => new pt({
|
|
|
1975
1977
|
key: "numbered-list-item-shortcuts",
|
|
1976
1978
|
inputRules: [
|
|
1977
1979
|
{
|
|
1978
|
-
find:
|
|
1980
|
+
find: /^\s?(\d+)\.\s$/,
|
|
1979
1981
|
replace({ match: e, editor: t }) {
|
|
1980
1982
|
if (Ee(
|
|
1981
1983
|
t.prosemirrorState
|
|
@@ -2004,14 +2006,14 @@ const un = () => new pt({
|
|
|
2004
2006
|
prosemirrorPlugins: [un()]
|
|
2005
2007
|
})
|
|
2006
2008
|
]
|
|
2007
|
-
),
|
|
2009
|
+
), hn = () => ({
|
|
2008
2010
|
type: "toggleListItem",
|
|
2009
2011
|
propSchema: {
|
|
2010
|
-
...
|
|
2012
|
+
...h
|
|
2011
2013
|
},
|
|
2012
2014
|
content: "inline"
|
|
2013
|
-
}),
|
|
2014
|
-
|
|
2015
|
+
}), mn = y(
|
|
2016
|
+
hn,
|
|
2015
2017
|
{
|
|
2016
2018
|
meta: {
|
|
2017
2019
|
isolating: !1
|
|
@@ -2047,12 +2049,12 @@ const un = () => new pt({
|
|
|
2047
2049
|
}
|
|
2048
2050
|
})
|
|
2049
2051
|
]
|
|
2050
|
-
),
|
|
2052
|
+
), gn = () => ({
|
|
2051
2053
|
type: "paragraph",
|
|
2052
|
-
propSchema:
|
|
2054
|
+
propSchema: h,
|
|
2053
2055
|
content: "inline"
|
|
2054
|
-
}), bn =
|
|
2055
|
-
|
|
2056
|
+
}), bn = y(
|
|
2057
|
+
gn,
|
|
2056
2058
|
{
|
|
2057
2059
|
meta: {
|
|
2058
2060
|
isolating: !1
|
|
@@ -2060,7 +2062,7 @@ const un = () => new pt({
|
|
|
2060
2062
|
parse: (e) => {
|
|
2061
2063
|
var t;
|
|
2062
2064
|
if (e.tagName === "P" && (t = e.textContent) != null && t.trim())
|
|
2063
|
-
return
|
|
2065
|
+
return v(e);
|
|
2064
2066
|
},
|
|
2065
2067
|
render: () => {
|
|
2066
2068
|
const e = document.createElement("p");
|
|
@@ -2095,11 +2097,11 @@ const un = () => new pt({
|
|
|
2095
2097
|
), Cn = () => ({
|
|
2096
2098
|
type: "quote",
|
|
2097
2099
|
propSchema: {
|
|
2098
|
-
backgroundColor:
|
|
2099
|
-
textColor:
|
|
2100
|
+
backgroundColor: h.backgroundColor,
|
|
2101
|
+
textColor: h.textColor
|
|
2100
2102
|
},
|
|
2101
2103
|
content: "inline"
|
|
2102
|
-
}), kn =
|
|
2104
|
+
}), kn = y(
|
|
2103
2105
|
Cn,
|
|
2104
2106
|
{
|
|
2105
2107
|
meta: {
|
|
@@ -2107,7 +2109,7 @@ const un = () => new pt({
|
|
|
2107
2109
|
},
|
|
2108
2110
|
parse(e) {
|
|
2109
2111
|
if (e.tagName === "BLOCKQUOTE") {
|
|
2110
|
-
const { backgroundColor: t, textColor: n } =
|
|
2112
|
+
const { backgroundColor: t, textColor: n } = v(e);
|
|
2111
2113
|
return { backgroundColor: t, textColor: n };
|
|
2112
2114
|
}
|
|
2113
2115
|
},
|
|
@@ -2151,18 +2153,18 @@ const un = () => new pt({
|
|
|
2151
2153
|
]
|
|
2152
2154
|
})
|
|
2153
2155
|
]
|
|
2154
|
-
),
|
|
2156
|
+
), vn = 35, Ie = 120, Mo = 31, yn = $e.create({
|
|
2155
2157
|
name: "BlockNoteTableExtension",
|
|
2156
2158
|
addProseMirrorPlugins: () => [
|
|
2157
2159
|
Ve({
|
|
2158
|
-
cellMinWidth:
|
|
2160
|
+
cellMinWidth: vn,
|
|
2159
2161
|
defaultCellMinWidth: Ie,
|
|
2160
2162
|
// We set this to null as we implement our own node view in the table
|
|
2161
2163
|
// block content. This node view is the same as what's used by default,
|
|
2162
2164
|
// but is wrapped in a `blockContent` HTML element.
|
|
2163
2165
|
View: null
|
|
2164
2166
|
}),
|
|
2165
|
-
|
|
2167
|
+
We()
|
|
2166
2168
|
],
|
|
2167
2169
|
addKeyboardShortcuts() {
|
|
2168
2170
|
return {
|
|
@@ -2196,7 +2198,7 @@ const un = () => new pt({
|
|
|
2196
2198
|
};
|
|
2197
2199
|
}
|
|
2198
2200
|
}), En = {
|
|
2199
|
-
textColor:
|
|
2201
|
+
textColor: h.textColor
|
|
2200
2202
|
}, xn = N.create({
|
|
2201
2203
|
name: "tableHeader",
|
|
2202
2204
|
addOptions() {
|
|
@@ -2248,7 +2250,7 @@ const un = () => new pt({
|
|
|
2248
2250
|
0
|
|
2249
2251
|
];
|
|
2250
2252
|
}
|
|
2251
|
-
}),
|
|
2253
|
+
}), Sn = N.create({
|
|
2252
2254
|
name: "tableCell",
|
|
2253
2255
|
addOptions() {
|
|
2254
2256
|
return {
|
|
@@ -2292,7 +2294,7 @@ const un = () => new pt({
|
|
|
2292
2294
|
0
|
|
2293
2295
|
];
|
|
2294
2296
|
}
|
|
2295
|
-
}),
|
|
2297
|
+
}), wn = N.create({
|
|
2296
2298
|
name: "table",
|
|
2297
2299
|
content: "tableRow+",
|
|
2298
2300
|
group: "blockContent",
|
|
@@ -2308,7 +2310,7 @@ const un = () => new pt({
|
|
|
2308
2310
|
},
|
|
2309
2311
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2310
2312
|
var r, a, s;
|
|
2311
|
-
const n =
|
|
2313
|
+
const n = gt(
|
|
2312
2314
|
this.name,
|
|
2313
2315
|
"table",
|
|
2314
2316
|
{
|
|
@@ -2337,7 +2339,7 @@ const un = () => new pt({
|
|
|
2337
2339
|
addNodeView() {
|
|
2338
2340
|
return ({ node: e, HTMLAttributes: t }) => {
|
|
2339
2341
|
var o;
|
|
2340
|
-
class n extends
|
|
2342
|
+
class n extends Re {
|
|
2341
2343
|
constructor(a, s, i) {
|
|
2342
2344
|
super(a, s), this.node = a, this.cellMinWidth = s, this.blockContentHTMLAttributes = i;
|
|
2343
2345
|
const c = document.createElement("div");
|
|
@@ -2345,10 +2347,10 @@ const un = () => new pt({
|
|
|
2345
2347
|
"bn-block-content",
|
|
2346
2348
|
i.class
|
|
2347
2349
|
), c.setAttribute("data-content-type", "table");
|
|
2348
|
-
for (const [p,
|
|
2350
|
+
for (const [p, m] of Object.entries(
|
|
2349
2351
|
i
|
|
2350
2352
|
))
|
|
2351
|
-
p !== "class" && c.setAttribute(p,
|
|
2353
|
+
p !== "class" && c.setAttribute(p, m);
|
|
2352
2354
|
const l = this.dom, u = document.createElement("div");
|
|
2353
2355
|
u.className = "tableWrapper-inner", u.appendChild(l.firstChild), l.appendChild(u), c.appendChild(l);
|
|
2354
2356
|
const d = document.createElement("div");
|
|
@@ -2407,7 +2409,7 @@ const un = () => new pt({
|
|
|
2407
2409
|
}
|
|
2408
2410
|
});
|
|
2409
2411
|
function De(e, t) {
|
|
2410
|
-
const o =
|
|
2412
|
+
const o = we.fromSchema(t).parse(e, {
|
|
2411
2413
|
topNode: t.nodes.blockGroup.create()
|
|
2412
2414
|
}), r = [];
|
|
2413
2415
|
return o.content.descendants((a) => {
|
|
@@ -2415,17 +2417,17 @@ function De(e, t) {
|
|
|
2415
2417
|
return r.push(a), !1;
|
|
2416
2418
|
}), F.fromArray(r);
|
|
2417
2419
|
}
|
|
2418
|
-
const Tn = () =>
|
|
2419
|
-
{ node:
|
|
2420
|
+
const Tn = () => vt(
|
|
2421
|
+
{ node: wn, type: "table", content: "table" },
|
|
2420
2422
|
En,
|
|
2421
2423
|
[
|
|
2422
2424
|
k({
|
|
2423
2425
|
key: "table-extensions",
|
|
2424
2426
|
tiptapExtensions: [
|
|
2425
|
-
|
|
2427
|
+
yn,
|
|
2426
2428
|
Mn,
|
|
2427
2429
|
xn,
|
|
2428
|
-
|
|
2430
|
+
Sn,
|
|
2429
2431
|
Ln
|
|
2430
2432
|
]
|
|
2431
2433
|
}),
|
|
@@ -2457,14 +2459,14 @@ const Tn = () => yt(
|
|
|
2457
2459
|
}
|
|
2458
2460
|
})
|
|
2459
2461
|
]
|
|
2460
|
-
),
|
|
2462
|
+
), ge = (e) => {
|
|
2461
2463
|
const t = e.src || void 0, n = e.width || void 0;
|
|
2462
2464
|
return { url: t, previewWidth: n };
|
|
2463
2465
|
}, Bn = '<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>', An = (e) => ({
|
|
2464
2466
|
type: "video",
|
|
2465
2467
|
propSchema: {
|
|
2466
|
-
textAlignment:
|
|
2467
|
-
backgroundColor:
|
|
2468
|
+
textAlignment: h.textAlignment,
|
|
2469
|
+
backgroundColor: h.backgroundColor,
|
|
2468
2470
|
name: { default: "" },
|
|
2469
2471
|
url: { default: "" },
|
|
2470
2472
|
caption: { default: "" },
|
|
@@ -2476,9 +2478,9 @@ const Tn = () => yt(
|
|
|
2476
2478
|
if (t.tagName === "VIDEO") {
|
|
2477
2479
|
if (t.closest("figure"))
|
|
2478
2480
|
return;
|
|
2479
|
-
const { backgroundColor: n } =
|
|
2481
|
+
const { backgroundColor: n } = v(t);
|
|
2480
2482
|
return {
|
|
2481
|
-
...
|
|
2483
|
+
...ge(t),
|
|
2482
2484
|
backgroundColor: n
|
|
2483
2485
|
};
|
|
2484
2486
|
}
|
|
@@ -2486,14 +2488,14 @@ const Tn = () => yt(
|
|
|
2486
2488
|
const n = $(t, "video");
|
|
2487
2489
|
if (!n)
|
|
2488
2490
|
return;
|
|
2489
|
-
const { targetElement: o, caption: r } = n, { backgroundColor: a } =
|
|
2491
|
+
const { targetElement: o, caption: r } = n, { backgroundColor: a } = v(t);
|
|
2490
2492
|
return {
|
|
2491
|
-
...
|
|
2493
|
+
...ge(o),
|
|
2492
2494
|
backgroundColor: a,
|
|
2493
2495
|
caption: r
|
|
2494
2496
|
};
|
|
2495
2497
|
}
|
|
2496
|
-
}, Nn =
|
|
2498
|
+
}, Nn = y(
|
|
2497
2499
|
An,
|
|
2498
2500
|
(e) => ({
|
|
2499
2501
|
meta: {
|
|
@@ -2531,7 +2533,7 @@ const Tn = () => yt(
|
|
|
2531
2533
|
runsBefore: ["file"]
|
|
2532
2534
|
})
|
|
2533
2535
|
);
|
|
2534
|
-
function
|
|
2536
|
+
function b(e, t, n) {
|
|
2535
2537
|
if (!(t in e.schema.blockSpecs))
|
|
2536
2538
|
return !1;
|
|
2537
2539
|
if (!n)
|
|
@@ -2555,21 +2557,21 @@ function C(e, t, n) {
|
|
|
2555
2557
|
return !0;
|
|
2556
2558
|
}
|
|
2557
2559
|
function Lo(e, t, n, o) {
|
|
2558
|
-
return
|
|
2560
|
+
return b(t, n, o) && e.type === n;
|
|
2559
2561
|
}
|
|
2560
2562
|
function To(e) {
|
|
2561
2563
|
return e instanceof Ce;
|
|
2562
2564
|
}
|
|
2563
|
-
const
|
|
2565
|
+
const W = /* @__PURE__ */ new Map();
|
|
2564
2566
|
function Hn(e) {
|
|
2565
|
-
if (
|
|
2566
|
-
return
|
|
2567
|
+
if (W.has(e))
|
|
2568
|
+
return W.get(e);
|
|
2567
2569
|
const t = new Xe();
|
|
2568
2570
|
return e._tiptapEditor.on("transaction", ({ transaction: n }) => {
|
|
2569
2571
|
t.appendMapping(n.mapping);
|
|
2570
2572
|
}), e._tiptapEditor.on("destroy", () => {
|
|
2571
|
-
|
|
2572
|
-
}),
|
|
2573
|
+
W.delete(e);
|
|
2574
|
+
}), W.set(e, t), t;
|
|
2573
2575
|
}
|
|
2574
2576
|
function In(e, t, n = "left") {
|
|
2575
2577
|
const o = ae.getState(e.prosemirrorState);
|
|
@@ -2600,11 +2602,11 @@ function In(e, t, n = "left") {
|
|
|
2600
2602
|
const Dn = je((e) => e.type.name === "blockContainer");
|
|
2601
2603
|
class On {
|
|
2602
2604
|
constructor(t, n, o) {
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2605
|
+
M(this, "state");
|
|
2606
|
+
M(this, "emitUpdate");
|
|
2607
|
+
M(this, "rootEl");
|
|
2608
|
+
M(this, "pluginState");
|
|
2609
|
+
M(this, "handleScroll", () => {
|
|
2608
2610
|
var t, n;
|
|
2609
2611
|
if ((t = this.state) != null && t.show) {
|
|
2610
2612
|
const o = (n = this.rootEl) == null ? void 0 : n.querySelector(
|
|
@@ -2615,10 +2617,10 @@ class On {
|
|
|
2615
2617
|
this.state.referencePos = o.getBoundingClientRect().toJSON(), this.emitUpdate(this.pluginState.triggerCharacter);
|
|
2616
2618
|
}
|
|
2617
2619
|
});
|
|
2618
|
-
|
|
2620
|
+
M(this, "closeMenu", () => {
|
|
2619
2621
|
this.editor.transact((t) => t.setMeta(B, null));
|
|
2620
2622
|
});
|
|
2621
|
-
|
|
2623
|
+
M(this, "clearQuery", () => {
|
|
2622
2624
|
this.pluginState !== void 0 && this.editor._tiptapEditor.chain().focus().deleteRange({
|
|
2623
2625
|
from: this.pluginState.queryStartPos() - (this.pluginState.deleteTriggerCharacter ? this.pluginState.triggerCharacter.length : 0),
|
|
2624
2626
|
to: this.editor.transact((t) => t.selection.from)
|
|
@@ -2663,7 +2665,7 @@ class On {
|
|
|
2663
2665
|
const B = new Ze("SuggestionMenuPlugin"), _n = k(({ editor: e }) => {
|
|
2664
2666
|
const t = [];
|
|
2665
2667
|
let n;
|
|
2666
|
-
const o =
|
|
2668
|
+
const o = ve(void 0);
|
|
2667
2669
|
return {
|
|
2668
2670
|
key: "suggestionMenu",
|
|
2669
2671
|
store: o,
|
|
@@ -2811,7 +2813,7 @@ function Vn(e) {
|
|
|
2811
2813
|
n = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
|
|
2812
2814
|
}
|
|
2813
2815
|
}
|
|
2814
|
-
function
|
|
2816
|
+
function C(e, t) {
|
|
2815
2817
|
const n = e.getTextCursorPosition().block;
|
|
2816
2818
|
if (n.content === void 0)
|
|
2817
2819
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
@@ -2820,111 +2822,89 @@ function b(e, t) {
|
|
|
2820
2822
|
}
|
|
2821
2823
|
function Bo(e) {
|
|
2822
2824
|
const t = [];
|
|
2823
|
-
return
|
|
2824
|
-
{
|
|
2825
|
-
onItemClick: () => {
|
|
2826
|
-
b(e, {
|
|
2827
|
-
type: "heading",
|
|
2828
|
-
props: { level: 1 }
|
|
2829
|
-
});
|
|
2830
|
-
},
|
|
2831
|
-
badge: M("Mod-Alt-1"),
|
|
2832
|
-
key: "heading",
|
|
2833
|
-
...e.dictionary.slash_menu.heading
|
|
2834
|
-
},
|
|
2835
|
-
{
|
|
2836
|
-
onItemClick: () => {
|
|
2837
|
-
b(e, {
|
|
2838
|
-
type: "heading",
|
|
2839
|
-
props: { level: 2 }
|
|
2840
|
-
});
|
|
2841
|
-
},
|
|
2842
|
-
badge: M("Mod-Alt-2"),
|
|
2843
|
-
key: "heading_2",
|
|
2844
|
-
...e.dictionary.slash_menu.heading_2
|
|
2845
|
-
},
|
|
2846
|
-
{
|
|
2825
|
+
return b(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((n) => n <= 3).forEach((n) => {
|
|
2826
|
+
t.push({
|
|
2847
2827
|
onItemClick: () => {
|
|
2848
|
-
|
|
2828
|
+
C(e, {
|
|
2849
2829
|
type: "heading",
|
|
2850
|
-
props: { level:
|
|
2830
|
+
props: { level: n }
|
|
2851
2831
|
});
|
|
2852
2832
|
},
|
|
2853
|
-
badge:
|
|
2854
|
-
key: "
|
|
2855
|
-
...e.dictionary.slash_menu
|
|
2856
|
-
}
|
|
2857
|
-
),
|
|
2833
|
+
badge: L(`Mod-Alt-${n}`),
|
|
2834
|
+
key: n === 1 ? "heading" : `heading_${n}`,
|
|
2835
|
+
...e.dictionary.slash_menu[n === 1 ? "heading" : `heading_${n}`]
|
|
2836
|
+
});
|
|
2837
|
+
}), b(e, "quote") && t.push({
|
|
2858
2838
|
onItemClick: () => {
|
|
2859
|
-
|
|
2839
|
+
C(e, {
|
|
2860
2840
|
type: "quote"
|
|
2861
2841
|
});
|
|
2862
2842
|
},
|
|
2863
2843
|
key: "quote",
|
|
2864
2844
|
...e.dictionary.slash_menu.quote
|
|
2865
|
-
}),
|
|
2845
|
+
}), b(e, "toggleListItem") && t.push({
|
|
2866
2846
|
onItemClick: () => {
|
|
2867
|
-
|
|
2847
|
+
C(e, {
|
|
2868
2848
|
type: "toggleListItem"
|
|
2869
2849
|
});
|
|
2870
2850
|
},
|
|
2871
|
-
badge:
|
|
2851
|
+
badge: L("Mod-Shift-6"),
|
|
2872
2852
|
key: "toggle_list",
|
|
2873
2853
|
...e.dictionary.slash_menu.toggle_list
|
|
2874
|
-
}),
|
|
2854
|
+
}), b(e, "numberedListItem") && t.push({
|
|
2875
2855
|
onItemClick: () => {
|
|
2876
|
-
|
|
2856
|
+
C(e, {
|
|
2877
2857
|
type: "numberedListItem"
|
|
2878
2858
|
});
|
|
2879
2859
|
},
|
|
2880
|
-
badge:
|
|
2860
|
+
badge: L("Mod-Shift-7"),
|
|
2881
2861
|
key: "numbered_list",
|
|
2882
2862
|
...e.dictionary.slash_menu.numbered_list
|
|
2883
|
-
}),
|
|
2863
|
+
}), b(e, "bulletListItem") && t.push({
|
|
2884
2864
|
onItemClick: () => {
|
|
2885
|
-
|
|
2865
|
+
C(e, {
|
|
2886
2866
|
type: "bulletListItem"
|
|
2887
2867
|
});
|
|
2888
2868
|
},
|
|
2889
|
-
badge:
|
|
2869
|
+
badge: L("Mod-Shift-8"),
|
|
2890
2870
|
key: "bullet_list",
|
|
2891
2871
|
...e.dictionary.slash_menu.bullet_list
|
|
2892
|
-
}),
|
|
2872
|
+
}), b(e, "checkListItem") && t.push({
|
|
2893
2873
|
onItemClick: () => {
|
|
2894
|
-
|
|
2874
|
+
C(e, {
|
|
2895
2875
|
type: "checkListItem"
|
|
2896
2876
|
});
|
|
2897
2877
|
},
|
|
2898
|
-
badge:
|
|
2878
|
+
badge: L("Mod-Shift-9"),
|
|
2899
2879
|
key: "check_list",
|
|
2900
2880
|
...e.dictionary.slash_menu.check_list
|
|
2901
|
-
}),
|
|
2881
|
+
}), b(e, "paragraph") && t.push({
|
|
2902
2882
|
onItemClick: () => {
|
|
2903
|
-
|
|
2883
|
+
C(e, {
|
|
2904
2884
|
type: "paragraph"
|
|
2905
2885
|
});
|
|
2906
2886
|
},
|
|
2907
|
-
badge:
|
|
2887
|
+
badge: L("Mod-Alt-0"),
|
|
2908
2888
|
key: "paragraph",
|
|
2909
2889
|
...e.dictionary.slash_menu.paragraph
|
|
2910
|
-
}),
|
|
2890
|
+
}), b(e, "codeBlock") && t.push({
|
|
2911
2891
|
onItemClick: () => {
|
|
2912
|
-
|
|
2892
|
+
C(e, {
|
|
2913
2893
|
type: "codeBlock"
|
|
2914
2894
|
});
|
|
2915
2895
|
},
|
|
2916
|
-
badge:
|
|
2896
|
+
badge: L("Mod-Alt-c"),
|
|
2917
2897
|
key: "code_block",
|
|
2918
2898
|
...e.dictionary.slash_menu.code_block
|
|
2919
|
-
}),
|
|
2899
|
+
}), b(e, "divider") && t.push({
|
|
2920
2900
|
onItemClick: () => {
|
|
2921
|
-
|
|
2901
|
+
C(e, { type: "divider" });
|
|
2922
2902
|
},
|
|
2923
2903
|
key: "divider",
|
|
2924
2904
|
...e.dictionary.slash_menu.divider
|
|
2925
|
-
}),
|
|
2905
|
+
}), b(e, "table") && t.push({
|
|
2926
2906
|
onItemClick: () => {
|
|
2927
|
-
|
|
2907
|
+
C(e, {
|
|
2928
2908
|
type: "table",
|
|
2929
2909
|
content: {
|
|
2930
2910
|
type: "tableContent",
|
|
@@ -2942,88 +2922,69 @@ function Bo(e) {
|
|
|
2942
2922
|
badge: void 0,
|
|
2943
2923
|
key: "table",
|
|
2944
2924
|
...e.dictionary.slash_menu.table
|
|
2945
|
-
}),
|
|
2925
|
+
}), b(e, "image", { url: "string" }) && t.push({
|
|
2946
2926
|
onItemClick: () => {
|
|
2947
2927
|
var o;
|
|
2948
|
-
const n =
|
|
2928
|
+
const n = C(e, {
|
|
2949
2929
|
type: "image"
|
|
2950
2930
|
});
|
|
2951
2931
|
(o = e.getExtension(I)) == null || o.showMenu(n.id);
|
|
2952
2932
|
},
|
|
2953
2933
|
key: "image",
|
|
2954
2934
|
...e.dictionary.slash_menu.image
|
|
2955
|
-
}),
|
|
2935
|
+
}), b(e, "video", { url: "string" }) && t.push({
|
|
2956
2936
|
onItemClick: () => {
|
|
2957
2937
|
var o;
|
|
2958
|
-
const n =
|
|
2938
|
+
const n = C(e, {
|
|
2959
2939
|
type: "video"
|
|
2960
2940
|
});
|
|
2961
2941
|
(o = e.getExtension(I)) == null || o.showMenu(n.id);
|
|
2962
2942
|
},
|
|
2963
2943
|
key: "video",
|
|
2964
2944
|
...e.dictionary.slash_menu.video
|
|
2965
|
-
}),
|
|
2945
|
+
}), b(e, "audio", { url: "string" }) && t.push({
|
|
2966
2946
|
onItemClick: () => {
|
|
2967
2947
|
var o;
|
|
2968
|
-
const n =
|
|
2948
|
+
const n = C(e, {
|
|
2969
2949
|
type: "audio"
|
|
2970
2950
|
});
|
|
2971
2951
|
(o = e.getExtension(I)) == null || o.showMenu(n.id);
|
|
2972
2952
|
},
|
|
2973
2953
|
key: "audio",
|
|
2974
2954
|
...e.dictionary.slash_menu.audio
|
|
2975
|
-
}),
|
|
2955
|
+
}), b(e, "file", { url: "string" }) && t.push({
|
|
2976
2956
|
onItemClick: () => {
|
|
2977
2957
|
var o;
|
|
2978
|
-
const n =
|
|
2958
|
+
const n = C(e, {
|
|
2979
2959
|
type: "file"
|
|
2980
2960
|
});
|
|
2981
2961
|
(o = e.getExtension(I)) == null || o.showMenu(n.id);
|
|
2982
2962
|
},
|
|
2983
2963
|
key: "file",
|
|
2984
2964
|
...e.dictionary.slash_menu.file
|
|
2985
|
-
}),
|
|
2965
|
+
}), b(e, "heading", {
|
|
2986
2966
|
level: "number",
|
|
2987
2967
|
isToggleable: "boolean"
|
|
2988
|
-
}) &&
|
|
2989
|
-
{
|
|
2990
|
-
onItemClick: () => {
|
|
2991
|
-
b(e, {
|
|
2992
|
-
type: "heading",
|
|
2993
|
-
props: { level: 1, isToggleable: !0 }
|
|
2994
|
-
});
|
|
2995
|
-
},
|
|
2996
|
-
key: "toggle_heading",
|
|
2997
|
-
...e.dictionary.slash_menu.toggle_heading
|
|
2998
|
-
},
|
|
2999
|
-
{
|
|
3000
|
-
onItemClick: () => {
|
|
3001
|
-
b(e, {
|
|
3002
|
-
type: "heading",
|
|
3003
|
-
props: { level: 2, isToggleable: !0 }
|
|
3004
|
-
});
|
|
3005
|
-
},
|
|
3006
|
-
key: "toggle_heading_2",
|
|
3007
|
-
...e.dictionary.slash_menu.toggle_heading_2
|
|
3008
|
-
},
|
|
3009
|
-
{
|
|
2968
|
+
}) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((n) => n <= 3).forEach((n) => {
|
|
2969
|
+
t.push({
|
|
3010
2970
|
onItemClick: () => {
|
|
3011
|
-
|
|
2971
|
+
C(e, {
|
|
3012
2972
|
type: "heading",
|
|
3013
|
-
props: { level:
|
|
2973
|
+
props: { level: n, isToggleable: !0 }
|
|
3014
2974
|
});
|
|
3015
2975
|
},
|
|
3016
|
-
key: "
|
|
3017
|
-
...e.dictionary.slash_menu
|
|
3018
|
-
}
|
|
3019
|
-
),
|
|
2976
|
+
key: n === 1 ? "toggle_heading" : `toggle_heading_${n}`,
|
|
2977
|
+
...e.dictionary.slash_menu[n === 1 ? "toggle_heading" : `toggle_heading_${n}`]
|
|
2978
|
+
});
|
|
2979
|
+
}), b(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((n) => n > 3).forEach((n) => {
|
|
3020
2980
|
t.push({
|
|
3021
2981
|
onItemClick: () => {
|
|
3022
|
-
|
|
2982
|
+
C(e, {
|
|
3023
2983
|
type: "heading",
|
|
3024
2984
|
props: { level: n }
|
|
3025
2985
|
});
|
|
3026
2986
|
},
|
|
2987
|
+
badge: L(`Mod-Alt-${n}`),
|
|
3027
2988
|
key: `heading_${n}`,
|
|
3028
2989
|
...e.dictionary.slash_menu[`heading_${n}`]
|
|
3029
2990
|
});
|
|
@@ -3059,9 +3020,9 @@ const Po = {
|
|
|
3059
3020
|
paragraph: bn(),
|
|
3060
3021
|
quote: kn(),
|
|
3061
3022
|
table: Tn(),
|
|
3062
|
-
toggleListItem:
|
|
3023
|
+
toggleListItem: mn(),
|
|
3063
3024
|
video: Nn()
|
|
3064
|
-
},
|
|
3025
|
+
}, Wn = Le(
|
|
3065
3026
|
{
|
|
3066
3027
|
type: "textColor",
|
|
3067
3028
|
propSchema: "string"
|
|
@@ -3076,7 +3037,7 @@ const Po = {
|
|
|
3076
3037
|
},
|
|
3077
3038
|
toExternalHTML: (e) => {
|
|
3078
3039
|
const t = document.createElement("span");
|
|
3079
|
-
return e !==
|
|
3040
|
+
return e !== h.textColor.default && (t.style.color = e in T ? T[e].text : e), {
|
|
3080
3041
|
dom: t,
|
|
3081
3042
|
contentDOM: t
|
|
3082
3043
|
};
|
|
@@ -3086,7 +3047,7 @@ const Po = {
|
|
|
3086
3047
|
return e.style.color;
|
|
3087
3048
|
}
|
|
3088
3049
|
}
|
|
3089
|
-
),
|
|
3050
|
+
), Rn = Le(
|
|
3090
3051
|
{
|
|
3091
3052
|
type: "backgroundColor",
|
|
3092
3053
|
propSchema: "string"
|
|
@@ -3101,7 +3062,7 @@ const Po = {
|
|
|
3101
3062
|
},
|
|
3102
3063
|
toExternalHTML: (e) => {
|
|
3103
3064
|
const t = document.createElement("span");
|
|
3104
|
-
return e !==
|
|
3065
|
+
return e !== h.backgroundColor.default && (t.style.backgroundColor = e in T ? T[e].background : e), {
|
|
3105
3066
|
dom: t,
|
|
3106
3067
|
contentDOM: t
|
|
3107
3068
|
};
|
|
@@ -3117,24 +3078,24 @@ const Po = {
|
|
|
3117
3078
|
underline: H(ct, "boolean"),
|
|
3118
3079
|
strike: H(it, "boolean"),
|
|
3119
3080
|
code: H(at, "boolean"),
|
|
3120
|
-
textColor:
|
|
3121
|
-
backgroundColor:
|
|
3081
|
+
textColor: Wn,
|
|
3082
|
+
backgroundColor: Rn
|
|
3122
3083
|
}, No = Mt(Fn), $n = {
|
|
3123
3084
|
text: { config: "text", implementation: {} },
|
|
3124
3085
|
link: { config: "link", implementation: {} }
|
|
3125
|
-
}, Ho =
|
|
3086
|
+
}, Ho = St(
|
|
3126
3087
|
$n
|
|
3127
3088
|
);
|
|
3128
3089
|
export {
|
|
3129
|
-
|
|
3090
|
+
b as $,
|
|
3130
3091
|
dn as A,
|
|
3131
3092
|
pn as B,
|
|
3132
3093
|
fn as C,
|
|
3133
|
-
|
|
3094
|
+
hn as D,
|
|
3134
3095
|
Mo as E,
|
|
3135
3096
|
Ot as F,
|
|
3136
|
-
|
|
3137
|
-
|
|
3097
|
+
mn as G,
|
|
3098
|
+
gn as H,
|
|
3138
3099
|
bn as I,
|
|
3139
3100
|
Cn as J,
|
|
3140
3101
|
kn as K,
|
|
@@ -3146,7 +3107,7 @@ export {
|
|
|
3146
3107
|
Nn as Q,
|
|
3147
3108
|
Kt as R,
|
|
3148
3109
|
Be as S,
|
|
3149
|
-
|
|
3110
|
+
gt as T,
|
|
3150
3111
|
le as U,
|
|
3151
3112
|
bt as V,
|
|
3152
3113
|
Po as W,
|
|
@@ -3157,59 +3118,59 @@ export {
|
|
|
3157
3118
|
Ie as a,
|
|
3158
3119
|
Lo as a0,
|
|
3159
3120
|
To as a1,
|
|
3160
|
-
|
|
3161
|
-
|
|
3121
|
+
h as a2,
|
|
3122
|
+
v as a3,
|
|
3162
3123
|
A as a4,
|
|
3163
3124
|
Eo as a5,
|
|
3164
3125
|
xo as a6,
|
|
3165
|
-
|
|
3126
|
+
So as a7,
|
|
3166
3127
|
I as a8,
|
|
3167
3128
|
_n as a9,
|
|
3168
3129
|
Z as aA,
|
|
3169
|
-
|
|
3130
|
+
vt as aB,
|
|
3170
3131
|
xt as aC,
|
|
3171
3132
|
Lt as aD,
|
|
3172
3133
|
Le as aE,
|
|
3173
|
-
|
|
3134
|
+
wt as aF,
|
|
3174
3135
|
V as aG,
|
|
3175
3136
|
Me as aH,
|
|
3176
3137
|
H as aI,
|
|
3177
|
-
|
|
3178
|
-
|
|
3138
|
+
mt as aJ,
|
|
3139
|
+
L as aK,
|
|
3179
3140
|
uo as aL,
|
|
3180
|
-
|
|
3141
|
+
R as aM,
|
|
3181
3142
|
po as aN,
|
|
3182
3143
|
In as aO,
|
|
3183
|
-
|
|
3144
|
+
C as aa,
|
|
3184
3145
|
Bo as ab,
|
|
3185
3146
|
Ao as ac,
|
|
3186
|
-
|
|
3147
|
+
ho as ad,
|
|
3187
3148
|
Mt as ae,
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3149
|
+
St as af,
|
|
3150
|
+
mo as ag,
|
|
3151
|
+
y as ah,
|
|
3191
3152
|
Bt as ai,
|
|
3192
3153
|
Tt as aj,
|
|
3193
|
-
|
|
3154
|
+
go as ak,
|
|
3194
3155
|
bo as al,
|
|
3195
3156
|
Ct as am,
|
|
3196
3157
|
Co as an,
|
|
3197
|
-
|
|
3158
|
+
vo as ao,
|
|
3198
3159
|
fo as ap,
|
|
3199
|
-
|
|
3160
|
+
wo as aq,
|
|
3200
3161
|
ko as ar,
|
|
3201
3162
|
D as as,
|
|
3202
3163
|
K as at,
|
|
3203
3164
|
Pt as au,
|
|
3204
3165
|
T as av,
|
|
3205
|
-
|
|
3206
|
-
|
|
3166
|
+
yo as aw,
|
|
3167
|
+
yt as ax,
|
|
3207
3168
|
Et as ay,
|
|
3208
3169
|
kt as az,
|
|
3209
3170
|
Vt as b,
|
|
3210
3171
|
_t as c,
|
|
3211
|
-
|
|
3212
|
-
|
|
3172
|
+
Wt as d,
|
|
3173
|
+
Rt as e,
|
|
3213
3174
|
Ft as f,
|
|
3214
3175
|
Ut as g,
|
|
3215
3176
|
qt as h,
|
|
@@ -3232,4 +3193,4 @@ export {
|
|
|
3232
3193
|
cn as y,
|
|
3233
3194
|
ln as z
|
|
3234
3195
|
};
|
|
3235
|
-
//# sourceMappingURL=defaultBlocks-
|
|
3196
|
+
//# sourceMappingURL=defaultBlocks-CXOCngjC.js.map
|