diff --git a/plugi-core/build.js b/plugi-core/build.js index b78d448..1acec92 100644 --- a/plugi-core/build.js +++ b/plugi-core/build.js @@ -1,107 +1,299 @@ -import { build } from 'vite'; -import path from 'path'; -import { fileURLToPath } from 'url'; -import fs from 'fs'; +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { spawn } from 'node:child_process'; +import { rolldown } from 'rolldown'; +import * as sass from 'sass'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const isWatch = process.argv.includes('--watch') || process.argv.includes('-w'); +const isDev = isWatch || process.env.NODE_ENV === 'development'; -// libraries -const libraries = [ - { - entry: './src/Modules/WebsiteManager/resources/assets/entry.js', - name: 'WebsiteManager', - fileName: 'WebsiteManager', - }, - { - entry: './src/Modules/GrapesJS/resources/assets/entryHead.js', - name: 'PageBuilderHead', - fileName: 'PageBuilderHead', - }, - { - entry: './src/Modules/GrapesJS/resources/assets/entryBody.js', - name: 'PageBuilderBody', - fileName: 'PageBuilderBody', - }, -]; +const GRAPES_JS_PATH = path.resolve(__dirname, 'node_modules/grapesjs/dist/grapes.min.js'); +const GRAPES_CSS_PATH = path.resolve(__dirname, 'node_modules/grapesjs/dist/css/grapes.min.css'); +const DIST_DIR = path.resolve(__dirname, 'dist'); +const DIST_PB_DIR = path.resolve(DIST_DIR, 'pagebuilder'); -// GrapesJS ships a pre-bundled Webpack bundle as its ESM entry (grapes.mjs). -// Vite cannot re-bundle it correctly because the internal __webpack_require__ -// calls break when Vite replaces the module system. Use a custom plugin to -// inject the raw GrapesJS UMD bundle and resolve the import to it. -function grapesjsBundlePlugin() { - const grapesMinPath = path.resolve(__dirname, 'node_modules/grapesjs/dist/grapes.min.js'); - const grapesMinContent = fs.readFileSync(grapesMinPath, 'utf-8'); - - return [ - { - name: 'grapesjs-resolve', - resolveId(id, importer) { - if (id === 'grapesjs') { - return { id: '\0grapesjs-umd', moduleSideEffects: true }; - } - return null; - }, - load(id) { - if (id === '\0grapesjs-umd') { - // Return the UMD bundle as a raw module that sets window.grapesjs - return `window.grapesjs = undefined; -${grapesMinContent} -var _grapesjs = window.grapesjs; -export default _grapesjs;`; - } - return null; - }, - // Prevent Rollup from trying to scan/transform this module - moduleParsed(info) { - if (info.id === '\0grapesjs-umd') { - info.isEntry = false; - } - }, - }, - { - name: 'grapesjs-output', - renderChunk(code) { - // The GrapesJS UMD bundle uses __webpack_modules__ which Rollup might rename. - // We need to ensure the output preserves the Webpack bundle structure. - return null; - }, - }, - ]; +function ensureDirectories() { + fs.mkdirSync(DIST_DIR, { recursive: true }); + fs.mkdirSync(DIST_PB_DIR, { recursive: true }); } +function verifyPreconditions() { + if (!fs.existsSync(GRAPES_JS_PATH)) { + console.error(`\x1b[31mError:\x1b[0m GrapesJS JavaScript bundle not found at: ${GRAPES_JS_PATH}`); + console.error("Please run 'npm install' before building plugi-core."); + process.exit(1); + } + if (!fs.existsSync(GRAPES_CSS_PATH)) { + console.error(`\x1b[31mError:\x1b[0m GrapesJS CSS bundle not found at: ${GRAPES_CSS_PATH}`); + console.error("Please run 'npm install' before building plugi-core."); + process.exit(1); + } +} -// build -libraries.forEach(async (libItem) => { - await build({ - configFile: false, - plugins: [grapesjsBundlePlugin()], - build: { - lib: libItem, - emptyOutDir: false, - minify: 'terser', - terserOptions: { - mangle: { - // Reserve names that are used as globals in pagebuilder.php to prevent - // the minifier from generating them as mangled variable names - reserved: ['config', 'editor', 'window', 'document', 'console', 'CKEDITOR'], - }, - compress: { - // Preserve __webpack_* variable names used by the GrapesJS Webpack bundle - keep_fargs: false, - }, - format: { - // Preserve __webpack_* variable names from being mangled - keep_quoted_props: true, - }, - }, - rollupOptions: { - output: { - assetFileNames: (assetInfo) => { - if (assetInfo.name === 'style.css') return `${libItem.fileName}.css`; - return assetInfo.name; - }, - }, - }, - }, +function cleanObsoleteArtifacts() { + const obsoleteFiles = [ + path.join(DIST_DIR, 'PageBuilderBody.css'), + path.join(DIST_DIR, 'PageBuilderBody.css.map'), + path.join(DIST_DIR, 'PageBuilderBody.umd.cjs'), + path.join(DIST_DIR, 'PageBuilderHead.umd.cjs'), + path.join(DIST_DIR, 'WebsiteManager.umd.cjs'), + path.join(DIST_PB_DIR, 'app.css'), + path.join(DIST_PB_DIR, 'app.css.map'), + path.join(DIST_PB_DIR, 'app.js'), + path.join(DIST_PB_DIR, 'app.js.map'), + ]; + + for (const file of obsoleteFiles) { + if (fs.existsSync(file)) { + try { + fs.unlinkSync(file); + } catch (e) { + // ignore + } + } + } +} + +async function bundleJs(input, output, { minify = !isDev } = {}) { + const start = performance.now(); + const bundle = await rolldown({ input }); + await bundle.write({ + file: output, + format: 'iife', + sourcemap: true, + minify, }); -}); + const duration = (performance.now() - start).toFixed(1); + const relOutput = path.relative(__dirname, output); + const size = (fs.statSync(output).size / 1024).toFixed(1); + console.log(` \x1b[32m✓\x1b[0m JS ${relOutput} (${size} kB, ${duration}ms)`); +} + +function compileSass(input, output) { + const start = performance.now(); + const result = sass.compile(input, { + style: 'compressed', + sourceMap: true, + }); + + let css = result.css; + const mapFileName = `${path.basename(output)}.map`; + css += `\n/*# sourceMappingURL=${mapFileName} */`; + + fs.writeFileSync(output, css); + if (result.sourceMap) { + fs.writeFileSync(`${output}.map`, JSON.stringify(result.sourceMap)); + } + + const duration = (performance.now() - start).toFixed(1); + const relOutput = path.relative(__dirname, output); + const size = (fs.statSync(output).size / 1024).toFixed(1); + console.log(` \x1b[32m✓\x1b[0m Sass ${relOutput} (${size} kB, ${duration}ms)`); +} + +function buildGrapesHead() { + const start = performance.now(); + + // 1. Copy GrapesJS minified script directly + const headJsOutput = path.join(DIST_DIR, 'PageBuilderHead.js'); + fs.copyFileSync(GRAPES_JS_PATH, headJsOutput); + + // 2. Concatenate GrapesJS core CSS and compiled custom SCSS + const headCssOutput = path.join(DIST_DIR, 'PageBuilderHead.css'); + const grapesCss = fs.readFileSync(GRAPES_CSS_PATH, 'utf-8'); + const customSassResult = sass.compile( + path.resolve(__dirname, 'src/Modules/GrapesJS/resources/assets/sass/app.scss'), + { style: 'compressed', sourceMap: true } + ); + + const combinedCss = `${grapesCss}\n${customSassResult.css}\n/*# sourceMappingURL=PageBuilderHead.css.map */`; + fs.writeFileSync(headCssOutput, combinedCss); + + if (customSassResult.sourceMap) { + fs.writeFileSync(`${headCssOutput}.map`, JSON.stringify(customSassResult.sourceMap)); + } + + const duration = (performance.now() - start).toFixed(1); + const jsSize = (fs.statSync(headJsOutput).size / 1024).toFixed(1); + const cssSize = (fs.statSync(headCssOutput).size / 1024).toFixed(1); + console.log(` \x1b[32m✓\x1b[0m GJS dist/PageBuilderHead.js (${jsSize} kB) & .css (${cssSize} kB) (${duration}ms)`); +} + +async function buildGrapesBody() { + await bundleJs( + path.resolve(__dirname, 'src/Modules/GrapesJS/resources/assets/js/app.js'), + path.join(DIST_DIR, 'PageBuilderBody.js'), + { minify: !isDev } + ); +} + +async function buildPageInjectionJs() { + await bundleJs( + path.resolve(__dirname, 'src/Modules/GrapesJS/resources/assets/js/page-injection.js'), + path.join(DIST_PB_DIR, 'page-injection.js'), + { minify: !isDev } + ); +} + +function buildPageInjectionCss() { + compileSass( + path.resolve(__dirname, 'src/Modules/GrapesJS/resources/assets/sass/page-injection.scss'), + path.join(DIST_PB_DIR, 'page-injection.css') + ); +} + +async function buildWebsiteManagerJs() { + await bundleJs( + path.resolve(__dirname, 'src/Modules/WebsiteManager/resources/assets/js/main.js'), + path.join(DIST_DIR, 'WebsiteManager.js'), + { minify: !isDev } + ); +} + +function runTailwindCli({ watch = false } = {}) { + const input = path.resolve(__dirname, 'src/Modules/WebsiteManager/resources/assets/css/style.css'); + const output = path.join(DIST_DIR, 'WebsiteManager.css'); + const tailwindBin = path.resolve(__dirname, 'node_modules/.bin/tailwindcss'); + + const args = ['-i', input, '-o', output]; + if (!isDev) { + args.push('--minify'); + } + if (watch) { + args.push('--watch'); + } + + if (watch) { + const child = spawn(tailwindBin, args, { stdio: 'inherit', cwd: __dirname }); + return child; + } + + return new Promise((resolve, reject) => { + const start = performance.now(); + const child = spawn(tailwindBin, args, { stdio: 'pipe', cwd: __dirname }); + let stderr = ''; + + child.stderr.on('data', (d) => { + stderr += d.toString(); + }); + + child.on('close', (code) => { + if (code === 0) { + const duration = (performance.now() - start).toFixed(1); + const size = (fs.statSync(output).size / 1024).toFixed(1); + console.log(` \x1b[32m✓\x1b[0m CSS dist/WebsiteManager.css (${size} kB, ${duration}ms)`); + resolve(); + } else { + console.error(`\x1b[31mError compiling Tailwind CSS:\x1b[0m\n${stderr}`); + reject(new Error(`Tailwind CLI exited with code ${code}`)); + } + }); + }); +} + +async function buildAll() { + const totalStart = performance.now(); + console.log(`\n\x1b[1mBuilding plugi-core assets (${isDev ? 'development' : 'production'})...\x1b[0m`); + + ensureDirectories(); + verifyPreconditions(); + cleanObsoleteArtifacts(); + + await Promise.all([ + buildWebsiteManagerJs(), + runTailwindCli({ watch: false }), + buildGrapesHead(), + buildGrapesBody(), + buildPageInjectionJs(), + buildPageInjectionCss(), + ]); + + const totalDuration = (performance.now() - totalStart).toFixed(1); + console.log(`\x1b[32m✨ Build finished successfully in ${totalDuration}ms.\x1b[0m\n`); +} + +function startWatch() { + const tailwindProcess = runTailwindCli({ watch: true }); + + const srcDir = path.resolve(__dirname, 'src'); + console.log(`\x1b[36mWatching for changes in ${srcDir}...\x1b[0m\n`); + + let debounceTimer = null; + const changedPaths = new Set(); + + function triggerRebuild() { + const paths = Array.from(changedPaths); + changedPaths.clear(); + + const tasks = []; + let rebuildWmJs = false; + let rebuildPbBody = false; + let rebuildPbHead = false; + let rebuildInjJs = false; + let rebuildInjCss = false; + + for (const p of paths) { + const normalized = p.replace(/\\/g, '/'); + if (normalized.includes('WebsiteManager/resources/assets/js/')) { + rebuildWmJs = true; + } + if (normalized.includes('GrapesJS/resources/assets/js/page-injection.js')) { + rebuildInjJs = true; + } else if (normalized.includes('GrapesJS/resources/assets/js/')) { + rebuildPbBody = true; + } + if (normalized.includes('GrapesJS/resources/assets/sass/page-injection.scss')) { + rebuildInjCss = true; + } else if (normalized.includes('GrapesJS/resources/assets/sass/')) { + rebuildPbHead = true; + } + } + + if (rebuildWmJs) tasks.push(buildWebsiteManagerJs()); + if (rebuildPbBody) tasks.push(buildGrapesBody()); + if (rebuildPbHead) tasks.push(Promise.resolve(buildGrapesHead())); + if (rebuildInjJs) tasks.push(buildPageInjectionJs()); + if (rebuildInjCss) tasks.push(Promise.resolve(buildPageInjectionCss())); + + if (tasks.length > 0) { + Promise.all(tasks).catch((err) => { + console.error('\x1b[31mRebuild error:\x1b[0m', err); + }); + } + } + + const watcher = fs.watch(srcDir, { recursive: true }, (eventType, filename) => { + if (!filename) return; + changedPaths.add(filename); + clearTimeout(debounceTimer); + debounceTimer = setTimeout(triggerRebuild, 50); + }); + + const cleanup = () => { + console.log('\nStopping watchers...'); + if (tailwindProcess) tailwindProcess.kill(); + watcher.close(); + process.exit(0); + }; + + process.on('SIGINT', cleanup); + process.on('SIGTERM', cleanup); +} + +if (isWatch) { + buildAll() + .then(() => { + startWatch(); + }) + .catch((err) => { + console.error('\x1b[31mBuild failed:\x1b[0m', err); + process.exit(1); + }); +} else { + buildAll().catch((err) => { + console.error('\x1b[31mBuild failed:\x1b[0m', err); + process.exit(1); + }); +} diff --git a/plugi-core/dist/PageBuilderBody.css b/plugi-core/dist/PageBuilderBody.css deleted file mode 100644 index 00edc56..0000000 --- a/plugi-core/dist/PageBuilderBody.css +++ /dev/null @@ -1 +0,0 @@ -html,body,#gjs{height:100%!important;margin:0;overflow:hidden}*{box-shadow:none!important}.form-control,.form-control:focus{color:#e1e1e1}.cursor-pointer{cursor:pointer}.gjs-editor{font-size:.9rem}.toast{opacity:1!important;border:none;right:15px;box-shadow:none}.toast.toast-success{background:#2dc837}#phpb-loading{position:absolute;height:100%;width:100%;background-color:#fff;z-index:10000;transition:opacity .3s,visibility .3s}#phpb-loading.loaded{visibility:hidden;opacity:0}#phpb-loading .circle{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:150px;height:150px}#phpb-loading .circle .text{font-size:20px;margin:20px -30px 0;text-align:center;color:#0091d1}#phpb-loading .loader{width:calc(100% + -0px);height:calc(100% + -0px);border:8px solid #0091d1;border-top:8px solid #004a6c;border-radius:50%;animation:rotate 5s linear infinite}@keyframes rotate{to{transform:rotate(360deg)}}.btn.focus,.btn:focus{box-shadow:none}.gjs-cv-canvas{height:100%;top:0;width:calc(100% - 325px)}.gjs-toolbar{z-index:100!important}.gjs-pn-panel{padding:0}.gjs-pn-panel .gjs-pn-buttons{justify-content:center}.gjs-pn-commands,.gjs-pn-options,.gjs-pn-devices-c{display:none}.gjs-devices-c{padding:0}.gjs-one-bg{background-color:#313844;border-bottom:none;color:#c4c7ce}.gjs-two-color,.gjs-four-color,.gjs-four-color-h:hover{color:#e1e1e1}.gjs-pn-commands{width:100%;box-shadow:none}::-webkit-scrollbar{width:7px;height:7px}::-webkit-scrollbar-track{background:#313844!important}::-webkit-scrollbar-thumb{background-color:#a5acb9!important;border-radius:3px}::-webkit-scrollbar-thumb:hover{background-color:#0091d1!important}.gjs-pn-views{top:40px}.gjs-pn-views .gjs-pn-btn{width:33.33%;margin-right:0;padding:16px 15px;border-radius:0;background:#3a3f4a;color:#e3e3e3;border-bottom:1px solid #3a3f4a;font-size:16px}.gjs-pn-views .gjs-pn-btn.gjs-pn-active{padding:15px;background-color:#515664;border-bottom-left-radius:unset;border-bottom-right-radius:unset;box-shadow:none;color:#fff;border-bottom:3px solid #0091d1}.gjs-pn-options{right:0}.gjs-pn-views,.gjs-pn-views-container{left:0;box-shadow:none;width:325px;padding-bottom:0;margin-bottom:0;margin-left:0;margin-right:0;padding-left:0;padding-right:0}.gjs-pn-views-container{padding-top:89px;background:#22272e;height:calc(100% - 40px);overflow:hidden}.gjs-pn-views-container>div:first-of-type{margin-top:44px}.gjs-pn-views-container>div{height:100%;overflow-y:auto}.gjs-pn-views-container>div>div{background:#22272e;border:none}.gjs-cv-canvas,.gjs-pn-devices-c{left:325px}.gjs-pn-panel #gjs-sm-caret{padding-right:0!important}.gjs-pn-panel .fa-caret-down{margin-right:5px!important}.gjs-pn-panel .fa-caret-right{margin-right:8px!important}.gjs-three-bg{background-color:#0091d1}.gjs-clm-tags #gjs-clm-close,.gjs-clm-tags #gjs-clm-checkbox{color:#fff}.gjs-field{background-color:#22272e;border-radius:0;padding:2px}.gjs-field input,.gjs-field select,.gjs-field textarea{padding:5px}.gjs-field .gjs-d-s-arrow{border-top:4px solid rgb(100,100,100)}#sidebar-header{position:absolute;box-shadow:none;width:325px;padding-bottom:0;margin-bottom:0;margin-left:0;margin-right:0;padding-left:0;padding-right:0;background:#22272e;height:40px;z-index:100}#sidebar-header #language-selector{float:right}#sidebar-header #language-selector .dropdown-item.active,#sidebar-header #language-selector .dropdown-item:active{background:#22272e!important}#sidebar-header #language-selector .dropdown-menu.show{padding:0}#sidebar-header #language-selector .dropdown-toggle{margin-top:2px;color:#fff!important;background:none!important;border:none;box-shadow:none;outline:none!important}#sidebar-header #language-selector .flag-icon{background-size:contain;background-position:50%;background-repeat:no-repeat;position:relative;display:inline-block;width:1.33333333em;height:12px;line-height:1em}#toggle-sidebar{position:absolute;left:0;top:0;z-index:100;color:#c4c7ce;background:#22272e;border-radius:0;transition-duration:unset}#block-search{position:fixed;background:#22272e;border-color:#3a3f4a;border-radius:0;width:325px;margin-top:-44px}#block-search i.fa-search{position:absolute;top:14px;left:9px;font-size:15px;color:#515664}#block-search input{background:#181b1e;padding:22px 20px 22px 30px;border-radius:0;border:none}#block-search input::-moz-placeholder{color:#515664}#block-search input::placeholder{color:#515664}.gjs-block{border:none;box-shadow:none;padding-bottom:8px;margin:5px;width:calc(50% - 10px)}.gjs-block.fa{padding:8px}.gjs-block:hover{color:#0091d1!important}.gjs-block .block-thumb{height:70px;overflow:hidden;margin-bottom:5px;opacity:.8}.gjs-block .block-thumb img{width:100%}.gjs-blocks-c{background:#22272e;padding:4px}.gjs-block-categories{background:#22272e;padding-bottom:45px}.gjs-block-label{font-size:.8rem;height:100%;display:grid}.gjs-block-label b{display:contents;font-weight:800}.gjs-block-category{background:#5a6371}.gjs-block-category.gjs-open{border-bottom:none!important;margin-bottom:10px}.gjs-blocks-cs{border-bottom:none!important}.gjs-layer .gjs-layer-title{background:#5a6371!important}.gjs-layer.gjs-selected .gjs-layer-title{background-color:#0091d1!important}.gjs-layer.gjs-hovered .gjs-layer-title{background-color:#0091d170!important}.gjs-category-title,.gjs-sm-sector .gjs-sm-title,.gjs-clm-tags .gjs-sm-title,.gjs-block-category .gjs-title,.gjs-layer-title{background:#424853!important;border-bottom:2px solid #363d48!important;letter-spacing:0;font-size:16px;font-weight:400}.gjs-sm-sector.gjs-sm-open .gjs-sm-title,.gjs-clm-tags.gjs-open .gjs-sm-title,.gjs-block-category.gjs-open .gjs-title{background:#545d6c!important}.gjs-layer-name{padding-top:2px;padding-bottom:13px}.gjs-layer-count{display:none}.gjs-layer-vis{padding-top:11px}.gjs-sm-sector.gjs-sm-open{border-bottom:1px solid rgba(0,0,0,.1)}.gjs-trt-trait{display:block}.gjs-trt-header{font-weight:400}.gjs-trt-trait .gjs-label,.gjs-trt-trait .gjs-field{width:100%}.gjs-field-checkbox{height:17px!important;width:17px!important}.gjs-traits-label{font-weight:400;font-size:16px;border-bottom:none}.gjs-sm-sector #gjs-sm-caret,.gjs-clm-tags #gjs-sm-caret{font-size:initial}.gjs-trt-traits .gjs-label-wrp{width:100%}.gjs-trt-traits p.no-settings{padding-top:10px;padding-bottom:10px}.gjs-trt-trait__wrp:first-of-type{padding-top:8px}.gjs-trt-trait__wrp:last-of-type{padding-bottom:8px}.gjs-trt-trait{padding-bottom:10px}.gjs-trt-trait .gjs-field-image{background:none;padding:0}.gjs-trt-trait .gjs-field-image .image__preview-container{text-align:center}.gjs-trt-trait .gjs-field-image .image__preview-container .image__remove-button{position:absolute;right:0;top:0;border-radius:0;background-color:#e9eef2;border-color:#e9eef2;color:#515664;padding:2px 6px}.gjs-trt-trait .gjs-field-image .image__preview-container img{max-width:100%;max-height:150px}#sidebar-bottom-buttons{position:absolute;left:0;bottom:0;height:40px;width:325px;margin:0;padding:0;box-shadow:none;background:#474c57;border-top:none}#sidebar-bottom-buttons button,#sidebar-bottom-buttons a{float:right;height:100%;width:33.33%;border-left:1px solid #343944;border-radius:0;color:#e3e3e3;font-size:15px;padding:8px 0}#sidebar-bottom-buttons button:hover,#sidebar-bottom-buttons a:hover{background:#017eb5;color:#fff}#sidebar-bottom-buttons button:last-child,#sidebar-bottom-buttons a:last-child{border-left:none}#sidebar-bottom-buttons button.waiting{background:#0091d1;color:#fff!important}#sidebar-bottom-buttons button.waiting i.fa{display:none}#sidebar-bottom-buttons #go-back:hover{background:#b03541}#sidebar-bottom-buttons #save-page:hover{background:#419147}.gjs-field{background-color:#22272e}.gjs-field select option{background-color:#fff;color:#000}.gjs-input-unit,.gjs-field-arrows,.gjs-sm-field select.gjs-input-unit{color:#e1e1e1}.gjs-sm-field select.gjs-input-unit option{background-color:#22272e;color:#fff}.gjs-field-arrow-d{border-top:4px solid #e1e1e1}.gjs-field-arrow-u{border-bottom:4px solid #e1e1e1}.gjs-field-radio{padding:0!important}.gjs-radio-item .gjs-radio-item-label{padding-top:10px;margin-bottom:0;padding-bottom:10px;width:100%}.gjs-radio-item input:checked+.gjs-radio-item-label{background-color:#545d6c}.gjs-sm-header,.gjs-trt-header{font-weight:400;color:#8c909d}.gjs-clm-tags{width:100%;padding-top:0;padding-bottom:0}.gjs-clm-tags #gjs-clm-status-c,.gjs-clm-tags #gjs-clm-sel-help{display:none}.gjs-clm-tags #gjs-clm-new{color:#e1e1e1}.gjs-clm-tags #gjs-clm-add-tag{background-color:#0091d1;border:none;box-shadow:1px 1px #fff3 inset;color:#fff}.gjs-clm-tags #gjs-clm-add-tag:hover{background-color:#004a6c}.gjs-sm-sectors .gjs-four-color,.gjs-sm-sectors .gjs-color-warn{color:#e1e1e1}.gjs-sm-sectors .gjs-sm-field.gjs-sm-composite{background-color:#c3e2ec24;border:1px solid rgba(121,147,155,.14)}.gjs-sm-sectors .gjs-sm-layers{background-color:#3a3f4a}.gjs-sm-sectors .gjs-sm-layers .gjs-sm-btn{background:#fff;color:#000;text-shadow:none}.gjs-sm-sectors .gjs-sm-layers .gjs-field{padding:0;background-color:#3a3f4a}.gjs-sm-sectors .gjs-sm-layers .gjs-field select{color:#fff;background:#424853}.gjs-sm-sectors .gjs-sm-stack #gjs-sm-add{color:#fff}.gjs-sm-sectors .gjs-sm-stack #gjs-sm-add:hover{color:#aaa}.gjs-am-assets-header{display:none}.gjs-am-assets-cont{background:none;padding-top:0}.gjs-am-assets{height:325px}.gjs-am-asset{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.gjs-btn-prim{display:inline-block;margin-top:10px;padding:.375rem .75rem;font-weight:400;text-align:center;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:1rem;line-height:1.5;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;color:#fff;border:1px solid #0091d1;background-color:#0091d1}.gjs-am-add-asset button{float:left;width:auto}.gjs-am-add-asset .gjs-am-add-field{width:100%}.gjs-am-file-uploader>form{background-color:#c3e2ec24;border:2px dashed rgb(189,194,200)}.gjs-am-file-uploader #gjs-am-title{color:#7e8793;text-shadow:none}.cke_dialog_body .cke_dialog_ui_vbox_child{padding:0}.cke_dialog_body input.cke_dialog_ui_input_text,.cke_dialog_body input.cke_dialog_ui_input_password,.cke_dialog_body input.cke_dialog_ui_input_tel,.cke_dialog_body textarea.cke_dialog_ui_input_textarea,.cke_dialog_body div.cke_dialog_ui_input_select{margin-bottom:10px}.cke_dialog_body .cke_dialog_ui_input_select{width:100%!important}.sidebar-collapsed .gjs-cv-canvas{width:calc(100% + -0px)}.sidebar-collapsed .gjs-pn-panels{display:none}.sidebar-collapsed .gjs-cv-canvas,.sidebar-collapsed .gjs-pn-devices-c{left:0}.sidebar-collapsed #toggle-sidebar{padding:14px 18px;font-size:18px;box-shadow:2px 3px 10px 2px #0000004d;border-bottom-right-radius:4px}html,body{overflow-x:initial!important}form{-webkit-margin-after:0;margin-block-end:0}[data-cursor=default]{cursor:default}[data-cursor=text]{cursor:text}span[draggable=true]{display:inline-flex}[phpb-hide-if-not-editable]{background:rgba(253,227,193,.4901960784);border:1px dashed rgba(185,142,87,.4901960784);padding:7px;font-size:1.1rem;font-style:italic;font-weight:400;text-align:center;color:#5e5e5e}[phpb-hide-if-not-editable]:not(.editable){display:none}[data-gjs-type].gjs-comp-selected{outline:1px solid #0091d1!important;outline-offset:0!important}div[data-gjs-type].gjs-comp-selected{outline:1px solid #0091d1!important;outline-offset:-1px!important}[phpb-content-container],[phpb-blocks-container]{min-height:50px;width:100%}[phpb-blocks-container]{border:1px dashed #0091d1}html ::-webkit-scrollbar,body ::-webkit-scrollbar{width:11px;height:11px}html ::-webkit-scrollbar-track,body ::-webkit-scrollbar-track{background:#f5f5f5}html ::-webkit-scrollbar-thumb,body ::-webkit-scrollbar-thumb{background-color:#ccc}html ::-webkit-scrollbar-thumb:hover,body ::-webkit-scrollbar-thumb:hover{background-color:#bbb}.gjs-waiting{opacity:.5;pointer-events:none} diff --git a/plugi-core/dist/PageBuilderBody.js b/plugi-core/dist/PageBuilderBody.js index e8959ec..f691c2a 100644 --- a/plugi-core/dist/PageBuilderBody.js +++ b/plugi-core/dist/PageBuilderBody.js @@ -1,1174 +1,2 @@ -$(".gjs-editor").append($("#toggle-sidebar")); -$(".gjs-pn-panels").prepend($("#sidebar-header")); -$(".gjs-pn-panels").append($("#sidebar-bottom-buttons")); -$("#toggle-sidebar").click(function() { - $("#gjs").toggleClass("sidebar-collapsed"); - triggerEditorResize(); -}); -autoCollapseSidebar(); -window.editor.on("run:open-sm", function(editor2) { - $(".gjs-trt-traits").parent().parent().css("display", "none"); - $(".gjs-sm-sectors").parent().parent().css("display", "block"); - $("#gjs-sm-advanced .gjs-sm-properties").append($(".gjs-clm-tags")); -}); -window.editor.on("run:open-tm", function(editor2) { - $(".gjs-sm-sectors").parent().parent().css("display", "none"); - $(".gjs-trt-traits").parent().parent().css("display", "block"); -}); -window.editor.on("block:drag:start", function(block) { - autoCollapseSidebar(); -}); -window.editor.on("rteToolbarPosUpdate", function(toolbarPosition) { - if (!window.editor || !window.editor.getSelected()) - return; - let selectedDomComponent = window.editor.getSelected().getEl(); - if (!selectedDomComponent) - return; - setTimeout(function() { - let $toolbar = $(".gjs-rte-toolbar").first(); - let toolbarInUpperHalf = $toolbar.offset().top < toolbarPosition.elementTop + 0.5 * toolbarPosition.elementHeight; - if (toolbarInUpperHalf) { - let newTop = toolbarPosition.elementTop - $toolbar.height(); - if (newTop > 0) { - $toolbar.css("top", newTop + "px"); - } - } - }, 0); -}); -function autoCollapseSidebar() { - if ($(window).width() < 1e3) { - $("#gjs").addClass("sidebar-collapsed"); - triggerEditorResize(); - } -} -function triggerEditorResize() { - window.editor.trigger("change:canvasOffset canvasScroll"); -} -let backspaceIsPressed = false; -$(document).keydown(function(event) { - if (event.which === 8) - backspaceIsPressed = true; -}).keyup(function(event) { - if (event.which === 8) - backspaceIsPressed = false; -}); -$(window).on("beforeunload", function(event) { - if (backspaceIsPressed) - event.preventDefault(); -}); -function addBlockSearch() { - $(".gjs-blocks-cs").prepend($("#block-search")); -} -window.addEventListener("message", onMessage, false); -function onMessage(event) { - if (event.data === "page-loaded") { - $("#phpb-loading").addClass("loaded"); - addBlockSearch(); - window.isLoaded = true; - $(window).trigger("pagebuilder-page-loaded"); - } else if (event.data === "touch-start") { - window.touchStart(); - } -} -$(document).on("input", "#block-search input", function() { - let term = $(this).val().toLowerCase(); - $(".gjs-block-category").each(function() { - let atLeastOneMatch = false; - $(this).find(".gjs-block").each(function() { - if (!$(this).data("original-html")) { - $(this).data("original-html", $(this).html()); - } - let label = $(this).text(); - if (label.toLowerCase().includes(term)) { - $(this).removeClass("d-none"); - atLeastOneMatch = true; - let regEx = new RegExp("(" + term + ")", "gi"); - let highlightedText = label.replace(regEx, "$1"); - $(this).find(".gjs-block-label").html( - $(this).data("original-html").replace(label.trim(), highlightedText) - ); - } else { - $(this).addClass("d-none"); - } - }); - $(this).removeClass("d-none"); - if (!atLeastOneMatch) { - $(this).addClass("d-none"); - } - }); -}); -window.customBuilderScripts = {}; -window.editor.on("component:create", (component) => { - if (component.components().length) { - let lastChild = component.components().models[component.components().length - 1]; - if (lastChild.attributes.type === "script") { - let blockId = component.attributes.attributes["block-id"]; - if (blockId === void 0) { - blockId = component.attributes.attributes["id"]; - } - let rootComponent = lastChild; - let insideEditablePartOfPage = false; - while (rootComponent.parent()) { - rootComponent = rootComponent.parent(); - if (rootComponent.attributes.attributes["phpb-content-container"]) { - insideEditablePartOfPage = true; - break; - } - } - if (insideEditablePartOfPage) { - window.customBuilderScripts[blockId] = lastChild.toHTML(); - lastChild.remove(); - } - } - } -}); -window.editor.on("component:add", function(component) { - if (component.attributes["run-builder-script"] !== void 0) { - let originalCustomBuilderScripts = customBuilderScripts; - window.customBuilderScripts[component.attributes["block-id"]] = customBuilderScripts[component.attributes["run-builder-script"]]; - runScriptsOfComponentAndChildren(component); - window.customBuilderScripts = originalCustomBuilderScripts; - delete component.attributes["run-builder-script"]; - } -}); -window.editor.on("sorter:drag:end", function(event) { - let component = event.modelToDrop; - if (component && component.attributes && (component.attributes["block-id"] || component.attributes["id"])) { - window.runScriptsOfComponentAndChildren(component); - } - for (let instanceName in CKEDITOR.instances) { - CKEDITOR.instances[instanceName].destroy(true); - } -}); -window.runScriptsOfComponentAndChildren = function(component) { - runComponentScript(component); - component.components().each(function(child) { - runScriptsOfComponentAndChildren(child); - }); -}; -function runComponentScript(component) { - let blockId = component.attributes["block-id"]; - if (blockId === void 0) { - blockId = component.attributes.attributes["id"]; - } - if (blockId && window.customBuilderScripts[blockId] !== void 0) { - let styleIdentifier = component.attributes["style-identifier"]; - let $scriptTag = $("").append(window.customBuilderScripts[blockId]); - $scriptTag.find("script").prepend("let inPageBuilder = true;"); - $scriptTag.find("script").prepend('let blockSelector = ".' + styleIdentifier + '";'); - $scriptTag.find("script").prepend('let block = document.getElementsByClassName("' + styleIdentifier + '")[0];'); - $scriptTag.find("script").prepend("(function(){"); - $scriptTag.find("script").append("})();"); - let scriptTag = document.createElement("script"); - scriptTag.type = "text/javascript"; - scriptTag.innerHTML = $scriptTag.find("script").html(); - window.editor.Canvas.getDocument().body.appendChild(scriptTag); - } -} -function afterGrapesJSLoaded() { - addThemeBlocks(); - let scriptTag = document.createElement("script"); - scriptTag.type = "text/javascript"; - scriptTag.src = window.injectionScriptUrl; - let fullScript = scriptTag.outerHTML + "';\n window.initialComponents = window.initialComponents.replace('', fullScript + '');\n\n $.each(window.languages, (languageCode, languageTranslation) => {\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 $blockHtml = $(\"\").append(block.content);\n $blockHtml.find(\"[phpb-blocks-container]\").each(function() {\n if ($(this).html() !== '' && $(this).html().trim() === '') {\n $(this).html('');\n }\n });\n window.themeBlocks[blockSlug].content = $blockHtml.html();\n block.content = $blockHtml.html();\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 $(\"#language-selector select\").on(\"change\", function() {\n let selectedLanguage = $(this).find(\"option:selected\").val();\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).on('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 let newComponent = component;\n\n // if we encounter a pagebuilder block, replace it with the server-side rendered html\n if (component.get('tagName') === 'phpb-block') {\n let id = component.attributes.attributes.id;\n if (window.pageBlocks[window.currentLanguage][id] !== undefined && window.pageBlocks[window.currentLanguage][id]['html'] !== undefined) {\n newComponent = component.replaceWith(window.pageBlocks[window.currentLanguage][id]['html']);\n window.pageBlocks[window.currentLanguage][id]['html'] = '';\n }\n }\n\n // replace placeholders inside child components\n newComponent.get('components').each(childComponent => replacePlaceholdersForRenderedBlocks(childComponent));\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 $(\".gjs-pn-buttons .gjs-pn-btn:nth-of-type(2)\").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 $(\".gjs-pn-buttons .gjs-pn-btn:nth-of-type(3)\").click();\n if ($(\"#gjs-sm-position\").hasClass(\"gjs-sm-open\")) {\n $(\"#gjs-sm-position\").find(\".gjs-sm-title\").click();\n }\n if (! $(\"#gjs-sm-background\").hasClass(\"gjs-sm-open\")) {\n $(\"#gjs-sm-background\").find(\".gjs-sm-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 $(\".gjs-trt-traits\").html('

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

');\n }, 0);\n }\n\n // only show the toolbar buttons that are applicable\n setTimeout(function() {\n if (! component.attributes.removable) {\n $(\".gjs-toolbar .fa-trash-o.gjs-toolbar-item\").hide();\n }\n if (! component.attributes.copyable) {\n $(\".gjs-toolbar .fa-clone.gjs-toolbar-item\").hide();\n }\n if (! component.attributes.draggable) {\n $(\".gjs-toolbar .fa-arrows.gjs-toolbar-item\").hide();\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) {\n let labelHtml = window.themeBlocks[blockSlug]['label'];\n let labelTextParts = labelHtml.split(\"\");\n if (labelTextParts.length > 1) {\n $(\".gjs-toolbar\").attr('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 blockRootComponent = component.replaceWith({tagName: wrapperElement});\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 blockRootComponent = component.replaceWith(firstChild);\n } else {\n blockRootComponent = component.replaceWith({tagName: 'div'});\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', function(component) {\n if (window.isLoaded !== true ||\n component.attributes['block-slug'] === undefined ||\n component.attributes['is-updating'] ||\n component.changed['attributes'] === undefined ||\n $(\".gjs-frame\").contents().find(\"#\" + component.ccid).length === 0\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 $(\".gjs-frame\").contents().find(\"#\" + component.ccid).addClass('gjs-freezed');\n\n let container = window.editor.getWrapper().find(\"#\" + component.ccid)[0].parent();\n let data = window.getComponentDataInStorageFormat(component);\n // refresh component contents with updated version requested via ajax call\n $.ajax({\n type: \"POST\",\n url: window.renderBlockUrl,\n data: {\n data: JSON.stringify(data),\n language: window.currentLanguage\n },\n success: function(blockHtml) {\n let blockId = $(blockHtml).attr('block-id');\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 },\n error: function() {\n $(\".gjs-frame\").contents().find(\"#\" + component.ccid).removeClass('gjs-freezed');\n component.attributes['is-updating'] = false;\n window.toastr.error(window.translations['toastr-component-update-failed']);\n }\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 newComponent = component.replaceWith(component.toHTML());\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 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 (! $.isEmptyObject(settings)) {\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 $(\"#save-page\").click(function() {\n saveAllTranslationsToServer();\n });\n\n /**\n * Save page on Ctrl + S.\n */\n $(document).bind(\"keydown\", function(e){\n if(e.ctrlKey && 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(function() {\n applyChangesFromCurrentLanguageToNewLanguage(newLanguage);\n\n let data = window.pageData;\n data.blocks = {[newLanguage]: window.pageBlocks[newLanguage]};\n\n // render the language variant server-side\n $.ajax({\n type: \"POST\",\n url: window.renderLanguageVariantUrl,\n data: {\n data: JSON.stringify(data),\n language: newLanguage\n },\n success: function(response) {\n response = JSON.parse(response);\n window.pageBlocks[newLanguage] = response.dynamicBlocks ? response.dynamicBlocks : {};\n callback();\n window.setWaiting(false);\n },\n error: function(error) {\n callback();\n console.log(error);\n let errorMessage = error.statusText + ' ' + error.status;\n errorMessage = error.responseJSON.message ? (errorMessage + ': \"' + error.responseJSON.message + '\"') : errorMessage;\n window.toastr.error(errorMessage);\n window.toastr.error(window.translations['toastr-switching-language-failed']);\n }\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 $currentLanguageBlockHtmlDom = $(\"\" + currentLanguageBlocks[blockId]['html'] + \"\");\n let $newLanguageBlockHtmlDom = $(\"\" + newLanguageBlocks[blockId]['html'] + \"\");\n $currentLanguageBlockHtmlDom.find(\"[phpb-blocks-container]\").each(function(index) {\n let currentLanguageBlockContainerHtml = $(this).html();\n $newLanguageBlockHtmlDom.find(\"[phpb-blocks-container]\").eq(index).html(currentLanguageBlockContainerHtml);\n });\n newLanguageBlocks[blockId]['html'] = $newLanguageBlockHtmlDom.html();\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(function() {\n\n // update all language variants with the latest data of the current language we just saved locally\n $.each(window.languages, (languageCode, languageTranslation) => {\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 $.ajax({\n type: \"POST\",\n url: $(\"#save-page\").data('url'),\n data: {\n data: JSON.stringify(data)\n },\n success: function() {\n toggleSaving();\n window.toastr.success(window.translations['toastr-changes-saved']);\n\n setTimeout(function() {\n window.changesOffset = window.editor.getModel().get('changesCount');\n }, 250);\n },\n error: function(error) {\n toggleSaving();\n console.log(error);\n let errorMessage = error.statusText + ' ' + error.status;\n errorMessage = error.responseJSON.message ? (errorMessage + ': \"' + error.responseJSON.message + '\"') : errorMessage;\n window.toastr.error(errorMessage);\n window.toastr.error(window.translations['toastr-saving-failed']);\n }\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 htmlDom = $(\"\" + html + \"\");\n // replace phpb-block elements with shortcode\n htmlDom.find('phpb-block').each(function() {\n $(this).replaceWith('[block slug=\"' + $(this).attr('slug') + '\" id=\"' + $(this).attr('id') + '\"]');\n });\n return htmlDom.html();\n }\n\n /**\n * Return the html representation of the given component.\n *\n * @param component\n */\n function getComponentHtml(component) {\n let htmlDom = $(\"\" + component.toHTML() + \"\");\n // replace phpb-block elements with shortcode\n htmlDom.find('phpb-block').each(function() {\n $(this).replaceWith('[block slug=\"' + $(this).attr('slug') + '\" id=\"' + $(this).attr('id') + '\"]');\n });\n return htmlDom.html();\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 = $(\"#save-page\");\n button.blur();\n\n if (button.hasClass('waiting')) {\n button.attr(\"disabled\", false);\n button.removeClass('waiting');\n button.find('.spinner-border').addClass('d-none');\n } else {\n button.attr(\"disabled\", true);\n button.addClass('waiting');\n button.find('.spinner-border').removeClass('d-none');\n }\n }\n\n\n","\n\n window.CKEDITOR.on('instanceReady', function (event) {\n event.editor.on('paste', function (event) {\n let result = event.data.dataValue;\n\n // remove all not allowed tags\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|sub|sup|h1|h2|h3|h4|h5|h6|blockquote|pre|hr)\\b)[^>]+>/gm, '');\n\n // remove all attributes of the allowed tags except from anchor\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|sub|sup|h1|h2|h3|h4|h5|h6|blockquote|pre|hr)\\b[^>]*>/gm, function(match, tag) {\n // for anchor tags remove all attributes except href\n if (tag === 'a') {\n let href = match.match(/href=\"([^\"]*)\"/);\n if (! href) {\n return match;\n }\n return '';\n }\n\n // allow styling on some tags\n if ('|table|tr|td|th|thead|tbody|tfoot|'.includes('|' + tag + '|')) {\n let style = match.match(/style=\"([^\"]*)\"/);\n if (! style) {\n return match;\n }\n return '<' + tag + ' style=\"' + style[1] + '\">';\n }\n\n return '<' + tag + '>';\n });\n\n event.data.dataValue = result;\n });\n });\n\n window.CKEDITOR.on('dialogDefinition', function(event) {\n let dialogName = event.data.name;\n let dialogDefinition = event.data.definition;\n if (dialogName === 'link') {\n let infoTab = dialogDefinition.getContents('info');\n\n dialogDefinition.onLoad = function() {\n let dialog = CKEDITOR.dialog.getCurrent();\n dialog.getContentElement('info', 'linkType').getElement().hide();\n dialog.getContentElement('info', 'protocol').getElement().hide();\n dialog.getContentElement('info', 'url').getElement().hide();\n };\n\n infoTab.add({\n type: 'select',\n id: 'linktype-selector',\n label: 'Linktype',\n 'default': '',\n items: [\n [window.translations['page'], \"page\"],\n [\"URL\", \"url\"]\n ],\n onChange: function(obj) {\n let dialog = CKEDITOR.dialog.getCurrent();\n if (obj.data.value === 'page') {\n dialog.getContentElement('info', 'page-selector').getElement().show();\n dialog.getContentElement('info', 'url-field').getElement().hide();\n } else {\n dialog.getContentElement('info', 'page-selector').getElement().hide();\n dialog.getContentElement('info', 'url-field').getElement().show();\n dialog.getContentElement('info', 'url-field').setValue('');\n }\n },\n setup: function(data) {\n if (data.type === undefined) {\n this.setValue('page');\n } else if (data.type === 'url' && data.url.url.startsWith('[page id=')) {\n this.setValue('page');\n } else {\n this.setValue(data.type);\n }\n }\n });\n\n infoTab.add({\n type: 'select',\n id: 'page-selector',\n label: window.translations['page'],\n 'default': '',\n items: window.pages,\n onChange: function() {\n let dialog = CKEDITOR.dialog.getCurrent();\n let page = '[page id=' + this.getValue() + ']';\n dialog.setValueOf('info', 'url', page);\n dialog.setValueOf('info', 'protocol', '');\n },\n setup: function(dialog) {\n this.allowOnChange = false;\n let pageId = '';\n if (dialog.url) {\n pageId = dialog.url.url.substr(9, dialog.url.url.length - 10);\n }\n this.setValue(pageId);\n this.allowOnChange = true;\n }\n });\n\n infoTab.add({\n type: 'text',\n id: 'url-field',\n label: 'URL',\n 'default': '',\n onChange: function() {\n let dialog = CKEDITOR.dialog.getCurrent();\n let url = this.getValue();\n dialog.setValueOf('info', 'url', url);\n },\n setup: function(dialog) {\n this.allowOnChange = false;\n let url = '';\n if (dialog.url) {\n url = dialog.url.url;\n }\n this.setValue(url);\n this.allowOnChange = true;\n }\n });\n }\n });\n\n\n","\n\n window.touchStart = function() {\n $(\"#gjs\").addClass('sidebar-collapsed');\n }\n\n"],"mappings":"C,WAEI,EAAE,aAAa,CAAC,CAAC,OAAO,EAAE,iBAAiB,CAAC,EAC5C,EAAE,gBAAgB,CAAC,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EAChD,EAAE,gBAAgB,CAAC,CAAC,OAAO,EAAE,yBAAyB,CAAC,EAEvD,EAAE,iBAAiB,CAAC,CAAC,MAAM,UAAW,CAClC,EAAE,MAAM,CAAC,CAAC,YAAY,mBAAmB,EACzCE,EAAoB,C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K,EAAS,GACTL,EAAO,MACPK,EAASL,EAAO,IAAI,IAAI,OAAO,EAAGA,EAAO,IAAI,IAAI,OAAS,EAAE,GAEhE,KAAK,SAASK,CAAM,EACpB,KAAK,cAAgB,EACzB,CACJ,CAAC,EAEDN,EAAQ,IAAI,CACR,KAAM,OACN,GAAI,YACJ,MAAO,MACPE,QAAW,GACX,SAAU,UAAW,CACjB,IAAID,EAAS,SAAS,OAAO,WAAW,EACpCM,EAAM,KAAK,SAAS,EACxBN,EAAO,WAAW,OAAQ,MAAOM,CAAG,CACxC,EACA,MAAO,SAASN,EAAQ,CACpB,KAAK,cAAgB,GACrB,IAAIM,EAAM,GACNN,EAAO,MACPM,EAAMN,EAAO,IAAI,KAErB,KAAK,SAASM,CAAG,EACjB,KAAK,cAAgB,EACzB,CACJ,CAAC,CACL,CACJ,CAAC,EC1HD,OAAO,WAAa,UAAW,CAC3B,EAAE,MAAM,CAAC,CAAC,SAAS,mBAAmB,CAC1C,C"} \ No newline at end of file diff --git a/plugi-core/dist/PageBuilderBody.umd.cjs b/plugi-core/dist/PageBuilderBody.umd.cjs deleted file mode 100644 index 5b091c1..0000000 --- a/plugi-core/dist/PageBuilderBody.umd.cjs +++ /dev/null @@ -1 +0,0 @@ -!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";function t(){$(window).width()<1e3&&($("#gjs").addClass("sidebar-collapsed"),e())}function e(){window.editor.trigger("change:canvasOffset canvasScroll")}$(".gjs-editor").append($("#toggle-sidebar")),$(".gjs-pn-panels").prepend($("#sidebar-header")),$(".gjs-pn-panels").append($("#sidebar-bottom-buttons")),$("#toggle-sidebar").click(function(){$("#gjs").toggleClass("sidebar-collapsed"),e()}),t(),window.editor.on("run:open-sm",function(){$(".gjs-trt-traits").parent().parent().css("display","none"),$(".gjs-sm-sectors").parent().parent().css("display","block"),$("#gjs-sm-advanced .gjs-sm-properties").append($(".gjs-clm-tags"))}),window.editor.on("run:open-tm",function(){$(".gjs-sm-sectors").parent().parent().css("display","none"),$(".gjs-trt-traits").parent().parent().css("display","block")}),window.editor.on("block:drag:start",function(){t()}),window.editor.on("rteToolbarPosUpdate",function(t){if(!window.editor||!window.editor.getSelected())return;window.editor.getSelected().getEl()&&setTimeout(function(){let e=$(".gjs-rte-toolbar").first();if(e.offset().top0&&e.css("top",n+"px")}},0)});let n=!1;function i(){!function(){for(let t in window.themeBlocks){let e=window.themeBlocks[t],n=$("").append(e.content);n.find("[phpb-blocks-container]").each(function(){""!==$(this).html()&&""===$(this).html().trim()&&$(this).html("")}),window.themeBlocks[t].content=n.html(),e.content=n.html(),editor.BlockManager.add(t,e)}}();let t=document.createElement("script");t.type="text/javascript",t.src=window.injectionScriptUrl;let e=t.outerHTML+"