Skip to content

Commit a49e603

Browse files
authored
Merge pull request #700 from hackmdio/fix-toggle-todo
Fix task todo might not toggle
2 parents 584f1c5 + a9c88ce commit a49e603

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

public/js/extra.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,11 @@ $.fn.sortByDepth = function () {
713713
function toggleTodoEvent (e) {
714714
const startline = $(this).closest('li').attr('data-startline') - 1
715715
const line = window.editor.getLine(startline)
716-
const matches = line.match(/^[>\s]*[-+*]\s\[([x ])\]/)
716+
const matches = line.match(/^[>\s-]*[-+*]\s\[([x ])\]/)
717717
if (matches && matches.length >= 2) {
718718
let checked = null
719719
if (matches[1] === 'x') { checked = true } else if (matches[1] === ' ') { checked = false }
720-
const replacements = matches[0].match(/(^[>\s]*[-+*]\s\[)([x ])(\])/)
720+
const replacements = matches[0].match(/(^[>\s-]*[-+*]\s\[)([x ])(\])/)
721721
window.editor.replaceRange(checked ? ' ' : 'x', {
722722
line: startline,
723723
ch: replacements[1].length

0 commit comments

Comments
 (0)