Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit d4ffebd

Browse files
committed
fix add new ddbb with v15 of obsidian
1 parent 6ad877a commit d4ffebd

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/main.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
import {
2727
DBFolderAPI
2828
} from 'api/plugin-api';
29-
import { DatabaseSettings } from 'cdm/SettingsModel';
29+
import { DatabaseSettings, LocalSettings } from 'cdm/SettingsModel';
3030

3131
import StateManager from 'StateManager';
3232
import { 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

src/services/DatabaseInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default class DatabaseInfo {
3838
const response = DatabaseStringToYamlParser(frontmatterRaw);
3939
if (Object.keys(response.errors).length > 0) {
4040
const errors = Object.keys(response.errors).map(e => e + ': ' + response.errors[e].join('\n')).join('\n')
41-
new Notice(errors);
41+
new Notice(errors, 10000);
4242
if (!response.yaml.config) response.yaml.config = default_local_settings;
4343
}
4444

0 commit comments

Comments
 (0)