mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-28 20:38:49 +01:00
This commit is contained in:
parent
b3b1f3e6a5
commit
a5dcf0827f
1 changed files with 8 additions and 0 deletions
|
|
@ -19,6 +19,14 @@ export const previewImage = (src: string, id: string) => {
|
|||
imagesElement.innerHTML = html;
|
||||
// @ts-ignore
|
||||
const viewer = new Viewer(imagesElement, {
|
||||
title: [1, (image: HTMLImageElement, imageData: IObject) => {
|
||||
let name = image.alt;
|
||||
if (!name) {
|
||||
name = image.src.substring(image.src.lastIndexOf("/") + 1);
|
||||
}
|
||||
name = name.substring(0, name.lastIndexOf(".")).replace(/-\d{14}-\w{7}$/, "");
|
||||
return `${name} [${imageData.naturalWidth} × ${imageData.naturalHeight}]`;
|
||||
}],
|
||||
button: false,
|
||||
initialViewIndex,
|
||||
transition: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue