Compare commits

..

10 commits

Author SHA1 Message Date
caffae
3c83ab046e Prepare for Git Release 2025-06-12 23:53:10 +08:00
caffae
73834af345 1.7.15 2025-06-12 23:53:10 +08:00
caffae
1e111d57fb fixed leaf opening bug 2025-06-12 23:53:03 +08:00
caffae
7315f13a7d Prepare for Git Release 2025-05-17 19:29:17 +08:00
caffae
6e87618c43 1.7.14 2025-05-17 19:29:17 +08:00
caffae
67133774b7 Prepare for Git Release 2025-05-17 19:28:51 +08:00
caffae
d65d4e103e 1.7.13 2025-05-17 19:20:26 +08:00
caffae
11a4ae6dc7 Prepare for Git Release 2025-05-17 19:18:12 +08:00
caffae
3c58721fc4 fixing package json 2025-03-12 12:57:19 +08:00
caffae
cc3ec3236e Prepare for Git Release 2025-03-12 12:54:02 +08:00
7 changed files with 61 additions and 17 deletions

13
build.sh Executable file
View 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!"

View file

@ -1,7 +1,7 @@
{
"id": "current-folder-notes-pamphlet",
"name": "Current Folder Notes",
"version": "1.7.11",
"version": "1.7.15",
"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.",
"author": "Pamela Wang",

42
main.ts
View file

@ -14,6 +14,7 @@ interface CurrentFolderNotesDisplaySettings {
showNavigation: boolean;
biggerText: boolean; // Add this line
biggerTextMobileOnly: boolean; // Add this new setting
maxFilesDisplay: number; // Add new setting for max files to display
}
const DEFAULT_SETTINGS: Partial<CurrentFolderNotesDisplaySettings> = {
@ -26,7 +27,8 @@ const DEFAULT_SETTINGS: Partial<CurrentFolderNotesDisplaySettings> = {
styleMode: 'fancy',
showNavigation: false,
biggerText: false,
biggerTextMobileOnly: false // Add default value
biggerTextMobileOnly: false,
maxFilesDisplay: 100 // Default to showing 100 files
}
export default class CurrentFolderNotesDisplay extends Plugin {
@ -145,8 +147,18 @@ export default class CurrentFolderNotesDisplay extends Plugin {
if (leaves.length === 1) {
// console.log("[CFN] Updating existing view");
const view = leaves[0].view as CurrentFolderNotesDisplayView;
await view.displayNotesInCurrentFolder();
const leaf = leaves[0];
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) {
// console.log("[CFN] No view found, creating new one");
this.activateView();
@ -446,7 +458,8 @@ export class CurrentFolderNotesDisplayView extends ItemView {
});
prevLink.setAttribute('aria-label', `Previous: ${prevNote.basename}`);
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, '');
});
}
@ -463,7 +476,8 @@ export class CurrentFolderNotesDisplayView extends ItemView {
});
nextLink.setAttribute('aria-label', `Next: ${nextNote.basename}`);
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, '');
});
}
@ -516,7 +530,7 @@ export class CurrentFolderNotesDisplayView extends ItemView {
});
// OPTIMIZE: Limit the number of files displayed at once to prevent memory issues
const MAX_FILES_DISPLAY = 100; // Adjust based on testing
const MAX_FILES_DISPLAY = this.plugin.settings.maxFilesDisplay; // Use the setting value
const displayedFiles = files.slice(0, MAX_FILES_DISPLAY);
const hasMoreFiles = files.length > MAX_FILES_DISPLAY;
@ -613,7 +627,8 @@ export class CurrentFolderNotesDisplayView extends ItemView {
// Add click handler to open the file
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, '');
});
}
@ -907,6 +922,19 @@ class CurrentFolderNotesDisplaySettingTab extends PluginSettingTab {
await this.plugin.saveSettings();
}));
new Setting(contentEl)
.setName('Maximum files to display')
.setDesc('Limit the number of files shown in the folder notes list. Use a lower value for better performance in large folders.')
.addSlider(slider => slider
.setLimits(10, 500, 10)
.setValue(this.plugin.settings.maxFilesDisplay)
.setDynamicTooltip()
.onChange(async (value) => {
this.plugin.settings.maxFilesDisplay = value;
await this.plugin.saveSettings();
this.plugin.refreshView();
}));
// About section with help text
const aboutEl = containerEl.createDiv({ cls: 'settings-section' });
aboutEl.createEl('h3', { cls: 'settings-section-header', text: ' About' });

View file

@ -1,7 +1,7 @@
{
"id": "current-folder-notes-pamphlet",
"name": "Current Folder Notes",
"version": "1.7.12",
"version": "1.7.15",
"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.",
"author": "Pamela Wang",

8
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "obsidian-sample-plugin",
"version": "1.7.12",
"name": "current-folder-notes-pamphlet",
"version": "1.7.15",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "obsidian-sample-plugin",
"version": "1.7.12",
"name": "current-folder-notes-pamphlet",
"version": "1.7.15",
"license": "MIT",
"devDependencies": {
"@types/node": "^16.11.6",

View file

@ -1,7 +1,7 @@
{
"name": "obsidian-sample-plugin",
"version": "1.7.12",
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
"name": "current-folder-notes-pamphlet",
"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.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",

View file

@ -25,5 +25,8 @@
"1.7.9": "1.7.7",
"1.7.10": "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.14": "1.7.7",
"1.7.15": "1.7.7"
}