Skip to content

fix(editor): fix undo clearing out editor after initial load (#638) (#641)#7

Merged
paulirwin merged 1 commit into
masterfrom
fix/undo-clears-initial-content
May 12, 2026
Merged

fix(editor): fix undo clearing out editor after initial load (#638) (#641)#7
paulirwin merged 1 commit into
masterfrom
fix/undo-clears-initial-content

Conversation

@paulirwin

Copy link
Copy Markdown
Member

Pulls upstream PR sibiraj-s/ngx-editor#641 into the fork ahead of upstream merging it.

Fixes upstream issue #638 — pressing Ctrl/Cmd+Z immediately after the editor loads no longer clears the initial content. The fix reworks Editor.setContent() to call view.updateState() with a fresh EditorState rather than dispatching a transaction, so the initial content load is not recorded in the undo history.

Summary

  • projects/ngx-editor/src/lib/Editor.tssetContent() no longer creates an undoable transaction
  • projects/ngx-editor/src/lib/editor.component.spec.ts — two new specs cover the bug and the related setContent history-reset behavior

Test plan

  • npm run test:lib passes locally against Angular v21 (33/33 tests, +2 new)
  • CI passes
  • Manual smoke: load editor with initial content, press Ctrl/Cmd+Z, content remains

@paulirwin paulirwin merged commit 1ec34fa into master May 12, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

1 participant