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

Commit 8244948

Browse files
committed
fix bug
1 parent 9023d50 commit 8244948

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

docs/docs/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.5.1
2+
### Visual
3+
- Support for darkmode to checkbox column
4+
### No longer broken
5+
- When new row is added and metadata column of created and modified is enabled, the metadata column is automatically filled with the current date and time instead of crashing.
16
## 1.5.0
27
*Published on 2022/05/27*
38
### Shiny new things

src/components/reducers/DatabaseDispatch.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import NoteInfo from "services/NoteInfo";
2323
import { DataviewService } from "services/DataviewService";
2424
import { obtainUniqueOptionValues } from "helpers/SelectHelper";
2525
import { RowSelectOption } from "cdm/RowSelectModel";
26+
import { Literal } from "obsidian-dataview/lib/data-model/value";
27+
import { DateTime } from "luxon";
2628

2729
export function databaseReducer(state: TableDataType, action: ActionType) {
2830
LOGGER.debug(
@@ -81,10 +83,13 @@ export function databaseReducer(state: TableDataType, action: ActionType) {
8183
action.filename,
8284
rowRecord
8385
);
84-
86+
const metadata: Record<string, Literal> = {};
87+
metadata[MetadataColumns.CREATED] = DateTime.now();
88+
metadata[MetadataColumns.MODIFIED] = DateTime.now();
8589
const row: RowDataType = {
8690
...rowRecord.frontmatter,
8791
...rowRecord.inline,
92+
...metadata,
8893
id: state.data.length + 1,
8994
note: new NoteInfo(
9095
{

src/services/MarkdownPostProcessorService.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { DatabaseCore } from "helpers/Constants";
22
import DBFolderPlugin from "main";
33
import { MarkdownPostProcessorContext } from "obsidian";
4-
5-
4+
import DatabaseInfo from "services/DatabaseInfo";
5+
import { VaultManagerDB } from "services/FileManagerService";
66

77
/**
88
* Keep info about a note and offer methods to manipulate it
@@ -71,8 +71,14 @@ export class PreviewDatabaseModeService {
7171
}
7272
el.empty();
7373

74+
const dbFile = VaultManagerDB.obtainTfileFromFilePath(ctx.sourcePath);
75+
const databaseDisk = new DatabaseInfo(dbFile);
76+
await databaseDisk.initDatabaseconfigYaml(
77+
this.plugin.settings.local_settings
78+
);
7479
const div = createDiv();
75-
div.textContent = "Random Text";
80+
div.textContent = `${databaseDisk
81+
.yaml.description}`;
7682
el.appendChild(div);
7783
setTimeout(async () => {
7884
let internalEmbedDiv: HTMLElement = div;

styles.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@
143143
background-color: CanvasText;
144144
}
145145

146-
.data-input-checkbox input[type=checkbox]:checked{
147-
background-color: var(--text-muted);
146+
.data-input-checkbox input[type="checkbox"]:checked{
147+
background-color: var(--background-modifier-border);
148148
}
149149

150150
.data-input-checkbox input[type="checkbox"]:checked::before {

0 commit comments

Comments
 (0)