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

Tinymce 6 custom style_formats not all formats working/showing up #13577

Closed
enemyss opened this issue Dec 14, 2022 · 5 comments
Closed

Tinymce 6 custom style_formats not all formats working/showing up #13577

enemyss opened this issue Dec 14, 2022 · 5 comments

Comments

@enemyss
Copy link

enemyss commented Dec 14, 2022

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

11.0.0

Bug summary

Some custom styles tinymce set via "style_formats" in app settings are not picked up. Looks like "block" and "format" ones are picked up but "selector" aren't

Also, why these style_formats doesn't override default ones but just merges them?
ut6TbpDdoa
I tried setting style_formats_merge: false, didn't help.

Specifics

For example

Doesn't work
{ "title": "Table row 1", "selector": "tr", "classes": "tablerow1" },
Works
{ "title": "Red header", "block": "h1", "styles": { "color": "#ff0000"} },
Doesn't work
{ "title": "Image Left", "selector": "img", "styles": { "float": "left", "margin": "0 10px 0 10px" } },
Works
{ "title": "Align center", "format": "aligncenter" },
Works
{ "title": "div", "block": "div" },

These examples are taken from https://www.tiny.cloud/docs/tinymce/6/user-formatting-options/

Steps to reproduce

  1. Add custom "style_formats" via appsettings.json, for example - [\r\n {\"title\":\"Rubriker\",\"items\":[\r\n { \"title\": \"Table row 1\", \"selector\": \"tr\", \"classes\": \"tablerow1\" }, { \"title\": \"Image Left\", \"selector\": \"img\", \"styles\": { \"float\": \"left\", \"margin\": \"0 10px 0 10px\" } },{ \"title\": \"Red header\", \"block\": \"h1\", \"styles\": { \"color\": \"#ff0000\"} },\r\n {\"title\":\"Header 3 (H3)\",\"block\":\"h3\"},\r\n {\"title\":\"Rubrik H2 orange\",\"block\":\"h2\", \"classes\": [\"is--orange\"]},\r\n {\"title\":\"Rubrik H3 orange\",\"block\":\"h3\", \"classes\": [\"is--orange\"]},\r\n\t{\r\n \"title\": \"V\u00E4nsterst\u00E4lld\",\r\n \"selector\": \"img\",\r\n \"classes\": [\"float--left\"]\r\n },\r\n {\r\n \"title\": \"H\u00F6gerst\u00E4lld\",\r\n \"selector\": \"img\",\r\n \"classes\": [\"float--right\"]\r\n }, {\r\n \"title\": \"Full bredd\",\r\n \"selector\": \"img\",\r\n \"classes\": [\"full--size\"]\r\n },\r\n\t{\"title\":\"Checklista\",\"selector\":\"ul\", \"classes\": [\"check-list\"]}\r\n ]}]
  2. Launch site and check RTE formats in backoffice it will show only these:
    r4XNMv2Zcp

Expected result / actual result

All custom "style_formats" should show up in RTE style list as they worked in Umbraco 8.

@kjac
Copy link
Contributor

kjac commented Dec 15, 2022

Hi @enemyss,

Thank you for reaching out 😄

On the subject of selectors... our TinyMCE configuration is set to hide un-applicable styles (style_formats_autohide = true). You should see the image specific styles when selecting an image.

On the subject of extending/merging the style set versus overwriting it completely, this seems to be a bug. I would expect to be able to remove the default styles explicitly by supplying my own style_formats - ideally we should support style_formats_merge too, but one thing at a time I guess.

I will get in touch with the team and see if we can't figure out a way to move forward with this.

@kjac
Copy link
Contributor

kjac commented Dec 15, 2022

Hi again @enemyss,

We talked this over internally and agreed to change things up a bit. A fix has been submitted - see #13582

@enemyss
Copy link
Author

enemyss commented Dec 15, 2022

Hi @kjac,

On the subject of selectors... our TinyMCE configuration is set to hide un-applicable styles (style_formats_autohide = true). You should see the image specific styles when selecting an image.

Ah, makes sense now :D

We talked this over internally and agreed to change things up a bit. A fix has been submitted - see #13582

Thanks a lot!

@kjac
Copy link
Contributor

kjac commented Dec 15, 2022

@enemyss while we're at it, we've also reverted the style_formats_autohide config so we apply the default, which is false. This should probably lessen the confusion about missing styles for everyone 😄

@nikolajlauridsen
Copy link
Contributor

I've just merged #13582, so I'll go ahead and close this one 😄

@nikolajlauridsen nikolajlauridsen added release/11.1.0 and removed state/needs-investigation This requires input from HQ or community to proceed labels Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants