#36316RTE: Importing google webfonts breaks style sheet parsing
Description
The rte does not show any custom classes, if your rte.css imports google webfonts:
rte.css
@charset "UTF-8";
@import "http://fonts.googleapis.com/css?family=Quattrocento+Sans:400,700,400italic,700italic";
p.teaser {
font-weight:bold;
}
pageTS is configured with this teaser class, but the class does not show up in the style drop down.
Removing the @import solves this issue (the class shows up correctly).
Digging into the code, I found the bug in sysext/rtehtmlarea/htmlarea/htmlarea.js:
When parsing the rules, it only checks if it is an import rule and uses the cssRules of that stylesheet:
Line 3761:
if (cssRules[rule].styleSheet) {
this.parseRules(cssRules[rule].styleSheet.cssRules);
}
The correct check would be:
if (cssRules[rule].styleSheet && cssRules[rule].styleSheet.cssRules) {
this.parseRules(cssRules[rule].styleSheet.cssRules);
}
In the case of the google web fonts cssRules is null and the check for cssRules.length fails.
Reviews 4
- TYPO3_4-5 12681[BUGFIX] RTE: Importing google webfonts breaks style sheet parsing
- TYPO3_4-7 12683[BUGFIX] RTE: Importing google webfonts breaks style sheet parsing
- TYPO3_4-6 12682[BUGFIX] RTE: Importing google webfonts breaks style sheet parsing
- main 12646[BUGFIX] RTE: Importing google webfonts breaks style sheet parsing