From f184e711c11de01c6fca1cf864a42517c2196122 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Wed, 31 Oct 2018 10:01:25 -0700 Subject: [PATCH] fix encoding issue for plain text - Closes #569 - Opens #564 --- components/Editor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/Editor.js b/components/Editor.js index 167415c..07d7d9f 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -149,7 +149,7 @@ class Editor extends React.Component { if (isPNG) { const newNode = node.cloneNode(true) - newNode.querySelectorAll('.CodeMirror-line > span > span').forEach(encodeTextNode) + newNode.querySelectorAll('.CodeMirror-line span[role="presentation"]').forEach(encodeTextNode) newNode.style.visibility = 'hidden' document.body.appendChild(newNode) @@ -172,8 +172,8 @@ class Editor extends React.Component { } if ( isPNG && // only occurs when saving PNG - n.className && - n.className.startsWith('cm-') // is CodeMirror primitive string + n.matches && + n.matches('span[role="presentation"]') ) { encodeTextNode(n) }