Opened 12 years ago
Last modified 8 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 )
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)
Change History (7)
comment:1 Changed 12 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 12 years ago by
Milestone: | CKEditor 4.0 |
---|
Changed 12 years ago by
Attachment: | test2_cke3.html added |
---|
comment:3 Changed 12 years ago by
Status: | new → confirmed |
---|---|
Version: | 4.0 (GitHub - master) → 3.2.1 |
- Actually the same thing is happening with tables and images as described in #9405 comment5.
- Problem can be reproduced from CKEditor 3.2.1 (when styles combo has started reflecting selection)
- 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:5 Changed 8 years ago by
May be related https://groups.google.com/forum/#!topic/hippo-community/RS7gf_s8ai4
Classes have to be alphabetically ordered to work...
comment:6 Changed 8 years ago by
@SebCorbin if that is really the case then this issue might be related to #13206.
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.
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.