summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph (Sheogorath) Kern2018-01-24 09:39:17 +0100
committerGitHub2018-01-24 09:39:17 +0100
commita49e603c38d16fc2323564881e84b0a784fdd906 (patch)
tree30a425d2021c5bb171945bca8cc459de61d1deb6
parent584f1c524904147df41d642db6303a13c968e6d1 (diff)
parenta9c88ce2483bfbba2ddf55f9f9d34fbfcf3281d4 (diff)
Merge pull request #700 from hackmdio/fix-toggle-todo
Fix task todo might not toggle
Diffstat (limited to '')
-rw-r--r--public/js/extra.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index ec7d39da..dbb0f458 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -713,11 +713,11 @@ $.fn.sortByDepth = function () {
function toggleTodoEvent (e) {
const startline = $(this).closest('li').attr('data-startline') - 1
const line = window.editor.getLine(startline)
- const matches = line.match(/^[>\s]*[-+*]\s\[([x ])\]/)
+ const matches = line.match(/^[>\s-]*[-+*]\s\[([x ])\]/)
if (matches && matches.length >= 2) {
let checked = null
if (matches[1] === 'x') { checked = true } else if (matches[1] === ' ') { checked = false }
- const replacements = matches[0].match(/(^[>\s]*[-+*]\s\[)([x ])(\])/)
+ const replacements = matches[0].match(/(^[>\s-]*[-+*]\s\[)([x ])(\])/)
window.editor.replaceRange(checked ? ' ' : 'x', {
line: startline,
ch: replacements[1].length