File: /home/agritoday/www/wp-content/plugins/td-composer/assets/js/js_files_for_gutenberg_editor.min.js
(function(b){var c={init:function(){var a=this;setTimeout(function(){a.elements();a.events()},10)},elements:function(){this.cache={};this.cache.$gutenbergEditor=b("#editor");this.cache.$gutenbergSwitch=b(b("#tdc-gutenberg-button-switch").html());this.cache.$gutenbergEditor.find(".edit-post-header-toolbar").after(this.cache.$gutenbergSwitch);this.cache.$switchButton=this.cache.$gutenbergSwitch.find("#tdc-switch-button")},events:function(){var a=this;a.cache.$switchButton.on("click",function(b){b.preventDefault();
wp.data.select("core/editor").getEditedPostAttribute("title")||wp.data.dispatch("core/editor").editPost({title:"TagDiv Composer Draft"});wp.data.dispatch("core/editor").savePost();a.redirectWhenSave()})},redirectWhenSave:function(){var a=this;setTimeout(function(){wp.data.select("core/editor").isSavingPost()?a.redirectWhenSave():location.href=tdcGutenbergSettings.tdcEditLink},300)}};b(function(){c.init()})})(jQuery);