Skip to content

History merging#932

Open
zoltanhosszu wants to merge 10 commits intomainfrom
history-merging
Open

History merging#932
zoltanhosszu wants to merge 10 commits intomainfrom
history-merging

Conversation

@zoltanhosszu
Copy link
Copy Markdown
Contributor

This PR fixes 2 issues with regards to editor history:

  • Previously image uploading caused multiple history events, even leaving an ActionTextAttachmentUploadNode DOM with a stale progressbar in the editor.
  • Previously node selection caused a history event.

Copilot AI review requested due to automatic review settings April 1, 2026 18:41

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings April 2, 2026 09:42

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings April 2, 2026 11:02

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings April 7, 2026 10:28

This comment was marked as resolved.

Copilot AI review requested due to automatic review settings April 7, 2026 10:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Collaborator

@samuelpecher samuelpecher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there has to be a different approach than complex surgery on the history stack. The root issue is that we're modifying the node too much in the background. If we completely bypass that, then there's no need for the surgery.

Comment thread src/editor/selection.js
Comment on lines +35 to 37
this.editor.getEditorState().read(() => {
this.#syncSelectedClasses()
})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would force a render as it's called within a command handler. The better move is unwrapping since the caller will need to call $getSelection and be in a read/update context

Suggested change
this.editor.getEditorState().read(() => {
this.#syncSelectedClasses()
})
this.#syncSelectedClasses()

// the undo history via HISTORIC_TAG.
get #transientUpdateTags() {
if (this.#editorHasFocus) {
return [ HISTORIC_TAG ]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HISTORIC_TAG is intended for use when history operations are applied (undo/redo). Feels dangerous.

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.

3 participants