mirror of
https://github.com/caffa/Obsidian-Current-Folder-Note-Display-Plugin.git
synced 2026-07-22 09:50:27 +00:00
Compare commits
No commits in common. "master" and "1.7.12" have entirely different histories.
7 changed files with 17 additions and 61 deletions
13
build.sh
13
build.sh
|
|
@ -1,13 +0,0 @@
|
|||
#!/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",
|
||||
"name": "Current Folder Notes",
|
||||
"version": "1.7.15",
|
||||
"version": "1.7.11",
|
||||
"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
42
main.ts
|
|
@ -14,7 +14,6 @@ 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> = {
|
||||
|
|
@ -27,8 +26,7 @@ const DEFAULT_SETTINGS: Partial<CurrentFolderNotesDisplaySettings> = {
|
|||
styleMode: 'fancy',
|
||||
showNavigation: false,
|
||||
biggerText: false,
|
||||
biggerTextMobileOnly: false,
|
||||
maxFilesDisplay: 100 // Default to showing 100 files
|
||||
biggerTextMobileOnly: false // Add default value
|
||||
}
|
||||
|
||||
export default class CurrentFolderNotesDisplay extends Plugin {
|
||||
|
|
@ -147,18 +145,8 @@ export default class CurrentFolderNotesDisplay extends Plugin {
|
|||
|
||||
if (leaves.length === 1) {
|
||||
// console.log("[CFN] Updating existing view");
|
||||
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();
|
||||
}
|
||||
const view = leaves[0].view as CurrentFolderNotesDisplayView;
|
||||
await view.displayNotesInCurrentFolder();
|
||||
} else if (leaves.length === 0) {
|
||||
// console.log("[CFN] No view found, creating new one");
|
||||
this.activateView();
|
||||
|
|
@ -458,8 +446,7 @@ export class CurrentFolderNotesDisplayView extends ItemView {
|
|||
});
|
||||
prevLink.setAttribute('aria-label', `Previous: ${prevNote.basename}`);
|
||||
prevLink.addEventListener('click', () => {
|
||||
// Use the full path to handle duplicate file names
|
||||
this.app.workspace.openLinkText(prevNote.path, '');
|
||||
this.app.workspace.openLinkText(prevNote.basename, parentFolderPath);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -476,8 +463,7 @@ export class CurrentFolderNotesDisplayView extends ItemView {
|
|||
});
|
||||
nextLink.setAttribute('aria-label', `Next: ${nextNote.basename}`);
|
||||
nextLink.addEventListener('click', () => {
|
||||
// Use the full path to handle duplicate file names
|
||||
this.app.workspace.openLinkText(nextNote.path, '');
|
||||
this.app.workspace.openLinkText(nextNote.basename, parentFolderPath);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -530,7 +516,7 @@ export class CurrentFolderNotesDisplayView extends ItemView {
|
|||
});
|
||||
|
||||
// OPTIMIZE: Limit the number of files displayed at once to prevent memory issues
|
||||
const MAX_FILES_DISPLAY = this.plugin.settings.maxFilesDisplay; // Use the setting value
|
||||
const MAX_FILES_DISPLAY = 100; // Adjust based on testing
|
||||
const displayedFiles = files.slice(0, MAX_FILES_DISPLAY);
|
||||
const hasMoreFiles = files.length > MAX_FILES_DISPLAY;
|
||||
|
||||
|
|
@ -627,8 +613,7 @@ export class CurrentFolderNotesDisplayView extends ItemView {
|
|||
|
||||
// Add click handler to open the file
|
||||
a.addEventListener('click', () => {
|
||||
// Use the full path instead of just basename to handle duplicate file names
|
||||
this.app.workspace.openLinkText(file.path, '');
|
||||
this.app.workspace.openLinkText(file.basename, parentFolderPath);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -922,19 +907,6 @@ 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' });
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "current-folder-notes-pamphlet",
|
||||
"name": "Current Folder Notes",
|
||||
"version": "1.7.15",
|
||||
"version": "1.7.12",
|
||||
"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
8
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "current-folder-notes-pamphlet",
|
||||
"version": "1.7.15",
|
||||
"name": "obsidian-sample-plugin",
|
||||
"version": "1.7.12",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "current-folder-notes-pamphlet",
|
||||
"version": "1.7.15",
|
||||
"name": "obsidian-sample-plugin",
|
||||
"version": "1.7.12",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.11.6",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"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.",
|
||||
"name": "obsidian-sample-plugin",
|
||||
"version": "1.7.12",
|
||||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dev": "node esbuild.config.mjs",
|
||||
|
|
|
|||
|
|
@ -25,8 +25,5 @@
|
|||
"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.13": "1.7.7",
|
||||
"1.7.14": "1.7.7",
|
||||
"1.7.15": "1.7.7"
|
||||
"1.7.12": "1.7.7"
|
||||
}
|
||||
Loading…
Reference in a new issue