From: Alexander Ebert Date: Wed, 20 Dec 2017 10:58:48 +0000 (+0100) Subject: Upgraded to Redactor II 2.12 X-Git-Tag: 3.1.0_Beta_5~2^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a9f381d0a21e761b838b773cf102230cc598c8d0;p=GitHub%2FWoltLab%2FWCF.git Upgraded to Redactor II 2.12 --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js index f0542ce13f..5f7565e67a 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js @@ -1,7 +1,7 @@ /* Redactor II - Version 2.11 - Updated: September 20, 2017 + Version 2.12 + Updated: December 4, 2017 http://imperavi.com/redactor/ @@ -101,7 +101,7 @@ // Options $.Redactor = Redactor; - $.Redactor.VERSION = '2.11'; + $.Redactor.VERSION = '2.12'; $.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', @@ -915,7 +915,7 @@ }, formatUncollapsed: function(tag, attr, value, type) { - this.selection.save(); + this.selection.save(); var replaced = []; var blocks = this.selection.blocks(); @@ -1839,10 +1839,8 @@ }, buildButtonTooltip: function($btn, title) { - if (this.opts.air || this.detect.isMobile()) - { - return; - } + if (typeof this.button.toolbar() === 'undefined') return; + if (this.opts.air || this.detect.isMobile()) return; var $tooltip = $(''); $tooltip.addClass('re-button-tooltip'); @@ -3107,7 +3105,7 @@ { if (link.href) { - var tmp = '##%%a href="' + link.href + '"'; + var tmp = '#####[a href="' + link.href + '"'; var attr; for (var j = 0, length = link.attributes.length; j < length; j++) { @@ -3118,7 +3116,7 @@ } } - link.outerHTML = tmp + '%%##' + link.innerHTML + '##%%/a%%##'; + link.outerHTML = tmp + ']#####' + link.innerHTML + '#####[/a]#####'; } }); } @@ -3128,7 +3126,7 @@ // images if (data.images && this.opts.pasteImages) { - html = html.replace(/])>/gi, '##%%img$1src="$2"$3%%##'); + html = html.replace(/])>/gi, '#####[img$1src="$2"$3]#####'); } // plain text @@ -3179,8 +3177,8 @@ // links & images if ((data.links && this.opts.pasteLinks) || (data.images && this.opts.pasteImages)) { - html = html.replace(new RegExp('##%%', 'gi'), '<'); - html = html.replace(new RegExp('%%##', 'gi'), '>'); + html = html.replace(new RegExp('#####\\[', 'gi'), '<'); + html = html.replace(new RegExp('\\]#####', 'gi'), '>'); } // plain text @@ -4836,6 +4834,7 @@ var width = Math.round(height * this.image.resizeHandle.ratio); if (height < 50 || width < 100) return; + if (this.core.editor().width() <= width) return; this.image.resizeHandle.el.attr({width: width, height: height}); this.image.resizeHandle.el.width(width); @@ -6925,19 +6924,6 @@ }, this), 1); } - - // remove last br - setTimeout($.proxy(function() - { - var block = this.selection.block(); - var nodes = block.childNodes; - var last = nodes[nodes.length-1]; - if (last && last.nodeType !== 3 && last.tagName === 'BR') - { - $(last).remove(); - } - - }, this), 1); }, checkEvents: function(arrow, key) { @@ -7746,26 +7732,9 @@ }, isUrl: function(url) { - var pattern = '((xn--)?[\\W\\w\\D\\d]+(-[\\W\\w\\D\\d]+)*\\.)+[\\W\\w]{2,}'; - - var re1 = new RegExp('^(http|ftp|https)://' + pattern, 'i'); - var re2 = new RegExp('^' + pattern, 'i'); - var re3 = new RegExp('\.(html|php)$', 'i'); - var re4 = new RegExp('^/', 'i'); - var re5 = new RegExp('^tel:(.*?)', 'i'); - - // add protocol - if (url.search(re1) === -1 && url.search(re2) !== -1 && url.search(re3) === -1 && url.substring(0, 1) !== '/') - { - url = 'http://' + url; - } - - if (url.search(re1) !== -1 || url.search(re3) !== -1 || url.search(re4) !== -1 || url.search(re5) !== -1) - { - return url; - } + var reUrl = new RegExp('^((https?|ftp):\\/\\/)?(([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$','i'); - return false; + return (reUrl.test(url)) ? url : false; }, isMailto: function(url) { @@ -7791,7 +7760,7 @@ { if (this.opts.linkValidation) { - link.url = this.link.isUrl(link.url); + link.url = (this.link.isUrl(link.url)) ? 'http://' + link.url.replace(/(ftp|https?):\/\//gi, '') : link.url; } } @@ -7944,15 +7913,7 @@ $el.removeAttr('class'); } - if (s.tagName === 'DIV') // video container - { - this.linkify.breakBlockTag($el, 'video'); - } - else if (s.tagName === 'IMG') // image - { - this.linkify.breakBlockTag($el, 'image'); - } - else if (s.tagName === 'A') + if (s.tagName === 'A') { this.core.callback('insertedLink', $el); } @@ -7969,36 +7930,6 @@ }, this), 100); - }, - breakBlockTag: function($el, type) - { - var breaked = this.utils.breakBlockTag(); - if (breaked === false) - { - return; - } - - var $newBlock = $el; - if (type === 'image') - { - $newBlock = $('
').append($el); - } - - if (breaked.type === 'start') - { - breaked.$block.before($newBlock); - } - else - { - breaked.$block.after($newBlock); - } - - - if (type === 'image') - { - this.caret.after($newBlock); - } - }, convertVideoLinks: function(html) { @@ -8025,7 +7956,7 @@ return html; } - return html.replace(html, ''); + return html.replace(html, ''); }, convertLinks: function(html) { @@ -8083,107 +8014,34 @@ list: function() { return { - toggle: function(cmd) + toggle: function(type) { if (this.utils.inBlocks(['table', 'td', 'th', 'tr'])) { return; } - var tag = (cmd === 'orderedlist' || cmd === 'ol') ? 'OL' : 'UL'; - cmd = (tag === 'OL') ? 'orderedlist' : 'unorderedlist' + type = (type === 'orderedlist') ? 'ol' : type; + type = (type === 'unorderedlist') ? 'ul' : type; - var $list = $(this.selection.current()).parentsUntil('.redactor-in', 'ul, ol').first(); + type = type.toLowerCase(); - this.placeholder.hide(); - this.buffer.set(); - - - if ($list.length !== 0 && $list[0].tagName === tag && this.utils.isRedactorParent($list)) - { - this.selection.save(); - - // remove list - $list.find('ul, ol').each(function() - { - var parent = $(this).closest('li'); - $(this).find('li').each(function() - { - $(parent).after(this); - }); - }); - - $list.find('ul, ol').remove(); - $list.find('li').each(function() - { - return $(this).replaceWith(function() - { - return $('

').append($(this).contents()); - }); - }); - - - $list.replaceWith(function() - { - return $(this).contents(); - }); - - this.selection.restore(); - return; - } - - - this.selection.save(); - - if ($list.length !== 0 && $list[0].tagName !== tag) - { - $list.each($.proxy(function(i,s) - { - this.utils.replaceToTag(s, tag); - - }, this)); - } - else - { - document.execCommand('insert' + cmd); - } - - this.selection.restore(); - - var $insertedList = this.list.get(); - if (!$insertedList) - { - if (!this.selection.block()) - { - document.execCommand('formatblock', false, 'p'); - } - - return; - } - - // clear span - $insertedList.find('span').replaceWith(function() - { - return $(this).contents(); - }); - - // remove style - $insertedList.find(this.opts.inlineTags.join(',')).each(function() - { - $(this).removeAttr('style'); - }); + this.buffer.set(); + this.selection.save(); - // remove block-element list wrapper - var $listParent = $insertedList.parent(); - if (this.utils.isRedactorParent($listParent) && $listParent[0].tagName !== 'LI' && this.utils.isBlock($listParent)) - { - this.selection.save(); + var nodes = this.list._getBlocks(); + var block = this.selection.block(); + var $list = $(block).parents('ul, ol').last(); + if (nodes.length === 0 && $list.length !== 0) + { + nodes = [$list.get(0)]; + } - $listParent.replaceWith($listParent.contents()); + nodes = (this.list._isUnformat(type, nodes)) ? this.list._unformat(type, nodes) : this.list._format(type, nodes); - this.selection.restore(); - } + this.selection.restore(); + return nodes; }, get: function() { @@ -8192,7 +8050,7 @@ return ($list.length === 0) ? false : $list; }, - combineAfterAndBefore: function(block) + combineAfterAndBefore: function(block) { var $prev = $(block).prev(); var $next = $(block).next(); @@ -8210,7 +8068,331 @@ return false; - } + }, + _getBlocks: function() + { + var finalBlocks = []; + var blocks = this.selection.blocks(); + for (var i = 0; i < blocks.length; i++) + { + var $el = $(blocks[i]); + var isFirst = ($el.parent().hasClass('redactor-in')); + + if (isFirst) finalBlocks.push(blocks[i]); + } + + return finalBlocks; + }, + _isUnformat: function(type, nodes) + { + var countLists = 0; + for (var i = 0; i < nodes.length; i++) + { + if (nodes[i].nodeType !== 3) + { + var tag = nodes[i].tagName.toLowerCase(); + if (tag === type || tag === 'figure') + { + countLists++; + } + } + } + + return (countLists === nodes.length); + }, + _uniteBlocks: function(nodes, tags) + { + var z = 0; + var blocks = { 0: [] }; + var lastcell = false; + for (var i = 0; i < nodes.length; i++) + { + var $node = $(nodes[i]); + var $cell = $node.closest('th, td'); + + if ($cell.length !== 0) + { + if ($cell.get(0) !== lastcell) + { + // create block + z++; + blocks[z] = []; + } + + if (this.list._isUniteBlock(nodes[i], tags)) + { + blocks[z].push(nodes[i]); + } + } + else + { + if (this.list._isUniteBlock(nodes[i], tags)) + { + blocks[z].push(nodes[i]); + } + else + { + // create block + z++; + blocks[z] = []; + } + } + + lastcell = $cell.get(); + } + + return blocks; + }, + _isUniteBlock: function(node, tags) + { + return (node.nodeType === 3 || tags.indexOf(node.tagName.toLowerCase()) !== -1); + }, + _createList: function(type, blocks, key) + { + var last = blocks[blocks.length-1]; + var $last = $(last); + var $list = $('<' + type + '>'); + $last.after($list); + + return $list; + }, + _createListItem: function(item) + { + var $item = $('

  • '); + if (item.nodeType === 3) + { + $item.append(item); + } + else + { + var $el = $(item); + $item.append($el.contents()); + $el.remove(); + } + + return $item; + }, + _format: function(type, nodes) + { + var tags = ['p', 'div', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol']; + var blocks = this.list._uniteBlocks(nodes, tags); + var lists = []; + + for (var key in blocks) + { + var items = blocks[key]; + var $list = this.list._createList(type, blocks[key]); + + for (var i = 0; i < items.length; i++) + { + var $item; + + // lists + if (items[i].nodeType !== 3 && (items[i].tagName === 'UL' || items[i].tagName === 'OL')) + { + $item = $(items[i]).contents(); + $list.append($item); + } + // other blocks or texts + else + { + $item = this.list._createListItem(items[i]); + //this.utils.normalizeTextNodes($item); + $list.append($item); + } + } + + lists.push($list.get(0)); + } + + return lists; + }, + _unformat: function(type, nodes) + { + + if (nodes.length === 1) + { + // one list + var $list = $(nodes[0]); + var $items = $list.find('li'); + + var selectedItems = this.selection.blocks(['li']); + var block = this.selection.block(); + var $li = $(block).closest('li'); + if (selectedItems.length === 0 && $li.length !== 0) + { + selectedItems = [$li.get(0)]; + } + + // 1) entire + if (selectedItems.length === $items.length) + { + return this.list._unformatEntire(nodes[0]); + } + + var pos = this.list._getItemsPosition($items, selectedItems); + + // 2) top + if (pos === 'Top') + { + return this.list._unformatAtSide('before', selectedItems, $list); + } + + // 3) bottom + else if (pos === 'Bottom') + { + selectedItems.reverse(); + return this.list._unformatAtSide('after', selectedItems, $list); + } + + // 4) middle + else if (pos === 'Middle') + { + var $last = $(selectedItems[selectedItems.length-1]); + + var ci = false; + + var $parent = false; + var $secondList = $('<' + $list.get(0).tagName.toLowerCase() + '>'); + $items.each(function(i, node) + { + if (ci) + { + var $node = $(node); + var $childList = ($node.children('ul, ol').length !== 0); + + if ($node.closest('.redactor-split-item').length === 0 && ($parent === false || $node.closest($parent).length === 0)) + { + $node.addClass('redactor-split-item'); + } + + $parent = $node; + + } + + if (node === $last.get(0)) + { + ci = true; + } + }); + + $items.filter('.redactor-split-item').each(function(i, node) + { + var $node = $(node); + $node.removeClass('redactor-split-item'); + $secondList.append(node); + }); + + $list.after($secondList); + + selectedItems.reverse(); + for (var i = 0; i < selectedItems.length; i++) + { + var $item = $(selectedItems[i]); + var $container = this.list._createUnformatContainer($item); + + $list.after($container); + $container.find('ul, ol').remove(); + $item.remove(); + } + + + return; + } + + } + else + { + // unformat all + for (var i = 0; i < nodes.length; i++) + { + if (nodes[i].nodeType !== 3 && nodes[i].tagName.toLowerCase() === type) + { + this.list._unformatEntire(nodes[i]); + } + } + } + }, + _unformatEntire: function(list) + { + var $list = $(list); + var $items = $list.find('li'); + $items.each(function(i, node) + { + var $item = $(node); + var $container = this.list._createUnformatContainer($item); + + $item.remove(); + $list.before($container); + + }.bind(this)); + + $list.remove(); + }, + _unformatAtSide: function(type, selectedItems, $list) + { + for (var i = 0; i < selectedItems.length; i++) + { + var $item = $(selectedItems[i]); + var $container = this.list._createUnformatContainer($item); + + $list[type]($container); + + var $innerLists = $container.find('ul, ol').first(); + $item.append($innerLists); + + $innerLists.each(function(i, node) + { + var $node = $(node); + var $parent = $node.closest('li'); + + if ($parent.get(0) === selectedItems[i]) + { + $node.unwrap(); + $parent.addClass('r-unwrapped'); + } + + }); + + if (this.utils.isEmpty($item.html())) $item.remove(); + } + + // clear empty + $list.find('.r-unwrapped').each(function(node) + { + var $node = $(node); + if ($node.html().trim() === '') $node.remove(); + else $node.removeClass('r-unwrapped'); + }); + }, + _getItemsPosition: function($items, selectedItems) + { + var pos = 'Middle'; + + var sFirst = selectedItems[0]; + var sLast = selectedItems[selectedItems.length-1]; + + var first = $items.first().get(0); + var last = $items.last().get(0); + + if (first === sFirst && last !== sLast) + { + pos = 'Top'; + } + else if (first !== sFirst && last === sLast) + { + pos = 'Bottom'; + } + + return pos; + }, + _createUnformatContainer: function($item) + { + var $container = $('

    '); + $container.append($item.contents()); + + return $container; + } }; }, @@ -9812,7 +9994,7 @@ // single node if (node === endNode) { - return [this.selection.parent()]; + return [node]; } // iterate @@ -10591,10 +10773,10 @@ formData.append(name, file); } - this.progress.show(); var stop = this.core.callback('uploadStart', e, formData); if (stop !== false) { + this.progress.show(); this.upload.send(formData, e); } }, @@ -10946,7 +11128,6 @@ return false; } - if (!isEmpty && this.utils.isStartOfElement(block)) { return { $block: $(block), $next: $(block).next(), type: 'start' }; diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.min.js b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.min.js index ab98095a1c..61ea273e40 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.min.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.min.js @@ -1 +1 @@ -!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(/\./)?void 0!==s[(e=i.split("."))[0]]&&(e=s[e[0]][e[1]]):e=s[i],void 0!==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="2.11",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,stylesClass:!1,scrollTarget:document,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,linkValidation:!0,pasteLinkTarget:!1,videoContainerClass:"video-container",toolbar:!0,toolbarFixed:!0,toolbarFixedTarget:document,toolbarFixedTopOffset:0,toolbarExternal:!1,toolbarOverflow:!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","horizontalrule"],buttonsTextLabeled:!1,buttonsHide:[],buttonsHideOnMobile:[],script:!0,removeNewlines:!1,removeComments:!0,replaceTags:{b:"strong",i:"em",strike:"del"},keepStyleAttr:[],keepInlineOnEnter:!1,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,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:"​",emptyHtmlRendered:t("").html("​").html(),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){if(this.$element=t(e),this.uuid=i++,this.sBuffer=[],this.sRebuffer=[],this.loadOptions(o),this.loadModules(),this.opts.clickToEdit&&!this.$element.hasClass("redactor-click-to-edit"))return 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&&this.opts.dragImageUpload,this.opts.dragFileUpload=null!==this.opts.fileUpload&&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,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={};void 0!==t.Redactor.settings.namespace?this.$element.hasClass(t.Redactor.settings.namespace)&&(i=t.Redactor.settings):i=t.Redactor.settings,this.opts=t.extend({},t.Redactor.opts,this.$element.data(),e),this.opts=t.extend({},this.opts,i)},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;i").addClass("redactor-air").attr({id:"redactor-air-"+this.uuid,role:"toolbar"}).hide()},show:function(e){this.selection.saveInstant(),t(".redactor-air").hide();var i=0,o=this.$air.innerWidth();t(window).width()')},setIn:function(){this.core.editor().addClass("redactor-in")},setId:function(){var t="textarea"===this.opts.type?"redactor-uuid-"+this.uuid:this.$element.attr("id");this.core.editor().attr("id",void 0===t?"redactor-uuid-"+this.uuid:t)},getName:function(){var t=this.$element.attr("name");return void 0===t?"content-"+this.uuid:t},buildTextarea:function(){this.$textarea=t("