!function(n){function t(n,t){n&&t&&t.length&&t.val(function(n){if(!n)return"";var t=n.getBody(),e=t&&t.firstElementChild;return t&&1===t.childElementCount&&e&&"1"===e.getAttribute("data-ff-editor-placeholder")&&t.textContent.trim()===e.textContent.trim()?"":n.getContent()}(n)).trigger("change")}function e(t,e){var o=n(t.getContainer()).find("iframe").contents().find("body"),i=n("<span/>",{class:"mce-placeholder",style:"color: #aaa;","data-ff-editor-placeholder":"1"}).text(e);o.empty().append(i)}function o(n){n&&(window.wpActiveEditor=n)}function i(){n(".fluentform-post-content").each(function(i,c){var r=n(c),a=r.closest("form"),l=r.attr("id"),u=250,f=r.attr("rows");f&&+f>0&&(u=30*f);var d=r.attr("placeholder")||"";if(l&&window.tinymce){var s=window.tinymce.get(l);s&&s.remove(),a.length&&a.off("submit.ffTinyMceSync."+l).on("submit.ffTinyMceSync."+l,function(){var n=window.tinymce.get(l);n&&(n.save(),t(n,r))}),setTimeout(function(){var n;window.tinymce.init({selector:"#"+l,branding:!1,menubar:!1,browser_spellcheck:!0,convert_newlines_to_brs:!0,external_plugins:(null===(n=window.FluentFormProTinyMce)||void 0===n?void 0:n.externalPlugins)||{},plugins:"lists link table code paste",toolbar:"formatselect table bold italic bullist numlist link blockquote alignleft aligncenter alignright underline strikethrough removeformat outdent indent undo redo code",height:u,setup:function(n){d&&(n.on("init",function(){o(l),""===n.getContent()&&e(n,d)}),n.on("focus",function(){o(l);var t=n.getContent({format:"raw"});""!==t&&-1===t.indexOf("mce-placeholder")||n.setContent("")}),n.on("blur",function(){""===n.getContent()&&e(n,d)})),n.on("BeforeSetContent",function(n){n.content&&!n.content.includes("\x3c!-- wp:paragraph --\x3e")&&(n.content=n.content.replace(/\n/g,"<br>"))}),n.on("GetContent",function(n){n.content&&!n.content.includes("\x3c!-- wp:paragraph --\x3e")&&(n.content=n.content.replace(/<br>/g,"\n"))}),["change","undo","redo"].forEach(function(e){n.on(e,function(){t(n,r)})})}})},10)}})}n(document).ready(function(){i()}),n(document).on("lity:open",function(){i()})}(jQuery);