@blocknote/core 0.19.2 → 0.20.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.
Files changed (87) hide show
  1. package/dist/blocknote.js +1721 -1453
  2. package/dist/blocknote.js.map +1 -1
  3. package/dist/blocknote.umd.cjs +7 -7
  4. package/dist/blocknote.umd.cjs.map +1 -1
  5. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js +6 -3
  6. package/dist/src/api/blockManipulation/commands/insertBlocks/insertBlocks.js.map +1 -1
  7. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js +219 -0
  8. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.js.map +1 -0
  9. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js +175 -0
  10. package/dist/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.js.map +1 -0
  11. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js +3 -0
  12. package/dist/src/api/blockManipulation/commands/splitBlock/splitBlock.test.js.map +1 -1
  13. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js +6 -3
  14. package/dist/src/api/blockManipulation/commands/updateBlock/updateBlock.js.map +1 -1
  15. package/dist/src/api/blockManipulation/getBlock/getBlock.js +56 -0
  16. package/dist/src/api/blockManipulation/getBlock/getBlock.js.map +1 -0
  17. package/dist/src/api/blockManipulation/selections/selection.js +149 -0
  18. package/dist/src/api/blockManipulation/selections/selection.js.map +1 -0
  19. package/dist/src/api/blockManipulation/selections/selection.test.js +39 -0
  20. package/dist/src/api/blockManipulation/selections/selection.test.js.map +1 -0
  21. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js +3 -0
  22. package/dist/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.js.map +1 -1
  23. package/dist/src/api/nodeUtil.js +1 -1
  24. package/dist/src/api/nodeUtil.js.map +1 -1
  25. package/dist/src/blocks/TableBlockContent/TableExtension.js +8 -1
  26. package/dist/src/blocks/TableBlockContent/TableExtension.js.map +1 -1
  27. package/dist/src/editor/BlockNoteEditor.js +56 -57
  28. package/dist/src/editor/BlockNoteEditor.js.map +1 -1
  29. package/dist/src/editor/BlockNoteExtensions.js +1 -0
  30. package/dist/src/editor/BlockNoteExtensions.js.map +1 -1
  31. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js +4 -2
  32. package/dist/src/extensions/FormattingToolbar/FormattingToolbarPlugin.js.map +1 -1
  33. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js +10 -8
  34. package/dist/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.js.map +1 -1
  35. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js +7 -3
  36. package/dist/src/extensions/LinkToolbar/LinkToolbarPlugin.js.map +1 -1
  37. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js +13 -7
  38. package/dist/src/extensions/Placeholder/PlaceholderPlugin.js.map +1 -1
  39. package/dist/src/extensions/SideMenu/dragging.js +5 -1
  40. package/dist/src/extensions/SideMenu/dragging.js.map +1 -1
  41. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js +25 -8
  42. package/dist/src/extensions/TableHandles/TableHandlesPlugin.js.map +1 -1
  43. package/dist/src/i18n/locales/ru.js +1 -1
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/dist/webpack-stats.json +1 -1
  46. package/package.json +3 -3
  47. package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +6 -6
  48. package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +9506 -0
  49. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +295 -0
  50. package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +338 -0
  51. package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +4 -0
  52. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +11 -3
  53. package/src/api/blockManipulation/getBlock/getBlock.ts +141 -0
  54. package/src/api/blockManipulation/selections/__snapshots__/selection.test.ts.snap +660 -0
  55. package/src/api/blockManipulation/selections/selection.test.ts +56 -0
  56. package/src/api/blockManipulation/selections/selection.ts +244 -0
  57. package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +4 -0
  58. package/src/api/nodeUtil.ts +2 -2
  59. package/src/blocks/TableBlockContent/TableExtension.ts +12 -1
  60. package/src/editor/BlockNoteEditor.ts +87 -85
  61. package/src/editor/BlockNoteExtensions.ts +2 -0
  62. package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +4 -2
  63. package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +11 -8
  64. package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +11 -4
  65. package/src/extensions/Placeholder/PlaceholderPlugin.ts +23 -15
  66. package/src/extensions/SideMenu/dragging.ts +5 -1
  67. package/src/extensions/TableHandles/TableHandlesPlugin.ts +34 -9
  68. package/src/i18n/locales/ru.ts +1 -1
  69. package/types/src/api/blockManipulation/commands/moveBlocks/moveBlocks.d.ts +15 -0
  70. package/types/src/api/blockManipulation/getBlock/getBlock.d.ts +7 -0
  71. package/types/src/api/blockManipulation/selections/selection.d.ts +5 -0
  72. package/types/src/api/blockManipulation/selections/selection.test.d.ts +1 -0
  73. package/types/src/api/nodeUtil.d.ts +1 -1
  74. package/types/src/editor/BlockNoteEditor.d.ts +54 -10
  75. package/types/src/editor/BlockNoteExtensions.d.ts +1 -0
  76. package/types/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.d.ts +1 -0
  77. package/types/src/pm-nodes/BlockContainer.d.ts +2 -2
  78. package/types/src/pm-nodes/BlockGroup.d.ts +2 -2
  79. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js +0 -116
  80. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.js.map +0 -1
  81. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js +0 -110
  82. package/dist/src/api/blockManipulation/commands/moveBlock/moveBlock.test.js.map +0 -1
  83. package/src/api/blockManipulation/commands/moveBlock/__snapshots__/moveBlock.test.ts.snap +0 -3799
  84. package/src/api/blockManipulation/commands/moveBlock/moveBlock.test.ts +0 -196
  85. package/src/api/blockManipulation/commands/moveBlock/moveBlock.ts +0 -176
  86. package/types/src/api/blockManipulation/commands/moveBlock/moveBlock.d.ts +0 -5
  87. /package/types/src/api/blockManipulation/commands/{moveBlock/moveBlock.test.d.ts → moveBlocks/moveBlocks.test.d.ts} +0 -0
@@ -48,22 +48,30 @@ export class PlaceholderPlugin {
48
48
  for (const [blockType, placeholder] of Object.entries(placeholders)) {
49
49
  const mustBeFocused = blockType === "default";
50
50
 
51
- styleSheet.insertRule(
52
- `${getSelector(
53
- blockType,
54
- mustBeFocused
55
- )}{ content: ${JSON.stringify(placeholder)}; }`
56
- );
57
-
58
- // For some reason, the placeholders which show when the block is focused
59
- // take priority over ones which show depending on block type, so we need
60
- // to make sure the block specific ones are also used when the block is
61
- // focused.
62
- if (!mustBeFocused) {
51
+ try {
63
52
  styleSheet.insertRule(
64
- `${getSelector(blockType, true)}{ content: ${JSON.stringify(
65
- placeholder
66
- )}; }`
53
+ `${getSelector(
54
+ blockType,
55
+ mustBeFocused
56
+ )} { content: ${JSON.stringify(placeholder)}; }`
57
+ );
58
+
59
+ // For some reason, the placeholders which show when the block is focused
60
+ // take priority over ones which show depending on block type, so we need
61
+ // to make sure the block specific ones are also used when the block is
62
+ // focused.
63
+ if (!mustBeFocused) {
64
+ styleSheet.insertRule(
65
+ `${getSelector(blockType, true)} { content: ${JSON.stringify(
66
+ placeholder
67
+ )}; }`
68
+ );
69
+ }
70
+ } catch (e) {
71
+ // eslint-disable-next-line no-console
72
+ console.warn(
73
+ `Failed to insert placeholder CSS rule - this is likely due to the browser not supporting certain CSS pseudo-element selectors (:has, :only-child:, or :before)`,
74
+ e
67
75
  );
68
76
  }
69
77
  }
@@ -149,7 +149,11 @@ export function dragStart<
149
149
 
150
150
  const view = editor.prosemirrorView;
151
151
 
152
- const pos = getNodeById(block.id, view.state.doc).posBeforeNode;
152
+ const posInfo = getNodeById(block.id, view.state.doc);
153
+ if (!posInfo) {
154
+ throw new Error(`Block with ID ${block.id} not found`);
155
+ }
156
+ const pos = posInfo.posBeforeNode;
153
157
 
154
158
  if (pos != null) {
155
159
  const selection = view.state.selection;
@@ -236,6 +236,9 @@ export class TableHandlesView<
236
236
  blockEl.id,
237
237
  this.editor._tiptapEditor.state.doc
238
238
  );
239
+ if (!pmNodeInfo) {
240
+ throw new Error(`Block with ID ${blockEl.id} not found`);
241
+ }
239
242
 
240
243
  const block = nodeToBlock(
241
244
  pmNodeInfo.node,
@@ -468,17 +471,26 @@ export class TableHandlesView<
468
471
  // the existing selection out of the block.
469
472
  this.editor.setTextCursorPosition(this.state.block.id);
470
473
  };
471
- // Updates drag handle positions on table content updates.
474
+ // Updates drag handles when the table is modified or removed.
472
475
  update() {
473
476
  if (!this.state || !this.state.show) {
474
477
  return;
475
478
  }
476
479
 
477
- const tableBody = this.tableElement!.querySelector("tbody");
478
- if (!tableBody) {
480
+ // Hide handles if the table block has been removed.
481
+ this.state.block = this.editor.getBlock(this.state.block.id)!;
482
+ if (!this.state.block) {
483
+ this.state.show = false;
484
+ this.state.showAddOrRemoveRowsButton = false;
485
+ this.state.showAddOrRemoveColumnsButton = false;
486
+ this.emitUpdate();
487
+
479
488
  return;
480
489
  }
481
490
 
491
+ const rowCount = this.state.block.content.rows.length;
492
+ const colCount = this.state.block.content.rows[0].cells.length;
493
+
482
494
  if (
483
495
  this.state.rowIndex !== undefined &&
484
496
  this.state.colIndex !== undefined
@@ -486,20 +498,33 @@ export class TableHandlesView<
486
498
  // If rows or columns are deleted in the update, the hovered indices for
487
499
  // those may now be out of bounds. If this is the case, they are moved to
488
500
  // the new last row or column.
489
- if (this.state.rowIndex >= tableBody.children.length) {
490
- this.state.rowIndex = tableBody.children.length - 1;
501
+ if (this.state.rowIndex >= rowCount) {
502
+ this.state.rowIndex = rowCount - 1;
491
503
  }
492
- if (this.state.colIndex >= tableBody.children[0].children.length) {
493
- this.state.colIndex = tableBody.children[0].children.length - 1;
504
+ if (this.state.colIndex >= colCount) {
505
+ this.state.colIndex = colCount - 1;
494
506
  }
507
+ }
508
+
509
+ // Update bounding boxes.
510
+ const tableBody = this.tableElement!.querySelector("tbody");
511
+ if (!tableBody) {
512
+ throw new Error(
513
+ "Table block does not contain a 'tbody' HTML element. This should never happen."
514
+ );
515
+ }
495
516
 
517
+ if (
518
+ this.state.rowIndex !== undefined &&
519
+ this.state.colIndex !== undefined
520
+ ) {
496
521
  const row = tableBody.children[this.state.rowIndex];
497
522
  const cell = row.children[this.state.colIndex];
523
+
498
524
  this.state.referencePosCell = cell.getBoundingClientRect();
499
525
  }
500
-
501
- this.state.block = this.editor.getBlock(this.state.block.id)!;
502
526
  this.state.referencePosTable = tableBody.getBoundingClientRect();
527
+
503
528
  this.emitUpdate();
504
529
  }
505
530
 
@@ -271,7 +271,7 @@ export const ru: Dictionary = {
271
271
  image: "Удалить картинку",
272
272
  video: "Удалить видео",
273
273
  audio: "Удалить аудио",
274
- file: "Скачать файл",
274
+ file: "Удалить файл",
275
275
  },
276
276
  },
277
277
  file_preview_toggle: {
@@ -0,0 +1,15 @@
1
+ import type { BlockNoteEditor } from "../../../../editor/BlockNoteEditor";
2
+ import { BlockIdentifier } from "../../../../schema/index.js";
3
+ /**
4
+ * Removes the selected blocks from the editor, then inserts them before/after a
5
+ * reference block. Also updates the selection to match the original selection
6
+ * using `getBlockSelectionData` and `updateBlockSelectionFromData`.
7
+ * @param editor The BlockNote editor instance to move the blocks in.
8
+ * @param referenceBlock The reference block to insert the selected blocks
9
+ * before/after.
10
+ * @param placement Whether to insert the selected blocks before or after the
11
+ * reference block.
12
+ */
13
+ 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;
@@ -0,0 +1,7 @@
1
+ import { Block } from "../../../blocks/defaultBlocks.js";
2
+ import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
3
+ import { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema/index.js";
4
+ export declare function getBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blockIdentifier: BlockIdentifier): Block<BSchema, I, S> | undefined;
5
+ export declare function getPrevBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blockIdentifier: BlockIdentifier): Block<BSchema, I, S> | undefined;
6
+ export declare function getNextBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blockIdentifier: BlockIdentifier): Block<BSchema, I, S> | undefined;
7
+ export declare function getParentBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blockIdentifier: BlockIdentifier): Block<BSchema, I, S> | undefined;
@@ -0,0 +1,5 @@
1
+ import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor";
2
+ import { Selection } from "../../../editor/selectionTypes.js";
3
+ import { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema/index.js";
4
+ export declare function getSelection<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>): Selection<BSchema, I, S> | undefined;
5
+ export declare function setSelection<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, startBlock: BlockIdentifier, endBlock: BlockIdentifier): void;
@@ -5,4 +5,4 @@ import { Node } from "prosemirror-model";
5
5
  export declare function getNodeById(id: string, doc: Node): {
6
6
  node: Node;
7
7
  posBeforeNode: number;
8
- };
8
+ } | undefined;
@@ -123,6 +123,20 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
123
123
  */
124
124
  setIdAttribute?: boolean;
125
125
  dropCursor?: (opts: any) => Plugin;
126
+ /**
127
+ Select desired behavior when pressing `Tab` (or `Shift-Tab`). Specifically,
128
+ what should happen when a user has selected multiple blocks while a toolbar
129
+ is open:
130
+ - `"prefer-navigate-ui"`: Change focus to the toolbar. The user needs to
131
+ first press `Escape` to close the toolbar, and can then indent multiple
132
+ blocks. Better for keyboard accessibility.
133
+ - `"prefer-indent"`: Regardless of whether toolbars are open, indent the
134
+ selection of blocks. In this case, it's not possible to navigate toolbars
135
+ with the keyboard.
136
+
137
+ @default "prefer-navigate-ui"
138
+ */
139
+ tabBehavior: "prefer-navigate-ui" | "prefer-indent";
126
140
  };
127
141
  export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockSchema, ISchema extends InlineContentSchema = DefaultInlineContentSchema, SSchema extends StyleSchema = DefaultStyleSchema> {
128
142
  protected readonly options: Partial<BlockNoteEditorOptions<any, any, any>>;
@@ -210,10 +224,39 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
210
224
  get document(): Block<BSchema, ISchema, SSchema>[];
211
225
  /**
212
226
  * Gets a snapshot of an existing block from the editor.
213
- * @param blockIdentifier The identifier of an existing block that should be retrieved.
214
- * @returns The block that matches the identifier, or `undefined` if no matching block was found.
227
+ * @param blockIdentifier The identifier of an existing block that should be
228
+ * retrieved.
229
+ * @returns The block that matches the identifier, or `undefined` if no
230
+ * matching block was found.
215
231
  */
216
232
  getBlock(blockIdentifier: BlockIdentifier): Block<BSchema, ISchema, SSchema> | undefined;
233
+ /**
234
+ * Gets a snapshot of the previous sibling of an existing block from the
235
+ * editor.
236
+ * @param blockIdentifier The identifier of an existing block for which the
237
+ * previous sibling should be retrieved.
238
+ * @returns The previous sibling of the block that matches the identifier.
239
+ * `undefined` if no matching block was found, or it's the first child/block
240
+ * in the document.
241
+ */
242
+ getPrevBlock(blockIdentifier: BlockIdentifier): Block<BSchema, ISchema, SSchema> | undefined;
243
+ /**
244
+ * Gets a snapshot of the next sibling of an existing block from the editor.
245
+ * @param blockIdentifier The identifier of an existing block for which the
246
+ * next sibling should be retrieved.
247
+ * @returns The next sibling of the block that matches the identifier.
248
+ * `undefined` if no matching block was found, or it's the last child/block in
249
+ * the document.
250
+ */
251
+ getNextBlock(blockIdentifier: BlockIdentifier): Block<BSchema, ISchema, SSchema> | undefined;
252
+ /**
253
+ * Gets a snapshot of the parent of an existing block from the editor.
254
+ * @param blockIdentifier The identifier of an existing block for which the
255
+ * parent should be retrieved.
256
+ * @returns The parent of the block that matches the identifier. `undefined`
257
+ * if no matching block was found, or the block isn't nested.
258
+ */
259
+ getParentBlock(blockIdentifier: BlockIdentifier): Block<BSchema, ISchema, SSchema> | undefined;
217
260
  /**
218
261
  * Traverses all blocks in the editor depth-first, and executes a callback for each.
219
262
  * @param callback The callback to execute for each block. Returning `false` stops the traversal.
@@ -246,6 +289,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
246
289
  * Gets a snapshot of the current selection.
247
290
  */
248
291
  getSelection(): Selection<BSchema, ISchema, SSchema> | undefined;
292
+ setSelection(startBlock: BlockIdentifier, endBlock: BlockIdentifier): void;
249
293
  /**
250
294
  * Checks if the editor is currently editable, or if it's locked.
251
295
  * @returns True if the editor is editable, false otherwise.
@@ -345,17 +389,17 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
345
389
  */
346
390
  unnestBlock(): void;
347
391
  /**
348
- * Moves the block containing the text cursor up. If the previous block has
349
- * children, moves it to the end of its children. If there is no previous
350
- * block, but the current block is nested, moves it out of & before its parent.
392
+ * Moves the selected blocks up. If the previous block has children, moves
393
+ * them to the end of its children. If there is no previous block, but the
394
+ * current blocks share a common parent, moves them out of & before it.
351
395
  */
352
- moveBlockUp(): void;
396
+ moveBlocksUp(): void;
353
397
  /**
354
- * Moves the block containing the text cursor down. If the next block has
355
- * children, moves it to the start of its children. If there is no next block,
356
- * but the current block is nested, moves it out of & after its parent.
398
+ * Moves the selected blocks down. If the next block has children, moves
399
+ * them to the start of its children. If there is no next block, but the
400
+ * current blocks share a common parent, moves them out of & after it.
357
401
  */
358
- moveBlockDown(): void;
402
+ moveBlocksDown(): void;
359
403
  /**
360
404
  * Exports blocks into a simplified HTML string. To better conform to HTML standards, children of blocks which aren't list
361
405
  * items are un-nested in the output HTML.
@@ -25,6 +25,7 @@ type ExtensionOptions<BSchema extends BlockSchema, I extends InlineContentSchema
25
25
  tableHandles: boolean;
26
26
  dropCursor: (opts: any) => Plugin;
27
27
  placeholders: Record<string | "default", string>;
28
+ tabBehavior?: "prefer-navigate-ui" | "prefer-indent";
28
29
  };
29
30
  /**
30
31
  * Get all the Tiptap extensions BlockNote is configured with by default
@@ -2,4 +2,5 @@ import { Extension } from "@tiptap/core";
2
2
  import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
3
3
  export declare const KeyboardShortcutsExtension: Extension<{
4
4
  editor: BlockNoteEditor<any, any, any>;
5
+ tabBehavior: "prefer-navigate-ui" | "prefer-indent";
5
6
  }, any>;
@@ -5,10 +5,10 @@ import type { BlockNoteEditor } from "../editor/BlockNoteEditor.js";
5
5
  */
6
6
  export declare const BlockContainer: Node<{
7
7
  domAttributes?: Partial<{
8
- blockGroup: Record<string, string>;
9
8
  blockContent: Record<string, string>;
10
- block: Record<string, string>;
9
+ blockGroup: Record<string, string>;
11
10
  editor: Record<string, string>;
11
+ block: Record<string, string>;
12
12
  inlineContent: Record<string, string>;
13
13
  }> | undefined;
14
14
  editor: BlockNoteEditor<any, any, any>;
@@ -1,10 +1,10 @@
1
1
  import { Node } from "@tiptap/core";
2
2
  export declare const BlockGroup: Node<{
3
3
  domAttributes?: Partial<{
4
- blockGroup: Record<string, string>;
5
4
  blockContent: Record<string, string>;
6
- block: Record<string, string>;
5
+ blockGroup: Record<string, string>;
7
6
  editor: Record<string, string>;
7
+ block: Record<string, string>;
8
8
  inlineContent: Record<string, string>;
9
9
  }> | undefined;
10
10
  }, any>;
@@ -1,116 +0,0 @@
1
- import { NodeSelection, TextSelection } from "prosemirror-state";
2
- import { CellSelection } from "prosemirror-tables";
3
- import { getBlockInfoFromSelection } from "../../../getBlockInfoFromPos.js";
4
- import { getNodeById } from "../../../nodeUtil.js";
5
- // `getBlockSelectionData` and `updateBlockSelectionFromData` are used to save
6
- // and restore the selection within a block, when the block is moved.
7
- function getBlockSelectionData(editor) {
8
- const { bnBlock } = getBlockInfoFromSelection(editor._tiptapEditor.state);
9
- const selectionData = {
10
- blockId: bnBlock.node.attrs.id,
11
- blockPos: bnBlock.beforePos,
12
- };
13
- if (editor._tiptapEditor.state.selection instanceof CellSelection) {
14
- return {
15
- ...selectionData,
16
- type: "cell",
17
- anchorCell: editor._tiptapEditor.state.selection
18
- .$anchorCell.pos,
19
- headCell: editor._tiptapEditor.state.selection
20
- .$headCell.pos,
21
- };
22
- }
23
- else if (editor._tiptapEditor.state.selection instanceof NodeSelection) {
24
- return {
25
- ...selectionData,
26
- type: "node",
27
- from: editor._tiptapEditor.state.selection.from,
28
- };
29
- }
30
- else {
31
- return {
32
- ...selectionData,
33
- type: "text",
34
- anchor: editor._tiptapEditor.state.selection.anchor,
35
- head: editor._tiptapEditor.state.selection.head,
36
- };
37
- }
38
- }
39
- function updateBlockSelectionFromData(editor, data) {
40
- const blockPos = getNodeById(data.blockId, editor._tiptapEditor.state.doc).posBeforeNode;
41
- let selection;
42
- if (data.type === "cell") {
43
- selection = CellSelection.create(editor._tiptapEditor.state.doc, data.anchorCell + (blockPos - data.blockPos), data.headCell + (blockPos - data.blockPos));
44
- }
45
- else if (data.type === "node") {
46
- selection = NodeSelection.create(editor._tiptapEditor.state.doc, data.from + (blockPos - data.blockPos));
47
- }
48
- else {
49
- selection = TextSelection.create(editor._tiptapEditor.state.doc, data.anchor + (blockPos - data.blockPos), data.head + (blockPos - data.blockPos));
50
- }
51
- editor._tiptapEditor.view.dispatch(editor._tiptapEditor.state.tr.setSelection(selection));
52
- }
53
- export function moveSelectedBlockAndSelection(editor, referenceBlock, placement) {
54
- const { block } = editor.getTextCursorPosition();
55
- const selectionData = getBlockSelectionData(editor);
56
- editor.removeBlocks([block]);
57
- editor.insertBlocks([block], referenceBlock, placement);
58
- updateBlockSelectionFromData(editor, selectionData);
59
- }
60
- export function moveBlockUp(editor) {
61
- // This function currently only supports moving a single block.
62
- const editorSelection = editor.getSelection();
63
- if (editorSelection && editorSelection.blocks.length > 1) {
64
- return;
65
- }
66
- const { prevBlock, parentBlock } = editor.getTextCursorPosition();
67
- let referenceBlockId;
68
- let placement;
69
- if (!prevBlock) {
70
- if (parentBlock) {
71
- referenceBlockId = parentBlock.id;
72
- placement = "before";
73
- }
74
- }
75
- else if (prevBlock.children.length > 0) {
76
- referenceBlockId = prevBlock.children[prevBlock.children.length - 1].id;
77
- placement = "after";
78
- }
79
- else {
80
- referenceBlockId = prevBlock.id;
81
- placement = "before";
82
- }
83
- if (!referenceBlockId || !placement) {
84
- return;
85
- }
86
- moveSelectedBlockAndSelection(editor, referenceBlockId, placement);
87
- }
88
- export function moveBlockDown(editor) {
89
- // This function currently only supports moving a single block.
90
- const editorSelection = editor.getSelection();
91
- if (editorSelection && editorSelection.blocks.length > 1) {
92
- return;
93
- }
94
- const { nextBlock, parentBlock } = editor.getTextCursorPosition();
95
- let referenceBlockId;
96
- let placement;
97
- if (!nextBlock) {
98
- if (parentBlock) {
99
- referenceBlockId = parentBlock.id;
100
- placement = "after";
101
- }
102
- }
103
- else if (nextBlock.children.length > 0) {
104
- referenceBlockId = nextBlock.children[0].id;
105
- placement = "before";
106
- }
107
- else {
108
- referenceBlockId = nextBlock.id;
109
- placement = "after";
110
- }
111
- if (!referenceBlockId || !placement) {
112
- return;
113
- }
114
- moveSelectedBlockAndSelection(editor, referenceBlockId, placement);
115
- }
116
- //# sourceMappingURL=moveBlock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"moveBlock.js","sourceRoot":"","sources":["../../../../../../src/api/blockManipulation/commands/moveBlock/moveBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAsBnD,8EAA8E;AAC9E,qEAAqE;AACrE,SAAS,qBAAqB,CAC5B,MAAsC;IAEtC,MAAM,EAAE,OAAO,EAAE,GAAG,yBAAyB,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAE1E,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QAC9B,QAAQ,EAAE,OAAO,CAAC,SAAS;KAC5B,CAAC;IAEF,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,YAAY,aAAa,EAAE,CAAC;QAClE,OAAO;YACL,GAAG,aAAa;YAChB,IAAI,EAAE,MAAe;YACrB,UAAU,EAAG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,SAA2B;iBAChE,WAAW,CAAC,GAAG;YAClB,QAAQ,EAAG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,SAA2B;iBAC9D,SAAS,CAAC,GAAG;SACjB,CAAC;IACJ,CAAC;SAAM,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,YAAY,aAAa,EAAE,CAAC;QACzE,OAAO;YACL,GAAG,aAAa;YAChB,IAAI,EAAE,MAAe;YACrB,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI;SAChD,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO;YACL,GAAG,aAAa;YACh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E,CAAC"}
@@ -1,110 +0,0 @@
1
- import { NodeSelection, TextSelection } from "prosemirror-state";
2
- import { CellSelection } from "prosemirror-tables";
3
- import { describe, expect, it } from "vitest";
4
- import { getBlockInfoFromSelection } from "../../../getBlockInfoFromPos.js";
5
- import { setupTestEnv } from "../../setupTestEnv.js";
6
- import { moveBlockDown, moveBlockUp, moveSelectedBlockAndSelection, } from "./moveBlock.js";
7
- const getEditor = setupTestEnv();
8
- function makeSelectionSpanContent(selectionType) {
9
- const blockInfo = getBlockInfoFromSelection(getEditor()._tiptapEditor.state);
10
- if (!blockInfo.isBlockContainer) {
11
- throw new Error(`Selection points to a ${blockInfo.blockNoteType} node, not a blockContainer node`);
12
- }
13
- const { blockContent } = blockInfo;
14
- if (selectionType === "cell") {
15
- getEditor()._tiptapEditor.view.dispatch(getEditor()._tiptapEditor.state.tr.setSelection(CellSelection.create(getEditor()._tiptapEditor.state.doc, getEditor()
16
- ._tiptapEditor.state.doc.resolve(blockContent.beforePos + 3)
17
- .before(), getEditor()
18
- ._tiptapEditor.state.doc.resolve(blockContent.afterPos - 3)
19
- .before())));
20
- }
21
- else if (selectionType === "node") {
22
- const resolvedContentStartPos = getEditor()._tiptapEditor.state.doc.resolve(blockContent.beforePos);
23
- getEditor()._tiptapEditor.view.dispatch(getEditor()._tiptapEditor.state.tr.setSelection(NodeSelection.create(getEditor()._tiptapEditor.state.doc, getEditor()
24
- ._tiptapEditor.state.doc.resolve(resolvedContentStartPos.after(resolvedContentStartPos.depth + 1))
25
- .start())));
26
- }
27
- else {
28
- const resolvedContentStartPos = getEditor()._tiptapEditor.state.doc.resolve(blockContent.beforePos);
29
- const resolvedContentEndPos = getEditor()._tiptapEditor.state.doc.resolve(blockContent.afterPos);
30
- getEditor()._tiptapEditor.view.dispatch(getEditor()._tiptapEditor.state.tr.setSelection(TextSelection.create(getEditor()._tiptapEditor.state.doc, getEditor()
31
- ._tiptapEditor.state.doc.resolve(resolvedContentStartPos.after(resolvedContentStartPos.depth + 1))
32
- .start(), getEditor()
33
- ._tiptapEditor.state.doc.resolve(resolvedContentEndPos.before(resolvedContentEndPos.depth + 1))
34
- .end())));
35
- }
36
- }
37
- describe("Test moveSelectedBlockAndSelection", () => {
38
- it("Text selection", () => {
39
- getEditor().setTextCursorPosition("paragraph-1");
40
- makeSelectionSpanContent("text");
41
- moveSelectedBlockAndSelection(getEditor(), "paragraph-0", "before");
42
- const selection = getEditor()._tiptapEditor.state.selection;
43
- getEditor().setTextCursorPosition("paragraph-1");
44
- makeSelectionSpanContent("text");
45
- expect(selection.eq(getEditor()._tiptapEditor.state.selection)).toBeTruthy();
46
- });
47
- it("Node selection", () => {
48
- getEditor().setTextCursorPosition("image-0");
49
- makeSelectionSpanContent("node");
50
- moveSelectedBlockAndSelection(getEditor(), "paragraph-0", "before");
51
- const selection = getEditor()._tiptapEditor.state.selection;
52
- getEditor().setTextCursorPosition("image-0");
53
- makeSelectionSpanContent("node");
54
- expect(selection.eq(getEditor()._tiptapEditor.state.selection)).toBeTruthy();
55
- });
56
- it("Cell selection", () => {
57
- getEditor().setTextCursorPosition("table-0");
58
- makeSelectionSpanContent("cell");
59
- moveSelectedBlockAndSelection(getEditor(), "paragraph-0", "before");
60
- const selection = getEditor()._tiptapEditor.state.selection;
61
- getEditor().setTextCursorPosition("table-0");
62
- makeSelectionSpanContent("cell");
63
- expect(selection.eq(getEditor()._tiptapEditor.state.selection)).toBeTruthy();
64
- });
65
- });
66
- describe("Test moveBlockUp", () => {
67
- it("Basic", () => {
68
- getEditor().setTextCursorPosition("paragraph-1");
69
- moveBlockUp(getEditor());
70
- expect(getEditor().document).toMatchSnapshot();
71
- });
72
- it("Into children", () => {
73
- getEditor().setTextCursorPosition("paragraph-2");
74
- moveBlockUp(getEditor());
75
- expect(getEditor().document).toMatchSnapshot();
76
- });
77
- it("Out of children", () => {
78
- getEditor().setTextCursorPosition("nested-paragraph-1");
79
- moveBlockUp(getEditor());
80
- expect(getEditor().document).toMatchSnapshot();
81
- });
82
- it("First block", () => {
83
- getEditor().setTextCursorPosition("paragraph-0");
84
- moveBlockUp(getEditor());
85
- expect(getEditor().document).toMatchSnapshot();
86
- });
87
- });
88
- describe("Test moveBlockDown", () => {
89
- it("Basic", () => {
90
- getEditor().setTextCursorPosition("paragraph-0");
91
- moveBlockDown(getEditor());
92
- expect(getEditor().document).toMatchSnapshot();
93
- });
94
- it("Into children", () => {
95
- getEditor().setTextCursorPosition("paragraph-1");
96
- moveBlockDown(getEditor());
97
- expect(getEditor().document).toMatchSnapshot();
98
- });
99
- it("Out of children", () => {
100
- getEditor().setTextCursorPosition("nested-paragraph-1");
101
- moveBlockDown(getEditor());
102
- expect(getEditor().document).toMatchSnapshot();
103
- });
104
- it("Last block", () => {
105
- getEditor().setTextCursorPosition("trailing-paragraph");
106
- moveBlockDown(getEditor());
107
- expect(getEditor().document).toMatchSnapshot();
108
- });
109
- });
110
- //# sourceMappingURL=moveBlock.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"moveBlock.test.js","sourceRoot":"","sources":["../../../../../../src/api/blockManipulation/commands/moveBlock/moveBlock.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,WAAW,EACX,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AAExB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;AAEjC,SAAS,wBAAwB,CAAC,aAAuC;IACvE,MAAM,SAAS,GAAG,yBAAyB,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAA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