obsidian-task-collector icon indicating copy to clipboard operation
obsidian-task-collector copied to clipboard

support for dataview task view

Open imed-ghomari opened this issue 3 years ago • 9 comments

Given that the latest beta support alternate checkboxes https://github.com/blacksmithgu/obsidian-dataview/issues/812, would it be possible to change their status via this plugin's right click menu ?

imed-ghomari avatar Apr 04 '22 17:04 imed-ghomari

I'll have to try it.

ebullient avatar Apr 04 '22 20:04 ebullient

I'm wondering about the same thing! I can put in some of the work to make this happen, I think, with some guidance...

It seems like it's not super straightforward. If I'm reading the TC code right, the plugin picks up the task to complete by reading the line that's activated by the right-click action (line 112):

https://github.com/ebullient/obsidian-task-collector/blob/75640e7ec5a2d3b1232cedf8a23693cab2d26fb5/src/taskcollector-Plugin.ts#L103-L116

Dataview items, though, aren't really on "lines," are they?

And yet, when I look under the hood at the HTML in Reading mode, I can't see a difference between Dataview Tasklist-generated checkboxes and "regular" checkboxes. Why is Task Collector adding this menu to a regular checkbox.... Screen Shot 2022-04-26 at 9 21 10 AM

... but not this dataview-generated checkbox? Screen Shot 2022-04-26 at 9 21 34 AM

ryanjamurphy avatar Apr 26 '22 11:04 ryanjamurphy

Dataview tasks are not added using the markdown renderer, so the markdown post-processor doesn't see them (which means I can't add the event handler to them). It creates the input boxes directly, and uses its own click handler (which TC would be in a race with, effectively).

In the end, I need some help from dataview to get this to work. I added some comments here: https://github.com/blacksmithgu/obsidian-dataview/issues/812

I was able to get pretty close, but there was a bit of fighting between my handler and the dataview handler. I was also missing the dataview context, so while I could update the source correctly, the task view wasn't updated to show that...

ebullient avatar Apr 26 '22 12:04 ebullient

How funny that that conversation happened less than a day ago. Serendipity! I had no idea anyone else was thinking about this 'til I started poking around this morning.

It looks like @blacksmithgu might get it the rest of the way. Fingers crossed. 🤞

ryanjamurphy avatar Apr 26 '22 13:04 ryanjamurphy

I was playing with it yesterday. Great minds... ;)

ebullient avatar Apr 26 '22 13:04 ebullient

This is .. a way: https://github.com/blacksmithgu/obsidian-dataview/pull/1048

ebullient avatar Apr 26 '22 21:04 ebullient

My hero!

ryanjamurphy avatar Apr 27 '22 13:04 ryanjamurphy

I think the outstanding user question is which way it should go. I have a BRAT release with a Task Collector API (so things can invoke the modal w/ complete/incomplete task completion characters defined), that's how the above PR works.

Alternately, Dataview could provide a hook so that I can override the event listener. The advantage there is that Task Collector can consolidate marking tasks (complete/reset, etc), which would make things more consistent across Dataview and elsewhere.

Not sure which is better or which makes more sense.

ebullient avatar Apr 27 '22 13:04 ebullient

I'm adding the ability for plugins to override or extend the default dataview task hook in the next beta :)

blacksmithgu avatar Apr 27 '22 19:04 blacksmithgu