Opened 13 years ago

Closed 9 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">&lt;h1&gt;Initial value&lt;/h1&gt;</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">&lt;div&gt;&lt;h1&gt;Initial value&lt;/h1&gt;&lt;/div&gt;</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:

Attachments (2)

6671.patch (518 bytes) - added by Garry Yao 13 years ago.
6671_2.patch (642 bytes) - added by Garry Yao 13 years ago.

Download all attachments as: .zip

Change History (18)

Changed 13 years ago by Garry Yao

Attachment: 6671.patch added

comment:1 Changed 13 years ago by Garry Yao

Component: Core : StylesUI : Floating Panel
Keywords: HasPatch removed
Owner: set to Garry Yao
Status: newreview
Version: 3.0

Much simplified reproducing steps here:

  1. Open "Styles" combo and apply the "Deleted Text" style to any text selection;
  2. 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 13 years ago by Garry Yao

Keywords: HasPatch added
Status: reviewassigned
Summary: removeFormat + Stylescombo bug+patchStyles combo drop down list not refreshed

comment:3 Changed 13 years ago by Wiktor Walc

Milestone: CKEditor 3.5.2

comment:4 Changed 13 years ago by Garry Yao

Keywords: HasPatch removed
Status: assignedreview

comment:5 Changed 13 years ago by Garry Yao

#6500 and #7032 has been marked as DUPs.

comment:6 Changed 13 years ago by Sa'ar Zac Elias

Status: reviewreview_passed

comment:7 Changed 13 years ago by Garry Yao

Resolution: fixed
Status: review_passedclosed

Fixed with [6453].

comment:8 Changed 13 years ago by Garry Yao

Milestone: CKEditor 3.5.3
Resolution: fixed
Status: closedreopened

Reopen because the fix is reverted by #7539.

comment:9 Changed 13 years ago by Satya Minnekanti

Cc: satya_minnekanti@… added
Keywords: IBM added

Changed 13 years ago by Garry Yao

Attachment: 6671_2.patch added

comment:10 Changed 13 years ago by Garry Yao

Keywords: FF added
Status: reopenedreview

comment:11 Changed 13 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.6.1
Status: reviewreview_passed

comment:12 Changed 13 years ago by Garry Yao

Resolution: fixed
Status: review_passedclosed

Fixed with [6946].

comment:13 Changed 12 years ago by Garry Yao

Milestone: CKEditor 3.6.1
Resolution: fixed
Status: closedreopened

The tc from first comment is still reproducible on trunk.

comment:14 Changed 12 years ago by Garry Yao

Confirmed to be regressed by Firefox since version 7.

comment:15 Changed 12 years ago by Jakub Ś

Status: reopenedconfirmed

Still reproducible in Firefox 11

comment:16 Changed 9 years ago by Jakub Ś

Resolution: fixed
Status: confirmedclosed

This issue is no longer reproducible in latest CKEditor 4.4.7 and FF 37.0.1

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