fix encoding issue for plain text

- Closes #569
- Opens #564
main
Mike Fix 6 years ago
parent 246a2f648f
commit f184e711c1

@ -149,7 +149,7 @@ class Editor extends React.Component {
if (isPNG) { if (isPNG) {
const newNode = node.cloneNode(true) 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' newNode.style.visibility = 'hidden'
document.body.appendChild(newNode) document.body.appendChild(newNode)
@ -172,8 +172,8 @@ class Editor extends React.Component {
} }
if ( if (
isPNG && // only occurs when saving PNG isPNG && // only occurs when saving PNG
n.className && n.matches &&
n.className.startsWith('cm-') // is CodeMirror primitive string n.matches('span[role="presentation"]')
) { ) {
encodeTextNode(n) encodeTextNode(n)
} }

Loading…
Cancel
Save