Skip to content

Commit

Permalink
Fix ObsidianCommands not having IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
chhoumann committed Aug 31, 2021
1 parent 46f6aa2 commit b60659a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gui/MacroGUIs/MacroBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ export class MacroBuilder extends Modal {

const addObsidianCommandFromInput = () => {
const value: string = input.getValue();
const command: IObsidianCommand = this.commands.find(v => v.name === value);
const obsidianCommand: IObsidianCommand = this.commands.find(v => v.name === value);
const command = new ObsidianCommand(obsidianCommand.name, obsidianCommand.commandId);
command.generateId();

this.addCommandToMacro(command);

Expand Down Expand Up @@ -256,6 +258,7 @@ export class MacroBuilder extends Modal {

private addCommandList() {
const commandList = this.contentEl.createDiv('commandList');
console.log(this.macro.commands);

this.commandListEl = new CommandList({
target: commandList,
Expand Down
3 changes: 3 additions & 0 deletions src/types/macros/ObsidianCommand.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Command} from "./Command";
import {CommandType} from "./CommandType";
import type {IObsidianCommand} from "./IObsidianCommand";
import {v4 as uuidv4} from "uuid";

export class ObsidianCommand extends Command implements IObsidianCommand {
name: string;
Expand All @@ -12,4 +13,6 @@ export class ObsidianCommand extends Command implements IObsidianCommand {
super(name, CommandType.Obsidian);
this.commandId = commandId;
}

generateId = () => this.id = uuidv4();
}

0 comments on commit b60659a

Please sign in to comment.