PluginProbe
Elementor Website Builder – more than just a page builder / 3.26.2
Elementor Website Builder – more than just a page builder v3.26.2
4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 All 455 releases
← All changes | assets/js/packages/editor-documents/editor-documents.min.js +1 -1 4.3.0 → 3.26.2 View file →
@@ -1 +1 @@
1 -(function(){var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),__copyProps=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},__toESM=(n,r,a)=>(a=n==null?{}:e(i(n)),__copyProps(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),o=__toESM(__commonJSMin(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},__copyProps=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},__toCommonJS=e=>__copyProps(n({},`__esModule`,{value:!0}),e),o={};__export(o,{COMPONENT_DOCUMENT_TYPE:()=>O,__useActiveDocument:()=>useActiveDocument,__useActiveDocumentActions:()=>useActiveDocumentActions,__useHostDocument:()=>useHostDocument,__useNavigateToDocument:()=>useNavigateToDocument,__useOpenDocumentInNewTab:()=>useOpenDocumentInNewTab,getCurrentDocument:()=>getCurrentDocument,getV1CurrentDocument:()=>getV1CurrentDocument,getV1DocumentsManager:()=>getV1DocumentsManager,init:()=>init,invalidateDocumentData:()=>invalidateDocumentData,isDocumentDirty:()=>isDocumentDirty,reloadCurrentDocument:()=>reloadCurrentDocument,setDocumentModifiedStatus:()=>setDocumentModifiedStatus,slice:()=>v,switchToDocument:()=>switchToDocument}),t.exports=__toCommonJS(o);var s=globalThis.elementorV2.editor,c=globalThis.elementorV2.store,l=globalThis.React,u=globalThis.wp.i18n,d=globalThis.elementorV2.store,f=globalThis.elementorV2.store,selectEntities=e=>e.documents.entities,selectActiveId=e=>e.documents.activeId,selectHostId=e=>e.documents.hostId,p=(0,f.__createSelector)(selectEntities,selectActiveId,(e,t)=>t&&e[t]?e[t]:null),m=(0,f.__createSelector)(selectEntities,selectHostId,(e,t)=>t&&e[t]?e[t]:null);function useActiveDocument(){return(0,d.__useSelector)(p)}var h=globalThis.elementorV2.store;function useHostDocument(){return(0,h.__useSelector)(m)}function useSyncDocumentTitle(){let e=useActiveDocument(),t=useHostDocument(),n=e&&e.type.value!==`kit`?e:t;(0,l.useEffect)(()=>{if(n?.title===void 0)return;let e=(0,u.__)(`Edit "%s" with Elementor`,`elementor`).replace(`%s`,n.title);window.document.title=e},[n?.title])}function LogicHooks(){return useSyncDocumentTitle(),null}var g=globalThis.elementorV2.store,_={entities:{},activeId:null,hostId:null};function hasActiveEntity(e){return!!(e.activeId&&e.entities[e.activeId])}var v=(0,g.__createSlice)({name:`documents`,initialState:_,reducers:{init(e,{payload:t}){e.entities=t.entities,e.hostId=t.hostId,e.activeId=t.activeId},activateDocument(e,t){e.entities[t.payload.id]=t.payload,e.activeId=t.payload.id},setAsHost(e,t){e.hostId=t.payload},updateActiveDocument(e,t){hasActiveEntity(e)&&(e.entities[e.activeId]={...e.entities[e.activeId],...t.payload})},startSaving(e){hasActiveEntity(e)&&(e.entities[e.activeId].isSaving=!0)},endSaving(e,t){hasActiveEntity(e)&&(e.entities[e.activeId]={...t.payload,isSaving:!1})},startSavingDraft:e=>{hasActiveEntity(e)&&(e.entities[e.activeId].isSavingDraft=!0)},endSavingDraft(e,t){hasActiveEntity(e)&&(e.entities[e.activeId]={...t.payload,isSavingDraft:!1})},markAsDirty(e){hasActiveEntity(e)&&(e.entities[e.activeId].isDirty=!0)},markAsPristine(e){hasActiveEntity(e)&&(e.entities[e.activeId].isDirty=!1)}}}),y=globalThis.elementorV2.editorV1Adapters,b=globalThis.elementorV2.store,x=globalThis.elementorV2.utils,S=globalThis.elementorV2.editorV1Adapters,C=globalThis.elementorV2.store;function getCurrentDocument(){return p((0,C.__getState)())}function getV1DocumentsManager(){let e=window.elementor?.documents;if(!e)throw Error(`Elementor Editor V1 documents manager not found`);return e}function getV1DocumentsExitTo(e){switch(window.elementor?.getPreferences?.(`exit_to`)||`this_post`){case`dashboard`:return e.config.urls.main_dashboard;case`all_posts`:return e.config.urls.all_post_type;default:return e.config.urls.exit_to_dashboard}}function getV1DocumentShowCopyAndShare(e){return e?.config?.panel?.show_copy_and_share??!1}function getV1DocumentPermalink(e){return e.config.urls.permalink??``}function getV1DocumentWpPreview(e){return e.config.urls.wp_preview??``}function normalizeV1Document(e){let t=e.config.revisions.current_id!==e.id,n=getV1DocumentsExitTo(e);return{id:e.id,title:e.container.settings.get(`post_title`),type:{value:e.config.type,label:e.config.panel.title},status:{value:e.config.status.value,label:e.config.status.label},links:{permalink:getV1DocumentPermalink(e),wpPreview:getV1DocumentWpPreview(e),platformEdit:n},isDirty:e.editor.isChanged||t,isSaving:e.editor.isSaving,isSavingDraft:!1,permissions:{allowAddingWidgets:e.config.panel?.allow_adding_widgets??!0,showCopyAndShare:getV1DocumentShowCopyAndShare(e)},userCan:{publish:e.config.user.can_publish}}}function setDocumentModifiedStatus(e){(0,S.__privateRunCommandSync)(`document/save/set-is-modified`,{status:e},{internal:!0})}function getV1CurrentDocument(){return window.elementor?.documents?.getCurrent()}function isDocumentDirty(e){let t=e.status.value===`draft`,n=e.revisions?.current_id!==e.id;return t||n}function invalidateDocumentData(e){getV1DocumentsManager().invalidateCache(e)}function reloadCurrentDocument(){let e=getCurrentDocument();return e?.id?(getV1DocumentsManager().invalidateCache(),(0,S.__privateRunCommand)(`editor/documents/switch`,{id:e.id,shouldScroll:!1,shouldNavigateToDefaultRoute:!1})):Promise.resolve()}function switchToDocument(e,t){return(0,S.__privateRunCommand)(`editor/documents/switch`,{id:e,...t})}function syncStore(){syncInitialization(),syncActiveDocument(),syncOnDocumentSave(),syncOnTitleChange(),syncOnDocumentChange(),syncOnExitToChange()}function syncInitialization(){let{init:e}=v.actions;(0,y.__privateListenTo)((0,y.v1ReadyEvent)(),()=>{let t=getV1DocumentsManager(),n=Object.entries(t.documents).reduce((e,[t,n])=>(e[t]=normalizeV1Document(n),e),{});(0,b.__dispatch)(e({entities:n,hostId:t.getInitialId(),activeId:t.getCurrentId()}))})}function syncActiveDocument(){let{activateDocument:e,setAsHost:t}=v.actions;(0,y.__privateListenTo)((0,y.commandEndEvent)(`editor/documents/open`),()=>{let n=getV1DocumentsManager(),r=normalizeV1Document(n.getCurrent());(0,b.__dispatch)(e(r)),n.getInitialId()===r.id&&(0,b.__dispatch)(t(r.id))})}function syncOnDocumentSave(){let{startSaving:e,endSaving:t,startSavingDraft:n,endSavingDraft:r}=v.actions,isDraft=e=>e.args?.status===`autosave`;(0,y.__privateListenTo)((0,y.commandStartEvent)(`document/save/save`),t=>{if(isDraft(t)){(0,b.__dispatch)(n());return}(0,b.__dispatch)(e())}),(0,y.__privateListenTo)((0,y.commandEndEvent)(`document/save/save`),e=>{let n=normalizeV1Document(getV1DocumentsManager().getCurrent());isDraft(e)?(0,b.__dispatch)(r(n)):(0,b.__dispatch)(t(n))})}function syncOnTitleChange(){let{updateActiveDocument:e}=v.actions,t=(0,x.debounce)(t=>{if(!(`post_title`in t.args?.settings))return;let n=getV1DocumentsManager().getCurrent().container.settings.get(`post_title`);(0,b.__dispatch)(e({title:n}))},400);(0,y.__privateListenTo)((0,y.commandEndEvent)(`document/elements/settings`),t)}function syncOnExitToChange(){let{updateActiveDocument:e}=v.actions,t=(0,x.debounce)(t=>{if(!(`exit_to`in t.args?.settings))return;let n=getV1DocumentsManager().getCurrent(),r=getV1DocumentsExitTo(n),i=getV1DocumentPermalink(n),a=getV1DocumentWpPreview(n);(0,b.__dispatch)(e({links:{platformEdit:r,permalink:i,wpPreview:a}}))},400);(0,y.__privateListenTo)((0,y.commandEndEvent)(`document/elements/settings`),t)}function syncOnDocumentChange(){let{markAsDirty:e,markAsPristine:t}=v.actions;(0,y.__privateListenTo)((0,y.commandEndEvent)(`document/save/set-is-modified`),()=>{if(!p((0,b.__getState)())?.isSaving){if(getV1DocumentsManager().getCurrent().editor.isChanged){(0,b.__dispatch)(e());return}(0,b.__dispatch)(t())}})}function init(){initStore(),(0,s.injectIntoLogic)({id:`documents-hooks`,component:LogicHooks})}function initStore(){(0,c.__registerSlice)(v),syncStore()}var w=globalThis.React,T=globalThis.elementorV2.editorV1Adapters;function useActiveDocumentActions(){let e=useActiveDocument()?.links?.permalink??``;return{save:(0,w.useCallback)(()=>(0,T.__privateRunCommand)(`document/save/default`),[]),saveDraft:(0,w.useCallback)(()=>(0,T.__privateRunCommand)(`document/save/draft`),[]),saveTemplate:(0,w.useCallback)(()=>(0,T.__privateOpenRoute)(`library/save-template`),[]),copyAndShare:(0,w.useCallback)(()=>{navigator.clipboard.writeText(e)},[e])}}var E=globalThis.React,getUpdateUrl=e=>{let t=new URL(window.location.href);return t.searchParams.set(`post`,e.toString()),t.searchParams.delete(`active-document`),t};function useNavigateToDocument(){return(0,E.useCallback)(async e=>{let t=getUpdateUrl(e);await switchToDocument(e,{setAsInitial:!0}),history.replaceState({},``,t)},[])}var D=globalThis.React;function useOpenDocumentInNewTab(){return(0,D.useCallback)(e=>{let t=getUpdateUrl(e);window.open(t.href)},[])}var O=`elementor_component`;0&&(t.exports={COMPONENT_DOCUMENT_TYPE:O,__useActiveDocument,__useActiveDocumentActions,__useHostDocument,__useNavigateToDocument,__useOpenDocumentInNewTab,getCurrentDocument,getV1CurrentDocument,getV1DocumentsManager,init,invalidateDocumentData,isDocumentDirty,reloadCurrentDocument,setDocumentModifiedStatus,slice:v,switchToDocument})}))());(window.elementorV2=window.elementorV2||{}).editorDocuments=o})(),window.elementorV2.editorDocuments?.init?.();
1 +!function(){"use strict";var t={d:function(e,n){for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r:function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{__useActiveDocument:function(){return w},__useActiveDocumentActions:function(){return y},__useHostDocument:function(){return h},__useNavigateToDocument:function(){return S},slice:function(){return c}});var n=window.elementorV2.store,i=window.elementorV2.editorV1Adapters,o=window.elementorV2.editor,a=window.React,s=window.wp.i18n;function r(t){return!(!t.activeId||!t.entities[t.activeId])}var c=(0,n.__createSlice)({name:"documents",initialState:{entities:{},activeId:null,hostId:null},reducers:{init(t,{payload:e}){t.entities=e.entities,t.hostId=e.hostId,t.activeId=e.activeId},activateDocument(t,e){t.entities[e.payload.id]=e.payload,t.activeId=e.payload.id},setAsHost(t,e){t.hostId=e.payload},updateActiveDocument(t,e){r(t)&&(t.entities[t.activeId]={...t.entities[t.activeId],...e.payload})},startSaving(t){r(t)&&(t.entities[t.activeId].isSaving=!0)},endSaving(t,e){r(t)&&(t.entities[t.activeId]={...e.payload,isSaving:!1})},startSavingDraft:t=>{r(t)&&(t.entities[t.activeId].isSavingDraft=!0)},endSavingDraft(t,e){r(t)&&(t.entities[t.activeId]={...e.payload,isSavingDraft:!1})},markAsDirty(t){r(t)&&(t.entities[t.activeId].isDirty=!0)},markAsPristine(t){r(t)&&(t.entities[t.activeId].isDirty=!1)}}});function d(){const t=window.elementor?.documents;if(!t)throw new Error("Elementor Editor V1 documents manager not found");return t}function u(t){switch(window.elementor?.getPreferences?.("exit_to")||"this_post"){case"dashboard":return t.config.urls.main_dashboard;case"all_posts":return t.config.urls.all_post_type;default:return t.config.urls.exit_to_dashboard}}function l(t){return t?.config?.panel?.show_copy_and_share??!1}function _(t){return t.config.urls.permalink??""}function m(t){const e=t.config.revisions.current_id!==t.id,n=u(t);return{id:t.id,title:t.container.settings.get("post_title"),type:{value:t.config.type,label:t.config.panel.title},status:{value:t.config.status.value,label:t.config.status.label},links:{permalink:_(t),platformEdit:n},isDirty:t.editor.isChanged||e,isSaving:t.editor.isSaving,isSavingDraft:!1,permissions:{allowAddingWidgets:t.config.panel?.allow_adding_widgets??!0,showCopyAndShare:l(t)},userCan:{publish:t.config.user.can_publish}}}function v(t,e){let n;return(...i)=>{clearTimeout(n),n=setTimeout((()=>{t(...i)}),e)}}var p=t=>t.documents.entities,f=(0,n.__createSelector)(p,(t=>t.documents.activeId),((t,e)=>e&&t[e]?t[e]:null)),g=(0,n.__createSelector)(p,(t=>t.documents.hostId),((t,e)=>e&&t[e]?t[e]:null));function h(){return(0,n.__useSelector)(g)}function w(){return(0,n.__useSelector)(f)}function y(){const t=w(),e=t?.links?.permalink??"";return{save:(0,a.useCallback)((()=>(0,i.__privateRunCommand)("document/save/default")),[]),saveDraft:(0,a.useCallback)((()=>(0,i.__privateRunCommand)("document/save/draft")),[]),saveTemplate:(0,a.useCallback)((()=>(0,i.__privateOpenRoute)("library/save-template")),[]),copyAndShare:(0,a.useCallback)((()=>{navigator.clipboard.writeText(e)}),[e])}}function S(){return(0,a.useCallback)((async t=>{await(0,i.__privateRunCommand)("editor/documents/switch",{id:t,setAsInitial:!0});const e=new URL(window.location.href);e.searchParams.set("post",t.toString()),e.searchParams.delete("active-document"),history.replaceState({},"",e)}),[])}(0,n.__registerSlice)(c),function(){const{init:t}=c.actions;(0,i.__privateListenTo)((0,i.v1ReadyEvent)(),(()=>{const e=d(),i=Object.entries(e.documents).reduce(((t,[e,n])=>(t[e]=m(n),t)),{});(0,n.__dispatch)(t({entities:i,hostId:e.getInitialId(),activeId:e.getCurrentId()}))}))}(),function(){const{activateDocument:t,setAsHost:e}=c.actions;(0,i.__privateListenTo)((0,i.commandEndEvent)("editor/documents/open"),(()=>{const i=d(),o=m(i.getCurrent());(0,n.__dispatch)(t(o)),i.getInitialId()===o.id&&(0,n.__dispatch)(e(o.id))}))}(),function(){const{startSaving:t,endSaving:e,startSavingDraft:o,endSavingDraft:a}=c.actions,s=t=>{const e=t;return"autosave"===e.args?.status};(0,i.__privateListenTo)((0,i.commandStartEvent)("document/save/save"),(e=>{s(e)?(0,n.__dispatch)(o()):(0,n.__dispatch)(t())})),(0,i.__privateListenTo)((0,i.commandEndEvent)("document/save/save"),(t=>{const i=m(d().getCurrent());s(t)?(0,n.__dispatch)(a(i)):(0,n.__dispatch)(e(i))}))}(),function(){const{updateActiveDocument:t}=c.actions,e=v((e=>{const i=e;if(!("post_title"in i.args?.settings))return;const o=d().getCurrent().container.settings.get("post_title");(0,n.__dispatch)(t({title:o}))}),400);(0,i.__privateListenTo)((0,i.commandEndEvent)("document/elements/settings"),e)}(),function(){const{markAsDirty:t,markAsPristine:e}=c.actions;(0,i.__privateListenTo)((0,i.commandEndEvent)("document/save/set-is-modified"),(()=>{d().getCurrent().editor.isChanged?(0,n.__dispatch)(t()):(0,n.__dispatch)(e())}))}(),function(){const{updateActiveDocument:t}=c.actions,e=v((e=>{const i=e;if(!("exit_to"in i.args?.settings))return;const o=d().getCurrent(),a=u(o),s=_(o);(0,n.__dispatch)(t({links:{platformEdit:a,permalink:s}}))}),400);(0,i.__privateListenTo)((0,i.commandEndEvent)("document/elements/settings"),e)}(),(0,o.injectIntoLogic)({id:"documents-hooks",component:function(){return function(){const t=w(),e=h(),n=t&&"kit"!==t.type.value?t:e;(0,a.useEffect)((()=>{if(void 0===n?.title)return;const t=(0,s.__)('Edit "%s" with Elementor',"elementor").replace("%s",n.title);window.document.title=t}),[n?.title])}(),null}}),(window.elementorV2=window.elementorV2||{}).editorDocuments=e}();