Making blocks
A block has a visual side which is the Block
class and an optional modified Livewire component (BlockEditComponent
) to make it editable.
Run the following artisan command to create a new Block with an edit component:
php artisan dropblockeditor:make Text
Note that the values of the block are accessable in your edit component through the data
attribute.
If you want to create a block that doesn't need an editable component, you can pass the --without-edit-component
flag.
Registering blocks
Once your block is created, to make it show up in the editor, you need to register it in your configuration file.
return [
'blocks' => [
Jeffreyvr\DropBlockEditor\Blocks\Example::class,
],
];
You may also override this by passing an array to the Livewire editor component.
@livewire('dropblockeditor', [
'blocks' => [
Jeffreyvr\DropBlockEditor\Blocks\Example::class,
]
])