inline this.state.fontFamily

main
Mike Fix 3 years ago
parent 6fd6d99a80
commit a88f98ddfb
No known key found for this signature in database
GPG Key ID: 1D85E862314CA79F

@ -134,9 +134,6 @@ class Editor extends React.Component {
height, height,
} }
// current font-family used
const fontFamily = this.state.fontFamily
// TODO consolidate type/format to only use one param // TODO consolidate type/format to only use one param
if (format === 'svg') { if (format === 'svg') {
return domtoimage return domtoimage
@ -151,7 +148,11 @@ class Editor extends React.Component {
.replace(/&(?!#?[a-z0-9]+;)/g, '&') .replace(/&(?!#?[a-z0-9]+;)/g, '&')
// remove other fonts which are not used // remove other fonts which are not used
.replace( .replace(
new RegExp('@font-face\\s+{\\s+font-family: (?!"*' + fontFamily + ').*?}', 'g'), // current font-family used
new RegExp(
'@font-face\\s+{\\s+font-family: (?!"*' + this.state.fontFamily + ').*?}',
'g'
),
'' ''
) )
) )

Loading…
Cancel
Save