Skip to content

Commit

Permalink
fix bug in tasks keyboad handling which I very recently introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
williamstein committed Oct 19, 2024
1 parent 59eea8c commit dfef472
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/packages/frontend/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ async function callApi(
await delay(RETRY_DELAY_MS);
return await callApi(endpoint, args, numRetriesOnFail - 1);
}
console.log("json = ", json);
if (json == null) {
throw Error("timeout -- try again later");
}
Expand Down
8 changes: 8 additions & 0 deletions src/packages/frontend/editors/task-editor/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,14 @@ export class TaskActions extends Actions<TaskState> {
this.set_local_task_state(task_id, { editing_desc: false });
}

isEditing = () => {
const task_id = this.getFrameData("current_task_id");
return !!this.getFrameData("local_task_state")?.getIn([
task_id,
"editing_desc",
]);
};

// null=unselect all.
public edit_desc(task_id: string | undefined | null): void {
// close any that were currently in edit state before opening new one
Expand Down
5 changes: 4 additions & 1 deletion src/packages/frontend/editors/task-editor/keyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ function is_sortable(actions): boolean {
}

export function create_key_handler(actions): (any) => void {
return function (evt) {
return (evt) => {
if (actions.isEditing()) {
return;
}
const read_only = !!actions.store.get("read_only");
const mod = evt.ctrlKey || evt.metaKey || evt.altKey || evt.shiftKey;

Expand Down

0 comments on commit dfef472

Please sign in to comment.