Skip to content

Commit a718927

Browse files
committed
Fix macro choice selected macro display
1 parent c8aa13b commit a718927

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "quickadd",
33
"name": "QuickAdd",
4-
"version": "0.1.14",
4+
"version": "0.1.15",
55
"minAppVersion": "0.12.00",
66
"description": "Quickly add new pages or content to your vault.",
77
"author": "Christian B. B. Houmann",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "quickadd",
3-
"version": "0.1.14",
3+
"version": "0.1.15",
44
"description": "Quickly add new pages or content to your vault.",
55
"main": "main.js",
66
"scripts": {

src/gui/ChoiceBuilder/macroChoiceBuilder.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import type {IMacro} from "../../types/macros/IMacro";
88
export class MacroChoiceBuilder extends ChoiceBuilder {
99
choice: IMacroChoice;
1010
selectedMacro: IMacro;
11-
private updateSelectedMacro: (macro: IMacro) => void;
11+
private updateSelectedMacro: () => void;
1212

1313
constructor(app: App, choice: IMacroChoice, private macros: IMacro[]) {
1414
super(app);
1515
this.choice = choice;
16-
this.selectedMacro = this.macros.find(m => m.id === this.choice.macroId);
1716

1817
this.display();
1918
}
@@ -25,15 +24,17 @@ export class MacroChoiceBuilder extends ChoiceBuilder {
2524
}
2625

2726
private addSelectedMacroElement() {
28-
const selectedMacro = this.contentEl.createEl('h3');
29-
selectedMacro.style.textAlign = "center";
27+
const selectedMacroEl = this.contentEl.createEl('h3');
28+
selectedMacroEl.style.textAlign = "center";
3029

31-
this.updateSelectedMacro = (macro => {
32-
if (macro)
33-
selectedMacro.textContent = `Selected macro: ${macro.name}`;
30+
this.updateSelectedMacro = (() => {
31+
this.selectedMacro = this.macros.find(m => m.id === this.choice.macroId);
32+
33+
if (this.selectedMacro)
34+
selectedMacroEl.textContent = `Selected macro: ${this.selectedMacro.name}`;
3435
});
3536

36-
this.updateSelectedMacro(this.choice.macro);
37+
this.updateSelectedMacro();
3738
}
3839

3940
private addSelectMacroSearch() {
@@ -50,7 +51,7 @@ export class MacroChoiceBuilder extends ChoiceBuilder {
5051
if (!macro) return;
5152

5253
this.choice.macroId = macro.id;
53-
this.updateSelectedMacro(this.choice.macro);
54+
this.updateSelectedMacro();
5455

5556
searchComponent.setValue("");
5657
}

versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"0.1.14": "0.12.4"
2+
"0.1.15": "0.12.4"
33
}

0 commit comments

Comments
 (0)