Rename files and fix one overview bug

This commit is contained in:
Lost Paul 2023-08-12 18:01:16 +02:00
parent 0b33958f3c
commit e040d554ec
10 changed files with 28 additions and 25 deletions

View file

@ -1,9 +1,9 @@
import { Setting } from 'obsidian';
import FolderNotesPlugin from './main';
import ExcludedFolderSettings from './modals/excludeFolderSettings';
import ExcludedFolderSettings from './modals/ExcludeFolderSettings';
import { FolderSuggest } from './suggesters/FolderSuggester';
import { SettingsTab } from './settings';
import PatternSettings from './modals/patternSettings';
import { SettingsTab } from './Settings';
import PatternSettings from './modals/PatternSettings';
export class ExcludedFolder {
type: string;

View file

@ -1,9 +1,11 @@
import { MarkdownPostProcessorContext, parseYaml, TAbstractFile, TFolder, TFile, stringifyYaml, Notice } from 'obsidian';
import { extractFolderName, getFolderNote } from '../functions/folderNoteFunctions';
import FolderNotesPlugin from '../main';
import { FolderOverviewSettings } from './modalSettings';
import { FolderOverviewSettings } from './ModalSettings';
import { getExcludedFolder } from '../excludedFolder';
export type includeTypes = 'folder' | 'markdown' | 'canvas' | 'other' | 'pdf' | 'images' | 'audio' | 'video' | 'all';
export type yamlSettings = {
folderPath: string;
title: string;
@ -18,6 +20,7 @@ export type yamlSettings = {
onlyIncludeSubfolders: boolean;
storeFolderCondition: boolean;
};
export class FolderOverview {
yaml: yamlSettings;
plugin: FolderNotesPlugin;
@ -38,16 +41,16 @@ export class FolderOverview {
this.yaml = {
folderPath: yaml?.folderPath || plugin.getFolderPathFromString(ctx.sourcePath),
title: yaml?.title || plugin.settings.defaultOverview.title,
disableTitle: yaml?.disableTitle || plugin.settings.defaultOverview.disableTitle,
disableTitle: yaml?.disableTitle !== undefined && yaml?.disableTitle !== null ? yaml?.disableTitle : plugin.settings.defaultOverview.disableTitle,
depth: yaml?.depth || plugin.settings.defaultOverview.depth,
style: yaml?.style || 'list',
includeTypes: includeTypes.map((type) => type.toLowerCase()) as includeTypes[],
disableFileTag: yaml?.disableFileTag || plugin.settings.defaultOverview.disableFileTag,
disableFileTag: yaml?.disableFileTag !== undefined && yaml?.disableFileTag !== null ? yaml?.disableFileTag : plugin.settings.defaultOverview.disableFileTag,
sortBy: yaml?.sortBy || plugin.settings.defaultOverview.sortBy,
sortByAsc: yaml?.sortByAsc || plugin.settings.defaultOverview.sortByAsc,
showEmptyFolders: yaml?.showEmptyFolders || plugin.settings.defaultOverview.showEmptyFolders,
onlyIncludeSubfolders: yaml?.onlyIncludeSubfolders || plugin.settings.defaultOverview.onlyIncludeSubfolders,
storeFolderCondition: yaml?.storeFolderCondition || plugin.settings.defaultOverview.storeFolderCondition
showEmptyFolders: yaml?.showEmptyFolders !== undefined && yaml?.showEmptyFolders !== null ? yaml?.showEmptyFolders : plugin.settings.defaultOverview.showEmptyFolders,
onlyIncludeSubfolders: yaml?.onlyIncludeSubfolders !== undefined && yaml?.onlyIncludeSubfolders !== null ? yaml?.onlyIncludeSubfolders : plugin.settings.defaultOverview.onlyIncludeSubfolders,
storeFolderCondition: yaml?.storeFolderCondition !== undefined && yaml?.storeFolderCondition !== null ? yaml?.storeFolderCondition : plugin.settings.defaultOverview.storeFolderCondition,
}
}
create(plugin: FolderNotesPlugin, source: string, el: HTMLElement, ctx: MarkdownPostProcessorContext) {

View file

@ -187,7 +187,7 @@ export class FolderOverviewSettings extends Modal {
.setDesc('Choose if the file tag should be shown after the file name')
.addToggle((toggle) => {
toggle
.setValue(this.yaml.disableFileTag || this.plugin.settings.defaultOverview.disableFileTag || false)
.setValue(this.yaml.disableFileTag)
.onChange(async (value) => {
this.yaml.disableFileTag = value;
if (this.defaultSettings) {
@ -255,7 +255,7 @@ export class FolderOverviewSettings extends Modal {
.setDesc('Show the names of folders that appear to have no files/folders in the folder overview. That\'s mostly the case when you set the file depth to 1.')
.addToggle((toggle) => {
toggle
.setValue(this.yaml.showEmptyFolders || this.plugin.settings.defaultOverview.showEmptyFolders || false)
.setValue(this.yaml.showEmptyFolders)
.onChange(async (value) => {
this.yaml.showEmptyFolders = value;
this.yaml.onlyIncludeSubfolders = false;
@ -272,7 +272,7 @@ export class FolderOverviewSettings extends Modal {
.setName('Only show first empty subfolders of current folder')
.addToggle((toggle) => {
toggle
.setValue(this.yaml.onlyIncludeSubfolders || this.plugin.settings.defaultOverview.onlyIncludeSubfolders || false)
.setValue(this.yaml.onlyIncludeSubfolders)
.onChange(async (value) => {
this.yaml.onlyIncludeSubfolders = value;
if (this.defaultSettings) {

View file

@ -1,5 +1,5 @@
import { Setting } from 'obsidian';
import { FolderOverviewSettings } from '../folderOverview/modalSettings';
import { FolderOverviewSettings } from '../folderOverview/ModalSettings';
import { includeTypes } from 'src/folderOverview/FolderOverview';
import { updateYaml } from 'src/folderOverview/FolderOverview';
export default class ListComponent {

View file

@ -1,8 +1,8 @@
import FolderNotesPlugin from '../main';
import ExistingFolderNoteModal from '../modals/existingNote';
import ExistingFolderNoteModal from '../modals/ExistingNote';
import { applyTemplate } from '../template';
import { TFolder, TFile, TAbstractFile, Keymap } from 'obsidian';
import DeleteConfirmationModal from '../modals/deleteConfirmation';
import DeleteConfirmationModal from '../modals/DeleteConfirmation';
import { addExcludedFolder, deleteExcludedFolder, getExcludedFolder, ExcludedFolder, updateExcludedFolder } from '../excludedFolder';
export async function createFolderNote(plugin: FolderNotesPlugin, folderPath: string, openFile: boolean, useModal?: boolean, existingNote?: TFile) {

View file

@ -1,13 +1,13 @@
import { Plugin, TFile, TFolder, TAbstractFile, MarkdownPostProcessorContext, parseYaml, Notice } from 'obsidian';
import { DEFAULT_SETTINGS, FolderNotesSettings, SettingsTab } from './settings';
import { DEFAULT_SETTINGS, FolderNotesSettings, SettingsTab } from './Settings';
import { Commands } from './commands';
import { FileExplorerWorkspaceLeaf } from './globals';
import { handleViewHeaderClick, handleFolderClick } from './events/handleClick';
import { handleFileRename, handleFolderRename } from './events/handleRename';
import { createFolderNote, extractFolderName, getFolderNote, getFolder } from './functions/folderNoteFunctions';
import { getExcludedFolder } from './excludedFolder';
import { FrontMatterTitlePluginHandler } from './events/frontMatterTitle';
import { FolderOverviewSettings } from './folderOverview/modalSettings';
import { FrontMatterTitlePluginHandler } from './events/FrontMatterTitle';
import { FolderOverviewSettings } from './folderOverview/ModalSettings';
import { FolderOverview } from './folderOverview/FolderOverview';
import './functions/ListComponent';
export default class FolderNotesPlugin extends Plugin {

View file

@ -1,12 +1,12 @@
import { App, Notice, Platform, PluginSettingTab, Setting, TFile, TFolder } from 'obsidian';
import FolderNotesPlugin from './main';
import { TemplateSuggest } from './suggesters/templateSuggester';
import { TemplateSuggest } from './suggesters/TemplateSuggester';
import { extractFolderName, getFolderNote } from './functions/folderNoteFunctions';
import { addExcludeFolderListItem, ExcludedFolder, addExcludedFolder, ExcludePattern, addExcludePatternListItem } from './excludedFolder';
import { FrontMatterTitlePluginHandler } from './events/frontMatterTitle';
import ConfirmationModal from "./modals/confirmCreation";
import { FrontMatterTitlePluginHandler } from './events/FrontMatterTitle';
import ConfirmationModal from "./modals/ConfirmCreation";
import { yamlSettings } from './folderOverview/FolderOverview';
import { FolderOverviewSettings } from './folderOverview/modalSettings';
import { FolderOverviewSettings } from './folderOverview/ModalSettings';
export interface FolderNotesSettings {
syncFolderName: boolean;
ctrlKey: boolean;

View file

@ -1,7 +1,7 @@
// Credits go to Liam's Periodic Notes Plugin: https://github.com/liamcain/obsidian-periodic-notes and https://github.com/SilentVoid13/Templater
import { TAbstractFile, TFile } from 'obsidian';
import { TextInputSuggest } from './suggest';
import { TextInputSuggest } from './Suggest';
import FolderNotesPlugin from '../main';
export enum FileSuggestMode {
TemplateFiles,

View file

@ -1,7 +1,7 @@
// Credits go to Liam's Periodic Notes Plugin: https://github.com/liamcain/obsidian-periodic-notes and https://github.com/SilentVoid13/Templater
import { TAbstractFile, TFolder } from 'obsidian';
import { TextInputSuggest } from './suggest';
import { TextInputSuggest } from './Suggest';
import FolderNotesPlugin from '../main';
export enum FileSuggestMode {
TemplateFiles,

View file

@ -1,7 +1,7 @@
// Credits go to Liam's Periodic Notes Plugin: https://github.com/liamcain/obsidian-periodic-notes and https://github.com/SilentVoid13/Templater
import { TAbstractFile, TFile, TFolder, Vault } from 'obsidian';
import { TextInputSuggest } from './suggest';
import { TextInputSuggest } from './Suggest';
import FolderNotesPlugin from '../main';
import { getTemplatePlugins } from 'src/template';
export enum FileSuggestMode {