(
plugin: TaskNotesPlugin,
tasks: TaskInfo[],
onChooseTask: (task: TaskInfo | null) => void,
options?: { placeholder?: string; title?: string; targetDate?: Date }
)
| 692 | * @param options - Optional configuration (placeholder, title) |
| 693 | */ |
| 694 | export function openTaskSelector( |
| 695 | plugin: TaskNotesPlugin, |
| 696 | tasks: TaskInfo[], |
| 697 | onChooseTask: (task: TaskInfo | null) => void, |
| 698 | options?: { placeholder?: string; title?: string; targetDate?: Date } |
| 699 | ): void { |
| 700 | const modal = new TaskSelectorWithCreateModal(plugin.app, plugin, tasks, { |
| 701 | placeholder: options?.placeholder, |
| 702 | title: options?.title, |
| 703 | targetDate: options?.targetDate, |
| 704 | onResult: (result) => { |
| 705 | if (result.type === "selected" || result.type === "created") { |
| 706 | onChooseTask(result.task); |
| 707 | } else { |
| 708 | onChooseTask(null); |
| 709 | } |
| 710 | }, |
| 711 | }); |
| 712 | modal.open(); |
| 713 | } |
no test coverage detected