Multiple Toolbars

To utilize multiple toolbars in your Nova resources, you can easily duplicate the configuration of toolbars.toolbar-1 in the config/nova-ckeditor.php file. Then, you can reference the cloned toolbar configuration in the options of your CkEditor fields.

  1. Add a new array item to the toolbars array, defining your new toolbar. For example:

config/nova-ckeditor.php
return [
    'toolbars' => [
        'toolbar-1' => [
            ...
        ],
        'toolbar-2' => [
            ...
        ],   
    ]
];

  1. Use it in your CkEditor field:

use Mostafaznv\NovaCkEditor\CkEditor;

class Article extends Resource
{
    public function fields(Request $request): array
    {
        return [
            ID::make()->sortable(),

            // this field uses the default toolbar (toolbar-1)
            CkEditor::make(trans('Content'), 'content')
                ->stacked(),

            CkEditor::make(trans('Description'), 'description')
                ->toolbar('toolbar-2')
                ->stacked()
        ];
    }
}

Last updated