@blocknote/xl-multi-column 0.32.0-hackdays.0 → 0.33.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/webpack-stats.json +1 -1
- package/package.json +3 -3
- package/src/test/conversions/htmlConversion.test.ts +3 -3
- package/src/test/conversions/nodeConversion.test.ts +1 -1
- package/types/src/test/setupTestEnv.d.ts +84 -4
- package/src/test/conversions/formatConversionTestUtil.ts +0 -199
- package/types/src/test/conversions/formatConversionTestUtil.d.ts +0 -5
package/dist/webpack-stats.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"builtAt":
|
|
1
|
+
{"builtAt":1751535630729,"assets":[{"name":"blocknote-xl-multi-column.cjs","size":20562},{"name":"blocknote-xl-multi-column.cjs.map","size":3791989}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote-xl-multi-column.cjs"],"names":["blocknote-xl-multi-column"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":364,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/de.ts","size":400,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/en.ts","size":378,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/es.ts","size":392,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":398,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/hr.ts","size":396,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":376,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":284,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":288,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":390,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":394,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":388,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ru.ts","size":370,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":340,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":274,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/i18n/dictionary.ts","size":189,"chunks":["a1ee98a"]},{"name":"./src/extensions/ColumnResize/ColumnResizeExtension.ts","size":8309,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Column.ts","size":2611,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/ColumnList.ts","size":1164,"chunks":["a1ee98a"]},{"name":"./src/blocks/Columns/index.ts","size":210,"chunks":["a1ee98a"]},{"name":"./src/blocks/schema.ts","size":425,"chunks":["a1ee98a"]},{"name":"./src/extensions/DropCursor/MultiColumnDropCursorPlugin.ts","size":11715,"chunks":["a1ee98a"]},{"name":"../../node_modules/.pnpm/react-icons@5.5.0_react@18.3.1/node_modules/react-icons/lib/iconContext.mjs","size":251,"chunks":["a1ee98a"]},{"name":"../../node_modules/.pnpm/react-icons@5.5.0_react@18.3.1/node_modules/react-icons/lib/iconBase.mjs","size":4003,"chunks":["a1ee98a"]},{"name":"../../node_modules/.pnpm/react-icons@5.5.0_react@18.3.1/node_modules/react-icons/tb/index.mjs","size":708,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getMultiColumnSlashMenuItems.tsx","size":2073,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"directory": "packages/xl-multi-column"
|
|
10
10
|
},
|
|
11
11
|
"license": "AGPL-3.0 OR PROPRIETARY",
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.33.0",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
15
|
"types",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@blocknote/core": "0.
|
|
46
|
-
"@blocknote/react": "0.
|
|
45
|
+
"@blocknote/core": "0.33.0",
|
|
46
|
+
"@blocknote/react": "0.33.0",
|
|
47
47
|
"@tiptap/core": "^2.12.0",
|
|
48
48
|
"prosemirror-model": "^1.25.1",
|
|
49
49
|
"prosemirror-state": "^1.4.3",
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
createExternalHTMLExporter,
|
|
10
10
|
createInternalHTMLSerializer,
|
|
11
11
|
} from "@blocknote/core";
|
|
12
|
-
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
13
|
-
|
|
14
12
|
import {
|
|
15
13
|
addIdsToBlocks,
|
|
16
14
|
partialBlocksToBlocksForTesting,
|
|
17
|
-
} from "
|
|
15
|
+
} from "@shared/formatConversionTestUtil.js";
|
|
16
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
17
|
+
|
|
18
18
|
import { multiColumnSchemaTestCases } from "./testCases.js";
|
|
19
19
|
|
|
20
20
|
// TODO: code same from @blocknote/core, maybe create separate test util package
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
blockToNode,
|
|
8
8
|
nodeToBlock,
|
|
9
9
|
} from "@blocknote/core";
|
|
10
|
+
import { partialBlockToBlockForTesting } from "@shared/formatConversionTestUtil.js";
|
|
10
11
|
|
|
11
|
-
import { partialBlockToBlockForTesting } from "./formatConversionTestUtil.js";
|
|
12
12
|
import { multiColumnSchemaTestCases } from "./testCases.js";
|
|
13
13
|
|
|
14
14
|
function addIdsToBlock(block: PartialBlock<any, any, any>) {
|
|
@@ -41,7 +41,10 @@ export declare const testEditorSchema: BlockNoteSchema<import("@blocknote/core")
|
|
|
41
41
|
propSchema: {
|
|
42
42
|
level: {
|
|
43
43
|
default: number;
|
|
44
|
-
values: readonly [1, 2, 3];
|
|
44
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
45
|
+
};
|
|
46
|
+
isToggleable: {
|
|
47
|
+
default: false;
|
|
45
48
|
};
|
|
46
49
|
backgroundColor: {
|
|
47
50
|
default: "default";
|
|
@@ -61,7 +64,10 @@ export declare const testEditorSchema: BlockNoteSchema<import("@blocknote/core")
|
|
|
61
64
|
propSchema: {
|
|
62
65
|
level: {
|
|
63
66
|
default: number;
|
|
64
|
-
values: readonly [1, 2, 3];
|
|
67
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
68
|
+
};
|
|
69
|
+
isToggleable: {
|
|
70
|
+
default: false;
|
|
65
71
|
};
|
|
66
72
|
backgroundColor: {
|
|
67
73
|
default: "default";
|
|
@@ -130,6 +136,40 @@ export declare const testEditorSchema: BlockNoteSchema<import("@blocknote/core")
|
|
|
130
136
|
};
|
|
131
137
|
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
132
138
|
};
|
|
139
|
+
toggleListItem: {
|
|
140
|
+
config: {
|
|
141
|
+
type: "toggleListItem";
|
|
142
|
+
content: "inline";
|
|
143
|
+
propSchema: {
|
|
144
|
+
backgroundColor: {
|
|
145
|
+
default: "default";
|
|
146
|
+
};
|
|
147
|
+
textColor: {
|
|
148
|
+
default: "default";
|
|
149
|
+
};
|
|
150
|
+
textAlignment: {
|
|
151
|
+
default: "left";
|
|
152
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
implementation: import("@blocknote/core").TiptapBlockImplementation<{
|
|
157
|
+
type: "toggleListItem";
|
|
158
|
+
content: "inline";
|
|
159
|
+
propSchema: {
|
|
160
|
+
backgroundColor: {
|
|
161
|
+
default: "default";
|
|
162
|
+
};
|
|
163
|
+
textColor: {
|
|
164
|
+
default: "default";
|
|
165
|
+
};
|
|
166
|
+
textAlignment: {
|
|
167
|
+
default: "left";
|
|
168
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
172
|
+
};
|
|
133
173
|
bulletListItem: {
|
|
134
174
|
config: {
|
|
135
175
|
type: "bulletListItem";
|
|
@@ -599,7 +639,10 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("@blocknote
|
|
|
599
639
|
propSchema: {
|
|
600
640
|
level: {
|
|
601
641
|
default: number;
|
|
602
|
-
values: readonly [1, 2, 3];
|
|
642
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
643
|
+
};
|
|
644
|
+
isToggleable: {
|
|
645
|
+
default: false;
|
|
603
646
|
};
|
|
604
647
|
backgroundColor: {
|
|
605
648
|
default: "default";
|
|
@@ -619,7 +662,10 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("@blocknote
|
|
|
619
662
|
propSchema: {
|
|
620
663
|
level: {
|
|
621
664
|
default: number;
|
|
622
|
-
values: readonly [1, 2, 3];
|
|
665
|
+
values: readonly [1, 2, 3, 4, 5, 6];
|
|
666
|
+
};
|
|
667
|
+
isToggleable: {
|
|
668
|
+
default: false;
|
|
623
669
|
};
|
|
624
670
|
backgroundColor: {
|
|
625
671
|
default: "default";
|
|
@@ -688,6 +734,40 @@ export declare function setupTestEnv(): () => BlockNoteEditor<import("@blocknote
|
|
|
688
734
|
};
|
|
689
735
|
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
690
736
|
};
|
|
737
|
+
toggleListItem: {
|
|
738
|
+
config: {
|
|
739
|
+
type: "toggleListItem";
|
|
740
|
+
content: "inline";
|
|
741
|
+
propSchema: {
|
|
742
|
+
backgroundColor: {
|
|
743
|
+
default: "default";
|
|
744
|
+
};
|
|
745
|
+
textColor: {
|
|
746
|
+
default: "default";
|
|
747
|
+
};
|
|
748
|
+
textAlignment: {
|
|
749
|
+
default: "left";
|
|
750
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
};
|
|
754
|
+
implementation: import("@blocknote/core").TiptapBlockImplementation<{
|
|
755
|
+
type: "toggleListItem";
|
|
756
|
+
content: "inline";
|
|
757
|
+
propSchema: {
|
|
758
|
+
backgroundColor: {
|
|
759
|
+
default: "default";
|
|
760
|
+
};
|
|
761
|
+
textColor: {
|
|
762
|
+
default: "default";
|
|
763
|
+
};
|
|
764
|
+
textAlignment: {
|
|
765
|
+
default: "left";
|
|
766
|
+
values: readonly ["left", "center", "right", "justify"];
|
|
767
|
+
};
|
|
768
|
+
};
|
|
769
|
+
}, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
|
|
770
|
+
};
|
|
691
771
|
bulletListItem: {
|
|
692
772
|
config: {
|
|
693
773
|
type: "bulletListItem";
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
// TODO: remove duplicate file
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Block,
|
|
5
|
-
BlockNoteSchema,
|
|
6
|
-
BlockSchema,
|
|
7
|
-
InlineContent,
|
|
8
|
-
InlineContentSchema,
|
|
9
|
-
isPartialLinkInlineContent,
|
|
10
|
-
isStyledTextInlineContent,
|
|
11
|
-
PartialBlock,
|
|
12
|
-
PartialInlineContent,
|
|
13
|
-
PartialTableCell,
|
|
14
|
-
StyledText,
|
|
15
|
-
StyleSchema,
|
|
16
|
-
TableCell,
|
|
17
|
-
TableContent,
|
|
18
|
-
UniqueID,
|
|
19
|
-
} from "@blocknote/core";
|
|
20
|
-
|
|
21
|
-
function textShorthandToStyledText(
|
|
22
|
-
content: string | StyledText<any>[] = "",
|
|
23
|
-
): StyledText<any>[] {
|
|
24
|
-
if (typeof content === "string") {
|
|
25
|
-
return [
|
|
26
|
-
{
|
|
27
|
-
type: "text",
|
|
28
|
-
text: content,
|
|
29
|
-
styles: {},
|
|
30
|
-
},
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
return content;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function partialContentToInlineContent(
|
|
37
|
-
content:
|
|
38
|
-
| PartialInlineContent<any, any>
|
|
39
|
-
| PartialTableCell<any, any>
|
|
40
|
-
| TableContent<any>
|
|
41
|
-
| undefined,
|
|
42
|
-
):
|
|
43
|
-
| InlineContent<any, any>[]
|
|
44
|
-
| TableContent<any>
|
|
45
|
-
| TableCell<any, any>
|
|
46
|
-
| undefined {
|
|
47
|
-
if (typeof content === "string") {
|
|
48
|
-
return textShorthandToStyledText(content);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (Array.isArray(content)) {
|
|
52
|
-
return content.flatMap((partialContent) => {
|
|
53
|
-
if (typeof partialContent === "string") {
|
|
54
|
-
return textShorthandToStyledText(partialContent);
|
|
55
|
-
} else if (isPartialLinkInlineContent(partialContent)) {
|
|
56
|
-
return {
|
|
57
|
-
...partialContent,
|
|
58
|
-
content: textShorthandToStyledText(partialContent.content),
|
|
59
|
-
};
|
|
60
|
-
} else if (isStyledTextInlineContent(partialContent)) {
|
|
61
|
-
return partialContent;
|
|
62
|
-
} else {
|
|
63
|
-
// custom inline content
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
props: {},
|
|
67
|
-
...partialContent,
|
|
68
|
-
content: partialContentToInlineContent(partialContent.content),
|
|
69
|
-
} as any;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
} else if (content?.type === "tableContent") {
|
|
73
|
-
return {
|
|
74
|
-
type: "tableContent",
|
|
75
|
-
columnWidths: content.columnWidths,
|
|
76
|
-
headerRows: content.headerRows,
|
|
77
|
-
headerCols: content.headerCols,
|
|
78
|
-
rows: content.rows.map((row) => ({
|
|
79
|
-
...row,
|
|
80
|
-
cells: row.cells.map(
|
|
81
|
-
(cell) => partialContentToInlineContent(cell) as any,
|
|
82
|
-
),
|
|
83
|
-
})),
|
|
84
|
-
};
|
|
85
|
-
} else if (content?.type === "tableCell") {
|
|
86
|
-
return {
|
|
87
|
-
type: "tableCell",
|
|
88
|
-
content: partialContentToInlineContent(content.content) as any[],
|
|
89
|
-
props: {
|
|
90
|
-
backgroundColor: content.props?.backgroundColor ?? "default",
|
|
91
|
-
textColor: content.props?.textColor ?? "default",
|
|
92
|
-
textAlignment: content.props?.textAlignment ?? "left",
|
|
93
|
-
colspan: content.props?.colspan ?? 1,
|
|
94
|
-
rowspan: content.props?.rowspan ?? 1,
|
|
95
|
-
},
|
|
96
|
-
} satisfies TableCell<any, any>;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return content;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export function partialBlocksToBlocksForTesting<
|
|
103
|
-
BSchema extends BlockSchema,
|
|
104
|
-
I extends InlineContentSchema,
|
|
105
|
-
S extends StyleSchema,
|
|
106
|
-
>(
|
|
107
|
-
schema: BlockNoteSchema<BSchema, I, S>,
|
|
108
|
-
partialBlocks: Array<PartialBlock<NoInfer<BSchema>, NoInfer<I>, NoInfer<S>>>,
|
|
109
|
-
): Array<Block<BSchema, I, S>> {
|
|
110
|
-
return partialBlocks.map((partialBlock) =>
|
|
111
|
-
partialBlockToBlockForTesting(schema.blockSchema, partialBlock),
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function partialBlockToBlockForTesting<
|
|
116
|
-
BSchema extends BlockSchema,
|
|
117
|
-
I extends InlineContentSchema,
|
|
118
|
-
S extends StyleSchema,
|
|
119
|
-
>(
|
|
120
|
-
schema: BSchema,
|
|
121
|
-
partialBlock: PartialBlock<BSchema, I, S>,
|
|
122
|
-
): Block<BSchema, I, S> {
|
|
123
|
-
const contentType: "inline" | "table" | "none" =
|
|
124
|
-
schema[partialBlock.type!].content;
|
|
125
|
-
|
|
126
|
-
const withDefaults: Block<BSchema, I, S> = {
|
|
127
|
-
id: "",
|
|
128
|
-
type: partialBlock.type!,
|
|
129
|
-
props: {} as any,
|
|
130
|
-
content:
|
|
131
|
-
contentType === "inline"
|
|
132
|
-
? []
|
|
133
|
-
: contentType === "table"
|
|
134
|
-
? {
|
|
135
|
-
type: "tableContent",
|
|
136
|
-
columnWidths: undefined,
|
|
137
|
-
headerRows: undefined,
|
|
138
|
-
headerCols: undefined,
|
|
139
|
-
rows: [],
|
|
140
|
-
}
|
|
141
|
-
: (undefined as any),
|
|
142
|
-
children: [] as any,
|
|
143
|
-
...partialBlock,
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
Object.entries(schema[partialBlock.type!].propSchema).forEach(
|
|
147
|
-
([propKey, propValue]) => {
|
|
148
|
-
if (
|
|
149
|
-
withDefaults.props[propKey] === undefined &&
|
|
150
|
-
propValue.default !== undefined
|
|
151
|
-
) {
|
|
152
|
-
(withDefaults.props as any)[propKey] = propValue.default;
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
if (contentType === "inline") {
|
|
158
|
-
const content = withDefaults.content as InlineContent<I, S>[] | undefined;
|
|
159
|
-
withDefaults.content = partialContentToInlineContent(content) as any;
|
|
160
|
-
} else if (contentType === "table") {
|
|
161
|
-
const content = withDefaults.content as TableContent<I, S> | undefined;
|
|
162
|
-
withDefaults.content = {
|
|
163
|
-
type: "tableContent",
|
|
164
|
-
columnWidths:
|
|
165
|
-
content?.columnWidths ||
|
|
166
|
-
content?.rows[0]?.cells.map(() => undefined) ||
|
|
167
|
-
[],
|
|
168
|
-
headerRows: content?.headerRows || undefined,
|
|
169
|
-
headerCols: content?.headerCols || undefined,
|
|
170
|
-
rows:
|
|
171
|
-
content?.rows.map((row) => ({
|
|
172
|
-
cells: row.cells.map((cell) => partialContentToInlineContent(cell)),
|
|
173
|
-
})) || [],
|
|
174
|
-
} as any;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return {
|
|
178
|
-
...withDefaults,
|
|
179
|
-
content: partialContentToInlineContent(withDefaults.content),
|
|
180
|
-
children: withDefaults.children.map((c) => {
|
|
181
|
-
return partialBlockToBlockForTesting(schema, c);
|
|
182
|
-
}),
|
|
183
|
-
} as any;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export function addIdsToBlock(block: PartialBlock<any, any, any>) {
|
|
187
|
-
if (!block.id) {
|
|
188
|
-
block.id = UniqueID.options.generateID();
|
|
189
|
-
}
|
|
190
|
-
if (block.children) {
|
|
191
|
-
addIdsToBlocks(block.children);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export function addIdsToBlocks(blocks: PartialBlock<any, any, any>[]) {
|
|
196
|
-
for (const block of blocks) {
|
|
197
|
-
addIdsToBlock(block);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Block, BlockNoteSchema, BlockSchema, InlineContentSchema, PartialBlock, StyleSchema } from "@blocknote/core";
|
|
2
|
-
export declare function partialBlocksToBlocksForTesting<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(schema: BlockNoteSchema<BSchema, I, S>, partialBlocks: Array<PartialBlock<NoInfer<BSchema>, NoInfer<I>, NoInfer<S>>>): Array<Block<BSchema, I, S>>;
|
|
3
|
-
export declare function partialBlockToBlockForTesting<BSchema extends BlockSchema, I extends InlineContentSchema, S extends StyleSchema>(schema: BSchema, partialBlock: PartialBlock<BSchema, I, S>): Block<BSchema, I, S>;
|
|
4
|
-
export declare function addIdsToBlock(block: PartialBlock<any, any, any>): void;
|
|
5
|
-
export declare function addIdsToBlocks(blocks: PartialBlock<any, any, any>[]): void;
|