mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-02 21:51:49 +01:00
This commit is contained in:
parent
1abeb6e41a
commit
9e4516a48e
1 changed files with 11 additions and 5 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue