Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#10659 closed defect (fixed)

Custom font style for dijit.Editor ignored

Reported by: Eric Pokriefke Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.5
Component: Editor Version: 1.4.0
Keywords: dijit editor font style Cc:
Blocked By: Blocking:

Description

If you add a style attribute to your div, which is used to create a dijit.Editor, for example

<div dojoType="dijit.Editor" style="foo:bar;font-size:10pt">

the style should be applied to the editing area, but it won't.

The problem is, as far as i discovered it, that there is a bug in the regular expression in Dijit/_editor/RichText.js line 493

this.style.replace(/(^|;)(line-|font-?)[^;]+/g, function(match){ userStyle += match.replace(/^;/g,"") + ';'; });

The regex matches strings like ";font-size:10pt" but this.style returns in the above example "foo: bar; font-size: 10pt", so the matching fails because of the whitespace between the styles.

A possible fix would be:

this.style.replace(/(^|;) ?(line-|font-?)[^;]+/g, function(match){ userStyle += match.replace(/^;/g,"") + ';'; });

Change History (6)

comment:1 Changed 10 years ago by Adam Peller

Component: DijitEditor
Milestone: tbd

comment:2 Changed 10 years ago by Adam Peller

Owner: set to Jared Jurkiewicz

comment:3 Changed 10 years ago by Jared Jurkiewicz

Milestone: tbd1.5

comment:4 Changed 10 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

(In [21233]) Adding in fixes for font-style migration to body node. also fixed incompatibility with IE due to casing of CSS variables in CSS text. Includes unit test. \!strict fixes #10659

comment:5 Changed 9 years ago by bill

(In [22137]) Fixing up mirroring and claring off certain styles from an editor domNode \!strict refs #11127

comment:6 Changed 9 years ago by bill

(In [22140]) Remove claro workaround code for Toolbar height, which was making Toolbar labels too big. Refs #10659, fixes #11127.

Note: See TracTickets for help on using tickets.