Skip to content

Commit

Permalink
fix: #1001 导出长图时展开所有代码块
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsonliu committed Dec 17, 2024
1 parent fdedb93 commit 3aff0c0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3aff0c0

Please sign in to comment.