Issue #2638Opened March 11, 2020by orionseye1 reactions

[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)

artfMarch 18, 20201 reactions

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.