diff --git a/manifest.json b/manifest.json index c7dab55..df90bed 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "gridexplorer", "name": "GridExplorer", - "version": "1.8.6", + "version": "1.8.7", "minAppVersion": "1.1.0", "description": "Browse note files in a grid view.", "author": "Devon22", diff --git a/package-lock.json b/package-lock.json index 1a4e56b..2ae8d7b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gridexplorer", - "version": "1.8.6", + "version": "1.8.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gridexplorer", - "version": "1.8.6", + "version": "1.8.7", "license": "MIT", "devDependencies": { "@types/node": "^16.11.6", diff --git a/package.json b/package.json index 90e84b0..ffefb86 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gridexplorer", - "version": "1.8.6", + "version": "1.8.7", "description": "Browse note files in a grid view.", "main": "main.js", "scripts": { diff --git a/src/GridView.ts b/src/GridView.ts index b0bed65..c838668 100644 --- a/src/GridView.ts +++ b/src/GridView.ts @@ -581,6 +581,24 @@ export class GridView extends ItemView { const titleContainer = contentArea.createDiv('ge-title-container'); const titleEl = titleContainer.createEl('span', { cls: 'ge-title', text: `📁 ${folder.name}` }); + // 檢查同名筆記是否存在 + const notePath = `${folder.path}/${folder.name}.md`; + const noteFile = this.app.vault.getAbstractFileByPath(notePath); + + if (noteFile instanceof TFile) { + // 使用 span 代替 button,只顯示圖示 + const noteIcon = titleContainer.createEl('span', { + cls: 'ge-note-button' + }); + setIcon(noteIcon, 'ellipsis-vertical'); + + // 點擊圖示時開啟同名筆記 + noteIcon.addEventListener('click', (e) => { + e.stopPropagation(); // 防止觸發資料夾的點擊事件 + this.app.workspace.getLeaf(false).openFile(noteFile); + }); + } + // 點擊時進入子資料夾 folderEl.addEventListener('click', () => { this.setSource('folder', folder.path); diff --git a/src/settings.ts b/src/settings.ts index c339cfb..56149a6 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -28,7 +28,7 @@ export const DEFAULT_SETTINGS: GallerySettings = { gridItemHeight: 0, // 網格項目高度,預設 0 imageAreaWidth: 100, // 圖片區域寬度,預設 100 imageAreaHeight: 100, // 圖片區域高度,預設 100 - titleFontSize: 1.1, // 筆記標題的字型大小,預設 1.1 + titleFontSize: 1.0, // 筆記標題的字型大小,預設 1.0 summaryLength: 100, // 筆記摘要的字數,預設 100 enableFileWatcher: true, // 預設啟用檔案監控 showMediaFiles: true, // 預設顯示圖片和影片 @@ -278,7 +278,10 @@ export class GridExplorerSettingTab extends PluginSettingTab { // 新增所有資料夾作為選項 folders.forEach(folder => { // 只顯示尚未被忽略的資料夾 - if (!this.plugin.settings.ignoredFolders.includes(folder.path)) { + const isIgnored = this.plugin.settings.ignoredFolders.some(ignoredPath => + folder.path === ignoredPath || folder.path.startsWith(ignoredPath + '/') + ); + if (!isIgnored) { dropdown.addOption(folder.path, folder.path); } }); diff --git a/styles.css b/styles.css index 7cd0c68..637f75b 100644 --- a/styles.css +++ b/styles.css @@ -104,6 +104,29 @@ width: 100%; } +.ge-note-button { + color: var(--text-muted); + cursor: pointer; + margin-left: 8px; + opacity: 0.7; + transition: opacity 0.2s ease; + background: none; + border: none; + padding: 0; + display: flex; + align-items: center; +} + +.ge-note-button:hover { + opacity: 1; + color: var(--text-accent); +} + +.ge-note-button svg { + width: 18px; + height: 18px; +} + .ge-content-area p { margin: 8px 0 0 0; color: var(--text-faint); @@ -680,4 +703,3 @@ border: 2px dashed var(--interactive-accent); transform: scale(1.05); } - diff --git a/versions.json b/versions.json index a308052..8e4c781 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "1.8.6": "1.1.0" + "1.8.7": "1.1.0" } \ No newline at end of file