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)
mmm honestly I don't see how that might have worked previously but I'll fix it in the next release
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.
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.
Issue #2921
BUG: Autosave not working on style manager when classes are disabled
Version: 0.16.18 Are you able to reproduce the bug from the demo? [x ] Yes: https://jsfiddle.net/ju1a0onx/ What is the expected behavior? A...
Issue #3629
BUG AND FIX: Layer manager overflow/scaling
Version: 0.17.19 Are you able to reproduce the bug from the demo?[x] Yes[ ] No What is the expected behavior? You should be able to see eve...
Issue #3319
BUG: layers text does not center after creating a new line
Version: current? You can get the version by typing grapesjs.version into the console Are you able to reproduce the bug from the demo? [ ]...
Issue #3166
BUG: Problem with copy and paste a node
*Version:0.16.27 Are you able to reproduce the bug from the demo? [ ] Yes [ ] No What is the expected behavior? In the right panel and canv...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.