Opened 14 years ago
Last modified 14 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 14 years ago by
Cc: | johaness.noreiga@… added |
---|
comment:2 Changed 14 years ago by
Component: | General → Core : Styles |
---|---|
Status: | new → confirmed |
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:
One idea for a fix would be parsing the "style" attribute, moving its contents to the styles object when loading the style definition.