@elementor/editor-editing-panel 4.2.0-929 → 4.2.0-931
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 +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +88 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +24 -24
- package/src/components/style-sections/layout-section/display-field.tsx +1 -8
- package/src/components/style-sections/layout-section/layout-section.tsx +2 -4
- package/src/dynamics/dynamic-transformer.ts +12 -9
- package/src/dynamics/types.ts +2 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-editing-panel",
|
|
3
|
-
"version": "4.2.0-
|
|
3
|
+
"version": "4.2.0-931",
|
|
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.2.0-
|
|
43
|
-
"@elementor/editor-canvas": "4.2.0-
|
|
44
|
-
"@elementor/editor-controls": "4.2.0-
|
|
45
|
-
"@elementor/editor-documents": "4.2.0-
|
|
46
|
-
"@elementor/editor-elements": "4.2.0-
|
|
47
|
-
"@elementor/editor-interactions": "4.2.0-
|
|
48
|
-
"@elementor/editor-notifications": "4.2.0-
|
|
49
|
-
"@elementor/editor-panels": "4.2.0-
|
|
50
|
-
"@elementor/editor-props": "4.2.0-
|
|
51
|
-
"@elementor/editor-responsive": "4.2.0-
|
|
52
|
-
"@elementor/editor-styles": "4.2.0-
|
|
53
|
-
"@elementor/editor-styles-repository": "4.2.0-
|
|
54
|
-
"@elementor/editor-ui": "4.2.0-
|
|
55
|
-
"@elementor/editor-v1-adapters": "4.2.0-
|
|
56
|
-
"@elementor/http-client": "4.2.0-
|
|
42
|
+
"@elementor/editor": "4.2.0-931",
|
|
43
|
+
"@elementor/editor-canvas": "4.2.0-931",
|
|
44
|
+
"@elementor/editor-controls": "4.2.0-931",
|
|
45
|
+
"@elementor/editor-documents": "4.2.0-931",
|
|
46
|
+
"@elementor/editor-elements": "4.2.0-931",
|
|
47
|
+
"@elementor/editor-interactions": "4.2.0-931",
|
|
48
|
+
"@elementor/editor-notifications": "4.2.0-931",
|
|
49
|
+
"@elementor/editor-panels": "4.2.0-931",
|
|
50
|
+
"@elementor/editor-props": "4.2.0-931",
|
|
51
|
+
"@elementor/editor-responsive": "4.2.0-931",
|
|
52
|
+
"@elementor/editor-styles": "4.2.0-931",
|
|
53
|
+
"@elementor/editor-styles-repository": "4.2.0-931",
|
|
54
|
+
"@elementor/editor-ui": "4.2.0-931",
|
|
55
|
+
"@elementor/editor-v1-adapters": "4.2.0-931",
|
|
56
|
+
"@elementor/http-client": "4.2.0-931",
|
|
57
57
|
"@elementor/icons": "~1.75.1",
|
|
58
|
-
"@elementor/editor-variables": "4.2.0-
|
|
59
|
-
"@elementor/locations": "4.2.0-
|
|
60
|
-
"@elementor/menus": "4.2.0-
|
|
61
|
-
"@elementor/query": "4.2.0-
|
|
62
|
-
"@elementor/schema": "4.2.0-
|
|
63
|
-
"@elementor/session": "4.2.0-
|
|
58
|
+
"@elementor/editor-variables": "4.2.0-931",
|
|
59
|
+
"@elementor/locations": "4.2.0-931",
|
|
60
|
+
"@elementor/menus": "4.2.0-931",
|
|
61
|
+
"@elementor/query": "4.2.0-931",
|
|
62
|
+
"@elementor/schema": "4.2.0-931",
|
|
63
|
+
"@elementor/session": "4.2.0-931",
|
|
64
64
|
"@elementor/ui": "1.37.5",
|
|
65
|
-
"@elementor/utils": "4.2.0-
|
|
66
|
-
"@elementor/wp-media": "4.2.0-
|
|
65
|
+
"@elementor/utils": "4.2.0-931",
|
|
66
|
+
"@elementor/wp-media": "4.2.0-931",
|
|
67
67
|
"@wordpress/i18n": "^5.13.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
2
|
import { type ToggleButtonGroupItem, ToggleControl } from '@elementor/editor-controls';
|
|
4
|
-
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
5
3
|
import { __ } from '@wordpress/i18n';
|
|
6
4
|
|
|
7
5
|
import { useStylesInheritanceChain } from '../../../contexts/styles-inheritance-context';
|
|
@@ -53,16 +51,11 @@ const displayFieldItems: ToggleButtonGroupItem< Displays >[] = [
|
|
|
53
51
|
|
|
54
52
|
export const DisplayField = () => {
|
|
55
53
|
const placeholder = useDisplayPlaceholderValue();
|
|
56
|
-
const isGridActive = isExperimentActive( 'e_css_grid' );
|
|
57
|
-
const items = useMemo(
|
|
58
|
-
() => ( isGridActive ? displayFieldItems : displayFieldItems.filter( ( item ) => item.value !== 'grid' ) ),
|
|
59
|
-
[ isGridActive ]
|
|
60
|
-
);
|
|
61
54
|
|
|
62
55
|
return (
|
|
63
56
|
<StylesField bind="display" propDisplayName={ DISPLAY_LABEL } placeholder={ placeholder }>
|
|
64
57
|
<StylesFieldLayout label={ DISPLAY_LABEL } direction="column">
|
|
65
|
-
<ToggleControl options={
|
|
58
|
+
<ToggleControl options={ displayFieldItems } maxItems={ 4 } fullWidth={ true } />
|
|
66
59
|
</StylesFieldLayout>
|
|
67
60
|
</StylesField>
|
|
68
61
|
);
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { ControlFormLabel } from '@elementor/editor-controls';
|
|
3
3
|
import { useParentElement } from '@elementor/editor-elements';
|
|
4
4
|
import { type StringPropValue } from '@elementor/editor-props';
|
|
5
|
-
import { isExperimentActive } from '@elementor/editor-v1-adapters';
|
|
6
5
|
import { __ } from '@wordpress/i18n';
|
|
7
6
|
|
|
8
7
|
import { useElement } from '../../../contexts/element-context';
|
|
@@ -38,7 +37,6 @@ export const LayoutSection = () => {
|
|
|
38
37
|
history: { propDisplayName: DISPLAY_LABEL },
|
|
39
38
|
} );
|
|
40
39
|
const displayPlaceholder = useDisplayPlaceholderValue();
|
|
41
|
-
const isGridExperimentActive = isExperimentActive( 'e_css_grid' );
|
|
42
40
|
const isDisplayFlex = shouldDisplayFlexFields( display, displayPlaceholder as StringPropValue );
|
|
43
41
|
const isDisplayGrid = 'grid' === ( display?.value ?? ( displayPlaceholder as StringPropValue )?.value );
|
|
44
42
|
const { element } = useElement();
|
|
@@ -64,8 +62,8 @@ export const LayoutSection = () => {
|
|
|
64
62
|
{ 'flex' === parentStyle?.display && (
|
|
65
63
|
<FlexChildFields parentStyleDirection={ getParentStyleDirection() } />
|
|
66
64
|
) }
|
|
67
|
-
{
|
|
68
|
-
{
|
|
65
|
+
{ isDisplayGrid && <GridFields /> }
|
|
66
|
+
{ 'grid' === parentStyle?.display && (
|
|
69
67
|
<GridChildFields parentStyleDirection={ getParentStyleDirection() } />
|
|
70
68
|
) }
|
|
71
69
|
</SectionContent>
|
|
@@ -9,12 +9,14 @@ type Dynamic = {
|
|
|
9
9
|
settings?: Props;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export const dynamicTransformer = createTransformer< Dynamic >( ( value, { propType } ) => {
|
|
12
|
+
export const dynamicTransformer = createTransformer< Dynamic >( ( value, { propType, renderContext } ) => {
|
|
13
13
|
if ( ! value?.name || ! isDynamicTagSupported( value.name ) ) {
|
|
14
14
|
return propType?.default ?? null;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const renderPostId = ( renderContext as { currentPostId?: number } | undefined )?.currentPostId;
|
|
18
|
+
|
|
19
|
+
return getDynamicValue( value.name, simpleTransform( value?.settings ?? {} ), renderPostId );
|
|
18
20
|
} );
|
|
19
21
|
|
|
20
22
|
// Temporary naive transformation until we'll have a `backendTransformer` that
|
|
@@ -29,7 +31,7 @@ function simpleTransform( props: Props ) {
|
|
|
29
31
|
return Object.fromEntries( transformed );
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
function getDynamicValue( name: string, settings: Record< string, unknown
|
|
34
|
+
function getDynamicValue( name: string, settings: Record< string, unknown >, renderPostId?: number ) {
|
|
33
35
|
const { dynamicTags } = window.elementor ?? {};
|
|
34
36
|
|
|
35
37
|
if ( ! dynamicTags ) {
|
|
@@ -43,6 +45,10 @@ function getDynamicValue( name: string, settings: Record< string, unknown > ) {
|
|
|
43
45
|
return null;
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
if ( renderPostId ) {
|
|
49
|
+
tag.editorRenderPostId = renderPostId;
|
|
50
|
+
}
|
|
51
|
+
|
|
46
52
|
return dynamicTags.loadTagDataFromCache( tag ) ?? null;
|
|
47
53
|
};
|
|
48
54
|
|
|
@@ -53,11 +59,8 @@ function getDynamicValue( name: string, settings: Record< string, unknown > ) {
|
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
return new Promise( ( resolve ) => {
|
|
56
|
-
dynamicTags.refreshCacheFromServer(
|
|
57
|
-
()
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
{ disableCache: true }
|
|
61
|
-
);
|
|
62
|
+
dynamicTags.refreshCacheFromServer( () => {
|
|
63
|
+
resolve( getTagValue() );
|
|
64
|
+
} );
|
|
62
65
|
} );
|
|
63
66
|
}
|
package/src/dynamics/types.ts
CHANGED
|
@@ -28,14 +28,10 @@ export type DynamicPropValue = TransformablePropValue<
|
|
|
28
28
|
{ name: string; settings?: Record< string, unknown > }
|
|
29
29
|
>;
|
|
30
30
|
|
|
31
|
-
export type RefreshCacheFromServerOptions = {
|
|
32
|
-
disableCache?: boolean;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
31
|
export type DynamicTagsManager = {
|
|
36
32
|
createTag: ( id: string, name: string, settings: Record< string, unknown > ) => TagInstance;
|
|
37
33
|
loadTagDataFromCache: ( tag: TagInstance ) => unknown;
|
|
38
|
-
refreshCacheFromServer: ( callback: () => void
|
|
34
|
+
refreshCacheFromServer: ( callback: () => void ) => void;
|
|
39
35
|
};
|
|
40
36
|
|
|
41
37
|
export type TagInstance = {
|
|
@@ -46,4 +42,5 @@ export type TagInstance = {
|
|
|
46
42
|
model: {
|
|
47
43
|
toJSON: () => Record< string, unknown >;
|
|
48
44
|
};
|
|
45
|
+
editorRenderPostId?: number;
|
|
49
46
|
};
|