1 /******/ (function() { // webpackBootstrap |
1 /******/ (() => { // webpackBootstrap |
2 /******/ var __webpack_modules__ = ({ |
2 /******/ "use strict"; |
3 |
3 /******/ // The require scope |
4 /***/ 4403: |
4 /******/ var __webpack_require__ = {}; |
5 /***/ (function(module, exports) { |
|
6 |
|
7 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
8 Copyright (c) 2018 Jed Watson. |
|
9 Licensed under the MIT License (MIT), see |
|
10 http://jedwatson.github.io/classnames |
|
11 */ |
|
12 /* global define */ |
|
13 |
|
14 (function () { |
|
15 'use strict'; |
|
16 |
|
17 var hasOwn = {}.hasOwnProperty; |
|
18 |
|
19 function classNames() { |
|
20 var classes = []; |
|
21 |
|
22 for (var i = 0; i < arguments.length; i++) { |
|
23 var arg = arguments[i]; |
|
24 if (!arg) continue; |
|
25 |
|
26 var argType = typeof arg; |
|
27 |
|
28 if (argType === 'string' || argType === 'number') { |
|
29 classes.push(arg); |
|
30 } else if (Array.isArray(arg)) { |
|
31 if (arg.length) { |
|
32 var inner = classNames.apply(null, arg); |
|
33 if (inner) { |
|
34 classes.push(inner); |
|
35 } |
|
36 } |
|
37 } else if (argType === 'object') { |
|
38 if (arg.toString === Object.prototype.toString) { |
|
39 for (var key in arg) { |
|
40 if (hasOwn.call(arg, key) && arg[key]) { |
|
41 classes.push(key); |
|
42 } |
|
43 } |
|
44 } else { |
|
45 classes.push(arg.toString()); |
|
46 } |
|
47 } |
|
48 } |
|
49 |
|
50 return classes.join(' '); |
|
51 } |
|
52 |
|
53 if ( true && module.exports) { |
|
54 classNames.default = classNames; |
|
55 module.exports = classNames; |
|
56 } else if (true) { |
|
57 // register as 'classnames', consistent with npm package name |
|
58 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { |
|
59 return classNames; |
|
60 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
|
61 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
62 } else {} |
|
63 }()); |
|
64 |
|
65 |
|
66 /***/ }) |
|
67 |
|
68 /******/ }); |
|
69 /************************************************************************/ |
|
70 /******/ // The module cache |
|
71 /******/ var __webpack_module_cache__ = {}; |
|
72 /******/ |
|
73 /******/ // The require function |
|
74 /******/ function __webpack_require__(moduleId) { |
|
75 /******/ // Check if module is in cache |
|
76 /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
|
77 /******/ if (cachedModule !== undefined) { |
|
78 /******/ return cachedModule.exports; |
|
79 /******/ } |
|
80 /******/ // Create a new module (and put it into the cache) |
|
81 /******/ var module = __webpack_module_cache__[moduleId] = { |
|
82 /******/ // no module.id needed |
|
83 /******/ // no module.loaded needed |
|
84 /******/ exports: {} |
|
85 /******/ }; |
|
86 /******/ |
|
87 /******/ // Execute the module function |
|
88 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
|
89 /******/ |
|
90 /******/ // Return the exports of the module |
|
91 /******/ return module.exports; |
|
92 /******/ } |
|
93 /******/ |
5 /******/ |
94 /************************************************************************/ |
6 /************************************************************************/ |
95 /******/ /* webpack/runtime/compat get default export */ |
7 /******/ /* webpack/runtime/compat get default export */ |
96 /******/ !function() { |
8 /******/ (() => { |
97 /******/ // getDefaultExport function for compatibility with non-harmony modules |
9 /******/ // getDefaultExport function for compatibility with non-harmony modules |
98 /******/ __webpack_require__.n = function(module) { |
10 /******/ __webpack_require__.n = (module) => { |
99 /******/ var getter = module && module.__esModule ? |
11 /******/ var getter = module && module.__esModule ? |
100 /******/ function() { return module['default']; } : |
12 /******/ () => (module['default']) : |
101 /******/ function() { return module; }; |
13 /******/ () => (module); |
102 /******/ __webpack_require__.d(getter, { a: getter }); |
14 /******/ __webpack_require__.d(getter, { a: getter }); |
103 /******/ return getter; |
15 /******/ return getter; |
104 /******/ }; |
16 /******/ }; |
105 /******/ }(); |
17 /******/ })(); |
106 /******/ |
18 /******/ |
107 /******/ /* webpack/runtime/define property getters */ |
19 /******/ /* webpack/runtime/define property getters */ |
108 /******/ !function() { |
20 /******/ (() => { |
109 /******/ // define getter functions for harmony exports |
21 /******/ // define getter functions for harmony exports |
110 /******/ __webpack_require__.d = function(exports, definition) { |
22 /******/ __webpack_require__.d = (exports, definition) => { |
111 /******/ for(var key in definition) { |
23 /******/ for(var key in definition) { |
112 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
113 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
114 /******/ } |
26 /******/ } |
115 /******/ } |
27 /******/ } |
116 /******/ }; |
28 /******/ }; |
117 /******/ }(); |
29 /******/ })(); |
118 /******/ |
30 /******/ |
119 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
120 /******/ !function() { |
32 /******/ (() => { |
121 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
33 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
122 /******/ }(); |
34 /******/ })(); |
123 /******/ |
35 /******/ |
124 /******/ /* webpack/runtime/make namespace object */ |
36 /******/ /* webpack/runtime/make namespace object */ |
125 /******/ !function() { |
37 /******/ (() => { |
126 /******/ // define __esModule on exports |
38 /******/ // define __esModule on exports |
127 /******/ __webpack_require__.r = function(exports) { |
39 /******/ __webpack_require__.r = (exports) => { |
128 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
129 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
130 /******/ } |
42 /******/ } |
131 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
132 /******/ }; |
44 /******/ }; |
133 /******/ }(); |
45 /******/ })(); |
134 /******/ |
46 /******/ |
135 /************************************************************************/ |
47 /************************************************************************/ |
136 var __webpack_exports__ = {}; |
48 var __webpack_exports__ = {}; |
137 // This entry need to be wrapped in an IIFE because it need to be in strict mode. |
|
138 !function() { |
|
139 "use strict"; |
|
140 // ESM COMPAT FLAG |
49 // ESM COMPAT FLAG |
141 __webpack_require__.r(__webpack_exports__); |
50 __webpack_require__.r(__webpack_exports__); |
142 |
51 |
143 // EXPORTS |
52 // EXPORTS |
144 __webpack_require__.d(__webpack_exports__, { |
53 __webpack_require__.d(__webpack_exports__, { |
145 "PluginBlockSettingsMenuItem": function() { return /* reexport */ plugin_block_settings_menu_item; }, |
54 PluginBlockSettingsMenuItem: () => (/* reexport */ PluginBlockSettingsMenuItem), |
146 "PluginDocumentSettingPanel": function() { return /* reexport */ plugin_document_setting_panel; }, |
55 PluginDocumentSettingPanel: () => (/* reexport */ PluginDocumentSettingPanel), |
147 "PluginMoreMenuItem": function() { return /* reexport */ plugin_more_menu_item; }, |
56 PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), |
148 "PluginPostPublishPanel": function() { return /* reexport */ plugin_post_publish_panel; }, |
57 PluginPostPublishPanel: () => (/* reexport */ PluginPostPublishPanel), |
149 "PluginPostStatusInfo": function() { return /* reexport */ plugin_post_status_info; }, |
58 PluginPostStatusInfo: () => (/* reexport */ PluginPostStatusInfo), |
150 "PluginPrePublishPanel": function() { return /* reexport */ plugin_pre_publish_panel; }, |
59 PluginPrePublishPanel: () => (/* reexport */ PluginPrePublishPanel), |
151 "PluginSidebar": function() { return /* reexport */ PluginSidebarEditPost; }, |
60 PluginSidebar: () => (/* reexport */ PluginSidebar), |
152 "PluginSidebarMoreMenuItem": function() { return /* reexport */ PluginSidebarMoreMenuItem; }, |
61 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), |
153 "__experimentalFullscreenModeClose": function() { return /* reexport */ fullscreen_mode_close; }, |
62 __experimentalFullscreenModeClose: () => (/* reexport */ fullscreen_mode_close), |
154 "__experimentalMainDashboardButton": function() { return /* reexport */ main_dashboard_button; }, |
63 __experimentalMainDashboardButton: () => (/* binding */ __experimentalMainDashboardButton), |
155 "initializeEditor": function() { return /* binding */ initializeEditor; }, |
64 __experimentalPluginPostExcerpt: () => (/* reexport */ __experimentalPluginPostExcerpt), |
156 "reinitializeEditor": function() { return /* binding */ reinitializeEditor; }, |
65 initializeEditor: () => (/* binding */ initializeEditor), |
157 "store": function() { return /* reexport */ store_store; } |
66 reinitializeEditor: () => (/* binding */ reinitializeEditor), |
|
67 store: () => (/* reexport */ store) |
158 }); |
68 }); |
159 |
69 |
160 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js |
70 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/actions.js |
161 var actions_namespaceObject = {}; |
71 var actions_namespaceObject = {}; |
162 __webpack_require__.r(actions_namespaceObject); |
72 __webpack_require__.r(actions_namespaceObject); |
163 __webpack_require__.d(actions_namespaceObject, { |
73 __webpack_require__.d(actions_namespaceObject, { |
164 "disableComplementaryArea": function() { return disableComplementaryArea; }, |
74 __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), |
165 "enableComplementaryArea": function() { return enableComplementaryArea; }, |
75 __unstableCreateTemplate: () => (__unstableCreateTemplate), |
166 "pinItem": function() { return pinItem; }, |
76 closeGeneralSidebar: () => (closeGeneralSidebar), |
167 "setFeatureDefaults": function() { return setFeatureDefaults; }, |
77 closeModal: () => (closeModal), |
168 "setFeatureValue": function() { return setFeatureValue; }, |
78 closePublishSidebar: () => (closePublishSidebar), |
169 "toggleFeature": function() { return toggleFeature; }, |
79 hideBlockTypes: () => (hideBlockTypes), |
170 "unpinItem": function() { return unpinItem; } |
80 initializeMetaBoxes: () => (initializeMetaBoxes), |
|
81 metaBoxUpdatesFailure: () => (metaBoxUpdatesFailure), |
|
82 metaBoxUpdatesSuccess: () => (metaBoxUpdatesSuccess), |
|
83 openGeneralSidebar: () => (openGeneralSidebar), |
|
84 openModal: () => (openModal), |
|
85 openPublishSidebar: () => (openPublishSidebar), |
|
86 removeEditorPanel: () => (removeEditorPanel), |
|
87 requestMetaBoxUpdates: () => (requestMetaBoxUpdates), |
|
88 setAvailableMetaBoxesPerLocation: () => (setAvailableMetaBoxesPerLocation), |
|
89 setIsEditingTemplate: () => (setIsEditingTemplate), |
|
90 setIsInserterOpened: () => (setIsInserterOpened), |
|
91 setIsListViewOpened: () => (setIsListViewOpened), |
|
92 showBlockTypes: () => (showBlockTypes), |
|
93 switchEditorMode: () => (switchEditorMode), |
|
94 toggleDistractionFree: () => (toggleDistractionFree), |
|
95 toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled), |
|
96 toggleEditorPanelOpened: () => (toggleEditorPanelOpened), |
|
97 toggleFeature: () => (toggleFeature), |
|
98 togglePinnedPluginItem: () => (togglePinnedPluginItem), |
|
99 togglePublishSidebar: () => (togglePublishSidebar), |
|
100 updatePreferredStyleVariations: () => (updatePreferredStyleVariations) |
171 }); |
101 }); |
172 |
102 |
173 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js |
103 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js |
174 var selectors_namespaceObject = {}; |
104 var selectors_namespaceObject = {}; |
175 __webpack_require__.r(selectors_namespaceObject); |
105 __webpack_require__.r(selectors_namespaceObject); |
176 __webpack_require__.d(selectors_namespaceObject, { |
106 __webpack_require__.d(selectors_namespaceObject, { |
177 "getActiveComplementaryArea": function() { return getActiveComplementaryArea; }, |
107 __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), |
178 "isFeatureActive": function() { return isFeatureActive; }, |
108 __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), |
179 "isItemPinned": function() { return isItemPinned; } |
109 areMetaBoxesInitialized: () => (areMetaBoxesInitialized), |
|
110 getActiveGeneralSidebarName: () => (getActiveGeneralSidebarName), |
|
111 getActiveMetaBoxLocations: () => (getActiveMetaBoxLocations), |
|
112 getAllMetaBoxes: () => (getAllMetaBoxes), |
|
113 getEditedPostTemplate: () => (getEditedPostTemplate), |
|
114 getEditorMode: () => (getEditorMode), |
|
115 getHiddenBlockTypes: () => (getHiddenBlockTypes), |
|
116 getMetaBoxesPerLocation: () => (getMetaBoxesPerLocation), |
|
117 getPreference: () => (getPreference), |
|
118 getPreferences: () => (getPreferences), |
|
119 hasMetaBoxes: () => (hasMetaBoxes), |
|
120 isEditingTemplate: () => (isEditingTemplate), |
|
121 isEditorPanelEnabled: () => (isEditorPanelEnabled), |
|
122 isEditorPanelOpened: () => (isEditorPanelOpened), |
|
123 isEditorPanelRemoved: () => (isEditorPanelRemoved), |
|
124 isEditorSidebarOpened: () => (isEditorSidebarOpened), |
|
125 isFeatureActive: () => (isFeatureActive), |
|
126 isInserterOpened: () => (isInserterOpened), |
|
127 isListViewOpened: () => (isListViewOpened), |
|
128 isMetaBoxLocationActive: () => (isMetaBoxLocationActive), |
|
129 isMetaBoxLocationVisible: () => (isMetaBoxLocationVisible), |
|
130 isModalActive: () => (isModalActive), |
|
131 isPluginItemPinned: () => (isPluginItemPinned), |
|
132 isPluginSidebarOpened: () => (isPluginSidebarOpened), |
|
133 isPublishSidebarOpened: () => (isPublishSidebarOpened), |
|
134 isSavingMetaBoxes: () => (selectors_isSavingMetaBoxes) |
180 }); |
135 }); |
181 |
136 |
182 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/actions.js |
137 ;// CONCATENATED MODULE: external ["wp","blocks"] |
183 var store_actions_namespaceObject = {}; |
138 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
184 __webpack_require__.r(store_actions_namespaceObject); |
139 ;// CONCATENATED MODULE: external ["wp","blockLibrary"] |
185 __webpack_require__.d(store_actions_namespaceObject, { |
140 const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; |
186 "__experimentalSetPreviewDeviceType": function() { return __experimentalSetPreviewDeviceType; }, |
141 ;// CONCATENATED MODULE: external ["wp","deprecated"] |
187 "__unstableCreateTemplate": function() { return __unstableCreateTemplate; }, |
142 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
188 "__unstableSwitchToTemplateMode": function() { return __unstableSwitchToTemplateMode; }, |
143 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
189 "closeGeneralSidebar": function() { return closeGeneralSidebar; }, |
144 ;// CONCATENATED MODULE: external ["wp","element"] |
190 "closeModal": function() { return closeModal; }, |
145 const external_wp_element_namespaceObject = window["wp"]["element"]; |
191 "closePublishSidebar": function() { return closePublishSidebar; }, |
146 ;// CONCATENATED MODULE: external ["wp","data"] |
192 "hideBlockTypes": function() { return hideBlockTypes; }, |
147 const external_wp_data_namespaceObject = window["wp"]["data"]; |
193 "initializeMetaBoxes": function() { return initializeMetaBoxes; }, |
148 ;// CONCATENATED MODULE: external ["wp","preferences"] |
194 "metaBoxUpdatesFailure": function() { return metaBoxUpdatesFailure; }, |
149 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; |
195 "metaBoxUpdatesSuccess": function() { return metaBoxUpdatesSuccess; }, |
150 ;// CONCATENATED MODULE: external ["wp","widgets"] |
196 "openGeneralSidebar": function() { return openGeneralSidebar; }, |
151 const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; |
197 "openModal": function() { return openModal; }, |
152 ;// CONCATENATED MODULE: external ["wp","editor"] |
198 "openPublishSidebar": function() { return openPublishSidebar; }, |
153 const external_wp_editor_namespaceObject = window["wp"]["editor"]; |
199 "removeEditorPanel": function() { return removeEditorPanel; }, |
154 ;// CONCATENATED MODULE: external ["wp","components"] |
200 "requestMetaBoxUpdates": function() { return requestMetaBoxUpdates; }, |
155 const external_wp_components_namespaceObject = window["wp"]["components"]; |
201 "setAvailableMetaBoxesPerLocation": function() { return setAvailableMetaBoxesPerLocation; }, |
156 ;// CONCATENATED MODULE: external ["wp","coreData"] |
202 "setIsEditingTemplate": function() { return setIsEditingTemplate; }, |
157 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
203 "setIsInserterOpened": function() { return setIsInserterOpened; }, |
158 ;// CONCATENATED MODULE: external ["wp","commands"] |
204 "setIsListViewOpened": function() { return setIsListViewOpened; }, |
159 const external_wp_commands_namespaceObject = window["wp"]["commands"]; |
205 "showBlockTypes": function() { return showBlockTypes; }, |
160 ;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs |
206 "switchEditorMode": function() { return switchEditorMode; }, |
161 function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); |
207 "toggleEditorPanelEnabled": function() { return toggleEditorPanelEnabled; }, |
162 ;// CONCATENATED MODULE: external ["wp","blockEditor"] |
208 "toggleEditorPanelOpened": function() { return toggleEditorPanelOpened; }, |
163 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
209 "toggleFeature": function() { return actions_toggleFeature; }, |
164 ;// CONCATENATED MODULE: external ["wp","plugins"] |
210 "togglePinnedPluginItem": function() { return togglePinnedPluginItem; }, |
165 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; |
211 "togglePublishSidebar": function() { return togglePublishSidebar; }, |
166 ;// CONCATENATED MODULE: external ["wp","i18n"] |
212 "updatePreferredStyleVariations": function() { return updatePreferredStyleVariations; } |
167 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
|
168 ;// CONCATENATED MODULE: external ["wp","notices"] |
|
169 const external_wp_notices_namespaceObject = window["wp"]["notices"]; |
|
170 ;// CONCATENATED MODULE: external ["wp","coreCommands"] |
|
171 const external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; |
|
172 ;// CONCATENATED MODULE: external ["wp","url"] |
|
173 const external_wp_url_namespaceObject = window["wp"]["url"]; |
|
174 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] |
|
175 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; |
|
176 ;// CONCATENATED MODULE: external ["wp","primitives"] |
|
177 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
178 ;// CONCATENATED MODULE: external "ReactJSXRuntime" |
|
179 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; |
|
180 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js |
|
181 /** |
|
182 * WordPress dependencies |
|
183 */ |
|
184 |
|
185 |
|
186 const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
|
187 xmlns: "http://www.w3.org/2000/svg", |
|
188 viewBox: "-2 -2 24 24", |
|
189 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
|
190 d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" |
|
191 }) |
213 }); |
192 }); |
214 |
193 /* harmony default export */ const library_wordpress = (wordpress); |
215 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js |
194 |
216 var store_selectors_namespaceObject = {}; |
195 ;// CONCATENATED MODULE: external ["wp","compose"] |
217 __webpack_require__.r(store_selectors_namespaceObject); |
196 const external_wp_compose_namespaceObject = window["wp"]["compose"]; |
218 __webpack_require__.d(store_selectors_namespaceObject, { |
197 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/reducer.js |
219 "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; }, |
|
220 "__experimentalGetPreviewDeviceType": function() { return __experimentalGetPreviewDeviceType; }, |
|
221 "areMetaBoxesInitialized": function() { return areMetaBoxesInitialized; }, |
|
222 "getActiveGeneralSidebarName": function() { return getActiveGeneralSidebarName; }, |
|
223 "getActiveMetaBoxLocations": function() { return getActiveMetaBoxLocations; }, |
|
224 "getAllMetaBoxes": function() { return getAllMetaBoxes; }, |
|
225 "getEditedPostTemplate": function() { return getEditedPostTemplate; }, |
|
226 "getEditorMode": function() { return getEditorMode; }, |
|
227 "getHiddenBlockTypes": function() { return getHiddenBlockTypes; }, |
|
228 "getMetaBoxesPerLocation": function() { return getMetaBoxesPerLocation; }, |
|
229 "getPreference": function() { return getPreference; }, |
|
230 "getPreferences": function() { return getPreferences; }, |
|
231 "hasMetaBoxes": function() { return hasMetaBoxes; }, |
|
232 "isEditingTemplate": function() { return selectors_isEditingTemplate; }, |
|
233 "isEditorPanelEnabled": function() { return isEditorPanelEnabled; }, |
|
234 "isEditorPanelOpened": function() { return isEditorPanelOpened; }, |
|
235 "isEditorPanelRemoved": function() { return isEditorPanelRemoved; }, |
|
236 "isEditorSidebarOpened": function() { return isEditorSidebarOpened; }, |
|
237 "isFeatureActive": function() { return selectors_isFeatureActive; }, |
|
238 "isInserterOpened": function() { return isInserterOpened; }, |
|
239 "isListViewOpened": function() { return isListViewOpened; }, |
|
240 "isMetaBoxLocationActive": function() { return isMetaBoxLocationActive; }, |
|
241 "isMetaBoxLocationVisible": function() { return isMetaBoxLocationVisible; }, |
|
242 "isModalActive": function() { return isModalActive; }, |
|
243 "isPluginItemPinned": function() { return isPluginItemPinned; }, |
|
244 "isPluginSidebarOpened": function() { return isPluginSidebarOpened; }, |
|
245 "isPublishSidebarOpened": function() { return isPublishSidebarOpened; }, |
|
246 "isSavingMetaBoxes": function() { return selectors_isSavingMetaBoxes; } |
|
247 }); |
|
248 |
|
249 ;// CONCATENATED MODULE: external ["wp","element"] |
|
250 var external_wp_element_namespaceObject = window["wp"]["element"]; |
|
251 ;// CONCATENATED MODULE: external ["wp","blocks"] |
|
252 var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
|
253 ;// CONCATENATED MODULE: external ["wp","blockLibrary"] |
|
254 var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; |
|
255 ;// CONCATENATED MODULE: external ["wp","data"] |
|
256 var external_wp_data_namespaceObject = window["wp"]["data"]; |
|
257 ;// CONCATENATED MODULE: external ["wp","hooks"] |
|
258 var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; |
|
259 ;// CONCATENATED MODULE: external ["wp","preferences"] |
|
260 var external_wp_preferences_namespaceObject = window["wp"]["preferences"]; |
|
261 ;// CONCATENATED MODULE: external ["wp","mediaUtils"] |
|
262 var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; |
|
263 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/components/index.js |
|
264 /** |
198 /** |
265 * WordPress dependencies |
199 * WordPress dependencies |
266 */ |
200 */ |
267 |
201 |
268 |
202 |
269 |
|
270 const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload; |
|
271 |
|
272 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload); |
|
273 |
|
274 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
|
275 function _extends() { |
|
276 _extends = Object.assign ? Object.assign.bind() : function (target) { |
|
277 for (var i = 1; i < arguments.length; i++) { |
|
278 var source = arguments[i]; |
|
279 |
|
280 for (var key in source) { |
|
281 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
282 target[key] = source[key]; |
|
283 } |
|
284 } |
|
285 } |
|
286 |
|
287 return target; |
|
288 }; |
|
289 return _extends.apply(this, arguments); |
|
290 } |
|
291 ;// CONCATENATED MODULE: external "lodash" |
|
292 var external_lodash_namespaceObject = window["lodash"]; |
|
293 ;// CONCATENATED MODULE: external ["wp","components"] |
|
294 var external_wp_components_namespaceObject = window["wp"]["components"]; |
|
295 ;// CONCATENATED MODULE: external ["wp","blockEditor"] |
|
296 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
|
297 ;// CONCATENATED MODULE: external ["wp","i18n"] |
|
298 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
|
299 ;// CONCATENATED MODULE: external ["wp","compose"] |
|
300 var external_wp_compose_namespaceObject = window["wp"]["compose"]; |
|
301 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/validate-multiple-use/index.js |
|
302 |
|
303 |
|
304 |
|
305 /** |
|
306 * External dependencies |
|
307 */ |
|
308 |
|
309 /** |
|
310 * WordPress dependencies |
|
311 */ |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 const enhance = (0,external_wp_compose_namespaceObject.compose)( |
|
321 /** |
|
322 * For blocks whose block type doesn't support `multiple`, provides the |
|
323 * wrapped component with `originalBlockClientId` -- a reference to the |
|
324 * first block of the same type in the content -- if and only if that |
|
325 * "original" block is not the current one. Thus, an inexisting |
|
326 * `originalBlockClientId` prop signals that the block is valid. |
|
327 * |
|
328 * @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance. |
|
329 * |
|
330 * @return {WPComponent} Enhanced component with merged state data props. |
|
331 */ |
|
332 (0,external_wp_data_namespaceObject.withSelect)((select, block) => { |
|
333 const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true); // For block types with `multiple` support, there is no "original |
|
334 // block" to be found in the content, as the block itself is valid. |
|
335 |
|
336 if (multiple) { |
|
337 return {}; |
|
338 } // Otherwise, only pass `originalBlockClientId` if it refers to a different |
|
339 // block from the current one. |
|
340 |
|
341 |
|
342 const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); |
|
343 const firstOfSameType = (0,external_lodash_namespaceObject.find)(blocks, _ref => { |
|
344 let { |
|
345 name |
|
346 } = _ref; |
|
347 return block.name === name; |
|
348 }); |
|
349 const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId; |
|
350 return { |
|
351 originalBlockClientId: isInvalid && firstOfSameType.clientId |
|
352 }; |
|
353 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => { |
|
354 let { |
|
355 originalBlockClientId |
|
356 } = _ref2; |
|
357 return { |
|
358 selectFirst: () => dispatch(external_wp_blockEditor_namespaceObject.store).selectBlock(originalBlockClientId) |
|
359 }; |
|
360 })); |
|
361 const withMultipleValidation = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => { |
|
362 return enhance(_ref3 => { |
|
363 let { |
|
364 originalBlockClientId, |
|
365 selectFirst, |
|
366 ...props |
|
367 } = _ref3; |
|
368 |
|
369 if (!originalBlockClientId) { |
|
370 return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props); |
|
371 } |
|
372 |
|
373 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(props.name); |
|
374 const outboundType = getOutboundType(props.name); |
|
375 return [(0,external_wp_element_namespaceObject.createElement)("div", { |
|
376 key: "invalid-preview", |
|
377 style: { |
|
378 minHeight: '60px' |
|
379 } |
|
380 }, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({ |
|
381 key: "block-edit" |
|
382 }, props))), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { |
|
383 key: "multiple-use-warning", |
|
384 actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
385 key: "find-original", |
|
386 variant: "secondary", |
|
387 onClick: selectFirst |
|
388 }, (0,external_wp_i18n_namespaceObject.__)('Find original')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
389 key: "remove", |
|
390 variant: "secondary", |
|
391 onClick: () => props.onReplace([]) |
|
392 }, (0,external_wp_i18n_namespaceObject.__)('Remove')), outboundType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
393 key: "transform", |
|
394 variant: "secondary", |
|
395 onClick: () => props.onReplace((0,external_wp_blocks_namespaceObject.createBlock)(outboundType.name, props.attributes)) |
|
396 }, (0,external_wp_i18n_namespaceObject.__)('Transform into:'), " ", outboundType.title)] |
|
397 }, (0,external_wp_element_namespaceObject.createElement)("strong", null, blockType === null || blockType === void 0 ? void 0 : blockType.title, ": "), (0,external_wp_i18n_namespaceObject.__)('This block can only be used once.'))]; |
|
398 }); |
|
399 }, 'withMultipleValidation'); |
|
400 /** |
|
401 * Given a base block name, returns the default block type to which to offer |
|
402 * transforms. |
|
403 * |
|
404 * @param {string} blockName Base block name. |
|
405 * |
|
406 * @return {?Object} The chosen default block type. |
|
407 */ |
|
408 |
|
409 function getOutboundType(blockName) { |
|
410 // Grab the first outbound transform. |
|
411 const transform = (0,external_wp_blocks_namespaceObject.findTransform)((0,external_wp_blocks_namespaceObject.getBlockTransforms)('to', blockName), _ref4 => { |
|
412 let { |
|
413 type, |
|
414 blocks |
|
415 } = _ref4; |
|
416 return type === 'block' && blocks.length === 1; |
|
417 } // What about when .length > 1? |
|
418 ); |
|
419 |
|
420 if (!transform) { |
|
421 return null; |
|
422 } |
|
423 |
|
424 return (0,external_wp_blocks_namespaceObject.getBlockType)(transform.blocks[0]); |
|
425 } |
|
426 |
|
427 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation); |
|
428 |
|
429 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/index.js |
|
430 /** |
|
431 * Internal dependencies |
|
432 */ |
|
433 |
|
434 |
|
435 |
|
436 ;// CONCATENATED MODULE: external ["wp","primitives"] |
|
437 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
438 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js |
|
439 |
|
440 |
|
441 /** |
|
442 * WordPress dependencies |
|
443 */ |
|
444 |
|
445 const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
446 xmlns: "http://www.w3.org/2000/svg", |
|
447 viewBox: "0 0 24 24" |
|
448 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
449 d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z" |
|
450 })); |
|
451 /* harmony default export */ var library_external = (external); |
|
452 |
|
453 ;// CONCATENATED MODULE: external ["wp","plugins"] |
|
454 var external_wp_plugins_namespaceObject = window["wp"]["plugins"]; |
|
455 ;// CONCATENATED MODULE: external ["wp","url"] |
|
456 var external_wp_url_namespaceObject = window["wp"]["url"]; |
|
457 ;// CONCATENATED MODULE: external ["wp","notices"] |
|
458 var external_wp_notices_namespaceObject = window["wp"]["notices"]; |
|
459 ;// CONCATENATED MODULE: external ["wp","editor"] |
|
460 var external_wp_editor_namespaceObject = window["wp"]["editor"]; |
|
461 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/copy-content-menu-item/index.js |
|
462 |
|
463 |
|
464 /** |
|
465 * WordPress dependencies |
|
466 */ |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 function CopyContentMenuItem() { |
|
474 const { |
|
475 createNotice |
|
476 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
477 const getText = (0,external_wp_data_namespaceObject.useSelect)(select => () => select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('content'), []); |
|
478 |
|
479 function onSuccess() { |
|
480 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), { |
|
481 isDismissible: true, |
|
482 type: 'snackbar' |
|
483 }); |
|
484 } |
|
485 |
|
486 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); |
|
487 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
488 ref: ref |
|
489 }, (0,external_wp_i18n_namespaceObject.__)('Copy all content')); |
|
490 } |
|
491 |
|
492 ;// CONCATENATED MODULE: external ["wp","keycodes"] |
|
493 var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; |
|
494 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/reducer.js |
|
495 /** |
|
496 * External dependencies |
|
497 */ |
|
498 |
|
499 /** |
|
500 * WordPress dependencies |
|
501 */ |
|
502 |
|
503 |
|
504 /** |
|
505 * Reducer storing the list of all programmatically removed panels. |
|
506 * |
|
507 * @param {Array} state Current state. |
|
508 * @param {Object} action Action object. |
|
509 * |
|
510 * @return {Array} Updated state. |
|
511 */ |
|
512 |
|
513 function removedPanels() { |
|
514 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
|
515 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
516 |
|
517 switch (action.type) { |
|
518 case 'REMOVE_PANEL': |
|
519 if (!(0,external_lodash_namespaceObject.includes)(state, action.panelName)) { |
|
520 return [...state, action.panelName]; |
|
521 } |
|
522 |
|
523 } |
|
524 |
|
525 return state; |
|
526 } |
|
527 /** |
|
528 * Reducer for storing the name of the open modal, or null if no modal is open. |
|
529 * |
|
530 * @param {Object} state Previous state. |
|
531 * @param {Object} action Action object containing the `name` of the modal |
|
532 * |
|
533 * @return {Object} Updated state |
|
534 */ |
|
535 |
|
536 function activeModal() { |
|
537 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
|
538 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
539 |
|
540 switch (action.type) { |
|
541 case 'OPEN_MODAL': |
|
542 return action.name; |
|
543 |
|
544 case 'CLOSE_MODAL': |
|
545 return null; |
|
546 } |
|
547 |
|
548 return state; |
|
549 } |
|
550 function publishSidebarActive() { |
|
551 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
552 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
553 |
|
554 switch (action.type) { |
|
555 case 'OPEN_PUBLISH_SIDEBAR': |
|
556 return true; |
|
557 |
|
558 case 'CLOSE_PUBLISH_SIDEBAR': |
|
559 return false; |
|
560 |
|
561 case 'TOGGLE_PUBLISH_SIDEBAR': |
|
562 return !state; |
|
563 } |
|
564 |
|
565 return state; |
|
566 } |
|
567 /** |
203 /** |
568 * Reducer keeping track of the meta boxes isSaving state. |
204 * Reducer keeping track of the meta boxes isSaving state. |
569 * A "true" value means the meta boxes saving request is in-flight. |
205 * A "true" value means the meta boxes saving request is in-flight. |
570 * |
206 * |
571 * |
207 * |
572 * @param {boolean} state Previous state. |
208 * @param {boolean} state Previous state. |
573 * @param {Object} action Action Object. |
209 * @param {Object} action Action Object. |
574 * |
210 * |
575 * @return {Object} Updated state. |
211 * @return {Object} Updated state. |
576 */ |
212 */ |
577 |
213 function isSavingMetaBoxes(state = false, action) { |
578 function isSavingMetaBoxes() { |
|
579 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
580 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
581 |
|
582 switch (action.type) { |
214 switch (action.type) { |
583 case 'REQUEST_META_BOX_UPDATES': |
215 case 'REQUEST_META_BOX_UPDATES': |
584 return true; |
216 return true; |
585 |
|
586 case 'META_BOX_UPDATES_SUCCESS': |
217 case 'META_BOX_UPDATES_SUCCESS': |
587 case 'META_BOX_UPDATES_FAILURE': |
218 case 'META_BOX_UPDATES_FAILURE': |
588 return false; |
219 return false; |
589 |
|
590 default: |
220 default: |
591 return state; |
221 return state; |
592 } |
222 } |
593 } |
223 } |
|
224 function mergeMetaboxes(metaboxes = [], newMetaboxes) { |
|
225 const mergedMetaboxes = [...metaboxes]; |
|
226 for (const metabox of newMetaboxes) { |
|
227 const existing = mergedMetaboxes.findIndex(box => box.id === metabox.id); |
|
228 if (existing !== -1) { |
|
229 mergedMetaboxes[existing] = metabox; |
|
230 } else { |
|
231 mergedMetaboxes.push(metabox); |
|
232 } |
|
233 } |
|
234 return mergedMetaboxes; |
|
235 } |
|
236 |
594 /** |
237 /** |
595 * Reducer keeping track of the meta boxes per location. |
238 * Reducer keeping track of the meta boxes per location. |
596 * |
239 * |
597 * @param {boolean} state Previous state. |
240 * @param {boolean} state Previous state. |
598 * @param {Object} action Action Object. |
241 * @param {Object} action Action Object. |
599 * |
242 * |
600 * @return {Object} Updated state. |
243 * @return {Object} Updated state. |
601 */ |
244 */ |
602 |
245 function metaBoxLocations(state = {}, action) { |
603 function metaBoxLocations() { |
|
604 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
605 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
606 |
|
607 switch (action.type) { |
246 switch (action.type) { |
608 case 'SET_META_BOXES_PER_LOCATIONS': |
247 case 'SET_META_BOXES_PER_LOCATIONS': |
609 return action.metaBoxesPerLocation; |
248 { |
610 } |
249 const newState = { |
611 |
250 ...state |
|
251 }; |
|
252 for (const [location, metaboxes] of Object.entries(action.metaBoxesPerLocation)) { |
|
253 newState[location] = mergeMetaboxes(newState[location], metaboxes); |
|
254 } |
|
255 return newState; |
|
256 } |
|
257 } |
612 return state; |
258 return state; |
613 } |
259 } |
614 /** |
260 |
615 * Reducer returning the editing canvas device type. |
261 /** |
616 * |
262 * Reducer tracking whether meta boxes are initialized. |
617 * @param {Object} state Current state. |
|
618 * @param {Object} action Dispatched action. |
|
619 * |
|
620 * @return {Object} Updated state. |
|
621 */ |
|
622 |
|
623 function deviceType() { |
|
624 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop'; |
|
625 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
626 |
|
627 switch (action.type) { |
|
628 case 'SET_PREVIEW_DEVICE_TYPE': |
|
629 return action.deviceType; |
|
630 } |
|
631 |
|
632 return state; |
|
633 } |
|
634 /** |
|
635 * Reducer to set the block inserter panel open or closed. |
|
636 * |
|
637 * Note: this reducer interacts with the list view panel reducer |
|
638 * to make sure that only one of the two panels is open at the same time. |
|
639 * |
|
640 * @param {Object} state Current state. |
|
641 * @param {Object} action Dispatched action. |
|
642 */ |
|
643 |
|
644 function blockInserterPanel() { |
|
645 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
646 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
647 |
|
648 switch (action.type) { |
|
649 case 'SET_IS_LIST_VIEW_OPENED': |
|
650 return action.isOpen ? false : state; |
|
651 |
|
652 case 'SET_IS_INSERTER_OPENED': |
|
653 return action.value; |
|
654 } |
|
655 |
|
656 return state; |
|
657 } |
|
658 /** |
|
659 * Reducer to set the list view panel open or closed. |
|
660 * |
|
661 * Note: this reducer interacts with the inserter panel reducer |
|
662 * to make sure that only one of the two panels is open at the same time. |
|
663 * |
|
664 * @param {Object} state Current state. |
|
665 * @param {Object} action Dispatched action. |
|
666 */ |
|
667 |
|
668 function listViewPanel() { |
|
669 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
670 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
671 |
|
672 switch (action.type) { |
|
673 case 'SET_IS_INSERTER_OPENED': |
|
674 return action.value ? false : state; |
|
675 |
|
676 case 'SET_IS_LIST_VIEW_OPENED': |
|
677 return action.isOpen; |
|
678 } |
|
679 |
|
680 return state; |
|
681 } |
|
682 /** |
|
683 * Reducer tracking whether the inserter is open. |
|
684 * |
263 * |
685 * @param {boolean} state |
264 * @param {boolean} state |
686 * @param {Object} action |
265 * @param {Object} action |
687 */ |
|
688 |
|
689 function isEditingTemplate() { |
|
690 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
691 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
692 |
|
693 switch (action.type) { |
|
694 case 'SET_IS_EDITING_TEMPLATE': |
|
695 return action.value; |
|
696 } |
|
697 |
|
698 return state; |
|
699 } |
|
700 /** |
|
701 * Reducer tracking whether meta boxes are initialized. |
|
702 * |
|
703 * @param {boolean} state |
|
704 * @param {Object} action |
|
705 * |
266 * |
706 * @return {boolean} Updated state. |
267 * @return {boolean} Updated state. |
707 */ |
268 */ |
708 |
269 function metaBoxesInitialized(state = false, action) { |
709 |
|
710 function metaBoxesInitialized() { |
|
711 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
712 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
713 |
|
714 switch (action.type) { |
270 switch (action.type) { |
715 case 'META_BOXES_INITIALIZED': |
271 case 'META_BOXES_INITIALIZED': |
716 return true; |
272 return true; |
717 } |
273 } |
718 |
|
719 return state; |
274 return state; |
720 } |
275 } |
721 |
|
722 const metaBoxes = (0,external_wp_data_namespaceObject.combineReducers)({ |
276 const metaBoxes = (0,external_wp_data_namespaceObject.combineReducers)({ |
723 isSaving: isSavingMetaBoxes, |
277 isSaving: isSavingMetaBoxes, |
724 locations: metaBoxLocations, |
278 locations: metaBoxLocations, |
725 initialized: metaBoxesInitialized |
279 initialized: metaBoxesInitialized |
726 }); |
280 }); |
727 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
281 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
728 activeModal, |
282 metaBoxes |
729 metaBoxes, |
|
730 publishSidebarActive, |
|
731 removedPanels, |
|
732 deviceType, |
|
733 blockInserterPanel, |
|
734 listViewPanel, |
|
735 isEditingTemplate |
|
736 })); |
283 })); |
737 |
284 |
738 ;// CONCATENATED MODULE: external ["wp","apiFetch"] |
285 ;// CONCATENATED MODULE: external ["wp","apiFetch"] |
739 var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; |
286 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; |
740 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
287 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
741 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
288 ;// CONCATENATED MODULE: external ["wp","hooks"] |
742 var classnames = __webpack_require__(4403); |
289 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; |
743 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
|
744 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js |
|
745 |
|
746 |
|
747 /** |
|
748 * WordPress dependencies |
|
749 */ |
|
750 |
|
751 const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
752 xmlns: "http://www.w3.org/2000/svg", |
|
753 viewBox: "0 0 24 24" |
|
754 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
755 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" |
|
756 })); |
|
757 /* harmony default export */ var library_check = (check); |
|
758 |
|
759 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js |
|
760 |
|
761 |
|
762 /** |
|
763 * WordPress dependencies |
|
764 */ |
|
765 |
|
766 const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
767 xmlns: "http://www.w3.org/2000/svg", |
|
768 viewBox: "0 0 24 24" |
|
769 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
770 d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" |
|
771 })); |
|
772 /* harmony default export */ var star_filled = (starFilled); |
|
773 |
|
774 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js |
|
775 |
|
776 |
|
777 /** |
|
778 * WordPress dependencies |
|
779 */ |
|
780 |
|
781 const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
782 xmlns: "http://www.w3.org/2000/svg", |
|
783 viewBox: "0 0 24 24" |
|
784 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
785 fillRule: "evenodd", |
|
786 d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", |
|
787 clipRule: "evenodd" |
|
788 })); |
|
789 /* harmony default export */ var star_empty = (starEmpty); |
|
790 |
|
791 ;// CONCATENATED MODULE: external ["wp","viewport"] |
|
792 var external_wp_viewport_namespaceObject = window["wp"]["viewport"]; |
|
793 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js |
|
794 |
|
795 |
|
796 /** |
|
797 * WordPress dependencies |
|
798 */ |
|
799 |
|
800 const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
801 xmlns: "http://www.w3.org/2000/svg", |
|
802 viewBox: "0 0 24 24" |
|
803 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
804 d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" |
|
805 })); |
|
806 /* harmony default export */ var close_small = (closeSmall); |
|
807 |
|
808 ;// CONCATENATED MODULE: external ["wp","deprecated"] |
|
809 var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
|
810 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
|
811 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js |
|
812 /** |
|
813 * WordPress dependencies |
|
814 */ |
|
815 |
|
816 |
|
817 /** |
|
818 * Enable the complementary area. |
|
819 * |
|
820 * @param {string} scope Complementary area scope. |
|
821 * @param {string} area Area identifier. |
|
822 */ |
|
823 |
|
824 const enableComplementaryArea = (scope, area) => _ref => { |
|
825 let { |
|
826 registry |
|
827 } = _ref; |
|
828 |
|
829 // Return early if there's no area. |
|
830 if (!area) { |
|
831 return; |
|
832 } |
|
833 |
|
834 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', area); |
|
835 }; |
|
836 /** |
|
837 * Disable the complementary area. |
|
838 * |
|
839 * @param {string} scope Complementary area scope. |
|
840 */ |
|
841 |
|
842 const disableComplementaryArea = scope => _ref2 => { |
|
843 let { |
|
844 registry |
|
845 } = _ref2; |
|
846 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', null); |
|
847 }; |
|
848 /** |
|
849 * Pins an item. |
|
850 * |
|
851 * @param {string} scope Item scope. |
|
852 * @param {string} item Item identifier. |
|
853 * |
|
854 * @return {Object} Action object. |
|
855 */ |
|
856 |
|
857 const pinItem = (scope, item) => _ref3 => { |
|
858 let { |
|
859 registry |
|
860 } = _ref3; |
|
861 |
|
862 // Return early if there's no item. |
|
863 if (!item) { |
|
864 return; |
|
865 } |
|
866 |
|
867 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do. |
|
868 |
|
869 if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) { |
|
870 return; |
|
871 } |
|
872 |
|
873 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, |
|
874 [item]: true |
|
875 }); |
|
876 }; |
|
877 /** |
|
878 * Unpins an item. |
|
879 * |
|
880 * @param {string} scope Item scope. |
|
881 * @param {string} item Item identifier. |
|
882 */ |
|
883 |
|
884 const unpinItem = (scope, item) => _ref4 => { |
|
885 let { |
|
886 registry |
|
887 } = _ref4; |
|
888 |
|
889 // Return early if there's no item. |
|
890 if (!item) { |
|
891 return; |
|
892 } |
|
893 |
|
894 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); |
|
895 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems, |
|
896 [item]: false |
|
897 }); |
|
898 }; |
|
899 /** |
|
900 * Returns an action object used in signalling that a feature should be toggled. |
|
901 * |
|
902 * @param {string} scope The feature scope (e.g. core/edit-post). |
|
903 * @param {string} featureName The feature name. |
|
904 */ |
|
905 |
|
906 function toggleFeature(scope, featureName) { |
|
907 return function (_ref5) { |
|
908 let { |
|
909 registry |
|
910 } = _ref5; |
|
911 external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { |
|
912 since: '6.0', |
|
913 alternative: `dispatch( 'core/preferences' ).toggle` |
|
914 }); |
|
915 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); |
|
916 }; |
|
917 } |
|
918 /** |
|
919 * Returns an action object used in signalling that a feature should be set to |
|
920 * a true or false value |
|
921 * |
|
922 * @param {string} scope The feature scope (e.g. core/edit-post). |
|
923 * @param {string} featureName The feature name. |
|
924 * @param {boolean} value The value to set. |
|
925 * |
|
926 * @return {Object} Action object. |
|
927 */ |
|
928 |
|
929 function setFeatureValue(scope, featureName, value) { |
|
930 return function (_ref6) { |
|
931 let { |
|
932 registry |
|
933 } = _ref6; |
|
934 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { |
|
935 since: '6.0', |
|
936 alternative: `dispatch( 'core/preferences' ).set` |
|
937 }); |
|
938 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); |
|
939 }; |
|
940 } |
|
941 /** |
|
942 * Returns an action object used in signalling that defaults should be set for features. |
|
943 * |
|
944 * @param {string} scope The feature scope (e.g. core/edit-post). |
|
945 * @param {Object<string, boolean>} defaults A key/value map of feature names to values. |
|
946 * |
|
947 * @return {Object} Action object. |
|
948 */ |
|
949 |
|
950 function setFeatureDefaults(scope, defaults) { |
|
951 return function (_ref7) { |
|
952 let { |
|
953 registry |
|
954 } = _ref7; |
|
955 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { |
|
956 since: '6.0', |
|
957 alternative: `dispatch( 'core/preferences' ).setDefaults` |
|
958 }); |
|
959 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); |
|
960 }; |
|
961 } |
|
962 |
|
963 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js |
|
964 /** |
|
965 * WordPress dependencies |
|
966 */ |
|
967 |
|
968 |
|
969 |
|
970 /** |
|
971 * Returns the complementary area that is active in a given scope. |
|
972 * |
|
973 * @param {Object} state Global application state. |
|
974 * @param {string} scope Item scope. |
|
975 * |
|
976 * @return {string} The complementary area that is active in the given scope. |
|
977 */ |
|
978 |
|
979 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { |
|
980 return select(external_wp_preferences_namespaceObject.store).get(scope, 'complementaryArea'); |
|
981 }); |
|
982 /** |
|
983 * Returns a boolean indicating if an item is pinned or not. |
|
984 * |
|
985 * @param {Object} state Global application state. |
|
986 * @param {string} scope Scope. |
|
987 * @param {string} item Item to check. |
|
988 * |
|
989 * @return {boolean} True if the item is pinned and false otherwise. |
|
990 */ |
|
991 |
|
992 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { |
|
993 var _pinnedItems$item; |
|
994 |
|
995 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); |
|
996 return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; |
|
997 }); |
|
998 /** |
|
999 * Returns a boolean indicating whether a feature is active for a particular |
|
1000 * scope. |
|
1001 * |
|
1002 * @param {Object} state The store state. |
|
1003 * @param {string} scope The scope of the feature (e.g. core/edit-post). |
|
1004 * @param {string} featureName The name of the feature. |
|
1005 * |
|
1006 * @return {boolean} Is the feature enabled? |
|
1007 */ |
|
1008 |
|
1009 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { |
|
1010 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, { |
|
1011 since: '6.0', |
|
1012 alternative: `select( 'core/preferences' ).get( scope, featureName )` |
|
1013 }); |
|
1014 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); |
|
1015 }); |
|
1016 |
|
1017 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js |
|
1018 /** |
|
1019 * The identifier for the data store. |
|
1020 * |
|
1021 * @type {string} |
|
1022 */ |
|
1023 const STORE_NAME = 'core/interface'; |
|
1024 |
|
1025 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js |
|
1026 /** |
|
1027 * WordPress dependencies |
|
1028 */ |
|
1029 |
|
1030 /** |
|
1031 * Internal dependencies |
|
1032 */ |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 /** |
|
1038 * Store definition for the interface namespace. |
|
1039 * |
|
1040 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
|
1041 * |
|
1042 * @type {Object} |
|
1043 */ |
|
1044 |
|
1045 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { |
|
1046 reducer: () => {}, |
|
1047 actions: actions_namespaceObject, |
|
1048 selectors: selectors_namespaceObject |
|
1049 }); // Once we build a more generic persistence plugin that works across types of stores |
|
1050 // we'd be able to replace this with a register call. |
|
1051 |
|
1052 (0,external_wp_data_namespaceObject.register)(store); |
|
1053 |
|
1054 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js |
|
1055 /** |
|
1056 * WordPress dependencies |
|
1057 */ |
|
1058 |
|
1059 /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { |
|
1060 return { |
|
1061 icon: ownProps.icon || context.icon, |
|
1062 identifier: ownProps.identifier || `${context.name}/${ownProps.name}` |
|
1063 }; |
|
1064 })); |
|
1065 |
|
1066 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js |
|
1067 |
|
1068 |
|
1069 |
|
1070 /** |
|
1071 * External dependencies |
|
1072 */ |
|
1073 |
|
1074 /** |
|
1075 * WordPress dependencies |
|
1076 */ |
|
1077 |
|
1078 |
|
1079 |
|
1080 /** |
|
1081 * Internal dependencies |
|
1082 */ |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 function ComplementaryAreaToggle(_ref) { |
|
1088 let { |
|
1089 as = external_wp_components_namespaceObject.Button, |
|
1090 scope, |
|
1091 identifier, |
|
1092 icon, |
|
1093 selectedIcon, |
|
1094 ...props |
|
1095 } = _ref; |
|
1096 const ComponentToUse = as; |
|
1097 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]); |
|
1098 const { |
|
1099 enableComplementaryArea, |
|
1100 disableComplementaryArea |
|
1101 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
1102 return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, _extends({ |
|
1103 icon: selectedIcon && isSelected ? selectedIcon : icon, |
|
1104 onClick: () => { |
|
1105 if (isSelected) { |
|
1106 disableComplementaryArea(scope); |
|
1107 } else { |
|
1108 enableComplementaryArea(scope, identifier); |
|
1109 } |
|
1110 } |
|
1111 }, (0,external_lodash_namespaceObject.omit)(props, ['name']))); |
|
1112 } |
|
1113 |
|
1114 /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); |
|
1115 |
|
1116 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js |
|
1117 |
|
1118 |
|
1119 |
|
1120 /** |
|
1121 * External dependencies |
|
1122 */ |
|
1123 |
|
1124 /** |
|
1125 * WordPress dependencies |
|
1126 */ |
|
1127 |
|
1128 |
|
1129 /** |
|
1130 * Internal dependencies |
|
1131 */ |
|
1132 |
|
1133 |
|
1134 |
|
1135 const ComplementaryAreaHeader = _ref => { |
|
1136 let { |
|
1137 smallScreenTitle, |
|
1138 children, |
|
1139 className, |
|
1140 toggleButtonProps |
|
1141 } = _ref; |
|
1142 const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({ |
|
1143 icon: close_small |
|
1144 }, toggleButtonProps)); |
|
1145 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1146 className: "components-panel__header interface-complementary-area-header__small" |
|
1147 }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", { |
|
1148 className: "interface-complementary-area-header__small-title" |
|
1149 }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1150 className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className), |
|
1151 tabIndex: -1 |
|
1152 }, children, toggleButton)); |
|
1153 }; |
|
1154 |
|
1155 /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader); |
|
1156 |
|
1157 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js |
|
1158 |
|
1159 |
|
1160 |
|
1161 /** |
|
1162 * External dependencies |
|
1163 */ |
|
1164 |
|
1165 /** |
|
1166 * WordPress dependencies |
|
1167 */ |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 function ActionItemSlot(_ref) { |
|
1173 let { |
|
1174 name, |
|
1175 as: Component = external_wp_components_namespaceObject.ButtonGroup, |
|
1176 fillProps = {}, |
|
1177 bubblesVirtually, |
|
1178 ...props |
|
1179 } = _ref; |
|
1180 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { |
|
1181 name: name, |
|
1182 bubblesVirtually: bubblesVirtually, |
|
1183 fillProps: fillProps |
|
1184 }, fills => { |
|
1185 if ((0,external_lodash_namespaceObject.isEmpty)(external_wp_element_namespaceObject.Children.toArray(fills))) { |
|
1186 return null; |
|
1187 } // Special handling exists for backward compatibility. |
|
1188 // It ensures that menu items created by plugin authors aren't |
|
1189 // duplicated with automatically injected menu items coming |
|
1190 // from pinnable plugin sidebars. |
|
1191 // @see https://github.com/WordPress/gutenberg/issues/14457 |
|
1192 |
|
1193 |
|
1194 const initializedByPlugins = []; |
|
1195 external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => { |
|
1196 let { |
|
1197 props: { |
|
1198 __unstableExplicitMenuItem, |
|
1199 __unstableTarget |
|
1200 } |
|
1201 } = _ref2; |
|
1202 |
|
1203 if (__unstableTarget && __unstableExplicitMenuItem) { |
|
1204 initializedByPlugins.push(__unstableTarget); |
|
1205 } |
|
1206 }); |
|
1207 const children = external_wp_element_namespaceObject.Children.map(fills, child => { |
|
1208 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { |
|
1209 return null; |
|
1210 } |
|
1211 |
|
1212 return child; |
|
1213 }); |
|
1214 return (0,external_wp_element_namespaceObject.createElement)(Component, props, children); |
|
1215 }); |
|
1216 } |
|
1217 |
|
1218 function ActionItem(_ref3) { |
|
1219 let { |
|
1220 name, |
|
1221 as: Component = external_wp_components_namespaceObject.Button, |
|
1222 onClick, |
|
1223 ...props |
|
1224 } = _ref3; |
|
1225 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { |
|
1226 name: name |
|
1227 }, _ref4 => { |
|
1228 let { |
|
1229 onClick: fpOnClick |
|
1230 } = _ref4; |
|
1231 return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({ |
|
1232 onClick: onClick || fpOnClick ? function () { |
|
1233 (onClick || external_lodash_namespaceObject.noop)(...arguments); |
|
1234 (fpOnClick || external_lodash_namespaceObject.noop)(...arguments); |
|
1235 } : undefined |
|
1236 }, props)); |
|
1237 }); |
|
1238 } |
|
1239 |
|
1240 ActionItem.Slot = ActionItemSlot; |
|
1241 /* harmony default export */ var action_item = (ActionItem); |
|
1242 |
|
1243 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js |
|
1244 |
|
1245 |
|
1246 |
|
1247 /** |
|
1248 * External dependencies |
|
1249 */ |
|
1250 |
|
1251 /** |
|
1252 * WordPress dependencies |
|
1253 */ |
|
1254 |
|
1255 |
|
1256 |
|
1257 /** |
|
1258 * Internal dependencies |
|
1259 */ |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility. |
|
1265 // They are removed so they don't leak to DOM elements. |
|
1266 // @see https://github.com/WordPress/gutenberg/issues/14457 |
|
1267 (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, (0,external_lodash_namespaceObject.omit)(props, ['__unstableExplicitMenuItem', '__unstableTarget'])); |
|
1268 |
|
1269 function ComplementaryAreaMoreMenuItem(_ref) { |
|
1270 let { |
|
1271 scope, |
|
1272 target, |
|
1273 __unstableExplicitMenuItem, |
|
1274 ...props |
|
1275 } = _ref; |
|
1276 return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({ |
|
1277 as: toggleProps => { |
|
1278 return (0,external_wp_element_namespaceObject.createElement)(action_item, _extends({ |
|
1279 __unstableExplicitMenuItem: __unstableExplicitMenuItem, |
|
1280 __unstableTarget: `${scope}/${target}`, |
|
1281 as: PluginsMenuItem, |
|
1282 name: `${scope}/plugin-more-menu` |
|
1283 }, toggleProps)); |
|
1284 }, |
|
1285 role: "menuitemcheckbox", |
|
1286 selectedIcon: library_check, |
|
1287 name: target, |
|
1288 scope: scope |
|
1289 }, props)); |
|
1290 } |
|
1291 |
|
1292 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js |
|
1293 |
|
1294 |
|
1295 |
|
1296 /** |
|
1297 * External dependencies |
|
1298 */ |
|
1299 |
|
1300 |
|
1301 /** |
|
1302 * WordPress dependencies |
|
1303 */ |
|
1304 |
|
1305 |
|
1306 |
|
1307 function PinnedItems(_ref) { |
|
1308 let { |
|
1309 scope, |
|
1310 ...props |
|
1311 } = _ref; |
|
1312 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, _extends({ |
|
1313 name: `PinnedItems/${scope}` |
|
1314 }, props)); |
|
1315 } |
|
1316 |
|
1317 function PinnedItemsSlot(_ref2) { |
|
1318 let { |
|
1319 scope, |
|
1320 className, |
|
1321 ...props |
|
1322 } = _ref2; |
|
1323 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({ |
|
1324 name: `PinnedItems/${scope}` |
|
1325 }, props), fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1326 className: classnames_default()(className, 'interface-pinned-items') |
|
1327 }, fills)); |
|
1328 } |
|
1329 |
|
1330 PinnedItems.Slot = PinnedItemsSlot; |
|
1331 /* harmony default export */ var pinned_items = (PinnedItems); |
|
1332 |
|
1333 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js |
|
1334 |
|
1335 |
|
1336 |
|
1337 /** |
|
1338 * External dependencies |
|
1339 */ |
|
1340 |
|
1341 /** |
|
1342 * WordPress dependencies |
|
1343 */ |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 /** |
|
1352 * Internal dependencies |
|
1353 */ |
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 |
|
1360 |
|
1361 |
|
1362 function ComplementaryAreaSlot(_ref) { |
|
1363 let { |
|
1364 scope, |
|
1365 ...props |
|
1366 } = _ref; |
|
1367 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({ |
|
1368 name: `ComplementaryArea/${scope}` |
|
1369 }, props)); |
|
1370 } |
|
1371 |
|
1372 function ComplementaryAreaFill(_ref2) { |
|
1373 let { |
|
1374 scope, |
|
1375 children, |
|
1376 className |
|
1377 } = _ref2; |
|
1378 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { |
|
1379 name: `ComplementaryArea/${scope}` |
|
1380 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1381 className: className |
|
1382 }, children)); |
|
1383 } |
|
1384 |
|
1385 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { |
|
1386 const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false); |
|
1387 const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false); |
|
1388 const { |
|
1389 enableComplementaryArea, |
|
1390 disableComplementaryArea |
|
1391 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
1392 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
1393 // If the complementary area is active and the editor is switching from a big to a small window size. |
|
1394 if (isActive && isSmall && !previousIsSmall.current) { |
|
1395 // Disable the complementary area. |
|
1396 disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big. |
|
1397 |
|
1398 shouldOpenWhenNotSmall.current = true; |
|
1399 } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size |
|
1400 // and we are going from a small to big window size. |
|
1401 shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) { |
|
1402 // Remove the flag indicating the complementary area should be enabled. |
|
1403 shouldOpenWhenNotSmall.current = false; // Enable the complementary area. |
|
1404 |
|
1405 enableComplementaryArea(scope, identifier); |
|
1406 } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active, |
|
1407 // remove the flag. |
|
1408 shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) { |
|
1409 shouldOpenWhenNotSmall.current = false; |
|
1410 } |
|
1411 |
|
1412 if (isSmall !== previousIsSmall.current) { |
|
1413 previousIsSmall.current = isSmall; |
|
1414 } |
|
1415 }, [isActive, isSmall, scope, identifier, activeArea]); |
|
1416 } |
|
1417 |
|
1418 function ComplementaryArea(_ref3) { |
|
1419 let { |
|
1420 children, |
|
1421 className, |
|
1422 closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), |
|
1423 identifier, |
|
1424 header, |
|
1425 headerClassName, |
|
1426 icon, |
|
1427 isPinnable = true, |
|
1428 panelClassName, |
|
1429 scope, |
|
1430 name, |
|
1431 smallScreenTitle, |
|
1432 title, |
|
1433 toggleShortcut, |
|
1434 isActiveByDefault, |
|
1435 showIconLabels = false |
|
1436 } = _ref3; |
|
1437 const { |
|
1438 isActive, |
|
1439 isPinned, |
|
1440 activeArea, |
|
1441 isSmall, |
|
1442 isLarge |
|
1443 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
1444 const { |
|
1445 getActiveComplementaryArea, |
|
1446 isItemPinned |
|
1447 } = select(store); |
|
1448 |
|
1449 const _activeArea = getActiveComplementaryArea(scope); |
|
1450 |
|
1451 return { |
|
1452 isActive: _activeArea === identifier, |
|
1453 isPinned: isItemPinned(scope, identifier), |
|
1454 activeArea: _activeArea, |
|
1455 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), |
|
1456 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large') |
|
1457 }; |
|
1458 }, [identifier, scope]); |
|
1459 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); |
|
1460 const { |
|
1461 enableComplementaryArea, |
|
1462 disableComplementaryArea, |
|
1463 pinItem, |
|
1464 unpinItem |
|
1465 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
|
1466 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
1467 if (isActiveByDefault && activeArea === undefined && !isSmall) { |
|
1468 enableComplementaryArea(scope, identifier); |
|
1469 } |
|
1470 }, [activeArea, isActiveByDefault, scope, identifier, isSmall]); |
|
1471 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, { |
|
1472 scope: scope |
|
1473 }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, { |
|
1474 scope: scope, |
|
1475 identifier: identifier, |
|
1476 isPressed: isActive && (!showIconLabels || isLarge), |
|
1477 "aria-expanded": isActive, |
|
1478 label: title, |
|
1479 icon: showIconLabels ? library_check : icon, |
|
1480 showTooltip: !showIconLabels, |
|
1481 variant: showIconLabels ? 'tertiary' : undefined |
|
1482 })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { |
|
1483 target: name, |
|
1484 scope: scope, |
|
1485 icon: icon |
|
1486 }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, { |
|
1487 className: classnames_default()('interface-complementary-area', className), |
|
1488 scope: scope |
|
1489 }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, { |
|
1490 className: headerClassName, |
|
1491 closeLabel: closeLabel, |
|
1492 onClose: () => disableComplementaryArea(scope), |
|
1493 smallScreenTitle: smallScreenTitle, |
|
1494 toggleButtonProps: { |
|
1495 label: closeLabel, |
|
1496 shortcut: toggleShortcut, |
|
1497 scope, |
|
1498 identifier |
|
1499 } |
|
1500 }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
1501 className: "interface-complementary-area__pin-unpin-item", |
|
1502 icon: isPinned ? star_filled : star_empty, |
|
1503 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), |
|
1504 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), |
|
1505 isPressed: isPinned, |
|
1506 "aria-expanded": isPinned |
|
1507 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, { |
|
1508 className: panelClassName |
|
1509 }, children))); |
|
1510 } |
|
1511 |
|
1512 const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); |
|
1513 ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; |
|
1514 /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped); |
|
1515 |
|
1516 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js |
|
1517 /** |
|
1518 * WordPress dependencies |
|
1519 */ |
|
1520 |
|
1521 |
|
1522 const FullscreenMode = _ref => { |
|
1523 let { |
|
1524 isActive |
|
1525 } = _ref; |
|
1526 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
1527 let isSticky = false; // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes |
|
1528 // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled |
|
1529 // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as |
|
1530 // a consequence of the FullscreenMode setup. |
|
1531 |
|
1532 if (document.body.classList.contains('sticky-menu')) { |
|
1533 isSticky = true; |
|
1534 document.body.classList.remove('sticky-menu'); |
|
1535 } |
|
1536 |
|
1537 return () => { |
|
1538 if (isSticky) { |
|
1539 document.body.classList.add('sticky-menu'); |
|
1540 } |
|
1541 }; |
|
1542 }, []); |
|
1543 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
1544 if (isActive) { |
|
1545 document.body.classList.add('is-fullscreen-mode'); |
|
1546 } else { |
|
1547 document.body.classList.remove('is-fullscreen-mode'); |
|
1548 } |
|
1549 |
|
1550 return () => { |
|
1551 if (isActive) { |
|
1552 document.body.classList.remove('is-fullscreen-mode'); |
|
1553 } |
|
1554 }; |
|
1555 }, [isActive]); |
|
1556 return null; |
|
1557 }; |
|
1558 |
|
1559 /* harmony default export */ var fullscreen_mode = (FullscreenMode); |
|
1560 |
|
1561 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js |
|
1562 |
|
1563 |
|
1564 |
|
1565 /** |
|
1566 * External dependencies |
|
1567 */ |
|
1568 |
|
1569 /** |
|
1570 * WordPress dependencies |
|
1571 */ |
|
1572 |
|
1573 /** |
|
1574 * WordPress dependencies |
|
1575 */ |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 function useHTMLClass(className) { |
|
1583 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
1584 const element = document && document.querySelector(`html:not(.${className})`); |
|
1585 |
|
1586 if (!element) { |
|
1587 return; |
|
1588 } |
|
1589 |
|
1590 element.classList.toggle(className); |
|
1591 return () => { |
|
1592 element.classList.toggle(className); |
|
1593 }; |
|
1594 }, [className]); |
|
1595 } |
|
1596 |
|
1597 function InterfaceSkeleton(_ref, ref) { |
|
1598 let { |
|
1599 footer, |
|
1600 header, |
|
1601 sidebar, |
|
1602 secondarySidebar, |
|
1603 notices, |
|
1604 content, |
|
1605 drawer, |
|
1606 actions, |
|
1607 labels, |
|
1608 className, |
|
1609 shortcuts |
|
1610 } = _ref; |
|
1611 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts); |
|
1612 useHTMLClass('interface-interface-skeleton__html-container'); |
|
1613 const defaultLabels = { |
|
1614 /* translators: accessibility text for the nav bar landmark region. */ |
|
1615 drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'), |
|
1616 |
|
1617 /* translators: accessibility text for the top bar landmark region. */ |
|
1618 header: (0,external_wp_i18n_namespaceObject.__)('Header'), |
|
1619 |
|
1620 /* translators: accessibility text for the content landmark region. */ |
|
1621 body: (0,external_wp_i18n_namespaceObject.__)('Content'), |
|
1622 |
|
1623 /* translators: accessibility text for the secondary sidebar landmark region. */ |
|
1624 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), |
|
1625 |
|
1626 /* translators: accessibility text for the settings landmark region. */ |
|
1627 sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'), |
|
1628 |
|
1629 /* translators: accessibility text for the publish landmark region. */ |
|
1630 actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), |
|
1631 |
|
1632 /* translators: accessibility text for the footer landmark region. */ |
|
1633 footer: (0,external_wp_i18n_namespaceObject.__)('Footer') |
|
1634 }; |
|
1635 const mergedLabels = { ...defaultLabels, |
|
1636 ...labels |
|
1637 }; |
|
1638 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, navigateRegionsProps, { |
|
1639 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]), |
|
1640 className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer') |
|
1641 }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1642 className: "interface-interface-skeleton__drawer", |
|
1643 role: "region", |
|
1644 "aria-label": mergedLabels.drawer, |
|
1645 tabIndex: "-1" |
|
1646 }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1647 className: "interface-interface-skeleton__editor" |
|
1648 }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1649 className: "interface-interface-skeleton__header", |
|
1650 role: "region", |
|
1651 "aria-label": mergedLabels.header, |
|
1652 tabIndex: "-1" |
|
1653 }, header), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1654 className: "interface-interface-skeleton__body" |
|
1655 }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1656 className: "interface-interface-skeleton__secondary-sidebar", |
|
1657 role: "region", |
|
1658 "aria-label": mergedLabels.secondarySidebar, |
|
1659 tabIndex: "-1" |
|
1660 }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1661 className: "interface-interface-skeleton__notices" |
|
1662 }, notices), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1663 className: "interface-interface-skeleton__content", |
|
1664 role: "region", |
|
1665 "aria-label": mergedLabels.body, |
|
1666 tabIndex: "-1" |
|
1667 }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1668 className: "interface-interface-skeleton__sidebar", |
|
1669 role: "region", |
|
1670 "aria-label": mergedLabels.sidebar, |
|
1671 tabIndex: "-1" |
|
1672 }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1673 className: "interface-interface-skeleton__actions", |
|
1674 role: "region", |
|
1675 "aria-label": mergedLabels.actions, |
|
1676 tabIndex: "-1" |
|
1677 }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1678 className: "interface-interface-skeleton__footer", |
|
1679 role: "region", |
|
1680 "aria-label": mergedLabels.footer, |
|
1681 tabIndex: "-1" |
|
1682 }, footer)); |
|
1683 } |
|
1684 |
|
1685 /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); |
|
1686 |
|
1687 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js |
|
1688 |
|
1689 |
|
1690 /** |
|
1691 * WordPress dependencies |
|
1692 */ |
|
1693 |
|
1694 const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1695 xmlns: "http://www.w3.org/2000/svg", |
|
1696 viewBox: "0 0 24 24" |
|
1697 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1698 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" |
|
1699 })); |
|
1700 /* harmony default export */ var more_vertical = (moreVertical); |
|
1701 |
|
1702 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js |
|
1703 |
|
1704 |
|
1705 /** |
|
1706 * External dependencies |
|
1707 */ |
|
1708 |
|
1709 /** |
|
1710 * WordPress dependencies |
|
1711 */ |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 function MoreMenuDropdown(_ref) { |
|
1717 let { |
|
1718 as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu, |
|
1719 className, |
|
1720 |
|
1721 /* translators: button label text should, if possible, be under 16 characters. */ |
|
1722 label = (0,external_wp_i18n_namespaceObject.__)('Options'), |
|
1723 popoverProps, |
|
1724 toggleProps, |
|
1725 children |
|
1726 } = _ref; |
|
1727 return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, { |
|
1728 className: classnames_default()('interface-more-menu-dropdown', className), |
|
1729 icon: more_vertical, |
|
1730 label: label, |
|
1731 popoverProps: { |
|
1732 position: 'bottom left', |
|
1733 ...popoverProps, |
|
1734 className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className) |
|
1735 }, |
|
1736 toggleProps: { |
|
1737 tooltipPosition: 'bottom', |
|
1738 ...toggleProps |
|
1739 } |
|
1740 }, onClose => children(onClose)); |
|
1741 } |
|
1742 |
|
1743 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal/index.js |
|
1744 |
|
1745 |
|
1746 /** |
|
1747 * WordPress dependencies |
|
1748 */ |
|
1749 |
|
1750 |
|
1751 function PreferencesModal(_ref) { |
|
1752 let { |
|
1753 closeModal, |
|
1754 children |
|
1755 } = _ref; |
|
1756 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
|
1757 className: "interface-preferences-modal", |
|
1758 title: (0,external_wp_i18n_namespaceObject.__)('Preferences'), |
|
1759 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
|
1760 onRequestClose: closeModal |
|
1761 }, children); |
|
1762 } |
|
1763 |
|
1764 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js |
|
1765 /** |
|
1766 * WordPress dependencies |
|
1767 */ |
|
1768 |
|
1769 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ |
|
1770 |
|
1771 /** |
|
1772 * Return an SVG icon. |
|
1773 * |
|
1774 * @param {IconProps} props icon is the SVG component to render |
|
1775 * size is a number specifiying the icon size in pixels |
|
1776 * Other props will be passed to wrapped SVG component |
|
1777 * |
|
1778 * @return {JSX.Element} Icon component |
|
1779 */ |
|
1780 |
|
1781 function Icon(_ref) { |
|
1782 let { |
|
1783 icon, |
|
1784 size = 24, |
|
1785 ...props |
|
1786 } = _ref; |
|
1787 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { |
|
1788 width: size, |
|
1789 height: size, |
|
1790 ...props |
|
1791 }); |
|
1792 } |
|
1793 |
|
1794 /* harmony default export */ var icon = (Icon); |
|
1795 |
|
1796 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js |
|
1797 |
|
1798 |
|
1799 /** |
|
1800 * WordPress dependencies |
|
1801 */ |
|
1802 |
|
1803 const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1804 xmlns: "http://www.w3.org/2000/svg", |
|
1805 viewBox: "0 0 24 24" |
|
1806 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1807 d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" |
|
1808 })); |
|
1809 /* harmony default export */ var chevron_left = (chevronLeft); |
|
1810 |
|
1811 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js |
|
1812 |
|
1813 |
|
1814 /** |
|
1815 * WordPress dependencies |
|
1816 */ |
|
1817 |
|
1818 const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1819 xmlns: "http://www.w3.org/2000/svg", |
|
1820 viewBox: "0 0 24 24" |
|
1821 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1822 d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" |
|
1823 })); |
|
1824 /* harmony default export */ var chevron_right = (chevronRight); |
|
1825 |
|
1826 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-tabs/index.js |
|
1827 |
|
1828 |
|
1829 /** |
|
1830 * WordPress dependencies |
|
1831 */ |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 const PREFERENCES_MENU = 'preferences-menu'; |
|
1838 function PreferencesModalTabs(_ref) { |
|
1839 let { |
|
1840 sections |
|
1841 } = _ref; |
|
1842 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); // This is also used to sync the two different rendered components |
|
1843 // between small and large viewports. |
|
1844 |
|
1845 const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU); |
|
1846 /** |
|
1847 * Create helper objects from `sections` for easier data handling. |
|
1848 * `tabs` is used for creating the `TabPanel` and `sectionsContentMap` |
|
1849 * is used for easier access to active tab's content. |
|
1850 */ |
|
1851 |
|
1852 const { |
|
1853 tabs, |
|
1854 sectionsContentMap |
|
1855 } = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
1856 let mappedTabs = { |
|
1857 tabs: [], |
|
1858 sectionsContentMap: {} |
|
1859 }; |
|
1860 |
|
1861 if (sections.length) { |
|
1862 mappedTabs = sections.reduce((accumulator, _ref2) => { |
|
1863 let { |
|
1864 name, |
|
1865 tabLabel: title, |
|
1866 content |
|
1867 } = _ref2; |
|
1868 accumulator.tabs.push({ |
|
1869 name, |
|
1870 title |
|
1871 }); |
|
1872 accumulator.sectionsContentMap[name] = content; |
|
1873 return accumulator; |
|
1874 }, { |
|
1875 tabs: [], |
|
1876 sectionsContentMap: {} |
|
1877 }); |
|
1878 } |
|
1879 |
|
1880 return mappedTabs; |
|
1881 }, [sections]); |
|
1882 const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]); |
|
1883 let modalContent; // We render different components based on the viewport size. |
|
1884 |
|
1885 if (isLargeViewport) { |
|
1886 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, { |
|
1887 className: "interface-preferences__tabs", |
|
1888 tabs: tabs, |
|
1889 initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined, |
|
1890 onSelect: setActiveMenu, |
|
1891 orientation: "vertical" |
|
1892 }, getCurrentTab); |
|
1893 } else { |
|
1894 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { |
|
1895 initialPath: "/", |
|
1896 className: "interface-preferences__provider" |
|
1897 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { |
|
1898 path: "/" |
|
1899 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { |
|
1900 isBorderless: true, |
|
1901 size: "small" |
|
1902 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => { |
|
1903 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, { |
|
1904 key: tab.name, |
|
1905 path: tab.name, |
|
1906 as: external_wp_components_namespaceObject.__experimentalItem, |
|
1907 isAction: true |
|
1908 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { |
|
1909 justify: "space-between" |
|
1910 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, { |
|
1911 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right |
|
1912 })))); |
|
1913 }))))), sections.length && sections.map(section => { |
|
1914 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { |
|
1915 key: `${section.name}-menu`, |
|
1916 path: section.name |
|
1917 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { |
|
1918 isBorderless: true, |
|
1919 size: "large" |
|
1920 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, { |
|
1921 isBorderless: false, |
|
1922 justify: "left", |
|
1923 size: "small", |
|
1924 gap: "6" |
|
1925 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, { |
|
1926 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, |
|
1927 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view') |
|
1928 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
|
1929 size: "16" |
|
1930 }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content))); |
|
1931 })); |
|
1932 } |
|
1933 |
|
1934 return modalContent; |
|
1935 } |
|
1936 |
|
1937 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-section/index.js |
|
1938 |
|
1939 |
|
1940 const Section = _ref => { |
|
1941 let { |
|
1942 description, |
|
1943 title, |
|
1944 children |
|
1945 } = _ref; |
|
1946 return (0,external_wp_element_namespaceObject.createElement)("fieldset", { |
|
1947 className: "interface-preferences-modal__section" |
|
1948 }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_element_namespaceObject.createElement)("h2", { |
|
1949 className: "interface-preferences-modal__section-title" |
|
1950 }, title), description && (0,external_wp_element_namespaceObject.createElement)("p", { |
|
1951 className: "interface-preferences-modal__section-description" |
|
1952 }, description)), children); |
|
1953 }; |
|
1954 |
|
1955 /* harmony default export */ var preferences_modal_section = (Section); |
|
1956 |
|
1957 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-base-option/index.js |
|
1958 |
|
1959 |
|
1960 /** |
|
1961 * WordPress dependencies |
|
1962 */ |
|
1963 |
|
1964 |
|
1965 function BaseOption(_ref) { |
|
1966 let { |
|
1967 help, |
|
1968 label, |
|
1969 isChecked, |
|
1970 onChange, |
|
1971 children |
|
1972 } = _ref; |
|
1973 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
1974 className: "interface-preferences-modal__option" |
|
1975 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { |
|
1976 help: help, |
|
1977 label: label, |
|
1978 checked: isChecked, |
|
1979 onChange: onChange |
|
1980 }), children); |
|
1981 } |
|
1982 |
|
1983 /* harmony default export */ var preferences_modal_base_option = (BaseOption); |
|
1984 |
|
1985 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js |
|
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 |
|
1999 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js |
|
2000 |
|
2001 |
|
2002 |
|
2003 ;// CONCATENATED MODULE: external ["wp","a11y"] |
|
2004 var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; |
|
2005 ;// CONCATENATED MODULE: external ["wp","coreData"] |
|
2006 var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
|
2007 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/utils/meta-boxes.js |
290 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/utils/meta-boxes.js |
2008 /** |
291 /** |
2009 * Function returning the current Meta Boxes DOM Node in the editor |
292 * Function returning the current Meta Boxes DOM Node in the editor |
2010 * whether the meta box area is opened or not. |
293 * whether the meta box area is opened or not. |
2011 * If the MetaBox Area is visible returns it, and returns the original container instead. |
294 * If the MetaBox Area is visible returns it, and returns the original container instead. |
2014 * |
297 * |
2015 * @return {string} HTML content. |
298 * @return {string} HTML content. |
2016 */ |
299 */ |
2017 const getMetaBoxContainer = location => { |
300 const getMetaBoxContainer = location => { |
2018 const area = document.querySelector(`.edit-post-meta-boxes-area.is-${location} .metabox-location-${location}`); |
301 const area = document.querySelector(`.edit-post-meta-boxes-area.is-${location} .metabox-location-${location}`); |
2019 |
|
2020 if (area) { |
302 if (area) { |
2021 return area; |
303 return area; |
2022 } |
304 } |
2023 |
|
2024 return document.querySelector('#metaboxes .metabox-location-' + location); |
305 return document.querySelector('#metaboxes .metabox-location-' + location); |
2025 }; |
306 }; |
2026 |
307 |
|
308 ;// CONCATENATED MODULE: external ["wp","privateApis"] |
|
309 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; |
|
310 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/lock-unlock.js |
|
311 /** |
|
312 * WordPress dependencies |
|
313 */ |
|
314 |
|
315 const { |
|
316 lock, |
|
317 unlock |
|
318 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-post'); |
|
319 |
2027 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/actions.js |
320 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/actions.js |
2028 /** |
321 /** |
2029 * External dependencies |
|
2030 */ |
|
2031 |
|
2032 /** |
|
2033 * WordPress dependencies |
322 * WordPress dependencies |
2034 */ |
323 */ |
2035 |
324 |
2036 |
325 |
2037 |
326 |
2038 |
327 |
2039 |
328 |
2040 |
329 |
2041 |
330 |
2042 |
|
2043 |
|
2044 |
|
2045 /** |
331 /** |
2046 * Internal dependencies |
332 * Internal dependencies |
2047 */ |
333 */ |
2048 |
334 |
2049 |
335 |
|
336 const { |
|
337 interfaceStore |
|
338 } = unlock(external_wp_editor_namespaceObject.privateApis); |
2050 |
339 |
2051 /** |
340 /** |
2052 * Returns an action object used in signalling that the user opened an editor sidebar. |
341 * Returns an action object used in signalling that the user opened an editor sidebar. |
2053 * |
342 * |
2054 * @param {?string} name Sidebar name to be opened. |
343 * @param {?string} name Sidebar name to be opened. |
2055 */ |
344 */ |
2056 |
345 const openGeneralSidebar = name => ({ |
2057 const openGeneralSidebar = name => _ref => { |
346 registry |
2058 let { |
347 }) => { |
2059 registry |
348 registry.dispatch(interfaceStore).enableComplementaryArea('core', name); |
2060 } = _ref; |
|
2061 return registry.dispatch(store).enableComplementaryArea(store_store.name, name); |
|
2062 }; |
349 }; |
|
350 |
2063 /** |
351 /** |
2064 * Returns an action object signalling that the user closed the sidebar. |
352 * Returns an action object signalling that the user closed the sidebar. |
2065 */ |
353 */ |
2066 |
354 const closeGeneralSidebar = () => ({ |
2067 const closeGeneralSidebar = () => _ref2 => { |
355 registry |
2068 let { |
356 }) => registry.dispatch(interfaceStore).disableComplementaryArea('core'); |
2069 registry |
357 |
2070 } = _ref2; |
358 /** |
2071 return registry.dispatch(store).disableComplementaryArea(store_store.name); |
359 * Returns an action object used in signalling that the user opened a modal. |
|
360 * |
|
361 * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead. |
|
362 * |
|
363 * |
|
364 * @param {string} name A string that uniquely identifies the modal. |
|
365 * |
|
366 * @return {Object} Action object. |
|
367 */ |
|
368 const openModal = name => ({ |
|
369 registry |
|
370 }) => { |
|
371 external_wp_deprecated_default()("select( 'core/edit-post' ).openModal( name )", { |
|
372 since: '6.3', |
|
373 alternative: "select( 'core/interface').openModal( name )" |
|
374 }); |
|
375 return registry.dispatch(interfaceStore).openModal(name); |
2072 }; |
376 }; |
2073 /** |
377 |
2074 * Returns an action object used in signalling that the user opened a modal. |
378 /** |
2075 * |
379 * Returns an action object signalling that the user closed a modal. |
2076 * @param {string} name A string that uniquely identifies the modal. |
380 * |
|
381 * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead. |
2077 * |
382 * |
2078 * @return {Object} Action object. |
383 * @return {Object} Action object. |
2079 */ |
384 */ |
2080 |
385 const closeModal = () => ({ |
2081 function openModal(name) { |
386 registry |
2082 return { |
387 }) => { |
2083 type: 'OPEN_MODAL', |
388 external_wp_deprecated_default()("select( 'core/edit-post' ).closeModal()", { |
2084 name |
389 since: '6.3', |
2085 }; |
390 alternative: "select( 'core/interface').closeModal()" |
2086 } |
391 }); |
2087 /** |
392 return registry.dispatch(interfaceStore).closeModal(); |
2088 * Returns an action object signalling that the user closed a modal. |
393 }; |
2089 * |
394 |
2090 * @return {Object} Action object. |
|
2091 */ |
|
2092 |
|
2093 function closeModal() { |
|
2094 return { |
|
2095 type: 'CLOSE_MODAL' |
|
2096 }; |
|
2097 } |
|
2098 /** |
395 /** |
2099 * Returns an action object used in signalling that the user opened the publish |
396 * Returns an action object used in signalling that the user opened the publish |
2100 * sidebar. |
397 * sidebar. |
|
398 * @deprecated |
2101 * |
399 * |
2102 * @return {Object} Action object |
400 * @return {Object} Action object |
2103 */ |
401 */ |
2104 |
402 const openPublishSidebar = () => ({ |
2105 function openPublishSidebar() { |
403 registry |
2106 return { |
404 }) => { |
2107 type: 'OPEN_PUBLISH_SIDEBAR' |
405 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).openPublishSidebar", { |
2108 }; |
406 since: '6.6', |
2109 } |
407 alternative: "dispatch( 'core/editor').openPublishSidebar" |
|
408 }); |
|
409 registry.dispatch(external_wp_editor_namespaceObject.store).openPublishSidebar(); |
|
410 }; |
|
411 |
2110 /** |
412 /** |
2111 * Returns an action object used in signalling that the user closed the |
413 * Returns an action object used in signalling that the user closed the |
2112 * publish sidebar. |
414 * publish sidebar. |
|
415 * @deprecated |
2113 * |
416 * |
2114 * @return {Object} Action object. |
417 * @return {Object} Action object. |
2115 */ |
418 */ |
2116 |
419 const closePublishSidebar = () => ({ |
2117 function closePublishSidebar() { |
420 registry |
|
421 }) => { |
|
422 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).closePublishSidebar", { |
|
423 since: '6.6', |
|
424 alternative: "dispatch( 'core/editor').closePublishSidebar" |
|
425 }); |
|
426 registry.dispatch(external_wp_editor_namespaceObject.store).closePublishSidebar(); |
|
427 }; |
|
428 |
|
429 /** |
|
430 * Returns an action object used in signalling that the user toggles the publish sidebar. |
|
431 * @deprecated |
|
432 * |
|
433 * @return {Object} Action object |
|
434 */ |
|
435 const togglePublishSidebar = () => ({ |
|
436 registry |
|
437 }) => { |
|
438 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).togglePublishSidebar", { |
|
439 since: '6.6', |
|
440 alternative: "dispatch( 'core/editor').togglePublishSidebar" |
|
441 }); |
|
442 registry.dispatch(external_wp_editor_namespaceObject.store).togglePublishSidebar(); |
|
443 }; |
|
444 |
|
445 /** |
|
446 * Returns an action object used to enable or disable a panel in the editor. |
|
447 * |
|
448 * @deprecated |
|
449 * |
|
450 * @param {string} panelName A string that identifies the panel to enable or disable. |
|
451 * |
|
452 * @return {Object} Action object. |
|
453 */ |
|
454 const toggleEditorPanelEnabled = panelName => ({ |
|
455 registry |
|
456 }) => { |
|
457 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled", { |
|
458 since: '6.5', |
|
459 alternative: "dispatch( 'core/editor').toggleEditorPanelEnabled" |
|
460 }); |
|
461 registry.dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelEnabled(panelName); |
|
462 }; |
|
463 |
|
464 /** |
|
465 * Opens a closed panel and closes an open panel. |
|
466 * |
|
467 * @deprecated |
|
468 * |
|
469 * @param {string} panelName A string that identifies the panel to open or close. |
|
470 */ |
|
471 const toggleEditorPanelOpened = panelName => ({ |
|
472 registry |
|
473 }) => { |
|
474 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleEditorPanelOpened", { |
|
475 since: '6.5', |
|
476 alternative: "dispatch( 'core/editor').toggleEditorPanelOpened" |
|
477 }); |
|
478 registry.dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelOpened(panelName); |
|
479 }; |
|
480 |
|
481 /** |
|
482 * Returns an action object used to remove a panel from the editor. |
|
483 * |
|
484 * @deprecated |
|
485 * |
|
486 * @param {string} panelName A string that identifies the panel to remove. |
|
487 * |
|
488 * @return {Object} Action object. |
|
489 */ |
|
490 const removeEditorPanel = panelName => ({ |
|
491 registry |
|
492 }) => { |
|
493 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).removeEditorPanel", { |
|
494 since: '6.5', |
|
495 alternative: "dispatch( 'core/editor').removeEditorPanel" |
|
496 }); |
|
497 registry.dispatch(external_wp_editor_namespaceObject.store).removeEditorPanel(panelName); |
|
498 }; |
|
499 |
|
500 /** |
|
501 * Triggers an action used to toggle a feature flag. |
|
502 * |
|
503 * @param {string} feature Feature name. |
|
504 */ |
|
505 const toggleFeature = feature => ({ |
|
506 registry |
|
507 }) => registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-post', feature); |
|
508 |
|
509 /** |
|
510 * Triggers an action used to switch editor mode. |
|
511 * |
|
512 * @deprecated |
|
513 * |
|
514 * @param {string} mode The editor mode. |
|
515 */ |
|
516 const switchEditorMode = mode => ({ |
|
517 registry |
|
518 }) => { |
|
519 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).switchEditorMode", { |
|
520 since: '6.6', |
|
521 alternative: "dispatch( 'core/editor').switchEditorMode" |
|
522 }); |
|
523 registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode); |
|
524 }; |
|
525 |
|
526 /** |
|
527 * Triggers an action object used to toggle a plugin name flag. |
|
528 * |
|
529 * @param {string} pluginName Plugin name. |
|
530 */ |
|
531 const togglePinnedPluginItem = pluginName => ({ |
|
532 registry |
|
533 }) => { |
|
534 const isPinned = registry.select(interfaceStore).isItemPinned('core', pluginName); |
|
535 registry.dispatch(interfaceStore)[isPinned ? 'unpinItem' : 'pinItem']('core', pluginName); |
|
536 }; |
|
537 |
|
538 /** |
|
539 * Returns an action object used in signaling that a style should be auto-applied when a block is created. |
|
540 * |
|
541 * @deprecated |
|
542 */ |
|
543 function updatePreferredStyleVariations() { |
|
544 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).updatePreferredStyleVariations", { |
|
545 since: '6.6', |
|
546 hint: 'Preferred Style Variations are not supported anymore.' |
|
547 }); |
2118 return { |
548 return { |
2119 type: 'CLOSE_PUBLISH_SIDEBAR' |
549 type: 'NOTHING' |
2120 }; |
550 }; |
2121 } |
551 } |
2122 /** |
552 |
2123 * Returns an action object used in signalling that the user toggles the publish sidebar. |
553 /** |
2124 * |
554 * Update the provided block types to be visible. |
2125 * @return {Object} Action object |
555 * |
2126 */ |
556 * @param {string[]} blockNames Names of block types to show. |
2127 |
557 */ |
2128 function togglePublishSidebar() { |
558 const showBlockTypes = blockNames => ({ |
|
559 registry |
|
560 }) => { |
|
561 unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).showBlockTypes(blockNames); |
|
562 }; |
|
563 |
|
564 /** |
|
565 * Update the provided block types to be hidden. |
|
566 * |
|
567 * @param {string[]} blockNames Names of block types to hide. |
|
568 */ |
|
569 const hideBlockTypes = blockNames => ({ |
|
570 registry |
|
571 }) => { |
|
572 unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).hideBlockTypes(blockNames); |
|
573 }; |
|
574 |
|
575 /** |
|
576 * Stores info about which Meta boxes are available in which location. |
|
577 * |
|
578 * @param {Object} metaBoxesPerLocation Meta boxes per location. |
|
579 */ |
|
580 function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) { |
2129 return { |
581 return { |
2130 type: 'TOGGLE_PUBLISH_SIDEBAR' |
|
2131 }; |
|
2132 } |
|
2133 /** |
|
2134 * Returns an action object used to enable or disable a panel in the editor. |
|
2135 * |
|
2136 * @param {string} panelName A string that identifies the panel to enable or disable. |
|
2137 * |
|
2138 * @return {Object} Action object. |
|
2139 */ |
|
2140 |
|
2141 const toggleEditorPanelEnabled = panelName => _ref3 => { |
|
2142 var _registry$select$get; |
|
2143 |
|
2144 let { |
|
2145 registry |
|
2146 } = _ref3; |
|
2147 const inactivePanels = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; |
|
2148 const isPanelInactive = !!(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName)); // If the panel is inactive, remove it to enable it, else add it to |
|
2149 // make it inactive. |
|
2150 |
|
2151 let updatedInactivePanels; |
|
2152 |
|
2153 if (isPanelInactive) { |
|
2154 updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName); |
|
2155 } else { |
|
2156 updatedInactivePanels = [...inactivePanels, panelName]; |
|
2157 } |
|
2158 |
|
2159 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'inactivePanels', updatedInactivePanels); |
|
2160 }; |
|
2161 /** |
|
2162 * Opens a closed panel and closes an open panel. |
|
2163 * |
|
2164 * @param {string} panelName A string that identifies the panel to open or close. |
|
2165 */ |
|
2166 |
|
2167 const toggleEditorPanelOpened = panelName => _ref4 => { |
|
2168 var _registry$select$get2; |
|
2169 |
|
2170 let { |
|
2171 registry |
|
2172 } = _ref4; |
|
2173 const openPanels = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; |
|
2174 const isPanelOpen = !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName)); // If the panel is open, remove it to close it, else add it to |
|
2175 // make it open. |
|
2176 |
|
2177 let updatedOpenPanels; |
|
2178 |
|
2179 if (isPanelOpen) { |
|
2180 updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName); |
|
2181 } else { |
|
2182 updatedOpenPanels = [...openPanels, panelName]; |
|
2183 } |
|
2184 |
|
2185 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'openPanels', updatedOpenPanels); |
|
2186 }; |
|
2187 /** |
|
2188 * Returns an action object used to remove a panel from the editor. |
|
2189 * |
|
2190 * @param {string} panelName A string that identifies the panel to remove. |
|
2191 * |
|
2192 * @return {Object} Action object. |
|
2193 */ |
|
2194 |
|
2195 function removeEditorPanel(panelName) { |
|
2196 return { |
|
2197 type: 'REMOVE_PANEL', |
|
2198 panelName |
|
2199 }; |
|
2200 } |
|
2201 /** |
|
2202 * Triggers an action used to toggle a feature flag. |
|
2203 * |
|
2204 * @param {string} feature Feature name. |
|
2205 */ |
|
2206 |
|
2207 const actions_toggleFeature = feature => _ref5 => { |
|
2208 let { |
|
2209 registry |
|
2210 } = _ref5; |
|
2211 return registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-post', feature); |
|
2212 }; |
|
2213 /** |
|
2214 * Triggers an action used to switch editor mode. |
|
2215 * |
|
2216 * @param {string} mode The editor mode. |
|
2217 */ |
|
2218 |
|
2219 const switchEditorMode = mode => _ref6 => { |
|
2220 let { |
|
2221 registry |
|
2222 } = _ref6; |
|
2223 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'editorMode', mode); // Unselect blocks when we switch to the code editor. |
|
2224 |
|
2225 if (mode !== 'visual') { |
|
2226 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); |
|
2227 } |
|
2228 |
|
2229 const message = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Visual editor selected') : (0,external_wp_i18n_namespaceObject.__)('Code editor selected'); |
|
2230 (0,external_wp_a11y_namespaceObject.speak)(message, 'assertive'); |
|
2231 }; |
|
2232 /** |
|
2233 * Triggers an action object used to toggle a plugin name flag. |
|
2234 * |
|
2235 * @param {string} pluginName Plugin name. |
|
2236 */ |
|
2237 |
|
2238 const togglePinnedPluginItem = pluginName => _ref7 => { |
|
2239 let { |
|
2240 registry |
|
2241 } = _ref7; |
|
2242 const isPinned = registry.select(store).isItemPinned('core/edit-post', pluginName); |
|
2243 registry.dispatch(store)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName); |
|
2244 }; |
|
2245 /** |
|
2246 * Returns an action object used in signaling that a style should be auto-applied when a block is created. |
|
2247 * |
|
2248 * @param {string} blockName Name of the block. |
|
2249 * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed. |
|
2250 */ |
|
2251 |
|
2252 const updatePreferredStyleVariations = (blockName, blockStyle) => _ref8 => { |
|
2253 var _registry$select$get3; |
|
2254 |
|
2255 let { |
|
2256 registry |
|
2257 } = _ref8; |
|
2258 |
|
2259 if (!blockName) { |
|
2260 return; |
|
2261 } |
|
2262 |
|
2263 const existingVariations = (_registry$select$get3 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get3 !== void 0 ? _registry$select$get3 : {}; // When the blockStyle is omitted, remove the block's preferred variation. |
|
2264 |
|
2265 if (!blockStyle) { |
|
2266 const updatedVariations = { ...existingVariations |
|
2267 }; |
|
2268 delete updatedVariations[blockName]; |
|
2269 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'preferredStyleVariations', updatedVariations); |
|
2270 } else { |
|
2271 // Else add the variation. |
|
2272 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'preferredStyleVariations', { ...existingVariations, |
|
2273 [blockName]: blockStyle |
|
2274 }); |
|
2275 } |
|
2276 }; |
|
2277 /** |
|
2278 * Update the provided block types to be visible. |
|
2279 * |
|
2280 * @param {string[]} blockNames Names of block types to show. |
|
2281 */ |
|
2282 |
|
2283 const showBlockTypes = blockNames => _ref9 => { |
|
2284 var _registry$select$get4; |
|
2285 |
|
2286 let { |
|
2287 registry |
|
2288 } = _ref9; |
|
2289 const existingBlockNames = (_registry$select$get4 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get4 !== void 0 ? _registry$select$get4 : []; |
|
2290 const newBlockNames = (0,external_lodash_namespaceObject.without)(existingBlockNames, ...(0,external_lodash_namespaceObject.castArray)(blockNames)); |
|
2291 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'hiddenBlockTypes', newBlockNames); |
|
2292 }; |
|
2293 /** |
|
2294 * Update the provided block types to be hidden. |
|
2295 * |
|
2296 * @param {string[]} blockNames Names of block types to hide. |
|
2297 */ |
|
2298 |
|
2299 const hideBlockTypes = blockNames => _ref10 => { |
|
2300 var _registry$select$get5; |
|
2301 |
|
2302 let { |
|
2303 registry |
|
2304 } = _ref10; |
|
2305 const existingBlockNames = (_registry$select$get5 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get5 !== void 0 ? _registry$select$get5 : []; |
|
2306 const mergedBlockNames = new Set([...existingBlockNames, ...(0,external_lodash_namespaceObject.castArray)(blockNames)]); |
|
2307 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]); |
|
2308 }; |
|
2309 /** |
|
2310 * Returns an action object used in signaling |
|
2311 * what Meta boxes are available in which location. |
|
2312 * |
|
2313 * @param {Object} metaBoxesPerLocation Meta boxes per location. |
|
2314 */ |
|
2315 |
|
2316 const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref11 => { |
|
2317 let { |
|
2318 dispatch |
|
2319 } = _ref11; |
|
2320 return dispatch({ |
|
2321 type: 'SET_META_BOXES_PER_LOCATIONS', |
582 type: 'SET_META_BOXES_PER_LOCATIONS', |
2322 metaBoxesPerLocation |
583 metaBoxesPerLocation |
2323 }); |
584 }; |
2324 }; |
585 } |
|
586 |
2325 /** |
587 /** |
2326 * Update a metabox. |
588 * Update a metabox. |
2327 */ |
589 */ |
2328 |
590 const requestMetaBoxUpdates = () => async ({ |
2329 const requestMetaBoxUpdates = () => async _ref12 => { |
591 registry, |
2330 let { |
592 select, |
2331 registry, |
593 dispatch |
2332 select, |
594 }) => { |
2333 dispatch |
|
2334 } = _ref12; |
|
2335 dispatch({ |
595 dispatch({ |
2336 type: 'REQUEST_META_BOX_UPDATES' |
596 type: 'REQUEST_META_BOX_UPDATES' |
2337 }); // Saves the wp_editor fields. |
597 }); |
2338 |
598 |
|
599 // Saves the wp_editor fields. |
2339 if (window.tinyMCE) { |
600 if (window.tinyMCE) { |
2340 window.tinyMCE.triggerSave(); |
601 window.tinyMCE.triggerSave(); |
2341 } // Additional data needed for backward compatibility. |
602 } |
|
603 |
|
604 // We gather the base form data. |
|
605 const baseFormData = new window.FormData(document.querySelector('.metabox-base-form')); |
|
606 const postId = baseFormData.get('post_ID'); |
|
607 const postType = baseFormData.get('post_type'); |
|
608 |
|
609 // Additional data needed for backward compatibility. |
2342 // If we do not provide this data, the post will be overridden with the default values. |
610 // If we do not provide this data, the post will be overridden with the default values. |
2343 |
611 // We cannot rely on getCurrentPost because right now on the editor we may be editing a pattern or a template. |
2344 |
612 // We need to retrieve the post that the base form data is referring to. |
2345 const post = registry.select(external_wp_editor_namespaceObject.store).getCurrentPost(); |
613 const post = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); |
2346 const additionalData = [post.comment_status ? ['comment_status', post.comment_status] : false, post.ping_status ? ['ping_status', post.ping_status] : false, post.sticky ? ['sticky', post.sticky] : false, post.author ? ['post_author', post.author] : false].filter(Boolean); // We gather all the metaboxes locations data and the base form data. |
614 const additionalData = [post.comment_status ? ['comment_status', post.comment_status] : false, post.ping_status ? ['ping_status', post.ping_status] : false, post.sticky ? ['sticky', post.sticky] : false, post.author ? ['post_author', post.author] : false].filter(Boolean); |
2347 |
615 |
2348 const baseFormData = new window.FormData(document.querySelector('.metabox-base-form')); |
616 // We gather all the metaboxes locations. |
2349 const activeMetaBoxLocations = select.getActiveMetaBoxLocations(); |
617 const activeMetaBoxLocations = select.getActiveMetaBoxLocations(); |
2350 const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData(getMetaBoxContainer(location)))]; // Merge all form data objects into a single one. |
618 const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData(getMetaBoxContainer(location)))]; |
2351 |
619 |
2352 const formData = (0,external_lodash_namespaceObject.reduce)(formDataToMerge, (memo, currentFormData) => { |
620 // Merge all form data objects into a single one. |
|
621 const formData = formDataToMerge.reduce((memo, currentFormData) => { |
2353 for (const [key, value] of currentFormData) { |
622 for (const [key, value] of currentFormData) { |
2354 memo.append(key, value); |
623 memo.append(key, value); |
2355 } |
624 } |
2356 |
|
2357 return memo; |
625 return memo; |
2358 }, new window.FormData()); |
626 }, new window.FormData()); |
2359 additionalData.forEach(_ref13 => { |
627 additionalData.forEach(([key, value]) => formData.append(key, value)); |
2360 let [key, value] = _ref13; |
|
2361 return formData.append(key, value); |
|
2362 }); |
|
2363 |
|
2364 try { |
628 try { |
2365 // Save the metaboxes. |
629 // Save the metaboxes. |
2366 await external_wp_apiFetch_default()({ |
630 await external_wp_apiFetch_default()({ |
2367 url: window._wpMetaBoxUrl, |
631 url: window._wpMetaBoxUrl, |
2368 method: 'POST', |
632 method: 'POST', |
2372 dispatch.metaBoxUpdatesSuccess(); |
636 dispatch.metaBoxUpdatesSuccess(); |
2373 } catch { |
637 } catch { |
2374 dispatch.metaBoxUpdatesFailure(); |
638 dispatch.metaBoxUpdatesFailure(); |
2375 } |
639 } |
2376 }; |
640 }; |
|
641 |
2377 /** |
642 /** |
2378 * Returns an action object used to signal a successful meta box update. |
643 * Returns an action object used to signal a successful meta box update. |
2379 * |
644 * |
2380 * @return {Object} Action object. |
645 * @return {Object} Action object. |
2381 */ |
646 */ |
2382 |
|
2383 function metaBoxUpdatesSuccess() { |
647 function metaBoxUpdatesSuccess() { |
2384 return { |
648 return { |
2385 type: 'META_BOX_UPDATES_SUCCESS' |
649 type: 'META_BOX_UPDATES_SUCCESS' |
2386 }; |
650 }; |
2387 } |
651 } |
|
652 |
2388 /** |
653 /** |
2389 * Returns an action object used to signal a failed meta box update. |
654 * Returns an action object used to signal a failed meta box update. |
2390 * |
655 * |
2391 * @return {Object} Action object. |
656 * @return {Object} Action object. |
2392 */ |
657 */ |
2393 |
|
2394 function metaBoxUpdatesFailure() { |
658 function metaBoxUpdatesFailure() { |
2395 return { |
659 return { |
2396 type: 'META_BOX_UPDATES_FAILURE' |
660 type: 'META_BOX_UPDATES_FAILURE' |
2397 }; |
661 }; |
2398 } |
662 } |
2399 /** |
663 |
2400 * Returns an action object used to toggle the width of the editing canvas. |
664 /** |
|
665 * Action that changes the width of the editing canvas. |
|
666 * |
|
667 * @deprecated |
2401 * |
668 * |
2402 * @param {string} deviceType |
669 * @param {string} deviceType |
2403 * |
670 */ |
2404 * @return {Object} Action object. |
671 const __experimentalSetPreviewDeviceType = deviceType => ({ |
2405 */ |
672 registry |
2406 |
673 }) => { |
2407 function __experimentalSetPreviewDeviceType(deviceType) { |
674 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType", { |
|
675 since: '6.5', |
|
676 version: '6.7', |
|
677 hint: 'registry.dispatch( editorStore ).setDeviceType' |
|
678 }); |
|
679 registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); |
|
680 }; |
|
681 |
|
682 /** |
|
683 * Returns an action object used to open/close the inserter. |
|
684 * |
|
685 * @deprecated |
|
686 * |
|
687 * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false). |
|
688 */ |
|
689 const setIsInserterOpened = value => ({ |
|
690 registry |
|
691 }) => { |
|
692 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsInserterOpened", { |
|
693 since: '6.5', |
|
694 alternative: "dispatch( 'core/editor').setIsInserterOpened" |
|
695 }); |
|
696 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); |
|
697 }; |
|
698 |
|
699 /** |
|
700 * Returns an action object used to open/close the list view. |
|
701 * |
|
702 * @deprecated |
|
703 * |
|
704 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. |
|
705 */ |
|
706 const setIsListViewOpened = isOpen => ({ |
|
707 registry |
|
708 }) => { |
|
709 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsListViewOpened", { |
|
710 since: '6.5', |
|
711 alternative: "dispatch( 'core/editor').setIsListViewOpened" |
|
712 }); |
|
713 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); |
|
714 }; |
|
715 |
|
716 /** |
|
717 * Returns an action object used to switch to template editing. |
|
718 * |
|
719 * @deprecated |
|
720 */ |
|
721 function setIsEditingTemplate() { |
|
722 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsEditingTemplate", { |
|
723 since: '6.5', |
|
724 alternative: "dispatch( 'core/editor').setRenderingMode" |
|
725 }); |
2408 return { |
726 return { |
2409 type: 'SET_PREVIEW_DEVICE_TYPE', |
727 type: 'NOTHING' |
2410 deviceType |
|
2411 }; |
728 }; |
2412 } |
729 } |
2413 /** |
730 |
2414 * Returns an action object used to open/close the inserter. |
731 /** |
2415 * |
732 * Create a block based template. |
2416 * @param {boolean|Object} value Whether the inserter should be |
733 * |
2417 * opened (true) or closed (false). |
734 * @deprecated |
2418 * To specify an insertion point, |
735 */ |
2419 * use an object. |
736 function __unstableCreateTemplate() { |
2420 * @param {string} value.rootClientId The root client ID to insert at. |
737 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__unstableCreateTemplate", { |
2421 * @param {number} value.insertionIndex The index to insert at. |
738 since: '6.5' |
2422 * |
739 }); |
2423 * @return {Object} Action object. |
|
2424 */ |
|
2425 |
|
2426 function setIsInserterOpened(value) { |
|
2427 return { |
740 return { |
2428 type: 'SET_IS_INSERTER_OPENED', |
741 type: 'NOTHING' |
2429 value |
|
2430 }; |
742 }; |
2431 } |
743 } |
2432 /** |
|
2433 * Returns an action object used to open/close the list view. |
|
2434 * |
|
2435 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. |
|
2436 * @return {Object} Action object. |
|
2437 */ |
|
2438 |
|
2439 function setIsListViewOpened(isOpen) { |
|
2440 return { |
|
2441 type: 'SET_IS_LIST_VIEW_OPENED', |
|
2442 isOpen |
|
2443 }; |
|
2444 } |
|
2445 /** |
|
2446 * Returns an action object used to switch to template editing. |
|
2447 * |
|
2448 * @param {boolean} value Is editing template. |
|
2449 * @return {Object} Action object. |
|
2450 */ |
|
2451 |
|
2452 function setIsEditingTemplate(value) { |
|
2453 return { |
|
2454 type: 'SET_IS_EDITING_TEMPLATE', |
|
2455 value |
|
2456 }; |
|
2457 } |
|
2458 /** |
|
2459 * Switches to the template mode. |
|
2460 * |
|
2461 * @param {boolean} newTemplate Is new template. |
|
2462 */ |
|
2463 |
|
2464 const __unstableSwitchToTemplateMode = function () { |
|
2465 let newTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
2466 return _ref14 => { |
|
2467 let { |
|
2468 registry, |
|
2469 select, |
|
2470 dispatch |
|
2471 } = _ref14; |
|
2472 dispatch(setIsEditingTemplate(true)); |
|
2473 const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate'); |
|
2474 |
|
2475 if (!isWelcomeGuideActive) { |
|
2476 const message = newTemplate ? (0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now.") : (0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'); |
|
2477 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(message, { |
|
2478 type: 'snackbar' |
|
2479 }); |
|
2480 } |
|
2481 }; |
|
2482 }; |
|
2483 /** |
|
2484 * Create a block based template. |
|
2485 * |
|
2486 * @param {Object?} template Template to create and assign. |
|
2487 */ |
|
2488 |
|
2489 const __unstableCreateTemplate = template => async _ref15 => { |
|
2490 let { |
|
2491 registry |
|
2492 } = _ref15; |
|
2493 const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template); |
|
2494 const post = registry.select(external_wp_editor_namespaceObject.store).getCurrentPost(); |
|
2495 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', post.type, post.id, { |
|
2496 template: savedTemplate.slug |
|
2497 }); |
|
2498 }; |
|
2499 let actions_metaBoxesInitialized = false; |
744 let actions_metaBoxesInitialized = false; |
|
745 |
2500 /** |
746 /** |
2501 * Initializes WordPress `postboxes` script and the logic for saving meta boxes. |
747 * Initializes WordPress `postboxes` script and the logic for saving meta boxes. |
2502 */ |
748 */ |
2503 |
749 const initializeMetaBoxes = () => ({ |
2504 const initializeMetaBoxes = () => _ref16 => { |
750 registry, |
2505 let { |
751 select, |
2506 registry, |
752 dispatch |
2507 select, |
753 }) => { |
2508 dispatch |
|
2509 } = _ref16; |
|
2510 |
|
2511 const isEditorReady = registry.select(external_wp_editor_namespaceObject.store).__unstableIsEditorReady(); |
754 const isEditorReady = registry.select(external_wp_editor_namespaceObject.store).__unstableIsEditorReady(); |
2512 |
|
2513 if (!isEditorReady) { |
755 if (!isEditorReady) { |
2514 return; |
756 return; |
2515 } // Only initialize once. |
757 } |
2516 |
758 // Only initialize once. |
2517 |
|
2518 if (actions_metaBoxesInitialized) { |
759 if (actions_metaBoxesInitialized) { |
2519 return; |
760 return; |
2520 } |
761 } |
2521 |
|
2522 const postType = registry.select(external_wp_editor_namespaceObject.store).getCurrentPostType(); |
762 const postType = registry.select(external_wp_editor_namespaceObject.store).getCurrentPostType(); |
2523 |
|
2524 if (window.postboxes.page !== postType) { |
763 if (window.postboxes.page !== postType) { |
2525 window.postboxes.add_postbox_toggles(postType); |
764 window.postboxes.add_postbox_toggles(postType); |
2526 } |
765 } |
2527 |
|
2528 actions_metaBoxesInitialized = true; |
766 actions_metaBoxesInitialized = true; |
2529 let wasSavingPost = registry.select(external_wp_editor_namespaceObject.store).isSavingPost(); |
767 |
2530 let wasAutosavingPost = registry.select(external_wp_editor_namespaceObject.store).isAutosavingPost(); |
768 // Save metaboxes on save completion, except for autosaves. |
2531 const hasMetaBoxes = select.hasMetaBoxes(); // Save metaboxes when performing a full save on the post. |
769 (0,external_wp_hooks_namespaceObject.addFilter)('editor.__unstableSavePost', 'core/edit-post/save-metaboxes', (previous, options) => previous.then(() => { |
2532 |
770 if (options.isAutosave) { |
2533 registry.subscribe(async () => { |
771 return; |
2534 const isSavingPost = registry.select(external_wp_editor_namespaceObject.store).isSavingPost(); |
|
2535 const isAutosavingPost = registry.select(external_wp_editor_namespaceObject.store).isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview. |
|
2536 // |
|
2537 // Meta boxes are initialized once at page load. It is not necessary to |
|
2538 // account for updates on each state change. |
|
2539 // |
|
2540 // See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309. |
|
2541 |
|
2542 const shouldTriggerMetaboxesSave = hasMetaBoxes && wasSavingPost && !isSavingPost && !wasAutosavingPost; // Save current state for next inspection. |
|
2543 |
|
2544 wasSavingPost = isSavingPost; |
|
2545 wasAutosavingPost = isAutosavingPost; |
|
2546 |
|
2547 if (shouldTriggerMetaboxesSave) { |
|
2548 await dispatch.requestMetaBoxUpdates(); |
|
2549 } |
772 } |
2550 }); |
773 if (!select.hasMetaBoxes()) { |
|
774 return; |
|
775 } |
|
776 return dispatch.requestMetaBoxUpdates(); |
|
777 })); |
2551 dispatch({ |
778 dispatch({ |
2552 type: 'META_BOXES_INITIALIZED' |
779 type: 'META_BOXES_INITIALIZED' |
2553 }); |
780 }); |
2554 }; |
781 }; |
2555 |
782 |
2556 ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js |
783 /** |
2557 |
784 * Action that toggles Distraction free mode. |
2558 |
785 * Distraction free mode expects there are no sidebars, as due to the |
2559 var LEAF_KEY, hasWeakMap; |
786 * z-index values set, you can't close sidebars. |
2560 |
787 * |
2561 /** |
788 * @deprecated |
2562 * Arbitrary value used as key for referencing cache object in WeakMap tree. |
789 */ |
2563 * |
790 const toggleDistractionFree = () => ({ |
2564 * @type {Object} |
791 registry |
2565 */ |
792 }) => { |
2566 LEAF_KEY = {}; |
793 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleDistractionFree", { |
2567 |
794 since: '6.6', |
2568 /** |
795 alternative: "dispatch( 'core/editor').toggleDistractionFree" |
2569 * Whether environment supports WeakMap. |
796 }); |
2570 * |
797 registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree(); |
2571 * @type {boolean} |
798 }; |
2572 */ |
|
2573 hasWeakMap = typeof WeakMap !== 'undefined'; |
|
2574 |
|
2575 /** |
|
2576 * Returns the first argument as the sole entry in an array. |
|
2577 * |
|
2578 * @param {*} value Value to return. |
|
2579 * |
|
2580 * @return {Array} Value returned as entry in array. |
|
2581 */ |
|
2582 function arrayOf( value ) { |
|
2583 return [ value ]; |
|
2584 } |
|
2585 |
|
2586 /** |
|
2587 * Returns true if the value passed is object-like, or false otherwise. A value |
|
2588 * is object-like if it can support property assignment, e.g. object or array. |
|
2589 * |
|
2590 * @param {*} value Value to test. |
|
2591 * |
|
2592 * @return {boolean} Whether value is object-like. |
|
2593 */ |
|
2594 function isObjectLike( value ) { |
|
2595 return !! value && 'object' === typeof value; |
|
2596 } |
|
2597 |
|
2598 /** |
|
2599 * Creates and returns a new cache object. |
|
2600 * |
|
2601 * @return {Object} Cache object. |
|
2602 */ |
|
2603 function createCache() { |
|
2604 var cache = { |
|
2605 clear: function() { |
|
2606 cache.head = null; |
|
2607 }, |
|
2608 }; |
|
2609 |
|
2610 return cache; |
|
2611 } |
|
2612 |
|
2613 /** |
|
2614 * Returns true if entries within the two arrays are strictly equal by |
|
2615 * reference from a starting index. |
|
2616 * |
|
2617 * @param {Array} a First array. |
|
2618 * @param {Array} b Second array. |
|
2619 * @param {number} fromIndex Index from which to start comparison. |
|
2620 * |
|
2621 * @return {boolean} Whether arrays are shallowly equal. |
|
2622 */ |
|
2623 function isShallowEqual( a, b, fromIndex ) { |
|
2624 var i; |
|
2625 |
|
2626 if ( a.length !== b.length ) { |
|
2627 return false; |
|
2628 } |
|
2629 |
|
2630 for ( i = fromIndex; i < a.length; i++ ) { |
|
2631 if ( a[ i ] !== b[ i ] ) { |
|
2632 return false; |
|
2633 } |
|
2634 } |
|
2635 |
|
2636 return true; |
|
2637 } |
|
2638 |
|
2639 /** |
|
2640 * Returns a memoized selector function. The getDependants function argument is |
|
2641 * called before the memoized selector and is expected to return an immutable |
|
2642 * reference or array of references on which the selector depends for computing |
|
2643 * its own return value. The memoize cache is preserved only as long as those |
|
2644 * dependant references remain the same. If getDependants returns a different |
|
2645 * reference(s), the cache is cleared and the selector value regenerated. |
|
2646 * |
|
2647 * @param {Function} selector Selector function. |
|
2648 * @param {Function} getDependants Dependant getter returning an immutable |
|
2649 * reference or array of reference used in |
|
2650 * cache bust consideration. |
|
2651 * |
|
2652 * @return {Function} Memoized selector. |
|
2653 */ |
|
2654 /* harmony default export */ function rememo(selector, getDependants ) { |
|
2655 var rootCache, getCache; |
|
2656 |
|
2657 // Use object source as dependant if getter not provided |
|
2658 if ( ! getDependants ) { |
|
2659 getDependants = arrayOf; |
|
2660 } |
|
2661 |
|
2662 /** |
|
2663 * Returns the root cache. If WeakMap is supported, this is assigned to the |
|
2664 * root WeakMap cache set, otherwise it is a shared instance of the default |
|
2665 * cache object. |
|
2666 * |
|
2667 * @return {(WeakMap|Object)} Root cache object. |
|
2668 */ |
|
2669 function getRootCache() { |
|
2670 return rootCache; |
|
2671 } |
|
2672 |
|
2673 /** |
|
2674 * Returns the cache for a given dependants array. When possible, a WeakMap |
|
2675 * will be used to create a unique cache for each set of dependants. This |
|
2676 * is feasible due to the nature of WeakMap in allowing garbage collection |
|
2677 * to occur on entries where the key object is no longer referenced. Since |
|
2678 * WeakMap requires the key to be an object, this is only possible when the |
|
2679 * dependant is object-like. The root cache is created as a hierarchy where |
|
2680 * each top-level key is the first entry in a dependants set, the value a |
|
2681 * WeakMap where each key is the next dependant, and so on. This continues |
|
2682 * so long as the dependants are object-like. If no dependants are object- |
|
2683 * like, then the cache is shared across all invocations. |
|
2684 * |
|
2685 * @see isObjectLike |
|
2686 * |
|
2687 * @param {Array} dependants Selector dependants. |
|
2688 * |
|
2689 * @return {Object} Cache object. |
|
2690 */ |
|
2691 function getWeakMapCache( dependants ) { |
|
2692 var caches = rootCache, |
|
2693 isUniqueByDependants = true, |
|
2694 i, dependant, map, cache; |
|
2695 |
|
2696 for ( i = 0; i < dependants.length; i++ ) { |
|
2697 dependant = dependants[ i ]; |
|
2698 |
|
2699 // Can only compose WeakMap from object-like key. |
|
2700 if ( ! isObjectLike( dependant ) ) { |
|
2701 isUniqueByDependants = false; |
|
2702 break; |
|
2703 } |
|
2704 |
|
2705 // Does current segment of cache already have a WeakMap? |
|
2706 if ( caches.has( dependant ) ) { |
|
2707 // Traverse into nested WeakMap. |
|
2708 caches = caches.get( dependant ); |
|
2709 } else { |
|
2710 // Create, set, and traverse into a new one. |
|
2711 map = new WeakMap(); |
|
2712 caches.set( dependant, map ); |
|
2713 caches = map; |
|
2714 } |
|
2715 } |
|
2716 |
|
2717 // We use an arbitrary (but consistent) object as key for the last item |
|
2718 // in the WeakMap to serve as our running cache. |
|
2719 if ( ! caches.has( LEAF_KEY ) ) { |
|
2720 cache = createCache(); |
|
2721 cache.isUniqueByDependants = isUniqueByDependants; |
|
2722 caches.set( LEAF_KEY, cache ); |
|
2723 } |
|
2724 |
|
2725 return caches.get( LEAF_KEY ); |
|
2726 } |
|
2727 |
|
2728 // Assign cache handler by availability of WeakMap |
|
2729 getCache = hasWeakMap ? getWeakMapCache : getRootCache; |
|
2730 |
|
2731 /** |
|
2732 * Resets root memoization cache. |
|
2733 */ |
|
2734 function clear() { |
|
2735 rootCache = hasWeakMap ? new WeakMap() : createCache(); |
|
2736 } |
|
2737 |
|
2738 // eslint-disable-next-line jsdoc/check-param-names |
|
2739 /** |
|
2740 * The augmented selector call, considering first whether dependants have |
|
2741 * changed before passing it to underlying memoize function. |
|
2742 * |
|
2743 * @param {Object} source Source object for derivation. |
|
2744 * @param {...*} extraArgs Additional arguments to pass to selector. |
|
2745 * |
|
2746 * @return {*} Selector result. |
|
2747 */ |
|
2748 function callSelector( /* source, ...extraArgs */ ) { |
|
2749 var len = arguments.length, |
|
2750 cache, node, i, args, dependants; |
|
2751 |
|
2752 // Create copy of arguments (avoid leaking deoptimization). |
|
2753 args = new Array( len ); |
|
2754 for ( i = 0; i < len; i++ ) { |
|
2755 args[ i ] = arguments[ i ]; |
|
2756 } |
|
2757 |
|
2758 dependants = getDependants.apply( null, args ); |
|
2759 cache = getCache( dependants ); |
|
2760 |
|
2761 // If not guaranteed uniqueness by dependants (primitive type or lack |
|
2762 // of WeakMap support), shallow compare against last dependants and, if |
|
2763 // references have changed, destroy cache to recalculate result. |
|
2764 if ( ! cache.isUniqueByDependants ) { |
|
2765 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { |
|
2766 cache.clear(); |
|
2767 } |
|
2768 |
|
2769 cache.lastDependants = dependants; |
|
2770 } |
|
2771 |
|
2772 node = cache.head; |
|
2773 while ( node ) { |
|
2774 // Check whether node arguments match arguments |
|
2775 if ( ! isShallowEqual( node.args, args, 1 ) ) { |
|
2776 node = node.next; |
|
2777 continue; |
|
2778 } |
|
2779 |
|
2780 // At this point we can assume we've found a match |
|
2781 |
|
2782 // Surface matched node to head if not already |
|
2783 if ( node !== cache.head ) { |
|
2784 // Adjust siblings to point to each other. |
|
2785 node.prev.next = node.next; |
|
2786 if ( node.next ) { |
|
2787 node.next.prev = node.prev; |
|
2788 } |
|
2789 |
|
2790 node.next = cache.head; |
|
2791 node.prev = null; |
|
2792 cache.head.prev = node; |
|
2793 cache.head = node; |
|
2794 } |
|
2795 |
|
2796 // Return immediately |
|
2797 return node.val; |
|
2798 } |
|
2799 |
|
2800 // No cached value found. Continue to insertion phase: |
|
2801 |
|
2802 node = { |
|
2803 // Generate the result from original function |
|
2804 val: selector.apply( null, args ), |
|
2805 }; |
|
2806 |
|
2807 // Avoid including the source object in the cache. |
|
2808 args[ 0 ] = null; |
|
2809 node.args = args; |
|
2810 |
|
2811 // Don't need to check whether node is already head, since it would |
|
2812 // have been returned above already if it was |
|
2813 |
|
2814 // Shift existing head down list |
|
2815 if ( cache.head ) { |
|
2816 cache.head.prev = node; |
|
2817 node.next = cache.head; |
|
2818 } |
|
2819 |
|
2820 cache.head = node; |
|
2821 |
|
2822 return node.val; |
|
2823 } |
|
2824 |
|
2825 callSelector.getDependants = getDependants; |
|
2826 callSelector.clear = clear; |
|
2827 clear(); |
|
2828 |
|
2829 return callSelector; |
|
2830 } |
|
2831 |
799 |
2832 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js |
800 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js |
2833 /** |
801 /** |
2834 * External dependencies |
|
2835 */ |
|
2836 |
|
2837 |
|
2838 /** |
|
2839 * WordPress dependencies |
802 * WordPress dependencies |
2840 */ |
803 */ |
2841 |
804 |
2842 |
805 |
2843 |
806 |
2844 |
807 |
2845 |
808 |
2846 |
809 |
2847 |
810 /** |
|
811 * Internal dependencies |
|
812 */ |
|
813 |
|
814 const { |
|
815 interfaceStore: selectors_interfaceStore |
|
816 } = unlock(external_wp_editor_namespaceObject.privateApis); |
2848 const EMPTY_ARRAY = []; |
817 const EMPTY_ARRAY = []; |
2849 const EMPTY_OBJECT = {}; |
818 const EMPTY_OBJECT = {}; |
|
819 |
2850 /** |
820 /** |
2851 * Returns the current editing mode. |
821 * Returns the current editing mode. |
2852 * |
822 * |
2853 * @param {Object} state Global application state. |
823 * @param {Object} state Global application state. |
2854 * |
824 * |
2855 * @return {string} Editing mode. |
825 * @return {string} Editing mode. |
2856 */ |
826 */ |
2857 |
|
2858 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
827 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
2859 var _select$get; |
828 var _select$get; |
2860 |
829 return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; |
2861 return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; |
|
2862 }); |
830 }); |
|
831 |
2863 /** |
832 /** |
2864 * Returns true if the editor sidebar is opened. |
833 * Returns true if the editor sidebar is opened. |
2865 * |
834 * |
2866 * @param {Object} state Global application state |
835 * @param {Object} state Global application state |
2867 * |
836 * |
2868 * @return {boolean} Whether the editor sidebar is opened. |
837 * @return {boolean} Whether the editor sidebar is opened. |
2869 */ |
838 */ |
2870 |
|
2871 const isEditorSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
839 const isEditorSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
2872 const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post'); |
840 const activeGeneralSidebar = select(selectors_interfaceStore).getActiveComplementaryArea('core'); |
2873 return (0,external_lodash_namespaceObject.includes)(['edit-post/document', 'edit-post/block'], activeGeneralSidebar); |
841 return ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar); |
2874 }); |
842 }); |
|
843 |
2875 /** |
844 /** |
2876 * Returns true if the plugin sidebar is opened. |
845 * Returns true if the plugin sidebar is opened. |
2877 * |
846 * |
2878 * @param {Object} state Global application state. |
847 * @param {Object} state Global application state. |
2879 * |
848 * |
2880 * @return {boolean} Whether the plugin sidebar is opened. |
849 * @return {boolean} Whether the plugin sidebar is opened. |
2881 */ |
850 */ |
2882 |
|
2883 const isPluginSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
851 const isPluginSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
2884 const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post'); |
852 const activeGeneralSidebar = select(selectors_interfaceStore).getActiveComplementaryArea('core'); |
2885 return !!activeGeneralSidebar && !(0,external_lodash_namespaceObject.includes)(['edit-post/document', 'edit-post/block'], activeGeneralSidebar); |
853 return !!activeGeneralSidebar && !['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar); |
2886 }); |
854 }); |
|
855 |
2887 /** |
856 /** |
2888 * Returns the current active general sidebar name, or null if there is no |
857 * Returns the current active general sidebar name, or null if there is no |
2889 * general sidebar active. The active general sidebar is a unique name to |
858 * general sidebar active. The active general sidebar is a unique name to |
2890 * identify either an editor or plugin sidebar. |
859 * identify either an editor or plugin sidebar. |
2891 * |
860 * |
2920 * @param {string[] | undefined} inactivePanels An array of inactive panel names. |
889 * @param {string[] | undefined} inactivePanels An array of inactive panel names. |
2921 * @param {string[] | undefined} openPanels An array of open panel names. |
890 * @param {string[] | undefined} openPanels An array of open panel names. |
2922 * |
891 * |
2923 * @return {Object} The converted panel data. |
892 * @return {Object} The converted panel data. |
2924 */ |
893 */ |
2925 |
|
2926 function convertPanelsToOldFormat(inactivePanels, openPanels) { |
894 function convertPanelsToOldFormat(inactivePanels, openPanels) { |
2927 var _ref; |
895 var _ref; |
2928 |
|
2929 // First reduce the inactive panels. |
896 // First reduce the inactive panels. |
2930 const panelsWithEnabledState = inactivePanels === null || inactivePanels === void 0 ? void 0 : inactivePanels.reduce((accumulatedPanels, panelName) => ({ ...accumulatedPanels, |
897 const panelsWithEnabledState = inactivePanels?.reduce((accumulatedPanels, panelName) => ({ |
|
898 ...accumulatedPanels, |
2931 [panelName]: { |
899 [panelName]: { |
2932 enabled: false |
900 enabled: false |
2933 } |
901 } |
2934 }), {}); // Then reduce the open panels, passing in the result of the previous |
902 }), {}); |
|
903 |
|
904 // Then reduce the open panels, passing in the result of the previous |
2935 // reduction as the initial value so that both open and inactive |
905 // reduction as the initial value so that both open and inactive |
2936 // panel state is combined. |
906 // panel state is combined. |
2937 |
907 const panels = openPanels?.reduce((accumulatedPanels, panelName) => { |
2938 const panels = openPanels === null || openPanels === void 0 ? void 0 : openPanels.reduce((accumulatedPanels, panelName) => { |
908 const currentPanelState = accumulatedPanels?.[panelName]; |
2939 const currentPanelState = accumulatedPanels === null || accumulatedPanels === void 0 ? void 0 : accumulatedPanels[panelName]; |
909 return { |
2940 return { ...accumulatedPanels, |
910 ...accumulatedPanels, |
2941 [panelName]: { ...currentPanelState, |
911 [panelName]: { |
|
912 ...currentPanelState, |
2942 opened: true |
913 opened: true |
2943 } |
914 } |
2944 }; |
915 }; |
2945 }, panelsWithEnabledState !== null && panelsWithEnabledState !== void 0 ? panelsWithEnabledState : {}); // The panels variable will only be set if openPanels wasn't `undefined`. |
916 }, panelsWithEnabledState !== null && panelsWithEnabledState !== void 0 ? panelsWithEnabledState : {}); |
|
917 |
|
918 // The panels variable will only be set if openPanels wasn't `undefined`. |
2946 // If it isn't set just return `panelsWithEnabledState`, and if that isn't |
919 // If it isn't set just return `panelsWithEnabledState`, and if that isn't |
2947 // set return an empty object. |
920 // set return an empty object. |
2948 |
|
2949 return (_ref = panels !== null && panels !== void 0 ? panels : panelsWithEnabledState) !== null && _ref !== void 0 ? _ref : EMPTY_OBJECT; |
921 return (_ref = panels !== null && panels !== void 0 ? panels : panelsWithEnabledState) !== null && _ref !== void 0 ? _ref : EMPTY_OBJECT; |
2950 } |
922 } |
|
923 |
2951 /** |
924 /** |
2952 * Returns the preferences (these preferences are persisted locally). |
925 * Returns the preferences (these preferences are persisted locally). |
2953 * |
926 * |
2954 * @param {Object} state Global application state. |
927 * @param {Object} state Global application state. |
2955 * |
928 * |
2956 * @return {Object} Preferences Object. |
929 * @return {Object} Preferences Object. |
2957 */ |
930 */ |
2958 |
|
2959 |
|
2960 const getPreferences = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
931 const getPreferences = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
2961 external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreferences`, { |
932 external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreferences`, { |
2962 since: '6.0', |
933 since: '6.0', |
2963 alternative: `select( 'core/preferences' ).get` |
934 alternative: `select( 'core/preferences' ).get` |
2964 }); // These preferences now exist in the preferences store. |
935 }); |
2965 // Fetch them so that they can be merged into the post |
936 const corePreferences = ['editorMode', 'hiddenBlockTypes'].reduce((accumulatedPrefs, preferenceKey) => { |
2966 // editor preferences. |
937 const value = select(external_wp_preferences_namespaceObject.store).get('core', preferenceKey); |
2967 |
938 return { |
2968 const preferences = ['hiddenBlockTypes', 'editorMode', 'preferredStyleVariations'].reduce((accumulatedPrefs, preferenceKey) => { |
939 ...accumulatedPrefs, |
2969 const value = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', preferenceKey); |
|
2970 return { ...accumulatedPrefs, |
|
2971 [preferenceKey]: value |
940 [preferenceKey]: value |
2972 }; |
941 }; |
2973 }, {}); // Panels were a preference, but the data structure changed when the state |
942 }, {}); |
|
943 |
|
944 // Panels were a preference, but the data structure changed when the state |
2974 // was migrated to the preferences store. They need to be converted from |
945 // was migrated to the preferences store. They need to be converted from |
2975 // the new preferences store format to old format to ensure no breaking |
946 // the new preferences store format to old format to ensure no breaking |
2976 // changes for plugins. |
947 // changes for plugins. |
2977 |
948 const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels'); |
2978 const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels'); |
949 const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels'); |
2979 const openPanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels'); |
|
2980 const panels = convertPanelsToOldFormat(inactivePanels, openPanels); |
950 const panels = convertPanelsToOldFormat(inactivePanels, openPanels); |
2981 return { ...preferences, |
951 return { |
|
952 ...corePreferences, |
2982 panels |
953 panels |
2983 }; |
954 }; |
2984 }); |
955 }); |
|
956 |
2985 /** |
957 /** |
2986 * |
958 * |
2987 * @param {Object} state Global application state. |
959 * @param {Object} state Global application state. |
2988 * @param {string} preferenceKey Preference Key. |
960 * @param {string} preferenceKey Preference Key. |
2989 * @param {*} defaultValue Default Value. |
961 * @param {*} defaultValue Default Value. |
2990 * |
962 * |
2991 * @return {*} Preference Value. |
963 * @return {*} Preference Value. |
2992 */ |
964 */ |
2993 |
|
2994 function getPreference(state, preferenceKey, defaultValue) { |
965 function getPreference(state, preferenceKey, defaultValue) { |
2995 external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreference`, { |
966 external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreference`, { |
2996 since: '6.0', |
967 since: '6.0', |
2997 alternative: `select( 'core/preferences' ).get` |
968 alternative: `select( 'core/preferences' ).get` |
2998 }); // Avoid using the `getPreferences` registry selector where possible. |
969 }); |
2999 |
970 |
|
971 // Avoid using the `getPreferences` registry selector where possible. |
3000 const preferences = getPreferences(state); |
972 const preferences = getPreferences(state); |
3001 const value = preferences[preferenceKey]; |
973 const value = preferences[preferenceKey]; |
3002 return value === undefined ? defaultValue : value; |
974 return value === undefined ? defaultValue : value; |
3003 } |
975 } |
|
976 |
3004 /** |
977 /** |
3005 * Returns an array of blocks that are hidden. |
978 * Returns an array of blocks that are hidden. |
3006 * |
979 * |
3007 * @return {Array} A list of the hidden block types |
980 * @return {Array} A list of the hidden block types |
3008 */ |
981 */ |
3009 |
|
3010 const getHiddenBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
982 const getHiddenBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
3011 var _select$get2; |
983 var _select$get2; |
3012 |
984 return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY; |
3013 return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY; |
|
3014 }); |
985 }); |
|
986 |
3015 /** |
987 /** |
3016 * Returns true if the publish sidebar is opened. |
988 * Returns true if the publish sidebar is opened. |
3017 * |
989 * |
|
990 * @deprecated |
|
991 * |
3018 * @param {Object} state Global application state |
992 * @param {Object} state Global application state |
3019 * |
993 * |
3020 * @return {boolean} Whether the publish sidebar is open. |
994 * @return {boolean} Whether the publish sidebar is open. |
3021 */ |
995 */ |
3022 |
996 const isPublishSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
3023 function isPublishSidebarOpened(state) { |
997 external_wp_deprecated_default()(`select( 'core/edit-post' ).isPublishSidebarOpened`, { |
3024 return state.publishSidebarActive; |
998 since: '6.6', |
3025 } |
999 alternative: `select( 'core/editor' ).isPublishSidebarOpened` |
|
1000 }); |
|
1001 return select(external_wp_editor_namespaceObject.store).isPublishSidebarOpened(); |
|
1002 }); |
|
1003 |
3026 /** |
1004 /** |
3027 * Returns true if the given panel was programmatically removed, or false otherwise. |
1005 * Returns true if the given panel was programmatically removed, or false otherwise. |
3028 * All panels are not removed by default. |
1006 * All panels are not removed by default. |
3029 * |
1007 * |
|
1008 * @deprecated |
|
1009 * |
3030 * @param {Object} state Global application state. |
1010 * @param {Object} state Global application state. |
3031 * @param {string} panelName A string that identifies the panel. |
1011 * @param {string} panelName A string that identifies the panel. |
3032 * |
1012 * |
3033 * @return {boolean} Whether or not the panel is removed. |
1013 * @return {boolean} Whether or not the panel is removed. |
3034 */ |
1014 */ |
3035 |
1015 const isEditorPanelRemoved = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { |
3036 function isEditorPanelRemoved(state, panelName) { |
1016 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelRemoved`, { |
3037 return (0,external_lodash_namespaceObject.includes)(state.removedPanels, panelName); |
1017 since: '6.5', |
3038 } |
1018 alternative: `select( 'core/editor' ).isEditorPanelRemoved` |
|
1019 }); |
|
1020 return select(external_wp_editor_namespaceObject.store).isEditorPanelRemoved(panelName); |
|
1021 }); |
|
1022 |
3039 /** |
1023 /** |
3040 * Returns true if the given panel is enabled, or false otherwise. Panels are |
1024 * Returns true if the given panel is enabled, or false otherwise. Panels are |
3041 * enabled by default. |
1025 * enabled by default. |
3042 * |
1026 * |
|
1027 * @deprecated |
|
1028 * |
3043 * @param {Object} state Global application state. |
1029 * @param {Object} state Global application state. |
3044 * @param {string} panelName A string that identifies the panel. |
1030 * @param {string} panelName A string that identifies the panel. |
3045 * |
1031 * |
3046 * @return {boolean} Whether or not the panel is enabled. |
1032 * @return {boolean} Whether or not the panel is enabled. |
3047 */ |
1033 */ |
3048 |
|
3049 const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { |
1034 const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { |
3050 const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels'); |
1035 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelEnabled`, { |
3051 return !isEditorPanelRemoved(state, panelName) && !(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName)); |
1036 since: '6.5', |
|
1037 alternative: `select( 'core/editor' ).isEditorPanelEnabled` |
|
1038 }); |
|
1039 return select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(panelName); |
3052 }); |
1040 }); |
|
1041 |
3053 /** |
1042 /** |
3054 * Returns true if the given panel is open, or false otherwise. Panels are |
1043 * Returns true if the given panel is open, or false otherwise. Panels are |
3055 * closed by default. |
1044 * closed by default. |
3056 * |
1045 * |
|
1046 * @deprecated |
|
1047 * |
3057 * @param {Object} state Global application state. |
1048 * @param {Object} state Global application state. |
3058 * @param {string} panelName A string that identifies the panel. |
1049 * @param {string} panelName A string that identifies the panel. |
3059 * |
1050 * |
3060 * @return {boolean} Whether or not the panel is open. |
1051 * @return {boolean} Whether or not the panel is open. |
3061 */ |
1052 */ |
3062 |
|
3063 const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { |
1053 const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { |
3064 const openPanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels'); |
1054 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelOpened`, { |
3065 return !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName)); |
1055 since: '6.5', |
|
1056 alternative: `select( 'core/editor' ).isEditorPanelOpened` |
|
1057 }); |
|
1058 return select(external_wp_editor_namespaceObject.store).isEditorPanelOpened(panelName); |
3066 }); |
1059 }); |
|
1060 |
3067 /** |
1061 /** |
3068 * Returns true if a modal is active, or false otherwise. |
1062 * Returns true if a modal is active, or false otherwise. |
|
1063 * |
|
1064 * @deprecated since WP 6.3 use `core/interface` store's selector with the same name instead. |
3069 * |
1065 * |
3070 * @param {Object} state Global application state. |
1066 * @param {Object} state Global application state. |
3071 * @param {string} modalName A string that uniquely identifies the modal. |
1067 * @param {string} modalName A string that uniquely identifies the modal. |
3072 * |
1068 * |
3073 * @return {boolean} Whether the modal is active. |
1069 * @return {boolean} Whether the modal is active. |
3074 */ |
1070 */ |
3075 |
1071 const isModalActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, modalName) => { |
3076 function isModalActive(state, modalName) { |
1072 external_wp_deprecated_default()(`select( 'core/edit-post' ).isModalActive`, { |
3077 return state.activeModal === modalName; |
1073 since: '6.3', |
3078 } |
1074 alternative: `select( 'core/interface' ).isModalActive` |
|
1075 }); |
|
1076 return !!select(selectors_interfaceStore).isModalActive(modalName); |
|
1077 }); |
|
1078 |
3079 /** |
1079 /** |
3080 * Returns whether the given feature is enabled or not. |
1080 * Returns whether the given feature is enabled or not. |
3081 * |
1081 * |
3082 * @param {Object} state Global application state. |
1082 * @param {Object} state Global application state. |
3083 * @param {string} feature Feature slug. |
1083 * @param {string} feature Feature slug. |
3084 * |
1084 * |
3085 * @return {boolean} Is active. |
1085 * @return {boolean} Is active. |
3086 */ |
1086 */ |
3087 |
1087 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, feature) => { |
3088 const selectors_isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, feature) => { |
|
3089 return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', feature); |
1088 return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', feature); |
3090 }); |
1089 }); |
|
1090 |
3091 /** |
1091 /** |
3092 * Returns true if the plugin item is pinned to the header. |
1092 * Returns true if the plugin item is pinned to the header. |
3093 * When the value is not set it defaults to true. |
1093 * When the value is not set it defaults to true. |
3094 * |
1094 * |
3095 * @param {Object} state Global application state. |
1095 * @param {Object} state Global application state. |
3096 * @param {string} pluginName Plugin item name. |
1096 * @param {string} pluginName Plugin item name. |
3097 * |
1097 * |
3098 * @return {boolean} Whether the plugin item is pinned. |
1098 * @return {boolean} Whether the plugin item is pinned. |
3099 */ |
1099 */ |
3100 |
|
3101 const isPluginItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, pluginName) => { |
1100 const isPluginItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, pluginName) => { |
3102 return select(store).isItemPinned('core/edit-post', pluginName); |
1101 return select(selectors_interfaceStore).isItemPinned('core', pluginName); |
3103 }); |
1102 }); |
|
1103 |
3104 /** |
1104 /** |
3105 * Returns an array of active meta box locations. |
1105 * Returns an array of active meta box locations. |
3106 * |
1106 * |
3107 * @param {Object} state Post editor state. |
1107 * @param {Object} state Post editor state. |
3108 * |
1108 * |
3109 * @return {string[]} Active meta box locations. |
1109 * @return {string[]} Active meta box locations. |
3110 */ |
1110 */ |
3111 |
1111 const getActiveMetaBoxLocations = (0,external_wp_data_namespaceObject.createSelector)(state => { |
3112 const getActiveMetaBoxLocations = rememo(state => { |
|
3113 return Object.keys(state.metaBoxes.locations).filter(location => isMetaBoxLocationActive(state, location)); |
1112 return Object.keys(state.metaBoxes.locations).filter(location => isMetaBoxLocationActive(state, location)); |
3114 }, state => [state.metaBoxes.locations]); |
1113 }, state => [state.metaBoxes.locations]); |
|
1114 |
3115 /** |
1115 /** |
3116 * Returns true if a metabox location is active and visible |
1116 * Returns true if a metabox location is active and visible |
3117 * |
1117 * |
3118 * @param {Object} state Post editor state. |
1118 * @param {Object} state Post editor state. |
3119 * @param {string} location Meta box location to test. |
1119 * @param {string} location Meta box location to test. |
3120 * |
1120 * |
3121 * @return {boolean} Whether the meta box location is active and visible. |
1121 * @return {boolean} Whether the meta box location is active and visible. |
3122 */ |
1122 */ |
3123 |
1123 const isMetaBoxLocationVisible = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, location) => { |
3124 function isMetaBoxLocationVisible(state, location) { |
1124 return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({ |
3125 return isMetaBoxLocationActive(state, location) && (0,external_lodash_namespaceObject.some)(getMetaBoxesPerLocation(state, location), _ref2 => { |
1125 id |
3126 let { |
1126 }) => { |
3127 id |
1127 return select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(state, `meta-box-${id}`); |
3128 } = _ref2; |
1128 }); |
3129 return isEditorPanelEnabled(state, `meta-box-${id}`); |
1129 }); |
3130 }); |
1130 |
3131 } |
|
3132 /** |
1131 /** |
3133 * Returns true if there is an active meta box in the given location, or false |
1132 * Returns true if there is an active meta box in the given location, or false |
3134 * otherwise. |
1133 * otherwise. |
3135 * |
1134 * |
3136 * @param {Object} state Post editor state. |
1135 * @param {Object} state Post editor state. |
3137 * @param {string} location Meta box location to test. |
1136 * @param {string} location Meta box location to test. |
3138 * |
1137 * |
3139 * @return {boolean} Whether the meta box location is active. |
1138 * @return {boolean} Whether the meta box location is active. |
3140 */ |
1139 */ |
3141 |
|
3142 function isMetaBoxLocationActive(state, location) { |
1140 function isMetaBoxLocationActive(state, location) { |
3143 const metaBoxes = getMetaBoxesPerLocation(state, location); |
1141 const metaBoxes = getMetaBoxesPerLocation(state, location); |
3144 return !!metaBoxes && metaBoxes.length !== 0; |
1142 return !!metaBoxes && metaBoxes.length !== 0; |
3145 } |
1143 } |
|
1144 |
3146 /** |
1145 /** |
3147 * Returns the list of all the available meta boxes for a given location. |
1146 * Returns the list of all the available meta boxes for a given location. |
3148 * |
1147 * |
3149 * @param {Object} state Global application state. |
1148 * @param {Object} state Global application state. |
3150 * @param {string} location Meta box location to test. |
1149 * @param {string} location Meta box location to test. |
3151 * |
1150 * |
3152 * @return {?Array} List of meta boxes. |
1151 * @return {?Array} List of meta boxes. |
3153 */ |
1152 */ |
3154 |
|
3155 function getMetaBoxesPerLocation(state, location) { |
1153 function getMetaBoxesPerLocation(state, location) { |
3156 return state.metaBoxes.locations[location]; |
1154 return state.metaBoxes.locations[location]; |
3157 } |
1155 } |
|
1156 |
3158 /** |
1157 /** |
3159 * Returns the list of all the available meta boxes. |
1158 * Returns the list of all the available meta boxes. |
3160 * |
1159 * |
3161 * @param {Object} state Global application state. |
1160 * @param {Object} state Global application state. |
3162 * |
1161 * |
3163 * @return {Array} List of meta boxes. |
1162 * @return {Array} List of meta boxes. |
3164 */ |
1163 */ |
3165 |
1164 const getAllMetaBoxes = (0,external_wp_data_namespaceObject.createSelector)(state => { |
3166 const getAllMetaBoxes = rememo(state => { |
1165 return Object.values(state.metaBoxes.locations).flat(); |
3167 return (0,external_lodash_namespaceObject.flatten)((0,external_lodash_namespaceObject.values)(state.metaBoxes.locations)); |
|
3168 }, state => [state.metaBoxes.locations]); |
1166 }, state => [state.metaBoxes.locations]); |
|
1167 |
3169 /** |
1168 /** |
3170 * Returns true if the post is using Meta Boxes |
1169 * Returns true if the post is using Meta Boxes |
3171 * |
1170 * |
3172 * @param {Object} state Global application state |
1171 * @param {Object} state Global application state |
3173 * |
1172 * |
3174 * @return {boolean} Whether there are metaboxes or not. |
1173 * @return {boolean} Whether there are metaboxes or not. |
3175 */ |
1174 */ |
3176 |
|
3177 function hasMetaBoxes(state) { |
1175 function hasMetaBoxes(state) { |
3178 return getActiveMetaBoxLocations(state).length > 0; |
1176 return getActiveMetaBoxLocations(state).length > 0; |
3179 } |
1177 } |
|
1178 |
3180 /** |
1179 /** |
3181 * Returns true if the Meta Boxes are being saved. |
1180 * Returns true if the Meta Boxes are being saved. |
3182 * |
1181 * |
3183 * @param {Object} state Global application state. |
1182 * @param {Object} state Global application state. |
3184 * |
1183 * |
3185 * @return {boolean} Whether the metaboxes are being saved. |
1184 * @return {boolean} Whether the metaboxes are being saved. |
3186 */ |
1185 */ |
3187 |
|
3188 function selectors_isSavingMetaBoxes(state) { |
1186 function selectors_isSavingMetaBoxes(state) { |
3189 return state.metaBoxes.isSaving; |
1187 return state.metaBoxes.isSaving; |
3190 } |
1188 } |
|
1189 |
3191 /** |
1190 /** |
3192 * Returns the current editing canvas device type. |
1191 * Returns the current editing canvas device type. |
3193 * |
1192 * |
|
1193 * @deprecated |
|
1194 * |
3194 * @param {Object} state Global application state. |
1195 * @param {Object} state Global application state. |
3195 * |
1196 * |
3196 * @return {string} Device type. |
1197 * @return {string} Device type. |
3197 */ |
1198 */ |
3198 |
1199 const __experimentalGetPreviewDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
3199 function __experimentalGetPreviewDeviceType(state) { |
1200 external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, { |
3200 return state.deviceType; |
1201 since: '6.5', |
3201 } |
1202 version: '6.7', |
|
1203 alternative: `select( 'core/editor' ).getDeviceType` |
|
1204 }); |
|
1205 return select(external_wp_editor_namespaceObject.store).getDeviceType(); |
|
1206 }); |
|
1207 |
3202 /** |
1208 /** |
3203 * Returns true if the inserter is opened. |
1209 * Returns true if the inserter is opened. |
3204 * |
1210 * |
|
1211 * @deprecated |
|
1212 * |
3205 * @param {Object} state Global application state. |
1213 * @param {Object} state Global application state. |
3206 * |
1214 * |
3207 * @return {boolean} Whether the inserter is opened. |
1215 * @return {boolean} Whether the inserter is opened. |
3208 */ |
1216 */ |
3209 |
1217 const isInserterOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
3210 function isInserterOpened(state) { |
1218 external_wp_deprecated_default()(`select( 'core/edit-post' ).isInserterOpened`, { |
3211 return !!state.blockInserterPanel; |
1219 since: '6.5', |
3212 } |
1220 alternative: `select( 'core/editor' ).isInserterOpened` |
|
1221 }); |
|
1222 return select(external_wp_editor_namespaceObject.store).isInserterOpened(); |
|
1223 }); |
|
1224 |
3213 /** |
1225 /** |
3214 * Get the insertion point for the inserter. |
1226 * Get the insertion point for the inserter. |
3215 * |
1227 * |
|
1228 * @deprecated |
|
1229 * |
3216 * @param {Object} state Global application state. |
1230 * @param {Object} state Global application state. |
3217 * |
1231 * |
3218 * @return {Object} The root client ID, index to insert at and starting filter value. |
1232 * @return {Object} The root client ID, index to insert at and starting filter value. |
3219 */ |
1233 */ |
3220 |
1234 const __experimentalGetInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
3221 function __experimentalGetInsertionPoint(state) { |
1235 external_wp_deprecated_default()(`select( 'core/edit-post' ).__experimentalGetInsertionPoint`, { |
3222 const { |
1236 since: '6.5', |
3223 rootClientId, |
1237 version: '6.7' |
3224 insertionIndex, |
1238 }); |
3225 filterValue |
1239 return unlock(select(external_wp_editor_namespaceObject.store)).getInsertionPoint(); |
3226 } = state.blockInserterPanel; |
1240 }); |
3227 return { |
1241 |
3228 rootClientId, |
|
3229 insertionIndex, |
|
3230 filterValue |
|
3231 }; |
|
3232 } |
|
3233 /** |
1242 /** |
3234 * Returns true if the list view is opened. |
1243 * Returns true if the list view is opened. |
3235 * |
1244 * |
3236 * @param {Object} state Global application state. |
1245 * @param {Object} state Global application state. |
3237 * |
1246 * |
3238 * @return {boolean} Whether the list view is opened. |
1247 * @return {boolean} Whether the list view is opened. |
3239 */ |
1248 */ |
3240 |
1249 const isListViewOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
3241 function isListViewOpened(state) { |
1250 external_wp_deprecated_default()(`select( 'core/edit-post' ).isListViewOpened`, { |
3242 return state.listViewPanel; |
1251 since: '6.5', |
3243 } |
1252 alternative: `select( 'core/editor' ).isListViewOpened` |
|
1253 }); |
|
1254 return select(external_wp_editor_namespaceObject.store).isListViewOpened(); |
|
1255 }); |
|
1256 |
3244 /** |
1257 /** |
3245 * Returns true if the template editing mode is enabled. |
1258 * Returns true if the template editing mode is enabled. |
3246 * |
1259 * |
|
1260 * @deprecated |
|
1261 */ |
|
1262 const isEditingTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
|
1263 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditingTemplate`, { |
|
1264 since: '6.5', |
|
1265 alternative: `select( 'core/editor' ).getRenderingMode` |
|
1266 }); |
|
1267 return select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template'; |
|
1268 }); |
|
1269 |
|
1270 /** |
|
1271 * Returns true if meta boxes are initialized. |
|
1272 * |
3247 * @param {Object} state Global application state. |
1273 * @param {Object} state Global application state. |
3248 * |
1274 * |
3249 * @return {boolean} Whether we're editing the template. |
|
3250 */ |
|
3251 |
|
3252 function selectors_isEditingTemplate(state) { |
|
3253 return state.isEditingTemplate; |
|
3254 } |
|
3255 /** |
|
3256 * Returns true if meta boxes are initialized. |
|
3257 * |
|
3258 * @param {Object} state Global application state. |
|
3259 * |
|
3260 * @return {boolean} Whether meta boxes are initialized. |
1275 * @return {boolean} Whether meta boxes are initialized. |
3261 */ |
1276 */ |
3262 |
|
3263 function areMetaBoxesInitialized(state) { |
1277 function areMetaBoxesInitialized(state) { |
3264 return state.metaBoxes.initialized; |
1278 return state.metaBoxes.initialized; |
3265 } |
1279 } |
|
1280 |
3266 /** |
1281 /** |
3267 * Retrieves the template of the currently edited post. |
1282 * Retrieves the template of the currently edited post. |
3268 * |
1283 * |
3269 * @return {Object?} Post Template. |
1284 * @return {Object?} Post Template. |
3270 */ |
1285 */ |
3271 |
|
3272 const getEditedPostTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
1286 const getEditedPostTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
|
1287 const { |
|
1288 id: postId, |
|
1289 type: postType, |
|
1290 slug |
|
1291 } = select(external_wp_editor_namespaceObject.store).getCurrentPost(); |
|
1292 const { |
|
1293 getSite, |
|
1294 getEditedEntityRecord, |
|
1295 getEntityRecords |
|
1296 } = select(external_wp_coreData_namespaceObject.store); |
|
1297 const siteSettings = getSite(); |
|
1298 // First check if the current page is set as the posts page. |
|
1299 const isPostsPage = +postId === siteSettings?.page_for_posts; |
|
1300 if (isPostsPage) { |
|
1301 const defaultTemplateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ |
|
1302 slug: 'home' |
|
1303 }); |
|
1304 return getEditedEntityRecord('postType', 'wp_template', defaultTemplateId); |
|
1305 } |
3273 const currentTemplate = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template'); |
1306 const currentTemplate = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template'); |
3274 |
|
3275 if (currentTemplate) { |
1307 if (currentTemplate) { |
3276 var _select$getEntityReco; |
1308 const templateWithSameSlug = getEntityRecords('postType', 'wp_template', { |
3277 |
|
3278 const templateWithSameSlug = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { |
|
3279 per_page: -1 |
1309 per_page: -1 |
3280 })) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.find(template => template.slug === currentTemplate); |
1310 })?.find(template => template.slug === currentTemplate); |
3281 |
|
3282 if (!templateWithSameSlug) { |
1311 if (!templateWithSameSlug) { |
3283 return templateWithSameSlug; |
1312 return templateWithSameSlug; |
3284 } |
1313 } |
3285 |
1314 return getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id); |
3286 return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id); |
1315 } |
3287 } |
1316 let slugToCheck; |
3288 |
1317 // In `draft` status we might not have a slug available, so we use the `single` |
3289 const post = select(external_wp_editor_namespaceObject.store).getCurrentPost(); |
1318 // post type templates slug(ex page, single-post, single-product etc..). |
3290 |
1319 // Pages do not need the `single` prefix in the slug to be prioritized |
3291 if (post.link) { |
1320 // through template hierarchy. |
3292 return select(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(post.link); |
1321 if (slug) { |
3293 } |
1322 slugToCheck = postType === 'page' ? `${postType}-${slug}` : `single-${postType}-${slug}`; |
3294 |
1323 } else { |
3295 return null; |
1324 slugToCheck = postType === 'page' ? 'page' : `single-${postType}`; |
|
1325 } |
|
1326 const defaultTemplateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ |
|
1327 slug: slugToCheck |
|
1328 }); |
|
1329 return defaultTemplateId ? select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', defaultTemplateId) : null; |
3296 }); |
1330 }); |
3297 |
1331 |
3298 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/constants.js |
1332 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/constants.js |
3299 /** |
1333 /** |
3300 * The identifier for the data store. |
1334 * The identifier for the data store. |
3301 * |
1335 * |
3302 * @type {string} |
1336 * @type {string} |
3303 */ |
1337 */ |
3304 const constants_STORE_NAME = 'core/edit-post'; |
1338 const STORE_NAME = 'core/edit-post'; |
|
1339 |
3305 /** |
1340 /** |
3306 * CSS selector string for the admin bar view post link anchor tag. |
1341 * CSS selector string for the admin bar view post link anchor tag. |
3307 * |
1342 * |
3308 * @type {string} |
1343 * @type {string} |
3309 */ |
1344 */ |
3310 |
|
3311 const VIEW_AS_LINK_SELECTOR = '#wp-admin-bar-view a'; |
1345 const VIEW_AS_LINK_SELECTOR = '#wp-admin-bar-view a'; |
|
1346 |
3312 /** |
1347 /** |
3313 * CSS selector string for the admin bar preview post link anchor tag. |
1348 * CSS selector string for the admin bar preview post link anchor tag. |
3314 * |
1349 * |
3315 * @type {string} |
1350 * @type {string} |
3316 */ |
1351 */ |
3317 |
|
3318 const VIEW_AS_PREVIEW_LINK_SELECTOR = '#wp-admin-bar-preview a'; |
1352 const VIEW_AS_PREVIEW_LINK_SELECTOR = '#wp-admin-bar-preview a'; |
3319 |
1353 |
3320 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/index.js |
1354 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/index.js |
3321 /** |
1355 /** |
3322 * WordPress dependencies |
1356 * WordPress dependencies |
3323 */ |
1357 */ |
3324 |
1358 |
|
1359 |
3325 /** |
1360 /** |
3326 * Internal dependencies |
1361 * Internal dependencies |
3327 */ |
1362 */ |
3328 |
1363 |
3329 |
1364 |
3335 * |
1370 * |
3336 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
1371 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
3337 * |
1372 * |
3338 * @type {Object} |
1373 * @type {Object} |
3339 */ |
1374 */ |
3340 |
1375 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { |
3341 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { |
|
3342 reducer: reducer, |
1376 reducer: reducer, |
3343 actions: store_actions_namespaceObject, |
1377 actions: actions_namespaceObject, |
3344 selectors: store_selectors_namespaceObject |
1378 selectors: selectors_namespaceObject |
3345 }); |
1379 }); |
3346 (0,external_wp_data_namespaceObject.register)(store_store); |
1380 (0,external_wp_data_namespaceObject.register)(store); |
3347 |
1381 |
3348 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js |
1382 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/back-button/fullscreen-mode-close.js |
|
1383 /** |
|
1384 * External dependencies |
|
1385 */ |
3349 |
1386 |
3350 |
1387 |
3351 /** |
1388 /** |
3352 * WordPress dependencies |
1389 * WordPress dependencies |
3353 */ |
1390 */ |
3354 |
1391 |
3355 |
1392 |
3356 |
1393 |
3357 |
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
3358 /** |
1400 /** |
3359 * Internal dependencies |
1401 * Internal dependencies |
3360 */ |
1402 */ |
3361 |
1403 |
3362 |
1404 |
3363 function KeyboardShortcutsHelpMenuItem(_ref) { |
1405 function FullscreenModeClose({ |
3364 let { |
1406 showTooltip, |
3365 openModal |
1407 icon, |
3366 } = _ref; |
1408 href, |
3367 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
1409 initialPost |
3368 onClick: () => { |
1410 }) { |
3369 openModal('edit-post/keyboard-shortcut-help'); |
1411 var _postType$labels$view; |
3370 }, |
|
3371 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h') |
|
3372 }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')); |
|
3373 } |
|
3374 /* harmony default export */ var keyboard_shortcuts_help_menu_item = ((0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
|
3375 const { |
1412 const { |
3376 openModal |
1413 isActive, |
3377 } = dispatch(store_store); |
1414 isRequestingSiteIcon, |
3378 return { |
1415 postType, |
3379 openModal |
1416 siteIconUrl |
3380 }; |
|
3381 })(KeyboardShortcutsHelpMenuItem)); |
|
3382 |
|
3383 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/tools-more-menu-group/index.js |
|
3384 |
|
3385 |
|
3386 /** |
|
3387 * External dependencies |
|
3388 */ |
|
3389 |
|
3390 /** |
|
3391 * WordPress dependencies |
|
3392 */ |
|
3393 |
|
3394 |
|
3395 |
|
3396 const { |
|
3397 Fill: ToolsMoreMenuGroup, |
|
3398 Slot |
|
3399 } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup'); |
|
3400 |
|
3401 ToolsMoreMenuGroup.Slot = _ref => { |
|
3402 let { |
|
3403 fillProps |
|
3404 } = _ref; |
|
3405 return (0,external_wp_element_namespaceObject.createElement)(Slot, { |
|
3406 fillProps: fillProps |
|
3407 }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
3408 label: (0,external_wp_i18n_namespaceObject.__)('Tools') |
|
3409 }, fills)); |
|
3410 }; |
|
3411 |
|
3412 /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup); |
|
3413 |
|
3414 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/welcome-guide-menu-item/index.js |
|
3415 |
|
3416 |
|
3417 /** |
|
3418 * WordPress dependencies |
|
3419 */ |
|
3420 |
|
3421 |
|
3422 |
|
3423 /** |
|
3424 * Internal dependencies |
|
3425 */ |
|
3426 |
|
3427 |
|
3428 function WelcomeGuideMenuItem() { |
|
3429 const isTemplateMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isEditingTemplate(), []); |
|
3430 return (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { |
|
3431 scope: "core/edit-post", |
|
3432 name: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide', |
|
3433 label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') |
|
3434 }); |
|
3435 } |
|
3436 |
|
3437 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/index.js |
|
3438 |
|
3439 |
|
3440 /** |
|
3441 * WordPress dependencies |
|
3442 */ |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 /** |
|
3449 * Internal dependencies |
|
3450 */ |
|
3451 |
|
3452 |
|
3453 |
|
3454 |
|
3455 |
|
3456 (0,external_wp_plugins_namespaceObject.registerPlugin)('edit-post', { |
|
3457 render() { |
|
3458 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group, null, _ref => { |
|
3459 let { |
|
3460 onClose |
|
3461 } = _ref; |
|
3462 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
3463 role: "menuitem", |
|
3464 href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { |
|
3465 post_type: 'wp_block' |
|
3466 }) |
|
3467 }, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks')), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts_help_menu_item, { |
|
3468 onSelect: onClose |
|
3469 }), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
3470 role: "menuitem", |
|
3471 icon: library_external, |
|
3472 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/'), |
|
3473 target: "_blank", |
|
3474 rel: "noopener noreferrer" |
|
3475 }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
|
3476 as: "span" |
|
3477 }, |
|
3478 /* translators: accessibility text */ |
|
3479 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))); |
|
3480 })); |
|
3481 } |
|
3482 |
|
3483 }); |
|
3484 |
|
3485 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] |
|
3486 var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; |
|
3487 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/text-editor/index.js |
|
3488 |
|
3489 |
|
3490 /** |
|
3491 * WordPress dependencies |
|
3492 */ |
|
3493 |
|
3494 |
|
3495 |
|
3496 |
|
3497 |
|
3498 |
|
3499 /** |
|
3500 * Internal dependencies |
|
3501 */ |
|
3502 |
|
3503 |
|
3504 |
|
3505 function TextEditor(_ref) { |
|
3506 let { |
|
3507 onExit, |
|
3508 isRichEditingEnabled |
|
3509 } = _ref; |
|
3510 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
3511 className: "edit-post-text-editor" |
|
3512 }, isRichEditingEnabled && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
3513 className: "edit-post-text-editor__toolbar" |
|
3514 }, (0,external_wp_element_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
3515 variant: "tertiary", |
|
3516 onClick: onExit, |
|
3517 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('m') |
|
3518 }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor')), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.TextEditorGlobalKeyboardShortcuts, null)), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
3519 className: "edit-post-text-editor__body" |
|
3520 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTextEditor, null))); |
|
3521 } |
|
3522 |
|
3523 /* harmony default export */ var text_editor = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({ |
|
3524 isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled |
|
3525 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
|
3526 return { |
|
3527 onExit() { |
|
3528 dispatch(store_store).switchEditorMode('visual'); |
|
3529 } |
|
3530 |
|
3531 }; |
|
3532 }))(TextEditor)); |
|
3533 |
|
3534 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js |
|
3535 |
|
3536 |
|
3537 /** |
|
3538 * WordPress dependencies |
|
3539 */ |
|
3540 |
|
3541 const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
3542 xmlns: "http://www.w3.org/2000/svg", |
|
3543 viewBox: "0 0 24 24" |
|
3544 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
3545 d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z" |
|
3546 })); |
|
3547 /* harmony default export */ var arrow_left = (arrowLeft); |
|
3548 |
|
3549 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/block-inspector-button.js |
|
3550 |
|
3551 |
|
3552 /** |
|
3553 * External dependencies |
|
3554 */ |
|
3555 |
|
3556 /** |
|
3557 * WordPress dependencies |
|
3558 */ |
|
3559 |
|
3560 |
|
3561 |
|
3562 |
|
3563 |
|
3564 |
|
3565 /** |
|
3566 * Internal dependencies |
|
3567 */ |
|
3568 |
|
3569 |
|
3570 function BlockInspectorButton(_ref) { |
|
3571 let { |
|
3572 onClick = external_lodash_namespaceObject.noop, |
|
3573 small = false |
|
3574 } = _ref; |
|
3575 const { |
|
3576 shortcut, |
|
3577 areAdvancedSettingsOpened |
|
3578 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
3579 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'), |
|
3580 areAdvancedSettingsOpened: select(store_store).getActiveGeneralSidebarName() === 'edit-post/block' |
|
3581 }), []); |
|
3582 const { |
|
3583 openGeneralSidebar, |
|
3584 closeGeneralSidebar |
|
3585 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
3586 const label = areAdvancedSettingsOpened ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings'); |
|
3587 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
3588 onClick: () => { |
|
3589 if (areAdvancedSettingsOpened) { |
|
3590 closeGeneralSidebar(); |
|
3591 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed')); |
|
3592 } else { |
|
3593 openGeneralSidebar('edit-post/block'); |
|
3594 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar')); |
|
3595 } |
|
3596 |
|
3597 onClick(); |
|
3598 }, |
|
3599 shortcut: shortcut |
|
3600 }, !small && label); |
|
3601 } |
|
3602 /* harmony default export */ var block_inspector_button = (BlockInspectorButton); |
|
3603 |
|
3604 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/index.js |
|
3605 |
|
3606 |
|
3607 /** |
|
3608 * External dependencies |
|
3609 */ |
|
3610 |
|
3611 /** |
|
3612 * WordPress dependencies |
|
3613 */ |
|
3614 |
|
3615 |
|
3616 |
|
3617 |
|
3618 |
|
3619 |
|
3620 |
|
3621 |
|
3622 |
|
3623 /** |
|
3624 * Internal dependencies |
|
3625 */ |
|
3626 |
|
3627 |
|
3628 |
|
3629 |
|
3630 function MaybeIframe(_ref) { |
|
3631 let { |
|
3632 children, |
|
3633 contentRef, |
|
3634 shouldIframe, |
|
3635 styles, |
|
3636 assets, |
|
3637 style |
|
3638 } = _ref; |
|
3639 const ref = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)(); |
|
3640 |
|
3641 if (!shouldIframe) { |
|
3642 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { |
|
3643 styles: styles |
|
3644 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, { |
|
3645 ref: contentRef, |
|
3646 className: "editor-styles-wrapper", |
|
3647 style: { |
|
3648 flex: '1', |
|
3649 ...style |
|
3650 }, |
|
3651 tabIndex: -1 |
|
3652 }, children)); |
|
3653 } |
|
3654 |
|
3655 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, { |
|
3656 head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, { |
|
3657 styles: styles |
|
3658 }), |
|
3659 assets: assets, |
|
3660 ref: ref, |
|
3661 contentRef: contentRef, |
|
3662 style: { |
|
3663 width: '100%', |
|
3664 height: '100%', |
|
3665 display: 'block' |
|
3666 }, |
|
3667 name: "editor-canvas" |
|
3668 }, children); |
|
3669 } |
|
3670 |
|
3671 function VisualEditor(_ref2) { |
|
3672 let { |
|
3673 styles |
|
3674 } = _ref2; |
|
3675 const { |
|
3676 deviceType, |
|
3677 isTemplateMode, |
|
3678 wrapperBlockName, |
|
3679 wrapperUniqueId |
|
3680 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
1417 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
3681 const { |
1418 const { |
3682 isEditingTemplate, |
|
3683 __experimentalGetPreviewDeviceType |
|
3684 } = select(store_store); |
|
3685 const { |
|
3686 getCurrentPostId, |
|
3687 getCurrentPostType |
1419 getCurrentPostType |
3688 } = select(external_wp_editor_namespaceObject.store); |
1420 } = select(external_wp_editor_namespaceObject.store); |
3689 |
1421 const { |
3690 const _isTemplateMode = isEditingTemplate(); |
1422 isFeatureActive |
3691 |
1423 } = select(store); |
3692 let _wrapperBlockName; |
1424 const { |
3693 |
1425 getEntityRecord, |
3694 if (getCurrentPostType() === 'wp_block') { |
1426 getPostType, |
3695 _wrapperBlockName = 'core/block'; |
1427 isResolving |
3696 } else if (!_isTemplateMode) { |
1428 } = select(external_wp_coreData_namespaceObject.store); |
3697 _wrapperBlockName = 'core/post-content'; |
1429 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; |
3698 } |
1430 const _postType = initialPost?.type || getCurrentPostType(); |
3699 |
|
3700 return { |
1431 return { |
3701 deviceType: __experimentalGetPreviewDeviceType(), |
1432 isActive: isFeatureActive('fullscreenMode'), |
3702 isTemplateMode: _isTemplateMode, |
1433 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), |
3703 wrapperBlockName: _wrapperBlockName, |
1434 postType: getPostType(_postType), |
3704 wrapperUniqueId: getCurrentPostId() |
1435 siteIconUrl: siteData.site_icon_url |
3705 }; |
1436 }; |
3706 }, []); |
1437 }, []); |
3707 const hasMetaBoxes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasMetaBoxes(), []); |
1438 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); |
3708 const { |
1439 if (!isActive || !postType) { |
3709 themeSupportsLayout, |
1440 return null; |
3710 assets |
1441 } |
3711 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
1442 let buttonIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { |
3712 const _settings = select(external_wp_blockEditor_namespaceObject.store).getSettings(); |
1443 size: "36px", |
3713 |
1444 icon: library_wordpress |
3714 return { |
1445 }); |
3715 themeSupportsLayout: _settings.supportsLayout, |
1446 const effect = { |
3716 assets: _settings.__unstableResolvedAssets |
1447 expand: { |
3717 }; |
1448 scale: 1.25, |
3718 }, []); |
1449 transition: { |
3719 const { |
1450 type: 'tween', |
3720 clearSelectedBlock |
1451 duration: '0.3' |
3721 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
1452 } |
3722 const { |
1453 } |
3723 setIsEditingTemplate |
|
3724 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
3725 const desktopCanvasStyles = { |
|
3726 height: '100%', |
|
3727 width: '100%', |
|
3728 margin: 0, |
|
3729 display: 'flex', |
|
3730 flexFlow: 'column', |
|
3731 // Default background color so that grey |
|
3732 // .edit-post-editor-regions__content color doesn't show through. |
|
3733 background: 'white' |
|
3734 }; |
1454 }; |
3735 const templateModeStyles = { ...desktopCanvasStyles, |
1455 if (siteIconUrl) { |
3736 borderRadius: '2px 2px 0 0', |
1456 buttonIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.img, { |
3737 border: '1px solid #ddd', |
1457 variants: !disableMotion && effect, |
3738 borderBottom: 0 |
1458 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), |
3739 }; |
1459 className: "edit-post-fullscreen-mode-close_site-icon", |
3740 const resizedCanvasStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType, isTemplateMode); |
1460 src: siteIconUrl |
3741 const defaultLayout = (0,external_wp_blockEditor_namespaceObject.useSetting)('layout'); |
1461 }); |
3742 const previewMode = 'is-' + deviceType.toLowerCase() + '-preview'; |
1462 } |
3743 let animatedStyles = isTemplateMode ? templateModeStyles : desktopCanvasStyles; |
1463 if (isRequestingSiteIcon) { |
3744 |
1464 buttonIcon = null; |
3745 if (resizedCanvasStyles) { |
1465 } |
3746 animatedStyles = resizedCanvasStyles; |
1466 |
3747 } |
1467 // Override default icon if custom icon is provided via props. |
3748 |
1468 if (icon) { |
3749 let paddingBottom; // Add a constant padding for the typewritter effect. When typing at the |
1469 buttonIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { |
3750 // bottom, there needs to be room to scroll up. |
1470 size: "36px", |
3751 |
1471 icon: icon |
3752 if (!hasMetaBoxes && !resizedCanvasStyles && !isTemplateMode) { |
1472 }); |
3753 paddingBottom = '40vh'; |
1473 } |
3754 } |
1474 const classes = dist_clsx({ |
3755 |
1475 'edit-post-fullscreen-mode-close': true, |
3756 const ref = (0,external_wp_element_namespaceObject.useRef)(); |
1476 'has-icon': siteIconUrl |
3757 const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_blockEditor_namespaceObject.__unstableUseClipboardHandler)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseBlockSelectionClearer)()]); |
1477 }); |
3758 const blockSelectionClearerRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseBlockSelectionClearer)(); |
1478 const buttonHref = href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { |
3759 const [, RecursionProvider] = (0,external_wp_blockEditor_namespaceObject.__experimentalUseNoRecursiveRenders)(wrapperUniqueId, wrapperBlockName); |
1479 post_type: postType.slug |
3760 const layout = (0,external_wp_element_namespaceObject.useMemo)(() => { |
1480 }); |
3761 if (isTemplateMode) { |
1481 const buttonLabel = (_postType$labels$view = postType?.labels?.view_items) !== null && _postType$labels$view !== void 0 ? _postType$labels$view : (0,external_wp_i18n_namespaceObject.__)('Back'); |
3762 return { |
1482 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { |
3763 type: 'default' |
1483 whileHover: "expand", |
3764 }; |
1484 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { |
|
1485 className: classes, |
|
1486 href: buttonHref, |
|
1487 label: buttonLabel, |
|
1488 showTooltip: showTooltip, |
|
1489 children: buttonIcon |
|
1490 }) |
|
1491 }); |
|
1492 } |
|
1493 /* harmony default export */ const fullscreen_mode_close = (FullscreenModeClose); |
|
1494 |
|
1495 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/back-button/index.js |
|
1496 /** |
|
1497 * WordPress dependencies |
|
1498 */ |
|
1499 |
|
1500 |
|
1501 |
|
1502 /** |
|
1503 * Internal dependencies |
|
1504 */ |
|
1505 |
|
1506 |
|
1507 |
|
1508 const { |
|
1509 BackButton: BackButtonFill |
|
1510 } = unlock(external_wp_editor_namespaceObject.privateApis); |
|
1511 const slideX = { |
|
1512 hidden: { |
|
1513 x: '-100%' |
|
1514 }, |
|
1515 distractionFreeInactive: { |
|
1516 x: 0 |
|
1517 }, |
|
1518 hover: { |
|
1519 x: 0, |
|
1520 transition: { |
|
1521 type: 'tween', |
|
1522 delay: 0.2 |
3765 } |
1523 } |
3766 |
1524 } |
3767 if (themeSupportsLayout) { |
1525 }; |
3768 return defaultLayout; |
1526 function BackButton({ |
3769 } |
1527 initialPost |
3770 |
1528 }) { |
3771 return undefined; |
1529 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButtonFill, { |
3772 }, [isTemplateMode, themeSupportsLayout, defaultLayout]); |
1530 children: ({ |
3773 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, { |
1531 length |
3774 __unstableContentRef: ref, |
1532 }) => length <= 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { |
3775 className: classnames_default()('edit-post-visual-editor', { |
1533 variants: slideX, |
3776 'is-template-mode': isTemplateMode |
1534 transition: { |
|
1535 type: 'tween', |
|
1536 delay: 0.8 |
|
1537 }, |
|
1538 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fullscreen_mode_close, { |
|
1539 showTooltip: true, |
|
1540 initialPost: initialPost |
|
1541 }) |
3777 }) |
1542 }) |
3778 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.VisualEditorGlobalKeyboardShortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { |
1543 }); |
3779 className: "edit-post-visual-editor__content-area", |
1544 } |
3780 animate: { |
1545 /* harmony default export */ const back_button = (BackButton); |
3781 padding: isTemplateMode ? '48px 48px 0' : '0' |
1546 |
3782 }, |
1547 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] |
3783 ref: blockSelectionClearerRef |
1548 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; |
3784 }, isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
3785 className: "edit-post-visual-editor__exit-template-mode", |
|
3786 icon: arrow_left, |
|
3787 onClick: () => { |
|
3788 clearSelectedBlock(); |
|
3789 setIsEditingTemplate(false); |
|
3790 } |
|
3791 }, (0,external_wp_i18n_namespaceObject.__)('Back')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { |
|
3792 animate: animatedStyles, |
|
3793 initial: desktopCanvasStyles, |
|
3794 className: previewMode |
|
3795 }, (0,external_wp_element_namespaceObject.createElement)(MaybeIframe, { |
|
3796 shouldIframe: isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile', |
|
3797 contentRef: contentRef, |
|
3798 styles: styles, |
|
3799 assets: assets, |
|
3800 style: { |
|
3801 paddingBottom |
|
3802 } |
|
3803 }, themeSupportsLayout && !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLayoutStyle, { |
|
3804 selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container", |
|
3805 layout: defaultLayout |
|
3806 }), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
3807 className: "edit-post-visual-editor__post-title-wrapper", |
|
3808 contentEditable: false |
|
3809 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, null)), (0,external_wp_element_namespaceObject.createElement)(RecursionProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, { |
|
3810 className: isTemplateMode ? 'wp-site-blocks' : undefined, |
|
3811 __experimentalLayout: layout |
|
3812 }))))), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref3 => { |
|
3813 let { |
|
3814 onClose |
|
3815 } = _ref3; |
|
3816 return (0,external_wp_element_namespaceObject.createElement)(block_inspector_button, { |
|
3817 onClick: onClose |
|
3818 }); |
|
3819 })); |
|
3820 } |
|
3821 |
|
3822 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcuts/index.js |
1549 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcuts/index.js |
3823 /** |
1550 /** |
3824 * WordPress dependencies |
1551 * WordPress dependencies |
3825 */ |
1552 */ |
3826 |
1553 |
3827 |
1554 |
3828 |
1555 |
3829 |
1556 |
3830 |
1557 |
3831 |
|
3832 /** |
1558 /** |
3833 * Internal dependencies |
1559 * Internal dependencies |
3834 */ |
1560 */ |
3835 |
|
3836 |
|
3837 |
1561 |
3838 function KeyboardShortcuts() { |
1562 function KeyboardShortcuts() { |
3839 const { |
1563 const { |
3840 getBlockSelectionStart |
1564 toggleFeature |
3841 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); |
1565 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
3842 const { |
|
3843 getEditorMode, |
|
3844 isEditorSidebarOpened, |
|
3845 isListViewOpened |
|
3846 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); |
|
3847 const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
3848 const { |
|
3849 richEditingEnabled, |
|
3850 codeEditingEnabled |
|
3851 } = select(external_wp_editor_namespaceObject.store).getEditorSettings(); |
|
3852 return !richEditingEnabled || !codeEditingEnabled; |
|
3853 }, []); |
|
3854 const { |
|
3855 switchEditorMode, |
|
3856 openGeneralSidebar, |
|
3857 closeGeneralSidebar, |
|
3858 toggleFeature, |
|
3859 setIsListViewOpened |
|
3860 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
3861 const { |
1566 const { |
3862 registerShortcut |
1567 registerShortcut |
3863 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); |
1568 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); |
3864 (0,external_wp_element_namespaceObject.useEffect)(() => { |
1569 (0,external_wp_element_namespaceObject.useEffect)(() => { |
3865 registerShortcut({ |
|
3866 name: 'core/edit-post/toggle-mode', |
|
3867 category: 'global', |
|
3868 description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'), |
|
3869 keyCombination: { |
|
3870 modifier: 'secondary', |
|
3871 character: 'm' |
|
3872 } |
|
3873 }); |
|
3874 registerShortcut({ |
1570 registerShortcut({ |
3875 name: 'core/edit-post/toggle-fullscreen', |
1571 name: 'core/edit-post/toggle-fullscreen', |
3876 category: 'global', |
1572 category: 'global', |
3877 description: (0,external_wp_i18n_namespaceObject.__)('Toggle fullscreen mode.'), |
1573 description: (0,external_wp_i18n_namespaceObject.__)('Toggle fullscreen mode.'), |
3878 keyCombination: { |
1574 keyCombination: { |
3879 modifier: 'secondary', |
1575 modifier: 'secondary', |
3880 character: 'f' |
1576 character: 'f' |
3881 } |
1577 } |
3882 }); |
1578 }); |
3883 registerShortcut({ |
|
3884 name: 'core/edit-post/toggle-list-view', |
|
3885 category: 'global', |
|
3886 description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'), |
|
3887 keyCombination: { |
|
3888 modifier: 'access', |
|
3889 character: 'o' |
|
3890 } |
|
3891 }); |
|
3892 registerShortcut({ |
|
3893 name: 'core/edit-post/toggle-sidebar', |
|
3894 category: 'global', |
|
3895 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the settings sidebar.'), |
|
3896 keyCombination: { |
|
3897 modifier: 'primaryShift', |
|
3898 character: ',' |
|
3899 } |
|
3900 }); |
|
3901 registerShortcut({ |
|
3902 name: 'core/edit-post/next-region', |
|
3903 category: 'global', |
|
3904 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), |
|
3905 keyCombination: { |
|
3906 modifier: 'ctrl', |
|
3907 character: '`' |
|
3908 }, |
|
3909 aliases: [{ |
|
3910 modifier: 'access', |
|
3911 character: 'n' |
|
3912 }] |
|
3913 }); |
|
3914 registerShortcut({ |
|
3915 name: 'core/edit-post/previous-region', |
|
3916 category: 'global', |
|
3917 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), |
|
3918 keyCombination: { |
|
3919 modifier: 'ctrlShift', |
|
3920 character: '`' |
|
3921 }, |
|
3922 aliases: [{ |
|
3923 modifier: 'access', |
|
3924 character: 'p' |
|
3925 }] |
|
3926 }); |
|
3927 registerShortcut({ |
|
3928 name: 'core/edit-post/keyboard-shortcuts', |
|
3929 category: 'main', |
|
3930 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), |
|
3931 keyCombination: { |
|
3932 modifier: 'access', |
|
3933 character: 'h' |
|
3934 } |
|
3935 }); |
|
3936 }, []); |
1579 }, []); |
3937 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-mode', () => { |
|
3938 switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual'); |
|
3939 }, { |
|
3940 isDisabled: isModeToggleDisabled |
|
3941 }); |
|
3942 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-fullscreen', () => { |
1580 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-fullscreen', () => { |
3943 toggleFeature('fullscreenMode'); |
1581 toggleFeature('fullscreenMode'); |
3944 }); |
1582 }); |
3945 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-sidebar', event => { |
|
3946 // This shortcut has no known clashes, but use preventDefault to prevent any |
|
3947 // obscure shortcuts from triggering. |
|
3948 event.preventDefault(); |
|
3949 |
|
3950 if (isEditorSidebarOpened()) { |
|
3951 closeGeneralSidebar(); |
|
3952 } else { |
|
3953 const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document'; |
|
3954 openGeneralSidebar(sidebarToOpen); |
|
3955 } |
|
3956 }); |
|
3957 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-list-view', () => setIsListViewOpened(!isListViewOpened())); |
|
3958 return null; |
1583 return null; |
3959 } |
1584 } |
3960 |
1585 /* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); |
3961 /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts); |
1586 |
3962 |
1587 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/init-pattern-modal/index.js |
3963 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/config.js |
|
3964 /** |
1588 /** |
3965 * WordPress dependencies |
1589 * WordPress dependencies |
3966 */ |
1590 */ |
3967 |
1591 |
3968 const textFormattingShortcuts = [{ |
1592 |
3969 keyCombination: { |
1593 |
3970 modifier: 'primary', |
1594 |
3971 character: 'b' |
1595 |
3972 }, |
|
3973 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') |
|
3974 }, { |
|
3975 keyCombination: { |
|
3976 modifier: 'primary', |
|
3977 character: 'i' |
|
3978 }, |
|
3979 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') |
|
3980 }, { |
|
3981 keyCombination: { |
|
3982 modifier: 'primary', |
|
3983 character: 'k' |
|
3984 }, |
|
3985 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') |
|
3986 }, { |
|
3987 keyCombination: { |
|
3988 modifier: 'primaryShift', |
|
3989 character: 'k' |
|
3990 }, |
|
3991 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') |
|
3992 }, { |
|
3993 keyCombination: { |
|
3994 character: '[[' |
|
3995 }, |
|
3996 description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page') |
|
3997 }, { |
|
3998 keyCombination: { |
|
3999 modifier: 'primary', |
|
4000 character: 'u' |
|
4001 }, |
|
4002 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') |
|
4003 }]; |
|
4004 |
|
4005 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/shortcut.js |
|
4006 |
|
4007 |
|
4008 /** |
|
4009 * External dependencies |
|
4010 */ |
|
4011 |
|
4012 /** |
|
4013 * WordPress dependencies |
|
4014 */ |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 function KeyCombination(_ref) { |
|
4020 let { |
|
4021 keyCombination, |
|
4022 forceAriaLabel |
|
4023 } = _ref; |
|
4024 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; |
|
4025 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; |
|
4026 return (0,external_wp_element_namespaceObject.createElement)("kbd", { |
|
4027 className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination", |
|
4028 "aria-label": forceAriaLabel || ariaLabel |
|
4029 }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => { |
|
4030 if (character === '+') { |
|
4031 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { |
|
4032 key: index |
|
4033 }, character); |
|
4034 } |
|
4035 |
|
4036 return (0,external_wp_element_namespaceObject.createElement)("kbd", { |
|
4037 key: index, |
|
4038 className: "edit-post-keyboard-shortcut-help-modal__shortcut-key" |
|
4039 }, character); |
|
4040 })); |
|
4041 } |
|
4042 |
|
4043 function Shortcut(_ref2) { |
|
4044 let { |
|
4045 description, |
|
4046 keyCombination, |
|
4047 aliases = [], |
|
4048 ariaLabel |
|
4049 } = _ref2; |
|
4050 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
4051 className: "edit-post-keyboard-shortcut-help-modal__shortcut-description" |
|
4052 }, description), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
4053 className: "edit-post-keyboard-shortcut-help-modal__shortcut-term" |
|
4054 }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { |
|
4055 keyCombination: keyCombination, |
|
4056 forceAriaLabel: ariaLabel |
|
4057 }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { |
|
4058 keyCombination: alias, |
|
4059 forceAriaLabel: ariaLabel, |
|
4060 key: index |
|
4061 })))); |
|
4062 } |
|
4063 |
|
4064 /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut); |
|
4065 |
|
4066 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js |
|
4067 |
|
4068 |
|
4069 /** |
|
4070 * WordPress dependencies |
|
4071 */ |
|
4072 |
1596 |
4073 |
1597 |
4074 /** |
1598 /** |
4075 * Internal dependencies |
1599 * Internal dependencies |
4076 */ |
1600 */ |
4077 |
1601 |
4078 |
1602 |
4079 |
1603 |
4080 function DynamicShortcut(_ref) { |
1604 |
4081 let { |
1605 |
4082 name |
1606 const { |
4083 } = _ref; |
1607 ReusableBlocksRenameHint |
|
1608 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); |
|
1609 function InitPatternModal() { |
4084 const { |
1610 const { |
4085 keyCombination, |
1611 editPost |
4086 description, |
1612 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); |
4087 aliases |
1613 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
|
1614 const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(undefined); |
|
1615 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); |
|
1616 const { |
|
1617 postType, |
|
1618 isNewPost |
4088 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
1619 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
4089 const { |
1620 const { |
4090 getShortcutKeyCombination, |
1621 getEditedPostAttribute, |
4091 getShortcutDescription, |
1622 isCleanNewPost |
4092 getShortcutAliases |
1623 } = select(external_wp_editor_namespaceObject.store); |
4093 } = select(external_wp_keyboardShortcuts_namespaceObject.store); |
|
4094 return { |
1624 return { |
4095 keyCombination: getShortcutKeyCombination(name), |
1625 postType: getEditedPostAttribute('type'), |
4096 aliases: getShortcutAliases(name), |
1626 isNewPost: isCleanNewPost() |
4097 description: getShortcutDescription(name) |
|
4098 }; |
|
4099 }, [name]); |
|
4100 |
|
4101 if (!keyCombination) { |
|
4102 return null; |
|
4103 } |
|
4104 |
|
4105 return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { |
|
4106 keyCombination: keyCombination, |
|
4107 description: description, |
|
4108 aliases: aliases |
|
4109 }); |
|
4110 } |
|
4111 |
|
4112 /* harmony default export */ var dynamic_shortcut = (DynamicShortcut); |
|
4113 |
|
4114 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/index.js |
|
4115 |
|
4116 |
|
4117 /** |
|
4118 * External dependencies |
|
4119 */ |
|
4120 |
|
4121 |
|
4122 /** |
|
4123 * WordPress dependencies |
|
4124 */ |
|
4125 |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 /** |
|
4132 * Internal dependencies |
|
4133 */ |
|
4134 |
|
4135 |
|
4136 |
|
4137 |
|
4138 |
|
4139 const MODAL_NAME = 'edit-post/keyboard-shortcut-help'; |
|
4140 |
|
4141 const ShortcutList = _ref => { |
|
4142 let { |
|
4143 shortcuts |
|
4144 } = _ref; |
|
4145 return ( |
|
4146 /* |
|
4147 * Disable reason: The `list` ARIA role is redundant but |
|
4148 * Safari+VoiceOver won't announce the list otherwise. |
|
4149 */ |
|
4150 |
|
4151 /* eslint-disable jsx-a11y/no-redundant-roles */ |
|
4152 (0,external_wp_element_namespaceObject.createElement)("ul", { |
|
4153 className: "edit-post-keyboard-shortcut-help-modal__shortcut-list", |
|
4154 role: "list" |
|
4155 }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", { |
|
4156 className: "edit-post-keyboard-shortcut-help-modal__shortcut", |
|
4157 key: index |
|
4158 }, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, { |
|
4159 name: shortcut |
|
4160 }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, shortcut)))) |
|
4161 /* eslint-enable jsx-a11y/no-redundant-roles */ |
|
4162 |
|
4163 ); |
|
4164 }; |
|
4165 |
|
4166 const ShortcutSection = _ref2 => { |
|
4167 let { |
|
4168 title, |
|
4169 shortcuts, |
|
4170 className |
|
4171 } = _ref2; |
|
4172 return (0,external_wp_element_namespaceObject.createElement)("section", { |
|
4173 className: classnames_default()('edit-post-keyboard-shortcut-help-modal__section', className) |
|
4174 }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", { |
|
4175 className: "edit-post-keyboard-shortcut-help-modal__section-title" |
|
4176 }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, { |
|
4177 shortcuts: shortcuts |
|
4178 })); |
|
4179 }; |
|
4180 |
|
4181 const ShortcutCategorySection = _ref3 => { |
|
4182 let { |
|
4183 title, |
|
4184 categoryName, |
|
4185 additionalShortcuts = [] |
|
4186 } = _ref3; |
|
4187 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
4188 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); |
|
4189 }, [categoryName]); |
|
4190 return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { |
|
4191 title: title, |
|
4192 shortcuts: categoryShortcuts.concat(additionalShortcuts) |
|
4193 }); |
|
4194 }; |
|
4195 |
|
4196 function KeyboardShortcutHelpModal(_ref4) { |
|
4197 let { |
|
4198 isModalActive, |
|
4199 toggleModal |
|
4200 } = _ref4; |
|
4201 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/keyboard-shortcuts', toggleModal); |
|
4202 |
|
4203 if (!isModalActive) { |
|
4204 return null; |
|
4205 } |
|
4206 |
|
4207 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
|
4208 className: "edit-post-keyboard-shortcut-help-modal", |
|
4209 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), |
|
4210 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
|
4211 onRequestClose: toggleModal |
|
4212 }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { |
|
4213 className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts", |
|
4214 shortcuts: ['core/edit-post/keyboard-shortcuts'] |
|
4215 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { |
|
4216 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), |
|
4217 categoryName: "global" |
|
4218 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { |
|
4219 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), |
|
4220 categoryName: "selection" |
|
4221 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { |
|
4222 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), |
|
4223 categoryName: "block", |
|
4224 additionalShortcuts: [{ |
|
4225 keyCombination: { |
|
4226 character: '/' |
|
4227 }, |
|
4228 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), |
|
4229 |
|
4230 /* translators: The forward-slash character. e.g. '/'. */ |
|
4231 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') |
|
4232 }] |
|
4233 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { |
|
4234 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), |
|
4235 shortcuts: textFormattingShortcuts |
|
4236 })); |
|
4237 } |
|
4238 /* harmony default export */ var keyboard_shortcut_help_modal = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({ |
|
4239 isModalActive: select(store_store).isModalActive(MODAL_NAME) |
|
4240 })), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref5) => { |
|
4241 let { |
|
4242 isModalActive |
|
4243 } = _ref5; |
|
4244 const { |
|
4245 openModal, |
|
4246 closeModal |
|
4247 } = dispatch(store_store); |
|
4248 return { |
|
4249 toggleModal: () => isModalActive ? closeModal() : openModal(MODAL_NAME) |
|
4250 }; |
|
4251 })])(KeyboardShortcutHelpModal)); |
|
4252 |
|
4253 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-custom-fields.js |
|
4254 |
|
4255 |
|
4256 /** |
|
4257 * WordPress dependencies |
|
4258 */ |
|
4259 |
|
4260 |
|
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 function CustomFieldsConfirmation(_ref) { |
|
4266 let { |
|
4267 willEnable |
|
4268 } = _ref; |
|
4269 const [isReloading, setIsReloading] = (0,external_wp_element_namespaceObject.useState)(false); |
|
4270 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", { |
|
4271 className: "edit-post-preferences-modal__custom-fields-confirmation-message" |
|
4272 }, (0,external_wp_i18n_namespaceObject.__)('A page reload is required for this change. Make sure your content is saved before reloading.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
4273 className: "edit-post-preferences-modal__custom-fields-confirmation-button", |
|
4274 variant: "secondary", |
|
4275 isBusy: isReloading, |
|
4276 disabled: isReloading, |
|
4277 onClick: () => { |
|
4278 setIsReloading(true); |
|
4279 document.getElementById('toggle-custom-fields-form').submit(); |
|
4280 } |
|
4281 }, willEnable ? (0,external_wp_i18n_namespaceObject.__)('Enable & Reload') : (0,external_wp_i18n_namespaceObject.__)('Disable & Reload'))); |
|
4282 } |
|
4283 function EnableCustomFieldsOption(_ref2) { |
|
4284 let { |
|
4285 label, |
|
4286 areCustomFieldsEnabled |
|
4287 } = _ref2; |
|
4288 const [isChecked, setIsChecked] = (0,external_wp_element_namespaceObject.useState)(areCustomFieldsEnabled); |
|
4289 return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_base_option, { |
|
4290 label: label, |
|
4291 isChecked: isChecked, |
|
4292 onChange: setIsChecked |
|
4293 }, isChecked !== areCustomFieldsEnabled && (0,external_wp_element_namespaceObject.createElement)(CustomFieldsConfirmation, { |
|
4294 willEnable: isChecked |
|
4295 })); |
|
4296 } |
|
4297 /* harmony default export */ var enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ |
|
4298 areCustomFieldsEnabled: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().enableCustomFields |
|
4299 }))(EnableCustomFieldsOption)); |
|
4300 |
|
4301 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-panel.js |
|
4302 /** |
|
4303 * WordPress dependencies |
|
4304 */ |
|
4305 |
|
4306 |
|
4307 |
|
4308 /** |
|
4309 * Internal dependencies |
|
4310 */ |
|
4311 |
|
4312 |
|
4313 /* harmony default export */ var enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => { |
|
4314 let { |
|
4315 panelName |
|
4316 } = _ref; |
|
4317 const { |
|
4318 isEditorPanelEnabled, |
|
4319 isEditorPanelRemoved |
|
4320 } = select(store_store); |
|
4321 return { |
|
4322 isRemoved: isEditorPanelRemoved(panelName), |
|
4323 isChecked: isEditorPanelEnabled(panelName) |
|
4324 }; |
|
4325 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => { |
|
4326 let { |
|
4327 isRemoved |
|
4328 } = _ref2; |
|
4329 return !isRemoved; |
|
4330 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => { |
|
4331 let { |
|
4332 panelName |
|
4333 } = _ref3; |
|
4334 return { |
|
4335 onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName) |
|
4336 }; |
|
4337 }))(preferences_modal_base_option)); |
|
4338 |
|
4339 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js |
|
4340 |
|
4341 |
|
4342 /** |
|
4343 * WordPress dependencies |
|
4344 */ |
|
4345 |
|
4346 /** |
|
4347 * Internal dependencies |
|
4348 */ |
|
4349 |
|
4350 |
|
4351 const { |
|
4352 Fill, |
|
4353 Slot: enable_plugin_document_setting_panel_Slot |
|
4354 } = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption'); |
|
4355 |
|
4356 const EnablePluginDocumentSettingPanelOption = _ref => { |
|
4357 let { |
|
4358 label, |
|
4359 panelName |
|
4360 } = _ref; |
|
4361 return (0,external_wp_element_namespaceObject.createElement)(Fill, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { |
|
4362 label: label, |
|
4363 panelName: panelName |
|
4364 })); |
|
4365 }; |
|
4366 |
|
4367 EnablePluginDocumentSettingPanelOption.Slot = enable_plugin_document_setting_panel_Slot; |
|
4368 /* harmony default export */ var enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption); |
|
4369 |
|
4370 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-publish-sidebar.js |
|
4371 /** |
|
4372 * WordPress dependencies |
|
4373 */ |
|
4374 |
|
4375 |
|
4376 |
|
4377 |
|
4378 |
|
4379 /* harmony default export */ var enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({ |
|
4380 isChecked: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled() |
|
4381 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
|
4382 const { |
|
4383 enablePublishSidebar, |
|
4384 disablePublishSidebar |
|
4385 } = dispatch(external_wp_editor_namespaceObject.store); |
|
4386 return { |
|
4387 onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar() |
|
4388 }; |
|
4389 }), // In < medium viewports we override this option and always show the publish sidebar. |
|
4390 // See the edit-post's header component for the specific logic. |
|
4391 (0,external_wp_viewport_namespaceObject.ifViewportMatches)('medium'))(preferences_modal_base_option)); |
|
4392 |
|
4393 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-feature.js |
|
4394 /** |
|
4395 * WordPress dependencies |
|
4396 */ |
|
4397 |
|
4398 |
|
4399 |
|
4400 /** |
|
4401 * Internal dependencies |
|
4402 */ |
|
4403 |
|
4404 |
|
4405 /* harmony default export */ var enable_feature = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => { |
|
4406 let { |
|
4407 featureName |
|
4408 } = _ref; |
|
4409 const { |
|
4410 isFeatureActive |
|
4411 } = select(store_store); |
|
4412 return { |
|
4413 isChecked: isFeatureActive(featureName) |
|
4414 }; |
|
4415 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => { |
|
4416 let { |
|
4417 featureName |
|
4418 } = _ref2; |
|
4419 return { |
|
4420 onChange: () => dispatch(store_store).toggleFeature(featureName) |
|
4421 }; |
|
4422 }))(preferences_modal_base_option)); |
|
4423 |
|
4424 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/index.js |
|
4425 |
|
4426 |
|
4427 |
|
4428 |
|
4429 |
|
4430 |
|
4431 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/meta-boxes-section.js |
|
4432 |
|
4433 |
|
4434 /** |
|
4435 * External dependencies |
|
4436 */ |
|
4437 |
|
4438 /** |
|
4439 * WordPress dependencies |
|
4440 */ |
|
4441 |
|
4442 |
|
4443 |
|
4444 |
|
4445 |
|
4446 /** |
|
4447 * Internal dependencies |
|
4448 */ |
|
4449 |
|
4450 |
|
4451 |
|
4452 function MetaBoxesSection(_ref) { |
|
4453 let { |
|
4454 areCustomFieldsRegistered, |
|
4455 metaBoxes, |
|
4456 ...sectionProps |
|
4457 } = _ref; |
|
4458 // The 'Custom Fields' meta box is a special case that we handle separately. |
|
4459 const thirdPartyMetaBoxes = (0,external_lodash_namespaceObject.filter)(metaBoxes, _ref2 => { |
|
4460 let { |
|
4461 id |
|
4462 } = _ref2; |
|
4463 return id !== 'postcustom'; |
|
4464 }); |
|
4465 |
|
4466 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) { |
|
4467 return null; |
|
4468 } |
|
4469 |
|
4470 return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, sectionProps, areCustomFieldsRegistered && (0,external_wp_element_namespaceObject.createElement)(enable_custom_fields, { |
|
4471 label: (0,external_wp_i18n_namespaceObject.__)('Custom fields') |
|
4472 }), (0,external_lodash_namespaceObject.map)(thirdPartyMetaBoxes, _ref3 => { |
|
4473 let { |
|
4474 id, |
|
4475 title |
|
4476 } = _ref3; |
|
4477 return (0,external_wp_element_namespaceObject.createElement)(enable_panel, { |
|
4478 key: id, |
|
4479 label: title, |
|
4480 panelName: `meta-box-${id}` |
|
4481 }); |
|
4482 })); |
|
4483 } |
|
4484 /* harmony default export */ var meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
|
4485 const { |
|
4486 getEditorSettings |
|
4487 } = select(external_wp_editor_namespaceObject.store); |
|
4488 const { |
|
4489 getAllMetaBoxes |
|
4490 } = select(store_store); |
|
4491 return { |
|
4492 // This setting should not live in the block editor's store. |
|
4493 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== undefined, |
|
4494 metaBoxes: getAllMetaBoxes() |
|
4495 }; |
|
4496 })(MetaBoxesSection)); |
|
4497 |
|
4498 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/checklist.js |
|
4499 |
|
4500 |
|
4501 /** |
|
4502 * External dependencies |
|
4503 */ |
|
4504 |
|
4505 /** |
|
4506 * WordPress dependencies |
|
4507 */ |
|
4508 |
|
4509 |
|
4510 |
|
4511 |
|
4512 function BlockTypesChecklist(_ref) { |
|
4513 let { |
|
4514 blockTypes, |
|
4515 value, |
|
4516 onItemChange |
|
4517 } = _ref; |
|
4518 return (0,external_wp_element_namespaceObject.createElement)("ul", { |
|
4519 className: "edit-post-block-manager__checklist" |
|
4520 }, blockTypes.map(blockType => (0,external_wp_element_namespaceObject.createElement)("li", { |
|
4521 key: blockType.name, |
|
4522 className: "edit-post-block-manager__checklist-item" |
|
4523 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { |
|
4524 label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, blockType.title, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
|
4525 icon: blockType.icon |
|
4526 })), |
|
4527 checked: value.includes(blockType.name), |
|
4528 onChange: (0,external_lodash_namespaceObject.partial)(onItemChange, blockType.name) |
|
4529 })))); |
|
4530 } |
|
4531 |
|
4532 /* harmony default export */ var checklist = (BlockTypesChecklist); |
|
4533 |
|
4534 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/category.js |
|
4535 |
|
4536 |
|
4537 /** |
|
4538 * External dependencies |
|
4539 */ |
|
4540 |
|
4541 /** |
|
4542 * WordPress dependencies |
|
4543 */ |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 /** |
|
4551 * Internal dependencies |
|
4552 */ |
|
4553 |
|
4554 |
|
4555 |
|
4556 |
|
4557 function BlockManagerCategory(_ref) { |
|
4558 let { |
|
4559 title, |
|
4560 blockTypes |
|
4561 } = _ref; |
|
4562 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory); |
|
4563 const { |
|
4564 defaultAllowedBlockTypes, |
|
4565 hiddenBlockTypes |
|
4566 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
4567 const { |
|
4568 getEditorSettings |
|
4569 } = select(external_wp_editor_namespaceObject.store); |
|
4570 const { |
|
4571 getHiddenBlockTypes |
|
4572 } = select(store_store); |
|
4573 return { |
|
4574 defaultAllowedBlockTypes: getEditorSettings().defaultAllowedBlockTypes, |
|
4575 hiddenBlockTypes: getHiddenBlockTypes() |
|
4576 }; |
1627 }; |
4577 }, []); |
1628 }, []); |
4578 const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { |
1629 (0,external_wp_element_namespaceObject.useEffect)(() => { |
4579 if (defaultAllowedBlockTypes === true) { |
1630 if (isNewPost && postType === 'wp_block') { |
4580 return blockTypes; |
1631 setIsModalOpen(true); |
4581 } |
1632 } |
4582 |
1633 // We only want the modal to open when the page is first loaded. |
4583 return blockTypes.filter(_ref2 => { |
1634 // eslint-disable-next-line react-hooks/exhaustive-deps |
4584 let { |
|
4585 name |
|
4586 } = _ref2; |
|
4587 return (0,external_lodash_namespaceObject.includes)(defaultAllowedBlockTypes || [], name); |
|
4588 }); |
|
4589 }, [defaultAllowedBlockTypes, blockTypes]); |
|
4590 const { |
|
4591 showBlockTypes, |
|
4592 hideBlockTypes |
|
4593 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
4594 const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)((blockName, nextIsChecked) => { |
|
4595 if (nextIsChecked) { |
|
4596 showBlockTypes(blockName); |
|
4597 } else { |
|
4598 hideBlockTypes(blockName); |
|
4599 } |
|
4600 }, []); |
1635 }, []); |
4601 const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)(nextIsChecked => { |
1636 if (postType !== 'wp_block' || !isNewPost) { |
4602 const blockNames = (0,external_lodash_namespaceObject.map)(blockTypes, 'name'); |
|
4603 |
|
4604 if (nextIsChecked) { |
|
4605 showBlockTypes(blockNames); |
|
4606 } else { |
|
4607 hideBlockTypes(blockNames); |
|
4608 } |
|
4609 }, [blockTypes]); |
|
4610 |
|
4611 if (!filteredBlockTypes.length) { |
|
4612 return null; |
1637 return null; |
4613 } |
1638 } |
4614 |
1639 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
4615 const checkedBlockNames = (0,external_lodash_namespaceObject.without)((0,external_lodash_namespaceObject.map)(filteredBlockTypes, 'name'), ...hiddenBlockTypes); |
1640 children: isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { |
4616 const titleId = 'edit-post-block-manager__category-title-' + instanceId; |
1641 title: (0,external_wp_i18n_namespaceObject.__)('Create pattern'), |
4617 const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length; |
1642 onRequestClose: () => { |
4618 let ariaChecked; |
1643 setIsModalOpen(false); |
4619 |
1644 }, |
4620 if (isAllChecked) { |
1645 overlayClassName: "reusable-blocks-menu-items__convert-modal", |
4621 ariaChecked = 'true'; |
1646 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { |
4622 } else if (checkedBlockNames.length > 0) { |
1647 onSubmit: event => { |
4623 ariaChecked = 'mixed'; |
1648 event.preventDefault(); |
4624 } else { |
1649 setIsModalOpen(false); |
4625 ariaChecked = 'false'; |
1650 editPost({ |
4626 } |
1651 title, |
4627 |
1652 meta: { |
4628 return (0,external_wp_element_namespaceObject.createElement)("div", { |
1653 wp_pattern_sync_status: syncType |
4629 role: "group", |
1654 } |
4630 "aria-labelledby": titleId, |
1655 }); |
4631 className: "edit-post-block-manager__category" |
1656 }, |
4632 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { |
1657 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { |
4633 checked: isAllChecked, |
1658 spacing: "5", |
4634 onChange: toggleAllVisible, |
1659 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { |
4635 className: "edit-post-block-manager__category-title", |
1660 label: (0,external_wp_i18n_namespaceObject.__)('Name'), |
4636 "aria-checked": ariaChecked, |
1661 value: title, |
4637 label: (0,external_wp_element_namespaceObject.createElement)("span", { |
1662 onChange: setTitle, |
4638 id: titleId |
1663 placeholder: (0,external_wp_i18n_namespaceObject.__)('My pattern'), |
4639 }, title) |
1664 className: "patterns-create-modal__name-input", |
4640 }), (0,external_wp_element_namespaceObject.createElement)(checklist, { |
1665 __nextHasNoMarginBottom: true, |
4641 blockTypes: filteredBlockTypes, |
1666 __next40pxDefaultSize: true |
4642 value: checkedBlockNames, |
1667 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ReusableBlocksRenameHint, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { |
4643 onItemChange: toggleVisible |
1668 label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'), |
4644 })); |
1669 help: (0,external_wp_i18n_namespaceObject.__)('Sync this pattern across multiple locations.'), |
4645 } |
1670 checked: !syncType, |
4646 |
1671 onChange: () => { |
4647 /* harmony default export */ var block_manager_category = (BlockManagerCategory); |
1672 setSyncType(!syncType ? 'unsynced' : undefined); |
4648 |
1673 } |
4649 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/index.js |
1674 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { |
4650 |
1675 justify: "right", |
4651 |
1676 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { |
4652 /** |
1677 variant: "primary", |
4653 * External dependencies |
1678 type: "submit", |
4654 */ |
1679 disabled: !title, |
4655 |
1680 __experimentalIsFocusable: true, |
|
1681 children: (0,external_wp_i18n_namespaceObject.__)('Create') |
|
1682 }) |
|
1683 })] |
|
1684 }) |
|
1685 }) |
|
1686 }) |
|
1687 }); |
|
1688 } |
|
1689 |
|
1690 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/browser-url/index.js |
4656 /** |
1691 /** |
4657 * WordPress dependencies |
1692 * WordPress dependencies |
4658 */ |
1693 */ |
4659 |
1694 |
4660 |
1695 |
4661 |
1696 |
4662 |
1697 |
4663 |
1698 |
4664 |
|
4665 |
|
4666 |
|
4667 /** |
|
4668 * Internal dependencies |
|
4669 */ |
|
4670 |
|
4671 |
|
4672 |
|
4673 |
|
4674 function BlockManager(_ref) { |
|
4675 let { |
|
4676 blockTypes, |
|
4677 categories, |
|
4678 hasBlockSupport, |
|
4679 isMatchingSearchTerm, |
|
4680 numberOfHiddenBlocks |
|
4681 } = _ref; |
|
4682 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); |
|
4683 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); // Filtering occurs here (as opposed to `withSelect`) to avoid |
|
4684 // wasted renders by consequence of `Array#filter` producing |
|
4685 // a new value reference on each call. |
|
4686 |
|
4687 blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || (0,external_lodash_namespaceObject.includes)(blockType.parent, 'core/post-content'))); // Announce search results on change |
|
4688 |
|
4689 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
4690 if (!search) { |
|
4691 return; |
|
4692 } |
|
4693 |
|
4694 const count = blockTypes.length; |
|
4695 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( |
|
4696 /* translators: %d: number of results. */ |
|
4697 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); |
|
4698 debouncedSpeak(resultsFoundMessage); |
|
4699 }, [blockTypes.length, search, debouncedSpeak]); |
|
4700 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
4701 className: "edit-post-block-manager__content" |
|
4702 }, !!numberOfHiddenBlocks && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
4703 className: "edit-post-block-manager__disabled-blocks-count" |
|
4704 }, (0,external_wp_i18n_namespaceObject.sprintf)( |
|
4705 /* translators: %d: number of blocks. */ |
|
4706 (0,external_wp_i18n_namespaceObject._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, { |
|
4707 label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'), |
|
4708 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'), |
|
4709 value: search, |
|
4710 onChange: nextSearch => setSearch(nextSearch), |
|
4711 className: "edit-post-block-manager__search" |
|
4712 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
4713 tabIndex: "0", |
|
4714 role: "region", |
|
4715 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'), |
|
4716 className: "edit-post-block-manager__results" |
|
4717 }, blockTypes.length === 0 && (0,external_wp_element_namespaceObject.createElement)("p", { |
|
4718 className: "edit-post-block-manager__no-results" |
|
4719 }, (0,external_wp_i18n_namespaceObject.__)('No blocks found.')), categories.map(category => (0,external_wp_element_namespaceObject.createElement)(block_manager_category, { |
|
4720 key: category.slug, |
|
4721 title: category.title, |
|
4722 blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, { |
|
4723 category: category.slug |
|
4724 }) |
|
4725 })), (0,external_wp_element_namespaceObject.createElement)(block_manager_category, { |
|
4726 title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'), |
|
4727 blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, _ref2 => { |
|
4728 let { |
|
4729 category |
|
4730 } = _ref2; |
|
4731 return !category; |
|
4732 }) |
|
4733 }))); |
|
4734 } |
|
4735 |
|
4736 /* harmony default export */ var block_manager = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
|
4737 const { |
|
4738 getBlockTypes, |
|
4739 getCategories, |
|
4740 hasBlockSupport, |
|
4741 isMatchingSearchTerm |
|
4742 } = select(external_wp_blocks_namespaceObject.store); |
|
4743 const { |
|
4744 getHiddenBlockTypes |
|
4745 } = select(store_store); |
|
4746 const hiddenBlockTypes = getHiddenBlockTypes(); |
|
4747 const numberOfHiddenBlocks = (0,external_lodash_namespaceObject.isArray)(hiddenBlockTypes) && hiddenBlockTypes.length; |
|
4748 return { |
|
4749 blockTypes: getBlockTypes(), |
|
4750 categories: getCategories(), |
|
4751 hasBlockSupport, |
|
4752 isMatchingSearchTerm, |
|
4753 numberOfHiddenBlocks |
|
4754 }; |
|
4755 })(BlockManager)); |
|
4756 |
|
4757 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/index.js |
|
4758 |
|
4759 |
|
4760 /** |
|
4761 * External dependencies |
|
4762 */ |
|
4763 |
|
4764 /** |
|
4765 * WordPress dependencies |
|
4766 */ |
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 |
|
4773 |
|
4774 |
|
4775 /** |
|
4776 * Internal dependencies |
|
4777 */ |
|
4778 |
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 const preferences_modal_MODAL_NAME = 'edit-post/preferences'; |
|
4784 function EditPostPreferencesModal() { |
|
4785 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); |
|
4786 const { |
|
4787 closeModal |
|
4788 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
4789 const { |
|
4790 isModalActive, |
|
4791 isViewable |
|
4792 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
4793 const { |
|
4794 getEditedPostAttribute |
|
4795 } = select(external_wp_editor_namespaceObject.store); |
|
4796 const { |
|
4797 getPostType |
|
4798 } = select(external_wp_coreData_namespaceObject.store); |
|
4799 const postType = getPostType(getEditedPostAttribute('type')); |
|
4800 return { |
|
4801 isModalActive: select(store_store).isModalActive(preferences_modal_MODAL_NAME), |
|
4802 isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false) |
|
4803 }; |
|
4804 }, []); |
|
4805 const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
4806 const { |
|
4807 getEditorSettings |
|
4808 } = select(external_wp_editor_namespaceObject.store); |
|
4809 const { |
|
4810 getEditorMode, |
|
4811 isFeatureActive |
|
4812 } = select(store_store); |
|
4813 const mode = getEditorMode(); |
|
4814 const isRichEditingEnabled = getEditorSettings().richEditingEnabled; |
|
4815 const hasReducedUI = isFeatureActive('reducedUI'); |
|
4816 return !hasReducedUI && isLargeViewport && isRichEditingEnabled && mode === 'visual'; |
|
4817 }, [isLargeViewport]); |
|
4818 const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{ |
|
4819 name: 'general', |
|
4820 tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'), |
|
4821 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { |
|
4822 title: (0,external_wp_i18n_namespaceObject.__)('Publishing'), |
|
4823 description: (0,external_wp_i18n_namespaceObject.__)('Change options related to publishing.') |
|
4824 }, (0,external_wp_element_namespaceObject.createElement)(enable_publish_sidebar, { |
|
4825 help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'), |
|
4826 label: (0,external_wp_i18n_namespaceObject.__)('Include pre-publish checklist') |
|
4827 })), (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { |
|
4828 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), |
|
4829 description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.') |
|
4830 }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, { |
|
4831 featureName: "reducedUI", |
|
4832 help: (0,external_wp_i18n_namespaceObject.__)('Compacts options and outlines in the toolbar.'), |
|
4833 label: (0,external_wp_i18n_namespaceObject.__)('Reduce the interface') |
|
4834 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, { |
|
4835 featureName: "focusMode", |
|
4836 help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'), |
|
4837 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode') |
|
4838 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, { |
|
4839 featureName: "showIconLabels", |
|
4840 help: (0,external_wp_i18n_namespaceObject.__)('Shows text instead of icons.'), |
|
4841 label: (0,external_wp_i18n_namespaceObject.__)('Display button labels') |
|
4842 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, { |
|
4843 featureName: "themeStyles", |
|
4844 help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'), |
|
4845 label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles') |
|
4846 }), showBlockBreadcrumbsOption && (0,external_wp_element_namespaceObject.createElement)(enable_feature, { |
|
4847 featureName: "showBlockBreadcrumbs", |
|
4848 help: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'), |
|
4849 label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs') |
|
4850 }))) |
|
4851 }, { |
|
4852 name: 'blocks', |
|
4853 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'), |
|
4854 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { |
|
4855 title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'), |
|
4856 description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.') |
|
4857 }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, { |
|
4858 featureName: "mostUsedBlocks", |
|
4859 help: (0,external_wp_i18n_namespaceObject.__)('Places the most frequent blocks in the block library.'), |
|
4860 label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks') |
|
4861 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, { |
|
4862 featureName: "keepCaretInsideBlock", |
|
4863 help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'), |
|
4864 label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block') |
|
4865 })), (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { |
|
4866 title: (0,external_wp_i18n_namespaceObject.__)('Visible blocks'), |
|
4867 description: (0,external_wp_i18n_namespaceObject.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.") |
|
4868 }, (0,external_wp_element_namespaceObject.createElement)(block_manager, null))) |
|
4869 }, { |
|
4870 name: 'panels', |
|
4871 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Panels'), |
|
4872 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { |
|
4873 title: (0,external_wp_i18n_namespaceObject.__)('Document settings'), |
|
4874 description: (0,external_wp_i18n_namespaceObject.__)('Choose what displays in the panel.') |
|
4875 }, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel.Slot, null), isViewable && (0,external_wp_element_namespaceObject.createElement)(enable_panel, { |
|
4876 label: (0,external_wp_i18n_namespaceObject.__)('Permalink'), |
|
4877 panelName: "post-link" |
|
4878 }), isViewable && (0,external_wp_element_namespaceObject.createElement)(enable_panel, { |
|
4879 label: (0,external_wp_i18n_namespaceObject.__)('Template'), |
|
4880 panelName: "template" |
|
4881 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, { |
|
4882 taxonomyWrapper: (content, taxonomy) => (0,external_wp_element_namespaceObject.createElement)(enable_panel, { |
|
4883 label: (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']), |
|
4884 panelName: `taxonomy-panel-${taxonomy.slug}` |
|
4885 }) |
|
4886 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { |
|
4887 label: (0,external_wp_i18n_namespaceObject.__)('Featured image'), |
|
4888 panelName: "featured-image" |
|
4889 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { |
|
4890 label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'), |
|
4891 panelName: "post-excerpt" |
|
4892 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, { |
|
4893 supportKeys: ['comments', 'trackbacks'] |
|
4894 }, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { |
|
4895 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), |
|
4896 panelName: "discussion-panel" |
|
4897 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { |
|
4898 label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'), |
|
4899 panelName: "page-attributes" |
|
4900 }))), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_section, { |
|
4901 title: (0,external_wp_i18n_namespaceObject.__)('Additional'), |
|
4902 description: (0,external_wp_i18n_namespaceObject.__)('Add extra areas to the editor.') |
|
4903 })) |
|
4904 }], [isViewable, isLargeViewport, showBlockBreadcrumbsOption]); |
|
4905 |
|
4906 if (!isModalActive) { |
|
4907 return null; |
|
4908 } |
|
4909 |
|
4910 return (0,external_wp_element_namespaceObject.createElement)(PreferencesModal, { |
|
4911 closeModal: closeModal |
|
4912 }, (0,external_wp_element_namespaceObject.createElement)(PreferencesModalTabs, { |
|
4913 sections: sections |
|
4914 })); |
|
4915 } |
|
4916 |
|
4917 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/browser-url/index.js |
|
4918 /** |
|
4919 * WordPress dependencies |
|
4920 */ |
|
4921 |
|
4922 |
|
4923 |
|
4924 |
|
4925 /** |
1699 /** |
4926 * Returns the Post's Edit URL. |
1700 * Returns the Post's Edit URL. |
4927 * |
1701 * |
4928 * @param {number} postId Post ID. |
1702 * @param {number} postId Post ID. |
4929 * |
1703 * |
4930 * @return {string} Post edit URL. |
1704 * @return {string} Post edit URL. |
4931 */ |
1705 */ |
4932 |
|
4933 function getPostEditURL(postId) { |
1706 function getPostEditURL(postId) { |
4934 return (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { |
1707 return (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { |
4935 post: postId, |
1708 post: postId, |
4936 action: 'edit' |
1709 action: 'edit' |
4937 }); |
1710 }); |
4938 } |
1711 } |
|
1712 |
4939 /** |
1713 /** |
4940 * Returns the Post's Trashed URL. |
1714 * Returns the Post's Trashed URL. |
4941 * |
1715 * |
4942 * @param {number} postId Post ID. |
1716 * @param {number} postId Post ID. |
4943 * @param {string} postType Post Type. |
1717 * @param {string} postType Post Type. |
4944 * |
1718 * |
4945 * @return {string} Post trashed URL. |
1719 * @return {string} Post trashed URL. |
4946 */ |
1720 */ |
4947 |
|
4948 function getPostTrashedURL(postId, postType) { |
1721 function getPostTrashedURL(postId, postType) { |
4949 return (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { |
1722 return (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { |
4950 trashed: 1, |
1723 trashed: 1, |
4951 post_type: postType, |
1724 post_type: postType, |
4952 ids: postId |
1725 ids: postId |
5027 id, |
1796 id, |
5028 status, |
1797 status, |
5029 type |
1798 type |
5030 } = post; |
1799 } = post; |
5031 const isTemplate = ['wp_template', 'wp_template_part'].includes(type); |
1800 const isTemplate = ['wp_template', 'wp_template_part'].includes(type); |
5032 |
|
5033 if (isTemplate) { |
1801 if (isTemplate) { |
5034 id = post.wp_id; |
1802 id = post.wp_id; |
5035 } |
1803 } |
5036 |
|
5037 return { |
1804 return { |
5038 postId: id, |
1805 postId: id, |
5039 postStatus: status, |
1806 postStatus: status, |
5040 postType: type, |
1807 postType: type, |
5041 isSavingPost: isSavingPost() |
1808 isSavingPost: isSavingPost() |
5042 }; |
1809 }; |
5043 })(BrowserURL)); |
1810 })(BrowserURL)); |
5044 |
1811 |
5045 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js |
1812 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js |
5046 |
|
5047 |
|
5048 /** |
|
5049 * WordPress dependencies |
|
5050 */ |
|
5051 |
|
5052 const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5053 xmlns: "http://www.w3.org/2000/svg", |
|
5054 viewBox: "-2 -2 24 24" |
|
5055 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5056 d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z" |
|
5057 })); |
|
5058 /* harmony default export */ var library_wordpress = (wordpress); |
|
5059 |
|
5060 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/fullscreen-mode-close/index.js |
|
5061 |
|
5062 |
|
5063 /** |
1813 /** |
5064 * External dependencies |
1814 * External dependencies |
5065 */ |
1815 */ |
5066 |
1816 |
5067 |
|
5068 /** |
|
5069 * WordPress dependencies |
|
5070 */ |
|
5071 |
|
5072 |
|
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 |
|
5079 |
|
5080 /** |
|
5081 * Internal dependencies |
|
5082 */ |
|
5083 |
|
5084 |
|
5085 |
|
5086 function FullscreenModeClose(_ref) { |
|
5087 let { |
|
5088 showTooltip, |
|
5089 icon, |
|
5090 href |
|
5091 } = _ref; |
|
5092 const { |
|
5093 isActive, |
|
5094 isRequestingSiteIcon, |
|
5095 postType, |
|
5096 siteIconUrl |
|
5097 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5098 const { |
|
5099 getCurrentPostType |
|
5100 } = select(external_wp_editor_namespaceObject.store); |
|
5101 const { |
|
5102 isFeatureActive |
|
5103 } = select(store_store); |
|
5104 const { |
|
5105 getEntityRecord, |
|
5106 getPostType, |
|
5107 isResolving |
|
5108 } = select(external_wp_coreData_namespaceObject.store); |
|
5109 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; |
|
5110 return { |
|
5111 isActive: isFeatureActive('fullscreenMode'), |
|
5112 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), |
|
5113 postType: getPostType(getCurrentPostType()), |
|
5114 siteIconUrl: siteData.site_icon_url |
|
5115 }; |
|
5116 }, []); |
|
5117 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); |
|
5118 |
|
5119 if (!isActive || !postType) { |
|
5120 return null; |
|
5121 } |
|
5122 |
|
5123 let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
|
5124 size: "36px", |
|
5125 icon: library_wordpress |
|
5126 }); |
|
5127 const effect = { |
|
5128 expand: { |
|
5129 scale: 1.25, |
|
5130 transition: { |
|
5131 type: 'tween', |
|
5132 duration: '0.3' |
|
5133 } |
|
5134 } |
|
5135 }; |
|
5136 |
|
5137 if (siteIconUrl) { |
|
5138 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, { |
|
5139 variants: !disableMotion && effect, |
|
5140 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), |
|
5141 className: "edit-post-fullscreen-mode-close_site-icon", |
|
5142 src: siteIconUrl |
|
5143 }); |
|
5144 } |
|
5145 |
|
5146 if (isRequestingSiteIcon) { |
|
5147 buttonIcon = null; |
|
5148 } // Override default icon if custom icon is provided via props. |
|
5149 |
|
5150 |
|
5151 if (icon) { |
|
5152 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
|
5153 size: "36px", |
|
5154 icon: icon |
|
5155 }); |
|
5156 } |
|
5157 |
|
5158 const classes = classnames_default()({ |
|
5159 'edit-post-fullscreen-mode-close': true, |
|
5160 'has-icon': siteIconUrl |
|
5161 }); |
|
5162 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { |
|
5163 whileHover: "expand" |
|
5164 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
5165 className: classes, |
|
5166 href: href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { |
|
5167 post_type: postType.slug |
|
5168 }), |
|
5169 label: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_items'], (0,external_wp_i18n_namespaceObject.__)('Back')), |
|
5170 showTooltip: showTooltip |
|
5171 }, buttonIcon)); |
|
5172 } |
|
5173 |
|
5174 /* harmony default export */ var fullscreen_mode_close = (FullscreenModeClose); |
|
5175 |
|
5176 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js |
|
5177 |
|
5178 |
|
5179 /** |
|
5180 * WordPress dependencies |
|
5181 */ |
|
5182 |
|
5183 const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5184 viewBox: "0 0 24 24", |
|
5185 xmlns: "http://www.w3.org/2000/svg" |
|
5186 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5187 d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z" |
|
5188 })); |
|
5189 /* harmony default export */ var list_view = (listView); |
|
5190 |
|
5191 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js |
|
5192 |
|
5193 |
|
5194 /** |
|
5195 * WordPress dependencies |
|
5196 */ |
|
5197 |
|
5198 const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5199 xmlns: "http://www.w3.org/2000/svg", |
|
5200 viewBox: "0 0 24 24" |
|
5201 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5202 d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" |
|
5203 })); |
|
5204 /* harmony default export */ var library_plus = (plus); |
|
5205 |
|
5206 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/header-toolbar/index.js |
|
5207 |
|
5208 |
|
5209 /** |
|
5210 * WordPress dependencies |
|
5211 */ |
|
5212 |
|
5213 |
|
5214 |
|
5215 |
|
5216 |
|
5217 |
|
5218 |
|
5219 |
|
5220 |
|
5221 /** |
|
5222 * Internal dependencies |
|
5223 */ |
|
5224 |
|
5225 |
|
5226 |
|
5227 const preventDefault = event => { |
|
5228 event.preventDefault(); |
|
5229 }; |
|
5230 |
|
5231 function HeaderToolbar() { |
|
5232 const inserterButton = (0,external_wp_element_namespaceObject.useRef)(); |
|
5233 const { |
|
5234 setIsInserterOpened, |
|
5235 setIsListViewOpened |
|
5236 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
5237 const { |
|
5238 isInserterEnabled, |
|
5239 isInserterOpened, |
|
5240 isTextModeEnabled, |
|
5241 showIconLabels, |
|
5242 isListViewOpen, |
|
5243 listViewShortcut |
|
5244 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5245 const { |
|
5246 hasInserterItems, |
|
5247 getBlockRootClientId, |
|
5248 getBlockSelectionEnd |
|
5249 } = select(external_wp_blockEditor_namespaceObject.store); |
|
5250 const { |
|
5251 getEditorSettings |
|
5252 } = select(external_wp_editor_namespaceObject.store); |
|
5253 const { |
|
5254 getEditorMode, |
|
5255 isFeatureActive, |
|
5256 isListViewOpened |
|
5257 } = select(store_store); |
|
5258 const { |
|
5259 getShortcutRepresentation |
|
5260 } = select(external_wp_keyboardShortcuts_namespaceObject.store); |
|
5261 return { |
|
5262 // This setting (richEditingEnabled) should not live in the block editor's setting. |
|
5263 isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())), |
|
5264 isInserterOpened: select(store_store).isInserterOpened(), |
|
5265 isTextModeEnabled: getEditorMode() === 'text', |
|
5266 showIconLabels: isFeatureActive('showIconLabels'), |
|
5267 isListViewOpen: isListViewOpened(), |
|
5268 listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view') |
|
5269 }; |
|
5270 }, []); |
|
5271 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); |
|
5272 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide'); |
|
5273 /* translators: accessibility text for the editor toolbar */ |
|
5274 |
|
5275 const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools'); |
|
5276 |
|
5277 const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); |
|
5278 const overflowItems = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { |
|
5279 as: external_wp_editor_namespaceObject.TableOfContents, |
|
5280 hasOutlineItemsDisabled: isTextModeEnabled, |
|
5281 repositionDropdown: showIconLabels && !isWideViewport, |
|
5282 showTooltip: !showIconLabels, |
|
5283 variant: showIconLabels ? 'tertiary' : undefined |
|
5284 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { |
|
5285 as: external_wp_components_namespaceObject.Button, |
|
5286 className: "edit-post-header-toolbar__list-view-toggle", |
|
5287 icon: list_view, |
|
5288 disabled: isTextModeEnabled, |
|
5289 isPressed: isListViewOpen |
|
5290 /* translators: button label text should, if possible, be under 16 characters. */ |
|
5291 , |
|
5292 label: (0,external_wp_i18n_namespaceObject.__)('List View'), |
|
5293 onClick: toggleListView, |
|
5294 shortcut: listViewShortcut, |
|
5295 showTooltip: !showIconLabels |
|
5296 })); |
|
5297 const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => { |
|
5298 if (isInserterOpened) { |
|
5299 // Focusing the inserter button closes the inserter popover. |
|
5300 inserterButton.current.focus(); |
|
5301 } else { |
|
5302 setIsInserterOpened(true); |
|
5303 } |
|
5304 }, [isInserterOpened, setIsInserterOpened]); |
|
5305 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, { |
|
5306 className: "edit-post-header-toolbar", |
|
5307 "aria-label": toolbarAriaLabel |
|
5308 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5309 className: "edit-post-header-toolbar__left" |
|
5310 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { |
|
5311 ref: inserterButton, |
|
5312 as: external_wp_components_namespaceObject.Button, |
|
5313 className: "edit-post-header-toolbar__inserter-toggle", |
|
5314 variant: "primary", |
|
5315 isPressed: isInserterOpened, |
|
5316 onMouseDown: preventDefault, |
|
5317 onClick: openInserter, |
|
5318 disabled: !isInserterEnabled, |
|
5319 icon: library_plus |
|
5320 /* translators: button label text should, if possible, be under 16 |
|
5321 characters. */ |
|
5322 , |
|
5323 label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button'), |
|
5324 showTooltip: !showIconLabels |
|
5325 }, showIconLabels && (!isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'))), (isWideViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { |
|
5326 as: external_wp_blockEditor_namespaceObject.ToolSelector, |
|
5327 showTooltip: !showIconLabels, |
|
5328 variant: showIconLabels ? 'tertiary' : undefined, |
|
5329 disabled: isTextModeEnabled |
|
5330 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { |
|
5331 as: external_wp_editor_namespaceObject.EditorHistoryUndo, |
|
5332 showTooltip: !showIconLabels, |
|
5333 variant: showIconLabels ? 'tertiary' : undefined |
|
5334 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { |
|
5335 as: external_wp_editor_namespaceObject.EditorHistoryRedo, |
|
5336 showTooltip: !showIconLabels, |
|
5337 variant: showIconLabels ? 'tertiary' : undefined |
|
5338 }), overflowItems))); |
|
5339 } |
|
5340 |
|
5341 /* harmony default export */ var header_toolbar = (HeaderToolbar); |
|
5342 |
|
5343 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/mode-switcher/index.js |
|
5344 |
|
5345 |
|
5346 /** |
|
5347 * WordPress dependencies |
|
5348 */ |
|
5349 |
|
5350 |
|
5351 |
|
5352 |
|
5353 |
|
5354 /** |
|
5355 * Internal dependencies |
|
5356 */ |
|
5357 |
|
5358 |
|
5359 /** |
|
5360 * Set of available mode options. |
|
5361 * |
|
5362 * @type {Array} |
|
5363 */ |
|
5364 |
|
5365 const MODES = [{ |
|
5366 value: 'visual', |
|
5367 label: (0,external_wp_i18n_namespaceObject.__)('Visual editor') |
|
5368 }, { |
|
5369 value: 'text', |
|
5370 label: (0,external_wp_i18n_namespaceObject.__)('Code editor') |
|
5371 }]; |
|
5372 |
|
5373 function ModeSwitcher() { |
|
5374 const { |
|
5375 shortcut, |
|
5376 isRichEditingEnabled, |
|
5377 isCodeEditingEnabled, |
|
5378 isEditingTemplate, |
|
5379 mode |
|
5380 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
5381 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-mode'), |
|
5382 isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled, |
|
5383 isCodeEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().codeEditingEnabled, |
|
5384 isEditingTemplate: select(store_store).isEditingTemplate(), |
|
5385 mode: select(store_store).getEditorMode() |
|
5386 }), []); |
|
5387 const { |
|
5388 switchEditorMode |
|
5389 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
5390 |
|
5391 if (isEditingTemplate) { |
|
5392 return null; |
|
5393 } |
|
5394 |
|
5395 if (!isRichEditingEnabled || !isCodeEditingEnabled) { |
|
5396 return null; |
|
5397 } |
|
5398 |
|
5399 const choices = MODES.map(choice => { |
|
5400 if (choice.value !== mode) { |
|
5401 return { ...choice, |
|
5402 shortcut |
|
5403 }; |
|
5404 } |
|
5405 |
|
5406 return choice; |
|
5407 }); |
|
5408 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
5409 label: (0,external_wp_i18n_namespaceObject.__)('Editor') |
|
5410 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { |
|
5411 choices: choices, |
|
5412 value: mode, |
|
5413 onSelect: switchEditorMode |
|
5414 })); |
|
5415 } |
|
5416 |
|
5417 /* harmony default export */ var mode_switcher = (ModeSwitcher); |
|
5418 |
|
5419 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/preferences-menu-item/index.js |
|
5420 |
|
5421 |
|
5422 /** |
|
5423 * WordPress dependencies |
|
5424 */ |
|
5425 |
|
5426 |
|
5427 |
|
5428 /** |
|
5429 * Internal dependencies |
|
5430 */ |
|
5431 |
|
5432 |
|
5433 function PreferencesMenuItem() { |
|
5434 const { |
|
5435 openModal |
|
5436 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
5437 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
5438 onClick: () => { |
|
5439 openModal('edit-post/preferences'); |
|
5440 } |
|
5441 }, (0,external_wp_i18n_namespaceObject.__)('Preferences')); |
|
5442 } |
|
5443 |
|
5444 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/writing-menu/index.js |
|
5445 |
|
5446 |
|
5447 /** |
|
5448 * WordPress dependencies |
|
5449 */ |
|
5450 |
|
5451 |
|
5452 |
|
5453 |
|
5454 |
|
5455 |
|
5456 function WritingMenu() { |
|
5457 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); |
|
5458 |
|
5459 if (!isLargeViewport) { |
|
5460 return null; |
|
5461 } |
|
5462 |
|
5463 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
5464 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun') |
|
5465 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { |
|
5466 scope: "core/edit-post", |
|
5467 name: "fixedToolbar", |
|
5468 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), |
|
5469 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), |
|
5470 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), |
|
5471 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') |
|
5472 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { |
|
5473 scope: "core/edit-post", |
|
5474 name: "focusMode", |
|
5475 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'), |
|
5476 info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'), |
|
5477 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'), |
|
5478 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated') |
|
5479 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { |
|
5480 scope: "core/edit-post", |
|
5481 name: "fullscreenMode", |
|
5482 label: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode'), |
|
5483 info: (0,external_wp_i18n_namespaceObject.__)('Work without distraction'), |
|
5484 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode activated'), |
|
5485 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode deactivated'), |
|
5486 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('f') |
|
5487 })); |
|
5488 } |
|
5489 |
|
5490 /* harmony default export */ var writing_menu = (WritingMenu); |
|
5491 |
|
5492 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/more-menu/index.js |
|
5493 |
|
5494 |
|
5495 /** |
|
5496 * WordPress dependencies |
|
5497 */ |
|
5498 |
|
5499 |
|
5500 |
|
5501 |
|
5502 /** |
|
5503 * Internal dependencies |
|
5504 */ |
|
5505 |
|
5506 |
|
5507 |
|
5508 |
|
5509 |
|
5510 |
|
5511 const MoreMenu = _ref => { |
|
5512 let { |
|
5513 showIconLabels |
|
5514 } = _ref; |
|
5515 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); |
|
5516 return (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, { |
|
5517 toggleProps: { |
|
5518 showTooltip: !showIconLabels, |
|
5519 ...(showIconLabels && { |
|
5520 variant: 'tertiary' |
|
5521 }) |
|
5522 } |
|
5523 }, _ref2 => { |
|
5524 let { |
|
5525 onClose |
|
5526 } = _ref2; |
|
5527 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, { |
|
5528 className: showIconLabels && 'show-icon-labels', |
|
5529 scope: "core/edit-post" |
|
5530 }), (0,external_wp_element_namespaceObject.createElement)(writing_menu, null), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, { |
|
5531 name: "core/edit-post/plugin-more-menu", |
|
5532 label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), |
|
5533 as: external_wp_components_namespaceObject.MenuGroup, |
|
5534 fillProps: { |
|
5535 onClick: onClose |
|
5536 } |
|
5537 }), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, { |
|
5538 fillProps: { |
|
5539 onClose |
|
5540 } |
|
5541 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(PreferencesMenuItem, null))); |
|
5542 }); |
|
5543 }; |
|
5544 |
|
5545 /* harmony default export */ var more_menu = (MoreMenu); |
|
5546 |
|
5547 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/post-publish-button-or-toggle.js |
|
5548 |
|
5549 |
|
5550 /** |
|
5551 * External dependencies |
|
5552 */ |
|
5553 |
|
5554 /** |
|
5555 * WordPress dependencies |
|
5556 */ |
|
5557 |
|
5558 |
|
5559 |
|
5560 |
|
5561 /** |
|
5562 * Internal dependencies |
|
5563 */ |
|
5564 |
|
5565 |
|
5566 function PostPublishButtonOrToggle(_ref) { |
|
5567 let { |
|
5568 forceIsDirty, |
|
5569 forceIsSaving, |
|
5570 hasPublishAction, |
|
5571 isBeingScheduled, |
|
5572 isPending, |
|
5573 isPublished, |
|
5574 isPublishSidebarEnabled, |
|
5575 isPublishSidebarOpened, |
|
5576 isScheduled, |
|
5577 togglePublishSidebar, |
|
5578 setEntitiesSavedStatesCallback |
|
5579 } = _ref; |
|
5580 const IS_TOGGLE = 'toggle'; |
|
5581 const IS_BUTTON = 'button'; |
|
5582 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); |
|
5583 let component; |
|
5584 /** |
|
5585 * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar): |
|
5586 * |
|
5587 * 1) We want to show a BUTTON when the post status is at the _final stage_ |
|
5588 * for a particular role (see https://wordpress.org/support/article/post-status/): |
|
5589 * |
|
5590 * - is published |
|
5591 * - is scheduled to be published |
|
5592 * - is pending and can't be published (but only for viewports >= medium). |
|
5593 * Originally, we considered showing a button for pending posts that couldn't be published |
|
5594 * (for example, for an author with the contributor role). Some languages can have |
|
5595 * long translations for "Submit for review", so given the lack of UI real estate available |
|
5596 * we decided to take into account the viewport in that case. |
|
5597 * See: https://github.com/WordPress/gutenberg/issues/10475 |
|
5598 * |
|
5599 * 2) Then, in small viewports, we'll show a TOGGLE. |
|
5600 * |
|
5601 * 3) Finally, we'll use the publish sidebar status to decide: |
|
5602 * |
|
5603 * - if it is enabled, we show a TOGGLE |
|
5604 * - if it is disabled, we show a BUTTON |
|
5605 */ |
|
5606 |
|
5607 if (isPublished || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) { |
|
5608 component = IS_BUTTON; |
|
5609 } else if (isSmallerThanMediumViewport) { |
|
5610 component = IS_TOGGLE; |
|
5611 } else if (isPublishSidebarEnabled) { |
|
5612 component = IS_TOGGLE; |
|
5613 } else { |
|
5614 component = IS_BUTTON; |
|
5615 } |
|
5616 |
|
5617 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishButton, { |
|
5618 forceIsDirty: forceIsDirty, |
|
5619 forceIsSaving: forceIsSaving, |
|
5620 isOpen: isPublishSidebarOpened, |
|
5621 isToggle: component === IS_TOGGLE, |
|
5622 onToggle: togglePublishSidebar, |
|
5623 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback |
|
5624 }); |
|
5625 } |
|
5626 /* harmony default export */ var post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({ |
|
5627 hasPublishAction: (0,external_lodash_namespaceObject.get)(select(external_wp_editor_namespaceObject.store).getCurrentPost(), ['_links', 'wp:action-publish'], false), |
|
5628 isBeingScheduled: select(external_wp_editor_namespaceObject.store).isEditedPostBeingScheduled(), |
|
5629 isPending: select(external_wp_editor_namespaceObject.store).isCurrentPostPending(), |
|
5630 isPublished: select(external_wp_editor_namespaceObject.store).isCurrentPostPublished(), |
|
5631 isPublishSidebarEnabled: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled(), |
|
5632 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), |
|
5633 isScheduled: select(external_wp_editor_namespaceObject.store).isCurrentPostScheduled() |
|
5634 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
|
5635 const { |
|
5636 togglePublishSidebar |
|
5637 } = dispatch(store_store); |
|
5638 return { |
|
5639 togglePublishSidebar |
|
5640 }; |
|
5641 }))(PostPublishButtonOrToggle)); |
|
5642 |
|
5643 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/device-preview/index.js |
|
5644 |
|
5645 |
|
5646 /** |
|
5647 * WordPress dependencies |
|
5648 */ |
|
5649 |
|
5650 |
|
5651 |
|
5652 |
|
5653 |
|
5654 |
|
5655 /** |
|
5656 * Internal dependencies |
|
5657 */ |
|
5658 |
|
5659 |
|
5660 function DevicePreview() { |
|
5661 const { |
|
5662 hasActiveMetaboxes, |
|
5663 isPostSaveable, |
|
5664 isSaving, |
|
5665 deviceType |
|
5666 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
5667 hasActiveMetaboxes: select(store_store).hasMetaBoxes(), |
|
5668 isSaving: select(store_store).isSavingMetaBoxes(), |
|
5669 isPostSaveable: select(external_wp_editor_namespaceObject.store).isEditedPostSaveable(), |
|
5670 deviceType: select(store_store).__experimentalGetPreviewDeviceType() |
|
5671 }), []); |
|
5672 const { |
|
5673 __experimentalSetPreviewDeviceType: setPreviewDeviceType |
|
5674 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
5675 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, { |
|
5676 isEnabled: isPostSaveable, |
|
5677 className: "edit-post-post-preview-dropdown", |
|
5678 deviceType: deviceType, |
|
5679 setDeviceType: setPreviewDeviceType |
|
5680 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5681 className: "edit-post-header-preview__grouping-external" |
|
5682 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, { |
|
5683 className: 'edit-post-header-preview__button-external', |
|
5684 role: "menuitem", |
|
5685 forceIsAutosaveable: hasActiveMetaboxes, |
|
5686 forcePreviewLink: isSaving ? null : undefined, |
|
5687 textContent: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
|
5688 icon: library_external |
|
5689 })) |
|
5690 })))); |
|
5691 } |
|
5692 |
|
5693 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/main-dashboard-button/index.js |
|
5694 |
|
5695 |
|
5696 /** |
|
5697 * WordPress dependencies |
|
5698 */ |
|
5699 |
|
5700 const slotName = '__experimentalMainDashboardButton'; |
|
5701 const { |
|
5702 Fill: main_dashboard_button_Fill, |
|
5703 Slot: MainDashboardButtonSlot |
|
5704 } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); |
|
5705 const MainDashboardButton = main_dashboard_button_Fill; |
|
5706 |
|
5707 const main_dashboard_button_Slot = _ref => { |
|
5708 let { |
|
5709 children |
|
5710 } = _ref; |
|
5711 const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName); |
|
5712 const hasFills = Boolean(slot.fills && slot.fills.length); |
|
5713 |
|
5714 if (!hasFills) { |
|
5715 return children; |
|
5716 } |
|
5717 |
|
5718 return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, { |
|
5719 bubblesVirtually: true |
|
5720 }); |
|
5721 }; |
|
5722 |
|
5723 MainDashboardButton.Slot = main_dashboard_button_Slot; |
|
5724 /* harmony default export */ var main_dashboard_button = (MainDashboardButton); |
|
5725 |
|
5726 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js |
|
5727 |
|
5728 |
|
5729 /** |
|
5730 * WordPress dependencies |
|
5731 */ |
|
5732 |
|
5733 const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5734 viewBox: "0 0 24 24", |
|
5735 xmlns: "http://www.w3.org/2000/svg" |
|
5736 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5737 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" |
|
5738 })); |
|
5739 /* harmony default export */ var chevron_down = (chevronDown); |
|
5740 |
|
5741 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/delete-template.js |
|
5742 |
|
5743 |
|
5744 /** |
|
5745 * External dependencies |
|
5746 */ |
|
5747 |
|
5748 /** |
|
5749 * WordPress dependencies |
|
5750 */ |
|
5751 |
|
5752 |
|
5753 |
|
5754 |
|
5755 |
|
5756 |
|
5757 |
|
5758 |
|
5759 /** |
|
5760 * Internal dependencies |
|
5761 */ |
|
5762 |
|
5763 |
|
5764 function DeleteTemplate() { |
|
5765 const { |
|
5766 clearSelectedBlock |
|
5767 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
|
5768 const { |
|
5769 setIsEditingTemplate |
|
5770 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
5771 const { |
|
5772 getEditorSettings |
|
5773 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); |
|
5774 const { |
|
5775 updateEditorSettings, |
|
5776 editPost |
|
5777 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); |
|
5778 const { |
|
5779 deleteEntityRecord |
|
5780 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
5781 const { |
|
5782 template |
|
5783 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5784 const { |
|
5785 isEditingTemplate, |
|
5786 getEditedPostTemplate |
|
5787 } = select(store_store); |
|
5788 |
|
5789 const _isEditing = isEditingTemplate(); |
|
5790 |
|
5791 return { |
|
5792 template: _isEditing ? getEditedPostTemplate() : null |
|
5793 }; |
|
5794 }, []); |
|
5795 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); |
|
5796 |
|
5797 if (!template || !template.wp_id) { |
|
5798 return null; |
|
5799 } |
|
5800 |
|
5801 let templateTitle = template.slug; |
|
5802 |
|
5803 if (template !== null && template !== void 0 && template.title) { |
|
5804 templateTitle = template.title; |
|
5805 } |
|
5806 |
|
5807 const onDelete = () => { |
|
5808 clearSelectedBlock(); |
|
5809 setIsEditingTemplate(false); |
|
5810 setShowConfirmDialog(false); |
|
5811 editPost({ |
|
5812 template: '' |
|
5813 }); |
|
5814 const settings = getEditorSettings(); |
|
5815 const newAvailableTemplates = (0,external_lodash_namespaceObject.pickBy)(settings.availableTemplates, (_title, id) => { |
|
5816 return id !== template.slug; |
|
5817 }); |
|
5818 updateEditorSettings({ ...settings, |
|
5819 availableTemplates: newAvailableTemplates |
|
5820 }); |
|
5821 deleteEntityRecord('postType', 'wp_template', template.id, { |
|
5822 throwOnError: true |
|
5823 }); |
|
5824 }; |
|
5825 |
|
5826 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { |
|
5827 className: "edit-post-template-top-area__second-menu-group" |
|
5828 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
5829 className: "edit-post-template-top-area__delete-template-button", |
|
5830 isDestructive: true, |
|
5831 variant: "secondary", |
|
5832 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Delete template'), |
|
5833 onClick: () => { |
|
5834 setShowConfirmDialog(true); |
|
5835 } |
|
5836 }, (0,external_wp_i18n_namespaceObject.__)('Delete template')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { |
|
5837 isOpen: showConfirmDialog, |
|
5838 onConfirm: onDelete, |
|
5839 onCancel: () => { |
|
5840 setShowConfirmDialog(false); |
|
5841 } |
|
5842 }, (0,external_wp_i18n_namespaceObject.sprintf)( |
|
5843 /* translators: %s: template name */ |
|
5844 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete the %s template? It may be used by other pages or posts.'), templateTitle)))); |
|
5845 } |
|
5846 |
|
5847 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/edit-template-title.js |
|
5848 |
|
5849 |
|
5850 /** |
|
5851 * External dependencies |
|
5852 */ |
|
5853 |
|
5854 /** |
|
5855 * WordPress dependencies |
|
5856 */ |
|
5857 |
|
5858 |
|
5859 |
|
5860 |
|
5861 |
|
5862 |
|
5863 /** |
|
5864 * Internal dependencies |
|
5865 */ |
|
5866 |
|
5867 |
|
5868 function EditTemplateTitle() { |
|
5869 const { |
|
5870 template |
|
5871 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5872 const { |
|
5873 getEditedPostTemplate |
|
5874 } = select(store_store); |
|
5875 return { |
|
5876 template: getEditedPostTemplate() |
|
5877 }; |
|
5878 }, []); |
|
5879 const { |
|
5880 editEntityRecord |
|
5881 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
5882 const { |
|
5883 getEditorSettings |
|
5884 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); |
|
5885 const { |
|
5886 updateEditorSettings |
|
5887 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); // Only user-created and non-default templates can change the name. |
|
5888 |
|
5889 if (!template.is_custom || template.has_theme_file) { |
|
5890 return null; |
|
5891 } |
|
5892 |
|
5893 let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default'); |
|
5894 |
|
5895 if (template !== null && template !== void 0 && template.title) { |
|
5896 templateTitle = template.title; |
|
5897 } else if (!!template) { |
|
5898 templateTitle = template.slug; |
|
5899 } |
|
5900 |
|
5901 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
5902 label: (0,external_wp_i18n_namespaceObject.__)('Title'), |
|
5903 value: templateTitle, |
|
5904 help: (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'), |
|
5905 onChange: newTitle => { |
|
5906 const settings = getEditorSettings(); |
|
5907 const newAvailableTemplates = (0,external_lodash_namespaceObject.mapValues)(settings.availableTemplates, (existingTitle, id) => { |
|
5908 if (id !== template.slug) { |
|
5909 return existingTitle; |
|
5910 } |
|
5911 |
|
5912 return newTitle; |
|
5913 }); |
|
5914 updateEditorSettings({ ...settings, |
|
5915 availableTemplates: newAvailableTemplates |
|
5916 }); |
|
5917 editEntityRecord('postType', 'wp_template', template.id, { |
|
5918 title: newTitle |
|
5919 }); |
|
5920 } |
|
5921 }); |
|
5922 } |
|
5923 |
|
5924 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/template-description.js |
|
5925 |
|
5926 |
|
5927 /** |
|
5928 * WordPress dependencies |
|
5929 */ |
|
5930 |
|
5931 |
|
5932 /** |
|
5933 * Internal dependencies |
|
5934 */ |
|
5935 |
|
5936 |
|
5937 function TemplateDescription() { |
|
5938 const { |
|
5939 description, |
|
5940 title |
|
5941 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5942 const { |
|
5943 getEditedPostTemplate |
|
5944 } = select(store_store); |
|
5945 return { |
|
5946 title: getEditedPostTemplate().title, |
|
5947 description: getEditedPostTemplate().description |
|
5948 }; |
|
5949 }, []); |
|
5950 |
|
5951 if (!description) { |
|
5952 return null; |
|
5953 } |
|
5954 |
|
5955 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, { |
|
5956 level: 4, |
|
5957 weight: 600 |
|
5958 }, title), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
|
5959 className: "edit-post-template-details__description", |
|
5960 size: "body", |
|
5961 as: "p", |
|
5962 style: { |
|
5963 marginTop: '12px' |
|
5964 } |
|
5965 }, description)); |
|
5966 } |
|
5967 |
|
5968 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/index.js |
|
5969 |
|
5970 |
|
5971 /** |
|
5972 * WordPress dependencies |
|
5973 */ |
|
5974 |
|
5975 |
|
5976 |
|
5977 |
|
5978 /** |
|
5979 * Internal dependencies |
|
5980 */ |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 |
|
5986 |
|
5987 |
|
5988 |
|
5989 function TemplateTitle() { |
|
5990 const { |
|
5991 template, |
|
5992 isEditing, |
|
5993 title |
|
5994 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5995 const { |
|
5996 isEditingTemplate, |
|
5997 getEditedPostTemplate |
|
5998 } = select(store_store); |
|
5999 const { |
|
6000 getEditedPostAttribute |
|
6001 } = select(external_wp_editor_namespaceObject.store); |
|
6002 |
|
6003 const _isEditing = isEditingTemplate(); |
|
6004 |
|
6005 return { |
|
6006 template: _isEditing ? getEditedPostTemplate() : null, |
|
6007 isEditing: _isEditing, |
|
6008 title: getEditedPostAttribute('title') ? getEditedPostAttribute('title') : (0,external_wp_i18n_namespaceObject.__)('Untitled') |
|
6009 }; |
|
6010 }, []); |
|
6011 const { |
|
6012 clearSelectedBlock |
|
6013 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
|
6014 const { |
|
6015 setIsEditingTemplate |
|
6016 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
6017 |
|
6018 if (!isEditing || !template) { |
|
6019 return null; |
|
6020 } |
|
6021 |
|
6022 let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default'); |
|
6023 |
|
6024 if (template !== null && template !== void 0 && template.title) { |
|
6025 templateTitle = template.title; |
|
6026 } else if (!!template) { |
|
6027 templateTitle = template.slug; |
|
6028 } |
|
6029 |
|
6030 const hasOptions = !!(template.custom || template.wp_id || template.description); |
|
6031 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6032 className: "edit-post-template-top-area" |
|
6033 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6034 className: "edit-post-template-post-title", |
|
6035 isLink: true, |
|
6036 showTooltip: true, |
|
6037 label: (0,external_wp_i18n_namespaceObject.sprintf)( |
|
6038 /* translators: %s: Title of the referring post, e.g: "Hello World!" */ |
|
6039 (0,external_wp_i18n_namespaceObject.__)('Edit %s'), title), |
|
6040 onClick: () => { |
|
6041 clearSelectedBlock(); |
|
6042 setIsEditingTemplate(false); |
|
6043 } |
|
6044 }, title), hasOptions ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { |
|
6045 position: "bottom center", |
|
6046 contentClassName: "edit-post-template-top-area__popover", |
|
6047 renderToggle: _ref => { |
|
6048 let { |
|
6049 onToggle |
|
6050 } = _ref; |
|
6051 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6052 className: "edit-post-template-title", |
|
6053 isLink: true, |
|
6054 icon: chevron_down, |
|
6055 showTooltip: true, |
|
6056 onClick: onToggle, |
|
6057 label: (0,external_wp_i18n_namespaceObject.__)('Template Options') |
|
6058 }, templateTitle); |
|
6059 }, |
|
6060 renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, null), (0,external_wp_element_namespaceObject.createElement)(TemplateDescription, null), (0,external_wp_element_namespaceObject.createElement)(DeleteTemplate, null)) |
|
6061 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { |
|
6062 className: "edit-post-template-title", |
|
6063 size: "body", |
|
6064 style: { |
|
6065 lineHeight: '24px' |
|
6066 } |
|
6067 }, templateTitle)); |
|
6068 } |
|
6069 |
|
6070 /* harmony default export */ var template_title = (TemplateTitle); |
|
6071 |
|
6072 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/index.js |
|
6073 |
|
6074 |
|
6075 /** |
|
6076 * External dependencies |
|
6077 */ |
|
6078 |
|
6079 /** |
|
6080 * WordPress dependencies |
|
6081 */ |
|
6082 |
|
6083 |
|
6084 |
|
6085 |
|
6086 |
|
6087 /** |
|
6088 * Internal dependencies |
|
6089 */ |
|
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 |
|
6095 |
|
6096 |
|
6097 |
|
6098 |
|
6099 |
|
6100 function Header(_ref) { |
|
6101 let { |
|
6102 setEntitiesSavedStatesCallback |
|
6103 } = _ref; |
|
6104 const { |
|
6105 hasActiveMetaboxes, |
|
6106 isPublishSidebarOpened, |
|
6107 isSaving, |
|
6108 showIconLabels, |
|
6109 hasReducedUI |
|
6110 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
6111 hasActiveMetaboxes: select(store_store).hasMetaBoxes(), |
|
6112 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), |
|
6113 isSaving: select(store_store).isSavingMetaBoxes(), |
|
6114 showIconLabels: select(store_store).isFeatureActive('showIconLabels'), |
|
6115 hasReducedUI: select(store_store).isFeatureActive('reducedUI') |
|
6116 }), []); |
|
6117 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); |
|
6118 const classes = classnames_default()('edit-post-header', { |
|
6119 'has-reduced-ui': hasReducedUI |
|
6120 }); |
|
6121 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6122 className: classes |
|
6123 }, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode_close, { |
|
6124 showTooltip: true |
|
6125 })), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6126 className: "edit-post-header__toolbar" |
|
6127 }, (0,external_wp_element_namespaceObject.createElement)(header_toolbar, null), (0,external_wp_element_namespaceObject.createElement)(template_title, null)), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6128 className: "edit-post-header__settings" |
|
6129 }, !isPublishSidebarOpened && // This button isn't completely hidden by the publish sidebar. |
|
6130 // We can't hide the whole toolbar when the publish sidebar is open because |
|
6131 // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node. |
|
6132 // We track that DOM node to return focus to the PostPublishButtonOrToggle |
|
6133 // when the publish sidebar has been closed. |
|
6134 (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSavedState, { |
|
6135 forceIsDirty: hasActiveMetaboxes, |
|
6136 forceIsSaving: isSaving, |
|
6137 showIconLabels: showIconLabels |
|
6138 }), (0,external_wp_element_namespaceObject.createElement)(DevicePreview, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, { |
|
6139 forceIsAutosaveable: hasActiveMetaboxes, |
|
6140 forcePreviewLink: isSaving ? null : undefined |
|
6141 }), (0,external_wp_element_namespaceObject.createElement)(post_publish_button_or_toggle, { |
|
6142 forceIsDirty: hasActiveMetaboxes, |
|
6143 forceIsSaving: isSaving, |
|
6144 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback |
|
6145 }), (isLargeViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, { |
|
6146 scope: "core/edit-post" |
|
6147 }), (0,external_wp_element_namespaceObject.createElement)(more_menu, { |
|
6148 showIconLabels: showIconLabels |
|
6149 })), showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(more_menu, { |
|
6150 showIconLabels: showIconLabels |
|
6151 }))); |
|
6152 } |
|
6153 |
|
6154 /* harmony default export */ var header = (Header); |
|
6155 |
|
6156 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js |
|
6157 |
|
6158 |
|
6159 /** |
|
6160 * WordPress dependencies |
|
6161 */ |
|
6162 |
|
6163 const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
6164 xmlns: "http://www.w3.org/2000/svg", |
|
6165 viewBox: "0 0 24 24" |
|
6166 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
6167 d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" |
|
6168 })); |
|
6169 /* harmony default export */ var library_close = (close_close); |
|
6170 |
|
6171 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/inserter-sidebar.js |
|
6172 |
|
6173 |
|
6174 |
|
6175 /** |
|
6176 * WordPress dependencies |
|
6177 */ |
|
6178 |
|
6179 |
|
6180 |
|
6181 |
|
6182 |
|
6183 |
|
6184 |
|
6185 /** |
|
6186 * Internal dependencies |
|
6187 */ |
|
6188 |
|
6189 |
|
6190 function InserterSidebar() { |
|
6191 const { |
|
6192 insertionPoint, |
|
6193 showMostUsedBlocks |
|
6194 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
6195 const { |
|
6196 isFeatureActive, |
|
6197 __experimentalGetInsertionPoint |
|
6198 } = select(store_store); |
|
6199 return { |
|
6200 insertionPoint: __experimentalGetInsertionPoint(), |
|
6201 showMostUsedBlocks: isFeatureActive('mostUsedBlocks') |
|
6202 }; |
|
6203 }, []); |
|
6204 const { |
|
6205 setIsInserterOpened |
|
6206 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
6207 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); |
|
6208 const TagName = !isMobileViewport ? external_wp_components_namespaceObject.VisuallyHidden : 'div'; |
|
6209 const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ |
|
6210 onClose: () => setIsInserterOpened(false), |
|
6211 focusOnMount: null |
|
6212 }); |
|
6213 const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); |
|
6214 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
6215 libraryRef.current.focusSearch(); |
|
6216 }, []); |
|
6217 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ |
|
6218 ref: inserterDialogRef |
|
6219 }, inserterDialogProps, { |
|
6220 className: "edit-post-editor__inserter-panel" |
|
6221 }), (0,external_wp_element_namespaceObject.createElement)(TagName, { |
|
6222 className: "edit-post-editor__inserter-panel-header" |
|
6223 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6224 icon: library_close, |
|
6225 label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'), |
|
6226 onClick: () => setIsInserterOpened(false) |
|
6227 })), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6228 className: "edit-post-editor__inserter-panel-content" |
|
6229 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, { |
|
6230 showMostUsedBlocks: showMostUsedBlocks, |
|
6231 showInserterHelpPanel: true, |
|
6232 shouldFocusBlock: isMobileViewport, |
|
6233 rootClientId: insertionPoint.rootClientId, |
|
6234 __experimentalInsertionIndex: insertionPoint.insertionIndex, |
|
6235 __experimentalFilterValue: insertionPoint.filterValue, |
|
6236 ref: libraryRef |
|
6237 }))); |
|
6238 } |
|
6239 |
|
6240 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/list-view-sidebar.js |
|
6241 |
|
6242 |
|
6243 /** |
|
6244 * WordPress dependencies |
|
6245 */ |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 |
|
6253 /** |
|
6254 * Internal dependencies |
|
6255 */ |
|
6256 |
|
6257 |
|
6258 function ListViewSidebar() { |
|
6259 const { |
|
6260 setIsListViewOpened |
|
6261 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
6262 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); |
|
6263 const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); |
|
6264 const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)(); |
|
6265 |
|
6266 function closeOnEscape(event) { |
|
6267 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { |
|
6268 event.preventDefault(); |
|
6269 setIsListViewOpened(false); |
|
6270 } |
|
6271 } |
|
6272 |
|
6273 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar); |
|
6274 const labelId = `edit-post-editor__list-view-panel-label-${instanceId}`; |
|
6275 return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions |
|
6276 (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6277 "aria-labelledby": labelId, |
|
6278 className: "edit-post-editor__list-view-panel", |
|
6279 onKeyDown: closeOnEscape |
|
6280 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6281 className: "edit-post-editor__list-view-panel-header", |
|
6282 ref: headerFocusReturnRef |
|
6283 }, (0,external_wp_element_namespaceObject.createElement)("strong", { |
|
6284 id: labelId |
|
6285 }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6286 icon: close_small, |
|
6287 label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'), |
|
6288 onClick: () => setIsListViewOpened(false) |
|
6289 })), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6290 className: "edit-post-editor__list-view-panel-content", |
|
6291 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef]) |
|
6292 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, { |
|
6293 showNestedBlocks: true, |
|
6294 __experimentalFeatures: true, |
|
6295 __experimentalPersistentListViewFeatures: true |
|
6296 }))) |
|
6297 ); |
|
6298 } |
|
6299 |
|
6300 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js |
|
6301 |
|
6302 |
|
6303 /** |
|
6304 * WordPress dependencies |
|
6305 */ |
|
6306 |
|
6307 const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
6308 xmlns: "http://www.w3.org/2000/svg", |
|
6309 viewBox: "0 0 24 24" |
|
6310 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
6311 fillRule: "evenodd", |
|
6312 d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z", |
|
6313 clipRule: "evenodd" |
|
6314 })); |
|
6315 /* harmony default export */ var library_cog = (cog); |
|
6316 |
|
6317 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-header/index.js |
|
6318 |
|
6319 |
|
6320 /** |
|
6321 * WordPress dependencies |
|
6322 */ |
|
6323 |
|
6324 |
|
6325 |
|
6326 |
|
6327 /** |
|
6328 * Internal dependencies |
|
6329 */ |
|
6330 |
|
6331 |
|
6332 |
|
6333 const SettingsHeader = _ref => { |
|
6334 let { |
|
6335 sidebarName |
|
6336 } = _ref; |
|
6337 const { |
|
6338 openGeneralSidebar |
|
6339 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
6340 |
|
6341 const openDocumentSettings = () => openGeneralSidebar('edit-post/document'); |
|
6342 |
|
6343 const openBlockSettings = () => openGeneralSidebar('edit-post/block'); |
|
6344 |
|
6345 const { |
|
6346 documentLabel, |
|
6347 isTemplateMode |
|
6348 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
6349 const postTypeLabel = select(external_wp_editor_namespaceObject.store).getPostTypeLabel(); |
|
6350 return { |
|
6351 // translators: Default label for the Document sidebar tab, not selected. |
|
6352 documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'), |
|
6353 isTemplateMode: select(store_store).isEditingTemplate() |
|
6354 }; |
|
6355 }, []); |
|
6356 const [documentAriaLabel, documentActiveClass] = sidebarName === 'edit-post/document' ? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label. |
|
6357 [(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s (selected)'), documentLabel), 'is-active'] : [documentLabel, '']; |
|
6358 const [blockAriaLabel, blockActiveClass] = sidebarName === 'edit-post/block' ? // translators: ARIA label for the Block Settings Sidebar tab, selected. |
|
6359 [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected. |
|
6360 [(0,external_wp_i18n_namespaceObject.__)('Block'), '']; |
|
6361 const [templateAriaLabel, templateActiveClass] = sidebarName === 'edit-post/document' ? [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : [(0,external_wp_i18n_namespaceObject.__)('Template'), '']; |
|
6362 /* Use a list so screen readers will announce how many tabs there are. */ |
|
6363 |
|
6364 return (0,external_wp_element_namespaceObject.createElement)("ul", null, !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6365 onClick: openDocumentSettings, |
|
6366 className: `edit-post-sidebar__panel-tab ${documentActiveClass}`, |
|
6367 "aria-label": documentAriaLabel, |
|
6368 "data-label": documentLabel |
|
6369 }, documentLabel)), isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6370 onClick: openDocumentSettings, |
|
6371 className: `edit-post-sidebar__panel-tab ${templateActiveClass}`, |
|
6372 "aria-label": templateAriaLabel, |
|
6373 "data-label": (0,external_wp_i18n_namespaceObject.__)('Template') |
|
6374 }, (0,external_wp_i18n_namespaceObject.__)('Template'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6375 onClick: openBlockSettings, |
|
6376 className: `edit-post-sidebar__panel-tab ${blockActiveClass}`, |
|
6377 "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab. |
|
6378 , |
|
6379 "data-label": (0,external_wp_i18n_namespaceObject.__)('Block') |
|
6380 }, // translators: Text label for the Block Settings Sidebar tab. |
|
6381 (0,external_wp_i18n_namespaceObject.__)('Block')))); |
|
6382 }; |
|
6383 |
|
6384 /* harmony default export */ var settings_header = (SettingsHeader); |
|
6385 |
|
6386 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-visibility/index.js |
|
6387 |
|
6388 |
|
6389 /** |
|
6390 * WordPress dependencies |
|
6391 */ |
|
6392 |
|
6393 |
|
6394 |
|
6395 function PostVisibility() { |
|
6396 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityCheck, { |
|
6397 render: _ref => { |
|
6398 let { |
|
6399 canEdit |
|
6400 } = _ref; |
|
6401 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { |
|
6402 className: "edit-post-post-visibility" |
|
6403 }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Visibility')), !canEdit && (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null)), canEdit && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { |
|
6404 position: "bottom left", |
|
6405 contentClassName: "edit-post-post-visibility__dialog", |
|
6406 renderToggle: _ref2 => { |
|
6407 let { |
|
6408 isOpen, |
|
6409 onToggle |
|
6410 } = _ref2; |
|
6411 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6412 "aria-expanded": isOpen, |
|
6413 className: "edit-post-post-visibility__toggle", |
|
6414 onClick: onToggle, |
|
6415 variant: "tertiary" |
|
6416 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null)); |
|
6417 }, |
|
6418 renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibility, null) |
|
6419 })); |
|
6420 } |
|
6421 }); |
|
6422 } |
|
6423 /* harmony default export */ var post_visibility = (PostVisibility); |
|
6424 |
|
6425 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-trash/index.js |
|
6426 |
|
6427 |
|
6428 /** |
|
6429 * WordPress dependencies |
|
6430 */ |
|
6431 |
|
6432 |
|
6433 function PostTrash() { |
|
6434 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrashCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrash, null))); |
|
6435 } |
|
6436 |
|
6437 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-schedule/index.js |
|
6438 |
|
6439 |
|
6440 /** |
|
6441 * WordPress dependencies |
|
6442 */ |
|
6443 |
|
6444 |
|
6445 |
|
6446 |
|
6447 function PostSchedule() { |
|
6448 const anchorRef = (0,external_wp_element_namespaceObject.useRef)(); |
|
6449 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { |
|
6450 className: "edit-post-post-schedule", |
|
6451 ref: anchorRef |
|
6452 }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Publish')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { |
|
6453 popoverProps: { |
|
6454 anchorRef: anchorRef.current |
|
6455 }, |
|
6456 position: "bottom left", |
|
6457 contentClassName: "edit-post-post-schedule__dialog", |
|
6458 renderToggle: _ref => { |
|
6459 let { |
|
6460 onToggle, |
|
6461 isOpen |
|
6462 } = _ref; |
|
6463 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6464 className: "edit-post-post-schedule__toggle", |
|
6465 onClick: onToggle, |
|
6466 "aria-expanded": isOpen, |
|
6467 variant: "tertiary" |
|
6468 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleLabel, null))); |
|
6469 }, |
|
6470 renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSchedule, null) |
|
6471 }))); |
|
6472 } |
|
6473 /* harmony default export */ var post_schedule = (PostSchedule); |
|
6474 |
|
6475 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-sticky/index.js |
|
6476 |
|
6477 |
|
6478 /** |
|
6479 * WordPress dependencies |
|
6480 */ |
|
6481 |
|
6482 |
|
6483 function PostSticky() { |
|
6484 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostStickyCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSticky, null))); |
|
6485 } |
|
6486 /* harmony default export */ var post_sticky = (PostSticky); |
|
6487 |
|
6488 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-author/index.js |
|
6489 |
|
6490 |
|
6491 /** |
|
6492 * WordPress dependencies |
|
6493 */ |
|
6494 |
|
6495 |
|
6496 function PostAuthor() { |
|
6497 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthorCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { |
|
6498 className: "edit-post-post-author" |
|
6499 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthor, null))); |
|
6500 } |
|
6501 /* harmony default export */ var post_author = (PostAuthor); |
|
6502 |
|
6503 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-slug/index.js |
|
6504 |
|
6505 |
|
6506 /** |
|
6507 * WordPress dependencies |
|
6508 */ |
|
6509 |
|
6510 |
|
6511 function PostSlug() { |
|
6512 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlug, null))); |
|
6513 } |
|
6514 /* harmony default export */ var post_slug = (PostSlug); |
|
6515 |
|
6516 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-format/index.js |
|
6517 |
|
6518 |
|
6519 /** |
|
6520 * WordPress dependencies |
|
6521 */ |
|
6522 |
|
6523 |
|
6524 function PostFormat() { |
|
6525 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormatCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormat, null))); |
|
6526 } |
|
6527 /* harmony default export */ var post_format = (PostFormat); |
|
6528 |
|
6529 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-pending-status/index.js |
|
6530 |
|
6531 |
|
6532 /** |
|
6533 * WordPress dependencies |
|
6534 */ |
|
6535 |
|
6536 |
|
6537 function PostPendingStatus() { |
|
6538 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatusCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatus, null))); |
|
6539 } |
|
6540 /* harmony default export */ var post_pending_status = (PostPendingStatus); |
|
6541 |
|
6542 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-status-info/index.js |
|
6543 |
|
6544 |
|
6545 /** |
|
6546 * Defines as extensibility slot for the Status & visibility panel. |
|
6547 */ |
|
6548 |
|
6549 /** |
|
6550 * WordPress dependencies |
|
6551 */ |
|
6552 |
|
6553 const { |
|
6554 Fill: plugin_post_status_info_Fill, |
|
6555 Slot: plugin_post_status_info_Slot |
|
6556 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo'); |
|
6557 /** |
|
6558 * Renders a row in the Status & visibility panel of the Document sidebar. |
|
6559 * It should be noted that this is named and implemented around the function it serves |
|
6560 * and not its location, which may change in future iterations. |
|
6561 * |
|
6562 * @param {Object} props Component properties. |
|
6563 * @param {string} [props.className] An optional class name added to the row. |
|
6564 * @param {WPElement} props.children Children to be rendered. |
|
6565 * |
|
6566 * @example |
|
6567 * ```js |
|
6568 * // Using ES5 syntax |
|
6569 * var __ = wp.i18n.__; |
|
6570 * var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo; |
|
6571 * |
|
6572 * function MyPluginPostStatusInfo() { |
|
6573 * return wp.element.createElement( |
|
6574 * PluginPostStatusInfo, |
|
6575 * { |
|
6576 * className: 'my-plugin-post-status-info', |
|
6577 * }, |
|
6578 * __( 'My post status info' ) |
|
6579 * ) |
|
6580 * } |
|
6581 * ``` |
|
6582 * |
|
6583 * @example |
|
6584 * ```jsx |
|
6585 * // Using ESNext syntax |
|
6586 * import { __ } from '@wordpress/i18n'; |
|
6587 * import { PluginPostStatusInfo } from '@wordpress/edit-post'; |
|
6588 * |
|
6589 * const MyPluginPostStatusInfo = () => ( |
|
6590 * <PluginPostStatusInfo |
|
6591 * className="my-plugin-post-status-info" |
|
6592 * > |
|
6593 * { __( 'My post status info' ) } |
|
6594 * </PluginPostStatusInfo> |
|
6595 * ); |
|
6596 * ``` |
|
6597 * |
|
6598 * @return {WPComponent} The component to be rendered. |
|
6599 */ |
|
6600 |
|
6601 const PluginPostStatusInfo = _ref => { |
|
6602 let { |
|
6603 children, |
|
6604 className |
|
6605 } = _ref; |
|
6606 return (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { |
|
6607 className: className |
|
6608 }, children)); |
|
6609 }; |
|
6610 |
|
6611 PluginPostStatusInfo.Slot = plugin_post_status_info_Slot; |
|
6612 /* harmony default export */ var plugin_post_status_info = (PluginPostStatusInfo); |
|
6613 |
|
6614 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-status/index.js |
|
6615 |
|
6616 |
|
6617 /** |
|
6618 * WordPress dependencies |
|
6619 */ |
|
6620 |
|
6621 |
|
6622 |
|
6623 |
|
6624 /** |
|
6625 * Internal dependencies |
|
6626 */ |
|
6627 |
|
6628 |
|
6629 |
|
6630 |
|
6631 |
|
6632 |
|
6633 |
|
6634 |
|
6635 |
|
6636 |
|
6637 |
|
6638 /** |
|
6639 * Module Constants |
|
6640 */ |
|
6641 |
|
6642 const PANEL_NAME = 'post-status'; |
|
6643 |
|
6644 function PostStatus(_ref) { |
|
6645 let { |
|
6646 isOpened, |
|
6647 onTogglePanel |
|
6648 } = _ref; |
|
6649 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
6650 className: "edit-post-post-status", |
|
6651 title: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'), |
|
6652 opened: isOpened, |
|
6653 onToggle: onTogglePanel |
|
6654 }, (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info.Slot, null, fills => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_visibility, null), (0,external_wp_element_namespaceObject.createElement)(post_schedule, null), (0,external_wp_element_namespaceObject.createElement)(post_format, null), (0,external_wp_element_namespaceObject.createElement)(post_sticky, null), (0,external_wp_element_namespaceObject.createElement)(post_pending_status, null), (0,external_wp_element_namespaceObject.createElement)(post_slug, null), (0,external_wp_element_namespaceObject.createElement)(post_author, null), fills, (0,external_wp_element_namespaceObject.createElement)(PostTrash, null)))); |
|
6655 } |
|
6656 |
|
6657 /* harmony default export */ var post_status = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
|
6658 // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do |
|
6659 // not use isEditorPanelEnabled since this panel should not be disabled through the UI. |
|
6660 const { |
|
6661 isEditorPanelRemoved, |
|
6662 isEditorPanelOpened |
|
6663 } = select(store_store); |
|
6664 return { |
|
6665 isRemoved: isEditorPanelRemoved(PANEL_NAME), |
|
6666 isOpened: isEditorPanelOpened(PANEL_NAME) |
|
6667 }; |
|
6668 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => { |
|
6669 let { |
|
6670 isRemoved |
|
6671 } = _ref2; |
|
6672 return !isRemoved; |
|
6673 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
|
6674 onTogglePanel() { |
|
6675 return dispatch(store_store).toggleEditorPanelOpened(PANEL_NAME); |
|
6676 } |
|
6677 |
|
6678 }))])(PostStatus)); |
|
6679 |
|
6680 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/last-revision/index.js |
|
6681 |
|
6682 |
|
6683 /** |
|
6684 * WordPress dependencies |
|
6685 */ |
|
6686 |
|
6687 |
|
6688 |
|
6689 function LastRevision() { |
|
6690 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevisionCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
6691 className: "edit-post-last-revision__panel" |
|
6692 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevision, null))); |
|
6693 } |
|
6694 |
|
6695 /* harmony default export */ var last_revision = (LastRevision); |
|
6696 |
|
6697 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js |
|
6698 |
|
6699 |
|
6700 /** |
|
6701 * External dependencies |
|
6702 */ |
|
6703 |
|
6704 /** |
|
6705 * WordPress dependencies |
|
6706 */ |
|
6707 |
|
6708 |
|
6709 |
|
6710 |
|
6711 /** |
|
6712 * Internal dependencies |
|
6713 */ |
|
6714 |
|
6715 |
|
6716 |
|
6717 function TaxonomyPanel(_ref) { |
|
6718 let { |
|
6719 isEnabled, |
|
6720 taxonomy, |
|
6721 isOpened, |
|
6722 onTogglePanel, |
|
6723 children |
|
6724 } = _ref; |
|
6725 |
|
6726 if (!isEnabled) { |
|
6727 return null; |
|
6728 } |
|
6729 |
|
6730 const taxonomyMenuName = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']); |
|
6731 |
|
6732 if (!taxonomyMenuName) { |
|
6733 return null; |
|
6734 } |
|
6735 |
|
6736 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
6737 title: taxonomyMenuName, |
|
6738 opened: isOpened, |
|
6739 onToggle: onTogglePanel |
|
6740 }, children); |
|
6741 } |
|
6742 |
|
6743 /* harmony default export */ var taxonomy_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { |
|
6744 const slug = (0,external_lodash_namespaceObject.get)(ownProps.taxonomy, ['slug']); |
|
6745 const panelName = slug ? `taxonomy-panel-${slug}` : ''; |
|
6746 return { |
|
6747 panelName, |
|
6748 isEnabled: slug ? select(store_store).isEditorPanelEnabled(panelName) : false, |
|
6749 isOpened: slug ? select(store_store).isEditorPanelOpened(panelName) : false |
|
6750 }; |
|
6751 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({ |
|
6752 onTogglePanel: () => { |
|
6753 dispatch(store_store).toggleEditorPanelOpened(ownProps.panelName); |
|
6754 } |
|
6755 })))(TaxonomyPanel)); |
|
6756 |
|
6757 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/index.js |
|
6758 |
|
6759 |
|
6760 /** |
|
6761 * WordPress dependencies |
|
6762 */ |
|
6763 |
|
6764 /** |
|
6765 * Internal dependencies |
|
6766 */ |
|
6767 |
|
6768 |
|
6769 |
|
6770 function PostTaxonomies() { |
|
6771 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, { |
|
6772 taxonomyWrapper: (content, taxonomy) => { |
|
6773 return (0,external_wp_element_namespaceObject.createElement)(taxonomy_panel, { |
|
6774 taxonomy: taxonomy |
|
6775 }, content); |
|
6776 } |
|
6777 })); |
|
6778 } |
|
6779 |
|
6780 /* harmony default export */ var post_taxonomies = (PostTaxonomies); |
|
6781 |
|
6782 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/featured-image/index.js |
|
6783 |
|
6784 |
|
6785 /** |
|
6786 * External dependencies |
|
6787 */ |
|
6788 |
|
6789 /** |
|
6790 * WordPress dependencies |
|
6791 */ |
|
6792 |
|
6793 |
|
6794 |
|
6795 |
|
6796 |
|
6797 |
|
6798 |
|
6799 /** |
|
6800 * Internal dependencies |
|
6801 */ |
|
6802 |
|
6803 |
|
6804 /** |
|
6805 * Module Constants |
|
6806 */ |
|
6807 |
|
6808 const featured_image_PANEL_NAME = 'featured-image'; |
|
6809 |
|
6810 function FeaturedImage(_ref) { |
|
6811 let { |
|
6812 isEnabled, |
|
6813 isOpened, |
|
6814 postType, |
|
6815 onTogglePanel |
|
6816 } = _ref; |
|
6817 |
|
6818 if (!isEnabled) { |
|
6819 return null; |
|
6820 } |
|
6821 |
|
6822 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
6823 title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'featured_image'], (0,external_wp_i18n_namespaceObject.__)('Featured image')), |
|
6824 opened: isOpened, |
|
6825 onToggle: onTogglePanel |
|
6826 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImage, null))); |
|
6827 } |
|
6828 |
|
6829 const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => { |
|
6830 const { |
|
6831 getEditedPostAttribute |
|
6832 } = select(external_wp_editor_namespaceObject.store); |
|
6833 const { |
|
6834 getPostType |
|
6835 } = select(external_wp_coreData_namespaceObject.store); |
|
6836 const { |
|
6837 isEditorPanelEnabled, |
|
6838 isEditorPanelOpened |
|
6839 } = select(store_store); |
|
6840 return { |
|
6841 postType: getPostType(getEditedPostAttribute('type')), |
|
6842 isEnabled: isEditorPanelEnabled(featured_image_PANEL_NAME), |
|
6843 isOpened: isEditorPanelOpened(featured_image_PANEL_NAME) |
|
6844 }; |
|
6845 }); |
|
6846 const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
|
6847 const { |
|
6848 toggleEditorPanelOpened |
|
6849 } = dispatch(store_store); |
|
6850 return { |
|
6851 onTogglePanel: (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, featured_image_PANEL_NAME) |
|
6852 }; |
|
6853 }); |
|
6854 /* harmony default export */ var featured_image = ((0,external_wp_compose_namespaceObject.compose)(applyWithSelect, applyWithDispatch)(FeaturedImage)); |
|
6855 |
|
6856 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-excerpt/index.js |
|
6857 |
|
6858 |
|
6859 /** |
|
6860 * WordPress dependencies |
|
6861 */ |
|
6862 |
|
6863 |
|
6864 |
|
6865 |
|
6866 |
|
6867 /** |
|
6868 * Internal dependencies |
|
6869 */ |
|
6870 |
|
6871 |
|
6872 /** |
|
6873 * Module Constants |
|
6874 */ |
|
6875 |
|
6876 const post_excerpt_PANEL_NAME = 'post-excerpt'; |
|
6877 |
|
6878 function PostExcerpt(_ref) { |
|
6879 let { |
|
6880 isEnabled, |
|
6881 isOpened, |
|
6882 onTogglePanel |
|
6883 } = _ref; |
|
6884 |
|
6885 if (!isEnabled) { |
|
6886 return null; |
|
6887 } |
|
6888 |
|
6889 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
6890 title: (0,external_wp_i18n_namespaceObject.__)('Excerpt'), |
|
6891 opened: isOpened, |
|
6892 onToggle: onTogglePanel |
|
6893 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerpt, null))); |
|
6894 } |
|
6895 |
|
6896 /* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
|
6897 return { |
|
6898 isEnabled: select(store_store).isEditorPanelEnabled(post_excerpt_PANEL_NAME), |
|
6899 isOpened: select(store_store).isEditorPanelOpened(post_excerpt_PANEL_NAME) |
|
6900 }; |
|
6901 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
|
6902 onTogglePanel() { |
|
6903 return dispatch(store_store).toggleEditorPanelOpened(post_excerpt_PANEL_NAME); |
|
6904 } |
|
6905 |
|
6906 }))])(PostExcerpt)); |
|
6907 |
|
6908 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-link/index.js |
|
6909 |
|
6910 |
|
6911 /** |
|
6912 * External dependencies |
|
6913 */ |
|
6914 |
|
6915 /** |
|
6916 * WordPress dependencies |
|
6917 */ |
|
6918 |
|
6919 |
|
6920 |
|
6921 |
|
6922 |
|
6923 |
|
6924 |
|
6925 |
|
6926 |
|
6927 /** |
|
6928 * Internal dependencies |
|
6929 */ |
|
6930 |
|
6931 |
|
6932 /** |
|
6933 * Module Constants |
|
6934 */ |
|
6935 |
|
6936 const post_link_PANEL_NAME = 'post-link'; |
|
6937 |
|
6938 function PostLink(_ref) { |
|
6939 let { |
|
6940 isOpened, |
|
6941 onTogglePanel, |
|
6942 isEditable, |
|
6943 postLink, |
|
6944 permalinkPrefix, |
|
6945 permalinkSuffix, |
|
6946 editPermalink, |
|
6947 postSlug, |
|
6948 postTypeLabel |
|
6949 } = _ref; |
|
6950 const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false); |
|
6951 let prefixElement, postNameElement, suffixElement; |
|
6952 |
|
6953 if (isEditable) { |
|
6954 prefixElement = permalinkPrefix && (0,external_wp_element_namespaceObject.createElement)("span", { |
|
6955 className: "edit-post-post-link__link-prefix" |
|
6956 }, permalinkPrefix); |
|
6957 postNameElement = postSlug && (0,external_wp_element_namespaceObject.createElement)("span", { |
|
6958 className: "edit-post-post-link__link-post-name" |
|
6959 }, postSlug); |
|
6960 suffixElement = permalinkSuffix && (0,external_wp_element_namespaceObject.createElement)("span", { |
|
6961 className: "edit-post-post-link__link-suffix" |
|
6962 }, permalinkSuffix); |
|
6963 } |
|
6964 |
|
6965 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
6966 title: (0,external_wp_i18n_namespaceObject.__)('Permalink'), |
|
6967 opened: isOpened, |
|
6968 onToggle: onTogglePanel |
|
6969 }, isEditable && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6970 className: "editor-post-link" |
|
6971 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
6972 label: (0,external_wp_i18n_namespaceObject.__)('URL Slug'), |
|
6973 value: forceEmptyField ? '' : postSlug, |
|
6974 autoComplete: "off", |
|
6975 spellCheck: "false", |
|
6976 onChange: newValue => { |
|
6977 editPermalink(newValue); // When we delete the field the permalink gets |
|
6978 // reverted to the original value. |
|
6979 // The forceEmptyField logic allows the user to have |
|
6980 // the field temporarily empty while typing. |
|
6981 |
|
6982 if (!newValue) { |
|
6983 if (!forceEmptyField) { |
|
6984 setForceEmptyField(true); |
|
6985 } |
|
6986 |
|
6987 return; |
|
6988 } |
|
6989 |
|
6990 if (forceEmptyField) { |
|
6991 setForceEmptyField(false); |
|
6992 } |
|
6993 }, |
|
6994 onBlur: event => { |
|
6995 editPermalink((0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value)); |
|
6996 |
|
6997 if (forceEmptyField) { |
|
6998 setForceEmptyField(false); |
|
6999 } |
|
7000 } |
|
7001 }), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('The last part of the URL.'), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { |
|
7002 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/settings-sidebar/#permalink') |
|
7003 }, (0,external_wp_i18n_namespaceObject.__)('Read about permalinks')))), (0,external_wp_element_namespaceObject.createElement)("h3", { |
|
7004 className: "edit-post-post-link__preview-label" |
|
7005 }, postTypeLabel || (0,external_wp_i18n_namespaceObject.__)('View post')), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
7006 className: "edit-post-post-link__preview-link-container" |
|
7007 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { |
|
7008 className: "edit-post-post-link__link", |
|
7009 href: postLink, |
|
7010 target: "_blank" |
|
7011 }, isEditable ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, prefixElement, postNameElement, suffixElement) : postLink))); |
|
7012 } |
|
7013 |
|
7014 /* harmony default export */ var post_link = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
|
7015 const { |
|
7016 isPermalinkEditable, |
|
7017 getCurrentPost, |
|
7018 isCurrentPostPublished, |
|
7019 getPermalinkParts, |
|
7020 getEditedPostAttribute, |
|
7021 getEditedPostSlug |
|
7022 } = select(external_wp_editor_namespaceObject.store); |
|
7023 const { |
|
7024 isEditorPanelEnabled, |
|
7025 isEditorPanelOpened |
|
7026 } = select(store_store); |
|
7027 const { |
|
7028 getPostType |
|
7029 } = select(external_wp_coreData_namespaceObject.store); |
|
7030 const { |
|
7031 link |
|
7032 } = getCurrentPost(); |
|
7033 const postTypeName = getEditedPostAttribute('type'); |
|
7034 const postType = getPostType(postTypeName); |
|
7035 const permalinkParts = getPermalinkParts(); |
|
7036 return { |
|
7037 postLink: link, |
|
7038 isEditable: isPermalinkEditable(), |
|
7039 isPublished: isCurrentPostPublished(), |
|
7040 isOpened: isEditorPanelOpened(post_link_PANEL_NAME), |
|
7041 isEnabled: isEditorPanelEnabled(post_link_PANEL_NAME), |
|
7042 isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false), |
|
7043 postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(getEditedPostSlug()), |
|
7044 postTypeLabel: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_item']), |
|
7045 hasPermalinkParts: !!permalinkParts, |
|
7046 permalinkPrefix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.prefix, |
|
7047 permalinkSuffix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.suffix |
|
7048 }; |
|
7049 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => { |
|
7050 let { |
|
7051 isEnabled, |
|
7052 postLink, |
|
7053 isViewable, |
|
7054 hasPermalinkParts |
|
7055 } = _ref2; |
|
7056 return isEnabled && postLink && isViewable && hasPermalinkParts; |
|
7057 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
|
7058 const { |
|
7059 toggleEditorPanelOpened |
|
7060 } = dispatch(store_store); |
|
7061 const { |
|
7062 editPost |
|
7063 } = dispatch(external_wp_editor_namespaceObject.store); |
|
7064 return { |
|
7065 onTogglePanel: () => toggleEditorPanelOpened(post_link_PANEL_NAME), |
|
7066 editPermalink: newSlug => { |
|
7067 editPost({ |
|
7068 slug: newSlug |
|
7069 }); |
|
7070 } |
|
7071 }; |
|
7072 })])(PostLink)); |
|
7073 |
|
7074 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/discussion-panel/index.js |
|
7075 |
|
7076 |
|
7077 /** |
|
7078 * WordPress dependencies |
|
7079 */ |
|
7080 |
|
7081 |
|
7082 |
|
7083 |
|
7084 |
|
7085 /** |
|
7086 * Internal dependencies |
|
7087 */ |
|
7088 |
|
7089 |
|
7090 /** |
|
7091 * Module Constants |
|
7092 */ |
|
7093 |
|
7094 const discussion_panel_PANEL_NAME = 'discussion-panel'; |
|
7095 |
|
7096 function DiscussionPanel(_ref) { |
|
7097 let { |
|
7098 isEnabled, |
|
7099 isOpened, |
|
7100 onTogglePanel |
|
7101 } = _ref; |
|
7102 |
|
7103 if (!isEnabled) { |
|
7104 return null; |
|
7105 } |
|
7106 |
|
7107 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, { |
|
7108 supportKeys: ['comments', 'trackbacks'] |
|
7109 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
7110 title: (0,external_wp_i18n_namespaceObject.__)('Discussion'), |
|
7111 opened: isOpened, |
|
7112 onToggle: onTogglePanel |
|
7113 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, { |
|
7114 supportKeys: "comments" |
|
7115 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostComments, null))), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, { |
|
7116 supportKeys: "trackbacks" |
|
7117 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPingbacks, null))))); |
|
7118 } |
|
7119 |
|
7120 /* harmony default export */ var discussion_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
|
7121 return { |
|
7122 isEnabled: select(store_store).isEditorPanelEnabled(discussion_panel_PANEL_NAME), |
|
7123 isOpened: select(store_store).isEditorPanelOpened(discussion_panel_PANEL_NAME) |
|
7124 }; |
|
7125 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
|
7126 onTogglePanel() { |
|
7127 return dispatch(store_store).toggleEditorPanelOpened(discussion_panel_PANEL_NAME); |
|
7128 } |
|
7129 |
|
7130 }))])(DiscussionPanel)); |
|
7131 |
|
7132 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/page-attributes/index.js |
|
7133 |
|
7134 |
|
7135 /** |
|
7136 * External dependencies |
|
7137 */ |
|
7138 |
|
7139 /** |
|
7140 * WordPress dependencies |
|
7141 */ |
|
7142 |
|
7143 |
|
7144 |
|
7145 |
|
7146 |
|
7147 |
|
7148 /** |
|
7149 * Internal dependencies |
|
7150 */ |
|
7151 |
|
7152 |
|
7153 /** |
|
7154 * Module Constants |
|
7155 */ |
|
7156 |
|
7157 const page_attributes_PANEL_NAME = 'page-attributes'; |
|
7158 function PageAttributes() { |
|
7159 const { |
|
7160 isEnabled, |
|
7161 isOpened, |
|
7162 postType |
|
7163 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
7164 const { |
|
7165 getEditedPostAttribute |
|
7166 } = select(external_wp_editor_namespaceObject.store); |
|
7167 const { |
|
7168 isEditorPanelEnabled, |
|
7169 isEditorPanelOpened |
|
7170 } = select(store_store); |
|
7171 const { |
|
7172 getPostType |
|
7173 } = select(external_wp_coreData_namespaceObject.store); |
|
7174 return { |
|
7175 isEnabled: isEditorPanelEnabled(page_attributes_PANEL_NAME), |
|
7176 isOpened: isEditorPanelOpened(page_attributes_PANEL_NAME), |
|
7177 postType: getPostType(getEditedPostAttribute('type')) |
|
7178 }; |
|
7179 }, []); |
|
7180 const { |
|
7181 toggleEditorPanelOpened |
|
7182 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
7183 |
|
7184 if (!isEnabled || !postType) { |
|
7185 return null; |
|
7186 } |
|
7187 |
|
7188 const onTogglePanel = (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, page_attributes_PANEL_NAME); |
|
7189 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
7190 title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'attributes'], (0,external_wp_i18n_namespaceObject.__)('Page attributes')), |
|
7191 opened: isOpened, |
|
7192 onToggle: onTogglePanel |
|
7193 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesParent, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesOrder, null)))); |
|
7194 } |
|
7195 /* harmony default export */ var page_attributes = (PageAttributes); |
|
7196 |
|
7197 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js |
|
7198 |
|
7199 |
|
7200 /** |
|
7201 * External dependencies |
|
7202 */ |
|
7203 |
1817 |
7204 /** |
1818 /** |
7205 * WordPress dependencies |
1819 * WordPress dependencies |
7206 */ |
1820 */ |
7207 |
1821 |
7349 __unstableIsEditorReady |
1941 __unstableIsEditorReady |
7350 } = select(external_wp_editor_namespaceObject.store); |
1942 } = select(external_wp_editor_namespaceObject.store); |
7351 const { |
1943 const { |
7352 getMetaBoxesPerLocation, |
1944 getMetaBoxesPerLocation, |
7353 areMetaBoxesInitialized: _areMetaBoxesInitialized |
1945 areMetaBoxesInitialized: _areMetaBoxesInitialized |
7354 } = select(store_store); |
1946 } = select(store); |
7355 return { |
1947 return { |
7356 metaBoxes: getMetaBoxesPerLocation(location), |
1948 metaBoxes: getMetaBoxesPerLocation(location), |
7357 areMetaBoxesInitialized: _areMetaBoxesInitialized(), |
1949 areMetaBoxesInitialized: _areMetaBoxesInitialized(), |
7358 isEditorReady: __unstableIsEditorReady() |
1950 isEditorReady: __unstableIsEditorReady() |
7359 }; |
1951 }; |
7360 }, [location]); // When editor is ready, initialize postboxes (wp core script) and metabox |
1952 }, [location]); |
|
1953 const hasMetaBoxes = !!metaBoxes?.length; |
|
1954 |
|
1955 // When editor is ready, initialize postboxes (wp core script) and metabox |
7361 // saving. This initializes all meta box locations, not just this specific |
1956 // saving. This initializes all meta box locations, not just this specific |
7362 // one. |
1957 // one. |
7363 |
|
7364 (0,external_wp_element_namespaceObject.useEffect)(() => { |
1958 (0,external_wp_element_namespaceObject.useEffect)(() => { |
7365 if (isEditorReady && !areMetaBoxesInitialized) { |
1959 if (isEditorReady && hasMetaBoxes && !areMetaBoxesInitialized) { |
7366 registry.dispatch(store_store).initializeMetaBoxes(); |
1960 registry.dispatch(store).initializeMetaBoxes(); |
7367 } |
1961 } |
7368 }, [isEditorReady, areMetaBoxesInitialized]); |
1962 }, [isEditorReady, hasMetaBoxes, areMetaBoxesInitialized]); |
7369 |
|
7370 if (!areMetaBoxesInitialized) { |
1963 if (!areMetaBoxesInitialized) { |
7371 return null; |
1964 return null; |
7372 } |
1965 } |
7373 |
1966 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
7374 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_lodash_namespaceObject.map)(metaBoxes, _ref2 => { |
1967 children: [(metaBoxes !== null && metaBoxes !== void 0 ? metaBoxes : []).map(({ |
7375 let { |
|
7376 id |
1968 id |
7377 } = _ref2; |
1969 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(meta_box_visibility, { |
7378 return (0,external_wp_element_namespaceObject.createElement)(meta_box_visibility, { |
|
7379 key: id, |
|
7380 id: id |
1970 id: id |
7381 }); |
1971 }, id)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(meta_boxes_area, { |
7382 }), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_area, { |
1972 location: location |
7383 location: location |
1973 })] |
7384 })); |
1974 }); |
7385 } |
1975 } |
7386 |
1976 |
7387 ;// CONCATENATED MODULE: external ["wp","warning"] |
1977 ;// CONCATENATED MODULE: external ["wp","keycodes"] |
7388 var external_wp_warning_namespaceObject = window["wp"]["warning"]; |
1978 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; |
7389 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js |
1979 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/more-menu/manage-patterns-menu-item.js |
7390 |
|
7391 |
|
7392 /** |
|
7393 * Defines as extensibility slot for the Settings sidebar |
|
7394 */ |
|
7395 |
|
7396 /** |
1980 /** |
7397 * WordPress dependencies |
1981 * WordPress dependencies |
7398 */ |
1982 */ |
7399 |
1983 |
7400 |
1984 |
7401 |
1985 |
7402 |
1986 |
7403 |
1987 |
7404 /** |
1988 |
7405 * Internal dependencies |
1989 function ManagePatternsMenuItem() { |
7406 */ |
1990 const url = (0,external_wp_data_namespaceObject.useSelect)(select => { |
7407 |
|
7408 |
|
7409 |
|
7410 const { |
|
7411 Fill: plugin_document_setting_panel_Fill, |
|
7412 Slot: plugin_document_setting_panel_Slot |
|
7413 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel'); |
|
7414 |
|
7415 const PluginDocumentSettingFill = _ref => { |
|
7416 let { |
|
7417 isEnabled, |
|
7418 panelName, |
|
7419 opened, |
|
7420 onToggle, |
|
7421 className, |
|
7422 title, |
|
7423 icon, |
|
7424 children |
|
7425 } = _ref; |
|
7426 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel, { |
|
7427 label: title, |
|
7428 panelName: panelName |
|
7429 }), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel_Fill, null, isEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
7430 className: className, |
|
7431 title: title, |
|
7432 icon: icon, |
|
7433 opened: opened, |
|
7434 onToggle: onToggle |
|
7435 }, children))); |
|
7436 }; |
|
7437 /** |
|
7438 * Renders items below the Status & Availability panel in the Document Sidebar. |
|
7439 * |
|
7440 * @param {Object} props Component properties. |
|
7441 * @param {string} [props.name] The machine-friendly name for the panel. |
|
7442 * @param {string} [props.className] An optional class name added to the row. |
|
7443 * @param {string} [props.title] The title of the panel |
|
7444 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. |
|
7445 * |
|
7446 * @example |
|
7447 * ```js |
|
7448 * // Using ES5 syntax |
|
7449 * var el = wp.element.createElement; |
|
7450 * var __ = wp.i18n.__; |
|
7451 * var registerPlugin = wp.plugins.registerPlugin; |
|
7452 * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel; |
|
7453 * |
|
7454 * function MyDocumentSettingPlugin() { |
|
7455 * return el( |
|
7456 * PluginDocumentSettingPanel, |
|
7457 * { |
|
7458 * className: 'my-document-setting-plugin', |
|
7459 * title: 'My Panel', |
|
7460 * }, |
|
7461 * __( 'My Document Setting Panel' ) |
|
7462 * ); |
|
7463 * } |
|
7464 * |
|
7465 * registerPlugin( 'my-document-setting-plugin', { |
|
7466 * render: MyDocumentSettingPlugin |
|
7467 * } ); |
|
7468 * ``` |
|
7469 * |
|
7470 * @example |
|
7471 * ```jsx |
|
7472 * // Using ESNext syntax |
|
7473 * import { registerPlugin } from '@wordpress/plugins'; |
|
7474 * import { PluginDocumentSettingPanel } from '@wordpress/edit-post'; |
|
7475 * |
|
7476 * const MyDocumentSettingTest = () => ( |
|
7477 * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel"> |
|
7478 * <p>My Document Setting Panel</p> |
|
7479 * </PluginDocumentSettingPanel> |
|
7480 * ); |
|
7481 * |
|
7482 * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } ); |
|
7483 * ``` |
|
7484 * |
|
7485 * @return {WPComponent} The component to be rendered. |
|
7486 */ |
|
7487 |
|
7488 |
|
7489 const PluginDocumentSettingPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { |
|
7490 if (undefined === ownProps.name) { |
|
7491 typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0; |
|
7492 } |
|
7493 |
|
7494 return { |
|
7495 icon: ownProps.icon || context.icon, |
|
7496 panelName: `${context.name}/${ownProps.name}` |
|
7497 }; |
|
7498 }), (0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { |
|
7499 let { |
|
7500 panelName |
|
7501 } = _ref2; |
|
7502 return { |
|
7503 opened: select(store_store).isEditorPanelOpened(panelName), |
|
7504 isEnabled: select(store_store).isEditorPanelEnabled(panelName) |
|
7505 }; |
|
7506 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => { |
|
7507 let { |
|
7508 panelName |
|
7509 } = _ref3; |
|
7510 return { |
|
7511 onToggle() { |
|
7512 return dispatch(store_store).toggleEditorPanelOpened(panelName); |
|
7513 } |
|
7514 |
|
7515 }; |
|
7516 }))(PluginDocumentSettingFill); |
|
7517 PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; |
|
7518 /* harmony default export */ var plugin_document_setting_panel = (PluginDocumentSettingPanel); |
|
7519 |
|
7520 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-sidebar/index.js |
|
7521 |
|
7522 |
|
7523 |
|
7524 /** |
|
7525 * WordPress dependencies |
|
7526 */ |
|
7527 |
|
7528 |
|
7529 |
|
7530 |
|
7531 |
|
7532 /** |
|
7533 * Internal dependencies |
|
7534 */ |
|
7535 |
|
7536 |
|
7537 /** |
|
7538 * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. |
|
7539 * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. |
|
7540 * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: |
|
7541 * |
|
7542 * ```js |
|
7543 * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' ); |
|
7544 * ``` |
|
7545 * |
|
7546 * @see PluginSidebarMoreMenuItem |
|
7547 * |
|
7548 * @param {Object} props Element props. |
|
7549 * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin. |
|
7550 * @param {string} [props.className] An optional class name added to the sidebar body. |
|
7551 * @param {string} props.title Title displayed at the top of the sidebar. |
|
7552 * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item. |
|
7553 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. |
|
7554 * |
|
7555 * @example |
|
7556 * ```js |
|
7557 * // Using ES5 syntax |
|
7558 * var __ = wp.i18n.__; |
|
7559 * var el = wp.element.createElement; |
|
7560 * var PanelBody = wp.components.PanelBody; |
|
7561 * var PluginSidebar = wp.editPost.PluginSidebar; |
|
7562 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. |
|
7563 * |
|
7564 * function MyPluginSidebar() { |
|
7565 * return el( |
|
7566 * PluginSidebar, |
|
7567 * { |
|
7568 * name: 'my-sidebar', |
|
7569 * title: 'My sidebar title', |
|
7570 * icon: moreIcon, |
|
7571 * }, |
|
7572 * el( |
|
7573 * PanelBody, |
|
7574 * {}, |
|
7575 * __( 'My sidebar content' ) |
|
7576 * ) |
|
7577 * ); |
|
7578 * } |
|
7579 * ``` |
|
7580 * |
|
7581 * @example |
|
7582 * ```jsx |
|
7583 * // Using ESNext syntax |
|
7584 * import { __ } from '@wordpress/i18n'; |
|
7585 * import { PanelBody } from '@wordpress/components'; |
|
7586 * import { PluginSidebar } from '@wordpress/edit-post'; |
|
7587 * import { more } from '@wordpress/icons'; |
|
7588 * |
|
7589 * const MyPluginSidebar = () => ( |
|
7590 * <PluginSidebar |
|
7591 * name="my-sidebar" |
|
7592 * title="My sidebar title" |
|
7593 * icon={ more } |
|
7594 * > |
|
7595 * <PanelBody> |
|
7596 * { __( 'My sidebar content' ) } |
|
7597 * </PanelBody> |
|
7598 * </PluginSidebar> |
|
7599 * ); |
|
7600 * ``` |
|
7601 */ |
|
7602 |
|
7603 function PluginSidebarEditPost(_ref) { |
|
7604 let { |
|
7605 className, |
|
7606 ...props |
|
7607 } = _ref; |
|
7608 const { |
|
7609 postTitle, |
|
7610 shortcut, |
|
7611 showIconLabels |
|
7612 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
7613 return { |
|
7614 postTitle: select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('title'), |
|
7615 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'), |
|
7616 showIconLabels: select(store_store).isFeatureActive('showIconLabels') |
|
7617 }; |
|
7618 }, []); |
|
7619 return (0,external_wp_element_namespaceObject.createElement)(complementary_area, _extends({ |
|
7620 panelClassName: className, |
|
7621 className: "edit-post-sidebar", |
|
7622 smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'), |
|
7623 scope: "core/edit-post", |
|
7624 toggleShortcut: shortcut, |
|
7625 showIconLabels: showIconLabels |
|
7626 }, props)); |
|
7627 } |
|
7628 |
|
7629 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template/actions.js |
|
7630 |
|
7631 |
|
7632 /** |
|
7633 * External dependencies |
|
7634 */ |
|
7635 |
|
7636 /** |
|
7637 * WordPress dependencies |
|
7638 */ |
|
7639 |
|
7640 |
|
7641 |
|
7642 |
|
7643 |
|
7644 |
|
7645 |
|
7646 /** |
|
7647 * Internal dependencies |
|
7648 */ |
|
7649 |
|
7650 |
|
7651 |
|
7652 |
|
7653 function PostTemplateActions(_ref) { |
|
7654 let { |
|
7655 isPostsPage |
|
7656 } = _ref; |
|
7657 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
|
7658 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); |
|
7659 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); |
|
7660 const { |
|
7661 template, |
|
7662 supportsTemplateMode, |
|
7663 defaultTemplate |
|
7664 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
7665 var _getPostType$viewable, _getPostType; |
|
7666 |
|
7667 const { |
1991 const { |
7668 getCurrentPostType, |
|
7669 getEditorSettings |
|
7670 } = select(external_wp_editor_namespaceObject.store); |
|
7671 const { |
|
7672 getPostType |
|
7673 } = select(external_wp_coreData_namespaceObject.store); |
|
7674 const { |
|
7675 getEditedPostTemplate |
|
7676 } = select(store_store); |
|
7677 const isViewable = (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; |
|
7678 |
|
7679 const _supportsTemplateMode = getEditorSettings().supportsTemplateMode && isViewable; |
|
7680 |
|
7681 return { |
|
7682 template: _supportsTemplateMode && getEditedPostTemplate(), |
|
7683 supportsTemplateMode: _supportsTemplateMode, |
|
7684 defaultTemplate: getEditorSettings().defaultBlockTemplate |
|
7685 }; |
|
7686 }, []); |
|
7687 const { |
|
7688 __unstableCreateTemplate, |
|
7689 __unstableSwitchToTemplateMode |
|
7690 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
7691 |
|
7692 if (!supportsTemplateMode) { |
|
7693 return null; |
|
7694 } |
|
7695 |
|
7696 const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); |
|
7697 |
|
7698 async function onCreateTemplate(event) { |
|
7699 event.preventDefault(); |
|
7700 |
|
7701 if (isBusy) { |
|
7702 return; |
|
7703 } |
|
7704 |
|
7705 setIsBusy(true); |
|
7706 const newTemplateContent = defaultTemplate !== null && defaultTemplate !== void 0 ? defaultTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { |
|
7707 tagName: 'header', |
|
7708 layout: { |
|
7709 inherit: true |
|
7710 } |
|
7711 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/site-title'), (0,external_wp_blocks_namespaceObject.createBlock)('core/site-tagline')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/separator'), (0,external_wp_blocks_namespaceObject.createBlock)('core/group', { |
|
7712 tagName: 'main' |
|
7713 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { |
|
7714 layout: { |
|
7715 inherit: true |
|
7716 } |
|
7717 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', { |
|
7718 layout: { |
|
7719 inherit: true |
|
7720 } |
|
7721 })])]); |
|
7722 await __unstableCreateTemplate({ |
|
7723 slug: 'wp-custom-template-' + (0,external_lodash_namespaceObject.kebabCase)(title || defaultTitle), |
|
7724 content: newTemplateContent, |
|
7725 title: title || defaultTitle |
|
7726 }); |
|
7727 setIsBusy(false); |
|
7728 setIsModalOpen(false); |
|
7729 |
|
7730 __unstableSwitchToTemplateMode(true); |
|
7731 } |
|
7732 |
|
7733 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
|
7734 className: "edit-post-template__actions" |
|
7735 }, !!template && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
7736 variant: "link", |
|
7737 onClick: () => __unstableSwitchToTemplateMode() |
|
7738 }, (0,external_wp_i18n_namespaceObject.__)('Edit')), !isPostsPage && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
7739 variant: "link", |
|
7740 onClick: () => setIsModalOpen(true) |
|
7741 }, |
|
7742 /* translators: button to create a new template */ |
|
7743 (0,external_wp_i18n_namespaceObject._x)('New', 'action'))), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
|
7744 title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'), |
|
7745 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
|
7746 onRequestClose: () => { |
|
7747 setIsModalOpen(false); |
|
7748 setTitle(''); |
|
7749 }, |
|
7750 overlayClassName: "edit-post-template__modal" |
|
7751 }, (0,external_wp_element_namespaceObject.createElement)("form", { |
|
7752 onSubmit: onCreateTemplate |
|
7753 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
|
7754 align: "flex-start", |
|
7755 gap: 8 |
|
7756 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
7757 label: (0,external_wp_i18n_namespaceObject.__)('Name'), |
|
7758 value: title, |
|
7759 onChange: setTitle, |
|
7760 placeholder: defaultTitle, |
|
7761 disabled: isBusy, |
|
7762 help: (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the template, e.g. "Full Width". Custom templates can be applied to any post or page.') |
|
7763 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
|
7764 className: "edit-post-template__modal-actions", |
|
7765 justify: "flex-end", |
|
7766 expanded: false |
|
7767 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
7768 variant: "tertiary", |
|
7769 onClick: () => { |
|
7770 setIsModalOpen(false); |
|
7771 setTitle(''); |
|
7772 } |
|
7773 }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
7774 variant: "primary", |
|
7775 type: "submit", |
|
7776 isBusy: isBusy, |
|
7777 "aria-disabled": isBusy |
|
7778 }, (0,external_wp_i18n_namespaceObject.__)('Create'))))))); |
|
7779 } |
|
7780 |
|
7781 /* harmony default export */ var actions = (PostTemplateActions); |
|
7782 |
|
7783 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template/index.js |
|
7784 |
|
7785 |
|
7786 /** |
|
7787 * External dependencies |
|
7788 */ |
|
7789 |
|
7790 /** |
|
7791 * WordPress dependencies |
|
7792 */ |
|
7793 |
|
7794 |
|
7795 |
|
7796 |
|
7797 |
|
7798 |
|
7799 |
|
7800 /** |
|
7801 * Internal dependencies |
|
7802 */ |
|
7803 |
|
7804 |
|
7805 |
|
7806 /** |
|
7807 * Module Constants |
|
7808 */ |
|
7809 |
|
7810 const template_PANEL_NAME = 'template'; |
|
7811 function TemplatePanel() { |
|
7812 const { |
|
7813 isEnabled, |
|
7814 isOpened, |
|
7815 isPostsPage, |
|
7816 selectedTemplate, |
|
7817 availableTemplates, |
|
7818 fetchedTemplates, |
|
7819 isViewable, |
|
7820 template, |
|
7821 supportsTemplateMode, |
|
7822 canUserCreate |
|
7823 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
7824 var _getPostType$viewable, _getPostType; |
|
7825 |
|
7826 const { |
|
7827 isEditorPanelEnabled, |
|
7828 isEditorPanelOpened, |
|
7829 getEditedPostTemplate |
|
7830 } = select(store_store); |
|
7831 const { |
|
7832 getEditedPostAttribute, |
|
7833 getEditorSettings, |
|
7834 getCurrentPostId, |
|
7835 getCurrentPostType |
|
7836 } = select(external_wp_editor_namespaceObject.store); |
|
7837 const { |
|
7838 getPostType, |
|
7839 getEntityRecord, |
|
7840 getEntityRecords, |
|
7841 canUser |
1992 canUser |
7842 } = select(external_wp_coreData_namespaceObject.store); |
1993 } = select(external_wp_coreData_namespaceObject.store); |
7843 const currentPostId = getCurrentPostId(); |
1994 const defaultUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { |
7844 const currentPostType = getCurrentPostType(); |
1995 post_type: 'wp_block' |
7845 const settings = getEntityRecord('root', 'site'); |
|
7846 |
|
7847 const _isViewable = (_getPostType$viewable = (_getPostType = getPostType(currentPostType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; |
|
7848 |
|
7849 const _supportsTemplateMode = select(external_wp_editor_namespaceObject.store).getEditorSettings().supportsTemplateMode && _isViewable; |
|
7850 |
|
7851 const templateRecords = getEntityRecords('postType', 'wp_template', { |
|
7852 post_type: currentPostType, |
|
7853 per_page: -1 |
|
7854 }); |
1996 }); |
7855 return { |
1997 const patternsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { |
7856 isEnabled: isEditorPanelEnabled(template_PANEL_NAME), |
1998 path: '/patterns' |
7857 isOpened: isEditorPanelOpened(template_PANEL_NAME), |
1999 }); |
7858 isPostsPage: currentPostId === (settings === null || settings === void 0 ? void 0 : settings.page_for_posts), |
2000 |
7859 selectedTemplate: getEditedPostAttribute('template'), |
2001 // The site editor and templates both check whether the user has |
7860 availableTemplates: getEditorSettings().availableTemplates, |
2002 // edit_theme_options capabilities. We can leverage that here and not |
7861 fetchedTemplates: templateRecords, |
2003 // display the manage patterns link if the user can't access it. |
7862 template: _supportsTemplateMode && getEditedPostTemplate(), |
2004 return canUser('create', 'templates') ? patternsUrl : defaultUrl; |
7863 isViewable: _isViewable, |
|
7864 supportsTemplateMode: _supportsTemplateMode, |
|
7865 canUserCreate: canUser('create', 'templates') |
|
7866 }; |
|
7867 }, []); |
2005 }, []); |
7868 const templates = (0,external_wp_element_namespaceObject.useMemo)(() => { |
2006 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { |
7869 return { ...availableTemplates, |
2007 role: "menuitem", |
7870 ...(0,external_lodash_namespaceObject.fromPairs)((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(_ref => { |
2008 href: url, |
7871 let { |
2009 children: (0,external_wp_i18n_namespaceObject.__)('Manage patterns') |
7872 slug, |
2010 }); |
7873 title |
2011 } |
7874 } = _ref; |
2012 /* harmony default export */ const manage_patterns_menu_item = (ManagePatternsMenuItem); |
7875 return [slug, title.rendered]; |
2013 |
7876 })) |
2014 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/more-menu/welcome-guide-menu-item.js |
7877 }; |
2015 /** |
7878 }, [availableTemplates, fetchedTemplates]); |
2016 * WordPress dependencies |
|
2017 */ |
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 function WelcomeGuideMenuItem() { |
|
2024 const isEditingTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', []); |
|
2025 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { |
|
2026 scope: "core/edit-post", |
|
2027 name: isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide', |
|
2028 label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') |
|
2029 }); |
|
2030 } |
|
2031 |
|
2032 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-custom-fields.js |
|
2033 /** |
|
2034 * WordPress dependencies |
|
2035 */ |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 /** |
|
2045 * Internal dependencies |
|
2046 */ |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 const { |
|
2052 PreferenceBaseOption |
|
2053 } = unlock(external_wp_preferences_namespaceObject.privateApis); |
|
2054 function submitCustomFieldsForm() { |
|
2055 const customFieldsForm = document.getElementById('toggle-custom-fields-form'); |
|
2056 |
|
2057 // Ensure the referrer values is up to update with any |
|
2058 customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute('value', (0,external_wp_url_namespaceObject.getPathAndQueryString)(window.location.href)); |
|
2059 customFieldsForm.submit(); |
|
2060 } |
|
2061 function CustomFieldsConfirmation({ |
|
2062 willEnable |
|
2063 }) { |
|
2064 const [isReloading, setIsReloading] = (0,external_wp_element_namespaceObject.useState)(false); |
|
2065 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
|
2066 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
|
2067 className: "edit-post-preferences-modal__custom-fields-confirmation-message", |
|
2068 children: (0,external_wp_i18n_namespaceObject.__)('A page reload is required for this change. Make sure your content is saved before reloading.') |
|
2069 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button, { |
|
2070 className: "edit-post-preferences-modal__custom-fields-confirmation-button", |
|
2071 variant: "secondary", |
|
2072 isBusy: isReloading, |
|
2073 __experimentalIsFocusable: true, |
|
2074 disabled: isReloading, |
|
2075 onClick: () => { |
|
2076 setIsReloading(true); |
|
2077 submitCustomFieldsForm(); |
|
2078 }, |
|
2079 children: willEnable ? (0,external_wp_i18n_namespaceObject.__)('Show & Reload Page') : (0,external_wp_i18n_namespaceObject.__)('Hide & Reload Page') |
|
2080 })] |
|
2081 }); |
|
2082 } |
|
2083 function EnableCustomFieldsOption({ |
|
2084 label, |
|
2085 areCustomFieldsEnabled |
|
2086 }) { |
|
2087 const [isChecked, setIsChecked] = (0,external_wp_element_namespaceObject.useState)(areCustomFieldsEnabled); |
|
2088 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceBaseOption, { |
|
2089 label: label, |
|
2090 isChecked: isChecked, |
|
2091 onChange: setIsChecked, |
|
2092 children: isChecked !== areCustomFieldsEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomFieldsConfirmation, { |
|
2093 willEnable: isChecked |
|
2094 }) |
|
2095 }); |
|
2096 } |
|
2097 /* harmony default export */ const enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ |
|
2098 areCustomFieldsEnabled: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().enableCustomFields |
|
2099 }))(EnableCustomFieldsOption)); |
|
2100 |
|
2101 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-panel.js |
|
2102 /** |
|
2103 * WordPress dependencies |
|
2104 */ |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 /** |
|
2111 * Internal dependencies |
|
2112 */ |
|
2113 |
|
2114 const { |
|
2115 PreferenceBaseOption: enable_panel_PreferenceBaseOption |
|
2116 } = unlock(external_wp_preferences_namespaceObject.privateApis); |
|
2117 /* harmony default export */ const enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, { |
|
2118 panelName |
|
2119 }) => { |
7879 const { |
2120 const { |
7880 toggleEditorPanelOpened |
2121 isEditorPanelEnabled, |
7881 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
2122 isEditorPanelRemoved |
|
2123 } = select(external_wp_editor_namespaceObject.store); |
|
2124 return { |
|
2125 isRemoved: isEditorPanelRemoved(panelName), |
|
2126 isChecked: isEditorPanelEnabled(panelName) |
|
2127 }; |
|
2128 }), (0,external_wp_compose_namespaceObject.ifCondition)(({ |
|
2129 isRemoved |
|
2130 }) => !isRemoved), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { |
|
2131 panelName |
|
2132 }) => ({ |
|
2133 onChange: () => dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelEnabled(panelName) |
|
2134 })))(enable_panel_PreferenceBaseOption)); |
|
2135 |
|
2136 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/meta-boxes-section.js |
|
2137 /** |
|
2138 * WordPress dependencies |
|
2139 */ |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 /** |
|
2146 * Internal dependencies |
|
2147 */ |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 const { |
|
2155 PreferencesModalSection |
|
2156 } = unlock(external_wp_preferences_namespaceObject.privateApis); |
|
2157 function MetaBoxesSection({ |
|
2158 areCustomFieldsRegistered, |
|
2159 metaBoxes, |
|
2160 ...sectionProps |
|
2161 }) { |
|
2162 // The 'Custom Fields' meta box is a special case that we handle separately. |
|
2163 const thirdPartyMetaBoxes = metaBoxes.filter(({ |
|
2164 id |
|
2165 }) => id !== 'postcustom'); |
|
2166 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) { |
|
2167 return null; |
|
2168 } |
|
2169 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { |
|
2170 ...sectionProps, |
|
2171 children: [areCustomFieldsRegistered && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_custom_fields, { |
|
2172 label: (0,external_wp_i18n_namespaceObject.__)('Custom fields') |
|
2173 }), thirdPartyMetaBoxes.map(({ |
|
2174 id, |
|
2175 title |
|
2176 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, { |
|
2177 label: title, |
|
2178 panelName: `meta-box-${id}` |
|
2179 }, id))] |
|
2180 }); |
|
2181 } |
|
2182 /* harmony default export */ const meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
7882 const { |
2183 const { |
7883 editPost |
2184 getEditorSettings |
7884 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); |
2185 } = select(external_wp_editor_namespaceObject.store); |
7885 |
2186 const { |
7886 if (!isEnabled || !isViewable || (0,external_lodash_namespaceObject.isEmpty)(availableTemplates) && (!supportsTemplateMode || !canUserCreate)) { |
2187 getAllMetaBoxes |
7887 return null; |
2188 } = select(store); |
7888 } |
2189 return { |
7889 |
2190 // This setting should not live in the block editor's store. |
7890 const onTogglePanel = (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, template_PANEL_NAME); |
2191 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== undefined, |
7891 |
2192 metaBoxes: getAllMetaBoxes() |
7892 let panelTitle = (0,external_wp_i18n_namespaceObject.__)('Template'); |
2193 }; |
7893 |
2194 })(MetaBoxesSection)); |
7894 if (!!template) { |
2195 |
7895 var _template$title; |
2196 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/index.js |
7896 |
|
7897 panelTitle = (0,external_wp_i18n_namespaceObject.sprintf)( |
|
7898 /* translators: %s: template title */ |
|
7899 (0,external_wp_i18n_namespaceObject.__)('Template: %s'), (_template$title = template === null || template === void 0 ? void 0 : template.title) !== null && _template$title !== void 0 ? _template$title : template.slug); |
|
7900 } |
|
7901 |
|
7902 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
7903 title: panelTitle, |
|
7904 opened: isOpened, |
|
7905 onToggle: onTogglePanel |
|
7906 }, isPostsPage ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, { |
|
7907 className: "edit-post-template__notice", |
|
7908 status: "warning", |
|
7909 isDismissible: false |
|
7910 }, (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { |
|
7911 hideLabelFromVision: true, |
|
7912 label: (0,external_wp_i18n_namespaceObject.__)('Template:'), |
|
7913 value: Object.keys(templates).includes(selectedTemplate) ? selectedTemplate : '', |
|
7914 onChange: templateSlug => { |
|
7915 editPost({ |
|
7916 template: templateSlug || '' |
|
7917 }); |
|
7918 }, |
|
7919 options: (0,external_lodash_namespaceObject.map)(templates, (templateName, templateSlug) => ({ |
|
7920 value: templateSlug, |
|
7921 label: templateName |
|
7922 })) |
|
7923 }), canUserCreate && (0,external_wp_element_namespaceObject.createElement)(actions, { |
|
7924 isPostsPage: isPostsPage |
|
7925 })); |
|
7926 } |
|
7927 /* harmony default export */ var template = (TemplatePanel); |
|
7928 |
|
7929 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js |
|
7930 |
|
7931 |
|
7932 /** |
2197 /** |
7933 * WordPress dependencies |
2198 * WordPress dependencies |
7934 */ |
2199 */ |
7935 |
2200 |
7936 const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
2201 |
7937 xmlns: "http://www.w3.org/2000/svg", |
2202 |
7938 viewBox: "0 0 24 24" |
2203 |
7939 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
2204 |
7940 d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" |
2205 /** |
7941 })); |
2206 * Internal dependencies |
7942 /* harmony default export */ var library_layout = (layout); |
2207 */ |
7943 |
2208 |
7944 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template-summary/index.js |
2209 |
7945 |
2210 |
7946 |
2211 const { |
|
2212 PreferenceToggleControl |
|
2213 } = unlock(external_wp_preferences_namespaceObject.privateApis); |
|
2214 const { |
|
2215 PreferencesModal |
|
2216 } = unlock(external_wp_editor_namespaceObject.privateApis); |
|
2217 function EditPostPreferencesModal() { |
|
2218 const extraSections = { |
|
2219 general: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(meta_boxes_section, { |
|
2220 title: (0,external_wp_i18n_namespaceObject.__)('Advanced') |
|
2221 }), |
|
2222 appearance: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { |
|
2223 scope: "core/edit-post", |
|
2224 featureName: "themeStyles", |
|
2225 help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'), |
|
2226 label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles') |
|
2227 }) |
|
2228 }; |
|
2229 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, { |
|
2230 extraSections: extraSections |
|
2231 }); |
|
2232 } |
|
2233 |
|
2234 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/more-menu/index.js |
7947 /** |
2235 /** |
7948 * WordPress dependencies |
2236 * WordPress dependencies |
7949 */ |
2237 */ |
7950 |
2238 |
7951 |
2239 |
7952 |
2240 |
|
2241 |
|
2242 |
|
2243 |
7953 /** |
2244 /** |
7954 * Internal dependencies |
2245 * Internal dependencies |
7955 */ |
2246 */ |
7956 |
2247 |
7957 |
2248 |
7958 |
2249 |
7959 function TemplateSummary() { |
2250 |
7960 const template = (0,external_wp_data_namespaceObject.useSelect)(select => { |
2251 |
7961 const { |
2252 |
7962 getEditedPostTemplate |
2253 |
7963 } = select(store_store); |
2254 const { |
7964 return getEditedPostTemplate(); |
2255 ToolsMoreMenuGroup, |
7965 }, []); |
2256 ViewMoreMenuGroup |
7966 |
2257 } = unlock(external_wp_editor_namespaceObject.privateApis); |
7967 if (!template) { |
2258 const MoreMenu = () => { |
7968 return null; |
2259 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); |
7969 } |
2260 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
7970 |
2261 children: [isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewMoreMenuGroup, { |
7971 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
2262 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { |
7972 align: "flex-start", |
2263 scope: "core/edit-post", |
7973 gap: "3" |
2264 name: "fullscreenMode", |
7974 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, { |
2265 label: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode'), |
7975 icon: library_layout |
2266 info: (0,external_wp_i18n_namespaceObject.__)('Show and hide the admin user interface'), |
7976 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("h2", { |
2267 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode activated'), |
7977 className: "edit-post-template-summary__title" |
2268 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode deactivated'), |
7978 }, (template === null || template === void 0 ? void 0 : template.title) || (template === null || template === void 0 ? void 0 : template.slug)), (0,external_wp_element_namespaceObject.createElement)("p", null, template === null || template === void 0 ? void 0 : template.description)))); |
2269 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('f') |
7979 } |
2270 }) |
7980 |
2271 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { |
7981 /* harmony default export */ var template_summary = (TemplateSummary); |
2272 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(manage_patterns_menu_item, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})] |
7982 |
2273 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditPostPreferencesModal, {})] |
7983 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-sidebar/index.js |
2274 }); |
7984 |
2275 }; |
7985 |
2276 /* harmony default export */ const more_menu = (MoreMenu); |
|
2277 |
|
2278 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/image.js |
|
2279 |
|
2280 |
|
2281 function WelcomeGuideImage({ |
|
2282 nonAnimatedSrc, |
|
2283 animatedSrc |
|
2284 }) { |
|
2285 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { |
|
2286 className: "edit-post-welcome-guide__image", |
|
2287 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { |
|
2288 srcSet: nonAnimatedSrc, |
|
2289 media: "(prefers-reduced-motion: reduce)" |
|
2290 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { |
|
2291 src: animatedSrc, |
|
2292 width: "312", |
|
2293 height: "240", |
|
2294 alt: "" |
|
2295 })] |
|
2296 }); |
|
2297 } |
|
2298 |
|
2299 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/default.js |
7986 /** |
2300 /** |
7987 * WordPress dependencies |
2301 * WordPress dependencies |
7988 */ |
2302 */ |
7989 |
2303 |
7990 |
2304 |
7994 /** |
2308 /** |
7995 * Internal dependencies |
2309 * Internal dependencies |
7996 */ |
2310 */ |
7997 |
2311 |
7998 |
2312 |
7999 |
|
8000 |
|
8001 |
|
8002 |
|
8003 |
|
8004 |
|
8005 |
|
8006 |
|
8007 |
|
8008 |
|
8009 |
|
8010 |
|
8011 |
|
8012 |
|
8013 |
|
8014 |
|
8015 const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ |
|
8016 web: true, |
|
8017 native: false |
|
8018 }); |
|
8019 |
|
8020 const SettingsSidebar = () => { |
|
8021 const { |
|
8022 sidebarName, |
|
8023 keyboardShortcut, |
|
8024 isTemplateMode |
|
8025 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
8026 // The settings sidebar is used by the edit-post/document and edit-post/block sidebars. |
|
8027 // sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed. |
|
8028 // If one of the two sidebars is active the component will contain the content of that sidebar. |
|
8029 // When neither of the the two sidebars is active we can not simply return null, because the PluginSidebarEditPost |
|
8030 // component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName |
|
8031 // should contain the sidebar that will be active when the toggle button is pressed. If a block |
|
8032 // is selected, that should be edit-post/block otherwise it's edit-post/document. |
|
8033 let sidebar = select(store).getActiveComplementaryArea(store_store.name); |
|
8034 |
|
8035 if (!['edit-post/document', 'edit-post/block'].includes(sidebar)) { |
|
8036 if (select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()) { |
|
8037 sidebar = 'edit-post/block'; |
|
8038 } |
|
8039 |
|
8040 sidebar = 'edit-post/document'; |
|
8041 } |
|
8042 |
|
8043 const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'); |
|
8044 return { |
|
8045 sidebarName: sidebar, |
|
8046 keyboardShortcut: shortcut, |
|
8047 isTemplateMode: select(store_store).isEditingTemplate() |
|
8048 }; |
|
8049 }, []); |
|
8050 return (0,external_wp_element_namespaceObject.createElement)(PluginSidebarEditPost, { |
|
8051 identifier: sidebarName, |
|
8052 header: (0,external_wp_element_namespaceObject.createElement)(settings_header, { |
|
8053 sidebarName: sidebarName |
|
8054 }), |
|
8055 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings'), |
|
8056 headerClassName: "edit-post-sidebar__panel-tabs" |
|
8057 /* translators: button label text should, if possible, be under 16 characters. */ |
|
8058 , |
|
8059 title: (0,external_wp_i18n_namespaceObject.__)('Settings'), |
|
8060 toggleShortcut: keyboardShortcut, |
|
8061 icon: library_cog, |
|
8062 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT |
|
8063 }, !isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_status, null), (0,external_wp_element_namespaceObject.createElement)(template, null), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel.Slot, null), (0,external_wp_element_namespaceObject.createElement)(last_revision, null), (0,external_wp_element_namespaceObject.createElement)(post_link, null), (0,external_wp_element_namespaceObject.createElement)(post_taxonomies, null), (0,external_wp_element_namespaceObject.createElement)(featured_image, null), (0,external_wp_element_namespaceObject.createElement)(post_excerpt, null), (0,external_wp_element_namespaceObject.createElement)(discussion_panel, null), (0,external_wp_element_namespaceObject.createElement)(page_attributes, null), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, { |
|
8064 location: "side" |
|
8065 })), isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(template_summary, null), sidebarName === 'edit-post/block' && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)); |
|
8066 }; |
|
8067 |
|
8068 /* harmony default export */ var settings_sidebar = (SettingsSidebar); |
|
8069 |
|
8070 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/image.js |
|
8071 |
|
8072 function WelcomeGuideImage(_ref) { |
|
8073 let { |
|
8074 nonAnimatedSrc, |
|
8075 animatedSrc |
|
8076 } = _ref; |
|
8077 return (0,external_wp_element_namespaceObject.createElement)("picture", { |
|
8078 className: "edit-post-welcome-guide__image" |
|
8079 }, (0,external_wp_element_namespaceObject.createElement)("source", { |
|
8080 srcSet: nonAnimatedSrc, |
|
8081 media: "(prefers-reduced-motion: reduce)" |
|
8082 }), (0,external_wp_element_namespaceObject.createElement)("img", { |
|
8083 src: animatedSrc, |
|
8084 width: "312", |
|
8085 height: "240", |
|
8086 alt: "" |
|
8087 })); |
|
8088 } |
|
8089 |
|
8090 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/default.js |
|
8091 |
|
8092 |
|
8093 /** |
|
8094 * WordPress dependencies |
|
8095 */ |
|
8096 |
|
8097 |
|
8098 |
|
8099 |
|
8100 /** |
|
8101 * Internal dependencies |
|
8102 */ |
|
8103 |
2313 |
8104 |
2314 |
8105 |
2315 |
8106 function WelcomeGuideDefault() { |
2316 function WelcomeGuideDefault() { |
8107 const { |
2317 const { |
8108 toggleFeature |
2318 toggleFeature |
8109 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
2319 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
8110 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { |
2320 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { |
8111 className: "edit-post-welcome-guide", |
2321 className: "edit-post-welcome-guide", |
8112 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor'), |
2322 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor'), |
8113 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), |
2323 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), |
8114 onFinish: () => toggleFeature('welcomeGuide'), |
2324 onFinish: () => toggleFeature('welcomeGuide'), |
8115 pages: [{ |
2325 pages: [{ |
8116 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
2326 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { |
8117 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", |
2327 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", |
8118 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" |
2328 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" |
8119 }), |
2329 }), |
8120 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
2330 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
8121 className: "edit-post-welcome-guide__heading" |
2331 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { |
8122 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", { |
2332 className: "edit-post-welcome-guide__heading", |
8123 className: "edit-post-welcome-guide__text" |
2333 children: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor') |
8124 }, (0,external_wp_i18n_namespaceObject.__)('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.'))) |
2334 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
|
2335 className: "edit-post-welcome-guide__text", |
|
2336 children: (0,external_wp_i18n_namespaceObject.__)('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.') |
|
2337 })] |
|
2338 }) |
8125 }, { |
2339 }, { |
8126 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
2340 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { |
8127 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", |
2341 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", |
8128 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" |
2342 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" |
8129 }), |
2343 }), |
8130 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
2344 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
8131 className: "edit-post-welcome-guide__heading" |
2345 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { |
8132 }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_wp_element_namespaceObject.createElement)("p", { |
2346 className: "edit-post-welcome-guide__heading", |
8133 className: "edit-post-welcome-guide__text" |
2347 children: (0,external_wp_i18n_namespaceObject.__)('Make each block your own') |
8134 }, (0,external_wp_i18n_namespaceObject.__)('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.'))) |
2348 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
|
2349 className: "edit-post-welcome-guide__text", |
|
2350 children: (0,external_wp_i18n_namespaceObject.__)('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.') |
|
2351 })] |
|
2352 }) |
8135 }, { |
2353 }, { |
8136 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
2354 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { |
8137 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", |
2355 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", |
8138 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" |
2356 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" |
8139 }), |
2357 }), |
8140 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
2358 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
8141 className: "edit-post-welcome-guide__heading" |
2359 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { |
8142 }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_wp_element_namespaceObject.createElement)("p", { |
2360 className: "edit-post-welcome-guide__heading", |
8143 className: "edit-post-welcome-guide__text" |
2361 children: (0,external_wp_i18n_namespaceObject.__)('Get to know the block library') |
8144 }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), { |
2362 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
8145 InserterIconImage: (0,external_wp_element_namespaceObject.createElement)("img", { |
2363 className: "edit-post-welcome-guide__text", |
8146 alt: (0,external_wp_i18n_namespaceObject.__)('inserter'), |
2364 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), { |
8147 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" |
2365 InserterIconImage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { |
8148 }) |
2366 alt: (0,external_wp_i18n_namespaceObject.__)('inserter'), |
8149 }))) |
2367 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" |
|
2368 }) |
|
2369 }) |
|
2370 })] |
|
2371 }) |
8150 }, { |
2372 }, { |
8151 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
2373 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { |
8152 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", |
2374 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", |
8153 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" |
2375 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" |
8154 }), |
2376 }), |
8155 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
2377 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
8156 className: "edit-post-welcome-guide__heading" |
2378 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { |
8157 }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", { |
2379 className: "edit-post-welcome-guide__heading", |
8158 className: "edit-post-welcome-guide__text" |
2380 children: (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor') |
8159 }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { |
2381 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("p", { |
8160 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/') |
2382 className: "edit-post-welcome-guide__text", |
8161 }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide.")))) |
2383 children: [(0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { |
|
2384 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'), |
|
2385 children: (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide.") |
|
2386 })] |
|
2387 })] |
|
2388 }) |
8162 }] |
2389 }] |
8163 }); |
2390 }); |
8164 } |
2391 } |
8165 |
2392 |
8166 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/template.js |
2393 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/template.js |
8167 |
|
8168 |
|
8169 /** |
2394 /** |
8170 * WordPress dependencies |
2395 * WordPress dependencies |
8171 */ |
2396 */ |
8172 |
2397 |
8173 |
2398 |
8174 |
2399 |
|
2400 |
8175 /** |
2401 /** |
8176 * Internal dependencies |
2402 * Internal dependencies |
8177 */ |
2403 */ |
|
2404 |
|
2405 |
8178 |
2406 |
8179 |
2407 |
8180 |
2408 |
8181 function WelcomeGuideTemplate() { |
2409 function WelcomeGuideTemplate() { |
8182 const { |
2410 const { |
8183 toggleFeature |
2411 toggleFeature |
8184 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
2412 } = (0,external_wp_data_namespaceObject.useDispatch)(store); |
8185 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { |
2413 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { |
8186 className: "edit-template-welcome-guide", |
2414 className: "edit-template-welcome-guide", |
8187 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor'), |
2415 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor'), |
8188 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), |
2416 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), |
8189 onFinish: () => toggleFeature('welcomeGuideTemplate'), |
2417 onFinish: () => toggleFeature('welcomeGuideTemplate'), |
8190 pages: [{ |
2418 pages: [{ |
8191 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { |
2419 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { |
8192 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg", |
2420 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg", |
8193 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif" |
2421 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif" |
8194 }), |
2422 }), |
8195 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { |
2423 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
8196 className: "edit-post-welcome-guide__heading" |
2424 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { |
8197 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor')), (0,external_wp_element_namespaceObject.createElement)("p", { |
2425 className: "edit-post-welcome-guide__heading", |
8198 className: "edit-post-welcome-guide__text" |
2426 children: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor') |
8199 }, (0,external_wp_i18n_namespaceObject.__)('Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.'))) |
2427 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
|
2428 className: "edit-post-welcome-guide__text", |
|
2429 children: (0,external_wp_i18n_namespaceObject.__)('Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.') |
|
2430 })] |
|
2431 }) |
8200 }] |
2432 }] |
8201 }); |
2433 }); |
8202 } |
2434 } |
8203 |
2435 |
8204 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/index.js |
2436 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/index.js |
8205 |
|
8206 |
|
8207 /** |
2437 /** |
8208 * WordPress dependencies |
2438 * WordPress dependencies |
8209 */ |
2439 */ |
|
2440 |
|
2441 |
8210 |
2442 |
8211 /** |
2443 /** |
8212 * Internal dependencies |
2444 * Internal dependencies |
8213 */ |
2445 */ |
8214 |
2446 |
8216 |
2448 |
8217 |
2449 |
8218 function WelcomeGuide() { |
2450 function WelcomeGuide() { |
8219 const { |
2451 const { |
8220 isActive, |
2452 isActive, |
8221 isTemplateMode |
2453 isEditingTemplate |
8222 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
2454 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
8223 const { |
2455 const { |
8224 isFeatureActive, |
2456 isFeatureActive |
8225 isEditingTemplate |
2457 } = select(store); |
8226 } = select(store_store); |
2458 const { |
8227 |
2459 getCurrentPostType |
8228 const _isTemplateMode = isEditingTemplate(); |
2460 } = select(external_wp_editor_namespaceObject.store); |
8229 |
2461 const _isEditingTemplate = getCurrentPostType() === 'wp_template'; |
8230 const feature = _isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide'; |
2462 const feature = _isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide'; |
8231 return { |
2463 return { |
8232 isActive: isFeatureActive(feature), |
2464 isActive: isFeatureActive(feature), |
8233 isTemplateMode: _isTemplateMode |
2465 isEditingTemplate: _isEditingTemplate |
8234 }; |
2466 }; |
8235 }, []); |
2467 }, []); |
8236 |
|
8237 if (!isActive) { |
2468 if (!isActive) { |
8238 return null; |
2469 return null; |
8239 } |
2470 } |
8240 |
2471 return isEditingTemplate ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideDefault, {}); |
8241 return isTemplateMode ? (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideTemplate, null) : (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideDefault, null); |
2472 } |
8242 } |
2473 |
8243 |
2474 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js |
8244 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-publish-panel/index.js |
|
8245 |
|
8246 |
|
8247 /** |
2475 /** |
8248 * WordPress dependencies |
2476 * WordPress dependencies |
8249 */ |
2477 */ |
8250 |
2478 |
8251 |
2479 |
8252 |
2480 const fullscreen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
8253 const { |
2481 xmlns: "http://www.w3.org/2000/svg", |
8254 Fill: plugin_post_publish_panel_Fill, |
2482 viewBox: "0 0 24 24", |
8255 Slot: plugin_post_publish_panel_Slot |
2483 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
8256 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel'); |
2484 d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" |
8257 |
2485 }) |
8258 const PluginPostPublishPanelFill = _ref => { |
2486 }); |
8259 let { |
2487 /* harmony default export */ const library_fullscreen = (fullscreen); |
8260 children, |
2488 |
8261 className, |
2489 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/commands/use-commands.js |
8262 title, |
|
8263 initialOpen = false, |
|
8264 icon |
|
8265 } = _ref; |
|
8266 return (0,external_wp_element_namespaceObject.createElement)(plugin_post_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
8267 className: className, |
|
8268 initialOpen: initialOpen || !title, |
|
8269 title: title, |
|
8270 icon: icon |
|
8271 }, children)); |
|
8272 }; |
|
8273 /** |
|
8274 * Renders provided content to the post-publish panel in the publish flow |
|
8275 * (side panel that opens after a user publishes the post). |
|
8276 * |
|
8277 * @param {Object} props Component properties. |
|
8278 * @param {string} [props.className] An optional class name added to the panel. |
|
8279 * @param {string} [props.title] Title displayed at the top of the panel. |
|
8280 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened. |
|
8281 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. |
|
8282 * |
|
8283 * @example |
|
8284 * ```js |
|
8285 * // Using ES5 syntax |
|
8286 * var __ = wp.i18n.__; |
|
8287 * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel; |
|
8288 * |
|
8289 * function MyPluginPostPublishPanel() { |
|
8290 * return wp.element.createElement( |
|
8291 * PluginPostPublishPanel, |
|
8292 * { |
|
8293 * className: 'my-plugin-post-publish-panel', |
|
8294 * title: __( 'My panel title' ), |
|
8295 * initialOpen: true, |
|
8296 * }, |
|
8297 * __( 'My panel content' ) |
|
8298 * ); |
|
8299 * } |
|
8300 * ``` |
|
8301 * |
|
8302 * @example |
|
8303 * ```jsx |
|
8304 * // Using ESNext syntax |
|
8305 * import { __ } from '@wordpress/i18n'; |
|
8306 * import { PluginPostPublishPanel } from '@wordpress/edit-post'; |
|
8307 * |
|
8308 * const MyPluginPostPublishPanel = () => ( |
|
8309 * <PluginPostPublishPanel |
|
8310 * className="my-plugin-post-publish-panel" |
|
8311 * title={ __( 'My panel title' ) } |
|
8312 * initialOpen={ true } |
|
8313 * > |
|
8314 * { __( 'My panel content' ) } |
|
8315 * </PluginPostPublishPanel> |
|
8316 * ); |
|
8317 * ``` |
|
8318 * |
|
8319 * @return {WPComponent} The component to be rendered. |
|
8320 */ |
|
8321 |
|
8322 |
|
8323 const PluginPostPublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { |
|
8324 return { |
|
8325 icon: ownProps.icon || context.icon |
|
8326 }; |
|
8327 }))(PluginPostPublishPanelFill); |
|
8328 PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot; |
|
8329 /* harmony default export */ var plugin_post_publish_panel = (PluginPostPublishPanel); |
|
8330 |
|
8331 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-pre-publish-panel/index.js |
|
8332 |
|
8333 |
|
8334 /** |
2490 /** |
8335 * WordPress dependencies |
2491 * WordPress dependencies |
8336 */ |
2492 */ |
8337 |
2493 |
8338 |
2494 |
8339 |
2495 |
8340 const { |
2496 |
8341 Fill: plugin_pre_publish_panel_Fill, |
2497 |
8342 Slot: plugin_pre_publish_panel_Slot |
2498 |
8343 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel'); |
2499 function useCommands() { |
8344 |
|
8345 const PluginPrePublishPanelFill = _ref => { |
|
8346 let { |
|
8347 children, |
|
8348 className, |
|
8349 title, |
|
8350 initialOpen = false, |
|
8351 icon |
|
8352 } = _ref; |
|
8353 return (0,external_wp_element_namespaceObject.createElement)(plugin_pre_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
8354 className: className, |
|
8355 initialOpen: initialOpen || !title, |
|
8356 title: title, |
|
8357 icon: icon |
|
8358 }, children)); |
|
8359 }; |
|
8360 /** |
|
8361 * Renders provided content to the pre-publish side panel in the publish flow |
|
8362 * (side panel that opens when a user first pushes "Publish" from the main editor). |
|
8363 * |
|
8364 * @param {Object} props Component props. |
|
8365 * @param {string} [props.className] An optional class name added to the panel. |
|
8366 * @param {string} [props.title] Title displayed at the top of the panel. |
|
8367 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. |
|
8368 * When no title is provided it is always opened. |
|
8369 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) |
|
8370 * icon slug string, or an SVG WP element, to be rendered when |
|
8371 * the sidebar is pinned to toolbar. |
|
8372 * |
|
8373 * @example |
|
8374 * ```js |
|
8375 * // Using ES5 syntax |
|
8376 * var __ = wp.i18n.__; |
|
8377 * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel; |
|
8378 * |
|
8379 * function MyPluginPrePublishPanel() { |
|
8380 * return wp.element.createElement( |
|
8381 * PluginPrePublishPanel, |
|
8382 * { |
|
8383 * className: 'my-plugin-pre-publish-panel', |
|
8384 * title: __( 'My panel title' ), |
|
8385 * initialOpen: true, |
|
8386 * }, |
|
8387 * __( 'My panel content' ) |
|
8388 * ); |
|
8389 * } |
|
8390 * ``` |
|
8391 * |
|
8392 * @example |
|
8393 * ```jsx |
|
8394 * // Using ESNext syntax |
|
8395 * import { __ } from '@wordpress/i18n'; |
|
8396 * import { PluginPrePublishPanel } from '@wordpress/edit-post'; |
|
8397 * |
|
8398 * const MyPluginPrePublishPanel = () => ( |
|
8399 * <PluginPrePublishPanel |
|
8400 * className="my-plugin-pre-publish-panel" |
|
8401 * title={ __( 'My panel title' ) } |
|
8402 * initialOpen={ true } |
|
8403 * > |
|
8404 * { __( 'My panel content' ) } |
|
8405 * </PluginPrePublishPanel> |
|
8406 * ); |
|
8407 * ``` |
|
8408 * |
|
8409 * @return {WPComponent} The component to be rendered. |
|
8410 */ |
|
8411 |
|
8412 |
|
8413 const PluginPrePublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { |
|
8414 return { |
|
8415 icon: ownProps.icon || context.icon |
|
8416 }; |
|
8417 }))(PluginPrePublishPanelFill); |
|
8418 PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot; |
|
8419 /* harmony default export */ var plugin_pre_publish_panel = (PluginPrePublishPanel); |
|
8420 |
|
8421 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/actions-panel.js |
|
8422 |
|
8423 |
|
8424 /** |
|
8425 * WordPress dependencies |
|
8426 */ |
|
8427 |
|
8428 |
|
8429 |
|
8430 |
|
8431 |
|
8432 /** |
|
8433 * Internal dependencies |
|
8434 */ |
|
8435 |
|
8436 |
|
8437 |
|
8438 |
|
8439 const { |
|
8440 Fill: actions_panel_Fill, |
|
8441 Slot: actions_panel_Slot |
|
8442 } = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel'); |
|
8443 const ActionsPanelFill = (/* unused pure expression or super */ null && (actions_panel_Fill)); |
|
8444 function ActionsPanel(_ref) { |
|
8445 let { |
|
8446 setEntitiesSavedStatesCallback, |
|
8447 closeEntitiesSavedStates, |
|
8448 isEntitiesSavedStatesOpen |
|
8449 } = _ref; |
|
8450 const { |
2500 const { |
8451 closePublishSidebar, |
2501 isFullscreen |
8452 togglePublishSidebar |
|
8453 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
8454 const { |
|
8455 publishSidebarOpened, |
|
8456 hasActiveMetaboxes, |
|
8457 isSavingMetaBoxes, |
|
8458 hasNonPostEntityChanges |
|
8459 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
2502 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
2503 const { |
|
2504 get |
|
2505 } = select(external_wp_preferences_namespaceObject.store); |
8460 return { |
2506 return { |
8461 publishSidebarOpened: select(store_store).isPublishSidebarOpened(), |
2507 isFullscreen: get('core/edit-post', 'fullscreenMode') |
8462 hasActiveMetaboxes: select(store_store).hasMetaBoxes(), |
|
8463 isSavingMetaBoxes: select(store_store).isSavingMetaBoxes(), |
|
8464 hasNonPostEntityChanges: select(external_wp_editor_namespaceObject.store).hasNonPostEntityChanges() |
|
8465 }; |
2508 }; |
8466 }, []); |
2509 }, []); |
8467 const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []); // It is ok for these components to be unmounted when not in visual use. |
2510 const { |
8468 // We don't want more than one present at a time, decide which to render. |
2511 toggle |
8469 |
2512 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); |
8470 let unmountableContent; |
2513 const { |
8471 |
2514 createInfoNotice |
8472 if (publishSidebarOpened) { |
2515 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
8473 unmountableContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishPanel, { |
2516 (0,external_wp_commands_namespaceObject.useCommand)({ |
8474 onClose: closePublishSidebar, |
2517 name: 'core/toggle-fullscreen-mode', |
8475 forceIsDirty: hasActiveMetaboxes, |
2518 label: isFullscreen ? (0,external_wp_i18n_namespaceObject.__)('Exit fullscreen') : (0,external_wp_i18n_namespaceObject.__)('Enter fullscreen'), |
8476 forceIsSaving: isSavingMetaBoxes, |
2519 icon: library_fullscreen, |
8477 PrePublishExtension: plugin_pre_publish_panel.Slot, |
2520 callback: ({ |
8478 PostPublishExtension: plugin_post_publish_panel.Slot |
2521 close |
8479 }); |
2522 }) => { |
8480 } else if (hasNonPostEntityChanges) { |
2523 toggle('core/edit-post', 'fullscreenMode'); |
8481 unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", { |
2524 close(); |
8482 className: "edit-post-layout__toggle-entities-saved-states-panel" |
2525 createInfoNotice(isFullscreen ? (0,external_wp_i18n_namespaceObject.__)('Fullscreen off.') : (0,external_wp_i18n_namespaceObject.__)('Fullscreen on.'), { |
8483 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
2526 id: 'core/edit-post/toggle-fullscreen-mode/notice', |
8484 variant: "secondary", |
2527 type: 'snackbar', |
8485 className: "edit-post-layout__toggle-entities-saved-states-panel-button", |
2528 actions: [{ |
8486 onClick: openEntitiesSavedStates, |
2529 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), |
8487 "aria-expanded": false |
2530 onClick: () => { |
8488 }, (0,external_wp_i18n_namespaceObject.__)('Open save panel'))); |
2531 toggle('core/edit-post', 'fullscreenMode'); |
8489 } else { |
2532 } |
8490 unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", { |
2533 }] |
8491 className: "edit-post-layout__toggle-publish-panel" |
2534 }); |
8492 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
2535 } |
8493 variant: "secondary", |
2536 }); |
8494 className: "edit-post-layout__toggle-publish-panel-button", |
2537 } |
8495 onClick: togglePublishSidebar, |
2538 |
8496 "aria-expanded": false |
2539 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/use-padding-appender.js |
8497 }, (0,external_wp_i18n_namespaceObject.__)('Open publish panel'))); |
|
8498 } // Since EntitiesSavedStates controls its own panel, we can keep it |
|
8499 // always mounted to retain its own component state (such as checkboxes). |
|
8500 |
|
8501 |
|
8502 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, { |
|
8503 close: closeEntitiesSavedStates |
|
8504 }), (0,external_wp_element_namespaceObject.createElement)(actions_panel_Slot, { |
|
8505 bubblesVirtually: true |
|
8506 }), !isEntitiesSavedStatesOpen && unmountableContent); |
|
8507 } |
|
8508 |
|
8509 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/start-page-options/index.js |
|
8510 |
|
8511 |
|
8512 /** |
2540 /** |
8513 * WordPress dependencies |
2541 * WordPress dependencies |
8514 */ |
2542 */ |
8515 |
2543 |
8516 |
2544 |
8517 |
2545 |
8518 |
2546 |
|
2547 function usePaddingAppender() { |
|
2548 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); |
|
2549 return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { |
|
2550 function onMouseDown(event) { |
|
2551 if (event.target !== node) { |
|
2552 return; |
|
2553 } |
|
2554 const { |
|
2555 ownerDocument |
|
2556 } = node; |
|
2557 const { |
|
2558 defaultView |
|
2559 } = ownerDocument; |
|
2560 const pseudoHeight = defaultView.parseInt(defaultView.getComputedStyle(node, ':after').height, 10); |
|
2561 if (!pseudoHeight) { |
|
2562 return; |
|
2563 } |
|
2564 |
|
2565 // Only handle clicks under the last child. |
|
2566 const lastChild = node.lastElementChild; |
|
2567 if (!lastChild) { |
|
2568 return; |
|
2569 } |
|
2570 const lastChildRect = lastChild.getBoundingClientRect(); |
|
2571 if (event.clientY < lastChildRect.bottom) { |
|
2572 return; |
|
2573 } |
|
2574 event.stopPropagation(); |
|
2575 const blockOrder = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockOrder(''); |
|
2576 const lastBlockClientId = blockOrder[blockOrder.length - 1]; |
|
2577 const lastBlock = registry.select(external_wp_blockEditor_namespaceObject.store).getBlock(lastBlockClientId); |
|
2578 const { |
|
2579 selectBlock, |
|
2580 insertDefaultBlock |
|
2581 } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); |
|
2582 if (lastBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(lastBlock)) { |
|
2583 selectBlock(lastBlockClientId); |
|
2584 } else { |
|
2585 insertDefaultBlock(); |
|
2586 } |
|
2587 } |
|
2588 node.addEventListener('mousedown', onMouseDown); |
|
2589 return () => { |
|
2590 node.removeEventListener('mousedown', onMouseDown); |
|
2591 }; |
|
2592 }, [registry]); |
|
2593 } |
|
2594 |
|
2595 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/use-should-iframe.js |
|
2596 /** |
|
2597 * WordPress dependencies |
|
2598 */ |
|
2599 |
8519 |
2600 |
8520 |
2601 |
8521 |
2602 |
8522 /** |
2603 /** |
8523 * Internal dependencies |
2604 * Internal dependencies |
8524 */ |
2605 */ |
8525 |
2606 |
8526 |
2607 const isGutenbergPlugin = false ? 0 : false; |
8527 |
2608 function useShouldIframe() { |
8528 function PatternSelection(_ref) { |
|
8529 let { |
|
8530 onChoosePattern |
|
8531 } = _ref; |
|
8532 const { |
2609 const { |
8533 blockPatterns |
2610 isBlockBasedTheme, |
|
2611 hasV3BlocksOnly, |
|
2612 isEditingTemplate, |
|
2613 hasMetaBoxes |
8534 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
2614 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
8535 const { |
2615 const { |
8536 __experimentalGetPatternsByBlockTypes |
2616 getEditorSettings, |
8537 } = select(external_wp_blockEditor_namespaceObject.store); |
2617 getCurrentPostType |
|
2618 } = select(external_wp_editor_namespaceObject.store); |
|
2619 const { |
|
2620 getBlockTypes |
|
2621 } = select(external_wp_blocks_namespaceObject.store); |
|
2622 const editorSettings = getEditorSettings(); |
8538 return { |
2623 return { |
8539 blockPatterns: __experimentalGetPatternsByBlockTypes('core/post-content') |
2624 isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme, |
|
2625 hasV3BlocksOnly: getBlockTypes().every(type => { |
|
2626 return type.apiVersion >= 3; |
|
2627 }), |
|
2628 isEditingTemplate: getCurrentPostType() === 'wp_template', |
|
2629 hasMetaBoxes: select(store).hasMetaBoxes() |
8540 }; |
2630 }; |
8541 }, []); |
2631 }, []); |
8542 const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns); |
2632 return (hasV3BlocksOnly || isGutenbergPlugin && isBlockBasedTheme) && !hasMetaBoxes || isEditingTemplate; |
|
2633 } |
|
2634 |
|
2635 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/index.js |
|
2636 /** |
|
2637 * External dependencies |
|
2638 */ |
|
2639 |
|
2640 |
|
2641 /** |
|
2642 * WordPress dependencies |
|
2643 */ |
|
2644 |
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 |
|
2654 |
|
2655 |
|
2656 |
|
2657 |
|
2658 /** |
|
2659 * Internal dependencies |
|
2660 */ |
|
2661 |
|
2662 |
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 const { |
|
2677 getLayoutStyles |
|
2678 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); |
|
2679 const { |
|
2680 useCommands: layout_useCommands |
|
2681 } = unlock(external_wp_coreCommands_namespaceObject.privateApis); |
|
2682 const { |
|
2683 useCommandContext |
|
2684 } = unlock(external_wp_commands_namespaceObject.privateApis); |
|
2685 const { |
|
2686 EditorInterface, |
|
2687 FullscreenMode, |
|
2688 Sidebar |
|
2689 } = unlock(external_wp_editor_namespaceObject.privateApis); |
|
2690 const { |
|
2691 BlockKeyboardShortcuts |
|
2692 } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); |
|
2693 const DESIGN_POST_TYPES = ['wp_template', 'wp_template_part', 'wp_block', 'wp_navigation']; |
|
2694 function useEditorStyles() { |
8543 const { |
2695 const { |
8544 resetEditorBlocks |
2696 hasThemeStyleSupport, |
8545 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); |
2697 editorSettings, |
8546 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { |
2698 isZoomedOutView, |
8547 blockPatterns: blockPatterns, |
2699 renderingMode, |
8548 shownPatterns: shownBlockPatterns, |
2700 postType |
8549 onClickPattern: (_pattern, blocks) => { |
2701 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
8550 resetEditorBlocks(blocks); |
|
8551 onChoosePattern(); |
|
8552 } |
|
8553 }); |
|
8554 } |
|
8555 |
|
8556 const START_PAGE_MODAL_STATES = { |
|
8557 INITIAL: 'INITIAL', |
|
8558 PATTERN: 'PATTERN', |
|
8559 CLOSED: 'CLOSED' |
|
8560 }; |
|
8561 function StartPageOptions() { |
|
8562 const [modalState, setModalState] = (0,external_wp_element_namespaceObject.useState)(START_PAGE_MODAL_STATES.INITIAL); |
|
8563 const shouldOpenModel = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
8564 if (modalState !== START_PAGE_MODAL_STATES.INITIAL) { |
|
8565 return false; |
|
8566 } |
|
8567 |
|
8568 const { |
2702 const { |
8569 __experimentalGetPatternsByBlockTypes |
2703 __unstableGetEditorMode |
8570 } = select(external_wp_blockEditor_namespaceObject.store); |
2704 } = select(external_wp_blockEditor_namespaceObject.store); |
8571 const { |
2705 const { |
8572 getCurrentPostType, |
2706 getCurrentPostType, |
8573 getEditedPostContent, |
2707 getRenderingMode |
8574 isEditedPostSaveable |
|
8575 } = select(external_wp_editor_namespaceObject.store); |
2708 } = select(external_wp_editor_namespaceObject.store); |
8576 const { |
2709 const _postType = getCurrentPostType(); |
8577 isEditingTemplate, |
2710 return { |
8578 isFeatureActive |
2711 hasThemeStyleSupport: select(store).isFeatureActive('themeStyles'), |
8579 } = select(store_store); |
2712 editorSettings: select(external_wp_editor_namespaceObject.store).getEditorSettings(), |
8580 return getCurrentPostType() === 'page' && !isEditedPostSaveable() && '' === getEditedPostContent() && !isEditingTemplate() && !isFeatureActive('welcomeGuide') && __experimentalGetPatternsByBlockTypes('core/post-content').length >= 1; |
2713 isZoomedOutView: __unstableGetEditorMode() === 'zoom-out', |
8581 }, [modalState]); |
2714 renderingMode: getRenderingMode(), |
8582 (0,external_wp_element_namespaceObject.useEffect)(() => { |
2715 postType: _postType |
8583 if (shouldOpenModel) { |
2716 }; |
8584 setModalState(START_PAGE_MODAL_STATES.PATTERN); |
2717 }, []); |
|
2718 |
|
2719 // Compute the default styles. |
|
2720 return (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
2721 var _editorSettings$style, _editorSettings$style2, _editorSettings$style3; |
|
2722 const presetStyles = (_editorSettings$style = editorSettings.styles?.filter(style => style.__unstableType && style.__unstableType !== 'theme')) !== null && _editorSettings$style !== void 0 ? _editorSettings$style : []; |
|
2723 const defaultEditorStyles = [...editorSettings.defaultEditorStyles, ...presetStyles]; |
|
2724 |
|
2725 // Has theme styles if the theme supports them and if some styles were not preset styles (in which case they're theme styles). |
|
2726 const hasThemeStyles = hasThemeStyleSupport && presetStyles.length !== ((_editorSettings$style2 = editorSettings.styles?.length) !== null && _editorSettings$style2 !== void 0 ? _editorSettings$style2 : 0); |
|
2727 |
|
2728 // If theme styles are not present or displayed, ensure that |
|
2729 // base layout styles are still present in the editor. |
|
2730 if (!editorSettings.disableLayoutStyles && !hasThemeStyles) { |
|
2731 defaultEditorStyles.push({ |
|
2732 css: getLayoutStyles({ |
|
2733 style: {}, |
|
2734 selector: 'body', |
|
2735 hasBlockGapSupport: false, |
|
2736 hasFallbackGapSupport: true, |
|
2737 fallbackGapValue: '0.5em' |
|
2738 }) |
|
2739 }); |
8585 } |
2740 } |
8586 }, [shouldOpenModel]); |
2741 const baseStyles = hasThemeStyles ? (_editorSettings$style3 = editorSettings.styles) !== null && _editorSettings$style3 !== void 0 ? _editorSettings$style3 : [] : defaultEditorStyles; |
8587 |
2742 |
8588 if (modalState === START_PAGE_MODAL_STATES.INITIAL || modalState === START_PAGE_MODAL_STATES.CLOSED) { |
2743 // Add a space for the typewriter effect. When typing in the last block, |
8589 return null; |
2744 // there needs to be room to scroll up. |
8590 } |
2745 if (!isZoomedOutView && renderingMode === 'post-only' && !DESIGN_POST_TYPES.includes(postType)) { |
8591 |
2746 return [...baseStyles, { |
8592 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
2747 css: ':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}' |
8593 className: "edit-post-start-page-options__modal", |
2748 }]; |
8594 title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'), |
|
8595 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Cancel'), |
|
8596 onRequestClose: () => { |
|
8597 setModalState(START_PAGE_MODAL_STATES.CLOSED); |
|
8598 } |
2749 } |
8599 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
2750 return baseStyles; |
8600 className: "edit-post-start-page-options__modal-content" |
2751 }, [editorSettings.defaultEditorStyles, editorSettings.disableLayoutStyles, editorSettings.styles, hasThemeStyleSupport, postType]); |
8601 }, modalState === START_PAGE_MODAL_STATES.PATTERN && (0,external_wp_element_namespaceObject.createElement)(PatternSelection, { |
2752 } |
8602 onChoosePattern: () => { |
2753 function Layout({ |
8603 setModalState(START_PAGE_MODAL_STATES.CLOSED); |
2754 initialPost |
8604 } |
2755 }) { |
8605 }))); |
2756 layout_useCommands(); |
8606 } |
2757 useCommands(); |
8607 |
2758 const paddingAppenderRef = usePaddingAppender(); |
8608 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/index.js |
2759 const shouldIframe = useShouldIframe(); |
8609 |
|
8610 |
|
8611 /** |
|
8612 * External dependencies |
|
8613 */ |
|
8614 |
|
8615 /** |
|
8616 * WordPress dependencies |
|
8617 */ |
|
8618 |
|
8619 |
|
8620 |
|
8621 |
|
8622 |
|
8623 |
|
8624 |
|
8625 |
|
8626 |
|
8627 |
|
8628 |
|
8629 |
|
8630 /** |
|
8631 * Internal dependencies |
|
8632 */ |
|
8633 |
|
8634 |
|
8635 |
|
8636 |
|
8637 |
|
8638 |
|
8639 |
|
8640 |
|
8641 |
|
8642 |
|
8643 |
|
8644 |
|
8645 |
|
8646 |
|
8647 |
|
8648 |
|
8649 const interfaceLabels = { |
|
8650 /* translators: accessibility text for the editor top bar landmark region. */ |
|
8651 header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'), |
|
8652 |
|
8653 /* translators: accessibility text for the editor content landmark region. */ |
|
8654 body: (0,external_wp_i18n_namespaceObject.__)('Editor content'), |
|
8655 |
|
8656 /* translators: accessibility text for the editor settings landmark region. */ |
|
8657 sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'), |
|
8658 |
|
8659 /* translators: accessibility text for the editor publish landmark region. */ |
|
8660 actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'), |
|
8661 |
|
8662 /* translators: accessibility text for the editor footer landmark region. */ |
|
8663 footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer') |
|
8664 }; |
|
8665 |
|
8666 function Layout(_ref) { |
|
8667 let { |
|
8668 styles |
|
8669 } = _ref; |
|
8670 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); |
|
8671 const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>='); |
|
8672 const { |
|
8673 openGeneralSidebar, |
|
8674 closeGeneralSidebar, |
|
8675 setIsInserterOpened |
|
8676 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
8677 const { |
2760 const { |
8678 createErrorNotice |
2761 createErrorNotice |
8679 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
2762 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
8680 const { |
2763 const { |
8681 mode, |
2764 mode, |
8682 isFullscreenActive, |
2765 isFullscreenActive, |
8683 isRichEditingEnabled, |
|
8684 sidebarIsOpened, |
|
8685 hasActiveMetaboxes, |
2766 hasActiveMetaboxes, |
8686 hasFixedToolbar, |
|
8687 previousShortcut, |
|
8688 nextShortcut, |
|
8689 hasBlockSelected, |
2767 hasBlockSelected, |
8690 isInserterOpened, |
|
8691 isListViewOpened, |
|
8692 showIconLabels, |
2768 showIconLabels, |
8693 hasReducedUI, |
2769 isDistractionFree, |
8694 showBlockBreadcrumbs, |
2770 showMetaBoxes, |
8695 isTemplateMode, |
2771 hasHistory, |
8696 documentLabel |
2772 isEditingTemplate, |
|
2773 isWelcomeGuideVisible |
8697 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
2774 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
8698 const { |
2775 const { |
8699 getEditorSettings, |
2776 get |
8700 getPostTypeLabel |
2777 } = select(external_wp_preferences_namespaceObject.store); |
|
2778 const { |
|
2779 getEditorSettings |
8701 } = select(external_wp_editor_namespaceObject.store); |
2780 } = select(external_wp_editor_namespaceObject.store); |
8702 const editorSettings = getEditorSettings(); |
2781 const { |
8703 const postTypeLabel = getPostTypeLabel(); |
2782 isFeatureActive |
|
2783 } = select(store); |
8704 return { |
2784 return { |
8705 isTemplateMode: select(store_store).isEditingTemplate(), |
2785 mode: select(external_wp_editor_namespaceObject.store).getEditorMode(), |
8706 hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'), |
2786 isFullscreenActive: select(store).isFeatureActive('fullscreenMode'), |
8707 sidebarIsOpened: !!(select(store).getActiveComplementaryArea(store_store.name) || select(store_store).isPublishSidebarOpened()), |
2787 hasActiveMetaboxes: select(store).hasMetaBoxes(), |
8708 isFullscreenActive: select(store_store).isFeatureActive('fullscreenMode'), |
2788 hasBlockSelected: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), |
8709 isInserterOpened: select(store_store).isInserterOpened(), |
2789 showIconLabels: get('core', 'showIconLabels'), |
8710 isListViewOpened: select(store_store).isListViewOpened(), |
2790 isDistractionFree: get('core', 'distractionFree'), |
8711 mode: select(store_store).getEditorMode(), |
2791 showMetaBoxes: select(external_wp_editor_namespaceObject.store).getRenderingMode() === 'post-only', |
8712 isRichEditingEnabled: editorSettings.richEditingEnabled, |
2792 hasHistory: !!getEditorSettings().onNavigateToPreviousEntityRecord, |
8713 hasActiveMetaboxes: select(store_store).hasMetaBoxes(), |
2793 isEditingTemplate: select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', |
8714 previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/previous-region'), |
2794 isWelcomeGuideVisible: isFeatureActive('welcomeGuide') |
8715 nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/next-region'), |
|
8716 showIconLabels: select(store_store).isFeatureActive('showIconLabels'), |
|
8717 hasReducedUI: select(store_store).isFeatureActive('reducedUI'), |
|
8718 showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'), |
|
8719 // translators: Default label for the Document in the Block Breadcrumb. |
|
8720 documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun') |
|
8721 }; |
2795 }; |
8722 }, []); |
2796 }, []); |
8723 const className = classnames_default()('edit-post-layout', 'is-mode-' + mode, { |
2797 |
8724 'is-sidebar-opened': sidebarIsOpened, |
2798 // Set the right context for the command palette |
8725 'has-fixed-toolbar': hasFixedToolbar, |
2799 const commandContext = hasBlockSelected ? 'block-selection-edit' : 'entity-edit'; |
8726 'has-metaboxes': hasActiveMetaboxes, |
2800 useCommandContext(commandContext); |
8727 'show-icon-labels': showIconLabels |
2801 const styles = useEditorStyles(); |
8728 }); |
2802 |
8729 |
2803 // We need to add the show-icon-labels class to the body element so it is applied to modals. |
8730 const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive |
2804 if (showIconLabels) { |
8731 |
2805 document.body.classList.add('show-icon-labels'); |
8732 |
2806 } else { |
8733 (0,external_wp_element_namespaceObject.useEffect)(() => { |
2807 document.body.classList.remove('show-icon-labels'); |
8734 if (sidebarIsOpened && !isHugeViewport) { |
2808 } |
8735 setIsInserterOpened(false); |
2809 const className = dist_clsx('edit-post-layout', 'is-mode-' + mode, { |
|
2810 'has-metaboxes': hasActiveMetaboxes |
|
2811 }); |
|
2812 function onPluginAreaError(name) { |
|
2813 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */ |
|
2814 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); |
|
2815 } |
|
2816 const { |
|
2817 createSuccessNotice |
|
2818 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
2819 const onActionPerformed = (0,external_wp_element_namespaceObject.useCallback)((actionId, items) => { |
|
2820 switch (actionId) { |
|
2821 case 'move-to-trash': |
|
2822 { |
|
2823 document.location.href = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { |
|
2824 trashed: 1, |
|
2825 post_type: items[0].type, |
|
2826 ids: items[0].id |
|
2827 }); |
|
2828 } |
|
2829 break; |
|
2830 case 'duplicate-post': |
|
2831 { |
|
2832 const newItem = items[0]; |
|
2833 const title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered; |
|
2834 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( |
|
2835 // translators: %s: Title of the created post e.g: "Post 1". |
|
2836 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), { |
|
2837 type: 'snackbar', |
|
2838 id: 'duplicate-post-action', |
|
2839 actions: [{ |
|
2840 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), |
|
2841 onClick: () => { |
|
2842 const postId = newItem.id; |
|
2843 document.location.href = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { |
|
2844 post: postId, |
|
2845 action: 'edit' |
|
2846 }); |
|
2847 } |
|
2848 }] |
|
2849 }); |
|
2850 } |
|
2851 break; |
8736 } |
2852 } |
8737 }, [sidebarIsOpened, isHugeViewport]); |
2853 }, [createSuccessNotice]); |
8738 (0,external_wp_element_namespaceObject.useEffect)(() => { |
2854 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
8739 if (isInserterOpened && !isHugeViewport) { |
2855 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FullscreenMode, { |
8740 closeGeneralSidebar(); |
2856 isActive: isFullscreenActive |
8741 } |
2857 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(browser_url, { |
8742 }, [isInserterOpened, isHugeViewport]); // Local state for save panel. |
2858 hasHistory: hasHistory |
8743 // Note 'truthy' callback implies an open panel. |
2859 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.AutosaveMonitor, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.LocalAutosaveMonitor, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InitPatternModal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { |
8744 |
2860 onError: onPluginAreaError |
8745 const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false); |
2861 }), !isDistractionFree && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Sidebar, { |
8746 const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => { |
2862 onActionPerformed: onActionPerformed, |
8747 if (typeof entitiesSavedStatesCallback === 'function') { |
2863 extraPanels: !isEditingTemplate && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MetaBoxes, { |
8748 entitiesSavedStatesCallback(arg); |
2864 location: "side" |
8749 } |
2865 }) |
8750 |
2866 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(more_menu, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button, { |
8751 setEntitiesSavedStatesCallback(false); |
2867 initialPost: initialPost |
8752 }, [entitiesSavedStatesCallback]); |
2868 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorInterface, { |
8753 const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library'); |
2869 className: className, |
8754 |
2870 styles: styles, |
8755 const secondarySidebar = () => { |
2871 forceIsDirty: hasActiveMetaboxes, |
8756 if (mode === 'visual' && isInserterOpened) { |
2872 contentRef: paddingAppenderRef, |
8757 return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null); |
2873 disableIframe: !shouldIframe |
8758 } |
2874 // We should auto-focus the canvas (title) on load. |
8759 |
2875 // eslint-disable-next-line jsx-a11y/no-autofocus |
8760 if (mode === 'visual' && isListViewOpened) { |
2876 , |
8761 return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null); |
2877 autoFocus: !isWelcomeGuideVisible, |
8762 } |
2878 children: !isDistractionFree && showMetaBoxes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
8763 |
2879 className: "edit-post-layout__metaboxes", |
8764 return null; |
2880 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MetaBoxes, { |
8765 }; |
2881 location: "normal" |
8766 |
2882 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MetaBoxes, { |
8767 function onPluginAreaError(name) { |
2883 location: "advanced" |
8768 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( |
2884 })] |
8769 /* translators: %s: plugin name */ |
2885 }) |
8770 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); |
2886 })] |
8771 } |
2887 }); |
8772 |
2888 } |
8773 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode, { |
2889 /* harmony default export */ const layout = (Layout); |
8774 isActive: isFullscreenActive |
|
8775 }), (0,external_wp_element_namespaceObject.createElement)(browser_url, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.AutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.LocalAutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_wp_element_namespaceObject.createElement)(settings_sidebar, null), (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, { |
|
8776 className: className, |
|
8777 labels: { ...interfaceLabels, |
|
8778 secondarySidebar: secondarySidebarLabel |
|
8779 }, |
|
8780 header: (0,external_wp_element_namespaceObject.createElement)(header, { |
|
8781 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback |
|
8782 }), |
|
8783 secondarySidebar: secondarySidebar(), |
|
8784 sidebar: (!isMobileViewport || sidebarIsOpened) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !isMobileViewport && !sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8785 className: "edit-post-layout__toggle-sidebar-panel" |
|
8786 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
8787 variant: "secondary", |
|
8788 className: "edit-post-layout__toggle-sidebar-panel-button", |
|
8789 onClick: openSidebarPanel, |
|
8790 "aria-expanded": false |
|
8791 }, hasBlockSelected ? (0,external_wp_i18n_namespaceObject.__)('Open block settings') : (0,external_wp_i18n_namespaceObject.__)('Open document settings'))), (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, { |
|
8792 scope: "core/edit-post" |
|
8793 })), |
|
8794 notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), |
|
8795 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0,external_wp_element_namespaceObject.createElement)(text_editor, null), isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)(VisualEditor, { |
|
8796 styles: styles |
|
8797 }), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8798 className: "edit-post-layout__metaboxes" |
|
8799 }, (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, { |
|
8800 location: "normal" |
|
8801 }), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, { |
|
8802 location: "advanced" |
|
8803 })), isMobileViewport && sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ScrollLock, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, { |
|
8804 scope: "core/block-inspector" |
|
8805 })), |
|
8806 footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8807 className: "edit-post-layout__footer" |
|
8808 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { |
|
8809 rootLabelText: documentLabel |
|
8810 })), |
|
8811 actions: (0,external_wp_element_namespaceObject.createElement)(ActionsPanel, { |
|
8812 closeEntitiesSavedStates: closeEntitiesSavedStates, |
|
8813 isEntitiesSavedStatesOpen: entitiesSavedStatesCallback, |
|
8814 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback |
|
8815 }), |
|
8816 shortcuts: { |
|
8817 previous: previousShortcut, |
|
8818 next: nextShortcut |
|
8819 } |
|
8820 }), (0,external_wp_element_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null), (0,external_wp_element_namespaceObject.createElement)(StartPageOptions, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, { |
|
8821 onError: onPluginAreaError |
|
8822 })); |
|
8823 } |
|
8824 |
|
8825 /* harmony default export */ var components_layout = (Layout); |
|
8826 |
2890 |
8827 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/listener-hooks.js |
2891 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/listener-hooks.js |
8828 /** |
2892 /** |
8829 * WordPress dependencies |
2893 * WordPress dependencies |
8830 */ |
2894 */ |
8835 /** |
2899 /** |
8836 * Internal dependencies |
2900 * Internal dependencies |
8837 */ |
2901 */ |
8838 |
2902 |
8839 |
2903 |
8840 /** |
|
8841 * This listener hook monitors for block selection and triggers the appropriate |
|
8842 * sidebar state. |
|
8843 * |
|
8844 * @param {number} postId The current post id. |
|
8845 */ |
|
8846 |
|
8847 const useBlockSelectionListener = postId => { |
|
8848 const { |
|
8849 hasBlockSelection, |
|
8850 isEditorSidebarOpened |
|
8851 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
8852 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), |
|
8853 isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened() |
|
8854 }), [postId]); |
|
8855 const { |
|
8856 openGeneralSidebar |
|
8857 } = (0,external_wp_data_namespaceObject.useDispatch)(constants_STORE_NAME); |
|
8858 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
8859 if (!isEditorSidebarOpened) { |
|
8860 return; |
|
8861 } |
|
8862 |
|
8863 if (hasBlockSelection) { |
|
8864 openGeneralSidebar('edit-post/block'); |
|
8865 } else { |
|
8866 openGeneralSidebar('edit-post/document'); |
|
8867 } |
|
8868 }, [hasBlockSelection, isEditorSidebarOpened]); |
|
8869 }; |
|
8870 /** |
2904 /** |
8871 * This listener hook monitors any change in permalink and updates the view |
2905 * This listener hook monitors any change in permalink and updates the view |
8872 * post link in the admin bar. |
2906 * post link in the admin bar. |
8873 * |
2907 */ |
8874 * @param {number} postId |
2908 const useUpdatePostLinkListener = () => { |
8875 */ |
|
8876 |
|
8877 const useUpdatePostLinkListener = postId => { |
|
8878 const { |
2909 const { |
8879 newPermalink |
2910 newPermalink |
8880 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
2911 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
8881 newPermalink: select(external_wp_editor_namespaceObject.store).getCurrentPost().link |
2912 newPermalink: select(external_wp_editor_namespaceObject.store).getCurrentPost().link |
8882 }), [postId]); |
2913 }), []); |
8883 const nodeToUpdate = (0,external_wp_element_namespaceObject.useRef)(); |
2914 const nodeToUpdate = (0,external_wp_element_namespaceObject.useRef)(); |
8884 (0,external_wp_element_namespaceObject.useEffect)(() => { |
2915 (0,external_wp_element_namespaceObject.useEffect)(() => { |
8885 nodeToUpdate.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR); |
2916 nodeToUpdate.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR); |
8886 }, [postId]); |
2917 }, []); |
8887 (0,external_wp_element_namespaceObject.useEffect)(() => { |
2918 (0,external_wp_element_namespaceObject.useEffect)(() => { |
8888 if (!newPermalink || !nodeToUpdate.current) { |
2919 if (!newPermalink || !nodeToUpdate.current) { |
8889 return; |
2920 return; |
8890 } |
2921 } |
8891 |
|
8892 nodeToUpdate.current.setAttribute('href', newPermalink); |
2922 nodeToUpdate.current.setAttribute('href', newPermalink); |
8893 }, [newPermalink]); |
2923 }, [newPermalink]); |
8894 }; |
2924 }; |
8895 |
2925 |
8896 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/index.js |
2926 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/index.js |
8897 /** |
2927 /** |
8898 * Internal dependencies |
2928 * Internal dependencies |
8899 */ |
2929 */ |
8900 |
2930 |
|
2931 |
8901 /** |
2932 /** |
8902 * Data component used for initializing the editor and re-initializes |
2933 * Data component used for initializing the editor and re-initializes |
8903 * when postId changes or on unmount. |
2934 * when postId changes or on unmount. |
8904 * |
2935 * |
8905 * @param {number} postId The id of the post. |
|
8906 * @return {null} This is a data component so does not render any ui. |
2936 * @return {null} This is a data component so does not render any ui. |
8907 */ |
2937 */ |
8908 |
2938 function EditorInitialization() { |
8909 function EditorInitialization(_ref) { |
2939 useUpdatePostLinkListener(); |
8910 let { |
|
8911 postId |
|
8912 } = _ref; |
|
8913 useBlockSelectionListener(postId); |
|
8914 useUpdatePostLinkListener(postId); |
|
8915 return null; |
2940 return null; |
8916 } |
2941 } |
8917 |
2942 |
|
2943 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/use-navigate-to-entity-record.js |
|
2944 /** |
|
2945 * WordPress dependencies |
|
2946 */ |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 /** |
|
2952 * A hook that records the 'entity' history in the post editor as a user |
|
2953 * navigates between editing a post and editing the post template or patterns. |
|
2954 * |
|
2955 * Implemented as a stack, so a little similar to the browser history API. |
|
2956 * |
|
2957 * Used to control displaying UI elements like the back button. |
|
2958 * |
|
2959 * @param {number} initialPostId The post id of the post when the editor loaded. |
|
2960 * @param {string} initialPostType The post type of the post when the editor loaded. |
|
2961 * @param {string} defaultRenderingMode The rendering mode to switch to when navigating. |
|
2962 * |
|
2963 * @return {Object} An object containing the `currentPost` variable and |
|
2964 * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions. |
|
2965 */ |
|
2966 function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) { |
|
2967 const [postHistory, dispatch] = (0,external_wp_element_namespaceObject.useReducer)((historyState, { |
|
2968 type, |
|
2969 post, |
|
2970 previousRenderingMode |
|
2971 }) => { |
|
2972 if (type === 'push') { |
|
2973 return [...historyState, { |
|
2974 post, |
|
2975 previousRenderingMode |
|
2976 }]; |
|
2977 } |
|
2978 if (type === 'pop') { |
|
2979 // Try to leave one item in the history. |
|
2980 if (historyState.length > 1) { |
|
2981 return historyState.slice(0, -1); |
|
2982 } |
|
2983 } |
|
2984 return historyState; |
|
2985 }, [{ |
|
2986 post: { |
|
2987 postId: initialPostId, |
|
2988 postType: initialPostType |
|
2989 } |
|
2990 }]); |
|
2991 const { |
|
2992 post, |
|
2993 previousRenderingMode |
|
2994 } = postHistory[postHistory.length - 1]; |
|
2995 const { |
|
2996 getRenderingMode |
|
2997 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); |
|
2998 const { |
|
2999 setRenderingMode |
|
3000 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); |
|
3001 const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => { |
|
3002 dispatch({ |
|
3003 type: 'push', |
|
3004 post: { |
|
3005 postId: params.postId, |
|
3006 postType: params.postType |
|
3007 }, |
|
3008 // Save the current rendering mode so we can restore it when navigating back. |
|
3009 previousRenderingMode: getRenderingMode() |
|
3010 }); |
|
3011 setRenderingMode(defaultRenderingMode); |
|
3012 }, [getRenderingMode, setRenderingMode, defaultRenderingMode]); |
|
3013 const onNavigateToPreviousEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(() => { |
|
3014 dispatch({ |
|
3015 type: 'pop' |
|
3016 }); |
|
3017 if (previousRenderingMode) { |
|
3018 setRenderingMode(previousRenderingMode); |
|
3019 } |
|
3020 }, [setRenderingMode, previousRenderingMode]); |
|
3021 return { |
|
3022 currentPost: post, |
|
3023 onNavigateToEntityRecord, |
|
3024 onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : undefined |
|
3025 }; |
|
3026 } |
|
3027 |
8918 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/editor.js |
3028 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/editor.js |
8919 |
|
8920 |
|
8921 |
|
8922 /** |
|
8923 * External dependencies |
|
8924 */ |
|
8925 |
|
8926 /** |
3029 /** |
8927 * WordPress dependencies |
3030 * WordPress dependencies |
8928 */ |
3031 */ |
8929 |
3032 |
8930 |
3033 |
8931 |
3034 |
8932 |
3035 |
8933 |
3036 |
8934 |
3037 |
8935 |
3038 |
8936 |
|
8937 |
|
8938 /** |
3039 /** |
8939 * Internal dependencies |
3040 * Internal dependencies |
8940 */ |
3041 */ |
8941 |
3042 |
8942 |
3043 |
8943 |
3044 |
8944 |
3045 |
8945 |
3046 |
8946 function Editor(_ref) { |
3047 |
8947 let { |
3048 |
8948 postId, |
3049 const { |
8949 postType, |
3050 ExperimentalEditorProvider |
8950 settings, |
3051 } = unlock(external_wp_editor_namespaceObject.privateApis); |
8951 initialEdits, |
3052 function Editor({ |
8952 onError, |
3053 postId: initialPostId, |
8953 ...props |
3054 postType: initialPostType, |
8954 } = _ref; |
3055 settings, |
|
3056 initialEdits, |
|
3057 ...props |
|
3058 }) { |
8955 const { |
3059 const { |
8956 hasFixedToolbar, |
3060 currentPost, |
8957 focusMode, |
3061 onNavigateToEntityRecord, |
8958 hasReducedUI, |
3062 onNavigateToPreviousEntityRecord |
8959 hasThemeStyles, |
3063 } = useNavigateToEntityRecord(initialPostId, initialPostType, 'post-only'); |
|
3064 const { |
8960 post, |
3065 post, |
8961 preferredStyleVariations, |
|
8962 hiddenBlockTypes, |
|
8963 blockTypes, |
|
8964 keepCaretInsideBlock, |
|
8965 isTemplateMode, |
|
8966 template |
3066 template |
8967 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
3067 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
8968 var _getPostType$viewable, _getPostType; |
3068 var _getPostType$viewable; |
8969 |
|
8970 const { |
3069 const { |
8971 isFeatureActive, |
3070 getEditedPostTemplate |
8972 __experimentalGetPreviewDeviceType, |
3071 } = select(store); |
8973 isEditingTemplate, |
|
8974 getEditedPostTemplate, |
|
8975 getHiddenBlockTypes |
|
8976 } = select(store_store); |
|
8977 const { |
3072 const { |
8978 getEntityRecord, |
3073 getEntityRecord, |
8979 getPostType, |
3074 getPostType, |
8980 getEntityRecords |
3075 canUser |
8981 } = select(external_wp_coreData_namespaceObject.store); |
3076 } = select(external_wp_coreData_namespaceObject.store); |
8982 const { |
3077 const { |
8983 getEditorSettings |
3078 getEditorSettings |
8984 } = select(external_wp_editor_namespaceObject.store); |
3079 } = select(external_wp_editor_namespaceObject.store); |
8985 const { |
3080 const postObject = getEntityRecord('postType', currentPost.postType, currentPost.postId); |
8986 getBlockTypes |
|
8987 } = select(external_wp_blocks_namespaceObject.store); |
|
8988 const isTemplate = ['wp_template', 'wp_template_part'].includes(postType); // Ideally the initializeEditor function should be called using the ID of the REST endpoint. |
|
8989 // to avoid the special case. |
|
8990 |
|
8991 let postObject; |
|
8992 |
|
8993 if (isTemplate) { |
|
8994 const posts = getEntityRecords('postType', postType, { |
|
8995 wp_id: postId |
|
8996 }); |
|
8997 postObject = posts === null || posts === void 0 ? void 0 : posts[0]; |
|
8998 } else { |
|
8999 postObject = getEntityRecord('postType', postType, postId); |
|
9000 } |
|
9001 |
|
9002 const supportsTemplateMode = getEditorSettings().supportsTemplateMode; |
3081 const supportsTemplateMode = getEditorSettings().supportsTemplateMode; |
9003 const isViewable = (_getPostType$viewable = (_getPostType = getPostType(postType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; |
3082 const isViewable = (_getPostType$viewable = getPostType(currentPost.postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; |
|
3083 const canViewTemplate = canUser('read', 'templates'); |
9004 return { |
3084 return { |
9005 hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop', |
3085 template: supportsTemplateMode && isViewable && canViewTemplate && currentPost.postType !== 'wp_template' ? getEditedPostTemplate() : null, |
9006 focusMode: isFeatureActive('focusMode'), |
|
9007 hasReducedUI: isFeatureActive('reducedUI'), |
|
9008 hasThemeStyles: isFeatureActive('themeStyles'), |
|
9009 preferredStyleVariations: select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations'), |
|
9010 hiddenBlockTypes: getHiddenBlockTypes(), |
|
9011 blockTypes: getBlockTypes(), |
|
9012 keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'), |
|
9013 isTemplateMode: isEditingTemplate(), |
|
9014 template: supportsTemplateMode && isViewable ? getEditedPostTemplate() : null, |
|
9015 post: postObject |
3086 post: postObject |
9016 }; |
3087 }; |
9017 }, [postType, postId]); |
3088 }, [currentPost.postType, currentPost.postId]); |
9018 const { |
3089 const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ |
9019 updatePreferredStyleVariations, |
3090 ...settings, |
9020 setIsInserterOpened |
3091 onNavigateToEntityRecord, |
9021 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
3092 onNavigateToPreviousEntityRecord, |
9022 const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { |
3093 defaultRenderingMode: 'post-only' |
9023 const result = { ...settings, |
3094 }), [settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]); |
9024 __experimentalPreferredStyleVariations: { |
3095 const initialPost = (0,external_wp_element_namespaceObject.useMemo)(() => { |
9025 value: preferredStyleVariations, |
3096 return { |
9026 onChange: updatePreferredStyleVariations |
3097 type: initialPostType, |
9027 }, |
3098 id: initialPostId |
9028 hasFixedToolbar, |
3099 }; |
9029 focusMode, |
3100 }, [initialPostType, initialPostId]); |
9030 hasReducedUI, |
|
9031 // This is marked as experimental to give time for the quick inserter to mature. |
|
9032 __experimentalSetIsInserterOpened: setIsInserterOpened, |
|
9033 keepCaretInsideBlock, |
|
9034 // Keep a reference of the `allowedBlockTypes` from the server to handle use cases |
|
9035 // where we need to differentiate if a block is disabled by the user or some plugin. |
|
9036 defaultAllowedBlockTypes: settings.allowedBlockTypes |
|
9037 }; // Omit hidden block types if exists and non-empty. |
|
9038 |
|
9039 if ((0,external_lodash_namespaceObject.size)(hiddenBlockTypes) > 0) { |
|
9040 // Defer to passed setting for `allowedBlockTypes` if provided as |
|
9041 // anything other than `true` (where `true` is equivalent to allow |
|
9042 // all block types). |
|
9043 const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? (0,external_lodash_namespaceObject.map)(blockTypes, 'name') : settings.allowedBlockTypes || []; |
|
9044 result.allowedBlockTypes = (0,external_lodash_namespaceObject.without)(defaultAllowedBlockTypes, ...hiddenBlockTypes); |
|
9045 } |
|
9046 |
|
9047 return result; |
|
9048 }, [settings, hasFixedToolbar, focusMode, hasReducedUI, hiddenBlockTypes, blockTypes, preferredStyleVariations, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]); |
|
9049 const styles = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
9050 const themeStyles = []; |
|
9051 const presetStyles = []; |
|
9052 (0,external_lodash_namespaceObject.forEach)(settings.styles, style => { |
|
9053 if (!style.__unstableType || style.__unstableType === 'theme') { |
|
9054 themeStyles.push(style); |
|
9055 } else { |
|
9056 presetStyles.push(style); |
|
9057 } |
|
9058 }); |
|
9059 const defaultEditorStyles = [...settings.defaultEditorStyles, ...presetStyles]; |
|
9060 return hasThemeStyles && themeStyles.length ? settings.styles : defaultEditorStyles; |
|
9061 }, [settings, hasThemeStyles]); |
|
9062 |
|
9063 if (!post) { |
3101 if (!post) { |
9064 return null; |
3102 return null; |
9065 } |
3103 } |
9066 |
3104 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { |
9067 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.StrictMode, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorProvider, _extends({ |
3105 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ExperimentalEditorProvider, { |
9068 settings: editorSettings, |
3106 settings: editorSettings, |
9069 post: post, |
3107 post: post, |
9070 initialEdits: initialEdits, |
3108 initialEdits: initialEdits, |
9071 useSubRegistry: false, |
3109 useSubRegistry: false, |
9072 __unstableTemplate: isTemplateMode ? template : undefined |
3110 __unstableTemplate: template, |
9073 }, props), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.ErrorBoundary, { |
3111 ...props, |
9074 onError: onError |
3112 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_editor_namespaceObject.ErrorBoundary, { |
9075 }, (0,external_wp_element_namespaceObject.createElement)(EditorInitialization, { |
3113 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_commands_namespaceObject.CommandMenu, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorInitialization, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout, { |
9076 postId: postId |
3114 initialPost: initialPost |
9077 }), (0,external_wp_element_namespaceObject.createElement)(components_layout, { |
3115 })] |
9078 styles: styles |
3116 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PostLockedModal, {})] |
9079 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null))))); |
3117 }) |
9080 } |
3118 }); |
9081 |
3119 } |
9082 /* harmony default export */ var editor = (Editor); |
3120 /* harmony default export */ const editor = (Editor); |
9083 |
3121 |
9084 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js |
3122 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/deprecated.js |
9085 |
|
9086 |
|
9087 /** |
|
9088 * External dependencies |
|
9089 */ |
|
9090 |
|
9091 /** |
3123 /** |
9092 * WordPress dependencies |
3124 * WordPress dependencies |
9093 */ |
3125 */ |
9094 |
3126 |
9095 |
3127 |
9096 |
3128 |
9097 |
3129 |
9098 |
3130 /** |
9099 const isEverySelectedBlockAllowed = (selected, allowed) => (0,external_lodash_namespaceObject.difference)(selected, allowed).length === 0; |
3131 * Internal dependencies |
9100 /** |
3132 */ |
9101 * Plugins may want to add an item to the menu either for every block |
3133 |
9102 * or only for the specific ones provided in the `allowedBlocks` component property. |
3134 |
9103 * |
3135 const { |
9104 * If there are multiple blocks selected the item will be rendered if every block |
3136 PluginPostExcerpt |
9105 * is of one allowed type (not necessarily the same). |
3137 } = unlock(external_wp_editor_namespaceObject.privateApis); |
9106 * |
3138 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); |
9107 * @param {string[]} selectedBlocks Array containing the names of the blocks selected |
3139 const deprecateSlot = name => { |
9108 * @param {string[]} allowedBlocks Array containing the names of the blocks allowed |
3140 external_wp_deprecated_default()(`wp.editPost.${name}`, { |
9109 * @return {boolean} Whether the item will be rendered or not. |
3141 since: '6.6', |
9110 */ |
3142 alternative: `wp.editor.${name}` |
9111 |
|
9112 |
|
9113 const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks); |
|
9114 /** |
|
9115 * Renders a new item in the block settings menu. |
|
9116 * |
|
9117 * @param {Object} props Component props. |
|
9118 * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list. |
|
9119 * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element. |
|
9120 * @param {string} props.label The menu item text. |
|
9121 * @param {Function} props.onClick Callback function to be executed when the user click the menu item. |
|
9122 * @param {boolean} [props.small] Whether to render the label or not. |
|
9123 * @param {string} [props.role] The ARIA role for the menu item. |
|
9124 * |
|
9125 * @example |
|
9126 * ```js |
|
9127 * // Using ES5 syntax |
|
9128 * var __ = wp.i18n.__; |
|
9129 * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem; |
|
9130 * |
|
9131 * function doOnClick(){ |
|
9132 * // To be called when the user clicks the menu item. |
|
9133 * } |
|
9134 * |
|
9135 * function MyPluginBlockSettingsMenuItem() { |
|
9136 * return wp.element.createElement( |
|
9137 * PluginBlockSettingsMenuItem, |
|
9138 * { |
|
9139 * allowedBlocks: [ 'core/paragraph' ], |
|
9140 * icon: 'dashicon-name', |
|
9141 * label: __( 'Menu item text' ), |
|
9142 * onClick: doOnClick, |
|
9143 * } |
|
9144 * ); |
|
9145 * } |
|
9146 * ``` |
|
9147 * |
|
9148 * @example |
|
9149 * ```jsx |
|
9150 * // Using ESNext syntax |
|
9151 * import { __ } from '@wordpress/i18n'; |
|
9152 * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post'; |
|
9153 * |
|
9154 * const doOnClick = ( ) => { |
|
9155 * // To be called when the user clicks the menu item. |
|
9156 * }; |
|
9157 * |
|
9158 * const MyPluginBlockSettingsMenuItem = () => ( |
|
9159 * <PluginBlockSettingsMenuItem |
|
9160 * allowedBlocks={ [ 'core/paragraph' ] } |
|
9161 * icon='dashicon-name' |
|
9162 * label={ __( 'Menu item text' ) } |
|
9163 * onClick={ doOnClick } /> |
|
9164 * ); |
|
9165 * ``` |
|
9166 * |
|
9167 * @return {WPComponent} The component to be rendered. |
|
9168 */ |
|
9169 |
|
9170 |
|
9171 const PluginBlockSettingsMenuItem = _ref => { |
|
9172 let { |
|
9173 allowedBlocks, |
|
9174 icon, |
|
9175 label, |
|
9176 onClick, |
|
9177 small, |
|
9178 role |
|
9179 } = _ref; |
|
9180 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => { |
|
9181 let { |
|
9182 selectedBlocks, |
|
9183 onClose |
|
9184 } = _ref2; |
|
9185 |
|
9186 if (!shouldRenderItem(selectedBlocks, allowedBlocks)) { |
|
9187 return null; |
|
9188 } |
|
9189 |
|
9190 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
9191 onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose), |
|
9192 icon: icon, |
|
9193 label: small ? label : undefined, |
|
9194 role: role |
|
9195 }, !small && label); |
|
9196 }); |
3143 }); |
9197 }; |
3144 }; |
9198 |
3145 |
9199 /* harmony default export */ var plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem); |
3146 /* eslint-disable jsdoc/require-param */ |
9200 |
3147 /** |
9201 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-more-menu-item/index.js |
3148 * @see PluginBlockSettingsMenuItem in @wordpress/editor package. |
|
3149 */ |
|
3150 function PluginBlockSettingsMenuItem(props) { |
|
3151 if (isSiteEditor) { |
|
3152 return null; |
|
3153 } |
|
3154 deprecateSlot('PluginBlockSettingsMenuItem'); |
|
3155 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginBlockSettingsMenuItem, { |
|
3156 ...props |
|
3157 }); |
|
3158 } |
|
3159 |
|
3160 /** |
|
3161 * @see PluginDocumentSettingPanel in @wordpress/editor package. |
|
3162 */ |
|
3163 function PluginDocumentSettingPanel(props) { |
|
3164 if (isSiteEditor) { |
|
3165 return null; |
|
3166 } |
|
3167 deprecateSlot('PluginDocumentSettingPanel'); |
|
3168 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginDocumentSettingPanel, { |
|
3169 ...props |
|
3170 }); |
|
3171 } |
|
3172 |
|
3173 /** |
|
3174 * @see PluginMoreMenuItem in @wordpress/editor package. |
|
3175 */ |
|
3176 function PluginMoreMenuItem(props) { |
|
3177 if (isSiteEditor) { |
|
3178 return null; |
|
3179 } |
|
3180 deprecateSlot('PluginMoreMenuItem'); |
|
3181 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { |
|
3182 ...props |
|
3183 }); |
|
3184 } |
|
3185 |
|
3186 /** |
|
3187 * @see PluginPrePublishPanel in @wordpress/editor package. |
|
3188 */ |
|
3189 function PluginPrePublishPanel(props) { |
|
3190 if (isSiteEditor) { |
|
3191 return null; |
|
3192 } |
|
3193 deprecateSlot('PluginPrePublishPanel'); |
|
3194 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginPrePublishPanel, { |
|
3195 ...props |
|
3196 }); |
|
3197 } |
|
3198 |
|
3199 /** |
|
3200 * @see PluginPostPublishPanel in @wordpress/editor package. |
|
3201 */ |
|
3202 function PluginPostPublishPanel(props) { |
|
3203 if (isSiteEditor) { |
|
3204 return null; |
|
3205 } |
|
3206 deprecateSlot('PluginPostPublishPanel'); |
|
3207 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginPostPublishPanel, { |
|
3208 ...props |
|
3209 }); |
|
3210 } |
|
3211 |
|
3212 /** |
|
3213 * @see PluginPostStatusInfo in @wordpress/editor package. |
|
3214 */ |
|
3215 function PluginPostStatusInfo(props) { |
|
3216 if (isSiteEditor) { |
|
3217 return null; |
|
3218 } |
|
3219 deprecateSlot('PluginPostStatusInfo'); |
|
3220 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginPostStatusInfo, { |
|
3221 ...props |
|
3222 }); |
|
3223 } |
|
3224 |
|
3225 /** |
|
3226 * @see PluginSidebar in @wordpress/editor package. |
|
3227 */ |
|
3228 function PluginSidebar(props) { |
|
3229 if (isSiteEditor) { |
|
3230 return null; |
|
3231 } |
|
3232 deprecateSlot('PluginSidebar'); |
|
3233 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { |
|
3234 ...props |
|
3235 }); |
|
3236 } |
|
3237 |
|
3238 /** |
|
3239 * @see PluginSidebarMoreMenuItem in @wordpress/editor package. |
|
3240 */ |
|
3241 function PluginSidebarMoreMenuItem(props) { |
|
3242 if (isSiteEditor) { |
|
3243 return null; |
|
3244 } |
|
3245 deprecateSlot('PluginSidebarMoreMenuItem'); |
|
3246 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { |
|
3247 ...props |
|
3248 }); |
|
3249 } |
|
3250 |
|
3251 /** |
|
3252 * @see PluginPostExcerpt in @wordpress/editor package. |
|
3253 */ |
|
3254 function __experimentalPluginPostExcerpt() { |
|
3255 if (isSiteEditor) { |
|
3256 return null; |
|
3257 } |
|
3258 external_wp_deprecated_default()('wp.editPost.__experimentalPluginPostExcerpt', { |
|
3259 since: '6.6', |
|
3260 hint: 'Core and custom panels can be access programmatically using their panel name.', |
|
3261 link: 'https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically' |
|
3262 }); |
|
3263 return PluginPostExcerpt; |
|
3264 } |
|
3265 |
|
3266 /* eslint-enable jsdoc/require-param */ |
|
3267 |
|
3268 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/index.js |
9202 /** |
3269 /** |
9203 * WordPress dependencies |
3270 * WordPress dependencies |
9204 */ |
3271 */ |
9205 |
3272 |
9206 |
3273 |
9207 |
3274 |
9208 |
3275 |
9209 /** |
|
9210 * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided. |
|
9211 * The text within the component appears as the menu item label. |
|
9212 * |
|
9213 * @param {Object} props Component properties. |
|
9214 * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor. |
|
9215 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. |
|
9216 * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item. |
|
9217 * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component. |
|
9218 * |
|
9219 * @example |
|
9220 * ```js |
|
9221 * // Using ES5 syntax |
|
9222 * var __ = wp.i18n.__; |
|
9223 * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem; |
|
9224 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. |
|
9225 * |
|
9226 * function onButtonClick() { |
|
9227 * alert( 'Button clicked.' ); |
|
9228 * } |
|
9229 * |
|
9230 * function MyButtonMoreMenuItem() { |
|
9231 * return wp.element.createElement( |
|
9232 * PluginMoreMenuItem, |
|
9233 * { |
|
9234 * icon: moreIcon, |
|
9235 * onClick: onButtonClick, |
|
9236 * }, |
|
9237 * __( 'My button title' ) |
|
9238 * ); |
|
9239 * } |
|
9240 * ``` |
|
9241 * |
|
9242 * @example |
|
9243 * ```jsx |
|
9244 * // Using ESNext syntax |
|
9245 * import { __ } from '@wordpress/i18n'; |
|
9246 * import { PluginMoreMenuItem } from '@wordpress/edit-post'; |
|
9247 * import { more } from '@wordpress/icons'; |
|
9248 * |
|
9249 * function onButtonClick() { |
|
9250 * alert( 'Button clicked.' ); |
|
9251 * } |
|
9252 * |
|
9253 * const MyButtonMoreMenuItem = () => ( |
|
9254 * <PluginMoreMenuItem |
|
9255 * icon={ more } |
|
9256 * onClick={ onButtonClick } |
|
9257 * > |
|
9258 * { __( 'My button title' ) } |
|
9259 * </PluginMoreMenuItem> |
|
9260 * ); |
|
9261 * ``` |
|
9262 * |
|
9263 * @return {WPComponent} The component to be rendered. |
|
9264 */ |
|
9265 |
|
9266 /* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { |
|
9267 var _ownProps$as; |
|
9268 |
|
9269 return { |
|
9270 as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem, |
|
9271 icon: ownProps.icon || context.icon, |
|
9272 name: 'core/edit-post/plugin-more-menu' |
|
9273 }; |
|
9274 }))(action_item)); |
|
9275 |
|
9276 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-sidebar-more-menu-item/index.js |
|
9277 |
|
9278 |
|
9279 |
|
9280 /** |
|
9281 * WordPress dependencies |
|
9282 */ |
|
9283 |
|
9284 /** |
|
9285 * Renders a menu item in `Plugins` group in `More Menu` drop down, |
|
9286 * and can be used to activate the corresponding `PluginSidebar` component. |
|
9287 * The text within the component appears as the menu item label. |
|
9288 * |
|
9289 * @param {Object} props Component props. |
|
9290 * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar. |
|
9291 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. |
|
9292 * |
|
9293 * @example |
|
9294 * ```js |
|
9295 * // Using ES5 syntax |
|
9296 * var __ = wp.i18n.__; |
|
9297 * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem; |
|
9298 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. |
|
9299 * |
|
9300 * function MySidebarMoreMenuItem() { |
|
9301 * return wp.element.createElement( |
|
9302 * PluginSidebarMoreMenuItem, |
|
9303 * { |
|
9304 * target: 'my-sidebar', |
|
9305 * icon: moreIcon, |
|
9306 * }, |
|
9307 * __( 'My sidebar title' ) |
|
9308 * ) |
|
9309 * } |
|
9310 * ``` |
|
9311 * |
|
9312 * @example |
|
9313 * ```jsx |
|
9314 * // Using ESNext syntax |
|
9315 * import { __ } from '@wordpress/i18n'; |
|
9316 * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post'; |
|
9317 * import { more } from '@wordpress/icons'; |
|
9318 * |
|
9319 * const MySidebarMoreMenuItem = () => ( |
|
9320 * <PluginSidebarMoreMenuItem |
|
9321 * target="my-sidebar" |
|
9322 * icon={ more } |
|
9323 * > |
|
9324 * { __( 'My sidebar title' ) } |
|
9325 * </PluginSidebarMoreMenuItem> |
|
9326 * ); |
|
9327 * ``` |
|
9328 * |
|
9329 * @return {WPComponent} The component to be rendered. |
|
9330 */ |
|
9331 |
|
9332 function PluginSidebarMoreMenuItem(props) { |
|
9333 return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility. |
|
9334 // @see https://github.com/WordPress/gutenberg/issues/14457 |
|
9335 , _extends({ |
|
9336 __unstableExplicitMenuItem: true, |
|
9337 scope: "core/edit-post" |
|
9338 }, props)); |
|
9339 } |
|
9340 |
|
9341 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/index.js |
|
9342 |
|
9343 |
|
9344 /** |
|
9345 * WordPress dependencies |
|
9346 */ |
|
9347 |
|
9348 |
3276 |
9349 |
3277 |
9350 |
3278 |
9351 |
3279 |
9352 |
3280 |