Fixed a issue while deleting categories - Polishing UI

This commit is contained in:
2025-12-17 21:21:54 +01:00
parent de23d34d49
commit 2e7d4b8ee9
3 changed files with 81 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
import { Plugin } from "obsidian";
import { Plugin, Notice } from "obsidian";
import { TaskWeaverView, VIEW_TYPE_TASKWEAVER } from "./view";
import { TaskWeaverSettingTab } from "./settings";
import { TaskWeaverSettings, DEFAULT_SETTINGS, Task, Category } from "./types";
@@ -91,6 +91,7 @@ export default class TaskWeaverPlugin extends Plugin {
async deleteCategory(categoryId: string): Promise<void> {
const hasTasks = this.settings.tasks.some(t => t.categoryId === categoryId);
if (hasTasks) {
new Notice("Cannot delete category: it still contains tasks. Please delete or move all tasks first.");
return;
}