Skip to content

Conversation

@fridaystreet
Copy link
Contributor

Without completely needing to refactor the way tiptap extensions and core blocknote extensions are added, this should be fairly simple approach to just allow a list of extension names to be passed in that will then be removed from the inbuiult extensions before being passed to tiptap.

This will allow you to the override these extensions if you wish without completely disbaling blocknote via

const editor = useCreateBlockNote({
    disableExtensions:['link'],
    _tiptapOptions: {
      extensions: [
        Link,
      ]
    }
  })

@vercel
Copy link

vercel bot commented Jun 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Jun 24, 2024 6:28pm
blocknote-website ✅ Ready (Inspect) Visit Preview Jun 24, 2024 6:28pm

@vercel
Copy link

vercel bot commented Jun 21, 2024

@fridaystreet is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Collaborator

@matthewlipski matthewlipski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! The only thing that might be a bit finicky is that enableBlockNoteExtensions also exists, and disableExtensions is basically the same thing but lets you disable specific extensions instead of all of them. Basically what I'm saying is you can probably just remove the enableBlockNoteExtensions option since your new one is the same but better:)

@matthewlipski matthewlipski merged commit cadf35f into TypeCellOS:main Jun 24, 2024
@fridaystreet
Copy link
Contributor Author

fridaystreet commented Jun 25, 2024

@matthewlipski ok great thanks. Yeah at first I actually just used enableBlockExtensions and made it

string[] | boolean

but after looking at it a few times it didn't feel like it made sense at it would imply you need to pass an array of all of the enabled ones just omitting the disabled ones.

I wasn't sure if there was some bigger picture reason for being to just disable/enable the whole thing with enableBlockNoteExtensions so opted for the extra parameter. I agree possibly it adds confusion with 2, but then again, if someone does want to disable all of them, they'd have to maintain an array full of all the extension names so maybe it is better to leave both.

I guess another option could be to just have explicit arrays for both, that way if you're looking to only enable some or only disable some it's easy, but probably overkill and confusing

enableExtensions string[] | boolean | undefined
disableExtensions string[] | boolean | undefined

Thanks for reveiwing it though. let me know if you want me to submit another PR

@matthewlipski
Copy link
Collaborator

All good, I think the use case of disabling all TipTap extensions is extremely rare since at that point you're probably better off just using a different editor, so I went ahead with removing enableBlockExtensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants