Fix custom fonts for buttons [MAILPOET-1633]

This commit is contained in:
Amine Ben hammou
2018-11-13 15:19:42 +01:00
parent c778b84932
commit 8ff4f7720b
2 changed files with 19 additions and 3 deletions

View File

@@ -322,7 +322,10 @@ define([
beforeEach(function () {
global.stubChannel(EditorApplication);
global.stubAvailableStyles(EditorApplication, {
fonts: ['Arial', 'Tahoma'],
fonts: {
standard: ['Arial', 'Tahoma'],
custom: ['Arvo', 'Lato', 'Lora']
},
headingSizes: ['16px', '20px']
});
@@ -343,7 +346,10 @@ define([
global.stubChannel(EditorApplication);
global.stubConfig(EditorApplication);
global.stubAvailableStyles(EditorApplication, {
fonts: ['Arial', 'Tahoma'],
fonts: {
standard: ['Arial', 'Tahoma'],
custom: ['Arvo', 'Lato', 'Lora']
},
headingSizes: ['16px', '20px']
});
});

View File

@@ -44,9 +44,16 @@
<div class="mailpoet_form_field_input_option">
<input type="text" name="font-color" id="mailpoet_field_button_font_color" class="mailpoet_field_button_font_color mailpoet_color" value="{{ model.styles.block.fontColor }}" />
<select id="mailpoet_field_button_font_family" name="font-family" class="mailpoet_select mailpoet_select_medium mailpoet_field_button_font_family mailpoet_font_family">
{{#each availableStyles.fonts}}
<optgroup label="<%= __('Standard fonts')%>">
{{#each availableStyles.fonts.standard}}
<option value="{{ this }}" {{#ifCond this '==' ../model.styles.block.fontFamily}}SELECTED{{/ifCond}}>{{ this }}</option>
{{/each}}
</optgroup>
<optgroup label="<%= __('Custom fonts')%>">
{{#each availableStyles.fonts.custom}}
<option value="{{ this }}" {{#ifCond this '==' ../model.styles.block.fontFamily}}SELECTED{{/ifCond}}>{{ this }}</option>
{{/each}}
</optgroup>
</select>
<select id="mailpoet_field_button_font_size" name="font-size" class="mailpoet_select mailpoet_select_small mailpoet_field_button_font_size mailpoet_font_size">
{{#each availableStyles.headingSizes}}
@@ -117,3 +124,6 @@
<input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') | escape('html_attr') %>" />
</div>
<script type="text/javascript">
fontsSelect('#mailpoet_field_button_font_family');
</script>