@@ -26,7 +26,7 @@ import {
2626import {
2727 DBFolderAPI
2828} from 'api/plugin-api' ;
29- import { DatabaseSettings } from 'cdm/SettingsModel' ;
29+ import { DatabaseSettings , LocalSettings } from 'cdm/SettingsModel' ;
3030
3131import StateManager from 'StateManager' ;
3232import { around } from 'monkey-around' ;
@@ -201,7 +201,7 @@ export default class DBFolderPlugin extends Plugin {
201201 . concat ( '\n' )
202202 . concat ( this . defaultConfiguration ( ) )
203203 ) ;
204- await app . workspace . activeLeaf . setViewState ( {
204+ await app . workspace . getMostRecentLeaf ( ) . setViewState ( {
205205 type : DatabaseCore . FRONTMATTER_KEY ,
206206 state : { file : database . path } ,
207207 } ) ;
@@ -217,8 +217,9 @@ export default class DBFolderPlugin extends Plugin {
217217 const local_settings = this . settings . local_settings ;
218218 const defaultConfig = [ ] ;
219219 defaultConfig . push ( "config:" ) ;
220- Object . entries ( local_settings ) . forEach ( ( [ key , value ] ) => {
221- defaultConfig . push ( `${ YAML_INDENT } ${ key } : ${ value } ` ) ;
220+ Object . entries ( DEFAULT_SETTINGS . local_settings ) . forEach ( ( [ key , value ] ) => {
221+ const defaultValue = local_settings [ key as keyof LocalSettings ] !== undefined ? local_settings [ key as keyof LocalSettings ] : value ;
222+ defaultConfig . push ( `${ YAML_INDENT } ${ key } : ${ defaultValue } ` ) ;
222223 } ) ;
223224 defaultConfig . push ( "%%>" ) ;
224225 return defaultConfig . join ( '\n' ) ;
@@ -248,7 +249,7 @@ export default class DBFolderPlugin extends Plugin {
248249 this . registerMarkdownPostProcessor ( previewMode . markdownPostProcessor ) ;
249250
250251 // internal-link quick preview
251- this . registerEvent ( this . app . workspace . on ( "quick-preview" , previewMode . hoverEvent ) ) ;
252+ this . registerEvent ( app . workspace . on ( "quick-preview" , previewMode . hoverEvent ) ) ;
252253
253254 //monitoring for div.popover.hover-popover.file-embed.is-loaded to be added to the DOM tree
254255 // this.observer = observer;
@@ -263,10 +264,10 @@ export default class DBFolderPlugin extends Plugin {
263264
264265 this . app . workspace . onLayoutReady ( ( ) => {
265266 this . register (
266- around ( ( this . app as any ) . commands , {
267+ around ( ( app as any ) . commands , {
267268 executeCommandById ( next ) {
268269 return function ( command : string ) {
269- const view = self . app . workspace . getActiveViewOfType ( DatabaseView ) ;
270+ const view = app . workspace . getActiveViewOfType ( DatabaseView ) ;
270271
271272 if ( view ) {
272273 //view.emitter.emit('hotkey', command);
@@ -332,7 +333,7 @@ export default class DBFolderPlugin extends Plugin {
332333 // Add a menu item to go back to database view
333334 this . register (
334335 around ( MarkdownView . prototype , {
335- onMoreOptionsMenu ( next ) {
336+ onPaneMenu ( next ) {
336337 return function ( menu : Menu ) {
337338 const file = this . file ;
338339 const cache = file
0 commit comments