@elementor/editor-global-classes 4.0.0-515 → 4.0.0-516

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-global-classes",
3
- "version": "4.0.0-515",
3
+ "version": "4.0.0-516",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,28 +39,28 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "4.0.0-515",
43
- "@elementor/editor-current-user": "4.0.0-515",
44
- "@elementor/editor-documents": "4.0.0-515",
45
- "@elementor/editor-editing-panel": "4.0.0-515",
46
- "@elementor/editor-mcp": "4.0.0-515",
47
- "@elementor/editor-panels": "4.0.0-515",
48
- "@elementor/editor-props": "4.0.0-515",
49
- "@elementor/editor-variables": "4.0.0-515",
50
- "@elementor/editor-styles": "4.0.0-515",
51
- "@elementor/editor-canvas": "4.0.0-515",
52
- "@elementor/editor-styles-repository": "4.0.0-515",
53
- "@elementor/editor-ui": "4.0.0-515",
54
- "@elementor/editor-v1-adapters": "4.0.0-515",
55
- "@elementor/http-client": "4.0.0-515",
42
+ "@elementor/editor": "4.0.0-516",
43
+ "@elementor/editor-current-user": "4.0.0-516",
44
+ "@elementor/editor-documents": "4.0.0-516",
45
+ "@elementor/editor-editing-panel": "4.0.0-516",
46
+ "@elementor/editor-mcp": "4.0.0-516",
47
+ "@elementor/editor-panels": "4.0.0-516",
48
+ "@elementor/editor-props": "4.0.0-516",
49
+ "@elementor/editor-variables": "4.0.0-516",
50
+ "@elementor/editor-styles": "4.0.0-516",
51
+ "@elementor/editor-canvas": "4.0.0-516",
52
+ "@elementor/editor-styles-repository": "4.0.0-516",
53
+ "@elementor/editor-ui": "4.0.0-516",
54
+ "@elementor/editor-v1-adapters": "4.0.0-516",
55
+ "@elementor/http-client": "4.0.0-516",
56
56
  "@elementor/icons": "^1.63.0",
57
- "@elementor/query": "4.0.0-515",
58
- "@elementor/schema": "4.0.0-515",
59
- "@elementor/store": "4.0.0-515",
57
+ "@elementor/query": "4.0.0-516",
58
+ "@elementor/schema": "4.0.0-516",
59
+ "@elementor/store": "4.0.0-516",
60
60
  "@elementor/ui": "1.36.17",
61
- "@elementor/utils": "4.0.0-515",
61
+ "@elementor/utils": "4.0.0-516",
62
62
  "@wordpress/i18n": "^5.13.0",
63
- "@elementor/mixpanel": "4.0.0-515"
63
+ "@elementor/mixpanel": "4.0.0-516"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "react": "^18.3.1",
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useEffect } from 'react';
3
- import { setDocumentModifiedStatus } from '@elementor/editor-documents';
3
+ import { getCurrentDocument, getV1DocumentsManager, setDocumentModifiedStatus } from '@elementor/editor-documents';
4
4
  import {
5
5
  __createPanel as createPanel,
6
6
  Panel,
@@ -10,7 +10,7 @@ import {
10
10
  PanelHeaderTitle,
11
11
  } from '@elementor/editor-panels';
12
12
  import { SaveChangesDialog, ThemeProvider, useDialog } from '@elementor/editor-ui';
13
- import { changeEditMode } from '@elementor/editor-v1-adapters';
13
+ import { __privateRunCommand as runCommand, changeEditMode } from '@elementor/editor-v1-adapters';
14
14
  import { XIcon } from '@elementor/icons';
15
15
  import { useMutation } from '@elementor/query';
16
16
  import { __dispatch as dispatch } from '@elementor/store';
@@ -45,6 +45,19 @@ import { blockPanelInteractions, unblockPanelInteractions } from './panel-intera
45
45
 
46
46
  const id = 'global-classes-manager';
47
47
 
48
+ const reloadDocument = () => {
49
+ const currentDocument = getCurrentDocument();
50
+ const documentsManager = getV1DocumentsManager();
51
+
52
+ documentsManager.invalidateCache();
53
+
54
+ return runCommand( 'editor/documents/switch', {
55
+ id: currentDocument?.id,
56
+ shouldScroll: false,
57
+ shouldNavigateToDefaultRoute: false,
58
+ } );
59
+ };
60
+
48
61
  // We need to disable the app-bar buttons, and the elements overlays when opening the classes manager panel.
49
62
  // The buttons and overlays are enabled only in edit mode, so we're creating a custom new edit mode that
50
63
  // will force them to be disabled. We can't use the `preview` edit mode in this case since it'll force
@@ -58,9 +71,9 @@ export const { panel, usePanelActions } = createPanel( {
58
71
 
59
72
  blockPanelInteractions();
60
73
  },
61
- onClose: () => {
74
+ onClose: async () => {
62
75
  changeEditMode( 'edit' );
63
-
76
+ await reloadDocument();
64
77
  unblockPanelInteractions();
65
78
  },
66
79
  isOpenPreviousElement: true,
@@ -1,5 +1,3 @@
1
- import { getCurrentDocument, getV1DocumentsManager } from '@elementor/editor-documents';
2
- import { __privateRunCommand as runCommand } from '@elementor/editor-v1-adapters';
3
1
  import { __dispatch as dispatch } from '@elementor/store';
4
2
 
5
3
  import { slice } from '../../store';
@@ -19,24 +17,7 @@ export const deleteClass = ( id: string ) => {
19
17
  };
20
18
 
21
19
  export const onDelete = async () => {
22
- await reloadDocument();
23
-
24
20
  isDeleted = false;
25
21
  };
26
22
 
27
23
  export const hasDeletedItems = () => isDeleted;
28
-
29
- // When deleting a class, we remove it from all the documents that have it applied.
30
- // In order to reflect the changes in the active document, we need to reload it.
31
- const reloadDocument = () => {
32
- const currentDocument = getCurrentDocument();
33
- const documentsManager = getV1DocumentsManager();
34
-
35
- documentsManager.invalidateCache();
36
-
37
- return runCommand( 'editor/documents/switch', {
38
- id: currentDocument?.id,
39
- shouldScroll: false,
40
- shouldNavigateToDefaultRoute: false,
41
- } );
42
- };