@elementor/editor-editing-panel 1.47.0 → 1.50.0
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/CHANGELOG.md +85 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +486 -378
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +503 -398
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -14
- package/src/components/css-classes/css-class-item.tsx +3 -2
- package/src/components/css-classes/css-class-menu.tsx +2 -2
- package/src/components/css-classes/css-class-selector.tsx +10 -2
- package/src/components/popover-body.tsx +12 -0
- package/src/components/style-sections/border-section/border-field.tsx +14 -7
- package/src/components/style-sections/effects-section/effects-section.tsx +18 -4
- package/src/components/style-sections/layout-section/flex-order-field.tsx +30 -19
- package/src/components/style-sections/layout-section/flex-size-field.tsx +14 -16
- package/src/components/style-sections/layout-section/layout-section.tsx +9 -2
- package/src/components/style-sections/layout-section/utils/rotated-icon.tsx +6 -1
- package/src/components/style-sections/position-section/position-section.tsx +19 -8
- package/src/components/style-sections/size-section/size-section.tsx +4 -1
- package/src/components/style-sections/typography-section/text-stroke-field.tsx +3 -1
- package/src/components/style-sections/typography-section/typography-section.tsx +6 -1
- package/src/components/style-tab.tsx +1 -1
- package/src/controls-registry/settings-field.tsx +21 -5
- package/src/controls-registry/styles-field.tsx +5 -3
- package/src/dynamics/components/dynamic-selection-control.tsx +22 -14
- package/src/dynamics/components/dynamic-selection.tsx +32 -36
- package/src/hooks/use-styles-field.ts +3 -4
- package/src/hooks/use-styles-fields.ts +141 -73
- package/src/index.ts +1 -1
- package/src/init.ts +0 -6
- package/src/reset-style-props.tsx +1 -1
- package/src/styles-inheritance/components/styles-inheritance-infotip.tsx +1 -1
- package/src/utils/get-styles-provider-color.ts +8 -0
- package/src/components/popover-scrollable-content.tsx +0 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ControlFormLabel, useBoundProp } from '@elementor/editor-controls';
|
|
3
3
|
import type { Control, ControlsSection } from '@elementor/editor-elements';
|
|
4
|
-
import { PopoverHeader
|
|
4
|
+
import { PopoverHeader } from '@elementor/editor-ui';
|
|
5
5
|
import { DatabaseIcon, SettingsIcon, XIcon } from '@elementor/icons';
|
|
6
6
|
import {
|
|
7
7
|
bindPopover,
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from '@elementor/ui';
|
|
22
22
|
import { __ } from '@wordpress/i18n';
|
|
23
23
|
|
|
24
|
+
import { PopoverBody } from '../../components/popover-body';
|
|
24
25
|
import { Control as BaseControl } from '../../controls-registry/control';
|
|
25
26
|
import { type ControlType, getControl } from '../../controls-registry/controls-registry';
|
|
26
27
|
import { usePersistDynamicValue } from '../../hooks/use-persist-dynamic-value';
|
|
@@ -82,9 +83,9 @@ export const DynamicSelectionControl = () => {
|
|
|
82
83
|
} }
|
|
83
84
|
{ ...bindPopover( selectionPopoverState ) }
|
|
84
85
|
>
|
|
85
|
-
<
|
|
86
|
+
<PopoverBody>
|
|
86
87
|
<DynamicSelection close={ selectionPopoverState.close } />
|
|
87
|
-
</
|
|
88
|
+
</PopoverBody>
|
|
88
89
|
</Popover>
|
|
89
90
|
</Box>
|
|
90
91
|
);
|
|
@@ -107,18 +108,21 @@ export const DynamicSettingsPopover = ( { dynamicTag }: { dynamicTag: DynamicTag
|
|
|
107
108
|
<Popover
|
|
108
109
|
disablePortal
|
|
109
110
|
disableScrollLock
|
|
110
|
-
anchorOrigin={ { vertical: 'bottom', horizontal: '
|
|
111
|
+
anchorOrigin={ { vertical: 'bottom', horizontal: 'right' } }
|
|
112
|
+
transformOrigin={ { vertical: 'top', horizontal: 'right' } }
|
|
111
113
|
PaperProps={ {
|
|
112
|
-
sx: { my:
|
|
114
|
+
sx: { my: 1 },
|
|
113
115
|
} }
|
|
114
116
|
{ ...bindPopover( popupState ) }
|
|
115
117
|
>
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
<PopoverBody>
|
|
119
|
+
<PopoverHeader
|
|
120
|
+
title={ dynamicTag.label }
|
|
121
|
+
onClose={ popupState.close }
|
|
122
|
+
icon={ <DatabaseIcon fontSize={ SIZE } /> }
|
|
123
|
+
/>
|
|
124
|
+
<DynamicSettings controls={ dynamicTag.atomic_controls } />
|
|
125
|
+
</PopoverBody>
|
|
122
126
|
</Popover>
|
|
123
127
|
</>
|
|
124
128
|
);
|
|
@@ -134,7 +138,7 @@ const DynamicSettings = ( { controls }: { controls: DynamicTag[ 'atomic_controls
|
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
return (
|
|
137
|
-
|
|
141
|
+
<>
|
|
138
142
|
<Tabs size="small" variant="fullWidth" { ...getTabsProps() }>
|
|
139
143
|
{ tabs.map( ( { value }, index ) => (
|
|
140
144
|
<Tab key={ index } label={ value.label } sx={ { px: 1, py: 0.5 } } { ...getTabProps( index ) } />
|
|
@@ -144,7 +148,11 @@ const DynamicSettings = ( { controls }: { controls: DynamicTag[ 'atomic_controls
|
|
|
144
148
|
|
|
145
149
|
{ tabs.map( ( { value }, index ) => {
|
|
146
150
|
return (
|
|
147
|
-
<TabPanel
|
|
151
|
+
<TabPanel
|
|
152
|
+
key={ index }
|
|
153
|
+
sx={ { flexGrow: 1, py: 0, overflowY: 'auto' } }
|
|
154
|
+
{ ...getTabPanelProps( index ) }
|
|
155
|
+
>
|
|
148
156
|
<Stack p={ 2 } gap={ 2 }>
|
|
149
157
|
{ value.items.map( ( item ) => {
|
|
150
158
|
if ( item.type === 'control' ) {
|
|
@@ -156,7 +164,7 @@ const DynamicSettings = ( { controls }: { controls: DynamicTag[ 'atomic_controls
|
|
|
156
164
|
</TabPanel>
|
|
157
165
|
);
|
|
158
166
|
} ) }
|
|
159
|
-
|
|
167
|
+
</>
|
|
160
168
|
);
|
|
161
169
|
};
|
|
162
170
|
|
|
@@ -3,10 +3,10 @@ import * as React from 'react';
|
|
|
3
3
|
import { useBoundProp } from '@elementor/editor-controls';
|
|
4
4
|
import { PopoverHeader, PopoverMenuList, PopoverSearch } from '@elementor/editor-ui';
|
|
5
5
|
import { DatabaseIcon } from '@elementor/icons';
|
|
6
|
-
import {
|
|
6
|
+
import { Divider, Link, Stack, Typography, useTheme } from '@elementor/ui';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { PopoverBody } from '../../components/popover-body';
|
|
10
10
|
import { usePersistDynamicValue } from '../../hooks/use-persist-dynamic-value';
|
|
11
11
|
import { usePropDynamicTags } from '../hooks/use-prop-dynamic-tags';
|
|
12
12
|
import { getAtomicDynamicTags } from '../sync/get-atomic-dynamic-tags';
|
|
@@ -76,43 +76,39 @@ export const DynamicSelection = ( { close: closePopover }: DynamicSelectionProps
|
|
|
76
76
|
] );
|
|
77
77
|
|
|
78
78
|
return (
|
|
79
|
-
|
|
79
|
+
<PopoverBody>
|
|
80
80
|
<PopoverHeader
|
|
81
81
|
title={ __( 'Dynamic tags', 'elementor' ) }
|
|
82
82
|
onClose={ closePopover }
|
|
83
83
|
icon={ <DatabaseIcon fontSize={ SIZE } /> }
|
|
84
84
|
/>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
</Fragment>
|
|
113
|
-
) }
|
|
114
|
-
</Stack>
|
|
115
|
-
</>
|
|
85
|
+
{ hasNoDynamicTags ? (
|
|
86
|
+
<NoDynamicTags />
|
|
87
|
+
) : (
|
|
88
|
+
<Fragment>
|
|
89
|
+
<PopoverSearch
|
|
90
|
+
value={ searchValue }
|
|
91
|
+
onSearch={ handleSearch }
|
|
92
|
+
placeholder={ __( 'Search dynamic tags…', 'elementor' ) }
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<Divider />
|
|
96
|
+
|
|
97
|
+
<PopoverMenuList
|
|
98
|
+
items={ virtualizedItems }
|
|
99
|
+
onSelect={ handleSetDynamicTag }
|
|
100
|
+
onClose={ closePopover }
|
|
101
|
+
selectedValue={ dynamicValue?.name }
|
|
102
|
+
itemStyle={ ( item ) =>
|
|
103
|
+
item.type === 'item' ? { paddingInlineStart: theme.spacing( 3.5 ) } : {}
|
|
104
|
+
}
|
|
105
|
+
noResultsComponent={
|
|
106
|
+
<NoResults searchValue={ searchValue } onClear={ () => setSearchValue( '' ) } />
|
|
107
|
+
}
|
|
108
|
+
/>
|
|
109
|
+
</Fragment>
|
|
110
|
+
) }
|
|
111
|
+
</PopoverBody>
|
|
116
112
|
);
|
|
117
113
|
};
|
|
118
114
|
|
|
@@ -142,7 +138,7 @@ const NoResults = ( { searchValue, onClear }: NoResultsProps ) => (
|
|
|
142
138
|
);
|
|
143
139
|
|
|
144
140
|
const NoDynamicTags = () => (
|
|
145
|
-
|
|
141
|
+
<>
|
|
146
142
|
<Divider />
|
|
147
143
|
<Stack
|
|
148
144
|
gap={ 1 }
|
|
@@ -161,7 +157,7 @@ const NoDynamicTags = () => (
|
|
|
161
157
|
{ __( "You'll need Elementor Pro to use this feature.", 'elementor' ) }
|
|
162
158
|
</Typography>
|
|
163
159
|
</Stack>
|
|
164
|
-
|
|
160
|
+
</>
|
|
165
161
|
);
|
|
166
162
|
|
|
167
163
|
const useFilteredOptions = ( searchValue: string ): OptionEntry[] => {
|
|
@@ -3,7 +3,8 @@ import type { PropKey, PropValue } from '@elementor/editor-props';
|
|
|
3
3
|
import { useStylesFields } from './use-styles-fields';
|
|
4
4
|
|
|
5
5
|
export function useStylesField< T extends PropValue >(
|
|
6
|
-
propName: PropKey
|
|
6
|
+
propName: PropKey,
|
|
7
|
+
meta: { history: { propDisplayName: string } }
|
|
7
8
|
): {
|
|
8
9
|
value: T;
|
|
9
10
|
setValue: ( newValue: T ) => void;
|
|
@@ -14,9 +15,7 @@ export function useStylesField< T extends PropValue >(
|
|
|
14
15
|
const value = values?.[ propName ] ?? null;
|
|
15
16
|
|
|
16
17
|
const setValue = ( newValue: T ) => {
|
|
17
|
-
setValues( {
|
|
18
|
-
[ propName ]: newValue,
|
|
19
|
-
} );
|
|
18
|
+
setValues( { [ propName ]: newValue }, meta );
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
return { value: value as T, setValue, canEdit };
|
|
@@ -1,61 +1,38 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
createElementStyle,
|
|
4
|
-
type CreateElementStyleArgs,
|
|
5
|
-
deleteElementStyle,
|
|
6
|
-
type ElementID,
|
|
7
|
-
getElementLabel,
|
|
8
|
-
} from '@elementor/editor-elements';
|
|
2
|
+
import { createElementStyle, deleteElementStyle, type ElementID, getElementLabel } from '@elementor/editor-elements';
|
|
9
3
|
import type { Props } from '@elementor/editor-props';
|
|
10
4
|
import { getVariantByMeta, type StyleDefinition, type StyleDefinitionVariant } from '@elementor/editor-styles';
|
|
11
|
-
import { type StylesProvider } from '@elementor/editor-styles-repository';
|
|
5
|
+
import { isElementsStylesProvider, type StylesProvider } from '@elementor/editor-styles-repository';
|
|
12
6
|
import { ELEMENTS_STYLES_RESERVED_LABEL } from '@elementor/editor-styles-repository';
|
|
13
|
-
import { undoable } from '@elementor/editor-v1-adapters';
|
|
7
|
+
import { isExperimentActive, undoable } from '@elementor/editor-v1-adapters';
|
|
14
8
|
import { __ } from '@wordpress/i18n';
|
|
15
9
|
|
|
16
10
|
import { useClassesProp } from '../contexts/classes-prop-context';
|
|
17
11
|
import { useElement } from '../contexts/element-context';
|
|
18
12
|
import { useStyle } from '../contexts/style-context';
|
|
19
13
|
import { StyleNotFoundUnderProviderError, StylesProviderCannotUpdatePropsError } from '../errors';
|
|
14
|
+
import { EXPERIMENTAL_FEATURES } from '../sync/experiments-flags';
|
|
20
15
|
import { useStylesRerender } from './use-styles-rerender';
|
|
21
16
|
|
|
22
17
|
export function useStylesFields< T extends Props >( propNames: ( keyof T & string )[] ) {
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
const {
|
|
19
|
+
element: { id: elementId },
|
|
20
|
+
} = useElement();
|
|
21
|
+
const { id: styleId, meta, provider, canEdit } = useStyle();
|
|
26
22
|
|
|
27
|
-
const undoableUpdateStyle = useUndoableUpdateStyle();
|
|
28
|
-
const undoableCreateElementStyle = useUndoableCreateElementStyle();
|
|
23
|
+
const undoableUpdateStyle = useUndoableUpdateStyle( { elementId, meta } );
|
|
24
|
+
const undoableCreateElementStyle = useUndoableCreateElementStyle( { elementId, meta } );
|
|
29
25
|
|
|
30
26
|
useStylesRerender();
|
|
31
27
|
|
|
32
|
-
const values = getProps< T >( {
|
|
33
|
-
elementId: element.id,
|
|
34
|
-
styleId: id,
|
|
35
|
-
provider,
|
|
36
|
-
meta,
|
|
37
|
-
propNames,
|
|
38
|
-
} );
|
|
39
|
-
|
|
40
|
-
const setValues = ( props: T ) => {
|
|
41
|
-
if ( id === null ) {
|
|
42
|
-
undoableCreateElementStyle( {
|
|
43
|
-
elementId: element.id,
|
|
44
|
-
classesProp,
|
|
45
|
-
meta,
|
|
46
|
-
props,
|
|
47
|
-
} );
|
|
48
|
-
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
28
|
+
const values = getProps< T >( { elementId, styleId, provider, meta, propNames } );
|
|
51
29
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} );
|
|
30
|
+
const setValues = ( props: T, { history: { propDisplayName } }: { history: { propDisplayName: string } } ) => {
|
|
31
|
+
if ( styleId === null ) {
|
|
32
|
+
undoableCreateElementStyle( { props, propDisplayName } );
|
|
33
|
+
} else {
|
|
34
|
+
undoableUpdateStyle( { provider, styleId, props, propDisplayName } );
|
|
35
|
+
}
|
|
59
36
|
};
|
|
60
37
|
|
|
61
38
|
return { values, setValues, canEdit };
|
|
@@ -91,52 +68,78 @@ function getProps< T extends Props >( { styleId, elementId, provider, meta, prop
|
|
|
91
68
|
) as NullableValues< T >;
|
|
92
69
|
}
|
|
93
70
|
|
|
94
|
-
type UndoableCreateElementStyleArgs =
|
|
71
|
+
type UndoableCreateElementStyleArgs = {
|
|
72
|
+
props: Props;
|
|
73
|
+
propDisplayName: string;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
function useUndoableCreateElementStyle( {
|
|
77
|
+
elementId,
|
|
78
|
+
meta,
|
|
79
|
+
}: {
|
|
80
|
+
elementId: ElementID;
|
|
81
|
+
meta: StyleDefinitionVariant[ 'meta' ];
|
|
82
|
+
} ) {
|
|
83
|
+
const classesProp = useClassesProp();
|
|
95
84
|
|
|
96
|
-
function useUndoableCreateElementStyle() {
|
|
97
85
|
return useMemo( () => {
|
|
86
|
+
const isVersion331Active = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_31 );
|
|
87
|
+
|
|
88
|
+
const createStyleArgs = { elementId, classesProp, meta, label: ELEMENTS_STYLES_RESERVED_LABEL };
|
|
89
|
+
|
|
98
90
|
return undoable(
|
|
99
91
|
{
|
|
100
|
-
do: (
|
|
101
|
-
return createElementStyle( {
|
|
102
|
-
...payload,
|
|
103
|
-
label: ELEMENTS_STYLES_RESERVED_LABEL,
|
|
104
|
-
} );
|
|
92
|
+
do: ( { props }: UndoableCreateElementStyleArgs ) => {
|
|
93
|
+
return createElementStyle( { ...createStyleArgs, props } );
|
|
105
94
|
},
|
|
106
95
|
|
|
107
|
-
undo: (
|
|
96
|
+
undo: ( _, styleId ) => {
|
|
108
97
|
deleteElementStyle( elementId, styleId );
|
|
109
98
|
},
|
|
110
99
|
|
|
111
|
-
redo: (
|
|
112
|
-
return createElementStyle( {
|
|
113
|
-
...payload,
|
|
114
|
-
styleId,
|
|
115
|
-
label: ELEMENTS_STYLES_RESERVED_LABEL,
|
|
116
|
-
} );
|
|
100
|
+
redo: ( { props }, styleId ) => {
|
|
101
|
+
return createElementStyle( { ...createStyleArgs, props, styleId } );
|
|
117
102
|
},
|
|
118
103
|
},
|
|
119
104
|
{
|
|
120
|
-
title: (
|
|
121
|
-
|
|
105
|
+
title: () => {
|
|
106
|
+
if ( isVersion331Active ) {
|
|
107
|
+
return localStyleHistoryTitlesV331.title( { elementId } );
|
|
108
|
+
}
|
|
109
|
+
return historyTitlesV330.title( { elementId } );
|
|
110
|
+
},
|
|
111
|
+
subtitle: ( { propDisplayName } ) => {
|
|
112
|
+
if ( isVersion331Active ) {
|
|
113
|
+
return localStyleHistoryTitlesV331.subtitle( { propDisplayName } );
|
|
114
|
+
}
|
|
115
|
+
return historyTitlesV330.subtitle;
|
|
116
|
+
},
|
|
122
117
|
}
|
|
123
118
|
);
|
|
124
|
-
}, [] );
|
|
119
|
+
}, [ classesProp, elementId, meta ] );
|
|
125
120
|
}
|
|
126
121
|
|
|
127
122
|
type UndoableUpdateStyleArgs = {
|
|
128
|
-
elementId: ElementID;
|
|
129
123
|
styleId: StyleDefinition[ 'id' ];
|
|
130
124
|
provider: StylesProvider;
|
|
131
|
-
meta: StyleDefinitionVariant[ 'meta' ];
|
|
132
125
|
props: Props;
|
|
126
|
+
propDisplayName: string;
|
|
133
127
|
};
|
|
134
128
|
|
|
135
|
-
function useUndoableUpdateStyle(
|
|
129
|
+
function useUndoableUpdateStyle( {
|
|
130
|
+
elementId,
|
|
131
|
+
meta,
|
|
132
|
+
}: {
|
|
133
|
+
elementId: ElementID;
|
|
134
|
+
|
|
135
|
+
meta: StyleDefinitionVariant[ 'meta' ];
|
|
136
|
+
} ) {
|
|
136
137
|
return useMemo( () => {
|
|
138
|
+
const isVersion331Active = isExperimentActive( EXPERIMENTAL_FEATURES.V_3_31 );
|
|
139
|
+
|
|
137
140
|
return undoable(
|
|
138
141
|
{
|
|
139
|
-
do: ( {
|
|
142
|
+
do: ( { provider, styleId, props }: UndoableUpdateStyleArgs ) => {
|
|
140
143
|
if ( ! provider.actions.updateProps ) {
|
|
141
144
|
throw new StylesProviderCannotUpdatePropsError( {
|
|
142
145
|
context: { providerKey: provider.getKey() },
|
|
@@ -147,28 +150,41 @@ function useUndoableUpdateStyle() {
|
|
|
147
150
|
|
|
148
151
|
const prevProps = getCurrentProps( style, meta );
|
|
149
152
|
|
|
150
|
-
provider.actions.updateProps(
|
|
151
|
-
{
|
|
152
|
-
id: styleId,
|
|
153
|
-
meta,
|
|
154
|
-
props,
|
|
155
|
-
},
|
|
156
|
-
{ elementId }
|
|
157
|
-
);
|
|
153
|
+
provider.actions.updateProps( { id: styleId, meta, props }, { elementId } );
|
|
158
154
|
|
|
159
155
|
return prevProps;
|
|
160
156
|
},
|
|
161
157
|
|
|
162
|
-
undo: ( {
|
|
158
|
+
undo: ( { provider, styleId }, prevProps ) => {
|
|
163
159
|
provider.actions.updateProps?.( { id: styleId, meta, props: prevProps }, { elementId } );
|
|
164
160
|
},
|
|
165
161
|
},
|
|
166
162
|
{
|
|
167
|
-
title: ( {
|
|
168
|
-
|
|
163
|
+
title: ( { provider } ) => {
|
|
164
|
+
if ( isVersion331Active ) {
|
|
165
|
+
const isLocal = isElementsStylesProvider( provider.getKey() );
|
|
166
|
+
|
|
167
|
+
if ( isLocal ) {
|
|
168
|
+
return localStyleHistoryTitlesV331.title( { elementId } );
|
|
169
|
+
}
|
|
170
|
+
return defaultHistoryTitlesV331.title( { provider } );
|
|
171
|
+
}
|
|
172
|
+
return historyTitlesV330.title( { elementId } );
|
|
173
|
+
},
|
|
174
|
+
subtitle: ( { provider, styleId, propDisplayName } ) => {
|
|
175
|
+
if ( isVersion331Active ) {
|
|
176
|
+
const isLocal = isElementsStylesProvider( provider.getKey() );
|
|
177
|
+
|
|
178
|
+
if ( isLocal ) {
|
|
179
|
+
return localStyleHistoryTitlesV331.subtitle( { propDisplayName } );
|
|
180
|
+
}
|
|
181
|
+
return defaultHistoryTitlesV331.subtitle( { provider, styleId, elementId, propDisplayName } );
|
|
182
|
+
}
|
|
183
|
+
return historyTitlesV330.subtitle;
|
|
184
|
+
},
|
|
169
185
|
}
|
|
170
186
|
);
|
|
171
|
-
}, [] );
|
|
187
|
+
}, [ elementId, meta ] );
|
|
172
188
|
}
|
|
173
189
|
|
|
174
190
|
function getCurrentProps( style: StyleDefinition | null, meta: StyleDefinitionVariant[ 'meta' ] ) {
|
|
@@ -182,3 +198,55 @@ function getCurrentProps( style: StyleDefinition | null, meta: StyleDefinitionVa
|
|
|
182
198
|
|
|
183
199
|
return structuredClone( props );
|
|
184
200
|
}
|
|
201
|
+
|
|
202
|
+
const historyTitlesV330 = {
|
|
203
|
+
title: ( { elementId }: { elementId: ElementID } ) => getElementLabel( elementId ),
|
|
204
|
+
subtitle: __( 'Style edited', 'elementor' ),
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
type DefaultHistoryTitleV331Args = {
|
|
208
|
+
provider: StylesProvider;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
type DefaultHistorySubtitleV331Args = {
|
|
212
|
+
provider: StylesProvider;
|
|
213
|
+
styleId: StyleDefinition[ 'id' ];
|
|
214
|
+
elementId: ElementID;
|
|
215
|
+
propDisplayName: string;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const defaultHistoryTitlesV331 = {
|
|
219
|
+
title: ( { provider }: DefaultHistoryTitleV331Args ) => {
|
|
220
|
+
const providerLabel = provider.labels?.singular;
|
|
221
|
+
return providerLabel ? capitalize( providerLabel ) : __( 'Style', 'elementor' );
|
|
222
|
+
},
|
|
223
|
+
subtitle: ( { provider, styleId, elementId, propDisplayName }: DefaultHistorySubtitleV331Args ) => {
|
|
224
|
+
const styleLabel = provider.actions.get( styleId, { elementId } )?.label;
|
|
225
|
+
|
|
226
|
+
if ( ! styleLabel ) {
|
|
227
|
+
throw new Error( `Style ${ styleId } not found` );
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// translators: %s$1 is the style label, %s$2 is the name of the style property being edited
|
|
231
|
+
return __( `%s$1 %s$2 edited`, 'elementor' ).replace( '%s$1', styleLabel ).replace( '%s$2', propDisplayName );
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
type LocalStyleHistoryTitleV331Args = {
|
|
236
|
+
elementId: ElementID;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
type LocalStyleHistorySubtitleV331Args = {
|
|
240
|
+
propDisplayName: string;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const localStyleHistoryTitlesV331 = {
|
|
244
|
+
title: ( { elementId }: LocalStyleHistoryTitleV331Args ) => getElementLabel( elementId ),
|
|
245
|
+
subtitle: ( { propDisplayName }: LocalStyleHistorySubtitleV331Args ) =>
|
|
246
|
+
// translators: %s is the name of the style property being edited
|
|
247
|
+
__( `%s edited`, 'elementor' ).replace( '%s', propDisplayName ),
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
function capitalize( str: string ) {
|
|
251
|
+
return str.charAt( 0 ).toUpperCase() + str.slice( 1 );
|
|
252
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { usePanelActions, usePanelStatus } from './panel';
|
|
|
9
9
|
export { type ValidationResult, type ValidationEvent } from './components/creatable-autocomplete';
|
|
10
10
|
export { controlActionsMenu } from './controls-actions';
|
|
11
11
|
export { useFontFamilies } from './components/style-sections/typography-section/hooks/use-font-families';
|
|
12
|
-
export {
|
|
12
|
+
export { PopoverBody } from './components/popover-body';
|
|
13
13
|
export { useSectionWidth } from './contexts/section-context';
|
|
14
14
|
|
|
15
15
|
export { init } from './init';
|
package/src/init.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { injectIntoLogic } from '@elementor/editor';
|
|
2
|
-
import { PrefetchUserData } from '@elementor/editor-current-user';
|
|
3
2
|
import { __registerPanel as registerPanel } from '@elementor/editor-panels';
|
|
4
3
|
import { blockCommand, isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
5
4
|
|
|
@@ -20,11 +19,6 @@ export function init() {
|
|
|
20
19
|
component: EditingPanelHooks,
|
|
21
20
|
} );
|
|
22
21
|
|
|
23
|
-
injectIntoLogic( {
|
|
24
|
-
id: 'current-user-data',
|
|
25
|
-
component: PrefetchUserData,
|
|
26
|
-
} );
|
|
27
|
-
|
|
28
22
|
// TODO: Move it from here once we have dynamic package.
|
|
29
23
|
initDynamics();
|
|
30
24
|
|
|
@@ -15,7 +15,7 @@ export function initResetStyleProps() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
// Temporary fix for the issue with ControlToggleButtonGroup.
|
|
18
|
-
const EXCLUDED_BINDS = [ '
|
|
18
|
+
const EXCLUDED_BINDS = [ 'flex-grow', 'flex-shrink', 'flex-basis' ];
|
|
19
19
|
|
|
20
20
|
export function useResetStyleValueProps() {
|
|
21
21
|
const isStyle = useIsStyle();
|
|
@@ -41,7 +41,7 @@ export const StylesInheritanceInfotip = ( { inheritanceChain, propType, path, la
|
|
|
41
41
|
|
|
42
42
|
const key = path.join( '.' );
|
|
43
43
|
|
|
44
|
-
const sectionWidth = useSectionWidth()
|
|
44
|
+
const sectionWidth = useSectionWidth();
|
|
45
45
|
|
|
46
46
|
const resolve = useMemo< PropsResolver >( () => {
|
|
47
47
|
return createPropsResolver( {
|
|
@@ -26,3 +26,11 @@ export const getStylesProviderThemeColor = ( provider: string ): ( ( theme: Them
|
|
|
26
26
|
|
|
27
27
|
return getStyleProviderColors( provider ).getThemeColor;
|
|
28
28
|
};
|
|
29
|
+
|
|
30
|
+
export function getTempStylesProviderThemeColor( provider: string ): ( ( theme: Theme ) => string ) | null {
|
|
31
|
+
if ( isElementsStylesProvider( provider ) ) {
|
|
32
|
+
return ( theme: Theme ) => theme.palette.primary.main;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return getStylesProviderThemeColor( provider );
|
|
36
|
+
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { PopoverScrollableContent as BasePopoverScrollableContent } from '@elementor/editor-ui';
|
|
3
|
-
|
|
4
|
-
import { useSectionWidth } from '../contexts/section-context';
|
|
5
|
-
|
|
6
|
-
type Props = React.ComponentProps< typeof BasePopoverScrollableContent >;
|
|
7
|
-
|
|
8
|
-
export const PopoverScrollableContent = ( props: Props ) => {
|
|
9
|
-
const sectionWidth = useSectionWidth();
|
|
10
|
-
|
|
11
|
-
return <BasePopoverScrollableContent { ...props } width={ sectionWidth } />;
|
|
12
|
-
};
|