Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14161

Vanessaa4df630b7797
diff --git a/app/src/protyle/export/util.ts b/app/src/protyle/export/util.ts
index eba45bdcf8..1f5f4e085d 100644
--- a/app/src/protyle/export/util.ts
+++ b/app/src/protyle/export/util.ts
@@ -10,7 +10,7 @@ import {isMobile} from "../../util/functions";
import {Constants} from "../../constants";
import {highlightRender} from "../render/highlightRender";
import {processRender} from "../util/processCode";
-import {openByMobile, setStorageVal} from "../util/compatibility";
+import {isIPhone, isSafari, openByMobile, setStorageVal} from "../util/compatibility";
import {showFileInFolder} from "../../util/pathName";
import {isPaidUser} from "../../util/needSubscribe";
@@ -64,17 +64,22 @@ export const exportImage = (id: string) => {
(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/html-to-image.min.js?v=1.11.13", "protyleHtml2image").then(() => {
- window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content")).then((blob) => {
- const formData = new FormData();
- formData.append("file", blob, btnsElement[1].getAttribute("data-title"));
- formData.append("type", "image/png");
- fetchPost("/api/export/exportAsFile", formData, (response) => {
- openByMobile(response.data.file);
- });
- hideMessage(msgId);
- exportDialog.destroy();
+ addScript("/stage/protyle/js/html-to-image.min.js?v=1.11.13", "protyleHtml2image").then(async () => {
+ let blob = await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
+ if (isIPhone() || isSafari()) {
+ await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
+ await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
+ await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
+ blob = await window.htmlToImage.toBlob(exportDialog.element.querySelector(".b3-dialog__content"))
+ }
+ const formData = new FormData();
+ formData.append("file", blob, btnsElement[1].getAttribute("data-title"));
+ formData.append("type", "image/png");
+ fetchPost("/api/export/exportAsFile", formData, (response) => {
+ openByMobile(response.data.file);
});
+ hideMessage(msgId);
+ exportDialog.destroy();
});
}, Constants.TIMEOUT_LOAD);
});
diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.ts
index 20c750d46a..9e3a001beb 100644
--- a/app/src/protyle/util/compatibility.ts
+++ b/app/src/protyle/util/compatibility.ts
@@ -180,6 +180,11 @@ export const isIPhone = () => {
return navigator.userAgent.indexOf("iPhone") > -1;
};
+export const isSafari = () => {
+ const userAgent = navigator.userAgent;
+ return userAgent.includes("Safari") && !userAgent.includes("Chrome") && !userAgent.includes("Chromium");
+};
+
export const isIPad = () => {
return navigator.userAgent.indexOf("iPad") > -1;
};