From 8629a8ef78ee4836f54ee4eabf4e5797c6767a2a Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Wed, 14 Nov 2018 17:04:52 -0800 Subject: [PATCH] Revert "sync up api image handler filter with ExportContainer" This reverts commit 543df74ead996e878f4e4eae7b0e31f6d8e82f08. --- api/handlers/image.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/api/handlers/image.js b/api/handlers/image.js index f744d0d..1b4cbab 100644 --- a/api/handlers/image.js +++ b/api/handlers/image.js @@ -16,12 +16,6 @@ module.exports = browser => async (req, res) => { const targetElement = await page.$('.export-container') - targetElement.querySelectorAll('span[role="presentation"]').forEach(node => { - if (node.innerText && node.innerText.match(/%\d\S/)) { - node.innerText = encodeURIComponent(node.innerText) - } - }) - const dataUrl = await page.evaluate((target = document) => { const config = { style: { @@ -29,6 +23,15 @@ module.exports = browser => async (req, res) => { 'transform-origin': 'center' }, filter: n => { + // %[00 -> 19] cause failures + if ( + n.innerText && + node.innerText.match(/%\d\S/) && + n.className && + n.className.startsWith('cm-') // is CodeMirror primitive string + ) { + n.innerText = encodeURIComponent(n.innerText) + } if (n.className) { return String(n.className).indexOf('eliminateOnRender') < 0 }