Opened 9 years ago

Closed 9 years ago

#13237 closed Bug (duplicate)

styleSet - removing class attribute when switching style

Reported by: Ivan Čentéš Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version: 4.4.5
Keywords: Cc:

Description

I'm having troubles setting up my styleSet. I have (for simplicity) 2 styles:

CKEDITOR.stylesSet.add( 'styles-styles-datart', [
	{ name: 'Paragraph', element: 'p' },
	{
		name: 'Box with border',
		element: 'div',
		attributes: {
			'class': 'box-with-border'
		}
	}
]);

When I then use the Styles combo to change a block to a "Box with border", everything is ok, the class name is there.

But when I want to change the block back to a normal Paragraph, it leaves the class value without changes:

<p class="box-with-border">...</p>

I tried various configurations of the Paragraph style, but none worked (well one worked, but it is quite ugly):

  1. { name: 'Paragraph', ..., {attributes : {'class' : null}} } - this produces <p class="null">
  2. { name: 'Paragraph', ..., {attributes : {'class' : false}} } - this removes the Paragraph style from the Combo completely
  3. { name: 'Paragraph', ..., {attributes : {'class' : }} } - empty string removes the Paragraph style from the Combo also
  4. { name: 'Paragraph', ..., {attributes : {'class' : ' '}} } - string with 1 space character. Only this configuration works the way I wanted

Is there some other, cleaner way to do this?

Change History (2)

comment:1 Changed 9 years ago by Ivan Čentéš

In the combination #2, there should be 'class' : '' (empty string).

comment:2 Changed 9 years ago by Jakub Ś

Resolution: duplicate
Status: newclosed

This is a DUP of #12526.

When using Styles dropdown it should rather be possible to join styles as mentioned here: #11120.

It should however be possible to reset all these styles either by deselecting each option in styles dropdown (styles dropdown options work as toggle buttons) or simply by selecting appropriate tag from format dropdown.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy