Ticket #6671 (confirmed Bug)
Styles combo drop down list not refreshed
| Reported by: | Webunity | 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
Change History
comment:1 Changed 2 years ago by garry.yao
- Owner set to garry.yao
- Keywords HasPatch removed
- Version set to 3.0
- Component changed from Core : Styles to UI : Floating Panel
- Status changed from new to review
Much simplified reproducing steps here:
- Open "Styles" combo and apply the "Deleted Text" style to any text selection;
- Click on "Remove Format" button, note that inline label is changed on "Styles" combo, then open the combo again;
- Actual: "Deleted Text" option keep marked on the list.
comment:2 Changed 2 years ago by garry.yao
- Status changed from review to assigned
- Keywords HasPatch added
- Summary changed from removeFormat + Stylescombo bug+patch to Styles combo drop down list not refreshed
comment:4 Changed 2 years ago by garry.yao
- Keywords HasPatch removed
- Status changed from assigned to review
comment:7 Changed 2 years ago by garry.yao
- Status changed from review_passed to closed
- Resolution set to fixed
Fixed with [6453].
comment:8 Changed 2 years ago by garry.yao
- Status changed from closed to reopened
- Resolution fixed deleted
- Milestone CKEditor 3.5.3 deleted
Reopen because the fix is reverted by #7539.
comment:10 Changed 2 years ago by garry.yao
- Status changed from reopened to review
- Keywords FF added
comment:11 Changed 2 years ago by fredck
- Status changed from review to review_passed
- Milestone set to CKEditor 3.6.1
comment:12 Changed 2 years ago by garry.yao
- Status changed from review_passed to closed
- Resolution set to fixed
Fixed with [6946].
comment:13 Changed 14 months ago by garry.yao
- Status changed from closed to reopened
- Resolution fixed deleted
- Milestone CKEditor 3.6.1 deleted
The tc from first comment is still reproducible on trunk.
comment:14 Changed 14 months ago by garry.yao
Confirmed to be regressed by Firefox since version 7.
comment:15 Changed 14 months ago by j.swiderski
- Status changed from reopened to confirmed
Still reproducible in Firefox 11
