GeezerVison is showing github.com — Merge pull request #541 from BitBagCommerce/add_trix · zanosecurity/SyliusCmsPlugin@c492293
File treeExpand file treeCollapse file tree Open diff view settings features/admin/wysiwyg/trix templates/bundles/BitBagSyliusCmsPlugin/Widget
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/build.yml +32-24Lines changed: 32 additions & 24 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,27 +14,21 @@ jobs: | 14 | 14 | tests: | 15 | 15 | runs-on: ubuntu-latest | 16 | 16 |
| 17 | | - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" | | 17 | + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}, Trix ${{ matrix.trix }}" | 18 | 18 |
| 19 | 19 | strategy: | 20 | 20 | fail-fast: false | 21 | 21 | matrix: | 22 | | - php: ["8.0", "8.1", "8.2", "8.3"] | | 22 | + php: ["8.1", "8.2", "8.3"] | 23 | 23 | symfony: ["^5.4", "^6.4"] | 24 | | - sylius: ["~1.12.0", "~1.13.0", "~1.14.0"] | | 24 | + sylius: ["~1.13.0", "~1.14.0"] | 25 | 25 | node: ["20.x"] | 26 | 26 | mysql: ["8.0"] | | 27 | + trix: [false, true] | 27 | 28 |
| 28 | 29 | exclude: | 29 | | - - sylius: "~1.13.0" | 30 | | - php: 8.0 | 31 | | - - sylius: "~1.14.0" | 32 | | - php: 8.0 | 33 | 30 | - sylius: "~1.14.0" | 34 | 31 | symfony: ^5.4 | 35 | | - - sylius: "~1.12.0" | 36 | | - php: 8.0 | 37 | | - symfony: ^6.4 | 38 | 32 |
| 39 | 33 | env: | 40 | 34 | APP_ENV: test | @@ -115,7 +109,17 @@ jobs: | 115 | 109 |
| 116 | 110 | - name: Install JS dependencies | 117 | 111 | run: | | 118 | | - (cd tests/Application && yarn install) | | 112 | + cd tests/Application | | 113 | + if [ "${{ matrix.trix }}" = "true" ]; then | | 114 | + yarn add trix | | 115 | + sed -i "s/wysiwyg: 'ckeditor'/wysiwyg: 'trix'/" webpack.config.js | | 116 | + fi | | 117 | + yarn install | | 118 | +
| | 119 | + - name: Configure Trix if enabled | | 120 | + if: matrix.trix == true | | 121 | + run: | | | 122 | + printf "bit_bag_sylius_cms:\n wysiwyg_editor: trix\n" >> tests/Application/config/packages/bitbag_sylius_cms_plugin.yaml | 119 | 123 |
| 120 | 124 | - name: Prepare test application database | 121 | 125 | run: | | @@ -145,25 +149,29 @@ jobs: | 145 | 149 | - name: Run PHPUnit | 146 | 150 | run: vendor/bin/phpunit --colors=always | 147 | 151 |
| | 152 | + - name: Set Behat tags | | 153 | + if: matrix.trix != true | | 154 | + run: echo "BEHAT_TAGS=--tags='~@wysiwyg'" >> $GITHUB_ENV | | 155 | + | 148 | 156 | - name: Run Behat | 149 | | - run: vendor/bin/behat --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat --colors --strict -vvv --no-interaction -f progress --rerun | | 157 | + run: vendor/bin/behat ${{ env.BEHAT_TAGS }} --colors --strict -vvv --no-interaction -f progress || vendor/bin/behat ${{ env.BEHAT_TAGS }} --colors --strict -vvv --no-interaction -f progress --rerun | 150 | 158 |
| 151 | 159 | - name: Upload Behat logs | 152 | | - uses: actions/upload-artifact@v3 | | 160 | + uses: actions/upload-artifact@v4 | 153 | 161 | if: failure() | 154 | 162 | with: | 155 | 163 | name: Behat logs | 156 | 164 | path: etc/build/ | 157 | 165 | if-no-files-found: ignore | 158 | 166 |
| 159 | | - - name: Failed build Slack notification | 160 | | - uses: rtCamp/action-slack-notify@v2 | 161 | | - if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} | 162 | | - env: | 163 | | - SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} | 164 | | - SLACK_COLOR: ${{ job.status }} | 165 | | - SLACK_ICON: https://github.com/rtCamp.png?size=48 | 166 | | - SLACK_MESSAGE: ':x:' | 167 | | - SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository | 168 | | - SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} | 169 | | - SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} | | 167 | +# - name: Failed build Slack notification | | 168 | +# uses: rtCamp/action-slack-notify@v2 | | 169 | +# if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} | | 170 | +# env: | | 171 | +# SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} | | 172 | +# SLACK_COLOR: ${{ job.status }} | | 173 | +# SLACK_ICON: https://github.com/rtCamp.png?size=48 | | 174 | +# SLACK_MESSAGE: ':x:' | | 175 | +# SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository | | 176 | +# SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} | | 177 | +# SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/coding_standard.yml +2-9Lines changed: 2 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,21 +18,14 @@ jobs: | 18 | 18 | strategy: | 19 | 19 | fail-fast: false | 20 | 20 | matrix: | 21 | | - php: ["8.0", "8.1", "8.2", "8.3"] | | 21 | + php: ["8.1", "8.2", "8.3"] | 22 | 22 | symfony: ["^5.4", "^6.4"] | 23 | | - sylius: ["~1.12.0", "~1.13.0", "~1.14.0"] | | 23 | + sylius: ["~1.13.0", "~1.14.0"] | 24 | 24 | node: ["20.x"] | 25 | 25 |
| 26 | 26 | exclude: | 27 | | - - sylius: "~1.13.0" | 28 | | - php: 8.0 | 29 | | - - sylius: "~1.14.0" | 30 | | - php: 8.0 | 31 | 27 | - sylius: "~1.14.0" | 32 | 28 | symfony: ^5.4 | 33 | | - - sylius: "~1.12.0" | 34 | | - php: 8.0 | 35 | | - symfony: ^6.4 | 36 | 29 |
| 37 | 30 | steps: | 38 | 31 | - uses: actions/checkout@v3 | |
Collapse file Copy file name to clipboard +45Lines changed: 45 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# UPGRADE FROM `v4.3` TO `v4.4` | | 2 | + | | 3 | +This update adds support for Trix (as an optional WYSIWYG editor). If you would like to replace CKeditor with Trix review the plugin installation steps. | | 4 | + | | 5 | +The configuration has been split and the `fos_ck_editor` configuration is required to be added with this update. | | 6 | + | | 7 | +1. Import required CKeditor config in your `config/packages/_sylius.yaml` file: | | 8 | +```yaml | | 9 | +# config/packages/_sylius.yaml | | 10 | + | | 11 | +imports: | | 12 | + ... | | 13 | + | | 14 | + - { resource: "@BitBagSyliusCmsPlugin/Resources/config/fos_ck_editor/fos_ck_editor.yml" } | | 15 | +``` | | 16 | +
| | 17 | +*Or copy contents of `vendor/BitBag/cms-plugin/src/Resources/config/fos_ck_editor/fos_ck_editor.yml` to `config/packages/fos_ck_editor.yaml` file.* | | 18 | + | | 19 | +2. If project use a `./vendor/bitbag/cms-plugin/webpack.config.js` file in `webpack.config.js` you need change: | | 20 | + | | 21 | +From: | | 22 | +```js | | 23 | +// webpack.config.js | | 24 | +
| | 25 | +const [ bitbagCmsShop, bitbagCmsAdmin ] = require('./vendor/bitbag/cms-plugin/webpack.config.js') | | 26 | +
| | 27 | +... | | 28 | +
| | 29 | +module.exports = [..., bitbagCmsShop, bitbagCmsAdmin]; | | 30 | +``` | | 31 | + | | 32 | +To: | | 33 | +```js | | 34 | +// webpack.config.js | | 35 | +
| | 36 | +const createCmsConfigs = require('./vendor/bitbag/cms-plugin/webpack.config.js) | | 37 | +
| | 38 | +... | | 39 | +
| | 40 | +const [bitbagCmsShop, bitbagCmsAdmin] = createCmsConfigs({ | | 41 | + wysiwyg: 'ckeditor' // 'ckeditor' | 'trix' | | 42 | +}); | | 43 | +
| | 44 | +module.exports = [..., bitbagCmsShop, bitbagCmsAdmin]; | | 45 | +``` |
Collapse file Copy file name to clipboardExpand all lines: composer.json +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | "description": "CMS plugin for Sylius applications.", | 10 | 10 | "license": "MIT", | 11 | 11 | "require": { | 12 | | - "php": "^8.0", | 13 | | - "sylius/sylius": "^1.12", | | 12 | + "php": "^8.1", | | 13 | + "sylius/sylius": "^1.13", | 14 | 14 | "league/csv": "^9.1", | 15 | 15 | "friendsofsymfony/ckeditor-bundle": "^2.0", | 16 | 16 | "instaclick/php-webdriver": "^1.4", | |
Collapse file Copy file name to clipboardExpand all lines: doc/01.1-webpack-config.md +5-1Lines changed: 5 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 13 | 13 |
| 14 | 14 | ```js | 15 | 15 | // webpack.config.js | 16 | | -const [ bitbagCmsShop, bitbagCmsAdmin ] = require('./vendor/bitbag/cms-plugin/webpack.config.js') | | 16 | +const createCmsConfigs = require('./vendor/bitbag/cms-plugin/webpack.config.js) | 17 | 17 | ... | 18 | 18 |
| | 19 | +const [bitbagCmsShop, bitbagCmsAdmin] = createCmsConfigs({ | | 20 | + wysiwyg: 'ckeditor' // 'ckeditor' | 'trix' | | 21 | +}); | | 22 | +
| 19 | 23 | module.exports = [..., bitbagCmsShop, bitbagCmsAdmin]; | 20 | 24 | ``` | 21 | 25 |
| |
Collapse file Copy file name to clipboardExpand all lines: doc/01.2-webpack-entry.md +5-2Lines changed: 5 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 15 | 15 |
| 16 | 16 | // Shop config | 17 | 17 | .addEntry('bitbag-cms-shop', 'vendor/bitbag/cms-plugin/src/Resources/assets/shop/entry.js') | 18 | | - | 19 | | -// Admin config | | 18 | + | | 19 | +// Admin config - add one of the following entries (CKeditor or Trix) | | 20 | + // CKeditor | 20 | 21 | .addEntry('bitbag-cms-admin', 'vendor/bitbag/cms-plugin/src/Resources/assets/admin/entry.js') | | 22 | + // Trix | | 23 | + .addEntry('bitbag-cms-admin', 'vendor/bitbag/cms-plugin/src/Resources/assets/admin/trix-entry.js') | 21 | 24 | ``` | 22 | 25 |
| 23 | 26 | 2. Add encore functions to your templates | |
Collapse file Copy file name to clipboardExpand all lines: doc/01.3-import-entry.md +4-1Lines changed: 4 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 16 | 16 | // ./assets/shop/entry.js | 17 | 17 | import '../../vendor/bitbag/cms-plugin/src/Resources/assets/shop/entry.js'; | 18 | 18 |
| 19 | | -// ./assets/admin/entry.js | | 19 | +// ./assets/admin/entry.js - choose one of the following entries (CKeditor or Trix) | | 20 | +//CkEditor | 20 | 21 | import '../../vendor/bitbag/cms-plugin/src/Resources/assets/admin/entry.js'; | | 22 | +// Trix | | 23 | +import '../../vendor/bitbag/cms-plugin/src/Resources/assets/admin/trix-entry.js'; | 21 | 24 | ``` |
Collapse file Copy file name to clipboardExpand all lines: doc/01.4-custom-solution.md +6Lines changed: 6 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,9 +11,15 @@ Main entry points: | 11 | 11 | ```js | 12 | 12 | // shop | 13 | 13 | .addEntry('/vendor/bitbag/cms-plugin/src/Resources/assets/shop/entry.js') | | 14 | +``` | 14 | 15 |
| | 16 | +Choose one of the following entries (CKeditor or Trix): | | 17 | +```js | 15 | 18 | // admin | | 19 | +// Ckeditor | 16 | 20 | .addEntry('/vendor/bitbag/cms-plugin/src/Resources/assets/admin/entry.js') | | 21 | +// Trix | | 22 | +.addEntry('/vendor/bitbag/cms-plugin/src/Resources/assets/admin/trix-entry.js') | 17 | 23 | ``` | 18 | 24 |
| 19 | 25 | Style entry points: | |
Collapse file Copy file name to clipboardExpand all lines: doc/01.5-non-webpack.md +11Lines changed: 11 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -17,11 +17,22 @@ $ bin/console assets:install | 17 | 17 | ``` | 18 | 18 |
| 19 | 19 | 2. Add twig inclusions in your templates: | | 20 | + | | 21 | +(select one of the following options, depending on the editor you want to use: Trix or CKEditor) | 20 | 22 | ```twig | | 23 | +{# CKeditor config #} | 21 | 24 | {# @SyliusAdminBundle/_scripts.html.twig #} | 22 | 25 | {% include '@SyliusUi/_javascripts.html.twig' with { | 23 | 26 | 'path': 'bundles/bitbagsyliuscmsplugin/build/bitbag-cms-admin.js' | 24 | 27 | } %} | | 28 | +{# end - CKeditor config #} | | 29 | +
| | 30 | +{# Trix config #} | | 31 | +{# @SyliusAdminBundle/_scripts.html.twig #} | | 32 | +{% include '@SyliusUi/_javascripts.html.twig' with { | | 33 | + 'path': 'vendor/bitbag/cms-plugin/src/Resources/assets/trix-entry.js' | | 34 | +} %} | | 35 | +{# end - Trix config #} | 25 | 36 |
| 26 | 37 | {# @SyliusAdminBundle/_styles.html.twig #} | 27 | 38 | {% include '@SyliusUi/_stylesheets.html.twig' with { | |
Collapse file Copy file name to clipboard +48Lines changed: 48 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +1. Add plugin dependencies to your `config/bundles.php` file: | | 2 | + | | 3 | +```php | | 4 | +return [ | | 5 | + ... | | 6 | + | | 7 | + FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true], | | 8 | + BitBag\SyliusCmsPlugin\BitBagSyliusCmsPlugin::class => ['all' => true], | | 9 | +]; | | 10 | +``` | | 11 | + | | 12 | +2. Install CKeditor ([FOS CKEditor](https://symfony.com/doc/master/bundles/FOSCKEditorBundle/usage/ckeditor.html)) | | 13 | + | | 14 | +```bash | | 15 | +$ bin/console ckeditor:install | | 16 | +``` | | 17 | + | | 18 | +**Note.** If you have an issue with CKEditor not running, please try installing it using the `4.22.1` tag: | | 19 | + | | 20 | +```bash | | 21 | +$ bin/console ckeditor:install --tag=4.22.1 | | 22 | +``` | | 23 | + | | 24 | +For more information regarding the `4.22.1` tag, please visit the #485 issue. | | 25 | + | | 26 | +3. Since FOSCKEditorBundle 2.0, to make Twig render the WYSIWYG editor, you must add some configuration under the `twig.form_themes` config key: | | 27 | + | | 28 | +```yaml | | 29 | +# Symfony 2/3: app/config/config.yml | | 30 | +# Symfony 4: config/packages/twig.yaml | | 31 | + | | 32 | +twig: | | 33 | + form_themes: | | 34 | + - '@FOSCKEditor/Form/ckeditor_widget.html.twig' | | 35 | + - '@BitBagSyliusCmsPlugin/Form/ckeditor_widget.html.twig' | | 36 | +``` | | 37 | +
| | 38 | +4. Import required CKeditor config in your `config/packages/_sylius.yaml` file: | | 39 | +```yaml | | 40 | +# config/packages/_sylius.yaml | | 41 | +
| | 42 | +imports: | | 43 | + ... | | 44 | + | | 45 | + - { resource: "@BitBagSyliusCmsPlugin/Resources/config/fos_ck_editor/fos_ck_editor.yml" } | | 46 | +``` | | 47 | + | | 48 | +Continue with the next installation steps |
|