Skip to content

Documentation Request: can BlockNote use TipTap extensions (e.g. for Tables) #63

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

Closed
brandondrew opened this issue Nov 12, 2022 · 10 comments
Assignees

Comments

@brandondrew
Copy link

BlockNote looks absolutely amazing, but my requirement (unfortunately) includes a need to support user-editable tables. Can BlockNote use TipTap extensions? Will they automatically appear in the slash menu? I would love some documentation on using TipTap extensions in BlockNote, if it is possible.

Thanks!

@YousefED
Copy link
Collaborator

Thanks @brandondrew! We're currently working to make (re)design API surface for custom elements, documentation will be part of this, keep you posted!

@samlroberts
Copy link

samlroberts commented Dec 20, 2022

Very curious about this

Thanks @brandondrew! We're currently working to make (re)design API surface for custom elements, documentation will be part of this, keep you posted!

Love to learn more about this, and any progress. I can even offer to help out if needed.

@brandondrew brandondrew changed the title Documentation Request: can BlockNote use TipTap extensions (e.g. for Tábles) Documentation Request: can BlockNote use TipTap extensions (e.g. for Tables) Dec 20, 2022
@YousefED
Copy link
Collaborator

The current focus is to separate the React UI layer #74 #75. This will improve the overall architecture. We expect his will be done in January. Then, we'll start looking at the extensibility API surface

Your input will definitely be useful! Can you share what kind of elements or other functionality you'd like to add?

@maxswjeon
Copy link

maxswjeon commented May 12, 2023

Hello, I approciate your hard work. Is there an update about this issue? Seems the PRs that you mentioned are already merged.

@maxswjeon
Copy link

Read some codes, found out that I can add extensions by adding _tiptapOptions.extensions. Might be only a documentational issue, right?

@brandondrew
Copy link
Author

@maxswjeon please report back if you're able to add extensions. thanks!

@maxswjeon
Copy link

For the record, the tiptap extension initialization is occured in packages/core/src/BlockNoteExtensions.ts. The key function, getBlockNoteExtensions is called by packages/core/src/BlockNoteEditor.ts#L129 and integrated in packages/core/src/BlockNoteEditor.ts#L161-164. The _tiptapOptions is in BlockNoteEditorOptions, undocumented.

@maxswjeon
Copy link

maxswjeon commented May 12, 2023

Checked and made a PoC(Proof of Concept) for it, but it was not successful.

  • Enter Key handling by addKeyboardShortcuts might not be compatible with other extensions, especially the Keyboard Handling methods in packages/core/src/extensions/Blocks/nodes/BlockContainer.ts.
  • InputRules are also not working, because of the packages/core/src/extensions/Blocks/nodes/BlockContainer.ts.

Might need a factory method, such as toBlockNoteExtension(extension: TipTapExtension) that extends the original Tiptap extension to work in BlockNote.

It would be great if the maintainers check about this, if possible. (since I don't know the codebase that well.)

@YousefED
Copy link
Collaborator

Hi all!

While this indeed is technically possible, there are two tricky things here why it's currently not encouraged:

  • maintainability: We're not 100% sure if we'll keep building on top of TipTap in the long term. For the foreseeable future, yes, but the most important core framework is Prosemirror - and there's something to be said for not having too many layers of abstractions
  • compatibility: as @maxswjeon noticed; not all functionality in TipTap Extensions might work well with the Block-based system.

Instead, we'll work on a plugin system (such as #164 ) to be able to add your own custom blocks. This might include a helper to transform Tiptap Nodes into custom blocks.

Hope this helps!

@maxswjeon
Copy link

Thanks for @YousefED for the review! If possible, I will take a look at #164 too! Again, thanks for your hard work!

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

No branches or pull requests

5 participants