Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["VoidZero.vite-plus-extension-pack"]
"recommendations": [
"VoidZero.vite-plus-extension-pack",
"TypeScriptTeam.native-preview"
]
}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"editor.codeActionsOnSave": {
"source.fixAll.oxc": "explicit"
},
"oxc.configPath": "./vite.config.ts",
"oxc.typeAware": true,
"oxc.fmt.configPath": "./vite.config.ts",
"npm.scriptRunner": "vp",
"[javascript]": { "editor.defaultFormatter": "oxc.oxc-vscode" },
Expand All @@ -16,7 +18,8 @@
"packages/website/docs/.vitepress": false,
"**/.*": false
},
"typescript.tsdk": "node_modules/typescript/lib",
"js/ts.experimental.useTsgo": true,
"js/ts.tsdk.path": "./node_modules/typescript",
"[xml]": {
"editor.defaultFormatter": "redhat.vscode-xml"
},
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"concurrently": "9.1.2",
"eslint-plugin-import": "^2.32.0",
"glob": "^10.5.0",
"oxlint-tsgolint": "^7.0.2001",
"serve": "14.2.6",
"typescript": "^7.0.2",
"vite-plus": "catalog:",
Expand Down
27 changes: 16 additions & 11 deletions packages/core/src/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ function removeUndefined<T extends Record<string, any> | undefined>(obj: T): T {
) as T;
}

type InitializedBlockSpecs<BSchema extends BlockSchema> = {
[K in keyof BSchema]: K extends string
? LooseBlockSpec<K, BSchema[K]["propSchema"], BSchema[K]["content"]>
: never;
};

export class CustomBlockNoteSchema<
BSchema extends BlockSchema,
ISchema extends InlineContentSchema,
Expand All @@ -47,11 +53,7 @@ export class CustomBlockNoteSchema<

public inlineContentSpecs: InlineContentSpecs;
public styleSpecs: StyleSpecs;
public blockSpecs: {
[K in keyof BSchema]: K extends string
? LooseBlockSpec<K, BSchema[K]["propSchema"], BSchema[K]["content"]>
: never;
};
public blockSpecs: InitializedBlockSpecs<BSchema>;

public blockSchema: BSchema;
public inlineContentSchema: ISchema;
Expand Down Expand Up @@ -80,7 +82,14 @@ export class CustomBlockNoteSchema<
this.inlineContentSchema = inlineContentSchema;
}

private init() {
private init(): {
blockSpecs: InitializedBlockSpecs<BSchema>;
blockSchema: BSchema;
inlineContentSpecs: InlineContentSpecs;
styleSpecs: StyleSpecs;
inlineContentSchema: ISchema;
styleSchema: SSchema;
} {
const getPriority = sortByDependencies(
Object.entries({
...this.opts.blockSpecs,
Expand Down Expand Up @@ -108,11 +117,7 @@ export class CustomBlockNoteSchema<
),
];
}),
) as {
[K in keyof BSchema]: K extends string
? LooseBlockSpec<K, BSchema[K]["propSchema"], BSchema[K]["content"]>
: never;
};
) as InitializedBlockSpecs<BSchema>;

const inlineContentSpecs = Object.fromEntries(
Object.entries(this.opts.inlineContentSpecs).map(
Expand Down
Loading
Loading