BUG: Cross-level reordering of blocks in Layer Manager causes Sorter errors and breaks further move attempts
GrapesJS version
- [x] I confirm to use the latest version of GrapesJS
What browser are you using?
Chrome
Reproducible demo link
https://grapesjs.com/demo.html
Describe the bug
How to reproduce the bug?
- Start from a fresh editor instance with an empty canvas
- From the Blocks panel, drag a "1 Column" block into the canvas.
- From the Blocks panel, drag a "Text" block into the canvas.
- In the Layer Manager, perform the following moves in order:
- Move the Text block inside the 1 Column block.
- Move the Text block outside and below the 1 Column block (same hierarchy level, just below it).
- Move the 1 Column block below the Text block.
- Try to move the Text block below the 1 Column block again.
What is the expected behavior? All drag & drop operations should be performed correctly and without errors.
What is the current behavior? In the last repro step the element doesn't move from its position.
Inspecting the DevTools console, two errors appear: the first when the drag operation starts and the second when the user releases the mouse button.
The Layer Manager enters into an inconsistent state and, since that moment, any other attempt to move the text block will fail with multiple errors in console.
Note: Performing the same steps directly inside the canvas is also affected, in a different way: in this case a duplicate Text element appears when performing the last repro step.
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
I guess it is the same as this bug too?
I don’t think it’s the same issue. In the one you linked, items are disappearing, while in my case the Layer Manager ends up in a state where you can’t move a layer anymore. They might be related at a higher level as “Sorter-related problems”, but from what I can see they’re two distinct bugs.