From 2890b032837e36dd477aa39cf473c05e8257e205 Mon Sep 17 00:00:00 2001
From: Pierre HUBERT
Date: Thu, 27 Dec 2018 14:02:01 +0100
Subject: [PATCH] Switched to BBCode language for posts.
---
README.md | 12 +-
.../js-bbcode-parser/bbcode-config.js | 289 ++++++++++++++++++
.../js-bbcode-parser/bbcode-parser.js | 152 +++++++++
assets/3rdparty/sceditor/formats/bbcode.js | 3 +
assets/3rdparty/sceditor/formats/xhtml.js | 3 +
assets/3rdparty/sceditor/icons/material.js | 3 +
assets/3rdparty/sceditor/icons/monocons.js | 3 +
.../sceditor/jquery.sceditor.bbcode.min.js | 3 +
.../3rdparty/sceditor/jquery.sceditor.min.js | 3 +
.../sceditor/jquery.sceditor.xhtml.min.js | 3 +
assets/3rdparty/sceditor/plugins/autosave.js | 3 +
.../3rdparty/sceditor/plugins/autoyoutube.js | 3 +
assets/3rdparty/sceditor/plugins/dragdrop.js | 3 +
assets/3rdparty/sceditor/plugins/format.js | 3 +
assets/3rdparty/sceditor/plugins/plaintext.js | 3 +
.../3rdparty/sceditor/plugins/strictbbcode.js | 2 +
assets/3rdparty/sceditor/plugins/undo.js | 3 +
assets/3rdparty/sceditor/plugins/v1compat.js | 3 +
assets/3rdparty/sceditor/sceditor.min.js | 3 +
.../sceditor/themes/content/default.min.css | 1 +
.../3rdparty/sceditor/themes/default.min.css | 1 +
.../sceditor/themes/defaultdark.min.css | 1 +
assets/3rdparty/sceditor/themes/famfamfam.png | Bin 0 -> 4583 bytes
.../3rdparty/sceditor/themes/modern.min.css | 1 +
.../sceditor/themes/office-toolbar.min.css | 1 +
.../3rdparty/sceditor/themes/office.min.css | 1 +
.../3rdparty/sceditor/themes/square.min.css | 1 +
assets/js/common/utils.js | 23 ++
assets/js/components/posts/edit.js | 16 +-
assets/js/components/posts/form.js | 31 +-
assets/js/components/posts/ui.js | 2 +-
system/config/dev.config.php | 12 +
32 files changed, 573 insertions(+), 18 deletions(-)
create mode 100644 assets/3rdparty/js-bbcode-parser/bbcode-config.js
create mode 100644 assets/3rdparty/js-bbcode-parser/bbcode-parser.js
create mode 100644 assets/3rdparty/sceditor/formats/bbcode.js
create mode 100644 assets/3rdparty/sceditor/formats/xhtml.js
create mode 100644 assets/3rdparty/sceditor/icons/material.js
create mode 100644 assets/3rdparty/sceditor/icons/monocons.js
create mode 100644 assets/3rdparty/sceditor/jquery.sceditor.bbcode.min.js
create mode 100644 assets/3rdparty/sceditor/jquery.sceditor.min.js
create mode 100644 assets/3rdparty/sceditor/jquery.sceditor.xhtml.min.js
create mode 100644 assets/3rdparty/sceditor/plugins/autosave.js
create mode 100644 assets/3rdparty/sceditor/plugins/autoyoutube.js
create mode 100644 assets/3rdparty/sceditor/plugins/dragdrop.js
create mode 100644 assets/3rdparty/sceditor/plugins/format.js
create mode 100644 assets/3rdparty/sceditor/plugins/plaintext.js
create mode 100644 assets/3rdparty/sceditor/plugins/strictbbcode.js
create mode 100644 assets/3rdparty/sceditor/plugins/undo.js
create mode 100644 assets/3rdparty/sceditor/plugins/v1compat.js
create mode 100644 assets/3rdparty/sceditor/sceditor.min.js
create mode 100644 assets/3rdparty/sceditor/themes/content/default.min.css
create mode 100644 assets/3rdparty/sceditor/themes/default.min.css
create mode 100644 assets/3rdparty/sceditor/themes/defaultdark.min.css
create mode 100644 assets/3rdparty/sceditor/themes/famfamfam.png
create mode 100644 assets/3rdparty/sceditor/themes/modern.min.css
create mode 100644 assets/3rdparty/sceditor/themes/office-toolbar.min.css
create mode 100644 assets/3rdparty/sceditor/themes/office.min.css
create mode 100644 assets/3rdparty/sceditor/themes/square.min.css
diff --git a/README.md b/README.md
index 09bcb820..4204bd2e 100644
--- a/README.md
+++ b/README.md
@@ -21,8 +21,10 @@ ComunicWeb would not exists without the following technologies developped by the
- jquery.hotkeys
- bootstrap-wysiwyg (https://github.com/steveathon/bootstrap-wysiwyg/)
- wdt-emoji-bundle (http://ned.im/wdt-emoji-bundle)
-- PNGLib (http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/) (BSD Licence)
-- Identicon (http://github.com/stewartlord/identicon.js) (BSD Licence)
-- FileSaver.js (http://eligrey.com) (by Eli Grey) (MIT Licence)
-- JSZip (https://github.com/Stuk/jszip.git) (MIT Licence)
-- JSZip Utils (https://github.com/Stuk/jszip-utils.git) (MIT Licence)
\ No newline at end of file
+- PNGLib (http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/) (BSD License)
+- Identicon (http://github.com/stewartlord/identicon.js) (BSD License)
+- FileSaver.js (http://eligrey.com) (by Eli Grey) (MIT License)
+- JSZip (https://github.com/Stuk/jszip.git) (MIT License)
+- JSZip Utils (https://github.com/Stuk/jszip-utils.git) (MIT License)
+- SCEditor (BBC WYIWYG editor) (https://github.com/samclarke/SCEditor) (MIT License)
+- JavaScript BBCode Parser (https://github.com/Frug/js-bbcode-parser) (MIT License)
\ No newline at end of file
diff --git a/assets/3rdparty/js-bbcode-parser/bbcode-config.js b/assets/3rdparty/js-bbcode-parser/bbcode-config.js
new file mode 100644
index 00000000..aaa79d9f
--- /dev/null
+++ b/assets/3rdparty/js-bbcode-parser/bbcode-config.js
@@ -0,0 +1,289 @@
+/*
+ * Javascript BBCode Parser Config Options
+ * @author Philip Nicolcev
+ * @license MIT License
+ */
+
+var parserColors = [ 'gray', 'silver', 'white', 'yellow', 'orange', 'red', 'fuchsia', 'blue', 'green', 'black', '#cd38d9' ];
+
+var parserTags = {
+ 'b': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+ 'code': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return '
';
+ },
+ noParse: true
+ },
+ 'color': {
+ openTag: function(params,content) {
+ var colorCode = params.substr(1) || "inherit";
+ BBCodeParser.regExpAllowedColors.lastIndex = 0;
+ BBCodeParser.regExpValidHexColors.lastIndex = 0;
+ if ( !BBCodeParser.regExpAllowedColors.test( colorCode ) ) {
+ if ( !BBCodeParser.regExpValidHexColors.test( colorCode ) ) {
+ colorCode = "inherit";
+ } else {
+ if (colorCode.substr(0,1) !== "#") {
+ colorCode = "#" + colorCode;
+ }
+ }
+ }
+
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+ 'i': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+ 'img': {
+ openTag: function(params,content) {
+
+ var myUrl = content;
+
+ BBCodeParser.urlPattern.lastIndex = 0;
+ if ( !BBCodeParser.urlPattern.test( myUrl ) ) {
+ myUrl = "";
+ }
+
+ return ' ';
+ },
+ closeTag: function(params,content) {
+ return '';
+ },
+ content: function(params,content) {
+ return '';
+ }
+ },
+ 'list': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ },
+ restrictChildrenTo: ["*", "li"]
+ },
+ 'noparse': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return '';
+ },
+ noParse: true
+ },
+ 'quote': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+ 's': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+ 'size': {
+ openTag: function(params,content) {
+ var mySize = parseInt(params.substr(1),10) || 0;
+ if (mySize < 10 || mySize > 20) {
+ mySize = 'inherit';
+ } else {
+ mySize = mySize + 'px';
+ }
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+ 'u': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+ 'url': {
+ openTag: function(params,content) {
+
+ var myUrl;
+
+ if (!params) {
+ myUrl = content.replace(/<.*?>/g,"");
+ } else {
+ myUrl = params.substr(1);
+ }
+
+ BBCodeParser.urlPattern.lastIndex = 0;
+ if ( !BBCodeParser.urlPattern.test( myUrl ) ) {
+ myUrl = "#";
+ }
+
+ BBCodeParser.urlPattern.lastIndex = 0;
+ if ( !BBCodeParser.urlPattern.test( myUrl ) ) {
+ myUrl = "";
+ }
+
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+
+ //COMUNIC ADD BEGIN
+
+ 'left': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return '
';
+ }
+ },
+
+ 'center': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return '
';
+ }
+ },
+
+ 'right': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return '
';
+ }
+ },
+
+ 'justify': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return '
';
+ }
+ },
+
+ 'ul': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+
+ 'ol': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+
+ 'li': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+
+ 'sup': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+
+ 'sub': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+
+ 'ltr': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return '
';
+ }
+ },
+
+ 'rtl': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return '
';
+ }
+ },
+
+
+ 'table': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return '
';
+ }
+ },
+
+ 'tr': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+
+ 'td': {
+ openTag: function(params,content) {
+ return '';
+ },
+ closeTag: function(params,content) {
+ return ' ';
+ }
+ },
+
+ //COMUNIC ADD END
+};
diff --git a/assets/3rdparty/js-bbcode-parser/bbcode-parser.js b/assets/3rdparty/js-bbcode-parser/bbcode-parser.js
new file mode 100644
index 00000000..ff109362
--- /dev/null
+++ b/assets/3rdparty/js-bbcode-parser/bbcode-parser.js
@@ -0,0 +1,152 @@
+/*
+ * Javascript BBCode Parser
+ * @author Philip Nicolcev
+ * @license MIT License
+ */
+
+var BBCodeParser = (function(parserTags, parserColors) {
+ 'use strict';
+
+ var me = {},
+ urlPattern = /^(?:https?|file|c):(?:\/{1,3}|\\{1})[-a-zA-Z0-9:;@#%&()~_?\+=\/\\\.]*$/,
+ emailPattern = /[^\s@]+@[^\s@]+\.[^\s@]+/,
+ fontFacePattern = /^([a-z][a-z0-9_]+|"[a-z][a-z0-9_\s]+")$/i,
+ tagNames = [],
+ tagNamesNoParse = [],
+ regExpAllowedColors,
+ regExpValidHexColors = /^#?[a-fA-F0-9]{6}$/,
+ ii, tagName, len;
+
+ // create tag list and lookup fields
+ for (tagName in parserTags) {
+ if (!parserTags.hasOwnProperty(tagName))
+ continue;
+
+ if (tagName === '*') {
+ tagNames.push('\\' + tagName);
+ } else {
+ tagNames.push(tagName);
+ if ( parserTags[tagName].noParse ) {
+ tagNamesNoParse.push(tagName);
+ }
+ }
+
+ parserTags[tagName].validChildLookup = {};
+ parserTags[tagName].validParentLookup = {};
+ parserTags[tagName].restrictParentsTo = parserTags[tagName].restrictParentsTo || [];
+ parserTags[tagName].restrictChildrenTo = parserTags[tagName].restrictChildrenTo || [];
+
+ len = parserTags[tagName].restrictChildrenTo.length;
+ for (ii = 0; ii < len; ii++) {
+ parserTags[tagName].validChildLookup[ parserTags[tagName].restrictChildrenTo[ii] ] = true;
+ }
+ len = parserTags[tagName].restrictParentsTo.length;
+ for (ii = 0; ii < len; ii++) {
+ parserTags[tagName].validParentLookup[ parserTags[tagName].restrictParentsTo[ii] ] = true;
+ }
+ }
+
+ regExpAllowedColors = new RegExp('^(?:' + parserColors.join('|') + ')$');
+
+ /*
+ * Create a regular expression that captures the innermost instance of a tag in an array of tags
+ * The returned RegExp captures the following in order:
+ * 1) the tag from the array that was matched
+ * 2) all (optional) parameters included in the opening tag
+ * 3) the contents surrounded by the tag
+ *
+ * @param {type} tagsArray - the array of tags to capture
+ * @returns {RegExp}
+ */
+ function createInnermostTagRegExp(tagsArray) {
+ var openingTag = '\\[(' + tagsArray.join('|') + ')\\b(?:[ =]([\\w"#\\-\\:\\/= ]*?))?\\]',
+ notContainingOpeningTag = '((?:(?=([^\\[]+))\\4|\\[(?!\\1\\b(?:[ =](?:[\\w"#\\-\\:\\/= ]*?))?\\]))*?)',
+ closingTag = '\\[\\/\\1\\]';
+
+ return new RegExp( openingTag + notContainingOpeningTag + closingTag, 'i');
+ }
+
+ /*
+ * Escape the contents of a tag and mark the tag with a null unicode character.
+ * To be used in a loop with a regular expression that captures tags.
+ * Marking the tag prevents it from being matched again.
+ *
+ * @param {type} matchStr - the full match, including the opening and closing tags
+ * @param {type} tagName - the tag that was matched
+ * @param {type} tagParams - parameters passed to the tag
+ * @param {type} tagContents - everything between the opening and closing tags
+ * @returns {String} - the full match with the tag contents escaped and the tag marked with \u0000
+ */
+ function escapeInnerTags(matchStr, tagName, tagParams, tagContents) {
+ tagParams = tagParams || "";
+ tagContents = tagContents || "";
+ tagContents = tagContents.replace(/\[/g, "[").replace(/\]/g, "]");
+ return "[\u0000" + tagName + tagParams + "]" + tagContents + "[/\u0000" + tagName + "]";
+ }
+
+ /*
+ * Escape all BBCodes that are inside the given tags.
+ *
+ * @param {string} text - the text to search through
+ * @param {string[]} tags - the tags to search for
+ * @returns {string} - the full text with the required code escaped
+ */
+ function escapeBBCodesInsideTags(text, tags) {
+ var innerMostRegExp;
+ if (tags.length === 0 || text.length < 7)
+ return text;
+ innerMostRegExp = createInnermostTagRegExp(tags);
+ while (
+ text !== (text = text.replace(innerMostRegExp, escapeInnerTags))
+ );
+ return text.replace(/\u0000/g,'');
+ }
+
+ /*
+ * Process a tag and its contents according to the rules provided in parserTags.
+ *
+ * @param {type} matchStr - the full match, including the opening and closing tags
+ * @param {type} tagName - the tag that was matched
+ * @param {type} tagParams - parameters passed to the tag
+ * @param {type} tagContents - everything between the opening and closing tags
+ * @returns {string} - the fully processed tag and its contents
+ */
+ function replaceTagsAndContent(matchStr, tagName, tagParams, tagContents) {
+ tagName = tagName.toLowerCase();
+ tagParams = tagParams || "";
+ tagContents = tagContents || "";
+ return parserTags[tagName].openTag(tagParams, tagContents) + (parserTags[tagName].content ? parserTags[tagName].content(tagParams, tagContents) : tagContents) + parserTags[tagName].closeTag(tagParams, tagContents);
+ }
+
+ function processTags(text, tagNames) {
+ var innerMostRegExp;
+
+ if (tagNames.length === 0 || text.length < 7)
+ return text;
+
+ innerMostRegExp = createInnermostTagRegExp(tagNames);
+
+ while (
+ text !== (text = text.replace(innerMostRegExp, replaceTagsAndContent))
+ );
+
+ return text;
+ }
+
+ /*
+ * Public Methods and Properties
+ */
+ me.process = function(text, config) {
+ text = escapeBBCodesInsideTags(text, tagNamesNoParse);
+
+ return processTags(text, tagNames);
+ };
+
+ me.allowedTags = tagNames;
+ me.urlPattern = urlPattern;
+ me.emailPattern = emailPattern;
+ me.regExpAllowedColors = regExpAllowedColors;
+ me.regExpValidHexColors = regExpValidHexColors;
+
+ return me;
+})(parserTags, parserColors);
diff --git a/assets/3rdparty/sceditor/formats/bbcode.js b/assets/3rdparty/sceditor/formats/bbcode.js
new file mode 100644
index 00000000..e17f5696
--- /dev/null
+++ b/assets/3rdparty/sceditor/formats/bbcode.js
@@ -0,0 +1,3 @@
+/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
+
+!function(t){"use strict";var h=t.escapeEntities,a=t.escapeUriScheme,m=t.dom,e=t.utils,p=m.css,g=m.attr,v=m.is,n=e.extend,s=e.each,r=t.ie,b=r&&r<11,y="data-sceditor-emoticon",l=t.command.get,x={always:1,never:2,auto:3},i={bold:{txtExec:["[b]","[/b]"]},italic:{txtExec:["[i]","[/i]"]},underline:{txtExec:["[u]","[/u]"]},strike:{txtExec:["[s]","[/s]"]},subscript:{txtExec:["[sub]","[/sub]"]},superscript:{txtExec:["[sup]","[/sup]"]},left:{txtExec:["[left]","[/left]"]},center:{txtExec:["[center]","[/center]"]},right:{txtExec:["[right]","[/right]"]},justify:{txtExec:["[justify]","[/justify]"]},font:{txtExec:function(t){var e=this;l("font")._dropDown(e,t,function(t){e.insertText("[font="+t+"]","[/font]")})}},size:{txtExec:function(t){var e=this;l("size")._dropDown(e,t,function(t){e.insertText("[size="+t+"]","[/size]")})}},color:{txtExec:function(t){var e=this;l("color")._dropDown(e,t,function(t){e.insertText("[color="+t+"]","[/color]")})}},bulletlist:{txtExec:function(t,e){var n="";s(e.split(/\r?\n/),function(){n+=(n?"\n":"")+"[li]"+this+"[/li]"}),this.insertText("[ul]\n"+n+"\n[/ul]")}},orderedlist:{txtExec:function(t,e){var n="";s(e.split(/\r?\n/),function(){n+=(n?"\n":"")+"[li]"+this+"[/li]"}),this.insertText("[ol]\n"+n+"\n[/ol]")}},table:{txtExec:["[table][tr][td]","[/td][/tr][/table]"]},horizontalrule:{txtExec:["[hr]"]},code:{txtExec:["[code]","[/code]"]},image:{txtExec:function(t,e){var i=this;l("image")._dropDown(i,t,e,function(t,e,n){var r="";e&&(r+=" width="+e),n&&(r+=" height="+n),i.insertText("[img"+r+"]"+t+"[/img]")})}},email:{txtExec:function(t,n){var r=this;l("email")._dropDown(r,t,function(t,e){r.insertText("[email="+t+"]"+(e||n||t)+"[/email]")})}},link:{txtExec:function(t,n){var r=this;l("link")._dropDown(r,t,function(t,e){r.insertText("[url="+t+"]"+(e||n||t)+"[/url]")})}},quote:{txtExec:["[quote]","[/quote]"]},youtube:{txtExec:function(t){var e=this;l("youtube")._dropDown(e,t,function(t){e.insertText("[youtube]"+t+"[/youtube]")})}},rtl:{txtExec:["[rtl]","[/rtl]"]},ltr:{txtExec:["[ltr]","[/ltr]"]}},k={b:{tags:{b:null,strong:null},styles:{"font-weight":["bold","bolder","401","700","800","900"]},format:"[b]{0}[/b]",html:"{0} "},i:{tags:{i:null,em:null},styles:{"font-style":["italic","oblique"]},format:"[i]{0}[/i]",html:"{0} "},u:{tags:{u:null},styles:{"text-decoration":["underline"]},format:"[u]{0}[/u]",html:"{0} "},s:{tags:{s:null,strike:null},styles:{"text-decoration":["line-through"]},format:"[s]{0}[/s]",html:"{0} "},sub:{tags:{sub:null},format:"[sub]{0}[/sub]",html:"{0} "},sup:{tags:{sup:null},format:"[sup]{0}[/sup]",html:"{0} "},font:{tags:{font:{face:null}},styles:{"font-family":null},quoteType:x.never,format:function(t,e){var n;return v(t,"font")&&(n=g(t,"face"))||(n=p(t,"font-family")),"[font="+E(n)+"]"+e+"[/font]"},html:'{0} '},size:{tags:{font:{size:null}},styles:{"font-size":null},format:function(t,e){var n=g(t,"size"),r=2;return n||(n=p(t,"fontSize")),-1{!0}'},color:{tags:{font:{color:null}},styles:{color:null},quoteType:x.never,format:function(t,e){var n;return v(t,"font")&&(n=g(t,"color"))||(n=t.style.color||p(t,"color")),"[color="+c(n)+"]"+e+"[/color]"},html:function(t,e,n){return''+n+" "}},ul:{tags:{ul:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ul]{0}[/ul]",html:""},list:{breakStart:!0,isInline:!1,skipLastLineBreak:!0,html:""},ol:{tags:{ol:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ol]{0}[/ol]",html:"{0} "},li:{tags:{li:null},isInline:!1,closedBy:["/ul","/ol","/list","*","li"],format:"[li]{0}[/li]",html:"{0} "},"*":{isInline:!1,closedBy:["/ul","/ol","/list","*","li"],html:"{0} "},table:{tags:{table:null},isInline:!1,isHtmlInline:!0,skipLastLineBreak:!0,format:"[table]{0}[/table]",html:""},tr:{tags:{tr:null},isInline:!1,skipLastLineBreak:!0,format:"[tr]{0}[/tr]",html:"{0} "},th:{tags:{th:null},allowsEmpty:!0,isInline:!1,format:"[th]{0}[/th]",html:"{0} "},td:{tags:{td:null},allowsEmpty:!0,isInline:!1,format:"[td]{0}[/td]",html:"{0} "},emoticon:{allowsEmpty:!0,tags:{img:{src:null,"data-sceditor-emoticon":null}},format:function(t,e){return g(t,y)+e},html:"{0}"},hr:{tags:{hr:null},allowsEmpty:!0,isSelfClosing:!0,isInline:!1,format:"[hr]{0}",html:" "},img:{allowsEmpty:!0,tags:{img:{src:null}},allowedChildren:["#"],quoteType:x.never,format:function(e,t){var n,r,i="",l=function(t){return e.style?e.style[t]:null};return g(e,y)?t:(n=g(e,"width")||l("width"),r=g(e,"height")||l("height"),(e.complete&&(n||r)||n&&r)&&(i="="+m.width(e)+"x"+m.height(e)),"[img"+i+"]"+g(e,"src")+"[/img]")},html:function(t,e,n){var r,i,l,o="";return r=e.width,i=e.height,e.defaultattr&&(r=(l=e.defaultattr.split(/x/i))[0],i=2===l.length?l[1]:l[0]),void 0!==r&&(o+=' width="'+h(r,!0)+'"'),void 0!==i&&(o+=' height="'+h(i,!0)+'"')," '}},url:{allowsEmpty:!0,tags:{a:{href:null}},quoteType:x.never,format:function(t,e){var n=g(t,"href");return"mailto:"===n.substr(0,7)?'[email="'+n.substr(7)+'"]'+e+"[/email]":"[url="+n+"]"+e+"[/url]"},html:function(t,e,n){return e.defaultattr=h(e.defaultattr,!0)||n,''+n+" "}},email:{quoteType:x.never,html:function(t,e,n){return''+n+" "}},quote:{tags:{blockquote:null},isInline:!1,quoteType:x.never,format:function(t,e){for(var n,r="data-author",i="",l=t.children,o=0;!n&&o"+h(e.defaultattr)+""+n),""+n+" "}},code:{tags:{code:null},isInline:!1,allowedChildren:["#","#newline"],format:"[code]{0}[/code]",html:"{0}
"},left:{styles:{"text-align":["left","-webkit-left","-moz-left","-khtml-left"]},isInline:!1,format:"[left]{0}[/left]",html:'{0}
'},center:{styles:{"text-align":["center","-webkit-center","-moz-center","-khtml-center"]},isInline:!1,format:"[center]{0}[/center]",html:'{0}
'},right:{styles:{"text-align":["right","-webkit-right","-moz-right","-khtml-right"]},isInline:!1,format:"[right]{0}[/right]",html:'{0}
'},justify:{styles:{"text-align":["justify","-webkit-justify","-moz-justify","-khtml-justify"]},isInline:!1,format:"[justify]{0}[/justify]",html:'{0}
'},youtube:{allowsEmpty:!0,tags:{iframe:{"data-youtube-id":null}},format:function(t,e){return(t=g(t,"data-youtube-id"))?"[youtube]"+t+"[/youtube]":e},html:'VIDEO '},rtl:{styles:{direction:["rtl"]},isInline:!1,format:"[rtl]{0}[/rtl]",html:'{0}
'},ltr:{styles:{direction:["ltr"]},isInline:!1,format:"[ltr]{0}[/ltr]",html:'{0}
'},ignore:{}};function w(t,r){return t.replace(/\{([^}]+)\}/g,function(t,e){var n=!0;return"!"===e.charAt(0)&&(n=!1,e=e.substring(1)),"0"===e&&(n=!1),void 0===r[e]?t:n?h(r[e],!0):r[e]})}function B(t){return"function"==typeof t}function E(t){return t?t.replace(/\\(.)/g,"$1").replace(/^(["'])(.*?)\1$/,"$2"):t}function C(t){var n=arguments;return t.replace(/\{(\d+)\}/g,function(t,e){return void 0!==n[e-0+1]?n[e-0+1]:"{"+e+"}"})}var I="open",T="content",S="newline",L="close";function u(t,e,n,r,i,l){var o=this;o.type=t,o.name=e,o.val=n,o.attrs=r||{},o.children=i||[],o.closing=l||null}function q(t){var m=this;function o(t,e){var n,r,i;return t===I&&(n=e.match(/\[([^\]\s=]+)(?:([^\]]+))?\]/))&&(i=l(n[1]),n[2]&&(n[2]=n[2].trim())&&(r=function(t){var e,n=/([^\s=]+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|((?:.(?!\s\S+=))*.))/g,r={};if("="===t.charAt(0)&&t.indexOf("=",1)<0)r.defaultattr=E(t.substr(1));else for("="===t.charAt(0)&&(t="defaultattr"+t);e=n.exec(t);)r[l(e[1])]=E(e[3])||e[4];return r}(n[2]))),t===L&&(n=e.match(/\[\/([^\[\]]+)\]/))&&(i=l(n[1])),t===S&&(i="#newline"),i&&(t!==I&&t!==L||k[i])||(t=T,i="#"),new u(t,i,e,r)}function d(t,e,n){for(var r=n.length;r--;)if(n[r].type===e&&n[r].name===t)return!0;return!1}function p(t,e){var n=(t?k[t.name]:{}).allowedChildren;return!m.opts.fixInvalidChildren||!n||-1 "),B(i.html)?o=i.html.call(m,r,r.attrs,l):(r.attrs[0]=l,o=w(i.html,r.attrs))):o=r.val+l+(r.closing?r.closing.val:"");else{if(r.type===S){if(!n){f.push(" ");continue}s||f.push(""),b||f.push(" "),e.length||f.push(" "),f.push("
\n"),s=!1;continue}a=n,o=h(r.val,!0)}a&&!s?(f.push(""),s=!0):!a&&s&&(f.push("
\n"),s=!1),f.push(o)}s&&f.push("\n");return f.join("")}(m.parse(t,e),!0)},m.toBBCode=function(t,e){return function t(e){var n,r,i,l,o,a,s,u,c,f,h=[];for(;0\n/g,""),(i=a.firstChild)&&v(i,"div")&&o(i,!0),(i=a.lastChild)&&v(i,"div")&&o(i),a.innerHTML):s}function e(t,e,n,r){var i,l,o=(n=n||document).createElement("div"),a=n.createElement("div"),s=new q(u.opts.parserOptions);for(a.innerHTML=e,p(o,"visibility","hidden"),o.appendChild(a),n.body.appendChild(o),t&&(o.insertBefore(n.createTextNode("#"),o.firstChild),o.appendChild(n.createTextNode("#"))),r&&p(a,"whiteSpace",p(r,"whiteSpace")),l=a.getElementsByClassName("sceditor-ignore");l.length;)l[0].parentNode.removeChild(l[0]);return m.removeWhiteSpace(o),i=d(a),n.body.removeChild(o),i=s.toBBCode(i,!0),u.opts.bbcodeTrim&&(i=i.trim()),i}u.init=function(){u.opts=this.opts,u.elementToBbcode=d,s(k,function(n){var r,t=k[n].tags,e=k[n].styles;t&&s(t,function(t,e){r=!1===k[n].isInline,o[t]=o[t]||{},o[t][r]=o[t][r]||{},o[t][r][n]=e}),e&&s(e,function(t,e){r=!1===k[n].isInline,a[r]=a[r]||{},a[r][t]=a[r][t]||{},a[r][t][n]=e})}),this.commands=n(!0,{},i,this.commands),this.toBBCode=u.toSource,this.fromBBCode=u.toHtml},u.toHtml=t.bind(null,!1),u.fragmentToHtml=t.bind(null,!0),u.toSource=e.bind(null,!1),u.fragmentToSource=e.bind(null,!0)}u.prototype={clone:function(){var t=this;return new u(t.type,t.name,t.val,n({},t.attrs),[],t.closing?t.closing.clone():null)},splitAt:function(t){var e,n=this.clone(),r=this.children.indexOf(t);return-1",""]},italic:{txtExec:[""," "]},underline:{txtExec:[''," "]},strike:{txtExec:[''," "]},subscript:{txtExec:[""," "]},superscript:{txtExec:[""," "]},left:{txtExec:['',"
"]},center:{txtExec:['',"
"]},right:{txtExec:['',"
"]},justify:{txtExec:['',"
"]},font:{txtExec:function(t){var e=this;l("font")._dropDown(e,t,function(t){e.insertText(''," ")})}},size:{txtExec:function(t){var e=this;l("size")._dropDown(e,t,function(t){e.insertText(''," ")})}},color:{txtExec:function(t){var e=this;l("color")._dropDown(e,t,function(t){e.insertText(''," ")})}},bulletlist:{txtExec:[""]},orderedlist:{txtExec:[""," "]},table:{txtExec:[""]},horizontalrule:{txtExec:[" "]},code:{txtExec:["","
"]},image:{txtExec:function(t,e){var o=this;l("image")._dropDown(o,t,e,function(t,e,n){var i="";e&&(i+=' width="'+e+'"'),n&&(i+=' height="'+n+'"'),o.insertText(" ')})}},email:{txtExec:function(t,n){var i=this;l("email")._dropDown(i,t,function(t,e){i.insertText(''+(e||n||t)+" ")})}},link:{txtExec:function(t,n){var i=this;l("link")._dropDown(i,t,function(t,e){i.insertText(''+(e||n||t)+" ")})}},quote:{txtExec:[""," "]},youtube:{txtExec:function(t){var n=this;l("youtube")._dropDown(n,t,function(t,e){n.insertText('VIDEO ')})}},rtl:{txtExec:['',"
"]},ltr:{txtExec:['',"
"]}};function z(){var o=this,n={},p={};function t(t,e,n){var i,o,h,r,a,l,s,c,u,d,f,g,v,x,m=n.createElement("div");return m.innerHTML=e,S(m,"visibility","hidden"),n.body.appendChild(m),o=m,C.traverse(o,function(t){var e=t.nodeName.toLowerCase();b("*",t),b(e,t)},!0),h=m,C.traverse(h,function(t){var e,n=t.nodeName.toLowerCase(),i=t.parentNode,o=t.nodeType,r=!C.isInline(t),a=t.previousSibling,l=t.nextSibling,s=i===h,c=!a&&!l,u="iframe"!==n&&function t(e,n){var i,o=e.childNodes,r=e.nodeName.toLowerCase(),a=e.nodeValue,l=o.length,s=z.allowedEmptyTags||[];if(n&&"br"===r)return!0;if(T(e,".sceditor-ignore"))return!0;if(-1":">",'"':"""," ":" "};return t?t.replace(/[&<>"\xa0]/g,function(t){return e[t]||t}):""}function g(t,e){switch(t.nodeType){case 1:"!"===t.nodeName.toLowerCase()?n(t):function(t,e){var n,i,o,r=t.nodeName.toLowerCase(),a="iframe"===r,l=t.attributes.length,s=t.firstChild,c=e||/pre(?:\-wrap)?$/i.test(S(t,"whiteSpace")),u=!t.firstChild&&!C.canHaveChildren(t)&&!a;if(T(t,".sceditor-ignore"))return;v("<"+r,!e&&h(t));for(;l--;)i=t.attributes[l],o=i.value,v(" "+i.name.toLowerCase()+'="'+f(o)+'"',!1);v(u?" />":">",!1),a||(n=s);for(;n;)d++,g(n,c),n=n.nextSibling,d--;u||v(""+r+">",!c&&!a&&h(t)&&s&&h(s))}(t,e);break;case 3:!function(t,e){var n=t.nodeValue;e||(n=n.replace(/[\r\n]/," ").replace(/[^\S|\u00A0]+/g," "));n&&v(f(n),!e&&h(t))}(t,e);break;case 4:v("");break;case 8:n(t);break;case 9:case 11:!function(t){var e=t.firstChild;for(;e;)g(e),e=e.nextSibling}(t)}}function n(t){v("\x3c!-- "+f(t.nodeValue)+" --\x3e")}function v(t,e){var n=d;if(!1!==e)for(o.length&&o.push("\n");n--;)o.push(i.indentStr);o.push(t)}function h(t){var e=t.previousSibling;return 1!==t.nodeType&&e?!C.isInline(e):!e&&!C.isInline(t.parentNode)||!C.isInline(t)}this.serialize=function(t,e){if(o=[],e)for(t=t.firstChild;t;)g(t),t=t.nextSibling;else g(t);return o.join("")}},z.converters=[{tags:{"*":{width:null}},conv:function(t){S(t,"width",n(t,"width")),A(t,"width")}},{tags:{"*":{height:null}},conv:function(t){S(t,"height",n(t,"height")),A(t,"height")}},{tags:{li:{value:null}},conv:function(t){A(t,"value")}},{tags:{"*":{text:null}},conv:function(t){S(t,"color",n(t,"text")),A(t,"text")}},{tags:{"*":{color:null}},conv:function(t){S(t,"color",n(t,"color")),A(t,"color")}},{tags:{"*":{face:null}},conv:function(t){S(t,"fontFamily",n(t,"face")),A(t,"face")}},{tags:{"*":{align:null}},conv:function(t){S(t,"textAlign",n(t,"align")),A(t,"align")}},{tags:{"*":{border:null}},conv:function(t){S(t,"borderWidth",n(t,"border")),A(t,"border")}},{tags:{applet:{name:null},img:{name:null},layer:{name:null},map:{name:null},object:{name:null},param:{name:null}},conv:function(t){n(t,"id")||n(t,"id",n(t,"name")),A(t,"name")}},{tags:{"*":{vspace:null}},conv:function(t){S(t,"marginTop",n(t,"vspace")-0),S(t,"marginBottom",n(t,"vspace")-0),A(t,"vspace")}},{tags:{"*":{hspace:null}},conv:function(t){S(t,"marginLeft",n(t,"hspace")-0),S(t,"marginRight",n(t,"hspace")-0),A(t,"hspace")}},{tags:{hr:{noshade:null}},conv:function(t){S(t,"borderStyle","solid"),A(t,"noshade")}},{tags:{"*":{nowrap:null}},conv:function(t){S(t,"whiteSpace","nowrap"),A(t,"nowrap")}},{tags:{big:null},conv:function(t){S(i(t,"span"),"fontSize","larger")}},{tags:{small:null},conv:function(t){S(i(t,"span"),"fontSize","smaller")}},{tags:{b:null},conv:function(t){i(t,"strong")}},{tags:{u:null},conv:function(t){S(i(t,"span"),"textDecoration","underline")}},{tags:{s:null,strike:null},conv:function(t){S(i(t,"span"),"textDecoration","line-through")}},{tags:{dir:null},conv:function(t){i(t,"ul")}},{tags:{center:null},conv:function(t){S(i(t,"div"),"textAlign","center")}},{tags:{font:{size:null}},conv:function(t){S(t,"fontSize",S(t,"fontSize")),A(t,"size")}},{tags:{font:null},conv:function(t){i(t,"span")}},{tags:{"*":{type:["_moz"]}},conv:function(t){A(t,"type")}},{tags:{"*":{_moz_dirty:null}},conv:function(t){A(t,"_moz_dirty")}},{tags:{"*":{_moz_editor_bogus_node:null}},conv:function(t){t.parentNode.removeChild(t)}}],z.allowedAttribs={},z.disallowedAttribs={},z.allowedTags=[],z.disallowedTags=[],z.allowedEmptyTags=[],y.formats.xhtml=z}(sceditor);
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/icons/material.js b/assets/3rdparty/sceditor/icons/material.js
new file mode 100644
index 00000000..ebc758a6
--- /dev/null
+++ b/assets/3rdparty/sceditor/icons/material.js
@@ -0,0 +1,3 @@
+/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
+
+!function(H,V){"use strict";var t=V.dom,M={bold:' ',bulletlist:' ',center:' ',code:' ',color:' ',copy:' ',cut:' ',date:' ',email:' ',emoticon:' ',font:' ',format:' ',grip:' ',horizontalrule:' ',image:' ',indent:' ',italic:' ',justify:' \t\t',left:' \t\t',link:' ',ltr:' ',maximize:' ',orderedlist:' ',outdent:' ',paste:' ',pastetext:' ',print:' ',quote:' ',redo:' ',removeformat:' ',right:' ',rtl:' ',size:' ',source:' ',strike:' ',subscript:' ',superscript:' ',table:' ',time:' ',underline:' ',undo:' ',unlink:' ',youtube:' '};V.icons.material=function(){var L,A={};return{create:function(H){return H in M&&(A[H]=V.dom.parseHTML(''+M[H]+" ").firstChild,"color"===H&&(L=A[H].querySelector(".sce-color"))),A[H]},update:function(H,V){if(L){var M="inherit";!H&&V&&(M=V.ownerDocument.queryCommandValue("forecolor"),parseInt(M)===M&&(M="#"+("000000"+(M=(255&M)<<16|65280&M|(16711680&M)>>>16).toString(16)).slice(-6))),t.css(L,"fill",M)}},rtl:function(H){var V=A.grip;if(V){var M=H?"scaleX(-1)":"";t.css(V,"transform",M),t.css(V,"msTransform",M),t.css(V,"webkitTransform",M)}}}},V.icons.material.icons=M}(document,sceditor);
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/icons/monocons.js b/assets/3rdparty/sceditor/icons/monocons.js
new file mode 100644
index 00000000..4cf24d36
--- /dev/null
+++ b/assets/3rdparty/sceditor/icons/monocons.js
@@ -0,0 +1,3 @@
+/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
+
+!function(h,a){"use strict";var c=a.dom,v={bold:'B ',bulletlist:' ',center:' ',code:' ',color:'A ',copy:' ',cut:' ',date:' ',email:' ',emoticon:' ',font:' ',format:' ',grip:' ',horizontalrule:' ',image:' ',indent:' ',italic:'i ',justify:' ',left:' ',link:' ',ltr:' ',maximize:' ',orderedlist:' ',outdent:' ',paste:' ',pastetext:' ',print:' ',quote:' ',redo:' ',removeformat:' ',right:' ',rtl:' ',size:' ',source:' ',strike:'S ',subscript:' ',superscript:' ',table:' ',time:' ',underline:'U ',undo:' ',unlink:' ',youtube:' '};a.icons.monocons=function(){var z,t={};return{create:function(h){return h in v&&(t[h]=a.dom.parseHTML(''+v[h]+" ").firstChild,"color"===h&&(z=t[h].querySelector(".sce-color"))),t[h]},update:function(h,a){if(z){var v="inherit";!h&&a&&(v=a.ownerDocument.queryCommandValue("forecolor"),parseInt(v)===v&&(v="#"+("000000"+(v=(255&v)<<16|65280&v|(16711680&v)>>>16).toString(16)).slice(-6))),c.css(z,"fill",v)}},rtl:function(h){var a=t.grip;if(a){var v=h?"scaleX(-1)":"";c.css(a,"transform",v),c.css(a,"msTransform",v),c.css(a,"webkitTransform",v)}}}},a.icons.monocons.icons=v}(document,sceditor);
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/jquery.sceditor.bbcode.min.js b/assets/3rdparty/sceditor/jquery.sceditor.bbcode.min.js
new file mode 100644
index 00000000..5c8e6f05
--- /dev/null
+++ b/assets/3rdparty/sceditor/jquery.sceditor.bbcode.min.js
@@ -0,0 +1,3 @@
+/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
+
+!function(o){"use strict";function e(e,t){return typeof t===e}o=o&&o.hasOwnProperty("default")?o.default:o;var be=e.bind(null,"string"),xe=e.bind(null,"undefined"),we=e.bind(null,"function"),r=e.bind(null,"number");function t(e){return!Object.keys(e).length}function ke(e,t){for(var n=e===!!e,o=n?2:1,r=n?t:e,i=!!n&&e;o ":">"," ":" ","\r\n":" ","\r":" ","\n":" "};return!1!==t&&(n['"']=""",n["'"]="'",n["`"]="`"),e.replace(/ {2}|\r\n|[&<>\r\n'"`]/g,function(e){return n[e]||e})}var b={html:'
',toolbarButton:'{dispName}
',emoticon:' ',fontOpt:'{font} ',sizeOpt:'{size} ',pastetext:'{label}
',table:'{rows}
{cols}
',image:'{url}
{width}
{height}
',email:'{label}
{desc}
',link:'{url}
{desc}
',youtubeMenu:'{label}
',youtube:'VIDEO '};function ht(e,t,n){var o=b[e];return Object.keys(t).forEach(function(e){o=o.replace(new RegExp(ft("{"+e+"}"),"g"),t[e])}),n&&(o=et(o)),o}var x=v&&v<11;function w(e){if("mozHidden"in document)for(var t,n=e.getBody();n;){if((t=n).firstChild)t=t.firstChild;else{for(;t&&!t.nextSibling;)t=t.parentNode;t&&(t=t.nextSibling)}3===n.nodeType&&/[\n\r\t]+/.test(n.nodeValue)&&(/^pre/.test(je(n.parentNode,"whiteSpace"))||Be(n)),n=t}}var mt={bold:{exec:"bold",tooltip:"Bold",shortcut:"Ctrl+B"},italic:{exec:"italic",tooltip:"Italic",shortcut:"Ctrl+I"},underline:{exec:"underline",tooltip:"Underline",shortcut:"Ctrl+U"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{state:function(e){if(e&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===je(e,"direction"),n=je(e,"textAlign");return"left"===n||n===(t?"start":"end")}},exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{state:function(e){if(e&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===je(e,"direction"),n=je(e,"textAlign");return"right"===n||n===(t?"end":"start")}},exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,e,n){var o=De("div");Fe(o,"click","a",function(e){n(Pe(this,"font")),t.closeDropDown(!0),e.preventDefault()}),t.opts.fonts.split(",").forEach(function(e){Re(o,ht("fontOpt",{font:e},!0))}),t.createDropDown(e,"font-picker",o)},exec:function(e){var t=this;mt.font._dropDown(t,e,function(e){t.execCommand("fontname",e)})},tooltip:"Font Name"},size:{_dropDown:function(t,e,n){var o=De("div");Fe(o,"click","a",function(e){n(Pe(this,"size")),t.closeDropDown(!0),e.preventDefault()});for(var r=1;r<=7;r++)Re(o,ht("sizeOpt",{size:r},!0));t.createDropDown(e,"fontsize-picker",o)},exec:function(e){var t=this;mt.size._dropDown(t,e,function(e){t.execCommand("fontsize",e)})},tooltip:"Font Size"},color:{_dropDown:function(t,e,n){var o=De("div"),r="",i=mt.color;i._htmlCache||(t.opts.colors.split("|").forEach(function(e){r+='',e.split(",").forEach(function(e){r+='
'}),r+="
"}),i._htmlCache=r),Re(o,et(i._htmlCache)),Fe(o,"click","a",function(e){n(Pe(this,"color")),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"color-picker",o)},exec:function(e){var t=this;mt.color._dropDown(t,e,function(e){t.execCommand("forecolor",e)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(e){var t,n=De("div"),o=this;Re(n,ht("pastetext",{label:o._("Paste your text inside the following box:"),insert:o._("Insert")},!0)),Fe(n,"click",".button",function(e){(t=He(n,"#txt")[0].value)&&o.wysiwygEditorInsertText(t),o.closeDropDown(!0),e.preventDefault()}),o.createDropDown(e,"pastetext",n)},tooltip:"Paste Text"},bulletlist:{exec:function(){w(this),this.execCommand("insertunorderedlist")},tooltip:"Bullet list"},orderedlist:{exec:function(){w(this),this.execCommand("insertorderedlist")},tooltip:"Numbered list"},indent:{state:function(e,t){var n,o,r;return qe(t,"li")?0:qe(t,"ul,ol,menu")&&(o=(n=this.getRangeHelper().selectedRange()).startContainer.parentNode,r=n.endContainer.parentNode,o!==o.parentNode.firstElementChild||qe(r,"li")&&r!==r.parentNode.lastElementChild)?0:-1},exec:function(){var e=this.getRangeHelper().getFirstBlockParent();this.focus(),Ne(e,"ul,ol,menu")&&this.execCommand("indent")},tooltip:"Add indent"},outdent:{state:function(e,t){return Ne(t,"ul,ol,menu")?0:-1},exec:function(){Ne(this.getRangeHelper().getFirstBlockParent(),"ul,ol,menu")&&this.execCommand("outdent")},tooltip:"Remove one indent"},table:{exec:function(e){var r=this,i=De("div");Re(i,ht("table",{rows:r._("Rows:"),cols:r._("Cols:"),insert:r._("Insert")},!0)),Fe(i,"click",".button",function(e){var t=Number(He(i,"#rows")[0].value),n=Number(He(i,"#cols")[0].value),o="";0"+Array(n+1).join(""+(x?"":" ")+" ")+""),o+="
",r.wysiwygEditorInsertHtml(o),r.closeDropDown(!0),e.preventDefault())}),r.createDropDown(e,"inserttable",i)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{exec:function(){this.wysiwygEditorInsertHtml("",(x?"":" ")+"
")},tooltip:"Code"},image:{_dropDown:function(t,e,n,o){var r=De("div");Re(r,ht("image",{url:t._("URL:"),width:t._("Width (optional):"),height:t._("Height (optional):"),insert:t._("Insert")},!0));var i=He(r,"#image")[0];i.value=n,Fe(r,"click",".button",function(e){i.value&&o(i.value,He(r,"#width")[0].value,He(r,"#height")[0].value),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertimage",r)},exec:function(e){var r=this;mt.image._dropDown(r,e,"",function(e,t,n){var o="";t&&(o+=' width="'+t+'"'),n&&(o+=' height="'+n+'"'),r.wysiwygEditorInsertHtml(" ')})},tooltip:"Insert an image"},email:{_dropDown:function(n,e,o){var r=De("div");Re(r,ht("email",{label:n._("E-mail:"),desc:n._("Description (optional):"),insert:n._("Insert")},!0)),Fe(r,"click",".button",function(e){var t=He(r,"#email")[0].value;t&&o(t,He(r,"#des")[0].value),n.closeDropDown(!0),e.preventDefault()}),n.createDropDown(e,"insertemail",r)},exec:function(e){var n=this;mt.email._dropDown(n,e,function(e,t){n.focus(),!n.getRangeHelper().selectedHtml()||t?n.wysiwygEditorInsertHtml(''+(t||e)+" "):n.execCommand("createlink","mailto:"+e)})},tooltip:"Insert an email"},link:{_dropDown:function(t,e,n){var o=De("div");Re(o,ht("link",{url:t._("URL:"),desc:t._("Description (optional):"),ins:t._("Insert")},!0));var r=He(o,"#link")[0];function i(e){r.value&&n(r.value,He(o,"#des")[0].value),t.closeDropDown(!0),e.preventDefault()}Fe(o,"click",".button",i),Fe(o,"keypress",function(e){13===e.which&&r.value&&i(e)},Ie),t.createDropDown(e,"insertlink",o)},exec:function(e){var n=this;mt.link._dropDown(n,e,function(e,t){n.focus(),t||!n.getRangeHelper().selectedHtml()?(t=t||e,n.wysiwygEditorInsertHtml(''+t+" ")):n.execCommand("createlink",e)})},tooltip:"Insert a link"},unlink:{state:function(){return Ne(this.currentNode(),"a")?0:-1},exec:function(){var e=Ne(this.currentNode(),"a");if(e){for(;e.firstChild;)Ve(e.firstChild,e);Be(e)}},tooltip:"Unlink"},quote:{exec:function(e,t,n){var o="",r=" ";t?(o=o+(n=n?""+n+" ":"")+t+r,r=null):""===this.getRangeHelper().selectedHtml()&&(r=(x?"":" ")+r),this.wysiwygEditorInsertHtml(o,r)},tooltip:"Insert a Quote"},emoticon:{exec:function(f){var p=this,h=function(e){var t,n,o=p.opts,r=o.emoticonsRoot||"",i=o.emoticonsCompat,l=p.getRangeHelper(),a=i&&" "!==l.getOuterText(!0,1)?" ":"",s=i&&" "!==l.getOuterText(!1,1)?" ":"",c=De("div"),u=De("div"),d=ke({},o.emoticons.dropdown,e?o.emoticons.more:{});return Re(c,u),n=Math.sqrt(Object.keys(d).length),Fe(c,"click","img",function(e){p.insert(a+Ae(this,"alt")+s,null,!1).closeDropDown(!0),e.preventDefault()}),Ee(d,function(e,t){Re(u,De("img",{src:r+(t.url||t),alt:e,title:t.tooltip||e})),u.children.length>=n&&(u=De("div"),Re(c,u))}),!e&&o.emoticons.more&&(Re(t=De("a",{className:"sceditor-more"}),document.createTextNode(p._("More"))),Fe(t,"click",function(e){p.createDropDown(f,"more-emoticons",h(!0)),e.preventDefault()}),Re(c,t)),c};p.createDropDown(f,"emoticons",h(!1))},txtExec:function(e){mt.emoticon.exec.call(this,e)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(i,e,l){var a=De("div");Re(a,ht("youtubeMenu",{label:i._("Video URL:"),insert:i._("Insert")},!0)),Fe(a,"click",".button",function(e){var t=He(a,"#link")[0].value,n=t.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),o=t.match(/[&|?](?:star)?t=((\d+[hms]?){1,3})/),r=0;o&&Ee(o[1].split(/[hms]/),function(e,t){""!==t&&(r=60*r+Number(t))}),n&&/^[a-zA-Z0-9_\-]{11}$/.test(n[1])&&l(n[1],r),i.closeDropDown(!0),e.preventDefault()}),i.createDropDown(e,"insertlink",a)},exec:function(e){var n=this;mt.youtube._dropDown(n,e,function(e,t){n.wysiwygEditorInsertHtml(ht("youtube",{id:e,time:t}))})},tooltip:"Insert a YouTube video"},date:{_date:function(e){var t=new Date,n=t.getYear(),o=t.getMonth()+1,r=t.getDate();return n<2e3&&(n=1900+n),o<10&&(o="0"+o),r<10&&(r="0"+r),e.opts.dateFormat.replace(/year/i,n).replace(/month/i,o).replace(/day/i,r)},exec:function(){this.insertText(mt.date._date(this))},txtExec:function(){this.insertText(mt.date._date(this))},tooltip:"Insert current date"},time:{_time:function(){var e=new Date,t=e.getHours(),n=e.getMinutes(),o=e.getSeconds();return t<10&&(t="0"+t),n<10&&(n="0"+n),o<10&&(o="0"+o),t+":"+n+":"+o},exec:function(){this.insertText(mt.time._time())},txtExec:function(){this.insertText(mt.time._time())},tooltip:"Insert current time"},ltr:{state:function(e,t){return t&&"ltr"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();this.focus(),(t&&!qe(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!qe(t,"body")))&&je(t,"direction","ltr"===je(t,"direction")?"":"ltr")},tooltip:"Left-to-Right"},rtl:{state:function(e,t){return t&&"rtl"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();this.focus(),(t&&!qe(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!qe(t,"body")))&&je(t,"direction","rtl"===je(t,"direction")?"":"rtl")},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize",shortcut:"Ctrl+Shift+M"},source:{state:function(){return this.sourceMode()},exec:function(){this.toggleSourceMode()},txtExec:function(){this.toggleSourceMode()},tooltip:"View source",shortcut:"Ctrl+Shift+S"},ignore:{}},k={};function gt(i){var r=this,l=[],a=function(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)},e=function(e,t){e=[].slice.call(e);var n,o,r=a(e.shift());for(n=0;ns.length&&c&&3===c.nodeType;)o=c.nodeValue,r=n-s.length,a&&(l=o.length,i=0),a=c,t?(u=i=Math.max(l-r,0),s=o.substr(i,l-i)+s,c=a.previousSibling):(u=i+(l=Math.min(r,o.length)),s+=o.substr(i,l),c=a.nextSibling);return{node:a||c,offset:u,text:s}};function vt(i,e){var l,a,s=e||i.contentDocument||i.document,c="sceditor-start-marker",u="sceditor-end-marker",y=this;y.insertHTML=function(e,t){var n,o;if(!y.selectedRange())return!1;for(t&&(e+=y.selectedHtml()+t),o=De("p",{},s),n=s.createDocumentFragment(),o.innerHTML=e;o.firstChild;)Re(n,o.firstChild);y.insertNode(n)},a=function(e,t,n){var o,r=s.createDocumentFragment();if("string"==typeof e?(t&&(e+=y.selectedHtml()+t),r=et(e)):(Re(r,e),t&&(Re(r,y.selectedRange().extractContents()),Re(r,t))),o=r.lastChild){for(;!rt(o.lastChild,!0);)o=o.lastChild;if(ot(o)?o.lastChild||Re(o,document.createTextNode("")):o=r,y.removeMarkers(),Re(o,l(c)),Re(o,l(u)),n){var i=De("div");return Re(i,r),i.innerHTML}return r}},y.insertNode=function(e,t){var n=a(e,t),o=y.selectedRange(),r=o.commonAncestorContainer;if(!n)return!1;o.deleteContents(),r&&3!==r.nodeType&&!ot(r)?Ve(n,r):o.insertNode(n),y.restoreRange()},y.cloneSelected=function(){var e=y.selectedRange();if(e)return e.cloneRange()},y.selectedRange=function(){var e,t,n=i.getSelection();if(n){if(n.rangeCount<=0){for(t=s.body;t.firstChild;)t=t.firstChild;(e=s.createRange()).setStartBefore(t),n.addRange(e)}return 0 '})},void n.readAsDataURL(t);l[a[c]]=i.getData(a[c])}l.text=l["text/plain"],l.html=l["text/html"],P(l)}else if(!T){var u=r.scrollTop;for(v.saveRange(),T=bt.createDocumentFragment();r.firstChild;)Re(T,r.firstChild);setTimeout(function(){var e=r.innerHTML;r.innerHTML="",Re(r,T),r.scrollTop=u,T=!1,v.restoreRange(),P({html:e})},0)}},P=function(e){var t=De("div",{},d);r.call("pasteRaw",e),Qe(w,"pasteraw",e),e.html?(t.innerHTML=e.html,it(t)):t.innerHTML=pt(e.text||"");var n={val:t.innerHTML};"fragmentToSource"in l&&(n.val=l.fragmentToSource(n.val,d,y)),r.call("paste",n),Qe(w,"paste",n),"fragmentToHtml"in l&&(n.val=l.fragmentToHtml(n.val,y)),r.call("pasteHtml",n),de.wysiwygEditorInsertHtml(n.val,null,!0)},de.closeDropDown=function(e){f&&(Be(f),f=null),!0===e&&de.focus()},de.wysiwygEditorInsertHtml=function(e,t,n){var o,r,i,l=Xe(s);de.focus(),!n&&Ne(b,"code")||(v.insertHTML(e,t),v.saveRange(),N(),_e(o=He(h,"#sceditor-end-marker")[0]),r=h.scrollTop,i=at(o).top+1.5*o.offsetHeight-l,Oe(o),(r").replace(/&/g,"&")),de.wysiwygEditorInsertHtml(e),de},de.getWysiwygEditorValue=function(e){for(var t,n=De("div",{},d),o=h.childNodes,r=0;r"+(xt?"":" ")+"
"),h.innerHTML=e,N(),Z(),le(),ue()},de.setSourceEditorValue=function(e){c.value=e,le()},de.updateOriginal=function(){a.value=de.val()},N=function(){var e,c,u,d,t,f,p;ye.emoticonsEnabled&&(e=h,c=ve,u=ye.emoticonsCompat,d=e.ownerDocument,t="(^|\\s| | | | |$)",f=[],p={},Me(e,"code")||(Ee(c,function(e){p[e]=new RegExp(t+ft(e)+t),f.push(e)}),f.sort(function(e,t){return t.length-e.length}),function e(t){for(t=t.firstChild;t;){if(t.nodeType!==Se||qe(t,"code")||e(t),t.nodeType===Te)for(var n=0;n")}e.preventDefault()}},Z=function(){Ze(h,function(e){if(e.nodeType===Se&&!/inline/.test(je(e,"display"))&&!qe(e,".sceditor-nlf")&&tt(e)){var t=De("p",{},d);return t.className="sceditor-nlf",t.innerHTML=wt?"":" ",Re(h,t),!1}if(3===e.nodeType&&!/^\s*$/.test(e.nodeValue)||qe(e,"br"))return!1})},$=function(){de.val(a.value)},U=function(){de.closeDropDown(),p=null},de._=function(){var n=arguments;return t&&t[n[0]]&&(n[0]=t[n[0]]),n[0].replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[t-0+1]?n[t-0+1]:"{"+t+"}"})},K=function(t){r&&r.call(t.type+"Event",t,de);var e=(t.target===c?"scesrc":"scewys")+t.type;fe[e]&&fe[e].forEach(function(e){e.call(de,t)})},de.bind=function(e,t,n,o){for(var r=(e=e.split(" ")).length;r--;)if(we(t)){var i="scewys"+e[r],l="scesrc"+e[r];n||(fe[i]=fe[i]||[],fe[i].push(t)),o||(fe[l]=fe[l]||[],fe[l].push(t)),"valuechanged"===e[r]&&(le.hasHandler=!0)}return de},de.unbind=function(e,t,n,o){for(var r=(e=e.split(" ")).length;r--;)we(t)&&(n||Ce(fe["scewys"+e[r]]||[],t),o||Ce(fe["scesrc"+e[r]]||[],t));return de},de.blur=function(e,t,n){return we(e)?de.bind("blur",e,t,n):de.sourceMode()?c.blur():h.blur(),de},de.focus=function(e,t,n){if(we(e))de.bind("focus",e,t,n);else if(de.inSourceMode())c.focus();else{if(He(d,":focus").length)return;var o,r=v.selectedRange();x||ne(),!wt&&r&&1===r.endOffset&&r.collapsed&&(o=r.endContainer)&&1===o.childNodes.length&&qe(o.firstChild,"br")&&(r.setStartBefore(o.firstChild),r.collapse(!0),v.selectRange(r)),i.focus(),h.focus(),p&&(v.selectRange(p),p=null)}return G(),de},de.keyDown=function(e,t,n){return de.bind("keydown",e,t,n)},de.keyPress=function(e,t,n){return de.bind("keypress",e,t,n)},de.keyUp=function(e,t,n){return de.bind("keyup",e,t,n)},de.nodeChanged=function(e){return de.bind("nodechanged",e,!1,!0)},de.selectionChanged=function(e){return de.bind("selectionchanged",e,!1,!0)},de.valueChanged=function(e,t,n){return de.bind("valuechanged",e,t,n)},oe=function(e){var n=0,o=de.emoticonsCache,t=String.fromCharCode(e.which);Ne(b,"code")||(o||(o=[],Ee(ve,function(e,t){o[n++]=[e,t]}),o.sort(function(e,t){return e[0].length-t[0].length}),de.emoticonsCache=o,de.longestEmoticonCode=o[o.length-1][0].length),v.replaceKeyword(de.emoticonsCache,!0,!0,de.longestEmoticonCode,ye.emoticonsCompat,t)&&(ye.emoticonsCompat&&/^\s$/.test(t)||e.preventDefault()))},re=function(){!function(e,t){var n=/[^\s\xA0\u2002\u2003\u2009\u00a0]+/,o=e&&He(e,"img[data-sceditor-emoticon]");if(e&&o.length)for(var r=0;r","/":"?","\\":"|","[":"{","]":"}"},o={109:"-",110:"del",111:"/",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},r=e.which,i={8:"backspace",9:"tab",13:"enter",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"win",92:"win",93:"select",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[r]||String.fromCharCode(r).toLowerCase();(e.ctrlKey||e.metaKey)&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&(t.push("shift"),o[r]?i=o[r]:n[i]&&(i=n[i])),i&&(r<16||18{0}"},i:{tags:{i:null,em:null},styles:{"font-style":["italic","oblique"]},format:"[i]{0}[/i]",html:"{0} "},u:{tags:{u:null},styles:{"text-decoration":["underline"]},format:"[u]{0}[/u]",html:"{0} "},s:{tags:{s:null,strike:null},styles:{"text-decoration":["line-through"]},format:"[s]{0}[/s]",html:"{0} "},sub:{tags:{sub:null},format:"[sub]{0}[/sub]",html:"{0} "},sup:{tags:{sup:null},format:"[sup]{0}[/sup]",html:"{0} "},font:{tags:{font:{face:null}},styles:{"font-family":null},quoteType:x.never,format:function(e,t){var n;return v(e,"font")&&(n=g(e,"face"))||(n=m(e,"font-family")),"[font="+E(n)+"]"+t+"[/font]"},html:'{0} '},size:{tags:{font:{size:null}},styles:{"font-size":null},format:function(e,t){var n=g(e,"size"),o=2;return n||(n=m(e,"fontSize")),-1{!0}'},color:{tags:{font:{color:null}},styles:{color:null},quoteType:x.never,format:function(e,t){var n;return v(e,"font")&&(n=g(e,"color"))||(n=e.style.color||m(e,"color")),"[color="+u(n)+"]"+t+"[/color]"},html:function(e,t,n){return''+n+" "}},ul:{tags:{ul:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ul]{0}[/ul]",html:""},list:{breakStart:!0,isInline:!1,skipLastLineBreak:!0,html:""},ol:{tags:{ol:null},breakStart:!0,isInline:!1,skipLastLineBreak:!0,format:"[ol]{0}[/ol]",html:"{0} "},li:{tags:{li:null},isInline:!1,closedBy:["/ul","/ol","/list","*","li"],format:"[li]{0}[/li]",html:"{0} "},"*":{isInline:!1,closedBy:["/ul","/ol","/list","*","li"],html:"{0} "},table:{tags:{table:null},isInline:!1,isHtmlInline:!0,skipLastLineBreak:!0,format:"[table]{0}[/table]",html:""},tr:{tags:{tr:null},isInline:!1,skipLastLineBreak:!0,format:"[tr]{0}[/tr]",html:"{0} "},th:{tags:{th:null},allowsEmpty:!0,isInline:!1,format:"[th]{0}[/th]",html:"{0} "},td:{tags:{td:null},allowsEmpty:!0,isInline:!1,format:"[td]{0}[/td]",html:"{0} "},emoticon:{allowsEmpty:!0,tags:{img:{src:null,"data-sceditor-emoticon":null}},format:function(e,t){return g(e,b)+t},html:"{0}"},hr:{tags:{hr:null},allowsEmpty:!0,isSelfClosing:!0,isInline:!1,format:"[hr]{0}",html:" "},img:{allowsEmpty:!0,tags:{img:{src:null}},allowedChildren:["#"],quoteType:x.never,format:function(t,e){var n,o,r="",i=function(e){return t.style?t.style[e]:null};return g(t,b)?e:(n=g(t,"width")||i("width"),o=g(t,"height")||i("height"),(t.complete&&(n||o)||n&&o)&&(r="="+h.width(t)+"x"+h.height(t)),"[img"+r+"]"+g(t,"src")+"[/img]")},html:function(e,t,n){var o,r,i,l="";return o=t.width,r=t.height,t.defaultattr&&(o=(i=t.defaultattr.split(/x/i))[0],r=2===i.length?i[1]:i[0]),void 0!==o&&(l+=' width="'+f(o,!0)+'"'),void 0!==r&&(l+=' height="'+f(r,!0)+'"')," '}},url:{allowsEmpty:!0,tags:{a:{href:null}},quoteType:x.never,format:function(e,t){var n=g(e,"href");return"mailto:"===n.substr(0,7)?'[email="'+n.substr(7)+'"]'+t+"[/email]":"[url="+n+"]"+t+"[/url]"},html:function(e,t,n){return t.defaultattr=f(t.defaultattr,!0)||n,''+n+" "}},email:{quoteType:x.never,html:function(e,t,n){return''+n+" "}},quote:{tags:{blockquote:null},isInline:!1,quoteType:x.never,format:function(e,t){for(var n,o="data-author",r="",i=e.children,l=0;!n&&l"+f(t.defaultattr)+""+n),""+n+" "}},code:{tags:{code:null},isInline:!1,allowedChildren:["#","#newline"],format:"[code]{0}[/code]",html:"{0}
"},left:{styles:{"text-align":["left","-webkit-left","-moz-left","-khtml-left"]},isInline:!1,format:"[left]{0}[/left]",html:'{0}
'},center:{styles:{"text-align":["center","-webkit-center","-moz-center","-khtml-center"]},isInline:!1,format:"[center]{0}[/center]",html:'{0}
'},right:{styles:{"text-align":["right","-webkit-right","-moz-right","-khtml-right"]},isInline:!1,format:"[right]{0}[/right]",html:'{0}
'},justify:{styles:{"text-align":["justify","-webkit-justify","-moz-justify","-khtml-justify"]},isInline:!1,format:"[justify]{0}[/justify]",html:'{0}
'},youtube:{allowsEmpty:!0,tags:{iframe:{"data-youtube-id":null}},format:function(e,t){return(e=g(e,"data-youtube-id"))?"[youtube]"+e+"[/youtube]":t},html:'VIDEO '},rtl:{styles:{direction:["rtl"]},isInline:!1,format:"[rtl]{0}[/rtl]",html:'{0}
'},ltr:{styles:{direction:["ltr"]},isInline:!1,format:"[ltr]{0}[/ltr]",html:'{0}
'},ignore:{}};function k(e,o){return e.replace(/\{([^}]+)\}/g,function(e,t){var n=!0;return"!"===t.charAt(0)&&(n=!1,t=t.substring(1)),"0"===t&&(n=!1),void 0===o[t]?e:n?f(o[t],!0):o[t]})}function C(e){return"function"==typeof e}function E(e){return e?e.replace(/\\(.)/g,"$1").replace(/^(["'])(.*?)\1$/,"$2"):e}function S(e){var n=arguments;return e.replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[t-0+1]?n[t-0+1]:"{"+t+"}"})}var T="open",D="content",M="newline",N="close";function c(e,t,n,o,r,i){var l=this;l.type=e,l.name=t,l.val=n,l.attrs=o||{},l.children=r||[],l.closing=i||null}function B(e){var h=this;function l(e,t){var n,o,r;return e===T&&(n=t.match(/\[([^\]\s=]+)(?:([^\]]+))?\]/))&&(r=i(n[1]),n[2]&&(n[2]=n[2].trim())&&(o=function(e){var t,n=/([^\s=]+)=(?:(?:(["'])((?:\\\2|[^\2])*?)\2)|((?:.(?!\s\S+=))*.))/g,o={};if("="===e.charAt(0)&&e.indexOf("=",1)<0)o.defaultattr=E(e.substr(1));else for("="===e.charAt(0)&&(e="defaultattr"+e);t=n.exec(e);)o[i(t[1])]=E(t[3])||t[4];return o}(n[2]))),e===N&&(n=t.match(/\[\/([^\[\]]+)\]/))&&(r=i(n[1])),e===M&&(r="#newline"),r&&(e!==T&&e!==N||w[r])||(e=D,r="#"),new c(e,r,t,o)}function p(e,t,n){for(var o=n.length;o--;)if(n[o].type===t&&n[o].name===e)return!0;return!1}function m(e,t){var n=(e?w[e.name]:{}).allowedChildren;return!h.opts.fixInvalidChildren||!n||-1 "),C(r.html)?l=r.html.call(h,o,o.attrs,i):(o.attrs[0]=i,l=k(r.html,o.attrs))):l=o.val+i+(o.closing?o.closing.val:"");else{if(o.type===M){if(!n){d.push(" ");continue}s||d.push(""),y||d.push(" "),t.length||d.push(" "),d.push("
\n"),s=!1;continue}a=n,l=f(o.val,!0)}a&&!s?(d.push(""),s=!0):!a&&s&&(d.push("
\n"),s=!1),d.push(l)}s&&d.push("\n");return d.join("")}(h.parse(e,t),!0)},h.toBBCode=function(e,t){return function e(t){var n,o,r,i,l,a,s,c,u,d,f=[];for(;0\n/g,""),(r=a.firstChild)&&v(r,"div")&&l(r,!0),(r=a.lastChild)&&v(r,"div")&&l(r),a.innerHTML):s}function t(e,t,n,o){var r,i,l=(n=n||document).createElement("div"),a=n.createElement("div"),s=new B(c.opts.parserOptions);for(a.innerHTML=t,m(l,"visibility","hidden"),l.appendChild(a),n.body.appendChild(l),e&&(l.insertBefore(n.createTextNode("#"),l.firstChild),l.appendChild(n.createTextNode("#"))),o&&m(a,"whiteSpace",m(o,"whiteSpace")),i=a.getElementsByClassName("sceditor-ignore");i.length;)i[0].parentNode.removeChild(i[0]);return h.removeWhiteSpace(l),r=p(a),n.body.removeChild(l),r=s.toBBCode(r,!0),c.opts.bbcodeTrim&&(r=r.trim()),r}c.init=function(){c.opts=this.opts,c.elementToBbcode=p,s(w,function(n){var o,e=w[n].tags,t=w[n].styles;e&&s(e,function(e,t){o=!1===w[n].isInline,l[e]=l[e]||{},l[e][o]=l[e][o]||{},l[e][o][n]=t}),t&&s(t,function(e,t){o=!1===w[n].isInline,a[o]=a[o]||{},a[o][e]=a[o][e]||{},a[o][e][n]=t})}),this.commands=n(!0,{},r,this.commands),this.toBBCode=c.toSource,this.fromBBCode=c.toHtml},c.toHtml=e.bind(null,!1),c.fragmentToHtml=e.bind(null,!0),c.toSource=t.bind(null,!1),c.fragmentToSource=t.bind(null,!0)}c.prototype={clone:function(){var e=this;return new c(e.type,e.name,e.val,n({},e.attrs),[],e.closing?e.closing.clone():null)},splitAt:function(e){var t,n=this.clone(),o=this.children.indexOf(e);return-1 ":">"," ":" ","\r\n":" ","\r":" ","\n":" "};return!1!==t&&(n['"']=""",n["'"]="'",n["`"]="`"),e=e.replace(/ {2}|\r\n|[&<>\r\n'"`]/g,function(e){return n[e]||e})}var b={html:'
',toolbarButton:'{dispName}
',emoticon:' ',fontOpt:'{font} ',sizeOpt:'{size} ',pastetext:'{label}
',table:'{rows}
{cols}
',image:'{url}
{width}
{height}
',email:'{label}
{desc}
',link:'{url}
{desc}
',youtubeMenu:'{label}
',youtube:'VIDEO '};function mt(e,t,n){var o=b[e];return Object.keys(t).forEach(function(e){o=o.replace(new RegExp(ft("{"+e+"}"),"g"),t[e])}),n&&(o=et(o)),o}var x=v&&v<11;function w(e){if("mozHidden"in document)for(var t,n=e.getBody();n;){if((t=n).firstChild)t=t.firstChild;else{for(;t&&!t.nextSibling;)t=t.parentNode;t&&(t=t.nextSibling)}3===n.nodeType&&/[\n\r\t]+/.test(n.nodeValue)&&(/^pre/.test(Pe(n.parentNode,"whiteSpace"))||Re(n)),n=t}}var gt={bold:{exec:"bold",tooltip:"Bold",shortcut:"Ctrl+B"},italic:{exec:"italic",tooltip:"Italic",shortcut:"Ctrl+I"},underline:{exec:"underline",tooltip:"Underline",shortcut:"Ctrl+U"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{state:function(e){if(e&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===Pe(e,"direction"),n=Pe(e,"textAlign");return"left"===n||n===(t?"start":"end")}},exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{state:function(e){if(e&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===Pe(e,"direction"),n=Pe(e,"textAlign");return"right"===n||n===(t?"end":"start")}},exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,e,n){var o=De("div");ze(o,"click","a",function(e){n(Ve(this,"font")),t.closeDropDown(!0),e.preventDefault()}),t.opts.fonts.split(",").forEach(function(e){Fe(o,mt("fontOpt",{font:e},!0))}),t.createDropDown(e,"font-picker",o)},exec:function(e){var t=this;gt.font._dropDown(t,e,function(e){t.execCommand("fontname",e)})},tooltip:"Font Name"},size:{_dropDown:function(t,e,n){var o=De("div");ze(o,"click","a",function(e){n(Ve(this,"size")),t.closeDropDown(!0),e.preventDefault()});for(var r=1;r<=7;r++)Fe(o,mt("sizeOpt",{size:r},!0));t.createDropDown(e,"fontsize-picker",o)},exec:function(e){var t=this;gt.size._dropDown(t,e,function(e){t.execCommand("fontsize",e)})},tooltip:"Font Size"},color:{_dropDown:function(t,e,n){var o=De("div"),r="",i=gt.color;i._htmlCache||(t.opts.colors.split("|").forEach(function(e){r+='',e.split(",").forEach(function(e){r+='
'}),r+="
"}),i._htmlCache=r),Fe(o,et(i._htmlCache)),ze(o,"click","a",function(e){n(Ve(this,"color")),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"color-picker",o)},exec:function(e){var t=this;gt.color._dropDown(t,e,function(e){t.execCommand("forecolor",e)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(e){var t,n=De("div"),o=this;Fe(n,mt("pastetext",{label:o._("Paste your text inside the following box:"),insert:o._("Insert")},!0)),ze(n,"click",".button",function(e){(t=He(n,"#txt")[0].value)&&o.wysiwygEditorInsertText(t),o.closeDropDown(!0),e.preventDefault()}),o.createDropDown(e,"pastetext",n)},tooltip:"Paste Text"},bulletlist:{exec:function(){w(this),this.execCommand("insertunorderedlist")},tooltip:"Bullet list"},orderedlist:{exec:function(){w(this),this.execCommand("insertorderedlist")},tooltip:"Numbered list"},indent:{state:function(e,t){var n,o,r;return We(t,"li")?0:We(t,"ul,ol,menu")&&(o=(n=this.getRangeHelper().selectedRange()).startContainer.parentNode,r=n.endContainer.parentNode,o!==o.parentNode.firstElementChild||We(r,"li")&&r!==r.parentNode.lastElementChild)?0:-1},exec:function(){var e=this.getRangeHelper().getFirstBlockParent();this.focus(),Ne(e,"ul,ol,menu")&&this.execCommand("indent")},tooltip:"Add indent"},outdent:{state:function(e,t){return Ne(t,"ul,ol,menu")?0:-1},exec:function(){Ne(this.getRangeHelper().getFirstBlockParent(),"ul,ol,menu")&&this.execCommand("outdent")},tooltip:"Remove one indent"},table:{exec:function(e){var r=this,i=De("div");Fe(i,mt("table",{rows:r._("Rows:"),cols:r._("Cols:"),insert:r._("Insert")},!0)),ze(i,"click",".button",function(e){var t=Number(He(i,"#rows")[0].value),n=Number(He(i,"#cols")[0].value),o="";0"+Array(n+1).join(""+(x?"":" ")+" ")+""),o+="
",r.wysiwygEditorInsertHtml(o),r.closeDropDown(!0),e.preventDefault())}),r.createDropDown(e,"inserttable",i)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{exec:function(){this.wysiwygEditorInsertHtml("",(x?"":" ")+"
")},tooltip:"Code"},image:{_dropDown:function(t,e,n,o){var r=De("div");Fe(r,mt("image",{url:t._("URL:"),width:t._("Width (optional):"),height:t._("Height (optional):"),insert:t._("Insert")},!0));var i=He(r,"#image")[0];i.value=n,ze(r,"click",".button",function(e){i.value&&o(i.value,He(r,"#width")[0].value,He(r,"#height")[0].value),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertimage",r)},exec:function(e){var r=this;gt.image._dropDown(r,e,"",function(e,t,n){var o="";t&&(o+=' width="'+t+'"'),n&&(o+=' height="'+n+'"'),r.wysiwygEditorInsertHtml(" ')})},tooltip:"Insert an image"},email:{_dropDown:function(n,e,o){var r=De("div");Fe(r,mt("email",{label:n._("E-mail:"),desc:n._("Description (optional):"),insert:n._("Insert")},!0)),ze(r,"click",".button",function(e){var t=He(r,"#email")[0].value;t&&o(t,He(r,"#des")[0].value),n.closeDropDown(!0),e.preventDefault()}),n.createDropDown(e,"insertemail",r)},exec:function(e){var n=this;gt.email._dropDown(n,e,function(e,t){n.focus(),!n.getRangeHelper().selectedHtml()||t?n.wysiwygEditorInsertHtml(''+(t||e)+" "):n.execCommand("createlink","mailto:"+e)})},tooltip:"Insert an email"},link:{_dropDown:function(t,e,n){var o=De("div");Fe(o,mt("link",{url:t._("URL:"),desc:t._("Description (optional):"),ins:t._("Insert")},!0));var r=He(o,"#link")[0];function i(e){r.value&&n(r.value,He(o,"#des")[0].value),t.closeDropDown(!0),e.preventDefault()}ze(o,"click",".button",i),ze(o,"keypress",function(e){13===e.which&&r.value&&i(e)},_e),t.createDropDown(e,"insertlink",o)},exec:function(e){var n=this;gt.link._dropDown(n,e,function(e,t){n.focus(),t||!n.getRangeHelper().selectedHtml()?(t=t||e,n.wysiwygEditorInsertHtml(''+t+" ")):n.execCommand("createlink",e)})},tooltip:"Insert a link"},unlink:{state:function(){return Ne(this.currentNode(),"a")?0:-1},exec:function(){var e=Ne(this.currentNode(),"a");if(e){for(;e.firstChild;)je(e.firstChild,e);Re(e)}},tooltip:"Unlink"},quote:{exec:function(e,t,n){var o="",r=" ";t?(o=o+(n=n?""+n+" ":"")+t+r,r=null):""===this.getRangeHelper().selectedHtml()&&(r=(x?"":" ")+r),this.wysiwygEditorInsertHtml(o,r)},tooltip:"Insert a Quote"},emoticon:{exec:function(f){var p=this,m=function(e){var t,n,o=p.opts,r=o.emoticonsRoot||"",i=o.emoticonsCompat,a=p.getRangeHelper(),l=i&&" "!==a.getOuterText(!0,1)?" ":"",c=i&&" "!==a.getOuterText(!1,1)?" ":"",s=De("div"),u=De("div"),d=Ce({},o.emoticons.dropdown,e?o.emoticons.more:{});return Fe(s,u),n=Math.sqrt(Object.keys(d).length),ze(s,"click","img",function(e){p.insert(l+Ae(this,"alt")+c,null,!1).closeDropDown(!0),e.preventDefault()}),Se(d,function(e,t){Fe(u,De("img",{src:r+(t.url||t),alt:e,title:t.tooltip||e})),u.children.length>=n&&(u=De("div"),Fe(s,u))}),!e&&o.emoticons.more&&(Fe(t=De("a",{className:"sceditor-more"}),document.createTextNode(p._("More"))),ze(t,"click",function(e){p.createDropDown(f,"more-emoticons",m(!0)),e.preventDefault()}),Fe(s,t)),s};p.createDropDown(f,"emoticons",m(!1))},txtExec:function(e){gt.emoticon.exec.call(this,e)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(i,e,a){var l=De("div");Fe(l,mt("youtubeMenu",{label:i._("Video URL:"),insert:i._("Insert")},!0)),ze(l,"click",".button",function(e){var t=He(l,"#link")[0].value,n=t.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),o=t.match(/[&|?](?:star)?t=((\d+[hms]?){1,3})/),r=0;o&&Se(o[1].split(/[hms]/),function(e,t){""!==t&&(r=60*r+Number(t))}),n&&/^[a-zA-Z0-9_\-]{11}$/.test(n[1])&&a(n[1],r),i.closeDropDown(!0),e.preventDefault()}),i.createDropDown(e,"insertlink",l)},exec:function(e){var n=this;gt.youtube._dropDown(n,e,function(e,t){n.wysiwygEditorInsertHtml(mt("youtube",{id:e,time:t}))})},tooltip:"Insert a YouTube video"},date:{_date:function(e){var t=new Date,n=t.getYear(),o=t.getMonth()+1,r=t.getDate();return n<2e3&&(n=1900+n),o<10&&(o="0"+o),r<10&&(r="0"+r),e.opts.dateFormat.replace(/year/i,n).replace(/month/i,o).replace(/day/i,r)},exec:function(){this.insertText(gt.date._date(this))},txtExec:function(){this.insertText(gt.date._date(this))},tooltip:"Insert current date"},time:{_time:function(){var e=new Date,t=e.getHours(),n=e.getMinutes(),o=e.getSeconds();return t<10&&(t="0"+t),n<10&&(n="0"+n),o<10&&(o="0"+o),t+":"+n+":"+o},exec:function(){this.insertText(gt.time._time())},txtExec:function(){this.insertText(gt.time._time())},tooltip:"Insert current time"},ltr:{state:function(e,t){return t&&"ltr"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();(this.focus(),t&&!We(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!We(t,"body")))&&Pe(t,"direction","ltr"===Pe(t,"direction")?"":"ltr")},tooltip:"Left-to-Right"},rtl:{state:function(e,t){return t&&"rtl"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();(this.focus(),t&&!We(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!We(t,"body")))&&Pe(t,"direction","rtl"===Pe(t,"direction")?"":"rtl")},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize",shortcut:"Ctrl+Shift+M"},source:{state:function(){return this.sourceMode()},exec:function(){this.toggleSourceMode()},txtExec:function(){this.toggleSourceMode()},tooltip:"View source",shortcut:"Ctrl+Shift+S"},ignore:{}},C={};function ht(i){var r=this,a=[],l=function(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)},e=function(e,t){e=[].slice.call(e);var n,o,r=l(e.shift());for(n=0;nc.length&&s&&3===s.nodeType;)o=s.nodeValue,r=n-c.length,l&&(a=o.length,i=0),l=s,t?(u=i=Math.max(a-r,0),c=o.substr(i,a-i)+c,s=l.previousSibling):(u=i+(a=Math.min(r,o.length)),c+=o.substr(i,a),s=l.nextSibling);return{node:l||s,offset:u,text:c}};function vt(i,e){var a,l,c=e||i.contentDocument||i.document,s="sceditor-start-marker",u="sceditor-end-marker",y=this;y.insertHTML=function(e,t){var n,o;if(!y.selectedRange())return!1;for(t&&(e+=y.selectedHtml()+t),o=De("p",{},c),n=c.createDocumentFragment(),o.innerHTML=e;o.firstChild;)Fe(n,o.firstChild);y.insertNode(n)},l=function(e,t,n){var o,r=c.createDocumentFragment();if("string"==typeof e?(t&&(e+=y.selectedHtml()+t),r=et(e)):(Fe(r,e),t&&(Fe(r,y.selectedRange().extractContents()),Fe(r,t))),o=r.lastChild){for(;!rt(o.lastChild,!0);)o=o.lastChild;if(ot(o)?o.lastChild||Fe(o,document.createTextNode("")):o=r,y.removeMarkers(),Fe(o,a(s)),Fe(o,a(u)),n){var i=De("div");return Fe(i,r),i.innerHTML}return r}},y.insertNode=function(e,t){var n=l(e,t),o=y.selectedRange(),r=o.commonAncestorContainer;if(!n)return!1;o.deleteContents(),r&&3!==r.nodeType&&!ot(r)?je(n,r):o.insertNode(n),y.restoreRange()},y.cloneSelected=function(){var e=y.selectedRange();if(e)return e.cloneRange()},y.selectedRange=function(){var e,t,n=i.getSelection();if(n){if(n.rangeCount<=0){for(t=c.body;t.firstChild;)t=t.firstChild;(e=c.createRange()).setStartBefore(t),n.addRange(e)}return 0 '})},void n.readAsDataURL(t);a[l[s]]=i.getData(l[s])}a.text=a["text/plain"],a.html=a["text/html"],V(a)}else if(!T){var u=r.scrollTop;for(v.saveRange(),T=bt.createDocumentFragment();r.firstChild;)Fe(T,r.firstChild);setTimeout(function(){var e=r.innerHTML;r.innerHTML="",Fe(r,T),r.scrollTop=u,T=!1,v.restoreRange(),V({html:e})},0)}},V=function(e){var t=De("div",{},d);r.call("pasteRaw",e),Qe(w,"pasteraw",e),e.html?(t.innerHTML=e.html,it(t)):t.innerHTML=pt(e.text||"");var n={val:t.innerHTML};"fragmentToSource"in a&&(n.val=a.fragmentToSource(n.val,d,y)),r.call("paste",n),Qe(w,"paste",n),"fragmentToHtml"in a&&(n.val=a.fragmentToHtml(n.val,y)),r.call("pasteHtml",n),de.wysiwygEditorInsertHtml(n.val,null,!0)},de.closeDropDown=function(e){f&&(Re(f),f=null),!0===e&&de.focus()},de.wysiwygEditorInsertHtml=function(e,t,n){var o,r,i,a=Xe(c);de.focus(),!n&&Ne(b,"code")||(v.insertHTML(e,t),v.saveRange(),N(),Ie(o=He(m,"#sceditor-end-marker")[0]),r=m.scrollTop,i=lt(o).top+1.5*o.offsetHeight-a,Be(o),(r").replace(/&/g,"&")),de.wysiwygEditorInsertHtml(e),de},de.getWysiwygEditorValue=function(e){for(var t,n=De("div",{},d),o=m.childNodes,r=0;r"+(xt?"":" ")+""),m.innerHTML=e,N(),Z(),ae(),ue()},de.setSourceEditorValue=function(e){s.value=e,ae()},de.updateOriginal=function(){l.value=de.val()},N=function(){var e,s,u,d,t,f,p;ye.emoticonsEnabled&&(e=m,s=ve,u=ye.emoticonsCompat,d=e.ownerDocument,t="(^|\\s| | | | |$)",f=[],p={},Me(e,"code")||(Se(s,function(e){p[e]=new RegExp(t+ft(e)+t),f.push(e)}),f.sort(function(e,t){return t.length-e.length}),function e(t){for(t=t.firstChild;t;){if(t.nodeType!==Ee||We(t,"code")||e(t),t.nodeType===Te)for(var n=0;n")}e.preventDefault()}}},Z=function(){Ze(m,function(e){if(e.nodeType===Ee&&!/inline/.test(Pe(e,"display"))&&!We(e,".sceditor-nlf")&&tt(e)){var t=De("p",{},d);return t.className="sceditor-nlf",t.innerHTML=wt?"":" ",Fe(m,t),!1}if(3===e.nodeType&&!/^\s*$/.test(e.nodeValue)||We(e,"br"))return!1})},U=function(){de.val(l.value)},$=function(){de.closeDropDown(),p=null},de._=function(){var n=arguments;return t&&t[n[0]]&&(n[0]=t[n[0]]),n[0].replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[t-0+1]?n[t-0+1]:"{"+t+"}"})},K=function(t){r&&r.call(t.type+"Event",t,de);var e=(t.target===s?"scesrc":"scewys")+t.type;fe[e]&&fe[e].forEach(function(e){e.call(de,t)})},de.bind=function(e,t,n,o){for(var r=(e=e.split(" ")).length;r--;)if(we(t)){var i="scewys"+e[r],a="scesrc"+e[r];n||(fe[i]=fe[i]||[],fe[i].push(t)),o||(fe[a]=fe[a]||[],fe[a].push(t)),"valuechanged"===e[r]&&(ae.hasHandler=!0)}return de},de.unbind=function(e,t,n,o){for(var r=(e=e.split(" ")).length;r--;)we(t)&&(n||ke(fe["scewys"+e[r]]||[],t),o||ke(fe["scesrc"+e[r]]||[],t));return de},de.blur=function(e,t,n){return we(e)?de.bind("blur",e,t,n):de.sourceMode()?s.blur():m.blur(),de},de.focus=function(e,t,n){if(we(e))de.bind("focus",e,t,n);else if(de.inSourceMode())s.focus();else{if(He(d,":focus").length)return;var o,r=v.selectedRange();x||ne(),!wt&&r&&1===r.endOffset&&r.collapsed&&(o=r.endContainer)&&1===o.childNodes.length&&We(o.firstChild,"br")&&(r.setStartBefore(o.firstChild),r.collapse(!0),v.selectRange(r)),i.focus(),m.focus(),p&&(v.selectRange(p),p=null)}return G(),de},de.keyDown=function(e,t,n){return de.bind("keydown",e,t,n)},de.keyPress=function(e,t,n){return de.bind("keypress",e,t,n)},de.keyUp=function(e,t,n){return de.bind("keyup",e,t,n)},de.nodeChanged=function(e){return de.bind("nodechanged",e,!1,!0)},de.selectionChanged=function(e){return de.bind("selectionchanged",e,!1,!0)},de.valueChanged=function(e,t,n){return de.bind("valuechanged",e,t,n)},oe=function(e){var n=0,o=de.emoticonsCache,t=String.fromCharCode(e.which);Ne(b,"code")||(o||(o=[],Se(ve,function(e,t){o[n++]=[e,t]}),o.sort(function(e,t){return e[0].length-t[0].length}),de.emoticonsCache=o,de.longestEmoticonCode=o[o.length-1][0].length),v.replaceKeyword(de.emoticonsCache,!0,!0,de.longestEmoticonCode,ye.emoticonsCompat,t)&&(ye.emoticonsCompat&&/^\s$/.test(t)||e.preventDefault()))},re=function(){!function(e,t){var n=/[^\s\xA0\u2002\u2003\u2009\u00a0]+/,o=e&&He(e,"img[data-sceditor-emoticon]");if(e&&o.length)for(var r=0;r","/":"?","\\":"|","[":"{","]":"}"},o={109:"-",110:"del",111:"/",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},r=e.which,i={8:"backspace",9:"tab",13:"enter",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"win",92:"win",93:"select",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[r]||String.fromCharCode(r).toLowerCase();(e.ctrlKey||e.metaKey)&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&(t.push("shift"),o[r]?i=o[r]:n[i]&&(i=n[i])),i&&(r<16||18 ":">"," ":" ","\r\n":" ","\r":" ","\n":" "};return!1!==t&&(n['"']=""",n["'"]="'",n["`"]="`"),e.replace(/ {2}|\r\n|[&<>\r\n'"`]/g,function(e){return n[e]||e})}var y={html:'
',toolbarButton:'{dispName}
',emoticon:' ',fontOpt:'{font} ',sizeOpt:'{size} ',pastetext:'{label}
',table:'{rows}
{cols}
',image:'{url}
{width}
{height}
',email:'{label}
{desc}
',link:'{url}
{desc}
',youtubeMenu:'{label}
',youtube:'VIDEO '};function gt(e,t,n){var o=y[e];return Object.keys(t).forEach(function(e){o=o.replace(new RegExp(ft("{"+e+"}"),"g"),t[e])}),n&&(o=et(o)),o}var x=v&&v<11;function w(e){if("mozHidden"in document)for(var t,n=e.getBody();n;){if((t=n).firstChild)t=t.firstChild;else{for(;t&&!t.nextSibling;)t=t.parentNode;t&&(t=t.nextSibling)}3===n.nodeType&&/[\n\r\t]+/.test(n.nodeValue)&&(/^pre/.test(Pe(n.parentNode,"whiteSpace"))||Re(n)),n=t}}var mt={bold:{exec:"bold",tooltip:"Bold",shortcut:"Ctrl+B"},italic:{exec:"italic",tooltip:"Italic",shortcut:"Ctrl+I"},underline:{exec:"underline",tooltip:"Underline",shortcut:"Ctrl+U"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{state:function(e){if(e&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===Pe(e,"direction"),n=Pe(e,"textAlign");return"left"===n||n===(t?"start":"end")}},exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{state:function(e){if(e&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===Pe(e,"direction"),n=Pe(e,"textAlign");return"right"===n||n===(t?"end":"start")}},exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,e,n){var o=De("div");ze(o,"click","a",function(e){n(Ve(this,"font")),t.closeDropDown(!0),e.preventDefault()}),t.opts.fonts.split(",").forEach(function(e){He(o,gt("fontOpt",{font:e},!0))}),t.createDropDown(e,"font-picker",o)},exec:function(e){var t=this;mt.font._dropDown(t,e,function(e){t.execCommand("fontname",e)})},tooltip:"Font Name"},size:{_dropDown:function(t,e,n){var o=De("div");ze(o,"click","a",function(e){n(Ve(this,"size")),t.closeDropDown(!0),e.preventDefault()});for(var i=1;i<=7;i++)He(o,gt("sizeOpt",{size:i},!0));t.createDropDown(e,"fontsize-picker",o)},exec:function(e){var t=this;mt.size._dropDown(t,e,function(e){t.execCommand("fontsize",e)})},tooltip:"Font Size"},color:{_dropDown:function(t,e,n){var o=De("div"),i="",r=mt.color;r._htmlCache||(t.opts.colors.split("|").forEach(function(e){i+='',e.split(",").forEach(function(e){i+='
'}),i+="
"}),r._htmlCache=i),He(o,et(r._htmlCache)),ze(o,"click","a",function(e){n(Ve(this,"color")),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"color-picker",o)},exec:function(e){var t=this;mt.color._dropDown(t,e,function(e){t.execCommand("forecolor",e)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(e){var t,n=De("div"),o=this;He(n,gt("pastetext",{label:o._("Paste your text inside the following box:"),insert:o._("Insert")},!0)),ze(n,"click",".button",function(e){(t=Fe(n,"#txt")[0].value)&&o.wysiwygEditorInsertText(t),o.closeDropDown(!0),e.preventDefault()}),o.createDropDown(e,"pastetext",n)},tooltip:"Paste Text"},bulletlist:{exec:function(){w(this),this.execCommand("insertunorderedlist")},tooltip:"Bullet list"},orderedlist:{exec:function(){w(this),this.execCommand("insertorderedlist")},tooltip:"Numbered list"},indent:{state:function(e,t){var n,o,i;return je(t,"li")?0:je(t,"ul,ol,menu")&&(o=(n=this.getRangeHelper().selectedRange()).startContainer.parentNode,i=n.endContainer.parentNode,o!==o.parentNode.firstElementChild||je(i,"li")&&i!==i.parentNode.lastElementChild)?0:-1},exec:function(){var e=this.getRangeHelper().getFirstBlockParent();this.focus(),Me(e,"ul,ol,menu")&&this.execCommand("indent")},tooltip:"Add indent"},outdent:{state:function(e,t){return Me(t,"ul,ol,menu")?0:-1},exec:function(){Me(this.getRangeHelper().getFirstBlockParent(),"ul,ol,menu")&&this.execCommand("outdent")},tooltip:"Remove one indent"},table:{exec:function(e){var i=this,r=De("div");He(r,gt("table",{rows:i._("Rows:"),cols:i._("Cols:"),insert:i._("Insert")},!0)),ze(r,"click",".button",function(e){var t=Number(Fe(r,"#rows")[0].value),n=Number(Fe(r,"#cols")[0].value),o="";0"+Array(n+1).join(""+(x?"":" ")+" ")+""),o+="
",i.wysiwygEditorInsertHtml(o),i.closeDropDown(!0),e.preventDefault())}),i.createDropDown(e,"inserttable",r)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{exec:function(){this.wysiwygEditorInsertHtml("",(x?"":" ")+"
")},tooltip:"Code"},image:{_dropDown:function(t,e,n,o){var i=De("div");He(i,gt("image",{url:t._("URL:"),width:t._("Width (optional):"),height:t._("Height (optional):"),insert:t._("Insert")},!0));var r=Fe(i,"#image")[0];r.value=n,ze(i,"click",".button",function(e){r.value&&o(r.value,Fe(i,"#width")[0].value,Fe(i,"#height")[0].value),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertimage",i)},exec:function(e){var i=this;mt.image._dropDown(i,e,"",function(e,t,n){var o="";t&&(o+=' width="'+t+'"'),n&&(o+=' height="'+n+'"'),i.wysiwygEditorInsertHtml(" ')})},tooltip:"Insert an image"},email:{_dropDown:function(n,e,o){var i=De("div");He(i,gt("email",{label:n._("E-mail:"),desc:n._("Description (optional):"),insert:n._("Insert")},!0)),ze(i,"click",".button",function(e){var t=Fe(i,"#email")[0].value;t&&o(t,Fe(i,"#des")[0].value),n.closeDropDown(!0),e.preventDefault()}),n.createDropDown(e,"insertemail",i)},exec:function(e){var n=this;mt.email._dropDown(n,e,function(e,t){n.focus(),!n.getRangeHelper().selectedHtml()||t?n.wysiwygEditorInsertHtml(''+(t||e)+" "):n.execCommand("createlink","mailto:"+e)})},tooltip:"Insert an email"},link:{_dropDown:function(t,e,n){var o=De("div");He(o,gt("link",{url:t._("URL:"),desc:t._("Description (optional):"),ins:t._("Insert")},!0));var i=Fe(o,"#link")[0];function r(e){i.value&&n(i.value,Fe(o,"#des")[0].value),t.closeDropDown(!0),e.preventDefault()}ze(o,"click",".button",r),ze(o,"keypress",function(e){13===e.which&&i.value&&r(e)},_e),t.createDropDown(e,"insertlink",o)},exec:function(e){var n=this;mt.link._dropDown(n,e,function(e,t){n.focus(),t||!n.getRangeHelper().selectedHtml()?(t=t||e,n.wysiwygEditorInsertHtml(''+t+" ")):n.execCommand("createlink",e)})},tooltip:"Insert a link"},unlink:{state:function(){return Me(this.currentNode(),"a")?0:-1},exec:function(){var e=Me(this.currentNode(),"a");if(e){for(;e.firstChild;)We(e.firstChild,e);Re(e)}},tooltip:"Unlink"},quote:{exec:function(e,t,n){var o="",i=" ";t?(o=o+(n=n?""+n+" ":"")+t+i,i=null):""===this.getRangeHelper().selectedHtml()&&(i=(x?"":" ")+i),this.wysiwygEditorInsertHtml(o,i)},tooltip:"Insert a Quote"},emoticon:{exec:function(f){var p=this,g=function(e){var t,n,o=p.opts,i=o.emoticonsRoot||"",r=o.emoticonsCompat,a=p.getRangeHelper(),l=r&&" "!==a.getOuterText(!0,1)?" ":"",c=r&&" "!==a.getOuterText(!1,1)?" ":"",s=De("div"),u=De("div"),d=Ce({},o.emoticons.dropdown,e?o.emoticons.more:{});return He(s,u),n=Math.sqrt(Object.keys(d).length),ze(s,"click","img",function(e){p.insert(l+Oe(this,"alt")+c,null,!1).closeDropDown(!0),e.preventDefault()}),Se(d,function(e,t){He(u,De("img",{src:i+(t.url||t),alt:e,title:t.tooltip||e})),u.children.length>=n&&(u=De("div"),He(s,u))}),!e&&o.emoticons.more&&(He(t=De("a",{className:"sceditor-more"}),document.createTextNode(p._("More"))),ze(t,"click",function(e){p.createDropDown(f,"more-emoticons",g(!0)),e.preventDefault()}),He(s,t)),s};p.createDropDown(f,"emoticons",g(!1))},txtExec:function(e){mt.emoticon.exec.call(this,e)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(r,e,a){var l=De("div");He(l,gt("youtubeMenu",{label:r._("Video URL:"),insert:r._("Insert")},!0)),ze(l,"click",".button",function(e){var t=Fe(l,"#link")[0].value,n=t.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),o=t.match(/[&|?](?:star)?t=((\d+[hms]?){1,3})/),i=0;o&&Se(o[1].split(/[hms]/),function(e,t){""!==t&&(i=60*i+Number(t))}),n&&/^[a-zA-Z0-9_\-]{11}$/.test(n[1])&&a(n[1],i),r.closeDropDown(!0),e.preventDefault()}),r.createDropDown(e,"insertlink",l)},exec:function(e){var n=this;mt.youtube._dropDown(n,e,function(e,t){n.wysiwygEditorInsertHtml(gt("youtube",{id:e,time:t}))})},tooltip:"Insert a YouTube video"},date:{_date:function(e){var t=new Date,n=t.getYear(),o=t.getMonth()+1,i=t.getDate();return n<2e3&&(n=1900+n),o<10&&(o="0"+o),i<10&&(i="0"+i),e.opts.dateFormat.replace(/year/i,n).replace(/month/i,o).replace(/day/i,i)},exec:function(){this.insertText(mt.date._date(this))},txtExec:function(){this.insertText(mt.date._date(this))},tooltip:"Insert current date"},time:{_time:function(){var e=new Date,t=e.getHours(),n=e.getMinutes(),o=e.getSeconds();return t<10&&(t="0"+t),n<10&&(n="0"+n),o<10&&(o="0"+o),t+":"+n+":"+o},exec:function(){this.insertText(mt.time._time())},txtExec:function(){this.insertText(mt.time._time())},tooltip:"Insert current time"},ltr:{state:function(e,t){return t&&"ltr"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();this.focus(),(t&&!je(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!je(t,"body")))&&Pe(t,"direction","ltr"===Pe(t,"direction")?"":"ltr")},tooltip:"Left-to-Right"},rtl:{state:function(e,t){return t&&"rtl"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();this.focus(),(t&&!je(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!je(t,"body")))&&Pe(t,"direction","rtl"===Pe(t,"direction")?"":"rtl")},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize",shortcut:"Ctrl+Shift+M"},source:{state:function(){return this.sourceMode()},exec:function(){this.toggleSourceMode()},txtExec:function(){this.toggleSourceMode()},tooltip:"View source",shortcut:"Ctrl+Shift+S"},ignore:{}},C={};function ht(r){var i=this,a=[],l=function(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)},e=function(e,t){e=[].slice.call(e);var n,o,i=l(e.shift());for(n=0;nc.length&&s&&3===s.nodeType;)o=s.nodeValue,i=n-c.length,l&&(a=o.length,r=0),l=s,t?(u=r=Math.max(a-i,0),c=o.substr(r,a-r)+c,s=l.previousSibling):(u=r+(a=Math.min(i,o.length)),c+=o.substr(r,a),s=l.nextSibling);return{node:l||s,offset:u,text:c}};function vt(r,e){var a,l,c=e||r.contentDocument||r.document,s="sceditor-start-marker",u="sceditor-end-marker",b=this;b.insertHTML=function(e,t){var n,o;if(!b.selectedRange())return!1;for(t&&(e+=b.selectedHtml()+t),o=De("p",{},c),n=c.createDocumentFragment(),o.innerHTML=e;o.firstChild;)He(n,o.firstChild);b.insertNode(n)},l=function(e,t,n){var o,i=c.createDocumentFragment();if("string"==typeof e?(t&&(e+=b.selectedHtml()+t),i=et(e)):(He(i,e),t&&(He(i,b.selectedRange().extractContents()),He(i,t))),o=i.lastChild){for(;!it(o.lastChild,!0);)o=o.lastChild;if(ot(o)?o.lastChild||He(o,document.createTextNode("")):o=i,b.removeMarkers(),He(o,a(s)),He(o,a(u)),n){var r=De("div");return He(r,i),r.innerHTML}return i}},b.insertNode=function(e,t){var n=l(e,t),o=b.selectedRange(),i=o.commonAncestorContainer;if(!n)return!1;o.deleteContents(),i&&3!==i.nodeType&&!ot(i)?We(n,i):o.insertNode(n),b.restoreRange()},b.cloneSelected=function(){var e=b.selectedRange();if(e)return e.cloneRange()},b.selectedRange=function(){var e,t,n=r.getSelection();if(n){if(n.rangeCount<=0){for(t=c.body;t.firstChild;)t=t.firstChild;(e=c.createRange()).setStartBefore(t),n.addRange(e)}return 0 '})},void n.readAsDataURL(t);a[l[s]]=r.getData(l[s])}a.text=a["text/plain"],a.html=a["text/html"],V(a)}else if(!T){var u=i.scrollTop;for(v.saveRange(),T=yt.createDocumentFragment();i.firstChild;)He(T,i.firstChild);setTimeout(function(){var e=i.innerHTML;i.innerHTML="",He(i,T),i.scrollTop=u,T=!1,v.restoreRange(),V({html:e})},0)}},V=function(e){var t=De("div",{},d);i.call("pasteRaw",e),Qe(w,"pasteraw",e),e.html?(t.innerHTML=e.html,rt(t)):t.innerHTML=pt(e.text||"");var n={val:t.innerHTML};"fragmentToSource"in a&&(n.val=a.fragmentToSource(n.val,d,b)),i.call("paste",n),Qe(w,"paste",n),"fragmentToHtml"in a&&(n.val=a.fragmentToHtml(n.val,b)),i.call("pasteHtml",n),de.wysiwygEditorInsertHtml(n.val,null,!0)},de.closeDropDown=function(e){f&&(Re(f),f=null),!0===e&&de.focus()},de.wysiwygEditorInsertHtml=function(e,t,n){var o,i,r,a=Xe(c);de.focus(),!n&&Me(y,"code")||(v.insertHTML(e,t),v.saveRange(),M(),Le(o=Fe(g,"#sceditor-end-marker")[0]),i=g.scrollTop,r=lt(o).top+1.5*o.offsetHeight-a,Be(o),(i").replace(/&/g,"&")),de.wysiwygEditorInsertHtml(e),de},de.getWysiwygEditorValue=function(e){for(var t,n=De("div",{},d),o=g.childNodes,i=0;i"+(xt?"":" ")+""),g.innerHTML=e,M(),Z(),ae(),ue()},de.setSourceEditorValue=function(e){s.value=e,ae()},de.updateOriginal=function(){l.value=de.val()},M=function(){var e,s,u,d,t,f,p;be.emoticonsEnabled&&(e=g,s=ve,u=be.emoticonsCompat,d=e.ownerDocument,t="(^|\\s| | | | |$)",f=[],p={},Ne(e,"code")||(Se(s,function(e){p[e]=new RegExp(t+ft(e)+t),f.push(e)}),f.sort(function(e,t){return t.length-e.length}),function e(t){for(t=t.firstChild;t;){if(t.nodeType!==ke||je(t,"code")||e(t),t.nodeType===Te)for(var n=0;n")}e.preventDefault()}},Z=function(){Ze(g,function(e){if(e.nodeType===ke&&!/inline/.test(Pe(e,"display"))&&!je(e,".sceditor-nlf")&&tt(e)){var t=De("p",{},d);return t.className="sceditor-nlf",t.innerHTML=wt?"":" ",He(g,t),!1}if(3===e.nodeType&&!/^\s*$/.test(e.nodeValue)||je(e,"br"))return!1})},U=function(){de.val(l.value)},$=function(){de.closeDropDown(),p=null},de._=function(){var n=arguments;return t&&t[n[0]]&&(n[0]=t[n[0]]),n[0].replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[t-0+1]?n[t-0+1]:"{"+t+"}"})},K=function(t){i&&i.call(t.type+"Event",t,de);var e=(t.target===s?"scesrc":"scewys")+t.type;fe[e]&&fe[e].forEach(function(e){e.call(de,t)})},de.bind=function(e,t,n,o){for(var i=(e=e.split(" ")).length;i--;)if(we(t)){var r="scewys"+e[i],a="scesrc"+e[i];n||(fe[r]=fe[r]||[],fe[r].push(t)),o||(fe[a]=fe[a]||[],fe[a].push(t)),"valuechanged"===e[i]&&(ae.hasHandler=!0)}return de},de.unbind=function(e,t,n,o){for(var i=(e=e.split(" ")).length;i--;)we(t)&&(n||Ee(fe["scewys"+e[i]]||[],t),o||Ee(fe["scesrc"+e[i]]||[],t));return de},de.blur=function(e,t,n){return we(e)?de.bind("blur",e,t,n):de.sourceMode()?s.blur():g.blur(),de},de.focus=function(e,t,n){if(we(e))de.bind("focus",e,t,n);else if(de.inSourceMode())s.focus();else{if(Fe(d,":focus").length)return;var o,i=v.selectedRange();x||ne(),!wt&&i&&1===i.endOffset&&i.collapsed&&(o=i.endContainer)&&1===o.childNodes.length&&je(o.firstChild,"br")&&(i.setStartBefore(o.firstChild),i.collapse(!0),v.selectRange(i)),r.focus(),g.focus(),p&&(v.selectRange(p),p=null)}return G(),de},de.keyDown=function(e,t,n){return de.bind("keydown",e,t,n)},de.keyPress=function(e,t,n){return de.bind("keypress",e,t,n)},de.keyUp=function(e,t,n){return de.bind("keyup",e,t,n)},de.nodeChanged=function(e){return de.bind("nodechanged",e,!1,!0)},de.selectionChanged=function(e){return de.bind("selectionchanged",e,!1,!0)},de.valueChanged=function(e,t,n){return de.bind("valuechanged",e,t,n)},oe=function(e){var n=0,o=de.emoticonsCache,t=String.fromCharCode(e.which);Me(y,"code")||(o||(o=[],Se(ve,function(e,t){o[n++]=[e,t]}),o.sort(function(e,t){return e[0].length-t[0].length}),de.emoticonsCache=o,de.longestEmoticonCode=o[o.length-1][0].length),v.replaceKeyword(de.emoticonsCache,!0,!0,de.longestEmoticonCode,be.emoticonsCompat,t)&&(be.emoticonsCompat&&/^\s$/.test(t)||e.preventDefault()))},ie=function(){!function(e,t){var n=/[^\s\xA0\u2002\u2003\u2009\u00a0]+/,o=e&&Fe(e,"img[data-sceditor-emoticon]");if(e&&o.length)for(var i=0;i","/":"?","\\":"|","[":"{","]":"}"},o={109:"-",110:"del",111:"/",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},i=e.which,r={8:"backspace",9:"tab",13:"enter",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"win",92:"win",93:"select",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[i]||String.fromCharCode(i).toLowerCase();(e.ctrlKey||e.metaKey)&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&(t.push("shift"),o[i]?r=o[i]:n[r]&&(r=n[r])),r&&(i<16||18",""]},italic:{txtExec:[""," "]},underline:{txtExec:[''," "]},strike:{txtExec:[''," "]},subscript:{txtExec:[""," "]},superscript:{txtExec:[""," "]},left:{txtExec:[' ',"
"]},center:{txtExec:['',"
"]},right:{txtExec:['',"
"]},justify:{txtExec:['',"
"]},font:{txtExec:function(e){var t=this;l("font")._dropDown(t,e,function(e){t.insertText(''," ")})}},size:{txtExec:function(e){var t=this;l("size")._dropDown(t,e,function(e){t.insertText(''," ")})}},color:{txtExec:function(e){var t=this;l("color")._dropDown(t,e,function(e){t.insertText(''," ")})}},bulletlist:{txtExec:[""]},orderedlist:{txtExec:[""," "]},table:{txtExec:[""]},horizontalrule:{txtExec:[" "]},code:{txtExec:["","
"]},image:{txtExec:function(e,t){var i=this;l("image")._dropDown(i,e,t,function(e,t,n){var o="";t&&(o+=' width="'+t+'"'),n&&(o+=' height="'+n+'"'),i.insertText(" ')})}},email:{txtExec:function(e,n){var o=this;l("email")._dropDown(o,e,function(e,t){o.insertText(''+(t||n||e)+" ")})}},link:{txtExec:function(e,n){var o=this;l("link")._dropDown(o,e,function(e,t){o.insertText(''+(t||n||e)+" ")})}},quote:{txtExec:[""," "]},youtube:{txtExec:function(e){var n=this;l("youtube")._dropDown(n,e,function(e,t){n.insertText('VIDEO ')})}},rtl:{txtExec:['',"
"]},ltr:{txtExec:['',"
"]}};function N(){var i=this,n={},b={};function e(e,t,n){var o,i,m,r,a,l,c,s,u,d,f,p,g,h,v=n.createElement("div");return v.innerHTML=t,S(v,"visibility","hidden"),n.body.appendChild(v),i=v,E.traverse(i,function(e){var t=e.nodeName.toLowerCase();y("*",e),y(t,e)},!0),m=v,E.traverse(m,function(e){var t,n=e.nodeName.toLowerCase(),o=e.parentNode,i=e.nodeType,r=!E.isInline(e),a=e.previousSibling,l=e.nextSibling,c=o===m,s=!a&&!l,u="iframe"!==n&&function e(t,n){var o,i=t.childNodes,r=t.nodeName.toLowerCase(),a=t.nodeValue,l=i.length,c=N.allowedEmptyTags||[];if(n&&"br"===r)return!0;if(k(t,".sceditor-ignore"))return!0;if(-1":">",'"':"""," ":" "};return e?e.replace(/[&<>"\xa0]/g,function(e){return t[e]||e}):""}function p(e,t){switch(e.nodeType){case 1:"!"===e.nodeName.toLowerCase()?n(e):function(e,t){var n,o,i,r=e.nodeName.toLowerCase(),a="iframe"===r,l=e.attributes.length,c=e.firstChild,s=t||/pre(?:\-wrap)?$/i.test(S(e,"whiteSpace")),u=!e.firstChild&&!E.canHaveChildren(e)&&!a;if(k(e,".sceditor-ignore"))return;g("<"+r,!t&&m(e));for(;l--;)o=e.attributes[l],i=o.value,g(" "+o.name.toLowerCase()+'="'+f(i)+'"',!1);g(u?" />":">",!1),a||(n=c);for(;n;)d++,p(n,s),n=n.nextSibling,d--;u||g(""+r+">",!s&&!a&&m(e)&&c&&m(c))}(e,t);break;case 3:!function(e,t){var n=e.nodeValue;t||(n=n.replace(/[\r\n]/," ").replace(/[^\S|\u00A0]+/g," "));n&&g(f(n),!t&&m(e))}(e,t);break;case 4:g("");break;case 8:n(e);break;case 9:case 11:!function(e){var t=e.firstChild;for(;t;)p(t),t=t.nextSibling}(e)}}function n(e){g("\x3c!-- "+f(e.nodeValue)+" --\x3e")}function g(e,t){var n=d;if(!1!==t)for(i.length&&i.push("\n");n--;)i.push(o.indentStr);i.push(e)}function m(e){var t=e.previousSibling;return 1!==e.nodeType&&t?!E.isInline(t):!t&&!E.isInline(e.parentNode)||!E.isInline(e)}this.serialize=function(e,t){if(i=[],t)for(e=e.firstChild;e;)p(e),e=e.nextSibling;else p(e);return i.join("")}},N.converters=[{tags:{"*":{width:null}},conv:function(e){S(e,"width",n(e,"width")),T(e,"width")}},{tags:{"*":{height:null}},conv:function(e){S(e,"height",n(e,"height")),T(e,"height")}},{tags:{li:{value:null}},conv:function(e){T(e,"value")}},{tags:{"*":{text:null}},conv:function(e){S(e,"color",n(e,"text")),T(e,"text")}},{tags:{"*":{color:null}},conv:function(e){S(e,"color",n(e,"color")),T(e,"color")}},{tags:{"*":{face:null}},conv:function(e){S(e,"fontFamily",n(e,"face")),T(e,"face")}},{tags:{"*":{align:null}},conv:function(e){S(e,"textAlign",n(e,"align")),T(e,"align")}},{tags:{"*":{border:null}},conv:function(e){S(e,"borderWidth",n(e,"border")),T(e,"border")}},{tags:{applet:{name:null},img:{name:null},layer:{name:null},map:{name:null},object:{name:null},param:{name:null}},conv:function(e){n(e,"id")||n(e,"id",n(e,"name")),T(e,"name")}},{tags:{"*":{vspace:null}},conv:function(e){S(e,"marginTop",n(e,"vspace")-0),S(e,"marginBottom",n(e,"vspace")-0),T(e,"vspace")}},{tags:{"*":{hspace:null}},conv:function(e){S(e,"marginLeft",n(e,"hspace")-0),S(e,"marginRight",n(e,"hspace")-0),T(e,"hspace")}},{tags:{hr:{noshade:null}},conv:function(e){S(e,"borderStyle","solid"),T(e,"noshade")}},{tags:{"*":{nowrap:null}},conv:function(e){S(e,"whiteSpace","nowrap"),T(e,"nowrap")}},{tags:{big:null},conv:function(e){S(o(e,"span"),"fontSize","larger")}},{tags:{small:null},conv:function(e){S(o(e,"span"),"fontSize","smaller")}},{tags:{b:null},conv:function(e){o(e,"strong")}},{tags:{u:null},conv:function(e){S(o(e,"span"),"textDecoration","underline")}},{tags:{s:null,strike:null},conv:function(e){S(o(e,"span"),"textDecoration","line-through")}},{tags:{dir:null},conv:function(e){o(e,"ul")}},{tags:{center:null},conv:function(e){S(o(e,"div"),"textAlign","center")}},{tags:{font:{size:null}},conv:function(e){S(e,"fontSize",S(e,"fontSize")),T(e,"size")}},{tags:{font:null},conv:function(e){o(e,"span")}},{tags:{"*":{type:["_moz"]}},conv:function(e){T(e,"type")}},{tags:{"*":{_moz_dirty:null}},conv:function(e){T(e,"_moz_dirty")}},{tags:{"*":{_moz_editor_bogus_node:null}},conv:function(e){e.parentNode.removeChild(e)}}],N.allowedAttribs={},N.disallowedAttribs={},N.allowedTags=[],N.disallowedTags=[],N.allowedEmptyTags=[],w.formats.xhtml=N}(sceditor);
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/plugins/autosave.js b/assets/3rdparty/sceditor/plugins/autosave.js
new file mode 100644
index 00000000..d29ee5ae
--- /dev/null
+++ b/assets/3rdparty/sceditor/plugins/autosave.js
@@ -0,0 +1,3 @@
+/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
+
+!function(e){"use strict";var t="sce-autodraft-"+location.pathname+location.search;function i(e){localStorage.removeItem(e||t)}e.plugins.autosave=function(){var a,e=this,o=t,r=864e5,n=function(e){localStorage.setItem(o,JSON.stringify(e))},s=function(){return JSON.parse(localStorage.getItem(o))};e.init=function(){var e=(a=this).opts&&a.opts.autosave||{};n=e.save||n,s=e.load||s,o=e.storageKey||o,r=e.expires||r,function(){for(var e=0;e'),n),n.nodeValue=s[3]+i.substr(s.index+s[0].length))}else a.is(n,"code")||e(n);n=n.nextSibling}}(t),e.html=t.innerHTML}}}}(document,sceditor);
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/plugins/dragdrop.js b/assets/3rdparty/sceditor/plugins/dragdrop.js
new file mode 100644
index 00000000..8459ab77
--- /dev/null
+++ b/assets/3rdparty/sceditor/plugins/dragdrop.js
@@ -0,0 +1,3 @@
+/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
+
+!function(n){"use strict";var v="data:image/gif;base64,R0lGODlhlgBkAPABAH19ffb29iH5BAAKAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAlgBkAAAC1YyPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5LL5jE6r1+y2+w2Py+f0uv2OvwD2fP6iD/gH6Pc2GIhg2JeQSNjGuLf4GMlYKIloefAIUEl52ZmJyaY5mUhqyFnqmQr6KRoaMKp66hbLumpQ69oK+5qrOyg4a6qYV2x8jJysvMzc7PwMHS09TV1tfY2drb3N3e39DR4uPk5ebn6Onq6+zt7u/g4fL99UAAAh+QQACgAAACwAAAAAlgBkAIEAAAB9fX329vYAAAAC3JSPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5LL5jE6r1+y2+w2Py+f0uv2OvwD2fP4iABgY+CcoCNeHuJdQyLjIaOiWiOj4CEhZ+SbZd/nI2RipqYhQOThKGpAZCuBZyArZprpqSupaCqtaazmLCRqai7rb2av5W5wqSShcm8fc7PwMHS09TV1tfY2drb3N3e39DR4uPk5ebn6Onq6+zt7u/g4fLz9PX29/j5/vVAAAIfkEAAoAAAAsAAAAAJYAZACBAAAAfX199vb2AAAAAuCUj6nL7Q+jnLTai7PevPsPhuJIluaJpurKtu4Lx/JM1/aN5/rO9/4PDAqHxKLxiEwql8ym8wmNSqfUqvWKzWq33K73Cw6Lx+Sy+YxOq9fstvsNj8vn9Lr9jr8E9nz+AgAYGLjQVwhXiJgguAiYgGjo9tinyCjoKLn3hpmJUGmJsBmguUnpCXCJOZraaXoKShoJe9DqehCqKlnqiZobuzrbyvuIO8xqKpxIPKlwrPCbBx0tPU1dbX2Nna29zd3t/Q0eLj5OXm5+jp6uvs7e7v4OHy8/T19vf4+fr7/P379UAAAh+QQACgAAACwAAAAAlgBkAIEAAAB9fX329vYAAAAC4JSPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5LL5jE6r1+y2+w2Py+f0uv2OvwT2fP6iD7gAMEhICAeImIAYiFDoOPi22KcouZfw6BhZGUBZeYlp6LbJiTD6CQqg6Vm6eQqqKtkZ24iaKtrKunpQa9tmmju7Wwu7KFtMi3oYDMzompkHHS09TV1tfY2drb3N3e39DR4uPk5ebn6Onq6+zt7u/g4fLz9PX29/j5+vv8/f31QAADs=",c=void 0!==window.FileReader,u=/data:[^;]+;base64,/i;function g(e){for(var t=e.substr(5,e.indexOf(";")-5),n=atob(e.substr(e.indexOf(",")+1)),r=new Uint8Array(n.length),i=0;i'+r._("Drop files here")+"
").firstChild),i.addEventListener("dragover",e),i.addEventListener("dragleave",d),i.addEventListener("dragend",d),i.addEventListener("drop",t),r.getBody().addEventListener("dragover",e),r.getBody().addEventListener("drop",d)},this.signalPasteHtml=function(e){if(!("handlePaste"in A)||A.handlePaste){var t=document.createElement("div");t.innerHTML=e.val;for(var n=t.querySelectorAll("img"),r=0;r",""+t+">"):e.execCommand("formatblock","<"+t+">")},a=function(e){var o=this,r=document.createElement("div");i.utils.each(c,function(t,a){var e=document.createElement("a");e.className="sceditor-option",e.textContent=a.name||a,e.addEventListener("click",function(e){o.closeDropDown(!0),a.exec?a.exec(o):n(o,t),e.preventDefault()}),r.appendChild(e)}),o.createDropDown(e,"format",r)}}}(sceditor);
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/plugins/plaintext.js b/assets/3rdparty/sceditor/plugins/plaintext.js
new file mode 100644
index 00000000..9ba5bf27
--- /dev/null
+++ b/assets/3rdparty/sceditor/plugins/plaintext.js
@@ -0,0 +1,3 @@
+/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
+
+!function(t){"use strict";var i=t.utils.extend;t.plugins.plaintext=function(){var e=!0;this.init=function(){var t=this.commands,n=this.opts;n&&n.plaintext&&n.plaintext.addButton&&(e=n.plaintext.enabled,t.pastetext=i(t.pastetext||{},{state:function(){return e?1:0},exec:function(){e=!e}}))},this.signalPasteRaw=function(t){if(e){if(t.html&&!t.text){var n=document.createElement("div");n.innerHTML=t.html,t.text=n.innerText}t.html=null}}}}(sceditor);
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/plugins/strictbbcode.js b/assets/3rdparty/sceditor/plugins/strictbbcode.js
new file mode 100644
index 00000000..83679268
--- /dev/null
+++ b/assets/3rdparty/sceditor/plugins/strictbbcode.js
@@ -0,0 +1,2 @@
+/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
+
diff --git a/assets/3rdparty/sceditor/plugins/undo.js b/assets/3rdparty/sceditor/plugins/undo.js
new file mode 100644
index 00000000..74071785
--- /dev/null
+++ b/assets/3rdparty/sceditor/plugins/undo.js
@@ -0,0 +1,3 @@
+/* SCEditor v2.1.3 | (C) 2017, Sam Clarke | sceditor.com/license */
+
+!function(e){"use strict";sceditor.plugins.undo=function(){var r,o,e=this,u=0,a=50,n=[],c=[],s=!1,l=function(e){s=!0,o=e.value,r.sourceMode(e.sourceMode),r.val(e.value,!1),r.focus(),e.sourceMode?r.sourceEditorCaret(e.caret):r.getRangeHelper().restoreRange(),s=!1};e.init=function(){a=(r=this).undoLimit||a,r.addShortcut("ctrl+z",e.undo),r.addShortcut("ctrl+shift+z",e.redo),r.addShortcut("ctrl+y",e.redo)},e.undo=function(){var e=c.pop(),t=r.val(null,!1);return e&&!n.length&&t===e.value&&(e=c.pop()),e&&(n.length||n.push({caret:r.sourceEditorCaret(),sourceMode:r.sourceMode(),value:t}),n.push(e),l(e)),!1},e.redo=function(){var e=n.pop();return c.length||(c.push(e),e=n.pop()),e&&(c.push(e),l(e)),!1},e.signalReady=function(){var e=r.val(null,!1);o=e,c.push({caret:this.sourceEditorCaret(),sourceMode:this.sourceMode(),value:e})},e.signalValuechangedEvent=function(e){var t=e.detail.rawValue;0a&&c.shift(),!s&&o&&o!==t&&(n.length=0,(u+=function(e,t){var r,o,u,a,n=e.length,c=t.length,s=Math.max(n,c);for(r=0;r ":">"," ":" ","\r\n":" ","\r":" ","\n":" "};return!1!==t&&(n['"']=""",n["'"]="'",n["`"]="`"),e=e.replace(/ {2}|\r\n|[&<>\r\n'"`]/g,function(e){return n[e]||e})}var y={html:'
',toolbarButton:' {dispName}
',emoticon:' ',fontOpt:'{font} ',sizeOpt:'{size} ',pastetext:'{label}
',table:'{rows}
{cols}
',image:'{url}
{width}
{height}
',email:'{label}
{desc}
',link:'{url}
{desc}
',youtubeMenu:'{label}
',youtube:'VIDEO '};function mt(e,t,n){var o=y[e];return Object.keys(t).forEach(function(e){o=o.replace(new RegExp(ft("{"+e+"}"),"g"),t[e])}),n&&(o=et(o)),o}var b=h&&h<11;function x(e){if("mozHidden"in document)for(var t,n=e.getBody();n;){if((t=n).firstChild)t=t.firstChild;else{for(;t&&!t.nextSibling;)t=t.parentNode;t&&(t=t.nextSibling)}3===n.nodeType&&/[\n\r\t]+/.test(n.nodeValue)&&(/^pre/.test(Pe(n.parentNode,"whiteSpace"))||Re(n)),n=t}}var gt={bold:{exec:"bold",tooltip:"Bold",shortcut:"Ctrl+B"},italic:{exec:"italic",tooltip:"Italic",shortcut:"Ctrl+I"},underline:{exec:"underline",tooltip:"Underline",shortcut:"Ctrl+U"},strike:{exec:"strikethrough",tooltip:"Strikethrough"},subscript:{exec:"subscript",tooltip:"Subscript"},superscript:{exec:"superscript",tooltip:"Superscript"},left:{state:function(e){if(e&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===Pe(e,"direction"),n=Pe(e,"textAlign");return"left"===n||n===(t?"start":"end")}},exec:"justifyleft",tooltip:"Align left"},center:{exec:"justifycenter",tooltip:"Center"},right:{state:function(e){if(e&&3===e.nodeType&&(e=e.parentNode),e){var t="ltr"===Pe(e,"direction"),n=Pe(e,"textAlign");return"right"===n||n===(t?"end":"start")}},exec:"justifyright",tooltip:"Align right"},justify:{exec:"justifyfull",tooltip:"Justify"},font:{_dropDown:function(t,e,n){var o=De("div");ze(o,"click","a",function(e){n(Ve(this,"font")),t.closeDropDown(!0),e.preventDefault()}),t.opts.fonts.split(",").forEach(function(e){Fe(o,mt("fontOpt",{font:e},!0))}),t.createDropDown(e,"font-picker",o)},exec:function(e){var t=this;gt.font._dropDown(t,e,function(e){t.execCommand("fontname",e)})},tooltip:"Font Name"},size:{_dropDown:function(t,e,n){var o=De("div");ze(o,"click","a",function(e){n(Ve(this,"size")),t.closeDropDown(!0),e.preventDefault()});for(var r=1;r<=7;r++)Fe(o,mt("sizeOpt",{size:r},!0));t.createDropDown(e,"fontsize-picker",o)},exec:function(e){var t=this;gt.size._dropDown(t,e,function(e){t.execCommand("fontsize",e)})},tooltip:"Font Size"},color:{_dropDown:function(t,e,n){var o=De("div"),r="",i=gt.color;i._htmlCache||(t.opts.colors.split("|").forEach(function(e){r+='',e.split(",").forEach(function(e){r+='
'}),r+="
"}),i._htmlCache=r),Fe(o,et(i._htmlCache)),ze(o,"click","a",function(e){n(Ve(this,"color")),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"color-picker",o)},exec:function(e){var t=this;gt.color._dropDown(t,e,function(e){t.execCommand("forecolor",e)})},tooltip:"Font Color"},removeformat:{exec:"removeformat",tooltip:"Remove Formatting"},cut:{exec:"cut",tooltip:"Cut",errorMessage:"Your browser does not allow the cut command. Please use the keyboard shortcut Ctrl/Cmd-X"},copy:{exec:"copy",tooltip:"Copy",errorMessage:"Your browser does not allow the copy command. Please use the keyboard shortcut Ctrl/Cmd-C"},paste:{exec:"paste",tooltip:"Paste",errorMessage:"Your browser does not allow the paste command. Please use the keyboard shortcut Ctrl/Cmd-V"},pastetext:{exec:function(e){var t,n=De("div"),o=this;Fe(n,mt("pastetext",{label:o._("Paste your text inside the following box:"),insert:o._("Insert")},!0)),ze(n,"click",".button",function(e){(t=He(n,"#txt")[0].value)&&o.wysiwygEditorInsertText(t),o.closeDropDown(!0),e.preventDefault()}),o.createDropDown(e,"pastetext",n)},tooltip:"Paste Text"},bulletlist:{exec:function(){x(this),this.execCommand("insertunorderedlist")},tooltip:"Bullet list"},orderedlist:{exec:function(){x(this),this.execCommand("insertorderedlist")},tooltip:"Numbered list"},indent:{state:function(e,t){var n,o,r;return We(t,"li")?0:We(t,"ul,ol,menu")&&(o=(n=this.getRangeHelper().selectedRange()).startContainer.parentNode,r=n.endContainer.parentNode,o!==o.parentNode.firstElementChild||We(r,"li")&&r!==r.parentNode.lastElementChild)?0:-1},exec:function(){var e=this.getRangeHelper().getFirstBlockParent();this.focus(),Ne(e,"ul,ol,menu")&&this.execCommand("indent")},tooltip:"Add indent"},outdent:{state:function(e,t){return Ne(t,"ul,ol,menu")?0:-1},exec:function(){Ne(this.getRangeHelper().getFirstBlockParent(),"ul,ol,menu")&&this.execCommand("outdent")},tooltip:"Remove one indent"},table:{exec:function(e){var r=this,i=De("div");Fe(i,mt("table",{rows:r._("Rows:"),cols:r._("Cols:"),insert:r._("Insert")},!0)),ze(i,"click",".button",function(e){var t=Number(He(i,"#rows")[0].value),n=Number(He(i,"#cols")[0].value),o="";0"+Array(n+1).join(""+(b?"":" ")+" ")+""),o+="
",r.wysiwygEditorInsertHtml(o),r.closeDropDown(!0),e.preventDefault())}),r.createDropDown(e,"inserttable",i)},tooltip:"Insert a table"},horizontalrule:{exec:"inserthorizontalrule",tooltip:"Insert a horizontal rule"},code:{exec:function(){this.wysiwygEditorInsertHtml("",(b?"":" ")+"
")},tooltip:"Code"},image:{_dropDown:function(t,e,n,o){var r=De("div");Fe(r,mt("image",{url:t._("URL:"),width:t._("Width (optional):"),height:t._("Height (optional):"),insert:t._("Insert")},!0));var i=He(r,"#image")[0];i.value=n,ze(r,"click",".button",function(e){i.value&&o(i.value,He(r,"#width")[0].value,He(r,"#height")[0].value),t.closeDropDown(!0),e.preventDefault()}),t.createDropDown(e,"insertimage",r)},exec:function(e){var r=this;gt.image._dropDown(r,e,"",function(e,t,n){var o="";t&&(o+=' width="'+t+'"'),n&&(o+=' height="'+n+'"'),r.wysiwygEditorInsertHtml(" ')})},tooltip:"Insert an image"},email:{_dropDown:function(n,e,o){var r=De("div");Fe(r,mt("email",{label:n._("E-mail:"),desc:n._("Description (optional):"),insert:n._("Insert")},!0)),ze(r,"click",".button",function(e){var t=He(r,"#email")[0].value;t&&o(t,He(r,"#des")[0].value),n.closeDropDown(!0),e.preventDefault()}),n.createDropDown(e,"insertemail",r)},exec:function(e){var n=this;gt.email._dropDown(n,e,function(e,t){n.focus(),!n.getRangeHelper().selectedHtml()||t?n.wysiwygEditorInsertHtml(''+(t||e)+" "):n.execCommand("createlink","mailto:"+e)})},tooltip:"Insert an email"},link:{_dropDown:function(t,e,n){var o=De("div");Fe(o,mt("link",{url:t._("URL:"),desc:t._("Description (optional):"),ins:t._("Insert")},!0));var r=He(o,"#link")[0];function i(e){r.value&&n(r.value,He(o,"#des")[0].value),t.closeDropDown(!0),e.preventDefault()}ze(o,"click",".button",i),ze(o,"keypress",function(e){13===e.which&&r.value&&i(e)},_e),t.createDropDown(e,"insertlink",o)},exec:function(e){var n=this;gt.link._dropDown(n,e,function(e,t){n.focus(),t||!n.getRangeHelper().selectedHtml()?(t=t||e,n.wysiwygEditorInsertHtml(''+t+" ")):n.execCommand("createlink",e)})},tooltip:"Insert a link"},unlink:{state:function(){return Ne(this.currentNode(),"a")?0:-1},exec:function(){var e=Ne(this.currentNode(),"a");if(e){for(;e.firstChild;)je(e.firstChild,e);Re(e)}},tooltip:"Unlink"},quote:{exec:function(e,t,n){var o="",r=" ";t?(o=o+(n=n?""+n+" ":"")+t+r,r=null):""===this.getRangeHelper().selectedHtml()&&(r=(b?"":" ")+r),this.wysiwygEditorInsertHtml(o,r)},tooltip:"Insert a Quote"},emoticon:{exec:function(f){var p=this,m=function(e){var t,n,o=p.opts,r=o.emoticonsRoot||"",i=o.emoticonsCompat,a=p.getRangeHelper(),l=i&&" "!==a.getOuterText(!0,1)?" ":"",c=i&&" "!==a.getOuterText(!1,1)?" ":"",s=De("div"),u=De("div"),d=Ce({},o.emoticons.dropdown,e?o.emoticons.more:{});return Fe(s,u),n=Math.sqrt(Object.keys(d).length),ze(s,"click","img",function(e){p.insert(l+Ae(this,"alt")+c,null,!1).closeDropDown(!0),e.preventDefault()}),Se(d,function(e,t){Fe(u,De("img",{src:r+(t.url||t),alt:e,title:t.tooltip||e})),u.children.length>=n&&(u=De("div"),Fe(s,u))}),!e&&o.emoticons.more&&(Fe(t=De("a",{className:"sceditor-more"}),document.createTextNode(p._("More"))),ze(t,"click",function(e){p.createDropDown(f,"more-emoticons",m(!0)),e.preventDefault()}),Fe(s,t)),s};p.createDropDown(f,"emoticons",m(!1))},txtExec:function(e){gt.emoticon.exec.call(this,e)},tooltip:"Insert an emoticon"},youtube:{_dropDown:function(i,e,a){var l=De("div");Fe(l,mt("youtubeMenu",{label:i._("Video URL:"),insert:i._("Insert")},!0)),ze(l,"click",".button",function(e){var t=He(l,"#link")[0].value,n=t.match(/(?:v=|v\/|embed\/|youtu.be\/)(.{11})/),o=t.match(/[&|?](?:star)?t=((\d+[hms]?){1,3})/),r=0;o&&Se(o[1].split(/[hms]/),function(e,t){""!==t&&(r=60*r+Number(t))}),n&&/^[a-zA-Z0-9_\-]{11}$/.test(n[1])&&a(n[1],r),i.closeDropDown(!0),e.preventDefault()}),i.createDropDown(e,"insertlink",l)},exec:function(e){var n=this;gt.youtube._dropDown(n,e,function(e,t){n.wysiwygEditorInsertHtml(mt("youtube",{id:e,time:t}))})},tooltip:"Insert a YouTube video"},date:{_date:function(e){var t=new Date,n=t.getYear(),o=t.getMonth()+1,r=t.getDate();return n<2e3&&(n=1900+n),o<10&&(o="0"+o),r<10&&(r="0"+r),e.opts.dateFormat.replace(/year/i,n).replace(/month/i,o).replace(/day/i,r)},exec:function(){this.insertText(gt.date._date(this))},txtExec:function(){this.insertText(gt.date._date(this))},tooltip:"Insert current date"},time:{_time:function(){var e=new Date,t=e.getHours(),n=e.getMinutes(),o=e.getSeconds();return t<10&&(t="0"+t),n<10&&(n="0"+n),o<10&&(o="0"+o),t+":"+n+":"+o},exec:function(){this.insertText(gt.time._time())},txtExec:function(){this.insertText(gt.time._time())},tooltip:"Insert current time"},ltr:{state:function(e,t){return t&&"ltr"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();(this.focus(),t&&!We(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!We(t,"body")))&&Pe(t,"direction","ltr"===Pe(t,"direction")?"":"ltr")},tooltip:"Left-to-Right"},rtl:{state:function(e,t){return t&&"rtl"===t.style.direction},exec:function(){var e=this.getRangeHelper(),t=e.getFirstBlockParent();(this.focus(),t&&!We(t,"body")||(this.execCommand("formatBlock","p"),(t=e.getFirstBlockParent())&&!We(t,"body")))&&Pe(t,"direction","rtl"===Pe(t,"direction")?"":"rtl")},tooltip:"Right-to-Left"},print:{exec:"print",tooltip:"Print"},maximize:{state:function(){return this.maximize()},exec:function(){this.maximize(!this.maximize())},txtExec:function(){this.maximize(!this.maximize())},tooltip:"Maximize",shortcut:"Ctrl+Shift+M"},source:{state:function(){return this.sourceMode()},exec:function(){this.toggleSourceMode()},txtExec:function(){this.toggleSourceMode()},tooltip:"View source",shortcut:"Ctrl+Shift+S"},ignore:{}},w={};function ht(i){var r=this,a=[],l=function(e){return"signal"+e.charAt(0).toUpperCase()+e.slice(1)},e=function(e,t){e=[].slice.call(e);var n,o,r=l(e.shift());for(n=0;nc.length&&s&&3===s.nodeType;)o=s.nodeValue,r=n-c.length,l&&(a=o.length,i=0),l=s,t?(u=i=Math.max(a-r,0),c=o.substr(i,a-i)+c,s=l.previousSibling):(u=i+(a=Math.min(r,o.length)),c+=o.substr(i,a),s=l.nextSibling);return{node:l||s,offset:u,text:c}};function vt(i,e){var a,l,c=e||i.contentDocument||i.document,s="sceditor-start-marker",u="sceditor-end-marker",y=this;y.insertHTML=function(e,t){var n,o;if(!y.selectedRange())return!1;for(t&&(e+=y.selectedHtml()+t),o=De("p",{},c),n=c.createDocumentFragment(),o.innerHTML=e;o.firstChild;)Fe(n,o.firstChild);y.insertNode(n)},l=function(e,t,n){var o,r=c.createDocumentFragment();if("string"==typeof e?(t&&(e+=y.selectedHtml()+t),r=et(e)):(Fe(r,e),t&&(Fe(r,y.selectedRange().extractContents()),Fe(r,t))),o=r.lastChild){for(;!rt(o.lastChild,!0);)o=o.lastChild;if(ot(o)?o.lastChild||Fe(o,document.createTextNode("")):o=r,y.removeMarkers(),Fe(o,a(s)),Fe(o,a(u)),n){var i=De("div");return Fe(i,r),i.innerHTML}return r}},y.insertNode=function(e,t){var n=l(e,t),o=y.selectedRange(),r=o.commonAncestorContainer;if(!n)return!1;o.deleteContents(),r&&3!==r.nodeType&&!ot(r)?je(n,r):o.insertNode(n),y.restoreRange()},y.cloneSelected=function(){var e=y.selectedRange();if(e)return e.cloneRange()},y.selectedRange=function(){var e,t,n=i.getSelection();if(n){if(n.rangeCount<=0){for(t=c.body;t.firstChild;)t=t.firstChild;(e=c.createRange()).setStartBefore(t),n.addRange(e)}return 0 '})},void n.readAsDataURL(t);a[l[s]]=i.getData(l[s])}a.text=a["text/plain"],a.html=a["text/html"],V(a)}else if(!T){var u=r.scrollTop;for(v.saveRange(),T=bt.createDocumentFragment();r.firstChild;)Fe(T,r.firstChild);setTimeout(function(){var e=r.innerHTML;r.innerHTML="",Fe(r,T),r.scrollTop=u,T=!1,v.restoreRange(),V({html:e})},0)}},V=function(e){var t=De("div",{},d);r.call("pasteRaw",e),Ge(w,"pasteraw",e),e.html?(t.innerHTML=e.html,it(t)):t.innerHTML=pt(e.text||"");var n={val:t.innerHTML};"fragmentToSource"in a&&(n.val=a.fragmentToSource(n.val,d,y)),r.call("paste",n),Ge(w,"paste",n),"fragmentToHtml"in a&&(n.val=a.fragmentToHtml(n.val,y)),r.call("pasteHtml",n),de.wysiwygEditorInsertHtml(n.val,null,!0)},de.closeDropDown=function(e){f&&(Re(f),f=null),!0===e&&de.focus()},de.wysiwygEditorInsertHtml=function(e,t,n){var o,r,i,a=Xe(c);de.focus(),!n&&Ne(b,"code")||(v.insertHTML(e,t),v.saveRange(),N(),Ie(o=He(m,"#sceditor-end-marker")[0]),r=m.scrollTop,i=lt(o).top+1.5*o.offsetHeight-a,Be(o),(r").replace(/&/g,"&")),de.wysiwygEditorInsertHtml(e),de},de.getWysiwygEditorValue=function(e){for(var t,n=De("div",{},d),o=m.childNodes,r=0;r"+(xt?"":" ")+""),m.innerHTML=e,N(),Z(),ae(),ue()},de.setSourceEditorValue=function(e){s.value=e,ae()},de.updateOriginal=function(){l.value=de.val()},N=function(){var e,s,u,d,t,f,p;ye.emoticonsEnabled&&(e=m,s=ve,u=ye.emoticonsCompat,d=e.ownerDocument,t="(^|\\s| | | | |$)",f=[],p={},Me(e,"code")||(Se(s,function(e){p[e]=new RegExp(t+ft(e)+t),f.push(e)}),f.sort(function(e,t){return t.length-e.length}),function e(t){for(t=t.firstChild;t;){if(t.nodeType!==Ee||We(t,"code")||e(t),t.nodeType===Te)for(var n=0;n")}e.preventDefault()}}},Z=function(){Ze(m,function(e){if(e.nodeType===Ee&&!/inline/.test(Pe(e,"display"))&&!We(e,".sceditor-nlf")&&tt(e)){var t=De("p",{},d);return t.className="sceditor-nlf",t.innerHTML=wt?"":" ",Fe(m,t),!1}if(3===e.nodeType&&!/^\s*$/.test(e.nodeValue)||We(e,"br"))return!1})},U=function(){de.val(l.value)},$=function(){de.closeDropDown(),p=null},de._=function(){var n=arguments;return t&&t[n[0]]&&(n[0]=t[n[0]]),n[0].replace(/\{(\d+)\}/g,function(e,t){return void 0!==n[t-0+1]?n[t-0+1]:"{"+t+"}"})},K=function(t){r&&r.call(t.type+"Event",t,de);var e=(t.target===s?"scesrc":"scewys")+t.type;fe[e]&&fe[e].forEach(function(e){e.call(de,t)})},de.bind=function(e,t,n,o){for(var r=(e=e.split(" ")).length;r--;)if(we(t)){var i="scewys"+e[r],a="scesrc"+e[r];n||(fe[i]=fe[i]||[],fe[i].push(t)),o||(fe[a]=fe[a]||[],fe[a].push(t)),"valuechanged"===e[r]&&(ae.hasHandler=!0)}return de},de.unbind=function(e,t,n,o){for(var r=(e=e.split(" ")).length;r--;)we(t)&&(n||ke(fe["scewys"+e[r]]||[],t),o||ke(fe["scesrc"+e[r]]||[],t));return de},de.blur=function(e,t,n){return we(e)?de.bind("blur",e,t,n):de.sourceMode()?s.blur():m.blur(),de},de.focus=function(e,t,n){if(we(e))de.bind("focus",e,t,n);else if(de.inSourceMode())s.focus();else{if(He(d,":focus").length)return;var o,r=v.selectedRange();x||ne(),!wt&&r&&1===r.endOffset&&r.collapsed&&(o=r.endContainer)&&1===o.childNodes.length&&We(o.firstChild,"br")&&(r.setStartBefore(o.firstChild),r.collapse(!0),v.selectRange(r)),i.focus(),m.focus(),p&&(v.selectRange(p),p=null)}return J(),de},de.keyDown=function(e,t,n){return de.bind("keydown",e,t,n)},de.keyPress=function(e,t,n){return de.bind("keypress",e,t,n)},de.keyUp=function(e,t,n){return de.bind("keyup",e,t,n)},de.nodeChanged=function(e){return de.bind("nodechanged",e,!1,!0)},de.selectionChanged=function(e){return de.bind("selectionchanged",e,!1,!0)},de.valueChanged=function(e,t,n){return de.bind("valuechanged",e,t,n)},oe=function(e){var n=0,o=de.emoticonsCache,t=String.fromCharCode(e.which);Ne(b,"code")||(o||(o=[],Se(ve,function(e,t){o[n++]=[e,t]}),o.sort(function(e,t){return e[0].length-t[0].length}),de.emoticonsCache=o,de.longestEmoticonCode=o[o.length-1][0].length),v.replaceKeyword(de.emoticonsCache,!0,!0,de.longestEmoticonCode,ye.emoticonsCompat,t)&&(ye.emoticonsCompat&&/^\s$/.test(t)||e.preventDefault()))},re=function(){!function(e,t){var n=/[^\s\xA0\u2002\u2003\u2009\u00a0]+/,o=e&&He(e,"img[data-sceditor-emoticon]");if(e&&o.length)for(var r=0;r","/":"?","\\":"|","[":"{","]":"}"},o={109:"-",110:"del",111:"/",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9"},r=e.which,i={8:"backspace",9:"tab",13:"enter",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",91:"win",92:"win",93:"select",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"}[r]||String.fromCharCode(r).toLowerCase();(e.ctrlKey||e.metaKey)&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&(t.push("shift"),o[r]?i=o[r]:n[i]&&(i=n[i])),i&&(r<16||18~jQ0e!@m|
z$=mAwZ>HrkVVq>2+*pdWF=CgReq8GlCRd!~6%`dvPft*f&t0h9@3ab)bx_0I`b~tv
zZKdNbV4rttTz!3gT&U`O~a*69A}>E}E=JhHR1khkYv
zUS7}S{8)mr%F4>K)Rpk|{CTS5?(gqqWo2Tm>D=r7d3t)+pi#ft_~PsK*`{A_x9;il
z{p9ccgs$Vp-}apPXjm7i(?6FgbE7b!7-LPxE(dl50%I+2d@yJ57(e&M!Me_Rp
z)#315t5kxezGJdm(w0n~y4Pxz$I$7udAW1n8XMo=;FzA9RijRRyX^JdoX(9%rFA)u
z$%gmeeEqCZwCx?}RtQcade^3->(!`|h;eDT$3?!htHo8A9+v7geHg~5MN%x(4A
zU*WcL_ug%>g(29=zjdCY+0CK(<&vU@W^#=or?YZ`j9IA{da31^`Ssn{
z*44pyZTNGJFl_*FT?CME{0{D8J3tz)JwB$R18zA2*#aMxS3E!;y
zM*TGx?CTdnPztfjH-a$sYwYq1&3M&?b$}_(zyP5MOYFFOPR!*UiD4QV`vexY8!o>s
zwA~QsL(C-q&}kdD1Xga@I4!|{5{jh6WR1#DW++l=k`t3qgr_IZQ>pUuRH}K&>ES3+
z(gG8TI=m`70>2zN@*E&0Hr>l>(qHovjqWi%oqH*Xd;Y#1(!mp5Z|H#>>p8#cIR
zob&RA&GZyr##
ztU$Cr=^Bj&G#Za|ERa+mNMQw%>I0P>MG1jvDN=pl=5(+0Sd1BGE!B*V1DT~!Apz6J
zPn6<-sOb=_3kiUJknCTXfiF{w!$fnNKOnj^5Si))gn6>q0)#QLC{~DRc|cg%yYSga
zewEz3CE=lp^#HfI9v~aN>CeQHN^Txo{w_HTUWnNn{z$eM$fvaacz)f*pIF6==
z$BrEQJwgQ9&fpQRi7q27EMuCJ@DBqB%ah||tPs7w$`va1NdY%m
z;QcdiW2`8WD+$G$=*=&aIa0sy(L?5fNO(9P?$5|#NDL8~PGWRsW~MisF&=Ir9!$8Y
z_54n7p9d3qHDa|E3WdzL33^10Lajzag~3o%l#n1GZcGT6L^>66A(W96OtNx8(UW6K
z8D*G*h=Qjeq6iHwqj15Soip0oLn)$=VL~m(YBzrQiV7&XND18
ztT*tMt6i!A!VUNpk*(Eg127iFMD4hMngEbQL}X;##Bx!r!&OaCoMuA#c;4k9hzlBj
zZAd_Qu#O8|Wcm2>&KqA79KpK;(B9{1qnOaF(?(tkpqmgBwU~-K*S#4$K{x%p3xb2s
zn@%s~xr<=H3Ath`VVESAy!6sb!(f;!w#q^?g@|FDl9)ngIo-IeolHzQ`)ocKt{4Vq
zorQ557uZb2!5%I!!oS$%ghIgCN}+jDAtSmLytZs9#^JwF1-(&B+Etr24S~O8
z3$|~>_8~*^^Px9Xtlixm{t|L{+U))}>n+xfzyKnT7lvZIfO5Qma=d_Yynu4NfO5P5
zA1~kCc;oWhsbJ&f*$4N3v;RRfnrqp3S-$_bpMH96IgX^LC^}wl#D_THryD_HIVPMs
zwOkgrKX~fYsT=VavRO{vrBCQ)mvUyafjj$U<`6T!MmislpKB5@F|j`JmM$RqUYrZCi2u)*2rH67i1K(nTP16%Az~;^Uxy
z#4YtD1W3ZyNNA~v(ul%RQc`Qzm(&C}i&}@#IFrR1UrRv&rZgF6(mu(FzD9DXcDrR}
z@g$sUJIbiQPDWpYzZ+a0T39JjXh?%ZoL{0)Xc6h%ZN8Vvd1Ra6w1m{{pmj1S59J&J^)L~JG`Nmk+gJbg&@1ntV(7N_UaRl!u7B;*Z9|!OZ`*5>=VkE%
z<@pyxf!`A(@hK5s5Ef=+WK2SVjjw;FR}-x23=|l@{++dmVnwkH#aSsL(qpg@B;Zmb?Cm_fnnfr1(otRC2f7(EpjqYzLL!RxV%#sUgn
zk6)z)h;j|)F=+G4WPqE~($ZpMM~|j+_N-X|m`^7R5@+Mh*mYKqTmle_`N&+Rt^nxo
z{DR$Cdq0*NCWSDeP#Chj#+s0lunaVRi=SVJ@@>qDxQ49v^Vkeb1U_BE-&3yDDvUNl
zAtJO8?z{t{)sBF_{Cc{mIM~*9Fy?I7wWF=AXAcv*
zPT-ntM_bRkdzd(QqU{8Vci-I;Lj~raAYu;!l(Pu~v`BqYBQH|2XTHL9%9#}z;yT|hf&avOdsV!r%vC7j+trAXV)aDf
zsV+Tw^yp4PqLGQ6FLHLCCLB~4PZLLR+d8$gv$ORm7o}QGsVK@RNBMp-3KsMIWE3}*
z68L^H5d{>!pNzt4r11S@`QrMupNx+f{$#D8+SJ>LF!)#6M)UysK4)48=iqAfOp2XLEj)HdC
zci{8aNW9=M?Q(zj@lUpYjx0F*{(Fzox81vs9^mkSz1PiPC${(a0ep+@z0ZrMx}tk8
z^4>i>#$J!!bKQ0KJc{{eMs{jYBf*yvp95?47D2*djE5kLxx#{*J=N7!&5oKDUkK7S
znH?4kN$h9zg+_e|n&v8tP;EBZsVFF@t8w7|PmQ0Qh?)9=k~)*w;V_#__F5`R8cGW6
zekMElyz*OLSfy_$s35Sq1|uWgtP
z&LY*Z7@UQp?kXvW$%)UI-7;H_<8#;8S{<|9M3Ix5GRf9z+L{~Ah3{;bU<9%;BWIOPJSw(i*+%7NffJgnRaxxB14dC6NmoDWvFPaN
z3!^8G(1;@X5+wSP$rB}U?zxv-a$$7zC|RH(lVMQMsEHa$2vt>8)m7$k8X^$0r53jo
zn``|>pt$hD3sI1LNQcqlD+^+ps)J$F(^NF$E+h7;3Wi&w31$o3b0uQwtpwlZf(l}q
zgMkrjVZtH_D-%{xTtH3>kusKEF!KTi^o8@!KOgq*-w*G<|9&6E>AdmA8}RYRAA`+i
z>!UawTzbI=AAA5Ge)wS@#F;WbyR&nvEqBS1CE3~YH7G7M3rKTSMMnLnMIi;;lBjtGv5xShzYEu)2wIx*zIb?8nmTH57q7ZFK>jV@NcCwq6#Zps|O2p#bt%n*~9C#%a
z)jJmhnX7Yhva+%~kT=xqX&6)`Rkcp9sE|KO)dB0H17zC0p_xBH*n(m`>`hA#6p6An?
z#55EeRkA3a2D(^Pk}UGld}38&z)8#lNZK?yM*ja}*s9APk|_zA?w;=?MgwH#yL<3B
ze9X#~-rjS)F&<<*yp^$sGWJ%+9?ICe_ZV2*FO+2_tije{0VELgb*8s
R^t1o~002ovPDHLkV1hp-8@>Pl
literal 0
HcmV?d00001
diff --git a/assets/3rdparty/sceditor/themes/modern.min.css b/assets/3rdparty/sceditor/themes/modern.min.css
new file mode 100644
index 00000000..c8701330
--- /dev/null
+++ b/assets/3rdparty/sceditor/themes/modern.min.css
@@ -0,0 +1 @@
+/*! SCEditor | (C) 2011-2016, Sam Clarke | sceditor.com/license */.sceditor-button div,div.sceditor-grip{background-image:url(famfamfam.png);background-repeat:no-repeat;width:16px;height:16px}.sceditor-button-youtube div{background-position:0 0}.sceditor-button-link div{background-position:0 -16px}.sceditor-button-unlink div{background-position:0 -32px}.sceditor-button-underline div{background-position:0 -48px}.sceditor-button-time div{background-position:0 -64px}.sceditor-button-table div{background-position:0 -80px}.sceditor-button-superscript div{background-position:0 -96px}.sceditor-button-subscript div{background-position:0 -112px}.sceditor-button-strike div{background-position:0 -128px}.sceditor-button-source div{background-position:0 -144px}.sceditor-button-size div{background-position:0 -160px}.sceditor-button-rtl div{background-position:0 -176px}.sceditor-button-right div{background-position:0 -192px}.sceditor-button-removeformat div{background-position:0 -208px}.sceditor-button-quote div{background-position:0 -224px}.sceditor-button-print div{background-position:0 -240px}.sceditor-button-pastetext div{background-position:0 -256px}.sceditor-button-paste div{background-position:0 -272px}.sceditor-button-outdent div{background-position:0 -288px}.sceditor-button-orderedlist div{background-position:0 -304px}.sceditor-button-maximize div{background-position:0 -320px}.sceditor-button-ltr div{background-position:0 -336px}.sceditor-button-left div{background-position:0 -352px}.sceditor-button-justify div{background-position:0 -368px}.sceditor-button-italic div{background-position:0 -384px}.sceditor-button-indent div{background-position:0 -400px}.sceditor-button-image div{background-position:0 -416px}.sceditor-button-horizontalrule div{background-position:0 -432px}.sceditor-button-format div{background-position:0 -448px}.sceditor-button-font div{background-position:0 -464px}.sceditor-button-emoticon div{background-position:0 -480px}.sceditor-button-email div{background-position:0 -496px}.sceditor-button-date div{background-position:0 -512px}.sceditor-button-cut div{background-position:0 -528px}.sceditor-button-copy div{background-position:0 -544px}.sceditor-button-color div{background-position:0 -560px}.sceditor-button-code div{background-position:0 -576px}.sceditor-button-center div{background-position:0 -592px}.sceditor-button-bulletlist div{background-position:0 -608px}.sceditor-button-bold div{background-position:0 -624px}div.sceditor-grip{background-position:0 -640px}.rtl div.sceditor-grip{background-position:0 -650px;right:auto;left:0}.sceditor-container{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;position:relative;background:padding-box #fff;font-size:13px;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;color:#333;line-height:1;font-weight:700;height:250px;border-radius:4px}.sceditor-container *,.sceditor-container :after,.sceditor-container :before{-webkit-box-sizing:content-box;box-sizing:content-box}.sceditor-container,.sceditor-container div,div.sceditor-dropdown,div.sceditor-dropdown div{padding:0;margin:0;z-index:3}.sceditor-container iframe,.sceditor-container textarea{display:block;-ms-flex:1 1 0%;-webkit-box-flex:1;flex:1 1 0%;line-height:1.25;border:0;outline:0;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;color:#111;padding:0;margin:5px;resize:none;background:#fff;height:auto!important;width:auto!important;width:calc(100% - 10px)!important;min-height:1px}div.sceditor-dnd-cover{position:absolute;top:0;left:0;bottom:0;right:0;background:rgba(255,255,255,.2);border:5px dashed #aaa;z-index:200;font-size:2em;text-align:center;color:#aaa}div.sceditor-dnd-cover p{position:relative;top:45%;pointer-events:none}div.sceditor-resize-cover{position:absolute;top:0;left:0;background:#000;width:100%;height:100%;z-index:10;opacity:.3}div.sceditor-grip{overflow:hidden;width:10px;height:10px;cursor:pointer;position:absolute;bottom:0;right:0;z-index:3;line-height:0}div.sceditor-grip.has-icon{background-image:none}.sceditor-maximize{position:fixed;top:0;left:0;height:100%!important;width:100%!important;border-radius:0;background-clip:padding-box;z-index:2000}body.sceditor-maximize,html.sceditor-maximize{height:100%;width:100%;padding:0;margin:0;overflow:hidden}.sceditor-maximize div.sceditor-grip{display:none}.sceditor-maximize div.sceditor-toolbar{border-radius:0;background-clip:padding-box}div.sceditor-dropdown{position:absolute;border:1px solid #ccc;background:padding-box #fff;z-index:4000;padding:10px;font-weight:400;font-size:15px;border-radius:2px;-webkit-box-shadow:1px 2px 4px rgba(0,0,0,.2);box-shadow:1px 2px 4px rgba(0,0,0,.2)}div.sceditor-dropdown *,div.sceditor-dropdown :after,div.sceditor-dropdown :before{-webkit-box-sizing:border-box;box-sizing:border-box}div.sceditor-dropdown a,div.sceditor-dropdown a:link{color:#333}div.sceditor-dropdown form{margin:0}div.sceditor-dropdown label{display:block;font-weight:700;color:#3c3c3c;padding:4px 0}div.sceditor-dropdown input,div.sceditor-dropdown textarea{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;outline:0;padding:4px;border:1px solid #ccc;border-top-color:#888;margin:0 0 .75em;border-radius:1px;background-clip:padding-box}div.sceditor-dropdown textarea{padding:6px}div.sceditor-dropdown input:focus,div.sceditor-dropdown textarea:focus{border-color:#666 #aaa #aaa;-webkit-box-shadow:inset 0 1px 5px rgba(0,0,0,.1);box-shadow:inset 0 1px 5px rgba(0,0,0,.1)}div.sceditor-dropdown .button{font-weight:700;color:#444;padding:6px 12px;background:padding-box #ececec;border:1px solid #ccc;border-radius:2px;cursor:pointer;margin:.3em 0 0}div.sceditor-dropdown .button:hover{background:#f3f3f3;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.15);box-shadow:0 1px 1px rgba(0,0,0,.15)}div.sceditor-font-picker,div.sceditor-fontsize-picker,div.sceditor-format{padding:6px 0}div.sceditor-color-picker{padding:4px}div.sceditor-emoticons,div.sceditor-more-emoticons{padding:0}.sceditor-pastetext textarea{border:1px solid #bbb;width:20em}.sceditor-emoticons img,.sceditor-more-emoticons img{padding:0;cursor:pointer;margin:2px}.sceditor-more{border-top:1px solid #bbb;display:block;text-align:center;cursor:pointer;font-weight:700;padding:6px 0}.sceditor-dropdown a:hover{background:#eee}.sceditor-font-option,.sceditor-fontsize-option,.sceditor-format a{display:block;padding:7px 10px;cursor:pointer;text-decoration:none;color:#222}.sceditor-fontsize-option{padding:7px 13px}.sceditor-color-column{float:left}.sceditor-color-option{display:block;border:2px solid #fff;height:18px;width:18px;overflow:hidden}.sceditor-color-option:hover{border:1px solid #aaa}div.sceditor-toolbar{-ms-flex-negative:0;flex-shrink:0;overflow:hidden;padding:3px 5px 2px;border-bottom:1px solid silver;line-height:0;text-align:left;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:3px 3px 0 0}div.sceditor-group{border-bottom:1px solid #aaa;border-radius:3px}.sceditor-button.active,.sceditor-button:active,.sceditor-button:hover{-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2)}.sceditor-button:active{background:#fff;-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3)}.sceditor-button.disabled:hover{background:inherit;cursor:default;-webkit-box-shadow:none;box-shadow:none}.sceditor-button,.sceditor-button div{display:block}.sceditor-button svg{display:inline-block;height:16px;width:16px;fill:#111;text-decoration:none;pointer-events:none;line-height:1}.sceditor-button.disabled svg{fill:#888}.sceditor-button div{display:inline-block;padding:0;overflow:hidden;line-height:0;font-size:0;color:transparent}.sceditor-button.has-icon div{display:none}.sceditor-button.disabled div{opacity:.3}.sceditor-button.text,.sceditor-button.text div,.sceditor-button.text-icon,.sceditor-button.text-icon div,.text .sceditor-button,.text .sceditor-button div,.text-icon .sceditor-button,.text-icon .sceditor-button div{display:inline-block;width:auto;line-height:16px;font-size:1em;color:inherit;text-indent:0}.sceditor-button.has-icon div,.sceditor-button.text div,.text .sceditor-button div,.text-icon .sceditor-button.has-icon div{padding:0 2px;background:0 0}.sceditor-button.text svg,.text .sceditor-button svg{display:none}.sceditor-button.text-icon div,.text-icon .sceditor-button div{padding:0 2px 0 20px}.rtl div.sceditor-toolbar{text-align:right}.rtl .sceditor-button{float:right}.sceditor-container{border:1px solid #999}.sceditor-container textarea{font-family:Consolas,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace;background:#2e3436;color:#fff;margin:0;padding:5px}div.sceditor-toolbar{background:#ccc;background:-webkit-gradient(linear,left top,left bottom,from(#ccc),to(#b2b2b2));background:-webkit-linear-gradient(top,#ccc 0,#b2b2b2 100%);background:-o-linear-gradient(top,#ccc 0,#b2b2b2 100%);background:linear-gradient(to bottom,#ccc 0,#b2b2b2 100%)}div.sceditor-group{display:inline;background:0 0;margin:0;padding:0;border:0}.sceditor-button{float:left;cursor:pointer;width:16px;padding:4px;margin:2px 1px 2px 3px;height:16px;border-radius:12px;background-clip:padding-box}.sceditor-button.active,.sceditor-button.active:hover,.sceditor-button:hover{-webkit-box-shadow:none;box-shadow:none}.sceditor-button:hover{background:rgba(255,255,255,.75);margin:1px 0 1px 2px;border:1px solid #eee}.sceditor-button.disabled:hover{margin:2px 1px 2px 3px;border:0}.sceditor-button.active{background:rgba(0,0,0,.1);margin:1px 0 1px 2px;border:1px solid #999}.sceditor-button.active:hover{background:rgba(255,255,255,.25)}.sceditor-button.active:active,.sceditor-button:active{margin:1px 0 1px 2px;border:1px solid #999;-webkit-box-shadow:inset 0 0 4px rgba(0,0,0,.5);box-shadow:inset 0 0 4px rgba(0,0,0,.5)}.sceditor-button div,.sceditor-button svg{margin:0}
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/themes/office-toolbar.min.css b/assets/3rdparty/sceditor/themes/office-toolbar.min.css
new file mode 100644
index 00000000..22d6606c
--- /dev/null
+++ b/assets/3rdparty/sceditor/themes/office-toolbar.min.css
@@ -0,0 +1 @@
+/*! SCEditor | (C) 2011-2016, Sam Clarke | sceditor.com/license */.sceditor-button div,div.sceditor-grip{background-image:url(famfamfam.png);background-repeat:no-repeat;width:16px;height:16px}.sceditor-button-youtube div{background-position:0 0}.sceditor-button-link div{background-position:0 -16px}.sceditor-button-unlink div{background-position:0 -32px}.sceditor-button-underline div{background-position:0 -48px}.sceditor-button-time div{background-position:0 -64px}.sceditor-button-table div{background-position:0 -80px}.sceditor-button-superscript div{background-position:0 -96px}.sceditor-button-subscript div{background-position:0 -112px}.sceditor-button-strike div{background-position:0 -128px}.sceditor-button-source div{background-position:0 -144px}.sceditor-button-size div{background-position:0 -160px}.sceditor-button-rtl div{background-position:0 -176px}.sceditor-button-right div{background-position:0 -192px}.sceditor-button-removeformat div{background-position:0 -208px}.sceditor-button-quote div{background-position:0 -224px}.sceditor-button-print div{background-position:0 -240px}.sceditor-button-pastetext div{background-position:0 -256px}.sceditor-button-paste div{background-position:0 -272px}.sceditor-button-outdent div{background-position:0 -288px}.sceditor-button-orderedlist div{background-position:0 -304px}.sceditor-button-maximize div{background-position:0 -320px}.sceditor-button-ltr div{background-position:0 -336px}.sceditor-button-left div{background-position:0 -352px}.sceditor-button-justify div{background-position:0 -368px}.sceditor-button-italic div{background-position:0 -384px}.sceditor-button-indent div{background-position:0 -400px}.sceditor-button-image div{background-position:0 -416px}.sceditor-button-horizontalrule div{background-position:0 -432px}.sceditor-button-format div{background-position:0 -448px}.sceditor-button-font div{background-position:0 -464px}.sceditor-button-emoticon div{background-position:0 -480px}.sceditor-button-email div{background-position:0 -496px}.sceditor-button-date div{background-position:0 -512px}.sceditor-button-cut div{background-position:0 -528px}.sceditor-button-copy div{background-position:0 -544px}.sceditor-button-color div{background-position:0 -560px}.sceditor-button-code div{background-position:0 -576px}.sceditor-button-center div{background-position:0 -592px}.sceditor-button-bulletlist div{background-position:0 -608px}.sceditor-button-bold div{background-position:0 -624px}div.sceditor-grip{background-position:0 -640px}.rtl div.sceditor-grip{background-position:0 -650px;right:auto;left:0}.sceditor-container{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;position:relative;background:padding-box #fff;font-size:13px;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;color:#333;line-height:1;font-weight:700;height:250px;border-radius:4px}.sceditor-container *,.sceditor-container :after,.sceditor-container :before{-webkit-box-sizing:content-box;box-sizing:content-box}.sceditor-container,.sceditor-container div,div.sceditor-dropdown,div.sceditor-dropdown div{padding:0;margin:0;z-index:3}.sceditor-container iframe,.sceditor-container textarea{display:block;-ms-flex:1 1 0%;-webkit-box-flex:1;flex:1 1 0%;line-height:1.25;border:0;outline:0;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;color:#111;padding:0;margin:5px;resize:none;background:#fff;height:auto!important;width:auto!important;width:calc(100% - 10px)!important;min-height:1px}.sceditor-container textarea{margin:7px 5px;font-family:Consolas,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace}div.sceditor-dnd-cover{position:absolute;top:0;left:0;bottom:0;right:0;background:rgba(255,255,255,.2);border:5px dashed #aaa;z-index:200;font-size:2em;text-align:center;color:#aaa}div.sceditor-dnd-cover p{position:relative;top:45%;pointer-events:none}div.sceditor-resize-cover{position:absolute;top:0;left:0;background:#000;width:100%;height:100%;z-index:10;opacity:.3}div.sceditor-grip{overflow:hidden;width:10px;height:10px;cursor:pointer;position:absolute;bottom:0;right:0;z-index:3;line-height:0}div.sceditor-grip.has-icon{background-image:none}.sceditor-maximize{position:fixed;top:0;left:0;height:100%!important;width:100%!important;border-radius:0;background-clip:padding-box;z-index:2000}body.sceditor-maximize,html.sceditor-maximize{height:100%;width:100%;padding:0;margin:0;overflow:hidden}.sceditor-maximize div.sceditor-grip{display:none}.sceditor-maximize div.sceditor-toolbar{border-radius:0;background-clip:padding-box}div.sceditor-dropdown{position:absolute;border:1px solid #ccc;background:padding-box #fff;z-index:4000;padding:10px;font-weight:400;font-size:15px;border-radius:2px;-webkit-box-shadow:1px 2px 4px rgba(0,0,0,.2);box-shadow:1px 2px 4px rgba(0,0,0,.2)}div.sceditor-dropdown *,div.sceditor-dropdown :after,div.sceditor-dropdown :before{-webkit-box-sizing:border-box;box-sizing:border-box}div.sceditor-dropdown a,div.sceditor-dropdown a:link{color:#333}div.sceditor-dropdown form{margin:0}div.sceditor-dropdown label{display:block;font-weight:700;color:#3c3c3c;padding:4px 0}div.sceditor-dropdown input,div.sceditor-dropdown textarea{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;outline:0;padding:4px;border:1px solid #ccc;border-top-color:#888;margin:0 0 .75em;border-radius:1px;background-clip:padding-box}div.sceditor-dropdown textarea{padding:6px}div.sceditor-dropdown input:focus,div.sceditor-dropdown textarea:focus{border-color:#666 #aaa #aaa;-webkit-box-shadow:inset 0 1px 5px rgba(0,0,0,.1);box-shadow:inset 0 1px 5px rgba(0,0,0,.1)}div.sceditor-dropdown .button{font-weight:700;color:#444;padding:6px 12px;background:padding-box #ececec;border:1px solid #ccc;border-radius:2px;cursor:pointer;margin:.3em 0 0}div.sceditor-dropdown .button:hover{background:#f3f3f3;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.15);box-shadow:0 1px 1px rgba(0,0,0,.15)}div.sceditor-font-picker,div.sceditor-fontsize-picker,div.sceditor-format{padding:6px 0}div.sceditor-color-picker{padding:4px}div.sceditor-emoticons,div.sceditor-more-emoticons{padding:0}.sceditor-pastetext textarea{border:1px solid #bbb;width:20em}.sceditor-emoticons img,.sceditor-more-emoticons img{padding:0;cursor:pointer;margin:2px}.sceditor-more{border-top:1px solid #bbb;display:block;text-align:center;cursor:pointer;font-weight:700;padding:6px 0}.sceditor-dropdown a:hover{background:#eee}.sceditor-font-option,.sceditor-fontsize-option,.sceditor-format a{display:block;padding:7px 10px;cursor:pointer;text-decoration:none;color:#222}.sceditor-fontsize-option{padding:7px 13px}.sceditor-color-column{float:left}.sceditor-color-option{display:block;border:2px solid #fff;height:18px;width:18px;overflow:hidden}.sceditor-color-option:hover{border:1px solid #aaa}div.sceditor-toolbar{-ms-flex-negative:0;flex-shrink:0;overflow:hidden;padding:3px 5px 2px;line-height:0;text-align:left;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:3px 3px 0 0}div.sceditor-group{display:inline-block;margin:1px 5px 1px 0;border-bottom:1px solid #aaa;border-radius:3px}.sceditor-button.active,.sceditor-button:active,.sceditor-button:hover{-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2)}.sceditor-button:active{-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3)}.sceditor-button.disabled:hover{background:inherit;cursor:default;-webkit-box-shadow:none;box-shadow:none}.sceditor-button,.sceditor-button div{display:block}.sceditor-button svg{display:inline-block;height:16px;width:16px;fill:#111;text-decoration:none;pointer-events:none;line-height:1}.sceditor-button.disabled svg{fill:#888}.sceditor-button div{display:inline-block;padding:0;overflow:hidden;line-height:0;font-size:0;color:transparent}.sceditor-button.has-icon div{display:none}.sceditor-button.disabled div{opacity:.3}.sceditor-button.text,.sceditor-button.text div,.sceditor-button.text-icon,.sceditor-button.text-icon div,.text .sceditor-button,.text .sceditor-button div,.text-icon .sceditor-button,.text-icon .sceditor-button div{display:inline-block;width:auto;line-height:16px;font-size:1em;color:inherit;text-indent:0}.sceditor-button.has-icon div,.sceditor-button.text div,.text .sceditor-button div,.text-icon .sceditor-button.has-icon div{padding:0 2px;background:0 0}.sceditor-button.text svg,.text .sceditor-button svg{display:none}.sceditor-button.text-icon div,.text-icon .sceditor-button div{padding:0 2px 0 20px}.rtl div.sceditor-toolbar{text-align:right}.rtl .sceditor-button{float:right}.sceditor-container{border:1px solid #8db2e3}div.sceditor-toolbar{border-bottom:1px solid #95a9c3;background:#dee8f5;background:-webkit-gradient(linear,left top,left bottom,from(#dee8f5),color-stop(29%,#c7d8ed),color-stop(61%,#ccdcee),to(#c0d8ef));background:-webkit-linear-gradient(top,#dee8f5 0,#c7d8ed 29%,#ccdcee 61%,#c0d8ef 100%);background:-o-linear-gradient(top,#dee8f5 0,#c7d8ed 29%,#ccdcee 61%,#c0d8ef 100%);background:linear-gradient(to bottom,#dee8f5 0,#c7d8ed 29%,#ccdcee 61%,#c0d8ef 100%)}div.sceditor-group{border:1px solid #7596bf;background:#cadcf0;padding:0;background:-webkit-gradient(linear,left top,left bottom,color-stop(24%,#cadcf0),color-stop(38%,#bcd0e9),color-stop(99%,#d0e1f7));background:-webkit-linear-gradient(top,#cadcf0 24%,#bcd0e9 38%,#d0e1f7 99%);background:-o-linear-gradient(top,#cadcf0 24%,#bcd0e9 38%,#d0e1f7 99%);background:linear-gradient(to bottom,#cadcf0 24%,#bcd0e9 38%,#d0e1f7 99%)}.sceditor-button{float:left;cursor:pointer;width:16px;height:16px;padding:3px 4px;border-radius:0;background-clip:padding-box;-webkit-box-shadow:inset 0 1px #d5e3f1,inset 0 -1px #e3edfb,inset 1px 0 #cddcef,inset -1px 0 #b8ceea;box-shadow:inset 0 1px #d5e3f1,inset 0 -1px #e3edfb,inset 1px 0 #cddcef,inset -1px 0 #b8ceea}.sceditor-button:first-child{border-radius:4px 0 0 4px;background-clip:padding-box}.sceditor-button:last-child{border-radius:0 4px 4px 0;background-clip:padding-box}.sceditor-button div,.sceditor-button svg{margin:0}.sceditor-button.active{background:#fbdbb5;background:-webkit-gradient(linear,left top,left bottom,color-stop(11%,#fbdbb5),color-stop(29%,#feb456),color-stop(99%,#fdeb9f));background:-webkit-linear-gradient(top,#fbdbb5 11%,#feb456 29%,#fdeb9f 99%);background:-o-linear-gradient(top,#fbdbb5 11%,#feb456 29%,#fdeb9f 99%);background:linear-gradient(to bottom,#fbdbb5 11%,#feb456 29%,#fdeb9f 99%);-webkit-box-shadow:inset 0 1px #ebd1b4,inset 0 -1px #ffe47f,inset -1px 0 #b8ceea;box-shadow:inset 0 1px #ebd1b4,inset 0 -1px #ffe47f,inset -1px 0 #b8ceea}.sceditor-button:hover{background:#fef7d5;background:-webkit-gradient(linear,left top,left bottom,from(#fef7d5),color-stop(42%,#fae5a9),color-stop(42%,#ffd048),to(#ffe59f));background:-webkit-linear-gradient(top,#fef7d5 0,#fae5a9 42%,#ffd048 42%,#ffe59f 100%);background:-o-linear-gradient(top,#fef7d5 0,#fae5a9 42%,#ffd048 42%,#ffe59f 100%);background:linear-gradient(to bottom,#fef7d5 0,#fae5a9 42%,#ffd048 42%,#ffe59f 100%);-webkit-box-shadow:inset 0 1px #fffbe8,inset -1px 0 #ffefc4,inset 0 -1px #fff9cc;box-shadow:inset 0 1px #fffbe8,inset -1px 0 #ffefc4,inset 0 -1px #fff9cc}.sceditor-button:active{background:#e7a66d;background:-webkit-gradient(linear,left top,left bottom,from(#e7a66d),color-stop(1%,#fcb16d),color-stop(42%,#ff8d05),to(#ffc450));background:-webkit-linear-gradient(top,#e7a66d 0,#fcb16d 1%,#ff8d05 42%,#ffc450 100%);background:-o-linear-gradient(top,#e7a66d 0,#fcb16d 1%,#ff8d05 42%,#ffc450 100%);background:linear-gradient(to bottom,#e7a66d 0,#fcb16d 1%,#ff8d05 42%,#ffc450 100%);-webkit-box-shadow:inset 0 1px 1px #7b6645,inset 0 -1px #d19c33;box-shadow:inset 0 1px 1px #7b6645,inset 0 -1px #d19c33}.sceditor-button.active:hover{background:#dba368;background:-webkit-gradient(linear,left top,left bottom,from(#dba368),color-stop(4%,#ffbd79),color-stop(34%,#fea335),color-stop(66%,#ffc64c),to(#fee069));background:-webkit-linear-gradient(top,#dba368 0,#ffbd79 4%,#fea335 34%,#ffc64c 66%,#fee069 100%);background:-o-linear-gradient(top,#dba368 0,#ffbd79 4%,#fea335 34%,#ffc64c 66%,#fee069 100%);background:linear-gradient(to bottom,#dba368 0,#ffbd79 4%,#fea335 34%,#ffc64c 66%,#fee069 100%);-webkit-box-shadow:inset 0 1px 1px #9e8255,inset 0 -1px #fcce6b;box-shadow:inset 0 1px 1px #9e8255,inset 0 -1px #fcce6b}
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/themes/office.min.css b/assets/3rdparty/sceditor/themes/office.min.css
new file mode 100644
index 00000000..71f7dea1
--- /dev/null
+++ b/assets/3rdparty/sceditor/themes/office.min.css
@@ -0,0 +1 @@
+/*! SCEditor | (C) 2011-2016, Sam Clarke | sceditor.com/license */.sceditor-button div,div.sceditor-grip{background-image:url(famfamfam.png);background-repeat:no-repeat;width:16px;height:16px}.sceditor-button-youtube div{background-position:0 0}.sceditor-button-link div{background-position:0 -16px}.sceditor-button-unlink div{background-position:0 -32px}.sceditor-button-underline div{background-position:0 -48px}.sceditor-button-time div{background-position:0 -64px}.sceditor-button-table div{background-position:0 -80px}.sceditor-button-superscript div{background-position:0 -96px}.sceditor-button-subscript div{background-position:0 -112px}.sceditor-button-strike div{background-position:0 -128px}.sceditor-button-source div{background-position:0 -144px}.sceditor-button-size div{background-position:0 -160px}.sceditor-button-rtl div{background-position:0 -176px}.sceditor-button-right div{background-position:0 -192px}.sceditor-button-removeformat div{background-position:0 -208px}.sceditor-button-quote div{background-position:0 -224px}.sceditor-button-print div{background-position:0 -240px}.sceditor-button-pastetext div{background-position:0 -256px}.sceditor-button-paste div{background-position:0 -272px}.sceditor-button-outdent div{background-position:0 -288px}.sceditor-button-orderedlist div{background-position:0 -304px}.sceditor-button-maximize div{background-position:0 -320px}.sceditor-button-ltr div{background-position:0 -336px}.sceditor-button-left div{background-position:0 -352px}.sceditor-button-justify div{background-position:0 -368px}.sceditor-button-italic div{background-position:0 -384px}.sceditor-button-indent div{background-position:0 -400px}.sceditor-button-image div{background-position:0 -416px}.sceditor-button-horizontalrule div{background-position:0 -432px}.sceditor-button-format div{background-position:0 -448px}.sceditor-button-font div{background-position:0 -464px}.sceditor-button-emoticon div{background-position:0 -480px}.sceditor-button-email div{background-position:0 -496px}.sceditor-button-date div{background-position:0 -512px}.sceditor-button-cut div{background-position:0 -528px}.sceditor-button-copy div{background-position:0 -544px}.sceditor-button-color div{background-position:0 -560px}.sceditor-button-code div{background-position:0 -576px}.sceditor-button-center div{background-position:0 -592px}.sceditor-button-bulletlist div{background-position:0 -608px}.sceditor-button-bold div{background-position:0 -624px}div.sceditor-grip{background-position:0 -640px}.rtl div.sceditor-grip{background-position:0 -650px;right:auto;left:0}.sceditor-container{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;position:relative;font-size:13px;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;color:#333;line-height:1;font-weight:700;height:250px;border-radius:4px}.sceditor-container *,.sceditor-container :after,.sceditor-container :before{-webkit-box-sizing:content-box;box-sizing:content-box}.sceditor-container,.sceditor-container div,div.sceditor-dropdown,div.sceditor-dropdown div{padding:0;margin:0;z-index:3}.sceditor-container iframe,.sceditor-container textarea{display:block;-ms-flex:1 1 0%;-webkit-box-flex:1;flex:1 1 0%;line-height:1.25;outline:0;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;color:#111;resize:none;height:auto!important;width:auto!important;min-height:1px}div.sceditor-dnd-cover{position:absolute;top:0;left:0;bottom:0;right:0;background:rgba(255,255,255,.2);border:5px dashed #aaa;z-index:200;font-size:2em;text-align:center;color:#aaa}div.sceditor-dnd-cover p{position:relative;top:45%;pointer-events:none}div.sceditor-resize-cover{position:absolute;top:0;left:0;background:#000;width:100%;height:100%;z-index:10;opacity:.3}div.sceditor-grip{overflow:hidden;width:10px;height:10px;cursor:pointer;position:absolute;bottom:0;right:0;z-index:3;line-height:0}div.sceditor-grip.has-icon{background-image:none}.sceditor-maximize{position:fixed;top:0;left:0;height:100%!important;width:100%!important;border-radius:0;background-clip:padding-box;z-index:2000}body.sceditor-maximize,html.sceditor-maximize{height:100%;width:100%;padding:0;margin:0;overflow:hidden}.sceditor-maximize div.sceditor-grip{display:none}.sceditor-maximize div.sceditor-toolbar{border-radius:0;background-clip:padding-box}div.sceditor-dropdown{position:absolute;border:1px solid #ccc;background:padding-box #fff;z-index:4000;padding:10px;font-weight:400;font-size:15px;border-radius:2px;-webkit-box-shadow:1px 2px 4px rgba(0,0,0,.2);box-shadow:1px 2px 4px rgba(0,0,0,.2)}div.sceditor-dropdown *,div.sceditor-dropdown :after,div.sceditor-dropdown :before{-webkit-box-sizing:border-box;box-sizing:border-box}div.sceditor-dropdown a,div.sceditor-dropdown a:link{color:#333}div.sceditor-dropdown form{margin:0}div.sceditor-dropdown label{display:block;font-weight:700;color:#3c3c3c;padding:4px 0}div.sceditor-dropdown input,div.sceditor-dropdown textarea{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;outline:0;padding:4px;border:1px solid #ccc;border-top-color:#888;margin:0 0 .75em;border-radius:1px;background-clip:padding-box}div.sceditor-dropdown textarea{padding:6px}div.sceditor-dropdown input:focus,div.sceditor-dropdown textarea:focus{border-color:#666 #aaa #aaa;-webkit-box-shadow:inset 0 1px 5px rgba(0,0,0,.1);box-shadow:inset 0 1px 5px rgba(0,0,0,.1)}div.sceditor-dropdown .button{font-weight:700;color:#444;padding:6px 12px;background:padding-box #ececec;border:1px solid #ccc;border-radius:2px;cursor:pointer;margin:.3em 0 0}div.sceditor-dropdown .button:hover{background:#f3f3f3;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.15);box-shadow:0 1px 1px rgba(0,0,0,.15)}div.sceditor-font-picker,div.sceditor-fontsize-picker,div.sceditor-format{padding:6px 0}div.sceditor-color-picker{padding:4px}div.sceditor-emoticons,div.sceditor-more-emoticons{padding:0}.sceditor-pastetext textarea{border:1px solid #bbb;width:20em}.sceditor-emoticons img,.sceditor-more-emoticons img{padding:0;cursor:pointer;margin:2px}.sceditor-more{border-top:1px solid #bbb;display:block;text-align:center;cursor:pointer;font-weight:700;padding:6px 0}.sceditor-dropdown a:hover{background:#eee}.sceditor-font-option,.sceditor-fontsize-option,.sceditor-format a{display:block;padding:7px 10px;cursor:pointer;text-decoration:none;color:#222}.sceditor-fontsize-option{padding:7px 13px}.sceditor-color-column{float:left}.sceditor-color-option{display:block;border:2px solid #fff;height:18px;width:18px;overflow:hidden}.sceditor-color-option:hover{border:1px solid #aaa}div.sceditor-toolbar{-ms-flex-negative:0;flex-shrink:0;overflow:hidden;padding:3px 5px 2px;line-height:0;text-align:left;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:3px 3px 0 0}div.sceditor-group{display:inline-block;margin:1px 5px 1px 0;border-bottom:1px solid #aaa;border-radius:3px}.sceditor-button.active,.sceditor-button:active,.sceditor-button:hover{-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2)}.sceditor-button:active{-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3)}.sceditor-button.disabled:hover{background:inherit;cursor:default;-webkit-box-shadow:none;box-shadow:none}.sceditor-button,.sceditor-button div{display:block}.sceditor-button svg{display:inline-block;height:16px;width:16px;fill:#111;text-decoration:none;pointer-events:none;line-height:1}.sceditor-button.disabled svg{fill:#888}.sceditor-button div{display:inline-block;padding:0;overflow:hidden;line-height:0;font-size:0;color:transparent}.sceditor-button.has-icon div{display:none}.sceditor-button.disabled div{opacity:.3}.sceditor-button.text,.sceditor-button.text div,.sceditor-button.text-icon,.sceditor-button.text-icon div,.text .sceditor-button,.text .sceditor-button div,.text-icon .sceditor-button,.text-icon .sceditor-button div{display:inline-block;width:auto;line-height:16px;font-size:1em;color:inherit;text-indent:0}.sceditor-button.has-icon div,.sceditor-button.text div,.text .sceditor-button div,.text-icon .sceditor-button.has-icon div{padding:0 2px;background:0 0}.sceditor-button.text svg,.text .sceditor-button svg{display:none}.sceditor-button.text-icon div,.text-icon .sceditor-button div{padding:0 2px 0 20px}.rtl div.sceditor-toolbar{text-align:right}.rtl .sceditor-button{float:right}.sceditor-container{border:1px solid #8db2e3}.sceditor-container textarea{font-family:Consolas,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace}div.sceditor-toolbar{border-bottom:1px solid #95a9c3;background:#dee8f5;background:-webkit-gradient(linear,left top,left bottom,from(#dee8f5),color-stop(29%,#c7d8ed),color-stop(61%,#ccdcee),to(#c0d8ef));background:-webkit-linear-gradient(top,#dee8f5 0,#c7d8ed 29%,#ccdcee 61%,#c0d8ef 100%);background:-o-linear-gradient(top,#dee8f5 0,#c7d8ed 29%,#ccdcee 61%,#c0d8ef 100%);background:linear-gradient(to bottom,#dee8f5 0,#c7d8ed 29%,#ccdcee 61%,#c0d8ef 100%)}div.sceditor-group{border:1px solid #7596bf;background:#cadcf0;padding:0;background:-webkit-gradient(linear,left top,left bottom,color-stop(24%,#cadcf0),color-stop(38%,#bcd0e9),color-stop(99%,#d0e1f7));background:-webkit-linear-gradient(top,#cadcf0 24%,#bcd0e9 38%,#d0e1f7 99%);background:-o-linear-gradient(top,#cadcf0 24%,#bcd0e9 38%,#d0e1f7 99%);background:linear-gradient(to bottom,#cadcf0 24%,#bcd0e9 38%,#d0e1f7 99%)}.sceditor-button{float:left;cursor:pointer;width:16px;height:16px;padding:3px 4px;border-radius:0;background-clip:padding-box;-webkit-box-shadow:inset 0 1px #d5e3f1,inset 0 -1px #e3edfb,inset 1px 0 #cddcef,inset -1px 0 #b8ceea;box-shadow:inset 0 1px #d5e3f1,inset 0 -1px #e3edfb,inset 1px 0 #cddcef,inset -1px 0 #b8ceea}.sceditor-button:first-child{border-radius:4px 0 0 4px;background-clip:padding-box}.sceditor-button:last-child{border-radius:0 4px 4px 0;background-clip:padding-box}.sceditor-button div,.sceditor-button svg{margin:0}.sceditor-button.active{background:#fbdbb5;background:-webkit-gradient(linear,left top,left bottom,color-stop(11%,#fbdbb5),color-stop(29%,#feb456),color-stop(99%,#fdeb9f));background:-webkit-linear-gradient(top,#fbdbb5 11%,#feb456 29%,#fdeb9f 99%);background:-o-linear-gradient(top,#fbdbb5 11%,#feb456 29%,#fdeb9f 99%);background:linear-gradient(to bottom,#fbdbb5 11%,#feb456 29%,#fdeb9f 99%);-webkit-box-shadow:inset 0 1px #ebd1b4,inset 0 -1px #ffe47f,inset -1px 0 #b8ceea;box-shadow:inset 0 1px #ebd1b4,inset 0 -1px #ffe47f,inset -1px 0 #b8ceea}.sceditor-button:hover{background:#fef7d5;background:-webkit-gradient(linear,left top,left bottom,from(#fef7d5),color-stop(42%,#fae5a9),color-stop(42%,#ffd048),to(#ffe59f));background:-webkit-linear-gradient(top,#fef7d5 0,#fae5a9 42%,#ffd048 42%,#ffe59f 100%);background:-o-linear-gradient(top,#fef7d5 0,#fae5a9 42%,#ffd048 42%,#ffe59f 100%);background:linear-gradient(to bottom,#fef7d5 0,#fae5a9 42%,#ffd048 42%,#ffe59f 100%);-webkit-box-shadow:inset 0 1px #fffbe8,inset -1px 0 #ffefc4,inset 0 -1px #fff9cc;box-shadow:inset 0 1px #fffbe8,inset -1px 0 #ffefc4,inset 0 -1px #fff9cc}.sceditor-button:active{background:#e7a66d;background:-webkit-gradient(linear,left top,left bottom,from(#e7a66d),color-stop(1%,#fcb16d),color-stop(42%,#ff8d05),to(#ffc450));background:-webkit-linear-gradient(top,#e7a66d 0,#fcb16d 1%,#ff8d05 42%,#ffc450 100%);background:-o-linear-gradient(top,#e7a66d 0,#fcb16d 1%,#ff8d05 42%,#ffc450 100%);background:linear-gradient(to bottom,#e7a66d 0,#fcb16d 1%,#ff8d05 42%,#ffc450 100%);-webkit-box-shadow:inset 0 1px 1px #7b6645,inset 0 -1px #d19c33;box-shadow:inset 0 1px 1px #7b6645,inset 0 -1px #d19c33}.sceditor-button.active:hover{background:#dba368;background:-webkit-gradient(linear,left top,left bottom,from(#dba368),color-stop(4%,#ffbd79),color-stop(34%,#fea335),color-stop(66%,#ffc64c),to(#fee069));background:-webkit-linear-gradient(top,#dba368 0,#ffbd79 4%,#fea335 34%,#ffc64c 66%,#fee069 100%);background:-o-linear-gradient(top,#dba368 0,#ffbd79 4%,#fea335 34%,#ffc64c 66%,#fee069 100%);background:linear-gradient(to bottom,#dba368 0,#ffbd79 4%,#fea335 34%,#ffc64c 66%,#fee069 100%);-webkit-box-shadow:inset 0 1px 1px #9e8255,inset 0 -1px #fcce6b;box-shadow:inset 0 1px 1px #9e8255,inset 0 -1px #fcce6b}.sceditor-container{background:#a3c2ea;background:-webkit-gradient(linear,left top,left bottom,from(#a3c2ea),color-stop(39%,#6d92c1),color-stop(64%,#577fb3),to(#6591cc));background:-webkit-linear-gradient(top,#a3c2ea 0,#6d92c1 39%,#577fb3 64%,#6591cc 100%);background:-o-linear-gradient(top,#a3c2ea 0,#6d92c1 39%,#577fb3 64%,#6591cc 100%);background:linear-gradient(to bottom,#a3c2ea 0,#6d92c1 39%,#577fb3 64%,#6591cc 100%)}.sceditor-container iframe,.sceditor-container textarea{border:1px solid #646464;background:#fff;margin:7px 40px;padding:20px;width:calc(100% - 120px)!important;-webkit-box-shadow:1px 1px 5px #293a52;box-shadow:1px 1px 5px #293a52}
\ No newline at end of file
diff --git a/assets/3rdparty/sceditor/themes/square.min.css b/assets/3rdparty/sceditor/themes/square.min.css
new file mode 100644
index 00000000..0b67f7d2
--- /dev/null
+++ b/assets/3rdparty/sceditor/themes/square.min.css
@@ -0,0 +1 @@
+/*! SCEditor | (C) 2011-2016, Sam Clarke | sceditor.com/license */.sceditor-button div,div.sceditor-grip{background-image:url(famfamfam.png);background-repeat:no-repeat;width:16px;height:16px}.sceditor-button-youtube div{background-position:0 0}.sceditor-button-link div{background-position:0 -16px}.sceditor-button-unlink div{background-position:0 -32px}.sceditor-button-underline div{background-position:0 -48px}.sceditor-button-time div{background-position:0 -64px}.sceditor-button-table div{background-position:0 -80px}.sceditor-button-superscript div{background-position:0 -96px}.sceditor-button-subscript div{background-position:0 -112px}.sceditor-button-strike div{background-position:0 -128px}.sceditor-button-source div{background-position:0 -144px}.sceditor-button-size div{background-position:0 -160px}.sceditor-button-rtl div{background-position:0 -176px}.sceditor-button-right div{background-position:0 -192px}.sceditor-button-removeformat div{background-position:0 -208px}.sceditor-button-quote div{background-position:0 -224px}.sceditor-button-print div{background-position:0 -240px}.sceditor-button-pastetext div{background-position:0 -256px}.sceditor-button-paste div{background-position:0 -272px}.sceditor-button-outdent div{background-position:0 -288px}.sceditor-button-orderedlist div{background-position:0 -304px}.sceditor-button-maximize div{background-position:0 -320px}.sceditor-button-ltr div{background-position:0 -336px}.sceditor-button-left div{background-position:0 -352px}.sceditor-button-justify div{background-position:0 -368px}.sceditor-button-italic div{background-position:0 -384px}.sceditor-button-indent div{background-position:0 -400px}.sceditor-button-image div{background-position:0 -416px}.sceditor-button-horizontalrule div{background-position:0 -432px}.sceditor-button-format div{background-position:0 -448px}.sceditor-button-font div{background-position:0 -464px}.sceditor-button-emoticon div{background-position:0 -480px}.sceditor-button-email div{background-position:0 -496px}.sceditor-button-date div{background-position:0 -512px}.sceditor-button-cut div{background-position:0 -528px}.sceditor-button-copy div{background-position:0 -544px}.sceditor-button-color div{background-position:0 -560px}.sceditor-button-code div{background-position:0 -576px}.sceditor-button-center div{background-position:0 -592px}.sceditor-button-bulletlist div{background-position:0 -608px}.sceditor-button-bold div{background-position:0 -624px}div.sceditor-grip{background-position:0 -640px}.rtl div.sceditor-grip{background-position:0 -650px;right:auto;left:0}.sceditor-container{display:-ms-flexbox;display:-webkit-box;display:flex;-ms-flex-direction:column;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;position:relative;background:padding-box #fff;font-size:13px;font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;color:#333;line-height:1;font-weight:700;height:250px}.sceditor-container *,.sceditor-container :after,.sceditor-container :before{-webkit-box-sizing:content-box;box-sizing:content-box}.sceditor-container,.sceditor-container div,div.sceditor-dropdown,div.sceditor-dropdown div{padding:0;margin:0;z-index:3}.sceditor-container iframe,.sceditor-container textarea{display:block;-ms-flex:1 1 0%;-webkit-box-flex:1;flex:1 1 0%;line-height:1.25;border:0;outline:0;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:14px;color:#111;padding:0;margin:5px;resize:none;background:#fff;height:auto!important;width:auto!important;width:calc(100% - 10px)!important;min-height:1px}div.sceditor-dnd-cover{position:absolute;top:0;left:0;bottom:0;right:0;background:rgba(255,255,255,.2);border:5px dashed #aaa;z-index:200;font-size:2em;text-align:center;color:#aaa}div.sceditor-dnd-cover p{position:relative;top:45%;pointer-events:none}div.sceditor-resize-cover{position:absolute;top:0;left:0;background:#000;width:100%;height:100%;z-index:10;opacity:.3}div.sceditor-grip{overflow:hidden;width:10px;height:10px;cursor:pointer;position:absolute;bottom:0;right:0;z-index:3;line-height:0}div.sceditor-grip.has-icon{background-image:none}.sceditor-maximize{position:fixed;top:0;left:0;height:100%!important;width:100%!important;border-radius:0;background-clip:padding-box;z-index:2000}body.sceditor-maximize,html.sceditor-maximize{height:100%;width:100%;padding:0;margin:0;overflow:hidden}.sceditor-maximize div.sceditor-grip{display:none}.sceditor-maximize div.sceditor-toolbar{border-radius:0;background-clip:padding-box}div.sceditor-dropdown{position:absolute;border:1px solid #ccc;background:padding-box #fff;z-index:4000;padding:10px;font-weight:400;font-size:15px;border-radius:2px;-webkit-box-shadow:1px 2px 4px rgba(0,0,0,.2);box-shadow:1px 2px 4px rgba(0,0,0,.2)}div.sceditor-dropdown *,div.sceditor-dropdown :after,div.sceditor-dropdown :before{-webkit-box-sizing:border-box;box-sizing:border-box}div.sceditor-dropdown a,div.sceditor-dropdown a:link{color:#333}div.sceditor-dropdown form{margin:0}div.sceditor-dropdown label{display:block;font-weight:700;color:#3c3c3c;padding:4px 0}div.sceditor-dropdown input,div.sceditor-dropdown textarea{font-family:Arial,"Helvetica Neue",Helvetica,sans-serif;outline:0;padding:4px;border:1px solid #ccc;border-top-color:#888;margin:0 0 .75em;border-radius:1px;background-clip:padding-box}div.sceditor-dropdown textarea{padding:6px}div.sceditor-dropdown input:focus,div.sceditor-dropdown textarea:focus{border-color:#666 #aaa #aaa;-webkit-box-shadow:inset 0 1px 5px rgba(0,0,0,.1);box-shadow:inset 0 1px 5px rgba(0,0,0,.1)}div.sceditor-dropdown .button{font-weight:700;color:#444;padding:6px 12px;background:padding-box #ececec;border:1px solid #ccc;border-radius:2px;cursor:pointer;margin:.3em 0 0}div.sceditor-dropdown .button:hover{background:#f3f3f3;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.15);box-shadow:0 1px 1px rgba(0,0,0,.15)}div.sceditor-font-picker,div.sceditor-fontsize-picker,div.sceditor-format{padding:6px 0}div.sceditor-color-picker{padding:4px}div.sceditor-emoticons,div.sceditor-more-emoticons{padding:0}.sceditor-pastetext textarea{border:1px solid #bbb;width:20em}.sceditor-emoticons img,.sceditor-more-emoticons img{padding:0;cursor:pointer;margin:2px}.sceditor-more{border-top:1px solid #bbb;display:block;text-align:center;cursor:pointer;font-weight:700;padding:6px 0}.sceditor-dropdown a:hover{background:#eee}.sceditor-font-option,.sceditor-fontsize-option,.sceditor-format a{display:block;padding:7px 10px;cursor:pointer;text-decoration:none;color:#222}.sceditor-fontsize-option{padding:7px 13px}.sceditor-color-column{float:left}.sceditor-color-option{display:block;border:2px solid #fff;height:18px;width:18px;overflow:hidden}.sceditor-color-option:hover{border:1px solid #aaa}div.sceditor-toolbar{-ms-flex-negative:0;flex-shrink:0;overflow:hidden;line-height:0;text-align:left;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:3px 3px 0 0}div.sceditor-group{display:inline-block;border-bottom:1px solid #aaa}.sceditor-button.active,.sceditor-button:active,.sceditor-button:hover{-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2)}.sceditor-button:active{-webkit-box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3);box-shadow:inset 1px 1px 0 rgba(0,0,0,.3),inset -1px 0 rgba(0,0,0,.3),inset 0 -1px 0 rgba(0,0,0,.2),inset 0 0 8px rgba(0,0,0,.3)}.sceditor-button.disabled:hover{background:inherit;cursor:default;-webkit-box-shadow:none;box-shadow:none}.sceditor-button,.sceditor-button div{display:block}.sceditor-button svg{display:inline-block;height:16px;width:16px;fill:#111;text-decoration:none;pointer-events:none;line-height:1}.sceditor-button.disabled svg{fill:#888}.sceditor-button div{display:inline-block;padding:0;overflow:hidden;line-height:0;font-size:0;color:transparent}.sceditor-button.has-icon div{display:none}.sceditor-button.disabled div{opacity:.3}.sceditor-button.text,.sceditor-button.text div,.sceditor-button.text-icon,.sceditor-button.text-icon div,.text .sceditor-button,.text .sceditor-button div,.text-icon .sceditor-button,.text-icon .sceditor-button div{display:inline-block;width:auto;line-height:16px;font-size:1em;color:inherit;text-indent:0}.sceditor-button.has-icon div,.sceditor-button.text div,.text .sceditor-button div,.text-icon .sceditor-button.has-icon div{padding:0 2px;background:0 0}.sceditor-button.text svg,.text .sceditor-button svg{display:none}.sceditor-button.text-icon div,.text-icon .sceditor-button div{padding:0 2px 0 20px}.rtl div.sceditor-toolbar{text-align:right}.rtl .sceditor-button{float:right}.sceditor-container{border:1px solid #d6d6d6;border-radius:0;background-clip:padding-box}.sceditor-container textarea{font-family:Consolas,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace;background:#2e3436;color:#fff;margin:0;padding:5px}div.sceditor-group,div.sceditor-toolbar{background:#f2f2f2;background:-webkit-gradient(linear,left top,left bottom,from(#f2f2f2),color-stop(89%,#ddd));background:-webkit-linear-gradient(top,#f2f2f2 0,#ddd 89%);background:-o-linear-gradient(top,#f2f2f2 0,#ddd 89%);background:linear-gradient(to bottom,#f2f2f2 0,#ddd 89%)}div.sceditor-toolbar{padding:0;border-bottom:1px solid #bbb;background-size:100% 32px}div.sceditor-group{margin:0;padding:2px 4px;border:0;border-right:1px solid #ccc;border-left:1px solid #eaeaea;border-radius:0;background-clip:padding-box}div.sceditor-group:last-child{border-right:0}div.sceditor-group:first-child{border-left:0}.sceditor-button{float:left;cursor:pointer;width:16px;height:16px;padding:5px;margin:1px;border-radius:0;background-clip:padding-box}.sceditor-button div,.sceditor-button svg{margin:0}.sceditor-button.active,.sceditor-button.active:hover,.sceditor-button:active,.sceditor-button:hover{margin:0;-webkit-box-shadow:none;box-shadow:none}.sceditor-button.active{background:#f4f4f4;border:1px solid #ccc}.sceditor-button:hover{background:#fefefe;border:1px solid #ddd}.sceditor-button.disabled:hover{margin:1px;border:0}.sceditor-button:active{background:#eee;border:1px solid #ccc}.sceditor-button.active:hover{background:#f8f8f8;border:1px solid #ddd}
\ No newline at end of file
diff --git a/assets/js/common/utils.js b/assets/js/common/utils.js
index 8ee9effc..cd6d578d 100644
--- a/assets/js/common/utils.js
+++ b/assets/js/common/utils.js
@@ -416,6 +416,10 @@ function checkString(value){
*/
function removeHtmlTags(input){
+ //Check if input string is empty
+ if(input == null)
+ return "";
+
//Prepare update
var output = input;
@@ -435,6 +439,25 @@ function removeHtmlTags(input){
return output;
}
+/**
+ * Replace all line break with paragraph tags
+ *
+ * @param {string} input Input string to convert
+ * @return {string} Generated string
+ */
+function lineBreakToPTags(input){
+
+ //Check if the string is empty
+ if(input == null || input == "")
+ return input;
+
+ //Change string
+ while(input.includes("\n"))
+ input = input.replace("\n", "");
+
+ return "
"+input+"
";
+}
+
/**
* Check a URL validity
*
diff --git a/assets/js/components/posts/edit.js b/assets/js/components/posts/edit.js
index 1f287a81..e4a33336 100644
--- a/assets/js/components/posts/edit.js
+++ b/assets/js/components/posts/edit.js
@@ -106,13 +106,19 @@ ComunicWeb.components.posts.edit = {
});
//Create update editor
- var editorDiv = createElem2({
+ var editorTextarea = createElem2({
appendTo: updateDiv,
- type: "div",
+ type: "textarea",
class: "editor",
- innerHTML: infos.content
+ value: infos.content
+ });
+
+ sceditor.create(editorTextarea, {
+ format: 'bbcode',
+ height: "200px",
+ width: "100%",
+ toolbarExclude: "youtube,image,size,link"
});
- $(editorDiv).wysiwyg();
//Create function to close modal
var closeModal = function(){
@@ -131,7 +137,7 @@ ComunicWeb.components.posts.edit = {
}
//Get the new post content
- var new_content = editorDiv.innerHTML;
+ var new_content = sceditor.instance(editorTextarea).getWysiwygEditorValue();
//Check the new post content
if(!ComunicWeb.components.posts.form._check_message(new_content)){
diff --git a/assets/js/components/posts/form.js b/assets/js/components/posts/form.js
index bffb3425..ee7580b5 100644
--- a/assets/js/components/posts/form.js
+++ b/assets/js/components/posts/form.js
@@ -42,18 +42,35 @@ ComunicWeb.components.posts.form = {
});
//Create post message textarea
- var inputMessageDiv = createElem2({
+ var inputMessageTextarea = createElem2({
appendTo: newPostMessageContener,
- type: "div",
- class: "new-message wdt-emoji-bundle-enabled",
+ type: "textarea",
+ class: "new-message",
innerHTML: ""
});
- //Enable bootstrap-wysiwyg
- $(inputMessageDiv).wysiwyg();
+ var inputMessageToolbarTarget = createElem2({
+ appendTo: newPostMessageContener,
+ type: "div"
+ });
+
+ sceditor.create(inputMessageTextarea, {
+ format: 'bbcode',
+ height: "200px",
+ width: "100%",
+ toolbar: 'bold,italic,underline,subscript,superscript|' +
+ 'left,center,right,justify|color|' +
+ 'bulletlist,orderedlist|table,code,quote|source',
+ toolbarContainer: inputMessageToolbarTarget
+ });
//Enable emojies picker
- ComunicWeb.components.emoji.picker.addPicker(inputMessageDiv);
+ ComunicWeb.components.emoji.picker.addDetachedPicker(newPostMessageContener, (emojie) => {
+
+ //Append new emojie to the instance
+ sceditor.instance(inputMessageTextarea).insertText(emojie);
+
+ });
//Add the different post types
@@ -344,7 +361,7 @@ ComunicWeb.components.posts.form = {
var datas = new FormData();
//Get the message content
- var message_content = inputMessageDiv.innerHTML;
+ var message_content = sceditor.instance(inputMessageTextarea).getWysiwygEditorValue();
datas.append("content", message_content);
//Check if the message includes an image
diff --git a/assets/js/components/posts/ui.js b/assets/js/components/posts/ui.js
index eaf51e58..f0fa71e3 100644
--- a/assets/js/components/posts/ui.js
+++ b/assets/js/components/posts/ui.js
@@ -826,7 +826,7 @@ ComunicWeb.components.posts.ui = {
appendTo: postRoot,
type: "div",
class: "post_content",
- innerHTML: removeJavascriptEventsFromHTML(info.content)
+ innerHTML: lineBreakToPTags(BBCodeParser.process(removeHtmlTags(info.content)))
});
//Parse emojies
diff --git a/system/config/dev.config.php b/system/config/dev.config.php
index fbff00c2..715ec177 100644
--- a/system/config/dev.config.php
+++ b/system/config/dev.config.php
@@ -73,6 +73,9 @@ class Dev {
//Emoji picker
"3rdparty/wdt-emoji/wdt-emoji-bundle.css",
+
+ //SCEditor (BBCode editor)
+ "3rdparty/sceditor/themes/default.min.css"
);
/**
@@ -146,6 +149,15 @@ class Dev {
//JSZip utils
"3rdparty/jszip-utils/jszip-utils.js",
+
+ //SCEditor (BBCode editor)
+ "3rdparty/sceditor/sceditor.min.js",
+ "3rdparty/sceditor/formats/bbcode.js",
+ "3rdparty/sceditor/formats/xhtml.js",
+
+ //JS BBCode Parser
+ "3rdparty/js-bbcode-parser/bbcode-config.js",
+ "3rdparty/js-bbcode-parser/bbcode-parser.js",
);
/**