Skip to content

Commit d9e0a22

Browse files
committed
merge fixes
1 parent fe2a2fa commit d9e0a22

File tree

5 files changed

+32
-28
lines changed

5 files changed

+32
-28
lines changed

exampleVault/examples fg.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@ rating: 31
33
title: test title test test
44
completed: false
55
toggle1: true
6-
slider1: 17
6+
slider1: 24
77
slider2: 8
88
text1: Testa
99
text_area1: test test test
1010
date1: Wednesday, July 20th 2022
11-
select: option c
11+
select: option b
1212
nested:
1313
object: dfgdf
1414
multi_select:
1515
- option a
16-
- option b
17-
- option c
16+
- option d
1817
time1: 10:17
1918
suggest: test
2019
editor: test **test**

exampleVault/other note.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
tags: test
33
title: "test test test "
4-
select: option c
4+
select: option b
55
date: Tuesday, June 21st 2022
66
time: 19:20
77
multi-select:
8+
- option a
89
- option b
910
- option c
1011
---

src/InputFieldMarkdownRenderChild.ts

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import { MarkdownRenderChild, TFile } from 'obsidian';
22
import MetaBindPlugin from './main';
33
import { AbstractInputField } from './inputFields/AbstractInputField';
44
import { InputFieldFactory } from './inputFields/InputFieldFactory';
5-
import { InputFieldArgumentType, InputFieldDeclaration, InputFieldDeclarationParser } from './parsers/InputFieldDeclarationParser';
6-
import { isFalsy, isTruthy, MetaBindBindTargetError, MetaBindInternalError } from './utils/Utils';
5+
import { InputFieldArgumentType, InputFieldDeclaration } from './parsers/InputFieldDeclarationParser';
76
import { AbstractInputFieldArgument } from './inputFieldArguments/AbstractInputFieldArgument';
87
import { ClassInputFieldArgument } from './inputFieldArguments/ClassInputFieldArgument';
98
import { parsePath, traverseObjectByPath } from '@opd-libs/opd-metadata-lib/lib/Utils';
@@ -33,7 +32,15 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
3332
metadataValueUpdateQueue: any[];
3433
inputFieldValueUpdateQueue: any[];
3534

36-
constructor(containerEl: HTMLElement, type: InputFieldMarkdownRenderChildType, fullDeclaration: string, plugin: MetaBindPlugin, filePath: string, uuid: string, error?: string) {
35+
constructor(
36+
containerEl: HTMLElement,
37+
type: InputFieldMarkdownRenderChildType,
38+
declaration: InputFieldDeclaration,
39+
plugin: MetaBindPlugin,
40+
filePath: string,
41+
uuid: string,
42+
error?: string
43+
) {
3744
super(containerEl);
3845

3946
this.error = error || '';
@@ -48,24 +55,20 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
4855
this.intervalCounter = 0;
4956
this.inputFieldDeclaration = declaration;
5057

51-
this.uid = this.plugin.markDownInputFieldIndex;
52-
this.plugin.markDownInputFieldIndex += 1;
53-
5458
if (!error) {
55-
try {
56-
if (this.inputFieldDeclaration.isBound) {
57-
this.parseBindTarget();
58-
}
59-
60-
61-
this.inputField = InputFieldFactory.createInputField(this.inputFieldDeclaration.inputFieldType, {
62-
type: type,
63-
inputFieldMarkdownRenderChild: this,
64-
onValueChanged: this.updateMetadataManager.bind(this),
65-
});
66-
} catch (e: any) {
67-
this.error = e.message;
68-
console.warn(e);
59+
try {
60+
if (this.inputFieldDeclaration.isBound) {
61+
this.parseBindTarget();
62+
}
63+
64+
this.inputField = InputFieldFactory.createInputField(this.inputFieldDeclaration.inputFieldType, {
65+
type: type,
66+
inputFieldMarkdownRenderChild: this,
67+
onValueChanged: this.updateMetadataManager.bind(this),
68+
});
69+
} catch (e: any) {
70+
this.error = e.message;
71+
console.warn(e);
6972
}
7073
}
7174
}

src/MetadataManager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export class MetadataManager {
5353
this.plugin.app.vault.cachedRead(file).then(value => {
5454
c.metadata = getMetaDataFromFileContent(value);
5555
console.log(`meta-bind | MetadataManager >> loaded metadata for file ${file.path}`, c.metadata);
56+
debugger;
5657
this.notifyListeners(c);
5758
});
5859

src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { CachedMetadata, editorEditorField, MarkdownPostProcessorContext, Plugin, TFile } from 'obsidian';
2-
import { Plugin, TFile } from 'obsidian';
32
import { DEFAULT_SETTINGS, MetaBindPluginSettings, MetaBindSettingTab } from './settings/Settings';
43
import { InputFieldMarkdownRenderChild, InputFieldMarkdownRenderChildType } from './InputFieldMarkdownRenderChild';
54
import { getFileName, isPath, removeFileEnding } from './utils/Utils';
65
import { DateParser } from './parsers/DateParser';
7-
import { InputFieldDeclarationParser } from './parsers/InputFieldDeclarationParser';
6+
import { InputFieldArgumentType, InputFieldDeclaration, InputFieldDeclarationParser, InputFieldType } from './parsers/InputFieldDeclarationParser';
87
import { MetadataManager } from './MetadataManager';
8+
import { MetaBindBindTargetError } from './utils/MetaBindErrors';
99

1010
export default class MetaBindPlugin extends Plugin {
1111
// defined in `loadSettings`
@@ -83,7 +83,7 @@ export default class MetaBindPlugin extends Plugin {
8383
}
8484
}
8585

86-
return new InputFieldMarkdownRenderChild(container, renderType, declaration as InputFieldDeclaration, this, sourcePath, error);
86+
return new InputFieldMarkdownRenderChild(container, renderType, declaration as InputFieldDeclaration, this, sourcePath, crypto.randomUUID(), error);
8787
}
8888

8989
/**

0 commit comments

Comments
 (0)