diff --git a/plugi-core/dist/PageBuilderBody.js b/plugi-core/dist/PageBuilderBody.js index f059d2b..bf5264f 100644 --- a/plugi-core/dist/PageBuilderBody.js +++ b/plugi-core/dist/PageBuilderBody.js @@ -15,7 +15,7 @@ transition: opacity 0.3s ease, transform 0.3s ease; opacity: 0; transform: translateY(-10px); - `;let o=document.createElement(`i`);o.className=n===`success`?`fa fa-check-circle`:n===`error`?`fa fa-exclamation-circle`:`fa fa-info-circle`,a.appendChild(o);let s=document.createElement(`span`);s.innerText=e,s.style.flex=`1`,a.appendChild(s),i.appendChild(a),requestAnimationFrame(()=>{a.style.opacity=`1`,a.style.transform=`translateY(0)`}),setTimeout(()=>{a.style.opacity=`0`,a.style.transform=`translateY(-10px)`,setTimeout(()=>{a.parentNode&&a.parentNode.removeChild(a)},300)},r)}window.toastr={success(e,t=3e3){n(e,`success`,t)},error(e,t=4e3){n(e,`error`,t)},info(e,t=3e3){n(e,`info`,t)}};let r=document.querySelector(`.gjs-editor`),i=document.getElementById(`toggle-sidebar`),a=document.getElementById(`sidebar-header`),o=document.getElementById(`sidebar-bottom-buttons`),s=document.querySelector(`.gjs-pn-panels`),c=document.getElementById(`gjs`);r&&i&&r.appendChild(i),s&&(a&&s.prepend(a),o&&s.appendChild(o)),i&&i.addEventListener(`click`,function(){c&&c.classList.toggle(`sidebar-collapsed`),u()}),l(),window.editor&&(window.editor.on(`run:open-sm`,function(e){let t=document.querySelector(`.gjs-trt-traits`);t&&t.parentElement&&t.parentElement.parentElement&&(t.parentElement.parentElement.style.display=`none`);let n=document.querySelector(`.gjs-sm-sectors`);n&&n.parentElement&&n.parentElement.parentElement&&(n.parentElement.parentElement.style.display=`block`);let r=document.querySelector(`#gjs-sm-advanced .gjs-sm-properties`),i=document.querySelector(`.gjs-clm-tags`);r&&i&&r.appendChild(i)}),window.editor.on(`run:open-tm`,function(e){let t=document.querySelector(`.gjs-sm-sectors`);t&&t.parentElement&&t.parentElement.parentElement&&(t.parentElement.parentElement.style.display=`none`);let n=document.querySelector(`.gjs-trt-traits`);n&&n.parentElement&&n.parentElement.parentElement&&(n.parentElement.parentElement.style.display=`block`)}),window.editor.on(`block:drag:start`,function(e){l()}),window.editor.on(`rteToolbarPosUpdate`,function(e){window.editor&&window.editor.getSelected()&&window.editor.getSelected().getEl()&&setTimeout(function(){let t=document.querySelector(`.gjs-rte-toolbar`);if(t&&t.getBoundingClientRect().top+window.scrollY0&&(t.style.top=n+`px`)}},0)}));function l(){window.innerWidth<1e3&&(c&&c.classList.add(`sidebar-collapsed`),u())}function u(){window.editor&&window.editor.trigger&&window.editor.trigger(`change:canvasOffset canvasScroll`)}let d=!1;document.addEventListener(`keydown`,function(e){(e.key===`Backspace`||e.which===8)&&(d=!0)}),document.addEventListener(`keyup`,function(e){(e.key===`Backspace`||e.which===8)&&(d=!1)}),window.addEventListener(`beforeunload`,function(e){d&&e.preventDefault()});function f(){let e=document.querySelector(`.gjs-blocks-cs`),t=document.getElementById(`block-search`);e&&t&&e.prepend(t)}window.addEventListener(`message`,p,!1);function p(e){if(e.data===`page-loaded`){let e=document.getElementById(`phpb-loading`);e&&e.classList.add(`loaded`),f(),window.isLoaded=!0,window.dispatchEvent(new CustomEvent(`pagebuilder-page-loaded`))}else e.data===`touch-start`&&window.touchStart&&window.touchStart()}document.addEventListener(`input`,function(e){let t=e.target.closest(`#block-search input`);if(!t)return;let n=t.value.toLowerCase().trim();document.querySelectorAll(`.gjs-block-category`).forEach(e=>{let t=!1;e.querySelectorAll(`.gjs-block`).forEach(e=>{e.dataset.originalHtml||(e.dataset.originalHtml=e.innerHTML);let r=e.textContent||``;if(!n||r.toLowerCase().includes(n)){e.classList.remove(`d-none`),t=!0;let i=e.querySelector(`.gjs-block-label`);if(i){if(n){let t=RegExp(`(`+n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)+`)`,`gi`),a=r.replace(t,`$1`);i.innerHTML=e.dataset.originalHtml.replace(r.trim(),a)}else e.innerHTML=e.dataset.originalHtml}}else e.classList.add(`d-none`)}),t?e.classList.remove(`d-none`):e.classList.add(`d-none`)})}),window.customBuilderScripts={},window.editor.on(`component:create`,e=>{if(e.components().length){let t=e.components().models[e.components().length-1];if(t.attributes.type===`script`){let n=e.attributes.attributes[`block-id`];n===void 0&&(n=e.attributes.attributes.id);let r=t,i=!1;for(;r.parent();)if(r=r.parent(),r.attributes.attributes[`phpb-content-container`]){i=!0;break}i&&(window.customBuilderScripts[n]=t.toHTML(),t.remove())}}}),window.editor.on(`component:add`,function(e){if(e.attributes[`run-builder-script`]!==void 0){let t=customBuilderScripts;window.customBuilderScripts[e.attributes[`block-id`]]=customBuilderScripts[e.attributes[`run-builder-script`]],runScriptsOfComponentAndChildren(e),window.customBuilderScripts=t,delete e.attributes[`run-builder-script`]}}),window.editor.on(`sorter:drag:end`,function(e){let t=e.modelToDrop;t&&t.attributes&&(t.attributes[`block-id`]||t.attributes.id)&&window.runScriptsOfComponentAndChildren(t)}),window.runScriptsOfComponentAndChildren=function(e){m(e),e.components().each(function(e){runScriptsOfComponentAndChildren(e)})};function m(e){let t=e.attributes[`block-id`];if(t===void 0&&(t=e.attributes.attributes.id),t&&window.customBuilderScripts[t]!==void 0){let n=e.attributes[`style-identifier`],r=document.createElement(`div`);r.innerHTML=window.customBuilderScripts[t];let i=r.querySelector(`script`);if(i){let e=`(function(){\nlet block = document.getElementsByClassName("${n}")[0];\nlet blockSelector = ".${n}";\nlet inPageBuilder = true;\n${i.innerHTML}\n})();`,t=document.createElement(`script`);t.type=`text/javascript`,t.textContent=e;let r=window.editor.Canvas.getDocument();r&&r.body&&r.body.appendChild(t)}}}function h(){_();let e=document.createElement(`script`);e.type=`text/javascript`,e.src=window.injectionScriptUrl;let t=e.outerHTML+`';\n window.initialComponents = window.initialComponents.replace('', fullScript + '');\n\n Object.keys(window.languages || {}).forEach(languageCode => {\n if (window.pageBlocks[languageCode] === null) {\n window.pageBlocks[languageCode] = {};\n }\n });\n\n activateLanguage(window.currentLanguage);\n }\n\n /**\n * GrapesJS wraps each external script with a start[number]Start() method,\n * which needs to be called on switching language.\n */\n function startFirstScript() {\n let scriptTags = document.querySelectorAll(\"script\");\n for (let i = 0; i < scriptTags.length; i++) {\n let node = scriptTags[i];\n if (node.innerHTML.startsWith('var script')) {\n let beforeEquals = node.innerHTML.split('=')[0];\n let scriptNumber = parseInt(beforeEquals.replace('var script', ''));\n if (Number.isInteger(scriptNumber)) {\n let startScriptMethodName = 'script' + scriptNumber + 'Start';\n if (typeof window[startScriptMethodName] === 'function') {\n if (scriptNumber !== 0) {\n window[startScriptMethodName]();\n }\n return false;\n }\n }\n }\n }\n }\n\n /**\n * Add all theme blocks to GrapesJS blocks manager.\n */\n function addThemeBlocks() {\n for (let blockSlug in window.themeBlocks) {\n let block = window.themeBlocks[blockSlug];\n\n // remove whitespace from phpb-block-container elements, otherwise these components will become type=text,\n // resulting in components dropped inside the container jumping to the dropped position - 1\n let tempDiv = document.createElement(\"div\");\n tempDiv.innerHTML = block.content;\n tempDiv.querySelectorAll(\"[phpb-blocks-container]\").forEach(cont => {\n if (cont.innerHTML !== '' && cont.innerHTML.trim() === '') {\n cont.innerHTML = '';\n }\n });\n window.themeBlocks[blockSlug].content = tempDiv.innerHTML;\n block.content = tempDiv.innerHTML;\n\n editor.BlockManager.add(blockSlug, block);\n }\n }\n\n /**\n * Switch pagebuilder to another language variant on changing the language selector.\n */\n document.addEventListener(\"change\", function(e) {\n const select = e.target.closest(\"#language-selector select\");\n if (!select) return;\n let selectedLanguage = select.value;\n\n window.switchLanguage(selectedLanguage, function() {\n activateLanguage(selectedLanguage);\n });\n });\n\n /**\n * Activate the given language variant in the pagebuilder.\n *\n * @param newLanguage\n */\n window.activateLanguage = function(newLanguage) {\n window.currentLanguage = newLanguage;\n\n // reset GrapesJS editor before loading the new language variant\n window.editor.select();\n window.editor.DomComponents.clear();\n window.editor.DomComponents.componentsById = [];\n window.editor.UndoManager.clear();\n\n // remove any script tags from previous languages\n window.editor.Canvas.getDocument().querySelectorAll(\"script\").forEach(function(node) {\n node.remove();\n });\n\n // load initial non-editable layout components\n window.editor.setComponents(window.initialComponents);\n denyAccessToLayoutElements(editor.getWrapper());\n window.editor.getWrapper().find(\"[phpb-content-container]\").forEach((container, index) => {\n container.set('custom-name', window.translations['page-content']);\n\n // reload components of this content container (adding all root phpb-block elements)\n container.components(window.contentContainerComponents[index]);\n\n // replace phpb-block elements with the server-side rendered version of each block\n replacePlaceholdersForRenderedBlocks(container);\n\n // apply the stored block settings to the server-side rendered html\n applyBlockAttributesToComponents(container);\n });\n };\n\n window.addEventListener('pagebuilder-page-loaded', function(event) {\n window.editor.getWrapper().find(\"[phpb-content-container]\").forEach(container => {\n restrictEditAccess(container);\n window.runScriptsOfComponentAndChildren(container);\n });\n window.setWaiting(false);\n\n setTimeout(function() {\n window.changesOffset = window.editor.getModel().get('changesCount');\n window.afterInitialRendering = true;\n }, 250);\n });\n\n /**\n * Replace phpb-block elements with the server-side rendered version of each block.\n *\n * @param component\n */\n function replacePlaceholdersForRenderedBlocks(component) {\n if (!component) return;\n\n // if we encounter a pagebuilder block, replace it with the server-side rendered html\n if (component.get && component.get('tagName') === 'phpb-block') {\n let id = component.attributes && component.attributes.attributes ? component.attributes.attributes.id : null;\n if (id && window.pageBlocks[window.currentLanguage] && window.pageBlocks[window.currentLanguage][id] !== undefined && window.pageBlocks[window.currentLanguage][id]['html'] !== undefined) {\n let replaced = component.replaceWith(window.pageBlocks[window.currentLanguage][id]['html']);\n window.pageBlocks[window.currentLanguage][id]['html'] = '';\n let replacedComponents = Array.isArray(replaced) ? replaced : [replaced];\n replacedComponents.forEach(comp => {\n if (comp && comp.get && comp.get('components')) {\n comp.get('components').each(childComponent => replacePlaceholdersForRenderedBlocks(childComponent));\n }\n });\n return;\n }\n }\n\n // replace placeholders inside child components\n if (component.get && component.get('components')) {\n component.get('components').each(childComponent => replacePlaceholdersForRenderedBlocks(childComponent));\n }\n }\n\n /**\n * Function for denying edit access to this component and all children that belong to the layout.\n *\n * @param component\n */\n function denyAccessToLayoutElements(component) {\n if ('phpb-content-container' in component.attributes.attributes) return;\n\n disableAllEditFunctionality(component);\n\n // apply restrictions to child components\n component.get('components').each(component => denyAccessToLayoutElements(component));\n }\n\n\n /**\n * Component select handler.\n */\n window.editor.on('component:selected', function(component) {\n // if the component has settings, activate settings panel in pagebuilder sidebar\n if (componentHasBlockSettings(component)) {\n const btn = document.querySelector(\".gjs-pn-buttons .gjs-pn-btn:nth-of-type(2)\");\n if (btn) btn.click();\n }\n else if (component.get('type') === '' && componentHasBackground(component)) {\n // on selecting a default component without settings, with editable background, show background styling\n const btn = document.querySelector(\".gjs-pn-buttons .gjs-pn-btn:nth-of-type(3)\");\n if (btn) btn.click();\n const pos = document.getElementById(\"gjs-sm-position\");\n if (pos && pos.classList.contains(\"gjs-sm-open\")) {\n const title = pos.querySelector(\".gjs-sm-title\");\n if (title) title.click();\n }\n const bg = document.getElementById(\"gjs-sm-background\");\n if (bg && !bg.classList.contains(\"gjs-sm-open\")) {\n const title = bg.querySelector(\".gjs-sm-title\");\n if (title) title.click();\n }\n }\n\n // if component has no settings, add no settings text to settings panel in sidebar\n if (! componentHasBlockSettings(component)) {\n setTimeout(function() {\n const traits = document.querySelector(\".gjs-trt-traits\");\n if (traits) {\n traits.innerHTML = '

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

';\n }\n }, 0);\n }\n\n // only show the toolbar buttons that are applicable\n setTimeout(function() {\n const trash = document.querySelector(\".gjs-toolbar .fa-trash-o.gjs-toolbar-item\");\n if (trash && !component.attributes.removable) trash.style.display = 'none';\n\n const clone = document.querySelector(\".gjs-toolbar .fa-clone.gjs-toolbar-item\");\n if (clone && !component.attributes.copyable) clone.style.display = 'none';\n\n const arrows = document.querySelector(\".gjs-toolbar .fa-arrows.gjs-toolbar-item\");\n if (arrows && !component.attributes.draggable) arrows.style.display = 'none';\n\n if (! component.attributes.removable && ! component.attributes.copyable && ! component.attributes.draggable) {\n window.editor.select(component.parent());\n }\n\n let blockSlug = component.attributes['block-slug'];\n if (blockSlug && window.themeBlocks && window.themeBlocks[blockSlug]) {\n let labelHtml = window.themeBlocks[blockSlug]['label'];\n let labelTextParts = labelHtml.split(\"\");\n if (labelTextParts.length > 1) {\n const toolbar = document.querySelector(\".gjs-toolbar\");\n if (toolbar) toolbar.setAttribute('title', \"Bloknaam: \" + labelTextParts[1]);\n }\n }\n }, 0);\n });\n\n\n /**\n * Component clone handler.\n */\n window.editor.on('component:clone', function(component) {\n // if the clone is performed by the user, do not copy the block id and style identifier\n if (! isCloningFromScript) {\n let originalComponent = window.editor.getWrapper().find('.' + component.attributes['style-identifier'])[0];\n\n if (component.attributes['style-identifier'] !== undefined && component.attributes['style-identifier'] !== '') {\n component.removeClass(component.attributes['style-identifier']);\n delete component.attributes['style-identifier'];\n addUniqueClass(component);\n }\n component.attributes['block-id'] = component.attributes['block-slug'];\n\n // pass a reference of the scripts of the original component to run on the cloned component\n if (originalComponent && window.customBuilderScripts[originalComponent.attributes['block-id']] !== undefined) {\n component.attributes['run-builder-script'] = originalComponent.attributes['block-id'];\n }\n }\n });\n\n\n /**\n * Return whether the given component contains a CSS background, that should be editable.\n *\n * @param component\n * @returns {boolean}\n */\n function componentHasBackground(component) {\n let hasBackground = false;\n\n let componentElement = component.getEl();\n if (componentElement && componentElement.style) {\n let componentStyle = window.getComputedStyle(componentElement);\n\n ['background', 'background-image', 'background-color'].forEach(property => {\n let value = componentStyle.getPropertyValue(property);\n if (value !== undefined && value !== '' && ! value.includes('none') && ! value.includes('rgba(0, 0, 0, 0)')) {\n hasBackground = true;\n }\n });\n }\n\n return hasBackground;\n }\n\n /**\n * Return whether the given component has settings defined in its block config file.\n *\n * @param component\n * @returns {boolean}\n */\n function componentHasBlockSettings(component) {\n return component.attributes.traits.length > 0;\n }\n\n /**\n * On dropping a component on the canvas, apply attributes of the container phpb-block element with configuration passed\n * from the server and restrict edit access to editable components.\n */\n window.editor.on('block:drag:stop', function(droppedComponent) {\n // ensure component drop was successful\n if (! droppedComponent || ! droppedComponent.attributes || ! droppedComponent.attributes.attributes) return;\n\n let draggedBlockId = generateId();\n droppedComponent.attributes.attributes['dropped-component-id'] = draggedBlockId;\n\n let parent = droppedComponent.parent();\n applyBlockAttributesToComponents(droppedComponent);\n\n // at this point droppedComponent is replaced in the DOM by the actual component (without the phpb-block element),\n // so we need to find the dropped component again in the context of its parent\n parent.components().each(function(child) {\n if (child.attributes['dropped-component-id'] === draggedBlockId) {\n delete child.attributes['dropped-component-id'];\n droppedComponent = child;\n }\n });\n restrictEditAccess(droppedComponent);\n\n window.runScriptsOfComponentAndChildren(droppedComponent);\n });\n\n /**\n * Apply the block attributes which are stored in elements to the top-level html element inside the block.\n * If the block starts with multiple top-level html elements, add a div element wrapping the block's top-level elements.\n *\n * @param component\n */\n function applyBlockAttributesToComponents(component) {\n if (component.attributes.tagName === 'phpb-block') {\n let container = component.parent();\n let clone = cloneComponent(component);\n\n // since component is a that should be removed and replaced by its children,\n // the component's parent's child that has the id of the component needs to be replaced\n let blockRootComponent;\n if (component.attributes.attributes['is-html'] === 'false') {\n container.components().each(function(componentSibling) {\n if (componentSibling.cid === component.cid) {\n // replace the by the actual component\n // the component is wrapped with a wrapper element to allow block styling (via a unique .style-identifier selector)\n let wrapperElement = ('wrapper' in component.attributes.attributes) ? component.attributes.attributes['wrapper'] : 'div';\n let rep = component.replaceWith({tagName: wrapperElement});\n blockRootComponent = Array.isArray(rep) ? rep[0] : rep;\n blockRootComponent.attributes['is-style-wrapper'] = true;\n clone.components().each(function(componentChild) {\n blockRootComponent.append(cloneComponent(componentChild));\n });\n }\n });\n } else {\n container.components().each(function(componentSibling) {\n if (componentSibling.cid === component.cid) {\n // if the has one direct child, replace it by its only child\n // else, replace it by a wrapper div to allow block styling (via a unique .style-identifier selector)\n if (clone.components().length === 1) {\n let firstChild = cloneComponent(clone.components().models[0]);\n let rep = component.replaceWith(firstChild);\n blockRootComponent = Array.isArray(rep) ? rep[0] : rep;\n } else {\n let rep = component.replaceWith({tagName: 'div'});\n blockRootComponent = Array.isArray(rep) ? rep[0] : rep;\n blockRootComponent.attributes['is-style-wrapper'] = true;\n clone.components().each(function(componentChild) {\n blockRootComponent.append(cloneComponent(componentChild));\n });\n }\n }\n });\n }\n component.remove();\n\n copyAttributes(clone, blockRootComponent, true, false);\n // add all settings of this component to the settings panel in the sidebar\n addSettingsToSidebar(blockRootComponent);\n // recursive call to find and replace elements of nested blocks (loaded via shortcodes)\n applyBlockAttributesToComponents(blockRootComponent);\n } else {\n component.components().each(function(childComponent) {\n // recursive call to find and replace elements of nested blocks (loaded via shortcodes)\n applyBlockAttributesToComponents(childComponent);\n });\n }\n }\n\n /**\n * Get the current setting values for the given component.\n *\n * @param component\n */\n function getCurrentSettingValues(component) {\n // Block settings are stored in window.pageBlocks in a structure starting with each root block (the first ancestor that does not have a dynamic parent itself).\n // So, we need to find the root of the given component and store all block ids along the way, in order to traverse the pageBlocks structure to the settings of the given component.\n // These block ids are only unique in the context of their parent (we can have multiple instances of the same nested block structure), so we call them relative IDs.\n let relativeIds = [];\n\n // get the root component of the given component (its first ancestor that does not have a dynamic parent itself or the block that is inside a blocks container)\n let rootComponent = component;\n let hasDynamicAncestor = false;\n while (rootComponent.parent() &&\n rootComponent.parent().attributes.attributes['phpb-blocks-container'] === undefined &&\n rootComponent.parent().attributes['is-html'] !== 'true' &&\n rootComponent.parent().attributes.attributes['phpb-content-container'] === undefined\n ) {\n if (rootComponent.parent().attributes['is-html'] === 'false') {\n hasDynamicAncestor = true;\n }\n if (rootComponent.attributes['block-id'] !== undefined) {\n relativeIds.push(rootComponent.attributes['block-id']);\n }\n rootComponent = rootComponent.parent();\n }\n\n let rootId = component.attributes['block-id'];\n if (hasDynamicAncestor) {\n rootId = rootComponent.attributes['block-id'];\n } else {\n relativeIds = [];\n }\n\n // get the component settings by traversing the pageBlocks structure\n let settings = window.pageBlocks[window.currentLanguage][rootId];\n relativeIds.reverse().forEach(function(relativeId) {\n if (settings === undefined || settings.blocks === undefined || settings.blocks[relativeId] === undefined) {\n settings = {};\n } else {\n settings = settings.blocks[relativeId];\n }\n });\n\n // return the values stored in the current component's settings structure\n let settingsValues = {};\n if (settings !== undefined && settings.settings !== undefined && settings.settings.attributes !== undefined) {\n settingsValues = settings.settings.attributes;\n }\n return settingsValues;\n }\n\n /**\n * Add all settings from the block's config file to the given component,\n * to allow them to be changed in the settings side panel.\n *\n * @param component\n */\n function addSettingsToSidebar(component) {\n if (window.blockSettings[component.attributes['block-slug']] === undefined) {\n return;\n }\n component.attributes.settings = {};\n\n let settingValues = getCurrentSettingValues(component);\n\n // set style identifier class to the block wrapper, if an identifier has been stored during earlier getDataInStorageFormat calls\n if (settingValues['style-identifier'] !== undefined) {\n component.addClass(settingValues['style-identifier']);\n }\n\n // for each setting add a trait to the settings sidebar panel with the earlier stored or default value\n component.attributes['is-updating'] = true;\n let settings = window.blockSettings[component.attributes['block-slug']];\n settings.forEach(function(setting) {\n let trait = component.addTrait(setting);\n if (settingValues[setting['name']] !== undefined) {\n trait[0].setTargetValue(settingValues[setting['name']]);\n } else if (setting['default-value'] !== undefined) {\n trait[0].setTargetValue(setting['default-value']);\n }\n });\n component.attributes['is-updating'] = false;\n }\n\n /**\n * On updating an attribute (block setting from the settings side panel), refresh dynamic block via Ajax.\n */\n window.editor.on('component:update', async function(component) {\n const frame = document.querySelector(\".gjs-frame\");\n const frameDoc = frame && (frame.contentDocument || (frame.contentWindow && frame.contentWindow.document));\n const frameEl = frameDoc ? frameDoc.getElementById(component.ccid) : null;\n\n if (window.isLoaded !== true ||\n component.attributes['block-slug'] === undefined ||\n component.attributes['is-updating'] ||\n component.changed['attributes'] === undefined ||\n !frameEl\n ) {\n return;\n }\n // dynamic pagebuilder blocks can depend on data passed by dynamic parent blocks,\n // so we need to update the closest parent which does not have a dynamic parent itself or the block that is inside a blocks container.\n // also keep track of all intermediate block ids, for re-selecting the currently selected component.\n let relativeIds = [];\n let ancestorToUpdate = component;\n let hasDynamicAncestor = false;\n while (ancestorToUpdate.parent() &&\n ancestorToUpdate.parent().attributes.attributes['phpb-blocks-container'] === undefined &&\n ancestorToUpdate.parent().attributes['is-html'] !== 'true' &&\n ancestorToUpdate.parent().attributes.attributes['phpb-content-container'] === undefined\n ) {\n if (ancestorToUpdate.parent().attributes['is-html'] === 'false') {\n hasDynamicAncestor = true;\n }\n if (ancestorToUpdate.attributes['block-id'] !== undefined) {\n relativeIds.push(ancestorToUpdate.attributes['block-id']);\n }\n ancestorToUpdate = ancestorToUpdate.parent();\n }\n\n if (hasDynamicAncestor) {\n component = ancestorToUpdate;\n } else {\n relativeIds = [];\n }\n\n component.attributes['is-updating'] = true;\n if (frameEl) frameEl.classList.add('gjs-freezed');\n\n let container = window.editor.getWrapper().find(\"#\" + component.ccid)[0].parent();\n let data = window.getComponentDataInStorageFormat(component);\n\n // refresh component contents with updated version requested via fetch call\n try {\n const formData = new URLSearchParams();\n formData.append('data', JSON.stringify(data));\n formData.append('language', window.currentLanguage);\n\n const response = await fetch(window.renderBlockUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'X-Requested-With': 'XMLHttpRequest'\n },\n body: formData\n });\n\n if (!response.ok) {\n if (frameEl) frameEl.classList.remove('gjs-freezed');\n component.attributes['is-updating'] = false;\n window.toastr.error(window.translations['toastr-component-update-failed']);\n return;\n }\n\n const blockHtml = await response.text();\n let parsedDiv = document.createElement('div');\n parsedDiv.innerHTML = blockHtml;\n let firstEl = parsedDiv.firstElementChild;\n let blockId = firstEl ? firstEl.getAttribute('block-id') : null;\n\n // set the block settings for the updated component to the new values\n window.pageBlocks[window.currentLanguage][blockId] = (data.blocks[blockId] === undefined) ? {} : data.blocks[blockId];\n\n // replace old component for the rendered html returned by the server\n component.replaceWith(blockHtml);\n replacePlaceholdersForRenderedBlocks(container);\n applyBlockAttributesToComponents(container);\n restrictEditAccess(container, false, false);\n\n // run builder scripts of the replaced component and all its children\n let replacedComponent = findChildViaBlockIdsPath(container, [blockId]);\n runScriptsOfComponentAndChildren(replacedComponent);\n\n // select the component that was selected before the ajax call\n relativeIds.push(blockId);\n let componentToSelect = findChildViaBlockIdsPath(container, relativeIds.reverse());\n window.editor.select(componentToSelect);\n } catch (error) {\n if (frameEl) frameEl.classList.remove('gjs-freezed');\n component.attributes['is-updating'] = false;\n window.toastr.error(window.translations['toastr-component-update-failed']);\n }\n });\n\n /**\n * Traverse the children of the given component via the given path of block IDs\n * and return the component with the last ID from the list.\n *\n * @param component\n * @param blockIds\n * @returns {null|*}\n */\n function findChildViaBlockIdsPath(component, blockIds) {\n // foobar\n if (blockIds.length === 0) {\n return component;\n }\n\n let result = null;\n\n component.forEachChild(function(child) {\n if (child.attributes['block-id'] === blockIds[0]) {\n result = findChildViaBlockIdsPath(child, blockIds.slice(1));\n return false;\n }\n });\n\n component.forEachChild(function(child) {\n let childResult = findChildViaBlockIdsPath(child, blockIds);\n if (childResult !== null) {\n result = childResult;\n return false;\n }\n });\n\n return result;\n }\n\n /**\n * Clone the given component (while preserving all attributes, like IDs).\n *\n * @param component\n */\n let isCloningFromScript = false;\n window.cloneComponent = function(component) {\n isCloningFromScript = true;\n\n let clone = component.clone();\n deepCopyAttributes(component, clone);\n\n isCloningFromScript = false;\n return clone;\n };\n\n /**\n * Apply the attributes of the given component and its children to each corresponding component of the given clone.\n *\n * @param component\n * @param clone\n */\n function deepCopyAttributes(component, clone) {\n // apply all attributes from component to clone\n copyAttributes(component, clone, false, true);\n // apply attributes from component's children to clone's children\n for (let index = 0; index < component.components().length; index++) {\n let componentChild = component.components().models[index];\n let cloneChild = clone.components().models[index];\n deepCopyAttributes(componentChild, cloneChild);\n }\n }\n\n /**\n * Apply the attributes of the given component to the given target component.\n *\n * @param component\n * @param targetComponent\n * @param copyGrapesAttributes whether all GrapesJS component attributes (like permissions) should be copied\n * @param copyHtmlElementAttributes whether the html element attributes should be copied\n */\n function copyAttributes(component, targetComponent, copyGrapesAttributes, copyHtmlElementAttributes) {\n let componentAttributes = component.attributes.attributes;\n for (let attribute in componentAttributes) {\n if (copyHtmlElementAttributes) {\n targetComponent.attributes.attributes[attribute] = componentAttributes[attribute];\n }\n if (copyGrapesAttributes) {\n targetComponent.attributes[attribute] = componentAttributes[attribute];\n }\n }\n }\n\n /**\n * Function for only allowing edit access on whitelisted components.\n *\n * @param component\n * @param directlyInsideDynamicBlock\n * @param allowEditableComponents\n */\n function restrictEditAccess(component, directlyInsideDynamicBlock = false, allowEditableComponents = true) {\n disableAllEditFunctionality(component);\n\n if (component.attributes.attributes['phpb-content-container'] !== undefined) {\n // the content container of the current page can receive other components\n component.set({\n droppable: true,\n hoverable: true,\n });\n } else if (component.attributes['block-slug'] !== undefined) {\n // change visibility of child elements that depend on whether this block is editable\n component.find('[phpb-hide-if-not-editable]').forEach((element) => {\n if (allowEditableComponents || window.afterInitialRendering) {\n element.addClass('editable');\n } else {\n element.removeClass('editable');\n }\n });\n\n // we just entered a new block, set default permissions\n let permissions = {\n selectable: true,\n hoverable: true,\n };\n if (! directlyInsideDynamicBlock) {\n // the block we entered is not located directly inside a dynamic block, hence this block can be removed, dragged, configured and styled\n permissions = {\n removable: true,\n draggable: true,\n copyable: true,\n selectable: true,\n hoverable: true,\n stylable: true,\n };\n // for styling this particular block, the block needs to have a unique class\n addUniqueClass(component);\n }\n if (component.attributes['is-html'] === 'true') {\n // the block we just entered is an html block,\n // the next layer of child blocks are not directly inside a dynamic block\n directlyInsideDynamicBlock = false;\n // in an html block, editing elements (based on their html tag) is allowed\n allowEditableComponents = true;\n } else {\n // the block we just entered is dynamic,\n // the next layer of child blocks are directly inside a dynamic block\n directlyInsideDynamicBlock = true;\n // in a dynamic block, editing elements (based on their html tag) is not allowed\n allowEditableComponents = false;\n // dynamic blocks do not have text-editable components, so remove text cursors\n component.getEl().setAttribute('data-cursor', 'default');\n }\n component.set(permissions);\n }\n\n // for raw content components, set editable to true and ignore processing editability for any child component\n if (component.attributes.attributes['data-raw-content'] !== undefined) {\n component.set({editable: true});\n return;\n }\n\n // set editable access based on tags, styling or html class attribute\n if (allowEditableComponents) {\n allowEditBasedOnComponentAttributes(component);\n\n // if the component is made text-editable, re-add the raw html contents\n // to ensure the text editor does not deal with elements with attributes added by GrapesJS\n if (component.attributes['made-text-editable'] === 'true') {\n component.attributes.attributes['data-raw-content'] = 'true';\n\n // refresh the current component in order to switch its component type to raw-content.\n // this disables GrapesJS parsing of any child elements, avoiding that any GrapesJS specific html attributes are added\n let replaced = component.replaceWith(component.toHTML());\n let newComponent = Array.isArray(replaced) ? replaced[0] : replaced;\n if (newComponent) {\n // copy important attributes from the original component to the refreshed component\n ['block-id', 'block-slug', 'is-html', 'style-identifier'].forEach(attribute => {\n newComponent.attributes[attribute] = component.attributes[attribute];\n });\n // apply block/component edit restrictions to the new raw-content type version of the component\n restrictEditAccess(newComponent);\n }\n return;\n }\n }\n\n // apply edit restrictions to child components\n component.get('components').each(component => restrictEditAccess(component, directlyInsideDynamicBlock, allowEditableComponents));\n }\n\n /**\n * Set the given component's editability based on which tag the component represents,\n * which attributes are set or which styling is applied.\n *\n * @param component\n * @returns {boolean}\n */\n function allowEditBasedOnComponentAttributes(component) {\n let htmlTag = component.get('tagName');\n\n let textEditableTags = [\n //'div','span', // needed for editable bootstrap alert, but cannot be used since divs (block containers) then cannot be removed\n 'h1','h2','h3','h4','h5','h6','h7',\n 'p','small','b','strong','i','em','label','button',\n 'ol', 'ul','li','table'\n ];\n let otherEditableTags = [\n 'img'\n ];\n\n let settings = {};\n if ('phpb-blocks-container' in component.attributes.attributes) {\n settings.hoverable = true;\n settings.selectable = true;\n settings.droppable = true;\n }\n\n if (textEditableTags.includes(htmlTag) || 'phpb-editable' in component.attributes.attributes) {\n settings.editable = true;\n component.attributes['made-text-editable'] = 'true';\n } else if (otherEditableTags.includes(htmlTag)) {\n settings.editable = true;\n }\n\n if (componentHasBackground(component)) {\n settings.hoverable = true;\n settings.selectable = true;\n settings.stylable = true;\n }\n\n if (htmlTag === 'a') {\n settings.hoverable = true;\n settings.selectable = true;\n settings.stylable = true;\n settings.removable = true;\n }\n\n if (Object.keys(settings).length > 0) {\n component.set(settings);\n if (settings.stylable !== undefined && settings.stylable) {\n addUniqueClass(component);\n }\n }\n }\n\n /**\n * Add a unique class to this component to ensure style only applies to this component instance.\n *\n * @param component\n */\n function addUniqueClass(component) {\n // get component identifier class if one is already added to the component's html when saving the pagebuilder previously\n let componentIdentifier = false;\n component.getClasses().forEach(componentClass => {\n if (componentClass.startsWith('ID') && componentClass.length >= 16) {\n componentIdentifier = componentClass;\n }\n });\n\n if (component.attributes['style-identifier'] === undefined) {\n component.attributes['style-identifier'] = componentIdentifier ? componentIdentifier : generateId();\n }\n component.addClass(component.attributes['style-identifier']);\n }\n\n /**\n * Disable all edit functionality on the given component.\n *\n * @param component\n */\n function disableAllEditFunctionality(component) {\n component.set({\n removable: false,\n draggable: false,\n droppable: false,\n badgable: false,\n stylable: false,\n highlightable: false,\n copyable: false,\n resizable: false,\n editable: false,\n layerable: false,\n selectable: false,\n hoverable: false\n });\n }\n\n /**\n * Generate a unique id string.\n *\n * Based on: https://gist.github.com/gordonbrander/2230317\n */\n let counter = 0;\n function generateId() {\n return 'ID' + (Date.now().toString(36)\n + Math.random().toString(36).substr(2, 5) + counter++).toUpperCase();\n }\n\n /**\n * Wait for GrapesJS to be fully loaded before trying to load the components in the page builder.\n */\n function waitForGrapesToLoad() {\n if (window.grapesJSLoaded) {\n afterGrapesJSLoaded();\n } else {\n setTimeout(waitForGrapesToLoad, 100);\n }\n }\n waitForGrapesToLoad();\n\n\n","\n\n window.pageData = {};\n\n window.changesOffset = 0;\n window.onbeforeunload = confirmExit;\n function confirmExit() {\n let changesCount = window.editor.getModel().get('changesCount') - window.changesOffset;\n if (changesCount > 0) {\n return \"Are you sure? There are unsaved changes.\";\n }\n }\n\n /**\n * Save page on clicking save button.\n */\n const savePageBtn = document.getElementById(\"save-page\");\n if (savePageBtn) {\n savePageBtn.addEventListener('click', function() {\n saveAllTranslationsToServer();\n });\n }\n\n /**\n * Save page on Ctrl + S.\n */\n document.addEventListener(\"keydown\", function(e) {\n if (e.ctrlKey && (e.key === 's' || e.key === 'S' || e.which === 83)) {\n // text-editor updates are not applied until focus is lost, so force GrapesJS update\n window.editor.store();\n\n saveAllTranslationsToServer();\n e.preventDefault();\n return false;\n }\n });\n\n /**\n * Switch the pagebuilder to the given language.\n * This stores the all data of the current language locally for later use and renders the given language variant on the server.\n *\n * @param newLanguage\n * @param callback\n */\n window.switchLanguage = function(newLanguage, callback) {\n window.setWaiting(true);\n\n saveCurrentTranslationLocally(async function() {\n applyChangesFromCurrentLanguageToNewLanguage(newLanguage);\n\n let data = window.pageData;\n data.blocks = {[newLanguage]: window.pageBlocks[newLanguage]};\n\n const formData = new URLSearchParams();\n formData.append('data', JSON.stringify(data));\n formData.append('language', newLanguage);\n\n // render the language variant server-side\n try {\n const response = await fetch(window.renderLanguageVariantUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'X-Requested-With': 'XMLHttpRequest'\n },\n body: formData\n });\n\n if (!response.ok) {\n let errData = {};\n try { errData = await response.json(); } catch(e) {}\n let errorMessage = response.statusText + ' ' + response.status;\n errorMessage = errData.message ? (errorMessage + ': \"' + errData.message + '\"') : errorMessage;\n window.toastr.error(errorMessage);\n window.toastr.error(window.translations['toastr-switching-language-failed']);\n callback();\n window.setWaiting(false);\n return;\n }\n\n const responseText = await response.text();\n let parsed = JSON.parse(responseText);\n window.pageBlocks[newLanguage] = parsed.dynamicBlocks ? parsed.dynamicBlocks : {};\n callback();\n window.setWaiting(false);\n } catch (error) {\n callback();\n console.error(error);\n window.toastr.error(error.message || 'Error');\n window.toastr.error(window.translations['toastr-switching-language-failed']);\n window.setWaiting(false);\n }\n });\n };\n\n /**\n * Copy new blocks of the current language to the new language or remove old blocks from the new language.\n *\n * @param newLanguage\n */\n function applyChangesFromCurrentLanguageToNewLanguage(newLanguage) {\n let newLanguageBlocks = window.pageBlocks[newLanguage];\n let currentLanguageBlocks = window.pageBlocks[window.currentLanguage];\n\n if (newLanguageBlocks === undefined) {\n newLanguageBlocks = currentLanguageBlocks;\n } else {\n updateNestedBlocks(currentLanguageBlocks, newLanguageBlocks);\n\n // copy missing blocks from the current language to the target language\n for (let blockId in currentLanguageBlocks) {\n if (newLanguageBlocks[blockId] === undefined) {\n newLanguageBlocks[blockId] = currentLanguageBlocks[blockId];\n }\n }\n }\n\n // copy the content of blocks containers of the current language to the blocks containers of the new language\n for (let blockId in currentLanguageBlocks) {\n let currentBlockHtml = (currentLanguageBlocks[blockId] && currentLanguageBlocks[blockId]['html']) || '';\n let newBlockHtml = (newLanguageBlocks[blockId] && newLanguageBlocks[blockId]['html']) || '';\n\n let currDiv = document.createElement(\"div\");\n currDiv.innerHTML = currentBlockHtml;\n let newDiv = document.createElement(\"div\");\n newDiv.innerHTML = newBlockHtml;\n\n let currContainers = currDiv.querySelectorAll(\"[phpb-blocks-container]\");\n let newContainers = newDiv.querySelectorAll(\"[phpb-blocks-container]\");\n\n currContainers.forEach((cont, index) => {\n if (newContainers[index]) {\n newContainers[index].innerHTML = cont.innerHTML;\n }\n });\n newLanguageBlocks[blockId]['html'] = newDiv.innerHTML;\n }\n\n window.pageBlocks[newLanguage] = newLanguageBlocks;\n }\n\n /**\n * Replace phpb-blocks-container html snippets if a block of the current language already exists in the target language.\n * This ensures all child blocks are present for all languages and they remain in the same order\n */\n function updateNestedBlocks(currentLanguageBlocks, newLanguageBlocks) {\n for (let blockId in currentLanguageBlocks) {\n // skip if the parent block does not yet exist in the target language\n if (newLanguageBlocks[blockId] === undefined) {\n continue;\n }\n\n for (let subBlockId in currentLanguageBlocks[blockId].blocks) {\n let updatedSubBlock = currentLanguageBlocks[blockId].blocks[subBlockId];\n let oldSubBlock = newLanguageBlocks[blockId].blocks[subBlockId];\n if (! updatedSubBlock || ! oldSubBlock) {\n continue;\n }\n\n let updatedSubBlockMatches = updatedSubBlock.html.match(/phpb-blocks-container(.*)>(.*)(.*) {\n let data = getContainerContentInStorageFormat(container);\n\n window.pageData['css'] = mergeCss(existingCss, data.css);\n window.pageData['style'] = data.style;\n window.pageData['html'][index] = data.html;\n window.pageData['components'][index] = data.components;\n\n window.pageBlocks[window.currentLanguage] = {...window.pageBlocks[window.currentLanguage], ...data.blocks};\n window.contentContainerComponents[index] = data.components;\n });\n\n if (callback) {\n callback();\n }\n }, 200);\n }\n\n /**\n * Add all selectors from existingCss that are missing in newCss.\n * Backwards compatibility fix: losing CSS due to having different block style identifiers for different languages.\n */\n function mergeCss(existingCss, newCss) {\n if (! existingCss) {\n return newCss;\n }\n let pageBlocksString = JSON.stringify(window.pageBlocks);\n let regex = \"\\\\.ID(.*?){(.*?)}\"\n let matches = existingCss.match(new RegExp(regex, 'g'));\n if (! matches) {\n return newCss;\n }\n matches.forEach(function(css) {\n let selector = css.split('{')[0];\n let pageBlocksStringSelector = selector.replace('.', ' ').trim();\n if (newCss.indexOf(selector) === -1 && pageBlocksString.indexOf(pageBlocksStringSelector) >= 0) {\n newCss += css;\n }\n });\n return newCss;\n }\n\n /**\n * Remove the style selectors that are no longer present among the current page blocks.\n */\n function removeOldStyleSelectors(styleComponents) {\n let pageBlocksString = JSON.stringify(window.pageBlocks);\n\n let updatedStyleComponents = [];\n styleComponents.forEach(styleComponent => {\n if (styleComponent.attributes.selectors.models.length) {\n let selector = styleComponent.attributes.selectors.models[0].id;\n if (pageBlocksString.includes(selector)) {\n updatedStyleComponents.push(styleComponent);\n }\n }\n });\n return updatedStyleComponents;\n }\n\n /**\n * Save the data of all translation variants on the server.\n */\n function saveAllTranslationsToServer() {\n toggleSaving();\n\n saveCurrentTranslationLocally(async function() {\n\n // update all language variants with the latest data of the current language we just saved locally\n Object.keys(window.languages || {}).forEach(languageCode => {\n if (languageCode !== window.currentLanguage) {\n applyChangesFromCurrentLanguageToNewLanguage(languageCode);\n }\n });\n\n let data = window.pageData;\n data.style = removeOldStyleSelectors(data.style);\n data.blocks = window.pageBlocks;\n\n const saveBtn = document.getElementById(\"save-page\");\n const saveUrl = saveBtn ? (saveBtn.dataset.url || saveBtn.getAttribute('data-url')) : '';\n\n const formData = new URLSearchParams();\n formData.append('data', JSON.stringify(data));\n\n try {\n const response = await fetch(saveUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'X-Requested-With': 'XMLHttpRequest'\n },\n body: formData\n });\n\n toggleSaving();\n\n if (!response.ok) {\n let errData = {};\n try { errData = await response.json(); } catch(e) {}\n let errorMessage = response.statusText + ' ' + response.status;\n errorMessage = errData.message ? (errorMessage + ': \"' + errData.message + '\"') : errorMessage;\n window.toastr.error(errorMessage);\n window.toastr.error(window.translations['toastr-saving-failed']);\n return;\n }\n\n window.toastr.success(window.translations['toastr-changes-saved']);\n\n setTimeout(function() {\n window.changesOffset = window.editor.getModel().get('changesCount');\n }, 250);\n } catch(error) {\n toggleSaving();\n console.error(error);\n window.toastr.error(error.message || 'Error');\n window.toastr.error(window.translations['toastr-saving-failed']);\n }\n });\n }\n\n /**\n * Get the given component in storage format (in context of its container with all siblings removed).\n *\n * @param component\n */\n window.getComponentDataInStorageFormat = function(component) {\n // clone component's parent, enabling us to temporarily remove all component's siblings without updating the pagebuilder\n let container = window.cloneComponent(component.parent());\n\n\n console.log({\n container: container,\n componentParent: component.parent(),\n })\n // remove all component's siblings since we only want to return the given component in storage format\n\n // container.get('components').reset();\n // container.append(component);\n const componentId = component.attributes['block-id']\n console.log(component.attributes['block-id'])\n container.components().forEach(c => {\n console.log({c})\n // console.log(c?.attributes['block-id'])\n // console.log(c?.attributes['block-id'] !== componentId)\n if(c?.attributes['block-id'] !== componentId) {\n c?.remove()\n }\n })\n\n console.log({\n containerL: container.get('components').length,\n componentParentL: component.parent().get('components').length,\n })\n return getContainerContentInStorageFormat(container);\n };\n\n /**\n * Get the given container in storage format.\n *\n * @param container\n */\n function getContainerContentInStorageFormat(container) {\n // remove all existing references while cloning GrapesJS components,\n // this prevents GrapesJS from changing our IDs due to ID collisions\n let componentReferences = window.editor.DomComponents.componentsById;\n window.editor.DomComponents.componentsById = [];\n\n // we need to clone the container, since we will be replacing components with placeholders and we don't want to update the page builder\n container = window.cloneComponent(container);\n // replace each pagebuilder block for a shortcode and phpb-block element and return an array of all page blocks data\n let blocksData = replaceDynamicBlocksWithPlaceholders(container).blocks;\n\n let html = window.html_beautify(getContainerHtml(container));\n let css = window.editor.getCss();\n let style = window.editor.getStyle();\n let components = JSON.parse(JSON.stringify(container.get('components')));\n\n // switch back to original GrapesJS component references\n window.editor.DomComponents.componentsById = componentReferences;\n\n return {\n html: html,\n css: css,\n components: components,\n blocks: blocksData,\n style: style,\n }\n }\n\n /**\n * Return the html representation of the contents of the given container.\n *\n * @param container\n */\n function getContainerHtml(container) {\n let html = '';\n container.get('components').forEach(component => html += component.toHTML());\n let div = document.createElement(\"div\");\n div.innerHTML = html;\n // replace phpb-block elements with shortcode\n div.querySelectorAll('phpb-block').forEach(el => {\n let slug = el.getAttribute('slug') || '';\n let id = el.getAttribute('id') || '';\n el.replaceWith('[block slug=\"' + slug + '\" id=\"' + id + '\"]');\n });\n return div.innerHTML;\n }\n\n /**\n * Return the html representation of the given component.\n *\n * @param component\n */\n function getComponentHtml(component) {\n let div = document.createElement(\"div\");\n div.innerHTML = component.toHTML();\n // replace phpb-block elements with shortcode\n div.querySelectorAll('phpb-block').forEach(el => {\n let slug = el.getAttribute('slug') || '';\n let id = el.getAttribute('id') || '';\n el.replaceWith('[block slug=\"' + slug + '\" id=\"' + id + '\"]');\n });\n return div.innerHTML;\n }\n\n /**\n * Replace all blocks with is-html === false with a component that contains all block attributes.\n *\n * @param component\n * @param parentIsDynamic\n * @param parentIsHtmlInsideDynamic\n */\n function replaceDynamicBlocksWithPlaceholders(component, parentIsDynamic = false, parentIsHtmlInsideDynamic = false) {\n // data structure to be filled with the data of nested blocks via recursive calls\n let data = {\n current_block: {settings: {}, blocks: {}, html: \"\", is_html: false},\n blocks: {}\n };\n\n // update variables for passing context to the recursive calls on child components\n let newParentIsDynamic = parentIsDynamic;\n let newParentIsHtmlInsideDynamic = parentIsHtmlInsideDynamic;\n if (component.attributes['block-id'] !== undefined) {\n if (component.attributes['is-html'] === 'false') {\n newParentIsDynamic = true;\n newParentIsHtmlInsideDynamic = false;\n } else if (parentIsDynamic) {\n newParentIsDynamic = false;\n newParentIsHtmlInsideDynamic = true;\n }\n }\n\n // depth-first recursive call for replacing nested blocks (the deepest blocks are handled first)\n component.get('components').forEach(function(childComponent) {\n let childData = replaceDynamicBlocksWithPlaceholders(childComponent, newParentIsDynamic, newParentIsHtmlInsideDynamic);\n\n // update data object with child data\n for (let key in childData.current_block.blocks) { data.current_block.blocks[key] = childData.current_block.blocks[key]; }\n for (let key in childData.blocks) { data.blocks[key] = childData.blocks[key]; }\n });\n\n // if the method is called with a cloned container (which does not have a parent), this top-level component does not need any changes\n if (! component.parent()) {\n return data;\n }\n\n // if the component is not a block, no replacements need to be done\n if (component.attributes['block-id'] === undefined) {\n return data;\n }\n\n // do the actual replacement of this component with a placeholder component\n if (component.attributes['is-html'] === 'true') {\n if (parentIsDynamic) {\n // the full html content of html blocks directly inside a dynamic block should be stored in parent context using its block-id,\n // this is important because a dynamic block defines block ids and this can collide with block ids hardcoded in other dynamic blocks\n data.current_block['blocks'][component.attributes['block-id']] = {settings: {}, blocks: {}, html: window.html_beautify(getComponentHtml(component)), is_html: true};\n } else {\n // html blocks outside direct context of dynamic blocks should be stored as a block itself\n\n // store the block's style-identifier\n // this will be used as class in a wrapper around the dynamic block to give the block its styling\n if (component.attributes['style-identifier'] !== undefined) {\n data.current_block['settings']['attributes'] = {'style-identifier': component.attributes['style-identifier']};\n }\n\n // replace this html component by a shortcode with a unique id\n let instanceId = component.attributes['block-id'];\n if (! component.attributes['block-id'].startsWith('ID')) {\n instanceId = generateId();\n }\n\n component.replaceWith({\n tagName: 'phpb-block',\n attributes: {\n slug: component.attributes['block-slug'],\n id: instanceId\n }\n });\n\n // store the block data globally in the blocks array\n data.blocks[instanceId] = {settings: data.current_block['settings'], blocks: {}, html: window.html_beautify(getComponentHtml(component)), is_html: true};\n data.current_block = {settings: {}, blocks: {}, html: \"\", is_html: false};\n }\n } else {\n // store the attributes set to this block using traits in the settings side panel\n let attributes = {};\n component.get('traits').each(function(trait) {\n attributes[trait.get('name')] = trait.getTargetValue();\n });\n data.current_block['settings']['attributes'] = attributes;\n\n // store the block's style-identifier\n // this will be used as class in a wrapper around the dynamic block to give the block its styling\n if (component.attributes['style-identifier'] !== undefined) {\n data.current_block['settings']['attributes']['style-identifier'] = component.attributes['style-identifier'];\n }\n\n // replace this dynamic component by a shortcode with a unique id\n let instanceId = component.attributes['block-id'];\n if (! component.attributes['block-id'].startsWith('ID')) {\n instanceId = generateId();\n }\n component.replaceWith({\n tagName: 'phpb-block',\n attributes: {\n slug: component.attributes['block-slug'],\n id: instanceId\n }\n });\n\n // store data.current_block data inside data.blocks with the unique id we just generated\n if (parentIsDynamic) {\n // inside a dynamic block, the block data is passed to the context of its parent block (so current_block is used)\n let currentBlockForParent = {settings: {}, blocks: {}, html: \"\", is_html: false};\n currentBlockForParent['blocks'][component.attributes['block-id']] = data.current_block;\n data.current_block = currentBlockForParent;\n } else {\n // outside dynamic blocks, the block data is globally stored in the blocks array\n data.blocks[instanceId] = data.current_block;\n data.current_block = {settings: {}, blocks: {}, html: \"\", is_html: false};\n }\n }\n\n return data;\n }\n\n /**\n * Generate a unique id string.\n *\n * Based on: https://gist.github.com/gordonbrander/2230317\n */\n let counter = 0;\n function generateId() {\n return 'ID' + (Date.now().toString(36)\n + Math.random().toString(36).substr(2, 5) + counter++).toUpperCase();\n }\n\n /**\n * Set the page builder waiting status.\n */\n window.setWaiting = function(value) {\n let wrapper = window.editor.DomComponents.getWrapper();\n if (value) {\n wrapper.addClass(\"gjs-waiting\");\n } else {\n wrapper.removeClass(\"gjs-waiting\");\n }\n };\n\n /**\n * Toggle the save button waiting status.\n */\n function toggleSaving() {\n let button = document.getElementById(\"save-page\");\n if (!button) return;\n button.blur();\n\n let spinner = button.querySelector('.spinner-border') || button.querySelector('.loading');\n\n if (button.classList.contains('waiting')) {\n button.removeAttribute(\"disabled\");\n button.classList.remove('waiting');\n if (spinner) spinner.classList.add('d-none');\n } else {\n button.setAttribute(\"disabled\", \"true\");\n button.classList.add('waiting');\n if (spinner) spinner.classList.remove('d-none');\n }\n }\n\n\n","export function sanitizeHtml(html) {\n if (!html) return '';\n // remove all not allowed tags\n let result = html.replace(/<(?!\\/?(?:a|table|tr|td|th|thead|tbody|tfoot|caption|col|colgroup|p|ul|ol|li|br|strong|em|b|i|u|strike|s|sub|sup|h1|h2|h3|h4|h5|h6|blockquote|pre|hr|span)\\b)[^>]+>/gim, '');\n\n // remove disallowed attributes from allowed tags, keeping href on anchor and style on table elements\n result = result.replace(/<(a|table|tr|td|th|thead|tbody|tfoot|caption|col|colgroup|p|ul|ol|li|br|strong|em|b|i|u|strike|s|sub|sup|h1|h2|h3|h4|h5|h6|blockquote|pre|hr|span)\\b([^>]*)>/gim, function(match, tag, attrs) {\n tag = tag.toLowerCase();\n if (tag === 'a') {\n const hrefMatch = attrs.match(/href=\"([^\"]*)\"/i) || attrs.match(/href='([^']*)'/i);\n const targetMatch = attrs.match(/target=\"([^\"]*)\"/i) || attrs.match(/target='([^']*)'/i);\n const href = hrefMatch ? ` href=\"${hrefMatch[1]}\"` : '';\n const target = targetMatch && targetMatch[1] === '_blank' ? ' target=\"_blank\"' : '';\n return ``;\n }\n if ('|table|tr|td|th|thead|tbody|tfoot|'.includes('|' + tag + '|')) {\n const styleMatch = attrs.match(/style=\"([^\"]*)\"/i) || attrs.match(/style='([^']*)'/i);\n return styleMatch ? `<${tag} style=\"${styleMatch[1]}\">` : `<${tag}>`;\n }\n return `<${tag}>`;\n });\n\n return result;\n}\n\nfunction setupPasteSanitizer(editor) {\n const handlePaste = ({ ev, rte }) => {\n ev.preventDefault();\n const clipboardData = ev.clipboardData || window.clipboardData;\n if (!clipboardData) return;\n\n const html = clipboardData.getData('text/html');\n const text = clipboardData.getData('text/plain');\n\n if (html) {\n const cleanHtml = sanitizeHtml(html);\n rte.insertHTML(cleanHtml);\n } else if (text) {\n const escaped = text\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/(?:\\r\\n|\\r|\\n)/g, '
');\n rte.insertHTML(escaped);\n }\n };\n\n if (editor.RichTextEditor) {\n const rteConfig = editor.RichTextEditor.getConfig();\n rteConfig.onPaste = handlePaste;\n }\n}\n\nfunction registerToolbarActions(editor) {\n const rte = editor.RichTextEditor;\n if (!rte) return;\n\n // Custom Link action\n if (rte.get('link')) {\n rte.remove('link');\n }\n rte.add('link', {\n icon: '',\n attributes: { title: (window.translations && window.translations['link']) || 'Link' },\n result: r => openLinkModal(editor, r)\n });\n\n if (!rte.get('unorderedList')) {\n rte.add('unorderedList', {\n icon: '',\n attributes: { title: 'Bulleted List' },\n result: r => r.exec('insertUnorderedList')\n });\n }\n\n if (!rte.get('orderedList')) {\n rte.add('orderedList', {\n icon: '',\n attributes: { title: 'Numbered List' },\n result: r => r.exec('insertOrderedList')\n });\n }\n\n if (!rte.get('justifyLeft')) {\n rte.add('justifyLeft', {\n icon: '',\n attributes: { title: 'Align Left' },\n result: r => r.exec('justifyLeft')\n });\n }\n\n if (!rte.get('justifyCenter')) {\n rte.add('justifyCenter', {\n icon: '',\n attributes: { title: 'Align Center' },\n result: r => r.exec('justifyCenter')\n });\n }\n\n if (!rte.get('justifyRight')) {\n rte.add('justifyRight', {\n icon: '',\n attributes: { title: 'Align Right' },\n result: r => r.exec('justifyRight')\n });\n }\n}\n\nfunction openLinkModal(editor, rte) {\n const sel = rte.selection();\n let savedRange = null;\n let currentAnchor = null;\n\n if (sel && sel.rangeCount > 0) {\n savedRange = sel.getRangeAt(0).cloneRange();\n let node = sel.anchorNode;\n if (node) {\n if (node.nodeType === Node.TEXT_NODE) node = node.parentNode;\n currentAnchor = node.closest ? node.closest('a') : null;\n }\n }\n\n let initialType = 'page';\n let initialPageId = '';\n let initialUrl = '';\n let initialTargetBlank = false;\n\n if (currentAnchor) {\n const href = currentAnchor.getAttribute('href') || '';\n if (currentAnchor.getAttribute('target') === '_blank') {\n initialTargetBlank = true;\n }\n if (href.startsWith('[page id=')) {\n initialType = 'page';\n initialPageId = href.substring(9, href.length - 1);\n } else {\n initialType = 'url';\n initialUrl = href;\n }\n }\n\n const pages = window.pages || [];\n const translations = window.translations || {};\n\n const container = document.createElement('div');\n container.className = 'gjs-link-modal-form';\n container.style.padding = '10px 0';\n\n // Type selector: Internal Page vs External URL\n const typeGroup = document.createElement('div');\n typeGroup.style.marginBottom = '12px';\n typeGroup.innerHTML = `\n \n
\n \n \n
\n `;\n container.appendChild(typeGroup);\n\n // Page selection container\n const pageGroup = document.createElement('div');\n pageGroup.style.marginBottom = '12px';\n pageGroup.style.display = initialType === 'page' ? 'block' : 'none';\n\n let pageOptionsHtml = '';\n pages.forEach(item => {\n const title = Array.isArray(item) ? item[0] : (item.title || item.name);\n const id = Array.isArray(item) ? item[1] : item.id;\n const isSelected = String(id) === String(initialPageId) ? 'selected' : '';\n pageOptionsHtml += ``;\n });\n\n pageGroup.innerHTML = `\n \n \n `;\n container.appendChild(pageGroup);\n\n // URL input container\n const urlGroup = document.createElement('div');\n urlGroup.style.marginBottom = '12px';\n urlGroup.style.display = initialType === 'url' ? 'block' : 'none';\n urlGroup.innerHTML = `\n \n \n `;\n container.appendChild(urlGroup);\n\n // Toggle between page and URL\n const radios = typeGroup.querySelectorAll('input[type=\"radio\"]');\n radios.forEach(radio => {\n radio.addEventListener('change', () => {\n if (radio.value === 'page') {\n pageGroup.style.display = 'block';\n urlGroup.style.display = 'none';\n } else {\n pageGroup.style.display = 'none';\n urlGroup.style.display = 'block';\n }\n });\n });\n\n // Target blank checkbox\n const targetGroup = document.createElement('div');\n targetGroup.style.marginBottom = '16px';\n targetGroup.innerHTML = `\n \n `;\n container.appendChild(targetGroup);\n\n // Buttons\n const buttonsGroup = document.createElement('div');\n buttonsGroup.style.display = 'flex';\n buttonsGroup.style.gap = '8px';\n buttonsGroup.style.justifyContent = 'flex-end';\n\n const cancelBtn = document.createElement('button');\n cancelBtn.type = 'button';\n cancelBtn.className = 'btn';\n cancelBtn.innerText = translations['cancel'] || 'Cancel';\n cancelBtn.addEventListener('click', () => editor.Modal.close());\n buttonsGroup.appendChild(cancelBtn);\n\n if (currentAnchor) {\n const unlinkBtn = document.createElement('button');\n unlinkBtn.type = 'button';\n unlinkBtn.className = 'btn btn-danger';\n unlinkBtn.style.color = '#e53e3e';\n unlinkBtn.innerText = translations['unlink'] || 'Remove Link';\n unlinkBtn.addEventListener('click', () => {\n const parent = currentAnchor.parentNode;\n while (currentAnchor.firstChild) {\n parent.insertBefore(currentAnchor.firstChild, currentAnchor);\n }\n parent.removeChild(currentAnchor);\n editor.Modal.close();\n });\n buttonsGroup.appendChild(unlinkBtn);\n }\n\n const applyBtn = document.createElement('button');\n applyBtn.type = 'button';\n applyBtn.className = 'btn btn-primary';\n applyBtn.style.backgroundColor = '#3b82f6';\n applyBtn.style.color = '#fff';\n applyBtn.innerText = translations['apply'] || 'Apply';\n applyBtn.addEventListener('click', () => {\n const selectedType = typeGroup.querySelector('input[type=\"radio\"]:checked').value;\n const pageSelect = pageGroup.querySelector('select');\n const urlInput = urlGroup.querySelector('input');\n const targetBlank = targetGroup.querySelector('input').checked;\n\n let href = '';\n if (selectedType === 'page') {\n if (pageSelect.value) {\n href = `[page id=${pageSelect.value}]`;\n }\n } else {\n href = urlInput.value.trim();\n }\n\n if (!href) {\n editor.Modal.close();\n return;\n }\n\n if (savedRange && rte.doc) {\n const win = rte.doc.defaultView || window;\n const currentSel = win.getSelection();\n if (currentSel) {\n currentSel.removeAllRanges();\n currentSel.addRange(savedRange);\n }\n }\n\n if (currentAnchor) {\n currentAnchor.setAttribute('href', href);\n if (targetBlank) {\n currentAnchor.setAttribute('target', '_blank');\n } else {\n currentAnchor.removeAttribute('target');\n }\n } else {\n const selectedText = savedRange ? savedRange.toString() : '';\n const targetAttr = targetBlank ? ' target=\"_blank\"' : '';\n const textToInsert = selectedText || href;\n rte.insertHTML(`${textToInsert}`);\n }\n\n editor.Modal.close();\n });\n buttonsGroup.appendChild(applyBtn);\n\n container.appendChild(buttonsGroup);\n\n editor.Modal.open({\n title: translations['link'] || 'Link',\n content: container\n });\n}\n\nlet isInitialized = false;\nexport function initRteLinkManager(editor) {\n if (!editor || !editor.RichTextEditor || isInitialized) return;\n isInitialized = true;\n setupPasteSanitizer(editor);\n registerToolbarActions(editor);\n}\n\nif (typeof window !== 'undefined') {\n if (window.editor) {\n initRteLinkManager(window.editor);\n } else {\n window.addEventListener('load', () => {\n if (window.editor) initRteLinkManager(window.editor);\n });\n }\n}\n","\n\n window.touchStart = function() {\n const gjsEl = document.getElementById('gjs');\n if (gjsEl) gjsEl.classList.add('sidebar-collapsed');\n};\n\n"],"mappings":"C,WAAA,IAAIE,EAAiB,KAErB,SAASC,GAAoB,CAOzB,OANKD,GAAmB,SAAS,KAAK,SAASA,CAAc,IACzDA,EAAiB,SAAS,cAAc,KAAK,EAC7CA,EAAe,UAAY,4BAC3BA,EAAe,MAAM,QAAU,4HAC/B,SAAS,KAAK,YAAYA,CAAc,GAErCA,CACX,CAEA,SAAgBE,EAAUC,EAASC,EAAO,OAAQC,EAAW,KAAM,CAC/D,GAAI,CAACF,EAAS,OACd,IAAMG,EAAYL,EAAkB,EAC9BM,EAAQ,SAAS,cAAc,KAAK,EAC1CA,EAAM,UAAY,eAAeH,IACjCG,EAAM,MAAM,QAAU;;;;;;;;;;;;;4BAaEH,IAAS,UAAY,UAAYA,IAAS,QAAU,UAAY,UAAU;;;;MAMlG,IAAMI,EAAO,SAAS,cAAc,GAAG,EACvCA,EAAK,UAAYJ,IAAS,UAAY,qBAAuBA,IAAS,QAAU,2BAA6B,oBAC7GG,EAAM,YAAYC,CAAI,EAEtB,IAAMC,EAAO,SAAS,cAAc,MAAM,EAC1CA,EAAK,UAAYN,EACjBM,EAAK,MAAM,KAAO,IAClBF,EAAM,YAAYE,CAAI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qB,GAChDI,EAAeF,GAAgBvB,EACrCjB,EAAI,WAAW,YAAYiB,EAAK,GAAGwB,EAAW,GAAGC,EAAa,KAAK,CACvE,CAEA9Q,EAAO,MAAM,MAAM,CAhBnB,CAiBJ,CAAC,EACDgQ,EAAa,YAAYK,CAAQ,EAEjClR,EAAU,YAAY6Q,CAAY,EAElChQ,EAAO,MAAM,KAAK,CACd,MAAOuP,EAAaZ,MAAW,OAC/B,QAASxP,CACb,CAAC,CACL,CAEA,IAAI4R,EAAgB,GACpB,SAAgBC,EAAmBhR,EAAQ,CAClCA,GAAWA,EAAO,gBAAkB+Q,KACzCA,EAAgB,GAChB9C,GAAoBjO,CAAM,EAC1B0O,GAAuB1O,CAAM,EACjC,CAEI,OAAO,OAAW,MACd,OAAO,OACPgR,EAAmB,OAAO,MAAM,EAEhC,OAAO,iBAAiB,WAAc,CAC9B,OAAO,QAAQA,EAAmB,OAAO,MAAM,CACvD,CAAC,GCrUL,OAAO,WAAa,UAAW,CAC/B,IAAMnR,EAAQ,SAAS,eAAe,KAAK,EACvCA,GAAOA,EAAM,UAAU,IAAI,mBAAmB,CACtD,C"} \ No newline at end of file +{"version":3,"file":"PageBuilderBody.js","names":["generateId","counter","toastContainer","getToastContainer","showToast","message","type","duration","container","alert","icon","span","msg","editorEl","toggleSidebarBtn","sidebarHeader","sidebarBottomButtons","panelsEl","gjsEl","triggerEditorResize","autoCollapseSidebar","editor","traits","sectors","advancedProps","clmTags","block","toolbarPosition","toolbar","newTop","backspaceIsPressed","event","addBlockSearch","blocksCs","blockSearch","onMessage","loadingEl","input","term","category","atLeastOneMatch","label","labelEl","regEx","highlightedText","component","lastChild","blockId","\"id\"","rootComponent","insideEditablePartOfPage","originalCustomBuilderScripts","runComponentScript","child","styleIdentifier","tempDiv","parsedScript","wrapped","scriptTag","canvasDoc","afterGrapesJSLoaded","addThemeBlocks","fullScript","startFirstScript","languageCode","scriptTags","i","node","beforeEquals","scriptNumber","startScriptMethodName","blockSlug","cont","select","selectedLanguage","newLanguage","denyAccessToLayoutElements","index","replacePlaceholdersForRenderedBlocks","applyBlockAttributesToComponents","restrictEditAccess","id","\"html\"","replaced","comp","childComponent","disableAllEditFunctionality","componentHasBlockSettings","btn","componentHasBackground","pos","title","bg","trash","clone","arrows","labelTextParts","\"label\"","isCloningFromScript","originalComponent","addUniqueClass","hasBackground","componentElement","componentStyle","property","value","droppedComponent","draggedBlockId","generateId$1","parent","blockRootComponent","componentSibling","wrapperElement","\"wrapper\"","rep","componentChild","firstChild","copyAttributes","addSettingsToSidebar","getCurrentSettingValues","relativeIds","hasDynamicAncestor","rootId","settings","relativeId","settingsValues","settingValues","setting","trait","\"name\"","frame","frameDoc","frameEl","\"attributes\"","ancestorToUpdate","data","formData","response","blockHtml","parsedDiv","firstEl","replacedComponent","findChildViaBlockIdsPath","componentToSelect","blockIds","result","childResult","deepCopyAttributes","targetComponent","copyGrapesAttributes","copyHtmlElementAttributes","componentAttributes","attribute","directlyInsideDynamicBlock","allowEditableComponents","element","permissions","allowEditBasedOnComponentAttributes","newComponent","htmlTag","textEditableTags","otherEditableTags","componentIdentifier","componentClass","counter$1","waitForGrapesToLoad","confirmExit","savePageBtn","saveAllTranslationsToServer","callback","saveCurrentTranslationLocally","applyChangesFromCurrentLanguageToNewLanguage","errData","errorMessage","responseText","parsed","error","newLanguageBlocks","currentLanguageBlocks","updateNestedBlocks","currentBlockHtml","newBlockHtml","currDiv","newDiv","currContainers","newContainers","subBlockId","updatedSubBlock","oldSubBlock","updatedSubBlockMatches","oldSubBlockMatches","existingCss","\"css\"","getContainerContentInStorageFormat","mergeCss","\"style\"","\"components\"","newCss","pageBlocksString","matches","css","selector","pageBlocksStringSelector","removeOldStyleSelectors","styleComponents","updatedStyleComponents","styleComponent","toggleSaving","saveBtn","saveUrl","componentId","c","componentReferences","blocksData","replaceDynamicBlocksWithPlaceholders","html","getContainerHtml","style","components","div","el","slug","getComponentHtml","parentIsDynamic","parentIsHtmlInsideDynamic","newParentIsDynamic","newParentIsHtmlInsideDynamic","childData","key","\"blocks\"","\"settings\"","instanceId","generateId","attributes","currentBlockForParent","counter","wrapper","button","spinner","sanitizeHtml","match","tag","attrs","hrefMatch","targetMatch","styleMatch","setupPasteSanitizer","handlePaste","ev","rte","clipboardData","text","cleanHtml","escaped","rteConfig","registerToolbarActions","\"link\"","r","openLinkModal","sel","savedRange","currentAnchor","initialType","initialPageId","initialUrl","initialTargetBlank","href","pages","translations","typeGroup","\"page\"","pageGroup","pageOptionsHtml","item","urlGroup","radio","targetGroup","buttonsGroup","cancelBtn","\"cancel\"","unlinkBtn","\"unlink\"","applyBtn","\"apply\"","selectedType","pageSelect","urlInput","targetBlank","currentSel","selectedText","targetAttr","textToInsert","isInitialized","initRteLinkManager"],"sources":["../src/Modules/GrapesJS/resources/assets/js/toast.js","../src/Modules/GrapesJS/resources/assets/js/pagebuilder.js","../src/Modules/GrapesJS/resources/assets/js/block-search.js","../src/Modules/GrapesJS/resources/assets/js/run-builder-scripts.js","../src/Modules/GrapesJS/resources/assets/js/manage-editable-components.js","../src/Modules/GrapesJS/resources/assets/js/save-page.js","../src/Modules/GrapesJS/resources/assets/js/rte-link-manager.js","../src/Modules/GrapesJS/resources/assets/js/responsive.js"],"sourcesContent":["let toastContainer = null;\n\nfunction getToastContainer() {\n if (!toastContainer || !document.body.contains(toastContainer)) {\n toastContainer = document.createElement('div');\n toastContainer.className = 'toast toast-top toast-end';\n toastContainer.style.cssText = 'position:fixed; top:20px; right:20px; z-index:999999; display:flex; flex-direction:column; gap:10px; pointer-events:none;';\n document.body.appendChild(toastContainer);\n }\n return toastContainer;\n}\n\nexport function showToast(message, type = 'info', duration = 3500) {\n if (!message) return;\n const container = getToastContainer();\n const alert = document.createElement('div');\n alert.className = `alert alert-${type}`;\n alert.style.cssText = `\n pointer-events: auto;\n min-width: 250px;\n max-width: 400px;\n padding: 12px 16px;\n border-radius: 6px;\n box-shadow: 0 4px 12px rgba(0,0,0,0.25);\n color: #fff;\n font-size: 14px;\n font-family: inherit;\n display: flex;\n align-items: center;\n gap: 8px;\n background-color: ${type === 'success' ? '#10b981' : type === 'error' ? '#ef4444' : '#3b82f6'};\n transition: opacity 0.3s ease, transform 0.3s ease;\n opacity: 0;\n transform: translateY(-10px);\n `;\n\n const icon = document.createElement('i');\n icon.className = type === 'success' ? 'fa fa-check-circle' : type === 'error' ? 'fa fa-exclamation-circle' : 'fa fa-info-circle';\n alert.appendChild(icon);\n\n const span = document.createElement('span');\n span.innerText = message;\n span.style.flex = '1';\n alert.appendChild(span);\n\n container.appendChild(alert);\n\n // animate in\n requestAnimationFrame(() => {\n alert.style.opacity = '1';\n alert.style.transform = 'translateY(0)';\n });\n\n setTimeout(() => {\n alert.style.opacity = '0';\n alert.style.transform = 'translateY(-10px)';\n setTimeout(() => {\n if (alert.parentNode) {\n alert.parentNode.removeChild(alert);\n }\n }, 300);\n }, duration);\n}\n\nwindow.toastr = {\n success(msg, duration = 3000) {\n showToast(msg, 'success', duration);\n },\n error(msg, duration = 4000) {\n showToast(msg, 'error', duration);\n },\n info(msg, duration = 3000) {\n showToast(msg, 'info', duration);\n }\n};\n","\n\n const editorEl = document.querySelector('.gjs-editor');\nconst toggleSidebarBtn = document.getElementById('toggle-sidebar');\nconst sidebarHeader = document.getElementById('sidebar-header');\nconst sidebarBottomButtons = document.getElementById('sidebar-bottom-buttons');\nconst panelsEl = document.querySelector('.gjs-pn-panels');\nconst gjsEl = document.getElementById('gjs');\n\nif (editorEl && toggleSidebarBtn) {\n editorEl.appendChild(toggleSidebarBtn);\n}\nif (panelsEl) {\n if (sidebarHeader) panelsEl.prepend(sidebarHeader);\n if (sidebarBottomButtons) panelsEl.appendChild(sidebarBottomButtons);\n}\n\nif (toggleSidebarBtn) {\n toggleSidebarBtn.addEventListener('click', function() {\n if (gjsEl) gjsEl.classList.toggle('sidebar-collapsed');\n triggerEditorResize();\n });\n}\nautoCollapseSidebar();\n\nif (window.editor) {\n window.editor.on('run:open-sm', function(editor) {\n const traits = document.querySelector('.gjs-trt-traits');\n if (traits && traits.parentElement && traits.parentElement.parentElement) {\n traits.parentElement.parentElement.style.display = 'none';\n }\n const sectors = document.querySelector('.gjs-sm-sectors');\n if (sectors && sectors.parentElement && sectors.parentElement.parentElement) {\n sectors.parentElement.parentElement.style.display = 'block';\n }\n // move element classes editor to advanced section\n const advancedProps = document.querySelector('#gjs-sm-advanced .gjs-sm-properties');\n const clmTags = document.querySelector('.gjs-clm-tags');\n if (advancedProps && clmTags) {\n advancedProps.appendChild(clmTags);\n }\n });\n\n window.editor.on('run:open-tm', function(editor) {\n const sectors = document.querySelector('.gjs-sm-sectors');\n if (sectors && sectors.parentElement && sectors.parentElement.parentElement) {\n sectors.parentElement.parentElement.style.display = 'none';\n }\n const traits = document.querySelector('.gjs-trt-traits');\n if (traits && traits.parentElement && traits.parentElement.parentElement) {\n traits.parentElement.parentElement.style.display = 'block';\n }\n });\n\n window.editor.on('block:drag:start', function(block) {\n autoCollapseSidebar();\n });\n\n window.editor.on('rteToolbarPosUpdate', function(toolbarPosition) {\n if (! window.editor || ! window.editor.getSelected()) return;\n let selectedDomComponent = window.editor.getSelected().getEl();\n if (! selectedDomComponent) return;\n\n setTimeout(function() {\n let toolbar = document.querySelector('.gjs-rte-toolbar');\n if (!toolbar) return;\n const rect = toolbar.getBoundingClientRect();\n let toolbarInUpperHalf = (rect.top + window.scrollY) < (toolbarPosition.elementTop + (0.5 * toolbarPosition.elementHeight));\n if (toolbarInUpperHalf) {\n let newTop = toolbarPosition.elementTop - toolbar.offsetHeight;\n if (newTop > 0) {\n toolbar.style.top = newTop + 'px';\n }\n }\n }, 0);\n });\n}\n\nfunction autoCollapseSidebar() {\n if (window.innerWidth < 1000) {\n if (gjsEl) gjsEl.classList.add('sidebar-collapsed');\n triggerEditorResize();\n }\n}\n\nfunction triggerEditorResize() {\n if (window.editor && window.editor.trigger) {\n window.editor.trigger('change:canvasOffset canvasScroll');\n }\n}\n\n// prevent exiting page builder with backspace button\nlet backspaceIsPressed = false;\ndocument.addEventListener('keydown', function(event) {\n if (event.key === 'Backspace' || event.which === 8) backspaceIsPressed = true;\n});\ndocument.addEventListener('keyup', function(event) {\n if (event.key === 'Backspace' || event.which === 8) backspaceIsPressed = false;\n});\nwindow.addEventListener('beforeunload', function(event) {\n if (backspaceIsPressed) event.preventDefault();\n});\n\nfunction addBlockSearch() {\n const blocksCs = document.querySelector('.gjs-blocks-cs');\n const blockSearch = document.getElementById('block-search');\n if (blocksCs && blockSearch) {\n blocksCs.prepend(blockSearch);\n }\n}\n\n// listen to messages from iframe\nwindow.addEventListener(\"message\", onMessage, false);\n\nfunction onMessage(event) {\n // if the page is loaded, remove loading element\n if (event.data === 'page-loaded') {\n const loadingEl = document.getElementById('phpb-loading');\n if (loadingEl) loadingEl.classList.add('loaded');\n addBlockSearch();\n window.isLoaded = true;\n window.dispatchEvent(new CustomEvent('pagebuilder-page-loaded'));\n } else if (event.data === 'touch-start') {\n if (window.touchStart) window.touchStart();\n }\n}\n","\ndocument.addEventListener(\"input\", function(e) {\n const input = e.target.closest(\"#block-search input\");\n if (!input) return;\n\n let term = input.value.toLowerCase().trim();\n\n document.querySelectorAll(\".gjs-block-category\").forEach(category => {\n let atLeastOneMatch = false;\n\n category.querySelectorAll(\".gjs-block\").forEach(block => {\n if (!block.dataset.originalHtml) {\n block.dataset.originalHtml = block.innerHTML;\n }\n\n let label = block.textContent || \"\";\n if (!term || label.toLowerCase().includes(term)) {\n block.classList.remove(\"d-none\");\n atLeastOneMatch = true;\n\n const labelEl = block.querySelector(\".gjs-block-label\");\n if (labelEl) {\n if (term) {\n let regEx = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&') + ')', \"gi\");\n let highlightedText = label.replace(regEx, '$1');\n labelEl.innerHTML = block.dataset.originalHtml.replace(label.trim(), highlightedText);\n } else {\n block.innerHTML = block.dataset.originalHtml;\n }\n }\n } else {\n block.classList.add(\"d-none\");\n }\n });\n\n if (atLeastOneMatch) {\n category.classList.remove(\"d-none\");\n } else {\n category.classList.add(\"d-none\");\n }\n });\n});\n","\n\n window.customBuilderScripts = {};\n\n /**\n * On instantiating the component model, before it is mounted in the canvas.\n */\n window.editor.on('component:create', component => {\n // extract the script tag of the given component (if it has one)\n if (component.components().length) {\n let lastChild = component.components().models[component.components().length - 1];\n if (lastChild.attributes.type === 'script') {\n let blockId = component.attributes.attributes['block-id'];\n if (blockId === undefined) {\n blockId = component.attributes.attributes['id'];\n }\n\n let rootComponent = lastChild;\n let insideEditablePartOfPage = false;\n while (rootComponent.parent()) {\n rootComponent = rootComponent.parent();\n if (rootComponent.attributes.attributes['phpb-content-container']) {\n insideEditablePartOfPage = true;\n break;\n }\n }\n\n if (insideEditablePartOfPage) {\n window.customBuilderScripts[blockId] = lastChild.toHTML();\n lastChild.remove();\n }\n }\n }\n });\n\n /**\n * After mounting the component in the canvas.\n */\n window.editor.on('component:add', function (component) {\n // run the script that was set when creating this component\n if (component.attributes['run-builder-script'] !== undefined) {\n let originalCustomBuilderScripts = customBuilderScripts;\n\n window.customBuilderScripts[component.attributes['block-id']] = customBuilderScripts[component.attributes['run-builder-script']];\n runScriptsOfComponentAndChildren(component);\n\n window.customBuilderScripts = originalCustomBuilderScripts;\n delete component.attributes['run-builder-script'];\n }\n });\n\n /**\n * On ending a component order drag, re-run builder scripts on newly added HTMl.\n */\n window.editor.on('sorter:drag:end', function(event) {\n let component = event.modelToDrop;\n if (component && component.attributes && (component.attributes['block-id'] || component.attributes['id'])) {\n window.runScriptsOfComponentAndChildren(component);\n }\n });\n\n /**\n * Run the custom builder scripts of the given component and of all child components.\n *\n * @param component\n */\n window.runScriptsOfComponentAndChildren = function(component) {\n runComponentScript(component);\n component.components().each(function(child) {\n runScriptsOfComponentAndChildren(child);\n });\n }\n\n /**\n * Run the custom builder scripts of the given component.\n *\n * @param component\n */\n function runComponentScript(component) {\n let blockId = component.attributes['block-id'];\n if (blockId === undefined) {\n blockId = component.attributes.attributes['id'];\n }\n if (blockId && window.customBuilderScripts[blockId] !== undefined) {\n let styleIdentifier = component.attributes[\"style-identifier\"];\n let tempDiv = document.createElement(\"div\");\n tempDiv.innerHTML = window.customBuilderScripts[blockId];\n let parsedScript = tempDiv.querySelector('script');\n if (parsedScript) {\n let scriptContent = parsedScript.innerHTML;\n let wrapped = `(function(){\\nlet block = document.getElementsByClassName(\"${styleIdentifier}\")[0];\\nlet blockSelector = \".${styleIdentifier}\";\\nlet inPageBuilder = true;\\n${scriptContent}\\n})();`;\n let scriptTag = document.createElement(\"script\");\n scriptTag.type = \"text/javascript\";\n scriptTag.textContent = wrapped;\n let canvasDoc = window.editor.Canvas.getDocument();\n if (canvasDoc && canvasDoc.body) {\n canvasDoc.body.appendChild(scriptTag);\n }\n }\n }\n }\n\n\n","\n\n /**\n * After loading GrapesJS, add all theme blocks and activate the editable blocks in the main language.\n */\n function afterGrapesJSLoaded() {\n addThemeBlocks();\n\n // add page injection script with page-loaded event to the end of the body tag of initialComponents,\n // which contains the html structure of the used layout file. And add script that starts all external scripts\n let scriptTag = document.createElement(\"script\");\n scriptTag.type = \"text/javascript\";\n scriptTag.src = window.injectionScriptUrl;\n let fullScript = scriptTag.outerHTML + '';\n window.initialComponents = window.initialComponents.replace('', fullScript + '');\n\n Object.keys(window.languages || {}).forEach(languageCode => {\n if (window.pageBlocks[languageCode] === null) {\n window.pageBlocks[languageCode] = {};\n }\n });\n\n activateLanguage(window.currentLanguage);\n }\n\n /**\n * GrapesJS wraps each external script with a start[number]Start() method,\n * which needs to be called on switching language.\n */\n function startFirstScript() {\n let scriptTags = document.querySelectorAll(\"script\");\n for (let i = 0; i < scriptTags.length; i++) {\n let node = scriptTags[i];\n if (node.innerHTML.startsWith('var script')) {\n let beforeEquals = node.innerHTML.split('=')[0];\n let scriptNumber = parseInt(beforeEquals.replace('var script', ''));\n if (Number.isInteger(scriptNumber)) {\n let startScriptMethodName = 'script' + scriptNumber + 'Start';\n if (typeof window[startScriptMethodName] === 'function') {\n if (scriptNumber !== 0) {\n window[startScriptMethodName]();\n }\n return false;\n }\n }\n }\n }\n }\n\n /**\n * Add all theme blocks to GrapesJS blocks manager.\n */\n function addThemeBlocks() {\n for (let blockSlug in window.themeBlocks) {\n let block = window.themeBlocks[blockSlug];\n\n // remove whitespace from phpb-block-container elements, otherwise these components will become type=text,\n // resulting in components dropped inside the container jumping to the dropped position - 1\n let tempDiv = document.createElement(\"div\");\n tempDiv.innerHTML = block.content;\n tempDiv.querySelectorAll(\"[phpb-blocks-container]\").forEach(cont => {\n if (cont.innerHTML !== '' && cont.innerHTML.trim() === '') {\n cont.innerHTML = '';\n }\n });\n window.themeBlocks[blockSlug].content = tempDiv.innerHTML;\n block.content = tempDiv.innerHTML;\n\n editor.BlockManager.add(blockSlug, block);\n }\n }\n\n /**\n * Switch pagebuilder to another language variant on changing the language selector.\n */\n document.addEventListener(\"change\", function(e) {\n const select = e.target.closest(\"#language-selector select\");\n if (!select) return;\n let selectedLanguage = select.value;\n\n window.switchLanguage(selectedLanguage, function() {\n activateLanguage(selectedLanguage);\n });\n });\n\n /**\n * Activate the given language variant in the pagebuilder.\n *\n * @param newLanguage\n */\n window.activateLanguage = function(newLanguage) {\n window.currentLanguage = newLanguage;\n\n // reset GrapesJS editor before loading the new language variant\n window.editor.select();\n window.editor.DomComponents.clear();\n window.editor.DomComponents.componentsById = [];\n window.editor.UndoManager.clear();\n\n // remove any script tags from previous languages\n window.editor.Canvas.getDocument().querySelectorAll(\"script\").forEach(function(node) {\n node.remove();\n });\n\n // load initial non-editable layout components\n window.editor.setComponents(window.initialComponents);\n denyAccessToLayoutElements(editor.getWrapper());\n window.editor.getWrapper().find(\"[phpb-content-container]\").forEach((container, index) => {\n container.set('custom-name', window.translations['page-content']);\n\n // reload components of this content container (adding all root phpb-block elements)\n container.components(window.contentContainerComponents[index]);\n\n // replace phpb-block elements with the server-side rendered version of each block\n replacePlaceholdersForRenderedBlocks(container);\n\n // apply the stored block settings to the server-side rendered html\n applyBlockAttributesToComponents(container);\n });\n };\n\n window.addEventListener('pagebuilder-page-loaded', function(event) {\n window.editor.getWrapper().find(\"[phpb-content-container]\").forEach(container => {\n restrictEditAccess(container);\n window.runScriptsOfComponentAndChildren(container);\n });\n window.setWaiting(false);\n\n setTimeout(function() {\n window.changesOffset = window.editor.getModel().get('changesCount');\n window.afterInitialRendering = true;\n }, 250);\n });\n\n /**\n * Replace phpb-block elements with the server-side rendered version of each block.\n *\n * @param component\n */\n function replacePlaceholdersForRenderedBlocks(component) {\n if (!component) return;\n\n // if we encounter a pagebuilder block, replace it with the server-side rendered html\n if (component.get && component.get('tagName') === 'phpb-block') {\n let id = component.attributes && component.attributes.attributes ? component.attributes.attributes.id : null;\n if (id && window.pageBlocks[window.currentLanguage] && window.pageBlocks[window.currentLanguage][id] !== undefined && window.pageBlocks[window.currentLanguage][id]['html'] !== undefined) {\n let replaced = component.replaceWith(window.pageBlocks[window.currentLanguage][id]['html']);\n window.pageBlocks[window.currentLanguage][id]['html'] = '';\n let replacedComponents = Array.isArray(replaced) ? replaced : [replaced];\n replacedComponents.forEach(comp => {\n if (comp && comp.get && comp.get('components')) {\n comp.get('components').each(childComponent => replacePlaceholdersForRenderedBlocks(childComponent));\n }\n });\n return;\n }\n }\n\n // replace placeholders inside child components\n if (component.get && component.get('components')) {\n component.get('components').each(childComponent => replacePlaceholdersForRenderedBlocks(childComponent));\n }\n }\n\n /**\n * Function for denying edit access to this component and all children that belong to the layout.\n *\n * @param component\n */\n function denyAccessToLayoutElements(component) {\n if ('phpb-content-container' in component.attributes.attributes) return;\n\n disableAllEditFunctionality(component);\n\n // apply restrictions to child components\n component.get('components').each(component => denyAccessToLayoutElements(component));\n }\n\n\n /**\n * Component select handler.\n */\n window.editor.on('component:selected', function(component) {\n // if the component has settings, activate settings panel in pagebuilder sidebar\n if (componentHasBlockSettings(component)) {\n const btn = document.querySelector(\".gjs-pn-buttons .gjs-pn-btn:nth-of-type(2)\");\n if (btn) btn.click();\n }\n else if (component.get('type') === '' && componentHasBackground(component)) {\n // on selecting a default component without settings, with editable background, show background styling\n const btn = document.querySelector(\".gjs-pn-buttons .gjs-pn-btn:nth-of-type(3)\");\n if (btn) btn.click();\n const pos = document.getElementById(\"gjs-sm-position\");\n if (pos && pos.classList.contains(\"gjs-sm-open\")) {\n const title = pos.querySelector(\".gjs-sm-title\");\n if (title) title.click();\n }\n const bg = document.getElementById(\"gjs-sm-background\");\n if (bg && !bg.classList.contains(\"gjs-sm-open\")) {\n const title = bg.querySelector(\".gjs-sm-title\");\n if (title) title.click();\n }\n }\n\n // if component has no settings, add no settings text to settings panel in sidebar\n if (! componentHasBlockSettings(component)) {\n setTimeout(function() {\n const traits = document.querySelector(\".gjs-trt-traits\");\n if (traits) {\n traits.innerHTML = '

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

';\n }\n }, 0);\n }\n\n // only show the toolbar buttons that are applicable\n setTimeout(function() {\n const trash = document.querySelector(\".gjs-toolbar .fa-trash-o.gjs-toolbar-item\");\n if (trash && !component.attributes.removable) trash.style.display = 'none';\n\n const clone = document.querySelector(\".gjs-toolbar .fa-clone.gjs-toolbar-item\");\n if (clone && !component.attributes.copyable) clone.style.display = 'none';\n\n const arrows = document.querySelector(\".gjs-toolbar .fa-arrows.gjs-toolbar-item\");\n if (arrows && !component.attributes.draggable) arrows.style.display = 'none';\n\n if (! component.attributes.removable && ! component.attributes.copyable && ! component.attributes.draggable) {\n window.editor.select(component.parent());\n }\n\n let blockSlug = component.attributes['block-slug'];\n if (blockSlug && window.themeBlocks && window.themeBlocks[blockSlug]) {\n let labelHtml = window.themeBlocks[blockSlug]['label'];\n let labelTextParts = labelHtml.split(\"\");\n if (labelTextParts.length > 1) {\n const toolbar = document.querySelector(\".gjs-toolbar\");\n if (toolbar) toolbar.setAttribute('title', \"Bloknaam: \" + labelTextParts[1]);\n }\n }\n }, 0);\n });\n\n\n /**\n * Component clone handler.\n */\n window.editor.on('component:clone', function(component) {\n // if the clone is performed by the user, do not copy the block id and style identifier\n if (! isCloningFromScript) {\n let originalComponent = window.editor.getWrapper().find('.' + component.attributes['style-identifier'])[0];\n\n if (component.attributes['style-identifier'] !== undefined && component.attributes['style-identifier'] !== '') {\n component.removeClass(component.attributes['style-identifier']);\n delete component.attributes['style-identifier'];\n addUniqueClass(component);\n }\n component.attributes['block-id'] = component.attributes['block-slug'];\n\n // pass a reference of the scripts of the original component to run on the cloned component\n if (originalComponent && window.customBuilderScripts[originalComponent.attributes['block-id']] !== undefined) {\n component.attributes['run-builder-script'] = originalComponent.attributes['block-id'];\n }\n }\n });\n\n\n /**\n * Return whether the given component contains a CSS background, that should be editable.\n *\n * @param component\n * @returns {boolean}\n */\n function componentHasBackground(component) {\n let hasBackground = false;\n\n let componentElement = component.getEl();\n if (componentElement && componentElement.style) {\n let componentStyle = window.getComputedStyle(componentElement);\n\n ['background', 'background-image', 'background-color'].forEach(property => {\n let value = componentStyle.getPropertyValue(property);\n if (value !== undefined && value !== '' && ! value.includes('none') && ! value.includes('rgba(0, 0, 0, 0)')) {\n hasBackground = true;\n }\n });\n }\n\n return hasBackground;\n }\n\n /**\n * Return whether the given component has settings defined in its block config file.\n *\n * @param component\n * @returns {boolean}\n */\n function componentHasBlockSettings(component) {\n return component.attributes.traits.length > 0;\n }\n\n /**\n * On dropping a component on the canvas, apply attributes of the container phpb-block element with configuration passed\n * from the server and restrict edit access to editable components.\n */\n window.editor.on('block:drag:stop', function(droppedComponent) {\n // ensure component drop was successful\n if (! droppedComponent || ! droppedComponent.attributes || ! droppedComponent.attributes.attributes) return;\n\n let draggedBlockId = generateId();\n droppedComponent.attributes.attributes['dropped-component-id'] = draggedBlockId;\n\n let parent = droppedComponent.parent();\n applyBlockAttributesToComponents(droppedComponent);\n\n // at this point droppedComponent is replaced in the DOM by the actual component (without the phpb-block element),\n // so we need to find the dropped component again in the context of its parent\n parent.components().each(function(child) {\n if (child.attributes['dropped-component-id'] === draggedBlockId) {\n delete child.attributes['dropped-component-id'];\n droppedComponent = child;\n }\n });\n restrictEditAccess(droppedComponent);\n\n window.runScriptsOfComponentAndChildren(droppedComponent);\n });\n\n /**\n * Apply the block attributes which are stored in elements to the top-level html element inside the block.\n * If the block starts with multiple top-level html elements, add a div element wrapping the block's top-level elements.\n *\n * @param component\n */\n function applyBlockAttributesToComponents(component) {\n if (component.attributes.tagName === 'phpb-block') {\n let container = component.parent();\n let clone = cloneComponent(component);\n\n // since component is a that should be removed and replaced by its children,\n // the component's parent's child that has the id of the component needs to be replaced\n let blockRootComponent;\n if (component.attributes.attributes['is-html'] === 'false') {\n container.components().each(function(componentSibling) {\n if (componentSibling.cid === component.cid) {\n // replace the by the actual component\n // the component is wrapped with a wrapper element to allow block styling (via a unique .style-identifier selector)\n let wrapperElement = ('wrapper' in component.attributes.attributes) ? component.attributes.attributes['wrapper'] : 'div';\n let rep = component.replaceWith({tagName: wrapperElement});\n blockRootComponent = Array.isArray(rep) ? rep[0] : rep;\n blockRootComponent.attributes['is-style-wrapper'] = true;\n clone.components().each(function(componentChild) {\n blockRootComponent.append(cloneComponent(componentChild));\n });\n }\n });\n } else {\n container.components().each(function(componentSibling) {\n if (componentSibling.cid === component.cid) {\n // if the has one direct child, replace it by its only child\n // else, replace it by a wrapper div to allow block styling (via a unique .style-identifier selector)\n if (clone.components().length === 1) {\n let firstChild = cloneComponent(clone.components().models[0]);\n let rep = component.replaceWith(firstChild);\n blockRootComponent = Array.isArray(rep) ? rep[0] : rep;\n } else {\n let rep = component.replaceWith({tagName: 'div'});\n blockRootComponent = Array.isArray(rep) ? rep[0] : rep;\n blockRootComponent.attributes['is-style-wrapper'] = true;\n clone.components().each(function(componentChild) {\n blockRootComponent.append(cloneComponent(componentChild));\n });\n }\n }\n });\n }\n component.remove();\n\n copyAttributes(clone, blockRootComponent, true, false);\n // add all settings of this component to the settings panel in the sidebar\n addSettingsToSidebar(blockRootComponent);\n // recursive call to find and replace elements of nested blocks (loaded via shortcodes)\n applyBlockAttributesToComponents(blockRootComponent);\n } else {\n component.components().each(function(childComponent) {\n // recursive call to find and replace elements of nested blocks (loaded via shortcodes)\n applyBlockAttributesToComponents(childComponent);\n });\n }\n }\n\n /**\n * Get the current setting values for the given component.\n *\n * @param component\n */\n function getCurrentSettingValues(component) {\n // Block settings are stored in window.pageBlocks in a structure starting with each root block (the first ancestor that does not have a dynamic parent itself).\n // So, we need to find the root of the given component and store all block ids along the way, in order to traverse the pageBlocks structure to the settings of the given component.\n // These block ids are only unique in the context of their parent (we can have multiple instances of the same nested block structure), so we call them relative IDs.\n let relativeIds = [];\n\n // get the root component of the given component (its first ancestor that does not have a dynamic parent itself or the block that is inside a blocks container)\n let rootComponent = component;\n let hasDynamicAncestor = false;\n while (rootComponent.parent() &&\n rootComponent.parent().attributes.attributes['phpb-blocks-container'] === undefined &&\n rootComponent.parent().attributes['is-html'] !== 'true' &&\n rootComponent.parent().attributes.attributes['phpb-content-container'] === undefined\n ) {\n if (rootComponent.parent().attributes['is-html'] === 'false') {\n hasDynamicAncestor = true;\n }\n if (rootComponent.attributes['block-id'] !== undefined) {\n relativeIds.push(rootComponent.attributes['block-id']);\n }\n rootComponent = rootComponent.parent();\n }\n\n let rootId = component.attributes['block-id'];\n if (hasDynamicAncestor) {\n rootId = rootComponent.attributes['block-id'];\n } else {\n relativeIds = [];\n }\n\n // get the component settings by traversing the pageBlocks structure\n let settings = window.pageBlocks[window.currentLanguage][rootId];\n relativeIds.reverse().forEach(function(relativeId) {\n if (settings === undefined || settings.blocks === undefined || settings.blocks[relativeId] === undefined) {\n settings = {};\n } else {\n settings = settings.blocks[relativeId];\n }\n });\n\n // return the values stored in the current component's settings structure\n let settingsValues = {};\n if (settings !== undefined && settings.settings !== undefined && settings.settings.attributes !== undefined) {\n settingsValues = settings.settings.attributes;\n }\n return settingsValues;\n }\n\n /**\n * Add all settings from the block's config file to the given component,\n * to allow them to be changed in the settings side panel.\n *\n * @param component\n */\n function addSettingsToSidebar(component) {\n if (window.blockSettings[component.attributes['block-slug']] === undefined) {\n return;\n }\n component.attributes.settings = {};\n\n let settingValues = getCurrentSettingValues(component);\n\n // set style identifier class to the block wrapper, if an identifier has been stored during earlier getDataInStorageFormat calls\n if (settingValues['style-identifier'] !== undefined) {\n component.addClass(settingValues['style-identifier']);\n }\n\n // for each setting add a trait to the settings sidebar panel with the earlier stored or default value\n component.attributes['is-updating'] = true;\n let settings = window.blockSettings[component.attributes['block-slug']];\n settings.forEach(function(setting) {\n let trait = component.addTrait(setting);\n if (settingValues[setting['name']] !== undefined) {\n trait[0].setTargetValue(settingValues[setting['name']]);\n } else if (setting['default-value'] !== undefined) {\n trait[0].setTargetValue(setting['default-value']);\n }\n });\n component.attributes['is-updating'] = false;\n }\n\n /**\n * On updating an attribute (block setting from the settings side panel), refresh dynamic block via Ajax.\n */\n window.editor.on('component:update', async function(component) {\n const frame = document.querySelector(\".gjs-frame\");\n const frameDoc = frame && (frame.contentDocument || (frame.contentWindow && frame.contentWindow.document));\n const frameEl = frameDoc ? frameDoc.getElementById(component.ccid) : null;\n\n if (window.isLoaded !== true ||\n component.attributes['block-slug'] === undefined ||\n component.attributes['is-updating'] ||\n component.changed['attributes'] === undefined ||\n !frameEl\n ) {\n return;\n }\n // dynamic pagebuilder blocks can depend on data passed by dynamic parent blocks,\n // so we need to update the closest parent which does not have a dynamic parent itself or the block that is inside a blocks container.\n // also keep track of all intermediate block ids, for re-selecting the currently selected component.\n let relativeIds = [];\n let ancestorToUpdate = component;\n let hasDynamicAncestor = false;\n while (ancestorToUpdate.parent() &&\n ancestorToUpdate.parent().attributes.attributes['phpb-blocks-container'] === undefined &&\n ancestorToUpdate.parent().attributes['is-html'] !== 'true' &&\n ancestorToUpdate.parent().attributes.attributes['phpb-content-container'] === undefined\n ) {\n if (ancestorToUpdate.parent().attributes['is-html'] === 'false') {\n hasDynamicAncestor = true;\n }\n if (ancestorToUpdate.attributes['block-id'] !== undefined) {\n relativeIds.push(ancestorToUpdate.attributes['block-id']);\n }\n ancestorToUpdate = ancestorToUpdate.parent();\n }\n\n if (hasDynamicAncestor) {\n component = ancestorToUpdate;\n } else {\n relativeIds = [];\n }\n\n component.attributes['is-updating'] = true;\n if (frameEl) frameEl.classList.add('gjs-freezed');\n\n let container = window.editor.getWrapper().find(\"#\" + component.ccid)[0].parent();\n let data = window.getComponentDataInStorageFormat(component);\n\n // refresh component contents with updated version requested via fetch call\n try {\n const formData = new URLSearchParams();\n formData.append('data', JSON.stringify(data));\n formData.append('language', window.currentLanguage);\n\n const response = await fetch(window.renderBlockUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'X-Requested-With': 'XMLHttpRequest'\n },\n body: formData\n });\n\n if (!response.ok) {\n if (frameEl) frameEl.classList.remove('gjs-freezed');\n component.attributes['is-updating'] = false;\n window.toastr.error(window.translations['toastr-component-update-failed']);\n return;\n }\n\n const blockHtml = await response.text();\n let parsedDiv = document.createElement('div');\n parsedDiv.innerHTML = blockHtml;\n let firstEl = parsedDiv.firstElementChild;\n let blockId = firstEl ? firstEl.getAttribute('block-id') : null;\n\n // set the block settings for the updated component to the new values\n window.pageBlocks[window.currentLanguage][blockId] = (data.blocks[blockId] === undefined) ? {} : data.blocks[blockId];\n\n // replace old component for the rendered html returned by the server\n component.replaceWith(blockHtml);\n replacePlaceholdersForRenderedBlocks(container);\n applyBlockAttributesToComponents(container);\n restrictEditAccess(container, false, false);\n\n // run builder scripts of the replaced component and all its children\n let replacedComponent = findChildViaBlockIdsPath(container, [blockId]);\n runScriptsOfComponentAndChildren(replacedComponent);\n\n // select the component that was selected before the ajax call\n relativeIds.push(blockId);\n let componentToSelect = findChildViaBlockIdsPath(container, relativeIds.reverse());\n window.editor.select(componentToSelect);\n } catch (error) {\n if (frameEl) frameEl.classList.remove('gjs-freezed');\n component.attributes['is-updating'] = false;\n window.toastr.error(window.translations['toastr-component-update-failed']);\n }\n });\n\n /**\n * Traverse the children of the given component via the given path of block IDs\n * and return the component with the last ID from the list.\n *\n * @param component\n * @param blockIds\n * @returns {null|*}\n */\n function findChildViaBlockIdsPath(component, blockIds) {\n // foobar\n if (blockIds.length === 0) {\n return component;\n }\n\n let result = null;\n\n component.forEachChild(function(child) {\n if (child.attributes['block-id'] === blockIds[0]) {\n result = findChildViaBlockIdsPath(child, blockIds.slice(1));\n return false;\n }\n });\n\n component.forEachChild(function(child) {\n let childResult = findChildViaBlockIdsPath(child, blockIds);\n if (childResult !== null) {\n result = childResult;\n return false;\n }\n });\n\n return result;\n }\n\n /**\n * Clone the given component (while preserving all attributes, like IDs).\n *\n * @param component\n */\n let isCloningFromScript = false;\n window.cloneComponent = function(component) {\n isCloningFromScript = true;\n\n let clone = component.clone();\n deepCopyAttributes(component, clone);\n\n isCloningFromScript = false;\n return clone;\n };\n\n /**\n * Apply the attributes of the given component and its children to each corresponding component of the given clone.\n *\n * @param component\n * @param clone\n */\n function deepCopyAttributes(component, clone) {\n // apply all attributes from component to clone\n copyAttributes(component, clone, false, true);\n // apply attributes from component's children to clone's children\n for (let index = 0; index < component.components().length; index++) {\n let componentChild = component.components().models[index];\n let cloneChild = clone.components().models[index];\n deepCopyAttributes(componentChild, cloneChild);\n }\n }\n\n /**\n * Apply the attributes of the given component to the given target component.\n *\n * @param component\n * @param targetComponent\n * @param copyGrapesAttributes whether all GrapesJS component attributes (like permissions) should be copied\n * @param copyHtmlElementAttributes whether the html element attributes should be copied\n */\n function copyAttributes(component, targetComponent, copyGrapesAttributes, copyHtmlElementAttributes) {\n let componentAttributes = component.attributes.attributes;\n for (let attribute in componentAttributes) {\n if (copyHtmlElementAttributes) {\n targetComponent.attributes.attributes[attribute] = componentAttributes[attribute];\n }\n if (copyGrapesAttributes) {\n targetComponent.attributes[attribute] = componentAttributes[attribute];\n }\n }\n }\n\n /**\n * Function for only allowing edit access on whitelisted components.\n *\n * @param component\n * @param directlyInsideDynamicBlock\n * @param allowEditableComponents\n */\n function restrictEditAccess(component, directlyInsideDynamicBlock = false, allowEditableComponents = true) {\n disableAllEditFunctionality(component);\n\n if (component.attributes.attributes['phpb-content-container'] !== undefined) {\n // the content container of the current page can receive other components\n component.set({\n droppable: true,\n hoverable: true,\n });\n } else if (component.attributes['block-slug'] !== undefined) {\n // change visibility of child elements that depend on whether this block is editable\n component.find('[phpb-hide-if-not-editable]').forEach((element) => {\n if (allowEditableComponents || window.afterInitialRendering) {\n element.addClass('editable');\n } else {\n element.removeClass('editable');\n }\n });\n\n // we just entered a new block, set default permissions\n let permissions = {\n selectable: true,\n hoverable: true,\n };\n if (! directlyInsideDynamicBlock) {\n // the block we entered is not located directly inside a dynamic block, hence this block can be removed, dragged, configured and styled\n permissions = {\n removable: true,\n draggable: true,\n copyable: true,\n selectable: true,\n hoverable: true,\n stylable: true,\n };\n // for styling this particular block, the block needs to have a unique class\n addUniqueClass(component);\n }\n if (component.attributes['is-html'] === 'true') {\n // the block we just entered is an html block,\n // the next layer of child blocks are not directly inside a dynamic block\n directlyInsideDynamicBlock = false;\n // in an html block, editing elements (based on their html tag) is allowed\n allowEditableComponents = true;\n } else {\n // the block we just entered is dynamic,\n // the next layer of child blocks are directly inside a dynamic block\n directlyInsideDynamicBlock = true;\n // in a dynamic block, editing elements (based on their html tag) is not allowed\n allowEditableComponents = false;\n // dynamic blocks do not have text-editable components, so remove text cursors\n component.getEl().setAttribute('data-cursor', 'default');\n }\n component.set(permissions);\n }\n\n // for raw content components, set editable to true and ignore processing editability for any child component\n if (component.attributes.attributes['data-raw-content'] !== undefined) {\n component.set({editable: true});\n return;\n }\n\n // set editable access based on tags, styling or html class attribute\n if (allowEditableComponents) {\n allowEditBasedOnComponentAttributes(component);\n\n // if the component is made text-editable, re-add the raw html contents\n // to ensure the text editor does not deal with elements with attributes added by GrapesJS\n if (component.attributes['made-text-editable'] === 'true') {\n component.attributes.attributes['data-raw-content'] = 'true';\n\n // refresh the current component in order to switch its component type to raw-content.\n // this disables GrapesJS parsing of any child elements, avoiding that any GrapesJS specific html attributes are added\n let replaced = component.replaceWith(component.toHTML());\n let newComponent = Array.isArray(replaced) ? replaced[0] : replaced;\n if (newComponent) {\n // copy important attributes from the original component to the refreshed component\n ['block-id', 'block-slug', 'is-html', 'style-identifier'].forEach(attribute => {\n newComponent.attributes[attribute] = component.attributes[attribute];\n });\n // apply block/component edit restrictions to the new raw-content type version of the component\n restrictEditAccess(newComponent);\n }\n return;\n }\n }\n\n // apply edit restrictions to child components\n component.get('components').each(component => restrictEditAccess(component, directlyInsideDynamicBlock, allowEditableComponents));\n }\n\n /**\n * Set the given component's editability based on which tag the component represents,\n * which attributes are set or which styling is applied.\n *\n * @param component\n * @returns {boolean}\n */\n function allowEditBasedOnComponentAttributes(component) {\n let htmlTag = component.get('tagName');\n\n let textEditableTags = [\n //'div','span', // needed for editable bootstrap alert, but cannot be used since divs (block containers) then cannot be removed\n 'h1','h2','h3','h4','h5','h6','h7',\n 'p','small','b','strong','i','em','label','button',\n 'ol', 'ul','li','table'\n ];\n let otherEditableTags = [\n 'img'\n ];\n\n let settings = {};\n if ('phpb-blocks-container' in component.attributes.attributes) {\n settings.hoverable = true;\n settings.selectable = true;\n settings.droppable = true;\n }\n\n if (textEditableTags.includes(htmlTag) || 'phpb-editable' in component.attributes.attributes) {\n settings.editable = true;\n component.attributes['made-text-editable'] = 'true';\n } else if (otherEditableTags.includes(htmlTag)) {\n settings.editable = true;\n }\n\n if (componentHasBackground(component)) {\n settings.hoverable = true;\n settings.selectable = true;\n settings.stylable = true;\n }\n\n if (htmlTag === 'a') {\n settings.hoverable = true;\n settings.selectable = true;\n settings.stylable = true;\n settings.removable = true;\n }\n\n if (Object.keys(settings).length > 0) {\n component.set(settings);\n if (settings.stylable !== undefined && settings.stylable) {\n addUniqueClass(component);\n }\n }\n }\n\n /**\n * Add a unique class to this component to ensure style only applies to this component instance.\n *\n * @param component\n */\n function addUniqueClass(component) {\n // get component identifier class if one is already added to the component's html when saving the pagebuilder previously\n let componentIdentifier = false;\n component.getClasses().forEach(componentClass => {\n if (componentClass.startsWith('ID') && componentClass.length >= 16) {\n componentIdentifier = componentClass;\n }\n });\n\n if (component.attributes['style-identifier'] === undefined) {\n component.attributes['style-identifier'] = componentIdentifier ? componentIdentifier : generateId();\n }\n component.addClass(component.attributes['style-identifier']);\n }\n\n /**\n * Disable all edit functionality on the given component.\n *\n * @param component\n */\n function disableAllEditFunctionality(component) {\n component.set({\n removable: false,\n draggable: false,\n droppable: false,\n badgable: false,\n stylable: false,\n highlightable: false,\n copyable: false,\n resizable: false,\n editable: false,\n layerable: false,\n selectable: false,\n hoverable: false\n });\n }\n\n /**\n * Generate a unique id string.\n *\n * Based on: https://gist.github.com/gordonbrander/2230317\n */\n let counter = 0;\n function generateId() {\n return 'ID' + (Date.now().toString(36)\n + Math.random().toString(36).substr(2, 5) + counter++).toUpperCase();\n }\n\n /**\n * Wait for GrapesJS to be fully loaded before trying to load the components in the page builder.\n */\n function waitForGrapesToLoad() {\n if (window.grapesJSLoaded) {\n afterGrapesJSLoaded();\n } else {\n setTimeout(waitForGrapesToLoad, 100);\n }\n }\n waitForGrapesToLoad();\n\n\n","\n\n window.pageData = {};\n\n window.changesOffset = 0;\n window.onbeforeunload = confirmExit;\n function confirmExit() {\n let changesCount = window.editor.getModel().get('changesCount') - window.changesOffset;\n if (changesCount > 0) {\n return \"Are you sure? There are unsaved changes.\";\n }\n }\n\n /**\n * Save page on clicking save button.\n */\n const savePageBtn = document.getElementById(\"save-page\");\n if (savePageBtn) {\n savePageBtn.addEventListener('click', function() {\n saveAllTranslationsToServer();\n });\n }\n\n /**\n * Save page on Ctrl + S.\n */\n document.addEventListener(\"keydown\", function(e) {\n if (e.ctrlKey && (e.key === 's' || e.key === 'S' || e.which === 83)) {\n // text-editor updates are not applied until focus is lost, so force GrapesJS update\n window.editor.store();\n\n saveAllTranslationsToServer();\n e.preventDefault();\n return false;\n }\n });\n\n /**\n * Switch the pagebuilder to the given language.\n * This stores the all data of the current language locally for later use and renders the given language variant on the server.\n *\n * @param newLanguage\n * @param callback\n */\n window.switchLanguage = function(newLanguage, callback) {\n window.setWaiting(true);\n\n saveCurrentTranslationLocally(async function() {\n applyChangesFromCurrentLanguageToNewLanguage(newLanguage);\n\n let data = window.pageData;\n data.blocks = {[newLanguage]: window.pageBlocks[newLanguage]};\n\n const formData = new URLSearchParams();\n formData.append('data', JSON.stringify(data));\n formData.append('language', newLanguage);\n\n // render the language variant server-side\n try {\n const response = await fetch(window.renderLanguageVariantUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'X-Requested-With': 'XMLHttpRequest'\n },\n body: formData\n });\n\n if (!response.ok) {\n let errData = {};\n try { errData = await response.json(); } catch(e) {}\n let errorMessage = response.statusText + ' ' + response.status;\n errorMessage = errData.message ? (errorMessage + ': \"' + errData.message + '\"') : errorMessage;\n window.toastr.error(errorMessage);\n window.toastr.error(window.translations['toastr-switching-language-failed']);\n callback();\n window.setWaiting(false);\n return;\n }\n\n const responseText = await response.text();\n let parsed = JSON.parse(responseText);\n window.pageBlocks[newLanguage] = parsed.dynamicBlocks ? parsed.dynamicBlocks : {};\n callback();\n window.setWaiting(false);\n } catch (error) {\n callback();\n console.error(error);\n window.toastr.error(error.message || 'Error');\n window.toastr.error(window.translations['toastr-switching-language-failed']);\n window.setWaiting(false);\n }\n });\n };\n\n /**\n * Copy new blocks of the current language to the new language or remove old blocks from the new language.\n *\n * @param newLanguage\n */\n function applyChangesFromCurrentLanguageToNewLanguage(newLanguage) {\n let newLanguageBlocks = window.pageBlocks[newLanguage];\n let currentLanguageBlocks = window.pageBlocks[window.currentLanguage];\n\n if (newLanguageBlocks === undefined) {\n newLanguageBlocks = currentLanguageBlocks;\n } else {\n updateNestedBlocks(currentLanguageBlocks, newLanguageBlocks);\n\n // copy missing blocks from the current language to the target language\n for (let blockId in currentLanguageBlocks) {\n if (newLanguageBlocks[blockId] === undefined) {\n newLanguageBlocks[blockId] = currentLanguageBlocks[blockId];\n }\n }\n }\n\n // copy the content of blocks containers of the current language to the blocks containers of the new language\n for (let blockId in currentLanguageBlocks) {\n let currentBlockHtml = (currentLanguageBlocks[blockId] && currentLanguageBlocks[blockId]['html']) || '';\n let newBlockHtml = (newLanguageBlocks[blockId] && newLanguageBlocks[blockId]['html']) || '';\n\n let currDiv = document.createElement(\"div\");\n currDiv.innerHTML = currentBlockHtml;\n let newDiv = document.createElement(\"div\");\n newDiv.innerHTML = newBlockHtml;\n\n let currContainers = currDiv.querySelectorAll(\"[phpb-blocks-container]\");\n let newContainers = newDiv.querySelectorAll(\"[phpb-blocks-container]\");\n\n currContainers.forEach((cont, index) => {\n if (newContainers[index]) {\n newContainers[index].innerHTML = cont.innerHTML;\n }\n });\n newLanguageBlocks[blockId]['html'] = newDiv.innerHTML;\n }\n\n window.pageBlocks[newLanguage] = newLanguageBlocks;\n }\n\n /**\n * Replace phpb-blocks-container html snippets if a block of the current language already exists in the target language.\n * This ensures all child blocks are present for all languages and they remain in the same order\n */\n function updateNestedBlocks(currentLanguageBlocks, newLanguageBlocks) {\n for (let blockId in currentLanguageBlocks) {\n // skip if the parent block does not yet exist in the target language\n if (newLanguageBlocks[blockId] === undefined) {\n continue;\n }\n\n for (let subBlockId in currentLanguageBlocks[blockId].blocks) {\n let updatedSubBlock = currentLanguageBlocks[blockId].blocks[subBlockId];\n let oldSubBlock = newLanguageBlocks[blockId].blocks[subBlockId];\n if (! updatedSubBlock || ! oldSubBlock) {\n continue;\n }\n\n let updatedSubBlockMatches = updatedSubBlock.html.match(/phpb-blocks-container(.*)>(.*)(.*) {\n let data = getContainerContentInStorageFormat(container);\n\n window.pageData['css'] = mergeCss(existingCss, data.css);\n window.pageData['style'] = data.style;\n window.pageData['html'][index] = data.html;\n window.pageData['components'][index] = data.components;\n\n window.pageBlocks[window.currentLanguage] = {...window.pageBlocks[window.currentLanguage], ...data.blocks};\n window.contentContainerComponents[index] = data.components;\n });\n\n if (callback) {\n callback();\n }\n }, 200);\n }\n\n /**\n * Add all selectors from existingCss that are missing in newCss.\n * Backwards compatibility fix: losing CSS due to having different block style identifiers for different languages.\n */\n function mergeCss(existingCss, newCss) {\n if (! existingCss) {\n return newCss;\n }\n let pageBlocksString = JSON.stringify(window.pageBlocks);\n let regex = \"\\\\.ID(.*?){(.*?)}\"\n let matches = existingCss.match(new RegExp(regex, 'g'));\n if (! matches) {\n return newCss;\n }\n matches.forEach(function(css) {\n let selector = css.split('{')[0];\n let pageBlocksStringSelector = selector.replace('.', ' ').trim();\n if (newCss.indexOf(selector) === -1 && pageBlocksString.indexOf(pageBlocksStringSelector) >= 0) {\n newCss += css;\n }\n });\n return newCss;\n }\n\n /**\n * Remove the style selectors that are no longer present among the current page blocks.\n */\n function removeOldStyleSelectors(styleComponents) {\n let pageBlocksString = JSON.stringify(window.pageBlocks);\n\n let updatedStyleComponents = [];\n styleComponents.forEach(styleComponent => {\n if (styleComponent.attributes.selectors.models.length) {\n let selector = styleComponent.attributes.selectors.models[0].id;\n if (pageBlocksString.includes(selector)) {\n updatedStyleComponents.push(styleComponent);\n }\n }\n });\n return updatedStyleComponents;\n }\n\n /**\n * Save the data of all translation variants on the server.\n */\n function saveAllTranslationsToServer() {\n toggleSaving();\n\n saveCurrentTranslationLocally(async function() {\n\n // update all language variants with the latest data of the current language we just saved locally\n Object.keys(window.languages || {}).forEach(languageCode => {\n if (languageCode !== window.currentLanguage) {\n applyChangesFromCurrentLanguageToNewLanguage(languageCode);\n }\n });\n\n let data = window.pageData;\n data.style = removeOldStyleSelectors(data.style);\n data.blocks = window.pageBlocks;\n\n const saveBtn = document.getElementById(\"save-page\");\n const saveUrl = saveBtn ? (saveBtn.dataset.url || saveBtn.getAttribute('data-url')) : '';\n\n const formData = new URLSearchParams();\n formData.append('data', JSON.stringify(data));\n\n try {\n const response = await fetch(saveUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'X-Requested-With': 'XMLHttpRequest'\n },\n body: formData\n });\n\n toggleSaving();\n\n if (!response.ok) {\n let errData = {};\n try { errData = await response.json(); } catch(e) {}\n let errorMessage = response.statusText + ' ' + response.status;\n errorMessage = errData.message ? (errorMessage + ': \"' + errData.message + '\"') : errorMessage;\n window.toastr.error(errorMessage);\n window.toastr.error(window.translations['toastr-saving-failed']);\n return;\n }\n\n window.toastr.success(window.translations['toastr-changes-saved']);\n\n setTimeout(function() {\n window.changesOffset = window.editor.getModel().get('changesCount');\n }, 250);\n } catch(error) {\n toggleSaving();\n console.error(error);\n window.toastr.error(error.message || 'Error');\n window.toastr.error(window.translations['toastr-saving-failed']);\n }\n });\n }\n\n /**\n * Get the given component in storage format (in context of its container with all siblings removed).\n *\n * @param component\n */\n window.getComponentDataInStorageFormat = function(component) {\n // clone component's parent, enabling us to temporarily remove all component's siblings without updating the pagebuilder\n let container = window.cloneComponent(component.parent());\n\n\n console.log({\n container: container,\n componentParent: component.parent(),\n })\n // remove all component's siblings since we only want to return the given component in storage format\n\n // container.get('components').reset();\n // container.append(component);\n const componentId = component.attributes['block-id']\n console.log(component.attributes['block-id'])\n container.components().forEach(c => {\n console.log({c})\n // console.log(c?.attributes['block-id'])\n // console.log(c?.attributes['block-id'] !== componentId)\n if(c?.attributes['block-id'] !== componentId) {\n c?.remove()\n }\n })\n\n console.log({\n containerL: container.get('components').length,\n componentParentL: component.parent().get('components').length,\n })\n return getContainerContentInStorageFormat(container);\n };\n\n /**\n * Get the given container in storage format.\n *\n * @param container\n */\n function getContainerContentInStorageFormat(container) {\n // remove all existing references while cloning GrapesJS components,\n // this prevents GrapesJS from changing our IDs due to ID collisions\n let componentReferences = window.editor.DomComponents.componentsById;\n window.editor.DomComponents.componentsById = [];\n\n // we need to clone the container, since we will be replacing components with placeholders and we don't want to update the page builder\n container = window.cloneComponent(container);\n // replace each pagebuilder block for a shortcode and phpb-block element and return an array of all page blocks data\n let blocksData = replaceDynamicBlocksWithPlaceholders(container).blocks;\n\n let html = window.html_beautify(getContainerHtml(container));\n let css = window.editor.getCss();\n let style = window.editor.getStyle();\n let components = JSON.parse(JSON.stringify(container.get('components')));\n\n // switch back to original GrapesJS component references\n window.editor.DomComponents.componentsById = componentReferences;\n\n return {\n html: html,\n css: css,\n components: components,\n blocks: blocksData,\n style: style,\n }\n }\n\n /**\n * Return the html representation of the contents of the given container.\n *\n * @param container\n */\n function getContainerHtml(container) {\n let html = '';\n container.get('components').forEach(component => html += component.toHTML());\n let div = document.createElement(\"div\");\n div.innerHTML = html;\n // replace phpb-block elements with shortcode\n div.querySelectorAll('phpb-block').forEach(el => {\n let slug = el.getAttribute('slug') || '';\n let id = el.getAttribute('id') || '';\n el.replaceWith('[block slug=\"' + slug + '\" id=\"' + id + '\"]');\n });\n return div.innerHTML;\n }\n\n /**\n * Return the html representation of the given component.\n *\n * @param component\n */\n function getComponentHtml(component) {\n let div = document.createElement(\"div\");\n div.innerHTML = component.toHTML();\n // replace phpb-block elements with shortcode\n div.querySelectorAll('phpb-block').forEach(el => {\n let slug = el.getAttribute('slug') || '';\n let id = el.getAttribute('id') || '';\n el.replaceWith('[block slug=\"' + slug + '\" id=\"' + id + '\"]');\n });\n return div.innerHTML;\n }\n\n /**\n * Replace all blocks with is-html === false with a component that contains all block attributes.\n *\n * @param component\n * @param parentIsDynamic\n * @param parentIsHtmlInsideDynamic\n */\n function replaceDynamicBlocksWithPlaceholders(component, parentIsDynamic = false, parentIsHtmlInsideDynamic = false) {\n // data structure to be filled with the data of nested blocks via recursive calls\n let data = {\n current_block: {settings: {}, blocks: {}, html: \"\", is_html: false},\n blocks: {}\n };\n\n // update variables for passing context to the recursive calls on child components\n let newParentIsDynamic = parentIsDynamic;\n let newParentIsHtmlInsideDynamic = parentIsHtmlInsideDynamic;\n if (component.attributes['block-id'] !== undefined) {\n if (component.attributes['is-html'] === 'false') {\n newParentIsDynamic = true;\n newParentIsHtmlInsideDynamic = false;\n } else if (parentIsDynamic) {\n newParentIsDynamic = false;\n newParentIsHtmlInsideDynamic = true;\n }\n }\n\n // depth-first recursive call for replacing nested blocks (the deepest blocks are handled first)\n component.get('components').forEach(function(childComponent) {\n let childData = replaceDynamicBlocksWithPlaceholders(childComponent, newParentIsDynamic, newParentIsHtmlInsideDynamic);\n\n // update data object with child data\n for (let key in childData.current_block.blocks) { data.current_block.blocks[key] = childData.current_block.blocks[key]; }\n for (let key in childData.blocks) { data.blocks[key] = childData.blocks[key]; }\n });\n\n // if the method is called with a cloned container (which does not have a parent), this top-level component does not need any changes\n if (! component.parent()) {\n return data;\n }\n\n // if the component is not a block, no replacements need to be done\n if (component.attributes['block-id'] === undefined) {\n return data;\n }\n\n // do the actual replacement of this component with a placeholder component\n if (component.attributes['is-html'] === 'true') {\n if (parentIsDynamic) {\n // the full html content of html blocks directly inside a dynamic block should be stored in parent context using its block-id,\n // this is important because a dynamic block defines block ids and this can collide with block ids hardcoded in other dynamic blocks\n data.current_block['blocks'][component.attributes['block-id']] = {settings: {}, blocks: {}, html: window.html_beautify(getComponentHtml(component)), is_html: true};\n } else {\n // html blocks outside direct context of dynamic blocks should be stored as a block itself\n\n // store the block's style-identifier\n // this will be used as class in a wrapper around the dynamic block to give the block its styling\n if (component.attributes['style-identifier'] !== undefined) {\n data.current_block['settings']['attributes'] = {'style-identifier': component.attributes['style-identifier']};\n }\n\n // replace this html component by a shortcode with a unique id\n let instanceId = component.attributes['block-id'];\n if (! component.attributes['block-id'].startsWith('ID')) {\n instanceId = generateId();\n }\n\n component.replaceWith({\n tagName: 'phpb-block',\n attributes: {\n slug: component.attributes['block-slug'],\n id: instanceId\n }\n });\n\n // store the block data globally in the blocks array\n data.blocks[instanceId] = {settings: data.current_block['settings'], blocks: {}, html: window.html_beautify(getComponentHtml(component)), is_html: true};\n data.current_block = {settings: {}, blocks: {}, html: \"\", is_html: false};\n }\n } else {\n // store the attributes set to this block using traits in the settings side panel\n let attributes = {};\n component.get('traits').each(function(trait) {\n attributes[trait.get('name')] = trait.getTargetValue();\n });\n data.current_block['settings']['attributes'] = attributes;\n\n // store the block's style-identifier\n // this will be used as class in a wrapper around the dynamic block to give the block its styling\n if (component.attributes['style-identifier'] !== undefined) {\n data.current_block['settings']['attributes']['style-identifier'] = component.attributes['style-identifier'];\n }\n\n // replace this dynamic component by a shortcode with a unique id\n let instanceId = component.attributes['block-id'];\n if (! component.attributes['block-id'].startsWith('ID')) {\n instanceId = generateId();\n }\n component.replaceWith({\n tagName: 'phpb-block',\n attributes: {\n slug: component.attributes['block-slug'],\n id: instanceId\n }\n });\n\n // store data.current_block data inside data.blocks with the unique id we just generated\n if (parentIsDynamic) {\n // inside a dynamic block, the block data is passed to the context of its parent block (so current_block is used)\n let currentBlockForParent = {settings: {}, blocks: {}, html: \"\", is_html: false};\n currentBlockForParent['blocks'][component.attributes['block-id']] = data.current_block;\n data.current_block = currentBlockForParent;\n } else {\n // outside dynamic blocks, the block data is globally stored in the blocks array\n data.blocks[instanceId] = data.current_block;\n data.current_block = {settings: {}, blocks: {}, html: \"\", is_html: false};\n }\n }\n\n return data;\n }\n\n /**\n * Generate a unique id string.\n *\n * Based on: https://gist.github.com/gordonbrander/2230317\n */\n let counter = 0;\n function generateId() {\n return 'ID' + (Date.now().toString(36)\n + Math.random().toString(36).substr(2, 5) + counter++).toUpperCase();\n }\n\n /**\n * Set the page builder waiting status.\n */\n window.setWaiting = function(value) {\n let wrapper = window.editor.DomComponents.getWrapper();\n if (value) {\n wrapper.addClass(\"gjs-waiting\");\n } else {\n wrapper.removeClass(\"gjs-waiting\");\n }\n };\n\n /**\n * Toggle the save button waiting status.\n */\n function toggleSaving() {\n let button = document.getElementById(\"save-page\");\n if (!button) return;\n button.blur();\n\n let spinner = button.querySelector('.spinner-border') || button.querySelector('.loading');\n\n if (button.classList.contains('waiting')) {\n button.removeAttribute(\"disabled\");\n button.classList.remove('waiting');\n if (spinner) spinner.style.display = \"none\";\n } else {\n button.setAttribute(\"disabled\", \"true\");\n button.classList.add('waiting');\n if (spinner) spinner.style.display = \"\";\n }\n }\n\n\n","export function sanitizeHtml(html) {\n if (!html) return '';\n // remove all not allowed tags\n let result = html.replace(/<(?!\\/?(?:a|table|tr|td|th|thead|tbody|tfoot|caption|col|colgroup|p|ul|ol|li|br|strong|em|b|i|u|strike|s|sub|sup|h1|h2|h3|h4|h5|h6|blockquote|pre|hr|span)\\b)[^>]+>/gim, '');\n\n // remove disallowed attributes from allowed tags, keeping href on anchor and style on table elements\n result = result.replace(/<(a|table|tr|td|th|thead|tbody|tfoot|caption|col|colgroup|p|ul|ol|li|br|strong|em|b|i|u|strike|s|sub|sup|h1|h2|h3|h4|h5|h6|blockquote|pre|hr|span)\\b([^>]*)>/gim, function(match, tag, attrs) {\n tag = tag.toLowerCase();\n if (tag === 'a') {\n const hrefMatch = attrs.match(/href=\"([^\"]*)\"/i) || attrs.match(/href='([^']*)'/i);\n const targetMatch = attrs.match(/target=\"([^\"]*)\"/i) || attrs.match(/target='([^']*)'/i);\n const href = hrefMatch ? ` href=\"${hrefMatch[1]}\"` : '';\n const target = targetMatch && targetMatch[1] === '_blank' ? ' target=\"_blank\"' : '';\n return ``;\n }\n if ('|table|tr|td|th|thead|tbody|tfoot|'.includes('|' + tag + '|')) {\n const styleMatch = attrs.match(/style=\"([^\"]*)\"/i) || attrs.match(/style='([^']*)'/i);\n return styleMatch ? `<${tag} style=\"${styleMatch[1]}\">` : `<${tag}>`;\n }\n return `<${tag}>`;\n });\n\n return result;\n}\n\nfunction setupPasteSanitizer(editor) {\n const handlePaste = ({ ev, rte }) => {\n ev.preventDefault();\n const clipboardData = ev.clipboardData || window.clipboardData;\n if (!clipboardData) return;\n\n const html = clipboardData.getData('text/html');\n const text = clipboardData.getData('text/plain');\n\n if (html) {\n const cleanHtml = sanitizeHtml(html);\n rte.insertHTML(cleanHtml);\n } else if (text) {\n const escaped = text\n .replace(/&/g, '&')\n .replace(//g, '>')\n .replace(/(?:\\r\\n|\\r|\\n)/g, '
');\n rte.insertHTML(escaped);\n }\n };\n\n if (editor.RichTextEditor) {\n const rteConfig = editor.RichTextEditor.getConfig();\n rteConfig.onPaste = handlePaste;\n }\n}\n\nfunction registerToolbarActions(editor) {\n const rte = editor.RichTextEditor;\n if (!rte) return;\n\n // Custom Link action\n if (rte.get('link')) {\n rte.remove('link');\n }\n rte.add('link', {\n icon: '',\n attributes: { title: (window.translations && window.translations['link']) || 'Link' },\n result: r => openLinkModal(editor, r)\n });\n\n if (!rte.get('unorderedList')) {\n rte.add('unorderedList', {\n icon: '',\n attributes: { title: 'Bulleted List' },\n result: r => r.exec('insertUnorderedList')\n });\n }\n\n if (!rte.get('orderedList')) {\n rte.add('orderedList', {\n icon: '',\n attributes: { title: 'Numbered List' },\n result: r => r.exec('insertOrderedList')\n });\n }\n\n if (!rte.get('justifyLeft')) {\n rte.add('justifyLeft', {\n icon: '',\n attributes: { title: 'Align Left' },\n result: r => r.exec('justifyLeft')\n });\n }\n\n if (!rte.get('justifyCenter')) {\n rte.add('justifyCenter', {\n icon: '',\n attributes: { title: 'Align Center' },\n result: r => r.exec('justifyCenter')\n });\n }\n\n if (!rte.get('justifyRight')) {\n rte.add('justifyRight', {\n icon: '',\n attributes: { title: 'Align Right' },\n result: r => r.exec('justifyRight')\n });\n }\n}\n\nfunction openLinkModal(editor, rte) {\n const sel = rte.selection();\n let savedRange = null;\n let currentAnchor = null;\n\n if (sel && sel.rangeCount > 0) {\n savedRange = sel.getRangeAt(0).cloneRange();\n let node = sel.anchorNode;\n if (node) {\n if (node.nodeType === Node.TEXT_NODE) node = node.parentNode;\n currentAnchor = node.closest ? node.closest('a') : null;\n }\n }\n\n let initialType = 'page';\n let initialPageId = '';\n let initialUrl = '';\n let initialTargetBlank = false;\n\n if (currentAnchor) {\n const href = currentAnchor.getAttribute('href') || '';\n if (currentAnchor.getAttribute('target') === '_blank') {\n initialTargetBlank = true;\n }\n if (href.startsWith('[page id=')) {\n initialType = 'page';\n initialPageId = href.substring(9, href.length - 1);\n } else {\n initialType = 'url';\n initialUrl = href;\n }\n }\n\n const pages = window.pages || [];\n const translations = window.translations || {};\n\n const container = document.createElement('div');\n container.className = 'gjs-link-modal-form';\n container.style.padding = '10px 0';\n\n // Type selector: Internal Page vs External URL\n const typeGroup = document.createElement('div');\n typeGroup.style.marginBottom = '12px';\n typeGroup.innerHTML = `\n \n
\n \n \n
\n `;\n container.appendChild(typeGroup);\n\n // Page selection container\n const pageGroup = document.createElement('div');\n pageGroup.style.marginBottom = '12px';\n pageGroup.style.display = initialType === 'page' ? 'block' : 'none';\n\n let pageOptionsHtml = '';\n pages.forEach(item => {\n const title = Array.isArray(item) ? item[0] : (item.title || item.name);\n const id = Array.isArray(item) ? item[1] : item.id;\n const isSelected = String(id) === String(initialPageId) ? 'selected' : '';\n pageOptionsHtml += ``;\n });\n\n pageGroup.innerHTML = `\n \n \n `;\n container.appendChild(pageGroup);\n\n // URL input container\n const urlGroup = document.createElement('div');\n urlGroup.style.marginBottom = '12px';\n urlGroup.style.display = initialType === 'url' ? 'block' : 'none';\n urlGroup.innerHTML = `\n \n \n `;\n container.appendChild(urlGroup);\n\n // Toggle between page and URL\n const radios = typeGroup.querySelectorAll('input[type=\"radio\"]');\n radios.forEach(radio => {\n radio.addEventListener('change', () => {\n if (radio.value === 'page') {\n pageGroup.style.display = 'block';\n urlGroup.style.display = 'none';\n } else {\n pageGroup.style.display = 'none';\n urlGroup.style.display = 'block';\n }\n });\n });\n\n // Target blank checkbox\n const targetGroup = document.createElement('div');\n targetGroup.style.marginBottom = '16px';\n targetGroup.innerHTML = `\n \n `;\n container.appendChild(targetGroup);\n\n // Buttons\n const buttonsGroup = document.createElement('div');\n buttonsGroup.style.display = 'flex';\n buttonsGroup.style.gap = '8px';\n buttonsGroup.style.justifyContent = 'flex-end';\n\n const cancelBtn = document.createElement('button');\n cancelBtn.type = 'button';\n cancelBtn.className = 'btn';\n cancelBtn.innerText = translations['cancel'] || 'Cancel';\n cancelBtn.addEventListener('click', () => editor.Modal.close());\n buttonsGroup.appendChild(cancelBtn);\n\n if (currentAnchor) {\n const unlinkBtn = document.createElement('button');\n unlinkBtn.type = 'button';\n unlinkBtn.className = 'btn btn-danger';\n unlinkBtn.style.color = '#e53e3e';\n unlinkBtn.innerText = translations['unlink'] || 'Remove Link';\n unlinkBtn.addEventListener('click', () => {\n const parent = currentAnchor.parentNode;\n while (currentAnchor.firstChild) {\n parent.insertBefore(currentAnchor.firstChild, currentAnchor);\n }\n parent.removeChild(currentAnchor);\n editor.Modal.close();\n });\n buttonsGroup.appendChild(unlinkBtn);\n }\n\n const applyBtn = document.createElement('button');\n applyBtn.type = 'button';\n applyBtn.className = 'btn btn-primary';\n applyBtn.style.backgroundColor = '#3b82f6';\n applyBtn.style.color = '#fff';\n applyBtn.innerText = translations['apply'] || 'Apply';\n applyBtn.addEventListener('click', () => {\n const selectedType = typeGroup.querySelector('input[type=\"radio\"]:checked').value;\n const pageSelect = pageGroup.querySelector('select');\n const urlInput = urlGroup.querySelector('input');\n const targetBlank = targetGroup.querySelector('input').checked;\n\n let href = '';\n if (selectedType === 'page') {\n if (pageSelect.value) {\n href = `[page id=${pageSelect.value}]`;\n }\n } else {\n href = urlInput.value.trim();\n }\n\n if (!href) {\n editor.Modal.close();\n return;\n }\n\n if (savedRange && rte.doc) {\n const win = rte.doc.defaultView || window;\n const currentSel = win.getSelection();\n if (currentSel) {\n currentSel.removeAllRanges();\n currentSel.addRange(savedRange);\n }\n }\n\n if (currentAnchor) {\n currentAnchor.setAttribute('href', href);\n if (targetBlank) {\n currentAnchor.setAttribute('target', '_blank');\n } else {\n currentAnchor.removeAttribute('target');\n }\n } else {\n const selectedText = savedRange ? savedRange.toString() : '';\n const targetAttr = targetBlank ? ' target=\"_blank\"' : '';\n const textToInsert = selectedText || href;\n rte.insertHTML(`${textToInsert}`);\n }\n\n editor.Modal.close();\n });\n buttonsGroup.appendChild(applyBtn);\n\n container.appendChild(buttonsGroup);\n\n editor.Modal.open({\n title: translations['link'] || 'Link',\n content: container\n });\n}\n\nlet isInitialized = false;\nexport function initRteLinkManager(editor) {\n if (!editor || !editor.RichTextEditor || isInitialized) return;\n isInitialized = true;\n setupPasteSanitizer(editor);\n registerToolbarActions(editor);\n}\n\nif (typeof window !== 'undefined') {\n if (window.editor) {\n initRteLinkManager(window.editor);\n } else {\n window.addEventListener('load', () => {\n if (window.editor) initRteLinkManager(window.editor);\n });\n }\n}\n","\n\n window.touchStart = function() {\n const gjsEl = document.getElementById('gjs');\n if (gjsEl) gjsEl.classList.add('sidebar-collapsed');\n};\n\n"],"mappings":"C,WAAA,IAAIE,EAAiB,KAErB,SAASC,GAAoB,CAOzB,OANKD,GAAmB,SAAS,KAAK,SAASA,CAAc,IACzDA,EAAiB,SAAS,cAAc,KAAK,EAC7CA,EAAe,UAAY,4BAC3BA,EAAe,MAAM,QAAU,4HAC/B,SAAS,KAAK,YAAYA,CAAc,GAErCA,CACX,CAEA,SAAgBE,EAAUC,EAASC,EAAO,OAAQC,EAAW,KAAM,CAC/D,GAAI,CAACF,EAAS,OACd,IAAMG,EAAYL,EAAkB,EAC9BM,EAAQ,SAAS,cAAc,KAAK,EAC1CA,EAAM,UAAY,eAAeH,IACjCG,EAAM,MAAM,QAAU;;;;;;;;;;;;;4BAaEH,IAAS,UAAY,UAAYA,IAAS,QAAU,UAAY,UAAU;;;;MAMlG,IAAMI,EAAO,SAAS,cAAc,GAAG,EACvCA,EAAK,UAAYJ,IAAS,UAAY,qBAAuBA,IAAS,QAAU,2BAA6B,oBAC7GG,EAAM,YAAYC,CAAI,EAEtB,IAAMC,EAAO,SAAS,cAAc,MAAM,EAC1CA,EAAK,UAAYN,EACjBM,EAAK,MAAM,KAAO,IAClBF,EAAM,YAAYE,CAAI,EAEtBH,EAAU,YAAYC,CAAK,EAG3B,0BAA4B,CACxBA,EAAM,MAAM,QAAU,IACtBA,EAAM,MAAM,UAAY,eAC5B,CAAC,EAED,eAAiB,CACbA,EAAM,MAAM,QAAU,IACtBA,EAAM,MAAM,UAAY,oBACxB,eAAiB,CACTA,EAAM,YACNA,EAAM,WAAW,YAAYA,CAAK,CAE1C,EAAG,GAAG,CACV,EAAGF,CAAQ,CACf,CAEA,OAAO,OAAS,CACZ,QAAQK,EAAKL,EAAW,IAAM,CAC1BH,EAA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CAClCA,GAAWA,EAAO,gBAAkB+Q,KACzCA,EAAgB,GAChB9C,GAAoBjO,CAAM,EAC1B0O,GAAuB1O,CAAM,EACjC,CAEI,OAAO,OAAW,MACd,OAAO,OACPgR,EAAmB,OAAO,MAAM,EAEhC,OAAO,iBAAiB,WAAc,CAC9B,OAAO,QAAQA,EAAmB,OAAO,MAAM,CACvD,CAAC,GCrUL,OAAO,WAAa,UAAW,CAC/B,IAAMnR,EAAQ,SAAS,eAAe,KAAK,EACvCA,GAAOA,EAAM,UAAU,IAAI,mBAAmB,CACtD,C"} \ No newline at end of file diff --git a/plugi-core/src/Modules/GrapesJS/resources/assets/js/save-page.js b/plugi-core/src/Modules/GrapesJS/resources/assets/js/save-page.js index 76d5776..242b51d 100644 --- a/plugi-core/src/Modules/GrapesJS/resources/assets/js/save-page.js +++ b/plugi-core/src/Modules/GrapesJS/resources/assets/js/save-page.js @@ -573,11 +573,11 @@ if (button.classList.contains('waiting')) { button.removeAttribute("disabled"); button.classList.remove('waiting'); - if (spinner) spinner.classList.add('d-none'); + if (spinner) spinner.style.display = "none"; } else { button.setAttribute("disabled", "true"); button.classList.add('waiting'); - if (spinner) spinner.classList.remove('d-none'); + if (spinner) spinner.style.display = ""; } } diff --git a/plugi-core/src/Modules/GrapesJS/resources/views/pagebuilder.php b/plugi-core/src/Modules/GrapesJS/resources/views/pagebuilder.php index 8313c4b..42642da 100644 --- a/plugi-core/src/Modules/GrapesJS/resources/views/pagebuilder.php +++ b/plugi-core/src/Modules/GrapesJS/resources/views/pagebuilder.php @@ -129,7 +129,7 @@ require __DIR__ . '/grapesjs/trait-manager.php';