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

wip: feature: server-side processing #451

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

YousefED
Copy link
Collaborator

@YousefED YousefED commented Dec 4, 2023

This introduces a server-util package which can be used to interact with BlockNote without instantiating an entire editor. For example, it can be used to render HTML from BlockNote blocks in JSON format (or from a YDoc) for server-side rendering. Or, for server-side conversion to markdown for server-side search indexing.

TODO
The current state is a PoC, there are several important todos to figure out:

  • We rely on JSDOM to polyfill document. If we don't want this, we either need a more lightweight polyfill, or replace our document.createElement related calls with something else. Or for example, use React / JSX for built-in nodes as well, as React supports server-side rendering without a dependency on document
  • Block serialization functions (toExternalHTML, toInternalHTML) currently expect an editor parameter. Is this useful / desired? Currently we fake an editor by passing editorContext instead
  • Is there a way to convert from Posemirror JSON to BlockNote JSON by just transforming the json, and not rely on Nodes, extensions and pmSchema to be available?
  • Add a test for server-side rendering including CSS, add tests for custom blocks, etc.
  • This still pulls in the entire @blocknote/core package (and if you'd use a react custom block, it would pull in all of @blocknote/react). Perhaps we can organize our package structure to be more lightweight

closes #387
closes #311

Copy link

vercel bot commented Dec 4, 2023

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

Name Status Preview Updated (UTC)
blocknote-website ✅ Ready (Inspect) Visit Preview Dec 4, 2023 9:35pm

@YousefED YousefED changed the title wip: Feature/server-util wip: feature: server-side processing Dec 4, 2023
@nikkimontoya
Copy link

@YousefED Hi! Could you please tell me when you plan to deliver this feature? It would be very useful for me :-)

@Jakisundays
Copy link

@YousefED Hello! 🌟 I'm eagerly looking forward to using this. Could you please complete it? Your work is much appreciated! 🚀

@YousefED
Copy link
Collaborator Author

Hi @nikkimontoya @Jakisundays!

Atm we're prioritizing some work for our sponsors and I currently don't require this feature myself - so even though I'd love to, it will be a while before we can dig into this. You can consider sponsoring or opening a bounty to encourage community members to step in

Copy link

algora-pbc bot commented May 13, 2024

💎 $25 bounty • odufuwas

Steps to solve:

  1. Start working: Comment /attempt #451 with your implementation plan
  2. Submit work: Create a pull request including /claim #451 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to TypeCellOS/BlockNote!

Add a bountyShare on socials

@m-risto
Copy link

m-risto commented May 22, 2024

Hi @YousefED,

this is also something which is required, so that we can use BlockNote.

@YousefED
Copy link
Collaborator Author

Hi @YousefED,

this is also something which is required, so that we can use BlockNote.

Hi @m-risto! Thanks and thanks for your sponsorship. Would love to hear more about your exact requirements before we continue working on this. Mind specifying more here, or reaching out on Discord / X / email ([email protected])?

@m-risto
Copy link

m-risto commented May 22, 2024

Hi @YousefED

i will write it down tomorrow, if i have a some free time.

The short version is we want to create a pdf server side with puppeteer and that's why we need the html extract.

But i will write you more via discord.

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

Successfully merging this pull request may close these issues.

to use blocksToHTML on server side Storing of output data
4 participants