You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 has 3 Entries: remove of original component, add of section and add of original component. When clicking undo the section is removed and the original component stays. But it is buggy in means of it is not removable and not really there because the stack entries do not reflect the changes correctly (maybe missing the initial add).
How to reproduce what I described:
open reproducable demo link
add text component (is wrapped in section as visible in layers)
click ctrl+z to undo
text is still in canvas and layers, section is gone. text is not removable
My Question:
Ideally I would like to change the UndoManager stack in that on undo either the section and original component are both removed at the same time and without bugs (currently the problem) or the original component is removed and if you click undo again then the section is removed (as if the section was added first). In component:mount event the stack does not have the newest entry of the add yet so I cant manipulate it at that time.
What is the best way to wrap the Component without having problems with the UndoManager or how can I manipulate the stack to fix it?
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
GrapesJS version
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 has 3 Entries: remove of original component, add of section and add of original component. When clicking undo the section is removed and the original component stays. But it is buggy in means of it is not removable and not really there because the stack entries do not reflect the changes correctly (maybe missing the initial add).
How to reproduce what I described:
My Question:
Ideally I would like to change the UndoManager stack in that on undo either the section and original component are both removed at the same time and without bugs (currently the problem) or the original component is removed and if you click undo again then the section is removed (as if the section was added first). In component:mount event the stack does not have the newest entry of the add yet so I cant manipulate it at that time.
What is the best way to wrap the Component without having problems with the UndoManager or how can I manipulate the stack to fix it?
Code of Conduct
The text was updated successfully, but these errors were encountered: