This commit is contained in:
Devon22 2025-03-18 17:17:54 +08:00
parent 6f72058fbc
commit a607a5cfc3
7 changed files with 51 additions and 8 deletions

View file

@ -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",

4
package-lock.json generated
View file

@ -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",

View file

@ -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": {

View file

@ -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);

View file

@ -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);
}
});

View file

@ -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);
}

View file

@ -1,3 +1,3 @@
{
"1.8.6": "1.1.0"
"1.8.7": "1.1.0"
}