@blocknote/core 0.42.3 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BlockNoteExtension-BWw0r8Gy.cjs +2 -0
- package/dist/BlockNoteExtension-BWw0r8Gy.cjs.map +1 -0
- package/dist/BlockNoteExtension-C2X7LW-V.js +25 -0
- package/dist/BlockNoteExtension-C2X7LW-V.js.map +1 -0
- package/dist/BlockNoteSchema-B4gm-Qco.cjs +2 -0
- package/dist/BlockNoteSchema-B4gm-Qco.cjs.map +1 -0
- package/dist/BlockNoteSchema-C-l154WP.js +270 -0
- package/dist/BlockNoteSchema-C-l154WP.js.map +1 -0
- package/dist/EventEmitter-CLwfmbqG.cjs +2 -0
- package/dist/EventEmitter-CLwfmbqG.cjs.map +1 -0
- package/dist/EventEmitter-CjSwpTbz.js +27 -0
- package/dist/EventEmitter-CjSwpTbz.js.map +1 -0
- package/dist/ShowSelection-BW37oJ6h.cjs +2 -0
- package/dist/ShowSelection-BW37oJ6h.cjs.map +1 -0
- package/dist/ShowSelection-Dz-NEase.js +43 -0
- package/dist/ShowSelection-Dz-NEase.js.map +1 -0
- package/dist/TrailingNode-B_zPMWxw.js +2098 -0
- package/dist/TrailingNode-B_zPMWxw.js.map +1 -0
- package/dist/TrailingNode-CRHrgOnK.cjs +2 -0
- package/dist/TrailingNode-CRHrgOnK.cjs.map +1 -0
- package/dist/{blockToNode-DIfPWLH8.js → blockToNode-DBNbhwwC.js} +33 -33
- package/dist/blockToNode-DBNbhwwC.js.map +1 -0
- package/dist/blockToNode-w7H99R6p.cjs.map +1 -1
- package/dist/blocknote.cjs +4 -4
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +2496 -5686
- package/dist/blocknote.js.map +1 -1
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +71 -70
- package/dist/blocks.js.map +1 -1
- package/dist/comments.cjs +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js +451 -137
- package/dist/comments.js.map +1 -1
- package/dist/defaultBlocks-DLJ4Q1_J.cjs +6 -0
- package/dist/defaultBlocks-DLJ4Q1_J.cjs.map +1 -0
- package/dist/{BlockNoteSchema-Bi-eeHal.js → defaultBlocks-DgA_mtQV.js} +974 -1027
- package/dist/defaultBlocks-DgA_mtQV.js.map +1 -0
- package/dist/extensions.cjs +2 -0
- package/dist/extensions.cjs.map +1 -0
- package/dist/extensions.js +57 -0
- package/dist/extensions.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/yjs.js +1 -1
- package/package.json +9 -3
- package/src/api/nodeConversions/blockToNode.ts +1 -1
- package/src/api/nodeConversions/nodeToBlock.ts +1 -1
- package/src/blocks/Code/block.ts +4 -4
- package/src/blocks/Divider/block.ts +2 -2
- package/src/blocks/File/helpers/render/createAddFileButton.ts +7 -5
- package/src/blocks/Heading/block.ts +23 -20
- package/src/blocks/ListItem/BulletListItem/block.ts +2 -2
- package/src/blocks/ListItem/CheckListItem/block.ts +2 -2
- package/src/blocks/ListItem/NumberedListItem/block.ts +3 -3
- package/src/blocks/ListItem/ToggleListItem/block.ts +2 -2
- package/src/blocks/PageBreak/getPageBreakSlashMenuItems.ts +2 -2
- package/src/blocks/Paragraph/block.ts +2 -2
- package/src/blocks/Quote/block.ts +2 -2
- package/src/blocks/Table/block.ts +4 -3
- package/src/blocks/ToggleWrapper/createToggleWrapper.ts +2 -1
- package/src/comments/extension.ts +353 -0
- package/src/comments/index.ts +2 -1
- package/src/comments/types.ts +8 -0
- package/src/{extensions/Comments → comments}/userstore/UserStore.ts +2 -2
- package/src/editor/BlockNoteEditor.test.ts +2 -23
- package/src/editor/BlockNoteEditor.ts +60 -453
- package/src/editor/BlockNoteExtension.test.ts +103 -0
- package/src/editor/BlockNoteExtension.ts +174 -56
- package/src/editor/managers/EventManager.ts +64 -35
- package/src/editor/managers/ExtensionManager/extensions.ts +214 -0
- package/src/editor/managers/ExtensionManager/index.ts +514 -0
- package/src/editor/managers/ExtensionManager/symbol.ts +6 -0
- package/src/editor/managers/SelectionManager.ts +5 -1
- package/src/editor/managers/StateManager.ts +29 -17
- package/src/editor/managers/index.ts +1 -5
- package/src/extensions/BlockChange/{BlockChangePlugin.ts → BlockChange.ts} +27 -29
- package/src/extensions/Collaboration/{ForkYDocPlugin.test.ts → ForkYDoc.test.ts} +6 -5
- package/src/extensions/Collaboration/ForkYDoc.ts +158 -0
- package/src/extensions/Collaboration/YCursorPlugin.ts +183 -0
- package/src/extensions/Collaboration/YSync.ts +16 -0
- package/src/extensions/Collaboration/YUndo.ts +12 -0
- package/src/extensions/Collaboration/schemaMigration/SchemaMigration.ts +59 -0
- package/src/extensions/DropCursor/DropCursor.ts +26 -0
- package/src/extensions/FilePanel/FilePanel.ts +41 -0
- package/src/extensions/FormattingToolbar/FormattingToolbar.ts +119 -0
- package/src/extensions/History/History.ts +11 -0
- package/src/extensions/LinkToolbar/LinkToolbar.ts +121 -0
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.ts +74 -0
- package/src/extensions/Placeholder/Placeholder.ts +148 -0
- package/src/extensions/PreviousBlockType/{PreviousBlockTypePlugin.ts → PreviousBlockType.ts} +9 -13
- package/src/extensions/ShowSelection/{ShowSelectionPlugin.ts → ShowSelection.ts} +27 -33
- package/src/extensions/SideMenu/{SideMenuPlugin.ts → SideMenu.ts} +63 -83
- package/src/extensions/SuggestionMenu/{SuggestionPlugin.ts → SuggestionMenu.ts} +71 -77
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +29 -44
- package/src/extensions/TableHandles/{TableHandlesPlugin.ts → TableHandles.ts} +416 -437
- package/src/extensions/TrailingNode/{TrailingNodeExtension.ts → TrailingNode.ts} +8 -17
- package/src/extensions/index.ts +24 -0
- package/src/extensions/{BackgroundColor → tiptap-extensions/BackgroundColor}/BackgroundColorExtension.ts +1 -1
- package/src/extensions/{KeyboardShortcuts → tiptap-extensions/KeyboardShortcuts}/KeyboardShortcutsExtension.ts +21 -16
- package/src/extensions/{TextColor → tiptap-extensions/TextColor}/TextColorExtension.ts +1 -1
- package/src/extensions/tiptap-extensions/index.ts +31 -0
- package/src/index.ts +1 -13
- package/src/schema/blocks/createSpec.ts +14 -11
- package/src/schema/blocks/internal.ts +2 -2
- package/src/schema/blocks/types.ts +8 -5
- package/src/schema/schema.ts +11 -36
- package/src/util/topo-sort.ts +46 -0
- package/types/src/comments/extension.d.ts +70 -0
- package/types/src/comments/index.d.ts +2 -1
- package/types/src/comments/types.d.ts +8 -0
- package/types/src/{extensions/Comments → comments}/userstore/UserStore.d.ts +2 -2
- package/types/src/editor/BlockNoteEditor.d.ts +34 -105
- package/types/src/editor/BlockNoteExtension.d.ts +87 -22
- package/types/src/editor/managers/EventManager.d.ts +25 -16
- package/types/src/editor/managers/ExtensionManager/extensions.d.ts +8 -0
- package/types/src/editor/managers/ExtensionManager/index.d.ts +83 -0
- package/types/src/editor/managers/ExtensionManager/symbol.d.ts +5 -0
- package/types/src/editor/managers/StateManager.d.ts +1 -12
- package/types/src/editor/managers/index.d.ts +1 -2
- package/types/src/extensions/BlockChange/BlockChange.d.ts +16 -0
- package/types/src/extensions/Collaboration/ForkYDoc.d.ts +34 -0
- package/types/src/extensions/Collaboration/ForkYDoc.test.d.ts +1 -0
- package/types/src/extensions/Collaboration/YCursorPlugin.d.ts +24 -0
- package/types/src/extensions/Collaboration/YSync.d.ts +8 -0
- package/types/src/extensions/Collaboration/YUndo.d.ts +12 -0
- package/types/src/extensions/Collaboration/schemaMigration/SchemaMigration.d.ts +8 -0
- package/types/src/extensions/DropCursor/DropCursor.d.ts +5 -0
- package/types/src/extensions/FilePanel/FilePanel.d.ts +11 -0
- package/types/src/extensions/FormattingToolbar/FormattingToolbar.d.ts +9 -0
- package/types/src/extensions/History/History.d.ts +6 -0
- package/types/src/extensions/LinkToolbar/LinkToolbar.d.ts +24 -0
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboard.d.ts +5 -0
- package/types/src/extensions/Placeholder/Placeholder.d.ts +6 -0
- package/types/src/extensions/PreviousBlockType/{PreviousBlockTypePlugin.d.ts → PreviousBlockType.d.ts} +9 -5
- package/types/src/extensions/ShowSelection/ShowSelection.d.ts +21 -0
- package/types/src/extensions/SideMenu/{SideMenuPlugin.d.ts → SideMenu.d.ts} +11 -15
- package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +54 -0
- package/types/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.d.ts +1 -1
- package/types/src/extensions/TableHandles/{TableHandlesPlugin.d.ts → TableHandles.d.ts} +28 -31
- package/types/src/extensions/TrailingNode/TrailingNode.d.ts +8 -0
- package/types/src/extensions/index.d.ts +24 -0
- package/types/src/extensions/{KeyboardShortcuts → tiptap-extensions/KeyboardShortcuts}/KeyboardShortcutsExtension.d.ts +1 -1
- package/types/src/extensions/tiptap-extensions/index.d.ts +11 -0
- package/types/src/index.d.ts +1 -13
- package/types/src/schema/blocks/createSpec.d.ts +4 -4
- package/types/src/schema/blocks/internal.d.ts +2 -2
- package/types/src/schema/blocks/types.d.ts +5 -5
- package/types/src/util/topo-sort.d.ts +8 -0
- package/dist/BlockNoteSchema-Bi-eeHal.js.map +0 -1
- package/dist/BlockNoteSchema-DjDaA2C3.cjs +0 -6
- package/dist/BlockNoteSchema-DjDaA2C3.cjs.map +0 -1
- package/dist/blockToNode-DIfPWLH8.js.map +0 -1
- package/src/comments/models/User.ts +0 -8
- package/src/editor/BlockNoteExtensions.ts +0 -325
- package/src/editor/managers/CollaborationManager.ts +0 -212
- package/src/editor/managers/ExtensionManager.ts +0 -130
- package/src/extensions/Collaboration/CursorPlugin.ts +0 -189
- package/src/extensions/Collaboration/ForkYDocPlugin.ts +0 -192
- package/src/extensions/Collaboration/SyncPlugin.ts +0 -18
- package/src/extensions/Collaboration/UndoPlugin.ts +0 -18
- package/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.ts +0 -59
- package/src/extensions/Comments/CommentsPlugin.ts +0 -392
- package/src/extensions/FilePanel/FilePanelPlugin.ts +0 -206
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +0 -363
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +0 -380
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +0 -75
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +0 -147
- package/types/src/comments/models/User.d.ts +0 -8
- package/types/src/editor/BlockNoteExtensions.d.ts +0 -43
- package/types/src/editor/managers/CollaborationManager.d.ts +0 -115
- package/types/src/editor/managers/ExtensionManager.d.ts +0 -68
- package/types/src/extensions/BlockChange/BlockChangePlugin.d.ts +0 -15
- package/types/src/extensions/Collaboration/CursorPlugin.d.ts +0 -37
- package/types/src/extensions/Collaboration/ForkYDocPlugin.d.ts +0 -41
- package/types/src/extensions/Collaboration/SyncPlugin.d.ts +0 -7
- package/types/src/extensions/Collaboration/UndoPlugin.d.ts +0 -9
- package/types/src/extensions/Collaboration/schemaMigration/SchemaMigrationPlugin.d.ts +0 -7
- package/types/src/extensions/Comments/CommentsPlugin.d.ts +0 -66
- package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +0 -31
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +0 -41
- package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +0 -42
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +0 -5
- package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +0 -6
- package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +0 -15
- package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +0 -31
- package/types/src/extensions/TrailingNode/TrailingNodeExtension.d.ts +0 -13
- /package/src/{extensions/Comments/CommentMark.ts → comments/mark.ts} +0 -0
- /package/src/extensions/{HardBreak → tiptap-extensions/HardBreak}/HardBreak.ts +0 -0
- /package/src/extensions/{Suggestions → tiptap-extensions/Suggestions}/SuggestionMarks.ts +0 -0
- /package/src/extensions/{TextAlignment → tiptap-extensions/TextAlignment}/TextAlignmentExtension.ts +0 -0
- /package/src/extensions/{UniqueID → tiptap-extensions/UniqueID}/UniqueID.ts +0 -0
- /package/types/src/{extensions/Comments/CommentMark.d.ts → comments/mark.d.ts} +0 -0
- /package/types/src/{extensions/Collaboration/ForkYDocPlugin.test.d.ts → editor/BlockNoteExtension.test.d.ts} +0 -0
- /package/types/src/extensions/{BackgroundColor → tiptap-extensions/BackgroundColor}/BackgroundColorExtension.d.ts +0 -0
- /package/types/src/extensions/{HardBreak → tiptap-extensions/HardBreak}/HardBreak.d.ts +0 -0
- /package/types/src/extensions/{Suggestions → tiptap-extensions/Suggestions}/SuggestionMarks.d.ts +0 -0
- /package/types/src/extensions/{TextAlignment → tiptap-extensions/TextAlignment}/TextAlignmentExtension.d.ts +0 -0
- /package/types/src/extensions/{TextColor → tiptap-extensions/TextColor}/TextColorExtension.d.ts +0 -0
- /package/types/src/extensions/{UniqueID → tiptap-extensions/UniqueID}/UniqueID.d.ts +0 -0
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
var Oe = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { TableMap as
|
|
5
|
-
import {
|
|
6
|
-
import Ze from "
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
|
|
2
|
+
var _e = (e, t, n) => t in e ? Oe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var L = (e, t, n) => _e(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { TableMap as be, goToNextCell as ne, columnResizing as Ve, tableEditing as Re, CellSelection as Ce, TableView as We } from "prosemirror-tables";
|
|
5
|
+
import { Node as N, Mark as Fe, Extension as $e, callOrReturn as Ue, getExtensionField as qe, mergeAttributes as z, findParentNode as je } from "@tiptap/core";
|
|
6
|
+
import { TextSelection as ke, Plugin as Ge, PluginKey as Ze } from "prosemirror-state";
|
|
7
|
+
import { DecorationSet as oe, Decoration as re } from "prosemirror-view";
|
|
8
|
+
import { ReplaceStep as ze, Mapping as Xe } from "prosemirror-transform";
|
|
9
|
+
import { ySyncPluginKey as ae, absolutePositionToRelativePosition as Ke, relativePositionToAbsolutePosition as Qe } from "y-prosemirror";
|
|
10
|
+
import { c as k, a as ye } from "./BlockNoteExtension-C2X7LW-V.js";
|
|
11
|
+
import { b as X, v as Je, g as O, a as ve, i as se, t as Ye, U as et, q as tt, A as G, r as nt, w as Ee, J as ot } from "./blockToNode-DBNbhwwC.js";
|
|
12
|
+
import rt from "@tiptap/extension-bold";
|
|
13
|
+
import at from "@tiptap/extension-code";
|
|
14
|
+
import st from "@tiptap/extension-italic";
|
|
15
|
+
import it from "@tiptap/extension-strike";
|
|
16
|
+
import ct from "@tiptap/extension-underline";
|
|
17
|
+
import { DOMParser as xe, Fragment as lt, DOMSerializer as ie } from "@tiptap/pm/model";
|
|
18
|
+
import { createHighlightPlugin as dt } from "prosemirror-highlight";
|
|
19
|
+
import { createParser as ut } from "prosemirror-highlight/shiki";
|
|
20
|
+
import { Slice as we, Fragment as F, DOMParser as Se } from "prosemirror-model";
|
|
21
|
+
import { Plugin as pt, PluginKey as ft } from "@tiptap/pm/state";
|
|
22
|
+
import { DecorationSet as ce, Decoration as gt } from "@tiptap/pm/view";
|
|
23
|
+
const ht = () => typeof navigator < "u" && (/Mac/.test(navigator.platform) || /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent));
|
|
19
24
|
function M(e, t = "Ctrl") {
|
|
20
|
-
return
|
|
25
|
+
return ht() ? e.replace("Mod", "⌘") : e.replace("Mod", t);
|
|
21
26
|
}
|
|
22
|
-
function
|
|
27
|
+
function D(...e) {
|
|
23
28
|
return [
|
|
24
29
|
// Converts to & from set to remove duplicates.
|
|
25
30
|
...new Set(
|
|
@@ -27,31 +32,31 @@ function I(...e) {
|
|
|
27
32
|
)
|
|
28
33
|
].join(" ");
|
|
29
34
|
}
|
|
30
|
-
const
|
|
31
|
-
function
|
|
35
|
+
const uo = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
36
|
+
function mt(e, t, n, o) {
|
|
32
37
|
const r = document.createElement("div");
|
|
33
|
-
r.className =
|
|
38
|
+
r.className = D(
|
|
34
39
|
"bn-block-content",
|
|
35
40
|
n.class
|
|
36
41
|
), r.setAttribute("data-content-type", e);
|
|
37
|
-
for (const [s,
|
|
38
|
-
s !== "class" && r.setAttribute(s,
|
|
42
|
+
for (const [s, i] of Object.entries(n))
|
|
43
|
+
s !== "class" && r.setAttribute(s, i);
|
|
39
44
|
const a = document.createElement(t);
|
|
40
|
-
a.className =
|
|
45
|
+
a.className = D(
|
|
41
46
|
"bn-inline-content",
|
|
42
47
|
o.class
|
|
43
48
|
);
|
|
44
|
-
for (const [s,
|
|
49
|
+
for (const [s, i] of Object.entries(
|
|
45
50
|
o
|
|
46
51
|
))
|
|
47
|
-
s !== "class" && a.setAttribute(s,
|
|
52
|
+
s !== "class" && a.setAttribute(s, i);
|
|
48
53
|
return r.appendChild(a), {
|
|
49
54
|
dom: r,
|
|
50
55
|
contentDOM: a
|
|
51
56
|
};
|
|
52
57
|
}
|
|
53
|
-
const
|
|
54
|
-
let n =
|
|
58
|
+
const le = (e, t) => {
|
|
59
|
+
let n = X(e, t.pmSchema);
|
|
55
60
|
n.type.name === "blockContainer" && (n = n.firstChild);
|
|
56
61
|
const o = t.pmSchema.nodes[n.type.name].spec.toDOM;
|
|
57
62
|
if (o === void 0)
|
|
@@ -65,7 +70,7 @@ const re = (e, t) => {
|
|
|
65
70
|
);
|
|
66
71
|
return r;
|
|
67
72
|
};
|
|
68
|
-
function
|
|
73
|
+
function bt(e, t = "<br>") {
|
|
69
74
|
const n = e.querySelectorAll("p");
|
|
70
75
|
if (n.length > 1) {
|
|
71
76
|
const o = n[0];
|
|
@@ -75,15 +80,15 @@ function lt(e, t = "<br>") {
|
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
}
|
|
78
|
-
function
|
|
83
|
+
function W(e) {
|
|
79
84
|
return "data-" + e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
80
85
|
}
|
|
81
|
-
function
|
|
86
|
+
function po(e) {
|
|
82
87
|
const t = e.split("/");
|
|
83
88
|
return !t.length || // invalid?
|
|
84
89
|
t[t.length - 1] === "" ? e : t[t.length - 1];
|
|
85
90
|
}
|
|
86
|
-
function
|
|
91
|
+
function fo(e) {
|
|
87
92
|
var n;
|
|
88
93
|
const t = [
|
|
89
94
|
"mp4",
|
|
@@ -103,7 +108,7 @@ function no(e) {
|
|
|
103
108
|
return !1;
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
|
-
function
|
|
111
|
+
function Ct(e) {
|
|
107
112
|
const t = {};
|
|
108
113
|
return Object.entries(e).forEach(([n, o]) => {
|
|
109
114
|
t[n] = {
|
|
@@ -113,7 +118,7 @@ function dt(e) {
|
|
|
113
118
|
// value is the same as its default, we don't display an HTML
|
|
114
119
|
// attribute for it.
|
|
115
120
|
parseHTML: (r) => {
|
|
116
|
-
const a = r.getAttribute(
|
|
121
|
+
const a = r.getAttribute(W(n));
|
|
117
122
|
if (a === null)
|
|
118
123
|
return null;
|
|
119
124
|
if (o.default === void 0 && o.type === "boolean" || o.default !== void 0 && typeof o.default == "boolean")
|
|
@@ -125,37 +130,37 @@ function dt(e) {
|
|
|
125
130
|
return a;
|
|
126
131
|
},
|
|
127
132
|
renderHTML: (r) => r[n] !== o.default ? {
|
|
128
|
-
[
|
|
133
|
+
[W(n)]: r[n]
|
|
129
134
|
} : {}
|
|
130
135
|
};
|
|
131
136
|
}), t;
|
|
132
137
|
}
|
|
133
|
-
function
|
|
138
|
+
function kt(e, t, n, o) {
|
|
134
139
|
const r = e();
|
|
135
140
|
if (r === void 0)
|
|
136
141
|
throw new Error("Cannot find node position");
|
|
137
142
|
const s = n.state.doc.resolve(r).node().attrs.id;
|
|
138
143
|
if (!s)
|
|
139
144
|
throw new Error("Block doesn't have id");
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
145
|
+
const i = t.getBlock(s);
|
|
146
|
+
if (i.type !== o)
|
|
142
147
|
throw new Error("Block type does not match");
|
|
143
|
-
return
|
|
148
|
+
return i;
|
|
144
149
|
}
|
|
145
|
-
function
|
|
150
|
+
function Z(e, t, n, o, r = !1, a) {
|
|
146
151
|
const s = document.createElement("div");
|
|
147
152
|
if (a !== void 0)
|
|
148
|
-
for (const [
|
|
149
|
-
|
|
150
|
-
s.className =
|
|
153
|
+
for (const [i, c] of Object.entries(a))
|
|
154
|
+
i !== "class" && s.setAttribute(i, c);
|
|
155
|
+
s.className = D(
|
|
151
156
|
"bn-block-content",
|
|
152
157
|
(a == null ? void 0 : a.class) || ""
|
|
153
158
|
), s.setAttribute("data-content-type", t);
|
|
154
|
-
for (const [
|
|
155
|
-
const u = o[
|
|
156
|
-
|
|
159
|
+
for (const [i, c] of Object.entries(n)) {
|
|
160
|
+
const u = o[i].default;
|
|
161
|
+
c !== u && s.setAttribute(W(i), c);
|
|
157
162
|
}
|
|
158
|
-
return r && s.setAttribute("data-file-block", ""), s.appendChild(e.dom), e.contentDOM && (e.contentDOM.className =
|
|
163
|
+
return r && s.setAttribute("data-file-block", ""), s.appendChild(e.dom), e.contentDOM && (e.contentDOM.className = D(
|
|
159
164
|
"bn-inline-content",
|
|
160
165
|
e.contentDOM.className
|
|
161
166
|
)), {
|
|
@@ -163,7 +168,7 @@ function G(e, t, n, o, r = !1, a) {
|
|
|
163
168
|
dom: s
|
|
164
169
|
};
|
|
165
170
|
}
|
|
166
|
-
function
|
|
171
|
+
function yt(e, t, n) {
|
|
167
172
|
return {
|
|
168
173
|
config: {
|
|
169
174
|
type: e.type,
|
|
@@ -172,18 +177,18 @@ function pt(e, t, n) {
|
|
|
172
177
|
},
|
|
173
178
|
implementation: {
|
|
174
179
|
node: e.node,
|
|
175
|
-
render:
|
|
176
|
-
toExternalHTML:
|
|
180
|
+
render: le,
|
|
181
|
+
toExternalHTML: le
|
|
177
182
|
},
|
|
178
183
|
extensions: n
|
|
179
184
|
};
|
|
180
185
|
}
|
|
181
|
-
function
|
|
186
|
+
function vt(e, t) {
|
|
182
187
|
e.stopEvent = (n) => (n.type === "mousedown" && setTimeout(() => {
|
|
183
188
|
t.view.dom.blur();
|
|
184
189
|
}, 10), !0);
|
|
185
190
|
}
|
|
186
|
-
function
|
|
191
|
+
function Et(e, t) {
|
|
187
192
|
const n = [
|
|
188
193
|
{
|
|
189
194
|
tag: "[data-content-type=" + e.type + "]",
|
|
@@ -207,40 +212,40 @@ function mt(e, t) {
|
|
|
207
212
|
schema: r
|
|
208
213
|
});
|
|
209
214
|
if (e.content === "inline") {
|
|
210
|
-
const
|
|
211
|
-
return
|
|
212
|
-
|
|
215
|
+
const i = o.cloneNode(!0);
|
|
216
|
+
return bt(
|
|
217
|
+
i,
|
|
213
218
|
(a = t.meta) != null && a.code ? `
|
|
214
219
|
` : "<br>"
|
|
215
|
-
),
|
|
220
|
+
), xe.fromSchema(r).parse(i, {
|
|
216
221
|
topNode: r.nodes.paragraph.create()
|
|
217
222
|
}).content;
|
|
218
223
|
}
|
|
219
|
-
return
|
|
224
|
+
return lt.empty;
|
|
220
225
|
} : void 0
|
|
221
226
|
}), n;
|
|
222
227
|
}
|
|
223
|
-
function
|
|
224
|
-
var a, s,
|
|
228
|
+
function go(e, t, n, o) {
|
|
229
|
+
var a, s, i, c;
|
|
225
230
|
const r = t.node || N.create({
|
|
226
231
|
name: e.type,
|
|
227
232
|
content: e.content === "inline" ? "inline*" : e.content === "none" ? "" : e.content,
|
|
228
233
|
group: "blockContent",
|
|
229
234
|
selectable: ((a = t.meta) == null ? void 0 : a.selectable) ?? !0,
|
|
230
235
|
isolating: ((s = t.meta) == null ? void 0 : s.isolating) ?? !0,
|
|
231
|
-
code: ((
|
|
232
|
-
defining: ((
|
|
236
|
+
code: ((i = t.meta) == null ? void 0 : i.code) ?? !1,
|
|
237
|
+
defining: ((c = t.meta) == null ? void 0 : c.defining) ?? !0,
|
|
233
238
|
priority: o,
|
|
234
239
|
addAttributes() {
|
|
235
|
-
return
|
|
240
|
+
return Ct(e.propSchema);
|
|
236
241
|
},
|
|
237
242
|
parseHTML() {
|
|
238
|
-
return
|
|
243
|
+
return Et(e, t);
|
|
239
244
|
},
|
|
240
|
-
renderHTML({ HTMLAttributes:
|
|
245
|
+
renderHTML({ HTMLAttributes: l }) {
|
|
241
246
|
var d;
|
|
242
247
|
const u = document.createElement("div");
|
|
243
|
-
return
|
|
248
|
+
return Z(
|
|
244
249
|
{
|
|
245
250
|
dom: u,
|
|
246
251
|
contentDOM: e.content === "inline" ? u : void 0
|
|
@@ -249,23 +254,23 @@ function ht(e, t, n, o) {
|
|
|
249
254
|
{},
|
|
250
255
|
e.propSchema,
|
|
251
256
|
((d = t.meta) == null ? void 0 : d.fileBlockAccept) !== void 0,
|
|
252
|
-
|
|
257
|
+
l
|
|
253
258
|
);
|
|
254
259
|
},
|
|
255
260
|
addNodeView() {
|
|
256
|
-
return (
|
|
257
|
-
var f,
|
|
258
|
-
const u = this.options.editor, d =
|
|
259
|
-
|
|
261
|
+
return (l) => {
|
|
262
|
+
var f, E;
|
|
263
|
+
const u = this.options.editor, d = kt(
|
|
264
|
+
l.getPos,
|
|
260
265
|
u,
|
|
261
266
|
this.editor,
|
|
262
267
|
e.type
|
|
263
268
|
), p = ((f = this.options.domAttributes) == null ? void 0 : f.blockContent) || {}, h = t.render.call(
|
|
264
|
-
{ blockContentDOMAttributes: p, props:
|
|
269
|
+
{ blockContentDOMAttributes: p, props: l, renderType: "nodeView" },
|
|
265
270
|
d,
|
|
266
271
|
u
|
|
267
272
|
);
|
|
268
|
-
return ((
|
|
273
|
+
return ((E = t.meta) == null ? void 0 : E.selectable) === !1 && vt(h, this.editor), h;
|
|
269
274
|
};
|
|
270
275
|
}
|
|
271
276
|
});
|
|
@@ -278,7 +283,7 @@ function ht(e, t, n, o) {
|
|
|
278
283
|
implementation: {
|
|
279
284
|
...t,
|
|
280
285
|
node: r,
|
|
281
|
-
render(
|
|
286
|
+
render(l, u) {
|
|
282
287
|
var p;
|
|
283
288
|
const d = ((p = r.options.domAttributes) == null ? void 0 : p.blockContent) || {};
|
|
284
289
|
return t.render.call(
|
|
@@ -287,22 +292,22 @@ function ht(e, t, n, o) {
|
|
|
287
292
|
props: void 0,
|
|
288
293
|
renderType: "dom"
|
|
289
294
|
},
|
|
290
|
-
|
|
295
|
+
l,
|
|
291
296
|
u
|
|
292
297
|
);
|
|
293
298
|
},
|
|
294
299
|
// TODO: this should not have wrapInBlockStructure and generally be a lot simpler
|
|
295
300
|
// post-processing in externalHTMLExporter should not be necessary
|
|
296
|
-
toExternalHTML: (
|
|
301
|
+
toExternalHTML: (l, u) => {
|
|
297
302
|
var p, h;
|
|
298
303
|
const d = ((p = r.options.domAttributes) == null ? void 0 : p.blockContent) || {};
|
|
299
304
|
return ((h = t.toExternalHTML) == null ? void 0 : h.call(
|
|
300
305
|
{ blockContentDOMAttributes: d },
|
|
301
|
-
|
|
306
|
+
l,
|
|
302
307
|
u
|
|
303
308
|
)) ?? t.render.call(
|
|
304
309
|
{ blockContentDOMAttributes: d, renderType: "dom", props: void 0 },
|
|
305
|
-
|
|
310
|
+
l,
|
|
306
311
|
u
|
|
307
312
|
);
|
|
308
313
|
}
|
|
@@ -310,7 +315,7 @@ function ht(e, t, n, o) {
|
|
|
310
315
|
extensions: n
|
|
311
316
|
};
|
|
312
317
|
}
|
|
313
|
-
function
|
|
318
|
+
function ho(e) {
|
|
314
319
|
return e;
|
|
315
320
|
}
|
|
316
321
|
function v(e, t, n) {
|
|
@@ -322,37 +327,37 @@ function v(e, t, n) {
|
|
|
322
327
|
...a,
|
|
323
328
|
// TODO: this should not have wrapInBlockStructure and generally be a lot simpler
|
|
324
329
|
// post-processing in externalHTMLExporter should not be necessary
|
|
325
|
-
toExternalHTML(
|
|
330
|
+
toExternalHTML(i, c) {
|
|
326
331
|
var u, d;
|
|
327
|
-
const
|
|
332
|
+
const l = (u = a.toExternalHTML) == null ? void 0 : u.call(
|
|
328
333
|
{ blockContentDOMAttributes: this.blockContentDOMAttributes },
|
|
329
|
-
|
|
330
|
-
|
|
334
|
+
i,
|
|
335
|
+
c
|
|
331
336
|
);
|
|
332
|
-
if (
|
|
333
|
-
return
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
+
if (l !== void 0)
|
|
338
|
+
return Z(
|
|
339
|
+
l,
|
|
340
|
+
i.type,
|
|
341
|
+
i.props,
|
|
337
342
|
r.propSchema,
|
|
338
343
|
((d = a.meta) == null ? void 0 : d.fileBlockAccept) !== void 0
|
|
339
344
|
);
|
|
340
345
|
},
|
|
341
|
-
render(
|
|
346
|
+
render(i, c) {
|
|
342
347
|
var d;
|
|
343
|
-
const
|
|
348
|
+
const l = a.render.call(
|
|
344
349
|
{
|
|
345
350
|
blockContentDOMAttributes: this.blockContentDOMAttributes,
|
|
346
351
|
renderType: this.renderType,
|
|
347
352
|
props: this.props
|
|
348
353
|
},
|
|
349
|
-
c,
|
|
350
|
-
l
|
|
351
|
-
);
|
|
352
|
-
return G(
|
|
353
354
|
i,
|
|
354
|
-
c
|
|
355
|
-
|
|
355
|
+
c
|
|
356
|
+
);
|
|
357
|
+
return Z(
|
|
358
|
+
l,
|
|
359
|
+
i.type,
|
|
360
|
+
i.props,
|
|
356
361
|
r.propSchema,
|
|
357
362
|
((d = a.meta) == null ? void 0 : d.fileBlockAccept) !== void 0,
|
|
358
363
|
this.blockContentDOMAttributes
|
|
@@ -363,13 +368,13 @@ function v(e, t, n) {
|
|
|
363
368
|
};
|
|
364
369
|
};
|
|
365
370
|
}
|
|
366
|
-
function
|
|
371
|
+
function mo(e, t, n, o) {
|
|
367
372
|
return e.dom.setAttribute("data-inline-content-type", t), Object.entries(n).filter(([r, a]) => {
|
|
368
373
|
const s = o[r];
|
|
369
374
|
return a !== s.default;
|
|
370
|
-
}).map(([r, a]) => [
|
|
375
|
+
}).map(([r, a]) => [W(r), a]).forEach(([r, a]) => e.dom.setAttribute(r, a)), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
371
376
|
}
|
|
372
|
-
function
|
|
377
|
+
function bo(e) {
|
|
373
378
|
return {
|
|
374
379
|
Backspace: ({ editor: t }) => {
|
|
375
380
|
const n = t.state.selection.$from;
|
|
@@ -377,14 +382,14 @@ function ao(e) {
|
|
|
377
382
|
}
|
|
378
383
|
};
|
|
379
384
|
}
|
|
380
|
-
function
|
|
385
|
+
function xt(e, t) {
|
|
381
386
|
return {
|
|
382
387
|
config: e,
|
|
383
388
|
implementation: t
|
|
384
389
|
};
|
|
385
390
|
}
|
|
386
|
-
function
|
|
387
|
-
return
|
|
391
|
+
function Co(e, t, n) {
|
|
392
|
+
return xt(
|
|
388
393
|
{
|
|
389
394
|
type: e.name,
|
|
390
395
|
propSchema: t,
|
|
@@ -396,12 +401,12 @@ function so(e, t, n) {
|
|
|
396
401
|
}
|
|
397
402
|
);
|
|
398
403
|
}
|
|
399
|
-
function
|
|
404
|
+
function wt(e) {
|
|
400
405
|
return Object.fromEntries(
|
|
401
406
|
Object.entries(e).map(([t, n]) => [t, n.config])
|
|
402
407
|
);
|
|
403
408
|
}
|
|
404
|
-
function
|
|
409
|
+
function St(e) {
|
|
405
410
|
return e === "boolean" ? {} : {
|
|
406
411
|
stringValue: {
|
|
407
412
|
default: void 0,
|
|
@@ -413,17 +418,17 @@ function bt(e) {
|
|
|
413
418
|
}
|
|
414
419
|
};
|
|
415
420
|
}
|
|
416
|
-
function
|
|
421
|
+
function V(e, t, n, o) {
|
|
417
422
|
return e.dom.setAttribute("data-style-type", t), o === "string" && e.dom.setAttribute("data-value", n), e.contentDOM && e.contentDOM.setAttribute("data-editable", ""), e;
|
|
418
423
|
}
|
|
419
|
-
function
|
|
424
|
+
function Me(e, t) {
|
|
420
425
|
return {
|
|
421
426
|
config: e,
|
|
422
427
|
implementation: t
|
|
423
428
|
};
|
|
424
429
|
}
|
|
425
430
|
function H(e, t) {
|
|
426
|
-
return
|
|
431
|
+
return Me(
|
|
427
432
|
{
|
|
428
433
|
type: e.name,
|
|
429
434
|
propSchema: t
|
|
@@ -438,7 +443,7 @@ function H(e, t) {
|
|
|
438
443
|
);
|
|
439
444
|
const a = o.pmSchema.mark(e.name, {
|
|
440
445
|
stringValue: n
|
|
441
|
-
}), s =
|
|
446
|
+
}), s = ie.renderSpec(
|
|
442
447
|
document,
|
|
443
448
|
r(a, !0)
|
|
444
449
|
);
|
|
@@ -456,7 +461,7 @@ function H(e, t) {
|
|
|
456
461
|
);
|
|
457
462
|
const a = o.pmSchema.mark(e.name, {
|
|
458
463
|
stringValue: n
|
|
459
|
-
}), s =
|
|
464
|
+
}), s = ie.renderSpec(
|
|
460
465
|
document,
|
|
461
466
|
r(a, !0)
|
|
462
467
|
);
|
|
@@ -469,12 +474,12 @@ function H(e, t) {
|
|
|
469
474
|
}
|
|
470
475
|
);
|
|
471
476
|
}
|
|
472
|
-
function
|
|
477
|
+
function Mt(e) {
|
|
473
478
|
return Object.fromEntries(
|
|
474
479
|
Object.entries(e).map(([t, n]) => [t, n.config])
|
|
475
480
|
);
|
|
476
481
|
}
|
|
477
|
-
function
|
|
482
|
+
function Lt(e, t) {
|
|
478
483
|
const n = [
|
|
479
484
|
{
|
|
480
485
|
tag: `[data-style-type="${e.type}"]`,
|
|
@@ -498,18 +503,18 @@ function kt(e, t) {
|
|
|
498
503
|
}
|
|
499
504
|
}), n;
|
|
500
505
|
}
|
|
501
|
-
function
|
|
502
|
-
const n =
|
|
506
|
+
function Le(e, t) {
|
|
507
|
+
const n = Fe.create({
|
|
503
508
|
name: e.type,
|
|
504
509
|
addAttributes() {
|
|
505
|
-
return
|
|
510
|
+
return St(e.propSchema);
|
|
506
511
|
},
|
|
507
512
|
parseHTML() {
|
|
508
|
-
return
|
|
513
|
+
return Lt(e, t.parse);
|
|
509
514
|
},
|
|
510
515
|
renderHTML({ mark: o }) {
|
|
511
516
|
const r = (t.toExternalHTML || t.render)(o.attrs.stringValue);
|
|
512
|
-
return
|
|
517
|
+
return V(
|
|
513
518
|
r,
|
|
514
519
|
e.type,
|
|
515
520
|
o.attrs.stringValue,
|
|
@@ -519,7 +524,7 @@ function Ee(e, t) {
|
|
|
519
524
|
addMarkView() {
|
|
520
525
|
return ({ mark: o }) => {
|
|
521
526
|
const r = t.render(o.attrs.stringValue);
|
|
522
|
-
return
|
|
527
|
+
return V(
|
|
523
528
|
r,
|
|
524
529
|
e.type,
|
|
525
530
|
o.attrs.stringValue,
|
|
@@ -528,12 +533,12 @@ function Ee(e, t) {
|
|
|
528
533
|
};
|
|
529
534
|
}
|
|
530
535
|
});
|
|
531
|
-
return
|
|
536
|
+
return Me(e, {
|
|
532
537
|
...t,
|
|
533
538
|
mark: n,
|
|
534
539
|
render: (o) => {
|
|
535
540
|
const r = t.render(o);
|
|
536
|
-
return
|
|
541
|
+
return V(
|
|
537
542
|
r,
|
|
538
543
|
e.type,
|
|
539
544
|
o,
|
|
@@ -542,7 +547,7 @@ function Ee(e, t) {
|
|
|
542
547
|
},
|
|
543
548
|
toExternalHTML: (o) => {
|
|
544
549
|
const r = (t.toExternalHTML || t.render)(o);
|
|
545
|
-
return
|
|
550
|
+
return V(
|
|
546
551
|
r,
|
|
547
552
|
e.type,
|
|
548
553
|
o,
|
|
@@ -551,229 +556,54 @@ function Ee(e, t) {
|
|
|
551
556
|
}
|
|
552
557
|
});
|
|
553
558
|
}
|
|
554
|
-
function
|
|
555
|
-
const t = vt(e);
|
|
556
|
-
let { roots: n, nonRoots: o } = ae(t);
|
|
557
|
-
const r = [];
|
|
558
|
-
for (; n.size; ) {
|
|
559
|
-
r.push(n);
|
|
560
|
-
const a = /* @__PURE__ */ new Set();
|
|
561
|
-
for (const s of n) {
|
|
562
|
-
const c = e.get(s);
|
|
563
|
-
if (c)
|
|
564
|
-
for (const l of c) {
|
|
565
|
-
const i = t.get(l);
|
|
566
|
-
if (i === void 0)
|
|
567
|
-
continue;
|
|
568
|
-
const u = i - 1;
|
|
569
|
-
t.set(l, u), u === 0 && a.add(l);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
n = a;
|
|
573
|
-
}
|
|
574
|
-
if (o = ae(t).nonRoots, o.size)
|
|
575
|
-
throw new Error(
|
|
576
|
-
`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(o).join(", ")}`
|
|
577
|
-
);
|
|
578
|
-
return r;
|
|
579
|
-
}
|
|
580
|
-
function yt(e) {
|
|
581
|
-
const t = St(e);
|
|
582
|
-
return Ct(t);
|
|
583
|
-
}
|
|
584
|
-
function vt(e) {
|
|
585
|
-
const t = /* @__PURE__ */ new Map();
|
|
586
|
-
for (const [n, o] of e.entries()) {
|
|
587
|
-
t.has(n) || t.set(n, 0);
|
|
588
|
-
for (const r of o) {
|
|
589
|
-
const a = t.get(r) ?? 0;
|
|
590
|
-
t.set(r, a + 1);
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
return t;
|
|
594
|
-
}
|
|
595
|
-
function ae(e) {
|
|
596
|
-
const t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
597
|
-
for (const [o, r] of e.entries())
|
|
598
|
-
r === 0 ? t.add(o) : n.add(o);
|
|
599
|
-
return { roots: t, nonRoots: n };
|
|
600
|
-
}
|
|
601
|
-
function St(e) {
|
|
602
|
-
const t = /* @__PURE__ */ new Map();
|
|
603
|
-
for (const [n, o] of e.entries()) {
|
|
604
|
-
t.has(n) || t.set(n, /* @__PURE__ */ new Set());
|
|
605
|
-
for (const r of o)
|
|
606
|
-
t.has(r) || t.set(r, /* @__PURE__ */ new Set()), t.get(r).add(n);
|
|
607
|
-
}
|
|
608
|
-
return t;
|
|
609
|
-
}
|
|
610
|
-
function Et() {
|
|
611
|
-
return /* @__PURE__ */ new Map();
|
|
612
|
-
}
|
|
613
|
-
function se(e) {
|
|
614
|
-
return e && Object.fromEntries(
|
|
615
|
-
Object.entries(e).filter(([, t]) => t !== void 0)
|
|
616
|
-
);
|
|
617
|
-
}
|
|
618
|
-
class wt {
|
|
619
|
-
constructor(t) {
|
|
620
|
-
// Helper so that you can use typeof schema.BlockNoteEditor
|
|
621
|
-
C(this, "BlockNoteEditor", "only for types");
|
|
622
|
-
C(this, "Block", "only for types");
|
|
623
|
-
C(this, "PartialBlock", "only for types");
|
|
624
|
-
C(this, "inlineContentSpecs");
|
|
625
|
-
C(this, "styleSpecs");
|
|
626
|
-
C(this, "blockSpecs");
|
|
627
|
-
C(this, "blockSchema");
|
|
628
|
-
C(this, "inlineContentSchema");
|
|
629
|
-
C(this, "styleSchema");
|
|
630
|
-
this.opts = t;
|
|
631
|
-
const {
|
|
632
|
-
blockSpecs: n,
|
|
633
|
-
inlineContentSpecs: o,
|
|
634
|
-
styleSpecs: r,
|
|
635
|
-
blockSchema: a,
|
|
636
|
-
inlineContentSchema: s,
|
|
637
|
-
styleSchema: c
|
|
638
|
-
} = this.init();
|
|
639
|
-
this.blockSpecs = n, this.styleSpecs = r, this.styleSchema = c, this.inlineContentSpecs = o, this.blockSchema = a, this.inlineContentSchema = s;
|
|
640
|
-
}
|
|
641
|
-
init() {
|
|
642
|
-
var i;
|
|
643
|
-
const t = Et(), n = /* @__PURE__ */ new Set();
|
|
644
|
-
t.set("default", n);
|
|
645
|
-
for (const [u, d] of Object.entries({
|
|
646
|
-
...this.opts.blockSpecs,
|
|
647
|
-
...this.opts.inlineContentSpecs,
|
|
648
|
-
...this.opts.styleSpecs
|
|
649
|
-
}))
|
|
650
|
-
(i = d.implementation) != null && i.runsBefore ? t.set(u, new Set(d.implementation.runsBefore)) : n.add(u);
|
|
651
|
-
const o = yt(t), r = o.findIndex((u) => u.has("default")), a = (u) => 91 + (o.findIndex((p) => p.has(u)) + r) * 10, s = Object.fromEntries(
|
|
652
|
-
Object.entries(this.opts.blockSpecs).map(([u, d]) => [
|
|
653
|
-
u,
|
|
654
|
-
ht(
|
|
655
|
-
d.config,
|
|
656
|
-
d.implementation,
|
|
657
|
-
d.extensions,
|
|
658
|
-
a(u)
|
|
659
|
-
)
|
|
660
|
-
])
|
|
661
|
-
), c = Object.fromEntries(
|
|
662
|
-
Object.entries(this.opts.inlineContentSpecs).map(
|
|
663
|
-
([u, d]) => {
|
|
664
|
-
var p;
|
|
665
|
-
return typeof d.config != "object" ? [u, d] : [
|
|
666
|
-
u,
|
|
667
|
-
{
|
|
668
|
-
...d,
|
|
669
|
-
implementation: {
|
|
670
|
-
...d.implementation,
|
|
671
|
-
node: (p = d.implementation) == null ? void 0 : p.node.extend({
|
|
672
|
-
priority: a(u)
|
|
673
|
-
})
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
];
|
|
677
|
-
}
|
|
678
|
-
)
|
|
679
|
-
), l = Object.fromEntries(
|
|
680
|
-
Object.entries(this.opts.styleSpecs).map(([u, d]) => {
|
|
681
|
-
var p;
|
|
682
|
-
return [
|
|
683
|
-
u,
|
|
684
|
-
{
|
|
685
|
-
...d,
|
|
686
|
-
implementation: {
|
|
687
|
-
...d.implementation,
|
|
688
|
-
mark: (p = d.implementation) == null ? void 0 : p.mark.extend({
|
|
689
|
-
priority: a(u)
|
|
690
|
-
})
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
];
|
|
694
|
-
})
|
|
695
|
-
);
|
|
696
|
-
return {
|
|
697
|
-
blockSpecs: s,
|
|
698
|
-
blockSchema: Object.fromEntries(
|
|
699
|
-
Object.entries(s).map(([u, d]) => [u, d.config])
|
|
700
|
-
),
|
|
701
|
-
inlineContentSpecs: se(c),
|
|
702
|
-
styleSpecs: se(l),
|
|
703
|
-
inlineContentSchema: ye(
|
|
704
|
-
c
|
|
705
|
-
),
|
|
706
|
-
styleSchema: Se(l)
|
|
707
|
-
};
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Adds additional block specs to the current schema in a builder pattern.
|
|
711
|
-
* This method allows extending the schema after it has been created.
|
|
712
|
-
*
|
|
713
|
-
* @param additionalBlockSpecs - Additional block specs to add to the schema
|
|
714
|
-
* @returns The current schema instance for chaining
|
|
715
|
-
*/
|
|
716
|
-
extend(t) {
|
|
717
|
-
Object.assign(this.opts.blockSpecs, t.blockSpecs), Object.assign(this.opts.inlineContentSpecs, t.inlineContentSpecs), Object.assign(this.opts.styleSpecs, t.styleSpecs);
|
|
718
|
-
const {
|
|
719
|
-
blockSpecs: n,
|
|
720
|
-
inlineContentSpecs: o,
|
|
721
|
-
styleSpecs: r,
|
|
722
|
-
blockSchema: a,
|
|
723
|
-
inlineContentSchema: s,
|
|
724
|
-
styleSchema: c
|
|
725
|
-
} = this.init();
|
|
726
|
-
return this.blockSpecs = n, this.styleSpecs = r, this.styleSchema = c, this.inlineContentSpecs = o, this.blockSchema = a, this.inlineContentSchema = s, this;
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
function xt(e, t) {
|
|
559
|
+
function Tt(e, t) {
|
|
730
560
|
let n, o;
|
|
731
|
-
if (t.firstChild.descendants((r, a) => n ? !1 : !
|
|
561
|
+
if (t.firstChild.descendants((r, a) => n ? !1 : !Bt(r) || r.attrs.id !== e ? !0 : (n = r, o = a + 1, !1)), !(n === void 0 || o === void 0))
|
|
732
562
|
return {
|
|
733
563
|
node: n,
|
|
734
564
|
posBeforeNode: o
|
|
735
565
|
};
|
|
736
566
|
}
|
|
737
|
-
function
|
|
567
|
+
function Bt(e) {
|
|
738
568
|
return e.type.isInGroup("bnBlock");
|
|
739
569
|
}
|
|
740
|
-
const
|
|
570
|
+
const ko = (e, t) => ({
|
|
741
571
|
tr: n,
|
|
742
572
|
dispatch: o
|
|
743
|
-
}) => (o &&
|
|
744
|
-
function
|
|
745
|
-
const a =
|
|
573
|
+
}) => (o && K(n, e, t), !0);
|
|
574
|
+
function K(e, t, n, o, r) {
|
|
575
|
+
const a = Je(e.doc.resolve(t));
|
|
746
576
|
let s = null;
|
|
747
|
-
a.blockNoteType === "table" && (s =
|
|
748
|
-
const
|
|
577
|
+
a.blockNoteType === "table" && (s = Pt(e));
|
|
578
|
+
const i = O(e);
|
|
749
579
|
if (o !== void 0 && r !== void 0 && o > r)
|
|
750
580
|
throw new Error("Invalid replaceFromPos or replaceToPos");
|
|
751
|
-
const
|
|
752
|
-
if (a.isBlockContainer &&
|
|
581
|
+
const c = i.nodes[a.blockNoteType], l = i.nodes[n.type || a.blockNoteType], u = l.isInGroup("bnBlock") ? l : i.nodes.blockContainer;
|
|
582
|
+
if (a.isBlockContainer && l.isInGroup("blockContent")) {
|
|
753
583
|
const d = o !== void 0 && o > a.blockContent.beforePos && o < a.blockContent.afterPos ? o - a.blockContent.beforePos - 1 : void 0, p = r !== void 0 && r > a.blockContent.beforePos && r < a.blockContent.afterPos ? r - a.blockContent.beforePos - 1 : void 0;
|
|
754
|
-
|
|
584
|
+
de(n, e, a), At(
|
|
755
585
|
n,
|
|
756
586
|
e,
|
|
587
|
+
c,
|
|
757
588
|
l,
|
|
758
|
-
i,
|
|
759
589
|
a,
|
|
760
590
|
d,
|
|
761
591
|
p
|
|
762
592
|
);
|
|
763
|
-
} else if (!a.isBlockContainer &&
|
|
764
|
-
|
|
593
|
+
} else if (!a.isBlockContainer && l.isInGroup("bnBlock"))
|
|
594
|
+
de(n, e, a);
|
|
765
595
|
else {
|
|
766
|
-
const d =
|
|
596
|
+
const d = ve(a.bnBlock.node, i);
|
|
767
597
|
e.replaceWith(
|
|
768
598
|
a.bnBlock.beforePos,
|
|
769
599
|
a.bnBlock.afterPos,
|
|
770
|
-
|
|
600
|
+
X(
|
|
771
601
|
{
|
|
772
602
|
children: d.children,
|
|
773
603
|
// if no children are passed in, use existing children
|
|
774
604
|
...n
|
|
775
605
|
},
|
|
776
|
-
|
|
606
|
+
i
|
|
777
607
|
)
|
|
778
608
|
);
|
|
779
609
|
return;
|
|
@@ -781,27 +611,27 @@ function q(e, t, n, o, r) {
|
|
|
781
611
|
e.setNodeMarkup(a.bnBlock.beforePos, u, {
|
|
782
612
|
...a.bnBlock.node.attrs,
|
|
783
613
|
...n.props
|
|
784
|
-
}), s &&
|
|
614
|
+
}), s && Nt(e, a, s);
|
|
785
615
|
}
|
|
786
|
-
function
|
|
787
|
-
const
|
|
788
|
-
let
|
|
616
|
+
function At(e, t, n, o, r, a, s) {
|
|
617
|
+
const i = O(t);
|
|
618
|
+
let c = "keep";
|
|
789
619
|
if (e.content)
|
|
790
620
|
if (typeof e.content == "string")
|
|
791
|
-
|
|
621
|
+
c = se(
|
|
792
622
|
[e.content],
|
|
793
|
-
|
|
623
|
+
i,
|
|
794
624
|
o.name
|
|
795
625
|
);
|
|
796
626
|
else if (Array.isArray(e.content))
|
|
797
|
-
|
|
627
|
+
c = se(e.content, i, o.name);
|
|
798
628
|
else if (e.content.type === "tableContent")
|
|
799
|
-
|
|
629
|
+
c = Ye(e.content, i);
|
|
800
630
|
else
|
|
801
|
-
throw new
|
|
631
|
+
throw new et(e.content.type);
|
|
802
632
|
else
|
|
803
|
-
n.spec.content === "" || o.spec.content !== n.spec.content && (
|
|
804
|
-
if (
|
|
633
|
+
n.spec.content === "" || o.spec.content !== n.spec.content && (c = []);
|
|
634
|
+
if (c === "keep")
|
|
805
635
|
t.setNodeMarkup(r.blockContent.beforePos, o, {
|
|
806
636
|
...r.blockContent.node.attrs,
|
|
807
637
|
...e.props
|
|
@@ -811,12 +641,12 @@ function Mt(e, t, n, o, r, a, s) {
|
|
|
811
641
|
...r.blockContent.node.attrs,
|
|
812
642
|
...e.props
|
|
813
643
|
});
|
|
814
|
-
const
|
|
644
|
+
const l = r.blockContent.beforePos + 1 + (a ?? 0), u = r.blockContent.beforePos + 1 + (s ?? r.blockContent.node.content.size), d = t.doc.resolve(r.blockContent.beforePos).depth, p = t.doc.resolve(l).depth, h = t.doc.resolve(u).depth;
|
|
815
645
|
t.replace(
|
|
816
|
-
|
|
646
|
+
l,
|
|
817
647
|
u,
|
|
818
|
-
new
|
|
819
|
-
|
|
648
|
+
new we(
|
|
649
|
+
F.from(c),
|
|
820
650
|
p - d - 1,
|
|
821
651
|
h - d - 1
|
|
822
652
|
)
|
|
@@ -830,20 +660,20 @@ function Mt(e, t, n, o, r, a, s) {
|
|
|
830
660
|
...r.blockContent.node.attrs,
|
|
831
661
|
...e.props
|
|
832
662
|
},
|
|
833
|
-
|
|
663
|
+
c
|
|
834
664
|
)
|
|
835
665
|
);
|
|
836
666
|
}
|
|
837
|
-
function
|
|
838
|
-
const o =
|
|
667
|
+
function de(e, t, n) {
|
|
668
|
+
const o = O(t);
|
|
839
669
|
if (e.children !== void 0 && e.children.length > 0) {
|
|
840
|
-
const r = e.children.map((a) =>
|
|
670
|
+
const r = e.children.map((a) => X(a, o));
|
|
841
671
|
if (n.childContainer)
|
|
842
672
|
t.step(
|
|
843
|
-
new
|
|
673
|
+
new ze(
|
|
844
674
|
n.childContainer.beforePos + 1,
|
|
845
675
|
n.childContainer.afterPos - 1,
|
|
846
|
-
new
|
|
676
|
+
new we(F.from(r), 0, 0)
|
|
847
677
|
)
|
|
848
678
|
);
|
|
849
679
|
else {
|
|
@@ -856,65 +686,65 @@ function ce(e, t, n) {
|
|
|
856
686
|
}
|
|
857
687
|
}
|
|
858
688
|
}
|
|
859
|
-
function
|
|
860
|
-
const a = typeof t == "string" ? t : t.id, s =
|
|
689
|
+
function yo(e, t, n, o, r) {
|
|
690
|
+
const a = typeof t == "string" ? t : t.id, s = Tt(a, e.doc);
|
|
861
691
|
if (!s)
|
|
862
692
|
throw new Error(`Block with ID ${a} not found`);
|
|
863
|
-
|
|
693
|
+
K(
|
|
864
694
|
e,
|
|
865
695
|
s.posBeforeNode,
|
|
866
696
|
n,
|
|
867
697
|
o,
|
|
868
698
|
r
|
|
869
699
|
);
|
|
870
|
-
const
|
|
871
|
-
return
|
|
700
|
+
const i = e.doc.resolve(s.posBeforeNode + 1).node(), c = O(e);
|
|
701
|
+
return ve(i, c);
|
|
872
702
|
}
|
|
873
|
-
function
|
|
703
|
+
function Pt(e) {
|
|
874
704
|
const t = "selection" in e ? e.selection : null;
|
|
875
|
-
if (!(t instanceof
|
|
705
|
+
if (!(t instanceof ke))
|
|
876
706
|
return null;
|
|
877
707
|
const n = e.doc.resolve(t.head);
|
|
878
708
|
let o = -1, r = -1;
|
|
879
|
-
for (let
|
|
880
|
-
const
|
|
881
|
-
if (o < 0 && (
|
|
882
|
-
r =
|
|
709
|
+
for (let w = n.depth; w >= 0; w--) {
|
|
710
|
+
const x = n.node(w).type.name;
|
|
711
|
+
if (o < 0 && (x === "tableCell" || x === "tableHeader") && (o = w), x === "table") {
|
|
712
|
+
r = w;
|
|
883
713
|
break;
|
|
884
714
|
}
|
|
885
715
|
}
|
|
886
716
|
if (o < 0 || r < 0)
|
|
887
717
|
return null;
|
|
888
|
-
const a = n.before(o), s = n.before(r),
|
|
889
|
-
if (!
|
|
718
|
+
const a = n.before(o), s = n.before(r), i = e.doc.nodeAt(s);
|
|
719
|
+
if (!i || i.type.name !== "table")
|
|
890
720
|
return null;
|
|
891
|
-
const
|
|
721
|
+
const c = be.get(i), l = a - (s + 1), u = c.map.indexOf(l);
|
|
892
722
|
if (u < 0)
|
|
893
723
|
return null;
|
|
894
|
-
const d = Math.floor(u /
|
|
895
|
-
return { row: d, col: p, offset:
|
|
724
|
+
const d = Math.floor(u / c.width), p = u % c.width, f = a + 1 + 1, E = Math.max(0, t.head - f);
|
|
725
|
+
return { row: d, col: p, offset: E };
|
|
896
726
|
}
|
|
897
|
-
function
|
|
898
|
-
var
|
|
727
|
+
function Nt(e, t, n) {
|
|
728
|
+
var w;
|
|
899
729
|
if (t.blockNoteType !== "table")
|
|
900
730
|
return !1;
|
|
901
731
|
let o = -1;
|
|
902
732
|
if (t.isBlockContainer)
|
|
903
733
|
o = e.mapping.map(t.blockContent.beforePos);
|
|
904
734
|
else {
|
|
905
|
-
const
|
|
906
|
-
e.doc.nodesBetween(
|
|
735
|
+
const x = e.mapping.map(t.bnBlock.beforePos), P = x + (((w = e.doc.nodeAt(x)) == null ? void 0 : w.nodeSize) || 0);
|
|
736
|
+
e.doc.nodesBetween(x, P, (m, S) => m.type.name === "table" ? (o = S, !1) : !0);
|
|
907
737
|
}
|
|
908
738
|
const r = o >= 0 ? e.doc.nodeAt(o) : null;
|
|
909
739
|
if (!r || r.type.name !== "table")
|
|
910
740
|
return !1;
|
|
911
|
-
const a =
|
|
912
|
-
if (
|
|
741
|
+
const a = be.get(r), s = Math.max(0, Math.min(n.row, a.height - 1)), i = Math.max(0, Math.min(n.col, a.width - 1)), c = s * a.width + i, l = a.map[c];
|
|
742
|
+
if (l == null)
|
|
913
743
|
return !1;
|
|
914
|
-
const d = o + 1 +
|
|
915
|
-
return "selection" in e && e.setSelection(
|
|
744
|
+
const d = o + 1 + l + 1, p = e.doc.nodeAt(d), h = d + 1, f = p ? p.content.size : 0, E = h + Math.max(0, Math.min(n.offset, f));
|
|
745
|
+
return "selection" in e && e.setSelection(ke.create(e.doc, E)), !0;
|
|
916
746
|
}
|
|
917
|
-
const
|
|
747
|
+
const T = {
|
|
918
748
|
gray: {
|
|
919
749
|
text: "#9b9a97",
|
|
920
750
|
background: "#ebeced"
|
|
@@ -951,7 +781,7 @@ const B = {
|
|
|
951
781
|
text: "#ad1a72",
|
|
952
782
|
background: "#f4dfeb"
|
|
953
783
|
}
|
|
954
|
-
},
|
|
784
|
+
}, vo = {
|
|
955
785
|
gray: {
|
|
956
786
|
text: "#bebdb8",
|
|
957
787
|
background: "#9b9a97"
|
|
@@ -988,7 +818,7 @@ const B = {
|
|
|
988
818
|
text: "#da208f",
|
|
989
819
|
background: "#ad1a72"
|
|
990
820
|
}
|
|
991
|
-
},
|
|
821
|
+
}, g = {
|
|
992
822
|
backgroundColor: {
|
|
993
823
|
default: "default"
|
|
994
824
|
},
|
|
@@ -1001,30 +831,30 @@ const B = {
|
|
|
1001
831
|
}
|
|
1002
832
|
}, y = (e) => {
|
|
1003
833
|
const t = {};
|
|
1004
|
-
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment =
|
|
834
|
+
return e.hasAttribute("data-background-color") ? t.backgroundColor = e.getAttribute("data-background-color") : e.style.backgroundColor && (t.backgroundColor = e.style.backgroundColor), e.hasAttribute("data-text-color") ? t.textColor = e.getAttribute("data-text-color") : e.style.color && (t.textColor = e.style.color), t.textAlignment = g.textAlignment.values.includes(
|
|
1005
835
|
e.style.textAlign
|
|
1006
836
|
) ? e.style.textAlign : void 0, t;
|
|
1007
|
-
},
|
|
1008
|
-
e.backgroundColor && e.backgroundColor !==
|
|
1009
|
-
},
|
|
1010
|
-
default:
|
|
1011
|
-
parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : t.style.backgroundColor ? t.style.backgroundColor :
|
|
1012
|
-
renderHTML: (t) => t[e] ===
|
|
837
|
+
}, A = (e, t) => {
|
|
838
|
+
e.backgroundColor && e.backgroundColor !== g.backgroundColor.default && (t.style.backgroundColor = e.backgroundColor in T ? T[e.backgroundColor].background : e.backgroundColor), e.textColor && e.textColor !== g.textColor.default && (t.style.color = e.textColor in T ? T[e.textColor].text : e.textColor), e.textAlignment && e.textAlignment !== g.textAlignment.default && (t.style.textAlign = e.textAlignment);
|
|
839
|
+
}, Eo = (e = "backgroundColor") => ({
|
|
840
|
+
default: g.backgroundColor.default,
|
|
841
|
+
parseHTML: (t) => t.hasAttribute("data-background-color") ? t.getAttribute("data-background-color") : t.style.backgroundColor ? t.style.backgroundColor : g.backgroundColor.default,
|
|
842
|
+
renderHTML: (t) => t[e] === g.backgroundColor.default ? {} : {
|
|
1013
843
|
"data-background-color": t[e]
|
|
1014
844
|
}
|
|
1015
|
-
}),
|
|
1016
|
-
default:
|
|
1017
|
-
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color :
|
|
1018
|
-
renderHTML: (t) => t[e] ===
|
|
845
|
+
}), xo = (e = "textColor") => ({
|
|
846
|
+
default: g.textColor.default,
|
|
847
|
+
parseHTML: (t) => t.hasAttribute("data-text-color") ? t.getAttribute("data-text-color") : t.style.color ? t.style.color : g.textColor.default,
|
|
848
|
+
renderHTML: (t) => t[e] === g.textColor.default ? {} : {
|
|
1019
849
|
"data-text-color": t[e]
|
|
1020
850
|
}
|
|
1021
|
-
}),
|
|
1022
|
-
default:
|
|
1023
|
-
parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign :
|
|
1024
|
-
renderHTML: (t) => t[e] ===
|
|
851
|
+
}), wo = (e = "textAlignment") => ({
|
|
852
|
+
default: g.textAlignment.default,
|
|
853
|
+
parseHTML: (t) => t.hasAttribute("data-text-alignment") ? t.getAttribute("data-text-alignment") : t.style.textAlign ? t.style.textAlign : g.textAlignment.default,
|
|
854
|
+
renderHTML: (t) => t[e] === g.textAlignment.default ? {} : {
|
|
1025
855
|
"data-text-alignment": t[e]
|
|
1026
856
|
}
|
|
1027
|
-
}),
|
|
857
|
+
}), $ = (e, t) => {
|
|
1028
858
|
const n = e.querySelector(
|
|
1029
859
|
t
|
|
1030
860
|
);
|
|
@@ -1032,27 +862,51 @@ const B = {
|
|
|
1032
862
|
return;
|
|
1033
863
|
const o = e.querySelector("figcaption"), r = (o == null ? void 0 : o.textContent) ?? void 0;
|
|
1034
864
|
return { targetElement: n, caption: r };
|
|
1035
|
-
},
|
|
865
|
+
}, I = k(({ editor: e }) => {
|
|
866
|
+
const t = ye(void 0);
|
|
867
|
+
function n() {
|
|
868
|
+
t.setState(void 0);
|
|
869
|
+
}
|
|
870
|
+
return {
|
|
871
|
+
key: "filePanel",
|
|
872
|
+
store: t,
|
|
873
|
+
mount({ signal: o }) {
|
|
874
|
+
const r = e.onChange(
|
|
875
|
+
n,
|
|
876
|
+
// Don't trigger if the changes are caused by a remote user.
|
|
877
|
+
!1
|
|
878
|
+
), a = e.onSelectionChange(
|
|
879
|
+
n,
|
|
880
|
+
// Don't trigger if the changes are caused by a remote user.
|
|
881
|
+
!1
|
|
882
|
+
);
|
|
883
|
+
o.addEventListener("abort", () => {
|
|
884
|
+
r(), a();
|
|
885
|
+
});
|
|
886
|
+
},
|
|
887
|
+
closeMenu: n,
|
|
888
|
+
showMenu(o) {
|
|
889
|
+
t.setState(o);
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
}), Ht = (e, t, n) => {
|
|
1036
893
|
const o = document.createElement("div");
|
|
1037
894
|
o.className = "bn-add-file-button";
|
|
1038
895
|
const r = document.createElement("div");
|
|
1039
896
|
r.className = "bn-add-file-button-icon", n ? r.appendChild(n) : r.innerHTML = '<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>', o.appendChild(r);
|
|
1040
897
|
const a = document.createElement("p");
|
|
1041
898
|
a.className = "bn-add-file-button-text", a.innerHTML = e.type in t.dictionary.file_blocks.add_button_text ? t.dictionary.file_blocks.add_button_text[e.type] : t.dictionary.file_blocks.add_button_text.file, o.appendChild(a);
|
|
1042
|
-
const s = (
|
|
1043
|
-
|
|
1044
|
-
},
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
block: e
|
|
1048
|
-
})
|
|
1049
|
-
);
|
|
899
|
+
const s = (c) => {
|
|
900
|
+
c.preventDefault(), c.stopPropagation();
|
|
901
|
+
}, i = () => {
|
|
902
|
+
var c;
|
|
903
|
+
t.isEditable && ((c = t.getExtension(I)) == null || c.showMenu(e.id));
|
|
1050
904
|
};
|
|
1051
905
|
return o.addEventListener(
|
|
1052
906
|
"mousedown",
|
|
1053
907
|
s,
|
|
1054
908
|
!0
|
|
1055
|
-
), o.addEventListener("click",
|
|
909
|
+
), o.addEventListener("click", i, !0), {
|
|
1056
910
|
dom: o,
|
|
1057
911
|
destroy: () => {
|
|
1058
912
|
o.removeEventListener(
|
|
@@ -1061,45 +915,45 @@ const B = {
|
|
|
1061
915
|
!0
|
|
1062
916
|
), o.removeEventListener(
|
|
1063
917
|
"click",
|
|
1064
|
-
|
|
918
|
+
i,
|
|
1065
919
|
!0
|
|
1066
920
|
);
|
|
1067
921
|
}
|
|
1068
922
|
};
|
|
1069
|
-
},
|
|
923
|
+
}, It = '<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>', Dt = (e) => {
|
|
1070
924
|
const t = document.createElement("div");
|
|
1071
925
|
t.className = "bn-file-name-with-icon";
|
|
1072
926
|
const n = document.createElement("div");
|
|
1073
|
-
n.className = "bn-file-icon", n.innerHTML =
|
|
927
|
+
n.className = "bn-file-icon", n.innerHTML = It, t.appendChild(n);
|
|
1074
928
|
const o = document.createElement("p");
|
|
1075
929
|
return o.className = "bn-file-name", o.textContent = e.props.name, t.appendChild(o), {
|
|
1076
930
|
dom: t
|
|
1077
931
|
};
|
|
1078
|
-
},
|
|
932
|
+
}, Q = (e, t, n, o) => {
|
|
1079
933
|
const r = document.createElement("div");
|
|
1080
934
|
if (r.className = "bn-file-block-content-wrapper", e.props.url === "") {
|
|
1081
|
-
const s =
|
|
935
|
+
const s = Ht(e, t, o);
|
|
1082
936
|
r.appendChild(s.dom);
|
|
1083
|
-
const
|
|
1084
|
-
if (
|
|
937
|
+
const i = t.onUploadStart((c) => {
|
|
938
|
+
if (c === e.id) {
|
|
1085
939
|
r.removeChild(s.dom);
|
|
1086
|
-
const
|
|
1087
|
-
|
|
940
|
+
const l = document.createElement("div");
|
|
941
|
+
l.className = "bn-file-loading-preview", l.textContent = "Loading...", r.appendChild(l);
|
|
1088
942
|
}
|
|
1089
943
|
});
|
|
1090
944
|
return {
|
|
1091
945
|
dom: r,
|
|
1092
946
|
destroy: () => {
|
|
1093
|
-
|
|
947
|
+
i(), s.destroy();
|
|
1094
948
|
}
|
|
1095
949
|
};
|
|
1096
950
|
}
|
|
1097
951
|
const a = { dom: r };
|
|
1098
952
|
if (e.props.showPreview === !1 || !n) {
|
|
1099
|
-
const s =
|
|
953
|
+
const s = Dt(e);
|
|
1100
954
|
r.appendChild(s.dom), a.destroy = () => {
|
|
1101
|
-
var
|
|
1102
|
-
(
|
|
955
|
+
var i;
|
|
956
|
+
(i = s.destroy) == null || i.call(s);
|
|
1103
957
|
};
|
|
1104
958
|
} else
|
|
1105
959
|
r.appendChild(n.dom);
|
|
@@ -1108,18 +962,18 @@ const B = {
|
|
|
1108
962
|
s.className = "bn-file-caption", s.textContent = e.props.caption, r.appendChild(s);
|
|
1109
963
|
}
|
|
1110
964
|
return a;
|
|
1111
|
-
},
|
|
965
|
+
}, J = (e, t) => {
|
|
1112
966
|
const n = document.createElement("figure"), o = document.createElement("figcaption");
|
|
1113
967
|
return o.textContent = t, n.appendChild(e), n.appendChild(o), { dom: n };
|
|
1114
|
-
},
|
|
968
|
+
}, U = (e, t) => {
|
|
1115
969
|
const n = document.createElement("div"), o = document.createElement("p");
|
|
1116
970
|
return o.textContent = t, n.appendChild(e), n.appendChild(o), {
|
|
1117
971
|
dom: n
|
|
1118
972
|
};
|
|
1119
|
-
},
|
|
973
|
+
}, ue = (e) => ({ url: e.src || void 0 }), Ot = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>', _t = (e) => ({
|
|
1120
974
|
type: "audio",
|
|
1121
975
|
propSchema: {
|
|
1122
|
-
backgroundColor:
|
|
976
|
+
backgroundColor: g.backgroundColor,
|
|
1123
977
|
// File name.
|
|
1124
978
|
name: {
|
|
1125
979
|
default: ""
|
|
@@ -1137,40 +991,40 @@ const B = {
|
|
|
1137
991
|
}
|
|
1138
992
|
},
|
|
1139
993
|
content: "none"
|
|
1140
|
-
}),
|
|
994
|
+
}), Vt = (e = {}) => (t) => {
|
|
1141
995
|
if (t.tagName === "AUDIO") {
|
|
1142
996
|
if (t.closest("figure"))
|
|
1143
997
|
return;
|
|
1144
998
|
const { backgroundColor: n } = y(t);
|
|
1145
999
|
return {
|
|
1146
|
-
...
|
|
1000
|
+
...ue(t),
|
|
1147
1001
|
backgroundColor: n
|
|
1148
1002
|
};
|
|
1149
1003
|
}
|
|
1150
1004
|
if (t.tagName === "FIGURE") {
|
|
1151
|
-
const n =
|
|
1005
|
+
const n = $(t, "audio");
|
|
1152
1006
|
if (!n)
|
|
1153
1007
|
return;
|
|
1154
1008
|
const { targetElement: o, caption: r } = n, { backgroundColor: a } = y(t);
|
|
1155
1009
|
return {
|
|
1156
|
-
...
|
|
1010
|
+
...ue(o),
|
|
1157
1011
|
backgroundColor: a,
|
|
1158
1012
|
caption: r
|
|
1159
1013
|
};
|
|
1160
1014
|
}
|
|
1161
|
-
},
|
|
1015
|
+
}, Rt = (e = {}) => (t, n) => {
|
|
1162
1016
|
const o = document.createElement("div");
|
|
1163
|
-
o.innerHTML = e.icon ??
|
|
1017
|
+
o.innerHTML = e.icon ?? Ot;
|
|
1164
1018
|
const r = document.createElement("audio");
|
|
1165
1019
|
return r.className = "bn-audio", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((a) => {
|
|
1166
1020
|
r.src = a;
|
|
1167
|
-
}) : r.src = t.props.url, r.controls = !0, r.contentEditable = "false", r.draggable = !1,
|
|
1021
|
+
}) : r.src = t.props.url, r.controls = !0, r.contentEditable = "false", r.draggable = !1, Q(
|
|
1168
1022
|
t,
|
|
1169
1023
|
n,
|
|
1170
1024
|
{ dom: r },
|
|
1171
1025
|
o.firstElementChild
|
|
1172
1026
|
);
|
|
1173
|
-
},
|
|
1027
|
+
}, Wt = (e = {}) => (t, n) => {
|
|
1174
1028
|
if (!t.props.url) {
|
|
1175
1029
|
const r = document.createElement("p");
|
|
1176
1030
|
return r.textContent = "Add audio", {
|
|
@@ -1178,114 +1032,46 @@ const B = {
|
|
|
1178
1032
|
};
|
|
1179
1033
|
}
|
|
1180
1034
|
let o;
|
|
1181
|
-
return t.props.showPreview ? (o = document.createElement("audio"), o.src = t.props.url) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ?
|
|
1035
|
+
return t.props.showPreview ? (o = document.createElement("audio"), o.src = t.props.url) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? J(o, t.props.caption) : U(o, t.props.caption) : {
|
|
1182
1036
|
dom: o
|
|
1183
1037
|
};
|
|
1184
|
-
},
|
|
1185
|
-
|
|
1038
|
+
}, Ft = v(
|
|
1039
|
+
_t,
|
|
1186
1040
|
(e) => ({
|
|
1187
1041
|
meta: {
|
|
1188
1042
|
fileBlockAccept: ["audio/*"]
|
|
1189
1043
|
},
|
|
1190
|
-
parse:
|
|
1191
|
-
render:
|
|
1192
|
-
toExternalHTML:
|
|
1044
|
+
parse: Vt(e),
|
|
1045
|
+
render: Rt(e),
|
|
1046
|
+
toExternalHTML: Wt(e),
|
|
1193
1047
|
runsBefore: ["file"]
|
|
1194
1048
|
})
|
|
1195
|
-
)
|
|
1196
|
-
class Rt {
|
|
1197
|
-
constructor() {
|
|
1198
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
1199
|
-
C(this, "callbacks", {});
|
|
1200
|
-
}
|
|
1201
|
-
on(t, n) {
|
|
1202
|
-
return this.callbacks[t] || (this.callbacks[t] = []), this.callbacks[t].push(n), () => this.off(t, n);
|
|
1203
|
-
}
|
|
1204
|
-
emit(t, ...n) {
|
|
1205
|
-
const o = this.callbacks[t];
|
|
1206
|
-
o && o.forEach((r) => r.apply(this, n));
|
|
1207
|
-
}
|
|
1208
|
-
off(t, n) {
|
|
1209
|
-
const o = this.callbacks[t];
|
|
1210
|
-
o && (n ? this.callbacks[t] = o.filter((r) => r !== n) : delete this.callbacks[t]);
|
|
1211
|
-
}
|
|
1212
|
-
removeAllListeners() {
|
|
1213
|
-
this.callbacks = {};
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
class Wt extends Rt {
|
|
1217
|
-
// eslint-disable-next-line
|
|
1218
|
-
constructor(...n) {
|
|
1219
|
-
super();
|
|
1220
|
-
C(this, "plugins", []);
|
|
1221
|
-
/**
|
|
1222
|
-
* Input rules for the block
|
|
1223
|
-
*/
|
|
1224
|
-
C(this, "inputRules");
|
|
1225
|
-
/**
|
|
1226
|
-
* A mapping of a keyboard shortcut to a function that will be called when the shortcut is pressed
|
|
1227
|
-
*
|
|
1228
|
-
* The keys are in the format:
|
|
1229
|
-
* - Key names may be strings like `Shift-Ctrl-Enter`—a key identifier prefixed with zero or more modifiers
|
|
1230
|
-
* - Key identifiers are based on the strings that can appear in KeyEvent.key
|
|
1231
|
-
* - Use lowercase letters to refer to letter keys (or uppercase letters if you want shift to be held)
|
|
1232
|
-
* - You may use `Space` as an alias for the " " name
|
|
1233
|
-
* - Modifiers can be given in any order: `Shift-` (or `s-`), `Alt-` (or `a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or `Meta-`)
|
|
1234
|
-
* - For characters that are created by holding shift, the Shift- prefix is implied, and should not be added explicitly
|
|
1235
|
-
* - You can use Mod- as a shorthand for Cmd- on Mac and Ctrl- on other platforms
|
|
1236
|
-
*
|
|
1237
|
-
* @example
|
|
1238
|
-
* ```typescript
|
|
1239
|
-
* keyboardShortcuts: {
|
|
1240
|
-
* "Mod-Enter": (ctx) => { return true; },
|
|
1241
|
-
* "Shift-Ctrl-Space": (ctx) => { return true; },
|
|
1242
|
-
* "a": (ctx) => { return true; },
|
|
1243
|
-
* "Space": (ctx) => { return true; }
|
|
1244
|
-
* }
|
|
1245
|
-
* ```
|
|
1246
|
-
*/
|
|
1247
|
-
C(this, "keyboardShortcuts");
|
|
1248
|
-
C(this, "tiptapExtensions");
|
|
1249
|
-
}
|
|
1250
|
-
static key() {
|
|
1251
|
-
throw new Error("You must implement the key method in your extension");
|
|
1252
|
-
}
|
|
1253
|
-
addProsemirrorPlugin(n) {
|
|
1254
|
-
this.plugins.push(n);
|
|
1255
|
-
}
|
|
1256
|
-
get priority() {
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
function w(e) {
|
|
1260
|
-
const t = Object.create(Wt.prototype);
|
|
1261
|
-
return t.key = e.key, t.inputRules = e.inputRules, t.keyboardShortcuts = e.keyboardShortcuts, t.plugins = e.plugins ?? [], t.tiptapExtensions = e.tiptapExtensions, t;
|
|
1262
|
-
}
|
|
1263
|
-
const le = Symbol.for("blocknote.shikiParser"), U = Symbol.for(
|
|
1049
|
+
), pe = Symbol.for("blocknote.shikiParser"), j = Symbol.for(
|
|
1264
1050
|
"blocknote.shikiHighlighterPromise"
|
|
1265
1051
|
);
|
|
1266
|
-
function
|
|
1052
|
+
function $t(e) {
|
|
1267
1053
|
const t = globalThis;
|
|
1268
1054
|
let n, o, r = !1;
|
|
1269
|
-
return
|
|
1055
|
+
return dt({
|
|
1270
1056
|
parser: (s) => {
|
|
1271
1057
|
if (!e.createHighlighter)
|
|
1272
1058
|
return process.env.NODE_ENV === "development" && !r && (console.log(
|
|
1273
1059
|
"For syntax highlighting of code blocks, you must provide a `createCodeBlockSpec({ createHighlighter: () => ... })` function"
|
|
1274
1060
|
), r = !0), [];
|
|
1275
1061
|
if (!n)
|
|
1276
|
-
return t[
|
|
1277
|
-
(
|
|
1278
|
-
n =
|
|
1062
|
+
return t[j] = t[j] || e.createHighlighter(), t[j].then(
|
|
1063
|
+
(c) => {
|
|
1064
|
+
n = c;
|
|
1279
1065
|
}
|
|
1280
1066
|
);
|
|
1281
|
-
const
|
|
1282
|
-
return !
|
|
1067
|
+
const i = Te(e, s.language);
|
|
1068
|
+
return !i || i === "text" || i === "none" || i === "plaintext" || i === "txt" ? [] : n.getLoadedLanguages().includes(i) ? (o || (o = t[pe] || ut(n), t[pe] = o), o(s)) : n.loadLanguage(i);
|
|
1283
1069
|
},
|
|
1284
1070
|
languageExtractor: (s) => s.attrs.language,
|
|
1285
1071
|
nodeTypes: ["codeBlock"]
|
|
1286
1072
|
});
|
|
1287
1073
|
}
|
|
1288
|
-
const
|
|
1074
|
+
const Ut = ({ defaultLanguage: e = "text" }) => ({
|
|
1289
1075
|
type: "codeBlock",
|
|
1290
1076
|
propSchema: {
|
|
1291
1077
|
language: {
|
|
@@ -1293,8 +1079,8 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
|
|
|
1293
1079
|
}
|
|
1294
1080
|
},
|
|
1295
1081
|
content: "inline"
|
|
1296
|
-
}),
|
|
1297
|
-
|
|
1082
|
+
}), qt = v(
|
|
1083
|
+
Ut,
|
|
1298
1084
|
(e) => ({
|
|
1299
1085
|
meta: {
|
|
1300
1086
|
code: !0,
|
|
@@ -1309,7 +1095,7 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
|
|
|
1309
1095
|
return { language: n.getAttribute("data-language") || ((a = n.className.split(" ").find((s) => s.includes("language-"))) == null ? void 0 : a.replace("language-", "")) };
|
|
1310
1096
|
},
|
|
1311
1097
|
parseContent: ({ el: t, schema: n }) => {
|
|
1312
|
-
const o =
|
|
1098
|
+
const o = xe.fromSchema(n), r = t.firstElementChild;
|
|
1313
1099
|
return o.parse(r, {
|
|
1314
1100
|
preserveWhitespace: "full",
|
|
1315
1101
|
topNode: n.nodes.codeBlock.create()
|
|
@@ -1320,20 +1106,20 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
|
|
|
1320
1106
|
r.appendChild(a);
|
|
1321
1107
|
let s;
|
|
1322
1108
|
if (e.supportedLanguages) {
|
|
1323
|
-
const
|
|
1109
|
+
const i = document.createElement("select");
|
|
1324
1110
|
Object.entries(e.supportedLanguages ?? {}).forEach(
|
|
1325
1111
|
([u, { name: d }]) => {
|
|
1326
1112
|
const p = document.createElement("option");
|
|
1327
|
-
p.value = u, p.text = d,
|
|
1113
|
+
p.value = u, p.text = d, i.appendChild(p);
|
|
1328
1114
|
}
|
|
1329
|
-
),
|
|
1330
|
-
const
|
|
1115
|
+
), i.value = t.props.language || e.defaultLanguage || "text";
|
|
1116
|
+
const c = (u) => {
|
|
1331
1117
|
const d = u.target.value;
|
|
1332
1118
|
n.updateBlock(t.id, { props: { language: d } });
|
|
1333
1119
|
};
|
|
1334
|
-
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1120
|
+
i.addEventListener("change", c), s = () => i.removeEventListener("change", c);
|
|
1121
|
+
const l = document.createElement("div");
|
|
1122
|
+
l.contentEditable = "false", l.appendChild(i), o.appendChild(l);
|
|
1337
1123
|
}
|
|
1338
1124
|
return o.appendChild(r), {
|
|
1339
1125
|
dom: o,
|
|
@@ -1352,11 +1138,11 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
|
|
|
1352
1138
|
}
|
|
1353
1139
|
}),
|
|
1354
1140
|
(e) => [
|
|
1355
|
-
|
|
1141
|
+
k({
|
|
1356
1142
|
key: "code-block-highlighter",
|
|
1357
|
-
|
|
1143
|
+
prosemirrorPlugins: [$t(e)]
|
|
1358
1144
|
}),
|
|
1359
|
-
|
|
1145
|
+
k({
|
|
1360
1146
|
key: "code-block-keyboard-shortcuts",
|
|
1361
1147
|
keyboardShortcuts: {
|
|
1362
1148
|
Delete: ({ editor: t }) => t.transact((n) => {
|
|
@@ -1374,18 +1160,18 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
|
|
|
1374
1160
|
const { block: o, nextBlock: r } = t.getTextCursorPosition();
|
|
1375
1161
|
if (o.type !== "codeBlock")
|
|
1376
1162
|
return !1;
|
|
1377
|
-
const { $from: a } = n.selection, s = a.parentOffset === a.parent.nodeSize - 2,
|
|
1163
|
+
const { $from: a } = n.selection, s = a.parentOffset === a.parent.nodeSize - 2, i = a.parent.textContent.endsWith(`
|
|
1378
1164
|
|
|
1379
1165
|
`);
|
|
1380
|
-
if (s &&
|
|
1166
|
+
if (s && i) {
|
|
1381
1167
|
if (n.delete(a.pos - 2, a.pos), r)
|
|
1382
1168
|
return t.setTextCursorPosition(r, "start"), !0;
|
|
1383
|
-
const [
|
|
1169
|
+
const [c] = t.insertBlocks(
|
|
1384
1170
|
[{ type: "paragraph" }],
|
|
1385
1171
|
o,
|
|
1386
1172
|
"after"
|
|
1387
1173
|
);
|
|
1388
|
-
return t.setTextCursorPosition(
|
|
1174
|
+
return t.setTextCursorPosition(c, "start"), !0;
|
|
1389
1175
|
}
|
|
1390
1176
|
return n.insertText(`
|
|
1391
1177
|
`), !0;
|
|
@@ -1412,7 +1198,7 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
|
|
|
1412
1198
|
type: "codeBlock",
|
|
1413
1199
|
props: {
|
|
1414
1200
|
language: {
|
|
1415
|
-
language:
|
|
1201
|
+
language: Te(e, n) ?? n
|
|
1416
1202
|
}.language
|
|
1417
1203
|
},
|
|
1418
1204
|
content: []
|
|
@@ -1423,18 +1209,18 @@ const jt = ({ defaultLanguage: e = "text" }) => ({
|
|
|
1423
1209
|
})
|
|
1424
1210
|
]
|
|
1425
1211
|
);
|
|
1426
|
-
function
|
|
1212
|
+
function Te(e, t) {
|
|
1427
1213
|
var n;
|
|
1428
1214
|
return (n = Object.entries(e.supportedLanguages ?? {}).find(
|
|
1429
1215
|
([o, { aliases: r }]) => (r == null ? void 0 : r.includes(t)) || o === t
|
|
1430
1216
|
)) == null ? void 0 : n[0];
|
|
1431
1217
|
}
|
|
1432
|
-
const
|
|
1218
|
+
const jt = () => ({
|
|
1433
1219
|
type: "divider",
|
|
1434
1220
|
propSchema: {},
|
|
1435
1221
|
content: "none"
|
|
1436
1222
|
}), Gt = v(
|
|
1437
|
-
|
|
1223
|
+
jt,
|
|
1438
1224
|
{
|
|
1439
1225
|
meta: {
|
|
1440
1226
|
isolating: !1
|
|
@@ -1450,7 +1236,7 @@ const $t = () => ({
|
|
|
1450
1236
|
}
|
|
1451
1237
|
},
|
|
1452
1238
|
[
|
|
1453
|
-
|
|
1239
|
+
k({
|
|
1454
1240
|
key: "divider-block-shortcuts",
|
|
1455
1241
|
inputRules: [
|
|
1456
1242
|
{
|
|
@@ -1462,10 +1248,10 @@ const $t = () => ({
|
|
|
1462
1248
|
]
|
|
1463
1249
|
})
|
|
1464
1250
|
]
|
|
1465
|
-
),
|
|
1251
|
+
), fe = (e) => ({ url: e.src || void 0 }), Zt = () => ({
|
|
1466
1252
|
type: "file",
|
|
1467
1253
|
propSchema: {
|
|
1468
|
-
backgroundColor:
|
|
1254
|
+
backgroundColor: g.backgroundColor,
|
|
1469
1255
|
// File name.
|
|
1470
1256
|
name: {
|
|
1471
1257
|
default: ""
|
|
@@ -1486,28 +1272,28 @@ const $t = () => ({
|
|
|
1486
1272
|
return;
|
|
1487
1273
|
const { backgroundColor: t } = y(e);
|
|
1488
1274
|
return {
|
|
1489
|
-
...
|
|
1275
|
+
...fe(e),
|
|
1490
1276
|
backgroundColor: t
|
|
1491
1277
|
};
|
|
1492
1278
|
}
|
|
1493
1279
|
if (e.tagName === "FIGURE") {
|
|
1494
|
-
const t =
|
|
1280
|
+
const t = $(e, "embed");
|
|
1495
1281
|
if (!t)
|
|
1496
1282
|
return;
|
|
1497
1283
|
const { targetElement: n, caption: o } = t, { backgroundColor: r } = y(e);
|
|
1498
1284
|
return {
|
|
1499
|
-
...
|
|
1285
|
+
...fe(n),
|
|
1500
1286
|
backgroundColor: r,
|
|
1501
1287
|
caption: o
|
|
1502
1288
|
};
|
|
1503
1289
|
}
|
|
1504
|
-
},
|
|
1290
|
+
}, Xt = v(Zt, {
|
|
1505
1291
|
meta: {
|
|
1506
1292
|
fileBlockAccept: ["*/*"]
|
|
1507
1293
|
},
|
|
1508
1294
|
parse: zt(),
|
|
1509
1295
|
render(e, t) {
|
|
1510
|
-
return
|
|
1296
|
+
return Q(e, t);
|
|
1511
1297
|
},
|
|
1512
1298
|
toExternalHTML(e) {
|
|
1513
1299
|
if (!e.props.url) {
|
|
@@ -1517,17 +1303,17 @@ const $t = () => ({
|
|
|
1517
1303
|
};
|
|
1518
1304
|
}
|
|
1519
1305
|
const t = document.createElement("a");
|
|
1520
|
-
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ?
|
|
1306
|
+
return t.href = e.props.url, t.textContent = e.props.name || e.props.url, e.props.caption ? U(t, e.props.caption) : {
|
|
1521
1307
|
dom: t
|
|
1522
1308
|
};
|
|
1523
1309
|
}
|
|
1524
|
-
}),
|
|
1310
|
+
}), Kt = {
|
|
1525
1311
|
set: (e, t) => window.localStorage.setItem(
|
|
1526
1312
|
`toggle-${e.id}`,
|
|
1527
1313
|
t ? "true" : "false"
|
|
1528
1314
|
),
|
|
1529
1315
|
get: (e) => window.localStorage.getItem(`toggle-${e.id}`) === "true"
|
|
1530
|
-
},
|
|
1316
|
+
}, Be = (e, t, n, o = Kt) => {
|
|
1531
1317
|
if ("isToggleable" in e.props && !e.props.isToggleable)
|
|
1532
1318
|
return {
|
|
1533
1319
|
dom: n
|
|
@@ -1537,17 +1323,17 @@ const $t = () => ({
|
|
|
1537
1323
|
const s = document.createElement("button");
|
|
1538
1324
|
s.className = "bn-toggle-button", s.type = "button", s.innerHTML = // https://fonts.google.com/icons?selected=Material+Symbols+Rounded:chevron_right:FILL@0;wght@700;GRAD@0;opsz@24&icon.query=chevron&icon.style=Rounded&icon.size=24&icon.color=%23e8eaed
|
|
1539
1325
|
'<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="CURRENTCOLOR"><path d="M320-200v-560l440 280-440 280Z"/></svg>';
|
|
1540
|
-
const
|
|
1541
|
-
s.addEventListener("mousedown",
|
|
1542
|
-
const
|
|
1326
|
+
const i = (f) => f.preventDefault();
|
|
1327
|
+
s.addEventListener("mousedown", i);
|
|
1328
|
+
const c = () => {
|
|
1543
1329
|
var f;
|
|
1544
|
-
a.getAttribute("data-show-children") === "true" ? (a.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1), r.contains(
|
|
1330
|
+
a.getAttribute("data-show-children") === "true" ? (a.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1), r.contains(l) && r.removeChild(l)) : (a.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0), t.isEditable && ((f = t.getBlock(e)) == null ? void 0 : f.children.length) === 0 && !r.contains(l) && r.appendChild(l));
|
|
1545
1331
|
};
|
|
1546
|
-
s.addEventListener("click",
|
|
1547
|
-
const
|
|
1548
|
-
|
|
1332
|
+
s.addEventListener("click", c), a.appendChild(s), a.appendChild(n);
|
|
1333
|
+
const l = document.createElement("button");
|
|
1334
|
+
l.className = "bn-toggle-add-block-button", l.type = "button", l.textContent = t.dictionary.toggle_blocks.add_block_button;
|
|
1549
1335
|
const u = (f) => f.preventDefault();
|
|
1550
|
-
|
|
1336
|
+
l.addEventListener(
|
|
1551
1337
|
"mousedown",
|
|
1552
1338
|
u
|
|
1553
1339
|
);
|
|
@@ -1560,44 +1346,50 @@ const $t = () => ({
|
|
|
1560
1346
|
t.setTextCursorPosition(f.children[0].id, "end"), t.focus();
|
|
1561
1347
|
});
|
|
1562
1348
|
};
|
|
1563
|
-
|
|
1349
|
+
l.addEventListener("click", d), r.appendChild(a);
|
|
1564
1350
|
let p = e.children.length;
|
|
1565
1351
|
const h = t.onChange(() => {
|
|
1566
|
-
var
|
|
1567
|
-
const f = ((
|
|
1568
|
-
f > p ? (a.getAttribute("data-show-children") === "false" && (a.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0)), r.contains(
|
|
1352
|
+
var E;
|
|
1353
|
+
const f = ((E = t.getBlock(e)) == null ? void 0 : E.children.length) ?? 0;
|
|
1354
|
+
f > p ? (a.getAttribute("data-show-children") === "false" && (a.setAttribute("data-show-children", "true"), o.set(t.getBlock(e), !0)), r.contains(l) && r.removeChild(l)) : f === 0 && f < p && (a.getAttribute("data-show-children") === "true" && (a.setAttribute("data-show-children", "false"), o.set(t.getBlock(e), !1)), r.contains(l) && r.removeChild(l)), p = f;
|
|
1569
1355
|
});
|
|
1570
|
-
return o.get(e) ? (a.setAttribute("data-show-children", "true"), e.children.length === 0 && r.appendChild(
|
|
1356
|
+
return o.get(e) ? (a.setAttribute("data-show-children", "true"), t.isEditable && e.children.length === 0 && r.appendChild(l)) : a.setAttribute("data-show-children", "false"), {
|
|
1571
1357
|
dom: r,
|
|
1572
1358
|
// Prevents re-renders when the toggle button is clicked.
|
|
1573
1359
|
ignoreMutation: (f) => f instanceof MutationRecord && // We want to prevent re-renders when the view changes, so we ignore
|
|
1574
1360
|
// all mutations where the `data-show-children` attribute is changed
|
|
1575
1361
|
// or the "add block" button is added/removed.
|
|
1576
|
-
(f.type === "attributes" && f.target === a && f.attributeName === "data-show-children" || f.type === "childList" && (f.addedNodes[0] ===
|
|
1362
|
+
(f.type === "attributes" && f.target === a && f.attributeName === "data-show-children" || f.type === "childList" && (f.addedNodes[0] === l || f.removedNodes[0] === l)),
|
|
1577
1363
|
destroy: () => {
|
|
1578
|
-
s.removeEventListener("mousedown",
|
|
1364
|
+
s.removeEventListener("mousedown", i), s.removeEventListener("click", c), l.removeEventListener(
|
|
1579
1365
|
"mousedown",
|
|
1580
1366
|
u
|
|
1581
|
-
),
|
|
1367
|
+
), l.removeEventListener(
|
|
1582
1368
|
"click",
|
|
1583
1369
|
d
|
|
1584
1370
|
), h == null || h();
|
|
1585
1371
|
}
|
|
1586
1372
|
};
|
|
1587
|
-
},
|
|
1373
|
+
}, Ae = [1, 2, 3, 4, 5, 6], Qt = (e) => ({ editor: t }) => {
|
|
1374
|
+
const n = t.getTextCursorPosition();
|
|
1375
|
+
return t.schema.blockSchema[n.block.type].content !== "inline" ? !1 : (t.updateBlock(n.block, {
|
|
1376
|
+
type: "heading",
|
|
1377
|
+
props: { level: e }
|
|
1378
|
+
}), !0);
|
|
1379
|
+
}, Jt = ({
|
|
1588
1380
|
defaultLevel: e = 1,
|
|
1589
|
-
levels: t =
|
|
1381
|
+
levels: t = Ae,
|
|
1590
1382
|
allowToggleHeadings: n = !0
|
|
1591
1383
|
} = {}) => ({
|
|
1592
1384
|
type: "heading",
|
|
1593
1385
|
propSchema: {
|
|
1594
|
-
...
|
|
1386
|
+
...g,
|
|
1595
1387
|
level: { default: e, values: t },
|
|
1596
1388
|
...n ? { isToggleable: { default: !1, optional: !0 } } : {}
|
|
1597
1389
|
},
|
|
1598
1390
|
content: "inline"
|
|
1599
|
-
}),
|
|
1600
|
-
|
|
1391
|
+
}), Yt = v(
|
|
1392
|
+
Jt,
|
|
1601
1393
|
({ allowToggleHeadings: e = !0 } = {}) => ({
|
|
1602
1394
|
meta: {
|
|
1603
1395
|
isolating: !1
|
|
@@ -1633,34 +1425,26 @@ const $t = () => ({
|
|
|
1633
1425
|
},
|
|
1634
1426
|
render(t, n) {
|
|
1635
1427
|
const o = document.createElement(`h${t.props.level}`);
|
|
1636
|
-
return e ? { ...
|
|
1428
|
+
return e ? { ...Be(t, n, o), contentDOM: o } : {
|
|
1637
1429
|
dom: o,
|
|
1638
1430
|
contentDOM: o
|
|
1639
1431
|
};
|
|
1640
1432
|
},
|
|
1641
1433
|
toExternalHTML(t) {
|
|
1642
1434
|
const n = document.createElement(`h${t.props.level}`);
|
|
1643
|
-
return
|
|
1435
|
+
return A(t.props, n), {
|
|
1644
1436
|
dom: n,
|
|
1645
1437
|
contentDOM: n
|
|
1646
1438
|
};
|
|
1647
1439
|
}
|
|
1648
1440
|
}),
|
|
1649
|
-
({ levels: e =
|
|
1650
|
-
|
|
1441
|
+
({ levels: e = Ae } = {}) => [
|
|
1442
|
+
k({
|
|
1651
1443
|
key: "heading-shortcuts",
|
|
1652
1444
|
keyboardShortcuts: Object.fromEntries(
|
|
1653
1445
|
e.map((t) => [
|
|
1654
1446
|
`Mod-Alt-${t}`,
|
|
1655
|
-
(
|
|
1656
|
-
const o = n.getTextCursorPosition();
|
|
1657
|
-
return n.schema.blockSchema[o.block.type].content !== "inline" ? !1 : (n.updateBlock(o.block, {
|
|
1658
|
-
type: "heading",
|
|
1659
|
-
props: {
|
|
1660
|
-
level: t
|
|
1661
|
-
}
|
|
1662
|
-
}), !0);
|
|
1663
|
-
}
|
|
1447
|
+
Qt(t)
|
|
1664
1448
|
]) ?? []
|
|
1665
1449
|
),
|
|
1666
1450
|
inputRules: e.map((t) => ({
|
|
@@ -1676,98 +1460,98 @@ const $t = () => ({
|
|
|
1676
1460
|
}))
|
|
1677
1461
|
})
|
|
1678
1462
|
]
|
|
1679
|
-
),
|
|
1680
|
-
const { dom: a, destroy: s } =
|
|
1463
|
+
), Pe = (e, t, n, o, r) => {
|
|
1464
|
+
const { dom: a, destroy: s } = Q(
|
|
1681
1465
|
e,
|
|
1682
1466
|
t,
|
|
1683
1467
|
n,
|
|
1684
1468
|
r
|
|
1685
|
-
),
|
|
1686
|
-
|
|
1469
|
+
), i = a;
|
|
1470
|
+
i.style.position = "relative", e.props.url && e.props.showPreview && (e.props.previewWidth ? i.style.width = `${e.props.previewWidth}px` : i.style.width = "fit-content");
|
|
1471
|
+
const c = document.createElement("div");
|
|
1472
|
+
c.className = "bn-resize-handle", c.style.left = "4px";
|
|
1687
1473
|
const l = document.createElement("div");
|
|
1688
|
-
l.className = "bn-resize-handle", l.style.
|
|
1689
|
-
const i = document.createElement("div");
|
|
1690
|
-
i.className = "bn-resize-handle", i.style.right = "4px";
|
|
1474
|
+
l.className = "bn-resize-handle", l.style.right = "4px";
|
|
1691
1475
|
const u = document.createElement("div");
|
|
1692
1476
|
u.style.position = "absolute", u.style.height = "100%", u.style.width = "100%";
|
|
1693
1477
|
let d, p = e.props.previewWidth;
|
|
1694
|
-
const h = (
|
|
1695
|
-
var
|
|
1478
|
+
const h = (m) => {
|
|
1479
|
+
var ee, te;
|
|
1696
1480
|
if (!d) {
|
|
1697
|
-
!t.isEditable && o.contains(
|
|
1481
|
+
!t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
1698
1482
|
return;
|
|
1699
1483
|
}
|
|
1700
|
-
let
|
|
1701
|
-
const
|
|
1702
|
-
e.props.textAlignment === "center" ? d.handleUsed === "left" ?
|
|
1703
|
-
Math.max(
|
|
1704
|
-
((
|
|
1705
|
-
),
|
|
1706
|
-
}, f = (
|
|
1707
|
-
(!
|
|
1484
|
+
let S;
|
|
1485
|
+
const _ = "touches" in m ? m.touches[0].clientX : m.clientX;
|
|
1486
|
+
e.props.textAlignment === "center" ? d.handleUsed === "left" ? S = d.initialWidth + (d.initialClientX - _) * 2 : S = d.initialWidth + (_ - d.initialClientX) * 2 : d.handleUsed === "left" ? S = d.initialWidth + d.initialClientX - _ : S = d.initialWidth + _ - d.initialClientX, p = Math.min(
|
|
1487
|
+
Math.max(S, 64),
|
|
1488
|
+
((te = (ee = t.domElement) == null ? void 0 : ee.firstElementChild) == null ? void 0 : te.clientWidth) || Number.MAX_VALUE
|
|
1489
|
+
), i.style.width = `${p}px`;
|
|
1490
|
+
}, f = (m) => {
|
|
1491
|
+
(!m.target || !i.contains(m.target) || !t.isEditable) && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l)), d && (d = void 0, i.contains(u) && i.removeChild(u), t.updateBlock(e, {
|
|
1708
1492
|
props: {
|
|
1709
1493
|
previewWidth: p
|
|
1710
1494
|
}
|
|
1711
1495
|
}));
|
|
1712
|
-
},
|
|
1713
|
-
t.isEditable && (o.appendChild(
|
|
1714
|
-
},
|
|
1715
|
-
|
|
1716
|
-
},
|
|
1717
|
-
|
|
1718
|
-
const
|
|
1496
|
+
}, E = () => {
|
|
1497
|
+
t.isEditable && (o.appendChild(c), o.appendChild(l));
|
|
1498
|
+
}, w = (m) => {
|
|
1499
|
+
m.relatedTarget === c || m.relatedTarget === l || d || t.isEditable && o.contains(c) && o.contains(l) && (o.removeChild(c), o.removeChild(l));
|
|
1500
|
+
}, x = (m) => {
|
|
1501
|
+
m.preventDefault(), i.contains(u) || i.appendChild(u);
|
|
1502
|
+
const S = "touches" in m ? m.touches[0].clientX : m.clientX;
|
|
1719
1503
|
d = {
|
|
1720
1504
|
handleUsed: "left",
|
|
1721
|
-
initialWidth:
|
|
1722
|
-
initialClientX:
|
|
1505
|
+
initialWidth: i.clientWidth,
|
|
1506
|
+
initialClientX: S
|
|
1723
1507
|
};
|
|
1724
|
-
},
|
|
1725
|
-
|
|
1726
|
-
const
|
|
1508
|
+
}, P = (m) => {
|
|
1509
|
+
m.preventDefault(), i.contains(u) || i.appendChild(u);
|
|
1510
|
+
const S = "touches" in m ? m.touches[0].clientX : m.clientX;
|
|
1727
1511
|
d = {
|
|
1728
1512
|
handleUsed: "right",
|
|
1729
|
-
initialWidth:
|
|
1730
|
-
initialClientX:
|
|
1513
|
+
initialWidth: i.clientWidth,
|
|
1514
|
+
initialClientX: S
|
|
1731
1515
|
};
|
|
1732
1516
|
};
|
|
1733
|
-
return window.addEventListener("mousemove", h), window.addEventListener("touchmove", h), window.addEventListener("mouseup", f), window.addEventListener("touchend", f),
|
|
1517
|
+
return window.addEventListener("mousemove", h), window.addEventListener("touchmove", h), window.addEventListener("mouseup", f), window.addEventListener("touchend", f), i.addEventListener("mouseenter", E), i.addEventListener("mouseleave", w), c.addEventListener(
|
|
1734
1518
|
"mousedown",
|
|
1735
|
-
|
|
1736
|
-
),
|
|
1519
|
+
x
|
|
1520
|
+
), c.addEventListener(
|
|
1737
1521
|
"touchstart",
|
|
1738
|
-
|
|
1739
|
-
),
|
|
1522
|
+
x
|
|
1523
|
+
), l.addEventListener(
|
|
1740
1524
|
"mousedown",
|
|
1741
|
-
|
|
1742
|
-
),
|
|
1525
|
+
P
|
|
1526
|
+
), l.addEventListener(
|
|
1743
1527
|
"touchstart",
|
|
1744
|
-
|
|
1528
|
+
P
|
|
1745
1529
|
), {
|
|
1746
|
-
dom:
|
|
1530
|
+
dom: i,
|
|
1747
1531
|
destroy: () => {
|
|
1748
|
-
s == null || s(), window.removeEventListener("mousemove", h), window.removeEventListener("touchmove", h), window.removeEventListener("mouseup", f), window.removeEventListener("touchend", f),
|
|
1532
|
+
s == null || s(), window.removeEventListener("mousemove", h), window.removeEventListener("touchmove", h), window.removeEventListener("mouseup", f), window.removeEventListener("touchend", f), i.removeEventListener("mouseenter", E), i.removeEventListener("mouseleave", w), c.removeEventListener(
|
|
1749
1533
|
"mousedown",
|
|
1750
|
-
|
|
1751
|
-
),
|
|
1534
|
+
x
|
|
1535
|
+
), c.removeEventListener(
|
|
1752
1536
|
"touchstart",
|
|
1753
|
-
|
|
1754
|
-
),
|
|
1537
|
+
x
|
|
1538
|
+
), l.removeEventListener(
|
|
1755
1539
|
"mousedown",
|
|
1756
|
-
|
|
1757
|
-
),
|
|
1540
|
+
P
|
|
1541
|
+
), l.removeEventListener(
|
|
1758
1542
|
"touchstart",
|
|
1759
|
-
|
|
1543
|
+
P
|
|
1760
1544
|
);
|
|
1761
1545
|
}
|
|
1762
1546
|
};
|
|
1763
|
-
},
|
|
1547
|
+
}, ge = (e) => {
|
|
1764
1548
|
const t = e.src || void 0, n = e.width || void 0, o = e.alt || void 0;
|
|
1765
1549
|
return { url: t, previewWidth: n, name: o };
|
|
1766
|
-
},
|
|
1550
|
+
}, en = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>', tn = (e = {}) => ({
|
|
1767
1551
|
type: "image",
|
|
1768
1552
|
propSchema: {
|
|
1769
|
-
textAlignment:
|
|
1770
|
-
backgroundColor:
|
|
1553
|
+
textAlignment: g.textAlignment,
|
|
1554
|
+
backgroundColor: g.backgroundColor,
|
|
1771
1555
|
// File name.
|
|
1772
1556
|
name: {
|
|
1773
1557
|
default: ""
|
|
@@ -1790,43 +1574,43 @@ const $t = () => ({
|
|
|
1790
1574
|
}
|
|
1791
1575
|
},
|
|
1792
1576
|
content: "none"
|
|
1793
|
-
}),
|
|
1577
|
+
}), nn = (e = {}) => (t) => {
|
|
1794
1578
|
if (t.tagName === "IMG") {
|
|
1795
1579
|
if (t.closest("figure"))
|
|
1796
1580
|
return;
|
|
1797
1581
|
const { backgroundColor: n } = y(t);
|
|
1798
1582
|
return {
|
|
1799
|
-
...
|
|
1583
|
+
...ge(t),
|
|
1800
1584
|
backgroundColor: n
|
|
1801
1585
|
};
|
|
1802
1586
|
}
|
|
1803
1587
|
if (t.tagName === "FIGURE") {
|
|
1804
|
-
const n =
|
|
1588
|
+
const n = $(t, "img");
|
|
1805
1589
|
if (!n)
|
|
1806
1590
|
return;
|
|
1807
1591
|
const { targetElement: o, caption: r } = n, { backgroundColor: a } = y(t);
|
|
1808
1592
|
return {
|
|
1809
|
-
...
|
|
1593
|
+
...ge(o),
|
|
1810
1594
|
backgroundColor: a,
|
|
1811
1595
|
caption: r
|
|
1812
1596
|
};
|
|
1813
1597
|
}
|
|
1814
|
-
},
|
|
1598
|
+
}, on = (e = {}) => (t, n) => {
|
|
1815
1599
|
const o = document.createElement("div");
|
|
1816
|
-
o.innerHTML = e.icon ??
|
|
1600
|
+
o.innerHTML = e.icon ?? en;
|
|
1817
1601
|
const r = document.createElement("div");
|
|
1818
1602
|
r.className = "bn-visual-media-wrapper";
|
|
1819
1603
|
const a = document.createElement("img");
|
|
1820
1604
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((s) => {
|
|
1821
1605
|
a.src = s;
|
|
1822
|
-
}) : a.src = t.props.url, a.alt = t.props.name || t.props.caption || "BlockNote image", a.contentEditable = "false", a.draggable = !1, r.appendChild(a),
|
|
1606
|
+
}) : a.src = t.props.url, a.alt = t.props.name || t.props.caption || "BlockNote image", a.contentEditable = "false", a.draggable = !1, r.appendChild(a), Pe(
|
|
1823
1607
|
t,
|
|
1824
1608
|
n,
|
|
1825
1609
|
{ dom: r },
|
|
1826
1610
|
r,
|
|
1827
1611
|
o.firstElementChild
|
|
1828
1612
|
);
|
|
1829
|
-
},
|
|
1613
|
+
}, rn = (e = {}) => (t, n) => {
|
|
1830
1614
|
if (!t.props.url) {
|
|
1831
1615
|
const r = document.createElement("p");
|
|
1832
1616
|
return r.textContent = "Add image", {
|
|
@@ -1834,28 +1618,28 @@ const $t = () => ({
|
|
|
1834
1618
|
};
|
|
1835
1619
|
}
|
|
1836
1620
|
let o;
|
|
1837
|
-
return t.props.showPreview ? (o = document.createElement("img"), o.src = t.props.url, o.alt = t.props.name || t.props.caption || "BlockNote image", t.props.previewWidth && (o.width = t.props.previewWidth)) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ?
|
|
1621
|
+
return t.props.showPreview ? (o = document.createElement("img"), o.src = t.props.url, o.alt = t.props.name || t.props.caption || "BlockNote image", t.props.previewWidth && (o.width = t.props.previewWidth)) : (o = document.createElement("a"), o.href = t.props.url, o.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? J(o, t.props.caption) : U(o, t.props.caption) : {
|
|
1838
1622
|
dom: o
|
|
1839
1623
|
};
|
|
1840
|
-
},
|
|
1841
|
-
|
|
1624
|
+
}, an = v(
|
|
1625
|
+
tn,
|
|
1842
1626
|
(e) => ({
|
|
1843
1627
|
meta: {
|
|
1844
1628
|
fileBlockAccept: ["image/*"]
|
|
1845
1629
|
},
|
|
1846
|
-
parse:
|
|
1847
|
-
render:
|
|
1848
|
-
toExternalHTML:
|
|
1630
|
+
parse: nn(e),
|
|
1631
|
+
render: on(e),
|
|
1632
|
+
toExternalHTML: rn(e),
|
|
1849
1633
|
runsBefore: ["file"]
|
|
1850
1634
|
})
|
|
1851
|
-
),
|
|
1635
|
+
), So = (e, t, n) => ({
|
|
1852
1636
|
state: o,
|
|
1853
1637
|
dispatch: r
|
|
1854
|
-
}) => r ?
|
|
1855
|
-
const r =
|
|
1638
|
+
}) => r ? Ne(o.tr, e, t, n) : !0, Ne = (e, t, n, o) => {
|
|
1639
|
+
const r = tt(e.doc, t), a = G(r);
|
|
1856
1640
|
if (!a.isBlockContainer)
|
|
1857
1641
|
return !1;
|
|
1858
|
-
const s =
|
|
1642
|
+
const s = O(e), i = [
|
|
1859
1643
|
{
|
|
1860
1644
|
type: a.bnBlock.node.type,
|
|
1861
1645
|
// always keep blockcontainer type
|
|
@@ -1866,25 +1650,25 @@ const $t = () => ({
|
|
|
1866
1650
|
attrs: o ? { ...a.blockContent.node.attrs } : {}
|
|
1867
1651
|
}
|
|
1868
1652
|
];
|
|
1869
|
-
return e.split(t, 2,
|
|
1870
|
-
},
|
|
1653
|
+
return e.split(t, 2, i), !0;
|
|
1654
|
+
}, q = (e, t) => {
|
|
1871
1655
|
const { blockInfo: n, selectionEmpty: o } = e.transact((s) => ({
|
|
1872
|
-
blockInfo:
|
|
1656
|
+
blockInfo: nt(s),
|
|
1873
1657
|
selectionEmpty: s.selection.anchor === s.selection.head
|
|
1874
1658
|
}));
|
|
1875
1659
|
if (!n.isBlockContainer)
|
|
1876
1660
|
return !1;
|
|
1877
1661
|
const { bnBlock: r, blockContent: a } = n;
|
|
1878
1662
|
return a.node.type.name !== t || !o ? !1 : a.node.childCount === 0 ? (e.transact((s) => {
|
|
1879
|
-
|
|
1663
|
+
K(s, r.beforePos, {
|
|
1880
1664
|
type: "paragraph",
|
|
1881
1665
|
props: {}
|
|
1882
1666
|
});
|
|
1883
|
-
}), !0) : a.node.childCount > 0 ? e.transact((s) => (s.deleteSelection(),
|
|
1667
|
+
}), !0) : a.node.childCount > 0 ? e.transact((s) => (s.deleteSelection(), Ne(s, s.selection.from, !0))) : !1;
|
|
1884
1668
|
};
|
|
1885
|
-
function
|
|
1669
|
+
function Y(e, t, n) {
|
|
1886
1670
|
var d, p, h;
|
|
1887
|
-
const o =
|
|
1671
|
+
const o = Se.fromSchema(t), r = e, a = document.createElement("div");
|
|
1888
1672
|
a.setAttribute("data-node-type", "blockGroup");
|
|
1889
1673
|
for (const f of Array.from(r.childNodes))
|
|
1890
1674
|
a.appendChild(f.cloneNode(!0));
|
|
@@ -1896,30 +1680,30 @@ function Q(e, t, n) {
|
|
|
1896
1680
|
s.firstChild.firstChild.nodeSize + 2
|
|
1897
1681
|
)
|
|
1898
1682
|
));
|
|
1899
|
-
const
|
|
1900
|
-
if (!(
|
|
1901
|
-
return
|
|
1902
|
-
const
|
|
1683
|
+
const i = (h = s.firstChild) == null ? void 0 : h.firstChild;
|
|
1684
|
+
if (!(i != null && i.isTextblock))
|
|
1685
|
+
return F.from(s);
|
|
1686
|
+
const c = t.nodes[n].create(
|
|
1903
1687
|
{},
|
|
1904
|
-
|
|
1905
|
-
),
|
|
1688
|
+
i.content
|
|
1689
|
+
), l = s.content.cut(
|
|
1906
1690
|
// +2 for the `blockGroup` node's start and end markers
|
|
1907
|
-
|
|
1691
|
+
i.nodeSize + 2
|
|
1908
1692
|
);
|
|
1909
|
-
if (
|
|
1910
|
-
const f = s.copy(
|
|
1911
|
-
return
|
|
1693
|
+
if (l.size > 0) {
|
|
1694
|
+
const f = s.copy(l);
|
|
1695
|
+
return c.content.addToEnd(f);
|
|
1912
1696
|
}
|
|
1913
|
-
return
|
|
1697
|
+
return c.content;
|
|
1914
1698
|
}
|
|
1915
|
-
const
|
|
1699
|
+
const sn = () => ({
|
|
1916
1700
|
type: "bulletListItem",
|
|
1917
1701
|
propSchema: {
|
|
1918
|
-
...
|
|
1702
|
+
...g
|
|
1919
1703
|
},
|
|
1920
1704
|
content: "inline"
|
|
1921
|
-
}),
|
|
1922
|
-
|
|
1705
|
+
}), cn = v(
|
|
1706
|
+
sn,
|
|
1923
1707
|
{
|
|
1924
1708
|
meta: {
|
|
1925
1709
|
isolating: !1
|
|
@@ -1934,7 +1718,7 @@ const rn = () => ({
|
|
|
1934
1718
|
},
|
|
1935
1719
|
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
1936
1720
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
1937
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
1721
|
+
parseContent: ({ el: e, schema: t }) => Y(e, t, "bulletListItem"),
|
|
1938
1722
|
render() {
|
|
1939
1723
|
const e = document.createElement("p");
|
|
1940
1724
|
return {
|
|
@@ -1944,17 +1728,17 @@ const rn = () => ({
|
|
|
1944
1728
|
},
|
|
1945
1729
|
toExternalHTML(e) {
|
|
1946
1730
|
const t = document.createElement("li"), n = document.createElement("p");
|
|
1947
|
-
return
|
|
1731
|
+
return A(e.props, t), t.appendChild(n), {
|
|
1948
1732
|
dom: t,
|
|
1949
1733
|
contentDOM: n
|
|
1950
1734
|
};
|
|
1951
1735
|
}
|
|
1952
1736
|
},
|
|
1953
1737
|
[
|
|
1954
|
-
|
|
1738
|
+
k({
|
|
1955
1739
|
key: "bullet-list-item-shortcuts",
|
|
1956
1740
|
keyboardShortcuts: {
|
|
1957
|
-
Enter: ({ editor: e }) =>
|
|
1741
|
+
Enter: ({ editor: e }) => q(e, "bulletListItem"),
|
|
1958
1742
|
"Mod-Shift-8": ({ editor: e }) => {
|
|
1959
1743
|
const t = e.getTextCursorPosition();
|
|
1960
1744
|
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
@@ -1967,7 +1751,7 @@ const rn = () => ({
|
|
|
1967
1751
|
{
|
|
1968
1752
|
find: new RegExp("^[-+*]\\s$"),
|
|
1969
1753
|
replace({ editor: e }) {
|
|
1970
|
-
if (
|
|
1754
|
+
if (Ee(
|
|
1971
1755
|
e.prosemirrorState
|
|
1972
1756
|
).blockNoteType !== "heading")
|
|
1973
1757
|
return {
|
|
@@ -1979,15 +1763,15 @@ const rn = () => ({
|
|
|
1979
1763
|
]
|
|
1980
1764
|
})
|
|
1981
1765
|
]
|
|
1982
|
-
),
|
|
1766
|
+
), ln = () => ({
|
|
1983
1767
|
type: "checkListItem",
|
|
1984
1768
|
propSchema: {
|
|
1985
|
-
...
|
|
1769
|
+
...g,
|
|
1986
1770
|
checked: { default: !1, type: "boolean" }
|
|
1987
1771
|
},
|
|
1988
1772
|
content: "inline"
|
|
1989
|
-
}),
|
|
1990
|
-
|
|
1773
|
+
}), dn = v(
|
|
1774
|
+
ln,
|
|
1991
1775
|
{
|
|
1992
1776
|
meta: {
|
|
1993
1777
|
isolating: !1
|
|
@@ -2006,7 +1790,7 @@ const rn = () => ({
|
|
|
2006
1790
|
},
|
|
2007
1791
|
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
2008
1792
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
2009
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
1793
|
+
parseContent: ({ el: e, schema: t }) => Y(e, t, "checkListItem"),
|
|
2010
1794
|
render(e, t) {
|
|
2011
1795
|
const n = document.createDocumentFragment(), o = document.createElement("input");
|
|
2012
1796
|
o.type = "checkbox", o.checked = e.props.checked, e.props.checked && o.setAttribute("checked", ""), o.addEventListener("change", () => {
|
|
@@ -2022,7 +1806,7 @@ const rn = () => ({
|
|
|
2022
1806
|
const t = document.createElement("li"), n = document.createElement("input");
|
|
2023
1807
|
n.type = "checkbox", n.checked = e.props.checked, e.props.checked && n.setAttribute("checked", "");
|
|
2024
1808
|
const o = document.createElement("p");
|
|
2025
|
-
return
|
|
1809
|
+
return A(e.props, t), t.appendChild(n), t.appendChild(o), {
|
|
2026
1810
|
dom: t,
|
|
2027
1811
|
contentDOM: o
|
|
2028
1812
|
};
|
|
@@ -2030,10 +1814,10 @@ const rn = () => ({
|
|
|
2030
1814
|
runsBefore: ["bulletListItem"]
|
|
2031
1815
|
},
|
|
2032
1816
|
[
|
|
2033
|
-
|
|
1817
|
+
k({
|
|
2034
1818
|
key: "check-list-item-shortcuts",
|
|
2035
1819
|
keyboardShortcuts: {
|
|
2036
|
-
Enter: ({ editor: e }) =>
|
|
1820
|
+
Enter: ({ editor: e }) => q(e, "checkListItem"),
|
|
2037
1821
|
"Mod-Shift-9": ({ editor: e }) => {
|
|
2038
1822
|
const t = e.getTextCursorPosition();
|
|
2039
1823
|
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
@@ -2070,48 +1854,48 @@ const rn = () => ({
|
|
|
2070
1854
|
})
|
|
2071
1855
|
]
|
|
2072
1856
|
);
|
|
2073
|
-
function
|
|
1857
|
+
function He(e, t, n, o) {
|
|
2074
1858
|
let r = e.firstChild.attrs.start || 1, a = !0;
|
|
2075
|
-
const s = !!e.firstChild.attrs.start,
|
|
1859
|
+
const s = !!e.firstChild.attrs.start, i = G({
|
|
2076
1860
|
posBeforeNode: t,
|
|
2077
1861
|
node: e
|
|
2078
1862
|
});
|
|
2079
|
-
if (!
|
|
1863
|
+
if (!i.isBlockContainer)
|
|
2080
1864
|
throw new Error("impossible");
|
|
2081
|
-
const
|
|
2082
|
-
return
|
|
2083
|
-
posBeforeNode:
|
|
2084
|
-
node:
|
|
2085
|
-
}).blockNoteType === "numberedListItem" && (r =
|
|
2086
|
-
|
|
2087
|
-
|
|
1865
|
+
const c = n.doc.resolve(i.bnBlock.beforePos).nodeBefore, l = c ? o.get(c) : void 0;
|
|
1866
|
+
return l !== void 0 ? (r = l + 1, a = !1) : c && G({
|
|
1867
|
+
posBeforeNode: i.bnBlock.beforePos - c.nodeSize,
|
|
1868
|
+
node: c
|
|
1869
|
+
}).blockNoteType === "numberedListItem" && (r = He(
|
|
1870
|
+
c,
|
|
1871
|
+
i.bnBlock.beforePos - c.nodeSize,
|
|
2088
1872
|
n,
|
|
2089
1873
|
o
|
|
2090
1874
|
).index + 1, a = !1), o.set(e, r), { index: r, isFirst: a, hasStart: s };
|
|
2091
1875
|
}
|
|
2092
|
-
function
|
|
1876
|
+
function he(e, t) {
|
|
2093
1877
|
const n = /* @__PURE__ */ new Map(), o = t.decorations.map(
|
|
2094
1878
|
e.mapping,
|
|
2095
1879
|
e.doc
|
|
2096
1880
|
), r = [];
|
|
2097
|
-
e.doc.nodesBetween(0, e.doc.nodeSize - 2, (s,
|
|
1881
|
+
e.doc.nodesBetween(0, e.doc.nodeSize - 2, (s, i) => {
|
|
2098
1882
|
if (s.type.name === "blockContainer" && s.firstChild.type.name === "numberedListItem") {
|
|
2099
|
-
const { index:
|
|
1883
|
+
const { index: c, isFirst: l, hasStart: u } = He(
|
|
2100
1884
|
s,
|
|
2101
|
-
|
|
1885
|
+
i,
|
|
2102
1886
|
e,
|
|
2103
1887
|
n
|
|
2104
1888
|
);
|
|
2105
1889
|
if (o.find(
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
(p) => p.index ===
|
|
1890
|
+
i,
|
|
1891
|
+
i + s.nodeSize,
|
|
1892
|
+
(p) => p.index === c && p.isFirst === l && p.hasStart === u
|
|
2109
1893
|
).length === 0) {
|
|
2110
|
-
const p = e.doc.nodeAt(
|
|
1894
|
+
const p = e.doc.nodeAt(i + 1);
|
|
2111
1895
|
r.push(
|
|
2112
1896
|
// move in by 1 to account for the block container
|
|
2113
|
-
|
|
2114
|
-
"data-index":
|
|
1897
|
+
gt.node(i + 1, i + 1 + p.nodeSize, {
|
|
1898
|
+
"data-index": c.toString()
|
|
2115
1899
|
})
|
|
2116
1900
|
);
|
|
2117
1901
|
}
|
|
@@ -2124,33 +1908,33 @@ function pe(e, t) {
|
|
|
2124
1908
|
decorations: o.remove(a).add(e.doc, r)
|
|
2125
1909
|
};
|
|
2126
1910
|
}
|
|
2127
|
-
const
|
|
2128
|
-
key: new
|
|
1911
|
+
const un = () => new pt({
|
|
1912
|
+
key: new ft("numbered-list-indexing-decorations"),
|
|
2129
1913
|
state: {
|
|
2130
1914
|
init(e, t) {
|
|
2131
|
-
return
|
|
2132
|
-
decorations:
|
|
1915
|
+
return he(t.tr, {
|
|
1916
|
+
decorations: ce.empty
|
|
2133
1917
|
});
|
|
2134
1918
|
},
|
|
2135
1919
|
apply(e, t) {
|
|
2136
|
-
return !e.docChanged && !e.selectionSet && t.decorations ? t :
|
|
1920
|
+
return !e.docChanged && !e.selectionSet && t.decorations ? t : he(e, t);
|
|
2137
1921
|
}
|
|
2138
1922
|
},
|
|
2139
1923
|
props: {
|
|
2140
1924
|
decorations(e) {
|
|
2141
1925
|
var t;
|
|
2142
|
-
return ((t = this.getState(e)) == null ? void 0 : t.decorations) ??
|
|
1926
|
+
return ((t = this.getState(e)) == null ? void 0 : t.decorations) ?? ce.empty;
|
|
2143
1927
|
}
|
|
2144
1928
|
}
|
|
2145
|
-
}),
|
|
1929
|
+
}), pn = () => ({
|
|
2146
1930
|
type: "numberedListItem",
|
|
2147
1931
|
propSchema: {
|
|
2148
|
-
...
|
|
1932
|
+
...g,
|
|
2149
1933
|
start: { default: void 0, type: "number" }
|
|
2150
1934
|
},
|
|
2151
1935
|
content: "inline"
|
|
2152
|
-
}),
|
|
2153
|
-
|
|
1936
|
+
}), fn = v(
|
|
1937
|
+
pn,
|
|
2154
1938
|
{
|
|
2155
1939
|
meta: {
|
|
2156
1940
|
isolating: !1
|
|
@@ -2170,7 +1954,7 @@ const ln = () => new ot({
|
|
|
2170
1954
|
},
|
|
2171
1955
|
// As `li` elements can contain multiple paragraphs, we need to merge their contents
|
|
2172
1956
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
2173
|
-
parseContent: ({ el: e, schema: t }) =>
|
|
1957
|
+
parseContent: ({ el: e, schema: t }) => Y(e, t, "numberedListItem"),
|
|
2174
1958
|
render() {
|
|
2175
1959
|
const e = document.createElement("p");
|
|
2176
1960
|
return {
|
|
@@ -2180,20 +1964,20 @@ const ln = () => new ot({
|
|
|
2180
1964
|
},
|
|
2181
1965
|
toExternalHTML(e) {
|
|
2182
1966
|
const t = document.createElement("li"), n = document.createElement("p");
|
|
2183
|
-
return
|
|
1967
|
+
return A(e.props, t), t.appendChild(n), {
|
|
2184
1968
|
dom: t,
|
|
2185
1969
|
contentDOM: n
|
|
2186
1970
|
};
|
|
2187
1971
|
}
|
|
2188
1972
|
},
|
|
2189
1973
|
[
|
|
2190
|
-
|
|
1974
|
+
k({
|
|
2191
1975
|
key: "numbered-list-item-shortcuts",
|
|
2192
1976
|
inputRules: [
|
|
2193
1977
|
{
|
|
2194
1978
|
find: new RegExp("^(\\d+)\\.\\s$"),
|
|
2195
1979
|
replace({ match: e, editor: t }) {
|
|
2196
|
-
if (
|
|
1980
|
+
if (Ee(
|
|
2197
1981
|
t.prosemirrorState
|
|
2198
1982
|
).blockNoteType === "heading")
|
|
2199
1983
|
return;
|
|
@@ -2208,7 +1992,7 @@ const ln = () => new ot({
|
|
|
2208
1992
|
}
|
|
2209
1993
|
],
|
|
2210
1994
|
keyboardShortcuts: {
|
|
2211
|
-
Enter: ({ editor: e }) =>
|
|
1995
|
+
Enter: ({ editor: e }) => q(e, "numberedListItem"),
|
|
2212
1996
|
"Mod-Shift-7": ({ editor: e }) => {
|
|
2213
1997
|
const t = e.getTextCursorPosition();
|
|
2214
1998
|
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
@@ -2217,24 +2001,24 @@ const ln = () => new ot({
|
|
|
2217
2001
|
}), !0);
|
|
2218
2002
|
}
|
|
2219
2003
|
},
|
|
2220
|
-
|
|
2004
|
+
prosemirrorPlugins: [un()]
|
|
2221
2005
|
})
|
|
2222
2006
|
]
|
|
2223
|
-
),
|
|
2007
|
+
), gn = () => ({
|
|
2224
2008
|
type: "toggleListItem",
|
|
2225
2009
|
propSchema: {
|
|
2226
|
-
...
|
|
2010
|
+
...g
|
|
2227
2011
|
},
|
|
2228
2012
|
content: "inline"
|
|
2229
|
-
}),
|
|
2230
|
-
|
|
2013
|
+
}), hn = v(
|
|
2014
|
+
gn,
|
|
2231
2015
|
{
|
|
2232
2016
|
meta: {
|
|
2233
2017
|
isolating: !1
|
|
2234
2018
|
},
|
|
2235
2019
|
render(e, t) {
|
|
2236
2020
|
const n = document.createElement("p");
|
|
2237
|
-
return { ...
|
|
2021
|
+
return { ...Be(
|
|
2238
2022
|
e,
|
|
2239
2023
|
t,
|
|
2240
2024
|
n
|
|
@@ -2242,17 +2026,17 @@ const ln = () => new ot({
|
|
|
2242
2026
|
},
|
|
2243
2027
|
toExternalHTML(e) {
|
|
2244
2028
|
const t = document.createElement("li"), n = document.createElement("p");
|
|
2245
|
-
return
|
|
2029
|
+
return A(e.props, t), t.appendChild(n), {
|
|
2246
2030
|
dom: t,
|
|
2247
2031
|
contentDOM: n
|
|
2248
2032
|
};
|
|
2249
2033
|
}
|
|
2250
2034
|
},
|
|
2251
2035
|
[
|
|
2252
|
-
|
|
2036
|
+
k({
|
|
2253
2037
|
key: "toggle-list-item-shortcuts",
|
|
2254
2038
|
keyboardShortcuts: {
|
|
2255
|
-
Enter: ({ editor: e }) =>
|
|
2039
|
+
Enter: ({ editor: e }) => q(e, "toggleListItem"),
|
|
2256
2040
|
"Mod-Shift-6": ({ editor: e }) => {
|
|
2257
2041
|
const t = e.getTextCursorPosition();
|
|
2258
2042
|
return e.schema.blockSchema[t.block.type].content !== "inline" ? !1 : (e.updateBlock(t.block, {
|
|
@@ -2264,39 +2048,11 @@ const ln = () => new ot({
|
|
|
2264
2048
|
})
|
|
2265
2049
|
]
|
|
2266
2050
|
), mn = () => ({
|
|
2267
|
-
type: "pageBreak",
|
|
2268
|
-
propSchema: {},
|
|
2269
|
-
content: "none"
|
|
2270
|
-
}), hn = v(
|
|
2271
|
-
mn,
|
|
2272
|
-
{
|
|
2273
|
-
parse(e) {
|
|
2274
|
-
if (e.tagName === "DIV" && e.hasAttribute("data-page-break"))
|
|
2275
|
-
return {};
|
|
2276
|
-
},
|
|
2277
|
-
render() {
|
|
2278
|
-
const e = document.createElement("div");
|
|
2279
|
-
return e.setAttribute("data-page-break", ""), {
|
|
2280
|
-
dom: e
|
|
2281
|
-
};
|
|
2282
|
-
},
|
|
2283
|
-
toExternalHTML() {
|
|
2284
|
-
const e = document.createElement("div");
|
|
2285
|
-
return e.setAttribute("data-page-break", ""), {
|
|
2286
|
-
dom: e
|
|
2287
|
-
};
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
), ho = (e) => e.extend({
|
|
2291
|
-
blockSpecs: {
|
|
2292
|
-
pageBreak: hn()
|
|
2293
|
-
}
|
|
2294
|
-
}), gn = () => ({
|
|
2295
2051
|
type: "paragraph",
|
|
2296
|
-
propSchema:
|
|
2052
|
+
propSchema: g,
|
|
2297
2053
|
content: "inline"
|
|
2298
2054
|
}), bn = v(
|
|
2299
|
-
|
|
2055
|
+
mn,
|
|
2300
2056
|
{
|
|
2301
2057
|
meta: {
|
|
2302
2058
|
isolating: !1
|
|
@@ -2315,7 +2071,7 @@ const ln = () => new ot({
|
|
|
2315
2071
|
},
|
|
2316
2072
|
toExternalHTML: (e) => {
|
|
2317
2073
|
const t = document.createElement("p");
|
|
2318
|
-
return
|
|
2074
|
+
return A(e.props, t), {
|
|
2319
2075
|
dom: t,
|
|
2320
2076
|
contentDOM: t
|
|
2321
2077
|
};
|
|
@@ -2323,7 +2079,7 @@ const ln = () => new ot({
|
|
|
2323
2079
|
runsBefore: ["default"]
|
|
2324
2080
|
},
|
|
2325
2081
|
[
|
|
2326
|
-
|
|
2082
|
+
k({
|
|
2327
2083
|
key: "paragraph-shortcuts",
|
|
2328
2084
|
keyboardShortcuts: {
|
|
2329
2085
|
"Mod-Alt-0": ({ editor: e }) => {
|
|
@@ -2336,15 +2092,15 @@ const ln = () => new ot({
|
|
|
2336
2092
|
}
|
|
2337
2093
|
})
|
|
2338
2094
|
]
|
|
2339
|
-
),
|
|
2095
|
+
), Cn = () => ({
|
|
2340
2096
|
type: "quote",
|
|
2341
2097
|
propSchema: {
|
|
2342
|
-
backgroundColor:
|
|
2343
|
-
textColor:
|
|
2098
|
+
backgroundColor: g.backgroundColor,
|
|
2099
|
+
textColor: g.textColor
|
|
2344
2100
|
},
|
|
2345
2101
|
content: "inline"
|
|
2346
|
-
}),
|
|
2347
|
-
|
|
2102
|
+
}), kn = v(
|
|
2103
|
+
Cn,
|
|
2348
2104
|
{
|
|
2349
2105
|
meta: {
|
|
2350
2106
|
isolating: !1
|
|
@@ -2364,14 +2120,14 @@ const ln = () => new ot({
|
|
|
2364
2120
|
},
|
|
2365
2121
|
toExternalHTML(e) {
|
|
2366
2122
|
const t = document.createElement("blockquote");
|
|
2367
|
-
return
|
|
2123
|
+
return A(e.props, t), {
|
|
2368
2124
|
dom: t,
|
|
2369
2125
|
contentDOM: t
|
|
2370
2126
|
};
|
|
2371
2127
|
}
|
|
2372
2128
|
},
|
|
2373
2129
|
[
|
|
2374
|
-
|
|
2130
|
+
k({
|
|
2375
2131
|
key: "quote-block-shortcuts",
|
|
2376
2132
|
keyboardShortcuts: {
|
|
2377
2133
|
"Mod-Alt-q": ({ editor: e }) => {
|
|
@@ -2395,18 +2151,18 @@ const ln = () => new ot({
|
|
|
2395
2151
|
]
|
|
2396
2152
|
})
|
|
2397
2153
|
]
|
|
2398
|
-
), yn = 35,
|
|
2154
|
+
), yn = 35, Ie = 120, Mo = 31, vn = $e.create({
|
|
2399
2155
|
name: "BlockNoteTableExtension",
|
|
2400
2156
|
addProseMirrorPlugins: () => [
|
|
2401
|
-
|
|
2157
|
+
Ve({
|
|
2402
2158
|
cellMinWidth: yn,
|
|
2403
|
-
defaultCellMinWidth:
|
|
2159
|
+
defaultCellMinWidth: Ie,
|
|
2404
2160
|
// We set this to null as we implement our own node view in the table
|
|
2405
2161
|
// block content. This node view is the same as what's used by default,
|
|
2406
2162
|
// but is wrapped in a `blockContent` HTML element.
|
|
2407
2163
|
View: null
|
|
2408
2164
|
}),
|
|
2409
|
-
|
|
2165
|
+
Re()
|
|
2410
2166
|
],
|
|
2411
2167
|
addKeyboardShortcuts() {
|
|
2412
2168
|
return {
|
|
@@ -2420,10 +2176,10 @@ const ln = () => new ot({
|
|
|
2420
2176
|
},
|
|
2421
2177
|
// Enables navigating cells using the tab key.
|
|
2422
2178
|
Tab: () => this.editor.commands.command(
|
|
2423
|
-
({ state: e, dispatch: t, view: n }) =>
|
|
2179
|
+
({ state: e, dispatch: t, view: n }) => ne(1)(e, t, n)
|
|
2424
2180
|
),
|
|
2425
2181
|
"Shift-Tab": () => this.editor.commands.command(
|
|
2426
|
-
({ state: e, dispatch: t, view: n }) =>
|
|
2182
|
+
({ state: e, dispatch: t, view: n }) => ne(-1)(e, t, n)
|
|
2427
2183
|
)
|
|
2428
2184
|
};
|
|
2429
2185
|
},
|
|
@@ -2434,14 +2190,14 @@ const ln = () => new ot({
|
|
|
2434
2190
|
storage: e.storage
|
|
2435
2191
|
};
|
|
2436
2192
|
return {
|
|
2437
|
-
tableRole:
|
|
2438
|
-
|
|
2193
|
+
tableRole: Ue(
|
|
2194
|
+
qe(e, "tableRole", t)
|
|
2439
2195
|
)
|
|
2440
2196
|
};
|
|
2441
2197
|
}
|
|
2442
|
-
}),
|
|
2443
|
-
textColor:
|
|
2444
|
-
},
|
|
2198
|
+
}), En = {
|
|
2199
|
+
textColor: g.textColor
|
|
2200
|
+
}, xn = N.create({
|
|
2445
2201
|
name: "tableHeader",
|
|
2446
2202
|
addOptions() {
|
|
2447
2203
|
return {
|
|
@@ -2481,7 +2237,7 @@ const ln = () => new ot({
|
|
|
2481
2237
|
tag: "th",
|
|
2482
2238
|
// As `th` elements can contain multiple paragraphs, we need to merge their contents
|
|
2483
2239
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
2484
|
-
getContent: (e, t) =>
|
|
2240
|
+
getContent: (e, t) => De(e, t)
|
|
2485
2241
|
}
|
|
2486
2242
|
];
|
|
2487
2243
|
},
|
|
@@ -2525,7 +2281,7 @@ const ln = () => new ot({
|
|
|
2525
2281
|
tag: "td",
|
|
2526
2282
|
// As `td` elements can contain multiple paragraphs, we need to merge their contents
|
|
2527
2283
|
// into a single one so that ProseMirror can parse everything correctly.
|
|
2528
|
-
getContent: (e, t) =>
|
|
2284
|
+
getContent: (e, t) => De(e, t)
|
|
2529
2285
|
}
|
|
2530
2286
|
];
|
|
2531
2287
|
},
|
|
@@ -2536,7 +2292,7 @@ const ln = () => new ot({
|
|
|
2536
2292
|
0
|
|
2537
2293
|
];
|
|
2538
2294
|
}
|
|
2539
|
-
}),
|
|
2295
|
+
}), Sn = N.create({
|
|
2540
2296
|
name: "table",
|
|
2541
2297
|
content: "tableRow+",
|
|
2542
2298
|
group: "blockContent",
|
|
@@ -2552,7 +2308,7 @@ const ln = () => new ot({
|
|
|
2552
2308
|
},
|
|
2553
2309
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2554
2310
|
var r, a, s;
|
|
2555
|
-
const n =
|
|
2311
|
+
const n = mt(
|
|
2556
2312
|
this.name,
|
|
2557
2313
|
"table",
|
|
2558
2314
|
{
|
|
@@ -2561,11 +2317,11 @@ const ln = () => new ot({
|
|
|
2561
2317
|
},
|
|
2562
2318
|
((a = this.options.domAttributes) == null ? void 0 : a.inlineContent) || {}
|
|
2563
2319
|
), o = document.createElement("colgroup");
|
|
2564
|
-
for (const
|
|
2565
|
-
if (
|
|
2566
|
-
for (const
|
|
2320
|
+
for (const i of e.children[0].children)
|
|
2321
|
+
if (i.attrs.colwidth)
|
|
2322
|
+
for (const l of i.attrs.colwidth) {
|
|
2567
2323
|
const u = document.createElement("col");
|
|
2568
|
-
|
|
2324
|
+
l && (u.style = `width: ${l}px`), o.appendChild(u);
|
|
2569
2325
|
}
|
|
2570
2326
|
else
|
|
2571
2327
|
o.appendChild(document.createElement("col"));
|
|
@@ -2581,34 +2337,34 @@ const ln = () => new ot({
|
|
|
2581
2337
|
addNodeView() {
|
|
2582
2338
|
return ({ node: e, HTMLAttributes: t }) => {
|
|
2583
2339
|
var o;
|
|
2584
|
-
class n extends
|
|
2585
|
-
constructor(a, s,
|
|
2586
|
-
super(a, s), this.node = a, this.cellMinWidth = s, this.blockContentHTMLAttributes =
|
|
2587
|
-
const
|
|
2588
|
-
|
|
2340
|
+
class n extends We {
|
|
2341
|
+
constructor(a, s, i) {
|
|
2342
|
+
super(a, s), this.node = a, this.cellMinWidth = s, this.blockContentHTMLAttributes = i;
|
|
2343
|
+
const c = document.createElement("div");
|
|
2344
|
+
c.className = D(
|
|
2589
2345
|
"bn-block-content",
|
|
2590
|
-
|
|
2591
|
-
),
|
|
2346
|
+
i.class
|
|
2347
|
+
), c.setAttribute("data-content-type", "table");
|
|
2592
2348
|
for (const [p, h] of Object.entries(
|
|
2593
|
-
|
|
2349
|
+
i
|
|
2594
2350
|
))
|
|
2595
|
-
p !== "class" &&
|
|
2596
|
-
const
|
|
2597
|
-
u.className = "tableWrapper-inner", u.appendChild(
|
|
2351
|
+
p !== "class" && c.setAttribute(p, h);
|
|
2352
|
+
const l = this.dom, u = document.createElement("div");
|
|
2353
|
+
u.className = "tableWrapper-inner", u.appendChild(l.firstChild), l.appendChild(u), c.appendChild(l);
|
|
2598
2354
|
const d = document.createElement("div");
|
|
2599
|
-
d.className = "table-widgets-container", d.style.position = "relative",
|
|
2355
|
+
d.className = "table-widgets-container", d.style.position = "relative", l.appendChild(d), this.dom = c;
|
|
2600
2356
|
}
|
|
2601
2357
|
ignoreMutation(a) {
|
|
2602
2358
|
return !a.target.closest(".tableWrapper-inner") || super.ignoreMutation(a);
|
|
2603
2359
|
}
|
|
2604
2360
|
}
|
|
2605
|
-
return new n(e,
|
|
2361
|
+
return new n(e, Ie, {
|
|
2606
2362
|
...((o = this.options.domAttributes) == null ? void 0 : o.blockContent) || {},
|
|
2607
2363
|
...t
|
|
2608
2364
|
});
|
|
2609
2365
|
};
|
|
2610
2366
|
}
|
|
2611
|
-
}),
|
|
2367
|
+
}), Mn = N.create({
|
|
2612
2368
|
name: "tableParagraph",
|
|
2613
2369
|
group: "tableContent",
|
|
2614
2370
|
content: "inline*",
|
|
@@ -2629,7 +2385,7 @@ const ln = () => new ot({
|
|
|
2629
2385
|
renderHTML({ HTMLAttributes: e }) {
|
|
2630
2386
|
return ["p", e, 0];
|
|
2631
2387
|
}
|
|
2632
|
-
}),
|
|
2388
|
+
}), Ln = N.create({
|
|
2633
2389
|
name: "tableRow",
|
|
2634
2390
|
addOptions() {
|
|
2635
2391
|
return {
|
|
@@ -2650,38 +2406,38 @@ const ln = () => new ot({
|
|
|
2650
2406
|
];
|
|
2651
2407
|
}
|
|
2652
2408
|
});
|
|
2653
|
-
function
|
|
2654
|
-
const o =
|
|
2409
|
+
function De(e, t) {
|
|
2410
|
+
const o = Se.fromSchema(t).parse(e, {
|
|
2655
2411
|
topNode: t.nodes.blockGroup.create()
|
|
2656
2412
|
}), r = [];
|
|
2657
2413
|
return o.content.descendants((a) => {
|
|
2658
2414
|
if (a.isInline)
|
|
2659
2415
|
return r.push(a), !1;
|
|
2660
|
-
}),
|
|
2416
|
+
}), F.fromArray(r);
|
|
2661
2417
|
}
|
|
2662
|
-
const
|
|
2663
|
-
{ node:
|
|
2664
|
-
|
|
2418
|
+
const Tn = () => yt(
|
|
2419
|
+
{ node: Sn, type: "table", content: "table" },
|
|
2420
|
+
En,
|
|
2665
2421
|
[
|
|
2666
|
-
|
|
2422
|
+
k({
|
|
2667
2423
|
key: "table-extensions",
|
|
2668
2424
|
tiptapExtensions: [
|
|
2669
2425
|
vn,
|
|
2670
|
-
|
|
2671
|
-
|
|
2426
|
+
Mn,
|
|
2427
|
+
xn,
|
|
2672
2428
|
wn,
|
|
2673
|
-
|
|
2429
|
+
Ln
|
|
2674
2430
|
]
|
|
2675
2431
|
}),
|
|
2676
2432
|
// Extension for keyboard shortcut which deletes the table if it's empty
|
|
2677
2433
|
// and all cells are selected. Uses a separate extension as it needs
|
|
2678
2434
|
// priority over keyboard handlers in the `TableExtension`'s
|
|
2679
2435
|
// `tableEditing` plugin.
|
|
2680
|
-
|
|
2436
|
+
k({
|
|
2681
2437
|
key: "table-keyboard-delete",
|
|
2682
2438
|
keyboardShortcuts: {
|
|
2683
2439
|
Backspace: ({ editor: e }) => {
|
|
2684
|
-
if (!(e.prosemirrorState.selection instanceof
|
|
2440
|
+
if (!(e.prosemirrorState.selection instanceof Ce))
|
|
2685
2441
|
return !1;
|
|
2686
2442
|
const t = e.getTextCursorPosition().block, n = t.content;
|
|
2687
2443
|
let o = 0;
|
|
@@ -2701,14 +2457,14 @@ const Bn = () => pt(
|
|
|
2701
2457
|
}
|
|
2702
2458
|
})
|
|
2703
2459
|
]
|
|
2704
|
-
),
|
|
2460
|
+
), me = (e) => {
|
|
2705
2461
|
const t = e.src || void 0, n = e.width || void 0;
|
|
2706
2462
|
return { url: t, previewWidth: n };
|
|
2707
|
-
},
|
|
2463
|
+
}, Bn = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>', An = (e) => ({
|
|
2708
2464
|
type: "video",
|
|
2709
2465
|
propSchema: {
|
|
2710
|
-
textAlignment:
|
|
2711
|
-
backgroundColor:
|
|
2466
|
+
textAlignment: g.textAlignment,
|
|
2467
|
+
backgroundColor: g.backgroundColor,
|
|
2712
2468
|
name: { default: "" },
|
|
2713
2469
|
url: { default: "" },
|
|
2714
2470
|
caption: { default: "" },
|
|
@@ -2716,43 +2472,43 @@ const Bn = () => pt(
|
|
|
2716
2472
|
previewWidth: { default: void 0, type: "number" }
|
|
2717
2473
|
},
|
|
2718
2474
|
content: "none"
|
|
2719
|
-
}),
|
|
2475
|
+
}), Pn = (e) => (t) => {
|
|
2720
2476
|
if (t.tagName === "VIDEO") {
|
|
2721
2477
|
if (t.closest("figure"))
|
|
2722
2478
|
return;
|
|
2723
2479
|
const { backgroundColor: n } = y(t);
|
|
2724
2480
|
return {
|
|
2725
|
-
...
|
|
2481
|
+
...me(t),
|
|
2726
2482
|
backgroundColor: n
|
|
2727
2483
|
};
|
|
2728
2484
|
}
|
|
2729
2485
|
if (t.tagName === "FIGURE") {
|
|
2730
|
-
const n =
|
|
2486
|
+
const n = $(t, "video");
|
|
2731
2487
|
if (!n)
|
|
2732
2488
|
return;
|
|
2733
2489
|
const { targetElement: o, caption: r } = n, { backgroundColor: a } = y(t);
|
|
2734
2490
|
return {
|
|
2735
|
-
...
|
|
2491
|
+
...me(o),
|
|
2736
2492
|
backgroundColor: a,
|
|
2737
2493
|
caption: r
|
|
2738
2494
|
};
|
|
2739
2495
|
}
|
|
2740
|
-
},
|
|
2496
|
+
}, Nn = v(
|
|
2741
2497
|
An,
|
|
2742
2498
|
(e) => ({
|
|
2743
2499
|
meta: {
|
|
2744
2500
|
fileBlockAccept: ["video/*"]
|
|
2745
2501
|
},
|
|
2746
|
-
parse:
|
|
2502
|
+
parse: Pn(),
|
|
2747
2503
|
render(t, n) {
|
|
2748
2504
|
const o = document.createElement("div");
|
|
2749
|
-
o.innerHTML = e.icon ??
|
|
2505
|
+
o.innerHTML = e.icon ?? Bn;
|
|
2750
2506
|
const r = document.createElement("div");
|
|
2751
2507
|
r.className = "bn-visual-media-wrapper";
|
|
2752
2508
|
const a = document.createElement("video");
|
|
2753
2509
|
return a.className = "bn-visual-media", n.resolveFileUrl ? n.resolveFileUrl(t.props.url).then((s) => {
|
|
2754
2510
|
a.src = s;
|
|
2755
|
-
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, a.width = t.props.previewWidth, r.appendChild(a),
|
|
2511
|
+
}) : a.src = t.props.url, a.controls = !0, a.contentEditable = "false", a.draggable = !1, a.width = t.props.previewWidth, r.appendChild(a), Pe(
|
|
2756
2512
|
t,
|
|
2757
2513
|
n,
|
|
2758
2514
|
{ dom: r },
|
|
@@ -2768,23 +2524,14 @@ const Bn = () => pt(
|
|
|
2768
2524
|
};
|
|
2769
2525
|
}
|
|
2770
2526
|
let n;
|
|
2771
|
-
return t.props.showPreview ? (n = document.createElement("video"), n.src = t.props.url, t.props.previewWidth && (n.width = t.props.previewWidth)) : (n = document.createElement("a"), n.href = t.props.url, n.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ?
|
|
2527
|
+
return t.props.showPreview ? (n = document.createElement("video"), n.src = t.props.url, t.props.previewWidth && (n.width = t.props.previewWidth)) : (n = document.createElement("a"), n.href = t.props.url, n.textContent = t.props.name || t.props.url), t.props.caption ? t.props.showPreview ? J(n, t.props.caption) : U(n, t.props.caption) : {
|
|
2772
2528
|
dom: n
|
|
2773
2529
|
};
|
|
2774
2530
|
},
|
|
2775
2531
|
runsBefore: ["file"]
|
|
2776
2532
|
})
|
|
2777
|
-
)
|
|
2778
|
-
|
|
2779
|
-
return t.append("file", e), (await (await fetch("https://tmpfiles.org/api/v1/upload", {
|
|
2780
|
-
method: "POST",
|
|
2781
|
-
body: t
|
|
2782
|
-
})).json()).data.url.replace(
|
|
2783
|
-
"tmpfiles.org/",
|
|
2784
|
-
"tmpfiles.org/dl/"
|
|
2785
|
-
);
|
|
2786
|
-
};
|
|
2787
|
-
function k(e, t, n) {
|
|
2533
|
+
);
|
|
2534
|
+
function C(e, t, n) {
|
|
2788
2535
|
if (!(t in e.schema.blockSpecs))
|
|
2789
2536
|
return !1;
|
|
2790
2537
|
if (!n)
|
|
@@ -2807,13 +2554,256 @@ function k(e, t, n) {
|
|
|
2807
2554
|
}
|
|
2808
2555
|
return !0;
|
|
2809
2556
|
}
|
|
2810
|
-
function
|
|
2811
|
-
return
|
|
2557
|
+
function Lo(e, t, n, o) {
|
|
2558
|
+
return C(t, n, o) && e.type === n;
|
|
2559
|
+
}
|
|
2560
|
+
function To(e) {
|
|
2561
|
+
return e instanceof Ce;
|
|
2812
2562
|
}
|
|
2813
|
-
|
|
2814
|
-
|
|
2563
|
+
const R = /* @__PURE__ */ new Map();
|
|
2564
|
+
function Hn(e) {
|
|
2565
|
+
if (R.has(e))
|
|
2566
|
+
return R.get(e);
|
|
2567
|
+
const t = new Xe();
|
|
2568
|
+
return e._tiptapEditor.on("transaction", ({ transaction: n }) => {
|
|
2569
|
+
t.appendMapping(n.mapping);
|
|
2570
|
+
}), e._tiptapEditor.on("destroy", () => {
|
|
2571
|
+
R.delete(e);
|
|
2572
|
+
}), R.set(e, t), t;
|
|
2573
|
+
}
|
|
2574
|
+
function In(e, t, n = "left") {
|
|
2575
|
+
const o = ae.getState(e.prosemirrorState);
|
|
2576
|
+
if (!o) {
|
|
2577
|
+
const a = Hn(e), s = a.maps.length;
|
|
2578
|
+
return () => a.slice(s).map(t, n === "left" ? -1 : 1);
|
|
2579
|
+
}
|
|
2580
|
+
const r = Ke(
|
|
2581
|
+
// Track the position after the position if we are on the right side
|
|
2582
|
+
t + (n === "right" ? 1 : -1),
|
|
2583
|
+
o.binding.type,
|
|
2584
|
+
o.binding.mapping
|
|
2585
|
+
);
|
|
2586
|
+
return () => {
|
|
2587
|
+
const a = ae.getState(
|
|
2588
|
+
e.prosemirrorState
|
|
2589
|
+
), s = Qe(
|
|
2590
|
+
a.doc,
|
|
2591
|
+
a.binding.type,
|
|
2592
|
+
r,
|
|
2593
|
+
a.binding.mapping
|
|
2594
|
+
);
|
|
2595
|
+
if (s === null)
|
|
2596
|
+
throw new Error("Position not found, cannot track positions");
|
|
2597
|
+
return s + (n === "right" ? -1 : 1);
|
|
2598
|
+
};
|
|
2599
|
+
}
|
|
2600
|
+
const Dn = je((e) => e.type.name === "blockContainer");
|
|
2601
|
+
class On {
|
|
2602
|
+
constructor(t, n, o) {
|
|
2603
|
+
L(this, "state");
|
|
2604
|
+
L(this, "emitUpdate");
|
|
2605
|
+
L(this, "rootEl");
|
|
2606
|
+
L(this, "pluginState");
|
|
2607
|
+
L(this, "handleScroll", () => {
|
|
2608
|
+
var t, n;
|
|
2609
|
+
if ((t = this.state) != null && t.show) {
|
|
2610
|
+
const o = (n = this.rootEl) == null ? void 0 : n.querySelector(
|
|
2611
|
+
`[data-decoration-id="${this.pluginState.decorationId}"]`
|
|
2612
|
+
);
|
|
2613
|
+
if (!o)
|
|
2614
|
+
return;
|
|
2615
|
+
this.state.referencePos = o.getBoundingClientRect().toJSON(), this.emitUpdate(this.pluginState.triggerCharacter);
|
|
2616
|
+
}
|
|
2617
|
+
});
|
|
2618
|
+
L(this, "closeMenu", () => {
|
|
2619
|
+
this.editor.transact((t) => t.setMeta(B, null));
|
|
2620
|
+
});
|
|
2621
|
+
L(this, "clearQuery", () => {
|
|
2622
|
+
this.pluginState !== void 0 && this.editor._tiptapEditor.chain().focus().deleteRange({
|
|
2623
|
+
from: this.pluginState.queryStartPos() - (this.pluginState.deleteTriggerCharacter ? this.pluginState.triggerCharacter.length : 0),
|
|
2624
|
+
to: this.editor.transact((t) => t.selection.from)
|
|
2625
|
+
}).run();
|
|
2626
|
+
});
|
|
2627
|
+
var r;
|
|
2628
|
+
this.editor = t, this.pluginState = void 0, this.emitUpdate = (a) => {
|
|
2629
|
+
var s;
|
|
2630
|
+
if (!this.state)
|
|
2631
|
+
throw new Error("Attempting to update uninitialized suggestions menu");
|
|
2632
|
+
n(a, {
|
|
2633
|
+
...this.state,
|
|
2634
|
+
ignoreQueryLength: (s = this.pluginState) == null ? void 0 : s.ignoreQueryLength
|
|
2635
|
+
});
|
|
2636
|
+
}, this.rootEl = o.root, (r = this.rootEl) == null || r.addEventListener("scroll", this.handleScroll, !0);
|
|
2637
|
+
}
|
|
2638
|
+
update(t, n) {
|
|
2639
|
+
var l;
|
|
2640
|
+
const o = B.getState(n), r = B.getState(
|
|
2641
|
+
t.state
|
|
2642
|
+
), a = o === void 0 && r !== void 0, s = o !== void 0 && r === void 0;
|
|
2643
|
+
if (!a && !(o !== void 0 && r !== void 0) && !s)
|
|
2644
|
+
return;
|
|
2645
|
+
if (this.pluginState = s ? o : r, s || !this.editor.isEditable) {
|
|
2646
|
+
this.state && (this.state.show = !1), this.emitUpdate(this.pluginState.triggerCharacter);
|
|
2647
|
+
return;
|
|
2648
|
+
}
|
|
2649
|
+
const c = (l = this.rootEl) == null ? void 0 : l.querySelector(
|
|
2650
|
+
`[data-decoration-id="${this.pluginState.decorationId}"]`
|
|
2651
|
+
);
|
|
2652
|
+
this.editor.isEditable && c && (this.state = {
|
|
2653
|
+
show: !0,
|
|
2654
|
+
referencePos: c.getBoundingClientRect().toJSON(),
|
|
2655
|
+
query: this.pluginState.query
|
|
2656
|
+
}, this.emitUpdate(this.pluginState.triggerCharacter));
|
|
2657
|
+
}
|
|
2658
|
+
destroy() {
|
|
2659
|
+
var t;
|
|
2660
|
+
(t = this.rootEl) == null || t.removeEventListener("scroll", this.handleScroll, !0);
|
|
2661
|
+
}
|
|
2815
2662
|
}
|
|
2816
|
-
|
|
2663
|
+
const B = new Ze("SuggestionMenuPlugin"), _n = k(({ editor: e }) => {
|
|
2664
|
+
const t = [];
|
|
2665
|
+
let n;
|
|
2666
|
+
const o = ye(void 0);
|
|
2667
|
+
return {
|
|
2668
|
+
key: "suggestionMenu",
|
|
2669
|
+
store: o,
|
|
2670
|
+
addTriggerCharacter: (r) => {
|
|
2671
|
+
t.push(r);
|
|
2672
|
+
},
|
|
2673
|
+
removeTriggerCharacter: (r) => {
|
|
2674
|
+
t.splice(t.indexOf(r), 1);
|
|
2675
|
+
},
|
|
2676
|
+
closeMenu: () => {
|
|
2677
|
+
n == null || n.closeMenu();
|
|
2678
|
+
},
|
|
2679
|
+
clearQuery: () => {
|
|
2680
|
+
n == null || n.clearQuery();
|
|
2681
|
+
},
|
|
2682
|
+
shown: () => {
|
|
2683
|
+
var r;
|
|
2684
|
+
return ((r = n == null ? void 0 : n.state) == null ? void 0 : r.show) || !1;
|
|
2685
|
+
},
|
|
2686
|
+
openSuggestionMenu: (r, a) => {
|
|
2687
|
+
e.headless || (e.focus(), e.transact((s) => {
|
|
2688
|
+
a != null && a.deleteTriggerCharacter && s.insertText(r), s.scrollIntoView().setMeta(B, {
|
|
2689
|
+
triggerCharacter: r,
|
|
2690
|
+
deleteTriggerCharacter: (a == null ? void 0 : a.deleteTriggerCharacter) || !1,
|
|
2691
|
+
ignoreQueryLength: (a == null ? void 0 : a.ignoreQueryLength) || !1
|
|
2692
|
+
});
|
|
2693
|
+
}));
|
|
2694
|
+
},
|
|
2695
|
+
// TODO this whole plugin needs to be refactored (but I've done the minimal)
|
|
2696
|
+
prosemirrorPlugins: [
|
|
2697
|
+
new Ge({
|
|
2698
|
+
key: B,
|
|
2699
|
+
view: (r) => (n = new On(
|
|
2700
|
+
e,
|
|
2701
|
+
(a, s) => {
|
|
2702
|
+
o.setState({ ...s, triggerCharacter: a });
|
|
2703
|
+
},
|
|
2704
|
+
r
|
|
2705
|
+
), n),
|
|
2706
|
+
state: {
|
|
2707
|
+
// Initialize the plugin's internal state.
|
|
2708
|
+
init() {
|
|
2709
|
+
},
|
|
2710
|
+
// Apply changes to the plugin state from an editor transaction.
|
|
2711
|
+
apply: (r, a, s, i) => {
|
|
2712
|
+
if (r.selection.$from.parent.type.spec.code)
|
|
2713
|
+
return a;
|
|
2714
|
+
const c = r.getMeta(B);
|
|
2715
|
+
if (typeof c == "object" && c !== null) {
|
|
2716
|
+
a && (n == null || n.closeMenu());
|
|
2717
|
+
const u = In(
|
|
2718
|
+
e,
|
|
2719
|
+
i.selection.from - // Need to account for the trigger char that was inserted, so we offset the position by the length of the trigger character.
|
|
2720
|
+
c.triggerCharacter.length
|
|
2721
|
+
);
|
|
2722
|
+
return {
|
|
2723
|
+
triggerCharacter: c.triggerCharacter,
|
|
2724
|
+
deleteTriggerCharacter: c.deleteTriggerCharacter !== !1,
|
|
2725
|
+
// When reading the queryStartPos, we offset the result by the length of the trigger character, to make it easy on the caller
|
|
2726
|
+
queryStartPos: () => u() + c.triggerCharacter.length,
|
|
2727
|
+
query: "",
|
|
2728
|
+
decorationId: `id_${Math.floor(Math.random() * 4294967295)}`,
|
|
2729
|
+
ignoreQueryLength: c == null ? void 0 : c.ignoreQueryLength
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2732
|
+
if (a === void 0)
|
|
2733
|
+
return a;
|
|
2734
|
+
if (
|
|
2735
|
+
// Highlighting text should hide the menu.
|
|
2736
|
+
i.selection.from !== i.selection.to || // Transactions with plugin metadata should hide the menu.
|
|
2737
|
+
c === null || // Certain mouse events should hide the menu.
|
|
2738
|
+
// TODO: Change to global mousedown listener.
|
|
2739
|
+
r.getMeta("focus") || r.getMeta("blur") || r.getMeta("pointer") || // Moving the caret before the character which triggered the menu should hide it.
|
|
2740
|
+
a.triggerCharacter !== void 0 && i.selection.from < a.queryStartPos() || // Moving the caret to a new block should hide the menu.
|
|
2741
|
+
!i.selection.$from.sameParent(
|
|
2742
|
+
i.doc.resolve(a.queryStartPos())
|
|
2743
|
+
)
|
|
2744
|
+
)
|
|
2745
|
+
return;
|
|
2746
|
+
const l = { ...a };
|
|
2747
|
+
return l.query = i.doc.textBetween(
|
|
2748
|
+
a.queryStartPos(),
|
|
2749
|
+
i.selection.from
|
|
2750
|
+
), l;
|
|
2751
|
+
}
|
|
2752
|
+
},
|
|
2753
|
+
props: {
|
|
2754
|
+
handleTextInput(r, a, s, i) {
|
|
2755
|
+
if (a === s) {
|
|
2756
|
+
const c = r.state.doc;
|
|
2757
|
+
for (const l of t) {
|
|
2758
|
+
const u = l.length > 1 ? c.textBetween(a - l.length, a) + i : i;
|
|
2759
|
+
if (l === u)
|
|
2760
|
+
return r.dispatch(r.state.tr.insertText(i)), r.dispatch(
|
|
2761
|
+
r.state.tr.setMeta(B, {
|
|
2762
|
+
triggerCharacter: u
|
|
2763
|
+
}).scrollIntoView()
|
|
2764
|
+
), !0;
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
return !1;
|
|
2768
|
+
},
|
|
2769
|
+
// Setup decorator on the currently active suggestion.
|
|
2770
|
+
decorations(r) {
|
|
2771
|
+
const a = this.getState(r);
|
|
2772
|
+
if (a === void 0)
|
|
2773
|
+
return null;
|
|
2774
|
+
if (!a.deleteTriggerCharacter) {
|
|
2775
|
+
const s = Dn(r.selection);
|
|
2776
|
+
if (s)
|
|
2777
|
+
return oe.create(r.doc, [
|
|
2778
|
+
re.node(
|
|
2779
|
+
s.pos,
|
|
2780
|
+
s.pos + s.node.nodeSize,
|
|
2781
|
+
{
|
|
2782
|
+
nodeName: "span",
|
|
2783
|
+
class: "bn-suggestion-decorator",
|
|
2784
|
+
"data-decoration-id": a.decorationId
|
|
2785
|
+
}
|
|
2786
|
+
)
|
|
2787
|
+
]);
|
|
2788
|
+
}
|
|
2789
|
+
return oe.create(r.doc, [
|
|
2790
|
+
re.inline(
|
|
2791
|
+
a.queryStartPos() - a.triggerCharacter.length,
|
|
2792
|
+
a.queryStartPos(),
|
|
2793
|
+
{
|
|
2794
|
+
nodeName: "span",
|
|
2795
|
+
class: "bn-suggestion-decorator",
|
|
2796
|
+
"data-decoration-id": a.decorationId
|
|
2797
|
+
}
|
|
2798
|
+
)
|
|
2799
|
+
]);
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
})
|
|
2803
|
+
]
|
|
2804
|
+
};
|
|
2805
|
+
});
|
|
2806
|
+
function Vn(e) {
|
|
2817
2807
|
let t = e.getTextCursorPosition().block, n = e.schema.blockSchema[t.type].content;
|
|
2818
2808
|
for (; n === "none"; ) {
|
|
2819
2809
|
if (t = e.getTextCursorPosition().nextBlock, t === void 0)
|
|
@@ -2826,11 +2816,11 @@ function b(e, t) {
|
|
|
2826
2816
|
if (n.content === void 0)
|
|
2827
2817
|
throw new Error("Slash Menu open in a block that doesn't contain content.");
|
|
2828
2818
|
let o;
|
|
2829
|
-
return Array.isArray(n.content) && (n.content.length === 1 &&
|
|
2819
|
+
return Array.isArray(n.content) && (n.content.length === 1 && ot(n.content[0]) && n.content[0].type === "text" && n.content[0].text === "/" || n.content.length === 0) ? (o = e.updateBlock(n, t), e.setTextCursorPosition(o)) : (o = e.insertBlocks([t], n, "after")[0], e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)), Vn(e), o;
|
|
2830
2820
|
}
|
|
2831
|
-
function
|
|
2821
|
+
function Bo(e) {
|
|
2832
2822
|
const t = [];
|
|
2833
|
-
return
|
|
2823
|
+
return C(e, "heading", { level: "number" }) && t.push(
|
|
2834
2824
|
{
|
|
2835
2825
|
onItemClick: () => {
|
|
2836
2826
|
b(e, {
|
|
@@ -2864,7 +2854,7 @@ function yo(e) {
|
|
|
2864
2854
|
key: "heading_3",
|
|
2865
2855
|
...e.dictionary.slash_menu.heading_3
|
|
2866
2856
|
}
|
|
2867
|
-
),
|
|
2857
|
+
), C(e, "quote") && t.push({
|
|
2868
2858
|
onItemClick: () => {
|
|
2869
2859
|
b(e, {
|
|
2870
2860
|
type: "quote"
|
|
@@ -2872,7 +2862,7 @@ function yo(e) {
|
|
|
2872
2862
|
},
|
|
2873
2863
|
key: "quote",
|
|
2874
2864
|
...e.dictionary.slash_menu.quote
|
|
2875
|
-
}),
|
|
2865
|
+
}), C(e, "toggleListItem") && t.push({
|
|
2876
2866
|
onItemClick: () => {
|
|
2877
2867
|
b(e, {
|
|
2878
2868
|
type: "toggleListItem"
|
|
@@ -2881,7 +2871,7 @@ function yo(e) {
|
|
|
2881
2871
|
badge: M("Mod-Shift-6"),
|
|
2882
2872
|
key: "toggle_list",
|
|
2883
2873
|
...e.dictionary.slash_menu.toggle_list
|
|
2884
|
-
}),
|
|
2874
|
+
}), C(e, "numberedListItem") && t.push({
|
|
2885
2875
|
onItemClick: () => {
|
|
2886
2876
|
b(e, {
|
|
2887
2877
|
type: "numberedListItem"
|
|
@@ -2890,7 +2880,7 @@ function yo(e) {
|
|
|
2890
2880
|
badge: M("Mod-Shift-7"),
|
|
2891
2881
|
key: "numbered_list",
|
|
2892
2882
|
...e.dictionary.slash_menu.numbered_list
|
|
2893
|
-
}),
|
|
2883
|
+
}), C(e, "bulletListItem") && t.push({
|
|
2894
2884
|
onItemClick: () => {
|
|
2895
2885
|
b(e, {
|
|
2896
2886
|
type: "bulletListItem"
|
|
@@ -2899,7 +2889,7 @@ function yo(e) {
|
|
|
2899
2889
|
badge: M("Mod-Shift-8"),
|
|
2900
2890
|
key: "bullet_list",
|
|
2901
2891
|
...e.dictionary.slash_menu.bullet_list
|
|
2902
|
-
}),
|
|
2892
|
+
}), C(e, "checkListItem") && t.push({
|
|
2903
2893
|
onItemClick: () => {
|
|
2904
2894
|
b(e, {
|
|
2905
2895
|
type: "checkListItem"
|
|
@@ -2908,7 +2898,7 @@ function yo(e) {
|
|
|
2908
2898
|
badge: M("Mod-Shift-9"),
|
|
2909
2899
|
key: "check_list",
|
|
2910
2900
|
...e.dictionary.slash_menu.check_list
|
|
2911
|
-
}),
|
|
2901
|
+
}), C(e, "paragraph") && t.push({
|
|
2912
2902
|
onItemClick: () => {
|
|
2913
2903
|
b(e, {
|
|
2914
2904
|
type: "paragraph"
|
|
@@ -2917,7 +2907,7 @@ function yo(e) {
|
|
|
2917
2907
|
badge: M("Mod-Alt-0"),
|
|
2918
2908
|
key: "paragraph",
|
|
2919
2909
|
...e.dictionary.slash_menu.paragraph
|
|
2920
|
-
}),
|
|
2910
|
+
}), C(e, "codeBlock") && t.push({
|
|
2921
2911
|
onItemClick: () => {
|
|
2922
2912
|
b(e, {
|
|
2923
2913
|
type: "codeBlock"
|
|
@@ -2926,13 +2916,13 @@ function yo(e) {
|
|
|
2926
2916
|
badge: M("Mod-Alt-c"),
|
|
2927
2917
|
key: "code_block",
|
|
2928
2918
|
...e.dictionary.slash_menu.code_block
|
|
2929
|
-
}),
|
|
2919
|
+
}), C(e, "divider") && t.push({
|
|
2930
2920
|
onItemClick: () => {
|
|
2931
2921
|
b(e, { type: "divider" });
|
|
2932
2922
|
},
|
|
2933
2923
|
key: "divider",
|
|
2934
2924
|
...e.dictionary.slash_menu.divider
|
|
2935
|
-
}),
|
|
2925
|
+
}), C(e, "table") && t.push({
|
|
2936
2926
|
onItemClick: () => {
|
|
2937
2927
|
b(e, {
|
|
2938
2928
|
type: "table",
|
|
@@ -2952,59 +2942,47 @@ function yo(e) {
|
|
|
2952
2942
|
badge: void 0,
|
|
2953
2943
|
key: "table",
|
|
2954
2944
|
...e.dictionary.slash_menu.table
|
|
2955
|
-
}),
|
|
2945
|
+
}), C(e, "image", { url: "string" }) && t.push({
|
|
2956
2946
|
onItemClick: () => {
|
|
2947
|
+
var o;
|
|
2957
2948
|
const n = b(e, {
|
|
2958
2949
|
type: "image"
|
|
2959
2950
|
});
|
|
2960
|
-
e.
|
|
2961
|
-
(o) => o.setMeta(e.filePanel.plugins[0], {
|
|
2962
|
-
block: n
|
|
2963
|
-
})
|
|
2964
|
-
);
|
|
2951
|
+
(o = e.getExtension(I)) == null || o.showMenu(n.id);
|
|
2965
2952
|
},
|
|
2966
2953
|
key: "image",
|
|
2967
2954
|
...e.dictionary.slash_menu.image
|
|
2968
|
-
}),
|
|
2955
|
+
}), C(e, "video", { url: "string" }) && t.push({
|
|
2969
2956
|
onItemClick: () => {
|
|
2957
|
+
var o;
|
|
2970
2958
|
const n = b(e, {
|
|
2971
2959
|
type: "video"
|
|
2972
2960
|
});
|
|
2973
|
-
e.
|
|
2974
|
-
(o) => o.setMeta(e.filePanel.plugins[0], {
|
|
2975
|
-
block: n
|
|
2976
|
-
})
|
|
2977
|
-
);
|
|
2961
|
+
(o = e.getExtension(I)) == null || o.showMenu(n.id);
|
|
2978
2962
|
},
|
|
2979
2963
|
key: "video",
|
|
2980
2964
|
...e.dictionary.slash_menu.video
|
|
2981
|
-
}),
|
|
2965
|
+
}), C(e, "audio", { url: "string" }) && t.push({
|
|
2982
2966
|
onItemClick: () => {
|
|
2967
|
+
var o;
|
|
2983
2968
|
const n = b(e, {
|
|
2984
2969
|
type: "audio"
|
|
2985
2970
|
});
|
|
2986
|
-
e.
|
|
2987
|
-
(o) => o.setMeta(e.filePanel.plugins[0], {
|
|
2988
|
-
block: n
|
|
2989
|
-
})
|
|
2990
|
-
);
|
|
2971
|
+
(o = e.getExtension(I)) == null || o.showMenu(n.id);
|
|
2991
2972
|
},
|
|
2992
2973
|
key: "audio",
|
|
2993
2974
|
...e.dictionary.slash_menu.audio
|
|
2994
|
-
}),
|
|
2975
|
+
}), C(e, "file", { url: "string" }) && t.push({
|
|
2995
2976
|
onItemClick: () => {
|
|
2977
|
+
var o;
|
|
2996
2978
|
const n = b(e, {
|
|
2997
2979
|
type: "file"
|
|
2998
2980
|
});
|
|
2999
|
-
e.
|
|
3000
|
-
(o) => o.setMeta(e.filePanel.plugins[0], {
|
|
3001
|
-
block: n
|
|
3002
|
-
})
|
|
3003
|
-
);
|
|
2981
|
+
(o = e.getExtension(I)) == null || o.showMenu(n.id);
|
|
3004
2982
|
},
|
|
3005
2983
|
key: "file",
|
|
3006
2984
|
...e.dictionary.slash_menu.file
|
|
3007
|
-
}),
|
|
2985
|
+
}), C(e, "heading", {
|
|
3008
2986
|
level: "number",
|
|
3009
2987
|
isToggleable: "boolean"
|
|
3010
2988
|
}) && t.push(
|
|
@@ -3038,7 +3016,7 @@ function yo(e) {
|
|
|
3038
3016
|
key: "toggle_heading_3",
|
|
3039
3017
|
...e.dictionary.slash_menu.toggle_heading_3
|
|
3040
3018
|
}
|
|
3041
|
-
),
|
|
3019
|
+
), C(e, "heading", { level: "number" }) && (e.schema.blockSchema.heading.propSchema.level.values || []).filter((n) => n > 3).forEach((n) => {
|
|
3042
3020
|
t.push({
|
|
3043
3021
|
onItemClick: () => {
|
|
3044
3022
|
b(e, {
|
|
@@ -3051,7 +3029,8 @@ function yo(e) {
|
|
|
3051
3029
|
});
|
|
3052
3030
|
}), t.push({
|
|
3053
3031
|
onItemClick: () => {
|
|
3054
|
-
|
|
3032
|
+
var n;
|
|
3033
|
+
(n = e.getExtension(_n)) == null || n.openSuggestionMenu(":", {
|
|
3055
3034
|
deleteTriggerCharacter: !0,
|
|
3056
3035
|
ignoreQueryLength: !0
|
|
3057
3036
|
});
|
|
@@ -3060,44 +3039,29 @@ function yo(e) {
|
|
|
3060
3039
|
...e.dictionary.slash_menu.emoji
|
|
3061
3040
|
}), t;
|
|
3062
3041
|
}
|
|
3063
|
-
function
|
|
3042
|
+
function Ao(e, t) {
|
|
3064
3043
|
return e.filter(
|
|
3065
3044
|
({ title: n, aliases: o }) => n.toLowerCase().includes(t.toLowerCase()) || o && o.filter(
|
|
3066
3045
|
(r) => r.toLowerCase().includes(t.toLowerCase())
|
|
3067
3046
|
).length !== 0
|
|
3068
3047
|
);
|
|
3069
3048
|
}
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
return Pn(e) && t.push({
|
|
3076
|
-
...e.dictionary.slash_menu.page_break,
|
|
3077
|
-
onItemClick: () => {
|
|
3078
|
-
b(e, {
|
|
3079
|
-
type: "pageBreak"
|
|
3080
|
-
});
|
|
3081
|
-
},
|
|
3082
|
-
key: "page_break"
|
|
3083
|
-
}), t;
|
|
3084
|
-
}
|
|
3085
|
-
const On = {
|
|
3086
|
-
audio: Vt(),
|
|
3087
|
-
bulletListItem: an(),
|
|
3088
|
-
checkListItem: cn(),
|
|
3089
|
-
codeBlock: Ut(),
|
|
3049
|
+
const Po = {
|
|
3050
|
+
audio: Ft(),
|
|
3051
|
+
bulletListItem: cn(),
|
|
3052
|
+
checkListItem: dn(),
|
|
3053
|
+
codeBlock: qt(),
|
|
3090
3054
|
divider: Gt(),
|
|
3091
|
-
file:
|
|
3092
|
-
heading:
|
|
3093
|
-
image:
|
|
3094
|
-
numberedListItem:
|
|
3055
|
+
file: Xt(),
|
|
3056
|
+
heading: Yt(),
|
|
3057
|
+
image: an(),
|
|
3058
|
+
numberedListItem: fn(),
|
|
3095
3059
|
paragraph: bn(),
|
|
3096
|
-
quote:
|
|
3097
|
-
table:
|
|
3098
|
-
toggleListItem:
|
|
3099
|
-
video:
|
|
3100
|
-
},
|
|
3060
|
+
quote: kn(),
|
|
3061
|
+
table: Tn(),
|
|
3062
|
+
toggleListItem: hn(),
|
|
3063
|
+
video: Nn()
|
|
3064
|
+
}, Rn = Le(
|
|
3101
3065
|
{
|
|
3102
3066
|
type: "textColor",
|
|
3103
3067
|
propSchema: "string"
|
|
@@ -3112,7 +3076,7 @@ const On = {
|
|
|
3112
3076
|
},
|
|
3113
3077
|
toExternalHTML: (e) => {
|
|
3114
3078
|
const t = document.createElement("span");
|
|
3115
|
-
return e !==
|
|
3079
|
+
return e !== g.textColor.default && (t.style.color = e in T ? T[e].text : e), {
|
|
3116
3080
|
dom: t,
|
|
3117
3081
|
contentDOM: t
|
|
3118
3082
|
};
|
|
@@ -3122,7 +3086,7 @@ const On = {
|
|
|
3122
3086
|
return e.style.color;
|
|
3123
3087
|
}
|
|
3124
3088
|
}
|
|
3125
|
-
),
|
|
3089
|
+
), Wn = Le(
|
|
3126
3090
|
{
|
|
3127
3091
|
type: "backgroundColor",
|
|
3128
3092
|
propSchema: "string"
|
|
@@ -3137,7 +3101,7 @@ const On = {
|
|
|
3137
3101
|
},
|
|
3138
3102
|
toExternalHTML: (e) => {
|
|
3139
3103
|
const t = document.createElement("span");
|
|
3140
|
-
return e !==
|
|
3104
|
+
return e !== g.backgroundColor.default && (t.style.backgroundColor = e in T ? T[e].background : e), {
|
|
3141
3105
|
dom: t,
|
|
3142
3106
|
contentDOM: t
|
|
3143
3107
|
};
|
|
@@ -3147,142 +3111,125 @@ const On = {
|
|
|
3147
3111
|
return e.style.backgroundColor;
|
|
3148
3112
|
}
|
|
3149
3113
|
}
|
|
3150
|
-
),
|
|
3151
|
-
bold: H(
|
|
3152
|
-
italic: H(
|
|
3153
|
-
underline: H(
|
|
3154
|
-
strike: H(
|
|
3155
|
-
code: H(
|
|
3156
|
-
textColor:
|
|
3157
|
-
backgroundColor:
|
|
3158
|
-
},
|
|
3114
|
+
), Fn = {
|
|
3115
|
+
bold: H(rt, "boolean"),
|
|
3116
|
+
italic: H(st, "boolean"),
|
|
3117
|
+
underline: H(ct, "boolean"),
|
|
3118
|
+
strike: H(it, "boolean"),
|
|
3119
|
+
code: H(at, "boolean"),
|
|
3120
|
+
textColor: Rn,
|
|
3121
|
+
backgroundColor: Wn
|
|
3122
|
+
}, No = Mt(Fn), $n = {
|
|
3159
3123
|
text: { config: "text", implementation: {} },
|
|
3160
3124
|
link: { config: "link", implementation: {} }
|
|
3161
|
-
},
|
|
3162
|
-
|
|
3125
|
+
}, Ho = wt(
|
|
3126
|
+
$n
|
|
3163
3127
|
);
|
|
3164
|
-
class Pe extends wt {
|
|
3165
|
-
static create(t) {
|
|
3166
|
-
return new Pe({
|
|
3167
|
-
blockSpecs: (t == null ? void 0 : t.blockSpecs) ?? On,
|
|
3168
|
-
inlineContentSpecs: (t == null ? void 0 : t.inlineContentSpecs) ?? Ie,
|
|
3169
|
-
styleSpecs: (t == null ? void 0 : t.styleSpecs) ?? He
|
|
3170
|
-
});
|
|
3171
|
-
}
|
|
3172
|
-
}
|
|
3173
3128
|
export {
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3129
|
+
C as $,
|
|
3130
|
+
dn as A,
|
|
3131
|
+
pn as B,
|
|
3132
|
+
fn as C,
|
|
3133
|
+
gn as D,
|
|
3134
|
+
Mo as E,
|
|
3135
|
+
Ot as F,
|
|
3136
|
+
hn as G,
|
|
3182
3137
|
mn as H,
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
Pt as c,
|
|
3264
|
-
Dt as d,
|
|
3265
|
-
_t as e,
|
|
3266
|
-
Vt as f,
|
|
3267
|
-
jt as g,
|
|
3268
|
-
Ut as h,
|
|
3269
|
-
we as i,
|
|
3270
|
-
$t as j,
|
|
3138
|
+
bn as I,
|
|
3139
|
+
Cn as J,
|
|
3140
|
+
kn as K,
|
|
3141
|
+
En as L,
|
|
3142
|
+
Tn as M,
|
|
3143
|
+
Bn as N,
|
|
3144
|
+
An as O,
|
|
3145
|
+
Pn as P,
|
|
3146
|
+
Nn as Q,
|
|
3147
|
+
Kt as R,
|
|
3148
|
+
Be as S,
|
|
3149
|
+
mt as T,
|
|
3150
|
+
le as U,
|
|
3151
|
+
bt as V,
|
|
3152
|
+
Po as W,
|
|
3153
|
+
Fn as X,
|
|
3154
|
+
No as Y,
|
|
3155
|
+
$n as Z,
|
|
3156
|
+
Ho as _,
|
|
3157
|
+
Ie as a,
|
|
3158
|
+
Lo as a0,
|
|
3159
|
+
To as a1,
|
|
3160
|
+
g as a2,
|
|
3161
|
+
y as a3,
|
|
3162
|
+
A as a4,
|
|
3163
|
+
Eo as a5,
|
|
3164
|
+
xo as a6,
|
|
3165
|
+
wo as a7,
|
|
3166
|
+
I as a8,
|
|
3167
|
+
_n as a9,
|
|
3168
|
+
Z as aA,
|
|
3169
|
+
yt as aB,
|
|
3170
|
+
xt as aC,
|
|
3171
|
+
Lt as aD,
|
|
3172
|
+
Le as aE,
|
|
3173
|
+
St as aF,
|
|
3174
|
+
V as aG,
|
|
3175
|
+
Me as aH,
|
|
3176
|
+
H as aI,
|
|
3177
|
+
ht as aJ,
|
|
3178
|
+
M as aK,
|
|
3179
|
+
uo as aL,
|
|
3180
|
+
W as aM,
|
|
3181
|
+
po as aN,
|
|
3182
|
+
In as aO,
|
|
3183
|
+
b as aa,
|
|
3184
|
+
Bo as ab,
|
|
3185
|
+
Ao as ac,
|
|
3186
|
+
go as ad,
|
|
3187
|
+
Mt as ae,
|
|
3188
|
+
wt as af,
|
|
3189
|
+
ho as ag,
|
|
3190
|
+
v as ah,
|
|
3191
|
+
Bt as ai,
|
|
3192
|
+
Tt as aj,
|
|
3193
|
+
mo as ak,
|
|
3194
|
+
bo as al,
|
|
3195
|
+
Ct as am,
|
|
3196
|
+
Co as an,
|
|
3197
|
+
yo as ao,
|
|
3198
|
+
fo as ap,
|
|
3199
|
+
So as aq,
|
|
3200
|
+
ko as ar,
|
|
3201
|
+
D as as,
|
|
3202
|
+
K as at,
|
|
3203
|
+
Pt as au,
|
|
3204
|
+
T as av,
|
|
3205
|
+
vo as aw,
|
|
3206
|
+
vt as ax,
|
|
3207
|
+
Et as ay,
|
|
3208
|
+
kt as az,
|
|
3209
|
+
Vt as b,
|
|
3210
|
+
_t as c,
|
|
3211
|
+
Rt as d,
|
|
3212
|
+
Wt as e,
|
|
3213
|
+
Ft as f,
|
|
3214
|
+
Ut as g,
|
|
3215
|
+
qt as h,
|
|
3216
|
+
Te as i,
|
|
3217
|
+
jt as j,
|
|
3271
3218
|
Gt as k,
|
|
3272
3219
|
Zt as l,
|
|
3273
3220
|
zt as m,
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3221
|
+
Xt as n,
|
|
3222
|
+
Jt as o,
|
|
3223
|
+
ue as p,
|
|
3224
|
+
Yt as q,
|
|
3225
|
+
en as r,
|
|
3226
|
+
tn as s,
|
|
3227
|
+
nn as t,
|
|
3228
|
+
on as u,
|
|
3229
|
+
rn as v,
|
|
3230
|
+
an as w,
|
|
3231
|
+
sn as x,
|
|
3232
|
+
cn as y,
|
|
3233
|
+
ln as z
|
|
3287
3234
|
};
|
|
3288
|
-
//# sourceMappingURL=
|
|
3235
|
+
//# sourceMappingURL=defaultBlocks-DgA_mtQV.js.map
|