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/9497
Vanessabab0e764e251
diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.tsindex f55ee72061..2766f12124 100644--- a/app/src/menus/commonMenuItem.ts+++ b/app/src/menus/commonMenuItem.ts@@ -431,7 +431,7 @@ export const copySubMenu = (id: string, accelerator = true, focusElement?: Eleme}];};-export const exportMd = (id: string, fileType = "NodeDocument") => {+export const exportMd = (id: string) => {return new MenuItem({label: window.siyuan.languages.export,type: "submenu",@@ -532,7 +532,7 @@ export const exportMd = (id: string, fileType = "NodeDocument") => {label: window.siyuan.languages.image,icon: "iconImage",click: () => {- exportImage(id, fileType);+ exportImage(id);}},/// #if !BROWSER@@ -540,26 +540,26 @@ export const exportMd = (id: string, fileType = "NodeDocument") => {label: "PDF",icon: "iconPDF",click: () => {- saveExport({type: "pdf", id, fileType});+ saveExport({type: "pdf", id});}}, {label: "HTML (SiYuan)",iconClass: "ft__error",icon: "iconHTML5",click: () => {- saveExport({type: "html", id, fileType});+ saveExport({type: "html", id});}}, {label: "HTML (Markdown)",icon: "iconHTML5",click: () => {- saveExport({type: "htmlmd", id, fileType});+ saveExport({type: "htmlmd", id});}}, {label: "Word .docx",icon: "iconExact",click: () => {- saveExport({type: "word", id, fileType});+ saveExport({type: "word", id});}}, {label: window.siyuan.languages.more,diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.tsindex fa0f1c9eed..38ed69079e 100644--- a/app/src/protyle/export/index.ts+++ b/app/src/protyle/export/index.ts@@ -19,10 +19,10 @@ export const saveExport = (option: IExportOptions) => {if (option.type === "pdf") {if (window.siyuan.config.appearance.mode === 1) {confirmDialog(window.siyuan.languages.pdfTip, window.siyuan.languages.pdfConfirm, () => {- renderPDF(option.id, option.fileType);+ renderPDF(option.id);});} else {- renderPDF(option.id, option.fileType);+ renderPDF(option.id);}} else if (option.type === "word") {const localData = window.siyuan.storage[Constants.LOCAL_EXPORTWORD];@@ -69,7 +69,7 @@ export const saveExport = (option: IExportOptions) => {};/// #if !BROWSER-const renderPDF = (id: string, fileType: string) => {+const renderPDF = (id: string) => {const localData = window.siyuan.storage[Constants.LOCAL_EXPORTPDF];const servePath = window.location.protocol + "//" + window.location.host;const isDefault = (window.siyuan.config.appearance.mode === 1 && window.siyuan.config.appearance.themeDark === "midnight") || (window.siyuan.config.appearance.mode === 0 && window.siyuan.config.appearance.themeLight === "daylight");@@ -244,7 +244,6 @@ const renderPDF = (id: string, fileType: string) => {</div></div><div style="zoom:${localData.scale || 1}" class="protyle-wysiwyg${window.siyuan.config.editor.displayBookmarkIcon ? " protyle-wysiwyg--attr" : ""}"-data-doc-type="${fileType}"id="preview"><div class="fn__loading" style="left:0"><img width="48px" src="${servePath}/stage/loading-pure.svg"></div></div>@@ -359,8 +358,21 @@ id="preview">cb(response);})}- const renderPreview = (html) => {- previewElement.innerHTML = html;+ const renderPreview = (data) => {+ previewElement.innerHTML = data.content;+ previewElement.setAttribute("data-doc-type", data.type || "NodeDocument");+ if (data.attrs.memo) {+ previewElement.setAttribute("memo", data.attrs.memo);+ }+ if (data.attrs.name) {+ previewElement.setAttribute("name", data.attrs.name);+ }+ if (data.attrs.bookmark) {+ previewElement.setAttribute("bookmark", data.attrs.bookmark);+ }+ if (data.attrs.alias) {+ previewElement.setAttribute("alias", data.attrs.alias);+ }Protyle.mermaidRender(previewElement, "${servePath}/stage/protyle");Protyle.flowchartRender(previewElement, "${servePath}/stage/protyle");Protyle.graphvizRender(previewElement, "${servePath}/stage/protyle");@@ -439,7 +451,7 @@ id="preview">return;}setPadding();- renderPreview(response2.data.content);+ renderPreview(response2.data);})};@@ -510,7 +522,7 @@ id="preview">actionElement.remove();});setPadding();- renderPreview(response.data.content);+ renderPreview(response.data);});</script></body></html>`;fetchPost("/api/export/exportTempContent", {content: html}, (response) => {diff --git a/app/src/protyle/export/util.ts b/app/src/protyle/export/util.tsindex 6663a884c4..901c79d41d 100644--- a/app/src/protyle/export/util.ts+++ b/app/src/protyle/export/util.ts@@ -25,13 +25,12 @@ export const afterExport = (exportPath: string, msgId: string) => {/// #endif};-export const exportImage = (id: string, fileType:string) => {+export const exportImage = (id: string) => {const exportDialog = new Dialog({title: window.siyuan.languages.exportAsImage,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: var(--b3-border-radius-b);"class="export-img protyle-wysiwyg${window.siyuan.config.editor.displayBookmarkIcon ? " protyle-wysiwyg--attr" : ""}"-data-doc-type="${fileType}"id="preview"></div><div class="fn__hr--b"></div><div class="fn__hr--b"></div>@@ -92,6 +91,19 @@ id="preview"></div>});const refreshPreview = (response: IWebSocketData) => {previewElement.innerHTML = response.data.content;+ previewElement.setAttribute("data-doc-type", response.data.type || "NodeDocument");+ if (response.data.attrs.memo) {+ previewElement.setAttribute("memo", response.data.attrs.memo);+ }+ if (response.data.attrs.name) {+ previewElement.setAttribute("name", response.data.attrs.name);+ }+ if (response.data.attrs.bookmark) {+ previewElement.setAttribute("bookmark", response.data.attrs.bookmark);+ }+ if (response.data.attrs.alias) {+ previewElement.setAttribute("alias", response.data.attrs.alias);+ }processRender(previewElement);highlightRender(previewElement);previewElement.querySelectorAll("table").forEach((item: HTMLElement) => {diff --git a/app/src/protyle/header/openTitleMenu.ts b/app/src/protyle/header/openTitleMenu.tsindex a544e36eb7..c4a4fcb464 100644--- a/app/src/protyle/header/openTitleMenu.ts+++ b/app/src/protyle/header/openTitleMenu.ts@@ -230,7 +230,7 @@ export const openTitleMenu = (protyle: IProtyle, position: IPosition) => {}).element);}genImportMenu(protyle.notebookId, protyle.path);- window.siyuan.menus.menu.append(exportMd(protyle.block.showAll ? protyle.block.id : protyle.block.rootID, protyle.wysiwyg.element.getAttribute("data-doc-type")));+ window.siyuan.menus.menu.append(exportMd(protyle.block.showAll ? protyle.block.id : protyle.block.rootID));if (protyle?.app?.plugins) {emitOpenMenu({diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex b32ee4cb60..ae8eb46092 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -501,7 +501,6 @@ interface IPluginDockTab {interface IExportOptions {type: string,id: string,- fileType: string}interface IOpenFileOptions {