@elementor/editor-editing-panel 4.5.0-1180 → 4.5.0-1181

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-editing-panel",
3
- "version": "4.5.0-1180",
3
+ "version": "4.5.0-1181",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,32 +39,32 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "4.5.0-1180",
43
- "@elementor/editor-canvas": "4.5.0-1180",
44
- "@elementor/editor-controls": "4.5.0-1180",
45
- "@elementor/editor-current-user": "4.5.0-1180",
46
- "@elementor/editor-documents": "4.5.0-1180",
47
- "@elementor/editor-elements": "4.5.0-1180",
48
- "@elementor/editor-interactions": "4.5.0-1180",
49
- "@elementor/editor-notifications": "4.5.0-1180",
50
- "@elementor/editor-panels": "4.5.0-1180",
51
- "@elementor/editor-props": "4.5.0-1180",
52
- "@elementor/editor-responsive": "4.5.0-1180",
53
- "@elementor/editor-styles": "4.5.0-1180",
54
- "@elementor/editor-styles-repository": "4.5.0-1180",
55
- "@elementor/editor-ui": "4.5.0-1180",
56
- "@elementor/editor-v1-adapters": "4.5.0-1180",
57
- "@elementor/http-client": "4.5.0-1180",
42
+ "@elementor/editor": "4.5.0-1181",
43
+ "@elementor/editor-canvas": "4.5.0-1181",
44
+ "@elementor/editor-controls": "4.5.0-1181",
45
+ "@elementor/editor-current-user": "4.5.0-1181",
46
+ "@elementor/editor-documents": "4.5.0-1181",
47
+ "@elementor/editor-elements": "4.5.0-1181",
48
+ "@elementor/editor-interactions": "4.5.0-1181",
49
+ "@elementor/editor-notifications": "4.5.0-1181",
50
+ "@elementor/editor-panels": "4.5.0-1181",
51
+ "@elementor/editor-props": "4.5.0-1181",
52
+ "@elementor/editor-responsive": "4.5.0-1181",
53
+ "@elementor/editor-styles": "4.5.0-1181",
54
+ "@elementor/editor-styles-repository": "4.5.0-1181",
55
+ "@elementor/editor-ui": "4.5.0-1181",
56
+ "@elementor/editor-v1-adapters": "4.5.0-1181",
57
+ "@elementor/http-client": "4.5.0-1181",
58
58
  "@elementor/icons": "~1.78.1",
59
- "@elementor/editor-variables": "4.5.0-1180",
60
- "@elementor/locations": "4.5.0-1180",
61
- "@elementor/menus": "4.5.0-1180",
62
- "@elementor/query": "4.5.0-1180",
63
- "@elementor/schema": "4.5.0-1180",
64
- "@elementor/session": "4.5.0-1180",
59
+ "@elementor/editor-variables": "4.5.0-1181",
60
+ "@elementor/locations": "4.5.0-1181",
61
+ "@elementor/menus": "4.5.0-1181",
62
+ "@elementor/query": "4.5.0-1181",
63
+ "@elementor/schema": "4.5.0-1181",
64
+ "@elementor/session": "4.5.0-1181",
65
65
  "@elementor/ui": "1.41.4",
66
- "@elementor/utils": "4.5.0-1180",
67
- "@elementor/wp-media": "4.5.0-1180",
66
+ "@elementor/utils": "4.5.0-1181",
67
+ "@elementor/wp-media": "4.5.0-1181",
68
68
  "@wordpress/i18n": "^5.13.0"
69
69
  },
70
70
  "peerDependencies": {
@@ -38,6 +38,7 @@ import {
38
38
  type ValidationEvent,
39
39
  type ValidationResult,
40
40
  } from '../creatable-autocomplete';
41
+ import { StyleTabHeaderSlot } from '../style-tab-header-location';
41
42
  import { CssClassItem } from './css-class-item';
42
43
  import { MissingClassesAlert } from './missing-classes-alert';
43
44
  import {
@@ -82,6 +83,7 @@ export const { Slot: ClassSelectorActionsSlot, inject: injectIntoClassSelectorAc
82
83
  */
83
84
 
84
85
  export function CssClassSelector() {
86
+ const { element } = useElement();
85
87
  const options = useOptions();
86
88
 
87
89
  const { id: activeId, setId: setActiveId } = useStyle();
@@ -117,6 +119,7 @@ export function CssClassSelector() {
117
119
  { __( 'Classes', 'elementor' ) }
118
120
  </FormLabel>
119
121
  <Stack direction="row" gap={ 1 }>
122
+ <StyleTabHeaderSlot elementId={ element.id } />
120
123
  <ClassSelectorActionsSlot />
121
124
  </Stack>
122
125
  </Stack>
@@ -0,0 +1,11 @@
1
+ import { createLocation } from '@elementor/locations';
2
+
3
+ export type CustomCssHeaderProps = {
4
+ elementId: string;
5
+ };
6
+
7
+ export const {
8
+ Slot: CustomCssHeaderSlot,
9
+ inject: injectIntoCustomCssHeader,
10
+ useInjections: useCustomCssHeaderInjections,
11
+ } = createLocation< CustomCssHeaderProps >();
@@ -9,11 +9,20 @@ type Props = PropsWithChildren< {
9
9
  title: string;
10
10
  defaultExpanded?: boolean;
11
11
  titleEnd?: CollapsibleValue< ReactNode | string >;
12
+ titleActions?: ReactNode;
12
13
  unmountOnExit?: boolean;
13
14
  action?: { component: ReactNode; onClick: () => void };
14
15
  } >;
15
16
 
16
- export function Section( { title, children, defaultExpanded = false, titleEnd, unmountOnExit = true, action }: Props ) {
17
+ export function Section( {
18
+ title,
19
+ children,
20
+ defaultExpanded = false,
21
+ titleEnd,
22
+ titleActions,
23
+ unmountOnExit = true,
24
+ action,
25
+ }: Props ) {
17
26
  const [ isOpen, setIsOpen ] = useStateByElement( title, !! defaultExpanded );
18
27
  const ref = useRef< HTMLElement >( null );
19
28
  const isDisabled = !! action;
@@ -46,6 +55,15 @@ export function Section( { title, children, defaultExpanded = false, titleEnd, u
46
55
  sx={ { flexGrow: 0, flexShrink: 1, marginInlineEnd: 1 } }
47
56
  />
48
57
  { getCollapsibleValue( titleEnd, isOpen ) }
58
+ { titleActions && (
59
+ <Stack
60
+ direction="row"
61
+ alignItems="center"
62
+ onClick={ ( event: React.MouseEvent ) => event.stopPropagation() }
63
+ >
64
+ { titleActions }
65
+ </Stack>
66
+ ) }
49
67
  </Stack>
50
68
  { action?.component }
51
69
  <CollapseIcon
@@ -0,0 +1,29 @@
1
+ import { type ComponentType, createElement } from 'react';
2
+ import { type ElementID } from '@elementor/editor-elements';
3
+ import { createLocation, type InjectArgs } from '@elementor/locations';
4
+
5
+ export type StyleSectionHeaderProps = {
6
+ elementId: ElementID;
7
+ sectionName: string;
8
+ };
9
+
10
+ const { Slot: StyleSectionHeaderSlot, inject: injectStyleSectionHeader } = createLocation< StyleSectionHeaderProps >();
11
+
12
+ type StyleSectionHeaderInjectArgs = Pick< InjectArgs< StyleSectionHeaderProps >, 'id' | 'component' > & {
13
+ sections?: string[];
14
+ options?: InjectArgs< StyleSectionHeaderProps >[ 'options' ];
15
+ };
16
+
17
+ export const injectIntoStyleSectionHeader = ( { id, component, sections, options }: StyleSectionHeaderInjectArgs ) => {
18
+ const filteredComponent: ComponentType< StyleSectionHeaderProps > = ( props ) => {
19
+ if ( sections && ! sections.includes( props.sectionName ) ) {
20
+ return null;
21
+ }
22
+
23
+ return createElement( component, props );
24
+ };
25
+
26
+ injectStyleSectionHeader( { id, component: filteredComponent, options } );
27
+ };
28
+
29
+ export { StyleSectionHeaderSlot };
@@ -0,0 +1,12 @@
1
+ import { type ElementID } from '@elementor/editor-elements';
2
+ import { createLocation } from '@elementor/locations';
3
+
4
+ export type StyleTabHeaderProps = {
5
+ elementId: ElementID;
6
+ };
7
+
8
+ export const {
9
+ Slot: StyleTabHeaderSlot,
10
+ inject: injectIntoStyleTabHeader,
11
+ useInjections: useStyleTabHeaderInjections,
12
+ } = createLocation< StyleTabHeaderProps >();
@@ -1,8 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import type { ReactNode } from 'react';
3
3
 
4
+ import { useElement } from '../contexts/element-context';
4
5
  import { useDefaultPanelSettings } from '../hooks/use-default-panel-settings';
5
6
  import { Section } from './section';
7
+ import { StyleSectionHeaderSlot } from './style-section-header-location';
6
8
  import { getStylesInheritanceIndicators } from './style-tab-collapsible-content';
7
9
 
8
10
  type SectionType = {
@@ -16,6 +18,7 @@ type Props = { section: SectionType; fields?: string[]; unmountOnExit?: boolean
16
18
 
17
19
  export const StyleTabSection = ( { section, fields = [], unmountOnExit = true }: Props ) => {
18
20
  const { component, name, title, action } = section;
21
+ const { element } = useElement();
19
22
  const tabDefaults = useDefaultPanelSettings();
20
23
  const SectionComponent = component || ( () => <></> );
21
24
  const isExpanded = tabDefaults.defaultSectionsExpanded.style?.includes( name );
@@ -25,6 +28,9 @@ export const StyleTabSection = ( { section, fields = [], unmountOnExit = true }:
25
28
  title={ title }
26
29
  defaultExpanded={ isExpanded }
27
30
  titleEnd={ getStylesInheritanceIndicators( fields ) }
31
+ titleActions={
32
+ element ? <StyleSectionHeaderSlot elementId={ element.id } sectionName={ name } /> : undefined
33
+ }
28
34
  unmountOnExit={ unmountOnExit }
29
35
  action={ action }
30
36
  >
@@ -87,7 +87,7 @@ const controlTypes = {
87
87
  toggle: { component: ToggleControl, layout: 'full', propTypeUtil: stringPropTypeUtil },
88
88
  'date-time': { component: DateTimeControl, layout: 'full', propTypeUtil: DateTimePropTypeUtil },
89
89
  video: { component: VideoMediaControl, layout: 'full', propTypeUtil: videoSrcPropTypeUtil },
90
- 'inline-editing': { component: InlineEditingControl, layout: 'full', propTypeUtil: escapedHtmlPropTypeUtil },
90
+ 'inline-editing': { component: InlineEditingControl, layout: 'custom', propTypeUtil: escapedHtmlPropTypeUtil },
91
91
  email: { component: EmailFormActionControl, layout: 'custom', propTypeUtil: emailsPropTypeUtil },
92
92
  'date-range': {
93
93
  component: DateRangeControl,
package/src/index.ts CHANGED
@@ -28,6 +28,13 @@ export { PseudoStateMenuItems } from './components/style-states/pseudo-state-men
28
28
  export { usePseudoStates } from './components/style-states/use-pseudo-states';
29
29
  export { injectIntoGridFields } from './components/style-sections/layout-section/layout-section';
30
30
  export { StyleTabSection } from './components/style-tab-section';
31
+ export {
32
+ CustomCssHeaderSlot,
33
+ injectIntoCustomCssHeader,
34
+ type CustomCssHeaderProps,
35
+ } from './components/custom-css-header-location';
36
+ export { injectIntoStyleSectionHeader, type StyleSectionHeaderProps } from './components/style-section-header-location';
37
+ export { injectIntoStyleTabHeader, type StyleTabHeaderProps } from './components/style-tab-header-location';
31
38
  export { ClassesPropProvider, useClassesProp } from './contexts/classes-prop-context';
32
39
  export { ElementProvider, useElement } from './contexts/element-context';
33
40
  export { StyleProvider, useStyle } from './contexts/style-context';
package/src/init.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { injectIntoLogic } from '@elementor/editor';
2
+ import { init as initEditorControls } from '@elementor/editor-controls';
2
3
  import { registerPanel } from '@elementor/editor-panels';
3
4
  import { blockCommand } from '@elementor/editor-v1-adapters';
4
5
 
@@ -12,6 +13,8 @@ import { init as initStylesInheritance } from './styles-inheritance/init';
12
13
  import { isAtomicWidgetSelected } from './sync/is-atomic-widget-selected';
13
14
 
14
15
  export function init() {
16
+ initEditorControls();
17
+
15
18
  registerPanel( panel );
16
19
  blockV1Panel();
17
20