question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: Set root does not work

See original GitHub issue

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Safari 15.0

Reproducible 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?

  1. Create HTML with some divs
  2. Set id or class to one div that you wants to be root layer
  3. Set that id as root element to init method :
grapesjs.init({
  container: '#gjs',
  fromElement: 1,
  height: '100%',
  storageManager: { type: 0 },
  plugins: ['gjs-blocks-basic'],
  layerManager: {
    root: '#editable',
  },
});
  1. You can edit all elements in editor

What is the expected behavior? All elements will be rendered, but only elements in root element will be editable

What is the current behavior? All elements are editable

Code of Conduct

  • I agree to follow this project’s Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
artfcommented, 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 logic (enabling only what is known). Well, I’ve tried it but unfortunately, I’ve spotted some issues I have to fix before. Once the next release is ready, I’ll publish the demo example.

0reactions
artfcommented, Feb 21, 2022

In that case, onlyMatched: true might help you, but consider that you’re always able to filter CSS rules before exporting them so you can exclude what is not necessary for your output.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Guide] Post-Root Common Issues, Bugs, and Fixes
This guide is meant to help those who have rooted their phones and are now finding it slow, laggy, messy, etc.
Read more >
How to Fix Root Bug after macOS 10.14 Update
There are many tricks to fix root bug on macOS 10.14 update. Here will offer you the most effective solutions to fix macOS...
Read more >
Bug #1980466 “mysql_secure_installation can not set root ...
When I am trying to use mysql_secure_installation after I installed MySQL server, it ends up with loop asking me the new root password....
Read more >
ADB root is not working on emulator (cannot run as root in ...
3, now I cannot run adb root command for new created emulator. the error shown is below: adbd cannot run as root in...
Read more >
"error: XDG_RUNTIME_DIR not set in the environment." when ...
(nautilus:9341): Gtk-WARNING **: cannot open display: The issue does not occur when I attempt to run nautilus as non-root. I am using ubuntu...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found