Opened 7 years ago

Last modified 7 years ago

#7813 confirmed Bug

Unable to apply more than one style to selected text

Reported by: Wiktor Walc Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version: 3.0
Keywords: Cc: johaness.noreiga@…

Description

Not sure if we have already a ticket for it.

The XHTML sample is using classes for different styles and it works fine (it's possible to apply bold and italic to the same text):

coreStyles_bold	: { element : 'span', attributes : {'class': 'Bold'} },
coreStyles_italic	: { element : 'span', attributes : {'class': 'Italic'}},
coreStyles_underline	: { element : 'span', attributes : {'class': 'Underline'}},

However, when using the following:

config.coreStyles_bold = { element: 'span', attributes: { 'style': 'font-weight:bold'} };
config.coreStyles_italic = { element: 'span', attributes: { 'style': 'font-style:italic'} };
config.coreStyles_underline = { element: 'span', attributes: { 'style': 'text-decoration:underline'} };

CKEditor allows setting only one style on the same selection. It's quite strange because each style uses a different CSS rule (font-weight/text-decoration etc.).

Change History (2)

comment:1 Changed 7 years ago by Wiktor Walc

Cc: johaness.noreiga@… added

comment:2 Changed 7 years ago by Frederico Caldeira Knabben

Component: GeneralCore : Styles
Status: newconfirmed

The problem here is the usage of the same attribute for styling, which the editor understands as an override rule. We deal with "class" as a special case and it looks like we need to give a similar special treatment for "style".

This works well when the style definition uses "styles" instead of "attributes". That's probably by design. For example:

config.coreStyles_bold = { element: 'span', styles: { 'font-weight' : 'bold' } };
config.coreStyles_italic = { element: 'span', styles: { 'font-style' : 'italic' } };

One idea for a fix would be parsing the "style" attribute, moving its contents to the styles object when loading the style definition.

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