Closed cmcintosh closed 1 year ago
Not currently. At the moment, are added in the order of insertion, but one possible trick might be the use of flexbox
We could look at something simple as adding a Weight parameter like CMS's like drupal do. Ill look at the code to see how hard it would be to create a PR.
Should the plugin added components being sort.
var editor = grapesjs.init(grapesjsoptions);
plugins: [ 'gjs-plugin-placeholder'],
pluginsOpts: {
'gjs-plugin-placeholder': {/* ...options */},
}
//Also added some manually
editor.BlockManager.add('grid-items', {
label: 'Grid items',
content: '<div>Grid code</div>'}
});
should able to customized afterward like
editor.BlockManager.sort(filter) -- by filter of label, by any config of order in BlockManager.add
As a (not-so-great and hopefully temporary) workaround, I moved the category I wanted to move using jQuery after the editor was fully initialized:
setTimeout(function(){
$(".gjs-block-categories>div:last").prependTo(".gjs-block-categories");
}, 1000)
Sort all blocks then render with block manager.
Closing for inactivity
Is there a method to set how the categories are shown in the Block tab?