@blocknote/core 0.30.1 → 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 +2754 -2230
- 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/webpack-stats.json +1 -1
- package/package.json +4 -5
- 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 +88 -37
- 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 +75 -70
- package/src/extensions/FilePanel/FilePanelPlugin.ts +50 -49
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +56 -26
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +22 -21
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +45 -42
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +111 -108
- package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +179 -170
- package/src/extensions/ShowSelection/ShowSelectionPlugin.ts +22 -19
- package/src/extensions/SideMenu/SideMenuPlugin.ts +19 -18
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +168 -168
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +4 -4
- package/src/extensions/Suggestions/SuggestionMarks.ts +175 -0
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +153 -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/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 +55 -9
- 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
package/src/i18n/locales/sk.ts
CHANGED
package/src/i18n/locales/uk.ts
CHANGED
package/src/i18n/locales/vi.ts
CHANGED
package/src/i18n/locales/zh.ts
CHANGED
package/src/index.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,19 +23,16 @@ 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 {
|
|
23
30
|
EMPTY_CELL_HEIGHT,
|
|
24
31
|
EMPTY_CELL_WIDTH,
|
|
25
32
|
} from "./blocks/TableBlockContent/TableExtension.js";
|
|
26
33
|
export * from "./blocks/VideoBlockContent/VideoBlockContent.js";
|
|
27
|
-
export * from "./blocks/defaultBlockHelpers.js";
|
|
28
|
-
export * from "./blocks/defaultBlockTypeGuards.js";
|
|
29
|
-
export * from "./blocks/defaultBlocks.js";
|
|
30
|
-
export * from "./blocks/defaultProps.js";
|
|
31
34
|
export * from "./editor/BlockNoteEditor.js";
|
|
35
|
+
export * from "./editor/BlockNoteExtension.js";
|
|
32
36
|
export * from "./editor/BlockNoteExtensions.js";
|
|
33
37
|
export * from "./editor/BlockNoteSchema.js";
|
|
34
38
|
export * from "./editor/defaultColors.js";
|
|
@@ -42,22 +46,24 @@ export * from "./extensions/LinkToolbar/protocols.js";
|
|
|
42
46
|
export * from "./extensions/SideMenu/SideMenuPlugin.js";
|
|
43
47
|
export * from "./extensions/SuggestionMenu/DefaultGridSuggestionItem.js";
|
|
44
48
|
export * from "./extensions/SuggestionMenu/DefaultSuggestionItem.js";
|
|
45
|
-
export * from "./extensions/SuggestionMenu/SuggestionPlugin.js";
|
|
46
49
|
export * from "./extensions/SuggestionMenu/getDefaultEmojiPickerItems.js";
|
|
47
50
|
export * from "./extensions/SuggestionMenu/getDefaultSlashMenuItems.js";
|
|
51
|
+
export * from "./extensions/SuggestionMenu/SuggestionPlugin.js";
|
|
48
52
|
export * from "./extensions/TableHandles/TableHandlesPlugin.js";
|
|
49
53
|
export * from "./i18n/dictionary.js";
|
|
50
54
|
export * from "./schema/index.js";
|
|
51
55
|
export * from "./util/browser.js";
|
|
52
56
|
export * from "./util/combineByGroup.js";
|
|
53
57
|
export * from "./util/esmDependencies.js";
|
|
54
|
-
export * from "./util/table.js";
|
|
55
58
|
export * from "./util/string.js";
|
|
59
|
+
export * from "./util/table.js";
|
|
56
60
|
export * from "./util/typescript.js";
|
|
57
61
|
|
|
58
62
|
export type { CodeBlockOptions } from "./blocks/CodeBlockContent/CodeBlockContent.js";
|
|
59
|
-
export {
|
|
63
|
+
export { assertEmpty, UnreachableCaseError } from "./util/typescript.js";
|
|
60
64
|
|
|
65
|
+
export * from "./util/EventEmitter.js";
|
|
66
|
+
// for testing from react (TODO: move):
|
|
61
67
|
// Unit testing
|
|
62
68
|
export { selectedFragmentToHTML } from "./api/clipboard/toClipboard/copyExtension.js";
|
|
63
69
|
|
|
@@ -70,3 +76,7 @@ export * from "./extensions/UniqueID/UniqueID.js";
|
|
|
70
76
|
export * from "./api/exporters/markdown/markdownExporter.js";
|
|
71
77
|
export * from "./api/parsers/html/parseHTML.js";
|
|
72
78
|
export * from "./api/parsers/markdown/parseMarkdown.js";
|
|
79
|
+
|
|
80
|
+
// TODO: for ai, remove?
|
|
81
|
+
export * from "./api/blockManipulation/getBlock/getBlock.js";
|
|
82
|
+
export * from "./api/positionMapping.js";
|
package/src/pm-nodes/Doc.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { Transaction } from "prosemirror-state";
|
|
1
2
|
import { Block, PartialBlock } from "../../../../blocks/defaultBlocks.js";
|
|
2
3
|
import { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../../../schema/index.js";
|
|
3
|
-
import type { Transaction } from "prosemirror-state";
|
|
4
4
|
export declare function insertBlocks<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(tr: Transaction, blocksToInsert: PartialBlock<BSchema, I, S>[], referenceBlock: BlockIdentifier, placement?: "before" | "after"): Block<BSchema, I, S>[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Block } from "../../../../blocks/defaultBlocks.js";
|
|
2
|
+
import type { BlockNoteEditor } from "../../../../editor/BlockNoteEditor";
|
|
3
|
+
import { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../../../schema/index.js";
|
|
4
|
+
export declare function removeBlocks<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(editor: BlockNoteEditor<BSchema, I, S>, blocksToRemove: BlockIdentifier[]): Block<BSchema, I, S>[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Transaction } from "prosemirror-state";
|
|
2
|
+
import type { TextCursorPosition } from "../../../editor/cursorPositionTypes.js";
|
|
3
|
+
import type { BlockIdentifier, BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema/index.js";
|
|
4
|
+
export declare function getTextCursorPosition<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(tr: Transaction): TextCursorPosition<BSchema, I, S>;
|
|
5
|
+
export declare function setTextCursorPosition(tr: Transaction, targetBlock: BlockIdentifier, placement?: "start" | "end"): void;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|