Add class into the li markup which contains checkbox
This commit is contained in:
parent
6bf5917da0
commit
abd857aafc
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
class ParsedownCheckbox extends ParsedownExtra
|
class ParsedownCheckbox extends ParsedownExtra
|
||||||
{
|
{
|
||||||
const VERSION = '0.0.1';
|
const VERSION = '0.0.2';
|
||||||
|
|
||||||
protected function blockListComplete($block)
|
protected function blockListComplete($block)
|
||||||
{
|
{
|
||||||
@ -41,9 +41,11 @@ class ParsedownCheckbox extends ParsedownExtra
|
|||||||
if ('[ ] ' === $begin_line) {
|
if ('[ ] ' === $begin_line) {
|
||||||
$block['element']['text'][$iterator_element]['text'][$iterator_text] = '<input type="checkbox" disabled /> '.
|
$block['element']['text'][$iterator_element]['text'][$iterator_text] = '<input type="checkbox" disabled /> '.
|
||||||
substr(trim($block['element']['text'][$iterator_element]['text'][$iterator_text]), 4);
|
substr(trim($block['element']['text'][$iterator_element]['text'][$iterator_text]), 4);
|
||||||
|
$block['element']['text'][$iterator_element]['attributes'] = ['class' => 'parsedown-task-list parsedown-task-list-open'];
|
||||||
} elseif ('[x] ' === $begin_line) {
|
} elseif ('[x] ' === $begin_line) {
|
||||||
$block['element']['text'][$iterator_element]['text'][$iterator_text] = '<input type="checkbox" checked disabled /> '.
|
$block['element']['text'][$iterator_element]['text'][$iterator_text] = '<input type="checkbox" checked disabled /> '.
|
||||||
substr(trim($block['element']['text'][$iterator_element]['text'][$iterator_text]), 4);
|
substr(trim($block['element']['text'][$iterator_element]['text'][$iterator_text]), 4);
|
||||||
|
$block['element']['text'][$iterator_element]['attributes'] = ['class' => 'parsedown-task-list parsedown-task-list-close'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,12 @@ EOF;
|
|||||||
|
|
||||||
$html = <<<EOF
|
$html = <<<EOF
|
||||||
<ul>
|
<ul>
|
||||||
<li><input type="checkbox" disabled /> test 1</li>
|
<li class="parsedown-task-list parsedown-task-list-open"><input type="checkbox" disabled /> test 1</li>
|
||||||
<li>[] test 2</li>
|
<li>[] test 2</li>
|
||||||
<li><input type="checkbox" checked disabled /> test 3
|
<li class="parsedown-task-list parsedown-task-list-close"><input type="checkbox" checked disabled /> test 3
|
||||||
<ul>
|
<ul>
|
||||||
<li><input type="checkbox" disabled /> test 4</li>
|
<li class="parsedown-task-list parsedown-task-list-open"><input type="checkbox" disabled /> test 4</li>
|
||||||
<li><input type="checkbox" checked disabled /> test 5</li>
|
<li class="parsedown-task-list parsedown-task-list-close"><input type="checkbox" checked disabled /> test 5</li>
|
||||||
</ul></li>
|
</ul></li>
|
||||||
<li><a href="https://markdown.org">test</a> 6</li>
|
<li><a href="https://markdown.org">test</a> 6</li>
|
||||||
<li><a href="https://markdown.org">x</a> test 7</li>
|
<li><a href="https://markdown.org">x</a> test 7</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user