Is there an event for checkbox toggle?

Recently, Im developing a todo management plugin.
I wonder if there is any checkbox toggle event. It would be very convenient for developing.

2 Likes

Hi there! Wondering the same. Have you found out anything in the meantime?

not yet.
I tried go through the documents, but nothing found.

I also did a bit of research there: So it seems that there isn’t any event published when a checkbox-item is completed. You can see all the published events by executing

monitorEvents(window)

in the dev-tools-console.

One possible solution for this would be to listen and react to the checkbox being completed on your own. So something like this would theoretically work (js pseudocode):

window.addEventListener("keydown", (event) => {
  if (event.key === shortcuts.CompleteCheckbox && isTodo(currentLine)) {
    let checkList = getChecklist(currentLine);
    checkList = moveLineToEnd(currentLine);
    modify(currentDocmuent);
  }
})

however it has two drawbacks:

  1. It listens to every keydown-event which is very much overhead
  2. There is no possibility react to a todo getting completed via a mouse-click

So I’m not happy with this approach yet.