Skip to content

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

:art: Internet images cannot be exported https://github.com/siyuan-note/siyuan/issues/11231

Danieldc8744a6cef3
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index e5b9698280..00487bc5b1 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -1303,7 +1303,10 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
openMenu(protyle.app, imgSrc, false, false);
}
- window.siyuan.menus.menu.append(new MenuItem(exportAsset(imgElement.getAttribute("data-src"))).element);
+ const dataSrc = imgElement.getAttribute("data-src");
+ if (dataSrc && dataSrc.startsWith("assets/")) {
+ window.siyuan.menus.menu.append(new MenuItem(exportAsset(dataSrc)).element);
+ }
if (protyle?.app?.plugins) {
emitOpenMenu({
plugins: protyle.app.plugins,
@@ -1935,7 +1938,7 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
}
}];
const src = videoElement.getAttribute("src");
- if (src.startsWith("assets/")) {
+ if (src && src.startsWith("assets/")) {
subMenus.push({
type: "separator"
});
@@ -1948,16 +1951,17 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
}
});
}
- const VideoSrc = videoElement.getAttribute("src");
- if (VideoSrc) {
+ if (src) {
subMenus.push({
id: "openBy",
label: window.siyuan.languages.openBy,
icon: "iconOpen",
- submenu: openMenu(protyle.app, VideoSrc, true, false) as IMenu[]
+ submenu: openMenu(protyle.app, src, true, false) as IMenu[]
});
}
- subMenus.push(exportAsset(src));
+ if (src && src.startsWith("assets/")) {
+ subMenus.push(exportAsset(src));
+ }
return subMenus;
};