@elementor/editor-components 4.0.0-634 → 4.0.0-635
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/dist/index.d.mts +1516 -1
- package/dist/index.d.ts +1516 -1
- package/dist/index.js +372 -232
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +280 -210
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/extended/components/create-component-form/create-component-form.tsx +2 -3
- package/src/extended/init.ts +5 -1
- package/src/extended/store/actions/add-overridable-group.ts +14 -20
- package/src/extended/store/actions/archive-component.ts +2 -3
- package/src/extended/store/actions/create-unpublished-component.ts +9 -12
- package/src/extended/store/actions/delete-overridable-group.ts +7 -13
- package/src/extended/store/actions/delete-overridable-prop.ts +9 -15
- package/src/extended/store/actions/rename-component.ts +2 -3
- package/src/extended/store/actions/rename-overridable-group.ts +7 -13
- package/src/extended/store/actions/reorder-group-props.ts +14 -20
- package/src/extended/store/actions/reorder-overridable-groups.ts +10 -16
- package/src/extended/store/actions/reset-sanitized-components.ts +2 -4
- package/src/extended/store/actions/set-overridable-prop.ts +5 -13
- package/src/extended/store/actions/update-component-sanitized-attribute.ts +3 -4
- package/src/extended/store/actions/update-current-component.ts +5 -14
- package/src/extended/store/actions/update-overridable-prop-params.ts +11 -17
- package/src/extended/sync/cleanup-overridable-props-on-delete.ts +3 -10
- package/src/extended/sync/create-components-before-save.ts +12 -14
- package/src/extended/sync/set-component-overridable-props-settings-before-save.ts +2 -3
- package/src/extended/sync/update-archived-component-before-save.ts +2 -3
- package/src/extended/sync/update-component-title-before-save.ts +4 -5
- package/src/extended/utils/component-name-validation.ts +2 -4
- package/src/extended/utils/is-editing-component.ts +2 -10
- package/src/index.ts +120 -0
- package/src/store/actions/update-overridable-prop.ts +4 -10
- package/src/store/dispatchers.ts +63 -0
- package/src/store/selectors.ts +49 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-components",
|
|
3
3
|
"description": "Elementor editor components",
|
|
4
|
-
"version": "4.0.0-
|
|
4
|
+
"version": "4.0.0-635",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,31 +40,31 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor": "4.0.0-
|
|
44
|
-
"@elementor/editor-canvas": "4.0.0-
|
|
45
|
-
"@elementor/editor-controls": "4.0.0-
|
|
46
|
-
"@elementor/editor-documents": "4.0.0-
|
|
47
|
-
"@elementor/editor-editing-panel": "4.0.0-
|
|
48
|
-
"@elementor/editor-elements": "4.0.0-
|
|
49
|
-
"@elementor/editor-elements-panel": "4.0.0-
|
|
50
|
-
"@elementor/editor-mcp": "4.0.0-
|
|
51
|
-
"@elementor/editor-templates": "4.0.0-
|
|
52
|
-
"@elementor/editor-panels": "4.0.0-
|
|
53
|
-
"@elementor/editor-props": "4.0.0-
|
|
54
|
-
"@elementor/editor-styles-repository": "4.0.0-
|
|
55
|
-
"@elementor/editor-ui": "4.0.0-
|
|
56
|
-
"@elementor/editor-v1-adapters": "4.0.0-
|
|
57
|
-
"@elementor/http-client": "4.0.0-
|
|
43
|
+
"@elementor/editor": "4.0.0-635",
|
|
44
|
+
"@elementor/editor-canvas": "4.0.0-635",
|
|
45
|
+
"@elementor/editor-controls": "4.0.0-635",
|
|
46
|
+
"@elementor/editor-documents": "4.0.0-635",
|
|
47
|
+
"@elementor/editor-editing-panel": "4.0.0-635",
|
|
48
|
+
"@elementor/editor-elements": "4.0.0-635",
|
|
49
|
+
"@elementor/editor-elements-panel": "4.0.0-635",
|
|
50
|
+
"@elementor/editor-mcp": "4.0.0-635",
|
|
51
|
+
"@elementor/editor-templates": "4.0.0-635",
|
|
52
|
+
"@elementor/editor-panels": "4.0.0-635",
|
|
53
|
+
"@elementor/editor-props": "4.0.0-635",
|
|
54
|
+
"@elementor/editor-styles-repository": "4.0.0-635",
|
|
55
|
+
"@elementor/editor-ui": "4.0.0-635",
|
|
56
|
+
"@elementor/editor-v1-adapters": "4.0.0-635",
|
|
57
|
+
"@elementor/http-client": "4.0.0-635",
|
|
58
58
|
"@elementor/icons": "^1.68.0",
|
|
59
|
-
"@elementor/events": "4.0.0-
|
|
60
|
-
"@elementor/query": "4.0.0-
|
|
61
|
-
"@elementor/schema": "4.0.0-
|
|
62
|
-
"@elementor/store": "4.0.0-
|
|
59
|
+
"@elementor/events": "4.0.0-635",
|
|
60
|
+
"@elementor/query": "4.0.0-635",
|
|
61
|
+
"@elementor/schema": "4.0.0-635",
|
|
62
|
+
"@elementor/store": "4.0.0-635",
|
|
63
63
|
"@elementor/ui": "1.36.17",
|
|
64
|
-
"@elementor/utils": "4.0.0-
|
|
64
|
+
"@elementor/utils": "4.0.0-635",
|
|
65
65
|
"@wordpress/i18n": "^5.13.0",
|
|
66
|
-
"@elementor/editor-notifications": "4.0.0-
|
|
67
|
-
"@elementor/editor-current-user": "4.0.0-
|
|
66
|
+
"@elementor/editor-notifications": "4.0.0-635",
|
|
67
|
+
"@elementor/editor-current-user": "4.0.0-635"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react": "^18.3.1",
|
|
@@ -4,12 +4,11 @@ import { getElementLabel, type V1ElementData } from '@elementor/editor-elements'
|
|
|
4
4
|
import { type NotificationData, notify } from '@elementor/editor-notifications';
|
|
5
5
|
import { Form as FormElement, ThemeProvider, useTextFieldAutoSelect } from '@elementor/editor-ui';
|
|
6
6
|
import { ComponentsIcon } from '@elementor/icons';
|
|
7
|
-
import { __getState as getState } from '@elementor/store';
|
|
8
7
|
import { Button, FormLabel, Grid, Popover, Stack, TextField, Typography } from '@elementor/ui';
|
|
9
8
|
import { __ } from '@wordpress/i18n';
|
|
10
9
|
|
|
11
10
|
import { useComponents } from '../../../hooks/use-components';
|
|
12
|
-
import {
|
|
11
|
+
import { componentsSelectors } from '../../../store/selectors';
|
|
13
12
|
import { type ComponentFormValues, type PublishedComponent } from '../../../types';
|
|
14
13
|
import { switchToComponent } from '../../../utils/switch-to-component';
|
|
15
14
|
import { trackComponentEvent } from '../../../utils/tracking';
|
|
@@ -84,7 +83,7 @@ export function CreateComponentForm() {
|
|
|
84
83
|
source: 'user',
|
|
85
84
|
} );
|
|
86
85
|
|
|
87
|
-
const publishedComponentId = (
|
|
86
|
+
const publishedComponentId = ( componentsSelectors.getComponentByUid( uid ) as PublishedComponent )?.id;
|
|
88
87
|
|
|
89
88
|
if ( publishedComponentId ) {
|
|
90
89
|
switchToComponent( publishedComponentId, instanceId );
|
package/src/extended/init.ts
CHANGED
|
@@ -32,9 +32,12 @@ import { initNonAtomicNestingPrevention } from './sync/prevent-non-atomic-nestin
|
|
|
32
32
|
import { initRevertOverridablesOnCopyOrDuplicate } from './sync/revert-overridables-on-copy-or-duplicate';
|
|
33
33
|
import { SanitizeOverridableProps } from './sync/sanitize-overridable-props';
|
|
34
34
|
|
|
35
|
+
const PRIORITY = 1;
|
|
36
|
+
|
|
35
37
|
export function initExtended() {
|
|
36
38
|
registerEditingPanelReplacement( {
|
|
37
|
-
id: 'component-instance-edit-panel',
|
|
39
|
+
id: 'extended-component-instance-edit-panel',
|
|
40
|
+
priority: PRIORITY,
|
|
38
41
|
condition: ( _, elementType ) => elementType.key === 'e-component',
|
|
39
42
|
component: ExtendedInstanceEditingPanel,
|
|
40
43
|
} );
|
|
@@ -43,6 +46,7 @@ export function initExtended() {
|
|
|
43
46
|
id: 'components',
|
|
44
47
|
label: __( 'Components', 'elementor' ),
|
|
45
48
|
component: ExtendedComponents,
|
|
49
|
+
priority: PRIORITY,
|
|
46
50
|
} );
|
|
47
51
|
|
|
48
52
|
registerPanel( componentPropertiesPanel );
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { selectCurrentComponent, selectOverridableProps, slice } from '../../../store/store';
|
|
1
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
2
|
+
import { componentsSelectors } from '../../../store/selectors';
|
|
4
3
|
import { type ComponentId, type OverridablePropsGroup } from '../../../types';
|
|
5
4
|
import { type Source, trackComponentEvent } from '../../../utils/tracking';
|
|
6
5
|
|
|
@@ -17,9 +16,9 @@ export function addOverridableGroup( {
|
|
|
17
16
|
label,
|
|
18
17
|
source,
|
|
19
18
|
}: AddGroupParams ): OverridablePropsGroup | undefined {
|
|
20
|
-
const currentComponent =
|
|
19
|
+
const currentComponent = componentsSelectors.getCurrentComponent();
|
|
21
20
|
|
|
22
|
-
const overridableProps =
|
|
21
|
+
const overridableProps = componentsSelectors.getOverridableProps( componentId );
|
|
23
22
|
|
|
24
23
|
if ( ! overridableProps ) {
|
|
25
24
|
return;
|
|
@@ -31,22 +30,17 @@ export function addOverridableGroup( {
|
|
|
31
30
|
props: [],
|
|
32
31
|
};
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
overridableProps
|
|
38
|
-
|
|
39
|
-
groups
|
|
40
|
-
|
|
41
|
-
items: {
|
|
42
|
-
...overridableProps.groups.items,
|
|
43
|
-
[ groupId ]: newGroup,
|
|
44
|
-
},
|
|
45
|
-
order: [ groupId, ...overridableProps.groups.order ],
|
|
46
|
-
},
|
|
33
|
+
componentsActions.setOverridableProps( componentId, {
|
|
34
|
+
...overridableProps,
|
|
35
|
+
groups: {
|
|
36
|
+
...overridableProps.groups,
|
|
37
|
+
items: {
|
|
38
|
+
...overridableProps.groups.items,
|
|
39
|
+
[ groupId ]: newGroup,
|
|
47
40
|
},
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
order: [ groupId, ...overridableProps.groups.order ],
|
|
42
|
+
},
|
|
43
|
+
} );
|
|
50
44
|
|
|
51
45
|
trackComponentEvent( {
|
|
52
46
|
action: 'propertiesGroupCreated',
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { setDocumentModifiedStatus } from '@elementor/editor-documents';
|
|
2
2
|
import { type NotificationData, notify } from '@elementor/editor-notifications';
|
|
3
|
-
import { __dispatch as dispatch } from '@elementor/store';
|
|
4
3
|
import { __ } from '@wordpress/i18n';
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
7
6
|
|
|
8
7
|
const successNotification = ( componentId: number, componentName: string ): NotificationData => ( {
|
|
9
8
|
type: 'success',
|
|
@@ -13,7 +12,7 @@ const successNotification = ( componentId: number, componentName: string ): Noti
|
|
|
13
12
|
} );
|
|
14
13
|
|
|
15
14
|
export const archiveComponent = ( componentId: number, componentName: string ) => {
|
|
16
|
-
|
|
15
|
+
componentsActions.archive( componentId );
|
|
17
16
|
setDocumentModifiedStatus( true );
|
|
18
17
|
notify( successNotification( componentId, componentName ) );
|
|
19
18
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createElements, deleteElement, getContainer, type V1ElementData } from '@elementor/editor-elements';
|
|
2
2
|
import { __privateRunCommand as runCommand } from '@elementor/editor-v1-adapters';
|
|
3
|
-
import { __dispatch as dispatch } from '@elementor/store';
|
|
4
3
|
import { generateUniqueId } from '@elementor/utils';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
|
|
7
|
-
import {
|
|
6
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
8
7
|
import { type OriginalElementData, type OverridableProps } from '../../../types';
|
|
9
8
|
import { type Source, trackComponentEvent } from '../../../utils/tracking';
|
|
10
9
|
import { type ComponentEventData } from '../../components/create-component-form/utils/get-component-event-data';
|
|
@@ -40,15 +39,13 @@ export async function createUnpublishedComponent( {
|
|
|
40
39
|
index: container?.view?._index ?? 0,
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} )
|
|
49
|
-
);
|
|
42
|
+
componentsActions.addUnpublished( {
|
|
43
|
+
...componentBase,
|
|
44
|
+
elements: [ elementDataWithOverridablesReverted ],
|
|
45
|
+
overridableProps,
|
|
46
|
+
} );
|
|
50
47
|
|
|
51
|
-
|
|
48
|
+
componentsActions.addCreatedThisSession( generatedUid );
|
|
52
49
|
|
|
53
50
|
const componentInstance = await replaceElementWithComponent( element, componentBase );
|
|
54
51
|
|
|
@@ -65,8 +62,8 @@ export async function createUnpublishedComponent( {
|
|
|
65
62
|
} catch ( error ) {
|
|
66
63
|
restoreOriginalElement( originalElement, componentInstance.id );
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
componentsActions.removeUnpublished( generatedUid );
|
|
66
|
+
componentsActions.removeCreatedThisSession( generatedUid );
|
|
70
67
|
|
|
71
68
|
throw error;
|
|
72
69
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { selectOverridableProps, slice } from '../../../store/store';
|
|
1
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
2
|
+
import { componentsSelectors } from '../../../store/selectors';
|
|
4
3
|
import { type ComponentId } from '../../../types';
|
|
5
4
|
import { deleteGroup } from '../utils/groups-transformers';
|
|
6
5
|
|
|
@@ -10,7 +9,7 @@ type DeleteGroupParams = {
|
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
export function deleteOverridableGroup( { componentId, groupId }: DeleteGroupParams ): boolean {
|
|
13
|
-
const overridableProps =
|
|
12
|
+
const overridableProps = componentsSelectors.getOverridableProps( componentId );
|
|
14
13
|
|
|
15
14
|
if ( ! overridableProps ) {
|
|
16
15
|
return false;
|
|
@@ -24,15 +23,10 @@ export function deleteOverridableGroup( { componentId, groupId }: DeleteGroupPar
|
|
|
24
23
|
|
|
25
24
|
const updatedGroups = deleteGroup( overridableProps.groups, groupId );
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
...overridableProps,
|
|
32
|
-
groups: updatedGroups,
|
|
33
|
-
},
|
|
34
|
-
} )
|
|
35
|
-
);
|
|
26
|
+
componentsActions.setOverridableProps( componentId, {
|
|
27
|
+
...overridableProps,
|
|
28
|
+
groups: updatedGroups,
|
|
29
|
+
} );
|
|
36
30
|
|
|
37
31
|
return true;
|
|
38
32
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { selectCurrentComponent, selectOverridableProps, slice } from '../../../store/store';
|
|
1
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
2
|
+
import { componentsSelectors } from '../../../store/selectors';
|
|
4
3
|
import { type ComponentId, type OverridableProp } from '../../../types';
|
|
5
4
|
import { type Source, trackComponentEvent } from '../../../utils/tracking';
|
|
6
5
|
import { revertElementOverridableSetting } from '../../utils/revert-overridable-settings';
|
|
@@ -13,7 +12,7 @@ type DeletePropParams = {
|
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
export function deleteOverridableProp( { componentId, propKey, source }: DeletePropParams ): void {
|
|
16
|
-
const overridableProps =
|
|
15
|
+
const overridableProps = componentsSelectors.getOverridableProps( componentId );
|
|
17
16
|
|
|
18
17
|
if ( ! overridableProps || Object.keys( overridableProps.props ).length === 0 ) {
|
|
19
18
|
return;
|
|
@@ -43,18 +42,13 @@ export function deleteOverridableProp( { componentId, propKey, source }: DeleteP
|
|
|
43
42
|
|
|
44
43
|
const updatedGroups = removePropFromAllGroups( overridableProps.groups, propKey );
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
props: remainingProps,
|
|
52
|
-
groups: updatedGroups,
|
|
53
|
-
},
|
|
54
|
-
} )
|
|
55
|
-
);
|
|
45
|
+
componentsActions.setOverridableProps( componentId, {
|
|
46
|
+
...overridableProps,
|
|
47
|
+
props: remainingProps,
|
|
48
|
+
groups: updatedGroups,
|
|
49
|
+
} );
|
|
56
50
|
|
|
57
|
-
const currentComponent =
|
|
51
|
+
const currentComponent = componentsSelectors.getCurrentComponent();
|
|
58
52
|
|
|
59
53
|
for ( const prop of deletedProps ) {
|
|
60
54
|
trackComponentEvent( {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { getV1DocumentsManager, setDocumentModifiedStatus } from '@elementor/editor-documents';
|
|
2
2
|
import { getAllDescendants, type V1Element } from '@elementor/editor-elements';
|
|
3
|
-
import { __dispatch as dispatch } from '@elementor/store';
|
|
4
3
|
|
|
5
4
|
import { COMPONENT_WIDGET_TYPE } from '../../../create-component-type';
|
|
6
|
-
import {
|
|
5
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
7
6
|
|
|
8
7
|
const TITLE_EXTERNAL_CHANGE_COMMAND = 'title_external_change';
|
|
9
8
|
|
|
10
9
|
export const renameComponent = ( componentUid: string, newName: string ) => {
|
|
11
|
-
|
|
10
|
+
componentsActions.rename( componentUid, newName );
|
|
12
11
|
|
|
13
12
|
setDocumentModifiedStatus( true );
|
|
14
13
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { selectOverridableProps, slice } from '../../../store/store';
|
|
1
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
2
|
+
import { componentsSelectors } from '../../../store/selectors';
|
|
4
3
|
import { type ComponentId } from '../../../types';
|
|
5
4
|
import { renameGroup } from '../utils/groups-transformers';
|
|
6
5
|
|
|
@@ -11,7 +10,7 @@ type RenameGroupParams = {
|
|
|
11
10
|
};
|
|
12
11
|
|
|
13
12
|
export function renameOverridableGroup( { componentId, groupId, label }: RenameGroupParams ): boolean {
|
|
14
|
-
const overridableProps =
|
|
13
|
+
const overridableProps = componentsSelectors.getOverridableProps( componentId );
|
|
15
14
|
|
|
16
15
|
if ( ! overridableProps ) {
|
|
17
16
|
return false;
|
|
@@ -25,15 +24,10 @@ export function renameOverridableGroup( { componentId, groupId, label }: RenameG
|
|
|
25
24
|
|
|
26
25
|
const updatedGroups = renameGroup( overridableProps.groups, groupId, label );
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...overridableProps,
|
|
33
|
-
groups: updatedGroups,
|
|
34
|
-
},
|
|
35
|
-
} )
|
|
36
|
-
);
|
|
27
|
+
componentsActions.setOverridableProps( componentId, {
|
|
28
|
+
...overridableProps,
|
|
29
|
+
groups: updatedGroups,
|
|
30
|
+
} );
|
|
37
31
|
|
|
38
32
|
return true;
|
|
39
33
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { selectOverridableProps, slice } from '../../../store/store';
|
|
1
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
2
|
+
import { componentsSelectors } from '../../../store/selectors';
|
|
4
3
|
import { type ComponentId } from '../../../types';
|
|
5
4
|
|
|
6
5
|
type ReorderGroupPropsParams = {
|
|
@@ -10,7 +9,7 @@ type ReorderGroupPropsParams = {
|
|
|
10
9
|
};
|
|
11
10
|
|
|
12
11
|
export function reorderGroupProps( { componentId, groupId, newPropsOrder }: ReorderGroupPropsParams ): void {
|
|
13
|
-
const overridableProps =
|
|
12
|
+
const overridableProps = componentsSelectors.getOverridableProps( componentId );
|
|
14
13
|
|
|
15
14
|
if ( ! overridableProps ) {
|
|
16
15
|
return;
|
|
@@ -22,22 +21,17 @@ export function reorderGroupProps( { componentId, groupId, newPropsOrder }: Reor
|
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
overridableProps
|
|
29
|
-
|
|
30
|
-
groups
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
[ groupId ]: {
|
|
35
|
-
...group,
|
|
36
|
-
props: newPropsOrder,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
24
|
+
componentsActions.setOverridableProps( componentId, {
|
|
25
|
+
...overridableProps,
|
|
26
|
+
groups: {
|
|
27
|
+
...overridableProps.groups,
|
|
28
|
+
items: {
|
|
29
|
+
...overridableProps.groups.items,
|
|
30
|
+
[ groupId ]: {
|
|
31
|
+
...group,
|
|
32
|
+
props: newPropsOrder,
|
|
39
33
|
},
|
|
40
34
|
},
|
|
41
|
-
}
|
|
42
|
-
);
|
|
35
|
+
},
|
|
36
|
+
} );
|
|
43
37
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { selectOverridableProps, slice } from '../../../store/store';
|
|
1
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
2
|
+
import { componentsSelectors } from '../../../store/selectors';
|
|
4
3
|
import { type ComponentId } from '../../../types';
|
|
5
4
|
|
|
6
5
|
type ReorderGroupsParams = {
|
|
@@ -9,22 +8,17 @@ type ReorderGroupsParams = {
|
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
export function reorderOverridableGroups( { componentId, newOrder }: ReorderGroupsParams ): void {
|
|
12
|
-
const overridableProps =
|
|
11
|
+
const overridableProps = componentsSelectors.getOverridableProps( componentId );
|
|
13
12
|
|
|
14
13
|
if ( ! overridableProps ) {
|
|
15
14
|
return;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
overridableProps
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
order: newOrder,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
} )
|
|
29
|
-
);
|
|
17
|
+
componentsActions.setOverridableProps( componentId, {
|
|
18
|
+
...overridableProps,
|
|
19
|
+
groups: {
|
|
20
|
+
...overridableProps.groups,
|
|
21
|
+
order: newOrder,
|
|
22
|
+
},
|
|
23
|
+
} );
|
|
30
24
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { slice } from '../../../store/store';
|
|
1
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
4
2
|
|
|
5
3
|
export function resetSanitizedComponents() {
|
|
6
|
-
|
|
4
|
+
componentsActions.resetSanitizedComponents();
|
|
7
5
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type PropValue } from '@elementor/editor-props';
|
|
2
|
-
import { __dispatch as dispatch, __getState as getState } from '@elementor/store';
|
|
3
2
|
import { generateUniqueId } from '@elementor/utils';
|
|
4
3
|
|
|
5
|
-
import {
|
|
4
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
5
|
+
import { componentsSelectors } from '../../../store/selectors';
|
|
6
6
|
import { type OriginPropFields, type OverridableProp } from '../../../types';
|
|
7
7
|
import { type Source, trackComponentEvent } from '../../../utils/tracking';
|
|
8
8
|
import {
|
|
@@ -40,7 +40,7 @@ export function setOverridableProp( {
|
|
|
40
40
|
originPropFields,
|
|
41
41
|
source,
|
|
42
42
|
}: Props ): OverridableProp | undefined {
|
|
43
|
-
const overridableProps =
|
|
43
|
+
const overridableProps = componentsSelectors.getOverridableProps( componentId );
|
|
44
44
|
|
|
45
45
|
if ( ! overridableProps ) {
|
|
46
46
|
return;
|
|
@@ -87,20 +87,12 @@ export function setOverridableProp( {
|
|
|
87
87
|
groups = removePropFromGroup( groups, existingOverridableProp.groupId, overridableProp.overrideKey );
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
slice.actions.setOverridableProps( {
|
|
92
|
-
componentId,
|
|
93
|
-
overridableProps: {
|
|
94
|
-
props,
|
|
95
|
-
groups,
|
|
96
|
-
},
|
|
97
|
-
} )
|
|
98
|
-
);
|
|
90
|
+
componentsActions.setOverridableProps( componentId, { props, groups } );
|
|
99
91
|
|
|
100
92
|
const isNewProperty = ! existingOverridableProp;
|
|
101
93
|
|
|
102
94
|
if ( isNewProperty ) {
|
|
103
|
-
const currentComponent =
|
|
95
|
+
const currentComponent = componentsSelectors.getCurrentComponent();
|
|
104
96
|
|
|
105
97
|
trackComponentEvent( {
|
|
106
98
|
action: 'propertyExposed',
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { type SanitizeAttributes, slice } from '../../../store/store';
|
|
1
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
2
|
+
import { type SanitizeAttributes } from '../../../store/store';
|
|
4
3
|
import { type ComponentId } from '../../../types';
|
|
5
4
|
|
|
6
5
|
export function updateComponentSanitizedAttribute( componentId: ComponentId, attribute: SanitizeAttributes ) {
|
|
7
|
-
|
|
6
|
+
componentsActions.updateComponentSanitizedAttribute( componentId, attribute );
|
|
8
7
|
}
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import { type V1Document } from '@elementor/editor-documents';
|
|
2
|
-
import { __getStore as getStore } from '@elementor/store';
|
|
3
2
|
|
|
4
|
-
import {
|
|
3
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
4
|
+
import { type ComponentsPathItem } from '../../../store/store';
|
|
5
5
|
|
|
6
|
-
export function updateCurrentComponent( {
|
|
7
|
-
path,
|
|
8
|
-
currentComponentId,
|
|
9
|
-
}: {
|
|
6
|
+
export function updateCurrentComponent( params: {
|
|
10
7
|
path: ComponentsPathItem[];
|
|
11
8
|
currentComponentId: V1Document[ 'id' ] | null;
|
|
12
9
|
} ) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if ( ! dispatch ) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
dispatch( slice.actions.setPath( path ) );
|
|
20
|
-
dispatch( slice.actions.setCurrentComponentId( currentComponentId ) );
|
|
10
|
+
componentsActions.setPath( params.path );
|
|
11
|
+
componentsActions.setCurrentComponentId( params.currentComponentId );
|
|
21
12
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { selectOverridableProps, slice } from '../../../store/store';
|
|
1
|
+
import { componentsActions } from '../../../store/dispatchers';
|
|
2
|
+
import { componentsSelectors } from '../../../store/selectors';
|
|
4
3
|
import { type ComponentId, type OverridableProp } from '../../../types';
|
|
5
4
|
import { movePropBetweenGroups } from '../utils/groups-transformers';
|
|
6
5
|
|
|
@@ -17,7 +16,7 @@ export function updateOverridablePropParams( {
|
|
|
17
16
|
label,
|
|
18
17
|
groupId,
|
|
19
18
|
}: UpdatePropParams ): OverridableProp | undefined {
|
|
20
|
-
const overridableProps =
|
|
19
|
+
const overridableProps = componentsSelectors.getOverridableProps( componentId );
|
|
21
20
|
|
|
22
21
|
if ( ! overridableProps ) {
|
|
23
22
|
return;
|
|
@@ -40,19 +39,14 @@ export function updateOverridablePropParams( {
|
|
|
40
39
|
|
|
41
40
|
const updatedGroups = movePropBetweenGroups( overridableProps.groups, overrideKey, oldGroupId, newGroupId );
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
overridableProps
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
groups: updatedGroups,
|
|
53
|
-
},
|
|
54
|
-
} )
|
|
55
|
-
);
|
|
42
|
+
componentsActions.setOverridableProps( componentId, {
|
|
43
|
+
...overridableProps,
|
|
44
|
+
props: {
|
|
45
|
+
...overridableProps.props,
|
|
46
|
+
[ overrideKey ]: updatedProp,
|
|
47
|
+
},
|
|
48
|
+
groups: updatedGroups,
|
|
49
|
+
} );
|
|
56
50
|
|
|
57
51
|
return updatedProp;
|
|
58
52
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { getAllDescendants, type V1Element } from '@elementor/editor-elements';
|
|
2
2
|
import { type HookOptions, registerDataHook } from '@elementor/editor-v1-adapters';
|
|
3
|
-
import { __getState as getState } from '@elementor/store';
|
|
4
3
|
|
|
5
|
-
import {
|
|
4
|
+
import { componentsSelectors } from '../../store/selectors';
|
|
6
5
|
import { deleteOverridableProp } from '../store/actions/delete-overridable-prop';
|
|
7
6
|
|
|
8
7
|
type DeleteCommandArgs = {
|
|
@@ -19,19 +18,13 @@ export function initCleanupOverridablePropsOnDelete() {
|
|
|
19
18
|
return true;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if ( ! state ) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const currentComponentId = selectCurrentComponentId( state );
|
|
21
|
+
const currentComponentId = componentsSelectors.getCurrentComponentId();
|
|
29
22
|
|
|
30
23
|
if ( ! currentComponentId ) {
|
|
31
24
|
return true;
|
|
32
25
|
}
|
|
33
26
|
|
|
34
|
-
const overridableProps =
|
|
27
|
+
const overridableProps = componentsSelectors.getOverridableProps( currentComponentId );
|
|
35
28
|
|
|
36
29
|
if ( ! overridableProps || Object.keys( overridableProps.props ).length === 0 ) {
|
|
37
30
|
return true;
|