Skip to content

Commit c394ac7

Browse files
authored
Merge pull request #254 from petitbx/feat/sylius-2.0
2 parents da3a0c2 + 0e80d3d commit c394ac7

File tree

128 files changed

+1869
-712
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+1869
-712
lines changed

.github/workflows/recipe.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
php: ['8.1', '8.2', '8.3']
18-
sylius: ["~1.12.0", "~1.13.0", "1.14.0"]
17+
php: ['8.2', '8.3']
18+
sylius: ["~2.0.0"]
1919

2020
steps:
2121
- name: Setup PHP

.github/workflows/security.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php: ['8.1', '8.2', '8.3']
16+
php: ['8.2', '8.3']
1717

1818
steps:
1919
- uses: actions/checkout@v3

.github/workflows/tests.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
php: ['8.1', '8.2', '8.3']
17+
php: ['8.2', '8.3']
18+
node: ['20']
1819

1920
env:
2021
SYMFONY_ARGS: --no-tls
@@ -25,7 +26,7 @@ jobs:
2526
- uses: actions/checkout@v2
2627
- uses: actions/setup-node@v2
2728
with:
28-
node-version: '14'
29+
node-version: ${{ matrix.node }}
2930
- name: Setup PHP
3031
uses: shivammathur/setup-php@v2
3132
with:

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.DEFAULT_GOAL := help
22
SHELL=/bin/bash
33
APP_DIR=tests/Application
4-
SYLIUS_VERSION=1.14.0
4+
SYLIUS_VERSION=2.0.0
55
SYMFONY=cd ${APP_DIR} && symfony
66
COMPOSER=symfony composer
77
CONSOLE=${SYMFONY} console
@@ -23,9 +23,8 @@ down: server.stop docker.down ## Down the project (removes docker containers, st
2323

2424
reset: ## Stop docker and remove dependencies
2525
${MAKE} docker.down || true
26-
rm -rf ${APP_DIR}/node_modules ${APP_DIR}/yarn.lock
2726
rm -rf ${APP_DIR}
28-
rm -rf vendor composer.lock
27+
rm -rf node_modules yarn.lock vendor composer.lock
2928
.PHONY: reset
3029

3130
dependencies: composer.lock node_modules ## Setup the dependencies
@@ -46,6 +45,7 @@ yarn.install: ${APP_DIR}/yarn.lock
4645

4746
${APP_DIR}/yarn.lock:
4847
ln -sf ${APP_DIR}/node_modules node_modules
48+
touch ${APP_DIR}/yarn.lock
4949
cd ${APP_DIR} && ${YARN} install && ${YARN} build
5050
# No CSS and JS on this plugin yet
5151
# ${YARN} install

README.md

Lines changed: 28 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@
99

1010
This plugin adds a rich editor on the fields you want. Now you can manage your content very easily!
1111

12-
![Example of rich editor field](docs/images/screenshots/demo.gif)
12+
![Example of rich editor panel](docs/images/screenshots/elements.png)
13+
![Example of admin form](docs/images/screenshots/admin.png)
14+
![Example of front display](docs/images/screenshots/front.png)
1315

1416
## Compatibility
1517

1618
| Sylius Version | PHP Version |
1719
|----------------|-----------------|
18-
| 1.12 | 8.1 - 8.2 - 8.3 |
19-
| 1.13 | 8.1 - 8.2 - 8.3 |
20-
| 1.14 | 8.1 - 8.2 - 8.3 |
20+
| 2.0 | 8.1 - 8.2 |
2121

22-
## Installation
22+
ℹ️ For Sylius 1.x, see our branch [branch 2.x] (https://github.com/monsieurbiz/SyliusRichEditorPlugin/tree/2.0) and all 2.x releases.
2323

24+
## Installation
2425

2526
### Require the plugin
2627

@@ -45,6 +46,7 @@ Change your `config/bundles.php` file to add the line for the plugin :
4546

4647
return [
4748
//..
49+
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
4850
MonsieurBiz\SyliusRichEditorPlugin\MonsieurBizSyliusRichEditorPlugin::class => ['all' => true],
4951
];
5052
```
@@ -66,12 +68,13 @@ monsieurbiz_richeditor_admin:
6668
</p>
6769
</details>
6870

69-
### Correct `Twig\Extra\Intl\IntlExtension` conflict
71+
### Correct `Twig\Extra\Intl\IntlExtension` and `Twig\Extra\String\StringExtension` conflict
7072

71-
If the recipe did not comment it, update the file `config/packages/twig.yaml` to comment or remove the `IntlExtension` declaration :
73+
If the recipe did not comment it, update the file `config/packages/twig.yaml` to comment or remove the `IntlExtension` and `StringExtension` declarations :
7274

7375
```yaml
7476
# Twig\Extra\Intl\IntlExtension: ~
77+
#Twig\Extra\String\StringExtension: ~
7578
```
7679

7780
### Install the assets
@@ -84,17 +87,8 @@ bin/console asset:install
8487

8588
## Use it with the [Sylius Media Manager](https://github.com/monsieurbiz/SyliusMediaManagerPlugin/)
8689

87-
You don't need to do something, everything is compatible.
88-
89-
```
90-
composer require monsieurbiz/sylius-media-manager-plugin="^1.0"
91-
```
92-
93-
If you used the rich editor before using the media manager, you need to override the form theme of the media manager plugin :
94-
```
95-
mkdir -p templates/bundles/MonsieurBizSyliusMediaManagerPlugin/Admin/MediaManager/Form/;
96-
cp dist/templates/bundles/MonsieurBizSyliusMediaManagerPlugin/Admin/MediaManager/Form/_theme.html.twig templates/bundles/MonsieurBizSyliusMediaManagerPlugin/Admin/MediaManager/Form/_theme.html.twig;
97-
```
90+
The Media Manager is not compatible yet with Rich Editor v3.
91+
We are doing our best to make it work with it. Stay tuned!
9892

9993
## Use the Rich Editor
10094

@@ -106,11 +100,9 @@ We have an example of implementation in the [file for the test application](/dis
106100
If your field has some data already, like some previous text before installing this plugin,
107101
then we will convert it for you as an HTML Element which contains… HTML.
108102

109-
![Example of a rich editor field](docs/images/screenshots/form_field.png)
110-
111103
This way you will be able to use our plugin right away without risking any data lost!
112104

113-
To make it clear: to have rich editor for original admin fields, like _Product description_, _Taxon desription_ etc. you have to update each form type by an extension as the example shows above.
105+
⚠️ To have rich editor for original admin fields, like _Product description_, _Taxon desription_ etc. you have to update each form type by an extension as the example shows above.
114106

115107
### Call twig render
116108

@@ -201,75 +193,21 @@ monsieurbiz_sylius_richeditor:
201193

202194
## Available elements
203195

204-
### Row Element (Layout)
205-
206-
It contains another rich editor field, each element will be displayed one below the other (as rows…).
207-
208-
### Column Element (Layout)
209-
210-
It contains another rich editor field, each element will be displayed side by side (as columns…).
211-
212-
By using this element in the `Row` element, you will be able to build some layout like the screenshot below.
213-
You can distinguish the `Row` element and the `Column` element by their dotted borders.
214-
215-
![The Columns and Rows elements](docs/images/screenshots/columns_and_rows.jpg)
216-
217-
### HTML Element
218-
219-
![The HTML element](docs/images/screenshots/html.png)
220-
221-
### Markdown Element
222-
223-
![The Markdown element](docs/images/screenshots/markdown.png)
224-
225-
You can use `MONSIEURBIZ_SYLIUS_RICH_EDITOR_ENABLED_HIGHLIGHT_JS_SHOP` to enable code highlighting in the shop.
226-
Also you can change the theme with `MONSIEURBIZ_SYLIUS_RICH_EDITOR_ENABLED_HIGHLIGHT_JS_THEME`.
227-
228-
### Text element
229-
230-
![The text element](docs/images/screenshots/text.png)
231-
232-
### Quote element
233-
234-
![The quote element](docs/images/screenshots/quote.png)
235-
236-
### Image element
237-
238-
![The image element](docs/images/screenshots/image.png)
239-
240-
### Video element
241-
242-
![The video element](docs/images/screenshots/video.png)
243-
244-
### Button element
245-
246-
![The button element](docs/images/screenshots/button.png)
247-
248-
### Title element
249-
250-
![The title element](docs/images/screenshots/title.png)
251-
252-
### Separator element
253-
254-
![The separator element](docs/images/screenshots/separator.png)
255-
256-
### Youtube element
257-
258-
![The Youtube element](docs/images/screenshots/youtube.png)
259-
260-
### Image collection element
261-
262-
![The Image collection element](docs/images/screenshots/image_collection.png)
263-
264-
## Example of a rich product description
265-
266-
### Admin form with preview
267-
268-
![Admin full form](docs/images/screenshots/full_back.png)
269-
270-
### Front display
271-
272-
![Front full display](docs/images/screenshots/full_front.png)
196+
- Two columns element (Layout)
197+
- Row Element (Layout)
198+
- Column Element (Layout)
199+
- HTML Element
200+
- Markdown Element
201+
- Text element
202+
- Quote element
203+
- Image element
204+
- Video element
205+
- Button element
206+
- Title element
207+
- Separator element
208+
- Youtube element
209+
- Image collection element
210+
- Anchor element
273211

274212
## Create your own elements
275213

@@ -413,27 +351,6 @@ Here is an example of a simple template for this our which can be used in front
413351
<iframe id="gmap_canvas" src="{{ element.link }}" scrolling="no" marginheight="0" marginwidth="0" width="600" height="500" frameborder="0"></iframe>
414352
```
415353

416-
417-
### The result !
418-
419-
#### The element is in the UI Elements list
420-
421-
![The Google Maps element](docs/images/screenshots/gmap_element.png)
422-
423-
#### You now have a form to edit it (your form!)
424-
425-
![The Google Maps form](docs/images/screenshots/gmap_form.png)
426-
427-
#### And we use your templates to render your UiElement
428-
429-
In admin :
430-
431-
![The GMap display](docs/images/screenshots/gmap_render_admin.png)
432-
433-
In front :
434-
435-
![The GMap display](docs/images/screenshots/gmap_render.png)
436-
437354
## File in fixtures management
438355

439356
In some cases you will want to add UI elements to your content fixtures which are Rich Editor fields. If you need files in your UI elements, you can use a dedicated fixture. It is used as follows.

UPGRADE-3.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Upgrade from v2 to v3
2+
3+
## Title UI Elements
4+
5+
H1, H2 and H3 are now Title element.
6+
The element stills available for existing contents, but you cannot add new ones.

assets/css/app.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ html.is-disabled body {
6060
right: 0;
6161
bottom: 0;
6262
left: 0;
63-
z-index: 999;
63+
z-index: 1020;
6464
display: none;
65-
padding: 0.714rem 0 0.714rem 5%;
65+
padding: 0 0 0 15rem;
6666
-webkit-user-select: none;
6767
-ms-user-select: none;
6868
user-select: none;
@@ -99,6 +99,7 @@ html.is-disabled body {
9999
border-right-width: 0;
100100
border-radius: 0.286rem 0 0 0.286rem;
101101
box-shadow: 1px 3px 3px 0 rgba(0, 0, 0, 0.2), 1px 3px 15px 2px rgba(0, 0, 0, 0.2);
102+
overflow: auto;
102103
}
103104

104105
[aria-hidden=false] .uie-panels__content {
@@ -124,6 +125,10 @@ html.is-disabled body {
124125
box-shadow: 0 1px 2px 0 rgba(34, 36, 38, 0.15);
125126
}
126127

128+
.uie-panels__new>.row {
129+
height: 100%;
130+
}
131+
127132
.uie-panels__new[aria-hidden=false] {
128133
display: flex;
129134
}
@@ -190,10 +195,6 @@ html.is-disabled body {
190195
cursor: pointer;
191196
}
192197

193-
.uie-card .content {
194-
padding-top: 1.5rem !important;
195-
}
196-
197198
.uie-card .header {
198199
display: flex !important;
199200
justify-content: space-between;

0 commit comments

Comments
 (0)