diff --git a/dist/langs/ar.min.js b/dist/langs/ar.min.js
index 0f83dd376..d9a05bda7 100644
--- a/dist/langs/ar.min.js
+++ b/dist/langs/ar.min.js
@@ -5,5 +5,7 @@
* ===========================================================
* Author : Abo Mokh ahmed (abomokhahmed)
* Github : https://github.com/abomokhahmed
+ * Reviewed by : Abdellah Chadidi (chadidi)
+ * Github : https://github.com/chadidi
*/
-jQuery.trumbowyg.langs.ar={_dir:"rtl",viewHTML:"إعرض-HTML",formatting:"تصميم",p:"فقرة",blockquote:"اقتباس",code:"كود",header:"رئيسي",bold:"عريض",italic:"مائل",strikethrough:"مشطوب",underline:"خطّ سفلي",strong:"بارز",em:"تغميق",del:"حذف",unorderedList:"قائمة غير مرتّبة",orderedList:"قائمة مرتّبة",insertImage:"إدخال صورة",insertVideo:"إدخال فيديو",link:"رابط",createLink:"انشاء رابط",unlink:"حذف رابط",justifyLeft:"تصحيح للشمال",justifyCenter:"تصحيح للمركز",justifyRight:"تصحيح لليمين",justifyFull:"تصحيح لكلا الإتّجاهين",horizontalRule:"إدخال خطّ أفقي",fullscreen:"شاشة واسعة",close:"إغلاق",submit:"أرسل",reset:"تهيئة من حديد",required:"إلزامي",description:"وصف",title:"عنوان",text:"نصّ"};
\ No newline at end of file
+jQuery.trumbowyg.langs.ar={_dir:"rtl",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:"إدراج خطّ أفقي",fullscreen:"ملء الشاشة",close:"إغلاق",submit:"إرسال",reset:"إعادة تعيين",required:"إلزامي",description:"وصف",title:"عنوان",text:"نصّ",target:"الهدف"};
\ No newline at end of file
diff --git a/dist/plugins/base64/trumbowyg.base64.js b/dist/plugins/base64/trumbowyg.base64.js
index a480eb2c9..f9958f5d3 100644
--- a/dist/plugins/base64/trumbowyg.base64.js
+++ b/dist/plugins/base64/trumbowyg.base64.js
@@ -13,13 +13,18 @@
return typeof FileReader !== 'undefined';
};
+ var isValidImage = function (type) {
+ return /^data:image\/[a-z]?/i.test(type);
+ };
+
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
base64: 'Image as base64',
file: 'File',
- errFileReaderNotSupported: 'FileReader is not supported by your browser.'
+ errFileReaderNotSupported: 'FileReader is not supported by your browser.',
+ errInvalidImage: 'Invalid image file.'
},
fr: {
base64: 'Image en base64',
@@ -32,6 +37,10 @@
zh_cn: {
base64: '图片(Base64编码)',
file: '文件'
+ },
+ nl: {
+ errFileReaderNotSupported: 'Uw browser ondersteunt deze functionaliteit niet.',
+ errInvalidImage: 'De gekozen afbeelding is ongeldig.'
}
},
// jshint camelcase:true
@@ -44,9 +53,9 @@
isSupported: isSupported,
fn: function () {
trumbowyg.saveRange();
-
+
var file;
- trumbowyg.openModalInsert(
+ var $modal = trumbowyg.openModalInsert(
// Title
trumbowyg.lang.base64,
@@ -54,7 +63,10 @@
{
file: {
type: 'file',
- required: true
+ required: true,
+ attributes: {
+ accept: 'image/*'
+ }
},
alt: {
label: 'description',
@@ -66,10 +78,17 @@
function (values) {
var fReader = new FileReader();
- fReader.onloadend = function () {
- trumbowyg.execCmd('insertImage', fReader.result);
- $(['img[src="', fReader.result, '"]:not([alt])'].join(''), trumbowyg.$box).attr('alt', values.alt);
- trumbowyg.closeModal();
+ fReader.onloadend = function (e) {
+ if (isValidImage(e.target.result)) {
+ trumbowyg.execCmd('insertImage', fReader.result);
+ $(['img[src="', fReader.result, '"]:not([alt])'].join(''), trumbowyg.$box).attr('alt', values.alt);
+ trumbowyg.closeModal();
+ } else {
+ trumbowyg.addErrorOnModalField(
+ $('input[type=file]', $modal),
+ trumbowyg.lang.errInvalidImage
+ );
+ }
};
fReader.readAsDataURL(file);
diff --git a/dist/plugins/base64/trumbowyg.base64.min.js b/dist/plugins/base64/trumbowyg.base64.min.js
index 88b5d5d18..def7efcfc 100644
--- a/dist/plugins/base64/trumbowyg.base64.min.js
+++ b/dist/plugins/base64/trumbowyg.base64.min.js
@@ -1 +1 @@
-!function(e){"use strict";var a=function(){return"undefined"!=typeof FileReader};e.extend(!0,e.trumbowyg,{langs:{en:{base64:"Image as base64",file:"File",errFileReaderNotSupported:"FileReader is not supported by your browser."},fr:{base64:"Image en base64",file:"Fichier"},cs:{base64:"Vložit obrázek",file:"Soubor"},zh_cn:{base64:"图片(Base64编码)",file:"文件"}},plugins:{base64:{shouldInit:a,init:function(n){var t={isSupported:a,fn:function(){n.saveRange();var a;n.openModalInsert(n.lang.base64,{file:{type:"file",required:!0},alt:{label:"description",value:n.getRangeText()}},function(t){var i=new FileReader;i.onloadend=function(){n.execCmd("insertImage",i.result),e(['img[src="',i.result,'"]:not([alt])'].join(""),n.$box).attr("alt",t.alt),n.closeModal()},i.readAsDataURL(a)}),e("input[type=file]").on("change",function(e){a=e.target.files[0]})}};n.addBtnDef("base64",t)}}}})}(jQuery);
\ No newline at end of file
+!function(e){"use strict";var a=function(){return"undefined"!=typeof FileReader},t=function(e){return/^data:image\/[a-z]?/i.test(e)};e.extend(!0,e.trumbowyg,{langs:{en:{base64:"Image as base64",file:"File",errFileReaderNotSupported:"FileReader is not supported by your browser.",errInvalidImage:"Invalid image file."},fr:{base64:"Image en base64",file:"Fichier"},cs:{base64:"Vložit obrázek",file:"Soubor"},zh_cn:{base64:"图片(Base64编码)",file:"文件"},nl:{errFileReaderNotSupported:"Uw browser ondersteunt deze functionaliteit niet.",errInvalidImage:"De gekozen afbeelding is ongeldig."}},plugins:{base64:{shouldInit:a,init:function(n){var i={isSupported:a,fn:function(){n.saveRange();var a,i=n.openModalInsert(n.lang.base64,{file:{type:"file",required:!0,attributes:{accept:"image/*"}},alt:{label:"description",value:n.getRangeText()}},function(r){var l=new FileReader;l.onloadend=function(a){t(a.target.result)?(n.execCmd("insertImage",l.result),e(['img[src="',l.result,'"]:not([alt])'].join(""),n.$box).attr("alt",r.alt),n.closeModal()):n.addErrorOnModalField(e("input[type=file]",i),n.lang.errInvalidImage)},l.readAsDataURL(a)});e("input[type=file]").on("change",function(e){a=e.target.files[0]})}};n.addBtnDef("base64",i)}}}})}(jQuery);
\ 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 bb76e48a9..53a897709 100644
--- a/dist/plugins/colors/ui/sass/trumbowyg.colors.scss
+++ b/dist/plugins/colors/ui/sass/trumbowyg.colors.scss
@@ -1,5 +1,5 @@
/**
- * Trumbowyg v2.2.0 - A lightweight WYSIWYG editor
+ * Trumbowyg v2.3.0 - A lightweight WYSIWYG editor
* Colors plugin stylesheet for Trumbowyg editor
* ------------------------
* @link http://alex-d.github.io/Trumbowyg
diff --git a/dist/plugins/colors/ui/trumbowyg.colors.css b/dist/plugins/colors/ui/trumbowyg.colors.css
index 442e7278a..0474fadb6 100644
--- a/dist/plugins/colors/ui/trumbowyg.colors.css
+++ b/dist/plugins/colors/ui/trumbowyg.colors.css
@@ -1,5 +1,5 @@
/**
- * Trumbowyg v2.2.0 - A lightweight WYSIWYG editor
+ * Trumbowyg v2.3.0 - A lightweight WYSIWYG editor
* Colors plugin stylesheet for Trumbowyg editor
* ------------------------
* @link http://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 a31874fb6..58883ba41 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.2.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
+/** Trumbowyg v2.3.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
.trumbowyg-dropdown-backColor,.trumbowyg-dropdown-foreColor{width:276px;padding:7px 5px}.trumbowyg-dropdown-backColor svg,.trumbowyg-dropdown-foreColor svg{display:none!important}.trumbowyg-dropdown-backColor button,.trumbowyg-dropdown-foreColor 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 button:focus::after,.trumbowyg-dropdown-backColor button:hover::after,.trumbowyg-dropdown-foreColor button:focus::after,.trumbowyg-dropdown-foreColor button:hover::after{content:" ";display:block;position:absolute;top:-5px;left:-5px;height:27px;width:27px;background:inherit;border:1px solid #FFF;box-shadow:#000 0 0 2px;z-index:10}
\ No newline at end of file
diff --git a/dist/plugins/upload/trumbowyg.upload.js b/dist/plugins/upload/trumbowyg.upload.js
index 6fb0f5a36..7e8490f93 100644
--- a/dist/plugins/upload/trumbowyg.upload.js
+++ b/dist/plugins/upload/trumbowyg.upload.js
@@ -1,11 +1,14 @@
/* ===========================================================
- * trumbowyg.upload.js v1.1
+ * trumbowyg.upload.js v1.2
* Upload plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Alexandre Demode (Alex-D)
* Twitter : @AlexandreDemode
* Website : alex-d.fr
+ * Mod by : Aleksandr-ru
+ * Twitter : @Aleksandr_ru
+ * Website : aleksandr.ru
*/
(function ($) {
@@ -68,6 +71,11 @@
upload: '上传',
file: '文件',
uploadError: '错误'
+ },
+ ru: {
+ upload: 'Загрузка',
+ file: 'Файл',
+ uploadError: 'Ошибка'
}
},
// jshint camelcase:true
@@ -91,7 +99,10 @@
{
file: {
type: 'file',
- required: true
+ required: true,
+ attributes: {
+ accept: 'image/*'
+ }
},
alt: {
label: 'description',
@@ -138,23 +149,28 @@
}, 200);
},
- success: trumbowyg.o.plugins.upload.success || function (data) {
- if (!!getDeep(data, trumbowyg.o.plugins.upload.statusPropertyName.split('.'))) {
- var url = getDeep(data, trumbowyg.o.plugins.upload.urlPropertyName.split('.'));
- trumbowyg.execCmd('insertImage', url);
- $('img[src="' + url + '"]:not([alt])', trumbowyg.$box).attr('alt', values.alt);
- setTimeout(function () {
- trumbowyg.closeModal();
- }, 250);
- trumbowyg.$c.trigger('tbwuploadsuccess', [trumbowyg, data, url]);
+ success: function (data) {
+ if (trumbowyg.o.plugins.upload.success) {
+ trumbowyg.o.plugins.upload.success(data, trumbowyg, $modal, values);
} else {
- trumbowyg.addErrorOnModalField(
- $('input[type=file]', $modal),
- trumbowyg.lang[data.message]
- );
- trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg, data]);
+ if (!!getDeep(data, trumbowyg.o.plugins.upload.statusPropertyName.split('.'))) {
+ var url = getDeep(data, trumbowyg.o.plugins.upload.urlPropertyName.split('.'));
+ trumbowyg.execCmd('insertImage', url);
+ $('img[src="' + url + '"]:not([alt])', trumbowyg.$box).attr('alt', values.alt);
+ setTimeout(function () {
+ trumbowyg.closeModal();
+ }, 250);
+ trumbowyg.$c.trigger('tbwuploadsuccess', [trumbowyg, data, url]);
+ } else {
+ trumbowyg.addErrorOnModalField(
+ $('input[type=file]', $modal),
+ trumbowyg.lang[data.message]
+ );
+ trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg, data]);
+ }
}
},
+
error: trumbowyg.o.plugins.upload.error || function () {
trumbowyg.addErrorOnModalField(
$('input[type=file]', $modal),
diff --git a/dist/plugins/upload/trumbowyg.upload.min.js b/dist/plugins/upload/trumbowyg.upload.min.js
index 8053beeca..840d7a6f8 100644
--- a/dist/plugins/upload/trumbowyg.upload.min.js
+++ b/dist/plugins/upload/trumbowyg.upload.min.js
@@ -1 +1 @@
-!function(r){"use strict";function e(r,a){var o=a.shift(),t=a;if(null!==r){if(0===t.length)return r[o];if("object"==typeof r)return e(r[o],t)}return r}function a(){if(!r.trumbowyg&&!r.trumbowyg.addedXhrProgressEvent){var e=r.ajaxSettings.xhr;r.ajaxSetup({xhr:function(){var r=e(),a=this;return r&&"object"==typeof r.upload&&void 0!==a.progressUpload&&r.upload.addEventListener("progress",function(r){a.progressUpload(r)},!1),r}}),r.trumbowyg.addedXhrProgressEvent=!0}}var o={serverPath:"./src/plugins/upload/trumbowyg.upload.php",fileFieldName:"fileToUpload",data:[],headers:{},xhrFields:{},urlPropertyName:"file",statusPropertyName:"success",success:void 0,error:void 0};a(),r.extend(!0,r.trumbowyg,{langs:{en:{upload:"Upload",file:"File",uploadError:"Error"},sk:{upload:"Nahrať",file:"Súbor",uploadError:"Chyba"},fr:{upload:"Envoi",file:"Fichier",uploadError:"Erreur"},cs:{upload:"Nahrát obrázek",file:"Soubor",uploadError:"Chyba"},zh_cn:{upload:"上传",file:"文件",uploadError:"错误"}},plugins:{upload:{init:function(a){a.o.plugins.upload=r.extend(!0,{},o,a.o.plugins.upload||{});var t={fn:function(){a.saveRange();var o,t=a.o.prefix,l=a.openModalInsert(a.lang.upload,{file:{type:"file",required:!0},alt:{label:"description",value:a.getRangeText()}},function(u){var p=new FormData;p.append(a.o.plugins.upload.fileFieldName,o),a.o.plugins.upload.data.map(function(r){p.append(r.name,r.value)}),0===r("."+t+"progress",l).length&&r("."+t+"modal-title",l).after(r("
",{"class":t+"progress"}).append(r("",{"class":t+"progress-bar"}))),r.ajax({url:a.o.plugins.upload.serverPath,headers:a.o.plugins.upload.headers,xhrFields:a.o.plugins.upload.xhrFields,type:"POST",data:p,cache:!1,dataType:"json",processData:!1,contentType:!1,progressUpload:function(e){r("."+t+"progress-bar").stop().animate({width:Math.round(100*e.loaded/e.total)+"%"},200)},success:a.o.plugins.upload.success||function(o){if(e(o,a.o.plugins.upload.statusPropertyName.split("."))){var t=e(o,a.o.plugins.upload.urlPropertyName.split("."));a.execCmd("insertImage",t),r('img[src="'+t+'"]:not([alt])',a.$box).attr("alt",u.alt),setTimeout(function(){a.closeModal()},250),a.$c.trigger("tbwuploadsuccess",[a,o,t])}else a.addErrorOnModalField(r("input[type=file]",l),a.lang[o.message]),a.$c.trigger("tbwuploaderror",[a,o])},error:a.o.plugins.upload.error||function(){a.addErrorOnModalField(r("input[type=file]",l),a.lang.uploadError),a.$c.trigger("tbwuploaderror",[a])}})});r("input[type=file]").on("change",function(r){try{o=r.target.files[0]}catch(e){o=r.target.value}})}};a.addBtnDef("upload",t)}}}})}(jQuery);
\ No newline at end of file
+!function(e){"use strict";function r(e,a){var o=a.shift(),l=a;if(null!==e){if(0===l.length)return e[o];if("object"==typeof e)return r(e[o],l)}return e}function a(){if(!e.trumbowyg&&!e.trumbowyg.addedXhrProgressEvent){var r=e.ajaxSettings.xhr;e.ajaxSetup({xhr:function(){var e=r(),a=this;return e&&"object"==typeof e.upload&&void 0!==a.progressUpload&&e.upload.addEventListener("progress",function(e){a.progressUpload(e)},!1),e}}),e.trumbowyg.addedXhrProgressEvent=!0}}var o={serverPath:"./src/plugins/upload/trumbowyg.upload.php",fileFieldName:"fileToUpload",data:[],headers:{},xhrFields:{},urlPropertyName:"file",statusPropertyName:"success",success:void 0,error:void 0};a(),e.extend(!0,e.trumbowyg,{langs:{en:{upload:"Upload",file:"File",uploadError:"Error"},sk:{upload:"Nahrať",file:"Súbor",uploadError:"Chyba"},fr:{upload:"Envoi",file:"Fichier",uploadError:"Erreur"},cs:{upload:"Nahrát obrázek",file:"Soubor",uploadError:"Chyba"},zh_cn:{upload:"上传",file:"文件",uploadError:"错误"},ru:{upload:"Загрузка",file:"Файл",uploadError:"Ошибка"}},plugins:{upload:{init:function(a){a.o.plugins.upload=e.extend(!0,{},o,a.o.plugins.upload||{});var l={fn:function(){a.saveRange();var o,l=a.o.prefix,t=a.openModalInsert(a.lang.upload,{file:{type:"file",required:!0,attributes:{accept:"image/*"}},alt:{label:"description",value:a.getRangeText()}},function(u){var s=new FormData;s.append(a.o.plugins.upload.fileFieldName,o),a.o.plugins.upload.data.map(function(e){s.append(e.name,e.value)}),0===e("."+l+"progress",t).length&&e("."+l+"modal-title",t).after(e("",{"class":l+"progress"}).append(e("",{"class":l+"progress-bar"}))),e.ajax({url:a.o.plugins.upload.serverPath,headers:a.o.plugins.upload.headers,xhrFields:a.o.plugins.upload.xhrFields,type:"POST",data:s,cache:!1,dataType:"json",processData:!1,contentType:!1,progressUpload:function(r){e("."+l+"progress-bar").stop().animate({width:Math.round(100*r.loaded/r.total)+"%"},200)},success:function(o){if(a.o.plugins.upload.success)a.o.plugins.upload.success(o,a,t,u);else if(r(o,a.o.plugins.upload.statusPropertyName.split("."))){var l=r(o,a.o.plugins.upload.urlPropertyName.split("."));a.execCmd("insertImage",l),e('img[src="'+l+'"]:not([alt])',a.$box).attr("alt",u.alt),setTimeout(function(){a.closeModal()},250),a.$c.trigger("tbwuploadsuccess",[a,o,l])}else a.addErrorOnModalField(e("input[type=file]",t),a.lang[o.message]),a.$c.trigger("tbwuploaderror",[a,o])},error:a.o.plugins.upload.error||function(){a.addErrorOnModalField(e("input[type=file]",t),a.lang.uploadError),a.$c.trigger("tbwuploaderror",[a])}})});e("input[type=file]").on("change",function(e){try{o=e.target.files[0]}catch(r){o=e.target.value}})}};a.addBtnDef("upload",l)}}}})}(jQuery);
\ No newline at end of file
diff --git a/dist/trumbowyg.js b/dist/trumbowyg.js
index ae5b9069c..18485af96 100644
--- a/dist/trumbowyg.js
+++ b/dist/trumbowyg.js
@@ -1,5 +1,5 @@
/**
- * Trumbowyg v2.2.0 - A lightweight WYSIWYG editor
+ * Trumbowyg v2.3.0 - A lightweight WYSIWYG editor
* Trumbowyg core file
* ------------------------
* @link http://alex-d.github.io/Trumbowyg
@@ -261,10 +261,12 @@ jQuery.trumbowyg = {
},
bold: {
- key: 'B'
+ key: 'B',
+ tag: 'b'
},
italic: {
- key: 'I'
+ key: 'I',
+ tag: 'i'
},
underline: {
tag: 'u'
@@ -696,12 +698,13 @@ jQuery.trumbowyg = {
prefix = t.o.prefix,
btn = t.btnsDef[btnName],
isDropdown = btn.dropdown,
+ hasIcon = btn.hasIcon != null ? btn.hasIcon : true,
textDef = t.lang[btnName] || btnName,
$btn = $('', {
type: 'button',
- class: prefix + btnName + '-button ' + (btn.class || ''),
- html: t.hasSvg ? '' : '',
+ class: prefix + btnName + '-button ' + (btn.class || '') + (!hasIcon ? ' ' + prefix + 'textual-button' : ''),
+ html: t.hasSvg && hasIcon ? '' : (btn.text || btn.title || t.lang[btnName] || btnName),
title: (btn.title || btn.text || textDef) + ((btn.key) ? ' (Ctrl + ' + btn.key + ')' : ''),
tabindex: -1,
mousedown: function () {
@@ -750,7 +753,8 @@ jQuery.trumbowyg = {
buildSubBtn: function (btnName) {
var t = this,
prefix = t.o.prefix,
- btn = t.btnsDef[btnName];
+ btn = t.btnsDef[btnName],
+ hasIcon = btn.hasIcon != null ? btn.hasIcon : true;
if (btn.key) {
t.keys[btn.key] = {
@@ -764,7 +768,7 @@ jQuery.trumbowyg = {
return $('', {
type: 'button',
class: prefix + btnName + '-dropdown-button' + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
- html: t.hasSvg ? '' + (btn.text || btn.title || t.lang[btnName] || btnName) : '',
+ html: t.hasSvg && hasIcon ? '' + (btn.text || btn.title || t.lang[btnName] || btnName) : (btn.text || btn.title || t.lang[btnName] || btnName),
title: ((btn.key) ? ' (Ctrl + ' + btn.key + ')' : null),
style: btn.style || null,
mousedown: function () {
@@ -1349,9 +1353,14 @@ jQuery.trumbowyg = {
$.each(fields, function (fieldName, field) {
var l = field.label,
- n = field.name || fieldName;
+ n = field.name || fieldName,
+ a = field.attributes || {};
- html += '