File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* Attaches `input` handlers to markdown rendered tasklist checkboxes in comments.
3
- * The code assumes the checkbox will be initially disabled by the markdown renderer.
4
3
*
5
4
* When a checkbox value changes, the corresponding [ ] or [x] in the markdown string
6
5
* is set accordingly and sent to the server. On success it updates the raw-content on
@@ -12,9 +11,11 @@ const preventListener = (e) => e.preventDefault();
12
11
export function initMarkupTasklist ( ) {
13
12
for ( const el of document . querySelectorAll ( `.markup[data-can-edit=true]` ) || [ ] ) {
14
13
const container = el . parentNode ;
15
- const checkboxes = el . querySelectorAll ( `.task-list-item input[type=checkbox][disabled] ` ) ;
14
+ const checkboxes = el . querySelectorAll ( `.task-list-item input[type=checkbox]` ) ;
16
15
17
16
for ( const checkbox of checkboxes ) {
17
+ if ( checkbox . dataset . editable ) return ;
18
+ checkbox . dataset . editable = 'true' ;
18
19
checkbox . addEventListener ( 'input' , async ( ) => {
19
20
const checkboxCharacter = checkbox . checked ? 'x' : ' ' ;
20
21
const position = parseInt ( checkbox . dataset . sourcePosition ) + 1 ;
You can’t perform that action at this time.
0 commit comments