|
|
@ -33,14 +33,7 @@ import {
|
|
|
|
DEFAULT_PRESET_ID
|
|
|
|
DEFAULT_PRESET_ID
|
|
|
|
} from '../lib/constants'
|
|
|
|
} from '../lib/constants'
|
|
|
|
import { serializeState, getQueryStringState } from '../lib/routing'
|
|
|
|
import { serializeState, getQueryStringState } from '../lib/routing'
|
|
|
|
import {
|
|
|
|
import { getSettings, escapeHtml, unescapeHtml, formatCode, omit } from '../lib/util'
|
|
|
|
getSettings,
|
|
|
|
|
|
|
|
escapeHtml,
|
|
|
|
|
|
|
|
unescapeHtml,
|
|
|
|
|
|
|
|
formatCode,
|
|
|
|
|
|
|
|
omit,
|
|
|
|
|
|
|
|
verifyPayloadSize
|
|
|
|
|
|
|
|
} from '../lib/util'
|
|
|
|
|
|
|
|
import LanguageIcon from './svg/Language'
|
|
|
|
import LanguageIcon from './svg/Language'
|
|
|
|
import ThemeIcon from './svg/Theme'
|
|
|
|
import ThemeIcon from './svg/Theme'
|
|
|
|
|
|
|
|
|
|
|
@ -428,6 +421,13 @@ class Editor extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const MAX_PAYLOAD_SIZE = 5e6 // bytes
|
|
|
|
|
|
|
|
function verifyPayloadSize(str) {
|
|
|
|
|
|
|
|
if (typeof str !== 'string') return true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new Blob([str]).size < MAX_PAYLOAD_SIZE
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function isImage(file) {
|
|
|
|
function isImage(file) {
|
|
|
|
return file.type.split('/')[0] === 'image'
|
|
|
|
return file.type.split('/')[0] === 'image'
|
|
|
|
}
|
|
|
|
}
|
|
|
|