fixed edited entry names not actually being saved

This commit is contained in:
Ell 2022-10-10 15:05:59 +02:00
parent 93440d385a
commit bce221aaaa
2 changed files with 16 additions and 10 deletions

View file

@ -112,17 +112,20 @@ export function displayTracker(tracker: Tracker, element: HTMLElement, getSectio
.setClass("clickable-icon") .setClass("clickable-icon")
.setTooltip("Edit") .setTooltip("Edit")
.setIcon("lucide-pencil") .setIcon("lucide-pencil")
.onClick(() => { .onClick(async () => {
if (namePar.hidden) { if (namePar.hidden) {
namePar.hidden = false; namePar.hidden = false;
nameBox.inputEl.hidden = true; nameBox.inputEl.hidden = true;
if (nameBox.getValue())
namePar.setText(nameBox.getValue());
editButton.setIcon("lucide-pencil"); editButton.setIcon("lucide-pencil");
if (nameBox.getValue()) {
entry.name = nameBox.getValue();
namePar.setText(entry.name);
await saveTracker(tracker, this.app, getSectionInfo());
}
} else { } else {
namePar.hidden = true; namePar.hidden = true;
nameBox.inputEl.hidden = false; nameBox.inputEl.hidden = false;
nameBox.setValue(namePar.getText()); nameBox.setValue(entry.name);
editButton.setIcon("lucide-check"); editButton.setIcon("lucide-check");
} }
}); });

File diff suppressed because one or more lines are too long