diff --git a/components/Editor.js b/components/Editor.js index a2ca44b..b749f8f 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -99,7 +99,9 @@ class Editor extends React.Component { } // Makes sure the slash in encoded in application/X is decoded - newState.language = unescapeHtml(newState.language) + if (newState.language) { + newState.language = unescapeHtml(newState.language) + } this.setState(newState) diff --git a/lib/util.js b/lib/util.js index a4435a4..1f80ffe 100644 --- a/lib/util.js +++ b/lib/util.js @@ -20,7 +20,6 @@ export const escapeHtml = s => { .replace(//g, '>') .replace(/\//g, '/') - .replace(/&/g, '&') } } @@ -30,7 +29,6 @@ export const unescapeHtml = s => { .replace(/</g, '<') .replace(/>/g, '>') .replace(///g, '/') - .replace(/&/g, '&'); } }