From: Alexander Ebert Date: Sun, 15 Jan 2017 18:05:32 +0000 (+0100) Subject: Upgraded to Redactor II 1.4.0 X-Git-Tag: 3.0.1~39 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e3397eb91bca999b6318d357bca2bb06a5464aed;p=GitHub%2FWoltLab%2FWCF.git Upgraded to Redactor II 1.4.0 --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js index 3c2f869810..e35da6c437 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js @@ -1,11 +1,11 @@ /* Redactor II - Version 1.3.2 - Updated: November 15, 2016 + Version 1.4 + Updated: January 11, 2017 http://imperavi.com/redactor/ - Copyright (c) 2009-2016, Imperavi Oy. + Copyright (c) 2009-2016, Imperavi LLC. License: http://imperavi.com/redactor/license/ Usage: $('#content').redactor(); @@ -101,7 +101,7 @@ // Options $.Redactor = Redactor; - $.Redactor.VERSION = '1.3.2'; + $.Redactor.VERSION = '1.4'; $.Redactor.modules = ['air', 'autosave', 'block', 'buffer', 'build', 'button', 'caret', 'clean', 'code', 'core', 'detect', 'dropdown', 'events', 'file', 'focus', 'image', 'indent', 'inline', 'insert', 'keydown', 'keyup', 'lang', 'line', 'link', 'linkify', 'list', 'marker', 'modal', 'observe', 'offset', 'paragraphize', 'paste', 'placeholder', @@ -119,6 +119,7 @@ direction: 'ltr', spellcheck: true, overrideStyles: true, + scrollTarget: document, focus: false, focusEnd: false, @@ -206,6 +207,7 @@ buttonsHideOnMobile: [], script: true, + removeNewlines: false, removeComments: true, replaceTags: { 'b': 'strong', @@ -699,6 +701,7 @@ this.$air.fadeOut(100); this.air.enabled = false; $(document).off('mousedown.redactor-air.' + this.uuid); + $(document).off('keydown.redactor-air.' + this.uuid); } }; @@ -844,7 +847,27 @@ tag = 'p'; } - var replaced = this.utils.replaceToTag(block, tag); + var replaced; + if (currentTag === 'blockquote' && this.utils.isEndOfElement(block)) + { + this.marker.remove(); + + replaced = document.createElement('p'); + replaced.innerHTML = this.opts.invisibleSpace; + + $(block).after(replaced); + this.caret.start(replaced); + var $last = $(block).children().last(); + + if ($last.length !== 0 && $last[0].tagName === 'BR') + { + $last.remove(); + } + } + else + { + replaced = this.utils.replaceToTag(block, tag); + } if (typeof attr === 'object') { @@ -866,7 +889,6 @@ $(replaced).html($.trim($(replaced).html())); } - this.selection.restore(); this.block.removeInlineTags(replaced); @@ -888,7 +910,6 @@ for (var i = 0; i < len; i++) { var currentTag = blocks[i].tagName.toLowerCase(); - if ($.inArray(currentTag, this.block.tags) !== -1 && currentTag !== 'figure') { var block = this.utils.replaceToTag(blocks[i], tag); @@ -2411,8 +2432,8 @@ html = html.replace(//gi, ''); // save markers - html = html.replace(/]?)id="selection-marker-1"(.*?[^>]?)>​<\/span>/gi, '[[[marker1]]]'); - html = html.replace(/]?)id="selection-marker-2"(.*?[^>]?)>​<\/span>/gi, '[[[marker2]]]'); + html = html.replace(/]?)>​<\/span>/gi, '###marker1###'); + html = html.replace(/]?)>​<\/span>/gi, '###marker2###'); // replace tags var self = this; @@ -2428,6 +2449,9 @@ }); } + // add span marker + $div.find('span').attr('data-redactor-span', true); + html = $div.html(); // remove tags @@ -2449,8 +2473,8 @@ html = this.paragraphize.load(html); // restore markers - html = html.replace('[[[marker1]]]', '​'); - html = html.replace('[[[marker2]]]', '​'); + html = html.replace('###marker1###', '​'); + html = html.replace('###marker2###', '​'); // empty if (html.search(/^(||\s|||| )$/i) !== -1) @@ -2476,7 +2500,6 @@ return ''; } - // remove image resize html = html.replace(/])>([\w\W]*?)<\/span>/gi, '$3'); html = html.replace(/])>(.*?)<\/span>/gi, ''); @@ -2496,8 +2519,8 @@ $(this).contents().unwrap(); }); - // remove span without attributes - $div.find('span').each(function() + // remove span without attributes & span marker + $div.find('span').removeAttr('data-redactor-span').each(function() { if (this.attributes.length === 0) { @@ -2526,7 +2549,6 @@ html = html.replace(new RegExp('', 'gi'), ''); html = html.replace(new RegExp('', 'gi'), ''); - // pre class html = html.replace(/
/gi, "
\n");
 					if (this.opts.preClass)
@@ -2563,6 +2585,13 @@
 					// remove new lines
                     html = html.replace(/\n{2,}/g, "\n");
 
+                    // remove all newlines
+                    if (this.opts.removeNewlines)
+                    {
+                        html = html.replace(/\n/g, "");
+                        html = html.replace(/\r\n/g, "");
+                    }
+
 					return html;
 				},
 				onPaste: function(html, data, insert)
@@ -2606,10 +2635,8 @@
 					// if paste event
 					if (insert !== true)
 					{
-						html = this.clean.removeSpans(html);
 						html = this.clean.removeEmptyInlineTags(html);
 
-
 						if (data.encode === false)
 						{
 							html = html.replace(/&/g, '&');
@@ -2742,18 +2769,41 @@
 				removeEmptyInlineTags: function(html)
 				{
 					var tags = this.opts.inlineTags;
-					var len = tags.length;
-					for (var i = 0; i < len; i++)
+    				var $div = $("
").html($.parseHTML(html, document, true)); + var self = this; + + var $spans = $div.find('span'); + var $tags = $div.find(tags.join(',')); + + $tags.removeAttr('style'); + + $tags.each(function() { - html = html.replace(new RegExp('<' + tags[i] + '[^>]*>(\s\n|\t)?', 'gi'), ''); - } + var tagHtml = $(this).html(); + if (this.attributes.length === 0 && self.utils.isEmpty(tagHtml)) + { + $(this).replaceWith(function() + { + return $(this).contents(); + }); + } + }); - return html; - }, - removeSpans: function(html) - { - html = html.replace(/<\/span>/gi, ''); - html = html.replace(/]*>/gi, ''); + $spans.each(function() + { + var tagHtml = $(this).html(); + if (this.attributes.length === 0) + { + $(this).replaceWith(function() + { + return $(this).contents(); + }); + } + }); + + html = $div.html(); + + $div.remove(); return html; }, @@ -2917,6 +2967,10 @@ { html = html.replace(new RegExp('<' + tags[i] + '(.*?[^>])((colspan|rowspan)="(.*?[^>])")?(.*?[^>])>', 'gi'), '###' + tags[i] + ' $2###'); } + else if (tags[i] === 'span') + { + html = html.replace(new RegExp('<' + tags[i] + '(.*?[^>])(class="(.*?[^>])")?(.*?[^>])>', 'gi'), '###' + tags[i] + ' $2###'); + } else { html = html.replace(new RegExp('<' + tags[i] + '[^>]*>', 'gi'), '###' + tags[i] + '###'); @@ -2966,7 +3020,7 @@ for (var i = 0; i < len; i++) { - if (tags[i] === 'td' || tags[i] === 'th') + if (tags[i] === 'td' || tags[i] === 'th' || tags[i] === 'span') { html = html.replace(new RegExp('###' + tags[i] + '\s?(.*?[^#])###', 'gi'), '<' + tags[i] + '$1>'); } @@ -3043,14 +3097,15 @@ var codeTag = false; var contents, attr1, attr2; - if (s.match(//i)) + if (s.match(/(([\n\r\s]+)?)/i)) { - arr = s.match(/([\w\W]*?)<\/code><\/pre>/i); + + arr = s.match(/(([\n\r\s]+)?)([\w\W]*?)<\/code><\/pre>/i); codeTag = true; - contents = arr[3]; + contents = arr[5]; attr1 = arr[1]; - attr2 = arr[2]; + attr2 = arr[4]; } else { @@ -3756,7 +3811,7 @@ if (this.detect.isDesktop() && !this.detect.isFirefox()) { this.dropdown.active.on('mouseover.redactor-dropdown', $.proxy(this.utils.disableBodyScroll, this)); - this.dropdown.active.on('mousedown.redactor-dropdown', $.proxy(this.utils.enableBodyScroll, this)); + this.dropdown.active.on('mouseout.redactor-dropdown mousedown.redactor-dropdown', $.proxy(this.utils.enableBodyScroll, this)); } e.stopPropagation(); @@ -4142,7 +4197,11 @@ } var files = e.dataTransfer.files; - this.upload.directUpload(files[0], e); + var len = files.length; + for (var i = 0; i < len; i++) + { + this.upload.directUpload(files[i], e); + } }, onDrop: function(e) { @@ -4467,6 +4526,10 @@ { this.core.callback('imageUpload', $img, json); } + else + { + this.core.callback('imageInserted', $img, json); + } }, setEditable: function($image) { @@ -4679,6 +4742,8 @@ this.observe.image = $image; var $link = $image.closest('a', this.$editor[0]); + var $figure = $image.closest('figure', this.$editor[0]); + var $container = ($figure.length !== 0) ? $figure : $image; this.modal.load('image-edit', this.lang.get('edit'), 705); @@ -4709,7 +4774,8 @@ } else { - var floatValue = ($image.css('display') == 'block' && $image.css('float') == 'none') ? 'center' : $image.css('float'); + var isCentered = ($figure.length !== 0) ? ($container.css('text-align') === 'center') : ($container.css('display') == 'block' && $container.css('float') == 'none'); + var floatValue = (isCentered) ? 'center' : $container.css('float'); $('#redactor-image-align').val(floatValue); } @@ -4804,11 +4870,14 @@ }, setFloating: function($image) { + var $figure = $image.closest('figure', this.$editor[0]); + var $container = ($figure.length !== 0) ? $figure : $image; var floating = $('#redactor-image-align').val(); var imageFloat = ''; var imageDisplay = ''; var imageMargin = ''; + var textAlign = ''; switch (floating) { @@ -4821,13 +4890,22 @@ imageMargin = '0 0 ' + this.opts.imageFloatMargin + ' ' + this.opts.imageFloatMargin; break; case 'center': - imageDisplay = 'block'; - imageMargin = 'auto'; + + if ($figure.length !== 0) + { + textAlign = 'center'; + } + else + { + imageDisplay = 'block'; + imageMargin = 'auto'; + } + break; } - $image.css({ 'float': imageFloat, display: imageDisplay, margin: imageMargin }); - $image.attr('rel', $image.attr('style')); + $container.css({ 'float': imageFloat, 'display': imageDisplay, 'margin': imageMargin, 'text-align': textAlign }); + $container.attr('rel', $image.attr('style')); }, addCaption: function($image, $link) { @@ -5096,12 +5174,144 @@ inline: function() { return { + + getClearedNodes: function() + { + var nodes = this.selection.nodes(); + var newNodes = []; + var len = nodes.length; + var started = len; + + for (var i = 0; i < len; i++) + { + if (i > started && !this.utils.isBlockTag(nodes[i].tagName)) + { + newNodes.push(nodes[i]); + } + + if ($(nodes[i]).hasClass('redactor-selection-marker')) + { + started = i + 1; + } + } + + return newNodes; + }, + isConvertableAttr: function(node, attr, value) + { + var nodeAttrValue = $(node).attr(attr); + if (nodeAttrValue) + { + if (attr === 'style') + { + + value = $.trim(value).replace(/;$/, '') + + var rules = value.split(';'); + var count = 0; + for (var i = 0; i < rules.length; i++) + { + var arr = rules[i].split(':'); + var ruleName = $.trim(arr[0]); + var ruleValue = $.trim(arr[1]); + + if (ruleName.search(/color/) !== -1) + { + var val = $(node).css(ruleName); + if (val && (val === ruleValue || this.utils.rgb2hex(val) === ruleValue)) + { + count++; + } + } + else if ($(node).css(ruleName) === ruleValue) + { + count++; + } + } + + if (count === rules.length) + { + return 1; + } + } + else if (nodeAttrValue === value) + { + return 1; + } + } + + return 0; + + }, + isConvertable: function(node, nodeTag, tag, attr) + { + if (nodeTag === tag) + { + if (attr) + { + var count = 0; + for (var key in attr) + { + count += this.inline.isConvertableAttr(node, key, attr[key]); + } + + if (count === Object.keys(attr).length) + { + return true; + } + } + else + { + return true; + } + } + + return false; + }, + setNodesStriked: function(nodes, tag, attr) + { + + for (var i = 0; i < nodes.length; i++) + { + var nodeTag = (nodes[i].tagName) ? nodes[i].tagName.toLowerCase() : undefined; + + var parent = nodes[i].parentNode; + var parentTag = (parent && parent.tagName) ? parent.tagName.toLowerCase() : undefined; + + var convertable = this.inline.isConvertable(parent, parentTag, tag, attr); + if (convertable) + { + var $el = $(parent).replaceWith(function() + { + return $('').append($(this).contents()); + }); + + $el.attr('data-redactor-inline-converted'); + } + + var convertable = this.inline.isConvertable(nodes[i], nodeTag, tag, attr); + if (convertable) + { + var $el = $(nodes[i]).replaceWith(function() + { + return $('').append($(this).contents()); + }); + } + } + }, format: function(tag, attr, value, type) { - tag = tag.toLowerCase(); + if (typeof attr !== 'undefined' && typeof attr !== 'object') + { + var obj = {}; + obj[attr] = value; + attr = obj; + } + + tag = tag.toLowerCase(); - // Stop formatting pre - if (this.utils.isCurrentOrParent(['PRE'])) + // Stop formatting pre/code + if (this.utils.isCurrentOrParent(['PRE', 'CODE'])) { return; } @@ -5117,7 +5327,7 @@ } } - this.placeholder.hide(); + this.placeholder.hide(); this.buffer.set(); if (this.utils.isCollapsed()) @@ -5126,167 +5336,35 @@ } else { - this.inline.formatUncollapsed(tag, attr, value, type); + this.inline.formatUncollapsed(tag, attr, value, type); } }, formatUncollapsed: function(tag, attr, value, type) { - var self = this; - var inlines = this.inline.inlines(); - var current = this.selection.current(); - if (current) - { - inlines.push(current); - } - this.selection.save(); - // save del tag - if (tag !== 'del') - { - this.core.editor().find('del').each(function(i,s) - { - self.utils.replaceToTag(s, 'deline'); - }); - } - - // save u tag - if (tag !== 'u') - { - this.core.editor().find('u').each(function(i,s) - { - self.utils.replaceToTag(s, 'inline'); - }); - } - - $.each(inlines, function() - { - if (this.nodeType === 1) - { - var currentTag = this.tagName.toLowerCase(); - if (currentTag === tag) - { - var $el = self.utils.replaceToTag(this, 'strike'); - $el.addClass('redactor-converted'); - } - } - }); + var nodes = this.inline.getClearedNodes(); + this.inline.setNodesStriked(nodes, tag, attr); - this.selection.restore(); + this.selection.restore(); - document.execCommand('strikethrough'); - - var formatting = true; - var parent = this.selection.parent(); - if (parent === false || parent.tagName !== 'STRIKE') - { - formatting = false; - } + document.execCommand('strikethrough'); this.selection.save(); - if (tag !== 'u') - { - this.core.editor().find('u').replaceWith(function() - { - return $(this).contents(); - }); - } - this.core.editor().find('strike').each(function() + + var self = this; + this.core.editor().find('strike').each(function() { var $el = self.utils.replaceToTag(this, tag); - if (formatting) - { - self.inline.setAttr($el, attr, value, type); - } - }); - this.core.editor().find('.redactor-converted').each(function() - { - var currentTag = this.tagName.toLowerCase(); - if (currentTag !== tag || formatting === false) - { - $(this).replaceWith(function() - { - return $(this).contents(); - }); - } - $(this).removeClass('redactor-converted'); - }); - // restore del tag - if (tag !== 'del') - { - this.core.editor().find('deline').each(function(i,s) - { - self.utils.replaceToTag(s, 'del'); - }); - } - // restore u tag - if (tag !== 'u') - { - this.core.editor().find('inline').each(function(i,s) - { - self.utils.replaceToTag(s, 'u'); - }); - } - this.selection.restore(); - - }, - inlines: function() - { - var inlines = []; - var nodes = this.inline.nodes(); - - $.each(nodes, $.proxy(function(i,node) - { - if (this.utils.isInline(node)) - { - inlines.push(node); - } - }, this)); - - var inline = this.selection.inline(); - if (inline === false && inlines.length === 0) - { - return []; - } - else if (inline !== false && inlines.length === 0) - { - return [inline]; - } - else - { - return inlines; - } - }, - nodes: function() - { - var sel = document.getSelection(); - - if (!sel.rangeCount || sel.isCollapsed || !sel.getRangeAt(0).commonAncestorContainer) - { - return []; - } - - var range = sel.getRangeAt(0); - - if (range.commonAncestorContainer.nodeType === 3) - { - var toRet = []; - var currNode = range.commonAncestorContainer; - while (currNode.parentNode && currNode.parentNode.childNodes.length === 1) + for (var key in attr) { - toRet.push(currNode.parentNode); - currNode = currNode.parentNode; - } - - return toRet; - } + self.inline.setAttr($el, key, attr[key], type); + } + }); - return [].filter.call(range.commonAncestorContainer.getElementsByTagName('*'), function (el) - { - return (typeof sel.containsNode === 'function') ? sel.containsNode(el, true) : true; - }); - }, + this.selection.restore(); + }, formatCollapsed: function(tag, attr, value, type) { var inline = this.selection.inline(); @@ -5378,6 +5456,11 @@ else { inline = this.inline[func + 'Attr'](attr, value, inline); + + if (attr === 'style' && inline[0].tagName === 'SPAN') + { + $(inline).attr('data-redactor-span', true); + } } } @@ -5500,7 +5583,45 @@ removeFormat: function() { document.execCommand('removeFormat'); + }, + removeStyleRule: function(name) + { + this.buffer.set(); + var parent = this.selection.parent(); + var nodes = this.selection.inlines(); + + this.selection.save(); + + if (parent && parent.tagName === 'SPAN') + { + var $s = $(parent); + + $s.css(name, ''); + $s.removeAttr('data-redactor-span'); + this.utils.removeEmptyAttr($s, 'style'); + if ($s[0].attributes.length === 0) + { + $s.replaceWith($s.contents()); + } + } + + $.each(nodes, $.proxy(function(i,s) + { + var $s = $(s); + if ($.inArray(s.tagName.toLowerCase(), this.opts.inlineTags) != -1 && !$s.hasClass('redactor-selection-marker')) + { + $s.css(name, ''); + this.utils.removeEmptyAttr($s, 'style'); + if ($s[0].attributes.length === 0) + { + $s.replaceWith($s.contents()); + } + } + }, this)); + + this.selection.restore(); } + }; }, @@ -5734,6 +5855,7 @@ var block = this.selection.block(); var gap = this.utils.isBlockTag(node.tagName); + var result = true; if (this.utils.isSelectAll()) { @@ -5771,11 +5893,15 @@ } else { - this.insert.placeNode(node, deleteContent); + result = this.insert.placeNode(node, deleteContent); } this.utils.disableSelectAll(); - this.caret.end(node); + + if (result) + { + this.caret.end(node); + } return node; @@ -5841,6 +5967,10 @@ { var sel = this.selection.get(); var range = this.selection.range(sel); + if (range == null) + { + return false; + } if (deleteContent !== false) { @@ -6139,7 +6269,7 @@ this.code.syncFire = false; this.keydown.removeEmptyLists(); - this.core.editor().find('*[style]').not('img, #redactor-image-box, #redactor-image-editter').removeAttr('style'); + this.core.editor().find('*[style]').not('img, #redactor-image-box, #redactor-image-editter, [data-redactor-span]').removeAttr('style'); this.keydown.formatEmpty(e); this.code.syncFire = true; @@ -9143,18 +9273,22 @@ var resultNodes = []; $.each(nodes, function(i,s) { - var tagName = (s.nodeType !== 1) ? false : s.tagName.toLowerCase(); - if ($(s).hasClass('redactor-script-tag, redactor-selection-marker')) - { - return; - } - else if (tagName && filter.length !== 0 && $.inArray(tagName, filter) === -1) - { - return; - } - else - { - resultNodes.push(s); + if (s) + { + var tagName = (s.nodeType !== 1) ? false : s.tagName.toLowerCase(); + + if ($(s).hasClass('redactor-script-tag, redactor-selection-marker')) + { + return; + } + else if (tagName && filter.length !== 0 && $.inArray(tagName, filter) === -1) + { + return; + } + else + { + resultNodes.push(s); + } } }); @@ -10280,10 +10414,16 @@ this.core.editor().addClass('redactor-relative'); }, // scroll + getScrollTarget: function() + { + var $scrollTarget = $(this.opts.scrollTarget); + + return ($scrollTarget.length !== 0) ? $scrollTarget : $(document); + }, freezeScroll: function() { - this.freezeScrollTop = $(document).scrollTop(); - $(document).scrollTop(this.freezeScrollTop); + this.freezeScrollTop = this.utils.getScrollTarget().scrollTop(); + this.utils.getScrollTarget().scrollTop(this.freezeScrollTop); }, unfreezeScroll: function() { @@ -10292,11 +10432,11 @@ return; } - $(document).scrollTop(this.freezeScrollTop); + this.utils.getScrollTarget().scrollTop(this.freezeScrollTop); }, saveScroll: function() { - this.tmpScrollTop = $(document).scrollTop(); + this.tmpScrollTop = this.utils.getScrollTarget().scrollTop(); }, restoreScroll: function() { @@ -10305,7 +10445,7 @@ return; } - $(document).scrollTop(this.tmpScrollTop); + this.utils.getScrollTarget().scrollTop(this.tmpScrollTop); }, isStartOfElement: function(element) { @@ -10479,6 +10619,21 @@ return data; } }, + isRgb: function(str) + { + return (str.search(/^rgb/i) === 0); + }, + rgb2hex: function(rgb) + { + rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); + + function hex(x) + { + return ("0" + parseInt(x).toString(16)).slice(-2); + } + + return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); + }, // #backward isCollapsed: function() diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.min.js b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.min.js index cc146962f8..559a6f892e 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.min.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.min.js @@ -1,5 +1,5 @@ -!function(t){"use strict";function e(t,i){return new e.prototype.init(t,i)}Function.prototype.bind||(Function.prototype.bind=function(t){var e=this;return function(){return e.apply(t)}});var i=0;t.fn.redactor=function(i){var o=[],r=Array.prototype.slice.call(arguments,1);return"string"==typeof i?this.each(function(){var e,s=t.data(this,"redactor");if("-1"!==i.search(/\./)?(e=i.split("."),"undefined"!=typeof s[e[0]]&&(e=s[e[0]][e[1]])):e=s[i],"undefined"!=typeof s&&t.isFunction(e)){var n=e.apply(s,r);void 0!==n&&n!==s&&o.push(n)}else t.error('No such method "'+i+'" for Redactor')}):this.each(function(){t.data(this,"redactor",{}),t.data(this,"redactor",e(this,i))}),0===o.length?this:1===o.length?o[0]:o},t.Redactor=e,t.Redactor.VERSION="1.3.2",t.Redactor.modules=["air","autosave","block","buffer","build","button","caret","clean","code","core","detect","dropdown","events","file","focus","image","indent","inline","insert","keydown","keyup","lang","line","link","linkify","list","marker","modal","observe","offset","paragraphize","paste","placeholder","progress","selection","shortcuts","storage","toolbar","upload","uploads3","utils","browser"],t.Redactor.settings={},t.Redactor.opts={animation:!1,lang:"en",direction:"ltr",spellcheck:!0,overrideStyles:!0,focus:!1,focusEnd:!1,clickToEdit:!1,structure:!1,tabindex:!1,minHeight:!1,maxHeight:!1,maxWidth:!1,plugins:!1,callbacks:{},placeholder:!1,linkify:!0,enterKey:!0,pastePlainText:!1,pasteImages:!0,pasteLinks:!0,pasteBlockTags:["pre","h1","h2","h3","h4","h5","h6","table","tbody","thead","tfoot","th","tr","td","ul","ol","li","blockquote","p","figure","figcaption"],pasteInlineTags:["br","strong","ins","code","del","span","samp","kbd","sup","sub","mark","var","cite","small","b","u","em","i"],preClass:!1,preSpaces:4,tabAsSpaces:!1,tabKey:!0,autosave:!1,autosaveName:!1,autosaveFields:!1,imageUpload:null,imageUploadParam:"file",imageUploadFields:!1,imageUploadForms:!1,imageTag:"figure",imageEditable:!0,imageCaption:!0,imagePosition:!1,imageResizable:!1,imageFloatMargin:"10px",dragImageUpload:!0,multipleImageUpload:!0,clipboardImageUpload:!0,fileUpload:null,fileUploadParam:"file",fileUploadFields:!1,fileUploadForms:!1,dragFileUpload:!0,s3:!1,linkNewTab:!1,linkTooltip:!0,linkNofollow:!1,linkSize:30,pasteLinkTarget:!1,videoContainerClass:"video-container",toolbar:!0,toolbarFixed:!0,toolbarFixedTarget:document,toolbarFixedTopOffset:0,toolbarExternal:!1,air:!1,airWidth:!1,formatting:["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],formattingAdd:!1,buttons:["format","bold","italic","deleted","lists","image","file","link"],buttonsHide:[],buttonsHideOnMobile:[],script:!0,removeComments:!0,replaceTags:{b:"strong",i:"em",strike:"del"},shortcuts:{"ctrl+shift+m, meta+shift+m":{func:"inline.removeFormat"},"ctrl+b, meta+b":{func:"inline.format",params:["bold"]},"ctrl+i, meta+i":{func:"inline.format",params:["italic"]},"ctrl+h, meta+h":{func:"inline.format",params:["superscript"]},"ctrl+l, meta+l":{func:"inline.format",params:["subscript"]},"ctrl+k, meta+k":{func:"link.show"},"ctrl+shift+7":{func:"list.toggle",params:["orderedlist"]},"ctrl+shift+8":{func:"list.toggle",params:["unorderedlist"]}},shortcutsAdd:!1,activeButtons:["deleted","italic","bold"],activeButtonsStates:{b:"bold",strong:"bold",i:"italic",em:"italic",del:"deleted",strike:"deleted"},langs:{en:{format:"Format",image:"Image",file:"File",link:"Link",bold:"Bold",italic:"Italic",deleted:"Strikethrough",underline:"Underline","bold-abbr":"B","italic-abbr":"I","deleted-abbr":"S","underline-abbr":"U",lists:"Lists","link-insert":"Insert link","link-edit":"Edit link","link-in-new-tab":"Open link in new tab",unlink:"Unlink",cancel:"Cancel",close:"Close",insert:"Insert",save:"Save","delete":"Delete",text:"Text",edit:"Edit",title:"Title",paragraph:"Normal text",quote:"Quote",code:"Code",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",filename:"Name",optional:"optional",unorderedlist:"Unordered List",orderedlist:"Ordered List",outdent:"Outdent",indent:"Indent",horizontalrule:"Line","upload-label":"Drop file here or ",caption:"Caption",bulletslist:"Bullets",numberslist:"Numbers","image-position":"Position",none:"None",left:"Left",right:"Right",center:"Center","accessibility-help-label":"Rich text editor"}},type:"textarea",inline:!1,buffer:[],rebuffer:[],inlineTags:["a","span","strong","strike","b","u","em","i","code","del","ins","samp","kbd","sup","sub","mark","var","cite","small"],blockTags:["pre","ul","ol","li","p","h1","h2","h3","h4","h5","h6","dl","dt","dd","div","td","blockquote","output","figcaption","figure","address","section","header","footer","aside","article","iframe"],paragraphize:!0,paragraphizeBlocks:["table","div","pre","form","ul","ol","h1","h2","h3","h4","h5","h6","dl","blockquote","figcaption","address","section","header","footer","aside","article","object","style","script","iframe","select","input","textarea","button","option","map","area","math","hr","fieldset","legend","hgroup","nav","figure","details","menu","summary","p"],emptyHtml:"

",invisibleSpace:"​",imageTypes:["image/png","image/jpeg","image/gif"],userAgent:navigator.userAgent.toLowerCase(),observe:{dropdowns:[]},regexps:{linkyoutube:/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/gi,linkvimeo:/https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/,linkimage:/((https?|www)[^\s]+\.)(jpe?g|png|gif)(\?[^\s-]+)?/gi,url:/(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/gi}},e.fn=t.Redactor.prototype={keyCode:{BACKSPACE:8,DELETE:46,UP:38,DOWN:40,ENTER:13,SPACE:32,ESC:27,TAB:9,CTRL:17,META:91,SHIFT:16,ALT:18,RIGHT:39,LEFT:37,LEFT_WIN:91},init:function(e,o){return this.$element=t(e),this.uuid=i++,this.loadOptions(o),this.loadModules(),this.opts.clickToEdit&&!this.$element.hasClass("redactor-click-to-edit")?this.loadToEdit(o):(this.$element.hasClass("redactor-click-to-edit")&&this.$element.removeClass("redactor-click-to-edit"),this.reIsBlock=new RegExp("^("+this.opts.blockTags.join("|").toUpperCase()+")$","i"),this.reIsInline=new RegExp("^("+this.opts.inlineTags.join("|").toUpperCase()+")$","i"),this.opts.dragImageUpload=null===this.opts.imageUpload?!1:this.opts.dragImageUpload,this.opts.dragFileUpload=null===this.opts.fileUpload?!1:this.opts.dragFileUpload,this.formatting={},this.lang.load(),t.extend(this.opts.shortcuts,this.opts.shortcutsAdd),this.$editor=this.$element,this.detectType(),this.core.callback("start"),this.core.callback("startToEdit"),this.start=!0,void this.build.start())},detectType:function(){this.build.isInline()||this.opts.inline?this.opts.type="inline":this.build.isTag("DIV")?this.opts.type="div":this.build.isTag("PRE")&&(this.opts.type="pre")},loadToEdit:function(e){this.$element.on("click.redactor-click-to-edit",t.proxy(function(){this.initToEdit(e)},this)),this.$element.addClass("redactor-click-to-edit")},initToEdit:function(e){t.extend(e.callbacks,{startToEdit:function(){this.insert.node(this.marker.get(),!1)},initToEdit:function(){this.selection.restore(),this.clickToCancelStorage=this.code.get(),t(this.opts.clickToCancel).off(".redactor-click-to-edit"),t(this.opts.clickToCancel).show().on("click.redactor-click-to-edit",t.proxy(function(i){i.preventDefault(),this.core.destroy(),this.events.syncFire=!1,this.$element.html(this.clickToCancelStorage),this.core.callback("cancel",this.clickToCancelStorage),this.events.syncFire=!0,this.clickToCancelStorage="",t(this.opts.clickToCancel).hide(),t(this.opts.clickToSave).hide(),this.$element.on("click.redactor-click-to-edit",t.proxy(function(){this.initToEdit(e)},this)),this.$element.addClass("redactor-click-to-edit")},this)),t(this.opts.clickToSave).off(".redactor-click-to-edit"),t(this.opts.clickToSave).show().on("click.redactor-click-to-edit",t.proxy(function(i){i.preventDefault(),this.core.destroy(),this.core.callback("save",this.code.get()),t(this.opts.clickToCancel).hide(),t(this.opts.clickToSave).hide(),this.$element.on("click.redactor-click-to-edit",t.proxy(function(){this.initToEdit(e)},this)),this.$element.addClass("redactor-click-to-edit")},this))}}),this.$element.redactor(e),this.$element.off(".redactor-click-to-edit")},loadOptions:function(e){var i={};"undefined"!=typeof t.Redactor.settings.namespace?this.$element.hasClass(t.Redactor.settings.namespace)&&(i=t.Redactor.settings):i=t.Redactor.settings,this.opts=t.extend({},t.extend(!0,{},t.Redactor.opts),t.extend(!0,{},i),this.$element.data(),e)},getModuleMethods:function(t){return Object.getOwnPropertyNames(t).filter(function(e){return"function"==typeof t[e]})},loadModules:function(){for(var e=t.Redactor.modules.length,i=0;e>i;i++)this.bindModuleMethods(t.Redactor.modules[i])},bindModuleMethods:function(t){if("undefined"!=typeof this[t]){this[t]=this[t]();for(var e=this.getModuleMethods(this[t]),i=e.length,o=0;i>o;o++)this[t][e[o]]=this[t][e[o]].bind(this)}},air:function(){return{enabled:!1,collapsed:function(){this.opts.air&&this.selection.get().collapseToStart()},collapsedEnd:function(){this.opts.air&&this.selection.get().collapseToEnd()},build:function(){this.detect.isMobile()||(this.button.hideButtons(),this.button.hideButtonsOnMobile(),0!==this.opts.buttons.length&&(this.$air=this.air.createContainer(),this.opts.airWidth!==!1&&this.$air.css("width",this.opts.airWidth),this.air.append(),this.button.$toolbar=this.$air,this.button.setFormatting(),this.button.load(this.$air),this.core.editor().on("mouseup.redactor",this,t.proxy(function(t){""!==this.selection.text()&&this.air.show(t)},this))))},append:function(){this.$air.appendTo("body")},createContainer:function(){return t("