diff --git a/dist/langs/az.js b/dist/langs/az.js index 2c2dfbc9..82c2e455 100644 --- a/dist/langs/az.js +++ b/dist/langs/az.js @@ -60,4 +60,4 @@ jQuery.trumbowyg.langs.az = { text: 'Mətn', removeformat: 'Formatlamanı təmizlə' -}; \ No newline at end of file +}; diff --git a/dist/langs/da.js b/dist/langs/da.js index bb031163..5b8df1de 100644 --- a/dist/langs/da.js +++ b/dist/langs/da.js @@ -61,4 +61,4 @@ jQuery.trumbowyg.langs.da = { text: 'Tekst', target: 'Mål', width: 'Bredde' -}; \ No newline at end of file +}; diff --git a/dist/langs/es_ar.js b/dist/langs/es_ar.js index 5c74c40f..74a7f2c0 100644 --- a/dist/langs/es_ar.js +++ b/dist/langs/es_ar.js @@ -53,4 +53,4 @@ jQuery.trumbowyg.langs.es_ar = { description: 'Descripción', title: 'Título', text: 'Texto' -}; \ No newline at end of file +}; diff --git a/dist/langs/et.js b/dist/langs/et.js index 64ae782d..d773feee 100644 --- a/dist/langs/et.js +++ b/dist/langs/et.js @@ -10,8 +10,8 @@ jQuery.trumbowyg.langs.et = { viewHTML: 'HTML vaade', - undo: 'Võta tagasi', - redo: 'Tee uuesti', + undo: 'Võta tagasi', + redo: 'Tee uuesti', formatting: 'Vorming', p: 'Lõik', @@ -28,8 +28,8 @@ jQuery.trumbowyg.langs.et = { em: 'Rõhutus', del: 'Eemaldatud', - superscript: 'Ülemine indeks', - subscript: 'Alumine indeks', + superscript: 'Ülemine indeks', + subscript: 'Alumine indeks', unorderedList: 'Järjestamata loend', orderedList: 'Järjestatud loend', @@ -46,7 +46,7 @@ jQuery.trumbowyg.langs.et = { justifyFull: 'Joonda rööpselt', horizontalRule: 'Horisontaaljoon', - removeformat: 'Eemalda vorming', + removeformat: 'Eemalda vorming', fullscreen: 'Täisekraan', @@ -59,7 +59,7 @@ jQuery.trumbowyg.langs.et = { description: 'Kirjeldus', title: 'Pealkiri', text: 'Tekst', - target: 'Sihtmärk', - width: 'Laius' + target: 'Sihtmärk', + width: 'Laius' }; diff --git a/dist/langs/fa.js b/dist/langs/fa.js index 347cf807..2ca8ff82 100644 --- a/dist/langs/fa.js +++ b/dist/langs/fa.js @@ -10,7 +10,7 @@ jQuery.trumbowyg.langs.fa = { _dir: 'rtl', - + viewHTML: 'نمایش کد اچ تی ام ال', formatting: 'قالب بندی', diff --git a/dist/langs/fi.js b/dist/langs/fi.js index cc620c2d..a2b92cd7 100644 --- a/dist/langs/fi.js +++ b/dist/langs/fi.js @@ -9,7 +9,7 @@ jQuery.trumbowyg.langs.fi = { viewHTML: 'Näytä HTML', - + undo: 'Kumoa', redo: 'Tee uudelleen', diff --git a/dist/langs/he.js b/dist/langs/he.js index 1826523d..a17c3370 100644 --- a/dist/langs/he.js +++ b/dist/langs/he.js @@ -54,4 +54,4 @@ jQuery.trumbowyg.langs.he = { description: 'תיאור', title: 'כותרת', text: 'טקסט' -}; \ No newline at end of file +}; diff --git a/dist/langs/id.js b/dist/langs/id.js index 32aabb36..0aee9ea7 100644 --- a/dist/langs/id.js +++ b/dist/langs/id.js @@ -54,4 +54,4 @@ jQuery.trumbowyg.langs.id = { description: 'Deskripsi', title: 'Judul', text: 'Teks' -}; \ No newline at end of file +}; diff --git a/dist/langs/it.js b/dist/langs/it.js index 199b9b9e..9da5c446 100644 --- a/dist/langs/it.js +++ b/dist/langs/it.js @@ -8,7 +8,7 @@ jQuery.trumbowyg.langs.it = { viewHTML: 'Mostra HTML', - + undo: 'Annulla', redo: 'Ripeti', @@ -58,5 +58,5 @@ jQuery.trumbowyg.langs.it = { removeformat: 'Rimuovi Formattazione', superscript: 'Apice', - subscript: 'Pedice', + subscript: 'Pedice' }; diff --git a/dist/langs/lt.js b/dist/langs/lt.js index 83207ed6..a3e44e42 100644 --- a/dist/langs/lt.js +++ b/dist/langs/lt.js @@ -55,5 +55,5 @@ jQuery.trumbowyg.langs.lt = { removeformat: 'Pašalinti formatavimą', superscript: 'Viršutinis indeksas', - subscript: 'Apatinis indeksas', + subscript: 'Apatinis indeksas' }; diff --git a/dist/langs/mn.js b/dist/langs/mn.js index ffee651b..c71eaa28 100644 --- a/dist/langs/mn.js +++ b/dist/langs/mn.js @@ -7,43 +7,43 @@ */ jQuery.trumbowyg.langs.mn = { - viewHTML: 'HTML харах', - undo: 'Буцаах', - redo: 'Дахих', - formatting: 'Формат', - p: 'Догол мөр', - blockquote: 'Ишлэл', - code: 'Код', - header: 'Гарчиг', - bold: 'Тод', - italic: 'Налуу', - strikethrough: 'Дундуур зураас', - underline: 'Доогуур зураас', - strong: 'Тод', - em: 'Налуу', - del: 'Дундуур зураас', - superscript: 'Дээд индекс', - subscript: 'Доод индекс', - unorderedList: 'Дугаарлаагүй жагсаалт', - orderedList: 'Дугаарласан жагсаалт', - insertImage: 'Зураг оруулах', - insertVideo: 'Видео оруулах', - link: 'Холбоос', - createLink: 'Холбоос үүсгэх', - unlink: 'Холбоос цуцлах', - justifyLeft: 'Зүүн тийш шахах', - justifyCenter: 'Голлуулах', - justifyRight: 'Баруун Баруун тийш шахах', - justifyFull: 'Тэгшитгэх', - horizontalRule: 'Хөндлөн шугам', - removeformat: 'Формат арилгах', - fullscreen: 'Дэлгэц дүүргэх', - close: 'Хаах', - submit: 'Оруулах', - reset: 'Цуцлах', - required: 'Шаардлагатай', - description: 'Тайлбар', - title: 'Гарчиг', - text: 'Текст', - target: 'Бай' + viewHTML: 'HTML харах', + undo: 'Буцаах', + redo: 'Дахих', + formatting: 'Формат', + p: 'Догол мөр', + blockquote: 'Ишлэл', + code: 'Код', + header: 'Гарчиг', + bold: 'Тод', + italic: 'Налуу', + strikethrough: 'Дундуур зураас', + underline: 'Доогуур зураас', + strong: 'Тод', + em: 'Налуу', + del: 'Дундуур зураас', + superscript: 'Дээд индекс', + subscript: 'Доод индекс', + unorderedList: 'Дугаарлаагүй жагсаалт', + orderedList: 'Дугаарласан жагсаалт', + insertImage: 'Зураг оруулах', + insertVideo: 'Видео оруулах', + link: 'Холбоос', + createLink: 'Холбоос үүсгэх', + unlink: 'Холбоос цуцлах', + justifyLeft: 'Зүүн тийш шахах', + justifyCenter: 'Голлуулах', + justifyRight: 'Баруун Баруун тийш шахах', + justifyFull: 'Тэгшитгэх', + horizontalRule: 'Хөндлөн шугам', + removeformat: 'Формат арилгах', + fullscreen: 'Дэлгэц дүүргэх', + close: 'Хаах', + submit: 'Оруулах', + reset: 'Цуцлах', + required: 'Шаардлагатай', + description: 'Тайлбар', + title: 'Гарчиг', + text: 'Текст', + target: 'Бай' }; diff --git a/dist/langs/nb.js b/dist/langs/nb.js index 18bf6435..5d663ab4 100644 --- a/dist/langs/nb.js +++ b/dist/langs/nb.js @@ -16,7 +16,7 @@ jQuery.trumbowyg.langs.nb = { viewHTML: 'Vis HTML', - undo: 'Angre', + undo: 'Angre', redo: 'Gjør om', formatting: 'Formater', @@ -34,7 +34,7 @@ jQuery.trumbowyg.langs.nb = { em: 'Kursiv', del: 'Slettet', - superscript: 'Hevet', + superscript: 'Hevet', subscript: 'Senket', unorderedList: 'Punktliste', @@ -52,7 +52,7 @@ jQuery.trumbowyg.langs.nb = { justifyFull: 'Blokkjuster', horizontalRule: 'Horisontal linje', - removeformat: 'Fjern formatering', + removeformat: 'Fjern formatering', fullscreen: 'Fullskjerm', @@ -65,6 +65,6 @@ jQuery.trumbowyg.langs.nb = { description: 'Beskrivelse', title: 'Tittel', text: 'Tekst', - target: 'Mål', + target: 'Mål', width: 'Bredde' }; diff --git a/dist/langs/pl.js b/dist/langs/pl.js index a963583d..17e3ab62 100644 --- a/dist/langs/pl.js +++ b/dist/langs/pl.js @@ -52,4 +52,4 @@ jQuery.trumbowyg.langs.pl = { description: 'Opis', title: 'Tytuł', text: 'Tekst' -}; \ No newline at end of file +}; diff --git a/dist/langs/pt.js b/dist/langs/pt.js index 6873b7c0..6a3644ad 100644 --- a/dist/langs/pt.js +++ b/dist/langs/pt.js @@ -11,7 +11,7 @@ jQuery.trumbowyg.langs.pt = { viewHTML: 'Ver HTML', - + undo: 'Desfazer', redo: 'Refazer', @@ -32,7 +32,7 @@ jQuery.trumbowyg.langs.pt = { superscript: 'Sobrescrito', subscript: 'Subscrito', - + unorderedList: 'Lista não ordenada', orderedList: 'Lista ordenada', diff --git a/dist/langs/pt_br.js b/dist/langs/pt_br.js index 251dba8f..9e662fb1 100644 --- a/dist/langs/pt_br.js +++ b/dist/langs/pt_br.js @@ -11,7 +11,7 @@ // jshint camelcase:false jQuery.trumbowyg.langs.pt_br = { viewHTML: 'Ver HTML', - + undo: 'Desfazer', redo: 'Refazer', @@ -32,7 +32,7 @@ jQuery.trumbowyg.langs.pt_br = { superscript: 'Sobrescrito', subscript: 'Subscrito', - + unorderedList: 'Lista não ordenada', orderedList: 'Lista ordenada', diff --git a/dist/langs/rs.js b/dist/langs/rs.js index b529e27a..6431dbac 100644 --- a/dist/langs/rs.js +++ b/dist/langs/rs.js @@ -50,4 +50,4 @@ jQuery.trumbowyg.langs.rs = { description: 'Опис', title: 'Наслов', text: 'Текст' -}; \ No newline at end of file +}; diff --git a/dist/langs/rs_latin.js b/dist/langs/rs_latin.js index 3931cde4..d7183697 100644 --- a/dist/langs/rs_latin.js +++ b/dist/langs/rs_latin.js @@ -51,4 +51,4 @@ jQuery.trumbowyg.langs.rs_latin = { description: 'Opis', title: 'Naslov', text: 'Tеkst' -}; \ No newline at end of file +}; diff --git a/dist/langs/sq.js b/dist/langs/sq.js index da3543a7..b9921e6c 100644 --- a/dist/langs/sq.js +++ b/dist/langs/sq.js @@ -7,7 +7,7 @@ */ jQuery.trumbowyg.langs.sq = { - + viewHTML: 'Shfaq HTML', undo: 'Prish', @@ -62,4 +62,4 @@ jQuery.trumbowyg.langs.sq = { text: 'Tekst', target: 'Objektivi', width: 'Gjeresia' -}; \ No newline at end of file +}; diff --git a/dist/langs/th.js b/dist/langs/th.js index 90db2e06..f07c6ac0 100644 --- a/dist/langs/th.js +++ b/dist/langs/th.js @@ -8,48 +8,48 @@ */ jQuery.trumbowyg.langs.th = { - viewHTML: 'ดู HTML', + viewHTML: 'ดู HTML', - formatting: 'จัดรูปแบบ', - p: 'ย่อหน้า', - blockquote: 'อ้างอิง', - code: 'โค๊ด', - header: 'ส่วนหัว', + formatting: 'จัดรูปแบบ', + p: 'ย่อหน้า', + blockquote: 'อ้างอิง', + code: 'โค๊ด', + header: 'ส่วนหัว', - bold: 'หนา', - italic: 'เอียง', - strikethrough: 'ขีดทับ', - underline: 'เส้นใต้', + bold: 'หนา', + italic: 'เอียง', + strikethrough: 'ขีดทับ', + underline: 'เส้นใต้', - strong: 'สำคัญ', - em: 'เน้น', - del: 'ลบ', + strong: 'สำคัญ', + em: 'เน้น', + del: 'ลบ', - unorderedList: 'รายการ', - orderedList: 'รายการ(ตัวเลข)', + unorderedList: 'รายการ', + orderedList: 'รายการ(ตัวเลข)', - insertImage: 'ใส่รูป', - insertVideo: 'ใส่วิดีโอ', - link: 'ลิงค์', - createLink: 'สร้างลิงค์', - unlink: 'ยกเลิกลิงค์', + insertImage: 'ใส่รูป', + insertVideo: 'ใส่วิดีโอ', + link: 'ลิงค์', + createLink: 'สร้างลิงค์', + unlink: 'ยกเลิกลิงค์', - justifyLeft: 'ชิดซ้าย', - justifyCenter: 'กลาง', - justifyRight: 'ชิดขวา', - justifyFull: 'เต็มบรรทัด', + justifyLeft: 'ชิดซ้าย', + justifyCenter: 'กลาง', + justifyRight: 'ชิดขวา', + justifyFull: 'เต็มบรรทัด', - horizontalRule: 'เส้นแนวนอน', + horizontalRule: 'เส้นแนวนอน', - fullscreen: 'เต็มหน้าจอ', + fullscreen: 'เต็มหน้าจอ', - close: 'ปิด', + close: 'ปิด', - submit: 'ตกลง', - reset: 'เริ่มใหม่', + submit: 'ตกลง', + reset: 'เริ่มใหม่', - required: 'จำเป็น', - description: 'คำอธิบาย', - title: 'หัวเรื่อง', - text: 'ข้อความ' + required: 'จำเป็น', + description: 'คำอธิบาย', + title: 'หัวเรื่อง', + text: 'ข้อความ' }; diff --git a/dist/langs/zh_cn.js b/dist/langs/zh_cn.js index 80877a42..15ea439f 100644 --- a/dist/langs/zh_cn.js +++ b/dist/langs/zh_cn.js @@ -54,4 +54,4 @@ jQuery.trumbowyg.langs.zh_cn = { description: '描述', title: '标题', text: '文字' -}; \ No newline at end of file +}; diff --git a/dist/langs/zh_tw.js b/dist/langs/zh_tw.js index c2368596..87e5a6aa 100644 --- a/dist/langs/zh_tw.js +++ b/dist/langs/zh_tw.js @@ -63,4 +63,4 @@ jQuery.trumbowyg.langs.zh_tw = { text: '文字', target: '目標', width: '寬度' -}; \ No newline at end of file +}; diff --git a/dist/plugins/colors/ui/sass/trumbowyg.colors.scss b/dist/plugins/colors/ui/sass/trumbowyg.colors.scss index efda94ff..a8185929 100644 --- a/dist/plugins/colors/ui/sass/trumbowyg.colors.scss +++ b/dist/plugins/colors/ui/sass/trumbowyg.colors.scss @@ -1,6 +1,6 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - * Default stylesheet for Trumbowyg editor plugin + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor + * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ * @license MIT diff --git a/dist/plugins/colors/ui/trumbowyg.colors.css b/dist/plugins/colors/ui/trumbowyg.colors.css index c89798eb..a5c85344 100644 --- a/dist/plugins/colors/ui/trumbowyg.colors.css +++ b/dist/plugins/colors/ui/trumbowyg.colors.css @@ -1,5 +1,5 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ diff --git a/dist/plugins/colors/ui/trumbowyg.colors.min.css b/dist/plugins/colors/ui/trumbowyg.colors.min.css index 17c724d5..88081238 100644 --- a/dist/plugins/colors/ui/trumbowyg.colors.min.css +++ b/dist/plugins/colors/ui/trumbowyg.colors.min.css @@ -1,2 +1,2 @@ -/** Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ +/** Trumbowyg v2.30.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ .trumbowyg-dropdown-backColor:not(.trumbowyg-dropdown--color-list),.trumbowyg-dropdown-foreColor:not(.trumbowyg-dropdown--color-list){max-width:276px;padding:7px 5px;overflow:initial}.trumbowyg-dropdown-backColor:not(.trumbowyg-dropdown--color-list) button,.trumbowyg-dropdown-foreColor:not(.trumbowyg-dropdown--color-list) button{display:block;position:relative;float:left;text-indent:-9999px;height:20px;width:20px;border:1px solid #333;padding:0;margin:2px}.trumbowyg-dropdown-backColor:not(.trumbowyg-dropdown--color-list) button:focus::after,.trumbowyg-dropdown-backColor:not(.trumbowyg-dropdown--color-list) button:hover::after,.trumbowyg-dropdown-foreColor:not(.trumbowyg-dropdown--color-list) button:focus::after,.trumbowyg-dropdown-foreColor:not(.trumbowyg-dropdown--color-list) button:hover::after{content:" ";display:block;position:absolute;top:-5px;left:-5px;width:27px;height:27px;background:inherit;border:1px solid #fff;-webkit-box-shadow:#000 0 0 2px;box-shadow:#000 0 0 2px;z-index:10}.trumbowyg-dropdown-backColor.trumbowyg-dropdown--color-list button:not(.trumbowyg-backColorRemove-dropdown-button){position:relative;color:#fff!important}.trumbowyg-dropdown-backColor.trumbowyg-dropdown--color-list button:not(.trumbowyg-backColorRemove-dropdown-button):focus::after,.trumbowyg-dropdown-backColor.trumbowyg-dropdown--color-list button:not(.trumbowyg-backColorRemove-dropdown-button):hover::after{content:" ";display:block;position:absolute;top:13px;left:0;width:0;height:0;border:5px solid transparent;border-left-color:#fff} \ No newline at end of file diff --git a/dist/plugins/emoji/ui/sass/trumbowyg.emoji.scss b/dist/plugins/emoji/ui/sass/trumbowyg.emoji.scss index 16b8a313..795c9a67 100644 --- a/dist/plugins/emoji/ui/sass/trumbowyg.emoji.scss +++ b/dist/plugins/emoji/ui/sass/trumbowyg.emoji.scss @@ -1,6 +1,6 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - * Default stylesheet for Trumbowyg editor plugin + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor + * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ * @license MIT diff --git a/dist/plugins/emoji/ui/trumbowyg.emoji.css b/dist/plugins/emoji/ui/trumbowyg.emoji.css index 89c93015..6997d6c5 100644 --- a/dist/plugins/emoji/ui/trumbowyg.emoji.css +++ b/dist/plugins/emoji/ui/trumbowyg.emoji.css @@ -1,5 +1,5 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ diff --git a/dist/plugins/emoji/ui/trumbowyg.emoji.min.css b/dist/plugins/emoji/ui/trumbowyg.emoji.min.css index c5725ad7..93f355b4 100644 --- a/dist/plugins/emoji/ui/trumbowyg.emoji.min.css +++ b/dist/plugins/emoji/ui/trumbowyg.emoji.min.css @@ -1,2 +1,2 @@ -/** Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ +/** Trumbowyg v2.30.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ .trumbowyg-dropdown-emoji{width:265px;padding:7px 0 7px 5px}.trumbowyg-dropdown-emoji svg{display:none!important}.trumbowyg-dropdown-emoji button{display:block;position:relative;float:left;height:26px;width:26px;padding:0;margin:2px;line-height:24px;text-align:center}.trumbowyg-dropdown-emoji button:focus::after,.trumbowyg-dropdown-emoji button:hover::after{display:block;position:absolute;top:-5px;left:-5px;height:27px;width:27px;background:inherit;-webkit-box-shadow:#000 0 0 2px;box-shadow:#000 0 0 2px;z-index:10;background-color:transparent}.trumbowyg .emoji{width:22px;height:22px;display:inline-block} \ No newline at end of file diff --git a/dist/plugins/fontfamily/trumbowyg.fontfamily.js b/dist/plugins/fontfamily/trumbowyg.fontfamily.js index fd4eb983..2201b08f 100644 --- a/dist/plugins/fontfamily/trumbowyg.fontfamily.js +++ b/dist/plugins/fontfamily/trumbowyg.fontfamily.js @@ -41,7 +41,7 @@ fontFamily: 'Lettertype' }, pt_br: { - fontFamily: 'Fonte', + fontFamily: 'Fonte' }, ru: { fontFamily: 'Шрифт' @@ -53,8 +53,8 @@ fontFamily: 'Yazı tipi' }, zh_tw: { - fontFamily: '字體', - }, + fontFamily: '字體' + } } }); // jshint camelcase:true @@ -83,8 +83,8 @@ fontfamily: { init: function (trumbowyg) { trumbowyg.o.plugins.fontfamily = $.extend({}, - defaultOptions, - trumbowyg.o.plugins.fontfamily || {} + defaultOptions, + trumbowyg.o.plugins.fontfamily || {} ); trumbowyg.addBtnDef('fontfamily', { diff --git a/dist/plugins/fontsize/trumbowyg.fontsize.js b/dist/plugins/fontsize/trumbowyg.fontsize.js index ea260b91..a2cabf91 100644 --- a/dist/plugins/fontsize/trumbowyg.fontsize.js +++ b/dist/plugins/fontsize/trumbowyg.fontsize.js @@ -279,14 +279,14 @@ 'medium': '中', 'large': '大', 'x-large': '最大', - 'custom': '自訂大小', + 'custom': '自訂大小' }, fontCustomSize: { title: '自訂義字體大小', label: '字體大小', value: '48px' } - }, + } } }); // jshint camelcase:true @@ -308,8 +308,8 @@ fontsize: { init: function (trumbowyg) { trumbowyg.o.plugins.fontsize = $.extend({}, - defaultOptions, - trumbowyg.o.plugins.fontsize || {} + defaultOptions, + trumbowyg.o.plugins.fontsize || {} ); trumbowyg.addBtnDef('fontsize', { @@ -335,10 +335,10 @@ fontElements.find('span[style*="font-size"]').contents().unwrap(); // Find elements that were added and change to with chosen size - fontElements.replaceWith(function() { + fontElements.replaceWith(function () { return $('', { - css: { 'font-size': size }, - html: this.innerHTML, + css: {'font-size': size}, + html: this.innerHTML }); }); diff --git a/dist/plugins/giphy/trumbowyg.giphy.js b/dist/plugins/giphy/trumbowyg.giphy.js index e181595a..3071d90b 100644 --- a/dist/plugins/giphy/trumbowyg.giphy.js +++ b/dist/plugins/giphy/trumbowyg.giphy.js @@ -72,20 +72,18 @@ 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; + var image = gifData.images[GIPHY_OPTIONS.pickerRendition]; + return !!image[GIPHY_OPTIONS.pickerRenditionUrlAttribute]; }) .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, + var image = gifData.images[GIPHY_OPTIONS.pickerRendition]; + var selectionImage = gifData.images[GIPHY_OPTIONS.selectionRendition]; + var imageRatio = image.height / image.width, altText = gifData.title; - var imgHtml = '' + altText + ''; + var url = image[GIPHY_OPTIONS.pickerRenditionUrlAttribute]; + var selectionUrl = selectionImage[GIPHY_OPTIONS.selectionRenditionUrlAttribute]; + var imgHtml = '' + altText + ''; return '
' + imgHtml + '
'; }) .join('') @@ -122,7 +120,7 @@ }); $('img', $giphyModal).on('click', function () { - var src = $(this).attr('src'), + var src = $(this).data('selection-url'), alt = $(this).attr('alt'); trumbowyg.restoreRange(); trumbowyg.execCmd('insertImage', src, false, true); @@ -139,13 +137,23 @@ }); } + // see: https://developers.giphy.com/explorer/ var defaultOptions = { rating: 'g', apiKey: null, throttleDelay: 300, + limit: 50, noResultGifUrl: 'https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif' }; + const GIPHY_OPTIONS = { + bundle: 'low_bandwidth', + pickerRendition: 'fixed_width_small', // see: https://developers.giphy.com/docs/optional-settings/#renditions-on-demand + pickerRenditionUrlAttribute: 'webp', // can be 'url' or 'mp4' or 'webp' + selectionRendition: 'original', + selectionRenditionUrlAttribute: 'url' + }; + // Add dropdown with font sizes $.extend(true, $.trumbowyg, { plugins: { @@ -162,8 +170,17 @@ 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 BASE_URL = [ + 'https://api.giphy.com/v1/gifs/search?api_key=', + trumbowyg.o.plugins.giphy.apiKey, + '&rating=', + trumbowyg.o.plugins.giphy.rating, + '&limit=', + trumbowyg.o.plugins.giphy.limit, + '&bundle=', + GIPHY_OPTIONS.bundle, + ].join(''); + const DEFAULT_URL = BASE_URL.replace('/search', '/trending'); var prefix = trumbowyg.o.prefix; var abortController = new AbortController(); diff --git a/dist/plugins/giphy/trumbowyg.giphy.min.js b/dist/plugins/giphy/trumbowyg.giphy.min.js index b72bb4bc..6abdeebe 100644 --- a/dist/plugins/giphy/trumbowyg.giphy.min.js +++ b/dist/plugins/giphy/trumbowyg.giphy.min.js @@ -1 +1 @@ -!function(i){"use strict";i.extend(!0,i.trumbowyg,{langs:{en:{giphy:"Insert GIF"},az:{giphy:"GIF yerləşdir"},by:{giphy:"Уставіць GIF"},de:{giphy:"GIF einfügen"},et:{giphy:"Sisesta GIF"},fr:{giphy:"Insérer un GIF"},hu:{giphy:"GIF beszúrás"},ru:{giphy:"Вставить GIF"},sl:{giphy:"Vstavi GIF"},tr:{giphy:"GIF ekle"}}});var e="tbwcancel";function t(e,t,n,l){var o=(t.width()-20)/3,a=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===a.length){if(i("."+n.o.prefix+"giphy-no-result",t).length>0)return;a=''}t.empty()}t.append(a);var c=function(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(l){l.o.plugins.giphy=i.extend({},n,l.o.plugins.giphy||{}),l.addBtnDef("giphy",{fn:function(){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,o=n.replace("/search","/trending"),a=l.o.prefix,c=new AbortController,r=''+('')+('
Powered by
')+'
';l.openModal(null,r,!1).one(e,(function(){try{c.abort(),c=new AbortController}catch(i){}l.closeModal()}));var s=i("."+a+"giphy-search"),g=i("."+a+"giphy-close"),h=i("."+a+"giphy-modal"),p=function(){navigator.onLine||i("."+a+"giphy-offline",h).length||(h.empty(),h.append('

You are offline

'))};fetch(o,{method:"GET",cache:"no-cache",signal:c.signal}).then((i=>{i.json().then((i=>{t(i,h,l,!0)}))})).catch((()=>{p()}));var u,d,y,f,m=(u=function(){var i=s.val();if(0!==i.length){try{c.abort(),c=new AbortController}catch(i){}fetch(n+"&q="+encodeURIComponent(i),{method:"GET",cache:"no-cache",signal:c.signal}).then((i=>{i.json().then((i=>{t(i,h,l,!0)}))})).catch((()=>{p()}))}},d=l.o.plugins.giphy.throttleDelay,function(){var i=this,e=(new Date).getTime(),t=arguments;y&&e'+("'+o+'')+""})).join("");if(!0===o){if(0===a.length){if(i("."+n.o.prefix+"giphy-no-result",t).length>0)return;a=''}t.empty()}t.append(a);var r=function(i){i.classList.add("tbw-loaded")};i("img",t).each((function(){var i=this;i.complete?r(i):i.addEventListener("load",(function(){r(this)}))})),i("img",t).on("click",(function(){var e=i(this).data("selection-url"),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,limit:50,noResultGifUrl:"https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif"};const l={bundle:"low_bandwidth",pickerRendition:"fixed_width_small",pickerRenditionUrlAttribute:"webp",selectionRendition:"original",selectionRenditionUrlAttribute:"url"};i.extend(!0,i.trumbowyg,{plugins:{giphy:{init:function(o){o.o.plugins.giphy=i.extend({},n,o.o.plugins.giphy||{}),o.addBtnDef("giphy",{fn:function(){if(null===o.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=",o.o.plugins.giphy.apiKey,"&rating=",o.o.plugins.giphy.rating,"&limit=",o.o.plugins.giphy.limit,"&bundle=",l.bundle].join("");const c=n.replace("/search","/trending");var a=o.o.prefix,r=new AbortController,s=''+('')+('
Powered by
')+'
';o.openModal(null,s,!1).one(e,(function(){try{r.abort(),r=new AbortController}catch(i){}o.closeModal()}));var g=i("."+a+"giphy-search"),h=i("."+a+"giphy-close"),p=i("."+a+"giphy-modal"),u=function(){navigator.onLine||i("."+a+"giphy-offline",p).length||(p.empty(),p.append('

You are offline

'))};fetch(c,{method:"GET",cache:"no-cache",signal:r.signal}).then((i=>{i.json().then((i=>{t(i,p,o,!0)}))})).catch((()=>{u()}));var d,y,f,m,v=(d=function(){var i=g.val();if(0!==i.length){try{r.abort(),r=new AbortController}catch(i){}fetch(n+"&q="+encodeURIComponent(i),{method:"GET",cache:"no-cache",signal:r.signal}).then((i=>{i.json().then((i=>{t(i,p,o,!0)}))})).catch((()=>{u()}))}},y=o.o.plugins.giphy.throttleDelay,function(){var i=this,e=(new Date).getTime(),t=arguments;f&&e', '' + Prism.highlight(text, Prism.languages[language]) + '', - '', + '' ].join(''); } @@ -198,16 +198,16 @@ var prismLanguageKeys = Object.keys(Prism.languages); var options = prismLanguageKeys.filter(function (languageKey) { - return languageNameKeys.indexOf(languageKey) >= 0; + return languageNameKeys.indexOf(languageKey) >= 0; }).map(function (languageKey) { return { id: languageKey, name: languageNames[languageKey] }; - }).sort(function(a, b){ + }).sort(function (a, b) { // Sort languages by name return a.name.localeCompare(b.name); - }).map(function( language){ + }).map(function (language) { // Generate a list of options return ''; }).join(''); @@ -305,7 +305,7 @@ tr: { highlight: 'Kod sözdizimini vurgula', highlightLine: 'Vurgu çizgileri, örneğin: 1,3-5' - }, + } // jshint camelcase:true }, // Add our plugin to Trumbowyg registered plugins diff --git a/dist/plugins/highlight/ui/sass/trumbowyg.highlight.scss b/dist/plugins/highlight/ui/sass/trumbowyg.highlight.scss index b650ad8c..1de9ce04 100644 --- a/dist/plugins/highlight/ui/sass/trumbowyg.highlight.scss +++ b/dist/plugins/highlight/ui/sass/trumbowyg.highlight.scss @@ -1,6 +1,6 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - * Default stylesheet for Trumbowyg editor plugin + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor + * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ * @license MIT @@ -10,16 +10,16 @@ */ .trumbowyg-highlight-form-group { - margin: 15px 10px; + margin: 15px 10px; - .trumbowyg-highlight-form-control { - width: 100%; - border: 1px solid #DEDEDE; - font-size: 14px; - padding: 7px; + .trumbowyg-highlight-form-control { + width: 100%; + border: 1px solid #DEDEDE; + font-size: 14px; + padding: 7px; - &.code { - height: 200px; + &.code { + height: 200px; + } } - } } diff --git a/dist/plugins/highlight/ui/trumbowyg.highlight.css b/dist/plugins/highlight/ui/trumbowyg.highlight.css index 5d2aeacb..ce0fcaff 100644 --- a/dist/plugins/highlight/ui/trumbowyg.highlight.css +++ b/dist/plugins/highlight/ui/trumbowyg.highlight.css @@ -1,5 +1,5 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ diff --git a/dist/plugins/highlight/ui/trumbowyg.highlight.min.css b/dist/plugins/highlight/ui/trumbowyg.highlight.min.css index 5c9e7b4e..aac6c718 100644 --- a/dist/plugins/highlight/ui/trumbowyg.highlight.min.css +++ b/dist/plugins/highlight/ui/trumbowyg.highlight.min.css @@ -1,2 +1,2 @@ -/** Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ +/** Trumbowyg v2.30.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ .trumbowyg-highlight-form-group{margin:15px 10px}.trumbowyg-highlight-form-group .trumbowyg-highlight-form-control{width:100%;border:1px solid #dedede;font-size:14px;padding:7px}.trumbowyg-highlight-form-group .trumbowyg-highlight-form-control.code{height:200px} \ No newline at end of file diff --git a/dist/plugins/indent/trumbowyg.indent.js b/dist/plugins/indent/trumbowyg.indent.js index e398443e..c98aaa45 100644 --- a/dist/plugins/indent/trumbowyg.indent.js +++ b/dist/plugins/indent/trumbowyg.indent.js @@ -1,4 +1,3 @@ - /* =========================================================== * trumbowyg.indent.js v1.0 * Indent or Outdent plugin for Trumbowyg @@ -8,7 +7,7 @@ * Website : https://github.com/Fabacks */ - (function ($) { +(function ($) { 'use strict'; $.extend(true, $.trumbowyg, { @@ -53,7 +52,7 @@ tr: { indent: 'Girinti', outdent: 'Çıkıntı' - }, + } // jshint camelcase:true } }); diff --git a/dist/plugins/lineheight/trumbowyg.lineheight.js b/dist/plugins/lineheight/trumbowyg.lineheight.js index fa116bc3..a648079f 100644 --- a/dist/plugins/lineheight/trumbowyg.lineheight.js +++ b/dist/plugins/lineheight/trumbowyg.lineheight.js @@ -147,7 +147,7 @@ '1.5': '大', '2.0': '特大' } - }, + } } }); // jshint camelcase:true @@ -167,8 +167,8 @@ lineheight: { init: function (trumbowyg) { trumbowyg.o.plugins.lineheight = $.extend({}, - defaultOptions, - trumbowyg.o.plugins.lineheight || {} + defaultOptions, + trumbowyg.o.plugins.lineheight || {} ); trumbowyg.addBtnDef('lineheight', { @@ -183,11 +183,11 @@ function buildDropdown(trumbowyg) { var dropdown = []; - $.each(trumbowyg.o.plugins.lineheight.sizeList, function(index, size) { + $.each(trumbowyg.o.plugins.lineheight.sizeList, function (index, size) { trumbowyg.addBtnDef('lineheight_' + size, { text: trumbowyg.lang.lineheights[size] || size, hasIcon: false, - fn: function(){ + fn: function () { trumbowyg.saveRange(); var text = trumbowyg.getRangeText(); if (text.replace(/\s/g, '') !== '') { diff --git a/dist/plugins/mathml/ui/sass/trumbowyg.mathml.scss b/dist/plugins/mathml/ui/sass/trumbowyg.mathml.scss index c172c9ba..1a3cc81b 100644 --- a/dist/plugins/mathml/ui/sass/trumbowyg.mathml.scss +++ b/dist/plugins/mathml/ui/sass/trumbowyg.mathml.scss @@ -1,6 +1,6 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - * Default stylesheet for Trumbowyg editor plugin + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor + * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ * @license MIT @@ -10,32 +10,32 @@ */ [formulas] { - position: relative; - display: inline-block; - pointer-events: none; + position: relative; + display: inline-block; + pointer-events: none; - &[inline="false"] { - display: block; - width: 100%; - } + &[inline="false"] { + display: block; + width: 100%; + } - &::after { - content: '\270E'; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - opacity: 0; - background-color: rgba(255, 255, 255, 0.83); - box-shadow: 0 0 5px 5px rgba(255, 255, 255, 0.83); - cursor: pointer; - pointer-events: auto; - } + &::after { + content: '\270E'; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + opacity: 0; + background-color: rgba(255, 255, 255, 0.83); + box-shadow: 0 0 5px 5px rgba(255, 255, 255, 0.83); + cursor: pointer; + pointer-events: auto; + } - &:hover { - &::after { - opacity: 1; - } - } + &:hover { + &::after { + opacity: 1; + } + } } diff --git a/dist/plugins/mathml/ui/trumbowyg.mathml.css b/dist/plugins/mathml/ui/trumbowyg.mathml.css index 2aa42e15..151ba933 100644 --- a/dist/plugins/mathml/ui/trumbowyg.mathml.css +++ b/dist/plugins/mathml/ui/trumbowyg.mathml.css @@ -1,5 +1,5 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ diff --git a/dist/plugins/mathml/ui/trumbowyg.mathml.min.css b/dist/plugins/mathml/ui/trumbowyg.mathml.min.css index cff646aa..cf817f1e 100644 --- a/dist/plugins/mathml/ui/trumbowyg.mathml.min.css +++ b/dist/plugins/mathml/ui/trumbowyg.mathml.min.css @@ -1,2 +1,2 @@ -/** Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ +/** Trumbowyg v2.30.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ @charset "UTF-8";[formulas]{position:relative;display:inline-block;pointer-events:none}[formulas][inline=false]{display:block;width:100%}[formulas]::after{content:"✎";position:absolute;top:0;right:0;bottom:0;left:0;opacity:0;background-color:rgba(255,255,255,.83);-webkit-box-shadow:0 0 5px 5px rgba(255,255,255,.83);box-shadow:0 0 5px 5px rgba(255,255,255,.83);cursor:pointer;pointer-events:auto}[formulas]:hover::after{opacity:1} \ No newline at end of file diff --git a/dist/plugins/mention/ui/sass/trumbowyg.mention.scss b/dist/plugins/mention/ui/sass/trumbowyg.mention.scss index 586f9114..77c557df 100644 --- a/dist/plugins/mention/ui/sass/trumbowyg.mention.scss +++ b/dist/plugins/mention/ui/sass/trumbowyg.mention.scss @@ -1,6 +1,6 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - * Default stylesheet for Trumbowyg editor plugin + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor + * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ * @license MIT diff --git a/dist/plugins/mention/ui/trumbowyg.mention.css b/dist/plugins/mention/ui/trumbowyg.mention.css index bea60c40..cc01b673 100644 --- a/dist/plugins/mention/ui/trumbowyg.mention.css +++ b/dist/plugins/mention/ui/trumbowyg.mention.css @@ -1,5 +1,5 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ @@ -20,11 +20,8 @@ right: 0; width: 15%; height: 100%; - -webkit-background-size: 100% 100%; - background-size: 100%; + background-size: 100%; background-image: -webkit-gradient(linear, left top, right top, from(rgba(255, 255, 255, 0)), color-stop(80%, #ffffff), to(#ffffff)); - background-image: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, #ffffff 80%, #ffffff 100%); - background-image: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, #ffffff 80%, #ffffff 100%); background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, #ffffff 80%, #ffffff 100%); pointer-events: none; } \ No newline at end of file diff --git a/dist/plugins/mention/ui/trumbowyg.mention.min.css b/dist/plugins/mention/ui/trumbowyg.mention.min.css index 5bbd1259..ec952e8b 100644 --- a/dist/plugins/mention/ui/trumbowyg.mention.min.css +++ b/dist/plugins/mention/ui/trumbowyg.mention.min.css @@ -1,2 +1,2 @@ -/** Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ -.trumbowyg-dropdown-mention button{position:relative;white-space:nowrap}.trumbowyg-dropdown-mention button:after{content:"";position:absolute;top:0;right:0;width:15%;height:100%;-webkit-background-size:100% 100%;background-size:100%;background-image:-webkit-gradient(linear,left top,right top,from(rgba(255,255,255,0)),color-stop(80%,#fff),to(#fff));background-image:-webkit-linear-gradient(left,rgba(255,255,255,0) 0,#fff 80%,#fff 100%);background-image:-o-linear-gradient(left,rgba(255,255,255,0) 0,#fff 80%,#fff 100%);background-image:linear-gradient(to right,rgba(255,255,255,0) 0,#fff 80%,#fff 100%);pointer-events:none} \ No newline at end of file +/** Trumbowyg v2.30.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ +.trumbowyg-dropdown-mention button{position:relative;white-space:nowrap}.trumbowyg-dropdown-mention button:after{content:"";position:absolute;top:0;right:0;width:15%;height:100%;background-size:100%;background-image:-webkit-gradient(linear,left top,right top,from(rgba(255,255,255,0)),color-stop(80%,#fff),to(#fff));background-image:linear-gradient(to right,rgba(255,255,255,0) 0,#fff 80%,#fff 100%);pointer-events:none} \ No newline at end of file diff --git a/dist/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss b/dist/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss index 5585b62d..aceb41a7 100644 --- a/dist/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss +++ b/dist/plugins/specialchars/ui/sass/trumbowyg.specialchars.scss @@ -1,6 +1,6 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - * Default stylesheet for Trumbowyg editor plugin + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor + * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ * @license MIT diff --git a/dist/plugins/specialchars/ui/trumbowyg.specialchars.css b/dist/plugins/specialchars/ui/trumbowyg.specialchars.css index 1df465f7..c2afbb49 100644 --- a/dist/plugins/specialchars/ui/trumbowyg.specialchars.css +++ b/dist/plugins/specialchars/ui/trumbowyg.specialchars.css @@ -1,5 +1,5 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ diff --git a/dist/plugins/specialchars/ui/trumbowyg.specialchars.min.css b/dist/plugins/specialchars/ui/trumbowyg.specialchars.min.css index 41f9b046..4a37de86 100644 --- a/dist/plugins/specialchars/ui/trumbowyg.specialchars.min.css +++ b/dist/plugins/specialchars/ui/trumbowyg.specialchars.min.css @@ -1,2 +1,2 @@ -/** Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ +/** Trumbowyg v2.30.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ .trumbowyg-symbol-\ -dropdown-button{display:none!important}.trumbowyg-symbol-\ -dropdown-button+button{clear:both}.trumbowyg-dropdown-specialChars{width:248px;padding:5px 3px 3px}.trumbowyg-dropdown-specialChars button{display:block;position:relative;float:left;height:26px;width:26px;padding:0;margin:2px;line-height:24px;text-align:center}.trumbowyg-dropdown-specialChars button:focus::after,.trumbowyg-dropdown-specialChars button:hover::after{display:block;position:absolute;top:-5px;left:-5px;height:27px;width:27px;background:inherit;-webkit-box-shadow:#000 0 0 2px;box-shadow:#000 0 0 2px;z-index:10;background-color:transparent}.trumbowyg .specialChars{width:22px;height:22px;display:inline-block} \ No newline at end of file diff --git a/dist/plugins/speechrecognition/trumbowyg.speechrecognition.js b/dist/plugins/speechrecognition/trumbowyg.speechrecognition.js new file mode 100644 index 00000000..143635b5 --- /dev/null +++ b/dist/plugins/speechrecognition/trumbowyg.speechrecognition.js @@ -0,0 +1,198 @@ +/* =========================================================== + * trumbowyg.speechrecognition.js v1.0 + * Speech recognition plugin for Trumbowyg + * http://alex-d.github.com/Trumbowyg + * =========================================================== + * Authors : + * - Tobias Rohde + * - Alexandre Demode (Alex-D) + * Website : tobiasrohde.de + */ +(function ($) { + 'use strict'; + + const defaultOptions = { + lang: 'en-US' + }; + + const SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition; + + function buildButtonDef(trumbowyg) { + let btnElement = null; + let isRecognizing = false; + let $resultTextParagraph = null; + + const recognition = new SpeechRecognition(); + + recognition.continuous = true; + recognition.interimResults = true; + recognition.maxAlternatives = 1; // We only read the first + + recognition.onstart = function () { + isRecognizing = true; + btnElement.style.color = '#e71d36'; + }; + + recognition.onerror = function () { + isRecognizing = false; + btnElement.style.removeProperty('color'); + }; + + recognition.onend = function () { + isRecognizing = false; + btnElement.style.removeProperty('color'); + }; + + recognition.onresult = function (event) { + const resultText = [...event.results].map((result) => { + return result[0].transcript + (result.isFinal ? '
' : ''); + }).join(''); + $resultTextParagraph.html(resultText); + trumbowyg.range.setEndAfter($resultTextParagraph[0]); + trumbowyg.range.collapse(); + trumbowyg.syncCode(); + }; + + return { + isSupported, + fn: function () { + if (isRecognizing) { + recognition.stop(); + return; + } + + // Get the actual button to allow to switch his color + btnElement = trumbowyg.$btnPane.find('.' + trumbowyg.o.prefix + 'speechrecognition-button svg')[0]; + + // Create a container if needed in which we will put the recognized text + trumbowyg.$ed.focus(); + setTimeout(() => { + trumbowyg.saveRange(); + if ( + trumbowyg.range.startContainer === trumbowyg.range.endContainer && + trumbowyg.range.startContainer.nodeName === 'P' && + trumbowyg.range.startContainer.innerText.trim() === '' + ) { + $resultTextParagraph = $(trumbowyg.range.startContainer); + } else { + $resultTextParagraph = $('

'); + trumbowyg.range.deleteContents(); + trumbowyg.range.insertNode($resultTextParagraph[0]); + } + + // Set up the recognition + recognition.lang = trumbowyg.o.plugins.speechRecognition.lang; + recognition.start(); + }); + } + }; + } + + function isSupported() { + return SpeechRecognition !== undefined; + } + + + $.extend(true, $.trumbowyg, { + langs: { + az: { + speechRecognition: 'Nitqin tanınması' + }, + bg: { + speechRecognition: 'Разпознаване на реч' + }, + by: { + speechRecognition: 'Распазнаванне маўлення' + }, + ca: { + speechRecognition: 'Reconeixement de veu' + }, + cs: { + speechRecognition: 'Rozpoznávání řeči' + }, + da: { + speechRecognition: 'Talegenkendelse' + }, + de: { + speechRecognition: 'Spracherkennung' + }, + el: { + speechRecognition: 'Αναγνώριση ομιλίας' + }, + en: { + speechRecognition: 'Speech recognition' + }, + es: { + speechRecognition: 'Reconocimiento de voz' + }, + et: { + speechRecognition: 'Kõnetuvastus' + }, + fi: { + speechRecognition: 'Puheentunnistus' + }, + fr: { + speechRecognition: 'Reconnaissance vocale' + }, + hr: { + speechRecognition: 'Prepoznavanje govora' + }, + hu: { + speechRecognition: 'Beszédfelismerés' + }, + it: { + speechRecognition: 'Riconoscimento vocale' + }, + lt: { + speechRecognition: 'Kalbos atpažinimas' + }, + nb: { + speechRecognition: 'Talegjenkjenning' + }, + nl: { + speechRecognition: 'Spraakherkenning' + }, + pl: { + speechRecognition: 'Rozpoznawanie mowy' + }, + pt: { + speechRecognition: 'Reconhecimento de voz' + }, + ro: { + speechRecognition: 'Recunoașterea vorbirii' + }, + rs: { + speechRecognition: 'Препознавање говора' + }, + ru: { + speechRecognition: 'Распознавание речи' + }, + sk: { + speechRecognition: 'Rozpoznávanie reči' + }, + sq: { + speechRecognition: 'Njohja e të folurit' + }, + sv: { + speechRecognition: 'Taligenkänning' + }, + ua: { + speechRecognition: 'Розпізнавання мови' + } + }, + + plugins: { + speechRecognition: { + shouldInit: isSupported, + init: function (trumbowyg) { + trumbowyg.o.plugins.speechRecognition = $.extend(true, {}, + defaultOptions, + trumbowyg.o.plugins.speechRecognition || {} + ); + + trumbowyg.addBtnDef('speechrecognition', buildButtonDef(trumbowyg)); + } + } + } + }); +})(jQuery); diff --git a/dist/plugins/speechrecognition/trumbowyg.speechrecognition.min.js b/dist/plugins/speechrecognition/trumbowyg.speechrecognition.min.js new file mode 100644 index 00000000..1e639a1c --- /dev/null +++ b/dist/plugins/speechrecognition/trumbowyg.speechrecognition.min.js @@ -0,0 +1,11 @@ +/* =========================================================== + * trumbowyg.speechrecognition.js v1.0 + * Speech recognition plugin for Trumbowyg + * http://alex-d.github.com/Trumbowyg + * =========================================================== + * Authors : + * - Tobias Rohde + * - Alexandre Demode (Alex-D) + * Website : tobiasrohde.de + */ +!function(e){"use strict";const n={lang:"en-US"},o=window.webkitSpeechRecognition||window.SpeechRecognition;function i(){return void 0!==o}e.extend(!0,e.trumbowyg,{langs:{az:{speechRecognition:"Nitqin tanınması"},bg:{speechRecognition:"Разпознаване на реч"},by:{speechRecognition:"Распазнаванне маўлення"},ca:{speechRecognition:"Reconeixement de veu"},cs:{speechRecognition:"Rozpoznávání řeči"},da:{speechRecognition:"Talegenkendelse"},de:{speechRecognition:"Spracherkennung"},el:{speechRecognition:"Αναγνώριση ομιλίας"},en:{speechRecognition:"Speech recognition"},es:{speechRecognition:"Reconocimiento de voz"},et:{speechRecognition:"Kõnetuvastus"},fi:{speechRecognition:"Puheentunnistus"},fr:{speechRecognition:"Reconnaissance vocale"},hr:{speechRecognition:"Prepoznavanje govora"},hu:{speechRecognition:"Beszédfelismerés"},it:{speechRecognition:"Riconoscimento vocale"},lt:{speechRecognition:"Kalbos atpažinimas"},nb:{speechRecognition:"Talegjenkjenning"},nl:{speechRecognition:"Spraakherkenning"},pl:{speechRecognition:"Rozpoznawanie mowy"},pt:{speechRecognition:"Reconhecimento de voz"},ro:{speechRecognition:"Recunoașterea vorbirii"},rs:{speechRecognition:"Препознавање говора"},ru:{speechRecognition:"Распознавание речи"},sk:{speechRecognition:"Rozpoznávanie reči"},sq:{speechRecognition:"Njohja e të folurit"},sv:{speechRecognition:"Taligenkänning"},ua:{speechRecognition:"Розпізнавання мови"}},plugins:{speechRecognition:{shouldInit:i,init:function(t){t.o.plugins.speechRecognition=e.extend(!0,{},n,t.o.plugins.speechRecognition||{}),t.addBtnDef("speechrecognition",function(n){let t=null,c=!1,s=null;const r=new o;return r.continuous=!0,r.interimResults=!0,r.maxAlternatives=1,r.onstart=function(){c=!0,t.style.color="#e71d36"},r.onerror=function(){c=!1,t.style.removeProperty("color")},r.onend=function(){c=!1,t.style.removeProperty("color")},r.onresult=function(e){const o=[...e.results].map((e=>e[0].transcript+(e.isFinal?"
":""))).join("");s.html(o),n.range.setEndAfter(s[0]),n.range.collapse(),n.syncCode()},{isSupported:i,fn:function(){c?r.stop():(t=n.$btnPane.find("."+n.o.prefix+"speechrecognition-button svg")[0],n.$ed.focus(),setTimeout((()=>{n.saveRange(),n.range.startContainer===n.range.endContainer&&"P"===n.range.startContainer.nodeName&&""===n.range.startContainer.innerText.trim()?s=e(n.range.startContainer):(s=e("

"),n.range.deleteContents(),n.range.insertNode(s[0])),r.lang=n.o.plugins.speechRecognition.lang,r.start()})))}}}(t))}}}})}(jQuery); \ No newline at end of file diff --git a/dist/plugins/table/trumbowyg.table.js b/dist/plugins/table/trumbowyg.table.js index 79c563b4..d96fc4c8 100644 --- a/dist/plugins/table/trumbowyg.table.js +++ b/dist/plugins/table/trumbowyg.table.js @@ -78,7 +78,7 @@ 'tableVerticalAlignTop', 'tableVerticalAlignMiddle', 'tableVerticalAlignBottom', - ], + ], }, { title: 'tableOthers', @@ -385,7 +385,7 @@ // when active table show AddRow / AddColumn if (t.$box.find('.' + t.o.prefix + 'table-button').hasClass(t.o.prefix + 'active-button')) { - var $table = $(t.doc.getSelection().anchorNode).closest('table'); + var $table = $(t.doc.getSelection().anchorNode).closest('table', t.$ed[0]); var tableState = getTableState($table); var hasSelectedCells = tableSelectedCells !== undefined; $(t.o.plugins.table.dropdown).each(function (_, buttonGroup) { @@ -451,7 +451,7 @@ var toggleActiveDropdownCells = function (columnEvent) { var column = $(columnEvent.target), - table = column.closest('table'), + table = column.closest('table', t.$ed[0]), colIndex = this.cellIndex, rowIndex = this.parentNode.rowIndex; @@ -600,7 +600,7 @@ t.saveRange(); var node = t.doc.getSelection().anchorNode; - var $table = $(node).closest('table'); + var $table = $(node).closest('table', t.$ed[0]); if ($table.length === 0) { return; @@ -609,7 +609,7 @@ if (node.tagName === 'TR') { node = $('td, th', node)[0]; } - var $focusedRow = $(node).closest('tr'); + var $focusedRow = $(node).closest('tr', t.$ed[0]); var tableState = getTableState($table); @@ -633,7 +633,7 @@ focusedRowIndex = Math.max(0, focusedRowIndex - 1); $focusedRow = $($rows[focusedRowIndex]); } else { - var rawCellRowspan = $(node).closest('td, th').attr('rowspan'); + var rawCellRowspan = $(node).closest('td, th', t.$ed[0]).attr('rowspan'); var cellRowspan = parseInt(rawCellRowspan ? rawCellRowspan : 1, 10); focusedRowIndex += cellRowspan - 1; $focusedRow = $($rows[focusedRowIndex]); @@ -1580,7 +1580,7 @@ }; var applyBackgroundColorToSelectedCells = function (color) { return function () { - var $table = $(t.doc.getSelection().anchorNode).closest('table'); + var $table = $(t.doc.getSelection().anchorNode).closest('table', t.$ed[0]); if ($table.length === 0) { return; @@ -1612,7 +1612,7 @@ var applyBorderColor = function (color) { return function () { - var $table = $(t.doc.getSelection().anchorNode).closest('table'); + var $table = $(t.doc.getSelection().anchorNode).closest('table', t.$ed[0]); if ($table.length === 0) { return; diff --git a/dist/plugins/table/trumbowyg.table.min.js b/dist/plugins/table/trumbowyg.table.min.js index 71e2abd5..229e1cc8 100644 --- a/dist/plugins/table/trumbowyg.table.min.js +++ b/dist/plugins/table/trumbowyg.table.min.js @@ -8,4 +8,4 @@ * Website : alex-d.fr * Original Author : Sven Dunemann [dunemann@forelabs.eu] */ -!function(e){"use strict";function t(e,t){var l,a;return function(){var o=this,n=(new Date).getTime(),r=arguments;if(l&&n",a);if(0===o.$box.find("."+l+"-"+t).length?o.$box.append(r.hide()):r=o.$box.find("."+l+"-"+t),r.html(""),o.$box.find("."+o.o.prefix+"table-button").hasClass(o.o.prefix+"active-button")){var i=e(o.doc.getSelection().anchorNode).closest("table"),s=c(i),u=void 0!==n;e(o.o.plugins.table.dropdown).each((function(t,l){r.append(e("

",{html:o.lang[l.title]?o.lang[l.title]:l.title,class:o.o.prefix+"table-dropdown-title"})).text();var a=e("
",{class:o.o.prefix+"dropdown-button-group"});e(l.buttons).each((function(t,l){if("tableAddHeaderRow"===l&&0!==e("thead",i).length)return;if("tableMergeCells"!==l||u){if("tableUnmergeCells"===l){var n=!1;if(z((function(e){var t=e.is("[colspan]")||e.is("[rowspan]");n=n||t}),s),!n)return}a.append(o.buildSubBtn(l))}})),r.append(a)}))}else{var f=e("");e("").appendTo(f);for(var g=0;g").appendTo(f),p=0;p").appendTo(m);f.find("td").on("mouseover",d),f.find("td").on("mousedown",b),r.append(f),r.append(e('
1x1
'))}o.dropdown(t)},class:o.o.prefix+"open-dropdown"},d=function(t){var l=e(t.target).closest("table"),a=this.cellIndex,o=this.parentNode.rowIndex;l.find("td").removeClass("active");for(var n=0;n<=o;n+=1)for(var r=0;r<=a;r+=1)l.find("tr:nth-of-type("+(n+1)+")").find("td:nth-of-type("+(r+1)+")").addClass("active");l.next(".trumbowyg-table-size").html(a+1+"x"+(o+1))},i=function(t){var l=o.o.tagClasses[t.tagName.toLowerCase()];l&&e(t).addClass(l)},s=function(t){i(t[0]),e("*",t).each((function(e,t){i(t)}))},b=function(){o.saveRange();var t=e("
"),l=e(""),a=e("");a.appendTo(l);for(var n=0;n<=this.cellIndex;n+=1)e(""),d=this.cellIndex,i=this.parentNode.rowIndex,b=0;b<=i;b+=1)for(var c=e("").appendTo(r),u=0;u<=d;u+=1)e(""),d=e("").appendTo(r),i=0;i").appendTo(d);t.prepend(r),s(t),E()}))},A=function(t=!1){return u((function(l,a,n,r){var d=r[e("tr",l).index(a)],i=e(n).closest("td, th"),b=T(i[0],d);if(t)b=Math.max(0,b-1);else{var c=i.attr("colspan");b+=parseInt(c||1,10)-1}for(var u=r.length,f=t&&0===b,g=0;g1){var s=D(o,[d,r]);s.element.setAttribute("colspan",s.colspan-1)}else i.element.remove()}x(),j()}))},D=function(e,t,l=!0){if(void 0!==t){var a=e[t[0]][t[1]];return l&&void 0!==a.mergedIn&&(a=e[a.mergedIn[0]][a.mergedIn[1]]),a}},x=function(t){var l=c(t),a=e("tr",t);e(l).each((function(t,o){o.every((function(e){return void 0!==e.mergedIn}))&&(e(l[t-1]).each((function(e,t){void 0!==t.mergedIn&&(t=D(l,t.mergedIn)),t.rowspan-=1,t.rowspan<=1?t.element.removeAttribute("rowspan"):t.element.setAttribute("rowspan",t.rowspan)})),a[t].remove())})),e('[class=""]',t).removeAttr("class"),e('[style=""]',t).removeAttr("style")},y={title:o.lang.tableMergeCells,text:o.lang.tableMergeCells,ico:"table-merge",fn:u((function(t,l,a,o){if(function(t){if(0===n.length)return!1;var l=n[0],a=D(t,l).tag;if(!n.every((function(e){return D(t,e).tag===a})))return!1;var o=[],r=[];if(e(n).each((function(e,l){for(var a=l[0],n=l[1],d=t[a][n],i=a+d.rowspan;a1&&i.attr("rowspan",f),g>1&&i.attr("colspan",g),x(t),E()}}}))},B={title:o.lang.tableUnmergeCells,text:o.lang.tableUnmergeCells,ico:"table-unmerge",fn:u((function(t,l,a,n){z((function(l){l.removeAttr("colspan").removeAttr("rowspan");for(var a=e("tr",t).index(l.closest("tr")),r=T(l[0],n[a]),d=n[a][r],i=0;i1){var d=t.getRangeAt(0),i=t.getRangeAt(l-1);a=d.startContainer.childNodes[d.startOffset],r=i.startContainer.childNodes[i.startOffset]}var s=e(a).closest("td, th"),b=e(r).closest("td, th"),u=s.closest("table"),f=b.closest("table");if(e('[class="'+L+'"]',o.$ed).removeAttr("class"),e("."+L,o.$ed).removeClass(L),0===u.length&&0===f.length||u[0]!==f[0]||s[0]===b[0])e("."+I,o.$ed).removeClass(I);else{u.addClass(I);var g=c(u),m=e("tr",u),p=s.closest("tr"),A=m.index(p),v=b.closest("tr"),h=m.index(v),C=T(s[0],g[A]),w=T(b[0],g[h]),R=Math.min(A,h),D=Math.max(A,h),x=Math.min(C,w),y=Math.max(C,w),B=[];m.each((function(t,l){tD||e("td, th",l).each((function(l,a){var o=T(a,g[t]);oy||(B.push([t,o]),e(a).addClass(L))}))})),n=B}}))}));var S,M,V,z=function(t,l){if(void 0!==n)e(n).each((function(a,o){var n=D(l,o,!1);void 0===n.mergedIn&&t(e(n.element))}));else{var a=e(o.doc.getSelection().anchorNode).closest("td, th");if(0===a.length)return;t(a)}},N="trumbowyg-table-handle-for",E=t((function(){if(o.o.plugins.table.allowHorizontalResize){var t=e("."+o.o.prefix+"table-resize-layers",o.$edBox),l=t.length>0;l||(t=e("
",{class:o.o.prefix+"table-resize-layers"}).appendTo(o.$edBox)),e("."+o.o.prefix+"table-resize-vertical-handle",t).each((function(t,l){e(l).off().remove()})),e("td, th",o.$ed).each((function(l,a){e("
",{class:o.o.prefix+"table-resize-vertical-handle"}).prop(N,a).on("mousedown.tbwTable",(function(t){t.preventDefault(),t.stopPropagation();var l=e(t.target).prop(N);S=e(l).closest("table"),M=c(S);var a=e("tr",S),o=e(l).closest("tr"),n=a.index(o),r=M[n],d=T(l,r),i=M[n][d];void 0!==i.mergedIn&&(i=M[i.mergedIn[0]][i.mergedIn[1]]),V=d+i.colspan-1,$(S,M),U(S,M),j(),S.css({maxWidth:""})})).appendTo(t)})),j(),l||(e(o.doc).on("mousemove.tbwTable",(function(t){if(void 0!==V){t.preventDefault(),t.stopPropagation();var l=S[0].getBoundingClientRect(),a=t.pageX-l.left-(H(M,V).element.getBoundingClientRect().left-l.left),o=e("col",S)[V];e(o).css({width:a}),j()}})).on("mouseup.tbwTable",(function(e){void 0!==V&&(e.preventDefault(),e.stopPropagation(),$(S,M),P(S,M),S=void 0,M=void 0,V=void 0,o.syncCode(),j())})),e(window).on("resize.tbwTable",(function(){j()})))}}),100),$=function(t,l){var a=e("colgroup",t);0===a.length&&(a=e("
").prependTo(t));for(var o=l[0].length,n=e("col",a).length;n").appendTo(a)},H=function(e,t){var l,a=0;do{l=e[a][t],a+=1}while(void 0===l.element||1!==l.colspan);return l},O=function(t,l,a=!1){var o=e("colgroup",t),n=e("col",o),r=Math.ceil(t[0].getBoundingClientRect().width);t.css({maxWidth:r});for(var d=l[0].length,i=[],s=0;s=0?l.push("tableBorderColor"+r):l.push("freeTableBorderColor")}}if(!e.style)return l;var d=e.style.verticalAlign;""!==d&&l.push("tableVerticalAlign"+a(d));var i=e.style.backgroundColor;if(("TH"===e.tagName||"TD"===e.tagName)&&""!==i){var s=n(i);t.o.plugins.table.colorList.indexOf(s)>=0?l.push("tableCellBackgroundColor"+s):l.push("freeTableCellBackgroundColor")}return l}}}})}(jQuery); \ No newline at end of file +!function(e){"use strict";function t(e,t){var l,a;return function(){var o=this,n=(new Date).getTime(),r=arguments;if(l&&n",a);if(0===o.$box.find("."+l+"-"+t).length?o.$box.append(r.hide()):r=o.$box.find("."+l+"-"+t),r.html(""),o.$box.find("."+o.o.prefix+"table-button").hasClass(o.o.prefix+"active-button")){var i=e(o.doc.getSelection().anchorNode).closest("table",o.$ed[0]),s=c(i),u=void 0!==n;e(o.o.plugins.table.dropdown).each((function(t,l){r.append(e("
",{html:o.lang[l.title]?o.lang[l.title]:l.title,class:o.o.prefix+"table-dropdown-title"})).text();var a=e("
",{class:o.o.prefix+"dropdown-button-group"});e(l.buttons).each((function(t,l){if("tableAddHeaderRow"===l&&0!==e("thead",i).length)return;if("tableMergeCells"!==l||u){if("tableUnmergeCells"===l){var n=!1;if(z((function(e){var t=e.is("[colspan]")||e.is("[rowspan]");n=n||t}),s),!n)return}a.append(o.buildSubBtn(l))}})),r.append(a)}))}else{var f=e("
",{scope:"col"}).appendTo(a);l.appendTo(t);for(var r=e("
").appendTo(c);r.appendTo(t),s(t);for(var f=o.range.endContainer;f.nodeType!==Node.ELEMENT_NODE;)f=f.parentNode;f!==o.$ed[0]&&o.range.setEndAfter(f),o.range.collapse(),o.range.insertNode(t[0]),"P"===f.nodeName&&0===f.textContent.trim().length&&f.remove(),o.syncCode(),E()},c=function(t){for(var l=e("tr",t),a=[],o=0;o0?d:1,10),b=parseInt(i>0?i:1,10);void 0!==a[t][o];)o+=1;a[t][o]={tag:n.tagName,element:n,colspan:s,rowspan:b};for(var c=1;c"),i=r.index(a);if(t)i=Math.max(0,i-1),a=e(r[i]);else{var b=e(o).closest("td, th").attr("rowspan"),c=parseInt(b||1,10);a=e(r[i+=c-1])}var u=e("tbody tr",l),f=0!==a.closest("thead").length;f&&(a=u.first());for(var g=n[i],m=n[i+1],p=n[0].length,A=0;A").appendTo(d)}0===i&&(t||f)?a.before(d):a.after(d),s(l),E()}))},g={title:o.lang.tableAddRowAbove,text:o.lang.tableAddRowAbove,ico:"row-above",fn:f(!0)},m={title:o.lang.tableAddRow,text:o.lang.tableAddRow,ico:"row-below",fn:f(!1)},p={title:o.lang.tableAddHeaderRow,text:o.lang.tableAddHeaderRow,ico:"header-row",fn:u((function(t,l,a,o){if(0!==e("thead",t).length)return!1;for(var n=o[0].length,r=e("
");e("").appendTo(f);for(var g=0;g").appendTo(f),p=0;p").appendTo(m);f.find("td").on("mouseover",d),f.find("td").on("mousedown",b),r.append(f),r.append(e('
1x1
'))}o.dropdown(t)},class:o.o.prefix+"open-dropdown"},d=function(t){var l=e(t.target).closest("table",o.$ed[0]),a=this.cellIndex,n=this.parentNode.rowIndex;l.find("td").removeClass("active");for(var r=0;r<=n;r+=1)for(var d=0;d<=a;d+=1)l.find("tr:nth-of-type("+(r+1)+")").find("td:nth-of-type("+(d+1)+")").addClass("active");l.next(".trumbowyg-table-size").html(a+1+"x"+(n+1))},i=function(t){var l=o.o.tagClasses[t.tagName.toLowerCase()];l&&e(t).addClass(l)},s=function(t){i(t[0]),e("*",t).each((function(e,t){i(t)}))},b=function(){o.saveRange();var t=e("
"),l=e(""),a=e("");a.appendTo(l);for(var n=0;n<=this.cellIndex;n+=1)e(""),d=this.cellIndex,i=this.parentNode.rowIndex,b=0;b<=i;b+=1)for(var c=e("").appendTo(r),u=0;u<=d;u+=1)e(""),d=e("").appendTo(r),i=0;i").appendTo(d);t.prepend(r),s(t),$()}))},A=function(t=!1){return u((function(l,a,n,r){var d=r[e("tr",l).index(a)],i=e(n).closest("td, th"),b=T(i[0],d);if(t)b=Math.max(0,b-1);else{var c=i.attr("colspan");b+=parseInt(c||1,10)-1}for(var u=r.length,f=t&&0===b,g=0;g1){var s=D(o,[d,r]);s.element.setAttribute("colspan",s.colspan-1)}else i.element.remove()}x(),j()}))},D=function(e,t,l=!0){if(void 0!==t){var a=e[t[0]][t[1]];return l&&void 0!==a.mergedIn&&(a=e[a.mergedIn[0]][a.mergedIn[1]]),a}},x=function(t){var l=c(t),a=e("tr",t);e(l).each((function(t,o){o.every((function(e){return void 0!==e.mergedIn}))&&(e(l[t-1]).each((function(e,t){void 0!==t.mergedIn&&(t=D(l,t.mergedIn)),t.rowspan-=1,t.rowspan<=1?t.element.removeAttribute("rowspan"):t.element.setAttribute("rowspan",t.rowspan)})),a[t].remove())})),e('[class=""]',t).removeAttr("class"),e('[style=""]',t).removeAttr("style")},y={title:o.lang.tableMergeCells,text:o.lang.tableMergeCells,ico:"table-merge",fn:u((function(t,l,a,o){if(function(t){if(0===n.length)return!1;var l=n[0],a=D(t,l).tag;if(!n.every((function(e){return D(t,e).tag===a})))return!1;var o=[],r=[];if(e(n).each((function(e,l){for(var a=l[0],n=l[1],d=t[a][n],i=a+d.rowspan;a1&&i.attr("rowspan",f),g>1&&i.attr("colspan",g),x(t),$()}}}))},B={title:o.lang.tableUnmergeCells,text:o.lang.tableUnmergeCells,ico:"table-unmerge",fn:u((function(t,l,a,n){z((function(l){l.removeAttr("colspan").removeAttr("rowspan");for(var a=e("tr",t).index(l.closest("tr")),r=T(l[0],n[a]),d=n[a][r],i=0;i1){var d=t.getRangeAt(0),i=t.getRangeAt(l-1);a=d.startContainer.childNodes[d.startOffset],r=i.startContainer.childNodes[i.startOffset]}var s=e(a).closest("td, th"),b=e(r).closest("td, th"),u=s.closest("table"),f=b.closest("table");if(e('[class="'+L+'"]',o.$ed).removeAttr("class"),e("."+L,o.$ed).removeClass(L),0===u.length&&0===f.length||u[0]!==f[0]||s[0]===b[0])e("."+I,o.$ed).removeClass(I);else{u.addClass(I);var g=c(u),m=e("tr",u),p=s.closest("tr"),A=m.index(p),v=b.closest("tr"),h=m.index(v),C=T(s[0],g[A]),w=T(b[0],g[h]),R=Math.min(A,h),D=Math.max(A,h),x=Math.min(C,w),y=Math.max(C,w),B=[];m.each((function(t,l){tD||e("td, th",l).each((function(l,a){var o=T(a,g[t]);oy||(B.push([t,o]),e(a).addClass(L))}))})),n=B}}))}));var S,M,V,z=function(t,l){if(void 0!==n)e(n).each((function(a,o){var n=D(l,o,!1);void 0===n.mergedIn&&t(e(n.element))}));else{var a=e(o.doc.getSelection().anchorNode).closest("td, th");if(0===a.length)return;t(a)}},N="trumbowyg-table-handle-for",$=t((function(){if(o.o.plugins.table.allowHorizontalResize){var t=e("."+o.o.prefix+"table-resize-layers",o.$edBox),l=t.length>0;l||(t=e("
",{class:o.o.prefix+"table-resize-layers"}).appendTo(o.$edBox)),e("."+o.o.prefix+"table-resize-vertical-handle",t).each((function(t,l){e(l).off().remove()})),e("td, th",o.$ed).each((function(l,a){e("
",{class:o.o.prefix+"table-resize-vertical-handle"}).prop(N,a).on("mousedown.tbwTable",(function(t){t.preventDefault(),t.stopPropagation();var l=e(t.target).prop(N);S=e(l).closest("table"),M=c(S);var a=e("tr",S),o=e(l).closest("tr"),n=a.index(o),r=M[n],d=T(l,r),i=M[n][d];void 0!==i.mergedIn&&(i=M[i.mergedIn[0]][i.mergedIn[1]]),V=d+i.colspan-1,E(S,M),U(S,M),j(),S.css({maxWidth:""})})).appendTo(t)})),j(),l||(e(o.doc).on("mousemove.tbwTable",(function(t){if(void 0!==V){t.preventDefault(),t.stopPropagation();var l=S[0].getBoundingClientRect(),a=t.pageX-l.left-(H(M,V).element.getBoundingClientRect().left-l.left),o=e("col",S)[V];e(o).css({width:a}),j()}})).on("mouseup.tbwTable",(function(e){void 0!==V&&(e.preventDefault(),e.stopPropagation(),E(S,M),P(S,M),S=void 0,M=void 0,V=void 0,o.syncCode(),j())})),e(window).on("resize.tbwTable",(function(){j()})))}}),100),E=function(t,l){var a=e("colgroup",t);0===a.length&&(a=e("
").prependTo(t));for(var o=l[0].length,n=e("col",a).length;n").appendTo(a)},H=function(e,t){var l,a=0;do{l=e[a][t],a+=1}while(void 0===l.element||1!==l.colspan);return l},O=function(t,l,a=!1){var o=e("colgroup",t),n=e("col",o),r=Math.ceil(t[0].getBoundingClientRect().width);t.css({maxWidth:r});for(var d=l[0].length,i=[],s=0;s=0?l.push("tableBorderColor"+r):l.push("freeTableBorderColor")}}if(!e.style)return l;var d=e.style.verticalAlign;""!==d&&l.push("tableVerticalAlign"+a(d));var i=e.style.backgroundColor;if(("TH"===e.tagName||"TD"===e.tagName)&&""!==i){var s=n(i);t.o.plugins.table.colorList.indexOf(s)>=0?l.push("tableCellBackgroundColor"+s):l.push("freeTableCellBackgroundColor")}return l}}}})}(jQuery); \ No newline at end of file diff --git a/dist/plugins/table/ui/sass/trumbowyg.table.scss b/dist/plugins/table/ui/sass/trumbowyg.table.scss index a4f98337..5288fa6f 100644 --- a/dist/plugins/table/ui/sass/trumbowyg.table.scss +++ b/dist/plugins/table/ui/sass/trumbowyg.table.scss @@ -1,6 +1,6 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - * Default stylesheet for Trumbowyg editor plugin + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor + * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ * @license MIT diff --git a/dist/plugins/table/ui/trumbowyg.table.css b/dist/plugins/table/ui/trumbowyg.table.css index 8bd4503d..68c989b2 100644 --- a/dist/plugins/table/ui/trumbowyg.table.css +++ b/dist/plugins/table/ui/trumbowyg.table.css @@ -1,5 +1,5 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor * Trumbowyg plugin stylesheet * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ diff --git a/dist/plugins/table/ui/trumbowyg.table.min.css b/dist/plugins/table/ui/trumbowyg.table.min.css index aa4a8171..e5439a39 100644 --- a/dist/plugins/table/ui/trumbowyg.table.min.css +++ b/dist/plugins/table/ui/trumbowyg.table.min.css @@ -1,2 +1,2 @@ -/** Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ +/** Trumbowyg v2.30.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ .trumbowyg-dropdown-table{max-height:unset}.trumbowyg-dropdown-table table{all:unset;display:inline-block;margin:10px;border-collapse:collapse}.trumbowyg-dropdown-table table td{all:unset;position:relative;display:table-cell;height:20px;width:20px;cursor:pointer;background:#fff}.trumbowyg-dropdown-table table td::after{content:"";display:block;position:absolute;top:1px;right:1px;bottom:1px;left:1px;border:1px solid #cecece;pointer-events:none}.trumbowyg-dropdown-table table td.active::after{background-color:#000;border-color:#000}.trumbowyg-dropdown-table .trumbowyg-table-size{text-align:center}.trumbowyg-table-dropdown-title{padding:8px 10px;font-size:12px;text-transform:uppercase;letter-spacing:2px;font-weight:700}.trumbowyg-dropdown-button-group+.trumbowyg-table-dropdown-title{margin-top:24px}.trumbowyg-table-cell-selection-mode ::-moz-selection{color:inherit;background-color:transparent}.trumbowyg-table-cell-selection-mode ::selection{color:inherit;background-color:transparent}.trumbowyg-table-cell-selected{background-color:#b4d3fe!important}.trumbowyg-table-resize-layers{position:absolute;top:0;left:0;width:0;height:0}.trumbowyg-table-resize-vertical-handle{position:absolute;width:5px;margin-left:-3px;cursor:col-resize}.trumbowyg-table-resize-vertical-handle::after{content:"";position:absolute;top:0;left:1px;width:3px;height:100%;background:#0073ff;border-radius:3px;pointer-events:none;opacity:0}.trumbowyg-table-resize-vertical-handle:hover::after{opacity:1}.trumbowyg-dropdown-tableBorderColor:not(.trumbowyg-dropdown--color-list),.trumbowyg-dropdown-tableCellBackgroundColor:not(.trumbowyg-dropdown--color-list){max-width:276px;padding:7px 5px;overflow:initial}.trumbowyg-dropdown-tableBorderColor:not(.trumbowyg-dropdown--color-list) button,.trumbowyg-dropdown-tableCellBackgroundColor:not(.trumbowyg-dropdown--color-list) button{display:block;position:relative;float:left;text-indent:-9999px;height:20px;width:20px;border:1px solid #333;padding:0;margin:2px}.trumbowyg-dropdown-tableBorderColor:not(.trumbowyg-dropdown--color-list) button:focus::after,.trumbowyg-dropdown-tableBorderColor:not(.trumbowyg-dropdown--color-list) button:hover::after,.trumbowyg-dropdown-tableCellBackgroundColor:not(.trumbowyg-dropdown--color-list) button:focus::after,.trumbowyg-dropdown-tableCellBackgroundColor:not(.trumbowyg-dropdown--color-list) button:hover::after{content:" ";display:block;position:absolute;top:-5px;left:-5px;width:27px;height:27px;background:inherit;border:1px solid #fff;-webkit-box-shadow:#000 0 0 2px;box-shadow:#000 0 0 2px;z-index:10}.trumbowyg-dropdown-tableBorderColor.trumbowyg-dropdown--color-list button:not(.trumbowyg-removeTableCellBackgroundColor-dropdown-button):not(.trumbowyg-removeTableBorderColor-dropdown-button),.trumbowyg-dropdown-tableCellBackgroundColor.trumbowyg-dropdown--color-list button:not(.trumbowyg-removeTableCellBackgroundColor-dropdown-button):not(.trumbowyg-removeTableBorderColor-dropdown-button){position:relative;color:#fff!important}.trumbowyg-dropdown-tableBorderColor.trumbowyg-dropdown--color-list button:not(.trumbowyg-removeTableCellBackgroundColor-dropdown-button):not(.trumbowyg-removeTableBorderColor-dropdown-button):focus::after,.trumbowyg-dropdown-tableBorderColor.trumbowyg-dropdown--color-list button:not(.trumbowyg-removeTableCellBackgroundColor-dropdown-button):not(.trumbowyg-removeTableBorderColor-dropdown-button):hover::after,.trumbowyg-dropdown-tableCellBackgroundColor.trumbowyg-dropdown--color-list button:not(.trumbowyg-removeTableCellBackgroundColor-dropdown-button):not(.trumbowyg-removeTableBorderColor-dropdown-button):focus::after,.trumbowyg-dropdown-tableCellBackgroundColor.trumbowyg-dropdown--color-list button:not(.trumbowyg-removeTableCellBackgroundColor-dropdown-button):not(.trumbowyg-removeTableBorderColor-dropdown-button):hover::after{content:" ";display:block;position:absolute;top:13px;left:0;width:0;height:0;border:5px solid transparent;border-left-color:#fff} \ No newline at end of file diff --git a/dist/plugins/tenor/trumbowyg.tenor.js b/dist/plugins/tenor/trumbowyg.tenor.js new file mode 100644 index 00000000..20ad79f5 --- /dev/null +++ b/dist/plugins/tenor/trumbowyg.tenor.js @@ -0,0 +1,319 @@ +// adapted from giphy plugin +/* global AbortController: true */ +(function ($) { + 'use strict'; + + $.extend(true, $.trumbowyg, { + langs: { + // jshint camelcase:false + en: { + tenor: 'Insert GIF' + }, + az: { + tenor: 'GIF yerləşdir' + }, + by: { + tenor: 'Уставіць GIF' + }, + de: { + tenor: 'GIF einfügen' + }, + et: { + tenor: 'Sisesta GIF' + }, + fr: { + tenor: 'Insérer un GIF' + }, + hu: { + tenor: 'GIF beszúrás' + }, + ru: { + tenor: 'Вставить GIF' + }, + sl: { + tenor: 'Vstavi GIF' + }, + tr: { + tenor: 'GIF ekle' + } + // jshint camelcase:true + } + }); + + var tenorLogo = ''; // jshint ignore:line + + var CANCEL_EVENT = 'tbwcancel'; + var nextCursor = null; + + // Throttle helper + function trumbowygThrottle(callback, delay) { + var last; + var timer; + + return function () { + var context = this; + var now = new Date().getTime(); + 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); + } + }; + } + + function registerGifClickEventInModal(trumbowyg, $tenorModal) { + $tenorModal.on('click', 'img', function () { + var src = $(this).attr('data-full'), + 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(); + } + $tenorModal.off('click', 'img'); + trumbowyg.closeModal(); + }); + } + + // Fills modal with response gifs + function renderGifs(response, $tenorModal, trumbowyg, mustEmpty) { + var $tenorLoading = $tenorModal.siblings('.' + trumbowyg.o.prefix + 'tenor-loading'); + var modalWidth = $tenorModal.width(); + var gapBetweenImages = 10; + var imagesPerRow = 3; + var imageWidth = (modalWidth - (gapBetweenImages * (imagesPerRow + 1))) / imagesPerRow; + + nextCursor = response.next; + var columnHeights = Array(imagesPerRow).fill(gapBetweenImages); + + if (!mustEmpty) { + columnHeights = $tenorModal.data('columnHeights') || columnHeights; + } + + var html = response.results + .map(function (gifData) { + // jshint camelcase:false + var image = gifData.media_formats.tinygif, + imageRatio = image.dims[1] / image.dims[0], + altText = gifData.content_description; + + var full_size = gifData.media_formats.gif.url; + + var imgHtml = '' + altText + ''; + + var minHeight = Math.min(...columnHeights); + var columnIndex = columnHeights.indexOf(minHeight); + var top = columnHeights[columnIndex]; + var left = gapBetweenImages + (columnIndex * (imageWidth + gapBetweenImages)); + + columnHeights[columnIndex] += imageRatio * imageWidth + gapBetweenImages; + + var divHtml = '
' + imgHtml + '
'; + return divHtml; + }) + .join(''); + + if (mustEmpty === true) { + if (html.length === 0) { + if ($('.' + trumbowyg.o.prefix + 'tenor-no-result', $tenorModal).length > 0) { + return; + } + + html = ''; + } + + $tenorModal.empty(); + } + $tenorModal.append(html); + + if (!nextCursor || nextCursor.length === 0) { + $tenorLoading.hide(); + } else { + $tenorLoading.show(); + } + + // 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 (img) { + img.classList.add('tbw-loaded'); + }; + $('img', $tenorModal).each(function () { + var img = this; + if (img.complete) { // images load instantly when cached and esp. when loaded in previous modal open + addLoadedClass(img); + return; + } + + img.addEventListener('load', function () { + addLoadedClass(this); + }); + }); + + $tenorModal.data('columnHeights', columnHeights); + + var maxHeight = Math.max(...columnHeights); + $tenorModal.css({ + position: 'relative', + height: maxHeight, + }); + } + + var defaultOptions = { + apiKey: null, + locale: 'en_US', + contentFilter: 'off', + throttleDelay: 300, + noResultGifUrl: 'https://media1.tenor.com/m/KOZLvzU0o4kAAAAC/no-results.gif' + }; + + // Add dropdown with font sizes + $.extend(true, $.trumbowyg, { + plugins: { + tenor: { + init: function (trumbowyg) { + trumbowyg.o.plugins.tenor = $.extend({}, + defaultOptions, + trumbowyg.o.plugins.tenor || {} + ); + + trumbowyg.addBtnDef('tenor', { + fn: function () { + if (trumbowyg.o.plugins.tenor.apiKey === null) { + throw new Error('You must set a Tenor API Key'); + } + + var BASE_URL = 'https://g.tenor.com/v2/search?ar_range=all&media_filter=gif,tinygif&limit=10&key=' + + trumbowyg.o.plugins.tenor.apiKey + + '&locale=' + trumbowyg.o.plugins.tenor.locale + + '&contentfilter=' + trumbowyg.o.plugins.tenor.contentFilter; + + var DEFAULT_URL = BASE_URL.replace('/search', '/featured'); + var prefix = trumbowyg.o.prefix; + var abortController = new AbortController(); + + // Create and open the modal + var searchInput = '', + closeButton = '', + poweredByTenor = '
Powered by' + tenorLogo + '
', + tenorModalHtml = searchInput + closeButton + poweredByTenor + '

Loading more gifs...

'; + + trumbowyg + .openModal(null, tenorModalHtml, false) + .one(CANCEL_EVENT, function () { + try { + abortController.abort(); + abortController = new AbortController(); + } catch (e) { + } + + trumbowyg.closeModal(); + }); + + var $tenorInput = $('.' + prefix + 'tenor-search'), + $tenorClose = $('.' + prefix + 'tenor-close'), + $tenorModal = $('.' + prefix + 'tenor-modal'), + $tenorModalScroll = $('.' + prefix + 'tenor-modal-scroll'); + + var onError = function () { + if (navigator.onLine || $('.' + prefix + 'tenor-offline', $tenorModal).length) { + return; + } + + $tenorModal.empty(); + $tenorModal.append('

You are offline

'); + }; + + registerGifClickEventInModal(trumbowyg, $tenorModal); + + // Load trending gifs as default + fetch(DEFAULT_URL, { + method: 'GET', + cache: 'no-cache', + signal: abortController.signal + }).then((response) => { + response.json().then((responseJson) => { + renderGifs(responseJson, $tenorModal, trumbowyg, true); + }); + }).catch(() => { + onError(); + }); + + var searchGifsOnInput = function () { + var query = $tenorInput.val(); + + if (query.length === 0) { + return; + } + + try { + abortController.abort(); + abortController = new AbortController(); + } catch (e) { + } + + $tenorModalScroll.scrollTop(0); + fetch(BASE_URL + '&q=' + encodeURIComponent(query), { + method: 'GET', + cache: 'no-cache', + signal: abortController.signal + }).then((response) => { + response.json().then((responseJson) => { + renderGifs(responseJson, $tenorModal, trumbowyg, true); + }); + }).catch(() => { + onError(); + }); + }; + var throttledInputRequest = trumbowygThrottle(searchGifsOnInput, trumbowyg.o.plugins.tenor.throttleDelay); + + $tenorInput.on('input', throttledInputRequest); + $tenorInput.focus(); + + $tenorClose.one('click', function () { + $tenorModal.trigger(CANCEL_EVENT); + }); + + var throttledQuery = trumbowygThrottle(function () { + if ($tenorModalScroll.scrollTop() + $tenorModalScroll.innerHeight() >= $tenorModalScroll[0].scrollHeight - 100) { + if (nextCursor) { + var query = $tenorInput.val(); + var url = query.length === 0 ? DEFAULT_URL : BASE_URL + '&q=' + encodeURIComponent(query); + url += '&pos=' + nextCursor; + + fetch(url, { + method: 'GET', + cache: 'no-cache', + signal: abortController.signal + }).then((response) => { + response.json().then((responseJson) => { + renderGifs(responseJson, $tenorModal, trumbowyg, false); + }); + }).catch(() => { + onError(); + }); + } + } + }, 500); + + // Infinite scrolling + $tenorModalScroll.on('scroll', throttledQuery); + } + }); + } + } + } + }); +})(jQuery); diff --git a/dist/plugins/tenor/trumbowyg.tenor.min.js b/dist/plugins/tenor/trumbowyg.tenor.min.js new file mode 100644 index 00000000..f9fb9204 --- /dev/null +++ b/dist/plugins/tenor/trumbowyg.tenor.min.js @@ -0,0 +1 @@ +!function(e){"use strict";e.extend(!0,e.trumbowyg,{langs:{en:{tenor:"Insert GIF"},az:{tenor:"GIF yerləşdir"},by:{tenor:"Уставіць GIF"},de:{tenor:"GIF einfügen"},et:{tenor:"Sisesta GIF"},fr:{tenor:"Insérer un GIF"},hu:{tenor:"GIF beszúrás"},ru:{tenor:"Вставить GIF"},sl:{tenor:"Vstavi GIF"},tr:{tenor:"GIF ekle"}}});var t="tbwcancel",n=null;function o(e,t){var n,o;return function(){var r=this,i=(new Date).getTime(),l=arguments;n&&i',l=Math.min(...c),a=c.indexOf(l),u=c[a],g=10+a*(s+10);return c[a]+=n*s+10,'
'+i+"
"})).join("");if(!0===i){if(0===u.length){if(e("."+r.o.prefix+"tenor-no-result",o).length>0)return;u=''}o.empty()}o.append(u),n&&0!==n.length?l.show():l.hide();var g=function(e){e.classList.add("tbw-loaded")};e("img",o).each((function(){var e=this;e.complete?g(e):e.addEventListener("load",(function(){g(this)}))})),o.data("columnHeights",c);var f=Math.max(...c);o.css({position:"relative",height:f})}var i={apiKey:null,locale:"en_US",contentFilter:"off",throttleDelay:300,noResultGifUrl:"https://media1.tenor.com/m/KOZLvzU0o4kAAAAC/no-results.gif"};e.extend(!0,e.trumbowyg,{plugins:{tenor:{init:function(l){l.o.plugins.tenor=e.extend({},i,l.o.plugins.tenor||{}),l.addBtnDef("tenor",{fn:function(){if(null===l.o.plugins.tenor.apiKey)throw new Error("You must set a Tenor API Key");var i="https://g.tenor.com/v2/search?ar_range=all&media_filter=gif,tinygif&limit=10&key="+l.o.plugins.tenor.apiKey+"&locale="+l.o.plugins.tenor.locale+"&contentfilter="+l.o.plugins.tenor.contentFilter,a=i.replace("/search","/featured"),s=l.o.prefix,c=new AbortController,u=''+('')+('
Powered by
')+'

Loading more gifs...

';l.openModal(null,u,!1).one(t,(function(){try{c.abort(),c=new AbortController}catch(e){}l.closeModal()}));var g=e("."+s+"tenor-search"),f=e("."+s+"tenor-close"),h=e("."+s+"tenor-modal"),d=e("."+s+"tenor-modal-scroll"),p=function(){navigator.onLine||e("."+s+"tenor-offline",h).length||(h.empty(),h.append('

You are offline

'))};!function(t,n){n.on("click","img",(function(){var o=e(this).attr("data-full"),r=e(this).attr("alt");t.restoreRange(),t.execCmd("insertImage",o,!1,!0),r&&(e('img[src="'+o+'"]:not([alt])',t.$box).attr("alt",r),t.syncCode()),n.off("click","img"),t.closeModal()}))}(l,h),fetch(a,{method:"GET",cache:"no-cache",signal:c.signal}).then((e=>{e.json().then((e=>{r(e,h,l,!0)}))})).catch((()=>{p()}));var m=o((function(){var e=g.val();if(0!==e.length){try{c.abort(),c=new AbortController}catch(e){}d.scrollTop(0),fetch(i+"&q="+encodeURIComponent(e),{method:"GET",cache:"no-cache",signal:c.signal}).then((e=>{e.json().then((e=>{r(e,h,l,!0)}))})).catch((()=>{p()}))}}),l.o.plugins.tenor.throttleDelay);g.on("input",m),g.focus(),f.one("click",(function(){h.trigger(t)}));var v=o((function(){if(d.scrollTop()+d.innerHeight()>=d[0].scrollHeight-100&&n){var e=g.val(),t=0===e.length?a:i+"&q="+encodeURIComponent(e);fetch(t+="&pos="+n,{method:"GET",cache:"no-cache",signal:c.signal}).then((e=>{e.json().then((e=>{r(e,h,l,!1)}))})).catch((()=>{p()}))}}),500);d.on("scroll",v)}})}}}})}(jQuery); \ No newline at end of file diff --git a/dist/plugins/tenor/ui/sass/trumbowyg.tenor.scss b/dist/plugins/tenor/ui/sass/trumbowyg.tenor.scss new file mode 100644 index 00000000..0d9c7e03 --- /dev/null +++ b/dist/plugins/tenor/ui/sass/trumbowyg.tenor.scss @@ -0,0 +1,124 @@ +/** + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor + * Trumbowyg plugin stylesheet + * ------------------------ + * @link https://alex-d.github.io/Trumbowyg/ + * @license MIT + * @author Alexandre Demode (Alex-D) + * Twitter : @AlexandreDemode + * Website : alex-d.fr + */ + +// Adapted from giphy plugin + +.trumbowyg-tenor-button svg { + transform: scale(1.22); +} + +.trumbowyg-tenor-search { + display: block; + width: 80%; + margin: 5%; + padding-left: 10px; + padding-right: 150px; +} + +.trumbowyg-tenor-close { + position: absolute; + top: calc(5% + 8px); + right: calc(5% - 2px); + width: 30px; + height: 30px; + background: none; + border: 1px solid transparent; + + &:hover, + &:focus { + outline: none; + background: #ecf0f1; + } + + &:focus { + border-color: rgba(0, 0, 0, 0.3); + } +} + +.trumbowyg-powered-by-tenor { + position: absolute; + top: calc(5% + 11px); + right: calc(15% + 5px); + pointer-events: none; + user-select: none; + + span { + text-transform: uppercase; + font-weight: bold; + font-size: 10px; + opacity: 0.6; + } + + svg { + width: 66px; + height: 15px; + vertical-align: middle; + margin-left: 6px; + opacity: 0.45; + } +} + +.trumbowyg-tenor-modal-scroll { + overflow: auto; + overflow-x: hidden; + height: 240px; + + .trumbowyg-tenor-loading { + display: none; + padding: 20px; + + img { + height: 25px; + } + } +} + +.trumbowyg-tenor-modal { + display: flex; + flex-wrap: wrap; + justify-content: center; + margin: 0 3%; + + .trumbowyg-tenor-no-result { + width: 100%; + margin: 0 3%; + } + + .trumbowyg-tenor-offline { + font-size: 18px; + width: 305%; + height: 600px; + margin-top: 95px; + text-align: center; + } +} + +.trumbowyg-tenor-modal .img-container { + margin-bottom: 10px; + background-color: #ecf0f1; + + img { + width: 100%; + cursor: pointer; + opacity: 0; + transition: opacity 150ms; + display: block; + + &:hover, + &:focus { + border: #2ecc71 solid 3px; + } + } + + img.tbw-loaded { + opacity: 1; + } +} diff --git a/dist/plugins/tenor/ui/trumbowyg.tenor.css b/dist/plugins/tenor/ui/trumbowyg.tenor.css new file mode 100644 index 00000000..ceae2625 --- /dev/null +++ b/dist/plugins/tenor/ui/trumbowyg.tenor.css @@ -0,0 +1,119 @@ +/** + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor + * Trumbowyg plugin stylesheet + * ------------------------ + * @link https://alex-d.github.io/Trumbowyg/ + * @license MIT + * @author Alexandre Demode (Alex-D) + * Twitter : @AlexandreDemode + * Website : alex-d.fr + */ + +.trumbowyg-tenor-button svg { + -webkit-transform: scale(1.22); + transform: scale(1.22); +} + +.trumbowyg-tenor-search { + display: block; + width: 80%; + margin: 5%; + padding-left: 10px; + padding-right: 150px; +} + +.trumbowyg-tenor-close { + position: absolute; + top: calc(5% + 8px); + right: calc(5% - 2px); + width: 30px; + height: 30px; + background: none; + border: 1px solid transparent; +} +.trumbowyg-tenor-close:hover, .trumbowyg-tenor-close:focus { + outline: none; + background: #ecf0f1; +} +.trumbowyg-tenor-close:focus { + border-color: rgba(0, 0, 0, 0.3); +} + +.trumbowyg-powered-by-tenor { + position: absolute; + top: calc(5% + 11px); + right: calc(15% + 5px); + pointer-events: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +.trumbowyg-powered-by-tenor span { + text-transform: uppercase; + font-weight: bold; + font-size: 10px; + opacity: 0.6; +} +.trumbowyg-powered-by-tenor svg { + width: 66px; + height: 15px; + vertical-align: middle; + margin-left: 6px; + opacity: 0.45; +} + +.trumbowyg-tenor-modal-scroll { + overflow: auto; + overflow-x: hidden; + height: 240px; +} +.trumbowyg-tenor-modal-scroll .trumbowyg-tenor-loading { + display: none; + padding: 20px; +} +.trumbowyg-tenor-modal-scroll .trumbowyg-tenor-loading img { + height: 25px; +} + +.trumbowyg-tenor-modal { + display: -webkit-box; + display: -ms-flexbox; + display: flex; + -ms-flex-wrap: wrap; + flex-wrap: wrap; + -webkit-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + margin: 0 3%; +} +.trumbowyg-tenor-modal .trumbowyg-tenor-no-result { + width: 100%; + margin: 0 3%; +} +.trumbowyg-tenor-modal .trumbowyg-tenor-offline { + font-size: 18px; + width: 305%; + height: 600px; + margin-top: 95px; + text-align: center; +} + +.trumbowyg-tenor-modal .img-container { + margin-bottom: 10px; + background-color: #ecf0f1; +} +.trumbowyg-tenor-modal .img-container img { + width: 100%; + cursor: pointer; + opacity: 0; + -webkit-transition: opacity 150ms; + transition: opacity 150ms; + display: block; +} +.trumbowyg-tenor-modal .img-container img:hover, .trumbowyg-tenor-modal .img-container img:focus { + border: #2ecc71 solid 3px; +} +.trumbowyg-tenor-modal .img-container img.tbw-loaded { + opacity: 1; +} \ No newline at end of file diff --git a/dist/plugins/tenor/ui/trumbowyg.tenor.min.css b/dist/plugins/tenor/ui/trumbowyg.tenor.min.css new file mode 100644 index 00000000..bf56e9f6 --- /dev/null +++ b/dist/plugins/tenor/ui/trumbowyg.tenor.min.css @@ -0,0 +1,2 @@ +/** Trumbowyg v2.30.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ +.trumbowyg-tenor-button svg{-webkit-transform:scale(1.22);transform:scale(1.22)}.trumbowyg-tenor-search{display:block;width:80%;margin:5%;padding-left:10px;padding-right:150px}.trumbowyg-tenor-close{position:absolute;top:calc(5% + 8px);right:calc(5% - 2px);width:30px;height:30px;background:0 0;border:1px solid transparent}.trumbowyg-tenor-close:focus,.trumbowyg-tenor-close:hover{outline:0;background:#ecf0f1}.trumbowyg-tenor-close:focus{border-color:rgba(0,0,0,.3)}.trumbowyg-powered-by-tenor{position:absolute;top:calc(5% + 11px);right:calc(15% + 5px);pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.trumbowyg-powered-by-tenor span{text-transform:uppercase;font-weight:700;font-size:10px;opacity:.6}.trumbowyg-powered-by-tenor svg{width:66px;height:15px;vertical-align:middle;margin-left:6px;opacity:.45}.trumbowyg-tenor-modal-scroll{overflow:auto;overflow-x:hidden;height:240px}.trumbowyg-tenor-modal-scroll .trumbowyg-tenor-loading{display:none;padding:20px}.trumbowyg-tenor-modal-scroll .trumbowyg-tenor-loading img{height:25px}.trumbowyg-tenor-modal{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin:0 3%}.trumbowyg-tenor-modal .trumbowyg-tenor-no-result{width:100%;margin:0 3%}.trumbowyg-tenor-modal .trumbowyg-tenor-offline{font-size:18px;width:305%;height:600px;margin-top:95px;text-align:center}.trumbowyg-tenor-modal .img-container{margin-bottom:10px;background-color:#ecf0f1}.trumbowyg-tenor-modal .img-container img{width:100%;cursor:pointer;opacity:0;-webkit-transition:opacity 150ms;transition:opacity 150ms;display:block}.trumbowyg-tenor-modal .img-container img:focus,.trumbowyg-tenor-modal .img-container img:hover{border:#2ecc71 solid 3px}.trumbowyg-tenor-modal .img-container img.tbw-loaded{opacity:1} \ No newline at end of file diff --git a/dist/trumbowyg.js b/dist/trumbowyg.js index cd025d17..e57410f7 100644 --- a/dist/trumbowyg.js +++ b/dist/trumbowyg.js @@ -1,5 +1,5 @@ /** - * Trumbowyg v2.29.0 - A lightweight WYSIWYG editor + * Trumbowyg v2.30.0 - A lightweight WYSIWYG editor * Trumbowyg core file * ------------------------ * @link https://alex-d.github.io/Trumbowyg/ @@ -209,7 +209,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { }; // @param: editorElem is the DOM element - var Trumbowyg = function (editorElem, options) { + var Trumbowyg = function (editorElem, options) { // jshint ignore:line var t = this, trumbowygIconsId = 'trumbowyg-icons', $trumbowyg = $.trumbowyg; @@ -261,7 +261,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { fetch(svgPathOption, { method: 'GET', headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' } }).then((response) => { response.text() @@ -295,7 +295,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { t.btnsDef = { viewHTML: { fn: 'toggle', - class: 'trumbowyg-not-disable', + class: 'trumbowyg-not-disable' }, undo: { @@ -534,7 +534,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { }); t.$edBox = $('
', { - class: prefix + 'editor-box', + class: prefix + 'editor-box' }); // $ta = Textarea @@ -708,7 +708,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { } }) .on('keyup focus', function () { - if (!t.$ta.val().match(/<.*>/) && !t.$ed.html().match(/<.*>/)) { + if (!t.$ta.val().match(/<.*>/) && !t.$ed.html().match(/<.*>/)) { setTimeout(function () { var block = t.isIE ? '

' : 'p'; t.doc.execCommand('formatBlock', false, block); @@ -832,7 +832,8 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { // Build a button and his action - buildBtn: function (btnName) { // btnName is name of the button + // @param btnName The name of the button + buildBtn: function (btnName) { // jshint ignore:line var t = this, prefix = t.o.prefix, btn = t.btnsDef[btnName], @@ -1269,7 +1270,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { return; } - if(revert) { + if (revert) { oldTag = newTag; newTag = tmpTag; } @@ -1293,7 +1294,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { } $newTag.html($oldTag.html()); $oldTag.remove(); - if(resetRange === true) { + if (resetRange === true) { t.range.selectNodeContents($newTag.get(0)); t.range.collapse(false); } @@ -1499,7 +1500,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { t.$ed.focus(); } - if(cmd === 'strikethrough' && t.o.semantic) { + if (cmd === 'strikethrough' && t.o.semantic) { t.semanticTag('strike', t.o.semanticKeepAttributes, true); // browsers cannot undo e.g. as they expect } @@ -1526,7 +1527,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { t.semanticCode(false, true); try { var listId = window.getSelection().focusNode; - if(!$(window.getSelection().focusNode.parentNode).hasClass('trumbowyg-editor')){ + if (!$(window.getSelection().focusNode.parentNode).hasClass('trumbowyg-editor')) { listId = window.getSelection().focusNode.parentNode; } var classes = t.o.tagClasses[param]; @@ -1620,7 +1621,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { .css({ top: '-' + t.$btnPane.outerHeight(), opacity: 0, - paddingBottom: buildForm ? null : '5%', + paddingBottom: buildForm ? null : '5%' }) .appendTo($modal) .animate({ @@ -1704,13 +1705,13 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { }).join(' '); if (typeof field.type === 'function') { - if (!field.name) { - field.name = n; - } + if (!field.name) { + field.name = n; + } - html += field.type(field, fieldId, prefix, lg); + html += field.type(field, fieldId, prefix, lg); - return; + return; } html += '

'; diff --git a/dist/trumbowyg.min.js b/dist/trumbowyg.min.js index f7643594..b71b0213 100644 --- a/dist/trumbowyg.min.js +++ b/dist/trumbowyg.min.js @@ -1,2 +1,2 @@ -/** Trumbowyg v2.29.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ +/** Trumbowyg v2.30.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg/ - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",_self:"Same tab (default)",_blank:"New tab",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target",width:"Width"}},plugins:{},svgPath:null,svgAbsoluteUseHref:!1,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,hideButtonTexts:null,prefix:"trumbowyg-",tagClasses:{},semantic:!0,semanticKeepAttributes:!1,resetCss:!1,removeformatPasted:!1,tabToIndent:!1,tagsToRemove:[],tagsToKeep:["hr","img","embed","iframe","input"],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},changeActiveDropdownIcon:!1,inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1,linkTargets:["_self","_blank"],svgPath:null},writable:!1,enumerable:!0,configurable:!1}),function(e,t,n,a){"use strict";var o="tbwconfirm",r="tbwcancel";a.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each((function(){a(this).data(n)||a(this).data(n,new i(this,e))}));if(1===this.length)try{var o=a(this).data(n);switch(e){case"execCmd":return o.execCmd(t.cmd,t.param,t.forceCss,t.skipTrumbowyg);case"openModal":return o.openModal(t.title,t.content);case"closeModal":return o.closeModal();case"openModalInsert":return o.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return o.saveRange();case"getRange":return o.range;case"getRangeText":return o.getRangeText();case"restoreRange":return o.restoreRange();case"enable":return o.setDisabled(!1);case"disable":return o.setDisabled(!0);case"toggle":return o.toggle();case"destroy":return o.destroy();case"empty":return o.empty();case"html":return o.html(t)}}catch(e){}return!1};var i=function(o,r){var i=this,s="trumbowyg-icons",l=a.trumbowyg;i.doc=o.ownerDocument||n,i.$ta=a(o),i.$c=a(o),null!=(r=r||{}).lang||null!=l.langs[r.lang]?i.lang=a.extend(!0,{},l.langs.en,l.langs[r.lang]):i.lang=l.langs.en,i.hideButtonTexts=null!=l.hideButtonTexts?l.hideButtonTexts:r.hideButtonTexts;var d=null!=l.svgPath?l.svgPath:r.svgPath;if(i.hasSvg=!1!==d,!1!==d&&(l.svgAbsoluteUseHref||0===a("#"+s,i.doc).length)){if(null==d)a("script[src]").each((function(e,t){var n=t.src,a=n.match("trumbowyg(.min)?.js");null!=a&&(d=n.substring(0,n.indexOf(a[0]))+"ui/icons.svg")}));if(null==d)console.warn("You must define svgPath: https://goo.gl/CfTY9U");else if(!l.svgAbsoluteUseHref){var c=i.doc.createElement("div");c.id=s,i.doc.body.insertBefore(c,i.doc.body.childNodes[0]),fetch(d,{method:"GET",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).then((e=>{e.text().then((e=>{c.innerHTML=e}))}))}}var u=i.doc.querySelector("base")?t.location.href.replace(t.location.hash,""):"";i.svgPath=l.svgAbsoluteUseHref?d:u;var g=i.lang.header,f=function(){return(t.chrome||t.Intl&&Intl.v8BreakIterator)&&"CSS"in t};i.btnsDef={viewHTML:{fn:"toggle",class:"trumbowyg-not-disable"},undo:{isSupported:f,key:"Z"},redo:{isSupported:f,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:g+" 1"},h2:{fn:"formatBlock",title:g+" 2"},h3:{fn:"formatBlock",title:g+" 3"},h4:{fn:"formatBlock",title:g+" 4"},h5:{fn:"formatBlock",title:g+" 5"},h6:{fn:"formatBlock",title:g+" 6"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{class:"trumbowyg-not-disable"},close:{fn:"destroy",class:"trumbowyg-not-disable"},formatting:{dropdown:["p","blockquote","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},i.o=a.extend(!0,{},l.defaultOptions,r),i.o.hasOwnProperty("imgDblClickHandler")||(i.o.imgDblClickHandler=i.getDefaultImgDblClickHandler()),i.urlPrefix=i.setupUrlPrefix(),i.disabled=i.o.disabled||"TEXTAREA"===o.nodeName&&o.disabled,r.btns?i.o.btns=r.btns:i.o.semantic||(i.o.btns[3]=["bold","italic","underline","strikethrough"]),a.each(i.o.btnsDef,(function(e,t){i.addBtnDef(e,t)})),i.eventNamespace="trumbowyg-event",i.keys=[],i.tagToButton={},i.tagHandlers=[],i.pasteHandlers=[].concat(i.o.pasteHandlers),i.isIE=-1!==e.userAgent.indexOf("MSIE")||-1!==e.appVersion.indexOf("Trident/"),i.isMac=-1!==e.platform.toUpperCase().indexOf("MAC"),i.init()};i.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.outerHeight()-39,e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(e){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout((function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")}))},addBtnDef:function(e,t){this.btnsDef[e]=a.extend(t,this.btnsDef[e]||{})},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":e.replace("://","")+"://"},buildEditor:function(){var e=this,n=e.o.prefix,o="";e.$box=a("
",{class:n+"box "+n+"editor-visible "+n+e.o.lang+" trumbowyg"}),e.$edBox=a("
",{class:n+"editor-box"}),e.isTextarea=e.$ta.is("textarea"),e.isTextarea?(o=e.$ta.val(),e.$ed=a("
").appendTo(e.$edBox),e.$box.insertAfter(e.$ta).append(e.$edBox,e.$ta)):(e.$ed=e.$ta,o=e.$ed.html(),e.$ta=a("
",{scope:"col"}).appendTo(a);l.appendTo(t);for(var r=e("
").appendTo(c);r.appendTo(t),s(t);for(var f=o.range.endContainer;f.nodeType!==Node.ELEMENT_NODE;)f=f.parentNode;f!==o.$ed[0]&&o.range.setEndAfter(f),o.range.collapse(),o.range.insertNode(t[0]),"P"===f.nodeName&&0===f.textContent.trim().length&&f.remove(),o.syncCode(),$()},c=function(t){for(var l=e("tr",t),a=[],o=0;o0?d:1,10),b=parseInt(i>0?i:1,10);void 0!==a[t][o];)o+=1;a[t][o]={tag:n.tagName,element:n,colspan:s,rowspan:b};for(var c=1;c"),b=d.index(a);if(t)b=Math.max(0,b-1),a=e(d[b]);else{var c=e(n).closest("td, th",o.$ed[0]).attr("rowspan"),u=parseInt(c||1,10);a=e(d[b+=u-1])}var f=e("tbody tr",l),g=0!==a.closest("thead").length;g&&(a=f.first());for(var m=r[b],p=r[b+1],A=r[0].length,v=0;v").appendTo(i)}0===b&&(t||g)?a.before(i):a.after(i),s(l),$()}))},g={title:o.lang.tableAddRowAbove,text:o.lang.tableAddRowAbove,ico:"row-above",fn:f(!0)},m={title:o.lang.tableAddRow,text:o.lang.tableAddRow,ico:"row-below",fn:f(!1)},p={title:o.lang.tableAddHeaderRow,text:o.lang.tableAddHeaderRow,ico:"header-row",fn:u((function(t,l,a,o){if(0!==e("thead",t).length)return!1;for(var n=o[0].length,r=e("