Use a bullet instead of a dash for the task

cycle-task-create
Zef Hemel 2024-09-29 13:29:37 +02:00
parent 9387bd988c
commit e5e2245a2d
1 changed files with 6 additions and 7 deletions

View File

@ -178,13 +178,13 @@ export function previewTaskToggle(eventString: string) {
} }
} }
async function convertListItemToTask(node: ParseTree){ async function convertListItemToTask(node: ParseTree) {
const listMark = node.children![0]; const listMark = node.children![0];
await editor.dispatch({ await editor.dispatch({
changes: { changes: {
from: listMark.from, from: listMark.from,
to: listMark.to, to: listMark.to,
insert: "- [ ]", insert: "* [ ]",
}, },
}); });
} }
@ -334,17 +334,16 @@ export async function taskCycleCommand() {
return; return;
} }
console.log("Node", node); console.log("Node", node);
const taskNode = const taskNode = node.type === "Task"
node.type === "Task" ? node
? node : findParentMatching(node!, (n) => n.type === "Task");
: findParentMatching(node!, (n) => n.type === "Task");
if (taskNode) { if (taskNode) {
const taskState = findNodeOfType(taskNode!, "TaskState"); const taskState = findNodeOfType(taskNode!, "TaskState");
if (taskState) { if (taskState) {
await cycleTaskState(taskState); await cycleTaskState(taskState);
} }
return return;
} }
// Convert a bullet point to a task // Convert a bullet point to a task