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

Vanessa9e4516a48e27
diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts
index 3a8169f0be..396e1bc8aa 100644
--- a/app/src/protyle/render/av/asset.ts
+++ b/app/src/protyle/render/av/asset.ts
@@ -21,7 +21,7 @@ import {renameAsset} from "../../../editor/rename";
import * as dayjs from "dayjs";
import {getColId} from "./col";
import {getFieldIdByCellElement} from "./row";
-import {getCompressURL, removeCompressURL} from "../../../util/image";
+import {base64ToURL, getCompressURL, removeCompressURL} from "../../../util/image";
import {confirmDialog} from "../../../dialog/confirmDialog";
import {filesize} from "filesize";
@@ -201,11 +201,17 @@ export const editAssetItem = (options: {
}) => {
const linkAddress = removeCompressURL(options.content);
const type = options.type as "image" | "file";
- const menu = new Menu(Constants.MENU_AV_ASSET_EDIT, () => {
- if ((!textElements[1] && textElements[0].value === linkAddress) ||
- (textElements[1] && textElements[0].value === linkAddress && textElements[1].value === options.name)) {
+ const menu = new Menu(Constants.MENU_AV_ASSET_EDIT, async () => {
+ let currentLink = textElements[0].value;
+ if ((!textElements[1] && currentLink === linkAddress) ||
+ (textElements[1] && currentLink === linkAddress && textElements[1].value === options.name)) {
return;
}
+ if (type === "image" && currentLink.startsWith("data:image/")) {
+ const base64Src = await base64ToURL([currentLink]);
+ currentLink = base64Src[0];
+ }
+
updateAssetCell({
protyle: options.protyle,
cellElements: options.cellElements,
@@ -213,7 +219,7 @@ export const editAssetItem = (options: {
updateValue: {
index: options.index,
value: {
- content: textElements[0].value,
+ content: currentLink,
name: textElements[1] ? textElements[1].value : "",
type
}