fix: Retain old formatting when editing row

This commit is contained in:
James Rupert Tan 2024-06-07 12:57:56 -05:00
parent d7b7b5ba1e
commit f308679bd2

View file

@ -357,9 +357,7 @@ function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableEle
.onClick(async () => { .onClick(async () => {
if (nameField.editing()) { if (nameField.editing()) {
entry.name = nameField.endEdit(); entry.name = nameField.endEdit();
if (entry.subEntries?.length) { expandButton.buttonEl.style.display = null;
expandButton.buttonEl.style.display = null;
}
startField.endEdit(); startField.endEdit();
entry.startTime = startField.getTimestamp(); entry.startTime = startField.getTimestamp();
if (!entryRunning) { if (!entryRunning) {
@ -372,9 +370,7 @@ function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableEle
renderNameAsMarkdown(nameField.label, getFile, component); renderNameAsMarkdown(nameField.label, getFile, component);
} else { } else {
nameField.beginEdit(entry.name); nameField.beginEdit(entry.name);
if (entry.subEntries?.length) { expandButton.buttonEl.style.display = 'none';
expandButton.buttonEl.style.display = 'none';
}
// only allow editing start and end times if we don't have sub entries // only allow editing start and end times if we don't have sub entries
if (!entry.subEntries) { if (!entry.subEntries) {
startField.beginEdit(entry.startTime); startField.beginEdit(entry.startTime);