|
|
@ -30,8 +30,7 @@ import {
|
|
|
|
DEFAULT_CODE,
|
|
|
|
DEFAULT_CODE,
|
|
|
|
DEFAULT_SETTINGS,
|
|
|
|
DEFAULT_SETTINGS,
|
|
|
|
DEFAULT_LANGUAGE,
|
|
|
|
DEFAULT_LANGUAGE,
|
|
|
|
DEFAULT_PRESET_ID,
|
|
|
|
DEFAULT_PRESET_ID
|
|
|
|
MAX_PAYLOAD_SIZE
|
|
|
|
|
|
|
|
} from '../lib/constants'
|
|
|
|
} from '../lib/constants'
|
|
|
|
import { serializeState, getQueryStringState } from '../lib/routing'
|
|
|
|
import { serializeState, getQueryStringState } from '../lib/routing'
|
|
|
|
import {
|
|
|
|
import {
|
|
|
@ -40,8 +39,7 @@ import {
|
|
|
|
unescapeHtml,
|
|
|
|
unescapeHtml,
|
|
|
|
formatCode,
|
|
|
|
formatCode,
|
|
|
|
omit,
|
|
|
|
omit,
|
|
|
|
isSafari,
|
|
|
|
verifyPayloadSize
|
|
|
|
sizeOf
|
|
|
|
|
|
|
|
} from '../lib/util'
|
|
|
|
} from '../lib/util'
|
|
|
|
import LanguageIcon from './svg/Language'
|
|
|
|
import LanguageIcon from './svg/Language'
|
|
|
|
import ThemeIcon from './svg/Theme'
|
|
|
|
import ThemeIcon from './svg/Theme'
|
|
|
@ -113,7 +111,10 @@ class Editor extends React.Component {
|
|
|
|
window.addEventListener('offline', this.setOffline)
|
|
|
|
window.addEventListener('offline', this.setOffline)
|
|
|
|
window.addEventListener('online', this.setOnline)
|
|
|
|
window.addEventListener('online', this.setOnline)
|
|
|
|
|
|
|
|
|
|
|
|
this.isSafari = isSafari()
|
|
|
|
this.isSafari =
|
|
|
|
|
|
|
|
window.navigator &&
|
|
|
|
|
|
|
|
window.navigator.userAgent.indexOf('Safari') !== -1 &&
|
|
|
|
|
|
|
|
window.navigator.userAgent.indexOf('Chrome') === -1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
componentWillUnmount() {
|
|
|
@ -271,9 +272,7 @@ class Editor extends React.Component {
|
|
|
|
|
|
|
|
|
|
|
|
updateBackground({ photographer, ...changes } = {}) {
|
|
|
|
updateBackground({ photographer, ...changes } = {}) {
|
|
|
|
if (this.isSafari) {
|
|
|
|
if (this.isSafari) {
|
|
|
|
this.disablePNG =
|
|
|
|
this.disablePNG = !verifyPayloadSize(changes.backgroundImage)
|
|
|
|
typeof changes.backgroundImage === 'string' &&
|
|
|
|
|
|
|
|
sizeOf(changes.backgroundImage) > MAX_PAYLOAD_SIZE
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (photographer) {
|
|
|
|
if (photographer) {
|
|
|
|