@elementor/editor-editing-panel 1.17.1 → 1.19.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 +72 -0
- package/dist/index.js +1014 -724
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +826 -536
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -11
- package/src/components/control-label-with-adornments.tsx +13 -0
- package/src/components/css-classes/css-class-item.tsx +32 -10
- package/src/components/css-classes/css-class-menu.tsx +25 -9
- package/src/components/css-classes/css-class-selector.tsx +13 -7
- package/src/components/editing-panel-hooks.tsx +0 -2
- package/src/components/editing-panel.tsx +2 -2
- package/src/components/multi-combobox.tsx +9 -4
- package/src/components/style-sections/border-section/border-radius-field.tsx +6 -5
- package/src/components/style-sections/position-section/dimensions-field.tsx +2 -2
- package/src/components/style-sections/spacing-section/spacing-section.tsx +4 -4
- package/src/components/style-sections/typography-section/font-family-field.tsx +2 -46
- package/src/components/style-sections/typography-section/font-style-field.tsx +1 -1
- package/src/components/style-sections/typography-section/hooks/use-font-families.ts +52 -0
- package/src/components/style-sections/typography-section/text-decoration-field.tsx +40 -89
- package/src/components/style-tab.tsx +34 -33
- package/src/contexts/styles-inheritance-context.tsx +80 -0
- package/src/controls-registry/control.tsx +3 -1
- package/src/controls-registry/styles-field.tsx +14 -4
- package/src/dynamics/components/dynamic-selection.tsx +111 -74
- package/src/hooks/use-styles-fields.ts +3 -4
- package/src/hooks/use-styles-rerender.ts +10 -0
- package/src/init.ts +6 -0
- package/src/styles-inheritance/styles-inheritance-indicator.tsx +70 -0
- package/src/sync/types.ts +1 -1
- package/src/hooks/use-close-editor-panel.ts +0 -23
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useBoundProp } from '@elementor/editor-controls';
|
|
3
|
+
import { ELEMENTS_STYLES_PROVIDER_KEY } from '@elementor/editor-styles-repository';
|
|
4
|
+
import { styled } from '@elementor/ui';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
|
|
7
|
+
import { useStyle } from '../contexts/style-context';
|
|
8
|
+
import { useStylesInheritanceField } from '../contexts/styles-inheritance-context';
|
|
9
|
+
import { useStylesField } from '../hooks/use-styles-field';
|
|
10
|
+
|
|
11
|
+
const Circle = styled( 'div', {
|
|
12
|
+
shouldForwardProp: ( prop ) => prop !== 'variant',
|
|
13
|
+
} )< { variant?: 'overridden' | 'local-affects' | 'global-affects' } >`
|
|
14
|
+
width: 5px;
|
|
15
|
+
height: 5px;
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
background-color: ${ ( { theme, variant } ) => {
|
|
18
|
+
switch ( variant ) {
|
|
19
|
+
case 'overridden':
|
|
20
|
+
return theme.palette.warning.main;
|
|
21
|
+
case 'global-affects':
|
|
22
|
+
return theme.palette.global.main;
|
|
23
|
+
case 'local-affects':
|
|
24
|
+
return theme.palette.primary.main;
|
|
25
|
+
default:
|
|
26
|
+
return theme.palette.text.secondary;
|
|
27
|
+
}
|
|
28
|
+
} };
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export const StylesInheritanceIndicator = () => {
|
|
32
|
+
const { bind } = useBoundProp();
|
|
33
|
+
const { id: currentStyleId, provider: currentStyleProvider, meta: currentStyleMeta } = useStyle();
|
|
34
|
+
const [ value ] = useStylesField( bind );
|
|
35
|
+
const inheritanceChain = useStylesInheritanceField( bind );
|
|
36
|
+
|
|
37
|
+
if ( ! inheritanceChain.length ) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const [ { styleId, styleVariant } ] = inheritanceChain;
|
|
42
|
+
|
|
43
|
+
const { breakpoint, state } = styleVariant.meta;
|
|
44
|
+
|
|
45
|
+
if (
|
|
46
|
+
styleId === currentStyleId &&
|
|
47
|
+
breakpoint === currentStyleMeta.breakpoint &&
|
|
48
|
+
state === currentStyleMeta.state
|
|
49
|
+
) {
|
|
50
|
+
return (
|
|
51
|
+
<Circle
|
|
52
|
+
aria-label={ __( 'This is the final value', 'elementor' ) }
|
|
53
|
+
variant={
|
|
54
|
+
currentStyleProvider?.key === ELEMENTS_STYLES_PROVIDER_KEY ? 'local-affects' : 'global-affects'
|
|
55
|
+
}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if ( value !== null && value !== undefined ) {
|
|
61
|
+
return (
|
|
62
|
+
<Circle
|
|
63
|
+
aria-label={ __( 'This value is overridden by another style', 'elementor' ) }
|
|
64
|
+
variant="overridden"
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return <Circle aria-label={ __( 'This has value from another style', 'elementor' ) } />;
|
|
70
|
+
};
|
package/src/sync/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ControlItem, type V1Element } from '@elementor/editor-elements';
|
|
2
2
|
import { type PropsSchema } from '@elementor/editor-props';
|
|
3
3
|
|
|
4
|
-
type SupportedFonts = 'system' | 'googlefonts' | '
|
|
4
|
+
export type SupportedFonts = 'system' | 'googlefonts' | 'custom';
|
|
5
5
|
|
|
6
6
|
type EnqueueFont = ( fontFamily: string, context?: 'preview' | 'editor' ) => void;
|
|
7
7
|
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { getSelectedElements, isElementInContainer, type V1Element } from '@elementor/editor-elements';
|
|
3
|
-
import { __privateListenTo as listenTo, type CommandEvent, commandStartEvent } from '@elementor/editor-v1-adapters';
|
|
4
|
-
|
|
5
|
-
import { usePanelActions } from '../panel';
|
|
6
|
-
import { isAtomicWidgetSelected } from '../sync/is-atomic-widget-selected';
|
|
7
|
-
|
|
8
|
-
export const useCloseEditorPanel = () => {
|
|
9
|
-
const { close } = usePanelActions();
|
|
10
|
-
|
|
11
|
-
return useEffect( () => {
|
|
12
|
-
return listenTo( commandStartEvent( 'document/elements/delete' ), ( e ) => {
|
|
13
|
-
const selectedElement = getSelectedElements()[ 0 ];
|
|
14
|
-
const { container: deletedContainer } = ( e as CommandEvent< { container: V1Element } > )?.args;
|
|
15
|
-
const isSelectedElementInDeletedContainer =
|
|
16
|
-
deletedContainer && selectedElement && isElementInContainer( selectedElement, deletedContainer );
|
|
17
|
-
|
|
18
|
-
if ( isSelectedElementInDeletedContainer && isAtomicWidgetSelected() ) {
|
|
19
|
-
close();
|
|
20
|
-
}
|
|
21
|
-
} );
|
|
22
|
-
}, [] ); // eslint-disable-line react-hooks/exhaustive-deps
|
|
23
|
-
};
|