Skip to content

Commit da33367

Browse files
committed
Update README.md
1 parent 77cc01d commit da33367

File tree

1 file changed

+52
-29
lines changed

1 file changed

+52
-29
lines changed

README.md

+52-29
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,92 @@
1-
# Nova HTML code Field
1+
# Nova HTML Code Field
22

33
[![Latest Stable Version](https://poser.pugx.org/interaction-design-foundation/nova-html-code-field/v/stable)](https://packagist.org/packages/interaction-design-foundation/nova-html-code-field)
44
[![Total Downloads](https://poser.pugx.org/interaction-design-foundation/nova-html-code-field/downloads)](https://packagist.org/packages/interaction-design-foundation/nova-html-code-field)
55

6-
![image](https://user-images.githubusercontent.com/5278175/144928019-c295d08c-d8cc-412f-90c1-b94a83aa63a7.png)
6+
A Laravel Nova field that provides a powerful HTML code editor with real-time preview capabilities.
7+
Write raw HTML and see instant results, with the preview rendered in an isolated iframe to prevent style conflicts with Nova's UI.
78

9+
![Nova HTML Code Field Demo](resources/img/[email protected])
810

9-
Sometimes you need an option to write a raw HTML and have a real-time preview for it.
10-
This package provides such ability. Under the hood this package uses iframe for HTML code your write,
11-
so Nova styles will not leak to the preview. Additionally, you can provide URLs to your custom CSS file
12-
and thus your HTML preview will be very close to the final result.
13-
14-
![image](https://github.com/InteractionDesignFoundation/nova-html-code-field/blob/main/resources/img/[email protected])
11+
## Features
1512

13+
- Real-time HTML preview
14+
- Isolated preview environment using iframes
15+
- Custom CSS injection support
16+
- Customizable preview template
17+
- Compatible with Laravel Nova 4.x and 5.x
1618

1719
## Installation
1820

19-
You can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:
21+
You can install the package via composer:
2022

2123
```bash
2224
composer require interaction-design-foundation/nova-html-code-field
2325
```
2426

27+
The package will automatically register its service provider.
28+
2529
## Usage
2630

31+
### Basic Usage
32+
2733
```php
2834
use InteractionDesignFoundation\NovaHtmlCodeField\HtmlCode;
2935

30-
public function fields()
36+
public function fields(NovaRequest $request): array
3137
{
3238
return [
33-
HtmlCode::make('HTML content', 'content'),
34-
];
39+
HtmlCode::make('HTML Content', 'content'),
40+
];
3541
}
3642
```
3743

44+
### Advanced Usage
3845

39-
### Options
40-
41-
Full example:
4246
```php
43-
HtmlCode::make('HTML content', 'content')
44-
->styles([asset(mix('css/app.css'))]), // optional, you can inject your custom CSS files to have more realistic preview.
45-
->previewTemplate('<section class="panel">%CODE%</section>') // optional, wrap editable code to have even better preview (good together with custom styles).
46-
```
47+
use InteractionDesignFoundation\NovaHtmlCodeField\HtmlCode;
4748

49+
public function fields(NovaRequest $request): array
50+
{
51+
return [
52+
HtmlCode::make('HTML Content', 'content')
53+
// Include stylesheets into iframe for more accurate preview
54+
->styles([
55+
asset('css/app.css'), // your custom
56+
'https://cdn.example.com/custom.css', // from a CDN
57+
])
58+
// Wrap the HTML content in a template ("%CODE%" is required)
59+
->previewTemplate('<section class="panel">%CODE%</section>'),
60+
];
61+
}
62+
```
4863

49-
### Changelog
64+
## Contributing
5065

51-
Please see [Releases](https://github.com/InteractionDesignFoundation/nova-unlayer-field/releases) for more information on what has changed recently.
66+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details on how to contribute to this project.
5267

68+
### Testing
5369

54-
## Contributing
70+
```bash
71+
composer test
72+
```
5573

56-
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
74+
### Code Style
5775

76+
```bash
77+
# Fix code style
78+
composer cs:fix
79+
```
5880

59-
## License
81+
## Security
6082

61-
The MIT License (MIT). Please see [License File](LICENSE) for more information.
83+
If you discover any security-related issues, please email the maintainers instead of using the issue tracker.
6284

85+
## Credits
6386

64-
## ToDo
87+
- [Interaction Design Foundation](https://github.com/InteractionDesignFoundation)
88+
- [All Contributors](../../contributors)
6589

66-
1. Add toolbar
67-
1. Add HTML validator (https://www.npmjs.com/package/html-validator)
68-
1. Optimize a preview: re-render only changed node
90+
## License
6991

92+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

0 commit comments

Comments
 (0)