Sometimes you need an option to write a raw HTML and have a real-time preview for it. This package provides such ability. Under the hood this package uses iframe for HTML code your write, so Nova styles will not leak to the preview. Additionally, you can provide URLs to your custom CSS file and thus your HTML preview will be very close to the final result.
You can install the package in to a Laravel app that uses Nova via composer:
composer require interaction-design-foundation/nova-html-code-field
use InteractionDesignFoundation\NovaHtmlCodeField\HtmlCode;
public function fields()
{
return [
HtmlCode::make('HTML content', 'content'),
];
}
Full example:
HtmlCode::make('HTML content', 'content')
->styles([asset(mix('css/app.css'))]), // optional, you can inject your custom CSS files to have more realistic preview.
->previewTemplate('<section class="panel">%CODE%</section>') // optional, wrap editable code to have even better preview (good together with custom styles).
Please see Releases for more information on what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.
- Add toolbar
- Add HTML validator (https://www.npmjs.com/package/html-validator)
- Optimize a preview: re-render only changed node