Grapesjs: How to add category for default block manager?

Created on 18 Jul 2018  路  4Comments  路  Source: artf/grapesjs

@artf I want put all default blocks to category named "Basic". But I can't find any documents about it.

image

I use editor.BlockManager.getAll().reset(); removed all blocks then use plugin "grapesjs-blocks-basic" to create "Basic" but anything still removed.

Or I just add a category to "gjs-blocks-no-cat", but I can't find anyway.

Thank you for help.

outdated

Most helpful comment

Hey @MooseFrankenstein Refer this codepen it might help you Codepen Demo

Please Try this code:

const bm = editor.BlockManager;
editor.on('load', () => {
editor.BlockManager.render([
bm.get('column1').set('category', ''),
bm.get('column2').set('category', ''),
bm.get('column3').set('category', ''),
bm.get('text').set('category', ''),
bm.get('image').set('category', '')
])
});

put your category in bm.get('column1').set('category', 'your own category')

All 4 comments

Hey @MooseFrankenstein Refer this codepen it might help you Codepen Demo

Please Try this code:

const bm = editor.BlockManager;
editor.on('load', () => {
editor.BlockManager.render([
bm.get('column1').set('category', ''),
bm.get('column2').set('category', ''),
bm.get('column3').set('category', ''),
bm.get('text').set('category', ''),
bm.get('image').set('category', '')
])
});

put your category in bm.get('column1').set('category', 'your own category')

@AnkitKachhadiya Thanks for your help. bm.get(id).set('category', 'your own category'). It works for me. Thanks again. 馃憤

image

Hi @artf ,
I am using your plugin and i want to use blocks in different tabs like blocks,widgets and grids but when i am using the properties of blockManager like blockManager : {appendTo: '#blocks'}. Its showing all blocks in single tabs but i want to show blocks in different-2 tabs which i have list of blocks. I am not able to add blocks in different different tabs. All tabs are shown in upper right corner in above images.
Thanks.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faizansaiyed picture faizansaiyed  路  3Comments

Geczy picture Geczy  路  3Comments

kosirm picture kosirm  路  3Comments

YashPrince picture YashPrince  路  3Comments

applibs picture applibs  路  3Comments