PluginProbe
Elementor Website Builder – more than just a page builder / 3.25.2
Elementor Website Builder – more than just a page builder v3.25.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.js +2 -389 4.3.0 → 3.25.2 View file →
@@ -1,389 +1,2 @@
1 -(function(_elementor_editor, _elementor_store, react, _wordpress_i18n, _elementor_editor_v1_adapters, _elementor_utils) {
2 -
3 -//#region \0rolldown/runtime.js
4 - var __defProp = Object.defineProperty;
5 - var __name = (target, value) => __defProp(target, "name", {
6 - value,
7 - configurable: true
8 - });
9 - var __exportAll = (all, no_symbols) => {
10 - let target = {};
11 - for (var name in all) {
12 - __defProp(target, name, {
13 - get: all[name],
14 - enumerable: true
15 - });
16 - }
17 - if (!no_symbols) {
18 - __defProp(target, Symbol.toStringTag, { value: "Module" });
19 - }
20 - return target;
21 - };
22 -
23 -//#endregion
24 -
25 -//#region packages/packages/core/editor-documents/src/store/selectors.ts
26 - var selectEntities = (state) => state.documents.entities;
27 - var selectActiveId = (state) => state.documents.activeId;
28 - var selectHostId = (state) => state.documents.hostId;
29 - var selectActiveDocument = (0, _elementor_store.__createSelector)(selectEntities, selectActiveId, (entities, activeId) => activeId && entities[activeId] ? entities[activeId] : null);
30 - var selectHostDocument = (0, _elementor_store.__createSelector)(selectEntities, selectHostId, (entities, hostId) => hostId && entities[hostId] ? entities[hostId] : null);
31 -
32 -//#endregion
33 -//#region packages/packages/core/editor-documents/src/hooks/use-active-document.ts
34 - function useActiveDocument() {
35 - return (0, _elementor_store.__useSelector)(selectActiveDocument);
36 - }
37 -
38 -//#endregion
39 -//#region packages/packages/core/editor-documents/src/hooks/use-host-document.ts
40 - function useHostDocument() {
41 - return (0, _elementor_store.__useSelector)(selectHostDocument);
42 - }
43 -
44 -//#endregion
45 -//#region packages/packages/core/editor-documents/src/hooks/use-sync-document-title.ts
46 - function useSyncDocumentTitle() {
47 - const activeDocument = useActiveDocument();
48 - const hostDocument = useHostDocument();
49 - const document = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument;
50 - (0, react.useEffect)(() => {
51 - if (document?.title === void 0) return;
52 - const title = (0, _wordpress_i18n.__)("Edit \"%s\" with Elementor", "elementor").replace("%s", document.title);
53 - window.document.title = title;
54 - }, [document?.title]);
55 - }
56 -
57 -//#endregion
58 -//#region packages/packages/core/editor-documents/src/components/logic-hooks.tsx
59 - function LogicHooks() {
60 - useSyncDocumentTitle();
61 - return null;
62 - }
63 -
64 -//#endregion
65 -//#region packages/packages/core/editor-documents/src/store/index.ts
66 - var initialState = {
67 - entities: {},
68 - activeId: null,
69 - hostId: null
70 - };
71 - function hasActiveEntity(state) {
72 - return !!(state.activeId && state.entities[state.activeId]);
73 - }
74 - var slice = (0, _elementor_store.__createSlice)({
75 - name: "documents",
76 - initialState,
77 - reducers: {
78 - init(state, { payload }) {
79 - state.entities = payload.entities;
80 - state.hostId = payload.hostId;
81 - state.activeId = payload.activeId;
82 - },
83 - activateDocument(state, action) {
84 - state.entities[action.payload.id] = action.payload;
85 - state.activeId = action.payload.id;
86 - },
87 - setAsHost(state, action) {
88 - state.hostId = action.payload;
89 - },
90 - updateActiveDocument(state, action) {
91 - if (hasActiveEntity(state)) state.entities[state.activeId] = {
92 - ...state.entities[state.activeId],
93 - ...action.payload
94 - };
95 - },
96 - startSaving(state) {
97 - if (hasActiveEntity(state)) state.entities[state.activeId].isSaving = true;
98 - },
99 - endSaving(state, action) {
100 - if (hasActiveEntity(state)) state.entities[state.activeId] = {
101 - ...action.payload,
102 - isSaving: false
103 - };
104 - },
105 - startSavingDraft: (state) => {
106 - if (hasActiveEntity(state)) state.entities[state.activeId].isSavingDraft = true;
107 - },
108 - endSavingDraft(state, action) {
109 - if (hasActiveEntity(state)) state.entities[state.activeId] = {
110 - ...action.payload,
111 - isSavingDraft: false
112 - };
113 - },
114 - markAsDirty(state) {
115 - if (hasActiveEntity(state)) state.entities[state.activeId].isDirty = true;
116 - },
117 - markAsPristine(state) {
118 - if (hasActiveEntity(state)) state.entities[state.activeId].isDirty = false;
119 - }
120 - }
121 - });
122 -
123 -//#endregion
124 -//#region packages/packages/core/editor-documents/src/store/get-current-document.ts
125 - function getCurrentDocument() {
126 - return selectActiveDocument((0, _elementor_store.__getState)());
127 - }
128 -
129 -//#endregion
130 -//#region packages/packages/core/editor-documents/src/sync/utils.ts
131 - function getV1DocumentsManager() {
132 - const documentsManager = window.elementor?.documents;
133 - if (!documentsManager) throw new Error("Elementor Editor V1 documents manager not found");
134 - return documentsManager;
135 - }
136 - function getV1DocumentsExitTo(documentData) {
137 - switch (window.elementor?.getPreferences?.("exit_to") || "this_post") {
138 - case "dashboard": return documentData.config.urls.main_dashboard;
139 - case "all_posts": return documentData.config.urls.all_post_type;
140 - default: return documentData.config.urls.exit_to_dashboard;
141 - }
142 - }
143 - function getV1DocumentShowCopyAndShare(documentData) {
144 - return documentData?.config?.panel?.show_copy_and_share ?? false;
145 - }
146 - function getV1DocumentPermalink(documentData) {
147 - return documentData.config.urls.permalink ?? "";
148 - }
149 - function getV1DocumentWpPreview(documentData) {
150 - return documentData.config.urls.wp_preview ?? "";
151 - }
152 - function normalizeV1Document(documentData) {
153 - const isUnpublishedRevision = documentData.config.revisions.current_id !== documentData.id;
154 - const exitToUrl = getV1DocumentsExitTo(documentData);
155 - return {
156 - id: documentData.id,
157 - title: documentData.container.settings.get("post_title"),
158 - type: {
159 - value: documentData.config.type,
160 - label: documentData.config.panel.title
161 - },
162 - status: {
163 - value: documentData.config.status.value,
164 - label: documentData.config.status.label
165 - },
166 - links: {
167 - permalink: getV1DocumentPermalink(documentData),
168 - wpPreview: getV1DocumentWpPreview(documentData),
169 - platformEdit: exitToUrl
170 - },
171 - isDirty: documentData.editor.isChanged || isUnpublishedRevision,
172 - isSaving: documentData.editor.isSaving,
173 - isSavingDraft: false,
174 - permissions: {
175 - allowAddingWidgets: documentData.config.panel?.allow_adding_widgets ?? true,
176 - showCopyAndShare: getV1DocumentShowCopyAndShare(documentData)
177 - },
178 - userCan: { publish: documentData.config.user.can_publish }
179 - };
180 - }
181 - function setDocumentModifiedStatus(status) {
182 - (0, _elementor_editor_v1_adapters.__privateRunCommandSync)("document/save/set-is-modified", { status }, { internal: true });
183 - }
184 - function getV1CurrentDocument() {
185 - return window.elementor?.documents?.getCurrent();
186 - }
187 - function isDocumentDirty(document) {
188 - const isDraft = document.status.value === "draft";
189 - const hasAutosave = document.revisions?.current_id !== document.id;
190 - return isDraft || hasAutosave;
191 - }
192 - function invalidateDocumentData(documentId) {
193 - getV1DocumentsManager().invalidateCache(documentId);
194 - }
195 - function reloadCurrentDocument() {
196 - const currentDocument = getCurrentDocument();
197 - if (!currentDocument?.id) return Promise.resolve();
198 - getV1DocumentsManager().invalidateCache();
199 - return (0, _elementor_editor_v1_adapters.__privateRunCommand)("editor/documents/switch", {
200 - id: currentDocument.id,
201 - shouldScroll: false,
202 - shouldNavigateToDefaultRoute: false
203 - });
204 - }
205 - function switchToDocument(documentId, options) {
206 - return (0, _elementor_editor_v1_adapters.__privateRunCommand)("editor/documents/switch", {
207 - id: documentId,
208 - ...options
209 - });
210 - }
211 -
212 -//#endregion
213 -//#region packages/packages/core/editor-documents/src/sync/sync-store.ts
214 - function syncStore() {
215 - syncInitialization();
216 - syncActiveDocument();
217 - syncOnDocumentSave();
218 - syncOnTitleChange();
219 - syncOnDocumentChange();
220 - syncOnExitToChange();
221 - }
222 - function syncInitialization() {
223 - const { init } = slice.actions;
224 - (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.v1ReadyEvent)(), () => {
225 - const documentsManager = getV1DocumentsManager();
226 - const entities = Object.entries(documentsManager.documents).reduce((acc, [id, document]) => {
227 - acc[id] = normalizeV1Document(document);
228 - return acc;
229 - }, {});
230 - (0, _elementor_store.__dispatch)(init({
231 - entities,
232 - hostId: documentsManager.getInitialId(),
233 - activeId: documentsManager.getCurrentId()
234 - }));
235 - });
236 - }
237 - function syncActiveDocument() {
238 - const { activateDocument, setAsHost } = slice.actions;
239 - (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.commandEndEvent)("editor/documents/open"), () => {
240 - const documentsManager = getV1DocumentsManager();
241 - const currentDocument = normalizeV1Document(documentsManager.getCurrent());
242 - (0, _elementor_store.__dispatch)(activateDocument(currentDocument));
243 - if (documentsManager.getInitialId() === currentDocument.id) (0, _elementor_store.__dispatch)(setAsHost(currentDocument.id));
244 - });
245 - }
246 - function syncOnDocumentSave() {
247 - const { startSaving, endSaving, startSavingDraft, endSavingDraft } = slice.actions;
248 - const isDraft = (e) => {
249 - return e.args?.status === "autosave";
250 - };
251 - (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.commandStartEvent)("document/save/save"), (e) => {
252 - if (isDraft(e)) {
253 - (0, _elementor_store.__dispatch)(startSavingDraft());
254 - return;
255 - }
256 - (0, _elementor_store.__dispatch)(startSaving());
257 - });
258 - (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.commandEndEvent)("document/save/save"), (e) => {
259 - const activeDocument = normalizeV1Document(getV1DocumentsManager().getCurrent());
260 - if (isDraft(e)) (0, _elementor_store.__dispatch)(endSavingDraft(activeDocument));
261 - else (0, _elementor_store.__dispatch)(endSaving(activeDocument));
262 - });
263 - }
264 - function syncOnTitleChange() {
265 - const { updateActiveDocument } = slice.actions;
266 - const updateTitle = (0, _elementor_utils.debounce)((e) => {
267 - if (!("post_title" in e.args?.settings)) return;
268 - const newTitle = getV1DocumentsManager().getCurrent().container.settings.get("post_title");
269 - (0, _elementor_store.__dispatch)(updateActiveDocument({ title: newTitle }));
270 - }, 400);
271 - (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.commandEndEvent)("document/elements/settings"), updateTitle);
272 - }
273 - function syncOnExitToChange() {
274 - const { updateActiveDocument } = slice.actions;
275 - const updateExitTo = (0, _elementor_utils.debounce)((e) => {
276 - if (!("exit_to" in e.args?.settings)) return;
277 - const currentDocument = getV1DocumentsManager().getCurrent();
278 - const newExitTo = getV1DocumentsExitTo(currentDocument);
279 - const permalink = getV1DocumentPermalink(currentDocument);
280 - const wpPreview = getV1DocumentWpPreview(currentDocument);
281 - (0, _elementor_store.__dispatch)(updateActiveDocument({ links: {
282 - platformEdit: newExitTo,
283 - permalink,
284 - wpPreview
285 - } }));
286 - }, 400);
287 - (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.commandEndEvent)("document/elements/settings"), updateExitTo);
288 - }
289 - function syncOnDocumentChange() {
290 - const { markAsDirty, markAsPristine } = slice.actions;
291 - (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.commandEndEvent)("document/save/set-is-modified"), () => {
292 - if (selectActiveDocument((0, _elementor_store.__getState)())?.isSaving) return;
293 - if (getV1DocumentsManager().getCurrent().editor.isChanged) {
294 - (0, _elementor_store.__dispatch)(markAsDirty());
295 - return;
296 - }
297 - (0, _elementor_store.__dispatch)(markAsPristine());
298 - });
299 - }
300 -
301 -//#endregion
302 -//#region packages/packages/core/editor-documents/src/init.ts
303 - function init() {
304 - initStore();
305 - (0, _elementor_editor.injectIntoLogic)({
306 - id: "documents-hooks",
307 - component: LogicHooks
308 - });
309 - }
310 - function initStore() {
311 - (0, _elementor_store.__registerSlice)(slice);
312 - syncStore();
313 - }
314 -
315 -//#endregion
316 -//#region packages/packages/core/editor-documents/src/hooks/use-active-document-actions.ts
317 - function useActiveDocumentActions() {
318 - const permalink = useActiveDocument()?.links?.permalink ?? "";
319 - return {
320 - save: (0, react.useCallback)(() => (0, _elementor_editor_v1_adapters.__privateRunCommand)("document/save/default"), []),
321 - saveDraft: (0, react.useCallback)(() => (0, _elementor_editor_v1_adapters.__privateRunCommand)("document/save/draft"), []),
322 - saveTemplate: (0, react.useCallback)(() => (0, _elementor_editor_v1_adapters.__privateOpenRoute)("library/save-template"), []),
323 - copyAndShare: (0, react.useCallback)(() => {
324 - navigator.clipboard.writeText(permalink);
325 - }, [permalink])
326 - };
327 - }
328 -
329 -//#endregion
330 -//#region packages/packages/core/editor-documents/src/hooks/utils.ts
331 - var getUpdateUrl = (id) => {
332 - const url = new URL(window.location.href);
333 - url.searchParams.set("post", id.toString());
334 - url.searchParams.delete("active-document");
335 - return url;
336 - };
337 -
338 -//#endregion
339 -//#region packages/packages/core/editor-documents/src/hooks/use-navigate-to-document.ts
340 - function useNavigateToDocument() {
341 - return (0, react.useCallback)(async (id) => {
342 - const url = getUpdateUrl(id);
343 - await switchToDocument(id, { setAsInitial: true });
344 - history.replaceState({}, "", url);
345 - }, []);
346 - }
347 -
348 -//#endregion
349 -//#region packages/packages/core/editor-documents/src/hooks/use-open-document-in-new-tab.ts
350 - function useOpenDocumentInNewTab() {
351 - return (0, react.useCallback)((id) => {
352 - const url = getUpdateUrl(id);
353 - window.open(url.href);
354 - }, []);
355 - }
356 -
357 -//#endregion
358 -//#region packages/packages/core/editor-documents/src/consts.ts
359 - var COMPONENT_DOCUMENT_TYPE = "elementor_component";
360 -
361 -//#endregion
362 -//#region packages/packages/core/editor-documents/src/index.ts
363 - var src_exports = /* @__PURE__ */ __exportAll({
364 - COMPONENT_DOCUMENT_TYPE: () => COMPONENT_DOCUMENT_TYPE,
365 - __useActiveDocument: () => useActiveDocument,
366 - __useActiveDocumentActions: () => useActiveDocumentActions,
367 - __useHostDocument: () => useHostDocument,
368 - __useNavigateToDocument: () => useNavigateToDocument,
369 - __useOpenDocumentInNewTab: () => useOpenDocumentInNewTab,
370 - getCurrentDocument: () => getCurrentDocument,
371 - getV1CurrentDocument: () => getV1CurrentDocument,
372 - getV1DocumentsManager: () => getV1DocumentsManager,
373 - init: () => init,
374 - invalidateDocumentData: () => invalidateDocumentData,
375 - isDocumentDirty: () => isDocumentDirty,
376 - reloadCurrentDocument: () => reloadCurrentDocument,
377 - setDocumentModifiedStatus: () => setDocumentModifiedStatus,
378 - slice: () => slice,
379 - switchToDocument: () => switchToDocument
380 - });
381 -
382 -//#endregion
383 -//#region \0elementor-package-library-entry
384 - (window.elementorV2 = window.elementorV2 || {}).editorDocuments = src_exports;
385 -
386 -//#endregion
387 -})(elementorV2.editor, elementorV2.store, React, wp.i18n, elementorV2.editorV1Adapters, elementorV2.utils);
388 -window.elementorV2.editorDocuments?.init?.();
389 -//# sourceMappingURL=editor-documents.js.map
1 +/*! For license information please see editor-documents.js.LICENSE.txt */
2 +!function(){"use strict";var t={react:function(t){t.exports=window.React},"@elementor/editor":function(t){t.exports=window.elementorV2.editor},"@elementor/editor-v1-adapters":function(t){t.exports=window.elementorV2.editorV1Adapters},"@elementor/store":function(t){t.exports=window.elementorV2.store},"@wordpress/i18n":function(t){t.exports=window.wp.i18n}},e={};function n(i){var o=e[i];if(void 0!==o)return o.exports;var a=e[i]={exports:{}};return t[i](a,a.exports,n),a.exports}n.d=function(t,e){for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};!function(){n.r(i),n.d(i,{__useActiveDocument:function(){return w},__useActiveDocumentActions:function(){return y},__useHostDocument:function(){return h},__useNavigateToDocument:function(){return S},slice:function(){return c}});var t=n("@elementor/store"),e=n("@elementor/editor-v1-adapters"),o=n("@elementor/editor"),a=n("react"),r=n("@wordpress/i18n");function s(t){return!(!t.activeId||!t.entities[t.activeId])}var c=(0,t.__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){s(t)&&(t.entities[t.activeId]={...t.entities[t.activeId],...e.payload})},startSaving(t){s(t)&&(t.entities[t.activeId].isSaving=!0)},endSaving(t,e){s(t)&&(t.entities[t.activeId]={...e.payload,isSaving:!1})},startSavingDraft:t=>{s(t)&&(t.entities[t.activeId].isSavingDraft=!0)},endSavingDraft(t,e){s(t)&&(t.entities[t.activeId]={...e.payload,isSavingDraft:!1})},markAsDirty(t){s(t)&&(t.entities[t.activeId].isDirty=!0)},markAsPristine(t){s(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 m(t){return t.config.urls.permalink??""}function v(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:m(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 p(t,e){let n;return(...i)=>{clearTimeout(n),n=setTimeout((()=>{t(...i)}),e)}}var _=t=>t.documents.entities,f=(0,t.__createSelector)(_,(t=>t.documents.activeId),((t,e)=>e&&t[e]?t[e]:null)),g=(0,t.__createSelector)(_,(t=>t.documents.hostId),((t,e)=>e&&t[e]?t[e]:null));function h(){return(0,t.__useSelector)(g)}function w(){return(0,t.__useSelector)(f)}function y(){const t=w(),n=t?.links?.permalink??"";return{save:(0,a.useCallback)((()=>(0,e.__privateRunCommand)("document/save/default")),[]),saveDraft:(0,a.useCallback)((()=>(0,e.__privateRunCommand)("document/save/draft")),[]),saveTemplate:(0,a.useCallback)((()=>(0,e.__privateOpenRoute)("library/save-template")),[]),copyAndShare:(0,a.useCallback)((()=>{navigator.clipboard.writeText(n)}),[n])}}function S(){return(0,a.useCallback)((async t=>{await(0,e.__privateRunCommand)("editor/documents/switch",{id:t,setAsInitial:!0});const n=new URL(window.location.href);n.searchParams.set("post",t.toString()),n.searchParams.delete("active-document"),history.replaceState({},"",n)}),[])}(0,t.__registerSlice)(c),function(){const{init:n}=c.actions;(0,e.__privateListenTo)((0,e.v1ReadyEvent)(),(()=>{const e=d(),i=Object.entries(e.documents).reduce(((t,[e,n])=>(t[e]=v(n),t)),{});(0,t.__dispatch)(n({entities:i,hostId:e.getInitialId(),activeId:e.getCurrentId()}))}))}(),function(){const{activateDocument:n,setAsHost:i}=c.actions;(0,e.__privateListenTo)((0,e.commandEndEvent)("editor/documents/open"),(()=>{const e=d(),o=v(e.getCurrent());(0,t.__dispatch)(n(o)),e.getInitialId()===o.id&&(0,t.__dispatch)(i(o.id))}))}(),function(){const{startSaving:n,endSaving:i,startSavingDraft:o,endSavingDraft:a}=c.actions,r=t=>{const e=t;return"autosave"===e.args?.status};(0,e.__privateListenTo)((0,e.commandStartEvent)("document/save/save"),(e=>{r(e)?(0,t.__dispatch)(o()):(0,t.__dispatch)(n())})),(0,e.__privateListenTo)((0,e.commandEndEvent)("document/save/save"),(e=>{const n=v(d().getCurrent());r(e)?(0,t.__dispatch)(a(n)):(0,t.__dispatch)(i(n))}))}(),function(){const{updateActiveDocument:n}=c.actions,i=p((e=>{const i=e;if(!("post_title"in i.args?.settings))return;const o=d().getCurrent().container.settings.get("post_title");(0,t.__dispatch)(n({title:o}))}),400);(0,e.__privateListenTo)((0,e.commandEndEvent)("document/elements/settings"),i)}(),function(){const{markAsDirty:n,markAsPristine:i}=c.actions;(0,e.__privateListenTo)((0,e.commandEndEvent)("document/save/set-is-modified"),(()=>{d().getCurrent().editor.isChanged?(0,t.__dispatch)(n()):(0,t.__dispatch)(i())}))}(),function(){const{updateActiveDocument:n}=c.actions,i=p((e=>{const i=e;if(!("exit_to"in i.args?.settings))return;const o=d().getCurrent(),a=u(o),r=m(o);(0,t.__dispatch)(n({links:{platformEdit:a,permalink:r}}))}),400);(0,e.__privateListenTo)((0,e.commandEndEvent)("document/elements/settings"),i)}(),(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,r.__)('Edit "%s" with Elementor',"elementor").replace("%s",n.title);window.document.title=t}),[n?.title])}(),null}})}(),(window.elementorV2=window.elementorV2||{}).editorDocuments=i}();