@blocknote/core 0.15.6 → 0.15.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.js +342 -308
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +4 -4
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +2 -2
- package/src/api/parsers/handleFileInsertion.ts +65 -14
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +1 -1
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +1 -1
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +1 -1
- package/src/editor/BlockNoteEditor.ts +18 -7
- package/src/extensions/SideMenu/SideMenuPlugin.ts +1 -1
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +16 -7
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +6 -1
- package/src/schema/blocks/types.ts +1 -1
- package/types/src/api/testUtil/cases/customBlocks.d.ts +6 -6
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +6 -6
- package/types/src/api/testUtil/cases/customStyles.d.ts +6 -6
- package/types/src/blocks/AudioBlockContent/AudioBlockContent.d.ts +3 -3
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +3 -3
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +3 -3
- package/types/src/blocks/defaultBlocks.d.ts +12 -12
- package/types/src/editor/BlockNoteEditor.d.ts +4 -1
- package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +1 -0
- package/types/src/schema/blocks/types.d.ts +1 -1
package/dist/blocknote.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Mt = (e, t, i) => t in e ?
|
|
1
|
+
var St = Object.defineProperty;
|
|
2
|
+
var Mt = (e, t, i) => t in e ? St(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
3
|
var c = (e, t, i) => Mt(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
4
|
import { Slice as j, Fragment as I, DOMSerializer as Ee, DOMParser as Tt, Node as Bt } from "prosemirror-model";
|
|
5
|
-
import { Extension as T, combineTransactionSteps as Lt, getChangedRanges as It, findChildrenInRange as At, Node as q, Mark as
|
|
5
|
+
import { Extension as T, combineTransactionSteps as Lt, getChangedRanges as It, findChildrenInRange as At, Node as q, Mark as Ce, InputRule as te, callOrReturn as Nt, getExtensionField as Pt, mergeAttributes as Ht, selectionToInsertionEnd as Dt, isTextSelection as Ut, isNodeSelection as jt, posToDOMRect as ve, getMarkRange as Ue, findParentNode as zt, findChildren as je, extensions as Y, Editor as Rt, createDocument as Vt, getSchema as Ot } from "@tiptap/core";
|
|
6
6
|
import { Plugin as w, PluginKey as M, Selection as ge, NodeSelection as se, TextSelection as Q, EditorState as Ft } from "prosemirror-state";
|
|
7
7
|
import { v4 as Gt } from "uuid";
|
|
8
8
|
import Kt from "@tiptap/extension-bold";
|
|
@@ -4307,7 +4307,7 @@ const ci = {
|
|
|
4307
4307
|
generic: {
|
|
4308
4308
|
ctrl_shortcut: "Ctrl"
|
|
4309
4309
|
}
|
|
4310
|
-
},
|
|
4310
|
+
}, xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4311
4311
|
__proto__: null,
|
|
4312
4312
|
ar: ci,
|
|
4313
4313
|
de: ui,
|
|
@@ -4459,10 +4459,10 @@ const ne = T.create({
|
|
|
4459
4459
|
if (Pe === null) {
|
|
4460
4460
|
const He = o.doc.type.createAndFill().content;
|
|
4461
4461
|
if (o.doc.content.findDiffStart(He) === null) {
|
|
4462
|
-
const
|
|
4462
|
+
const De = JSON.parse(
|
|
4463
4463
|
JSON.stringify(n.doc.toJSON())
|
|
4464
4464
|
);
|
|
4465
|
-
if (
|
|
4465
|
+
if (De.content[0].content[0].attrs.id = "initialBlockId", JSON.stringify(De.content) === JSON.stringify(He.toJSON())) {
|
|
4466
4466
|
s.setNodeMarkup(N, void 0, {
|
|
4467
4467
|
...B.attrs,
|
|
4468
4468
|
[d]: "initialBlockId"
|
|
@@ -4476,8 +4476,8 @@ const ne = T.create({
|
|
|
4476
4476
|
});
|
|
4477
4477
|
return;
|
|
4478
4478
|
}
|
|
4479
|
-
const { deleted:
|
|
4480
|
-
|
|
4479
|
+
const { deleted: Ct } = h.invert().mapResult(N);
|
|
4480
|
+
Ct && y.includes(Pe) && s.setNodeMarkup(N, void 0, {
|
|
4481
4481
|
...B.attrs,
|
|
4482
4482
|
[d]: u()
|
|
4483
4483
|
});
|
|
@@ -4604,7 +4604,7 @@ class A extends Error {
|
|
|
4604
4604
|
super(`Unreachable case: ${t}`);
|
|
4605
4605
|
}
|
|
4606
4606
|
}
|
|
4607
|
-
function
|
|
4607
|
+
function Er(e, t = !0) {
|
|
4608
4608
|
const { "data-test": i, ...o } = e;
|
|
4609
4609
|
if (Object.keys(o).length > 0 && t)
|
|
4610
4610
|
throw new Error("Object must be empty " + JSON.stringify(e));
|
|
@@ -4625,7 +4625,7 @@ function Re(e, t, i) {
|
|
|
4625
4625
|
return e.text.split(/(\n)/g).filter((n) => n.length > 0).map((n) => n === `
|
|
4626
4626
|
` ? t.nodes.hardBreak.create() : t.text(n, o));
|
|
4627
4627
|
}
|
|
4628
|
-
function
|
|
4628
|
+
function Ci(e, t, i) {
|
|
4629
4629
|
const o = t.marks.link.create({
|
|
4630
4630
|
href: e.href
|
|
4631
4631
|
});
|
|
@@ -4656,7 +4656,7 @@ function xe(e, t, i) {
|
|
|
4656
4656
|
function $(e, t, i) {
|
|
4657
4657
|
const o = [];
|
|
4658
4658
|
for (const n of e)
|
|
4659
|
-
typeof n == "string" ? o.push(...xe(n, t, i)) : Qe(n) ? o.push(...
|
|
4659
|
+
typeof n == "string" ? o.push(...xe(n, t, i)) : Qe(n) ? o.push(...Ci(n, t, i)) : ie(n) ? o.push(...xe([n], t, i)) : o.push(
|
|
4660
4660
|
tt(n, t, i)
|
|
4661
4661
|
);
|
|
4662
4662
|
return o;
|
|
@@ -4722,7 +4722,7 @@ function H(e, t, i) {
|
|
|
4722
4722
|
r.length > 0 ? [n, a] : n
|
|
4723
4723
|
);
|
|
4724
4724
|
}
|
|
4725
|
-
function
|
|
4725
|
+
function Si(e, t, i) {
|
|
4726
4726
|
const o = {
|
|
4727
4727
|
type: "tableContent",
|
|
4728
4728
|
rows: []
|
|
@@ -4733,7 +4733,7 @@ function Ci(e, t, i) {
|
|
|
4733
4733
|
};
|
|
4734
4734
|
n.content.forEach((a) => {
|
|
4735
4735
|
r.cells.push(
|
|
4736
|
-
|
|
4736
|
+
Se(
|
|
4737
4737
|
a.firstChild,
|
|
4738
4738
|
t,
|
|
4739
4739
|
i
|
|
@@ -4742,7 +4742,7 @@ function Ci(e, t, i) {
|
|
|
4742
4742
|
}), o.rows.push(r);
|
|
4743
4743
|
}), o;
|
|
4744
4744
|
}
|
|
4745
|
-
function
|
|
4745
|
+
function Se(e, t, i) {
|
|
4746
4746
|
const o = [];
|
|
4747
4747
|
let n;
|
|
4748
4748
|
return e.content.forEach((r) => {
|
|
@@ -4849,7 +4849,7 @@ function it(e, t, i) {
|
|
|
4849
4849
|
s in d && (o[s] = l);
|
|
4850
4850
|
}
|
|
4851
4851
|
let r;
|
|
4852
|
-
return n.content === "styled" ? r =
|
|
4852
|
+
return n.content === "styled" ? r = Se(
|
|
4853
4853
|
e,
|
|
4854
4854
|
t,
|
|
4855
4855
|
i
|
|
@@ -4896,13 +4896,13 @@ function x(e, t, i, o, n) {
|
|
|
4896
4896
|
);
|
|
4897
4897
|
let p;
|
|
4898
4898
|
if (d.content === "inline")
|
|
4899
|
-
p =
|
|
4899
|
+
p = Se(
|
|
4900
4900
|
a.contentNode,
|
|
4901
4901
|
i,
|
|
4902
4902
|
o
|
|
4903
4903
|
);
|
|
4904
4904
|
else if (d.content === "table")
|
|
4905
|
-
p =
|
|
4905
|
+
p = Si(
|
|
4906
4906
|
a.contentNode,
|
|
4907
4907
|
i,
|
|
4908
4908
|
o
|
|
@@ -5068,20 +5068,20 @@ const de = (e, t) => {
|
|
|
5068
5068
|
n
|
|
5069
5069
|
);
|
|
5070
5070
|
}, i;
|
|
5071
|
-
},
|
|
5071
|
+
}, S = (e) => {
|
|
5072
5072
|
const { contentType: t } = _(
|
|
5073
5073
|
e.state.doc,
|
|
5074
5074
|
e.state.selection.from
|
|
5075
5075
|
);
|
|
5076
5076
|
return t.spec.content;
|
|
5077
5077
|
}, Bi = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
5078
|
-
function
|
|
5078
|
+
function D(e, t = "Ctrl") {
|
|
5079
5079
|
return Bi() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
5080
5080
|
}
|
|
5081
5081
|
function z(...e) {
|
|
5082
5082
|
return e.filter((t) => t).join(" ");
|
|
5083
5083
|
}
|
|
5084
|
-
const
|
|
5084
|
+
const Cr = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
5085
5085
|
function R(e, t, i, o) {
|
|
5086
5086
|
const n = document.createElement("div");
|
|
5087
5087
|
n.className = z(
|
|
@@ -5349,7 +5349,7 @@ function dt(e) {
|
|
|
5349
5349
|
Object.entries(e).map(([t, i]) => [t, i.config])
|
|
5350
5350
|
);
|
|
5351
5351
|
}
|
|
5352
|
-
function
|
|
5352
|
+
function Di(e) {
|
|
5353
5353
|
return [
|
|
5354
5354
|
{
|
|
5355
5355
|
tag: `[data-inline-content-type="${e.type}"]`,
|
|
@@ -5360,7 +5360,7 @@ function Ui(e) {
|
|
|
5360
5360
|
}
|
|
5361
5361
|
];
|
|
5362
5362
|
}
|
|
5363
|
-
function
|
|
5363
|
+
function Mr(e, t) {
|
|
5364
5364
|
const i = q.create({
|
|
5365
5365
|
name: e.type,
|
|
5366
5366
|
inline: !0,
|
|
@@ -5375,7 +5375,7 @@ function Cr(e, t) {
|
|
|
5375
5375
|
return Ni(e);
|
|
5376
5376
|
},
|
|
5377
5377
|
parseHTML() {
|
|
5378
|
-
return
|
|
5378
|
+
return Di(e);
|
|
5379
5379
|
},
|
|
5380
5380
|
renderHTML({ node: o }) {
|
|
5381
5381
|
const n = this.options.editor, r = t.render(
|
|
@@ -5399,7 +5399,7 @@ function Cr(e, t) {
|
|
|
5399
5399
|
e.propSchema
|
|
5400
5400
|
);
|
|
5401
5401
|
}
|
|
5402
|
-
function
|
|
5402
|
+
function Ui(e) {
|
|
5403
5403
|
return e === "boolean" ? {} : {
|
|
5404
5404
|
stringValue: {
|
|
5405
5405
|
default: void 0,
|
|
@@ -5420,7 +5420,7 @@ function ct(e, t) {
|
|
|
5420
5420
|
implementation: t
|
|
5421
5421
|
};
|
|
5422
5422
|
}
|
|
5423
|
-
function
|
|
5423
|
+
function U(e, t) {
|
|
5424
5424
|
return ct(
|
|
5425
5425
|
{
|
|
5426
5426
|
type: e.name,
|
|
@@ -5447,11 +5447,11 @@ function zi(e) {
|
|
|
5447
5447
|
}
|
|
5448
5448
|
];
|
|
5449
5449
|
}
|
|
5450
|
-
function
|
|
5451
|
-
const i =
|
|
5450
|
+
function Tr(e, t) {
|
|
5451
|
+
const i = Ce.create({
|
|
5452
5452
|
name: e.type,
|
|
5453
5453
|
addAttributes() {
|
|
5454
|
-
return
|
|
5454
|
+
return Ui(e.propSchema);
|
|
5455
5455
|
},
|
|
5456
5456
|
parseHTML() {
|
|
5457
5457
|
return zi(e);
|
|
@@ -5624,7 +5624,7 @@ const ue = (e) => {
|
|
|
5624
5624
|
propSchema: Ri,
|
|
5625
5625
|
content: "none",
|
|
5626
5626
|
isFileBlock: !0,
|
|
5627
|
-
|
|
5627
|
+
fileBlockAccept: ["audio/*"]
|
|
5628
5628
|
}, Oi = (e, t) => {
|
|
5629
5629
|
const i = document.createElement("div");
|
|
5630
5630
|
if (i.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
@@ -5747,7 +5747,7 @@ const ue = (e) => {
|
|
|
5747
5747
|
render: qi,
|
|
5748
5748
|
parse: Xi,
|
|
5749
5749
|
toExternalHTML: Zi
|
|
5750
|
-
}),
|
|
5750
|
+
}), Br = async (e) => {
|
|
5751
5751
|
const t = new FormData();
|
|
5752
5752
|
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
5753
5753
|
method: "POST",
|
|
@@ -5786,7 +5786,7 @@ const ue = (e) => {
|
|
|
5786
5786
|
propSchema: Yi,
|
|
5787
5787
|
content: "none",
|
|
5788
5788
|
isFileBlock: !0,
|
|
5789
|
-
|
|
5789
|
+
fileBlockAccept: ["image/*"]
|
|
5790
5790
|
}, eo = (e, t) => {
|
|
5791
5791
|
const i = document.createElement("div");
|
|
5792
5792
|
if (i.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
@@ -5888,7 +5888,7 @@ const ue = (e) => {
|
|
|
5888
5888
|
propSchema: no,
|
|
5889
5889
|
content: "none",
|
|
5890
5890
|
isFileBlock: !0,
|
|
5891
|
-
|
|
5891
|
+
fileBlockAccept: ["video/*"]
|
|
5892
5892
|
}, ao = (e, t) => {
|
|
5893
5893
|
const i = document.createElement("div");
|
|
5894
5894
|
if (i.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
@@ -5958,7 +5958,7 @@ const ue = (e) => {
|
|
|
5958
5958
|
render: ao,
|
|
5959
5959
|
parse: so,
|
|
5960
5960
|
toExternalHTML: lo
|
|
5961
|
-
}), uo =
|
|
5961
|
+
}), uo = Ce.create({
|
|
5962
5962
|
name: "backgroundColor",
|
|
5963
5963
|
addAttributes() {
|
|
5964
5964
|
return {
|
|
@@ -5984,10 +5984,10 @@ const ue = (e) => {
|
|
|
5984
5984
|
renderHTML({ HTMLAttributes: e }) {
|
|
5985
5985
|
return ["span", e, 0];
|
|
5986
5986
|
}
|
|
5987
|
-
}), po =
|
|
5987
|
+
}), po = U(
|
|
5988
5988
|
uo,
|
|
5989
5989
|
"string"
|
|
5990
|
-
), ho =
|
|
5990
|
+
), ho = Ce.create({
|
|
5991
5991
|
name: "textColor",
|
|
5992
5992
|
addAttributes() {
|
|
5993
5993
|
return {
|
|
@@ -6011,7 +6011,7 @@ const ue = (e) => {
|
|
|
6011
6011
|
renderHTML({ HTMLAttributes: e }) {
|
|
6012
6012
|
return ["span", e, 0];
|
|
6013
6013
|
}
|
|
6014
|
-
}), mo =
|
|
6014
|
+
}), mo = U(ho, "string"), fo = {
|
|
6015
6015
|
...k,
|
|
6016
6016
|
level: { default: 1, values: [1, 2, 3] }
|
|
6017
6017
|
}, go = O({
|
|
@@ -6039,7 +6039,7 @@ const ue = (e) => {
|
|
|
6039
6039
|
...[1, 2, 3].map((e) => new te({
|
|
6040
6040
|
find: new RegExp(`^(#{${e}})\\s$`),
|
|
6041
6041
|
handler: ({ state: t, chain: i, range: o }) => {
|
|
6042
|
-
|
|
6042
|
+
S(this.editor) === "inline*" && i().BNUpdateBlock(t.selection.from, {
|
|
6043
6043
|
type: "heading",
|
|
6044
6044
|
props: {
|
|
6045
6045
|
level: e
|
|
@@ -6051,7 +6051,7 @@ const ue = (e) => {
|
|
|
6051
6051
|
},
|
|
6052
6052
|
addKeyboardShortcuts() {
|
|
6053
6053
|
return {
|
|
6054
|
-
"Mod-Alt-1": () =>
|
|
6054
|
+
"Mod-Alt-1": () => S(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6055
6055
|
this.editor.state.selection.anchor,
|
|
6056
6056
|
{
|
|
6057
6057
|
type: "heading",
|
|
@@ -6060,7 +6060,7 @@ const ue = (e) => {
|
|
|
6060
6060
|
}
|
|
6061
6061
|
}
|
|
6062
6062
|
),
|
|
6063
|
-
"Mod-Alt-2": () =>
|
|
6063
|
+
"Mod-Alt-2": () => S(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6064
6064
|
this.editor.state.selection.anchor,
|
|
6065
6065
|
{
|
|
6066
6066
|
type: "heading",
|
|
@@ -6069,7 +6069,7 @@ const ue = (e) => {
|
|
|
6069
6069
|
}
|
|
6070
6070
|
}
|
|
6071
6071
|
),
|
|
6072
|
-
"Mod-Alt-3": () =>
|
|
6072
|
+
"Mod-Alt-3": () => S(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6073
6073
|
this.editor.state.selection.anchor,
|
|
6074
6074
|
{
|
|
6075
6075
|
type: "heading",
|
|
@@ -6154,7 +6154,7 @@ const ue = (e) => {
|
|
|
6154
6154
|
new te({
|
|
6155
6155
|
find: new RegExp("^[-+*]\\s$"),
|
|
6156
6156
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6157
|
-
|
|
6157
|
+
S(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6158
6158
|
type: "bulletListItem",
|
|
6159
6159
|
props: {}
|
|
6160
6160
|
}).deleteRange({ from: i.from, to: i.to });
|
|
@@ -6165,7 +6165,7 @@ const ue = (e) => {
|
|
|
6165
6165
|
addKeyboardShortcuts() {
|
|
6166
6166
|
return {
|
|
6167
6167
|
Enter: () => Be(this.editor),
|
|
6168
|
-
"Mod-Shift-8": () =>
|
|
6168
|
+
"Mod-Shift-8": () => S(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6169
6169
|
this.editor.state.selection.anchor,
|
|
6170
6170
|
{
|
|
6171
6171
|
type: "bulletListItem",
|
|
@@ -6277,7 +6277,7 @@ const ue = (e) => {
|
|
|
6277
6277
|
new te({
|
|
6278
6278
|
find: new RegExp("^1\\.\\s$"),
|
|
6279
6279
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6280
|
-
|
|
6280
|
+
S(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6281
6281
|
type: "numberedListItem",
|
|
6282
6282
|
props: {}
|
|
6283
6283
|
}).deleteRange({ from: i.from, to: i.to });
|
|
@@ -6288,7 +6288,7 @@ const ue = (e) => {
|
|
|
6288
6288
|
addKeyboardShortcuts() {
|
|
6289
6289
|
return {
|
|
6290
6290
|
Enter: () => Be(this.editor),
|
|
6291
|
-
"Mod-Shift-7": () =>
|
|
6291
|
+
"Mod-Shift-7": () => S(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6292
6292
|
this.editor.state.selection.anchor,
|
|
6293
6293
|
{
|
|
6294
6294
|
type: "numberedListItem",
|
|
@@ -6348,10 +6348,10 @@ const ue = (e) => {
|
|
|
6348
6348
|
((i = this.options.domAttributes) == null ? void 0 : i.inlineContent) || {}
|
|
6349
6349
|
);
|
|
6350
6350
|
}
|
|
6351
|
-
}),
|
|
6351
|
+
}), Co = X(
|
|
6352
6352
|
Eo,
|
|
6353
6353
|
xo
|
|
6354
|
-
),
|
|
6354
|
+
), So = {
|
|
6355
6355
|
...k,
|
|
6356
6356
|
checked: {
|
|
6357
6357
|
default: !1
|
|
@@ -6378,7 +6378,7 @@ const ue = (e) => {
|
|
|
6378
6378
|
new te({
|
|
6379
6379
|
find: new RegExp("\\[\\s*\\]\\s$"),
|
|
6380
6380
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6381
|
-
|
|
6381
|
+
S(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6382
6382
|
type: "checkListItem",
|
|
6383
6383
|
props: {
|
|
6384
6384
|
checked: !1
|
|
@@ -6389,7 +6389,7 @@ const ue = (e) => {
|
|
|
6389
6389
|
new te({
|
|
6390
6390
|
find: new RegExp("\\[[Xx]\\]\\s$"),
|
|
6391
6391
|
handler: ({ state: e, chain: t, range: i }) => {
|
|
6392
|
-
|
|
6392
|
+
S(this.editor) === "inline*" && t().BNUpdateBlock(e.selection.from, {
|
|
6393
6393
|
type: "checkListItem",
|
|
6394
6394
|
props: {
|
|
6395
6395
|
checked: !0
|
|
@@ -6402,7 +6402,7 @@ const ue = (e) => {
|
|
|
6402
6402
|
addKeyboardShortcuts() {
|
|
6403
6403
|
return {
|
|
6404
6404
|
Enter: () => Be(this.editor),
|
|
6405
|
-
"Mod-Shift-9": () =>
|
|
6405
|
+
"Mod-Shift-9": () => S(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6406
6406
|
this.editor.state.selection.anchor,
|
|
6407
6407
|
{
|
|
6408
6408
|
type: "checkListItem",
|
|
@@ -6510,7 +6510,7 @@ const ue = (e) => {
|
|
|
6510
6510
|
}
|
|
6511
6511
|
}), To = X(
|
|
6512
6512
|
Mo,
|
|
6513
|
-
|
|
6513
|
+
So
|
|
6514
6514
|
), Bo = {
|
|
6515
6515
|
...k
|
|
6516
6516
|
}, Lo = O({
|
|
@@ -6519,7 +6519,7 @@ const ue = (e) => {
|
|
|
6519
6519
|
group: "blockContent",
|
|
6520
6520
|
addKeyboardShortcuts() {
|
|
6521
6521
|
return {
|
|
6522
|
-
"Mod-Alt-0": () =>
|
|
6522
|
+
"Mod-Alt-0": () => S(this.editor) !== "inline*" ? !0 : this.editor.commands.BNUpdateBlock(
|
|
6523
6523
|
this.editor.state.selection.anchor,
|
|
6524
6524
|
{
|
|
6525
6525
|
type: "paragraph",
|
|
@@ -6637,7 +6637,7 @@ const ue = (e) => {
|
|
|
6637
6637
|
0
|
|
6638
6638
|
];
|
|
6639
6639
|
}
|
|
6640
|
-
}),
|
|
6640
|
+
}), Do = X(
|
|
6641
6641
|
Po,
|
|
6642
6642
|
No,
|
|
6643
6643
|
[
|
|
@@ -6655,49 +6655,49 @@ const ue = (e) => {
|
|
|
6655
6655
|
paragraph: Io,
|
|
6656
6656
|
heading: bo,
|
|
6657
6657
|
bulletListItem: yo,
|
|
6658
|
-
numberedListItem:
|
|
6658
|
+
numberedListItem: Co,
|
|
6659
6659
|
checkListItem: To,
|
|
6660
|
-
table:
|
|
6660
|
+
table: Do,
|
|
6661
6661
|
file: Ji,
|
|
6662
6662
|
image: oo,
|
|
6663
6663
|
video: co,
|
|
6664
6664
|
audio: Ki
|
|
6665
|
-
},
|
|
6666
|
-
bold:
|
|
6667
|
-
italic:
|
|
6668
|
-
underline:
|
|
6669
|
-
strike:
|
|
6670
|
-
code:
|
|
6665
|
+
}, Uo = lt(ht), mt = {
|
|
6666
|
+
bold: U(Kt, "boolean"),
|
|
6667
|
+
italic: U($t, "boolean"),
|
|
6668
|
+
underline: U(Xt, "boolean"),
|
|
6669
|
+
strike: U(qt, "boolean"),
|
|
6670
|
+
code: U(Wt, "boolean"),
|
|
6671
6671
|
textColor: mo,
|
|
6672
6672
|
backgroundColor: po
|
|
6673
|
-
},
|
|
6673
|
+
}, Lr = ut(mt), ft = {
|
|
6674
6674
|
text: { config: "text", implementation: {} },
|
|
6675
6675
|
link: { config: "link", implementation: {} }
|
|
6676
6676
|
}, jo = dt(
|
|
6677
6677
|
ft
|
|
6678
6678
|
);
|
|
6679
|
-
function
|
|
6680
|
-
return e in t.schema.blockSchema && t.schema.blockSchema[e] ===
|
|
6679
|
+
function C(e, t) {
|
|
6680
|
+
return e in t.schema.blockSchema && t.schema.blockSchema[e] === Uo[e];
|
|
6681
6681
|
}
|
|
6682
6682
|
function zo(e, t) {
|
|
6683
6683
|
return e in t.schema.inlineContentSchema && t.schema.inlineContentSchema[e] === jo[e];
|
|
6684
6684
|
}
|
|
6685
6685
|
function Ro(e, t, i) {
|
|
6686
|
-
return t.type === e && t.type in i.schema.blockSchema &&
|
|
6686
|
+
return t.type === e && t.type in i.schema.blockSchema && C(t.type, i);
|
|
6687
6687
|
}
|
|
6688
|
-
function
|
|
6688
|
+
function Ir(e, t) {
|
|
6689
6689
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock || !1;
|
|
6690
6690
|
}
|
|
6691
|
-
function
|
|
6691
|
+
function Ar(e, t) {
|
|
6692
6692
|
return e.type in t.schema.blockSchema && t.schema.blockSchema[e.type].isFileBlock && "showPreview" in t.schema.blockSchema[e.type].propSchema || !1;
|
|
6693
6693
|
}
|
|
6694
|
-
function
|
|
6694
|
+
function Nr(e, t) {
|
|
6695
6695
|
return t.schema.blockSchema[e.type].isFileBlock && !e.props.url;
|
|
6696
6696
|
}
|
|
6697
6697
|
function Vo(e, t, i) {
|
|
6698
6698
|
return t in i.schema.blockSchema && e in i.schema.blockSchema[t].propSchema && i.schema.blockSchema[t].propSchema[e] === k[e];
|
|
6699
6699
|
}
|
|
6700
|
-
function
|
|
6700
|
+
function Pr(e, t, i) {
|
|
6701
6701
|
return Vo(e, t.type, i);
|
|
6702
6702
|
}
|
|
6703
6703
|
function Le(e, t) {
|
|
@@ -6837,7 +6837,7 @@ function Wo(e, t, i, o = { updateSelection: !0 }) {
|
|
|
6837
6837
|
const { parent: u } = n.doc.resolve(r);
|
|
6838
6838
|
u.isTextblock && !u.type.spec.code && !u.childCount && (r -= 1, a += 1);
|
|
6839
6839
|
}
|
|
6840
|
-
return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), o.updateSelection &&
|
|
6840
|
+
return s ? n.insertText(d, r, a) : n.replaceWith(r, a, t), o.updateSelection && Dt(n, n.steps.length - 1, -1), i.dispatch(n), !0;
|
|
6841
6841
|
}
|
|
6842
6842
|
function $o() {
|
|
6843
6843
|
const e = (t) => {
|
|
@@ -7096,7 +7096,7 @@ class an {
|
|
|
7096
7096
|
c(this, "preventHide", !1);
|
|
7097
7097
|
c(this, "preventShow", !1);
|
|
7098
7098
|
c(this, "shouldShow", ({ state: t, from: i, to: o, view: n }) => {
|
|
7099
|
-
const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(i, o).length &&
|
|
7099
|
+
const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(i, o).length && Ut(t.selection);
|
|
7100
7100
|
return !(!n.hasFocus() || s || l);
|
|
7101
7101
|
});
|
|
7102
7102
|
c(this, "blurHandler", (t) => {
|
|
@@ -7220,7 +7220,7 @@ class dn {
|
|
|
7220
7220
|
const i = t.target, o = this.pmView.posAtDOM(i, 0) + 1, n = this.pmView.state.doc.resolve(o), r = n.marks();
|
|
7221
7221
|
for (const a of r)
|
|
7222
7222
|
if (a.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
7223
|
-
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange =
|
|
7223
|
+
this.mouseHoveredLinkMark = a, this.mouseHoveredLinkMarkRange = Ue(n, a.type, a.attrs) || void 0;
|
|
7224
7224
|
break;
|
|
7225
7225
|
}
|
|
7226
7226
|
}
|
|
@@ -7292,7 +7292,7 @@ class dn {
|
|
|
7292
7292
|
const o = this.pmView.state.selection.$from.marks();
|
|
7293
7293
|
for (const n of o)
|
|
7294
7294
|
if (n.type.name === this.pmView.state.schema.mark("link").type.name) {
|
|
7295
|
-
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange =
|
|
7295
|
+
this.keyboardHoveredLinkMark = n, this.keyboardHoveredLinkMarkRange = Ue(
|
|
7296
7296
|
this.pmView.state.selection.$from,
|
|
7297
7297
|
n.type,
|
|
7298
7298
|
n.attrs
|
|
@@ -7714,7 +7714,7 @@ class fn {
|
|
|
7714
7714
|
this.editor._tiptapEditor.chain().BNCreateBlock(d).setTextSelection(u).run();
|
|
7715
7715
|
} else
|
|
7716
7716
|
this.editor._tiptapEditor.commands.setTextSelection(a + 1);
|
|
7717
|
-
this.editor.
|
|
7717
|
+
this.editor.openSuggestionMenu("/");
|
|
7718
7718
|
}
|
|
7719
7719
|
}
|
|
7720
7720
|
const gn = new M("SideMenuPlugin");
|
|
@@ -7789,14 +7789,18 @@ class kn {
|
|
|
7789
7789
|
});
|
|
7790
7790
|
c(this, "clearQuery", () => {
|
|
7791
7791
|
this.pluginState !== void 0 && this.editor._tiptapEditor.chain().focus().deleteRange({
|
|
7792
|
-
from: this.pluginState.queryStartPos - (this.pluginState.
|
|
7792
|
+
from: this.pluginState.queryStartPos - (this.pluginState.deleteTriggerCharacter ? this.pluginState.triggerCharacter.length : 0),
|
|
7793
7793
|
to: this.editor._tiptapEditor.state.selection.from
|
|
7794
7794
|
}).run();
|
|
7795
7795
|
});
|
|
7796
7796
|
this.editor = t, this.pluginState = void 0, this.emitUpdate = (o) => {
|
|
7797
|
+
var n;
|
|
7797
7798
|
if (!this.state)
|
|
7798
7799
|
throw new Error("Attempting to update uninitialized suggestions menu");
|
|
7799
|
-
i(o,
|
|
7800
|
+
i(o, {
|
|
7801
|
+
...this.state,
|
|
7802
|
+
ignoreQueryLength: (n = this.pluginState) == null ? void 0 : n.ignoreQueryLength
|
|
7803
|
+
});
|
|
7800
7804
|
}, this.rootEl = this.editor._tiptapEditor.view.root, this.rootEl.addEventListener("scroll", this.handleScroll, !0);
|
|
7801
7805
|
}
|
|
7802
7806
|
update(t, i) {
|
|
@@ -7863,10 +7867,11 @@ class yn extends Z {
|
|
|
7863
7867
|
if (typeof l == "object" && l !== null && r === void 0)
|
|
7864
7868
|
return {
|
|
7865
7869
|
triggerCharacter: l.triggerCharacter,
|
|
7866
|
-
|
|
7870
|
+
deleteTriggerCharacter: l.deleteTriggerCharacter !== !1,
|
|
7867
7871
|
queryStartPos: s.selection.from,
|
|
7868
7872
|
query: "",
|
|
7869
|
-
decorationId: `id_${Math.floor(Math.random() * 4294967295)}
|
|
7873
|
+
decorationId: `id_${Math.floor(Math.random() * 4294967295)}`,
|
|
7874
|
+
ignoreQueryLength: l == null ? void 0 : l.ignoreQueryLength
|
|
7870
7875
|
};
|
|
7871
7876
|
if (r === void 0)
|
|
7872
7877
|
return r;
|
|
@@ -7900,7 +7905,7 @@ class yn extends Z {
|
|
|
7900
7905
|
const r = this.getState(n);
|
|
7901
7906
|
if (r === void 0)
|
|
7902
7907
|
return null;
|
|
7903
|
-
if (!r.
|
|
7908
|
+
if (!r.deleteTriggerCharacter) {
|
|
7904
7909
|
const a = _n(n.selection);
|
|
7905
7910
|
if (a)
|
|
7906
7911
|
return K.create(n.doc, [
|
|
@@ -7938,7 +7943,7 @@ class yn extends Z {
|
|
|
7938
7943
|
return ((o = (i = this.view) == null ? void 0 : i.state) == null ? void 0 : o.show) || !1;
|
|
7939
7944
|
}
|
|
7940
7945
|
}
|
|
7941
|
-
function
|
|
7946
|
+
function Hr(e, t) {
|
|
7942
7947
|
e.suggestionMenus.addTriggerCharacter(t);
|
|
7943
7948
|
}
|
|
7944
7949
|
let v;
|
|
@@ -8100,7 +8105,7 @@ class En {
|
|
|
8100
8105
|
}
|
|
8101
8106
|
}
|
|
8102
8107
|
const ee = new M("TableHandlesPlugin");
|
|
8103
|
-
class
|
|
8108
|
+
class Cn extends Z {
|
|
8104
8109
|
constructor(i) {
|
|
8105
8110
|
super();
|
|
8106
8111
|
c(this, "view");
|
|
@@ -8249,7 +8254,7 @@ async function Xe(e, t) {
|
|
|
8249
8254
|
), s = await Ie(a);
|
|
8250
8255
|
return { internalHTML: n, externalHTML: a, plainText: s };
|
|
8251
8256
|
}
|
|
8252
|
-
const
|
|
8257
|
+
const Sn = (e) => T.create({
|
|
8253
8258
|
name: "copyToClipboard",
|
|
8254
8259
|
addProseMirrorPlugins() {
|
|
8255
8260
|
return [
|
|
@@ -8289,186 +8294,17 @@ const Cn = (e) => T.create({
|
|
|
8289
8294
|
})
|
|
8290
8295
|
];
|
|
8291
8296
|
}
|
|
8292
|
-
})
|
|
8293
|
-
function Mn(e) {
|
|
8294
|
-
let t = e.getTextCursorPosition().block, i = e.schema.blockSchema[t.type].content;
|
|
8295
|
-
for (; i === "none"; )
|
|
8296
|
-
t = e.getTextCursorPosition().nextBlock, i = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
|
|
8297
|
-
}
|
|
8298
|
-
function E(e, t) {
|
|
8299
|
-
const i = e.getTextCursorPosition().block;
|
|
8300
|
-
if (i.content === void 0)
|
|
8301
|
-
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
8302
|
-
Array.isArray(i.content) && (i.content.length === 1 && ie(i.content[0]) && i.content[0].type === "text" && i.content[0].text === "/" || i.content.length === 0) ? e.updateBlock(i, t) : (e.insertBlocks([t], i, "after"), e.setTextCursorPosition(
|
|
8303
|
-
e.getTextCursorPosition().nextBlock,
|
|
8304
|
-
"end"
|
|
8305
|
-
));
|
|
8306
|
-
const o = e.getTextCursorPosition().block;
|
|
8307
|
-
return Mn(e), o;
|
|
8308
|
-
}
|
|
8309
|
-
function Hr(e) {
|
|
8310
|
-
const t = [];
|
|
8311
|
-
return S("heading", e) && t.push(
|
|
8312
|
-
{
|
|
8313
|
-
onItemClick: () => {
|
|
8314
|
-
E(e, {
|
|
8315
|
-
type: "heading",
|
|
8316
|
-
props: { level: 1 }
|
|
8317
|
-
});
|
|
8318
|
-
},
|
|
8319
|
-
badge: U("Mod-Alt-1"),
|
|
8320
|
-
key: "heading",
|
|
8321
|
-
...e.dictionary.slash_menu.heading
|
|
8322
|
-
},
|
|
8323
|
-
{
|
|
8324
|
-
onItemClick: () => {
|
|
8325
|
-
E(e, {
|
|
8326
|
-
type: "heading",
|
|
8327
|
-
props: { level: 2 }
|
|
8328
|
-
});
|
|
8329
|
-
},
|
|
8330
|
-
badge: U("Mod-Alt-2"),
|
|
8331
|
-
key: "heading_2",
|
|
8332
|
-
...e.dictionary.slash_menu.heading_2
|
|
8333
|
-
},
|
|
8334
|
-
{
|
|
8335
|
-
onItemClick: () => {
|
|
8336
|
-
E(e, {
|
|
8337
|
-
type: "heading",
|
|
8338
|
-
props: { level: 3 }
|
|
8339
|
-
});
|
|
8340
|
-
},
|
|
8341
|
-
badge: U("Mod-Alt-3"),
|
|
8342
|
-
key: "heading_3",
|
|
8343
|
-
...e.dictionary.slash_menu.heading_3
|
|
8344
|
-
}
|
|
8345
|
-
), S("numberedListItem", e) && t.push({
|
|
8346
|
-
onItemClick: () => {
|
|
8347
|
-
E(e, {
|
|
8348
|
-
type: "numberedListItem"
|
|
8349
|
-
});
|
|
8350
|
-
},
|
|
8351
|
-
badge: U("Mod-Shift-7"),
|
|
8352
|
-
key: "numbered_list",
|
|
8353
|
-
...e.dictionary.slash_menu.numbered_list
|
|
8354
|
-
}), S("bulletListItem", e) && t.push({
|
|
8355
|
-
onItemClick: () => {
|
|
8356
|
-
E(e, {
|
|
8357
|
-
type: "bulletListItem"
|
|
8358
|
-
});
|
|
8359
|
-
},
|
|
8360
|
-
badge: U("Mod-Shift-8"),
|
|
8361
|
-
key: "bullet_list",
|
|
8362
|
-
...e.dictionary.slash_menu.bullet_list
|
|
8363
|
-
}), S("checkListItem", e) && t.push({
|
|
8364
|
-
onItemClick: () => {
|
|
8365
|
-
E(e, {
|
|
8366
|
-
type: "checkListItem"
|
|
8367
|
-
});
|
|
8368
|
-
},
|
|
8369
|
-
badge: U("Mod-Shift-9"),
|
|
8370
|
-
key: "check_list",
|
|
8371
|
-
...e.dictionary.slash_menu.check_list
|
|
8372
|
-
}), S("paragraph", e) && t.push({
|
|
8373
|
-
onItemClick: () => {
|
|
8374
|
-
E(e, {
|
|
8375
|
-
type: "paragraph"
|
|
8376
|
-
});
|
|
8377
|
-
},
|
|
8378
|
-
badge: U("Mod-Alt-0"),
|
|
8379
|
-
key: "paragraph",
|
|
8380
|
-
...e.dictionary.slash_menu.paragraph
|
|
8381
|
-
}), S("table", e) && t.push({
|
|
8382
|
-
onItemClick: () => {
|
|
8383
|
-
E(e, {
|
|
8384
|
-
type: "table",
|
|
8385
|
-
content: {
|
|
8386
|
-
type: "tableContent",
|
|
8387
|
-
rows: [
|
|
8388
|
-
{
|
|
8389
|
-
cells: ["", "", ""]
|
|
8390
|
-
},
|
|
8391
|
-
{
|
|
8392
|
-
cells: ["", "", ""]
|
|
8393
|
-
}
|
|
8394
|
-
]
|
|
8395
|
-
}
|
|
8396
|
-
});
|
|
8397
|
-
},
|
|
8398
|
-
badge: void 0,
|
|
8399
|
-
key: "table",
|
|
8400
|
-
...e.dictionary.slash_menu.table
|
|
8401
|
-
}), S("image", e) && t.push({
|
|
8402
|
-
onItemClick: () => {
|
|
8403
|
-
const i = E(e, {
|
|
8404
|
-
type: "image"
|
|
8405
|
-
});
|
|
8406
|
-
e.dispatch(
|
|
8407
|
-
e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
|
|
8408
|
-
block: i
|
|
8409
|
-
})
|
|
8410
|
-
);
|
|
8411
|
-
},
|
|
8412
|
-
key: "image",
|
|
8413
|
-
...e.dictionary.slash_menu.image
|
|
8414
|
-
}), S("video", e) && t.push({
|
|
8415
|
-
onItemClick: () => {
|
|
8416
|
-
const i = E(e, {
|
|
8417
|
-
type: "video"
|
|
8418
|
-
});
|
|
8419
|
-
e.dispatch(
|
|
8420
|
-
e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
|
|
8421
|
-
block: i
|
|
8422
|
-
})
|
|
8423
|
-
);
|
|
8424
|
-
},
|
|
8425
|
-
key: "video",
|
|
8426
|
-
...e.dictionary.slash_menu.video
|
|
8427
|
-
}), S("audio", e) && t.push({
|
|
8428
|
-
onItemClick: () => {
|
|
8429
|
-
const i = E(e, {
|
|
8430
|
-
type: "audio"
|
|
8431
|
-
});
|
|
8432
|
-
e.dispatch(
|
|
8433
|
-
e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
|
|
8434
|
-
block: i
|
|
8435
|
-
})
|
|
8436
|
-
);
|
|
8437
|
-
},
|
|
8438
|
-
key: "audio",
|
|
8439
|
-
...e.dictionary.slash_menu.audio
|
|
8440
|
-
}), S("file", e) && t.push({
|
|
8441
|
-
onItemClick: () => {
|
|
8442
|
-
const i = E(e, {
|
|
8443
|
-
type: "file"
|
|
8444
|
-
});
|
|
8445
|
-
e.dispatch(
|
|
8446
|
-
e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
|
|
8447
|
-
block: i
|
|
8448
|
-
})
|
|
8449
|
-
);
|
|
8450
|
-
},
|
|
8451
|
-
key: "image",
|
|
8452
|
-
...e.dictionary.slash_menu.file
|
|
8453
|
-
}), t.push({
|
|
8454
|
-
onItemClick: () => e.openSelectionMenu(":"),
|
|
8455
|
-
key: "emoji",
|
|
8456
|
-
...e.dictionary.slash_menu.emoji
|
|
8457
|
-
}), t;
|
|
8458
|
-
}
|
|
8459
|
-
function Ur(e, t) {
|
|
8460
|
-
return e.filter(
|
|
8461
|
-
({ title: i, aliases: o }) => i.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
|
|
8462
|
-
(n) => n.toLowerCase().includes(t.toLowerCase())
|
|
8463
|
-
).length !== 0
|
|
8464
|
-
);
|
|
8465
|
-
}
|
|
8466
|
-
const Ae = [
|
|
8297
|
+
}), Ae = [
|
|
8467
8298
|
"blocknote/html",
|
|
8468
8299
|
"Files",
|
|
8469
8300
|
"text/html",
|
|
8470
8301
|
"text/plain"
|
|
8471
8302
|
];
|
|
8303
|
+
function Mn(e, t) {
|
|
8304
|
+
if (!e.startsWith(".") || !t.startsWith("."))
|
|
8305
|
+
throw new Error("The strings provided are not valid file extensions.");
|
|
8306
|
+
return e === t;
|
|
8307
|
+
}
|
|
8472
8308
|
function Tn(e, t) {
|
|
8473
8309
|
const i = e.split("/"), o = t.split("/");
|
|
8474
8310
|
if (i.length !== 2)
|
|
@@ -8501,23 +8337,41 @@ async function yt(e, t) {
|
|
|
8501
8337
|
for (let a = 0; a < n.length; a++) {
|
|
8502
8338
|
let s = "file";
|
|
8503
8339
|
for (const d of r)
|
|
8504
|
-
for (const u of d.
|
|
8505
|
-
|
|
8340
|
+
for (const u of d.fileBlockAccept || []) {
|
|
8341
|
+
const p = u.startsWith("."), h = n[a].getAsFile();
|
|
8342
|
+
if (h && (!p && h.type && Tn(n[a].type, u) || p && Mn(
|
|
8343
|
+
"." + h.name.split(".").pop(),
|
|
8344
|
+
u
|
|
8345
|
+
))) {
|
|
8506
8346
|
s = d.type;
|
|
8507
8347
|
break;
|
|
8508
8348
|
}
|
|
8349
|
+
}
|
|
8509
8350
|
const l = n[a].getAsFile();
|
|
8510
8351
|
if (l) {
|
|
8511
|
-
const d = await t.uploadFile(l)
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8352
|
+
const d = await t.uploadFile(l), u = typeof d == "string" ? {
|
|
8353
|
+
type: s,
|
|
8354
|
+
props: {
|
|
8355
|
+
name: l.name,
|
|
8356
|
+
url: d
|
|
8357
|
+
}
|
|
8358
|
+
} : { type: s, ...d };
|
|
8359
|
+
if (e.type === "paste" && t.insertBlocks(
|
|
8360
|
+
[u],
|
|
8361
|
+
t.getTextCursorPosition().block,
|
|
8362
|
+
"after"
|
|
8363
|
+
), e.type === "drop") {
|
|
8364
|
+
const p = {
|
|
8365
|
+
left: e.clientX,
|
|
8366
|
+
top: e.clientY
|
|
8367
|
+
}, h = t._tiptapEditor.view.posAtCoords(p);
|
|
8368
|
+
if (!h)
|
|
8369
|
+
return;
|
|
8370
|
+
const m = _(
|
|
8371
|
+
t._tiptapEditor.state.doc,
|
|
8372
|
+
h.pos
|
|
8373
|
+
);
|
|
8374
|
+
t.insertBlocks([u], m.id, "after");
|
|
8521
8375
|
}
|
|
8522
8376
|
}
|
|
8523
8377
|
}
|
|
@@ -8670,7 +8524,7 @@ const Bn = (e) => T.create({
|
|
|
8670
8524
|
})
|
|
8671
8525
|
];
|
|
8672
8526
|
}
|
|
8673
|
-
}), Hn = new M("non-editable-block"),
|
|
8527
|
+
}), Hn = new M("non-editable-block"), Dn = () => new w({
|
|
8674
8528
|
key: Hn,
|
|
8675
8529
|
props: {
|
|
8676
8530
|
handleKeyDown: (e, t) => {
|
|
@@ -8696,7 +8550,7 @@ const Bn = (e) => T.create({
|
|
|
8696
8550
|
return !1;
|
|
8697
8551
|
}
|
|
8698
8552
|
}
|
|
8699
|
-
}), Ze = new M("previous-blocks"),
|
|
8553
|
+
}), Ze = new M("previous-blocks"), Un = {
|
|
8700
8554
|
// Numbered List Items
|
|
8701
8555
|
index: "index",
|
|
8702
8556
|
// Headings
|
|
@@ -8773,7 +8627,7 @@ const Bn = (e) => T.create({
|
|
|
8773
8627
|
return;
|
|
8774
8628
|
const a = i.currentTransactionOldBlockAttrs[n.attrs.id], s = {};
|
|
8775
8629
|
for (const [d, u] of Object.entries(a))
|
|
8776
|
-
s["data-prev-" +
|
|
8630
|
+
s["data-prev-" + Un[d]] = u || "none";
|
|
8777
8631
|
const l = W.node(r, r + n.nodeSize, {
|
|
8778
8632
|
...s
|
|
8779
8633
|
});
|
|
@@ -9012,7 +8866,7 @@ const Bn = (e) => T.create({
|
|
|
9012
8866
|
};
|
|
9013
8867
|
},
|
|
9014
8868
|
addProseMirrorPlugins() {
|
|
9015
|
-
return [jn(),
|
|
8869
|
+
return [jn(), Dn()];
|
|
9016
8870
|
},
|
|
9017
8871
|
addKeyboardShortcuts() {
|
|
9018
8872
|
return {
|
|
@@ -9217,7 +9071,7 @@ const Bn = (e) => T.create({
|
|
|
9217
9071
|
domAttributes: e.domAttributes
|
|
9218
9072
|
})
|
|
9219
9073
|
]),
|
|
9220
|
-
|
|
9074
|
+
Sn(e.editor),
|
|
9221
9075
|
Bn(e.editor),
|
|
9222
9076
|
Ln(e.editor),
|
|
9223
9077
|
ni.configure({ width: 5, color: "#ddeeff" }),
|
|
@@ -9523,7 +9377,7 @@ class vt {
|
|
|
9523
9377
|
...t.placeholders
|
|
9524
9378
|
}
|
|
9525
9379
|
};
|
|
9526
|
-
this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, this.formattingToolbar = new ln(this), this.linkToolbar = new un(this), this.sideMenu = new bn(this), this.suggestionMenus = new yn(this), this.filePanel = new rn(this),
|
|
9380
|
+
this.schema = o.schema, this.blockImplementations = o.schema.blockSpecs, this.inlineContentImplementations = o.schema.inlineContentSpecs, this.styleImplementations = o.schema.styleSpecs, this.formattingToolbar = new ln(this), this.linkToolbar = new un(this), this.sideMenu = new bn(this), this.suggestionMenus = new yn(this), this.filePanel = new rn(this), C("table", this) && (this.tableHandles = new Cn(this));
|
|
9527
9381
|
const n = Fn({
|
|
9528
9382
|
editor: this,
|
|
9529
9383
|
domAttributes: o.domAttributes || {},
|
|
@@ -10077,11 +9931,13 @@ class vt {
|
|
|
10077
9931
|
this._tiptapEditor.off("selectionUpdate", i);
|
|
10078
9932
|
};
|
|
10079
9933
|
}
|
|
10080
|
-
|
|
9934
|
+
openSuggestionMenu(t, i) {
|
|
9935
|
+
const o = this.prosemirrorView.state.tr, n = i && i.deleteTriggerCharacter ? o.insertText(t) : o;
|
|
10081
9936
|
this.prosemirrorView.focus(), this.prosemirrorView.dispatch(
|
|
10082
|
-
|
|
9937
|
+
n.scrollIntoView().setMeta(this.suggestionMenus.plugin, {
|
|
10083
9938
|
triggerCharacter: t,
|
|
10084
|
-
|
|
9939
|
+
deleteTriggerCharacter: (i == null ? void 0 : i.deleteTriggerCharacter) || !1,
|
|
9940
|
+
ignoreQueryLength: (i == null ? void 0 : i.ignoreQueryLength) || !1
|
|
10085
9941
|
})
|
|
10086
9942
|
);
|
|
10087
9943
|
}
|
|
@@ -10101,6 +9957,184 @@ async function Dr(e, t) {
|
|
|
10101
9957
|
onItemClick: () => e.insertInlineContent(n.skins[0].native + " ")
|
|
10102
9958
|
}));
|
|
10103
9959
|
}
|
|
9960
|
+
function Xn(e) {
|
|
9961
|
+
let t = e.getTextCursorPosition().block, i = e.schema.blockSchema[t.type].content;
|
|
9962
|
+
for (; i === "none"; )
|
|
9963
|
+
t = e.getTextCursorPosition().nextBlock, i = e.schema.blockSchema[t.type].content, e.setTextCursorPosition(t, "end");
|
|
9964
|
+
}
|
|
9965
|
+
function E(e, t) {
|
|
9966
|
+
const i = e.getTextCursorPosition().block;
|
|
9967
|
+
if (i.content === void 0)
|
|
9968
|
+
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
9969
|
+
Array.isArray(i.content) && (i.content.length === 1 && ie(i.content[0]) && i.content[0].type === "text" && i.content[0].text === "/" || i.content.length === 0) ? e.updateBlock(i, t) : (e.insertBlocks([t], i, "after"), e.setTextCursorPosition(
|
|
9970
|
+
e.getTextCursorPosition().nextBlock,
|
|
9971
|
+
"end"
|
|
9972
|
+
));
|
|
9973
|
+
const o = e.getTextCursorPosition().block;
|
|
9974
|
+
return Xn(e), o;
|
|
9975
|
+
}
|
|
9976
|
+
function Ur(e) {
|
|
9977
|
+
const t = [];
|
|
9978
|
+
return C("heading", e) && t.push(
|
|
9979
|
+
{
|
|
9980
|
+
onItemClick: () => {
|
|
9981
|
+
E(e, {
|
|
9982
|
+
type: "heading",
|
|
9983
|
+
props: { level: 1 }
|
|
9984
|
+
});
|
|
9985
|
+
},
|
|
9986
|
+
badge: D("Mod-Alt-1"),
|
|
9987
|
+
key: "heading",
|
|
9988
|
+
...e.dictionary.slash_menu.heading
|
|
9989
|
+
},
|
|
9990
|
+
{
|
|
9991
|
+
onItemClick: () => {
|
|
9992
|
+
E(e, {
|
|
9993
|
+
type: "heading",
|
|
9994
|
+
props: { level: 2 }
|
|
9995
|
+
});
|
|
9996
|
+
},
|
|
9997
|
+
badge: D("Mod-Alt-2"),
|
|
9998
|
+
key: "heading_2",
|
|
9999
|
+
...e.dictionary.slash_menu.heading_2
|
|
10000
|
+
},
|
|
10001
|
+
{
|
|
10002
|
+
onItemClick: () => {
|
|
10003
|
+
E(e, {
|
|
10004
|
+
type: "heading",
|
|
10005
|
+
props: { level: 3 }
|
|
10006
|
+
});
|
|
10007
|
+
},
|
|
10008
|
+
badge: D("Mod-Alt-3"),
|
|
10009
|
+
key: "heading_3",
|
|
10010
|
+
...e.dictionary.slash_menu.heading_3
|
|
10011
|
+
}
|
|
10012
|
+
), C("numberedListItem", e) && t.push({
|
|
10013
|
+
onItemClick: () => {
|
|
10014
|
+
E(e, {
|
|
10015
|
+
type: "numberedListItem"
|
|
10016
|
+
});
|
|
10017
|
+
},
|
|
10018
|
+
badge: D("Mod-Shift-7"),
|
|
10019
|
+
key: "numbered_list",
|
|
10020
|
+
...e.dictionary.slash_menu.numbered_list
|
|
10021
|
+
}), C("bulletListItem", e) && t.push({
|
|
10022
|
+
onItemClick: () => {
|
|
10023
|
+
E(e, {
|
|
10024
|
+
type: "bulletListItem"
|
|
10025
|
+
});
|
|
10026
|
+
},
|
|
10027
|
+
badge: D("Mod-Shift-8"),
|
|
10028
|
+
key: "bullet_list",
|
|
10029
|
+
...e.dictionary.slash_menu.bullet_list
|
|
10030
|
+
}), C("checkListItem", e) && t.push({
|
|
10031
|
+
onItemClick: () => {
|
|
10032
|
+
E(e, {
|
|
10033
|
+
type: "checkListItem"
|
|
10034
|
+
});
|
|
10035
|
+
},
|
|
10036
|
+
badge: D("Mod-Shift-9"),
|
|
10037
|
+
key: "check_list",
|
|
10038
|
+
...e.dictionary.slash_menu.check_list
|
|
10039
|
+
}), C("paragraph", e) && t.push({
|
|
10040
|
+
onItemClick: () => {
|
|
10041
|
+
E(e, {
|
|
10042
|
+
type: "paragraph"
|
|
10043
|
+
});
|
|
10044
|
+
},
|
|
10045
|
+
badge: D("Mod-Alt-0"),
|
|
10046
|
+
key: "paragraph",
|
|
10047
|
+
...e.dictionary.slash_menu.paragraph
|
|
10048
|
+
}), C("table", e) && t.push({
|
|
10049
|
+
onItemClick: () => {
|
|
10050
|
+
E(e, {
|
|
10051
|
+
type: "table",
|
|
10052
|
+
content: {
|
|
10053
|
+
type: "tableContent",
|
|
10054
|
+
rows: [
|
|
10055
|
+
{
|
|
10056
|
+
cells: ["", "", ""]
|
|
10057
|
+
},
|
|
10058
|
+
{
|
|
10059
|
+
cells: ["", "", ""]
|
|
10060
|
+
}
|
|
10061
|
+
]
|
|
10062
|
+
}
|
|
10063
|
+
});
|
|
10064
|
+
},
|
|
10065
|
+
badge: void 0,
|
|
10066
|
+
key: "table",
|
|
10067
|
+
...e.dictionary.slash_menu.table
|
|
10068
|
+
}), C("image", e) && t.push({
|
|
10069
|
+
onItemClick: () => {
|
|
10070
|
+
const i = E(e, {
|
|
10071
|
+
type: "image"
|
|
10072
|
+
});
|
|
10073
|
+
e.dispatch(
|
|
10074
|
+
e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
|
|
10075
|
+
block: i
|
|
10076
|
+
})
|
|
10077
|
+
);
|
|
10078
|
+
},
|
|
10079
|
+
key: "image",
|
|
10080
|
+
...e.dictionary.slash_menu.image
|
|
10081
|
+
}), C("video", e) && t.push({
|
|
10082
|
+
onItemClick: () => {
|
|
10083
|
+
const i = E(e, {
|
|
10084
|
+
type: "video"
|
|
10085
|
+
});
|
|
10086
|
+
e.dispatch(
|
|
10087
|
+
e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
|
|
10088
|
+
block: i
|
|
10089
|
+
})
|
|
10090
|
+
);
|
|
10091
|
+
},
|
|
10092
|
+
key: "video",
|
|
10093
|
+
...e.dictionary.slash_menu.video
|
|
10094
|
+
}), C("audio", e) && t.push({
|
|
10095
|
+
onItemClick: () => {
|
|
10096
|
+
const i = E(e, {
|
|
10097
|
+
type: "audio"
|
|
10098
|
+
});
|
|
10099
|
+
e.dispatch(
|
|
10100
|
+
e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
|
|
10101
|
+
block: i
|
|
10102
|
+
})
|
|
10103
|
+
);
|
|
10104
|
+
},
|
|
10105
|
+
key: "audio",
|
|
10106
|
+
...e.dictionary.slash_menu.audio
|
|
10107
|
+
}), C("file", e) && t.push({
|
|
10108
|
+
onItemClick: () => {
|
|
10109
|
+
const i = E(e, {
|
|
10110
|
+
type: "file"
|
|
10111
|
+
});
|
|
10112
|
+
e.dispatch(
|
|
10113
|
+
e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin, {
|
|
10114
|
+
block: i
|
|
10115
|
+
})
|
|
10116
|
+
);
|
|
10117
|
+
},
|
|
10118
|
+
key: "image",
|
|
10119
|
+
...e.dictionary.slash_menu.file
|
|
10120
|
+
}), t.push({
|
|
10121
|
+
onItemClick: () => {
|
|
10122
|
+
e.openSuggestionMenu(":", {
|
|
10123
|
+
deleteTriggerCharacter: !0,
|
|
10124
|
+
ignoreQueryLength: !0
|
|
10125
|
+
});
|
|
10126
|
+
},
|
|
10127
|
+
key: "emoji",
|
|
10128
|
+
...e.dictionary.slash_menu.emoji
|
|
10129
|
+
}), t;
|
|
10130
|
+
}
|
|
10131
|
+
function jr(e, t) {
|
|
10132
|
+
return e.filter(
|
|
10133
|
+
({ title: i, aliases: o }) => i.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
|
|
10134
|
+
(n) => n.toLowerCase().includes(t.toLowerCase())
|
|
10135
|
+
).length !== 0
|
|
10136
|
+
);
|
|
10137
|
+
}
|
|
10104
10138
|
function we(e = "") {
|
|
10105
10139
|
return typeof e == "string" ? [
|
|
10106
10140
|
{
|
|
@@ -10120,7 +10154,7 @@ function xt(e) {
|
|
|
10120
10154
|
content: xt(t.content)
|
|
10121
10155
|
}) : e;
|
|
10122
10156
|
}
|
|
10123
|
-
function
|
|
10157
|
+
function zr(e, t) {
|
|
10124
10158
|
return t.map(
|
|
10125
10159
|
(i) => Et(e, i)
|
|
10126
10160
|
);
|
|
@@ -10144,12 +10178,12 @@ function Et(e, t) {
|
|
|
10144
10178
|
children: i.children.map((o) => Et(e, o))
|
|
10145
10179
|
};
|
|
10146
10180
|
}
|
|
10147
|
-
function Xn(e) {
|
|
10148
|
-
e.id || (e.id = ne.options.generateID()), e.children && Zn(e.children);
|
|
10149
|
-
}
|
|
10150
10181
|
function Zn(e) {
|
|
10182
|
+
e.id || (e.id = ne.options.generateID()), e.children && Jn(e.children);
|
|
10183
|
+
}
|
|
10184
|
+
function Jn(e) {
|
|
10151
10185
|
for (const t of e)
|
|
10152
|
-
|
|
10186
|
+
Zn(t);
|
|
10153
10187
|
}
|
|
10154
10188
|
export {
|
|
10155
10189
|
Ki as AudioBlock,
|
|
@@ -10166,17 +10200,17 @@ export {
|
|
|
10166
10200
|
bn as SideMenuProsemirrorPlugin,
|
|
10167
10201
|
fn as SideMenuView,
|
|
10168
10202
|
yn as SuggestionMenuProseMirrorPlugin,
|
|
10169
|
-
|
|
10203
|
+
Cn as TableHandlesProsemirrorPlugin,
|
|
10170
10204
|
En as TableHandlesView,
|
|
10171
10205
|
ne as UniqueID,
|
|
10172
10206
|
A as UnreachableCaseError,
|
|
10173
10207
|
co as VideoBlock,
|
|
10174
|
-
|
|
10175
|
-
|
|
10208
|
+
Zn as addIdsToBlock,
|
|
10209
|
+
Jn as addIdsToBlocks,
|
|
10176
10210
|
Ai as addInlineContentAttributes,
|
|
10177
10211
|
Ni as addInlineContentKeyboardShortcuts,
|
|
10178
10212
|
ji as addStyleAttributes,
|
|
10179
|
-
|
|
10213
|
+
Er as assertEmpty,
|
|
10180
10214
|
Vi as audioBlockConfig,
|
|
10181
10215
|
Fi as audioParse,
|
|
10182
10216
|
Ri as audioPropSchema,
|
|
@@ -10185,16 +10219,16 @@ export {
|
|
|
10185
10219
|
H as blockToNode,
|
|
10186
10220
|
Xo as blocksToMarkdown,
|
|
10187
10221
|
le as camelToDataKebab,
|
|
10188
|
-
|
|
10222
|
+
Pr as checkBlockHasDefaultProp,
|
|
10189
10223
|
Ro as checkBlockIsDefaultType,
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10224
|
+
Ir as checkBlockIsFileBlock,
|
|
10225
|
+
Nr as checkBlockIsFileBlockWithPlaceholder,
|
|
10226
|
+
Ar as checkBlockIsFileBlockWithPreview,
|
|
10193
10227
|
Vo as checkBlockTypeHasDefaultProp,
|
|
10194
|
-
|
|
10228
|
+
C as checkDefaultBlockTypeInSchema,
|
|
10195
10229
|
zo as checkDefaultInlineContentTypeInSchema,
|
|
10196
10230
|
Ie as cleanHTMLToMarkdown,
|
|
10197
|
-
|
|
10231
|
+
Se as contentNodeToInlineContent,
|
|
10198
10232
|
pe as createAddFileButton,
|
|
10199
10233
|
ce as createBlockSpec,
|
|
10200
10234
|
X as createBlockSpecFromStronglyTypedTiptapNode,
|
|
@@ -10203,7 +10237,7 @@ export {
|
|
|
10203
10237
|
de as createExternalHTMLExporter,
|
|
10204
10238
|
Te as createFigureWithCaption,
|
|
10205
10239
|
V as createFileAndCaptionWrapper,
|
|
10206
|
-
|
|
10240
|
+
Mr as createInlineContentSpec,
|
|
10207
10241
|
Hi as createInlineContentSpecFromTipTapNode,
|
|
10208
10242
|
st as createInternalBlockSpec,
|
|
10209
10243
|
Me as createInternalHTMLSerializer,
|
|
@@ -10212,16 +10246,16 @@ export {
|
|
|
10212
10246
|
me as createLinkWithCaption,
|
|
10213
10247
|
pt as createResizeHandlesWrapper,
|
|
10214
10248
|
O as createStronglyTypedTiptapNode,
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10249
|
+
Tr as createStyleSpec,
|
|
10250
|
+
U as createStyleSpecFromTipTapMark,
|
|
10251
|
+
Hr as createSuggestionMenu,
|
|
10252
|
+
Uo as defaultBlockSchema,
|
|
10219
10253
|
ht as defaultBlockSpecs,
|
|
10220
10254
|
Ve as defaultBlockToHTML,
|
|
10221
10255
|
jo as defaultInlineContentSchema,
|
|
10222
10256
|
ft as defaultInlineContentSpecs,
|
|
10223
10257
|
k as defaultProps,
|
|
10224
|
-
|
|
10258
|
+
Lr as defaultStyleSchema,
|
|
10225
10259
|
mt as defaultStyleSpecs,
|
|
10226
10260
|
P as esmDependencies,
|
|
10227
10261
|
$i as fileBlockConfig,
|
|
@@ -10230,17 +10264,17 @@ export {
|
|
|
10230
10264
|
qi as fileRender,
|
|
10231
10265
|
Zi as fileToExternalHTML,
|
|
10232
10266
|
Sr as filenameFromURL,
|
|
10233
|
-
|
|
10234
|
-
|
|
10267
|
+
jr as filterSuggestionItems,
|
|
10268
|
+
D as formatKeyboardShortcut,
|
|
10235
10269
|
sn as formattingToolbarPluginKey,
|
|
10236
10270
|
Li as getBlockFromPos,
|
|
10237
10271
|
Fn as getBlockNoteExtensions,
|
|
10238
10272
|
lt as getBlockSchemaFromSpecs,
|
|
10239
|
-
|
|
10273
|
+
S as getCurrentBlockContentType,
|
|
10240
10274
|
Dr as getDefaultEmojiPickerItems,
|
|
10241
|
-
|
|
10275
|
+
Ur as getDefaultSlashMenuItems,
|
|
10242
10276
|
fe as getDraggableBlockFromElement,
|
|
10243
|
-
|
|
10277
|
+
Di as getInlineContentParseRules,
|
|
10244
10278
|
dt as getInlineContentSchemaFromSpecs,
|
|
10245
10279
|
Ii as getParseRules,
|
|
10246
10280
|
zi as getStyleParseRules,
|
|
@@ -10257,10 +10291,10 @@ export {
|
|
|
10257
10291
|
Bi as isAppleOS,
|
|
10258
10292
|
ze as isLinkInlineContent,
|
|
10259
10293
|
Qe as isPartialLinkInlineContent,
|
|
10260
|
-
|
|
10294
|
+
Cr as isSafari,
|
|
10261
10295
|
ie as isStyledTextInlineContent,
|
|
10262
10296
|
cn as linkToolbarPluginKey,
|
|
10263
|
-
|
|
10297
|
+
xr as locales,
|
|
10264
10298
|
on as markdownToBlocks,
|
|
10265
10299
|
z as mergeCSSClasses,
|
|
10266
10300
|
x as nodeToBlock,
|
|
@@ -10269,13 +10303,13 @@ export {
|
|
|
10269
10303
|
he as parseFigureElement,
|
|
10270
10304
|
Ge as parseImageElement,
|
|
10271
10305
|
Et as partialBlockToBlockForTesting,
|
|
10272
|
-
|
|
10306
|
+
zr as partialBlocksToBlocksForTesting,
|
|
10273
10307
|
at as propsToAttributes,
|
|
10274
10308
|
gn as sideMenuPluginKey,
|
|
10275
|
-
|
|
10309
|
+
Ui as stylePropsToAttributes,
|
|
10276
10310
|
et as tableContentToNodes,
|
|
10277
10311
|
ee as tableHandlesPluginKey,
|
|
10278
|
-
|
|
10312
|
+
Br as uploadToTmpFilesDotOrg_DEV_ONLY,
|
|
10279
10313
|
ro as videoBlockConfig,
|
|
10280
10314
|
so as videoParse,
|
|
10281
10315
|
no as videoPropSchema,
|