Skip to content

Commit

Permalink
Fix remaining issues
Browse files Browse the repository at this point in the history
  • Loading branch information
LostPaul committed Jan 8, 2025
1 parent a44cba7 commit 8338368
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "folder-notes",
"name": "Folder notes",
"version": "1.7.33",
"version": "1.7.34",
"minAppVersion": "0.15.0",
"description": "Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.",
"author": "Lost Paul",
Expand Down
2 changes: 1 addition & 1 deletion src/ExcludeFolders/modals/WhitelistedFoldersSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class WhitelistedFoldersSettings extends Modal {
app: App;
settingsTab: SettingsTab;
constructor(settingsTab: SettingsTab) {
super(app);
super(settingsTab.app);
this.plugin = settingsTab.plugin;
this.settingsTab = settingsTab;
this.app = settingsTab.app;
Expand Down
4 changes: 2 additions & 2 deletions src/events/handleClick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function handleViewHeaderClick(event: MouseEvent, plugin: FolderNot
} else if (event.altKey || Keymap.isModEvent(event) === 'tab') {
if ((plugin.settings.altKey && event.altKey) || (plugin.settings.ctrlKey && Keymap.isModEvent(event) === 'tab')) {
await createFolderNote(plugin, folderPath, true, undefined, true);
addCSSClassToTitleEL(plugin, folderPath, 'has-folder-note');
addCSSClassToTitleEL(folderPath, 'has-folder-note');
removeCSSClassFromEL(folderPath, 'has-not-folder-note');
return;
}
Expand Down Expand Up @@ -86,7 +86,7 @@ export async function handleFolderClick(event: MouseEvent, plugin: FolderNotesPl
} else if (event.altKey || Keymap.isModEvent(event) === 'tab') {
if ((plugin.settings.altKey && event.altKey) || (plugin.settings.ctrlKey && Keymap.isModEvent(event) === 'tab')) {
await createFolderNote(plugin, folderPath, true, undefined, true);
addCSSClassToTitleEL(plugin, folderPath, 'has-folder-note');
addCSSClassToTitleEL(folderPath, 'has-folder-note');
removeCSSClassFromEL(folderPath, 'has-not-folder-note');
return;
}
Expand Down
16 changes: 8 additions & 8 deletions src/events/handleRename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ export function handleRename(file: TAbstractFile, oldPath: string, plugin: Folde
const isRename = (file.parent?.path === getFolderPathFromString(oldPath))
if (folder instanceof TFolder) {
if (plugin.isEmptyFolderNoteFolder(folder)) {
addCSSClassToTitleEL(plugin, folder.path, 'only-has-folder-note');
addCSSClassToTitleEL(folder.path, 'only-has-folder-note');
} else {
removeCSSClassFromEL(folder.path, 'only-has-folder-note');
}
}

if (oldFolder instanceof TFolder) {
if (plugin.isEmptyFolderNoteFolder(oldFolder)) {
addCSSClassToTitleEL(plugin, oldFolder.path, 'only-has-folder-note');
addCSSClassToTitleEL(oldFolder.path, 'only-has-folder-note');
} else {
removeCSSClassFromEL(oldFolder.path, 'only-has-folder-note');
}
Expand Down Expand Up @@ -143,8 +143,8 @@ export async function handleFileRename(file: TFile, oldPath: string, plugin: Fol
const folderNote = getFolderNote(plugin, oldPath, plugin.settings.storageLocation, file);

if (!excludedFolder?.disableFolderNote && folderName === newFolder?.name && !detachedExcludedFolder) {
addCSSClassToTitleEL(plugin, file.path, 'is-folder-note');
addCSSClassToTitleEL(plugin, newFolder.path, 'has-folder-note');
addCSSClassToTitleEL(file.path, 'is-folder-note');
addCSSClassToTitleEL(newFolder.path, 'has-folder-note');
return;
} else if (excludedFolder?.disableFolderNote || (folderName !== newFolder?.name)) {
removeCSSClassFromEL(file.path, 'is-folder-note');
Expand All @@ -155,9 +155,9 @@ export async function handleFileRename(file: TFile, oldPath: string, plugin: Fol


if (folderName === newFolder?.name) {
addCSSClassToTitleEL(plugin, file.path, 'is-folder-note');
addCSSClassToTitleEL(file.path, 'is-folder-note');
removeCSSClassFromEL(oldFolder?.path, 'has-folder-note');
addCSSClassToTitleEL(plugin, newFolder.path, 'has-folder-note');
addCSSClassToTitleEL(newFolder.path, 'has-folder-note');
return;
}

Expand All @@ -179,8 +179,8 @@ async function renameFolderOnFileRename(file: TFile, oldPath: string, oldFolder:
removeCSSClassFromEL(file.path, 'is-folder-note');
return;
} else if (newFolderName === oldFolder.name) {
addCSSClassToTitleEL(plugin, oldFolder.path, 'has-folder-note');
addCSSClassToTitleEL(plugin, file.path, 'is-folder-note');
addCSSClassToTitleEL(oldFolder.path, 'has-folder-note');
addCSSClassToTitleEL(file.path, 'is-folder-note');
return;
}

Expand Down
4 changes: 2 additions & 2 deletions src/functions/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FileExplorerWorkspaceLeaf } from "src/globals";

export function getFileNameFromPathString(path: string): string {
return path.substring(path.lastIndexOf('/' || '\\') >= 0 ? path.lastIndexOf('/' || '\\') + 1 : 0);
return path.substring(path.lastIndexOf('/') >= 0 ? path.lastIndexOf('/') + 1 : 0);
}

export function getFolderNameFromPathString(path: string): string {
Expand All @@ -21,7 +21,7 @@ export function getExtensionFromPathString(path: string): string {
}

export function getFolderPathFromString(path: string): string {
const subString = path.lastIndexOf('/' || '\\') >= 0 ? path.lastIndexOf('/') : 0;
const subString = path.lastIndexOf('/') >= 0 ? path.lastIndexOf('/') : 0;
const folderPath = path.substring(0, subString);
if (folderPath === '') {
return '/';
Expand Down
2 changes: 1 addition & 1 deletion src/modals/AddSupportedFileType.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { App, Modal, Setting, TFolder, Notice } from 'obsidian';
import FolderNotesPlugin from '../main';
import ListComponent from 'src/functions/ListComponent';
import { ListComponent } from 'src/functions/ListComponent';
import { SettingTab } from 'obsidian';

export default class AddSupportedFileModal extends Modal {
Expand Down

0 comments on commit 8338368

Please sign in to comment.