fix issue from encoding breaking html highlighting after save

Closes #749
main
Mike Fix 6 years ago
parent f556a6246e
commit 29072fce92

@ -137,14 +137,14 @@ class Editor extends React.Component {
const map = new Map() const map = new Map()
const undoMap = value => { const undoMap = value => {
map.forEach((value, node) => (node.innerText = value)) map.forEach((value, node) => (node.innerHTML = value))
return value return value
} }
if (isPNG) { if (isPNG) {
node.querySelectorAll('span[role="presentation"]').forEach(node => { node.querySelectorAll('span[role="presentation"]').forEach(node => {
if (node.innerText && node.innerText.match(/%[A-Za-z0-9]{2}/)) { if (node.innerText && node.innerText.match(/%[A-Za-z0-9]{2}/)) {
map.set(node, node.innerText) map.set(node, node.innerHTML)
node.innerText.match(/%[A-Za-z0-9]{2}/g).forEach(t => { node.innerText.match(/%[A-Za-z0-9]{2}/g).forEach(t => {
node.innerText = node.innerText.replace(t, encodeURIComponent(t)) node.innerText = node.innerText.replace(t, encodeURIComponent(t))
}) })

Loading…
Cancel
Save