Vanessa 2025-05-20 10:01:25 +08:00
parent 4264d0d193
commit b3764d6a20
4 changed files with 10 additions and 5 deletions

View file

@ -58,10 +58,11 @@ export const previewDocImage = (currentSrc: string, id: string) => {
}); });
}; };
export const previewAttrViewImages = (currentSrc: string, avID: string, viewID: string) => { export const previewAttrViewImages = (currentSrc: string, avID: string, viewID: string, query: string) => {
fetchPost("/api/av/getCurrentAttrViewImages", { fetchPost("/api/av/getCurrentAttrViewImages", {
id: avID, id: avID,
viewID: viewID viewID,
query,
}, (response) => { }, (response) => {
previewImages(response.data, currentSrc); previewImages(response.data, currentSrc);
}); });

View file

@ -68,6 +68,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
(imgElement as HTMLImageElement).src, (imgElement as HTMLImageElement).src,
blockElement.getAttribute("data-av-id"), blockElement.getAttribute("data-av-id"),
blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW), blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW),
(blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement)?.value.trim() || ""
); );
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();

View file

@ -341,7 +341,8 @@ export const editAssetItem = (options: {
previewAttrViewImages( previewAttrViewImages(
linkAddress, linkAddress,
options.blockElement.getAttribute("data-av-id"), options.blockElement.getAttribute("data-av-id"),
options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW),
(options.blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement)?.value.trim() || ""
); );
} }
}); });

View file

@ -1259,13 +1259,15 @@ export const openMenuPanel = (options: {
)) { )) {
openAsset(options.protyle.app, assetLink.trim(), parseInt(getSearch("page", assetLink)), "right"); openAsset(options.protyle.app, assetLink.trim(), parseInt(getSearch("page", assetLink)), "right");
} else if (Constants.SIYUAN_ASSETS_IMAGE.includes(suffix)) { } else if (Constants.SIYUAN_ASSETS_IMAGE.includes(suffix)) {
previewAttrViewImages(assetLink, avID, options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW)); previewAttrViewImages(assetLink, avID, options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW),
(options.blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement)?.value.trim() || "");
} else { } else {
window.open(assetLink); window.open(assetLink);
} }
/// #else /// #else
if (Constants.SIYUAN_ASSETS_IMAGE.includes(suffix)) { if (Constants.SIYUAN_ASSETS_IMAGE.includes(suffix)) {
previewAttrViewImages(assetLink, avID, options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW)); previewAttrViewImages(assetLink, avID, options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW),
(options.blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement)?.value.trim() || "");
} else { } else {
window.open(assetLink); window.open(assetLink);
} }