Editor custom snippet logic

I am using a custom editor paragraph snippet - is it possible to check what the next block is e.g if next image add this html ?

I see there are block type and block next functions, but I not sure how to use them together: https://github.com/getkirby/editor/wiki/Block-object

I was answering on Slack and you deleted your post as I was about to finish – all gone. But thanks for asking here instead.

Try this (I’m just guessing from the docs without having tried it myself):

$nextBlock = $block->next();
if ($nextBlock && $nextBlock->type() == 'image') {
  // do stuff
}

works perfect, thanks!