@blocknote/core 0.23.5 → 0.23.6
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 +103 -97
- package/dist/blocknote.js.map +1 -1
- package/dist/blocknote.umd.cjs +6 -6
- package/dist/blocknote.umd.cjs.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/api/clipboard/toClipboard/copyExtension.ts +37 -2
- package/src/blocks/TableBlockContent/TableBlockContent.ts +2 -1
- package/src/extensions/SideMenu/dragging.ts +2 -5
package/dist/blocknote.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var go = Object.defineProperty;
|
|
2
2
|
var bo = (e, t, o) => t in e ? go(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
3
|
var p = (e, t, o) => bo(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
-
import { Slice as q, Fragment as j, DOMSerializer as
|
|
5
|
-
import { Extension as L, combineTransactionSteps as _o, getChangedRanges as yo, findChildrenInRange as vo, Node as X, Mark as xe, InputRule as te, isTextSelection as
|
|
6
|
-
import { Plugin as B, PluginKey as N, TextSelection as
|
|
4
|
+
import { Slice as q, Fragment as j, DOMSerializer as vt, DOMParser as wt, Node as ko } from "prosemirror-model";
|
|
5
|
+
import { Extension as L, combineTransactionSteps as _o, getChangedRanges as yo, findChildrenInRange as vo, Node as X, Mark as xe, InputRule as te, isTextSelection as xt, callOrReturn as wo, getExtensionField as xo, selectionToInsertionEnd as Co, isNodeSelection as Ye, posToDOMRect as je, getMarkRange as Qe, findChildren as et, findParentNode as Eo, extensions as re, Editor as So, createDocument as Bo, getSchema as To } from "@tiptap/core";
|
|
6
|
+
import { Plugin as B, PluginKey as N, TextSelection as U, NodeSelection as ce, Selection as Me, EditorState as Mo } from "prosemirror-state";
|
|
7
7
|
import { v4 as Io } from "uuid";
|
|
8
8
|
import { createHighlightPlugin as Lo } from "prosemirror-highlight";
|
|
9
9
|
import { createParser as Ao } from "prosemirror-highlight/shiki";
|
|
10
|
-
import { bundledLanguagesInfo as
|
|
10
|
+
import { bundledLanguagesInfo as Ct, createHighlighter as Po } from "shiki";
|
|
11
11
|
import No from "@tiptap/extension-bold";
|
|
12
12
|
import jo from "@tiptap/extension-code";
|
|
13
13
|
import Do from "@tiptap/extension-italic";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import Ho from "@tiptap/extension-strike";
|
|
15
|
+
import Uo from "@tiptap/extension-underline";
|
|
16
16
|
import { ReplaceStep as Oo, ReplaceAroundStep as De } from "prosemirror-transform";
|
|
17
17
|
import { TableCell as Ro } from "@tiptap/extension-table-cell";
|
|
18
18
|
import { TableHeader as Vo } from "@tiptap/extension-table-header";
|
|
@@ -23,7 +23,6 @@ import { HardBreak as Ko } from "@tiptap/extension-hard-break";
|
|
|
23
23
|
import { History as qo } from "@tiptap/extension-history";
|
|
24
24
|
import { Link as Xo } from "@tiptap/extension-link";
|
|
25
25
|
import { Text as Zo } from "@tiptap/extension-text";
|
|
26
|
-
import * as Ct from "prosemirror-view";
|
|
27
26
|
import { Decoration as oe, DecorationSet as ie, EditorView as Jo } from "prosemirror-view";
|
|
28
27
|
import Yo from "@tiptap/extension-collaboration";
|
|
29
28
|
import Qo from "@tiptap/extension-collaboration-cursor";
|
|
@@ -5716,7 +5715,7 @@ function _i(e, t, o) {
|
|
|
5716
5715
|
const i = t.marks.link.create({
|
|
5717
5716
|
href: e.href
|
|
5718
5717
|
});
|
|
5719
|
-
return
|
|
5718
|
+
return He(e.content, t, o).map(
|
|
5720
5719
|
(n) => {
|
|
5721
5720
|
if (n.type.name === "text")
|
|
5722
5721
|
return n.mark([...n.marks, i]);
|
|
@@ -5726,7 +5725,7 @@ function _i(e, t, o) {
|
|
|
5726
5725
|
}
|
|
5727
5726
|
);
|
|
5728
5727
|
}
|
|
5729
|
-
function
|
|
5728
|
+
function He(e, t, o, i) {
|
|
5730
5729
|
const n = [];
|
|
5731
5730
|
if (typeof e == "string")
|
|
5732
5731
|
return n.push(
|
|
@@ -5743,13 +5742,13 @@ function Ue(e, t, o, i) {
|
|
|
5743
5742
|
);
|
|
5744
5743
|
return n;
|
|
5745
5744
|
}
|
|
5746
|
-
function
|
|
5745
|
+
function H(e, t, o, i) {
|
|
5747
5746
|
const n = [];
|
|
5748
5747
|
for (const r of e)
|
|
5749
5748
|
typeof r == "string" ? n.push(
|
|
5750
|
-
...
|
|
5749
|
+
...He(r, t, o, i)
|
|
5751
5750
|
) : St(r) ? n.push(..._i(r, t, o)) : de(r) ? n.push(
|
|
5752
|
-
...
|
|
5751
|
+
...He([r], t, o, i)
|
|
5753
5752
|
) : n.push(
|
|
5754
5753
|
Bt(r, t, o)
|
|
5755
5754
|
);
|
|
@@ -5771,7 +5770,7 @@ function Ce(e, t, o) {
|
|
|
5771
5770
|
t.text(d)
|
|
5772
5771
|
);
|
|
5773
5772
|
else {
|
|
5774
|
-
const h =
|
|
5773
|
+
const h = H(d, t, o);
|
|
5775
5774
|
c = t.nodes.tableParagraph.createChecked({}, h);
|
|
5776
5775
|
}
|
|
5777
5776
|
const u = t.nodes.tableCell.createChecked(
|
|
@@ -5797,7 +5796,7 @@ function Bt(e, t, o) {
|
|
|
5797
5796
|
if (!e.content)
|
|
5798
5797
|
i = t.nodes[n].createChecked(e.props);
|
|
5799
5798
|
else if (typeof e.content == "string") {
|
|
5800
|
-
const r =
|
|
5799
|
+
const r = H(
|
|
5801
5800
|
[e.content],
|
|
5802
5801
|
t,
|
|
5803
5802
|
o,
|
|
@@ -5805,7 +5804,7 @@ function Bt(e, t, o) {
|
|
|
5805
5804
|
);
|
|
5806
5805
|
i = t.nodes[n].createChecked(e.props, r);
|
|
5807
5806
|
} else if (Array.isArray(e.content)) {
|
|
5808
|
-
const r =
|
|
5807
|
+
const r = H(
|
|
5809
5808
|
e.content,
|
|
5810
5809
|
t,
|
|
5811
5810
|
o,
|
|
@@ -5864,13 +5863,13 @@ function Mt(e, t, o, i) {
|
|
|
5864
5863
|
let n;
|
|
5865
5864
|
if (t)
|
|
5866
5865
|
if (typeof t == "string")
|
|
5867
|
-
n =
|
|
5866
|
+
n = H(
|
|
5868
5867
|
[t],
|
|
5869
5868
|
e.pmSchema,
|
|
5870
5869
|
e.schema.styleSchema
|
|
5871
5870
|
);
|
|
5872
5871
|
else if (Array.isArray(t))
|
|
5873
|
-
n =
|
|
5872
|
+
n = H(
|
|
5874
5873
|
t,
|
|
5875
5874
|
e.pmSchema,
|
|
5876
5875
|
e.schema.styleSchema
|
|
@@ -5973,7 +5972,7 @@ const It = (e, t, o, i, n, r, a) => {
|
|
|
5973
5972
|
r
|
|
5974
5973
|
), s;
|
|
5975
5974
|
}, Ee = (e, t) => {
|
|
5976
|
-
const o =
|
|
5975
|
+
const o = vt.fromSchema(e);
|
|
5977
5976
|
return {
|
|
5978
5977
|
exportBlocks: (i, n) => {
|
|
5979
5978
|
const r = vi(
|
|
@@ -6001,14 +6000,14 @@ function wi(e, t, o, i, n) {
|
|
|
6001
6000
|
let r;
|
|
6002
6001
|
if (t)
|
|
6003
6002
|
if (typeof t == "string")
|
|
6004
|
-
r =
|
|
6003
|
+
r = H(
|
|
6005
6004
|
[t],
|
|
6006
6005
|
e.pmSchema,
|
|
6007
6006
|
e.schema.styleSchema,
|
|
6008
6007
|
i
|
|
6009
6008
|
);
|
|
6010
6009
|
else if (Array.isArray(t))
|
|
6011
|
-
r =
|
|
6010
|
+
r = H(
|
|
6012
6011
|
t,
|
|
6013
6012
|
e.pmSchema,
|
|
6014
6013
|
e.schema.styleSchema,
|
|
@@ -6092,7 +6091,7 @@ const At = (e, t, o, i) => {
|
|
|
6092
6091
|
const n = e.pmSchema.nodes.blockGroup, r = n.spec.toDOM(n.create({})), a = Lt(e, t, o, i);
|
|
6093
6092
|
return (s = r.contentDOM) == null || s.appendChild(a), r.dom;
|
|
6094
6093
|
}, Ci = (e, t) => {
|
|
6095
|
-
const o =
|
|
6094
|
+
const o = vt.fromSchema(e);
|
|
6096
6095
|
return {
|
|
6097
6096
|
serializeBlocks: (i, n) => At(t, i, o, n).outerHTML
|
|
6098
6097
|
};
|
|
@@ -6509,7 +6508,7 @@ function Se(e, t, o) {
|
|
|
6509
6508
|
}
|
|
6510
6509
|
if (r.type.name !== "link" && r.type.name !== "text" && t[r.type.name]) {
|
|
6511
6510
|
n && (i.push(n), n = void 0), i.push(
|
|
6512
|
-
|
|
6511
|
+
Ue(r, t, o)
|
|
6513
6512
|
);
|
|
6514
6513
|
return;
|
|
6515
6514
|
}
|
|
@@ -6580,7 +6579,7 @@ function Se(e, t, o) {
|
|
|
6580
6579
|
};
|
|
6581
6580
|
}), n && i.push(n), i;
|
|
6582
6581
|
}
|
|
6583
|
-
function
|
|
6582
|
+
function Ue(e, t, o) {
|
|
6584
6583
|
if (e.type.name === "text" || e.type.name === "link")
|
|
6585
6584
|
throw new Error("unexpected");
|
|
6586
6585
|
const i = {}, n = t[e.type.name];
|
|
@@ -6698,7 +6697,7 @@ function Li(e, t) {
|
|
|
6698
6697
|
}
|
|
6699
6698
|
);
|
|
6700
6699
|
}
|
|
6701
|
-
function
|
|
6700
|
+
function Ht(e) {
|
|
6702
6701
|
return Object.fromEntries(
|
|
6703
6702
|
Object.entries(e).map(([t, o]) => [t, o.config])
|
|
6704
6703
|
);
|
|
@@ -6733,7 +6732,7 @@ function ds(e, t) {
|
|
|
6733
6732
|
},
|
|
6734
6733
|
renderHTML({ node: i }) {
|
|
6735
6734
|
const n = this.options.editor, r = t.render(
|
|
6736
|
-
|
|
6735
|
+
Ue(
|
|
6737
6736
|
i,
|
|
6738
6737
|
n.schema.inlineContentSchema,
|
|
6739
6738
|
n.schema.styleSchema
|
|
@@ -6753,7 +6752,7 @@ function ds(e, t) {
|
|
|
6753
6752
|
addNodeView() {
|
|
6754
6753
|
return ({ node: i, getPos: n }) => {
|
|
6755
6754
|
const r = this.options.editor, a = t.render(
|
|
6756
|
-
|
|
6755
|
+
Ue(
|
|
6757
6756
|
i,
|
|
6758
6757
|
r.schema.inlineContentSchema,
|
|
6759
6758
|
r.schema.styleSchema
|
|
@@ -6762,7 +6761,7 @@ function ds(e, t) {
|
|
|
6762
6761
|
(s) => {
|
|
6763
6762
|
if (typeof n == "boolean")
|
|
6764
6763
|
return;
|
|
6765
|
-
const l =
|
|
6764
|
+
const l = H(
|
|
6766
6765
|
[s],
|
|
6767
6766
|
r._tiptapEditor.schema,
|
|
6768
6767
|
r.schema.styleSchema
|
|
@@ -6806,14 +6805,14 @@ function Pi(e) {
|
|
|
6806
6805
|
function Ni(e, t, o, i) {
|
|
6807
6806
|
return e.dom.setAttribute("data-style-type", t), i === "string" && e.dom.setAttribute("data-value", o), e.contentDOM !== void 0 && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
6808
6807
|
}
|
|
6809
|
-
function
|
|
6808
|
+
function Ut(e, t) {
|
|
6810
6809
|
return {
|
|
6811
6810
|
config: e,
|
|
6812
6811
|
implementation: t
|
|
6813
6812
|
};
|
|
6814
6813
|
}
|
|
6815
6814
|
function K(e, t) {
|
|
6816
|
-
return
|
|
6815
|
+
return Ut(
|
|
6817
6816
|
{
|
|
6818
6817
|
type: e.name,
|
|
6819
6818
|
propSchema: t
|
|
@@ -6864,7 +6863,7 @@ function cs(e, t) {
|
|
|
6864
6863
|
);
|
|
6865
6864
|
}
|
|
6866
6865
|
});
|
|
6867
|
-
return
|
|
6866
|
+
return Ut(e, {
|
|
6868
6867
|
mark: o
|
|
6869
6868
|
});
|
|
6870
6869
|
}
|
|
@@ -6910,11 +6909,11 @@ const Be = (e, t) => {
|
|
|
6910
6909
|
);
|
|
6911
6910
|
}
|
|
6912
6911
|
};
|
|
6913
|
-
},
|
|
6912
|
+
}, Hi = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>', Ui = (e) => {
|
|
6914
6913
|
const t = document.createElement("div");
|
|
6915
6914
|
t.className = "bn-file-name-with-icon";
|
|
6916
6915
|
const o = document.createElement("div");
|
|
6917
|
-
o.className = "bn-file-icon", o.innerHTML =
|
|
6916
|
+
o.className = "bn-file-icon", o.innerHTML = Hi, t.appendChild(o);
|
|
6918
6917
|
const i = document.createElement("p");
|
|
6919
6918
|
return i.className = "bn-file-name", i.textContent = e.props.name, t.appendChild(i), {
|
|
6920
6919
|
dom: t
|
|
@@ -6945,7 +6944,7 @@ const Be = (e, t) => {
|
|
|
6945
6944
|
}
|
|
6946
6945
|
const a = { dom: r };
|
|
6947
6946
|
if (e.props.showPreview === !1 || !o) {
|
|
6948
|
-
const s =
|
|
6947
|
+
const s = Ui(e);
|
|
6949
6948
|
r.appendChild(s.dom), a.destroy = () => {
|
|
6950
6949
|
var l;
|
|
6951
6950
|
(l = s.destroy) == null || l.call(s);
|
|
@@ -7035,7 +7034,7 @@ const Be = (e, t) => {
|
|
|
7035
7034
|
name: "Plain Text",
|
|
7036
7035
|
match: ["text", "txt", "plain"]
|
|
7037
7036
|
},
|
|
7038
|
-
...
|
|
7037
|
+
...Ct.filter((e) => [
|
|
7039
7038
|
"c",
|
|
7040
7039
|
"cpp",
|
|
7041
7040
|
"css",
|
|
@@ -7250,7 +7249,7 @@ const Be = (e, t) => {
|
|
|
7250
7249
|
}
|
|
7251
7250
|
);
|
|
7252
7251
|
const s = a.language;
|
|
7253
|
-
return s && s !== "text" && !o.getLoadedLanguages().includes(s) && e.find(({ id: l }) => l === s) &&
|
|
7252
|
+
return s && s !== "text" && !o.getLoadedLanguages().includes(s) && e.find(({ id: l }) => l === s) && Ct.find(({ id: l }) => l === s) ? o.loadLanguage(s) : (i || (i = t[lt] || Ao(o), t[lt] = i), i(a));
|
|
7254
7253
|
},
|
|
7255
7254
|
languageExtractor: (a) => a.attrs.language,
|
|
7256
7255
|
nodeTypes: [this.name]
|
|
@@ -7272,7 +7271,7 @@ const Be = (e, t) => {
|
|
|
7272
7271
|
this.type
|
|
7273
7272
|
))
|
|
7274
7273
|
return null;
|
|
7275
|
-
t.tr.delete(o.from, o.to).setBlockType(o.from, o.from, this.type, a).setSelection(
|
|
7274
|
+
t.tr.delete(o.from, o.to).setBlockType(o.from, o.from, this.type, a).setSelection(U.create(t.tr.doc, o.from));
|
|
7276
7275
|
}
|
|
7277
7276
|
})
|
|
7278
7277
|
];
|
|
@@ -7281,7 +7280,7 @@ const Be = (e, t) => {
|
|
|
7281
7280
|
return {
|
|
7282
7281
|
Delete: ({ editor: e }) => {
|
|
7283
7282
|
const { selection: t } = e.state, { $from: o } = t;
|
|
7284
|
-
if (e.isActive(this.name) && !o.parent.textContent &&
|
|
7283
|
+
if (e.isActive(this.name) && !o.parent.textContent && xt(t)) {
|
|
7285
7284
|
const i = o.pos - o.parentOffset - 2;
|
|
7286
7285
|
return e.chain().setNodeSelection(i).deleteSelection().run(), !0;
|
|
7287
7286
|
}
|
|
@@ -7503,14 +7502,14 @@ function dn(e, t, o, i, n, r) {
|
|
|
7503
7502
|
let a = "keep";
|
|
7504
7503
|
if (e.content)
|
|
7505
7504
|
if (typeof e.content == "string")
|
|
7506
|
-
a =
|
|
7505
|
+
a = H(
|
|
7507
7506
|
[e.content],
|
|
7508
7507
|
t.schema,
|
|
7509
7508
|
o.schema.styleSchema,
|
|
7510
7509
|
n.name
|
|
7511
7510
|
);
|
|
7512
7511
|
else if (Array.isArray(e.content))
|
|
7513
|
-
a =
|
|
7512
|
+
a = H(
|
|
7514
7513
|
e.content,
|
|
7515
7514
|
t.schema,
|
|
7516
7515
|
o.schema.styleSchema,
|
|
@@ -8493,7 +8492,7 @@ const zt = {
|
|
|
8493
8492
|
renderHTML({ HTMLAttributes: e }) {
|
|
8494
8493
|
return ["p", e, 0];
|
|
8495
8494
|
}
|
|
8496
|
-
}),
|
|
8495
|
+
}), Hn = W(
|
|
8497
8496
|
jn,
|
|
8498
8497
|
Nn,
|
|
8499
8498
|
[
|
|
@@ -8510,7 +8509,7 @@ const zt = {
|
|
|
8510
8509
|
), pt = (e) => {
|
|
8511
8510
|
const t = e.src || void 0, o = e.width || void 0;
|
|
8512
8511
|
return { url: t, previewWidth: o };
|
|
8513
|
-
},
|
|
8512
|
+
}, Un = '<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>', On = {
|
|
8514
8513
|
textAlignment: x.textAlignment,
|
|
8515
8514
|
backgroundColor: x.backgroundColor,
|
|
8516
8515
|
// File name.
|
|
@@ -8540,7 +8539,7 @@ const zt = {
|
|
|
8540
8539
|
fileBlockAccept: ["video/*"]
|
|
8541
8540
|
}, Vn = (e, t) => {
|
|
8542
8541
|
const o = document.createElement("div");
|
|
8543
|
-
o.innerHTML =
|
|
8542
|
+
o.innerHTML = Un;
|
|
8544
8543
|
const i = document.createElement("div");
|
|
8545
8544
|
i.className = "bn-visual-media-wrapper";
|
|
8546
8545
|
const n = document.createElement("video");
|
|
@@ -8589,7 +8588,7 @@ const zt = {
|
|
|
8589
8588
|
bulletListItem: wn,
|
|
8590
8589
|
numberedListItem: Tn,
|
|
8591
8590
|
checkListItem: Cn,
|
|
8592
|
-
table:
|
|
8591
|
+
table: Hn,
|
|
8593
8592
|
file: ln,
|
|
8594
8593
|
image: _n,
|
|
8595
8594
|
video: Gn,
|
|
@@ -8597,15 +8596,15 @@ const zt = {
|
|
|
8597
8596
|
}, $n = jt(qt), Xt = {
|
|
8598
8597
|
bold: K(No, "boolean"),
|
|
8599
8598
|
italic: K(Do, "boolean"),
|
|
8600
|
-
underline: K(
|
|
8601
|
-
strike: K(
|
|
8599
|
+
underline: K(Uo, "boolean"),
|
|
8600
|
+
strike: K(Ho, "boolean"),
|
|
8602
8601
|
code: K(jo, "boolean"),
|
|
8603
8602
|
textColor: tn,
|
|
8604
8603
|
backgroundColor: Qi
|
|
8605
8604
|
}, hs = Ot(Xt), Zt = {
|
|
8606
8605
|
text: { config: "text", implementation: {} },
|
|
8607
8606
|
link: { config: "link", implementation: {} }
|
|
8608
|
-
}, Wn =
|
|
8607
|
+
}, Wn = Ht(
|
|
8609
8608
|
Zt
|
|
8610
8609
|
);
|
|
8611
8610
|
function I(e, t) {
|
|
@@ -8832,7 +8831,7 @@ class fe {
|
|
|
8832
8831
|
p(this, "BlockNoteEditor", "only for types");
|
|
8833
8832
|
p(this, "Block", "only for types");
|
|
8834
8833
|
p(this, "PartialBlock", "only for types");
|
|
8835
|
-
this.blockSpecs = Le(t == null ? void 0 : t.blockSpecs) || qt, this.inlineContentSpecs = Le(t == null ? void 0 : t.inlineContentSpecs) || Zt, this.styleSpecs = Le(t == null ? void 0 : t.styleSpecs) || Xt, this.blockSchema = jt(this.blockSpecs), this.inlineContentSchema =
|
|
8834
|
+
this.blockSpecs = Le(t == null ? void 0 : t.blockSpecs) || qt, this.inlineContentSpecs = Le(t == null ? void 0 : t.inlineContentSpecs) || Zt, this.styleSpecs = Le(t == null ? void 0 : t.styleSpecs) || Xt, this.blockSchema = jt(this.blockSpecs), this.inlineContentSchema = Ht(
|
|
8836
8835
|
this.inlineContentSpecs
|
|
8837
8836
|
), this.styleSchema = Ot(this.styleSpecs);
|
|
8838
8837
|
}
|
|
@@ -8963,7 +8962,7 @@ function er(e, t) {
|
|
|
8963
8962
|
throw new Error(
|
|
8964
8963
|
`Could not find block with ID ${t.headBlockId} to update selection`
|
|
8965
8964
|
);
|
|
8966
|
-
i =
|
|
8965
|
+
i = U.create(
|
|
8967
8966
|
e._tiptapEditor.state.doc,
|
|
8968
8967
|
o + t.anchorOffset,
|
|
8969
8968
|
a + t.headOffset
|
|
@@ -9319,7 +9318,7 @@ function fr(e, t, o) {
|
|
|
9319
9318
|
m = d.blockContent.afterPos - 1;
|
|
9320
9319
|
e._tiptapEditor.dispatch(
|
|
9321
9320
|
e._tiptapEditor.state.tr.setSelection(
|
|
9322
|
-
|
|
9321
|
+
U.create(e._tiptapEditor.state.doc, h, m)
|
|
9323
9322
|
)
|
|
9324
9323
|
);
|
|
9325
9324
|
}
|
|
@@ -9514,7 +9513,7 @@ function ro(e) {
|
|
|
9514
9513
|
return wr(e), xr(e), e;
|
|
9515
9514
|
}
|
|
9516
9515
|
async function ao(e, t, o, i, n) {
|
|
9517
|
-
const r = ro(e), s =
|
|
9516
|
+
const r = ro(e), s = wt.fromSchema(n).parse(r, {
|
|
9518
9517
|
topNode: n.nodes.blockGroup.create()
|
|
9519
9518
|
}), l = [];
|
|
9520
9519
|
for (let d = 0; d < s.childCount; d++)
|
|
@@ -9802,8 +9801,7 @@ function co(e, t) {
|
|
|
9802
9801
|
new ce(e.state.doc.resolve(e.state.selection.from - 1))
|
|
9803
9802
|
)
|
|
9804
9803
|
);
|
|
9805
|
-
const o =
|
|
9806
|
-
e,
|
|
9804
|
+
const o = e.serializeForClipboard(
|
|
9807
9805
|
e.state.selection.content()
|
|
9808
9806
|
).dom.innerHTML, i = e.state.selection.content().content, n = Ar(
|
|
9809
9807
|
e,
|
|
@@ -9812,7 +9810,18 @@ function co(e, t) {
|
|
|
9812
9810
|
), r = Xe(n);
|
|
9813
9811
|
return { clipboardHTML: o, externalHTML: n, markdown: r };
|
|
9814
9812
|
}
|
|
9815
|
-
const mt = (
|
|
9813
|
+
const mt = () => {
|
|
9814
|
+
const e = window.getSelection();
|
|
9815
|
+
if (!e || e.isCollapsed)
|
|
9816
|
+
return !0;
|
|
9817
|
+
let t = e.focusNode;
|
|
9818
|
+
for (; t; ) {
|
|
9819
|
+
if (t instanceof HTMLElement && t.getAttribute("contenteditable") === "false")
|
|
9820
|
+
return !0;
|
|
9821
|
+
t = t.parentElement;
|
|
9822
|
+
}
|
|
9823
|
+
return !1;
|
|
9824
|
+
}, ft = (e, t, o) => {
|
|
9816
9825
|
o.preventDefault(), o.clipboardData.clearData();
|
|
9817
9826
|
const { clipboardHTML: i, externalHTML: n, markdown: r } = co(
|
|
9818
9827
|
t,
|
|
@@ -9827,10 +9836,10 @@ const mt = (e, t, o) => {
|
|
|
9827
9836
|
props: {
|
|
9828
9837
|
handleDOMEvents: {
|
|
9829
9838
|
copy(t, o) {
|
|
9830
|
-
return mt(e, t, o), !0;
|
|
9839
|
+
return mt() || ft(e, t, o), !0;
|
|
9831
9840
|
},
|
|
9832
9841
|
cut(t, o) {
|
|
9833
|
-
return mt(e, t, o), t.editable && t.dispatch(t.state.tr.deleteSelection()), !0;
|
|
9842
|
+
return mt() || (ft(e, t, o), t.editable && t.dispatch(t.state.tr.deleteSelection())), !0;
|
|
9834
9843
|
},
|
|
9835
9844
|
// This is for the use-case in which only a block without content
|
|
9836
9845
|
// is selected, e.g. an image block, and dragged (not using the
|
|
@@ -9995,14 +10004,14 @@ class Dr extends ne {
|
|
|
9995
10004
|
return this.on("update", o);
|
|
9996
10005
|
}
|
|
9997
10006
|
}
|
|
9998
|
-
class
|
|
10007
|
+
class Hr {
|
|
9999
10008
|
constructor(t, o, i) {
|
|
10000
10009
|
p(this, "state");
|
|
10001
10010
|
p(this, "emitUpdate");
|
|
10002
10011
|
p(this, "preventHide", !1);
|
|
10003
10012
|
p(this, "preventShow", !1);
|
|
10004
10013
|
p(this, "shouldShow", ({ state: t, from: o, to: i, view: n }) => {
|
|
10005
|
-
const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(o, i).length &&
|
|
10014
|
+
const { doc: r, selection: a } = t, { empty: s } = a, l = !r.textBetween(o, i).length && xt(t.selection);
|
|
10006
10015
|
return a.$from.parent.type.spec.code || Ye(a) && a.node.type.spec.code ? !1 : !(!n.hasFocus() || s || l);
|
|
10007
10016
|
});
|
|
10008
10017
|
p(this, "blurHandler", (t) => {
|
|
@@ -10081,7 +10090,7 @@ class Ur {
|
|
|
10081
10090
|
return je(this.pmView, n, r);
|
|
10082
10091
|
}
|
|
10083
10092
|
}
|
|
10084
|
-
const
|
|
10093
|
+
const Ur = new N(
|
|
10085
10094
|
"FormattingToolbarPlugin"
|
|
10086
10095
|
);
|
|
10087
10096
|
class Or extends ne {
|
|
@@ -10091,8 +10100,8 @@ class Or extends ne {
|
|
|
10091
10100
|
p(this, "plugin");
|
|
10092
10101
|
p(this, "closeMenu", () => this.view.closeMenu());
|
|
10093
10102
|
this.plugin = new B({
|
|
10094
|
-
key:
|
|
10095
|
-
view: (i) => (this.view = new
|
|
10103
|
+
key: Ur,
|
|
10104
|
+
view: (i) => (this.view = new Hr(o, i, (n) => {
|
|
10096
10105
|
this.emit("update", n);
|
|
10097
10106
|
}), this.view),
|
|
10098
10107
|
props: {
|
|
@@ -10108,7 +10117,7 @@ class Or extends ne {
|
|
|
10108
10117
|
return this.on("update", o);
|
|
10109
10118
|
}
|
|
10110
10119
|
}
|
|
10111
|
-
const
|
|
10120
|
+
const gt = (e, t) => {
|
|
10112
10121
|
const o = e.resolve(t);
|
|
10113
10122
|
if (o.depth <= 1)
|
|
10114
10123
|
return;
|
|
@@ -10162,7 +10171,7 @@ const ft = (e, t) => {
|
|
|
10162
10171
|
);
|
|
10163
10172
|
}
|
|
10164
10173
|
return !0;
|
|
10165
|
-
},
|
|
10174
|
+
}, bt = (e) => ({
|
|
10166
10175
|
state: t,
|
|
10167
10176
|
dispatch: o
|
|
10168
10177
|
}) => {
|
|
@@ -10220,7 +10229,7 @@ const ft = (e, t) => {
|
|
|
10220
10229
|
if (!a.isBlockContainer)
|
|
10221
10230
|
return !1;
|
|
10222
10231
|
const { bnBlock: s, blockContent: l } = a, d = r.selection.from === l.beforePos + 1, c = r.selection.empty, u = s.beforePos;
|
|
10223
|
-
return d && c ? i().command(
|
|
10232
|
+
return d && c ? i().command(bt(u)).scrollIntoView().run() : !1;
|
|
10224
10233
|
}),
|
|
10225
10234
|
() => n.command(({ state: r, dispatch: a }) => {
|
|
10226
10235
|
const s = _(r);
|
|
@@ -10229,13 +10238,13 @@ const ft = (e, t) => {
|
|
|
10229
10238
|
s.bnBlock.beforePos
|
|
10230
10239
|
))
|
|
10231
10240
|
return !1;
|
|
10232
|
-
const c =
|
|
10241
|
+
const c = gt(
|
|
10233
10242
|
r.doc,
|
|
10234
10243
|
s.bnBlock.beforePos
|
|
10235
10244
|
);
|
|
10236
10245
|
if ((c == null ? void 0 : c.blockNoteType) !== "column")
|
|
10237
10246
|
return !1;
|
|
10238
|
-
const u = c, h =
|
|
10247
|
+
const u = c, h = gt(
|
|
10239
10248
|
r.doc,
|
|
10240
10249
|
u.bnBlock.beforePos
|
|
10241
10250
|
);
|
|
@@ -10265,7 +10274,7 @@ const ft = (e, t) => {
|
|
|
10265
10274
|
)
|
|
10266
10275
|
);
|
|
10267
10276
|
const k = r.tr.doc.resolve(u.bnBlock.beforePos);
|
|
10268
|
-
r.tr.setSelection(
|
|
10277
|
+
r.tr.setSelection(U.between(k, k));
|
|
10269
10278
|
} else {
|
|
10270
10279
|
r.tr.step(
|
|
10271
10280
|
new De(
|
|
@@ -10284,7 +10293,7 @@ const ft = (e, t) => {
|
|
|
10284
10293
|
const k = r.tr.doc.resolve(
|
|
10285
10294
|
r.tr.mapping.map(u.bnBlock.beforePos - 1)
|
|
10286
10295
|
);
|
|
10287
|
-
r.tr.setSelection(
|
|
10296
|
+
r.tr.setSelection(U.between(k, k));
|
|
10288
10297
|
}
|
|
10289
10298
|
else if (m)
|
|
10290
10299
|
if (g) {
|
|
@@ -10298,7 +10307,7 @@ const ft = (e, t) => {
|
|
|
10298
10307
|
const k = r.tr.doc.resolve(
|
|
10299
10308
|
h.bnBlock.beforePos
|
|
10300
10309
|
);
|
|
10301
|
-
r.tr.setSelection(
|
|
10310
|
+
r.tr.setSelection(U.between(k, k));
|
|
10302
10311
|
} else
|
|
10303
10312
|
r.tr.delete(
|
|
10304
10313
|
u.bnBlock.beforePos - 1,
|
|
@@ -10316,7 +10325,7 @@ const ft = (e, t) => {
|
|
|
10316
10325
|
b.content
|
|
10317
10326
|
);
|
|
10318
10327
|
const k = r.tr.doc.resolve(u.bnBlock.beforePos - 1);
|
|
10319
|
-
r.tr.setSelection(
|
|
10328
|
+
r.tr.setSelection(U.between(k, k));
|
|
10320
10329
|
}
|
|
10321
10330
|
}
|
|
10322
10331
|
return !0;
|
|
@@ -10373,7 +10382,7 @@ const ft = (e, t) => {
|
|
|
10373
10382
|
let f = d, g = a.afterPos + 1, b = n.doc.resolve(g).depth;
|
|
10374
10383
|
for (; b < f; )
|
|
10375
10384
|
f = b, g += 2, b = n.doc.resolve(g).depth;
|
|
10376
|
-
return i.command(
|
|
10385
|
+
return i.command(bt(g - 1));
|
|
10377
10386
|
}
|
|
10378
10387
|
return !1;
|
|
10379
10388
|
})
|
|
@@ -10400,7 +10409,7 @@ const ft = (e, t) => {
|
|
|
10400
10409
|
if (r) {
|
|
10401
10410
|
const f = n.schema.nodes.blockContainer.createAndFill();
|
|
10402
10411
|
n.tr.insert(h, f).scrollIntoView(), n.tr.setSelection(
|
|
10403
|
-
new
|
|
10412
|
+
new U(n.doc.resolve(m))
|
|
10404
10413
|
);
|
|
10405
10414
|
}
|
|
10406
10415
|
return !0;
|
|
@@ -10654,7 +10663,7 @@ class Xr {
|
|
|
10654
10663
|
t.state.tr.selection.$to.after(),
|
|
10655
10664
|
t.state.schema.nodes.paragraph.createChecked()
|
|
10656
10665
|
).setSelection(
|
|
10657
|
-
new
|
|
10666
|
+
new U(
|
|
10658
10667
|
i.doc.resolve(t.state.tr.selection.$to.after() + 1)
|
|
10659
10668
|
)
|
|
10660
10669
|
)
|
|
@@ -10729,7 +10738,7 @@ class Jr {
|
|
|
10729
10738
|
});
|
|
10730
10739
|
}
|
|
10731
10740
|
}
|
|
10732
|
-
const
|
|
10741
|
+
const kt = new N("previous-blocks"), Yr = {
|
|
10733
10742
|
// Numbered List Items
|
|
10734
10743
|
index: "index",
|
|
10735
10744
|
// Headings
|
|
@@ -10744,14 +10753,14 @@ class Qr {
|
|
|
10744
10753
|
p(this, "plugin");
|
|
10745
10754
|
let t;
|
|
10746
10755
|
this.plugin = new B({
|
|
10747
|
-
key:
|
|
10756
|
+
key: kt,
|
|
10748
10757
|
view(o) {
|
|
10749
10758
|
return {
|
|
10750
10759
|
update: async (i, n) => {
|
|
10751
10760
|
var r;
|
|
10752
10761
|
((r = this.key) == null ? void 0 : r.getState(i.state).updatedBlocks.size) > 0 && (t = setTimeout(() => {
|
|
10753
10762
|
i.dispatch(
|
|
10754
|
-
i.state.tr.setMeta(
|
|
10763
|
+
i.state.tr.setMeta(kt, { clearUpdate: !0 })
|
|
10755
10764
|
);
|
|
10756
10765
|
}, 0));
|
|
10757
10766
|
},
|
|
@@ -10873,7 +10882,7 @@ function ea(e, t) {
|
|
|
10873
10882
|
o = e.from, i = e.to;
|
|
10874
10883
|
return { from: o, to: i };
|
|
10875
10884
|
}
|
|
10876
|
-
function
|
|
10885
|
+
function _t(e, t, o = t) {
|
|
10877
10886
|
t === o && (o += e.state.doc.resolve(t + 1).node().nodeSize);
|
|
10878
10887
|
const i = e.domAtPos(t).node.cloneNode(!0), n = e.domAtPos(t).node, r = (c, u) => Array.prototype.indexOf.call(c.children, u), a = r(
|
|
10879
10888
|
n,
|
|
@@ -10909,13 +10918,10 @@ function ta(e, t, o) {
|
|
|
10909
10918
|
const a = i.state.selection, s = i.state.doc, { from: l, to: d } = ea(a, s), c = l <= r && r < d, u = a.$anchor.node() !== a.$head.node() || a instanceof Q;
|
|
10910
10919
|
c && u ? (i.dispatch(
|
|
10911
10920
|
i.state.tr.setSelection(Q.create(s, l, d))
|
|
10912
|
-
),
|
|
10921
|
+
), _t(i, l, d)) : (i.dispatch(
|
|
10913
10922
|
i.state.tr.setSelection(ce.create(i.state.doc, r))
|
|
10914
|
-
),
|
|
10915
|
-
const h = i.state.selection.content(), m = o.pmSchema, f =
|
|
10916
|
-
i,
|
|
10917
|
-
h
|
|
10918
|
-
).dom.innerHTML, g = Ee(m, o), b = lo(h.content, o.schema), k = g.exportBlocks(b, {}), C = Xe(k);
|
|
10923
|
+
), _t(i, r));
|
|
10924
|
+
const h = i.state.selection.content(), m = o.pmSchema, f = i.serializeForClipboard(h).dom.innerHTML, g = Ee(m, o), b = lo(h.content, o.schema), k = g.exportBlocks(b, {}), C = Xe(k);
|
|
10919
10925
|
e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", f), e.dataTransfer.setData("text/html", k), e.dataTransfer.setData("text/plain", C), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(O, 0, 0);
|
|
10920
10926
|
}
|
|
10921
10927
|
}
|
|
@@ -11008,7 +11014,7 @@ class ia {
|
|
|
11008
11014
|
var i;
|
|
11009
11015
|
if (this.pmView.dragging === null || (this.editor._tiptapEditor.commands.blur(), !this.isDragOrigin && this.pmView.dom.contains(t.target) ? this.pmView.dispatch(
|
|
11010
11016
|
this.pmView.state.tr.setSelection(
|
|
11011
|
-
|
|
11017
|
+
U.create(
|
|
11012
11018
|
this.pmView.state.tr.doc,
|
|
11013
11019
|
this.pmView.state.tr.selection.to
|
|
11014
11020
|
)
|
|
@@ -11054,7 +11060,7 @@ class ia {
|
|
|
11054
11060
|
throw new Error("New drag was started while an existing drag is ongoing");
|
|
11055
11061
|
const i = document.createElement("div");
|
|
11056
11062
|
i.innerHTML = o;
|
|
11057
|
-
const r =
|
|
11063
|
+
const r = wt.fromSchema(this.pmView.state.schema).parse(i, {
|
|
11058
11064
|
topNode: this.pmView.state.schema.nodes.blockGroup.create()
|
|
11059
11065
|
});
|
|
11060
11066
|
this.pmView.dragging = {
|
|
@@ -11404,7 +11410,7 @@ function xs(e, t) {
|
|
|
11404
11410
|
e.suggestionMenus.addTriggerCharacter(t);
|
|
11405
11411
|
}
|
|
11406
11412
|
let M;
|
|
11407
|
-
function
|
|
11413
|
+
function yt(e) {
|
|
11408
11414
|
M || (M = document.createElement("div"), M.innerHTML = "_", M.style.opacity = "0", M.style.height = "1px", M.style.width = "1px", e instanceof Document ? e.body.appendChild(M) : e.appendChild(M));
|
|
11409
11415
|
}
|
|
11410
11416
|
function da(e) {
|
|
@@ -11654,7 +11660,7 @@ class ha extends ne {
|
|
|
11654
11660
|
})
|
|
11655
11661
|
), !this.editor.prosemirrorView)
|
|
11656
11662
|
throw new Error("Editor view not initialized.");
|
|
11657
|
-
|
|
11663
|
+
yt(this.editor.prosemirrorView.root), o.dataTransfer.setDragImage(M, 0, 0), o.dataTransfer.effectAllowed = "move";
|
|
11658
11664
|
});
|
|
11659
11665
|
/**
|
|
11660
11666
|
* Callback that should be set on the `dragStart` event for whichever element
|
|
@@ -11678,7 +11684,7 @@ class ha extends ne {
|
|
|
11678
11684
|
})
|
|
11679
11685
|
), !this.editor.prosemirrorView)
|
|
11680
11686
|
throw new Error("Editor view not initialized.");
|
|
11681
|
-
|
|
11687
|
+
yt(this.editor.prosemirrorView.root), o.dataTransfer.setDragImage(M, 0, 0), o.dataTransfer.effectAllowed = "copyMove";
|
|
11682
11688
|
});
|
|
11683
11689
|
/**
|
|
11684
11690
|
* Callback that should be set on the `dragEnd` event for both the element
|
|
@@ -12677,7 +12683,7 @@ class mo {
|
|
|
12677
12683
|
* @param content can be a string, or array of partial inline content elements
|
|
12678
12684
|
*/
|
|
12679
12685
|
insertInlineContent(t) {
|
|
12680
|
-
const o =
|
|
12686
|
+
const o = H(
|
|
12681
12687
|
t,
|
|
12682
12688
|
this.pmSchema,
|
|
12683
12689
|
this.schema.styleSchema
|
|
@@ -13164,14 +13170,14 @@ export {
|
|
|
13164
13170
|
Kt as EMPTY_CELL_WIDTH,
|
|
13165
13171
|
Ss as Exporter,
|
|
13166
13172
|
Oi as FILE_AUDIO_ICON_SVG,
|
|
13167
|
-
|
|
13173
|
+
Hi as FILE_ICON_SVG,
|
|
13168
13174
|
hn as FILE_IMAGE_ICON_SVG,
|
|
13169
|
-
|
|
13175
|
+
Un as FILE_VIDEO_ICON_SVG,
|
|
13170
13176
|
ln as FileBlock,
|
|
13171
13177
|
Dr as FilePanelProsemirrorPlugin,
|
|
13172
13178
|
jr as FilePanelView,
|
|
13173
13179
|
Or as FormattingToolbarProsemirrorPlugin,
|
|
13174
|
-
|
|
13180
|
+
Hr as FormattingToolbarView,
|
|
13175
13181
|
ao as HTMLToBlocks,
|
|
13176
13182
|
_n as ImageBlock,
|
|
13177
13183
|
$r as LinkToolbarProsemirrorPlugin,
|
|
@@ -13220,13 +13226,13 @@ export {
|
|
|
13220
13226
|
Ee as createExternalHTMLExporter,
|
|
13221
13227
|
We as createFigureWithCaption,
|
|
13222
13228
|
$e as createFileBlockWrapper,
|
|
13223
|
-
|
|
13229
|
+
Ui as createFileNameWithIcon,
|
|
13224
13230
|
ds as createInlineContentSpec,
|
|
13225
13231
|
Li as createInlineContentSpecFromTipTapNode,
|
|
13226
13232
|
Nt as createInternalBlockSpec,
|
|
13227
13233
|
Ci as createInternalHTMLSerializer,
|
|
13228
13234
|
Ii as createInternalInlineContentSpec,
|
|
13229
|
-
|
|
13235
|
+
Ut as createInternalStyleSpec,
|
|
13230
13236
|
Te as createLinkWithCaption,
|
|
13231
13237
|
Ft as createResizableFileBlockWrapper,
|
|
13232
13238
|
$ as createStronglyTypedTiptapNode,
|
|
@@ -13252,7 +13258,7 @@ export {
|
|
|
13252
13258
|
ls as filenameFromURL,
|
|
13253
13259
|
_s as filterSuggestionItems,
|
|
13254
13260
|
V as formatKeyboardShortcut,
|
|
13255
|
-
|
|
13261
|
+
Ur as formattingToolbarPluginKey,
|
|
13256
13262
|
Si as getBlockFromPos,
|
|
13257
13263
|
F as getBlockInfo,
|
|
13258
13264
|
pe as getBlockInfoFromResolvedPos,
|
|
@@ -13263,7 +13269,7 @@ export {
|
|
|
13263
13269
|
Ts as getDefaultEmojiPickerItems,
|
|
13264
13270
|
ks as getDefaultSlashMenuItems,
|
|
13265
13271
|
Ai as getInlineContentParseRules,
|
|
13266
|
-
|
|
13272
|
+
Ht as getInlineContentSchemaFromSpecs,
|
|
13267
13273
|
z as getNearestBlockPos,
|
|
13268
13274
|
A as getNodeById,
|
|
13269
13275
|
vs as getPageBreakSlashMenuItems,
|
|
@@ -13277,7 +13283,7 @@ export {
|
|
|
13277
13283
|
kn as imageToExternalHTML,
|
|
13278
13284
|
Pt as inheritedProps,
|
|
13279
13285
|
qe as initializeESMDependencies,
|
|
13280
|
-
|
|
13286
|
+
H as inlineContentToNodes,
|
|
13281
13287
|
T as insertOrUpdateBlock,
|
|
13282
13288
|
Ei as isAppleOS,
|
|
13283
13289
|
it as isLinkInlineContent,
|
|
@@ -13290,7 +13296,7 @@ export {
|
|
|
13290
13296
|
Sr as markdownToBlocks,
|
|
13291
13297
|
G as mergeCSSClasses,
|
|
13292
13298
|
v as nodeToBlock,
|
|
13293
|
-
|
|
13299
|
+
Ue as nodeToCustomInlineContent,
|
|
13294
13300
|
Ki as pageBreakConfig,
|
|
13295
13301
|
Xi as pageBreakParse,
|
|
13296
13302
|
qi as pageBreakRender,
|