fixed deleting task on text del

This commit is contained in:
poanse 2026-03-20 09:16:07 +03:00
parent 7af472312e
commit 2244ad95dd
2 changed files with 9 additions and 1 deletions

View file

@ -148,6 +148,7 @@
onpointerup={onPointerUp}
onblur={() => finishEditing()}
role="presentation"
tabindex="-1"
>
<TaskText {taskId} {isUnselected} {context}/>
</div>

View file

@ -125,11 +125,17 @@
if (e.key === "Enter") {
e.preventDefault();
textEditEl.blur(); // Triggers handleBlur
// TODO: body gets focused instead of viewport
} else if (e.key === "Tab" && suggest !== null) {
// another hack to select suggest on tab
e.preventDefault();
textEditEl.dispatchEvent(new KeyboardEvent('keydown', {key: 'Enter'}));
} else if (e.key == "Escape" && isEditing) {
e.stopPropagation();
textEditEl.blur();
} else if (e.key == "Escape") {
textEditEl.blur();
} else {
e.stopPropagation();
}
}
@ -137,6 +143,7 @@
// TODO: throws error because text preview doesn't exit when blur on textedit happens
context.editingTaskId = NoTaskId;
handleInput();
textEditEl?.parentElement?.parentElement?.focus();
await tick(); // Wait for DOM to render preview element
await renderMarkdown();
}