Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bard content not being json decoded #40

Closed
johncarter- opened this issue Jun 28, 2021 · 1 comment
Closed

Bard content not being json decoded #40

johncarter- opened this issue Jun 28, 2021 · 1 comment
Labels

Comments

@johncarter-
Copy link
Contributor

Description

When I save a Bard field the contents of the field in the edit screen is still json.

image

Steps to reproduce

config\runway.php

    'resources' => [
        \App\Models\MyModel::class => [
            'name' => 'My Model',

            'hidden' => true,
            // 'icon' => '',

            'blueprint' => [
                'sections' => [
                    'main' => [
                        'fields' => [
                            [
                                'handle' => 'title',
                                'field' => [
                                    'type' => 'text',
                                    'validate' => 'required',
                                ],
                            ],
                            [
                                'handle' => 'body',
                                'field' => [
                                    'type' => 'markdown',
                                    'validate' => '',
                                ],
                            ],
                            [
                                'handle' => 'images',
                                'field' => [
                                    'type' => 'assets',
                                    'container' => 'assets',
                                    'validate' => '',
                                ],
                            ],
                            [
                                'handle' => 'bard_content',
                                'field' => [
                                    'always_show_set_button' => false,
                                    'buttons' => [
                                        'h2',
                                        'h3',
                                        'bold',
                                        'italic',
                                        'unorderedlist',
                                        'orderedlist',
                                        'removeformat',
                                        'quote',
                                        'anchor',
                                        'image',
                                        'table',
                                    ],
                                    'save_html' => false,
                                    'toolbar_mode' => 'fixed',
                                    'link_noopener' => false,
                                    'link_noreferrer' => false,
                                    'target_blank' => false,
                                    'reading_time' => false,
                                    'fullscreen' => true,
                                    'allow_source' => true,
                                    'enable_input_rules' => true,
                                    'enable_paste_rules' => true,
                                    'display' => 'Standard Bard Field',
                                    'type' => 'bard',
                                    'icon' => 'bard',
                                    'listable' => 'hidden',
                                ],
                            ],
                        ],
                    ],
                ],
            ],

            'listing' => [
                'columns' => [
                    'title',
                ],

                'sort' => [
                    'column' => 'title',
                    'direction' => 'asc',
                ],
            ]
        ],
  

database\migrations\2021_06_26_211029_create_my_models_table.php

        Schema::create('my_models', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->string('body')->nullable();
            $table->json('images')->nullable();
            $table->json('bard_content')->nullable();
            $table->timestamps();
        });

app\Models\MyModel.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class MyModel extends Model
{
    use HasFactory;

    // protected $guarded = [];

    protected $casts = [
        'bard_content' => 'json',
    ];
}

Environment

Statamic 3.1.26 Solo
Laravel 8.48.2
PHP 7.4.19
doublethreedigital/runway 2.0.5

@duncanmcclean
Copy link
Member

Thanks, I'll take a look this evening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants