diff --git a/dist/pagebuilder/app.js b/dist/pagebuilder/app.js index 4c2ca89e..3a01423b 100644 --- a/dist/pagebuilder/app.js +++ b/dist/pagebuilder/app.js @@ -1 +1 @@ -!function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=6)}([,,,,,,function(t,e,n){t.exports=n(7)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(8),o=(n.n(i),n(9)),a=(n.n(o),n(10)),r=(n.n(a),n(11)),s=(n.n(r),n(12)),l=(n.n(s),n(13));n.n(l)},function(t,e){$(document).ready(function(){function t(){$(window).width()<1e3&&($("#gjs").addClass("sidebar-collapsed"),e())}function e(){window.editor.trigger("change:canvasOffset canvasScroll")}$(".gjs-editor").append($("#toggle-sidebar")),$(".gjs-pn-panels").prepend($("#sidebar-header")),$(".gjs-pn-panels").append($("#sidebar-bottom-buttons")),$("#toggle-sidebar").click(function(){$("#gjs").toggleClass("sidebar-collapsed"),e()}),t(),window.editor.on("run:open-sm",function(t){$(".gjs-trt-traits").parent().parent().css("display","none"),$(".gjs-sm-sectors").parent().parent().css("display","block"),$("#gjs-sm-advanced .gjs-sm-properties").append($(".gjs-clm-tags"))}),window.editor.on("run:open-tm",function(t){$(".gjs-sm-sectors").parent().parent().css("display","none"),$(".gjs-trt-traits").parent().parent().css("display","block")}),window.editor.on("block:drag:start",function(e){t()});var n=!1;$(document).keydown(function(t){8===t.which&&(n=!0)}).keyup(function(t){8===t.which&&(n=!1)}),$(window).on("beforeunload",function(t){n&&t.preventDefault()})}),window.addEventListener("message",function(t){"page-loaded"===t.data?setTimeout(function(){$("#phpb-loading").addClass("loaded"),$(".gjs-blocks-cs").prepend($("#block-search")),window.isLoaded=!0},500):"touch-start"===t.data&&window.touchStart()},!1)},function(t,e){$(document).on("input","#block-search input",function(){var t=$(this).val().toLowerCase();$(".gjs-blocks-cs .gjs-block").each(function(){$(this).text().toLowerCase().includes(t)?$(this).removeClass("d-none"):$(this).addClass("d-none")})})},function(t,e){$(document).ready(function(){var t="";function e(){o(),setTimeout(function(){var t=n(window.editor.getWrapper().find("[phpb-content-container]")[0]);$.ajax({type:"POST",url:$("#save-page").data("url"),data:{data:JSON.stringify(t)},success:function(){o(),window.toastr.success(window.translations["toastr-changes-saved"])},error:function(){o(),window.toastr.error(window.translations["toastr-saving-failed"])}})},200)}function n(e){e=window.cloneComponent(e),t=window.editor.getCss();var n=function e(n){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var r={};r.current_block={};r.blocks={};var s=o;var l=a;void 0!==n.attributes["block-id"]&&("false"===n.attributes["is-html"]?(s=!0,l=!1):o&&"true"===n.attributes["is-html"]&&(l=!0));n.get("components").forEach(function(t){var n=e(t,s,l);for(var i in n.current_block)r.current_block[i]=n.current_block[i];for(var o in n.blocks)r.blocks[o]=n.blocks[o]});if(void 0!==n.attributes["block-id"])if(o&&"true"===n.attributes["is-html"]&&!1===a)r.current_block[n.attributes["block-id"]]=window.html_beautify(n.toHTML());else if("false"===n.attributes["is-html"]){var c={};n.get("traits").each(function(t){c[t.get("name")]=t.getTargetValue()}),r.current_block.attributes=c,void 0!==n.attributes["style-identifier"]&&t.includes(n.attributes["style-identifier"])&&(r.current_block.attributes["style-identifier"]=n.attributes["style-identifier"]);var d="ID"+(Date.now().toString(36)+Math.random().toString(36).substr(2,5)+i++).toUpperCase();if(n.replaceWith({tagName:"phpb-block",attributes:{slug:n.attributes["block-slug"],id:d}}),o){var u={};u[n.attributes["block-id"]]=r.current_block,r.current_block=u}else r.blocks[d]=r.current_block,r.current_block={}}return r}(e).blocks,o=window.html_beautify(function(t){var e="";t.get("components").forEach(function(t){return e+=t.toHTML()});var n=$(""+e+"");return n.find("phpb-block").each(function(){$(this).replaceWith('[block slug="'+$(this).attr("slug")+'" id="'+$(this).attr("id")+'"]')}),n.html()}(e)),a=window.editor.getCss(),r=window.editor.getStyle();return{html:o,css:a,components:JSON.parse(JSON.stringify(e.get("components"))),blocks:n,style:r}}$("#save-page").click(function(){e()}),$(document).bind("keydown",function(t){if(t.ctrlKey&&83===t.which)return e(),t.preventDefault(),!1}),window.getComponentDataInStorageFormat=function(t){var e=window.cloneComponent(t.parent());return e.get("components").reset(),e.append(t),n(e)};var i=0;function o(){var t=$("#save-page");t.blur(),t.hasClass("waiting")?(t.attr("disabled",!1),t.removeClass("waiting"),t.find(".spinner-border").addClass("d-none")):(t.attr("disabled",!0),t.addClass("waiting"),t.find(".spinner-border").removeClass("d-none"))}})},function(t,e){!function(){function t(){for(var t in window.themeBlocks){var e=window.themeBlocks[t],n=$("").append(e.content);n.find("[phpb-blocks-container]").each(function(){""!==$(this).html()&&""===$(this).html().trim()&&$(this).html("")}),e.content=n.html(),editor.BlockManager.add(t,e)}}function e(t){var n=t;if("phpb-block"===t.get("tagName")){var i=t.attributes.attributes.id;void 0!==window.dynamicBlocks[i]&&void 0!==window.dynamicBlocks[i].html&&(n=t.replaceWith(window.dynamicBlocks[i].html))}n.get("components").each(function(t){return e(t)})}function n(t){var e=!1,n=t.getEl();if(n&&n.style){var i=window.getComputedStyle(n);["background","background-image","background-color"].forEach(function(t){var n=i.getPropertyValue(t);void 0===n||""===n||n.includes("none")||n.includes("rgba(0, 0, 0, 0)")||(e=!0)})}return e}function i(t){return void 0!==window.blockSettings[t.attributes["block-slug"]]&&window.blockSettings[t.attributes["block-slug"]].length}function o(t){if("phpb-block"===t.attributes.tagName){var e=t.parent(),n=cloneComponent(t),i=void 0;e.components().each(function(e){e.cid===t.cid&&(i=t.replaceWith({tagName:"div"}),n.components().each(function(t){i.append(cloneComponent(t))}))}),t.remove(),a(n,i,!0,!1),function(t){if(void 0===window.blockSettings[t.attributes["block-slug"]])return;t.attributes.settings={};var e=[],n=t.attributes["block-id"];if(void 0!==window.dynamicBlocks[n]&&void 0!==window.dynamicBlocks[n].settings.attributes)t.attributes.settings=window.dynamicBlocks[n].settings,e=window.dynamicBlocks[n].settings.attributes;else if(t.parent()&&void 0!==t.parent().attributes.settings){var i=t.parent().attributes.settings;void 0!==i[n]&&void 0!==i[n].attributes&&(t.attributes.settings=i[n],e=i[n].attributes)}void 0!==e["style-identifier"]&&t.addClass(e["style-identifier"]);t.attributes["is-updating"]=!0,window.blockSettings[t.attributes["block-slug"]].forEach(function(n){var i=t.addTrait(n);void 0!==e[n.name]?i.setTargetValue(e[n.name]):void 0!==n["default-value"]&&i.setTargetValue(n["default-value"])}),t.attributes["is-updating"]=!1}(i),o(i)}else t.components().each(function(t){o(t)})}function a(t,e,n,i){var o=t.attributes.attributes;for(var a in o)o.hasOwnProperty(a)&&(i&&(e.attributes.attributes[a]=o[a]),n&&(e.attributes[a]=o[a]))}function r(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(l(t),void 0!==t.attributes.attributes["phpb-content-container"])t.set({droppable:!0,hoverable:!0});else if(void 0!==t.attributes["block-slug"]){var o={selectable:!0,hoverable:!0};e||(o={removable:!0,draggable:!0,copyable:!0,selectable:!0,hoverable:!0,stylable:!0},s(t)),"true"===t.attributes["is-html"]?(e=!1,i=!0):(e=!0,i=!1,t.getEl().setAttribute("data-cursor","default")),t.set(o)}i&&(function(t){var e=t.get("tagName");if(["h1","h2","h3","h4","h5","h6","h7","p","a","img","button","small","b","strong","i","em","ul","li","th","td"].includes(e)||n(t)||"phpb-editable"in t.attributes.attributes||"phpb-blocks-container"in t.attributes.attributes)return function(t){var e={editable:!0};"phpb-blocks-container"in t.attributes.attributes&&(e.droppable=!0,e.selectable=!0);t.set(e),s(t)}(t),!0;return!1}(t)&&"text"===t.attributes.type&&(i=!1));t.get("components").each(function(t){return r(t,e,i)})}function s(t){var e=!1;t.getClasses().forEach(function(t){t.startsWith("ID")&&16===t.length&&(e=t)}),void 0===t.attributes["style-identifier"]&&(t.attributes["style-identifier"]=e||"ID"+(Date.now().toString(36)+Math.random().toString(36).substr(2,5)+c++).toUpperCase()),e||t.addClass(t.attributes["style-identifier"])}function l(t){t.set({removable:!1,draggable:!1,droppable:!1,badgable:!1,stylable:!1,highlightable:!1,copyable:!1,resizable:!1,editable:!1,layerable:!1,selectable:!1,hoverable:!1})}window.editor.on("load",function(n){!function t(e){if("phpb-content-container"in e.attributes.attributes)return;l(e);e.get("components").each(function(e){return t(e)})}(n.getWrapper()),t();var i=n.getWrapper().find("[phpb-content-container]")[0];i.set("custom-name",window.translations["page-content"]),i.components(window.pageComponents),e(i),o(i),setTimeout(function(){r(i)},500)}),window.editor.on("component:selected",function(t){i(t)?$(".gjs-pn-buttons .gjs-pn-btn:nth-of-type(2)").click():""===t.get("type")&&n(t)&&($(".gjs-pn-buttons .gjs-pn-btn:nth-of-type(3)").click(),$("#gjs-sm-position").hasClass("gjs-sm-open")&&$("#gjs-sm-position").find(".gjs-sm-title").click(),$("#gjs-sm-background").hasClass("gjs-sm-open")||$("#gjs-sm-background").find(".gjs-sm-title").click()),i(t)||setTimeout(function(){$(".gjs-trt-traits").html('

'+window.translations["trait-manager"]["no-settings"]+"

")},0),setTimeout(function(){t.attributes.removable||$(".gjs-toolbar .fa-trash-o.gjs-toolbar-item").hide(),t.attributes.copyable||$(".gjs-toolbar .fa-clone.gjs-toolbar-item").hide(),t.attributes.draggable||$(".gjs-toolbar .fa-arrows.gjs-toolbar-item").hide()},0)}),window.editor.on("block:drag:stop",function(t){if(t){var e=t.parent();o(t),r(e)}}),window.editor.on("component:update",function(t){if(!0===window.isLoaded&&!t.attributes["is-updating"]&&void 0!==t.changed.attributes&&0!==$(".gjs-frame").contents().find("#"+t.ccid).length){for(var n=t;n.parent()&&"false"===n.parent().attributes["is-html"];)n=n.parent();(t=n).attributes["is-updating"]=!0,$(".gjs-frame").contents().find("#"+t.ccid).addClass("gjs-freezed");var i=window.editor.getWrapper().find("#"+t.ccid)[0].parent(),a=window.getComponentDataInStorageFormat(t);$.ajax({type:"POST",url:window.renderBlockUrl,data:{data:JSON.stringify(a)},success:function(n){var s=$(n).attr("block-id");void 0===window.dynamicBlocks[s]&&(window.dynamicBlocks[s]={settings:{}}),window.dynamicBlocks[s].settings=void 0===a.blocks[s]?{}:a.blocks[s],t.replaceWith(n),e(i),o(i),r(i);var l=void 0;i.components().each(function(t){t.attributes["block-id"]===s&&(l=t)}),window.editor.select(l)},error:function(){$(".gjs-frame").contents().find("#"+t.ccid).removeClass("gjs-freezed"),t.attributes["is-updating"]=!1}})}}),window.cloneComponent=function(t){var e=t.clone();return function t(e,n){a(e,n,!1,!0);for(var i=0;i1&&void 0!==arguments[1]&&arguments[1];var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var r={};r.current_block={};r.blocks={};var s=i;var l=a;void 0!==n.attributes["block-id"]&&("false"===n.attributes["is-html"]?(s=!0,l=!1):i&&"true"===n.attributes["is-html"]&&(l=!0));n.get("components").forEach(function(t){var n=e(t,s,l);for(var o in n.current_block)r.current_block[o]=n.current_block[o];for(var i in n.blocks)r.blocks[i]=n.blocks[i]});if(void 0!==n.attributes["block-id"])if(i&&"true"===n.attributes["is-html"]&&!1===a)r.current_block[n.attributes["block-id"]]=window.html_beautify(n.toHTML());else if("false"===n.attributes["is-html"]){var c={};n.get("traits").each(function(t){c[t.get("name")]=t.getTargetValue()}),r.current_block.attributes=c,void 0!==n.attributes["style-identifier"]&&t.includes(n.attributes["style-identifier"])&&(r.current_block.attributes["style-identifier"]=n.attributes["style-identifier"]);var d="ID"+(Date.now().toString(36)+Math.random().toString(36).substr(2,5)+o++).toUpperCase();if(n.replaceWith({tagName:"phpb-block",attributes:{slug:n.attributes["block-slug"],id:d}}),i){var u={};u[n.attributes["block-id"]]=r.current_block,r.current_block=u}else r.blocks[d]=r.current_block,r.current_block={}}return r}(e).blocks,i=window.html_beautify(function(t){var e="";t.get("components").forEach(function(t){return e+=t.toHTML()});var n=$(""+e+"");return n.find("phpb-block").each(function(){$(this).replaceWith('[block slug="'+$(this).attr("slug")+'" id="'+$(this).attr("id")+'"]')}),n.html()}(e)),a=window.editor.getCss(),r=window.editor.getStyle();return{html:i,css:a,components:JSON.parse(JSON.stringify(e.get("components"))),blocks:n,style:r}}$("#save-page").click(function(){e()}),$(document).bind("keydown",function(t){if(t.ctrlKey&&83===t.which)return window.editor.store(),e(),t.preventDefault(),!1}),window.getComponentDataInStorageFormat=function(t){var e=window.cloneComponent(t.parent());return e.get("components").reset(),e.append(t),n(e)};var o=0;function i(){var t=$("#save-page");t.blur(),t.hasClass("waiting")?(t.attr("disabled",!1),t.removeClass("waiting"),t.find(".spinner-border").addClass("d-none")):(t.attr("disabled",!0),t.addClass("waiting"),t.find(".spinner-border").removeClass("d-none"))}})},function(t,e){!function(){function t(){for(var t in window.themeBlocks){var e=window.themeBlocks[t],n=$("").append(e.content);n.find("[phpb-blocks-container]").each(function(){""!==$(this).html()&&""===$(this).html().trim()&&$(this).html("")}),e.content=n.html(),editor.BlockManager.add(t,e)}}function e(t){var n=t;if("phpb-block"===t.get("tagName")){var o=t.attributes.attributes.id;void 0!==window.dynamicBlocks[o]&&void 0!==window.dynamicBlocks[o].html&&(n=t.replaceWith(window.dynamicBlocks[o].html))}n.get("components").each(function(t){return e(t)})}function n(t){var e=!1,n=t.getEl();if(n&&n.style){var o=window.getComputedStyle(n);["background","background-image","background-color"].forEach(function(t){var n=o.getPropertyValue(t);void 0===n||""===n||n.includes("none")||n.includes("rgba(0, 0, 0, 0)")||(e=!0)})}return e}function o(t){return void 0!==window.blockSettings[t.attributes["block-slug"]]&&window.blockSettings[t.attributes["block-slug"]].length}function i(t){if("phpb-block"===t.attributes.tagName){var e=t.parent(),n=cloneComponent(t),o=void 0;e.components().each(function(e){e.cid===t.cid&&(o=t.replaceWith({tagName:"div"}),n.components().each(function(t){o.append(cloneComponent(t))}))}),t.remove(),a(n,o,!0,!1),function(t){if(void 0===window.blockSettings[t.attributes["block-slug"]])return;t.attributes.settings={};var e=[],n=t.attributes["block-id"];if(void 0!==window.dynamicBlocks[n]&&void 0!==window.dynamicBlocks[n].settings.attributes)t.attributes.settings=window.dynamicBlocks[n].settings,e=window.dynamicBlocks[n].settings.attributes;else if(t.parent()&&void 0!==t.parent().attributes.settings){var o=t.parent().attributes.settings;void 0!==o[n]&&void 0!==o[n].attributes&&(t.attributes.settings=o[n],e=o[n].attributes)}void 0!==e["style-identifier"]&&t.addClass(e["style-identifier"]);t.attributes["is-updating"]=!0,window.blockSettings[t.attributes["block-slug"]].forEach(function(n){var o=t.addTrait(n);void 0!==e[n.name]?o.setTargetValue(e[n.name]):void 0!==n["default-value"]&&o.setTargetValue(n["default-value"])}),t.attributes["is-updating"]=!1}(o),i(o)}else t.components().each(function(t){i(t)})}function a(t,e,n,o){var i=t.attributes.attributes;for(var a in i)i.hasOwnProperty(a)&&(o&&(e.attributes.attributes[a]=i[a]),n&&(e.attributes[a]=i[a]))}function r(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(l(t),void 0!==t.attributes.attributes["phpb-content-container"])t.set({droppable:!0,hoverable:!0});else if(void 0!==t.attributes["block-slug"]){var i={selectable:!0,hoverable:!0};e||(i={removable:!0,draggable:!0,copyable:!0,selectable:!0,hoverable:!0,stylable:!0},s(t)),"true"===t.attributes["is-html"]?(e=!1,o=!0):(e=!0,o=!1,t.getEl().setAttribute("data-cursor","default")),t.set(i)}o&&(function(t){var e=t.get("tagName");if(["h1","h2","h3","h4","h5","h6","h7","p","a","img","button","small","b","strong","i","em","ul","li","th","td"].includes(e)||n(t)||"phpb-editable"in t.attributes.attributes||"phpb-blocks-container"in t.attributes.attributes)return function(t){var e={editable:!0};"phpb-blocks-container"in t.attributes.attributes&&(e.droppable=!0,e.selectable=!0);t.set(e),s(t)}(t),!0;return!1}(t)&&"text"===t.attributes.type&&(o=!1));t.get("components").each(function(t){return r(t,e,o)})}function s(t){var e=!1;t.getClasses().forEach(function(t){t.startsWith("ID")&&16===t.length&&(e=t)}),void 0===t.attributes["style-identifier"]&&(t.attributes["style-identifier"]=e||"ID"+(Date.now().toString(36)+Math.random().toString(36).substr(2,5)+c++).toUpperCase()),e||t.addClass(t.attributes["style-identifier"])}function l(t){t.set({removable:!1,draggable:!1,droppable:!1,badgable:!1,stylable:!1,highlightable:!1,copyable:!1,resizable:!1,editable:!1,layerable:!1,selectable:!1,hoverable:!1})}window.editor.on("load",function(n){!function t(e){if("phpb-content-container"in e.attributes.attributes)return;l(e);e.get("components").each(function(e){return t(e)})}(n.getWrapper()),t();var o=n.getWrapper().find("[phpb-content-container]")[0];o.set("custom-name",window.translations["page-content"]),o.components(window.pageComponents),e(o),i(o),setTimeout(function(){r(o)},500)}),window.editor.on("component:selected",function(t){o(t)?$(".gjs-pn-buttons .gjs-pn-btn:nth-of-type(2)").click():""===t.get("type")&&n(t)&&($(".gjs-pn-buttons .gjs-pn-btn:nth-of-type(3)").click(),$("#gjs-sm-position").hasClass("gjs-sm-open")&&$("#gjs-sm-position").find(".gjs-sm-title").click(),$("#gjs-sm-background").hasClass("gjs-sm-open")||$("#gjs-sm-background").find(".gjs-sm-title").click()),o(t)||setTimeout(function(){$(".gjs-trt-traits").html('

'+window.translations["trait-manager"]["no-settings"]+"

")},0),setTimeout(function(){t.attributes.removable||$(".gjs-toolbar .fa-trash-o.gjs-toolbar-item").hide(),t.attributes.copyable||$(".gjs-toolbar .fa-clone.gjs-toolbar-item").hide(),t.attributes.draggable||$(".gjs-toolbar .fa-arrows.gjs-toolbar-item").hide()},0)}),window.editor.on("block:drag:stop",function(t){if(t){var e=t.parent();i(t),r(e)}}),window.editor.on("component:update",function(t){if(!0===window.isLoaded&&!t.attributes["is-updating"]&&void 0!==t.changed.attributes&&0!==$(".gjs-frame").contents().find("#"+t.ccid).length){for(var n=t;n.parent()&&"false"===n.parent().attributes["is-html"];)n=n.parent();(t=n).attributes["is-updating"]=!0,$(".gjs-frame").contents().find("#"+t.ccid).addClass("gjs-freezed");var o=window.editor.getWrapper().find("#"+t.ccid)[0].parent(),a=window.getComponentDataInStorageFormat(t);$.ajax({type:"POST",url:window.renderBlockUrl,data:{data:JSON.stringify(a)},success:function(n){var s=$(n).attr("block-id");void 0===window.dynamicBlocks[s]&&(window.dynamicBlocks[s]={settings:{}}),window.dynamicBlocks[s].settings=void 0===a.blocks[s]?{}:a.blocks[s],t.replaceWith(n),e(o),i(o),r(o);var l=void 0;o.components().each(function(t){t.attributes["block-id"]===s&&(l=t)}),window.editor.select(l)},error:function(){$(".gjs-frame").contents().find("#"+t.ccid).removeClass("gjs-freezed"),t.attributes["is-updating"]=!1}})}}),window.cloneComponent=function(t){var e=t.clone();return function t(e,n){a(e,n,!1,!0);for(var o=0;o