diff --git a/dist/jquery.webhook-redactor.js b/dist/jquery.webhook-redactor.js index a1c7dcf..6fd1204 100644 --- a/dist/jquery.webhook-redactor.js +++ b/dist/jquery.webhook-redactor.js @@ -1,6 +1,6 @@ -/*! webhook-redactor - v0.0.1 - 2015-01-12 +/*! webhook-redactor - v0.0.1 - 2016-03-29 * https://github.com/webhook/webhook-redactor -* Copyright (c) 2015 Mike Horn; Licensed MIT */ +* Copyright (c) 2016 Mike Horn; Licensed MIT */ (function ($) { 'use strict'; @@ -734,10 +734,11 @@ right : { classSuffix: 'arrow-right' }, small : { classSuffix: 'small', text: 'S' }, medium : { classSuffix: 'medium', text: 'M' }, + large : { classSuffix: 'large', text: 'L' }, resize_full : { classSuffix: 'resize-full' }, resize_small: { classSuffix: 'resize-small' } }, - controlGroup: ['left', 'up', 'down', 'right', '|', 'small', 'medium', 'resize_full', 'resize_small', 'remove'], + controlGroup: ['left', 'up', 'down', 'right', '|', 'small', 'medium', 'large', 'resize_full', 'resize_small', 'remove'], init: function () { this.redactor.$editor.on('focus', $.proxy(this.addCaptions, this)); // this.addCaptions(); @@ -771,6 +772,7 @@ if ($figure.hasClass('wy-figure-small')) { $toolbar.find('.wy-figure-controls-small').show().addClass('on'); $toolbar.find('.wy-figure-controls-medium').show(); + $toolbar.find('.wy-figure-controls-large').show(); $toolbar.find('.wy-figure-controls-resize-full').show(); $toolbar.find('.wy-figure-controls-resize-small').hide(); } @@ -778,6 +780,15 @@ else if ($figure.hasClass('wy-figure-medium')) { $toolbar.find('.wy-figure-controls-small').show(); $toolbar.find('.wy-figure-controls-medium').show().addClass('on'); + $toolbar.find('.wy-figure-controls-large').show(); + $toolbar.find('.wy-figure-controls-resize-full').show(); + $toolbar.find('.wy-figure-controls-resize-small').hide(); + } + + else if ($figure.hasClass('wy-figure-large')) { + $toolbar.find('.wy-figure-controls-small').show(); + $toolbar.find('.wy-figure-controls-medium').show(); + $toolbar.find('.wy-figure-controls-large').show().addClass('on'); $toolbar.find('.wy-figure-controls-resize-full').show(); $toolbar.find('.wy-figure-controls-resize-small').hide(); } @@ -825,7 +836,8 @@ case 'small': case 'medium': - changeSuffix(['small', 'medium', 'large'], [command]); + case 'large': + changeSuffix(['small', 'medium', 'large', 'full'], [command]); if (!$figure.hasClass('wy-figure-left') && !$figure.hasClass('wy-figure-right')) { $figure.addClass('wy-figure-left'); $figure.trigger('left'); @@ -833,11 +845,11 @@ break; case 'resize_full': - changeSuffix(['small', 'medium', 'left', 'right'], ['large']); + changeSuffix(['small', 'medium', 'large', 'left', 'right'], ['full']); break; case 'resize_small': - changeSuffix(['small', 'large', 'right'], ['medium', 'left']); + changeSuffix(['small', 'medium', 'full', 'right'], ['large', 'left']); break; } diff --git a/dist/jquery.webhook-redactor.min.js b/dist/jquery.webhook-redactor.min.js index 6bfb65c..bce5ab9 100644 --- a/dist/jquery.webhook-redactor.min.js +++ b/dist/jquery.webhook-redactor.min.js @@ -1,4 +1,4 @@ -/*! webhook-redactor - v0.0.1 - 2015-01-12 +/*! webhook-redactor - v0.0.1 - 2016-03-29 * https://github.com/webhook/webhook-redactor -* Copyright (c) 2015 Mike Horn; Licensed MIT */ -!function(a){"use strict";window.RedactorPlugins=window.RedactorPlugins||{},a.embedly.defaults.key="65874c90af644c6a8f0b7072fe857811",a.embedly.defaults.query={maxwidth:640};var b=function(a){this.redactor=a,this.$editor=a.$editor,this.observe()};b.prototype={urlRegex:/((http:\/\/(.*youtube\.com\/watch.*|.*\.youtube\.com\/v\/.*|youtu\.be\/.*|.*\.youtube\.com\/user\/.*|.*\.youtube\.com\/.*#.*\/.*|m\.youtube\.com\/watch.*|m\.youtube\.com\/index.*|.*\.youtube\.com\/profile.*|.*\.youtube\.com\/view_play_list.*|.*\.youtube\.com\/playlist.*|www\.vimeo\.com\/groups\/.*\/videos\/.*|www\.vimeo\.com\/.*|vimeo\.com\/groups\/.*\/videos\/.*|vimeo\.com\/.*|vimeo\.com\/m\/#\/.*|player\.vimeo\.com\/.*))|(https:\/\/(.*youtube\.com\/watch.*|.*\.youtube\.com\/v\/.*|www\.vimeo\.com\/.*|vimeo\.com\/.*|player\.vimeo\.com\/.*)))/i,observe:function(){this.redactor.$editor.on("keyup.redactor",a.proxy(function(a){a.which===this.redactor.keyCode.ENTER&&this.checkNode(this.redactor.$editor.get(0))},this))},checkNode:function(b){return a.each(b.childNodes,a.proxy(function(b,c){if(3===c.nodeType&&c.nodeValue&&this.urlRegex.test(c.nodeValue)){this.redactor.buffer.set();var d=c.nodeValue.match(this.urlRegex)[0],e=a("loading embed...");c.nodeValue=c.nodeValue.replace(this.urlRegex,""),a(c).parentsUntil(this.$editor).last().after(e),a.embedly.oembed(d).done(function(b){a.each(b,function(){e.replaceWith(this.html?'
'+this.html+"
":a("

").text(d))})})}else 1!==c.nodeType||/^(a|button|textarea)$/i.test(c.tagName)||this.checkNode(c)},this)),this.matches}},window.RedactorPlugins.autoembedly=function(){return{init:function(){this.autoembedly=new b(this)}}}}(jQuery),function(a){"use strict";window.RedactorPlugins||(window.RedactorPlugins={});var b=function(a){this.redactor=a,this.$editor=a.$editor,this.init()};b.prototype={getTemplate:function(){return String()+'

'},init:function(){var b=this.redactor.button.addBefore("html","embed","Insert Embed Code"),c=this.redactor.button.get("embed");c.removeClass("redactor-btn-image").addClass("fa-redactor-btn"),c.html(''),this.redactor.button.addCallback(b,a.proxy(this.show,this))},show:function(){this.redactor.modal.addTemplate("insert-embed",this.getTemplate()),this.redactor.modal.addCallback("insert-embed",a.proxy(function(){this.redactor.selection.save(),setTimeout(function(){a("#embed-code-textarea").focus()},200)},this)),this.redactor.modal.load("insert-embed","Insert Embed",500),this.redactor.modal.createCancelButton();var b=this.redactor.modal.createActionButton("Insert");b.on("click",a.proxy(this.insert,this)),this.redactor.modal.show()},insert:function(){var b=a("#embed-code-textarea").val();this.redactor.modal.close(),this.redactor.selection.restore(),this.redactor.insert.html('
'+b+"
",!1),this.redactor.code.sync()}},window.RedactorPlugins.embed=function(){return{init:function(){this.embed=new b(this)}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a,this.toolbar={},this.init()};b.prototype={control:{up:{classSuffix:"arrow-up"},down:{classSuffix:"arrow-down"},"|":{classSuffix:"divider"},remove:{classSuffix:"delete"}},controlGroup:["up","down","remove"],init:function(){this.observeCaptions(),this.observeToolbars(),this.observeKeyboard()},observeCaptions:function(){this.redactor.$editor.on("click","figcaption:empty, cite:empty",a.proxy(function(b){a(b.target).prepend("
"),this.redactor.caret.setEnd(b.target),b.stopPropagation()},this)),a(window).on("click",a.proxy(this.cleanCaptions,this)),this.redactor.$editor.on("blur",a.proxy(this.cleanCaptions,this)),this.redactor.$editor.closest("form").one("submit",a.proxy(this.clearCaptions,this)),this.redactor.$editor.on("keydown",a.proxy(function(b){var c=a(this.redactor.selection.getCurrent()),d=!c.text().length,e=!!a(c).closest("figcaption, cite").length,f=a.inArray(b.keyCode,[this.redactor.keyCode.BACKSPACE,this.redactor.keyCode.DELETE])>=0;d&&f&&e&&b.preventDefault()},this))},cleanCaptions:function(){this.redactor.$editor.find("figcaption, cite").filter(function(){return!a(this).text()}).empty()},clearCaptions:function(){this.redactor.$editor.find("figcaption, cite").filter(function(){return!a(this).text()}).remove(),this.redactor.opts.visual&&this.redactor.code.sync()},showToolbar:function(b){var c=a(b.currentTarget),d=c.data("type")||"default";"image"===d&&(d="webhookImage");var e=this.getToolbar(d).data("figure",c).prependTo(c);this.redactor[d]&&this.redactor[d].onShow&&this.redactor[d].onShow(c,e)},hideToolbar:function(b){a(b.currentTarget).find(".wy-figure-controls").appendTo(this.redactor.$box)},observeToolbars:function(){this.redactor.$editor.on("mousedown",".wy-figure-controls",a.proxy(function(){event.preventDefault(),this.current=this.redactor.selection.getCurrent()},this)),this.redactor.$editor.on("click",".wy-figure-controls span, .wy-figure-controls a",a.proxy(function(b){b.stopPropagation();var c=a(b.currentTarget),d=c.data("command"),e=c.closest("figure"),f=e.data("type");"image"===f&&(f="webhookImage");var g=this.redactor[f];this.command(d,e,g)},this)),this.redactor.$editor.on("keydown",function(){a(this).find("figure").trigger("mouseleave")}),this.redactor.utils.isMobile()?(this.redactor.$editor.on("touchstart","figure",function(b){"FIGCAPTION"!==b.target.nodeName&&a(b.target).parents(".wy-figure-controls").length&&a(this).trigger("click",b)}),this.redactor.$editor.on("click","figure",a.proxy(function(a){"FIGCAPTION"!==a.target.nodeName&&this.redactor.$editor.trigger("blur"),this.showToolbar(a)},this))):(this.redactor.$editor.on("mouseenter","figure",a.proxy(this.showToolbar,this)),this.redactor.$editor.on("mouseleave","figure",a.proxy(this.hideToolbar,this)))},getToolbar:function(b){if(this.toolbar[b])return this.toolbar[b];var c=this.redactor[b]&&this.redactor[b].controlGroup||this.controlGroup,d=a.extend({},this.control,this.redactor[b]&&this.redactor[b].control||{}),e=this.buildControls(c,d),f=a('
').append(e);return this.toolbar[b]=f,f},buildControls:function(b,c){var d=a();return a.each(b,a.proxy(function(b,e){var f;"string"==typeof e?(f=c[e],d=d.add(a("",{"class":"wy-figure-controls-"+f.classSuffix,text:f.text}).data({command:e,control:f}))):"object"==typeof e&&a.each(e,a.proxy(function(b,e){var g=a("").text(" "+b).addClass("wy-figure-controls-table wy-dropdown");a('').appendTo(g);var h=a('
').appendTo(g);g.on("mouseover",function(){h.show()}),g.on("mouseout",function(){h.hide()}),a.each(e,a.proxy(function(b,d){f=c[d],"|"===d?a('
').appendTo(h):a("",{text:f.text}).data({command:d,control:f}).appendTo(a("
").appendTo(h))},this)),d=d.add(g)},this))},this)),d},command:function(b,c,d){switch(c.find(".wy-figure-controls").appendTo(this.redactor.$box),this.redactor.buffer.add(this.redactor.$editor.html()),b){case"up":c.prev().before(c);break;case"down":c.next().after(c);break;case"remove":c.remove();break;default:d&&d.command&&d.command(b,c,a(this.current))}this.redactor.code.sync()},observeKeyboard:function(){var a=this.redactor;a.$editor.on("keydown",function(b){var c=a.selection.getBlock();8===b.keyCode&&!a.caret.getOffset(c)&&c.previousSibling&&"FIGURE"===c.previousSibling.nodeName&&b.preventDefault()})}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.figure=function(){return{init:function(){this.figure=new b(this)}}}}(jQuery),function(a){"use strict";var b=function(b){this.redactor=b,this.$window=a(window),this.$window.on("scroll",a.proxy(this.checkOffset,this)),b.$box.on("scroll",a.proxy(this.checkOffset,this)),this.redactor.$editor.on("focus",a.proxy(function(){this.isFocused=!0},this)),this.redactor.$editor.on("blur",a.proxy(function(){this.isFocused=!1},this))};b.prototype={isFixed:!1,isFocused:!1,checkOffset:function(){var a=this.redactor.$box.offset(),b=a.top-this.$window.scrollTop()<=0,c=a.top+this.redactor.$box.outerHeight()-this.redactor.$toolbar.outerHeight()-this.$window.scrollTop()>=0;b&&c?this.fix():this.unfix()},fix:function(){if(this.isFixed)return void(this.redactor.utils.isMobile()&&this.isFocused&&this.redactor.$toolbar.css({position:"absolute",top:this.$window.scrollTop()-this.redactor.$box.offset().top,left:this.redactor.$box.offset().left}));var a=parseInt(this.redactor.$box.css("border-left-width").replace("px",""),10);this.redactor.$toolbar.css({position:"fixed",left:this.redactor.$box.offset().left+a,width:this.redactor.$box.width(),zIndex:300}),this.redactor.$editor.css("padding-top",this.redactor.$toolbar.height()+10),this.isFixed=!0},unfix:function(){this.isFixed&&(this.redactor.$toolbar.css({position:"relative",left:"",width:"",top:""}),this.redactor.$editor.css("padding-top",10),this.isFixed=!1)}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.fixedtoolbar=function(){return{init:function(){this.fixedtoolbar=new b(this)}}}}(jQuery),function(a){"use strict";var b=window.RedactorPlugins=window.RedactorPlugins||{};b.fullscreen=function(){return{init:function(){this.isFullscreen=!1;var a=this.button.add("fullscreen","Fullscreen");this.button.addCallback(a,this.fullscreen.toggleFullscreen),this.button.get("fullscreen").addClass("redactor_btn_fullscreen"),this.button.get("fullscreen").parent().addClass("redactor_btn_right"),this.opts.fullscreen&&this.fullscreen.toggleFullscreen()},toggleFullscreen:function(){var b;if(this.isFullscreen){this.selection.save(),this.button.removeIcon("fullscreen","normalscreen"),this.button.setInactive("fullscreen"),this.isFullscreen=!1,a(window).off("resize",a.proxy(this.fullscreen.fullScreenResize,this)),a("body, html").css("overflow",""),this.$box.removeClass("redactor_box_fullscreen").css({width:"auto",height:"auto"}),this.opts.iframe&&(b=this.$editor.html()),this.opts.iframe?this.fullscreen.fullscreenIframe(b):this.code.sync();var c=this.fsheight;this.opts.autoresize&&(c="auto"),this.opts.maxHeight&&this.$editor.css("max-height",this.opts.maxHeight),this.opts.toolbarExternal&&(this.$box.css("top",this.boxcss.top),this.$toolbar.css({width:this.toolcss.width,top:this.toolcss.top,position:this.toolcss.position})),this.opts.iframe&&this.$frame.css("height",c),this.focus.setStart(),this.observe.load(),a(document).scrollTop(this.oldScrollTop),this.selection.restore()}else this.selection.save(),this.fixedtoolbar&&this.fixedtoolbar.unfix(),this.button.changeIcon("fullscreen","normalscreen"),this.button.setActive("fullscreen"),this.isFullscreen=!0,this.opts.toolbarExternal&&(this.toolcss={},this.boxcss={},this.toolcss.width=this.$toolbar.css("width"),this.toolcss.top=this.$toolbar.css("top"),this.toolcss.position=this.$toolbar.css("position"),this.boxcss.top=this.$box.css("top")),this.fsheight=this.$editor.height(),this.opts.maxHeight&&this.$editor.css("max-height",""),this.opts.iframe&&(b=this.code.get()),this.$box.addClass("redactor_box_fullscreen"),a("body, html").css("overflow","hidden"),this.opts.iframe&&this.fullscreen.fullscreenIframe(b),this.fullscreen.fullScreenResize(),a(window).resize(a.proxy(this.fullscreen.fullScreenResize,this)),this.oldScrollTop=a(document).scrollTop(),a(document).scrollTop(0,0),this.focus.setStart(),this.observe.load(),this.selection.restore();a(window).trigger("scroll")},fullscreenIframe:function(a){this.$editor=this.$frame.contents().find("body"),this.$editor.attr({contenteditable:!0,dir:this.opts.direction}),this.$editor[0]&&(this.document=this.$editor[0].ownerDocument,this.window=this.document.defaultView||window),this.iframeAddCss(),this.opts.fullpage?this.setFullpageOnInit(a):this.code.set(a),this.opts.wym&&this.$editor.addClass("redactor_editor_wym")},fullScreenResize:function(){if(!this.isFullscreen)return!1;var b=this.$toolbar.height(),c=a(window).height()-b;this.$box.width(a(window).width()-2).height(c+b),this.opts.toolbarExternal&&(this.$toolbar.css({top:"0px",position:"absolute",width:"100%"}),this.$box.css("top",b+"px"))}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a,this.init()};b.prototype={control:{left:{classSuffix:"arrow-left"},right:{classSuffix:"arrow-right"},small:{classSuffix:"small",text:"S"},medium:{classSuffix:"medium",text:"M"},resize_full:{classSuffix:"resize-full"},resize_small:{classSuffix:"resize-small"}},controlGroup:["left","up","down","right","|","small","medium","resize_full","resize_small","remove"],init:function(){this.redactor.$editor.on("focus",a.proxy(this.addCaptions,this))},addCaptions:function(){this.redactor.$editor.find("figure[data-type=image]:not(:has(figcaption))").each(function(){a(this).append("
")})},onShow:function(a,b){b.children().removeClass("on"),a.hasClass("wy-figure-small")?(b.find(".wy-figure-controls-small").show().addClass("on"),b.find(".wy-figure-controls-medium").show(),b.find(".wy-figure-controls-resize-full").show(),b.find(".wy-figure-controls-resize-small").hide()):a.hasClass("wy-figure-medium")?(b.find(".wy-figure-controls-small").show(),b.find(".wy-figure-controls-medium").show().addClass("on"),b.find(".wy-figure-controls-resize-full").show(),b.find(".wy-figure-controls-resize-small").hide()):(b.find(".wy-figure-controls-small").hide(),b.find(".wy-figure-controls-medium").hide(),b.find(".wy-figure-controls-large").hide(),b.find(".wy-figure-controls-resize-full").hide(),b.find(".wy-figure-controls-resize-small").show()),a.hasClass("wy-figure-right")&&b.find(".wy-figure-controls-arrow-right").addClass("on"),a.hasClass("wy-figure-left")&&b.find(".wy-figure-controls-arrow-left").addClass("on")},command:function(b,c){var d=function(a,b,c,d){var e=(d?".":"")+"wy-figure-"+(c||"");return e+a.join((b||" ")+e)},e=function(b,e){c.removeClass(d(b)).addClass(d(e)),a.each(e,function(a,b){c.trigger("imageCommand",b)})};switch(b){case"left":case"right":e(["left","right"],[b]),c.hasClass("wy-figure-medium")||c.hasClass("wy-figure-small")||(c.addClass("wy-figure-medium"),c.trigger("medium"));break;case"small":case"medium":e(["small","medium","large"],[b]),c.hasClass("wy-figure-left")||c.hasClass("wy-figure-right")||(c.addClass("wy-figure-left"),c.trigger("left"));break;case"resize_full":e(["small","medium","left","right"],["large"]);break;case"resize_small":e(["small","large","right"],["medium","left"])}}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.webhookImage=function(){return{init:function(){this.webhookImage=new b(this)}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a,this.init()};b.prototype={control:{left:{classSuffix:"arrow-left"},right:{classSuffix:"arrow-right"},small:{classSuffix:"small",text:"S"},medium:{classSuffix:"medium",text:"M"},large:{classSuffix:"large",text:"L"},resizeFull:{classSuffix:"resize-full"},resizeSmall:{classSuffix:"resize-small"}},controlGroup:["left","up","down","right","|","small","medium","large","resizeFull","resizeSmall","remove"],init:function(){this.redactor.$editor.on("focus",a.proxy(this.addCites,this)),this.observe()},addCites:function(){this.redactor.$editor.find("figure[data-type=quote] blockquote:not(:has(cite))").each(function(){a(this).append("")})},observe:function(){this.redactor.$editor.on("mutate",a.proxy(this.orphanCheck,this))},orphanCheck:function(){this.redactor.$editor.find("blockquote").filter(function(){return!a(this).parents("figure").length}).each(function(){a('
').insertBefore(this).prepend(a(this).append(""))})},onShow:function(a,b){b.children().removeClass("on"),a.hasClass("wy-figure-medium")?b.find(".wy-figure-controls-medium").addClass("on"):a.hasClass("wy-figure-large")?b.find(".wy-figure-controls-large").addClass("on"):b.find(".wy-figure-controls-small").addClass("on"),a.hasClass("wy-figure-left")?(b.find(".wy-figure-controls-arrow-left").addClass("on"),b.find(".wy-figure-controls-resize-small").hide(),b.find(".wy-figure-controls-resize-full").show()):a.hasClass("wy-figure-right")?(b.find(".wy-figure-controls-arrow-right").addClass("on"),b.find(".wy-figure-controls-resize-small").hide(),b.find(".wy-figure-controls-resize-full").show()):(b.find(".wy-figure-controls-resize-small").show(),b.find(".wy-figure-controls-resize-full").hide())},command:function(a,b){switch(a){case"left":b.removeClass("wy-figure-right").addClass("wy-figure-left");break;case"right":b.removeClass("wy-figure-left").addClass("wy-figure-right");break;case"resize_full":b.removeClass("wy-figure-left wy-figure-right");break;case"resize_small":b.addClass("wy-figure-left");break;case"small":b.removeClass("wy-figure-medium wy-figure-large").addClass("wy-figure-small");break;case"medium":b.removeClass("wy-figure-small wy-figure-large").addClass("wy-figure-medium");break;case"large":b.removeClass("wy-figure-small wy-figure-medium").addClass("wy-figure-large")}},toggle:function(){this.redactor.block.format("blockquote");var b=a(this.redactor.selection.getBlock()||this.redactor.selection.getCurrent());b.is("blockquote")?a('
').insertBefore(b).prepend(b.append("")):(b.closest("figure").before(b).remove(),b.find("cite").remove()),this.redactor.code.sync()}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.quote=function(){return{init:function(){this.quote=new b(this);var c=this.button.addBefore("link","quote","Quote");this.button.addCallback(c,a.proxy(this.quote.toggle,this.quote)),this.button.get("quote").addClass("redactor_btn_quote")}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a};b.prototype={control:{rowUp:{text:"Add row above"},rowDown:{text:"Add row below"},colLeft:{text:"Add column left"},colRight:{text:"Add column right"},addHead:{text:"Add header"},delHead:{text:"Delete header"},delCol:{text:"Delete column"},delRow:{text:"Delete row"},delTable:{text:"Delete table"},stripe:{text:"Striped row"},border:{text:"Borders on rows"},fullBorder:{text:"Borders everywhere"}},controlGroup:["up","down","|",{"Table Options":["rowUp","rowDown","colLeft","colRight","|","addHead","delHead","|","delCol","delRow","delTable","|","border","stripe","fullBorder"]},"remove"],insertTable:function(b,c){this.redactor.buffer.set(!1);var d,e,f,g,h=a("
"),i=Math.floor(99999*Math.random()),j=a(''),k=a("").appendTo(j),l=a("").appendTo(j);for(e=a("").appendTo(k),f=0;c>f;f++)a("").appendTo(e);for(d=0;b>d;d++){for(e=a(""),f=0;c>f;f++)g=a(""),0===d&&0===f&&g.append(''+this.redactor.opts.invisibleSpace+""),a(e).append(g);l.append(e)}a('
').addClass("wy-table wy-table-bordered-rows").append(j).appendTo(h);var m=h.html();this.redactor.modal.close(),this.redactor.selection.restore();var n=this.redactor.selection.getBlock()||this.redactor.selection.getCurrent();n?a(n).after(m):this.redactor.insert.html(m,!1),this.redactor.selection.restore();var o=this.redactor.$editor.find("#table"+i);o.find("span#selection-marker-1").remove(),o.removeAttr("id"),this.redactor.code.sync()},command:function(b,c,d){switch(b){case"rowUp":case"rowDown":a.proxy(function(){var c,e=d.closest("tr"),f=a("
");for(c=0;c").text("Data").appendTo(f);"rowUp"===b?f.insertBefore(e):f.insertAfter(e)},this)();break;case"colLeft":case"colRight":a.proxy(function(){var c=d.closest("td"),e=c.closest("tr"),f=e.closest("table"),g=e.children().index(c)+1,h="colLeft"===b?"before":"after";f.find("thead tr").children(":nth-child("+g+")")[h](a("").prependTo(d),f=a("").appendTo(e),g=0;b>g;g++)a("
Header
Data
").text("Header")),f.find("tbody tr").children(":nth-child("+g+")")[h](a("").text("Data"))},this)();break;case"addHead":c.find("table thead").length||a.proxy(function(){for(var b=c.find("tr").first().children().length,d=c.find("table"),e=a("
").text("Header").appendTo(f)},this)();break;case"delHead":c.find("thead").remove();break;case"delCol":a.proxy(function(){var a=d.closest("td"),b=a.parent().children().index(a)+1;a.closest("table").find("tr").children(":nth-child("+b+")").remove()},this)();break;case"delRow":d.closest("tr").remove();break;case"delTable":c.remove();break;case"border":c.removeClass("wy-table-bordered-all").toggleClass("wy-table-bordered-rows");break;case"stripe":c.toggleClass("wy-table-striped");break;case"fullBorder":c.removeClass("wy-table-bordered-rows").toggleClass("wy-table-bordered-all")}}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.table=function(){return{init:function(){this.table=new b(this);var c=this.button.addBefore("link","table","Table");this.button.addCallback(c,a.proxy(function(){this.selection.save();var b=a.proxy(function(){a(".redactor_insert_table_close_btn").on("click",a.proxy(function(){this.button.setInactive("table")},this)),setTimeout(function(){a("#redactor_table_rows").trigger("focus")},200)},this),c=String()+"
';this.modal.addTemplate("insert-table",c),this.modal.addCallback("insert-table",b),this.modal.load("insert-table","Insert Table",500),this.modal.createCancelButton();var d=this.modal.createActionButton("Insert");d.on("click",a.proxy(function(){this.table.insertTable(a("#redactor_table_rows").val(),a("#redactor_table_columns").val()),this.button.setInactive("table")},this)),this.modal.show()},this)),this.button.get("table").addClass("redactor_btn_table")}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a,this.init()};b.prototype={control:{resizeFull:{classSuffix:"resize-full"},resizeSmall:{classSuffix:"resize-small"}},controlGroup:["up","down","|","resizeFull","resizeSmall","remove"],init:function(){},onShow:function(a,b){a.hasClass("wy-figure-full")?(b.find(".wy-figure-controls-resize-full").hide(),b.find(".wy-figure-controls-resize-small").show()):(b.find(".wy-figure-controls-resize-full").show(),b.find(".wy-figure-controls-resize-small").hide())},command:function(a,b){"resizeFull"===a?b.addClass("wy-figure-full"):"resizeSmall"===a&&b.removeClass("wy-figure-full")}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.video=function(){return{init:function(){this.video=new b(this);var c=function(b){this.buffer.set(),b='

'+b+"

",this.selection.restore();var c=this.selection.getBlock()||this.selection.getCurrent();c?a(c).after(b):this.insert.html(b,!1),this.code.sync(),this.modal.close()},d=/(http|https):\/\/[\w\-]+(\.[\w\-]+)+([\w.,@?\^=%&:\/~+#\-]*[\w@?\^=%&\/~+#\-])?/,e=this.button.addBefore("link","video","Video");this.button.addCallback(e,a.proxy(function(){var b=a.proxy(function(){this.selection.save(),setTimeout(function(){a("#redactor_insert_video_area").focus()},200)},this),e=String()+'
';this.modal.addTemplate("insert-video",e),this.modal.addCallback("insert-video",b),this.modal.load("insert-video","Insert Video",500),this.modal.createCancelButton();var f=this.modal.createActionButton("Insert");f.on("click",a.proxy(function(){var b=a.trim(a("#redactor_insert_video_area").val());d.test(b)?a.embedly.oembed(b).done(a.proxy(function(b){a.each(b,a.proxy(function(a,b){c.call(this,b.html)},this))},this)):c.call(this,b)},this)),this.modal.show()},this)),this.button.get("video").addClass("redactor_btn_video")}}}}(jQuery),function(a){"use strict";a.fn.webhookRedactor=function(b){return this.redactor("string"==typeof b?b:a.extend({},a.webhookRedactor.options,b))},a.webhookRedactor=function(b){return a.extend({},a.webhookRedactor.options,b)},a.webhookRedactor.options={imageEditable:!1,buttons:["formatting","bold","italic","unorderedlist","orderedlist","link","html"],buttonSource:!0,convertLinks:!1,dragImageUpload:!1,dragFileUpload:!1,toolbarFixed:!1,formatting:[],formattingAdd:[{tag:"p",title:"Normal text"},{tag:"h1",title:"Header 1"},{tag:"h2",title:"Header 2"},{tag:"h3",title:"Header 3"},{tag:"h4",title:"Header 4"},{tag:"h5",title:"Header 5"},{tag:"code",title:"Inline Code"},{tag:"pre",title:"Code Block"}],deniedTags:["html","head","body"],plugins:["fullscreen","fixedtoolbar","autoembedly","figure","video","webhookImage","table","quote","embed"],initCallback:function(){this.modal.setDraggable=function(){},a.each(this.opts.buttons,a.proxy(function(a,b){this.button.get(b).addClass("redactor_btn_"+b)},this)),this.$element.closest("form").one("submit",a.proxy(function(){this.opts.visual&&this.code.sync()},this));var b=this;this.$editor.on("paste",function(){setTimeout(function(){b.$editor.find("[dir]").removeAttr("dir")},5)}),this.$element.trigger("init.webhookRedactor",this.core.getObject()),this.$editor.find("figure[data-type=video]:not(:has(figcaption))").each(function(){a(this).append("
")}),this.$editor.find("figure[data-type=quote] blockquote:not(:has(cite))").each(function(){a(this).append("")}),this.$editor.find("figure[data-type=image]:not(:has(figcaption))").each(function(){a(this).append("
")}),this.$editor.find("figure[data-type=embed]:not(:has(figcaption))").each(function(){a(this).append("
")})},changeCallback:function(){var a="p, h1, h2, h3, h4, h5";this.$editor.children(":first-child").is(a)||this.$editor.prepend("


"),this.$editor.children(":last-child").is(a)||this.$editor.append("


"),this.$editor.trigger("mutate"),this.$element.trigger("mutate.webhookRedactor",this.core.getObject())}}}(jQuery); \ No newline at end of file +* Copyright (c) 2016 Mike Horn; Licensed MIT */ +!function(a){"use strict";window.RedactorPlugins=window.RedactorPlugins||{},a.embedly.defaults.key="65874c90af644c6a8f0b7072fe857811",a.embedly.defaults.query={maxwidth:640};var b=function(a){this.redactor=a,this.$editor=a.$editor,this.observe()};b.prototype={urlRegex:/((http:\/\/(.*youtube\.com\/watch.*|.*\.youtube\.com\/v\/.*|youtu\.be\/.*|.*\.youtube\.com\/user\/.*|.*\.youtube\.com\/.*#.*\/.*|m\.youtube\.com\/watch.*|m\.youtube\.com\/index.*|.*\.youtube\.com\/profile.*|.*\.youtube\.com\/view_play_list.*|.*\.youtube\.com\/playlist.*|www\.vimeo\.com\/groups\/.*\/videos\/.*|www\.vimeo\.com\/.*|vimeo\.com\/groups\/.*\/videos\/.*|vimeo\.com\/.*|vimeo\.com\/m\/#\/.*|player\.vimeo\.com\/.*))|(https:\/\/(.*youtube\.com\/watch.*|.*\.youtube\.com\/v\/.*|www\.vimeo\.com\/.*|vimeo\.com\/.*|player\.vimeo\.com\/.*)))/i,observe:function(){this.redactor.$editor.on("keyup.redactor",a.proxy(function(a){a.which===this.redactor.keyCode.ENTER&&this.checkNode(this.redactor.$editor.get(0))},this))},checkNode:function(b){return a.each(b.childNodes,a.proxy(function(b,c){if(3===c.nodeType&&c.nodeValue&&this.urlRegex.test(c.nodeValue)){this.redactor.buffer.set();var d=c.nodeValue.match(this.urlRegex)[0],e=a("loading embed...");c.nodeValue=c.nodeValue.replace(this.urlRegex,""),a(c).parentsUntil(this.$editor).last().after(e),a.embedly.oembed(d).done(function(b){a.each(b,function(){this.html?e.replaceWith('
'+this.html+"
"):e.replaceWith(a("

").text(d))})})}else 1!==c.nodeType||/^(a|button|textarea)$/i.test(c.tagName)||this.checkNode(c)},this)),this.matches}},window.RedactorPlugins.autoembedly=function(){return{init:function(){this.autoembedly=new b(this)}}}}(jQuery),function(a){"use strict";window.RedactorPlugins||(window.RedactorPlugins={});var b=function(a){this.redactor=a,this.$editor=a.$editor,this.init()};b.prototype={getTemplate:function(){return String()+'

'},init:function(){var b=this.redactor.button.addBefore("html","embed","Insert Embed Code"),c=this.redactor.button.get("embed");c.removeClass("redactor-btn-image").addClass("fa-redactor-btn"),c.html(''),this.redactor.button.addCallback(b,a.proxy(this.show,this))},show:function(){this.redactor.modal.addTemplate("insert-embed",this.getTemplate()),this.redactor.modal.addCallback("insert-embed",a.proxy(function(){this.redactor.selection.save(),setTimeout(function(){a("#embed-code-textarea").focus()},200)},this)),this.redactor.modal.load("insert-embed","Insert Embed",500),this.redactor.modal.createCancelButton();var b=this.redactor.modal.createActionButton("Insert");b.on("click",a.proxy(this.insert,this)),this.redactor.modal.show()},insert:function(){var b=a("#embed-code-textarea").val();this.redactor.modal.close(),this.redactor.selection.restore(),this.redactor.insert.html('
'+b+"
",!1),this.redactor.code.sync()}},window.RedactorPlugins.embed=function(){return{init:function(){this.embed=new b(this)}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a,this.toolbar={},this.init()};b.prototype={control:{up:{classSuffix:"arrow-up"},down:{classSuffix:"arrow-down"},"|":{classSuffix:"divider"},remove:{classSuffix:"delete"}},controlGroup:["up","down","remove"],init:function(){this.observeCaptions(),this.observeToolbars(),this.observeKeyboard()},observeCaptions:function(){this.redactor.$editor.on("click","figcaption:empty, cite:empty",a.proxy(function(b){a(b.target).prepend("
"),this.redactor.caret.setEnd(b.target),b.stopPropagation()},this)),a(window).on("click",a.proxy(this.cleanCaptions,this)),this.redactor.$editor.on("blur",a.proxy(this.cleanCaptions,this)),this.redactor.$editor.closest("form").one("submit",a.proxy(this.clearCaptions,this)),this.redactor.$editor.on("keydown",a.proxy(function(b){var c=a(this.redactor.selection.getCurrent()),d=!c.text().length,e=!!a(c).closest("figcaption, cite").length,f=a.inArray(b.keyCode,[this.redactor.keyCode.BACKSPACE,this.redactor.keyCode.DELETE])>=0;d&&f&&e&&b.preventDefault()},this))},cleanCaptions:function(){this.redactor.$editor.find("figcaption, cite").filter(function(){return!a(this).text()}).empty()},clearCaptions:function(){this.redactor.$editor.find("figcaption, cite").filter(function(){return!a(this).text()}).remove(),this.redactor.opts.visual&&this.redactor.code.sync()},showToolbar:function(b){var c=a(b.currentTarget),d=c.data("type")||"default";"image"===d&&(d="webhookImage");var e=this.getToolbar(d).data("figure",c).prependTo(c);this.redactor[d]&&this.redactor[d].onShow&&this.redactor[d].onShow(c,e)},hideToolbar:function(b){a(b.currentTarget).find(".wy-figure-controls").appendTo(this.redactor.$box)},observeToolbars:function(){this.redactor.$editor.on("mousedown",".wy-figure-controls",a.proxy(function(){event.preventDefault(),this.current=this.redactor.selection.getCurrent()},this)),this.redactor.$editor.on("click",".wy-figure-controls span, .wy-figure-controls a",a.proxy(function(b){b.stopPropagation();var c=a(b.currentTarget),d=c.data("command"),e=c.closest("figure"),f=e.data("type");"image"===f&&(f="webhookImage");var g=this.redactor[f];this.command(d,e,g)},this)),this.redactor.$editor.on("keydown",function(){a(this).find("figure").trigger("mouseleave")}),this.redactor.utils.isMobile()?(this.redactor.$editor.on("touchstart","figure",function(b){"FIGCAPTION"!==b.target.nodeName&&a(b.target).parents(".wy-figure-controls").length&&a(this).trigger("click",b)}),this.redactor.$editor.on("click","figure",a.proxy(function(a){"FIGCAPTION"!==a.target.nodeName&&this.redactor.$editor.trigger("blur"),this.showToolbar(a)},this))):(this.redactor.$editor.on("mouseenter","figure",a.proxy(this.showToolbar,this)),this.redactor.$editor.on("mouseleave","figure",a.proxy(this.hideToolbar,this)))},getToolbar:function(b){if(this.toolbar[b])return this.toolbar[b];var c=this.redactor[b]&&this.redactor[b].controlGroup||this.controlGroup,d=a.extend({},this.control,this.redactor[b]&&this.redactor[b].control||{}),e=this.buildControls(c,d),f=a('
').append(e);return this.toolbar[b]=f,f},buildControls:function(b,c){var d=a();return a.each(b,a.proxy(function(b,e){var f;"string"==typeof e?(f=c[e],d=d.add(a("",{"class":"wy-figure-controls-"+f.classSuffix,text:f.text}).data({command:e,control:f}))):"object"==typeof e&&a.each(e,a.proxy(function(b,e){var g=a("").text(" "+b).addClass("wy-figure-controls-table wy-dropdown");a('').appendTo(g);var h=a('
').appendTo(g);g.on("mouseover",function(){h.show()}),g.on("mouseout",function(){h.hide()}),a.each(e,a.proxy(function(b,d){f=c[d],"|"===d?a('
').appendTo(h):a("",{text:f.text}).data({command:d,control:f}).appendTo(a("
").appendTo(h))},this)),d=d.add(g)},this))},this)),d},command:function(b,c,d){switch(c.find(".wy-figure-controls").appendTo(this.redactor.$box),this.redactor.buffer.add(this.redactor.$editor.html()),b){case"up":c.prev().before(c);break;case"down":c.next().after(c);break;case"remove":c.remove();break;default:d&&d.command&&d.command(b,c,a(this.current))}this.redactor.code.sync()},observeKeyboard:function(){var a=this.redactor;a.$editor.on("keydown",function(b){var c=a.selection.getBlock();8===b.keyCode&&!a.caret.getOffset(c)&&c.previousSibling&&"FIGURE"===c.previousSibling.nodeName&&b.preventDefault()})}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.figure=function(){return{init:function(){this.figure=new b(this)}}}}(jQuery),function(a){"use strict";var b=function(b){this.redactor=b,this.$window=a(window),this.$window.on("scroll",a.proxy(this.checkOffset,this)),b.$box.on("scroll",a.proxy(this.checkOffset,this)),this.redactor.$editor.on("focus",a.proxy(function(){this.isFocused=!0},this)),this.redactor.$editor.on("blur",a.proxy(function(){this.isFocused=!1},this))};b.prototype={isFixed:!1,isFocused:!1,checkOffset:function(){var a=this.redactor.$box.offset(),b=a.top-this.$window.scrollTop()<=0,c=a.top+this.redactor.$box.outerHeight()-this.redactor.$toolbar.outerHeight()-this.$window.scrollTop()>=0;b&&c?this.fix():this.unfix()},fix:function(){if(this.isFixed)return void(this.redactor.utils.isMobile()&&this.isFocused&&this.redactor.$toolbar.css({position:"absolute",top:this.$window.scrollTop()-this.redactor.$box.offset().top,left:this.redactor.$box.offset().left}));var a=parseInt(this.redactor.$box.css("border-left-width").replace("px",""),10);this.redactor.$toolbar.css({position:"fixed",left:this.redactor.$box.offset().left+a,width:this.redactor.$box.width(),zIndex:300}),this.redactor.$editor.css("padding-top",this.redactor.$toolbar.height()+10),this.isFixed=!0},unfix:function(){this.isFixed&&(this.redactor.$toolbar.css({position:"relative",left:"",width:"",top:""}),this.redactor.$editor.css("padding-top",10),this.isFixed=!1)}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.fixedtoolbar=function(){return{init:function(){this.fixedtoolbar=new b(this)}}}}(jQuery),function(a){"use strict";var b=window.RedactorPlugins=window.RedactorPlugins||{};b.fullscreen=function(){return{init:function(){this.isFullscreen=!1;var a=this.button.add("fullscreen","Fullscreen");this.button.addCallback(a,this.fullscreen.toggleFullscreen),this.button.get("fullscreen").addClass("redactor_btn_fullscreen"),this.button.get("fullscreen").parent().addClass("redactor_btn_right"),this.opts.fullscreen&&this.fullscreen.toggleFullscreen()},toggleFullscreen:function(){var b;if(this.isFullscreen){this.selection.save(),this.button.removeIcon("fullscreen","normalscreen"),this.button.setInactive("fullscreen"),this.isFullscreen=!1,a(window).off("resize",a.proxy(this.fullscreen.fullScreenResize,this)),a("body, html").css("overflow",""),this.$box.removeClass("redactor_box_fullscreen").css({width:"auto",height:"auto"}),this.opts.iframe&&(b=this.$editor.html()),this.opts.iframe?this.fullscreen.fullscreenIframe(b):this.code.sync();var c=this.fsheight;this.opts.autoresize&&(c="auto"),this.opts.maxHeight&&this.$editor.css("max-height",this.opts.maxHeight),this.opts.toolbarExternal&&(this.$box.css("top",this.boxcss.top),this.$toolbar.css({width:this.toolcss.width,top:this.toolcss.top,position:this.toolcss.position})),this.opts.iframe&&this.$frame.css("height",c),this.focus.setStart(),this.observe.load(),a(document).scrollTop(this.oldScrollTop),this.selection.restore()}else this.selection.save(),this.fixedtoolbar&&this.fixedtoolbar.unfix(),this.button.changeIcon("fullscreen","normalscreen"),this.button.setActive("fullscreen"),this.isFullscreen=!0,this.opts.toolbarExternal&&(this.toolcss={},this.boxcss={},this.toolcss.width=this.$toolbar.css("width"),this.toolcss.top=this.$toolbar.css("top"),this.toolcss.position=this.$toolbar.css("position"),this.boxcss.top=this.$box.css("top")),this.fsheight=this.$editor.height(),this.opts.maxHeight&&this.$editor.css("max-height",""),this.opts.iframe&&(b=this.code.get()),this.$box.addClass("redactor_box_fullscreen"),a("body, html").css("overflow","hidden"),this.opts.iframe&&this.fullscreen.fullscreenIframe(b),this.fullscreen.fullScreenResize(),a(window).resize(a.proxy(this.fullscreen.fullScreenResize,this)),this.oldScrollTop=a(document).scrollTop(),a(document).scrollTop(0,0),this.focus.setStart(),this.observe.load(),this.selection.restore();a(window).trigger("scroll")},fullscreenIframe:function(a){this.$editor=this.$frame.contents().find("body"),this.$editor.attr({contenteditable:!0,dir:this.opts.direction}),this.$editor[0]&&(this.document=this.$editor[0].ownerDocument,this.window=this.document.defaultView||window),this.iframeAddCss(),this.opts.fullpage?this.setFullpageOnInit(a):this.code.set(a),this.opts.wym&&this.$editor.addClass("redactor_editor_wym")},fullScreenResize:function(){if(!this.isFullscreen)return!1;var b=this.$toolbar.height(),c=a(window).height()-b;this.$box.width(a(window).width()-2).height(c+b),this.opts.toolbarExternal&&(this.$toolbar.css({top:"0px",position:"absolute",width:"100%"}),this.$box.css("top",b+"px"))}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a,this.init()};b.prototype={control:{left:{classSuffix:"arrow-left"},right:{classSuffix:"arrow-right"},small:{classSuffix:"small",text:"S"},medium:{classSuffix:"medium",text:"M"},large:{classSuffix:"large",text:"L"},resize_full:{classSuffix:"resize-full"},resize_small:{classSuffix:"resize-small"}},controlGroup:["left","up","down","right","|","small","medium","large","resize_full","resize_small","remove"],init:function(){this.redactor.$editor.on("focus",a.proxy(this.addCaptions,this))},addCaptions:function(){this.redactor.$editor.find("figure[data-type=image]:not(:has(figcaption))").each(function(){a(this).append("
")})},onShow:function(a,b){b.children().removeClass("on"),a.hasClass("wy-figure-small")?(b.find(".wy-figure-controls-small").show().addClass("on"),b.find(".wy-figure-controls-medium").show(),b.find(".wy-figure-controls-large").show(),b.find(".wy-figure-controls-resize-full").show(),b.find(".wy-figure-controls-resize-small").hide()):a.hasClass("wy-figure-medium")?(b.find(".wy-figure-controls-small").show(),b.find(".wy-figure-controls-medium").show().addClass("on"),b.find(".wy-figure-controls-large").show(),b.find(".wy-figure-controls-resize-full").show(),b.find(".wy-figure-controls-resize-small").hide()):a.hasClass("wy-figure-large")?(b.find(".wy-figure-controls-small").show(),b.find(".wy-figure-controls-medium").show(),b.find(".wy-figure-controls-large").show().addClass("on"),b.find(".wy-figure-controls-resize-full").show(),b.find(".wy-figure-controls-resize-small").hide()):(b.find(".wy-figure-controls-small").hide(),b.find(".wy-figure-controls-medium").hide(),b.find(".wy-figure-controls-large").hide(),b.find(".wy-figure-controls-resize-full").hide(),b.find(".wy-figure-controls-resize-small").show()),a.hasClass("wy-figure-right")&&b.find(".wy-figure-controls-arrow-right").addClass("on"),a.hasClass("wy-figure-left")&&b.find(".wy-figure-controls-arrow-left").addClass("on")},command:function(b,c){var d=function(a,b,c,d){var e=(d?".":"")+"wy-figure-"+(c||"");return e+a.join((b||" ")+e)},e=function(b,e){c.removeClass(d(b)).addClass(d(e)),a.each(e,function(a,b){c.trigger("imageCommand",b)})};switch(b){case"left":case"right":e(["left","right"],[b]),c.hasClass("wy-figure-medium")||c.hasClass("wy-figure-small")||(c.addClass("wy-figure-medium"),c.trigger("medium"));break;case"small":case"medium":case"large":e(["small","medium","large","full"],[b]),c.hasClass("wy-figure-left")||c.hasClass("wy-figure-right")||(c.addClass("wy-figure-left"),c.trigger("left"));break;case"resize_full":e(["small","medium","large","left","right"],["full"]);break;case"resize_small":e(["small","medium","full","right"],["large","left"])}}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.webhookImage=function(){return{init:function(){this.webhookImage=new b(this)}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a,this.init()};b.prototype={control:{left:{classSuffix:"arrow-left"},right:{classSuffix:"arrow-right"},small:{classSuffix:"small",text:"S"},medium:{classSuffix:"medium",text:"M"},large:{classSuffix:"large",text:"L"},resizeFull:{classSuffix:"resize-full"},resizeSmall:{classSuffix:"resize-small"}},controlGroup:["left","up","down","right","|","small","medium","large","resizeFull","resizeSmall","remove"],init:function(){this.redactor.$editor.on("focus",a.proxy(this.addCites,this)),this.observe()},addCites:function(){this.redactor.$editor.find("figure[data-type=quote] blockquote:not(:has(cite))").each(function(){a(this).append("")})},observe:function(){this.redactor.$editor.on("mutate",a.proxy(this.orphanCheck,this))},orphanCheck:function(){this.redactor.$editor.find("blockquote").filter(function(){return!a(this).parents("figure").length}).each(function(){a('
').insertBefore(this).prepend(a(this).append(""))})},onShow:function(a,b){b.children().removeClass("on"),a.hasClass("wy-figure-medium")?b.find(".wy-figure-controls-medium").addClass("on"):a.hasClass("wy-figure-large")?b.find(".wy-figure-controls-large").addClass("on"):b.find(".wy-figure-controls-small").addClass("on"),a.hasClass("wy-figure-left")?(b.find(".wy-figure-controls-arrow-left").addClass("on"),b.find(".wy-figure-controls-resize-small").hide(),b.find(".wy-figure-controls-resize-full").show()):a.hasClass("wy-figure-right")?(b.find(".wy-figure-controls-arrow-right").addClass("on"),b.find(".wy-figure-controls-resize-small").hide(),b.find(".wy-figure-controls-resize-full").show()):(b.find(".wy-figure-controls-resize-small").show(),b.find(".wy-figure-controls-resize-full").hide())},command:function(a,b){switch(a){case"left":b.removeClass("wy-figure-right").addClass("wy-figure-left");break;case"right":b.removeClass("wy-figure-left").addClass("wy-figure-right");break;case"resize_full":b.removeClass("wy-figure-left wy-figure-right");break;case"resize_small":b.addClass("wy-figure-left");break;case"small":b.removeClass("wy-figure-medium wy-figure-large").addClass("wy-figure-small");break;case"medium":b.removeClass("wy-figure-small wy-figure-large").addClass("wy-figure-medium");break;case"large":b.removeClass("wy-figure-small wy-figure-medium").addClass("wy-figure-large")}},toggle:function(){this.redactor.block.format("blockquote");var b=a(this.redactor.selection.getBlock()||this.redactor.selection.getCurrent());b.is("blockquote")?a('
').insertBefore(b).prepend(b.append("")):(b.closest("figure").before(b).remove(),b.find("cite").remove()),this.redactor.code.sync()}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.quote=function(){return{init:function(){this.quote=new b(this);var c=this.button.addBefore("link","quote","Quote");this.button.addCallback(c,a.proxy(this.quote.toggle,this.quote)),this.button.get("quote").addClass("redactor_btn_quote")}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a};b.prototype={control:{rowUp:{text:"Add row above"},rowDown:{text:"Add row below"},colLeft:{text:"Add column left"},colRight:{text:"Add column right"},addHead:{text:"Add header"},delHead:{text:"Delete header"},delCol:{text:"Delete column"},delRow:{text:"Delete row"},delTable:{text:"Delete table"},stripe:{text:"Striped row"},border:{text:"Borders on rows"},fullBorder:{text:"Borders everywhere"}},controlGroup:["up","down","|",{"Table Options":["rowUp","rowDown","colLeft","colRight","|","addHead","delHead","|","delCol","delRow","delTable","|","border","stripe","fullBorder"]},"remove"],insertTable:function(b,c){this.redactor.buffer.set(!1);var d,e,f,g,h=a("
"),i=Math.floor(99999*Math.random()),j=a(''),k=a("").appendTo(j),l=a("").appendTo(j);for(e=a("").appendTo(k),f=0;c>f;f++)a("").appendTo(e);for(d=0;b>d;d++){for(e=a(""),f=0;c>f;f++)g=a(""),0===d&&0===f&&g.append(''+this.redactor.opts.invisibleSpace+""),a(e).append(g);l.append(e)}a('
').addClass("wy-table wy-table-bordered-rows").append(j).appendTo(h);var m=h.html();this.redactor.modal.close(),this.redactor.selection.restore();var n=this.redactor.selection.getBlock()||this.redactor.selection.getCurrent();n?a(n).after(m):this.redactor.insert.html(m,!1),this.redactor.selection.restore();var o=this.redactor.$editor.find("#table"+i);o.find("span#selection-marker-1").remove(),o.removeAttr("id"),this.redactor.code.sync()},command:function(b,c,d){switch(b){case"rowUp":case"rowDown":a.proxy(function(){var c,e=d.closest("tr"),f=a("
");for(c=0;c").text("Data").appendTo(f);"rowUp"===b?f.insertBefore(e):f.insertAfter(e)},this)();break;case"colLeft":case"colRight":a.proxy(function(){var c=d.closest("td"),e=c.closest("tr"),f=e.closest("table"),g=e.children().index(c)+1,h="colLeft"===b?"before":"after";f.find("thead tr").children(":nth-child("+g+")")[h](a("").prependTo(d),f=a("").appendTo(e),g=0;b>g;g++)a("
Header
Data
").text("Header")),f.find("tbody tr").children(":nth-child("+g+")")[h](a("").text("Data"))},this)();break;case"addHead":c.find("table thead").length||a.proxy(function(){for(var b=c.find("tr").first().children().length,d=c.find("table"),e=a("
").text("Header").appendTo(f)},this)();break;case"delHead":c.find("thead").remove();break;case"delCol":a.proxy(function(){var a=d.closest("td"),b=a.parent().children().index(a)+1;a.closest("table").find("tr").children(":nth-child("+b+")").remove()},this)();break;case"delRow":d.closest("tr").remove();break;case"delTable":c.remove();break;case"border":c.removeClass("wy-table-bordered-all").toggleClass("wy-table-bordered-rows");break;case"stripe":c.toggleClass("wy-table-striped");break;case"fullBorder":c.removeClass("wy-table-bordered-rows").toggleClass("wy-table-bordered-all")}}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.table=function(){return{init:function(){this.table=new b(this);var c=this.button.addBefore("link","table","Table");this.button.addCallback(c,a.proxy(function(){this.selection.save();var b=a.proxy(function(){a(".redactor_insert_table_close_btn").on("click",a.proxy(function(){this.button.setInactive("table")},this)),setTimeout(function(){a("#redactor_table_rows").trigger("focus")},200)},this),c=String()+"
';this.modal.addTemplate("insert-table",c),this.modal.addCallback("insert-table",b),this.modal.load("insert-table","Insert Table",500),this.modal.createCancelButton();var d=this.modal.createActionButton("Insert");d.on("click",a.proxy(function(){this.table.insertTable(a("#redactor_table_rows").val(),a("#redactor_table_columns").val()),this.button.setInactive("table")},this)),this.modal.show()},this)),this.button.get("table").addClass("redactor_btn_table")}}}}(jQuery),function(a){"use strict";var b=function(a){this.redactor=a,this.init()};b.prototype={control:{resizeFull:{classSuffix:"resize-full"},resizeSmall:{classSuffix:"resize-small"}},controlGroup:["up","down","|","resizeFull","resizeSmall","remove"],init:function(){},onShow:function(a,b){a.hasClass("wy-figure-full")?(b.find(".wy-figure-controls-resize-full").hide(),b.find(".wy-figure-controls-resize-small").show()):(b.find(".wy-figure-controls-resize-full").show(),b.find(".wy-figure-controls-resize-small").hide())},command:function(a,b){"resizeFull"===a?b.addClass("wy-figure-full"):"resizeSmall"===a&&b.removeClass("wy-figure-full")}},window.RedactorPlugins=window.RedactorPlugins||{},window.RedactorPlugins.video=function(){return{init:function(){this.video=new b(this);var c=function(b){this.buffer.set(),b='

'+b+"

",this.selection.restore();var c=this.selection.getBlock()||this.selection.getCurrent();c?a(c).after(b):this.insert.html(b,!1),this.code.sync(),this.modal.close()},d=/(http|https):\/\/[\w\-]+(\.[\w\-]+)+([\w.,@?\^=%&:\/~+#\-]*[\w@?\^=%&\/~+#\-])?/,e=this.button.addBefore("link","video","Video");this.button.addCallback(e,a.proxy(function(){var b=a.proxy(function(){this.selection.save(),setTimeout(function(){a("#redactor_insert_video_area").focus()},200)},this),e=String()+'
';this.modal.addTemplate("insert-video",e),this.modal.addCallback("insert-video",b),this.modal.load("insert-video","Insert Video",500),this.modal.createCancelButton();var f=this.modal.createActionButton("Insert");f.on("click",a.proxy(function(){var b=a.trim(a("#redactor_insert_video_area").val());d.test(b)?a.embedly.oembed(b).done(a.proxy(function(b){a.each(b,a.proxy(function(a,b){c.call(this,b.html)},this))},this)):c.call(this,b)},this)),this.modal.show()},this)),this.button.get("video").addClass("redactor_btn_video")}}}}(jQuery),function(a){"use strict";a.fn.webhookRedactor=function(b){return this.redactor("string"==typeof b?b:a.extend({},a.webhookRedactor.options,b))},a.webhookRedactor=function(b){return a.extend({},a.webhookRedactor.options,b)},a.webhookRedactor.options={imageEditable:!1,buttons:["formatting","bold","italic","unorderedlist","orderedlist","link","html"],buttonSource:!0,convertLinks:!1,dragImageUpload:!1,dragFileUpload:!1,toolbarFixed:!1,formatting:[],formattingAdd:[{tag:"p",title:"Normal text"},{tag:"h1",title:"Header 1"},{tag:"h2",title:"Header 2"},{tag:"h3",title:"Header 3"},{tag:"h4",title:"Header 4"},{tag:"h5",title:"Header 5"},{tag:"code",title:"Inline Code"},{tag:"pre",title:"Code Block"}],deniedTags:["html","head","body"],plugins:["fullscreen","fixedtoolbar","autoembedly","figure","video","webhookImage","table","quote","embed"],initCallback:function(){this.modal.setDraggable=function(){},a.each(this.opts.buttons,a.proxy(function(a,b){this.button.get(b).addClass("redactor_btn_"+b)},this)),this.$element.closest("form").one("submit",a.proxy(function(){this.opts.visual&&this.code.sync()},this));var b=this;this.$editor.on("paste",function(){setTimeout(function(){b.$editor.find("[dir]").removeAttr("dir")},5)}),this.$element.trigger("init.webhookRedactor",this.core.getObject()),this.$editor.find("figure[data-type=video]:not(:has(figcaption))").each(function(){a(this).append("
")}),this.$editor.find("figure[data-type=quote] blockquote:not(:has(cite))").each(function(){a(this).append("")}),this.$editor.find("figure[data-type=image]:not(:has(figcaption))").each(function(){a(this).append("
")}),this.$editor.find("figure[data-type=embed]:not(:has(figcaption))").each(function(){a(this).append("
")})},changeCallback:function(){var a="p, h1, h2, h3, h4, h5";this.$editor.children(":first-child").is(a)||this.$editor.prepend("


"),this.$editor.children(":last-child").is(a)||this.$editor.append("


"),this.$editor.trigger("mutate"),this.$element.trigger("mutate.webhookRedactor",this.core.getObject())}}}(jQuery); \ No newline at end of file diff --git a/src/redactor.image.js b/src/redactor.image.js index 2ab4a21..3c03255 100644 --- a/src/redactor.image.js +++ b/src/redactor.image.js @@ -21,10 +21,11 @@ right : { classSuffix: 'arrow-right' }, small : { classSuffix: 'small', text: 'S' }, medium : { classSuffix: 'medium', text: 'M' }, + large : { classSuffix: 'large', text: 'L' }, resize_full : { classSuffix: 'resize-full' }, resize_small: { classSuffix: 'resize-small' } }, - controlGroup: ['left', 'up', 'down', 'right', '|', 'small', 'medium', 'resize_full', 'resize_small', 'remove'], + controlGroup: ['left', 'up', 'down', 'right', '|', 'small', 'medium', 'large', 'resize_full', 'resize_small', 'remove'], init: function () { this.redactor.$editor.on('focus', $.proxy(this.addCaptions, this)); // this.addCaptions(); @@ -58,6 +59,7 @@ if ($figure.hasClass('wy-figure-small')) { $toolbar.find('.wy-figure-controls-small').show().addClass('on'); $toolbar.find('.wy-figure-controls-medium').show(); + $toolbar.find('.wy-figure-controls-large').show(); $toolbar.find('.wy-figure-controls-resize-full').show(); $toolbar.find('.wy-figure-controls-resize-small').hide(); } @@ -65,6 +67,15 @@ else if ($figure.hasClass('wy-figure-medium')) { $toolbar.find('.wy-figure-controls-small').show(); $toolbar.find('.wy-figure-controls-medium').show().addClass('on'); + $toolbar.find('.wy-figure-controls-large').show(); + $toolbar.find('.wy-figure-controls-resize-full').show(); + $toolbar.find('.wy-figure-controls-resize-small').hide(); + } + + else if ($figure.hasClass('wy-figure-large')) { + $toolbar.find('.wy-figure-controls-small').show(); + $toolbar.find('.wy-figure-controls-medium').show(); + $toolbar.find('.wy-figure-controls-large').show().addClass('on'); $toolbar.find('.wy-figure-controls-resize-full').show(); $toolbar.find('.wy-figure-controls-resize-small').hide(); } @@ -112,7 +123,8 @@ case 'small': case 'medium': - changeSuffix(['small', 'medium', 'large'], [command]); + case 'large': + changeSuffix(['small', 'medium', 'large', 'full'], [command]); if (!$figure.hasClass('wy-figure-left') && !$figure.hasClass('wy-figure-right')) { $figure.addClass('wy-figure-left'); $figure.trigger('left'); @@ -120,11 +132,11 @@ break; case 'resize_full': - changeSuffix(['small', 'medium', 'left', 'right'], ['large']); + changeSuffix(['small', 'medium', 'large', 'left', 'right'], ['full']); break; case 'resize_small': - changeSuffix(['small', 'large', 'right'], ['medium', 'left']); + changeSuffix(['small', 'medium', 'full', 'right'], ['large', 'left']); break; }