2018-06-24 16:07:22 +03:00
|
|
|
|
(function ($) {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
$.extend(true, $.trumbowyg, {
|
|
|
|
|
langs: {
|
|
|
|
|
// jshint camelcase:false
|
|
|
|
|
en: {
|
|
|
|
|
fontFamily: 'Font'
|
|
|
|
|
},
|
2020-05-12 21:47:37 +03:00
|
|
|
|
es: {
|
|
|
|
|
fontFamily: 'Fuente'
|
|
|
|
|
},
|
|
|
|
|
da: {
|
|
|
|
|
fontFamily: 'Skrifttype'
|
|
|
|
|
},
|
2018-06-24 16:07:22 +03:00
|
|
|
|
fr: {
|
|
|
|
|
fontFamily: 'Police'
|
|
|
|
|
},
|
2020-05-12 21:47:37 +03:00
|
|
|
|
de: {
|
|
|
|
|
fontFamily: 'Schriftart'
|
|
|
|
|
},
|
2018-06-24 16:07:22 +03:00
|
|
|
|
nl: {
|
|
|
|
|
fontFamily: 'Lettertype'
|
|
|
|
|
},
|
|
|
|
|
tr: {
|
|
|
|
|
fontFamily: 'Yazı Tipi'
|
2020-05-12 21:47:37 +03:00
|
|
|
|
},
|
|
|
|
|
zh_tw: {
|
|
|
|
|
fontFamily: '字體',
|
|
|
|
|
},
|
|
|
|
|
pt_br: {
|
|
|
|
|
fontFamily: 'Fonte',
|
|
|
|
|
},
|
|
|
|
|
ko: {
|
|
|
|
|
fontFamily: '글꼴'
|
|
|
|
|
},
|
2018-06-24 16:07:22 +03:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// jshint camelcase:true
|
|
|
|
|
|
|
|
|
|
var defaultOptions = {
|
|
|
|
|
fontList: [
|
|
|
|
|
{name: 'Arial', family: 'Arial, Helvetica, sans-serif'},
|
2020-05-12 21:47:37 +03:00
|
|
|
|
{name: 'Arial Black', family: 'Arial Black, Gadget, sans-serif'},
|
|
|
|
|
{name: 'Comic Sans', family: 'Comic Sans MS, Textile, cursive, sans-serif'},
|
|
|
|
|
{name: 'Courier New', family: 'Courier New, Courier, monospace'},
|
2018-06-24 16:07:22 +03:00
|
|
|
|
{name: 'Georgia', family: 'Georgia, serif'},
|
|
|
|
|
{name: 'Impact', family: 'Impact, Charcoal, sans-serif'},
|
2020-05-12 21:47:37 +03:00
|
|
|
|
{name: 'Lucida Console', family: 'Lucida Console, Monaco, monospace'},
|
|
|
|
|
{name: 'Lucida Sans', family: 'Lucida Sans Uncide, Lucida Grande, sans-serif'},
|
|
|
|
|
{name: 'Palatino', family: 'Palatino Linotype, Book Antiqua, Palatino, serif'},
|
2018-06-24 16:07:22 +03:00
|
|
|
|
{name: 'Tahoma', family: 'Tahoma, Geneva, sans-serif'},
|
2020-05-12 21:47:37 +03:00
|
|
|
|
{name: 'Times New Roman', family: 'Times New Roman, Times, serif'},
|
|
|
|
|
{name: 'Trebuchet', family: 'Trebuchet MS, Helvetica, sans-serif'},
|
2018-06-24 16:07:22 +03:00
|
|
|
|
{name: 'Verdana', family: 'Verdana, Geneva, sans-serif'}
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Add dropdown with web safe fonts
|
|
|
|
|
$.extend(true, $.trumbowyg, {
|
|
|
|
|
plugins: {
|
|
|
|
|
fontfamily: {
|
|
|
|
|
init: function (trumbowyg) {
|
2020-05-12 21:47:37 +03:00
|
|
|
|
trumbowyg.o.plugins.fontfamily = $.extend({},
|
|
|
|
|
defaultOptions,
|
|
|
|
|
trumbowyg.o.plugins.fontfamily || {}
|
|
|
|
|
);
|
|
|
|
|
|
2018-06-24 16:07:22 +03:00
|
|
|
|
trumbowyg.addBtnDef('fontfamily', {
|
|
|
|
|
dropdown: buildDropdown(trumbowyg),
|
|
|
|
|
hasIcon: false,
|
|
|
|
|
text: trumbowyg.lang.fontFamily
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function buildDropdown(trumbowyg) {
|
|
|
|
|
var dropdown = [];
|
|
|
|
|
|
|
|
|
|
$.each(trumbowyg.o.plugins.fontfamily.fontList, function (index, font) {
|
|
|
|
|
trumbowyg.addBtnDef('fontfamily_' + index, {
|
|
|
|
|
title: '<span style="font-family: ' + font.family + ';">' + font.name + '</span>',
|
|
|
|
|
hasIcon: false,
|
|
|
|
|
fn: function () {
|
|
|
|
|
trumbowyg.execCmd('fontName', font.family, true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
dropdown.push('fontfamily_' + index);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return dropdown;
|
|
|
|
|
}
|
|
|
|
|
})(jQuery);
|