@blocknote/core 0.24.2 → 0.25.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 +12 -0
- package/dist/blocknote.cjs.map +1 -0
- package/dist/blocknote.js +4754 -3514
- package/dist/blocknote.js.map +1 -1
- package/dist/comments.cjs +2 -0
- package/dist/comments.cjs.map +1 -0
- package/dist/comments.js +593 -0
- package/dist/comments.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +39 -26
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +1022 -378
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +730 -270
- package/src/api/blockManipulation/commands/moveBlocks/__snapshots__/moveBlocks.test.ts.snap +3100 -1260
- package/src/api/blockManipulation/commands/removeBlocks/__snapshots__/removeBlocks.test.ts.snap +438 -162
- package/src/api/blockManipulation/commands/replaceBlocks/__snapshots__/replaceBlocks.test.ts.snap +1168 -432
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +930 -378
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2485 -1015
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +28 -1
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +1 -1
- package/src/api/blockManipulation/selections/__snapshots__/selection.test.ts.snap +292 -108
- package/src/api/blockManipulation/setupTestEnv.ts +14 -1
- package/src/api/blockManipulation/tables/tables.test.ts +1987 -0
- package/src/api/blockManipulation/tables/tables.ts +887 -0
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraph.html +66 -24
- package/src/api/clipboard/__snapshots__/external/pasteEndOfParagraphText.html +66 -24
- package/src/api/clipboard/__snapshots__/external/pasteImage.html +66 -24
- package/src/api/clipboard/__snapshots__/external/pasteParagraphInCustomBlock.html +66 -24
- package/src/api/clipboard/__snapshots__/external/pasteTable.html +132 -48
- package/src/api/clipboard/__snapshots__/external/pasteTableInExistingTable.html +136 -44
- package/src/api/clipboard/toClipboard/copyExtension.ts +2 -3
- package/src/api/exporters/html/__snapshots__/table/headerCols/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/headerCols/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/headerRows/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/headerRows/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/headersRows/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/headersRows/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/mixedCellColors/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/mixedCellColors/internal.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/external.html +1 -0
- package/src/api/exporters/html/__snapshots__/table/mixedRowspansAndColspans/internal.html +1 -0
- package/src/api/exporters/markdown/__snapshots__/table/headerCols/markdown.md +4 -0
- package/src/api/exporters/markdown/__snapshots__/table/headerRows/markdown.md +4 -0
- package/src/api/exporters/markdown/__snapshots__/table/mixedCellColors/markdown.md +5 -0
- package/src/api/exporters/markdown/__snapshots__/table/mixedRowspansAndColspans/markdown.md +5 -0
- package/src/api/nodeConversions/__snapshots__/nodeConversions.test.ts.snap +985 -20
- package/src/api/nodeConversions/blockToNode.ts +63 -20
- package/src/api/nodeConversions/nodeToBlock.ts +75 -13
- package/src/api/parsers/html/__snapshots__/parse-notion-html.json +145 -54
- package/src/api/testUtil/cases/defaultSchema.ts +782 -9
- package/src/api/testUtil/partialBlockTestUtil.ts +39 -4
- package/src/blocks/TableBlockContent/TableBlockContent.ts +11 -5
- package/src/blocks/defaultBlockTypeGuards.ts +8 -0
- package/src/comments/index.ts +9 -0
- package/src/comments/models/User.ts +8 -0
- package/src/comments/threadstore/DefaultThreadStoreAuth.ts +106 -0
- package/src/comments/threadstore/ThreadStore.ts +134 -0
- package/src/comments/threadstore/ThreadStoreAuth.ts +13 -0
- package/src/comments/threadstore/TipTapThreadStore.ts +292 -0
- package/src/comments/threadstore/yjs/RESTYjsThreadStore.ts +144 -0
- package/src/comments/threadstore/yjs/YjsThreadStore.test.ts +294 -0
- package/src/comments/threadstore/yjs/YjsThreadStore.ts +340 -0
- package/src/comments/threadstore/yjs/YjsThreadStoreBase.ts +48 -0
- package/src/comments/threadstore/yjs/yjsHelpers.ts +121 -0
- package/src/comments/types.ts +117 -0
- package/src/editor/Block.css +16 -8
- package/src/editor/BlockNoteEditor.ts +269 -92
- package/src/editor/BlockNoteExtensions.ts +24 -1
- package/src/editor/BlockNoteTipTapEditor.ts +5 -1
- package/src/editor/editor.css +17 -0
- package/src/extensions/BackgroundColor/BackgroundColorExtension.ts +1 -1
- package/src/extensions/Comments/CommentMark.ts +61 -0
- package/src/extensions/Comments/CommentsPlugin.ts +301 -0
- package/src/extensions/Comments/userstore/UserStore.ts +72 -0
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +9 -5
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +3 -3
- package/src/extensions/ShowSelection/ShowSelectionPlugin.ts +52 -0
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +409 -57
- package/src/extensions/TextAlignment/TextAlignmentExtension.ts +2 -0
- package/src/extensions/TextColor/TextColorExtension.ts +1 -1
- package/src/i18n/locales/ar.ts +23 -0
- package/src/i18n/locales/de.ts +15 -0
- package/src/i18n/locales/en.ts +25 -1
- package/src/i18n/locales/es.ts +16 -1
- package/src/i18n/locales/fr.ts +23 -0
- package/src/i18n/locales/hr.ts +18 -0
- package/src/i18n/locales/is.ts +24 -1
- package/src/i18n/locales/it.ts +15 -0
- package/src/i18n/locales/ja.ts +23 -0
- package/src/i18n/locales/ko.ts +23 -0
- package/src/i18n/locales/nl.ts +23 -0
- package/src/i18n/locales/no.ts +23 -0
- package/src/i18n/locales/pl.ts +23 -0
- package/src/i18n/locales/pt.ts +23 -0
- package/src/i18n/locales/ru.ts +23 -0
- package/src/i18n/locales/uk.ts +23 -0
- package/src/i18n/locales/vi.ts +23 -0
- package/src/i18n/locales/zh.ts +23 -0
- package/src/index.ts +6 -4
- package/src/schema/blocks/types.ts +32 -2
- package/src/util/browser.ts +1 -1
- package/src/util/table.ts +107 -0
- package/types/src/api/blockManipulation/tables/tables.d.ts +343 -0
- package/types/src/api/blockManipulation/tables/tables.test.d.ts +1 -0
- package/types/src/api/clipboard/toClipboard/copyExtension.d.ts +1 -1
- package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +1 -2
- package/types/src/blocks/defaultBlockTypeGuards.d.ts +3 -0
- package/types/src/comments/index.d.ts +9 -0
- package/types/src/comments/models/User.d.ts +8 -0
- package/types/src/comments/threadstore/DefaultThreadStoreAuth.d.ts +47 -0
- package/types/src/comments/threadstore/ThreadStore.d.ts +121 -0
- package/types/src/comments/threadstore/ThreadStoreAuth.d.ts +12 -0
- package/types/src/comments/threadstore/TipTapThreadStore.d.ts +97 -0
- package/types/src/comments/threadstore/yjs/RESTYjsThreadStore.d.ts +83 -0
- package/types/src/comments/threadstore/yjs/YjsThreadStore.d.ts +79 -0
- package/types/src/comments/threadstore/yjs/YjsThreadStore.test.d.ts +1 -0
- package/types/src/comments/threadstore/yjs/YjsThreadStoreBase.d.ts +15 -0
- package/types/src/comments/threadstore/yjs/yjsHelpers.d.ts +13 -0
- package/types/src/comments/types.d.ts +109 -0
- package/types/src/editor/BlockNoteEditor.d.ts +146 -66
- package/types/src/editor/BlockNoteExtensions.d.ts +4 -0
- package/types/src/extensions/Collaboration/createCollaborationExtensions.d.ts +1 -1
- package/types/src/extensions/Comments/CommentMark.d.ts +2 -0
- package/types/src/extensions/Comments/CommentsPlugin.d.ts +49 -0
- package/types/src/extensions/Comments/userstore/UserStore.d.ts +31 -0
- package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +15 -0
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +66 -1
- package/types/src/i18n/locales/de.d.ts +15 -0
- package/types/src/i18n/locales/en.d.ts +20 -0
- package/types/src/i18n/locales/es.d.ts +15 -0
- package/types/src/i18n/locales/hr.d.ts +18 -0
- package/types/src/i18n/locales/it.d.ts +15 -0
- package/types/src/index.d.ts +5 -4
- package/types/src/pm-nodes/BlockContainer.d.ts +2 -2
- package/types/src/pm-nodes/BlockGroup.d.ts +2 -2
- package/types/src/schema/blocks/types.d.ts +23 -2
- package/types/src/util/browser.d.ts +1 -1
- package/types/src/util/table.d.ts +12 -0
- package/dist/blocknote.umd.cjs +0 -11
- package/dist/blocknote.umd.cjs.map +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Plugin } from "prosemirror-state";
|
|
2
|
+
import type { CommentBody, ThreadStore, User } from "../../comments/index.js";
|
|
3
|
+
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
4
|
+
import { EventEmitter } from "../../util/EventEmitter.js";
|
|
5
|
+
import { UserStore } from "./userstore/UserStore.js";
|
|
6
|
+
export declare class CommentsPlugin extends EventEmitter<any> {
|
|
7
|
+
private readonly editor;
|
|
8
|
+
readonly threadStore: ThreadStore;
|
|
9
|
+
private readonly markType;
|
|
10
|
+
readonly plugin: Plugin;
|
|
11
|
+
readonly userStore: UserStore<User>;
|
|
12
|
+
private pendingComment;
|
|
13
|
+
private selectedThreadId;
|
|
14
|
+
private emitStateUpdate;
|
|
15
|
+
/**
|
|
16
|
+
* when a thread is resolved or deleted, we need to update the marks to reflect the new state
|
|
17
|
+
*/
|
|
18
|
+
private updateMarksFromThreads;
|
|
19
|
+
constructor(editor: BlockNoteEditor<any, any, any>, threadStore: ThreadStore, markType: string);
|
|
20
|
+
/**
|
|
21
|
+
* Subscribe to state updates
|
|
22
|
+
*/
|
|
23
|
+
onUpdate(callback: (state: {
|
|
24
|
+
pendingComment: boolean;
|
|
25
|
+
selectedThreadId: string | undefined;
|
|
26
|
+
}) => void): () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Set the selected thread
|
|
29
|
+
*/
|
|
30
|
+
selectThread(threadId: string | undefined): void;
|
|
31
|
+
/**
|
|
32
|
+
* Start a pending comment (e.g.: when clicking the "Add comment" button)
|
|
33
|
+
*/
|
|
34
|
+
startPendingComment(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Stop a pending comment (e.g.: user closes the comment composer)
|
|
37
|
+
*/
|
|
38
|
+
stopPendingComment(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Create a thread at the current selection
|
|
41
|
+
*/
|
|
42
|
+
createThread(options: {
|
|
43
|
+
initialComment: {
|
|
44
|
+
body: CommentBody;
|
|
45
|
+
metadata?: any;
|
|
46
|
+
};
|
|
47
|
+
metadata?: any;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { User } from "../../../comments/index.js";
|
|
2
|
+
import { EventEmitter } from "../../../util/EventEmitter.js";
|
|
3
|
+
/**
|
|
4
|
+
* The `UserStore` is used to retrieve and cache information about users.
|
|
5
|
+
*
|
|
6
|
+
* It does this by calling `resolveUsers` (which is user-defined in the Editor Options)
|
|
7
|
+
* for users that are not yet cached.
|
|
8
|
+
*/
|
|
9
|
+
export declare class UserStore<U extends User> extends EventEmitter<any> {
|
|
10
|
+
private readonly resolveUsers;
|
|
11
|
+
private userCache;
|
|
12
|
+
private loadingUsers;
|
|
13
|
+
constructor(resolveUsers: (userIds: string[]) => Promise<U[]>);
|
|
14
|
+
/**
|
|
15
|
+
* Load information about users based on an array of user ids.
|
|
16
|
+
*/
|
|
17
|
+
loadUsers(userIds: string[]): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve information about a user based on their id, if cached.
|
|
20
|
+
*
|
|
21
|
+
* The user will have to be loaded via `loadUsers` first
|
|
22
|
+
*/
|
|
23
|
+
getUser(userId: string): U | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Subscribe to changes in the user store.
|
|
26
|
+
*
|
|
27
|
+
* @param cb - The callback to call when the user store changes.
|
|
28
|
+
* @returns A function to unsubscribe from the user store.
|
|
29
|
+
*/
|
|
30
|
+
subscribe(cb: (users: Map<string, U>) => void): () => void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Plugin } from "prosemirror-state";
|
|
2
|
+
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
3
|
+
/**
|
|
4
|
+
* Plugin that shows adds a decoration around the current selection
|
|
5
|
+
* This can be used to highlight the current selection in the UI even when the
|
|
6
|
+
* text editor is not focused.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ShowSelectionPlugin {
|
|
9
|
+
private readonly editor;
|
|
10
|
+
readonly plugin: Plugin;
|
|
11
|
+
private enabled;
|
|
12
|
+
constructor(editor: BlockNoteEditor<any, any, any>);
|
|
13
|
+
setEnabled(enabled: boolean): void;
|
|
14
|
+
getEnabled(): boolean;
|
|
15
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Plugin, PluginKey, PluginView } from "prosemirror-state";
|
|
2
2
|
import { EditorView } from "prosemirror-view";
|
|
3
|
+
import { RelativeCellIndices } from "../../api/blockManipulation/tables/tables.js";
|
|
3
4
|
import { DefaultBlockSchema } from "../../blocks/defaultBlocks.js";
|
|
4
5
|
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
|
|
5
6
|
import { BlockFromConfigNoChildren, BlockSchemaWithBlock, InlineContentSchema, StyleSchema } from "../../schema/index.js";
|
|
@@ -36,7 +37,7 @@ export declare class TableHandlesView<I extends InlineContentSchema, S extends S
|
|
|
36
37
|
mouseUpHandler: (event: MouseEvent) => void;
|
|
37
38
|
mouseMoveHandler: (event: MouseEvent) => false | undefined;
|
|
38
39
|
dragOverHandler: (event: DragEvent) => void;
|
|
39
|
-
dropHandler: (event: DragEvent) =>
|
|
40
|
+
dropHandler: (event: DragEvent) => boolean;
|
|
40
41
|
update(): void;
|
|
41
42
|
destroy(): void;
|
|
42
43
|
}
|
|
@@ -78,4 +79,68 @@ export declare class TableHandlesProsemirrorPlugin<I extends InlineContentSchema
|
|
|
78
79
|
* same cell regardless of which cell is hovered by the mouse cursor.
|
|
79
80
|
*/
|
|
80
81
|
unfreezeHandles: () => void;
|
|
82
|
+
getCellsAtRowHandle: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, relativeRowIndex: RelativeCellIndices["row"]) => (RelativeCellIndices & {
|
|
83
|
+
cell: import("../../schema/index.js").TableCell<any, any>;
|
|
84
|
+
})[];
|
|
85
|
+
/**
|
|
86
|
+
* Get all the cells in a column of the table block.
|
|
87
|
+
*/
|
|
88
|
+
getCellsAtColumnHandle: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, relativeColumnIndex: RelativeCellIndices["col"]) => (RelativeCellIndices & {
|
|
89
|
+
cell: import("../../schema/index.js").TableCell<any, any>;
|
|
90
|
+
})[];
|
|
91
|
+
/**
|
|
92
|
+
* Sets the selection to the given cell or a range of cells.
|
|
93
|
+
* @returns The new state after the selection has been set.
|
|
94
|
+
*/
|
|
95
|
+
private setCellSelection;
|
|
96
|
+
/**
|
|
97
|
+
* Adds a row or column to the table using prosemirror-table commands
|
|
98
|
+
*/
|
|
99
|
+
addRowOrColumn: (index: RelativeCellIndices["row"] | RelativeCellIndices["col"], direction: {
|
|
100
|
+
orientation: "row";
|
|
101
|
+
side: "above" | "below";
|
|
102
|
+
} | {
|
|
103
|
+
orientation: "column";
|
|
104
|
+
side: "left" | "right";
|
|
105
|
+
}) => boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Removes a row or column from the table using prosemirror-table commands
|
|
108
|
+
*/
|
|
109
|
+
removeRowOrColumn: (index: RelativeCellIndices["row"] | RelativeCellIndices["col"], direction: "row" | "column") => boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Merges the cells in the table block.
|
|
112
|
+
*/
|
|
113
|
+
mergeCells: (cellsToMerge?: {
|
|
114
|
+
relativeStartCell: RelativeCellIndices;
|
|
115
|
+
relativeEndCell: RelativeCellIndices;
|
|
116
|
+
}) => boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Splits the cell in the table block.
|
|
119
|
+
* If no cell is provided, the current cell selected will be split.
|
|
120
|
+
*/
|
|
121
|
+
splitCell: (relativeCellToSplit?: RelativeCellIndices) => boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the start and end cells of the current cell selection.
|
|
124
|
+
* @returns The start and end cells of the current cell selection.
|
|
125
|
+
*/
|
|
126
|
+
getCellSelection: () => undefined | {
|
|
127
|
+
from: RelativeCellIndices;
|
|
128
|
+
to: RelativeCellIndices;
|
|
129
|
+
/**
|
|
130
|
+
* All of the cells that are within the selected range.
|
|
131
|
+
*/
|
|
132
|
+
cells: RelativeCellIndices[];
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Gets the direction of the merge based on the current cell selection.
|
|
136
|
+
*
|
|
137
|
+
* Returns undefined when there is no cell selection, or the selection is not within a table.
|
|
138
|
+
*/
|
|
139
|
+
getMergeDirection: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any> | undefined) => "vertical" | "horizontal" | undefined;
|
|
140
|
+
cropEmptyRowsOrColumns: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, removeEmpty: "columns" | "rows") => {
|
|
141
|
+
cells: (import("../../schema/index.js").StyledText<any> | import("../../schema/index.js").Link<any> | import("../../schema/index.js").CustomInlineContentFromConfig<any, any>)[][] | import("../../schema/index.js").TableCell<any, any>[];
|
|
142
|
+
}[];
|
|
143
|
+
addRowsOrColumns: (block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, addType: "columns" | "rows", numToAdd: number) => {
|
|
144
|
+
cells: (import("../../schema/index.js").StyledText<any> | import("../../schema/index.js").Link<any> | import("../../schema/index.js").CustomInlineContentFromConfig<any, any>)[][] | import("../../schema/index.js").TableCell<any, any>[];
|
|
145
|
+
}[];
|
|
81
146
|
}
|
|
@@ -97,6 +97,9 @@ export declare const de: {
|
|
|
97
97
|
bulletListItem: string;
|
|
98
98
|
numberedListItem: string;
|
|
99
99
|
checkListItem: string;
|
|
100
|
+
new_comment: string;
|
|
101
|
+
edit_comment: string;
|
|
102
|
+
comment_reply: string;
|
|
100
103
|
};
|
|
101
104
|
file_blocks: {
|
|
102
105
|
image: {
|
|
@@ -283,6 +286,18 @@ export declare const de: {
|
|
|
283
286
|
url_placeholder: string;
|
|
284
287
|
};
|
|
285
288
|
};
|
|
289
|
+
comments: {
|
|
290
|
+
actions: {
|
|
291
|
+
add_reaction: string;
|
|
292
|
+
resolve: string;
|
|
293
|
+
edit_comment: string;
|
|
294
|
+
delete_comment: string;
|
|
295
|
+
more_actions: string;
|
|
296
|
+
};
|
|
297
|
+
reactions: {
|
|
298
|
+
reacted_by: string;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
286
301
|
generic: {
|
|
287
302
|
ctrl_shortcut: string;
|
|
288
303
|
};
|
|
@@ -113,6 +113,8 @@ export declare const en: {
|
|
|
113
113
|
drag_handle: {
|
|
114
114
|
delete_menuitem: string;
|
|
115
115
|
colors_menuitem: string;
|
|
116
|
+
header_row_menuitem: string;
|
|
117
|
+
header_column_menuitem: string;
|
|
116
118
|
};
|
|
117
119
|
table_handle: {
|
|
118
120
|
delete_column_menuitem: string;
|
|
@@ -121,6 +123,9 @@ export declare const en: {
|
|
|
121
123
|
add_right_menuitem: string;
|
|
122
124
|
add_above_menuitem: string;
|
|
123
125
|
add_below_menuitem: string;
|
|
126
|
+
split_cell_menuitem: string;
|
|
127
|
+
merge_cells_menuitem: string;
|
|
128
|
+
background_color_menuitem: string;
|
|
124
129
|
};
|
|
125
130
|
suggestion_menu: {
|
|
126
131
|
no_items_title: string;
|
|
@@ -210,6 +215,9 @@ export declare const en: {
|
|
|
210
215
|
align_justify: {
|
|
211
216
|
tooltip: string;
|
|
212
217
|
};
|
|
218
|
+
table_cell_merge: {
|
|
219
|
+
tooltip: string;
|
|
220
|
+
};
|
|
213
221
|
comment: {
|
|
214
222
|
tooltip: string;
|
|
215
223
|
};
|
|
@@ -242,6 +250,18 @@ export declare const en: {
|
|
|
242
250
|
url_placeholder: string;
|
|
243
251
|
};
|
|
244
252
|
};
|
|
253
|
+
comments: {
|
|
254
|
+
actions: {
|
|
255
|
+
add_reaction: string;
|
|
256
|
+
resolve: string;
|
|
257
|
+
edit_comment: string;
|
|
258
|
+
delete_comment: string;
|
|
259
|
+
more_actions: string;
|
|
260
|
+
};
|
|
261
|
+
reactions: {
|
|
262
|
+
reacted_by: string;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
245
265
|
generic: {
|
|
246
266
|
ctrl_shortcut: string;
|
|
247
267
|
};
|
|
@@ -97,6 +97,9 @@ export declare const es: {
|
|
|
97
97
|
bulletListItem: string;
|
|
98
98
|
numberedListItem: string;
|
|
99
99
|
checkListItem: string;
|
|
100
|
+
new_comment: string;
|
|
101
|
+
edit_comment: string;
|
|
102
|
+
comment_reply: string;
|
|
100
103
|
};
|
|
101
104
|
file_blocks: {
|
|
102
105
|
image: {
|
|
@@ -248,6 +251,18 @@ export declare const es: {
|
|
|
248
251
|
url_placeholder: string;
|
|
249
252
|
};
|
|
250
253
|
};
|
|
254
|
+
comments: {
|
|
255
|
+
actions: {
|
|
256
|
+
add_reaction: string;
|
|
257
|
+
resolve: string;
|
|
258
|
+
edit_comment: string;
|
|
259
|
+
delete_comment: string;
|
|
260
|
+
more_actions: string;
|
|
261
|
+
};
|
|
262
|
+
reactions: {
|
|
263
|
+
reacted_by: string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
251
266
|
generic: {
|
|
252
267
|
ctrl_shortcut: string;
|
|
253
268
|
};
|
|
@@ -84,6 +84,9 @@ export declare const hr: {
|
|
|
84
84
|
aliases: string[];
|
|
85
85
|
group: string;
|
|
86
86
|
};
|
|
87
|
+
comment: {
|
|
88
|
+
tooltip: string;
|
|
89
|
+
};
|
|
87
90
|
};
|
|
88
91
|
placeholders: {
|
|
89
92
|
default: string;
|
|
@@ -91,6 +94,9 @@ export declare const hr: {
|
|
|
91
94
|
bulletListItem: string;
|
|
92
95
|
numberedListItem: string;
|
|
93
96
|
checkListItem: string;
|
|
97
|
+
new_comment: string;
|
|
98
|
+
edit_comment: string;
|
|
99
|
+
comment_reply: string;
|
|
94
100
|
};
|
|
95
101
|
file_blocks: {
|
|
96
102
|
image: {
|
|
@@ -242,6 +248,18 @@ export declare const hr: {
|
|
|
242
248
|
url_placeholder: string;
|
|
243
249
|
};
|
|
244
250
|
};
|
|
251
|
+
comments: {
|
|
252
|
+
actions: {
|
|
253
|
+
add_reaction: string;
|
|
254
|
+
resolve: string;
|
|
255
|
+
edit_comment: string;
|
|
256
|
+
delete_comment: string;
|
|
257
|
+
more_actions: string;
|
|
258
|
+
};
|
|
259
|
+
reactions: {
|
|
260
|
+
reacted_by: string;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
245
263
|
generic: {
|
|
246
264
|
ctrl_shortcut: string;
|
|
247
265
|
};
|
|
@@ -97,6 +97,9 @@ export declare const it: {
|
|
|
97
97
|
bulletListItem: string;
|
|
98
98
|
numberedListItem: string;
|
|
99
99
|
checkListItem: string;
|
|
100
|
+
new_comment: string;
|
|
101
|
+
edit_comment: string;
|
|
102
|
+
comment_reply: string;
|
|
100
103
|
};
|
|
101
104
|
file_blocks: {
|
|
102
105
|
image: {
|
|
@@ -248,6 +251,18 @@ export declare const it: {
|
|
|
248
251
|
url_placeholder: string;
|
|
249
252
|
};
|
|
250
253
|
};
|
|
254
|
+
comments: {
|
|
255
|
+
actions: {
|
|
256
|
+
add_reaction: string;
|
|
257
|
+
resolve: string;
|
|
258
|
+
edit_comment: string;
|
|
259
|
+
delete_comment: string;
|
|
260
|
+
more_actions: string;
|
|
261
|
+
};
|
|
262
|
+
reactions: {
|
|
263
|
+
reacted_by: string;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
251
266
|
generic: {
|
|
252
267
|
ctrl_shortcut: string;
|
|
253
268
|
};
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as locales from "./i18n/locales/index.js";
|
|
2
|
+
export * from "./api/blockManipulation/commands/updateBlock/updateBlock.js";
|
|
2
3
|
export * from "./api/exporters/html/externalHTMLExporter.js";
|
|
3
4
|
export * from "./api/exporters/html/internalHTMLSerializer.js";
|
|
4
5
|
export * from "./api/getBlockInfoFromPos.js";
|
|
@@ -6,9 +7,6 @@ export * from "./api/nodeUtil.js";
|
|
|
6
7
|
export * from "./api/testUtil/index.js";
|
|
7
8
|
export * from "./blocks/AudioBlockContent/AudioBlockContent.js";
|
|
8
9
|
export * from "./blocks/CodeBlockContent/CodeBlockContent.js";
|
|
9
|
-
export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
|
|
10
|
-
export * from "./blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.js";
|
|
11
|
-
export * from "./blocks/PageBreakBlockContent/schema.js";
|
|
12
10
|
export * from "./blocks/FileBlockContent/FileBlockContent.js";
|
|
13
11
|
export * from "./blocks/FileBlockContent/helpers/parse/parseEmbedElement.js";
|
|
14
12
|
export * from "./blocks/FileBlockContent/helpers/parse/parseFigureElement.js";
|
|
@@ -20,6 +18,9 @@ export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createFigureWith
|
|
|
20
18
|
export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js";
|
|
21
19
|
export * from "./blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js";
|
|
22
20
|
export * from "./blocks/ImageBlockContent/ImageBlockContent.js";
|
|
21
|
+
export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
|
|
22
|
+
export * from "./blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.js";
|
|
23
|
+
export * from "./blocks/PageBreakBlockContent/schema.js";
|
|
23
24
|
export { EMPTY_CELL_HEIGHT, EMPTY_CELL_WIDTH, } from "./blocks/TableBlockContent/TableExtension.js";
|
|
24
25
|
export * from "./blocks/VideoBlockContent/VideoBlockContent.js";
|
|
25
26
|
export * from "./blocks/defaultBlockHelpers.js";
|
|
@@ -49,11 +50,11 @@ export * from "./schema/index.js";
|
|
|
49
50
|
export * from "./util/browser.js";
|
|
50
51
|
export * from "./util/combineByGroup.js";
|
|
51
52
|
export * from "./util/esmDependencies.js";
|
|
53
|
+
export * from "./util/table.js";
|
|
52
54
|
export * from "./util/string.js";
|
|
53
55
|
export * from "./util/typescript.js";
|
|
54
56
|
export { UnreachableCaseError, assertEmpty } from "./util/typescript.js";
|
|
55
57
|
export { locales };
|
|
56
|
-
export * from "./api/blockManipulation/commands/updateBlock/updateBlock.js";
|
|
57
58
|
export * from "./api/nodeConversions/blockToNode.js";
|
|
58
59
|
export * from "./api/nodeConversions/nodeToBlock.js";
|
|
59
60
|
export * from "./api/testUtil/partialBlockTestUtil.js";
|
|
@@ -5,10 +5,10 @@ import type { BlockNoteEditor } from "../editor/BlockNoteEditor.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const BlockContainer: Node<{
|
|
7
7
|
domAttributes?: Partial<{
|
|
8
|
-
blockGroup: Record<string, string>;
|
|
9
|
-
blockContent: Record<string, string>;
|
|
10
8
|
editor: Record<string, string>;
|
|
11
9
|
block: Record<string, string>;
|
|
10
|
+
blockGroup: Record<string, string>;
|
|
11
|
+
blockContent: Record<string, string>;
|
|
12
12
|
inlineContent: Record<string, string>;
|
|
13
13
|
}> | undefined;
|
|
14
14
|
editor: BlockNoteEditor<any, any, any>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Node } from "@tiptap/core";
|
|
2
2
|
export declare const BlockGroup: Node<{
|
|
3
3
|
domAttributes?: Partial<{
|
|
4
|
-
blockGroup: Record<string, string>;
|
|
5
|
-
blockContent: Record<string, string>;
|
|
6
4
|
editor: Record<string, string>;
|
|
7
5
|
block: Record<string, string>;
|
|
6
|
+
blockGroup: Record<string, string>;
|
|
7
|
+
blockContent: Record<string, string>;
|
|
8
8
|
inlineContent: Record<string, string>;
|
|
9
9
|
}> | undefined;
|
|
10
10
|
}, any>;
|
|
@@ -73,11 +73,25 @@ export type BlockSchemaFromSpecs<T extends BlockSpecs> = {
|
|
|
73
73
|
export type BlockSchemaWithBlock<BType extends string, C extends BlockConfig> = {
|
|
74
74
|
[k in BType]: C;
|
|
75
75
|
};
|
|
76
|
+
export type TableCellProps = {
|
|
77
|
+
backgroundColor: string;
|
|
78
|
+
textColor: string;
|
|
79
|
+
textAlignment: "left" | "center" | "right" | "justify";
|
|
80
|
+
colspan?: number;
|
|
81
|
+
rowspan?: number;
|
|
82
|
+
};
|
|
83
|
+
export type TableCell<I extends InlineContentSchema, S extends StyleSchema = StyleSchema> = {
|
|
84
|
+
type: "tableCell";
|
|
85
|
+
props: TableCellProps;
|
|
86
|
+
content: InlineContent<I, S>[];
|
|
87
|
+
};
|
|
76
88
|
export type TableContent<I extends InlineContentSchema, S extends StyleSchema = StyleSchema> = {
|
|
77
89
|
type: "tableContent";
|
|
78
90
|
columnWidths: (number | undefined)[];
|
|
91
|
+
headerRows?: number;
|
|
92
|
+
headerCols?: number;
|
|
79
93
|
rows: {
|
|
80
|
-
cells: InlineContent<I, S>[][];
|
|
94
|
+
cells: InlineContent<I, S>[][] | TableCell<I, S>[];
|
|
81
95
|
}[];
|
|
82
96
|
};
|
|
83
97
|
export type BlockFromConfigNoChildren<B extends BlockConfig, I extends InlineContentSchema, S extends StyleSchema> = {
|
|
@@ -104,11 +118,18 @@ export type SpecificBlock<BSchema extends BlockSchema, BType extends keyof BSche
|
|
|
104
118
|
*create/update blocks in the editor.
|
|
105
119
|
*
|
|
106
120
|
*/
|
|
121
|
+
export type PartialTableCell<I extends InlineContentSchema, S extends StyleSchema = StyleSchema> = {
|
|
122
|
+
type: "tableCell";
|
|
123
|
+
props?: Partial<TableCellProps>;
|
|
124
|
+
content?: PartialInlineContent<I, S>;
|
|
125
|
+
};
|
|
107
126
|
export type PartialTableContent<I extends InlineContentSchema, S extends StyleSchema = StyleSchema> = {
|
|
108
127
|
type: "tableContent";
|
|
109
128
|
columnWidths?: (number | undefined)[];
|
|
129
|
+
headerRows?: number;
|
|
130
|
+
headerCols?: number;
|
|
110
131
|
rows: {
|
|
111
|
-
cells: PartialInlineContent<I, S>[];
|
|
132
|
+
cells: PartialInlineContent<I, S>[] | PartialTableCell<I, S>[];
|
|
112
133
|
}[];
|
|
113
134
|
};
|
|
114
135
|
type PartialBlockFromConfigNoChildren<B extends BlockConfig, I extends InlineContentSchema, S extends StyleSchema> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const isAppleOS: () => boolean;
|
|
2
2
|
export declare function formatKeyboardShortcut(shortcut: string, ctrlText?: string): string;
|
|
3
|
-
export declare function mergeCSSClasses(...classes: (string | undefined)[]): string;
|
|
3
|
+
export declare function mergeCSSClasses(...classes: (string | false | undefined)[]): string;
|
|
4
4
|
export declare const isSafari: () => boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InlineContentSchema, StyleSchema, PartialInlineContent } from "../schema";
|
|
2
|
+
import { PartialTableCell, TableCell } from "../schema/blocks/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* This will map a table cell to a TableCell object.
|
|
5
|
+
* This is useful for when we want to get the full table cell object from a partial table cell.
|
|
6
|
+
* It is guaranteed to return a new TableCell object.
|
|
7
|
+
*/
|
|
8
|
+
export declare function mapTableCell<T extends InlineContentSchema, S extends StyleSchema>(content: PartialInlineContent<T, S> | PartialTableCell<T, S> | TableCell<T, S>): TableCell<T, S>;
|
|
9
|
+
export declare function isPartialTableCell<T extends InlineContentSchema, S extends StyleSchema>(content: TableCell<T, S> | PartialInlineContent<T, S> | PartialTableCell<T, S> | undefined | null): content is PartialTableCell<T, S>;
|
|
10
|
+
export declare function isTableCell<T extends InlineContentSchema, S extends StyleSchema>(content: TableCell<T, S> | PartialInlineContent<T, S> | PartialTableCell<T, S> | undefined | null): content is TableCell<T, S>;
|
|
11
|
+
export declare function getColspan(cell: TableCell<any, any> | PartialTableCell<any, any> | PartialInlineContent<any, any>): number;
|
|
12
|
+
export declare function getRowspan(cell: TableCell<any, any> | PartialTableCell<any, any> | PartialInlineContent<any, any>): number;
|