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