!function(a){a.PluginManager.add("wptadv",function(b){function c(b){var c="table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary";return b=b.replace(new RegExp("<(?:"+c+")(?: [^>]*)?>","gi"),"\n$&"),b=b.replace(new RegExp("","gi"),"$&\n"),b=b.replace(/(]*)?>)[\r\n\t]*/gi,"$1\n"),b=b.replace(/>\n[\r\n\t]+\n<"),b=b.replace(/^
  • \u00a0<\/td>/g," "),a.trim(b)}function d(a){var c=b.$(a);c.css({width:null,height:null}),c.attr("style")||c.attr({style:null})}var e=!b.settings.wpautop&&b.settings.tadv_noautop;return b.addCommand("Tadv_Mark",function(){b.formatter.toggle("mark")}),b.addButton("tadv_mark",{icon:"backcolor",tooltip:"Mark",cmd:"Tadv_Mark",stateSelector:"mark"}),b.on("init",function(){e&&b.on("SaveContent",function(a){a.content=a.content.replace(/caption\](\s|]*>|

     <\/p>)*\[caption/g,"caption] [caption"),a.content=a.content.replace(/<(object|audio|video)[\s\S]+?<\/\1>/g,function(a){return a.replace(/[\r\n\t ]+/g," ")}),a.content=a.content.replace(/]*)?>[\s\S]+?<\/pre>/g,function(a){return a=a.replace(/
    (\r\n|\n)?/g,"\n"),a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g,"\n")}),a.content=c(a.content)});try{b.plugins.searchreplace&&!b.controlManager.buttons.searchreplace&&b.shortcuts.remove("meta+f")}catch(a){}b.formatter.register({mark:{inline:"mark"}})}),b.on("ObjectResizeStart",function(a){var c,d,e,f=a.target,g=b.$(f);if(g.is("table")){if(f.style.width&&f.style.width.indexOf("%")!==-1)return;c=parseInt(g.parent().css("width"),10),d=parseInt(a.width,10),c&&d&&(Math.abs(c-d)<3?g.css({width:"100%"}):(e=Math.round(d/c*100),e>10&&e<200&&g.css({width:e+"%"})))}},!0),b.addMenuItem("tmaresettablesize",{text:"Reset table size",cmd:"tmaResetTableSize",icon:"dashicon dashicons-image-flip-horizontal",context:"format"}),b.addMenuItem("tmaremovetablestyles",{text:"Remove table styling",cmd:"tmaRemoveTableStyles",icon:"dashicon dashicons-editor-table",context:"format"}),b.addButton("tmaresettablesize",{title:"Reset table size",cmd:"tmaResetTableSize",icon:"dashicon dashicons-image-flip-horizontal"}),b.addButton("tmaremovetablestyles",{title:"Remove table styling",cmd:"tmaRemoveTableStyles",icon:"dashicon dashicons-editor-table"}),b.addCommand("tmaRemoveTableStyles",function(){var a=b.selection.getStart(),c=b.dom.getParents(a,"table");c&&b.$(c).attr({style:null,width:null,height:null,border:null,cellspacing:null,cellpadding:null}).find("tr, td").each(function(a,c){b.$(c).attr({style:null,width:null,height:null})})}),b.addCommand("tmaResetTableSize",function(){var a=b.selection.getStart(),c=b.dom.getParents(a,"table");c&&(d(c),b.$(c).find("tr, td").each(function(a,b){d(b)}))}),e&&(b.on("beforeSetContent",function(a){var b,c=window.wp;c&&(b=c.editor&&c.editor.autop,b||(b=c.oldEditor&&c.oldEditor.autop),a.load&&b&&a.content&&a.content.indexOf("\n")>-1&&!/

    /i.test(a.content)&&(a.content=b(a.content)))},!0),b.settings.classic_block_editor&&b.on("beforeGetContent",function(c){if("raw"!==c.format){var d=a.$(".block-editor-block-list__block");1===d.length&&"core/freeform"===d.attr("data-type")?b.$("p").each(function(a,c){c.hasAttributes()||b.$(c).attr("data-tadv-p","keep")}):b.$("p[data-tadv-p]").removeAttr("data-tadv-p")}},!0)),{addLineBreaks:c}})}(window.tinymce);