BUG/[QUESTION]: How to correctly wrap a Component on add/mount?
Hi @artf, Reproducible Link I’m also hitting a crash when using component.replaceWith() together with UndoManager. This only happens when replaceWith() is triggered during editor lifecycle events (e.g. change:status, component:selected, component:deselected). On undo, GrapesJS tries to restore selection/state for the...
Read full answer below ↓Question
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v128 Reproducible demo link https://jsfiddle.net/fjyk6n4a/2/ Describe the bug Hi @artf, I am currently trying to wrap a component in a section component if its has not been wrapped yet. I am hooking into the component:mount event and replacing the added component with the section component (which has the added one as child). My Code looks something like this: The issue I'm facing is that the UndoManager stack is not completely aligned with what is happening. After the add and wrap the stack...
Answers (2)
Hi @artf, Reproducible Link I’m also hitting a crash when using component.replaceWith() together with UndoManager. This only happens when replaceWith() is triggered during editor lifecycle events (e.g. change:status, component:selected, component:deselected). On undo, GrapesJS tries to restore sele...
The issue you're facing with the UndoManager stack becoming inconsistent after wrapping a component using component.replaceWith inside the component:mount event is a common challenge when modifying the editor's state in a way that doesn't align with the UndoManager's default tracking. The root caus...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #6696
Crash when calling component.replaceWith() during lifecycle events with UndoManager enabled
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://code...
Issue #4323
Performance issue while dragging component to canvas when you have 2k component on canvas
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Google Chrome Version 101.0.4951.41 (Officia...
Issue #5990
When you delete a component, duplicate classes between components will be deleted.
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 126.0.6478.127(Windows) Reproducibl...
Issue #5641
Undomanager.remove() not working
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome v91Reproducible demo link https://cod...
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.