Skip to content

Commit

Permalink
fix: add editor parameter to inline content render (core) (#1091)
Browse files Browse the repository at this point in the history
* add editor parameter to inline content render (core)

* Fixed lint issue

---------

Co-authored-by: matthewlipski <[email protected]>
  • Loading branch information
YousefED and matthewlipski authored Sep 20, 2024
1 parent e62e69d commit c45936a
Showing 1 changed file with 7 additions and 4 deletions.
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

0 comments on commit c45936a

Please sign in to comment.