Update src/task-lists-element.ts
Co-authored-by: Kristján Oddsson <koddsson@gmail.com>
This commit is contained in:
Родитель
63e57957cd
Коммит
fdaa68a9bf
|
@ -132,11 +132,8 @@ function position(checkbox: HTMLInputElement): [number, number] {
|
|||
const list = taskList(checkbox)
|
||||
if (!list) throw new Error('.contains-task-list not found')
|
||||
const item = checkbox.closest('.task-list-item')
|
||||
const index = item
|
||||
? Array.from(list.children)
|
||||
.filter(el => el.classList.contains('task-list-item'))
|
||||
.indexOf(item)
|
||||
: -1
|
||||
const listItems = Array.from(list.children).filter(el => el.classList.contains('task-list-item'))
|
||||
const index = item ? listItems.indexOf(item) : -1
|
||||
return [listIndex(list), index]
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче