gui 에디터 추가
This commit is contained in:
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
/* ===========================================================
|
||||
* ko.js
|
||||
* Korean translation for Trumbowyg
|
||||
* http://alex-d.github.com/Trumbowyg
|
||||
* ===========================================================
|
||||
* Author : JoongSeob Vito Kim (dorajistyle)
|
||||
* Blog : http://dorajistyle.pe.kr
|
||||
* Github : https://github.com/dorajistyle
|
||||
*/
|
||||
jQuery.trumbowyg.langs.ko={viewHTML:"HTML로 보기",formatting:"양식",p:"문단",blockquote:"인용부호",code:"코드",header:"머릿말",bold:"진하게",italic:"기울임",strikethrough:"취소선",underline:"밑줄",strong:"굵게",em:"강조",del:"취소",unorderedList:"순차 목록",orderedList:"비순차 목록",insertImage:"이미지 넣기",insertVideo:"비디오 넣기",link:"링크",createLink:"링크 넣기",unlink:"링크 없애기",justifyLeft:"왼쪽 정렬",justifyCenter:"가운데 정렬",justifyRight:"오른쪽 정렬",justifyFull:"혼합 정렬",horizontalRule:"가로줄 넣기",fullscreen:"전체 화면",close:"닫기",submit:"전송",reset:"초기화",required:"꼭 입력해야 합니다.",description:"설명",title:"제목",text:"본문 내용"};
|
||||
@@ -0,0 +1,143 @@
|
||||
/* ===========================================================
|
||||
* 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 = {
|
||||
allowTagsFromPaste: [
|
||||
'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) {
|
||||
trumbowyg.o.removeformatPasted = false;
|
||||
trumbowyg.o.plugins.allowTagsFromPaste = trumbowyg.o.allowTagsFromPaste ? $(defaultOptions.allowTagsFromPaste).not(trumbowyg.o.allowTagsFromPaste).get() : [];
|
||||
trumbowyg.pasteHandlers.push(function () {
|
||||
setTimeout(function () {
|
||||
var processNodes = trumbowyg.$ed.html();
|
||||
$.each(trumbowyg.o.plugins.allowTagsFromPaste, function (iterator, tagName) {
|
||||
processNodes = processNodes.replace(new RegExp('<\\/?' + tagName + '(\\s[^>]*)?>', 'gi'), '');
|
||||
});
|
||||
trumbowyg.$ed.html(processNodes);
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
+1
@@ -0,0 +1 @@
|
||||
!function(e){"use strict";var t={allowTagsFromPaste:["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"]};e.extend(!0,e.trumbowyg,{plugins:{allowTagsFromPaste:{init:function(a){a.o.removeformatPasted=!1,a.o.plugins.allowTagsFromPaste=a.o.allowTagsFromPaste?e(t.allowTagsFromPaste).not(a.o.allowTagsFromPaste).get():[],a.pasteHandlers.push(function(){setTimeout(function(){var t=a.$ed.html();e.each(a.o.plugins.allowTagsFromPaste,function(e,a){t=t.replace(new RegExp("<\\/?"+a+"(\\s[^>]*)?>","gi"),"")}),a.$ed.html(t)},0)})}}}})}(jQuery);
|
||||
@@ -0,0 +1,129 @@
|
||||
/* ===========================================================
|
||||
* 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.'
|
||||
},
|
||||
fr: {
|
||||
base64: 'Image en base64',
|
||||
file: 'Fichier'
|
||||
},
|
||||
cs: {
|
||||
base64: 'Vložit obrázek',
|
||||
file: 'Soubor'
|
||||
},
|
||||
zh_cn: {
|
||||
base64: '图片(Base64编码)',
|
||||
file: '文件'
|
||||
},
|
||||
nl: {
|
||||
base64: 'Afbeelding inline',
|
||||
file: 'Bestand',
|
||||
errFileReaderNotSupported: 'Uw browser ondersteunt deze functionaliteit niet.',
|
||||
errInvalidImage: 'De gekozen afbeelding is ongeldig.'
|
||||
},
|
||||
ru: {
|
||||
base64: 'Изображение как код в base64',
|
||||
file: 'Файл',
|
||||
errFileReaderNotSupported: 'FileReader не поддерживается вашим браузером.',
|
||||
errInvalidImage: 'Недопустимый файл изображения.'
|
||||
},
|
||||
ja: {
|
||||
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ı.'
|
||||
}
|
||||
},
|
||||
// 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);
|
||||
$(['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);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,112 @@
|
||||
/* ===========================================================
|
||||
* 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 -cgCraft
|
||||
html = html.replace(/ /gi, ' ');
|
||||
// strip out extra spaces -cgCraft
|
||||
html = html.replace(/ <\//gi, '</');
|
||||
|
||||
while (html.indexOf(' ') !== -1) {
|
||||
html = html.split(' ').join(' ');
|
||||
}
|
||||
|
||||
// strip -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 cleanout 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 () {
|
||||
try {
|
||||
trumbowyg.$ed.html(cleanIt(trumbowyg.$ed.html()));
|
||||
} catch (c) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
!function(e){"use strict";function r(e){var r=e;return r=r.replace(/<[^> ]*/g,function(e){return e.toLowerCase()}),r=r.replace(/<[^>]*>/g,function(e){return e=e.replace(/ [^=]+=/g,function(e){return e.toLowerCase()})}),r=r.replace(/<[^>]*>/g,function(e){return e=e.replace(/( [^=]+=)([^"][^ >]*)/g,'$1"$2"')})}function n(e){for(e=r(e),e=e.replace(/<b(\s+|>)/g,"<strong$1"),e=e.replace(/<\/b(\s+|>)/g,"</strong$1"),e=e.replace(/<i(\s+|>)/g,"<em$1"),e=e.replace(/<\/i(\s+|>)/g,"</em$1"),e=e.replace(/<!(?:--[\s\S]*?--\s*)?>\s*/g,""),e=e.replace(/ /gi," "),e=e.replace(/ <\//gi,"</");e.indexOf(" ")!==-1;)e=e.split(" ").join(" ");return e=e.replace(/^\s*|\s*$/g,""),e=e.replace(/<[^>]*>/g,function(e){return e=e.replace(/ ([^=]+)="[^"]*"/g,function(e,r){return["alt","href","src","title"].indexOf(r)!==-1?e:""})}),e=e.replace(/<\?xml[^>]*>/g,""),e=e.replace(/<[^ >]+:[^>]*>/g,""),e=e.replace(/<\/[^ >]+:[^>]*>/g,""),e=e.replace(/<(div|span|style|meta|link).*?>/gi,"")}e.extend(!0,e.trumbowyg,{plugins:{cleanPaste:{init:function(e){e.pasteHandlers.push(function(){try{e.$ed.html(n(e.$ed.html()))}catch(r){}})}}}})}(jQuery);
|
||||
@@ -0,0 +1,185 @@
|
||||
/* ===========================================================
|
||||
* 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
|
||||
cs: {
|
||||
foreColor: 'Barva textu',
|
||||
backColor: 'Barva pozadí'
|
||||
},
|
||||
en: {
|
||||
foreColor: 'Text color',
|
||||
backColor: 'Background color'
|
||||
},
|
||||
fr: {
|
||||
foreColor: 'Couleur du texte',
|
||||
backColor: 'Couleur de fond'
|
||||
},
|
||||
nl: {
|
||||
foreColor: 'Tekstkleur',
|
||||
backColor: 'Achtergrondkleur'
|
||||
},
|
||||
sk: {
|
||||
foreColor: 'Farba textu',
|
||||
backColor: 'Farba pozadia'
|
||||
},
|
||||
zh_cn: {
|
||||
foreColor: '文字颜色',
|
||||
backColor: '背景颜色'
|
||||
},
|
||||
ru: {
|
||||
foreColor: 'Цвет текста',
|
||||
backColor: 'Цвет выделения текста'
|
||||
},
|
||||
ja: {
|
||||
foreColor: '文字色',
|
||||
backColor: '背景色'
|
||||
},
|
||||
tr: {
|
||||
foreColor: 'Yazı rengi',
|
||||
backColor: 'Arkaplan rengi'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 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+))?\)$/);
|
||||
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']
|
||||
};
|
||||
|
||||
// Add all colors in two dropdowns
|
||||
$.extend(true, $.trumbowyg, {
|
||||
plugins: {
|
||||
color: {
|
||||
init: function (trumbowyg) {
|
||||
trumbowyg.o.plugins.colors = trumbowyg.o.plugins.colors || defaultOptions;
|
||||
var foreColorBtnDef = {
|
||||
dropdown: buildDropdown('foreColor', trumbowyg)
|
||||
},
|
||||
backColorBtnDef = {
|
||||
dropdown: buildDropdown('backColor', trumbowyg)
|
||||
};
|
||||
|
||||
trumbowyg.addBtnDef('foreColor', foreColorBtnDef);
|
||||
trumbowyg.addBtnDef('backColor', backColorBtnDef);
|
||||
},
|
||||
tagHandler: colorTagHandler
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function buildDropdown(fn, trumbowyg) {
|
||||
var dropdown = [];
|
||||
|
||||
$.each(trumbowyg.o.plugins.colors.colorList, function (i, color) {
|
||||
var btn = fn + color,
|
||||
btnDef = {
|
||||
fn: fn,
|
||||
forceCss: true,
|
||||
param: '#' + color,
|
||||
style: 'background-color: #' + color + ';'
|
||||
};
|
||||
trumbowyg.addBtnDef(btn, btnDef);
|
||||
dropdown.push(btn);
|
||||
});
|
||||
|
||||
var removeColorButtonName = fn + 'Remove',
|
||||
removeColorBtnDef = {
|
||||
fn: 'removeFormat',
|
||||
param: fn,
|
||||
style: 'background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAG0lEQVQIW2NkQAAfEJMRmwBYhoGBYQtMBYoAADziAp0jtJTgAAAAAElFTkSuQmCC);'
|
||||
};
|
||||
trumbowyg.addBtnDef(removeColorButtonName, removeColorBtnDef);
|
||||
dropdown.push(removeColorButtonName);
|
||||
|
||||
// add free color btn
|
||||
var freeColorButtonName = fn + 'Free',
|
||||
freeColorBtnDef = {
|
||||
fn: function () {
|
||||
trumbowyg.openModalInsert(trumbowyg.lang[fn],
|
||||
{
|
||||
color: {
|
||||
label: fn,
|
||||
value: '#FFFFFF'
|
||||
}
|
||||
},
|
||||
// callback
|
||||
function (values) {
|
||||
trumbowyg.execCmd(fn, values.color);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
},
|
||||
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);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Default stylesheet for Trumbowyg editor plugin
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.trumbowyg-dropdown-foreColor,
|
||||
.trumbowyg-dropdown-backColor {
|
||||
width: 276px;
|
||||
padding: 7px 5px;
|
||||
|
||||
svg {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
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;
|
||||
height: 27px;
|
||||
width: 27px;
|
||||
background: inherit;
|
||||
border: 1px solid #FFF;
|
||||
box-shadow: #000 0 0 2px;
|
||||
z-index: 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Trumbowyg plugin stylesheet
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.trumbowyg-dropdown-foreColor,
|
||||
.trumbowyg-dropdown-backColor {
|
||||
width: 276px;
|
||||
padding: 7px 5px; }
|
||||
.trumbowyg-dropdown-foreColor svg,
|
||||
.trumbowyg-dropdown-backColor svg {
|
||||
display: none !important; }
|
||||
.trumbowyg-dropdown-foreColor button,
|
||||
.trumbowyg-dropdown-backColor button {
|
||||
display: block;
|
||||
position: relative;
|
||||
float: left;
|
||||
text-indent: -9999px;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
border: 1px solid #333;
|
||||
padding: 0;
|
||||
margin: 2px; }
|
||||
.trumbowyg-dropdown-foreColor button:hover::after, .trumbowyg-dropdown-foreColor button:focus::after,
|
||||
.trumbowyg-dropdown-backColor button:hover::after,
|
||||
.trumbowyg-dropdown-backColor button:focus::after {
|
||||
content: " ";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
left: -5px;
|
||||
height: 27px;
|
||||
width: 27px;
|
||||
background: inherit;
|
||||
border: 1px solid #FFF;
|
||||
box-shadow: #000 0 0 2px;
|
||||
z-index: 10; }
|
||||
@@ -0,0 +1,2 @@
|
||||
/** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
|
||||
.trumbowyg-dropdown-backColor,.trumbowyg-dropdown-foreColor{width:276px;padding:7px 5px}.trumbowyg-dropdown-backColor svg,.trumbowyg-dropdown-foreColor svg{display:none!important}.trumbowyg-dropdown-backColor button,.trumbowyg-dropdown-foreColor button{display:block;position:relative;float:left;text-indent:-9999px;height:20px;width:20px;border:1px solid #333;padding:0;margin:2px}.trumbowyg-dropdown-backColor button:focus::after,.trumbowyg-dropdown-backColor button:hover::after,.trumbowyg-dropdown-foreColor button:focus::after,.trumbowyg-dropdown-foreColor button:hover::after{content:" ";display:block;position:absolute;top:-5px;left:-5px;height:27px;width:27px;background:inherit;border:1px solid #FFF;box-shadow:#000 0 0 2px;z-index:10}
|
||||
@@ -0,0 +1,968 @@
|
||||
/* ===========================================================
|
||||
* trumbowyg.emoji.js v0.1
|
||||
* Emoji picker plugin for Trumbowyg
|
||||
* http://alex-d.github.com/Trumbowyg
|
||||
* ===========================================================
|
||||
* Author : Nicolas Pion
|
||||
* Twitter : @nicolas_pion
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
var defaultOptions = {
|
||||
emojiList: [
|
||||
':bowtie:',
|
||||
':smile:',
|
||||
':laughing:',
|
||||
':blush:',
|
||||
':smiley:',
|
||||
':relaxed:',
|
||||
':smirk:',
|
||||
':heart_eyes:',
|
||||
':kissing_heart:',
|
||||
':kissing_closed_eyes:',
|
||||
':flushed:',
|
||||
':relieved:',
|
||||
':satisfied:',
|
||||
':grin:',
|
||||
':wink:',
|
||||
':stuck_out_tongue_winking_eye:',
|
||||
':stuck_out_tongue_closed_eyes:',
|
||||
':grinning:',
|
||||
':kissing:',
|
||||
':kissing_smiling_eyes:',
|
||||
':stuck_out_tongue:',
|
||||
':sleeping:',
|
||||
':worried:',
|
||||
':frowning:',
|
||||
':anguished:',
|
||||
':open_mouth:',
|
||||
':grimacing:',
|
||||
':confused:',
|
||||
':hushed:',
|
||||
':expressionless:',
|
||||
':unamused:',
|
||||
':sweat_smile:',
|
||||
':sweat:',
|
||||
':disappointed_relieved:',
|
||||
':weary:',
|
||||
':pensive:',
|
||||
':disappointed:',
|
||||
':confounded:',
|
||||
':fearful:',
|
||||
':cold_sweat:',
|
||||
':persevere:',
|
||||
':cry:',
|
||||
':sob:',
|
||||
':joy:',
|
||||
':astonished:',
|
||||
':scream:',
|
||||
':neckbeard:',
|
||||
':tired_face:',
|
||||
':angry:',
|
||||
':rage:',
|
||||
':triumph:',
|
||||
':sleepy:',
|
||||
':yum:',
|
||||
':mask:',
|
||||
':sunglasses:',
|
||||
':dizzy_face:',
|
||||
':imp:',
|
||||
':smiling_imp:',
|
||||
':neutral_face:',
|
||||
':no_mouth:',
|
||||
':innocent:',
|
||||
':alien:',
|
||||
':yellow_heart:',
|
||||
':blue_heart:',
|
||||
':purple_heart:',
|
||||
':heart:',
|
||||
':green_heart:',
|
||||
':broken_heart:',
|
||||
':heartbeat:',
|
||||
':heartpulse:',
|
||||
':two_hearts:',
|
||||
':revolving_hearts:',
|
||||
':cupid:',
|
||||
':sparkling_heart:',
|
||||
':sparkles:',
|
||||
':star:',
|
||||
':star2:',
|
||||
':dizzy:',
|
||||
':boom:',
|
||||
':collision:',
|
||||
':anger:',
|
||||
':exclamation:',
|
||||
':question:',
|
||||
':grey_exclamation:',
|
||||
':grey_question:',
|
||||
':zzz:',
|
||||
':dash:',
|
||||
':sweat_drops:',
|
||||
':notes:',
|
||||
':musical_note:',
|
||||
':fire:',
|
||||
':hankey:',
|
||||
':poop:',
|
||||
':shit:',
|
||||
':+1:',
|
||||
':thumbsup:',
|
||||
':-1:',
|
||||
':thumbsdown:',
|
||||
':ok_hand:',
|
||||
':punch:',
|
||||
':facepunch:',
|
||||
':fist:',
|
||||
':v:',
|
||||
':wave:',
|
||||
':hand:',
|
||||
':raised_hand:',
|
||||
':open_hands:',
|
||||
':point_up:',
|
||||
':point_down:',
|
||||
':point_left:',
|
||||
':point_right:',
|
||||
':raised_hands:',
|
||||
':pray:',
|
||||
':point_up_2:',
|
||||
':clap:',
|
||||
':muscle:',
|
||||
':metal:',
|
||||
':fu:',
|
||||
':runner:',
|
||||
':running:',
|
||||
':couple:',
|
||||
':family:',
|
||||
':two_men_holding_hands:',
|
||||
':two_women_holding_hands:',
|
||||
':dancer:',
|
||||
':dancers:',
|
||||
':ok_woman:',
|
||||
':no_good:',
|
||||
':information_desk_person:',
|
||||
':raising_hand:',
|
||||
':bride_with_veil:',
|
||||
':person_with_pouting_face:',
|
||||
':person_frowning:',
|
||||
':bow:',
|
||||
':couplekiss:',
|
||||
':couple_with_heart:',
|
||||
':massage:',
|
||||
':haircut:',
|
||||
':nail_care:',
|
||||
':boy:',
|
||||
':girl:',
|
||||
':woman:',
|
||||
':man:',
|
||||
':baby:',
|
||||
':older_woman:',
|
||||
':older_man:',
|
||||
':person_with_blond_hair:',
|
||||
':man_with_gua_pi_mao:',
|
||||
':man_with_turban:',
|
||||
':construction_worker:',
|
||||
':cop:',
|
||||
':angel:',
|
||||
':princess:',
|
||||
':smiley_cat:',
|
||||
':smile_cat:',
|
||||
':heart_eyes_cat:',
|
||||
':kissing_cat:',
|
||||
':smirk_cat:',
|
||||
':scream_cat:',
|
||||
':crying_cat_face:',
|
||||
':joy_cat:',
|
||||
':pouting_cat:',
|
||||
':japanese_ogre:',
|
||||
':japanese_goblin:',
|
||||
':see_no_evil:',
|
||||
':hear_no_evil:',
|
||||
':speak_no_evil:',
|
||||
':guardsman:',
|
||||
':skull:',
|
||||
':feet:',
|
||||
':lips:',
|
||||
':kiss:',
|
||||
':droplet:',
|
||||
':ear:',
|
||||
':eyes:',
|
||||
':nose:',
|
||||
':tongue:',
|
||||
':love_letter:',
|
||||
':bust_in_silhouette:',
|
||||
':busts_in_silhouette:',
|
||||
':speech_balloon:',
|
||||
':thought_balloon:',
|
||||
':feelsgood:',
|
||||
':finnadie:',
|
||||
':goberserk:',
|
||||
':godmode:',
|
||||
':hurtrealbad:',
|
||||
':rage1:',
|
||||
':rage2:',
|
||||
':rage3:',
|
||||
':rage4:',
|
||||
':suspect:',
|
||||
':trollface:',
|
||||
':sunny:',
|
||||
':umbrella:',
|
||||
':cloud:',
|
||||
':snowflake:',
|
||||
':snowman:',
|
||||
':zap:',
|
||||
':cyclone:',
|
||||
':foggy:',
|
||||
':ocean:',
|
||||
':cat:',
|
||||
':dog:',
|
||||
':mouse:',
|
||||
':hamster:',
|
||||
':rabbit:',
|
||||
':wolf:',
|
||||
':frog:',
|
||||
':tiger:',
|
||||
':koala:',
|
||||
':bear:',
|
||||
':pig:',
|
||||
':pig_nose:',
|
||||
':cow:',
|
||||
':boar:',
|
||||
':monkey_face:',
|
||||
':monkey:',
|
||||
':horse:',
|
||||
':racehorse:',
|
||||
':camel:',
|
||||
':sheep:',
|
||||
':elephant:',
|
||||
':panda_face:',
|
||||
':snake:',
|
||||
':bird:',
|
||||
':baby_chick:',
|
||||
':hatched_chick:',
|
||||
':hatching_chick:',
|
||||
':chicken:',
|
||||
':penguin:',
|
||||
':turtle:',
|
||||
':bug:',
|
||||
':honeybee:',
|
||||
':ant:',
|
||||
':beetle:',
|
||||
':snail:',
|
||||
':octopus:',
|
||||
':tropical_fish:',
|
||||
':fish:',
|
||||
':whale:',
|
||||
':whale2:',
|
||||
':dolphin:',
|
||||
':cow2:',
|
||||
':ram:',
|
||||
':rat:',
|
||||
':water_buffalo:',
|
||||
':tiger2:',
|
||||
':rabbit2:',
|
||||
':dragon:',
|
||||
':goat:',
|
||||
':rooster:',
|
||||
':dog2:',
|
||||
':pig2:',
|
||||
':mouse2:',
|
||||
':ox:',
|
||||
':dragon_face:',
|
||||
':blowfish:',
|
||||
':crocodile:',
|
||||
':dromedary_camel:',
|
||||
':leopard:',
|
||||
':cat2:',
|
||||
':poodle:',
|
||||
':paw_prints:',
|
||||
':bouquet:',
|
||||
':cherry_blossom:',
|
||||
':tulip:',
|
||||
':four_leaf_clover:',
|
||||
':rose:',
|
||||
':sunflower:',
|
||||
':hibiscus:',
|
||||
':maple_leaf:',
|
||||
':leaves:',
|
||||
':fallen_leaf:',
|
||||
':herb:',
|
||||
':mushroom:',
|
||||
':cactus:',
|
||||
':palm_tree:',
|
||||
':evergreen_tree:',
|
||||
':deciduous_tree:',
|
||||
':chestnut:',
|
||||
':seedling:',
|
||||
':blossom:',
|
||||
':ear_of_rice:',
|
||||
':shell:',
|
||||
':globe_with_meridians:',
|
||||
':sun_with_face:',
|
||||
':full_moon_with_face:',
|
||||
':new_moon_with_face:',
|
||||
':new_moon:',
|
||||
':waxing_crescent_moon:',
|
||||
':first_quarter_moon:',
|
||||
':waxing_gibbous_moon:',
|
||||
':full_moon:',
|
||||
':waning_gibbous_moon:',
|
||||
':last_quarter_moon:',
|
||||
':waning_crescent_moon:',
|
||||
':last_quarter_moon_with_face:',
|
||||
':first_quarter_moon_with_face:',
|
||||
':crescent_moon:',
|
||||
':earth_africa:',
|
||||
':earth_americas:',
|
||||
':earth_asia:',
|
||||
':volcano:',
|
||||
':milky_way:',
|
||||
':partly_sunny:',
|
||||
':octocat:',
|
||||
':squirrel:',
|
||||
':bamboo:',
|
||||
':gift_heart:',
|
||||
':dolls:',
|
||||
':school_satchel:',
|
||||
':mortar_board:',
|
||||
':flags:',
|
||||
':fireworks:',
|
||||
':sparkler:',
|
||||
':wind_chime:',
|
||||
':rice_scene:',
|
||||
':jack_o_lantern:',
|
||||
':ghost:',
|
||||
':santa:',
|
||||
':christmas_tree:',
|
||||
':gift:',
|
||||
':bell:',
|
||||
':no_bell:',
|
||||
':tanabata_tree:',
|
||||
':tada:',
|
||||
':confetti_ball:',
|
||||
':balloon:',
|
||||
':crystal_ball:',
|
||||
':cd:',
|
||||
':dvd:',
|
||||
':floppy_disk:',
|
||||
':camera:',
|
||||
':video_camera:',
|
||||
':movie_camera:',
|
||||
':computer:',
|
||||
':tv:',
|
||||
':iphone:',
|
||||
':phone:',
|
||||
':telephone:',
|
||||
':telephone_receiver:',
|
||||
':pager:',
|
||||
':fax:',
|
||||
':minidisc:',
|
||||
':vhs:',
|
||||
':sound:',
|
||||
':speaker:',
|
||||
':mute:',
|
||||
':loudspeaker:',
|
||||
':mega:',
|
||||
':hourglass:',
|
||||
':hourglass_flowing_sand:',
|
||||
':alarm_clock:',
|
||||
':watch:',
|
||||
':radio:',
|
||||
':satellite:',
|
||||
':loop:',
|
||||
':mag:',
|
||||
':mag_right:',
|
||||
':unlock:',
|
||||
':lock:',
|
||||
':lock_with_ink_pen:',
|
||||
':closed_lock_with_key:',
|
||||
':key:',
|
||||
':bulb:',
|
||||
':flashlight:',
|
||||
':high_brightness:',
|
||||
':low_brightness:',
|
||||
':electric_plug:',
|
||||
':battery:',
|
||||
':calling:',
|
||||
':email:',
|
||||
':mailbox:',
|
||||
':postbox:',
|
||||
':bath:',
|
||||
':bathtub:',
|
||||
':shower:',
|
||||
':toilet:',
|
||||
':wrench:',
|
||||
':nut_and_bolt:',
|
||||
':hammer:',
|
||||
':seat:',
|
||||
':moneybag:',
|
||||
':yen:',
|
||||
':dollar:',
|
||||
':pound:',
|
||||
':euro:',
|
||||
':credit_card:',
|
||||
':money_with_wings:',
|
||||
':e-mail:',
|
||||
':inbox_tray:',
|
||||
':outbox_tray:',
|
||||
':envelope:',
|
||||
':incoming_envelope:',
|
||||
':postal_horn:',
|
||||
':mailbox_closed:',
|
||||
':mailbox_with_mail:',
|
||||
':mailbox_with_no_mail:',
|
||||
':package:',
|
||||
':door:',
|
||||
':smoking:',
|
||||
':bomb:',
|
||||
':gun:',
|
||||
':hocho:',
|
||||
':pill:',
|
||||
':syringe:',
|
||||
':page_facing_up:',
|
||||
':page_with_curl:',
|
||||
':bookmark_tabs:',
|
||||
':bar_chart:',
|
||||
':chart_with_upwards_trend:',
|
||||
':chart_with_downwards_trend:',
|
||||
':scroll:',
|
||||
':clipboard:',
|
||||
':calendar:',
|
||||
':date:',
|
||||
':card_index:',
|
||||
':file_folder:',
|
||||
':open_file_folder:',
|
||||
':scissors:',
|
||||
':pushpin:',
|
||||
':paperclip:',
|
||||
':black_nib:',
|
||||
':pencil2:',
|
||||
':straight_ruler:',
|
||||
':triangular_ruler:',
|
||||
':closed_book:',
|
||||
':green_book:',
|
||||
':blue_book:',
|
||||
':orange_book:',
|
||||
':notebook:',
|
||||
':notebook_with_decorative_cover:',
|
||||
':ledger:',
|
||||
':books:',
|
||||
':bookmark:',
|
||||
':name_badge:',
|
||||
':microscope:',
|
||||
':telescope:',
|
||||
':newspaper:',
|
||||
':football:',
|
||||
':basketball:',
|
||||
':soccer:',
|
||||
':baseball:',
|
||||
':tennis:',
|
||||
':8ball:',
|
||||
':rugby_football:',
|
||||
':bowling:',
|
||||
':golf:',
|
||||
':mountain_bicyclist:',
|
||||
':bicyclist:',
|
||||
':horse_racing:',
|
||||
':snowboarder:',
|
||||
':swimmer:',
|
||||
':surfer:',
|
||||
':ski:',
|
||||
':spades:',
|
||||
':hearts:',
|
||||
':clubs:',
|
||||
':diamonds:',
|
||||
':gem:',
|
||||
':ring:',
|
||||
':trophy:',
|
||||
':musical_score:',
|
||||
':musical_keyboard:',
|
||||
':violin:',
|
||||
':space_invader:',
|
||||
':video_game:',
|
||||
':black_joker:',
|
||||
':flower_playing_cards:',
|
||||
':game_die:',
|
||||
':dart:',
|
||||
':mahjong:',
|
||||
':clapper:',
|
||||
':memo:',
|
||||
':pencil:',
|
||||
':book:',
|
||||
':art:',
|
||||
':microphone:',
|
||||
':headphones:',
|
||||
':trumpet:',
|
||||
':saxophone:',
|
||||
':guitar:',
|
||||
':shoe:',
|
||||
':sandal:',
|
||||
':high_heel:',
|
||||
':lipstick:',
|
||||
':boot:',
|
||||
':shirt:',
|
||||
':tshirt:',
|
||||
':necktie:',
|
||||
':womans_clothes:',
|
||||
':dress:',
|
||||
':running_shirt_with_sash:',
|
||||
':jeans:',
|
||||
':kimono:',
|
||||
':bikini:',
|
||||
':ribbon:',
|
||||
':tophat:',
|
||||
':crown:',
|
||||
':womans_hat:',
|
||||
':mans_shoe:',
|
||||
':closed_umbrella:',
|
||||
':briefcase:',
|
||||
':handbag:',
|
||||
':pouch:',
|
||||
':purse:',
|
||||
':eyeglasses:',
|
||||
':fishing_pole_and_fish:',
|
||||
':coffee:',
|
||||
':tea:',
|
||||
':sake:',
|
||||
':baby_bottle:',
|
||||
':beer:',
|
||||
':beers:',
|
||||
':cocktail:',
|
||||
':tropical_drink:',
|
||||
':wine_glass:',
|
||||
':fork_and_knife:',
|
||||
':pizza:',
|
||||
':hamburger:',
|
||||
':fries:',
|
||||
':poultry_leg:',
|
||||
':meat_on_bone:',
|
||||
':spaghetti:',
|
||||
':curry:',
|
||||
':fried_shrimp:',
|
||||
':bento:',
|
||||
':sushi:',
|
||||
':fish_cake:',
|
||||
':rice_ball:',
|
||||
':rice_cracker:',
|
||||
':rice:',
|
||||
':ramen:',
|
||||
':stew:',
|
||||
':oden:',
|
||||
':dango:',
|
||||
':egg:',
|
||||
':bread:',
|
||||
':doughnut:',
|
||||
':custard:',
|
||||
':icecream:',
|
||||
':ice_cream:',
|
||||
':shaved_ice:',
|
||||
':birthday:',
|
||||
':cake:',
|
||||
':cookie:',
|
||||
':chocolate_bar:',
|
||||
':candy:',
|
||||
':lollipop:',
|
||||
':honey_pot:',
|
||||
':apple:',
|
||||
':green_apple:',
|
||||
':tangerine:',
|
||||
':lemon:',
|
||||
':cherries:',
|
||||
':grapes:',
|
||||
':watermelon:',
|
||||
':strawberry:',
|
||||
':peach:',
|
||||
':melon:',
|
||||
':banana:',
|
||||
':pear:',
|
||||
':pineapple:',
|
||||
':sweet_potato:',
|
||||
':eggplant:',
|
||||
':tomato:',
|
||||
':corn:',
|
||||
':house:',
|
||||
':house_with_garden:',
|
||||
':school:',
|
||||
':office:',
|
||||
':post_office:',
|
||||
':hospital:',
|
||||
':bank:',
|
||||
':convenience_store:',
|
||||
':love_hotel:',
|
||||
':hotel:',
|
||||
':wedding:',
|
||||
':church:',
|
||||
':department_store:',
|
||||
':european_post_office:',
|
||||
':city_sunrise:',
|
||||
':city_sunset:',
|
||||
':japanese_castle:',
|
||||
':european_castle:',
|
||||
':tent:',
|
||||
':factory:',
|
||||
':tokyo_tower:',
|
||||
':japan:',
|
||||
':mount_fuji:',
|
||||
':sunrise_over_mountains:',
|
||||
':sunrise:',
|
||||
':stars:',
|
||||
':statue_of_liberty:',
|
||||
':bridge_at_night:',
|
||||
':carousel_horse:',
|
||||
':rainbow:',
|
||||
':ferris_wheel:',
|
||||
':fountain:',
|
||||
':roller_coaster:',
|
||||
':ship:',
|
||||
':speedboat:',
|
||||
':boat:',
|
||||
':sailboat:',
|
||||
':rowboat:',
|
||||
':anchor:',
|
||||
':rocket:',
|
||||
':airplane:',
|
||||
':helicopter:',
|
||||
':steam_locomotive:',
|
||||
':tram:',
|
||||
':mountain_railway:',
|
||||
':bike:',
|
||||
':aerial_tramway:',
|
||||
':suspension_railway:',
|
||||
':mountain_cableway:',
|
||||
':tractor:',
|
||||
':blue_car:',
|
||||
':oncoming_automobile:',
|
||||
':car:',
|
||||
':red_car:',
|
||||
':taxi:',
|
||||
':oncoming_taxi:',
|
||||
':articulated_lorry:',
|
||||
':bus:',
|
||||
':oncoming_bus:',
|
||||
':rotating_light:',
|
||||
':police_car:',
|
||||
':oncoming_police_car:',
|
||||
':fire_engine:',
|
||||
':ambulance:',
|
||||
':minibus:',
|
||||
':truck:',
|
||||
':train:',
|
||||
':station:',
|
||||
':train2:',
|
||||
':bullettrain_front:',
|
||||
':bullettrain_side:',
|
||||
':light_rail:',
|
||||
':monorail:',
|
||||
':railway_car:',
|
||||
':trolleybus:',
|
||||
':ticket:',
|
||||
':fuelpump:',
|
||||
':vertical_traffic_light:',
|
||||
':traffic_light:',
|
||||
':warning:',
|
||||
':construction:',
|
||||
':beginner:',
|
||||
':atm:',
|
||||
':slot_machine:',
|
||||
':busstop:',
|
||||
':barber:',
|
||||
':hotsprings:',
|
||||
':checkered_flag:',
|
||||
':crossed_flags:',
|
||||
':izakaya_lantern:',
|
||||
':moyai:',
|
||||
':circus_tent:',
|
||||
':performing_arts:',
|
||||
':round_pushpin:',
|
||||
':triangular_flag_on_post:',
|
||||
':jp:',
|
||||
':kr:',
|
||||
':cn:',
|
||||
':us:',
|
||||
':fr:',
|
||||
':es:',
|
||||
':it:',
|
||||
':ru:',
|
||||
':gb:',
|
||||
':uk:',
|
||||
':de:',
|
||||
':one:',
|
||||
':two:',
|
||||
':three:',
|
||||
':four:',
|
||||
':five:',
|
||||
':six:',
|
||||
':seven:',
|
||||
':eight:',
|
||||
':nine:',
|
||||
':keycap_ten:',
|
||||
':1234:',
|
||||
':zero:',
|
||||
':hash:',
|
||||
':symbols:',
|
||||
':arrow_backward:',
|
||||
':arrow_down:',
|
||||
':arrow_forward:',
|
||||
':arrow_left:',
|
||||
':capital_abcd:',
|
||||
':abcd:',
|
||||
':abc:',
|
||||
':arrow_lower_left:',
|
||||
':arrow_lower_right:',
|
||||
':arrow_right:',
|
||||
':arrow_up:',
|
||||
':arrow_upper_left:',
|
||||
':arrow_upper_right:',
|
||||
':arrow_double_down:',
|
||||
':arrow_double_up:',
|
||||
':arrow_down_small:',
|
||||
':arrow_heading_down:',
|
||||
':arrow_heading_up:',
|
||||
':leftwards_arrow_with_hook:',
|
||||
':arrow_right_hook:',
|
||||
':left_right_arrow:',
|
||||
':arrow_up_down:',
|
||||
':arrow_up_small:',
|
||||
':arrows_clockwise:',
|
||||
':arrows_counterclockwise:',
|
||||
':rewind:',
|
||||
':fast_forward:',
|
||||
':information_source:',
|
||||
':ok:',
|
||||
':twisted_rightwards_arrows:',
|
||||
':repeat:',
|
||||
':repeat_one:',
|
||||
':new:',
|
||||
':top:',
|
||||
':up:',
|
||||
':cool:',
|
||||
':free:',
|
||||
':ng:',
|
||||
':cinema:',
|
||||
':koko:',
|
||||
':signal_strength:',
|
||||
':u5272:',
|
||||
':u5408:',
|
||||
':u55b6:',
|
||||
':u6307:',
|
||||
':u6708:',
|
||||
':u6709:',
|
||||
':u6e80:',
|
||||
':u7121:',
|
||||
':u7533:',
|
||||
':u7a7a:',
|
||||
':u7981:',
|
||||
':sa:',
|
||||
':restroom:',
|
||||
':mens:',
|
||||
':womens:',
|
||||
':baby_symbol:',
|
||||
':no_smoking:',
|
||||
':parking:',
|
||||
':wheelchair:',
|
||||
':metro:',
|
||||
':baggage_claim:',
|
||||
':accept:',
|
||||
':wc:',
|
||||
':potable_water:',
|
||||
':put_litter_in_its_place:',
|
||||
':secret:',
|
||||
':congratulations:',
|
||||
':m:',
|
||||
':passport_control:',
|
||||
':left_luggage:',
|
||||
':customs:',
|
||||
':ideograph_advantage:',
|
||||
':cl:',
|
||||
':sos:',
|
||||
':id:',
|
||||
':no_entry_sign:',
|
||||
':underage:',
|
||||
':no_mobile_phones:',
|
||||
':do_not_litter:',
|
||||
':non-potable_water:',
|
||||
':no_bicycles:',
|
||||
':no_pedestrians:',
|
||||
':children_crossing:',
|
||||
':no_entry:',
|
||||
':eight_spoked_asterisk:',
|
||||
':sparkle:',
|
||||
':eight_pointed_black_star:',
|
||||
':heart_decoration:',
|
||||
':vs:',
|
||||
':vibration_mode:',
|
||||
':mobile_phone_off:',
|
||||
':chart:',
|
||||
':currency_exchange:',
|
||||
':aries:',
|
||||
':taurus:',
|
||||
':gemini:',
|
||||
':cancer:',
|
||||
':leo:',
|
||||
':virgo:',
|
||||
':libra:',
|
||||
':scorpius:',
|
||||
':sagittarius:',
|
||||
':capricorn:',
|
||||
':aquarius:',
|
||||
':pisces:',
|
||||
':ophiuchus:',
|
||||
':six_pointed_star:',
|
||||
':negative_squared_cross_mark:',
|
||||
':a:',
|
||||
':b:',
|
||||
':ab:',
|
||||
':o2:',
|
||||
':diamond_shape_with_a_dot_inside:',
|
||||
':recycle:',
|
||||
':end:',
|
||||
':back:',
|
||||
':on:',
|
||||
':soon:',
|
||||
':clock1:',
|
||||
':clock130:',
|
||||
':clock10:',
|
||||
':clock1030:',
|
||||
':clock11:',
|
||||
':clock1130:',
|
||||
':clock12:',
|
||||
':clock1230:',
|
||||
':clock2:',
|
||||
':clock230:',
|
||||
':clock3:',
|
||||
':clock330:',
|
||||
':clock4:',
|
||||
':clock430:',
|
||||
':clock5:',
|
||||
':clock530:',
|
||||
':clock6:',
|
||||
':clock630:',
|
||||
':clock7:',
|
||||
':clock730:',
|
||||
':clock8:',
|
||||
':clock830:',
|
||||
':clock9:',
|
||||
':clock930:',
|
||||
':heavy_dollar_sign:',
|
||||
':copyright:',
|
||||
':registered:',
|
||||
':tm:',
|
||||
':x:',
|
||||
':heavy_exclamation_mark:',
|
||||
':bangbang:',
|
||||
':interrobang:',
|
||||
':o:',
|
||||
':heavy_multiplication_x:',
|
||||
':heavy_plus_sign:',
|
||||
':heavy_minus_sign:',
|
||||
':heavy_division_sign:',
|
||||
':white_flower:',
|
||||
':100:',
|
||||
':heavy_check_mark:',
|
||||
':ballot_box_with_check:',
|
||||
':radio_button:',
|
||||
':link:',
|
||||
':curly_loop:',
|
||||
':wavy_dash:',
|
||||
':part_alternation_mark:',
|
||||
':trident:',
|
||||
':black_small_square:',
|
||||
':white_small_square:',
|
||||
':black_medium_small_square:',
|
||||
':white_medium_small_square:',
|
||||
':black_medium_square:',
|
||||
':white_medium_square:',
|
||||
':white_large_square:',
|
||||
':white_check_mark:',
|
||||
':black_square_button:',
|
||||
':white_square_button:',
|
||||
':black_circle:',
|
||||
':white_circle:',
|
||||
':red_circle:',
|
||||
':large_blue_circle:',
|
||||
':large_blue_diamond:',
|
||||
':large_orange_diamond:',
|
||||
':small_blue_diamond:',
|
||||
':small_orange_diamond:',
|
||||
':small_red_triangle:',
|
||||
':small_red_triangle_down:',
|
||||
':shipit:'
|
||||
]
|
||||
};
|
||||
|
||||
// Add all emoji in a dropdown
|
||||
$.extend(true, $.trumbowyg, {
|
||||
langs: {
|
||||
// jshint camelcase:false
|
||||
en: {
|
||||
emoji: 'Add an emoji'
|
||||
},
|
||||
fr: {
|
||||
emoji: 'Ajouter un emoji'
|
||||
},
|
||||
zh_cn: {
|
||||
emoji: '添加表情'
|
||||
},
|
||||
ru: {
|
||||
emoji: 'Вставить emoji'
|
||||
},
|
||||
ja: {
|
||||
emoji: '絵文字の挿入'
|
||||
},
|
||||
tr: {
|
||||
emoji: 'Emoji ekle'
|
||||
}
|
||||
},
|
||||
// jshint camelcase:true
|
||||
plugins: {
|
||||
emoji: {
|
||||
init: function (trumbowyg) {
|
||||
trumbowyg.o.plugins.emoji = trumbowyg.o.plugins.emoji || defaultOptions;
|
||||
var emojiBtnDef = {
|
||||
dropdown: buildDropdown(trumbowyg)
|
||||
};
|
||||
trumbowyg.addBtnDef('emoji', emojiBtnDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function buildDropdown(trumbowyg) {
|
||||
var dropdown = [];
|
||||
|
||||
$.each(trumbowyg.o.plugins.emoji.emojiList, function (i, emoji) {
|
||||
if ($.isArray(emoji)) { // Custom emoji behaviour
|
||||
var emojiCode = emoji[0],
|
||||
emojiUrl = emoji[1],
|
||||
emojiHtml = '<img src="' + emojiUrl + '" alt="' + emojiCode + '">',
|
||||
customEmojiBtnName = 'emoji-' + emojiCode.replace(/:/g, ''),
|
||||
customEmojiBtnDef = {
|
||||
hasIcon: false,
|
||||
text: emojiHtml,
|
||||
fn: function () {
|
||||
trumbowyg.execCmd('insertImage', emojiUrl, false, true);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
trumbowyg.addBtnDef(customEmojiBtnName, customEmojiBtnDef);
|
||||
dropdown.push(customEmojiBtnName);
|
||||
} else { // Default behaviour
|
||||
var btn = emoji.replace(/:/g, ''),
|
||||
defaultEmojiBtnName = 'emoji-' + btn,
|
||||
defaultEmojiBtnDef = {
|
||||
text: emoji,
|
||||
fn: function () {
|
||||
trumbowyg.execCmd('insertText', emoji);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
trumbowyg.addBtnDef(defaultEmojiBtnName, defaultEmojiBtnDef);
|
||||
dropdown.push(defaultEmojiBtnName);
|
||||
}
|
||||
});
|
||||
|
||||
return dropdown;
|
||||
}
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Default stylesheet for Trumbowyg editor plugin
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.trumbowyg-dropdown-emoji {
|
||||
width: 265px;
|
||||
padding: 7px 0 7px 5px;
|
||||
height: 200px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.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,47 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Trumbowyg plugin stylesheet
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.trumbowyg-dropdown-emoji {
|
||||
width: 265px;
|
||||
padding: 7px 0 7px 5px;
|
||||
height: 200px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden; }
|
||||
|
||||
.trumbowyg-dropdown-emoji svg {
|
||||
display: none !important; }
|
||||
|
||||
.trumbowyg-dropdown-emoji button {
|
||||
display: block;
|
||||
position: relative;
|
||||
float: left;
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
padding: 0;
|
||||
margin: 2px;
|
||||
line-height: 24px;
|
||||
text-align: center; }
|
||||
.trumbowyg-dropdown-emoji button:hover::after, .trumbowyg-dropdown-emoji button: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,2 @@
|
||||
/** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
|
||||
.trumbowyg-dropdown-emoji{width:265px;padding:7px 0 7px 5px;height:200px;overflow-y:scroll;overflow-x:hidden}.trumbowyg-dropdown-emoji svg{display:none!important}.trumbowyg-dropdown-emoji button{display:block;position:relative;float:left;height:26px;width:26px;padding:0;margin:2px;line-height:24px;text-align:center}.trumbowyg-dropdown-emoji button:focus::after,.trumbowyg-dropdown-emoji button:hover::after{display:block;position:absolute;top:-5px;left:-5px;height:27px;width:27px;background:inherit;box-shadow:#000 0 0 2px;z-index:10;background-color:transparent}.trumbowyg .emoji{width:22px;height:22px;display:inline-block}
|
||||
@@ -0,0 +1,73 @@
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
$.extend(true, $.trumbowyg, {
|
||||
langs: {
|
||||
// jshint camelcase:false
|
||||
en: {
|
||||
fontFamily: 'Font'
|
||||
},
|
||||
fr: {
|
||||
fontFamily: 'Police'
|
||||
},
|
||||
nl: {
|
||||
fontFamily: 'Lettertype'
|
||||
},
|
||||
tr: {
|
||||
fontFamily: 'Yazı Tipi'
|
||||
}
|
||||
}
|
||||
});
|
||||
// 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 = trumbowyg.o.plugins.fontfamily || defaultOptions;
|
||||
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 @@
|
||||
!function(a){"use strict";function n(n){var i=[];return a.each(n.o.plugins.fontfamily.fontList,function(a,e){n.addBtnDef("fontfamily_"+a,{title:'<span style="font-family: '+e.family+';">'+e.name+"</span>",hasIcon:!1,fn:function(){n.execCmd("fontName",e.family,!0)}}),i.push("fontfamily_"+a)}),i}a.extend(!0,a.trumbowyg,{langs:{en:{fontFamily:"Font"},fr:{fontFamily:"Police"},nl:{fontFamily:"Lettertype"},tr:{fontFamily:"Yazı Tipi"}}});var i={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"}]};a.extend(!0,a.trumbowyg,{plugins:{fontfamily:{init:function(a){a.o.plugins.fontfamily=a.o.plugins.fontfamily||i,a.addBtnDef("fontfamily",{dropdown:n(a),hasIcon:!1,text:a.lang.fontFamily})}}}})}(jQuery);
|
||||
@@ -0,0 +1,117 @@
|
||||
(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'
|
||||
}
|
||||
},
|
||||
fr: {
|
||||
fontsize: 'Taille de la police',
|
||||
fontsizes: {
|
||||
'x-small': 'Très petit',
|
||||
'small': 'Petit',
|
||||
'medium': 'Normal',
|
||||
'large': 'Grand',
|
||||
'x-large': 'Très grand',
|
||||
'custom': 'Douane'
|
||||
}
|
||||
},
|
||||
nl: {
|
||||
fontsize: 'Lettergrootte',
|
||||
fontsizes: {
|
||||
'x-small': 'Extra klein',
|
||||
'small': 'Klein',
|
||||
'medium': 'Normaal',
|
||||
'large': 'Groot',
|
||||
'x-large': 'Extra groot',
|
||||
'custom': 'Tilpasset'
|
||||
}
|
||||
},
|
||||
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': 'Görenek'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// jshint camelcase:true
|
||||
|
||||
// Add dropdown with font sizes
|
||||
$.extend(true, $.trumbowyg, {
|
||||
plugins: {
|
||||
fontsize: {
|
||||
init: function (trumbowyg) {
|
||||
trumbowyg.addBtnDef('fontsize', {
|
||||
dropdown: buildDropdown(trumbowyg)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function buildDropdown(trumbowyg) {
|
||||
var dropdown = [];
|
||||
var sizes = ['x-small', 'small', 'medium', 'large', 'x-large'];
|
||||
|
||||
$.each(sizes, function (index, size) {
|
||||
trumbowyg.addBtnDef('fontsize_' + size, {
|
||||
text: '<span style="font-size: ' + size + ';">' + trumbowyg.lang.fontsizes[size] + '</span>',
|
||||
hasIcon: false,
|
||||
fn: function () {
|
||||
trumbowyg.execCmd('fontSize', index + 1, true);
|
||||
}
|
||||
});
|
||||
dropdown.push('fontsize_' + size);
|
||||
});
|
||||
|
||||
var freeSizeButtonName = 'fontsize_custom',
|
||||
freeSizeBtnDef = {
|
||||
fn: function () {
|
||||
trumbowyg.openModalInsert('Custom Font Size',
|
||||
{
|
||||
size: {
|
||||
label: 'Font Size',
|
||||
value: '48px'
|
||||
}
|
||||
},
|
||||
function (values) {
|
||||
var text = trumbowyg.range.startContainer.parentElement;
|
||||
var selectedText = trumbowyg.getRangeText();
|
||||
if ($(text).html() === selectedText) {
|
||||
$(text).css('font-size', values.size);
|
||||
} else {
|
||||
trumbowyg.range.deleteContents();
|
||||
var html = '<span style="font-size: ' + values.size + ';">' + selectedText + '</span>';
|
||||
var node = $(html)[0];
|
||||
trumbowyg.range.insertNode(node);
|
||||
}
|
||||
trumbowyg.saveRange();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
},
|
||||
text: '<span style="font-size: medium;">' + trumbowyg.lang.fontsizes.custom + '</span>',
|
||||
hasIcon: false
|
||||
};
|
||||
trumbowyg.addBtnDef(freeSizeButtonName, freeSizeBtnDef);
|
||||
dropdown.push(freeSizeButtonName);
|
||||
|
||||
return dropdown;
|
||||
}
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,82 @@
|
||||
/* globals Prism */
|
||||
(function ($, Prism) {
|
||||
'use strict';
|
||||
|
||||
// My plugin default options
|
||||
var defaultOptions = {};
|
||||
|
||||
function highlightIt(text, language) {
|
||||
return [
|
||||
'<pre class="language-' + language + '">',
|
||||
'<code class="language-' + language + '">' + Prism.highlight(text, Prism.languages[language]) + '</code>',
|
||||
'</pre>',
|
||||
].join('');
|
||||
}
|
||||
|
||||
// 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">',
|
||||
(function () {
|
||||
var options = '';
|
||||
|
||||
for (var lang in Prism.languages) {
|
||||
if (Prism.languages[lang].comment) {
|
||||
options += '<option value="' + lang + '">' + lang + '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
})(),
|
||||
' </select>',
|
||||
'</div>',
|
||||
'<div class="' + trumbowyg.o.prefix + 'highlight-form-group">',
|
||||
' <textarea class="' + trumbowyg.o.prefix + 'highlight-form-control code"></textarea>',
|
||||
'</div>',
|
||||
].join('\n')),
|
||||
$language = $modal.find('.language'),
|
||||
$code = $modal.find('.code');
|
||||
|
||||
// Listen clicks on modal box buttons
|
||||
$modal.on('tbwconfirm', function () {
|
||||
trumbowyg.restoreRange();
|
||||
trumbowyg.execCmd('insertHTML', highlightIt($code.val(), $language.val()));
|
||||
trumbowyg.execCmd('insertHTML', '<p><br></p>');
|
||||
|
||||
trumbowyg.closeModal();
|
||||
});
|
||||
|
||||
$modal.on('tbwcancel', function () {
|
||||
trumbowyg.closeModal();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$.extend(true, $.trumbowyg, {
|
||||
// Add some translations
|
||||
langs: {
|
||||
en: {
|
||||
highlight: 'Code syntax highlight'
|
||||
}
|
||||
},
|
||||
// Add our plugin to Trumbowyg registred 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 @@
|
||||
!function(n,i){"use strict";function e(n,e){return['<pre class="language-'+e+'">','<code class="language-'+e+'">'+i.highlight(n,i.languages[e])+"</code>","</pre>"].join("")}function o(n){return{fn:function(){var o=n.openModal("Code",['<div class="'+n.o.prefix+'highlight-form-group">',' <select class="'+n.o.prefix+'highlight-form-control language">',function(){var n="";for(var e in i.languages)i.languages[e].comment&&(n+='<option value="'+e+'">'+e+"</option>");return n}()," </select>","</div>",'<div class="'+n.o.prefix+'highlight-form-group">',' <textarea class="'+n.o.prefix+'highlight-form-control code"></textarea>',"</div>"].join("\n")),t=o.find(".language"),g=o.find(".code");o.on("tbwconfirm",function(){n.restoreRange(),n.execCmd("insertHTML",e(g.val(),t.val())),n.execCmd("insertHTML","<p><br></p>"),n.closeModal()}),o.on("tbwcancel",function(){n.closeModal()})}}}var t={};n.extend(!0,n.trumbowyg,{langs:{en:{highlight:"Code syntax highlight"}},plugins:{highlight:{init:function(i){i.o.plugins.highlight=n.extend(!0,{},t,i.o.plugins.highlight||{}),i.addBtnDef("highlight",o(i))}}}})}(jQuery,Prism);
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Default stylesheet for Trumbowyg editor plugin
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.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,20 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Trumbowyg plugin stylesheet
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.trumbowyg-highlight-form-group {
|
||||
margin: 15px 10px; }
|
||||
.trumbowyg-highlight-form-group .trumbowyg-highlight-form-control {
|
||||
width: 100%;
|
||||
border: 1px solid #DEDEDE;
|
||||
font-size: 14px;
|
||||
padding: 7px; }
|
||||
.trumbowyg-highlight-form-group .trumbowyg-highlight-form-control.code {
|
||||
height: 200px; }
|
||||
@@ -0,0 +1,2 @@
|
||||
/** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
|
||||
.trumbowyg-highlight-form-group{margin:15px 10px}.trumbowyg-highlight-form-group .trumbowyg-highlight-form-control{width:100%;border:1px solid #DEDEDE;font-size:14px;padding:7px}.trumbowyg-highlight-form-group .trumbowyg-highlight-form-control.code{height:200px}
|
||||
@@ -0,0 +1,190 @@
|
||||
/*/* ===========================================================
|
||||
* 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: {
|
||||
de: {
|
||||
history: {
|
||||
redo: 'Wiederholen',
|
||||
undo: 'Rückgängig'
|
||||
}
|
||||
},
|
||||
en: {
|
||||
history: {
|
||||
redo: 'Redo',
|
||||
undo: 'Undo'
|
||||
}
|
||||
},
|
||||
fr: {
|
||||
history: {
|
||||
redo: 'Annuler',
|
||||
undo: 'Rétablir'
|
||||
}
|
||||
}
|
||||
},
|
||||
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 modifed 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);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,89 @@
|
||||
/*/* ===========================================================
|
||||
* 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: {
|
||||
en: {
|
||||
insertAudio: 'Insert Audio'
|
||||
},
|
||||
fr: {
|
||||
insertAudio: 'Insérer un son'
|
||||
},
|
||||
ru: {
|
||||
insertAudio: 'Вставить аудио'
|
||||
},
|
||||
ja: {
|
||||
insertAudio: '音声の挿入'
|
||||
},
|
||||
tr: {
|
||||
insertAudio: 'Ses Ekle'
|
||||
}
|
||||
},
|
||||
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 @@
|
||||
!function(e){"use strict";var r={src:{label:"URL",required:!0},autoplay:{label:"AutoPlay",required:!1,type:"checkbox"},muted:{label:"Muted",required:!1,type:"checkbox"},preload:{label:"preload options",required:!1}};e.extend(!0,e.trumbowyg,{langs:{en:{insertAudio:"Insert Audio"},fr:{insertAudio:"Insérer un son"},ru:{insertAudio:"Вставить аудио"},ja:{insertAudio:"音声の挿入"},tr:{insertAudio:"Ses Ekle"}},plugins:{insertAudio:{init:function(n){var t={fn:function(){var t=function(r){var t="<audio controls";r.src&&(t+=" src='"+r.src+"'"),r.autoplay&&(t+=" autoplay"),r.muted&&(t+=" muted"),r.preload&&(t+=" preload='"+r+"'"),t+="></audio>";var o=e(t)[0];return n.range.deleteContents(),n.range.insertNode(o),!0};n.openModalInsert(n.lang.insertAudio,r,t)}};n.addBtnDef("insertAudio",t)}}}})}(jQuery);
|
||||
@@ -0,0 +1,104 @@
|
||||
(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'
|
||||
}
|
||||
},
|
||||
fr: {
|
||||
lineheight: 'Hauteur de ligne',
|
||||
lineheights: {
|
||||
'0.9': 'Petit',
|
||||
'normal': 'Regular',
|
||||
'1.5': 'Grand',
|
||||
'2.0': 'Très grand'
|
||||
}
|
||||
},
|
||||
nl: {
|
||||
lineheight: 'Regelhoogte',
|
||||
lineheights: {
|
||||
'0.9': 'Klein',
|
||||
'normal': 'Normaal',
|
||||
'1.5': 'Groot',
|
||||
'2.0': 'Extra groot'
|
||||
}
|
||||
},
|
||||
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'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// jshint camelcase:true
|
||||
|
||||
// Add dropdown with font sizes
|
||||
$.extend(true, $.trumbowyg, {
|
||||
plugins: {
|
||||
lineheight: {
|
||||
init: function (trumbowyg) {
|
||||
trumbowyg.addBtnDef('lineheight', {
|
||||
dropdown: buildDropdown(trumbowyg)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Build the dropdown
|
||||
function buildDropdown(trumbowyg) {
|
||||
var dropdown = [];
|
||||
var sizes = ['0.9', 'normal', '1.5', '2.0'];
|
||||
|
||||
$.each(sizes, function(index, size) {
|
||||
trumbowyg.addBtnDef('lineheight_' + size, {
|
||||
text: '<span style="line-height: ' + size + ';">' + trumbowyg.lang.lineheights[size] + '</span>',
|
||||
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 @@
|
||||
!function(e){"use strict";function n(n){var i=[],l=["0.9","normal","1.5","2.0"];return e.each(l,function(l,r){n.addBtnDef("lineheight_"+r,{text:'<span style="line-height: '+r+';">'+n.lang.lineheights[r]+"</span>",hasIcon:!1,fn:function(){n.saveRange();var i=n.getRangeText();if(""!==i.replace(/\s/g,""))try{var l=t();e(l).css("lineHeight",r)}catch(a){}}}),i.push("lineheight_"+r)}),i}function t(){var e,n=null;return window.getSelection?(e=window.getSelection(),e.rangeCount&&(n=e.getRangeAt(0).commonAncestorContainer,1!==n.nodeType&&(n=n.parentNode))):(e=document.selection)&&"Control"!==e.type&&(n=e.createRange().parentElement()),n}e.extend(!0,e.trumbowyg,{langs:{en:{lineheight:"Line height",lineheights:{.9:"Small",normal:"Regular",1.5:"Large","2.0":"Extra large"}},fr:{lineheight:"Hauteur de ligne",lineheights:{.9:"Petit",normal:"Regular",1.5:"Grand","2.0":"Très grand"}},nl:{lineheight:"Regelhoogte",lineheights:{.9:"Klein",normal:"Normaal",1.5:"Groot","2.0":"Extra groot"}},tr:{lineheight:"Satır yüksekliği",lineheights:{.9:"Küçük",normal:"Normal",1.5:"Büyük","2.0":"Çok Büyük"}}}}),e.extend(!0,e.trumbowyg,{plugins:{lineheight:{init:function(e){e.addBtnDef("lineheight",{dropdown:n(e)})}}}})}(jQuery);
|
||||
@@ -0,0 +1,88 @@
|
||||
/* ===========================================================
|
||||
* trumbowyg.mathMl.js v1.0
|
||||
* MathML plugin for Trumbowyg
|
||||
* https://github.com/loclamor/Trumbowyg/tree/mathml-plugin/plugins/mathml
|
||||
* ===========================================================
|
||||
* Author : loclamor
|
||||
*/
|
||||
|
||||
/* globals MathJax */
|
||||
(function($) {
|
||||
'use strict';
|
||||
$.extend(true, $.trumbowyg, {
|
||||
langs: {
|
||||
en: {
|
||||
mathml: 'Insert Formulas',
|
||||
formulas: 'Formulas',
|
||||
inline: 'Inline'
|
||||
},
|
||||
fr: {
|
||||
mathml: 'Inserer une formule',
|
||||
formulas: 'Formule',
|
||||
inline: 'En ligne'
|
||||
},
|
||||
tr: {
|
||||
mathml: 'Formül Ekle',
|
||||
formulas: 'Formüller',
|
||||
inline: 'Satır içi'
|
||||
}
|
||||
},
|
||||
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 delimitor = v.inline ? '$' : '$$';
|
||||
if (trumbowyg.currentMathNode) {
|
||||
$(trumbowyg.currentMathNode).html(delimitor + ' ' + v.formulas + ' ' + delimitor).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') + '" >' + delimitor + ' ' + v.formulas + ' ' + delimitor + '</span>';
|
||||
var node = $(html)[0];
|
||||
node.onclick = function(e) {
|
||||
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 @@
|
||||
!function(e){"use strict";e.extend(!0,e.trumbowyg,{langs:{en:{mathml:"Insert Formulas",formulas:"Formulas",inline:"Inline"},fr:{mathml:"Inserer une formule",formulas:"Formule",inline:"En ligne"},tr:{mathml:"Formül Ekle",formulas:"Formüller",inline:"Satır içi"}},plugins:{mathml:{init:function(n){var t={fn:function(){n.saveRange();var t={formulas:{label:n.lang.formulas,required:!0,value:""},inline:{label:n.lang.inline,attributes:{checked:!0},type:"checkbox",required:!1}},a=function(l){var r=l.inline?"$":"$$";if(n.currentMathNode)e(n.currentMathNode).html(r+" "+l.formulas+" "+r).attr("formulas",l.formulas).attr("inline",l.inline?"true":"false");else{var i='<span class="mathMlContainer" contenteditable="false" formulas="'+l.formulas+'" inline="'+(l.inline?"true":"false")+'" >'+r+" "+l.formulas+" "+r+"</span>",u=e(i)[0];u.onclick=function(l){n.currentMathNode=this,t.formulas.value=e(this).attr("formulas"),"true"===e(this).attr("inline")?t.inline.attributes.checked=!0:delete t.inline.attributes.checked,n.openModalInsert(n.lang.mathml,t,a)},n.range.deleteContents(),n.range.insertNode(u)}return n.currentMathNode=!1,MathJax.Hub.Queue(["Typeset",MathJax.Hub]),!0};t.formulas.value=n.getRangeText(),t.inline.attributes.checked=!0,n.openModalInsert(n.lang.mathml,t,a)}};n.addBtnDef("mathml",t)}}}})}(jQuery);
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Default stylesheet for Trumbowyg editor plugin
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.mathMlContainer {
|
||||
|
||||
position: relative;
|
||||
|
||||
&[inline="false"] {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
pointer-events: none;
|
||||
&:after {
|
||||
content: '\270E';
|
||||
pointer-events: auto;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
background-color: #ffffffd4;
|
||||
cursor: pointer;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
box-shadow: 0 0 5px 5px #ffffffd4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Trumbowyg plugin stylesheet
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.mathMlContainer {
|
||||
position: relative; }
|
||||
.mathMlContainer[inline="false"] {
|
||||
display: block;
|
||||
width: 100%; }
|
||||
.mathMlContainer:hover {
|
||||
pointer-events: none; }
|
||||
.mathMlContainer:hover:after {
|
||||
content: '\270E';
|
||||
pointer-events: auto;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
background-color: #ffffffd4;
|
||||
cursor: pointer;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
box-shadow: 0 0 5px 5px #ffffffd4; }
|
||||
@@ -0,0 +1,2 @@
|
||||
/** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
|
||||
.mathMlContainer{position:relative}.mathMlContainer[inline=false]{display:block;width:100%}.mathMlContainer:hover{pointer-events:none}.mathMlContainer:hover:after{content:'\270E';pointer-events:auto;position:absolute;left:0;top:0;background-color:#fffd4;cursor:pointer;bottom:0;right:0;box-shadow:0 0 5px 5px #fffd4}
|
||||
@@ -0,0 +1,105 @@
|
||||
/* ===========================================================
|
||||
* 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: {
|
||||
en: {
|
||||
mention: 'Mention'
|
||||
},
|
||||
fr: {
|
||||
mention: 'Mentioner'
|
||||
},
|
||||
ru: {
|
||||
mention: 'Упомянуть'
|
||||
},
|
||||
tr: {
|
||||
mention: 'Bahset'
|
||||
}
|
||||
},
|
||||
|
||||
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 = [];
|
||||
|
||||
// Check if source is an array
|
||||
if (items.constructor === Array) {
|
||||
$.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 @@
|
||||
!function(n){"use strict";function t(t,o){var e=[];return t.constructor===Array&&n.each(t,function(n,t){var i="mention-"+n,r={hasIcon:!1,text:o.o.plugins.mention.formatDropdownItem(t),fn:function(){return o.execCmd("insertHTML",o.o.plugins.mention.formatResult(t)),!0}};o.addBtnDef(i,r),e.push(i)}),e}function o(n){return n.login}function e(n){return"@"+n.login+" "}var i={source:"",formatDropdownItem:o,formatResult:e};n.extend(!0,n.trumbowyg,{langs:{en:{mention:"Mention"},fr:{mention:"Mentioner"},ru:{mention:"Упомянуть"},tr:{mention:"Bahset"}},plugins:{mention:{init:function(o){o.o.plugins.mention=n.extend(!0,{},i,o.o.plugins.mention||{});var e={dropdown:t(o.o.plugins.mention.source,o)};o.addBtnDef("mention",e)}}}})}(jQuery);
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Default stylesheet for Trumbowyg editor plugin
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.trumbowyg-dropdown-mention {
|
||||
height: calc(75%);
|
||||
width: 300px;
|
||||
max-width: 300px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
|
||||
svg {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
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,32 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Trumbowyg plugin stylesheet
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.trumbowyg-dropdown-mention {
|
||||
height: calc(75%);
|
||||
width: 300px;
|
||||
max-width: 300px;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden; }
|
||||
.trumbowyg-dropdown-mention svg {
|
||||
display: none !important; }
|
||||
.trumbowyg-dropdown-mention button {
|
||||
position: relative;
|
||||
white-space: nowrap; }
|
||||
.trumbowyg-dropdown-mention button:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 15%;
|
||||
height: 100%;
|
||||
background-size: 100%;
|
||||
background-image: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, #ffffff 80%, #ffffff 100%);
|
||||
pointer-events: none; }
|
||||
@@ -0,0 +1,2 @@
|
||||
/** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
|
||||
.trumbowyg-dropdown-mention{height:calc(75%);width:300px;max-width:300px;overflow-y:scroll;overflow-x:hidden}.trumbowyg-dropdown-mention svg{display:none!important}.trumbowyg-dropdown-mention button{position:relative;white-space:nowrap}.trumbowyg-dropdown-mention button:after{content:"";position:absolute;top:0;right:0;width:15%;height:100%;background-size:100%;background-image:linear-gradient(to right,rgba(255,255,255,0) 0,#fff 80%,#fff 100%);pointer-events:none}
|
||||
@@ -0,0 +1,104 @@
|
||||
/* ===========================================================
|
||||
* 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: {
|
||||
en: {
|
||||
noembed: 'Noembed',
|
||||
noembedError: 'Error'
|
||||
},
|
||||
sk: {
|
||||
noembedError: 'Chyba'
|
||||
},
|
||||
fr: {
|
||||
noembedError: 'Erreur'
|
||||
},
|
||||
cs: {
|
||||
noembedError: 'Chyba'
|
||||
},
|
||||
ru: {
|
||||
noembedError: 'Ошибка'
|
||||
},
|
||||
ja: {
|
||||
noembedError: 'エラー'
|
||||
},
|
||||
tr: {
|
||||
noembedError: 'Hata'
|
||||
}
|
||||
},
|
||||
|
||||
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 @@
|
||||
!function(e){"use strict";var r={proxy:"https://noembed.com/embed?nowrap=on",urlFiled:"url",data:[],success:void 0,error:void 0};e.extend(!0,e.trumbowyg,{langs:{en:{noembed:"Noembed",noembedError:"Error"},sk:{noembedError:"Chyba"},fr:{noembedError:"Erreur"},cs:{noembedError:"Chyba"},ru:{noembedError:"Ошибка"},ja:{noembedError:"エラー"},tr:{noembedError:"Hata"}},plugins:{noembed:{init:function(o){o.o.plugins.noembed=e.extend(!0,{},r,o.o.plugins.noembed||{});var n={fn:function(){var r=o.openModalInsert(o.lang.noembed,{url:{label:"URL",required:!0}},function(n){e.ajax({url:o.o.plugins.noembed.proxy,type:"GET",data:n,cache:!1,dataType:"json",success:o.o.plugins.noembed.success||function(n){n.html?(o.execCmd("insertHTML",n.html),setTimeout(function(){o.closeModal()},250)):o.addErrorOnModalField(e("input[type=text]",r),n.error)},error:o.o.plugins.noembed.error||function(){o.addErrorOnModalField(e("input[type=text]",r),o.lang.noembedError)}})})}};o.addBtnDef("noembed",n)}}}})}(jQuery);
|
||||
@@ -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 @@
|
||||
!function(t){"use strict";var e={enabled:!0,endpoints:["https://noembed.com/embed?nowrap=on","https://api.maxmade.nl/url2iframe/embed"]};t.extend(!0,t.trumbowyg,{plugins:{pasteEmbed:{init:function(n){n.o.plugins.pasteEmbed=t.extend(!0,{},e,n.o.plugins.pasteEmbed||{}),n.o.plugins.pasteEmbed.enabled&&n.pasteHandlers.push(function(e){try{var a=(e.originalEvent||e).clipboardData,r=a.getData("Text"),s=n.o.plugins.pasteEmbed.endpoints,i=null;if(r.startsWith("http")){e.stopPropagation(),e.preventDefault();var o={url:r.trim()},p="",l=0;i&&i.transport&&i.transport.abort(),i=t.ajax({crossOrigin:!0,url:s[l],type:"GET",data:o,cache:!1,dataType:"jsonp",success:function(t){t.html?(l=0,p=t.html):l+=1},error:function(){l+=1},complete:function(){0===p.length&&l<s.length-1&&(this.url=s[l],this.data=o,t.ajax(this)),l===s.length-1&&(p=t("<a>",{href:r,text:r}).prop("outerHTML")),p.length>0&&(l=0,n.execCmd("insertHTML",p))}})}}catch(u){}})}}}})}(jQuery);
|
||||
@@ -0,0 +1,41 @@
|
||||
/* ===========================================================
|
||||
* 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,
|
||||
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, undefined, true);
|
||||
};
|
||||
/* jshint +W083 */
|
||||
reader.readAsDataURL(items[i].getAsFile());
|
||||
}
|
||||
}
|
||||
} catch (c) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1 @@
|
||||
!function(e){"use strict";e.extend(!0,e.trumbowyg,{plugins:{pasteImage:{init:function(e){e.pasteHandlers.push(function(t){try{for(var a,n=(t.originalEvent||t).clipboardData.items,i=n.length-1;i>=0;i-=1)n[i].type.match(/^image\//)&&(a=new FileReader,a.onloadend=function(t){e.execCmd("insertImage",t.target.result,void 0,!0)},a.readAsDataURL(n[i].getAsFile()))}catch(r){}})}}}})}(jQuery);
|
||||
@@ -0,0 +1,130 @@
|
||||
/* ===========================================================
|
||||
* 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>'
|
||||
},
|
||||
fr: {
|
||||
preformatted: 'Exemple de code <pre>'
|
||||
},
|
||||
it: {
|
||||
preformatted: 'Codice <pre>'
|
||||
},
|
||||
zh_cn: {
|
||||
preformatted: '代码示例 <pre>'
|
||||
},
|
||||
ru: {
|
||||
preformatted: 'Пример кода <pre>'
|
||||
},
|
||||
ja: {
|
||||
preformatted: 'コードサンプル <pre>'
|
||||
},
|
||||
tr: {
|
||||
preformatted: 'Kod örneği <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 @@
|
||||
!function(e){"use strict";function t(){var e,t=null;return window.getSelection?(e=window.getSelection(),e.rangeCount&&(t=e.getRangeAt(0).commonAncestorContainer,1!==t.nodeType&&(t=t.parentNode))):(e=document.selection)&&"Control"!==e.type&&(t=e.createRange().parentElement()),t}function n(e){var t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText||""}function r(){var t=null;if(document.selection)t=document.selection.createRange().parentElement();else{var n=window.getSelection();n.rangeCount>0&&(t=n.getRangeAt(0).startContainer.parentNode)}var r=e(t).contents().closest("pre").length,o=e(t).contents().closest("code").length;r&&o?e(t).contents().unwrap("code").unwrap("pre"):r?e(t).contents().unwrap("pre"):o&&e(t).contents().unwrap("code")}e.extend(!0,e.trumbowyg,{langs:{en:{preformatted:"Code sample <pre>"},fr:{preformatted:"Exemple de code <pre>"},it:{preformatted:"Codice <pre>"},zh_cn:{preformatted:"代码示例 <pre>"},ru:{preformatted:"Пример кода <pre>"},ja:{preformatted:"コードサンプル <pre>"},tr:{preformatted:"Kod örneği <pre>"}},plugins:{preformatted:{init:function(e){var o={fn:function(){e.saveRange();var o=e.getRangeText();if(""!==o.replace(/\s/g,""))try{var a=t().tagName.toLowerCase();if("code"===a||"pre"===a)return r();e.execCmd("insertHTML","<pre><code>"+n(o)+"</code></pre>")}catch(c){}},tag:"pre"};e.addBtnDef("preformatted",o)}}}})}(jQuery);
|
||||
@@ -0,0 +1,69 @@
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
var defaultOptions = {
|
||||
minSize: 32,
|
||||
step: 4
|
||||
};
|
||||
|
||||
var preventDefault = function (ev) {
|
||||
return ev.preventDefault();
|
||||
};
|
||||
|
||||
$.extend(true, $.trumbowyg, {
|
||||
plugins: {
|
||||
resizimg: {
|
||||
init: function (trumbowyg) {
|
||||
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 () {
|
||||
trumbowyg.$c.trigger('tbwchange');
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function initResizable() {
|
||||
trumbowyg.$ed.find('img:not(.resizable)')
|
||||
.resizable(trumbowyg.o.plugins.resizimg.resizable)
|
||||
.on('mousedown', preventDefault);
|
||||
}
|
||||
|
||||
function destroyResizable() {
|
||||
trumbowyg.$ed.find('img.resizable')
|
||||
.resizable('destroy')
|
||||
.off('mousedown', preventDefault);
|
||||
trumbowyg.syncTextarea();
|
||||
}
|
||||
|
||||
trumbowyg.$c.on('tbwinit', initResizable);
|
||||
trumbowyg.$c.on('tbwfocus', initResizable);
|
||||
trumbowyg.$c.on('tbwchange', initResizable);
|
||||
trumbowyg.$c.on('tbwblur', destroyResizable);
|
||||
trumbowyg.$c.on('tbwclose', destroyResizable);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1 @@
|
||||
!function(i){"use strict";var e={minSize:32,step:4},n=function(i){return i.preventDefault()};i.extend(!0,i.trumbowyg,{plugins:{resizimg:{init:function(t){function o(){t.$ed.find("img:not(.resizable)").resizable(t.o.plugins.resizimg.resizable).on("mousedown",n)}function r(){t.$ed.find("img.resizable").resizable("destroy").off("mousedown",n),t.syncTextarea()}t.o.plugins.resizimg=i.extend(!0,{},e,t.o.plugins.resizimg||{},{resizable:{resizeWidth:!1,onDragStart:function(i,e){var n=t.o.plugins.resizimg,o=i.pageX-e.offset().left,r=i.pageY-e.offset().top;if(o<e.width()-n.minSize||r<e.height()-n.minSize)return!1},onDrag:function(i,e,n,o){var r=t.o.plugins.resizimg;return o<r.minSize&&(o=r.minSize),o-=o%r.step,e.height(o),!1},onDragEnd:function(){t.$c.trigger("tbwchange")}}}),t.$c.on("tbwinit",o),t.$c.on("tbwfocus",o),t.$c.on("tbwchange",o),t.$c.on("tbwblur",r),t.$c.on("tbwclose",r)}}}})}(jQuery);
|
||||
@@ -0,0 +1,72 @@
|
||||
/* ===========================================================
|
||||
* 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: {
|
||||
en: {
|
||||
ruby: 'Add ruby text',
|
||||
rubyModal: 'Ruby modal',
|
||||
rubyText: 'Ruby text'
|
||||
},
|
||||
fr: {
|
||||
ruby: 'Ajouter du texte ruby',
|
||||
rubyModal: 'Modale ruby',
|
||||
rubyText: 'Texte ruby'
|
||||
},
|
||||
id: {
|
||||
ruby: 'Sisipkan teks ruby',
|
||||
rubyModal: 'Modal teks ruby',
|
||||
rubyText: 'Teks ruby'
|
||||
},
|
||||
tr: {
|
||||
ruby: 'Ruby metni ekle',
|
||||
rubyModal: 'Ruby modal',
|
||||
rubyText: 'Ruby metni'
|
||||
}
|
||||
},
|
||||
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 @@
|
||||
!function(e){"use strict";e.extend(!0,e.trumbowyg,{langs:{en:{ruby:"Add ruby text",rubyModal:"Ruby modal",rubyText:"Ruby text"},fr:{ruby:"Ajouter du texte ruby",rubyModal:"Modale ruby",rubyText:"Texte ruby"},id:{ruby:"Sisipkan teks ruby",rubyModal:"Modal teks ruby",rubyText:"Teks ruby"},tr:{ruby:"Ruby metni ekle",rubyModal:"Ruby modal",rubyText:"Ruby metni"}},plugins:{ruby:{init:function(r){var u={fn:function(){r.saveRange(),r.openModalInsert(r.lang.ruby,{rubyText:{label:r.lang.rubyText,required:!1},modal:{label:r.lang.rubyModal,value:r.getRangeText(),required:!0}},function(u){var t=e('<ruby title="'+u.rubyText+'">'+u.modal+"<rp> (</rp><rt>"+u.rubyText+"</rt><rp>)</rp></ruby>")[0];return r.range.deleteContents(),r.range.insertNode(t),r.syncCode(),r.$c.trigger("tbwchange"),!0})}};r.addBtnDef("ruby",u)}}}})}(jQuery);
|
||||
@@ -0,0 +1,283 @@
|
||||
/* ===========================================================
|
||||
* 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: {
|
||||
en: {
|
||||
table: 'Insert table',
|
||||
tableAddRow: 'Add row',
|
||||
tableAddColumn: 'Add column',
|
||||
tableDeleteRow: 'Delete row',
|
||||
tableDeleteColumn: 'Delete column',
|
||||
tableDestroy: 'Delete table',
|
||||
error: 'Error'
|
||||
},
|
||||
de: {
|
||||
table: 'Tabelle einfügen',
|
||||
tableAddRow: 'Zeile hinzufügen',
|
||||
tableAddColumn: 'Spalte hinzufügen',
|
||||
tableDeleteRow: 'Zeile löschen',
|
||||
tableDeleteColumn: 'Spalte löschen',
|
||||
tableDestroy: 'Tabelle löschen',
|
||||
error: 'Error'
|
||||
},
|
||||
sk: {
|
||||
table: 'Vytvoriť tabuľky',
|
||||
tableAddRow: 'Pridať riadok',
|
||||
tableAddColumn: 'Pridať stĺpec',
|
||||
error: 'Chyba'
|
||||
},
|
||||
fr: {
|
||||
table: 'Insérer un tableau',
|
||||
tableAddRow: 'Ajouter des lignes',
|
||||
tableAddColumn: 'Ajouter des colonnes',
|
||||
error: 'Erreur'
|
||||
},
|
||||
cs: {
|
||||
table: 'Vytvořit příkaz Table',
|
||||
tableAddRow: 'Přidat řádek',
|
||||
tableAddColumn: 'Přidat sloupec',
|
||||
error: 'Chyba'
|
||||
},
|
||||
ru: {
|
||||
table: 'Вставить таблицу',
|
||||
tableAddRow: 'Добавить строки',
|
||||
tableAddColumn: 'Добавить столбцы',
|
||||
error: 'Ошибка'
|
||||
},
|
||||
ja: {
|
||||
table: '表の挿入',
|
||||
tableAddRow: '行の追加',
|
||||
tableAddColumn: '列の追加',
|
||||
error: 'エラー'
|
||||
},
|
||||
tr: {
|
||||
table: 'Tablo ekle',
|
||||
tableAddRow: 'Satır ekle',
|
||||
tableAddColumn: 'Kolon ekle',
|
||||
error: 'Hata'
|
||||
}
|
||||
},
|
||||
|
||||
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('tableAddRow'));
|
||||
$dropdown.append(t.buildSubBtn('tableAddColumn'));
|
||||
$dropdown.append(t.buildSubBtn('tableDeleteRow'));
|
||||
$dropdown.append(t.buildSubBtn('tableDeleteColumn'));
|
||||
$dropdown.append(t.buildSubBtn('tableDestroy'));
|
||||
} else {
|
||||
var tableSelect = $('<table></table>');
|
||||
for (var i = 0; i < t.o.plugins.table.rows; i += 1) {
|
||||
var row = $('<tr></tr>').appendTo(tableSelect);
|
||||
for (var j = 0; j < t.o.plugins.table.columns; j += 1) {
|
||||
$('<td></td>').appendTo(row);
|
||||
}
|
||||
}
|
||||
tableSelect.find('td').on('mouseover', tableAnimate);
|
||||
tableSelect.find('td').on('mousedown', tableBuild);
|
||||
|
||||
$dropdown.append(tableSelect);
|
||||
$dropdown.append($('<center>1x1</center>'));
|
||||
}
|
||||
|
||||
t.dropdown(btnName);
|
||||
}
|
||||
};
|
||||
|
||||
var tableAnimate = function(column_event) {
|
||||
var column = $(column_event.target),
|
||||
table = column.parents('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('center').html((colIndex+1) + "x" + (rowIndex+1));
|
||||
};
|
||||
|
||||
var tableBuild = function(column_event) {
|
||||
t.saveRange();
|
||||
|
||||
var tabler = $('<table></table>');
|
||||
if (t.o.plugins.table.styler) {
|
||||
tabler.attr('class', t.o.plugins.table.styler);
|
||||
}
|
||||
|
||||
var column = $(column_event.target),
|
||||
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></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 table = $(node).closest('table');
|
||||
|
||||
if(table.length > 0) {
|
||||
var row = $('<tr></tr>');
|
||||
// add columns according to current columns count
|
||||
for (var i = 0; i < table.find('tr')[0].childElementCount; i += 1) {
|
||||
$('<td></td>').appendTo(row);
|
||||
}
|
||||
// add row to table
|
||||
row.appendTo(table);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var addColumn = {
|
||||
title: t.lang['tableAddColumn'],
|
||||
text: t.lang['tableAddColumn'],
|
||||
ico: 'col-right',
|
||||
|
||||
fn: function () {
|
||||
t.saveRange();
|
||||
|
||||
var node = t.doc.getSelection().focusNode;
|
||||
var table = $(node).closest('table');
|
||||
|
||||
if(table.length > 0) {
|
||||
$(table).find('tr').each(function() {
|
||||
$(this).find('td:last').after('<td></td>');
|
||||
});
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
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();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
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();
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
t.addBtnDef('table', buildButtonDef);
|
||||
t.addBtnDef('tableAddRow', addRow);
|
||||
t.addBtnDef('tableAddColumn', addColumn);
|
||||
t.addBtnDef('tableDeleteRow', deleteRow);
|
||||
t.addBtnDef('tableDeleteColumn', deleteColumn);
|
||||
t.addBtnDef('tableDestroy', destroy);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Default stylesheet for Trumbowyg editor plugin
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.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;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 0 1px #cecece inset;
|
||||
|
||||
&.active {
|
||||
background-color: #00b393;
|
||||
box-shadow: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Trumbowyg plugin stylesheet
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
.trumbowyg-editor table {
|
||||
width: 100%; }
|
||||
.trumbowyg-editor table td {
|
||||
border: 1px dotted #e7eaec;
|
||||
padding: 8px; }
|
||||
|
||||
.trumbowyg-dropdown-table table {
|
||||
margin: 10px;
|
||||
display: inline-block; }
|
||||
|
||||
.trumbowyg-dropdown-table table td {
|
||||
display: inline-block;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
margin: 1px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 0 1px #cecece inset; }
|
||||
.trumbowyg-dropdown-table table td.active {
|
||||
background-color: #00b393;
|
||||
box-shadow: none;
|
||||
cursor: pointer; }
|
||||
@@ -0,0 +1,2 @@
|
||||
/** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */
|
||||
.trumbowyg-editor table{width:100%}.trumbowyg-editor table td{border:1px dotted #e7eaec;padding:8px}.trumbowyg-dropdown-table table{margin:10px;display:inline-block}.trumbowyg-dropdown-table table td{display:inline-block;height:20px;width:20px;margin:1px;background-color:#fff;box-shadow:0 0 0 1px #cecece inset}.trumbowyg-dropdown-table table td.active{background-color:#00b393;box-shadow:none;cursor:pointer}
|
||||
@@ -0,0 +1,64 @@
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Adds the language variables
|
||||
$.extend(true, $.trumbowyg, {
|
||||
langs: {
|
||||
en: {
|
||||
template: 'Template'
|
||||
},
|
||||
fr: {
|
||||
template: 'Patron'
|
||||
},
|
||||
nl: {
|
||||
template: 'Sjabloon'
|
||||
},
|
||||
ru: {
|
||||
template: 'Шаблон'
|
||||
},
|
||||
ja: {
|
||||
template: 'テンプレート'
|
||||
},
|
||||
tr: {
|
||||
template: 'Şablon'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 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 @@
|
||||
!function(t){"use strict";function e(e){var n=e.o.plugins.templates,a=[];return t.each(n,function(t,n){e.addBtnDef("template_"+t,{fn:function(){e.html(n.html)},hasIcon:!1,title:n.name}),a.push("template_"+t)}),a}t.extend(!0,t.trumbowyg,{langs:{en:{template:"Template"},fr:{template:"Patron"},nl:{template:"Sjabloon"},ru:{template:"Шаблон"},ja:{template:"テンプレート"},tr:{template:"Şablon"}}}),t.extend(!0,t.trumbowyg,{plugins:{template:{shouldInit:function(t){return t.o.plugins.hasOwnProperty("templates")},init:function(t){t.addBtnDef("template",{dropdown:e(t),hasIcon:!1,text:t.lang.template})}}}})}(jQuery);
|
||||
@@ -0,0 +1,261 @@
|
||||
/* ===========================================================
|
||||
* 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'
|
||||
},
|
||||
sk: {
|
||||
upload: 'Nahrať',
|
||||
file: 'Súbor',
|
||||
uploadError: 'Chyba'
|
||||
},
|
||||
fr: {
|
||||
upload: 'Envoi',
|
||||
file: 'Fichier',
|
||||
uploadError: 'Erreur'
|
||||
},
|
||||
cs: {
|
||||
upload: 'Nahrát obrázek',
|
||||
file: 'Soubor',
|
||||
uploadError: 'Chyba'
|
||||
},
|
||||
zh_cn: {
|
||||
upload: '上传',
|
||||
file: '文件',
|
||||
uploadError: '错误'
|
||||
},
|
||||
zh_tw: {
|
||||
upload: '上傳',
|
||||
file: '文件',
|
||||
uploadError: '錯誤'
|
||||
},
|
||||
ru: {
|
||||
upload: 'Загрузка',
|
||||
file: 'Файл',
|
||||
uploadError: 'Ошибка'
|
||||
},
|
||||
ja: {
|
||||
upload: 'アップロード',
|
||||
file: 'ファイル',
|
||||
uploadError: 'エラー'
|
||||
},
|
||||
pt_br: {
|
||||
upload: 'Enviar do local',
|
||||
file: 'Arquivo',
|
||||
uploadError: 'Erro'
|
||||
},
|
||||
tr: {
|
||||
upload: 'Yükle',
|
||||
file: 'Dosya',
|
||||
uploadError: 'Hata'
|
||||
}
|
||||
},
|
||||
// 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: ''
|
||||
};
|
||||
}
|
||||
|
||||
var $modal = trumbowyg.openModalInsert(
|
||||
// Title
|
||||
trumbowyg.lang.upload,
|
||||
|
||||
// Fields
|
||||
fields,
|
||||
|
||||
// Callback
|
||||
function (values) {
|
||||
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);
|
||||
var $img = $('img[src="' + url + '"]:not([alt])', trumbowyg.$box);
|
||||
$img.attr('alt', values.alt);
|
||||
if (trumbowyg.o.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]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
error: trumbowyg.o.plugins.upload.error || function () {
|
||||
trumbowyg.addErrorOnModalField(
|
||||
$('input[type=file]', $modal),
|
||||
trumbowyg.lang.uploadError
|
||||
);
|
||||
trumbowyg.$c.trigger('tbwuploaderror', [trumbowyg]);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
$('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 req = originalXhr(),
|
||||
that = this;
|
||||
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);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,1823 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Trumbowyg core file
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
jQuery.trumbowyg = {
|
||||
langs: {
|
||||
en: {
|
||||
viewHTML: 'View HTML',
|
||||
|
||||
undo: 'Undo',
|
||||
redo: 'Redo',
|
||||
|
||||
formatting: 'Formatting',
|
||||
p: 'Paragraph',
|
||||
blockquote: 'Quote',
|
||||
code: 'Code',
|
||||
header: 'Header',
|
||||
|
||||
bold: 'Bold',
|
||||
italic: 'Italic',
|
||||
strikethrough: 'Stroke',
|
||||
underline: 'Underline',
|
||||
|
||||
strong: 'Strong',
|
||||
em: 'Emphasis',
|
||||
del: 'Deleted',
|
||||
|
||||
superscript: 'Superscript',
|
||||
subscript: 'Subscript',
|
||||
|
||||
unorderedList: 'Unordered list',
|
||||
orderedList: 'Ordered list',
|
||||
|
||||
insertImage: 'Insert Image',
|
||||
link: 'Link',
|
||||
createLink: 'Insert link',
|
||||
unlink: 'Remove link',
|
||||
|
||||
justifyLeft: 'Align Left',
|
||||
justifyCenter: 'Align Center',
|
||||
justifyRight: 'Align Right',
|
||||
justifyFull: 'Align Justify',
|
||||
|
||||
horizontalRule: 'Insert horizontal rule',
|
||||
removeformat: 'Remove format',
|
||||
|
||||
fullscreen: 'Fullscreen',
|
||||
|
||||
close: 'Close',
|
||||
|
||||
submit: 'Confirm',
|
||||
reset: 'Cancel',
|
||||
|
||||
required: 'Required',
|
||||
description: 'Description',
|
||||
title: 'Title',
|
||||
text: 'Text',
|
||||
target: 'Target',
|
||||
width: 'Width'
|
||||
}
|
||||
},
|
||||
|
||||
// Plugins
|
||||
plugins: {},
|
||||
|
||||
// SVG Path globally
|
||||
svgPath: null,
|
||||
|
||||
hideButtonTexts: null
|
||||
};
|
||||
|
||||
// Makes default options read-only
|
||||
Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
|
||||
value: {
|
||||
lang: 'en',
|
||||
|
||||
fixedBtnPane: false,
|
||||
fixedFullWidth: false,
|
||||
autogrow: false,
|
||||
autogrowOnEnter: false,
|
||||
imageWidthModalEdit: false,
|
||||
|
||||
prefix: 'trumbowyg-',
|
||||
|
||||
semantic: true,
|
||||
resetCss: false,
|
||||
removeformatPasted: false,
|
||||
tagsToRemove: [],
|
||||
btns: [
|
||||
['viewHTML'],
|
||||
['undo', 'redo'], // Only supported in Blink browsers
|
||||
['formatting'],
|
||||
['strong', 'em', 'del'],
|
||||
['superscript', 'subscript'],
|
||||
['link'],
|
||||
['insertImage'],
|
||||
['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
|
||||
['unorderedList', 'orderedList'],
|
||||
['horizontalRule'],
|
||||
['removeformat'],
|
||||
['fullscreen']
|
||||
],
|
||||
// For custom button definitions
|
||||
btnsDef: {},
|
||||
|
||||
inlineElementsSelector: 'a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u',
|
||||
|
||||
pasteHandlers: [],
|
||||
|
||||
// imgDblClickHandler: default is defined in constructor
|
||||
|
||||
plugins: {},
|
||||
urlProtocol: false,
|
||||
minimalLinks: false
|
||||
},
|
||||
writable: false,
|
||||
enumerable: true,
|
||||
configurable: false
|
||||
});
|
||||
|
||||
|
||||
(function (navigator, window, document, $) {
|
||||
'use strict';
|
||||
|
||||
var CONFIRM_EVENT = 'tbwconfirm',
|
||||
CANCEL_EVENT = 'tbwcancel';
|
||||
|
||||
$.fn.trumbowyg = function (options, params) {
|
||||
var trumbowygDataName = 'trumbowyg';
|
||||
if (options === Object(options) || !options) {
|
||||
return this.each(function () {
|
||||
if (!$(this).data(trumbowygDataName)) {
|
||||
$(this).data(trumbowygDataName, new Trumbowyg(this, options));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (this.length === 1) {
|
||||
try {
|
||||
var t = $(this).data(trumbowygDataName);
|
||||
switch (options) {
|
||||
// Exec command
|
||||
case 'execCmd':
|
||||
return t.execCmd(params.cmd, params.param, params.forceCss);
|
||||
|
||||
// Modal box
|
||||
case 'openModal':
|
||||
return t.openModal(params.title, params.content);
|
||||
case 'closeModal':
|
||||
return t.closeModal();
|
||||
case 'openModalInsert':
|
||||
return t.openModalInsert(params.title, params.fields, params.callback);
|
||||
|
||||
// Range
|
||||
case 'saveRange':
|
||||
return t.saveRange();
|
||||
case 'getRange':
|
||||
return t.range;
|
||||
case 'getRangeText':
|
||||
return t.getRangeText();
|
||||
case 'restoreRange':
|
||||
return t.restoreRange();
|
||||
|
||||
// Enable/disable
|
||||
case 'enable':
|
||||
return t.setDisabled(false);
|
||||
case 'disable':
|
||||
return t.setDisabled(true);
|
||||
|
||||
// Toggle
|
||||
case 'toggle':
|
||||
return t.toggle();
|
||||
|
||||
// Destroy
|
||||
case 'destroy':
|
||||
return t.destroy();
|
||||
|
||||
// Empty
|
||||
case 'empty':
|
||||
return t.empty();
|
||||
|
||||
// HTML
|
||||
case 'html':
|
||||
return t.html(params);
|
||||
}
|
||||
} catch (c) {
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// @param: editorElem is the DOM element
|
||||
var Trumbowyg = function (editorElem, options) {
|
||||
var t = this,
|
||||
trumbowygIconsId = 'trumbowyg-icons',
|
||||
$trumbowyg = $.trumbowyg;
|
||||
|
||||
// Get the document of the element. It use to makes the plugin
|
||||
// compatible on iframes.
|
||||
t.doc = editorElem.ownerDocument || document;
|
||||
|
||||
// jQuery object of the editor
|
||||
t.$ta = $(editorElem); // $ta : Textarea
|
||||
t.$c = $(editorElem); // $c : creator
|
||||
|
||||
options = options || {};
|
||||
|
||||
// Localization management
|
||||
if (options.lang != null || $trumbowyg.langs[options.lang] != null) {
|
||||
t.lang = $.extend(true, {}, $trumbowyg.langs.en, $trumbowyg.langs[options.lang]);
|
||||
} else {
|
||||
t.lang = $trumbowyg.langs.en;
|
||||
}
|
||||
|
||||
t.hideButtonTexts = $trumbowyg.hideButtonTexts != null ? $trumbowyg.hideButtonTexts : options.hideButtonTexts;
|
||||
|
||||
// SVG path
|
||||
var svgPathOption = $trumbowyg.svgPath != null ? $trumbowyg.svgPath : options.svgPath;
|
||||
t.hasSvg = svgPathOption !== false;
|
||||
t.svgPath = !!t.doc.querySelector('base') ? window.location.href.split('#')[0] : '';
|
||||
if ($('#' + trumbowygIconsId, t.doc).length === 0 && svgPathOption !== false) {
|
||||
if (svgPathOption == null) {
|
||||
// Hack to get svgPathOption based on trumbowyg.js path
|
||||
var scriptElements = document.getElementsByTagName('script');
|
||||
for (var i = 0; i < scriptElements.length; i += 1) {
|
||||
var source = scriptElements[i].src;
|
||||
var matches = source.match('trumbowyg(\.min)?\.js');
|
||||
if (matches != null) {
|
||||
svgPathOption = source.substring(0, source.indexOf(matches[0])) + 'ui/icons.svg';
|
||||
}
|
||||
}
|
||||
if (svgPathOption == null) {
|
||||
console.warn('You must define svgPath: https://goo.gl/CfTY9U'); // jshint ignore:line
|
||||
}
|
||||
}
|
||||
|
||||
var div = t.doc.createElement('div');
|
||||
div.id = trumbowygIconsId;
|
||||
t.doc.body.insertBefore(div, t.doc.body.childNodes[0]);
|
||||
$.ajax({
|
||||
async: true,
|
||||
type: 'GET',
|
||||
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
dataType: 'xml',
|
||||
crossDomain: true,
|
||||
url: svgPathOption,
|
||||
data: null,
|
||||
beforeSend: null,
|
||||
complete: null,
|
||||
success: function (data) {
|
||||
div.innerHTML = new XMLSerializer().serializeToString(data.documentElement);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* When the button is associated to a empty object
|
||||
* fn and title attributs are defined from the button key value
|
||||
*
|
||||
* For example
|
||||
* foo: {}
|
||||
* is equivalent to :
|
||||
* foo: {
|
||||
* fn: 'foo',
|
||||
* title: this.lang.foo
|
||||
* }
|
||||
*/
|
||||
var h = t.lang.header, // Header translation
|
||||
isBlinkFunction = function () {
|
||||
return (window.chrome || (window.Intl && Intl.v8BreakIterator)) && 'CSS' in window;
|
||||
};
|
||||
t.btnsDef = {
|
||||
viewHTML: {
|
||||
fn: 'toggle'
|
||||
},
|
||||
|
||||
undo: {
|
||||
isSupported: isBlinkFunction,
|
||||
key: 'Z'
|
||||
},
|
||||
redo: {
|
||||
isSupported: isBlinkFunction,
|
||||
key: 'Y'
|
||||
},
|
||||
|
||||
p: {
|
||||
fn: 'formatBlock'
|
||||
},
|
||||
blockquote: {
|
||||
fn: 'formatBlock'
|
||||
},
|
||||
h1: {
|
||||
fn: 'formatBlock',
|
||||
title: h + ' 1'
|
||||
},
|
||||
h2: {
|
||||
fn: 'formatBlock',
|
||||
title: h + ' 2'
|
||||
},
|
||||
h3: {
|
||||
fn: 'formatBlock',
|
||||
title: h + ' 3'
|
||||
},
|
||||
h4: {
|
||||
fn: 'formatBlock',
|
||||
title: h + ' 4'
|
||||
},
|
||||
subscript: {
|
||||
tag: 'sub'
|
||||
},
|
||||
superscript: {
|
||||
tag: 'sup'
|
||||
},
|
||||
|
||||
bold: {
|
||||
key: 'B',
|
||||
tag: 'b'
|
||||
},
|
||||
italic: {
|
||||
key: 'I',
|
||||
tag: 'i'
|
||||
},
|
||||
underline: {
|
||||
tag: 'u'
|
||||
},
|
||||
strikethrough: {
|
||||
tag: 'strike'
|
||||
},
|
||||
|
||||
strong: {
|
||||
fn: 'bold',
|
||||
key: 'B'
|
||||
},
|
||||
em: {
|
||||
fn: 'italic',
|
||||
key: 'I'
|
||||
},
|
||||
del: {
|
||||
fn: 'strikethrough'
|
||||
},
|
||||
|
||||
createLink: {
|
||||
key: 'K',
|
||||
tag: 'a'
|
||||
},
|
||||
unlink: {},
|
||||
|
||||
insertImage: {},
|
||||
|
||||
justifyLeft: {
|
||||
tag: 'left',
|
||||
forceCss: true
|
||||
},
|
||||
justifyCenter: {
|
||||
tag: 'center',
|
||||
forceCss: true
|
||||
},
|
||||
justifyRight: {
|
||||
tag: 'right',
|
||||
forceCss: true
|
||||
},
|
||||
justifyFull: {
|
||||
tag: 'justify',
|
||||
forceCss: true
|
||||
},
|
||||
|
||||
unorderedList: {
|
||||
fn: 'insertUnorderedList',
|
||||
tag: 'ul'
|
||||
},
|
||||
orderedList: {
|
||||
fn: 'insertOrderedList',
|
||||
tag: 'ol'
|
||||
},
|
||||
|
||||
horizontalRule: {
|
||||
fn: 'insertHorizontalRule'
|
||||
},
|
||||
|
||||
removeformat: {},
|
||||
|
||||
fullscreen: {
|
||||
class: 'trumbowyg-not-disable'
|
||||
},
|
||||
close: {
|
||||
fn: 'destroy',
|
||||
class: 'trumbowyg-not-disable'
|
||||
},
|
||||
|
||||
// Dropdowns
|
||||
formatting: {
|
||||
dropdown: ['p', 'blockquote', 'h1', 'h2', 'h3', 'h4'],
|
||||
ico: 'p'
|
||||
},
|
||||
link: {
|
||||
dropdown: ['createLink', 'unlink']
|
||||
}
|
||||
};
|
||||
|
||||
// Defaults Options
|
||||
t.o = $.extend(true, {}, $trumbowyg.defaultOptions, options);
|
||||
if (!t.o.hasOwnProperty('imgDblClickHandler')) {
|
||||
t.o.imgDblClickHandler = t.getDefaultImgDblClickHandler();
|
||||
}
|
||||
|
||||
t.urlPrefix = t.setupUrlPrefix();
|
||||
|
||||
t.disabled = t.o.disabled || (editorElem.nodeName === 'TEXTAREA' && editorElem.disabled);
|
||||
|
||||
if (options.btns) {
|
||||
t.o.btns = options.btns;
|
||||
} else if (!t.o.semantic) {
|
||||
t.o.btns[3] = ['bold', 'italic', 'underline', 'strikethrough'];
|
||||
}
|
||||
|
||||
$.each(t.o.btnsDef, function (btnName, btnDef) {
|
||||
t.addBtnDef(btnName, btnDef);
|
||||
});
|
||||
|
||||
// put this here in the event it would be merged in with options
|
||||
t.eventNamespace = 'trumbowyg-event';
|
||||
|
||||
// Keyboard shortcuts are load in this array
|
||||
t.keys = [];
|
||||
|
||||
// Tag to button dynamically hydrated
|
||||
t.tagToButton = {};
|
||||
t.tagHandlers = [];
|
||||
|
||||
// Admit multiple paste handlers
|
||||
t.pasteHandlers = [].concat(t.o.pasteHandlers);
|
||||
|
||||
// Check if browser is IE
|
||||
t.isIE = (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') !== -1);
|
||||
|
||||
t.init();
|
||||
};
|
||||
|
||||
Trumbowyg.prototype = {
|
||||
DEFAULT_SEMANTIC_MAP: {
|
||||
'b': 'strong',
|
||||
'i': 'em',
|
||||
's': 'del',
|
||||
'strike': 'del',
|
||||
'div': 'p'
|
||||
},
|
||||
|
||||
init: function () {
|
||||
var t = this;
|
||||
t.height = t.$ta.height();
|
||||
|
||||
t.initPlugins();
|
||||
|
||||
try {
|
||||
// Disable image resize, try-catch for old IE
|
||||
t.doc.execCommand('enableObjectResizing', false, false);
|
||||
t.doc.execCommand('defaultParagraphSeparator', false, 'p');
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
t.buildEditor();
|
||||
t.buildBtnPane();
|
||||
|
||||
t.fixedBtnPaneEvents();
|
||||
|
||||
t.buildOverlay();
|
||||
|
||||
setTimeout(function () {
|
||||
if (t.disabled) {
|
||||
t.setDisabled(true);
|
||||
}
|
||||
t.$c.trigger('tbwinit');
|
||||
});
|
||||
},
|
||||
|
||||
addBtnDef: function (btnName, btnDef) {
|
||||
this.btnsDef[btnName] = btnDef;
|
||||
},
|
||||
|
||||
setupUrlPrefix: function () {
|
||||
var protocol = this.o.urlProtocol;
|
||||
if (!protocol) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof(protocol) !== 'string') {
|
||||
return 'https://';
|
||||
}
|
||||
return /:\/\/$/.test(protocol) ? protocol : protocol + '://';
|
||||
},
|
||||
|
||||
buildEditor: function () {
|
||||
var t = this,
|
||||
prefix = t.o.prefix,
|
||||
html = '';
|
||||
|
||||
t.$box = $('<div/>', {
|
||||
class: prefix + 'box ' + prefix + 'editor-visible ' + prefix + t.o.lang + ' trumbowyg'
|
||||
});
|
||||
|
||||
// $ta = Textarea
|
||||
// $ed = Editor
|
||||
t.isTextarea = t.$ta.is('textarea');
|
||||
if (t.isTextarea) {
|
||||
html = t.$ta.val();
|
||||
t.$ed = $('<div/>');
|
||||
t.$box
|
||||
.insertAfter(t.$ta)
|
||||
.append(t.$ed, t.$ta);
|
||||
} else {
|
||||
t.$ed = t.$ta;
|
||||
html = t.$ed.html();
|
||||
|
||||
t.$ta = $('<textarea/>', {
|
||||
name: t.$ta.attr('id'),
|
||||
height: t.height
|
||||
}).val(html);
|
||||
|
||||
t.$box
|
||||
.insertAfter(t.$ed)
|
||||
.append(t.$ta, t.$ed);
|
||||
t.syncCode();
|
||||
}
|
||||
|
||||
t.$ta
|
||||
.addClass(prefix + 'textarea')
|
||||
.attr('tabindex', -1)
|
||||
;
|
||||
|
||||
t.$ed
|
||||
.addClass(prefix + 'editor')
|
||||
.attr({
|
||||
contenteditable: true,
|
||||
dir: t.lang._dir || 'ltr'
|
||||
})
|
||||
.html(html)
|
||||
;
|
||||
|
||||
if (t.o.tabindex) {
|
||||
t.$ed.attr('tabindex', t.o.tabindex);
|
||||
}
|
||||
|
||||
if (t.$c.is('[placeholder]')) {
|
||||
t.$ed.attr('placeholder', t.$c.attr('placeholder'));
|
||||
}
|
||||
|
||||
if (t.$c.is('[spellcheck]')) {
|
||||
t.$ed.attr('spellcheck', t.$c.attr('spellcheck'));
|
||||
}
|
||||
|
||||
if (t.o.resetCss) {
|
||||
t.$ed.addClass(prefix + 'reset-css');
|
||||
}
|
||||
|
||||
if (!t.o.autogrow) {
|
||||
t.$ta.add(t.$ed).css({
|
||||
height: t.height
|
||||
});
|
||||
}
|
||||
|
||||
t.semanticCode();
|
||||
|
||||
if (t.o.autogrowOnEnter) {
|
||||
t.$ed.addClass(prefix + 'autogrow-on-enter');
|
||||
}
|
||||
|
||||
var ctrl = false,
|
||||
composition = false,
|
||||
debounceButtonPaneStatus,
|
||||
updateEventName = 'keyup';
|
||||
|
||||
t.$ed
|
||||
.on('dblclick', 'img', t.o.imgDblClickHandler)
|
||||
.on('keydown', function (e) {
|
||||
if ((e.ctrlKey || e.metaKey) && !e.altKey) {
|
||||
ctrl = true;
|
||||
var key = t.keys[String.fromCharCode(e.which).toUpperCase()];
|
||||
|
||||
try {
|
||||
t.execCmd(key.fn, key.param);
|
||||
return false;
|
||||
} catch (c) {
|
||||
}
|
||||
}
|
||||
})
|
||||
.on('compositionstart compositionupdate', function () {
|
||||
composition = true;
|
||||
})
|
||||
.on(updateEventName + ' compositionend', function (e) {
|
||||
if (e.type === 'compositionend') {
|
||||
composition = false;
|
||||
} else if (composition) {
|
||||
return;
|
||||
}
|
||||
|
||||
var keyCode = e.which;
|
||||
|
||||
if (keyCode >= 37 && keyCode <= 40) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((e.ctrlKey || e.metaKey) && (keyCode === 89 || keyCode === 90)) {
|
||||
t.$c.trigger('tbwchange');
|
||||
} else if (!ctrl && keyCode !== 17) {
|
||||
var compositionEndIE = t.isIE ? e.type === 'compositionend' : true;
|
||||
t.semanticCode(false, compositionEndIE && keyCode === 13);
|
||||
t.$c.trigger('tbwchange');
|
||||
} else if (typeof e.which === 'undefined') {
|
||||
t.semanticCode(false, false, true);
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
ctrl = false;
|
||||
}, 50);
|
||||
})
|
||||
.on('mouseup keydown keyup', function (e) {
|
||||
if ((!e.ctrlKey && !e.metaKey) || e.altKey) {
|
||||
setTimeout(function () { // "hold on" to the ctrl key for 50ms
|
||||
ctrl = false;
|
||||
}, 50);
|
||||
}
|
||||
clearTimeout(debounceButtonPaneStatus);
|
||||
debounceButtonPaneStatus = setTimeout(function () {
|
||||
t.updateButtonPaneStatus();
|
||||
}, 50);
|
||||
})
|
||||
.on('focus blur', function (e) {
|
||||
t.$c.trigger('tbw' + e.type);
|
||||
if (e.type === 'blur') {
|
||||
$('.' + prefix + 'active-button', t.$btnPane).removeClass(prefix + 'active-button ' + prefix + 'active');
|
||||
}
|
||||
if (t.o.autogrowOnEnter) {
|
||||
if (t.autogrowOnEnterDontClose) {
|
||||
return;
|
||||
}
|
||||
if (e.type === 'focus') {
|
||||
t.autogrowOnEnterWasFocused = true;
|
||||
t.autogrowEditorOnEnter();
|
||||
}
|
||||
else if (!t.o.autogrow) {
|
||||
t.$ed.css({height: t.$ed.css('min-height')});
|
||||
t.$c.trigger('tbwresize');
|
||||
}
|
||||
}
|
||||
})
|
||||
.on('cut', function () {
|
||||
setTimeout(function () {
|
||||
t.semanticCode(false, true);
|
||||
t.$c.trigger('tbwchange');
|
||||
}, 0);
|
||||
})
|
||||
.on('paste', function (e) {
|
||||
if (t.o.removeformatPasted) {
|
||||
e.preventDefault();
|
||||
|
||||
if (window.getSelection && window.getSelection().deleteFromDocument) {
|
||||
window.getSelection().deleteFromDocument();
|
||||
}
|
||||
|
||||
try {
|
||||
// IE
|
||||
var text = window.clipboardData.getData('Text');
|
||||
|
||||
try {
|
||||
// <= IE10
|
||||
t.doc.selection.createRange().pasteHTML(text);
|
||||
} catch (c) {
|
||||
// IE 11
|
||||
t.doc.getSelection().getRangeAt(0).insertNode(t.doc.createTextNode(text));
|
||||
}
|
||||
t.$c.trigger('tbwchange', e);
|
||||
} catch (d) {
|
||||
// Not IE
|
||||
t.execCmd('insertText', (e.originalEvent || e).clipboardData.getData('text/plain'));
|
||||
}
|
||||
}
|
||||
|
||||
// Call pasteHandlers
|
||||
$.each(t.pasteHandlers, function (i, pasteHandler) {
|
||||
pasteHandler(e);
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
t.semanticCode(false, true);
|
||||
t.$c.trigger('tbwpaste', e);
|
||||
}, 0);
|
||||
});
|
||||
|
||||
t.$ta
|
||||
.on('keyup', function () {
|
||||
t.$c.trigger('tbwchange');
|
||||
})
|
||||
.on('paste', function () {
|
||||
setTimeout(function () {
|
||||
t.$c.trigger('tbwchange');
|
||||
}, 0);
|
||||
});
|
||||
|
||||
t.$box.on('keydown', function (e) {
|
||||
if (e.which === 27 && $('.' + prefix + 'modal-box', t.$box).length === 1) {
|
||||
t.closeModal();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//autogrow when entering logic
|
||||
autogrowEditorOnEnter: function () {
|
||||
var t = this;
|
||||
t.$ed.removeClass('autogrow-on-enter');
|
||||
var oldHeight = t.$ed[0].clientHeight;
|
||||
t.$ed.height('auto');
|
||||
var totalHeight = t.$ed[0].scrollHeight;
|
||||
t.$ed.addClass('autogrow-on-enter');
|
||||
if (oldHeight !== totalHeight) {
|
||||
t.$ed.height(oldHeight);
|
||||
setTimeout(function () {
|
||||
t.$ed.css({height: totalHeight});
|
||||
t.$c.trigger('tbwresize');
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// Build button pane, use o.btns option
|
||||
buildBtnPane: function () {
|
||||
var t = this,
|
||||
prefix = t.o.prefix;
|
||||
|
||||
var $btnPane = t.$btnPane = $('<div/>', {
|
||||
class: prefix + 'button-pane'
|
||||
});
|
||||
|
||||
$.each(t.o.btns, function (i, btnGrp) {
|
||||
if (!$.isArray(btnGrp)) {
|
||||
btnGrp = [btnGrp];
|
||||
}
|
||||
|
||||
var $btnGroup = $('<div/>', {
|
||||
class: prefix + 'button-group ' + ((btnGrp.indexOf('fullscreen') >= 0) ? prefix + 'right' : '')
|
||||
});
|
||||
$.each(btnGrp, function (i, btn) {
|
||||
try { // Prevent buildBtn error
|
||||
if (t.isSupportedBtn(btn)) { // It's a supported button
|
||||
$btnGroup.append(t.buildBtn(btn));
|
||||
}
|
||||
} catch (c) {
|
||||
}
|
||||
});
|
||||
|
||||
if ($btnGroup.html().trim().length > 0) {
|
||||
$btnPane.append($btnGroup);
|
||||
}
|
||||
});
|
||||
|
||||
t.$box.prepend($btnPane);
|
||||
},
|
||||
|
||||
|
||||
// Build a button and his action
|
||||
buildBtn: function (btnName) { // btnName is name of the button
|
||||
var t = this,
|
||||
prefix = t.o.prefix,
|
||||
btn = t.btnsDef[btnName],
|
||||
isDropdown = btn.dropdown,
|
||||
hasIcon = btn.hasIcon != null ? btn.hasIcon : true,
|
||||
textDef = t.lang[btnName] || btnName,
|
||||
|
||||
$btn = $('<button/>', {
|
||||
type: 'button',
|
||||
class: prefix + btnName + '-button ' + (btn.class || '') + (!hasIcon ? ' ' + prefix + 'textual-button' : ''),
|
||||
html: t.hasSvg && hasIcon ?
|
||||
'<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' :
|
||||
t.hideButtonTexts ? '' : (btn.text || btn.title || t.lang[btnName] || btnName),
|
||||
title: (btn.title || btn.text || textDef) + ((btn.key) ? ' (Ctrl + ' + btn.key + ')' : ''),
|
||||
tabindex: -1,
|
||||
mousedown: function () {
|
||||
if (!isDropdown || $('.' + btnName + '-' + prefix + 'dropdown', t.$box).is(':hidden')) {
|
||||
$('body', t.doc).trigger('mousedown');
|
||||
}
|
||||
|
||||
if ((t.$btnPane.hasClass(prefix + 'disable') || t.$box.hasClass(prefix + 'disabled')) &&
|
||||
!$(this).hasClass(prefix + 'active') &&
|
||||
!$(this).hasClass(prefix + 'not-disable')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
t.execCmd((isDropdown ? 'dropdown' : false) || btn.fn || btnName, btn.param || btnName, btn.forceCss);
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (isDropdown) {
|
||||
$btn.addClass(prefix + 'open-dropdown');
|
||||
var dropdownPrefix = prefix + 'dropdown',
|
||||
dropdownOptions = { // the dropdown
|
||||
class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + prefix + 'fixed-top'
|
||||
};
|
||||
dropdownOptions['data-' + dropdownPrefix] = btnName;
|
||||
var $dropdown = $('<div/>', dropdownOptions);
|
||||
$.each(isDropdown, function (i, def) {
|
||||
if (t.btnsDef[def] && t.isSupportedBtn(def)) {
|
||||
$dropdown.append(t.buildSubBtn(def));
|
||||
}
|
||||
});
|
||||
t.$box.append($dropdown.hide());
|
||||
} else if (btn.key) {
|
||||
t.keys[btn.key] = {
|
||||
fn: btn.fn || btnName,
|
||||
param: btn.param || btnName
|
||||
};
|
||||
}
|
||||
|
||||
if (!isDropdown) {
|
||||
t.tagToButton[(btn.tag || btnName).toLowerCase()] = btnName;
|
||||
}
|
||||
|
||||
return $btn;
|
||||
},
|
||||
// Build a button for dropdown menu
|
||||
// @param n : name of the subbutton
|
||||
buildSubBtn: function (btnName) {
|
||||
var t = this,
|
||||
prefix = t.o.prefix,
|
||||
btn = t.btnsDef[btnName],
|
||||
hasIcon = btn.hasIcon != null ? btn.hasIcon : true;
|
||||
|
||||
if (btn.key) {
|
||||
t.keys[btn.key] = {
|
||||
fn: btn.fn || btnName,
|
||||
param: btn.param || btnName
|
||||
};
|
||||
}
|
||||
|
||||
t.tagToButton[(btn.tag || btnName).toLowerCase()] = btnName;
|
||||
|
||||
return $('<button/>', {
|
||||
type: 'button',
|
||||
class: prefix + btnName + '-dropdown-button' + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
|
||||
html: t.hasSvg && hasIcon ? '<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' + (btn.text || btn.title || t.lang[btnName] || btnName) : (btn.text || btn.title || t.lang[btnName] || btnName),
|
||||
title: ((btn.key) ? ' (Ctrl + ' + btn.key + ')' : null),
|
||||
style: btn.style || null,
|
||||
mousedown: function () {
|
||||
$('body', t.doc).trigger('mousedown');
|
||||
|
||||
t.execCmd(btn.fn || btnName, btn.param || btnName, btn.forceCss);
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
// Check if button is supported
|
||||
isSupportedBtn: function (b) {
|
||||
try {
|
||||
return this.btnsDef[b].isSupported();
|
||||
} catch (c) {
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
// Build overlay for modal box
|
||||
buildOverlay: function () {
|
||||
var t = this;
|
||||
t.$overlay = $('<div/>', {
|
||||
class: t.o.prefix + 'overlay'
|
||||
}).appendTo(t.$box);
|
||||
return t.$overlay;
|
||||
},
|
||||
showOverlay: function () {
|
||||
var t = this;
|
||||
$(window).trigger('scroll');
|
||||
t.$overlay.fadeIn(200);
|
||||
t.$box.addClass(t.o.prefix + 'box-blur');
|
||||
},
|
||||
hideOverlay: function () {
|
||||
var t = this;
|
||||
t.$overlay.fadeOut(50);
|
||||
t.$box.removeClass(t.o.prefix + 'box-blur');
|
||||
},
|
||||
|
||||
// Management of fixed button pane
|
||||
fixedBtnPaneEvents: function () {
|
||||
var t = this,
|
||||
fixedFullWidth = t.o.fixedFullWidth,
|
||||
$box = t.$box;
|
||||
|
||||
if (!t.o.fixedBtnPane) {
|
||||
return;
|
||||
}
|
||||
|
||||
t.isFixed = false;
|
||||
|
||||
$(window)
|
||||
.on('scroll.' + t.eventNamespace + ' resize.' + t.eventNamespace, function () {
|
||||
if (!$box) {
|
||||
return;
|
||||
}
|
||||
|
||||
t.syncCode();
|
||||
|
||||
var scrollTop = $(window).scrollTop(),
|
||||
offset = $box.offset().top + 1,
|
||||
bp = t.$btnPane,
|
||||
oh = bp.outerHeight() - 2;
|
||||
|
||||
if ((scrollTop - offset > 0) && ((scrollTop - offset - t.height) < 0)) {
|
||||
if (!t.isFixed) {
|
||||
t.isFixed = true;
|
||||
bp.css({
|
||||
position: 'fixed',
|
||||
top: 0,
|
||||
left: fixedFullWidth ? '0' : 'auto',
|
||||
zIndex: 7
|
||||
});
|
||||
$([t.$ta, t.$ed]).css({marginTop: bp.height()});
|
||||
}
|
||||
bp.css({
|
||||
width: fixedFullWidth ? '100%' : (($box.width() - 1) + 'px')
|
||||
});
|
||||
|
||||
$('.' + t.o.prefix + 'fixed-top', $box).css({
|
||||
position: fixedFullWidth ? 'fixed' : 'absolute',
|
||||
top: fixedFullWidth ? oh : oh + (scrollTop - offset) + 'px',
|
||||
zIndex: 15
|
||||
});
|
||||
} else if (t.isFixed) {
|
||||
t.isFixed = false;
|
||||
bp.removeAttr('style');
|
||||
$([t.$ta, t.$ed]).css({marginTop: 0});
|
||||
$('.' + t.o.prefix + 'fixed-top', $box).css({
|
||||
position: 'absolute',
|
||||
top: oh
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Disable editor
|
||||
setDisabled: function (disable) {
|
||||
var t = this,
|
||||
prefix = t.o.prefix;
|
||||
|
||||
t.disabled = disable;
|
||||
|
||||
if (disable) {
|
||||
t.$ta.attr('disabled', true);
|
||||
} else {
|
||||
t.$ta.removeAttr('disabled');
|
||||
}
|
||||
t.$box.toggleClass(prefix + 'disabled', disable);
|
||||
t.$ed.attr('contenteditable', !disable);
|
||||
},
|
||||
|
||||
// Destroy the editor
|
||||
destroy: function () {
|
||||
var t = this,
|
||||
prefix = t.o.prefix;
|
||||
|
||||
if (t.isTextarea) {
|
||||
t.$box.after(
|
||||
t.$ta
|
||||
.css({height: ''})
|
||||
.val(t.html())
|
||||
.removeClass(prefix + 'textarea')
|
||||
.show()
|
||||
);
|
||||
} else {
|
||||
t.$box.after(
|
||||
t.$ed
|
||||
.css({height: ''})
|
||||
.removeClass(prefix + 'editor')
|
||||
.removeAttr('contenteditable')
|
||||
.removeAttr('dir')
|
||||
.html(t.html())
|
||||
.show()
|
||||
);
|
||||
}
|
||||
|
||||
t.$ed.off('dblclick', 'img');
|
||||
|
||||
t.destroyPlugins();
|
||||
|
||||
t.$box.remove();
|
||||
t.$c.removeData('trumbowyg');
|
||||
$('body').removeClass(prefix + 'body-fullscreen');
|
||||
t.$c.trigger('tbwclose');
|
||||
$(window).off('scroll.' + t.eventNamespace + ' resize.' + t.eventNamespace);
|
||||
},
|
||||
|
||||
|
||||
// Empty the editor
|
||||
empty: function () {
|
||||
this.$ta.val('');
|
||||
this.syncCode(true);
|
||||
},
|
||||
|
||||
|
||||
// Function call when click on viewHTML button
|
||||
toggle: function () {
|
||||
var t = this,
|
||||
prefix = t.o.prefix;
|
||||
|
||||
if (t.o.autogrowOnEnter) {
|
||||
t.autogrowOnEnterDontClose = !t.$box.hasClass(prefix + 'editor-hidden');
|
||||
}
|
||||
|
||||
t.semanticCode(false, true);
|
||||
|
||||
setTimeout(function () {
|
||||
t.doc.activeElement.blur();
|
||||
t.$box.toggleClass(prefix + 'editor-hidden ' + prefix + 'editor-visible');
|
||||
t.$btnPane.toggleClass(prefix + 'disable');
|
||||
$('.' + prefix + 'viewHTML-button', t.$btnPane).toggleClass(prefix + 'active');
|
||||
if (t.$box.hasClass(prefix + 'editor-visible')) {
|
||||
t.$ta.attr('tabindex', -1);
|
||||
} else {
|
||||
t.$ta.removeAttr('tabindex');
|
||||
}
|
||||
|
||||
if (t.o.autogrowOnEnter && !t.autogrowOnEnterDontClose) {
|
||||
t.autogrowEditorOnEnter();
|
||||
}
|
||||
}, 0);
|
||||
},
|
||||
|
||||
// Open dropdown when click on a button which open that
|
||||
dropdown: function (name) {
|
||||
var t = this,
|
||||
d = t.doc,
|
||||
prefix = t.o.prefix,
|
||||
$dropdown = $('[data-' + prefix + 'dropdown=' + name + ']', t.$box),
|
||||
$btn = $('.' + prefix + name + '-button', t.$btnPane),
|
||||
show = $dropdown.is(':hidden');
|
||||
|
||||
$('body', d).trigger('mousedown');
|
||||
|
||||
if (show) {
|
||||
var o = $btn.offset().left;
|
||||
$btn.addClass(prefix + 'active');
|
||||
|
||||
$dropdown.css({
|
||||
position: 'absolute',
|
||||
top: $btn.offset().top - t.$btnPane.offset().top + $btn.outerHeight(),
|
||||
left: (t.o.fixedFullWidth && t.isFixed) ? o + 'px' : (o - t.$btnPane.offset().left) + 'px'
|
||||
}).show();
|
||||
|
||||
$(window).trigger('scroll');
|
||||
|
||||
$('body', d).on('mousedown.' + t.eventNamespace, function (e) {
|
||||
if (!$dropdown.is(e.target)) {
|
||||
$('.' + prefix + 'dropdown', t.$box).hide();
|
||||
$('.' + prefix + 'active', t.$btnPane).removeClass(prefix + 'active');
|
||||
$('body', d).off('mousedown.' + t.eventNamespace);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// HTML Code management
|
||||
html: function (html) {
|
||||
var t = this;
|
||||
|
||||
if (html != null) {
|
||||
t.$ta.val(html);
|
||||
t.syncCode(true);
|
||||
t.$c.trigger('tbwchange');
|
||||
return t;
|
||||
}
|
||||
|
||||
return t.$ta.val();
|
||||
},
|
||||
syncTextarea: function () {
|
||||
var t = this;
|
||||
t.$ta.val(t.$ed.text().trim().length > 0 || t.$ed.find('hr,img,embed,iframe,input').length > 0 ? t.$ed.html() : '');
|
||||
},
|
||||
syncCode: function (force) {
|
||||
var t = this;
|
||||
if (!force && t.$ed.is(':visible')) {
|
||||
t.syncTextarea();
|
||||
} else {
|
||||
// wrap the content in a div it's easier to get the innerhtml
|
||||
var html = $('<div>').html(t.$ta.val());
|
||||
//scrub the html before loading into the doc
|
||||
var safe = $('<div>').append(html);
|
||||
$(t.o.tagsToRemove.join(','), safe).remove();
|
||||
t.$ed.html(safe.contents().html());
|
||||
}
|
||||
|
||||
if (t.o.autogrow) {
|
||||
t.height = t.$ed.height();
|
||||
if (t.height !== t.$ta.css('height')) {
|
||||
t.$ta.css({height: t.height});
|
||||
t.$c.trigger('tbwresize');
|
||||
}
|
||||
}
|
||||
if (t.o.autogrowOnEnter) {
|
||||
// t.autogrowEditorOnEnter();
|
||||
t.$ed.height('auto');
|
||||
var totalheight = t.autogrowOnEnterWasFocused ? t.$ed[0].scrollHeight : t.$ed.css('min-height');
|
||||
if (totalheight !== t.$ta.css('height')) {
|
||||
t.$ed.css({height: totalheight});
|
||||
t.$c.trigger('tbwresize');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Analyse and update to semantic code
|
||||
// @param force : force to sync code from textarea
|
||||
// @param full : wrap text nodes in <p>
|
||||
// @param keepRange : leave selection range as it is
|
||||
semanticCode: function (force, full, keepRange) {
|
||||
var t = this;
|
||||
t.saveRange();
|
||||
t.syncCode(force);
|
||||
|
||||
if (t.o.semantic) {
|
||||
t.semanticTag('b');
|
||||
t.semanticTag('i');
|
||||
t.semanticTag('s');
|
||||
t.semanticTag('strike');
|
||||
|
||||
if (full) {
|
||||
var inlineElementsSelector = t.o.inlineElementsSelector,
|
||||
blockElementsSelector = ':not(' + inlineElementsSelector + ')';
|
||||
|
||||
// Wrap text nodes in span for easier processing
|
||||
t.$ed.contents().filter(function () {
|
||||
return this.nodeType === 3 && this.nodeValue.trim().length > 0;
|
||||
}).wrap('<span data-tbw/>');
|
||||
|
||||
// Wrap groups of inline elements in paragraphs (recursive)
|
||||
var wrapInlinesInParagraphsFrom = function ($from) {
|
||||
if ($from.length !== 0) {
|
||||
var $finalParagraph = $from.nextUntil(blockElementsSelector).addBack().wrapAll('<p/>').parent(),
|
||||
$nextElement = $finalParagraph.nextAll(inlineElementsSelector).first();
|
||||
$finalParagraph.next('br').remove();
|
||||
wrapInlinesInParagraphsFrom($nextElement);
|
||||
}
|
||||
};
|
||||
wrapInlinesInParagraphsFrom(t.$ed.children(inlineElementsSelector).first());
|
||||
|
||||
t.semanticTag('div', true);
|
||||
|
||||
// Unwrap paragraphs content, containing nothing usefull
|
||||
t.$ed.find('p').filter(function () {
|
||||
// Don't remove currently being edited element
|
||||
if (t.range && this === t.range.startContainer) {
|
||||
return false;
|
||||
}
|
||||
return $(this).text().trim().length === 0 && $(this).children().not('br,span').length === 0;
|
||||
}).contents().unwrap();
|
||||
|
||||
// Get rid of temporial span's
|
||||
$('[data-tbw]', t.$ed).contents().unwrap();
|
||||
|
||||
// Remove empty <p>
|
||||
t.$ed.find('p:empty').remove();
|
||||
}
|
||||
|
||||
if (!keepRange) {
|
||||
t.restoreRange();
|
||||
}
|
||||
|
||||
t.syncTextarea();
|
||||
}
|
||||
},
|
||||
|
||||
semanticTag: function (oldTag, copyAttributes) {
|
||||
var newTag;
|
||||
|
||||
if (this.o.semantic != null && typeof this.o.semantic === 'object' && this.o.semantic.hasOwnProperty(oldTag)) {
|
||||
newTag = this.o.semantic[oldTag];
|
||||
} else if (this.o.semantic === true && this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(oldTag)) {
|
||||
newTag = this.DEFAULT_SEMANTIC_MAP[oldTag];
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
$(oldTag, this.$ed).each(function () {
|
||||
var $oldTag = $(this);
|
||||
$oldTag.wrap('<' + newTag + '/>');
|
||||
if (copyAttributes) {
|
||||
$.each($oldTag.prop('attributes'), function () {
|
||||
$oldTag.parent().attr(this.name, this.value);
|
||||
});
|
||||
}
|
||||
$oldTag.contents().unwrap();
|
||||
});
|
||||
},
|
||||
|
||||
// Function call when user click on "Insert Link"
|
||||
createLink: function () {
|
||||
var t = this,
|
||||
documentSelection = t.doc.getSelection(),
|
||||
node = documentSelection.focusNode,
|
||||
text = new XMLSerializer().serializeToString(documentSelection.getRangeAt(0).cloneContents()),
|
||||
url,
|
||||
title,
|
||||
target;
|
||||
|
||||
while (['A', 'DIV'].indexOf(node.nodeName) < 0) {
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
if (node && node.nodeName === 'A') {
|
||||
var $a = $(node);
|
||||
text = $a.text();
|
||||
url = $a.attr('href');
|
||||
if (!t.o.minimalLinks) {
|
||||
title = $a.attr('title');
|
||||
target = $a.attr('target');
|
||||
}
|
||||
var range = t.doc.createRange();
|
||||
range.selectNode(node);
|
||||
documentSelection.removeAllRanges();
|
||||
documentSelection.addRange(range);
|
||||
}
|
||||
|
||||
t.saveRange();
|
||||
|
||||
var options = {
|
||||
url: {
|
||||
label: 'URL',
|
||||
required: true,
|
||||
value: url
|
||||
},
|
||||
text: {
|
||||
label: t.lang.text,
|
||||
value: text
|
||||
}
|
||||
};
|
||||
if (!t.o.minimalLinks) {
|
||||
Object.assign(options, {
|
||||
title: {
|
||||
label: t.lang.title,
|
||||
value: title
|
||||
},
|
||||
target: {
|
||||
label: t.lang.target,
|
||||
value: target
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
t.openModalInsert(t.lang.createLink, options, function (v) { // v is value
|
||||
var url = t.prependUrlPrefix(v.url);
|
||||
if (!url.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var link = $(['<a href="', v.url, '">', v.text || v.url, '</a>'].join(''));
|
||||
|
||||
if (!t.o.minimalLinks) {
|
||||
if (v.title.length > 0) {
|
||||
link.attr('title', v.title);
|
||||
}
|
||||
if (v.target.length > 0) {
|
||||
link.attr('target', v.target);
|
||||
}
|
||||
}
|
||||
t.range.deleteContents();
|
||||
t.range.insertNode(link[0]);
|
||||
t.syncCode();
|
||||
t.$c.trigger('tbwchange');
|
||||
return true;
|
||||
});
|
||||
},
|
||||
prependUrlPrefix: function (url) {
|
||||
var t = this;
|
||||
if (!t.urlPrefix) {
|
||||
return url;
|
||||
}
|
||||
|
||||
const VALID_LINK_PREFIX = /^([a-z][-+.a-z0-9]*:|\/|#)/i;
|
||||
if (VALID_LINK_PREFIX.test(url)) {
|
||||
return url;
|
||||
}
|
||||
|
||||
const SIMPLE_EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
if (SIMPLE_EMAIL_REGEX.test(url)) {
|
||||
return 'mailto:' + url;
|
||||
}
|
||||
|
||||
return t.urlPrefix + url;
|
||||
},
|
||||
unlink: function () {
|
||||
var t = this,
|
||||
documentSelection = t.doc.getSelection(),
|
||||
node = documentSelection.focusNode;
|
||||
|
||||
if (documentSelection.isCollapsed) {
|
||||
while (['A', 'DIV'].indexOf(node.nodeName) < 0) {
|
||||
node = node.parentNode;
|
||||
}
|
||||
|
||||
if (node && node.nodeName === 'A') {
|
||||
var range = t.doc.createRange();
|
||||
range.selectNode(node);
|
||||
documentSelection.removeAllRanges();
|
||||
documentSelection.addRange(range);
|
||||
}
|
||||
}
|
||||
t.execCmd('unlink', undefined, undefined, true);
|
||||
},
|
||||
insertImage: function () {
|
||||
var t = this;
|
||||
t.saveRange();
|
||||
|
||||
var options = {
|
||||
url: {
|
||||
label: 'URL',
|
||||
required: true
|
||||
},
|
||||
alt: {
|
||||
label: t.lang.description,
|
||||
value: t.getRangeText()
|
||||
}
|
||||
};
|
||||
|
||||
if (t.o.imageWidthModalEdit) {
|
||||
options.width = {};
|
||||
}
|
||||
|
||||
t.openModalInsert(t.lang.insertImage, options, function (v) { // v are values
|
||||
t.execCmd('insertImage', v.url);
|
||||
var $img = $('img[src="' + v.url + '"]:not([alt])', t.$box);
|
||||
$img.attr('alt', v.alt);
|
||||
|
||||
if (t.o.imageWidthModalEdit) {
|
||||
$img.attr({
|
||||
width: v.width
|
||||
});
|
||||
}
|
||||
|
||||
t.syncCode();
|
||||
t.$c.trigger('tbwchange');
|
||||
|
||||
return true;
|
||||
});
|
||||
},
|
||||
fullscreen: function () {
|
||||
var t = this,
|
||||
prefix = t.o.prefix,
|
||||
fullscreenCssClass = prefix + 'fullscreen',
|
||||
isFullscreen;
|
||||
|
||||
t.$box.toggleClass(fullscreenCssClass);
|
||||
isFullscreen = t.$box.hasClass(fullscreenCssClass);
|
||||
$('body').toggleClass(prefix + 'body-fullscreen', isFullscreen);
|
||||
$(window).trigger('scroll');
|
||||
t.$c.trigger('tbw' + (isFullscreen ? 'open' : 'close') + 'fullscreen');
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Call method of trumbowyg if exist
|
||||
* else try to call anonymous function
|
||||
* and finaly native execCommand
|
||||
*/
|
||||
execCmd: function (cmd, param, forceCss, skipTrumbowyg) {
|
||||
var t = this;
|
||||
skipTrumbowyg = !!skipTrumbowyg || '';
|
||||
|
||||
if (cmd !== 'dropdown') {
|
||||
t.$ed.focus();
|
||||
}
|
||||
|
||||
try {
|
||||
t.doc.execCommand('styleWithCSS', false, forceCss || false);
|
||||
} catch (c) {
|
||||
}
|
||||
|
||||
try {
|
||||
t[cmd + skipTrumbowyg](param);
|
||||
} catch (c) {
|
||||
try {
|
||||
cmd(param);
|
||||
} catch (e2) {
|
||||
if (cmd === 'insertHorizontalRule') {
|
||||
param = undefined;
|
||||
} else if (cmd === 'formatBlock' && t.isIE) {
|
||||
param = '<' + param + '>';
|
||||
}
|
||||
|
||||
t.doc.execCommand(cmd, false, param);
|
||||
|
||||
t.syncCode();
|
||||
t.semanticCode(false, true);
|
||||
}
|
||||
|
||||
if (cmd !== 'dropdown') {
|
||||
t.updateButtonPaneStatus();
|
||||
t.$c.trigger('tbwchange');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// Open a modal box
|
||||
openModal: function (title, content) {
|
||||
var t = this,
|
||||
prefix = t.o.prefix;
|
||||
|
||||
// No open a modal box when exist other modal box
|
||||
if ($('.' + prefix + 'modal-box', t.$box).length > 0) {
|
||||
return false;
|
||||
}
|
||||
if (t.o.autogrowOnEnter) {
|
||||
t.autogrowOnEnterDontClose = true;
|
||||
}
|
||||
|
||||
t.saveRange();
|
||||
t.showOverlay();
|
||||
|
||||
// Disable all btnPane btns
|
||||
t.$btnPane.addClass(prefix + 'disable');
|
||||
|
||||
// Build out of ModalBox, it's the mask for animations
|
||||
var $modal = $('<div/>', {
|
||||
class: prefix + 'modal ' + prefix + 'fixed-top'
|
||||
}).css({
|
||||
top: t.$btnPane.height()
|
||||
}).appendTo(t.$box);
|
||||
|
||||
// Click on overlay close modal by cancelling them
|
||||
t.$overlay.one('click', function () {
|
||||
$modal.trigger(CANCEL_EVENT);
|
||||
return false;
|
||||
});
|
||||
|
||||
// Build the form
|
||||
var $form = $('<form/>', {
|
||||
action: '',
|
||||
html: content
|
||||
})
|
||||
.on('submit', function () {
|
||||
$modal.trigger(CONFIRM_EVENT);
|
||||
return false;
|
||||
})
|
||||
.on('reset', function () {
|
||||
$modal.trigger(CANCEL_EVENT);
|
||||
return false;
|
||||
})
|
||||
.on('submit reset', function () {
|
||||
if (t.o.autogrowOnEnter) {
|
||||
t.autogrowOnEnterDontClose = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Build ModalBox and animate to show them
|
||||
var $box = $('<div/>', {
|
||||
class: prefix + 'modal-box',
|
||||
html: $form
|
||||
})
|
||||
.css({
|
||||
top: '-' + t.$btnPane.outerHeight() + 'px',
|
||||
opacity: 0
|
||||
})
|
||||
.appendTo($modal)
|
||||
.animate({
|
||||
top: 0,
|
||||
opacity: 1
|
||||
}, 100);
|
||||
|
||||
|
||||
// Append title
|
||||
$('<span/>', {
|
||||
text: title,
|
||||
class: prefix + 'modal-title'
|
||||
}).prependTo($box);
|
||||
|
||||
$modal.height($box.outerHeight() + 10);
|
||||
|
||||
|
||||
// Focus in modal box
|
||||
$('input:first', $box).focus();
|
||||
|
||||
|
||||
// Append Confirm and Cancel buttons
|
||||
t.buildModalBtn('submit', $box);
|
||||
t.buildModalBtn('reset', $box);
|
||||
|
||||
|
||||
$(window).trigger('scroll');
|
||||
|
||||
return $modal;
|
||||
},
|
||||
// @param n is name of modal
|
||||
buildModalBtn: function (n, $modal) {
|
||||
var t = this,
|
||||
prefix = t.o.prefix;
|
||||
|
||||
return $('<button/>', {
|
||||
class: prefix + 'modal-button ' + prefix + 'modal-' + n,
|
||||
type: n,
|
||||
text: t.lang[n] || n
|
||||
}).appendTo($('form', $modal));
|
||||
},
|
||||
// close current modal box
|
||||
closeModal: function () {
|
||||
var t = this,
|
||||
prefix = t.o.prefix;
|
||||
|
||||
t.$btnPane.removeClass(prefix + 'disable');
|
||||
t.$overlay.off();
|
||||
|
||||
// Find the modal box
|
||||
var $modalBox = $('.' + prefix + 'modal-box', t.$box);
|
||||
|
||||
$modalBox.animate({
|
||||
top: '-' + $modalBox.height()
|
||||
}, 100, function () {
|
||||
$modalBox.parent().remove();
|
||||
t.hideOverlay();
|
||||
});
|
||||
|
||||
t.restoreRange();
|
||||
},
|
||||
// Preformated build and management modal
|
||||
openModalInsert: function (title, fields, cmd) {
|
||||
var t = this,
|
||||
prefix = t.o.prefix,
|
||||
lg = t.lang,
|
||||
html = '';
|
||||
|
||||
$.each(fields, function (fieldName, field) {
|
||||
var l = field.label || fieldName,
|
||||
n = field.name || fieldName,
|
||||
a = field.attributes || {};
|
||||
|
||||
var attr = Object.keys(a).map(function (prop) {
|
||||
return prop + '="' + a[prop] + '"';
|
||||
}).join(' ');
|
||||
|
||||
html += '<label><input type="' + (field.type || 'text') + '" name="' + n + '"' +
|
||||
(field.type === 'checkbox' && field.value ? ' checked="checked"' : ' value="' + (field.value || '').replace(/"/g, '"')) +
|
||||
'"' + attr + '><span class="' + prefix + 'input-infos"><span>' +
|
||||
(lg[l] ? lg[l] : l) +
|
||||
'</span></span></label>';
|
||||
});
|
||||
|
||||
return t.openModal(title, html)
|
||||
.on(CONFIRM_EVENT, function () {
|
||||
var $form = $('form', $(this)),
|
||||
valid = true,
|
||||
values = {};
|
||||
|
||||
$.each(fields, function (fieldName, field) {
|
||||
var n = field.name || fieldName;
|
||||
|
||||
var $field = $('input[name="' + n + '"]', $form),
|
||||
inputType = $field.attr('type');
|
||||
|
||||
switch (inputType.toLowerCase()) {
|
||||
case 'checkbox':
|
||||
values[n] = $field.is(':checked');
|
||||
break;
|
||||
case 'radio':
|
||||
values[n] = $field.filter(':checked').val();
|
||||
break;
|
||||
default:
|
||||
values[n] = $.trim($field.val());
|
||||
break;
|
||||
}
|
||||
// Validate value
|
||||
if (field.required && values[n] === '') {
|
||||
valid = false;
|
||||
t.addErrorOnModalField($field, t.lang.required);
|
||||
} else if (field.pattern && !field.pattern.test(values[n])) {
|
||||
valid = false;
|
||||
t.addErrorOnModalField($field, field.patternError);
|
||||
}
|
||||
});
|
||||
|
||||
if (valid) {
|
||||
t.restoreRange();
|
||||
|
||||
if (cmd(values, fields)) {
|
||||
t.syncCode();
|
||||
t.$c.trigger('tbwchange');
|
||||
t.closeModal();
|
||||
$(this).off(CONFIRM_EVENT);
|
||||
}
|
||||
}
|
||||
})
|
||||
.one(CANCEL_EVENT, function () {
|
||||
$(this).off(CONFIRM_EVENT);
|
||||
t.closeModal();
|
||||
});
|
||||
},
|
||||
addErrorOnModalField: function ($field, err) {
|
||||
var prefix = this.o.prefix,
|
||||
$label = $field.parent();
|
||||
|
||||
$field
|
||||
.on('change keyup', function () {
|
||||
$label.removeClass(prefix + 'input-error');
|
||||
});
|
||||
|
||||
$label
|
||||
.addClass(prefix + 'input-error')
|
||||
.find('input+span')
|
||||
.append(
|
||||
$('<span/>', {
|
||||
class: prefix + 'msg-error',
|
||||
text: err
|
||||
})
|
||||
);
|
||||
},
|
||||
|
||||
getDefaultImgDblClickHandler: function () {
|
||||
var t = this;
|
||||
|
||||
return function () {
|
||||
var $img = $(this),
|
||||
src = $img.attr('src'),
|
||||
base64 = '(Base64)';
|
||||
|
||||
if (src.indexOf('data:image') === 0) {
|
||||
src = base64;
|
||||
}
|
||||
|
||||
var options = {
|
||||
url: {
|
||||
label: 'URL',
|
||||
value: src,
|
||||
required: true
|
||||
},
|
||||
alt: {
|
||||
label: t.lang.description,
|
||||
value: $img.attr('alt')
|
||||
}
|
||||
};
|
||||
|
||||
if (t.o.imageWidthModalEdit) {
|
||||
options.width = {
|
||||
value: $img.attr('width') ? $img.attr('width') : ''
|
||||
};
|
||||
}
|
||||
|
||||
t.openModalInsert(t.lang.insertImage, options, function (v) {
|
||||
if (v.src !== base64) {
|
||||
$img.attr({
|
||||
src: v.url
|
||||
});
|
||||
}
|
||||
$img.attr({
|
||||
alt: v.alt
|
||||
});
|
||||
|
||||
if (t.o.imageWidthModalEdit) {
|
||||
if (parseInt(v.width) > 0) {
|
||||
$img.attr({
|
||||
width: v.width
|
||||
});
|
||||
} else {
|
||||
$img.removeAttr('width');
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
return false;
|
||||
};
|
||||
},
|
||||
|
||||
// Range management
|
||||
saveRange: function () {
|
||||
var t = this,
|
||||
documentSelection = t.doc.getSelection();
|
||||
|
||||
t.range = null;
|
||||
|
||||
if (documentSelection.rangeCount) {
|
||||
var savedRange = t.range = documentSelection.getRangeAt(0),
|
||||
range = t.doc.createRange(),
|
||||
rangeStart;
|
||||
range.selectNodeContents(t.$ed[0]);
|
||||
range.setEnd(savedRange.startContainer, savedRange.startOffset);
|
||||
rangeStart = (range + '').length;
|
||||
t.metaRange = {
|
||||
start: rangeStart,
|
||||
end: rangeStart + (savedRange + '').length
|
||||
};
|
||||
}
|
||||
},
|
||||
restoreRange: function () {
|
||||
var t = this,
|
||||
metaRange = t.metaRange,
|
||||
savedRange = t.range,
|
||||
documentSelection = t.doc.getSelection(),
|
||||
range;
|
||||
|
||||
if (!savedRange) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (metaRange && metaRange.start !== metaRange.end) { // Algorithm from http://jsfiddle.net/WeWy7/3/
|
||||
var charIndex = 0,
|
||||
nodeStack = [t.$ed[0]],
|
||||
node,
|
||||
foundStart = false,
|
||||
stop = false;
|
||||
|
||||
range = t.doc.createRange();
|
||||
|
||||
while (!stop && (node = nodeStack.pop())) {
|
||||
if (node.nodeType === 3) {
|
||||
var nextCharIndex = charIndex + node.length;
|
||||
if (!foundStart && metaRange.start >= charIndex && metaRange.start <= nextCharIndex) {
|
||||
range.setStart(node, metaRange.start - charIndex);
|
||||
foundStart = true;
|
||||
}
|
||||
if (foundStart && metaRange.end >= charIndex && metaRange.end <= nextCharIndex) {
|
||||
range.setEnd(node, metaRange.end - charIndex);
|
||||
stop = true;
|
||||
}
|
||||
charIndex = nextCharIndex;
|
||||
} else {
|
||||
var cn = node.childNodes,
|
||||
i = cn.length;
|
||||
|
||||
while (i > 0) {
|
||||
i -= 1;
|
||||
nodeStack.push(cn[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
documentSelection.removeAllRanges();
|
||||
documentSelection.addRange(range || savedRange);
|
||||
},
|
||||
getRangeText: function () {
|
||||
return this.range + '';
|
||||
},
|
||||
|
||||
updateButtonPaneStatus: function () {
|
||||
var t = this,
|
||||
prefix = t.o.prefix,
|
||||
tags = t.getTagsRecursive(t.doc.getSelection().focusNode),
|
||||
activeClasses = prefix + 'active-button ' + prefix + 'active';
|
||||
|
||||
$('.' + prefix + 'active-button', t.$btnPane).removeClass(activeClasses);
|
||||
$.each(tags, function (i, tag) {
|
||||
var btnName = t.tagToButton[tag.toLowerCase()],
|
||||
$btn = $('.' + prefix + btnName + '-button', t.$btnPane);
|
||||
|
||||
if ($btn.length > 0) {
|
||||
$btn.addClass(activeClasses);
|
||||
} else {
|
||||
try {
|
||||
$btn = $('.' + prefix + 'dropdown .' + prefix + btnName + '-dropdown-button', t.$box);
|
||||
var dropdownBtnName = $btn.parent().data('dropdown');
|
||||
$('.' + prefix + dropdownBtnName + '-button', t.$box).addClass(activeClasses);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
getTagsRecursive: function (element, tags) {
|
||||
var t = this;
|
||||
tags = tags || (element && element.tagName ? [element.tagName] : []);
|
||||
|
||||
if (element && element.parentNode) {
|
||||
element = element.parentNode;
|
||||
} else {
|
||||
return tags;
|
||||
}
|
||||
|
||||
var tag = element.tagName;
|
||||
if (tag === 'DIV') {
|
||||
return tags;
|
||||
}
|
||||
if (tag === 'P' && element.style.textAlign !== '') {
|
||||
tags.push(element.style.textAlign);
|
||||
}
|
||||
|
||||
$.each(t.tagHandlers, function (i, tagHandler) {
|
||||
tags = tags.concat(tagHandler(element, t));
|
||||
});
|
||||
|
||||
tags.push(tag);
|
||||
|
||||
return t.getTagsRecursive(element, tags).filter(function (tag) {
|
||||
return tag != null;
|
||||
});
|
||||
},
|
||||
|
||||
// Plugins
|
||||
initPlugins: function () {
|
||||
var t = this;
|
||||
t.loadedPlugins = [];
|
||||
$.each($.trumbowyg.plugins, function (name, plugin) {
|
||||
if (!plugin.shouldInit || plugin.shouldInit(t)) {
|
||||
plugin.init(t);
|
||||
if (plugin.tagHandler) {
|
||||
t.tagHandlers.push(plugin.tagHandler);
|
||||
}
|
||||
t.loadedPlugins.push(plugin);
|
||||
}
|
||||
});
|
||||
},
|
||||
destroyPlugins: function () {
|
||||
$.each(this.loadedPlugins, function (i, plugin) {
|
||||
if (plugin.destroy) {
|
||||
plugin.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
})(navigator, window, document, jQuery);
|
||||
Vendored
+2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,809 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Default stylesheet for Trumbowyg editor
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
$light-color: #ecf0f1 !default;
|
||||
$dark-color: #222 !default;
|
||||
|
||||
$modal-submit-color: #2ecc71 !default;
|
||||
$modal-reset-color: #EEE !default;
|
||||
|
||||
$transition-duration: 150ms !default;
|
||||
$slow-transition-duration: 300ms !default;
|
||||
|
||||
#trumbowyg-icons {
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
height: 0;
|
||||
width: 0;
|
||||
|
||||
svg {
|
||||
height: 0;
|
||||
width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-box {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 17px;
|
||||
height: 100%;
|
||||
fill: $dark-color;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-box,
|
||||
.trumbowyg-editor {
|
||||
display: block;
|
||||
position: relative;
|
||||
border: 1px solid #DDD;
|
||||
width: 100%;
|
||||
min-height: 300px;
|
||||
margin: 17px auto;
|
||||
}
|
||||
|
||||
.trumbowyg-box .trumbowyg-editor {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.trumbowyg-box.trumbowyg-fullscreen {
|
||||
background: #FEFEFE;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.trumbowyg-editor,
|
||||
.trumbowyg-textarea {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding: 20px;
|
||||
min-height: 300px;
|
||||
width: 100%;
|
||||
border-style: none;
|
||||
resize: none;
|
||||
outline: none;
|
||||
overflow: auto;
|
||||
|
||||
&.trumbowyg-autogrow-on-enter {
|
||||
transition: height $slow-transition-duration ease-out;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-box-blur .trumbowyg-editor {
|
||||
*,
|
||||
&::before {
|
||||
color: transparent !important;
|
||||
text-shadow: 0 0 7px #333;
|
||||
|
||||
@media screen and (min-width: 0 \0) {
|
||||
color: rgba(200, 200, 200, 0.6) !important;
|
||||
}
|
||||
@supports (-ms-accelerator:true) {
|
||||
color: rgba(200, 200, 200, 0.6) !important;
|
||||
}
|
||||
}
|
||||
img,
|
||||
hr {
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-textarea {
|
||||
position: relative;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
font-family: "Inconsolata", "Consolas", "Courier", "Courier New", sans-serif;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.trumbowyg-box.trumbowyg-editor-visible {
|
||||
.trumbowyg-textarea {
|
||||
height: 1px !important;
|
||||
width: 25%;
|
||||
min-height: 0 !important;
|
||||
padding: 0 !important;
|
||||
background: none;
|
||||
opacity: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-box.trumbowyg-editor-hidden {
|
||||
.trumbowyg-textarea {
|
||||
display: block;
|
||||
}
|
||||
.trumbowyg-editor {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-box.trumbowyg-disabled {
|
||||
.trumbowyg-textarea {
|
||||
opacity: 0.8;
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-editor[contenteditable=true]:empty:not(:focus)::before {
|
||||
content: attr(placeholder);
|
||||
color: #999;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.trumbowyg-button-pane {
|
||||
width: 100%;
|
||||
min-height: 36px;
|
||||
background: $light-color;
|
||||
border-bottom: 1px solid darken($light-color, 7%);
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
position: relative;
|
||||
list-style-type: none;
|
||||
line-height: 10px;
|
||||
backface-visibility: hidden;
|
||||
z-index: 11;
|
||||
|
||||
&::after {
|
||||
content: " ";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 36px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background: darken($light-color, 7%);
|
||||
}
|
||||
|
||||
.trumbowyg-button-group {
|
||||
display: inline-block;
|
||||
|
||||
.trumbowyg-fullscreen-button svg {
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: " ";
|
||||
display: inline-block;
|
||||
width: 1px;
|
||||
background: darken($light-color, 7%);
|
||||
margin: 0 5px;
|
||||
height: 35px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
&:last-child::after {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
|
||||
button {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
padding: 1px 6px !important;
|
||||
margin-bottom: 1px;
|
||||
overflow: hidden;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
vertical-align: middle;
|
||||
transition: background-color $transition-duration, opacity $transition-duration;
|
||||
|
||||
&.trumbowyg-textual-button {
|
||||
width: auto;
|
||||
line-height: 35px;
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.trumbowyg-disable button:not(.trumbowyg-not-disable):not(.trumbowyg-active),
|
||||
button.trumbowyg-disable,
|
||||
.trumbowyg-disabled & button:not(.trumbowyg-not-disable):not(.trumbowyg-viewHTML-button) {
|
||||
opacity: 0.2;
|
||||
cursor: default;
|
||||
}
|
||||
&.trumbowyg-disable,
|
||||
.trumbowyg-disabled & {
|
||||
.trumbowyg-button-group::before {
|
||||
background: darken($light-color, 3%);
|
||||
}
|
||||
}
|
||||
|
||||
button:not(.trumbowyg-disable):hover,
|
||||
button:not(.trumbowyg-disable):focus,
|
||||
button.trumbowyg-active {
|
||||
background-color: #FFF;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.trumbowyg-open-dropdown {
|
||||
&::after {
|
||||
display: block;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
right: 3px;
|
||||
height: 0;
|
||||
width: 0;
|
||||
border: 3px solid transparent;
|
||||
border-top-color: #555;
|
||||
}
|
||||
|
||||
&.trumbowyg-textual-button {
|
||||
padding-left: 10px !important;
|
||||
padding-right: 18px !important;
|
||||
|
||||
&::after {
|
||||
top: 17px;
|
||||
right: 7px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-right {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-dropdown {
|
||||
width: 200px;
|
||||
border: 1px solid $light-color;
|
||||
padding: 5px 0;
|
||||
border-top: none;
|
||||
background: #FFF;
|
||||
margin-left: -1px;
|
||||
box-shadow: rgba(0, 0, 0, .1) 0 2px 3px;
|
||||
z-index: 12;
|
||||
|
||||
button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
text-decoration: none;
|
||||
background: #FFF;
|
||||
padding: 0 10px;
|
||||
color: #333 !important;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
font-size: 15px;
|
||||
transition: all $transition-duration;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: $light-color;
|
||||
}
|
||||
|
||||
svg {
|
||||
float: left;
|
||||
margin-right: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Modal box */
|
||||
.trumbowyg-modal {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
max-width: 520px;
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
z-index: 12;
|
||||
overflow: hidden;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.trumbowyg-modal-box {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
max-width: 500px;
|
||||
width: calc(100% - 20px);
|
||||
padding-bottom: 45px;
|
||||
z-index: 1;
|
||||
background-color: #FFF;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
box-shadow: rgba(0, 0, 0, .2) 0 2px 3px;
|
||||
backface-visibility: hidden;
|
||||
|
||||
.trumbowyg-modal-title {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin: 0 0 20px;
|
||||
padding: 15px 0 13px;
|
||||
display: block;
|
||||
border-bottom: 1px solid #EEE;
|
||||
color: #333;
|
||||
background: lighten($light-color, 5%);
|
||||
}
|
||||
|
||||
.trumbowyg-progress {
|
||||
width: 100%;
|
||||
height: 3px;
|
||||
position: absolute;
|
||||
top: 58px;
|
||||
|
||||
.trumbowyg-progress-bar {
|
||||
background: #2BC06A;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
transition: width $transition-duration linear;
|
||||
}
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
position: relative;
|
||||
margin: 15px 12px;
|
||||
height: 29px;
|
||||
line-height: 29px;
|
||||
overflow: hidden;
|
||||
|
||||
.trumbowyg-input-infos {
|
||||
display: block;
|
||||
text-align: left;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
transition: all 150ms;
|
||||
|
||||
span {
|
||||
display: block;
|
||||
color: darken($light-color, 45%);
|
||||
background-color: lighten($light-color, 5%);
|
||||
border: 1px solid #DEDEDE;
|
||||
padding: 0 7px;
|
||||
width: 150px;
|
||||
}
|
||||
span.trumbowyg-msg-error {
|
||||
color: #e74c3c;
|
||||
}
|
||||
}
|
||||
|
||||
&.trumbowyg-input-error {
|
||||
input,
|
||||
textarea {
|
||||
border: 1px solid #e74c3c;
|
||||
}
|
||||
|
||||
.trumbowyg-input-infos {
|
||||
margin-top: -27px;
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
height: 27px;
|
||||
line-height: 27px;
|
||||
border: 1px solid #DEDEDE;
|
||||
background: #fff;
|
||||
font-size: 14px;
|
||||
max-width: 330px;
|
||||
width: 70%;
|
||||
padding: 0 7px;
|
||||
transition: all $transition-duration;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
outline: none;
|
||||
border: 1px solid #95a5a6;
|
||||
}
|
||||
&:focus {
|
||||
background: lighten($light-color, 5%);
|
||||
}
|
||||
}
|
||||
|
||||
input[type="checkbox"]{
|
||||
left: 5px;
|
||||
top: 5px;
|
||||
right: auto;
|
||||
|
||||
+ .trumbowyg-input-infos span{
|
||||
width: auto;
|
||||
padding-left: 25px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.error {
|
||||
margin-top: 25px;
|
||||
display: block;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.trumbowyg-modal-button {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 0;
|
||||
text-decoration: none;
|
||||
color: #FFF;
|
||||
display: block;
|
||||
width: 100px;
|
||||
height: 35px;
|
||||
line-height: 33px;
|
||||
margin: 0 10px;
|
||||
background-color: #333;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif;
|
||||
font-size: 16px;
|
||||
transition: all $transition-duration;
|
||||
|
||||
&.trumbowyg-modal-submit {
|
||||
right: 110px;
|
||||
background: darken($modal-submit-color, 3%);
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: lighten($modal-submit-color, 5%);
|
||||
outline: none;
|
||||
}
|
||||
&:active {
|
||||
background: darken($modal-submit-color, 10%);
|
||||
}
|
||||
}
|
||||
|
||||
&.trumbowyg-modal-reset {
|
||||
color: #555;
|
||||
background: darken($modal-reset-color, 3%);
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: lighten($modal-reset-color, 5%);
|
||||
outline: none;
|
||||
}
|
||||
&:active {
|
||||
background: darken($modal-reset-color, 10%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-overlay {
|
||||
position: absolute;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
display: none;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fullscreen
|
||||
*/
|
||||
body.trumbowyg-body-fullscreen {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.trumbowyg-fullscreen {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
z-index: 99999;
|
||||
|
||||
&.trumbowyg-box,
|
||||
.trumbowyg-editor {
|
||||
border: none;
|
||||
}
|
||||
.trumbowyg-editor,
|
||||
.trumbowyg-textarea {
|
||||
height: calc(100% - 37px) !important;
|
||||
overflow: auto;
|
||||
}
|
||||
.trumbowyg-overlay {
|
||||
height: 100% !important;
|
||||
}
|
||||
.trumbowyg-button-group .trumbowyg-fullscreen-button svg {
|
||||
color: $dark-color;
|
||||
fill: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-editor {
|
||||
object,
|
||||
embed,
|
||||
video,
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
video,
|
||||
img {
|
||||
height: auto;
|
||||
}
|
||||
img {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
/*
|
||||
* lset for resetCss option
|
||||
*/
|
||||
&.trumbowyg-reset-css {
|
||||
background: #FEFEFE !important;
|
||||
font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif !important;
|
||||
font-size: 14px !important;
|
||||
line-height: 1.45em !important;
|
||||
color: #333;
|
||||
|
||||
a {
|
||||
color: #15c !important;
|
||||
text-decoration: underline !important;
|
||||
}
|
||||
|
||||
div,
|
||||
p,
|
||||
ul,
|
||||
ol,
|
||||
blockquote {
|
||||
box-shadow: none !important;
|
||||
background: none !important;
|
||||
margin: 0 !important;
|
||||
margin-bottom: 15px !important;
|
||||
line-height: 1.4em !important;
|
||||
font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif !important;
|
||||
font-size: 14px !important;
|
||||
border: none;
|
||||
}
|
||||
iframe,
|
||||
object,
|
||||
hr {
|
||||
margin-bottom: 15px !important;
|
||||
}
|
||||
blockquote {
|
||||
margin-left: 32px !important;
|
||||
font-style: italic !important;
|
||||
color: #555;
|
||||
}
|
||||
ul {
|
||||
list-style: disc;
|
||||
}
|
||||
ul,
|
||||
ol {
|
||||
padding-left: 20px !important;
|
||||
}
|
||||
ul ul,
|
||||
ol ol,
|
||||
ul ol,
|
||||
ol ul {
|
||||
border: none;
|
||||
margin: 2px !important;
|
||||
padding: 0 !important;
|
||||
padding-left: 24px !important;
|
||||
}
|
||||
hr {
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: none;
|
||||
border-top: 1px solid #CCC;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4 {
|
||||
color: #111;
|
||||
background: none;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 32px !important;
|
||||
line-height: 38px !important;
|
||||
margin-bottom: 20px !important;
|
||||
}
|
||||
h2 {
|
||||
font-size: 26px !important;
|
||||
line-height: 34px !important;
|
||||
margin-bottom: 15px !important;
|
||||
}
|
||||
h3 {
|
||||
font-size: 22px !important;
|
||||
line-height: 28px !important;
|
||||
margin-bottom: 7px !important;
|
||||
}
|
||||
h4 {
|
||||
font-size: 16px !important;
|
||||
line-height: 22px !important;
|
||||
margin-bottom: 7px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Dark theme
|
||||
*/
|
||||
.trumbowyg-dark {
|
||||
.trumbowyg-textarea {
|
||||
background: #111;
|
||||
color: #ddd;
|
||||
}
|
||||
.trumbowyg-box {
|
||||
border: 1px solid lighten($dark-color, 7%);
|
||||
|
||||
&.trumbowyg-fullscreen {
|
||||
background: #111;
|
||||
}
|
||||
&.trumbowyg-box-blur .trumbowyg-editor {
|
||||
*,
|
||||
&::before {
|
||||
text-shadow: 0 0 7px #ccc;
|
||||
|
||||
@media screen and (min-width: 0 \0
|
||||
) {
|
||||
color: rgba(20, 20, 20, 0.6) !important;
|
||||
}
|
||||
@supports (-ms-accelerator:true) {
|
||||
color: rgba(20, 20, 20, 0.6) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
svg {
|
||||
fill: $light-color;
|
||||
color: $light-color;
|
||||
}
|
||||
}
|
||||
.trumbowyg-button-pane {
|
||||
background-color: $dark-color;
|
||||
border-bottom-color: lighten($dark-color, 7%);
|
||||
|
||||
&::after {
|
||||
background: lighten($dark-color, 7%);
|
||||
}
|
||||
|
||||
.trumbowyg-button-group:not(:empty) {
|
||||
&::after {
|
||||
background-color: lighten($dark-color, 7%);
|
||||
}
|
||||
.trumbowyg-fullscreen-button svg {
|
||||
color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
&.trumbowyg-disable {
|
||||
.trumbowyg-button-group::after {
|
||||
background-color: lighten($dark-color, 3%);
|
||||
}
|
||||
}
|
||||
|
||||
button:not(.trumbowyg-disable):hover,
|
||||
button:not(.trumbowyg-disable):focus,
|
||||
button.trumbowyg-active {
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
.trumbowyg-open-dropdown::after {
|
||||
border-top-color: #fff;
|
||||
}
|
||||
}
|
||||
.trumbowyg-fullscreen {
|
||||
.trumbowyg-button-group .trumbowyg-fullscreen-button svg {
|
||||
color: $light-color;
|
||||
fill: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-dropdown {
|
||||
border-color: $dark-color;
|
||||
background: #333;
|
||||
box-shadow: rgba(0, 0, 0, .3) 0 2px 3px;
|
||||
|
||||
button {
|
||||
background: #333;
|
||||
color: #fff !important;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: $dark-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Modal box
|
||||
.trumbowyg-modal-box {
|
||||
background-color: $dark-color;
|
||||
|
||||
.trumbowyg-modal-title {
|
||||
border-bottom: 1px solid #555;
|
||||
color: #fff;
|
||||
background: lighten($dark-color, 10%);
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
position: relative;
|
||||
margin: 15px 12px;
|
||||
height: 27px;
|
||||
line-height: 27px;
|
||||
overflow: hidden;
|
||||
|
||||
.trumbowyg-input-infos {
|
||||
span {
|
||||
color: #eee;
|
||||
background-color: lighten($dark-color, 5%);
|
||||
border-color: $dark-color;
|
||||
}
|
||||
span.trumbowyg-msg-error {
|
||||
color: #e74c3c;
|
||||
}
|
||||
}
|
||||
|
||||
&.trumbowyg-input-error {
|
||||
input,
|
||||
textarea {
|
||||
border-color: #e74c3c;
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
border-color: $dark-color;
|
||||
color: #eee;
|
||||
background: #333;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
border-color: lighten($dark-color, 25%);
|
||||
}
|
||||
&:focus {
|
||||
background-color: lighten($dark-color, 5%);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.trumbowyg-modal-button {
|
||||
&.trumbowyg-modal-submit {
|
||||
background: darken($modal-submit-color, 20%);
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: darken($modal-submit-color, 10%);
|
||||
}
|
||||
&:active {
|
||||
background: darken($modal-submit-color, 25%);
|
||||
}
|
||||
}
|
||||
&.trumbowyg-modal-reset {
|
||||
background: #333;
|
||||
color: #ccc;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background: #444;
|
||||
}
|
||||
&:active {
|
||||
background: #111;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.trumbowyg-overlay {
|
||||
background-color: rgba(15, 15, 15, 0.6);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,587 @@
|
||||
/**
|
||||
* Trumbowyg v2.10.0 - A lightweight WYSIWYG editor
|
||||
* Default stylesheet for Trumbowyg editor
|
||||
* ------------------------
|
||||
* @link http://alex-d.github.io/Trumbowyg
|
||||
* @license MIT
|
||||
* @author Alexandre Demode (Alex-D)
|
||||
* Twitter : @AlexandreDemode
|
||||
* Website : alex-d.fr
|
||||
*/
|
||||
|
||||
#trumbowyg-icons {
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
height: 0;
|
||||
width: 0; }
|
||||
#trumbowyg-icons svg {
|
||||
height: 0;
|
||||
width: 0; }
|
||||
|
||||
.trumbowyg-box *,
|
||||
.trumbowyg-box *::before,
|
||||
.trumbowyg-box *::after {
|
||||
box-sizing: border-box; }
|
||||
|
||||
.trumbowyg-box svg {
|
||||
width: 17px;
|
||||
height: 100%;
|
||||
fill: #222; }
|
||||
|
||||
.trumbowyg-box,
|
||||
.trumbowyg-editor {
|
||||
display: block;
|
||||
position: relative;
|
||||
border: 1px solid #DDD;
|
||||
width: 100%;
|
||||
min-height: 300px;
|
||||
margin: 17px auto; }
|
||||
|
||||
.trumbowyg-box .trumbowyg-editor {
|
||||
margin: 0 auto; }
|
||||
|
||||
.trumbowyg-box.trumbowyg-fullscreen {
|
||||
background: #FEFEFE;
|
||||
border: none !important; }
|
||||
|
||||
.trumbowyg-editor,
|
||||
.trumbowyg-textarea {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding: 20px;
|
||||
min-height: 300px;
|
||||
width: 100%;
|
||||
border-style: none;
|
||||
resize: none;
|
||||
outline: none;
|
||||
overflow: auto; }
|
||||
.trumbowyg-editor.trumbowyg-autogrow-on-enter,
|
||||
.trumbowyg-textarea.trumbowyg-autogrow-on-enter {
|
||||
transition: height 300ms ease-out; }
|
||||
|
||||
.trumbowyg-box-blur .trumbowyg-editor *, .trumbowyg-box-blur .trumbowyg-editor::before {
|
||||
color: transparent !important;
|
||||
text-shadow: 0 0 7px #333; }
|
||||
@media screen and (min-width: 0 \0) {
|
||||
.trumbowyg-box-blur .trumbowyg-editor *, .trumbowyg-box-blur .trumbowyg-editor::before {
|
||||
color: rgba(200, 200, 200, 0.6) !important; } }
|
||||
@supports (-ms-accelerator: true) {
|
||||
.trumbowyg-box-blur .trumbowyg-editor *, .trumbowyg-box-blur .trumbowyg-editor::before {
|
||||
color: rgba(200, 200, 200, 0.6) !important; } }
|
||||
|
||||
.trumbowyg-box-blur .trumbowyg-editor img,
|
||||
.trumbowyg-box-blur .trumbowyg-editor hr {
|
||||
opacity: 0.2; }
|
||||
|
||||
.trumbowyg-textarea {
|
||||
position: relative;
|
||||
display: block;
|
||||
overflow: auto;
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
font-family: "Inconsolata", "Consolas", "Courier", "Courier New", sans-serif;
|
||||
line-height: 18px; }
|
||||
|
||||
.trumbowyg-box.trumbowyg-editor-visible .trumbowyg-textarea {
|
||||
height: 1px !important;
|
||||
width: 25%;
|
||||
min-height: 0 !important;
|
||||
padding: 0 !important;
|
||||
background: none;
|
||||
opacity: 0 !important; }
|
||||
|
||||
.trumbowyg-box.trumbowyg-editor-hidden .trumbowyg-textarea {
|
||||
display: block; }
|
||||
|
||||
.trumbowyg-box.trumbowyg-editor-hidden .trumbowyg-editor {
|
||||
display: none; }
|
||||
|
||||
.trumbowyg-box.trumbowyg-disabled .trumbowyg-textarea {
|
||||
opacity: 0.8;
|
||||
background: none; }
|
||||
|
||||
.trumbowyg-editor[contenteditable=true]:empty:not(:focus)::before {
|
||||
content: attr(placeholder);
|
||||
color: #999;
|
||||
pointer-events: none; }
|
||||
|
||||
.trumbowyg-button-pane {
|
||||
width: 100%;
|
||||
min-height: 36px;
|
||||
background: #ecf0f1;
|
||||
border-bottom: 1px solid #d7e0e2;
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
position: relative;
|
||||
list-style-type: none;
|
||||
line-height: 10px;
|
||||
backface-visibility: hidden;
|
||||
z-index: 11; }
|
||||
.trumbowyg-button-pane::after {
|
||||
content: " ";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 36px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
height: 1px;
|
||||
background: #d7e0e2; }
|
||||
.trumbowyg-button-pane .trumbowyg-button-group {
|
||||
display: inline-block; }
|
||||
.trumbowyg-button-pane .trumbowyg-button-group .trumbowyg-fullscreen-button svg {
|
||||
color: transparent; }
|
||||
.trumbowyg-button-pane .trumbowyg-button-group::after {
|
||||
content: " ";
|
||||
display: inline-block;
|
||||
width: 1px;
|
||||
background: #d7e0e2;
|
||||
margin: 0 5px;
|
||||
height: 35px;
|
||||
vertical-align: top; }
|
||||
.trumbowyg-button-pane .trumbowyg-button-group:last-child::after {
|
||||
content: none; }
|
||||
.trumbowyg-button-pane button {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
padding: 1px 6px !important;
|
||||
margin-bottom: 1px;
|
||||
overflow: hidden;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
vertical-align: middle;
|
||||
transition: background-color 150ms, opacity 150ms; }
|
||||
.trumbowyg-button-pane button.trumbowyg-textual-button {
|
||||
width: auto;
|
||||
line-height: 35px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none; }
|
||||
.trumbowyg-button-pane.trumbowyg-disable button:not(.trumbowyg-not-disable):not(.trumbowyg-active),
|
||||
.trumbowyg-button-pane button.trumbowyg-disable,
|
||||
.trumbowyg-disabled .trumbowyg-button-pane button:not(.trumbowyg-not-disable):not(.trumbowyg-viewHTML-button) {
|
||||
opacity: 0.2;
|
||||
cursor: default; }
|
||||
.trumbowyg-button-pane.trumbowyg-disable .trumbowyg-button-group::before,
|
||||
.trumbowyg-disabled .trumbowyg-button-pane .trumbowyg-button-group::before {
|
||||
background: #e3e9eb; }
|
||||
.trumbowyg-button-pane button:not(.trumbowyg-disable):hover,
|
||||
.trumbowyg-button-pane button:not(.trumbowyg-disable):focus,
|
||||
.trumbowyg-button-pane button.trumbowyg-active {
|
||||
background-color: #FFF;
|
||||
outline: none; }
|
||||
.trumbowyg-button-pane .trumbowyg-open-dropdown::after {
|
||||
display: block;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
right: 3px;
|
||||
height: 0;
|
||||
width: 0;
|
||||
border: 3px solid transparent;
|
||||
border-top-color: #555; }
|
||||
.trumbowyg-button-pane .trumbowyg-open-dropdown.trumbowyg-textual-button {
|
||||
padding-left: 10px !important;
|
||||
padding-right: 18px !important; }
|
||||
.trumbowyg-button-pane .trumbowyg-open-dropdown.trumbowyg-textual-button::after {
|
||||
top: 17px;
|
||||
right: 7px; }
|
||||
.trumbowyg-button-pane .trumbowyg-right {
|
||||
float: right; }
|
||||
|
||||
.trumbowyg-dropdown {
|
||||
width: 200px;
|
||||
border: 1px solid #ecf0f1;
|
||||
padding: 5px 0;
|
||||
border-top: none;
|
||||
background: #FFF;
|
||||
margin-left: -1px;
|
||||
box-shadow: rgba(0, 0, 0, 0.1) 0 2px 3px;
|
||||
z-index: 12; }
|
||||
.trumbowyg-dropdown button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
text-decoration: none;
|
||||
background: #FFF;
|
||||
padding: 0 10px;
|
||||
color: #333 !important;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
font-size: 15px;
|
||||
transition: all 150ms; }
|
||||
.trumbowyg-dropdown button:hover, .trumbowyg-dropdown button:focus {
|
||||
background: #ecf0f1; }
|
||||
.trumbowyg-dropdown button svg {
|
||||
float: left;
|
||||
margin-right: 14px; }
|
||||
|
||||
/* Modal box */
|
||||
.trumbowyg-modal {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
max-width: 520px;
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
z-index: 12;
|
||||
overflow: hidden;
|
||||
backface-visibility: hidden; }
|
||||
|
||||
.trumbowyg-modal-box {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
max-width: 500px;
|
||||
width: calc(100% - 20px);
|
||||
padding-bottom: 45px;
|
||||
z-index: 1;
|
||||
background-color: #FFF;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
box-shadow: rgba(0, 0, 0, 0.2) 0 2px 3px;
|
||||
backface-visibility: hidden; }
|
||||
.trumbowyg-modal-box .trumbowyg-modal-title {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin: 0 0 20px;
|
||||
padding: 15px 0 13px;
|
||||
display: block;
|
||||
border-bottom: 1px solid #EEE;
|
||||
color: #333;
|
||||
background: #fbfcfc; }
|
||||
.trumbowyg-modal-box .trumbowyg-progress {
|
||||
width: 100%;
|
||||
height: 3px;
|
||||
position: absolute;
|
||||
top: 58px; }
|
||||
.trumbowyg-modal-box .trumbowyg-progress .trumbowyg-progress-bar {
|
||||
background: #2BC06A;
|
||||
width: 0;
|
||||
height: 100%;
|
||||
transition: width 150ms linear; }
|
||||
.trumbowyg-modal-box label {
|
||||
display: block;
|
||||
position: relative;
|
||||
margin: 15px 12px;
|
||||
height: 29px;
|
||||
line-height: 29px;
|
||||
overflow: hidden; }
|
||||
.trumbowyg-modal-box label .trumbowyg-input-infos {
|
||||
display: block;
|
||||
text-align: left;
|
||||
height: 25px;
|
||||
line-height: 25px;
|
||||
transition: all 150ms; }
|
||||
.trumbowyg-modal-box label .trumbowyg-input-infos span {
|
||||
display: block;
|
||||
color: #69878f;
|
||||
background-color: #fbfcfc;
|
||||
border: 1px solid #DEDEDE;
|
||||
padding: 0 7px;
|
||||
width: 150px; }
|
||||
.trumbowyg-modal-box label .trumbowyg-input-infos span.trumbowyg-msg-error {
|
||||
color: #e74c3c; }
|
||||
.trumbowyg-modal-box label.trumbowyg-input-error input,
|
||||
.trumbowyg-modal-box label.trumbowyg-input-error textarea {
|
||||
border: 1px solid #e74c3c; }
|
||||
.trumbowyg-modal-box label.trumbowyg-input-error .trumbowyg-input-infos {
|
||||
margin-top: -27px; }
|
||||
.trumbowyg-modal-box label input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
height: 27px;
|
||||
line-height: 27px;
|
||||
border: 1px solid #DEDEDE;
|
||||
background: #fff;
|
||||
font-size: 14px;
|
||||
max-width: 330px;
|
||||
width: 70%;
|
||||
padding: 0 7px;
|
||||
transition: all 150ms; }
|
||||
.trumbowyg-modal-box label input:hover, .trumbowyg-modal-box label input:focus {
|
||||
outline: none;
|
||||
border: 1px solid #95a5a6; }
|
||||
.trumbowyg-modal-box label input:focus {
|
||||
background: #fbfcfc; }
|
||||
.trumbowyg-modal-box label input[type="checkbox"] {
|
||||
left: 5px;
|
||||
top: 5px;
|
||||
right: auto; }
|
||||
.trumbowyg-modal-box label input[type="checkbox"] + .trumbowyg-input-infos span {
|
||||
width: auto;
|
||||
padding-left: 25px; }
|
||||
.trumbowyg-modal-box .error {
|
||||
margin-top: 25px;
|
||||
display: block;
|
||||
color: red; }
|
||||
.trumbowyg-modal-box .trumbowyg-modal-button {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 0;
|
||||
text-decoration: none;
|
||||
color: #FFF;
|
||||
display: block;
|
||||
width: 100px;
|
||||
height: 35px;
|
||||
line-height: 33px;
|
||||
margin: 0 10px;
|
||||
background-color: #333;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif;
|
||||
font-size: 16px;
|
||||
transition: all 150ms; }
|
||||
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit {
|
||||
right: 110px;
|
||||
background: #2bc06a; }
|
||||
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:hover, .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:focus {
|
||||
background: #40d47e;
|
||||
outline: none; }
|
||||
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:active {
|
||||
background: #25a25a; }
|
||||
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset {
|
||||
color: #555;
|
||||
background: #e6e6e6; }
|
||||
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:hover, .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:focus {
|
||||
background: #fbfbfb;
|
||||
outline: none; }
|
||||
.trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:active {
|
||||
background: #d5d5d5; }
|
||||
|
||||
.trumbowyg-overlay {
|
||||
position: absolute;
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
left: 0;
|
||||
display: none;
|
||||
top: 0;
|
||||
z-index: 10; }
|
||||
|
||||
/**
|
||||
* Fullscreen
|
||||
*/
|
||||
body.trumbowyg-body-fullscreen {
|
||||
overflow: hidden; }
|
||||
|
||||
.trumbowyg-fullscreen {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
z-index: 99999; }
|
||||
.trumbowyg-fullscreen.trumbowyg-box,
|
||||
.trumbowyg-fullscreen .trumbowyg-editor {
|
||||
border: none; }
|
||||
.trumbowyg-fullscreen .trumbowyg-editor,
|
||||
.trumbowyg-fullscreen .trumbowyg-textarea {
|
||||
height: calc(100% - 37px) !important;
|
||||
overflow: auto; }
|
||||
.trumbowyg-fullscreen .trumbowyg-overlay {
|
||||
height: 100% !important; }
|
||||
.trumbowyg-fullscreen .trumbowyg-button-group .trumbowyg-fullscreen-button svg {
|
||||
color: #222;
|
||||
fill: transparent; }
|
||||
|
||||
.trumbowyg-editor {
|
||||
/*
|
||||
* lset for resetCss option
|
||||
*/ }
|
||||
.trumbowyg-editor object,
|
||||
.trumbowyg-editor embed,
|
||||
.trumbowyg-editor video,
|
||||
.trumbowyg-editor img {
|
||||
max-width: 100%; }
|
||||
.trumbowyg-editor video,
|
||||
.trumbowyg-editor img {
|
||||
height: auto; }
|
||||
.trumbowyg-editor img {
|
||||
cursor: move; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css {
|
||||
background: #FEFEFE !important;
|
||||
font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif !important;
|
||||
font-size: 14px !important;
|
||||
line-height: 1.45em !important;
|
||||
color: #333; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css a {
|
||||
color: #15c !important;
|
||||
text-decoration: underline !important; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css div,
|
||||
.trumbowyg-editor.trumbowyg-reset-css p,
|
||||
.trumbowyg-editor.trumbowyg-reset-css ul,
|
||||
.trumbowyg-editor.trumbowyg-reset-css ol,
|
||||
.trumbowyg-editor.trumbowyg-reset-css blockquote {
|
||||
box-shadow: none !important;
|
||||
background: none !important;
|
||||
margin: 0 !important;
|
||||
margin-bottom: 15px !important;
|
||||
line-height: 1.4em !important;
|
||||
font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif !important;
|
||||
font-size: 14px !important;
|
||||
border: none; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css iframe,
|
||||
.trumbowyg-editor.trumbowyg-reset-css object,
|
||||
.trumbowyg-editor.trumbowyg-reset-css hr {
|
||||
margin-bottom: 15px !important; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css blockquote {
|
||||
margin-left: 32px !important;
|
||||
font-style: italic !important;
|
||||
color: #555; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css ul {
|
||||
list-style: disc; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css ul,
|
||||
.trumbowyg-editor.trumbowyg-reset-css ol {
|
||||
padding-left: 20px !important; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css ul ul,
|
||||
.trumbowyg-editor.trumbowyg-reset-css ol ol,
|
||||
.trumbowyg-editor.trumbowyg-reset-css ul ol,
|
||||
.trumbowyg-editor.trumbowyg-reset-css ol ul {
|
||||
border: none;
|
||||
margin: 2px !important;
|
||||
padding: 0 !important;
|
||||
padding-left: 24px !important; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css hr {
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: none;
|
||||
border-top: 1px solid #CCC; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css h1,
|
||||
.trumbowyg-editor.trumbowyg-reset-css h2,
|
||||
.trumbowyg-editor.trumbowyg-reset-css h3,
|
||||
.trumbowyg-editor.trumbowyg-reset-css h4 {
|
||||
color: #111;
|
||||
background: none;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
font-weight: bold; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css h1 {
|
||||
font-size: 32px !important;
|
||||
line-height: 38px !important;
|
||||
margin-bottom: 20px !important; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css h2 {
|
||||
font-size: 26px !important;
|
||||
line-height: 34px !important;
|
||||
margin-bottom: 15px !important; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css h3 {
|
||||
font-size: 22px !important;
|
||||
line-height: 28px !important;
|
||||
margin-bottom: 7px !important; }
|
||||
.trumbowyg-editor.trumbowyg-reset-css h4 {
|
||||
font-size: 16px !important;
|
||||
line-height: 22px !important;
|
||||
margin-bottom: 7px !important; }
|
||||
|
||||
/*
|
||||
* Dark theme
|
||||
*/
|
||||
.trumbowyg-dark .trumbowyg-textarea {
|
||||
background: #111;
|
||||
color: #ddd; }
|
||||
|
||||
.trumbowyg-dark .trumbowyg-box {
|
||||
border: 1px solid #343434; }
|
||||
.trumbowyg-dark .trumbowyg-box.trumbowyg-fullscreen {
|
||||
background: #111; }
|
||||
.trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor *, .trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor::before {
|
||||
text-shadow: 0 0 7px #ccc; }
|
||||
@media screen and (min-width: 0 \0 ) {
|
||||
.trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor *, .trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor::before {
|
||||
color: rgba(20, 20, 20, 0.6) !important; } }
|
||||
@supports (-ms-accelerator: true) {
|
||||
.trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor *, .trumbowyg-dark .trumbowyg-box.trumbowyg-box-blur .trumbowyg-editor::before {
|
||||
color: rgba(20, 20, 20, 0.6) !important; } }
|
||||
.trumbowyg-dark .trumbowyg-box svg {
|
||||
fill: #ecf0f1;
|
||||
color: #ecf0f1; }
|
||||
|
||||
.trumbowyg-dark .trumbowyg-button-pane {
|
||||
background-color: #222;
|
||||
border-bottom-color: #343434; }
|
||||
.trumbowyg-dark .trumbowyg-button-pane::after {
|
||||
background: #343434; }
|
||||
.trumbowyg-dark .trumbowyg-button-pane .trumbowyg-button-group:not(:empty)::after {
|
||||
background-color: #343434; }
|
||||
.trumbowyg-dark .trumbowyg-button-pane .trumbowyg-button-group:not(:empty) .trumbowyg-fullscreen-button svg {
|
||||
color: transparent; }
|
||||
.trumbowyg-dark .trumbowyg-button-pane.trumbowyg-disable .trumbowyg-button-group::after {
|
||||
background-color: #2a2a2a; }
|
||||
.trumbowyg-dark .trumbowyg-button-pane button:not(.trumbowyg-disable):hover,
|
||||
.trumbowyg-dark .trumbowyg-button-pane button:not(.trumbowyg-disable):focus,
|
||||
.trumbowyg-dark .trumbowyg-button-pane button.trumbowyg-active {
|
||||
background-color: #333; }
|
||||
.trumbowyg-dark .trumbowyg-button-pane .trumbowyg-open-dropdown::after {
|
||||
border-top-color: #fff; }
|
||||
|
||||
.trumbowyg-dark .trumbowyg-fullscreen .trumbowyg-button-group .trumbowyg-fullscreen-button svg {
|
||||
color: #ecf0f1;
|
||||
fill: transparent; }
|
||||
|
||||
.trumbowyg-dark .trumbowyg-dropdown {
|
||||
border-color: #222;
|
||||
background: #333;
|
||||
box-shadow: rgba(0, 0, 0, 0.3) 0 2px 3px; }
|
||||
.trumbowyg-dark .trumbowyg-dropdown button {
|
||||
background: #333;
|
||||
color: #fff !important; }
|
||||
.trumbowyg-dark .trumbowyg-dropdown button:hover, .trumbowyg-dark .trumbowyg-dropdown button:focus {
|
||||
background: #222; }
|
||||
|
||||
.trumbowyg-dark .trumbowyg-modal-box {
|
||||
background-color: #222; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-title {
|
||||
border-bottom: 1px solid #555;
|
||||
color: #fff;
|
||||
background: #3c3c3c; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box label {
|
||||
display: block;
|
||||
position: relative;
|
||||
margin: 15px 12px;
|
||||
height: 27px;
|
||||
line-height: 27px;
|
||||
overflow: hidden; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box label .trumbowyg-input-infos span {
|
||||
color: #eee;
|
||||
background-color: #2f2f2f;
|
||||
border-color: #222; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box label .trumbowyg-input-infos span.trumbowyg-msg-error {
|
||||
color: #e74c3c; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box label.trumbowyg-input-error input,
|
||||
.trumbowyg-dark .trumbowyg-modal-box label.trumbowyg-input-error textarea {
|
||||
border-color: #e74c3c; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box label input {
|
||||
border-color: #222;
|
||||
color: #eee;
|
||||
background: #333; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box label input:hover, .trumbowyg-dark .trumbowyg-modal-box label input:focus {
|
||||
border-color: #626262; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box label input:focus {
|
||||
background-color: #2f2f2f; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit {
|
||||
background: #1b7943; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:hover, .trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:focus {
|
||||
background: #25a25a; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-submit:active {
|
||||
background: #176437; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset {
|
||||
background: #333;
|
||||
color: #ccc; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:hover, .trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:focus {
|
||||
background: #444; }
|
||||
.trumbowyg-dark .trumbowyg-modal-box .trumbowyg-modal-button.trumbowyg-modal-reset:active {
|
||||
background: #111; }
|
||||
|
||||
.trumbowyg-dark .trumbowyg-overlay {
|
||||
background-color: rgba(15, 15, 15, 0.6); }
|
||||
Vendored
+2
File diff suppressed because one or more lines are too long
+37
-5
@@ -48,13 +48,20 @@ if ($me['level'] >= 5) {
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 내무부</title>
|
||||
<script>
|
||||
var editable = <?=($me['level']>=5?'true':'false')?>;
|
||||
</script>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/trumbowyg/trumbowyg.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/trumbowyg/langs/ko.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/dipcenter.js')?>
|
||||
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/trumbowyg/ui/trumbowyg.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
|
||||
<?=WebUtil::printCSS('css/dipcenter.css')?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -223,10 +230,35 @@ if ($budgetricediff > 0) {
|
||||
<form name=form1 method=post action=c_dipcenter.php>
|
||||
<tr><td colspan=2 height=10></td></tr>
|
||||
<tr><td colspan=2 align=center bgcolor=orange>국 가 방 침 & 임관 권유 메시지</td></tr>
|
||||
<tr><td colspan=2 class=bg1>국가 방침 <textarea <?=$read?> maxlength=16000 rows="5" style="color:white;background-color:black;width:830px;" name=msg><?=$nation['msg']?></textarea><input type=<?=$btn?> name=btn value=국가방침></td></tr>
|
||||
<tr><td colspan=2 class=bg1>임관 권유 <input type=text <?=$read?> maxlength=1000 style=color:white;background-color:black;width:830px; name=scoutmsg value='<?=$nation['scoutmsg']?>'><input type=<?=$btn?> name=btn value=임관권유></td></tr>
|
||||
<tr><td colspan=2>870px x 200px를 넘어서는 내용은 표시되지 않습니다.</td></tr>
|
||||
<tr><td colspan=2 height=10></td></tr>
|
||||
<tr><td colspan='2'><div id='noticeForm'>
|
||||
<div class='bg1' style="display: flex; justify-content: space-around">
|
||||
<div style='flex: 1 1 auto;'>
|
||||
국가 방침
|
||||
</div>
|
||||
<div>
|
||||
<input type='submit' class='submit' name=btn value='국가방침 수정'><input type='button' class='cancel_edit' value='취소'>
|
||||
</div>
|
||||
</div>
|
||||
<textarea type=hidden class='input_form' style='display:none;' name=msg><?=$nation['msg']?></textarea>
|
||||
<div class='edit_form viewer'></div>
|
||||
</div></td></tr>
|
||||
<tr><td colspan='2'><div id='scoutMsgForm'>
|
||||
<div class='bg1' style="display: flex; justify-content: space-around">
|
||||
<div style='flex: 1 1 auto;'>
|
||||
임관 권유
|
||||
</div>
|
||||
<div>
|
||||
<input type='submit' class='submit' name=btn value='임관 권유문 수정'><input type='button' class='cancel_edit' value='취소'>
|
||||
</div>
|
||||
</div>
|
||||
<div style='border-bottom:solid gray 0.5px;'>870px x 200px를 넘어서는 내용은 표시되지 않습니다.</div>
|
||||
<textarea type=hidden class='input_form' style='display:none;' name=scoutmsg><?=$nation['scoutmsg']?></textarea>
|
||||
<div style="width:870px;margin-left:auto;">
|
||||
<div class='edit_form viewer'></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div></td></tr>
|
||||
<tr><td colspan=2 align=center bgcolor=green>예 산 & 정 책</td></tr>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
|
||||
+2
-2
@@ -28,13 +28,13 @@ if($me['level'] < 5) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if($btn == "국가방침") {
|
||||
if($btn == "국가방침 수정") {
|
||||
$msg = mb_substr($msg, 0, 16384);
|
||||
//$msg = StringUtil::
|
||||
$db->update('nation', [
|
||||
'msg'=>WebUtil::htmlPurify($msg)
|
||||
], 'nation=%i',$me['nation']);
|
||||
} elseif($btn == "임관권유") {
|
||||
} elseif($btn == "임관 권유문 수정") {
|
||||
$scoutmsg = mb_substr($scoutmsg, 0, 1000);
|
||||
$db->update('nation', [
|
||||
'scoutmsg'=>WebUtil::htmlPurify($scoutmsg)
|
||||
|
||||
+17
-1
@@ -201,4 +201,20 @@ div.bar_out div.bar_in{
|
||||
font-size : .875rem;
|
||||
line-height : .5;
|
||||
border-radius : .2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.edit_form.viewer{
|
||||
max-height:200px;
|
||||
overflow-y:auto;
|
||||
}
|
||||
|
||||
.trumbowyg-box{
|
||||
margin:0;
|
||||
border-left:none;
|
||||
border-right:none;
|
||||
}
|
||||
|
||||
.edit_form.trumbowyg-editor{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#scoutMsgForm .viewer{
|
||||
max-height:200px;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery(function($){
|
||||
|
||||
function guiEditorInit($obj, editable){
|
||||
var $submitBtn = $obj.find('.submit');
|
||||
var $noticeInput = $obj.find('.input_form');
|
||||
var $editForm = $obj.find('.edit_form');
|
||||
var $cancelEdit = $obj.find('.cancel_edit');
|
||||
|
||||
var editMode = false;
|
||||
|
||||
function enableEditor(){
|
||||
editMode = true;
|
||||
$cancelEdit.show();
|
||||
$editForm.removeClass('viewer').trumbowyg({
|
||||
autogrow: true,
|
||||
autogrowOnEnter: true,
|
||||
lang: 'ko',
|
||||
removeformatPasted: true
|
||||
|
||||
}).trumbowyg('html', $noticeInput.val());
|
||||
}
|
||||
|
||||
function disableEditor(){
|
||||
editMode = false;
|
||||
$editForm.trumbowyg('destroy');
|
||||
$cancelEdit.hide();
|
||||
$editForm.html($noticeInput.val()).addClass('viewer');
|
||||
}
|
||||
|
||||
$cancelEdit.hide();
|
||||
$editForm.html($noticeInput.val());
|
||||
if(editable){
|
||||
$submitBtn.prop('disabled', false);
|
||||
}
|
||||
else{
|
||||
$submitBtn.prop('disabled', true);
|
||||
}
|
||||
|
||||
$submitBtn.click(function(e){
|
||||
if(!editMode){
|
||||
e.preventDefault();
|
||||
enableEditor();
|
||||
return false;
|
||||
}
|
||||
$noticeInput.val($editForm.trumbowyg('html'));
|
||||
});
|
||||
|
||||
$cancelEdit.click(function(e){
|
||||
e.preventDefault();
|
||||
disableEditor();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
guiEditorInit($('#noticeForm'), editable);
|
||||
guiEditorInit($('#scoutMsgForm'), editable);
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user