From 926ba9224ff3b66d7098697a83b9b3c73802a089 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Wed, 27 Jun 2018 09:25:59 -0700 Subject: [PATCH] Fix % encoding issue --- components/Editor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/Editor.js b/components/Editor.js index 79a47aa..6150a6a 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -103,8 +103,12 @@ class Editor extends React.Component { }, filter: n => { // %[00 -> 19] cause failures - if (n.innerText && n.innerText.match(/%[0-1][0-9]/)) { - return false + if ( + n.innerText && n.innerText.match(/%[0-1][0-9]/) && + n.className && + n.className.startsWith('cm-') // is CodeMirror primitive string + ) { + n.innerText = n.innerText.replace('%', '%25') } if (n.className) { return String(n.className).indexOf('eliminateOnRender') < 0