mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-26 02:06:10 +01:00
Optimize attributeView image browsing (#14843)
This commit is contained in:
parent
b06cee76f8
commit
2b03a364af
7 changed files with 169 additions and 8 deletions
|
|
@ -21,7 +21,7 @@ import {openMenuPanel} from "./openMenuPanel";
|
|||
import {hintRef} from "../../hint/extend";
|
||||
import {focusBlock, focusByRange} from "../../util/selection";
|
||||
import {showMessage} from "../../../dialog/message";
|
||||
import {previewImage} from "../../preview/image";
|
||||
import {previewAttrViewImages} from "../../preview/image";
|
||||
import {openEmojiPanel, unicode2Emoji} from "../../../emoji";
|
||||
import * as dayjs from "dayjs";
|
||||
import {openCalcMenu} from "./calc";
|
||||
|
|
@ -64,7 +64,13 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
|||
}
|
||||
const imgElement = hasClosestByClassName(event.target, "av__cellassetimg");
|
||||
if (imgElement) {
|
||||
previewImage((imgElement as HTMLImageElement).src);
|
||||
previewAttrViewImages(
|
||||
(imgElement as HTMLImageElement).src,
|
||||
blockElement.getAttribute("data-av-id"),
|
||||
blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW),
|
||||
(blockElement.querySelector('[data-type="av-search"]') as HTMLInputElement)?.value.trim() || "",
|
||||
parseInt(blockElement.dataset.pageSize) || undefined
|
||||
);
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {openMenu} from "../../../menus/commonMenuItem";
|
|||
import {MenuItem} from "../../../menus/Menu";
|
||||
import {copyPNGByLink, exportAsset} from "../../../menus/util";
|
||||
import {setPosition} from "../../../util/setPosition";
|
||||
import {previewImage} from "../../preview/image";
|
||||
import {previewAttrViewImages} from "../../preview/image";
|
||||
import {genAVValueHTML} from "./blockAttr";
|
||||
import {hideMessage, showMessage} from "../../../dialog/message";
|
||||
import {fetchPost} from "../../../util/fetch";
|
||||
|
|
@ -338,8 +338,13 @@ export const editAssetItem = (options: {
|
|||
icon: "iconPreview",
|
||||
label: window.siyuan.languages.cardPreview,
|
||||
click() {
|
||||
previewImage(linkAddress);
|
||||
}
|
||||
previewAttrViewImages(
|
||||
linkAddress,
|
||||
options.blockElement.getAttribute("data-av-id"),
|
||||
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
|
||||
)}
|
||||
});
|
||||
}
|
||||
if (openSubMenu.length > 0) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue