| 1 |
/******/ (function() { // webpackBootstrap |
| 2 |
/******/ "use strict"; |
| 3 |
/******/ // The require scope |
| 4 |
/******/ var __webpack_require__ = {}; |
| 5 |
/******/ |
| 6 |
/************************************************************************/ |
| 7 |
/******/ /* webpack/runtime/compat get default export */ |
| 8 |
/******/ !function() { |
| 9 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
| 10 |
/******/ __webpack_require__.n = function(module) { |
| 11 |
/******/ var getter = module && module.__esModule ? |
| 12 |
/******/ function() { return module['default']; } : |
| 13 |
/******/ function() { return module; }; |
| 14 |
/******/ __webpack_require__.d(getter, { a: getter }); |
| 15 |
/******/ return getter; |
| 16 |
/******/ }; |
| 17 |
/******/ }(); |
| 18 |
/******/ |
| 19 |
/******/ /* webpack/runtime/define property getters */ |
| 20 |
/******/ !function() { |
| 21 |
/******/ // define getter functions for harmony exports |
| 22 |
/******/ __webpack_require__.d = function(exports, definition) { |
| 23 |
/******/ for(var key in definition) { |
| 24 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 25 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 26 |
/******/ } |
| 27 |
/******/ } |
| 28 |
/******/ }; |
| 29 |
/******/ }(); |
| 30 |
/******/ |
| 31 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 32 |
/******/ !function() { |
| 33 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
| 34 |
/******/ }(); |
| 35 |
/******/ |
| 36 |
/******/ /* webpack/runtime/make namespace object */ |
| 37 |
/******/ !function() { |
| 38 |
/******/ // define __esModule on exports |
| 39 |
/******/ __webpack_require__.r = function(exports) { |
| 40 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 41 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 42 |
/******/ } |
| 43 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 44 |
/******/ }; |
| 45 |
/******/ }(); |
| 46 |
/******/ |
| 47 |
/************************************************************************/ |
| 48 |
var __webpack_exports__ = {}; |
| 49 |
// ESM COMPAT FLAG |
| 50 |
__webpack_require__.r(__webpack_exports__); |
| 51 |
|
| 52 |
;// CONCATENATED MODULE: external "__UNSTABLE__elementorPackages.ui" |
| 53 |
var external_UNSTABLE_elementorPackages_ui_namespaceObject = __UNSTABLE__elementorPackages.ui; |
| 54 |
;// CONCATENATED MODULE: external "__UNSTABLE__elementorPackages.icons" |
| 55 |
var external_UNSTABLE_elementorPackages_icons_namespaceObject = __UNSTABLE__elementorPackages.icons; |
| 56 |
;// CONCATENATED MODULE: external "__UNSTABLE__elementorPackages.documents" |
| 57 |
var external_UNSTABLE_elementorPackages_documents_namespaceObject = __UNSTABLE__elementorPackages.documents; |
| 58 |
;// CONCATENATED MODULE: external "wp.i18n" |
| 59 |
var external_wp_i18n_namespaceObject = wp.i18n; |
| 60 |
;// CONCATENATED MODULE: external "__UNSTABLE__elementorPackages.v1Adapters" |
| 61 |
var external_UNSTABLE_elementorPackages_v1Adapters_namespaceObject = __UNSTABLE__elementorPackages.v1Adapters; |
| 62 |
;// CONCATENATED MODULE: ./packages/recently-edited/src/components/top-bar/settings-button.tsx |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
function SettingsButton({ |
| 68 |
type |
| 69 |
}) { |
| 70 |
const { |
| 71 |
isActive, |
| 72 |
isBlocked |
| 73 |
} = (0,external_UNSTABLE_elementorPackages_v1Adapters_namespaceObject.useRouteStatus)('panel/page-settings'); |
| 74 |
|
| 75 |
/* translators: %s: Post type label. */ |
| 76 |
const title = (0,external_wp_i18n_namespaceObject.__)('%s Settings', 'elementor').replace('%s', type.label); |
| 77 |
return /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Tooltip, { |
| 78 |
title: title |
| 79 |
}, /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Box, { |
| 80 |
component: "span", |
| 81 |
"aria-label": undefined |
| 82 |
}, /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.ToggleButton, { |
| 83 |
value: "document-settings", |
| 84 |
selected: isActive, |
| 85 |
disabled: isBlocked, |
| 86 |
onChange: () => (0,external_UNSTABLE_elementorPackages_v1Adapters_namespaceObject.openRoute)('panel/page-settings/settings'), |
| 87 |
"aria-label": title, |
| 88 |
size: "small" |
| 89 |
}, /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_icons_namespaceObject.SettingsIcon, null)))); |
| 90 |
} |
| 91 |
;// CONCATENATED MODULE: ./packages/recently-edited/src/components/top-bar/indicator.tsx |
| 92 |
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } |
| 93 |
|
| 94 |
function Indicator({ |
| 95 |
title, |
| 96 |
status |
| 97 |
}) { |
| 98 |
return /*#__PURE__*/React.createElement(Tooltip, { |
| 99 |
title: title |
| 100 |
}, /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Stack, { |
| 101 |
direction: "row", |
| 102 |
alignItems: "center", |
| 103 |
spacing: 2 |
| 104 |
}, /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Typography, { |
| 105 |
variant: "body2", |
| 106 |
sx: { |
| 107 |
maxWidth: '120px' |
| 108 |
}, |
| 109 |
noWrap: true |
| 110 |
}, title), status.value !== 'publish' && /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Typography, { |
| 111 |
variant: "body2", |
| 112 |
sx: { |
| 113 |
fontStyle: 'italic' |
| 114 |
} |
| 115 |
}, "(", status.label, ")"))); |
| 116 |
} |
| 117 |
function Tooltip(props) { |
| 118 |
return /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Tooltip, _extends({ |
| 119 |
PopperProps: { |
| 120 |
sx: { |
| 121 |
'&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom': { |
| 122 |
mt: 7 |
| 123 |
} |
| 124 |
} |
| 125 |
} |
| 126 |
}, props)); |
| 127 |
} |
| 128 |
;// CONCATENATED MODULE: external "React" |
| 129 |
var external_React_namespaceObject = React; |
| 130 |
;// CONCATENATED MODULE: ./packages/recently-edited/src/components/top-bar/chip-doc-type.tsx |
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
const iconsDocType = { |
| 135 |
header: external_UNSTABLE_elementorPackages_icons_namespaceObject.HeaderTemplateIcon, |
| 136 |
footer: external_UNSTABLE_elementorPackages_icons_namespaceObject.FooterTemplateIcon, |
| 137 |
'single-post': external_UNSTABLE_elementorPackages_icons_namespaceObject.PostTypeIcon, |
| 138 |
'single-page': external_UNSTABLE_elementorPackages_icons_namespaceObject.PageTypeIcon, |
| 139 |
popup: external_UNSTABLE_elementorPackages_icons_namespaceObject.PopupTemplateIcon, |
| 140 |
archive: external_UNSTABLE_elementorPackages_icons_namespaceObject.ArchiveTemplateIcon, |
| 141 |
'search-results': external_UNSTABLE_elementorPackages_icons_namespaceObject.SearchResultsTemplateIcon, |
| 142 |
'loop-item': external_UNSTABLE_elementorPackages_icons_namespaceObject.LoopItemTemplateIcon, |
| 143 |
'error-404': external_UNSTABLE_elementorPackages_icons_namespaceObject.Error404TemplateIcon, |
| 144 |
'landing-page': external_UNSTABLE_elementorPackages_icons_namespaceObject.LandingPageTemplateIcon, |
| 145 |
page: external_UNSTABLE_elementorPackages_icons_namespaceObject.PageTemplateIcon, |
| 146 |
section: external_UNSTABLE_elementorPackages_icons_namespaceObject.SectionTemplateIcon, |
| 147 |
container: external_UNSTABLE_elementorPackages_icons_namespaceObject.ContainerTemplateIcon, |
| 148 |
'wp-page': external_UNSTABLE_elementorPackages_icons_namespaceObject.PageTypeIcon, |
| 149 |
'wp-post': external_UNSTABLE_elementorPackages_icons_namespaceObject.PostTypeIcon |
| 150 |
}; |
| 151 |
function DocTypeChip({ |
| 152 |
postType, |
| 153 |
docType, |
| 154 |
label |
| 155 |
}) { |
| 156 |
const color = 'elementor_library' === postType ? 'global' : 'primary'; |
| 157 |
const Icon = iconsDocType?.[docType] || external_UNSTABLE_elementorPackages_icons_namespaceObject.PostTypeIcon; |
| 158 |
return /*#__PURE__*/external_React_namespaceObject.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Chip, { |
| 159 |
size: "medium", |
| 160 |
variant: "standard", |
| 161 |
label: label, |
| 162 |
color: color, |
| 163 |
icon: /*#__PURE__*/external_React_namespaceObject.createElement(Icon, null) |
| 164 |
}); |
| 165 |
} |
| 166 |
;// CONCATENATED MODULE: ./packages/recently-edited/src/components/top-bar/posts-list.tsx |
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
function PostsList({ |
| 171 |
recentPosts |
| 172 |
}) { |
| 173 |
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.ListSubheader, { |
| 174 |
sx: { |
| 175 |
fontSize: 12, |
| 176 |
fontStyle: 'italic', |
| 177 |
pl: 4 |
| 178 |
}, |
| 179 |
component: "div", |
| 180 |
id: "nested-list-subheader" |
| 181 |
}, (0,external_wp_i18n_namespaceObject.__)('Recent', 'elementor')), recentPosts.length ? recentPosts.map(({ |
| 182 |
title, |
| 183 |
edit_url: editUrl, |
| 184 |
type, |
| 185 |
id |
| 186 |
}) => /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.MenuItem, { |
| 187 |
key: id, |
| 188 |
component: "a", |
| 189 |
href: editUrl |
| 190 |
}, title, /*#__PURE__*/React.createElement(DocTypeChip, { |
| 191 |
postType: type.post_type, |
| 192 |
docType: type.doc_type, |
| 193 |
label: type.label |
| 194 |
}))) : /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Typography, { |
| 195 |
variant: "caption", |
| 196 |
sx: { |
| 197 |
color: 'grey.500', |
| 198 |
fontStyle: 'italic', |
| 199 |
p: 4 |
| 200 |
}, |
| 201 |
component: "div", |
| 202 |
"aria-label": undefined |
| 203 |
}, (0,external_wp_i18n_namespaceObject.__)('There are no other pages or templates on this site yet.', 'elementor'))); |
| 204 |
} |
| 205 |
;// CONCATENATED MODULE: external "wp.apiFetch" |
| 206 |
var external_wp_apiFetch_namespaceObject = wp.apiFetch; |
| 207 |
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
| 208 |
;// CONCATENATED MODULE: external "wp.url" |
| 209 |
var external_wp_url_namespaceObject = wp.url; |
| 210 |
;// CONCATENATED MODULE: ./packages/recently-edited/src/hooks/use-recent-posts.ts |
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
function useRecentPosts(documentId) { |
| 215 |
const [recentPosts, setRecentPosts] = (0,external_React_namespaceObject.useState)([]); |
| 216 |
const [isLoading, setIsLoading] = (0,external_React_namespaceObject.useState)(false); |
| 217 |
(0,external_React_namespaceObject.useEffect)(() => { |
| 218 |
if (documentId) { |
| 219 |
setIsLoading(true); |
| 220 |
fetchRecentlyEditedPosts(documentId).then(posts => { |
| 221 |
setRecentPosts(posts); |
| 222 |
setIsLoading(false); |
| 223 |
}); |
| 224 |
} |
| 225 |
}, [documentId]); |
| 226 |
return { |
| 227 |
isLoading, |
| 228 |
recentPosts |
| 229 |
}; |
| 230 |
} |
| 231 |
async function fetchRecentlyEditedPosts(documentId) { |
| 232 |
const queryParams = { |
| 233 |
posts_per_page: 5, |
| 234 |
post__not_in: documentId |
| 235 |
}; |
| 236 |
return await external_wp_apiFetch_default()({ |
| 237 |
path: (0,external_wp_url_namespaceObject.addQueryArgs)('/elementor/v1/site-navigation/recent-posts', queryParams) |
| 238 |
}).then(response => response).catch(() => []); |
| 239 |
} |
| 240 |
;// CONCATENATED MODULE: ./packages/recently-edited/src/components/top-bar/recently-edited.tsx |
| 241 |
function recently_edited_extends() { recently_edited_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return recently_edited_extends.apply(this, arguments); } |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
function RecentlyEdited() { |
| 250 |
const activeDocument = (0,external_UNSTABLE_elementorPackages_documents_namespaceObject.useActiveDocument)(); |
| 251 |
const hostDocument = (0,external_UNSTABLE_elementorPackages_documents_namespaceObject.useHostDocument)(); |
| 252 |
const document = activeDocument && activeDocument.type.value !== 'kit' ? activeDocument : hostDocument; |
| 253 |
const { |
| 254 |
recentPosts |
| 255 |
} = useRecentPosts(document?.id); |
| 256 |
const popupState = (0,external_UNSTABLE_elementorPackages_ui_namespaceObject.usePopupState)({ |
| 257 |
variant: 'popover', |
| 258 |
popupId: 'elementor-v2-top-bar-recently-edited' |
| 259 |
}); |
| 260 |
if (!document) { |
| 261 |
return null; |
| 262 |
} |
| 263 |
return /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Stack, { |
| 264 |
direction: "row", |
| 265 |
spacing: 1, |
| 266 |
alignItems: "center", |
| 267 |
sx: { |
| 268 |
paddingInlineStart: 1, |
| 269 |
cursor: 'default' |
| 270 |
} |
| 271 |
}, /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Button, recently_edited_extends({ |
| 272 |
color: "inherit", |
| 273 |
size: "small", |
| 274 |
endIcon: /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_icons_namespaceObject.ChevronDownIcon, { |
| 275 |
fontSize: "small" |
| 276 |
}) |
| 277 |
}, (0,external_UNSTABLE_elementorPackages_ui_namespaceObject.bindTrigger)(popupState)), /*#__PURE__*/React.createElement(Indicator, { |
| 278 |
title: document.title, |
| 279 |
status: document.status |
| 280 |
})), /*#__PURE__*/React.createElement(external_UNSTABLE_elementorPackages_ui_namespaceObject.Menu, recently_edited_extends({ |
| 281 |
PaperProps: { |
| 282 |
sx: { |
| 283 |
mt: 4, |
| 284 |
minWidth: 314 |
| 285 |
} |
| 286 |
} |
| 287 |
}, (0,external_UNSTABLE_elementorPackages_ui_namespaceObject.bindMenu)(popupState)), /*#__PURE__*/React.createElement(PostsList, { |
| 288 |
recentPosts: recentPosts |
| 289 |
})), /*#__PURE__*/React.createElement(SettingsButton, { |
| 290 |
type: document.type |
| 291 |
})); |
| 292 |
} |
| 293 |
;// CONCATENATED MODULE: external "__UNSTABLE__elementorPackages.topBar" |
| 294 |
var external_UNSTABLE_elementorPackages_topBar_namespaceObject = __UNSTABLE__elementorPackages.topBar; |
| 295 |
;// CONCATENATED MODULE: ./packages/recently-edited/src/init.ts |
| 296 |
|
| 297 |
|
| 298 |
function init() { |
| 299 |
registerTopBarMenuItems(); |
| 300 |
} |
| 301 |
function registerTopBarMenuItems() { |
| 302 |
(0,external_UNSTABLE_elementorPackages_topBar_namespaceObject.injectIntoCanvasDisplay)({ |
| 303 |
name: 'document-recently-edited', |
| 304 |
filler: RecentlyEdited |
| 305 |
}); |
| 306 |
} |
| 307 |
;// CONCATENATED MODULE: ./packages/recently-edited/src/index.ts |
| 308 |
|
| 309 |
init(); |
| 310 |
(window.__UNSTABLE__elementorPackages = window.__UNSTABLE__elementorPackages || {}).recentlyEdited = __webpack_exports__; |
| 311 |
/******/ })() |
| 312 |
; |