@blocknote/core 0.24.1 → 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 +5028 -3444
- 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/fromClipboard/handleFileInsertion.ts +36 -14
- 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 +16 -10
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +3 -3
- package/src/extensions/ShowSelection/ShowSelectionPlugin.ts +52 -0
- package/src/extensions/SideMenu/SideMenuPlugin.ts +22 -9
- 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/extensions/UniqueID/UniqueID.ts +8 -3
- 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/index.ts +1 -0
- package/src/i18n/locales/is.ts +24 -1
- package/src/i18n/locales/it.ts +21 -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 +346 -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/FormattingToolbar/FormattingToolbarPlugin.d.ts +1 -1
- package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +15 -0
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +1 -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/index.d.ts +1 -0
- package/types/src/i18n/locales/it.d.ts +21 -0
- package/types/src/i18n/locales/no.d.ts +2 -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
package/src/index.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 {
|
|
24
25
|
EMPTY_CELL_HEIGHT,
|
|
25
26
|
EMPTY_CELL_WIDTH,
|
|
@@ -52,11 +53,11 @@ export * from "./schema/index.js";
|
|
|
52
53
|
export * from "./util/browser.js";
|
|
53
54
|
export * from "./util/combineByGroup.js";
|
|
54
55
|
export * from "./util/esmDependencies.js";
|
|
56
|
+
export * from "./util/table.js";
|
|
55
57
|
export * from "./util/string.js";
|
|
56
58
|
export * from "./util/typescript.js";
|
|
57
59
|
export { UnreachableCaseError, assertEmpty } from "./util/typescript.js";
|
|
58
60
|
export { locales };
|
|
59
|
-
export * from "./api/blockManipulation/commands/updateBlock/updateBlock.js";
|
|
60
61
|
|
|
61
62
|
// for testing from react (TODO: move):
|
|
62
63
|
export * from "./api/nodeConversions/blockToNode.js";
|
|
@@ -68,3 +69,4 @@ export * from "./extensions/UniqueID/UniqueID.js";
|
|
|
68
69
|
export * from "./api/exporters/markdown/markdownExporter.js";
|
|
69
70
|
export * from "./api/parsers/html/parseHTML.js";
|
|
70
71
|
export * from "./api/parsers/markdown/parseMarkdown.js";
|
|
72
|
+
|
|
@@ -144,14 +144,33 @@ export type BlockSchemaWithBlock<
|
|
|
144
144
|
[k in BType]: C;
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
+
export type TableCellProps = {
|
|
148
|
+
backgroundColor: string;
|
|
149
|
+
textColor: string;
|
|
150
|
+
textAlignment: "left" | "center" | "right" | "justify";
|
|
151
|
+
colspan?: number;
|
|
152
|
+
rowspan?: number;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type TableCell<
|
|
156
|
+
I extends InlineContentSchema,
|
|
157
|
+
S extends StyleSchema = StyleSchema
|
|
158
|
+
> = {
|
|
159
|
+
type: "tableCell";
|
|
160
|
+
props: TableCellProps;
|
|
161
|
+
content: InlineContent<I, S>[];
|
|
162
|
+
};
|
|
163
|
+
|
|
147
164
|
export type TableContent<
|
|
148
165
|
I extends InlineContentSchema,
|
|
149
166
|
S extends StyleSchema = StyleSchema
|
|
150
167
|
> = {
|
|
151
168
|
type: "tableContent";
|
|
152
169
|
columnWidths: (number | undefined)[];
|
|
170
|
+
headerRows?: number;
|
|
171
|
+
headerCols?: number;
|
|
153
172
|
rows: {
|
|
154
|
-
cells: InlineContent<I, S>[][];
|
|
173
|
+
cells: InlineContent<I, S>[][] | TableCell<I, S>[];
|
|
155
174
|
}[];
|
|
156
175
|
};
|
|
157
176
|
|
|
@@ -220,14 +239,25 @@ export type SpecificBlock<
|
|
|
220
239
|
*
|
|
221
240
|
*/
|
|
222
241
|
|
|
242
|
+
export type PartialTableCell<
|
|
243
|
+
I extends InlineContentSchema,
|
|
244
|
+
S extends StyleSchema = StyleSchema
|
|
245
|
+
> = {
|
|
246
|
+
type: "tableCell";
|
|
247
|
+
props?: Partial<TableCellProps>;
|
|
248
|
+
content?: PartialInlineContent<I, S>;
|
|
249
|
+
};
|
|
250
|
+
|
|
223
251
|
export type PartialTableContent<
|
|
224
252
|
I extends InlineContentSchema,
|
|
225
253
|
S extends StyleSchema = StyleSchema
|
|
226
254
|
> = {
|
|
227
255
|
type: "tableContent";
|
|
228
256
|
columnWidths?: (number | undefined)[];
|
|
257
|
+
headerRows?: number;
|
|
258
|
+
headerCols?: number;
|
|
229
259
|
rows: {
|
|
230
|
-
cells: PartialInlineContent<I, S>[];
|
|
260
|
+
cells: PartialInlineContent<I, S>[] | PartialTableCell<I, S>[];
|
|
231
261
|
}[];
|
|
232
262
|
};
|
|
233
263
|
|
package/src/util/browser.ts
CHANGED
|
@@ -12,7 +12,7 @@ export function formatKeyboardShortcut(shortcut: string, ctrlText = "Ctrl") {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function mergeCSSClasses(...classes: string[]) {
|
|
15
|
+
export function mergeCSSClasses(...classes: (string | false | undefined)[]) {
|
|
16
16
|
return classes.filter((c) => c).join(" ");
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
InlineContentSchema,
|
|
3
|
+
StyleSchema,
|
|
4
|
+
PartialInlineContent,
|
|
5
|
+
InlineContent,
|
|
6
|
+
} from "../schema";
|
|
7
|
+
import { PartialTableCell, TableCell } from "../schema/blocks/types.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This will map a table cell to a TableCell object.
|
|
11
|
+
* This is useful for when we want to get the full table cell object from a partial table cell.
|
|
12
|
+
* It is guaranteed to return a new TableCell object.
|
|
13
|
+
*/
|
|
14
|
+
export function mapTableCell<
|
|
15
|
+
T extends InlineContentSchema,
|
|
16
|
+
S extends StyleSchema
|
|
17
|
+
>(
|
|
18
|
+
content: PartialInlineContent<T, S> | PartialTableCell<T, S> | TableCell<T, S>
|
|
19
|
+
): TableCell<T, S> {
|
|
20
|
+
return isTableCell(content)
|
|
21
|
+
? { ...content }
|
|
22
|
+
: isPartialTableCell(content)
|
|
23
|
+
? {
|
|
24
|
+
type: "tableCell",
|
|
25
|
+
content: ([] as InlineContent<T, S>[]).concat(content.content as any),
|
|
26
|
+
props: {
|
|
27
|
+
backgroundColor: content.props?.backgroundColor ?? "default",
|
|
28
|
+
textColor: content.props?.textColor ?? "default",
|
|
29
|
+
textAlignment: content.props?.textAlignment ?? "left",
|
|
30
|
+
colspan: content.props?.colspan ?? 1,
|
|
31
|
+
rowspan: content.props?.rowspan ?? 1,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
: {
|
|
35
|
+
type: "tableCell",
|
|
36
|
+
content: ([] as InlineContent<T, S>[]).concat(content as any),
|
|
37
|
+
props: {
|
|
38
|
+
backgroundColor: "default",
|
|
39
|
+
textColor: "default",
|
|
40
|
+
textAlignment: "left",
|
|
41
|
+
colspan: 1,
|
|
42
|
+
rowspan: 1,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function isPartialTableCell<
|
|
48
|
+
T extends InlineContentSchema,
|
|
49
|
+
S extends StyleSchema
|
|
50
|
+
>(
|
|
51
|
+
content:
|
|
52
|
+
| TableCell<T, S>
|
|
53
|
+
| PartialInlineContent<T, S>
|
|
54
|
+
| PartialTableCell<T, S>
|
|
55
|
+
| undefined
|
|
56
|
+
| null
|
|
57
|
+
): content is PartialTableCell<T, S> {
|
|
58
|
+
return (
|
|
59
|
+
content !== undefined &&
|
|
60
|
+
content !== null &&
|
|
61
|
+
typeof content !== "string" &&
|
|
62
|
+
!Array.isArray(content) &&
|
|
63
|
+
content.type === "tableCell"
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function isTableCell<
|
|
68
|
+
T extends InlineContentSchema,
|
|
69
|
+
S extends StyleSchema
|
|
70
|
+
>(
|
|
71
|
+
content:
|
|
72
|
+
| TableCell<T, S>
|
|
73
|
+
| PartialInlineContent<T, S>
|
|
74
|
+
| PartialTableCell<T, S>
|
|
75
|
+
| undefined
|
|
76
|
+
| null
|
|
77
|
+
): content is TableCell<T, S> {
|
|
78
|
+
return (
|
|
79
|
+
isPartialTableCell(content) &&
|
|
80
|
+
content.props !== undefined &&
|
|
81
|
+
content.content !== undefined
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function getColspan(
|
|
86
|
+
cell:
|
|
87
|
+
| TableCell<any, any>
|
|
88
|
+
| PartialTableCell<any, any>
|
|
89
|
+
| PartialInlineContent<any, any>
|
|
90
|
+
): number {
|
|
91
|
+
if (isTableCell(cell)) {
|
|
92
|
+
return cell.props.colspan ?? 1;
|
|
93
|
+
}
|
|
94
|
+
return 1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function getRowspan(
|
|
98
|
+
cell:
|
|
99
|
+
| TableCell<any, any>
|
|
100
|
+
| PartialTableCell<any, any>
|
|
101
|
+
| PartialInlineContent<any, any>
|
|
102
|
+
): number {
|
|
103
|
+
if (isTableCell(cell)) {
|
|
104
|
+
return cell.props.rowspan ?? 1;
|
|
105
|
+
}
|
|
106
|
+
return 1;
|
|
107
|
+
}
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { DefaultBlockSchema } from "../../../blocks/defaultBlocks.js";
|
|
2
|
+
import { BlockFromConfigNoChildren, TableCell, TableContent } from "../../../schema/blocks/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Here be dragons.
|
|
5
|
+
*
|
|
6
|
+
* Tables are complex because of rowspan and colspan behavior.
|
|
7
|
+
* The majority of this file is concerned with translating between "relative" and "absolute" indices.
|
|
8
|
+
*
|
|
9
|
+
* The following diagram may help explain the relationship between the different indices:
|
|
10
|
+
*
|
|
11
|
+
* One-based indexing of rows and columns in a table:
|
|
12
|
+
* | 1-1 | 1-2 | 1-3 |
|
|
13
|
+
* | 2-1 | 2-2 | 2-3 |
|
|
14
|
+
* | 3-1 | 3-2 | 3-3 |
|
|
15
|
+
*
|
|
16
|
+
* A complicated table with colspans and rowspans:
|
|
17
|
+
* | 1-1 | 1-2 | 1-2 |
|
|
18
|
+
* | 2-1 | 2-1 | 2-2 |
|
|
19
|
+
* | 2-1 | 2-1 | 3-1 |
|
|
20
|
+
*
|
|
21
|
+
* You can see here that we have:
|
|
22
|
+
* - two cells that contain the value "1-2", because it has a colspan of 2.
|
|
23
|
+
* - four cells that contain the value "2-1", because it has a rowspan of 2 and a colspan of 2.
|
|
24
|
+
*
|
|
25
|
+
* This would be represented in block note json (roughly) as:
|
|
26
|
+
* [
|
|
27
|
+
* {
|
|
28
|
+
* "cells": [
|
|
29
|
+
* {
|
|
30
|
+
* "type": "tableCell",
|
|
31
|
+
* "content": ["1,1"],
|
|
32
|
+
* "props": {
|
|
33
|
+
* "colspan": 1,
|
|
34
|
+
* "rowspan": 1
|
|
35
|
+
* },
|
|
36
|
+
* },
|
|
37
|
+
* {
|
|
38
|
+
* "type": "tableCell",
|
|
39
|
+
* "content": ["1,2"],
|
|
40
|
+
* "props": {
|
|
41
|
+
* "colspan": 2,
|
|
42
|
+
* "rowspan": 1
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
* ],
|
|
46
|
+
* },
|
|
47
|
+
* {
|
|
48
|
+
* "cells": [
|
|
49
|
+
* {
|
|
50
|
+
* "type": "tableCell",
|
|
51
|
+
* "content": ["2,1"],
|
|
52
|
+
* "props": {
|
|
53
|
+
* "colspan": 2,
|
|
54
|
+
* "rowspan": 2
|
|
55
|
+
* }
|
|
56
|
+
* },
|
|
57
|
+
* {
|
|
58
|
+
* "type": "tableCell",
|
|
59
|
+
* "content": ["2,2"],
|
|
60
|
+
* "props": {
|
|
61
|
+
* "colspan": 1,
|
|
62
|
+
* "rowspan": 1
|
|
63
|
+
* }
|
|
64
|
+
* ],
|
|
65
|
+
* },
|
|
66
|
+
* {
|
|
67
|
+
* "cells": [
|
|
68
|
+
* {
|
|
69
|
+
* "type": "tableCell",
|
|
70
|
+
* "content": ["3,1"],
|
|
71
|
+
* "props": {
|
|
72
|
+
* "colspan": 1,
|
|
73
|
+
* "rowspan": 1,
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* ]
|
|
77
|
+
* }
|
|
78
|
+
* ]
|
|
79
|
+
*
|
|
80
|
+
* Which maps cleanly to the following HTML:
|
|
81
|
+
*
|
|
82
|
+
* <table>
|
|
83
|
+
* <tr>
|
|
84
|
+
* <td>1-1</td>
|
|
85
|
+
* <td colspan="2">1-2</td>
|
|
86
|
+
* </tr>
|
|
87
|
+
* <tr>
|
|
88
|
+
* <td rowspan="2" colspan="2">2-1</td>
|
|
89
|
+
* <td>2-2</td>
|
|
90
|
+
* </tr>
|
|
91
|
+
* <tr>
|
|
92
|
+
* <td>3-1</td>
|
|
93
|
+
* </tr>
|
|
94
|
+
* </table>
|
|
95
|
+
*
|
|
96
|
+
* We have a problem though, from the block json, there is no way to tell that the cell "2-1" is the second cell in the second row.
|
|
97
|
+
* To resolve this, we created the occupancy grid, which is a grid of all the cells in the table, as though they were only 1x1 cells.
|
|
98
|
+
* See {@link OccupancyGrid} for more information.
|
|
99
|
+
*
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
* Relative cell indices are relative to the table block's content.
|
|
103
|
+
*
|
|
104
|
+
* This is a sparse representation of the table and is how HTML and BlockNote JSON represent tables.
|
|
105
|
+
*
|
|
106
|
+
* For example, if we have a table with a rowspan of 2, the second row may only have 1 element in a 2x2 table.
|
|
107
|
+
*
|
|
108
|
+
* ```
|
|
109
|
+
* // Visual representation of the table
|
|
110
|
+
* | 1-1 | 1-2 | // has 2 cells
|
|
111
|
+
* | 1-1 | 2-2 | // has only 1 cell
|
|
112
|
+
* // Relative cell indices
|
|
113
|
+
* [{ row: 1, col: 1, rowspan: 2 }, { row: 1, col: 2 }] // has 2 cells
|
|
114
|
+
* [{ row: 1, col: 2 }] // has only 1 cell
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
export type RelativeCellIndices = {
|
|
118
|
+
row: number;
|
|
119
|
+
col: number;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Absolute cell indices are relative to the table's layout (it's {@link OccupancyGrid}).
|
|
123
|
+
*
|
|
124
|
+
* It is as though the table is a grid of 1x1 cells, and any colspan or rowspan results in multiple 1x1 cells being occupied.
|
|
125
|
+
*
|
|
126
|
+
* For example, if we have a table with a colspan of 2, it will occupy 2 cells in the layout grid.
|
|
127
|
+
*
|
|
128
|
+
* ```
|
|
129
|
+
* // Visual representation of the table
|
|
130
|
+
* | 1-1 | 1-1 | // has 2 cells
|
|
131
|
+
* | 2-1 | 2-2 | // has 2 cell
|
|
132
|
+
* // Absolute cell indices
|
|
133
|
+
* [{ row: 1, col: 1, colspan: 2 }, { row: 1, col: 2, colspan: 2 }] // has 2 cells
|
|
134
|
+
* [{ row: 1, col: 1 }, { row: 1, col: 2 }] // has 2 cells
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export type AbsoluteCellIndices = {
|
|
138
|
+
row: number;
|
|
139
|
+
col: number;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* An occupancy grid is a grid of the occupied cells in the table.
|
|
143
|
+
* It is used to track the occupied cells in the table to know where to place the next cell.
|
|
144
|
+
*
|
|
145
|
+
* Since it allows us to resolve cell indices both {@link RelativeCellIndices} and {@link AbsoluteCellIndices}, it is the core data structure for table operations.
|
|
146
|
+
*/
|
|
147
|
+
type OccupancyGrid = (RelativeCellIndices & {
|
|
148
|
+
/**
|
|
149
|
+
* The rowspan of the cell.
|
|
150
|
+
*/
|
|
151
|
+
rowspan: number;
|
|
152
|
+
/**
|
|
153
|
+
* The colspan of the cell.
|
|
154
|
+
*/
|
|
155
|
+
colspan: number;
|
|
156
|
+
/**
|
|
157
|
+
* The cell.
|
|
158
|
+
*/
|
|
159
|
+
cell: TableCell<any, any>;
|
|
160
|
+
})[][];
|
|
161
|
+
/**
|
|
162
|
+
* This will return the {@link OccupancyGrid} of the table.
|
|
163
|
+
* By laying out the table as though it were a grid of 1x1 cells, we can easily track where the cells are located (both relatively and absolutely).
|
|
164
|
+
*
|
|
165
|
+
* @returns an {@link OccupancyGrid}
|
|
166
|
+
*/
|
|
167
|
+
export declare function getTableCellOccupancyGrid(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>): OccupancyGrid;
|
|
168
|
+
/**
|
|
169
|
+
* Given an {@link OccupancyGrid}, this will return the {@link TableContent} rows.
|
|
170
|
+
*
|
|
171
|
+
* @note This will remove duplicates from the occupancy grid. And does no bounds checking for validity of the occupancy grid.
|
|
172
|
+
*/
|
|
173
|
+
export declare function getTableRowsFromOccupancyGrid(occupancyGrid: OccupancyGrid): TableContent<any, any>["rows"];
|
|
174
|
+
/**
|
|
175
|
+
* This will resolve the relative cell indices within the table block to the absolute cell indices within the table, accounting for colspan and rowspan.
|
|
176
|
+
*
|
|
177
|
+
* @note It will return only the first cell (i.e. top-left) that matches the relative cell indices. To find the other absolute cell indices this cell occupies, you can assume it is the rowspan and colspan number of cells away from the top-left cell.
|
|
178
|
+
*
|
|
179
|
+
* @returns The {@link AbsoluteCellIndices} and the {@link TableCell} at the absolute position.
|
|
180
|
+
*/
|
|
181
|
+
export declare function getAbsoluteTableCells(
|
|
182
|
+
/**
|
|
183
|
+
* The relative position of the cell in the table.
|
|
184
|
+
*/
|
|
185
|
+
relativeCellIndices: RelativeCellIndices,
|
|
186
|
+
/**
|
|
187
|
+
* The table block containing the cell.
|
|
188
|
+
*/
|
|
189
|
+
block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>,
|
|
190
|
+
/**
|
|
191
|
+
* The occupancy grid of the table.
|
|
192
|
+
*/
|
|
193
|
+
occupancyGrid?: OccupancyGrid): AbsoluteCellIndices & {
|
|
194
|
+
cell: TableCell<any, any>;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* This will get the dimensions of the table block.
|
|
198
|
+
*
|
|
199
|
+
* @returns The height and width of the table.
|
|
200
|
+
*/
|
|
201
|
+
export declare function getDimensionsOfTable(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>): {
|
|
202
|
+
/**
|
|
203
|
+
* The number of rows in the table.
|
|
204
|
+
*/
|
|
205
|
+
height: number;
|
|
206
|
+
/**
|
|
207
|
+
* The number of columns in the table.
|
|
208
|
+
*/
|
|
209
|
+
width: number;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* This will resolve the absolute cell indices within the table block to the relative cell indices within the table, accounting for colspan and rowspan.
|
|
213
|
+
*
|
|
214
|
+
* @returns The {@link RelativeCellIndices} and the {@link TableCell} at the relative position.
|
|
215
|
+
*/
|
|
216
|
+
export declare function getRelativeTableCells(
|
|
217
|
+
/**
|
|
218
|
+
* The {@link AbsoluteCellIndices} of the cell in the table.
|
|
219
|
+
*/
|
|
220
|
+
absoluteCellIndices: AbsoluteCellIndices,
|
|
221
|
+
/**
|
|
222
|
+
* The table block containing the cell.
|
|
223
|
+
*/
|
|
224
|
+
block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>,
|
|
225
|
+
/**
|
|
226
|
+
* The occupancy grid of the table.
|
|
227
|
+
*/
|
|
228
|
+
occupancyGrid?: OccupancyGrid): (RelativeCellIndices & {
|
|
229
|
+
cell: TableContent<any, any>["rows"][number]["cells"][number];
|
|
230
|
+
}) | undefined;
|
|
231
|
+
/**
|
|
232
|
+
* This will get all the cells within a relative row of a table block.
|
|
233
|
+
*
|
|
234
|
+
* This method always starts the search for the row at the first column of the table.
|
|
235
|
+
*
|
|
236
|
+
* ```
|
|
237
|
+
* // Visual representation of a table
|
|
238
|
+
* | A | B | C |
|
|
239
|
+
* | | D | E |
|
|
240
|
+
* | F | G | H |
|
|
241
|
+
* // "A" has a rowspan of 2
|
|
242
|
+
*
|
|
243
|
+
* // getCellsAtRowHandle(0)
|
|
244
|
+
* // returns [
|
|
245
|
+
* { row: 0, col: 0, cell: "A" },
|
|
246
|
+
* { row: 0, col: 1, cell: "B" },
|
|
247
|
+
* { row: 0, col: 2, cell: "C" },
|
|
248
|
+
* ]
|
|
249
|
+
*
|
|
250
|
+
* // getCellsAtColumnHandle(1)
|
|
251
|
+
* // returns [
|
|
252
|
+
* { row: 1, col: 0, cell: "F" },
|
|
253
|
+
* { row: 1, col: 1, cell: "G" },
|
|
254
|
+
* { row: 1, col: 2, cell: "H" },
|
|
255
|
+
* ]
|
|
256
|
+
* ```
|
|
257
|
+
*
|
|
258
|
+
* As you can see, you may not be able to retrieve all nodes given a relative row index, as cells can span multiple rows.
|
|
259
|
+
*
|
|
260
|
+
* @returns All of the cells associated with the relative row of the table. (All cells that have the same relative row index)
|
|
261
|
+
*/
|
|
262
|
+
export declare function getCellsAtRowHandle(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, relativeRowIndex: RelativeCellIndices["row"]): (RelativeCellIndices & {
|
|
263
|
+
cell: TableCell<any, any>;
|
|
264
|
+
})[];
|
|
265
|
+
/**
|
|
266
|
+
* This will get all the cells within a relative column of a table block.
|
|
267
|
+
*
|
|
268
|
+
* This method always starts the search for the column at the first row of the table.
|
|
269
|
+
*
|
|
270
|
+
* ```
|
|
271
|
+
* // Visual representation of a table
|
|
272
|
+
* | A | B |
|
|
273
|
+
* | C | D | E |
|
|
274
|
+
* | F | G | H |
|
|
275
|
+
* // "A" has a colspan of 2
|
|
276
|
+
*
|
|
277
|
+
* // getCellsAtColumnHandle(0)
|
|
278
|
+
* // returns [
|
|
279
|
+
* { row: 0, col: 0, cell: "A" },
|
|
280
|
+
* { row: 1, col: 0, cell: "C" },
|
|
281
|
+
* { row: 2, col: 0, cell: "F" },
|
|
282
|
+
* ]
|
|
283
|
+
*
|
|
284
|
+
* // getCellsAtColumnHandle(1)
|
|
285
|
+
* // returns [
|
|
286
|
+
* { row: 0, col: 1, cell: "B" },
|
|
287
|
+
* { row: 1, col: 2, cell: "E" },
|
|
288
|
+
* { row: 2, col: 2, cell: "F" },
|
|
289
|
+
* ]
|
|
290
|
+
* ```
|
|
291
|
+
*
|
|
292
|
+
* As you can see, you may not be able to retrieve all nodes given a relative column index, as cells can span multiple columns.
|
|
293
|
+
*
|
|
294
|
+
* @returns All of the cells associated with the relative column of the table. (All cells that have the same relative column index)
|
|
295
|
+
*/
|
|
296
|
+
export declare function getCellsAtColumnHandle(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, relativeColumnIndex: RelativeCellIndices["col"]): (RelativeCellIndices & {
|
|
297
|
+
cell: TableCell<any, any>;
|
|
298
|
+
})[];
|
|
299
|
+
/**
|
|
300
|
+
* This moves a column from one index to another.
|
|
301
|
+
*
|
|
302
|
+
* @note This is a destructive operation, it will modify the provided {@link OccupancyGrid} in place.
|
|
303
|
+
*/
|
|
304
|
+
export declare function moveColumn(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, fromColIndex: RelativeCellIndices["col"], toColIndex: RelativeCellIndices["col"], occupancyGrid?: OccupancyGrid): TableContent<any, any>["rows"];
|
|
305
|
+
/**
|
|
306
|
+
* This moves a row from one index to another.
|
|
307
|
+
*
|
|
308
|
+
* @note This is a destructive operation, it will modify the {@link OccupancyGrid} in place.
|
|
309
|
+
*/
|
|
310
|
+
export declare function moveRow(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, fromRowIndex: RelativeCellIndices["row"], toRowIndex: RelativeCellIndices["row"], occupancyGrid?: OccupancyGrid): TableContent<any, any>["rows"];
|
|
311
|
+
/**
|
|
312
|
+
* This will remove empty rows or columns from the table.
|
|
313
|
+
*
|
|
314
|
+
* @note This is a destructive operation, it will modify the {@link OccupancyGrid} in place.
|
|
315
|
+
*/
|
|
316
|
+
export declare function cropEmptyRowsOrColumns(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, removeEmpty: "columns" | "rows", occupancyGrid?: OccupancyGrid): TableContent<any, any>["rows"];
|
|
317
|
+
/**
|
|
318
|
+
* This will add a specified number of rows or columns to the table (filling with empty cells).
|
|
319
|
+
*
|
|
320
|
+
* @note This is a destructive operation, it will modify the {@link OccupancyGrid} in place.
|
|
321
|
+
*/
|
|
322
|
+
export declare function addRowsOrColumns(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, addType: "columns" | "rows",
|
|
323
|
+
/**
|
|
324
|
+
* The number of rows or columns to add.
|
|
325
|
+
*
|
|
326
|
+
* @note if negative, it will remove rows or columns.
|
|
327
|
+
*/
|
|
328
|
+
numToAdd: number, occupancyGrid?: OccupancyGrid): TableContent<any, any>["rows"];
|
|
329
|
+
/**
|
|
330
|
+
* Checks if a row can be safely dropped at the target row index without splitting merged cells.
|
|
331
|
+
*/
|
|
332
|
+
export declare function canRowBeDraggedInto(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, draggingIndex: RelativeCellIndices["row"], targetRowIndex: RelativeCellIndices["row"]): boolean;
|
|
333
|
+
/**
|
|
334
|
+
* Checks if a column can be safely dropped at the target column index without splitting merged cells.
|
|
335
|
+
*/
|
|
336
|
+
export declare function canColumnBeDraggedInto(block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>, draggingIndex: RelativeCellIndices["col"], targetColumnIndex: RelativeCellIndices["col"]): boolean;
|
|
337
|
+
/**
|
|
338
|
+
* Checks if two cells are in the same column.
|
|
339
|
+
*
|
|
340
|
+
* @returns True if the cells are in the same column, false otherwise.
|
|
341
|
+
*/
|
|
342
|
+
export declare function areInSameColumn(from: RelativeCellIndices, to: RelativeCellIndices, block: BlockFromConfigNoChildren<DefaultBlockSchema["table"], any, any>): boolean;
|
|
343
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Extension } from "@tiptap/core";
|
|
2
|
-
import { EditorView } from "prosemirror-view";
|
|
2
|
+
import type { EditorView } from "prosemirror-view";
|
|
3
3
|
import type { BlockNoteEditor } from "../../../editor/BlockNoteEditor.js";
|
|
4
4
|
import { BlockSchema, InlineContentSchema, StyleSchema } from "../../../schema/index.js";
|
|
5
5
|
export declare function selectedFragmentToHTML<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(view: EditorView, editor: BlockNoteEditor<BSchema, I, S>): {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Node } from "@tiptap/core";
|
|
2
1
|
export declare const tablePropSchema: {
|
|
3
2
|
textColor: {
|
|
4
3
|
default: "default";
|
|
5
4
|
};
|
|
6
5
|
};
|
|
7
|
-
export declare const TableBlockContent: Node<any, any> & {
|
|
6
|
+
export declare const TableBlockContent: import("@tiptap/core").Node<any, any> & {
|
|
8
7
|
name: "table";
|
|
9
8
|
config: {
|
|
10
9
|
content: "tableRow+";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { CellSelection } from "prosemirror-tables";
|
|
1
2
|
import type { BlockNoteEditor } from "../editor/BlockNoteEditor.js";
|
|
2
3
|
import { BlockFromConfig, BlockSchema, FileBlockConfig, InlineContentSchema, StyleSchema } from "../schema/index.js";
|
|
3
4
|
import { Block, DefaultBlockSchema, DefaultInlineContentSchema } from "./defaultBlocks.js";
|
|
4
5
|
import { defaultProps } from "./defaultProps.js";
|
|
6
|
+
import { Selection } from "prosemirror-state";
|
|
5
7
|
export declare function checkDefaultBlockTypeInSchema<BlockType extends keyof DefaultBlockSchema, I extends InlineContentSchema, S extends StyleSchema>(blockType: BlockType, editor: BlockNoteEditor<any, I, S>): editor is BlockNoteEditor<{
|
|
6
8
|
Type: DefaultBlockSchema[BlockType];
|
|
7
9
|
}, I, S>;
|
|
@@ -30,3 +32,4 @@ export declare function checkBlockHasDefaultProp<Prop extends keyof typeof defau
|
|
|
30
32
|
};
|
|
31
33
|
content: "table" | "inline" | "none";
|
|
32
34
|
}, I, S>;
|
|
35
|
+
export declare function isTableCellSelection(selection: Selection): selection is CellSelection;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./models/User.js";
|
|
2
|
+
export * from "./threadstore/DefaultThreadStoreAuth.js";
|
|
3
|
+
export * from "./threadstore/ThreadStore.js";
|
|
4
|
+
export * from "./threadstore/ThreadStoreAuth.js";
|
|
5
|
+
export * from "./threadstore/TipTapThreadStore.js";
|
|
6
|
+
export * from "./threadstore/yjs/RESTYjsThreadStore.js";
|
|
7
|
+
export * from "./threadstore/yjs/YjsThreadStore.js";
|
|
8
|
+
export * from "./threadstore/yjs/YjsThreadStoreBase.js";
|
|
9
|
+
export * from "./types.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CommentData, ThreadData } from "../types.js";
|
|
2
|
+
import { ThreadStoreAuth } from "./ThreadStoreAuth.js";
|
|
3
|
+
export declare class DefaultThreadStoreAuth extends ThreadStoreAuth {
|
|
4
|
+
private readonly userId;
|
|
5
|
+
private readonly role;
|
|
6
|
+
constructor(userId: string, role: "comment" | "editor");
|
|
7
|
+
/**
|
|
8
|
+
* Auth: should be possible by anyone with comment access
|
|
9
|
+
*/
|
|
10
|
+
canCreateThread(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Auth: should be possible by anyone with comment access
|
|
13
|
+
*/
|
|
14
|
+
canAddComment(_thread: ThreadData): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Auth: should only be possible by the comment author
|
|
17
|
+
*/
|
|
18
|
+
canUpdateComment(comment: CommentData): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Auth: should be possible by the comment author OR an editor of the document
|
|
21
|
+
*/
|
|
22
|
+
canDeleteComment(comment: CommentData): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Auth: should only be possible by an editor of the document
|
|
25
|
+
*/
|
|
26
|
+
canDeleteThread(_thread: ThreadData): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Auth: should be possible by anyone with comment access
|
|
29
|
+
*/
|
|
30
|
+
canResolveThread(_thread: ThreadData): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Auth: should be possible by anyone with comment access
|
|
33
|
+
*/
|
|
34
|
+
canUnresolveThread(_thread: ThreadData): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Auth: should be possible by anyone with comment access
|
|
37
|
+
*
|
|
38
|
+
* Note: will also check if the user has already reacted with the same emoji. TBD: is that a nice design or should this responsibility be outside of auth?
|
|
39
|
+
*/
|
|
40
|
+
canAddReaction(comment: CommentData, emoji?: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Auth: should be possible by anyone with comment access
|
|
43
|
+
*
|
|
44
|
+
* Note: will also check if the user has already reacted with the same emoji. TBD: is that a nice design or should this responsibility be outside of auth?
|
|
45
|
+
*/
|
|
46
|
+
canDeleteReaction(comment: CommentData, emoji?: string): boolean;
|
|
47
|
+
}
|