@blocknote/core 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.cjs +1 -1
- package/dist/blocknote.js +4 -4
- package/dist/{blocks-UU7EM-QM.js → blocks-D0lMxErU.js} +397 -368
- package/dist/blocks-D0lMxErU.js.map +1 -0
- package/dist/blocks-KyMOxPT3.cjs +11 -0
- package/dist/blocks-KyMOxPT3.cjs.map +1 -0
- package/dist/blocks.cjs +1 -1
- package/dist/blocks.js +2 -2
- package/dist/{extensions-CkLT--Nc.js → extensions-CQFfm5f5.js} +619 -353
- package/dist/extensions-CQFfm5f5.js.map +1 -0
- package/dist/extensions-Cuw3zOdC.cjs +52 -0
- package/dist/extensions-Cuw3zOdC.cjs.map +1 -0
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.js +3 -3
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +1 -1
- package/dist/locales.js.map +1 -1
- package/dist/{src-SVFpMAWE.js → src-DK_8q1j5.js} +1070 -564
- package/dist/src-DK_8q1j5.js.map +1 -0
- package/dist/src-_83jmA7A.cjs +21 -0
- package/dist/src-_83jmA7A.cjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/dist/yjs.cjs +1 -1
- package/dist/yjs.js +8 -8
- package/package.json +1 -13
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +7 -7
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -3
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +5 -5
- package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +2550 -291
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +83 -2
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +103 -42
- package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -143
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +12 -12
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +5 -3
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +6 -6
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +22 -22
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +12 -8
- package/src/api/blockManipulation/setupTestEnv.ts +1 -1
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +2 -6
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +7 -2
- package/src/api/exporters/markdown/htmlToMarkdown.ts +813 -0
- package/src/api/exporters/markdown/markdownExporter.ts +2 -21
- package/src/api/nodeConversions/blockToNode.ts +3 -2
- package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +122 -107
- package/src/api/parsers/html/util/nestedLists.test.ts +1 -12
- package/src/api/parsers/markdown/markdownToHtml.ts +1194 -0
- package/src/api/parsers/markdown/parseMarkdown.ts +2 -101
- package/src/blocks/Audio/block.ts +1 -4
- package/src/blocks/Code/block.test.ts +258 -0
- package/src/blocks/File/block.ts +1 -4
- package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +7 -2
- package/src/blocks/Image/block.ts +9 -6
- package/src/blocks/ListItem/BulletListItem/block.ts +7 -4
- package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +3 -4
- package/src/blocks/Video/block.ts +4 -5
- package/src/blocks/Video/parseVideoElement.ts +2 -1
- package/src/editor/Block.css +8 -0
- package/src/editor/BlockNoteEditor.test.ts +10 -4
- package/src/editor/BlockNoteEditor.ts +30 -13
- package/src/editor/managers/BlockManager.ts +10 -6
- package/src/editor/managers/ExtensionManager/index.ts +80 -25
- package/src/editor/performance.test.ts +2 -2
- package/src/editor/transformPasted.test.ts +295 -0
- package/src/editor/transformPasted.ts +77 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +1 -12
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +0 -11
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -1
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -1
- package/src/extensions/SideMenu/dragging.ts +7 -10
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +21 -0
- package/src/extensions/TrailingNode/TrailingNode.ts +124 -65
- package/src/i18n/locales/fr.ts +1 -1
- package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.d.ts +13 -2
- package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +1 -1
- package/types/src/api/exporters/markdown/htmlToMarkdown.d.ts +11 -0
- package/types/src/api/parsers/markdown/markdownToHtml.d.ts +5 -0
- package/types/src/blocks/Code/block.test.d.ts +1 -0
- package/types/src/blocks/Video/block.d.ts +2 -0
- package/types/src/blocks/Video/parseVideoElement.d.ts +1 -0
- package/types/src/editor/BlockNoteEditor.d.ts +20 -6
- package/types/src/editor/managers/BlockManager.d.ts +8 -4
- package/types/src/editor/transformPasted.test.d.ts +1 -0
- package/types/src/extensions/TrailingNode/TrailingNode.d.ts +8 -3
- package/dist/blocks-BFnTypT-.cjs +0 -11
- package/dist/blocks-BFnTypT-.cjs.map +0 -1
- package/dist/blocks-UU7EM-QM.js.map +0 -1
- package/dist/extensions-CYsFi5Is.cjs +0 -2
- package/dist/extensions-CYsFi5Is.cjs.map +0 -1
- package/dist/extensions-CkLT--Nc.js.map +0 -1
- package/dist/src-DsJ6yzs9.cjs +0 -5
- package/dist/src-DsJ6yzs9.cjs.map +0 -1
- package/dist/src-SVFpMAWE.js.map +0 -1
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +0 -42
- package/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts +0 -19
- package/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.ts +0 -39
- package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +0 -7
- package/types/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.d.ts +0 -2
- package/types/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.d.ts +0 -6
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "../../schema/index.js";
|
|
10
10
|
import { formatKeyboardShortcut } from "../../util/browser.js";
|
|
11
11
|
import { FilePanelExtension } from "../FilePanel/FilePanel.js";
|
|
12
|
+
import { FormattingToolbarExtension } from "../FormattingToolbar/FormattingToolbar.js";
|
|
12
13
|
import { DefaultSuggestionItem } from "./DefaultSuggestionItem.js";
|
|
13
14
|
import { SuggestionMenu } from "./SuggestionMenu.js";
|
|
14
15
|
|
|
@@ -242,6 +243,11 @@ export function getDefaultSlashMenuItems<
|
|
|
242
243
|
|
|
243
244
|
// Immediately open the file toolbar
|
|
244
245
|
editor.getExtension(FilePanelExtension)?.showMenu(insertedBlock.id);
|
|
246
|
+
// Immediately hide the formatting toolbar. This is only necessary for
|
|
247
|
+
// when the `trailingBlock` editor option is set to `false` and the
|
|
248
|
+
// inserted block is at the end of the document. Otherwise, the
|
|
249
|
+
// selection moves to the next block with inline content.
|
|
250
|
+
editor.getExtension(FormattingToolbarExtension)?.store.setState(false);
|
|
245
251
|
},
|
|
246
252
|
key: "image",
|
|
247
253
|
...editor.dictionary.slash_menu.image,
|
|
@@ -257,6 +263,11 @@ export function getDefaultSlashMenuItems<
|
|
|
257
263
|
|
|
258
264
|
// Immediately open the file toolbar
|
|
259
265
|
editor.getExtension(FilePanelExtension)?.showMenu(insertedBlock.id);
|
|
266
|
+
// Immediately hide the formatting toolbar. This is only necessary for
|
|
267
|
+
// when the `trailingBlock` editor option is set to `false` and the
|
|
268
|
+
// inserted block is at the end of the document. Otherwise, the
|
|
269
|
+
// selection moves to the next block with inline content.
|
|
270
|
+
editor.getExtension(FormattingToolbarExtension)?.store.setState(false);
|
|
260
271
|
},
|
|
261
272
|
key: "video",
|
|
262
273
|
...editor.dictionary.slash_menu.video,
|
|
@@ -272,6 +283,11 @@ export function getDefaultSlashMenuItems<
|
|
|
272
283
|
|
|
273
284
|
// Immediately open the file toolbar
|
|
274
285
|
editor.getExtension(FilePanelExtension)?.showMenu(insertedBlock.id);
|
|
286
|
+
// Immediately hide the formatting toolbar. This is only necessary for
|
|
287
|
+
// when the `trailingBlock` editor option is set to `false` and the
|
|
288
|
+
// inserted block is at the end of the document. Otherwise, the
|
|
289
|
+
// selection moves to the next block with inline content.
|
|
290
|
+
editor.getExtension(FormattingToolbarExtension)?.store.setState(false);
|
|
275
291
|
},
|
|
276
292
|
key: "audio",
|
|
277
293
|
...editor.dictionary.slash_menu.audio,
|
|
@@ -287,6 +303,11 @@ export function getDefaultSlashMenuItems<
|
|
|
287
303
|
|
|
288
304
|
// Immediately open the file toolbar
|
|
289
305
|
editor.getExtension(FilePanelExtension)?.showMenu(insertedBlock.id);
|
|
306
|
+
// Immediately hide the formatting toolbar. This is only necessary for
|
|
307
|
+
// when the `trailingBlock` editor option is set to `false` and the
|
|
308
|
+
// inserted block is at the end of the document. Otherwise, the
|
|
309
|
+
// selection moves to the next block with inline content.
|
|
310
|
+
editor.getExtension(FormattingToolbarExtension)?.store.setState(false);
|
|
290
311
|
},
|
|
291
312
|
key: "file",
|
|
292
313
|
...editor.dictionary.slash_menu.file,
|
|
@@ -1,76 +1,135 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Node as PMNode } from "prosemirror-model";
|
|
2
|
+
import { Plugin, PluginKey, type Transaction } from "prosemirror-state";
|
|
3
|
+
import { Decoration, DecorationSet } from "prosemirror-view";
|
|
4
|
+
import {
|
|
5
|
+
createExtension,
|
|
6
|
+
ExtensionOptions,
|
|
7
|
+
} from "../../editor/BlockNoteExtension.js";
|
|
3
8
|
|
|
4
|
-
|
|
9
|
+
const PLUGIN_KEY = new PluginKey<DecorationSet>("trailingNode");
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
// Skip the widget when the editor isn't editable, or when the document already
|
|
12
|
+
// ends with an empty paragraph block (since the user can just type into it).
|
|
13
|
+
function shouldShowTrailingWidget(doc: PMNode, isEditable: boolean): boolean {
|
|
14
|
+
if (!isEditable) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const TrailingNodeExtension = createExtension(() => {
|
|
17
|
-
return {
|
|
18
|
-
key: "trailingNode",
|
|
19
|
-
prosemirrorPlugins: [
|
|
20
|
-
new Plugin({
|
|
21
|
-
key: plugin,
|
|
22
|
-
appendTransaction: (_, __, state) => {
|
|
23
|
-
const { doc, tr, schema } = state;
|
|
24
|
-
const shouldInsertNodeAtEnd = plugin.getState(state);
|
|
25
|
-
const endPosition = doc.content.size - 2;
|
|
26
|
-
const type = schema.nodes["blockContainer"];
|
|
27
|
-
const contentType = schema.nodes["paragraph"];
|
|
28
|
-
if (!shouldInsertNodeAtEnd) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return tr.insert(
|
|
33
|
-
endPosition,
|
|
34
|
-
type.create(undefined, contentType.create()),
|
|
35
|
-
);
|
|
36
|
-
},
|
|
37
|
-
state: {
|
|
38
|
-
init: (_, _state) => {
|
|
39
|
-
// (maybe fix): use same logic as apply() here
|
|
40
|
-
// so it works when initializing
|
|
41
|
-
},
|
|
42
|
-
apply: (tr, value) => {
|
|
43
|
-
if (!tr.docChanged) {
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
18
|
+
const rootGroup = doc.lastChild;
|
|
19
|
+
const lastBlock = rootGroup?.lastChild;
|
|
20
|
+
const lastContent = lastBlock?.firstChild;
|
|
46
21
|
|
|
47
|
-
|
|
22
|
+
return !(
|
|
23
|
+
lastBlock?.type.name === "blockContainer" &&
|
|
24
|
+
lastContent?.type.name === "paragraph" &&
|
|
25
|
+
lastContent.content.size === 0
|
|
26
|
+
);
|
|
27
|
+
}
|
|
48
28
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Renders a fake trailing block as a widget decoration after the last block of
|
|
31
|
+
* the document. Clicking it inserts a real trailing block and moves the
|
|
32
|
+
* selection into it. This way the trailing block is not part of the document
|
|
33
|
+
* content, so it doesn't appear when the editor is read-only or when the
|
|
34
|
+
* content is exported.
|
|
35
|
+
*/
|
|
36
|
+
export const TrailingNodeExtension = createExtension(
|
|
37
|
+
({ editor }: ExtensionOptions) => {
|
|
38
|
+
function createTrailingWidget(pos: number): Decoration {
|
|
39
|
+
return Decoration.widget(
|
|
40
|
+
pos,
|
|
41
|
+
() => {
|
|
42
|
+
const el = document.createElement("div");
|
|
43
|
+
el.className = "bn-trailing-block";
|
|
44
|
+
el.contentEditable = "false";
|
|
45
|
+
el.addEventListener("mousedown", (event) => {
|
|
46
|
+
// Stop ProseMirror from trying to place the selection somewhere
|
|
47
|
+
// based on this click.
|
|
48
|
+
event.preventDefault();
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
editor.transact((tr) => {
|
|
51
|
+
const [insertedBlock] = editor.insertBlocks(
|
|
52
|
+
[{ type: "paragraph" }],
|
|
53
|
+
editor.document[editor.document.length - 1],
|
|
54
|
+
"after",
|
|
55
|
+
);
|
|
56
|
+
editor.setTextCursorPosition(insertedBlock, "start");
|
|
57
|
+
tr.scrollIntoView();
|
|
58
|
+
});
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
editor.prosemirrorView?.focus();
|
|
61
|
+
});
|
|
62
|
+
return el;
|
|
63
|
+
},
|
|
64
|
+
{ side: 1 },
|
|
65
|
+
);
|
|
66
|
+
}
|
|
58
67
|
|
|
59
|
-
|
|
68
|
+
// Maps the existing DecorationSet through the transaction, then
|
|
69
|
+
// incrementally adds or removes the widget only if the show/hide state
|
|
70
|
+
// crossed over. The underlying Decoration (and its rendered DOM) stays
|
|
71
|
+
// reference-stable across transactions.
|
|
72
|
+
function nextDecorationSet(
|
|
73
|
+
tr: Transaction,
|
|
74
|
+
oldSet: DecorationSet,
|
|
75
|
+
isEditable: boolean,
|
|
76
|
+
): DecorationSet {
|
|
77
|
+
const mapped = oldSet.map(tr.mapping, tr.doc);
|
|
78
|
+
const existing = mapped.find();
|
|
79
|
+
const wasShowing = existing.length > 0;
|
|
80
|
+
const shouldShow = shouldShowTrailingWidget(tr.doc, isEditable);
|
|
60
81
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
82
|
+
if (wasShowing === shouldShow) {
|
|
83
|
+
return mapped;
|
|
84
|
+
}
|
|
85
|
+
if (wasShowing) {
|
|
86
|
+
return mapped.remove(existing);
|
|
87
|
+
}
|
|
88
|
+
return mapped.add(tr.doc, [
|
|
89
|
+
createTrailingWidget(tr.doc.content.size - 1),
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
64
92
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
return {
|
|
94
|
+
key: "trailingNode",
|
|
95
|
+
prosemirrorPlugins: [
|
|
96
|
+
new Plugin<DecorationSet>({
|
|
97
|
+
key: PLUGIN_KEY,
|
|
98
|
+
state: {
|
|
99
|
+
init: (_, state) =>
|
|
100
|
+
nextDecorationSet(
|
|
101
|
+
state.tr,
|
|
102
|
+
DecorationSet.empty,
|
|
103
|
+
editor.isEditable,
|
|
104
|
+
),
|
|
105
|
+
apply: (tr, oldSet) => {
|
|
106
|
+
if (!tr.docChanged && !tr.getMeta(PLUGIN_KEY)) {
|
|
107
|
+
return oldSet;
|
|
108
|
+
}
|
|
109
|
+
return nextDecorationSet(tr, oldSet, editor.isEditable);
|
|
110
|
+
},
|
|
71
111
|
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
112
|
+
// Editable changes don't dispatch a transaction on their own, so the
|
|
113
|
+
// plugin state can't re-evaluate on its own. Watch for the change
|
|
114
|
+
// and dispatch a no-op transaction tagged with this plugin's key so
|
|
115
|
+
// `apply` re-runs and adds or removes the widget.
|
|
116
|
+
view(view) {
|
|
117
|
+
let lastEditable = view.editable;
|
|
118
|
+
return {
|
|
119
|
+
update(view) {
|
|
120
|
+
if (view.editable === lastEditable) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
lastEditable = view.editable;
|
|
124
|
+
view.dispatch(view.state.tr.setMeta(PLUGIN_KEY, true));
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
props: {
|
|
129
|
+
decorations: (state) => PLUGIN_KEY.getState(state),
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
],
|
|
133
|
+
} as const;
|
|
134
|
+
},
|
|
135
|
+
);
|
package/src/i18n/locales/fr.ts
CHANGED
|
@@ -244,7 +244,7 @@ export const fr: Dictionary = {
|
|
|
244
244
|
} as Record<string, string>,
|
|
245
245
|
},
|
|
246
246
|
toggle_blocks: {
|
|
247
|
-
add_block_button: "
|
|
247
|
+
add_block_button: "Liste repliable vide. Cliquez pour ajouter un bloc.",
|
|
248
248
|
},
|
|
249
249
|
// from react package:
|
|
250
250
|
side_menu: {
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { Block } from "../../../../blocks/defaultBlocks.js";
|
|
1
2
|
import type { BlockNoteEditor } from "../../../../editor/BlockNoteEditor";
|
|
2
3
|
import { BlockIdentifier } from "../../../../schema/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Removes the given blocks from the editor, then inserts them before/after a
|
|
6
|
+
* reference block.
|
|
7
|
+
* @param editor The BlockNote editor instance to move the blocks in.
|
|
8
|
+
* @param blocks The blocks to move.
|
|
9
|
+
* @param referenceBlock The reference block to insert the blocks before/after.
|
|
10
|
+
* @param placement Whether to insert the blocks before or after the reference
|
|
11
|
+
* block.
|
|
12
|
+
*/
|
|
13
|
+
export declare function moveBlocks(editor: BlockNoteEditor<any, any, any>, blocks: Block<any, any, any>[], referenceBlock: BlockIdentifier, placement: "before" | "after"): void;
|
|
3
14
|
/**
|
|
4
15
|
* Removes the selected blocks from the editor, then inserts them before/after a
|
|
5
16
|
* reference block. Also updates the selection to match the original selection
|
|
@@ -11,5 +22,5 @@ import { BlockIdentifier } from "../../../../schema/index.js";
|
|
|
11
22
|
* reference block.
|
|
12
23
|
*/
|
|
13
24
|
export declare function moveSelectedBlocksAndSelection(editor: BlockNoteEditor<any, any, any>, referenceBlock: BlockIdentifier, placement: "before" | "after"): void;
|
|
14
|
-
export declare function moveBlocksUp(editor: BlockNoteEditor<any, any, any
|
|
15
|
-
export declare function moveBlocksDown(editor: BlockNoteEditor<any, any, any
|
|
25
|
+
export declare function moveBlocksUp(editor: BlockNoteEditor<any, any, any>, blockIdentifier?: BlockIdentifier): void;
|
|
26
|
+
export declare function moveBlocksDown(editor: BlockNoteEditor<any, any, any>, blockIdentifier?: BlockIdentifier): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { EditorView } from "prosemirror-view";
|
|
2
|
-
export declare function handleVSCodePaste(event: ClipboardEvent, view: EditorView):
|
|
2
|
+
export declare function handleVSCodePaste(event: ClipboardEvent, view: EditorView): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom HTML-to-Markdown serializer for BlockNote.
|
|
3
|
+
* Replaces the unified/rehype-remark pipeline with a direct DOM-based implementation.
|
|
4
|
+
*
|
|
5
|
+
* Input: HTML string from createExternalHTMLExporter
|
|
6
|
+
* Output: GFM-compatible markdown string
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Convert an HTML string (from BlockNote's external HTML exporter) to markdown.
|
|
10
|
+
*/
|
|
11
|
+
export declare function htmlToMarkdown(html: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -32,11 +32,13 @@ export declare const videoParse: (_config: VideoOptions) => (element: HTMLElemen
|
|
|
32
32
|
backgroundColor: string | undefined;
|
|
33
33
|
url: string | undefined;
|
|
34
34
|
previewWidth: number | undefined;
|
|
35
|
+
name: string | undefined;
|
|
35
36
|
} | {
|
|
36
37
|
backgroundColor: string | undefined;
|
|
37
38
|
caption: string | undefined;
|
|
38
39
|
url: string | undefined;
|
|
39
40
|
previewWidth: number | undefined;
|
|
41
|
+
name: string | undefined;
|
|
40
42
|
} | undefined;
|
|
41
43
|
export declare const createVideoBlockSpec: (options?: Partial<{
|
|
42
44
|
icon: string;
|
|
@@ -224,7 +224,8 @@ export interface BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema ext
|
|
|
224
224
|
headers?: boolean;
|
|
225
225
|
};
|
|
226
226
|
/**
|
|
227
|
-
*
|
|
227
|
+
* When the editor document doesn't end in an empty paragraph block, this option causes the editor to render an element simulating one.
|
|
228
|
+
* When clicked by the user, it gets turned into an actual block at the end of the document. This element is not shown when the option is `false`.
|
|
228
229
|
*
|
|
229
230
|
* @default true
|
|
230
231
|
*/
|
|
@@ -392,9 +393,18 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
392
393
|
/**
|
|
393
394
|
* Mount the editor to a DOM element.
|
|
394
395
|
*
|
|
396
|
+
* @param element The DOM element to mount the editor's contenteditable into.
|
|
397
|
+
* @param options.portalTarget Where to mount `editor.portalElement` — the
|
|
398
|
+
* container that floating UI (toolbars, menus, etc) portals into. When
|
|
399
|
+
* omitted, defaults to `element.parentElement` (which is the editor's
|
|
400
|
+
* `bn-container` in typical React usage), or to `document.body` /
|
|
401
|
+
* the surrounding shadow root when no parent is available.
|
|
402
|
+
*
|
|
395
403
|
* @warning Not needed to call manually when using React, use BlockNoteView to take care of mounting
|
|
396
404
|
*/
|
|
397
|
-
mount: (element: HTMLElement
|
|
405
|
+
mount: (element: HTMLElement, options?: {
|
|
406
|
+
portalTarget?: HTMLElement | null;
|
|
407
|
+
}) => void;
|
|
398
408
|
/**
|
|
399
409
|
* Unmount the editor from the DOM element it is bound to
|
|
400
410
|
*/
|
|
@@ -683,15 +693,19 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
683
693
|
/**
|
|
684
694
|
* Moves the selected blocks up. If the previous block has children, moves
|
|
685
695
|
* them to the end of its children. If there is no previous block, but the
|
|
686
|
-
* current blocks share a common parent, moves them out of & before it.
|
|
696
|
+
* current blocks share a common parent, moves them out of & before it. If a
|
|
697
|
+
* `blockIdentifier` is provided, that block is moved instead of the
|
|
698
|
+
* selection, and the selection is left unchanged.
|
|
687
699
|
*/
|
|
688
|
-
moveBlocksUp(): void;
|
|
700
|
+
moveBlocksUp(blockIdentifier?: BlockIdentifier): void;
|
|
689
701
|
/**
|
|
690
702
|
* Moves the selected blocks down. If the next block has children, moves
|
|
691
703
|
* them to the start of its children. If there is no next block, but the
|
|
692
|
-
* current blocks share a common parent, moves them out of & after it.
|
|
704
|
+
* current blocks share a common parent, moves them out of & after it. If a
|
|
705
|
+
* `blockIdentifier` is provided, that block is moved instead of the
|
|
706
|
+
* selection, and the selection is left unchanged.
|
|
693
707
|
*/
|
|
694
|
-
moveBlocksDown(): void;
|
|
708
|
+
moveBlocksDown(blockIdentifier?: BlockIdentifier): void;
|
|
695
709
|
/**
|
|
696
710
|
* Exports blocks into a simplified HTML string. To better conform to HTML standards, children of blocks which aren't list
|
|
697
711
|
* items are un-nested in the output HTML.
|
|
@@ -102,13 +102,17 @@ export declare class BlockManager<BSchema extends BlockSchema = DefaultBlockSche
|
|
|
102
102
|
/**
|
|
103
103
|
* Moves the selected blocks up. If the previous block has children, moves
|
|
104
104
|
* them to the end of its children. If there is no previous block, but the
|
|
105
|
-
* current blocks share a common parent, moves them out of & before it.
|
|
105
|
+
* current blocks share a common parent, moves them out of & before it. If a
|
|
106
|
+
* `blockIdentifier` is provided, that block is moved instead of the
|
|
107
|
+
* selection, and the selection is left unchanged.
|
|
106
108
|
*/
|
|
107
|
-
moveBlocksUp(): void;
|
|
109
|
+
moveBlocksUp(blockIdentifier?: BlockIdentifier): void;
|
|
108
110
|
/**
|
|
109
111
|
* Moves the selected blocks down. If the next block has children, moves
|
|
110
112
|
* them to the start of its children. If there is no next block, but the
|
|
111
|
-
* current blocks share a common parent, moves them out of & after it.
|
|
113
|
+
* current blocks share a common parent, moves them out of & after it. If a
|
|
114
|
+
* `blockIdentifier` is provided, that block is moved instead of the
|
|
115
|
+
* selection, and the selection is left unchanged.
|
|
112
116
|
*/
|
|
113
|
-
moveBlocksDown(): void;
|
|
117
|
+
moveBlocksDown(blockIdentifier?: BlockIdentifier): void;
|
|
114
118
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Plugin } from "prosemirror-state";
|
|
2
|
+
import { DecorationSet } from "prosemirror-view";
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Renders a fake trailing block as a widget decoration after the last block of
|
|
5
|
+
* the document. Clicking it inserts a real trailing block and moves the
|
|
6
|
+
* selection into it. This way the trailing block is not part of the document
|
|
7
|
+
* content, so it doesn't appear when the editor is read-only or when the
|
|
8
|
+
* content is exported.
|
|
4
9
|
*/
|
|
5
|
-
export declare const TrailingNodeExtension: () => import("../../index.js").ExtensionFactoryInstance<{
|
|
10
|
+
export declare const TrailingNodeExtension: (options?: Record<string, any> | undefined) => import("../../index.js").ExtensionFactoryInstance<{
|
|
6
11
|
readonly key: "trailingNode";
|
|
7
|
-
readonly prosemirrorPlugins: readonly [Plugin<
|
|
12
|
+
readonly prosemirrorPlugins: readonly [Plugin<DecorationSet>];
|
|
8
13
|
}>;
|