From 969dc95129143e66d0e913060a011e7594479fc0 Mon Sep 17 00:00:00 2001 From: yousefed Date: Fri, 20 Sep 2024 17:03:52 +0200 Subject: [PATCH 1/2] add editor parameter to inline content render (core) --- packages/core/src/schema/inlineContent/createSpec.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/core/src/schema/inlineContent/createSpec.ts b/packages/core/src/schema/inlineContent/createSpec.ts index bf9d513465..05674302a5 100644 --- a/packages/core/src/schema/inlineContent/createSpec.ts +++ b/packages/core/src/schema/inlineContent/createSpec.ts @@ -4,6 +4,7 @@ import { inlineContentToNodes, nodeToCustomInlineContent, } from "../../api/nodeConversions/nodeConversions"; +import { BlockNoteEditor } from "../../editor/BlockNoteEditor"; import { propsToAttributes } from "../blocks/internal"; import { Props } from "../propTypes"; import { StyleSchema } from "../styles/types"; @@ -34,13 +35,13 @@ export type CustomInlineContentImplementation< inlineContent: InlineContentFromConfig, updateInlineContent: ( update: PartialCustomInlineContentFromConfig - ) => 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;` */ - // editor: BlockNoteEditor + editor: BlockNoteEditor // (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 , but that's not possible without passing the other generics because Typescript doesn't support partial inferred generics ) => { @@ -109,7 +110,8 @@ export function createInlineContentSpec< ) as any as InlineContentFromConfig, // TODO: fix cast () => { // No-op - } + }, + editor ); return addInlineContentAttributes( @@ -148,7 +150,8 @@ export function createInlineContentSpec< content ) ); - } + }, + editor ); return addInlineContentAttributes( From 5467f243f1caa23f7298c6f414ac75a6eece3837 Mon Sep 17 00:00:00 2001 From: matthewlipski Date: Fri, 20 Sep 2024 17:14:29 +0200 Subject: [PATCH 2/2] Fixed lint issue --- packages/core/src/schema/inlineContent/createSpec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/schema/inlineContent/createSpec.ts b/packages/core/src/schema/inlineContent/createSpec.ts index 05674302a5..443384881e 100644 --- a/packages/core/src/schema/inlineContent/createSpec.ts +++ b/packages/core/src/schema/inlineContent/createSpec.ts @@ -4,7 +4,7 @@ import { inlineContentToNodes, nodeToCustomInlineContent, } from "../../api/nodeConversions/nodeConversions"; -import { BlockNoteEditor } from "../../editor/BlockNoteEditor"; +import type { BlockNoteEditor } from "../../editor/BlockNoteEditor"; import { propsToAttributes } from "../blocks/internal"; import { Props } from "../propTypes"; import { StyleSchema } from "../styles/types";