Skip to content
Merged
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
11 changes: 7 additions & 4 deletions packages/core/src/schema/inlineContent/createSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
inlineContentToNodes,
nodeToCustomInlineContent,
} from "../../api/nodeConversions/nodeConversions";
import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
import { propsToAttributes } from "../blocks/internal";
import { Props } from "../propTypes";
import { StyleSchema } from "../styles/types";
Expand Down Expand Up @@ -34,13 +35,13 @@ export type CustomInlineContentImplementation<
inlineContent: InlineContentFromConfig<T, S>,
updateInlineContent: (
update: PartialCustomInlineContentFromConfig<T, S>
) => void
) => void,
/**
* The BlockNote editor instance
* This is typed generically. If you want an editor with your custom schema, you need to
* cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`
*/
// editor: BlockNoteEditor<B, I, S>
editor: BlockNoteEditor<any, any, S>
// (note) if we want to fix the manual cast, we need to prevent circular references and separate block definition and render implementations
// or allow manually passing <BSchema>, but that's not possible without passing the other generics because Typescript doesn't support partial inferred generics
) => {
Expand Down Expand Up @@ -109,7 +110,8 @@ export function createInlineContentSpec<
) as any as InlineContentFromConfig<T, S>, // TODO: fix cast
() => {
// No-op
}
},
editor
);

return addInlineContentAttributes(
Expand Down Expand Up @@ -148,7 +150,8 @@ export function createInlineContentSpec<
content
)
);
}
},
editor
);

return addInlineContentAttributes(
Expand Down