From 9cd27e274e4c55a1f88e79d53bb87c21a9450efb Mon Sep 17 00:00:00 2001 From: "xiaoqi.cxq" Date: Fri, 30 Jun 2023 11:29:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=A0=87=E9=A2=98=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/services/exportSvc.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/services/exportSvc.js b/src/services/exportSvc.js index c7ad63cc..03507ed0 100644 --- a/src/services/exportSvc.js +++ b/src/services/exportSvc.js @@ -93,7 +93,7 @@ export default { // 替换相对路径图片为blob图片 const imgs = Array.prototype.slice.call(containerElt.getElementsByTagName('img')).map((imgElt) => { - let uri = imgElt.attributes && imgElt.attributes.href && imgElt.attributes.href.nodeValue; + let uri = imgElt.attributes && imgElt.attributes.src && imgElt.attributes.src.nodeValue; if (uri && uri.indexOf('http://') !== 0 && uri.indexOf('https://') !== 0) { uri = decodeURIComponent(uri); imgElt.removeAttribute('src'); @@ -116,7 +116,12 @@ export default { // Make TOC const allHeaders = containerElt.querySelectorAll('h1,h2,h3,h4,h5,h6'); Array.prototype.slice.call(allHeaders).forEach((headingElt) => { - headingElt.innerHTML = `${headingElt.innerHTML}`; + const prefixElt = document.createElement('span'); + prefixElt.className = 'prefix'; + headingElt.insertBefore(prefixElt, headingElt.firstChild); + const suffixElt = document.createElement('span'); + suffixElt.className = 'suffix'; + headingElt.appendChild(suffixElt); }); const headings = allHeaders.cl_map(headingElt => ({ title: headingElt.textContent,