1+ import { RowDataType } from "cdm/FolderModel" ;
12import { obtainColumnsFromFile } from "components/Columns" ;
2- import { Setting } from "obsidian" ;
3- import { DataviewService } from "services/DataviewService" ;
3+ import { Notice , Setting } from "obsidian" ;
44import { VaultManagerDB } from "services/FileManagerService" ;
55import { AbstractSettingsHandler , SettingHandlerResponse } from "settings/handlers/AbstractSettingHandler" ;
66
@@ -12,12 +12,12 @@ export class UseFileFieldsAsTemplateColumnsHandler extends AbstractSettingsHandl
1212 // Local exclusivey
1313 if ( local ) {
1414 const filePaths : Record < string , string > = { } ;
15- app . vault . getMarkdownFiles ( )
16- . filter ( file => file . path . startsWith ( view . file . parent . path ) )
17- . forEach ( file => { filePaths [ file . path ] = file . basename } ) ;
15+ view . rows . forEach ( ( row : RowDataType ) => {
16+ filePaths [ row . note . getFile ( ) . path ] = row . note . getFile ( ) . basename ;
17+ } ) ;
1818 new Setting ( containerEl )
1919 . setName ( this . settingTitle )
20- . setDesc ( 'Select file to use as template for database columns' )
20+ . setDesc ( 'Select file to use as template for database columns. Click the button to apply the template. ' )
2121 . addDropdown ( ( dropdown ) => {
2222 dropdown . addOptions ( filePaths ) ;
2323 dropdown . setValue ( "-" ) ;
@@ -32,6 +32,7 @@ export class UseFileFieldsAsTemplateColumnsHandler extends AbstractSettingsHandl
3232 const columns = await obtainColumnsFromFile ( tfile ) ;
3333 view . diskConfig . yaml . columns = columns ;
3434 view . diskConfig . saveOnDisk ( ) ;
35+ new Notice ( `${ Object . keys ( columns ) . length } Columns were loaded from file "${ tfile . basename } "! Close this dialog to show the database changes` ) ;
3536 } ) ;
3637 } ) ;
3738 }
0 commit comments