Skip to content

Commit

Permalink
fix: 导出时处理懒加载的图片 close #504
Browse files Browse the repository at this point in the history
  • Loading branch information
sunsonliu committed Jul 27, 2023
1 parent 8fdaf6a commit 8a26cda
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/toolbars/hooks/Export.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@ export default class Export extends MenuBase {
/** @type {HTMLElement}*/ (document.querySelector('.cherry-dropdown[name=export]')).style.display = 'none';
}
// 强制刷新一下预览区域的内容
if (this.editor.previewer.isPreviewerHidden()) {
this.$cherry.refreshPreviewer();
const { previewer } = this.$cherry;
let html = '';
if (previewer.isPreviewerHidden()) {
html = previewer.options.previewerCache.html;
} else {
html = previewer.getDomContainer().innerHTML;
}
this.editor.previewer.export(type);
// 需要未加载的图片替换成原始图片
html = previewer.lazyLoadImg.changeDataSrc2Src(html);
previewer.refresh(html);
previewer.export(type);
}
}

0 comments on commit 8a26cda

Please sign in to comment.