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: Improve export PDF window https://github.com/siyuan-note/siyuan/issues/10711
Danielbdbd7e13c93a
diff --git a/app/electron/main.js b/app/electron/main.jsindex a815dd0b71..5fa46356a9 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -855,19 +855,32 @@ app.whenReady().then(() => {}data.filePaths = result.filePaths;data.webContentsId = event.sender.id;- getWindowByContentId(event.sender.id).getParentWindow().send("siyuan-export-pdf", data);+ const wnd = getWindowByContentId(event.sender.id);+ if (!wnd) {+ // 文档已经被删除的情况下关闭窗口,下同+ event.sender.destroy();+ return;+ }+ const parentWnd = wnd.getParentWindow();+ if (!parentWnd) {+ event.sender.destroy();+ return;+ }+ parentWnd.send("siyuan-export-pdf", data);});});ipcMain.on("siyuan-export-newwindow", (event, data) => {const parentWnd = getWindowByContentId(event.sender.id);+ const parentWndBounds = parentWnd.getBounds();+ const parentWndScreen = screen.getDisplayNearestPoint({x: parentWndBounds.x, y: parentWndBounds.y});+ parentWndScreen.size.width;+// The PDF/Word export preview window automatically adjusts according to the size of the main window https://github.com/siyuan-note/siyuan/issues/10554const printWin = new BrowserWindow({- parent: parentWnd,- modal: false,show: true,- width: Math.floor(parentWnd.getBounds().width * 0.8),- height: Math.floor(parentWnd.getBounds().height * 0.8),- resizable: false,+ width: parentWndScreen.size.width * 0.9,+ height: parentWndScreen.size.height * 0.9,+ resizable: true,frame: "darwin" === process.platform,icon: path.join(appDir, "stage", "icon-large.png"),titleBarStyle: "hidden",diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex 782c678e93..56ec30365e 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -23,7 +23,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:}} else if (tempElement.content.querySelector("table")) {tempElement.content.querySelectorAll("tr").forEach(item => {- values.push([])+ values.push([]);Array.from(item.children).forEach(cell => {values[values.length - 1].push({text: {content: cell.textContent},@@ -50,7 +50,7 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:const avID = blockElement.dataset.avId;const id = blockElement.dataset.nodeId;let currentRowElement: Element;- const firstColIndex = cellElements[0].getAttribute("data-col-id")+ const firstColIndex = cellElements[0].getAttribute("data-col-id");values.find(rowItem => {if (!currentRowElement) {currentRowElement = cellElements[0].parentElement;@@ -63,9 +63,9 @@ const processAV = (range: Range, html: string, protyle: IProtyle, blockElement:let cellElement: HTMLElement;rowItem.find(cellValue => {if (!cellElement) {- cellElement = currentRowElement.querySelector(`.av__cell[data-col-id="${firstColIndex}"]`) as HTMLElement+ cellElement = currentRowElement.querySelector(`.av__cell[data-col-id="${firstColIndex}"]`) as HTMLElement;} else {- cellElement = cellElement.nextElementSibling as HTMLElement+ cellElement = cellElement.nextElementSibling as HTMLElement;}if (!cellElement.classList.contains("av__cell")) {return true;