From 31ed5ff3045975d4daf8347b50455e56aca65019 Mon Sep 17 00:00:00 2001 From: Devon22 Date: Sat, 13 Jun 2026 23:12:01 +0800 Subject: [PATCH] 3.4.4 --- manifest.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/main.ts | 27 +++++++++++++++++++++++++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index 2f69b37..b9731b5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "gridexplorer", "name": "GridExplorer", - "version": "3.4.3", + "version": "3.4.4", "minAppVersion": "1.8.7", "description": "Browse note files in a grid view.", "author": "Devon22", diff --git a/package-lock.json b/package-lock.json index e892c54..f6df7e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gridexplorer", - "version": "3.4.3", + "version": "3.4.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gridexplorer", - "version": "3.4.3", + "version": "3.4.4", "license": "MIT", "dependencies": { "jszip": "^3.10.1" diff --git a/package.json b/package.json index 066178e..bb8483b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gridexplorer", - "version": "3.4.3", + "version": "3.4.4", "description": "Browse note files in a grid view.", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index 690ee98..1d655da 100644 --- a/src/main.ts +++ b/src/main.ts @@ -43,6 +43,15 @@ export default class GridExplorerPlugin extends Plugin { settings: GallerySettings = DEFAULT_SETTINGS; statusBarItem: HTMLElement | null = null; + async getThumbnail(zipPath: string): Promise { + const file = this.app.vault.getAbstractFileByPath(zipPath); + if (file instanceof TFile && file.extension.toLowerCase() === 'zip') { + const { getFirstImageFromZip } = await import('./utils/mediaUtils'); + return await getFirstImageFromZip(this.app, file); + } + return null; + } + async onload() { await this.loadSettings(); @@ -63,7 +72,11 @@ export default class GridExplorerPlugin extends Plugin { VIEW_TYPE_ZIP, (leaf) => new ZipView(leaf) ); - this.registerExtensions(["zip"], VIEW_TYPE_ZIP); + try { + this.registerExtensions(["zip"], VIEW_TYPE_ZIP); + } catch (e) { + console.warn("Grid Explorer: Could not register 'zip' extension.", e); + } // 註冊設定頁面 this.addSettingTab(new GridExplorerSettingTab(this.app, this)); @@ -502,9 +515,19 @@ export default class GridExplorerPlugin extends Plugin { }, true); // 使用 capture 階段以確保優先處理 - // 設定 Canvas 拖曳處理 + // 註冊版面拖曳處理 this.setupCanvasDropHandlers(); + // 暴露 API 供其他外掛使用 + const appWithPlugins = this.app as { + plugins?: { + plugins?: Record; + }; + }; + if (appWithPlugins.plugins?.plugins) { + appWithPlugins.plugins.plugins['obsidian-gridexplorer'] = this; + } + // Override new tab behavior (for useQuickAccessAsNewTabMode setting) const { workspace } = this.app;