diff --git a/components/Editor.js b/components/Editor.js index 3fd9056..cee5c19 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -33,14 +33,7 @@ import { DEFAULT_PRESET_ID } from '../lib/constants' import { serializeState, getQueryStringState } from '../lib/routing' -import { - getSettings, - escapeHtml, - unescapeHtml, - formatCode, - omit, - verifyPayloadSize -} from '../lib/util' +import { getSettings, escapeHtml, unescapeHtml, formatCode, omit } from '../lib/util' import LanguageIcon from './svg/Language' 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) { return file.type.split('/')[0] === 'image' } diff --git a/lib/util.js b/lib/util.js index fa9e65b..0e39260 100644 --- a/lib/util.js +++ b/lib/util.js @@ -76,10 +76,3 @@ export const omit = (object, keys) => omitBy(object, (_, k) => keys.indexOf(k) > export const stringifyRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})` export const capitalize = s => s.charAt(0).toUpperCase() + s.slice(1) - -const MAX_PAYLOAD_SIZE = 5e6 -export const verifyPayloadSize = str => { - if (typeof str !== 'string') return true - - return new Blob([str]).size < MAX_PAYLOAD_SIZE // bytes -}