mirror of
https://github.com/caffa/Obsidian-Current-Folder-Note-Display-Plugin.git
synced 2026-07-22 09:50:27 +00:00
Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c83ab046e | ||
|
|
73834af345 | ||
|
|
1e111d57fb | ||
|
|
7315f13a7d | ||
|
|
6e87618c43 | ||
|
|
67133774b7 |
7 changed files with 39 additions and 11 deletions
13
build.sh
Executable file
13
build.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Build script for Current Folder Notes plugin
|
||||||
|
|
||||||
|
echo "Building Current Folder Notes plugin..."
|
||||||
|
|
||||||
|
# Run TypeScript compiler
|
||||||
|
npx tsc -noEmit false
|
||||||
|
|
||||||
|
# Use esbuild to bundle the project
|
||||||
|
node esbuild.config.mjs
|
||||||
|
|
||||||
|
echo "Build completed successfully!"
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "current-folder-notes-pamphlet",
|
"id": "current-folder-notes-pamphlet",
|
||||||
"name": "Current Folder Notes",
|
"name": "Current Folder Notes",
|
||||||
"version": "1.7.12",
|
"version": "1.7.15",
|
||||||
"minAppVersion": "1.7.7",
|
"minAppVersion": "1.7.7",
|
||||||
"description": "Shows a list of notes in the current folder, and allows you to filter the titles to include or exclude notes.",
|
"description": "Shows a list of notes in the current folder, and allows you to filter the titles to include or exclude notes.",
|
||||||
"author": "Pamela Wang",
|
"author": "Pamela Wang",
|
||||||
|
|
|
||||||
23
main.ts
23
main.ts
|
|
@ -147,8 +147,18 @@ export default class CurrentFolderNotesDisplay extends Plugin {
|
||||||
|
|
||||||
if (leaves.length === 1) {
|
if (leaves.length === 1) {
|
||||||
// console.log("[CFN] Updating existing view");
|
// console.log("[CFN] Updating existing view");
|
||||||
const view = leaves[0].view as CurrentFolderNotesDisplayView;
|
const leaf = leaves[0];
|
||||||
await view.displayNotesInCurrentFolder();
|
const view = leaf.view;
|
||||||
|
|
||||||
|
// Check if view is an instance of CurrentFolderNotesDisplayView
|
||||||
|
if (view && view instanceof CurrentFolderNotesDisplayView) {
|
||||||
|
await view.displayNotesInCurrentFolder();
|
||||||
|
} else {
|
||||||
|
// If the view doesn't have the expected method, recreate it
|
||||||
|
console.log("[CFN] View is not a CurrentFolderNotesDisplayView, recreating view");
|
||||||
|
leaf.detach();
|
||||||
|
await this.activateView();
|
||||||
|
}
|
||||||
} else if (leaves.length === 0) {
|
} else if (leaves.length === 0) {
|
||||||
// console.log("[CFN] No view found, creating new one");
|
// console.log("[CFN] No view found, creating new one");
|
||||||
this.activateView();
|
this.activateView();
|
||||||
|
|
@ -448,7 +458,8 @@ export class CurrentFolderNotesDisplayView extends ItemView {
|
||||||
});
|
});
|
||||||
prevLink.setAttribute('aria-label', `Previous: ${prevNote.basename}`);
|
prevLink.setAttribute('aria-label', `Previous: ${prevNote.basename}`);
|
||||||
prevLink.addEventListener('click', () => {
|
prevLink.addEventListener('click', () => {
|
||||||
this.app.workspace.openLinkText(prevNote.basename, parentFolderPath);
|
// Use the full path to handle duplicate file names
|
||||||
|
this.app.workspace.openLinkText(prevNote.path, '');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -465,7 +476,8 @@ export class CurrentFolderNotesDisplayView extends ItemView {
|
||||||
});
|
});
|
||||||
nextLink.setAttribute('aria-label', `Next: ${nextNote.basename}`);
|
nextLink.setAttribute('aria-label', `Next: ${nextNote.basename}`);
|
||||||
nextLink.addEventListener('click', () => {
|
nextLink.addEventListener('click', () => {
|
||||||
this.app.workspace.openLinkText(nextNote.basename, parentFolderPath);
|
// Use the full path to handle duplicate file names
|
||||||
|
this.app.workspace.openLinkText(nextNote.path, '');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -615,7 +627,8 @@ export class CurrentFolderNotesDisplayView extends ItemView {
|
||||||
|
|
||||||
// Add click handler to open the file
|
// Add click handler to open the file
|
||||||
a.addEventListener('click', () => {
|
a.addEventListener('click', () => {
|
||||||
this.app.workspace.openLinkText(file.basename, parentFolderPath);
|
// Use the full path instead of just basename to handle duplicate file names
|
||||||
|
this.app.workspace.openLinkText(file.path, '');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "current-folder-notes-pamphlet",
|
"id": "current-folder-notes-pamphlet",
|
||||||
"name": "Current Folder Notes",
|
"name": "Current Folder Notes",
|
||||||
"version": "1.7.13",
|
"version": "1.7.15",
|
||||||
"minAppVersion": "1.7.7",
|
"minAppVersion": "1.7.7",
|
||||||
"description": "Shows a list of notes in the current folder, and allows you to filter the titles to include or exclude notes.",
|
"description": "Shows a list of notes in the current folder, and allows you to filter the titles to include or exclude notes.",
|
||||||
"author": "Pamela Wang",
|
"author": "Pamela Wang",
|
||||||
|
|
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "current-folder-notes-pamphlet",
|
"name": "current-folder-notes-pamphlet",
|
||||||
"version": "1.7.13",
|
"version": "1.7.15",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "current-folder-notes-pamphlet",
|
"name": "current-folder-notes-pamphlet",
|
||||||
"version": "1.7.13",
|
"version": "1.7.15",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.6",
|
"@types/node": "^16.11.6",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "current-folder-notes-pamphlet",
|
"name": "current-folder-notes-pamphlet",
|
||||||
"version": "1.7.13",
|
"version": "1.7.15",
|
||||||
"description": "Shows a list of notes in the current folder, and allows you to filter the titles to include or exclude notes.",
|
"description": "Shows a list of notes in the current folder, and allows you to filter the titles to include or exclude notes.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -26,5 +26,7 @@
|
||||||
"1.7.10": "1.7.7",
|
"1.7.10": "1.7.7",
|
||||||
"1.7.11": "1.7.7",
|
"1.7.11": "1.7.7",
|
||||||
"1.7.12": "1.7.7",
|
"1.7.12": "1.7.7",
|
||||||
"1.7.13": "1.7.7"
|
"1.7.13": "1.7.7",
|
||||||
|
"1.7.14": "1.7.7",
|
||||||
|
"1.7.15": "1.7.7"
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue