| 1 |
/******/ (() => { // webpackBootstrap |
| 2 |
/******/ var __webpack_modules__ = ({ |
| 3 |
|
| 4 |
/***/ "../modules/editor-one/assets/js/admin-menu/classes/flyout-interaction-handler.js": |
| 5 |
/*!****************************************************************************************!*\ |
| 6 |
!*** ../modules/editor-one/assets/js/admin-menu/classes/flyout-interaction-handler.js ***! |
| 7 |
\****************************************************************************************/ |
| 8 |
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { |
| 9 |
|
| 10 |
"use strict"; |
| 11 |
|
| 12 |
|
| 13 |
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 14 |
Object.defineProperty(exports, "__esModule", ({ |
| 15 |
value: true |
| 16 |
})); |
| 17 |
exports.FlyoutInteractionHandler = void 0; |
| 18 |
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js")); |
| 19 |
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js")); |
| 20 |
var FlyoutInteractionHandler = exports.FlyoutInteractionHandler = /*#__PURE__*/function () { |
| 21 |
function FlyoutInteractionHandler() { |
| 22 |
(0, _classCallCheck2.default)(this, FlyoutInteractionHandler); |
| 23 |
this.activeMenu = null; |
| 24 |
this.activeParent = null; |
| 25 |
this.closeTimeout = null; |
| 26 |
this.lastMousePos = null; |
| 27 |
this.exitPoint = null; |
| 28 |
this.mouseMoveHandler = null; |
| 29 |
} |
| 30 |
return (0, _createClass2.default)(FlyoutInteractionHandler, [{ |
| 31 |
key: "handle", |
| 32 |
value: function handle() { |
| 33 |
this.setupFlyoutMenus(); |
| 34 |
this.setupMobileSupport(); |
| 35 |
} |
| 36 |
}, { |
| 37 |
key: "setupFlyoutMenus", |
| 38 |
value: function setupFlyoutMenus() { |
| 39 |
var _this = this; |
| 40 |
var menuItems = document.querySelectorAll('#adminmenu li.elementor-has-flyout'); |
| 41 |
menuItems.forEach(function (parentLi) { |
| 42 |
var flyoutMenu = parentLi.querySelector('.elementor-submenu-flyout'); |
| 43 |
if (!flyoutMenu) { |
| 44 |
return; |
| 45 |
} |
| 46 |
_this.attachHoverEvents(parentLi, flyoutMenu); |
| 47 |
_this.attachFocusEvents(parentLi, flyoutMenu); |
| 48 |
_this.attachKeyboardEvents(parentLi, flyoutMenu); |
| 49 |
}); |
| 50 |
} |
| 51 |
}, { |
| 52 |
key: "attachHoverEvents", |
| 53 |
value: function attachHoverEvents(parentLi, flyoutMenu) { |
| 54 |
var _this2 = this; |
| 55 |
parentLi.addEventListener('mouseenter', function () { |
| 56 |
// If moving to a new parent that is NOT part of the current active tree |
| 57 |
if (_this2.activeMenu && !_this2.activeMenu.contains(parentLi) && _this2.activeMenu !== flyoutMenu) { |
| 58 |
// If we are moving to a sibling or unrelated menu, close the current one immediately |
| 59 |
// UNLESS we are in the safe zone triangle of the parent |
| 60 |
if (!_this2.isCursorInSafeZone()) { |
| 61 |
_this2.hideFlyout(_this2.activeMenu); |
| 62 |
} |
| 63 |
} |
| 64 |
_this2.clearCloseTimeout(); |
| 65 |
_this2.showFlyout(parentLi, flyoutMenu); |
| 66 |
}); |
| 67 |
parentLi.addEventListener('mouseleave', function (event) { |
| 68 |
_this2.exitPoint = { |
| 69 |
x: event.clientX, |
| 70 |
y: event.clientY |
| 71 |
}; |
| 72 |
_this2.scheduleClose(parentLi, flyoutMenu); |
| 73 |
}); |
| 74 |
flyoutMenu.addEventListener('mouseenter', function () { |
| 75 |
_this2.clearCloseTimeout(); |
| 76 |
_this2.stopMouseTracking(); |
| 77 |
}); |
| 78 |
flyoutMenu.addEventListener('mouseleave', function (event) { |
| 79 |
_this2.exitPoint = { |
| 80 |
x: event.clientX, |
| 81 |
y: event.clientY |
| 82 |
}; |
| 83 |
_this2.scheduleClose(parentLi, flyoutMenu); |
| 84 |
}); |
| 85 |
} |
| 86 |
}, { |
| 87 |
key: "attachFocusEvents", |
| 88 |
value: function attachFocusEvents(parentLi, flyoutMenu) { |
| 89 |
var _this3 = this; |
| 90 |
var parentLink = parentLi.querySelector(':scope > a'); |
| 91 |
if (parentLink) { |
| 92 |
parentLink.addEventListener('focus', function () { |
| 93 |
_this3.showFlyout(parentLi, flyoutMenu); |
| 94 |
}); |
| 95 |
} |
| 96 |
flyoutMenu.addEventListener('focusout', function (event) { |
| 97 |
if (!parentLi.contains(event.relatedTarget)) { |
| 98 |
_this3.hideFlyout(flyoutMenu); |
| 99 |
} |
| 100 |
}); |
| 101 |
} |
| 102 |
}, { |
| 103 |
key: "attachKeyboardEvents", |
| 104 |
value: function attachKeyboardEvents(parentLi, flyoutMenu) { |
| 105 |
var _this4 = this; |
| 106 |
parentLi.addEventListener('keydown', function (event) { |
| 107 |
_this4.handleKeyNavigation(event, parentLi, flyoutMenu); |
| 108 |
}); |
| 109 |
} |
| 110 |
}, { |
| 111 |
key: "showFlyout", |
| 112 |
value: function showFlyout(parentLi, flyoutMenu) { |
| 113 |
if (this.activeMenu && this.activeMenu !== flyoutMenu) { |
| 114 |
this.hideFlyout(this.activeMenu); |
| 115 |
} |
| 116 |
this.exitPoint = null; |
| 117 |
this.positionFlyout(parentLi, flyoutMenu); |
| 118 |
flyoutMenu.classList.add('elementor-submenu-flyout-visible'); |
| 119 |
this.activeMenu = flyoutMenu; |
| 120 |
this.activeParent = parentLi; |
| 121 |
} |
| 122 |
}, { |
| 123 |
key: "hideFlyout", |
| 124 |
value: function hideFlyout(flyoutMenu) { |
| 125 |
flyoutMenu.classList.remove('elementor-submenu-flyout-visible'); |
| 126 |
if (this.activeMenu === flyoutMenu) { |
| 127 |
this.activeMenu = null; |
| 128 |
this.activeParent = null; |
| 129 |
this.exitPoint = null; |
| 130 |
this.stopMouseTracking(); |
| 131 |
} |
| 132 |
} |
| 133 |
}, { |
| 134 |
key: "scheduleClose", |
| 135 |
value: function scheduleClose(parentLi, flyoutMenu) { |
| 136 |
var _this5 = this; |
| 137 |
this.clearCloseTimeout(); |
| 138 |
this.startMouseTracking(parentLi, flyoutMenu); |
| 139 |
this.closeTimeout = setTimeout(function () { |
| 140 |
_this5.checkAndClose(flyoutMenu); |
| 141 |
}, 300); |
| 142 |
} |
| 143 |
}, { |
| 144 |
key: "checkAndClose", |
| 145 |
value: function checkAndClose(flyoutMenu) { |
| 146 |
var _this6 = this; |
| 147 |
if (!this.activeMenu) { |
| 148 |
return; |
| 149 |
} |
| 150 |
if (!this.isCursorInSafeZone()) { |
| 151 |
this.hideFlyout(flyoutMenu); |
| 152 |
} else { |
| 153 |
this.closeTimeout = setTimeout(function () { |
| 154 |
_this6.checkAndClose(flyoutMenu); |
| 155 |
}, 300); |
| 156 |
} |
| 157 |
} |
| 158 |
}, { |
| 159 |
key: "clearCloseTimeout", |
| 160 |
value: function clearCloseTimeout() { |
| 161 |
if (this.closeTimeout) { |
| 162 |
clearTimeout(this.closeTimeout); |
| 163 |
this.closeTimeout = null; |
| 164 |
} |
| 165 |
} |
| 166 |
}, { |
| 167 |
key: "startMouseTracking", |
| 168 |
value: function startMouseTracking() { |
| 169 |
var _this7 = this; |
| 170 |
this.stopMouseTracking(); |
| 171 |
this.mouseMoveHandler = function (event) { |
| 172 |
_this7.lastMousePos = { |
| 173 |
x: event.clientX, |
| 174 |
y: event.clientY |
| 175 |
}; |
| 176 |
}; |
| 177 |
document.addEventListener('mousemove', this.mouseMoveHandler); |
| 178 |
} |
| 179 |
}, { |
| 180 |
key: "stopMouseTracking", |
| 181 |
value: function stopMouseTracking() { |
| 182 |
if (this.mouseMoveHandler) { |
| 183 |
document.removeEventListener('mousemove', this.mouseMoveHandler); |
| 184 |
this.mouseMoveHandler = null; |
| 185 |
} |
| 186 |
this.lastMousePos = null; |
| 187 |
} |
| 188 |
}, { |
| 189 |
key: "isCursorInSafeZone", |
| 190 |
value: function isCursorInSafeZone() { |
| 191 |
if (!this.lastMousePos || !this.activeMenu || !this.activeParent) { |
| 192 |
return false; |
| 193 |
} |
| 194 |
var cursor = this.lastMousePos; |
| 195 |
var parentRect = this.activeParent.getBoundingClientRect(); |
| 196 |
if (this.isPointInRect(cursor, parentRect)) { |
| 197 |
return true; |
| 198 |
} |
| 199 |
var flyoutRect = this.activeMenu.getBoundingClientRect(); |
| 200 |
if (this.isPointInRect(cursor, flyoutRect)) { |
| 201 |
return true; |
| 202 |
} |
| 203 |
return this.isPointInTriangle(cursor, parentRect, flyoutRect); |
| 204 |
} |
| 205 |
}, { |
| 206 |
key: "isPointInRect", |
| 207 |
value: function isPointInRect(point, rect) { |
| 208 |
return point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom; |
| 209 |
} |
| 210 |
}, { |
| 211 |
key: "isPointInTriangle", |
| 212 |
value: function isPointInTriangle(cursor, parentRect, flyoutRect) { |
| 213 |
var exitX = this.exitPoint ? this.exitPoint.x : parentRect.right; |
| 214 |
var distParent = Math.abs(exitX - parentRect.right); |
| 215 |
var distFlyout = Math.abs(exitX - flyoutRect.left); |
| 216 |
var triangleApex, baseTop, baseBottom; |
| 217 |
|
| 218 |
// Determine direction: Moving towards Flyout (default) or towards Parent (backwards) |
| 219 |
if (distParent < distFlyout) { |
| 220 |
// Moving towards Flyout |
| 221 |
triangleApex = this.exitPoint || { |
| 222 |
x: parentRect.right, |
| 223 |
y: parentRect.top + parentRect.height / 2 |
| 224 |
}; |
| 225 |
baseTop = { |
| 226 |
x: flyoutRect.left, |
| 227 |
y: flyoutRect.top - 100 |
| 228 |
}; |
| 229 |
baseBottom = { |
| 230 |
x: flyoutRect.left, |
| 231 |
y: flyoutRect.bottom + 100 |
| 232 |
}; |
| 233 |
} else { |
| 234 |
// Moving towards Parent |
| 235 |
triangleApex = this.exitPoint || { |
| 236 |
x: flyoutRect.left, |
| 237 |
y: flyoutRect.top + flyoutRect.height / 2 |
| 238 |
}; |
| 239 |
baseTop = { |
| 240 |
x: parentRect.right, |
| 241 |
y: parentRect.top - 100 |
| 242 |
}; |
| 243 |
baseBottom = { |
| 244 |
x: parentRect.right, |
| 245 |
y: parentRect.bottom + 100 |
| 246 |
}; |
| 247 |
} |
| 248 |
return this.pointInTriangle(cursor, triangleApex, baseTop, baseBottom); |
| 249 |
} |
| 250 |
}, { |
| 251 |
key: "pointInTriangle", |
| 252 |
value: function pointInTriangle(p, v1, v2, v3) { |
| 253 |
var sign = function sign(p1, p2, p3) { |
| 254 |
return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y); |
| 255 |
}; |
| 256 |
var d1 = sign(p, v1, v2); |
| 257 |
var d2 = sign(p, v2, v3); |
| 258 |
var d3 = sign(p, v3, v1); |
| 259 |
var hasNeg = 0 > d1 || 0 > d2 || 0 > d3; |
| 260 |
var hasPos = 0 < d1 || 0 < d2 || 0 < d3; |
| 261 |
return !(hasNeg && hasPos); |
| 262 |
} |
| 263 |
}, { |
| 264 |
key: "positionFlyout", |
| 265 |
value: function positionFlyout(parentLi, flyoutMenu) { |
| 266 |
var windowHeight = window.innerHeight; |
| 267 |
var flyoutHeight = flyoutMenu.offsetHeight; |
| 268 |
var parentRect = parentLi.getBoundingClientRect(); |
| 269 |
var relativeTop = parentRect.top; |
| 270 |
if (relativeTop + flyoutHeight > windowHeight) { |
| 271 |
var newTop = windowHeight - flyoutHeight - relativeTop; |
| 272 |
if (newTop < -relativeTop) { |
| 273 |
newTop = -relativeTop + 10; |
| 274 |
} |
| 275 |
flyoutMenu.style.top = newTop + 'px'; |
| 276 |
} else { |
| 277 |
delete flyoutMenu.style.top; |
| 278 |
} |
| 279 |
} |
| 280 |
}, { |
| 281 |
key: "handleKeyNavigation", |
| 282 |
value: function handleKeyNavigation(event, parentLi, flyoutMenu) { |
| 283 |
var allLinks = flyoutMenu.querySelectorAll('a'); |
| 284 |
var focusedLink = flyoutMenu.querySelector('a:focus'); |
| 285 |
var currentIndex = Array.from(allLinks).indexOf(focusedLink); |
| 286 |
var isVisible = flyoutMenu.classList.contains('elementor-submenu-flyout-visible'); |
| 287 |
switch (event.key) { |
| 288 |
case 'ArrowRight': |
| 289 |
if (!isVisible) { |
| 290 |
var _allLinks$; |
| 291 |
event.preventDefault(); |
| 292 |
this.showFlyout(parentLi, flyoutMenu); |
| 293 |
(_allLinks$ = allLinks[0]) === null || _allLinks$ === void 0 || _allLinks$.focus(); |
| 294 |
} |
| 295 |
break; |
| 296 |
case 'ArrowLeft': |
| 297 |
if (isVisible) { |
| 298 |
var _parentLi$querySelect; |
| 299 |
event.preventDefault(); |
| 300 |
this.hideFlyout(flyoutMenu); |
| 301 |
(_parentLi$querySelect = parentLi.querySelector(':scope > a')) === null || _parentLi$querySelect === void 0 || _parentLi$querySelect.focus(); |
| 302 |
} |
| 303 |
break; |
| 304 |
case 'ArrowDown': |
| 305 |
if (isVisible && currentIndex >= 0) { |
| 306 |
var _allLinks$nextIndex; |
| 307 |
event.preventDefault(); |
| 308 |
var nextIndex = (currentIndex + 1) % allLinks.length; |
| 309 |
(_allLinks$nextIndex = allLinks[nextIndex]) === null || _allLinks$nextIndex === void 0 || _allLinks$nextIndex.focus(); |
| 310 |
} |
| 311 |
break; |
| 312 |
case 'ArrowUp': |
| 313 |
if (isVisible && currentIndex >= 0) { |
| 314 |
var _allLinks$prevIndex; |
| 315 |
event.preventDefault(); |
| 316 |
var prevIndex = (currentIndex - 1 + allLinks.length) % allLinks.length; |
| 317 |
(_allLinks$prevIndex = allLinks[prevIndex]) === null || _allLinks$prevIndex === void 0 || _allLinks$prevIndex.focus(); |
| 318 |
} |
| 319 |
break; |
| 320 |
case 'Escape': |
| 321 |
if (isVisible) { |
| 322 |
var _parentLi$querySelect2; |
| 323 |
event.preventDefault(); |
| 324 |
this.hideFlyout(flyoutMenu); |
| 325 |
(_parentLi$querySelect2 = parentLi.querySelector(':scope > a')) === null || _parentLi$querySelect2 === void 0 || _parentLi$querySelect2.focus(); |
| 326 |
} |
| 327 |
break; |
| 328 |
} |
| 329 |
} |
| 330 |
}, { |
| 331 |
key: "setupMobileSupport", |
| 332 |
value: function setupMobileSupport() { |
| 333 |
var _this8 = this; |
| 334 |
if (window.innerWidth > 782) { |
| 335 |
return; |
| 336 |
} |
| 337 |
var menuLinks = document.querySelectorAll('#adminmenu li.elementor-has-flyout > a'); |
| 338 |
menuLinks.forEach(function (link) { |
| 339 |
link.addEventListener('click', function (event) { |
| 340 |
_this8.handleMobileClick(event, link); |
| 341 |
}); |
| 342 |
}); |
| 343 |
document.addEventListener('click', function (event) { |
| 344 |
_this8.handleDocumentClick(event); |
| 345 |
}); |
| 346 |
} |
| 347 |
}, { |
| 348 |
key: "handleMobileClick", |
| 349 |
value: function handleMobileClick(event, link) { |
| 350 |
var parentLi = link.parentElement; |
| 351 |
var flyoutMenu = parentLi.querySelector('.elementor-submenu-flyout'); |
| 352 |
if (!flyoutMenu) { |
| 353 |
return; |
| 354 |
} |
| 355 |
if (parentLi.classList.contains('elementor-flyout-open')) { |
| 356 |
return; |
| 357 |
} |
| 358 |
event.preventDefault(); |
| 359 |
document.querySelectorAll('#adminmenu li.elementor-has-flyout').forEach(function (item) { |
| 360 |
item.classList.remove('elementor-flyout-open'); |
| 361 |
}); |
| 362 |
parentLi.classList.add('elementor-flyout-open'); |
| 363 |
} |
| 364 |
}, { |
| 365 |
key: "handleDocumentClick", |
| 366 |
value: function handleDocumentClick(event) { |
| 367 |
if (!event.target.closest('#adminmenu li.elementor-has-flyout')) { |
| 368 |
document.querySelectorAll('#adminmenu li.elementor-has-flyout').forEach(function (item) { |
| 369 |
item.classList.remove('elementor-flyout-open'); |
| 370 |
}); |
| 371 |
} |
| 372 |
} |
| 373 |
}]); |
| 374 |
}(); |
| 375 |
|
| 376 |
/***/ }), |
| 377 |
|
| 378 |
/***/ "../modules/editor-one/assets/js/admin-menu/classes/flyout-menu-renderer.js": |
| 379 |
/*!**********************************************************************************!*\ |
| 380 |
!*** ../modules/editor-one/assets/js/admin-menu/classes/flyout-menu-renderer.js ***! |
| 381 |
\**********************************************************************************/ |
| 382 |
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { |
| 383 |
|
| 384 |
"use strict"; |
| 385 |
|
| 386 |
|
| 387 |
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 388 |
Object.defineProperty(exports, "__esModule", ({ |
| 389 |
value: true |
| 390 |
})); |
| 391 |
exports.FlyoutMenuRenderer = void 0; |
| 392 |
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js")); |
| 393 |
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js")); |
| 394 |
var FlyoutMenuRenderer = exports.FlyoutMenuRenderer = /*#__PURE__*/function () { |
| 395 |
function FlyoutMenuRenderer(config) { |
| 396 |
(0, _classCallCheck2.default)(this, FlyoutMenuRenderer); |
| 397 |
this.config = config; |
| 398 |
} |
| 399 |
return (0, _createClass2.default)(FlyoutMenuRenderer, [{ |
| 400 |
key: "render", |
| 401 |
value: function render() { |
| 402 |
var editorFlyout = this.config.editorFlyout; |
| 403 |
if (!editorFlyout || !editorFlyout.items || !editorFlyout.items.length) { |
| 404 |
return false; |
| 405 |
} |
| 406 |
var editorLi = this.findEditorInMenu("#toplevel_page_elementor-home"); |
| 407 |
if (!editorLi) { |
| 408 |
return false; |
| 409 |
} |
| 410 |
editorLi.classList.add('elementor-has-flyout'); |
| 411 |
var editorFlyoutUl = document.createElement('ul'); |
| 412 |
editorFlyoutUl.className = 'elementor-submenu-flyout elementor-level-3'; |
| 413 |
editorFlyout.items.forEach(function (item) { |
| 414 |
if (item.has_divider_before) { |
| 415 |
var dividerLi = document.createElement('li'); |
| 416 |
dividerLi.className = 'elementor-flyout-divider'; |
| 417 |
dividerLi.setAttribute('role', 'separator'); |
| 418 |
editorFlyoutUl.appendChild(dividerLi); |
| 419 |
} |
| 420 |
var li = document.createElement('li'); |
| 421 |
li.setAttribute('data-group-id', item.group_id || ''); |
| 422 |
var a = document.createElement('a'); |
| 423 |
a.href = item.url; |
| 424 |
a.textContent = item.label; |
| 425 |
li.appendChild(a); |
| 426 |
editorFlyoutUl.appendChild(li); |
| 427 |
}); |
| 428 |
editorLi.appendChild(editorFlyoutUl); |
| 429 |
return true; |
| 430 |
} |
| 431 |
}, { |
| 432 |
key: "findEditorInMenu", |
| 433 |
value: function findEditorInMenu(menuSelector) { |
| 434 |
var menuItem = document.querySelector(menuSelector); |
| 435 |
if (!menuItem) { |
| 436 |
return null; |
| 437 |
} |
| 438 |
var submenu = menuItem.querySelector('.wp-submenu'); |
| 439 |
if (!submenu) { |
| 440 |
return null; |
| 441 |
} |
| 442 |
var editorItem = submenu.querySelector('a[href$="page=elementor"]'); |
| 443 |
if (!editorItem) { |
| 444 |
return null; |
| 445 |
} |
| 446 |
return editorItem.closest('li'); |
| 447 |
} |
| 448 |
}]); |
| 449 |
}(); |
| 450 |
|
| 451 |
/***/ }), |
| 452 |
|
| 453 |
/***/ "../modules/editor-one/assets/js/admin-menu/classes/sidebar-menu-handler.js": |
| 454 |
/*!**********************************************************************************!*\ |
| 455 |
!*** ../modules/editor-one/assets/js/admin-menu/classes/sidebar-menu-handler.js ***! |
| 456 |
\**********************************************************************************/ |
| 457 |
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { |
| 458 |
|
| 459 |
"use strict"; |
| 460 |
|
| 461 |
|
| 462 |
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 463 |
Object.defineProperty(exports, "__esModule", ({ |
| 464 |
value: true |
| 465 |
})); |
| 466 |
exports.SidebarMenuHandler = void 0; |
| 467 |
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js")); |
| 468 |
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js")); |
| 469 |
var SidebarMenuHandler = exports.SidebarMenuHandler = /*#__PURE__*/function () { |
| 470 |
function SidebarMenuHandler() { |
| 471 |
(0, _classCallCheck2.default)(this, SidebarMenuHandler); |
| 472 |
this.elementorHomeMenu = this.findElementorHomeMenu(); |
| 473 |
if (this.elementorHomeMenu) { |
| 474 |
this.deactivateOtherMenus(); |
| 475 |
this.activateElementorMenu(); |
| 476 |
this.highlightSubmenu(); |
| 477 |
} |
| 478 |
} |
| 479 |
return (0, _createClass2.default)(SidebarMenuHandler, [{ |
| 480 |
key: "findElementorHomeMenu", |
| 481 |
value: function findElementorHomeMenu() { |
| 482 |
return document.querySelector('#toplevel_page_elementor-home'); |
| 483 |
} |
| 484 |
}, { |
| 485 |
key: "deactivateOtherMenus", |
| 486 |
value: function deactivateOtherMenus() { |
| 487 |
var _this = this; |
| 488 |
document.querySelectorAll('#adminmenu li.wp-has-current-submenu').forEach(function (item) { |
| 489 |
if (item !== _this.elementorHomeMenu) { |
| 490 |
item.classList.remove('wp-has-current-submenu', 'wp-menu-open', 'selected'); |
| 491 |
item.classList.add('wp-not-current-submenu'); |
| 492 |
var link = item.querySelector(':scope > a'); |
| 493 |
if (link) { |
| 494 |
link.classList.remove('wp-has-current-submenu', 'wp-menu-open', 'current'); |
| 495 |
} |
| 496 |
} |
| 497 |
}); |
| 498 |
} |
| 499 |
}, { |
| 500 |
key: "activateElementorMenu", |
| 501 |
value: function activateElementorMenu() { |
| 502 |
this.elementorHomeMenu.classList.remove('wp-not-current-submenu'); |
| 503 |
this.elementorHomeMenu.classList.add('wp-has-current-submenu', 'wp-menu-open', 'selected'); |
| 504 |
var elementorLink = this.elementorHomeMenu.querySelector(':scope > a.menu-top'); |
| 505 |
if (elementorLink) { |
| 506 |
elementorLink.classList.add('wp-has-current-submenu', 'wp-menu-open'); |
| 507 |
} |
| 508 |
} |
| 509 |
}, { |
| 510 |
key: "highlightSubmenu", |
| 511 |
value: function highlightSubmenu() { |
| 512 |
var currentUrl = new URL(window.location.href); |
| 513 |
var searchParams = currentUrl.searchParams; |
| 514 |
var page = searchParams.get('page'); |
| 515 |
var targetSlug = 'elementor'; |
| 516 |
if ('elementor' === page || 'elementor-home' === page) { |
| 517 |
targetSlug = 'elementor'; |
| 518 |
} else if ('e-form-submissions' === page) { |
| 519 |
targetSlug = 'e-form-submissions'; |
| 520 |
} else if ('elementor-theme-builder' === page) { |
| 521 |
targetSlug = 'elementor-theme-builder'; |
| 522 |
} |
| 523 |
var submenuItems = this.elementorHomeMenu.querySelectorAll('.wp-submenu li'); |
| 524 |
submenuItems.forEach(function (item) { |
| 525 |
var link = item.querySelector('a'); |
| 526 |
if (!link) { |
| 527 |
return; |
| 528 |
} |
| 529 |
item.classList.remove('current'); |
| 530 |
link.classList.remove('current'); |
| 531 |
link.setAttribute('aria-current', ''); |
| 532 |
var linkUrl = new URL(link.href, window.location.origin); |
| 533 |
var linkPage = linkUrl.searchParams.get('page'); |
| 534 |
if (linkPage === targetSlug) { |
| 535 |
item.classList.add('current'); |
| 536 |
link.classList.add('current'); |
| 537 |
link.setAttribute('aria-current', 'page'); |
| 538 |
} |
| 539 |
}); |
| 540 |
} |
| 541 |
}]); |
| 542 |
}(); |
| 543 |
|
| 544 |
/***/ }), |
| 545 |
|
| 546 |
/***/ "../node_modules/@babel/runtime/helpers/classCallCheck.js": |
| 547 |
/*!****************************************************************!*\ |
| 548 |
!*** ../node_modules/@babel/runtime/helpers/classCallCheck.js ***! |
| 549 |
\****************************************************************/ |
| 550 |
/***/ ((module) => { |
| 551 |
|
| 552 |
function _classCallCheck(a, n) { |
| 553 |
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); |
| 554 |
} |
| 555 |
module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 556 |
|
| 557 |
/***/ }), |
| 558 |
|
| 559 |
/***/ "../node_modules/@babel/runtime/helpers/createClass.js": |
| 560 |
/*!*************************************************************!*\ |
| 561 |
!*** ../node_modules/@babel/runtime/helpers/createClass.js ***! |
| 562 |
\*************************************************************/ |
| 563 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 564 |
|
| 565 |
var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js"); |
| 566 |
function _defineProperties(e, r) { |
| 567 |
for (var t = 0; t < r.length; t++) { |
| 568 |
var o = r[t]; |
| 569 |
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); |
| 570 |
} |
| 571 |
} |
| 572 |
function _createClass(e, r, t) { |
| 573 |
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { |
| 574 |
writable: !1 |
| 575 |
}), e; |
| 576 |
} |
| 577 |
module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 578 |
|
| 579 |
/***/ }), |
| 580 |
|
| 581 |
/***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js": |
| 582 |
/*!***********************************************************************!*\ |
| 583 |
!*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***! |
| 584 |
\***********************************************************************/ |
| 585 |
/***/ ((module) => { |
| 586 |
|
| 587 |
function _interopRequireDefault(e) { |
| 588 |
return e && e.__esModule ? e : { |
| 589 |
"default": e |
| 590 |
}; |
| 591 |
} |
| 592 |
module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 593 |
|
| 594 |
/***/ }), |
| 595 |
|
| 596 |
/***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js": |
| 597 |
/*!*************************************************************!*\ |
| 598 |
!*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***! |
| 599 |
\*************************************************************/ |
| 600 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 601 |
|
| 602 |
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]); |
| 603 |
function toPrimitive(t, r) { |
| 604 |
if ("object" != _typeof(t) || !t) return t; |
| 605 |
var e = t[Symbol.toPrimitive]; |
| 606 |
if (void 0 !== e) { |
| 607 |
var i = e.call(t, r || "default"); |
| 608 |
if ("object" != _typeof(i)) return i; |
| 609 |
throw new TypeError("@@toPrimitive must return a primitive value."); |
| 610 |
} |
| 611 |
return ("string" === r ? String : Number)(t); |
| 612 |
} |
| 613 |
module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 614 |
|
| 615 |
/***/ }), |
| 616 |
|
| 617 |
/***/ "../node_modules/@babel/runtime/helpers/toPropertyKey.js": |
| 618 |
/*!***************************************************************!*\ |
| 619 |
!*** ../node_modules/@babel/runtime/helpers/toPropertyKey.js ***! |
| 620 |
\***************************************************************/ |
| 621 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 622 |
|
| 623 |
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]); |
| 624 |
var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "../node_modules/@babel/runtime/helpers/toPrimitive.js"); |
| 625 |
function toPropertyKey(t) { |
| 626 |
var i = toPrimitive(t, "string"); |
| 627 |
return "symbol" == _typeof(i) ? i : i + ""; |
| 628 |
} |
| 629 |
module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 630 |
|
| 631 |
/***/ }), |
| 632 |
|
| 633 |
/***/ "../node_modules/@babel/runtime/helpers/typeof.js": |
| 634 |
/*!********************************************************!*\ |
| 635 |
!*** ../node_modules/@babel/runtime/helpers/typeof.js ***! |
| 636 |
\********************************************************/ |
| 637 |
/***/ ((module) => { |
| 638 |
|
| 639 |
function _typeof(o) { |
| 640 |
"@babel/helpers - typeof"; |
| 641 |
|
| 642 |
return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { |
| 643 |
return typeof o; |
| 644 |
} : function (o) { |
| 645 |
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; |
| 646 |
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o); |
| 647 |
} |
| 648 |
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; |
| 649 |
|
| 650 |
/***/ }) |
| 651 |
|
| 652 |
/******/ }); |
| 653 |
/************************************************************************/ |
| 654 |
/******/ // The module cache |
| 655 |
/******/ var __webpack_module_cache__ = {}; |
| 656 |
/******/ |
| 657 |
/******/ // The require function |
| 658 |
/******/ function __webpack_require__(moduleId) { |
| 659 |
/******/ // Check if module is in cache |
| 660 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 661 |
/******/ if (cachedModule !== undefined) { |
| 662 |
/******/ return cachedModule.exports; |
| 663 |
/******/ } |
| 664 |
/******/ // Create a new module (and put it into the cache) |
| 665 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 666 |
/******/ // no module.id needed |
| 667 |
/******/ // no module.loaded needed |
| 668 |
/******/ exports: {} |
| 669 |
/******/ }; |
| 670 |
/******/ |
| 671 |
/******/ // Execute the module function |
| 672 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 673 |
/******/ |
| 674 |
/******/ // Return the exports of the module |
| 675 |
/******/ return module.exports; |
| 676 |
/******/ } |
| 677 |
/******/ |
| 678 |
/************************************************************************/ |
| 679 |
var __webpack_exports__ = {}; |
| 680 |
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. |
| 681 |
(() => { |
| 682 |
"use strict"; |
| 683 |
/*!*********************************************************!*\ |
| 684 |
!*** ../modules/editor-one/assets/js/admin-menu/app.js ***! |
| 685 |
\*********************************************************/ |
| 686 |
|
| 687 |
|
| 688 |
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 689 |
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js")); |
| 690 |
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js")); |
| 691 |
var _flyoutMenuRenderer = __webpack_require__(/*! ./classes/flyout-menu-renderer */ "../modules/editor-one/assets/js/admin-menu/classes/flyout-menu-renderer.js"); |
| 692 |
var _sidebarMenuHandler = __webpack_require__(/*! ./classes/sidebar-menu-handler */ "../modules/editor-one/assets/js/admin-menu/classes/sidebar-menu-handler.js"); |
| 693 |
var _flyoutInteractionHandler = __webpack_require__(/*! ./classes/flyout-interaction-handler */ "../modules/editor-one/assets/js/admin-menu/classes/flyout-interaction-handler.js"); |
| 694 |
var EditorOneMenu = /*#__PURE__*/function () { |
| 695 |
function EditorOneMenu() { |
| 696 |
var _window; |
| 697 |
(0, _classCallCheck2.default)(this, EditorOneMenu); |
| 698 |
this.config = ((_window = window) === null || _window === void 0 ? void 0 : _window.editorOneMenuConfig) || {}; |
| 699 |
} |
| 700 |
return (0, _createClass2.default)(EditorOneMenu, [{ |
| 701 |
key: "init", |
| 702 |
value: function init() { |
| 703 |
if (this.isSidebarNavigationActive()) { |
| 704 |
new _sidebarMenuHandler.SidebarMenuHandler(); |
| 705 |
return; |
| 706 |
} |
| 707 |
this.buildFlyoutMenus(); |
| 708 |
} |
| 709 |
}, { |
| 710 |
key: "isSidebarNavigationActive", |
| 711 |
value: function isSidebarNavigationActive() { |
| 712 |
return document.body.classList.contains('e-has-sidebar-navigation'); |
| 713 |
} |
| 714 |
}, { |
| 715 |
key: "buildFlyoutMenus", |
| 716 |
value: function buildFlyoutMenus() { |
| 717 |
var renderer = new _flyoutMenuRenderer.FlyoutMenuRenderer(this.config); |
| 718 |
if (renderer.render()) { |
| 719 |
new _flyoutInteractionHandler.FlyoutInteractionHandler().handle(); |
| 720 |
} |
| 721 |
} |
| 722 |
}]); |
| 723 |
}(); |
| 724 |
var initEditorOneMenu = function initEditorOneMenu() { |
| 725 |
var editorOneMenu = new EditorOneMenu(); |
| 726 |
editorOneMenu.init(); |
| 727 |
}; |
| 728 |
if ('loading' === document.readyState) { |
| 729 |
document.addEventListener('DOMContentLoaded', initEditorOneMenu); |
| 730 |
} else { |
| 731 |
initEditorOneMenu(); |
| 732 |
} |
| 733 |
})(); |
| 734 |
|
| 735 |
/******/ })() |
| 736 |
; |
| 737 |
//# sourceMappingURL=editor-one-menu.js.map |