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

Vanessa1d4948a14659
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index b7adb2b180..a95de991d9 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -510,7 +510,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
- const imagePath = imgElement.getAttribute("data-src")
+ const imagePath = imgElement.getAttribute("data-src")
if (imagePath.startsWith("assets/")) {
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.rename,
@@ -690,6 +690,14 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
protyle.toolbar.setInlineMark(protyle, "link", "remove");
}
}).element);
+ if (linkAddress.startsWith("assets/")) {
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.rename,
+ click() {
+ renameAsset(linkAddress);
+ }
+ }).element);
+ }
if (linkAddress?.startsWith("siyuan://blocks/")) {
window.siyuan.menus.menu.append(new MenuItem({
icon: "iconRefresh",
@@ -808,6 +816,15 @@ export const videoMenu = (protyle: IProtyle, nodeElement: Element, type: string)
}, {
type: "separator"
}];
+ const src = videoElement.getAttribute("src")
+ if (src.startsWith("assets/")) {
+ subMenus.push({
+ label: window.siyuan.languages.rename,
+ click() {
+ renameAsset(src);
+ }
+ })
+ }
return subMenus.concat(openMenu(videoElement.getAttribute("src"), true) as IMenu[]);
};