|
|
@ -35,8 +35,8 @@ import defaults, { BlockManagerConfig } from './config/config'; |
|
|
import Block, { BlockProperties } from './model/Block'; |
|
|
import Block, { BlockProperties } from './model/Block'; |
|
|
import Blocks from './model/Blocks'; |
|
|
import Blocks from './model/Blocks'; |
|
|
import Categories from '../abstract/ModuleCategories'; |
|
|
import Categories from '../abstract/ModuleCategories'; |
|
|
import Category from '../abstract/ModuleCategory'; |
|
|
import Category, { getItemsByCategory } from '../abstract/ModuleCategory'; |
|
|
import { BlocksEvents } from './types'; |
|
|
import { BlocksByCategory, BlocksEvents } from './types'; |
|
|
import BlocksView from './view/BlocksView'; |
|
|
import BlocksView from './view/BlocksView'; |
|
|
|
|
|
|
|
|
export type BlockEvent = `${BlocksEvents}`; |
|
|
export type BlockEvent = `${BlocksEvents}`; |
|
|
@ -278,6 +278,19 @@ export default class BlockManager extends ItemManagerModule<BlockManagerConfig, |
|
|
return this._dragBlock; |
|
|
return this._dragBlock; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Get blocks by category. |
|
|
|
|
|
* @example |
|
|
|
|
|
* blockManager.getBlocksByCategory(); |
|
|
|
|
|
* // Returns an array of items of this type
|
|
|
|
|
|
* // > { category?: Category; items: Block[] }
|
|
|
|
|
|
* |
|
|
|
|
|
* // NOTE: The item without category is the one containing blocks without category.
|
|
|
|
|
|
*/ |
|
|
|
|
|
getBlocksByCategory(): BlocksByCategory[] { |
|
|
|
|
|
return getItemsByCategory<Block>(this.getAll().models); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Render blocks |
|
|
* Render blocks |
|
|
* @param {Array} blocks Blocks to render, without the argument will render all global blocks |
|
|
* @param {Array} blocks Blocks to render, without the argument will render all global blocks |
|
|
|