()
| 558 | } |
| 559 | |
| 560 | private async handleDelete(): Promise<void> { |
| 561 | // Show confirmation dialog |
| 562 | const confirmed = await this.showDeleteConfirmation(); |
| 563 | if (!confirmed) return; |
| 564 | |
| 565 | try { |
| 566 | await this.deleteTimeblockFromDailyNote(); |
| 567 | |
| 568 | // Signal immediate update before triggering data change |
| 569 | this.onChange?.(); |
| 570 | |
| 571 | // Refresh calendar views |
| 572 | this.plugin.emitter.trigger("data-changed"); |
| 573 | |
| 574 | new Notice( |
| 575 | this.translate("notices.timeblockDeletedSuccess", { title: this.timeblock.title }) |
| 576 | ); |
| 577 | this.close(); |
| 578 | } catch (error) { |
| 579 | tasknotesLogger.error("Error deleting timeblock:", { |
| 580 | category: "internal", |
| 581 | operation: "deleting-timeblock", |
| 582 | error: error, |
| 583 | }); |
| 584 | new Notice(this.translate("notices.timeblockDeleteFailed")); |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | private async showDeleteConfirmation(): Promise<boolean> { |
| 589 | return new Promise((resolve) => { |
no test coverage detected