/*! * froala_editor v4.3.1 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2024 Froala Labs */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],t):t(e.FroalaEditor)}(this,function(ye){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,l=Array(t);a"));var t="";A.opts.colorsHEXInput&&(t='
"));var a={buttons:e,colors:function n(){for(var e='
',t=0;t"),"REMOVE"!=A.opts.tableColors[t]?e+='').concat(A.language.translate("Color")," ").concat(A.opts.tableColors[t],"   "):e+='').concat(A.icon.create("tableColorRemove"),'').concat(A.language.translate("Clear Formatting"),"");return e+="
"}(),custom_color:t},l=A.popups.create("table.colors",a);return A.events.$on(A.$wp,"scroll.table-colors",function(){A.popups.isVisible("table.colors")&&s()}),function r(u){A.events.on("popup.tab",function(e){var t=T(e.currentTarget);if(!A.popups.isVisible("table.colors")||!t.is("span"))return!0;var a=e.which,l=!0;if(ye.KEYCODE.TAB==a){var n=u.find(".fr-buttons");l=!A.accessibility.focusToolbar(n,!!e.shiftKey)}else if(ye.KEYCODE.ARROW_UP==a||ye.KEYCODE.ARROW_DOWN==a||ye.KEYCODE.ARROW_LEFT==a||ye.KEYCODE.ARROW_RIGHT==a){var r=t.parent().find("span.fr-command"),o=r.index(t),s=A.opts.colorsStep,i=Math.floor(r.length/s),f=o%s,c=Math.floor(o/s),d=c*s+f,p=i*s;ye.KEYCODE.ARROW_UP==a?d=((d-s)%p+p)%p:ye.KEYCODE.ARROW_DOWN==a?d=(d+s)%p:ye.KEYCODE.ARROW_LEFT==a?d=((d-1)%p+p)%p:ye.KEYCODE.ARROW_RIGHT==a&&(d=(d+1)%p);var h=T(r.get(d));A.events.disableBlur(),h.focus(),l=!1}else ye.KEYCODE.ENTER==a&&(A.button.exec(t),l=!1);return!1===l&&(e.preventDefault(),e.stopPropagation()),l},!0)}(l),l}()),A.popups.setContainer("table.colors",A.$sc);var a=I(e),l=(a.left+a.right)/2,n=a.bottom;!function r(){var e=A.popups.get("table.colors"),t=A.$el.find(".fr-selected-cell").first(),a=A.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="'.concat(a,'"]')).addClass("fr-selected-color fr-active-item"),l.val(a).trigger("change")}(),A.popups.show("table.colors",l,n,a.bottom-a.top,!0)}}function i(){0===te().length&&A.toolbar.enable()}function c(e){if(e)return A.popups.onHide("table.insert",function(){A.popups.get("table.insert").find('.fr-table-size .fr-select-table-size > span[data-row="1"][data-col="1"]').trigger("mouseover")}),!0;var t="";0'.concat(A.button.buildList(A.opts.tableInsertButtons),""));var a={buttons:t,rows_columns:function r(){for(var e='
1 × 1
',t=1;t<=A.opts.tableInsertMaxSize;t++){for(var a=1;a<=A.opts.tableInsertMaxSize;a++){var l="inline-block";2').concat(t," × ").concat(a,"   ")}e+='
'}return e+="
"}()},l=A.popups.create("table.insert",a);return A.events.$on(l,"mouseover",".fr-table-size .fr-select-table-size .fr-table-cell",function(e){d(T(e.currentTarget))},!0),function n(e){A.events.$on(e,"focus","[tabIndex]",function(e){var t=T(e.currentTarget);d(t)}),A.events.on("popup.tab",function(e){var t=T(e.currentTarget);if(!A.popups.isVisible("table.insert")||!t.is("span, a"))return!0;var a,l=e.which;if(ye.KEYCODE.ARROW_UP==l||ye.KEYCODE.ARROW_DOWN==l||ye.KEYCODE.ARROW_LEFT==l||ye.KEYCODE.ARROW_RIGHT==l){if(t.is("span.fr-table-cell")){var n=t.parent().find("span.fr-table-cell"),r=n.index(t),o=A.opts.tableInsertMaxSize,s=r%o,i=Math.floor(r/o);ye.KEYCODE.ARROW_UP==l?i=Math.max(0,i-1):ye.KEYCODE.ARROW_DOWN==l?i=Math.min(A.opts.tableInsertMaxSize-1,i+1):ye.KEYCODE.ARROW_LEFT==l?s=Math.max(0,s-1):ye.KEYCODE.ARROW_RIGHT==l&&(s=Math.min(A.opts.tableInsertMaxSize-1,s+1));var f=i*o+s,c=T(n.get(f));d(c),A.events.disableBlur(),c.focus(),a=!1}}else ye.KEYCODE.ENTER==l&&(A.button.exec(t),a=!1);return!1===a&&(e.preventDefault(),e.stopPropagation()),a},!0)}(l),l}function d(e){var t=e.data("row");null!==t&&(t=parseInt(t));var a=e.data("col");null!==a&&(a=parseInt(a));var l=e.parent();l.siblings(".fr-table-size-info").html("".concat(t," × ").concat(a)),l.find("> span").removeClass("hover fr-active-item");for(var n=1;n<=A.opts.tableInsertMaxSize;n++)for(var r=0;r<=A.opts.tableInsertMaxSize;r++){var o=l.find('> span[data-row="'.concat(n,'"][data-col="').concat(r,'"]'));n<=t&&r<=a?o.addClass("hover"):n<=t+1||n<=2&&!A.helpers.isMobile()?o.css("display","inline-block"):2'.concat(A.button.buildList(A.opts.tableEditButtons),"")},a=A.popups.create("table.edit",t);return A.events.$on(A.$wp,"scroll.table-edit",function(){A.popups.isVisible("table.edit")&&g()}),a}return!1}function b(e){var t={startTag:"",closeTag:""};return A.opts.keepTextFormatOnTable&&(t=h(function s(e){var t=new Set,a=e.textContent,l=0,n=[e.firstChild];for(;0':"<"+r.nodeName.toLowerCase()+">",a=""+a}}return{startTag:t,closeTag:a}}function u(){if(0
';else{var c=b(r[l][a]);s+=''+c.startTag+"
"+c.closeTag+""}}s+="",n=0 table tbody"))):T(t.find("tr").not(t.find("> table tr")).get(l)),"below"==e?"TBODY"==n.attr("tagName")?n.prepend(s):n[0].parentNode&&n[0].insertAdjacentHTML("afterend",s):"above"==e&&("TBODY"==n.attr("tagName")?n.append(s):n.before(s),A.popups.isVisible("table.edit")&&g())}}function v(e,t,a){var l,n,r,o,s,i=0,f=x(a);if(e<(t=Math.min(t,f[0].length-1)))for(n=e;n<=t;n++)if(!(e table tr")).each(function(s,e){var t=T(e),i=0;t.find("> th, > td").each(function(e,t){for(var a=T(t),l=parseInt(a.attr("colspan"),10)||1,n=parseInt(a.attr("rowspan"),10)||1,r=s;r")),O=A.shared.$table_resizer,A.events.$on(O,"mousedown",function(e){return!A.core.sameInstance(O)||(0a-A.opts.tableResizerOffset?O.css("left",a-A.opts.tableResizerOffset-A.$wp.offset().left):l')),A.events.bindClick(A.shared.$ti_helper,"a",function(){var e=f.data("selected-cell"),t=f.data("position"),a=f.data("instance")||A;"before"==t?(A.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertColumn(t),e.removeClass("fr-selected-cell"),A.undo.saveStep()):"after"==t?(A.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertColumn(t),e.removeClass("fr-selected-cell"),A.undo.saveStep()):"above"==t?(A.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertRow(t),e.removeClass("fr-selected-cell"),A.undo.saveStep()):"below"==t&&(A.undo.saveStep(),e.addClass("fr-selected-cell"),a.table.insertRow(t),e.removeClass("fr-selected-cell"),A.undo.saveStep()),H()}),A.events.on("shared.destroy",function(){A.shared.$ti_helper.html("").removeData().remove(),A.shared.$ti_helper=null},!0),A.events.$on(A.shared.$ti_helper,"mousemove",function(e){e.stopPropagation()},!0),A.events.$on(T(A.o_win),"scroll",function(){H()},!0),A.events.$on(A.$wp,"scroll",function(){H()},!0)),f=A.shared.$ti_helper,A.events.on("destroy",function(){f=null}),A.tooltip.bind(A.$box,".fr-insert-helper > a.fr-floating-btn")}function ee(){l=null,clearTimeout(o)}function te(){return A.el.querySelectorAll(".fr-selected-cell")}function ae(){var e=te();if(e.length){for(var t=e[0];t&&"TABLE"!=t.tagName&&t.parentNode!=A.el;)t=t.parentNode;return t&&"TABLE"==t.tagName?T(t):T([])}return T([])}function le(){n=!1}return{_init:function ne(){if(!A.$wp)return!1;if(A.helpers.isMobile()&&(A.events.$on(A.$el,"mousedown",e),A.events.$on(A.$win,"mouseup",a)),!A.helpers.isMobile()){y=n=r=!1,A.events.$on(A.$el,"mousedown",e),A.popups.onShow("image.edit",function(){N(),n=r=!1}),A.popups.onShow("link.edit",function(){N(),n=r=!1}),A.events.on("commands.mousedown",function(e){0"),a==t.length-1&&T(t[a]).prepend(ye.MARKERS);return A.selection.restore(),A.undo.saveStep(),!(t=[])}if(1',o=100/t;for(a=0;a",l=0;l"+n.startTag,0===a&&0===l&&(r+=ye.MARKERS),r+="
"+n.closeTag+"";r+=""}if(r+="",A.opts.trackChangesEnabled){A.edit.on(),A.events.focus(!0),A.selection.restore(),A.undo.saveStep(),A.markers.insert(),A.html.wrap();var s=A.$el.find(".fr-marker");A.node.isLastSibling(s)&&s.parent().hasClass("fr-deletable")&&s.insertAfter(s.parent()),s.replaceWith(r),A.selection.clear()}else A.html.insert(r);A.selection.restore();var i=A.$el.find(".fr-inserted-table");i.removeClass("fr-inserted-table"),A.events.trigger("table.inserted",[i.get(0)])},remove:u,insertRow:m,deleteRow:function oe(){var e=ae();if(0=r.min_i;t--){for(l=T(e.find("tr").not(e.find("> table tr")).get(t)),a=0;a table tr")).get(t+1)).prepend(i):T(n[t+1][f-1])[0].parentNode&&T(n[t+1][f-1])[0].insertAdjacentElement("afterend",i)}}var c=l.parent();l.remove(),0===c.find("tr").length&&c.remove(),n=x(e)}E(0,n.length-1,0,n[0].length-1,e),0 table tr")).each(function(e){for(var t,a=T(this),l=0,n=0;l-1 th, > td").get(n))){t=null;break}t==p[e][l]?(l+=parseInt(T(t).attr("colspan"),10)||1,n++):(l+=parseInt(T(p[e][l]).attr("colspan"),10)||1,"after"==c&&(t=0===n?-1:a.find("> th, > td").get(n-1)))}var r=T(t);if("after"==c&&d
');else{var f=b(p[e][d]);s='')+f.startTag+"
"+f.closeTag+""}T(s).append("
"),T(s).css("width","".concat(u.toFixed(4),"%")),-1==t?a.prepend(s):null==t?a.append(s):"before"==c?r.before(s):"after"==c&&r.after(s)}}),e.find("th, td").each(function(){(a=T(this)).data("old-width")&&(a.css("width",(a.data("old-width")*u/h).toFixed(4)+"%"),a.removeData("old-width"))}),A.popups.isVisible("table.edit")&&g()}},deleteColumn:function ie(){var e=ae();if(0r.max_j)&&(o+=l.outerWidth()/e.outerWidth()*100));for(o/=n.length,a=r.max_j;a>=r.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()}E(0,n.length-1,0,n[0].length-1,e),0"!=(t=T(l[e])).html()&&""!==t.html()&&(s+="
".concat(t.html())),t.remove();n.html(s),A.selection.setAtEnd(n.get(0)),A.selection.restore(),A.toolbar.enable(),w(a.min_i,a.max_i,o);var f=o.find("tr:empty");for(e=f.length-1;0<=e;e--)T(f[e]).remove();v(a.min_j,a.max_j,o),g()}},splitCellVertically:function ce(){if(1==te().length){var e=A.$el.find(".fr-selected-cell"),t=parseInt(e.attr("colspan"),10)||1,a=e.parent().outerWidth(),l=e.outerWidth(),n=e.clone().html("
"),r=x(),o=$(e.get(0),r);if(1");if(1 table tr")).get(i)).prepend(o):T(n[i][f])[0].parentNode&&T(n[i][f])[0].insertAdjacentElement("afterend",o[0])}else{var c,d=T(document.createElement("tr")).append(o);for(c=0;c th").length){var t,a="",l=0;for(l=e.find("tr").first().find("> th").length,e.find("tr").first().find("> td").each(function(){var e=T(this);l+=parseInt(e.attr("colspan"),10)||1}),t=0;t
";a+="",e.prepend(a),g()}},addFooter:function he(){var e=ae();if(0 td";for(0 th"),e.find("tr").first().find(n).each(function(){var e=T(this);l+=parseInt(e.attr("colspan"),10)||1}),t=0;t
";a+="",e.append(a),g()}},removeHeader:function ue(){var e=ae(),t=e.find("> thead");if(0<(t=T(t)).length)if(0===e.find("tbody tr").length)u();else if(t.remove(),0 thead").length?e.removeClass("fr-active").attr("aria-pressed",!1):e.addClass("fr-active").attr("aria-pressed",!0))}}),ye.DefineIcon("tableFooter",{NAME:"table",FA5NAME:"table",SVG_KEY:"tableFooter"}),ye.RegisterCommand("tableFooter",{title:"Table Footer",focus:!1,toggle:!0,callback:function(){this.popups.get("table.edit").find('.fr-command[data-cmd="tableFooter"]').hasClass("fr-active")?this.table.removeFooter():this.table.addFooter()},refresh:function(e){var t=this.table.selectedTable();0'+this.language.translate(t[a])+"");return e+=""},callback:function(e,t){"above"==t||"below"==t?this.table.insertRow(t):this.table.deleteRow()}}),ye.DefineIcon("tableColumns",{NAME:"bars fa-rotate-90",SVG_KEY:"columns"}),ye.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()}}),ye.DefineIcon("tableCells",{NAME:"square-o",FA5NAME:"square",SVG_KEY:"cellOptions"}),ye.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').concat(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.$,l=this.$el.find(".fr-selected-cell").closest("table");l&&t.find(".fr-command").each(function(){var e=a(this).data("param1"),t=l.hasClass(e);a(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),ye.DefineIcon("tableCellBackground",{NAME:"tint",SVG_KEY:"cellBackground"}),ye.RegisterCommand("tableCellBackground",{title:"Cell Background",focus:!1,popup:!0,callback:function(){this.table.showColorsPopup()}}),ye.RegisterCommand("tableCellBackgroundColor",{undo:!0,focus:!1,callback:function(e,t){this.table.setBackground(t)}}),ye.DefineIcon("tableBack",{NAME:"arrow-left",SVG_KEY:"back"}),ye.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"))}}),ye.DefineIcon("tableCellVerticalAlign",{NAME:"arrows-v",FA5NAME:"arrows-alt-v",SVG_KEY:"verticalAlignMiddle"}),ye.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)}}),ye.DefineIcon("tableCellHorizontalAlign",{NAME:"align-left",SVG_KEY:"alignLeft"}),ye.DefineIcon("align-left",{NAME:"align-left",SVG_KEY:"alignLeft"}),ye.DefineIcon("align-right",{NAME:"align-right",SVG_KEY:"alignRight"}),ye.DefineIcon("align-center",{NAME:"align-center",SVG_KEY:"alignCenter"}),ye.DefineIcon("align-justify",{NAME:"align-justify",SVG_KEY:"alignJustify"}),ye.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(),a=this.$;t.length&&e.find("> *").first().replaceWith(this.icon.create("align-".concat(this.helpers.getAlignment(a(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)}}),ye.DefineIcon("tableCellStyle",{NAME:"magic",SVG_KEY:"cellStyle"}),ye.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.$,l=this.$el.find(".fr-selected-cell").first();l&&t.find(".fr-command").each(function(){var e=a(this).data("param1"),t=l.hasClass(e);a(this).toggleClass("fr-active",t).attr("aria-selected",t)})}}),ye.RegisterCommand("tableCellBackgroundCustomColor",{title:"OK",undo:!0,callback:function(){this.table.customColor()}}),ye.DefineIcon("tableColorRemove",{NAME:"eraser",SVG_KEY:"remove"})});