Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend default or all blocks with custom functionality #1360

Open
cgross opened this issue Jan 7, 2025 · 0 comments
Open

Extend default or all blocks with custom functionality #1360

cgross opened this issue Jan 7, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@cgross
Copy link

cgross commented Jan 7, 2025

BlockNote is really impressive! Thank you for building such a great library!

Is your feature request related to a problem? Please describe.
I'm using BlockNote to build a note editor for researchers. They need to be able to source individual blocks (like to note where they found the information).

It would also be important that this feature work across block types. Potentially all block types but some could be excluded. For example, an image/audio/file block would also need to be sourced to where they're from but heading blocks wouldn't.

Describe the solution you'd like
I think I can provide a new button in the block side menu. That would set some props on the block that would include the source information. That all seems possible today (I think). Then I would need a way to render the source from the props at the end of the block. The rendered source would be a small footnote.

Something like a decorator around the render function of all blocks would be amazing. If there was a way to do something like:

useCreateBlockNote({
   blockDecorator: ({props, children}) => <div>{children}<div>{props.source}</div></div>
})

Describe alternatives you've considered
I tried to see if i could use a custom style or the custom DOM attributes but neither solution seemed workable.

Additional context
If this would be a desired feature by the BlockNote team, I could create a PR if it would be looked and potentially merged.

Bonus
[ ] I'm a sponsor and would appreciate if you could look into this sooner than later 💖

@cgross cgross added the enhancement New feature or request label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant