Issue #3005💬 AnsweredOpened September 7, 2020by Davidvlv1 reactions

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

Quick answerby artf1

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

Read full answer below ↓

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

Answers (3)

artfSeptember 14, 2020

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

RJCAMSeptember 10, 2020

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

DavidvlvSeptember 11, 2020

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

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.