芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/elementor/assets/js/packages/documents.min.js
!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 u},useActiveDocumentActions:function(){return m},useHostDocument:function(){return f}});var n=__UNSTABLE__elementorPackages.store;function i(){const t=window.elementor?.documents;if(!t)throw new Error("Elementor Editor V1 documents manager not found");return t}function a(t){const e=t.config.revisions.current_id!==t.id;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},isDirty:t.editor.isChanged||e,isSaving:t.editor.isSaving,isSavingDraft:!1,userCan:{publish:t.config.user.can_publish}}}var s=__UNSTABLE__elementorPackages.v1Adapters;function o(t){return!(!t.activeId||!t.entities[t.activeId])}const c=t=>t.documents.entities,r=(0,n.createSelector)(c,(t=>t.documents.activeId),((t,e)=>e&&t[e]?t[e]:null)),d=(0,n.createSelector)(c,(t=>t.documents.hostId),((t,e)=>e&&t[e]?t[e]:null));function u(){return(0,n.useSelector)(r)}var l,v=React;function m(){return{save:(0,v.useCallback)((()=>(0,s.runCommand)("document/save/default")),[]),saveDraft:(0,v.useCallback)((()=>(0,s.runCommand)("document/save/draft")),[]),saveTemplate:(0,v.useCallback)((()=>(0,s.openRoute)("library/save-template")),[])}}function f(){return(0,n.useSelector)(d)}(function(t){const{init:e}=t.actions;(0,s.listenTo)((0,s.v1ReadyEvent)(),(()=>{const t=i(),s=Object.entries(t.documents).reduce(((t,[e,n])=>(t[e]=a(n),t)),{});(0,n.dispatch)(e({entities:s,hostId:t.getInitialId(),activeId:t.getCurrentId()}))}))})(l=(0,n.addSlice)({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},startSaving(t){o(t)&&(t.entities[t.activeId].isSaving=!0)},endSaving(t,e){o(t)&&(t.entities[t.activeId]={...e.payload,isSaving:!1})},startSavingDraft:t=>{o(t)&&(t.entities[t.activeId].isSavingDraft=!0)},endSavingDraft(t,e){o(t)&&(t.entities[t.activeId]={...e.payload,isSavingDraft:!1})},markAsDirty(t){o(t)&&(t.entities[t.activeId].isDirty=!0)},markAsPristine(t){o(t)&&(t.entities[t.activeId].isDirty=!1)}}})),function(t){const{activateDocument:e}=t.actions;(0,s.listenTo)((0,s.commandEndEvent)("editor/documents/open"),(()=>{const t=a(i().getCurrent());(0,n.dispatch)(e(t))}))}(l),function(t){const{startSaving:e,endSaving:o,startSavingDraft:c,endSavingDraft:r}=t.actions,d=t=>{const e=t;return"autosave"===e.args?.status};(0,s.listenTo)((0,s.commandStartEvent)("document/save/save"),(t=>{d(t)?(0,n.dispatch)(c()):(0,n.dispatch)(e())})),(0,s.listenTo)((0,s.commandEndEvent)("document/save/save"),(t=>{const e=a(i().getCurrent());d(t)?(0,n.dispatch)(r(e)):(0,n.dispatch)(o(e))}))}(l),function(t){const{markAsDirty:e,markAsPristine:a}=t.actions;(0,s.listenTo)((0,s.commandEndEvent)("document/save/set-is-modified"),(()=>{i().getCurrent().editor.isChanged?(0,n.dispatch)(e()):(0,n.dispatch)(a())}))}(l),(window.__UNSTABLE__elementorPackages=window.__UNSTABLE__elementorPackages||{}).documents=e}();