1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

fix checkbox rendering bug

it doesn't render multiline content properly
This commit is contained in:
Dick Choi
2016-07-27 17:54:16 +09:00
parent 49acd8a4f3
commit b6bb438507

View File

@@ -96,9 +96,9 @@ md.block.ruler.at('paragraph', function (state, startLine/*, endLine*/) {
token.map = [ startLine, state.line ]
if (state.parentType === 'list') {
let match = content.match(/\[( |x)\] ?(.+)/i)
let match = content.match(/^\[( |x)\] ?(.+)/i)
if (match) {
content = `<label class='taskListItem' for='checkbox-${startLine + 1}'><input type='checkbox'${match[1] !== ' ' ? ' checked' : ''} id='checkbox-${startLine + 1}'/> ${match[2]}</label>`
content = `<label class='taskListItem' for='checkbox-${startLine + 1}'><input type='checkbox'${match[1] !== ' ' ? ' checked' : ''} id='checkbox-${startLine + 1}'/> ${content.substring(4, content.length)}</label>`
}
}