Skip to content

Commit 41b2e43

Browse files
committed
fix: update the extend types
1 parent fdbc419 commit 41b2e43

File tree

9 files changed

+92
-58
lines changed

9 files changed

+92
-58
lines changed

packages/code-block/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
"@blocknote/core": "0.36.1",
5353
"@shikijs/core": "^3.2.1",
5454
"@shikijs/engine-javascript": "^3.2.1",
55-
"@shikijs/langs-precompiled": "^3.2.1",
5655
"@shikijs/langs": "^3.2.1",
56+
"@shikijs/langs-precompiled": "^3.2.1",
5757
"@shikijs/themes": "^3.2.1",
5858
"@shikijs/types": "^3.2.1"
5959
},

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"prosemirror-state": "^1.4.3",
101101
"prosemirror-tables": "^1.6.4",
102102
"prosemirror-transform": "^1.10.4",
103-
"prosemirror-view": "^1.38.1",
103+
"prosemirror-view": "^1.40.1",
104104
"rehype-format": "^5.0.1",
105105
"rehype-parse": "^9.0.1",
106106
"rehype-remark": "^10.0.0",

packages/core/src/schema/blocks/internal.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,12 @@ export function createBlockSpecFromStronglyTypedTiptapNode<
249249
return createTypedBlockSpec(
250250
{
251251
type: node.name as T["name"],
252-
content: (node.config.content === "inline*"
253-
? "inline"
254-
: node.config.content === "tableRow+"
255-
? "table"
256-
: "none") as any, // TODO does this typing even matter?
252+
content:
253+
node.config.content === "inline*"
254+
? "inline"
255+
: node.config.content === "tableRow+"
256+
? "table"
257+
: "none",
257258
propSchema,
258259
},
259260
{

packages/core/src/schema/schema.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import {
44
BlockNoDefaults,
55
BlockSchema,
66
BlockSpecs,
7+
InlineContentConfig,
78
InlineContentSchema,
9+
InlineContentSpec,
810
InlineContentSpecs,
911
LooseBlockSpec,
1012
PartialBlockNoDefaults,
13+
StyleConfig,
1114
StyleSchema,
15+
StyleSpec,
1216
StyleSpecs,
1317
addNodeAndExtensionsToSpec,
1418
getInlineContentSchemaFromSpecs,
@@ -153,26 +157,33 @@ export class CustomBlockNoteSchema<
153157
*/
154158
public extend<
155159
AdditionalBlockSpecs extends BlockSpecs,
156-
AdditionalInlineContentSpecs extends InlineContentSpecs,
157-
AdditionalStyleSpecs extends StyleSpecs,
160+
AdditionalInlineContentSpecs extends Record<
161+
string,
162+
InlineContentSpec<InlineContentConfig>
163+
>,
164+
AdditionalStyleSpecs extends Record<string, StyleSpec<StyleConfig>>,
158165
>(opts: {
159166
blockSpecs?: AdditionalBlockSpecs;
160167
inlineContentSpecs?: AdditionalInlineContentSpecs;
161168
styleSpecs?: AdditionalStyleSpecs;
162169
}): CustomBlockNoteSchema<
163170
AdditionalBlockSpecs extends undefined
164-
? BSchema & {
171+
? BSchema
172+
: BSchema & {
165173
[K in keyof AdditionalBlockSpecs]: K extends string
166174
? AdditionalBlockSpecs[K]["config"]
167175
: never;
168-
}
169-
: BSchema,
176+
},
170177
AdditionalInlineContentSpecs extends undefined
171-
? ISchema & AdditionalInlineContentSpecs
172-
: ISchema,
178+
? ISchema
179+
: ISchema & {
180+
[K in keyof AdditionalInlineContentSpecs]: AdditionalInlineContentSpecs[K]["config"];
181+
},
173182
AdditionalStyleSpecs extends undefined
174-
? SSchema & AdditionalStyleSpecs
175-
: SSchema
183+
? SSchema
184+
: SSchema & {
185+
[K in keyof AdditionalStyleSpecs]: AdditionalStyleSpecs[K]["config"];
186+
}
176187
> {
177188
// Merge the new specs with existing ones
178189
Object.assign(this.opts.blockSpecs, opts.blockSpecs);

packages/react/src/schema/ReactBlockSpec.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ export function createReactBlockSpec<
230230
},
231231
)(this.props!) as ReturnType<BlockImplementation["render"]>;
232232
} else {
233-
const BlockContent =
234-
blockImplementation.toExternalHTML || blockImplementation.render;
233+
const BlockContent = blockImplementation.render;
235234
const output = renderToDOMSpec((refCB) => {
236235
return (
237236
<BlockContentWrapper

packages/xl-docx-exporter/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@
6868
"@types/react-dom": "^19.1.0",
6969
"@zip.js/zip.js": "^2.7.57",
7070
"eslint": "^8.10.0",
71+
"react": "^19.1.0",
72+
"react-dom": "^19.1.0",
7173
"rollup-plugin-webpack-stats": "^0.2.2",
7274
"typescript": "^5.0.4",
7375
"vite": "^5.3.4",
7476
"vite-plugin-eslint": "^1.8.1",
7577
"vitest": "^2.0.3",
76-
"xml-formatter": "^3.6.3",
77-
"react": "^19.1.0",
78-
"react-dom": "^19.1.0"
78+
"xml-formatter": "^3.6.3"
7979
},
8080
"peerDependencies": {
8181
"react": "^18.0 || ^19.0 || >= 19.0.0-rc",

packages/xl-multi-column/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"prosemirror-state": "^1.4.3",
5959
"prosemirror-tables": "^1.3.7",
6060
"prosemirror-transform": "^1.10.4",
61-
"prosemirror-view": "^1.38.1",
61+
"prosemirror-view": "^1.40.1",
6262
"react-icons": "^5.2.1"
6363
},
6464
"devDependencies": {

packages/xl-multi-column/src/test/setupTestEnv.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ import {
55
} from "@blocknote/core";
66
import { afterAll, beforeAll, beforeEach } from "vitest";
77

8-
import { withMultiColumn } from "../blocks/schema.js";
8+
import { ColumnBlock, ColumnListBlock } from "../blocks/Columns/index.js";
99

10-
export const testEditorSchema = withMultiColumn(BlockNoteSchema.create());
10+
export const testEditorSchema = BlockNoteSchema.create().extend({
11+
blockSpecs: {
12+
column: ColumnBlock,
13+
columnList: ColumnListBlock,
14+
} as const,
15+
});
1116

1217
export function setupTestEnv() {
1318
let editor: BlockNoteEditor<

0 commit comments

Comments
 (0)