Issue #2387Opened November 7, 2019by rlopzc14 reactions

How to change the default selected panel?

Question

I'm trying to use defaultCommand: 'open-blocks' but the style manager is the default selected one

Thanks!

Answers (3)

pouyamiralayiNovember 12, 20198 reactions

thanks @naveen-15697 your solution works pretty awesome! well done. @romariolopezc does this suit your situation? as suggested by @naveen-15697 you have to go like this:

editor.on('load', () => {
        const blockBtn = editor.Panels.getButton('views', 'open-layers');
        blockBtn.set('active', 1);
})

and the button ids for views panel are:

  • open-sm
  • open-tm
  • open-layers
  • open-blocks

cheers!

naveen-15697November 12, 20194 reactions

@pouyamiralayi it doesn't behave as expected.

If I use editor.runCommand('open-blocks') on load, the components icon is not selected. Is appended to the bottom of the style manager

2019-11-11-085143_409x567_scrot

2019-11-11-085307_530x515_scrot

Here the screenshots

@romariolopezc , Instead for running the command. Try activating blocks button on load. const blockBtn = editor.Panels.getButton('panel-id', 'block-button-name'); blockBtn.set('active', 1);

rlopzcNovember 12, 20192 reactions

@pouyamiralayi @naveen-15697 it works!!

I use it outside of the load, after initializing grapesjs. If I use it on load then I see a small delay when changing from the style manager to open-blocks. If its after the .init({..}) then when it renders is selected

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.