Skip to content

Commit

Permalink
Merge pull request #38020 from jackkinsella/patch-1
Browse files Browse the repository at this point in the history
Update ActionText docs [ci skip]
  • Loading branch information
rafaelfranca committed Dec 18, 2019
2 parents 334450b + e1e9373 commit 69e0091
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions guides/source/action_text_overview.md
Expand Up @@ -45,9 +45,31 @@ happens after every keystroke, and avoids the need to use execCommand at all.

## Installation

Run `rails action_text:install` to add the Yarn package and copy over the necessary migration.
Also, you need to set up Active Storage for embedded images and other attachments.
Please refer to the [Active Storage Overview](active_storage_overview.html) guide.
Run `rails action_text:install` to add the Yarn package and copy over the necessary migration. Also, you need to set up Active Storage for embedded images and other attachments. Please refer to the [Active Storage Overview](active_storage_overview.html) guide.

After the installation is complete, a Rails app using Webpacker should have the following changes:

1. Both `trix` and `@rails/actiontext` should be required in your JavaScript pack.

```js
// application.js
require("trix")
require("@rails/actiontext")
```

2. The`trix` stylesheet should be imported into `actiontext.scss`.

```scss
@import "trix/dist/trix";
```

Additionally this `actiontext.scss` file should be imported into your stylesheet pack.

```
// application.scss
@import "./actiontext.scss";
```


## Examples

Expand All @@ -60,6 +82,8 @@ class Message < ApplicationRecord
end
```

Note that you don't need to add a `content` field to your `messages` table.

Then refer to this field in the form for the model:

```erb
Expand Down

0 comments on commit 69e0091

Please sign in to comment.