getkirby / editor

A new type of WYSIWYG editor for Kirby
https://getkirby.com
205 stars 28 forks source link

Code block does not work, when editor is nested within structure #229

Open trych opened 4 years ago

trych commented 4 years ago

Describe the bug When an editor field is nested within a structure field, I cannot use the code field properly, not even when using the pretty: false option as advised elsewhere.

I am able to create a code field and enter a code snippet just fine, but when I reload the panel page, the code actually disappears (it's not displayed at all in the editor block, see screenshots).

Before reloading: 20200501-172427_Screenshot_GoogleChrome

After reloading: 20200501-172443_Screenshot_GoogleChrome

(Edit: Also, now I noticed in the panel's console it gives me this error: block component does not exist: paragraph).

In the content file, the code is now listed like this: 20200501-172611_Screenshot_SublimeText

And when I try to use this in my template, using

<?= $page->teststructure()->toStructure()->first()->testeditor()->blocks()  ?>

it renders the literal JSON string like this in the frontend: 20200501-172903_Screenshot_GoogleChrome

Would be great, if I could somehow be able to use code blocks within editor fields within structure fields as well! :)

tststs commented 4 years ago

@bastianallgeier any news here? it seems this issue is not only for a code block. we currently try to upgrade our projects to kirby v3 and trying to render editor content via ->blocks(). inside a structure the result is always that it renders the JSON structure instead of HTML.