From 59ab0cbaff0960c6b179926bdc5e05178a8adaf6 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Wed, 28 Feb 2024 10:55:08 +0100 Subject: [PATCH] Emit task:stateChange event --- plugs/tasks/task.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugs/tasks/task.ts b/plugs/tasks/task.ts index 7c7830b6..a1d1c624 100644 --- a/plugs/tasks/task.ts +++ b/plugs/tasks/task.ts @@ -1,6 +1,6 @@ import type { ClickEvent, IndexTreeEvent } from "$type/types.ts"; -import { editor, markdown, space, sync } from "$sb/syscalls.ts"; +import { editor, events, markdown, space, sync } from "$sb/syscalls.ts"; import { addParentPointers, @@ -191,6 +191,13 @@ async function cycleTaskState( await updateTaskState(ref, stateText, changeTo); } } + + await events.dispatchEvent("task:stateChange", { + from: node.parent!.from, + to: node.parent!.to, + newState: changeTo, + text: renderToText(node.parent), + }); } export async function updateTaskState(