Skip to content

Commit

Permalink
Merge pull request #391 from em411/fix/ckeditor-remove-icons
Browse files Browse the repository at this point in the history
Update docs and fix CKEditor configuration
  • Loading branch information
KrisFlorq authored Aug 20, 2021
2 parents a9281d8 + 900cfc0 commit 50fe4fd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Since FOSCKEditorBundle 2.0, to make Twig render the WYSIWYG editor, you must ad
twig:
form_themes:
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'
- '@BitBagSyliusCmsPlugin/Form/ckeditor_widget.html.twig'
```
Import required config in your `config/packages/_sylius.yaml` file:
Expand Down
23 changes: 21 additions & 2 deletions doc/wysiwyg.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@

This plugin comes with a default [FOSCKEditorBundle](https://github.com/FriendsOfSymfony/FOSCKEditorBundle) integration.
It has also been customized to use image upload feature. Every time you upload an image in the CKEditor, a new image media
is being created.
is being created.

## General usage

You can use a custom [WysiwygType](../src/Form/Type/WysiwygType.php) any place you want the CKEditor to appear in.
Take [the BlockTranslationType](../src/Form/Type/Translation/BlockTranslationType.php) as an example.

**Note:**

*In the WYSIWYG fields, you can use Twig function nesting. Read more [here](twig-functions-in-admin.md).*

## Configuration

If you want to customize any behavior of the CKEditor, you have to override one of these files: [CKEditor config](../src/Resources/config/fos_ck_editor/fos_ck_editor.yml) or [CKEditor js config](../src/Resources/views/Form/ckeditor_widget.html.twig)

**Useful links:**
- [CKEditor configuration](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html)
- [CKEditor DTD configuration](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dtd.html)


**Note:**
Remember to add your js configuration to `config/packages/twig.yaml` file:**
```yaml
# Symfony 2/3: app/config/config.yml
# Symfony 4: config/packages/twig.yaml

twig:
form_themes:
- 'path to your configuration'
```
5 changes: 5 additions & 0 deletions src/Resources/views/Form/ckeditor_widget.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "@FOSCKEditor/Form/ckeditor_widget.html.twig" %}

{% block ckeditor_widget_extra %}
CKEDITOR.dtd.$removeEmpty['i'] = false;
{% endblock %}
1 change: 1 addition & 0 deletions tests/Application/config/packages/twig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ twig:
strict_variables: '%kernel.debug%'
form_themes:
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'
- '@BitBagSyliusCmsPlugin/Form/ckeditor_widget.html.twig'

services:
_defaults:
Expand Down

0 comments on commit 50fe4fd

Please sign in to comment.