| @@ -45,19 +45,29 @@ | ||
| 45 | 45 | } |
| 46 | 46 | isSectionScrollSnapEnabled() { |
| 47 | 47 | return elementor.settings.page.model.attributes.scroll_snap; |
| 48 | 48 | } |
| 49 | - isFirstElement() { | |
| 50 | - return this.$element[0] === document.querySelector(".elementor-section-wrap > .elementor-element:first-child"); | |
| 51 | - } | |
| 52 | 49 | isOverflowHidden() { |
| 53 | 50 | return "hidden" === this.$element.css("overflow"); |
| 54 | 51 | } |
| 55 | - getOffset() { | |
| 56 | - if ("body" === elementor.config.document.container) return this.$element.offset().top; | |
| 57 | - const $container = jQuery(elementor.config.document.container); | |
| 58 | - return this.$element.offset().top - $container.offset().top; | |
| 52 | + isEmbeddedEditArea() { | |
| 53 | + const editAreaElement = this.getEditAreaElement(); | |
| 54 | + if (!editAreaElement) return false; | |
| 55 | + return null !== editAreaElement.closest(".elementor-embedded-editor"); | |
| 59 | 56 | } |
| 57 | + getEditAreaElement() { | |
| 58 | + const $closestEditArea = this.$element.closest(".elementor-edit-area-active"); | |
| 59 | + if ($closestEditArea.length) return $closestEditArea[0]; | |
| 60 | + const document = elementor.documents.getCurrent(); | |
| 61 | + const $editArea = document === null || document === void 0 ? void 0 : document.$element; | |
| 62 | + if ($editArea === null || $editArea === void 0 ? void 0 : $editArea.length) return $editArea[0]; | |
| 63 | + return this.$element.closest(".elementor-edit-area")[0]; | |
| 64 | + } | |
| 65 | + getEditAreaOffset() { | |
| 66 | + const editAreaElement = this.getEditAreaElement(); | |
| 67 | + if (!editAreaElement) return Number.POSITIVE_INFINITY; | |
| 68 | + return this.$element[0].getBoundingClientRect().top - editAreaElement.getBoundingClientRect().top; | |
| 69 | + } | |
| 60 | 70 | setHandlesPosition() { |
| 61 | 71 | const document = elementor.documents.getCurrent(); |
| 62 | 72 | if (!(document === null || document === void 0 ? void 0 : document.container.isEditable())) return; |
| 63 | 73 | if (this.isSectionScrollSnapEnabled()) { |
| @@ -63,10 +73,9 @@ | ||
| 63 | 73 | if (this.isSectionScrollSnapEnabled()) { |
| 64 | 74 | this.$element.addClass(handlesInsideClass); |
| 65 | 75 | return; |
| 66 | 76 | } |
| 67 | - const { top } = this.$element[0].getBoundingClientRect(); | |
| 68 | - if (top < handlesHeight || this.isOverflowHidden()) this.$element.addClass(handlesInsideClass); | |
| 77 | + if (this.$element[0].getBoundingClientRect().top < handlesHeight || this.isOverflowHidden() || this.isEmbeddedEditArea() && this.getEditAreaOffset() < handlesHeight) this.$element.addClass(handlesInsideClass); | |
| 69 | 78 | else this.$element.removeClass(handlesInsideClass); |
| 70 | 79 | } |
| 71 | 80 | }; |
| 72 | 81 | exports.default = HandlesPosition; |