Skip to content

[examples] Undo does not restore content after replacing a Cmd+A selection #11

@wudidewo12

Description

@wudidewo12

Description

In multiple Slate examples, replacing the whole editor selection with a single character and then undoing does not restore the original content locally. The live reference restores the original document.

Recording

Screenshots attached below:

Local actual behavior:
Live reference expected behavior:
Video attached below:

CleanShot.2026-05-07.at.18.16.55.mp4

Sandbox

No standalone sandbox. Reproduced in the Slate examples site.

Local reproduction URL:

http://localhost:3100/examples/mentions

Reference URL:

https://www.slatejs.org/examples/mentions

Steps

To reproduce the behavior:

  1. Go to http://localhost:3100/examples/mentions.
  2. Click inside the Mentions editor.
  3. Press Cmd+A.
  4. Type Z.
  5. Press Cmd+Z.
  6. Repeat the same steps on https://www.slatejs.org/examples/mentions.

Expectation

After pressing Cmd+Z, the editor should restore the original Mentions document content, matching the live reference.

Actual behavior

On localhost, the editor remains as Z after pressing Cmd+Z. The original Mentions document content is not restored.

Environment

  • Local URL: http://localhost:3100/examples/mentions
  • Reference URL: https://www.slatejs.org/examples/mentions
  • Local branch/commit: v2, ce2bd6c6
  • Browser: Chrome
  • OS: macOS
  • Local app setup: Slate examples site served locally with bun serve

Additional scope:

The same behavior also reproduces in examples/inlines and examples/tables.

This is now tracked as a cross-example issue. I will retest it as an existing issue after future pulls instead of opening per-example duplicates.

Steps checked:

  1. Open http://localhost:3100/examples/inlines.
  2. Click inside the editor.
  3. Press Cmd+A.
  4. Type Z.
  5. Press Cmd+Z.
  6. Compare with https://www.slatejs.org/examples/inlines.

On localhost, the editor still shows only Z after Cmd+Z. The live reference restores the original Inlines document.

Impact

This breaks undo behavior after replacing a full editor selection across multiple Slate examples
. A normal select-all, replace, undo workflow can leave the document content lost locally instead of restoring the previous content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions