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

Adjust continuous quotation pattern

This commit is contained in:
Ryota Kusano
2019-05-13 16:35:20 +09:00
committed by Junyoung Choi
parent edac4d3fed
commit 244a28c7d2
4 changed files with 8 additions and 6 deletions

View File

@@ -159,8 +159,8 @@ class MarkdownEditor extends React.Component {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
const idMatch = /checkbox-([0-9]+)/ const idMatch = /checkbox-([0-9]+)/
const checkedMatch = /^\s*>?\s*[+\-*] \[x]/i const checkedMatch = /^(\s*>?)*\s*[+\-*] \[x]/i
const uncheckedMatch = /^\s*>?\s*[+\-*] \[ ]/ const uncheckedMatch = /^(\s*>?)*\s*[+\-*] \[ ]/
const checkReplace = /\[x]/i const checkReplace = /\[x]/i
const uncheckReplace = /\[ ]/ const uncheckReplace = /\[ ]/
if (idMatch.test(e.target.getAttribute('id'))) { if (idMatch.test(e.target.getAttribute('id'))) {

View File

@@ -78,8 +78,8 @@ class MarkdownSplitEditor extends React.Component {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
const idMatch = /checkbox-([0-9]+)/ const idMatch = /checkbox-([0-9]+)/
const checkedMatch = /^\s*>?\s*[+\-*] \[x]/i const checkedMatch = /^(\s*>?)*\s*[+\-*] \[x]/i
const uncheckedMatch = /^\s*>?\s*[+\-*] \[ ]/ const uncheckedMatch = /^(\s*>?)*\s*[+\-*] \[ ]/
const checkReplace = /\[x]/i const checkReplace = /\[x]/i
const uncheckReplace = /\[ ]/ const uncheckReplace = /\[ ]/
if (idMatch.test(e.target.getAttribute('id'))) { if (idMatch.test(e.target.getAttribute('id'))) {

View File

@@ -4,7 +4,7 @@ export function getTodoStatus (content) {
let numberOfCompletedTodo = 0 let numberOfCompletedTodo = 0
splitted.forEach((line) => { splitted.forEach((line) => {
const trimmedLine = line.trim().replace(/^>\s*/, '') const trimmedLine = line.trim().replace(/^(>\s*)*/, '')
if (trimmedLine.match(/^[+\-*] \[(\s|x)] ./i)) { if (trimmedLine.match(/^[+\-*] \[(\s|x)] ./i)) {
numberOfTodo++ numberOfTodo++
} }

View File

@@ -33,7 +33,9 @@ test('getTodoStatus should return a correct hash object', t => {
['> - [ ] a\n- [x] a\n', { total: 2, completed: 1 }], ['> - [ ] a\n- [x] a\n', { total: 2, completed: 1 }],
['> + [ ] a\n+ foo [x]bar a\n', { total: 1, completed: 0 }], ['> + [ ] a\n+ foo [x]bar a\n', { total: 1, completed: 0 }],
['> - [X] `- [X] a`\n', { total: 1, completed: 1 }], ['> - [X] `- [X] a`\n', { total: 1, completed: 1 }],
['> \t - [X] `- [X] a`\n', { total: 1, completed: 1 }] ['> \t - [X] `- [X] a`\n', { total: 1, completed: 1 }],
['> > - [ ] a\n', { total: 1, completed: 0 }],
['> > > - [ ] a\n- [x] a\n', { total: 2, completed: 1 }]
] ]
testCases.forEach(testCase => { testCases.forEach(testCase => {