Skip to content

Commit 2e79fd6

Browse files
committed
Merge branch 'master' into release
2 parents 4c6c6ec + 222f0dd commit 2e79fd6

File tree

7 files changed

+28
-21
lines changed

7 files changed

+28
-21
lines changed

exampleVault/.obsidian/plugins/obsidian-meta-bind-plugin/main.js

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exampleVault/.obsidian/plugins/obsidian-meta-bind-plugin/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "obsidian-meta-bind-plugin",
33
"name": "Meta Bind Plugin",
4-
"version": "0.3.0",
4+
"version": "0.3.1",
55
"minAppVersion": "0.14.0",
66
"description": "This plugin can create input fields inside your notes and bind them to metadata fields.",
77
"author": "Moritz Jung",

exampleVault/examples fg.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ rating: 31
33
title: test title test test
44
completed: false
55
toggle1: false
6-
slider1: 5
6+
slider1: 89
77
slider2: 6
8-
text1: Test asdasd
9-
text_area1: Test teasd
10-
date1: 2022-05-28
8+
text1: Test
9+
text_area1: Test test
10+
date1: Wednesday, July 20th 2022
1111
select: option b
12+
nested:
13+
object: dfgdf
1214
multi_select:
1315
- option a
1416
- option c
@@ -88,6 +90,9 @@ option(option d)
8890
> [!INFO]
8991
> `INPUT[slider(addLabels, minValue(1), maxValue(10)):slider1]`
9092
93+
## Nested data
94+
`INPUT[text:nested.object]`
95+
9196
---
9297

9398
## Linking to a different note

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "obsidian-meta-bind-plugin",
33
"name": "Meta Bind Plugin",
4-
"version": "0.3.1",
4+
"version": "0.3.2",
55
"minAppVersion": "0.14.0",
66
"description": "This plugin can create input fields inside your notes and bind them to metadata fields.",
77
"author": "Moritz Jung",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-meta-bind-plugin",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "This plugin can create input fields inside your notes and bind them to metadata fields.",
55
"main": "main.js",
66
"scripts": {

src/InputFieldMarkdownRenderChild.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { MetaBindBindTargetError, MetaBindInternalError } from './utils/Utils';
88
import { AbstractInputFieldArgument } from './inputFieldArguments/AbstractInputFieldArgument';
99
import { ClassInputFieldArgument } from './inputFieldArguments/ClassInputFieldArgument';
1010
import { getFrontmatterOfTFile, updateOrInsertFieldInTFile } from '@opd-libs/opd-metadata-lib/lib/API';
11-
import { validatePath as validateObjectPath } from '@opd-libs/opd-metadata-lib/lib/Utils';
11+
import { traverseObject, validatePath as validateObjectPath } from '@opd-libs/opd-metadata-lib/lib/Utils';
1212

1313
export enum InputFieldMarkdownRenderChildType {
1414
INLINE_CODE_BLOCK,
@@ -183,8 +183,8 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
183183
}
184184

185185
getInitialValue(): any | undefined {
186-
if (this.inputFieldDeclaration?.isBound) {
187-
return this.metaData[this.bindTargetMetadataField ?? ''] ?? this.inputField?.getDefaultValue();
186+
if (this.inputFieldDeclaration?.isBound && this.bindTargetMetadataField) {
187+
return traverseObject(this.bindTargetMetadataField, this.metaData) ?? this.inputField?.getDefaultValue();
188188
}
189189
}
190190

src/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { getFileName, isPath, removeFileEnding } from './utils/Utils';
55
import { Logger } from './utils/Logger';
66
import { DateParser } from './parsers/DateParser';
77
import { InputFieldDeclarationParser } from './parsers/InputFieldDeclarationParser';
8-
import { getFrontmatterOfTFile } from '@opd-libs/opd-metadata-lib/lib/API';
8+
import { getFieldFromTFile, getFrontmatterOfTFile } from '@opd-libs/opd-metadata-lib/lib/API';
9+
import { traverseObject } from '@opd-libs/opd-metadata-lib/lib/Utils';
910

1011
export default class MetaBindPlugin extends Plugin {
1112
// @ts-ignore defined in `onload`
@@ -95,7 +96,7 @@ export default class MetaBindPlugin extends Plugin {
9596
if (metadata === undefined) {
9697
metadata = getFrontmatterOfTFile(file, this);
9798
}
98-
activeMarkdownInputField.pushToInputFieldValueUpdateQueue(metadata[activeMarkdownInputField.bindTargetMetadataField]);
99+
activeMarkdownInputField.pushToInputFieldValueUpdateQueue(traverseObject(activeMarkdownInputField.bindTargetMetadataField, metadata));
99100
}
100101
}
101102
}

0 commit comments

Comments
 (0)