front / gutenberg-js

JavaScript only version of the WordPress Gutenberg editor (DEPRECATED)
GNU General Public License v2.0
390 stars 42 forks source link

Reusable blocks - Block has been deleted or is unavailable. #25

Closed vonloxx closed 5 years ago

vonloxx commented 5 years ago

Ahoy! Something strange happening with reusable blocks. I added a reusable block from a selection of blocks and it created without problems but when loading the page again it shows a message: Block has been deleted or is unavailable. Tested with G-editor and Drupal Gutenberg.

vonloxx commented 5 years ago

Ok! Found the issue. Some extra properties are needed when fetching the reusable block. Here's what I'm using now:

        'id' => (int) $block->id(),
        'title' => ['raw' => $block->info->value],
        'content' => ['protected' => false, 'raw' => $block->body->value],
        'type' => 'block',
        'status' => 'publish',
        'slug' => 'reusable_block_' . $block->id(),