Exported SVG is too large. (#683)

* The svg had initially contained all the fonts which are not need, so removed the fonts which we don't use using regex.

* Added my name to the contributors list.

* README.* updated

* unwanted regex string removed

* update ' ' to be \s+
main
Joel Hanson 6 years ago committed by Michael Fix
parent eda479e7eb
commit 8d93c58fa6

@ -463,6 +463,15 @@
"contributions": [
"translation"
]
},
{
"login": "Joel-hanson",
"name": "Joel Hanson",
"avatar_url": "https://avatars2.githubusercontent.com/u/17215044?s=460&v=4",
"profile": "https://github.com/Joel-hanson",
"contributions": [
"code"
]
}
],
"repoType": "github"

File diff suppressed because one or more lines are too long

@ -159,6 +159,8 @@ class Editor extends React.Component {
height
}
// current font-family used
const fontFamily = this.state.fontFamily
try {
if (type === 'blob') {
if (format === 'svg') {
@ -171,6 +173,11 @@ class Editor extends React.Component {
// https://github.com/tsayen/dom-to-image/blob/fae625bce0970b3a039671ea7f338d05ecb3d0e8/src/dom-to-image.js#L551
.replace(/%23/g, '#')
.replace(/%0A/g, '\n')
// remove other fonts which are not used
.replace(
new RegExp('@font-face\\s+{\\s+font-family: (?!"*' + fontFamily + ').*?}', 'g'),
''
)
)
// https://stackoverflow.com/questions/7604436/xmlparseentityref-no-name-warnings-while-loading-xml-into-a-php-file
.then(dataUrl => dataUrl.replace(/&(?!#?[a-z0-9]+;)/g, '&'))

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save