johnathan/nova-trumbowyg
johnathan/nova-trumbowyg adds the lightweight Trumbowyg WYSIWYG editor to Laravel Nova as a ready-to-use field. It provides a fast, customizable rich-text input for admin resources, letting you configure toolbar options and edit clean HTML content directly in Nova without a heavy editor dependency.
This is a Nova field package that wraps the Trumbowyg WYSIWYG editor. Treat it as a legacy Nova 1/2-era package first: confirm your Nova and Laravel versions before installing. Last release was 2019, so it is unlikely to work cleanly with Nova 4/5.
Minimal setup:
composer require johnathan/nova-trumbowyg
In a Nova resource, import the field class from the package namespace shown in its README and swap a Textarea for it:
use Johnathan\NovaTrumbowyg\Trumbowyg;
Trumbowyg::make('Content')
->options([
'btns' => [
['viewHTML'],
['formatting'],
['strong', 'em', 'del'],
['link'],
['undo', 'redo'],
],
]),
Look first at:
composer.json in the package for laravel/nova and illuminate/* constraints.src/FieldServiceProvider.php and the field Vue component to see how assets are loaded.First real use case: a CMS “Page body” or “Post content” field where editors need links, bold/italic, and basic formatting. Keep it on form views initially, save the resulting HTML into a text/longText column, and render it through a sanitizer rather than directly.
Use the field as a drop-in replacement for long-form HTML content:
public function fields(Request $request)
{
return [
ID::make()->sortable(),
Text::make('Title')->rules('required', 'max:255'),
Trumbowyg::make('Body')
->rules('required')
->onlyOnForms(),
Text::make('Body')
->displayUsing(fn ($value) => \Illuminate\Support\Str::limit(strip_tags($value), 120))
->exceptOnForms(),
];
}
Common day-to-day patterns:
options() array across resources.mews/purifier, HTMLPurifier, or an allowlist-based sanitizer in a model mutator/observer.max:255 rule is usually wrong for a rich-text column.{!! $sanitizedHtml !!} after purification. For index columns, show a strip_tags() preview.File/Image field is easier to secure and validate.onlyOnForms() / exceptOnForms() to avoid trying to render the editor in index/detail contexts where its JS may not initialize.Integration tips:
options() or setOptions() method, pass Trumbowyg’s native config there. Toolbar buttons are arrays of arrays; getting the nesting wrong produces a blank or malformed toolbar.composer require conflicts with Nova 4/5, do not force it. Use a maintained Tiptap/Quill/Trumbowyg Nova field instead, or fork and upgrade the Vue component.Trumbowyg is not defined, missing icons, or 404s for CSS/JS. Check the browser console and network tab, clear Nova/Composer caches, and confirm whether the package requires vendor:publish.[['strong', 'em'], ['link']], not a flat list in every case.Textarea to confirm the rest of the resource works, then isolate whether the failure is field initialization, assets, or saved HTML.How can I help you explore Laravel packages today?