Skip to content

onChange fires for indentation, but when you call getChanges, the array of changes is empty #1757

Open
@niieani

Description

@niieani

Describe the bug

editor.onChange(...) event fires for indentation, but when you call context.getChanges(), the array of changes is empty.

To Reproduce

  1. open this simple reproduction
  2. create two blocks
  3. open the devtools console
  4. try to indent the 2nd block

You'll see the an empty array of changes, which is something I didn't expect.

Same problem applies when dragging & dropping a block to rearrange its position.

Context

I was prototyping and playing around with BlockNote to see its capabilities, and was hoping it would be possible to create a sync system using the onChange hook (to autosave the blocks in a DB).
I know I can also access the underlying ProseMirror transactions, but I was under the impression onChange would be the better level of abstraction, as it is aware of block IDs. Let me know if I'm approaching this wrong.

Looks like maybe the function here:

export function getBlocksChangedByTransaction<

doesn't support indentation or block move changes?

Misc

  • Node version: N/A
  • Package manager: N/A
  • Browser: Chromium 137.0.7151.69
  • I'm a sponsor and would appreciate if you could look into this sooner than later 💖

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions