<commit_before>jQuery.fn.definePlugin('FontStylePicker', function () {
	'use strict';

	var names = {
		fontStylePickerClass: 'font-style-picker',
		presetSelectClass:'font-style-picker-preset-select',
		fontPickerClass: 'font-style-picker-font-picker',
		fontSizeClass: 'font-style-picker-font-size',
		textStyleClass: 'font-style-picker-text-style' 
	};

    var defaultFontDisplayName = 'Arial';
    var defaultFont = 'arial';
    var customFont= 'Custom';

    var boxLikeDrop = '<div class="box-like-drop"><span class="box-like-drop-content">Font Picker</span><span class="box-like-arrow box-like-arrow-down"></span></div>';


    var contentMarkup = '<div class="uilib-divider-row"><span class="font-picker-label">Style:</span><span class="style-place-holder"></span></div>';
        contentMarkup += '<div class="uilib-divider-row"><span class="font-picker-label">Font:</span><span class="font-place-holder"></span></div>';
        contentMarkup += '<div class="uilib-divider-row"><span class="font-picker-label"> </span><span class="props-place-holder"></span></div>';

    var textStyleHtml = '';
    textStyleHtml += '<button value="bold" class="grad-1" style="font-family: serif;font-weight: bold;">B</button>';
    textStyleHtml += '<button value="italic" class="grad-1" style="font-family: serif;font-style: italic;">I</button>';
    textStyleHtml += '<button value="underline" class="grad-1" style="font-family: serif;text-decoration: underline;">U</button>';

    return {
		init : function () {
			this.isParamMode = this.getParamKey();
			this.currentValue = null;
			this.popup = null;
			this.fontSizePicker = null;
			this.textStylePicker = null;
			this.fontPicker = null;
			this.presetSelectPicker = null;
            this.customVal = {};
			this.markup();
            this.setValue(this.options.value);
			this.bindEvents();
		},
		getDefaults : function () {
			return {
				value: 'Body-L'
			};
		},
		markup : function () {
			this.$el.html(boxLikeDrop);
			this.$el.addClass(names.fontStylePickerClass);
			
			this.createPopup();
			this.createFontPicker();
			this.createTextStylePicker();
			this.createFontSizePicker();
            this.createPresetPicker();

			this.popup.content.innerHTML = contentMarkup;
			
			$(this.popup.content).find('.style-place-holder').append(
				this.presetSelectPicker.$el.addClass(names.presetSelectClass)
			);
			
			$(this.popup.content).find('.font-place-holder').append(
				this.fontPicker.$el.addClass(names.fontPickerClass)
			);
			
			$(this.popup.content).find('.props-place-holder').append(
				this.fontSizePicker.$el.addClass(names.fontSizeClass),
				this.textStylePicker.$el.addClass(names.textStyleClass)
			);
			
			//this.popup.open();			
		},
		createFontSizePicker: function(){
			this.fontSizePicker = this.UI().create({
				ctrl: 'Spinner',
				options: {
					size : 'medium'
				},
				appendTo: this.$el
			}).getCtrl();
		},
		createTextStylePicker: function(){
			this.textStylePicker = this.UI().create({
				ctrl: 'ToggleButtonGroup',
				html: textStyleHtml,
				appendTo: this.$el
			}).getCtrl();
		},
		createFontPicker: function(){
			this.fontPicker = this.UI().create({
				ctrl: 'FontPicker',
				appendTo: this.$el
			}).getCtrl();
		},
		createPresetPicker: function(){
			var html = '';
			var _this = this;
			var presets = this.getSiteTextPresets();

            Object.keys(presets).sort().forEach(function(presetName){

                var styleFont = _this.getStyleFontByReference(presetName) ;
                var font = (styleFont && styleFont.fontFamily) || defaultFont;
                var fontSize = (styleFont && styleFont.size) || '12px';
                var styleCss = ' style="font-family:' + font +'"';
                html += _this.createStyleHtmlMarkup(presetName, presetName.replace(/-/g,' '), font, fontSize, styleCss, "");
			});

            // Add the custom font
            html += this.createCustomMarkup();

			this.presetSelectPicker = this.UI().create({
				ctrl: 'Dropdown',
				appendTo: this.$el,
				html: html,
				options:{
					width : 265,
					height : 260,
					value: 1,
					modifier: function($el, $original){

                        // Remove the description of the font style
                        var modifierHtml = _this.createSelectedStyleHtmlMarkup($el);
                        $el.html(modifierHtml);
						return $el;
					}
				}
			}).getCtrl();		
			
		},
        createCustomMarkup: function(){
            var fontFamily = (this.fontPicker && this.fontPicker.getValue() && this.fontPicker.getValue().value) || defaultFont;
            var textStyle = (this.textStylePicker && this.textStylePicker.getValue() && this.textStylePicker.getValue()) || {bold : false, italic : false, underline: false};
            var fontSize = (this.fontSizePicker && this.fontSizePicker.getValue()) || 0;

            var textStyleCss = textStyle.bold ? '; font-weight: bold': "";
            textStyleCss += textStyle.italic ? '; font-style: italic': "";<commit_msg>Update custom default font size<commit_after>jQuery.fn.definePlugin('FontStylePicker', function () {
	'use strict';

	var names = {
		fontStylePickerClass: 'font-style-picker',
		presetSelectClass:'font-style-picker-preset-select',
		fontPickerClass: 'font-style-picker-font-picker',
		fontSizeClass: 'font-style-picker-font-size',
		textStyleClass: 'font-style-picker-text-style' 
	};

    var defaultFontDisplayName = 'Arial';
    var defaultFont = 'arial';
    var customFont= 'Custom';

    var boxLikeDrop = '<div class="box-like-drop"><span class="box-like-drop-content">Font Picker</span><span class="box-like-arrow box-like-arrow-down"></span></div>';


    var contentMarkup = '<div class="uilib-divider-row"><span class="font-picker-label">Style:</span><span class="style-place-holder"></span></div>';
        contentMarkup += '<div class="uilib-divider-row"><span class="font-picker-label">Font:</span><span class="font-place-holder"></span></div>';
        contentMarkup += '<div class="uilib-divider-row"><span class="font-picker-label"> </span><span class="props-place-holder"></span></div>';

    var textStyleHtml = '';
    textStyleHtml += '<button value="bold" class="grad-1" style="font-family: serif;font-weight: bold;">B</button>';
    textStyleHtml += '<button value="italic" class="grad-1" style="font-family: serif;font-style: italic;">I</button>';
    textStyleHtml += '<button value="underline" class="grad-1" style="font-family: serif;text-decoration: underline;">U</button>';

    return {
		init : function () {
			this.isParamMode = this.getParamKey();
			this.currentValue = null;
			this.popup = null;
			this.fontSizePicker = null;
			this.textStylePicker = null;
			this.fontPicker = null;
			this.presetSelectPicker = null;
            this.customVal = {};
			this.markup();
            this.setValue(this.options.value);
			this.bindEvents();
		},
		getDefaults : function () {
			return {
				value: 'Body-L'
			};
		},
		markup : function () {
			this.$el.html(boxLikeDrop);
			this.$el.addClass(names.fontStylePickerClass);
			
			this.createPopup();
			this.createFontPicker();
			this.createTextStylePicker();
			this.createFontSizePicker();
            this.createPresetPicker();

			this.popup.content.innerHTML = contentMarkup;
			
			$(this.popup.content).find('.style-place-holder').append(
				this.presetSelectPicker.$el.addClass(names.presetSelectClass)
			);
			
			$(this.popup.content).find('.font-place-holder').append(
				this.fontPicker.$el.addClass(names.fontPickerClass)
			);
			
			$(this.popup.content).find('.props-place-holder').append(
				this.fontSizePicker.$el.addClass(names.fontSizeClass),
				this.textStylePicker.$el.addClass(names.textStyleClass)
			);
			
			//this.popup.open();			
		},
		createFontSizePicker: function(){
			this.fontSizePicker = this.UI().create({
				ctrl: 'Spinner',
				options: {
					size : 'medium'
				},
				appendTo: this.$el
			}).getCtrl();
		},
		createTextStylePicker: function(){
			this.textStylePicker = this.UI().create({
				ctrl: 'ToggleButtonGroup',
				html: textStyleHtml,
				appendTo: this.$el
			}).getCtrl();
		},
		createFontPicker: function(){
			this.fontPicker = this.UI().create({
				ctrl: 'FontPicker',
				appendTo: this.$el
			}).getCtrl();
		},
		createPresetPicker: function(){
			var html = '';
			var that = this;
			var presets = this.getSiteTextPresets();

            Object.keys(presets).sort().forEach(function(presetName){

                var styleFont = that.getStyleFontByReference(presetName) ;
                var font = (styleFont && styleFont.fontFamily) || defaultFont;
                var fontSize = (styleFont && styleFont.size) || '12px';
                var styleCss = ' style="font-family:' + font +'"';
                html += that.createStyleHtmlMarkup(presetName, presetName.replace(/-/g,' '), font, fontSize, styleCss, "");
			});

            // Add the custom font
            html += this.createCustomMarkup();

			this.presetSelectPicker = this.UI().create({
				ctrl: 'Dropdown',
				appendTo: this.$el,
				html: html,
				options:{
					width : 265,
					height : 260,
					value: 1,
					modifier: function($el, $original){

                        // Remove the description of the font style
                        var modifierHtml = that.createSelectedStyleHtmlMarkup($el);
                        $el.html(modifierHtml);
						return $el;
					}
				}
			}).getCtrl();		
			
		},
        createCustomMarkup: function(){
            var fontFamily = (this.fontPicker && this.fontPicker.getValue() && this.fontPicker.getValue().value) || defaultFont;
            var textStyle = (this.textStylePicker && this.textStylePicker.getValue() && this.textStylePicker.getValue()) || {bold : false, italic : false, underline: false};
            var fontSize = (this.fontSizePicker && this.fontSizePicker.getValue()) || 12;

            var textStyleCss = textStyle.bold ? '; font-weight: bold': "";
            textStyleCss += textStyle.italic ? '; font-style: italic': "";
{'fraction_non_alphanumeric': 0.16346441015430563, 'fraction_numerical': 0.0026879044300647087, 'mean_word_length': 3.135858377933306, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1872866', 'n_tokens_mistral': 3484, 'n_tokens_neox': 3010, 'n_words': 512}