@blocknote/core 0.50.0 → 0.51.1

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.
Files changed (103) hide show
  1. package/dist/blocknote.cjs +1 -1
  2. package/dist/blocknote.js +4 -4
  3. package/dist/{blocks-UU7EM-QM.js → blocks-D0lMxErU.js} +397 -368
  4. package/dist/blocks-D0lMxErU.js.map +1 -0
  5. package/dist/blocks-KyMOxPT3.cjs +11 -0
  6. package/dist/blocks-KyMOxPT3.cjs.map +1 -0
  7. package/dist/blocks.cjs +1 -1
  8. package/dist/blocks.js +2 -2
  9. package/dist/extensions-Cutrafjg.cjs +52 -0
  10. package/dist/extensions-Cutrafjg.cjs.map +1 -0
  11. package/dist/{extensions-CkLT--Nc.js → extensions-D2mx2C9y.js} +622 -353
  12. package/dist/extensions-D2mx2C9y.js.map +1 -0
  13. package/dist/extensions.cjs +1 -1
  14. package/dist/extensions.js +3 -3
  15. package/dist/locales.cjs +1 -1
  16. package/dist/locales.cjs.map +1 -1
  17. package/dist/locales.js +1 -1
  18. package/dist/locales.js.map +1 -1
  19. package/dist/src-D5R5YzV7.cjs +21 -0
  20. package/dist/src-D5R5YzV7.cjs.map +1 -0
  21. package/dist/{src-SVFpMAWE.js → src-Dvmif2FY.js} +1070 -564
  22. package/dist/src-Dvmif2FY.js.map +1 -0
  23. package/dist/style.css +1 -1
  24. package/dist/webpack-stats.json +1 -1
  25. package/dist/yjs.cjs +1 -1
  26. package/dist/yjs.js +8 -8
  27. package/package.json +1 -13
  28. package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +7 -7
  29. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -3
  30. package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +5 -5
  31. package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +2550 -291
  32. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +83 -2
  33. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +103 -42
  34. package/src/api/blockManipulation/commands/nestBlock/__snapshots__/nestBlock.test.ts.snap +0 -143
  35. package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +12 -12
  36. package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +5 -3
  37. package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +6 -6
  38. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +22 -22
  39. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +12 -8
  40. package/src/api/blockManipulation/setupTestEnv.ts +1 -1
  41. package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +2 -6
  42. package/src/api/clipboard/fromClipboard/pasteExtension.ts +7 -2
  43. package/src/api/clipboard/toClipboard/copyExtension.ts +12 -1
  44. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +12 -4
  45. package/src/api/exporters/markdown/htmlToMarkdown.ts +813 -0
  46. package/src/api/exporters/markdown/markdownExporter.ts +2 -21
  47. package/src/api/nodeConversions/blockToNode.ts +3 -2
  48. package/src/api/parsers/html/util/__snapshots__/nestedLists.test.ts.snap +122 -107
  49. package/src/api/parsers/html/util/nestedLists.test.ts +1 -12
  50. package/src/api/parsers/markdown/markdownToHtml.ts +1194 -0
  51. package/src/api/parsers/markdown/parseMarkdown.ts +2 -101
  52. package/src/blocks/Audio/block.ts +1 -4
  53. package/src/blocks/Code/block.test.ts +258 -0
  54. package/src/blocks/File/block.ts +1 -4
  55. package/src/blocks/File/helpers/render/createFileBlockWrapper.ts +7 -2
  56. package/src/blocks/Image/block.ts +9 -6
  57. package/src/blocks/ListItem/BulletListItem/block.ts +7 -4
  58. package/src/blocks/ListItem/NumberedListItem/IndexingPlugin.ts +3 -4
  59. package/src/blocks/Video/block.ts +4 -5
  60. package/src/blocks/Video/parseVideoElement.ts +2 -1
  61. package/src/editor/Block.css +8 -0
  62. package/src/editor/BlockNoteEditor.test.ts +10 -4
  63. package/src/editor/BlockNoteEditor.ts +30 -13
  64. package/src/editor/managers/BlockManager.ts +10 -6
  65. package/src/editor/managers/ExtensionManager/index.ts +80 -25
  66. package/src/editor/performance.test.ts +2 -2
  67. package/src/editor/transformPasted.test.ts +295 -0
  68. package/src/editor/transformPasted.ts +77 -0
  69. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +1 -12
  70. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +0 -11
  71. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -1
  72. package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -1
  73. package/src/extensions/SideMenu/dragging.ts +7 -10
  74. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +21 -0
  75. package/src/extensions/TrailingNode/TrailingNode.ts +124 -65
  76. package/src/i18n/locales/fr.ts +1 -1
  77. package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.d.ts +13 -2
  78. package/types/src/api/clipboard/fromClipboard/handleVSCodePaste.d.ts +1 -1
  79. package/types/src/api/exporters/html/util/serializeBlocksExternalHTML.d.ts +1 -0
  80. package/types/src/api/exporters/markdown/htmlToMarkdown.d.ts +11 -0
  81. package/types/src/api/parsers/markdown/markdownToHtml.d.ts +5 -0
  82. package/types/src/blocks/Code/block.test.d.ts +1 -0
  83. package/types/src/blocks/Video/block.d.ts +2 -0
  84. package/types/src/blocks/Video/parseVideoElement.d.ts +1 -0
  85. package/types/src/editor/BlockNoteEditor.d.ts +20 -6
  86. package/types/src/editor/managers/BlockManager.d.ts +8 -4
  87. package/types/src/editor/transformPasted.test.d.ts +1 -0
  88. package/types/src/extensions/TrailingNode/TrailingNode.d.ts +8 -3
  89. package/dist/blocks-BFnTypT-.cjs +0 -11
  90. package/dist/blocks-BFnTypT-.cjs.map +0 -1
  91. package/dist/blocks-UU7EM-QM.js.map +0 -1
  92. package/dist/extensions-CYsFi5Is.cjs +0 -2
  93. package/dist/extensions-CYsFi5Is.cjs.map +0 -1
  94. package/dist/extensions-CkLT--Nc.js.map +0 -1
  95. package/dist/src-DsJ6yzs9.cjs +0 -5
  96. package/dist/src-DsJ6yzs9.cjs.map +0 -1
  97. package/dist/src-SVFpMAWE.js.map +0 -1
  98. package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +0 -42
  99. package/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.ts +0 -19
  100. package/src/api/exporters/markdown/util/removeUnderlinesRehypePlugin.ts +0 -39
  101. package/types/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.d.ts +0 -7
  102. package/types/src/api/exporters/markdown/util/convertVideoToMarkdownRehypePlugin.d.ts +0 -2
  103. 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 { Plugin, PluginKey } from "prosemirror-state";
2
- import { createExtension } from "../../editor/BlockNoteExtension.js";
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
- // based on https://github.com/ueberdosis/tiptap/blob/40a9404c94c7fef7900610c195536384781ae101/demos/src/Experiments/TrailingNode/Vue/trailing-node.ts
9
+ const PLUGIN_KEY = new PluginKey<DecorationSet>("trailingNode");
5
10
 
6
- /**
7
- * Extension based on:
8
- * - https://github.com/ueberdosis/tiptap/blob/v1/packages/tiptap-extensions/src/extensions/TrailingNode.js
9
- * - https://github.com/remirror/remirror/blob/e0f1bec4a1e8073ce8f5500d62193e52321155b9/packages/prosemirror-trailing-node/src/trailing-node-plugin.ts
10
- */
11
- const plugin = new PluginKey("trailingNode");
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
- * Add a trailing node to the document so the user can always click at the bottom of the document and start typing
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
- let lastNode = tr.doc.lastChild;
22
+ return !(
23
+ lastBlock?.type.name === "blockContainer" &&
24
+ lastContent?.type.name === "paragraph" &&
25
+ lastContent.content.size === 0
26
+ );
27
+ }
48
28
 
49
- if (!lastNode || lastNode.type.name !== "blockGroup") {
50
- throw new Error("Expected blockGroup");
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
- lastNode = lastNode.lastChild;
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
- if (!lastNode || lastNode.type.name !== "blockContainer") {
56
- return true; // not a blockContainer, but for example Columns. Insert trailing node
57
- }
60
+ editor.prosemirrorView?.focus();
61
+ });
62
+ return el;
63
+ },
64
+ { side: 1 },
65
+ );
66
+ }
58
67
 
59
- const lastContentNode = lastNode.firstChild;
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
- if (!lastContentNode) {
62
- throw new Error("Expected blockContent");
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
- // If last node is not empty (size > 4) or it doesn't contain
66
- // inline content, we need to add a trailing node.
67
- return (
68
- lastNode.nodeSize > 4 ||
69
- lastContentNode.type.spec.content !== "inline*"
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
- } as const;
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
+ );
@@ -244,7 +244,7 @@ export const fr: Dictionary = {
244
244
  } as Record<string, string>,
245
245
  },
246
246
  toggle_blocks: {
247
- add_block_button: "Toggle vide. Cliquez pour ajouter un bloc.",
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>): void;
15
- export declare function moveBlocksDown(editor: BlockNoteEditor<any, any, any>): void;
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): Promise<boolean>;
2
+ export declare function handleVSCodePaste(event: ClipboardEvent, view: EditorView): boolean;
@@ -4,6 +4,7 @@ import type { BlockNoteEditor } from "../../../../editor/BlockNoteEditor.js";
4
4
  import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../../schema/index.js";
5
5
  export declare function serializeInlineContentExternalHTML<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<any, I, S>, blockContent: PartialBlock<BSchema, I, S>["content"], serializer: DOMSerializer, options?: {
6
6
  document?: Document;
7
+ blockType?: string;
7
8
  }): DocumentFragment;
8
9
  export declare const serializeBlocksExternalHTML: <BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blocks: PartialBlock<BSchema, I, S>[], serializer: DOMSerializer, orderedListItemBlockTypes: Set<string>, unorderedListItemBlockTypes: Set<string>, options?: {
9
10
  document?: Document;
@@ -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,5 @@
1
+ /**
2
+ * Convert a markdown string to an HTML string.
3
+ * This is a direct replacement for the unified/remark/rehype pipeline.
4
+ */
5
+ export declare function markdownToHtml(markdown: 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;
@@ -1,4 +1,5 @@
1
1
  export declare const parseVideoElement: (videoElement: HTMLVideoElement) => {
2
2
  url: string | undefined;
3
3
  previewWidth: number | undefined;
4
+ name: string | undefined;
4
5
  };
@@ -224,7 +224,8 @@ export interface BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema ext
224
224
  headers?: boolean;
225
225
  };
226
226
  /**
227
- * An option which user can pass with `false` value to disable the automatic creation of a trailing new block on the next line when the user types or edits any block.
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) => void;
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
- * Add a trailing node to the document so the user can always click at the bottom of the document and start typing
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<void>];
12
+ readonly prosemirrorPlugins: readonly [Plugin<DecorationSet>];
8
13
  }>;