diff --git a/blueprints.yaml b/blueprints.yaml index 7a5c9d9..a829584 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -23,3 +23,14 @@ form: 0: Disabled validate: type: bool + checkbox_disabled: + type: toggle + label: Checkbox disabled + help: For check boxes to be clickable on the frontend disable this setting + highlight: 1 + default: 1 + options: + 1: Enabled + 0: Disabled + validate: + type: bool diff --git a/markdown-tasklists.php b/markdown-tasklists.php index d84bced..0f9abea 100644 --- a/markdown-tasklists.php +++ b/markdown-tasklists.php @@ -25,6 +25,7 @@ public function onMarkdownInitialized(Event $event) $markdown->addBlockType('-', 'List', false, true); $markdown->blockListComplete = function(array $Block) { + $checkbox_disabled = ( false === $this->config->get('plugins.markdown-tasklists.checkbox_disabled') ? '' : ' disabled' ); if ($Block['pattern'] === '[*+-]') { $containsTaskList = false; foreach ($Block['element']['text'] as &$Item) { @@ -35,7 +36,7 @@ public function onMarkdownInitialized(Event $event) $Item['attributes'] = ['class' => 'task-list-item']; $Text = sprintf( ' %s', - $prefix === '[x] ' ? 'checked disabled' : 'disabled', + $prefix === '[x] ' ? 'checked'.$checkbox_disabled : $checkbox_disabled, substr(trim($Text), 4) ); }