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

Vanessac90801cfdd60
diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts
index 1de4356787..0af4a62240 100644
--- a/app/src/protyle/render/av/asset.ts
+++ b/app/src/protyle/render/av/asset.ts
@@ -17,6 +17,7 @@ import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
import {genCellValueByElement, getTypeByCellElement} from "./cell";
import {writeText} from "../../util/compatibility";
import {escapeAttr} from "../../../util/escape";
+import {renameAsset} from "../../../editor/rename";
export const bindAssetEvent = (options: {
protyle: IProtyle,
@@ -224,13 +225,6 @@ ${window.siyuan.languages.title}
label: `${window.siyuan.languages.link}
<textarea rows="1" style="margin:4px 0;width: ${isMobile() ? "200" : "360"}px;resize: vertical;" class="b3-text-field"></textarea>`,
});
- menu.addItem({
- icon: "iconPreview",
- label: window.siyuan.languages.cardPreview,
- click() {
- previewImage(linkAddress);
- }
- });
menu.addItem({
label: window.siyuan.languages.copy,
icon: "iconCopy",
@@ -245,7 +239,6 @@ ${window.siyuan.languages.title}
copyPNGByLink(linkAddress);
}
});
- menu.addSeparator();
}
menu.addItem({
icon: "iconTrashcan",
@@ -259,6 +252,24 @@ ${window.siyuan.languages.title}
});
}
});
+ menu.addItem({
+ label: window.siyuan.languages.rename,
+ icon: "iconEdit",
+ click() {
+ renameAsset(linkAddress);
+ document.querySelector(".av__panel")?.remove();
+ }
+ });
+ menu.addSeparator();
+ if (type !== "file") {
+ menu.addItem({
+ icon: "iconPreview",
+ label: window.siyuan.languages.cardPreview,
+ click() {
+ previewImage(linkAddress);
+ }
+ });
+ }
openMenu(options.protyle ? options.protyle.app : window.siyuan.ws.app, linkAddress, false, false);
if (linkAddress?.startsWith("assets/")) {
window.siyuan.menus.menu.append(new MenuItem(exportAsset(linkAddress)).element);