This commit is contained in:
Devon22 2026-06-06 11:57:34 +08:00
parent b4d944562b
commit 945337d105
6 changed files with 14 additions and 8 deletions

3
.gitignore vendored
View file

@ -30,3 +30,6 @@ AGENTS.md
# Changelog
Changelog.md
# Code snippets
snippets/

View file

@ -1,7 +1,7 @@
{
"id": "mediaviewer",
"name": "Media Viewer",
"version": "2.1.4",
"version": "2.1.5",
"minAppVersion": "1.8.7",
"description": "View and manage media files within your notes.",
"author": "Devon22",

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "mediaviewer",
"version": "2.1.4",
"version": "2.1.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "mediaviewer",
"version": "2.1.4",
"version": "2.1.5",
"license": "MIT",
"devDependencies": {
"@types/node": "^16.11.6",

View file

@ -1,6 +1,6 @@
{
"name": "mediaviewer",
"version": "2.1.4",
"version": "2.1.5",
"description": "View and manage media files within your notes.",
"main": "main.js",
"scripts": {

View file

@ -1,4 +1,4 @@
import { App, TFile, Menu, Notice, Platform, Modal, Setting } from 'obsidian';
import { App, TFile, Menu, Notice, Platform, Modal, Setting } from 'obsidian';
import MediaViewPlugin from './main';
import { FullScreenModal } from './fullscreen';
import { MediaViewSettings } from './settings';
@ -1160,6 +1160,7 @@ export class GalleryBlock {
const img = activeDocument.createElement('img');
img.src = item.thumbnail;
img.className = 'mvgb-note-thumbnail-image';
img.toggleClass('is-pointer-disabled', Platform.isMobile);
notePreview.appendChild(img);
} else {
// 否則使用預設圖示
@ -1386,6 +1387,7 @@ export class GalleryBlock {
img.src = media.thumbnail;
img.alt = media.path || '';
img.className = 'mvgb-video-thumbnail';
img.toggleClass('is-pointer-disabled', Platform.isMobile);
container.appendChild(img);
} else {
const video = activeDocument.createElement('video');
@ -1417,6 +1419,7 @@ export class GalleryBlock {
img.src = media.thumbnail;
img.alt = media.path || '';
img.className = 'mvgb-video-thumbnail';
img.toggleClass('is-pointer-disabled', Platform.isMobile);
container.appendChild(img);
} else {
const audio = activeDocument.createElement('audio');
@ -1531,7 +1534,7 @@ export class GalleryBlock {
modal.open();
window.setTimeout(() => {
const allUrls = modal.mediaUrls;
const targetIndex = allUrls.findIndex(m => m.url === media.url);
const targetIndex = allUrls.findIndex(m => (media.path && m.path === media.path) || m.url === media.url);
if (targetIndex !== -1) {
void modal.showMedia(targetIndex);
}

View file

@ -917,8 +917,8 @@
.mvgb-btn-drag {
top: 8px;
left: 8px;
width: 28px;
height: 28px;
width: 32px;
height: 32px;
border-radius: 50%;
background: rgba(0, 0, 0, 0.55);
color: white;