File modules/editor/trumbowyg/plugins/template/trumbowyg.template.js

Last commit: Tue Aug 28 00:33:27 2018 +0200	Jan Dankert	Editoren für Markdown (SimpleMDE) und HTML (Trumbowyg) installiert.
1 (function ($) { 2 'use strict'; 3 4 // Adds the language variables 5 $.extend(true, $.trumbowyg, { 6 langs: { 7 en: { 8 template: 'Template' 9 }, 10 fr: { 11 template: 'Patron' 12 }, 13 nl: { 14 template: 'Sjabloon' 15 }, 16 ru: { 17 template: 'Шаблон' 18 }, 19 ja: { 20 template: 'テンプレート' 21 }, 22 tr: { 23 template: 'Şablon' 24 } 25 } 26 }); 27 28 // Adds the extra button definition 29 $.extend(true, $.trumbowyg, { 30 plugins: { 31 template: { 32 shouldInit: function (trumbowyg) { 33 return trumbowyg.o.plugins.hasOwnProperty('templates'); 34 }, 35 init: function (trumbowyg) { 36 trumbowyg.addBtnDef('template', { 37 dropdown: templateSelector(trumbowyg), 38 hasIcon: false, 39 text: trumbowyg.lang.template 40 }); 41 } 42 } 43 } 44 }); 45 46 // Creates the template-selector dropdown. 47 function templateSelector(trumbowyg) { 48 var available = trumbowyg.o.plugins.templates; 49 var templates = []; 50 51 $.each(available, function (index, template) { 52 trumbowyg.addBtnDef('template_' + index, { 53 fn: function () { 54 trumbowyg.html(template.html); 55 }, 56 hasIcon: false, 57 title: template.name 58 }); 59 templates.push('template_' + index); 60 }); 61 62 return templates; 63 } 64 })(jQuery);
Download modules/editor/trumbowyg/plugins/template/trumbowyg.template.js
History Tue, 28 Aug 2018 00:33:27 +0200 Jan Dankert Editoren für Markdown (SimpleMDE) und HTML (Trumbowyg) installiert.