Feature #32424 » demo_hardbreaks_setting.patch
| app/views/settings/_general.html.erb | ||
|---|---|---|
|
<p><%= setting_select :protocol, [['HTTP', 'http'], ['HTTPS', 'https']] %></p>
|
||
|
<p><%= setting_select :text_formatting, Redmine::WikiFormatting.formats_for_select, :blank => :label_none %></p>
|
||
|
<p><%= setting_select :text_formatting, Redmine::WikiFormatting.formats_for_select, :blank => :label_none %>
|
||
|
<label class="block <%= "hidden" unless Setting.text_formatting == "common_mark" %>">
|
||
|
<%= setting_check_box :text_formatting_common_mark_hardbreaks, label: false %>
|
||
|
<%= l(:setting_text_formatting_common_mark_hardbreaks) %>
|
||
|
</label>
|
||
|
</p>
|
||
|
<p><%= setting_check_box :cache_formatted_text %></p>
|
||
|
<p><%= setting_select :wiki_compression, [['Gzip', 'gzip']], :blank => :label_none %></p>
|
||
| ... | ... | |
|
<%= submit_tag l(:button_save) %>
|
||
|
<% end %>
|
||
|
<%= javascript_tag do %>
|
||
|
$('#settings_text_formatting').on('change', function(e){
|
||
|
const formatter = e.target.value;
|
||
|
const parent_block = document.getElementById("settings_text_formatting_common_mark_hardbreaks").parentElement;
|
||
|
if (formatter == "common_mark") {
|
||
|
parent_block.classList.remove('hidden');
|
||
|
} else {
|
||
|
parent_block.classList.add('hidden');
|
||
|
}
|
||
|
});
|
||
|
<% end %>
|
||
| config/locales/en.yml | ||
|---|---|---|
|
setting_project_list_defaults: Projects list defaults
|
||
|
setting_twofa: Two-factor authentication
|
||
|
setting_default_issue_query: Default Query
|
||
|
setting_text_formatting_common_mark_hardbreaks: "Use regular line breaks (\\n) as hardbreaks"
|
||
|
permission_add_project: Create project
|
||
|
permission_add_subprojects: Create subprojects
|
||
| config/settings.yml | ||
|---|---|---|
|
default: 0
|
||
|
text_formatting:
|
||
|
default: textile
|
||
|
text_formatting_common_mark_hardbreaks:
|
||
|
default: 1
|
||
|
cache_formatted_text:
|
||
|
default: 0
|
||
|
wiki_compression:
|
||
| lib/redmine/wiki_formatting/common_mark/formatter.rb | ||
|---|---|---|
|
# https://github.com/gjtorikian/commonmarker#render-options
|
||
|
commonmarker_render_options: [
|
||
|
:UNSAFE
|
||
|
].freeze,
|
||
|
],
|
||
|
}.freeze
|
||
|
if Setting.text_formatting_common_mark_hardbreaks?
|
||
|
PIPELINE_CONFIG[:commonmarker_render_options].push(:HARDBREAKS)
|
||
|
PIPELINE_CONFIG[:commonmarker_render_options].freeze
|
||
|
end
|
||
|
MarkdownPipeline = HTML::Pipeline.new [
|
||
|
MarkdownFilter,
|
||
|
SanitizationFilter,
|
||
| public/stylesheets/application.css | ||
|---|---|---|
|
float: none;
|
||
|
}
|
||
|
.tabular label.block.hidden {
|
||
|
display: none;
|
||
|
}
|
||
|
.tabular label.inline{
|
||
|
font-weight: normal;
|
||
|
float:none;
|
||