BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

feature: add support for blocknote transactions

Open YousefED opened this issue 1 year ago • 1 comments

This is a POC for blocknote-level transactions. It should make it possible to clean our existing commands (those in blockManipulation further down by migrating away from tiptap-style commands). It also unlocks the possibility for userland-transactions.

For example, the following bug is fixed:

  • select a number of paragraphs
  • change type to "heading"
  • "undo" will undo them one by one (after the fix, "undo" will reset all headings back to paragraphs in one step as expected)

closes https://github.com/TypeCellOS/BlockNote/issues?q=is%3Aissue+is%3Aopen+undo

TODO:

  • add tests
  • See if there are bugs with this approach. For example, what if you call other functions in a transact block that depend on editor.state? It's likely they should read the state from the activeTransaction instead (diagnose, create tests, and fix)
  • if there are other BlockNote APIs called in a loop (similar to blocktype select), migrate them to use transact

YousefED avatar Oct 13 '24 18:10 YousefED

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

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Oct 13, 2024 7:14pm
blocknote-website ✅ Ready (Inspect) Visit Preview Oct 13, 2024 7:14pm

vercel[bot] avatar Oct 13 '24 18:10 vercel[bot]