Opened 13 years ago

Closed 13 years ago

#8656 closed Bug (invalid)

When font_style and fontSize_style are using element:div, changing font size overwrites font style and vice versa

Reported by: adsharp Owned by:
Priority: Normal Milestone:
Component: Core : Styles Version: 3.6.2
Keywords: Cc: adam.sharp@…

Description

I have the following configuration:

config.font_style = {
  element    : 'div',
  styles   : { 'font-family' : '#(family)' },
  overrides  : [ { element : 'font', attributes : { 'face' : null } } ]
};
config.fontSize_style = {
  element    : 'div',
  styles   : { 'font-size' : '#(size)' },
  overrides  : [ { element : 'font', attributes : { 'size' : null } } ]
};

Where the default element for each is:

element    : 'span',

When the default span is used, font size and font family peacefully coexist. But when both are using div elements, changing the font size overwrites the font family div, and vice versa. Put another way, the formatting div can only have EITHER font-family or font-size styles in its style attribute.


When I set the font on a paragraph I get something like this:

<div style="font-family:arial,helvetica,sans-serif;">Hello.</div>

I then set the font and get this:

<div style="font-size:12px;">Hello.</div>

This is what I expected:

<div style="font-family:arial,helvetica,sans-serif; font-size:12px;">Hello.</div>

To be clear, this works as expected when the element is set to span for both. However it seems to achieve this by using two nested span elements, not by modifying the style attribute:

<span style="font-size:12px;"><span style="font-family: arial,helvetica,sans-serif;">Hello.</span></span>

I don't know if this would work for the div element.

I have tested this in Firefox and Safari under Mac OS X.

Change History (2)

comment:1 Changed 13 years ago by adsharp

Cc: adam.sharp@… added

comment:2 Changed 13 years ago by Garry Yao

Resolution: invalid
Status: newclosed

Font style/size style configuration accepts inline element only so it will NOT work with "div", please use instead the styles combo for that.

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