Issue #2511๐Ÿ’ฌ AnsweredOpened January 16, 2020by ikenderham1 reactions

How to open a sector when selecting a element?

Quick answerby artfโค 1

@ikenderham you were almost there

Read full answer below โ†“

Question

Hello everybody

How do i open a selector like general as i select the element.

I am new to javascript, but i tried something out like this.

editor.on('component:selected', function(component) {
  if(component.attributes.tagName == 'div') {
    const styleManager = editor.StyleManager;
    styleManager.getSector('General',{
 
      open: true,
   
    });
  }
});

what iam doing wrong?

Thx for help

Answers (3)

artfโ€ข January 19, 2020

@ikenderham you were almost there

editor.StyleManager.getSector('general').set({ open: true })
ikenderhamโ€ข January 16, 2020

Can you show me a example, if i click on a DIV then i need general to be opened, or when i click on a h1, then i need to open the "typography"?

Thanks alot im new to this.

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.