Ticket #6671 (confirmed Bug)

Opened 4 years ago

Last modified 3 years ago

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">&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

6671.patch (518 bytes) - added by garry.yao 4 years ago.
6671_2.patch (642 bytes) - added by garry.yao 4 years ago.

Change History

Changed 4 years ago by garry.yao

comment:1 Changed 4 years ago by garry.yao

  • Status changed from new to review
  • Keywords HasPatch removed
  • Version set to 3.0
  • Component changed from Core : Styles to UI : Floating Panel
  • Owner set to garry.yao

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 4 years ago by garry.yao

  • Keywords HasPatch added
  • Status changed from review to assigned
  • Summary changed from removeFormat + Stylescombo bug+patch to Styles combo drop down list not refreshed

comment:3 Changed 4 years ago by wwalc

  • Milestone set to CKEditor 3.5.2

comment:4 Changed 4 years ago by garry.yao

  • Status changed from assigned to review
  • Keywords HasPatch removed

comment:5 Changed 4 years ago by garry.yao

#6500 and #7032 has been marked as DUPs.

comment:6 Changed 4 years ago by Saare

  • Status changed from review to review_passed

comment:7 Changed 4 years ago by garry.yao

  • Status changed from review_passed to closed
  • Resolution set to fixed

Fixed with [6453].

comment:8 Changed 4 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:9 Changed 4 years ago by satya

  • Keywords IBM added
  • Cc satya_minnekanti@… added

Changed 4 years ago by garry.yao

comment:10 Changed 4 years ago by garry.yao

  • Keywords FF added
  • Status changed from reopened to review

comment:11 Changed 4 years ago by fredck

  • Status changed from review to review_passed
  • Milestone set to CKEditor 3.6.1

comment:12 Changed 4 years ago by garry.yao

  • Status changed from review_passed to closed
  • Resolution set to fixed

Fixed with [6946].

comment:13 Changed 3 years 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 3 years ago by garry.yao

Confirmed to be regressed by Firefox since version 7.

comment:15 Changed 3 years ago by j.swiderski

  • Status changed from reopened to confirmed

Still reproducible in Firefox 11

Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy