grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

[Bug]: Programmatic retrieval of layers' visibility always returns `true`

Open mcottret opened this issue 6 years ago • 2 comments

Hello again :)

Our team might have found a bug while using the Layer Manager API: every call to component.viewLayer.isVisible() seems to always return true, regardless of their actual state.

Steps to reproduce:

  • Open the demo
  • Switch to the layers panel
  • Click on the eye icon to hide the "Body" layer
  • Open the console
  • Executing editor.getWrapper().viewLayer.isVisible() returns 1 instead of false

Looking at the code, I believe this.model.getStyle() should be used instead of this.model.get('style') (which always returns {}) to retrieve the current display value.

As always, I'd be happy to open a PR to fix it !

Cheers :)

mcottret avatar Jun 30 '20 16:06 mcottret

Yeah, you're totally right, the PR is welcome :)

artf avatar Jul 05 '20 18:07 artf

Great ! #2879 opened.

mcottret avatar Jul 06 '20 14:07 mcottret