Issue #5641๐Ÿ’ฌ AnsweredOpened Jan 24, 2024by yashvi20260 reactions

Undomanager.remove() not working

Quick answerby artf

The problem here is not Undomanager.remove but what is tracked. When you're resizing the image, you're not editing the Component itself but its CssRule object so that's why it's not working as expected. I'd probably suggest to simply skip the undo manager with operations you don't want to track

Read full answer below โ†“

Question

GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome v91Reproducible demo link https://codepen.io/Harshsne/pen/WNgZzPEDescribe the bug How to reproduce the bug?Append an image to the canvas and close the image modal.(so that component will be removed from tracking as i have removed the component from the undomanager stack) editor.on('asset:close', () => { console.log("close") const selected = editor.getSelected(); if (selected && selected.is('image')) { editor.UndoManager.remove(selected); } })Press crtl+ z What is the expected behavior? ...Rem...

Answers (2)

artfโ€ข Feb 10, 2024

The problem here is not Undomanager.remove but what is tracked. When you're resizing the image, you're not editing the Component itself but its CssRule object so that's why it's not working as expected. I'd probably suggest to simply skip the undo manager with operations you don't want to track

GJS Helperโ€ข May 17, 2026

The issue you're encountering with editor.UndoManager.remove() not preventing the undo of a component's removal is due to a misunderstanding of how the UndoManager operates in this specific context. The UndoManager.remove(component) method is designed to remove all recorded states related to a spec...

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.