@elementor/editor-editing-panel 1.33.1 → 1.35.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 +38 -0
- package/dist/index.js +131 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/components/editing-panel-tabs.tsx +37 -20
- package/src/components/section.tsx +4 -3
- package/src/components/style-sections/layout-section/display-field.tsx +21 -7
- package/src/components/style-sections/position-section/position-section.tsx +3 -3
- package/src/components/style-sections/typography-section/font-family-field.tsx +1 -1
- package/src/components/style-sections/typography-section/hooks/use-font-families.ts +1 -1
- package/src/hooks/use-direction.ts +3 -4
- package/src/hooks/use-state-by-element.ts +18 -0
- package/src/styles-inheritance/styles-inheritance-indicator.tsx +2 -2
- package/src/sync/get-elementor-globals.ts +19 -0
- package/src/sync/is-experiment-active.ts +7 -0
- package/src/sync/types.ts +1 -4
- package/src/sync/get-elementor-config.ts +0 -7
- package/src/sync/get-experiments-config.ts +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,21 +39,21 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "0.19.
|
|
43
|
-
"@elementor/editor-canvas": "0.21.
|
|
44
|
-
"@elementor/editor-controls": "0.
|
|
42
|
+
"@elementor/editor": "0.19.2",
|
|
43
|
+
"@elementor/editor-canvas": "0.21.2",
|
|
44
|
+
"@elementor/editor-controls": "0.30.0",
|
|
45
45
|
"@elementor/editor-current-user": "0.3.2",
|
|
46
46
|
"@elementor/editor-elements": "0.8.2",
|
|
47
|
-
"@elementor/editor-panels": "0.15.
|
|
47
|
+
"@elementor/editor-panels": "0.15.2",
|
|
48
48
|
"@elementor/editor-props": "0.12.0",
|
|
49
49
|
"@elementor/editor-responsive": "0.13.4",
|
|
50
50
|
"@elementor/editor-styles": "0.6.6",
|
|
51
|
-
"@elementor/editor-styles-repository": "0.8.
|
|
51
|
+
"@elementor/editor-styles-repository": "0.8.7",
|
|
52
52
|
"@elementor/editor-ui": "0.8.1",
|
|
53
53
|
"@elementor/editor-v1-adapters": "0.11.0",
|
|
54
54
|
"@elementor/icons": "1.40.1",
|
|
55
|
-
"@elementor/locations": "0.
|
|
56
|
-
"@elementor/menus": "0.1.
|
|
55
|
+
"@elementor/locations": "0.8.0",
|
|
56
|
+
"@elementor/menus": "0.1.5",
|
|
57
57
|
"@elementor/schema": "0.1.2",
|
|
58
58
|
"@elementor/session": "0.1.0",
|
|
59
59
|
"@elementor/ui": "1.34.2",
|
|
@@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
|
|
6
6
|
import { useElement } from '../contexts/element-context';
|
|
7
7
|
import { ScrollProvider } from '../contexts/scroll-context';
|
|
8
|
+
import { useStateByElement } from '../hooks/use-state-by-element';
|
|
8
9
|
import { SettingsTab } from './settings-tab';
|
|
9
10
|
import { stickyHeaderStyles, StyleTab } from './style-tab';
|
|
10
11
|
|
|
@@ -12,30 +13,46 @@ type TabValue = 'settings' | 'style';
|
|
|
12
13
|
|
|
13
14
|
export const EditingPanelTabs = () => {
|
|
14
15
|
const { element } = useElement();
|
|
15
|
-
|
|
16
|
-
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs< TabValue >( 'settings' );
|
|
17
|
-
|
|
18
16
|
return (
|
|
19
17
|
// When switching between elements, the local states should be reset. We are using key to rerender the tabs.
|
|
20
18
|
// Reference: https://react.dev/learn/preserving-and-resetting-state#resetting-a-form-with-a-key
|
|
21
19
|
<Fragment key={ element.id }>
|
|
22
|
-
<
|
|
23
|
-
<Stack direction="column" sx={ { width: '100%' } }>
|
|
24
|
-
<Stack sx={ { ...stickyHeaderStyles, top: 0 } }>
|
|
25
|
-
<Tabs variant="fullWidth" size="small" sx={ { mt: 0.5 } } { ...getTabsProps() }>
|
|
26
|
-
<Tab label={ __( 'General', 'elementor' ) } { ...getTabProps( 'settings' ) } />
|
|
27
|
-
<Tab label={ __( 'Style', 'elementor' ) } { ...getTabProps( 'style' ) } />
|
|
28
|
-
</Tabs>
|
|
29
|
-
<Divider />
|
|
30
|
-
</Stack>
|
|
31
|
-
<TabPanel { ...getTabPanelProps( 'settings' ) } disablePadding>
|
|
32
|
-
<SettingsTab />
|
|
33
|
-
</TabPanel>
|
|
34
|
-
<TabPanel { ...getTabPanelProps( 'style' ) } disablePadding>
|
|
35
|
-
<StyleTab />
|
|
36
|
-
</TabPanel>
|
|
37
|
-
</Stack>
|
|
38
|
-
</ScrollProvider>
|
|
20
|
+
<PanelTabContent />
|
|
39
21
|
</Fragment>
|
|
40
22
|
);
|
|
41
23
|
};
|
|
24
|
+
|
|
25
|
+
const PanelTabContent = () => {
|
|
26
|
+
const defaultComponentTab = 'settings';
|
|
27
|
+
|
|
28
|
+
const [ currentTab, setCurrentTab ] = useStateByElement< TabValue >( 'tab', defaultComponentTab );
|
|
29
|
+
const { getTabProps, getTabPanelProps, getTabsProps } = useTabs< TabValue >( currentTab );
|
|
30
|
+
return (
|
|
31
|
+
<ScrollProvider>
|
|
32
|
+
<Stack direction="column" sx={ { width: '100%' } }>
|
|
33
|
+
<Stack sx={ { ...stickyHeaderStyles, top: 0 } }>
|
|
34
|
+
<Tabs
|
|
35
|
+
variant="fullWidth"
|
|
36
|
+
size="small"
|
|
37
|
+
sx={ { mt: 0.5 } }
|
|
38
|
+
{ ...getTabsProps() }
|
|
39
|
+
onChange={ ( _: unknown, newValue: TabValue ) => {
|
|
40
|
+
getTabsProps().onChange( _, newValue );
|
|
41
|
+
setCurrentTab( newValue );
|
|
42
|
+
} }
|
|
43
|
+
>
|
|
44
|
+
<Tab label={ __( 'General', 'elementor' ) } { ...getTabProps( 'settings' ) } />
|
|
45
|
+
<Tab label={ __( 'Style', 'elementor' ) } { ...getTabProps( 'style' ) } />
|
|
46
|
+
</Tabs>
|
|
47
|
+
<Divider />
|
|
48
|
+
</Stack>
|
|
49
|
+
<TabPanel { ...getTabPanelProps( 'settings' ) } disablePadding>
|
|
50
|
+
<SettingsTab />
|
|
51
|
+
</TabPanel>
|
|
52
|
+
<TabPanel { ...getTabPanelProps( 'style' ) } disablePadding>
|
|
53
|
+
<StyleTab />
|
|
54
|
+
</TabPanel>
|
|
55
|
+
</Stack>
|
|
56
|
+
</ScrollProvider>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type PropsWithChildren, useId
|
|
2
|
+
import { type PropsWithChildren, useId } from 'react';
|
|
3
3
|
import { Collapse, Divider, ListItemButton, ListItemText, Stack } from '@elementor/ui';
|
|
4
4
|
|
|
5
|
+
import { useStateByElement } from '../hooks/use-state-by-element';
|
|
5
6
|
import { CollapseIcon } from './collapse-icon';
|
|
6
7
|
|
|
7
8
|
type Props = PropsWithChildren< {
|
|
@@ -10,7 +11,7 @@ type Props = PropsWithChildren< {
|
|
|
10
11
|
} >;
|
|
11
12
|
|
|
12
13
|
export function Section( { title, children, defaultExpanded = false }: Props ) {
|
|
13
|
-
const [ isOpen, setIsOpen ] =
|
|
14
|
+
const [ isOpen, setIsOpen ] = useStateByElement( title, !! defaultExpanded );
|
|
14
15
|
|
|
15
16
|
const id = useId();
|
|
16
17
|
const labelId = `label-${ id }`;
|
|
@@ -21,7 +22,7 @@ export function Section( { title, children, defaultExpanded = false }: Props ) {
|
|
|
21
22
|
<ListItemButton
|
|
22
23
|
id={ labelId }
|
|
23
24
|
aria-controls={ contentId }
|
|
24
|
-
onClick={ () => setIsOpen(
|
|
25
|
+
onClick={ () => setIsOpen( ! isOpen ) }
|
|
25
26
|
sx={ { '&:hover': { backgroundColor: 'transparent' } } }
|
|
26
27
|
>
|
|
27
28
|
<ListItemText
|
|
@@ -5,11 +5,12 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
|
|
6
6
|
import { useStylesInheritanceField } from '../../../contexts/styles-inheritance-context';
|
|
7
7
|
import { StylesField } from '../../../controls-registry/styles-field';
|
|
8
|
+
import { isExperimentActive } from '../../../sync/is-experiment-active';
|
|
8
9
|
import { ControlLabel } from '../../control-label';
|
|
9
10
|
|
|
10
|
-
type Displays = 'block' | 'flex' | 'inline-block' | 'inline-flex';
|
|
11
|
+
type Displays = 'block' | 'flex' | 'inline-block' | 'inline-flex' | 'none';
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
+
const displayFieldItems: ToggleButtonGroupItem< Displays >[] = [
|
|
13
14
|
{
|
|
14
15
|
value: 'block',
|
|
15
16
|
renderContent: () => __( 'Block', 'elementor' ),
|
|
@@ -28,22 +29,35 @@ const displayFieldOptions: ToggleButtonGroupItem< Displays >[] = [
|
|
|
28
29
|
label: __( 'Inline-block', 'elementor' ),
|
|
29
30
|
showTooltip: true,
|
|
30
31
|
},
|
|
31
|
-
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
export const DisplayField = () => {
|
|
35
|
+
const isDisplayNoneFeatureActive = isExperimentActive( 'e_v_3_30' );
|
|
36
|
+
const items = [ ...displayFieldItems ];
|
|
37
|
+
|
|
38
|
+
if ( isDisplayNoneFeatureActive ) {
|
|
39
|
+
items.push( {
|
|
40
|
+
value: 'none',
|
|
41
|
+
renderContent: () => __( 'None', 'elementor' ),
|
|
42
|
+
label: __( 'None', 'elementor' ),
|
|
43
|
+
showTooltip: true,
|
|
44
|
+
} );
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
items.push( {
|
|
32
48
|
value: 'inline-flex',
|
|
33
49
|
renderContent: () => __( 'In-flx', 'elementor' ),
|
|
34
50
|
label: __( 'Inline-flex', 'elementor' ),
|
|
35
51
|
showTooltip: true,
|
|
36
|
-
}
|
|
37
|
-
];
|
|
52
|
+
} );
|
|
38
53
|
|
|
39
|
-
export const DisplayField = () => {
|
|
40
54
|
const placeholder = useDisplayPlaceholderValue();
|
|
41
55
|
|
|
42
56
|
return (
|
|
43
57
|
<StylesField bind="display" placeholder={ placeholder }>
|
|
44
58
|
<Stack gap={ 0.75 }>
|
|
45
59
|
<ControlLabel>{ __( 'Display', 'elementor' ) }</ControlLabel>
|
|
46
|
-
<ToggleControl options={
|
|
60
|
+
<ToggleControl options={ items } maxItems={ 4 } fullWidth={ true } />
|
|
47
61
|
</Stack>
|
|
48
62
|
</StylesField>
|
|
49
63
|
);
|
|
@@ -5,7 +5,7 @@ import { useSessionStorage } from '@elementor/session';
|
|
|
5
5
|
import { useStyle } from '../../../contexts/style-context';
|
|
6
6
|
import { useStylesField } from '../../../hooks/use-styles-field';
|
|
7
7
|
import { useStylesFields } from '../../../hooks/use-styles-fields';
|
|
8
|
-
import {
|
|
8
|
+
import { isExperimentActive } from '../../../sync/is-experiment-active';
|
|
9
9
|
import { PanelDivider } from '../../panel-divider';
|
|
10
10
|
import { SectionContent } from '../../section-content';
|
|
11
11
|
import { DimensionsField } from './dimensions-field';
|
|
@@ -38,7 +38,7 @@ export const PositionSection = () => {
|
|
|
38
38
|
] );
|
|
39
39
|
|
|
40
40
|
const [ dimensionsValuesFromHistory, updateDimensionsHistory, clearDimensionsHistory ] = usePersistDimensions();
|
|
41
|
-
const
|
|
41
|
+
const isCssIdFeatureActive = isExperimentActive( 'e_v_3_30' );
|
|
42
42
|
|
|
43
43
|
const onPositionChange = ( newPosition: string | null, previousPosition: string | null | undefined ) => {
|
|
44
44
|
if ( newPosition === 'static' ) {
|
|
@@ -71,7 +71,7 @@ export const PositionSection = () => {
|
|
|
71
71
|
</>
|
|
72
72
|
) : null }
|
|
73
73
|
|
|
74
|
-
{
|
|
74
|
+
{ isCssIdFeatureActive && (
|
|
75
75
|
<>
|
|
76
76
|
<PanelDivider />
|
|
77
77
|
<OffsetField />
|
|
@@ -20,7 +20,7 @@ export const FontFamilyField = () => {
|
|
|
20
20
|
<Grid item xs={ 6 }>
|
|
21
21
|
<ControlLabel>{ __( 'Font family', 'elementor' ) }</ControlLabel>
|
|
22
22
|
</Grid>
|
|
23
|
-
<Grid item xs={ 6 } sx={ {
|
|
23
|
+
<Grid item xs={ 6 } sx={ { minWidth: 0 } }>
|
|
24
24
|
<FontFamilyControl fontFamilies={ fontFamilies } />
|
|
25
25
|
</Grid>
|
|
26
26
|
</Grid>
|
|
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import { type FontCategory } from '@elementor/editor-controls';
|
|
3
3
|
import { __ } from '@wordpress/i18n';
|
|
4
4
|
|
|
5
|
-
import { getElementorConfig } from '../../../../sync/get-elementor-
|
|
5
|
+
import { getElementorConfig } from '../../../../sync/get-elementor-globals';
|
|
6
6
|
|
|
7
7
|
const supportedCategories: Record< string, string > = {
|
|
8
8
|
system: __( 'System', 'elementor' ),
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useTheme } from '@elementor/ui';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getElementorFrontendConfig } from '../sync/get-elementor-globals';
|
|
4
4
|
|
|
5
5
|
export function useDirection() {
|
|
6
|
-
const theme = useTheme()
|
|
7
|
-
extendedWindow: ExtendedWindow = window;
|
|
6
|
+
const theme = useTheme();
|
|
8
7
|
|
|
9
8
|
const isUiRtl = 'rtl' === theme.direction,
|
|
10
|
-
isSiteRtl = !!
|
|
9
|
+
isSiteRtl = !! getElementorFrontendConfig()?.is_rtl;
|
|
11
10
|
|
|
12
11
|
return { isSiteRtl, isUiRtl };
|
|
13
12
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { getSessionStorageItem, setSessionStorageItem } from '@elementor/session';
|
|
3
|
+
|
|
4
|
+
import { useElement } from '../contexts/element-context';
|
|
5
|
+
|
|
6
|
+
export const useStateByElement = < T >( key: string, initialValue: T ) => {
|
|
7
|
+
const { element } = useElement();
|
|
8
|
+
const lookup = `elementor/editor-state/${ element.id }/${ key }`;
|
|
9
|
+
const storedValue = getSessionStorageItem< T >( lookup );
|
|
10
|
+
const [ value, setValue ] = useState( storedValue ?? initialValue );
|
|
11
|
+
|
|
12
|
+
const doUpdate = ( newValue: T ) => {
|
|
13
|
+
setSessionStorageItem( lookup, newValue );
|
|
14
|
+
setValue( newValue );
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return [ value, doUpdate ] as const;
|
|
18
|
+
};
|
|
@@ -8,7 +8,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
import { StyleIndicator } from '../components/style-indicator';
|
|
9
9
|
import { useStyle } from '../contexts/style-context';
|
|
10
10
|
import { useStylesInheritanceField } from '../contexts/styles-inheritance-context';
|
|
11
|
-
import {
|
|
11
|
+
import { isExperimentActive } from '../sync/is-experiment-active';
|
|
12
12
|
import { StyleIndicatorInfotip } from './styles-inheritance-infotip';
|
|
13
13
|
|
|
14
14
|
export const StylesInheritanceIndicator = () => {
|
|
@@ -41,7 +41,7 @@ export const StylesInheritanceIndicator = () => {
|
|
|
41
41
|
const label: string = getLabel( { isFinalValue, hasValue } );
|
|
42
42
|
const variantType = getVariant( { isFinalValue, hasValue, currentStyleProvider } );
|
|
43
43
|
|
|
44
|
-
const
|
|
44
|
+
const eIndicationsPopover = isExperimentActive( 'e_indications_popover' );
|
|
45
45
|
|
|
46
46
|
if ( ! eIndicationsPopover ) {
|
|
47
47
|
return <StyleIndicator variant={ variantType } aria-label={ label } />;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ExtendedWindow } from './types';
|
|
2
|
+
|
|
3
|
+
export const getElementorConfig = () => {
|
|
4
|
+
const extendedWindow = window as unknown as ExtendedWindow;
|
|
5
|
+
|
|
6
|
+
return extendedWindow.elementor?.config ?? {};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const getElementorFrontendConfig = () => {
|
|
10
|
+
const extendedWindow = window as unknown as ExtendedWindow;
|
|
11
|
+
|
|
12
|
+
return extendedWindow.elementorFrontend?.config ?? {};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const getElementorCommonConfig = () => {
|
|
16
|
+
const extendedWindow = window as unknown as ExtendedWindow;
|
|
17
|
+
|
|
18
|
+
return extendedWindow.elementorCommon?.config ?? {};
|
|
19
|
+
};
|
package/src/sync/types.ts
CHANGED
|
@@ -33,10 +33,7 @@ export type ExtendedWindow = Window & {
|
|
|
33
33
|
};
|
|
34
34
|
elementorCommon?: {
|
|
35
35
|
config?: {
|
|
36
|
-
experimentalFeatures?:
|
|
37
|
-
e_indications_popover?: boolean;
|
|
38
|
-
e_css_id?: boolean;
|
|
39
|
-
};
|
|
36
|
+
experimentalFeatures?: Record< string, boolean >;
|
|
40
37
|
};
|
|
41
38
|
};
|
|
42
39
|
elementorFrontend?: {
|