@elementor/editor-canvas 3.35.0-429 → 3.35.0-431

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.js CHANGED
@@ -374,13 +374,15 @@ var useHasOverlapping = () => {
374
374
  // src/components/outline-overlay.tsx
375
375
  var CANVAS_WRAPPER_ID = "elementor-preview-responsive-wrapper";
376
376
  var OverlayBox = (0, import_ui.styled)(import_ui.Box, {
377
- shouldForwardProp: (prop) => prop !== "isSelected" && prop !== "isSmallerOffset"
378
- })(({ theme, isSelected, isSmallerOffset }) => ({
379
- outline: `${isSelected ? "2px" : "1px"} solid ${theme.palette.primary.light}`,
380
- outlineOffset: isSelected && !isSmallerOffset ? "-2px" : "-1px",
381
- pointerEvents: "none"
382
- }));
383
- var OutlineOverlay = ({ element, isSelected, id }) => {
377
+ shouldForwardProp: (prop) => prop !== "isSelected" && prop !== "isSmallerOffset" && prop !== "isGlobal"
378
+ })(
379
+ ({ theme, isSelected, isSmallerOffset, isGlobal }) => ({
380
+ outline: `${isSelected ? "2px" : "1px"} solid ${isGlobal ? theme.palette.global.main : theme.palette.primary.light}`,
381
+ outlineOffset: isSelected && !isSmallerOffset ? "-2px" : "-1px",
382
+ pointerEvents: "none"
383
+ })
384
+ );
385
+ var OutlineOverlay = ({ element, isSelected, id, isGlobal = false }) => {
384
386
  const { context, floating, isVisible } = useFloatingOnElement({ element, isSelected });
385
387
  const { getFloatingProps, getReferenceProps } = (0, import_react5.useInteractions)([(0, import_react5.useHover)(context)]);
386
388
  const hasOverlapping = useHasOverlapping();
@@ -391,6 +393,7 @@ var OutlineOverlay = ({ element, isSelected, id }) => {
391
393
  {
392
394
  ref: floating.setRef,
393
395
  isSelected,
396
+ isGlobal,
394
397
  style: floating.styles,
395
398
  "data-element-overlay": id,
396
399
  role: "presentation",
@@ -418,10 +421,19 @@ function ElementsOverlays() {
418
421
  if (!isActive) {
419
422
  return null;
420
423
  }
421
- return elements.map(([id, element]) => {
424
+ return elements.map(({ id, domElement, isGlobal }) => {
422
425
  const isSelected = selected.element?.id === id;
423
426
  return overlayRegistry.map(
424
- ({ shouldRender, component: Overlay }, index) => shouldRender({ id, element, isSelected }) && /* @__PURE__ */ React2.createElement(Overlay, { key: `${id}-${index}`, id, element, isSelected })
427
+ ({ shouldRender, component: Overlay }, index) => shouldRender({ id, element: domElement, isSelected }) && /* @__PURE__ */ React2.createElement(
428
+ Overlay,
429
+ {
430
+ key: `${id}-${index}`,
431
+ id,
432
+ element: domElement,
433
+ isSelected,
434
+ isGlobal
435
+ }
436
+ )
425
437
  );
426
438
  });
427
439
  }
@@ -429,7 +441,11 @@ function useElementsDom() {
429
441
  return (0, import_editor_v1_adapters2.__privateUseListenTo)(
430
442
  [(0, import_editor_v1_adapters2.windowEvent)("elementor/editor/element-rendered"), (0, import_editor_v1_adapters2.windowEvent)("elementor/editor/element-destroyed")],
431
443
  () => {
432
- return (0, import_editor_elements2.getElements)().filter((el) => ELEMENTS_DATA_ATTR in (el.view?.el?.dataset ?? {})).map((element) => [element.id, element.view?.getDomElement?.()?.get?.(0)]).filter((item) => !!item[1]);
444
+ return (0, import_editor_elements2.getElements)().filter((el) => ELEMENTS_DATA_ATTR in (el.view?.el?.dataset ?? {})).map((element) => ({
445
+ id: element.id,
446
+ domElement: element.view?.getDomElement?.()?.get?.(0),
447
+ isGlobal: element.model.get("isGlobal") ?? false
448
+ })).filter((item) => !!item.domElement);
433
449
  }
434
450
  );
435
451
  }
package/dist/index.mjs CHANGED
@@ -328,13 +328,15 @@ var useHasOverlapping = () => {
328
328
  // src/components/outline-overlay.tsx
329
329
  var CANVAS_WRAPPER_ID = "elementor-preview-responsive-wrapper";
330
330
  var OverlayBox = styled(Box, {
331
- shouldForwardProp: (prop) => prop !== "isSelected" && prop !== "isSmallerOffset"
332
- })(({ theme, isSelected, isSmallerOffset }) => ({
333
- outline: `${isSelected ? "2px" : "1px"} solid ${theme.palette.primary.light}`,
334
- outlineOffset: isSelected && !isSmallerOffset ? "-2px" : "-1px",
335
- pointerEvents: "none"
336
- }));
337
- var OutlineOverlay = ({ element, isSelected, id }) => {
331
+ shouldForwardProp: (prop) => prop !== "isSelected" && prop !== "isSmallerOffset" && prop !== "isGlobal"
332
+ })(
333
+ ({ theme, isSelected, isSmallerOffset, isGlobal }) => ({
334
+ outline: `${isSelected ? "2px" : "1px"} solid ${isGlobal ? theme.palette.global.main : theme.palette.primary.light}`,
335
+ outlineOffset: isSelected && !isSmallerOffset ? "-2px" : "-1px",
336
+ pointerEvents: "none"
337
+ })
338
+ );
339
+ var OutlineOverlay = ({ element, isSelected, id, isGlobal = false }) => {
338
340
  const { context, floating, isVisible } = useFloatingOnElement({ element, isSelected });
339
341
  const { getFloatingProps, getReferenceProps } = useInteractions([useHover(context)]);
340
342
  const hasOverlapping = useHasOverlapping();
@@ -345,6 +347,7 @@ var OutlineOverlay = ({ element, isSelected, id }) => {
345
347
  {
346
348
  ref: floating.setRef,
347
349
  isSelected,
350
+ isGlobal,
348
351
  style: floating.styles,
349
352
  "data-element-overlay": id,
350
353
  role: "presentation",
@@ -372,10 +375,19 @@ function ElementsOverlays() {
372
375
  if (!isActive) {
373
376
  return null;
374
377
  }
375
- return elements.map(([id, element]) => {
378
+ return elements.map(({ id, domElement, isGlobal }) => {
376
379
  const isSelected = selected.element?.id === id;
377
380
  return overlayRegistry.map(
378
- ({ shouldRender, component: Overlay }, index) => shouldRender({ id, element, isSelected }) && /* @__PURE__ */ React2.createElement(Overlay, { key: `${id}-${index}`, id, element, isSelected })
381
+ ({ shouldRender, component: Overlay }, index) => shouldRender({ id, element: domElement, isSelected }) && /* @__PURE__ */ React2.createElement(
382
+ Overlay,
383
+ {
384
+ key: `${id}-${index}`,
385
+ id,
386
+ element: domElement,
387
+ isSelected,
388
+ isGlobal
389
+ }
390
+ )
379
391
  );
380
392
  });
381
393
  }
@@ -383,7 +395,11 @@ function useElementsDom() {
383
395
  return useListenTo(
384
396
  [windowEvent("elementor/editor/element-rendered"), windowEvent("elementor/editor/element-destroyed")],
385
397
  () => {
386
- return getElements().filter((el) => ELEMENTS_DATA_ATTR in (el.view?.el?.dataset ?? {})).map((element) => [element.id, element.view?.getDomElement?.()?.get?.(0)]).filter((item) => !!item[1]);
398
+ return getElements().filter((el) => ELEMENTS_DATA_ATTR in (el.view?.el?.dataset ?? {})).map((element) => ({
399
+ id: element.id,
400
+ domElement: element.view?.getDomElement?.()?.get?.(0),
401
+ isGlobal: element.model.get("isGlobal") ?? false
402
+ })).filter((item) => !!item.domElement);
387
403
  }
388
404
  );
389
405
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-canvas",
3
3
  "description": "Elementor Editor Canvas",
4
- "version": "3.35.0-429",
4
+ "version": "3.35.0-431",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -37,24 +37,24 @@
37
37
  "react-dom": "^18.3.1"
38
38
  },
39
39
  "dependencies": {
40
- "@elementor/editor": "3.35.0-429",
41
- "@elementor/editor-controls": "3.35.0-429",
42
- "@elementor/editor-documents": "3.35.0-429",
43
- "@elementor/editor-elements": "3.35.0-429",
44
- "@elementor/editor-interactions": "3.35.0-429",
45
- "@elementor/editor-mcp": "3.35.0-429",
46
- "@elementor/editor-notifications": "3.35.0-429",
47
- "@elementor/editor-props": "3.35.0-429",
48
- "@elementor/editor-responsive": "3.35.0-429",
49
- "@elementor/editor-styles": "3.35.0-429",
50
- "@elementor/editor-styles-repository": "3.35.0-429",
51
- "@elementor/editor-ui": "3.35.0-429",
52
- "@elementor/editor-v1-adapters": "3.35.0-429",
53
- "@elementor/schema": "3.35.0-429",
54
- "@elementor/twing": "3.35.0-429",
40
+ "@elementor/editor": "3.35.0-431",
41
+ "@elementor/editor-controls": "3.35.0-431",
42
+ "@elementor/editor-documents": "3.35.0-431",
43
+ "@elementor/editor-elements": "3.35.0-431",
44
+ "@elementor/editor-interactions": "3.35.0-431",
45
+ "@elementor/editor-mcp": "3.35.0-431",
46
+ "@elementor/editor-notifications": "3.35.0-431",
47
+ "@elementor/editor-props": "3.35.0-431",
48
+ "@elementor/editor-responsive": "3.35.0-431",
49
+ "@elementor/editor-styles": "3.35.0-431",
50
+ "@elementor/editor-styles-repository": "3.35.0-431",
51
+ "@elementor/editor-ui": "3.35.0-431",
52
+ "@elementor/editor-v1-adapters": "3.35.0-431",
53
+ "@elementor/schema": "3.35.0-431",
54
+ "@elementor/twing": "3.35.0-431",
55
55
  "@elementor/ui": "1.36.17",
56
- "@elementor/utils": "3.35.0-429",
57
- "@elementor/wp-media": "3.35.0-429",
56
+ "@elementor/utils": "3.35.0-431",
57
+ "@elementor/wp-media": "3.35.0-431",
58
58
  "@floating-ui/react": "^0.27.5",
59
59
  "@wordpress/i18n": "^5.13.0"
60
60
  },
@@ -32,19 +32,29 @@ export function ElementsOverlays() {
32
32
  return null;
33
33
  }
34
34
 
35
- return elements.map( ( [ id, element ] ) => {
35
+ return elements.map( ( { id, domElement, isGlobal } ) => {
36
36
  const isSelected = selected.element?.id === id;
37
37
 
38
38
  return overlayRegistry.map(
39
39
  ( { shouldRender, component: Overlay }, index ) =>
40
- shouldRender( { id, element, isSelected } ) && (
41
- <Overlay key={ `${ id }-${ index }` } id={ id } element={ element } isSelected={ isSelected } />
40
+ shouldRender( { id, element: domElement, isSelected } ) && (
41
+ <Overlay
42
+ key={ `${ id }-${ index }` }
43
+ id={ id }
44
+ element={ domElement }
45
+ isSelected={ isSelected }
46
+ isGlobal={ isGlobal }
47
+ />
42
48
  )
43
49
  );
44
50
  } );
45
51
  }
46
52
 
47
- type IdElementTuple = [ string, HTMLElement ];
53
+ type ElementData = {
54
+ id: string;
55
+ domElement: HTMLElement;
56
+ isGlobal: boolean;
57
+ };
48
58
 
49
59
  function useElementsDom() {
50
60
  return useListenTo(
@@ -52,8 +62,12 @@ function useElementsDom() {
52
62
  () => {
53
63
  return getElements()
54
64
  .filter( ( el ) => ELEMENTS_DATA_ATTR in ( el.view?.el?.dataset ?? {} ) )
55
- .map( ( element ) => [ element.id, element.view?.getDomElement?.()?.get?.( 0 ) ] )
56
- .filter( ( item ): item is IdElementTuple => !! item[ 1 ] );
65
+ .map( ( element ) => ( {
66
+ id: element.id,
67
+ domElement: element.view?.getDomElement?.()?.get?.( 0 ),
68
+ isGlobal: element.model.get( 'isGlobal' ) ?? false,
69
+ } ) )
70
+ .filter( ( item ): item is ElementData => !! item.domElement );
57
71
  }
58
72
  );
59
73
  }
@@ -14,14 +14,18 @@ type Props = ElementOverlayProps & {
14
14
  };
15
15
 
16
16
  const OverlayBox = styled( Box, {
17
- shouldForwardProp: ( prop ) => prop !== 'isSelected' && prop !== 'isSmallerOffset',
18
- } )< Pick< Props, 'isSelected' | 'isSmallerOffset' > >( ( { theme, isSelected, isSmallerOffset } ) => ( {
19
- outline: `${ isSelected ? '2px' : '1px' } solid ${ theme.palette.primary.light }`,
20
- outlineOffset: isSelected && ! isSmallerOffset ? '-2px' : '-1px',
21
- pointerEvents: 'none',
22
- } ) );
17
+ shouldForwardProp: ( prop ) => prop !== 'isSelected' && prop !== 'isSmallerOffset' && prop !== 'isGlobal',
18
+ } )< Pick< Props, 'isSelected' | 'isSmallerOffset' | 'isGlobal' > >(
19
+ ( { theme, isSelected, isSmallerOffset, isGlobal } ) => ( {
20
+ outline: `${ isSelected ? '2px' : '1px' } solid ${
21
+ isGlobal ? theme.palette.global.main : theme.palette.primary.light
22
+ }`,
23
+ outlineOffset: isSelected && ! isSmallerOffset ? '-2px' : '-1px',
24
+ pointerEvents: 'none',
25
+ } )
26
+ );
23
27
 
24
- export const OutlineOverlay = ( { element, isSelected, id }: Props ): React.ReactElement | false => {
28
+ export const OutlineOverlay = ( { element, isSelected, id, isGlobal = false }: Props ): React.ReactElement | false => {
25
29
  const { context, floating, isVisible } = useFloatingOnElement( { element, isSelected } );
26
30
  const { getFloatingProps, getReferenceProps } = useInteractions( [ useHover( context ) ] );
27
31
  const hasOverlapping = useHasOverlapping();
@@ -36,6 +40,7 @@ export const OutlineOverlay = ( { element, isSelected, id }: Props ): React.Reac
36
40
  <OverlayBox
37
41
  ref={ floating.setRef }
38
42
  isSelected={ isSelected }
43
+ isGlobal={ isGlobal }
39
44
  style={ floating.styles }
40
45
  data-element-overlay={ id }
41
46
  role="presentation"
@@ -4,6 +4,7 @@ export type ElementOverlayProps = {
4
4
  element: HTMLElement;
5
5
  id: string;
6
6
  isSelected: boolean;
7
+ isGlobal?: boolean;
7
8
  };
8
9
 
9
10
  export type OverlayFilterArgs = {