Opened 12 years ago

Last modified 7 years ago

#9349 confirmed Bug

Custom style with anchor element fails

Reported by: Olek Nowodziński Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version: 3.2.1
Keywords: Cc:

Description (last modified by Olek Nowodziński)

The following anchor style is invisible on the list of available styles:

CKEDITOR.stylesSet.add( 'default', [
	{
		name: 'Custom anchor',
		element: 'a',
		styles: {
			'line-height': '18px',
			color: 'red'
		}
	}
]);

The following code also fails:

var range = CKEDITOR.instances.editor1.getSelection().getRanges()[ 0 ];
new CKEDITOR.style( { element: 'a', ... } ).applyToRange( range );

It is visible when accessing via getStylesSet though:

CKEDITOR.instances.editor1.getStylesSet( function( stylesDefinitions ) { 
	console.log( stylesDefinitions );
});
>>> [ Object ]

This problem is only for element: 'a'. It works with p and similar. Also in v3.

Attachments (1)

test2_cke3.html (2.2 KB) - added by Jakub Ś 11 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 12 years ago by Olek Nowodziński

Description: modified (diff)

comment:2 Changed 12 years ago by Garry Yao

Milestone: CKEditor 4.0

The DTD list of object elements need to be reviewed - style.js#L63, actually with the presence of link dialog, it makes little sense of having style with element <a> to be applied as "object", which manipulate a ancestor in the element path.

While we can definitely avoid this bug, since the style system support an explicit "type" property on style def, which will yield the proper style application result.

{
	element: 'a',
	type: CKEDITOR.STYLE_INLINE,
	attributes: { href: '#' },
	styles : { 'line-height': '18px' }
}

Added tc dt/core/style/style.html#test-apply-anchor-style for such usage.

Meanwhile we're working on the html5 DTD at #9301, the DTD is to be unified there, so I would leave this ticket open, to be checked after then.

Changed 11 years ago by Jakub Ś

Attachment: test2_cke3.html added

comment:3 Changed 11 years ago by Jakub Ś

Status: newconfirmed
Version: 4.0 (GitHub - master)3.2.1
  1. Actually the same thing is happening with tables and images as described in #9405 comment5.
  2. Problem can be reproduced from CKEditor 3.2.1 (when styles combo has started reflecting selection)
  3. Styles are only visible when you click on element and then open styles dropdown.

Please also see the attached sample.

This may be a duplicate of #9405.

comment:4 Changed 11 years ago by Bhadresh Shiroya1

same problem occur plz ans

comment:5 Changed 7 years ago by SebCorbin

May be related https://groups.google.com/forum/#!topic/hippo-community/RS7gf_s8ai4

Classes have to be alphabetically ordered to work...

comment:6 Changed 7 years ago by Jakub Ś

@SebCorbin if that is really the case then this issue might be related to #13206.

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