@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/dist/index.js CHANGED
@@ -788,6 +788,7 @@ var updateElementSettings = ({ id, props, withHistory = true }) => {
788
788
  };
789
789
 
790
790
  // src/link-restriction.ts
791
+ var ANCHOR_SELECTOR = "a, [data-action-link]";
791
792
  function getLinkInLinkRestriction(elementId) {
792
793
  const anchoredDescendantId = getAnchoredDescendantId(elementId);
793
794
  if (anchoredDescendantId) {
@@ -814,7 +815,7 @@ function getAnchoredDescendantId(elementId) {
814
815
  if (!element) {
815
816
  return null;
816
817
  }
817
- for (const childAnchorElement of Array.from(element.querySelectorAll("a"))) {
818
+ for (const childAnchorElement of Array.from(element.querySelectorAll(ANCHOR_SELECTOR))) {
818
819
  const childElementId = findElementIdOf(childAnchorElement);
819
820
  if (childElementId !== elementId) {
820
821
  return childElementId;
@@ -827,7 +828,7 @@ function getAnchoredAncestorId(elementId) {
827
828
  if (!element || element.parentElement === null) {
828
829
  return null;
829
830
  }
830
- const parentAnchor = element.parentElement.closest("a");
831
+ const parentAnchor = element.parentElement.closest(ANCHOR_SELECTOR);
831
832
  return parentAnchor ? findElementIdOf(parentAnchor) : null;
832
833
  }
833
834
  function isElementAnchored(elementId) {
@@ -835,17 +836,17 @@ function isElementAnchored(elementId) {
835
836
  if (!element) {
836
837
  return false;
837
838
  }
838
- if (isAnchorTag(element.tagName)) {
839
+ if (element.matches(ANCHOR_SELECTOR)) {
839
840
  return true;
840
841
  }
841
842
  return doesElementContainAnchor(element);
842
843
  }
843
844
  function doesElementContainAnchor(element) {
844
- for (const child of element.children) {
845
+ for (const child of Array.from(element.children)) {
845
846
  if (isElementorElement(child)) {
846
847
  continue;
847
848
  }
848
- if (isAnchorTag(child.tagName)) {
849
+ if (child.matches(ANCHOR_SELECTOR)) {
849
850
  return true;
850
851
  }
851
852
  if (doesElementContainAnchor(child)) {
@@ -864,9 +865,6 @@ function getElementDOM(id) {
864
865
  return null;
865
866
  }
866
867
  }
867
- function isAnchorTag(tagName) {
868
- return tagName.toLowerCase() === "a";
869
- }
870
868
  function isElementorElement(element) {
871
869
  return element.hasAttribute("data-id");
872
870
  }