| 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 ["__UNSTABLE__elementorPackages","editorAppBar"] ***! |
| 18 |
\*****************************************************************/ |
| 19 |
/***/ (function(module) { |
| 20 |
|
| 21 |
module.exports = window["__UNSTABLE__elementorPackages"]["editorAppBar"]; |
| 22 |
|
| 23 |
/***/ }), |
| 24 |
|
| 25 |
/***/ "@elementor/editor-documents": |
| 26 |
/*!********************************************************************!*\ |
| 27 |
!*** external ["__UNSTABLE__elementorPackages","editorDocuments"] ***! |
| 28 |
\********************************************************************/ |
| 29 |
/***/ (function(module) { |
| 30 |
|
| 31 |
module.exports = window["__UNSTABLE__elementorPackages"]["editorDocuments"]; |
| 32 |
|
| 33 |
/***/ }), |
| 34 |
|
| 35 |
/***/ "@elementor/icons": |
| 36 |
/*!**********************************************************!*\ |
| 37 |
!*** external ["__UNSTABLE__elementorPackages","icons"] ***! |
| 38 |
\**********************************************************/ |
| 39 |
/***/ (function(module) { |
| 40 |
|
| 41 |
module.exports = window["__UNSTABLE__elementorPackages"]["icons"]; |
| 42 |
|
| 43 |
/***/ }), |
| 44 |
|
| 45 |
/***/ "@elementor/ui": |
| 46 |
/*!*******************************************************!*\ |
| 47 |
!*** external ["__UNSTABLE__elementorPackages","ui"] ***! |
| 48 |
\*******************************************************/ |
| 49 |
/***/ (function(module) { |
| 50 |
|
| 51 |
module.exports = window["__UNSTABLE__elementorPackages"]["ui"]; |
| 52 |
|
| 53 |
/***/ }), |
| 54 |
|
| 55 |
/***/ "@wordpress/api-fetch": |
| 56 |
/*!**********************************!*\ |
| 57 |
!*** external ["wp","apiFetch"] ***! |
| 58 |
\**********************************/ |
| 59 |
/***/ (function(module) { |
| 60 |
|
| 61 |
module.exports = window["wp"]["apiFetch"]; |
| 62 |
|
| 63 |
/***/ }), |
| 64 |
|
| 65 |
/***/ "@wordpress/i18n": |
| 66 |
/*!******************************!*\ |
| 67 |
!*** external ["wp","i18n"] ***! |
| 68 |
\******************************/ |
| 69 |
/***/ (function(module) { |
| 70 |
|
| 71 |
module.exports = window["wp"]["i18n"]; |
| 72 |
|
| 73 |
/***/ }), |
| 74 |
|
| 75 |
/***/ "@wordpress/url": |
| 76 |
/*!*****************************!*\ |
| 77 |
!*** external ["wp","url"] ***! |
| 78 |
\*****************************/ |
| 79 |
/***/ (function(module) { |
| 80 |
|
| 81 |
module.exports = window["wp"]["url"]; |
| 82 |
|
| 83 |
/***/ }) |
| 84 |
|
| 85 |
/******/ }); |
| 86 |
/************************************************************************/ |
| 87 |
/******/ // The module cache |
| 88 |
/******/ var __webpack_module_cache__ = {}; |
| 89 |
/******/ |
| 90 |
/******/ // The require function |
| 91 |
/******/ function __webpack_require__(moduleId) { |
| 92 |
/******/ // Check if module is in cache |
| 93 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 94 |
/******/ if (cachedModule !== undefined) { |
| 95 |
/******/ return cachedModule.exports; |
| 96 |
/******/ } |
| 97 |
/******/ // Create a new module (and put it into the cache) |
| 98 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 99 |
/******/ // no module.id needed |
| 100 |
/******/ // no module.loaded needed |
| 101 |
/******/ exports: {} |
| 102 |
/******/ }; |
| 103 |
/******/ |
| 104 |
/******/ // Execute the module function |
| 105 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 106 |
/******/ |
| 107 |
/******/ // Return the exports of the module |
| 108 |
/******/ return module.exports; |
| 109 |
/******/ } |
| 110 |
/******/ |
| 111 |
/************************************************************************/ |
| 112 |
/******/ /* webpack/runtime/define property getters */ |
| 113 |
/******/ !function() { |
| 114 |
/******/ // define getter functions for harmony exports |
| 115 |
/******/ __webpack_require__.d = function(exports, definition) { |
| 116 |
/******/ for(var key in definition) { |
| 117 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 118 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 119 |
/******/ } |
| 120 |
/******/ } |
| 121 |
/******/ }; |
| 122 |
/******/ }(); |
| 123 |
/******/ |
| 124 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 125 |
/******/ !function() { |
| 126 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
| 127 |
/******/ }(); |
| 128 |
/******/ |
| 129 |
/******/ /* webpack/runtime/make namespace object */ |
| 130 |
/******/ !function() { |
| 131 |
/******/ // define __esModule on exports |
| 132 |
/******/ __webpack_require__.r = function(exports) { |
| 133 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 134 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 135 |
/******/ } |
| 136 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 137 |
/******/ }; |
| 138 |
/******/ }(); |
| 139 |
/******/ |
| 140 |
/************************************************************************/ |
| 141 |
var __webpack_exports__ = {}; |
| 142 |
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. |
| 143 |
!function() { |
| 144 |
/*!***********************************************************************!*\ |
| 145 |
!*** ./node_modules/@elementor/editor-site-navigation/dist/index.mjs ***! |
| 146 |
\***********************************************************************/ |
| 147 |
__webpack_require__.r(__webpack_exports__); |
| 148 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 149 |
/* harmony export */ "extendIconsMap": function() { return /* binding */ extendIconsMap; } |
| 150 |
/* harmony export */ }); |
| 151 |
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons"); |
| 152 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react"); |
| 153 |
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui"); |
| 154 |
/* harmony import */ var _elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/editor-documents */ "@elementor/editor-documents"); |
| 155 |
/* harmony import */ var _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/api-fetch */ "@wordpress/api-fetch"); |
| 156 |
/* harmony import */ var _wordpress_url__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/url */ "@wordpress/url"); |
| 157 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 158 |
/* harmony import */ var _elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @elementor/editor-app-bar */ "@elementor/editor-app-bar"); |
| 159 |
// src/icons-map.ts |
| 160 |
|
| 161 |
var initialIconsMap = { |
| 162 |
page: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PageTemplateIcon, |
| 163 |
section: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.SectionTemplateIcon, |
| 164 |
container: _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.ContainerTemplateIcon, |
| 165 |
"wp-page": _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PageTypeIcon, |
| 166 |
"wp-post": _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PostTypeIcon |
| 167 |
}; |
| 168 |
var iconsMap = { ...initialIconsMap }; |
| 169 |
function extendIconsMap(additionalIcons) { |
| 170 |
Object.assign(iconsMap, additionalIcons); |
| 171 |
} |
| 172 |
function getIconsMap() { |
| 173 |
return iconsMap; |
| 174 |
} |
| 175 |
|
| 176 |
// src/components/top-bar/recently-edited.tsx |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
// src/components/top-bar/indicator.tsx |
| 183 |
|
| 184 |
|
| 185 |
function Indicator({ title, status }) { |
| 186 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(Tooltip, { title }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Stack, { direction: "row", alignItems: "center", spacing: 2 }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, { 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, { variant: "body2", sx: { fontStyle: "italic" } }, "(", status.label, ")"))); |
| 187 |
} |
| 188 |
function Tooltip(props) { |
| 189 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 190 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Tooltip, |
| 191 |
{ |
| 192 |
PopperProps: { |
| 193 |
sx: { |
| 194 |
"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": { |
| 195 |
mt: 7 |
| 196 |
} |
| 197 |
} |
| 198 |
}, |
| 199 |
...props |
| 200 |
} |
| 201 |
); |
| 202 |
} |
| 203 |
|
| 204 |
// src/hooks/use-recent-posts.ts |
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
var endpointPath = "/elementor/v1/site-navigation/recent-posts"; |
| 209 |
function useRecentPosts(documentId) { |
| 210 |
const [recentPosts, setRecentPosts] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)([]); |
| 211 |
const [isLoading, setIsLoading] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); |
| 212 |
(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(() => { |
| 213 |
if (documentId) { |
| 214 |
setIsLoading(true); |
| 215 |
fetchRecentlyEditedPosts(documentId).then((posts) => { |
| 216 |
setRecentPosts(posts); |
| 217 |
setIsLoading(false); |
| 218 |
}); |
| 219 |
} |
| 220 |
}, [documentId]); |
| 221 |
return { |
| 222 |
isLoading, |
| 223 |
recentPosts |
| 224 |
}; |
| 225 |
} |
| 226 |
async function fetchRecentlyEditedPosts(documentId) { |
| 227 |
const queryParams = { |
| 228 |
posts_per_page: 5, |
| 229 |
post__not_in: documentId |
| 230 |
}; |
| 231 |
return await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ |
| 232 |
path: (0,_wordpress_url__WEBPACK_IMPORTED_MODULE_5__.addQueryArgs)(endpointPath, queryParams) |
| 233 |
}).then((response) => response).catch(() => []); |
| 234 |
} |
| 235 |
|
| 236 |
// src/components/top-bar/recently-edited.tsx |
| 237 |
|
| 238 |
|
| 239 |
// src/components/top-bar/chip-doc-type.tsx |
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
var iconsMap2 = getIconsMap(); |
| 244 |
function DocTypeChip({ postType, docType, label }) { |
| 245 |
const color = "elementor_library" === postType ? "global" : "primary"; |
| 246 |
const Icon = iconsMap2[docType] || _elementor_icons__WEBPACK_IMPORTED_MODULE_0__.PostTypeIcon; |
| 247 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 248 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Chip, |
| 249 |
{ |
| 250 |
size: "medium", |
| 251 |
variant: "standard", |
| 252 |
label, |
| 253 |
color, |
| 254 |
icon: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(Icon, null), |
| 255 |
sx: { ml: 3 } |
| 256 |
} |
| 257 |
); |
| 258 |
} |
| 259 |
|
| 260 |
// src/components/top-bar/post-list-item.tsx |
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
// src/hooks/use-reverse-html-entities.ts |
| 266 |
|
| 267 |
function useReverseHtmlEntities(escapedHTML = "") { |
| 268 |
return (0,react__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => { |
| 269 |
const textarea = document.createElement("textarea"); |
| 270 |
textarea.innerHTML = escapedHTML; |
| 271 |
const { value } = textarea; |
| 272 |
textarea.remove(); |
| 273 |
return value; |
| 274 |
}, [escapedHTML]); |
| 275 |
} |
| 276 |
|
| 277 |
// src/components/top-bar/post-list-item.tsx |
| 278 |
function PostListItem({ post, closePopup }) { |
| 279 |
const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.useNavigateToDocument)(); |
| 280 |
const postTitle = useReverseHtmlEntities(post.title); |
| 281 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuItem, { dense: true, sx: { width: "100%" }, onClick: () => { |
| 282 |
closePopup(); |
| 283 |
navigateToDocument(post.id); |
| 284 |
} }, postTitle, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(DocTypeChip, { postType: post.type.post_type, docType: post.type.doc_type, label: post.type.label })); |
| 285 |
} |
| 286 |
|
| 287 |
// src/components/top-bar/create-post-list-item.tsx |
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
// src/hooks/use-create-page.ts |
| 292 |
|
| 293 |
|
| 294 |
var endpointPath2 = "/elementor/v1/site-navigation/add-new-post"; |
| 295 |
function useCreatePage() { |
| 296 |
const [isLoading, setIsLoading] = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(false); |
| 297 |
return { |
| 298 |
create: () => { |
| 299 |
setIsLoading(true); |
| 300 |
return addNewPage().then((newPost) => newPost).finally(() => setIsLoading(false)); |
| 301 |
}, |
| 302 |
isLoading |
| 303 |
}; |
| 304 |
} |
| 305 |
async function addNewPage() { |
| 306 |
return await _wordpress_api_fetch__WEBPACK_IMPORTED_MODULE_4__({ |
| 307 |
path: endpointPath2, |
| 308 |
method: "POST", |
| 309 |
data: { post_type: "page" } |
| 310 |
}); |
| 311 |
} |
| 312 |
|
| 313 |
// src/components/top-bar/create-post-list-item.tsx |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
function CreatePostListItem({ closePopup }) { |
| 318 |
const { create, isLoading } = useCreatePage(); |
| 319 |
const navigateToDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.useNavigateToDocument)(); |
| 320 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.MenuItem, { dense: true, size: "small", color: "inherit", component: "div", onClick: async () => { |
| 321 |
const { id } = await create(); |
| 322 |
closePopup(); |
| 323 |
navigateToDocument(id); |
| 324 |
} }, /* @__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)), (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Add new page", "elementor")); |
| 325 |
} |
| 326 |
|
| 327 |
// src/components/top-bar/recently-edited.tsx |
| 328 |
function RecentlyEdited() { |
| 329 |
const activeDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.useActiveDocument)(); |
| 330 |
const hostDocument = (0,_elementor_editor_documents__WEBPACK_IMPORTED_MODULE_3__.useHostDocument)(); |
| 331 |
const document2 = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument; |
| 332 |
const { recentPosts } = useRecentPosts(document2?.id); |
| 333 |
const popupState = (0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.usePopupState)({ |
| 334 |
variant: "popover", |
| 335 |
popupId: "elementor-v2-top-bar-recently-edited" |
| 336 |
}); |
| 337 |
const documentTitle = useReverseHtmlEntities(document2?.title); |
| 338 |
if (!document2) { |
| 339 |
return null; |
| 340 |
} |
| 341 |
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Box, { sx: { cursor: "default" } }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 342 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Button, |
| 343 |
{ |
| 344 |
color: "inherit", |
| 345 |
size: "small", |
| 346 |
endIcon: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_icons__WEBPACK_IMPORTED_MODULE_0__.ChevronDownIcon, { fontSize: "small" }), |
| 347 |
...(0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindTrigger)(popupState) |
| 348 |
}, |
| 349 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 350 |
Indicator, |
| 351 |
{ |
| 352 |
title: documentTitle, |
| 353 |
status: document2.status |
| 354 |
} |
| 355 |
) |
| 356 |
), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement( |
| 357 |
_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Menu, |
| 358 |
{ |
| 359 |
MenuListProps: { component: "div" }, |
| 360 |
PaperProps: { sx: { mt: 4, minWidth: 314 } }, |
| 361 |
...(0,_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.bindMenu)(popupState) |
| 362 |
}, |
| 363 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.ListSubheader, { sx: { fontSize: 12, fontStyle: "italic", pl: 4 }, component: "div", id: "nested-list-subheader" }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("Recent", "elementor")), |
| 364 |
recentPosts.map((post) => /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(PostListItem, { key: post.id, post, closePopup: popupState.close })), |
| 365 |
recentPosts.length === 0 && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Typography, { variant: "caption", sx: { color: "grey.500", fontStyle: "italic", p: 4 }, component: "div", "aria-label": void 0 }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_6__.__)("There are no other pages or templates on this site yet.", "elementor")), |
| 366 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(_elementor_ui__WEBPACK_IMPORTED_MODULE_2__.Divider, null), |
| 367 |
/* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_1__.createElement(CreatePostListItem, { closePopup: popupState.close }) |
| 368 |
)); |
| 369 |
} |
| 370 |
|
| 371 |
// src/init.ts |
| 372 |
|
| 373 |
function init() { |
| 374 |
registerTopBarMenuItems(); |
| 375 |
} |
| 376 |
function registerTopBarMenuItems() { |
| 377 |
(0,_elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_7__.injectIntoPageIndication)({ |
| 378 |
id: "document-recently-edited", |
| 379 |
filler: RecentlyEdited |
| 380 |
}); |
| 381 |
} |
| 382 |
|
| 383 |
// src/index.ts |
| 384 |
init(); |
| 385 |
|
| 386 |
|
| 387 |
}(); |
| 388 |
(window.__UNSTABLE__elementorPackages = window.__UNSTABLE__elementorPackages || {}).editorSiteNavigation = __webpack_exports__; |
| 389 |
/******/ })() |
| 390 |
; |