Edit file File name : editor-documents.min.js Content :!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}(); Save