Version 5.0.0 beta 11.1
This commit is contained in:
1 parent
264eeb97e0
commit
90e8c7e903
466 files changed
+7796
-2394
No files matched your search
@@ -46,14 +46,14 @@ let basePages=Math.ceil(Math.abs(children[children.length-1].getBoundingClientRe
|
||||
return basePages;},setupObserver(){if(this._observer){this._observer.disconnect();}
|
||||
if(this.getCarousel()instanceof HTMLElement){this._observer=new ResizeObserver(_.debounce(()=>this.updateCarouselIndicator()));this._observer.observe(this.getCarousel());}}});}(jQuery,_));;
|
||||
;(function($,_){"use strict";let pageLoadTime;setTimeout(()=>pageLoadTime=Date.now());let state='unloaded';const whenLoadedCallbacks=[];function whenLoaded(){return new Promise(resolve=>{if(state==='loaded'){resolve();return;}
|
||||
whenLoadedCallbacks.push(resolve);if(state==='unloaded'){ips.loader.get(['core/front/controllers/widgets/ips.widgets.block.js']).then(async()=>{if(!window.ips.utils.pagebuilder){const url=ips.getSetting('baseURL')+`/applications/core/interface/pagebuilder/manifest.json?v=${ips.getSetting('pagebuilderKey')}`
|
||||
whenLoadedCallbacks.push(resolve);if(state==='unloaded'){ips.loader.get(['core/front/controllers/widgets/ips.widgets.block.js']).then(async()=>{if(!window.ips.utils.pagebuilder){const url=ips.getSetting('baseURL')+`/applications/core/interface/static/pagebuilder/manifest.json?v=${ips.getSetting('pagebuilderKey')}&antiCache=${encodeURIComponent(ips.getSetting('jsAntiCache'))}`
|
||||
const data=await ips.fetch(url)
|
||||
const toLoad=[];for(const key in data){if(data[key].file?.match(/\.css$/i)){const href=ips.getSetting('baseURL')+'/applications/core/interface/pagebuilder/'+data[key].file
|
||||
const toLoad=[];for(const key in data){if(data[key].file?.match(/\.css$/i)){const href=ips.getSetting('baseURL')+'/applications/core/interface/static/pagebuilder/'+data[key].file+`?antiCache=${encodeURIComponent(ips.getSetting('jsAntiCache'))}`
|
||||
if(!document.querySelector(`[href="${encodeURI(href)}"]`)){const style=document.createElement('link')
|
||||
style.rel='stylesheet'
|
||||
style.href=href
|
||||
document.head.appendChild(style)}}else if(data[key].isEntry){toLoad.push(ips.getSetting('baseURL')+'/applications/core/interface/pagebuilder/'+data[key].file)}}
|
||||
if(toLoad.length){await ips.loader.get(toLoad)}}
|
||||
document.head.appendChild(style)}}else if(data[key].isEntry){toLoad.push('/applications/core/interface/static/pagebuilder/'+data[key].file)}}
|
||||
if(toLoad.length){await ips.loader.getStatic(toLoad)}}
|
||||
state='loaded';while(whenLoadedCallbacks.length){whenLoadedCallbacks.shift()();}})
|
||||
state='loading';}})}
|
||||
ips.controller.register('core.front.widgets.manager',{_loadedManager:false,_loadingManager:false,_inManagingState:false,_wasUnused:false,initialize(){this.on('click','[data-action="openSidebar"]',this.openSidebarManager);this.on('click','[data-action="closeSidebar"]',this.closeSidebarManager);this._wasUnused=!!document.querySelector('.ipsLayout__secondary-column.ipsLayout__secondary-column--hide')||this._wasUnused;whenLoaded().then(()=>{if(ips.utils.url.getParam('_blockManager')){this.openSidebarManager();}});window.addEventListener('historychange',_.debounce((e)=>{if(ips.utils.history.getLastChangeType()!=='pagebuilder'&&e.detail?.type!=='pop'){return;}
|
||||
@@ -73,7 +73,7 @@ this.scope.addClass('cWidgetsManaging');},closeSidebarManager(e){e?.preventDefau
|
||||
if(ips.utils.url.getParam('_blockManager')){if(ips.utils.history.getState('pagebuilder').artificial){window.history.back()}
|
||||
setTimeout(()=>ips.utils.history.replaceState({},'pagebuilder',window.location.href.replace(/\?(.*?)&?_blockManager=[^&]*/,'?$1').replace(/[?&]+$/,'')))}}},_setUpDragging(){this.elem.querySelectorAll('[data-role="availableBlocks"] ul').forEach(list=>{list.style.zIndex=ips.ui.zIndex();list.querySelectorAll(':scope > .cSidebarManager_block').forEach(item=>this._setupDraggingOnItem(item));})},_setupDraggingOnItem(item){item.setAttribute('draggable','true');const wrapBehavior=item.dataset.widgetLayouts?.split(',')?.[0]?.trim()||'table'
|
||||
item.addEventListener('dragstart',function(e){e.stopPropagation();e.dataTransfer.clearData();const data={blockID:e.target.dataset.blockid,blockTitle:e.target.dataset.blocktitle,allowReuse:e.target.dataset.allowreuse,config:!!e.target.dataset.blockconfig,blank:e.target.dataset.blockerrormessage,menustyle:e.target.dataset.menustyle,ipsWrapBehavior:wrapBehavior,};e.dataTransfer.setData('application/x.ipsblock',JSON.stringify(data));ipsSettings.__pageeditor_last_dragged_widget_data__=data;item.addEventListener('dragend',e=>{delete ipsSettings.__pageeditor_last_dragged_widget_data__;},{once:true});})},async _showManager(){this.scope.find('#elSidebarManager').removeAttr('hidden');this._fadeUnmanagedRoots();if(!this._loadedManager&&!this._loadingManager){try{const response=await ips.fetch(ips.getSetting('baseURL')+'index.php?app=core&module=system&controller=widgets&do=getBlockList',{data:{pageApp:$('body').attr('data-pageApp')}})
|
||||
this._loadedManager=true;this.scope.find('[data-role="availableBlocks"]').html(response);this._setUpDragging();this.setupSearch();this.setupFavorites();try{$(document).trigger('contentChange',[$('#elSidebarManager')]);}catch(e){Debug.error(e);}
|
||||
this._loadedManager=true;this.scope.find('[data-role="availableBlocks"]').html(response);this.scope.find('[data-role="availableBlocks"]').attr("data-unloaded",null);this._setUpDragging();this.setupSearch();this.setupFavorites();try{$(document).trigger('contentChange',[$('#elSidebarManager')]);}catch(e){Debug.error(e);}
|
||||
document.dispatchEvent(new CustomEvent('ipsWidgetManagerLoaded',{bubbles:true,cancelable:true}))}catch(e){Debug.error(e)
|
||||
ips.ui.alert.show({type:'alert',icon:'warn',message:ips.getString('sidebar_fetch_blocks_error'),callbacks:{}});}
|
||||
this.scope.find('[data-role="availableBlocks"]').removeClass('ipsLoading ipsLoading_dark');this._loadingManager=false;}else{this._setUpDragging();this.setupSearch();this.setupFavorites();}
|
||||
|
||||
Reference in new issue
Block a user