/*! * froala_editor v2.8.4 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2018 Froala Labs */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(e,t){return t===undefined&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),a(t)}:a(window.jQuery)}(function(Z){Z.extend(Z.FE.POPUP_TEMPLATES,{"table.insert":"[_BUTTONS_][_ROWS_COLUMNS_]","table.edit":"[_BUTTONS_]","table.colors":"[_BUTTONS_][_COLORS_][_CUSTOM_COLOR_]"}),Z.extend(Z.FE.DEFAULTS,{tableInsertMaxSize:10,tableEditButtons:["tableHeader","tableRemove","|","tableRows","tableColumns","tableStyle","-","tableCells","tableCellBackground","tableCellVerticalAlign","tableCellHorizontalAlign","tableCellStyle"],tableInsertButtons:["tableBack","|"],tableResizer:!0,tableDefaultWidth:"100%",tableResizerOffset:5,tableResizingLimit:30,tableColorsButtons:["tableBack","|"],tableColors:["#61BD6D","#1ABC9C","#54ACD2","#2C82C9","#9365B8","#475577","#CCCCCC","#41A85F","#00A885","#3D8EB9","#2969B0","#553982","#28324E","#000000","#F7DA64","#FBA026","#EB6B56","#E25041","#A38F84","#EFEFEF","#FFFFFF","#FAC51C","#F37934","#D14841","#B8312F","#7C706B","#D1D5D8","REMOVE"],tableColorsStep:7,tableCellStyles:{"fr-highlighted":"Highlighted","fr-thick":"Thick"},tableStyles:{"fr-dashed-borders":"Dashed Borders","fr-alternate-rows":"Alternate Rows"},tableCellMultipleStyles:!0,tableMultipleStyles:!0,tableInsertHelper:!0,tableInsertHelperOffset:15}),Z.FE.PLUGINS.table=function(E){var C,o,s,n,l,r,w;function h(){var e=O();if(e){var t=E.popups.get("table.edit");if(t||(t=p()),t){E.popups.setContainer("table.edit",E.$sc);var a=M(e),l=(a.left+a.right)/2,s=a.bottom;E.popups.show("table.edit",l,s,a.bottom-a.top),E.edit.isDisabled()&&(1");var t="";E.opts.colorsHEXInput&&(t='
");var a={buttons:e,colors:function(){for(var e='
',t=0;t"),"REMOVE"!=E.opts.tableColors[t]?e+=''+E.language.translate("Color")+" "+E.opts.tableColors[t]+"   ":e+=''+E.icon.create("tableColorRemove")+''+E.language.translate("Clear Formatting")+"";return e+="
"}(),custom_color:t},l=E.popups.create("table.colors",a);return E.events.$on(E.$wp,"scroll.table-colors",function(){E.popups.isVisible("table.colors")&&f()}),u=l,E.events.on("popup.tab",function(e){var t=Z(e.currentTarget);if(!E.popups.isVisible("table.colors")||!t.is("span"))return!0;var a=e.which,l=!0;if(Z.FE.KEYCODE.TAB==a){var s=u.find(".fr-buttons");l=!E.accessibility.focusToolbar(s,!!e.shiftKey)}else if(Z.FE.KEYCODE.ARROW_UP==a||Z.FE.KEYCODE.ARROW_DOWN==a||Z.FE.KEYCODE.ARROW_LEFT==a||Z.FE.KEYCODE.ARROW_RIGHT==a){var n=t.parent().find("span.fr-command"),r=n.index(t),o=E.opts.colorsStep,i=Math.floor(n.length/o),f=r%o,c=Math.floor(r/o),d=c*o+f,p=i*o;Z.FE.KEYCODE.ARROW_UP==a?d=((d-o)%p+p)%p:Z.FE.KEYCODE.ARROW_DOWN==a?d=(d+o)%p:Z.FE.KEYCODE.ARROW_LEFT==a?d=((d-1)%p+p)%p:Z.FE.KEYCODE.ARROW_RIGHT==a&&(d=(d+1)%p);var h=Z(n.get(d));E.events.disableBlur(),h.focus(),l=!1}else Z.FE.KEYCODE.ENTER==a&&(E.button.exec(t),l=!1);return!1===l&&(e.preventDefault(),e.stopPropagation()),l},!0),l;var u}()),E.popups.setContainer("table.colors",E.$sc);var r=M(s),o=(r.left+r.right)/2,i=r.bottom;e=E.popups.get("table.colors"),t=E.$el.find(".fr-selected-cell:first"),a=E.helpers.RGBToHex(t.css("background-color")),l=e.find(".fr-table-colors-hex-layer input"),e.find(".fr-selected-color").removeClass("fr-selected-color fr-active-item"),e.find('span[data-param1="'+a+'"]').addClass("fr-selected-color fr-active-item"),l.val(a).trigger("change"),E.popups.show("table.colors",o,i,r.bottom-r.top)}}function i(){0===J().length&&E.toolbar.enable()}function c(e){if(e)return E.popups.onHide("table.insert",function(){E.popups.get("table.insert").find('.fr-table-size .fr-select-table-size > span[data-row="1"][data-col="1"]').trigger("mouseenter")}),!0;var t="";0'+E.button.buildList(E.opts.tableInsertButtons)+"");var a,l={buttons:t,rows_columns:function(){for(var e='
1 × 1
',t=1;t<=E.opts.tableInsertMaxSize;t++){for(var a=1;a<=E.opts.tableInsertMaxSize;a++){var l="inline-block";2'+t+" × "+a+"   "}e+='
'}return e+="
"}()},s=E.popups.create("table.insert",l);return E.events.$on(s,"mouseenter",".fr-table-size .fr-select-table-size .fr-table-cell",function(e){d(Z(e.currentTarget))},!0),a=s,E.events.$on(a,"focus","[tabIndex]",function(e){var t=Z(e.currentTarget);d(t)}),E.events.on("popup.tab",function(e){var t=Z(e.currentTarget);if(!E.popups.isVisible("table.insert")||!t.is("span, a"))return!0;var a,l=e.which;if(Z.FE.KEYCODE.ARROW_UP==l||Z.FE.KEYCODE.ARROW_DOWN==l||Z.FE.KEYCODE.ARROW_LEFT==l||Z.FE.KEYCODE.ARROW_RIGHT==l){if(t.is("span.fr-table-cell")){var s=t.parent().find("span.fr-table-cell"),n=s.index(t),r=E.opts.tableInsertMaxSize,o=n%r,i=Math.floor(n/r);Z.FE.KEYCODE.ARROW_UP==l?i=Math.max(0,i-1):Z.FE.KEYCODE.ARROW_DOWN==l?i=Math.min(E.opts.tableInsertMaxSize-1,i+1):Z.FE.KEYCODE.ARROW_LEFT==l?o=Math.max(0,o-1):Z.FE.KEYCODE.ARROW_RIGHT==l&&(o=Math.min(E.opts.tableInsertMaxSize-1,o+1));var f=i*r+o,c=Z(s.get(f));d(c),E.events.disableBlur(),c.focus(),a=!1}}else Z.FE.KEYCODE.ENTER==l&&(E.button.exec(t),a=!1);return!1===a&&(e.preventDefault(),e.stopPropagation()),a},!0),s}function d(e){var t=e.data("row"),a=e.data("col"),l=e.parent();l.siblings(".fr-table-size-info").html(t+" × "+a),l.find("> span").removeClass("hover fr-active-item");for(var s=1;s<=E.opts.tableInsertMaxSize;s++)for(var n=0;n<=E.opts.tableInsertMaxSize;n++){var r=l.find('> span[data-row="'+s+'"][data-col="'+n+'"]');s<=t&&n<=a?r.addClass("hover"):s<=t+1||s<=2&&!E.helpers.isMobile()?r.css("display","inline-block"):2'+E.button.buildList(E.opts.tableEditButtons)+""},a=E.popups.create("table.edit",t);return E.events.$on(E.$wp,"scroll.table-edit",function(){E.popups.isVisible("table.edit")&&h()}),a}return!1}function u(){if(0 th, > td").each(function(e,t){for(var a=Z(t),l=parseInt(a.attr("colspan"),10)||1,s=parseInt(a.attr("rowspan"),10)||1,n=o;n
')),C=E.shared.$table_resizer,E.events.$on(C,"mousedown",function(e){return!E.core.sameInstance(C)||(0a-E.opts.tableResizerOffset?C.css("left",a-E.opts.tableResizerOffset-E.$wp.offset().left):l'),E.events.bindClick(E.shared.$ti_helper,"a",function(){var e=o.data("selected-cell"),t=o.data("position"),a=o.data("instance")||E;"before"==t?(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertColumn(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()):"after"==t?(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertColumn(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()):"above"==t?(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertRow(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()):"below"==t&&(E.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertRow(t),e.removeClass("fr-selected-cell"),E.undo.saveStep()),k()}),E.events.on("shared.destroy",function(){E.shared.$ti_helper.html("").removeData().remove(),E.shared.$ti_helper=null},!0),E.events.$on(E.shared.$ti_helper,"mousemove",function(e){e.stopPropagation()},!0),E.events.$on(Z(E.o_win),"scroll",function(){k()},!0),E.events.$on(E.$wp,"scroll",function(){k()},!0)),o=E.shared.$ti_helper,E.events.on("destroy",function(){o=null}),E.tooltip.bind(E.$box,".fr-insert-helper > a.fr-floating-btn")}function G(){l=null,clearTimeout(r)}function J(){return E.el.querySelectorAll(".fr-selected-cell")}function Q(){var e=J();if(e.length){for(var t=e[0];t&&"TABLE"!=t.tagName&&t.parentNode!=E.el;)t=t.parentNode;return t&&"TABLE"==t.tagName?Z(t):Z([])}return Z([])}return{_init:function(){if(!E.$wp)return!1;if(!E.helpers.isMobile()){w=s=n=!1,E.events.$on(E.$el,"mousedown",e),E.popups.onShow("image.edit",function(){D(),s=n=!1}),E.popups.onShow("link.edit",function(){D(),s=n=!1}),E.events.on("commands.mousedown",function(e){0"),a==t.length-1&&Z(t[a]).prepend(Z.FE.MARKERS);return E.selection.restore(),E.undo.saveStep(),!(t=[])}if(1',n=100/t;for(a=0;a",l=0;l",0===a&&0===l&&(s+=Z.FE.MARKERS),s+="
";s+=""}s+="",E.html.insert(s),E.selection.restore();var r=E.$el.find(".fr-inserted-table");r.removeClass("fr-inserted-table"),E.events.trigger("table.inserted",[r.get(0)])},remove:u,insertRow:b,deleteRow:function(){var e=Q();if(0=n.min_i;t--){for(l=Z(e.find("tr").not(e.find("table tr")).get(t)),a=0;a th, > td").get(s))){t=null;break}t==c[e][l]?(l+=parseInt(Z(t).attr("colspan"),10)||1,s++):(l+=parseInt(Z(c[e][l]).attr("colspan"),10)||1,"after"==i&&(t=0===s?-1:a.find("> th, > td").get(s-1)))}var n,r=Z(t);if("after"==i&&f
':'
',-1==t?a.prepend(n):null==t?a.append(n):"before"==i?r.before(n):"after"==i&&r.after(n)}),e.find("th, td").each(function(){(a=Z(this)).data("old-width")&&(a.css("width",(a.data("old-width")*p/d).toFixed(4)+"%"),a.removeData("old-width"))}),E.popups.isVisible("table.edit")&&h()}},deleteColumn:function(){var e=Q();if(0n.max_j)&&(r+=l.outerWidth()/e.outerWidth()*100));for(r/=s.length,a=n.max_j;a>=n.min_j;a--)for(t=0;t th, > td").length&&(0===i.prev().length||0===i.next().length||i.prev().find("> th[rowspan], > td[rowspan]").length th, > td").length)&&i.remove()}R(0,s.length-1,0,s[0].length-1,e),0"!=(t=Z(l[e])).html()&&""!==t.html()&&(o+="
"+t.html()),t.remove();s.html(o),E.selection.setAtEnd(s.get(0)),E.selection.restore(),E.toolbar.enable(),m(a.min_i,a.max_i,r);var f=r.find("tr:empty");for(e=f.length-1;0<=e;e--)Z(f[e]).remove();g(a.min_j,a.max_j,r),h()}},splitCellVertically:function(){if(1==J().length){var e=E.$el.find(".fr-selected-cell"),t=parseInt(e.attr("colspan"),10)||1,a=e.parent().outerWidth(),l=e.outerWidth(),s=e.clone().html("
"),n=O(),r=A(e.get(0),n);if(1");if(1").append(r);for(c=0;c td").each(function(){var e=Z(this);l+=parseInt(e.attr("colspan"),10)||1}),t=0;t
";a+="",e.prepend(a),h()}},removeHeader:function(){var e=Q(),t=e.find("thead");if(0'+this.language.translate(t[a])+"");return e+=""},callback:function(e,t){"above"==t||"below"==t?this.table.insertRow(t):this.table.deleteRow()}}),Z.FE.DefineIcon("tableColumns",{NAME:"bars fa-rotate-90"}),Z.FE.RegisterCommand("tableColumns",{type:"dropdown",focus:!1,title:"Column",options:{before:"Insert column before",after:"Insert column after","delete":"Delete column"},html:function(){var e='"},callback:function(e,t){"before"==t||"after"==t?this.table.insertColumn(t):this.table.deleteColumn()}}),Z.FE.DefineIcon("tableCells",{NAME:"square-o",FA5NAME:"square"}),Z.FE.RegisterCommand("tableCells",{type:"dropdown",focus:!1,title:"Cell",options:{merge:"Merge cells","vertical-split":"Vertical split","horizontal-split":"Horizontal split"},html:function(){var e='"},callback:function(e,t){"merge"==t?this.table.mergeCells():"vertical-split"==t?this.table.splitCellVertically():this.table.splitCellHorizontally()},refreshOnShow:function(e,t){1'+this.language.translate(t[a])+"");return e+=""},callback:function(e,t){this.table.applyStyle(t,this.$el.find(".fr-selected-cell").closest("table"),this.opts.tableMultipleStyles,this.opts.tableStyles)},refreshOnShow:function(e,t){var a=this.$el.find(".fr-selected-cell").closest("table");a&&t.find(".fr-command").each(function(){var e=Z(this).data("param1"),t=a.hasClass(e);Z(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),Z.FE.DefineIcon("tableCellBackground",{NAME:"tint"}),Z.FE.RegisterCommand("tableCellBackground",{title:"Cell Background",focus:!1,popup:!0,callback:function(){this.table.showColorsPopup()}}),Z.FE.RegisterCommand("tableCellBackgroundColor",{undo:!0,focus:!1,callback:function(e,t){this.table.setBackground(t)}}),Z.FE.DefineIcon("tableBack",{NAME:"arrow-left"}),Z.FE.RegisterCommand("tableBack",{title:"Back",undo:!1,focus:!1,back:!0,callback:function(){this.table.back()},refresh:function(e){0!==this.table.selectedCells().length||this.opts.toolbarInline?(e.removeClass("fr-hidden"),e.next(".fr-separator").removeClass("fr-hidden")):(e.addClass("fr-hidden"),e.next(".fr-separator").addClass("fr-hidden"))}}),Z.FE.DefineIcon("tableCellVerticalAlign",{NAME:"arrows-v",FA5NAME:"arrows-alt-v"}),Z.FE.RegisterCommand("tableCellVerticalAlign",{type:"dropdown",focus:!1,title:"Vertical Align",options:{Top:"Align Top",Middle:"Align Middle",Bottom:"Align Bottom"},html:function(){var e='"},callback:function(e,t){this.table.verticalAlign(t)},refreshOnShow:function(e,t){t.find('.fr-command[data-param1="'+this.$el.find(".fr-selected-cell").css("vertical-align")+'"]').addClass("fr-active").attr("aria-selected",!0)}}),Z.FE.DefineIcon("tableCellHorizontalAlign",{NAME:"align-left"}),Z.FE.DefineIcon("align-left",{NAME:"align-left"}),Z.FE.DefineIcon("align-right",{NAME:"align-right"}),Z.FE.DefineIcon("align-center",{NAME:"align-center"}),Z.FE.DefineIcon("align-justify",{NAME:"align-justify"}),Z.FE.RegisterCommand("tableCellHorizontalAlign",{type:"dropdown",focus:!1,title:"Horizontal Align",options:{left:"Align Left",center:"Align Center",right:"Align Right",justify:"Align Justify"},html:function(){var e='"},callback:function(e,t){this.table.horizontalAlign(t)},refresh:function(e){var t=this.table.selectedCells();t.length&&e.find("> *:first").replaceWith(this.icon.create("align-"+this.helpers.getAlignment(Z(t[0]))))},refreshOnShow:function(e,t){t.find('.fr-command[data-param1="'+this.helpers.getAlignment(this.$el.find(".fr-selected-cell:first"))+'"]').addClass("fr-active").attr("aria-selected",!0)}}),Z.FE.DefineIcon("tableCellStyle",{NAME:"magic"}),Z.FE.RegisterCommand("tableCellStyle",{title:"Cell Style",type:"dropdown",focus:!1,html:function(){var e='"},callback:function(e,t){this.table.applyStyle(t,this.$el.find(".fr-selected-cell"),this.opts.tableCellMultipleStyles,this.opts.tableCellStyles)},refreshOnShow:function(e,t){var a=this.$el.find(".fr-selected-cell:first");a&&t.find(".fr-command").each(function(){var e=Z(this).data("param1"),t=a.hasClass(e);Z(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),Z.FE.RegisterCommand("tableCellBackgroundCustomColor",{title:"OK",undo:!0,callback:function(){this.table.customColor()}}),Z.FE.DefineIcon("tableColorRemove",{NAME:"eraser"})});