Bug in a combinationof Kirby visual editor with Kirby Builder?

This kept me really busy for some hours … It might be related to the Kirby Builder, but i still post it here, since I don’t really know where the problem is.

I tried to have the Kirby visual editor as part of a Kirby builder field set. The blueprints and panel work as expected, but when I apply the same logic as this one

<?= $page->text()->blocks() ?>

in my respective snippets/blocks, I get this in my html

[
{
"attrs": [],
"content": "test45",
"id": "_ll1ats87h",
type": "paragraph
}
]

It turns out that before “type” and after “paragraph” the quotation marks are missing. If I add these in the content file (via text editor) it renders correctly. But as soon as I edit the page via panel the quotation marks are lost again.

Any ideas how to fix this?
Best
Hagen

Have you set pretty: false in the editor field configuration?

1 Like

@ahmetbora: Thats exactly it …

No I didn’t include “pretty: false”, I now included it in the field config and then it works! Wow …
By the way outside of the kirby builder fieldsets, the WYSIWYG editor works without this option.
Can you explain what it does?

@texnixe: Again I’m impressed by the details you know about kirby :+1:

        if ($this->pretty === true) {
            return json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
        }

        return json_encode($value);

You can read about the JSON constants here: PHP: Predefined Constants - Manual