craftcms/ckeditor

Cannot add inline-style tag to element

Closed this issue · 1 comments

Hi,

I'm trying to add an inline-style tag to a paragraph. For example: my user selects a few words, clicks on Styles and chooses Green Text. What I'd like to see is this being generated:

<p style="color: #385E89;">Green Text</p>

I can't get this to work via the JSON config. Classes do work, but in my specific case I need it to be an inline-style. For now, I won't go into details as to why this is the case. If needed, I will.

What I did try was:

  "style": {
"definitions": [
    "attributes": {
      "style": "color:#385E39;"
    },
    "classes": [
      "text-gg-green"
    ],
    "element": "p",
    "name": "Green text"
    ]
    }

I'm using Craft 4.10.3 and CKEditor 3.8.3.

Hi, thanks for getting in touch! CKEditor 5 does not support adding inline attributes via the styles feature - you can only use classes.

Here’s a bit more info on this:

I hope this helps!