@blocknote/core 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.cjs +9 -9
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +2771 -2245
- package/dist/blocknote.js.map +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.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/webpack-stats.json +1 -1
- package/package.json +8 -7
- package/src/api/README.md +1 -1
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +19 -14
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +7 -8
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +12 -12
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +14 -14
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +16 -16
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +8 -8
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +12 -12
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +8 -8
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +10 -10
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +2 -2
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2816 -0
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +200 -42
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +104 -34
- package/src/api/blockManipulation/getBlock/getBlock.ts +9 -9
- package/src/api/blockManipulation/insertContentAt.ts +1 -1
- package/src/api/blockManipulation/selections/selection.ts +59 -12
- package/src/api/blockManipulation/selections/{textCursorPosition/textCursorPosition.ts → textCursorPosition.ts} +13 -13
- package/src/api/blockManipulation/tables/tables.test.ts +106 -106
- package/src/api/blockManipulation/tables/tables.ts +35 -35
- package/src/api/clipboard/fromClipboard/fileDropExtension.ts +2 -2
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +9 -9
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +3 -3
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +3 -3
- package/src/api/clipboard/toClipboard/copyExtension.ts +22 -22
- package/src/api/exporters/html/externalHTMLExporter.ts +6 -6
- package/src/api/exporters/html/internalHTMLSerializer.ts +3 -3
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +16 -16
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +14 -14
- package/src/api/exporters/markdown/markdownExporter.ts +3 -3
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +3 -3
- package/src/api/getBlockInfoFromPos.ts +6 -6
- package/src/api/nodeConversions/blockToNode.ts +31 -28
- package/src/api/nodeConversions/fragmentToBlocks.ts +1 -1
- package/src/api/nodeConversions/nodeToBlock.ts +240 -41
- package/src/api/nodeUtil.test.ts +16 -16
- package/src/api/nodeUtil.ts +10 -10
- package/src/api/parsers/html/parseHTML.ts +1 -1
- package/src/api/parsers/html/util/nestedLists.ts +2 -2
- package/src/api/parsers/markdown/parseMarkdown.ts +1 -1
- package/src/api/pmUtil.ts +7 -7
- package/src/api/positionMapping.test.ts +3 -3
- package/src/api/positionMapping.ts +5 -5
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +4 -4
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +18 -18
- package/src/blocks/FileBlockContent/FileBlockContent.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +6 -6
- package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +1 -1
- package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +7 -7
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +1 -1
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +1 -1
- package/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +2 -2
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +6 -6
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +4 -4
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +4 -4
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +10 -10
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +4 -4
- package/src/blocks/ListItemBlockContent/getListItemContent.ts +5 -5
- package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +1 -1
- package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +3 -3
- package/src/blocks/PageBreakBlockContent/schema.ts +2 -2
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +3 -3
- package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +4 -4
- package/src/blocks/README.md +1 -1
- package/src/blocks/TableBlockContent/TableBlockContent.ts +37 -7
- package/src/blocks/TableBlockContent/TableExtension.ts +3 -3
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +4 -4
- package/src/blocks/defaultBlockHelpers.ts +8 -8
- package/src/blocks/defaultBlockTypeGuards.ts +16 -16
- package/src/blocks/defaultBlocks.ts +3 -3
- package/src/comments/threadstore/DefaultThreadStoreAuth.ts +3 -3
- package/src/comments/threadstore/ThreadStore.ts +1 -1
- package/src/comments/threadstore/TipTapThreadStore.ts +10 -10
- package/src/comments/threadstore/yjs/RESTYjsThreadStore.ts +4 -4
- package/src/comments/threadstore/yjs/YjsThreadStore.test.ts +2 -2
- package/src/comments/threadstore/yjs/YjsThreadStore.ts +14 -14
- package/src/comments/threadstore/yjs/YjsThreadStoreBase.ts +1 -1
- package/src/comments/threadstore/yjs/yjsHelpers.ts +6 -6
- package/src/editor/Block.css +35 -1
- package/src/editor/BlockNoteEditor.test.ts +10 -3
- package/src/editor/BlockNoteEditor.ts +95 -38
- package/src/editor/BlockNoteExtension.ts +26 -0
- package/src/editor/BlockNoteExtensions.ts +38 -22
- package/src/editor/BlockNoteSchema.ts +4 -4
- package/src/editor/BlockNoteTipTapEditor.ts +33 -12
- package/src/editor/README.md +1 -1
- package/src/editor/cursorPositionTypes.ts +1 -1
- package/src/editor/editor.css +15 -3
- package/src/editor/selectionTypes.ts +1 -1
- package/src/editor/transformPasted.ts +2 -2
- package/src/exporter/Exporter.ts +5 -5
- package/src/exporter/mapping.ts +7 -7
- package/src/extensions/BackgroundColor/BackgroundColorMark.ts +1 -1
- package/src/extensions/Collaboration/CursorPlugin.ts +15 -9
- 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 +80 -75
- package/src/extensions/Comments/userstore/UserStore.ts +2 -2
- package/src/extensions/FilePanel/FilePanelPlugin.ts +56 -55
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +60 -30
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +26 -26
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +33 -32
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +45 -42
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +113 -110
- package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +179 -170
- package/src/extensions/README.md +1 -1
- package/src/extensions/ShowSelection/ShowSelectionPlugin.ts +22 -19
- package/src/extensions/SideMenu/MultipleNodeSelection.ts +1 -1
- package/src/extensions/SideMenu/SideMenuPlugin.ts +49 -48
- package/src/extensions/SideMenu/dragging.ts +8 -8
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +176 -176
- package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -2
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +16 -16
- package/src/extensions/Suggestions/SuggestionMarks.ts +175 -0
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +199 -195
- package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
- package/src/extensions/UniqueID/UniqueID.ts +6 -6
- package/src/extensions/getDraggableBlockFromElement.ts +1 -1
- package/src/fonts/inter.css +18 -9
- 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/locales.ts +1 -1
- package/src/pm-nodes/BlockContainer.ts +1 -1
- package/src/pm-nodes/BlockGroup.ts +2 -2
- package/src/pm-nodes/Doc.ts +5 -4
- package/src/schema/README.md +1 -1
- package/src/schema/blocks/createSpec.ts +14 -14
- package/src/schema/blocks/internal.ts +17 -17
- package/src/schema/blocks/types.ts +25 -25
- package/src/schema/inlineContent/createSpec.ts +16 -20
- package/src/schema/inlineContent/internal.ts +9 -9
- package/src/schema/inlineContent/types.ts +26 -26
- package/src/schema/propTypes.ts +8 -8
- package/src/schema/styles/createSpec.ts +2 -2
- package/src/schema/styles/internal.ts +7 -7
- package/src/schema/styles/types.ts +2 -2
- package/src/util/EventEmitter.ts +4 -4
- package/src/util/README.md +1 -1
- package/src/util/combineByGroup.ts +1 -1
- package/src/util/table.ts +33 -30
- package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.d.ts +1 -1
- package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.d.ts +4 -0
- package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.d.ts +1 -0
- 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.d.ts +5 -0
- package/types/src/api/blockManipulation/transactions.test.d.ts +0 -0
- package/types/src/api/clipboard/clipboardExternal.test.d.ts +1 -0
- package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
- package/types/src/api/clipboard/testUtil.d.ts +541 -0
- package/types/src/api/exporters/html/htmlConversion.test.d.ts +1 -0
- package/types/src/api/exporters/markdown/markdownExporter.test.d.ts +1 -0
- package/types/src/api/nodeConversions/nodeConversions.test.d.ts +1 -0
- package/types/src/api/nodeConversions/nodeToBlock.d.ts +39 -2
- package/types/src/api/parsers/html/parseHTML.test.d.ts +1 -0
- package/types/src/api/parsers/markdown/parseMarkdown.test.d.ts +1 -0
- package/types/src/api/pmUtil.d.ts +3 -3
- package/types/src/api/testUtil/cases/customBlocks.d.ts +670 -0
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +558 -0
- package/types/src/api/testUtil/cases/customStyles.d.ts +552 -0
- package/types/src/api/testUtil/cases/defaultSchema.d.ts +4 -0
- package/types/src/api/testUtil/index.d.ts +14 -0
- package/types/src/api/testUtil/partialBlockTestUtil.d.ts +9 -0
- package/types/src/api/testUtil/paste.d.ts +2 -0
- package/types/src/blocks/CodeBlockContent/defaultSupportedLanguages.d.ts +6 -0
- package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +9 -1
- package/types/src/editor/BlockNoteEditor.d.ts +58 -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/ForkYDocPlugin.test.d.ts +1 -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/Collaboration/createCollaborationExtensions.d.ts +17 -0
- package/types/src/extensions/Comments/CommentsPlugin.d.ts +2 -4
- package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +3 -4
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -5
- package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +3 -4
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +2 -3
- package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +2 -3
- package/types/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.d.ts +2 -3
- package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +2 -3
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +3 -4
- package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +2 -4
- package/types/src/extensions/Suggestions/SuggestionMarks.d.ts +4 -0
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +5 -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/dist/tsconfig.tsbuildinfo +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
|
@@ -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,15 @@ 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
|
|
228
237
|
*/
|
|
229
238
|
_extensions: Record<string, BlockNoteExtension | BlockNoteExtensionFactory>;
|
|
239
|
+
/**
|
|
240
|
+
* Register
|
|
241
|
+
*/
|
|
242
|
+
extensions: Array<BlockNoteExtension | BlockNoteExtensionFactory>;
|
|
230
243
|
/**
|
|
231
244
|
* Boolean indicating whether the editor is in headless mode.
|
|
232
245
|
* Headless mode means we can use features like importing / exporting blocks,
|
|
@@ -247,7 +260,7 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
247
260
|
/**
|
|
248
261
|
* extensions that are added to the editor, can be tiptap extensions or prosemirror plugins
|
|
249
262
|
*/
|
|
250
|
-
|
|
263
|
+
extensions: Record<string, SupportedExtension>;
|
|
251
264
|
/**
|
|
252
265
|
* Boolean indicating whether the editor is in headless mode.
|
|
253
266
|
* Headless mode means we can use features like importing / exporting blocks,
|
|
@@ -290,7 +303,10 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
290
303
|
readonly tableHandles?: TableHandlesProsemirrorPlugin<ISchema, SSchema>;
|
|
291
304
|
readonly comments?: CommentsPlugin;
|
|
292
305
|
private readonly showSelectionPlugin;
|
|
293
|
-
|
|
306
|
+
/**
|
|
307
|
+
* The plugin for forking a document, only defined if in collaboration mode
|
|
308
|
+
*/
|
|
309
|
+
readonly forkYDocPlugin?: ForkYDocPlugin;
|
|
294
310
|
/**
|
|
295
311
|
* The `uploadFile` method is what the editor uses when files need to be uploaded (for example when selecting an image to upload).
|
|
296
312
|
* This method should set when creating the editor as this is application-specific.
|
|
@@ -374,6 +390,17 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
374
390
|
* If another `transact` call is made within the callback, it will be passed the same transaction as the parent call.
|
|
375
391
|
*/
|
|
376
392
|
tr: Transaction) => T): T;
|
|
393
|
+
/**
|
|
394
|
+
* Shorthand to get a typed extension from the editor, by
|
|
395
|
+
* just passing in the extension class.
|
|
396
|
+
*
|
|
397
|
+
* @param ext - The extension class to get
|
|
398
|
+
* @param key - optional, the key of the extension in the extensions object (defaults to the extension name)
|
|
399
|
+
* @returns The extension instance
|
|
400
|
+
*/
|
|
401
|
+
extension<T extends BlockNoteExtension>(ext: {
|
|
402
|
+
new (...args: any[]): T;
|
|
403
|
+
} & typeof BlockNoteExtension, key?: string): T;
|
|
377
404
|
/**
|
|
378
405
|
* Mount the editor to a parent DOM element. Call mount(undefined) to clean up
|
|
379
406
|
*
|
|
@@ -473,9 +500,28 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
473
500
|
*/
|
|
474
501
|
setTextCursorPosition(targetBlock: BlockIdentifier, placement?: "start" | "end"): void;
|
|
475
502
|
/**
|
|
476
|
-
* Gets a snapshot of the current selection.
|
|
503
|
+
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
504
|
+
* that the selection spans across.
|
|
505
|
+
*
|
|
506
|
+
* If the selection starts / ends halfway through a block, the returned data will contain the entire block.
|
|
477
507
|
*/
|
|
478
508
|
getSelection(): Selection<BSchema, ISchema, SSchema> | undefined;
|
|
509
|
+
/**
|
|
510
|
+
* Gets a snapshot of the current selection. This contains all blocks (included nested blocks)
|
|
511
|
+
* that the selection spans across.
|
|
512
|
+
*
|
|
513
|
+
* If the selection starts / ends halfway through a block, the returned block will be
|
|
514
|
+
* only the part of the block that is included in the selection.
|
|
515
|
+
*/
|
|
516
|
+
getSelectionCutBlocks(): {
|
|
517
|
+
blocks: Block<Record<string, import("../index.js").BlockConfig>, InlineContentSchema, StyleSchema>[];
|
|
518
|
+
blockCutAtStart: string | undefined;
|
|
519
|
+
blockCutAtEnd: string | undefined;
|
|
520
|
+
_meta: {
|
|
521
|
+
startPos: number;
|
|
522
|
+
endPos: number;
|
|
523
|
+
};
|
|
524
|
+
};
|
|
479
525
|
/**
|
|
480
526
|
* Sets the selection to a range of blocks.
|
|
481
527
|
* @param startBlock The identifier of the block that should be the start of the selection.
|
|
@@ -538,7 +584,9 @@ export declare class BlockNoteEditor<BSchema extends BlockSchema = DefaultBlockS
|
|
|
538
584
|
*
|
|
539
585
|
* @param content can be a string, or array of partial inline content elements
|
|
540
586
|
*/
|
|
541
|
-
insertInlineContent(content: PartialInlineContent<ISchema, SSchema
|
|
587
|
+
insertInlineContent(content: PartialInlineContent<ISchema, SSchema>, { updateSelection }?: {
|
|
588
|
+
updateSelection?: boolean;
|
|
589
|
+
}): void;
|
|
542
590
|
/**
|
|
543
591
|
* Gets the active text styles at the text cursor position or at the end of the current selection if it's active.
|
|
544
592
|
*/
|
|
@@ -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 name(): 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 name(): 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 name(): 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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 name(): 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 name(): string;
|
|
4
4
|
constructor();
|
|
5
5
|
get priority(): number;
|
|
6
6
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
export declare const createCollaborationExtensions: (collaboration: {
|
|
3
|
+
fragment: Y.XmlFragment;
|
|
4
|
+
user: {
|
|
5
|
+
name: string;
|
|
6
|
+
color: string;
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
};
|
|
9
|
+
provider: any;
|
|
10
|
+
renderCursor?: (user: any) => HTMLElement;
|
|
11
|
+
showCursorLabels?: "always" | "activity";
|
|
12
|
+
}) => (import("@tiptap/core").Extension<import("@tiptap/extension-collaboration").CollaborationOptions, import("@tiptap/extension-collaboration").CollaborationStorage> | import("@tiptap/core").Extension<import("@tiptap/extension-collaboration-cursor").CollaborationCursorOptions, {
|
|
13
|
+
users: {
|
|
14
|
+
clientId: number;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}[];
|
|
17
|
+
}>)[];
|
|
@@ -1,13 +1,11 @@
|
|
|
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
|
-
readonly plugin: Plugin;
|
|
11
9
|
readonly userStore: UserStore<User>;
|
|
12
10
|
/**
|
|
13
11
|
* 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,8 @@ 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
25
|
private view;
|
|
26
|
-
readonly plugin: Plugin;
|
|
27
26
|
constructor(editor: BlockNoteEditor<Record<string, FileBlockConfig>, I, S>);
|
|
28
27
|
get shown(): boolean;
|
|
29
28
|
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,8 @@ 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 {
|
|
34
35
|
private view;
|
|
35
|
-
readonly plugin: Plugin;
|
|
36
36
|
constructor(editor: BlockNoteEditor<any, any, any>);
|
|
37
37
|
get shown(): boolean;
|
|
38
38
|
onUpdate(callback: (state: FormattingToolbarState) => void): () => void;
|
|
@@ -1,16 +1,15 @@
|
|
|
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
12
|
private view;
|
|
13
|
-
readonly plugin: Plugin;
|
|
14
13
|
constructor(editor: BlockNoteEditor<BSchema, I, S>);
|
|
15
14
|
onUpdate(callback: (state: LinkToolbarState) => void): () => void;
|
|
16
15
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare class NodeSelectionKeyboardPlugin {
|
|
3
|
-
readonly plugin: Plugin;
|
|
1
|
+
import { BlockNoteExtension } from "../../editor/BlockNoteExtension.js";
|
|
2
|
+
export declare class NodeSelectionKeyboardPlugin extends BlockNoteExtension {
|
|
4
3
|
constructor();
|
|
5
4
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
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 {
|
|
5
4
|
constructor(editor: BlockNoteEditor<any, any, any>, placeholders: Record<string | "default" | "emptyDocument", string | undefined>);
|
|
6
5
|
}
|
|
@@ -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,6 @@ 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
|
-
readonly plugin: Plugin;
|
|
10
|
+
export declare class PreviousBlockTypePlugin extends BlockNoteExtension {
|
|
12
11
|
constructor();
|
|
13
12
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
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
|
-
readonly plugin: Plugin;
|
|
11
10
|
private enabled;
|
|
12
11
|
constructor(editor: BlockNoteEditor<any, any, any>);
|
|
13
12
|
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,9 @@ 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
64
|
view: SideMenuView<BSchema, I, S> | undefined;
|
|
65
|
-
readonly plugin: Plugin;
|
|
66
65
|
constructor(editor: BlockNoteEditor<BSchema, I, S>, sideMenuDetection: "viewport" | "editor");
|
|
67
66
|
onUpdate(callback: (state: SideMenuState<BSchema, I, S>) => void): () => void;
|
|
68
67
|
/**
|
|
@@ -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,8 @@ 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 {
|
|
21
20
|
private view;
|
|
22
|
-
readonly plugin: Plugin;
|
|
23
21
|
private triggerCharacters;
|
|
24
22
|
constructor(editor: BlockNoteEditor<BSchema, I, S>);
|
|
25
23
|
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,9 @@ 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
47
|
private view;
|
|
48
|
-
readonly plugin: Plugin;
|
|
49
48
|
constructor(editor: BlockNoteEditor<BlockSchemaWithBlock<"table", DefaultBlockSchema["table"]>, I, S>);
|
|
50
49
|
onUpdate(callback: (state: TableHandlesState<I, S>) => void): () => void;
|
|
51
50
|
/**
|
|
@@ -138,9 +137,9 @@ export declare class TableHandlesProsemirrorPlugin<I extends InlineContentSchema
|
|
|
138
137
|
*/
|
|
139
138
|
getMergeDirection: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any> | undefined) => "vertical" | "horizontal" | undefined;
|
|
140
139
|
cropEmptyRowsOrColumns: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, removeEmpty: "columns" | "rows") => {
|
|
141
|
-
cells: (import("../../index.js").
|
|
140
|
+
cells: (import("../../index.js").CustomInlineContentFromConfig<any, any> | import("../../index.js").StyledText<any> | import("../../index.js").Link<any>)[][] | import("../../index.js").TableCell<any, any>[];
|
|
142
141
|
}[];
|
|
143
142
|
addRowsOrColumns: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, addType: "columns" | "rows", numToAdd: number) => {
|
|
144
|
-
cells: (import("../../index.js").
|
|
143
|
+
cells: (import("../../index.js").CustomInlineContentFromConfig<any, any> | import("../../index.js").StyledText<any> | import("../../index.js").Link<any>)[][] | import("../../index.js").TableCell<any, any>[];
|
|
145
144
|
}[];
|
|
146
145
|
}
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
export * from "./api/blockManipulation/commands/insertBlocks/insertBlocks.js";
|
|
2
|
+
export * from "./api/blockManipulation/commands/replaceBlocks/replaceBlocks.js";
|
|
1
3
|
export * from "./api/blockManipulation/commands/updateBlock/updateBlock.js";
|
|
2
4
|
export * from "./api/exporters/html/externalHTMLExporter.js";
|
|
3
5
|
export * from "./api/exporters/html/internalHTMLSerializer.js";
|
|
4
6
|
export * from "./api/getBlockInfoFromPos.js";
|
|
5
7
|
export * from "./api/nodeUtil.js";
|
|
8
|
+
export * from "./api/pmUtil.js";
|
|
6
9
|
export * from "./blocks/AudioBlockContent/AudioBlockContent.js";
|
|
7
10
|
export * from "./blocks/CodeBlockContent/CodeBlockContent.js";
|
|
11
|
+
export * from "./blocks/defaultBlockHelpers.js";
|
|
12
|
+
export * from "./blocks/defaultBlocks.js";
|
|
13
|
+
export * from "./blocks/defaultBlockTypeGuards.js";
|
|
14
|
+
export * from "./blocks/defaultProps.js";
|
|
8
15
|
export * from "./blocks/FileBlockContent/FileBlockContent.js";
|
|
9
16
|
export * from "./blocks/FileBlockContent/helpers/parse/parseEmbedElement.js";
|
|
10
17
|
export * from "./blocks/FileBlockContent/helpers/parse/parseFigureElement.js";
|
|
@@ -16,16 +23,13 @@ export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createFigureWith
|
|
|
16
23
|
export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js";
|
|
17
24
|
export * from "./blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js";
|
|
18
25
|
export * from "./blocks/ImageBlockContent/ImageBlockContent.js";
|
|
19
|
-
export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
|
|
20
26
|
export * from "./blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.js";
|
|
27
|
+
export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
|
|
21
28
|
export * from "./blocks/PageBreakBlockContent/schema.js";
|
|
22
29
|
export { EMPTY_CELL_HEIGHT, EMPTY_CELL_WIDTH, } from "./blocks/TableBlockContent/TableExtension.js";
|
|
23
30
|
export * from "./blocks/VideoBlockContent/VideoBlockContent.js";
|
|
24
|
-
export * from "./blocks/defaultBlockHelpers.js";
|
|
25
|
-
export * from "./blocks/defaultBlockTypeGuards.js";
|
|
26
|
-
export * from "./blocks/defaultBlocks.js";
|
|
27
|
-
export * from "./blocks/defaultProps.js";
|
|
28
31
|
export * from "./editor/BlockNoteEditor.js";
|
|
32
|
+
export * from "./editor/BlockNoteExtension.js";
|
|
29
33
|
export * from "./editor/BlockNoteExtensions.js";
|
|
30
34
|
export * from "./editor/BlockNoteSchema.js";
|
|
31
35
|
export * from "./editor/defaultColors.js";
|
|
@@ -39,20 +43,21 @@ export * from "./extensions/LinkToolbar/protocols.js";
|
|
|
39
43
|
export * from "./extensions/SideMenu/SideMenuPlugin.js";
|
|
40
44
|
export * from "./extensions/SuggestionMenu/DefaultGridSuggestionItem.js";
|
|
41
45
|
export * from "./extensions/SuggestionMenu/DefaultSuggestionItem.js";
|
|
42
|
-
export * from "./extensions/SuggestionMenu/SuggestionPlugin.js";
|
|
43
46
|
export * from "./extensions/SuggestionMenu/getDefaultEmojiPickerItems.js";
|
|
44
47
|
export * from "./extensions/SuggestionMenu/getDefaultSlashMenuItems.js";
|
|
48
|
+
export * from "./extensions/SuggestionMenu/SuggestionPlugin.js";
|
|
45
49
|
export * from "./extensions/TableHandles/TableHandlesPlugin.js";
|
|
46
50
|
export * from "./i18n/dictionary.js";
|
|
47
51
|
export * from "./schema/index.js";
|
|
48
52
|
export * from "./util/browser.js";
|
|
49
53
|
export * from "./util/combineByGroup.js";
|
|
50
54
|
export * from "./util/esmDependencies.js";
|
|
51
|
-
export * from "./util/table.js";
|
|
52
55
|
export * from "./util/string.js";
|
|
56
|
+
export * from "./util/table.js";
|
|
53
57
|
export * from "./util/typescript.js";
|
|
54
58
|
export type { CodeBlockOptions } from "./blocks/CodeBlockContent/CodeBlockContent.js";
|
|
55
|
-
export {
|
|
59
|
+
export { assertEmpty, UnreachableCaseError } from "./util/typescript.js";
|
|
60
|
+
export * from "./util/EventEmitter.js";
|
|
56
61
|
export { selectedFragmentToHTML } from "./api/clipboard/toClipboard/copyExtension.js";
|
|
57
62
|
export * from "./api/nodeConversions/blockToNode.js";
|
|
58
63
|
export * from "./api/nodeConversions/nodeToBlock.js";
|
|
@@ -60,3 +65,5 @@ export * from "./extensions/UniqueID/UniqueID.js";
|
|
|
60
65
|
export * from "./api/exporters/markdown/markdownExporter.js";
|
|
61
66
|
export * from "./api/parsers/html/parseHTML.js";
|
|
62
67
|
export * from "./api/parsers/markdown/parseMarkdown.js";
|
|
68
|
+
export * from "./api/blockManipulation/getBlock/getBlock.js";
|
|
69
|
+
export * from "./api/positionMapping.js";
|