Added configuration option for enabling rich editor by default.

This commit is contained in:
Antonin 2016-06-27 12:24:12 +02:00
parent bcb289406e
commit d37ec75550
7 changed files with 12 additions and 4 deletions

View file

@ -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');

View file

@ -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
];

View file

@ -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);

View file

@ -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;
});

View file

@ -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();
}
});

View file

@ -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
];

View file

@ -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 -->