zulip/static/templates/settings/default_code_language_settings_widget.hbs
Rohitt Vashishtha f9caf522f0 markdown: Allow setting a default language for code blocks.
This adds a new realm setting: default_code_block_language.

This PR also adds a new widget to specify a language, which
behaves somewhat differently from other widgets of the same
kind; instead of exposing methods to the whole module, we
just create a single IIFE that handles all the interactions
with the DOM for the widget.

We also move the code for remapping languages to format_code
function since we want to preserve the original language to
decide if we override it using default_code_clock_language.

Fixes #14404.
2020-04-09 16:02:02 -07:00

22 lines
1.2 KiB
Handlebars

<div class="input-group" id="realm_default_code_block_language_widget">
<label for="realm_default_code_block_language" id="realm_default_code_block_language_label" class="inline-block">
{{ label }}
<span class="realm_default_code_block_language_setting dropup actual-dropdown-menu prop-element" id="id_realm_default_code_block_language"
name="realm_default_code_block_language" aria-labelledby="realm_default_code_block_language_label">
<button class="button small rounded dropdown-toggle" data-toggle="dropdown">
<span id="realm_default_code_block_language_name"></span>
<i class="fa fa-pencil"></i>
</button>
<ul class="dropdown-menu modal-bg" role="menu">
<li class="dropdown-search" role="presentation">
<input class="no-input-change-detection" type="text" role="menuitem" placeholder="{{t 'Filter languages' }}" autofocus/>
</li>
<span class="dropdown-list-body" data-simplebar></span>
</ul>
</span>
</label>
{{#if is_admin }}
<a class="default_code_block_language_unset" id="default_code_block_language_unset">{{t "[Unset]" }}</a>
{{/if}}
</div>