(task: TaskInfo, target: HTMLElement)
| 2767 | } |
| 2768 | |
| 2769 | private async toggleSubtasks(task: TaskInfo, target: HTMLElement): Promise<void> { |
| 2770 | try { |
| 2771 | if (!this.plugin.expandedProjectsService) { |
| 2772 | tasknotesLogger.error( |
| 2773 | "[TaskNotes][TaskListView] ExpandedProjectsService not initialized", |
| 2774 | { category: "stale-data", operation: "expandedprojectsservice-not-initialized" } |
| 2775 | ); |
| 2776 | new Notice("Service not available. Please try reloading the plugin."); |
| 2777 | return; |
| 2778 | } |
| 2779 | |
| 2780 | const newExpanded = this.plugin.expandedProjectsService.toggle( |
| 2781 | task.path, |
| 2782 | this.plugin.settings?.expandSubtasksByDefault === true |
| 2783 | ); |
| 2784 | target.classList.toggle("task-card__chevron--expanded", newExpanded); |
| 2785 | target.setAttribute( |
| 2786 | "aria-label", |
| 2787 | newExpanded ? "Collapse subtasks" : "Expand subtasks" |
| 2788 | ); |
| 2789 | |
| 2790 | // Find the card element and toggle subtasks display |
| 2791 | const card = target.closest<HTMLElement>(".task-card"); |
| 2792 | if (card) { |
| 2793 | const { toggleSubtasks } = await import("../ui/TaskCard"); |
| 2794 | await toggleSubtasks(card, task, this.plugin, newExpanded); |
| 2795 | } |
| 2796 | } catch (error) { |
| 2797 | tasknotesLogger.error("[TaskNotes][TaskListView] Failed to toggle subtasks", { |
| 2798 | category: "persistence", |
| 2799 | operation: "toggle-subtasks", |
| 2800 | error: error, |
| 2801 | }); |
| 2802 | new Notice("Failed to toggle subtasks"); |
| 2803 | } |
| 2804 | } |
| 2805 | |
| 2806 | private async toggleBlockingTasks(task: TaskInfo, target: HTMLElement): Promise<void> { |
| 2807 | try { |
no test coverage detected