Issue #4947πŸ’¬ AnsweredOpened Feb 27, 2023by FaisalShaikhHA2 reactions

Undo manager not working properly on undoing a remove action

Quick answerby artf❀ 1

Yeah undo triggers the change:columns, in your case you could try to wrap your updateColumns changes in editor.UndoManager.skip.

Read full answer below ↓

Question

GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome - version 110.0.5481.100 (Official Build) (arm64)Reproducible demo link https://codepen.io/faisal-praella/pen/ExeNwxJDescribe the bugI have added a custom columns component with a number trait name columns used for adding or removing the child component column.When I add a new column using the trait and undo the change it works fine but when I remove the column and undo the change an extra column is added.This might be because when Grapesjs undo remove change it appends the removed column and...

Answers (4)

artfβ€’ Mar 10, 2023

Yeah undo triggers the change:columns, in your case you could try to wrap your updateColumns changes in editor.UndoManager.skip.

updateColumns() {
  editor.UndoManager.skip(() => {
    // your operations
  })
}
artfβ€’ Mar 11, 2023

Ok I'm closing this one then and please open a new bug issue related to checkbox traits.

FaisalShaikhHAβ€’ Mar 10, 2023

Thank you @artf it works, to fix this I was toggling the trait change listener by listening to undo command before & run events but this feels cleaner. The checkbox trait not getting checked or unchecked on undo/redo (trait value is updated on my end). Reproducible on Grapesjs webpage demo. Need he...

GJSBlockβ€’ May 17, 2026

Thanks for reporting this, @FaisalShaikhHA. Great question about Undo manager not working properly on undoing a remove action. The recommended approach with UndoManager is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event list...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.