@elementor/editor-controls 3.35.0-437 → 3.35.0-438

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-controls",
3
3
  "description": "This package contains the controls model and utils for the Elementor editor",
4
- "version": "3.35.0-437",
4
+ "version": "3.35.0-438",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,22 +40,22 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor-current-user": "3.35.0-437",
44
- "@elementor/editor-elements": "3.35.0-437",
45
- "@elementor/editor-props": "3.35.0-437",
46
- "@elementor/editor-responsive": "3.35.0-437",
47
- "@elementor/editor-ui": "3.35.0-437",
48
- "@elementor/editor-v1-adapters": "3.35.0-437",
49
- "@elementor/env": "3.35.0-437",
50
- "@elementor/http-client": "3.35.0-437",
43
+ "@elementor/editor-current-user": "3.35.0-438",
44
+ "@elementor/editor-elements": "3.35.0-438",
45
+ "@elementor/editor-props": "3.35.0-438",
46
+ "@elementor/editor-responsive": "3.35.0-438",
47
+ "@elementor/editor-ui": "3.35.0-438",
48
+ "@elementor/editor-v1-adapters": "3.35.0-438",
49
+ "@elementor/env": "3.35.0-438",
50
+ "@elementor/http-client": "3.35.0-438",
51
51
  "@elementor/icons": "^1.63.0",
52
- "@elementor/locations": "3.35.0-437",
53
- "@elementor/mixpanel": "3.35.0-437",
54
- "@elementor/query": "3.35.0-437",
55
- "@elementor/session": "3.35.0-437",
52
+ "@elementor/locations": "3.35.0-438",
53
+ "@elementor/mixpanel": "3.35.0-438",
54
+ "@elementor/query": "3.35.0-438",
55
+ "@elementor/session": "3.35.0-438",
56
56
  "@elementor/ui": "1.36.17",
57
- "@elementor/utils": "3.35.0-437",
58
- "@elementor/wp-media": "3.35.0-437",
57
+ "@elementor/utils": "3.35.0-438",
58
+ "@elementor/wp-media": "3.35.0-438",
59
59
  "@wordpress/i18n": "^5.13.0",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "dayjs": "^1.11.18",
@@ -13,6 +13,7 @@ import { EditItemPopover } from '../../components/control-repeater/items/edit-it
13
13
  import { RepeaterHeader } from '../../components/repeater/repeater-header';
14
14
  import { ControlAdornments } from '../../control-adornments/control-adornments';
15
15
  import { createControl } from '../../create-control';
16
+ import { useElementCanHaveChildren } from '../../hooks/use-element-can-have-children';
16
17
  import { initialRotateValue, initialScaleValue, initialSkewValue, initialTransformValue } from './initial-values';
17
18
  import { TransformContent } from './transform-content';
18
19
  import { TransformIcon } from './transform-icon';
@@ -25,10 +26,15 @@ export const TransformRepeaterControl = createControl( () => {
25
26
  const context = useBoundProp( transformPropTypeUtil );
26
27
  const headerRef = useRef< HTMLDivElement >( null );
27
28
  const popupState = usePopupState( { variant: 'popover' } );
29
+ const showChildrenPerspective = useElementCanHaveChildren();
28
30
 
29
31
  return (
30
32
  <PropProvider { ...context }>
31
- <TransformSettingsControl popupState={ popupState } anchorRef={ headerRef } />
33
+ <TransformSettingsControl
34
+ popupState={ popupState }
35
+ anchorRef={ headerRef }
36
+ showChildrenPerspective={ showChildrenPerspective }
37
+ />
32
38
  <PropKeyProvider bind={ 'transform-functions' }>
33
39
  <Repeater headerRef={ headerRef } propType={ context.propType } popupState={ popupState } />
34
40
  </PropKeyProvider>
@@ -14,9 +14,11 @@ const SIZE = 'tiny';
14
14
  export const TransformSettingsControl = ( {
15
15
  popupState,
16
16
  anchorRef,
17
+ showChildrenPerspective,
17
18
  }: {
18
19
  popupState: PopupState;
19
20
  anchorRef: React.RefObject< HTMLDivElement | null >;
21
+ showChildrenPerspective: boolean;
20
22
  } ) => {
21
23
  const popupProps = bindPopover( {
22
24
  ...popupState,
@@ -47,10 +49,14 @@ export const TransformSettingsControl = ( {
47
49
  <PropKeyProvider bind={ 'transform-origin' }>
48
50
  <TransformOriginControl />
49
51
  </PropKeyProvider>
50
- <Box sx={ { my: 0.5 } }>
51
- <Divider />
52
- </Box>
53
- <ChildrenPerspectiveControl />
52
+ { showChildrenPerspective && (
53
+ <>
54
+ <Box sx={ { my: 0.5 } }>
55
+ <Divider />
56
+ </Box>
57
+ <ChildrenPerspectiveControl />
58
+ </>
59
+ ) }
54
60
  </PopoverContent>
55
61
  </Popover>
56
62
  );
@@ -0,0 +1,17 @@
1
+ import { useMemo } from 'react';
2
+ import { getContainer, useSelectedElement } from '@elementor/editor-elements';
3
+
4
+ export const useElementCanHaveChildren = (): boolean => {
5
+ const { element } = useSelectedElement();
6
+ const elementId = element?.id || '';
7
+
8
+ return useMemo( () => {
9
+ const container = getContainer( elementId );
10
+
11
+ if ( ! container ) {
12
+ return false;
13
+ }
14
+
15
+ return container.model.get( 'elType' ) !== 'widget';
16
+ }, [ elementId ] );
17
+ };
package/src/index.ts CHANGED
@@ -81,3 +81,4 @@ export {
81
81
 
82
82
  // hooks
83
83
  export { useSyncExternalState } from './hooks/use-sync-external-state';
84
+ export { useElementCanHaveChildren } from './hooks/use-element-can-have-children';