This commit is contained in:
Vanessa 2023-05-22 22:08:01 +08:00
parent e5641b1d39
commit 0d1868fe3a
22 changed files with 81 additions and 61 deletions

View file

@ -28,7 +28,7 @@ export const afterExport = (exportPath: string, msgId: string) => {
export const exportImage = (id: string) => {
const exportDialog = new Dialog({
title: window.siyuan.languages.exportAsImage,
content: `<div class="b3-dialog__content" style="max-height: 70vh;overflow: auto;${isMobile() ? "padding:8px;" : ""};background-color: var(--b3-theme-background)">
content: `<div class="b3-dialog__content" style="${isMobile() ? "padding:8px;" : ""};background-color: var(--b3-theme-background)">
<div style="${isMobile() ? "padding: 16px;margin: 16px 0" : "padding: 48px;margin: 8px 0 24px"};border: 1px solid var(--b3-border-color);border-radius: 10px;" class="export-img protyle-wysiwyg${window.siyuan.config.editor.displayBookmarkIcon ? " protyle-wysiwyg--attr" : ""}" id="preview"></div>
<div class="fn__hr--b"></div>
<div class="fn__hr--b"></div>
@ -45,6 +45,7 @@ export const exportImage = (id: string) => {
</div>
<div class="fn__loading"><img height="128px" width="128px" src="stage/loading-pure.svg"></div>`,
width: isMobile() ? "92vw" : "990px",
height: "70vh"
});
const btnsElement = exportDialog.element.querySelectorAll(".b3-button");
btnsElement[0].addEventListener("click", () => {
@ -52,7 +53,7 @@ export const exportImage = (id: string) => {
});
btnsElement[1].addEventListener("click", () => {
const msgId = showMessage(window.siyuan.languages.exporting, 0);
previewElement.parentElement.style.maxHeight = "none";
(exportDialog.element.querySelector(".b3-dialog__container") as HTMLElement).style.height = "";
setStorageVal(Constants.LOCAL_EXPORTIMG, window.siyuan.storage[Constants.LOCAL_EXPORTIMG]);
setTimeout(() => {
addScript("stage/protyle/js/html2canvas.min.js?v=1.4.1", "protyleHtml2canvas").then(() => {