Skip to content

Commit

Permalink
Added a check class to check li
Browse files Browse the repository at this point in the history
  • Loading branch information
tavaresasilva committed Sep 13, 2024
1 parent 1aff5ad commit 60cadb7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/content/Content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ export class Content extends BaseUIComponent {
this.clearSelectionOnDrag();
this.reRenderPlaceholder();

document.addEventListener('click', (event) => {
const target = event.target as HTMLInputElement;

if (target && target.type === 'checkbox' && target.closest('.list-item-checkable')) {
const listItem = target.closest('.list-item-checkable');
const contentDiv = listItem?.querySelector('.editable') as HTMLDivElement;

if (target.checked) {
contentDiv?.classList.add('checked');
target.classList.add('checked');
} else {
contentDiv?.classList.remove('checked');
target.classList.remove('checked');
}
}
});


// Event selector
document.addEventListener(DefaultJSEvents.Click, (event: MouseEvent) => {
Expand Down

0 comments on commit 60cadb7

Please sign in to comment.