@elementor/editor-controls 3.35.0-450 → 3.35.0-452

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-450",
4
+ "version": "3.35.0-452",
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-450",
44
- "@elementor/editor-elements": "3.35.0-450",
45
- "@elementor/editor-props": "3.35.0-450",
46
- "@elementor/editor-responsive": "3.35.0-450",
47
- "@elementor/editor-ui": "3.35.0-450",
48
- "@elementor/editor-v1-adapters": "3.35.0-450",
49
- "@elementor/env": "3.35.0-450",
50
- "@elementor/http-client": "3.35.0-450",
43
+ "@elementor/editor-current-user": "3.35.0-452",
44
+ "@elementor/editor-elements": "3.35.0-452",
45
+ "@elementor/editor-props": "3.35.0-452",
46
+ "@elementor/editor-responsive": "3.35.0-452",
47
+ "@elementor/editor-ui": "3.35.0-452",
48
+ "@elementor/editor-v1-adapters": "3.35.0-452",
49
+ "@elementor/env": "3.35.0-452",
50
+ "@elementor/http-client": "3.35.0-452",
51
51
  "@elementor/icons": "^1.63.0",
52
- "@elementor/locations": "3.35.0-450",
53
- "@elementor/mixpanel": "3.35.0-450",
54
- "@elementor/query": "3.35.0-450",
55
- "@elementor/session": "3.35.0-450",
52
+ "@elementor/locations": "3.35.0-452",
53
+ "@elementor/mixpanel": "3.35.0-452",
54
+ "@elementor/query": "3.35.0-452",
55
+ "@elementor/session": "3.35.0-452",
56
56
  "@elementor/ui": "1.36.17",
57
- "@elementor/utils": "3.35.0-450",
58
- "@elementor/wp-media": "3.35.0-450",
57
+ "@elementor/utils": "3.35.0-452",
58
+ "@elementor/wp-media": "3.35.0-452",
59
59
  "@wordpress/i18n": "^5.13.0",
60
60
  "@monaco-editor/react": "^4.7.0",
61
61
  "dayjs": "^1.11.18",
@@ -47,7 +47,7 @@ type InlineEditorProps = {
47
47
  elementId?: ElementID;
48
48
  };
49
49
 
50
- const INITIAL_STYLE = 'margin:0;padding:0;';
50
+ const INLINE_EDITOR_RESET_CLASS = 'elementor-inline-editor-reset';
51
51
 
52
52
  const useOnUpdate = ( callback: () => void, dependencies: DependencyList ): void => {
53
53
  const hasMounted = useRef( false );
@@ -181,6 +181,8 @@ export const InlineEditor = forwardRef(
181
181
  setValue( isEmpty( newValue ) ? null : newValue );
182
182
  };
183
183
 
184
+ const classes = `${ INLINE_EDITOR_RESET_CLASS } ${ elementClasses }`;
185
+
184
186
  const editor = useEditor( {
185
187
  extensions: [
186
188
  Document.extend( {
@@ -189,24 +191,20 @@ export const InlineEditor = forwardRef(
189
191
  Paragraph.extend( {
190
192
  renderHTML( { HTMLAttributes } ) {
191
193
  const tag = expectedTag ?? 'p';
192
- return [ tag, { ...HTMLAttributes, style: INITIAL_STYLE, class: elementClasses }, 0 ];
194
+ return [ tag, { ...HTMLAttributes, class: classes }, 0 ];
193
195
  },
194
196
  } ),
195
197
  Heading.extend( {
196
198
  renderHTML( { node, HTMLAttributes } ) {
197
199
  if ( expectedTag ) {
198
- return [
199
- expectedTag,
200
- { ...HTMLAttributes, style: INITIAL_STYLE, class: elementClasses },
201
- 0,
202
- ];
200
+ return [ expectedTag, { ...HTMLAttributes, class: classes }, 0 ];
203
201
  }
204
202
 
205
203
  const level = this.options.levels.includes( node.attrs.level )
206
204
  ? node.attrs.level
207
205
  : this.options.levels[ 0 ];
208
206
 
209
- return [ `h${ level }`, { ...HTMLAttributes, style: INITIAL_STYLE, class: elementClasses }, 0 ];
207
+ return [ `h${ level }`, { ...HTMLAttributes, class: classes }, 0 ];
210
208
  },
211
209
  } ).configure( {
212
210
  levels: [ 1, 2, 3, 4, 5, 6 ],
@@ -17,6 +17,7 @@ type MultiSizePropValue = Record< PropKey, PropValue >;
17
17
  type Item = {
18
18
  icon: ReactNode;
19
19
  label: string;
20
+ ariaLabel?: string;
20
21
  bind: PropKey;
21
22
  };
22
23
 
@@ -171,15 +172,17 @@ export function EqualUnequalSizesControl< TMultiPropType extends string, TPropVa
171
172
  }
172
173
 
173
174
  const MultiSizeValueControl = ( { item, rowRef }: { item: Item; rowRef: RefObject< HTMLDivElement > } ) => {
175
+ const { bind, label, icon, ariaLabel } = item;
176
+
174
177
  return (
175
- <PropKeyProvider bind={ item.bind }>
178
+ <PropKeyProvider bind={ bind }>
176
179
  <Grid item xs={ 6 }>
177
180
  <Grid container gap={ 0.75 } alignItems="center">
178
181
  <Grid item xs={ 12 }>
179
- <ControlLabel>{ item.label }</ControlLabel>
182
+ <ControlLabel>{ label }</ControlLabel>
180
183
  </Grid>
181
184
  <Grid item xs={ 12 }>
182
- <SizeControl startIcon={ item.icon } anchorRef={ rowRef } />
185
+ <SizeControl startIcon={ icon } ariaLabel={ ariaLabel } anchorRef={ rowRef } />
183
186
  </Grid>
184
187
  </Grid>
185
188
  </Grid>
@@ -117,7 +117,12 @@ export const GapControl = ( { label }: { label: string } ) => {
117
117
  <ControlFormLabel>{ __( 'Column', 'elementor' ) }</ControlFormLabel>
118
118
  </Grid>
119
119
  <Grid item xs={ 12 }>
120
- <Control bind={ 'column' } isLinked={ isLinked } anchorRef={ stackRef } />
120
+ <Control
121
+ bind={ 'column' }
122
+ ariaLabel={ __( 'Column gap', 'elementor' ) }
123
+ isLinked={ isLinked }
124
+ anchorRef={ stackRef }
125
+ />
121
126
  </Grid>
122
127
  </Grid>
123
128
  <Grid container gap={ 0.75 } alignItems="center">
@@ -125,7 +130,12 @@ export const GapControl = ( { label }: { label: string } ) => {
125
130
  <ControlFormLabel>{ __( 'Row', 'elementor' ) }</ControlFormLabel>
126
131
  </Grid>
127
132
  <Grid item xs={ 12 }>
128
- <Control bind={ 'row' } isLinked={ isLinked } anchorRef={ stackRef } />
133
+ <Control
134
+ bind={ 'row' }
135
+ ariaLabel={ __( 'Row gap', 'elementor' ) }
136
+ isLinked={ isLinked }
137
+ anchorRef={ stackRef }
138
+ />
129
139
  </Grid>
130
140
  </Grid>
131
141
  </Stack>
@@ -135,20 +145,22 @@ export const GapControl = ( { label }: { label: string } ) => {
135
145
 
136
146
  const Control = ( {
137
147
  bind,
148
+ ariaLabel,
138
149
  isLinked,
139
150
  anchorRef,
140
151
  }: {
141
152
  bind: PropKey;
153
+ ariaLabel?: string;
142
154
  isLinked: boolean;
143
155
  anchorRef: RefObject< HTMLDivElement >;
144
156
  } ) => {
145
157
  if ( isLinked ) {
146
- return <SizeControl anchorRef={ anchorRef } />;
158
+ return <SizeControl anchorRef={ anchorRef } ariaLabel={ ariaLabel } />;
147
159
  }
148
160
 
149
161
  return (
150
162
  <PropKeyProvider bind={ bind }>
151
- <SizeControl anchorRef={ anchorRef } />
163
+ <SizeControl anchorRef={ anchorRef } ariaLabel={ ariaLabel } />
152
164
  </PropKeyProvider>
153
165
  );
154
166
  };
@@ -46,6 +46,10 @@ export const InlineEditingControl = createControl(
46
46
  '& a': {
47
47
  color: 'inherit',
48
48
  },
49
+ '& .elementor-inline-editor-reset': {
50
+ margin: 0,
51
+ padding: 0,
52
+ },
49
53
  },
50
54
  '.strip-styles *': {
51
55
  all: 'unset',
@@ -4,7 +4,7 @@ import { dimensionsPropTypeUtil, type PropKey, sizePropTypeUtil } from '@element
4
4
  import { useActiveBreakpoint } from '@elementor/editor-responsive';
5
5
  import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from '@elementor/icons';
6
6
  import { Grid, Stack, Tooltip } from '@elementor/ui';
7
- import { __ } from '@wordpress/i18n';
7
+ import { __, sprintf } from '@wordpress/i18n';
8
8
 
9
9
  import { PropKeyProvider, PropProvider, useBoundProp } from '../bound-prop-context';
10
10
  import { ControlFormLabel } from '../components/control-form-label';
@@ -134,7 +134,7 @@ export const LinkedDimensionsControl = ( { label, isSiteRtl = false, extendedOpt
134
134
  </Tooltip>
135
135
  </Stack>
136
136
 
137
- { getCssDimensionProps( isSiteRtl ).map( ( row, index ) => (
137
+ { getCssDimensionProps( label, isSiteRtl ).map( ( row, index ) => (
138
138
  <Stack direction="row" gap={ 2 } flexWrap="nowrap" key={ index } ref={ gridRowRefs[ index ] }>
139
139
  { row.map( ( { icon, ...props } ) => (
140
140
  <Grid container gap={ 0.75 } alignItems="center" key={ props.bind }>
@@ -144,6 +144,7 @@ export const LinkedDimensionsControl = ( { label, isSiteRtl = false, extendedOpt
144
144
  <Grid item xs={ 12 }>
145
145
  <Control
146
146
  bind={ props.bind }
147
+ ariaLabel={ props.ariaLabel }
147
148
  startIcon={ icon }
148
149
  isLinked={ isLinked }
149
150
  extendedOptions={ extendedOptions }
@@ -161,6 +162,7 @@ export const LinkedDimensionsControl = ( { label, isSiteRtl = false, extendedOpt
161
162
 
162
163
  const Control = ( {
163
164
  bind,
165
+ ariaLabel,
164
166
  startIcon,
165
167
  isLinked,
166
168
  extendedOptions,
@@ -168,6 +170,7 @@ const Control = ( {
168
170
  min,
169
171
  }: {
170
172
  bind: PropKey;
173
+ ariaLabel: string;
171
174
  startIcon: React.ReactNode;
172
175
  isLinked: boolean;
173
176
  extendedOptions?: ExtendedOption[];
@@ -177,6 +180,7 @@ const Control = ( {
177
180
  if ( isLinked ) {
178
181
  return (
179
182
  <SizeControl
183
+ ariaLabel={ ariaLabel }
180
184
  startIcon={ startIcon }
181
185
  extendedOptions={ extendedOptions }
182
186
  anchorRef={ anchorRef }
@@ -188,6 +192,7 @@ const Control = ( {
188
192
  return (
189
193
  <PropKeyProvider bind={ bind }>
190
194
  <SizeControl
195
+ ariaLabel={ ariaLabel }
191
196
  startIcon={ startIcon }
192
197
  extendedOptions={ extendedOptions }
193
198
  anchorRef={ anchorRef }
@@ -205,17 +210,24 @@ const Label = ( { label, bind }: { label: string; bind: PropKey } ) => {
205
210
  );
206
211
  };
207
212
 
208
- function getCssDimensionProps( isSiteRtl: boolean ) {
213
+ function getCssDimensionProps( label: string, isSiteRtl: boolean ) {
209
214
  return [
210
215
  [
211
216
  {
212
217
  bind: 'block-start',
213
218
  label: __( 'Top', 'elementor' ),
219
+ /* translators: %s is the name of the main group (margin or padding) */
220
+ ariaLabel: sprintf( __( '%s top', 'elementor' ), label ),
214
221
  icon: <SideTopIcon fontSize={ 'tiny' } />,
215
222
  },
216
223
  {
217
224
  bind: 'inline-end',
218
225
  label: isSiteRtl ? __( 'Left', 'elementor' ) : __( 'Right', 'elementor' ),
226
+ ariaLabel: isSiteRtl
227
+ ? /* translators: %s is the name of the main group (margin or padding) */
228
+ sprintf( __( '%s left', 'elementor' ), label )
229
+ : /* translators: %s is the name of the main group (margin or padding) */
230
+ sprintf( __( '%s right', 'elementor' ), label ),
219
231
  icon: isSiteRtl ? <SideLeftIcon fontSize={ 'tiny' } /> : <SideRightIcon fontSize={ 'tiny' } />,
220
232
  },
221
233
  ],
@@ -223,11 +235,18 @@ function getCssDimensionProps( isSiteRtl: boolean ) {
223
235
  {
224
236
  bind: 'block-end',
225
237
  label: __( 'Bottom', 'elementor' ),
238
+ /* translators: %s is the name of the main group (margin or padding) */
239
+ ariaLabel: sprintf( __( '%s bottom', 'elementor' ), label ),
226
240
  icon: <SideBottomIcon fontSize={ 'tiny' } />,
227
241
  },
228
242
  {
229
243
  bind: 'inline-start',
230
244
  label: isSiteRtl ? __( 'Right', 'elementor' ) : __( 'Left', 'elementor' ),
245
+ ariaLabel: isSiteRtl
246
+ ? /* translators: %s is the name of the main group (margin or padding) */
247
+ sprintf( __( '%s right', 'elementor' ), label )
248
+ : /* translators: %s is the name of the main group (margin or padding) */
249
+ sprintf( __( '%s left', 'elementor' ), label ),
231
250
  icon: isSiteRtl ? <SideRightIcon fontSize={ 'tiny' } /> : <SideLeftIcon fontSize={ 'tiny' } />,
232
251
  },
233
252
  ],