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/16152

Vanessa4aa2b6bdc9d8
diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts
index 7b62ba24bb..d0ee7c4696 100644
--- a/app/src/menus/commonMenuItem.ts
+++ b/app/src/menus/commonMenuItem.ts
@@ -752,7 +752,24 @@ export const exportMd = (id: string) => {
}
},
]
- }
+ },
+ /// #else
+ {
+ id: "exportPDF",
+ label: "PDF",
+ icon: "iconPDF",
+ ignore: !isInAndroid(),
+ click: () => {
+ const localData = window.siyuan.storage[Constants.LOCAL_EXPORTPDF];
+ fetchPost("/api/export/exportPreviewHTML", {
+ id: "${id}",
+ keepFold: localData.keepFold,
+ merge: localData.mergeSubdocs,
+ }, response => {
+ window.JSAndroid.exportPDF(response.data.content);
+ });
+ }
+ },
/// #endif
]
}).element;
diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts
index 7c3a927f3a..136544917b 100644
--- a/app/src/types/index.d.ts
+++ b/app/src/types/index.d.ts
@@ -245,6 +245,7 @@ interface Window {
readHTMLClipboard(): string
getBlockURL(): string
hideKeyboard(): void
+ exportPDF(html: string): void
};
JSHarmony: {
openExternal(url: string): void