@blocknote/core 0.36.1 → 0.37.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/blocknote.cjs +7 -7
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +612 -610
- package/dist/blocknote.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +1 -1
- package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +22 -0
- package/src/blocks/TableBlockContent/TableBlockContent.ts +2 -5
- package/src/editor/editor.css +5 -0
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/blocknote.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var co = Object.defineProperty;
|
|
2
2
|
var lo = (e, n, t) => n in e ? co(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
|
|
3
|
-
var
|
|
3
|
+
var p = (e, n, t) => lo(e, typeof n != "symbol" ? n + "" : n, t);
|
|
4
4
|
import { Slice as X, Fragment as R, DOMSerializer as ln, DOMParser as Ee, Node as uo } from "prosemirror-model";
|
|
5
5
|
import { ReplaceStep as dn, ReplaceAroundStep as st, Mapping as ho } from "prosemirror-transform";
|
|
6
6
|
import { Extension as _, combineTransactionSteps as un, getChangedRanges as po, findChildrenInRange as fo, Node as oe, Mark as re, isTextSelection as hn, InputRule as le, callOrReturn as mo, getExtensionField as go, mergeAttributes as kt, selectionToInsertionEnd as bo, isNodeSelection as it, posToDOMRect as Ue, getMarkRange as Nt, findChildren as Ht, findParentNode as ko, extensions as we, Editor as wo, createDocument as yo, getSchema as Co } from "@tiptap/core";
|
|
7
|
-
import { Plugin as
|
|
7
|
+
import { Plugin as N, PluginKey as U, TextSelection as L, NodeSelection as be, Selection as Ve, EditorState as vo } from "prosemirror-state";
|
|
8
8
|
import { v4 as pn } from "uuid";
|
|
9
9
|
import { TableMap as $e, goToNextCell as Dt, columnResizing as So, tableEditing as Eo, TableView as Bo, CellSelection as Be, addRowBefore as xo, addRowAfter as Mo, addColumnBefore as Po, addColumnAfter as To, deleteRow as Io, deleteColumn as Lo, mergeCells as Ao, splitCell as No } from "prosemirror-tables";
|
|
10
10
|
import Ho from "fast-deep-equal";
|
|
@@ -22,7 +22,7 @@ import { History as jo } from "@tiptap/extension-history";
|
|
|
22
22
|
import { Link as Go } from "@tiptap/extension-link";
|
|
23
23
|
import { Text as qo } from "@tiptap/extension-text";
|
|
24
24
|
import { yCursorPlugin as Ko, defaultSelectionBuilder as Yo, ySyncPlugin as Xo, yUndoPlugin as Jo, ySyncPluginKey as de, getRelativeSelection as Zo, absolutePositionToRelativePosition as Qo, relativePositionToAbsolutePosition as er, yUndoPluginKey as Ae, yCursorPluginKey as tr, undoCommand as nr, redoCommand as or } from "y-prosemirror";
|
|
25
|
-
import { DecorationSet as
|
|
25
|
+
import { DecorationSet as j, Decoration as J, EditorView as rr } from "prosemirror-view";
|
|
26
26
|
import * as ie from "yjs";
|
|
27
27
|
import { undo as sr, redo as ir } from "prosemirror-history";
|
|
28
28
|
import { dropCursor as ar } from "prosemirror-dropcursor";
|
|
@@ -115,7 +115,7 @@ const Ge = _.create({
|
|
|
115
115
|
addProseMirrorPlugins() {
|
|
116
116
|
let e = null, n = !1;
|
|
117
117
|
return [
|
|
118
|
-
new
|
|
118
|
+
new N({
|
|
119
119
|
key: new U("uniqueID"),
|
|
120
120
|
appendTransaction: (t, o, r) => {
|
|
121
121
|
const s = t.some((m) => m.docChanged) && !o.doc.eq(r.doc), i = this.options.filterTransaction && t.some((m) => {
|
|
@@ -127,38 +127,38 @@ const Ge = _.create({
|
|
|
127
127
|
const { tr: a } = r, { types: c, attributeName: l, generateID: d } = this.options, u = un(
|
|
128
128
|
o.doc,
|
|
129
129
|
t
|
|
130
|
-
), { mapping:
|
|
130
|
+
), { mapping: h } = u;
|
|
131
131
|
if (po(u).forEach(({ newRange: m }) => {
|
|
132
132
|
const g = fo(
|
|
133
133
|
r.doc,
|
|
134
134
|
m,
|
|
135
135
|
(w) => c.includes(w.type.name)
|
|
136
136
|
), b = g.map(({ node: w }) => w.attrs[l]).filter((w) => w !== null), k = dr(b);
|
|
137
|
-
g.forEach(({ node: w, pos:
|
|
138
|
-
let
|
|
139
|
-
const
|
|
140
|
-
if (
|
|
141
|
-
const
|
|
142
|
-
if (o.doc.content.findDiffStart(
|
|
143
|
-
const
|
|
137
|
+
g.forEach(({ node: w, pos: C }) => {
|
|
138
|
+
let y;
|
|
139
|
+
const B = (y = a.doc.nodeAt(C)) === null || y === void 0 ? void 0 : y.attrs[l];
|
|
140
|
+
if (B === null) {
|
|
141
|
+
const v = o.doc.type.createAndFill().content;
|
|
142
|
+
if (o.doc.content.findDiffStart(v) === null) {
|
|
143
|
+
const M = JSON.parse(
|
|
144
144
|
JSON.stringify(r.doc.toJSON())
|
|
145
145
|
);
|
|
146
|
-
if (
|
|
147
|
-
a.setNodeMarkup(
|
|
146
|
+
if (M.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(M.content) === JSON.stringify(v.toJSON())) {
|
|
147
|
+
a.setNodeMarkup(C, void 0, {
|
|
148
148
|
...w.attrs,
|
|
149
149
|
[l]: "initialBlockId"
|
|
150
150
|
});
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
a.setNodeMarkup(
|
|
154
|
+
a.setNodeMarkup(C, void 0, {
|
|
155
155
|
...w.attrs,
|
|
156
156
|
[l]: d()
|
|
157
157
|
});
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
const { deleted:
|
|
161
|
-
|
|
160
|
+
const { deleted: K } = h.invert().mapResult(C);
|
|
161
|
+
K && k.includes(B) && a.setNodeMarkup(C, void 0, {
|
|
162
162
|
...w.attrs,
|
|
163
163
|
[l]: d()
|
|
164
164
|
});
|
|
@@ -275,7 +275,7 @@ function ve(e) {
|
|
|
275
275
|
function ct(e) {
|
|
276
276
|
return wt(e) ? e.props.rowspan ?? 1 : 1;
|
|
277
277
|
}
|
|
278
|
-
class
|
|
278
|
+
class G extends Error {
|
|
279
279
|
constructor(n) {
|
|
280
280
|
super(`Unreachable case: ${n}`);
|
|
281
281
|
}
|
|
@@ -345,7 +345,7 @@ function hr(e) {
|
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
const
|
|
348
|
+
const T = {
|
|
349
349
|
backgroundColor: {
|
|
350
350
|
default: "default"
|
|
351
351
|
},
|
|
@@ -426,7 +426,7 @@ function Ne(e, n, t, o, r = !1, s) {
|
|
|
426
426
|
dom: i
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function q(e) {
|
|
430
430
|
return oe.create(e);
|
|
431
431
|
}
|
|
432
432
|
function gn(e, n) {
|
|
@@ -479,7 +479,7 @@ function fr(e, n) {
|
|
|
479
479
|
}), t;
|
|
480
480
|
}
|
|
481
481
|
function Me(e, n) {
|
|
482
|
-
const t =
|
|
482
|
+
const t = q({
|
|
483
483
|
name: e.type,
|
|
484
484
|
content: e.content === "inline" ? "inline*" : "",
|
|
485
485
|
group: "blockContent",
|
|
@@ -605,18 +605,18 @@ function Ct(e, n) {
|
|
|
605
605
|
let i, a;
|
|
606
606
|
if (t.forEach((c, l) => {
|
|
607
607
|
if (c.type.spec.group === "blockContent") {
|
|
608
|
-
const d = c, u = o + l + 1,
|
|
608
|
+
const d = c, u = o + l + 1, h = u + c.nodeSize;
|
|
609
609
|
i = {
|
|
610
610
|
node: d,
|
|
611
611
|
beforePos: u,
|
|
612
|
-
afterPos:
|
|
612
|
+
afterPos: h
|
|
613
613
|
};
|
|
614
614
|
} else if (c.type.name === "blockGroup") {
|
|
615
|
-
const d = c, u = o + l + 1,
|
|
615
|
+
const d = c, u = o + l + 1, h = u + c.nodeSize;
|
|
616
616
|
a = {
|
|
617
617
|
node: d,
|
|
618
618
|
beforePos: u,
|
|
619
|
-
afterPos:
|
|
619
|
+
afterPos: h
|
|
620
620
|
};
|
|
621
621
|
}
|
|
622
622
|
}), !i)
|
|
@@ -653,7 +653,7 @@ function Pe(e) {
|
|
|
653
653
|
);
|
|
654
654
|
return Ct(e.nodeAfter, e.pos);
|
|
655
655
|
}
|
|
656
|
-
function
|
|
656
|
+
function S(e) {
|
|
657
657
|
const n = Z(e.doc, e.selection.anchor);
|
|
658
658
|
return ne(n);
|
|
659
659
|
}
|
|
@@ -661,7 +661,7 @@ function qe(e) {
|
|
|
661
661
|
const n = Z(e.doc, e.selection.anchor);
|
|
662
662
|
return ne(n);
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function H(e) {
|
|
665
665
|
return "doc" in e ? e.doc.type.schema : e.type.schema;
|
|
666
666
|
}
|
|
667
667
|
function kn(e) {
|
|
@@ -696,9 +696,9 @@ function wn(e, n, t) {
|
|
|
696
696
|
cells: []
|
|
697
697
|
};
|
|
698
698
|
l === 0 && a.content.forEach((u) => {
|
|
699
|
-
let
|
|
700
|
-
|
|
701
|
-
}), d.cells = a.content.content.map((u,
|
|
699
|
+
let h = u.attrs.colwidth;
|
|
700
|
+
h == null && (h = new Array(u.attrs.colspan ?? 1).fill(void 0)), o.columnWidths.push(...h);
|
|
701
|
+
}), d.cells = a.content.content.map((u, h) => (r[l] || (r[l] = []), r[l][h] = u.type.name === "tableHeader", {
|
|
702
702
|
type: "tableCell",
|
|
703
703
|
content: u.content.content.map(
|
|
704
704
|
(m) => Ke(m, n, t)
|
|
@@ -777,7 +777,7 @@ function Ke(e, n, t) {
|
|
|
777
777
|
else if (l.propSchema === "string")
|
|
778
778
|
i[l.type] = c.attrs.stringValue;
|
|
779
779
|
else
|
|
780
|
-
throw new
|
|
780
|
+
throw new G(l.propSchema);
|
|
781
781
|
}
|
|
782
782
|
r ? ue(r) ? a ? (o.push(r), r = {
|
|
783
783
|
type: "link",
|
|
@@ -872,9 +872,9 @@ function E(e, n, t = vt(n), o = St(n), r = ke(n), s = Et(n)) {
|
|
|
872
872
|
const w = l.propSchema;
|
|
873
873
|
b in w && !(w[b].default === void 0 && k === void 0) && (d[b] = k);
|
|
874
874
|
}
|
|
875
|
-
const u = t[a.blockNoteType],
|
|
875
|
+
const u = t[a.blockNoteType], h = [];
|
|
876
876
|
(g = a.childContainer) == null || g.node.forEach((b) => {
|
|
877
|
-
|
|
877
|
+
h.push(
|
|
878
878
|
E(
|
|
879
879
|
b,
|
|
880
880
|
n,
|
|
@@ -905,13 +905,13 @@ function E(e, n, t = vt(n), o = St(n), r = ke(n), s = Et(n)) {
|
|
|
905
905
|
} else if (u.content === "none")
|
|
906
906
|
f = void 0;
|
|
907
907
|
else
|
|
908
|
-
throw new
|
|
908
|
+
throw new G(u.content);
|
|
909
909
|
const m = {
|
|
910
910
|
id: c,
|
|
911
911
|
type: u.type,
|
|
912
912
|
props: d,
|
|
913
913
|
content: f,
|
|
914
|
-
children:
|
|
914
|
+
children: h
|
|
915
915
|
};
|
|
916
916
|
return s == null || s.set(e, m), m;
|
|
917
917
|
}
|
|
@@ -933,7 +933,7 @@ function gr(e, n, t = vt(n), o = St(n), r = ke(n), s = Et(n)) {
|
|
|
933
933
|
if (a.type.name !== "blockGroup")
|
|
934
934
|
throw new Error("unexpected");
|
|
935
935
|
const d = [];
|
|
936
|
-
let u,
|
|
936
|
+
let u, h;
|
|
937
937
|
return a.forEach((f, m, g) => {
|
|
938
938
|
if (f.type.name !== "blockContainer")
|
|
939
939
|
throw new Error("unexpected");
|
|
@@ -947,12 +947,12 @@ function gr(e, n, t = vt(n), o = St(n), r = ke(n), s = Et(n)) {
|
|
|
947
947
|
if (f.firstChild.type.name === "blockGroup") {
|
|
948
948
|
if (!b)
|
|
949
949
|
throw new Error("unexpected");
|
|
950
|
-
const
|
|
950
|
+
const B = i(
|
|
951
951
|
f.firstChild,
|
|
952
952
|
Math.max(0, c - 1),
|
|
953
953
|
k ? Math.max(0, l - 1) : 0
|
|
954
954
|
);
|
|
955
|
-
u =
|
|
955
|
+
u = B.blockCutAtStart, k && (h = B.blockCutAtEnd), d.push(...B.blocks);
|
|
956
956
|
return;
|
|
957
957
|
}
|
|
958
958
|
const w = E(
|
|
@@ -962,22 +962,22 @@ function gr(e, n, t = vt(n), o = St(n), r = ke(n), s = Et(n)) {
|
|
|
962
962
|
o,
|
|
963
963
|
r,
|
|
964
964
|
s
|
|
965
|
-
),
|
|
966
|
-
let
|
|
967
|
-
if (
|
|
968
|
-
const
|
|
969
|
-
|
|
965
|
+
), C = f.childCount > 1 ? f.child(1) : void 0;
|
|
966
|
+
let y = [];
|
|
967
|
+
if (C) {
|
|
968
|
+
const B = i(
|
|
969
|
+
C,
|
|
970
970
|
0,
|
|
971
971
|
// TODO: can this be anything other than 0?
|
|
972
972
|
k ? Math.max(0, l - 1) : 0
|
|
973
973
|
);
|
|
974
|
-
|
|
974
|
+
y = B.blocks, k && (h = B.blockCutAtEnd);
|
|
975
975
|
}
|
|
976
|
-
k && !
|
|
976
|
+
k && !C && l > 1 && (h = w.id), b && c > 1 && (u = w.id), d.push({
|
|
977
977
|
...w,
|
|
978
|
-
children:
|
|
978
|
+
children: y
|
|
979
979
|
});
|
|
980
|
-
}), { blocks: d, blockCutAtStart: u, blockCutAtEnd:
|
|
980
|
+
}), { blocks: d, blockCutAtStart: u, blockCutAtEnd: h };
|
|
981
981
|
}
|
|
982
982
|
if (e.content.childCount === 0)
|
|
983
983
|
return {
|
|
@@ -1091,7 +1091,7 @@ function jc(e, n) {
|
|
|
1091
1091
|
(a) => {
|
|
1092
1092
|
if (typeof r == "boolean")
|
|
1093
1093
|
return;
|
|
1094
|
-
const c =
|
|
1094
|
+
const c = z([a], s.pmSchema);
|
|
1095
1095
|
s.transact(
|
|
1096
1096
|
(l) => l.replaceWith(r(), r() + o.nodeSize, c)
|
|
1097
1097
|
);
|
|
@@ -1176,7 +1176,7 @@ function Gc(e, n) {
|
|
|
1176
1176
|
else if (e.propSchema === "string")
|
|
1177
1177
|
r = n.render(o.attrs.stringValue);
|
|
1178
1178
|
else
|
|
1179
|
-
throw new
|
|
1179
|
+
throw new G(e.propSchema);
|
|
1180
1180
|
return vr(
|
|
1181
1181
|
r,
|
|
1182
1182
|
e.type,
|
|
@@ -1202,13 +1202,13 @@ function se(e) {
|
|
|
1202
1202
|
for (let s = 0; s < e.content.rows.length; s++)
|
|
1203
1203
|
for (let i = 0; i < e.content.rows[s].cells.length; i++) {
|
|
1204
1204
|
const a = at(e.content.rows[s].cells[i]), c = ct(a), l = ve(a), { row: d, col: u } = r(s, i);
|
|
1205
|
-
for (let
|
|
1205
|
+
for (let h = d; h < d + c; h++)
|
|
1206
1206
|
for (let f = u; f < u + l; f++) {
|
|
1207
|
-
if (o[
|
|
1207
|
+
if (o[h][f])
|
|
1208
1208
|
throw new Error(
|
|
1209
|
-
`Unable to create occupancy grid for table, cell at ${
|
|
1209
|
+
`Unable to create occupancy grid for table, cell at ${h},${f} is already occupied`
|
|
1210
1210
|
);
|
|
1211
|
-
o[
|
|
1211
|
+
o[h][f] = {
|
|
1212
1212
|
row: s,
|
|
1213
1213
|
col: i,
|
|
1214
1214
|
rowspan: c,
|
|
@@ -1431,7 +1431,7 @@ function _t(e, n, t, o) {
|
|
|
1431
1431
|
else if (c.propSchema === "string")
|
|
1432
1432
|
a && r.push(n.mark(i, { stringValue: a }));
|
|
1433
1433
|
else
|
|
1434
|
-
throw new
|
|
1434
|
+
throw new G(c.propSchema);
|
|
1435
1435
|
}
|
|
1436
1436
|
return !o || !n.nodes[o].spec.code ? e.text.split(/(\n)/g).filter((i) => i.length > 0).map((i) => i === `
|
|
1437
1437
|
` ? n.nodes.hardBreak.createChecked() : n.text(i, r)) : e.text.length > 0 ? [n.text(e.text, r)] : [];
|
|
@@ -1467,7 +1467,7 @@ function pt(e, n, t, o) {
|
|
|
1467
1467
|
);
|
|
1468
1468
|
return r;
|
|
1469
1469
|
}
|
|
1470
|
-
function
|
|
1470
|
+
function z(e, n, t, o = ke(n)) {
|
|
1471
1471
|
const r = [];
|
|
1472
1472
|
for (const s of e)
|
|
1473
1473
|
typeof s == "string" ? r.push(
|
|
@@ -1483,13 +1483,13 @@ function Ye(e, n, t = ke(n)) {
|
|
|
1483
1483
|
const o = [], r = new Array(e.headerRows ?? 0).fill(!0), s = new Array(e.headerCols ?? 0).fill(!0), i = e.columnWidths ?? [];
|
|
1484
1484
|
for (let a = 0; a < e.rows.length; a++) {
|
|
1485
1485
|
const c = e.rows[a], l = [], d = r[a];
|
|
1486
|
-
for (let
|
|
1487
|
-
const f = c.cells[
|
|
1486
|
+
for (let h = 0; h < c.cells.length; h++) {
|
|
1487
|
+
const f = c.cells[h], m = s[h], g = void 0;
|
|
1488
1488
|
let b = null;
|
|
1489
1489
|
const k = he(
|
|
1490
1490
|
{
|
|
1491
1491
|
row: a,
|
|
1492
|
-
col:
|
|
1492
|
+
col: h
|
|
1493
1493
|
},
|
|
1494
1494
|
{ content: e }
|
|
1495
1495
|
);
|
|
@@ -1497,29 +1497,29 @@ function Ye(e, n, t = ke(n)) {
|
|
|
1497
1497
|
if (f) if (typeof f == "string")
|
|
1498
1498
|
b = n.text(f);
|
|
1499
1499
|
else if (Ce(f)) {
|
|
1500
|
-
f.content && (b =
|
|
1500
|
+
f.content && (b = z(
|
|
1501
1501
|
f.content,
|
|
1502
1502
|
n,
|
|
1503
1503
|
"tableParagraph",
|
|
1504
1504
|
t
|
|
1505
1505
|
));
|
|
1506
|
-
const
|
|
1507
|
-
|
|
1506
|
+
const y = ve(f);
|
|
1507
|
+
y > 1 && (w = new Array(y).fill(!1).map((B, K) => i[k.col + K] ?? void 0));
|
|
1508
1508
|
} else
|
|
1509
|
-
b =
|
|
1509
|
+
b = z(
|
|
1510
1510
|
f,
|
|
1511
1511
|
n,
|
|
1512
1512
|
"tableParagraph",
|
|
1513
1513
|
t
|
|
1514
1514
|
);
|
|
1515
|
-
const
|
|
1515
|
+
const C = n.nodes[m || d ? "tableHeader" : "tableCell"].createChecked(
|
|
1516
1516
|
{
|
|
1517
1517
|
...Ce(f) ? f.props : {},
|
|
1518
1518
|
colwidth: w
|
|
1519
1519
|
},
|
|
1520
1520
|
n.nodes.tableParagraph.createChecked(g, b)
|
|
1521
1521
|
);
|
|
1522
|
-
l.push(
|
|
1522
|
+
l.push(C);
|
|
1523
1523
|
}
|
|
1524
1524
|
const u = n.nodes.tableRow.createChecked({}, l);
|
|
1525
1525
|
o.push(u);
|
|
@@ -1533,7 +1533,7 @@ function xn(e, n, t) {
|
|
|
1533
1533
|
if (!e.content)
|
|
1534
1534
|
o = n.nodes[r].createChecked(e.props);
|
|
1535
1535
|
else if (typeof e.content == "string") {
|
|
1536
|
-
const s =
|
|
1536
|
+
const s = z(
|
|
1537
1537
|
[e.content],
|
|
1538
1538
|
n,
|
|
1539
1539
|
r,
|
|
@@ -1541,7 +1541,7 @@ function xn(e, n, t) {
|
|
|
1541
1541
|
);
|
|
1542
1542
|
o = n.nodes[r].createChecked(e.props, s);
|
|
1543
1543
|
} else if (Array.isArray(e.content)) {
|
|
1544
|
-
const s =
|
|
1544
|
+
const s = z(
|
|
1545
1545
|
e.content,
|
|
1546
1546
|
n,
|
|
1547
1547
|
r,
|
|
@@ -1552,7 +1552,7 @@ function xn(e, n, t) {
|
|
|
1552
1552
|
const s = Ye(e.content, n, t);
|
|
1553
1553
|
o = n.nodes[r].createChecked(e.props, s);
|
|
1554
1554
|
} else
|
|
1555
|
-
throw new
|
|
1555
|
+
throw new G(e.content.type);
|
|
1556
1556
|
return o;
|
|
1557
1557
|
}
|
|
1558
1558
|
function pe(e, n, t = ke(n)) {
|
|
@@ -1602,7 +1602,7 @@ function xt(e) {
|
|
|
1602
1602
|
return e.type.isInGroup("bnBlock");
|
|
1603
1603
|
}
|
|
1604
1604
|
function Ir(e, n, t, o = "before") {
|
|
1605
|
-
const r = typeof t == "string" ? t : t.id, s =
|
|
1605
|
+
const r = typeof t == "string" ? t : t.id, s = H(e), i = n.map(
|
|
1606
1606
|
(d) => pe(d, s)
|
|
1607
1607
|
), a = F(r, e.doc);
|
|
1608
1608
|
if (!a)
|
|
@@ -1615,7 +1615,7 @@ function Ir(e, n, t, o = "before") {
|
|
|
1615
1615
|
);
|
|
1616
1616
|
}
|
|
1617
1617
|
function Ut(e, n, t) {
|
|
1618
|
-
const o =
|
|
1618
|
+
const o = H(e), r = t.map(
|
|
1619
1619
|
(d) => pe(d, o)
|
|
1620
1620
|
), s = new Set(
|
|
1621
1621
|
n.map(
|
|
@@ -1634,10 +1634,10 @@ function Ut(e, n, t) {
|
|
|
1634
1634
|
const b = e.doc.nodeSize;
|
|
1635
1635
|
c += g - b;
|
|
1636
1636
|
}
|
|
1637
|
-
const
|
|
1637
|
+
const h = e.doc.nodeSize, f = e.doc.resolve(u - c);
|
|
1638
1638
|
f.node().type.name === "blockGroup" && f.node(f.depth - 1).type.name !== "doc" && f.node().childCount === 1 ? e.delete(f.before(), f.after()) : e.delete(u - c, u - c + d.nodeSize);
|
|
1639
1639
|
const m = e.doc.nodeSize;
|
|
1640
|
-
return c +=
|
|
1640
|
+
return c += h - m, !1;
|
|
1641
1641
|
}), s.size > 0) {
|
|
1642
1642
|
const d = [...s].join(`
|
|
1643
1643
|
`);
|
|
@@ -1657,12 +1657,12 @@ function Mn(e, n, t, o, r) {
|
|
|
1657
1657
|
const s = Pe(e.doc.resolve(n));
|
|
1658
1658
|
let i = null;
|
|
1659
1659
|
s.blockNoteType === "table" && (i = Nr(e));
|
|
1660
|
-
const a =
|
|
1660
|
+
const a = H(e);
|
|
1661
1661
|
if (o !== void 0 && r !== void 0 && o > r)
|
|
1662
1662
|
throw new Error("Invalid replaceFromPos or replaceToPos");
|
|
1663
1663
|
const c = a.nodes[s.blockNoteType], l = a.nodes[t.type || s.blockNoteType], d = l.isInGroup("bnBlock") ? l : a.nodes.blockContainer;
|
|
1664
1664
|
if (s.isBlockContainer && l.isInGroup("blockContent")) {
|
|
1665
|
-
const u = o !== void 0 && o > s.blockContent.beforePos && o < s.blockContent.afterPos ? o - s.blockContent.beforePos - 1 : void 0,
|
|
1665
|
+
const u = o !== void 0 && o > s.blockContent.beforePos && o < s.blockContent.afterPos ? o - s.blockContent.beforePos - 1 : void 0, h = r !== void 0 && r > s.blockContent.beforePos && r < s.blockContent.afterPos ? r - s.blockContent.beforePos - 1 : void 0;
|
|
1666
1666
|
$t(t, e, s), Lr(
|
|
1667
1667
|
t,
|
|
1668
1668
|
e,
|
|
@@ -1670,7 +1670,7 @@ function Mn(e, n, t, o, r) {
|
|
|
1670
1670
|
l,
|
|
1671
1671
|
s,
|
|
1672
1672
|
u,
|
|
1673
|
-
|
|
1673
|
+
h
|
|
1674
1674
|
);
|
|
1675
1675
|
} else if (!s.isBlockContainer && l.isInGroup("bnBlock"))
|
|
1676
1676
|
$t(t, e, s);
|
|
@@ -1696,21 +1696,21 @@ function Mn(e, n, t, o, r) {
|
|
|
1696
1696
|
}), i && Hr(e, s, i);
|
|
1697
1697
|
}
|
|
1698
1698
|
function Lr(e, n, t, o, r, s, i) {
|
|
1699
|
-
const a =
|
|
1699
|
+
const a = H(n);
|
|
1700
1700
|
let c = "keep";
|
|
1701
1701
|
if (e.content)
|
|
1702
1702
|
if (typeof e.content == "string")
|
|
1703
|
-
c =
|
|
1703
|
+
c = z(
|
|
1704
1704
|
[e.content],
|
|
1705
1705
|
a,
|
|
1706
1706
|
o.name
|
|
1707
1707
|
);
|
|
1708
1708
|
else if (Array.isArray(e.content))
|
|
1709
|
-
c =
|
|
1709
|
+
c = z(e.content, a, o.name);
|
|
1710
1710
|
else if (e.content.type === "tableContent")
|
|
1711
1711
|
c = Ye(e.content, a);
|
|
1712
1712
|
else
|
|
1713
|
-
throw new
|
|
1713
|
+
throw new G(e.content.type);
|
|
1714
1714
|
else
|
|
1715
1715
|
t.spec.content === "" || o.spec.content !== t.spec.content && (c = []);
|
|
1716
1716
|
if (c === "keep")
|
|
@@ -1723,13 +1723,13 @@ function Lr(e, n, t, o, r, s, i) {
|
|
|
1723
1723
|
...r.blockContent.node.attrs,
|
|
1724
1724
|
...e.props
|
|
1725
1725
|
});
|
|
1726
|
-
const l = r.blockContent.beforePos + 1 + (s ?? 0), d = r.blockContent.beforePos + 1 + (i ?? r.blockContent.node.content.size), u = n.doc.resolve(r.blockContent.beforePos).depth,
|
|
1726
|
+
const l = r.blockContent.beforePos + 1 + (s ?? 0), d = r.blockContent.beforePos + 1 + (i ?? r.blockContent.node.content.size), u = n.doc.resolve(r.blockContent.beforePos).depth, h = n.doc.resolve(l).depth, f = n.doc.resolve(d).depth;
|
|
1727
1727
|
n.replace(
|
|
1728
1728
|
l,
|
|
1729
1729
|
d,
|
|
1730
1730
|
new X(
|
|
1731
1731
|
R.from(c),
|
|
1732
|
-
|
|
1732
|
+
h - u - 1,
|
|
1733
1733
|
f - u - 1
|
|
1734
1734
|
)
|
|
1735
1735
|
);
|
|
@@ -1747,7 +1747,7 @@ function Lr(e, n, t, o, r, s, i) {
|
|
|
1747
1747
|
);
|
|
1748
1748
|
}
|
|
1749
1749
|
function $t(e, n, t) {
|
|
1750
|
-
const o =
|
|
1750
|
+
const o = H(n);
|
|
1751
1751
|
if (e.children !== void 0 && e.children.length > 0) {
|
|
1752
1752
|
const r = e.children.map((s) => pe(s, o));
|
|
1753
1753
|
if (t.childContainer)
|
|
@@ -1779,12 +1779,12 @@ function Ar(e, n, t, o, r) {
|
|
|
1779
1779
|
o,
|
|
1780
1780
|
r
|
|
1781
1781
|
);
|
|
1782
|
-
const a = e.doc.resolve(i.posBeforeNode + 1).node(), c =
|
|
1782
|
+
const a = e.doc.resolve(i.posBeforeNode + 1).node(), c = H(e);
|
|
1783
1783
|
return E(a, c);
|
|
1784
1784
|
}
|
|
1785
1785
|
function Nr(e) {
|
|
1786
1786
|
const n = "selection" in e ? e.selection : null;
|
|
1787
|
-
if (!(n instanceof
|
|
1787
|
+
if (!(n instanceof L))
|
|
1788
1788
|
return null;
|
|
1789
1789
|
const t = e.doc.resolve(n.head);
|
|
1790
1790
|
let o = -1, r = -1;
|
|
@@ -1803,8 +1803,8 @@ function Nr(e) {
|
|
|
1803
1803
|
const c = $e.get(a), l = s - (i + 1), d = c.map.indexOf(l);
|
|
1804
1804
|
if (d < 0)
|
|
1805
1805
|
return null;
|
|
1806
|
-
const u = Math.floor(d / c.width),
|
|
1807
|
-
return { row: u, col:
|
|
1806
|
+
const u = Math.floor(d / c.width), h = d % c.width, m = s + 1 + 1, g = Math.max(0, n.head - m);
|
|
1807
|
+
return { row: u, col: h, offset: g };
|
|
1808
1808
|
}
|
|
1809
1809
|
function Hr(e, n, t) {
|
|
1810
1810
|
var b;
|
|
@@ -1815,7 +1815,7 @@ function Hr(e, n, t) {
|
|
|
1815
1815
|
o = e.mapping.map(n.blockContent.beforePos);
|
|
1816
1816
|
else {
|
|
1817
1817
|
const k = e.mapping.map(n.bnBlock.beforePos), w = k + (((b = e.doc.nodeAt(k)) == null ? void 0 : b.nodeSize) || 0);
|
|
1818
|
-
e.doc.nodesBetween(k, w, (
|
|
1818
|
+
e.doc.nodesBetween(k, w, (C, y) => C.type.name === "table" ? (o = y, !1) : !0);
|
|
1819
1819
|
}
|
|
1820
1820
|
const r = o >= 0 ? e.doc.nodeAt(o) : null;
|
|
1821
1821
|
if (!r || r.type.name !== "table")
|
|
@@ -1823,8 +1823,8 @@ function Hr(e, n, t) {
|
|
|
1823
1823
|
const s = $e.get(r), i = Math.max(0, Math.min(t.row, s.height - 1)), a = Math.max(0, Math.min(t.col, s.width - 1)), c = i * s.width + a, l = s.map[c];
|
|
1824
1824
|
if (l == null)
|
|
1825
1825
|
return !1;
|
|
1826
|
-
const u = o + 1 + l + 1,
|
|
1827
|
-
return "selection" in e && e.setSelection(
|
|
1826
|
+
const u = o + 1 + l + 1, h = e.doc.nodeAt(u), f = u + 1, m = h ? h.content.size : 0, g = f + Math.max(0, Math.min(t.offset, m));
|
|
1827
|
+
return "selection" in e && e.setSelection(L.create(e.doc, g)), !0;
|
|
1828
1828
|
}
|
|
1829
1829
|
function Pn(e) {
|
|
1830
1830
|
const n = Array.from(e.classList).filter(
|
|
@@ -1836,27 +1836,27 @@ function Tn(e, n, t, o) {
|
|
|
1836
1836
|
let r;
|
|
1837
1837
|
if (n)
|
|
1838
1838
|
if (typeof n == "string")
|
|
1839
|
-
r =
|
|
1839
|
+
r = z([n], e.pmSchema);
|
|
1840
1840
|
else if (Array.isArray(n))
|
|
1841
|
-
r =
|
|
1841
|
+
r = z(n, e.pmSchema);
|
|
1842
1842
|
else if (n.type === "tableContent")
|
|
1843
1843
|
r = Ye(n, e.pmSchema);
|
|
1844
1844
|
else
|
|
1845
|
-
throw new
|
|
1845
|
+
throw new G(n.type);
|
|
1846
1846
|
else throw new Error("blockContent is required");
|
|
1847
1847
|
const s = t.serializeFragment(R.from(r), o);
|
|
1848
1848
|
return s.nodeType === 1 && Pn(s), s;
|
|
1849
1849
|
}
|
|
1850
1850
|
function Dr(e, n, t, o, r, s, i) {
|
|
1851
|
-
var g, b, k, w,
|
|
1851
|
+
var g, b, k, w, C, y, B, K;
|
|
1852
1852
|
const a = (i == null ? void 0 : i.document) ?? document, c = n.pmSchema.nodes.blockContainer;
|
|
1853
1853
|
let l = t.props;
|
|
1854
1854
|
if (!t.props) {
|
|
1855
1855
|
l = {};
|
|
1856
|
-
for (const [
|
|
1856
|
+
for (const [x, v] of Object.entries(
|
|
1857
1857
|
n.schema.blockSchema[t.type].propSchema
|
|
1858
1858
|
))
|
|
1859
|
-
|
|
1859
|
+
v.default !== void 0 && (l[x] = v.default);
|
|
1860
1860
|
}
|
|
1861
1861
|
const d = (b = (g = c.spec) == null ? void 0 : g.toDOM) == null ? void 0 : b.call(
|
|
1862
1862
|
g,
|
|
@@ -1864,53 +1864,53 @@ function Dr(e, n, t, o, r, s, i) {
|
|
|
1864
1864
|
id: t.id,
|
|
1865
1865
|
...l
|
|
1866
1866
|
})
|
|
1867
|
-
), u = Array.from(d.dom.attributes),
|
|
1868
|
-
if (
|
|
1869
|
-
const
|
|
1867
|
+
), u = Array.from(d.dom.attributes), h = n.blockImplementations[t.type].implementation.toExternalHTML({ ...t, props: l }, n), f = a.createDocumentFragment();
|
|
1868
|
+
if (h.dom.classList.contains("bn-block-content")) {
|
|
1869
|
+
const x = [
|
|
1870
1870
|
...u,
|
|
1871
|
-
...Array.from(
|
|
1871
|
+
...Array.from(h.dom.attributes)
|
|
1872
1872
|
].filter(
|
|
1873
|
-
(
|
|
1873
|
+
(v) => v.name.startsWith("data") && v.name !== "data-content-type" && v.name !== "data-file-block" && v.name !== "data-node-view-wrapper" && v.name !== "data-node-type" && v.name !== "data-id" && v.name !== "data-index" && v.name !== "data-editable"
|
|
1874
1874
|
);
|
|
1875
|
-
for (const
|
|
1876
|
-
|
|
1877
|
-
Pn(
|
|
1875
|
+
for (const v of x)
|
|
1876
|
+
h.dom.firstChild.setAttribute(v.name, v.value);
|
|
1877
|
+
Pn(h.dom.firstChild), f.append(...Array.from(h.dom.childNodes));
|
|
1878
1878
|
} else
|
|
1879
|
-
f.append(
|
|
1880
|
-
if (
|
|
1881
|
-
const
|
|
1879
|
+
f.append(h.dom);
|
|
1880
|
+
if (h.contentDOM && t.content) {
|
|
1881
|
+
const x = Tn(
|
|
1882
1882
|
n,
|
|
1883
1883
|
t.content,
|
|
1884
1884
|
// TODO
|
|
1885
1885
|
o,
|
|
1886
1886
|
i
|
|
1887
1887
|
);
|
|
1888
|
-
|
|
1888
|
+
h.contentDOM.appendChild(x);
|
|
1889
1889
|
}
|
|
1890
1890
|
let m;
|
|
1891
1891
|
if (r.has(t.type) ? m = "OL" : s.has(t.type) && (m = "UL"), m) {
|
|
1892
1892
|
if (((k = e.lastChild) == null ? void 0 : k.nodeName) !== m) {
|
|
1893
|
-
const
|
|
1894
|
-
m === "OL" && (l != null && l.start) && (l == null ? void 0 : l.start) !== 1 &&
|
|
1893
|
+
const v = a.createElement(m);
|
|
1894
|
+
m === "OL" && (l != null && l.start) && (l == null ? void 0 : l.start) !== 1 && v.setAttribute("start", l.start + ""), e.append(v);
|
|
1895
1895
|
}
|
|
1896
|
-
const
|
|
1897
|
-
|
|
1896
|
+
const x = a.createElement("li");
|
|
1897
|
+
x.append(f), e.lastChild.appendChild(x);
|
|
1898
1898
|
} else
|
|
1899
1899
|
e.append(f);
|
|
1900
1900
|
if (t.children && t.children.length > 0) {
|
|
1901
|
-
const
|
|
1901
|
+
const x = a.createDocumentFragment();
|
|
1902
1902
|
if (In(
|
|
1903
|
-
|
|
1903
|
+
x,
|
|
1904
1904
|
n,
|
|
1905
1905
|
t.children,
|
|
1906
1906
|
o,
|
|
1907
1907
|
r,
|
|
1908
1908
|
s,
|
|
1909
1909
|
i
|
|
1910
|
-
), ((w = e.lastChild) == null ? void 0 : w.nodeName) === "UL" || ((
|
|
1911
|
-
for (; ((
|
|
1912
|
-
e.lastChild.lastChild.appendChild(
|
|
1913
|
-
n.pmSchema.nodes[t.type].isInGroup("blockContent") ? e.append(
|
|
1910
|
+
), ((w = e.lastChild) == null ? void 0 : w.nodeName) === "UL" || ((C = e.lastChild) == null ? void 0 : C.nodeName) === "OL")
|
|
1911
|
+
for (; ((y = x.firstChild) == null ? void 0 : y.nodeName) === "UL" || ((B = x.firstChild) == null ? void 0 : B.nodeName) === "OL"; )
|
|
1912
|
+
e.lastChild.lastChild.appendChild(x.firstChild);
|
|
1913
|
+
n.pmSchema.nodes[t.type].isInGroup("blockContent") ? e.append(x) : (K = h.contentDOM) == null || K.append(x);
|
|
1914
1914
|
}
|
|
1915
1915
|
}
|
|
1916
1916
|
const In = (e, n, t, o, r, s, i) => {
|
|
@@ -1964,18 +1964,18 @@ function Rr(e, n, t, o, r) {
|
|
|
1964
1964
|
let s;
|
|
1965
1965
|
if (n)
|
|
1966
1966
|
if (typeof n == "string")
|
|
1967
|
-
s =
|
|
1967
|
+
s = z([n], e.pmSchema, o);
|
|
1968
1968
|
else if (Array.isArray(n))
|
|
1969
|
-
s =
|
|
1969
|
+
s = z(n, e.pmSchema, o);
|
|
1970
1970
|
else if (n.type === "tableContent")
|
|
1971
1971
|
s = Ye(n, e.pmSchema);
|
|
1972
1972
|
else
|
|
1973
|
-
throw new
|
|
1973
|
+
throw new G(n.type);
|
|
1974
1974
|
else throw new Error("blockContent is required");
|
|
1975
1975
|
return t.serializeFragment(R.from(s), r);
|
|
1976
1976
|
}
|
|
1977
1977
|
function Vr(e, n, t, o, r) {
|
|
1978
|
-
var u,
|
|
1978
|
+
var u, h, f, m, g;
|
|
1979
1979
|
const s = e.pmSchema.nodes.blockContainer;
|
|
1980
1980
|
let i = n.props;
|
|
1981
1981
|
if (!n.props) {
|
|
@@ -2009,8 +2009,8 @@ function Vr(e, n, t, o, r) {
|
|
|
2009
2009
|
}
|
|
2010
2010
|
return c.dom;
|
|
2011
2011
|
}
|
|
2012
|
-
const d = (f = (
|
|
2013
|
-
|
|
2012
|
+
const d = (f = (h = s.spec) == null ? void 0 : h.toDOM) == null ? void 0 : f.call(
|
|
2013
|
+
h,
|
|
2014
2014
|
s.create({
|
|
2015
2015
|
id: n.id,
|
|
2016
2016
|
...i
|
|
@@ -2062,7 +2062,7 @@ function $r(e) {
|
|
|
2062
2062
|
} : e.getMeta("y-sync$") ? e.getMeta("y-sync$").isUndoRedoOperation ? { type: "undo-redo" } : { type: "yjs-remote" } : { type: "local" };
|
|
2063
2063
|
}
|
|
2064
2064
|
function Ft(e) {
|
|
2065
|
-
const n = "__root__", t = {}, o = {}, r =
|
|
2065
|
+
const n = "__root__", t = {}, o = {}, r = H(e);
|
|
2066
2066
|
return e.descendants((s, i) => {
|
|
2067
2067
|
if (!xt(s))
|
|
2068
2068
|
return !0;
|
|
@@ -2084,16 +2084,16 @@ function Fr(e, n) {
|
|
|
2084
2084
|
const i = {};
|
|
2085
2085
|
for (let g = 0; g < s.length; g++)
|
|
2086
2086
|
i[s[g]] = g;
|
|
2087
|
-
const a = r.map((g) => i[g]), c = a.length, l = [], d = [], u = new Array(c).fill(-1),
|
|
2087
|
+
const a = r.map((g) => i[g]), c = a.length, l = [], d = [], u = new Array(c).fill(-1), h = (g, b) => {
|
|
2088
2088
|
let k = 0, w = g.length;
|
|
2089
2089
|
for (; k < w; ) {
|
|
2090
|
-
const
|
|
2091
|
-
g[
|
|
2090
|
+
const C = k + w >>> 1;
|
|
2091
|
+
g[C] < b ? k = C + 1 : w = C;
|
|
2092
2092
|
}
|
|
2093
2093
|
return k;
|
|
2094
2094
|
};
|
|
2095
2095
|
for (let g = 0; g < c; g++) {
|
|
2096
|
-
const b = a[g], k =
|
|
2096
|
+
const b = a[g], k = h(l, b);
|
|
2097
2097
|
k > 0 && (u[g] = d[k - 1]), k === l.length ? (l.push(b), d.push(g)) : (l[k] = b, d[k] = g);
|
|
2098
2098
|
}
|
|
2099
2099
|
const f = /* @__PURE__ */ new Set();
|
|
@@ -2150,22 +2150,22 @@ function Nn(e, n = []) {
|
|
|
2150
2150
|
const c = r.childrenByParent, l = s.childrenByParent, d = "__root__", u = /* @__PURE__ */ new Set([
|
|
2151
2151
|
...Object.keys(c),
|
|
2152
2152
|
...Object.keys(l)
|
|
2153
|
-
]),
|
|
2153
|
+
]), h = /* @__PURE__ */ new Set();
|
|
2154
2154
|
return u.forEach((f) => {
|
|
2155
2155
|
const m = Fr(
|
|
2156
2156
|
c[f],
|
|
2157
2157
|
l[f]
|
|
2158
2158
|
);
|
|
2159
2159
|
m.size !== 0 && m.forEach((g) => {
|
|
2160
|
-
var
|
|
2160
|
+
var C, y;
|
|
2161
2161
|
const b = r.byId[g], k = s.byId[g];
|
|
2162
|
-
!b || !k || b.parentId !== k.parentId || a.has(g) || (b.parentId ?? d) !== f ||
|
|
2162
|
+
!b || !k || b.parentId !== k.parentId || a.has(g) || (b.parentId ?? d) !== f || h.has(g) || (h.add(g), i.push({
|
|
2163
2163
|
type: "move",
|
|
2164
2164
|
block: k.block,
|
|
2165
2165
|
prevBlock: b.block,
|
|
2166
2166
|
source: t,
|
|
2167
|
-
prevParent: b.parentId ? (
|
|
2168
|
-
currentParent: k.parentId ? (
|
|
2167
|
+
prevParent: b.parentId ? (C = r.byId[b.parentId]) == null ? void 0 : C.block : void 0,
|
|
2168
|
+
currentParent: k.parentId ? (y = s.byId[k.parentId]) == null ? void 0 : y.block : void 0
|
|
2169
2169
|
}), a.add(g));
|
|
2170
2170
|
});
|
|
2171
2171
|
}), i;
|
|
@@ -2268,7 +2268,7 @@ const Je = (e, n) => {
|
|
|
2268
2268
|
dom: t
|
|
2269
2269
|
};
|
|
2270
2270
|
}, zt = (e) => ({ url: e.src || void 0 }), Gr = '<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>', qr = {
|
|
2271
|
-
backgroundColor:
|
|
2271
|
+
backgroundColor: T.backgroundColor,
|
|
2272
2272
|
// File name.
|
|
2273
2273
|
name: {
|
|
2274
2274
|
default: ""
|
|
@@ -2337,7 +2337,7 @@ const Je = (e, n) => {
|
|
|
2337
2337
|
language: {
|
|
2338
2338
|
default: "text"
|
|
2339
2339
|
}
|
|
2340
|
-
}, es =
|
|
2340
|
+
}, es = q({
|
|
2341
2341
|
name: "codeBlock",
|
|
2342
2342
|
content: "inline*",
|
|
2343
2343
|
group: "blockContent",
|
|
@@ -2409,7 +2409,7 @@ const Je = (e, n) => {
|
|
|
2409
2409
|
addNodeView() {
|
|
2410
2410
|
const e = this.options;
|
|
2411
2411
|
return ({ editor: n, node: t, getPos: o, HTMLAttributes: r }) => {
|
|
2412
|
-
var u,
|
|
2412
|
+
var u, h;
|
|
2413
2413
|
const s = document.createElement("pre"), i = document.createElement("select"), a = document.createElement("div"), { dom: c, contentDOM: l } = $(
|
|
2414
2414
|
this.name,
|
|
2415
2415
|
"code",
|
|
@@ -2417,7 +2417,7 @@ const Je = (e, n) => {
|
|
|
2417
2417
|
...((u = this.options.domAttributes) == null ? void 0 : u.blockContent) || {},
|
|
2418
2418
|
...r
|
|
2419
2419
|
},
|
|
2420
|
-
((
|
|
2420
|
+
((h = this.options.domAttributes) == null ? void 0 : h.inlineContent) || {}
|
|
2421
2421
|
), d = (f) => {
|
|
2422
2422
|
const m = f.target.value;
|
|
2423
2423
|
n.commands.command(({ tr: g }) => (g.setNodeAttribute(o(), "language", m), !0));
|
|
@@ -2477,7 +2477,7 @@ const Je = (e, n) => {
|
|
|
2477
2477
|
this.type
|
|
2478
2478
|
))
|
|
2479
2479
|
return null;
|
|
2480
|
-
n.tr.delete(t.from, t.to).setBlockType(t.from, t.from, this.type, i).setSelection(
|
|
2480
|
+
n.tr.delete(t.from, t.to).setBlockType(t.from, t.from, this.type, i).setSelection(L.create(n.tr.doc, t.from));
|
|
2481
2481
|
}
|
|
2482
2482
|
})
|
|
2483
2483
|
];
|
|
@@ -2578,7 +2578,7 @@ const ns = re.create({
|
|
|
2578
2578
|
return ["span", e, 0];
|
|
2579
2579
|
}
|
|
2580
2580
|
}), ss = ae(rs, "string"), jt = (e) => ({ url: e.src || void 0 }), is = {
|
|
2581
|
-
backgroundColor:
|
|
2581
|
+
backgroundColor: T.backgroundColor,
|
|
2582
2582
|
// File name.
|
|
2583
2583
|
name: {
|
|
2584
2584
|
default: ""
|
|
@@ -2664,11 +2664,11 @@ const ns = re.create({
|
|
|
2664
2664
|
});
|
|
2665
2665
|
};
|
|
2666
2666
|
l.addEventListener("click", u), r.appendChild(s);
|
|
2667
|
-
let
|
|
2667
|
+
let h = e.children.length;
|
|
2668
2668
|
const f = n.onChange(() => {
|
|
2669
2669
|
var g;
|
|
2670
2670
|
const m = ((g = n.getBlock(e)) == null ? void 0 : g.children.length) ?? 0;
|
|
2671
|
-
m >
|
|
2671
|
+
m > h ? (s.getAttribute("data-show-children") === "false" && (s.setAttribute("data-show-children", "true"), o.set(n.getBlock(e), !0)), r.contains(l) && r.removeChild(l)) : m === 0 && m < h && (s.getAttribute("data-show-children") === "true" && (s.setAttribute("data-show-children", "false"), o.set(n.getBlock(e), !1)), r.contains(l) && r.removeChild(l)), h = m;
|
|
2672
2672
|
});
|
|
2673
2673
|
return o.get(e) ? (s.setAttribute("data-show-children", "true"), e.children.length === 0 && r.appendChild(l)) : s.setAttribute("data-show-children", "false"), {
|
|
2674
2674
|
dom: r,
|
|
@@ -2688,10 +2688,10 @@ const ns = re.create({
|
|
|
2688
2688
|
}
|
|
2689
2689
|
};
|
|
2690
2690
|
}, ps = [1, 2, 3, 4, 5, 6], Dn = {
|
|
2691
|
-
...
|
|
2691
|
+
...T,
|
|
2692
2692
|
level: { default: 1, values: ps },
|
|
2693
2693
|
isToggleable: { default: !1 }
|
|
2694
|
-
}, fs =
|
|
2694
|
+
}, fs = q({
|
|
2695
2695
|
name: "heading",
|
|
2696
2696
|
content: "inline*",
|
|
2697
2697
|
group: "blockContent",
|
|
@@ -2703,7 +2703,7 @@ const ns = re.create({
|
|
|
2703
2703
|
...this.options.editor.settings.heading.levels.map((n) => new le({
|
|
2704
2704
|
find: new RegExp(`^(#{${n}})\\s$`),
|
|
2705
2705
|
handler: ({ state: t, chain: o, range: r }) => {
|
|
2706
|
-
const s =
|
|
2706
|
+
const s = S(t);
|
|
2707
2707
|
!s.isBlockContainer || s.blockContent.node.type.spec.content !== "inline*" || o().command(
|
|
2708
2708
|
O(s.bnBlock.beforePos, {
|
|
2709
2709
|
type: "heading",
|
|
@@ -2722,7 +2722,7 @@ const ns = re.create({
|
|
|
2722
2722
|
e.settings.heading.levels.map((n) => [
|
|
2723
2723
|
`Mod-Alt-${n}`,
|
|
2724
2724
|
() => {
|
|
2725
|
-
const t =
|
|
2725
|
+
const t = S(this.editor.state);
|
|
2726
2726
|
return !t.isBlockContainer || t.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
2727
2727
|
O(t.bnBlock.beforePos, {
|
|
2728
2728
|
type: "heading",
|
|
@@ -2799,61 +2799,63 @@ const ns = re.create({
|
|
|
2799
2799
|
r,
|
|
2800
2800
|
s
|
|
2801
2801
|
), c = i;
|
|
2802
|
-
e.props.url && e.props.showPreview && (e.props.previewWidth ? c.style.width = `${e.props.previewWidth}px` : c.style.width = "fit-content");
|
|
2802
|
+
c.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? c.style.width = `${e.props.previewWidth}px` : c.style.width = "fit-content");
|
|
2803
2803
|
const l = document.createElement("div");
|
|
2804
2804
|
l.className = "bn-resize-handle", l.style.left = "4px";
|
|
2805
2805
|
const d = document.createElement("div");
|
|
2806
2806
|
d.className = "bn-resize-handle", d.style.right = "4px";
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2807
|
+
const u = document.createElement("div");
|
|
2808
|
+
u.style.position = "absolute", u.style.height = "100%", u.style.width = "100%";
|
|
2809
|
+
let h, f = e.props.previewWidth;
|
|
2810
|
+
const m = (y) => {
|
|
2811
|
+
var x, v;
|
|
2812
|
+
if (!h) {
|
|
2811
2813
|
!n.isEditable && o.contains(l) && o.contains(d) && (o.removeChild(l), o.removeChild(d));
|
|
2812
2814
|
return;
|
|
2813
2815
|
}
|
|
2814
|
-
let
|
|
2815
|
-
e.props.textAlignment === "center" ?
|
|
2816
|
-
Math.max(
|
|
2817
|
-
((
|
|
2818
|
-
), c.style.width = `${
|
|
2819
|
-
},
|
|
2820
|
-
(!y.target || !c.contains(y.target) || !n.isEditable) && o.contains(l) && o.contains(d) && (o.removeChild(l), o.removeChild(d)),
|
|
2816
|
+
let B;
|
|
2817
|
+
e.props.textAlignment === "center" ? h.handleUsed === "left" ? B = h.initialWidth + (h.initialClientX - y.clientX) * 2 : B = h.initialWidth + (y.clientX - h.initialClientX) * 2 : h.handleUsed === "left" ? B = h.initialWidth + h.initialClientX - y.clientX : B = h.initialWidth + y.clientX - h.initialClientX, f = Math.min(
|
|
2818
|
+
Math.max(B, 64),
|
|
2819
|
+
((v = (x = n.domElement) == null ? void 0 : x.firstElementChild) == null ? void 0 : v.clientWidth) || Number.MAX_VALUE
|
|
2820
|
+
), c.style.width = `${f}px`;
|
|
2821
|
+
}, g = (y) => {
|
|
2822
|
+
(!y.target || !c.contains(y.target) || !n.isEditable) && o.contains(l) && o.contains(d) && (o.removeChild(l), o.removeChild(d)), h && (h = void 0, c.contains(u) && c.removeChild(u), n.updateBlock(e, {
|
|
2821
2823
|
props: {
|
|
2822
|
-
previewWidth:
|
|
2824
|
+
previewWidth: f
|
|
2823
2825
|
}
|
|
2824
2826
|
}));
|
|
2825
|
-
},
|
|
2827
|
+
}, b = () => {
|
|
2826
2828
|
n.isEditable && (o.appendChild(l), o.appendChild(d));
|
|
2827
|
-
}, b = (y) => {
|
|
2828
|
-
y.relatedTarget === l || y.relatedTarget === d || u || n.isEditable && o.contains(l) && o.contains(d) && (o.removeChild(l), o.removeChild(d));
|
|
2829
2829
|
}, k = (y) => {
|
|
2830
|
-
y.
|
|
2830
|
+
y.relatedTarget === l || y.relatedTarget === d || h || n.isEditable && o.contains(l) && o.contains(d) && (o.removeChild(l), o.removeChild(d));
|
|
2831
|
+
}, w = (y) => {
|
|
2832
|
+
y.preventDefault(), c.contains(u) || c.appendChild(u), h = {
|
|
2831
2833
|
handleUsed: "left",
|
|
2832
2834
|
initialWidth: c.clientWidth,
|
|
2833
2835
|
initialClientX: y.clientX
|
|
2834
2836
|
};
|
|
2835
|
-
},
|
|
2836
|
-
y.preventDefault(), u = {
|
|
2837
|
+
}, C = (y) => {
|
|
2838
|
+
y.preventDefault(), c.contains(u) || c.appendChild(u), h = {
|
|
2837
2839
|
handleUsed: "right",
|
|
2838
2840
|
initialWidth: c.clientWidth,
|
|
2839
2841
|
initialClientX: y.clientX
|
|
2840
2842
|
};
|
|
2841
2843
|
};
|
|
2842
|
-
return window.addEventListener("mousemove",
|
|
2844
|
+
return window.addEventListener("mousemove", m), window.addEventListener("mouseup", g), c.addEventListener("mouseenter", b), c.addEventListener("mouseleave", k), l.addEventListener(
|
|
2843
2845
|
"mousedown",
|
|
2844
|
-
|
|
2846
|
+
w
|
|
2845
2847
|
), d.addEventListener(
|
|
2846
2848
|
"mousedown",
|
|
2847
|
-
|
|
2849
|
+
C
|
|
2848
2850
|
), {
|
|
2849
2851
|
dom: c,
|
|
2850
2852
|
destroy: () => {
|
|
2851
|
-
a == null || a(), window.removeEventListener("mousemove",
|
|
2853
|
+
a == null || a(), window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", g), c.removeEventListener("mouseenter", b), c.removeEventListener("mouseleave", k), l.removeEventListener(
|
|
2852
2854
|
"mousedown",
|
|
2853
|
-
|
|
2855
|
+
w
|
|
2854
2856
|
), d.removeEventListener(
|
|
2855
2857
|
"mousedown",
|
|
2856
|
-
|
|
2858
|
+
C
|
|
2857
2859
|
);
|
|
2858
2860
|
}
|
|
2859
2861
|
};
|
|
@@ -2861,8 +2863,8 @@ const ns = re.create({
|
|
|
2861
2863
|
const n = e.src || void 0, t = e.width || void 0, o = e.alt || void 0;
|
|
2862
2864
|
return { url: n, previewWidth: t, name: o };
|
|
2863
2865
|
}, gs = '<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>', bs = {
|
|
2864
|
-
textAlignment:
|
|
2865
|
-
backgroundColor:
|
|
2866
|
+
textAlignment: T.textAlignment,
|
|
2867
|
+
backgroundColor: T.backgroundColor,
|
|
2866
2868
|
// File name.
|
|
2867
2869
|
name: {
|
|
2868
2870
|
default: ""
|
|
@@ -2979,8 +2981,8 @@ const ns = re.create({
|
|
|
2979
2981
|
)
|
|
2980
2982
|
]);
|
|
2981
2983
|
}, Ss = {
|
|
2982
|
-
...
|
|
2983
|
-
}, Es =
|
|
2984
|
+
...T
|
|
2985
|
+
}, Es = q({
|
|
2984
2986
|
name: "toggleListItem",
|
|
2985
2987
|
content: "inline*",
|
|
2986
2988
|
group: "blockContent",
|
|
@@ -2991,7 +2993,7 @@ const ns = re.create({
|
|
|
2991
2993
|
return {
|
|
2992
2994
|
Enter: () => Qe(this.options.editor),
|
|
2993
2995
|
"Mod-Shift-6": () => {
|
|
2994
|
-
const e =
|
|
2996
|
+
const e = S(this.editor.state);
|
|
2995
2997
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
2996
2998
|
O(e.bnBlock.beforePos, {
|
|
2997
2999
|
type: "toggleListItem",
|
|
@@ -3051,7 +3053,7 @@ const ns = re.create({
|
|
|
3051
3053
|
Ss
|
|
3052
3054
|
);
|
|
3053
3055
|
function Tt(e, n, t) {
|
|
3054
|
-
var u,
|
|
3056
|
+
var u, h, f;
|
|
3055
3057
|
const o = Ee.fromSchema(n), r = e, s = document.createElement("div");
|
|
3056
3058
|
s.setAttribute("data-node-type", "blockGroup");
|
|
3057
3059
|
for (const m of Array.from(r.childNodes))
|
|
@@ -3059,7 +3061,7 @@ function Tt(e, n, t) {
|
|
|
3059
3061
|
let i = o.parse(s, {
|
|
3060
3062
|
topNode: n.nodes.blockGroup.create()
|
|
3061
3063
|
});
|
|
3062
|
-
((
|
|
3064
|
+
((h = (u = i.firstChild) == null ? void 0 : u.firstChild) == null ? void 0 : h.type.name) === "checkListItem" && (i = i.copy(
|
|
3063
3065
|
i.content.cut(
|
|
3064
3066
|
i.firstChild.firstChild.nodeSize + 2
|
|
3065
3067
|
)
|
|
@@ -3081,8 +3083,8 @@ function Tt(e, n, t) {
|
|
|
3081
3083
|
return c.content;
|
|
3082
3084
|
}
|
|
3083
3085
|
const xs = {
|
|
3084
|
-
...
|
|
3085
|
-
}, Ms =
|
|
3086
|
+
...T
|
|
3087
|
+
}, Ms = q({
|
|
3086
3088
|
name: "bulletListItem",
|
|
3087
3089
|
content: "inline*",
|
|
3088
3090
|
group: "blockContent",
|
|
@@ -3095,7 +3097,7 @@ const xs = {
|
|
|
3095
3097
|
new le({
|
|
3096
3098
|
find: new RegExp("^[-+*]\\s$"),
|
|
3097
3099
|
handler: ({ state: e, chain: n, range: t }) => {
|
|
3098
|
-
const o =
|
|
3100
|
+
const o = S(e);
|
|
3099
3101
|
!o.isBlockContainer || o.blockContent.node.type.spec.content !== "inline*" || o.blockNoteType === "heading" || n().command(
|
|
3100
3102
|
O(o.bnBlock.beforePos, {
|
|
3101
3103
|
type: "bulletListItem",
|
|
@@ -3110,7 +3112,7 @@ const xs = {
|
|
|
3110
3112
|
return {
|
|
3111
3113
|
Enter: () => Qe(this.options.editor),
|
|
3112
3114
|
"Mod-Shift-8": () => {
|
|
3113
|
-
const e =
|
|
3115
|
+
const e = S(this.editor.state);
|
|
3114
3116
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
3115
3117
|
O(e.bnBlock.beforePos, {
|
|
3116
3118
|
type: "bulletListItem",
|
|
@@ -3163,11 +3165,11 @@ const xs = {
|
|
|
3163
3165
|
Ms,
|
|
3164
3166
|
xs
|
|
3165
3167
|
), Vn = {
|
|
3166
|
-
...
|
|
3168
|
+
...T,
|
|
3167
3169
|
checked: {
|
|
3168
3170
|
default: !1
|
|
3169
3171
|
}
|
|
3170
|
-
}, Ts =
|
|
3172
|
+
}, Ts = q({
|
|
3171
3173
|
name: "checkListItem",
|
|
3172
3174
|
content: "inline*",
|
|
3173
3175
|
group: "blockContent",
|
|
@@ -3180,7 +3182,7 @@ const xs = {
|
|
|
3180
3182
|
new le({
|
|
3181
3183
|
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
3182
3184
|
handler: ({ state: e, chain: n, range: t }) => {
|
|
3183
|
-
const o =
|
|
3185
|
+
const o = S(e);
|
|
3184
3186
|
!o.isBlockContainer || o.blockContent.node.type.spec.content !== "inline*" || n().command(
|
|
3185
3187
|
O(o.bnBlock.beforePos, {
|
|
3186
3188
|
type: "checkListItem",
|
|
@@ -3194,7 +3196,7 @@ const xs = {
|
|
|
3194
3196
|
new le({
|
|
3195
3197
|
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
3196
3198
|
handler: ({ state: e, chain: n, range: t }) => {
|
|
3197
|
-
const o =
|
|
3199
|
+
const o = S(e);
|
|
3198
3200
|
!o.isBlockContainer || o.blockContent.node.type.spec.content !== "inline*" || n().command(
|
|
3199
3201
|
O(o.bnBlock.beforePos, {
|
|
3200
3202
|
type: "checkListItem",
|
|
@@ -3211,7 +3213,7 @@ const xs = {
|
|
|
3211
3213
|
return {
|
|
3212
3214
|
Enter: () => Qe(this.options.editor),
|
|
3213
3215
|
"Mod-Shift-9": () => {
|
|
3214
|
-
const e =
|
|
3216
|
+
const e = S(this.editor.state);
|
|
3215
3217
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
3216
3218
|
O(e.bnBlock.beforePos, {
|
|
3217
3219
|
type: "checkListItem",
|
|
@@ -3293,16 +3295,16 @@ const xs = {
|
|
|
3293
3295
|
return;
|
|
3294
3296
|
}
|
|
3295
3297
|
if (typeof n != "boolean") {
|
|
3296
|
-
const
|
|
3298
|
+
const h = Z(
|
|
3297
3299
|
t.state.doc,
|
|
3298
3300
|
n()
|
|
3299
3301
|
);
|
|
3300
|
-
if (
|
|
3302
|
+
if (h.node.type.name !== "blockContainer")
|
|
3301
3303
|
throw new Error(
|
|
3302
|
-
`Expected blockContainer node, got ${
|
|
3304
|
+
`Expected blockContainer node, got ${h.node.type.name}`
|
|
3303
3305
|
);
|
|
3304
3306
|
this.editor.commands.command(
|
|
3305
|
-
O(
|
|
3307
|
+
O(h.posBeforeNode, {
|
|
3306
3308
|
type: "checkListItem",
|
|
3307
3309
|
props: {
|
|
3308
3310
|
checked: i.checked
|
|
@@ -3337,7 +3339,7 @@ const xs = {
|
|
|
3337
3339
|
}), Is = Q(
|
|
3338
3340
|
Ts,
|
|
3339
3341
|
Vn
|
|
3340
|
-
), Ls = new U("numbered-list-indexing"), As = () => new
|
|
3342
|
+
), Ls = new U("numbered-list-indexing"), As = () => new N({
|
|
3341
3343
|
key: Ls,
|
|
3342
3344
|
appendTransaction: (e, n, t) => {
|
|
3343
3345
|
const o = t.tr;
|
|
@@ -3368,8 +3370,8 @@ const xs = {
|
|
|
3368
3370
|
c = (parseInt(b) + 1).toString();
|
|
3369
3371
|
}
|
|
3370
3372
|
}
|
|
3371
|
-
const u = l.blockContent.node,
|
|
3372
|
-
if (
|
|
3373
|
+
const u = l.blockContent.node, h = u.attrs.index, f = ((a = d == null ? void 0 : d.firstChild) == null ? void 0 : a.type.name) !== "numberedListItem";
|
|
3374
|
+
if (h !== c || u.attrs.start && !f) {
|
|
3373
3375
|
r = !0;
|
|
3374
3376
|
const { start: m, ...g } = u.attrs;
|
|
3375
3377
|
o.setNodeMarkup(l.blockContent.beforePos, void 0, {
|
|
@@ -3384,9 +3386,9 @@ const xs = {
|
|
|
3384
3386
|
}), r ? o : null;
|
|
3385
3387
|
}
|
|
3386
3388
|
}), _n = {
|
|
3387
|
-
...
|
|
3389
|
+
...T,
|
|
3388
3390
|
start: { default: void 0, type: "number" }
|
|
3389
|
-
}, Ns =
|
|
3391
|
+
}, Ns = q({
|
|
3390
3392
|
name: "numberedListItem",
|
|
3391
3393
|
content: "inline*",
|
|
3392
3394
|
group: "blockContent",
|
|
@@ -3411,7 +3413,7 @@ const xs = {
|
|
|
3411
3413
|
new le({
|
|
3412
3414
|
find: new RegExp("^(\\d+)\\.\\s$"),
|
|
3413
3415
|
handler: ({ state: e, chain: n, range: t, match: o }) => {
|
|
3414
|
-
const r =
|
|
3416
|
+
const r = S(e);
|
|
3415
3417
|
if (!r.isBlockContainer || r.blockContent.node.type.spec.content !== "inline*" || r.blockNoteType === "numberedListItem" || r.blockNoteType === "heading")
|
|
3416
3418
|
return;
|
|
3417
3419
|
const s = parseInt(o[1]);
|
|
@@ -3431,7 +3433,7 @@ const xs = {
|
|
|
3431
3433
|
return {
|
|
3432
3434
|
Enter: () => Qe(this.options.editor),
|
|
3433
3435
|
"Mod-Shift-7": () => {
|
|
3434
|
-
const e =
|
|
3436
|
+
const e = S(this.editor.state);
|
|
3435
3437
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
3436
3438
|
O(e.bnBlock.beforePos, {
|
|
3437
3439
|
type: "numberedListItem",
|
|
@@ -3496,15 +3498,15 @@ const xs = {
|
|
|
3496
3498
|
Ns,
|
|
3497
3499
|
_n
|
|
3498
3500
|
), Ds = {
|
|
3499
|
-
...
|
|
3500
|
-
}, Os =
|
|
3501
|
+
...T
|
|
3502
|
+
}, Os = q({
|
|
3501
3503
|
name: "paragraph",
|
|
3502
3504
|
content: "inline*",
|
|
3503
3505
|
group: "blockContent",
|
|
3504
3506
|
addKeyboardShortcuts() {
|
|
3505
3507
|
return {
|
|
3506
3508
|
"Mod-Alt-0": () => {
|
|
3507
|
-
const e =
|
|
3509
|
+
const e = S(this.editor.state);
|
|
3508
3510
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
3509
3511
|
O(e.bnBlock.beforePos, {
|
|
3510
3512
|
type: "paragraph",
|
|
@@ -3548,8 +3550,8 @@ const xs = {
|
|
|
3548
3550
|
Os,
|
|
3549
3551
|
Ds
|
|
3550
3552
|
), Vs = {
|
|
3551
|
-
...
|
|
3552
|
-
}, _s =
|
|
3553
|
+
...T
|
|
3554
|
+
}, _s = q({
|
|
3553
3555
|
name: "quote",
|
|
3554
3556
|
content: "inline*",
|
|
3555
3557
|
group: "blockContent",
|
|
@@ -3559,7 +3561,7 @@ const xs = {
|
|
|
3559
3561
|
new le({
|
|
3560
3562
|
find: new RegExp("^>\\s$"),
|
|
3561
3563
|
handler: ({ state: e, chain: n, range: t }) => {
|
|
3562
|
-
const o =
|
|
3564
|
+
const o = S(e);
|
|
3563
3565
|
!o.isBlockContainer || o.blockContent.node.type.spec.content !== "inline*" || n().command(
|
|
3564
3566
|
O(o.bnBlock.beforePos, {
|
|
3565
3567
|
type: "quote",
|
|
@@ -3573,7 +3575,7 @@ const xs = {
|
|
|
3573
3575
|
addKeyboardShortcuts() {
|
|
3574
3576
|
return {
|
|
3575
3577
|
"Mod-Alt-q": () => {
|
|
3576
|
-
const e =
|
|
3578
|
+
const e = S(this.editor.state);
|
|
3577
3579
|
return !e.isBlockContainer || e.blockContent.node.type.spec.content !== "inline*" ? !0 : this.editor.commands.command(
|
|
3578
3580
|
O(e.bnBlock.beforePos, {
|
|
3579
3581
|
type: "quote"
|
|
@@ -3662,8 +3664,8 @@ const xs = {
|
|
|
3662
3664
|
};
|
|
3663
3665
|
}
|
|
3664
3666
|
}), zs = {
|
|
3665
|
-
textColor:
|
|
3666
|
-
}, Ws =
|
|
3667
|
+
textColor: T.textColor
|
|
3668
|
+
}, Ws = q({
|
|
3667
3669
|
name: "table",
|
|
3668
3670
|
content: "tableRow+",
|
|
3669
3671
|
group: "blockContent",
|
|
@@ -3716,10 +3718,10 @@ const xs = {
|
|
|
3716
3718
|
"bn-block-content",
|
|
3717
3719
|
a.class
|
|
3718
3720
|
), c.setAttribute("data-content-type", "table");
|
|
3719
|
-
for (const [
|
|
3721
|
+
for (const [h, f] of Object.entries(
|
|
3720
3722
|
a
|
|
3721
3723
|
))
|
|
3722
|
-
|
|
3724
|
+
h !== "class" && c.setAttribute(h, f);
|
|
3723
3725
|
const l = this.dom, d = document.createElement("div");
|
|
3724
3726
|
d.className = "tableWrapper-inner", d.appendChild(l.firstChild), l.appendChild(d), c.appendChild(l);
|
|
3725
3727
|
const u = document.createElement("div");
|
|
@@ -3735,7 +3737,7 @@ const xs = {
|
|
|
3735
3737
|
});
|
|
3736
3738
|
};
|
|
3737
3739
|
}
|
|
3738
|
-
}), js =
|
|
3740
|
+
}), js = q({
|
|
3739
3741
|
name: "tableParagraph",
|
|
3740
3742
|
group: "tableContent",
|
|
3741
3743
|
content: "inline*",
|
|
@@ -3753,8 +3755,8 @@ const xs = {
|
|
|
3753
3755
|
}
|
|
3754
3756
|
];
|
|
3755
3757
|
},
|
|
3756
|
-
renderHTML({
|
|
3757
|
-
return ["p",
|
|
3758
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
3759
|
+
return ["p", e, 0];
|
|
3758
3760
|
}
|
|
3759
3761
|
}), Gs = oe.create({
|
|
3760
3762
|
name: "tableRow",
|
|
@@ -3831,8 +3833,8 @@ const qs = Q(
|
|
|
3831
3833
|
const n = e.src || void 0, t = e.width || void 0;
|
|
3832
3834
|
return { url: n, previewWidth: t };
|
|
3833
3835
|
}, Ks = '<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>', Ys = {
|
|
3834
|
-
textAlignment:
|
|
3835
|
-
backgroundColor:
|
|
3836
|
+
textAlignment: T.textAlignment,
|
|
3837
|
+
backgroundColor: T.backgroundColor,
|
|
3836
3838
|
// File name.
|
|
3837
3839
|
name: {
|
|
3838
3840
|
default: ""
|
|
@@ -3956,7 +3958,7 @@ function Qc(e, n) {
|
|
|
3956
3958
|
return n.schema.blockSchema[e.type].isFileBlock && !e.props.url;
|
|
3957
3959
|
}
|
|
3958
3960
|
function si(e, n, t) {
|
|
3959
|
-
return n in t.schema.blockSchema && e in t.schema.blockSchema[n].propSchema && t.schema.blockSchema[n].propSchema[e] ===
|
|
3961
|
+
return n in t.schema.blockSchema && e in t.schema.blockSchema[n].propSchema && t.schema.blockSchema[n].propSchema[e] === T[e];
|
|
3960
3962
|
}
|
|
3961
3963
|
function el(e, n, t) {
|
|
3962
3964
|
return si(e, n.type, t);
|
|
@@ -3982,7 +3984,7 @@ function ii(e) {
|
|
|
3982
3984
|
t = e.schema.blockSchema[n.type].content, e.setTextCursorPosition(n, "end");
|
|
3983
3985
|
}
|
|
3984
3986
|
}
|
|
3985
|
-
function
|
|
3987
|
+
function I(e, n) {
|
|
3986
3988
|
const t = e.getTextCursorPosition().block;
|
|
3987
3989
|
if (t.content === void 0)
|
|
3988
3990
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
@@ -3994,7 +3996,7 @@ function nl(e) {
|
|
|
3994
3996
|
return D("heading", e) && n.push(
|
|
3995
3997
|
{
|
|
3996
3998
|
onItemClick: () => {
|
|
3997
|
-
|
|
3999
|
+
I(e, {
|
|
3998
4000
|
type: "heading",
|
|
3999
4001
|
props: { level: 1 }
|
|
4000
4002
|
});
|
|
@@ -4005,7 +4007,7 @@ function nl(e) {
|
|
|
4005
4007
|
},
|
|
4006
4008
|
{
|
|
4007
4009
|
onItemClick: () => {
|
|
4008
|
-
|
|
4010
|
+
I(e, {
|
|
4009
4011
|
type: "heading",
|
|
4010
4012
|
props: { level: 2 }
|
|
4011
4013
|
});
|
|
@@ -4016,7 +4018,7 @@ function nl(e) {
|
|
|
4016
4018
|
},
|
|
4017
4019
|
{
|
|
4018
4020
|
onItemClick: () => {
|
|
4019
|
-
|
|
4021
|
+
I(e, {
|
|
4020
4022
|
type: "heading",
|
|
4021
4023
|
props: { level: 3 }
|
|
4022
4024
|
});
|
|
@@ -4027,7 +4029,7 @@ function nl(e) {
|
|
|
4027
4029
|
}
|
|
4028
4030
|
), D("quote", e) && n.push({
|
|
4029
4031
|
onItemClick: () => {
|
|
4030
|
-
|
|
4032
|
+
I(e, {
|
|
4031
4033
|
type: "quote"
|
|
4032
4034
|
});
|
|
4033
4035
|
},
|
|
@@ -4035,7 +4037,7 @@ function nl(e) {
|
|
|
4035
4037
|
...e.dictionary.slash_menu.quote
|
|
4036
4038
|
}), D("toggleListItem", e) && n.push({
|
|
4037
4039
|
onItemClick: () => {
|
|
4038
|
-
|
|
4040
|
+
I(e, {
|
|
4039
4041
|
type: "toggleListItem"
|
|
4040
4042
|
});
|
|
4041
4043
|
},
|
|
@@ -4044,7 +4046,7 @@ function nl(e) {
|
|
|
4044
4046
|
...e.dictionary.slash_menu.toggle_list
|
|
4045
4047
|
}), D("numberedListItem", e) && n.push({
|
|
4046
4048
|
onItemClick: () => {
|
|
4047
|
-
|
|
4049
|
+
I(e, {
|
|
4048
4050
|
type: "numberedListItem"
|
|
4049
4051
|
});
|
|
4050
4052
|
},
|
|
@@ -4053,7 +4055,7 @@ function nl(e) {
|
|
|
4053
4055
|
...e.dictionary.slash_menu.numbered_list
|
|
4054
4056
|
}), D("bulletListItem", e) && n.push({
|
|
4055
4057
|
onItemClick: () => {
|
|
4056
|
-
|
|
4058
|
+
I(e, {
|
|
4057
4059
|
type: "bulletListItem"
|
|
4058
4060
|
});
|
|
4059
4061
|
},
|
|
@@ -4062,7 +4064,7 @@ function nl(e) {
|
|
|
4062
4064
|
...e.dictionary.slash_menu.bullet_list
|
|
4063
4065
|
}), D("checkListItem", e) && n.push({
|
|
4064
4066
|
onItemClick: () => {
|
|
4065
|
-
|
|
4067
|
+
I(e, {
|
|
4066
4068
|
type: "checkListItem"
|
|
4067
4069
|
});
|
|
4068
4070
|
},
|
|
@@ -4071,7 +4073,7 @@ function nl(e) {
|
|
|
4071
4073
|
...e.dictionary.slash_menu.check_list
|
|
4072
4074
|
}), D("paragraph", e) && n.push({
|
|
4073
4075
|
onItemClick: () => {
|
|
4074
|
-
|
|
4076
|
+
I(e, {
|
|
4075
4077
|
type: "paragraph"
|
|
4076
4078
|
});
|
|
4077
4079
|
},
|
|
@@ -4080,7 +4082,7 @@ function nl(e) {
|
|
|
4080
4082
|
...e.dictionary.slash_menu.paragraph
|
|
4081
4083
|
}), D("codeBlock", e) && n.push({
|
|
4082
4084
|
onItemClick: () => {
|
|
4083
|
-
|
|
4085
|
+
I(e, {
|
|
4084
4086
|
type: "codeBlock"
|
|
4085
4087
|
});
|
|
4086
4088
|
},
|
|
@@ -4089,7 +4091,7 @@ function nl(e) {
|
|
|
4089
4091
|
...e.dictionary.slash_menu.code_block
|
|
4090
4092
|
}), D("table", e) && n.push({
|
|
4091
4093
|
onItemClick: () => {
|
|
4092
|
-
|
|
4094
|
+
I(e, {
|
|
4093
4095
|
type: "table",
|
|
4094
4096
|
content: {
|
|
4095
4097
|
type: "tableContent",
|
|
@@ -4109,7 +4111,7 @@ function nl(e) {
|
|
|
4109
4111
|
...e.dictionary.slash_menu.table
|
|
4110
4112
|
}), D("image", e) && n.push({
|
|
4111
4113
|
onItemClick: () => {
|
|
4112
|
-
const t =
|
|
4114
|
+
const t = I(e, {
|
|
4113
4115
|
type: "image"
|
|
4114
4116
|
});
|
|
4115
4117
|
e.transact(
|
|
@@ -4122,7 +4124,7 @@ function nl(e) {
|
|
|
4122
4124
|
...e.dictionary.slash_menu.image
|
|
4123
4125
|
}), D("video", e) && n.push({
|
|
4124
4126
|
onItemClick: () => {
|
|
4125
|
-
const t =
|
|
4127
|
+
const t = I(e, {
|
|
4126
4128
|
type: "video"
|
|
4127
4129
|
});
|
|
4128
4130
|
e.transact(
|
|
@@ -4135,7 +4137,7 @@ function nl(e) {
|
|
|
4135
4137
|
...e.dictionary.slash_menu.video
|
|
4136
4138
|
}), D("audio", e) && n.push({
|
|
4137
4139
|
onItemClick: () => {
|
|
4138
|
-
const t =
|
|
4140
|
+
const t = I(e, {
|
|
4139
4141
|
type: "audio"
|
|
4140
4142
|
});
|
|
4141
4143
|
e.transact(
|
|
@@ -4148,7 +4150,7 @@ function nl(e) {
|
|
|
4148
4150
|
...e.dictionary.slash_menu.audio
|
|
4149
4151
|
}), D("file", e) && n.push({
|
|
4150
4152
|
onItemClick: () => {
|
|
4151
|
-
const t =
|
|
4153
|
+
const t = I(e, {
|
|
4152
4154
|
type: "file"
|
|
4153
4155
|
});
|
|
4154
4156
|
e.transact(
|
|
@@ -4162,7 +4164,7 @@ function nl(e) {
|
|
|
4162
4164
|
}), D("heading", e) && (n.push(
|
|
4163
4165
|
{
|
|
4164
4166
|
onItemClick: () => {
|
|
4165
|
-
|
|
4167
|
+
I(e, {
|
|
4166
4168
|
type: "heading",
|
|
4167
4169
|
props: { level: 1, isToggleable: !0 }
|
|
4168
4170
|
});
|
|
@@ -4172,7 +4174,7 @@ function nl(e) {
|
|
|
4172
4174
|
},
|
|
4173
4175
|
{
|
|
4174
4176
|
onItemClick: () => {
|
|
4175
|
-
|
|
4177
|
+
I(e, {
|
|
4176
4178
|
type: "heading",
|
|
4177
4179
|
props: { level: 2, isToggleable: !0 }
|
|
4178
4180
|
});
|
|
@@ -4182,7 +4184,7 @@ function nl(e) {
|
|
|
4182
4184
|
},
|
|
4183
4185
|
{
|
|
4184
4186
|
onItemClick: () => {
|
|
4185
|
-
|
|
4187
|
+
I(e, {
|
|
4186
4188
|
type: "heading",
|
|
4187
4189
|
props: { level: 3, isToggleable: !0 }
|
|
4188
4190
|
});
|
|
@@ -4193,7 +4195,7 @@ function nl(e) {
|
|
|
4193
4195
|
), e.settings.heading.levels.filter((t) => t > 3).forEach((t) => {
|
|
4194
4196
|
n.push({
|
|
4195
4197
|
onItemClick: () => {
|
|
4196
|
-
|
|
4198
|
+
I(e, {
|
|
4197
4199
|
type: "heading",
|
|
4198
4200
|
props: { level: t }
|
|
4199
4201
|
});
|
|
@@ -4226,16 +4228,16 @@ function ot(e) {
|
|
|
4226
4228
|
}
|
|
4227
4229
|
class Ie {
|
|
4228
4230
|
constructor(n) {
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4231
|
+
p(this, "blockSpecs");
|
|
4232
|
+
p(this, "inlineContentSpecs");
|
|
4233
|
+
p(this, "styleSpecs");
|
|
4234
|
+
p(this, "blockSchema");
|
|
4235
|
+
p(this, "inlineContentSchema");
|
|
4236
|
+
p(this, "styleSchema");
|
|
4235
4237
|
// Helper so that you can use typeof schema.BlockNoteEditor
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4238
|
+
p(this, "BlockNoteEditor", "only for types");
|
|
4239
|
+
p(this, "Block", "only for types");
|
|
4240
|
+
p(this, "PartialBlock", "only for types");
|
|
4239
4241
|
this.blockSpecs = ot(n == null ? void 0 : n.blockSpecs) || $n, this.inlineContentSpecs = ot(n == null ? void 0 : n.inlineContentSpecs) || zn, this.styleSpecs = ot(n == null ? void 0 : n.styleSpecs) || Fn, this.blockSchema = bn(this.blockSpecs), this.inlineContentSchema = yn(
|
|
4240
4242
|
this.inlineContentSpecs
|
|
4241
4243
|
), this.styleSchema = vn(this.styleSpecs);
|
|
@@ -4289,7 +4291,7 @@ function sl(e) {
|
|
|
4289
4291
|
return hi(e) && n.push({
|
|
4290
4292
|
...e.dictionary.slash_menu.page_break,
|
|
4291
4293
|
onItemClick: () => {
|
|
4292
|
-
|
|
4294
|
+
I(e, {
|
|
4293
4295
|
type: "pageBreak"
|
|
4294
4296
|
});
|
|
4295
4297
|
},
|
|
@@ -4345,7 +4347,7 @@ function fi(e, n) {
|
|
|
4345
4347
|
throw new Error(
|
|
4346
4348
|
`Could not find block with ID ${n.headBlockId} to update selection`
|
|
4347
4349
|
);
|
|
4348
|
-
o =
|
|
4350
|
+
o = L.create(
|
|
4349
4351
|
e.doc,
|
|
4350
4352
|
t + n.anchorOffset,
|
|
4351
4353
|
i + n.headOffset
|
|
@@ -4442,12 +4444,12 @@ function bi(e, n, t) {
|
|
|
4442
4444
|
),
|
|
4443
4445
|
l ? 3 : 1,
|
|
4444
4446
|
0
|
|
4445
|
-
),
|
|
4447
|
+
), h = s.start, f = s.end;
|
|
4446
4448
|
return e.step(
|
|
4447
4449
|
new st(
|
|
4448
|
-
|
|
4450
|
+
h - (l ? 3 : 1),
|
|
4449
4451
|
f,
|
|
4450
|
-
|
|
4452
|
+
h,
|
|
4451
4453
|
f,
|
|
4452
4454
|
u,
|
|
4453
4455
|
1,
|
|
@@ -4478,12 +4480,12 @@ function yi(e) {
|
|
|
4478
4480
|
});
|
|
4479
4481
|
}
|
|
4480
4482
|
function Ci(e, n) {
|
|
4481
|
-
const t = typeof n == "string" ? n : n.id, o =
|
|
4483
|
+
const t = typeof n == "string" ? n : n.id, o = H(e), r = F(t, e);
|
|
4482
4484
|
if (r)
|
|
4483
4485
|
return E(r.node, o);
|
|
4484
4486
|
}
|
|
4485
4487
|
function vi(e, n) {
|
|
4486
|
-
const t = typeof n == "string" ? n : n.id, o = F(t, e), r =
|
|
4488
|
+
const t = typeof n == "string" ? n : n.id, o = F(t, e), r = H(e);
|
|
4487
4489
|
if (!o)
|
|
4488
4490
|
return;
|
|
4489
4491
|
const i = e.resolve(o.posBeforeNode).nodeBefore;
|
|
@@ -4491,7 +4493,7 @@ function vi(e, n) {
|
|
|
4491
4493
|
return E(i, r);
|
|
4492
4494
|
}
|
|
4493
4495
|
function Si(e, n) {
|
|
4494
|
-
const t = typeof n == "string" ? n : n.id, o = F(t, e), r =
|
|
4496
|
+
const t = typeof n == "string" ? n : n.id, o = F(t, e), r = H(e);
|
|
4495
4497
|
if (!o)
|
|
4496
4498
|
return;
|
|
4497
4499
|
const i = e.resolve(
|
|
@@ -4501,7 +4503,7 @@ function Si(e, n) {
|
|
|
4501
4503
|
return E(i, r);
|
|
4502
4504
|
}
|
|
4503
4505
|
function Ei(e, n) {
|
|
4504
|
-
const t = typeof n == "string" ? n : n.id, o =
|
|
4506
|
+
const t = typeof n == "string" ? n : n.id, o = H(e), r = F(t, e);
|
|
4505
4507
|
if (!r)
|
|
4506
4508
|
return;
|
|
4507
4509
|
const s = e.resolve(r.posBeforeNode), i = s.node(), a = s.node(-1), c = a.type.name !== "doc" ? i.type.name === "blockGroup" ? a : i : void 0;
|
|
@@ -4519,7 +4521,7 @@ function Bi(e, n, t, o = { updateSelection: !0 }) {
|
|
|
4519
4521
|
return i ? e.insertText(c, r, s) : e.replaceWith(r, s, t), o.updateSelection && bo(e, e.steps.length - 1, -1), !0;
|
|
4520
4522
|
}
|
|
4521
4523
|
function xi(e) {
|
|
4522
|
-
const n =
|
|
4524
|
+
const n = H(e);
|
|
4523
4525
|
if (e.selection.empty || "node" in e.selection)
|
|
4524
4526
|
return;
|
|
4525
4527
|
const t = e.doc.resolve(
|
|
@@ -4527,19 +4529,19 @@ function xi(e) {
|
|
|
4527
4529
|
), o = e.doc.resolve(
|
|
4528
4530
|
Z(e.doc, e.selection.to).posBeforeNode
|
|
4529
4531
|
), r = (l, d) => {
|
|
4530
|
-
const u = t.posAtIndex(l, d),
|
|
4531
|
-
if (!
|
|
4532
|
+
const u = t.posAtIndex(l, d), h = e.doc.resolve(u).nodeAfter;
|
|
4533
|
+
if (!h)
|
|
4532
4534
|
throw new Error(
|
|
4533
4535
|
`Error getting selection - node not found at position ${u}`
|
|
4534
4536
|
);
|
|
4535
|
-
return E(
|
|
4537
|
+
return E(h, n);
|
|
4536
4538
|
}, s = [], i = t.sharedDepth(o.pos), a = t.index(i), c = o.index(i);
|
|
4537
4539
|
if (t.depth > i) {
|
|
4538
4540
|
s.push(E(t.nodeAfter, n));
|
|
4539
4541
|
for (let l = t.depth; l > i; l--)
|
|
4540
4542
|
if (t.node(l).type.isInGroup("childContainer")) {
|
|
4541
|
-
const u = t.index(l) + 1,
|
|
4542
|
-
for (let f = u; f <
|
|
4543
|
+
const u = t.index(l) + 1, h = t.node(l).childCount;
|
|
4544
|
+
for (let f = u; f < h; f++)
|
|
4543
4545
|
s.push(r(f, l));
|
|
4544
4546
|
}
|
|
4545
4547
|
} else
|
|
@@ -4555,7 +4557,7 @@ function xi(e) {
|
|
|
4555
4557
|
};
|
|
4556
4558
|
}
|
|
4557
4559
|
function Mi(e, n, t) {
|
|
4558
|
-
const o = typeof n == "string" ? n : n.id, r = typeof t == "string" ? t : t.id, s =
|
|
4560
|
+
const o = typeof n == "string" ? n : n.id, r = typeof t == "string" ? t : t.id, s = H(e), i = Te(s);
|
|
4559
4561
|
if (o === r)
|
|
4560
4562
|
throw new Error(
|
|
4561
4563
|
`Attempting to set selection with the same anchor and head blocks (id ${o})`
|
|
@@ -4566,12 +4568,12 @@ function Mi(e, n, t) {
|
|
|
4566
4568
|
const c = F(r, e.doc);
|
|
4567
4569
|
if (!c)
|
|
4568
4570
|
throw new Error(`Block with ID ${r} not found`);
|
|
4569
|
-
const l = ne(a), d = ne(c), u = i.blockSchema[l.blockNoteType],
|
|
4571
|
+
const l = ne(a), d = ne(c), u = i.blockSchema[l.blockNoteType], h = i.blockSchema[d.blockNoteType];
|
|
4570
4572
|
if (!l.isBlockContainer || u.content === "none")
|
|
4571
4573
|
throw new Error(
|
|
4572
4574
|
`Attempting to set selection anchor in block without content (id ${o})`
|
|
4573
4575
|
);
|
|
4574
|
-
if (!d.isBlockContainer ||
|
|
4576
|
+
if (!d.isBlockContainer || h.content === "none")
|
|
4575
4577
|
throw new Error(
|
|
4576
4578
|
`Attempting to set selection anchor in block without content (id ${r})`
|
|
4577
4579
|
);
|
|
@@ -4581,7 +4583,7 @@ function Mi(e, n, t) {
|
|
|
4581
4583
|
f = l.blockContent.beforePos + g.positionAt(0, 0, l.blockContent.node) + 1 + 2;
|
|
4582
4584
|
} else
|
|
4583
4585
|
f = l.blockContent.beforePos + 1;
|
|
4584
|
-
if (
|
|
4586
|
+
if (h.content === "table") {
|
|
4585
4587
|
const g = $e.get(d.blockContent.node), b = d.blockContent.beforePos + g.positionAt(
|
|
4586
4588
|
g.height - 1,
|
|
4587
4589
|
g.width - 1,
|
|
@@ -4590,10 +4592,10 @@ function Mi(e, n, t) {
|
|
|
4590
4592
|
m = b + k - 2;
|
|
4591
4593
|
} else
|
|
4592
4594
|
m = d.blockContent.afterPos - 1;
|
|
4593
|
-
e.setSelection(
|
|
4595
|
+
e.setSelection(L.create(e.doc, f, m));
|
|
4594
4596
|
}
|
|
4595
4597
|
function Pi(e) {
|
|
4596
|
-
const n =
|
|
4598
|
+
const n = H(e);
|
|
4597
4599
|
let t = e.selection.$from, o = e.selection.$to;
|
|
4598
4600
|
for (; o.parentOffset >= o.parent.nodeSize - 2 && o.depth > 0; )
|
|
4599
4601
|
o = e.doc.resolve(o.pos + 1);
|
|
@@ -4616,7 +4618,7 @@ function Pi(e) {
|
|
|
4616
4618
|
};
|
|
4617
4619
|
}
|
|
4618
4620
|
function Ti(e) {
|
|
4619
|
-
const { bnBlock: n } = qe(e), t =
|
|
4621
|
+
const { bnBlock: n } = qe(e), t = H(e.doc), o = e.doc.resolve(n.beforePos), r = o.nodeBefore, s = e.doc.resolve(n.afterPos).nodeAfter;
|
|
4620
4622
|
let i;
|
|
4621
4623
|
return o.depth > 1 && (i = o.node(), i.type.isInGroup("bnBlock") || (i = o.node(o.depth - 1))), {
|
|
4622
4624
|
block: E(n.node, t),
|
|
@@ -4626,7 +4628,7 @@ function Ti(e) {
|
|
|
4626
4628
|
};
|
|
4627
4629
|
}
|
|
4628
4630
|
function Xn(e, n, t = "start") {
|
|
4629
|
-
const o = typeof n == "string" ? n : n.id, r =
|
|
4631
|
+
const o = typeof n == "string" ? n : n.id, r = H(e.doc), s = Te(r), i = F(o, e.doc);
|
|
4630
4632
|
if (!i)
|
|
4631
4633
|
throw new Error(`Block with ID ${o} not found`);
|
|
4632
4634
|
const a = ne(i), c = s.blockSchema[a.blockNoteType].content;
|
|
@@ -4638,18 +4640,18 @@ function Xn(e, n, t = "start") {
|
|
|
4638
4640
|
}
|
|
4639
4641
|
if (c === "inline")
|
|
4640
4642
|
t === "start" ? e.setSelection(
|
|
4641
|
-
|
|
4643
|
+
L.create(e.doc, l.beforePos + 1)
|
|
4642
4644
|
) : e.setSelection(
|
|
4643
|
-
|
|
4645
|
+
L.create(e.doc, l.afterPos - 1)
|
|
4644
4646
|
);
|
|
4645
4647
|
else if (c === "table")
|
|
4646
4648
|
t === "start" ? e.setSelection(
|
|
4647
|
-
|
|
4649
|
+
L.create(e.doc, l.beforePos + 4)
|
|
4648
4650
|
) : e.setSelection(
|
|
4649
|
-
|
|
4651
|
+
L.create(e.doc, l.afterPos - 4)
|
|
4650
4652
|
);
|
|
4651
4653
|
else
|
|
4652
|
-
throw new
|
|
4654
|
+
throw new G(c);
|
|
4653
4655
|
} else {
|
|
4654
4656
|
const l = t === "start" ? a.childContainer.node.firstChild : a.childContainer.node.lastChild;
|
|
4655
4657
|
Xn(e, l.attrs.id, t);
|
|
@@ -4875,8 +4877,8 @@ async function eo(e, n) {
|
|
|
4875
4877
|
let c = "file";
|
|
4876
4878
|
for (const d of s)
|
|
4877
4879
|
for (const u of d.fileBlockAccept || []) {
|
|
4878
|
-
const
|
|
4879
|
-
if (f && (!
|
|
4880
|
+
const h = u.startsWith("."), f = r[a].getAsFile();
|
|
4881
|
+
if (f && (!h && f.type && $i(r[a].type, u) || h && Ui(
|
|
4880
4882
|
"." + f.name.split(".").pop(),
|
|
4881
4883
|
u
|
|
4882
4884
|
))) {
|
|
@@ -4904,24 +4906,24 @@ async function eo(e, n) {
|
|
|
4904
4906
|
if (!g)
|
|
4905
4907
|
return;
|
|
4906
4908
|
u = n.transact((b) => {
|
|
4907
|
-
var
|
|
4908
|
-
const k = Z(b.doc, g.pos), w = (
|
|
4909
|
+
var y;
|
|
4910
|
+
const k = Z(b.doc, g.pos), w = (y = n.prosemirrorView) == null ? void 0 : y.dom.querySelector(
|
|
4909
4911
|
`[data-id="${k.node.attrs.id}"]`
|
|
4910
|
-
),
|
|
4912
|
+
), C = w == null ? void 0 : w.getBoundingClientRect();
|
|
4911
4913
|
return Jt(
|
|
4912
4914
|
n,
|
|
4913
4915
|
n.getBlock(k.node.attrs.id),
|
|
4914
4916
|
d,
|
|
4915
|
-
|
|
4917
|
+
C && (C.top + C.bottom) / 2 > m.top ? "before" : "after"
|
|
4916
4918
|
);
|
|
4917
4919
|
});
|
|
4918
4920
|
} else
|
|
4919
4921
|
return;
|
|
4920
|
-
const
|
|
4922
|
+
const h = await n.uploadFile(l, u), f = typeof h == "string" ? {
|
|
4921
4923
|
props: {
|
|
4922
|
-
url:
|
|
4924
|
+
url: h
|
|
4923
4925
|
}
|
|
4924
|
-
} : { ...
|
|
4926
|
+
} : { ...h };
|
|
4925
4927
|
n.updateBlock(u, f);
|
|
4926
4928
|
}
|
|
4927
4929
|
}
|
|
@@ -4930,7 +4932,7 @@ const Fi = (e) => _.create({
|
|
|
4930
4932
|
name: "dropFile",
|
|
4931
4933
|
addProseMirrorPlugins() {
|
|
4932
4934
|
return [
|
|
4933
|
-
new
|
|
4935
|
+
new N({
|
|
4934
4936
|
props: {
|
|
4935
4937
|
handleDOMEvents: {
|
|
4936
4938
|
drop(n, t) {
|
|
@@ -5010,7 +5012,7 @@ const sa = (e, n) => _.create({
|
|
|
5010
5012
|
name: "pasteFromClipboard",
|
|
5011
5013
|
addProseMirrorPlugins() {
|
|
5012
5014
|
return [
|
|
5013
|
-
new
|
|
5015
|
+
new N({
|
|
5014
5016
|
props: {
|
|
5015
5017
|
handleDOMEvents: {
|
|
5016
5018
|
paste(t, o) {
|
|
@@ -5039,7 +5041,7 @@ function to(e) {
|
|
|
5039
5041
|
const n = [];
|
|
5040
5042
|
return e.descendants((t) => {
|
|
5041
5043
|
var r, s;
|
|
5042
|
-
const o =
|
|
5044
|
+
const o = H(t);
|
|
5043
5045
|
return t.type.name === "blockContainer" && ((r = t.firstChild) == null ? void 0 : r.type.name) === "blockGroup" ? !0 : t.type.name === "columnList" && t.childCount === 1 ? ((s = t.firstChild) == null || s.forEach((i) => {
|
|
5044
5046
|
n.push(E(i, o));
|
|
5045
5047
|
}), !1) : t.type.isInGroup("bnBlock") ? (n.push(E(t, o)), !1) : !0;
|
|
@@ -5127,7 +5129,7 @@ const Zt = () => {
|
|
|
5127
5129
|
name: "copyToClipboard",
|
|
5128
5130
|
addProseMirrorPlugins() {
|
|
5129
5131
|
return et(), [
|
|
5130
|
-
new
|
|
5132
|
+
new N({
|
|
5131
5133
|
props: {
|
|
5132
5134
|
handleDOMEvents: {
|
|
5133
5135
|
copy(n, t) {
|
|
@@ -5165,9 +5167,9 @@ const Zt = () => {
|
|
|
5165
5167
|
types: ["blockContainer", "tableCell", "tableHeader"],
|
|
5166
5168
|
attributes: {
|
|
5167
5169
|
backgroundColor: {
|
|
5168
|
-
default:
|
|
5169
|
-
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") :
|
|
5170
|
-
renderHTML: (e) => e.backgroundColor ===
|
|
5170
|
+
default: T.backgroundColor.default,
|
|
5171
|
+
parseHTML: (e) => e.hasAttribute("data-background-color") ? e.getAttribute("data-background-color") : T.backgroundColor.default,
|
|
5172
|
+
renderHTML: (e) => e.backgroundColor === T.backgroundColor.default ? {} : {
|
|
5171
5173
|
"data-background-color": e.backgroundColor
|
|
5172
5174
|
}
|
|
5173
5175
|
}
|
|
@@ -5179,7 +5181,7 @@ const Zt = () => {
|
|
|
5179
5181
|
class At {
|
|
5180
5182
|
constructor() {
|
|
5181
5183
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
5182
|
-
|
|
5184
|
+
p(this, "callbacks", {});
|
|
5183
5185
|
}
|
|
5184
5186
|
on(n, t) {
|
|
5185
5187
|
return this.callbacks[n] || (this.callbacks[n] = []), this.callbacks[n].push(t), () => this.off(n, t);
|
|
@@ -5196,11 +5198,11 @@ class At {
|
|
|
5196
5198
|
this.callbacks = {};
|
|
5197
5199
|
}
|
|
5198
5200
|
}
|
|
5199
|
-
class
|
|
5201
|
+
class A extends At {
|
|
5200
5202
|
// eslint-disable-next-line
|
|
5201
5203
|
constructor(...t) {
|
|
5202
5204
|
super();
|
|
5203
|
-
|
|
5205
|
+
p(this, "plugins", []);
|
|
5204
5206
|
}
|
|
5205
5207
|
static key() {
|
|
5206
5208
|
throw new Error("You must implement the key method in your extension");
|
|
@@ -5211,12 +5213,12 @@ class L extends At {
|
|
|
5211
5213
|
get priority() {
|
|
5212
5214
|
}
|
|
5213
5215
|
}
|
|
5214
|
-
class la extends
|
|
5216
|
+
class la extends A {
|
|
5215
5217
|
constructor() {
|
|
5216
5218
|
super();
|
|
5217
|
-
|
|
5219
|
+
p(this, "beforeChangeCallbacks", []);
|
|
5218
5220
|
this.addProsemirrorPlugin(
|
|
5219
|
-
new
|
|
5221
|
+
new N({
|
|
5220
5222
|
filterTransaction: (t) => {
|
|
5221
5223
|
let o;
|
|
5222
5224
|
return this.beforeChangeCallbacks.reduce((r, s) => r === !1 ? r : s({
|
|
@@ -5240,12 +5242,12 @@ class la extends L {
|
|
|
5240
5242
|
};
|
|
5241
5243
|
}
|
|
5242
5244
|
}
|
|
5243
|
-
const me = class me extends
|
|
5245
|
+
const me = class me extends A {
|
|
5244
5246
|
constructor(t) {
|
|
5245
5247
|
super();
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5248
|
+
p(this, "provider");
|
|
5249
|
+
p(this, "recentlyUpdatedCursors");
|
|
5250
|
+
p(this, "renderCursor", (t, o) => {
|
|
5249
5251
|
let r = this.recentlyUpdatedCursors.get(o);
|
|
5250
5252
|
if (!r) {
|
|
5251
5253
|
const s = (this.collaboration.renderCursor ?? me.defaultCursorRender)(t);
|
|
@@ -5270,7 +5272,7 @@ const me = class me extends L {
|
|
|
5270
5272
|
}
|
|
5271
5273
|
return r.element;
|
|
5272
5274
|
});
|
|
5273
|
-
|
|
5275
|
+
p(this, "updateUser", (t) => {
|
|
5274
5276
|
this.provider.awareness.setLocalStateField("user", t);
|
|
5275
5277
|
});
|
|
5276
5278
|
this.collaboration = t, this.provider = t.provider, this.recentlyUpdatedCursors = /* @__PURE__ */ new Map(), this.provider.awareness.setLocalStateField("user", t.user), t.showCursorLabels !== "always" && this.provider.awareness.on(
|
|
@@ -5311,7 +5313,7 @@ const me = class me extends L {
|
|
|
5311
5313
|
return 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2] <= 0.179;
|
|
5312
5314
|
}
|
|
5313
5315
|
};
|
|
5314
|
-
|
|
5316
|
+
p(me, "defaultCursorRender", (t) => {
|
|
5315
5317
|
const o = document.createElement("span");
|
|
5316
5318
|
o.classList.add("bn-collaboration-cursor__base");
|
|
5317
5319
|
const r = document.createElement("span");
|
|
@@ -5326,7 +5328,7 @@ h(me, "defaultCursorRender", (t) => {
|
|
|
5326
5328
|
), s.insertBefore(document.createTextNode(t.name), null), r.insertBefore(s, null), o.insertBefore(document.createTextNode(""), null), o.insertBefore(r, null), o.insertBefore(document.createTextNode(""), null), o;
|
|
5327
5329
|
});
|
|
5328
5330
|
let ze = me;
|
|
5329
|
-
class mt extends
|
|
5331
|
+
class mt extends A {
|
|
5330
5332
|
static key() {
|
|
5331
5333
|
return "ySyncPlugin";
|
|
5332
5334
|
}
|
|
@@ -5337,7 +5339,7 @@ class mt extends L {
|
|
|
5337
5339
|
return 1001;
|
|
5338
5340
|
}
|
|
5339
5341
|
}
|
|
5340
|
-
class gt extends
|
|
5342
|
+
class gt extends A {
|
|
5341
5343
|
static key() {
|
|
5342
5344
|
return "yUndoPlugin";
|
|
5343
5345
|
}
|
|
@@ -5395,9 +5397,9 @@ const oo = re.create({
|
|
|
5395
5397
|
class da extends At {
|
|
5396
5398
|
constructor(t) {
|
|
5397
5399
|
super();
|
|
5398
|
-
|
|
5400
|
+
p(this, "userCache", /* @__PURE__ */ new Map());
|
|
5399
5401
|
// avoid duplicate loads
|
|
5400
|
-
|
|
5402
|
+
p(this, "loadingUsers", /* @__PURE__ */ new Set());
|
|
5401
5403
|
this.resolveUsers = t;
|
|
5402
5404
|
}
|
|
5403
5405
|
/**
|
|
@@ -5460,41 +5462,41 @@ function ha(e, n) {
|
|
|
5460
5462
|
});
|
|
5461
5463
|
}), t;
|
|
5462
5464
|
}
|
|
5463
|
-
class pa extends
|
|
5465
|
+
class pa extends A {
|
|
5464
5466
|
constructor(t, o, r) {
|
|
5465
5467
|
super();
|
|
5466
|
-
|
|
5468
|
+
p(this, "userStore");
|
|
5467
5469
|
/**
|
|
5468
5470
|
* Whether a comment is currently being composed
|
|
5469
5471
|
*/
|
|
5470
|
-
|
|
5472
|
+
p(this, "pendingComment", !1);
|
|
5471
5473
|
/**
|
|
5472
5474
|
* The currently selected thread id
|
|
5473
5475
|
*/
|
|
5474
|
-
|
|
5476
|
+
p(this, "selectedThreadId");
|
|
5475
5477
|
/**
|
|
5476
5478
|
* Store the positions of all threads in the document.
|
|
5477
5479
|
* this can be used later to implement a floating sidebar
|
|
5478
5480
|
*/
|
|
5479
|
-
|
|
5481
|
+
p(this, "threadPositions", /* @__PURE__ */ new Map());
|
|
5480
5482
|
/**
|
|
5481
5483
|
* when a thread is resolved or deleted, we need to update the marks to reflect the new state
|
|
5482
5484
|
*/
|
|
5483
|
-
|
|
5485
|
+
p(this, "updateMarksFromThreads", (t) => {
|
|
5484
5486
|
this.editor.transact((o) => {
|
|
5485
5487
|
o.doc.descendants((r, s) => {
|
|
5486
5488
|
r.marks.forEach((i) => {
|
|
5487
5489
|
if (i.type.name === this.markType) {
|
|
5488
5490
|
const a = i.type, c = i.attrs.threadId, l = t.get(c), d = !!(!l || l.resolved || l.deletedAt);
|
|
5489
5491
|
if (d !== i.attrs.orphan) {
|
|
5490
|
-
const u = Math.max(s, 0),
|
|
5492
|
+
const u = Math.max(s, 0), h = Math.min(
|
|
5491
5493
|
s + r.nodeSize,
|
|
5492
5494
|
o.doc.content.size - 1,
|
|
5493
5495
|
o.doc.content.size - 1
|
|
5494
5496
|
);
|
|
5495
|
-
o.removeMark(u,
|
|
5497
|
+
o.removeMark(u, h, i), o.addMark(
|
|
5496
5498
|
u,
|
|
5497
|
-
|
|
5499
|
+
h,
|
|
5498
5500
|
a.create({
|
|
5499
5501
|
...i.attrs,
|
|
5500
5502
|
orphan: d
|
|
@@ -5515,12 +5517,12 @@ class pa extends L {
|
|
|
5515
5517
|
});
|
|
5516
5518
|
const s = this;
|
|
5517
5519
|
this.addProsemirrorPlugin(
|
|
5518
|
-
new
|
|
5520
|
+
new N({
|
|
5519
5521
|
key: He,
|
|
5520
5522
|
state: {
|
|
5521
5523
|
init() {
|
|
5522
5524
|
return {
|
|
5523
|
-
decorations:
|
|
5525
|
+
decorations: j.empty
|
|
5524
5526
|
};
|
|
5525
5527
|
},
|
|
5526
5528
|
apply(i, a) {
|
|
@@ -5545,14 +5547,14 @@ class pa extends L {
|
|
|
5545
5547
|
);
|
|
5546
5548
|
}
|
|
5547
5549
|
return {
|
|
5548
|
-
decorations:
|
|
5550
|
+
decorations: j.create(i.doc, d)
|
|
5549
5551
|
};
|
|
5550
5552
|
}
|
|
5551
5553
|
},
|
|
5552
5554
|
props: {
|
|
5553
5555
|
decorations(i) {
|
|
5554
5556
|
var a;
|
|
5555
|
-
return ((a = He.getState(i)) == null ? void 0 : a.decorations) ??
|
|
5557
|
+
return ((a = He.getState(i)) == null ? void 0 : a.decorations) ?? j.empty;
|
|
5556
5558
|
},
|
|
5557
5559
|
/**
|
|
5558
5560
|
* Handle click on a thread mark and mark it as selected
|
|
@@ -5566,7 +5568,7 @@ class pa extends L {
|
|
|
5566
5568
|
return;
|
|
5567
5569
|
}
|
|
5568
5570
|
const d = l.marks.find(
|
|
5569
|
-
(
|
|
5571
|
+
(h) => h.type.name === r && h.attrs.orphan !== !0
|
|
5570
5572
|
), u = d == null ? void 0 : d.attrs.threadId;
|
|
5571
5573
|
s.selectThread(u, !1);
|
|
5572
5574
|
}
|
|
@@ -5648,18 +5650,18 @@ class pa extends L {
|
|
|
5648
5650
|
}
|
|
5649
5651
|
class fa {
|
|
5650
5652
|
constructor(n, t, o, r) {
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5653
|
+
p(this, "state");
|
|
5654
|
+
p(this, "emitUpdate");
|
|
5655
|
+
p(this, "mouseDownHandler", () => {
|
|
5654
5656
|
var n;
|
|
5655
5657
|
(n = this.state) != null && n.show && (this.state.show = !1, this.emitUpdate());
|
|
5656
5658
|
});
|
|
5657
5659
|
// For dragging the whole editor.
|
|
5658
|
-
|
|
5660
|
+
p(this, "dragstartHandler", () => {
|
|
5659
5661
|
var n;
|
|
5660
5662
|
(n = this.state) != null && n.show && (this.state.show = !1, this.emitUpdate());
|
|
5661
5663
|
});
|
|
5662
|
-
|
|
5664
|
+
p(this, "scrollHandler", () => {
|
|
5663
5665
|
var n;
|
|
5664
5666
|
if ((n = this.state) != null && n.show) {
|
|
5665
5667
|
const t = this.pmView.root.querySelector(
|
|
@@ -5670,7 +5672,7 @@ class fa {
|
|
|
5670
5672
|
this.state.referencePos = t.getBoundingClientRect(), this.emitUpdate();
|
|
5671
5673
|
}
|
|
5672
5674
|
});
|
|
5673
|
-
|
|
5675
|
+
p(this, "closeMenu", () => {
|
|
5674
5676
|
var n;
|
|
5675
5677
|
(n = this.state) != null && n.show && (this.state.show = !1, this.emitUpdate());
|
|
5676
5678
|
});
|
|
@@ -5706,16 +5708,16 @@ class fa {
|
|
|
5706
5708
|
const rt = new U(
|
|
5707
5709
|
"FilePanelPlugin"
|
|
5708
5710
|
);
|
|
5709
|
-
class ma extends
|
|
5711
|
+
class ma extends A {
|
|
5710
5712
|
constructor(t) {
|
|
5711
5713
|
super();
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
+
p(this, "view");
|
|
5715
|
+
p(this, "closeMenu", () => {
|
|
5714
5716
|
var t;
|
|
5715
5717
|
return (t = this.view) == null ? void 0 : t.closeMenu();
|
|
5716
5718
|
});
|
|
5717
5719
|
this.addProsemirrorPlugin(
|
|
5718
|
-
new
|
|
5720
|
+
new N({
|
|
5719
5721
|
key: rt,
|
|
5720
5722
|
view: (o) => (this.view = new fa(
|
|
5721
5723
|
t,
|
|
@@ -5756,18 +5758,18 @@ class ma extends L {
|
|
|
5756
5758
|
}
|
|
5757
5759
|
class ga {
|
|
5758
5760
|
constructor(n, t, o) {
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5761
|
+
p(this, "state");
|
|
5762
|
+
p(this, "emitUpdate");
|
|
5763
|
+
p(this, "preventHide", !1);
|
|
5764
|
+
p(this, "preventShow", !1);
|
|
5765
|
+
p(this, "shouldShow", ({ view: n, state: t, from: o, to: r }) => {
|
|
5764
5766
|
const { doc: s, selection: i } = t, { empty: a } = i, c = !s.textBetween(o, r).length && hn(t.selection);
|
|
5765
5767
|
if (i.$from.parent.type.spec.code || it(i) && i.node.type.spec.code || a || c)
|
|
5766
5768
|
return !1;
|
|
5767
5769
|
const l = document.activeElement;
|
|
5768
5770
|
return !(!this.isElementWithinEditorWrapper(l) && n.editable);
|
|
5769
5771
|
});
|
|
5770
|
-
|
|
5772
|
+
p(this, "blurHandler", (n) => {
|
|
5771
5773
|
var o;
|
|
5772
5774
|
if (this.preventHide) {
|
|
5773
5775
|
this.preventHide = !1;
|
|
@@ -5780,28 +5782,28 @@ class ga {
|
|
|
5780
5782
|
".bn-ui-container, .bn-ui-container *"
|
|
5781
5783
|
)) || (o = this.state) != null && o.show && (this.state.show = !1, this.emitUpdate());
|
|
5782
5784
|
});
|
|
5783
|
-
|
|
5785
|
+
p(this, "isElementWithinEditorWrapper", (n) => {
|
|
5784
5786
|
if (!n)
|
|
5785
5787
|
return !1;
|
|
5786
5788
|
const t = this.pmView.dom.parentElement;
|
|
5787
5789
|
return t ? t.contains(n) : !1;
|
|
5788
5790
|
});
|
|
5789
|
-
|
|
5791
|
+
p(this, "viewMousedownHandler", (n) => {
|
|
5790
5792
|
(!this.isElementWithinEditorWrapper(n.target) || n.button === 0) && (this.preventShow = !0);
|
|
5791
5793
|
});
|
|
5792
|
-
|
|
5794
|
+
p(this, "mouseupHandler", () => {
|
|
5793
5795
|
this.preventShow && (this.preventShow = !1, setTimeout(() => this.update(this.pmView)));
|
|
5794
5796
|
});
|
|
5795
5797
|
// For dragging the whole editor.
|
|
5796
|
-
|
|
5798
|
+
p(this, "dragHandler", () => {
|
|
5797
5799
|
var n;
|
|
5798
5800
|
(n = this.state) != null && n.show && (this.state.show = !1, this.emitUpdate());
|
|
5799
5801
|
});
|
|
5800
|
-
|
|
5802
|
+
p(this, "scrollHandler", () => {
|
|
5801
5803
|
var n;
|
|
5802
5804
|
(n = this.state) != null && n.show && (this.state.referencePos = this.getSelectionBoundingBox(), this.emitUpdate());
|
|
5803
5805
|
});
|
|
5804
|
-
|
|
5806
|
+
p(this, "closeMenu", () => {
|
|
5805
5807
|
var n;
|
|
5806
5808
|
(n = this.state) != null && n.show && (this.state.show = !1, this.emitUpdate());
|
|
5807
5809
|
});
|
|
@@ -5823,8 +5825,8 @@ class ga {
|
|
|
5823
5825
|
state: o,
|
|
5824
5826
|
from: l,
|
|
5825
5827
|
to: d
|
|
5826
|
-
}),
|
|
5827
|
-
if (!this.preventShow && (u || this.preventHide) && !
|
|
5828
|
+
}), h = typeof Range.prototype.getClientRects > "u";
|
|
5829
|
+
if (!this.preventShow && (u || this.preventHide) && !h) {
|
|
5828
5830
|
const b = this.getSelectionBoundingBox();
|
|
5829
5831
|
if (b.height === 0 && b.width === 0) {
|
|
5830
5832
|
queueMicrotask(() => {
|
|
@@ -5834,7 +5836,7 @@ class ga {
|
|
|
5834
5836
|
};
|
|
5835
5837
|
this.state = w, this.emitUpdate(), n.dispatch(
|
|
5836
5838
|
n.state.tr.setSelection(
|
|
5837
|
-
|
|
5839
|
+
L.create(
|
|
5838
5840
|
n.state.doc,
|
|
5839
5841
|
n.state.selection.from + 1,
|
|
5840
5842
|
n.state.selection.to
|
|
@@ -5842,7 +5844,7 @@ class ga {
|
|
|
5842
5844
|
)
|
|
5843
5845
|
), n.dispatch(
|
|
5844
5846
|
n.state.tr.setSelection(
|
|
5845
|
-
|
|
5847
|
+
L.create(
|
|
5846
5848
|
n.state.doc,
|
|
5847
5849
|
n.state.selection.from - 1,
|
|
5848
5850
|
n.state.selection.to
|
|
@@ -5880,13 +5882,13 @@ class ga {
|
|
|
5880
5882
|
const ba = new U(
|
|
5881
5883
|
"FormattingToolbarPlugin"
|
|
5882
5884
|
);
|
|
5883
|
-
class ka extends
|
|
5885
|
+
class ka extends A {
|
|
5884
5886
|
constructor(t) {
|
|
5885
5887
|
super();
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
+
p(this, "view");
|
|
5889
|
+
p(this, "closeMenu", () => this.view.closeMenu());
|
|
5888
5890
|
this.addProsemirrorPlugin(
|
|
5889
|
-
new
|
|
5891
|
+
new N({
|
|
5890
5892
|
key: ba,
|
|
5891
5893
|
view: (o) => (this.view = new ga(t, o, (r) => {
|
|
5892
5894
|
this.emit("update", r);
|
|
@@ -6006,7 +6008,7 @@ const wa = oe.create({
|
|
|
6006
6008
|
() => r.undoInputRule(),
|
|
6007
6009
|
// Reverts block content type to a paragraph if the selection is at the start of the block.
|
|
6008
6010
|
() => r.command(({ state: s }) => {
|
|
6009
|
-
const i =
|
|
6011
|
+
const i = S(s);
|
|
6010
6012
|
if (!i.isBlockContainer)
|
|
6011
6013
|
return !1;
|
|
6012
6014
|
const a = s.selection.from === i.blockContent.beforePos + 1, c = i.blockContent.node.type.name === "paragraph";
|
|
@@ -6019,7 +6021,7 @@ const wa = oe.create({
|
|
|
6019
6021
|
}),
|
|
6020
6022
|
// Removes a level of nesting if the block is indented if the selection is at the start of the block.
|
|
6021
6023
|
() => r.command(({ state: s }) => {
|
|
6022
|
-
const i =
|
|
6024
|
+
const i = S(s);
|
|
6023
6025
|
if (!i.isBlockContainer)
|
|
6024
6026
|
return !1;
|
|
6025
6027
|
const { blockContent: a } = i;
|
|
@@ -6028,14 +6030,14 @@ const wa = oe.create({
|
|
|
6028
6030
|
// Merges block with the previous one if it isn't indented, and the selection is at the start of the
|
|
6029
6031
|
// block. The target block for merging must contain inline content.
|
|
6030
6032
|
() => r.command(({ state: s }) => {
|
|
6031
|
-
const i =
|
|
6033
|
+
const i = S(s);
|
|
6032
6034
|
if (!i.isBlockContainer)
|
|
6033
6035
|
return !1;
|
|
6034
6036
|
const { bnBlock: a, blockContent: c } = i, l = s.selection.from === c.beforePos + 1, d = s.selection.empty, u = a.beforePos;
|
|
6035
6037
|
return l && d ? o().command(tn(u)).scrollIntoView().run() : !1;
|
|
6036
6038
|
}),
|
|
6037
6039
|
() => r.command(({ state: s, dispatch: i }) => {
|
|
6038
|
-
const a =
|
|
6040
|
+
const a = S(s);
|
|
6039
6041
|
if (!a.isBlockContainer || !(s.selection.from === a.blockContent.beforePos + 1) || _e(
|
|
6040
6042
|
s.doc,
|
|
6041
6043
|
a.bnBlock.beforePos
|
|
@@ -6047,13 +6049,13 @@ const wa = oe.create({
|
|
|
6047
6049
|
);
|
|
6048
6050
|
if ((d == null ? void 0 : d.blockNoteType) !== "column")
|
|
6049
6051
|
return !1;
|
|
6050
|
-
const u = d,
|
|
6052
|
+
const u = d, h = en(
|
|
6051
6053
|
s.doc,
|
|
6052
6054
|
u.bnBlock.beforePos
|
|
6053
6055
|
);
|
|
6054
|
-
if ((
|
|
6056
|
+
if ((h == null ? void 0 : h.blockNoteType) !== "columnList")
|
|
6055
6057
|
throw new Error("parent of column is not a column list");
|
|
6056
|
-
const f = u.childContainer.node.childCount === 1, m = f &&
|
|
6058
|
+
const f = u.childContainer.node.childCount === 1, m = f && h.childContainer.node.childCount === 2, g = h.childContainer.node.firstChild === u.bnBlock.node;
|
|
6057
6059
|
if (i) {
|
|
6058
6060
|
const b = s.doc.slice(
|
|
6059
6061
|
a.bnBlock.beforePos,
|
|
@@ -6065,11 +6067,11 @@ const wa = oe.create({
|
|
|
6065
6067
|
s.tr.step(
|
|
6066
6068
|
new st(
|
|
6067
6069
|
// replace entire column list
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
+
h.bnBlock.beforePos,
|
|
6071
|
+
h.bnBlock.afterPos,
|
|
6070
6072
|
// select content of remaining column:
|
|
6071
6073
|
u.bnBlock.afterPos + 1,
|
|
6072
|
-
|
|
6074
|
+
h.bnBlock.afterPos - 2,
|
|
6073
6075
|
b,
|
|
6074
6076
|
b.size,
|
|
6075
6077
|
// append existing content to blockToMove
|
|
@@ -6077,15 +6079,15 @@ const wa = oe.create({
|
|
|
6077
6079
|
)
|
|
6078
6080
|
);
|
|
6079
6081
|
const k = s.tr.doc.resolve(u.bnBlock.beforePos);
|
|
6080
|
-
s.tr.setSelection(
|
|
6082
|
+
s.tr.setSelection(L.between(k, k));
|
|
6081
6083
|
} else {
|
|
6082
6084
|
s.tr.step(
|
|
6083
6085
|
new st(
|
|
6084
6086
|
// replace entire column list
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
+
h.bnBlock.beforePos,
|
|
6088
|
+
h.bnBlock.afterPos,
|
|
6087
6089
|
// select content of existing column:
|
|
6088
|
-
|
|
6090
|
+
h.bnBlock.beforePos + 2,
|
|
6089
6091
|
u.bnBlock.beforePos - 1,
|
|
6090
6092
|
b,
|
|
6091
6093
|
0,
|
|
@@ -6096,7 +6098,7 @@ const wa = oe.create({
|
|
|
6096
6098
|
const k = s.tr.doc.resolve(
|
|
6097
6099
|
s.tr.mapping.map(u.bnBlock.beforePos - 1)
|
|
6098
6100
|
);
|
|
6099
|
-
s.tr.setSelection(
|
|
6101
|
+
s.tr.setSelection(L.between(k, k));
|
|
6100
6102
|
}
|
|
6101
6103
|
else if (f)
|
|
6102
6104
|
if (g) {
|
|
@@ -6104,13 +6106,13 @@ const wa = oe.create({
|
|
|
6104
6106
|
u.bnBlock.beforePos,
|
|
6105
6107
|
u.bnBlock.afterPos
|
|
6106
6108
|
), s.tr.insert(
|
|
6107
|
-
|
|
6109
|
+
h.bnBlock.beforePos,
|
|
6108
6110
|
b.content
|
|
6109
6111
|
);
|
|
6110
6112
|
const k = s.tr.doc.resolve(
|
|
6111
|
-
|
|
6113
|
+
h.bnBlock.beforePos
|
|
6112
6114
|
);
|
|
6113
|
-
s.tr.setSelection(
|
|
6115
|
+
s.tr.setSelection(L.between(k, k));
|
|
6114
6116
|
} else
|
|
6115
6117
|
s.tr.delete(
|
|
6116
6118
|
u.bnBlock.beforePos - 1,
|
|
@@ -6121,14 +6123,14 @@ const wa = oe.create({
|
|
|
6121
6123
|
a.bnBlock.beforePos,
|
|
6122
6124
|
a.bnBlock.afterPos
|
|
6123
6125
|
), g ? s.tr.insert(
|
|
6124
|
-
|
|
6126
|
+
h.bnBlock.beforePos - 1,
|
|
6125
6127
|
b.content
|
|
6126
6128
|
) : s.tr.insert(
|
|
6127
6129
|
u.bnBlock.beforePos - 1,
|
|
6128
6130
|
b.content
|
|
6129
6131
|
);
|
|
6130
6132
|
const k = s.tr.doc.resolve(u.bnBlock.beforePos - 1);
|
|
6131
|
-
s.tr.setSelection(
|
|
6133
|
+
s.tr.setSelection(L.between(k, k));
|
|
6132
6134
|
}
|
|
6133
6135
|
}
|
|
6134
6136
|
return !0;
|
|
@@ -6136,7 +6138,7 @@ const wa = oe.create({
|
|
|
6136
6138
|
// Deletes the current block if it's an empty block with inline content,
|
|
6137
6139
|
// and moves the selection to the previous block.
|
|
6138
6140
|
() => r.command(({ state: s }) => {
|
|
6139
|
-
const i =
|
|
6141
|
+
const i = S(s);
|
|
6140
6142
|
if (!i.isBlockContainer)
|
|
6141
6143
|
return !1;
|
|
6142
6144
|
if (i.blockContent.node.childCount === 0 && i.blockContent.node.type.spec.content === "inline*") {
|
|
@@ -6172,7 +6174,7 @@ const wa = oe.create({
|
|
|
6172
6174
|
// when the selection is empty and at the start of the block. Moves the
|
|
6173
6175
|
// current block into the deleted block's place.
|
|
6174
6176
|
() => r.command(({ state: s }) => {
|
|
6175
|
-
const i =
|
|
6177
|
+
const i = S(s);
|
|
6176
6178
|
if (!i.isBlockContainer)
|
|
6177
6179
|
throw new Error("todo");
|
|
6178
6180
|
const a = s.selection.from === i.blockContent.beforePos + 1, c = s.selection.empty, l = _e(
|
|
@@ -6207,15 +6209,15 @@ const wa = oe.create({
|
|
|
6207
6209
|
// if one exists, the block has no children, and the selection is at the
|
|
6208
6210
|
// end of the block.
|
|
6209
6211
|
() => o.command(({ state: r }) => {
|
|
6210
|
-
const s =
|
|
6212
|
+
const s = S(r);
|
|
6211
6213
|
if (!s.isBlockContainer)
|
|
6212
6214
|
return !1;
|
|
6213
6215
|
const {
|
|
6214
6216
|
bnBlock: i,
|
|
6215
6217
|
blockContent: a,
|
|
6216
6218
|
childContainer: c
|
|
6217
|
-
} = s, { depth: l } = r.doc.resolve(i.beforePos), d = i.afterPos === r.doc.nodeSize - 3, u = r.selection.from === a.afterPos - 1,
|
|
6218
|
-
if (!d && u &&
|
|
6219
|
+
} = s, { depth: l } = r.doc.resolve(i.beforePos), d = i.afterPos === r.doc.nodeSize - 3, u = r.selection.from === a.afterPos - 1, h = r.selection.empty;
|
|
6220
|
+
if (!d && u && h && !(c !== void 0)) {
|
|
6219
6221
|
let m = l, g = i.afterPos + 1, b = r.doc.resolve(g).depth;
|
|
6220
6222
|
for (; b < m; )
|
|
6221
6223
|
m = b, g += 2, b = r.doc.resolve(g).depth;
|
|
@@ -6227,15 +6229,15 @@ const wa = oe.create({
|
|
|
6227
6229
|
// Removes a level of nesting if the block is empty & indented, while the selection is also empty & at the start
|
|
6228
6230
|
// of the block.
|
|
6229
6231
|
() => r.command(({ state: i }) => {
|
|
6230
|
-
const a =
|
|
6232
|
+
const a = S(i);
|
|
6231
6233
|
if (!a.isBlockContainer)
|
|
6232
6234
|
return !1;
|
|
6233
|
-
const { bnBlock: c, blockContent: l } = a, { depth: d } = i.doc.resolve(c.beforePos), u = i.selection.$anchor.parentOffset === 0,
|
|
6234
|
-
return u &&
|
|
6235
|
+
const { bnBlock: c, blockContent: l } = a, { depth: d } = i.doc.resolve(c.beforePos), u = i.selection.$anchor.parentOffset === 0, h = i.selection.anchor === i.selection.head, f = l.node.childCount === 0, m = d > 1;
|
|
6236
|
+
return u && h && f && m ? r.liftListItem("blockContainer") : !1;
|
|
6235
6237
|
}),
|
|
6236
6238
|
// Creates a hard break if block is configured to do so.
|
|
6237
6239
|
() => r.command(({ state: i }) => {
|
|
6238
|
-
const a =
|
|
6240
|
+
const a = S(i), c = this.options.editor.schema.blockSchema[a.blockNoteType].hardBreakShortcut ?? "shift+enter";
|
|
6239
6241
|
if (c === "none")
|
|
6240
6242
|
return !1;
|
|
6241
6243
|
if (
|
|
@@ -6260,16 +6262,16 @@ const wa = oe.create({
|
|
|
6260
6262
|
// Creates a new block and moves the selection to it if the current one is empty, while the selection is also
|
|
6261
6263
|
// empty & at the start of the block.
|
|
6262
6264
|
() => r.command(({ state: i, dispatch: a }) => {
|
|
6263
|
-
const c =
|
|
6265
|
+
const c = S(i);
|
|
6264
6266
|
if (!c.isBlockContainer)
|
|
6265
6267
|
return !1;
|
|
6266
|
-
const { bnBlock: l, blockContent: d } = c, u = i.selection.$anchor.parentOffset === 0,
|
|
6267
|
-
if (u &&
|
|
6268
|
+
const { bnBlock: l, blockContent: d } = c, u = i.selection.$anchor.parentOffset === 0, h = i.selection.anchor === i.selection.head, f = d.node.childCount === 0;
|
|
6269
|
+
if (u && h && f) {
|
|
6268
6270
|
const m = l.afterPos, g = m + 2;
|
|
6269
6271
|
if (a) {
|
|
6270
6272
|
const b = i.schema.nodes.blockContainer.createAndFill();
|
|
6271
6273
|
i.tr.insert(m, b).scrollIntoView(), i.tr.setSelection(
|
|
6272
|
-
new
|
|
6274
|
+
new L(i.doc.resolve(g))
|
|
6273
6275
|
);
|
|
6274
6276
|
}
|
|
6275
6277
|
return !0;
|
|
@@ -6279,7 +6281,7 @@ const wa = oe.create({
|
|
|
6279
6281
|
// Splits the current block, moving content inside that's after the cursor to a new text block below. Also
|
|
6280
6282
|
// deletes the selection beforehand, if it's not empty.
|
|
6281
6283
|
() => r.command(({ state: i, chain: a }) => {
|
|
6282
|
-
const c =
|
|
6284
|
+
const c = S(i);
|
|
6283
6285
|
if (!c.isBlockContainer)
|
|
6284
6286
|
return !1;
|
|
6285
6287
|
const { blockContent: l } = c, d = i.selection.$anchor.parentOffset === 0;
|
|
@@ -6317,18 +6319,18 @@ const wa = oe.create({
|
|
|
6317
6319
|
});
|
|
6318
6320
|
class Sa {
|
|
6319
6321
|
constructor(n, t, o) {
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6322
|
+
p(this, "state");
|
|
6323
|
+
p(this, "emitUpdate");
|
|
6324
|
+
p(this, "menuUpdateTimer");
|
|
6325
|
+
p(this, "startMenuUpdateTimer");
|
|
6326
|
+
p(this, "stopMenuUpdateTimer");
|
|
6327
|
+
p(this, "mouseHoveredLinkMark");
|
|
6328
|
+
p(this, "mouseHoveredLinkMarkRange");
|
|
6329
|
+
p(this, "keyboardHoveredLinkMark");
|
|
6330
|
+
p(this, "keyboardHoveredLinkMarkRange");
|
|
6331
|
+
p(this, "linkMark");
|
|
6332
|
+
p(this, "linkMarkRange");
|
|
6333
|
+
p(this, "mouseOverHandler", (n) => {
|
|
6332
6334
|
if (this.mouseHoveredLinkMark = void 0, this.mouseHoveredLinkMarkRange = void 0, this.stopMenuUpdateTimer(), n.target instanceof HTMLAnchorElement && n.target.nodeName === "A") {
|
|
6333
6335
|
const t = n.target, o = this.pmView.posAtDOM(t, 0) + 1, r = this.pmView.state.doc.resolve(o), s = r.marks();
|
|
6334
6336
|
for (const i of s)
|
|
@@ -6339,7 +6341,7 @@ class Sa {
|
|
|
6339
6341
|
}
|
|
6340
6342
|
return this.startMenuUpdateTimer(), !1;
|
|
6341
6343
|
});
|
|
6342
|
-
|
|
6344
|
+
p(this, "clickHandler", (n) => {
|
|
6343
6345
|
var o;
|
|
6344
6346
|
const t = this.pmView.dom.parentElement;
|
|
6345
6347
|
// Toolbar is open.
|
|
@@ -6347,7 +6349,7 @@ class Sa {
|
|
|
6347
6349
|
n && n.target && // The clicked element is not the editor.
|
|
6348
6350
|
!(t === n.target || t.contains(n.target)) && (o = this.state) != null && o.show && (this.state.show = !1, this.emitUpdate());
|
|
6349
6351
|
});
|
|
6350
|
-
|
|
6352
|
+
p(this, "scrollHandler", () => {
|
|
6351
6353
|
var n;
|
|
6352
6354
|
this.linkMark !== void 0 && (n = this.state) != null && n.show && (this.state.referencePos = Ue(
|
|
6353
6355
|
this.pmView,
|
|
@@ -6355,7 +6357,7 @@ class Sa {
|
|
|
6355
6357
|
this.linkMarkRange.to
|
|
6356
6358
|
), this.emitUpdate());
|
|
6357
6359
|
});
|
|
6358
|
-
|
|
6360
|
+
p(this, "closeMenu", () => {
|
|
6359
6361
|
var n;
|
|
6360
6362
|
(n = this.state) != null && n.show && (this.state.show = !1, this.emitUpdate());
|
|
6361
6363
|
});
|
|
@@ -6376,7 +6378,7 @@ class Sa {
|
|
|
6376
6378
|
editLink(n, t) {
|
|
6377
6379
|
var o;
|
|
6378
6380
|
this.editor.transact((r) => {
|
|
6379
|
-
const s =
|
|
6381
|
+
const s = H(r);
|
|
6380
6382
|
r.insertText(t, this.linkMarkRange.from, this.linkMarkRange.to), r.addMark(
|
|
6381
6383
|
this.linkMarkRange.from,
|
|
6382
6384
|
this.linkMarkRange.from + t.length,
|
|
@@ -6442,20 +6444,20 @@ class Sa {
|
|
|
6442
6444
|
}
|
|
6443
6445
|
}
|
|
6444
6446
|
const Ea = new U("LinkToolbarPlugin");
|
|
6445
|
-
class Ba extends
|
|
6447
|
+
class Ba extends A {
|
|
6446
6448
|
constructor(t) {
|
|
6447
6449
|
super();
|
|
6448
|
-
|
|
6450
|
+
p(this, "view");
|
|
6449
6451
|
/**
|
|
6450
6452
|
* Edit the currently hovered link.
|
|
6451
6453
|
*/
|
|
6452
|
-
|
|
6454
|
+
p(this, "editLink", (t, o) => {
|
|
6453
6455
|
this.view.editLink(t, o);
|
|
6454
6456
|
});
|
|
6455
6457
|
/**
|
|
6456
6458
|
* Delete the currently hovered link.
|
|
6457
6459
|
*/
|
|
6458
|
-
|
|
6460
|
+
p(this, "deleteLink", () => {
|
|
6459
6461
|
this.view.deleteLink();
|
|
6460
6462
|
});
|
|
6461
6463
|
/**
|
|
@@ -6465,7 +6467,7 @@ class Ba extends L {
|
|
|
6465
6467
|
* This function starts the delay timer, and should be used for when the mouse
|
|
6466
6468
|
* cursor enters the link toolbar.
|
|
6467
6469
|
*/
|
|
6468
|
-
|
|
6470
|
+
p(this, "startHideTimer", () => {
|
|
6469
6471
|
this.view.startMenuUpdateTimer();
|
|
6470
6472
|
});
|
|
6471
6473
|
/**
|
|
@@ -6475,12 +6477,12 @@ class Ba extends L {
|
|
|
6475
6477
|
* This function stops the delay timer, and should be used for when the mouse
|
|
6476
6478
|
* cursor exits the link toolbar.
|
|
6477
6479
|
*/
|
|
6478
|
-
|
|
6480
|
+
p(this, "stopHideTimer", () => {
|
|
6479
6481
|
this.view.stopMenuUpdateTimer();
|
|
6480
6482
|
});
|
|
6481
|
-
|
|
6483
|
+
p(this, "closeMenu", () => this.view.closeMenu());
|
|
6482
6484
|
this.addProsemirrorPlugin(
|
|
6483
|
-
new
|
|
6485
|
+
new N({
|
|
6484
6486
|
key: Ea,
|
|
6485
6487
|
view: (o) => (this.view = new Sa(t, o, (r) => {
|
|
6486
6488
|
this.emit("update", r);
|
|
@@ -6514,13 +6516,13 @@ const xa = [
|
|
|
6514
6516
|
"cid",
|
|
6515
6517
|
"xmpp"
|
|
6516
6518
|
], Ma = "https", Pa = new U("node-selection-keyboard");
|
|
6517
|
-
class Ta extends
|
|
6519
|
+
class Ta extends A {
|
|
6518
6520
|
static key() {
|
|
6519
6521
|
return "nodeSelectionKeyboard";
|
|
6520
6522
|
}
|
|
6521
6523
|
constructor() {
|
|
6522
6524
|
super(), this.addProsemirrorPlugin(
|
|
6523
|
-
new
|
|
6525
|
+
new N({
|
|
6524
6526
|
key: Pa,
|
|
6525
6527
|
props: {
|
|
6526
6528
|
handleKeyDown: (n, t) => {
|
|
@@ -6536,7 +6538,7 @@ class Ta extends L {
|
|
|
6536
6538
|
n.state.tr.selection.$to.after(),
|
|
6537
6539
|
n.state.schema.nodes.paragraph.createChecked()
|
|
6538
6540
|
).setSelection(
|
|
6539
|
-
new
|
|
6541
|
+
new L(
|
|
6540
6542
|
o.doc.resolve(n.state.tr.selection.$to.after() + 1)
|
|
6541
6543
|
)
|
|
6542
6544
|
)
|
|
@@ -6551,13 +6553,13 @@ class Ta extends L {
|
|
|
6551
6553
|
}
|
|
6552
6554
|
}
|
|
6553
6555
|
const Ia = new U("blocknote-placeholder");
|
|
6554
|
-
class La extends
|
|
6556
|
+
class La extends A {
|
|
6555
6557
|
static key() {
|
|
6556
6558
|
return "placeholder";
|
|
6557
6559
|
}
|
|
6558
6560
|
constructor(n, t) {
|
|
6559
6561
|
super(), this.addProsemirrorPlugin(
|
|
6560
|
-
new
|
|
6562
|
+
new N({
|
|
6561
6563
|
key: Ia,
|
|
6562
6564
|
view: (o) => {
|
|
6563
6565
|
var l, d;
|
|
@@ -6569,7 +6571,7 @@ class La extends L {
|
|
|
6569
6571
|
try {
|
|
6570
6572
|
const {
|
|
6571
6573
|
default: u,
|
|
6572
|
-
emptyDocument:
|
|
6574
|
+
emptyDocument: h,
|
|
6573
6575
|
...f
|
|
6574
6576
|
} = t;
|
|
6575
6577
|
for (const [b, k] of Object.entries(f)) {
|
|
@@ -6583,7 +6585,7 @@ class La extends L {
|
|
|
6583
6585
|
const m = "[data-is-only-empty-block]", g = "[data-is-empty-and-focused]";
|
|
6584
6586
|
a.insertRule(
|
|
6585
6587
|
`${c(m)} { content: ${JSON.stringify(
|
|
6586
|
-
|
|
6588
|
+
h
|
|
6587
6589
|
)}; }`
|
|
6588
6590
|
), a.insertRule(
|
|
6589
6591
|
`${c(g)} { content: ${JSON.stringify(
|
|
@@ -6598,8 +6600,8 @@ class La extends L {
|
|
|
6598
6600
|
}
|
|
6599
6601
|
return {
|
|
6600
6602
|
destroy: () => {
|
|
6601
|
-
var u,
|
|
6602
|
-
((u = n.prosemirrorView) == null ? void 0 : u.root) instanceof ShadowRoot ? n.prosemirrorView.root.removeChild(s) : (
|
|
6603
|
+
var u, h;
|
|
6604
|
+
((u = n.prosemirrorView) == null ? void 0 : u.root) instanceof ShadowRoot ? n.prosemirrorView.root.removeChild(s) : (h = n.prosemirrorView) == null || h.root.head.removeChild(s);
|
|
6603
6605
|
}
|
|
6604
6606
|
};
|
|
6605
6607
|
},
|
|
@@ -6623,7 +6625,7 @@ class La extends L {
|
|
|
6623
6625
|
})
|
|
6624
6626
|
);
|
|
6625
6627
|
}
|
|
6626
|
-
return
|
|
6628
|
+
return j.create(r, i);
|
|
6627
6629
|
}
|
|
6628
6630
|
}
|
|
6629
6631
|
})
|
|
@@ -6640,7 +6642,7 @@ const nn = new U("previous-blocks"), Aa = {
|
|
|
6640
6642
|
depth: "depth",
|
|
6641
6643
|
"depth-change": "depth-change"
|
|
6642
6644
|
};
|
|
6643
|
-
class Na extends
|
|
6645
|
+
class Na extends A {
|
|
6644
6646
|
static key() {
|
|
6645
6647
|
return "previousBlockType";
|
|
6646
6648
|
}
|
|
@@ -6648,7 +6650,7 @@ class Na extends L {
|
|
|
6648
6650
|
super();
|
|
6649
6651
|
let n;
|
|
6650
6652
|
this.addProsemirrorPlugin(
|
|
6651
|
-
new
|
|
6653
|
+
new N({
|
|
6652
6654
|
key: nn,
|
|
6653
6655
|
view(t) {
|
|
6654
6656
|
return {
|
|
@@ -6689,8 +6691,8 @@ class Na extends L {
|
|
|
6689
6691
|
(d) => d.attrs.id
|
|
6690
6692
|
);
|
|
6691
6693
|
for (const d of l) {
|
|
6692
|
-
const u = c.get(d.node.attrs.id),
|
|
6693
|
-
if (u &&
|
|
6694
|
+
const u = c.get(d.node.attrs.id), h = u == null ? void 0 : u.node.firstChild, f = d.node.firstChild;
|
|
6695
|
+
if (u && h && f) {
|
|
6694
6696
|
const m = {
|
|
6695
6697
|
index: f.attrs.index,
|
|
6696
6698
|
level: f.attrs.level,
|
|
@@ -6698,9 +6700,9 @@ class Na extends L {
|
|
|
6698
6700
|
depth: s.doc.resolve(d.pos).depth
|
|
6699
6701
|
};
|
|
6700
6702
|
let g = {
|
|
6701
|
-
index:
|
|
6702
|
-
level:
|
|
6703
|
-
type:
|
|
6703
|
+
index: h.attrs.index,
|
|
6704
|
+
level: h.attrs.level,
|
|
6705
|
+
type: h.type.name,
|
|
6704
6706
|
depth: r.doc.resolve(u.pos).depth
|
|
6705
6707
|
};
|
|
6706
6708
|
i[d.node.attrs.id] = g, t.getMeta("numberedListIndexing") && (d.node.attrs.id in o.prevTransactionOldBlockAttrs && (g = o.prevTransactionOldBlockAttrs[d.node.attrs.id]), m.type === "numberedListItem" && (g.index = m.index)), o.currentTransactionOldBlockAttrs[d.node.attrs.id] = g, JSON.stringify(g) !== JSON.stringify(m) && (g["depth-change"] = g.depth - m.depth, o.updatedBlocks.add(d.node.attrs.id));
|
|
@@ -6725,7 +6727,7 @@ class Na extends L {
|
|
|
6725
6727
|
...c
|
|
6726
6728
|
});
|
|
6727
6729
|
r.push(l);
|
|
6728
|
-
}),
|
|
6730
|
+
}), j.create(t.doc, r);
|
|
6729
6731
|
}
|
|
6730
6732
|
}
|
|
6731
6733
|
})
|
|
@@ -6733,22 +6735,22 @@ class Na extends L {
|
|
|
6733
6735
|
}
|
|
6734
6736
|
}
|
|
6735
6737
|
const on = new U("blocknote-show-selection");
|
|
6736
|
-
class Ha extends
|
|
6738
|
+
class Ha extends A {
|
|
6737
6739
|
constructor(t) {
|
|
6738
6740
|
super();
|
|
6739
|
-
|
|
6741
|
+
p(this, "enabled", !1);
|
|
6740
6742
|
this.editor = t, this.addProsemirrorPlugin(
|
|
6741
|
-
new
|
|
6743
|
+
new N({
|
|
6742
6744
|
key: on,
|
|
6743
6745
|
props: {
|
|
6744
6746
|
decorations: (o) => {
|
|
6745
6747
|
const { doc: r, selection: s } = o;
|
|
6746
6748
|
if (!this.enabled)
|
|
6747
|
-
return
|
|
6749
|
+
return j.empty;
|
|
6748
6750
|
const i = J.inline(s.from, s.to, {
|
|
6749
6751
|
"data-show-selection": "true"
|
|
6750
6752
|
});
|
|
6751
|
-
return
|
|
6753
|
+
return j.create(r, [i]);
|
|
6752
6754
|
}
|
|
6753
6755
|
}
|
|
6754
6756
|
})
|
|
@@ -6774,7 +6776,7 @@ function so(e, n) {
|
|
|
6774
6776
|
class ce extends Ve {
|
|
6775
6777
|
constructor(t, o) {
|
|
6776
6778
|
super(t, o);
|
|
6777
|
-
|
|
6779
|
+
p(this, "nodes");
|
|
6778
6780
|
const r = t.node();
|
|
6779
6781
|
this.nodes = [], t.doc.nodesBetween(t.pos, o.pos, (s, i, a) => {
|
|
6780
6782
|
if (a !== null && a.eq(r))
|
|
@@ -6807,7 +6809,7 @@ class ce extends Ve {
|
|
|
6807
6809
|
}
|
|
6808
6810
|
}
|
|
6809
6811
|
Ve.jsonID("multiple-node", ce);
|
|
6810
|
-
let
|
|
6812
|
+
let W;
|
|
6811
6813
|
function Da(e, n) {
|
|
6812
6814
|
let t, o;
|
|
6813
6815
|
const r = n.resolve(e.from).node().type.spec.group === "blockContent", s = n.resolve(e.to).node().type.spec.group === "blockContent", i = Math.min(e.$anchor.depth, e.$head.depth);
|
|
@@ -6820,7 +6822,7 @@ function Da(e, n) {
|
|
|
6820
6822
|
}
|
|
6821
6823
|
function rn(e, n, t = n) {
|
|
6822
6824
|
n === t && (t += e.state.doc.resolve(n + 1).node().nodeSize);
|
|
6823
|
-
const o = e.domAtPos(n).node.cloneNode(!0), r = e.domAtPos(n).node, s = (u,
|
|
6825
|
+
const o = e.domAtPos(n).node.cloneNode(!0), r = e.domAtPos(n).node, s = (u, h) => Array.prototype.indexOf.call(u.children, h), i = s(
|
|
6824
6826
|
r,
|
|
6825
6827
|
// Expects from position to be just before the first selected block.
|
|
6826
6828
|
e.domAtPos(n + 1).node.parentElement
|
|
@@ -6831,19 +6833,19 @@ function rn(e, n, t = n) {
|
|
|
6831
6833
|
);
|
|
6832
6834
|
for (let u = r.childElementCount - 1; u >= 0; u--)
|
|
6833
6835
|
(u > a || u < i) && o.removeChild(o.children[u]);
|
|
6834
|
-
io(e.root),
|
|
6835
|
-
const c =
|
|
6836
|
+
io(e.root), W = o;
|
|
6837
|
+
const c = W.getElementsByTagName("iframe");
|
|
6836
6838
|
for (let u = 0; u < c.length; u++) {
|
|
6837
|
-
const
|
|
6838
|
-
f && f.removeChild(
|
|
6839
|
+
const h = c[u], f = h.parentElement;
|
|
6840
|
+
f && f.removeChild(h);
|
|
6839
6841
|
}
|
|
6840
6842
|
const d = e.dom.className.split(" ").filter(
|
|
6841
6843
|
(u) => u !== "ProseMirror" && u !== "bn-root" && u !== "bn-editor"
|
|
6842
6844
|
).join(" ");
|
|
6843
|
-
|
|
6845
|
+
W.className = W.className + " bn-drag-preview " + d, e.root instanceof ShadowRoot ? e.root.appendChild(W) : e.root.body.appendChild(W);
|
|
6844
6846
|
}
|
|
6845
6847
|
function io(e) {
|
|
6846
|
-
|
|
6848
|
+
W !== void 0 && (e instanceof ShadowRoot ? e.removeChild(W) : e.body.removeChild(W), W = void 0);
|
|
6847
6849
|
}
|
|
6848
6850
|
function Oa(e, n, t) {
|
|
6849
6851
|
if (!e.dataTransfer)
|
|
@@ -6862,8 +6864,8 @@ function Oa(e, n, t) {
|
|
|
6862
6864
|
), rn(o, c, l)) : (o.dispatch(
|
|
6863
6865
|
o.state.tr.setSelection(be.create(o.state.doc, s))
|
|
6864
6866
|
), rn(o, s));
|
|
6865
|
-
const
|
|
6866
|
-
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", m), e.dataTransfer.setData("text/html", k), e.dataTransfer.setData("text/plain", w), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(
|
|
6867
|
+
const h = o.state.selection.content(), f = t.pmSchema, m = o.serializeForClipboard(h).dom.innerHTML, g = Xe(f, t), b = to(h.content), k = g.exportBlocks(b, {}), w = It(k);
|
|
6868
|
+
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", m), e.dataTransfer.setData("text/html", k), e.dataTransfer.setData("text/plain", w), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(W, 0, 0);
|
|
6867
6869
|
}
|
|
6868
6870
|
}
|
|
6869
6871
|
const sn = 250;
|
|
@@ -6907,16 +6909,16 @@ function Ra(e, n) {
|
|
|
6907
6909
|
}
|
|
6908
6910
|
class Va {
|
|
6909
6911
|
constructor(n, t, o) {
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6912
|
+
p(this, "state");
|
|
6913
|
+
p(this, "emitUpdate");
|
|
6914
|
+
p(this, "mousePos");
|
|
6915
|
+
p(this, "hoveredBlock");
|
|
6916
|
+
p(this, "menuFrozen", !1);
|
|
6917
|
+
p(this, "isDragOrigin", !1);
|
|
6918
|
+
p(this, "updateState", (n) => {
|
|
6917
6919
|
this.state = n, this.emitUpdate(this.state);
|
|
6918
6920
|
});
|
|
6919
|
-
|
|
6921
|
+
p(this, "updateStateFromMousePos", () => {
|
|
6920
6922
|
var o, r, s, i, a;
|
|
6921
6923
|
if (this.menuFrozen || !this.mousePos)
|
|
6922
6924
|
return;
|
|
@@ -6973,7 +6975,7 @@ class Va {
|
|
|
6973
6975
|
* could then drag between editors in different windows, but you can only
|
|
6974
6976
|
* access `dataTransfer` contents on `dragstart` and `drop` events.
|
|
6975
6977
|
*/
|
|
6976
|
-
|
|
6978
|
+
p(this, "onDragStart", (n) => {
|
|
6977
6979
|
var i;
|
|
6978
6980
|
const t = (i = n.dataTransfer) == null ? void 0 : i.getData("blocknote/html");
|
|
6979
6981
|
if (!t || this.pmView.dragging)
|
|
@@ -6991,7 +6993,7 @@ class Va {
|
|
|
6991
6993
|
/**
|
|
6992
6994
|
* Finds the closest editor visually to the given coordinates
|
|
6993
6995
|
*/
|
|
6994
|
-
|
|
6996
|
+
p(this, "findClosestEditorElement", (n) => {
|
|
6995
6997
|
const t = Array.from(this.pmView.root.querySelectorAll(".bn-editor"));
|
|
6996
6998
|
if (t.length === 0)
|
|
6997
6999
|
return null;
|
|
@@ -7019,7 +7021,7 @@ class Va {
|
|
|
7019
7021
|
*
|
|
7020
7022
|
* The synthetic event is a necessary evil because we do not control prosemirror-dropcursor to be able to show the drop-cursor within the range we want
|
|
7021
7023
|
*/
|
|
7022
|
-
|
|
7024
|
+
p(this, "onDragOver", (n) => {
|
|
7023
7025
|
if (n.synthetic)
|
|
7024
7026
|
return;
|
|
7025
7027
|
const t = this.getDragEventContext(n);
|
|
@@ -7032,7 +7034,7 @@ class Va {
|
|
|
7032
7034
|
/**
|
|
7033
7035
|
* Closes the drop-cursor for the current editor
|
|
7034
7036
|
*/
|
|
7035
|
-
|
|
7037
|
+
p(this, "closeDropCursor", () => {
|
|
7036
7038
|
const n = new Event("dragleave", { bubbles: !1 });
|
|
7037
7039
|
n.synthetic = !0, this.pmView.dom.dispatchEvent(n);
|
|
7038
7040
|
});
|
|
@@ -7044,7 +7046,7 @@ class Va {
|
|
|
7044
7046
|
* - Whether the current editor instance is the drag origin
|
|
7045
7047
|
* - Whether the drop event is within the bounds of the current editor instance
|
|
7046
7048
|
*/
|
|
7047
|
-
|
|
7049
|
+
p(this, "getDragEventContext", (n) => {
|
|
7048
7050
|
var c;
|
|
7049
7051
|
const t = !((c = n.dataTransfer) != null && c.types.includes("blocknote/html")) && !!this.pmView.dragging, o = !!this.isDragOrigin, r = t || o, s = this.findClosestEditorElement(n);
|
|
7050
7052
|
if (!s || s.distance > sn)
|
|
@@ -7070,7 +7072,7 @@ class Va {
|
|
|
7070
7072
|
* - If we are the drag origin but not the drop point:
|
|
7071
7073
|
* - Delete the dragged content from our editor after a delay
|
|
7072
7074
|
*/
|
|
7073
|
-
|
|
7075
|
+
p(this, "onDrop", (n) => {
|
|
7074
7076
|
if (n.synthetic)
|
|
7075
7077
|
return;
|
|
7076
7078
|
const t = this.getDragEventContext(n);
|
|
@@ -7084,7 +7086,7 @@ class Va {
|
|
|
7084
7086
|
return;
|
|
7085
7087
|
this.pmView.dispatch(
|
|
7086
7088
|
this.pmView.state.tr.setSelection(
|
|
7087
|
-
|
|
7089
|
+
L.create(
|
|
7088
7090
|
this.pmView.state.tr.doc,
|
|
7089
7091
|
this.pmView.state.tr.selection.anchor
|
|
7090
7092
|
)
|
|
@@ -7099,14 +7101,14 @@ class Va {
|
|
|
7099
7101
|
return;
|
|
7100
7102
|
}
|
|
7101
7103
|
});
|
|
7102
|
-
|
|
7104
|
+
p(this, "onDragEnd", (n) => {
|
|
7103
7105
|
n.synthetic || (this.pmView.dragging = null);
|
|
7104
7106
|
});
|
|
7105
|
-
|
|
7107
|
+
p(this, "onKeyDown", (n) => {
|
|
7106
7108
|
var t;
|
|
7107
7109
|
(t = this.state) != null && t.show && this.editor.isFocused() && (this.state.show = !1, this.emitUpdate(this.state));
|
|
7108
7110
|
});
|
|
7109
|
-
|
|
7111
|
+
p(this, "onMouseMove", (n) => {
|
|
7110
7112
|
var s;
|
|
7111
7113
|
if (this.menuFrozen)
|
|
7112
7114
|
return;
|
|
@@ -7123,7 +7125,7 @@ class Va {
|
|
|
7123
7125
|
}
|
|
7124
7126
|
this.updateStateFromMousePos();
|
|
7125
7127
|
});
|
|
7126
|
-
|
|
7128
|
+
p(this, "onScroll", () => {
|
|
7127
7129
|
var n;
|
|
7128
7130
|
(n = this.state) != null && n.show && (this.state.referencePos = this.hoveredBlock.getBoundingClientRect(), this.emitUpdate(this.state)), this.updateStateFromMousePos();
|
|
7129
7131
|
});
|
|
@@ -7204,20 +7206,20 @@ class Va {
|
|
|
7204
7206
|
}
|
|
7205
7207
|
}
|
|
7206
7208
|
const _a = new U("SideMenuPlugin");
|
|
7207
|
-
class Ua extends
|
|
7209
|
+
class Ua extends A {
|
|
7208
7210
|
constructor(t) {
|
|
7209
7211
|
super();
|
|
7210
|
-
|
|
7212
|
+
p(this, "view");
|
|
7211
7213
|
/**
|
|
7212
7214
|
* Handles drag & drop events for blocks.
|
|
7213
7215
|
*/
|
|
7214
|
-
|
|
7216
|
+
p(this, "blockDragStart", (t, o) => {
|
|
7215
7217
|
this.view && (this.view.isDragOrigin = !0), Oa(t, o, this.editor);
|
|
7216
7218
|
});
|
|
7217
7219
|
/**
|
|
7218
7220
|
* Handles drag & drop events for blocks.
|
|
7219
7221
|
*/
|
|
7220
|
-
|
|
7222
|
+
p(this, "blockDragEnd", () => {
|
|
7221
7223
|
this.editor.prosemirrorView && io(this.editor.prosemirrorView.root), this.view && (this.view.isDragOrigin = !1);
|
|
7222
7224
|
});
|
|
7223
7225
|
/**
|
|
@@ -7225,7 +7227,7 @@ class Ua extends L {
|
|
|
7225
7227
|
* attached to the same block regardless of which block is hovered by the
|
|
7226
7228
|
* mouse cursor.
|
|
7227
7229
|
*/
|
|
7228
|
-
|
|
7230
|
+
p(this, "freezeMenu", () => {
|
|
7229
7231
|
this.view.menuFrozen = !0, this.view.state.show = !0, this.view.emitUpdate(this.view.state);
|
|
7230
7232
|
});
|
|
7231
7233
|
/**
|
|
@@ -7233,11 +7235,11 @@ class Ua extends L {
|
|
|
7233
7235
|
* attached to the same block regardless of which block is hovered by the
|
|
7234
7236
|
* mouse cursor.
|
|
7235
7237
|
*/
|
|
7236
|
-
|
|
7238
|
+
p(this, "unfreezeMenu", () => {
|
|
7237
7239
|
this.view.menuFrozen = !1, this.view.state.show = !1, this.view.emitUpdate(this.view.state);
|
|
7238
7240
|
});
|
|
7239
7241
|
this.editor = t, this.addProsemirrorPlugin(
|
|
7240
|
-
new
|
|
7242
|
+
new N({
|
|
7241
7243
|
key: _a,
|
|
7242
7244
|
view: (o) => (this.view = new Va(t, o, (r) => {
|
|
7243
7245
|
this.emit("update", r);
|
|
@@ -7294,11 +7296,11 @@ function Fa(e, n, t = "left") {
|
|
|
7294
7296
|
const za = ko((e) => e.type.name === "blockContainer");
|
|
7295
7297
|
class Wa {
|
|
7296
7298
|
constructor(n, t) {
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7299
|
+
p(this, "state");
|
|
7300
|
+
p(this, "emitUpdate");
|
|
7301
|
+
p(this, "rootEl");
|
|
7302
|
+
p(this, "pluginState");
|
|
7303
|
+
p(this, "handleScroll", () => {
|
|
7302
7304
|
var n, t;
|
|
7303
7305
|
if ((n = this.state) != null && n.show) {
|
|
7304
7306
|
const o = (t = this.rootEl) == null ? void 0 : t.querySelector(
|
|
@@ -7309,10 +7311,10 @@ class Wa {
|
|
|
7309
7311
|
this.state.referencePos = o.getBoundingClientRect(), this.emitUpdate(this.pluginState.triggerCharacter);
|
|
7310
7312
|
}
|
|
7311
7313
|
});
|
|
7312
|
-
|
|
7314
|
+
p(this, "closeMenu", () => {
|
|
7313
7315
|
this.editor.transact((n) => n.setMeta(ge, null));
|
|
7314
7316
|
});
|
|
7315
|
-
|
|
7317
|
+
p(this, "clearQuery", () => {
|
|
7316
7318
|
this.pluginState !== void 0 && this.editor._tiptapEditor.chain().focus().deleteRange({
|
|
7317
7319
|
from: this.pluginState.queryStartPos() - (this.pluginState.deleteTriggerCharacter ? this.pluginState.triggerCharacter.length : 0),
|
|
7318
7320
|
to: this.editor.transact((n) => n.selection.from)
|
|
@@ -7355,25 +7357,25 @@ class Wa {
|
|
|
7355
7357
|
}
|
|
7356
7358
|
}
|
|
7357
7359
|
const ge = new U("SuggestionMenuPlugin");
|
|
7358
|
-
class ja extends
|
|
7360
|
+
class ja extends A {
|
|
7359
7361
|
constructor(t) {
|
|
7360
7362
|
super();
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7363
|
+
p(this, "view");
|
|
7364
|
+
p(this, "triggerCharacters", []);
|
|
7365
|
+
p(this, "addTriggerCharacter", (t) => {
|
|
7364
7366
|
this.triggerCharacters.push(t);
|
|
7365
7367
|
});
|
|
7366
7368
|
// TODO: Should this be called automatically when listeners are removed?
|
|
7367
|
-
|
|
7369
|
+
p(this, "removeTriggerCharacter", (t) => {
|
|
7368
7370
|
this.triggerCharacters = this.triggerCharacters.filter(
|
|
7369
7371
|
(o) => o !== t
|
|
7370
7372
|
);
|
|
7371
7373
|
});
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
+
p(this, "closeMenu", () => this.view.closeMenu());
|
|
7375
|
+
p(this, "clearQuery", () => this.view.clearQuery());
|
|
7374
7376
|
const o = this.triggerCharacters;
|
|
7375
7377
|
this.addProsemirrorPlugin(
|
|
7376
|
-
new
|
|
7378
|
+
new N({
|
|
7377
7379
|
key: ge,
|
|
7378
7380
|
view: () => (this.view = new Wa(
|
|
7379
7381
|
t,
|
|
@@ -7452,7 +7454,7 @@ class ja extends L {
|
|
|
7452
7454
|
if (!s.deleteTriggerCharacter) {
|
|
7453
7455
|
const i = za(r.selection);
|
|
7454
7456
|
if (i)
|
|
7455
|
-
return
|
|
7457
|
+
return j.create(r.doc, [
|
|
7456
7458
|
J.node(
|
|
7457
7459
|
i.pos,
|
|
7458
7460
|
i.pos + i.node.nodeSize,
|
|
@@ -7464,7 +7466,7 @@ class ja extends L {
|
|
|
7464
7466
|
)
|
|
7465
7467
|
]);
|
|
7466
7468
|
}
|
|
7467
|
-
return
|
|
7469
|
+
return j.create(r.doc, [
|
|
7468
7470
|
J.inline(
|
|
7469
7471
|
s.queryStartPos() - s.triggerCharacter.length,
|
|
7470
7472
|
s.queryStartPos(),
|
|
@@ -7674,22 +7676,22 @@ function Ja(e, n) {
|
|
|
7674
7676
|
}
|
|
7675
7677
|
class Za {
|
|
7676
7678
|
constructor(n, t, o) {
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7679
|
+
p(this, "state");
|
|
7680
|
+
p(this, "emitUpdate");
|
|
7681
|
+
p(this, "tableId");
|
|
7682
|
+
p(this, "tablePos");
|
|
7683
|
+
p(this, "tableElement");
|
|
7684
|
+
p(this, "menuFrozen", !1);
|
|
7685
|
+
p(this, "mouseState", "up");
|
|
7686
|
+
p(this, "prevWasEditable", null);
|
|
7687
|
+
p(this, "viewMousedownHandler", () => {
|
|
7686
7688
|
this.mouseState = "down";
|
|
7687
7689
|
});
|
|
7688
|
-
|
|
7690
|
+
p(this, "mouseUpHandler", (n) => {
|
|
7689
7691
|
this.mouseState = "up", this.mouseMoveHandler(n);
|
|
7690
7692
|
});
|
|
7691
|
-
|
|
7692
|
-
var l, d, u,
|
|
7693
|
+
p(this, "mouseMoveHandler", (n) => {
|
|
7694
|
+
var l, d, u, h, f, m, g;
|
|
7693
7695
|
if (this.menuFrozen || this.mouseState === "selecting" || !(n.target instanceof Element) || !this.pmView.dom.contains(n.target))
|
|
7694
7696
|
return;
|
|
7695
7697
|
const t = Xa(n.target);
|
|
@@ -7723,7 +7725,7 @@ class Za {
|
|
|
7723
7725
|
if (ri("table", a, this.editor) && (this.tablePos = i.posBeforeNode + 1, s = a), !s)
|
|
7724
7726
|
return;
|
|
7725
7727
|
this.tableId = r.id;
|
|
7726
|
-
const c = (
|
|
7728
|
+
const c = (h = t.domNode.closest(".tableWrapper")) == null ? void 0 : h.querySelector(".table-widgets-container");
|
|
7727
7729
|
if ((t == null ? void 0 : t.type) === "wrapper") {
|
|
7728
7730
|
const b = n.clientY >= o.bottom - 1 && // -1 to account for fractions of pixels in "bottom"
|
|
7729
7731
|
n.clientY < o.bottom + 20, k = n.clientX >= o.right - 1 && n.clientX < o.right + 20, w = n.clientX > o.right || n.clientY > o.bottom;
|
|
@@ -7758,9 +7760,9 @@ class Za {
|
|
|
7758
7760
|
}
|
|
7759
7761
|
return this.emitUpdate(), !1;
|
|
7760
7762
|
});
|
|
7761
|
-
|
|
7762
|
-
var
|
|
7763
|
-
if (((
|
|
7763
|
+
p(this, "dragOverHandler", (n) => {
|
|
7764
|
+
var h;
|
|
7765
|
+
if (((h = this.state) == null ? void 0 : h.draggingState) === void 0)
|
|
7764
7766
|
return;
|
|
7765
7767
|
n.preventDefault(), n.dataTransfer.dropEffect = "move", Ja(
|
|
7766
7768
|
".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline",
|
|
@@ -7787,7 +7789,7 @@ class Za {
|
|
|
7787
7789
|
const u = this.state.draggingState.draggedCellOrientation === "row" ? t.top : t.left;
|
|
7788
7790
|
this.state.draggingState.mousePos !== u && (this.state.draggingState.mousePos = u, s = !0), s && this.emitUpdate(), d && this.editor.transact((f) => f.setMeta(ye, !0));
|
|
7789
7791
|
});
|
|
7790
|
-
|
|
7792
|
+
p(this, "dropHandler", (n) => {
|
|
7791
7793
|
if (this.mouseState = "up", this.state === void 0 || this.state.draggingState === void 0)
|
|
7792
7794
|
return !1;
|
|
7793
7795
|
if (this.state.rowIndex === void 0 || this.state.colIndex === void 0)
|
|
@@ -7887,15 +7889,15 @@ class Za {
|
|
|
7887
7889
|
}
|
|
7888
7890
|
}
|
|
7889
7891
|
const ye = new U("TableHandlesPlugin");
|
|
7890
|
-
class Qa extends
|
|
7892
|
+
class Qa extends A {
|
|
7891
7893
|
constructor(t) {
|
|
7892
7894
|
super();
|
|
7893
|
-
|
|
7895
|
+
p(this, "view");
|
|
7894
7896
|
/**
|
|
7895
7897
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
7896
7898
|
* is used as the column drag handle.
|
|
7897
7899
|
*/
|
|
7898
|
-
|
|
7900
|
+
p(this, "colDragStart", (t) => {
|
|
7899
7901
|
if (this.view.state === void 0 || this.view.state.colIndex === void 0)
|
|
7900
7902
|
throw new Error(
|
|
7901
7903
|
"Attempted to drag table column, but no table block was hovered prior."
|
|
@@ -7919,7 +7921,7 @@ class Qa extends L {
|
|
|
7919
7921
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
7920
7922
|
* is used as the row drag handle.
|
|
7921
7923
|
*/
|
|
7922
|
-
|
|
7924
|
+
p(this, "rowDragStart", (t) => {
|
|
7923
7925
|
if (this.view.state === void 0 || this.view.state.rowIndex === void 0)
|
|
7924
7926
|
throw new Error(
|
|
7925
7927
|
"Attempted to drag table row, but no table block was hovered prior."
|
|
@@ -7943,7 +7945,7 @@ class Qa extends L {
|
|
|
7943
7945
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
7944
7946
|
* used as the row drag handle, and the one used as the column drag handle.
|
|
7945
7947
|
*/
|
|
7946
|
-
|
|
7948
|
+
p(this, "dragEnd", () => {
|
|
7947
7949
|
if (this.view.state === void 0)
|
|
7948
7950
|
throw new Error(
|
|
7949
7951
|
"Attempted to drag table row, but no table block was hovered prior."
|
|
@@ -7956,26 +7958,26 @@ class Qa extends L {
|
|
|
7956
7958
|
* Freezes the drag handles. When frozen, they will stay attached to the same
|
|
7957
7959
|
* cell regardless of which cell is hovered by the mouse cursor.
|
|
7958
7960
|
*/
|
|
7959
|
-
|
|
7961
|
+
p(this, "freezeHandles", () => {
|
|
7960
7962
|
this.view.menuFrozen = !0;
|
|
7961
7963
|
});
|
|
7962
7964
|
/**
|
|
7963
7965
|
* Unfreezes the drag handles. When frozen, they will stay attached to the
|
|
7964
7966
|
* same cell regardless of which cell is hovered by the mouse cursor.
|
|
7965
7967
|
*/
|
|
7966
|
-
|
|
7968
|
+
p(this, "unfreezeHandles", () => {
|
|
7967
7969
|
this.view.menuFrozen = !1;
|
|
7968
7970
|
});
|
|
7969
|
-
|
|
7971
|
+
p(this, "getCellsAtRowHandle", (t, o) => dt(t, o));
|
|
7970
7972
|
/**
|
|
7971
7973
|
* Get all the cells in a column of the table block.
|
|
7972
7974
|
*/
|
|
7973
|
-
|
|
7975
|
+
p(this, "getCellsAtColumnHandle", (t, o) => ut(t, o));
|
|
7974
7976
|
/**
|
|
7975
7977
|
* Sets the selection to the given cell or a range of cells.
|
|
7976
7978
|
* @returns The new state after the selection has been set.
|
|
7977
7979
|
*/
|
|
7978
|
-
|
|
7980
|
+
p(this, "setCellSelection", (t, o, r = o) => {
|
|
7979
7981
|
const s = this.view;
|
|
7980
7982
|
if (!s)
|
|
7981
7983
|
throw new Error("Table handles view not initialized");
|
|
@@ -7997,7 +7999,7 @@ class Qa extends L {
|
|
|
7997
7999
|
/**
|
|
7998
8000
|
* Adds a row or column to the table using prosemirror-table commands
|
|
7999
8001
|
*/
|
|
8000
|
-
|
|
8002
|
+
p(this, "addRowOrColumn", (t, o) => {
|
|
8001
8003
|
this.editor.exec((r, s) => {
|
|
8002
8004
|
const i = this.setCellSelection(
|
|
8003
8005
|
r,
|
|
@@ -8009,7 +8011,7 @@ class Qa extends L {
|
|
|
8009
8011
|
/**
|
|
8010
8012
|
* Removes a row or column from the table using prosemirror-table commands
|
|
8011
8013
|
*/
|
|
8012
|
-
|
|
8014
|
+
p(this, "removeRowOrColumn", (t, o) => o === "row" ? this.editor.exec((r, s) => {
|
|
8013
8015
|
const i = this.setCellSelection(r, {
|
|
8014
8016
|
row: t,
|
|
8015
8017
|
col: 0
|
|
@@ -8025,7 +8027,7 @@ class Qa extends L {
|
|
|
8025
8027
|
/**
|
|
8026
8028
|
* Merges the cells in the table block.
|
|
8027
8029
|
*/
|
|
8028
|
-
|
|
8030
|
+
p(this, "mergeCells", (t) => this.editor.exec((o, r) => {
|
|
8029
8031
|
const s = t ? this.setCellSelection(
|
|
8030
8032
|
o,
|
|
8031
8033
|
t.relativeStartCell,
|
|
@@ -8037,7 +8039,7 @@ class Qa extends L {
|
|
|
8037
8039
|
* Splits the cell in the table block.
|
|
8038
8040
|
* If no cell is provided, the current cell selected will be split.
|
|
8039
8041
|
*/
|
|
8040
|
-
|
|
8042
|
+
p(this, "splitCell", (t) => this.editor.exec((o, r) => {
|
|
8041
8043
|
const s = t ? this.setCellSelection(o, t) : o;
|
|
8042
8044
|
return No(s, r);
|
|
8043
8045
|
}));
|
|
@@ -8045,7 +8047,7 @@ class Qa extends L {
|
|
|
8045
8047
|
* Gets the start and end cells of the current cell selection.
|
|
8046
8048
|
* @returns The start and end cells of the current cell selection.
|
|
8047
8049
|
*/
|
|
8048
|
-
|
|
8050
|
+
p(this, "getCellSelection", () => this.editor.transact((t) => {
|
|
8049
8051
|
const o = t.selection;
|
|
8050
8052
|
let r = o.$from, s = o.$to;
|
|
8051
8053
|
if (Yt(o)) {
|
|
@@ -8061,8 +8063,8 @@ class Qa extends L {
|
|
|
8061
8063
|
return;
|
|
8062
8064
|
const i = t.doc.resolve(
|
|
8063
8065
|
r.pos - r.parentOffset - 1
|
|
8064
|
-
), a = t.doc.resolve(s.pos - s.parentOffset - 1), c = t.doc.resolve(i.pos - i.parentOffset - 1), l = r.index(i.depth), d = i.index(c.depth), u = s.index(a.depth),
|
|
8065
|
-
for (let m = d; m <=
|
|
8066
|
+
), a = t.doc.resolve(s.pos - s.parentOffset - 1), c = t.doc.resolve(i.pos - i.parentOffset - 1), l = r.index(i.depth), d = i.index(c.depth), u = s.index(a.depth), h = a.index(c.depth), f = [];
|
|
8067
|
+
for (let m = d; m <= h; m++)
|
|
8066
8068
|
for (let g = l; g <= u; g++)
|
|
8067
8069
|
f.push({ row: m, col: g });
|
|
8068
8070
|
return {
|
|
@@ -8071,7 +8073,7 @@ class Qa extends L {
|
|
|
8071
8073
|
col: l
|
|
8072
8074
|
},
|
|
8073
8075
|
to: {
|
|
8074
|
-
row:
|
|
8076
|
+
row: h,
|
|
8075
8077
|
col: u
|
|
8076
8078
|
},
|
|
8077
8079
|
cells: f
|
|
@@ -8082,7 +8084,7 @@ class Qa extends L {
|
|
|
8082
8084
|
*
|
|
8083
8085
|
* Returns undefined when there is no cell selection, or the selection is not within a table.
|
|
8084
8086
|
*/
|
|
8085
|
-
|
|
8087
|
+
p(this, "getMergeDirection", (t) => this.editor.transact((o) => {
|
|
8086
8088
|
const r = Yt(o.selection) ? o.selection : void 0;
|
|
8087
8089
|
if (!r || !t || // Only offer the merge button if there is more than one cell selected.
|
|
8088
8090
|
r.ranges.length <= 1)
|
|
@@ -8091,10 +8093,10 @@ class Qa extends L {
|
|
|
8091
8093
|
if (s)
|
|
8092
8094
|
return Pr(s.from, s.to, t) ? "vertical" : "horizontal";
|
|
8093
8095
|
}));
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
+
p(this, "cropEmptyRowsOrColumns", (t, o) => xr(t, o));
|
|
8097
|
+
p(this, "addRowsOrColumns", (t, o, r) => Mr(t, o, r));
|
|
8096
8098
|
this.editor = t, this.addProsemirrorPlugin(
|
|
8097
|
-
new
|
|
8099
|
+
new N({
|
|
8098
8100
|
key: ye,
|
|
8099
8101
|
view: (o) => (this.view = new Za(t, o, (r) => {
|
|
8100
8102
|
this.emit("update", r);
|
|
@@ -8110,14 +8112,14 @@ class Qa extends L {
|
|
|
8110
8112
|
return;
|
|
8111
8113
|
const s = [], { block: i, draggingState: a } = this.view.state, { originalIndex: c, draggedCellOrientation: l } = a;
|
|
8112
8114
|
if (r === c || !i || l === "row" && !En(i, c, r) || l === "col" && !Bn(i, c, r))
|
|
8113
|
-
return
|
|
8115
|
+
return j.create(o.doc, s);
|
|
8114
8116
|
const d = o.doc.resolve(this.view.tablePos + 1);
|
|
8115
8117
|
return this.view.state.draggingState.draggedCellOrientation === "row" ? dt(
|
|
8116
8118
|
this.view.state.block,
|
|
8117
8119
|
r
|
|
8118
|
-
).forEach(({ row:
|
|
8120
|
+
).forEach(({ row: h, col: f }) => {
|
|
8119
8121
|
const m = o.doc.resolve(
|
|
8120
|
-
d.posAtIndex(
|
|
8122
|
+
d.posAtIndex(h) + 1
|
|
8121
8123
|
), g = o.doc.resolve(
|
|
8122
8124
|
m.posAtIndex(f) + 1
|
|
8123
8125
|
), b = g.node(), k = g.pos + (r > c ? b.nodeSize - 2 : 0);
|
|
@@ -8131,9 +8133,9 @@ class Qa extends L {
|
|
|
8131
8133
|
}) : ut(
|
|
8132
8134
|
this.view.state.block,
|
|
8133
8135
|
r
|
|
8134
|
-
).forEach(({ row:
|
|
8136
|
+
).forEach(({ row: h, col: f }) => {
|
|
8135
8137
|
const m = o.doc.resolve(
|
|
8136
|
-
d.posAtIndex(
|
|
8138
|
+
d.posAtIndex(h) + 1
|
|
8137
8139
|
), g = o.doc.resolve(
|
|
8138
8140
|
m.posAtIndex(f) + 1
|
|
8139
8141
|
), b = g.node(), k = g.pos + (r > c ? b.nodeSize - 2 : 0);
|
|
@@ -8144,7 +8146,7 @@ class Qa extends L {
|
|
|
8144
8146
|
return w.className = "bn-table-drop-cursor", w.style.top = "0", w.style.bottom = "0", r > c ? w.style.right = "-2px" : w.style.left = "-3px", w.style.width = "4px", w;
|
|
8145
8147
|
})
|
|
8146
8148
|
);
|
|
8147
|
-
}),
|
|
8149
|
+
}), j.create(o.doc, s);
|
|
8148
8150
|
}
|
|
8149
8151
|
}
|
|
8150
8152
|
})
|
|
@@ -8193,9 +8195,9 @@ const ec = _.create({
|
|
|
8193
8195
|
types: ["blockContainer", "tableCell", "tableHeader"],
|
|
8194
8196
|
attributes: {
|
|
8195
8197
|
textColor: {
|
|
8196
|
-
default:
|
|
8197
|
-
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") :
|
|
8198
|
-
renderHTML: (e) => e.textColor ===
|
|
8198
|
+
default: T.textColor.default,
|
|
8199
|
+
parseHTML: (e) => e.hasAttribute("data-text-color") ? e.getAttribute("data-text-color") : T.textColor.default,
|
|
8200
|
+
renderHTML: (e) => e.textColor === T.textColor.default ? {} : {
|
|
8199
8201
|
"data-text-color": e.textColor
|
|
8200
8202
|
}
|
|
8201
8203
|
}
|
|
@@ -8208,7 +8210,7 @@ const ec = _.create({
|
|
|
8208
8210
|
addProseMirrorPlugins() {
|
|
8209
8211
|
const e = new U(this.name);
|
|
8210
8212
|
return [
|
|
8211
|
-
new
|
|
8213
|
+
new N({
|
|
8212
8214
|
key: e,
|
|
8213
8215
|
appendTransaction: (n, t, o) => {
|
|
8214
8216
|
const { doc: r, tr: s, schema: i } = o, a = e.getState(o), c = r.content.size - 2, l = i.nodes.blockContainer, d = i.nodes.paragraph;
|
|
@@ -8327,19 +8329,19 @@ const ec = _.create({
|
|
|
8327
8329
|
content: "blockGroup",
|
|
8328
8330
|
marks: "insertion modification deletion"
|
|
8329
8331
|
});
|
|
8330
|
-
class ac extends
|
|
8332
|
+
class ac extends A {
|
|
8331
8333
|
constructor({
|
|
8332
8334
|
editor: t,
|
|
8333
8335
|
collaboration: o
|
|
8334
8336
|
}) {
|
|
8335
8337
|
super(t);
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
+
p(this, "editor");
|
|
8339
|
+
p(this, "collaboration");
|
|
8338
8340
|
/**
|
|
8339
8341
|
* Stores whether the editor is editing a forked document,
|
|
8340
8342
|
* preserving a reference to the original document and the forked document.
|
|
8341
8343
|
*/
|
|
8342
|
-
|
|
8344
|
+
p(this, "forkedState");
|
|
8343
8345
|
this.editor = t, this.collaboration = o;
|
|
8344
8346
|
}
|
|
8345
8347
|
static key() {
|
|
@@ -8599,7 +8601,7 @@ function pc(e, n) {
|
|
|
8599
8601
|
if (o)
|
|
8600
8602
|
return !1;
|
|
8601
8603
|
if (r) {
|
|
8602
|
-
const a =
|
|
8604
|
+
const a = S(n.state);
|
|
8603
8605
|
if (a.isBlockContainer)
|
|
8604
8606
|
return !(a.blockContent.node.type.spec.content === "tableRow+");
|
|
8605
8607
|
}
|
|
@@ -8609,13 +8611,13 @@ function pc(e, n) {
|
|
|
8609
8611
|
const je = class je extends wo {
|
|
8610
8612
|
constructor(t, o) {
|
|
8611
8613
|
super({ ...t, content: void 0 });
|
|
8612
|
-
|
|
8614
|
+
p(this, "_state");
|
|
8613
8615
|
/**
|
|
8614
8616
|
* Mounts / unmounts the editor to a dom element
|
|
8615
8617
|
*
|
|
8616
8618
|
* @param element DOM element to mount to, ur null / undefined to destroy
|
|
8617
8619
|
*/
|
|
8618
|
-
|
|
8620
|
+
p(this, "mount", (t, o, r) => {
|
|
8619
8621
|
o ? (this.options.element = o, this.createViewAlternative(t, r)) : (this.destroy(), this.isInitialized = !1);
|
|
8620
8622
|
});
|
|
8621
8623
|
const r = this.schema;
|
|
@@ -8746,7 +8748,7 @@ const je = class je extends wo {
|
|
|
8746
8748
|
), this.emit("create", { editor: this }), this.isInitialized = !0;
|
|
8747
8749
|
}
|
|
8748
8750
|
};
|
|
8749
|
-
|
|
8751
|
+
p(je, "create", (t, o) => {
|
|
8750
8752
|
var s, i;
|
|
8751
8753
|
const r = (s = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : s.setTimeout;
|
|
8752
8754
|
typeof ((i = globalThis == null ? void 0 : globalThis.window) == null ? void 0 : i.setTimeout) < "u" && (globalThis.window.setTimeout = () => 0);
|
|
@@ -8767,16 +8769,16 @@ const fc = {
|
|
|
8767
8769
|
};
|
|
8768
8770
|
class ao extends At {
|
|
8769
8771
|
constructor(t) {
|
|
8770
|
-
var l, d, u,
|
|
8772
|
+
var l, d, u, h, f, m, g, b, k, w, C, y, B, K, x, v;
|
|
8771
8773
|
super();
|
|
8772
8774
|
/**
|
|
8773
8775
|
* The underlying prosemirror schema
|
|
8774
8776
|
*/
|
|
8775
|
-
|
|
8777
|
+
p(this, "pmSchema");
|
|
8776
8778
|
/**
|
|
8777
8779
|
* extensions that are added to the editor, can be tiptap extensions or prosemirror plugins
|
|
8778
8780
|
*/
|
|
8779
|
-
|
|
8781
|
+
p(this, "extensions", {});
|
|
8780
8782
|
/**
|
|
8781
8783
|
* Boolean indicating whether the editor is in headless mode.
|
|
8782
8784
|
* Headless mode means we can use features like importing / exporting blocks,
|
|
@@ -8784,43 +8786,43 @@ class ao extends At {
|
|
|
8784
8786
|
*
|
|
8785
8787
|
* You probably don't need to set this manually, but use the `server-util` package instead that uses this option internally
|
|
8786
8788
|
*/
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
+
p(this, "headless", !1);
|
|
8790
|
+
p(this, "_tiptapEditor");
|
|
8789
8791
|
// TODO: Type should actually reflect that it can be `undefined` in headless mode
|
|
8790
8792
|
/**
|
|
8791
8793
|
* Used by React to store a reference to an `ElementRenderer` helper utility to make sure we can render React elements
|
|
8792
8794
|
* in the correct context (used by `ReactRenderUtil`)
|
|
8793
8795
|
*/
|
|
8794
|
-
|
|
8796
|
+
p(this, "elementRenderer", null);
|
|
8795
8797
|
/**
|
|
8796
8798
|
* Cache of all blocks. This makes sure we don't have to "recompute" blocks if underlying Prosemirror Nodes haven't changed.
|
|
8797
8799
|
* This is especially useful when we want to keep track of the same block across multiple operations,
|
|
8798
8800
|
* with this cache, blocks stay the same object reference (referential equality with ===).
|
|
8799
8801
|
*/
|
|
8800
|
-
|
|
8802
|
+
p(this, "blockCache", /* @__PURE__ */ new WeakMap());
|
|
8801
8803
|
/**
|
|
8802
8804
|
* The dictionary contains translations for the editor.
|
|
8803
8805
|
*/
|
|
8804
|
-
|
|
8806
|
+
p(this, "dictionary");
|
|
8805
8807
|
/**
|
|
8806
8808
|
* The schema of the editor. The schema defines which Blocks, InlineContent, and Styles are available in the editor.
|
|
8807
8809
|
*/
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8810
|
+
p(this, "schema");
|
|
8811
|
+
p(this, "blockImplementations");
|
|
8812
|
+
p(this, "inlineContentImplementations");
|
|
8813
|
+
p(this, "styleImplementations");
|
|
8814
|
+
p(this, "formattingToolbar");
|
|
8815
|
+
p(this, "linkToolbar");
|
|
8816
|
+
p(this, "sideMenu");
|
|
8817
|
+
p(this, "suggestionMenus");
|
|
8818
|
+
p(this, "filePanel");
|
|
8819
|
+
p(this, "tableHandles");
|
|
8820
|
+
p(this, "comments");
|
|
8821
|
+
p(this, "showSelectionPlugin");
|
|
8820
8822
|
/**
|
|
8821
8823
|
* The plugin for forking a document, only defined if in collaboration mode
|
|
8822
8824
|
*/
|
|
8823
|
-
|
|
8825
|
+
p(this, "forkYDocPlugin");
|
|
8824
8826
|
/**
|
|
8825
8827
|
* The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).
|
|
8826
8828
|
* This method should set when creating the editor as this is application-specific.
|
|
@@ -8830,25 +8832,25 @@ class ao extends At {
|
|
|
8830
8832
|
* @param file The file that should be uploaded.
|
|
8831
8833
|
* @returns The URL of the uploaded file OR an object containing props that should be set on the file block (such as an id)
|
|
8832
8834
|
*/
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8835
|
+
p(this, "uploadFile");
|
|
8836
|
+
p(this, "onUploadStartCallbacks", []);
|
|
8837
|
+
p(this, "onUploadEndCallbacks", []);
|
|
8838
|
+
p(this, "resolveFileUrl");
|
|
8839
|
+
p(this, "resolveUsers");
|
|
8838
8840
|
/**
|
|
8839
8841
|
* Editor settings
|
|
8840
8842
|
*/
|
|
8841
|
-
|
|
8843
|
+
p(this, "settings");
|
|
8842
8844
|
/**
|
|
8843
8845
|
* Stores the currently active transaction, which is the accumulated transaction from all {@link dispatch} calls during a {@link transact} calls
|
|
8844
8846
|
*/
|
|
8845
|
-
|
|
8847
|
+
p(this, "activeTransaction", null);
|
|
8846
8848
|
/**
|
|
8847
8849
|
* Mount the editor to a parent DOM element. Call mount(undefined) to clean up
|
|
8848
8850
|
*
|
|
8849
8851
|
* @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
|
|
8850
8852
|
*/
|
|
8851
|
-
|
|
8853
|
+
p(this, "mount", (t, o) => {
|
|
8852
8854
|
this._tiptapEditor.mount(this, t, o);
|
|
8853
8855
|
});
|
|
8854
8856
|
this.options = t;
|
|
@@ -8874,7 +8876,7 @@ class ao extends At {
|
|
|
8874
8876
|
splitCells: ((l = t == null ? void 0 : t.tables) == null ? void 0 : l.splitCells) ?? !1,
|
|
8875
8877
|
cellBackgroundColor: ((d = t == null ? void 0 : t.tables) == null ? void 0 : d.cellBackgroundColor) ?? !1,
|
|
8876
8878
|
cellTextColor: ((u = t == null ? void 0 : t.tables) == null ? void 0 : u.cellTextColor) ?? !1,
|
|
8877
|
-
headers: ((
|
|
8879
|
+
headers: ((h = t == null ? void 0 : t.tables) == null ? void 0 : h.headers) ?? !1
|
|
8878
8880
|
},
|
|
8879
8881
|
codeBlock: {
|
|
8880
8882
|
indentLineWithTab: ((f = t == null ? void 0 : t.codeBlock) == null ? void 0 : f.indentLineWithTab) ?? !0,
|
|
@@ -8915,31 +8917,31 @@ class ao extends At {
|
|
|
8915
8917
|
tabBehavior: r.tabBehavior,
|
|
8916
8918
|
comments: r.comments,
|
|
8917
8919
|
pasteHandler: r.pasteHandler
|
|
8918
|
-
}), (((w = r._tiptapOptions) == null ? void 0 : w.extensions) || []).forEach((
|
|
8919
|
-
this.extensions[
|
|
8920
|
+
}), (((w = r._tiptapOptions) == null ? void 0 : w.extensions) || []).forEach((P) => {
|
|
8921
|
+
this.extensions[P.name] = P;
|
|
8920
8922
|
});
|
|
8921
|
-
for (let
|
|
8922
|
-
typeof
|
|
8923
|
-
const
|
|
8924
|
-
if (!
|
|
8923
|
+
for (let P of r.extensions || []) {
|
|
8924
|
+
typeof P == "function" && (P = P(this));
|
|
8925
|
+
const M = P.constructor.key();
|
|
8926
|
+
if (!M)
|
|
8925
8927
|
throw new Error(
|
|
8926
|
-
`Extension ${
|
|
8928
|
+
`Extension ${P.constructor.name} does not have a key method`
|
|
8927
8929
|
);
|
|
8928
|
-
if (this.extensions[
|
|
8930
|
+
if (this.extensions[M])
|
|
8929
8931
|
throw new Error(
|
|
8930
|
-
`Extension ${
|
|
8932
|
+
`Extension ${P.constructor.name} already exists with key ${M}`
|
|
8931
8933
|
);
|
|
8932
|
-
this.extensions[
|
|
8934
|
+
this.extensions[M] = P;
|
|
8933
8935
|
}
|
|
8934
|
-
if (Object.entries(r._extensions || {}).forEach(([
|
|
8935
|
-
const ee = typeof
|
|
8936
|
+
if (Object.entries(r._extensions || {}).forEach(([P, M]) => {
|
|
8937
|
+
const ee = typeof M == "function" ? M(this) : M;
|
|
8936
8938
|
if (!("plugin" in ee)) {
|
|
8937
|
-
this.extensions[
|
|
8939
|
+
this.extensions[P] = ee;
|
|
8938
8940
|
return;
|
|
8939
8941
|
}
|
|
8940
|
-
this.extensions[
|
|
8942
|
+
this.extensions[P] = new class extends A {
|
|
8941
8943
|
static key() {
|
|
8942
|
-
return
|
|
8944
|
+
return P;
|
|
8943
8945
|
}
|
|
8944
8946
|
constructor() {
|
|
8945
8947
|
super(), this.addProsemirrorPlugin(ee.plugin);
|
|
@@ -8949,13 +8951,13 @@ class ao extends At {
|
|
|
8949
8951
|
}
|
|
8950
8952
|
}();
|
|
8951
8953
|
}), this.formattingToolbar = this.extensions.formattingToolbar, this.linkToolbar = this.extensions.linkToolbar, this.sideMenu = this.extensions.sideMenu, this.suggestionMenus = this.extensions.suggestionMenus, this.filePanel = this.extensions.filePanel, this.tableHandles = this.extensions.tableHandles, this.comments = this.extensions.comments, this.showSelectionPlugin = this.extensions.showSelection, this.forkYDocPlugin = this.extensions.forkYDocPlugin, r.uploadFile) {
|
|
8952
|
-
const
|
|
8953
|
-
this.uploadFile = async (
|
|
8954
|
+
const P = r.uploadFile;
|
|
8955
|
+
this.uploadFile = async (M, Le) => {
|
|
8954
8956
|
this.onUploadStartCallbacks.forEach(
|
|
8955
8957
|
(ee) => ee.apply(this, [Le])
|
|
8956
8958
|
);
|
|
8957
8959
|
try {
|
|
8958
|
-
return await M
|
|
8960
|
+
return await P(M, Le);
|
|
8959
8961
|
} finally {
|
|
8960
8962
|
this.onUploadEndCallbacks.forEach(
|
|
8961
8963
|
(ee) => ee.apply(this, [Le])
|
|
@@ -8984,34 +8986,34 @@ class ao extends At {
|
|
|
8984
8986
|
"initialContent must be a non-empty array of blocks, received: " + i
|
|
8985
8987
|
);
|
|
8986
8988
|
const a = [
|
|
8987
|
-
...Object.entries(this.extensions).map(([
|
|
8988
|
-
if (
|
|
8989
|
-
return
|
|
8990
|
-
if (!(
|
|
8989
|
+
...Object.entries(this.extensions).map(([P, M]) => {
|
|
8990
|
+
if (M instanceof _ || M instanceof oe || M instanceof re)
|
|
8991
|
+
return M;
|
|
8992
|
+
if (!(M instanceof A && !M.plugins.length))
|
|
8991
8993
|
return _.create({
|
|
8992
|
-
name:
|
|
8993
|
-
priority:
|
|
8994
|
-
addProseMirrorPlugins: () =>
|
|
8994
|
+
name: P,
|
|
8995
|
+
priority: M.priority,
|
|
8996
|
+
addProseMirrorPlugins: () => M.plugins
|
|
8995
8997
|
});
|
|
8996
8998
|
})
|
|
8997
|
-
].filter((
|
|
8999
|
+
].filter((P) => P !== void 0), c = {
|
|
8998
9000
|
...fc,
|
|
8999
9001
|
...r._tiptapOptions,
|
|
9000
9002
|
content: i,
|
|
9001
9003
|
extensions: a,
|
|
9002
9004
|
editorProps: {
|
|
9003
|
-
...(
|
|
9005
|
+
...(C = r._tiptapOptions) == null ? void 0 : C.editorProps,
|
|
9004
9006
|
attributes: {
|
|
9005
9007
|
// As of TipTap v2.5.0 the tabIndex is removed when the editor is not
|
|
9006
9008
|
// editable, so you can't focus it. We want to revert this as we have
|
|
9007
9009
|
// UI behaviour that relies on it.
|
|
9008
9010
|
tabIndex: "0",
|
|
9009
|
-
...(
|
|
9010
|
-
...(
|
|
9011
|
+
...(B = (y = r._tiptapOptions) == null ? void 0 : y.editorProps) == null ? void 0 : B.attributes,
|
|
9012
|
+
...(K = r.domAttributes) == null ? void 0 : K.editor,
|
|
9011
9013
|
class: te(
|
|
9012
9014
|
"bn-editor",
|
|
9013
9015
|
r.defaultStyles ? "bn-default-styles" : "",
|
|
9014
|
-
((
|
|
9016
|
+
((v = (x = r.domAttributes) == null ? void 0 : x.editor) == null ? void 0 : v.class) || ""
|
|
9015
9017
|
)
|
|
9016
9018
|
},
|
|
9017
9019
|
transformPasted: hc
|
|
@@ -9379,7 +9381,7 @@ class ao extends At {
|
|
|
9379
9381
|
* @param content can be a string, or array of partial inline content elements
|
|
9380
9382
|
*/
|
|
9381
9383
|
insertInlineContent(t, { updateSelection: o = !1 } = {}) {
|
|
9382
|
-
const r =
|
|
9384
|
+
const r = z(t, this.pmSchema);
|
|
9383
9385
|
this.transact((s) => {
|
|
9384
9386
|
Bi(
|
|
9385
9387
|
s,
|
|
@@ -9427,7 +9429,7 @@ class ao extends At {
|
|
|
9427
9429
|
else if (s.propSchema === "string")
|
|
9428
9430
|
this._tiptapEditor.commands.setMark(o, { stringValue: r });
|
|
9429
9431
|
else
|
|
9430
|
-
throw new
|
|
9432
|
+
throw new G(s.propSchema);
|
|
9431
9433
|
}
|
|
9432
9434
|
}
|
|
9433
9435
|
/**
|
|
@@ -9452,7 +9454,7 @@ class ao extends At {
|
|
|
9452
9454
|
else if (s.propSchema === "string")
|
|
9453
9455
|
this._tiptapEditor.commands.toggleMark(o, { stringValue: r });
|
|
9454
9456
|
else
|
|
9455
|
-
throw new
|
|
9457
|
+
throw new G(s.propSchema);
|
|
9456
9458
|
}
|
|
9457
9459
|
}
|
|
9458
9460
|
/**
|
|
@@ -9478,7 +9480,7 @@ class ao extends At {
|
|
|
9478
9480
|
const r = this.pmSchema.mark("link", { href: t });
|
|
9479
9481
|
this.transact((s) => {
|
|
9480
9482
|
const { from: i, to: a } = s.selection;
|
|
9481
|
-
o ? s.insertText(o, i, a).addMark(i, i + o.length, r) : s.setSelection(
|
|
9483
|
+
o ? s.insertText(o, i, a).addMark(i, i + o.length, r) : s.setSelection(L.create(s.doc, a)).addMark(
|
|
9482
9484
|
i,
|
|
9483
9485
|
a,
|
|
9484
9486
|
r
|
|
@@ -9859,7 +9861,7 @@ function hl(e, ...n) {
|
|
|
9859
9861
|
export {
|
|
9860
9862
|
Zr as AudioBlock,
|
|
9861
9863
|
ao as BlockNoteEditor,
|
|
9862
|
-
|
|
9864
|
+
A as BlockNoteExtension,
|
|
9863
9865
|
Ie as BlockNoteSchema,
|
|
9864
9866
|
cl as COLORS_DARK_MODE_DEFAULT,
|
|
9865
9867
|
al as COLORS_DEFAULT,
|
|
@@ -9888,7 +9890,7 @@ export {
|
|
|
9888
9890
|
Qa as TableHandlesProsemirrorPlugin,
|
|
9889
9891
|
Za as TableHandlesView,
|
|
9890
9892
|
Ge as UniqueID,
|
|
9891
|
-
|
|
9893
|
+
G as UnreachableCaseError,
|
|
9892
9894
|
xa as VALID_LINK_PROTOCOLS,
|
|
9893
9895
|
ei as VideoBlock,
|
|
9894
9896
|
Vt as addInlineContentAttributes,
|
|
@@ -9936,7 +9938,7 @@ export {
|
|
|
9936
9938
|
Cn as createInternalStyleSpec,
|
|
9937
9939
|
Ze as createLinkWithCaption,
|
|
9938
9940
|
On as createResizableFileBlockWrapper,
|
|
9939
|
-
|
|
9941
|
+
q as createStronglyTypedTiptapNode,
|
|
9940
9942
|
Gc as createStyleSpec,
|
|
9941
9943
|
ae as createStyleSpecFromTipTapMark,
|
|
9942
9944
|
il as createSuggestionMenu,
|
|
@@ -9947,7 +9949,7 @@ export {
|
|
|
9947
9949
|
Qr as defaultCodeBlockPropSchema,
|
|
9948
9950
|
ni as defaultInlineContentSchema,
|
|
9949
9951
|
zn as defaultInlineContentSpecs,
|
|
9950
|
-
|
|
9952
|
+
T as defaultProps,
|
|
9951
9953
|
Kc as defaultStyleSchema,
|
|
9952
9954
|
Fn as defaultStyleSpecs,
|
|
9953
9955
|
hs as defaultToggledState,
|
|
@@ -9967,7 +9969,7 @@ export {
|
|
|
9967
9969
|
yt as getBlockFromPos,
|
|
9968
9970
|
ne as getBlockInfo,
|
|
9969
9971
|
Pe as getBlockInfoFromResolvedPos,
|
|
9970
|
-
|
|
9972
|
+
S as getBlockInfoFromSelection,
|
|
9971
9973
|
qe as getBlockInfoFromTransaction,
|
|
9972
9974
|
Ct as getBlockInfoWithManualOffset,
|
|
9973
9975
|
cc as getBlockNoteExtensions,
|
|
@@ -9987,7 +9989,7 @@ export {
|
|
|
9987
9989
|
sl as getPageBreakSlashMenuItems,
|
|
9988
9990
|
Ei as getParentBlock,
|
|
9989
9991
|
fr as getParseRules,
|
|
9990
|
-
|
|
9992
|
+
H as getPmSchema,
|
|
9991
9993
|
vi as getPrevBlock,
|
|
9992
9994
|
ct as getRowspan,
|
|
9993
9995
|
Sr as getStyleParseRules,
|
|
@@ -10000,9 +10002,9 @@ export {
|
|
|
10000
10002
|
Cs as imageToExternalHTML,
|
|
10001
10003
|
mn as inheritedProps,
|
|
10002
10004
|
et as initializeESMDependencies,
|
|
10003
|
-
|
|
10005
|
+
z as inlineContentToNodes,
|
|
10004
10006
|
Ir as insertBlocks,
|
|
10005
|
-
|
|
10007
|
+
I as insertOrUpdateBlock,
|
|
10006
10008
|
ur as isAppleOS,
|
|
10007
10009
|
Ot as isLinkInlineContent,
|
|
10008
10010
|
xt as isNodeBlock,
|