Add ability to fold Group headings #1012
Replies: 5 comments 5 replies
-
See #1323 - a request to fold indented tasks when viewed in reading mode. |
Beta Was this translation helpful? Give feedback.
-
See #1466 - another request to fold group headings. |
Beta Was this translation helpful? Give feedback.
-
@claremacrae this is something I'd be very keen on too; I had a look at the code, how to make it work with the obsidian-tasks/src/Renderer/QueryRenderer.ts Lines 314 to 322 in e65dd75 private async addAllTaskGroups(tasksSortedLimitedGrouped: TaskGroups, content: HTMLDivElement) {
for (const group of tasksSortedLimitedGrouped.groups) {
// If there were no 'group by' instructions, group.groupHeadings
// will be empty, and no headings will be added.
const detailsGroup = content.createEl('details');
const summaryItem = content.createEl('summary'); // or detailsGroup.createEl(...)?
// detailsGroup.appendChild(summaryItem) ?
await this.addGroupHeadings(summaryItem, group.groupHeadings);
await this.createTaskList(group.tasks, detailsGroup); // does this then create the new elements within the <details></details> tag?
}
} It's been a while that I've dealt with javascript so my implementation might be completely off, but if you think that's going in the right direction, I would be happy to try and implement this. |
Beta Was this translation helpful? Give feedback.
-
I've had a look at the generated HTML and asked the following in #theme-dev in Discord: I'm not sure if this is a #plugin-dev or #theme-dev question... I think it needs more CSS expertise, so will start here.... For <div>
<h5 data-heading="Later (3 tasks)">
<div class="heading-collapse-indicator collapse-indicator collapse-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="svg-icon right-triangle">
<path d="M3 8L12 17L21 8"></path>
</svg>
</div>
Later (3 tasks)
</h5>
</div> (The above code is the same, regardless of whether or not And Tasks generates: <h5 class="tasks-group-heading">
<p>Later (3 tasks)</p>
</h5> Should I simply rewrite the heading-creation in Tasks, to mimic those 10 or so lines of Obsidian code (and would it then work on all platforms?) |
Beta Was this translation helpful? Give feedback.
-
From Discord
I'm using the Obsidian Tasks plugin and have a query like this:
Can you add a fold icon to the filenames and the headlines? It like to collapse some items when going through the list.
Beta Was this translation helpful? Give feedback.
All reactions