Hi guys,
Excited to play and explore this code. Is there a way to load blocks collapsed?
I noticed the style manager has properties for open = false, but I don't see it for blocks.
I was able to make them all collapsed by default by changing this code
src/block_manager/view/CategoryView.js
updateVisibility() {
if(this.model.get('open'))
this.**close**(); //used to be open by default
else
this.**open**();
},
Thanks!
It turns out there is a default value you can change in the model.
src/block_manager/model/Category.js
var Backbone = require('backbone');
module.exports = Backbone.Model.extend({
defaults: {
id: '',
label: '',
open: false,
attributes: {},
},
});
but I'm not able to set it when I'm loading a new block. Still looking will update soon.
Hi Dan, when you add a block you can indicate the category and its state if you want
editor.BlockManager.add('block-id', {
...
label: 'Lable content',
category: {
id: 'some-cat',
label: 'Some cat',
open: true
}
})
If you want to close all block categories opened by default just add this
editor.BlockManager.getCategories().each(ctg => ctg.set('open', false))
Thanks Artur!
Can;t wait to contribute once I get familiar with the code.
Dan
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.
Most helpful comment
Hi Dan, when you add a block you can indicate the category and its state if you want
If you want to close all block categories opened by default just add this