From 3aff0c0cc911b059208ef612cb33ef741b72cd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sunsonliu=28=E5=88=98=E9=98=B3=29?= Date: Tue, 17 Dec 2024 14:51:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#1001=20=E5=AF=BC=E5=87=BA=E9=95=BF?= =?UTF-8?q?=E5=9B=BE=E6=97=B6=E5=B1=95=E5=BC=80=E6=89=80=E6=9C=89=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/export.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/export.js b/src/utils/export.js index de4c98dc..3c2cec87 100644 --- a/src/utils/export.js +++ b/src/utils/export.js @@ -92,6 +92,11 @@ export function exportPDF(previewDom, fileName) { const oldTitle = document.title; document.title = fileName; getReadyToExport(previewDom, (/** @type {HTMLElement}*/ cherryPreviewer, /** @type {function}*/ thenFinish) => { + // 强制展开所有代码块 + cherryPreviewer.innerHTML = cherryPreviewer.innerHTML.replace( + /class="cherry-code-unExpand("| )/g, + 'class="cherry-code-expand$1', + ); window.print(); thenFinish(); document.title = oldTitle;