An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/6349
Vanessa1abb0843b586
diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.tsindex 925c6051a0..7bb9bb9265 100644--- a/app/src/protyle/export/index.ts+++ b/app/src/protyle/export/index.ts@@ -61,6 +61,7 @@ export const saveExport = (option: { type: string, id: string }) => {};/// #if !BROWSER+let originalZoomFactor = 1;const renderPDF = (id: string) => {const localData = JSON.parse(localStorage.getItem(Constants.LOCAL_EXPORTPDF) || JSON.stringify({landscape: false,@@ -371,12 +372,13 @@ const renderPDF = (id: string) => {});</script></body></html>`;const mainWindow = getCurrentWindow();- const mainWindowZoomFactor = mainWindow.webContents.getZoomFactor();+ originalZoomFactor = mainWindow.webContents.zoomFactor;window.siyuan.printWin = new BrowserWindow({parent: mainWindow,modal: true,show: true,width: 1032,+ height: 618,resizable: false,frame: "darwin" === window.siyuan.config.system.os,icon: path.join(window.siyuan.config.system.appDir, "stage", "icon-large.png"),@@ -393,12 +395,16 @@ const renderPDF = (id: string) => {// 导出 PDF 预览界面不受主界面缩放影响 https://github.com/siyuan-note/siyuan/issues/6262window.siyuan.printWin.webContents.setZoomFactor(1);});- window.siyuanfetchPost("/api/export/exportTempContent", {content: html}, (response) => {window.siyuan.printWin.loadURL(response.data.url);});};+export const destroyPrintWindow = () => {+ getCurrentWindow().webContents.setZoomFactor(originalZoomFactor);+ window.siyuan.printWin.destroy();+};+const getExportPath = (option: { type: string, id: string }, removeAssets?: boolean) => {fetchPost("/api/block/getBlockInfo", {id: option.iddiff --git a/app/src/protyle/wysiwyg/getBlock.ts b/app/src/protyle/wysiwyg/getBlock.tsindex 6386035636..3a8f34daab 100644--- a/app/src/protyle/wysiwyg/getBlock.ts+++ b/app/src/protyle/wysiwyg/getBlock.ts@@ -96,7 +96,7 @@ export const getTopEmptyElement = (element: Element) => {if (!topElement.parentElement.getAttribute("data-node-id")) {topElement = topElement.parentElement;} else {- let hasText = false+ let hasText = false;Array.from(topElement.parentElement.querySelectorAll('[contenteditable="true"]')).find(item => {if (item.textContent.replace(Constants.ZWSP, "").replace("\n", "") !== "") {hasText = true;diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.tsindex f95251e002..74c8f4af5c 100644--- a/app/src/util/onGetConfig.ts+++ b/app/src/util/onGetConfig.ts@@ -28,6 +28,7 @@ import {showMessage} from "../dialog/message";import {replaceLocalPath} from "../editor/rename";import {editor} from "../config/editor";import {goBack, goForward} from "./backForward";+import {destroyPrintWindow} from "../protyle/export";const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {if (key1 === "general") {@@ -381,7 +382,7 @@ const initWindow = () => {winOnClose(currentWindow, close);});ipcRenderer.on(Constants.SIYUAN_EXPORT_CLOSE, () => {- window.siyuan.printWin.destroy();+ destroyPrintWindow();});ipcRenderer.on(Constants.SIYUAN_EXPORT_PDF, (e, ipcData) => {dialog.showOpenDialog({@@ -389,7 +390,7 @@ const initWindow = () => {properties: ["createDirectory", "openDirectory"],}).then((result: OpenDialogReturnValue) => {if (result.canceled) {- window.siyuan.printWin.destroy();+ destroyPrintWindow();return;}const msgId = showMessage(window.siyuan.languages.exporting, -1);@@ -405,7 +406,7 @@ const initWindow = () => {}, () => {const pdfFilePath = path.join(filePath, path.basename(filePath) + ".pdf");fs.writeFileSync(pdfFilePath, pdfData);- window.siyuan.printWin.destroy();+ destroyPrintWindow();fetchPost("/api/export/addPDFOutline", {id: ipcData.rootId,path: pdfFilePath@@ -437,11 +438,11 @@ const initWindow = () => {});}).catch((error: string) => {showMessage("Export PDF error:" + error, 0, "error", msgId);- window.siyuan.printWin.destroy();+ destroyPrintWindow();});} catch (e) {showMessage("Export PDF failed: " + e, 0, "error", msgId);- window.siyuan.printWin.destroy();+ destroyPrintWindow();}window.siyuan.printWin.hide();});