Builder Field: no preview with image and sizes

I’ve got a Builder Field image block which uses srcset and sizes. The preview for this block can’t be generated with the sizes present when I remove the sizes the preview shows as aspected. (Obviously, I can make a snippet for preview only.) When using a textarea and a Kirby image tag with the srcset and sizes it does work.

No preview with sizes:

Preview without sizes:

Hey @coko,

Can you tell me if there are any javascript errors in the console?

Tim, sorry for the late reply, busy …
Yes, errors, a quick screenshot:

As a workaround, would it work when you replace every $kirby with kirby() inside site/snippets/blocks/images.php ?

The $kirby variable is not available during preview. It is a valid point that this variable should be available here aswell.

Yes, I’ve got those sizes from my config: sizes="<?= $kirby->option('srcset-sizes.default') ?>".
So I can call them with kirby() also? Well, that’s no probs.

Yes. In Kirby context you can almost always call kirby() and page() if $kirby and/or $page are, why ever, not available.

Ok, thanks.