Undo manager not working properly on undoing a remove action
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)
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
})
}
Ok I'm closing this one then and please open a new bug issue related to checkbox traits.
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...
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.
Issue #5632
Add a change to the undomanager
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v91 Reproducible demo link https://...
Issue #4812
Layerable property not working as expected in parent-child scenario.
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? 107.0.5304.110 (Official Build) (arm64) Re...
Issue #5631
Undo manager add() not working as expected
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v91 Reproducible demo link -- Descr...
Issue #6263
Duplicated links are added using rte
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? ChromeReproducible demo link https://codepen...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins β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.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
Big Updates: TinyMCE 8 and Placeholder 2.0 for GrapesJS
In May we shipped major updates to two of our most popular GrapesJS plugins β TinyMCE Inline Text Editor and Placeholder.
Tutorial
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.