diff --git a/components/Editor.js b/components/Editor.js
index 5b64c17..560e07b 100644
--- a/components/Editor.js
+++ b/components/Editor.js
@@ -15,6 +15,7 @@ import Carbon from './Carbon'
import ExportMenu from './ExportMenu'
import Themes from './Themes'
import TweetButton from './TweetButton'
+import GistContainer from './GistContainer'
import {
LANGUAGES,
LANGUAGE_MIME_HASH,
@@ -29,7 +30,7 @@ import {
DEFAULT_PRESET_ID
} from '../lib/constants'
import { serializeState, getQueryStringState } from '../lib/routing'
-import { getSettings, escapeHtml, unescapeHtml, formatCode, omit } from '../lib/util'
+import { getSettings, unescapeHtml, formatCode, omit } from '../lib/util'
import LanguageIcon from './svg/Language'
const languageIcon =
@@ -61,29 +62,9 @@ class Editor extends React.Component {
async componentDidMount() {
const { asPath = '' } = this.props.router
- const { query, pathname } = url.parse(asPath, true)
- const path = escapeHtml(pathname.split('/').pop())
+ const { query } = url.parse(asPath, true)
const queryParams = getQueryStringState(query)
- let initialState = Object.keys(queryParams).length ? queryParams : {}
- try {
- // TODO fix this hack
- if (path.length >= 19 && path.indexOf('.') === -1 && this.context.gist) {
- const { code, language, config } = await this.context.gist.get(path)
-
- if (typeof config === 'object') {
- initialState = config
- }
-
- if (language) {
- initialState.language = language.toLowerCase()
- }
-
- initialState.code = code
- }
- } catch (e) {
- // eslint-disable-next-line
- console.log(e)
- }
+ const initialState = Object.keys(queryParams).length ? queryParams : {}
const newState = {
// Load from localStorage
@@ -355,6 +336,8 @@ class Editor extends React.Component {
)}
+
+ this.setState(stateFromGist)} />