diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/ResourceManagementOptionsConfiguration.cs b/src/OrchardCore.Modules/OrchardCore.Resources/ResourceManagementOptionsConfiguration.cs index 26e8fa46cfd..6649ea93f22 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/ResourceManagementOptionsConfiguration.cs +++ b/src/OrchardCore.Modules/OrchardCore.Resources/ResourceManagementOptionsConfiguration.cs @@ -413,17 +413,17 @@ ResourceManifest BuildManifest() manifest .DefineStyle("trumbowyg") .SetUrl("~/OrchardCore.Resources/Styles/trumbowyg.min.css", "~/OrchardCore.Resources/Styles/trumbowyg.css") - .SetCdn("https://cdn.jsdelivr.net/npm/trumbowyg@2.27.3/dist/ui/trumbowyg.min.css", "https://cdn.jsdelivr.net/npm/trumbowyg@2.27.3/dist/ui/trumbowyg.css") - .SetCdnIntegrity("sha384-BMSJyRuWWysKSQXUwY6xhPnRLhIEIKVrndBFiMT8osUv0Jy4u+kVojiTB4oIk9Cy", "sha384-+WI6uKHvRRdOtp4c41xrQHz3liE5QZxjkFUx8KwLRMiMgSPpkoMnUMOjO7k8WH1Q") - .SetVersion("2.27.3"); + .SetCdn("https://cdn.jsdelivr.net/npm/trumbowyg@2.28.0/dist/ui/trumbowyg.min.css", "https://cdn.jsdelivr.net/npm/trumbowyg@2.28.0/dist/ui/trumbowyg.css") + .SetCdnIntegrity("sha384-XfI6P0jtm0X3QDEQxS1DotzhIXkJeuSV1wtBOntPaRxzpzTkMWkpZpkuzj8qVHzl", "sha384-GUyfWhYsIKKkAMejJuy50VTSfyfkrrJX2csg7fxJJt7vi+gXH8qxqH29C5GURaum") + .SetVersion("2.28.0"); manifest .DefineScript("trumbowyg") .SetDependencies("jquery-resizable") .SetUrl("~/OrchardCore.Resources/Scripts/trumbowyg.min.js", "~/OrchardCore.Resources/Scripts/trumbowyg.js") - .SetCdn("https://cdn.jsdelivr.net/npm/trumbowyg@2.27.3/dist/trumbowyg.min.js", "https://cdn.jsdelivr.net/npm/trumbowyg@2.27.3/dist/trumbowyg.js") - .SetCdnIntegrity("sha384-OZd+lx/Xv8IR7nJZmRKR4NJhT0urUXigW5V7FOEtmrFRf1BKKVc0DWhdiCh8UX8+", "sha384-nWqhxDAuUls0N/CYl8px54jeiP9i8+J64k1UPiM6DMC/u/qRY+jfkprB5VndU7B4") - .SetVersion("2.27.3"); + .SetCdn("https://cdn.jsdelivr.net/npm/trumbowyg@2.28.0/dist/trumbowyg.min.js", "https://cdn.jsdelivr.net/npm/trumbowyg@2.28.0/dist/trumbowyg.js") + .SetCdnIntegrity("sha384-O4OAGMDq5hnqt4/WQz+fW6yVgZ02jmw+Yf1j02zIgglnCYXf/7TmET8tFbrTN6u5", "sha384-dNxlebCuuiNWPhPBEd69nEAtkEWa7Z9IWkrL+OSmJ456dlu6TAASXgL72Bn4GGju") + .SetVersion("2.28.0"); manifest .DefineScript("trumbowyg-shortcodes") @@ -435,13 +435,13 @@ ResourceManifest BuildManifest() .DefineStyle("trumbowyg-plugins") .SetDependencies("trumbowyg") .SetUrl("~/OrchardCore.Resources/Styles/trumbowyg-plugins.min.css", "~/OrchardCore.Resources/Styles/trumbowyg-plugins.css") - .SetVersion("2.27.3"); + .SetVersion("2.28.0"); manifest .DefineScript("trumbowyg-plugins") .SetDependencies("trumbowyg") .SetUrl("~/OrchardCore.Resources/Scripts/trumbowyg-plugins.min.js", "~/OrchardCore.Resources/Scripts/trumbowyg-plugins.js") - .SetVersion("2.27.3"); + .SetVersion("2.28.0"); manifest .DefineScript("vuejs") diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/package-lock.json b/src/OrchardCore.Modules/OrchardCore.Resources/package-lock.json index 4c9c9b019d3..5fafce897dd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/package-lock.json +++ b/src/OrchardCore.Modules/OrchardCore.Resources/package-lock.json @@ -20,7 +20,7 @@ "monaco-editor": "^0.46.0", "nouislider": "15.7.0", "sortablejs": "^1.14.0", - "trumbowyg": "2.27.3", + "trumbowyg": "2.28.0", "vue": "^2.6.14", "vue-multiselect": "^2.1.6", "vuedraggable": "^2.24.3" @@ -459,9 +459,9 @@ } }, "node_modules/trumbowyg": { - "version": "2.27.3", - "resolved": "https://registry.npmjs.org/trumbowyg/-/trumbowyg-2.27.3.tgz", - "integrity": "sha512-mEFhPSrF3dobjnGSSW7BfnmX5Pnv9T4KIoATOHxFOHtb1exE0L2hNPxCr6Bh4iFRJQD4UErleyKCapKf2yImKw==", + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/trumbowyg/-/trumbowyg-2.28.0.tgz", + "integrity": "sha512-K4KX6psV+hUt03Y3RNdQM5Y+JLfZOUliNnCz5lm12Llfhwvx0P0geBsM0w9ZHeX5g8q7d2MC5X7sPOwGv0Q7Kw==", "peerDependencies": { "jquery": ">=1.8" } @@ -984,9 +984,9 @@ } }, "trumbowyg": { - "version": "2.27.3", - "resolved": "https://registry.npmjs.org/trumbowyg/-/trumbowyg-2.27.3.tgz", - "integrity": "sha512-mEFhPSrF3dobjnGSSW7BfnmX5Pnv9T4KIoATOHxFOHtb1exE0L2hNPxCr6Bh4iFRJQD4UErleyKCapKf2yImKw==", + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/trumbowyg/-/trumbowyg-2.28.0.tgz", + "integrity": "sha512-K4KX6psV+hUt03Y3RNdQM5Y+JLfZOUliNnCz5lm12Llfhwvx0P0geBsM0w9ZHeX5g8q7d2MC5X7sPOwGv0Q7Kw==", "requires": {} }, "ts-node": { diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/package.json b/src/OrchardCore.Modules/OrchardCore.Resources/package.json index 7c8063a687f..1afa82b6756 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/package.json +++ b/src/OrchardCore.Modules/OrchardCore.Resources/package.json @@ -14,7 +14,7 @@ "js-cookie": "3.0.5", "monaco-editor": "^0.46.0", "sortablejs": "^1.14.0", - "trumbowyg": "2.27.3", + "trumbowyg": "2.28.0", "vue": "^2.6.14", "vue-multiselect": "^2.1.6", "vuedraggable": "^2.24.3" diff --git a/src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Scripts/trumbowyg-plugins.js b/src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Scripts/trumbowyg-plugins.js index 5946ca29418..8666068348f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Scripts/trumbowyg-plugins.js +++ b/src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Scripts/trumbowyg-plugins.js @@ -1333,982 +1333,509 @@ langs: { // jshint camelcase:false en: { - fontsize: 'Font size', - fontsizes: { - 'x-small': 'Extra small', - 'small': 'Small', - 'medium': 'Regular', - 'large': 'Large', - 'x-large': 'Extra large', - 'custom': 'Custom' - }, - fontCustomSize: { - title: 'Custom Font Size', - label: 'Font Size', - value: '48px' - } + fontFamily: 'Font' }, az: { - fontsize: 'Şrift həcmi', - fontsizes: { - 'x-small': 'Daha kiçik', - 'small': 'Kiçik', - 'medium': 'Normal', - 'large': 'Böyük', - 'x-large': 'Daha böyük', - 'custom': 'Fərdi həcm' - }, - fontCustomSize: { - title: 'Fərdi şrift həcmi', - label: 'Şrift həcmi', - value: '48px' - } + fontFamily: 'Şrift' }, by: { - fontsize: 'Памер шрыфта', - fontsizes: { - 'x-small': 'Вельмі маленькі', - 'small': 'Маленькі', - 'medium': 'Звычайны', - 'large': 'Вялікі', - 'x-large': 'Вельмі вялікі', - 'custom': 'Карыстальніцкі' - }, - fontCustomSize: { - title: 'Карыстальніцкі Памер Шрыфта', - label: 'Памер Шрыфта', - value: '48px' - } + fontFamily: 'Шрыфт' }, ca: { - fontsize: 'Mida de la lletra', - fontsizes: { - 'x-small': 'Molt petita', - 'small': 'Petita', - 'medium': 'Normal', - 'large': 'Gran', - 'x-large': 'Molt Gran', - 'custom': 'Personalitzada' - }, - fontCustomSize: { - title: 'Mida de lletra personalitzada', - label: 'Mida de lletra', - value: '48px' - } + fontFamily: 'Font' }, da: { - fontsize: 'Skriftstørrelse', - fontsizes: { - 'x-small': 'Ekstra lille', - 'small': 'Lille', - 'medium': 'Normal', - 'large': 'Stor', - 'x-large': 'Ekstra stor', - 'custom': 'Brugerdefineret' - } + fontFamily: 'Skrifttype' }, de: { - fontsize: 'Schriftgröße', - fontsizes: { - 'x-small': 'Sehr klein', - 'small': 'Klein', - 'medium': 'Normal', - 'large': 'Groß', - 'x-large': 'Sehr groß', - 'custom': 'Benutzerdefiniert' - }, - fontCustomSize: { - title: 'Benutzerdefinierte Schriftgröße', - label: 'Schriftgröße', - value: '48px' - } + fontFamily: 'Schriftart' }, es: { - fontsize: 'Tamaño de Fuente', - fontsizes: { - 'x-small': 'Extra pequeña', - 'small': 'Pegueña', - 'medium': 'Regular', - 'large': 'Grande', - 'x-large': 'Extra Grande', - 'custom': 'Customizada' - }, - fontCustomSize: { - title: 'Tamaño de Fuente Customizada', - label: 'Tamaño de Fuente', - value: '48px' - } + fontFamily: 'Fuente' }, et: { - fontsize: 'Teksti suurus', - fontsizes: { - 'x-small': 'Väga väike', - 'small': 'Väike', - 'medium': 'Tavaline', - 'large': 'Suur', - 'x-large': 'Väga suur', - 'custom': 'Määra ise' - }, - fontCustomSize: { - title: 'Kohandatud teksti suurus', - label: 'Teksti suurus', - value: '48px' - } + fontFamily: 'Font' }, fr: { - fontsize: 'Taille de la police', - fontsizes: { - 'x-small': 'Très petit', - 'small': 'Petit', - 'medium': 'Normal', - 'large': 'Grand', - 'x-large': 'Très grand', - 'custom': 'Taille personnalisée' - }, - fontCustomSize: { - title: 'Taille de police personnalisée', - label: 'Taille de la police', - value: '48px' - } + fontFamily: 'Police' }, hu: { - fontsize: 'Betű méret', - fontsizes: { - 'x-small': 'Extra kicsi', - 'small': 'Kicsi', - 'medium': 'Normális', - 'large': 'Nagy', - 'x-large': 'Extra nagy', - 'custom': 'Egyedi' - }, - fontCustomSize: { - title: 'Egyedi betű méret', - label: 'Betű méret', - value: '48px' - } - }, - it: { - fontsize: 'Dimensioni del testo', - fontsizes: { - 'x-small': 'Molto piccolo', - 'small': 'piccolo', - 'regular': 'normale', - 'large': 'grande', - 'x-large': 'Molto grande', - 'custom': 'Personalizzato' - }, - fontCustomSize: { - title: 'Dimensioni del testo personalizzato', - label: 'Dimensioni del testo', - value: '48px' - } + fontFamily: 'Betűtípus' }, ko: { - fontsize: '글꼴 크기', - fontsizes: { - 'x-small': '아주 작게', - 'small': '작게', - 'medium': '보통', - 'large': '크게', - 'x-large': '아주 크게', - 'custom': '사용자 지정' - }, - fontCustomSize: { - title: '사용자 지정 글꼴 크기', - label: '글꼴 크기', - value: '48px' - } + fontFamily: '글꼴' }, nl: { - fontsize: 'Lettergrootte', - fontsizes: { - 'x-small': 'Extra klein', - 'small': 'Klein', - 'medium': 'Normaal', - 'large': 'Groot', - 'x-large': 'Extra groot', - 'custom': 'Handmatig' - }, - fontCustomSize: { - title: 'Handmatige lettergrootte', - label: 'Lettergrootte', - value: '48px' - } + fontFamily: 'Lettertype' }, pt_br: { - fontsize: 'Tamanho da fonte', - fontsizes: { - 'x-small': 'Extra pequeno', - 'small': 'Pequeno', - 'regular': 'Médio', - 'large': 'Grande', - 'x-large': 'Extra grande', - 'custom': 'Personalizado' - }, - fontCustomSize: { - title: 'Tamanho de Fonte Personalizado', - label: 'Tamanho de Fonte', - value: '48px' - } + fontFamily: 'Fonte' }, ru: { - fontsize: 'Размер шрифта', - fontsizes: { - 'x-small': 'Очень маленький', - 'small': 'Маленький', - 'medium': 'Обычный', - 'large': 'Большой', - 'x-large': 'Очень большой', - 'custom': 'Пользовательский' - }, - fontCustomSize: { - title: 'Пользовательский Размер Шрифта', - label: 'Размер Шрифта', - value: '48px' - } + fontFamily: 'Шрифт' }, sl: { - fontsize: 'Velikost pisave', - fontsizes: { - 'x-small': 'Ekstra majhna', - 'small': 'Majhna', - 'medium': 'Navadno', - 'large': 'Velika', - 'x-large': 'Ekstra velika', - 'custom': 'Poljubna' - }, - fontCustomSize: { - title: 'Poljubna velikost pisave', - label: 'Velikost pisave', - value: '48px' - } + fontFamily: 'Pisava' }, tr: { - fontsize: 'Yazı boyutu', - fontsizes: { - 'x-small': 'Çok küçük', - 'small': 'Küçük', - 'medium': 'Normal', - 'large': 'Büyük', - 'x-large': 'Çok büyük', - 'custom': 'Özel' - }, - fontCustomSize: { - title: 'Özel Yazı Boyutu', - label: 'Yazı Boyutu', - value: '48px' - } + fontFamily: 'Yazı tipi' }, zh_tw: { - fontsize: '字體大小', - fontsizes: { - 'x-small': '最小', - 'small': '小', - 'medium': '中', - 'large': '大', - 'x-large': '最大', - 'custom': '自訂大小' - }, - fontCustomSize: { - title: '自訂義字體大小', - label: '字體大小', - value: '48px' - } + fontFamily: '字體' } } }); // jshint camelcase:true var defaultOptions = { - sizeList: ['x-small', 'small', 'medium', 'large', 'x-large'], - allowCustomSize: true + fontList: [{ + name: 'Arial', + family: 'Arial, Helvetica, sans-serif' + }, { + 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' + }, { + name: 'Georgia', + family: 'Georgia, serif' + }, { + name: 'Impact', + family: 'Impact, Charcoal, sans-serif' + }, { + 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' + }, { + name: 'Tahoma', + family: 'Tahoma, Geneva, sans-serif' + }, { + name: 'Times New Roman', + family: 'Times New Roman, Times, serif' + }, { + name: 'Trebuchet', + family: 'Trebuchet MS, Helvetica, sans-serif' + }, { + name: 'Verdana', + family: 'Verdana, Geneva, sans-serif' + }] }; - // Add dropdown with font sizes + // Add dropdown with web safe fonts $.extend(true, $.trumbowyg, { plugins: { - fontsize: { + fontfamily: { init: function init(trumbowyg) { - trumbowyg.o.plugins.fontsize = $.extend({}, defaultOptions, trumbowyg.o.plugins.fontsize || {}); - trumbowyg.addBtnDef('fontsize', { - dropdown: buildDropdown(trumbowyg) + trumbowyg.o.plugins.fontfamily = $.extend({}, defaultOptions, trumbowyg.o.plugins.fontfamily || {}); + trumbowyg.addBtnDef('fontfamily', { + dropdown: buildDropdown(trumbowyg), + hasIcon: false, + text: trumbowyg.lang.fontFamily }); } } } }); - function setFontSize(trumbowyg, size) { - trumbowyg.$ed.focus(); - trumbowyg.saveRange(); - - // Temporary size - trumbowyg.execCmd('fontSize', '1'); - var fontElements = trumbowyg.$ed.find('font[size="1"]'); - - // Remove previous font-size span tags. Needed to prevent Firefox from - // nesting multiple spans on font-size changes. - // (see https://github.com/Alex-D/Trumbowyg/issues/1252) - fontElements.find('span[style*="font-size"]').contents().unwrap(); - - // Find elements that were added and change to with chosen size - fontElements.replaceWith(function () { - return $('', { - css: { - 'font-size': size - }, - html: this.innerHTML - }); - }); - - // Remove and leftover elements - $(trumbowyg.range.startContainer.parentElement).find('span[style=""]').contents().unwrap(); - trumbowyg.restoreRange(); - trumbowyg.syncCode(); - trumbowyg.$c.trigger('tbwchange'); - } function buildDropdown(trumbowyg) { var dropdown = []; - $.each(trumbowyg.o.plugins.fontsize.sizeList, function (index, size) { - trumbowyg.addBtnDef('fontsize_' + size, { - text: '' + (trumbowyg.lang.fontsizes[size] || size) + '', + $.each(trumbowyg.o.plugins.fontfamily.fontList, function (index, font) { + trumbowyg.addBtnDef('fontfamily_' + index, { + title: '' + font.name + '', hasIcon: false, fn: function fn() { - setFontSize(trumbowyg, size); + trumbowyg.execCmd('fontName', font.family, true); } }); - dropdown.push('fontsize_' + size); + dropdown.push('fontfamily_' + index); }); - if (trumbowyg.o.plugins.fontsize.allowCustomSize) { - var customSizeButtonName = 'fontsize_custom'; - var customSizeBtnDef = { - fn: function fn() { - trumbowyg.openModalInsert(trumbowyg.lang.fontCustomSize.title, { - size: { - label: trumbowyg.lang.fontCustomSize.label, - value: trumbowyg.lang.fontCustomSize.value - } - }, function (form) { - setFontSize(trumbowyg, form.size); - return true; - }); - }, - text: '' + trumbowyg.lang.fontsizes.custom + '', - hasIcon: false - }; - trumbowyg.addBtnDef(customSizeButtonName, customSizeBtnDef); - dropdown.push(customSizeButtonName); - } return dropdown; } })(jQuery); -!function (e) { +!function (a) { "use strict"; - e.extend(!0, e.trumbowyg, { + a.extend(!0, a.trumbowyg, { langs: { en: { - fontsize: "Font size", - fontsizes: { - "x-small": "Extra small", - small: "Small", - medium: "Regular", - large: "Large", - "x-large": "Extra large", - custom: "Custom" - }, - fontCustomSize: { - title: "Custom Font Size", - label: "Font Size", - value: "48px" - } + fontFamily: "Font" }, az: { - fontsize: "Şrift həcmi", - fontsizes: { - "x-small": "Daha kiçik", - small: "Kiçik", - medium: "Normal", - large: "Böyük", - "x-large": "Daha böyük", - custom: "Fərdi həcm" - }, - fontCustomSize: { - title: "Fərdi şrift həcmi", - label: "Şrift həcmi", - value: "48px" - } + fontFamily: "Şrift" }, by: { - fontsize: "Памер шрыфта", - fontsizes: { - "x-small": "Вельмі маленькі", - small: "Маленькі", - medium: "Звычайны", - large: "Вялікі", - "x-large": "Вельмі вялікі", - custom: "Карыстальніцкі" - }, - fontCustomSize: { - title: "Карыстальніцкі Памер Шрыфта", - label: "Памер Шрыфта", - value: "48px" - } + fontFamily: "Шрыфт" }, ca: { - fontsize: "Mida de la lletra", - fontsizes: { - "x-small": "Molt petita", - small: "Petita", - medium: "Normal", - large: "Gran", - "x-large": "Molt Gran", - custom: "Personalitzada" - }, - fontCustomSize: { - title: "Mida de lletra personalitzada", - label: "Mida de lletra", - value: "48px" - } + fontFamily: "Font" }, da: { - fontsize: "Skriftstørrelse", - fontsizes: { - "x-small": "Ekstra lille", - small: "Lille", - medium: "Normal", - large: "Stor", - "x-large": "Ekstra stor", - custom: "Brugerdefineret" - } + fontFamily: "Skrifttype" }, de: { - fontsize: "Schriftgröße", - fontsizes: { - "x-small": "Sehr klein", - small: "Klein", - medium: "Normal", - large: "Groß", - "x-large": "Sehr groß", - custom: "Benutzerdefiniert" - }, - fontCustomSize: { - title: "Benutzerdefinierte Schriftgröße", - label: "Schriftgröße", - value: "48px" - } + fontFamily: "Schriftart" }, es: { - fontsize: "Tamaño de Fuente", - fontsizes: { - "x-small": "Extra pequeña", - small: "Pegueña", - medium: "Regular", - large: "Grande", - "x-large": "Extra Grande", - custom: "Customizada" - }, - fontCustomSize: { - title: "Tamaño de Fuente Customizada", - label: "Tamaño de Fuente", - value: "48px" - } + fontFamily: "Fuente" }, et: { - fontsize: "Teksti suurus", - fontsizes: { - "x-small": "Väga väike", - small: "Väike", - medium: "Tavaline", - large: "Suur", - "x-large": "Väga suur", - custom: "Määra ise" - }, - fontCustomSize: { - title: "Kohandatud teksti suurus", - label: "Teksti suurus", - value: "48px" - } + fontFamily: "Font" }, fr: { - fontsize: "Taille de la police", - fontsizes: { - "x-small": "Très petit", - small: "Petit", - medium: "Normal", - large: "Grand", - "x-large": "Très grand", - custom: "Taille personnalisée" - }, - fontCustomSize: { - title: "Taille de police personnalisée", - label: "Taille de la police", - value: "48px" - } + fontFamily: "Police" }, hu: { - fontsize: "Betű méret", - fontsizes: { - "x-small": "Extra kicsi", - small: "Kicsi", - medium: "Normális", - large: "Nagy", - "x-large": "Extra nagy", - custom: "Egyedi" - }, - fontCustomSize: { - title: "Egyedi betű méret", - label: "Betű méret", - value: "48px" - } - }, - it: { - fontsize: "Dimensioni del testo", - fontsizes: { - "x-small": "Molto piccolo", - small: "piccolo", - regular: "normale", - large: "grande", - "x-large": "Molto grande", - custom: "Personalizzato" - }, - fontCustomSize: { - title: "Dimensioni del testo personalizzato", - label: "Dimensioni del testo", - value: "48px" - } + fontFamily: "Betűtípus" }, ko: { - fontsize: "글꼴 크기", - fontsizes: { - "x-small": "아주 작게", - small: "작게", - medium: "보통", - large: "크게", - "x-large": "아주 크게", - custom: "사용자 지정" - }, - fontCustomSize: { - title: "사용자 지정 글꼴 크기", - label: "글꼴 크기", - value: "48px" - } + fontFamily: "글꼴" }, nl: { - fontsize: "Lettergrootte", - fontsizes: { - "x-small": "Extra klein", - small: "Klein", - medium: "Normaal", - large: "Groot", - "x-large": "Extra groot", - custom: "Handmatig" - }, - fontCustomSize: { - title: "Handmatige lettergrootte", - label: "Lettergrootte", - value: "48px" - } + fontFamily: "Lettertype" }, pt_br: { - fontsize: "Tamanho da fonte", - fontsizes: { - "x-small": "Extra pequeno", - small: "Pequeno", - regular: "Médio", - large: "Grande", - "x-large": "Extra grande", - custom: "Personalizado" - }, - fontCustomSize: { - title: "Tamanho de Fonte Personalizado", - label: "Tamanho de Fonte", - value: "48px" - } + fontFamily: "Fonte" }, ru: { - fontsize: "Размер шрифта", - fontsizes: { - "x-small": "Очень маленький", - small: "Маленький", - medium: "Обычный", - large: "Большой", - "x-large": "Очень большой", - custom: "Пользовательский" - }, - fontCustomSize: { - title: "Пользовательский Размер Шрифта", - label: "Размер Шрифта", - value: "48px" - } + fontFamily: "Шрифт" }, sl: { - fontsize: "Velikost pisave", - fontsizes: { - "x-small": "Ekstra majhna", - small: "Majhna", - medium: "Navadno", - large: "Velika", - "x-large": "Ekstra velika", - custom: "Poljubna" - }, - fontCustomSize: { - title: "Poljubna velikost pisave", - label: "Velikost pisave", - value: "48px" - } + fontFamily: "Pisava" }, tr: { - fontsize: "Yazı boyutu", - fontsizes: { - "x-small": "Çok küçük", - small: "Küçük", - medium: "Normal", - large: "Büyük", - "x-large": "Çok büyük", - custom: "Özel" - }, - fontCustomSize: { - title: "Özel Yazı Boyutu", - label: "Yazı Boyutu", - value: "48px" - } + fontFamily: "Yazı tipi" }, zh_tw: { - fontsize: "字體大小", - fontsizes: { - "x-small": "最小", - small: "小", - medium: "中", - large: "大", - "x-large": "最大", - custom: "自訂大小" - }, - fontCustomSize: { - title: "自訂義字體大小", - label: "字體大小", - value: "48px" - } + fontFamily: "字體" } } }); - var t = { - sizeList: ["x-small", "small", "medium", "large", "x-large"], - allowCustomSize: !0 + var n = { + fontList: [{ + name: "Arial", + family: "Arial, Helvetica, sans-serif" + }, { + 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" + }, { + name: "Georgia", + family: "Georgia, serif" + }, { + name: "Impact", + family: "Impact, Charcoal, sans-serif" + }, { + 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" + }, { + name: "Tahoma", + family: "Tahoma, Geneva, sans-serif" + }, { + name: "Times New Roman", + family: "Times New Roman, Times, serif" + }, { + name: "Trebuchet", + family: "Trebuchet MS, Helvetica, sans-serif" + }, { + name: "Verdana", + family: "Verdana, Geneva, sans-serif" + }] }; - function l(t, l) { - t.$ed.focus(), t.saveRange(), t.execCmd("fontSize", "1"); - var a = t.$ed.find('font[size="1"]'); - a.find('span[style*="font-size"]').contents().unwrap(), a.replaceWith(function () { - return e("", { - css: { - "font-size": l - }, - html: this.innerHTML - }); - }), e(t.range.startContainer.parentElement).find('span[style=""]').contents().unwrap(), t.restoreRange(), t.syncCode(), t.$c.trigger("tbwchange"); - } - function a(t) { - var a = []; - if (e.each(t.o.plugins.fontsize.sizeList, function (e, s) { - t.addBtnDef("fontsize_" + s, { - text: '' + (t.lang.fontsizes[s] || s) + "", + function i(n) { + var i = []; + return a.each(n.o.plugins.fontfamily.fontList, function (a, e) { + n.addBtnDef("fontfamily_" + a, { + title: '' + e.name + "", hasIcon: !1, fn: function fn() { - l(t, s); + n.execCmd("fontName", e.family, !0); } - }), a.push("fontsize_" + s); - }), t.o.plugins.fontsize.allowCustomSize) { - var s = "fontsize_custom", - i = { - fn: function fn() { - t.openModalInsert(t.lang.fontCustomSize.title, { - size: { - label: t.lang.fontCustomSize.label, - value: t.lang.fontCustomSize.value - } - }, function (e) { - return l(t, e.size), !0; - }); - }, - text: '' + t.lang.fontsizes.custom + "", - hasIcon: !1 - }; - t.addBtnDef(s, i), a.push(s); - } - return a; + }), i.push("fontfamily_" + a); + }), i; } - e.extend(!0, e.trumbowyg, { + a.extend(!0, a.trumbowyg, { plugins: { - fontsize: { - init: function init(l) { - l.o.plugins.fontsize = e.extend({}, t, l.o.plugins.fontsize || {}), l.addBtnDef("fontsize", { - dropdown: a(l) + fontfamily: { + init: function init(e) { + e.o.plugins.fontfamily = a.extend({}, n, e.o.plugins.fontfamily || {}), e.addBtnDef("fontfamily", { + dropdown: i(e), + hasIcon: !1, + text: e.lang.fontFamily }); } } } }); }(jQuery); +/*/* =========================================================== + * trumbowyg.history.js v1.0 + * history plugin for Trumbowyg + * http://alex-d.github.com/Trumbowyg + * =========================================================== + * Author : Sven Dunemann [dunemann@forelabs.eu] + */ + (function ($) { 'use strict'; - $.extend(true, $.trumbowyg, { - langs: { - // jshint camelcase:false - en: { - fontFamily: 'Font' - }, - az: { - fontFamily: 'Şrift' - }, - by: { - fontFamily: 'Шрыфт' - }, - ca: { - fontFamily: 'Font' - }, - da: { - fontFamily: 'Skrifttype' - }, - de: { - fontFamily: 'Schriftart' - }, - es: { - fontFamily: 'Fuente' - }, - et: { - fontFamily: 'Font' - }, - fr: { - fontFamily: 'Police' - }, - hu: { - fontFamily: 'Betűtípus' - }, - ko: { - fontFamily: '글꼴' - }, - nl: { - fontFamily: 'Lettertype' - }, - pt_br: { - fontFamily: 'Fonte' - }, - ru: { - fontFamily: 'Шрифт' - }, - sl: { - fontFamily: 'Pisava' - }, - tr: { - fontFamily: 'Yazı tipi' - }, - zh_tw: { - fontFamily: '字體' - } - } - }); - // jshint camelcase:true - - var defaultOptions = { - fontList: [{ - name: 'Arial', - family: 'Arial, Helvetica, sans-serif' - }, { - 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' - }, { - name: 'Georgia', - family: 'Georgia, serif' - }, { - name: 'Impact', - family: 'Impact, Charcoal, sans-serif' - }, { - 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' - }, { - name: 'Tahoma', - family: 'Tahoma, Geneva, sans-serif' - }, { - name: 'Times New Roman', - family: 'Times New Roman, Times, serif' - }, { - name: 'Trebuchet', - family: 'Trebuchet MS, Helvetica, sans-serif' - }, { - name: 'Verdana', - family: 'Verdana, Geneva, sans-serif' - }] - }; - - // Add dropdown with web safe fonts $.extend(true, $.trumbowyg, { plugins: { - fontfamily: { - init: function init(trumbowyg) { - trumbowyg.o.plugins.fontfamily = $.extend({}, defaultOptions, trumbowyg.o.plugins.fontfamily || {}); - trumbowyg.addBtnDef('fontfamily', { - dropdown: buildDropdown(trumbowyg), - hasIcon: false, - text: trumbowyg.lang.fontFamily - }); + history: { + destroy: function destroy(t) { + t.$c.off('tbwinit.history tbwchange.history'); + }, + init: function init(t) { + t.o.plugins.history = $.extend(true, { + _stack: [], + _index: -1, + _focusEl: undefined + }, t.o.plugins.history || {}); + var btnBuildDefRedo = { + title: t.lang.redo, + ico: 'redo', + key: 'Y', + fn: function fn() { + if (t.o.plugins.history._index < t.o.plugins.history._stack.length - 1) { + t.o.plugins.history._index += 1; + var index = t.o.plugins.history._index; + var newState = t.o.plugins.history._stack[index]; + t.execCmd('html', newState); + // because of some semantic optimisations we have to save the state back + // to history + t.o.plugins.history._stack[index] = t.$ed.html(); + carretToEnd(); + toggleButtonStates(); + } + } + }; + var btnBuildDefUndo = { + title: t.lang.undo, + ico: 'undo', + key: 'Z', + fn: function fn() { + if (t.o.plugins.history._index > 0) { + t.o.plugins.history._index -= 1; + var index = t.o.plugins.history._index, + newState = t.o.plugins.history._stack[index]; + t.execCmd('html', newState); + // because of some semantic optimisations we have to save the state back + // to history + t.o.plugins.history._stack[index] = t.$ed.html(); + carretToEnd(); + toggleButtonStates(); + } + } + }; + var pushToHistory = function pushToHistory() { + var index = t.o.plugins.history._index, + stack = t.o.plugins.history._stack, + latestState = stack.slice(-1)[0] || '

', + prevState = stack[index], + newState = t.$ed.html(), + focusEl = t.doc.getSelection().focusNode, + focusElText = '', + latestStateTagsList, + newStateTagsList, + prevFocusEl = t.o.plugins.history._focusEl; + latestStateTagsList = $('
' + latestState + '
').find('*').map(function () { + return this.localName; + }); + newStateTagsList = $('
' + newState + '
').find('*').map(function () { + return this.localName; + }); + if (focusEl) { + t.o.plugins.history._focusEl = focusEl; + focusElText = focusEl.outerHTML || focusEl.textContent; + } + if (newState !== prevState) { + // a new stack entry is defined when current insert ends on a whitespace character + // or count of node elements has been changed + // or focused element differs from previous one + if (focusElText.slice(-1).match(/\s/) || !arraysAreIdentical(latestStateTagsList, newStateTagsList) || t.o.plugins.history._index <= 0 || focusEl !== prevFocusEl) { + t.o.plugins.history._index += 1; + // remove newer entries in history when something new was added + // because timeline was changes with interaction + t.o.plugins.history._stack = stack.slice(0, t.o.plugins.history._index); + // now add new state to modified history + t.o.plugins.history._stack.push(newState); + } else { + // modify last stack entry + t.o.plugins.history._stack[index] = newState; + } + toggleButtonStates(); + } + }; + var toggleButtonStates = function toggleButtonStates() { + var index = t.o.plugins.history._index, + stackSize = t.o.plugins.history._stack.length, + undoState = index > 0, + redoState = stackSize !== 0 && index !== stackSize - 1; + toggleButtonState('historyUndo', undoState); + toggleButtonState('historyRedo', redoState); + }; + var toggleButtonState = function toggleButtonState(btn, enable) { + var button = t.$box.find('.trumbowyg-' + btn + '-button'); + if (enable) { + button.removeClass('trumbowyg-disable'); + } else if (!button.hasClass('trumbowyg-disable')) { + button.addClass('trumbowyg-disable'); + } + }; + var arraysAreIdentical = function arraysAreIdentical(a, b) { + if (a === b) { + return true; + } + if (a == null || b == null) { + return false; + } + if (a.length !== b.length) { + return false; + } + for (var i = 0; i < a.length; i += 1) { + if (a[i] !== b[i]) { + return false; + } + } + return true; + }; + var carretToEnd = function carretToEnd() { + var node = t.doc.getSelection().focusNode, + range = t.doc.createRange(); + if (node.childNodes.length > 0) { + range.setStartAfter(node.childNodes[node.childNodes.length - 1]); + range.setEndAfter(node.childNodes[node.childNodes.length - 1]); + t.doc.getSelection().removeAllRanges(); + t.doc.getSelection().addRange(range); + } + }; + t.$c.on('tbwinit.history tbwchange.history', pushToHistory); + t.addBtnDef('historyRedo', btnBuildDefRedo); + t.addBtnDef('historyUndo', btnBuildDefUndo); } } } }); - function buildDropdown(trumbowyg) { - var dropdown = []; - $.each(trumbowyg.o.plugins.fontfamily.fontList, function (index, font) { - trumbowyg.addBtnDef('fontfamily_' + index, { - title: '' + font.name + '', - hasIcon: false, - fn: function fn() { - trumbowyg.execCmd('fontName', font.family, true); - } - }); - dropdown.push('fontfamily_' + index); - }); - return dropdown; - } })(jQuery); -!function (a) { +/*/* =========================================================== + * trumbowyg.history.js v1.0 + * history plugin for Trumbowyg + * http://alex-d.github.com/Trumbowyg + * =========================================================== + * Author : Sven Dunemann [dunemann@forelabs.eu] + */ +!function (i) { "use strict"; - a.extend(!0, a.trumbowyg, { - langs: { - en: { - fontFamily: "Font" - }, - az: { - fontFamily: "Şrift" - }, - by: { - fontFamily: "Шрыфт" - }, - ca: { - fontFamily: "Font" - }, - da: { - fontFamily: "Skrifttype" - }, - de: { - fontFamily: "Schriftart" - }, - es: { - fontFamily: "Fuente" - }, - et: { - fontFamily: "Font" - }, - fr: { - fontFamily: "Police" - }, - hu: { - fontFamily: "Betűtípus" - }, - ko: { - fontFamily: "글꼴" - }, - nl: { - fontFamily: "Lettertype" - }, - pt_br: { - fontFamily: "Fonte" - }, - ru: { - fontFamily: "Шрифт" - }, - sl: { - fontFamily: "Pisava" - }, - tr: { - fontFamily: "Yazı tipi" - }, - zh_tw: { - fontFamily: "字體" - } - } - }); - var n = { - fontList: [{ - name: "Arial", - family: "Arial, Helvetica, sans-serif" - }, { - 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" - }, { - name: "Georgia", - family: "Georgia, serif" - }, { - name: "Impact", - family: "Impact, Charcoal, sans-serif" - }, { - 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" - }, { - name: "Tahoma", - family: "Tahoma, Geneva, sans-serif" - }, { - name: "Times New Roman", - family: "Times New Roman, Times, serif" - }, { - name: "Trebuchet", - family: "Trebuchet MS, Helvetica, sans-serif" - }, { - name: "Verdana", - family: "Verdana, Geneva, sans-serif" - }] - }; - function i(n) { - var i = []; - return a.each(n.o.plugins.fontfamily.fontList, function (a, e) { - n.addBtnDef("fontfamily_" + a, { - title: '' + e.name + "", - hasIcon: !1, - fn: function fn() { - n.execCmd("fontName", e.family, !0); - } - }), i.push("fontfamily_" + a); - }), i; - } - a.extend(!0, a.trumbowyg, { + i.extend(!0, i.trumbowyg, { plugins: { - fontfamily: { - init: function init(e) { - e.o.plugins.fontfamily = a.extend({}, n, e.o.plugins.fontfamily || {}), e.addBtnDef("fontfamily", { - dropdown: i(e), - hasIcon: !1, - text: e.lang.fontFamily - }); + history: { + destroy: function destroy(i) { + i.$c.off("tbwinit.history tbwchange.history"); + }, + init: function init(t) { + t.o.plugins.history = i.extend(!0, { + _stack: [], + _index: -1, + _focusEl: void 0 + }, t.o.plugins.history || {}); + var o = { + title: t.lang.redo, + ico: "redo", + key: "Y", + fn: function fn() { + if (t.o.plugins.history._index < t.o.plugins.history._stack.length - 1) { + t.o.plugins.history._index += 1; + var i = t.o.plugins.history._index, + o = t.o.plugins.history._stack[i]; + t.execCmd("html", o), t.o.plugins.history._stack[i] = t.$ed.html(), r(), s(); + } + } + }, + n = { + title: t.lang.undo, + ico: "undo", + key: "Z", + fn: function fn() { + if (t.o.plugins.history._index > 0) { + t.o.plugins.history._index -= 1; + var i = t.o.plugins.history._index, + o = t.o.plugins.history._stack[i]; + t.execCmd("html", o), t.o.plugins.history._stack[i] = t.$ed.html(), r(), s(); + } + } + }, + s = function s() { + var i = t.o.plugins.history._index, + o = t.o.plugins.history._stack.length, + n = 0 !== o && i !== o - 1; + e("historyUndo", i > 0), e("historyRedo", n); + }, + e = function e(i, o) { + var n = t.$box.find(".trumbowyg-" + i + "-button"); + o ? n.removeClass("trumbowyg-disable") : n.hasClass("trumbowyg-disable") || n.addClass("trumbowyg-disable"); + }, + l = function l(i, t) { + if (i === t) return !0; + if (null == i || null == t) return !1; + if (i.length !== t.length) return !1; + for (var o = 0; o < i.length; o += 1) if (i[o] !== t[o]) return !1; + return !0; + }, + r = function r() { + var i = t.doc.getSelection().focusNode, + o = t.doc.createRange(); + i.childNodes.length > 0 && (o.setStartAfter(i.childNodes[i.childNodes.length - 1]), o.setEndAfter(i.childNodes[i.childNodes.length - 1]), t.doc.getSelection().removeAllRanges(), t.doc.getSelection().addRange(o)); + }; + t.$c.on("tbwinit.history tbwchange.history", function () { + var o, + n, + e = t.o.plugins.history._index, + r = t.o.plugins.history._stack, + d = r.slice(-1)[0] || "

", + u = r[e], + h = t.$ed.html(), + c = t.doc.getSelection().focusNode, + g = "", + a = t.o.plugins.history._focusEl; + o = i("
" + d + "
").find("*").map(function () { + return this.localName; + }), n = i("
" + h + "
").find("*").map(function () { + return this.localName; + }), c && (t.o.plugins.history._focusEl = c, g = c.outerHTML || c.textContent), h !== u && (g.slice(-1).match(/\s/) || !l(o, n) || t.o.plugins.history._index <= 0 || c !== a ? (t.o.plugins.history._index += 1, t.o.plugins.history._stack = r.slice(0, t.o.plugins.history._index), t.o.plugins.history._stack.push(h)) : t.o.plugins.history._stack[e] = h, s()); + }), t.addBtnDef("historyRedo", o), t.addBtnDef("historyUndo", n); } } } }); }(jQuery); +/* =========================================================== + * trumbowyg.indent.js v1.0 + * Indent or Outdent plugin for Trumbowyg + * http://alex-d.github.com/Trumbowyg + * =========================================================== + * Author : Fabacks + * Website : https://github.com/Fabacks + */ + (function ($) { 'use strict'; @@ -2316,604 +1843,872 @@ langs: { // jshint camelcase:false en: { - giphy: 'Insert GIF' + indent: 'Indent', + outdent: 'Outdent' }, az: { - giphy: 'GIF yerləşdir' + indent: 'Girinti', + outdent: 'Çıxıntı' }, by: { - giphy: 'Уставіць GIF' + indent: 'Водступ', + outdent: 'Выступ' }, et: { - giphy: 'Sisesta GIF' + indent: 'Taande suurendamine', + outdent: 'Taande vähendamine' }, fr: { - giphy: 'Insérer un GIF' + indent: 'Augmenter le retrait', + outdent: 'Diminuer le retrait' }, - hu: { - giphy: 'GIF beszúrás' + pt_br: { + indent: 'Aumentar Recuo', + outdent: 'Diminuir Recuo' }, ru: { - giphy: 'Вставить GIF' + indent: 'Отступ', + outdent: 'Выступ' }, sl: { - giphy: 'Vstavi GIF' + indent: 'Povečaj zamik', + outdent: 'Zmanjšaj zamik' }, tr: { - giphy: 'GIF ekle' + indent: 'Girinti', + outdent: 'Çıkıntı' } // jshint camelcase:true } }); - var giphyLogo = ''; // jshint ignore:line - - var CANCEL_EVENT = 'tbwcancel'; - - // Throttle helper - function trumbowygThrottle(callback, delay) { - var last; - var timer; - return function () { - var context = this; - var now = +new Date(); - var args = arguments; - if (last && now < last + delay) { - clearTimeout(timer); - timer = setTimeout(function () { - last = now; - callback.apply(context, args); - }, delay); - } else { - last = now; - callback.apply(context, args); - } - }; - } - - // Fills modal with response gifs - function renderGifs(response, $giphyModal, trumbowyg, mustEmpty) { - var width = ($giphyModal.width() - 20) / 3; - var html = response.data.filter(function (gifData) { - // jshint camelcase:false - var downsized = gifData.images.downsized || gifData.images.downsized_medium; - // jshint camelcase:true - return !!downsized.url; - }).map(function (gifData) { - // jshint camelcase:false - var downsized = gifData.images.downsized || gifData.images.downsized_medium; - // jshint camelcase:true - var image = downsized, - imageRatio = image.height / image.width, - altText = gifData.title; - var imgHtml = '' + altText + ''; - return '
' + imgHtml + '
'; - }).join(''); - if (mustEmpty === true) { - if (html.length === 0) { - if ($('.' + trumbowyg.o.prefix + 'giphy-no-result', $giphyModal).length > 0) { - return; - } - html = ''; - } - $giphyModal.empty(); - } - $giphyModal.append(html); - - // Remove gray overlay on image load - // moved here from inline callback definition due to CSP issue - // Note: this is being done post-factum because load event doesn't bubble up and so can't be delegated - var addLoadedClass = function addLoadedClass(img) { - img.classList.add('tbw-loaded'); - }; - $('img', $giphyModal).each(function () { - var img = this; - if (img.complete) { - // images load instantly when cached and esp. when loaded in previous modal open - addLoadedClass(img); - } else { - img.addEventListener('load', function () { - addLoadedClass(this); - }); - } - }); - $('img', $giphyModal).on('click', function () { - var src = $(this).attr('src'), - alt = $(this).attr('alt'); - trumbowyg.restoreRange(); - trumbowyg.execCmd('insertImage', src, false, true); - - // relay alt tag into inserted image - if (alt) { - var $img = $('img[src="' + src + '"]:not([alt])', trumbowyg.$box); - $img.attr('alt', alt); - // Note: This seems to fire relatively early and could be wrapped in a setTimeout if needed - trumbowyg.syncCode(); - } - $('img', $giphyModal).off(); - trumbowyg.closeModal(); - }); - } - var defaultOptions = { - rating: 'g', - apiKey: null, - throttleDelay: 300, - noResultGifUrl: 'https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif' - }; - - // Add dropdown with font sizes + // Adds the extra button definition $.extend(true, $.trumbowyg, { plugins: { - giphy: { + paragraph: { init: function init(trumbowyg) { - trumbowyg.o.plugins.giphy = $.extend({}, defaultOptions, trumbowyg.o.plugins.giphy || {}); - trumbowyg.addBtnDef('giphy', { - fn: function fn() { - if (trumbowyg.o.plugins.giphy.apiKey === null) { - throw new Error('You must set a Giphy API Key'); - } - var BASE_URL = 'https://api.giphy.com/v1/gifs/search?api_key=' + trumbowyg.o.plugins.giphy.apiKey + '&rating=' + trumbowyg.o.plugins.giphy.rating, - DEFAULT_URL = BASE_URL.replace('/search', '/trending'); - var previousAjaxCall = { - abort: function abort() {} - }; - var prefix = trumbowyg.o.prefix; - - // Create and open the modal - var searchInput = '', - closeButton = '', - poweredByGiphy = '
Powered by' + giphyLogo + '
', - giphyModalHtml = searchInput + closeButton + poweredByGiphy + '
'; - trumbowyg.openModal(null, giphyModalHtml, false).one(CANCEL_EVENT, function () { - try { - previousAjaxCall.abort(); - } catch (e) {} - trumbowyg.closeModal(); - }); - var $giphyInput = $('.' + prefix + 'giphy-search'), - $giphyClose = $('.' + prefix + 'giphy-close'), - $giphyModal = $('.' + prefix + 'giphy-modal'); - var ajaxError = function ajaxError() { - if (!navigator.onLine && !$('.' + prefix + 'giphy-offline', $giphyModal).length) { - $giphyModal.empty(); - $giphyModal.append('

You are offline

'); - } - }; - - // Load trending gifs as default - $.ajax({ - url: DEFAULT_URL, - dataType: 'json', - success: function success(response) { - renderGifs(response, $giphyModal, trumbowyg, true); - }, - error: ajaxError - }); - var searchGifsOnInput = function searchGifsOnInput() { - var query = $giphyInput.val(); - if (query.length === 0) { - return; - } - try { - previousAjaxCall.abort(); - } catch (e) {} - previousAjaxCall = $.ajax({ - url: BASE_URL + '&q=' + encodeURIComponent(query), - dataType: 'json', - success: function success(response) { - renderGifs(response, $giphyModal, trumbowyg, true); - }, - error: ajaxError - }); - }; - var throttledInputRequest = trumbowygThrottle(searchGifsOnInput, trumbowyg.o.plugins.giphy.throttleDelay); - $giphyInput.on('input', throttledInputRequest); - $giphyInput.focus(); - $giphyClose.one('click', function () { - $giphyModal.trigger(CANCEL_EVENT); - }); - } - }); + var indentBtnDef = { + fn: 'indent', + title: trumbowyg.lang.indent, + isSupported: function isSupported() { + return !!document.queryCommandSupported && !!document.queryCommandSupported('indent'); + }, + ico: 'indent' + }; + var outdentBtnDef = { + fn: 'outdent', + title: trumbowyg.lang.outdent, + isSupported: function isSupported() { + return !!document.queryCommandSupported && !!document.queryCommandSupported('outdent'); + }, + ico: 'outdent' + }; + trumbowyg.addBtnDef('indent', indentBtnDef); + trumbowyg.addBtnDef('outdent', outdentBtnDef); } } } }); })(jQuery); -!function (i) { +/* =========================================================== + * trumbowyg.indent.js v1.0 + * Indent or Outdent plugin for Trumbowyg + * http://alex-d.github.com/Trumbowyg + * =========================================================== + * Author : Fabacks + * Website : https://github.com/Fabacks + */ +!function (n) { "use strict"; - i.extend(!0, i.trumbowyg, { + n.extend(!0, n.trumbowyg, { langs: { en: { - giphy: "Insert GIF" + indent: "Indent", + outdent: "Outdent" }, az: { - giphy: "GIF yerləşdir" + indent: "Girinti", + outdent: "Çıxıntı" }, by: { - giphy: "Уставіць GIF" + indent: "Водступ", + outdent: "Выступ" }, et: { - giphy: "Sisesta GIF" + indent: "Taande suurendamine", + outdent: "Taande vähendamine" }, fr: { - giphy: "Insérer un GIF" + indent: "Augmenter le retrait", + outdent: "Diminuer le retrait" }, - hu: { - giphy: "GIF beszúrás" + pt_br: { + indent: "Aumentar Recuo", + outdent: "Diminuir Recuo" }, ru: { - giphy: "Вставить GIF" + indent: "Отступ", + outdent: "Выступ" }, sl: { - giphy: "Vstavi GIF" + indent: "Povečaj zamik", + outdent: "Zmanjšaj zamik" }, tr: { - giphy: "GIF ekle" + indent: "Girinti", + outdent: "Çıkıntı" } } - }); - var e = "tbwcancel"; - function t(e, t, n, l) { - var a = (t.width() - 20) / 3, - o = e.data.filter(function (i) { - return !!(i.images.downsized || i.images.downsized_medium).url; - }).map(function (i) { - var e = i.images.downsized || i.images.downsized_medium, - t = e.height / e.width, - n = i.title; - return '
' + ("' + n + '') + "
"; - }).join(""); - if (!0 === l) { - if (0 === o.length) { - if (i("." + n.o.prefix + "giphy-no-result", t).length > 0) return; - o = ''; - } - t.empty(); - } - t.append(o); - var c = function c(i) { - i.classList.add("tbw-loaded"); - }; - i("img", t).each(function () { - var i = this; - i.complete ? c(i) : i.addEventListener("load", function () { - c(this); - }); - }), i("img", t).on("click", function () { - var e = i(this).attr("src"), - l = i(this).attr("alt"); - (n.restoreRange(), n.execCmd("insertImage", e, !1, !0), l) && (i('img[src="' + e + '"]:not([alt])', n.$box).attr("alt", l), n.syncCode()); - i("img", t).off(), n.closeModal(); - }); - } - var n = { - rating: "g", - apiKey: null, - throttleDelay: 300, - noResultGifUrl: "https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif" - }; - i.extend(!0, i.trumbowyg, { - plugins: { - giphy: { - init: function init(l) { - l.o.plugins.giphy = i.extend({}, n, l.o.plugins.giphy || {}), l.addBtnDef("giphy", { - fn: function fn() { - if (null === l.o.plugins.giphy.apiKey) throw new Error("You must set a Giphy API Key"); - var n = "https://api.giphy.com/v1/gifs/search?api_key=" + l.o.plugins.giphy.apiKey + "&rating=" + l.o.plugins.giphy.rating, - a = n.replace("/search", "/trending"), - o = { - abort: function abort() {} - }, - c = l.o.prefix, - r = '' + ('') + ('
Powered by
') + '
'; - l.openModal(null, r, !1).one(e, function () { - try { - o.abort(); - } catch (i) {} - l.closeModal(); - }); - var s = i("." + c + "giphy-search"), - g = i("." + c + "giphy-close"), - p = i("." + c + "giphy-modal"), - h = function h() { - navigator.onLine || i("." + c + "giphy-offline", p).length || (p.empty(), p.append('

You are offline

')); - }; - i.ajax({ - url: a, - dataType: "json", - success: function success(i) { - t(i, p, l, !0); - }, - error: h - }); - var u, - d, - y, - f, - m = (u = function u() { - var e = s.val(); - if (0 !== e.length) { - try { - o.abort(); - } catch (i) {} - o = i.ajax({ - url: n + "&q=" + encodeURIComponent(e), - dataType: "json", - success: function success(i) { - t(i, p, l, !0); - }, - error: h - }); - } - }, d = l.o.plugins.giphy.throttleDelay, function () { - var i = this, - e = +new Date(), - t = arguments; - y && e < y + d ? (clearTimeout(f), f = setTimeout(function () { - y = e, u.apply(i, t); - }, d)) : (y = e, u.apply(i, t)); - }); - s.on("input", m), s.focus(), g.one("click", function () { - p.trigger(e); - }); - } - }); - } + }), n.extend(!0, n.trumbowyg, { + plugins: { + paragraph: { + init: function init(n) { + var t = { + fn: "indent", + title: n.lang.indent, + isSupported: function isSupported() { + return !!document.queryCommandSupported && !!document.queryCommandSupported("indent"); + }, + ico: "indent" + }, + e = { + fn: "outdent", + title: n.lang.outdent, + isSupported: function isSupported() { + return !!document.queryCommandSupported && !!document.queryCommandSupported("outdent"); + }, + ico: "outdent" + }; + n.addBtnDef("indent", t), n.addBtnDef("outdent", e); + } } } }); }(jQuery); -/*/* =========================================================== - * trumbowyg.history.js v1.0 - * history plugin for Trumbowyg - * http://alex-d.github.com/Trumbowyg - * =========================================================== - * Author : Sven Dunemann [dunemann@forelabs.eu] - */ - (function ($) { 'use strict'; $.extend(true, $.trumbowyg, { - plugins: { - history: { - destroy: function destroy(t) { - t.$c.off('tbwinit.history tbwchange.history'); + langs: { + // jshint camelcase:false + en: { + fontsize: 'Font size', + fontsizes: { + 'x-small': 'Extra small', + 'small': 'Small', + 'medium': 'Regular', + 'large': 'Large', + 'x-large': 'Extra large', + 'custom': 'Custom' }, - init: function init(t) { - t.o.plugins.history = $.extend(true, { - _stack: [], - _index: -1, - _focusEl: undefined - }, t.o.plugins.history || {}); - var btnBuildDefRedo = { - title: t.lang.redo, - ico: 'redo', - key: 'Y', - fn: function fn() { - if (t.o.plugins.history._index < t.o.plugins.history._stack.length - 1) { - t.o.plugins.history._index += 1; - var index = t.o.plugins.history._index; - var newState = t.o.plugins.history._stack[index]; - t.execCmd('html', newState); - // because of some semantic optimisations we have to save the state back - // to history - t.o.plugins.history._stack[index] = t.$ed.html(); - carretToEnd(); - toggleButtonStates(); - } - } - }; - var btnBuildDefUndo = { - title: t.lang.undo, - ico: 'undo', - key: 'Z', - fn: function fn() { - if (t.o.plugins.history._index > 0) { - t.o.plugins.history._index -= 1; - var index = t.o.plugins.history._index, - newState = t.o.plugins.history._stack[index]; - t.execCmd('html', newState); - // because of some semantic optimisations we have to save the state back - // to history - t.o.plugins.history._stack[index] = t.$ed.html(); - carretToEnd(); - toggleButtonStates(); - } - } - }; - var pushToHistory = function pushToHistory() { - var index = t.o.plugins.history._index, - stack = t.o.plugins.history._stack, - latestState = stack.slice(-1)[0] || '

', - prevState = stack[index], - newState = t.$ed.html(), - focusEl = t.doc.getSelection().focusNode, - focusElText = '', - latestStateTagsList, - newStateTagsList, - prevFocusEl = t.o.plugins.history._focusEl; - latestStateTagsList = $('
' + latestState + '
').find('*').map(function () { - return this.localName; - }); - newStateTagsList = $('
' + newState + '
').find('*').map(function () { - return this.localName; - }); - if (focusEl) { - t.o.plugins.history._focusEl = focusEl; - focusElText = focusEl.outerHTML || focusEl.textContent; - } - if (newState !== prevState) { - // a new stack entry is defined when current insert ends on a whitespace character - // or count of node elements has been changed - // or focused element differs from previous one - if (focusElText.slice(-1).match(/\s/) || !arraysAreIdentical(latestStateTagsList, newStateTagsList) || t.o.plugins.history._index <= 0 || focusEl !== prevFocusEl) { - t.o.plugins.history._index += 1; - // remove newer entries in history when something new was added - // because timeline was changes with interaction - t.o.plugins.history._stack = stack.slice(0, t.o.plugins.history._index); - // now add new state to modified history - t.o.plugins.history._stack.push(newState); - } else { - // modify last stack entry - t.o.plugins.history._stack[index] = newState; - } - toggleButtonStates(); - } - }; - var toggleButtonStates = function toggleButtonStates() { - var index = t.o.plugins.history._index, - stackSize = t.o.plugins.history._stack.length, - undoState = index > 0, - redoState = stackSize !== 0 && index !== stackSize - 1; - toggleButtonState('historyUndo', undoState); - toggleButtonState('historyRedo', redoState); - }; - var toggleButtonState = function toggleButtonState(btn, enable) { - var button = t.$box.find('.trumbowyg-' + btn + '-button'); - if (enable) { - button.removeClass('trumbowyg-disable'); - } else if (!button.hasClass('trumbowyg-disable')) { - button.addClass('trumbowyg-disable'); - } - }; - var arraysAreIdentical = function arraysAreIdentical(a, b) { - if (a === b) { - return true; - } - if (a == null || b == null) { - return false; - } - if (a.length !== b.length) { - return false; - } - for (var i = 0; i < a.length; i += 1) { - if (a[i] !== b[i]) { - return false; - } - } - return true; - }; - var carretToEnd = function carretToEnd() { - var node = t.doc.getSelection().focusNode, - range = t.doc.createRange(); - if (node.childNodes.length > 0) { - range.setStartAfter(node.childNodes[node.childNodes.length - 1]); - range.setEndAfter(node.childNodes[node.childNodes.length - 1]); - t.doc.getSelection().removeAllRanges(); - t.doc.getSelection().addRange(range); - } - }; - t.$c.on('tbwinit.history tbwchange.history', pushToHistory); - t.addBtnDef('historyRedo', btnBuildDefRedo); - t.addBtnDef('historyUndo', btnBuildDefUndo); + fontCustomSize: { + title: 'Custom Font Size', + label: 'Font Size', + value: '48px' + } + }, + az: { + fontsize: 'Şrift həcmi', + fontsizes: { + 'x-small': 'Daha kiçik', + 'small': 'Kiçik', + 'medium': 'Normal', + 'large': 'Böyük', + 'x-large': 'Daha böyük', + 'custom': 'Fərdi həcm' + }, + fontCustomSize: { + title: 'Fərdi şrift həcmi', + label: 'Şrift həcmi', + value: '48px' + } + }, + by: { + fontsize: 'Памер шрыфта', + fontsizes: { + 'x-small': 'Вельмі маленькі', + 'small': 'Маленькі', + 'medium': 'Звычайны', + 'large': 'Вялікі', + 'x-large': 'Вельмі вялікі', + 'custom': 'Карыстальніцкі' + }, + fontCustomSize: { + title: 'Карыстальніцкі Памер Шрыфта', + label: 'Памер Шрыфта', + value: '48px' + } + }, + ca: { + fontsize: 'Mida de la lletra', + fontsizes: { + 'x-small': 'Molt petita', + 'small': 'Petita', + 'medium': 'Normal', + 'large': 'Gran', + 'x-large': 'Molt Gran', + 'custom': 'Personalitzada' + }, + fontCustomSize: { + title: 'Mida de lletra personalitzada', + label: 'Mida de lletra', + value: '48px' + } + }, + da: { + fontsize: 'Skriftstørrelse', + fontsizes: { + 'x-small': 'Ekstra lille', + 'small': 'Lille', + 'medium': 'Normal', + 'large': 'Stor', + 'x-large': 'Ekstra stor', + 'custom': 'Brugerdefineret' + } + }, + de: { + fontsize: 'Schriftgröße', + fontsizes: { + 'x-small': 'Sehr klein', + 'small': 'Klein', + 'medium': 'Normal', + 'large': 'Groß', + 'x-large': 'Sehr groß', + 'custom': 'Benutzerdefiniert' + }, + fontCustomSize: { + title: 'Benutzerdefinierte Schriftgröße', + label: 'Schriftgröße', + value: '48px' + } + }, + es: { + fontsize: 'Tamaño de Fuente', + fontsizes: { + 'x-small': 'Extra pequeña', + 'small': 'Pegueña', + 'medium': 'Regular', + 'large': 'Grande', + 'x-large': 'Extra Grande', + 'custom': 'Customizada' + }, + fontCustomSize: { + title: 'Tamaño de Fuente Customizada', + label: 'Tamaño de Fuente', + value: '48px' + } + }, + et: { + fontsize: 'Teksti suurus', + fontsizes: { + 'x-small': 'Väga väike', + 'small': 'Väike', + 'medium': 'Tavaline', + 'large': 'Suur', + 'x-large': 'Väga suur', + 'custom': 'Määra ise' + }, + fontCustomSize: { + title: 'Kohandatud teksti suurus', + label: 'Teksti suurus', + value: '48px' + } + }, + fr: { + fontsize: 'Taille de la police', + fontsizes: { + 'x-small': 'Très petit', + 'small': 'Petit', + 'medium': 'Normal', + 'large': 'Grand', + 'x-large': 'Très grand', + 'custom': 'Taille personnalisée' + }, + fontCustomSize: { + title: 'Taille de police personnalisée', + label: 'Taille de la police', + value: '48px' + } + }, + hu: { + fontsize: 'Betű méret', + fontsizes: { + 'x-small': 'Extra kicsi', + 'small': 'Kicsi', + 'medium': 'Normális', + 'large': 'Nagy', + 'x-large': 'Extra nagy', + 'custom': 'Egyedi' + }, + fontCustomSize: { + title: 'Egyedi betű méret', + label: 'Betű méret', + value: '48px' + } + }, + it: { + fontsize: 'Dimensioni del testo', + fontsizes: { + 'x-small': 'Molto piccolo', + 'small': 'piccolo', + 'regular': 'normale', + 'large': 'grande', + 'x-large': 'Molto grande', + 'custom': 'Personalizzato' + }, + fontCustomSize: { + title: 'Dimensioni del testo personalizzato', + label: 'Dimensioni del testo', + value: '48px' + } + }, + ko: { + fontsize: '글꼴 크기', + fontsizes: { + 'x-small': '아주 작게', + 'small': '작게', + 'medium': '보통', + 'large': '크게', + 'x-large': '아주 크게', + 'custom': '사용자 지정' + }, + fontCustomSize: { + title: '사용자 지정 글꼴 크기', + label: '글꼴 크기', + value: '48px' + } + }, + nl: { + fontsize: 'Lettergrootte', + fontsizes: { + 'x-small': 'Extra klein', + 'small': 'Klein', + 'medium': 'Normaal', + 'large': 'Groot', + 'x-large': 'Extra groot', + 'custom': 'Handmatig' + }, + fontCustomSize: { + title: 'Handmatige lettergrootte', + label: 'Lettergrootte', + value: '48px' + } + }, + pt_br: { + fontsize: 'Tamanho da fonte', + fontsizes: { + 'x-small': 'Extra pequeno', + 'small': 'Pequeno', + 'regular': 'Médio', + 'large': 'Grande', + 'x-large': 'Extra grande', + 'custom': 'Personalizado' + }, + fontCustomSize: { + title: 'Tamanho de Fonte Personalizado', + label: 'Tamanho de Fonte', + value: '48px' + } + }, + ru: { + fontsize: 'Размер шрифта', + fontsizes: { + 'x-small': 'Очень маленький', + 'small': 'Маленький', + 'medium': 'Обычный', + 'large': 'Большой', + 'x-large': 'Очень большой', + 'custom': 'Пользовательский' + }, + fontCustomSize: { + title: 'Пользовательский Размер Шрифта', + label: 'Размер Шрифта', + value: '48px' + } + }, + sl: { + fontsize: 'Velikost pisave', + fontsizes: { + 'x-small': 'Ekstra majhna', + 'small': 'Majhna', + 'medium': 'Navadno', + 'large': 'Velika', + 'x-large': 'Ekstra velika', + 'custom': 'Poljubna' + }, + fontCustomSize: { + title: 'Poljubna velikost pisave', + label: 'Velikost pisave', + value: '48px' + } + }, + tr: { + fontsize: 'Yazı boyutu', + fontsizes: { + 'x-small': 'Çok küçük', + 'small': 'Küçük', + 'medium': 'Normal', + 'large': 'Büyük', + 'x-large': 'Çok büyük', + 'custom': 'Özel' + }, + fontCustomSize: { + title: 'Özel Yazı Boyutu', + label: 'Yazı Boyutu', + value: '48px' + } + }, + zh_tw: { + fontsize: '字體大小', + fontsizes: { + 'x-small': '最小', + 'small': '小', + 'medium': '中', + 'large': '大', + 'x-large': '最大', + 'custom': '自訂大小' + }, + fontCustomSize: { + title: '自訂義字體大小', + label: '字體大小', + value: '48px' + } + } + } + }); + // jshint camelcase:true + + var defaultOptions = { + sizeList: ['x-small', 'small', 'medium', 'large', 'x-large'], + allowCustomSize: true + }; + + // Add dropdown with font sizes + $.extend(true, $.trumbowyg, { + plugins: { + fontsize: { + init: function init(trumbowyg) { + trumbowyg.o.plugins.fontsize = $.extend({}, defaultOptions, trumbowyg.o.plugins.fontsize || {}); + trumbowyg.addBtnDef('fontsize', { + dropdown: buildDropdown(trumbowyg) + }); + } + } + } + }); + function setFontSize(trumbowyg, size) { + trumbowyg.$ed.focus(); + trumbowyg.saveRange(); + + // Temporary size + trumbowyg.execCmd('fontSize', '1'); + var fontElements = trumbowyg.$ed.find('font[size="1"]'); + + // Remove previous font-size span tags. Needed to prevent Firefox from + // nesting multiple spans on font-size changes. + // (see https://github.com/Alex-D/Trumbowyg/issues/1252) + fontElements.find('span[style*="font-size"]').contents().unwrap(); + + // Find elements that were added and change to with chosen size + fontElements.replaceWith(function () { + return $('', { + css: { + 'font-size': size + }, + html: this.innerHTML + }); + }); + + // Remove and leftover elements + $(trumbowyg.range.startContainer.parentElement).find('span[style=""]').contents().unwrap(); + trumbowyg.restoreRange(); + trumbowyg.syncCode(); + trumbowyg.$c.trigger('tbwchange'); + } + function buildDropdown(trumbowyg) { + var dropdown = []; + $.each(trumbowyg.o.plugins.fontsize.sizeList, function (index, size) { + trumbowyg.addBtnDef('fontsize_' + size, { + text: '' + (trumbowyg.lang.fontsizes[size] || size) + '', + hasIcon: false, + fn: function fn() { + setFontSize(trumbowyg, size); + } + }); + dropdown.push('fontsize_' + size); + }); + if (trumbowyg.o.plugins.fontsize.allowCustomSize) { + var customSizeButtonName = 'fontsize_custom'; + var customSizeBtnDef = { + fn: function fn() { + trumbowyg.openModalInsert(trumbowyg.lang.fontCustomSize.title, { + size: { + label: trumbowyg.lang.fontCustomSize.label, + value: trumbowyg.lang.fontCustomSize.value + } + }, function (form) { + setFontSize(trumbowyg, form.size); + return true; + }); + }, + text: '' + trumbowyg.lang.fontsizes.custom + '', + hasIcon: false + }; + trumbowyg.addBtnDef(customSizeButtonName, customSizeBtnDef); + dropdown.push(customSizeButtonName); + } + return dropdown; + } +})(jQuery); +!function (e) { + "use strict"; + + e.extend(!0, e.trumbowyg, { + langs: { + en: { + fontsize: "Font size", + fontsizes: { + "x-small": "Extra small", + small: "Small", + medium: "Regular", + large: "Large", + "x-large": "Extra large", + custom: "Custom" + }, + fontCustomSize: { + title: "Custom Font Size", + label: "Font Size", + value: "48px" + } + }, + az: { + fontsize: "Şrift həcmi", + fontsizes: { + "x-small": "Daha kiçik", + small: "Kiçik", + medium: "Normal", + large: "Böyük", + "x-large": "Daha böyük", + custom: "Fərdi həcm" + }, + fontCustomSize: { + title: "Fərdi şrift həcmi", + label: "Şrift həcmi", + value: "48px" + } + }, + by: { + fontsize: "Памер шрыфта", + fontsizes: { + "x-small": "Вельмі маленькі", + small: "Маленькі", + medium: "Звычайны", + large: "Вялікі", + "x-large": "Вельмі вялікі", + custom: "Карыстальніцкі" + }, + fontCustomSize: { + title: "Карыстальніцкі Памер Шрыфта", + label: "Памер Шрыфта", + value: "48px" + } + }, + ca: { + fontsize: "Mida de la lletra", + fontsizes: { + "x-small": "Molt petita", + small: "Petita", + medium: "Normal", + large: "Gran", + "x-large": "Molt Gran", + custom: "Personalitzada" + }, + fontCustomSize: { + title: "Mida de lletra personalitzada", + label: "Mida de lletra", + value: "48px" + } + }, + da: { + fontsize: "Skriftstørrelse", + fontsizes: { + "x-small": "Ekstra lille", + small: "Lille", + medium: "Normal", + large: "Stor", + "x-large": "Ekstra stor", + custom: "Brugerdefineret" + } + }, + de: { + fontsize: "Schriftgröße", + fontsizes: { + "x-small": "Sehr klein", + small: "Klein", + medium: "Normal", + large: "Groß", + "x-large": "Sehr groß", + custom: "Benutzerdefiniert" + }, + fontCustomSize: { + title: "Benutzerdefinierte Schriftgröße", + label: "Schriftgröße", + value: "48px" + } + }, + es: { + fontsize: "Tamaño de Fuente", + fontsizes: { + "x-small": "Extra pequeña", + small: "Pegueña", + medium: "Regular", + large: "Grande", + "x-large": "Extra Grande", + custom: "Customizada" + }, + fontCustomSize: { + title: "Tamaño de Fuente Customizada", + label: "Tamaño de Fuente", + value: "48px" + } + }, + et: { + fontsize: "Teksti suurus", + fontsizes: { + "x-small": "Väga väike", + small: "Väike", + medium: "Tavaline", + large: "Suur", + "x-large": "Väga suur", + custom: "Määra ise" + }, + fontCustomSize: { + title: "Kohandatud teksti suurus", + label: "Teksti suurus", + value: "48px" + } + }, + fr: { + fontsize: "Taille de la police", + fontsizes: { + "x-small": "Très petit", + small: "Petit", + medium: "Normal", + large: "Grand", + "x-large": "Très grand", + custom: "Taille personnalisée" + }, + fontCustomSize: { + title: "Taille de police personnalisée", + label: "Taille de la police", + value: "48px" + } + }, + hu: { + fontsize: "Betű méret", + fontsizes: { + "x-small": "Extra kicsi", + small: "Kicsi", + medium: "Normális", + large: "Nagy", + "x-large": "Extra nagy", + custom: "Egyedi" + }, + fontCustomSize: { + title: "Egyedi betű méret", + label: "Betű méret", + value: "48px" + } + }, + it: { + fontsize: "Dimensioni del testo", + fontsizes: { + "x-small": "Molto piccolo", + small: "piccolo", + regular: "normale", + large: "grande", + "x-large": "Molto grande", + custom: "Personalizzato" + }, + fontCustomSize: { + title: "Dimensioni del testo personalizzato", + label: "Dimensioni del testo", + value: "48px" + } + }, + ko: { + fontsize: "글꼴 크기", + fontsizes: { + "x-small": "아주 작게", + small: "작게", + medium: "보통", + large: "크게", + "x-large": "아주 크게", + custom: "사용자 지정" + }, + fontCustomSize: { + title: "사용자 지정 글꼴 크기", + label: "글꼴 크기", + value: "48px" + } + }, + nl: { + fontsize: "Lettergrootte", + fontsizes: { + "x-small": "Extra klein", + small: "Klein", + medium: "Normaal", + large: "Groot", + "x-large": "Extra groot", + custom: "Handmatig" + }, + fontCustomSize: { + title: "Handmatige lettergrootte", + label: "Lettergrootte", + value: "48px" + } + }, + pt_br: { + fontsize: "Tamanho da fonte", + fontsizes: { + "x-small": "Extra pequeno", + small: "Pequeno", + regular: "Médio", + large: "Grande", + "x-large": "Extra grande", + custom: "Personalizado" + }, + fontCustomSize: { + title: "Tamanho de Fonte Personalizado", + label: "Tamanho de Fonte", + value: "48px" + } + }, + ru: { + fontsize: "Размер шрифта", + fontsizes: { + "x-small": "Очень маленький", + small: "Маленький", + medium: "Обычный", + large: "Большой", + "x-large": "Очень большой", + custom: "Пользовательский" + }, + fontCustomSize: { + title: "Пользовательский Размер Шрифта", + label: "Размер Шрифта", + value: "48px" + } + }, + sl: { + fontsize: "Velikost pisave", + fontsizes: { + "x-small": "Ekstra majhna", + small: "Majhna", + medium: "Navadno", + large: "Velika", + "x-large": "Ekstra velika", + custom: "Poljubna" + }, + fontCustomSize: { + title: "Poljubna velikost pisave", + label: "Velikost pisave", + value: "48px" + } + }, + tr: { + fontsize: "Yazı boyutu", + fontsizes: { + "x-small": "Çok küçük", + small: "Küçük", + medium: "Normal", + large: "Büyük", + "x-large": "Çok büyük", + custom: "Özel" + }, + fontCustomSize: { + title: "Özel Yazı Boyutu", + label: "Yazı Boyutu", + value: "48px" + } + }, + zh_tw: { + fontsize: "字體大小", + fontsizes: { + "x-small": "最小", + small: "小", + medium: "中", + large: "大", + "x-large": "最大", + custom: "自訂大小" + }, + fontCustomSize: { + title: "自訂義字體大小", + label: "字體大小", + value: "48px" + } + } + } + }); + var t = { + sizeList: ["x-small", "small", "medium", "large", "x-large"], + allowCustomSize: !0 + }; + function l(t, l) { + t.$ed.focus(), t.saveRange(), t.execCmd("fontSize", "1"); + var a = t.$ed.find('font[size="1"]'); + a.find('span[style*="font-size"]').contents().unwrap(), a.replaceWith(function () { + return e("", { + css: { + "font-size": l + }, + html: this.innerHTML + }); + }), e(t.range.startContainer.parentElement).find('span[style=""]').contents().unwrap(), t.restoreRange(), t.syncCode(), t.$c.trigger("tbwchange"); + } + function a(t) { + var a = []; + if (e.each(t.o.plugins.fontsize.sizeList, function (e, s) { + t.addBtnDef("fontsize_" + s, { + text: '' + (t.lang.fontsizes[s] || s) + "", + hasIcon: !1, + fn: function fn() { + l(t, s); } - } + }), a.push("fontsize_" + s); + }), t.o.plugins.fontsize.allowCustomSize) { + var s = "fontsize_custom", + i = { + fn: function fn() { + t.openModalInsert(t.lang.fontCustomSize.title, { + size: { + label: t.lang.fontCustomSize.label, + value: t.lang.fontCustomSize.value + } + }, function (e) { + return l(t, e.size), !0; + }); + }, + text: '' + t.lang.fontsizes.custom + "", + hasIcon: !1 + }; + t.addBtnDef(s, i), a.push(s); } - }); -})(jQuery); -/*/* =========================================================== - * trumbowyg.history.js v1.0 - * history plugin for Trumbowyg - * http://alex-d.github.com/Trumbowyg - * =========================================================== - * Author : Sven Dunemann [dunemann@forelabs.eu] - */ -!function (i) { - "use strict"; - - i.extend(!0, i.trumbowyg, { + return a; + } + e.extend(!0, e.trumbowyg, { plugins: { - history: { - destroy: function destroy(i) { - i.$c.off("tbwinit.history tbwchange.history"); - }, - init: function init(t) { - t.o.plugins.history = i.extend(!0, { - _stack: [], - _index: -1, - _focusEl: void 0 - }, t.o.plugins.history || {}); - var o = { - title: t.lang.redo, - ico: "redo", - key: "Y", - fn: function fn() { - if (t.o.plugins.history._index < t.o.plugins.history._stack.length - 1) { - t.o.plugins.history._index += 1; - var i = t.o.plugins.history._index, - o = t.o.plugins.history._stack[i]; - t.execCmd("html", o), t.o.plugins.history._stack[i] = t.$ed.html(), r(), s(); - } - } - }, - n = { - title: t.lang.undo, - ico: "undo", - key: "Z", - fn: function fn() { - if (t.o.plugins.history._index > 0) { - t.o.plugins.history._index -= 1; - var i = t.o.plugins.history._index, - o = t.o.plugins.history._stack[i]; - t.execCmd("html", o), t.o.plugins.history._stack[i] = t.$ed.html(), r(), s(); - } - } - }, - s = function s() { - var i = t.o.plugins.history._index, - o = t.o.plugins.history._stack.length, - n = 0 !== o && i !== o - 1; - e("historyUndo", i > 0), e("historyRedo", n); - }, - e = function e(i, o) { - var n = t.$box.find(".trumbowyg-" + i + "-button"); - o ? n.removeClass("trumbowyg-disable") : n.hasClass("trumbowyg-disable") || n.addClass("trumbowyg-disable"); - }, - l = function l(i, t) { - if (i === t) return !0; - if (null == i || null == t) return !1; - if (i.length !== t.length) return !1; - for (var o = 0; o < i.length; o += 1) if (i[o] !== t[o]) return !1; - return !0; - }, - r = function r() { - var i = t.doc.getSelection().focusNode, - o = t.doc.createRange(); - i.childNodes.length > 0 && (o.setStartAfter(i.childNodes[i.childNodes.length - 1]), o.setEndAfter(i.childNodes[i.childNodes.length - 1]), t.doc.getSelection().removeAllRanges(), t.doc.getSelection().addRange(o)); - }; - t.$c.on("tbwinit.history tbwchange.history", function () { - var o, - n, - e = t.o.plugins.history._index, - r = t.o.plugins.history._stack, - d = r.slice(-1)[0] || "

", - u = r[e], - h = t.$ed.html(), - c = t.doc.getSelection().focusNode, - g = "", - a = t.o.plugins.history._focusEl; - o = i("
" + d + "
").find("*").map(function () { - return this.localName; - }), n = i("
" + h + "
").find("*").map(function () { - return this.localName; - }), c && (t.o.plugins.history._focusEl = c, g = c.outerHTML || c.textContent), h !== u && (g.slice(-1).match(/\s/) || !l(o, n) || t.o.plugins.history._index <= 0 || c !== a ? (t.o.plugins.history._index += 1, t.o.plugins.history._stack = r.slice(0, t.o.plugins.history._index), t.o.plugins.history._stack.push(h)) : t.o.plugins.history._stack[e] = h, s()); - }), t.addBtnDef("historyRedo", o), t.addBtnDef("historyUndo", n); + fontsize: { + init: function init(l) { + l.o.plugins.fontsize = e.extend({}, t, l.o.plugins.fontsize || {}), l.addBtnDef("fontsize", { + dropdown: a(l) + }); } } } }); }(jQuery); -/* =========================================================== - * trumbowyg.indent.js v1.0 - * Indent or Outdent plugin for Trumbowyg - * http://alex-d.github.com/Trumbowyg - * =========================================================== - * Author : Fabacks - * Website : https://github.com/Fabacks - */ - (function ($) { 'use strict'; @@ -2921,144 +2716,349 @@ langs: { // jshint camelcase:false en: { - indent: 'Indent', - outdent: 'Outdent' + giphy: 'Insert GIF' }, az: { - indent: 'Girinti', - outdent: 'Çıxıntı' + giphy: 'GIF yerləşdir' }, by: { - indent: 'Водступ', - outdent: 'Выступ' + giphy: 'Уставіць GIF' }, et: { - indent: 'Taande suurendamine', - outdent: 'Taande vähendamine' + giphy: 'Sisesta GIF' }, fr: { - indent: 'Augmenter le retrait', - outdent: 'Diminuer le retrait' + giphy: 'Insérer un GIF' }, - pt_br: { - indent: 'Aumentar Recuo', - outdent: 'Diminuir Recuo' + hu: { + giphy: 'GIF beszúrás' }, ru: { - indent: 'Отступ', - outdent: 'Выступ' + giphy: 'Вставить GIF' }, sl: { - indent: 'Povečaj zamik', - outdent: 'Zmanjšaj zamik' + giphy: 'Vstavi GIF' }, tr: { - indent: 'Girinti', - outdent: 'Çıkıntı' + giphy: 'GIF ekle' } // jshint camelcase:true } }); - // Adds the extra button definition + var giphyLogo = ''; // jshint ignore:line + + var CANCEL_EVENT = 'tbwcancel'; + + // Throttle helper + function trumbowygThrottle(callback, delay) { + var last; + var timer; + return function () { + var context = this; + var now = +new Date(); + var args = arguments; + if (last && now < last + delay) { + clearTimeout(timer); + timer = setTimeout(function () { + last = now; + callback.apply(context, args); + }, delay); + } else { + last = now; + callback.apply(context, args); + } + }; + } + + // Fills modal with response gifs + function renderGifs(response, $giphyModal, trumbowyg, mustEmpty) { + var width = ($giphyModal.width() - 20) / 3; + var html = response.data.filter(function (gifData) { + // jshint camelcase:false + var downsized = gifData.images.downsized || gifData.images.downsized_medium; + // jshint camelcase:true + return !!downsized.url; + }).map(function (gifData) { + // jshint camelcase:false + var downsized = gifData.images.downsized || gifData.images.downsized_medium; + // jshint camelcase:true + var image = downsized, + imageRatio = image.height / image.width, + altText = gifData.title; + var imgHtml = '' + altText + ''; + return '
' + imgHtml + '
'; + }).join(''); + if (mustEmpty === true) { + if (html.length === 0) { + if ($('.' + trumbowyg.o.prefix + 'giphy-no-result', $giphyModal).length > 0) { + return; + } + html = ''; + } + $giphyModal.empty(); + } + $giphyModal.append(html); + + // Remove gray overlay on image load + // moved here from inline callback definition due to CSP issue + // Note: this is being done post-factum because load event doesn't bubble up and so can't be delegated + var addLoadedClass = function addLoadedClass(img) { + img.classList.add('tbw-loaded'); + }; + $('img', $giphyModal).each(function () { + var img = this; + if (img.complete) { + // images load instantly when cached and esp. when loaded in previous modal open + addLoadedClass(img); + } else { + img.addEventListener('load', function () { + addLoadedClass(this); + }); + } + }); + $('img', $giphyModal).on('click', function () { + var src = $(this).attr('src'), + alt = $(this).attr('alt'); + trumbowyg.restoreRange(); + trumbowyg.execCmd('insertImage', src, false, true); + + // relay alt tag into inserted image + if (alt) { + var $img = $('img[src="' + src + '"]:not([alt])', trumbowyg.$box); + $img.attr('alt', alt); + // Note: This seems to fire relatively early and could be wrapped in a setTimeout if needed + trumbowyg.syncCode(); + } + $('img', $giphyModal).off(); + trumbowyg.closeModal(); + }); + } + var defaultOptions = { + rating: 'g', + apiKey: null, + throttleDelay: 300, + noResultGifUrl: 'https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif' + }; + + // Add dropdown with font sizes $.extend(true, $.trumbowyg, { plugins: { - paragraph: { + giphy: { init: function init(trumbowyg) { - var indentBtnDef = { - fn: 'indent', - title: trumbowyg.lang.indent, - isSupported: function isSupported() { - return !!document.queryCommandSupported && !!document.queryCommandSupported('indent'); - }, - ico: 'indent' - }; - var outdentBtnDef = { - fn: 'outdent', - title: trumbowyg.lang.outdent, - isSupported: function isSupported() { - return !!document.queryCommandSupported && !!document.queryCommandSupported('outdent'); - }, - ico: 'outdent' - }; - trumbowyg.addBtnDef('indent', indentBtnDef); - trumbowyg.addBtnDef('outdent', outdentBtnDef); + trumbowyg.o.plugins.giphy = $.extend({}, defaultOptions, trumbowyg.o.plugins.giphy || {}); + trumbowyg.addBtnDef('giphy', { + fn: function fn() { + if (trumbowyg.o.plugins.giphy.apiKey === null) { + throw new Error('You must set a Giphy API Key'); + } + var BASE_URL = 'https://api.giphy.com/v1/gifs/search?api_key=' + trumbowyg.o.plugins.giphy.apiKey + '&rating=' + trumbowyg.o.plugins.giphy.rating, + DEFAULT_URL = BASE_URL.replace('/search', '/trending'); + var previousAjaxCall = { + abort: function abort() {} + }; + var prefix = trumbowyg.o.prefix; + + // Create and open the modal + var searchInput = '', + closeButton = '', + poweredByGiphy = '
Powered by' + giphyLogo + '
', + giphyModalHtml = searchInput + closeButton + poweredByGiphy + '
'; + trumbowyg.openModal(null, giphyModalHtml, false).one(CANCEL_EVENT, function () { + try { + previousAjaxCall.abort(); + } catch (e) {} + trumbowyg.closeModal(); + }); + var $giphyInput = $('.' + prefix + 'giphy-search'), + $giphyClose = $('.' + prefix + 'giphy-close'), + $giphyModal = $('.' + prefix + 'giphy-modal'); + var ajaxError = function ajaxError() { + if (!navigator.onLine && !$('.' + prefix + 'giphy-offline', $giphyModal).length) { + $giphyModal.empty(); + $giphyModal.append('

You are offline

'); + } + }; + + // Load trending gifs as default + $.ajax({ + url: DEFAULT_URL, + dataType: 'json', + success: function success(response) { + renderGifs(response, $giphyModal, trumbowyg, true); + }, + error: ajaxError + }); + var searchGifsOnInput = function searchGifsOnInput() { + var query = $giphyInput.val(); + if (query.length === 0) { + return; + } + try { + previousAjaxCall.abort(); + } catch (e) {} + previousAjaxCall = $.ajax({ + url: BASE_URL + '&q=' + encodeURIComponent(query), + dataType: 'json', + success: function success(response) { + renderGifs(response, $giphyModal, trumbowyg, true); + }, + error: ajaxError + }); + }; + var throttledInputRequest = trumbowygThrottle(searchGifsOnInput, trumbowyg.o.plugins.giphy.throttleDelay); + $giphyInput.on('input', throttledInputRequest); + $giphyInput.focus(); + $giphyClose.one('click', function () { + $giphyModal.trigger(CANCEL_EVENT); + }); + } + }); } } } }); })(jQuery); -/* =========================================================== - * trumbowyg.indent.js v1.0 - * Indent or Outdent plugin for Trumbowyg - * http://alex-d.github.com/Trumbowyg - * =========================================================== - * Author : Fabacks - * Website : https://github.com/Fabacks - */ -!function (n) { +!function (i) { "use strict"; - n.extend(!0, n.trumbowyg, { + i.extend(!0, i.trumbowyg, { langs: { en: { - indent: "Indent", - outdent: "Outdent" + giphy: "Insert GIF" }, az: { - indent: "Girinti", - outdent: "Çıxıntı" + giphy: "GIF yerləşdir" }, by: { - indent: "Водступ", - outdent: "Выступ" + giphy: "Уставіць GIF" }, et: { - indent: "Taande suurendamine", - outdent: "Taande vähendamine" + giphy: "Sisesta GIF" }, fr: { - indent: "Augmenter le retrait", - outdent: "Diminuer le retrait" + giphy: "Insérer un GIF" }, - pt_br: { - indent: "Aumentar Recuo", - outdent: "Diminuir Recuo" + hu: { + giphy: "GIF beszúrás" }, ru: { - indent: "Отступ", - outdent: "Выступ" + giphy: "Вставить GIF" }, sl: { - indent: "Povečaj zamik", - outdent: "Zmanjšaj zamik" + giphy: "Vstavi GIF" }, tr: { - indent: "Girinti", - outdent: "Çıkıntı" + giphy: "GIF ekle" } } - }), n.extend(!0, n.trumbowyg, { + }); + var e = "tbwcancel"; + function t(e, t, n, l) { + var a = (t.width() - 20) / 3, + o = e.data.filter(function (i) { + return !!(i.images.downsized || i.images.downsized_medium).url; + }).map(function (i) { + var e = i.images.downsized || i.images.downsized_medium, + t = e.height / e.width, + n = i.title; + return '
' + ("' + n + '') + "
"; + }).join(""); + if (!0 === l) { + if (0 === o.length) { + if (i("." + n.o.prefix + "giphy-no-result", t).length > 0) return; + o = ''; + } + t.empty(); + } + t.append(o); + var c = function c(i) { + i.classList.add("tbw-loaded"); + }; + i("img", t).each(function () { + var i = this; + i.complete ? c(i) : i.addEventListener("load", function () { + c(this); + }); + }), i("img", t).on("click", function () { + var e = i(this).attr("src"), + l = i(this).attr("alt"); + (n.restoreRange(), n.execCmd("insertImage", e, !1, !0), l) && (i('img[src="' + e + '"]:not([alt])', n.$box).attr("alt", l), n.syncCode()); + i("img", t).off(), n.closeModal(); + }); + } + var n = { + rating: "g", + apiKey: null, + throttleDelay: 300, + noResultGifUrl: "https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif" + }; + i.extend(!0, i.trumbowyg, { plugins: { - paragraph: { - init: function init(n) { - var t = { - fn: "indent", - title: n.lang.indent, - isSupported: function isSupported() { - return !!document.queryCommandSupported && !!document.queryCommandSupported("indent"); - }, - ico: "indent" - }, - e = { - fn: "outdent", - title: n.lang.outdent, - isSupported: function isSupported() { - return !!document.queryCommandSupported && !!document.queryCommandSupported("outdent"); - }, - ico: "outdent" - }; - n.addBtnDef("indent", t), n.addBtnDef("outdent", e); + giphy: { + init: function init(l) { + l.o.plugins.giphy = i.extend({}, n, l.o.plugins.giphy || {}), l.addBtnDef("giphy", { + fn: function fn() { + if (null === l.o.plugins.giphy.apiKey) throw new Error("You must set a Giphy API Key"); + var n = "https://api.giphy.com/v1/gifs/search?api_key=" + l.o.plugins.giphy.apiKey + "&rating=" + l.o.plugins.giphy.rating, + a = n.replace("/search", "/trending"), + o = { + abort: function abort() {} + }, + c = l.o.prefix, + r = '' + ('') + ('
Powered by
') + '
'; + l.openModal(null, r, !1).one(e, function () { + try { + o.abort(); + } catch (i) {} + l.closeModal(); + }); + var s = i("." + c + "giphy-search"), + g = i("." + c + "giphy-close"), + p = i("." + c + "giphy-modal"), + h = function h() { + navigator.onLine || i("." + c + "giphy-offline", p).length || (p.empty(), p.append('

You are offline

')); + }; + i.ajax({ + url: a, + dataType: "json", + success: function success(i) { + t(i, p, l, !0); + }, + error: h + }); + var u, + d, + y, + f, + m = (u = function u() { + var e = s.val(); + if (0 !== e.length) { + try { + o.abort(); + } catch (i) {} + o = i.ajax({ + url: n + "&q=" + encodeURIComponent(e), + dataType: "json", + success: function success(i) { + t(i, p, l, !0); + }, + error: h + }); + } + }, d = l.o.plugins.giphy.throttleDelay, function () { + var i = this, + e = +new Date(), + t = arguments; + y && e < y + d ? (clearTimeout(f), f = setTimeout(function () { + y = e, u.apply(i, t); + }, d)) : (y = e, u.apply(i, t)); + }); + s.on("input", m), s.focus(), g.one("click", function () { + p.trigger(e); + }); + } + }); } } } @@ -3445,216 +3445,215 @@ } }); }(jQuery); -/*/* =========================================================== - * trumbowyg.insertaudio.js v1.0 - * InsertAudio plugin for Trumbowyg +/* =========================================================== + * trumbowyg.mention.js v0.1 + * Mention plugin for Trumbowyg * http://alex-d.github.com/Trumbowyg * =========================================================== - * Author : Adam Hess (AdamHess) + * Author : Viper + * Github: https://github.com/Globulopolis + * Website: http://киноархив.com */ (function ($) { 'use strict'; - var insertAudioOptions = { - src: { - label: 'URL', - required: true - }, - autoplay: { - label: 'AutoPlay', - required: false, - type: 'checkbox' - }, - muted: { - label: 'Muted', - required: false, - type: 'checkbox' - }, - preload: { - label: 'preload options', - required: false - } + var defaultOptions = { + source: [], + formatDropdownItem: formatDropdownItem, + formatResult: formatResult }; $.extend(true, $.trumbowyg, { langs: { // jshint camelcase:false en: { - insertAudio: 'Insert Audio' + mention: 'Mention' }, az: { - insertAudio: 'Səs yerləşdir' + mention: 'Bildirmək' }, by: { - insertAudio: 'Уставіць аўдыё' - }, - ca: { - insertAudio: 'Inserir Audio' + mention: 'Згадаць' }, da: { - insertAudio: 'Indsæt lyd' - }, - es: { - insertAudio: 'Insertar Audio' + mention: 'Nævn' }, et: { - insertAudio: 'Lisa helifail' + mention: 'Maini' }, fr: { - insertAudio: 'Insérer un son' + mention: 'Mentionner' }, hu: { - insertAudio: 'Audio beszúrás' - }, - ja: { - insertAudio: '音声の挿入' + mention: 'Említ' }, ko: { - insertAudio: '소리 넣기' + mention: '언급' }, pt_br: { - insertAudio: 'Inserir áudio' + mention: 'Menção' }, ru: { - insertAudio: 'Вставить аудио' + mention: 'Упомянуть' }, sl: { - insertAudio: 'Vstavi zvočno datoteko' + mention: 'Omeni' }, tr: { - insertAudio: 'Ses Ekle' + mention: 'Bahset' + }, + zh_tw: { + mention: '標記' } // jshint camelcase:true }, plugins: { - insertAudio: { + mention: { init: function init(trumbowyg) { + trumbowyg.o.plugins.mention = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.mention || {}); var btnDef = { - fn: function fn() { - var insertAudioCallback = function insertAudioCallback(v) { - // controls should always be show otherwise the audio will - // be invisible defeating the point of a wysiwyg - var html = '