mirror of
https://github.com/devon22/obsidian-mediaviewer.git
synced 2026-07-22 11:50:28 +00:00
1.9.6
This commit is contained in:
parent
dbb3160fa0
commit
27a5f08b35
6 changed files with 14 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "mediaviewer",
|
||||
"name": "Media Viewer",
|
||||
"version": "1.9.5",
|
||||
"version": "1.9.6",
|
||||
"minAppVersion": "1.1.0",
|
||||
"description": "View and manage media files within your notes.",
|
||||
"author": "Devon22",
|
||||
|
|
|
|||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mediaviewer",
|
||||
"version": "1.9.5",
|
||||
"version": "1.9.6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "mediaviewer",
|
||||
"version": "1.9.5",
|
||||
"version": "1.9.6",
|
||||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -110,12 +110,21 @@ export class FullScreenModal extends Modal {
|
|||
|
||||
if (url) {
|
||||
let type = 'image';
|
||||
const urlExtension = url.split('.').pop()?.toLowerCase(); // Get extension from URL
|
||||
|
||||
if (file) {
|
||||
const extension = file.extension.toLowerCase();
|
||||
if (!extension.match(/^(jpg|jpeg|png|gif|webp|mp4|mkv|mov|webm|flac|m4a|mp3|ogg|wav|3gp)$/)) {
|
||||
continue;
|
||||
}
|
||||
type = extension.match(/^(jpg|jpeg|png|gif|webp)$/) ? 'image' : 'video';
|
||||
} else if (urlExtension) { // If it's an external URL, check its extension
|
||||
if (urlExtension.match(/^(mp4|mkv|mov|webm|flac|m4a|mp3|ogg|wav|3gp)$/)) {
|
||||
type = 'video';
|
||||
} else if (!urlExtension.match(/^(jpg|jpeg|png|gif|webp)$/)) {
|
||||
// If the extension is not a known video or image type, skip it
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果這個 URL 已經存在,將新的連結文字加入到現有的列表中
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ export class GalleryBlock {
|
|||
// 如果找不到檔案,再嘗試直接用路徑查找
|
||||
const fileByPath = this.app.vault.getAbstractFileByPath(url);
|
||||
if (fileByPath && fileByPath instanceof TFile) {
|
||||
const extension = url.toLowerCase();
|
||||
const extension = fileByPath.extension.toLowerCase();
|
||||
items.push({
|
||||
type: extension.match(/\.(mp4|mkv|mov|webm|mp3|m4a|flac|ogg|wav|3gp)$/) ? 'video' : 'image',
|
||||
url: this.app.vault.getResourcePath(fileByPath),
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"1.9.5": "1.1.0"
|
||||
"1.9.6": "1.1.0"
|
||||
}
|
||||
Loading…
Reference in a new issue