diff --git a/.gitignore b/.gitignore index b2da6fc..529edd5 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ data.json .DS_Store release.zip +.aider* +.env diff --git a/current-folder-notes/manifest.json b/current-folder-notes/manifest.json index 6ee275d..8cdd5d5 100644 --- a/current-folder-notes/manifest.json +++ b/current-folder-notes/manifest.json @@ -1,7 +1,7 @@ { "id": "current-folder-notes-pamphlet", "name": "Current Folder Notes", - "version": "1.7.1", + "version": "1.7.2", "minAppVersion": "1.5.11", "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", diff --git a/current-folder-notes/styles.css b/current-folder-notes/styles.css index 7ab4c5a..bdb5887 100644 --- a/current-folder-notes/styles.css +++ b/current-folder-notes/styles.css @@ -8,7 +8,7 @@ color: var(--text-small); text-decoration: none; font-size: var(--font-ui-medium); - font-family: var(--font-interface-theme); + /* font-family: var(--font-interface-theme); */ line-height: var(--line-height-tight); } diff --git a/main.ts b/main.ts index 198bcf3..f803b4d 100644 --- a/main.ts +++ b/main.ts @@ -25,31 +25,14 @@ const DEFAULT_SETTINGS: Partial = { export default class CurrentFolderNotesDisplay extends Plugin { settings: CurrentFolderNotesDisplaySettings; + private leaves: WorkspaceLeaf[] = []; fileChangeHandler(file: TFile) { if (file instanceof TFile && file.path === this.file.path) { this.load(); } - this.panes = []; // Initialize the array in the constructor - // Close all tracked panes when the plugin is unloaded - for (const pane of this.panes) { - if (!pane.isDetached()) { - pane.detach(); - } - } - this.panes = []; // Clear the array after closing the panes - - // ... existing code ... } - async onload() { - await this.loadSettings(); - - // Example of opening a pane and adding it to the panes array - const leaf = this.app.workspace.getLeaf('tab'); - await leaf.setViewState({ type: 'markdown' }); - this.panes.push(leaf); // Add the pane to the panes array - async onload() { await this.loadSettings(); @@ -103,10 +86,19 @@ export default class CurrentFolderNotesDisplay extends Plugin { this.refreshView(); })); + // when I switch active files, update the view + // this.registerEvent(this.app.workspace.on('active-leaf-change', async (leaf) => { + // this.refreshView(); + // })); + + } onunload() { console.log('unloading plugin'); + this.leaves.forEach(leaf => { + leaf.detach(); + }); @@ -125,7 +117,8 @@ export default class CurrentFolderNotesDisplay extends Plugin { // in the right sidebar for it leaf = workspace.getRightLeaf(false); if (leaf) { - await leaf.setViewState({ type: VIEW_TYPE_CURRENT_FOLDER_NOTES_DISPLAY, active: true }); + await leaf.setViewState({ type: VIEW_TYPE_CURRENT_FOLDER_NOTES_DISPLAY, active: true }); + this.leaves.push(leaf); } } diff --git a/prepareForGitReleaseNreplace.sh b/prepareForGitReleaseNreplace.sh new file mode 100644 index 0000000..200f9b5 --- /dev/null +++ b/prepareForGitReleaseNreplace.sh @@ -0,0 +1,28 @@ +# minor version bump +npm version patch + +# create the current_release directory if it does not exist +mkdir -p current-folder-notes + +# make a copy of the main.js, manifest.json, and styles.css files in another folder +cp main.js current-folder-notes +cp manifest.json current-folder-notes +cp styles.css current-folder-notes + +rm -f "/Users/caffae/Notes/Char V4/.obsidian/plugins/Current Folder Notes/main.js" +rm -f "/Users/caffae/Notes/Char V4/.obsidian/plugins/Current Folder Notes/manifest.json" +rm -f "/Users/caffae/Notes/Char V4/.obsidian/plugins/Current Folder Notes/styles.css" + +cp main.js "/Users/caffae/Notes/Char V4/.obsidian/plugins/Current Folder Notes" +cp manifest.json "/Users/caffae/Notes/Char V4/.obsidian/plugins/Current Folder Notes" +cp styles.css "/Users/caffae/Notes/Char V4/.obsidian/plugins/Current Folder Notes" + +# compress the current_release folder into a zip file +# zip -r release.zip current_release +zip -vr current-folder-notes.zip current-folder-notes -x "*.DS_Store" + +mv current-folder-notes.zip release.zip + +# remove the current_release folder +# rm -rf current-folder-notes +