Optimize attributeView image browsing (#14843)

This commit is contained in:
Jiangshuon 2025-05-18 11:31:22 +08:00 committed by GitHub
parent b06cee76f8
commit 2b03a364af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 169 additions and 8 deletions

View file

@ -18,7 +18,7 @@ import {getSearch} from "../../../util/functions";
/// #if !MOBILE
import {openAsset} from "../../../editor/util";
/// #endif
import {previewImage} from "../../preview/image";
import {previewAttrViewImages} from "../../preview/image";
import {assetMenu} from "../../../menus/protyle";
import {addView, bindSwitcherEvent, bindViewEvent, getSwitcherHTML, getViewHTML, openViewMenu} from "./view";
import {focusBlock} from "../../util/selection";
@ -1259,13 +1259,22 @@ export const openMenuPanel = (options: {
)) {
openAsset(options.protyle.app, assetLink.trim(), parseInt(getSearch("page", assetLink)), "right");
} else if (Constants.SIYUAN_ASSETS_IMAGE.includes(suffix)) {
previewImage(assetLink);
previewAttrViewImages(assetLink,avID,
options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW),
(options.blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement)?.value.trim() || "",
parseInt(options.blockElement.getAttribute("data-page-size")) || undefined
)
} else {
window.open(assetLink);
}
/// #else
if (Constants.SIYUAN_ASSETS_IMAGE.includes(suffix)) {
previewImage(assetLink);
previewAttrViewImages(assetLink,avID,
options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW),
(options.blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement)?.value.trim() || "",
parseInt(options.blockElement.getAttribute("data-page-size")) || undefined
)
} else {
window.open(assetLink);
}