Edit File: themify-builder-gutenberg.min.js
(function(b,e,d,c){var f=d.createElement;b.builderUtils={stateInit:!1,number:0,tempHTML:null,vent:_.extend({},Backbone.Events),isRendered:function(){return document.getElementById("tb_toolbar")},saveHTML:function(a){this.isRendered()&&(this.tempHTML=document.getElementById("tb_canvas_block").innerHTML)},restoreHTML:function(a){if("undefined"!==typeof tb_app&&!_.isNull(this.tempHTML)&&!this.isRendered()&&document.getElementById("tb_canvas_block")&&(document.getElementById("tb_canvas_block").innerHTML= this.tempHTML,!_.isUndefined(tb_app.Instances.Builder[0]))){a=document.getElementById("tb_row_wrapper").querySelectorAll("[data-cid]");a=Array.prototype.slice.call(a);for(var b=0,g=a.length;b<g;++b){var d=tb_app.Models.Registry.lookup(a[b].getAttribute("data-cid"));d&&d.trigger("change:view",a[b])}tb_app.toolbar.setElement(c("#tb_toolbar")).render();tb_app.toolbarCallback();tb_app.Instances.Builder[0].setElement(c("#tb_row_wrapper"));tb_app.Instances.Builder[0].init(!0)}},manageState:function(a){"undefined"=== typeof tb_app||this.stateInit||(this.stateInit=!0,tb_app.vent.on("dom:change",function(){tb_app.hasChanged&&a.setAttributes({data:b.builderUtils.number++})}),tb_app.vent.on("backend:switchfrontend",function(a){window.top.location.href=a}),document.getElementById("block-"+a.clientId).removeAttribute("tabIndex"))},saveBlock:function(){"undefined"!==typeof tb_app&&(this.onClicking?this.onClicking=!1:tb_app.hasChanged?tb_app.Utils.saveBuilder(this.goToFrontend):this.goToFrontend())},goToFrontend:function(){tb_app.redirectFrontend&& tb_app.vent.trigger("backend:switchfrontend",tb_app.redirectFrontend)}};b.registerBlockType("themify-builder/canvas",{title:"Themify Builder",icon:"layout",category:"layout",useOnce:!0,attributes:{data:{source:"meta"}},edit:function(a){b.builderUtils.vent.trigger("edit",a);return f("div",{id:"tb_canvas_block",tabIndex:-1},"placeholder builder")},save:function(){return null}});e=_.debounce(function(a){b.builderUtils.saveHTML(a);b.builderUtils.restoreHTML(a);b.builderUtils.manageState(a)},800);d=_.debounce(function(){b.builderUtils.saveBlock()}, 800);b.builderUtils.vent.on("edit",e);b.builderUtils.vent.on("save",d);c(function(){c("body").on("click",".editor-post-publish-button, .editor-post-save-draft",function(a){tb_app.hasChanged&&tb_app.Utils.saveBuilder(function(){b.builderUtils.onClicking=!0})}).off("click.frontend-btn","#tb_switch_frontend").on("click.frontend-btn","#tb_switch_frontend",function(){var a=c(".editor-post-publish-button");a.bind("DOMSubtreeModified",function(){"Update"!==a.text()||c(".editor-post-saved-state").length|| (b.builderUtils.onClicking=!1,b.builderUtils.saveBlock())})})});c(document).ajaxComplete(function(a,c,d){a=d.url;c="post.php?post="+themifyBuilder.post_ID+"&action=edit&classic-editor=1&meta_box=1";"POST"===d.type&&-1!==a.indexOf(c)&&b.builderUtils.vent.trigger("save")})})(window.wp.blocks,window.wp.i18n,window.wp.element,jQuery);
Back to File Manager