@elementor/editor-components 3.35.0-479 → 3.35.0-481

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-components",
3
3
  "description": "Elementor editor components",
4
- "version": "3.35.0-479",
4
+ "version": "3.35.0-481",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,30 +40,30 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor": "3.35.0-479",
44
- "@elementor/editor-canvas": "3.35.0-479",
45
- "@elementor/editor-controls": "3.35.0-479",
46
- "@elementor/editor-documents": "3.35.0-479",
47
- "@elementor/editor-editing-panel": "3.35.0-479",
48
- "@elementor/editor-elements": "3.35.0-479",
49
- "@elementor/editor-elements-panel": "3.35.0-479",
50
- "@elementor/editor-mcp": "3.35.0-479",
51
- "@elementor/editor-panels": "3.35.0-479",
52
- "@elementor/editor-props": "3.35.0-479",
53
- "@elementor/editor-styles-repository": "3.35.0-479",
54
- "@elementor/editor-ui": "3.35.0-479",
55
- "@elementor/editor-v1-adapters": "3.35.0-479",
56
- "@elementor/http-client": "3.35.0-479",
43
+ "@elementor/editor": "3.35.0-481",
44
+ "@elementor/editor-canvas": "3.35.0-481",
45
+ "@elementor/editor-controls": "3.35.0-481",
46
+ "@elementor/editor-documents": "3.35.0-481",
47
+ "@elementor/editor-editing-panel": "3.35.0-481",
48
+ "@elementor/editor-elements": "3.35.0-481",
49
+ "@elementor/editor-elements-panel": "3.35.0-481",
50
+ "@elementor/editor-mcp": "3.35.0-481",
51
+ "@elementor/editor-panels": "3.35.0-481",
52
+ "@elementor/editor-props": "3.35.0-481",
53
+ "@elementor/editor-styles-repository": "3.35.0-481",
54
+ "@elementor/editor-ui": "3.35.0-481",
55
+ "@elementor/editor-v1-adapters": "3.35.0-481",
56
+ "@elementor/http-client": "3.35.0-481",
57
57
  "@elementor/icons": "^1.63.0",
58
- "@elementor/mixpanel": "3.35.0-479",
59
- "@elementor/query": "3.35.0-479",
60
- "@elementor/schema": "3.35.0-479",
61
- "@elementor/store": "3.35.0-479",
58
+ "@elementor/mixpanel": "3.35.0-481",
59
+ "@elementor/query": "3.35.0-481",
60
+ "@elementor/schema": "3.35.0-481",
61
+ "@elementor/store": "3.35.0-481",
62
62
  "@elementor/ui": "1.36.17",
63
- "@elementor/utils": "3.35.0-479",
63
+ "@elementor/utils": "3.35.0-481",
64
64
  "@wordpress/i18n": "^5.13.0",
65
- "@elementor/editor-notifications": "3.35.0-479",
66
- "@elementor/editor-current-user": "3.35.0-479"
65
+ "@elementor/editor-notifications": "3.35.0-481",
66
+ "@elementor/editor-current-user": "3.35.0-481"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "react": "^18.3.1",
package/src/api.ts CHANGED
@@ -100,21 +100,23 @@ export const apiClient = {
100
100
  },
101
101
  } )
102
102
  .then( ( res ) => res.data.data ),
103
- updateArchivedComponents: async ( componentIds: number[] ) =>
103
+ updateArchivedComponents: async ( componentIds: number[], status: DocumentSaveStatus ) =>
104
104
  await httpService()
105
105
  .post< { data: { failedIds: number[]; successIds: number[]; success: boolean } } >(
106
106
  `${ BASE_URL }/archive`,
107
107
  {
108
108
  componentIds,
109
+ status,
109
110
  }
110
111
  )
111
112
  .then( ( res ) => res.data.data ),
112
- updateComponentTitle: ( updatedComponentNames: UpdatedComponentName[] ) =>
113
+ updateComponentTitle: ( updatedComponentNames: UpdatedComponentName[], status: DocumentSaveStatus ) =>
113
114
  httpService()
114
115
  .post< { data: { failedIds: number[]; successIds: number[]; success: boolean } } >(
115
116
  `${ BASE_URL }/update-titles`,
116
117
  {
117
118
  components: updatedComponentNames,
119
+ status,
118
120
  }
119
121
  )
120
122
  .then( ( res ) => res.data.data ),
@@ -1,9 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { useSuppressedMessage } from '@elementor/editor-current-user';
3
3
  import { getV1DocumentsManager } from '@elementor/editor-documents';
4
+ import { PanelHeader } from '@elementor/editor-panels';
5
+ import { EllipsisWithTooltip } from '@elementor/editor-ui';
4
6
  import { ArrowLeftIcon, ComponentsFilledIcon } from '@elementor/icons';
5
7
  import { __getState as getState } from '@elementor/store';
6
- import { Box, Divider, IconButton, Stack, Tooltip, Typography } from '@elementor/ui';
8
+ import { Box, Divider, IconButton, Tooltip, Typography } from '@elementor/ui';
7
9
  import { __ } from '@wordpress/i18n';
8
10
 
9
11
  import { useNavigateBack } from '../../hooks/use-navigate-back';
@@ -51,31 +53,25 @@ export const ComponentPanelHeader = () => {
51
53
 
52
54
  return (
53
55
  <Box>
54
- <Stack
55
- direction="row"
56
- alignItems="center"
57
- justifyContent="space-between"
58
- sx={ { height: 48, pl: 1.5, pr: 2, py: 1 } }
59
- >
60
- <Stack direction="row" alignItems="center">
61
- <Tooltip title={ __( 'Back', 'elementor' ) }>
62
- <IconButton size="tiny" onClick={ onBack } aria-label={ __( 'Back', 'elementor' ) }>
63
- <ArrowLeftIcon fontSize="tiny" />
64
- </IconButton>
65
- </Tooltip>
66
- <Stack direction="row" alignItems="center" gap={ 0.5 }>
67
- <ComponentsFilledIcon fontSize="tiny" stroke="currentColor" />
68
- <Typography variant="caption" sx={ { fontWeight: 500 } }>
69
- { componentName }
70
- </Typography>
71
- </Stack>
72
- </Stack>
56
+ <PanelHeader sx={ { justifyContent: 'start', px: 2 } }>
57
+ <Tooltip title={ __( 'Back', 'elementor' ) }>
58
+ <IconButton size="tiny" onClick={ onBack } aria-label={ __( 'Back', 'elementor' ) }>
59
+ <ArrowLeftIcon fontSize="tiny" />
60
+ </IconButton>
61
+ </Tooltip>
62
+ <ComponentsFilledIcon fontSize="tiny" stroke="currentColor" />
63
+ <EllipsisWithTooltip
64
+ title={ componentName }
65
+ as={ Typography }
66
+ variant="caption"
67
+ sx={ { fontWeight: 500, flexGrow: 1 } }
68
+ />
73
69
  <ComponentsBadge
74
70
  overridablePropsCount={ overridablePropsCount }
75
71
  ref={ anchorRef }
76
72
  onClick={ handleOpenPropertiesPanel }
77
73
  />
78
- </Stack>
74
+ </PanelHeader>
79
75
  <Divider />
80
76
  <ComponentIntroduction
81
77
  anchorRef={ anchorRef }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { EditableField, MenuListItem } from '@elementor/editor-ui';
2
+ import { EditableField, EllipsisWithTooltip, MenuListItem } from '@elementor/editor-ui';
3
3
  import { DotsVerticalIcon } from '@elementor/icons';
4
4
  import {
5
5
  bindMenu,
@@ -101,7 +101,6 @@ export function PropertiesGroup( {
101
101
  { isThisGroupEditing ? (
102
102
  <Box
103
103
  sx={ {
104
- flex: 1,
105
104
  height: 28,
106
105
  display: 'flex',
107
106
  alignItems: 'center',
@@ -109,6 +108,11 @@ export function PropertiesGroup( {
109
108
  borderColor: 'text.secondary',
110
109
  borderRadius: 1,
111
110
  pl: 0.5,
111
+ flexGrow: 1,
112
+ overflow: 'hidden',
113
+ textOverflow: 'ellipsis',
114
+ whiteSpace: 'nowrap',
115
+ width: '100%',
112
116
  } }
113
117
  >
114
118
  <EditableField
@@ -121,12 +125,12 @@ export function PropertiesGroup( {
121
125
  />
122
126
  </Box>
123
127
  ) : (
124
- <Typography
128
+ <EllipsisWithTooltip
129
+ title={ group.label }
130
+ as={ Typography }
125
131
  variant="caption"
126
132
  sx={ { color: 'text.primary', fontWeight: 400, lineHeight: 1.66 } }
127
- >
128
- { group.label }
129
- </Typography>
133
+ />
130
134
  ) }
131
135
  <IconButton
132
136
  className="group-menu"
@@ -3,10 +3,10 @@ import { type V1Element, type V1ElementData } from '@elementor/editor-elements';
3
3
 
4
4
  import { type DocumentSaveStatus } from '../types';
5
5
  import { createComponentsBeforeSave } from './create-components-before-save';
6
+ import { publishDraftComponentsInPageBeforeSave } from './publish-draft-components-in-page-before-save';
6
7
  import { setComponentOverridablePropsSettingsBeforeSave } from './set-component-overridable-props-settings-before-save';
7
8
  import { updateArchivedComponentBeforeSave } from './update-archived-component-before-save';
8
9
  import { updateComponentTitleBeforeSave } from './update-component-title-before-save';
9
- import { updateComponentsBeforeSave } from './update-components-before-save';
10
10
 
11
11
  type Options = {
12
12
  container: V1Element & {
@@ -24,10 +24,29 @@ export const beforeSave = ( { container, status }: Options ) => {
24
24
  const elements = container?.model.get( 'elements' ).toJSON?.() ?? [];
25
25
 
26
26
  return Promise.all( [
27
- updateArchivedComponentBeforeSave(),
28
- createComponentsBeforeSave( { elements, status } ),
29
- updateComponentsBeforeSave( { elements, status } ),
27
+ syncComponents( { elements, status } ),
30
28
  setComponentOverridablePropsSettingsBeforeSave( { container } ),
31
- updateComponentTitleBeforeSave(),
32
29
  ] );
33
30
  };
31
+
32
+ // These operations run sequentially to prevent race conditions when multiple
33
+ // edits occur on the same component simultaneously.
34
+ // TODO: Consolidate these into a single PUT /components endpoint.
35
+ const syncComponents = async ( { elements, status }: { elements: V1ElementData[]; status: DocumentSaveStatus } ) => {
36
+ // This order is important - first update existing components, then create new components,
37
+ // Since new component validation depends on the existing components (preventing duplicate names).
38
+ await updateExistingComponentsBeforeSave( { elements, status } );
39
+ await createComponentsBeforeSave( { elements, status } );
40
+ };
41
+
42
+ const updateExistingComponentsBeforeSave = async ( {
43
+ elements,
44
+ status,
45
+ }: {
46
+ elements: V1ElementData[];
47
+ status: DocumentSaveStatus;
48
+ } ) => {
49
+ await updateComponentTitleBeforeSave( status );
50
+ await updateArchivedComponentBeforeSave( status );
51
+ await publishDraftComponentsInPageBeforeSave( { elements, status } );
52
+ };
@@ -11,7 +11,7 @@ type Options = {
11
11
  elements: V1ElementData[];
12
12
  };
13
13
 
14
- export async function updateComponentsBeforeSave( { status, elements }: Options ) {
14
+ export async function publishDraftComponentsInPageBeforeSave( { status, elements }: Options ) {
15
15
  if ( status !== 'publish' ) {
16
16
  return;
17
17
  }
@@ -3,6 +3,7 @@ import { __getState as getState } from '@elementor/store';
3
3
 
4
4
  import { apiClient } from '../api';
5
5
  import { selectArchivedThisSession } from '../store/store';
6
+ import { type DocumentSaveStatus } from '../types';
6
7
 
7
8
  const failedNotification = ( message: string ): NotificationData => ( {
8
9
  type: 'error',
@@ -10,7 +11,7 @@ const failedNotification = ( message: string ): NotificationData => ( {
10
11
  id: 'failed-archived-components-notification',
11
12
  } );
12
13
 
13
- export const updateArchivedComponentBeforeSave = async () => {
14
+ export const updateArchivedComponentBeforeSave = async ( status: DocumentSaveStatus ) => {
14
15
  try {
15
16
  const archivedComponents = selectArchivedThisSession( getState() );
16
17
 
@@ -18,7 +19,7 @@ export const updateArchivedComponentBeforeSave = async () => {
18
19
  return;
19
20
  }
20
21
 
21
- const result = await apiClient.updateArchivedComponents( archivedComponents );
22
+ const result = await apiClient.updateArchivedComponents( archivedComponents, status );
22
23
 
23
24
  const failedIds = result.failedIds.join( ', ' );
24
25
 
@@ -2,15 +2,16 @@ import { __dispatch as dispatch, __getState as getState } from '@elementor/store
2
2
 
3
3
  import { apiClient } from '../api';
4
4
  import { selectUpdatedComponentNames, slice } from '../store/store';
5
+ import { type DocumentSaveStatus } from '../types';
5
6
 
6
- export const updateComponentTitleBeforeSave = async () => {
7
+ export const updateComponentTitleBeforeSave = async ( status: DocumentSaveStatus ) => {
7
8
  const updatedComponentNames = selectUpdatedComponentNames( getState() );
8
9
 
9
10
  if ( ! updatedComponentNames.length ) {
10
11
  return;
11
12
  }
12
13
 
13
- const result = await apiClient.updateComponentTitle( updatedComponentNames );
14
+ const result = await apiClient.updateComponentTitle( updatedComponentNames, status );
14
15
 
15
16
  if ( result.failedIds.length === 0 ) {
16
17
  dispatch( slice.actions.cleanUpdatedComponentNames() );