Android task entry fix
This commit is contained in:
@ -109,6 +109,28 @@ export class TaskFileView extends TextFileView {
|
||||
this.rootEl.appendChild(bar);
|
||||
}
|
||||
|
||||
// Add-task row — outside the scroll container so it stays visible when
|
||||
// the Android keyboard opens and the viewport shrinks.
|
||||
const addItem = this.rootEl.createDiv({ cls: 'yaotp-task-item yaotp-add-task-item' });
|
||||
const addHandle = addItem.createDiv({ cls: 'yaotp-drag-handle yaotp-drag-handle-disabled' });
|
||||
addHandle.innerHTML = '⋮';
|
||||
addItem.createEl('input', {
|
||||
cls: 'yaotp-checkbox',
|
||||
type: 'checkbox',
|
||||
attr: { disabled: true, 'aria-hidden': 'true' },
|
||||
});
|
||||
const addInput = addItem.createEl('input', {
|
||||
cls: 'yaotp-new-task-input',
|
||||
type: 'text',
|
||||
attr: { placeholder: 'Enter new task...' },
|
||||
}) as HTMLInputElement;
|
||||
addInput.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
const text = addInput.value.trim();
|
||||
if (text) this.addTask(text);
|
||||
}
|
||||
});
|
||||
|
||||
// Task list container
|
||||
this.listEl = this.rootEl.createDiv({ cls: 'yaotp-list-container' });
|
||||
|
||||
@ -116,7 +138,6 @@ export class TaskFileView extends TextFileView {
|
||||
onComplete: (index) => this.completeTask(index),
|
||||
onEdit: (index) => this.editTask(index),
|
||||
onReorder: (oldIndex, newIndex) => this.reorderTask(oldIndex, newIndex),
|
||||
onAdd: (text) => this.addTask(text),
|
||||
});
|
||||
this.taskList.render(this.tasks);
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ export interface TaskListCallbacks {
|
||||
onComplete: (index: number) => void;
|
||||
onEdit: (index: number) => void;
|
||||
onReorder: (oldIndex: number, newIndex: number) => void;
|
||||
onAdd: (text: string) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -25,32 +24,6 @@ export class TaskListComponent {
|
||||
this.destroy();
|
||||
this.container.empty();
|
||||
|
||||
// Add-task row — always first, outside the sortable list
|
||||
const addItem = this.container.createDiv({ cls: 'yaotp-task-item yaotp-add-task-item' });
|
||||
|
||||
const addHandle = addItem.createDiv({ cls: 'yaotp-drag-handle yaotp-drag-handle-disabled' });
|
||||
addHandle.innerHTML = '⋮';
|
||||
|
||||
addItem.createEl('input', {
|
||||
cls: 'yaotp-checkbox',
|
||||
type: 'checkbox',
|
||||
attr: { disabled: true, 'aria-hidden': 'true' },
|
||||
});
|
||||
|
||||
const input = addItem.createEl('input', {
|
||||
cls: 'yaotp-new-task-input',
|
||||
type: 'text',
|
||||
attr: { placeholder: 'Enter new task...' },
|
||||
}) as HTMLInputElement;
|
||||
input.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') {
|
||||
const text = input.value.trim();
|
||||
if (text) {
|
||||
this.callbacks.onAdd(text);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (tasks.length === 0) return;
|
||||
|
||||
const list = this.container.createEl('ul', { cls: 'yaotp-task-list' });
|
||||
|
||||
@ -156,7 +156,12 @@
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/* Add-task row */
|
||||
/* Add-task row — sits outside the scroll container as a fixed-height flex item */
|
||||
.yaotp-add-task-item {
|
||||
flex-shrink: 0;
|
||||
border-bottom: 1px solid var(--background-modifier-border);
|
||||
}
|
||||
|
||||
.yaotp-drag-handle-disabled {
|
||||
opacity: 0.2;
|
||||
cursor: default;
|
||||
|
||||
Reference in New Issue
Block a user