Skip to content

Commit

Permalink
Tweaks the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tonysm committed Apr 12, 2024
1 parent 960e096 commit 0c08cc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,26 @@ Next, you may run the migration:
php artisan migrate
```

That's it.

### Blade Components

If you're using the [Importmap Laravel](https://github.com/tonysm/importmap-laravel) package, make sure you add the Trix core styles Blade Component to the `head` tag on your layout file(s):
Ensure the styles Blade component were added to your layouts:

```blade
<x-rich-text::styles />
```

If you're using breeze, you might want to set `theme=richtextlaravel` prop to this styles component:
Alternatively, if you're using Breeze (or TailwindCSS), you may prefer the tweaked theme:

```blade
<x-rich-text::styles theme="richtextlaravel" />
```

If you're using Laravel Mix/Webpack, the `resources/js/trix.js` file has the JS setup and the CSS import as well, so no need to use the the Blade Component.

The package also publishes a Blade Component for you which can be used inside your forms, like so:
Finally, you may now use the published input Blade component on your forms like so:

```blade
<x-trix-input id="bio" name="bio" />
```

That's it!

## Overview

We extract attachments before saving the rich text field (which uses Trix) in the database and minimize the content for storage. Attachments are replaced with `rich-text-attachment` tags. Attachments from attachable models have a `sgid` attribute, which should globally identify them in your app.
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private function updateAppLayoutFiles(): void
$layouts->each(function ($file) {
$contents = File::get($file);

if (str_contains($contents, '<x-rich-text::styles />')) {
if (str_contains($contents, '<x-rich-text::styles')) {
return;
}

Expand Down

0 comments on commit 0c08cc1

Please sign in to comment.