How to change the default selected panel?
I'm trying to use defaultCommand: 'open-blocks' but the style manager is the default selected one
Thanks!
Hi @romariolopezc did you try this:
defaultCommand: 'select-comp',
cheers!
Hello @pouyamiralayi
I just tried it and is not working
@romariolopezc are you on the latest version?
@pouyamiralayi I have this:
"grapesjs": "^0.15.8",
"grapesjs-mjml": "^0.1.15",
I'm using th MJML plugin, it may have something to do?
@romariolopezc please do not use defaultCommand and give this a try:
editor.on('load', () => {
editor.runCommand('open-blocks')
})
for other panels, replace open-blocks with open-layers for layers and open-tm for traits.
the current problem is that style-manager will always be opened by default in all of above scenarios.
it seems that this is a bug, i just tried using defaultCommand: 'open-layers' and it is not working; the same goes for 'open-traits'. i also tried all the alternatives like 'OpenTraitManager' @artf
@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


Here the screenshots
@romariolopezc unfortunately yes:
the current problem is that style-manager will always be opened by default in all of above scenarios.
i will investigate on this matter.
@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
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);
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!
@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
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
viewspanel are:
- open-sm
- open-tm
- open-layers
- open-blocks
cheers!
Actually i want to remove view code button so i write this code in angular this._editor.Panels.removeButton('options', 'export-template') but it's not working