[HELP] Adding new category for later use (without blocks yet)
Question
How do i define a new category, to use for later blocks i create ..without yet assigning a block to it.. and keep it closed by default?
I mean this one can be used to for a block added, but what if i have multiple blocks to add to same category again and again? Is there a way to have the category id, label, open state defined elswhere, instead repeating the process?
editor.BlockManager.add('block-id', {
...
label: 'Label content',
category: {
id: 'some-cat',
label: 'Some cat',
open: true
}
})
To collapse the default ones i used
editor.BlockManager.getCategories().each(ctg => ctg.set('open', false))
Answers (1)
Once the category is created you can use its ID in this way category: 'some-cat'
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1547
How to add component attributes (before rendering)
Hello, I'm looking to auto create components inside a block element and it seems that I manage to do that but with a small missing... How I...
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 #2189
[Question] How to add "Ordered/Unordered List" option in rte/custom block
Hi I'm trying to create an ordered list with grapesjs. I tried adding the following to the rte: And this works if my page is pre-filled wit...
Issue #3119
[QUESTION] How to create custom block made of grapesjs components?
Hi, i want to have custom blocks made of grapesjs components. I found solution how to add components: https://github.com/artf/grapesjs/issu...
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.