This commit is contained in:
2026-03-20 17:13:38 +01:00
parent 4c84735b75
commit c043ee9a52
1152 changed files with 317560 additions and 0 deletions
@@ -0,0 +1,162 @@
/* ===========================================================
* trumbowyg.allowTagsFromPaste.js v1.0.2
* It cleans tags from pasted text, whilst allowing several specified tags
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Fathi Anshory (0x00000F5C)
* Twitter : @fscchannl
* Notes:
* - removeformatPasted must be set to FALSE since it was applied prior to pasteHandlers, or else it will be useless
* - It is most advisable to use along with the cleanpaste plugin, or else you'd end up with dirty markup
*/
(function ($) {
'use strict';
var defaultOptions = {
// When empty, all tags are allowed making this plugin useless
// If you want to remove all tags, use removeformatPasted core option instead
allowedTags: [],
// List of tags which can be allowed
removableTags: [
'a',
'abbr',
'address',
'b',
'bdi',
'bdo',
'blockquote',
'br',
'cite',
'code',
'del',
'dfn',
'details',
'em',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'hr',
'i',
'ins',
'kbd',
'mark',
'meter',
'pre',
'progress',
'q',
'rp',
'rt',
'ruby',
's',
'samp',
'small',
'span',
'strong',
'sub',
'summary',
'sup',
'time',
'u',
'var',
'wbr',
'img',
'map',
'area',
'canvas',
'figcaption',
'figure',
'picture',
'audio',
'source',
'track',
'video',
'ul',
'ol',
'li',
'dl',
'dt',
'dd',
'table',
'caption',
'th',
'tr',
'td',
'thead',
'tbody',
'tfoot',
'col',
'colgroup',
'style',
'div',
'p',
'form',
'input',
'textarea',
'button',
'select',
'optgroup',
'option',
'label',
'fieldset',
'legend',
'datalist',
'keygen',
'output',
'iframe',
'link',
'nav',
'header',
'hgroup',
'footer',
'main',
'section',
'article',
'aside',
'dialog',
'script',
'noscript',
'embed',
'object',
'param'
]
};
$.extend(true, $.trumbowyg, {
plugins: {
allowTagsFromPaste: {
init: function (trumbowyg) {
if (!trumbowyg.o.plugins.allowTagsFromPaste) {
return;
}
// Force disable remove format pasted
trumbowyg.o.removeformatPasted = false;
var allowedTags = trumbowyg.o.plugins.allowTagsFromPaste.allowedTags || defaultOptions.allowedTags;
var removableTags = trumbowyg.o.plugins.allowTagsFromPaste.removableTags || defaultOptions.removableTags;
if (allowedTags.length === 0) {
return;
}
// Get list of tags to remove
var tagsToRemove = $(removableTags).not(allowedTags).get();
trumbowyg.pasteHandlers.push(function () {
setTimeout(function () {
var processNodes = trumbowyg.$ed.html();
$.each(tagsToRemove, function (iterator, tagName) {
processNodes = processNodes.replace(new RegExp('<\\/?' + tagName + '(\\s[^>]*)?>', 'gi'), '');
});
trumbowyg.$ed.html(processNodes);
}, 0);
});
}
}
}
});
})(jQuery);
@@ -0,0 +1,165 @@
/* ===========================================================
* trumbowyg.base64.js v1.0
* Base64 plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Cyril Biencourt (lizardK)
*/
(function ($) {
'use strict';
var isSupported = function () {
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.',
errInvalidImage: 'Invalid image file.'
},
cs: {
base64: 'Vložit obrázek',
file: 'Soubor'
},
da: {
base64: 'Billede som base64',
file: 'Fil',
errFileReaderNotSupported: 'FileReader er ikke understøttet af din browser.',
errInvalidImage: 'Ugyldig billedfil.'
},
et: {
base64: 'Pilt base64 formaadis',
file: 'Fail',
errFileReaderNotSupported: 'Teie veebilehitseja ei toeta FileReader funktsiooni.',
errInvalidImage: 'Vigane pildifail.'
},
fr: {
base64: 'Image en base64',
file: 'Fichier'
},
hu: {
base64: 'Kép beszúrás inline',
file: 'Fájl',
errFileReaderNotSupported: 'Ez a böngésző nem támogatja a FileReader funkciót.',
errInvalidImage: 'Érvénytelen képfájl.'
},
ja: {
base64: '画像 (Base64形式)',
file: 'ファイル',
errFileReaderNotSupported: 'あなたのブラウザーはFileReaderをサポートしていません',
errInvalidImage: '画像形式が正しくありません'
},
ko: {
base64: '그림 넣기(base64)',
file: '파일',
errFileReaderNotSupported: 'FileReader가 현재 브라우저를 지원하지 않습니다.',
errInvalidImage: '유효하지 않은 파일'
},
nl: {
base64: 'Afbeelding inline',
file: 'Bestand',
errFileReaderNotSupported: 'Uw browser ondersteunt deze functionaliteit niet.',
errInvalidImage: 'De gekozen afbeelding is ongeldig.'
},
pt_br: {
base64: 'Imagem em base64',
file: 'Arquivo',
errFileReaderNotSupported: 'FileReader não é suportado pelo seu navegador.',
errInvalidImage: 'Arquivo de imagem inválido.'
},
ru: {
base64: 'Изображение как код в base64',
file: 'Файл',
errFileReaderNotSupported: 'FileReader не поддерживается вашим браузером.',
errInvalidImage: 'Недопустимый файл изображения.'
},
tr: {
base64: 'Base64 olarak resim',
file: 'Dosya',
errFileReaderNotSupported: 'FileReader tarayıcınız tarafından desteklenmiyor.',
errInvalidImage: 'Geçersiz resim dosyası.'
},
zh_cn: {
base64: '图片(Base64编码)',
file: '文件'
},
zh_tw: {
base64: '圖片(base64編碼)',
file: '檔案',
errFileReaderNotSupported: '你的瀏覽器不支援FileReader',
errInvalidImage: '不正確的檔案格式'
},
},
// jshint camelcase:true
plugins: {
base64: {
shouldInit: isSupported,
init: function (trumbowyg) {
var btnDef = {
isSupported: isSupported,
fn: function () {
trumbowyg.saveRange();
var file;
var $modal = trumbowyg.openModalInsert(
// Title
trumbowyg.lang.base64,
// Fields
{
file: {
type: 'file',
required: true,
attributes: {
accept: 'image/*'
}
},
alt: {
label: 'description',
value: trumbowyg.getRangeText()
}
},
// Callback
function (values) {
var fReader = new FileReader();
fReader.onloadend = function (e) {
if (isValidImage(e.target.result)) {
trumbowyg.execCmd('insertImage', fReader.result, false, true);
$(['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);
}
);
$('input[type=file]').on('change', function (e) {
file = e.target.files[0];
});
}
};
trumbowyg.addBtnDef('base64', btnDef);
}
}
}
});
})(jQuery);
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path d="M64 17v38H8V17h56m8-8H0v54h72V9z"/>
<path d="M29.9 28.9c-.5-.5-1.1-.8-1.8-.8s-1.4.2-1.9.7c-.5.4-.9 1-1.2 1.6-.3.6-.5 1.3-.6 2.1-.1.7-.2 1.4-.2 1.9l.1.1c.6-.8 1.2-1.4 2-1.8.8-.4 1.7-.5 2.7-.5.9 0 1.8.2 2.6.6.8.4 1.6.9 2.2 1.5.6.6 1 1.3 1.2 2.2.3.8.4 1.6.4 2.5 0 1.1-.2 2.1-.5 3-.3.9-.8 1.7-1.5 2.4-.6.7-1.4 1.2-2.3 1.6-.9.4-1.9.6-3 .6-1.6 0-2.8-.3-3.9-.9-1-.6-1.8-1.4-2.5-2.4-.6-1-1-2.1-1.3-3.4-.2-1.3-.4-2.6-.4-3.9 0-1.3.1-2.6.4-3.8.3-1.3.8-2.4 1.4-3.5.7-1 1.5-1.9 2.5-2.5 1-.6 2.3-1 3.8-1 .9 0 1.7.1 2.5.4.8.3 1.4.6 2 1.1.6.5 1.1 1.1 1.4 1.8.4.7.6 1.5.7 2.5h-4c0-1-.3-1.6-.8-2.1zm-3.5 6.8c-.4.2-.8.5-1 .8-.3.4-.5.8-.6 1.2-.1.5-.2 1-.2 1.5s.1.9.2 1.4c.1.5.4.9.6 1.2.3.4.6.7 1 .9.4.2.9.3 1.4.3.5 0 1-.1 1.3-.3.4-.2.7-.5 1-.9.3-.4.5-.8.6-1.2.1-.5.2-.9.2-1.4 0-.5-.1-1-.2-1.4-.1-.5-.3-.9-.6-1.2-.3-.4-.6-.7-1-.9-.4-.2-.9-.3-1.4-.3-.4 0-.9.1-1.3.3zM36.3 41.3v-3.8l9-12.1H49v12.4h2.7v3.5H49v4.8h-4v-4.8h-8.7zM45 30.7l-5.3 7.2h5.4l-.1-7.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1022 B

@@ -0,0 +1,147 @@
/* ===========================================================
* trumbowyg.cleanpaste.js v1.0
* Font Clean paste plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Authors : Eric Radin
* Todd Graham (slackwalker)
*
* This plugin will perform a "cleaning" on any paste, in particular
* it will clean pasted content of microsoft word document tags and classes.
*/
(function ($) {
'use strict';
function checkValidTags(snippet) {
var theString = snippet;
// Replace uppercase element names with lowercase
theString = theString.replace(/<[^> ]*/g, function (match) {
return match.toLowerCase();
});
// Replace uppercase attribute names with lowercase
theString = theString.replace(/<[^>]*>/g, function (match) {
match = match.replace(/ [^=]+=/g, function (match2) {
return match2.toLowerCase();
});
return match;
});
// Put quotes around unquoted attributes
theString = theString.replace(/<[^>]*>/g, function (match) {
match = match.replace(/( [^=]+=)([^"][^ >]*)/g, '$1\"$2\"');
return match;
});
return theString;
}
function cleanIt(html) {
// first make sure all tags and attributes are made valid
html = checkValidTags(html);
// Replace opening bold tags with strong
html = html.replace(/<b(\s+|>)/g, '<strong$1');
// Replace closing bold tags with closing strong
html = html.replace(/<\/b(\s+|>)/g, '</strong$1');
// Replace italic tags with em
html = html.replace(/<i(\s+|>)/g, '<em$1');
// Replace closing italic tags with closing em
html = html.replace(/<\/i(\s+|>)/g, '</em$1');
// strip out comments -cgCraft
html = html.replace(/<!(?:--[\s\S]*?--\s*)?>\s*/g, '');
// strip out &nbsp; -cgCraft
html = html.replace(/&nbsp;/gi, ' ');
// strip out extra spaces -cgCraft
html = html.replace(/ <\//gi, '</');
// Remove multiple spaces
html.replace(/\s+/g, ' ');
// strip &nbsp; -cgCraft
html = html.replace(/^\s*|\s*$/g, '');
// Strip out unaccepted attributes
html = html.replace(/<[^>]*>/g, function (match) {
match = match.replace(/ ([^=]+)="[^"]*"/g, function (match2, attributeName) {
if (['alt', 'href', 'src', 'title'].indexOf(attributeName) !== -1) {
return match2;
}
return '';
});
return match;
});
// Final clean out for MS Word crud
html = html.replace(/<\?xml[^>]*>/g, '');
html = html.replace(/<[^ >]+:[^>]*>/g, '');
html = html.replace(/<\/[^ >]+:[^>]*>/g, '');
// remove unwanted tags
html = html.replace(/<(div|span|style|meta|link).*?>/gi, '');
return html;
}
// clean editor
// this will clean the inserted contents
// it does a compare, before and after paste to determine the
// pasted contents
$.extend(true, $.trumbowyg, {
plugins: {
cleanPaste: {
init: function (trumbowyg) {
trumbowyg.pasteHandlers.push(function (pasteEvent) {
setTimeout(function () {
try {
trumbowyg.saveRange();
var clipboardData = (pasteEvent.originalEvent || pasteEvent).clipboardData,
pastedData = clipboardData.getData('Text'),
node = trumbowyg.doc.getSelection().focusNode,
range = trumbowyg.doc.createRange(),
cleanedPaste = cleanIt(pastedData.trim()),
newNode = $(cleanedPaste)[0] || trumbowyg.doc.createTextNode(cleanedPaste);
if (trumbowyg.$ed.html() === '') {
// simply append if there is no content in editor
trumbowyg.$ed[0].appendChild(newNode);
} else {
// insert pasted content behind last focused node
range.setStartAfter(node);
range.setEndAfter(node);
trumbowyg.doc.getSelection().removeAllRanges();
trumbowyg.doc.getSelection().addRange(range);
trumbowyg.range.insertNode(newNode);
}
// now set cursor right after pasted content
range = trumbowyg.doc.createRange();
range.setStartAfter(newNode);
range.setEndAfter(newNode);
trumbowyg.doc.getSelection().removeAllRanges();
trumbowyg.doc.getSelection().addRange(range);
// prevent defaults
pasteEvent.stopPropagation();
pasteEvent.preventDefault();
// save new node as focused node
trumbowyg.saveRange();
trumbowyg.syncCode();
trumbowyg.$c.trigger('tbwchange');
} catch (c) {
}
}, 0);
});
}
}
}
});
})(jQuery);
@@ -0,0 +1,264 @@
/* ===========================================================
* trumbowyg.colors.js v1.2
* Colors picker plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Alexandre Demode (Alex-D)
* Twitter : @AlexandreDemode
* Website : alex-d.fr
*/
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
foreColor: 'Text color',
backColor: 'Background color',
foreColorRemove: 'Remove text color',
backColorRemove: 'Remove background color'
},
cs: {
foreColor: 'Barva textu',
backColor: 'Barva pozadí'
},
da: {
foreColor: 'Tekstfarve',
backColor: 'Baggrundsfarve'
},
de: {
foreColor: 'Textfarbe',
backColor: 'Hintergrundfarbe'
},
et: {
foreColor: 'Teksti värv',
backColor: 'Taustavärv',
foreColorRemove: 'Eemalda teksti värv',
backColorRemove: 'Eemalda taustavärv'
},
fr: {
foreColor: 'Couleur du texte',
backColor: 'Couleur de fond',
foreColorRemove: 'Supprimer la couleur du texte',
backColorRemove: 'Supprimer la couleur de fond'
},
hu: {
foreColor: 'Betű szín',
backColor: 'Háttér szín',
foreColorRemove: 'Betű szín eltávolítása',
backColorRemove: 'Háttér szín eltávolítása'
},
ja: {
foreColor: '文字色',
backColor: '背景色'
},
ko: {
foreColor: '글자색',
backColor: '배경색',
foreColorRemove: '글자색 지우기',
backColorRemove: '배경색 지우기'
},
nl: {
foreColor: 'Tekstkleur',
backColor: 'Achtergrondkleur'
},
pt_br: {
foreColor: 'Cor de fonte',
backColor: 'Cor de fundo'
},
ru: {
foreColor: 'Цвет текста',
backColor: 'Цвет выделения текста'
},
sk: {
foreColor: 'Farba textu',
backColor: 'Farba pozadia'
},
tr: {
foreColor: 'Yazı rengi',
backColor: 'Arka plan rengi',
foreColorRemove: 'Yazı rengini kaldır',
backColorRemove: 'Arka plan rengini kaldır'
},
zh_cn: {
foreColor: '文字颜色',
backColor: '背景颜色'
},
zh_tw: {
foreColor: '文字顏色',
backColor: '背景顏色'
},
}
});
// jshint camelcase:true
function hex(x) {
return ('0' + parseInt(x).toString(16)).slice(-2);
}
function colorToHex(rgb) {
if (rgb.search('rgb') === -1) {
return rgb.replace('#', '');
} else if (rgb === 'rgba(0, 0, 0, 0)') {
return 'transparent';
} else {
rgb = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d?(.\d+)))?\)$/);
return hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}
}
function colorTagHandler(element, trumbowyg) {
var tags = [];
if (!element.style) {
return tags;
}
// background color
if (element.style.backgroundColor !== '') {
var backColor = colorToHex(element.style.backgroundColor);
if (trumbowyg.o.plugins.colors.colorList.indexOf(backColor) >= 0) {
tags.push('backColor' + backColor);
} else {
tags.push('backColorFree');
}
}
// text color
var foreColor;
if (element.style.color !== '') {
foreColor = colorToHex(element.style.color);
} else if (element.hasAttribute('color')) {
foreColor = colorToHex(element.getAttribute('color'));
}
if (foreColor) {
if (trumbowyg.o.plugins.colors.colorList.indexOf(foreColor) >= 0) {
tags.push('foreColor' + foreColor);
} else {
tags.push('foreColorFree');
}
}
return tags;
}
var defaultOptions = {
colorList: [
'ffffff', '000000', 'eeece1', '1f497d', '4f81bd', 'c0504d', '9bbb59', '8064a2', '4bacc6', 'f79646', 'ffff00',
'f2f2f2', '7f7f7f', 'ddd9c3', 'c6d9f0', 'dbe5f1', 'f2dcdb', 'ebf1dd', 'e5e0ec', 'dbeef3', 'fdeada', 'fff2ca',
'd8d8d8', '595959', 'c4bd97', '8db3e2', 'b8cce4', 'e5b9b7', 'd7e3bc', 'ccc1d9', 'b7dde8', 'fbd5b5', 'ffe694',
'bfbfbf', '3f3f3f', '938953', '548dd4', '95b3d7', 'd99694', 'c3d69b', 'b2a2c7', 'b7dde8', 'fac08f', 'f2c314',
'a5a5a5', '262626', '494429', '17365d', '366092', '953734', '76923c', '5f497a', '92cddc', 'e36c09', 'c09100',
'7f7f7f', '0c0c0c', '1d1b10', '0f243e', '244061', '632423', '4f6128', '3f3151', '31859b', '974806', '7f6000'
],
foreColorList: null, // fallbacks on colorList
backColorList: null, // fallbacks on colorList
allowCustomForeColor: true,
allowCustomBackColor: true,
displayAsList: false,
};
// Add all colors in two dropdowns
$.extend(true, $.trumbowyg, {
plugins: {
color: {
init: function (trumbowyg) {
trumbowyg.o.plugins.colors = trumbowyg.o.plugins.colors || defaultOptions;
var dropdownClass = trumbowyg.o.plugins.colors.displayAsList ? trumbowyg.o.prefix + 'dropdown--color-list' : '';
var foreColorBtnDef = {
dropdown: buildDropdown('foreColor', trumbowyg),
dropdownClass: dropdownClass,
},
backColorBtnDef = {
dropdown: buildDropdown('backColor', trumbowyg),
dropdownClass: dropdownClass,
};
trumbowyg.addBtnDef('foreColor', foreColorBtnDef);
trumbowyg.addBtnDef('backColor', backColorBtnDef);
},
tagHandler: colorTagHandler
}
}
});
function buildDropdown(fn, trumbowyg) {
var dropdown = [],
trumbowygColorOptions = trumbowyg.o.plugins.colors,
colorList = trumbowygColorOptions[fn + 'List'] || trumbowygColorOptions.colorList;
$.each(colorList, function (i, color) {
var btn = fn + color,
btnDef = {
fn: fn,
forceCss: true,
hasIcon: false,
text: trumbowyg.lang['#' + color] || ('#' + color),
param: '#' + color,
style: 'background-color: #' + color + ';'
};
if (trumbowygColorOptions.displayAsList && fn === 'foreColor') {
btnDef.style = 'color: #' + color + ' !important;';
}
trumbowyg.addBtnDef(btn, btnDef);
dropdown.push(btn);
});
// Remove color
var removeColorButtonName = fn + 'Remove',
removeColorBtnDef = {
fn: 'removeFormat',
hasIcon: false,
param: fn,
style: 'background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAG0lEQVQIW2NkQAAfEJMRmwBYhoGBYQtMBYoAADziAp0jtJTgAAAAAElFTkSuQmCC);'
};
if (trumbowygColorOptions.displayAsList) {
removeColorBtnDef.style = '';
}
trumbowyg.addBtnDef(removeColorButtonName, removeColorBtnDef);
dropdown.push(removeColorButtonName);
// Custom color
if (trumbowygColorOptions['allowCustom' + fn.charAt(0).toUpperCase() + fn.substr(1)]) {
// add free color btn
var freeColorButtonName = fn + 'Free',
freeColorBtnDef = {
fn: function () {
trumbowyg.openModalInsert(trumbowyg.lang[fn],
{
color: {
label: fn,
forceCss: true,
type: 'color',
value: '#FFFFFF'
}
},
// callback
function (values) {
trumbowyg.execCmd(fn, values.color);
return true;
}
);
},
hasIcon: false,
text: '#',
// style adjust for displaying the text
style: 'text-indent: 0; line-height: 20px; padding: 0 5px;'
};
trumbowyg.addBtnDef(freeColorButtonName, freeColorBtnDef);
dropdown.push(freeColorButtonName);
}
return dropdown;
}
})(jQuery);
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path d="M36.5 22.3l-6.3 18.1H43l-6.3-18.1z"/>
<path d="M9 8.9v54.2h54.1V8.9H9zm39.9 48.2L45 46H28.2l-3.9 11.1h-7.6L32.8 15h7.8l16.2 42.1h-7.9z"/>
</svg>

After

Width:  |  Height:  |  Size: 217 B

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path d="M32 15h7.8L56 57.1h-7.9l-4-11.1H27.4l-4 11.1h-7.6L32 15zm-2.5 25.4h12.9L36 22.3h-.2l-6.3 18.1z"/>
</svg>

After

Width:  |  Height:  |  Size: 176 B

@@ -0,0 +1,57 @@
.trumbowyg-dropdown-foreColor:not(.trumbowyg-dropdown--color-list),
.trumbowyg-dropdown-backColor:not(.trumbowyg-dropdown--color-list) {
max-width: 276px;
padding: 7px 5px;
overflow: initial;
button {
display: block;
position: relative;
float: left;
text-indent: -9999px;
height: 20px;
width: 20px;
border: 1px solid #333;
padding: 0;
margin: 2px;
&:hover,
&:focus {
&::after {
content: " ";
display: block;
position: absolute;
top: -5px;
left: -5px;
width: 27px;
height: 27px;
background: inherit;
border: 1px solid #fff;
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;
&:hover,
&:focus {
&::after {
content: " ";
display: block;
position: absolute;
top: 13px;
left: 0;
width: 0;
height: 0;
border: 5px solid transparent;
border-left-color: #fff;
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path d="M36.05 9C21.09 9 8.949 21.141 8.949 36.101c0 14.96 12.141 27.101 27.101 27.101 14.96 0 27.101-12.141 27.101-27.101S51.01 9 36.05 9zm9.757 15.095c2.651 0 4.418 1.767 4.418 4.418s-1.767 4.418-4.418 4.418-4.418-1.767-4.418-4.418 1.767-4.418 4.418-4.418zm-19.479 0c2.651 0 4.418 1.767 4.418 4.418s-1.767 4.418-4.418 4.418-4.418-1.767-4.418-4.418 1.767-4.418 4.418-4.418zm9.722 30.436c-14.093 0-16.261-13.009-16.261-13.009h32.522S50.143 54.531 36.05 54.531z"/>
</svg>

After

Width:  |  Height:  |  Size: 537 B

@@ -0,0 +1,42 @@
.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;
&:hover,
&:focus {
&::after {
display: block;
position: absolute;
top: -5px;
left: -5px;
height: 27px;
width: 27px;
background: inherit;
box-shadow: #000 0 0 2px;
z-index: 10;
background-color: transparent;
}
}
}
.trumbowyg .emoji {
width: 22px;
height: 22px;
display: inline-block;
}
@@ -0,0 +1,101 @@
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
fontFamily: 'Font'
},
es: {
fontFamily: 'Fuente'
},
da: {
fontFamily: 'Skrifttype'
},
de: {
fontFamily: 'Schriftart'
},
et: {
fontFamily: 'Font'
},
fr: {
fontFamily: 'Police'
},
hu: {
fontFamily: 'Betűtípus'
},
ko: {
fontFamily: '글꼴'
},
nl: {
fontFamily: 'Lettertype'
},
pt_br: {
fontFamily: 'Fonte',
},
tr: {
fontFamily: 'Yazı tipi'
},
zh_tw: {
fontFamily: '字體',
},
}
});
// jshint camelcase:true
var defaultOptions = {
fontList: [
{name: 'Arial', family: 'Arial, Helvetica, sans-serif'},
{name: 'Arial Black', family: 'Arial Black, Gadget, sans-serif'},
{name: 'Comic Sans', family: 'Comic Sans MS, Textile, cursive, sans-serif'},
{name: 'Courier New', family: 'Courier New, Courier, monospace'},
{name: 'Georgia', family: 'Georgia, serif'},
{name: 'Impact', family: 'Impact, Charcoal, sans-serif'},
{name: 'Lucida Console', family: 'Lucida Console, Monaco, monospace'},
{name: 'Lucida Sans', family: 'Lucida Sans Uncide, Lucida Grande, sans-serif'},
{name: 'Palatino', family: 'Palatino Linotype, Book Antiqua, Palatino, serif'},
{name: 'Tahoma', family: 'Tahoma, Geneva, sans-serif'},
{name: 'Times New Roman', family: 'Times New Roman, Times, serif'},
{name: 'Trebuchet', family: 'Trebuchet MS, Helvetica, sans-serif'},
{name: 'Verdana', family: 'Verdana, Geneva, sans-serif'}
]
};
// Add dropdown with web safe fonts
$.extend(true, $.trumbowyg, {
plugins: {
fontfamily: {
init: function (trumbowyg) {
trumbowyg.o.plugins.fontfamily = $.extend({},
defaultOptions,
trumbowyg.o.plugins.fontfamily || {}
);
trumbowyg.addBtnDef('fontfamily', {
dropdown: buildDropdown(trumbowyg),
hasIcon: false,
text: trumbowyg.lang.fontFamily
});
}
}
}
});
function buildDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.fontfamily.fontList, function (index, font) {
trumbowyg.addBtnDef('fontfamily_' + index, {
title: '<span style="font-family: ' + font.family + ';">' + font.name + '</span>',
hasIcon: false,
fn: function () {
trumbowyg.execCmd('fontName', font.family, true);
}
});
dropdown.push('fontfamily_' + index);
});
return dropdown;
}
})(jQuery);
@@ -0,0 +1,301 @@
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
fontsize: 'Font size',
fontsizes: {
'x-small': 'Extra small',
'small': 'Small',
'medium': 'Regular',
'large': 'Large',
'x-large': 'Extra large',
'custom': 'Custom'
},
fontCustomSize: {
title: 'Custom Font Size',
label: 'Font Size',
value: '48px'
}
},
da: {
fontsize: 'Skriftstørrelse',
fontsizes: {
'x-small': 'Ekstra lille',
'small': 'Lille',
'medium': 'Normal',
'large': 'Stor',
'x-large': 'Ekstra stor',
'custom': 'Brugerdefineret'
}
},
de: {
fontsize: 'Schriftgröße',
fontsizes: {
'x-small': 'Sehr klein',
'small': 'Klein',
'medium': 'Normal',
'large': 'Groß',
'x-large': 'Sehr groß',
'custom': 'Benutzerdefiniert'
},
fontCustomSize: {
title: 'Benutzerdefinierte Schriftgröße',
label: 'Schriftgröße',
value: '48px'
}
},
es: {
fontsize: 'Tamaño de Fuente',
fontsizes: {
'x-small': 'Extra pequeña',
'small': 'Pegueña',
'medium': 'Regular',
'large': 'Grande',
'x-large': 'Extra Grande',
'custom': 'Customizada'
},
fontCustomSize: {
title: 'Tamaño de Fuente Customizada',
label: 'Tamaño de Fuente',
value: '48px'
}
},
et: {
fontsize: 'Teksti suurus',
fontsizes: {
'x-small': 'Väga väike',
'small': 'Väike',
'medium': 'Tavaline',
'large': 'Suur',
'x-large': 'Väga suur',
'custom': 'Määra ise'
},
fontCustomSize: {
title: 'Kohandatud teksti suurus',
label: 'Teksti suurus',
value: '48px'
}
},
fr: {
fontsize: 'Taille de la police',
fontsizes: {
'x-small': 'Très petit',
'small': 'Petit',
'medium': 'Normal',
'large': 'Grand',
'x-large': 'Très grand',
'custom': 'Taille personnalisée'
},
fontCustomSize: {
title: 'Taille de police personnalisée',
label: 'Taille de la police',
value: '48px'
}
},
hu: {
fontsize: 'Betű méret',
fontsizes: {
'x-small': 'Extra kicsi',
'small': 'Kicsi',
'medium': 'Normális',
'large': 'Nagy',
'x-large': 'Extra nagy',
'custom': 'Egyedi'
},
fontCustomSize: {
title: 'Egyedi betű méret',
label: 'Betű méret',
value: '48px'
}
},
it: {
fontsize: 'Dimensioni del testo',
fontsizes: {
'x-small': 'Molto piccolo',
'small': 'piccolo',
'regular': 'normale',
'large': 'grande',
'x-large': 'Molto grande',
'custom': 'Personalizzato'
},
fontCustomSize: {
title: 'Dimensioni del testo personalizzato',
label: 'Dimensioni del testo',
value: '48px'
}
},
ko: {
fontsize: '글꼴 크기',
fontsizes: {
'x-small': '아주 작게',
'small': '작게',
'medium': '보통',
'large': '크게',
'x-large': '아주 크게',
'custom': '사용자 지정'
},
fontCustomSize: {
title: '사용자 지정 글꼴 크기',
label: '글꼴 크기',
value: '48px'
}
},
nl: {
fontsize: 'Lettergrootte',
fontsizes: {
'x-small': 'Extra klein',
'small': 'Klein',
'medium': 'Normaal',
'large': 'Groot',
'x-large': 'Extra groot',
'custom': 'Tilpasset'
}
},
pt_br: {
fontsize: 'Tamanho da fonte',
fontsizes: {
'x-small': 'Extra pequeno',
'small': 'Pequeno',
'regular': 'Médio',
'large': 'Grande',
'x-large': 'Extra grande',
'custom': 'Personalizado'
},
fontCustomSize: {
title: 'Tamanho de Fonte Personalizado',
label: 'Tamanho de Fonte',
value: '48px'
}
},
tr: {
fontsize: 'Yazı boyutu',
fontsizes: {
'x-small': 'Çok küçük',
'small': 'Küçük',
'medium': 'Normal',
'large': 'Büyük',
'x-large': 'Çok büyük',
'custom': 'Özel'
},
fontCustomSize: {
title: 'Özel Yazı Boyutu',
label: 'Yazı Boyutu',
value: '48px'
}
},
zh_tw: {
fontsize: '字體大小',
fontsizes: {
'x-small': '最小',
'small': '小',
'medium': '中',
'large': '大',
'x-large': '最大',
'custom': '自訂大小',
},
fontCustomSize: {
title: '自訂義字體大小',
label: '字體大小',
value: '48px'
}
},
}
});
// jshint camelcase:true
var defaultOptions = {
sizeList: [
'x-small',
'small',
'medium',
'large',
'x-large'
],
allowCustomSize: true
};
// Add dropdown with font sizes
$.extend(true, $.trumbowyg, {
plugins: {
fontsize: {
init: function (trumbowyg) {
trumbowyg.o.plugins.fontsize = $.extend({},
defaultOptions,
trumbowyg.o.plugins.fontsize || {}
);
trumbowyg.addBtnDef('fontsize', {
dropdown: buildDropdown(trumbowyg)
});
}
}
}
});
function setFontSize(trumbowyg, size) {
trumbowyg.$ed.focus();
trumbowyg.saveRange();
// Temporary size
trumbowyg.execCmd('fontSize', '1');
// Find <font> elements that were added and change to <span> with chosen size
trumbowyg.$ed.find('font[size="1"]').replaceWith(function() {
return $('<span/>', {
css: { 'font-size': size },
html: this.innerHTML,
});
});
// Remove and leftover <span> elements
$(trumbowyg.range.startContainer.parentElement).find('span[style=""]').contents().unwrap();
trumbowyg.restoreRange();
trumbowyg.syncCode();
trumbowyg.$c.trigger('tbwchange');
}
function buildDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.fontsize.sizeList, function (index, size) {
trumbowyg.addBtnDef('fontsize_' + size, {
text: '<span style="font-size: ' + size + ';">' + (trumbowyg.lang.fontsizes[size] || size) + '</span>',
hasIcon: false,
fn: function () {
setFontSize(trumbowyg, size);
}
});
dropdown.push('fontsize_' + size);
});
if (trumbowyg.o.plugins.fontsize.allowCustomSize) {
var customSizeButtonName = 'fontsize_custom';
var customSizeBtnDef = {
fn: function () {
trumbowyg.openModalInsert(trumbowyg.lang.fontCustomSize.title,
{
size: {
label: trumbowyg.lang.fontCustomSize.label,
value: trumbowyg.lang.fontCustomSize.value
}
},
function (form) {
setFontSize(trumbowyg, form.size);
return true;
}
);
},
text: '<span style="font-size: medium;">' + trumbowyg.lang.fontsizes.custom + '</span>',
hasIcon: false
};
trumbowyg.addBtnDef(customSizeButtonName, customSizeBtnDef);
dropdown.push(customSizeButtonName);
}
return dropdown;
}
})(jQuery);
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3V9H3v3z"/>
</svg>

After

Width:  |  Height:  |  Size: 130 B

@@ -0,0 +1,191 @@
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
giphy: 'Insert GIF',
},
et: {
giphy: 'Sisesta GIF',
},
fr: {
giphy: 'Insérer un GIF',
},
hu: {
giphy: 'GIF beszúrás',
},
tr: {
giphy: 'GIF ekle',
},
// jshint camelcase:true
}
});
var giphyLogo = '<svg viewBox="0 0 231 53" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="2"><path d="M48.32 22.386c0-1.388-.252-1.892-1.767-1.85-3.448.126-6.855.042-10.303.042H25.443c-.927 0-1.346.211-1.305 1.22.085 2.86.085 5.72.043 8.58 0 .883.252 1.169 1.169 1.135 2.018-.084 3.995-.042 6.014 0 1.64 0 4.164-.546 4.752.252.841 1.169.421 3.364.337 5.089-.043.547-.547 1.304-1.094 1.598-2.692 1.556-5.678 2.018-8.747 1.892-5.342-.21-9.336-2.439-11.481-7.527-1.388-3.364-1.725-6.855-1.01-10.43 1.01-4.963 3.407-8.747 8.58-10.051 5.215-1.305 10.136-.547 14.467 2.817 1.219.967 1.798.715 2.691-.294 1.514-1.724 3.154-3.322 4.753-4.963 1.892-1.933 1.892-1.892-.169-3.7C38.429.813 31.238-.617 23.5.224 12.818 1.393 5.248 6.658 1.59 17.045-.177 22.008-.428 27.097.623 32.227c1.682 7.914 5.551 14.12 13.289 17.368 6.898 2.901 14.046 3.448 21.321 1.598 4.331-1.093 8.411-2.608 11.354-6.223 1.136-1.388 1.725-2.902 1.682-4.71l.043-17.873.008-.001zm125.153 3.784l.042-23.046c0-1.136-.168-1.598-1.472-1.556a238.02 238.02 0 0 1-11.017 0c-1.136-.042-1.439.337-1.439 1.439v15.645c0 1.345-.421 1.556-1.641 1.556a422.563 422.563 0 0 0-14.593 0c-1.262.042-1.472-.421-1.439-1.556l.043-15.813c0-.926-.169-1.304-1.17-1.262h-11.513c-.927 0-1.304.169-1.304 1.22v46.764c0 .967.252 1.262 1.219 1.262h11.512c1.169.042 1.262-.462 1.262-1.388l-.042-15.644c0-1.053.251-1.346 1.304-1.346h15.14c1.22 0 1.388.421 1.388 1.472l-.042 15.477c0 1.093.21 1.472 1.388 1.439 3.615-.085 7.233-.085 10.807 0 1.304.042 1.598-.337 1.598-1.598l-.042-23.047.011-.018zM106.565 1.654c-8.369-.211-16.728-.126-25.065-.211-1.346 0-1.767.337-1.767 1.724l.043 23.004v23.215c0 1.009.168 1.439 1.304 1.387a271.22 271.22 0 0 1 11.691 0c1.094 0 1.346-.336 1.346-1.345l-.042-10.64c0-1.052.294-1.345 1.345-1.345 3.322.042 6.645.085 9.967-.085 4.407-.21 8.621-1.219 12.111-4.12 5.551-4.584 7.613-12.701 5.131-20.061-2.313-6.561-8.747-11.354-16.064-11.522v-.001zm-3.028 24.013c-2.818.042-5.594-.043-8.411.042-1.169.042-1.439-.378-1.345-1.439.084-1.556 0-3.069 0-4.626v-5.131c-.043-.841.251-1.094 1.052-1.052 2.986.042 5.929-.085 8.915.042 3.616.126 5.887 2.692 5.846 6.266-.126 3.658-2.313 5.846-6.055 5.887l-.002.011zM229.699 1.569c-4.458 0-8.915-.042-13.415.043-.629 0-1.472.503-1.85 1.052a505.695 505.695 0 0 0-8.957 14.214c-.884 1.472-1.22 1.169-1.977-.084l-8.496-14.089c-.503-.841-1.052-1.136-2.018-1.136l-13.078.043c-.462 0-.967.125-1.439.21.21.378.378.799.629 1.169l17.412 27.167c.462.715.715 1.682.757 2.524v16.653c0 1.052.168 1.514 1.388 1.472 3.784-.084 7.57-.084 11.354 0 1.136.043 1.304-.377 1.304-1.387l-.042-8.58c0-2.734-.084-5.51.042-8.243.043-.926.337-1.933.841-2.649l18.167-27.041c.252-.337.337-.758.547-1.17a3.636 3.636 0 0 0-1.169-.168zM70.104 2.661c0-1.009-.294-1.219-1.262-1.219H57.69c-1.262-.043-1.472.377-1.472 1.513l.042 23.004v23.34c0 1.053.126 1.514 1.346 1.473 3.7-.085 7.444-.043 11.152 0 .966 0 1.387-.085 1.387-1.262l-.042-46.857.001.008z" fill="currentColor" fill-rule="nonzero"/></svg>'; // jshint ignore:line
var CANCEL_EVENT = 'tbwcancel';
// Throttle helper
function trumbowygThrottle(callback, delay) {
var last;
var timer;
return function () {
var context = this;
var now = +new Date();
var args = arguments;
if (last && now < last + delay) {
clearTimeout(timer);
timer = setTimeout(function () {
last = now;
callback.apply(context, args);
}, delay);
} else {
last = now;
callback.apply(context, args);
}
};
}
// Fills modal with response gifs
function renderGifs(response, $giphyModal, trumbowyg, mustEmpty) {
var width = ($giphyModal.width() - 20) / 3;
var html = response.data
.filter(function (gifData) {
return gifData.images.downsized.url !== '';
})
.map(function (gifData) {
var image = gifData.images.downsized,
imageRatio = image.height / image.width;
return '<div class="img-container"><img src=' + image.url + ' width="' + width + '" height="' + imageRatio * width + '" loading="lazy" onload="this.classList.add(\'tbw-loaded\')"/></div>';
})
.join('')
;
if (mustEmpty === true) {
if (html.length === 0) {
if ($('.' + trumbowyg.o.prefix + 'giphy-no-result', $giphyModal).length > 0) {
return;
}
html = '<img class="' + trumbowyg.o.prefix + 'giphy-no-result" src="' + trumbowyg.o.plugins.giphy.noResultGifUrl + '"/>';
}
$giphyModal.empty();
}
$giphyModal.append(html);
$('img', $giphyModal).on('click', function () {
trumbowyg.restoreRange();
trumbowyg.execCmd('insertImage', $(this).attr('src'), false, true);
$('img', $giphyModal).off();
trumbowyg.closeModal();
});
}
var defaultOptions = {
rating: 'g',
apiKey: null,
throttleDelay: 300,
noResultGifUrl: 'https://media.giphy.com/media/2Faz9FbRzmwxY0pZS/giphy.gif'
};
// Add dropdown with font sizes
$.extend(true, $.trumbowyg, {
plugins: {
giphy: {
init: function (trumbowyg) {
trumbowyg.o.plugins.giphy = $.extend({},
defaultOptions,
trumbowyg.o.plugins.giphy || {}
);
trumbowyg.addBtnDef('giphy', {
fn: function() {
if (trumbowyg.o.plugins.giphy.apiKey === null) {
throw new Error('You must set a Giphy API Key');
}
var BASE_URL = 'https://api.giphy.com/v1/gifs/search?api_key=' + trumbowyg.o.plugins.giphy.apiKey + '&rating=' + trumbowyg.o.plugins.giphy.rating,
DEFAULT_URL = BASE_URL.replace('/search', '/trending');
var previousAjaxCall = {abort: function () {}};
var prefix = trumbowyg.o.prefix;
// Create and open the modal
var searchInput = '<input name="" class="' + prefix + 'giphy-search" placeholder="Search a GIF" autofocus="autofocus">',
closeButton = '<button class="' + prefix + 'giphy-close" title="' + trumbowyg.lang.close + '"><svg><use xlink:href="' + trumbowyg.svgPath + '#' + prefix + 'close"/></svg></button>',
poweredByGiphy = '<div class="' + prefix + 'powered-by-giphy"><span>Powered by</span>' + giphyLogo + '</div>',
giphyModalHtml = searchInput + closeButton + poweredByGiphy + '<div class="' + prefix + 'giphy-modal-scroll"><div class="' + prefix + 'giphy-modal"></div></div>';
trumbowyg
.openModal(null, giphyModalHtml, false)
.one(CANCEL_EVENT, function () {
try {
previousAjaxCall.abort();
} catch (e) {}
trumbowyg.closeModal();
});
var $giphyInput = $('.' + prefix + 'giphy-search'),
$giphyClose = $('.' + prefix + 'giphy-close'),
$giphyModal = $('.' + prefix + 'giphy-modal');
var ajaxError = function () {
if (!navigator.onLine && !$('.' + prefix + 'giphy-offline', $giphyModal).length) {
$giphyModal.empty();
$giphyModal.append('<p class="' + prefix + 'giphy-offline">You are offline</p>');
}
};
// Load trending gifs as default
$.ajax({
url: DEFAULT_URL,
dataType: 'json',
success: function(response) {
renderGifs(response, $giphyModal, trumbowyg, true);
},
error: ajaxError
});
var searchGifsOnInput = function () {
var query = $giphyInput.val();
if (query.length === 0) {
return;
}
try {
previousAjaxCall.abort();
} catch (e) {}
previousAjaxCall = $.ajax({
url: BASE_URL + '&q=' + encodeURIComponent(query),
dataType: 'json',
success: function(response) {
renderGifs(response, $giphyModal, trumbowyg, true);
},
error: ajaxError
});
};
var throttledInputRequest = trumbowygThrottle(searchGifsOnInput, trumbowyg.o.plugins.giphy.throttleDelay);
$giphyInput.on('input', throttledInputRequest);
$giphyInput.focus();
$giphyClose.one('click', function() {
$giphyModal.trigger(CANCEL_EVENT);
});
},
});
}
}
}
});
})(jQuery);
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path d="M15.676 40.149v-5.282h13.645v12.489c-1.326 1.283-3.248 2.413-5.764 3.39-2.516.977-5.065 1.465-7.646 1.465-3.279 0-6.137-.688-8.575-2.064-2.439-1.376-4.271-3.343-5.497-5.903C.613 41.685 0 38.901 0 35.893c0-3.265.684-6.166 2.053-8.704 1.369-2.538 3.372-4.484 6.01-5.839 2.01-1.04 4.512-1.561 7.506-1.561 3.893 0 6.933.816 9.122 2.449 2.188 1.632 3.596 3.889 4.223 6.769l-6.287 1.176c-.442-1.54-1.273-2.755-2.492-3.646-1.219-.892-2.741-1.337-4.566-1.337-2.766 0-4.965.877-6.597 2.63-1.633 1.754-2.449 4.356-2.449 7.806 0 3.722.827 6.513 2.481 8.373 1.654 1.861 3.821 2.791 6.501 2.791 1.326 0 2.656-.26 3.989-.781 1.333-.52 2.477-1.151 3.432-1.892v-3.978h-7.25zM36.568 20.324h6.33v31.352h-6.33zM50.507 51.676V20.324H72v5.304H56.837v7.421h13.089v5.303H56.837v13.324h-6.33z"/>
</svg>

After

Width:  |  Height:  |  Size: 853 B

@@ -0,0 +1,100 @@
.trumbowyg-giphy-button svg {
transform: scale(1.22);
}
.trumbowyg-giphy-search {
display: block;
width: 80%;
margin: 5%;
padding-left: 10px;
padding-right: 150px;
}
.trumbowyg-giphy-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-giphy {
position: absolute;
top: calc(5% + 12px);
right: calc(15% + 10px);
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: bottom;
margin-left: 6px;
opacity: 0.45;
}
}
.trumbowyg-giphy-modal-scroll {
overflow: auto;
overflow-x: hidden;
height: 240px;
}
.trumbowyg-giphy-modal {
padding: 0 5%;
columns: 3;
column-gap: 10px;
.trumbowyg-giphy-no-result {
width: 250%;
margin: 13% 0 0 29%;
}
.trumbowyg-giphy-offline {
font-size: 18px;
width: 305%;
height: 600px;
margin-top: 95px;
text-align: center;
}
}
.trumbowyg-giphy-modal .img-container {
width: 100%;
margin-bottom: 10px;
background-color: #ecf0f1;
img {
width: 100%;
cursor: pointer;
opacity: 0;
transition: opacity 150ms;
&:hover,
&:focus {
border: #2ecc71 solid 3px;
}
}
img.tbw-loaded {
opacity: 1;
}
}
@@ -0,0 +1,307 @@
/* globals Prism */
(function ($, Prism) {
'use strict';
// My plugin default options
var defaultOptions = {
enableLineHighlight: true,
languageNames: {
// For updated list of languages
// see https://github.com/PrismJS/prism/blob/master/plugins/show-language/prism-show-language.js
'html': 'HTML',
'xml': 'XML',
'svg': 'SVG',
'mathml': 'MathML',
'ssml': 'SSML',
'css': 'CSS',
'clike': 'C-like',
'js': 'JavaScript',
'abap': 'ABAP',
'abnf': 'Augmented BackusNaur form',
'al': 'AL',
'antlr4': 'ANTLR4',
'g4': 'ANTLR4',
'apacheconf': 'Apache Configuration',
'apl': 'APL',
'aql': 'AQL',
'arff': 'ARFF',
'asciidoc': 'AsciiDoc',
'adoc': 'AsciiDoc',
'asm6502': '6502 Assembly',
'aspnet': 'ASP.NET (C#)',
'autohotkey': 'AutoHotkey',
'autoit': 'AutoIt',
'basic': 'BASIC',
'bbcode': 'BBcode',
'bnf': 'BackusNaur form',
'rbnf': 'Routing BackusNaur form',
'conc': 'Concurnas',
'csharp': 'C#',
'cs': 'C#',
'dotnet': 'C#',
'cpp': 'C++',
'cil': 'CIL',
'coffee': 'CoffeeScript',
'cmake': 'CMake',
'csp': 'Content-Security-Policy',
'css-extras': 'CSS Extras',
'dax': 'DAX',
'django': 'Django/Jinja2',
'jinja2': 'Django/Jinja2',
'dns-zone-file': 'DNS zone file',
'dns-zone': 'DNS zone file',
'dockerfile': 'Docker',
'ebnf': 'Extended BackusNaur form',
'ejs': 'EJS',
'etlua': 'Embedded Lua templating',
'erb': 'ERB',
'excel-formula': 'Excel Formula',
'xlsx': 'Excel Formula',
'xls': 'Excel Formula',
'fsharp': 'F#',
'firestore-security-rules': 'Firestore security rules',
'ftl': 'FreeMarker Template Language',
'gcode': 'G-code',
'gdscript': 'GDScript',
'gedcom': 'GEDCOM',
'glsl': 'GLSL',
'gml': 'GameMaker Language',
'gamemakerlanguage': 'GameMaker Language',
'graphql': 'GraphQL',
'hs': 'Haskell',
'hcl': 'HCL',
'hlsl': 'HLSL',
'http': 'HTTP',
'hpkp': 'HTTP Public-Key-Pins',
'hsts': 'HTTP Strict-Transport-Security',
'ichigojam': 'IchigoJam',
'iecst': 'Structured Text (IEC 61131-3)',
'inform7': 'Inform 7',
'javadoc': 'JavaDoc',
'javadoclike': 'JavaDoc-like',
'javastacktrace': 'Java stack trace',
'jq': 'JQ',
'jsdoc': 'JSDoc',
'js-extras': 'JS Extras',
'js-templates': 'JS Templates',
'json': 'JSON',
'jsonp': 'JSONP',
'json5': 'JSON5',
'latex': 'LaTeX',
'tex': 'TeX',
'context': 'ConTeXt',
'lilypond': 'LilyPond',
'ly': 'LilyPond',
'emacs': 'Lisp',
'elisp': 'Lisp',
'emacs-lisp': 'Lisp',
'llvm': 'LLVM IR',
'lolcode': 'LOLCODE',
'md': 'Markdown',
'markup-templating': 'Markup templating',
'matlab': 'MATLAB',
'mel': 'MEL',
'moon': 'MoonScript',
'n1ql': 'N1QL',
'n4js': 'N4JS',
'n4jsd': 'N4JS',
'nand2tetris-hdl': 'Nand To Tetris HDL',
'nasm': 'NASM',
'neon': 'NEON',
'nginx': 'nginx',
'nsis': 'NSIS',
'objectivec': 'Objective-C',
'objc': 'Objective-C',
'ocaml': 'OCaml',
'opencl': 'OpenCL',
'parigp': 'PARI/GP',
'objectpascal': 'Object Pascal',
'pcaxis': 'PC-Axis',
'px': 'PC-Axis',
'peoplecode': 'PeopleCode',
'pcode': 'PeopleCode',
'php': 'PHP',
'phpdoc': 'PHPDoc',
'php-extras': 'PHP Extras',
'plsql': 'PL/SQL',
'powerquery': 'PowerQuery',
'pq': 'PowerQuery',
'mscript': 'PowerQuery',
'powershell': 'PowerShell',
'properties': '.properties',
'protobuf': 'Protocol Buffers',
'py': 'Python',
'q': 'Q (kdb+ database)',
'qml': 'QML',
'rkt': 'Racket',
'jsx': 'React JSX',
'tsx': 'React TSX',
'renpy': 'Ren\'py',
'rest': 'reST (reStructuredText)',
'robotframework': 'Robot Framework',
'robot': 'Robot Framework',
'rb': 'Ruby',
'sas': 'SAS',
'sass': 'Sass (Sass)',
'scss': 'Sass (Scss)',
'shell-session': 'Shell session',
'solidity': 'Solidity (Ethereum)',
'solution-file': 'Solution file',
'sln': 'Solution file',
'soy': 'Soy (Closure Template)',
'sparql': 'SPARQL',
'rq': 'SPARQL',
'splunk-spl': 'Splunk SPL',
'sqf': 'SQF: Status Quo Function (Arma 3)',
'sql': 'SQL',
'tap': 'TAP',
'toml': 'TOML',
'tt2': 'Template Toolkit 2',
'trig': 'TriG',
'ts': 'TypeScript',
't4-cs': 'T4 Text Templates (C#)',
't4': 'T4 Text Templates (C#)',
't4-vb': 'T4 Text Templates (VB)',
't4-templating': 'T4 templating',
'uscript': 'UnrealScript',
'uc': 'UnrealScript',
'vbnet': 'VB.Net',
'vhdl': 'VHDL',
'vim': 'vim',
'visual-basic': 'Visual Basic',
'vb': 'Visual Basic',
'wasm': 'WebAssembly',
'wiki': 'Wiki markup',
'xeoracube': 'XeoraCube',
'xojo': 'Xojo (REALbasic)',
'xquery': 'XQuery',
'yaml': 'YAML',
'yml': 'YAML'
}
};
function highlightIt(text, language, lineHighlight) {
return [
'<pre class="language-' + language + '" ' + (lineHighlight ? 'data-line="' + lineHighlight + '"' : '') + '>',
'<code class="language-' + language + '">' + Prism.highlight(text, Prism.languages[language]) + '</code>',
'</pre>',
].join('');
}
function escapeHtml(html) {
return $('<div/>').text(html).html();
}
function buildHighlightOptions(trumbowyg) {
var languageNames = trumbowyg.o.plugins.highlight.languageNames;
var languageNameKeys = Object.keys(languageNames);
var prismLanguageKeys = Object.keys(Prism.languages);
var options = prismLanguageKeys.filter(function (languageKey) {
return languageNameKeys.indexOf(languageKey) >= 0;
}).map(function (languageKey) {
return {
id: languageKey,
name: languageNames[languageKey]
};
}).sort(function(a, b){
// Sort languages by name
return a.name.localeCompare(b.name);
}).map(function( language){
// Generate a list of options
return '<option value="' + escapeHtml(language.id) + '">' + escapeHtml(language.name) + '</option>';
}).join('');
return options;
}
function buildLineHighlightFieldIfEnabled(trumbowyg) {
if (trumbowyg.o.plugins.highlight.enableLineHighlight === false) {
return '';
}
return '<div class="' + trumbowyg.o.prefix + 'highlight-form-group">' +
' <input placeholder="' + trumbowyg.lang.highlightLine +
'" class="' + trumbowyg.o.prefix + 'highlight-form-control trumbowyg-line-highlight"/>' +
'</div>';
}
// If my plugin is a button
function buildButtonDef(trumbowyg) {
return {
fn: function () {
var $modal = trumbowyg.openModal('Code', [
'<div class="' + trumbowyg.o.prefix + 'highlight-form-group">',
' <select class="' + trumbowyg.o.prefix + 'highlight-form-control language" autofocus>',
buildHighlightOptions(trumbowyg),
' </select>',
'</div>',
'<div class="' + trumbowyg.o.prefix + 'highlight-form-group">',
' <textarea class="' + trumbowyg.o.prefix + 'highlight-form-control code"></textarea>',
'</div>',
buildLineHighlightFieldIfEnabled(trumbowyg),
].join('\n')),
$language = $modal.find('.language'),
$code = $modal.find('.code'),
$lineHighlight = $modal.find('.trumbowyg-line-highlight');
// Listen clicks on modal box buttons
$modal.on('tbwconfirm', function () {
trumbowyg.restoreRange();
trumbowyg.execCmd('insertHTML', highlightIt($code.val(), $language.val(), $lineHighlight.val()));
trumbowyg.execCmd('insertHTML', '<p><br></p>');
trumbowyg.closeModal();
});
$modal.on('tbwcancel', function () {
trumbowyg.closeModal();
});
}
};
}
$.extend(true, $.trumbowyg, {
// Add some translations
langs: {
// jshint camelcase:false
en: {
highlight: 'Code syntax highlight',
highlightLine: 'Highlight lines, e.g.: 1,3-5'
},
es: {
highlight: 'Resaltado de sintaxis de código',
highlightLine: 'Resaltar lineas, ej: 1,3-5'
},
et: {
highlight: 'Koodi esiletoomine',
highlightLine: 'Koodiread, näiteks: 1,3-5'
},
hu: {
highlight: 'Kód kiemelés'
},
ko: {
highlight: '코드 문법 하이라이트'
},
pt_br: {
highlight: 'Realçar sintaxe de código'
},
// jshint camelcase:true
},
// Add our plugin to Trumbowyg registered plugins
plugins: {
highlight: {
init: function (trumbowyg) {
// Fill current Trumbowyg instance with my plugin default options
trumbowyg.o.plugins.highlight = $.extend(true, {},
defaultOptions,
trumbowyg.o.plugins.highlight || {}
);
// If my plugin is a button
trumbowyg.addBtnDef('highlight', buildButtonDef(trumbowyg));
}
}
}
});
})(jQuery, Prism);
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60">
<path d="M11 7c0-2.206-1.794-4-4-4S3 4.794 3 7s1.794 4 4 4 4-1.794 4-4zM7 9c-1.103 0-2-.897-2-2s.897-2 2-2 2 .897 2 2-.897 2-2 2zM16 11c2.206 0 4-1.794 4-4s-1.794-4-4-4-4 1.794-4 4 1.794 4 4 4zm0-6c1.103 0 2 .897 2 2s-.897 2-2 2-2-.897-2-2 .897-2 2-2zM25 11c2.206 0 4-1.794 4-4s-1.794-4-4-4-4 1.794-4 4 1.794 4 4 4zm0-6c1.103 0 2 .897 2 2s-.897 2-2 2-2-.897-2-2 .897-2 2-2z"/>
<path d="M0 0v60h60V0H0zm2 2h56v10H2V2zm0 56V14h5v44H2zm56 0H9V14h49v44z"/>
<path d="M5 17H4a1 1 0 100 2h1a1 1 0 100-2zM5 21H4a1 1 0 100 2h1a1 1 0 100-2zM5 25H4a1 1 0 100 2h1a1 1 0 100-2zM5 29H4a1 1 0 100 2h1a1 1 0 100-2zM5 33H4a1 1 0 100 2h1a1 1 0 100-2zM5 37H4a1 1 0 100 2h1a1 1 0 100-2zM5 41H4a1 1 0 100 2h1a1 1 0 100-2zM5 45H4a1 1 0 100 2h1a1 1 0 100-2zM5 49H4a1 1 0 100 2h1a1 1 0 100-2zM5 53H4a1 1 0 100 2h1a1 1 0 100-2zM13 19h13a1 1 0 100-2H13a1 1 0 100 2zM30 19h10a1 1 0 100-2H30a1 1 0 100 2zM44 19h2a1 1 0 100-2h-2a1 1 0 100 2zM35 22a1 1 0 001 1h15a1 1 0 100-2H36a1 1 0 00-1 1zM32 21H18a1 1 0 100 2h14a1 1 0 100-2zM13 23h1a1 1 0 100-2h-1a1 1 0 100 2zM13 27h9a1 1 0 100-2h-9a1 1 0 100 2zM26 27h2a1 1 0 100-2h-2a1 1 0 100 2zM46 25H32a1 1 0 100 2h14a1 1 0 100-2zM13 31h13a1 1 0 100-2H13a1 1 0 100 2zM41 30a1 1 0 00-1-1H30a1 1 0 100 2h10a1 1 0 001-1zM36 35h8a1 1 0 100-2h-8a1 1 0 100 2zM17 34a1 1 0 001 1h14a1 1 0 100-2H18a1 1 0 00-1 1zM13 35h1a1 1 0 100-2h-1a1 1 0 100 2zM13 39h9a1 1 0 100-2h-9a1 1 0 100 2zM26 39h2a1 1 0 100-2h-2a1 1 0 100 2zM31 38a1 1 0 001 1h15a1 1 0 100-2H32a1 1 0 00-1 1zM13 43h13a1 1 0 100-2H13a1 1 0 100 2zM40 41H30a1 1 0 100 2h10a1 1 0 100-2zM51 41h-7a1 1 0 100 2h7a1 1 0 100-2zM40 45h-4a1 1 0 100 2h4a1 1 0 100-2zM17 46a1 1 0 001 1h14a1 1 0 100-2H18a1 1 0 00-1 1zM13 47h1a1 1 0 100-2h-1a1 1 0 100 2zM22 49h-9a1 1 0 100 2h9a1 1 0 100-2zM28 49h-2a1 1 0 100 2h2a1 1 0 100-2zM39 49h-7a1 1 0 100 2h7a1 1 0 100-2zM44 49h-1a1 1 0 100 2h1a1 1 0 100-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -0,0 +1,14 @@
.trumbowyg-highlight-form-group {
margin: 15px 10px;
.trumbowyg-highlight-form-control {
width: 100%;
border: 1px solid #DEDEDE;
font-size: 14px;
padding: 7px;
&.code {
height: 200px;
}
}
}
@@ -0,0 +1,228 @@
/*/* ===========================================================
* trumbowyg.history.js v1.0
* history plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Sven Dunemann [dunemann@forelabs.eu]
*/
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
history: {
redo: 'Redo',
undo: 'Undo'
}
},
da: {
history: {
redo: 'Annuller fortryd',
undo: 'Fortryd'
}
},
de: {
history: {
redo: 'Wiederholen',
undo: 'Rückgängig'
}
},
et: {
history: {
redo: 'Võta tagasi',
undo: 'Tee uuesti'
}
},
fr: {
history: {
redo: 'Annuler',
undo: 'Rétablir'
}
},
hu: {
history: {
redo: 'Visszállít',
undo: 'Visszavon'
}
},
ko: {
history: {
redo: '다시 실행',
undo: '되돌리기'
}
},
pt_br: {
history: {
redo: 'Refazer',
undo: 'Desfazer'
}
},
zh_tw: {
history: {
redo: '重做',
undo: '復原'
}
},
// jshint camelcase:true
},
plugins: {
history: {
init: function (t) {
t.o.plugins.history = $.extend(true, {
_stack: [],
_index: -1,
_focusEl: undefined
}, t.o.plugins.history || {});
var btnBuildDefRedo = {
title: t.lang.history.redo,
ico: 'redo',
key: 'Y',
fn: function () {
if (t.o.plugins.history._index < t.o.plugins.history._stack.length - 1) {
t.o.plugins.history._index += 1;
var index = t.o.plugins.history._index;
var newState = t.o.plugins.history._stack[index];
t.execCmd('html', newState);
// because of some semantic optimisations we have to save the state back
// to history
t.o.plugins.history._stack[index] = t.$ed.html();
carretToEnd();
toggleButtonStates();
}
}
};
var btnBuildDefUndo = {
title: t.lang.history.undo,
ico: 'undo',
key: 'Z',
fn: function () {
if (t.o.plugins.history._index > 0) {
t.o.plugins.history._index -= 1;
var index = t.o.plugins.history._index,
newState = t.o.plugins.history._stack[index];
t.execCmd('html', newState);
// because of some semantic optimisations we have to save the state back
// to history
t.o.plugins.history._stack[index] = t.$ed.html();
carretToEnd();
toggleButtonStates();
}
}
};
var pushToHistory = function () {
var index = t.o.plugins.history._index,
stack = t.o.plugins.history._stack,
latestState = stack.slice(-1)[0] || '<p></p>',
prevState = stack[index],
newState = t.$ed.html(),
focusEl = t.doc.getSelection().focusNode,
focusElText = '',
latestStateTagsList,
newStateTagsList,
prevFocusEl = t.o.plugins.history._focusEl;
latestStateTagsList = $('<div>' + latestState + '</div>').find('*').map(function () {
return this.localName;
});
newStateTagsList = $('<div>' + newState + '</div>').find('*').map(function () {
return this.localName;
});
if (focusEl) {
t.o.plugins.history._focusEl = focusEl;
focusElText = focusEl.outerHTML || focusEl.textContent;
}
if (newState !== prevState) {
// a new stack entry is defined when current insert ends on a whitespace character
// or count of node elements has been changed
// or focused element differs from previous one
if (focusElText.slice(-1).match(/\s/) ||
!arraysAreIdentical(latestStateTagsList, newStateTagsList) ||
t.o.plugins.history._index <= 0 || focusEl !== prevFocusEl)
{
t.o.plugins.history._index += 1;
// remove newer entries in history when something new was added
// because timeline was changes with interaction
t.o.plugins.history._stack = stack.slice(
0, t.o.plugins.history._index
);
// now add new state to modified history
t.o.plugins.history._stack.push(newState);
} else {
// modify last stack entry
t.o.plugins.history._stack[index] = newState;
}
toggleButtonStates();
}
};
var toggleButtonStates = function () {
var index = t.o.plugins.history._index,
stackSize = t.o.plugins.history._stack.length,
undoState = (index > 0),
redoState = (stackSize !== 0 && index !== stackSize - 1);
toggleButtonState('historyUndo', undoState);
toggleButtonState('historyRedo', redoState);
};
var toggleButtonState = function (btn, enable) {
var button = t.$box.find('.trumbowyg-' + btn + '-button');
if (enable) {
button.removeClass('trumbowyg-disable');
} else if (!button.hasClass('trumbowyg-disable')) {
button.addClass('trumbowyg-disable');
}
};
var arraysAreIdentical = function (a, b) {
if (a === b) {
return true;
}
if (a == null || b == null) {
return false;
}
if (a.length !== b.length) {
return false;
}
for (var i = 0; i < a.length; i += 1) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
};
var carretToEnd = function () {
var node = t.doc.getSelection().focusNode,
range = t.doc.createRange();
if (node.childNodes.length > 0) {
range.setStartAfter(node.childNodes[node.childNodes.length - 1]);
range.setEndAfter(node.childNodes[node.childNodes.length - 1]);
t.doc.getSelection().removeAllRanges();
t.doc.getSelection().addRange(range);
}
};
t.$c.on('tbwinit tbwchange', pushToHistory);
t.addBtnDef('historyRedo', btnBuildDefRedo);
t.addBtnDef('historyUndo', btnBuildDefUndo);
}
}
}
});
})(jQuery);
@@ -0,0 +1,60 @@
/* ===========================================================
* trumbowyg.indent.js v1.0
* Indent or Outdent plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Fabacks
* Website : https://github.com/Fabacks
*/
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
en: {
indent: 'Indent',
outdent: 'Outdent'
},
et: {
indent: 'Taande suurendamine',
outdent: 'Taande vähendamine'
},
fr: {
indent: 'Augmenter le retrait',
outdent: 'Diminuer le retrait'
}
}
});
// Adds the extra button definition
$.extend(true, $.trumbowyg, {
plugins: {
paragraph: {
init: function (trumbowyg) {
var indentBtnDef = {
fn: 'indent',
title: trumbowyg.lang.indent,
isSupported: function () {
return !!document.queryCommandSupported && !!document.queryCommandSupported('indent');
},
ico: 'indent'
};
var outdentBtnDef = {
fn: 'outdent',
title: trumbowyg.lang.outdent,
isSupported: function () {
return !!document.queryCommandSupported && !!document.queryCommandSupported('outdent');
},
ico: 'outdent'
};
trumbowyg.addBtnDef('indent', indentBtnDef);
trumbowyg.addBtnDef('outdent', outdentBtnDef);
}
}
}
});
})(jQuery);
@@ -0,0 +1,3 @@
<svg viewBox="0 0 467.765 467.765" xmlns="http://www.w3.org/2000/svg">
<path d="M181.412 151.176h292.353v58.471H181.412zM181.412 272.118h292.353v58.471H181.412zM0 393.059h467.765v58.471H0zM0 30.235h467.765v58.471H0zM0 350.824V116.941l116.941 116.941z"/>
</svg>

After

Width:  |  Height:  |  Size: 265 B

@@ -0,0 +1,3 @@
<svg viewBox="0 0 467.765 467.765" xmlns="http://www.w3.org/2000/svg">
<path d="M181.412 151.176h292.353v58.471H181.412zM181.412 272.118h292.353v58.471H181.412zM0 393.059h467.765v58.471H0zM0 30.235h467.765v58.471H0zM0 233.882l116.941-116.941v233.882z"/>
</svg>

After

Width:  |  Height:  |  Size: 265 B

@@ -0,0 +1,106 @@
/*/* ===========================================================
* trumbowyg.insertaudio.js v1.0
* InsertAudio plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Adam Hess (AdamHess)
*/
(function ($) {
'use strict';
var insertAudioOptions = {
src: {
label: 'URL',
required: true
},
autoplay: {
label: 'AutoPlay',
required: false,
type: 'checkbox'
},
muted: {
label: 'Muted',
required: false,
type: 'checkbox'
},
preload: {
label: 'preload options',
required: false
}
};
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
insertAudio: 'Insert Audio'
},
da: {
insertAudio: 'Indsæt lyd'
},
et: {
insertAudio: 'Lisa helifail'
},
fr: {
insertAudio: 'Insérer un son'
},
hu: {
insertAudio: 'Audio beszúrás'
},
ja: {
insertAudio: '音声の挿入'
},
ko: {
insertAudio: '소리 넣기'
},
pt_br: {
insertAudio: 'Inserir áudio'
},
ru: {
insertAudio: 'Вставить аудио'
},
tr: {
insertAudio: 'Ses Ekle'
},
// jshint camelcase:true
},
plugins: {
insertAudio: {
init: function (trumbowyg) {
var btnDef = {
fn: function () {
var insertAudioCallback = function (v) {
// controls should always be show otherwise the audio will
// be invisible defeating the point of a wysiwyg
var html = '<audio controls';
if (v.src) {
html += ' src=\'' + v.src + '\'';
}
if (v.autoplay) {
html += ' autoplay';
}
if (v.muted) {
html += ' muted';
}
if (v.preload) {
html += ' preload=\'' + v + '\'';
}
html += '></audio>';
var node = $(html)[0];
trumbowyg.range.deleteContents();
trumbowyg.range.insertNode(node);
return true;
};
trumbowyg.openModalInsert(trumbowyg.lang.insertAudio, insertAudioOptions, insertAudioCallback);
}
};
trumbowyg.addBtnDef('insertAudio', btnDef);
}
}
}
});
})(jQuery);
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -2 12 12">
<path d="M3.344 0l-1.344 2h-2v4h2l1.344 2h.656v-8h-.656zm1.656 1v1c.152 0 .313.026.469.063h.031c.86.215 1.5.995 1.5 1.938 0 .942-.64 1.722-1.5 1.938-.166.041-.338.063-.5.063v1c.258 0 .516-.035.75-.094 1.3-.325 2.25-1.508 2.25-2.906 0-1.398-.95-2.581-2.25-2.906-.234-.059-.492-.094-.75-.094zm0 2v2l.25-.031c.433-.118.75-.507.75-.969 0-.446-.325-.819-.75-.938v-.031h-.031l-.219-.031z"
/>
</svg>

After

Width:  |  Height:  |  Size: 460 B

@@ -0,0 +1,180 @@
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
lineheight: 'Line height',
lineheights: {
'0.9': 'Small',
'normal': 'Regular',
'1.5': 'Large',
'2.0': 'Extra large'
}
},
da: {
lineheight: 'Linjehøjde',
lineheights: {
'0.9': 'Lille',
'normal': 'Normal',
'1.5': 'Stor',
'2.0': 'Ekstra stor'
}
},
et: {
lineheight: 'Reavahe',
lineheights: {
'0.9': 'Väike',
'normal': 'Tavaline',
'1.5': 'Suur',
'2.0': 'Väga suur'
}
},
fr: {
lineheight: 'Hauteur de ligne',
lineheights: {
'0.9': 'Petite',
'normal': 'Normale',
'1.5': 'Grande',
'2.0': 'Très grande'
}
},
hu: {
lineheight: 'Line height',
lineheights: {
'0.9': 'Small',
'normal': 'Regular',
'1.5': 'Large',
'2.0': 'Extra large'
}
},
it: {
lineheight: 'Altezza linea',
lineheights: {
'0.9': 'Bassa',
'normal': 'Normale',
'1.5': 'Alta',
'2.0': 'Molto alta'
}
},
ko: {
lineheight: '줄 간격',
lineheights: {
'0.9': '좁게',
'normal': '보통',
'1.5': '넓게',
'2.0': '아주 넓게'
}
},
nl: {
lineheight: 'Regelhoogte',
lineheights: {
'0.9': 'Klein',
'normal': 'Normaal',
'1.5': 'Groot',
'2.0': 'Extra groot'
}
},
pt_br: {
lineheight: 'Altura de linha',
lineheights: {
'0.9': 'Pequena',
'normal': 'Regular',
'1.5': 'Grande',
'2.0': 'Extra grande'
}
},
tr: {
lineheight: 'Satır yüksekliği',
lineheights: {
'0.9': 'Küçük',
'normal': 'Normal',
'1.5': 'Büyük',
'2.0': 'Çok Büyük'
}
},
zh_tw: {
lineheight: '文字間距',
lineheights: {
'0.9': '小',
'normal': '正常',
'1.5': '大',
'2.0': '特大'
}
},
}
});
// jshint camelcase:true
var defaultOptions = {
sizeList: [
'0.9',
'normal',
'1.5',
'2.0'
]
};
// Add dropdown with font sizes
$.extend(true, $.trumbowyg, {
plugins: {
lineheight: {
init: function (trumbowyg) {
trumbowyg.o.plugins.lineheight = $.extend({},
defaultOptions,
trumbowyg.o.plugins.lineheight || {}
);
trumbowyg.addBtnDef('lineheight', {
dropdown: buildDropdown(trumbowyg)
});
}
}
}
});
// Build the dropdown
function buildDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.lineheight.sizeList, function(index, size) {
trumbowyg.addBtnDef('lineheight_' + size, {
text: trumbowyg.lang.lineheights[size] || size,
hasIcon: false,
fn: function(){
trumbowyg.saveRange();
var text = trumbowyg.getRangeText();
if (text.replace(/\s/g, '') !== '') {
try {
var parent = getSelectionParentElement();
$(parent).css('lineHeight', size);
} catch (e) {
}
}
}
});
dropdown.push('lineheight_' + size);
});
return dropdown;
}
// Get the selection's parent
function getSelectionParentElement() {
var parentEl = null,
selection;
if (window.getSelection) {
selection = window.getSelection();
if (selection.rangeCount) {
parentEl = selection.getRangeAt(0).commonAncestorContainer;
if (parentEl.nodeType !== 1) {
parentEl = parentEl.parentNode;
}
}
} else if ((selection = document.selection) && selection.type !== 'Control') {
parentEl = selection.createRange().parentElement();
}
return parentEl;
}
})(jQuery);
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path fill="currentColor" d="M31 14h36v8H31zM31 50h36v8H31zM31 32h30v8H31z"/>
<path fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="3.6428" d="M7.8195 47.2068l8.333 8.1507 8.1051-8.1507M24.2756 24.6348l-8.3329-8.1507-8.1052 8.1507"/>
<path fill="currentColor" d="M14.3475 53.7613v-36h3.3847v36z"/>
</svg>

After

Width:  |  Height:  |  Size: 401 B

@@ -0,0 +1,127 @@
/* ===========================================================
* trumbowyg.mathMl.js v1.0
* MathML plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : loclamor
*/
/* globals MathJax */
(function($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
mathml: 'Insert Formulas',
formulas: 'Formulas',
inline: 'Inline'
},
da: {
mathml: 'Indsæt formler',
formulas: 'Formler',
inline: 'Inline'
},
et: {
mathml: 'Sisesta valem',
formulas: 'Valemid',
inline: 'Teksti sees'
},
fr: {
mathml: 'Inserer une formule',
formulas: 'Formule',
inline: 'En ligne'
},
hu: {
mathml: 'Formulák beszúrás',
formulas: 'Formulák',
inline: 'Inline'
},
ko: {
mathml: '수식 넣기',
formulas: '수식',
inline: '글 안에 넣기'
},
pt_br: {
mathml: 'Inserir fórmulas',
formulas: 'Fórmulas',
inline: 'Em linha'
},
tr: {
mathml: 'Formül Ekle',
formulas: 'Formüller',
inline: 'Satır içi'
},
zh_tw: {
mathml: '插入方程式',
formulas: '方程式',
inline: '內嵌'
},
},
// jshint camelcase:true
plugins: {
mathml: {
init: function(trumbowyg) {
var btnDef = {
fn: function() {
trumbowyg.saveRange();
var mathMLoptions = {
formulas: {
label: trumbowyg.lang.formulas,
required: true,
value: ''
},
inline: {
label: trumbowyg.lang.inline,
attributes: {
checked: true
},
type: 'checkbox',
required: false,
}
};
var mathmlCallback = function(v) {
var delimiter = v.inline ? '$' : '$$';
if (trumbowyg.currentMathNode) {
$(trumbowyg.currentMathNode)
.html(delimiter + ' ' + v.formulas + ' ' + delimiter)
.attr('formulas', v.formulas)
.attr('inline', (v.inline ? 'true' : 'false'));
} else {
var html = '<span class="mathMlContainer" contenteditable="false" formulas="' + v.formulas + '" inline="' + (v.inline ? 'true' : 'false') + '" >' + delimiter + ' ' + v.formulas + ' ' + delimiter + '</span>';
var node = $(html)[0];
node.onclick = function() {
trumbowyg.currentMathNode = this;
mathMLoptions.formulas.value = $(this).attr('formulas');
if ($(this).attr('inline') === 'true') {
mathMLoptions.inline.attributes.checked = true;
} else {
delete mathMLoptions.inline.attributes.checked;
}
trumbowyg.openModalInsert(trumbowyg.lang.mathml, mathMLoptions, mathmlCallback);
};
trumbowyg.range.deleteContents();
trumbowyg.range.insertNode(node);
}
trumbowyg.currentMathNode = false;
MathJax.Hub.Queue(['Typeset', MathJax.Hub]);
return true;
};
mathMLoptions.formulas.value = trumbowyg.getRangeText();
mathMLoptions.inline.attributes.checked = true;
trumbowyg.openModalInsert(trumbowyg.lang.mathml, mathMLoptions, mathmlCallback);
}
};
trumbowyg.addBtnDef('mathml', btnDef);
}
}
}
});
})(jQuery);
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 445.878 445.878">
<path d="M426.024 86.447H209.705l-84.911 298.911c-2.568 7.967-9.854 13.482-18.22 13.771-.236 0-.464.006-.688.006a19.868 19.868 0 01-18.436-12.478l-34.714-86.782H19.851C8.884 299.876 0 290.986 0 280.022c0-10.965 8.893-19.854 19.851-19.854H66.18a19.862 19.862 0 0118.436 12.483l19.237 48.09 72.472-260.218a19.855 19.855 0 0118.903-13.781h230.798c10.97 0 19.854 8.89 19.854 19.851s-8.892 19.854-19.856 19.854zm10.699 266.78l-78.259-87.904 74.576-82.783c1.318-1.454 1.638-3.547.857-5.341a4.977 4.977 0 00-4.54-2.946h-47.18a4.995 4.995 0 00-3.759 1.72l-50.059 58.047-49.674-58.029a4.95 4.95 0 00-3.771-1.738H225.58a4.947 4.947 0 00-4.521 2.929 4.939 4.939 0 00.824 5.332l73.743 82.81-77.641 87.923a4.977 4.977 0 00-.813 5.325 4.978 4.978 0 004.528 2.92h48.9c1.472 0 2.867-.65 3.807-1.785l51.819-62.181 53.05 62.229a4.972 4.972 0 003.782 1.743h49.97a4.938 4.938 0 004.527-2.926 4.966 4.966 0 00-.832-5.345z"/>
</svg>

After

Width:  |  Height:  |  Size: 986 B

@@ -0,0 +1,25 @@
.mathMlContainer {
position: relative;
&[inline="false"] {
display: block;
width: 100%;
}
&:hover {
pointer-events: none;
&::after {
content: '\270E';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 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;
}
}
}
@@ -0,0 +1,122 @@
/* ===========================================================
* trumbowyg.mention.js v0.1
* Mention plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Viper
* Github: https://github.com/Globulopolis
* Website: http://киноархив.com
*/
(function ($) {
'use strict';
var defaultOptions = {
source: [],
formatDropdownItem: formatDropdownItem,
formatResult: formatResult
};
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
mention: 'Mention'
},
da: {
mention: 'Nævn'
},
et: {
mention: 'Maini'
},
fr: {
mention: 'Mentionner'
},
hu: {
mention: 'Említ'
},
ko: {
mention: '언급'
},
pt_br: {
mention: 'Menção'
},
ru: {
mention: 'Упомянуть'
},
tr: {
mention: 'Bahset'
},
zh_tw: {
mention: '標記'
},
// jshint camelcase:true
},
plugins: {
mention: {
init: function (trumbowyg) {
trumbowyg.o.plugins.mention = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.mention || {});
var btnDef = {
dropdown: buildDropdown(trumbowyg.o.plugins.mention.source, trumbowyg)
};
trumbowyg.addBtnDef('mention', btnDef);
}
}
}
});
/**
* Build dropdown list
*
* @param {Array} items Items
* @param {object} trumbowyg Editor
*
* @return {Array}
*/
function buildDropdown(items, trumbowyg) {
var dropdown = [];
$.each(items, function (i, item) {
var btn = 'mention-' + i,
btnDef = {
hasIcon: false,
text: trumbowyg.o.plugins.mention.formatDropdownItem(item),
fn: function () {
trumbowyg.execCmd('insertHTML', trumbowyg.o.plugins.mention.formatResult(item));
return true;
}
};
trumbowyg.addBtnDef(btn, btnDef);
dropdown.push(btn);
});
return dropdown;
}
/**
* Format item in dropdown.
*
* @param {object} item Item object.
*
* @return {string}
*/
function formatDropdownItem(item) {
return item.login;
}
/**
* Format result pasted in editor.
*
* @param {object} item Item object.
*
* @return {string}
*/
function formatResult(item) {
return '@' + item.login + ' ';
}
})(jQuery);
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128">
<path fill-rule="evenodd" d="M73.309 62.5c-1.53 9.86-8.16 17.85-14.45 17.85-5.61 0-8.5-4.08-8.5-10.54 0-13.089 8.84-24.139 20.06-24.139 2.21 0 3.91.34 5.27.68L73.309 62.5zm14.45 44.2c-6.8 3.57-15.98 5.44-24.65 5.44-25.329 0-43.519-16.15-43.519-44.54 0-32.469 22.78-52.869 48.789-52.869 26.35 0 40.63 17.17 40.63 39.27 0 19.549-9.18 28.899-16.49 28.729-4.76-.17-5.95-4.76-4.25-14.79l5.1-31.449c-4.25-2.38-12.75-4.25-20.23-4.25-24.48 0-39.779 18.87-39.779 39.609 0 13.94 7.99 22.1 19.039 22.1 9.01 0 16.66-4.42 21.93-13.09h.34c.85 9.01 6.63 13.09 14.62 13.09 18.36 0 32.3-15.64 32.3-40.459 0-28.56-21.42-49.13-51.34-49.13C31.83 4.361 6.67 34.451 6.67 69.13c0 33.32 24.82 53.55 53.039 53.55 12.07 0 20.91-1.53 31.11-6.12l-3.06-9.86z"/>
</svg>

After

Width:  |  Height:  |  Size: 805 B

@@ -0,0 +1,18 @@
.trumbowyg-dropdown-mention {
button {
position: relative;
white-space: nowrap;
&:after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 15%;
height: 100%;
background-size: 100%;
background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, #ffffff 80%, #ffffff 100%);
pointer-events: none;
}
}
}
@@ -0,0 +1,129 @@
/* ===========================================================
* trumbowyg.noembed.js v1.0
* noEmbed plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Jake Johns (jakejohns)
*/
(function ($) {
'use strict';
var defaultOptions = {
proxy: 'https://noembed.com/embed?nowrap=on',
urlFiled: 'url',
data: [],
success: undefined,
error: undefined
};
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
noembed: 'Noembed',
noembedError: 'Error'
},
cs: {
noembedError: 'Chyba'
},
da: {
noembedError: 'Fejl'
},
et: {
noembed: 'Noembed',
noembedError: 'Viga'
},
fr: {
noembedError: 'Erreur'
},
hu: {
noembed: 'Noembed',
noembedError: 'Hiba'
},
ja: {
noembedError: 'エラー'
},
ko: {
noembed: 'oEmbed 넣기',
noembedError: '에러'
},
pt_br: {
noembed: 'Incorporar',
noembedError: 'Erro'
},
ru: {
noembedError: 'Ошибка'
},
sk: {
noembedError: 'Chyba'
},
tr: {
noembedError: 'Hata'
},
zh_tw: {
noembed: '插入影片',
noembedError: '錯誤'
},
// jshint camelcase:true
},
plugins: {
noembed: {
init: function (trumbowyg) {
trumbowyg.o.plugins.noembed = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.noembed || {});
var btnDef = {
fn: function () {
var $modal = trumbowyg.openModalInsert(
// Title
trumbowyg.lang.noembed,
// Fields
{
url: {
label: 'URL',
required: true
}
},
// Callback
function (data) {
$.ajax({
url: trumbowyg.o.plugins.noembed.proxy,
type: 'GET',
data: data,
cache: false,
dataType: 'json',
success: trumbowyg.o.plugins.noembed.success || function (data) {
if (data.html) {
trumbowyg.execCmd('insertHTML', data.html);
setTimeout(function () {
trumbowyg.closeModal();
}, 250);
} else {
trumbowyg.addErrorOnModalField(
$('input[type=text]', $modal),
data.error
);
}
},
error: trumbowyg.o.plugins.noembed.error || function () {
trumbowyg.addErrorOnModalField(
$('input[type=text]', $modal),
trumbowyg.lang.noembedError
);
}
});
}
);
}
};
trumbowyg.addBtnDef('noembed', btnDef);
}
}
}
});
})(jQuery);
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path d="M31.5 33.6V25l11 11-11 11v-8.8z"/>
<path d="M64 17v38H8V17h56m8-8H0v54h72V9z"/>
</svg>

After

Width:  |  Height:  |  Size: 165 B

@@ -0,0 +1,96 @@
/* ===========================================================
* trumbowyg.pasteembed.js v1.0
* Url paste to iframe with noembed. Plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Max Seelig
* Facebook : https://facebook.com/maxse
* Website : https://www.maxmade.nl/
*/
(function($) {
'use strict';
var defaultOptions = {
enabled: true,
endpoints: [
'https://noembed.com/embed?nowrap=on',
'https://api.maxmade.nl/url2iframe/embed'
]
};
$.extend(true, $.trumbowyg, {
plugins: {
pasteEmbed: {
init: function(trumbowyg) {
trumbowyg.o.plugins.pasteEmbed = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.pasteEmbed || {});
if (!trumbowyg.o.plugins.pasteEmbed.enabled) {
return;
}
trumbowyg.pasteHandlers.push(function(pasteEvent) {
try {
var clipboardData = (pasteEvent.originalEvent || pasteEvent).clipboardData,
pastedData = clipboardData.getData('Text'),
endpoints = trumbowyg.o.plugins.pasteEmbed.endpoints,
request = null;
if (pastedData.startsWith('http')) {
pasteEvent.stopPropagation();
pasteEvent.preventDefault();
var query = {
url: pastedData.trim()
};
var content = '';
var index = 0;
if (request && request.transport) {
request.transport.abort();
}
request = $.ajax({
crossOrigin: true,
url: endpoints[index],
type: 'GET',
data: query,
cache: false,
dataType: 'jsonp',
success: function(res) {
if (res.html) {
index = 0;
content = res.html;
} else {
index += 1;
}
},
error: function() {
index += 1;
},
complete: function() {
if (content.length === 0 && index < endpoints.length - 1) {
this.url = endpoints[index];
this.data = query;
$.ajax(this);
}
if (index === endpoints.length - 1) {
content = $('<a>', {
href: pastedData,
text: pastedData
}).prop('outerHTML');
}
if (content.length > 0) {
index = 0;
trumbowyg.execCmd('insertHTML', content);
}
}
});
}
} catch (c) {}
});
}
}
}
});
})(jQuery);
@@ -0,0 +1,49 @@
/* ===========================================================
* trumbowyg.pasteimage.js v1.0
* Basic base64 paste plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Alexandre Demode (Alex-D)
* Twitter : @AlexandreDemode
* Website : alex-d.fr
*/
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
plugins: {
pasteImage: {
init: function (trumbowyg) {
trumbowyg.pasteHandlers.push(function (pasteEvent) {
try {
var items = (pasteEvent.originalEvent || pasteEvent).clipboardData.items,
mustPreventDefault = false,
reader;
for (var i = items.length - 1; i >= 0; i -= 1) {
if (items[i].type.match(/^image\//)) {
reader = new FileReader();
/* jshint -W083 */
reader.onloadend = function (event) {
trumbowyg.execCmd('insertImage', event.target.result, false, true);
};
/* jshint +W083 */
reader.readAsDataURL(items[i].getAsFile());
mustPreventDefault = true;
}
}
if (mustPreventDefault) {
pasteEvent.stopPropagation();
pasteEvent.preventDefault();
}
} catch (c) {
}
});
}
}
}
});
})(jQuery);
@@ -0,0 +1,148 @@
/* ===========================================================
* trumbowyg.preformatted.js v1.0
* Preformatted plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Casella Edoardo (Civile)
*/
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
preformatted: 'Code sample <pre>'
},
da: {
preformatted: 'Præformateret <pre>'
},
et: {
preformatted: 'Eelvormindatud tekst <pre>'
},
fr: {
preformatted: 'Exemple de code <pre>'
},
hu: {
preformatted: 'Kód minta <pre>'
},
it: {
preformatted: 'Codice <pre>'
},
ja: {
preformatted: 'コードサンプル <pre>'
},
ko: {
preformatted: '코드 예제 <pre>'
},
pt_br: {
preformatted: 'Exemple de código <pre>'
},
ru: {
preformatted: 'Пример кода <pre>'
},
tr: {
preformatted: 'Kod örneği <pre>'
},
zh_cn: {
preformatted: '代码示例 <pre>'
},
zh_tw: {
preformatted: '代碼範例 <pre>'
},
},
// jshint camelcase:true
plugins: {
preformatted: {
init: function (trumbowyg) {
var btnDef = {
fn: function () {
trumbowyg.saveRange();
var text = trumbowyg.getRangeText();
if (text.replace(/\s/g, '') !== '') {
try {
var curtag = getSelectionParentElement().tagName.toLowerCase();
if (curtag === 'code' || curtag === 'pre') {
return unwrapCode();
}
else {
trumbowyg.execCmd('insertHTML', '<pre><code>' + strip(text) + '</code></pre>');
}
} catch (e) {
}
}
},
tag: 'pre'
};
trumbowyg.addBtnDef('preformatted', btnDef);
}
}
}
});
/*
* GetSelectionParentElement
*/
function getSelectionParentElement() {
var parentEl = null,
selection;
if (window.getSelection) {
selection = window.getSelection();
if (selection.rangeCount) {
parentEl = selection.getRangeAt(0).commonAncestorContainer;
if (parentEl.nodeType !== 1) {
parentEl = parentEl.parentNode;
}
}
} else if ((selection = document.selection) && selection.type !== 'Control') {
parentEl = selection.createRange().parentElement();
}
return parentEl;
}
/*
* Strip
* returns a text without HTML tags
*/
function strip(html) {
var tmp = document.createElement('DIV');
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || '';
}
/*
* UnwrapCode
* ADD/FIX: to improve, works but can be better
* "paranoic" solution
*/
function unwrapCode() {
var container = null;
if (document.selection) { //for IE
container = document.selection.createRange().parentElement();
} else {
var select = window.getSelection();
if (select.rangeCount > 0) {
container = select.getRangeAt(0).startContainer.parentNode;
}
}
//'paranoic' unwrap
var ispre = $(container).contents().closest('pre').length;
var iscode = $(container).contents().closest('code').length;
if (ispre && iscode) {
$(container).contents().unwrap('code').unwrap('pre');
} else if (ispre) {
$(container).contents().unwrap('pre');
} else if (iscode) {
$(container).contents().unwrap('code');
}
}
})(jQuery);
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path d="M10.3 33.5c.4 0 .9-.1 1.5-.2s1.2-.3 1.8-.7c.6-.3 1.1-.8 1.5-1.3.4-.5.6-1.3.6-2.1V17.1c0-1.4.3-2.6.8-3.6s1.2-1.9 2-2.5c.8-.7 1.6-1.2 2.5-1.5.9-.3 1.6-.5 2.2-.5h5.3v5.3h-3.2c-.7 0-1.3.1-1.8.4-.4.3-.8.6-1 1-.2.4-.4.9-.4 1.3-.1.5-.1.9-.1 1.4v11.4c0 1.2-.2 2.1-.7 2.9-.5.8-1 1.4-1.7 1.8-.6.4-1.3.8-2 1-.7.2-1.3.3-1.7.4v.1c.5 0 1 .1 1.7.3.7.2 1.3.5 2 .9.6.5 1.2 1.1 1.7 1.9.5.8.7 2 .7 3.4v11.1c0 .4 0 .9.1 1.4.1.5.2.9.4 1.3s.6.7 1 1c.4.3 1 .4 1.8.4h3.2V63h-5.3c-.6 0-1.4-.2-2.2-.5-.9-.3-1.7-.8-2.5-1.5s-1.4-1.5-2-2.5c-.5-1-.8-2.2-.8-3.6V43.5c0-.9-.2-1.7-.6-2.3-.4-.6-.9-1.1-1.5-1.5-.6-.4-1.2-.6-1.8-.7-.6-.1-1.1-.2-1.5-.2v-5.3zM61.8 38.7c-.4 0-1 .1-1.6.2-.6.1-1.2.4-1.8.7-.6.3-1.1.7-1.5 1.3-.4.5-.6 1.3-.6 2.1v12.1c0 1.4-.3 2.6-.8 3.6s-1.2 1.9-2 2.5c-.8.7-1.6 1.2-2.5 1.5-.9.3-1.6.5-2.2.5h-5.3v-5.3h3.2c.7 0 1.3-.1 1.8-.4.4-.3.8-.6 1-1 .2-.4.4-.9.4-1.3.1-.5.1-.9.1-1.4V42.3c0-1.2.2-2.1.7-2.9.5-.8 1-1.4 1.7-1.8.6-.4 1.3-.8 2-1 .7-.2 1.3-.3 1.7-.4v-.1c-.5 0-1-.1-1.7-.3-.7-.2-1.3-.5-2-.9-.6-.4-1.2-1.1-1.7-1.9-.5-.8-.7-2-.7-3.4V18.5c0-.4 0-.9-.1-1.4-.1-.5-.2-.9-.4-1.3s-.6-.7-1-1c-.4-.3-1-.4-1.8-.4h-3.2V9.1h5.3c.6 0 1.4.2 2.2.5.9.3 1.7.8 2.5 1.5s1.4 1.5 2 2.5c.5 1 .8 2.2.8 3.6v11.6c0 .9.2 1.7.6 2.3.4.6.9 1.1 1.5 1.5.6.4 1.2.6 1.8.7.6.1 1.2.2 1.6.2v5.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,311 @@
; (function ($) {
'use strict';
var defaultOptions = {
minSize: 32,
step: 4
};
function preventDefault(e) {
e.stopPropagation();
e.preventDefault();
}
var ResizeWithCanvas = function (trumbowyg) {
// variable to create canvas and save img in resize mode
this.resizeCanvas = document.createElement('canvas');
// to allow canvas to get focus
this.resizeCanvas.setAttribute('tabindex', '0');
this.resizeCanvas.id = 'trumbowyg-resizimg-' + (+new Date());
this.ctx = null;
this.resizeImg = null;
this.pressEscape = function (obj) {
obj.reset();
};
this.pressBackspaceOrDelete = function (obj) {
$(obj.resizeCanvas).remove();
obj.resizeImg = null;
if (trumbowyg !== null){
trumbowyg.syncCode();
// notify changes
trumbowyg.$c.trigger('tbwchange');
}
};
// PRIVATE FUNCTION
var focusedNow = false;
var isCursorSeResize = false;
// calculate offset to change mouse over square in the canvas
var offsetX, offsetY;
var reOffset = function (canvas) {
var BB = canvas.getBoundingClientRect();
offsetX = BB.left;
offsetY = BB.top;
};
var updateCanvas = function (canvas, ctx, img, canvasWidth, canvasHeight) {
ctx.translate(0.5, 0.5);
ctx.lineWidth = 1;
// image
ctx.drawImage(img, 5, 5, canvasWidth - 10, canvasHeight - 10);
// border
ctx.beginPath();
ctx.rect(5, 5, canvasWidth - 10, canvasHeight - 10);
ctx.stroke();
// square in the angle
ctx.beginPath();
ctx.fillStyle = 'rgb(255, 255, 255)';
ctx.rect(canvasWidth - 10, canvasHeight - 10, 9, 9);
ctx.fill();
ctx.stroke();
// get the offset to change the mouse cursor
reOffset(canvas);
return ctx;
};
// PUBLIC FUNCTION
// necessary to correctly print cursor over square. Called once for instance. Useless with trumbowyg.
this.init = function () {
var _this = this;
$(window).on('scroll resize', function () {
_this.reCalcOffset();
});
};
this.reCalcOffset = function () {
reOffset(this.resizeCanvas);
};
this.canvasId = function () {
return this.resizeCanvas.id;
};
this.isActive = function () {
return this.resizeImg !== null;
};
this.isFocusedNow = function () {
return focusedNow;
};
this.blurNow = function () {
focusedNow = false;
};
// restore image in the HTML of the editor
this.reset = function () {
if (this.resizeImg === null) {
return;
}
// set style of image to avoid issue on resize because this attribute have priority over width and height attribute
this.resizeImg.setAttribute('style', 'width: 100%; max-width: ' + (this.resizeCanvas.clientWidth - 10) + 'px; height: auto; max-height: ' + (this.resizeCanvas.clientHeight - 10) + 'px;');
$(this.resizeCanvas).replaceWith($(this.resizeImg));
// reset canvas style
this.resizeCanvas.removeAttribute('style');
this.resizeImg = null;
};
// setup canvas with points and border to allow the resizing operation
this.setup = function (img, resizableOptions) {
this.resizeImg = img;
if (!this.resizeCanvas.getContext) {
return false;
}
focusedNow = true;
// draw canvas
this.resizeCanvas.width = $(this.resizeImg).width() + 10;
this.resizeCanvas.height = $(this.resizeImg).height() + 10;
this.resizeCanvas.style.margin = '-5px';
this.ctx = this.resizeCanvas.getContext('2d');
// replace image with canvas
$(this.resizeImg).replaceWith($(this.resizeCanvas));
updateCanvas(this.resizeCanvas, this.ctx, this.resizeImg, this.resizeCanvas.width, this.resizeCanvas.height);
// enable resize
$(this.resizeCanvas).resizableSafe(resizableOptions)
.on('mousedown', preventDefault);
var _this = this;
$(this.resizeCanvas)
.on('mousemove', function (e) {
var mouseX = Math.round(e.clientX - offsetX);
var mouseY = Math.round(e.clientY - offsetY);
var wasCursorSeResize = isCursorSeResize;
_this.ctx.rect(_this.resizeCanvas.width - 10, _this.resizeCanvas.height - 10, 9, 9);
isCursorSeResize = _this.ctx.isPointInPath(mouseX, mouseY);
if (wasCursorSeResize !== isCursorSeResize) {
this.style.cursor = isCursorSeResize ? 'se-resize' : 'default';
}
})
.on('keydown', function (e) {
if (!_this.isActive()) {
return;
}
var x = e.keyCode;
if (x === 27) { // ESC
_this.pressEscape(_this);
} else if (x === 8 || x === 46) { // BACKSPACE or DELETE
_this.pressBackspaceOrDelete(_this);
}
})
.on('focus', preventDefault)
.on('blur', function () {
_this.reset();
// save changes
if (trumbowyg !== null){
trumbowyg.syncCode();
// notify changes
trumbowyg.$c.trigger('tbwchange');
}
});
this.resizeCanvas.focus();
return true;
};
// update the canvas after the resizing
this.refresh = function () {
if (!this.resizeCanvas.getContext) {
return;
}
this.resizeCanvas.width = this.resizeCanvas.clientWidth;
this.resizeCanvas.height = this.resizeCanvas.clientHeight;
updateCanvas(this.resizeCanvas, this.ctx, this.resizeImg, this.resizeCanvas.width, this.resizeCanvas.height);
};
};
$.extend(true, $.trumbowyg, {
plugins: {
resizimg: {
destroyResizable: function () {},
init: function (trumbowyg) {
var destroyResizable = this.destroyResizable;
// object to interact with canvas
var resizeWithCanvas = new ResizeWithCanvas(trumbowyg);
this.destroyResizable = function () {
// clean html code
trumbowyg.$ed.find('canvas.resizable')
.resizableSafe('destroy')
.off('mousedown', preventDefault)
.removeClass('resizable');
resizeWithCanvas.reset();
trumbowyg.syncCode();
};
trumbowyg.o.plugins.resizimg = $.extend(true, {},
defaultOptions,
trumbowyg.o.plugins.resizimg || {},
{
resizable: {
resizeWidth: false,
onDragStart: function (ev, $el) {
var opt = trumbowyg.o.plugins.resizimg;
var x = ev.pageX - $el.offset().left;
var y = ev.pageY - $el.offset().top;
if (x < $el.width() - opt.minSize || y < $el.height() - opt.minSize) {
return false;
}
},
onDrag: function (ev, $el, newWidth, newHeight) {
var opt = trumbowyg.o.plugins.resizimg;
if (newHeight < opt.minSize) {
newHeight = opt.minSize;
}
newHeight -= newHeight % opt.step;
$el.height(newHeight);
return false;
},
onDragEnd: function () {
// resize update canvas information
resizeWithCanvas.refresh();
trumbowyg.syncCode();
}
}
}
);
function initResizable() {
trumbowyg.$ed.find('img')
.off('click')
.on('click', function (e) {
// if I'm already do a resize, reset it
if (resizeWithCanvas.isActive()) {
resizeWithCanvas.reset();
}
// initialize resize of image
resizeWithCanvas.setup(this, trumbowyg.o.plugins.resizimg.resizable);
preventDefault(e);
});
}
trumbowyg.$c.on('tbwinit', function () {
initResizable();
// disable resize when click on other items
trumbowyg.$ed.on('click', function (e) {
// check if I've clicked out of canvas or image to reset it
if ($(e.target).is('img') || e.target.id === resizeWithCanvas.canvasId()) {
return;
}
preventDefault(e);
resizeWithCanvas.reset();
//sync
trumbowyg.syncCode();
// notify changes
trumbowyg.$c.trigger('tbwchange');
});
trumbowyg.$ed.on('scroll', function () {
resizeWithCanvas.reCalcOffset();
});
});
trumbowyg.$c.on('tbwfocus tbwchange', initResizable);
trumbowyg.$c.on('tbwresize', function () {
resizeWithCanvas.reCalcOffset();
});
// Destroy
trumbowyg.$c.on('tbwblur', function () {
// when canvas is created the tbwblur is called
// this code avoid to destroy the canvas that allow the image resizing
if (resizeWithCanvas.isFocusedNow()) {
resizeWithCanvas.blurNow();
} else {
destroyResizable();
}
});
},
destroy: function () {
this.destroyResizable();
}
}
}
});
})(jQuery);
@@ -0,0 +1,104 @@
/* ===========================================================
* trumbowyg.ruby.js v1.0
* Ruby text plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Fathi Anshory (0x00000F5C)
* Twitter : @fscchannl
* Comment : Since I use trumbowyg in my project and required it to insert ruby text, so I thought I can contribute a little. :D
*/
(function ($) {
'use strict';
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
ruby: 'Add ruby text',
rubyModal: 'Ruby modal',
rubyText: 'Ruby text'
},
da: {
ruby: 'Tilføj ruby tekst',
rubyModal: 'Ruby modal',
rubyText: 'Ruby tekst'
},
et: {
ruby: 'Lisa ruby tekst',
rubyModal: 'Ruby modaal',
rubyText: 'Ruby tekst'
},
fr: {
ruby: 'Ajouter du texte ruby',
rubyModal: 'Modale ruby',
rubyText: 'Texte ruby'
},
hu: {
ruby: 'Ruby szöveg hozzáadás',
rubyModal: 'Ruby modal',
rubyText: 'Ruby szöveg'
},
id: {
ruby: 'Sisipkan teks ruby',
rubyModal: 'Modal teks ruby',
rubyText: 'Teks ruby'
},
ko: {
ruby: '루비 문자 넣기',
rubyModal: '대상 문자',
rubyText: '루비 문자'
},
pt_br: {
ruby: 'Adicionar texto ruby',
rubyModal: 'Modal ruby',
rubyText: 'Texto ruby'
},
tr: {
ruby: 'Ruby metni ekle',
rubyModal: 'Ruby modal',
rubyText: 'Ruby metni'
},
zh_tw: {
ruby: '加入 ruby 文字',
rubyModal: 'Ruby 彈跳視窗',
rubyText: 'Ruby 文字'
},
// jshint camelcase:true
},
plugins: {
ruby: {
init: function (trumbowyg) {
var btnDef = {
fn: function () {
trumbowyg.saveRange();
trumbowyg.openModalInsert(
trumbowyg.lang.ruby,
{
rubyText: {
label: trumbowyg.lang.rubyText,
required: false,
},
modal: {
label: trumbowyg.lang.rubyModal,
value: trumbowyg.getRangeText(),
required: true
}
},
function (v) {
var node = $('<ruby title="' + v.rubyText + '">' + v.modal + '<rp> (</rp><rt>' + v.rubyText + '</rt><rp>)</rp></ruby>')[0];
trumbowyg.range.deleteContents();
trumbowyg.range.insertNode(node);
trumbowyg.syncCode();
trumbowyg.$c.trigger('tbwchange');
return true;
}
);
}
};
trumbowyg.addBtnDef('ruby', btnDef);
}
}
}
});
})(jQuery);
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path d="M16.499 24.477h8.018L41.08 67.5H33l-4.04-11.361H11.804L7.764 67.5H0l16.499-43.023zm-2.65 25.907h13.127l-6.438-18.497h-.177l-6.512 18.497zM65.053 16.685c-6.316 1.178-12.025 1.98-17.126 2.408a362.385 362.385 0 00-.965 5.833c-.25 1.57-.679 3.907-1.286 7.013 3.033-1.963 5.852-3.266 8.458-3.907 2.639-.642 4.905-.891 6.797-.75 1.891.108 3.746.661 5.566 1.661 1.82.964 3.264 2.408 4.334 4.334 1.104 1.893 1.427 4.088.965 6.584-.466 2.461-1.554 4.494-3.265 6.101-1.679 1.605-3.658 2.783-5.941 3.532-2.283.785-4.853 1.251-7.707 1.391-2.819.144-5.906.161-9.259.056 0-1.642-.287-3.212-.857-4.71l.108-.59c2.711.5 5.246.768 7.601.802 2.39 0 4.529-.195 6.421-.589 1.927-.393 3.605-1.069 5.031-2.031 1.427-.965 2.319-2.319 2.676-4.067.394-1.75.269-3.229-.373-4.443-.644-1.249-1.446-2.213-2.408-2.891-.929-.68-2.161-1.034-3.693-1.071-1.536-.072-3.265.089-5.192.482-1.927.391-3.82 1.14-5.672 2.248a24.308 24.308 0 00-4.978 3.907l-4.872-1.981c1.463-5.031 2.355-8.597 2.677-10.703.321-2.105.642-4.067.963-5.887-3.961.25-7.154.411-9.58.481-.215-1.927-.52-3.534-.91-4.817l.32-.32c3.604.32 7.225.446 10.865.375.214-1.355.481-3.103.804-5.245.354-2.175.407-3.621.16-4.336.034-.784.374-1.017 1.017-.695l5.085.749c.428.251.444.573.055.964l-.857.91c-.537 2.89-.981 5.352-1.338 7.385 4.279-.427 9.312-1.393 15.092-2.89l1.284 4.707"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,85 @@
/* ===========================================================
* trumbowyg.specialchars.js v0.99
* Unicode characters picker plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Renaud Hoyoux (geektortoise)
*/
(function ($) {
'use strict';
var defaultOptions = {
symbolList: [
// currencies
'0024', '20AC', '00A3', '00A2', '00A5', '00A4', '2030', null,
// legal signs
'00A9', '00AE', '2122', null,
// textual sign
'00A7', '00B6', '00C6', '00E6', '0152', '0153', null,
'2022', '25CF', '2023', '25B6', '2B29', '25C6', null,
//maths
'00B1', '00D7', '00F7', '21D2', '21D4', '220F', '2211', '2243', '2264', '2265'
]
};
$.extend(true, $.trumbowyg, {
langs: {
en: {
specialChars: 'Special characters'
},
et: {
specialChars: 'Erimärgid'
},
fr: {
specialChars: 'Caractères spéciaux'
},
hu: {
specialChars: 'Speciális karakterek'
},
ko: {
specialChars: '특수문자'
},
},
plugins: {
specialchars: {
init: function (trumbowyg) {
trumbowyg.o.plugins.specialchars = trumbowyg.o.plugins.specialchars || defaultOptions;
var specialCharsBtnDef = {
dropdown: buildDropdown(trumbowyg)
};
trumbowyg.addBtnDef('specialChars', specialCharsBtnDef);
}
}
}
});
function buildDropdown(trumbowyg) {
var dropdown = [];
$.each(trumbowyg.o.plugins.specialchars.symbolList, function (i, symbol) {
if (symbol === null) {
symbol = '&nbsp';
} else {
symbol = '&#x' + symbol;
}
var btn = symbol.replace(/:/g, ''),
defaultSymbolBtnName = 'symbol-' + btn,
defaultSymbolBtnDef = {
text: symbol,
hasIcon: false,
fn: function () {
var encodedSymbol = String.fromCodePoint(parseInt(symbol.replace('&#', '0')));
trumbowyg.execCmd('insertText', encodedSymbol);
return true;
}
};
trumbowyg.addBtnDef(defaultSymbolBtnName, defaultSymbolBtnDef);
dropdown.push(defaultSymbolBtnName);
});
return dropdown;
}
})(jQuery);
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72" fill-rule="evenodd">
<path d="M36 3c18.213 0 33 14.787 33 33S54.213 69 36 69 3 54.213 3 36 17.787 3 36 3zm0 6.735c14.496 0 26.265 11.769 26.265 26.265S50.496 62.265 36 62.265 9.735 50.496 9.735 36 21.504 9.735 36 9.735z"/>
<path d="M45.248 40.04h8.816C52.23 48.325 44.833 54.52 36 54.52c-10.222 0-18.52-8.298-18.52-18.52S25.778 17.48 36 17.48c8.712 0 16.027 6.028 17.977 14.142h-8.912A10.009 10.009 0 0036 25.898c-5.575 0-10.102 4.527-10.102 10.102S30.425 46.102 36 46.102a10.08 10.08 0 009.248-6.061z"/>
</svg>

After

Width:  |  Height:  |  Size: 580 B

@@ -0,0 +1,45 @@
.trumbowyg-symbol-\&nbsp-dropdown-button {
display: none !important;
}
.trumbowyg-symbol-\&nbsp-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;
&:hover,
&:focus {
&::after {
display: block;
position: absolute;
top: -5px;
left: -5px;
height: 27px;
width: 27px;
background: inherit;
box-shadow: #000 0 0 2px;
z-index: 10;
background-color: transparent;
}
}
}
.trumbowyg .specialChars {
width: 22px;
height: 22px;
display: inline-block;
}
@@ -0,0 +1,454 @@
/* ===========================================================
* trumbowyg.table.custom.js v2.0
* Table plugin for Trumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Sven Dunemann [dunemann@forelabs.eu]
*/
(function ($) {
'use strict';
var defaultOptions = {
rows: 8,
columns: 8,
styler: 'table'
};
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
table: 'Insert table',
tableAddRow: 'Add row',
tableAddRowAbove: 'Add row above',
tableAddColumnLeft: 'Add column to the left',
tableAddColumn: 'Add column to the right',
tableDeleteRow: 'Delete row',
tableDeleteColumn: 'Delete column',
tableDestroy: 'Delete table',
error: 'Error'
},
cs: {
table: 'Vytvořit příkaz Table',
tableAddRow: 'Přidat řádek',
tableAddRowAbove: 'Přidat řádek',
tableAddColumnLeft: 'Přidat sloupec',
tableAddColumn: 'Přidat sloupec',
error: 'Chyba'
},
da: {
table: 'Indsæt tabel',
tableAddRow: 'Tilføj række',
tableAddRowAbove: 'Tilføj række',
tableAddColumnLeft: 'Tilføj kolonne',
tableAddColumn: 'Tilføj kolonne',
tableDeleteRow: 'Slet række',
tableDeleteColumn: 'Slet kolonne',
tableDestroy: 'Slet tabel',
error: 'Fejl'
},
de: {
table: 'Tabelle einfügen',
tableAddRow: 'Zeile hinzufügen',
tableAddRowAbove: 'Zeile hinzufügen',
tableAddColumnLeft: 'Spalte hinzufügen',
tableAddColumn: 'Spalte hinzufügen',
tableDeleteRow: 'Zeile löschen',
tableDeleteColumn: 'Spalte löschen',
tableDestroy: 'Tabelle löschen',
error: 'Error'
},
et: {
table: 'Sisesta tabel',
tableAddRow: 'Lisa rida',
tableAddRowAbove: 'Lisa rida üles',
tableAddColumnLeft: 'Lisa tulp vasakule',
tableAddColumn: 'Lisa tulp paremale',
tableDeleteRow: 'Kustuta rida',
tableDeleteColumn: 'Kustuta tulp',
tableDestroy: 'Kustuta tabel',
error: 'Viga'
},
fr: {
table: 'Insérer un tableau',
tableAddRow: 'Ajouter des lignes',
tableAddRowAbove: 'Ajouter des lignes',
tableAddColumnLeft: 'Ajouter des colonnes',
tableAddColumn: 'Ajouter des colonnes',
tableDeleteRow: 'Effacer la ligne',
tableDeleteColumn: 'Effacer la colonne',
tableDestroy: 'Effacer le tableau',
error: 'Erreur'
},
hu: {
table: 'Táblázat beszúrás',
tableAddRow: 'Sor hozzáadás',
tableAddRowAbove: 'Sor beszúrás fönt',
tableAddColumnLeft: 'Sor beszúrás balra',
tableAddColumn: 'Sor beszúrás jobbra',
tableDeleteRow: 'Sor törlés',
tableDeleteColumn: 'Oszlop törlés',
tableDestroy: 'Táblázat törlés',
error: 'Hiba'
},
id: {
table: 'Sisipkan tabel',
tableAddRow: 'Sisipkan baris',
tableAddRowAbove: 'Sisipkan baris',
tableAddColumnLeft: 'Sisipkan kolom',
tableAddColumn: 'Sisipkan kolom',
tableDeleteRow: 'Hapus baris',
tableDeleteColumn: 'Hapus kolom',
tableDestroy: 'Hapus tabel',
error: 'Galat'
},
ja: {
table: '表の挿入',
tableAddRow: '行の追加',
tableAddRowAbove: '行の追加',
tableAddColumnLeft: '列の追加',
tableAddColumn: '列の追加',
error: 'エラー'
},
ko: {
table: '표 넣기',
tableAddRow: '줄 추가',
tableAddRowAbove: '줄 추가',
tableAddColumnLeft: '칸 추가',
tableAddColumn: '칸 추가',
tableDeleteRow: '줄 삭제',
tableDeleteColumn: '칸 삭제',
tableDestroy: '표 지우기',
error: '에러'
},
pt_br: {
table: 'Inserir tabela',
tableAddRow: 'Adicionar linha',
tableAddRowAbove: 'Adicionar linha',
tableAddColumnLeft: 'Adicionar coluna',
tableAddColumn: 'Adicionar coluna',
tableDeleteRow: 'Deletar linha',
tableDeleteColumn: 'Deletar coluna',
tableDestroy: 'Deletar tabela',
error: 'Erro'
},
ru: {
table: 'Вставить таблицу',
tableAddRow: 'Добавить строку',
tableAddRowAbove: 'Добавить строку',
tableAddColumnLeft: 'Добавить столбец',
tableAddColumn: 'Добавить столбец',
tableDeleteRow: 'Удалить строку',
tableDeleteColumn: 'Удалить столбец',
tableDestroy: 'Удалить таблицу',
error: 'Ошибка'
},
sk: {
table: 'Vytvoriť tabuľky',
tableAddRow: 'Pridať riadok',
tableAddRowAbove: 'Pridať riadok',
tableAddColumnLeft: 'Pridať stĺpec',
tableAddColumn: 'Pridať stĺpec',
error: 'Chyba'
},
tr: {
table: 'Tablo ekle',
tableAddRow: 'Satır ekle',
tableAddRowAbove: 'Yukarıya satır ekle',
tableAddColumnLeft: 'Sola sütun ekle',
tableAddColumn: 'Sağa sütun ekle',
tableDeleteRow: 'Satırı sil',
tableDeleteColumn: 'Sütunu sil',
tableDestroy: 'Tabloyu sil',
error: 'Hata'
},
zh_tw: {
table: '插入表格',
tableAddRow: '加入行',
tableAddRowAbove: '加入行',
tableAddColumnLeft: '加入列',
tableAddColumn: '加入列',
tableDeleteRow: '刪除行',
tableDeleteColumn: '刪除列',
tableDestroy: '刪除表格',
error: '錯誤'
},
es: {
table: 'Insertar tabla',
tableAddRow: 'Agregar fila',
tableAddRowAbove: 'Agregar fila arriba',
tableAddColumnLeft: 'Agregar columna a la izquierda',
tableAddColumn: 'Agregar columna a la derecha',
tableDeleteRow: 'Borrar fila',
tableDeleteColumn: 'Borrar columna',
tableDestroy: 'Borrar tabla',
error: 'Error'
}// jshint camelcase:true
},
plugins: {
table: {
init: function (t) {
t.o.plugins.table = $.extend(true, {}, defaultOptions, t.o.plugins.table || {});
var buildButtonDef = {
fn: function () {
t.saveRange();
var btnName = 'table';
var dropdownPrefix = t.o.prefix + 'dropdown',
dropdownOptions = { // the dropdown
class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + t.o.prefix + 'fixed-top'
};
dropdownOptions['data-' + dropdownPrefix] = btnName;
var $dropdown = $('<div/>', dropdownOptions);
if (t.$box.find('.' + dropdownPrefix + '-' + btnName).length === 0) {
t.$box.append($dropdown.hide());
} else {
$dropdown = t.$box.find('.' + dropdownPrefix + '-' + btnName);
}
// clear dropdown
$dropdown.html('');
// when active table show AddRow / AddColumn
if (t.$box.find('.' + t.o.prefix + 'table-button').hasClass(t.o.prefix + 'active-button')) {
$dropdown.append(t.buildSubBtn('tableAddRowAbove'));
$dropdown.append(t.buildSubBtn('tableAddRow'));
$dropdown.append(t.buildSubBtn('tableAddColumnLeft'));
$dropdown.append(t.buildSubBtn('tableAddColumn'));
$dropdown.append(t.buildSubBtn('tableDeleteRow'));
$dropdown.append(t.buildSubBtn('tableDeleteColumn'));
$dropdown.append(t.buildSubBtn('tableDestroy'));
} else {
var tableSelect = $('<table/>');
$('<tbody/>').appendTo(tableSelect);
for (var i = 0; i < t.o.plugins.table.rows; i += 1) {
var row = $('<tr/>').appendTo(tableSelect);
for (var j = 0; j < t.o.plugins.table.columns; j += 1) {
$('<td/>').appendTo(row);
}
}
tableSelect.find('td').on('mouseover', tableAnimate);
tableSelect.find('td').on('mousedown', tableBuild);
$dropdown.append(tableSelect);
$dropdown.append($('<div class="trumbowyg-table-size">1x1</div>'));
}
t.dropdown(btnName);
}
};
var tableAnimate = function(columnEvent) {
var column = $(columnEvent.target),
table = column.closest('table'),
colIndex = this.cellIndex,
rowIndex = this.parentNode.rowIndex;
// reset all columns
table.find('td').removeClass('active');
for (var i = 0; i <= rowIndex; i += 1) {
for (var j = 0; j <= colIndex; j += 1) {
table.find('tr:nth-of-type('+(i+1)+')').find('td:nth-of-type('+(j+1)+')').addClass('active');
}
}
// set label
table.next('.trumbowyg-table-size').html((colIndex+1) + 'x' + (rowIndex+1));
};
var tableBuild = function() {
t.saveRange();
var tabler = $('<table/>');
$('<tbody/>').appendTo(tabler);
if (t.o.plugins.table.styler) {
tabler.attr('class', t.o.plugins.table.styler);
}
var colIndex = this.cellIndex,
rowIndex = this.parentNode.rowIndex;
for (var i = 0; i <= rowIndex; i += 1) {
var row = $('<tr></tr>').appendTo(tabler);
for (var j = 0; j <= colIndex; j += 1) {
$('<td/>').appendTo(row);
}
}
t.range.deleteContents();
t.range.insertNode(tabler[0]);
t.$c.trigger('tbwchange');
};
var addRow = {
title: t.lang.tableAddRow,
text: t.lang.tableAddRow,
ico: 'row-below',
fn: function () {
t.saveRange();
var node = t.doc.getSelection().focusNode;
var focusedRow = $(node).closest('tr');
var table = $(node).closest('table');
if(table.length > 0) {
var row = $('<tr/>');
// add columns according to current columns count
for (var i = 0; i < table.find('tr')[0].childElementCount; i += 1) {
$('<td/>').appendTo(row);
}
// add row to table
focusedRow.after(row);
}
t.syncCode();
}
};
var addRowAbove = {
title: t.lang.tableAddRowAbove,
text: t.lang.tableAddRowAbove,
ico: 'row-above',
fn: function () {
t.saveRange();
var node = t.doc.getSelection().focusNode;
var focusedRow = $(node).closest('tr');
var table = $(node).closest('table');
if(table.length > 0) {
var row = $('<tr/>');
// add columns according to current columns count
for (var i = 0; i < table.find('tr')[0].childElementCount; i += 1) {
$('<td/>').appendTo(row);
}
// add row to table
focusedRow.before(row);
}
t.syncCode();
}
};
var addColumn = {
title: t.lang.tableAddColumn,
text: t.lang.tableAddColumn,
ico: 'col-right',
fn: function () {
t.saveRange();
var node = t.doc.getSelection().focusNode;
var focusedCol = $(node).closest('td');
var table = $(node).closest('table');
var focusedColIdx = focusedCol.index();
if(table.length > 0) {
$(table).find('tr').each(function() {
$($(this).children()[focusedColIdx]).after('<td></td>');
});
}
t.syncCode();
}
};
var addColumnLeft = {
title: t.lang.tableAddColumnLeft,
text: t.lang.tableAddColumnLeft,
ico: 'col-left',
fn: function () {
t.saveRange();
var node = t.doc.getSelection().focusNode;
var focusedCol = $(node).closest('td');
var table = $(node).closest('table');
var focusedColIdx = focusedCol.index();
if(table.length > 0) {
$(table).find('tr').each(function() {
$($(this).children()[focusedColIdx]).before('<td></td>');
});
}
t.syncCode();
}
};
var destroy = {
title: t.lang.tableDestroy,
text: t.lang.tableDestroy,
ico: 'table-delete',
fn: function () {
t.saveRange();
var node = t.doc.getSelection().focusNode,
table = $(node).closest('table');
table.remove();
t.syncCode();
}
};
var deleteRow = {
title: t.lang.tableDeleteRow,
text: t.lang.tableDeleteRow,
ico: 'row-delete',
fn: function () {
t.saveRange();
var node = t.doc.getSelection().focusNode,
row = $(node).closest('tr');
row.remove();
t.syncCode();
}
};
var deleteColumn = {
title: t.lang.tableDeleteColumn,
text: t.lang.tableDeleteColumn,
ico: 'col-delete',
fn: function () {
t.saveRange();
var node = t.doc.getSelection().focusNode,
table = $(node).closest('table'),
td = $(node).closest('td'),
cellIndex = td.index();
$(table).find('tr').each(function() {
$(this).find('td:eq(' + cellIndex + ')').remove();
});
t.syncCode();
}
};
t.addBtnDef('table', buildButtonDef);
t.addBtnDef('tableAddRowAbove', addRowAbove);
t.addBtnDef('tableAddRow', addRow);
t.addBtnDef('tableAddColumnLeft', addColumnLeft);
t.addBtnDef('tableAddColumn', addColumn);
t.addBtnDef('tableDeleteRow', deleteRow);
t.addBtnDef('tableDeleteColumn', deleteColumn);
t.addBtnDef('tableDestroy', destroy);
}
}
}
});
})(jQuery);
@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g transform="translate(-326-532.36)">
<rect width="6" height="15" x="335" y="537.36" fill="#ed5565" stroke="#000" stroke-linejoin="round"
stroke-linecap="round" stroke-width=".837" rx=".646"/>
<path d="m507.95 46.02c-1.367-16.368-14.588-30.13-31.21-30.13h-444.96c-16.622 0-29.844 13.762-31.24 30.13h-.54v414.82c0 17.544 14.239 31.782 31.782 31.782h444.95c17.544 0 31.782-14.239 31.782-31.782v-414.82h-.571m-349.04 414.82h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35"
fill="#000" transform="matrix(.03776 0 0 .03776 328.4 534.76)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 947 B

@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g transform="translate(-326-532.36)">
<rect width="6" height="15" x="329" y="537.36" fill="#1ab394" stroke="#000" stroke-linejoin="round"
stroke-linecap="round" stroke-width=".837" rx=".646"/>
<path d="m507.95 46.02c-1.367-16.368-14.588-30.13-31.21-30.13h-444.96c-16.622 0-29.844 13.762-31.24 30.13h-.54v414.82c0 17.544 14.239 31.782 31.782 31.782h444.95c17.544 0 31.782-14.239 31.782-31.782v-414.82h-.571m-349.04 414.82h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35"
transform="matrix(.03776 0 0 .03776 328.4 534.76)" fill="#000"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 947 B

@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<g transform="matrix(-1 0 0 1 350-532.36)">
<rect y="537.36" x="329" height="15" width="6" fill="#1ab394" stroke="#000" stroke-linejoin="round"
stroke-linecap="round" stroke-width=".837" rx=".646"/>
<path d="m507.95 46.02c-1.367-16.368-14.588-30.13-31.21-30.13h-444.96c-16.622 0-29.844 13.762-31.24 30.13h-.54v414.82c0 17.544 14.239 31.782 31.782 31.782h444.95c17.544 0 31.782-14.239 31.782-31.782v-414.82h-.571m-349.04 414.82h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35"
fill="#000" transform="matrix(.03776 0 0 .03776 328.4 534.76)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 952 B

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<rect y="-347" x="537.06" height="18" width="6" transform="matrix(0 1 1 0 350-532.36)" fill="#1ab394" stroke="#000"
stroke-linejoin="round" stroke-linecap="round" stroke-width=".917" rx=".776"/>
<path d="m507.95 46.02c-1.367-16.368-14.588-30.13-31.21-30.13h-444.96c-16.622 0-29.844 13.762-31.24 30.13h-.54v414.82c0 17.544 14.239 31.782 31.782 31.782h444.95c17.544 0 31.782-14.239 31.782-31.782v-414.82h-.571m-349.04 414.82h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35"
transform="matrix(-.03776 0 0 .03776 21.6 2.4)" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 916 B

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<rect y="-347.06" x="548.4" height="18.13" width="4.427" transform="matrix(0 1 1 0 350-532.36)" fill="#1ab394"
stroke="#000" stroke-linejoin="round" stroke-linecap="round" stroke-width=".79" rx=".781"/>
<path d="m507.95 46.02c-1.367-16.368-14.588-30.13-31.21-30.13h-444.96c-16.622 0-29.844 13.762-31.24 30.13h-.54v414.82c0 17.544 14.239 31.782 31.782 31.782h444.95c17.544 0 31.782-14.239 31.782-31.782v-414.82h-.571m-349.04 414.82h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35"
transform="matrix(-.03776 0 0 .03776 21.6 2.4)" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 924 B

@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<rect width="5" height="18" x="543.36" y="-347" transform="matrix(0 1-1 0-326-532.36)" fill="#ed5565" rx=".776"/>
<path d="m507.95 46.02c-1.367-16.368-14.588-30.13-31.21-30.13h-444.96c-16.622 0-29.844 13.762-31.24 30.13h-.54v414.82c0 17.544 14.239 31.782 31.782 31.782h444.95c17.544 0 31.782-14.239 31.782-31.782v-414.82h-.571m-349.04 414.82h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35"
transform="matrix(.03776 0 0 .03776 2.4 2.398)" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 825 B

@@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<rect y="-347" x="537.06" height="18" width="6" transform="matrix(0 1 1 0 350-532.36)" fill="#ed5565" stroke="#000"
stroke-linejoin="round" stroke-linecap="round" stroke-width=".917" rx=".776"/>
<rect width="5" height="18" x="543.36" y="-347" transform="matrix(0 1-1 0-326-532.36)" fill="#ed5565" rx=".776"/>
<rect y="-347.06" x="548.4" height="18.13" width="4.427" transform="matrix(0 1 1 0 350-532.36)" fill="#ed5565"
stroke="#000" stroke-linejoin="round" stroke-linecap="round" stroke-width=".79" rx=".781"/>
<path d="m507.95 46.02c-1.367-16.368-14.588-30.13-31.21-30.13h-444.96c-16.622 0-29.844 13.762-31.24 30.13h-.54v414.82c0 17.544 14.239 31.782 31.782 31.782h444.95c17.544 0 31.782-14.239 31.782-31.782v-414.82h-.571m-349.04 414.82h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35"
transform="matrix(.03776 0 0 .03776 2.4 2.398)" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="m507.95 46.02c-1.367-16.368-14.588-30.13-31.21-30.13h-444.96c-16.622 0-29.844 13.762-31.24 30.13h-.54v414.82c0 17.544 14.239 31.782 31.782 31.782h444.95c17.544 0 31.782-14.239 31.782-31.782v-414.82h-.571m-349.04 414.82h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35m158.91 254.26h-127.13v-95.35h127.13v95.35m0-124.49h-127.13v-97.99h127.13v97.99m0-129.77h-127.13v-95.35h127.13v95.35"
transform="matrix(.03776 0 0 .03776 2.4 2.398)" fill="#000"/>
</svg>

After

Width:  |  Height:  |  Size: 707 B

@@ -0,0 +1,35 @@
.trumbowyg-editor table {
width: 100%;
td {
border: 1px dotted #e7eaec;
padding: 8px;
}
}
.trumbowyg-dropdown-table {
table {
margin: 10px;
display: inline-block;
}
table td {
display: inline-block;
height: 20px;
width: 20px;
margin: 1px;
padding: 0;
background-color: #fff;
box-shadow: 0 0 0 1px #cecece inset;
&.active {
background-color: #00b393;
box-shadow: none;
cursor: pointer;
}
}
.trumbowyg-table-size {
text-align: center;
}
}
@@ -0,0 +1,87 @@
(function ($) {
'use strict';
// Adds the language variables
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
template: 'Template'
},
da: {
template: 'Skabelon'
},
de: {
template: 'Vorlage'
},
et: {
template: 'Mall'
},
fr: {
template: 'Patron'
},
hu: {
template: 'Sablon'
},
ja: {
template: 'テンプレート'
},
ko: {
template: '서식'
},
nl: {
template: 'Sjabloon'
},
pt_br: {
template: 'Modelo'
},
ru: {
template: 'Шаблон'
},
tr: {
template: 'Şablon'
},
zh_tw: {
template: '模板',
},
// jshint camelcase:true
}
});
// Adds the extra button definition
$.extend(true, $.trumbowyg, {
plugins: {
template: {
shouldInit: function (trumbowyg) {
return trumbowyg.o.plugins.hasOwnProperty('templates');
},
init: function (trumbowyg) {
trumbowyg.addBtnDef('template', {
dropdown: templateSelector(trumbowyg),
hasIcon: false,
text: trumbowyg.lang.template
});
}
}
}
});
// Creates the template-selector dropdown.
function templateSelector(trumbowyg) {
var available = trumbowyg.o.plugins.templates;
var templates = [];
$.each(available, function (index, template) {
trumbowyg.addBtnDef('template_' + index, {
fn: function () {
trumbowyg.html(template.html);
},
hasIcon: false,
title: template.name
});
templates.push('template_' + index);
});
return templates;
}
})(jQuery);
@@ -0,0 +1,299 @@
/* ===========================================================
* 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 ($) {
'use strict';
var defaultOptions = {
serverPath: '',
fileFieldName: 'fileToUpload',
data: [], // Additional data for ajax [{name: 'key', value: 'value'}]
headers: {}, // Additional headers
xhrFields: {}, // Additional fields
urlPropertyName: 'file', // How to get url from the json response (for instance 'url' for {url: ....})
statusPropertyName: 'success', // How to get status from the json response
success: undefined, // Success callback: function (data, trumbowyg, $modal, values) {}
error: undefined, // Error callback: function () {}
imageWidthModalEdit: false // Add ability to edit image width
};
function getDeep(object, propertyParts) {
var mainProperty = propertyParts.shift(),
otherProperties = propertyParts;
if (object !== null) {
if (otherProperties.length === 0) {
return object[mainProperty];
}
if (typeof object === 'object') {
return getDeep(object[mainProperty], otherProperties);
}
}
return object;
}
addXhrProgressEvent();
$.extend(true, $.trumbowyg, {
langs: {
// jshint camelcase:false
en: {
upload: 'Upload',
file: 'File',
uploadError: 'Error'
},
cs: {
upload: 'Nahrát obrázek',
file: 'Soubor',
uploadError: 'Chyba'
},
da: {
upload: 'Upload',
file: 'Fil',
uploadError: 'Fejl'
},
de: {
upload: 'Hochladen',
file: 'Datei',
uploadError: 'Fehler'
},
et: {
upload: 'Lae üles',
file: 'Fail',
uploadError: 'Viga'
},
fr: {
upload: 'Envoi',
file: 'Fichier',
uploadError: 'Erreur'
},
hu: {
upload: 'Feltöltés',
file: 'Fájl',
uploadError: 'Hiba'
},
ja: {
upload: 'アップロード',
file: 'ファイル',
uploadError: 'エラー'
},
ko: {
upload: '그림 올리기',
file: '파일',
uploadError: '에러'
},
pt_br: {
upload: 'Enviar do local',
file: 'Arquivo',
uploadError: 'Erro'
},
ru: {
upload: 'Загрузка',
file: 'Файл',
uploadError: 'Ошибка'
},
sk: {
upload: 'Nahrať',
file: 'Súbor',
uploadError: 'Chyba'
},
tr: {
upload: 'Yükle',
file: 'Dosya',
uploadError: 'Hata'
},
zh_cn: {
upload: '上传',
file: '文件',
uploadError: '错误'
},
zh_tw: {
upload: '上傳',
file: '文件',
uploadError: '錯誤'
},
},
// jshint camelcase:true
plugins: {
upload: {
init: function (trumbowyg) {
trumbowyg.o.plugins.upload = $.extend(true, {}, defaultOptions, trumbowyg.o.plugins.upload || {});
var btnDef = {
fn: function () {
trumbowyg.saveRange();
var file,
prefix = trumbowyg.o.prefix;
var fields = {
file: {
type: 'file',
required: true,
attributes: {
accept: 'image/*'
}
},
alt: {
label: 'description',
value: trumbowyg.getRangeText()
}
};
if (trumbowyg.o.plugins.upload.imageWidthModalEdit) {
fields.width = {
value: ''
};
}
// Prevent multiple submissions while uploading
var isUploading = false;
var $modal = trumbowyg.openModalInsert(
// Title
trumbowyg.lang.upload,
// Fields
fields,
// Callback
function (values) {
if (isUploading) {
return;
}
isUploading = true;
var data = new FormData();
data.append(trumbowyg.o.plugins.upload.fileFieldName, file);
trumbowyg.o.plugins.upload.data.map(function (cur) {
data.append(cur.name, cur.value);
});
$.map(values, function (curr, key) {
if (key !== 'file') {
data.append(key, curr);
}
});
if ($('.' + prefix + 'progress', $modal).length === 0) {
$('.' + prefix + 'modal-title', $modal)
.after(
$('<div/>', {
'class': prefix + 'progress'
}).append(
$('<div/>', {
'class': prefix + 'progress-bar'
})
)
);
}
$.ajax({
url: trumbowyg.o.plugins.upload.serverPath,
headers: trumbowyg.o.plugins.upload.headers,
xhrFields: trumbowyg.o.plugins.upload.xhrFields,
type: 'POST',
data: data,
cache: false,
dataType: 'json',
processData: false,
contentType: false,
progressUpload: function (e) {
$('.' + prefix + 'progress-bar').css('width', Math.round(e.loaded * 100 / e.total) + '%');
},
success: function (data) {
if (trumbowyg.o.plugins.upload.success) {
trumbowyg.o.plugins.upload.success(data, trumbowyg, $modal, values);
} else {
if (!!getDeep(data, trumbowyg.o.plugins.upload.statusPropertyName.split('.'))) {
var url = getDeep(data, trumbowyg.o.plugins.upload.urlPropertyName.split('.'));
trumbowyg.execCmd('insertImage', url, false, true);
var $img = $('img[src="' + url + '"]:not([alt])', trumbowyg.$box);
$img.attr('alt', values.alt);
if (trumbowyg.o.plugins.upload.imageWidthModalEdit && parseInt(values.width) > 0) {
$img.attr({
width: values.width
});
}
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]);
}
}
isUploading = false;
},
error: trumbowyg.o.plugins.upload.error || function () {
trumbowyg.addErrorOnModalField(
$('input[type=file]', $modal),
trumbowyg.lang.uploadError
);
trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg]);
isUploading = false;
}
});
}
);
$('input[type=file]').on('change', function (e) {
try {
// If multiple files allowed, we just get the first.
file = e.target.files[0];
} catch (err) {
// In IE8, multiple files not allowed
file = e.target.value;
}
});
}
};
trumbowyg.addBtnDef('upload', btnDef);
}
}
}
});
function addXhrProgressEvent() {
if (!$.trumbowyg.addedXhrProgressEvent) { // Avoid adding progress event multiple times
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
xhr: function () {
var that = this,
req = originalXhr();
if (req && typeof req.upload === 'object' && that.progressUpload !== undefined) {
req.upload.addEventListener('progress', function (e) {
that.progressUpload(e);
}, false);
}
return req;
}
});
$.trumbowyg.addedXhrProgressEvent = true;
}
}
})(jQuery);
@@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72">
<path d="M64 27v28H8V27H0v36h72V27h-8z"/>
<path d="M32 50h8V16h-8z"/>
<path d="M36 6L24 20h24z"/>
</svg>

After

Width:  |  Height:  |  Size: 178 B