Opened 15 years ago
Closed 11 years ago
#6671 closed Bug (fixed)
Styles combo drop down list not refreshed
| Reported by: | Gilles van den Hoven | Owned by: | Garry Yao |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | UI : Floating Panel | Version: | 3.0 |
| Keywords: | IBM FF | Cc: | gilles@…, satya_minnekanti@… |
Description
Situation:
- CKEditor 3.4.2
- Custom styleset loaded
- removeFormatTags added to include (e.g. remove) block elements
Following configuration was used:
<textarea name="editor1" rows="8" cols="60"><h1>Initial value</h1></textarea>
<script type="text/javascript">//<![CDATA[
CKEDITOR.replace('editor1', {
"language": "en",
"skin": "v2",
"width": "100%",
"height": "500",
"resize_enabled": false,
"baseHref": "http:\/\/127.0.0.1\/",
"forcePasteAsPlainText": true,
"removePlugins": "elementspath",
"removeFormatTags": "b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var,h1,h2,h3,h4,h5,h6,hr",
"toolbarCanCollapse": false,
"stylesSet": "default:http:\/\/127.0.0.1\/\/rewrite.php\/cms\/ckeditor\/styles"
});
//]]></script>
The loaded styleset:
CKEDITOR.stylesSet.add('default', [ { name: 'CMS - Accordeon titel element', element: 'div', attributes: { 'class': 'wuaTitle' } }, { name: 'Koptekst 1', element: 'h1' }, { name: 'Koptekst 2', element: 'h2' }, { name: 'Koptekst 3', element: 'h3' }, { name: 'Koptekst 4', element: 'h4' }, { name: 'Koptekst 5', element: 'h5' }, { name: 'Koptekst 6', element: 'h6' } ]);
BUG description:
- Select the entire tag
- Click on the removeFormat button
- This removes the H1, but leaves the style marked in the stylescombo.
- So the styles combo did not get refreshed/updated in FF 3.6.12.
Does NOT happen (e.g. behaviour is correct) when the H1 is wrapped in a container as shown below:
<textarea name="editor1" rows="8" cols="60"><div><h1>Initial value</h1></div></textarea>
Cause & sollution:
After searching and diggin into the code for a huge ammount of time..
It seems that after clicking the removeFormat button, the "selectionChange", attached in the stylescombo (onRender) is not fired.
Getting this event to fire (duplicating code from _source/plugins/tabletools/dialogs.js:525) was unsuccesfull.
I managed to get it working by doing the following 2 changes, but it could be nicer...
./_source/plugins/stylescombo/plugins.js
onRender : function()
{
function updateCombo( ev ) {
var currentValue = this.getValue();
var elementPath = ev.data.path,
elements = elementPath.elements;
// For each element into the elements path.
for ( var i = 0, count = elements.length, element ; i < count ; i++ )
{
element = elements[i];
// Check if the element is removable by any of
// the styles.
for ( var value in styles )
{
if ( styles[ value ].checkElementRemovable( element, true ) )
{
if ( value != currentValue )
this.setValue( value );
return;
}
}
}
// If no styles match, just empty it.
this.setValue( '' );
}
editor.on( 'selectionChange', updateCombo, this);
editor.on( 'removeFormat', updateCombo, this);
},
./_source/plugins/stylescombo/plugins.js (line 120)
editor.getSelection().selectRanges( ranges );
editor.fire( 'removeFormat', { path : new CKEDITOR.dom.elementPath( editor.getSelection().getStartElement() ) } );
Sample URLs:
- Bug behavior http://ckeditor.webunity.nl/index-3-4-2-nocontainer.php
- Correct behavior http://ckeditor.webunity.nl/index-3-4-2-container.php
- Patched behavior http://ckeditor.webunity.nl/index-3-4-2-patched.php
Attachments (2)
Change History (18)
Changed 15 years ago by
| Attachment: | 6671.patch added |
|---|
comment:1 Changed 15 years ago by
| Component: | Core : Styles → UI : Floating Panel |
|---|---|
| Keywords: | HasPatch removed |
| Owner: | set to Garry Yao |
| Status: | new → review |
| Version: | → 3.0 |
comment:2 Changed 15 years ago by
| Keywords: | HasPatch added |
|---|---|
| Status: | review → assigned |
| Summary: | removeFormat + Stylescombo bug+patch → Styles combo drop down list not refreshed |
comment:3 Changed 15 years ago by
| Milestone: | → CKEditor 3.5.2 |
|---|
comment:4 Changed 15 years ago by
| Keywords: | HasPatch removed |
|---|---|
| Status: | assigned → review |
comment:6 Changed 15 years ago by
| Status: | review → review_passed |
|---|
comment:7 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review_passed → closed |
Fixed with [6453].
comment:8 Changed 15 years ago by
| Milestone: | CKEditor 3.5.3 |
|---|---|
| Resolution: | fixed |
| Status: | closed → reopened |
Reopen because the fix is reverted by #7539.
comment:9 Changed 15 years ago by
| Cc: | satya_minnekanti@… added |
|---|---|
| Keywords: | IBM added |
Changed 15 years ago by
| Attachment: | 6671_2.patch added |
|---|
comment:10 Changed 15 years ago by
| Keywords: | FF added |
|---|---|
| Status: | reopened → review |
comment:11 Changed 15 years ago by
| Milestone: | → CKEditor 3.6.1 |
|---|---|
| Status: | review → review_passed |
comment:12 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review_passed → closed |
Fixed with [6946].
comment:13 Changed 14 years ago by
| Milestone: | CKEditor 3.6.1 |
|---|---|
| Resolution: | fixed |
| Status: | closed → reopened |
The tc from first comment is still reproducible on trunk.
comment:16 Changed 11 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | confirmed → closed |
This issue is no longer reproducible in latest CKEditor 4.4.7 and FF 37.0.1

Much simplified reproducing steps here: