@elementor/editor-elements 3.35.0-325 → 3.35.0-326

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-elements",
3
3
  "description": "This package contains the elements model for the Elementor editor",
4
- "version": "3.35.0-325",
4
+ "version": "3.35.0-326",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,12 +40,12 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor-mcp": "3.35.0-325",
44
- "@elementor/editor-props": "3.35.0-325",
45
- "@elementor/editor-styles": "3.35.0-325",
46
- "@elementor/editor-v1-adapters": "3.35.0-325",
47
- "@elementor/schema": "3.35.0-325",
48
- "@elementor/utils": "3.35.0-325",
43
+ "@elementor/editor-mcp": "3.35.0-326",
44
+ "@elementor/editor-props": "3.35.0-326",
45
+ "@elementor/editor-styles": "3.35.0-326",
46
+ "@elementor/editor-v1-adapters": "3.35.0-326",
47
+ "@elementor/schema": "3.35.0-326",
48
+ "@elementor/utils": "3.35.0-326",
49
49
  "@wordpress/i18n": "^3.1.0"
50
50
  },
51
51
  "peerDependencies": {
@@ -1,5 +1,7 @@
1
1
  import { getContainer } from './sync/get-container';
2
2
 
3
+ const ANCHOR_SELECTOR = 'a, [data-action-link]';
4
+
3
5
  export type LinkInLinkRestriction =
4
6
  | {
5
7
  shouldRestrict: true;
@@ -45,7 +47,7 @@ export function getAnchoredDescendantId( elementId: string ): string | null {
45
47
  return null;
46
48
  }
47
49
 
48
- for ( const childAnchorElement of Array.from( element.querySelectorAll( 'a' ) ) ) {
50
+ for ( const childAnchorElement of Array.from( element.querySelectorAll( ANCHOR_SELECTOR ) ) ) {
49
51
  // Ensure the child is not in the current element's scope
50
52
  const childElementId = findElementIdOf( childAnchorElement );
51
53
 
@@ -64,19 +66,19 @@ export function getAnchoredAncestorId( elementId: string ): string | null {
64
66
  return null;
65
67
  }
66
68
 
67
- const parentAnchor = element.parentElement.closest( 'a' );
69
+ const parentAnchor = element.parentElement.closest( ANCHOR_SELECTOR );
68
70
 
69
71
  return parentAnchor ? findElementIdOf( parentAnchor ) : null;
70
72
  }
71
73
 
72
74
  export function isElementAnchored( elementId: string ): boolean {
73
- const element = getElementDOM( elementId );
75
+ const element = getElementDOM( elementId ) as HTMLElement;
74
76
 
75
77
  if ( ! element ) {
76
78
  return false;
77
79
  }
78
80
 
79
- if ( isAnchorTag( element.tagName ) ) {
81
+ if ( element.matches( ANCHOR_SELECTOR ) ) {
80
82
  return true;
81
83
  }
82
84
 
@@ -84,12 +86,12 @@ export function isElementAnchored( elementId: string ): boolean {
84
86
  }
85
87
 
86
88
  function doesElementContainAnchor( element: Element ): boolean {
87
- for ( const child of element.children ) {
89
+ for ( const child of Array.from( element.children ) as HTMLElement[] ) {
88
90
  if ( isElementorElement( child ) ) {
89
91
  continue;
90
92
  }
91
93
 
92
- if ( isAnchorTag( child.tagName ) ) {
94
+ if ( child.matches( ANCHOR_SELECTOR ) ) {
93
95
  return true;
94
96
  }
95
97
 
@@ -113,10 +115,6 @@ function getElementDOM( id: string ) {
113
115
  }
114
116
  }
115
117
 
116
- function isAnchorTag( tagName: string ): boolean {
117
- return tagName.toLowerCase() === 'a';
118
- }
119
-
120
118
  function isElementorElement( element: Element ): boolean {
121
119
  return element.hasAttribute( 'data-id' );
122
120
  }