Jump to content

CKEditor does not reapply styles


steveooo
 Share

Recommended Posts

Hello,

I am using custom styles:

CKEDITOR.stylesSet.add('mystyles', [
    { name: 'Box', element: 'div', attributes: { 'class': 'box' } },
    { name: 'Subheader', element: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes: { 'class': 'subheader' } },
    { name: 'No margin bottom', element: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], attributes: { 'class': 'no-margin-bottom' } },
    { name: 'Intro nav', element: ['ul', 'ol'], attributes: { 'class': 'intro-navigation' } },
]);

The thing is: I see my custom styling in the editor (via contents.css) and my styles are selectable and savable.

So I style text and save and it works.

On reopening the styles won't apply, even if it was successfully saved (right HTML in database), so when I then save, all styles are gone.

Am I doing something wrong?

Link to comment
Share on other sites

Have you tried disabling ACF in the field's settings? If disabling ACF makes it work, you'll probably have to add rules for the elements and classes in your custom styles in the Extra Allowed Content field.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...