From 60cadb7242799ecec55a11eaa721872937d7b6cf Mon Sep 17 00:00:00 2001 From: Alexandre Date: Fri, 13 Sep 2024 20:55:47 -0300 Subject: [PATCH] Added a check class to check li --- src/components/content/Content.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/components/content/Content.ts b/src/components/content/Content.ts index 4bf8c77..9ce33a1 100644 --- a/src/components/content/Content.ts +++ b/src/components/content/Content.ts @@ -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) => {