Skip to content

Commit 0fc6331

Browse files
committed
Merge branch 'master' into release
2 parents bc7f1f2 + 79afb27 commit 0fc6331

File tree

13 files changed

+119
-64
lines changed

13 files changed

+119
-64
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ For more examples see the `exampleVault` folder.
2828
- `select` a select input field, only for code blocks
2929
- `multi_select` a multi-select input field, only for code blocks
3030
- `date` a date input field
31+
- `date_picker` a date picker
3132

3233
#### Arguments
3334
- `class(class_name)` adds a css class to the input field
@@ -36,9 +37,10 @@ For more examples see the `exampleVault` folder.
3637
- `maxValue(value)` only for slider, sets the max value
3738
- `option(value)` only for (multi-)selects, adds an option to the select
3839
- `title(value)` only for (multi-)selects, adds a title to the select input
40+
- `alignRight` only for date picker, aligns the date picker popup to the right of the input field
3941

4042
### How to install
41-
You must manually download the zip archive from the latest release here on GitHub.
43+
You can eiter download it directly through Obsidian's plugin page or you can manually download the zip archive from the latest release here on GitHub.
4244
After downloading, extract the archive into the `.obsidian/plugins` folder in your vault.
4345

4446
The folder structure should look like this:

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

Lines changed: 78 additions & 49 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.2.1",
4+
"version": "0.3.0",
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.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ option(option d)
121121
):other note#multi-select]
122122
```
123123

124-
Lorem ipsum dolor sit amet, `INPUT[date():other note#date]` consectetur adipiscing elit. Pellentesque sit amet porttitor arcu. Quisque scelerisque dolor augue, et posuere nulla bibendum nec. `INPUT[date():other note#date]` Curabitur sed rhoncus nisl. Maecenas nisi justo, viverra vel tempus vel, hendrerit at metus. `INPUT[date_picker:other note#date]` asdasd asdasdasd
124+
Lorem ipsum dolor sit amet, `INPUT[date():other note#date]` consectetur adipiscing elit. Pellentesque sit amet porttitor arcu. Quisque scelerisque dolor augue, et posuere nulla bibendum nec. `INPUT[date():other note#date]` Curabitur sed rhoncus nisl. Maecenas nisi justo, viverra vel tempus vel, hendrerit at metus. `INPUT[date_picker():other note#date]` asdasd asdasdasd
125125

126126
asdasd
127127

exampleVault/other note.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: asdasds sdf sasdfnosdijn sdaskdjasbokbfosdasdasdasd asd asdasda f
3-
select: option b
2+
title: asdasds sdf sasdfnosdijn sdaskdjasbokbfosdasdasdasd asd asd
3+
select: option a
44
multi-select:
5-
- option b
5+
- option a
66
- option c
7-
date: Monday, June 4th 2029
7+
date: Wednesday, June 6th 2029
88
time: 19:20
99
---

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.2.1",
4+
"version": "0.3.0",
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.2.1",
3+
"version": "0.3.0",
44
"description": "This plugin can create input fields inside your notes and bind them to metadata fields.",
55
"main": "main.js",
66
"scripts": {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {AbstractInputFieldArgument} from './AbstractInputFieldArgument';
2+
import {InputFieldArgumentType, InputFieldType} from '../parsers/InputFieldDeclarationParser';
3+
4+
export class AlignRightInputFieldArgument extends AbstractInputFieldArgument {
5+
identifier: InputFieldArgumentType = InputFieldArgumentType.ALIGN_RIGHT;
6+
allowedInputFields: InputFieldType[] = [
7+
InputFieldType.DATE_PICKER,
8+
];
9+
value: boolean = true;
10+
requiresValue: boolean = false;
11+
allowMultiple: boolean = false;
12+
13+
parseValue(valueStr: string): void {
14+
this.value = (valueStr.toLowerCase() === 'true');
15+
}
16+
}

src/inputFieldArguments/InputFieldArgumentFactory.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {MinValueInputFieldArgument} from "./MinValueInputFieldArgument";
66
import {MaxValueInputFieldArgument} from "./MaxValueInputFieldArgument";
77
import {OptionInputFieldArgument} from "./OptionInputFieldArgument";
88
import {TitleInputFieldArgument} from "./TitleInputFieldArgument";
9+
import {AlignRightInputFieldArgument} from './AlignRightInputFieldArgument';
910

1011

1112
export class InputFieldArgumentFactory {
@@ -22,6 +23,8 @@ export class InputFieldArgumentFactory {
2223
return new OptionInputFieldArgument();
2324
} else if (argumentIdentifier === InputFieldArgumentType.TITLE) {
2425
return new TitleInputFieldArgument();
26+
} else if (argumentIdentifier === InputFieldArgumentType.ALIGN_RIGHT) {
27+
return new AlignRightInputFieldArgument();
2528
} else {
2629
throw new MetaBindParsingError(`unknown argument \'${argumentIdentifier}\'`);
2730
}

src/inputFields/DatePicker/DatePicker.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
export let dateFormat: string = 'dddd, MMMM Do YYYY';
1313
export let dateChangeCallback: (date: Moment) => void;
1414
15+
export let alignRight: boolean;
16+
1517
let date: number;
1618
let month: number;
1719
let year: number;
@@ -68,7 +70,6 @@
6870
.date-picker {
6971
position: absolute;
7072
top: 35px;
71-
left: 0;
7273
display: inline-block;
7374
background: var(--background-secondary);
7475
border-radius: var(--meta-bind-plugin-border-radius);
@@ -134,7 +135,7 @@
134135
</div>
135136
{#if showDatePicker}
136137
<div class="date-picker-close-layer" on:click={() => showDatePicker = false}></div>
137-
<div class="date-picker">
138+
<div class="date-picker" style="{alignRight ? 'left: auto; right: 0;' : 'right: auto; left: 0;'}">
138139
<div class="date-picker-header">
139140
<button class="month-switch-button" on:click={prevMonth}>Prev</button>
140141
<div class="date-picker-header-text">

0 commit comments

Comments
 (0)