| @@ -131,22 +131,41 @@ | ||
| 131 | 131 | var _connectionButton = _interopRequireDefault(__webpack_require__(/*! ./components/connection-button/connection-button */ "../modules/admin-top-bar/assets/js/components/connection-button/connection-button.js")); |
| 132 | 132 | var _usePageTitle = __webpack_require__(/*! ./hooks/use-page-title/use-page-title */ "../modules/admin-top-bar/assets/js/hooks/use-page-title/use-page-title.js"); |
| 133 | 133 | var _environment = _interopRequireDefault(__webpack_require__(/*! elementor-common/utils/environment */ "../core/common/assets/js/utils/environment.js")); |
| 134 | 134 | function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } |
| 135 | +var isEditorOneEnabled = function isEditorOneEnabled() { | |
| 136 | + var _window$elementorComm, _window$elementorComm2; | |
| 137 | + return (_window$elementorComm = (_window$elementorComm2 = window.elementorCommon) === null || _window$elementorComm2 === void 0 || (_window$elementorComm2 = _window$elementorComm2.config) === null || _window$elementorComm2 === void 0 || (_window$elementorComm2 = _window$elementorComm2.experimentalFeatures) === null || _window$elementorComm2 === void 0 ? void 0 : _window$elementorComm2.e_editor_one) !== null && _window$elementorComm !== void 0 ? _window$elementorComm : false; | |
| 138 | +}; | |
| 135 | 139 | function AdminTopBar() { |
| 136 | 140 | var _window, _elementorNotificatio; |
| 137 | 141 | var actionButtonsRef = (0, _react.useRef)(), |
| 138 | - promotion = window.elementorAdminTopBarConfig.promotion; | |
| 142 | + promotion = window.elementorAdminTopBarConfig.promotion, | |
| 143 | + editorOneEnabled = isEditorOneEnabled(); | |
| 139 | 144 | |
| 140 | 145 | // Handle Top Bar visibility on initiation: Indicate that the admin top bar is visible and the page content needs to push down below the admin top bar for visibility. |
| 141 | 146 | (0, _react.useEffect)(function () { |
| 142 | 147 | var adminTopBarElement = document.querySelector('#e-admin-top-bar-root'); |
| 143 | - adminTopBarElement === null || adminTopBarElement === void 0 || adminTopBarElement.classList.add('e-admin-top-bar--active'); | |
| 144 | - adminTopBarElement === null || adminTopBarElement === void 0 || adminTopBarElement.classList.add('e-admin-top-bar--editor-one'); | |
| 145 | - }, []); | |
| 148 | + adminTopBarElement.classList.add('e-admin-top-bar--active'); | |
| 149 | + if (editorOneEnabled) { | |
| 150 | + adminTopBarElement.classList.add('e-admin-top-bar--editor-one'); | |
| 151 | + } | |
| 152 | + }, [editorOneEnabled]); | |
| 146 | 153 | |
| 147 | 154 | // Handle the page title visibility in admin top bar. |
| 148 | 155 | var pageTitleText = (0, _usePageTitle.usePageTitle)(); |
| 156 | + | |
| 157 | + // Handle the action buttons visibility in admin top bar on initiation. | |
| 158 | + // Skip moving buttons when Editor One is enabled - they stay in .wrap | |
| 159 | + (0, _react.useEffect)(function () { | |
| 160 | + if (editorOneEnabled) { | |
| 161 | + return; | |
| 162 | + } | |
| 163 | + var actionButtonElements = document.querySelectorAll('.page-title-action'); | |
| 164 | + actionButtonElements.forEach(function (actionButtonElement) { | |
| 165 | + actionButtonsRef.current.appendChild(actionButtonElement); | |
| 166 | + }); | |
| 167 | + }, [editorOneEnabled]); | |
| 149 | 168 | var finderAction = function finderAction() { |
| 150 | 169 | $e.route('finder'); |
| 151 | 170 | }; |
| 152 | 171 | var controlSign = _environment.default.mac ? "\u2318" : '^'; |