Issue #4083πŸ’¬ AnsweredOpened Jan 20, 2022by henzigo1 reactions

Set root does not work

Quick answerby artf❀ 1

Yeah, the LayerManager module itself has no documentation. Indeed it's on the waiting list for the refactoring and once it's done we can publish more about its usage and API documentation. Anyway, I've seen your previous message about how you would like to use my demo example but with inverted logic (enabling only wha...

Read full answer below ↓

Question

GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Safari 15.0Reproducible demo link https://jsfiddle.net/adw6y12f/9/Describe the bug Hello, I'm trying to set root component for the editor as it was described here. Unfortunately, this is not working and I can edit all HTML content. Thanks for your advice or fix that bug :) How to reproduce the bug?Create HTML with some divsSet id or class to one div that you wants to be root layerSet that id as root element to init method : You can edit all elements in editor What is the expected behavior? All eleme...

Answers (4)

artfβ€’ Jan 25, 2022

Yeah, the LayerManager module itself has no documentation. Indeed it's on the waiting list for the refactoring and once it's done we can publish more about its usage and API documentation. Anyway, I've seen your previous message about how you would like to use my demo example but with inverted logi...

artfβ€’ Jan 21, 2022

Yeah, I see the issue with the root configuration in LayerManager. The temporary fix would be to trigger the root change on render of the layers panel: But anyway, the root of the LayerManager doesn't decide if your components are editable or not, its purpose here is only to change the root in the...

henzigoβ€’ Jan 21, 2022

Thank you for your answer. It would be nice to have some documentation of what is root element because only mentions are in PR/issues.

GJSBlockβ€’ May 17, 2026

Thanks for reporting this, @henzigo. Great question about Set root does not work. The recommended approach with Components is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener method Most operations can be achieved by...

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 β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.