@@ -10,13 +10,13 @@ export default function initMarkdownCheckboxes() {
10
10
const $segment = $ ( segment ) ;
11
11
const $checkboxes = $segment . find ( '.render-content.markdown input:checkbox' ) ;
12
12
13
- const onChange = async ( ev , cbIndex ) => {
14
- const $cb = $ ( ev . target ) ;
15
- const checkboxMarkdown = $cb . is ( ':checked' ) ? '[x]' : '[ ]' ;
13
+ const onChange = async ( ev , checkboxIndex ) => {
14
+ const $checkbox = $ ( ev . target ) ;
15
+ const checkboxMarkdown = $checkbox . is ( ':checked' ) ? '[x]' : '[ ]' ;
16
16
17
17
const $rawContent = $segment . find ( '.raw-content' ) ;
18
18
const oldContent = $rawContent . text ( ) ;
19
- const newContent = oldContent . replace ( checkboxMarkdownPattern , replaceNthMatchWith ( cbIndex , checkboxMarkdown ) ) ;
19
+ const newContent = oldContent . replace ( checkboxMarkdownPattern , replaceNthMatchWith ( checkboxIndex , checkboxMarkdown ) ) ;
20
20
21
21
if ( newContent !== oldContent ) {
22
22
disableAll ( $checkboxes ) ;
@@ -28,7 +28,7 @@ export default function initMarkdownCheckboxes() {
28
28
await submit ( newContent , url , context ) ;
29
29
$rawContent . text ( newContent ) ;
30
30
} catch ( e ) {
31
- $cb . prop ( 'checked' , ! $cb . is ( ':checked' ) ) ;
31
+ $checkbox . prop ( 'checked' , ! $checkbox . is ( ':checked' ) ) ;
32
32
33
33
console . error ( e ) ;
34
34
} finally {
@@ -38,8 +38,8 @@ export default function initMarkdownCheckboxes() {
38
38
} ;
39
39
40
40
enableAll ( $checkboxes ) ;
41
- $checkboxes . each ( ( cbIndex , cb ) => {
42
- $ ( cb ) . on ( 'change' , ( ev ) => onChange ( ev , cbIndex ) ) ;
41
+ $checkboxes . each ( ( checkboxIndex , checkboxElement ) => {
42
+ $ ( checkboxElement ) . on ( 'change' , ( ev ) => onChange ( ev , checkboxIndex ) ) ;
43
43
} ) ;
44
44
} ) ;
45
45
}
0 commit comments