@blocknote/core 0.30.1 → 0.31.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.
- package/dist/blocknote.cjs +9 -9
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +2793 -2213
- package/dist/blocknote.js.map +1 -1
- package/dist/{en-D4taoCs4.cjs → en-BXVKCwYt.cjs} +2 -2
- package/dist/en-BXVKCwYt.cjs.map +1 -0
- package/dist/{en-B7ycW7c8.js → en-qGo6sk9V.js} +2 -3
- package/dist/en-qGo6sk9V.js.map +1 -0
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +20 -39
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +5 -6
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +2 -3
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +1 -1
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2816 -0
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +158 -0
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +87 -17
- package/src/api/blockManipulation/selections/selection.ts +48 -1
- package/src/api/blockManipulation/selections/{textCursorPosition/textCursorPosition.ts → textCursorPosition.ts} +7 -7
- package/src/api/getBlockInfoFromPos.ts +1 -1
- package/src/api/nodeConversions/blockToNode.ts +5 -2
- package/src/api/nodeConversions/nodeToBlock.ts +203 -8
- package/src/api/pmUtil.ts +3 -3
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +6 -6
- package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +1 -1
- package/src/blocks/TableBlockContent/TableBlockContent.ts +32 -2
- package/src/editor/Block.css +27 -1
- package/src/editor/BlockNoteEditor.test.ts +7 -0
- package/src/editor/BlockNoteEditor.ts +124 -39
- package/src/editor/BlockNoteExtension.ts +26 -0
- package/src/editor/BlockNoteExtensions.ts +28 -12
- package/src/editor/BlockNoteTipTapEditor.ts +23 -2
- package/src/extensions/Collaboration/CursorPlugin.ts +13 -7
- package/src/extensions/Collaboration/ForkYDocPlugin.test.ts +166 -0
- package/src/extensions/Collaboration/ForkYDocPlugin.ts +174 -0
- package/src/extensions/Collaboration/SyncPlugin.ts +7 -4
- package/src/extensions/Collaboration/UndoPlugin.ts +7 -4
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +30 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +30 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -0
- package/src/extensions/Comments/CommentsPlugin.ts +79 -70
- package/src/extensions/FilePanel/FilePanelPlugin.ts +54 -49
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +60 -26
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +26 -21
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +49 -42
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +115 -108
- package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +183 -170
- package/src/extensions/ShowSelection/ShowSelectionPlugin.ts +26 -19
- package/src/extensions/SideMenu/SideMenuPlugin.ts +23 -18
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +172 -168
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +4 -4
- package/src/extensions/Suggestions/SuggestionMarks.ts +175 -0
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +157 -150
- package/src/i18n/locales/ar.ts +0 -1
- package/src/i18n/locales/de.ts +0 -1
- package/src/i18n/locales/en.ts +0 -1
- package/src/i18n/locales/es.ts +0 -1
- package/src/i18n/locales/fr.ts +0 -1
- package/src/i18n/locales/hr.ts +0 -1
- package/src/i18n/locales/is.ts +0 -1
- package/src/i18n/locales/it.ts +0 -1
- package/src/i18n/locales/ja.ts +0 -1
- package/src/i18n/locales/ko.ts +0 -1
- package/src/i18n/locales/nl.ts +0 -1
- package/src/i18n/locales/no.ts +0 -1
- package/src/i18n/locales/pl.ts +0 -1
- package/src/i18n/locales/pt.ts +0 -1
- package/src/i18n/locales/ru.ts +0 -1
- package/src/i18n/locales/sk.ts +0 -1
- package/src/i18n/locales/uk.ts +0 -1
- package/src/i18n/locales/vi.ts +0 -1
- package/src/i18n/locales/zh-tw.ts +0 -1
- package/src/i18n/locales/zh.ts +0 -1
- package/src/index.ts +18 -8
- package/src/pm-nodes/BlockContainer.ts +1 -1
- package/src/pm-nodes/BlockGroup.ts +1 -1
- package/src/pm-nodes/Doc.ts +1 -0
- package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.d.ts +1 -1
- package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.d.ts +3 -1
- package/types/src/api/blockManipulation/selections/selection.d.ts +10 -0
- package/types/src/api/blockManipulation/selections/{textCursorPosition/textCursorPosition.d.ts → textCursorPosition.d.ts} +2 -2
- package/types/src/api/nodeConversions/nodeToBlock.d.ts +39 -2
- package/types/src/api/pmUtil.d.ts +3 -3
- package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +9 -1
- package/types/src/editor/BlockNoteEditor.d.ts +62 -10
- package/types/src/editor/BlockNoteExtension.d.ts +9 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -2
- package/types/src/editor/BlockNoteTipTapEditor.d.ts +2 -2
- package/types/src/extensions/Collaboration/CursorPlugin.d.ts +3 -3
- package/types/src/extensions/Collaboration/ForkYDocPlugin.d.ts +41 -0
- package/types/src/extensions/Collaboration/SyncPlugin.d.ts +3 -3
- package/types/src/extensions/Collaboration/UndoPlugin.d.ts +3 -3
- package/types/src/extensions/Comments/CommentsPlugin.d.ts +3 -4
- package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +4 -4
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +6 -5
- package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +4 -4
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +3 -3
- package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +3 -3
- package/types/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.d.ts +3 -3
- package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +3 -3
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +4 -4
- package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +3 -4
- package/types/src/extensions/Suggestions/SuggestionMarks.d.ts +4 -0
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +6 -6
- package/types/src/i18n/locales/en.d.ts +0 -1
- package/types/src/i18n/locales/sk.d.ts +0 -1
- package/types/src/index.d.ts +15 -8
- package/dist/en-B7ycW7c8.js.map +0 -1
- package/dist/en-D4taoCs4.cjs.map +0 -1
- package/src/api/blockManipulation/selections/__snapshots__/selection.test.ts.snap +0 -844
- package/src/api/blockManipulation/selections/selection.test.ts +0 -72
- package/src/api/blockManipulation/selections/textCursorPosition/__snapshots__/textCursorPosition.test.ts.snap +0 -316
- package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.ts +0 -74
- package/types/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.d.ts +0 -1
- /package/types/src/{api/blockManipulation/selections/selection.test.d.ts → extensions/Collaboration/ForkYDocPlugin.test.d.ts} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Transaction } from "prosemirror-state";
|
|
2
|
+
import { Transform } from "prosemirror-transform";
|
|
2
3
|
import type { Block, PartialBlock } from "../../../../blocks/defaultBlocks.js";
|
|
3
4
|
import type { BlockIdentifier, BlockSchema } from "../../../../schema/blocks/types.js";
|
|
4
5
|
import type { InlineContentSchema } from "../../../../schema/inlineContent/types.js";
|
|
@@ -7,4 +8,5 @@ export declare const updateBlockCommand: <BSchema extends BlockSchema, I extends
|
|
|
7
8
|
tr: Transaction;
|
|
8
9
|
dispatch?: () => void;
|
|
9
10
|
}) => boolean;
|
|
10
|
-
export declare function
|
|
11
|
+
export declare function updateBlockTr<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(tr: Transform, posBeforeBlock: number, block: PartialBlock<BSchema, I, S>, replaceFromPos?: number, replaceToPos?: number): void;
|
|
12
|
+
export declare function updateBlock<BSchema extends BlockSchema = any, I extends InlineContentSchema = any, S extends StyleSchema = any>(tr: Transaction, blockToUpdate: BlockIdentifier, update: PartialBlock<BSchema, I, S>, replaceFromPos?: number, replaceToPos?: number): Block<BSchema, I, S>;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { type Transaction } from "prosemirror-state";
|
|
2
|
+
import { Block } from "../../../blocks/defaultBlocks.js";
|
|
2
3
|
import { Selection } from "../../../editor/selectionTypes.js";
|
|
3
4
|
import { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema/index.js";
|
|
4
5
|
export declare function getSelection<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(tr: Transaction): Selection<BSchema, I, S> | undefined;
|
|
5
6
|
export declare function setSelection(tr: Transaction, startBlock: BlockIdentifier, endBlock: BlockIdentifier): void;
|
|
7
|
+
export declare function getSelectionCutBlocks(tr: Transaction): {
|
|
8
|
+
blocks: Block<Record<string, import("../../../index.js").BlockConfig>, InlineContentSchema, StyleSchema>[];
|
|
9
|
+
blockCutAtStart: string | undefined;
|
|
10
|
+
blockCutAtEnd: string | undefined;
|
|
11
|
+
_meta: {
|
|
12
|
+
startPos: number;
|
|
13
|
+
endPos: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Transaction } from "prosemirror-state";
|
|
2
|
-
import type { TextCursorPosition } from "
|
|
3
|
-
import type { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "
|
|
2
|
+
import type { TextCursorPosition } from "../../../editor/cursorPositionTypes.js";
|
|
3
|
+
import type { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema/index.js";
|
|
4
4
|
export declare function getTextCursorPosition<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(tr: Transaction): TextCursorPosition<BSchema, I, S>;
|
|
5
5
|
export declare function setTextCursorPosition(tr: Transaction, targetBlock: BlockIdentifier, placement?: "start" | "end"): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Node, Schema } from "@tiptap/pm/model";
|
|
2
|
-
import type { BlockSchema, InlineContent, InlineContentSchema, StyleSchema, TableContent } from "../../schema/index.js";
|
|
1
|
+
import { Node, Schema, Slice } from "@tiptap/pm/model";
|
|
3
2
|
import type { Block } from "../../blocks/defaultBlocks.js";
|
|
3
|
+
import type { BlockSchema, InlineContent, InlineContentSchema, StyleSchema, TableContent } from "../../schema/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* Converts an internal (prosemirror) table node contentto a BlockNote Tablecontent
|
|
6
6
|
*/
|
|
@@ -16,3 +16,40 @@ export declare function nodeToCustomInlineContent<I extends InlineContentSchema,
|
|
|
16
16
|
* TODO: test changes
|
|
17
17
|
*/
|
|
18
18
|
export declare function nodeToBlock<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(node: Node, schema: Schema, blockSchema?: BSchema, inlineContentSchema?: I, styleSchema?: S, blockCache?: import("../../index.js").BlockCache<any, any, any>): Block<BSchema, I, S>;
|
|
19
|
+
/**
|
|
20
|
+
* Convert a Prosemirror document to a BlockNote document (array of blocks)
|
|
21
|
+
*/
|
|
22
|
+
export declare function docToBlocks<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(doc: Node, schema: Schema, blockSchema?: BSchema, inlineContentSchema?: I, styleSchema?: S, blockCache?: import("../../index.js").BlockCache<any, any, any>): Block<BSchema, I, S>[];
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* Parse a Prosemirror Slice into a BlockNote selection. The prosemirror schema looks like this:
|
|
26
|
+
*
|
|
27
|
+
* <blockGroup>
|
|
28
|
+
* <blockContainer> (main content of block)
|
|
29
|
+
* <p, heading, etc.>
|
|
30
|
+
* <blockGroup> (only if blocks has children)
|
|
31
|
+
* <blockContainer> (child block)
|
|
32
|
+
* <p, heading, etc.>
|
|
33
|
+
* </blockContainer>
|
|
34
|
+
* <blockContainer> (child block 2)
|
|
35
|
+
* <p, heading, etc.>
|
|
36
|
+
* </blockContainer>
|
|
37
|
+
* </blockContainer>
|
|
38
|
+
* </blockGroup>
|
|
39
|
+
* </blockGroup>
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
export declare function prosemirrorSliceToSlicedBlocks<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(slice: Slice, schema: Schema, blockSchema?: BSchema, inlineContentSchema?: I, styleSchema?: S, blockCache?: WeakMap<Node, Block<BSchema, I, S>>): {
|
|
43
|
+
/**
|
|
44
|
+
* The blocks that are included in the selection.
|
|
45
|
+
*/
|
|
46
|
+
blocks: Block<BSchema, I, S>[];
|
|
47
|
+
/**
|
|
48
|
+
* If a block was "cut" at the start of the selection, this will be the id of the block that was cut.
|
|
49
|
+
*/
|
|
50
|
+
blockCutAtStart: string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* If a block was "cut" at the end of the selection, this will be the id of the block that was cut.
|
|
53
|
+
*/
|
|
54
|
+
blockCutAtEnd: string | undefined;
|
|
55
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Node, Schema } from "prosemirror-model";
|
|
2
|
-
import
|
|
2
|
+
import { Transform } from "prosemirror-transform";
|
|
3
|
+
import { BlockNoteSchema } from "../editor/BlockNoteSchema.js";
|
|
3
4
|
import type { BlockSchema } from "../schema/blocks/types.js";
|
|
4
5
|
import type { InlineContentSchema } from "../schema/inlineContent/types.js";
|
|
5
6
|
import type { StyleSchema } from "../schema/styles/types.js";
|
|
6
|
-
|
|
7
|
-
export declare function getPmSchema(trOrNode: Transaction | Node): Schema<any, any>;
|
|
7
|
+
export declare function getPmSchema(trOrNode: Transform | Node): Schema<any, any>;
|
|
8
8
|
export declare function getBlockNoteSchema<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(schema: Schema): BlockNoteSchema<BSchema, I, S>;
|
|
9
9
|
export declare function getBlockSchema<BSchema extends BlockSchema>(schema: Schema): BSchema;
|
|
10
10
|
export declare function getInlineContentSchema<I extends InlineContentSchema>(schema: Schema): I;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
1
2
|
export declare const tablePropSchema: {
|
|
2
3
|
textColor: {
|
|
3
4
|
default: "default";
|
|
4
5
|
};
|
|
5
6
|
};
|
|
6
|
-
export declare const TableBlockContent:
|
|
7
|
+
export declare const TableBlockContent: Node<any, any> & {
|
|
7
8
|
name: "table";
|
|
8
9
|
config: {
|
|
9
10
|
content: "tableRow+";
|
|
10
11
|
};
|
|
11
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* This extension allows you to create table rows.
|
|
15
|
+
* @see https://www.tiptap.dev/api/nodes/table-row
|
|
16
|
+
*/
|
|
17
|
+
export declare const TableRow: Node<{
|
|
18
|
+
HTMLAttributes: Record<string, any>;
|
|
19
|
+
}, any>;
|
|
12
20
|
export declare const Table: {
|
|
13
21
|
config: {
|
|
14
22
|
type: "table";
|
|
@@ -21,13 +21,20 @@ import { EditorView } from "prosemirror-view";
|
|
|
21
21
|
import { BlocksChanged } from "../api/nodeUtil.js";
|
|
22
22
|
import { CodeBlockOptions } from "../blocks/CodeBlockContent/CodeBlockContent.js";
|
|
23
23
|
import type { ThreadStore, User } from "../comments/index.js";
|
|
24
|
-
import "../
|
|
24
|
+
import type { ForkYDocPlugin } from "../extensions/Collaboration/ForkYDocPlugin.js";
|
|
25
25
|
import { EventEmitter } from "../util/EventEmitter.js";
|
|
26
|
+
import { BlockNoteExtension } from "./BlockNoteExtension.js";
|
|
27
|
+
import "../style.css";
|
|
28
|
+
/**
|
|
29
|
+
* A factory function that returns a BlockNoteExtension
|
|
30
|
+
* This is useful so we can create extensions that require an editor instance
|
|
31
|
+
* in the constructor
|
|
32
|
+
*/
|
|
26
33
|
export type BlockNoteExtensionFactory = (editor: BlockNoteEditor<any, any, any>) => BlockNoteExtension;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
/**
|
|
35
|
+
* We support Tiptap extensions and BlockNoteExtension based extensions
|
|
36
|
+
*/
|
|
37
|
+
export type SupportedExtension = AnyExtension | BlockNoteExtension;
|
|
31
38
|
export type BlockCache<BSchema extends BlockSchema = any, ISchema extends InlineContentSchema = any, SSchema extends StyleSchema = any> = WeakMap<Node, Block<BSchema, ISchema, SSchema>>;
|
|
32
39
|
export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends InlineContentSchema, SSchema extends StyleSchema> = {
|
|
33
40
|
/**
|
|
@@ -224,9 +231,21 @@ export type BlockNoteEditorOptions<BSchema extends BlockSchema, ISchema extends
|
|
|
224
231
|
*/
|
|
225
232
|
_tiptapOptions: Partial<EditorOptions>;
|
|
226
233
|
/**
|
|
227
|
-
* (experimental) add extra
|
|
234
|
+
* (experimental) add extra extensions to the editor
|
|
235
|
+
*
|
|
236
|
+
* @deprecated, should use `extensions` instead
|
|
237
|
+
*/
|
|
238
|
+
_extensions: Record<string, {
|
|
239
|
+
plugin: Plugin;
|
|
240
|
+
priority?: number;
|
|
241
|
+
} | ((editor: BlockNoteEditor<any, any, any>) => {
|
|
242
|
+
plugin: Plugin;
|
|
243
|
+
priority?: number;
|
|
244
|
+
})>;
|
|
245
|
+
/**
|
|
246
|
+
* Register
|
|
228
247
|
*/
|
|
229
|
-
|
|
248
|
+
extensions: Array<BlockNoteExtension | BlockNoteExtensionFactory>;
|
|
230
249
|
/**
|
|
231
250
|
* Boolean indicating whether the editor is in headless mode.
|
|
232
251
|
* Headless mode means we can use features like importing / exporting blocks,
|
|
@@ -247,7 +266,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
247
266
|
/**
|
|
248
267
|
* extensions that are added to the editor, can be tiptap extensions or prosemirror plugins
|
|
249
268
|
*/
|
|
250
|
-
|
|
269
|
+
extensions: Record<string, SupportedExtension>;
|
|
251
270
|
/**
|
|
252
271
|
* Boolean indicating whether the editor is in headless mode.
|
|
253
272
|
* Headless mode means we can use features like importing / exporting blocks,
|
|
@@ -290,7 +309,10 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
290
309
|
readonly tableHandles?: TableHandlesProsemirrorPlugin<ISchema, SSchema>;
|
|
291
310
|
readonly comments?: CommentsPlugin;
|
|
292
311
|
private readonly showSelectionPlugin;
|
|
293
|
-
|
|
312
|
+
/**
|
|
313
|
+
* The plugin for forking a document, only defined if in collaboration mode
|
|
314
|
+
*/
|
|
315
|
+
readonly forkYDocPlugin?: ForkYDocPlugin;
|
|
294
316
|
/**
|
|
295
317
|
* The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).
|
|
296
318
|
* This method should set when creating the editor as this is application-specific.
|
|
@@ -374,6 +396,17 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
374
396
|
* If another `transact` call is made within the callback, it will be passed the same transaction as the parent call.
|
|
375
397
|
*/
|
|
376
398
|
tr: Transaction) => T): T;
|
|
399
|
+
/**
|
|
400
|
+
* Shorthand to get a typed extension from the editor, by
|
|
401
|
+
* just passing in the extension class.
|
|
402
|
+
*
|
|
403
|
+
* @param ext - The extension class to get
|
|
404
|
+
* @param key - optional, the key of the extension in the extensions object (defaults to the extension name)
|
|
405
|
+
* @returns The extension instance
|
|
406
|
+
*/
|
|
407
|
+
extension<T extends BlockNoteExtension>(ext: {
|
|
408
|
+
new (...args: any[]): T;
|
|
409
|
+
} & typeof BlockNoteExtension, key?: string): T;
|
|
377
410
|
/**
|
|
378
411
|
* Mount the editor to a parent DOM element. Call mount(undefined) to clean up
|
|
379
412
|
*
|
|
@@ -473,9 +506,28 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
473
506
|
*/
|
|
474
507
|
setTextCursorPosition(targetBlock: BlockIdentifier, placement?: "start" | "end"): void;
|
|
475
508
|
/**
|
|
476
|
-
* Gets a snapshot of the current selection.
|
|
509
|
+
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
510
|
+
* that the selection spans across.
|
|
511
|
+
*
|
|
512
|
+
* If the selection starts / ends halfway through a block, the returned data will contain the entire block.
|
|
477
513
|
*/
|
|
478
514
|
getSelection(): Selection<BSchema, ISchema, SSchema> | undefined;
|
|
515
|
+
/**
|
|
516
|
+
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
517
|
+
* that the selection spans across.
|
|
518
|
+
*
|
|
519
|
+
* If the selection starts / ends halfway through a block, the returned block will be
|
|
520
|
+
* only the part of the block that is included in the selection.
|
|
521
|
+
*/
|
|
522
|
+
getSelectionCutBlocks(): {
|
|
523
|
+
blocks: Block<Record<string, import("../index.js").BlockConfig>, InlineContentSchema, StyleSchema>[];
|
|
524
|
+
blockCutAtStart: string | undefined;
|
|
525
|
+
blockCutAtEnd: string | undefined;
|
|
526
|
+
_meta: {
|
|
527
|
+
startPos: number;
|
|
528
|
+
endPos: number;
|
|
529
|
+
};
|
|
530
|
+
};
|
|
479
531
|
/**
|
|
480
532
|
* Sets the selection to a range of blocks.
|
|
481
533
|
* @param startBlock The identifier of the block that should be the start of the selection.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin } from "prosemirror-state";
|
|
2
|
+
import { EventEmitter } from "../util/EventEmitter.js";
|
|
3
|
+
export declare abstract class BlockNoteExtension<TEvent extends Record<string, any> = any> extends EventEmitter<TEvent> {
|
|
4
|
+
static key(): string;
|
|
5
|
+
protected addProsemirrorPlugin(plugin: Plugin): void;
|
|
6
|
+
readonly plugins: Plugin[];
|
|
7
|
+
get priority(): number | undefined;
|
|
8
|
+
constructor(..._args: any[]);
|
|
9
|
+
}
|
|
@@ -2,7 +2,7 @@ import { Plugin } from "prosemirror-state";
|
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
import type { ThreadStore } from "../comments/index.js";
|
|
4
4
|
import { BlockNoteDOMAttributes, BlockSchema, BlockSpecs, InlineContentSchema, InlineContentSpecs, StyleSchema, StyleSpecs } from "../schema/index.js";
|
|
5
|
-
import type { BlockNoteEditor, BlockNoteEditorOptions,
|
|
5
|
+
import type { BlockNoteEditor, BlockNoteEditorOptions, SupportedExtension } from "./BlockNoteEditor.js";
|
|
6
6
|
type ExtensionOptions<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = {
|
|
7
7
|
editor: BlockNoteEditor<BSchema, I, S>;
|
|
8
8
|
domAttributes: Partial<BlockNoteDOMAttributes>;
|
|
@@ -37,5 +37,5 @@ type ExtensionOptions<BSchema extends BlockSchema, I extends InlineContentSchema
|
|
|
37
37
|
/**
|
|
38
38
|
* Get all the Tiptap extensions BlockNote is configured with by default
|
|
39
39
|
*/
|
|
40
|
-
export declare const getBlockNoteExtensions: <BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(opts: ExtensionOptions<BSchema, I, S>) => Record<string,
|
|
40
|
+
export declare const getBlockNoteExtensions: <BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(opts: ExtensionOptions<BSchema, I, S>) => Record<string, SupportedExtension>;
|
|
41
41
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Editor, EditorOptions } from "@tiptap/core";
|
|
2
|
-
import { Editor as TiptapEditor } from "@tiptap/core";
|
|
1
|
+
import { Editor, EditorOptions, Editor as TiptapEditor } from "@tiptap/core";
|
|
3
2
|
import { EditorState, Transaction } from "@tiptap/pm/state";
|
|
4
3
|
import { PartialBlock } from "../blocks/defaultBlocks.js";
|
|
5
4
|
import { StyleSchema } from "../schema/index.js";
|
|
@@ -17,6 +16,7 @@ export declare class BlockNoteTipTapEditor extends TiptapEditor {
|
|
|
17
16
|
protected constructor(options: BlockNoteTipTapEditorOptions, styleSchema: StyleSchema);
|
|
18
17
|
get state(): EditorState;
|
|
19
18
|
dispatch(transaction: Transaction): void;
|
|
19
|
+
forceEnablePlugins(): void;
|
|
20
20
|
/**
|
|
21
21
|
* Replace the default `createView` method with a custom one - which we call on mount
|
|
22
22
|
*/
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Plugin } from "prosemirror-state";
|
|
2
1
|
import { Awareness } from "y-protocols/awareness.js";
|
|
3
2
|
import * as Y from "yjs";
|
|
3
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
4
4
|
export type CollaborationUser = {
|
|
5
5
|
name: string;
|
|
6
6
|
color: string;
|
|
7
7
|
[key: string]: string;
|
|
8
8
|
};
|
|
9
|
-
export declare class CursorPlugin {
|
|
9
|
+
export declare class CursorPlugin extends BlockNoteExtension {
|
|
10
10
|
private collaboration;
|
|
11
|
-
|
|
11
|
+
static key(): string;
|
|
12
12
|
private provider;
|
|
13
13
|
private recentlyUpdatedCursors;
|
|
14
14
|
constructor(collaboration: {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BlockNoteEditor, BlockNoteEditorOptions } from "../../editor/BlockNoteEditor.js";
|
|
2
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
3
|
+
export declare class ForkYDocPlugin extends BlockNoteExtension<{
|
|
4
|
+
forked: boolean;
|
|
5
|
+
}> {
|
|
6
|
+
static key(): string;
|
|
7
|
+
private editor;
|
|
8
|
+
private collaboration;
|
|
9
|
+
constructor({ editor, collaboration, }: {
|
|
10
|
+
editor: BlockNoteEditor<any, any, any>;
|
|
11
|
+
collaboration: BlockNoteEditorOptions<any, any, any>["collaboration"];
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* To find a fragment in another ydoc, we need to search for it.
|
|
15
|
+
*/
|
|
16
|
+
private findTypeInOtherYdoc;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the editor is editing a forked document,
|
|
19
|
+
* preserving a reference to the original document and the forked document.
|
|
20
|
+
*/
|
|
21
|
+
get isForkedFromRemote(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Stores whether the editor is editing a forked document,
|
|
24
|
+
* preserving a reference to the original document and the forked document.
|
|
25
|
+
*/
|
|
26
|
+
private forkedState;
|
|
27
|
+
/**
|
|
28
|
+
* Fork the Y.js document from syncing to the remote,
|
|
29
|
+
* allowing modifications to the document without affecting the remote.
|
|
30
|
+
* These changes can later be rolled back or applied to the remote.
|
|
31
|
+
*/
|
|
32
|
+
fork(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Resume syncing the Y.js document to the remote
|
|
35
|
+
* If `keepChanges` is true, any changes that have been made to the forked document will be applied to the original document.
|
|
36
|
+
* Otherwise, the original document will be restored and the changes will be discarded.
|
|
37
|
+
*/
|
|
38
|
+
merge({ keepChanges }: {
|
|
39
|
+
keepChanges: boolean;
|
|
40
|
+
}): void;
|
|
41
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Plugin } from "prosemirror-state";
|
|
2
1
|
import type * as Y from "yjs";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
3
|
+
export declare class SyncPlugin extends BlockNoteExtension {
|
|
4
|
+
static key(): string;
|
|
5
5
|
constructor(fragment: Y.XmlFragment);
|
|
6
6
|
get priority(): number;
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class UndoPlugin {
|
|
3
|
-
|
|
1
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
2
|
+
export declare class UndoPlugin extends BlockNoteExtension {
|
|
3
|
+
static key(): string;
|
|
4
4
|
constructor();
|
|
5
5
|
get priority(): number;
|
|
6
6
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Plugin } from "prosemirror-state";
|
|
2
1
|
import type { CommentBody, ThreadStore, User } from "../../comments/index.js";
|
|
3
2
|
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
4
|
-
import {
|
|
3
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
5
4
|
import { UserStore } from "./userstore/UserStore.js";
|
|
6
|
-
export declare class CommentsPlugin extends
|
|
5
|
+
export declare class CommentsPlugin extends BlockNoteExtension {
|
|
7
6
|
private readonly editor;
|
|
8
7
|
readonly threadStore: ThreadStore;
|
|
9
8
|
private readonly markType;
|
|
10
|
-
|
|
9
|
+
static key(): string;
|
|
11
10
|
readonly userStore: UserStore<User>;
|
|
12
11
|
/**
|
|
13
12
|
* Whether a comment is currently being composed
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { EditorState,
|
|
1
|
+
import { EditorState, PluginKey, PluginView } from "prosemirror-state";
|
|
2
2
|
import { EditorView } from "prosemirror-view";
|
|
3
3
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
4
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
4
5
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
|
|
5
6
|
import type { BlockFromConfig, FileBlockConfig, InlineContentSchema, StyleSchema } from "../../schema/index.js";
|
|
6
|
-
import { EventEmitter } from "../../util/EventEmitter.js";
|
|
7
7
|
export type FilePanelState<I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
|
|
8
8
|
block: BlockFromConfig<FileBlockConfig, I, S>;
|
|
9
9
|
};
|
|
@@ -21,9 +21,9 @@ export declare class FilePanelView<I extends InlineContentSchema, S extends Styl
|
|
|
21
21
|
closeMenu: () => void;
|
|
22
22
|
destroy(): void;
|
|
23
23
|
}
|
|
24
|
-
export declare class FilePanelProsemirrorPlugin<I extends InlineContentSchema, S extends StyleSchema> extends
|
|
24
|
+
export declare class FilePanelProsemirrorPlugin<I extends InlineContentSchema, S extends StyleSchema> extends BlockNoteExtension {
|
|
25
|
+
static key(): string;
|
|
25
26
|
private view;
|
|
26
|
-
readonly plugin: Plugin;
|
|
27
27
|
constructor(editor: BlockNoteEditor<Record<string, FileBlockConfig>, I, S>);
|
|
28
28
|
get shown(): boolean;
|
|
29
29
|
onUpdate(callback: (state: FilePanelState<I, S>) => void): () => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { EditorState,
|
|
1
|
+
import { EditorState, PluginKey, PluginView } from "prosemirror-state";
|
|
2
2
|
import { EditorView } from "prosemirror-view";
|
|
3
3
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
4
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
4
5
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
|
|
5
6
|
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema/index.js";
|
|
6
|
-
import { EventEmitter } from "../../util/EventEmitter.js";
|
|
7
7
|
export type FormattingToolbarState = UiElementPosition;
|
|
8
8
|
export declare class FormattingToolbarView implements PluginView {
|
|
9
9
|
private readonly editor;
|
|
@@ -20,7 +20,8 @@ export declare class FormattingToolbarView implements PluginView {
|
|
|
20
20
|
}) => boolean;
|
|
21
21
|
constructor(editor: BlockNoteEditor<BlockSchema, InlineContentSchema, StyleSchema>, pmView: EditorView, emitUpdate: (state: FormattingToolbarState) => void);
|
|
22
22
|
blurHandler: (event: FocusEvent) => void;
|
|
23
|
-
|
|
23
|
+
isElementWithinEditorWrapper: (element: Node | null) => boolean;
|
|
24
|
+
viewMousedownHandler: (e: MouseEvent) => void;
|
|
24
25
|
mouseupHandler: () => void;
|
|
25
26
|
dragHandler: () => void;
|
|
26
27
|
scrollHandler: () => void;
|
|
@@ -30,9 +31,9 @@ export declare class FormattingToolbarView implements PluginView {
|
|
|
30
31
|
getSelectionBoundingBox(): DOMRect;
|
|
31
32
|
}
|
|
32
33
|
export declare const formattingToolbarPluginKey: PluginKey<any>;
|
|
33
|
-
export declare class FormattingToolbarProsemirrorPlugin extends
|
|
34
|
+
export declare class FormattingToolbarProsemirrorPlugin extends BlockNoteExtension {
|
|
35
|
+
static key(): string;
|
|
34
36
|
private view;
|
|
35
|
-
readonly plugin: Plugin;
|
|
36
37
|
constructor(editor: BlockNoteEditor<any, any, any>);
|
|
37
38
|
get shown(): boolean;
|
|
38
39
|
onUpdate(callback: (state: FormattingToolbarState) => void): () => void;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PluginKey } from "prosemirror-state";
|
|
2
2
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
3
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
3
4
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
|
|
4
5
|
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema/index.js";
|
|
5
|
-
import { EventEmitter } from "../../util/EventEmitter.js";
|
|
6
6
|
export type LinkToolbarState = UiElementPosition & {
|
|
7
7
|
url: string;
|
|
8
8
|
text: string;
|
|
9
9
|
};
|
|
10
10
|
export declare const linkToolbarPluginKey: PluginKey<any>;
|
|
11
|
-
export declare class LinkToolbarProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends
|
|
11
|
+
export declare class LinkToolbarProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends BlockNoteExtension {
|
|
12
|
+
static key(): string;
|
|
12
13
|
private view;
|
|
13
|
-
readonly plugin: Plugin;
|
|
14
14
|
constructor(editor: BlockNoteEditor<BSchema, I, S>);
|
|
15
15
|
onUpdate(callback: (state: LinkToolbarState) => void): () => void;
|
|
16
16
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class NodeSelectionKeyboardPlugin {
|
|
3
|
-
|
|
1
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
2
|
+
export declare class NodeSelectionKeyboardPlugin extends BlockNoteExtension {
|
|
3
|
+
static key(): string;
|
|
4
4
|
constructor();
|
|
5
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Plugin } from "prosemirror-state";
|
|
2
1
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
3
|
+
export declare class PlaceholderPlugin extends BlockNoteExtension {
|
|
4
|
+
static key(): string;
|
|
5
5
|
constructor(editor: BlockNoteEditor<any, any, any>, placeholders: Record<string | "default" | "emptyDocument", string | undefined>);
|
|
6
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
2
2
|
/**
|
|
3
3
|
* This plugin tracks transformation of Block node attributes, so we can support CSS transitions.
|
|
4
4
|
*
|
|
@@ -7,7 +7,7 @@ import { Plugin } from "prosemirror-state";
|
|
|
7
7
|
*
|
|
8
8
|
* Solution: When attributes change on a node, this plugin sets a data-* attribute with the "previous" value. This way we can still use CSS transitions. (See block.module.css)
|
|
9
9
|
*/
|
|
10
|
-
export declare class PreviousBlockTypePlugin {
|
|
11
|
-
|
|
10
|
+
export declare class PreviousBlockTypePlugin extends BlockNoteExtension {
|
|
11
|
+
static key(): string;
|
|
12
12
|
constructor();
|
|
13
13
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Plugin } from "prosemirror-state";
|
|
2
1
|
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
2
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
3
3
|
/**
|
|
4
4
|
* Plugin that shows adds a decoration around the current selection
|
|
5
5
|
* This can be used to highlight the current selection in the UI even when the
|
|
6
6
|
* text editor is not focused.
|
|
7
7
|
*/
|
|
8
|
-
export declare class ShowSelectionPlugin {
|
|
8
|
+
export declare class ShowSelectionPlugin extends BlockNoteExtension {
|
|
9
9
|
private readonly editor;
|
|
10
|
-
|
|
10
|
+
static key(): string;
|
|
11
11
|
private enabled;
|
|
12
12
|
constructor(editor: BlockNoteEditor<any, any, any>);
|
|
13
13
|
setEnabled(enabled: boolean): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { EditorState,
|
|
1
|
+
import { EditorState, PluginKey, PluginView } from "@tiptap/pm/state";
|
|
2
2
|
import { EditorView } from "@tiptap/pm/view";
|
|
3
3
|
import { Block } from "../../blocks/defaultBlocks.js";
|
|
4
4
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
5
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
5
6
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
|
|
6
7
|
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema/index.js";
|
|
7
|
-
import { EventEmitter } from "../../util/EventEmitter.js";
|
|
8
8
|
export type SideMenuState<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> = UiElementPosition & {
|
|
9
9
|
block: Block<BSchema, I, S>;
|
|
10
10
|
};
|
|
@@ -59,10 +59,10 @@ export declare class SideMenuView<BSchema extends BlockSchema, I extends InlineC
|
|
|
59
59
|
destroy(): void;
|
|
60
60
|
}
|
|
61
61
|
export declare const sideMenuPluginKey: PluginKey<any>;
|
|
62
|
-
export declare class SideMenuProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends
|
|
62
|
+
export declare class SideMenuProsemirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends BlockNoteExtension {
|
|
63
63
|
private readonly editor;
|
|
64
|
+
static key(): string;
|
|
64
65
|
view: SideMenuView<BSchema, I, S> | undefined;
|
|
65
|
-
readonly plugin: Plugin;
|
|
66
66
|
constructor(editor: BlockNoteEditor<BSchema, I, S>, sideMenuDetection: "viewport" | "editor");
|
|
67
67
|
onUpdate(callback: (state: SideMenuState<BSchema, I, S>) => void): () => void;
|
|
68
68
|
/**
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Plugin } from "prosemirror-state";
|
|
2
1
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
2
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
3
3
|
import { UiElementPosition } from "../../extensions-shared/UiElementPosition.js";
|
|
4
4
|
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../schema/index.js";
|
|
5
|
-
import { EventEmitter } from "../../util/EventEmitter.js";
|
|
6
5
|
export type SuggestionMenuState = UiElementPosition & {
|
|
7
6
|
query: string;
|
|
8
7
|
ignoreQueryLength?: boolean;
|
|
@@ -17,9 +16,9 @@ export type SuggestionMenuState = UiElementPosition & {
|
|
|
17
16
|
* - This version hides some unnecessary complexity from the user of the plugin.
|
|
18
17
|
* - This version handles key events differently
|
|
19
18
|
*/
|
|
20
|
-
export declare class SuggestionMenuProseMirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends
|
|
19
|
+
export declare class SuggestionMenuProseMirrorPlugin<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema> extends BlockNoteExtension {
|
|
20
|
+
static key(): string;
|
|
21
21
|
private view;
|
|
22
|
-
readonly plugin: Plugin;
|
|
23
22
|
private triggerCharacters;
|
|
24
23
|
constructor(editor: BlockNoteEditor<BSchema, I, S>);
|
|
25
24
|
onUpdate(triggerCharacter: string, callback: (state: SuggestionMenuState) => void): () => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PluginKey, PluginView } from "prosemirror-state";
|
|
2
2
|
import { EditorView } from "prosemirror-view";
|
|
3
3
|
import { RelativeCellIndices } from "../../api/blockManipulation/tables/tables.js";
|
|
4
4
|
import { DefaultBlockSchema } from "../../blocks/defaultBlocks.js";
|
|
5
5
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
6
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
6
7
|
import { BlockFromConfigNoChildren, BlockSchemaWithBlock, InlineContentSchema, StyleSchema } from "../../schema/index.js";
|
|
7
|
-
import { EventEmitter } from "../../util/EventEmitter.js";
|
|
8
8
|
export type TableHandlesState<I extends InlineContentSchema, S extends StyleSchema> = {
|
|
9
9
|
show: boolean;
|
|
10
10
|
showAddOrRemoveRowsButton: boolean;
|
|
@@ -42,10 +42,10 @@ export declare class TableHandlesView<I extends InlineContentSchema, S extends S
|
|
|
42
42
|
destroy(): void;
|
|
43
43
|
}
|
|
44
44
|
export declare const tableHandlesPluginKey: PluginKey<any>;
|
|
45
|
-
export declare class TableHandlesProsemirrorPlugin<I extends InlineContentSchema, S extends StyleSchema> extends
|
|
45
|
+
export declare class TableHandlesProsemirrorPlugin<I extends InlineContentSchema, S extends StyleSchema> extends BlockNoteExtension {
|
|
46
46
|
private readonly editor;
|
|
47
|
+
static key(): string;
|
|
47
48
|
private view;
|
|
48
|
-
readonly plugin: Plugin;
|
|
49
49
|
constructor(editor: BlockNoteEditor<BlockSchemaWithBlock<"table", DefaultBlockSchema["table"]>, I, S>);
|
|
50
50
|
onUpdate(callback: (state: TableHandlesState<I, S>) => void): () => void;
|
|
51
51
|
/**
|
|
@@ -138,9 +138,9 @@ export declare class TableHandlesProsemirrorPlugin<I extends InlineContentSchema
|
|
|
138
138
|
*/
|
|
139
139
|
getMergeDirection: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any> | undefined) => "vertical" | "horizontal" | undefined;
|
|
140
140
|
cropEmptyRowsOrColumns: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, removeEmpty: "columns" | "rows") => {
|
|
141
|
-
cells: (import("../../index.js").
|
|
141
|
+
cells: (import("../../index.js").CustomInlineContentFromConfig<any, any> | import("../../index.js").StyledText<any> | import("../../index.js").Link<any>)[][] | import("../../index.js").TableCell<any, any>[];
|
|
142
142
|
}[];
|
|
143
143
|
addRowsOrColumns: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, addType: "columns" | "rows", numToAdd: number) => {
|
|
144
|
-
cells: (import("../../index.js").
|
|
144
|
+
cells: (import("../../index.js").CustomInlineContentFromConfig<any, any> | import("../../index.js").StyledText<any> | import("../../index.js").Link<any>)[][] | import("../../index.js").TableCell<any, any>[];
|
|
145
145
|
}[];
|
|
146
146
|
}
|