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

Commit 8055312

Browse files
committed
Merge branch '172-support-for-popout-windows'
2 parents 6299ac3 + d4ffebd commit 8055312

File tree

7 files changed

+24
-29
lines changed

7 files changed

+24
-29
lines changed

manifest-beta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"id": "dbfolder",
33
"name": "DB Folder",
4-
"version": "1.7.0",
5-
"minAppVersion": "0.14.8",
4+
"version": "1.8.0",
5+
"minAppVersion": "0.15.3",
66
"description": "Folder with the capability to store and retrieve data from a folder like database",
77
"author": "RafaelGB",
88
"authorUrl": "https://github.com/RafaelGB/obsidian-bd-folder",

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "dbfolder",
33
"name": "DB Folder",
44
"version": "1.8.0",
5-
"minAppVersion": "0.14.8",
5+
"minAppVersion": "0.15.3",
66
"description": "Folder with the capability to store and retrieve data from a folder like database",
77
"author": "RafaelGB",
88
"authorUrl": "https://github.com/RafaelGB/obsidian-bd-folder",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"eslint": "8.15.0",
4141
"jest": "27.5.1",
4242
"jest-mock-extended": "2.0.6",
43-
"obsidian": "0.15.1",
43+
"obsidian": "0.15.3",
4444
"rollup": "2.75.5",
4545
"rollup-plugin-typescript2": "0.32.0",
4646
"rollup-plugin-terser": "7.0.2",

src/components/reducers/GlobalFilter.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
22
import "regenerator-runtime/runtime";
33
import { useAsyncDebounce } from "react-table";
4-
import { StyleVariables } from "helpers/Constants";
54
import { GlobalFilterProps } from "cdm/MenuBarModel";
65

76
/**

src/main.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ 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';
3333
import { LOGGER } from 'services/Logger';
34-
import { DatabaseCore, DatabaseFrontmatterOptions, DEFAULT_SETTINGS } from 'helpers/Constants';
34+
import { DatabaseCore, DatabaseFrontmatterOptions, DEFAULT_SETTINGS, YAML_INDENT } from 'helpers/Constants';
3535
import { PreviewDatabaseModeService } from 'services/MarkdownPostProcessorService';
3636

3737
export default class DBFolderPlugin extends Plugin {
@@ -195,13 +195,13 @@ export default class DBFolderPlugin extends Plugin {
195195
this.app.fileManager as any
196196
).createNewMarkdownFile(targetFolder, 'Untitled database');
197197

198-
await this.app.vault.modify(
198+
await app.vault.modify(
199199
database,
200200
DatabaseFrontmatterOptions.BASIC
201201
.concat('\n')
202202
.concat(this.defaultConfiguration())
203203
);
204-
await this.app.workspace.activeLeaf.setViewState({
204+
await app.workspace.getMostRecentLeaf().setViewState({
205205
type: DatabaseCore.FRONTMATTER_KEY,
206206
state: { file: database.path },
207207
});
@@ -215,20 +215,16 @@ export default class DBFolderPlugin extends Plugin {
215215
*/
216216
defaultConfiguration(): string {
217217
const local_settings = this.settings.local_settings;
218-
return [
219-
`config:`,
220-
` enable_show_state: ${local_settings.enable_show_state}`,
221-
` group_folder_column: `,
222-
` remove_field_when_delete_column: ${local_settings.remove_field_when_delete_column}`,
223-
` cell_size: ${local_settings.cell_size}`,
224-
` sticky_first_column: ${local_settings.sticky_first_column}`,
225-
` show_metadata_created: ${local_settings.show_metadata_created}`,
226-
` show_metadata_modified: ${local_settings.show_metadata_modified}`,
227-
` source_data: ${local_settings.source_data}`,
228-
` source_form_result: ${local_settings.source_form_result}`,
229-
`%%>`
230-
].join('\n');
218+
const defaultConfig = [];
219+
defaultConfig.push("config:");
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}`);
223+
});
224+
defaultConfig.push("%%>");
225+
return defaultConfig.join('\n');
231226
}
227+
232228
registerEvents() {
233229
this.registerEvent(
234230
this.app.workspace.on('file-menu', (menu, file: TFile) => {
@@ -253,7 +249,7 @@ export default class DBFolderPlugin extends Plugin {
253249
this.registerMarkdownPostProcessor(previewMode.markdownPostProcessor);
254250

255251
// internal-link quick preview
256-
this.registerEvent(this.app.workspace.on("quick-preview", previewMode.hoverEvent));
252+
this.registerEvent(app.workspace.on("quick-preview", previewMode.hoverEvent));
257253

258254
//monitoring for div.popover.hover-popover.file-embed.is-loaded to be added to the DOM tree
259255
// this.observer = observer;
@@ -268,10 +264,10 @@ export default class DBFolderPlugin extends Plugin {
268264

269265
this.app.workspace.onLayoutReady(() => {
270266
this.register(
271-
around((this.app as any).commands, {
267+
around((app as any).commands, {
272268
executeCommandById(next) {
273269
return function (command: string) {
274-
const view = self.app.workspace.getActiveViewOfType(DatabaseView);
270+
const view = app.workspace.getActiveViewOfType(DatabaseView);
275271

276272
if (view) {
277273
//view.emitter.emit('hotkey', command);
@@ -337,7 +333,7 @@ export default class DBFolderPlugin extends Plugin {
337333
// Add a menu item to go back to database view
338334
this.register(
339335
around(MarkdownView.prototype, {
340-
onMoreOptionsMenu(next) {
336+
onPaneMenu(next) {
341337
return function (menu: Menu) {
342338
const file = this.file;
343339
const cache = file

src/parsers/handlers/marshall/MarshallConfigHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ export class MarshallConfigHandler extends AbstractYamlHandler {
1515
} else {
1616
Object.entries(DEFAULT_SETTINGS.local_settings).forEach(([key, value]) => {
1717
if (this.checkNullable(yaml.config[key as keyof LocalSettings])) {
18-
yaml.config = this.loadDefaultConfig(key, value, yaml.config);
18+
yaml.config = this.loadDefaultConfig(key as keyof LocalSettings, value, yaml.config);
1919
if (value !== "") {
2020
this.addError(`There was not "${key}" key in yaml. Default value "${value}" will be loaded`);
2121
}
2222
}
2323
// Check type of default value
2424
if (typeof value === "boolean") {
25-
yaml.config = this.parseBoolean(key, yaml.config);
25+
yaml.config = this.parseBoolean(key as keyof LocalSettings, yaml.config);
2626
}
2727
});
2828
}

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)