@@ -10,6 +10,7 @@ import { EditorState, Transaction } from "@tiptap/pm/state";
1010import { blockToNode } from "../api/nodeConversions/blockToNode.js" ;
1111import { PartialBlock } from "../blocks/defaultBlocks.js" ;
1212import { StyleSchema } from "../schema/index.js" ;
13+ import type { BlockNoteEditor } from "./BlockNoteEditor.js" ;
1314
1415export type BlockNoteTipTapEditorOptions = Partial <
1516 Omit < EditorOptions , "content" >
@@ -149,15 +150,19 @@ export class BlockNoteTipTapEditor extends TiptapEditor {
149150 /**
150151 * Replace the default `createView` method with a custom one - which we call on mount
151152 */
152- private createViewAlternative ( contentComponent ?: any ) {
153+ private createViewAlternative (
154+ blockNoteEditor : BlockNoteEditor < any , any , any > ,
155+ contentComponent ?: any
156+ ) {
153157 ( this as any ) . contentComponent = contentComponent ;
154158
155159 const markViews : any = { } ;
156160 this . extensionManager . extensions . forEach ( ( extension ) => {
157161 if ( extension . type === "mark" && extension . config . addMarkView ) {
158162 // Note: migrate to using `addMarkView` from tiptap as soon as this lands
159163 // (currently tiptap doesn't support markviews)
160- markViews [ extension . name ] = extension . config . addMarkView ;
164+ markViews [ extension . name ] =
165+ extension . config . addMarkView ( blockNoteEditor ) ;
161166 }
162167 } ) ;
163168
@@ -198,12 +203,16 @@ export class BlockNoteTipTapEditor extends TiptapEditor {
198203 *
199204 * @param element DOM element to mount to, ur null / undefined to destroy
200205 */
201- public mount = ( element ?: HTMLElement | null , contentComponent ?: any ) => {
206+ public mount = (
207+ blockNoteEditor : BlockNoteEditor < any , any , any > ,
208+ element ?: HTMLElement | null ,
209+ contentComponent ?: any
210+ ) => {
202211 if ( ! element ) {
203212 this . destroy ( ) ;
204213 } else {
205214 this . options . element = element ;
206- this . createViewAlternative ( contentComponent ) ;
215+ this . createViewAlternative ( blockNoteEditor , contentComponent ) ;
207216 }
208217 } ;
209218}
0 commit comments