| 1 |
/******/ (function() { // webpackBootstrap |
| 2 |
/******/ "use strict"; |
| 3 |
/******/ var __webpack_modules__ = ({ |
| 4 |
|
| 5 |
/***/ "react": |
| 6 |
/*!**************************!*\ |
| 7 |
!*** external ["React"] ***! |
| 8 |
\**************************/ |
| 9 |
/***/ (function(module) { |
| 10 |
|
| 11 |
module.exports = window["React"]; |
| 12 |
|
| 13 |
/***/ }), |
| 14 |
|
| 15 |
/***/ "@elementor/editor-app-bar": |
| 16 |
/*!***********************************************!*\ |
| 17 |
!*** external ["elementorV2","editorAppBar"] ***! |
| 18 |
\***********************************************/ |
| 19 |
/***/ (function(module) { |
| 20 |
|
| 21 |
module.exports = window["elementorV2"]["editorAppBar"]; |
| 22 |
|
| 23 |
/***/ }), |
| 24 |
|
| 25 |
/***/ "@elementor/editor-documents": |
| 26 |
/*!**************************************************!*\ |
| 27 |
!*** external ["elementorV2","editorDocuments"] ***! |
| 28 |
\**************************************************/ |
| 29 |
/***/ (function(module) { |
| 30 |
|
| 31 |
module.exports = window["elementorV2"]["editorDocuments"]; |
| 32 |
|
| 33 |
/***/ }), |
| 34 |
|
| 35 |
/***/ "@elementor/editor-panels": |
| 36 |
/*!***********************************************!*\ |
| 37 |
!*** external ["elementorV2","editorPanels"] ***! |
| 38 |
\***********************************************/ |
| 39 |
/***/ (function(module) { |
| 40 |
|
| 41 |
module.exports = window["elementorV2"]["editorPanels"]; |
| 42 |
|
| 43 |
/***/ }), |
| 44 |
|
| 45 |
/***/ "@elementor/env": |
| 46 |
/*!**************************************!*\ |
| 47 |
!*** external ["elementorV2","env"] ***! |
| 48 |
\**************************************/ |
| 49 |
/***/ (function(module) { |
| 50 |
|
| 51 |
module.exports = window["elementorV2"]["env"]; |
| 52 |
|
| 53 |
/***/ }), |
| 54 |
|
| 55 |
/***/ "@elementor/icons": |
| 56 |
/*!****************************************!*\ |
| 57 |
!*** external ["elementorV2","icons"] ***! |
| 58 |
\****************************************/ |
| 59 |
/***/ (function(module) { |
| 60 |
|
| 61 |
module.exports = window["elementorV2"]["icons"]; |
| 62 |
|
| 63 |
/***/ }), |
| 64 |
|
| 65 |
/***/ "@elementor/query": |
| 66 |
/*!****************************************!*\ |
| 67 |
!*** external ["elementorV2","query"] ***! |
| 68 |
\****************************************/ |
| 69 |
/***/ (function(module) { |
| 70 |
|
| 71 |
module.exports = window["elementorV2"]["query"]; |
| 72 |
|
| 73 |
/***/ }), |
| 74 |
|
| 75 |
/***/ "@elementor/ui": |
| 76 |
/*!*************************************!*\ |
| 77 |
!*** external ["elementorV2","ui"] ***! |
| 78 |
\*************************************/ |
| 79 |
/***/ (function(module) { |
| 80 |
|
| 81 |
module.exports = window["elementorV2"]["ui"]; |
| 82 |
|
| 83 |
/***/ }), |
| 84 |
|
| 85 |
/***/ "@wordpress/api-fetch": |
| 86 |
/*!**********************************!*\ |
| 87 |
!*** external ["wp","apiFetch"] ***! |
| 88 |
\**********************************/ |
| 89 |
/***/ (function(module) { |
| 90 |
|
| 91 |
module.exports = window["wp"]["apiFetch"]; |
| 92 |
|
| 93 |
/***/ }), |
| 94 |
|
| 95 |
/***/ "@wordpress/i18n": |
| 96 |
/*!******************************!*\ |
| 97 |
!*** external ["wp","i18n"] ***! |
| 98 |
\******************************/ |
| 99 |
/***/ (function(module) { |
| 100 |
|
| 101 |
module.exports = window["wp"]["i18n"]; |
| 102 |
|
| 103 |
/***/ }), |
| 104 |
|
| 105 |
/***/ "@wordpress/url": |
| 106 |
/*!*****************************!*\ |
| 107 |
!*** external ["wp","url"] ***! |
| 108 |
\*****************************/ |
| 109 |
/***/ (function(module) { |
| 110 |
|
| 111 |
module.exports = window["wp"]["url"]; |
| 112 |
|
| 113 |
/***/ }) |
| 114 |
|
| 115 |
/******/ }); |
| 116 |
/************************************************************************/ |
| 117 |
/******/ // The module cache |
| 118 |
/******/ var __webpack_module_cache__ = {}; |
| 119 |
/******/ |
| 120 |
/******/ // The require function |
| 121 |
/******/ function __webpack_require__(moduleId) { |
| 122 |
/******/ // Check if module is in cache |
| 123 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 124 |
/******/ if (cachedModule !== undefined) { |
| 125 |
/******/ return cachedModule.exports; |
| 126 |
/******/ } |
| 127 |
/******/ // Create a new module (and put it into the cache) |
| 128 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 129 |
/******/ // no module.id needed |
| 130 |
/******/ // no module.loaded needed |
| 131 |
/******/ exports: {} |
| 132 |
/******/ }; |
| 133 |
/******/ |
| 134 |
/******/ // Execute the module function |
| 135 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 136 |
/******/ |
| 137 |
/******/ // Return the exports of the module |
| 138 |
/******/ return module.exports; |
| 139 |
/******/ } |
| 140 |
/******/ |
| 141 |
/************************************************************************/ |
| 142 |
/******/ /* webpack/runtime/define property getters */ |
| 143 |
/******/ !function() { |
| 144 |
/******/ // define getter functions for harmony exports |
| 145 |
/******/ __webpack_require__.d = function(exports, definition) { |
| 146 |
/******/ for(var key in definition) { |
| 147 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 148 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 149 |
/******/ } |
| 150 |
/******/ } |
| 151 |
/******/ }; |
| 152 |
/******/ }(); |
| 153 |
/******/ |
| 154 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 155 |
/******/ !function() { |
| 156 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
| 157 |
/******/ }(); |
| 158 |
/******/ |
| 159 |
/******/ /* webpack/runtime/make namespace object */ |
| 160 |
/******/ !function() { |
| 161 |
/******/ // define __esModule on exports |
| 162 |
/******/ __webpack_require__.r = function(exports) { |
| 163 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 164 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 165 |
/******/ } |
| 166 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 167 |
/******/ }; |
| 168 |
/******/ }(); |
| 169 |
/******/ |
| 170 |
/************************************************************************/ |
| 171 |
var __webpack_exports__ = {}; |
| 172 |
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. |
| 173 |
!function() { |
| 174 |
/*!***********************************************************************!*\ |
| 175 |
!*** ./node_modules/@elementor/editor-site-navigation/dist/index.mjs ***! |
| 176 |
\***********************************************************************/ |
| 177 |
__webpack_require__.r(__webpack_exports__); |
| 178 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 179 |
/* harmony export */ extendIconsMap: function() { return /* binding */ extendIconsMap; } |
| 180 |
/* harmony export */ }); |
| 181 |
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); |
| 182 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react"); |
| 183 |
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); |
| 184 |
/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); |
| 185 |
/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); |
| 186 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); |
| 187 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 188 |
/* harmony import */ var _elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @elementor/editor-app-bar */ "@elementor/editor-app-bar"); |
| 189 |
/* harmony import */ var _elementor_editor_panels__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @elementor/editor-panels */ "@elementor/editor-panels"); |
| 190 |
/* harmony import */ var _elementor_query__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @elementor/query */ "@elementor/query"); |
| 191 |
/* harmony import */ var _elementor_env__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @elementor/env */ "@elementor/env"); |
| 192 |
// src/icons-map.ts |
| 193 |
|
| 194 |
var initialIconsMap = { |
| 195 |
page: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PageTemplateIcon, |
| 196 |
section: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.SectionTemplateIcon, |
| 197 |
container: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.ContainerTemplateIcon, |
| 198 |
"wp-page": _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PageTypeIcon, |
| 199 |
"wp-post": _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PostTypeIcon |
| 200 |
}; |
| 201 |
var iconsMap = { ...initialIconsMap }; |
| 202 |
function extendIconsMap(additionalIcons) { |
| 203 |
Object.assign(iconsMap, additionalIcons); |
| 204 |
} |
| 205 |
function getIconsMap() { |
| 206 |
return iconsMap; |
| 207 |
} |
| 208 |
|
| 209 |
// src/components/top-bar/recently-edited.tsx |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
// src/components/top-bar/indicator.tsx |
| 216 |
|
| 217 |
|
| 218 |
function Indicator({ title, status }) { |
| 219 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(Tooltip, { title }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, { component: "span", direction: "row", alignItems: "center", spacing: 0.5 }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, { component: "span", variant: "body2", sx: { maxWidth: "120px" }, noWrap: true }, title), status.value !== "publish" && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, { component: "span", variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")"))); |
| 220 |
} |
| 221 |
function Tooltip(props) { |
| 222 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 223 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, |
| 224 |
{ |
| 225 |
PopperProps: { |
| 226 |
sx: { |
| 227 |
"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": { |
| 228 |
mt: 2.7 |
| 229 |
} |
| 230 |
} |
| 231 |
}, |
| 232 |
...props |
| 233 |
} |
| 234 |
); |
| 235 |
} |
| 236 |
|
| 237 |
// src/hooks/use-recent-posts.ts |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
var endpointPath = "/elementor/v1/site-navigation/recent-posts"; |
| 242 |
function useRecentPosts(documentId) { |
| 243 |
const [recentPosts, setRecentPosts] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)([]); |
| 244 |
const [isLoading, setIsLoading] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); |
| 245 |
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => { |
| 246 |
if (documentId) { |
| 247 |
setIsLoading(true); |
| 248 |
fetchRecentlyEditedPosts(documentId).then((posts) => { |
| 249 |
setRecentPosts(posts); |
| 250 |
setIsLoading(false); |
| 251 |
}); |
| 252 |
} |
| 253 |
}, [documentId]); |
| 254 |
return { |
| 255 |
isLoading, |
| 256 |
recentPosts |
| 257 |
}; |
| 258 |
} |
| 259 |
async function fetchRecentlyEditedPosts(documentId) { |
| 260 |
const queryParams = { |
| 261 |
posts_per_page: 5, |
| 262 |
post__not_in: documentId |
| 263 |
}; |
| 264 |
return await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ |
| 265 |
path: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_5__.addQueryArgs)(endpointPath, queryParams) |
| 266 |
}).then((response) => response).catch(() => []); |
| 267 |
} |
| 268 |
|
| 269 |
// src/components/top-bar/recently-edited.tsx |
| 270 |
|
| 271 |
|
| 272 |
// src/components/top-bar/chip-doc-type.tsx |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
var iconsMap2 = getIconsMap(); |
| 277 |
function DocTypeChip({ postType, docType, label }) { |
| 278 |
const color = "elementor_library" === postType ? "global" : "primary"; |
| 279 |
const Icon = iconsMap2[docType] || _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PostTypeIcon; |
| 280 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 281 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Chip, |
| 282 |
{ |
| 283 |
component: "span", |
| 284 |
size: "small", |
| 285 |
variant: "standard", |
| 286 |
label, |
| 287 |
"data-value": docType, |
| 288 |
color, |
| 289 |
icon: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(Icon, null), |
| 290 |
sx: { ml: 1, cursor: "inherit" } |
| 291 |
} |
| 292 |
); |
| 293 |
} |
| 294 |
|
| 295 |
// src/components/top-bar/post-list-item.tsx |
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
// src/hooks/use-reverse-html-entities.ts |
| 301 |
|
| 302 |
function useReverseHtmlEntities(escapedHTML = "") { |
| 303 |
return (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => { |
| 304 |
const textarea = document.createElement("textarea"); |
| 305 |
textarea.innerHTML = escapedHTML; |
| 306 |
const { value } = textarea; |
| 307 |
textarea.remove(); |
| 308 |
return value; |
| 309 |
}, [escapedHTML]); |
| 310 |
} |
| 311 |
|
| 312 |
// src/components/top-bar/post-list-item.tsx |
| 313 |
function PostListItem({ post, closePopup, ...props }) { |
| 314 |
const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.__useNavigateToDocument)(); |
| 315 |
const postTitle = useReverseHtmlEntities(post.title); |
| 316 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 317 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuItem, |
| 318 |
{ |
| 319 |
onClick: async () => { |
| 320 |
closePopup(); |
| 321 |
await navigateToDocument(post.id); |
| 322 |
}, |
| 323 |
...props |
| 324 |
}, |
| 325 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 326 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemText, |
| 327 |
{ |
| 328 |
sx: { flexGrow: 0 }, |
| 329 |
primaryTypographyProps: { noWrap: true }, |
| 330 |
primary: postTitle |
| 331 |
} |
| 332 |
), |
| 333 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 334 |
DocTypeChip, |
| 335 |
{ |
| 336 |
postType: post.type.post_type, |
| 337 |
docType: post.type.doc_type, |
| 338 |
label: post.type.label |
| 339 |
} |
| 340 |
) |
| 341 |
); |
| 342 |
} |
| 343 |
|
| 344 |
// src/components/top-bar/create-post-list-item.tsx |
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
// src/hooks/use-create-page.ts |
| 349 |
|
| 350 |
|
| 351 |
var endpointPath2 = "/elementor/v1/site-navigation/add-new-post"; |
| 352 |
function useCreatePage() { |
| 353 |
const [isLoading, setIsLoading] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); |
| 354 |
return { |
| 355 |
create: () => { |
| 356 |
setIsLoading(true); |
| 357 |
return addNewPage().then((newPost) => newPost).finally(() => setIsLoading(false)); |
| 358 |
}, |
| 359 |
isLoading |
| 360 |
}; |
| 361 |
} |
| 362 |
async function addNewPage() { |
| 363 |
return await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ |
| 364 |
path: endpointPath2, |
| 365 |
method: "POST", |
| 366 |
data: { post_type: "page" } |
| 367 |
}); |
| 368 |
} |
| 369 |
|
| 370 |
// src/components/top-bar/create-post-list-item.tsx |
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
function CreatePostListItem({ closePopup, ...props }) { |
| 375 |
const { create, isLoading } = useCreatePage(); |
| 376 |
const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.__useNavigateToDocument)(); |
| 377 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 378 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuItem, |
| 379 |
{ |
| 380 |
onClick: async () => { |
| 381 |
const { id } = await create(); |
| 382 |
closePopup(); |
| 383 |
await navigateToDocument(id); |
| 384 |
}, |
| 385 |
...props |
| 386 |
}, |
| 387 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemIcon, null, isLoading ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.CircularProgress, null) : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PlusIcon, null)), |
| 388 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemText, { primary: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Add new page", "elementor") }) |
| 389 |
); |
| 390 |
} |
| 391 |
|
| 392 |
// src/components/top-bar/recently-edited.tsx |
| 393 |
function RecentlyEdited() { |
| 394 |
const activeDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.__useActiveDocument)(); |
| 395 |
const hostDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.__useHostDocument)(); |
| 396 |
const document2 = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument; |
| 397 |
const { recentPosts } = useRecentPosts(document2?.id); |
| 398 |
const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.usePopupState)({ |
| 399 |
variant: "popover", |
| 400 |
popupId: "elementor-v2-top-bar-recently-edited" |
| 401 |
}); |
| 402 |
const documentTitle = useReverseHtmlEntities(document2?.title); |
| 403 |
if (!document2) { |
| 404 |
return null; |
| 405 |
} |
| 406 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 407 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, |
| 408 |
{ |
| 409 |
color: "inherit", |
| 410 |
size: "small", |
| 411 |
endIcon: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__.ChevronDownIcon, { fontSize: "small" }), |
| 412 |
...(0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindTrigger)(popupState) |
| 413 |
}, |
| 414 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 415 |
Indicator, |
| 416 |
{ |
| 417 |
title: documentTitle, |
| 418 |
status: document2.status |
| 419 |
} |
| 420 |
) |
| 421 |
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 422 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Menu, |
| 423 |
{ |
| 424 |
MenuListProps: { |
| 425 |
subheader: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListSubheader, { color: "primary", sx: { fontStyle: "italic", fontWeight: "300" } }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Recent", "elementor")) |
| 426 |
}, |
| 427 |
PaperProps: { sx: { mt: 2.5, width: 320 } }, |
| 428 |
...(0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindMenu)(popupState) |
| 429 |
}, |
| 430 |
recentPosts.map((post) => /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PostListItem, { key: post.id, post, closePopup: popupState.close })), |
| 431 |
recentPosts.length === 0 && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuItem, { disabled: true }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 432 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemText, |
| 433 |
{ |
| 434 |
primaryTypographyProps: { |
| 435 |
variant: "caption", |
| 436 |
fontStyle: "italic" |
| 437 |
}, |
| 438 |
primary: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("There are no other pages or templates on this site yet.", "elementor") |
| 439 |
} |
| 440 |
)), |
| 441 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, { disabled: recentPosts.length === 0 }), |
| 442 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(CreatePostListItem, { closePopup: popupState.close }) |
| 443 |
)); |
| 444 |
} |
| 445 |
|
| 446 |
// src/init.ts |
| 447 |
|
| 448 |
|
| 449 |
// src/hooks/use-toggle-button-props.ts |
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
// src/components/panel/panel.ts |
| 454 |
|
| 455 |
|
| 456 |
// src/components/panel/shell.tsx |
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
// src/components/panel/posts-list/posts-collapsible-list.tsx |
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
// src/hooks/use-posts.ts |
| 467 |
|
| 468 |
|
| 469 |
// src/api/post.ts |
| 470 |
|
| 471 |
|
| 472 |
var postTypesMap = { |
| 473 |
page: { |
| 474 |
labels: { |
| 475 |
singular_name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Page", "elementor"), |
| 476 |
plural_name: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Pages", "elementor") |
| 477 |
}, |
| 478 |
rest_base: "pages" |
| 479 |
} |
| 480 |
}; |
| 481 |
var getRequest = (postTypeSlug) => { |
| 482 |
const baseUri = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; |
| 483 |
const keys = ["id", "type", "title", "link", "status"]; |
| 484 |
const queryParams = new URLSearchParams({ |
| 485 |
status: "any", |
| 486 |
per_page: "-1", |
| 487 |
order: "asc", |
| 488 |
_fields: keys.join(",") |
| 489 |
}); |
| 490 |
const uri = baseUri + "?" + queryParams.toString(); |
| 491 |
return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ path: uri }); |
| 492 |
}; |
| 493 |
var createRequest = (postTypeSlug, newPost) => { |
| 494 |
const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; |
| 495 |
return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ |
| 496 |
path, |
| 497 |
method: "POST", |
| 498 |
data: newPost |
| 499 |
}); |
| 500 |
}; |
| 501 |
var updateRequest = (postTypeSlug, updatedPost) => { |
| 502 |
const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; |
| 503 |
const { id, ...data } = updatedPost; |
| 504 |
return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ |
| 505 |
path: `${path}/${id}`, |
| 506 |
method: "POST", |
| 507 |
data |
| 508 |
}); |
| 509 |
}; |
| 510 |
var deleteRequest = (postTypeSlug, postId) => { |
| 511 |
const path = `/wp/v2/${postTypesMap[postTypeSlug].rest_base}`; |
| 512 |
return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ |
| 513 |
path: `${path}/${postId}`, |
| 514 |
method: "DELETE" |
| 515 |
}); |
| 516 |
}; |
| 517 |
var duplicateRequest = (originalPost) => { |
| 518 |
const path = `/elementor/v1/site-navigation/duplicate-post`; |
| 519 |
return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ |
| 520 |
path, |
| 521 |
method: "POST", |
| 522 |
data: { |
| 523 |
post_id: originalPost.id, |
| 524 |
title: originalPost.title |
| 525 |
} |
| 526 |
}); |
| 527 |
}; |
| 528 |
|
| 529 |
// src/hooks/use-posts.ts |
| 530 |
var postsQueryKey = (postTypeSlug) => ["site-navigation", "posts", postTypeSlug]; |
| 531 |
function usePosts(postTypeSlug) { |
| 532 |
return (0,_elementor_query__WEBPACK_IMPORTED_MODULE_9__.useQuery)({ |
| 533 |
queryKey: postsQueryKey(postTypeSlug), |
| 534 |
queryFn: () => getRequest(postTypeSlug) |
| 535 |
}); |
| 536 |
} |
| 537 |
|
| 538 |
// src/contexts/post-list-context.tsx |
| 539 |
|
| 540 |
|
| 541 |
var defaultValues = { |
| 542 |
type: "page", |
| 543 |
editMode: { mode: "none", details: {} }, |
| 544 |
setEditMode: () => null, |
| 545 |
resetEditMode: () => null |
| 546 |
}; |
| 547 |
var PostListContext = (0,react__WEBPACK_IMPORTED_MODULE_1__.createContext)(defaultValues); |
| 548 |
var PostListContextProvider = ({ |
| 549 |
type, |
| 550 |
children |
| 551 |
}) => { |
| 552 |
const [editMode, setEditMode] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(defaultValues.editMode); |
| 553 |
const resetEditMode = () => { |
| 554 |
setEditMode(defaultValues.editMode); |
| 555 |
}; |
| 556 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PostListContext.Provider, { value: { |
| 557 |
type, |
| 558 |
editMode, |
| 559 |
setEditMode, |
| 560 |
resetEditMode |
| 561 |
} }, children); |
| 562 |
}; |
| 563 |
function usePostListContext() { |
| 564 |
const context = (0,react__WEBPACK_IMPORTED_MODULE_1__.useContext)(PostListContext); |
| 565 |
if (!context) { |
| 566 |
throw new Error("The `usePostListContext()` hook must be used within an `<PostListContextProvider />`"); |
| 567 |
} |
| 568 |
return context; |
| 569 |
} |
| 570 |
|
| 571 |
// src/components/panel/posts-list/collapsible-list.tsx |
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
var RotateIcon = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.styled)(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__.ChevronDownIcon, { |
| 577 |
shouldForwardProp: (prop) => prop !== "isOpen" |
| 578 |
})(({ theme, isOpen }) => ({ |
| 579 |
transform: isOpen ? "rotate(0deg)" : "rotate(-90deg)", |
| 580 |
transition: theme.transitions.create("transform", { |
| 581 |
duration: theme.transitions.duration.standard |
| 582 |
}) |
| 583 |
})); |
| 584 |
function CollapsibleList({ |
| 585 |
label, |
| 586 |
Icon, |
| 587 |
isOpenByDefault = false, |
| 588 |
children |
| 589 |
}) { |
| 590 |
const [isOpen, setIsOpen] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(isOpenByDefault); |
| 591 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItem, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemIcon, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 592 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, |
| 593 |
{ |
| 594 |
onClick: () => setIsOpen((prev) => !prev), |
| 595 |
sx: { color: "inherit" }, |
| 596 |
size: "small" |
| 597 |
}, |
| 598 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(RotateIcon, { fontSize: "small", isOpen }) |
| 599 |
)), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemIcon, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(Icon, null)), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemText, { primaryTypographyProps: { variant: "subtitle1", component: "span", sx: { fontWeight: "bold" } }, primary: label })), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 600 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Collapse, |
| 601 |
{ |
| 602 |
in: isOpen, |
| 603 |
timeout: "auto", |
| 604 |
unmountOnExit: true |
| 605 |
}, |
| 606 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.List, { dense: true }, children) |
| 607 |
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, { sx: { my: 3 } })); |
| 608 |
} |
| 609 |
|
| 610 |
// src/components/panel/posts-list/post-list-item.tsx |
| 611 |
|
| 612 |
|
| 613 |
// src/components/panel/posts-list/list-items/list-item-rename.tsx |
| 614 |
|
| 615 |
|
| 616 |
// src/hooks/use-posts-actions.ts |
| 617 |
|
| 618 |
function usePostActions(postTypeSlug) { |
| 619 |
const invalidatePosts = useInvalidatePosts(postTypeSlug); |
| 620 |
const onSuccess = () => invalidatePosts({ exact: true }); |
| 621 |
const createPost = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_9__.useMutation)( |
| 622 |
(newPost) => createRequest(postTypeSlug, newPost), |
| 623 |
{ onSuccess } |
| 624 |
); |
| 625 |
const updatePost = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_9__.useMutation)( |
| 626 |
(updatedPost) => updateRequest(postTypeSlug, updatedPost), |
| 627 |
{ onSuccess } |
| 628 |
); |
| 629 |
const deletePost = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_9__.useMutation)( |
| 630 |
(postId) => deleteRequest(postTypeSlug, postId), |
| 631 |
{ onSuccess } |
| 632 |
); |
| 633 |
const duplicatePost = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_9__.useMutation)( |
| 634 |
(originalPost) => duplicateRequest(originalPost), |
| 635 |
{ onSuccess } |
| 636 |
); |
| 637 |
return { |
| 638 |
createPost, |
| 639 |
updatePost, |
| 640 |
deletePost, |
| 641 |
duplicatePost |
| 642 |
}; |
| 643 |
} |
| 644 |
function useInvalidatePosts(postTypeSlug) { |
| 645 |
const queryClient = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_9__.useQueryClient)(); |
| 646 |
return (options = {}) => { |
| 647 |
const queryKey = postsQueryKey(postTypeSlug); |
| 648 |
return queryClient.invalidateQueries(queryKey, options); |
| 649 |
}; |
| 650 |
} |
| 651 |
|
| 652 |
// src/components/panel/posts-list/list-items/edit-mode-template.tsx |
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
function EditModeTemplate({ postTitle, isLoading, callback }) { |
| 659 |
const inputRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(); |
| 660 |
const [inputError, setInputError] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(""); |
| 661 |
const closeButton = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(); |
| 662 |
const onBlur = (e) => { |
| 663 |
if (closeButton.current === e.relatedTarget) { |
| 664 |
return; |
| 665 |
} |
| 666 |
runCallback(); |
| 667 |
}; |
| 668 |
const onFormSubmit = (e) => { |
| 669 |
e.preventDefault(); |
| 670 |
runCallback(); |
| 671 |
}; |
| 672 |
const validateInput = () => { |
| 673 |
let isValid = true; |
| 674 |
if (inputRef.current?.value === "") { |
| 675 |
isValid = false; |
| 676 |
setInputError((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Name is required", "elementor")); |
| 677 |
} |
| 678 |
return isValid; |
| 679 |
}; |
| 680 |
const runCallback = () => { |
| 681 |
if (!validateInput()) { |
| 682 |
return; |
| 683 |
} |
| 684 |
callback(inputRef.current?.value || ""); |
| 685 |
}; |
| 686 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 687 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItem, |
| 688 |
{ |
| 689 |
sx: { pt: 1, pl: 0 }, |
| 690 |
secondaryAction: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(CloseButton, { isLoading, closeButton }) |
| 691 |
}, |
| 692 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { width: "100%", sx: { ml: 4, pr: 3 }, component: "form", onSubmit: onFormSubmit }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 693 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.TextField, |
| 694 |
{ |
| 695 |
autoFocus: true, |
| 696 |
fullWidth: true, |
| 697 |
ref: inputRef, |
| 698 |
defaultValue: postTitle, |
| 699 |
disabled: isLoading, |
| 700 |
error: !!inputError, |
| 701 |
onBlur, |
| 702 |
variant: "outlined", |
| 703 |
color: "secondary", |
| 704 |
size: "small", |
| 705 |
margin: "dense" |
| 706 |
} |
| 707 |
)) |
| 708 |
); |
| 709 |
} |
| 710 |
function CloseButton({ isLoading, closeButton }) { |
| 711 |
const { resetEditMode } = usePostListContext(); |
| 712 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 713 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.IconButton, |
| 714 |
{ |
| 715 |
size: "small", |
| 716 |
color: "secondary", |
| 717 |
onClick: resetEditMode, |
| 718 |
ref: closeButton, |
| 719 |
disabled: isLoading |
| 720 |
}, |
| 721 |
isLoading ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.CircularProgress, null) : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__.XIcon, { fontSize: "small" }) |
| 722 |
); |
| 723 |
} |
| 724 |
|
| 725 |
// src/components/panel/posts-list/list-items/list-item-rename.tsx |
| 726 |
function ListItemRename({ post }) { |
| 727 |
const { type, resetEditMode } = usePostListContext(); |
| 728 |
const { updatePost } = usePostActions(type); |
| 729 |
const renamePostCallback = (inputValue) => { |
| 730 |
if (inputValue === post.title.rendered) { |
| 731 |
resetEditMode(); |
| 732 |
} |
| 733 |
updatePost.mutateAsync({ |
| 734 |
id: post.id, |
| 735 |
title: inputValue |
| 736 |
}, { |
| 737 |
onSuccess: () => { |
| 738 |
resetEditMode(); |
| 739 |
} |
| 740 |
}); |
| 741 |
}; |
| 742 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(EditModeTemplate, { postTitle: post.title.rendered, isLoading: updatePost.isLoading, callback: renamePostCallback }); |
| 743 |
} |
| 744 |
|
| 745 |
// src/components/panel/posts-list/list-items/list-item-create.tsx |
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
function ListItemCreate() { |
| 750 |
const { type, resetEditMode } = usePostListContext(); |
| 751 |
const { createPost } = usePostActions(type); |
| 752 |
const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.__useNavigateToDocument)(); |
| 753 |
const createPostCallback = (inputValue) => { |
| 754 |
createPost.mutateAsync({ |
| 755 |
title: inputValue, |
| 756 |
status: "draft" |
| 757 |
}, { |
| 758 |
onSuccess: (data) => { |
| 759 |
resetEditMode(); |
| 760 |
navigateToDocument(data.id); |
| 761 |
} |
| 762 |
}); |
| 763 |
}; |
| 764 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(EditModeTemplate, { postTitle: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("New Page", "elementor"), isLoading: createPost.isLoading, callback: createPostCallback }); |
| 765 |
} |
| 766 |
|
| 767 |
// src/components/panel/posts-list/list-items/list-item-duplicate.tsx |
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
function ListItemDuplicate() { |
| 772 |
const { type, editMode, resetEditMode } = usePostListContext(); |
| 773 |
const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.__useNavigateToDocument)(); |
| 774 |
const { duplicatePost } = usePostActions(type); |
| 775 |
if ("duplicate" !== editMode.mode) { |
| 776 |
return null; |
| 777 |
} |
| 778 |
const duplicatePostCallback = (inputValue) => { |
| 779 |
duplicatePost.mutateAsync({ |
| 780 |
id: editMode.details.postId, |
| 781 |
title: inputValue |
| 782 |
}, { |
| 783 |
onSuccess: (data) => { |
| 784 |
resetEditMode(); |
| 785 |
navigateToDocument(data.post_id); |
| 786 |
} |
| 787 |
}); |
| 788 |
}; |
| 789 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(EditModeTemplate, { postTitle: `${editMode.details.title} ${(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("copy", "elementor")}`, isLoading: duplicatePost.isLoading, callback: duplicatePostCallback }); |
| 790 |
} |
| 791 |
|
| 792 |
// src/components/panel/posts-list/list-items/list-item-view.tsx |
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
// src/components/shared/page-title-and-status.tsx |
| 799 |
|
| 800 |
|
| 801 |
var PageStatus = ({ status }) => { |
| 802 |
if ("publish" === status) { |
| 803 |
return null; |
| 804 |
} |
| 805 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 806 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, |
| 807 |
{ |
| 808 |
component: "span", |
| 809 |
variant: "body2", |
| 810 |
sx: { |
| 811 |
textTransform: "capitalize", |
| 812 |
fontStyle: "italic", |
| 813 |
whiteSpace: "nowrap", |
| 814 |
flexBasis: "content" |
| 815 |
} |
| 816 |
}, |
| 817 |
"(", |
| 818 |
status, |
| 819 |
")" |
| 820 |
); |
| 821 |
}; |
| 822 |
var PageTitle = ({ title }) => { |
| 823 |
const modifiedTitle = useReverseHtmlEntities(title); |
| 824 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 825 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, |
| 826 |
{ |
| 827 |
component: "span", |
| 828 |
variant: "body2", |
| 829 |
noWrap: true, |
| 830 |
sx: { |
| 831 |
flexBasis: "auto" |
| 832 |
} |
| 833 |
}, |
| 834 |
modifiedTitle |
| 835 |
); |
| 836 |
}; |
| 837 |
function PageTitleAndStatus({ page }) { |
| 838 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { display: "flex" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PageTitle, { title: page.title.rendered }), "\xA0", /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PageStatus, { status: page.status })); |
| 839 |
} |
| 840 |
|
| 841 |
// src/components/panel/actions-menu/actions/rename.tsx |
| 842 |
|
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
// src/components/panel/actions-menu/action-menu-item.tsx |
| 847 |
|
| 848 |
|
| 849 |
function ActionMenuItem({ title, icon: Icon, ListItemButtonProps }) { |
| 850 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuItem, { disableGutters: true }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 851 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemButton, |
| 852 |
{ |
| 853 |
...ListItemButtonProps |
| 854 |
}, |
| 855 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemIcon, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(Icon, null)), |
| 856 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemText, { primary: title }) |
| 857 |
)); |
| 858 |
} |
| 859 |
|
| 860 |
// src/components/panel/actions-menu/actions/rename.tsx |
| 861 |
function Rename({ post }) { |
| 862 |
const { setEditMode } = usePostListContext(); |
| 863 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 864 |
ActionMenuItem, |
| 865 |
{ |
| 866 |
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Rename", "elementor"), |
| 867 |
icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.EraseIcon, |
| 868 |
ListItemButtonProps: { |
| 869 |
onClick: () => { |
| 870 |
setEditMode({ |
| 871 |
mode: "rename", |
| 872 |
details: { |
| 873 |
postId: post.id |
| 874 |
} |
| 875 |
}); |
| 876 |
} |
| 877 |
} |
| 878 |
} |
| 879 |
); |
| 880 |
} |
| 881 |
|
| 882 |
// src/components/panel/actions-menu/actions/duplicate.tsx |
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
function Duplicate({ post, popupState }) { |
| 887 |
const { setEditMode } = usePostListContext(); |
| 888 |
const onClick = () => { |
| 889 |
popupState.close(); |
| 890 |
setEditMode({ |
| 891 |
mode: "duplicate", |
| 892 |
details: { |
| 893 |
postId: post.id, |
| 894 |
title: post.title.rendered |
| 895 |
} |
| 896 |
}); |
| 897 |
}; |
| 898 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 899 |
ActionMenuItem, |
| 900 |
{ |
| 901 |
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Duplicate", "elementor"), |
| 902 |
icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.CopyIcon, |
| 903 |
ListItemButtonProps: { |
| 904 |
onClick |
| 905 |
} |
| 906 |
} |
| 907 |
); |
| 908 |
} |
| 909 |
|
| 910 |
// src/components/panel/actions-menu/actions/delete.tsx |
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
function Delete({ post }) { |
| 918 |
const [isDialogOpen, setIsDialogOpen] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); |
| 919 |
const activeDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.__useActiveDocument)(); |
| 920 |
const isPostActive = activeDocument?.id === post.id; |
| 921 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 922 |
ActionMenuItem, |
| 923 |
{ |
| 924 |
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Delete", "elementor"), |
| 925 |
icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.TrashIcon, |
| 926 |
ListItemButtonProps: { |
| 927 |
disabled: post.isHome || isPostActive, |
| 928 |
onClick: () => setIsDialogOpen(true), |
| 929 |
sx: { "&:hover": { color: "error.main" } } |
| 930 |
} |
| 931 |
} |
| 932 |
), isDialogOpen && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(DeleteDialog, { post, setIsDialogOpen })); |
| 933 |
} |
| 934 |
function DeleteDialog({ post, setIsDialogOpen }) { |
| 935 |
const { type } = usePostListContext(); |
| 936 |
const { deletePost } = usePostActions(type); |
| 937 |
const dialogTitle = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.sprintf)((0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)('Delete "%s"?', "elementor"), post.title.rendered); |
| 938 |
const deletePage = async () => { |
| 939 |
await deletePost.mutateAsync(post.id); |
| 940 |
}; |
| 941 |
const handleCancel = () => { |
| 942 |
if (deletePost.isLoading) { |
| 943 |
return; |
| 944 |
} |
| 945 |
setIsDialogOpen(false); |
| 946 |
}; |
| 947 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 948 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Dialog, |
| 949 |
{ |
| 950 |
open: true, |
| 951 |
onClose: handleCancel, |
| 952 |
"aria-labelledby": "delete-dialog" |
| 953 |
}, |
| 954 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.DialogTitle, { noWrap: true }, dialogTitle), |
| 955 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, null), |
| 956 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.DialogContent, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.DialogContentText, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("The page and its content will be deleted forever and we won\u2019t be able to recover them.", "elementor"))), |
| 957 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.DialogActions, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, { variant: "contained", color: "secondary", onClick: handleCancel, disabled: deletePost.isLoading }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Cancel", "elementor")), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, { variant: "contained", color: "error", onClick: deletePage, disabled: deletePost.isLoading }, !deletePost.isLoading ? (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Delete", "elementor") : /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.CircularProgress, null))) |
| 958 |
); |
| 959 |
} |
| 960 |
|
| 961 |
// src/components/panel/actions-menu/actions/view.tsx |
| 962 |
|
| 963 |
|
| 964 |
|
| 965 |
function View({ post }) { |
| 966 |
const { type } = usePostListContext(); |
| 967 |
const title = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("View %s", "elementor").replace("%s", postTypesMap[type].labels.singular_name); |
| 968 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 969 |
ActionMenuItem, |
| 970 |
{ |
| 971 |
title, |
| 972 |
icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.EyeIcon, |
| 973 |
ListItemButtonProps: { |
| 974 |
onClick: () => window.open(post.link, "_blank") |
| 975 |
} |
| 976 |
} |
| 977 |
); |
| 978 |
} |
| 979 |
|
| 980 |
// src/components/panel/actions-menu/actions/set-home.tsx |
| 981 |
|
| 982 |
|
| 983 |
|
| 984 |
|
| 985 |
// src/hooks/use-homepage-actions.ts |
| 986 |
|
| 987 |
|
| 988 |
// src/api/settings.ts |
| 989 |
|
| 990 |
var getSettings = () => { |
| 991 |
const baseUri = "/wp/v2/settings"; |
| 992 |
const keys = ["show_on_front", "page_on_front"]; |
| 993 |
const queryParams = new URLSearchParams({ |
| 994 |
_fields: keys.join(",") |
| 995 |
}); |
| 996 |
const uri = baseUri + "?" + queryParams.toString(); |
| 997 |
return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ path: uri }); |
| 998 |
}; |
| 999 |
var updateSettings = (settings) => { |
| 1000 |
return _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ |
| 1001 |
path: "/wp/v2/settings", |
| 1002 |
method: "POST", |
| 1003 |
data: settings |
| 1004 |
}); |
| 1005 |
}; |
| 1006 |
|
| 1007 |
// src/hooks/use-homepage.ts |
| 1008 |
|
| 1009 |
var settingsQueryKey = () => ["site-navigation", "homepage"]; |
| 1010 |
function useHomepage() { |
| 1011 |
return (0,_elementor_query__WEBPACK_IMPORTED_MODULE_9__.useQuery)({ |
| 1012 |
queryKey: settingsQueryKey(), |
| 1013 |
queryFn: () => getSettings() |
| 1014 |
}); |
| 1015 |
} |
| 1016 |
|
| 1017 |
// src/hooks/use-homepage-actions.ts |
| 1018 |
function useHomepageActions() { |
| 1019 |
const invalidateSettings = useInvalidateSettings(); |
| 1020 |
const onSuccess = async () => invalidateSettings({ exact: true }); |
| 1021 |
const updateSettingsMutation = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_9__.useMutation)( |
| 1022 |
(settings) => updateSettings(settings), |
| 1023 |
{ onSuccess } |
| 1024 |
); |
| 1025 |
return { updateSettingsMutation }; |
| 1026 |
} |
| 1027 |
function useInvalidateSettings() { |
| 1028 |
const queryClient = (0,_elementor_query__WEBPACK_IMPORTED_MODULE_9__.useQueryClient)(); |
| 1029 |
return (options = {}) => { |
| 1030 |
const queryKey = settingsQueryKey(); |
| 1031 |
return queryClient.invalidateQueries(queryKey, options); |
| 1032 |
}; |
| 1033 |
} |
| 1034 |
|
| 1035 |
// src/components/panel/actions-menu/actions/set-home.tsx |
| 1036 |
|
| 1037 |
function SetHome({ post }) { |
| 1038 |
const { updateSettingsMutation } = useHomepageActions(); |
| 1039 |
const handleClick = () => { |
| 1040 |
updateSettingsMutation.mutateAsync({ show_on_front: "page", page_on_front: post.id }); |
| 1041 |
}; |
| 1042 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1043 |
ActionMenuItem, |
| 1044 |
{ |
| 1045 |
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Set as homepage", "elementor"), |
| 1046 |
icon: !updateSettingsMutation.isLoading ? _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.HomeIcon : _elementor_ui__WEBPACK_IMPORTED_MODULE_2__.CircularProgress, |
| 1047 |
ListItemButtonProps: { |
| 1048 |
disabled: !!post.isHome || post.status !== "publish" || updateSettingsMutation.isLoading, |
| 1049 |
onClick: handleClick |
| 1050 |
} |
| 1051 |
} |
| 1052 |
); |
| 1053 |
} |
| 1054 |
|
| 1055 |
// src/components/panel/posts-list/list-items/list-item-view.tsx |
| 1056 |
|
| 1057 |
function ListItemView({ post }) { |
| 1058 |
const activeDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.__useActiveDocument)(); |
| 1059 |
const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.__useNavigateToDocument)(); |
| 1060 |
const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.usePopupState)({ |
| 1061 |
variant: "popover", |
| 1062 |
popupId: "post-actions", |
| 1063 |
disableAutoFocus: true |
| 1064 |
}); |
| 1065 |
const isActive = activeDocument?.id === post.id; |
| 1066 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1067 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItem, |
| 1068 |
{ |
| 1069 |
disablePadding: true, |
| 1070 |
secondaryAction: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1071 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ToggleButton, |
| 1072 |
{ |
| 1073 |
value: true, |
| 1074 |
color: "secondary", |
| 1075 |
size: "small", |
| 1076 |
selected: popupState.isOpen, |
| 1077 |
...(0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindTrigger)(popupState) |
| 1078 |
}, |
| 1079 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__.DotsVerticalIcon, { fontSize: "small" }) |
| 1080 |
) |
| 1081 |
}, |
| 1082 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1083 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemButton, |
| 1084 |
{ |
| 1085 |
selected: isActive, |
| 1086 |
onClick: () => { |
| 1087 |
if (!isActive) { |
| 1088 |
navigateToDocument(post.id); |
| 1089 |
} |
| 1090 |
}, |
| 1091 |
dense: true, |
| 1092 |
disableGutters: true |
| 1093 |
}, |
| 1094 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemIcon, null), |
| 1095 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1096 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemText, |
| 1097 |
{ |
| 1098 |
disableTypography: true |
| 1099 |
}, |
| 1100 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PageTitleAndStatus, { page: post }) |
| 1101 |
), |
| 1102 |
post.isHome && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListItemIcon, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__.HomeIcon, { titleAccess: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Homepage", "elementor"), color: "disabled" })) |
| 1103 |
) |
| 1104 |
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1105 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Menu, |
| 1106 |
{ |
| 1107 |
PaperProps: { sx: { mt: 2, width: 200 } }, |
| 1108 |
MenuListProps: { dense: true }, |
| 1109 |
...(0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindMenu)(popupState) |
| 1110 |
}, |
| 1111 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(Rename, { post }), |
| 1112 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(Duplicate, { post, popupState }), |
| 1113 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(Delete, { post }), |
| 1114 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(View, { post }), |
| 1115 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, null), |
| 1116 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(SetHome, { post }) |
| 1117 |
)); |
| 1118 |
} |
| 1119 |
|
| 1120 |
// src/components/panel/posts-list/post-list-item.tsx |
| 1121 |
function PostListItem2({ post }) { |
| 1122 |
const { editMode } = usePostListContext(); |
| 1123 |
if ("rename" === editMode.mode && post?.id && post?.id === editMode.details.postId) { |
| 1124 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(ListItemRename, { post }); |
| 1125 |
} |
| 1126 |
if ("create" === editMode.mode && !post) { |
| 1127 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(ListItemCreate, null); |
| 1128 |
} |
| 1129 |
if ("duplicate" === editMode.mode && !post) { |
| 1130 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(ListItemDuplicate, null); |
| 1131 |
} |
| 1132 |
if (!post) { |
| 1133 |
return null; |
| 1134 |
} |
| 1135 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(ListItemView, { post }); |
| 1136 |
} |
| 1137 |
|
| 1138 |
// src/components/panel/add-new-button.tsx |
| 1139 |
|
| 1140 |
|
| 1141 |
|
| 1142 |
|
| 1143 |
function AddNewButton() { |
| 1144 |
const { setEditMode } = usePostListContext(); |
| 1145 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1146 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, |
| 1147 |
{ |
| 1148 |
size: "small", |
| 1149 |
sx: { mt: 4, mb: 4, mr: 5 }, |
| 1150 |
startIcon: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PlusIcon, null), |
| 1151 |
onClick: () => { |
| 1152 |
setEditMode({ mode: "create", details: {} }); |
| 1153 |
} |
| 1154 |
}, |
| 1155 |
(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Add New", "elementor") |
| 1156 |
); |
| 1157 |
} |
| 1158 |
|
| 1159 |
// src/components/panel/posts-list/posts-collapsible-list.tsx |
| 1160 |
function PostsCollapsibleList({ isOpenByDefault = false }) { |
| 1161 |
const { type, editMode } = usePostListContext(); |
| 1162 |
const { data: posts, isLoading: postsLoading } = usePosts(type); |
| 1163 |
const { data: homepageSettings } = useHomepage(); |
| 1164 |
if (!posts || postsLoading) { |
| 1165 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { sx: { px: 5 } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1166 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, |
| 1167 |
{ |
| 1168 |
display: "flex", |
| 1169 |
justifyContent: "flex-end", |
| 1170 |
alignItems: "center" |
| 1171 |
}, |
| 1172 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { sx: { my: 4 }, animation: "wave", variant: "rounded", width: "110px", height: "28px" }) |
| 1173 |
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "100%", height: "24px" }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Skeleton, { sx: { my: 3 }, animation: "wave", variant: "rounded", width: "70%", height: "24px" }))); |
| 1174 |
} |
| 1175 |
const label = `${postTypesMap[type].labels.plural_name} (${posts.length.toString()})`; |
| 1176 |
const isHomepageSet = homepageSettings?.show_on_front === "page" && !!homepageSettings?.page_on_front; |
| 1177 |
const homepageId = isHomepageSet ? homepageSettings.page_on_front : null; |
| 1178 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1179 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, |
| 1180 |
{ |
| 1181 |
display: "flex", |
| 1182 |
justifyContent: "flex-end", |
| 1183 |
alignItems: "center" |
| 1184 |
}, |
| 1185 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(AddNewButton, null) |
| 1186 |
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.List, { dense: true }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 1187 |
CollapsibleList, |
| 1188 |
{ |
| 1189 |
label, |
| 1190 |
Icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PageTypeIcon, |
| 1191 |
isOpenByDefault: isOpenByDefault || false |
| 1192 |
}, |
| 1193 |
posts.map((post) => { |
| 1194 |
post = { ...post, isHome: post.id === homepageId }; |
| 1195 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PostListItem2, { key: post.id, post }); |
| 1196 |
}), |
| 1197 |
["duplicate", "create"].includes(editMode.mode) && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PostListItem2, null) |
| 1198 |
))); |
| 1199 |
} |
| 1200 |
|
| 1201 |
// src/components/panel/shell.tsx |
| 1202 |
var Shell = () => { |
| 1203 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_8__.Panel, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_8__.PanelHeader, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_8__.PanelHeaderTitle, null, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Pages", "elementor"))), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_8__.PanelBody, null, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PostListContextProvider, { type: "page" }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PostsCollapsibleList, { isOpenByDefault: true })))); |
| 1204 |
}; |
| 1205 |
var shell_default = Shell; |
| 1206 |
|
| 1207 |
// src/components/panel/panel.ts |
| 1208 |
var { |
| 1209 |
panel, |
| 1210 |
usePanelStatus, |
| 1211 |
usePanelActions |
| 1212 |
} = (0,_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_8__.__createPanel)({ |
| 1213 |
id: "site-navigation-panel", |
| 1214 |
component: shell_default |
| 1215 |
}); |
| 1216 |
|
| 1217 |
// src/hooks/use-toggle-button-props.ts |
| 1218 |
function useToggleButtonProps() { |
| 1219 |
const { isOpen, isBlocked } = usePanelStatus(); |
| 1220 |
const { open, close } = usePanelActions(); |
| 1221 |
return { |
| 1222 |
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Pages", "elementor"), |
| 1223 |
icon: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PagesIcon, |
| 1224 |
onClick: () => isOpen ? close() : open(), |
| 1225 |
selected: isOpen, |
| 1226 |
disabled: isBlocked |
| 1227 |
}; |
| 1228 |
} |
| 1229 |
|
| 1230 |
// src/init.ts |
| 1231 |
|
| 1232 |
|
| 1233 |
// src/env.ts |
| 1234 |
|
| 1235 |
var { env, validateEnv } = (0,_elementor_env__WEBPACK_IMPORTED_MODULE_10__.parseEnv)("@elementor/editor-site-navigation", (envData) => { |
| 1236 |
return envData; |
| 1237 |
}); |
| 1238 |
|
| 1239 |
// src/init.ts |
| 1240 |
function init() { |
| 1241 |
registerTopBarMenuItems(); |
| 1242 |
if (env.is_pages_panel_active) { |
| 1243 |
(0,_elementor_editor_panels__WEBPACK_IMPORTED_MODULE_8__.__registerPanel)(panel); |
| 1244 |
registerButton(); |
| 1245 |
} |
| 1246 |
} |
| 1247 |
function registerTopBarMenuItems() { |
| 1248 |
(0,_elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_7__.injectIntoPageIndication)({ |
| 1249 |
id: "document-recently-edited", |
| 1250 |
component: RecentlyEdited |
| 1251 |
}); |
| 1252 |
} |
| 1253 |
function registerButton() { |
| 1254 |
_elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_7__.toolsMenu.registerToggleAction({ |
| 1255 |
id: "toggle-site-navigation-panel", |
| 1256 |
priority: 2, |
| 1257 |
useProps: useToggleButtonProps |
| 1258 |
}); |
| 1259 |
} |
| 1260 |
|
| 1261 |
// src/index.ts |
| 1262 |
init(); |
| 1263 |
|
| 1264 |
|
| 1265 |
}(); |
| 1266 |
(window.elementorV2 = window.elementorV2 || {}).editorSiteNavigation = __webpack_exports__; |
| 1267 |
/******/ })() |
| 1268 |
; |