@elementor/editor-editing-panel 4.4.0-1086 → 4.4.0-1088
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 +34 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +118 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/controls-registry/controls-registry.tsx +2 -0
- package/src/controls-registry/settings-field.tsx +41 -3
- package/src/utils/is-responsive-prop-type.ts +19 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "4.4.0-
|
|
3
|
+
"version": "4.4.0-1088",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,31 +39,31 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "4.4.0-
|
|
43
|
-
"@elementor/editor-canvas": "4.4.0-
|
|
44
|
-
"@elementor/editor-controls": "4.4.0-
|
|
45
|
-
"@elementor/editor-documents": "4.4.0-
|
|
46
|
-
"@elementor/editor-elements": "4.4.0-
|
|
47
|
-
"@elementor/editor-interactions": "4.4.0-
|
|
48
|
-
"@elementor/editor-notifications": "4.4.0-
|
|
49
|
-
"@elementor/editor-panels": "4.4.0-
|
|
50
|
-
"@elementor/editor-props": "4.4.0-
|
|
51
|
-
"@elementor/editor-responsive": "4.4.0-
|
|
52
|
-
"@elementor/editor-styles": "4.4.0-
|
|
53
|
-
"@elementor/editor-styles-repository": "4.4.0-
|
|
54
|
-
"@elementor/editor-ui": "4.4.0-
|
|
55
|
-
"@elementor/editor-v1-adapters": "4.4.0-
|
|
56
|
-
"@elementor/http-client": "4.4.0-
|
|
42
|
+
"@elementor/editor": "4.4.0-1088",
|
|
43
|
+
"@elementor/editor-canvas": "4.4.0-1088",
|
|
44
|
+
"@elementor/editor-controls": "4.4.0-1088",
|
|
45
|
+
"@elementor/editor-documents": "4.4.0-1088",
|
|
46
|
+
"@elementor/editor-elements": "4.4.0-1088",
|
|
47
|
+
"@elementor/editor-interactions": "4.4.0-1088",
|
|
48
|
+
"@elementor/editor-notifications": "4.4.0-1088",
|
|
49
|
+
"@elementor/editor-panels": "4.4.0-1088",
|
|
50
|
+
"@elementor/editor-props": "4.4.0-1088",
|
|
51
|
+
"@elementor/editor-responsive": "4.4.0-1088",
|
|
52
|
+
"@elementor/editor-styles": "4.4.0-1088",
|
|
53
|
+
"@elementor/editor-styles-repository": "4.4.0-1088",
|
|
54
|
+
"@elementor/editor-ui": "4.4.0-1088",
|
|
55
|
+
"@elementor/editor-v1-adapters": "4.4.0-1088",
|
|
56
|
+
"@elementor/http-client": "4.4.0-1088",
|
|
57
57
|
"@elementor/icons": "~1.75.1",
|
|
58
|
-
"@elementor/editor-variables": "4.4.0-
|
|
59
|
-
"@elementor/locations": "4.4.0-
|
|
60
|
-
"@elementor/menus": "4.4.0-
|
|
61
|
-
"@elementor/query": "4.4.0-
|
|
62
|
-
"@elementor/schema": "4.4.0-
|
|
63
|
-
"@elementor/session": "4.4.0-
|
|
58
|
+
"@elementor/editor-variables": "4.4.0-1088",
|
|
59
|
+
"@elementor/locations": "4.4.0-1088",
|
|
60
|
+
"@elementor/menus": "4.4.0-1088",
|
|
61
|
+
"@elementor/query": "4.4.0-1088",
|
|
62
|
+
"@elementor/schema": "4.4.0-1088",
|
|
63
|
+
"@elementor/session": "4.4.0-1088",
|
|
64
64
|
"@elementor/ui": "1.37.5",
|
|
65
|
-
"@elementor/utils": "4.4.0-
|
|
66
|
-
"@elementor/wp-media": "4.4.0-
|
|
65
|
+
"@elementor/utils": "4.4.0-1088",
|
|
66
|
+
"@elementor/wp-media": "4.4.0-1088",
|
|
67
67
|
"@wordpress/i18n": "^5.13.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
InlineEditingControl,
|
|
11
11
|
KeyValueControl,
|
|
12
12
|
LinkControl,
|
|
13
|
+
NoticeControl,
|
|
13
14
|
NumberControl,
|
|
14
15
|
QueryChipsControl,
|
|
15
16
|
QueryControl,
|
|
@@ -97,6 +98,7 @@ const controlTypes = {
|
|
|
97
98
|
propTypeUtil: timeRangePropTypeUtil,
|
|
98
99
|
},
|
|
99
100
|
'attachment-type': { component: AttachmentTypeControl, layout: 'custom', propTypeUtil: stringPropTypeUtil },
|
|
101
|
+
notice: { component: NoticeControl, layout: 'full', propTypeUtil: stringPropTypeUtil },
|
|
100
102
|
} as const satisfies ControlRegistry;
|
|
101
103
|
|
|
102
104
|
export type ControlType = keyof typeof controlTypes;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { PropKeyProvider, PropProvider, type SetValueMeta } from '@elementor/editor-controls';
|
|
3
|
+
import { PropKeyProvider, PropProvider, type SetValueMeta, useBoundProp } from '@elementor/editor-controls';
|
|
4
4
|
import { setDocumentModifiedStatus } from '@elementor/editor-documents';
|
|
5
5
|
import { type ElementID, getElementLabel, getElementSettings, updateElementSettings } from '@elementor/editor-elements';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
type CreateOptions,
|
|
8
|
+
type PropKey,
|
|
9
|
+
type Props,
|
|
10
|
+
responsiveFallbackChain,
|
|
11
|
+
responsivePropTypeUtil,
|
|
12
|
+
} from '@elementor/editor-props';
|
|
13
|
+
import { type BreakpointId, useActiveBreakpoint, useBreakpoints } from '@elementor/editor-responsive';
|
|
7
14
|
import { undoable } from '@elementor/editor-v1-adapters';
|
|
8
15
|
import { __ } from '@wordpress/i18n';
|
|
9
16
|
|
|
10
17
|
import { useElement } from '../contexts/element-context';
|
|
18
|
+
import { isResponsivePropType } from '../utils/is-responsive-prop-type';
|
|
11
19
|
import {
|
|
12
20
|
extractDependencyEffect,
|
|
13
21
|
extractOrderedDependencies,
|
|
@@ -24,6 +32,7 @@ type SettingsFieldProps = {
|
|
|
24
32
|
};
|
|
25
33
|
|
|
26
34
|
const HISTORY_DEBOUNCE_WAIT = 800;
|
|
35
|
+
const DESKTOP_BREAKPOINT: BreakpointId = 'desktop';
|
|
27
36
|
|
|
28
37
|
export const SettingsField = ( { bind, children, propDisplayName }: SettingsFieldProps ) => {
|
|
29
38
|
const {
|
|
@@ -62,7 +71,36 @@ export const SettingsField = ( { bind, children, propDisplayName }: SettingsFiel
|
|
|
62
71
|
|
|
63
72
|
return (
|
|
64
73
|
<PropProvider propType={ propType } value={ value } setValue={ setValue } isDisabled={ isDisabled }>
|
|
65
|
-
<PropKeyProvider bind={ bind }>
|
|
74
|
+
<PropKeyProvider bind={ bind }>
|
|
75
|
+
{ isResponsivePropType( propsSchema[ bind ] ) ? (
|
|
76
|
+
<ResponsiveBinding>{ children }</ResponsiveBinding>
|
|
77
|
+
) : (
|
|
78
|
+
children
|
|
79
|
+
) }
|
|
80
|
+
</PropKeyProvider>
|
|
81
|
+
</PropProvider>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const ResponsiveBinding = ( { children }: { children: React.ReactNode } ) => {
|
|
86
|
+
const { value, setValue, propType, disabled } = useBoundProp( responsivePropTypeUtil );
|
|
87
|
+
const breakpoint = useActiveBreakpoint() ?? DESKTOP_BREAKPOINT;
|
|
88
|
+
const activeBreakpoints = ( useBreakpoints() ?? [] ).map( ( { id } ) => id );
|
|
89
|
+
|
|
90
|
+
const inherited = responsiveFallbackChain( breakpoint )
|
|
91
|
+
.filter( ( key ) => key !== breakpoint && activeBreakpoints.includes( key as BreakpointId ) )
|
|
92
|
+
.map( ( key ) => value?.[ key ] )
|
|
93
|
+
.find( ( entry ) => entry !== null && entry !== undefined );
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<PropProvider
|
|
97
|
+
propType={ propType }
|
|
98
|
+
value={ value }
|
|
99
|
+
setValue={ setValue }
|
|
100
|
+
placeholder={ { [ breakpoint ]: inherited } }
|
|
101
|
+
isDisabled={ () => disabled }
|
|
102
|
+
>
|
|
103
|
+
<PropKeyProvider bind={ breakpoint }>{ children }</PropKeyProvider>
|
|
66
104
|
</PropProvider>
|
|
67
105
|
);
|
|
68
106
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type PropType, type UnionPropType } from '@elementor/editor-props';
|
|
2
|
+
|
|
3
|
+
export function isResponsivePropType( propType: PropType | undefined ): boolean {
|
|
4
|
+
if ( ! propType ) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if ( 'key' in propType && propType.key === 'responsive' ) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if ( propType.kind === 'union' ) {
|
|
13
|
+
return Object.values( ( propType as UnionPropType ).prop_types ).some( ( inner ) =>
|
|
14
|
+
isResponsivePropType( inner )
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return false;
|
|
19
|
+
}
|