Issue #3005Opened September 7, 2020by Davidvlv1 reactions

BUG: Layer manager appendTo is duplicating the layers every time grapesjs is init

Question

Version: 0.16.18 and up (The issue was introduced somewhere after 0.15.3, not sure when)

Are you able to reproduce the bug from the demo?

[x] Yes [ ] No

What is the expected behavior? On grapesjs.init() the layers manager with appendTo should replace the layers with a new one

What is the current behavior? When grapesjs.init() is called with appendTo on the layers manager, it creates a new layer manager each time, orphaning the old one.

Are you able to attach screenshots, screencasts or a live demo?

[x] Yes https://jsfiddle.net/uevznyLk/ [ ] No

To reproduce: press the "Add Grapesjs" button multiple times.

Answers (3)

artfSeptember 14, 20201 reactions

mmm honestly I don't see how that might have worked previously but I'll fix it in the next release

RJCAMSeptember 10, 20200 reactions

Hi @Davidvlv your appending the layers outside the "gjs" div element so you can see that when you remove the grapesjs editor (with the remove button) the layers panel stills there because like you're doing it you're separating the editor from the layers. What you can do is empty the div "layers" after click in the remove button to fix the remove function. Also if you do not want the layers panel to repeat I think you need to call the remove function before the add function.

DavidvlvSeptember 11, 20200 reactions

Thanks @RJCAM , I can see how to patch it. The issue is that this was not the previous behaviour before I upgraded from 0.15.3 to 0.16.18 - it used to handle appendTo fine when re-initializing. So I am still of the opinion that this is a bug introduced sometime and should be fixed.

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.