Skip to content

Commit ec969fc

Browse files
committed
fix: Restore title field in task modals (regression from #324)
The title field was accidentally removed from all task modals in commit 0b34a19. This fix restores the title field with the correct visibility logic: - Edit modals: Always show title field in the details section - Creation modals with NLP enabled: Show title field in details section (since the main title input is replaced by NLP textarea) - Creation modals with NLP disabled: Only show the main title field at top (no title field in details section needed) This ensures users can always edit the task title regardless of modal type or NLP settings.
1 parent 797e9f3 commit ec969fc

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/modals/TaskModal.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,33 @@ export abstract class TaskModal extends Modal {
158158
this.detailsContainer.style.display = 'none';
159159
}
160160

161+
// Title field appears in details section for:
162+
// 1. Edit modals (always)
163+
// 2. Creation modals when NLP is enabled (since the main title input is replaced by NLP textarea)
164+
const isEditModal = this.getModalTitle() === 'Edit task';
165+
const isCreationWithNLP = this.getModalTitle() === 'Create task' && this.plugin.settings.enableNaturalLanguageInput;
166+
167+
if (isEditModal || isCreationWithNLP) {
168+
const titleLabel = this.detailsContainer.createDiv('detail-label');
169+
titleLabel.textContent = 'Title';
170+
171+
const titleInputDetailed = this.detailsContainer.createEl('input', {
172+
type: 'text',
173+
cls: 'title-input-detailed',
174+
placeholder: 'Task title...'
175+
});
176+
177+
titleInputDetailed.value = this.title;
178+
titleInputDetailed.addEventListener('input', (e) => {
179+
this.title = (e.target as HTMLInputElement).value;
180+
});
181+
182+
// Store reference for creation modals with NLP
183+
if (isCreationWithNLP && !this.titleInput) {
184+
this.titleInput = titleInputDetailed;
185+
}
186+
}
187+
161188
// Details textarea (only for creation modals, not edit modals)
162189
if (this.getModalTitle() !== 'Edit task') {
163190
const detailsLabel = this.detailsContainer.createDiv('detail-label');

0 commit comments

Comments
 (0)