- Install the package
composer require apimediaru/nova-tinymce
- Publish assets
php artisan nova-tinymce:publish
php artisan vendor:publish --tag=nova-tinymce-config
php artisan vendor:publish --tag=nova-tinymce-lang
(enables skins, languages and plugins)
php artisan vendor:publish --tag=nova-tinymce-assets
Example of usage in Nova:
use APIMedia\TinyMCE\TinyMCE;
/**
* Get the fields displayed by the resource.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function fields(Request $request)
{
return [
// ...
TinyMCE::make('Content'), 'content'),
];
}
TinyMCE frontend display height. Passing int
means height in pixels, but also you can pass string
with a css value, for example, 20rem
.
TinyMCE::make('Content'), 'content')
->height(150),
Override default editor settings for a certain field: editorConfig(array $config): array
.
Docs for TinyMCE can be found here.
TinyMCE::make('Content'), 'content')
->editorConfig([
'menubar' => false,
'plugins' => [
// Some plugins
],
'toolbar' => 'any custom toolbar items',
// ...
]),