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):
- { name: 'Paragraph', ..., {attributes : {'class' : null}} } - this produces <p class="null">
- { name: 'Paragraph', ..., {attributes : {'class' : false}} } - this removes the Paragraph style from the Combo completely
- { name: 'Paragraph', ..., {attributes : {'class' : }} } - empty string removes the Paragraph style from the Combo also
- { 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
comment:2 Changed 9 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
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.
In the combination #2, there should be 'class' : '' (empty string).