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)
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 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);
@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.
Issue #631
How to refresh Classes view for active Component in the Style Manager
I'm using a trait (type=select) to change the class of a component (a "column" component, so classes representing width 1-12). After I have...
Issue #2514
[Question]: How to change device from dropdown to icon
I'm trying to replace the dropdown with icon for the devices following the example in the newsletter template yet it doesn't work.
Issue #3294
FEAT: Adding options to properties list array in style manager
Hi, How can I add buildProps to properties list such that when an option is selected, the properties of that option will be displayed An ex...
Issue #2687
[Question] How to append style manager to custom panel
I would like to append the whole style manager module to a panel? I have been digging up the docs for the past 2 days and couldn't find a p...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.

