Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StylesSet for images #278

Open
jblechinger opened this issue Apr 10, 2024 · 4 comments · May be fixed by #300
Open

StylesSet for images #278

jblechinger opened this issue Apr 10, 2024 · 4 comments · May be fixed by #300

Comments

@jblechinger
Copy link

Is there any way to use RTE StylesSet's with images?

image

I already tried:
- { name: "Image special style", element: "img", attributes: { 'class': 'img-style' } }

Thanks 😊

@wwenzel
Copy link

wwenzel commented Apr 24, 2024

Unfortunally, I have the same problem.
All entries in StylesSet for element: "img" are ignored (till TYPO3 V10/11 this works fine).

Is there any mistake in the notation above or is handling completly changed in TYPO3 V12?

Any help is welcome. Thanks.

@wwenzel
Copy link

wwenzel commented Apr 25, 2024

I tried this new syntax for ckeditor5 but it also doesn't work:
style:
definitions:
- { name: "Image special style", element: "img", classes: ['img-style' ] }

Anyone any idea whats wrong?

@thommyhh thommyhh linked a pull request Sep 19, 2024 that will close this issue
@thommyhh
Copy link
Collaborator

I started debugging this issue, as I ran into it.

The root problem seems to be, that the CKEditor registers image stuff, even thought the CKEditor image plugin is not loaded. The style definitions are parsed and "compiled" directly, when the style plugin is initialized. This leads to, that the registration of the typo3image model with the img tag happens to late, to make it into the compiled style definitions.

When the style is checked against the selected element, the registered model names are checked. The CKEditor core registers imageInline, imageBlock as block elements with the img tag. That's why the typo3image is not recognized, when checking the styles.

I created an extra branch (#300) and made is so far, that the styles are enabled, when an image is selected and the correct style is displayed as active. However I can't get it change the class, when choosing another one. Feel free to use my branch and give it a try.

@thommyhh
Copy link
Collaborator

@jblechinger @wwenzel It just finished my PR (#300) and the style dropdown now works again. Would you mind testing my branch?

@Gitsko Would you take a look at the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants