if (!target) return null;
if (target.hasAttribute("data-description")) {
// Oh no: An edit has arrived from a replica while a local edit is in progress.
- const input = target.children[0] as HTMLInputElement;
+ const input = target.firstChild as HTMLInputElement;
if (
input.value === target.getAttribute("data-description") &&
input.selectionStart === input.value.length &&
const [createTimestamp, description] = splitN(data, " ", 1);
return Model.edit(createTimestamp, description);
}
- if (command == "State") {
- const [createTimestamp, state] = splitN(data, " ", 1);
- return Model.setState(timestamp, createTimestamp, state);
- }
if (command == "Priority") {
const [createTimestamp, newPriority] = splitN(data, " ", 1);
return Model.setPriority(createTimestamp, parseFloat(newPriority));
}
+ if (command == "State") {
+ const [createTimestamp, state] = splitN(data, " ", 1);
+ return Model.setState(timestamp, createTimestamp, state);
+ }
},
record: function (entry: string) {
const oldDescription = task.getAttribute("data-description")!;
const newDescription = input.value;
input.removeEventListener("blur", this.completeEdit);
- task.removeChild(task.children[0]);
+ task.removeChild(input);
task.removeAttribute("data-description");
task.focus();
if (newDescription === oldDescription || resolution === CommitOrAbort.Abort) {