Skip to content

Commit

Permalink
Updated README structure and added HTML Purifier config section
Browse files Browse the repository at this point in the history
By #13
  • Loading branch information
Bert Oost committed Jun 23, 2019
1 parent 2cb4c3f commit ca0c5da
Showing 1 changed file with 63 additions and 8 deletions.
71 changes: 63 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,82 @@ __[Check the Craft CMS v2 version here](https://github.com/froala/Craft-Froala-W

![Entry Field Example](screenshots/editor-on-entry.png "Entry Field Example")

## Installation

You can install this plugin from the Plugin Store or with Composer.

#### From the Plugin Store

Go to the Plugin Store in your project's Control Panel and search for "Froala". Then click on the "Install" button in its modal window.

#### With Composer

Open your terminal and run the following commands:

```bash
# go to the project directory
cd /path/to/my-project

# tell Composer to load the plugin
composer require froala/craft-froala-wysiwyg

# tell Craft to install the plugin
./craft install/plugin froala-editor
```

## Known issue (help wanted!)

Adding links to Craft Entries causing issues when you double click on the entry to link to. Just click once and use the "Select" button.

Sorry for the inconvience. We're working on these annoying issues. But we decided to release a new version because of some missing important other features (like saving links the Craft way).

## Installation
## Configuration

Tell composer to load the plugin
### Froala Configs

```terminal
composer require froala/craft-froala-wysiwyg
```
You can create custom configs that will be available to your Froala fields. They should be created as JSON files in your `config/froalaeditor/` folder.

Afterwards you have to install the plugin via the control panel:
For example, if you created a `config/froalaeditor/Simple.json` file with the following content:

```json
{
"toolbarButtons": [
"bold", "italic", "underline", "strikeThrough", "formatOL", "formatUL", "insertHR", "|",
"undo", "redo", "|", "paragraphFormat", "paragraphStyle", "|", "html"
],
"paragraphFormat": {
"N": "Normal",
"H1": "Heading 1",
"H2": "Heading 2",
"H3": "Heading 3",
"H4": "Heading 4"
}
}
```
Settings > Plugins > Froala WYSIWYG > Install

…then a "Simple" option would become available within the config section on your Froala field’s settings.

See the [Froala documentation](https://www.froala.com/wysiwyg-editor/docs/options) for a list of available config options and buttons.

### HTML Purifier Configs

Froala fields use [HTML Purifier](http://htmlpurifier.org) to ensure that no malicious code makes it into its field values, to prevent XSS attacks and other vulnerabilities.

You can create custom HTML Purifier configs that will be available to your Froala fields. They should be created as JSON files in your `config/htmlpurifier/` folder.

Use this as a starting point, which is the default config that Froala fields use if no custom HTML Purifier config is selected:

```json
{
"Attr.AllowedFrameTargets": ["_blank"],
"Attr.EnableID": true,
"HTML.AllowedComments": ["pagebreak"]
}
```

Or use the Craft CMS plugin store to install the plugin.
(The [HTML.AllowedComments](http://htmlpurifier.org/live/configdoc/plain.html#HTML.AllowedComments) option is required for the `pagebreak` plugin.)

See the [HTML Purifier documentation](http://htmlpurifier.org/live/configdoc/plain.html) for a list of available config options.

## Contributing

Expand Down

0 comments on commit ca0c5da

Please sign in to comment.