safari bug fixes

main
Mike Fix 6 years ago
parent 8c5e584aa2
commit f8a3499156

@ -81,7 +81,7 @@ class Editor extends React.Component {
if ( if (
navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Safari') !== -1 &&
navigator.userAgent.indexOf('Chrome') === -1 && navigator.userAgent.indexOf('Chrome') === -1 &&
format === 'png' format !== 'svg'
) { ) {
const encodedState = serializeState(this.state) const encodedState = serializeState(this.state)
return api.image(encodedState) return api.image(encodedState)

@ -50,10 +50,9 @@ const reverseMappings = mappings.map(mapping =>
) )
export const serializeState = state => { export const serializeState = state => {
const stateString = JSON.stringify(state) const stateString = encodeURIComponent(JSON.stringify(state))
return encodeURIComponent( return encodeURIComponent(typeof window !== 'undefined'
typeof window !== 'undefined'
? btoa(stateString) ? btoa(stateString)
: Buffer.from(stateString).toString('base64') : Buffer.from(stateString).toString('base64')
) )

Loading…
Cancel
Save