Skip to content

Commit cc71537

Browse files
committed
fix styles for obsidian version 1.5.0
1 parent 95a04d7 commit cc71537

File tree

4 files changed

+51
-36
lines changed

4 files changed

+51
-36
lines changed

exampleVault/Advanced Examples/PF2e Encounter Calculator.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ const bindTarget = mb.createBindTarget('enemy');
3838
const tableHead = ['Name', 'Level', 'Variant', 'Count'];
3939
const columns = [
4040
mb.inputField.createInputFieldDeclarationFromString('INPUT[text:^.name]'),
41-
mb.inputField.createInputFieldDeclarationFromString('INPUT[number:^.level]'),
41+
mb.inputField.createInputFieldDeclarationFromString('INPUT[number(class(meta-bind-small-width)):^.level]'),
4242
mb.inputField.createInputFieldDeclarationFromString('INPUT[inlineSelect(option(-1, weak), option(0, normal), option(1, elite)):^.variant]'),
43-
mb.inputField.createInputFieldDeclarationFromString('INPUT[number:^.count]')
43+
mb.inputField.createInputFieldDeclarationFromString('INPUT[number(class(meta-bind-small-width)):^.count]')
4444
];
4545
4646
mb.createTable(container, context.file.path, component, bindTarget, tableHead, columns);
@@ -50,12 +50,11 @@ mb.createTable(container, context.file.path, component, bindTarget, tableHead, c
5050

5151
```meta-bind-js-view
5252
{enemy} and children as enemies
53-
{playerCount} as playerCount
5453
{playerLevel} as playerLevel
5554
---
5655
5756
function getXP(enemyLevel) {
58-
const diff = enemyLevel - context.playerLevel;
57+
const diff = enemyLevel - context.bound.playerLevel;
5958
if (diff === -4) {
6059
return 10;
6160
}
@@ -88,7 +87,7 @@ function getXP(enemyLevel) {
8887
8988
function calculateTotalXP() {
9089
let acc = 0;
91-
for (const enemy of context.enemies) {
90+
for (const enemy of context.bound.enemies) {
9291
const xp = getXP((enemy.level ?? 0) + (enemy.variant ?? 0));
9392
if (xp === -1) {
9493
return -1;
@@ -98,7 +97,7 @@ function calculateTotalXP() {
9897
return acc;
9998
}
10099
101-
return "Encounter XP: " + calculateTotalXP()
100+
return engine.markdown.create(`Encounter XP: **${calculateTotalXP()}**`);
102101
```
103102

104103
> [!info] XP Reference

exampleVault/examples.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
slider1: 3
2+
slider1: 8
33
suggest: test
44
toggle1: false
55
Domestic_tasks:
@@ -15,10 +15,10 @@ nested:
1515
---
1616

1717
## In callouts
18-
> quote
18+
1919
> `INPUT[slider(addLabels, minValue(1), maxValue(10)):slider1]`
2020
21-
> [!INFO]
21+
> [!info]
2222
> `INPUT[slider(addLabels, minValue(1), maxValue(10)):slider1]`
2323
2424
> [!INFO]

src/metaBindTable/MetaBindTableComponent.svelte

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,37 @@
1414
}
1515
</script>
1616

17-
<table>
18-
<thead>
19-
<tr>
20-
{#each tableHead as headCell}
21-
<th>{headCell}</th>
22-
{/each}
23-
<th></th>
24-
</tr>
25-
</thead>
26-
<tbody>
27-
{#each tableCells as tableRow (tableRow.index)}
17+
<div class="mb-table-wrapper">
18+
<table class="mb-html-table">
19+
<thead>
2820
<tr>
29-
{#if tableRow.isValid}
30-
{#each tableRow.cells as tableCell}
31-
<MetaBindTableCellComponent table={table} bind:cell={tableCell}></MetaBindTableCellComponent>
32-
{/each}
33-
{:else}
34-
<td class="meta-bind-error" colspan={tableHead.length}> invalid data</td>
35-
{/if}
36-
37-
<td>
38-
<Button on:click={() => table.removeColumn(tableRow.index)}>
39-
<Icon iconName="x" />
40-
</Button>
41-
</td>
21+
{#each tableHead as headCell}
22+
<th>{headCell}</th>
23+
{/each}
24+
<th></th>
4225
</tr>
43-
{/each}
44-
</tbody>
45-
</table>
26+
</thead>
27+
<tbody>
28+
{#each tableCells as tableRow (tableRow.index)}
29+
<tr>
30+
{#if tableRow.isValid}
31+
{#each tableRow.cells as tableCell}
32+
<MetaBindTableCellComponent table={table} bind:cell={tableCell}
33+
></MetaBindTableCellComponent>
34+
{/each}
35+
{:else}
36+
<td class="meta-bind-error" colspan={tableHead.length}> invalid data</td>
37+
{/if}
38+
39+
<td>
40+
<Button on:click={() => table.removeColumn(tableRow.index)}>
41+
<Icon iconName="x" />
42+
</Button>
43+
</td>
44+
</tr>
45+
{/each}
46+
</tbody>
47+
</table>
48+
</div>
4649

4750
<Button on:click={() => table.addColumn()}>Add Column</Button>

styles.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ body {
1414

1515
.mb-input-wrapper {
1616
display: inline;
17+
white-space: normal;
1718
}
1819

1920
/* View Wrappers */
@@ -421,6 +422,14 @@ a.mb-no-link {
421422
text-decoration: none;
422423
}
423424

425+
table.mb-html-table {
426+
--table-column-min-width: 10px;
427+
}
428+
429+
.mb-table-wrapper {
430+
overflow-x: auto;
431+
}
432+
424433
/* --- UTIL CLASSES --- */
425434

426435
.meta-bind-full-width > * {
@@ -430,3 +439,7 @@ a.mb-no-link {
430439
.meta-bind-high > * {
431440
height: 200px;
432441
}
442+
443+
.meta-bind-small-width > * {
444+
width: 80px;
445+
}

0 commit comments

Comments
 (0)