diff --git a/adminstuds.php b/adminstuds.php index 5750828a81ed4d31fe84cc3bc55f7c365413d5a8..ec9d96ee76eeed008ba0195a7e4114faaab175ae 100644 --- a/adminstuds.php +++ b/adminstuds.php @@ -422,5 +422,6 @@ $smarty->assign('hidden', false); $smarty->assign('accessGranted', true); $smarty->assign('resultPubliclyVisible', true); $smarty->assign('editedVoteUniqueId', ''); +$smarty->assign('default_to_marldown_editor', $config['markdown_editor_by_default']); $smarty->display('studs.tpl'); diff --git a/app/inc/config.template.php b/app/inc/config.template.php index bcbd21b2331244794b1b22b44282f1b0ab6bda1a..4e38cdc54543ab34a99d5f34fa26e117f322f8ba 100644 --- a/app/inc/config.template.php +++ b/app/inc/config.template.php @@ -92,4 +92,5 @@ $config = [ 'default_poll_duration' => 180, // default values for the new poll duration (number of days). /* create_classic_poll.php */ 'user_can_add_img_or_link' => true, // user can add link or URL when creating his poll. + 'markdown_editor_by_default' => true // The markdown editor for the description is enabled by default ]; \ No newline at end of file diff --git a/create_poll.php b/create_poll.php index 550101fbce2c401c6fbfb28c93ed0ce2eaba2efe..7e8570c4751473efe198c27957576f8cca35aec8 100644 --- a/create_poll.php +++ b/create_poll.php @@ -265,6 +265,7 @@ $smarty->assign('title', $title); $smarty->assign('useRemoteUser', $useRemoteUser); $smarty->assign('errors', $errors); $smarty->assign('use_smtp', $config['use_smtp']); +$smarty->assign('default_to_marldown_editor', $config['markdown_editor_by_default']); $smarty->assign('goToStep2', GO_TO_STEP_2); $smarty->assign('poll_type', $poll_type); diff --git a/js/app/adminstuds.js b/js/app/adminstuds.js index 9b4bcd3c8221e1eac892b7a8d880ae9dd1d440aa..c77d06f1ff8cae03d634e4511ef93249549d3dea 100644 --- a/js/app/adminstuds.js +++ b/js/app/adminstuds.js @@ -53,7 +53,9 @@ $(document).ready(function() { $('.js-desc textarea').focus(); if (firstOpening) { firstOpening = false; - wrapper.enable(); + if ($('#rich-editor-button').hasClass('active')) { + wrapper.enable(); + } } return false; }); diff --git a/js/app/create_poll.js b/js/app/create_poll.js index ffa79951ee1c232d375c7f44d18e2b4ea7cd246a..81b14437f2e392e89b3c0ee14ad82a0ab0da4af6 100644 --- a/js/app/create_poll.js +++ b/js/app/create_poll.js @@ -91,6 +91,8 @@ $(document).ready(function () { } var wrapper = new MDEWrapper($('#poll_comments')[0], $('#rich-editor-button'), $('#simple-editor-button')); - wrapper.enable(); + if ($('#rich-editor-button').hasClass('active')) { + wrapper.enable(); + } }); \ No newline at end of file diff --git a/tpl/admin/config.tpl b/tpl/admin/config.tpl index bb5d9dcf66432c7a7c7f239e79c1b670cea4e665..7d92011d37a14ce315795831bbba42c2814b71e8 100644 --- a/tpl/admin/config.tpl +++ b/tpl/admin/config.tpl @@ -92,4 +92,5 @@ $config = [ 'default_poll_duration' => 180, // default values for the new poll duration (number of days). /* create_classic_poll.php */ 'user_can_add_img_or_link' => true, // user can add link or URL when creating his poll. + 'markdown_editor_by_default' => true // The markdown editor for the description is enabled by default ]; \ No newline at end of file diff --git a/tpl/part/description_markdown.tpl b/tpl/part/description_markdown.tpl index 7029be24790f9752b75c102bb4f15f880d765b21..e2bb823d29f60baed17c0b8c7ddcb90d7f84140e 100644 --- a/tpl/part/description_markdown.tpl +++ b/tpl/part/description_markdown.tpl @@ -1,8 +1,8 @@ {* Description buttons for markdown *} <div class="btn-group" role="group" aria-label="..."> - <button type="button" id="rich-editor-button" class="btn btn-default btn-xs active">{__('PollInfo', 'Rich editor')}</button> - <button type="button" id="simple-editor-button" class="btn btn-default btn-xs">{__('PollInfo', 'Simple editor')}</button> + <button type="button" id="rich-editor-button" class="btn btn-default btn-xs{if $default_to_marldown_editor} active{/if}">{__('PollInfo', 'Rich editor')}</button> + <button type="button" id="simple-editor-button" class="btn btn-default btn-xs{if !$default_to_marldown_editor} active{/if}">{__('PollInfo', 'Simple editor')}</button> </div> <a href="" data-toggle="modal" data-target="#markdown_modal"><i class="glyphicon glyphicon-info-sign"></i></a><!-- TODO Add accessibility -->