changeset 19 | 3d72ae0968f4 |
parent 18 | be944660c56a |
child 21 | 48c4eec2b7e6 |
18:be944660c56a | 19:3d72ae0968f4 |
---|---|
1 this["wp"] = this["wp"] || {}; this["wp"]["editor"] = |
1 /******/ (function() { // webpackBootstrap |
2 /******/ (function(modules) { // webpackBootstrap |
2 /******/ var __webpack_modules__ = ({ |
3 /******/ // The module cache |
3 |
4 /******/ var installedModules = {}; |
4 /***/ 6411: |
5 /******/ |
5 /***/ (function(module, exports) { |
6 /******/ // The require function |
6 |
7 /******/ function __webpack_require__(moduleId) { |
7 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
8 /******/ |
8 autosize 4.0.4 |
9 /******/ // Check if module is in cache |
9 license: MIT |
10 /******/ if(installedModules[moduleId]) { |
10 http://www.jacklmoore.com/autosize |
11 /******/ return installedModules[moduleId].exports; |
11 */ |
12 /******/ } |
12 (function (global, factory) { |
13 /******/ // Create a new module (and put it into the cache) |
13 if (true) { |
14 /******/ var module = installedModules[moduleId] = { |
14 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), |
15 /******/ i: moduleId, |
15 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? |
16 /******/ l: false, |
16 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), |
17 /******/ exports: {} |
17 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
18 /******/ }; |
18 } else { var mod; } |
19 /******/ |
19 })(this, function (module, exports) { |
20 /******/ // Execute the module function |
20 'use strict'; |
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
21 |
22 /******/ |
22 var map = typeof Map === "function" ? new Map() : function () { |
23 /******/ // Flag the module as loaded |
23 var keys = []; |
24 /******/ module.l = true; |
24 var values = []; |
25 /******/ |
25 |
26 /******/ // Return the exports of the module |
26 return { |
27 /******/ return module.exports; |
27 has: function has(key) { |
28 /******/ } |
28 return keys.indexOf(key) > -1; |
29 /******/ |
29 }, |
30 /******/ |
30 get: function get(key) { |
31 /******/ // expose the modules object (__webpack_modules__) |
31 return values[keys.indexOf(key)]; |
32 /******/ __webpack_require__.m = modules; |
32 }, |
33 /******/ |
33 set: function set(key, value) { |
34 /******/ // expose the module cache |
34 if (keys.indexOf(key) === -1) { |
35 /******/ __webpack_require__.c = installedModules; |
35 keys.push(key); |
36 /******/ |
36 values.push(value); |
37 /******/ // define getter function for harmony exports |
37 } |
38 /******/ __webpack_require__.d = function(exports, name, getter) { |
38 }, |
39 /******/ if(!__webpack_require__.o(exports, name)) { |
39 delete: function _delete(key) { |
40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
40 var index = keys.indexOf(key); |
41 /******/ } |
41 if (index > -1) { |
42 /******/ }; |
42 keys.splice(index, 1); |
43 /******/ |
43 values.splice(index, 1); |
44 /******/ // define __esModule on exports |
44 } |
45 /******/ __webpack_require__.r = function(exports) { |
45 } |
46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
46 }; |
47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
47 }(); |
48 /******/ } |
48 |
49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
49 var createEvent = function createEvent(name) { |
50 /******/ }; |
50 return new Event(name, { bubbles: true }); |
51 /******/ |
51 }; |
52 /******/ // create a fake namespace object |
52 try { |
53 /******/ // mode & 1: value is a module id, require it |
53 new Event('test'); |
54 /******/ // mode & 2: merge all properties of value into the ns |
54 } catch (e) { |
55 /******/ // mode & 4: return value when already ns object |
55 // IE does not support `new Event()` |
56 /******/ // mode & 8|1: behave like require |
56 createEvent = function createEvent(name) { |
57 /******/ __webpack_require__.t = function(value, mode) { |
57 var evt = document.createEvent('Event'); |
58 /******/ if(mode & 1) value = __webpack_require__(value); |
58 evt.initEvent(name, true, false); |
59 /******/ if(mode & 8) return value; |
59 return evt; |
60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
60 }; |
61 /******/ var ns = Object.create(null); |
61 } |
62 /******/ __webpack_require__.r(ns); |
62 |
63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
63 function assign(ta) { |
64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
64 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; |
65 /******/ return ns; |
65 |
66 /******/ }; |
66 var heightOffset = null; |
67 /******/ |
67 var clientWidth = null; |
68 /******/ // getDefaultExport function for compatibility with non-harmony modules |
68 var cachedHeight = null; |
69 /******/ __webpack_require__.n = function(module) { |
69 |
70 /******/ var getter = module && module.__esModule ? |
70 function init() { |
71 /******/ function getDefault() { return module['default']; } : |
71 var style = window.getComputedStyle(ta, null); |
72 /******/ function getModuleExports() { return module; }; |
72 |
73 /******/ __webpack_require__.d(getter, 'a', getter); |
73 if (style.resize === 'vertical') { |
74 /******/ return getter; |
74 ta.style.resize = 'none'; |
75 /******/ }; |
75 } else if (style.resize === 'both') { |
76 /******/ |
76 ta.style.resize = 'horizontal'; |
77 /******/ // Object.prototype.hasOwnProperty.call |
77 } |
78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
78 |
79 /******/ |
79 if (style.boxSizing === 'content-box') { |
80 /******/ // __webpack_public_path__ |
80 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); |
81 /******/ __webpack_require__.p = ""; |
81 } else { |
82 /******/ |
82 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); |
83 /******/ |
83 } |
84 /******/ // Load entry module and return exports |
84 // Fix when a textarea is not on document body and heightOffset is Not a Number |
85 /******/ return __webpack_require__(__webpack_require__.s = "PLxR"); |
85 if (isNaN(heightOffset)) { |
86 /******/ }) |
86 heightOffset = 0; |
87 /************************************************************************/ |
87 } |
88 /******/ ({ |
88 |
89 |
89 update(); |
90 /***/ "16Al": |
90 } |
91 /***/ (function(module, exports, __webpack_require__) { |
91 |
92 function changeOverflow(value) { |
|
93 { |
|
94 // Chrome/Safari-specific fix: |
|
95 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space |
|
96 // made available by removing the scrollbar. The following forces the necessary text reflow. |
|
97 var width = ta.style.width; |
|
98 ta.style.width = '0px'; |
|
99 // Force reflow: |
|
100 /* jshint ignore:start */ |
|
101 ta.offsetWidth; |
|
102 /* jshint ignore:end */ |
|
103 ta.style.width = width; |
|
104 } |
|
105 |
|
106 ta.style.overflowY = value; |
|
107 } |
|
108 |
|
109 function getParentOverflows(el) { |
|
110 var arr = []; |
|
111 |
|
112 while (el && el.parentNode && el.parentNode instanceof Element) { |
|
113 if (el.parentNode.scrollTop) { |
|
114 arr.push({ |
|
115 node: el.parentNode, |
|
116 scrollTop: el.parentNode.scrollTop |
|
117 }); |
|
118 } |
|
119 el = el.parentNode; |
|
120 } |
|
121 |
|
122 return arr; |
|
123 } |
|
124 |
|
125 function resize() { |
|
126 if (ta.scrollHeight === 0) { |
|
127 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. |
|
128 return; |
|
129 } |
|
130 |
|
131 var overflows = getParentOverflows(ta); |
|
132 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) |
|
133 |
|
134 ta.style.height = ''; |
|
135 ta.style.height = ta.scrollHeight + heightOffset + 'px'; |
|
136 |
|
137 // used to check if an update is actually necessary on window.resize |
|
138 clientWidth = ta.clientWidth; |
|
139 |
|
140 // prevents scroll-position jumping |
|
141 overflows.forEach(function (el) { |
|
142 el.node.scrollTop = el.scrollTop; |
|
143 }); |
|
144 |
|
145 if (docTop) { |
|
146 document.documentElement.scrollTop = docTop; |
|
147 } |
|
148 } |
|
149 |
|
150 function update() { |
|
151 resize(); |
|
152 |
|
153 var styleHeight = Math.round(parseFloat(ta.style.height)); |
|
154 var computed = window.getComputedStyle(ta, null); |
|
155 |
|
156 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box |
|
157 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; |
|
158 |
|
159 // The actual height not matching the style height (set via the resize method) indicates that |
|
160 // the max-height has been exceeded, in which case the overflow should be allowed. |
|
161 if (actualHeight < styleHeight) { |
|
162 if (computed.overflowY === 'hidden') { |
|
163 changeOverflow('scroll'); |
|
164 resize(); |
|
165 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; |
|
166 } |
|
167 } else { |
|
168 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. |
|
169 if (computed.overflowY !== 'hidden') { |
|
170 changeOverflow('hidden'); |
|
171 resize(); |
|
172 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; |
|
173 } |
|
174 } |
|
175 |
|
176 if (cachedHeight !== actualHeight) { |
|
177 cachedHeight = actualHeight; |
|
178 var evt = createEvent('autosize:resized'); |
|
179 try { |
|
180 ta.dispatchEvent(evt); |
|
181 } catch (err) { |
|
182 // Firefox will throw an error on dispatchEvent for a detached element |
|
183 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 |
|
184 } |
|
185 } |
|
186 } |
|
187 |
|
188 var pageResize = function pageResize() { |
|
189 if (ta.clientWidth !== clientWidth) { |
|
190 update(); |
|
191 } |
|
192 }; |
|
193 |
|
194 var destroy = function (style) { |
|
195 window.removeEventListener('resize', pageResize, false); |
|
196 ta.removeEventListener('input', update, false); |
|
197 ta.removeEventListener('keyup', update, false); |
|
198 ta.removeEventListener('autosize:destroy', destroy, false); |
|
199 ta.removeEventListener('autosize:update', update, false); |
|
200 |
|
201 Object.keys(style).forEach(function (key) { |
|
202 ta.style[key] = style[key]; |
|
203 }); |
|
204 |
|
205 map.delete(ta); |
|
206 }.bind(ta, { |
|
207 height: ta.style.height, |
|
208 resize: ta.style.resize, |
|
209 overflowY: ta.style.overflowY, |
|
210 overflowX: ta.style.overflowX, |
|
211 wordWrap: ta.style.wordWrap |
|
212 }); |
|
213 |
|
214 ta.addEventListener('autosize:destroy', destroy, false); |
|
215 |
|
216 // IE9 does not fire onpropertychange or oninput for deletions, |
|
217 // so binding to onkeyup to catch most of those events. |
|
218 // There is no way that I know of to detect something like 'cut' in IE9. |
|
219 if ('onpropertychange' in ta && 'oninput' in ta) { |
|
220 ta.addEventListener('keyup', update, false); |
|
221 } |
|
222 |
|
223 window.addEventListener('resize', pageResize, false); |
|
224 ta.addEventListener('input', update, false); |
|
225 ta.addEventListener('autosize:update', update, false); |
|
226 ta.style.overflowX = 'hidden'; |
|
227 ta.style.wordWrap = 'break-word'; |
|
228 |
|
229 map.set(ta, { |
|
230 destroy: destroy, |
|
231 update: update |
|
232 }); |
|
233 |
|
234 init(); |
|
235 } |
|
236 |
|
237 function destroy(ta) { |
|
238 var methods = map.get(ta); |
|
239 if (methods) { |
|
240 methods.destroy(); |
|
241 } |
|
242 } |
|
243 |
|
244 function update(ta) { |
|
245 var methods = map.get(ta); |
|
246 if (methods) { |
|
247 methods.update(); |
|
248 } |
|
249 } |
|
250 |
|
251 var autosize = null; |
|
252 |
|
253 // Do nothing in Node.js environment and IE8 (or lower) |
|
254 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { |
|
255 autosize = function autosize(el) { |
|
256 return el; |
|
257 }; |
|
258 autosize.destroy = function (el) { |
|
259 return el; |
|
260 }; |
|
261 autosize.update = function (el) { |
|
262 return el; |
|
263 }; |
|
264 } else { |
|
265 autosize = function autosize(el, options) { |
|
266 if (el) { |
|
267 Array.prototype.forEach.call(el.length ? el : [el], function (x) { |
|
268 return assign(x, options); |
|
269 }); |
|
270 } |
|
271 return el; |
|
272 }; |
|
273 autosize.destroy = function (el) { |
|
274 if (el) { |
|
275 Array.prototype.forEach.call(el.length ? el : [el], destroy); |
|
276 } |
|
277 return el; |
|
278 }; |
|
279 autosize.update = function (el) { |
|
280 if (el) { |
|
281 Array.prototype.forEach.call(el.length ? el : [el], update); |
|
282 } |
|
283 return el; |
|
284 }; |
|
285 } |
|
286 |
|
287 exports.default = autosize; |
|
288 module.exports = exports['default']; |
|
289 }); |
|
290 |
|
291 /***/ }), |
|
292 |
|
293 /***/ 4403: |
|
294 /***/ (function(module, exports) { |
|
295 |
|
296 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
297 Copyright (c) 2018 Jed Watson. |
|
298 Licensed under the MIT License (MIT), see |
|
299 http://jedwatson.github.io/classnames |
|
300 */ |
|
301 /* global define */ |
|
302 |
|
303 (function () { |
|
304 'use strict'; |
|
305 |
|
306 var hasOwn = {}.hasOwnProperty; |
|
307 |
|
308 function classNames() { |
|
309 var classes = []; |
|
310 |
|
311 for (var i = 0; i < arguments.length; i++) { |
|
312 var arg = arguments[i]; |
|
313 if (!arg) continue; |
|
314 |
|
315 var argType = typeof arg; |
|
316 |
|
317 if (argType === 'string' || argType === 'number') { |
|
318 classes.push(arg); |
|
319 } else if (Array.isArray(arg)) { |
|
320 if (arg.length) { |
|
321 var inner = classNames.apply(null, arg); |
|
322 if (inner) { |
|
323 classes.push(inner); |
|
324 } |
|
325 } |
|
326 } else if (argType === 'object') { |
|
327 if (arg.toString === Object.prototype.toString) { |
|
328 for (var key in arg) { |
|
329 if (hasOwn.call(arg, key) && arg[key]) { |
|
330 classes.push(key); |
|
331 } |
|
332 } |
|
333 } else { |
|
334 classes.push(arg.toString()); |
|
335 } |
|
336 } |
|
337 } |
|
338 |
|
339 return classes.join(' '); |
|
340 } |
|
341 |
|
342 if ( true && module.exports) { |
|
343 classNames.default = classNames; |
|
344 module.exports = classNames; |
|
345 } else if (true) { |
|
346 // register as 'classnames', consistent with npm package name |
|
347 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { |
|
348 return classNames; |
|
349 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
|
350 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
351 } else {} |
|
352 }()); |
|
353 |
|
354 |
|
355 /***/ }), |
|
356 |
|
357 /***/ 4827: |
|
358 /***/ (function(module) { |
|
359 |
|
360 // This code has been refactored for 140 bytes |
|
361 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js |
|
362 var computedStyle = function (el, prop, getComputedStyle) { |
|
363 getComputedStyle = window.getComputedStyle; |
|
364 |
|
365 // In one fell swoop |
|
366 return ( |
|
367 // If we have getComputedStyle |
|
368 getComputedStyle ? |
|
369 // Query it |
|
370 // TODO: From CSS-Query notes, we might need (node, null) for FF |
|
371 getComputedStyle(el) : |
|
372 |
|
373 // Otherwise, we are in IE and use currentStyle |
|
374 el.currentStyle |
|
375 )[ |
|
376 // Switch to camelCase for CSSOM |
|
377 // DEV: Grabbed from jQuery |
|
378 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 |
|
379 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 |
|
380 prop.replace(/-(\w)/gi, function (word, letter) { |
|
381 return letter.toUpperCase(); |
|
382 }) |
|
383 ]; |
|
384 }; |
|
385 |
|
386 module.exports = computedStyle; |
|
387 |
|
388 |
|
389 /***/ }), |
|
390 |
|
391 /***/ 9894: |
|
392 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
|
393 |
|
394 // Load in dependencies |
|
395 var computedStyle = __webpack_require__(4827); |
|
396 |
|
397 /** |
|
398 * Calculate the `line-height` of a given node |
|
399 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. |
|
400 * @returns {Number} `line-height` of the element in pixels |
|
401 */ |
|
402 function lineHeight(node) { |
|
403 // Grab the line-height via style |
|
404 var lnHeightStr = computedStyle(node, 'line-height'); |
|
405 var lnHeight = parseFloat(lnHeightStr, 10); |
|
406 |
|
407 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') |
|
408 if (lnHeightStr === lnHeight + '') { |
|
409 // Save the old lineHeight style and update the em unit to the element |
|
410 var _lnHeightStyle = node.style.lineHeight; |
|
411 node.style.lineHeight = lnHeightStr + 'em'; |
|
412 |
|
413 // Calculate the em based height |
|
414 lnHeightStr = computedStyle(node, 'line-height'); |
|
415 lnHeight = parseFloat(lnHeightStr, 10); |
|
416 |
|
417 // Revert the lineHeight style |
|
418 if (_lnHeightStyle) { |
|
419 node.style.lineHeight = _lnHeightStyle; |
|
420 } else { |
|
421 delete node.style.lineHeight; |
|
422 } |
|
423 } |
|
424 |
|
425 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) |
|
426 // DEV: `em` units are converted to `pt` in IE6 |
|
427 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length |
|
428 if (lnHeightStr.indexOf('pt') !== -1) { |
|
429 lnHeight *= 4; |
|
430 lnHeight /= 3; |
|
431 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) |
|
432 } else if (lnHeightStr.indexOf('mm') !== -1) { |
|
433 lnHeight *= 96; |
|
434 lnHeight /= 25.4; |
|
435 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) |
|
436 } else if (lnHeightStr.indexOf('cm') !== -1) { |
|
437 lnHeight *= 96; |
|
438 lnHeight /= 2.54; |
|
439 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) |
|
440 } else if (lnHeightStr.indexOf('in') !== -1) { |
|
441 lnHeight *= 96; |
|
442 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) |
|
443 } else if (lnHeightStr.indexOf('pc') !== -1) { |
|
444 lnHeight *= 16; |
|
445 } |
|
446 |
|
447 // Continue our computation |
|
448 lnHeight = Math.round(lnHeight); |
|
449 |
|
450 // If the line-height is "normal", calculate by font-size |
|
451 if (lnHeightStr === 'normal') { |
|
452 // Create a temporary node |
|
453 var nodeName = node.nodeName; |
|
454 var _node = document.createElement(nodeName); |
|
455 _node.innerHTML = ' '; |
|
456 |
|
457 // If we have a text area, reset it to only 1 row |
|
458 // https://github.com/twolfson/line-height/issues/4 |
|
459 if (nodeName.toUpperCase() === 'TEXTAREA') { |
|
460 _node.setAttribute('rows', '1'); |
|
461 } |
|
462 |
|
463 // Set the font-size of the element |
|
464 var fontSizeStr = computedStyle(node, 'font-size'); |
|
465 _node.style.fontSize = fontSizeStr; |
|
466 |
|
467 // Remove default padding/border which can affect offset height |
|
468 // https://github.com/twolfson/line-height/issues/4 |
|
469 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight |
|
470 _node.style.padding = '0px'; |
|
471 _node.style.border = '0px'; |
|
472 |
|
473 // Append it to the body |
|
474 var body = document.body; |
|
475 body.appendChild(_node); |
|
476 |
|
477 // Assume the line height of the element is the height |
|
478 var height = _node.offsetHeight; |
|
479 lnHeight = height; |
|
480 |
|
481 // Remove our child from the DOM |
|
482 body.removeChild(_node); |
|
483 } |
|
484 |
|
485 // Return the calculated height |
|
486 return lnHeight; |
|
487 } |
|
488 |
|
489 // Export lineHeight |
|
490 module.exports = lineHeight; |
|
491 |
|
492 |
|
493 /***/ }), |
|
494 |
|
495 /***/ 5372: |
|
496 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
|
92 |
497 |
93 "use strict"; |
498 "use strict"; |
94 /** |
499 /** |
95 * Copyright (c) 2013-present, Facebook, Inc. |
500 * Copyright (c) 2013-present, Facebook, Inc. |
96 * |
501 * |
98 * LICENSE file in the root directory of this source tree. |
503 * LICENSE file in the root directory of this source tree. |
99 */ |
504 */ |
100 |
505 |
101 |
506 |
102 |
507 |
103 var ReactPropTypesSecret = __webpack_require__("WbBG"); |
508 var ReactPropTypesSecret = __webpack_require__(9567); |
104 |
509 |
105 function emptyFunction() {} |
510 function emptyFunction() {} |
106 function emptyFunctionWithReset() {} |
511 function emptyFunctionWithReset() {} |
107 emptyFunctionWithReset.resetWarningCache = emptyFunction; |
512 emptyFunctionWithReset.resetWarningCache = emptyFunction; |
108 |
513 |
126 }; |
531 }; |
127 // Important! |
532 // Important! |
128 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. |
533 // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. |
129 var ReactPropTypes = { |
534 var ReactPropTypes = { |
130 array: shim, |
535 array: shim, |
536 bigint: shim, |
|
131 bool: shim, |
537 bool: shim, |
132 func: shim, |
538 func: shim, |
133 number: shim, |
539 number: shim, |
134 object: shim, |
540 object: shim, |
135 string: shim, |
541 string: shim, |
157 }; |
563 }; |
158 |
564 |
159 |
565 |
160 /***/ }), |
566 /***/ }), |
161 |
567 |
162 /***/ "17x9": |
568 /***/ 2652: |
163 /***/ (function(module, exports, __webpack_require__) { |
569 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { |
164 |
570 |
165 /** |
571 /** |
166 * Copyright (c) 2013-present, Facebook, Inc. |
572 * Copyright (c) 2013-present, Facebook, Inc. |
167 * |
573 * |
168 * This source code is licensed under the MIT license found in the |
574 * This source code is licensed under the MIT license found in the |
170 */ |
576 */ |
171 |
577 |
172 if (false) { var throwOnDirectAccess, ReactIs; } else { |
578 if (false) { var throwOnDirectAccess, ReactIs; } else { |
173 // By explicitly using `prop-types` you are opting into new production behavior. |
579 // By explicitly using `prop-types` you are opting into new production behavior. |
174 // http://fb.me/prop-types-in-prod |
580 // http://fb.me/prop-types-in-prod |
175 module.exports = __webpack_require__("16Al")(); |
581 module.exports = __webpack_require__(5372)(); |
176 } |
582 } |
177 |
583 |
178 |
584 |
179 /***/ }), |
585 /***/ }), |
180 |
586 |
181 /***/ "1ZqX": |
587 /***/ 9567: |
182 /***/ (function(module, exports) { |
588 /***/ (function(module) { |
183 |
589 |
184 (function() { module.exports = window["wp"]["data"]; }()); |
590 "use strict"; |
591 /** |
|
592 * Copyright (c) 2013-present, Facebook, Inc. |
|
593 * |
|
594 * This source code is licensed under the MIT license found in the |
|
595 * LICENSE file in the root directory of this source tree. |
|
596 */ |
|
597 |
|
598 |
|
599 |
|
600 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; |
|
601 |
|
602 module.exports = ReactPropTypesSecret; |
|
603 |
|
185 |
604 |
186 /***/ }), |
605 /***/ }), |
187 |
606 |
188 /***/ "51Zz": |
607 /***/ 5438: |
189 /***/ (function(module, exports) { |
608 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { |
190 |
|
191 (function() { module.exports = window["wp"]["dataControls"]; }()); |
|
192 |
|
193 /***/ }), |
|
194 |
|
195 /***/ "6aBm": |
|
196 /***/ (function(module, exports) { |
|
197 |
|
198 (function() { module.exports = window["wp"]["mediaUtils"]; }()); |
|
199 |
|
200 /***/ }), |
|
201 |
|
202 /***/ "7fqt": |
|
203 /***/ (function(module, exports) { |
|
204 |
|
205 (function() { module.exports = window["wp"]["wordcount"]; }()); |
|
206 |
|
207 /***/ }), |
|
208 |
|
209 /***/ "CNgt": |
|
210 /***/ (function(module, exports, __webpack_require__) { |
|
211 |
609 |
212 "use strict"; |
610 "use strict"; |
213 |
611 |
214 var __extends = (this && this.__extends) || (function () { |
612 var __extends = (this && this.__extends) || (function () { |
215 var extendStatics = Object.setPrototypeOf || |
613 var extendStatics = Object.setPrototypeOf || |
237 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) |
635 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) |
238 t[p[i]] = s[p[i]]; |
636 t[p[i]] = s[p[i]]; |
239 return t; |
637 return t; |
240 }; |
638 }; |
241 exports.__esModule = true; |
639 exports.__esModule = true; |
242 var React = __webpack_require__("cDcd"); |
640 var React = __webpack_require__(9196); |
243 var PropTypes = __webpack_require__("17x9"); |
641 var PropTypes = __webpack_require__(2652); |
244 var autosize = __webpack_require__("GemG"); |
642 var autosize = __webpack_require__(6411); |
245 var _getLineHeight = __webpack_require__("Rk8H"); |
643 var _getLineHeight = __webpack_require__(9894); |
246 var getLineHeight = _getLineHeight; |
644 var getLineHeight = _getLineHeight; |
247 var RESIZED = "autosize:resized"; |
645 var RESIZED = "autosize:resized"; |
248 /** |
646 /** |
249 * A light replacement for built-in textarea component |
647 * A light replacement for built-in textarea component |
250 * which automaticaly adjusts its height to match the content |
648 * which automaticaly adjusts its height to match the content |
338 }); |
736 }); |
339 |
737 |
340 |
738 |
341 /***/ }), |
739 /***/ }), |
342 |
740 |
343 /***/ "Civd": |
741 /***/ 773: |
344 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
742 /***/ (function(__unused_webpack_module, exports, __webpack_require__) { |
345 |
743 |
346 "use strict"; |
744 "use strict"; |
347 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
745 var __webpack_unused_export__; |
348 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
746 |
349 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
747 __webpack_unused_export__ = true; |
350 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
748 var TextareaAutosize_1 = __webpack_require__(5438); |
351 |
749 exports.Z = TextareaAutosize_1.TextareaAutosize; |
352 |
|
353 /** |
|
354 * WordPress dependencies |
|
355 */ |
|
356 |
|
357 const layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
358 xmlns: "http://www.w3.org/2000/svg", |
|
359 viewBox: "0 0 24 24" |
|
360 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
361 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" |
|
362 })); |
|
363 /* harmony default export */ __webpack_exports__["a"] = (layout); |
|
364 |
750 |
365 |
751 |
366 /***/ }), |
752 /***/ }), |
367 |
753 |
368 /***/ "FqII": |
754 /***/ 9196: |
369 /***/ (function(module, exports) { |
755 /***/ (function(module) { |
370 |
|
371 (function() { module.exports = window["wp"]["date"]; }()); |
|
372 |
|
373 /***/ }), |
|
374 |
|
375 /***/ "GRId": |
|
376 /***/ (function(module, exports) { |
|
377 |
|
378 (function() { module.exports = window["wp"]["element"]; }()); |
|
379 |
|
380 /***/ }), |
|
381 |
|
382 /***/ "GemG": |
|
383 /***/ (function(module, exports, __webpack_require__) { |
|
384 |
|
385 var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
386 autosize 4.0.4 |
|
387 license: MIT |
|
388 http://www.jacklmoore.com/autosize |
|
389 */ |
|
390 (function (global, factory) { |
|
391 if (true) { |
|
392 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), |
|
393 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? |
|
394 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), |
|
395 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
396 } else { var mod; } |
|
397 })(this, function (module, exports) { |
|
398 'use strict'; |
|
399 |
|
400 var map = typeof Map === "function" ? new Map() : function () { |
|
401 var keys = []; |
|
402 var values = []; |
|
403 |
|
404 return { |
|
405 has: function has(key) { |
|
406 return keys.indexOf(key) > -1; |
|
407 }, |
|
408 get: function get(key) { |
|
409 return values[keys.indexOf(key)]; |
|
410 }, |
|
411 set: function set(key, value) { |
|
412 if (keys.indexOf(key) === -1) { |
|
413 keys.push(key); |
|
414 values.push(value); |
|
415 } |
|
416 }, |
|
417 delete: function _delete(key) { |
|
418 var index = keys.indexOf(key); |
|
419 if (index > -1) { |
|
420 keys.splice(index, 1); |
|
421 values.splice(index, 1); |
|
422 } |
|
423 } |
|
424 }; |
|
425 }(); |
|
426 |
|
427 var createEvent = function createEvent(name) { |
|
428 return new Event(name, { bubbles: true }); |
|
429 }; |
|
430 try { |
|
431 new Event('test'); |
|
432 } catch (e) { |
|
433 // IE does not support `new Event()` |
|
434 createEvent = function createEvent(name) { |
|
435 var evt = document.createEvent('Event'); |
|
436 evt.initEvent(name, true, false); |
|
437 return evt; |
|
438 }; |
|
439 } |
|
440 |
|
441 function assign(ta) { |
|
442 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return; |
|
443 |
|
444 var heightOffset = null; |
|
445 var clientWidth = null; |
|
446 var cachedHeight = null; |
|
447 |
|
448 function init() { |
|
449 var style = window.getComputedStyle(ta, null); |
|
450 |
|
451 if (style.resize === 'vertical') { |
|
452 ta.style.resize = 'none'; |
|
453 } else if (style.resize === 'both') { |
|
454 ta.style.resize = 'horizontal'; |
|
455 } |
|
456 |
|
457 if (style.boxSizing === 'content-box') { |
|
458 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); |
|
459 } else { |
|
460 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); |
|
461 } |
|
462 // Fix when a textarea is not on document body and heightOffset is Not a Number |
|
463 if (isNaN(heightOffset)) { |
|
464 heightOffset = 0; |
|
465 } |
|
466 |
|
467 update(); |
|
468 } |
|
469 |
|
470 function changeOverflow(value) { |
|
471 { |
|
472 // Chrome/Safari-specific fix: |
|
473 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space |
|
474 // made available by removing the scrollbar. The following forces the necessary text reflow. |
|
475 var width = ta.style.width; |
|
476 ta.style.width = '0px'; |
|
477 // Force reflow: |
|
478 /* jshint ignore:start */ |
|
479 ta.offsetWidth; |
|
480 /* jshint ignore:end */ |
|
481 ta.style.width = width; |
|
482 } |
|
483 |
|
484 ta.style.overflowY = value; |
|
485 } |
|
486 |
|
487 function getParentOverflows(el) { |
|
488 var arr = []; |
|
489 |
|
490 while (el && el.parentNode && el.parentNode instanceof Element) { |
|
491 if (el.parentNode.scrollTop) { |
|
492 arr.push({ |
|
493 node: el.parentNode, |
|
494 scrollTop: el.parentNode.scrollTop |
|
495 }); |
|
496 } |
|
497 el = el.parentNode; |
|
498 } |
|
499 |
|
500 return arr; |
|
501 } |
|
502 |
|
503 function resize() { |
|
504 if (ta.scrollHeight === 0) { |
|
505 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. |
|
506 return; |
|
507 } |
|
508 |
|
509 var overflows = getParentOverflows(ta); |
|
510 var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240) |
|
511 |
|
512 ta.style.height = ''; |
|
513 ta.style.height = ta.scrollHeight + heightOffset + 'px'; |
|
514 |
|
515 // used to check if an update is actually necessary on window.resize |
|
516 clientWidth = ta.clientWidth; |
|
517 |
|
518 // prevents scroll-position jumping |
|
519 overflows.forEach(function (el) { |
|
520 el.node.scrollTop = el.scrollTop; |
|
521 }); |
|
522 |
|
523 if (docTop) { |
|
524 document.documentElement.scrollTop = docTop; |
|
525 } |
|
526 } |
|
527 |
|
528 function update() { |
|
529 resize(); |
|
530 |
|
531 var styleHeight = Math.round(parseFloat(ta.style.height)); |
|
532 var computed = window.getComputedStyle(ta, null); |
|
533 |
|
534 // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box |
|
535 var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight; |
|
536 |
|
537 // The actual height not matching the style height (set via the resize method) indicates that |
|
538 // the max-height has been exceeded, in which case the overflow should be allowed. |
|
539 if (actualHeight < styleHeight) { |
|
540 if (computed.overflowY === 'hidden') { |
|
541 changeOverflow('scroll'); |
|
542 resize(); |
|
543 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; |
|
544 } |
|
545 } else { |
|
546 // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands. |
|
547 if (computed.overflowY !== 'hidden') { |
|
548 changeOverflow('hidden'); |
|
549 resize(); |
|
550 actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight; |
|
551 } |
|
552 } |
|
553 |
|
554 if (cachedHeight !== actualHeight) { |
|
555 cachedHeight = actualHeight; |
|
556 var evt = createEvent('autosize:resized'); |
|
557 try { |
|
558 ta.dispatchEvent(evt); |
|
559 } catch (err) { |
|
560 // Firefox will throw an error on dispatchEvent for a detached element |
|
561 // https://bugzilla.mozilla.org/show_bug.cgi?id=889376 |
|
562 } |
|
563 } |
|
564 } |
|
565 |
|
566 var pageResize = function pageResize() { |
|
567 if (ta.clientWidth !== clientWidth) { |
|
568 update(); |
|
569 } |
|
570 }; |
|
571 |
|
572 var destroy = function (style) { |
|
573 window.removeEventListener('resize', pageResize, false); |
|
574 ta.removeEventListener('input', update, false); |
|
575 ta.removeEventListener('keyup', update, false); |
|
576 ta.removeEventListener('autosize:destroy', destroy, false); |
|
577 ta.removeEventListener('autosize:update', update, false); |
|
578 |
|
579 Object.keys(style).forEach(function (key) { |
|
580 ta.style[key] = style[key]; |
|
581 }); |
|
582 |
|
583 map.delete(ta); |
|
584 }.bind(ta, { |
|
585 height: ta.style.height, |
|
586 resize: ta.style.resize, |
|
587 overflowY: ta.style.overflowY, |
|
588 overflowX: ta.style.overflowX, |
|
589 wordWrap: ta.style.wordWrap |
|
590 }); |
|
591 |
|
592 ta.addEventListener('autosize:destroy', destroy, false); |
|
593 |
|
594 // IE9 does not fire onpropertychange or oninput for deletions, |
|
595 // so binding to onkeyup to catch most of those events. |
|
596 // There is no way that I know of to detect something like 'cut' in IE9. |
|
597 if ('onpropertychange' in ta && 'oninput' in ta) { |
|
598 ta.addEventListener('keyup', update, false); |
|
599 } |
|
600 |
|
601 window.addEventListener('resize', pageResize, false); |
|
602 ta.addEventListener('input', update, false); |
|
603 ta.addEventListener('autosize:update', update, false); |
|
604 ta.style.overflowX = 'hidden'; |
|
605 ta.style.wordWrap = 'break-word'; |
|
606 |
|
607 map.set(ta, { |
|
608 destroy: destroy, |
|
609 update: update |
|
610 }); |
|
611 |
|
612 init(); |
|
613 } |
|
614 |
|
615 function destroy(ta) { |
|
616 var methods = map.get(ta); |
|
617 if (methods) { |
|
618 methods.destroy(); |
|
619 } |
|
620 } |
|
621 |
|
622 function update(ta) { |
|
623 var methods = map.get(ta); |
|
624 if (methods) { |
|
625 methods.update(); |
|
626 } |
|
627 } |
|
628 |
|
629 var autosize = null; |
|
630 |
|
631 // Do nothing in Node.js environment and IE8 (or lower) |
|
632 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { |
|
633 autosize = function autosize(el) { |
|
634 return el; |
|
635 }; |
|
636 autosize.destroy = function (el) { |
|
637 return el; |
|
638 }; |
|
639 autosize.update = function (el) { |
|
640 return el; |
|
641 }; |
|
642 } else { |
|
643 autosize = function autosize(el, options) { |
|
644 if (el) { |
|
645 Array.prototype.forEach.call(el.length ? el : [el], function (x) { |
|
646 return assign(x, options); |
|
647 }); |
|
648 } |
|
649 return el; |
|
650 }; |
|
651 autosize.destroy = function (el) { |
|
652 if (el) { |
|
653 Array.prototype.forEach.call(el.length ? el : [el], destroy); |
|
654 } |
|
655 return el; |
|
656 }; |
|
657 autosize.update = function (el) { |
|
658 if (el) { |
|
659 Array.prototype.forEach.call(el.length ? el : [el], update); |
|
660 } |
|
661 return el; |
|
662 }; |
|
663 } |
|
664 |
|
665 exports.default = autosize; |
|
666 module.exports = exports['default']; |
|
667 }); |
|
668 |
|
669 /***/ }), |
|
670 |
|
671 /***/ "HSyU": |
|
672 /***/ (function(module, exports) { |
|
673 |
|
674 (function() { module.exports = window["wp"]["blocks"]; }()); |
|
675 |
|
676 /***/ }), |
|
677 |
|
678 /***/ "JREk": |
|
679 /***/ (function(module, exports) { |
|
680 |
|
681 (function() { module.exports = window["wp"]["serverSideRender"]; }()); |
|
682 |
|
683 /***/ }), |
|
684 |
|
685 /***/ "K2cm": |
|
686 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
687 |
756 |
688 "use strict"; |
757 "use strict"; |
689 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
758 module.exports = window["React"]; |
690 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
759 |
691 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
760 /***/ }) |
692 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
761 |
693 |
762 /******/ }); |
694 |
763 /************************************************************************/ |
695 /** |
764 /******/ // The module cache |
696 * WordPress dependencies |
765 /******/ var __webpack_module_cache__ = {}; |
697 */ |
766 /******/ |
698 |
767 /******/ // The require function |
699 const redo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
768 /******/ function __webpack_require__(moduleId) { |
700 xmlns: "http://www.w3.org/2000/svg", |
769 /******/ // Check if module is in cache |
701 viewBox: "0 0 24 24" |
770 /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
702 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
771 /******/ if (cachedModule !== undefined) { |
703 d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" |
772 /******/ return cachedModule.exports; |
704 })); |
773 /******/ } |
705 /* harmony default export */ __webpack_exports__["a"] = (redo); |
774 /******/ // Create a new module (and put it into the cache) |
706 |
775 /******/ var module = __webpack_module_cache__[moduleId] = { |
707 |
776 /******/ // no module.id needed |
708 /***/ }), |
777 /******/ // no module.loaded needed |
709 |
778 /******/ exports: {} |
710 /***/ "K9lf": |
779 /******/ }; |
711 /***/ (function(module, exports) { |
780 /******/ |
712 |
781 /******/ // Execute the module function |
713 (function() { module.exports = window["wp"]["compose"]; }()); |
782 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
714 |
783 /******/ |
715 /***/ }), |
784 /******/ // Return the exports of the module |
716 |
785 /******/ return module.exports; |
717 /***/ "Mmq9": |
786 /******/ } |
718 /***/ (function(module, exports) { |
787 /******/ |
719 |
788 /************************************************************************/ |
720 (function() { module.exports = window["wp"]["url"]; }()); |
789 /******/ /* webpack/runtime/compat get default export */ |
721 |
790 /******/ !function() { |
722 /***/ }), |
791 /******/ // getDefaultExport function for compatibility with non-harmony modules |
723 |
792 /******/ __webpack_require__.n = function(module) { |
724 /***/ "NMb1": |
793 /******/ var getter = module && module.__esModule ? |
725 /***/ (function(module, exports) { |
794 /******/ function() { return module['default']; } : |
726 |
795 /******/ function() { return module; }; |
727 (function() { module.exports = window["wp"]["deprecated"]; }()); |
796 /******/ __webpack_require__.d(getter, { a: getter }); |
728 |
797 /******/ return getter; |
729 /***/ }), |
798 /******/ }; |
730 |
799 /******/ }(); |
731 /***/ "Ntru": |
800 /******/ |
732 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
801 /******/ /* webpack/runtime/define property getters */ |
733 |
802 /******/ !function() { |
734 "use strict"; |
803 /******/ // define getter functions for harmony exports |
735 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
804 /******/ __webpack_require__.d = function(exports, definition) { |
736 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
805 /******/ for(var key in definition) { |
737 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
806 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
738 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
807 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
739 |
808 /******/ } |
740 |
809 /******/ } |
741 /** |
810 /******/ }; |
742 * WordPress dependencies |
811 /******/ }(); |
743 */ |
812 /******/ |
744 |
813 /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
745 const undo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
814 /******/ !function() { |
746 xmlns: "http://www.w3.org/2000/svg", |
815 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
747 viewBox: "0 0 24 24" |
816 /******/ }(); |
748 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
817 /******/ |
749 d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" |
818 /******/ /* webpack/runtime/make namespace object */ |
750 })); |
819 /******/ !function() { |
751 /* harmony default export */ __webpack_exports__["a"] = (undo); |
820 /******/ // define __esModule on exports |
752 |
821 /******/ __webpack_require__.r = function(exports) { |
753 |
822 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
754 /***/ }), |
823 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
755 |
824 /******/ } |
756 /***/ "O6Fj": |
825 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
757 /***/ (function(module, exports, __webpack_require__) { |
826 /******/ }; |
758 |
827 /******/ }(); |
759 "use strict"; |
828 /******/ |
760 |
829 /************************************************************************/ |
761 exports.__esModule = true; |
830 var __webpack_exports__ = {}; |
762 var TextareaAutosize_1 = __webpack_require__("CNgt"); |
831 // This entry need to be wrapped in an IIFE because it need to be in strict mode. |
763 exports["default"] = TextareaAutosize_1.TextareaAutosize; |
832 !function() { |
764 |
|
765 |
|
766 /***/ }), |
|
767 |
|
768 /***/ "PLxR": |
|
769 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
770 |
|
771 "use strict"; |
833 "use strict"; |
772 // ESM COMPAT FLAG |
834 // ESM COMPAT FLAG |
773 __webpack_require__.r(__webpack_exports__); |
835 __webpack_require__.r(__webpack_exports__); |
774 |
836 |
775 // EXPORTS |
837 // EXPORTS |
776 __webpack_require__.d(__webpack_exports__, "storeConfig", function() { return /* reexport */ storeConfig; }); |
838 __webpack_require__.d(__webpack_exports__, { |
777 __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; }); |
839 "AlignmentToolbar": function() { return /* reexport */ AlignmentToolbar; }, |
778 __webpack_require__.d(__webpack_exports__, "userAutocompleter", function() { return /* reexport */ autocompleters_user; }); |
840 "Autocomplete": function() { return /* reexport */ Autocomplete; }, |
779 __webpack_require__.d(__webpack_exports__, "AutosaveMonitor", function() { return /* reexport */ autosave_monitor; }); |
841 "AutosaveMonitor": function() { return /* reexport */ autosave_monitor; }, |
780 __webpack_require__.d(__webpack_exports__, "DocumentOutline", function() { return /* reexport */ document_outline; }); |
842 "BlockAlignmentToolbar": function() { return /* reexport */ BlockAlignmentToolbar; }, |
781 __webpack_require__.d(__webpack_exports__, "DocumentOutlineCheck", function() { return /* reexport */ check; }); |
843 "BlockControls": function() { return /* reexport */ BlockControls; }, |
782 __webpack_require__.d(__webpack_exports__, "VisualEditorGlobalKeyboardShortcuts", function() { return /* reexport */ visual_editor_shortcuts; }); |
844 "BlockEdit": function() { return /* reexport */ BlockEdit; }, |
783 __webpack_require__.d(__webpack_exports__, "TextEditorGlobalKeyboardShortcuts", function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; }); |
845 "BlockEditorKeyboardShortcuts": function() { return /* reexport */ BlockEditorKeyboardShortcuts; }, |
784 __webpack_require__.d(__webpack_exports__, "EditorKeyboardShortcutsRegister", function() { return /* reexport */ register_shortcuts; }); |
846 "BlockFormatControls": function() { return /* reexport */ BlockFormatControls; }, |
785 __webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return /* reexport */ editor_history_redo; }); |
847 "BlockIcon": function() { return /* reexport */ BlockIcon; }, |
786 __webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return /* reexport */ editor_history_undo; }); |
848 "BlockInspector": function() { return /* reexport */ BlockInspector; }, |
787 __webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return /* reexport */ editor_notices; }); |
849 "BlockList": function() { return /* reexport */ BlockList; }, |
788 __webpack_require__.d(__webpack_exports__, "EditorSnackbars", function() { return /* reexport */ EditorSnackbars; }); |
850 "BlockMover": function() { return /* reexport */ BlockMover; }, |
789 __webpack_require__.d(__webpack_exports__, "EntitiesSavedStates", function() { return /* reexport */ EntitiesSavedStates; }); |
851 "BlockNavigationDropdown": function() { return /* reexport */ BlockNavigationDropdown; }, |
790 __webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return /* reexport */ error_boundary; }); |
852 "BlockSelectionClearer": function() { return /* reexport */ BlockSelectionClearer; }, |
791 __webpack_require__.d(__webpack_exports__, "LocalAutosaveMonitor", function() { return /* reexport */ local_autosave_monitor; }); |
853 "BlockSettingsMenu": function() { return /* reexport */ BlockSettingsMenu; }, |
792 __webpack_require__.d(__webpack_exports__, "PageAttributesCheck", function() { return /* reexport */ page_attributes_check; }); |
854 "BlockTitle": function() { return /* reexport */ BlockTitle; }, |
793 __webpack_require__.d(__webpack_exports__, "PageAttributesOrder", function() { return /* reexport */ page_attributes_order; }); |
855 "BlockToolbar": function() { return /* reexport */ BlockToolbar; }, |
794 __webpack_require__.d(__webpack_exports__, "PageAttributesParent", function() { return /* reexport */ page_attributes_parent; }); |
856 "ColorPalette": function() { return /* reexport */ ColorPalette; }, |
795 __webpack_require__.d(__webpack_exports__, "PageTemplate", function() { return /* reexport */ post_template; }); |
857 "ContrastChecker": function() { return /* reexport */ ContrastChecker; }, |
796 __webpack_require__.d(__webpack_exports__, "PostAuthor", function() { return /* reexport */ post_author; }); |
858 "CopyHandler": function() { return /* reexport */ CopyHandler; }, |
797 __webpack_require__.d(__webpack_exports__, "PostAuthorCheck", function() { return /* reexport */ post_author_check; }); |
859 "DefaultBlockAppender": function() { return /* reexport */ DefaultBlockAppender; }, |
798 __webpack_require__.d(__webpack_exports__, "PostComments", function() { return /* reexport */ post_comments; }); |
860 "DocumentOutline": function() { return /* reexport */ document_outline; }, |
799 __webpack_require__.d(__webpack_exports__, "PostExcerpt", function() { return /* reexport */ post_excerpt; }); |
861 "DocumentOutlineCheck": function() { return /* reexport */ check; }, |
800 __webpack_require__.d(__webpack_exports__, "PostExcerptCheck", function() { return /* reexport */ post_excerpt_check; }); |
862 "EditorHistoryRedo": function() { return /* reexport */ editor_history_redo; }, |
801 __webpack_require__.d(__webpack_exports__, "PostFeaturedImage", function() { return /* reexport */ post_featured_image; }); |
863 "EditorHistoryUndo": function() { return /* reexport */ editor_history_undo; }, |
802 __webpack_require__.d(__webpack_exports__, "PostFeaturedImageCheck", function() { return /* reexport */ post_featured_image_check; }); |
864 "EditorKeyboardShortcutsRegister": function() { return /* reexport */ register_shortcuts; }, |
803 __webpack_require__.d(__webpack_exports__, "PostFormat", function() { return /* reexport */ PostFormat; }); |
865 "EditorNotices": function() { return /* reexport */ editor_notices; }, |
804 __webpack_require__.d(__webpack_exports__, "PostFormatCheck", function() { return /* reexport */ post_format_check; }); |
866 "EditorProvider": function() { return /* reexport */ provider; }, |
805 __webpack_require__.d(__webpack_exports__, "PostLastRevision", function() { return /* reexport */ post_last_revision; }); |
867 "EditorSnackbars": function() { return /* reexport */ EditorSnackbars; }, |
806 __webpack_require__.d(__webpack_exports__, "PostLastRevisionCheck", function() { return /* reexport */ post_last_revision_check; }); |
868 "EntitiesSavedStates": function() { return /* reexport */ EntitiesSavedStates; }, |
807 __webpack_require__.d(__webpack_exports__, "PostLockedModal", function() { return /* reexport */ PostLockedModal; }); |
869 "ErrorBoundary": function() { return /* reexport */ error_boundary; }, |
808 __webpack_require__.d(__webpack_exports__, "PostPendingStatus", function() { return /* reexport */ post_pending_status; }); |
870 "FontSizePicker": function() { return /* reexport */ FontSizePicker; }, |
809 __webpack_require__.d(__webpack_exports__, "PostPendingStatusCheck", function() { return /* reexport */ post_pending_status_check; }); |
871 "InnerBlocks": function() { return /* reexport */ InnerBlocks; }, |
810 __webpack_require__.d(__webpack_exports__, "PostPingbacks", function() { return /* reexport */ post_pingbacks; }); |
872 "Inserter": function() { return /* reexport */ Inserter; }, |
811 __webpack_require__.d(__webpack_exports__, "PostPreviewButton", function() { return /* reexport */ post_preview_button; }); |
873 "InspectorAdvancedControls": function() { return /* reexport */ InspectorAdvancedControls; }, |
812 __webpack_require__.d(__webpack_exports__, "PostPublishButton", function() { return /* reexport */ post_publish_button; }); |
874 "InspectorControls": function() { return /* reexport */ InspectorControls; }, |
813 __webpack_require__.d(__webpack_exports__, "PostPublishButtonLabel", function() { return /* reexport */ post_publish_button_label; }); |
875 "LocalAutosaveMonitor": function() { return /* reexport */ local_autosave_monitor; }, |
814 __webpack_require__.d(__webpack_exports__, "PostPublishPanel", function() { return /* reexport */ post_publish_panel; }); |
876 "MediaPlaceholder": function() { return /* reexport */ MediaPlaceholder; }, |
815 __webpack_require__.d(__webpack_exports__, "PostSavedState", function() { return /* reexport */ PostSavedState; }); |
877 "MediaUpload": function() { return /* reexport */ MediaUpload; }, |
816 __webpack_require__.d(__webpack_exports__, "PostSchedule", function() { return /* reexport */ PostSchedule; }); |
878 "MediaUploadCheck": function() { return /* reexport */ MediaUploadCheck; }, |
817 __webpack_require__.d(__webpack_exports__, "PostScheduleCheck", function() { return /* reexport */ post_schedule_check; }); |
879 "MultiSelectScrollIntoView": function() { return /* reexport */ MultiSelectScrollIntoView; }, |
818 __webpack_require__.d(__webpack_exports__, "PostScheduleLabel", function() { return /* reexport */ post_schedule_label; }); |
880 "NavigableToolbar": function() { return /* reexport */ NavigableToolbar; }, |
819 __webpack_require__.d(__webpack_exports__, "PostSlug", function() { return /* reexport */ post_slug; }); |
881 "ObserveTyping": function() { return /* reexport */ ObserveTyping; }, |
820 __webpack_require__.d(__webpack_exports__, "PostSlugCheck", function() { return /* reexport */ PostSlugCheck; }); |
882 "PageAttributesCheck": function() { return /* reexport */ page_attributes_check; }, |
821 __webpack_require__.d(__webpack_exports__, "PostSticky", function() { return /* reexport */ post_sticky; }); |
883 "PageAttributesOrder": function() { return /* reexport */ order; }, |
822 __webpack_require__.d(__webpack_exports__, "PostStickyCheck", function() { return /* reexport */ post_sticky_check; }); |
884 "PageAttributesParent": function() { return /* reexport */ page_attributes_parent; }, |
823 __webpack_require__.d(__webpack_exports__, "PostSwitchToDraftButton", function() { return /* reexport */ post_switch_to_draft_button; }); |
885 "PageTemplate": function() { return /* reexport */ post_template; }, |
824 __webpack_require__.d(__webpack_exports__, "PostTaxonomies", function() { return /* reexport */ post_taxonomies; }); |
886 "PanelColorSettings": function() { return /* reexport */ PanelColorSettings; }, |
825 __webpack_require__.d(__webpack_exports__, "PostTaxonomiesCheck", function() { return /* reexport */ post_taxonomies_check; }); |
887 "PlainText": function() { return /* reexport */ PlainText; }, |
826 __webpack_require__.d(__webpack_exports__, "PostTextEditor", function() { return /* reexport */ PostTextEditor; }); |
888 "PostAuthor": function() { return /* reexport */ post_author; }, |
827 __webpack_require__.d(__webpack_exports__, "PostTitle", function() { return /* reexport */ PostTitle; }); |
889 "PostAuthorCheck": function() { return /* reexport */ PostAuthorCheck; }, |
828 __webpack_require__.d(__webpack_exports__, "PostTrash", function() { return /* reexport */ post_trash; }); |
890 "PostComments": function() { return /* reexport */ post_comments; }, |
829 __webpack_require__.d(__webpack_exports__, "PostTrashCheck", function() { return /* reexport */ post_trash_check; }); |
891 "PostExcerpt": function() { return /* reexport */ post_excerpt; }, |
830 __webpack_require__.d(__webpack_exports__, "PostTypeSupportCheck", function() { return /* reexport */ post_type_support_check; }); |
892 "PostExcerptCheck": function() { return /* reexport */ post_excerpt_check; }, |
831 __webpack_require__.d(__webpack_exports__, "PostVisibility", function() { return /* reexport */ post_visibility; }); |
893 "PostFeaturedImage": function() { return /* reexport */ post_featured_image; }, |
832 __webpack_require__.d(__webpack_exports__, "PostVisibilityLabel", function() { return /* reexport */ post_visibility_label; }); |
894 "PostFeaturedImageCheck": function() { return /* reexport */ post_featured_image_check; }, |
833 __webpack_require__.d(__webpack_exports__, "PostVisibilityCheck", function() { return /* reexport */ post_visibility_check; }); |
895 "PostFormat": function() { return /* reexport */ PostFormat; }, |
834 __webpack_require__.d(__webpack_exports__, "TableOfContents", function() { return /* reexport */ table_of_contents; }); |
896 "PostFormatCheck": function() { return /* reexport */ post_format_check; }, |
835 __webpack_require__.d(__webpack_exports__, "UnsavedChangesWarning", function() { return /* reexport */ UnsavedChangesWarning; }); |
897 "PostLastRevision": function() { return /* reexport */ post_last_revision; }, |
836 __webpack_require__.d(__webpack_exports__, "WordCount", function() { return /* reexport */ WordCount; }); |
898 "PostLastRevisionCheck": function() { return /* reexport */ post_last_revision_check; }, |
837 __webpack_require__.d(__webpack_exports__, "EditorProvider", function() { return /* reexport */ provider; }); |
899 "PostLockedModal": function() { return /* reexport */ PostLockedModal; }, |
838 __webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return /* reexport */ external_wp_serverSideRender_default.a; }); |
900 "PostPendingStatus": function() { return /* reexport */ post_pending_status; }, |
839 __webpack_require__.d(__webpack_exports__, "RichText", function() { return /* reexport */ RichText; }); |
901 "PostPendingStatusCheck": function() { return /* reexport */ post_pending_status_check; }, |
840 __webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ Autocomplete; }); |
902 "PostPingbacks": function() { return /* reexport */ post_pingbacks; }, |
841 __webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return /* reexport */ AlignmentToolbar; }); |
903 "PostPreviewButton": function() { return /* reexport */ post_preview_button; }, |
842 __webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return /* reexport */ BlockAlignmentToolbar; }); |
904 "PostPublishButton": function() { return /* reexport */ post_publish_button; }, |
843 __webpack_require__.d(__webpack_exports__, "BlockControls", function() { return /* reexport */ BlockControls; }); |
905 "PostPublishButtonLabel": function() { return /* reexport */ label; }, |
844 __webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return /* reexport */ deprecated_BlockEdit; }); |
906 "PostPublishPanel": function() { return /* reexport */ post_publish_panel; }, |
845 __webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return /* reexport */ BlockEditorKeyboardShortcuts; }); |
907 "PostSavedState": function() { return /* reexport */ PostSavedState; }, |
846 __webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return /* reexport */ BlockFormatControls; }); |
908 "PostSchedule": function() { return /* reexport */ PostSchedule; }, |
847 __webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return /* reexport */ BlockIcon; }); |
909 "PostScheduleCheck": function() { return /* reexport */ post_schedule_check; }, |
848 __webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return /* reexport */ BlockInspector; }); |
910 "PostScheduleLabel": function() { return /* reexport */ post_schedule_label; }, |
849 __webpack_require__.d(__webpack_exports__, "BlockList", function() { return /* reexport */ BlockList; }); |
911 "PostSlug": function() { return /* reexport */ post_slug; }, |
850 __webpack_require__.d(__webpack_exports__, "BlockMover", function() { return /* reexport */ BlockMover; }); |
912 "PostSlugCheck": function() { return /* reexport */ PostSlugCheck; }, |
851 __webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return /* reexport */ BlockNavigationDropdown; }); |
913 "PostSticky": function() { return /* reexport */ post_sticky; }, |
852 __webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return /* reexport */ BlockSelectionClearer; }); |
914 "PostStickyCheck": function() { return /* reexport */ post_sticky_check; }, |
853 __webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return /* reexport */ BlockSettingsMenu; }); |
915 "PostSwitchToDraftButton": function() { return /* reexport */ post_switch_to_draft_button; }, |
854 __webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return /* reexport */ BlockTitle; }); |
916 "PostTaxonomies": function() { return /* reexport */ post_taxonomies; }, |
855 __webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return /* reexport */ BlockToolbar; }); |
917 "PostTaxonomiesCheck": function() { return /* reexport */ post_taxonomies_check; }, |
856 __webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ ColorPalette; }); |
918 "PostTaxonomiesFlatTermSelector": function() { return /* reexport */ flat_term_selector; }, |
857 __webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return /* reexport */ ContrastChecker; }); |
919 "PostTaxonomiesHierarchicalTermSelector": function() { return /* reexport */ hierarchical_term_selector; }, |
858 __webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return /* reexport */ CopyHandler; }); |
920 "PostTextEditor": function() { return /* reexport */ PostTextEditor; }, |
859 __webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return /* reexport */ DefaultBlockAppender; }); |
921 "PostTitle": function() { return /* reexport */ PostTitle; }, |
860 __webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ FontSizePicker; }); |
922 "PostTrash": function() { return /* reexport */ PostTrash; }, |
861 __webpack_require__.d(__webpack_exports__, "Inserter", function() { return /* reexport */ Inserter; }); |
923 "PostTrashCheck": function() { return /* reexport */ post_trash_check; }, |
862 __webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return /* reexport */ InnerBlocks; }); |
924 "PostTypeSupportCheck": function() { return /* reexport */ post_type_support_check; }, |
863 __webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return /* reexport */ InspectorAdvancedControls; }); |
925 "PostVisibility": function() { return /* reexport */ post_visibility; }, |
864 __webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return /* reexport */ InspectorControls; }); |
926 "PostVisibilityCheck": function() { return /* reexport */ post_visibility_check; }, |
865 __webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return /* reexport */ PanelColorSettings; }); |
927 "PostVisibilityLabel": function() { return /* reexport */ post_visibility_label; }, |
866 __webpack_require__.d(__webpack_exports__, "PlainText", function() { return /* reexport */ PlainText; }); |
928 "RichText": function() { return /* reexport */ RichText; }, |
867 __webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return /* reexport */ RichTextShortcut; }); |
929 "RichTextShortcut": function() { return /* reexport */ RichTextShortcut; }, |
868 __webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return /* reexport */ RichTextToolbarButton; }); |
930 "RichTextToolbarButton": function() { return /* reexport */ RichTextToolbarButton; }, |
869 __webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return /* reexport */ __unstableRichTextInputEvent; }); |
931 "ServerSideRender": function() { return /* reexport */ (external_wp_serverSideRender_default()); }, |
870 __webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return /* reexport */ MediaPlaceholder; }); |
932 "SkipToSelectedBlock": function() { return /* reexport */ SkipToSelectedBlock; }, |
871 __webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return /* reexport */ MediaUpload; }); |
933 "TableOfContents": function() { return /* reexport */ table_of_contents; }, |
872 __webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return /* reexport */ MediaUploadCheck; }); |
934 "TextEditorGlobalKeyboardShortcuts": function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; }, |
873 __webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return /* reexport */ MultiSelectScrollIntoView; }); |
935 "ThemeSupportCheck": function() { return /* reexport */ theme_support_check; }, |
874 __webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return /* reexport */ NavigableToolbar; }); |
936 "URLInput": function() { return /* reexport */ URLInput; }, |
875 __webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return /* reexport */ ObserveTyping; }); |
937 "URLInputButton": function() { return /* reexport */ URLInputButton; }, |
876 __webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return /* reexport */ PreserveScrollInReorder; }); |
938 "URLPopover": function() { return /* reexport */ URLPopover; }, |
877 __webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return /* reexport */ SkipToSelectedBlock; }); |
939 "UnsavedChangesWarning": function() { return /* reexport */ UnsavedChangesWarning; }, |
878 __webpack_require__.d(__webpack_exports__, "URLInput", function() { return /* reexport */ URLInput; }); |
940 "VisualEditorGlobalKeyboardShortcuts": function() { return /* reexport */ visual_editor_shortcuts; }, |
879 __webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return /* reexport */ URLInputButton; }); |
941 "Warning": function() { return /* reexport */ Warning; }, |
880 __webpack_require__.d(__webpack_exports__, "URLPopover", function() { return /* reexport */ URLPopover; }); |
942 "WordCount": function() { return /* reexport */ WordCount; }, |
881 __webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ Warning; }); |
943 "WritingFlow": function() { return /* reexport */ WritingFlow; }, |
882 __webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ WritingFlow; }); |
944 "__unstableRichTextInputEvent": function() { return /* reexport */ __unstableRichTextInputEvent; }, |
883 __webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return /* reexport */ createCustomColorsHOC; }); |
945 "cleanForSlug": function() { return /* reexport */ cleanForSlug; }, |
884 __webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return /* reexport */ getColorClassName; }); |
946 "createCustomColorsHOC": function() { return /* reexport */ createCustomColorsHOC; }, |
885 __webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return /* reexport */ getColorObjectByAttributeValues; }); |
947 "getColorClassName": function() { return /* reexport */ getColorClassName; }, |
886 __webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return /* reexport */ getColorObjectByColorValue; }); |
948 "getColorObjectByAttributeValues": function() { return /* reexport */ getColorObjectByAttributeValues; }, |
887 __webpack_require__.d(__webpack_exports__, "getFontSize", function() { return /* reexport */ getFontSize; }); |
949 "getColorObjectByColorValue": function() { return /* reexport */ getColorObjectByColorValue; }, |
888 __webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return /* reexport */ getFontSizeClass; }); |
950 "getFontSize": function() { return /* reexport */ getFontSize; }, |
889 __webpack_require__.d(__webpack_exports__, "withColorContext", function() { return /* reexport */ withColorContext; }); |
951 "getFontSizeClass": function() { return /* reexport */ getFontSizeClass; }, |
890 __webpack_require__.d(__webpack_exports__, "withColors", function() { return /* reexport */ withColors; }); |
952 "getTemplatePartIcon": function() { return /* reexport */ getTemplatePartIcon; }, |
891 __webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return /* reexport */ withFontSizes; }); |
953 "mediaUpload": function() { return /* reexport */ mediaUpload; }, |
892 __webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return /* reexport */ mediaUpload; }); |
954 "store": function() { return /* reexport */ store_store; }, |
893 __webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return /* reexport */ cleanForSlug; }); |
955 "storeConfig": function() { return /* reexport */ storeConfig; }, |
894 __webpack_require__.d(__webpack_exports__, "transformStyles", function() { return /* reexport */ external_wp_blockEditor_["transformStyles"]; }); |
956 "transformStyles": function() { return /* reexport */ external_wp_blockEditor_namespaceObject.transformStyles; }, |
957 "userAutocompleter": function() { return /* reexport */ user; }, |
|
958 "withColorContext": function() { return /* reexport */ withColorContext; }, |
|
959 "withColors": function() { return /* reexport */ withColors; }, |
|
960 "withFontSizes": function() { return /* reexport */ withFontSizes; } |
|
961 }); |
|
895 |
962 |
896 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js |
963 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js |
897 var selectors_namespaceObject = {}; |
964 var selectors_namespaceObject = {}; |
898 __webpack_require__.r(selectors_namespaceObject); |
965 __webpack_require__.r(selectors_namespaceObject); |
899 __webpack_require__.d(selectors_namespaceObject, "hasEditorUndo", function() { return hasEditorUndo; }); |
966 __webpack_require__.d(selectors_namespaceObject, { |
900 __webpack_require__.d(selectors_namespaceObject, "hasEditorRedo", function() { return hasEditorRedo; }); |
967 "__experimentalGetDefaultTemplatePartAreas": function() { return __experimentalGetDefaultTemplatePartAreas; }, |
901 __webpack_require__.d(selectors_namespaceObject, "isEditedPostNew", function() { return selectors_isEditedPostNew; }); |
968 "__experimentalGetDefaultTemplateType": function() { return __experimentalGetDefaultTemplateType; }, |
902 __webpack_require__.d(selectors_namespaceObject, "hasChangedContent", function() { return hasChangedContent; }); |
969 "__experimentalGetDefaultTemplateTypes": function() { return __experimentalGetDefaultTemplateTypes; }, |
903 __webpack_require__.d(selectors_namespaceObject, "isEditedPostDirty", function() { return selectors_isEditedPostDirty; }); |
970 "__experimentalGetTemplateInfo": function() { return __experimentalGetTemplateInfo; }, |
904 __webpack_require__.d(selectors_namespaceObject, "hasNonPostEntityChanges", function() { return selectors_hasNonPostEntityChanges; }); |
971 "__unstableIsEditorReady": function() { return __unstableIsEditorReady; }, |
905 __webpack_require__.d(selectors_namespaceObject, "isCleanNewPost", function() { return selectors_isCleanNewPost; }); |
972 "canInsertBlockType": function() { return canInsertBlockType; }, |
906 __webpack_require__.d(selectors_namespaceObject, "getCurrentPost", function() { return selectors_getCurrentPost; }); |
973 "canUserUseUnfilteredHTML": function() { return canUserUseUnfilteredHTML; }, |
907 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostType", function() { return selectors_getCurrentPostType; }); |
974 "didPostSaveRequestFail": function() { return didPostSaveRequestFail; }, |
908 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostId", function() { return selectors_getCurrentPostId; }); |
975 "didPostSaveRequestSucceed": function() { return didPostSaveRequestSucceed; }, |
909 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostRevisionsCount", function() { return getCurrentPostRevisionsCount; }); |
976 "getActivePostLock": function() { return getActivePostLock; }, |
910 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostLastRevisionId", function() { return getCurrentPostLastRevisionId; }); |
977 "getAdjacentBlockClientId": function() { return getAdjacentBlockClientId; }, |
911 __webpack_require__.d(selectors_namespaceObject, "getPostEdits", function() { return selectors_getPostEdits; }); |
978 "getAutosaveAttribute": function() { return getAutosaveAttribute; }, |
912 __webpack_require__.d(selectors_namespaceObject, "getReferenceByDistinctEdits", function() { return getReferenceByDistinctEdits; }); |
979 "getBlock": function() { return getBlock; }, |
913 __webpack_require__.d(selectors_namespaceObject, "getCurrentPostAttribute", function() { return selectors_getCurrentPostAttribute; }); |
980 "getBlockAttributes": function() { return getBlockAttributes; }, |
914 __webpack_require__.d(selectors_namespaceObject, "getEditedPostAttribute", function() { return selectors_getEditedPostAttribute; }); |
981 "getBlockCount": function() { return getBlockCount; }, |
915 __webpack_require__.d(selectors_namespaceObject, "getAutosaveAttribute", function() { return getAutosaveAttribute; }); |
982 "getBlockHierarchyRootClientId": function() { return getBlockHierarchyRootClientId; }, |
916 __webpack_require__.d(selectors_namespaceObject, "getEditedPostVisibility", function() { return selectors_getEditedPostVisibility; }); |
983 "getBlockIndex": function() { return getBlockIndex; }, |
917 __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPending", function() { return isCurrentPostPending; }); |
984 "getBlockInsertionPoint": function() { return getBlockInsertionPoint; }, |
918 __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPublished", function() { return selectors_isCurrentPostPublished; }); |
985 "getBlockListSettings": function() { return getBlockListSettings; }, |
919 __webpack_require__.d(selectors_namespaceObject, "isCurrentPostScheduled", function() { return selectors_isCurrentPostScheduled; }); |
986 "getBlockMode": function() { return getBlockMode; }, |
920 __webpack_require__.d(selectors_namespaceObject, "isEditedPostPublishable", function() { return selectors_isEditedPostPublishable; }); |
987 "getBlockName": function() { return getBlockName; }, |
921 __webpack_require__.d(selectors_namespaceObject, "isEditedPostSaveable", function() { return selectors_isEditedPostSaveable; }); |
988 "getBlockOrder": function() { return getBlockOrder; }, |
922 __webpack_require__.d(selectors_namespaceObject, "isEditedPostEmpty", function() { return isEditedPostEmpty; }); |
989 "getBlockRootClientId": function() { return getBlockRootClientId; }, |
923 __webpack_require__.d(selectors_namespaceObject, "isEditedPostAutosaveable", function() { return selectors_isEditedPostAutosaveable; }); |
990 "getBlockSelectionEnd": function() { return getBlockSelectionEnd; }, |
924 __webpack_require__.d(selectors_namespaceObject, "getAutosave", function() { return getAutosave; }); |
991 "getBlockSelectionStart": function() { return getBlockSelectionStart; }, |
925 __webpack_require__.d(selectors_namespaceObject, "hasAutosave", function() { return hasAutosave; }); |
992 "getBlocks": function() { return getBlocks; }, |
926 __webpack_require__.d(selectors_namespaceObject, "isEditedPostBeingScheduled", function() { return selectors_isEditedPostBeingScheduled; }); |
993 "getBlocksByClientId": function() { return getBlocksByClientId; }, |
927 __webpack_require__.d(selectors_namespaceObject, "isEditedPostDateFloating", function() { return isEditedPostDateFloating; }); |
994 "getClientIdsOfDescendants": function() { return getClientIdsOfDescendants; }, |
928 __webpack_require__.d(selectors_namespaceObject, "isSavingPost", function() { return selectors_isSavingPost; }); |
995 "getClientIdsWithDescendants": function() { return getClientIdsWithDescendants; }, |
929 __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestSucceed", function() { return didPostSaveRequestSucceed; }); |
996 "getCurrentPost": function() { return getCurrentPost; }, |
930 __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestFail", function() { return didPostSaveRequestFail; }); |
997 "getCurrentPostAttribute": function() { return getCurrentPostAttribute; }, |
931 __webpack_require__.d(selectors_namespaceObject, "isAutosavingPost", function() { return selectors_isAutosavingPost; }); |
998 "getCurrentPostId": function() { return getCurrentPostId; }, |
932 __webpack_require__.d(selectors_namespaceObject, "isPreviewingPost", function() { return isPreviewingPost; }); |
999 "getCurrentPostLastRevisionId": function() { return getCurrentPostLastRevisionId; }, |
933 __webpack_require__.d(selectors_namespaceObject, "getEditedPostPreviewLink", function() { return selectors_getEditedPostPreviewLink; }); |
1000 "getCurrentPostRevisionsCount": function() { return getCurrentPostRevisionsCount; }, |
934 __webpack_require__.d(selectors_namespaceObject, "getSuggestedPostFormat", function() { return selectors_getSuggestedPostFormat; }); |
1001 "getCurrentPostType": function() { return getCurrentPostType; }, |
935 __webpack_require__.d(selectors_namespaceObject, "getBlocksForSerialization", function() { return getBlocksForSerialization; }); |
1002 "getEditedPostAttribute": function() { return getEditedPostAttribute; }, |
936 __webpack_require__.d(selectors_namespaceObject, "getEditedPostContent", function() { return getEditedPostContent; }); |
1003 "getEditedPostContent": function() { return getEditedPostContent; }, |
937 __webpack_require__.d(selectors_namespaceObject, "isPublishingPost", function() { return selectors_isPublishingPost; }); |
1004 "getEditedPostPreviewLink": function() { return getEditedPostPreviewLink; }, |
938 __webpack_require__.d(selectors_namespaceObject, "isPermalinkEditable", function() { return isPermalinkEditable; }); |
1005 "getEditedPostSlug": function() { return getEditedPostSlug; }, |
939 __webpack_require__.d(selectors_namespaceObject, "getPermalink", function() { return getPermalink; }); |
1006 "getEditedPostVisibility": function() { return getEditedPostVisibility; }, |
940 __webpack_require__.d(selectors_namespaceObject, "getEditedPostSlug", function() { return getEditedPostSlug; }); |
1007 "getEditorBlocks": function() { return getEditorBlocks; }, |
941 __webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return getPermalinkParts; }); |
1008 "getEditorSelection": function() { return getEditorSelection; }, |
942 __webpack_require__.d(selectors_namespaceObject, "isPostLocked", function() { return selectors_isPostLocked; }); |
1009 "getEditorSelectionEnd": function() { return getEditorSelectionEnd; }, |
943 __webpack_require__.d(selectors_namespaceObject, "isPostSavingLocked", function() { return selectors_isPostSavingLocked; }); |
1010 "getEditorSelectionStart": function() { return getEditorSelectionStart; }, |
944 __webpack_require__.d(selectors_namespaceObject, "isPostAutosavingLocked", function() { return isPostAutosavingLocked; }); |
1011 "getEditorSettings": function() { return getEditorSettings; }, |
945 __webpack_require__.d(selectors_namespaceObject, "isPostLockTakeover", function() { return isPostLockTakeover; }); |
1012 "getFirstMultiSelectedBlockClientId": function() { return getFirstMultiSelectedBlockClientId; }, |
946 __webpack_require__.d(selectors_namespaceObject, "getPostLockUser", function() { return getPostLockUser; }); |
1013 "getGlobalBlockCount": function() { return getGlobalBlockCount; }, |
947 __webpack_require__.d(selectors_namespaceObject, "getActivePostLock", function() { return getActivePostLock; }); |
1014 "getInserterItems": function() { return getInserterItems; }, |
948 __webpack_require__.d(selectors_namespaceObject, "canUserUseUnfilteredHTML", function() { return selectors_canUserUseUnfilteredHTML; }); |
1015 "getLastMultiSelectedBlockClientId": function() { return getLastMultiSelectedBlockClientId; }, |
949 __webpack_require__.d(selectors_namespaceObject, "isPublishSidebarEnabled", function() { return selectors_isPublishSidebarEnabled; }); |
1016 "getMultiSelectedBlockClientIds": function() { return getMultiSelectedBlockClientIds; }, |
950 __webpack_require__.d(selectors_namespaceObject, "getEditorBlocks", function() { return getEditorBlocks; }); |
1017 "getMultiSelectedBlocks": function() { return getMultiSelectedBlocks; }, |
951 __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionStart", function() { return getEditorSelectionStart; }); |
1018 "getMultiSelectedBlocksEndClientId": function() { return getMultiSelectedBlocksEndClientId; }, |
952 __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionEnd", function() { return getEditorSelectionEnd; }); |
1019 "getMultiSelectedBlocksStartClientId": function() { return getMultiSelectedBlocksStartClientId; }, |
953 __webpack_require__.d(selectors_namespaceObject, "getEditorSelection", function() { return selectors_getEditorSelection; }); |
1020 "getNextBlockClientId": function() { return getNextBlockClientId; }, |
954 __webpack_require__.d(selectors_namespaceObject, "__unstableIsEditorReady", function() { return selectors_unstableIsEditorReady; }); |
1021 "getPermalink": function() { return getPermalink; }, |
955 __webpack_require__.d(selectors_namespaceObject, "getEditorSettings", function() { return selectors_getEditorSettings; }); |
1022 "getPermalinkParts": function() { return getPermalinkParts; }, |
956 __webpack_require__.d(selectors_namespaceObject, "getStateBeforeOptimisticTransaction", function() { return getStateBeforeOptimisticTransaction; }); |
1023 "getPostEdits": function() { return getPostEdits; }, |
957 __webpack_require__.d(selectors_namespaceObject, "inSomeHistory", function() { return inSomeHistory; }); |
1024 "getPostLockUser": function() { return getPostLockUser; }, |
958 __webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return getBlockName; }); |
1025 "getPostTypeLabel": function() { return getPostTypeLabel; }, |
959 __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return isBlockValid; }); |
1026 "getPreviousBlockClientId": function() { return getPreviousBlockClientId; }, |
960 __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; }); |
1027 "getSelectedBlock": function() { return getSelectedBlock; }, |
961 __webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return getBlock; }); |
1028 "getSelectedBlockClientId": function() { return getSelectedBlockClientId; }, |
962 __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; }); |
1029 "getSelectedBlockCount": function() { return getSelectedBlockCount; }, |
963 __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return __unstableGetBlockWithoutInnerBlocks; }); |
1030 "getSelectedBlocksInitialCaretPosition": function() { return getSelectedBlocksInitialCaretPosition; }, |
964 __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return getClientIdsOfDescendants; }); |
1031 "getStateBeforeOptimisticTransaction": function() { return getStateBeforeOptimisticTransaction; }, |
965 __webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; }); |
1032 "getSuggestedPostFormat": function() { return getSuggestedPostFormat; }, |
966 __webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return selectors_getGlobalBlockCount; }); |
1033 "getTemplate": function() { return getTemplate; }, |
967 __webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return getBlocksByClientId; }); |
1034 "getTemplateLock": function() { return getTemplateLock; }, |
968 __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return getBlockCount; }); |
1035 "hasChangedContent": function() { return hasChangedContent; }, |
969 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return getBlockSelectionStart; }); |
1036 "hasEditorRedo": function() { return hasEditorRedo; }, |
970 __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return getBlockSelectionEnd; }); |
1037 "hasEditorUndo": function() { return hasEditorUndo; }, |
971 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return getSelectedBlockCount; }); |
1038 "hasInserterItems": function() { return hasInserterItems; }, |
972 __webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return hasSelectedBlock; }); |
1039 "hasMultiSelection": function() { return hasMultiSelection; }, |
973 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return getSelectedBlockClientId; }); |
1040 "hasNonPostEntityChanges": function() { return hasNonPostEntityChanges; }, |
974 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return getSelectedBlock; }); |
1041 "hasSelectedBlock": function() { return hasSelectedBlock; }, |
975 __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return getBlockRootClientId; }); |
1042 "hasSelectedInnerBlock": function() { return hasSelectedInnerBlock; }, |
976 __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; }); |
1043 "inSomeHistory": function() { return inSomeHistory; }, |
977 __webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; }); |
1044 "isAncestorMultiSelected": function() { return isAncestorMultiSelected; }, |
978 __webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return getPreviousBlockClientId; }); |
1045 "isAutosavingPost": function() { return isAutosavingPost; }, |
979 __webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return getNextBlockClientId; }); |
1046 "isBlockInsertionPointVisible": function() { return isBlockInsertionPointVisible; }, |
980 __webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return getSelectedBlocksInitialCaretPosition; }); |
1047 "isBlockMultiSelected": function() { return isBlockMultiSelected; }, |
981 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return getMultiSelectedBlockClientIds; }); |
1048 "isBlockSelected": function() { return isBlockSelected; }, |
982 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return getMultiSelectedBlocks; }); |
1049 "isBlockValid": function() { return isBlockValid; }, |
983 __webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return getFirstMultiSelectedBlockClientId; }); |
1050 "isBlockWithinSelection": function() { return isBlockWithinSelection; }, |
984 __webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return getLastMultiSelectedBlockClientId; }); |
1051 "isCaretWithinFormattedText": function() { return isCaretWithinFormattedText; }, |
985 __webpack_require__.d(selectors_namespaceObject, "isFirstMultiSelectedBlock", function() { return isFirstMultiSelectedBlock; }); |
1052 "isCleanNewPost": function() { return isCleanNewPost; }, |
986 __webpack_require__.d(selectors_namespaceObject, "isBlockMultiSelected", function() { return isBlockMultiSelected; }); |
1053 "isCurrentPostPending": function() { return isCurrentPostPending; }, |
987 __webpack_require__.d(selectors_namespaceObject, "isAncestorMultiSelected", function() { return isAncestorMultiSelected; }); |
1054 "isCurrentPostPublished": function() { return isCurrentPostPublished; }, |
988 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksStartClientId", function() { return getMultiSelectedBlocksStartClientId; }); |
1055 "isCurrentPostScheduled": function() { return isCurrentPostScheduled; }, |
989 __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return getMultiSelectedBlocksEndClientId; }); |
1056 "isEditedPostAutosaveable": function() { return isEditedPostAutosaveable; }, |
990 __webpack_require__.d(selectors_namespaceObject, "getBlockOrder", function() { return getBlockOrder; }); |
1057 "isEditedPostBeingScheduled": function() { return isEditedPostBeingScheduled; }, |
991 __webpack_require__.d(selectors_namespaceObject, "getBlockIndex", function() { return getBlockIndex; }); |
1058 "isEditedPostDateFloating": function() { return isEditedPostDateFloating; }, |
992 __webpack_require__.d(selectors_namespaceObject, "isBlockSelected", function() { return isBlockSelected; }); |
1059 "isEditedPostDirty": function() { return isEditedPostDirty; }, |
993 __webpack_require__.d(selectors_namespaceObject, "hasSelectedInnerBlock", function() { return hasSelectedInnerBlock; }); |
1060 "isEditedPostEmpty": function() { return isEditedPostEmpty; }, |
994 __webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; }); |
1061 "isEditedPostNew": function() { return isEditedPostNew; }, |
995 __webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return hasMultiSelection; }); |
1062 "isEditedPostPublishable": function() { return isEditedPostPublishable; }, |
996 __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return isMultiSelecting; }); |
1063 "isEditedPostSaveable": function() { return isEditedPostSaveable; }, |
997 __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return isSelectionEnabled; }); |
1064 "isFirstMultiSelectedBlock": function() { return isFirstMultiSelectedBlock; }, |
998 __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return getBlockMode; }); |
1065 "isMultiSelecting": function() { return isMultiSelecting; }, |
999 __webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return isTyping; }); |
1066 "isPermalinkEditable": function() { return isPermalinkEditable; }, |
1000 __webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return isCaretWithinFormattedText; }); |
1067 "isPostAutosavingLocked": function() { return isPostAutosavingLocked; }, |
1001 __webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return getBlockInsertionPoint; }); |
1068 "isPostLockTakeover": function() { return isPostLockTakeover; }, |
1002 __webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return isBlockInsertionPointVisible; }); |
1069 "isPostLocked": function() { return isPostLocked; }, |
1003 __webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return isValidTemplate; }); |
1070 "isPostSavingLocked": function() { return isPostSavingLocked; }, |
1004 __webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; }); |
1071 "isPreviewingPost": function() { return isPreviewingPost; }, |
1005 __webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return getTemplateLock; }); |
1072 "isPublishSidebarEnabled": function() { return isPublishSidebarEnabled; }, |
1006 __webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return canInsertBlockType; }); |
1073 "isPublishingPost": function() { return isPublishingPost; }, |
1007 __webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return getInserterItems; }); |
1074 "isSavingNonPostEntityChanges": function() { return isSavingNonPostEntityChanges; }, |
1008 __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; }); |
1075 "isSavingPost": function() { return isSavingPost; }, |
1009 __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; }); |
1076 "isSelectionEnabled": function() { return isSelectionEnabled; }, |
1010 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplateTypes", function() { return __experimentalGetDefaultTemplateTypes; }); |
1077 "isTyping": function() { return isTyping; }, |
1011 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplatePartAreas", function() { return __experimentalGetDefaultTemplatePartAreas; }); |
1078 "isValidTemplate": function() { return isValidTemplate; } |
1012 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplateType", function() { return __experimentalGetDefaultTemplateType; }); |
1079 }); |
1013 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetTemplateInfo", function() { return __experimentalGetTemplateInfo; }); |
|
1014 |
1080 |
1015 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js |
1081 // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js |
1016 var actions_namespaceObject = {}; |
1082 var actions_namespaceObject = {}; |
1017 __webpack_require__.r(actions_namespaceObject); |
1083 __webpack_require__.r(actions_namespaceObject); |
1018 __webpack_require__.d(actions_namespaceObject, "setupEditor", function() { return actions_setupEditor; }); |
1084 __webpack_require__.d(actions_namespaceObject, { |
1019 __webpack_require__.d(actions_namespaceObject, "__experimentalTearDownEditor", function() { return actions_experimentalTearDownEditor; }); |
1085 "__experimentalTearDownEditor": function() { return __experimentalTearDownEditor; }, |
1020 __webpack_require__.d(actions_namespaceObject, "resetPost", function() { return resetPost; }); |
1086 "autosave": function() { return autosave; }, |
1021 __webpack_require__.d(actions_namespaceObject, "resetAutosave", function() { return resetAutosave; }); |
1087 "clearSelectedBlock": function() { return clearSelectedBlock; }, |
1022 __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateStart", function() { return __experimentalRequestPostUpdateStart; }); |
1088 "createUndoLevel": function() { return createUndoLevel; }, |
1023 __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateFinish", function() { return __experimentalRequestPostUpdateFinish; }); |
1089 "disablePublishSidebar": function() { return disablePublishSidebar; }, |
1024 __webpack_require__.d(actions_namespaceObject, "updatePost", function() { return updatePost; }); |
1090 "editPost": function() { return editPost; }, |
1025 __webpack_require__.d(actions_namespaceObject, "setupEditorState", function() { return setupEditorState; }); |
1091 "enablePublishSidebar": function() { return enablePublishSidebar; }, |
1026 __webpack_require__.d(actions_namespaceObject, "editPost", function() { return actions_editPost; }); |
1092 "enterFormattedText": function() { return enterFormattedText; }, |
1027 __webpack_require__.d(actions_namespaceObject, "savePost", function() { return actions_savePost; }); |
1093 "exitFormattedText": function() { return exitFormattedText; }, |
1028 __webpack_require__.d(actions_namespaceObject, "refreshPost", function() { return refreshPost; }); |
1094 "hideInsertionPoint": function() { return hideInsertionPoint; }, |
1029 __webpack_require__.d(actions_namespaceObject, "trashPost", function() { return trashPost; }); |
1095 "insertBlock": function() { return insertBlock; }, |
1030 __webpack_require__.d(actions_namespaceObject, "autosave", function() { return actions_autosave; }); |
1096 "insertBlocks": function() { return insertBlocks; }, |
1031 __webpack_require__.d(actions_namespaceObject, "redo", function() { return actions_redo; }); |
1097 "insertDefaultBlock": function() { return insertDefaultBlock; }, |
1032 __webpack_require__.d(actions_namespaceObject, "undo", function() { return actions_undo; }); |
1098 "lockPostAutosaving": function() { return lockPostAutosaving; }, |
1033 __webpack_require__.d(actions_namespaceObject, "createUndoLevel", function() { return createUndoLevel; }); |
1099 "lockPostSaving": function() { return lockPostSaving; }, |
1034 __webpack_require__.d(actions_namespaceObject, "updatePostLock", function() { return actions_updatePostLock; }); |
1100 "mergeBlocks": function() { return mergeBlocks; }, |
1035 __webpack_require__.d(actions_namespaceObject, "enablePublishSidebar", function() { return enablePublishSidebar; }); |
1101 "moveBlockToPosition": function() { return moveBlockToPosition; }, |
1036 __webpack_require__.d(actions_namespaceObject, "disablePublishSidebar", function() { return disablePublishSidebar; }); |
1102 "moveBlocksDown": function() { return moveBlocksDown; }, |
1037 __webpack_require__.d(actions_namespaceObject, "lockPostSaving", function() { return lockPostSaving; }); |
1103 "moveBlocksUp": function() { return moveBlocksUp; }, |
1038 __webpack_require__.d(actions_namespaceObject, "unlockPostSaving", function() { return unlockPostSaving; }); |
1104 "multiSelect": function() { return multiSelect; }, |
1039 __webpack_require__.d(actions_namespaceObject, "lockPostAutosaving", function() { return lockPostAutosaving; }); |
1105 "receiveBlocks": function() { return receiveBlocks; }, |
1040 __webpack_require__.d(actions_namespaceObject, "unlockPostAutosaving", function() { return unlockPostAutosaving; }); |
1106 "redo": function() { return redo; }, |
1041 __webpack_require__.d(actions_namespaceObject, "resetEditorBlocks", function() { return actions_resetEditorBlocks; }); |
1107 "refreshPost": function() { return refreshPost; }, |
1042 __webpack_require__.d(actions_namespaceObject, "updateEditorSettings", function() { return actions_updateEditorSettings; }); |
1108 "removeBlock": function() { return removeBlock; }, |
1043 __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return resetBlocks; }); |
1109 "removeBlocks": function() { return removeBlocks; }, |
1044 __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; }); |
1110 "replaceBlock": function() { return replaceBlock; }, |
1045 __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; }); |
1111 "replaceBlocks": function() { return replaceBlocks; }, |
1046 __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; }); |
1112 "resetBlocks": function() { return resetBlocks; }, |
1047 __webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return actions_selectBlock; }); |
1113 "resetEditorBlocks": function() { return resetEditorBlocks; }, |
1048 __webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return startMultiSelect; }); |
1114 "resetPost": function() { return resetPost; }, |
1049 __webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return stopMultiSelect; }); |
1115 "savePost": function() { return savePost; }, |
1050 __webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return multiSelect; }); |
1116 "selectBlock": function() { return selectBlock; }, |
1051 __webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return actions_clearSelectedBlock; }); |
1117 "setTemplateValidity": function() { return setTemplateValidity; }, |
1052 __webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return toggleSelection; }); |
1118 "setupEditor": function() { return setupEditor; }, |
1053 __webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return replaceBlocks; }); |
1119 "setupEditorState": function() { return setupEditorState; }, |
1054 __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; }); |
1120 "showInsertionPoint": function() { return showInsertionPoint; }, |
1055 __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return moveBlocksDown; }); |
1121 "startMultiSelect": function() { return startMultiSelect; }, |
1056 __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return moveBlocksUp; }); |
1122 "startTyping": function() { return startTyping; }, |
1057 __webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return moveBlockToPosition; }); |
1123 "stopMultiSelect": function() { return stopMultiSelect; }, |
1058 __webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return insertBlock; }); |
1124 "stopTyping": function() { return stopTyping; }, |
1059 __webpack_require__.d(actions_namespaceObject, "insertBlocks", function() { return actions_insertBlocks; }); |
1125 "synchronizeTemplate": function() { return synchronizeTemplate; }, |
1060 __webpack_require__.d(actions_namespaceObject, "showInsertionPoint", function() { return showInsertionPoint; }); |
1126 "toggleBlockMode": function() { return toggleBlockMode; }, |
1061 __webpack_require__.d(actions_namespaceObject, "hideInsertionPoint", function() { return hideInsertionPoint; }); |
1127 "toggleSelection": function() { return toggleSelection; }, |
1062 __webpack_require__.d(actions_namespaceObject, "setTemplateValidity", function() { return actions_setTemplateValidity; }); |
1128 "trashPost": function() { return trashPost; }, |
1063 __webpack_require__.d(actions_namespaceObject, "synchronizeTemplate", function() { return actions_synchronizeTemplate; }); |
1129 "undo": function() { return undo; }, |
1064 __webpack_require__.d(actions_namespaceObject, "mergeBlocks", function() { return mergeBlocks; }); |
1130 "unlockPostAutosaving": function() { return unlockPostAutosaving; }, |
1065 __webpack_require__.d(actions_namespaceObject, "removeBlocks", function() { return removeBlocks; }); |
1131 "unlockPostSaving": function() { return unlockPostSaving; }, |
1066 __webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return removeBlock; }); |
1132 "updateBlock": function() { return updateBlock; }, |
1067 __webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; }); |
1133 "updateBlockAttributes": function() { return updateBlockAttributes; }, |
1068 __webpack_require__.d(actions_namespaceObject, "startTyping", function() { return startTyping; }); |
1134 "updateBlockListSettings": function() { return updateBlockListSettings; }, |
1069 __webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return stopTyping; }); |
1135 "updateEditorSettings": function() { return updateEditorSettings; }, |
1070 __webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return enterFormattedText; }); |
1136 "updatePost": function() { return updatePost; }, |
1071 __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; }); |
1137 "updatePostLock": function() { return updatePostLock; } |
1072 __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return actions_insertDefaultBlock; }); |
1138 }); |
1073 __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return updateBlockListSettings; }); |
1139 |
1074 |
1140 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
1075 // EXTERNAL MODULE: external ["wp","blockEditor"] |
1141 function _extends() { |
1076 var external_wp_blockEditor_ = __webpack_require__("axFQ"); |
1142 _extends = Object.assign ? Object.assign.bind() : function (target) { |
1077 |
1143 for (var i = 1; i < arguments.length; i++) { |
1078 // EXTERNAL MODULE: external ["wp","coreData"] |
1144 var source = arguments[i]; |
1079 var external_wp_coreData_ = __webpack_require__("jZUy"); |
1145 |
1080 |
1146 for (var key in source) { |
1081 // EXTERNAL MODULE: external ["wp","richText"] |
1147 if (Object.prototype.hasOwnProperty.call(source, key)) { |
1082 var external_wp_richText_ = __webpack_require__("qRz9"); |
1148 target[key] = source[key]; |
1083 |
1149 } |
1084 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
1150 } |
1085 var esm_extends = __webpack_require__("wx14"); |
1151 } |
1086 |
1152 |
1087 // EXTERNAL MODULE: external ["wp","element"] |
1153 return target; |
1088 var external_wp_element_ = __webpack_require__("GRId"); |
1154 }; |
1089 |
1155 return _extends.apply(this, arguments); |
1090 // EXTERNAL MODULE: external "lodash" |
1156 } |
1091 var external_lodash_ = __webpack_require__("YLtl"); |
1157 ;// CONCATENATED MODULE: external ["wp","element"] |
1092 |
1158 var external_wp_element_namespaceObject = window["wp"]["element"]; |
1093 // EXTERNAL MODULE: external ["wp","blocks"] |
1159 ;// CONCATENATED MODULE: external "lodash" |
1094 var external_wp_blocks_ = __webpack_require__("HSyU"); |
1160 var external_lodash_namespaceObject = window["lodash"]; |
1095 |
1161 ;// CONCATENATED MODULE: external ["wp","blocks"] |
1096 // EXTERNAL MODULE: external ["wp","data"] |
1162 var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
1097 var external_wp_data_ = __webpack_require__("1ZqX"); |
1163 ;// CONCATENATED MODULE: external ["wp","data"] |
1098 |
1164 var external_wp_data_namespaceObject = window["wp"]["data"]; |
1099 // EXTERNAL MODULE: external ["wp","compose"] |
1165 ;// CONCATENATED MODULE: external ["wp","coreData"] |
1100 var external_wp_compose_ = __webpack_require__("K9lf"); |
1166 var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
1101 |
1167 ;// CONCATENATED MODULE: external ["wp","compose"] |
1102 // EXTERNAL MODULE: external ["wp","hooks"] |
1168 var external_wp_compose_namespaceObject = window["wp"]["compose"]; |
1103 var external_wp_hooks_ = __webpack_require__("g56x"); |
1169 ;// CONCATENATED MODULE: external ["wp","hooks"] |
1104 |
1170 var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; |
1105 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js |
1171 ;// CONCATENATED MODULE: external ["wp","blockEditor"] |
1106 |
1172 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
1107 |
1173 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js |
1108 |
|
1109 /** |
|
1110 * External dependencies |
|
1111 */ |
|
1112 |
|
1113 /** |
1174 /** |
1114 * WordPress dependencies |
1175 * WordPress dependencies |
1115 */ |
1176 */ |
1116 |
1177 |
1117 |
1178 /** |
1118 |
1179 * The default post editor settings. |
1119 |
1180 * |
1120 |
1181 * @property {boolean|Array} allowedBlockTypes Allowed block types |
1121 |
1182 * @property {boolean} richEditingEnabled Whether rich editing is enabled or not |
1122 |
1183 * @property {boolean} codeEditingEnabled Whether code editing is enabled or not |
1123 /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ |
1184 * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not. |
1124 |
1185 * true = the user has opted to show the Custom Fields panel at the bottom of the editor. |
1125 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ |
1186 * false = the user has opted to hide the Custom Fields panel at the bottom of the editor. |
1126 |
1187 * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed. |
1127 /** |
1188 * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API. |
1128 * Object whose keys are the names of block attributes, where each value |
1189 * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage. |
1129 * represents the meta key to which the block attribute is intended to save. |
1190 * @property {Array?} availableTemplates The available post templates |
1130 * |
1191 * @property {boolean} disablePostFormats Whether or not the post formats are disabled |
1131 * @see https://developer.wordpress.org/reference/functions/register_meta/ |
1192 * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions |
1132 * |
1193 * @property {number} maxUploadFileSize Maximum upload file size |
1133 * @typedef {Object<string,string>} WPMetaAttributeMapping |
1194 * @property {boolean} supportsLayout Whether the editor supports layouts. |
1134 */ |
1195 */ |
1135 |
1196 |
1136 /** |
1197 const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_namespaceObject.SETTINGS_DEFAULTS, |
1137 * Given a mapping of attribute names (meta source attributes) to their |
|
1138 * associated meta key, returns a higher order component that overrides its |
|
1139 * `attributes` and `setAttributes` props to sync any changes with the edited |
|
1140 * post's meta keys. |
|
1141 * |
|
1142 * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. |
|
1143 * |
|
1144 * @return {WPHigherOrderComponent} Higher-order component. |
|
1145 */ |
|
1146 |
|
1147 const createWithMetaAttributeSource = metaAttributes => Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => ({ |
|
1148 attributes, |
|
1149 setAttributes, |
|
1150 ...props |
|
1151 }) => { |
|
1152 const postType = Object(external_wp_data_["useSelect"])(select => select('core/editor').getCurrentPostType(), []); |
|
1153 const [meta, setMeta] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'meta'); |
|
1154 const mergedAttributes = Object(external_wp_element_["useMemo"])(() => ({ ...attributes, |
|
1155 ...Object(external_lodash_["mapValues"])(metaAttributes, metaKey => meta[metaKey]) |
|
1156 }), [attributes, meta]); |
|
1157 return Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({ |
|
1158 attributes: mergedAttributes, |
|
1159 setAttributes: nextAttributes => { |
|
1160 const nextMeta = Object(external_lodash_["mapKeys"])( // Filter to intersection of keys between the updated |
|
1161 // attributes and those with an associated meta key. |
|
1162 Object(external_lodash_["pickBy"])(nextAttributes, (value, key) => metaAttributes[key]), // Rename the keys to the expected meta key name. |
|
1163 (value, attributeKey) => metaAttributes[attributeKey]); |
|
1164 |
|
1165 if (!Object(external_lodash_["isEmpty"])(nextMeta)) { |
|
1166 setMeta(nextMeta); |
|
1167 } |
|
1168 |
|
1169 setAttributes(nextAttributes); |
|
1170 } |
|
1171 }, props)); |
|
1172 }, 'withMetaAttributeSource'); |
|
1173 /** |
|
1174 * Filters a registered block's settings to enhance a block's `edit` component |
|
1175 * to upgrade meta-sourced attributes to use the post's meta entity property. |
|
1176 * |
|
1177 * @param {WPBlockSettings} settings Registered block settings. |
|
1178 * |
|
1179 * @return {WPBlockSettings} Filtered block settings. |
|
1180 */ |
|
1181 |
|
1182 |
|
1183 function shimAttributeSource(settings) { |
|
1184 /** @type {WPMetaAttributeMapping} */ |
|
1185 const metaAttributes = Object(external_lodash_["mapValues"])(Object(external_lodash_["pickBy"])(settings.attributes, { |
|
1186 source: 'meta' |
|
1187 }), 'meta'); |
|
1188 |
|
1189 if (!Object(external_lodash_["isEmpty"])(metaAttributes)) { |
|
1190 settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit); |
|
1191 } |
|
1192 |
|
1193 return settings; |
|
1194 } |
|
1195 |
|
1196 Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); // The above filter will only capture blocks registered after the filter was |
|
1197 // added. There may already be blocks registered by this point, and those must |
|
1198 // be updated to apply the shim. |
|
1199 // |
|
1200 // The following implementation achieves this, albeit with a couple caveats: |
|
1201 // - Only blocks registered on the global store will be modified. |
|
1202 // - The block settings are directly mutated, since there is currently no |
|
1203 // mechanism to update an existing block registration. This is the reason for |
|
1204 // `getBlockType` separate from `getBlockTypes`, since the latter returns a |
|
1205 // _copy_ of the block registration (i.e. the mutation would not affect the |
|
1206 // actual registered block settings). |
|
1207 // |
|
1208 // `getBlockTypes` or `getBlockType` implementation could change in the future |
|
1209 // in regards to creating settings clones, but the corresponding end-to-end |
|
1210 // tests for meta blocks should cover against any potential regressions. |
|
1211 // |
|
1212 // In the future, we could support updating block settings, at which point this |
|
1213 // implementation could use that mechanism instead. |
|
1214 |
|
1215 Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getBlockTypes().map(({ |
|
1216 name |
|
1217 }) => Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getBlockType(name)).forEach(shimAttributeSource); |
|
1218 |
|
1219 // EXTERNAL MODULE: external ["wp","apiFetch"] |
|
1220 var external_wp_apiFetch_ = __webpack_require__("ywyh"); |
|
1221 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_); |
|
1222 |
|
1223 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js |
|
1224 |
|
1225 |
|
1226 /** |
|
1227 * WordPress dependencies |
|
1228 */ |
|
1229 |
|
1230 /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ |
|
1231 |
|
1232 /** |
|
1233 * A user mentions completer. |
|
1234 * |
|
1235 * @type {WPCompleter} |
|
1236 */ |
|
1237 |
|
1238 /* harmony default export */ var autocompleters_user = ({ |
|
1239 name: 'users', |
|
1240 className: 'editor-autocompleters__user', |
|
1241 triggerPrefix: '@', |
|
1242 |
|
1243 options(search) { |
|
1244 let payload = ''; |
|
1245 |
|
1246 if (search) { |
|
1247 payload = '?search=' + encodeURIComponent(search); |
|
1248 } |
|
1249 |
|
1250 return external_wp_apiFetch_default()({ |
|
1251 path: '/wp/v2/users' + payload |
|
1252 }); |
|
1253 }, |
|
1254 |
|
1255 isDebounced: true, |
|
1256 |
|
1257 getOptionKeywords(user) { |
|
1258 return [user.slug, user.name]; |
|
1259 }, |
|
1260 |
|
1261 getOptionLabel(user) { |
|
1262 const avatar = user.avatar_urls && user.avatar_urls[24] ? Object(external_wp_element_["createElement"])("img", { |
|
1263 key: "avatar", |
|
1264 className: "editor-autocompleters__user-avatar", |
|
1265 alt: "", |
|
1266 src: user.avatar_urls[24] |
|
1267 }) : Object(external_wp_element_["createElement"])("span", { |
|
1268 className: "editor-autocompleters__no-avatar" |
|
1269 }); |
|
1270 return [avatar, Object(external_wp_element_["createElement"])("span", { |
|
1271 key: "name", |
|
1272 className: "editor-autocompleters__user-name" |
|
1273 }, user.name), Object(external_wp_element_["createElement"])("span", { |
|
1274 key: "slug", |
|
1275 className: "editor-autocompleters__user-slug" |
|
1276 }, user.slug)]; |
|
1277 }, |
|
1278 |
|
1279 getOptionCompletion(user) { |
|
1280 return `@${user.slug}`; |
|
1281 } |
|
1282 |
|
1283 }); |
|
1284 |
|
1285 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js |
|
1286 /** |
|
1287 * External dependencies |
|
1288 */ |
|
1289 |
|
1290 /** |
|
1291 * WordPress dependencies |
|
1292 */ |
|
1293 |
|
1294 |
|
1295 /** |
|
1296 * Internal dependencies |
|
1297 */ |
|
1298 |
|
1299 |
|
1300 |
|
1301 function setDefaultCompleters(completers = []) { |
|
1302 // Provide copies so filters may directly modify them. |
|
1303 completers.push(Object(external_lodash_["clone"])(autocompleters_user)); |
|
1304 return completers; |
|
1305 } |
|
1306 |
|
1307 Object(external_wp_hooks_["addFilter"])('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); |
|
1308 |
|
1309 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js |
|
1310 /** |
|
1311 * Internal dependencies |
|
1312 */ |
|
1313 |
|
1314 |
|
1315 |
|
1316 // EXTERNAL MODULE: external ["wp","dataControls"] |
|
1317 var external_wp_dataControls_ = __webpack_require__("51Zz"); |
|
1318 |
|
1319 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js |
|
1320 /** |
|
1321 * WordPress dependencies |
|
1322 */ |
|
1323 |
|
1324 const PREFERENCES_DEFAULTS = { |
|
1325 insertUsage: {}, |
|
1326 // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580. |
|
1327 isPublishSidebarEnabled: true |
|
1328 }; |
|
1329 /** |
|
1330 * The default post editor settings |
|
1331 * |
|
1332 * allowedBlockTypes boolean|Array Allowed block types |
|
1333 * richEditingEnabled boolean Whether rich editing is enabled or not |
|
1334 * codeEditingEnabled boolean Whether code editing is enabled or not |
|
1335 * enableCustomFields boolean Whether the WordPress custom fields are enabled or not |
|
1336 * autosaveInterval number Autosave Interval |
|
1337 * availableTemplates array? The available post templates |
|
1338 * disablePostFormats boolean Whether or not the post formats are disabled |
|
1339 * allowedMimeTypes array? List of allowed mime types and file extensions |
|
1340 * maxUploadFileSize number Maximum upload file size |
|
1341 * supportsLayout boolean Whether the editor supports layouts. |
|
1342 */ |
|
1343 |
|
1344 const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_["SETTINGS_DEFAULTS"], |
|
1345 richEditingEnabled: true, |
1198 richEditingEnabled: true, |
1346 codeEditingEnabled: true, |
1199 codeEditingEnabled: true, |
1347 enableCustomFields: false, |
1200 enableCustomFields: undefined, |
1348 supportsLayout: true |
1201 supportsLayout: true |
1349 }; |
1202 }; |
1350 |
1203 |
1351 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js |
1204 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js |
1352 /** |
1205 /** |
1353 * External dependencies |
1206 * External dependencies |
1354 */ |
1207 */ |
1355 |
1208 |
1356 /** |
1209 /** |
1388 * |
1241 * |
1389 * @return {boolean} Whether the two objects have the same keys. |
1242 * @return {boolean} Whether the two objects have the same keys. |
1390 */ |
1243 */ |
1391 |
1244 |
1392 function hasSameKeys(a, b) { |
1245 function hasSameKeys(a, b) { |
1393 return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b)); |
1246 return isEqual(keys(a), keys(b)); |
1394 } |
1247 } |
1395 /** |
1248 /** |
1396 * Returns true if, given the currently dispatching action and the previously |
1249 * Returns true if, given the currently dispatching action and the previously |
1397 * dispatched action, the two actions are editing the same post property, or |
1250 * dispatched action, the two actions are editing the same post property, or |
1398 * false otherwise. |
1251 * false otherwise. |
1426 return false; |
1279 return false; |
1427 } |
1280 } |
1428 |
1281 |
1429 return isUpdatingSamePostProperty(action, previousAction); |
1282 return isUpdatingSamePostProperty(action, previousAction); |
1430 } |
1283 } |
1431 function reducer_postId(state = null, action) { |
1284 function postId() { |
1285 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
|
1286 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1287 |
|
1432 switch (action.type) { |
1288 switch (action.type) { |
1433 case 'SETUP_EDITOR_STATE': |
1289 case 'SETUP_EDITOR_STATE': |
1434 case 'RESET_POST': |
|
1435 return action.post.id; |
1290 return action.post.id; |
1436 } |
1291 } |
1437 |
1292 |
1438 return state; |
1293 return state; |
1439 } |
1294 } |
1440 function reducer_postType(state = null, action) { |
1295 function postType() { |
1296 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; |
|
1297 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1298 |
|
1441 switch (action.type) { |
1299 switch (action.type) { |
1442 case 'SETUP_EDITOR_STATE': |
1300 case 'SETUP_EDITOR_STATE': |
1443 case 'RESET_POST': |
|
1444 return action.post.type; |
1301 return action.post.type; |
1445 } |
1302 } |
1446 |
1303 |
1447 return state; |
1304 return state; |
1448 } |
1305 } |
1453 * @param {Object} action Dispatched action. |
1310 * @param {Object} action Dispatched action. |
1454 * |
1311 * |
1455 * @return {boolean} Updated state. |
1312 * @return {boolean} Updated state. |
1456 */ |
1313 */ |
1457 |
1314 |
1458 function reducer_template(state = { |
1315 function template() { |
1459 isValid: true |
1316 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
1460 }, action) { |
1317 isValid: true |
1318 }; |
|
1319 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1320 |
|
1461 switch (action.type) { |
1321 switch (action.type) { |
1462 case 'SET_TEMPLATE_VALIDITY': |
1322 case 'SET_TEMPLATE_VALIDITY': |
1463 return { ...state, |
1323 return { ...state, |
1464 isValid: action.isValid |
1324 isValid: action.isValid |
1465 }; |
1325 }; |
1466 } |
1326 } |
1467 |
1327 |
1468 return state; |
1328 return state; |
1469 } |
1329 } |
1470 /** |
1330 /** |
1471 * Reducer returning the user preferences. |
|
1472 * |
|
1473 * @param {Object} state Current state. |
|
1474 * @param {Object} action Dispatched action. |
|
1475 * |
|
1476 * @return {string} Updated state. |
|
1477 */ |
|
1478 |
|
1479 function preferences(state = PREFERENCES_DEFAULTS, action) { |
|
1480 switch (action.type) { |
|
1481 case 'ENABLE_PUBLISH_SIDEBAR': |
|
1482 return { ...state, |
|
1483 isPublishSidebarEnabled: true |
|
1484 }; |
|
1485 |
|
1486 case 'DISABLE_PUBLISH_SIDEBAR': |
|
1487 return { ...state, |
|
1488 isPublishSidebarEnabled: false |
|
1489 }; |
|
1490 } |
|
1491 |
|
1492 return state; |
|
1493 } |
|
1494 /** |
|
1495 * Reducer returning current network request state (whether a request to |
1331 * Reducer returning current network request state (whether a request to |
1496 * the WP REST API is in progress, successful, or failed). |
1332 * the WP REST API is in progress, successful, or failed). |
1497 * |
1333 * |
1498 * @param {Object} state Current state. |
1334 * @param {Object} state Current state. |
1499 * @param {Object} action Dispatched action. |
1335 * @param {Object} action Dispatched action. |
1500 * |
1336 * |
1501 * @return {Object} Updated state. |
1337 * @return {Object} Updated state. |
1502 */ |
1338 */ |
1503 |
1339 |
1504 function saving(state = {}, action) { |
1340 function saving() { |
1341 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
1342 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1343 |
|
1505 switch (action.type) { |
1344 switch (action.type) { |
1506 case 'REQUEST_POST_UPDATE_START': |
1345 case 'REQUEST_POST_UPDATE_START': |
1507 case 'REQUEST_POST_UPDATE_FINISH': |
1346 case 'REQUEST_POST_UPDATE_FINISH': |
1508 return { |
1347 return { |
1509 pending: action.type === 'REQUEST_POST_UPDATE_START', |
1348 pending: action.type === 'REQUEST_POST_UPDATE_START', |
1516 /** |
1355 /** |
1517 * Post Lock State. |
1356 * Post Lock State. |
1518 * |
1357 * |
1519 * @typedef {Object} PostLockState |
1358 * @typedef {Object} PostLockState |
1520 * |
1359 * |
1521 * @property {boolean} isLocked Whether the post is locked. |
1360 * @property {boolean} isLocked Whether the post is locked. |
1522 * @property {?boolean} isTakeover Whether the post editing has been taken over. |
1361 * @property {?boolean} isTakeover Whether the post editing has been taken over. |
1523 * @property {?boolean} activePostLock Active post lock value. |
1362 * @property {?boolean} activePostLock Active post lock value. |
1524 * @property {?Object} user User that took over the post. |
1363 * @property {?Object} user User that took over the post. |
1525 */ |
1364 */ |
1526 |
1365 |
1527 /** |
1366 /** |
1528 * Reducer returning the post lock status. |
1367 * Reducer returning the post lock status. |
1529 * |
1368 * |
1530 * @param {PostLockState} state Current state. |
1369 * @param {PostLockState} state Current state. |
1531 * @param {Object} action Dispatched action. |
1370 * @param {Object} action Dispatched action. |
1532 * |
1371 * |
1533 * @return {PostLockState} Updated state. |
1372 * @return {PostLockState} Updated state. |
1534 */ |
1373 */ |
1535 |
1374 |
1536 function postLock(state = { |
1375 function postLock() { |
1537 isLocked: false |
1376 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { |
1538 }, action) { |
1377 isLocked: false |
1378 }; |
|
1379 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1380 |
|
1539 switch (action.type) { |
1381 switch (action.type) { |
1540 case 'UPDATE_POST_LOCK': |
1382 case 'UPDATE_POST_LOCK': |
1541 return action.lock; |
1383 return action.lock; |
1542 } |
1384 } |
1543 |
1385 |
1552 * @param {Object} action Dispatched action. |
1394 * @param {Object} action Dispatched action. |
1553 * |
1395 * |
1554 * @return {PostLockState} Updated state. |
1396 * @return {PostLockState} Updated state. |
1555 */ |
1397 */ |
1556 |
1398 |
1557 function postSavingLock(state = {}, action) { |
1399 function postSavingLock() { |
1400 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
1401 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1402 |
|
1558 switch (action.type) { |
1403 switch (action.type) { |
1559 case 'LOCK_POST_SAVING': |
1404 case 'LOCK_POST_SAVING': |
1560 return { ...state, |
1405 return { ...state, |
1561 [action.lockName]: true |
1406 [action.lockName]: true |
1562 }; |
1407 }; |
1563 |
1408 |
1564 case 'UNLOCK_POST_SAVING': |
1409 case 'UNLOCK_POST_SAVING': |
1565 return Object(external_lodash_["omit"])(state, action.lockName); |
1410 return (0,external_lodash_namespaceObject.omit)(state, action.lockName); |
1566 } |
1411 } |
1567 |
1412 |
1568 return state; |
1413 return state; |
1569 } |
1414 } |
1570 /** |
1415 /** |
1576 * @param {Object} action Dispatched action. |
1421 * @param {Object} action Dispatched action. |
1577 * |
1422 * |
1578 * @return {PostLockState} Updated state. |
1423 * @return {PostLockState} Updated state. |
1579 */ |
1424 */ |
1580 |
1425 |
1581 function postAutosavingLock(state = {}, action) { |
1426 function postAutosavingLock() { |
1427 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
1428 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1429 |
|
1582 switch (action.type) { |
1430 switch (action.type) { |
1583 case 'LOCK_POST_AUTOSAVING': |
1431 case 'LOCK_POST_AUTOSAVING': |
1584 return { ...state, |
1432 return { ...state, |
1585 [action.lockName]: true |
1433 [action.lockName]: true |
1586 }; |
1434 }; |
1587 |
1435 |
1588 case 'UNLOCK_POST_AUTOSAVING': |
1436 case 'UNLOCK_POST_AUTOSAVING': |
1589 return Object(external_lodash_["omit"])(state, action.lockName); |
1437 return (0,external_lodash_namespaceObject.omit)(state, action.lockName); |
1590 } |
1438 } |
1591 |
1439 |
1592 return state; |
1440 return state; |
1593 } |
1441 } |
1594 /** |
1442 /** |
1595 * Reducer returning whether the editor is ready to be rendered. |
1443 * Reducer returning whether the editor is ready to be rendered. |
1596 * The editor is considered ready to be rendered once |
1444 * The editor is considered ready to be rendered once |
1597 * the post object is loaded properly and the initial blocks parsed. |
1445 * the post object is loaded properly and the initial blocks parsed. |
1598 * |
1446 * |
1599 * @param {boolean} state |
1447 * @param {boolean} state |
1600 * @param {Object} action |
1448 * @param {Object} action |
1601 * |
1449 * |
1602 * @return {boolean} Updated state. |
1450 * @return {boolean} Updated state. |
1603 */ |
1451 */ |
1604 |
1452 |
1605 function reducer_isReady(state = false, action) { |
1453 function isReady() { |
1454 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; |
|
1455 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1456 |
|
1606 switch (action.type) { |
1457 switch (action.type) { |
1607 case 'SETUP_EDITOR_STATE': |
1458 case 'SETUP_EDITOR_STATE': |
1608 return true; |
1459 return true; |
1609 |
1460 |
1610 case 'TEAR_DOWN_EDITOR': |
1461 case 'TEAR_DOWN_EDITOR': |
1620 * @param {Object} action Dispatched action. |
1471 * @param {Object} action Dispatched action. |
1621 * |
1472 * |
1622 * @return {Object} Updated state. |
1473 * @return {Object} Updated state. |
1623 */ |
1474 */ |
1624 |
1475 |
1625 function reducer_editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) { |
1476 function editorSettings() { |
1477 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : EDITOR_SETTINGS_DEFAULTS; |
|
1478 let action = arguments.length > 1 ? arguments[1] : undefined; |
|
1479 |
|
1626 switch (action.type) { |
1480 switch (action.type) { |
1627 case 'UPDATE_EDITOR_SETTINGS': |
1481 case 'UPDATE_EDITOR_SETTINGS': |
1628 return { ...state, |
1482 return { ...state, |
1629 ...action.settings |
1483 ...action.settings |
1630 }; |
1484 }; |
1631 } |
1485 } |
1632 |
1486 |
1633 return state; |
1487 return state; |
1634 } |
1488 } |
1635 /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({ |
1489 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
1636 postId: reducer_postId, |
1490 postId, |
1637 postType: reducer_postType, |
1491 postType, |
1638 preferences, |
|
1639 saving, |
1492 saving, |
1640 postLock, |
1493 postLock, |
1641 template: reducer_template, |
1494 template, |
1642 postSavingLock, |
1495 postSavingLock, |
1643 isReady: reducer_isReady, |
1496 isReady, |
1644 editorSettings: reducer_editorSettings, |
1497 editorSettings, |
1645 postAutosavingLock |
1498 postAutosavingLock |
1646 })); |
1499 })); |
1647 |
1500 |
1648 // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js |
1501 ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js |
1649 var rememo = __webpack_require__("pPDe"); |
1502 |
1650 |
1503 |
1651 // EXTERNAL MODULE: external ["wp","date"] |
1504 var LEAF_KEY, hasWeakMap; |
1652 var external_wp_date_ = __webpack_require__("FqII"); |
1505 |
1653 |
1506 /** |
1654 // EXTERNAL MODULE: external ["wp","url"] |
1507 * Arbitrary value used as key for referencing cache object in WeakMap tree. |
1655 var external_wp_url_ = __webpack_require__("Mmq9"); |
1508 * |
1656 |
1509 * @type {Object} |
1657 // EXTERNAL MODULE: external ["wp","deprecated"] |
1510 */ |
1658 var external_wp_deprecated_ = __webpack_require__("NMb1"); |
1511 LEAF_KEY = {}; |
1659 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_); |
1512 |
1660 |
1513 /** |
1661 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js |
1514 * Whether environment supports WeakMap. |
1662 var layout = __webpack_require__("Civd"); |
1515 * |
1663 |
1516 * @type {boolean} |
1664 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js |
1517 */ |
1518 hasWeakMap = typeof WeakMap !== 'undefined'; |
|
1519 |
|
1520 /** |
|
1521 * Returns the first argument as the sole entry in an array. |
|
1522 * |
|
1523 * @param {*} value Value to return. |
|
1524 * |
|
1525 * @return {Array} Value returned as entry in array. |
|
1526 */ |
|
1527 function arrayOf( value ) { |
|
1528 return [ value ]; |
|
1529 } |
|
1530 |
|
1531 /** |
|
1532 * Returns true if the value passed is object-like, or false otherwise. A value |
|
1533 * is object-like if it can support property assignment, e.g. object or array. |
|
1534 * |
|
1535 * @param {*} value Value to test. |
|
1536 * |
|
1537 * @return {boolean} Whether value is object-like. |
|
1538 */ |
|
1539 function isObjectLike( value ) { |
|
1540 return !! value && 'object' === typeof value; |
|
1541 } |
|
1542 |
|
1543 /** |
|
1544 * Creates and returns a new cache object. |
|
1545 * |
|
1546 * @return {Object} Cache object. |
|
1547 */ |
|
1548 function createCache() { |
|
1549 var cache = { |
|
1550 clear: function() { |
|
1551 cache.head = null; |
|
1552 }, |
|
1553 }; |
|
1554 |
|
1555 return cache; |
|
1556 } |
|
1557 |
|
1558 /** |
|
1559 * Returns true if entries within the two arrays are strictly equal by |
|
1560 * reference from a starting index. |
|
1561 * |
|
1562 * @param {Array} a First array. |
|
1563 * @param {Array} b Second array. |
|
1564 * @param {number} fromIndex Index from which to start comparison. |
|
1565 * |
|
1566 * @return {boolean} Whether arrays are shallowly equal. |
|
1567 */ |
|
1568 function isShallowEqual( a, b, fromIndex ) { |
|
1569 var i; |
|
1570 |
|
1571 if ( a.length !== b.length ) { |
|
1572 return false; |
|
1573 } |
|
1574 |
|
1575 for ( i = fromIndex; i < a.length; i++ ) { |
|
1576 if ( a[ i ] !== b[ i ] ) { |
|
1577 return false; |
|
1578 } |
|
1579 } |
|
1580 |
|
1581 return true; |
|
1582 } |
|
1583 |
|
1584 /** |
|
1585 * Returns a memoized selector function. The getDependants function argument is |
|
1586 * called before the memoized selector and is expected to return an immutable |
|
1587 * reference or array of references on which the selector depends for computing |
|
1588 * its own return value. The memoize cache is preserved only as long as those |
|
1589 * dependant references remain the same. If getDependants returns a different |
|
1590 * reference(s), the cache is cleared and the selector value regenerated. |
|
1591 * |
|
1592 * @param {Function} selector Selector function. |
|
1593 * @param {Function} getDependants Dependant getter returning an immutable |
|
1594 * reference or array of reference used in |
|
1595 * cache bust consideration. |
|
1596 * |
|
1597 * @return {Function} Memoized selector. |
|
1598 */ |
|
1599 /* harmony default export */ function rememo(selector, getDependants ) { |
|
1600 var rootCache, getCache; |
|
1601 |
|
1602 // Use object source as dependant if getter not provided |
|
1603 if ( ! getDependants ) { |
|
1604 getDependants = arrayOf; |
|
1605 } |
|
1606 |
|
1607 /** |
|
1608 * Returns the root cache. If WeakMap is supported, this is assigned to the |
|
1609 * root WeakMap cache set, otherwise it is a shared instance of the default |
|
1610 * cache object. |
|
1611 * |
|
1612 * @return {(WeakMap|Object)} Root cache object. |
|
1613 */ |
|
1614 function getRootCache() { |
|
1615 return rootCache; |
|
1616 } |
|
1617 |
|
1618 /** |
|
1619 * Returns the cache for a given dependants array. When possible, a WeakMap |
|
1620 * will be used to create a unique cache for each set of dependants. This |
|
1621 * is feasible due to the nature of WeakMap in allowing garbage collection |
|
1622 * to occur on entries where the key object is no longer referenced. Since |
|
1623 * WeakMap requires the key to be an object, this is only possible when the |
|
1624 * dependant is object-like. The root cache is created as a hierarchy where |
|
1625 * each top-level key is the first entry in a dependants set, the value a |
|
1626 * WeakMap where each key is the next dependant, and so on. This continues |
|
1627 * so long as the dependants are object-like. If no dependants are object- |
|
1628 * like, then the cache is shared across all invocations. |
|
1629 * |
|
1630 * @see isObjectLike |
|
1631 * |
|
1632 * @param {Array} dependants Selector dependants. |
|
1633 * |
|
1634 * @return {Object} Cache object. |
|
1635 */ |
|
1636 function getWeakMapCache( dependants ) { |
|
1637 var caches = rootCache, |
|
1638 isUniqueByDependants = true, |
|
1639 i, dependant, map, cache; |
|
1640 |
|
1641 for ( i = 0; i < dependants.length; i++ ) { |
|
1642 dependant = dependants[ i ]; |
|
1643 |
|
1644 // Can only compose WeakMap from object-like key. |
|
1645 if ( ! isObjectLike( dependant ) ) { |
|
1646 isUniqueByDependants = false; |
|
1647 break; |
|
1648 } |
|
1649 |
|
1650 // Does current segment of cache already have a WeakMap? |
|
1651 if ( caches.has( dependant ) ) { |
|
1652 // Traverse into nested WeakMap. |
|
1653 caches = caches.get( dependant ); |
|
1654 } else { |
|
1655 // Create, set, and traverse into a new one. |
|
1656 map = new WeakMap(); |
|
1657 caches.set( dependant, map ); |
|
1658 caches = map; |
|
1659 } |
|
1660 } |
|
1661 |
|
1662 // We use an arbitrary (but consistent) object as key for the last item |
|
1663 // in the WeakMap to serve as our running cache. |
|
1664 if ( ! caches.has( LEAF_KEY ) ) { |
|
1665 cache = createCache(); |
|
1666 cache.isUniqueByDependants = isUniqueByDependants; |
|
1667 caches.set( LEAF_KEY, cache ); |
|
1668 } |
|
1669 |
|
1670 return caches.get( LEAF_KEY ); |
|
1671 } |
|
1672 |
|
1673 // Assign cache handler by availability of WeakMap |
|
1674 getCache = hasWeakMap ? getWeakMapCache : getRootCache; |
|
1675 |
|
1676 /** |
|
1677 * Resets root memoization cache. |
|
1678 */ |
|
1679 function clear() { |
|
1680 rootCache = hasWeakMap ? new WeakMap() : createCache(); |
|
1681 } |
|
1682 |
|
1683 // eslint-disable-next-line jsdoc/check-param-names |
|
1684 /** |
|
1685 * The augmented selector call, considering first whether dependants have |
|
1686 * changed before passing it to underlying memoize function. |
|
1687 * |
|
1688 * @param {Object} source Source object for derivation. |
|
1689 * @param {...*} extraArgs Additional arguments to pass to selector. |
|
1690 * |
|
1691 * @return {*} Selector result. |
|
1692 */ |
|
1693 function callSelector( /* source, ...extraArgs */ ) { |
|
1694 var len = arguments.length, |
|
1695 cache, node, i, args, dependants; |
|
1696 |
|
1697 // Create copy of arguments (avoid leaking deoptimization). |
|
1698 args = new Array( len ); |
|
1699 for ( i = 0; i < len; i++ ) { |
|
1700 args[ i ] = arguments[ i ]; |
|
1701 } |
|
1702 |
|
1703 dependants = getDependants.apply( null, args ); |
|
1704 cache = getCache( dependants ); |
|
1705 |
|
1706 // If not guaranteed uniqueness by dependants (primitive type or lack |
|
1707 // of WeakMap support), shallow compare against last dependants and, if |
|
1708 // references have changed, destroy cache to recalculate result. |
|
1709 if ( ! cache.isUniqueByDependants ) { |
|
1710 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { |
|
1711 cache.clear(); |
|
1712 } |
|
1713 |
|
1714 cache.lastDependants = dependants; |
|
1715 } |
|
1716 |
|
1717 node = cache.head; |
|
1718 while ( node ) { |
|
1719 // Check whether node arguments match arguments |
|
1720 if ( ! isShallowEqual( node.args, args, 1 ) ) { |
|
1721 node = node.next; |
|
1722 continue; |
|
1723 } |
|
1724 |
|
1725 // At this point we can assume we've found a match |
|
1726 |
|
1727 // Surface matched node to head if not already |
|
1728 if ( node !== cache.head ) { |
|
1729 // Adjust siblings to point to each other. |
|
1730 node.prev.next = node.next; |
|
1731 if ( node.next ) { |
|
1732 node.next.prev = node.prev; |
|
1733 } |
|
1734 |
|
1735 node.next = cache.head; |
|
1736 node.prev = null; |
|
1737 cache.head.prev = node; |
|
1738 cache.head = node; |
|
1739 } |
|
1740 |
|
1741 // Return immediately |
|
1742 return node.val; |
|
1743 } |
|
1744 |
|
1745 // No cached value found. Continue to insertion phase: |
|
1746 |
|
1747 node = { |
|
1748 // Generate the result from original function |
|
1749 val: selector.apply( null, args ), |
|
1750 }; |
|
1751 |
|
1752 // Avoid including the source object in the cache. |
|
1753 args[ 0 ] = null; |
|
1754 node.args = args; |
|
1755 |
|
1756 // Don't need to check whether node is already head, since it would |
|
1757 // have been returned above already if it was |
|
1758 |
|
1759 // Shift existing head down list |
|
1760 if ( cache.head ) { |
|
1761 cache.head.prev = node; |
|
1762 node.next = cache.head; |
|
1763 } |
|
1764 |
|
1765 cache.head = node; |
|
1766 |
|
1767 return node.val; |
|
1768 } |
|
1769 |
|
1770 callSelector.getDependants = getDependants; |
|
1771 callSelector.clear = clear; |
|
1772 clear(); |
|
1773 |
|
1774 return callSelector; |
|
1775 } |
|
1776 |
|
1777 ;// CONCATENATED MODULE: external ["wp","date"] |
|
1778 var external_wp_date_namespaceObject = window["wp"]["date"]; |
|
1779 ;// CONCATENATED MODULE: external ["wp","url"] |
|
1780 var external_wp_url_namespaceObject = window["wp"]["url"]; |
|
1781 ;// CONCATENATED MODULE: external ["wp","deprecated"] |
|
1782 var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; |
|
1783 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); |
|
1784 ;// CONCATENATED MODULE: external ["wp","primitives"] |
|
1785 var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
1786 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js |
|
1787 |
|
1788 |
|
1789 /** |
|
1790 * WordPress dependencies |
|
1791 */ |
|
1792 |
|
1793 const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1794 xmlns: "http://www.w3.org/2000/svg", |
|
1795 viewBox: "0 0 24 24" |
|
1796 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1797 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" |
|
1798 })); |
|
1799 /* harmony default export */ var library_layout = (layout); |
|
1800 |
|
1801 ;// CONCATENATED MODULE: external ["wp","preferences"] |
|
1802 var external_wp_preferences_namespaceObject = window["wp"]["preferences"]; |
|
1803 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js |
|
1665 /** |
1804 /** |
1666 * Set of post properties for which edits should assume a merging behavior, |
1805 * Set of post properties for which edits should assume a merging behavior, |
1667 * assuming an object value. |
1806 * assuming an object value. |
1668 * |
1807 * |
1669 * @type {Set} |
1808 * @type {Set} |
1680 const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; |
1819 const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID'; |
1681 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; |
1820 const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/; |
1682 const ONE_MINUTE_IN_MS = 60 * 1000; |
1821 const ONE_MINUTE_IN_MS = 60 * 1000; |
1683 const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; |
1822 const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content']; |
1684 |
1823 |
1685 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js |
1824 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js |
1686 /** |
1825 |
1687 * External dependencies |
|
1688 */ |
|
1689 |
1826 |
1690 /** |
1827 /** |
1691 * WordPress dependencies |
1828 * WordPress dependencies |
1692 */ |
1829 */ |
1693 |
1830 |
1694 |
1831 const header = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
1695 /** |
|
1696 * Returns the URL of a WPAdmin Page. |
|
1697 * |
|
1698 * TODO: This should be moved to a module less specific to the editor. |
|
1699 * |
|
1700 * @param {string} page Page to navigate to. |
|
1701 * @param {Object} query Query Args. |
|
1702 * |
|
1703 * @return {string} WPAdmin URL. |
|
1704 */ |
|
1705 |
|
1706 function getWPAdminURL(page, query) { |
|
1707 return Object(external_wp_url_["addQueryArgs"])(page, query); |
|
1708 } |
|
1709 /** |
|
1710 * Performs some basic cleanup of a string for use as a post slug |
|
1711 * |
|
1712 * This replicates some of what sanitize_title() does in WordPress core, but |
|
1713 * is only designed to approximate what the slug will be. |
|
1714 * |
|
1715 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters. |
|
1716 * Removes combining diacritical marks. Converts whitespace, periods, |
|
1717 * and forward slashes to hyphens. Removes any remaining non-word characters |
|
1718 * except hyphens and underscores. Converts remaining string to lowercase. |
|
1719 * It does not account for octets, HTML entities, or other encoded characters. |
|
1720 * |
|
1721 * @param {string} string Title or slug to be processed |
|
1722 * |
|
1723 * @return {string} Processed string |
|
1724 */ |
|
1725 |
|
1726 function cleanForSlug(string) { |
|
1727 if (!string) { |
|
1728 return ''; |
|
1729 } |
|
1730 |
|
1731 return Object(external_lodash_["trim"])(Object(external_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\p{L}\p{N}_-]+/gu, '').toLowerCase(), '-'); |
|
1732 } |
|
1733 |
|
1734 // EXTERNAL MODULE: external ["wp","primitives"] |
|
1735 var external_wp_primitives_ = __webpack_require__("Tqx9"); |
|
1736 |
|
1737 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js |
|
1738 |
|
1739 |
|
1740 /** |
|
1741 * WordPress dependencies |
|
1742 */ |
|
1743 |
|
1744 const header = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { |
|
1745 xmlns: "http://www.w3.org/2000/svg", |
1832 xmlns: "http://www.w3.org/2000/svg", |
1746 viewBox: "0 0 24 24" |
1833 viewBox: "0 0 24 24" |
1747 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { |
1834 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
1748 d: "M18.5 10.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" |
1835 d: "M18.5 10.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" |
1749 })); |
1836 })); |
1750 /* harmony default export */ var library_header = (header); |
1837 /* harmony default export */ var library_header = (header); |
1751 |
1838 |
1752 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js |
1839 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js |
1753 |
1840 |
1754 |
1841 |
1755 /** |
1842 /** |
1756 * WordPress dependencies |
1843 * WordPress dependencies |
1757 */ |
1844 */ |
1758 |
1845 |
1759 const footer = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { |
1846 const footer = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
1760 xmlns: "http://www.w3.org/2000/svg", |
1847 xmlns: "http://www.w3.org/2000/svg", |
1761 viewBox: "0 0 24 24" |
1848 viewBox: "0 0 24 24" |
1762 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { |
1849 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
1763 fillRule: "evenodd", |
1850 fillRule: "evenodd", |
1764 d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" |
1851 d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" |
1765 })); |
1852 })); |
1766 /* harmony default export */ var library_footer = (footer); |
1853 /* harmony default export */ var library_footer = (footer); |
1767 |
1854 |
1768 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js |
1855 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js |
1769 |
1856 |
1770 |
1857 |
1771 /** |
1858 /** |
1772 * WordPress dependencies |
1859 * WordPress dependencies |
1773 */ |
1860 */ |
1774 |
1861 |
1775 const sidebar = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { |
1862 const sidebar = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
1776 xmlns: "http://www.w3.org/2000/svg", |
1863 xmlns: "http://www.w3.org/2000/svg", |
1777 viewBox: "0 0 24 24" |
1864 viewBox: "0 0 24 24" |
1778 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { |
1865 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
1779 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.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" |
1866 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.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" |
1780 })); |
1867 })); |
1781 /* harmony default export */ var library_sidebar = (sidebar); |
1868 /* harmony default export */ var library_sidebar = (sidebar); |
1782 |
1869 |
1783 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/get-template-part-icon.js |
1870 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol-filled.js |
1871 |
|
1872 |
|
1873 /** |
|
1874 * WordPress dependencies |
|
1875 */ |
|
1876 |
|
1877 const symbolFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
1878 xmlns: "http://www.w3.org/2000/svg", |
|
1879 viewBox: "0 0 24 24" |
|
1880 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
1881 d: "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-17.6 1L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z" |
|
1882 })); |
|
1883 /* harmony default export */ var symbol_filled = (symbolFilled); |
|
1884 |
|
1885 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/get-template-part-icon.js |
|
1784 /** |
1886 /** |
1785 * WordPress dependencies |
1887 * WordPress dependencies |
1786 */ |
1888 */ |
1787 |
1889 |
1788 /** |
1890 /** |
1800 return library_footer; |
1902 return library_footer; |
1801 } else if ('sidebar' === iconName) { |
1903 } else if ('sidebar' === iconName) { |
1802 return library_sidebar; |
1904 return library_sidebar; |
1803 } |
1905 } |
1804 |
1906 |
1805 return layout["a" /* default */]; |
1907 return symbol_filled; |
1806 } |
1908 } |
1807 |
1909 |
1808 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js |
1910 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js |
1809 /** |
1911 /** |
1810 * External dependencies |
1912 * External dependencies |
1811 */ |
1913 */ |
1812 |
1914 |
1813 |
1915 |
1820 |
1922 |
1821 |
1923 |
1822 |
1924 |
1823 |
1925 |
1824 |
1926 |
1927 |
|
1928 |
|
1929 |
|
1825 /** |
1930 /** |
1826 * Internal dependencies |
1931 * Internal dependencies |
1827 */ |
1932 */ |
1828 |
|
1829 |
|
1830 |
1933 |
1831 |
1934 |
1832 |
1935 |
1833 |
1936 |
1834 /** |
1937 /** |
1855 * @param {Object} state Global application state. |
1958 * @param {Object} state Global application state. |
1856 * |
1959 * |
1857 * @return {boolean} Whether undo history exists. |
1960 * @return {boolean} Whether undo history exists. |
1858 */ |
1961 */ |
1859 |
1962 |
1860 const hasEditorUndo = Object(external_wp_data_["createRegistrySelector"])(select => () => { |
1963 const hasEditorUndo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
1861 return select('core').hasUndo(); |
1964 return select(external_wp_coreData_namespaceObject.store).hasUndo(); |
1862 }); |
1965 }); |
1863 /** |
1966 /** |
1864 * Returns true if any future editor history snapshots exist, or false |
1967 * Returns true if any future editor history snapshots exist, or false |
1865 * otherwise. |
1968 * otherwise. |
1866 * |
1969 * |
1867 * @param {Object} state Global application state. |
1970 * @param {Object} state Global application state. |
1868 * |
1971 * |
1869 * @return {boolean} Whether redo history exists. |
1972 * @return {boolean} Whether redo history exists. |
1870 */ |
1973 */ |
1871 |
1974 |
1872 const hasEditorRedo = Object(external_wp_data_["createRegistrySelector"])(select => () => { |
1975 const hasEditorRedo = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { |
1873 return select('core').hasRedo(); |
1976 return select(external_wp_coreData_namespaceObject.store).hasRedo(); |
1874 }); |
1977 }); |
1875 /** |
1978 /** |
1876 * Returns true if the currently edited post is yet to be saved, or false if |
1979 * Returns true if the currently edited post is yet to be saved, or false if |
1877 * the post has been saved. |
1980 * the post has been saved. |
1878 * |
1981 * |
1879 * @param {Object} state Global application state. |
1982 * @param {Object} state Global application state. |
1880 * |
1983 * |
1881 * @return {boolean} Whether the post is new. |
1984 * @return {boolean} Whether the post is new. |
1882 */ |
1985 */ |
1883 |
1986 |
1884 function selectors_isEditedPostNew(state) { |
1987 function isEditedPostNew(state) { |
1885 return selectors_getCurrentPost(state).status === 'auto-draft'; |
1988 return getCurrentPost(state).status === 'auto-draft'; |
1886 } |
1989 } |
1887 /** |
1990 /** |
1888 * Returns true if content includes unsaved changes, or false otherwise. |
1991 * Returns true if content includes unsaved changes, or false otherwise. |
1889 * |
1992 * |
1890 * @param {Object} state Editor state. |
1993 * @param {Object} state Editor state. |
1891 * |
1994 * |
1892 * @return {boolean} Whether content includes unsaved changes. |
1995 * @return {boolean} Whether content includes unsaved changes. |
1893 */ |
1996 */ |
1894 |
1997 |
1895 function hasChangedContent(state) { |
1998 function hasChangedContent(state) { |
1896 const edits = selectors_getPostEdits(state); |
1999 const edits = getPostEdits(state); |
1897 return 'blocks' in edits || // `edits` is intended to contain only values which are different from |
2000 return 'blocks' in edits || // `edits` is intended to contain only values which are different from |
1898 // the saved post, so the mere presence of a property is an indicator |
2001 // the saved post, so the mere presence of a property is an indicator |
1899 // that the value is different than what is known to be saved. While |
2002 // that the value is different than what is known to be saved. While |
1900 // content in Visual mode is represented by the blocks state, in Text |
2003 // content in Visual mode is represented by the blocks state, in Text |
1901 // mode it is tracked by `edits.content`. |
2004 // mode it is tracked by `edits.content`. |
1908 * @param {Object} state Global application state. |
2011 * @param {Object} state Global application state. |
1909 * |
2012 * |
1910 * @return {boolean} Whether unsaved values exist. |
2013 * @return {boolean} Whether unsaved values exist. |
1911 */ |
2014 */ |
1912 |
2015 |
1913 const selectors_isEditedPostDirty = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
2016 const isEditedPostDirty = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
1914 // Edits should contain only fields which differ from the saved post (reset |
2017 // Edits should contain only fields which differ from the saved post (reset |
1915 // at initial load and save complete). Thus, a non-empty edits state can be |
2018 // at initial load and save complete). Thus, a non-empty edits state can be |
1916 // inferred to contain unsaved values. |
2019 // inferred to contain unsaved values. |
1917 const postType = selectors_getCurrentPostType(state); |
2020 const postType = getCurrentPostType(state); |
1918 const postId = selectors_getCurrentPostId(state); |
2021 const postId = getCurrentPostId(state); |
1919 |
2022 |
1920 if (select('core').hasEditsForEntityRecord('postType', postType, postId)) { |
2023 if (select(external_wp_coreData_namespaceObject.store).hasEditsForEntityRecord('postType', postType, postId)) { |
1921 return true; |
2024 return true; |
1922 } |
2025 } |
1923 |
2026 |
1924 return false; |
2027 return false; |
1925 }); |
2028 }); |
1930 * @param {Object} state Global application state. |
2033 * @param {Object} state Global application state. |
1931 * |
2034 * |
1932 * @return {boolean} Whether there are edits or not. |
2035 * @return {boolean} Whether there are edits or not. |
1933 */ |
2036 */ |
1934 |
2037 |
1935 const selectors_hasNonPostEntityChanges = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
2038 const hasNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
1936 const dirtyEntityRecords = select('core').__experimentalGetDirtyEntityRecords(); |
2039 const dirtyEntityRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); |
1937 |
2040 |
1938 const { |
2041 const { |
1939 type, |
2042 type, |
1940 id |
2043 id |
1941 } = selectors_getCurrentPost(state); |
2044 } = getCurrentPost(state); |
1942 return Object(external_lodash_["some"])(dirtyEntityRecords, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); |
2045 return (0,external_lodash_namespaceObject.some)(dirtyEntityRecords, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); |
1943 }); |
2046 }); |
1944 /** |
2047 /** |
1945 * Returns true if there are no unsaved values for the current edit session and |
2048 * Returns true if there are no unsaved values for the current edit session and |
1946 * if the currently edited post is new (has never been saved before). |
2049 * if the currently edited post is new (has never been saved before). |
1947 * |
2050 * |
1948 * @param {Object} state Global application state. |
2051 * @param {Object} state Global application state. |
1949 * |
2052 * |
1950 * @return {boolean} Whether new post and unsaved values exist. |
2053 * @return {boolean} Whether new post and unsaved values exist. |
1951 */ |
2054 */ |
1952 |
2055 |
1953 function selectors_isCleanNewPost(state) { |
2056 function isCleanNewPost(state) { |
1954 return !selectors_isEditedPostDirty(state) && selectors_isEditedPostNew(state); |
2057 return !isEditedPostDirty(state) && isEditedPostNew(state); |
1955 } |
2058 } |
1956 /** |
2059 /** |
1957 * Returns the post currently being edited in its last known saved state, not |
2060 * Returns the post currently being edited in its last known saved state, not |
1958 * including unsaved edits. Returns an object containing relevant default post |
2061 * including unsaved edits. Returns an object containing relevant default post |
1959 * values if the post has not yet been saved. |
2062 * values if the post has not yet been saved. |
1961 * @param {Object} state Global application state. |
2064 * @param {Object} state Global application state. |
1962 * |
2065 * |
1963 * @return {Object} Post object. |
2066 * @return {Object} Post object. |
1964 */ |
2067 */ |
1965 |
2068 |
1966 const selectors_getCurrentPost = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
2069 const getCurrentPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
1967 const postId = selectors_getCurrentPostId(state); |
2070 const postId = getCurrentPostId(state); |
1968 const postType = selectors_getCurrentPostType(state); |
2071 const postType = getCurrentPostType(state); |
1969 const post = select('core').getRawEntityRecord('postType', postType, postId); |
2072 const post = select(external_wp_coreData_namespaceObject.store).getRawEntityRecord('postType', postType, postId); |
1970 |
2073 |
1971 if (post) { |
2074 if (post) { |
1972 return post; |
2075 return post; |
1973 } // This exists for compatibility with the previous selector behavior |
2076 } // This exists for compatibility with the previous selector behavior |
1974 // which would guarantee an object return based on the editor reducer's |
2077 // which would guarantee an object return based on the editor reducer's |
1983 * @param {Object} state Global application state. |
2086 * @param {Object} state Global application state. |
1984 * |
2087 * |
1985 * @return {string} Post type. |
2088 * @return {string} Post type. |
1986 */ |
2089 */ |
1987 |
2090 |
1988 function selectors_getCurrentPostType(state) { |
2091 function getCurrentPostType(state) { |
1989 return state.postType; |
2092 return state.postType; |
1990 } |
2093 } |
1991 /** |
2094 /** |
1992 * Returns the ID of the post currently being edited, or null if the post has |
2095 * Returns the ID of the post currently being edited, or null if the post has |
1993 * not yet been saved. |
2096 * not yet been saved. |
1995 * @param {Object} state Global application state. |
2098 * @param {Object} state Global application state. |
1996 * |
2099 * |
1997 * @return {?number} ID of current post. |
2100 * @return {?number} ID of current post. |
1998 */ |
2101 */ |
1999 |
2102 |
2000 function selectors_getCurrentPostId(state) { |
2103 function getCurrentPostId(state) { |
2001 return state.postId; |
2104 return state.postId; |
2002 } |
2105 } |
2003 /** |
2106 /** |
2004 * Returns the number of revisions of the post currently being edited. |
2107 * Returns the number of revisions of the post currently being edited. |
2005 * |
2108 * |
2007 * |
2110 * |
2008 * @return {number} Number of revisions. |
2111 * @return {number} Number of revisions. |
2009 */ |
2112 */ |
2010 |
2113 |
2011 function getCurrentPostRevisionsCount(state) { |
2114 function getCurrentPostRevisionsCount(state) { |
2012 return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0); |
2115 return (0,external_lodash_namespaceObject.get)(getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0); |
2013 } |
2116 } |
2014 /** |
2117 /** |
2015 * Returns the last revision ID of the post currently being edited, |
2118 * Returns the last revision ID of the post currently being edited, |
2016 * or null if the post has no revisions. |
2119 * or null if the post has no revisions. |
2017 * |
2120 * |
2019 * |
2122 * |
2020 * @return {?number} ID of the last revision. |
2123 * @return {?number} ID of the last revision. |
2021 */ |
2124 */ |
2022 |
2125 |
2023 function getCurrentPostLastRevisionId(state) { |
2126 function getCurrentPostLastRevisionId(state) { |
2024 return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null); |
2127 return (0,external_lodash_namespaceObject.get)(getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null); |
2025 } |
2128 } |
2026 /** |
2129 /** |
2027 * Returns any post values which have been changed in the editor but not yet |
2130 * Returns any post values which have been changed in the editor but not yet |
2028 * been saved. |
2131 * been saved. |
2029 * |
2132 * |
2030 * @param {Object} state Global application state. |
2133 * @param {Object} state Global application state. |
2031 * |
2134 * |
2032 * @return {Object} Object of key value pairs comprising unsaved edits. |
2135 * @return {Object} Object of key value pairs comprising unsaved edits. |
2033 */ |
2136 */ |
2034 |
2137 |
2035 const selectors_getPostEdits = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
2138 const getPostEdits = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
2036 const postType = selectors_getCurrentPostType(state); |
2139 const postType = getCurrentPostType(state); |
2037 const postId = selectors_getCurrentPostId(state); |
2140 const postId = getCurrentPostId(state); |
2038 return select('core').getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT; |
2141 return select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT; |
2039 }); |
|
2040 /** |
|
2041 * Returns a new reference when edited values have changed. This is useful in |
|
2042 * inferring where an edit has been made between states by comparison of the |
|
2043 * return values using strict equality. |
|
2044 * |
|
2045 * @deprecated since Gutenberg 6.5.0. |
|
2046 * |
|
2047 * @example |
|
2048 * |
|
2049 * ``` |
|
2050 * const hasEditOccurred = ( |
|
2051 * getReferenceByDistinctEdits( beforeState ) !== |
|
2052 * getReferenceByDistinctEdits( afterState ) |
|
2053 * ); |
|
2054 * ``` |
|
2055 * |
|
2056 * @param {Object} state Editor state. |
|
2057 * |
|
2058 * @return {*} A value whose reference will change only when an edit occurs. |
|
2059 */ |
|
2060 |
|
2061 const getReferenceByDistinctEdits = Object(external_wp_data_["createRegistrySelector"])(select => () => |
|
2062 /* state */ |
|
2063 { |
|
2064 external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`", { |
|
2065 since: '5.4', |
|
2066 alternative: "`wp.data.select( 'core' ).getReferenceByDistinctEdits`" |
|
2067 }); |
|
2068 return select('core').getReferenceByDistinctEdits(); |
|
2069 }); |
2142 }); |
2070 /** |
2143 /** |
2071 * Returns an attribute value of the saved post. |
2144 * Returns an attribute value of the saved post. |
2072 * |
2145 * |
2073 * @param {Object} state Global application state. |
2146 * @param {Object} state Global application state. |
2074 * @param {string} attributeName Post attribute name. |
2147 * @param {string} attributeName Post attribute name. |
2075 * |
2148 * |
2076 * @return {*} Post attribute value. |
2149 * @return {*} Post attribute value. |
2077 */ |
2150 */ |
2078 |
2151 |
2079 function selectors_getCurrentPostAttribute(state, attributeName) { |
2152 function getCurrentPostAttribute(state, attributeName) { |
2080 switch (attributeName) { |
2153 switch (attributeName) { |
2081 case 'type': |
2154 case 'type': |
2082 return selectors_getCurrentPostType(state); |
2155 return getCurrentPostType(state); |
2083 |
2156 |
2084 case 'id': |
2157 case 'id': |
2085 return selectors_getCurrentPostId(state); |
2158 return getCurrentPostId(state); |
2086 |
2159 |
2087 default: |
2160 default: |
2088 const post = selectors_getCurrentPost(state); |
2161 const post = getCurrentPost(state); |
2089 |
2162 |
2090 if (!post.hasOwnProperty(attributeName)) { |
2163 if (!post.hasOwnProperty(attributeName)) { |
2091 break; |
2164 break; |
2092 } |
2165 } |
2093 |
2166 |
2104 * |
2177 * |
2105 * @return {*} Post attribute value. |
2178 * @return {*} Post attribute value. |
2106 */ |
2179 */ |
2107 |
2180 |
2108 const getNestedEditedPostProperty = (state, attributeName) => { |
2181 const getNestedEditedPostProperty = (state, attributeName) => { |
2109 const edits = selectors_getPostEdits(state); |
2182 const edits = getPostEdits(state); |
2110 |
2183 |
2111 if (!edits.hasOwnProperty(attributeName)) { |
2184 if (!edits.hasOwnProperty(attributeName)) { |
2112 return selectors_getCurrentPostAttribute(state, attributeName); |
2185 return getCurrentPostAttribute(state, attributeName); |
2113 } |
2186 } |
2114 |
2187 |
2115 return { ...selectors_getCurrentPostAttribute(state, attributeName), |
2188 return { ...getCurrentPostAttribute(state, attributeName), |
2116 ...edits[attributeName] |
2189 ...edits[attributeName] |
2117 }; |
2190 }; |
2118 }; |
2191 }; |
2119 /** |
2192 /** |
2120 * Returns a single attribute of the post being edited, preferring the unsaved |
2193 * Returns a single attribute of the post being edited, preferring the unsaved |
2126 * |
2199 * |
2127 * @return {*} Post attribute value. |
2200 * @return {*} Post attribute value. |
2128 */ |
2201 */ |
2129 |
2202 |
2130 |
2203 |
2131 function selectors_getEditedPostAttribute(state, attributeName) { |
2204 function getEditedPostAttribute(state, attributeName) { |
2132 // Special cases |
2205 // Special cases. |
2133 switch (attributeName) { |
2206 switch (attributeName) { |
2134 case 'content': |
2207 case 'content': |
2135 return getEditedPostContent(state); |
2208 return getEditedPostContent(state); |
2136 } // Fall back to saved post value if not edited. |
2209 } // Fall back to saved post value if not edited. |
2137 |
2210 |
2138 |
2211 |
2139 const edits = selectors_getPostEdits(state); |
2212 const edits = getPostEdits(state); |
2140 |
2213 |
2141 if (!edits.hasOwnProperty(attributeName)) { |
2214 if (!edits.hasOwnProperty(attributeName)) { |
2142 return selectors_getCurrentPostAttribute(state, attributeName); |
2215 return getCurrentPostAttribute(state, attributeName); |
2143 } // Merge properties are objects which contain only the patch edit in state, |
2216 } // Merge properties are objects which contain only the patch edit in state, |
2144 // and thus must be merged with the current post attribute. |
2217 // and thus must be merged with the current post attribute. |
2145 |
2218 |
2146 |
2219 |
2147 if (EDIT_MERGE_PROPERTIES.has(attributeName)) { |
2220 if (EDIT_MERGE_PROPERTIES.has(attributeName)) { |
2162 * @param {string} attributeName Autosave attribute name. |
2235 * @param {string} attributeName Autosave attribute name. |
2163 * |
2236 * |
2164 * @return {*} Autosave attribute value. |
2237 * @return {*} Autosave attribute value. |
2165 */ |
2238 */ |
2166 |
2239 |
2167 const getAutosaveAttribute = Object(external_wp_data_["createRegistrySelector"])(select => (state, attributeName) => { |
2240 const getAutosaveAttribute = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, attributeName) => { |
2168 if (!Object(external_lodash_["includes"])(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') { |
2241 if (!(0,external_lodash_namespaceObject.includes)(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') { |
2169 return; |
2242 return; |
2170 } |
2243 } |
2171 |
2244 |
2172 const postType = selectors_getCurrentPostType(state); |
2245 const postType = getCurrentPostType(state); |
2173 const postId = selectors_getCurrentPostId(state); |
2246 const postId = getCurrentPostId(state); |
2174 const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); |
2247 const currentUserId = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getCurrentUser(), ['id']); |
2175 const autosave = select('core').getAutosave(postType, postId, currentUserId); |
2248 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); |
2176 |
2249 |
2177 if (autosave) { |
2250 if (autosave) { |
2178 return getPostRawValue(autosave[attributeName]); |
2251 return getPostRawValue(autosave[attributeName]); |
2179 } |
2252 } |
2180 }); |
2253 }); |
2186 * @param {Object} state Global application state. |
2259 * @param {Object} state Global application state. |
2187 * |
2260 * |
2188 * @return {string} Post visibility. |
2261 * @return {string} Post visibility. |
2189 */ |
2262 */ |
2190 |
2263 |
2191 function selectors_getEditedPostVisibility(state) { |
2264 function getEditedPostVisibility(state) { |
2192 const status = selectors_getEditedPostAttribute(state, 'status'); |
2265 const status = getEditedPostAttribute(state, 'status'); |
2193 |
2266 |
2194 if (status === 'private') { |
2267 if (status === 'private') { |
2195 return 'private'; |
2268 return 'private'; |
2196 } |
2269 } |
2197 |
2270 |
2198 const password = selectors_getEditedPostAttribute(state, 'password'); |
2271 const password = getEditedPostAttribute(state, 'password'); |
2199 |
2272 |
2200 if (password) { |
2273 if (password) { |
2201 return 'password'; |
2274 return 'password'; |
2202 } |
2275 } |
2203 |
2276 |
2210 * |
2283 * |
2211 * @return {boolean} Whether current post is pending review. |
2284 * @return {boolean} Whether current post is pending review. |
2212 */ |
2285 */ |
2213 |
2286 |
2214 function isCurrentPostPending(state) { |
2287 function isCurrentPostPending(state) { |
2215 return selectors_getCurrentPost(state).status === 'pending'; |
2288 return getCurrentPost(state).status === 'pending'; |
2216 } |
2289 } |
2217 /** |
2290 /** |
2218 * Return true if the current post has already been published. |
2291 * Return true if the current post has already been published. |
2219 * |
2292 * |
2220 * @param {Object} state Global application state. |
2293 * @param {Object} state Global application state. |
2221 * @param {Object?} currentPost Explicit current post for bypassing registry selector. |
2294 * @param {Object?} currentPost Explicit current post for bypassing registry selector. |
2222 * |
2295 * |
2223 * @return {boolean} Whether the post has been published. |
2296 * @return {boolean} Whether the post has been published. |
2224 */ |
2297 */ |
2225 |
2298 |
2226 function selectors_isCurrentPostPublished(state, currentPost) { |
2299 function isCurrentPostPublished(state, currentPost) { |
2227 const post = currentPost || selectors_getCurrentPost(state); |
2300 const post = currentPost || getCurrentPost(state); |
2228 return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !Object(external_wp_date_["isInTheFuture"])(new Date(Number(Object(external_wp_date_["getDate"])(post.date)) - ONE_MINUTE_IN_MS)); |
2301 return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !(0,external_wp_date_namespaceObject.isInTheFuture)(new Date(Number((0,external_wp_date_namespaceObject.getDate)(post.date)) - ONE_MINUTE_IN_MS)); |
2229 } |
2302 } |
2230 /** |
2303 /** |
2231 * Returns true if post is already scheduled. |
2304 * Returns true if post is already scheduled. |
2232 * |
2305 * |
2233 * @param {Object} state Global application state. |
2306 * @param {Object} state Global application state. |
2234 * |
2307 * |
2235 * @return {boolean} Whether current post is scheduled to be posted. |
2308 * @return {boolean} Whether current post is scheduled to be posted. |
2236 */ |
2309 */ |
2237 |
2310 |
2238 function selectors_isCurrentPostScheduled(state) { |
2311 function isCurrentPostScheduled(state) { |
2239 return selectors_getCurrentPost(state).status === 'future' && !selectors_isCurrentPostPublished(state); |
2312 return getCurrentPost(state).status === 'future' && !isCurrentPostPublished(state); |
2240 } |
2313 } |
2241 /** |
2314 /** |
2242 * Return true if the post being edited can be published. |
2315 * Return true if the post being edited can be published. |
2243 * |
2316 * |
2244 * @param {Object} state Global application state. |
2317 * @param {Object} state Global application state. |
2245 * |
2318 * |
2246 * @return {boolean} Whether the post can been published. |
2319 * @return {boolean} Whether the post can been published. |
2247 */ |
2320 */ |
2248 |
2321 |
2249 function selectors_isEditedPostPublishable(state) { |
2322 function isEditedPostPublishable(state) { |
2250 const post = selectors_getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post |
2323 const post = getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post |
2251 // being saveable. Currently this restriction is imposed at UI. |
2324 // being saveable. Currently this restriction is imposed at UI. |
2252 // |
2325 // |
2253 // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`) |
2326 // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`). |
2254 |
2327 |
2255 return selectors_isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1; |
2328 return isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1; |
2256 } |
2329 } |
2257 /** |
2330 /** |
2258 * Returns true if the post can be saved, or false otherwise. A post must |
2331 * Returns true if the post can be saved, or false otherwise. A post must |
2259 * contain a title, an excerpt, or non-empty content to be valid for save. |
2332 * contain a title, an excerpt, or non-empty content to be valid for save. |
2260 * |
2333 * |
2261 * @param {Object} state Global application state. |
2334 * @param {Object} state Global application state. |
2262 * |
2335 * |
2263 * @return {boolean} Whether the post can be saved. |
2336 * @return {boolean} Whether the post can be saved. |
2264 */ |
2337 */ |
2265 |
2338 |
2266 function selectors_isEditedPostSaveable(state) { |
2339 function isEditedPostSaveable(state) { |
2267 if (selectors_isSavingPost(state)) { |
2340 if (isSavingPost(state)) { |
2268 return false; |
2341 return false; |
2269 } // TODO: Post should not be saveable if not dirty. Cannot be added here at |
2342 } // TODO: Post should not be saveable if not dirty. Cannot be added here at |
2270 // this time since posts where meta boxes are present can be saved even if |
2343 // this time since posts where meta boxes are present can be saved even if |
2271 // the post is not dirty. Currently this restriction is imposed at UI, but |
2344 // the post is not dirty. Currently this restriction is imposed at UI, but |
2272 // should be moved here. |
2345 // should be moved here. |
2273 // |
2346 // |
2274 // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition) |
2347 // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition) |
2275 // See: <PostSavedState /> (`forceIsDirty` prop) |
2348 // See: <PostSavedState /> (`forceIsDirty` prop) |
2276 // See: <PostPublishButton /> (`forceIsDirty` prop) |
2349 // See: <PostPublishButton /> (`forceIsDirty` prop) |
2277 // See: https://github.com/WordPress/gutenberg/pull/4184 |
2350 // See: https://github.com/WordPress/gutenberg/pull/4184. |
2278 |
2351 |
2279 |
2352 |
2280 return !!selectors_getEditedPostAttribute(state, 'title') || !!selectors_getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_["Platform"].OS === 'native'; |
2353 return !!getEditedPostAttribute(state, 'title') || !!getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_namespaceObject.Platform.OS === 'native'; |
2281 } |
2354 } |
2282 /** |
2355 /** |
2283 * Returns true if the edited post has content. A post has content if it has at |
2356 * Returns true if the edited post has content. A post has content if it has at |
2284 * least one saveable block or otherwise has a non-empty content property |
2357 * least one saveable block or otherwise has a non-empty content property |
2285 * assigned. |
2358 * assigned. |
2317 // non-empty, if only by virtue of its own comment delimiters. |
2390 // non-empty, if only by virtue of its own comment delimiters. |
2318 |
2391 |
2319 |
2392 |
2320 const blockName = blocks[0].name; |
2393 const blockName = blocks[0].name; |
2321 |
2394 |
2322 if (blockName !== Object(external_wp_blocks_["getDefaultBlockName"])() && blockName !== Object(external_wp_blocks_["getFreeformContentHandlerName"])()) { |
2395 if (blockName !== (0,external_wp_blocks_namespaceObject.getDefaultBlockName)() && blockName !== (0,external_wp_blocks_namespaceObject.getFreeformContentHandlerName)()) { |
2323 return false; |
2396 return false; |
2324 } |
2397 } |
2325 } |
2398 } |
2326 |
2399 |
2327 return !getEditedPostContent(state); |
2400 return !getEditedPostContent(state); |
2333 * @param {Object} autosave A raw autosave object from the REST API. |
2406 * @param {Object} autosave A raw autosave object from the REST API. |
2334 * |
2407 * |
2335 * @return {boolean} Whether the post can be autosaved. |
2408 * @return {boolean} Whether the post can be autosaved. |
2336 */ |
2409 */ |
2337 |
2410 |
2338 const selectors_isEditedPostAutosaveable = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
2411 const isEditedPostAutosaveable = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
2339 // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. |
2412 // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving. |
2340 if (!selectors_isEditedPostSaveable(state)) { |
2413 if (!isEditedPostSaveable(state)) { |
2341 return false; |
2414 return false; |
2342 } // A post is not autosavable when there is a post autosave lock. |
2415 } // A post is not autosavable when there is a post autosave lock. |
2343 |
2416 |
2344 |
2417 |
2345 if (isPostAutosavingLocked(state)) { |
2418 if (isPostAutosavingLocked(state)) { |
2346 return false; |
2419 return false; |
2347 } |
2420 } |
2348 |
2421 |
2349 const postType = selectors_getCurrentPostType(state); |
2422 const postType = getCurrentPostType(state); |
2350 const postId = selectors_getCurrentPostId(state); |
2423 const postId = getCurrentPostId(state); |
2351 const hasFetchedAutosave = select('core').hasFetchedAutosaves(postType, postId); |
2424 const hasFetchedAutosave = select(external_wp_coreData_namespaceObject.store).hasFetchedAutosaves(postType, postId); |
2352 const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave |
2425 const currentUserId = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave |
2353 // via a resolver, moving below the return would result in the autosave never |
2426 // via a resolver, moving below the return would result in the autosave never |
2354 // being fetched. |
2427 // being fetched. |
2355 // eslint-disable-next-line @wordpress/no-unused-vars-before-return |
2428 // eslint-disable-next-line @wordpress/no-unused-vars-before-return |
2356 |
2429 |
2357 const autosave = select('core').getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is |
2430 const autosave = select(external_wp_coreData_namespaceObject.store).getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is |
2358 // unable to determine if the post is autosaveable, so return false. |
2431 // unable to determine if the post is autosaveable, so return false. |
2359 |
2432 |
2360 if (!hasFetchedAutosave) { |
2433 if (!hasFetchedAutosave) { |
2361 return false; |
2434 return false; |
2362 } // If we don't already have an autosave, the post is autosaveable. |
2435 } // If we don't already have an autosave, the post is autosaveable. |
2373 if (hasChangedContent(state)) { |
2446 if (hasChangedContent(state)) { |
2374 return true; |
2447 return true; |
2375 } // If the title or excerpt has changed, the post is autosaveable. |
2448 } // If the title or excerpt has changed, the post is autosaveable. |
2376 |
2449 |
2377 |
2450 |
2378 return ['title', 'excerpt'].some(field => getPostRawValue(autosave[field]) !== selectors_getEditedPostAttribute(state, field)); |
2451 return ['title', 'excerpt'].some(field => getPostRawValue(autosave[field]) !== getEditedPostAttribute(state, field)); |
2379 }); |
|
2380 /** |
|
2381 * Returns the current autosave, or null if one is not set (i.e. if the post |
|
2382 * has yet to be autosaved, or has been saved or published since the last |
|
2383 * autosave). |
|
2384 * |
|
2385 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` |
|
2386 * selector from the '@wordpress/core-data' package. |
|
2387 * |
|
2388 * @param {Object} state Editor state. |
|
2389 * |
|
2390 * @return {?Object} Current autosave, if exists. |
|
2391 */ |
|
2392 |
|
2393 const getAutosave = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
|
2394 external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getAutosave()`", { |
|
2395 since: '5.3', |
|
2396 alternative: "`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`" |
|
2397 }); |
|
2398 const postType = selectors_getCurrentPostType(state); |
|
2399 const postId = selectors_getCurrentPostId(state); |
|
2400 const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); |
|
2401 const autosave = select('core').getAutosave(postType, postId, currentUserId); |
|
2402 return Object(external_lodash_["mapValues"])(Object(external_lodash_["pick"])(autosave, AUTOSAVE_PROPERTIES), getPostRawValue); |
|
2403 }); |
|
2404 /** |
|
2405 * Returns the true if there is an existing autosave, otherwise false. |
|
2406 * |
|
2407 * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector |
|
2408 * from the '@wordpress/core-data' package and check for a truthy value. |
|
2409 * |
|
2410 * @param {Object} state Global application state. |
|
2411 * |
|
2412 * @return {boolean} Whether there is an existing autosave. |
|
2413 */ |
|
2414 |
|
2415 const hasAutosave = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
|
2416 external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).hasAutosave()`", { |
|
2417 since: '5.3', |
|
2418 alternative: "`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`" |
|
2419 }); |
|
2420 const postType = selectors_getCurrentPostType(state); |
|
2421 const postId = selectors_getCurrentPostId(state); |
|
2422 const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); |
|
2423 return !!select('core').getAutosave(postType, postId, currentUserId); |
|
2424 }); |
2452 }); |
2425 /** |
2453 /** |
2426 * Return true if the post being edited is being scheduled. Preferring the |
2454 * Return true if the post being edited is being scheduled. Preferring the |
2427 * unsaved status values. |
2455 * unsaved status values. |
2428 * |
2456 * |
2429 * @param {Object} state Global application state. |
2457 * @param {Object} state Global application state. |
2430 * |
2458 * |
2431 * @return {boolean} Whether the post has been published. |
2459 * @return {boolean} Whether the post has been published. |
2432 */ |
2460 */ |
2433 |
2461 |
2434 function selectors_isEditedPostBeingScheduled(state) { |
2462 function isEditedPostBeingScheduled(state) { |
2435 const date = selectors_getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency) |
2463 const date = getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency). |
2436 |
2464 |
2437 const checkedDate = new Date(Number(Object(external_wp_date_["getDate"])(date)) - ONE_MINUTE_IN_MS); |
2465 const checkedDate = new Date(Number((0,external_wp_date_namespaceObject.getDate)(date)) - ONE_MINUTE_IN_MS); |
2438 return Object(external_wp_date_["isInTheFuture"])(checkedDate); |
2466 return (0,external_wp_date_namespaceObject.isInTheFuture)(checkedDate); |
2439 } |
2467 } |
2440 /** |
2468 /** |
2441 * Returns whether the current post should be considered to have a "floating" |
2469 * Returns whether the current post should be considered to have a "floating" |
2442 * date (i.e. that it would publish "Immediately" rather than at a set time). |
2470 * date (i.e. that it would publish "Immediately" rather than at a set time). |
2443 * |
2471 * |
2450 * |
2478 * |
2451 * @return {boolean} Whether the edited post has a floating date value. |
2479 * @return {boolean} Whether the edited post has a floating date value. |
2452 */ |
2480 */ |
2453 |
2481 |
2454 function isEditedPostDateFloating(state) { |
2482 function isEditedPostDateFloating(state) { |
2455 const date = selectors_getEditedPostAttribute(state, 'date'); |
2483 const date = getEditedPostAttribute(state, 'date'); |
2456 const modified = selectors_getEditedPostAttribute(state, 'modified'); // This should be the status of the persisted post |
2484 const modified = getEditedPostAttribute(state, 'modified'); // This should be the status of the persisted post |
2457 // It shouldn't use the "edited" status otherwise it breaks the |
2485 // It shouldn't use the "edited" status otherwise it breaks the |
2458 // infered post data floating status |
2486 // inferred post data floating status |
2459 // See https://github.com/WordPress/gutenberg/issues/28083 |
2487 // See https://github.com/WordPress/gutenberg/issues/28083. |
2460 |
2488 |
2461 const status = selectors_getCurrentPost(state).status; |
2489 const status = getCurrentPost(state).status; |
2462 |
2490 |
2463 if (status === 'draft' || status === 'auto-draft' || status === 'pending') { |
2491 if (status === 'draft' || status === 'auto-draft' || status === 'pending') { |
2464 return date === modified || date === null; |
2492 return date === modified || date === null; |
2465 } |
2493 } |
2466 |
2494 |
2472 * @param {Object} state Global application state. |
2500 * @param {Object} state Global application state. |
2473 * |
2501 * |
2474 * @return {boolean} Whether post is being saved. |
2502 * @return {boolean} Whether post is being saved. |
2475 */ |
2503 */ |
2476 |
2504 |
2477 const selectors_isSavingPost = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
2505 const isSavingPost = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
2478 const postType = selectors_getCurrentPostType(state); |
2506 const postType = getCurrentPostType(state); |
2479 const postId = selectors_getCurrentPostId(state); |
2507 const postId = getCurrentPostId(state); |
2480 return select('core').isSavingEntityRecord('postType', postType, postId); |
2508 return select(external_wp_coreData_namespaceObject.store).isSavingEntityRecord('postType', postType, postId); |
2509 }); |
|
2510 /** |
|
2511 * Returns true if non-post entities are currently being saved, or false otherwise. |
|
2512 * |
|
2513 * @param {Object} state Global application state. |
|
2514 * |
|
2515 * @return {boolean} Whether non-post entities are being saved. |
|
2516 */ |
|
2517 |
|
2518 const isSavingNonPostEntityChanges = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
|
2519 const entitiesBeingSaved = select(external_wp_coreData_namespaceObject.store).__experimentalGetEntitiesBeingSaved(); |
|
2520 |
|
2521 const { |
|
2522 type, |
|
2523 id |
|
2524 } = getCurrentPost(state); |
|
2525 return (0,external_lodash_namespaceObject.some)(entitiesBeingSaved, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id); |
|
2481 }); |
2526 }); |
2482 /** |
2527 /** |
2483 * Returns true if a previous post save was attempted successfully, or false |
2528 * Returns true if a previous post save was attempted successfully, or false |
2484 * otherwise. |
2529 * otherwise. |
2485 * |
2530 * |
2486 * @param {Object} state Global application state. |
2531 * @param {Object} state Global application state. |
2487 * |
2532 * |
2488 * @return {boolean} Whether the post was saved successfully. |
2533 * @return {boolean} Whether the post was saved successfully. |
2489 */ |
2534 */ |
2490 |
2535 |
2491 const didPostSaveRequestSucceed = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
2536 const didPostSaveRequestSucceed = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
2492 const postType = selectors_getCurrentPostType(state); |
2537 const postType = getCurrentPostType(state); |
2493 const postId = selectors_getCurrentPostId(state); |
2538 const postId = getCurrentPostId(state); |
2494 return !select('core').getLastEntitySaveError('postType', postType, postId); |
2539 return !select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); |
2495 }); |
2540 }); |
2496 /** |
2541 /** |
2497 * Returns true if a previous post save was attempted but failed, or false |
2542 * Returns true if a previous post save was attempted but failed, or false |
2498 * otherwise. |
2543 * otherwise. |
2499 * |
2544 * |
2500 * @param {Object} state Global application state. |
2545 * @param {Object} state Global application state. |
2501 * |
2546 * |
2502 * @return {boolean} Whether the post save failed. |
2547 * @return {boolean} Whether the post save failed. |
2503 */ |
2548 */ |
2504 |
2549 |
2505 const didPostSaveRequestFail = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
2550 const didPostSaveRequestFail = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
2506 const postType = selectors_getCurrentPostType(state); |
2551 const postType = getCurrentPostType(state); |
2507 const postId = selectors_getCurrentPostId(state); |
2552 const postId = getCurrentPostId(state); |
2508 return !!select('core').getLastEntitySaveError('postType', postType, postId); |
2553 return !!select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', postType, postId); |
2509 }); |
2554 }); |
2510 /** |
2555 /** |
2511 * Returns true if the post is autosaving, or false otherwise. |
2556 * Returns true if the post is autosaving, or false otherwise. |
2512 * |
2557 * |
2513 * @param {Object} state Global application state. |
2558 * @param {Object} state Global application state. |
2514 * |
2559 * |
2515 * @return {boolean} Whether the post is autosaving. |
2560 * @return {boolean} Whether the post is autosaving. |
2516 */ |
2561 */ |
2517 |
2562 |
2518 function selectors_isAutosavingPost(state) { |
2563 function isAutosavingPost(state) { |
2519 if (!selectors_isSavingPost(state)) { |
2564 if (!isSavingPost(state)) { |
2520 return false; |
2565 return false; |
2521 } |
2566 } |
2522 |
2567 |
2523 return !!Object(external_lodash_["get"])(state.saving, ['options', 'isAutosave']); |
2568 return !!(0,external_lodash_namespaceObject.get)(state.saving, ['options', 'isAutosave']); |
2524 } |
2569 } |
2525 /** |
2570 /** |
2526 * Returns true if the post is being previewed, or false otherwise. |
2571 * Returns true if the post is being previewed, or false otherwise. |
2527 * |
2572 * |
2528 * @param {Object} state Global application state. |
2573 * @param {Object} state Global application state. |
2529 * |
2574 * |
2530 * @return {boolean} Whether the post is being previewed. |
2575 * @return {boolean} Whether the post is being previewed. |
2531 */ |
2576 */ |
2532 |
2577 |
2533 function isPreviewingPost(state) { |
2578 function isPreviewingPost(state) { |
2534 if (!selectors_isSavingPost(state)) { |
2579 if (!isSavingPost(state)) { |
2535 return false; |
2580 return false; |
2536 } |
2581 } |
2537 |
2582 |
2538 return !!state.saving.options.isPreview; |
2583 return !!(0,external_lodash_namespaceObject.get)(state.saving, ['options', 'isPreview']); |
2539 } |
2584 } |
2540 /** |
2585 /** |
2541 * Returns the post preview link |
2586 * Returns the post preview link |
2542 * |
2587 * |
2543 * @param {Object} state Global application state. |
2588 * @param {Object} state Global application state. |
2544 * |
2589 * |
2545 * @return {string?} Preview Link. |
2590 * @return {string?} Preview Link. |
2546 */ |
2591 */ |
2547 |
2592 |
2548 function selectors_getEditedPostPreviewLink(state) { |
2593 function getEditedPostPreviewLink(state) { |
2549 if (state.saving.pending || selectors_isSavingPost(state)) { |
2594 if (state.saving.pending || isSavingPost(state)) { |
2550 return; |
2595 return; |
2551 } |
2596 } |
2552 |
2597 |
2553 let previewLink = getAutosaveAttribute(state, 'preview_link'); |
2598 let previewLink = getAutosaveAttribute(state, 'preview_link'); // Fix for issue: https://github.com/WordPress/gutenberg/issues/33616 |
2554 |
2599 // If the post is draft, ignore the preview link from the autosave record, |
2555 if (!previewLink) { |
2600 // because the preview could be a stale autosave if the post was switched from |
2556 previewLink = selectors_getEditedPostAttribute(state, 'link'); |
2601 // published to draft. |
2602 // See: https://github.com/WordPress/gutenberg/pull/37952. |
|
2603 |
|
2604 if (!previewLink || 'draft' === getCurrentPost(state).status) { |
|
2605 previewLink = getEditedPostAttribute(state, 'link'); |
|
2557 |
2606 |
2558 if (previewLink) { |
2607 if (previewLink) { |
2559 previewLink = Object(external_wp_url_["addQueryArgs"])(previewLink, { |
2608 previewLink = (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { |
2560 preview: true |
2609 preview: true |
2561 }); |
2610 }); |
2562 } |
2611 } |
2563 } |
2612 } |
2564 |
2613 |
2565 const featuredImageId = selectors_getEditedPostAttribute(state, 'featured_media'); |
2614 const featuredImageId = getEditedPostAttribute(state, 'featured_media'); |
2566 |
2615 |
2567 if (previewLink && featuredImageId) { |
2616 if (previewLink && featuredImageId) { |
2568 return Object(external_wp_url_["addQueryArgs"])(previewLink, { |
2617 return (0,external_wp_url_namespaceObject.addQueryArgs)(previewLink, { |
2569 _thumbnail_id: featuredImageId |
2618 _thumbnail_id: featuredImageId |
2570 }); |
2619 }); |
2571 } |
2620 } |
2572 |
2621 |
2573 return previewLink; |
2622 return previewLink; |
2580 * @param {Object} state Global application state. |
2629 * @param {Object} state Global application state. |
2581 * |
2630 * |
2582 * @return {?string} Suggested post format. |
2631 * @return {?string} Suggested post format. |
2583 */ |
2632 */ |
2584 |
2633 |
2585 function selectors_getSuggestedPostFormat(state) { |
2634 function getSuggestedPostFormat(state) { |
2586 const blocks = getEditorBlocks(state); |
2635 const blocks = getEditorBlocks(state); |
2587 if (blocks.length > 2) return null; |
2636 if (blocks.length > 2) return null; |
2588 let name; // If there is only one block in the content of the post grab its name |
2637 let name; // If there is only one block in the content of the post grab its name |
2589 // so we can derive a suitable post format from it. |
2638 // so we can derive a suitable post format from it. |
2590 |
2639 |
2591 if (blocks.length === 1) { |
2640 if (blocks.length === 1) { |
2592 name = blocks[0].name; // check for core/embed `video` and `audio` eligible suggestions |
2641 name = blocks[0].name; // Check for core/embed `video` and `audio` eligible suggestions. |
2593 |
2642 |
2594 if (name === 'core/embed') { |
2643 if (name === 'core/embed') { |
2595 var _blocks$0$attributes; |
2644 var _blocks$0$attributes; |
2596 |
2645 |
2597 const provider = (_blocks$0$attributes = blocks[0].attributes) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes.providerNameSlug; |
2646 const provider = (_blocks$0$attributes = blocks[0].attributes) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes.providerNameSlug; |
2631 default: |
2680 default: |
2632 return null; |
2681 return null; |
2633 } |
2682 } |
2634 } |
2683 } |
2635 /** |
2684 /** |
2636 * Returns a set of blocks which are to be used in consideration of the post's |
|
2637 * generated save content. |
|
2638 * |
|
2639 * @deprecated since Gutenberg 6.2.0. |
|
2640 * |
|
2641 * @param {Object} state Editor state. |
|
2642 * |
|
2643 * @return {WPBlock[]} Filtered set of blocks for save. |
|
2644 */ |
|
2645 |
|
2646 function getBlocksForSerialization(state) { |
|
2647 external_wp_deprecated_default()('`core/editor` getBlocksForSerialization selector', { |
|
2648 since: '5.3', |
|
2649 alternative: 'getEditorBlocks', |
|
2650 hint: 'Blocks serialization pre-processing occurs at save time' |
|
2651 }); |
|
2652 const blocks = state.editor.present.blocks.value; // WARNING: Any changes to the logic of this function should be verified |
|
2653 // against the implementation of isEditedPostEmpty, which bypasses this |
|
2654 // function for performance' sake, in an assumption of this current logic |
|
2655 // being irrelevant to the optimized condition of emptiness. |
|
2656 // A single unmodified default block is assumed to be equivalent to an |
|
2657 // empty post. |
|
2658 |
|
2659 const isSingleUnmodifiedDefaultBlock = blocks.length === 1 && Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])(blocks[0]); |
|
2660 |
|
2661 if (isSingleUnmodifiedDefaultBlock) { |
|
2662 return []; |
|
2663 } |
|
2664 |
|
2665 return blocks; |
|
2666 } |
|
2667 /** |
|
2668 * Returns the content of the post being edited. |
2685 * Returns the content of the post being edited. |
2669 * |
2686 * |
2670 * @param {Object} state Global application state. |
2687 * @param {Object} state Global application state. |
2671 * |
2688 * |
2672 * @return {string} Post content. |
2689 * @return {string} Post content. |
2673 */ |
2690 */ |
2674 |
2691 |
2675 const getEditedPostContent = Object(external_wp_data_["createRegistrySelector"])(select => state => { |
2692 const getEditedPostContent = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
2676 const postId = selectors_getCurrentPostId(state); |
2693 const postId = getCurrentPostId(state); |
2677 const postType = selectors_getCurrentPostType(state); |
2694 const postType = getCurrentPostType(state); |
2678 const record = select('core').getEditedEntityRecord('postType', postType, postId); |
2695 const record = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); |
2679 |
2696 |
2680 if (record) { |
2697 if (record) { |
2681 if (typeof record.content === 'function') { |
2698 if (typeof record.content === 'function') { |
2682 return record.content(record); |
2699 return record.content(record); |
2683 } else if (record.blocks) { |
2700 } else if (record.blocks) { |
2684 return Object(external_wp_blocks_["__unstableSerializeAndClean"])(record.blocks); |
2701 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(record.blocks); |
2685 } else if (record.content) { |
2702 } else if (record.content) { |
2686 return record.content; |
2703 return record.content; |
2687 } |
2704 } |
2688 } |
2705 } |
2689 |
2706 |
2695 * @param {Object} state Global application state. |
2712 * @param {Object} state Global application state. |
2696 * |
2713 * |
2697 * @return {boolean} Whether post is being published. |
2714 * @return {boolean} Whether post is being published. |
2698 */ |
2715 */ |
2699 |
2716 |
2700 function selectors_isPublishingPost(state) { |
2717 function isPublishingPost(state) { |
2701 return selectors_isSavingPost(state) && !selectors_isCurrentPostPublished(state) && selectors_getEditedPostAttribute(state, 'status') === 'publish'; |
2718 return isSavingPost(state) && !isCurrentPostPublished(state) && getEditedPostAttribute(state, 'status') === 'publish'; |
2702 } |
2719 } |
2703 /** |
2720 /** |
2704 * Returns whether the permalink is editable or not. |
2721 * Returns whether the permalink is editable or not. |
2705 * |
2722 * |
2706 * @param {Object} state Editor state. |
2723 * @param {Object} state Editor state. |
2707 * |
2724 * |
2708 * @return {boolean} Whether or not the permalink is editable. |
2725 * @return {boolean} Whether or not the permalink is editable. |
2709 */ |
2726 */ |
2710 |
2727 |
2711 function isPermalinkEditable(state) { |
2728 function isPermalinkEditable(state) { |
2712 const permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); |
2729 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); |
2713 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); |
2730 return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate); |
2714 } |
2731 } |
2715 /** |
2732 /** |
2716 * Returns the permalink for the post. |
2733 * Returns the permalink for the post. |
2717 * |
2734 * |
2748 * |
2765 * |
2749 * @return {string} The current slug to be displayed in the editor |
2766 * @return {string} The current slug to be displayed in the editor |
2750 */ |
2767 */ |
2751 |
2768 |
2752 function getEditedPostSlug(state) { |
2769 function getEditedPostSlug(state) { |
2753 return selectors_getEditedPostAttribute(state, 'slug') || cleanForSlug(selectors_getEditedPostAttribute(state, 'title')) || selectors_getCurrentPostId(state); |
2770 return getEditedPostAttribute(state, 'slug') || (0,external_wp_url_namespaceObject.cleanForSlug)(getEditedPostAttribute(state, 'title')) || getCurrentPostId(state); |
2754 } |
2771 } |
2755 /** |
2772 /** |
2756 * Returns the permalink for a post, split into it's three parts: the prefix, |
2773 * Returns the permalink for a post, split into it's three parts: the prefix, |
2757 * the postName, and the suffix. |
2774 * the postName, and the suffix. |
2758 * |
2775 * |
2761 * @return {Object} An object containing the prefix, postName, and suffix for |
2778 * @return {Object} An object containing the prefix, postName, and suffix for |
2762 * the permalink, or null if the post is not viewable. |
2779 * the permalink, or null if the post is not viewable. |
2763 */ |
2780 */ |
2764 |
2781 |
2765 function getPermalinkParts(state) { |
2782 function getPermalinkParts(state) { |
2766 const permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template'); |
2783 const permalinkTemplate = getEditedPostAttribute(state, 'permalink_template'); |
2767 |
2784 |
2768 if (!permalinkTemplate) { |
2785 if (!permalinkTemplate) { |
2769 return null; |
2786 return null; |
2770 } |
2787 } |
2771 |
2788 |
2772 const postName = selectors_getEditedPostAttribute(state, 'slug') || selectors_getEditedPostAttribute(state, 'generated_slug'); |
2789 const postName = getEditedPostAttribute(state, 'slug') || getEditedPostAttribute(state, 'generated_slug'); |
2773 const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); |
2790 const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX); |
2774 return { |
2791 return { |
2775 prefix, |
2792 prefix, |
2776 postName, |
2793 postName, |
2777 suffix |
2794 suffix |
2783 * @param {Object} state Global application state. |
2800 * @param {Object} state Global application state. |
2784 * |
2801 * |
2785 * @return {boolean} Is locked. |
2802 * @return {boolean} Is locked. |
2786 */ |
2803 */ |
2787 |
2804 |
2788 function selectors_isPostLocked(state) { |
2805 function isPostLocked(state) { |
2789 return state.postLock.isLocked; |
2806 return state.postLock.isLocked; |
2790 } |
2807 } |
2791 /** |
2808 /** |
2792 * Returns whether post saving is locked. |
2809 * Returns whether post saving is locked. |
2793 * |
2810 * |
2794 * @param {Object} state Global application state. |
2811 * @param {Object} state Global application state. |
2795 * |
2812 * |
2796 * @return {boolean} Is locked. |
2813 * @return {boolean} Is locked. |
2797 */ |
2814 */ |
2798 |
2815 |
2799 function selectors_isPostSavingLocked(state) { |
2816 function isPostSavingLocked(state) { |
2800 return Object.keys(state.postSavingLock).length > 0; |
2817 return Object.keys(state.postSavingLock).length > 0; |
2801 } |
2818 } |
2802 /** |
2819 /** |
2803 * Returns whether post autosaving is locked. |
2820 * Returns whether post autosaving is locked. |
2804 * |
2821 * |
2849 * @param {Object} state Editor state. |
2866 * @param {Object} state Editor state. |
2850 * |
2867 * |
2851 * @return {boolean} Whether the user can or can't post unfiltered HTML. |
2868 * @return {boolean} Whether the user can or can't post unfiltered HTML. |
2852 */ |
2869 */ |
2853 |
2870 |
2854 function selectors_canUserUseUnfilteredHTML(state) { |
2871 function canUserUseUnfilteredHTML(state) { |
2855 return Object(external_lodash_["has"])(selectors_getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']); |
2872 return (0,external_lodash_namespaceObject.has)(getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']); |
2856 } |
2873 } |
2857 /** |
2874 /** |
2858 * Returns whether the pre-publish panel should be shown |
2875 * Returns whether the pre-publish panel should be shown |
2859 * or skipped when the user clicks the "publish" button. |
2876 * or skipped when the user clicks the "publish" button. |
2860 * |
2877 * |
2861 * @param {Object} state Global application state. |
|
2862 * |
|
2863 * @return {boolean} Whether the pre-publish panel should be shown or not. |
2878 * @return {boolean} Whether the pre-publish panel should be shown or not. |
2864 */ |
2879 */ |
2865 |
2880 |
2866 function selectors_isPublishSidebarEnabled(state) { |
2881 const isPublishSidebarEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'isPublishSidebarEnabled')); |
2867 if (state.preferences.hasOwnProperty('isPublishSidebarEnabled')) { |
|
2868 return state.preferences.isPublishSidebarEnabled; |
|
2869 } |
|
2870 |
|
2871 return PREFERENCES_DEFAULTS.isPublishSidebarEnabled; |
|
2872 } |
|
2873 /** |
2882 /** |
2874 * Return the current block list. |
2883 * Return the current block list. |
2875 * |
2884 * |
2876 * @param {Object} state |
2885 * @param {Object} state |
2877 * @return {Array} Block list. |
2886 * @return {Array} Block list. |
2878 */ |
2887 */ |
2879 |
2888 |
2880 function getEditorBlocks(state) { |
2889 function getEditorBlocks(state) { |
2881 return selectors_getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY; |
2890 return getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY; |
2882 } |
2891 } |
2883 /** |
2892 /** |
2884 * A block selection object. |
2893 * A block selection object. |
2885 * |
2894 * |
2886 * @typedef {Object} WPBlockSelection |
2895 * @typedef {Object} WPBlockSelection |
2902 |
2911 |
2903 function getEditorSelectionStart(state) { |
2912 function getEditorSelectionStart(state) { |
2904 var _getEditedPostAttribu; |
2913 var _getEditedPostAttribu; |
2905 |
2914 |
2906 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { |
2915 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { |
2907 since: '10.0', |
2916 since: '5.8', |
2908 plugin: 'Gutenberg', |
|
2909 alternative: "select('core/editor').getEditorSelection" |
2917 alternative: "select('core/editor').getEditorSelection" |
2910 }); |
2918 }); |
2911 return (_getEditedPostAttribu = selectors_getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu === void 0 ? void 0 : _getEditedPostAttribu.selectionStart; |
2919 return (_getEditedPostAttribu = getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu === void 0 ? void 0 : _getEditedPostAttribu.selectionStart; |
2912 } |
2920 } |
2913 /** |
2921 /** |
2914 * Returns the current selection end. |
2922 * Returns the current selection end. |
2915 * |
2923 * |
2916 * @param {Object} state |
2924 * @param {Object} state |
2921 |
2929 |
2922 function getEditorSelectionEnd(state) { |
2930 function getEditorSelectionEnd(state) { |
2923 var _getEditedPostAttribu2; |
2931 var _getEditedPostAttribu2; |
2924 |
2932 |
2925 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { |
2933 external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", { |
2926 since: '10.0', |
2934 since: '5.8', |
2927 plugin: 'Gutenberg', |
|
2928 alternative: "select('core/editor').getEditorSelection" |
2935 alternative: "select('core/editor').getEditorSelection" |
2929 }); |
2936 }); |
2930 return (_getEditedPostAttribu2 = selectors_getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu2 === void 0 ? void 0 : _getEditedPostAttribu2.selectionEnd; |
2937 return (_getEditedPostAttribu2 = getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu2 === void 0 ? void 0 : _getEditedPostAttribu2.selectionEnd; |
2931 } |
2938 } |
2932 /** |
2939 /** |
2933 * Returns the current selection. |
2940 * Returns the current selection. |
2934 * |
2941 * |
2935 * @param {Object} state |
2942 * @param {Object} state |
2936 * @return {WPBlockSelection} The selection end. |
2943 * @return {WPBlockSelection} The selection end. |
2937 */ |
2944 */ |
2938 |
2945 |
2939 function selectors_getEditorSelection(state) { |
2946 function getEditorSelection(state) { |
2940 return selectors_getEditedPostAttribute(state, 'selection'); |
2947 return getEditedPostAttribute(state, 'selection'); |
2941 } |
2948 } |
2942 /** |
2949 /** |
2943 * Is the editor ready |
2950 * Is the editor ready |
2944 * |
2951 * |
2945 * @param {Object} state |
2952 * @param {Object} state |
2946 * @return {boolean} is Ready. |
2953 * @return {boolean} is Ready. |
2947 */ |
2954 */ |
2948 |
2955 |
2949 function selectors_unstableIsEditorReady(state) { |
2956 function __unstableIsEditorReady(state) { |
2950 return state.isReady; |
2957 return state.isReady; |
2951 } |
2958 } |
2952 /** |
2959 /** |
2953 * Returns the post editor settings. |
2960 * Returns the post editor settings. |
2954 * |
2961 * |
2955 * @param {Object} state Editor state. |
2962 * @param {Object} state Editor state. |
2956 * |
2963 * |
2957 * @return {Object} The editor settings object. |
2964 * @return {Object} The editor settings object. |
2958 */ |
2965 */ |
2959 |
2966 |
2960 function selectors_getEditorSettings(state) { |
2967 function getEditorSettings(state) { |
2961 return state.editorSettings; |
2968 return state.editorSettings; |
2962 } |
2969 } |
2963 /* |
2970 /* |
2964 * Backward compatibility |
2971 * Backward compatibility |
2965 */ |
2972 */ |
2992 }); |
2999 }); |
2993 return false; |
3000 return false; |
2994 } |
3001 } |
2995 |
3002 |
2996 function getBlockEditorSelector(name) { |
3003 function getBlockEditorSelector(name) { |
2997 return Object(external_wp_data_["createRegistrySelector"])(select => (state, ...args) => { |
3004 return (0,external_wp_data_namespaceObject.createRegistrySelector)(select => function (state) { |
2998 external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { |
3005 external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', { |
2999 since: '5.3', |
3006 since: '5.3', |
3000 alternative: "`wp.data.select( 'core/block-editor' )." + name + '`' |
3007 alternative: "`wp.data.select( 'core/block-editor' )." + name + '`', |
3008 version: '6.2' |
|
3001 }); |
3009 }); |
3002 return select('core/block-editor')[name](...args); |
3010 |
3011 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
|
3012 args[_key - 1] = arguments[_key]; |
|
3013 } |
|
3014 |
|
3015 return select(external_wp_blockEditor_namespaceObject.store)[name](...args); |
|
3003 }); |
3016 }); |
3004 } |
3017 } |
3005 /** |
3018 /** |
3006 * @see getBlockName in core/block-editor store. |
3019 * @see getBlockName in core/block-editor store. |
3007 */ |
3020 */ |
3025 const getBlock = getBlockEditorSelector('getBlock'); |
3038 const getBlock = getBlockEditorSelector('getBlock'); |
3026 /** |
3039 /** |
3027 * @see getBlocks in core/block-editor store. |
3040 * @see getBlocks in core/block-editor store. |
3028 */ |
3041 */ |
3029 |
3042 |
3030 const selectors_getBlocks = getBlockEditorSelector('getBlocks'); |
3043 const getBlocks = getBlockEditorSelector('getBlocks'); |
3031 /** |
|
3032 * @see __unstableGetBlockWithoutInnerBlocks in core/block-editor store. |
|
3033 */ |
|
3034 |
|
3035 const __unstableGetBlockWithoutInnerBlocks = getBlockEditorSelector('__unstableGetBlockWithoutInnerBlocks'); |
|
3036 /** |
3044 /** |
3037 * @see getClientIdsOfDescendants in core/block-editor store. |
3045 * @see getClientIdsOfDescendants in core/block-editor store. |
3038 */ |
3046 */ |
3039 |
3047 |
3040 const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); |
3048 const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants'); |
3045 const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); |
3053 const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants'); |
3046 /** |
3054 /** |
3047 * @see getGlobalBlockCount in core/block-editor store. |
3055 * @see getGlobalBlockCount in core/block-editor store. |
3048 */ |
3056 */ |
3049 |
3057 |
3050 const selectors_getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); |
3058 const getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount'); |
3051 /** |
3059 /** |
3052 * @see getBlocksByClientId in core/block-editor store. |
3060 * @see getBlocksByClientId in core/block-editor store. |
3053 */ |
3061 */ |
3054 |
3062 |
3055 const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); |
3063 const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId'); |
3272 */ |
3280 */ |
3273 |
3281 |
3274 function __experimentalGetDefaultTemplateTypes(state) { |
3282 function __experimentalGetDefaultTemplateTypes(state) { |
3275 var _getEditorSettings; |
3283 var _getEditorSettings; |
3276 |
3284 |
3277 return (_getEditorSettings = selectors_getEditorSettings(state)) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings.defaultTemplateTypes; |
3285 return (_getEditorSettings = getEditorSettings(state)) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings.defaultTemplateTypes; |
3278 } |
3286 } |
3279 /** |
3287 /** |
3280 * Returns the default template part areas. |
3288 * Returns the default template part areas. |
3281 * |
3289 * |
3282 * @param {Object} state Global application state. |
3290 * @param {Object} state Global application state. |
3283 * |
3291 * |
3284 * @return {Array} The template part areas. |
3292 * @return {Array} The template part areas. |
3285 */ |
3293 */ |
3286 |
3294 |
3287 const __experimentalGetDefaultTemplatePartAreas = Object(rememo["a" /* default */])(state => { |
3295 const __experimentalGetDefaultTemplatePartAreas = rememo(state => { |
3288 var _getEditorSettings2; |
3296 var _getEditorSettings2; |
3289 |
3297 |
3290 const areas = ((_getEditorSettings2 = selectors_getEditorSettings(state)) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2.defaultTemplatePartAreas) || []; |
3298 const areas = ((_getEditorSettings2 = getEditorSettings(state)) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2.defaultTemplatePartAreas) || []; |
3291 return areas === null || areas === void 0 ? void 0 : areas.map(item => { |
3299 return areas === null || areas === void 0 ? void 0 : areas.map(item => { |
3292 return { ...item, |
3300 return { ...item, |
3293 icon: getTemplatePartIcon(item.icon) |
3301 icon: getTemplatePartIcon(item.icon) |
3294 }; |
3302 }; |
3295 }); |
3303 }); |
3296 }, state => { |
3304 }, state => { |
3297 var _getEditorSettings3; |
3305 var _getEditorSettings3; |
3298 |
3306 |
3299 return [(_getEditorSettings3 = selectors_getEditorSettings(state)) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3.defaultTemplatePartAreas]; |
3307 return [(_getEditorSettings3 = getEditorSettings(state)) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3.defaultTemplatePartAreas]; |
3300 }); |
3308 }); |
3301 /** |
3309 /** |
3302 * Returns a default template type searched by slug. |
3310 * Returns a default template type searched by slug. |
3303 * |
3311 * |
3304 * @param {Object} state Global application state. |
3312 * @param {Object} state Global application state. |
3305 * @param {string} slug The template type slug. |
3313 * @param {string} slug The template type slug. |
3306 * |
3314 * |
3307 * @return {Object} The template type. |
3315 * @return {Object} The template type. |
3308 */ |
3316 */ |
3309 |
3317 |
3310 const __experimentalGetDefaultTemplateType = Object(rememo["a" /* default */])((state, slug) => Object(external_lodash_["find"])(__experimentalGetDefaultTemplateTypes(state), { |
3318 const __experimentalGetDefaultTemplateType = rememo((state, slug) => (0,external_lodash_namespaceObject.find)(__experimentalGetDefaultTemplateTypes(state), { |
3311 slug |
3319 slug |
3312 }) || {}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]); |
3320 }) || {}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]); |
3313 /** |
3321 /** |
3314 * Given a template entity, return information about it which is ready to be |
3322 * Given a template entity, return information about it which is ready to be |
3315 * rendered, such as the title, description, and icon. |
3323 * rendered, such as the title, description, and icon. |
3316 * |
3324 * |
3317 * @param {Object} state Global application state. |
3325 * @param {Object} state Global application state. |
3318 * @param {Object} template The template for which we need information. |
3326 * @param {Object} template The template for which we need information. |
3319 * @return {Object} Information about the template, including title, description, and icon. |
3327 * @return {Object} Information about the template, including title, description, and icon. |
3320 */ |
3328 */ |
3321 |
3329 |
3322 function __experimentalGetTemplateInfo(state, template) { |
3330 function __experimentalGetTemplateInfo(state, template) { |
3336 const { |
3344 const { |
3337 title: defaultTitle, |
3345 title: defaultTitle, |
3338 description: defaultDescription |
3346 description: defaultDescription |
3339 } = __experimentalGetDefaultTemplateType(state, slug); |
3347 } = __experimentalGetDefaultTemplateType(state, slug); |
3340 |
3348 |
3341 const templateTitle = Object(external_lodash_["isString"])(title) ? title : title === null || title === void 0 ? void 0 : title.rendered; |
3349 const templateTitle = (0,external_lodash_namespaceObject.isString)(title) ? title : title === null || title === void 0 ? void 0 : title.rendered; |
3342 const templateDescription = Object(external_lodash_["isString"])(excerpt) ? excerpt : excerpt === null || excerpt === void 0 ? void 0 : excerpt.raw; |
3350 const templateDescription = (0,external_lodash_namespaceObject.isString)(excerpt) ? excerpt : excerpt === null || excerpt === void 0 ? void 0 : excerpt.raw; |
3343 const templateIcon = ((_experimentalGetDefa = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)) === null || _experimentalGetDefa === void 0 ? void 0 : _experimentalGetDefa.icon) || layout["a" /* default */]; |
3351 const templateIcon = ((_experimentalGetDefa = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)) === null || _experimentalGetDefa === void 0 ? void 0 : _experimentalGetDefa.icon) || library_layout; |
3344 return { |
3352 return { |
3345 title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, |
3353 title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug, |
3346 description: templateDescription || defaultDescription, |
3354 description: templateDescription || defaultDescription, |
3347 icon: templateIcon |
3355 icon: templateIcon |
3348 }; |
3356 }; |
3349 } |
3357 } |
3350 |
3358 /** |
3351 // EXTERNAL MODULE: external ["wp","notices"] |
3359 * Returns a post type label depending on the current post. |
3352 var external_wp_notices_ = __webpack_require__("onLe"); |
3360 * |
3353 |
3361 * @param {Object} state Global application state. |
3354 // EXTERNAL MODULE: external ["wp","i18n"] |
3362 * |
3355 var external_wp_i18n_ = __webpack_require__("l3Sj"); |
3363 * @return {string|undefined} The post type label if available, otherwise undefined. |
3356 |
3364 */ |
3357 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js |
3365 |
3366 const getPostTypeLabel = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { |
|
3367 var _postType$labels; |
|
3368 |
|
3369 const currentPostType = getCurrentPostType(state); |
|
3370 const postType = select(external_wp_coreData_namespaceObject.store).getPostType(currentPostType); // Disable reason: Post type labels object is shaped like this. |
|
3371 // eslint-disable-next-line camelcase |
|
3372 |
|
3373 return postType === null || postType === void 0 ? void 0 : (_postType$labels = postType.labels) === null || _postType$labels === void 0 ? void 0 : _postType$labels.singular_name; |
|
3374 }); |
|
3375 |
|
3376 ;// CONCATENATED MODULE: external ["wp","apiFetch"] |
|
3377 var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; |
|
3378 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
|
3379 ;// CONCATENATED MODULE: external ["wp","notices"] |
|
3380 var external_wp_notices_namespaceObject = window["wp"]["notices"]; |
|
3381 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/local-autosave.js |
|
3382 /** |
|
3383 * Function returning a sessionStorage key to set or retrieve a given post's |
|
3384 * automatic session backup. |
|
3385 * |
|
3386 * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's |
|
3387 * `loggedout` handler can clear sessionStorage of any user-private content. |
|
3388 * |
|
3389 * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 |
|
3390 * |
|
3391 * @param {string} postId Post ID. |
|
3392 * @param {boolean} isPostNew Whether post new. |
|
3393 * |
|
3394 * @return {string} sessionStorage key |
|
3395 */ |
|
3396 function postKey(postId, isPostNew) { |
|
3397 return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`; |
|
3398 } |
|
3399 |
|
3400 function localAutosaveGet(postId, isPostNew) { |
|
3401 return window.sessionStorage.getItem(postKey(postId, isPostNew)); |
|
3402 } |
|
3403 function localAutosaveSet(postId, isPostNew, title, content, excerpt) { |
|
3404 window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({ |
|
3405 post_title: title, |
|
3406 content, |
|
3407 excerpt |
|
3408 })); |
|
3409 } |
|
3410 function localAutosaveClear(postId, isPostNew) { |
|
3411 window.sessionStorage.removeItem(postKey(postId, isPostNew)); |
|
3412 } |
|
3413 |
|
3414 ;// CONCATENATED MODULE: external ["wp","i18n"] |
|
3415 var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
|
3416 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js |
|
3358 /** |
3417 /** |
3359 * WordPress dependencies |
3418 * WordPress dependencies |
3360 */ |
3419 */ |
3361 |
3420 |
3362 /** |
3421 /** |
3383 previousPost, |
3442 previousPost, |
3384 post, |
3443 post, |
3385 postType |
3444 postType |
3386 } = data; // Autosaves are neither shown a notice nor redirected. |
3445 } = data; // Autosaves are neither shown a notice nor redirected. |
3387 |
3446 |
3388 if (Object(external_lodash_["get"])(data.options, ['isAutosave'])) { |
3447 if ((0,external_lodash_namespaceObject.get)(data.options, ['isAutosave'])) { |
3389 return []; |
3448 return []; |
3449 } // No notice is shown after trashing a post |
|
3450 |
|
3451 |
|
3452 if (post.status === 'trash' && previousPost.status !== 'trash') { |
|
3453 return []; |
|
3390 } |
3454 } |
3391 |
3455 |
3392 const publishStatus = ['publish', 'private', 'future']; |
3456 const publishStatus = ['publish', 'private', 'future']; |
3393 const isPublished = Object(external_lodash_["includes"])(publishStatus, previousPost.status); |
3457 const isPublished = (0,external_lodash_namespaceObject.includes)(publishStatus, previousPost.status); |
3394 const willPublish = Object(external_lodash_["includes"])(publishStatus, post.status); |
3458 const willPublish = (0,external_lodash_namespaceObject.includes)(publishStatus, post.status); |
3395 let noticeMessage; |
3459 let noticeMessage; |
3396 let shouldShowLink = Object(external_lodash_["get"])(postType, ['viewable'], false); |
3460 let shouldShowLink = (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false); |
3461 let isDraft; // Always should a notice, which will be spoken for accessibility. |
|
3397 |
3462 |
3398 if (!isPublished && !willPublish) { |
3463 if (!isPublished && !willPublish) { |
3399 // If saving a non-published post, don't show notice. |
3464 // If saving a non-published post, don't show notice. |
3400 noticeMessage = null; |
3465 noticeMessage = (0,external_wp_i18n_namespaceObject.__)('Draft saved.'); |
3466 isDraft = true; |
|
3401 } else if (isPublished && !willPublish) { |
3467 } else if (isPublished && !willPublish) { |
3402 // If undoing publish status, show specific notice |
3468 // If undoing publish status, show specific notice. |
3403 noticeMessage = postType.labels.item_reverted_to_draft; |
3469 noticeMessage = postType.labels.item_reverted_to_draft; |
3404 shouldShowLink = false; |
3470 shouldShowLink = false; |
3405 } else if (!isPublished && willPublish) { |
3471 } else if (!isPublished && willPublish) { |
3406 // If publishing or scheduling a post, show the corresponding |
3472 // If publishing or scheduling a post, show the corresponding |
3407 // publish message |
3473 // publish message. |
3408 noticeMessage = { |
3474 noticeMessage = { |
3409 publish: postType.labels.item_published, |
3475 publish: postType.labels.item_published, |
3410 private: postType.labels.item_published_privately, |
3476 private: postType.labels.item_published_privately, |
3411 future: postType.labels.item_scheduled |
3477 future: postType.labels.item_scheduled |
3412 }[post.status]; |
3478 }[post.status]; |
3413 } else { |
3479 } else { |
3414 // Generic fallback notice |
3480 // Generic fallback notice. |
3415 noticeMessage = postType.labels.item_updated; |
3481 noticeMessage = postType.labels.item_updated; |
3416 } |
3482 } |
3417 |
3483 |
3418 if (noticeMessage) { |
3484 const actions = []; |
3419 const actions = []; |
3485 |
3420 |
3486 if (shouldShowLink) { |
3421 if (shouldShowLink) { |
3487 actions.push({ |
3422 actions.push({ |
3488 label: isDraft ? (0,external_wp_i18n_namespaceObject.__)('View Preview') : postType.labels.view_item, |
3423 label: postType.labels.view_item, |
3489 url: post.link |
3424 url: post.link |
3490 }); |
3425 }); |
3491 } |
3426 } |
3492 |
3427 |
3493 return [noticeMessage, { |
3428 return [noticeMessage, { |
3494 id: SAVE_POST_NOTICE_ID, |
3429 id: SAVE_POST_NOTICE_ID, |
3495 type: 'snackbar', |
3430 type: 'snackbar', |
3496 actions |
3431 actions |
3497 }]; |
3432 }]; |
|
3433 } |
|
3434 |
|
3435 return []; |
|
3436 } |
3498 } |
3437 /** |
3499 /** |
3438 * Builds the fail notification arguments for dispatch. |
3500 * Builds the fail notification arguments for dispatch. |
3439 * |
3501 * |
3440 * @param {Object} data Incoming data to build the arguments with. |
3502 * @param {Object} data Incoming data to build the arguments with. |
3456 return []; |
3518 return []; |
3457 } |
3519 } |
3458 |
3520 |
3459 const publishStatus = ['publish', 'private', 'future']; |
3521 const publishStatus = ['publish', 'private', 'future']; |
3460 const isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message |
3522 const isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message |
3461 // Unless we publish an "updating failed" message |
3523 // Unless we publish an "updating failed" message. |
3462 |
3524 |
3463 const messages = { |
3525 const messages = { |
3464 publish: Object(external_wp_i18n_["__"])('Publishing failed.'), |
3526 publish: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), |
3465 private: Object(external_wp_i18n_["__"])('Publishing failed.'), |
3527 private: (0,external_wp_i18n_namespaceObject.__)('Publishing failed.'), |
3466 future: Object(external_wp_i18n_["__"])('Scheduling failed.') |
3528 future: (0,external_wp_i18n_namespaceObject.__)('Scheduling failed.') |
3467 }; |
3529 }; |
3468 let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_wp_i18n_["__"])('Updating failed.'); // Check if message string contains HTML. Notice text is currently only |
3530 let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : (0,external_wp_i18n_namespaceObject.__)('Updating failed.'); // Check if message string contains HTML. Notice text is currently only |
3469 // supported as plaintext, and stripping the tags may muddle the meaning. |
3531 // supported as plaintext, and stripping the tags may muddle the meaning. |
3470 |
3532 |
3471 if (error.message && !/<\/?[^>]*>/.test(error.message)) { |
3533 if (error.message && !/<\/?[^>]*>/.test(error.message)) { |
3472 noticeMessage = [noticeMessage, error.message].join(' '); |
3534 noticeMessage = [noticeMessage, error.message].join(' '); |
3473 } |
3535 } |
3483 * |
3545 * |
3484 * @return {Array} Arguments for dispatch. |
3546 * @return {Array} Arguments for dispatch. |
3485 */ |
3547 */ |
3486 |
3548 |
3487 function getNotificationArgumentsForTrashFail(data) { |
3549 function getNotificationArgumentsForTrashFail(data) { |
3488 return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : Object(external_wp_i18n_["__"])('Trashing failed'), { |
3550 return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : (0,external_wp_i18n_namespaceObject.__)('Trashing failed'), { |
3489 id: TRASH_POST_NOTICE_ID |
3551 id: TRASH_POST_NOTICE_ID |
3490 }]; |
3552 }]; |
3491 } |
3553 } |
3492 |
3554 |
3493 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js |
3555 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js |
3494 /** |
3556 /** |
3495 * External dependencies |
3557 * External dependencies |
3496 */ |
3558 */ |
3497 |
3559 |
3498 /** |
3560 /** |
3502 |
3564 |
3503 |
3565 |
3504 |
3566 |
3505 |
3567 |
3506 |
3568 |
3569 |
|
3570 |
|
3507 /** |
3571 /** |
3508 * Internal dependencies |
3572 * Internal dependencies |
3509 */ |
3573 */ |
3574 |
|
3510 |
3575 |
3511 |
3576 |
3512 |
3577 |
3513 /** |
3578 /** |
3514 * Returns an action generator used in signalling that editor has initialized with |
3579 * Returns an action generator used in signalling that editor has initialized with |
3515 * the specified post object and editor settings. |
3580 * the specified post object and editor settings. |
3516 * |
3581 * |
3517 * @param {Object} post Post object. |
3582 * @param {Object} post Post object. |
3518 * @param {Object} edits Initial edited attributes object. |
3583 * @param {Object} edits Initial edited attributes object. |
3519 * @param {Array?} template Block Template. |
3584 * @param {Array?} template Block Template. |
3520 */ |
3585 */ |
3521 |
3586 |
3522 function* actions_setupEditor(post, edits, template) { |
3587 const setupEditor = (post, edits, template) => _ref => { |
3523 // In order to ensure maximum of a single parse during setup, edits are |
3588 let { |
3524 // included as part of editor setup action. Assume edited content as |
3589 dispatch |
3525 // canonical if provided, falling back to post. |
3590 } = _ref; |
3526 let content; |
3591 dispatch.setupEditorState(post); // Apply a template for new posts only, if exists. |
3527 |
|
3528 if (Object(external_lodash_["has"])(edits, ['content'])) { |
|
3529 content = edits.content; |
|
3530 } else { |
|
3531 content = post.content.raw; |
|
3532 } |
|
3533 |
|
3534 let blocks = Object(external_wp_blocks_["parse"])(content); // Apply a template for new posts only, if exists. |
|
3535 |
3592 |
3536 const isNewPost = post.status === 'auto-draft'; |
3593 const isNewPost = post.status === 'auto-draft'; |
3537 |
3594 |
3538 if (isNewPost && template) { |
3595 if (isNewPost && template) { |
3539 blocks = Object(external_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template); |
3596 // In order to ensure maximum of a single parse during setup, edits are |
3540 } |
3597 // included as part of editor setup action. Assume edited content as |
3541 |
3598 // canonical if provided, falling back to post. |
3542 yield resetPost(post); |
3599 let content; |
3543 yield { |
3600 |
3544 type: 'SETUP_EDITOR', |
3601 if ((0,external_lodash_namespaceObject.has)(edits, ['content'])) { |
3545 post, |
3602 content = edits.content; |
3546 edits, |
3603 } else { |
3547 template |
3604 content = post.content.raw; |
3548 }; |
3605 } |
3549 yield actions_resetEditorBlocks(blocks, { |
3606 |
3550 __unstableShouldCreateUndoLevel: false |
3607 let blocks = (0,external_wp_blocks_namespaceObject.parse)(content); |
3551 }); |
3608 blocks = (0,external_wp_blocks_namespaceObject.synchronizeBlocksWithTemplate)(blocks, template); |
3552 yield setupEditorState(post); |
3609 dispatch.resetEditorBlocks(blocks, { |
3553 |
3610 __unstableShouldCreateUndoLevel: false |
3554 if (edits && Object.keys(edits).some(key => edits[key] !== (Object(external_lodash_["has"])(post, [key, 'raw']) ? post[key].raw : post[key]))) { |
3611 }); |
3555 yield actions_editPost(edits); |
3612 } |
3556 } |
3613 |
3557 } |
3614 if (edits && Object.values(edits).some(_ref2 => { |
3615 var _post$key$raw, _post$key; |
|
3616 |
|
3617 let [key, edit] = _ref2; |
|
3618 return edit !== ((_post$key$raw = (_post$key = post[key]) === null || _post$key === void 0 ? void 0 : _post$key.raw) !== null && _post$key$raw !== void 0 ? _post$key$raw : post[key]); |
|
3619 })) { |
|
3620 dispatch.editPost(edits); |
|
3621 } |
|
3622 }; |
|
3558 /** |
3623 /** |
3559 * Returns an action object signalling that the editor is being destroyed and |
3624 * Returns an action object signalling that the editor is being destroyed and |
3560 * that any necessary state or side-effect cleanup should occur. |
3625 * that any necessary state or side-effect cleanup should occur. |
3561 * |
3626 * |
3562 * @return {Object} Action object. |
3627 * @return {Object} Action object. |
3563 */ |
3628 */ |
3564 |
3629 |
3565 function actions_experimentalTearDownEditor() { |
3630 function __experimentalTearDownEditor() { |
3566 return { |
3631 return { |
3567 type: 'TEAR_DOWN_EDITOR' |
3632 type: 'TEAR_DOWN_EDITOR' |
3568 }; |
3633 }; |
3569 } |
3634 } |
3570 /** |
3635 /** |
3571 * Returns an action object used in signalling that the latest version of the |
3636 * Returns an action object used in signalling that the latest version of the |
3572 * post has been received, either by initialization or save. |
3637 * post has been received, either by initialization or save. |
3573 * |
3638 * |
3574 * @param {Object} post Post object. |
3639 * @deprecated Since WordPress 6.0. |
3575 * |
3640 */ |
3576 * @return {Object} Action object. |
3641 |
3577 */ |
3642 function resetPost() { |
3578 |
3643 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).resetPost", { |
3579 function resetPost(post) { |
3644 since: '6.0', |
3580 return { |
3645 version: '6.3', |
3581 type: 'RESET_POST', |
3646 alternative: 'Initialize the editor with the setupEditorState action' |
3582 post |
|
3583 }; |
|
3584 } |
|
3585 /** |
|
3586 * Returns an action object used in signalling that the latest autosave of the |
|
3587 * post has been received, by initialization or autosave. |
|
3588 * |
|
3589 * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )` |
|
3590 * selector from the '@wordpress/core-data' package. |
|
3591 * |
|
3592 * @param {Object} newAutosave Autosave post object. |
|
3593 * |
|
3594 * @return {Object} Action object. |
|
3595 */ |
|
3596 |
|
3597 function* resetAutosave(newAutosave) { |
|
3598 external_wp_deprecated_default()('resetAutosave action (`core/editor` store)', { |
|
3599 since: '5.3', |
|
3600 alternative: 'receiveAutosaves action (`core` store)' |
|
3601 }); |
|
3602 const postId = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostId'); |
|
3603 yield external_wp_data_["controls"].dispatch('core', 'receiveAutosaves', postId, newAutosave); |
|
3604 return { |
|
3605 type: '__INERT__' |
|
3606 }; |
|
3607 } |
|
3608 /** |
|
3609 * Action for dispatching that a post update request has started. |
|
3610 * |
|
3611 * @param {Object} options |
|
3612 * |
|
3613 * @return {Object} An action object |
|
3614 */ |
|
3615 |
|
3616 function __experimentalRequestPostUpdateStart(options = {}) { |
|
3617 return { |
|
3618 type: 'REQUEST_POST_UPDATE_START', |
|
3619 options |
|
3620 }; |
|
3621 } |
|
3622 /** |
|
3623 * Action for dispatching that a post update request has finished. |
|
3624 * |
|
3625 * @param {Object} options |
|
3626 * |
|
3627 * @return {Object} An action object |
|
3628 */ |
|
3629 |
|
3630 function __experimentalRequestPostUpdateFinish(options = {}) { |
|
3631 return { |
|
3632 type: 'REQUEST_POST_UPDATE_FINISH', |
|
3633 options |
|
3634 }; |
|
3635 } |
|
3636 /** |
|
3637 * Returns an action object used in signalling that a patch of updates for the |
|
3638 * latest version of the post have been received. |
|
3639 * |
|
3640 * @return {Object} Action object. |
|
3641 * @deprecated since Gutenberg 9.7.0. |
|
3642 */ |
|
3643 |
|
3644 function updatePost() { |
|
3645 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { |
|
3646 since: '5.7', |
|
3647 alternative: 'User the core entitires store instead' |
|
3648 }); |
3647 }); |
3649 return { |
3648 return { |
3650 type: 'DO_NOTHING' |
3649 type: 'DO_NOTHING' |
3651 }; |
3650 }; |
3652 } |
3651 } |
3653 /** |
3652 /** |
3653 * Returns an action object used in signalling that a patch of updates for the |
|
3654 * latest version of the post have been received. |
|
3655 * |
|
3656 * @return {Object} Action object. |
|
3657 * @deprecated since Gutenberg 9.7.0. |
|
3658 */ |
|
3659 |
|
3660 function updatePost() { |
|
3661 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", { |
|
3662 since: '5.7', |
|
3663 alternative: 'Use the core entities store instead' |
|
3664 }); |
|
3665 return { |
|
3666 type: 'DO_NOTHING' |
|
3667 }; |
|
3668 } |
|
3669 /** |
|
3654 * Returns an action object used to setup the editor state when first opening |
3670 * Returns an action object used to setup the editor state when first opening |
3655 * an editor. |
3671 * an editor. |
3656 * |
3672 * |
3657 * @param {Object} post Post object. |
3673 * @param {Object} post Post object. |
3658 * |
3674 * |
3659 * @return {Object} Action object. |
3675 * @return {Object} Action object. |
3660 */ |
3676 */ |
3661 |
3677 |
3662 function setupEditorState(post) { |
3678 function setupEditorState(post) { |
3669 * Returns an action object used in signalling that attributes of the post have |
3685 * Returns an action object used in signalling that attributes of the post have |
3670 * been edited. |
3686 * been edited. |
3671 * |
3687 * |
3672 * @param {Object} edits Post attributes to edit. |
3688 * @param {Object} edits Post attributes to edit. |
3673 * @param {Object} options Options for the edit. |
3689 * @param {Object} options Options for the edit. |
3674 * |
3690 */ |
3675 * @yield {Object} Action object or control. |
3691 |
3676 */ |
3692 const editPost = (edits, options) => _ref3 => { |
3677 |
3693 let { |
3678 function* actions_editPost(edits, options) { |
3694 select, |
3695 registry |
|
3696 } = _ref3; |
|
3679 const { |
3697 const { |
3680 id, |
3698 id, |
3681 type |
3699 type |
3682 } = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); |
3700 } = select.getCurrentPost(); |
3683 yield external_wp_data_["controls"].dispatch('core', 'editEntityRecord', 'postType', type, id, edits, options); |
3701 registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', type, id, edits, options); |
3684 } |
3702 }; |
3685 /** |
3703 /** |
3686 * Action generator for saving the current post in the editor. |
3704 * Action for saving the current post in the editor. |
3687 * |
3705 * |
3688 * @param {Object} options |
3706 * @param {Object} options |
3689 */ |
3707 */ |
3690 |
3708 |
3691 function* actions_savePost(options = {}) { |
3709 const savePost = function () { |
3692 if (!(yield external_wp_data_["controls"].select(STORE_NAME, 'isEditedPostSaveable'))) { |
3710 let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
3693 return; |
3711 return async _ref4 => { |
3694 } |
3712 let { |
3695 |
3713 select, |
3696 let edits = { |
3714 dispatch, |
3697 content: yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostContent') |
3715 registry |
3698 }; |
3716 } = _ref4; |
3699 |
3717 |
3700 if (!options.isAutosave) { |
3718 if (!select.isEditedPostSaveable()) { |
3701 yield external_wp_data_["controls"].dispatch(STORE_NAME, 'editPost', edits, { |
3719 return; |
3702 undoIgnore: true |
|
3703 }); |
|
3704 } |
|
3705 |
|
3706 yield __experimentalRequestPostUpdateStart(options); |
|
3707 const previousRecord = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); |
|
3708 edits = { |
|
3709 id: previousRecord.id, |
|
3710 ...(yield external_wp_data_["controls"].select('core', 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id)), |
|
3711 ...edits |
|
3712 }; |
|
3713 yield external_wp_data_["controls"].dispatch('core', 'saveEntityRecord', 'postType', previousRecord.type, edits, options); |
|
3714 yield __experimentalRequestPostUpdateFinish(options); |
|
3715 const error = yield external_wp_data_["controls"].select('core', 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id); |
|
3716 |
|
3717 if (error) { |
|
3718 const args = getNotificationArgumentsForSaveFail({ |
|
3719 post: previousRecord, |
|
3720 edits, |
|
3721 error |
|
3722 }); |
|
3723 |
|
3724 if (args.length) { |
|
3725 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', ...args); |
|
3726 } |
3720 } |
3727 } else { |
3721 |
3728 const updatedRecord = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); |
3722 const content = select.getEditedPostContent(); |
3729 const args = getNotificationArgumentsForSaveSuccess({ |
3723 |
3730 previousPost: previousRecord, |
3724 if (!options.isAutosave) { |
3731 post: updatedRecord, |
3725 dispatch.editPost({ |
3732 postType: yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', updatedRecord.type), |
3726 content |
3727 }, { |
|
3728 undoIgnore: true |
|
3729 }); |
|
3730 } |
|
3731 |
|
3732 const previousRecord = select.getCurrentPost(); |
|
3733 const edits = { |
|
3734 id: previousRecord.id, |
|
3735 ...registry.select(external_wp_coreData_namespaceObject.store).getEntityRecordNonTransientEdits('postType', previousRecord.type, previousRecord.id), |
|
3736 content |
|
3737 }; |
|
3738 dispatch({ |
|
3739 type: 'REQUEST_POST_UPDATE_START', |
|
3733 options |
3740 options |
3734 }); |
3741 }); |
3735 |
3742 await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', previousRecord.type, edits, options); |
3736 if (args.length) { |
3743 dispatch({ |
3737 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createSuccessNotice', ...args); |
3744 type: 'REQUEST_POST_UPDATE_FINISH', |
3738 } // Make sure that any edits after saving create an undo level and are |
3745 options |
3739 // considered for change detection. |
3746 }); |
3740 |
3747 const error = registry.select(external_wp_coreData_namespaceObject.store).getLastEntitySaveError('postType', previousRecord.type, previousRecord.id); |
3741 |
3748 |
3742 if (!options.isAutosave) { |
3749 if (error) { |
3743 yield external_wp_data_["controls"].dispatch('core/block-editor', '__unstableMarkLastChangeAsPersistent'); |
3750 const args = getNotificationArgumentsForSaveFail({ |
3751 post: previousRecord, |
|
3752 edits, |
|
3753 error |
|
3754 }); |
|
3755 |
|
3756 if (args.length) { |
|
3757 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...args); |
|
3758 } |
|
3759 } else { |
|
3760 const updatedRecord = select.getCurrentPost(); |
|
3761 const args = getNotificationArgumentsForSaveSuccess({ |
|
3762 previousPost: previousRecord, |
|
3763 post: updatedRecord, |
|
3764 postType: await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(updatedRecord.type), |
|
3765 options |
|
3766 }); |
|
3767 |
|
3768 if (args.length) { |
|
3769 registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(...args); |
|
3770 } // Make sure that any edits after saving create an undo level and are |
|
3771 // considered for change detection. |
|
3772 |
|
3773 |
|
3774 if (!options.isAutosave) { |
|
3775 registry.dispatch(external_wp_blockEditor_namespaceObject.store).__unstableMarkLastChangeAsPersistent(); |
|
3776 } |
|
3744 } |
3777 } |
3745 } |
3778 }; |
3746 } |
3779 }; |
3747 /** |
3780 /** |
3748 * Action generator for handling refreshing the current post. |
3781 * Action for refreshing the current post. |
3749 */ |
3782 * |
3750 |
3783 * @deprecated Since WordPress 6.0. |
3751 function* refreshPost() { |
3784 */ |
3752 const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); |
3785 |
3753 const postTypeSlug = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostType'); |
3786 function refreshPost() { |
3754 const postType = yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', postTypeSlug); |
3787 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).refreshPost", { |
3755 const newPost = yield Object(external_wp_dataControls_["apiFetch"])({ |
3788 since: '6.0', |
3756 // Timestamp arg allows caller to bypass browser caching, which is |
3789 version: '6.3', |
3757 // expected for this specific function. |
3790 alternative: 'Use the core entities store instead' |
3758 path: `/wp/v2/${postType.rest_base}/${post.id}` + `?context=edit&_timestamp=${Date.now()}` |
|
3759 }); |
3791 }); |
3760 yield external_wp_data_["controls"].dispatch(STORE_NAME, 'resetPost', newPost); |
3792 return { |
3761 } |
3793 type: 'DO_NOTHING' |
3762 /** |
3794 }; |
3763 * Action generator for trashing the current post in the editor. |
3795 } |
3764 */ |
3796 /** |
3765 |
3797 * Action for trashing the current post in the editor. |
3766 function* trashPost() { |
3798 */ |
3767 const postTypeSlug = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostType'); |
3799 |
3768 const postType = yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', postTypeSlug); |
3800 const trashPost = () => async _ref5 => { |
3769 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'removeNotice', TRASH_POST_NOTICE_ID); |
3801 let { |
3802 select, |
|
3803 dispatch, |
|
3804 registry |
|
3805 } = _ref5; |
|
3806 const postTypeSlug = select.getCurrentPostType(); |
|
3807 const postType = await registry.resolveSelect(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); |
|
3808 registry.dispatch(external_wp_notices_namespaceObject.store).removeNotice(TRASH_POST_NOTICE_ID); |
|
3770 |
3809 |
3771 try { |
3810 try { |
3772 const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); |
3811 const post = select.getCurrentPost(); |
3773 yield Object(external_wp_dataControls_["apiFetch"])({ |
3812 await external_wp_apiFetch_default()({ |
3774 path: `/wp/v2/${postType.rest_base}/${post.id}`, |
3813 path: `/wp/v2/${postType.rest_base}/${post.id}`, |
3775 method: 'DELETE' |
3814 method: 'DELETE' |
3776 }); |
3815 }); |
3777 yield external_wp_data_["controls"].dispatch(STORE_NAME, 'savePost'); |
3816 await dispatch.savePost(); |
3778 } catch (error) { |
3817 } catch (error) { |
3779 yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', ...getNotificationArgumentsForTrashFail({ |
3818 registry.dispatch(external_wp_notices_namespaceObject.store).createErrorNotice(...getNotificationArgumentsForTrashFail({ |
3780 error |
3819 error |
3781 })); |
3820 })); |
3782 } |
3821 } |
3783 } |
3822 }; |
3784 /** |
3823 /** |
3785 * Action generator used in signalling that the post should autosave. This |
3824 * Action that autosaves the current post. This |
3786 * includes server-side autosaving (default) and client-side (a.k.a. local) |
3825 * includes server-side autosaving (default) and client-side (a.k.a. local) |
3787 * autosaving (e.g. on the Web, the post might be committed to Session |
3826 * autosaving (e.g. on the Web, the post might be committed to Session |
3788 * Storage). |
3827 * Storage). |
3789 * |
3828 * |
3790 * @param {Object?} options Extra flags to identify the autosave. |
3829 * @param {Object?} options Extra flags to identify the autosave. |
3791 */ |
3830 */ |
3792 |
3831 |
3793 function* actions_autosave({ |
3832 const autosave = function () { |
3794 local = false, |
3833 let { |
3795 ...options |
3834 local = false, |
3796 } = {}) { |
3835 ...options |
3797 if (local) { |
3836 } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
3798 const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); |
3837 return async _ref6 => { |
3799 const isPostNew = yield external_wp_data_["controls"].select(STORE_NAME, 'isEditedPostNew'); |
3838 let { |
3800 const title = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'title'); |
3839 select, |
3801 const content = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'content'); |
3840 dispatch |
3802 const excerpt = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'excerpt'); |
3841 } = _ref6; |
3803 yield { |
3842 |
3804 type: 'LOCAL_AUTOSAVE_SET', |
3843 if (local) { |
3805 postId: post.id, |
3844 const post = select.getCurrentPost(); |
3806 isPostNew, |
3845 const isPostNew = select.isEditedPostNew(); |
3807 title, |
3846 const title = select.getEditedPostAttribute('title'); |
3808 content, |
3847 const content = select.getEditedPostAttribute('content'); |
3809 excerpt |
3848 const excerpt = select.getEditedPostAttribute('excerpt'); |
3810 }; |
3849 localAutosaveSet(post.id, isPostNew, title, content, excerpt); |
3811 } else { |
3850 } else { |
3812 yield external_wp_data_["controls"].dispatch(STORE_NAME, 'savePost', { |
3851 await dispatch.savePost({ |
3813 isAutosave: true, |
3852 isAutosave: true, |
3814 ...options |
3853 ...options |
3815 }); |
3854 }); |
3816 } |
3855 } |
3817 } |
3856 }; |
3818 /** |
3857 }; |
3819 * Returns an action object used in signalling that undo history should |
3858 /** |
3820 * restore last popped state. |
3859 * Action that restores last popped state in undo history. |
3821 * |
3860 */ |
3822 * @yield {Object} Action object. |
3861 |
3823 */ |
3862 const redo = () => _ref7 => { |
3824 |
3863 let { |
3825 function* actions_redo() { |
3864 registry |
3826 yield external_wp_data_["controls"].dispatch('core', 'redo'); |
3865 } = _ref7; |
3827 } |
3866 registry.dispatch(external_wp_coreData_namespaceObject.store).redo(); |
3828 /** |
3867 }; |
3829 * Returns an action object used in signalling that undo history should pop. |
3868 /** |
3830 * |
3869 * Action that pops a record from undo history and undoes the edit. |
3831 * @yield {Object} Action object. |
3870 */ |
3832 */ |
3871 |
3833 |
3872 const undo = () => _ref8 => { |
3834 function* actions_undo() { |
3873 let { |
3835 yield external_wp_data_["controls"].dispatch('core', 'undo'); |
3874 registry |
3836 } |
3875 } = _ref8; |
3837 /** |
3876 registry.dispatch(external_wp_coreData_namespaceObject.store).undo(); |
3838 * Returns an action object used in signalling that undo history record should |
3877 }; |
3839 * be created. |
3878 /** |
3840 * |
3879 * Action that creates an undo history record. |
3880 * |
|
3881 * @deprecated Since WordPress 6.0 |
|
3882 */ |
|
3883 |
|
3884 function createUndoLevel() { |
|
3885 external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).createUndoLevel", { |
|
3886 since: '6.0', |
|
3887 version: '6.3', |
|
3888 alternative: 'Use the core entities store instead' |
|
3889 }); |
|
3890 return { |
|
3891 type: 'DO_NOTHING' |
|
3892 }; |
|
3893 } |
|
3894 /** |
|
3895 * Action that locks the editor. |
|
3896 * |
|
3897 * @param {Object} lock Details about the post lock status, user, and nonce. |
|
3841 * @return {Object} Action object. |
3898 * @return {Object} Action object. |
3842 */ |
3899 */ |
3843 |
3900 |
3844 function createUndoLevel() { |
3901 function updatePostLock(lock) { |
3845 return { |
|
3846 type: 'CREATE_UNDO_LEVEL' |
|
3847 }; |
|
3848 } |
|
3849 /** |
|
3850 * Returns an action object used to lock the editor. |
|
3851 * |
|
3852 * @param {Object} lock Details about the post lock status, user, and nonce. |
|
3853 * |
|
3854 * @return {Object} Action object. |
|
3855 */ |
|
3856 |
|
3857 function actions_updatePostLock(lock) { |
|
3858 return { |
3902 return { |
3859 type: 'UPDATE_POST_LOCK', |
3903 type: 'UPDATE_POST_LOCK', |
3860 lock |
3904 lock |
3861 }; |
3905 }; |
3862 } |
3906 } |
3863 /** |
3907 /** |
3864 * Returns an action object used in signalling that the user has enabled the |
3908 * Enable the publish sidebar. |
3865 * publish sidebar. |
3909 */ |
3866 * |
3910 |
3867 * @return {Object} Action object |
3911 const enablePublishSidebar = () => _ref9 => { |
3868 */ |
3912 let { |
3869 |
3913 registry |
3870 function enablePublishSidebar() { |
3914 } = _ref9; |
3871 return { |
3915 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', true); |
3872 type: 'ENABLE_PUBLISH_SIDEBAR' |
3916 }; |
3873 }; |
3917 /** |
3874 } |
3918 * Disables the publish sidebar. |
3875 /** |
3919 */ |
3876 * Returns an action object used in signalling that the user has disabled the |
3920 |
3877 * publish sidebar. |
3921 const disablePublishSidebar = () => _ref10 => { |
3878 * |
3922 let { |
3879 * @return {Object} Action object |
3923 registry |
3880 */ |
3924 } = _ref10; |
3881 |
3925 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'isPublishSidebarEnabled', false); |
3882 function disablePublishSidebar() { |
3926 }; |
3883 return { |
3927 /** |
3884 type: 'DISABLE_PUBLISH_SIDEBAR' |
3928 * Action that locks post saving. |
3885 }; |
3929 * |
3886 } |
3930 * @param {string} lockName The lock name. |
3887 /** |
|
3888 * Returns an action object used to signal that post saving is locked. |
|
3889 * |
|
3890 * @param {string} lockName The lock name. |
|
3891 * |
3931 * |
3892 * @example |
3932 * @example |
3893 * ``` |
3933 * ``` |
3894 * const { subscribe } = wp.data; |
3934 * const { subscribe } = wp.data; |
3895 * |
3935 * |
3933 type: 'LOCK_POST_SAVING', |
3973 type: 'LOCK_POST_SAVING', |
3934 lockName |
3974 lockName |
3935 }; |
3975 }; |
3936 } |
3976 } |
3937 /** |
3977 /** |
3938 * Returns an action object used to signal that post saving is unlocked. |
3978 * Action that unlocks post saving. |
3939 * |
3979 * |
3940 * @param {string} lockName The lock name. |
3980 * @param {string} lockName The lock name. |
3941 * |
3981 * |
3942 * @example |
3982 * @example |
3943 * ``` |
3983 * ``` |
3944 * // Unlock post saving with the lock key `mylock`: |
3984 * // Unlock post saving with the lock key `mylock`: |
3945 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); |
3985 * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' ); |
3953 type: 'UNLOCK_POST_SAVING', |
3993 type: 'UNLOCK_POST_SAVING', |
3954 lockName |
3994 lockName |
3955 }; |
3995 }; |
3956 } |
3996 } |
3957 /** |
3997 /** |
3958 * Returns an action object used to signal that post autosaving is locked. |
3998 * Action that locks post autosaving. |
3959 * |
3999 * |
3960 * @param {string} lockName The lock name. |
4000 * @param {string} lockName The lock name. |
3961 * |
4001 * |
3962 * @example |
4002 * @example |
3963 * ``` |
4003 * ``` |
3964 * // Lock post autosaving with the lock key `mylock`: |
4004 * // Lock post autosaving with the lock key `mylock`: |
3965 * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); |
4005 * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' ); |
3973 type: 'LOCK_POST_AUTOSAVING', |
4013 type: 'LOCK_POST_AUTOSAVING', |
3974 lockName |
4014 lockName |
3975 }; |
4015 }; |
3976 } |
4016 } |
3977 /** |
4017 /** |
3978 * Returns an action object used to signal that post autosaving is unlocked. |
4018 * Action that unlocks post autosaving. |
3979 * |
4019 * |
3980 * @param {string} lockName The lock name. |
4020 * @param {string} lockName The lock name. |
3981 * |
4021 * |
3982 * @example |
4022 * @example |
3983 * ``` |
4023 * ``` |
3984 * // Unlock post saving with the lock key `mylock`: |
4024 * // Unlock post saving with the lock key `mylock`: |
3985 * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); |
4025 * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' ); |
3997 /** |
4037 /** |
3998 * Returns an action object used to signal that the blocks have been updated. |
4038 * Returns an action object used to signal that the blocks have been updated. |
3999 * |
4039 * |
4000 * @param {Array} blocks Block Array. |
4040 * @param {Array} blocks Block Array. |
4001 * @param {?Object} options Optional options. |
4041 * @param {?Object} options Optional options. |
4002 * |
4042 */ |
4003 * @yield {Object} Action object |
4043 |
4004 */ |
4044 const resetEditorBlocks = function (blocks) { |
4005 |
4045 let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
4006 function* actions_resetEditorBlocks(blocks, options = {}) { |
4046 return _ref11 => { |
4007 const { |
4047 let { |
4008 __unstableShouldCreateUndoLevel, |
4048 select, |
4009 selection |
4049 dispatch, |
4010 } = options; |
4050 registry |
4011 const edits = { |
4051 } = _ref11; |
4012 blocks, |
4052 const { |
4013 selection |
4053 __unstableShouldCreateUndoLevel, |
4054 selection |
|
4055 } = options; |
|
4056 const edits = { |
|
4057 blocks, |
|
4058 selection |
|
4059 }; |
|
4060 |
|
4061 if (__unstableShouldCreateUndoLevel !== false) { |
|
4062 const { |
|
4063 id, |
|
4064 type |
|
4065 } = select.getCurrentPost(); |
|
4066 const noChange = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', type, id).blocks === edits.blocks; |
|
4067 |
|
4068 if (noChange) { |
|
4069 registry.dispatch(external_wp_coreData_namespaceObject.store).__unstableCreateUndoLevel('postType', type, id); |
|
4070 |
|
4071 return; |
|
4072 } // We create a new function here on every persistent edit |
|
4073 // to make sure the edit makes the post dirty and creates |
|
4074 // a new undo level. |
|
4075 |
|
4076 |
|
4077 edits.content = _ref12 => { |
|
4078 let { |
|
4079 blocks: blocksForSerialization = [] |
|
4080 } = _ref12; |
|
4081 return (0,external_wp_blocks_namespaceObject.__unstableSerializeAndClean)(blocksForSerialization); |
|
4082 }; |
|
4083 } |
|
4084 |
|
4085 dispatch.editPost(edits); |
|
4014 }; |
4086 }; |
4015 |
4087 }; |
4016 if (__unstableShouldCreateUndoLevel !== false) { |
|
4017 const { |
|
4018 id, |
|
4019 type |
|
4020 } = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost'); |
|
4021 const noChange = (yield external_wp_data_["controls"].select('core', 'getEditedEntityRecord', 'postType', type, id)).blocks === edits.blocks; |
|
4022 |
|
4023 if (noChange) { |
|
4024 return yield external_wp_data_["controls"].dispatch('core', '__unstableCreateUndoLevel', 'postType', type, id); |
|
4025 } // We create a new function here on every persistent edit |
|
4026 // to make sure the edit makes the post dirty and creates |
|
4027 // a new undo level. |
|
4028 |
|
4029 |
|
4030 edits.content = ({ |
|
4031 blocks: blocksForSerialization = [] |
|
4032 }) => Object(external_wp_blocks_["__unstableSerializeAndClean"])(blocksForSerialization); |
|
4033 } |
|
4034 |
|
4035 yield* actions_editPost(edits); |
|
4036 } |
|
4037 /* |
4088 /* |
4038 * Returns an action object used in signalling that the post editor settings have been updated. |
4089 * Returns an action object used in signalling that the post editor settings have been updated. |
4039 * |
4090 * |
4040 * @param {Object} settings Updated settings |
4091 * @param {Object} settings Updated settings |
4041 * |
4092 * |
4042 * @return {Object} Action object |
4093 * @return {Object} Action object |
4043 */ |
4094 */ |
4044 |
4095 |
4045 function actions_updateEditorSettings(settings) { |
4096 function updateEditorSettings(settings) { |
4046 return { |
4097 return { |
4047 type: 'UPDATE_EDITOR_SETTINGS', |
4098 type: 'UPDATE_EDITOR_SETTINGS', |
4048 settings |
4099 settings |
4049 }; |
4100 }; |
4050 } |
4101 } |
4051 /** |
4102 /** |
4052 * Backward compatibility |
4103 * Backward compatibility |
4053 */ |
4104 */ |
4054 |
4105 |
4055 const getBlockEditorAction = name => function* (...args) { |
4106 const getBlockEditorAction = name => function () { |
4056 external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { |
4107 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
4057 since: '5.3', |
4108 args[_key] = arguments[_key]; |
4058 alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`' |
4109 } |
4059 }); |
4110 |
4060 yield external_wp_data_["controls"].dispatch('core/block-editor', name, ...args); |
4111 return _ref13 => { |
4112 let { |
|
4113 registry |
|
4114 } = _ref13; |
|
4115 external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', { |
|
4116 since: '5.3', |
|
4117 alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`', |
|
4118 version: '6.2' |
|
4119 }); |
|
4120 registry.dispatch(external_wp_blockEditor_namespaceObject.store)[name](...args); |
|
4121 }; |
|
4061 }; |
4122 }; |
4062 /** |
4123 /** |
4063 * @see resetBlocks in core/block-editor store. |
4124 * @see resetBlocks in core/block-editor store. |
4064 */ |
4125 */ |
4065 |
4126 |
4082 const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes'); |
4143 const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes'); |
4083 /** |
4144 /** |
4084 * @see selectBlock in core/block-editor store. |
4145 * @see selectBlock in core/block-editor store. |
4085 */ |
4146 */ |
4086 |
4147 |
4087 const actions_selectBlock = getBlockEditorAction('selectBlock'); |
4148 const selectBlock = getBlockEditorAction('selectBlock'); |
4088 /** |
4149 /** |
4089 * @see startMultiSelect in core/block-editor store. |
4150 * @see startMultiSelect in core/block-editor store. |
4090 */ |
4151 */ |
4091 |
4152 |
4092 const startMultiSelect = getBlockEditorAction('startMultiSelect'); |
4153 const startMultiSelect = getBlockEditorAction('startMultiSelect'); |
4102 const multiSelect = getBlockEditorAction('multiSelect'); |
4163 const multiSelect = getBlockEditorAction('multiSelect'); |
4103 /** |
4164 /** |
4104 * @see clearSelectedBlock in core/block-editor store. |
4165 * @see clearSelectedBlock in core/block-editor store. |
4105 */ |
4166 */ |
4106 |
4167 |
4107 const actions_clearSelectedBlock = getBlockEditorAction('clearSelectedBlock'); |
4168 const clearSelectedBlock = getBlockEditorAction('clearSelectedBlock'); |
4108 /** |
4169 /** |
4109 * @see toggleSelection in core/block-editor store. |
4170 * @see toggleSelection in core/block-editor store. |
4110 */ |
4171 */ |
4111 |
4172 |
4112 const toggleSelection = getBlockEditorAction('toggleSelection'); |
4173 const toggleSelection = getBlockEditorAction('toggleSelection'); |
4142 const insertBlock = getBlockEditorAction('insertBlock'); |
4203 const insertBlock = getBlockEditorAction('insertBlock'); |
4143 /** |
4204 /** |
4144 * @see insertBlocks in core/block-editor store. |
4205 * @see insertBlocks in core/block-editor store. |
4145 */ |
4206 */ |
4146 |
4207 |
4147 const actions_insertBlocks = getBlockEditorAction('insertBlocks'); |
4208 const insertBlocks = getBlockEditorAction('insertBlocks'); |
4148 /** |
4209 /** |
4149 * @see showInsertionPoint in core/block-editor store. |
4210 * @see showInsertionPoint in core/block-editor store. |
4150 */ |
4211 */ |
4151 |
4212 |
4152 const showInsertionPoint = getBlockEditorAction('showInsertionPoint'); |
4213 const showInsertionPoint = getBlockEditorAction('showInsertionPoint'); |
4157 const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint'); |
4218 const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint'); |
4158 /** |
4219 /** |
4159 * @see setTemplateValidity in core/block-editor store. |
4220 * @see setTemplateValidity in core/block-editor store. |
4160 */ |
4221 */ |
4161 |
4222 |
4162 const actions_setTemplateValidity = getBlockEditorAction('setTemplateValidity'); |
4223 const setTemplateValidity = getBlockEditorAction('setTemplateValidity'); |
4163 /** |
4224 /** |
4164 * @see synchronizeTemplate in core/block-editor store. |
4225 * @see synchronizeTemplate in core/block-editor store. |
4165 */ |
4226 */ |
4166 |
4227 |
4167 const actions_synchronizeTemplate = getBlockEditorAction('synchronizeTemplate'); |
4228 const synchronizeTemplate = getBlockEditorAction('synchronizeTemplate'); |
4168 /** |
4229 /** |
4169 * @see mergeBlocks in core/block-editor store. |
4230 * @see mergeBlocks in core/block-editor store. |
4170 */ |
4231 */ |
4171 |
4232 |
4172 const mergeBlocks = getBlockEditorAction('mergeBlocks'); |
4233 const mergeBlocks = getBlockEditorAction('mergeBlocks'); |
4207 const exitFormattedText = getBlockEditorAction('exitFormattedText'); |
4268 const exitFormattedText = getBlockEditorAction('exitFormattedText'); |
4208 /** |
4269 /** |
4209 * @see insertDefaultBlock in core/block-editor store. |
4270 * @see insertDefaultBlock in core/block-editor store. |
4210 */ |
4271 */ |
4211 |
4272 |
4212 const actions_insertDefaultBlock = getBlockEditorAction('insertDefaultBlock'); |
4273 const insertDefaultBlock = getBlockEditorAction('insertDefaultBlock'); |
4213 /** |
4274 /** |
4214 * @see updateBlockListSettings in core/block-editor store. |
4275 * @see updateBlockListSettings in core/block-editor store. |
4215 */ |
4276 */ |
4216 |
4277 |
4217 const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings'); |
4278 const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings'); |
4218 |
4279 |
4219 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/controls.js |
4280 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js |
4220 /** |
|
4221 * Function returning a sessionStorage key to set or retrieve a given post's |
|
4222 * automatic session backup. |
|
4223 * |
|
4224 * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's |
|
4225 * `loggedout` handler can clear sessionStorage of any user-private content. |
|
4226 * |
|
4227 * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103 |
|
4228 * |
|
4229 * @param {string} postId Post ID. |
|
4230 * @param {boolean} isPostNew Whether post new. |
|
4231 * @return {string} sessionStorage key |
|
4232 */ |
|
4233 function postKey(postId, isPostNew) { |
|
4234 return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`; |
|
4235 } |
|
4236 |
|
4237 function localAutosaveGet(postId, isPostNew) { |
|
4238 return window.sessionStorage.getItem(postKey(postId, isPostNew)); |
|
4239 } |
|
4240 function localAutosaveSet(postId, isPostNew, title, content, excerpt) { |
|
4241 window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({ |
|
4242 post_title: title, |
|
4243 content, |
|
4244 excerpt |
|
4245 })); |
|
4246 } |
|
4247 function localAutosaveClear(postId, isPostNew) { |
|
4248 window.sessionStorage.removeItem(postKey(postId, isPostNew)); |
|
4249 } |
|
4250 const controls = { |
|
4251 LOCAL_AUTOSAVE_SET({ |
|
4252 postId, |
|
4253 isPostNew, |
|
4254 title, |
|
4255 content, |
|
4256 excerpt |
|
4257 }) { |
|
4258 localAutosaveSet(postId, isPostNew, title, content, excerpt); |
|
4259 } |
|
4260 |
|
4261 }; |
|
4262 /* harmony default export */ var store_controls = (controls); |
|
4263 |
|
4264 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js |
|
4265 /** |
4281 /** |
4266 * WordPress dependencies |
4282 * WordPress dependencies |
4267 */ |
4283 */ |
4268 |
4284 |
4269 |
|
4270 /** |
4285 /** |
4271 * Internal dependencies |
4286 * Internal dependencies |
4272 */ |
4287 */ |
4273 |
|
4274 |
4288 |
4275 |
4289 |
4276 |
4290 |
4277 |
4291 |
4278 |
4292 |
4285 */ |
4299 */ |
4286 |
4300 |
4287 const storeConfig = { |
4301 const storeConfig = { |
4288 reducer: reducer, |
4302 reducer: reducer, |
4289 selectors: selectors_namespaceObject, |
4303 selectors: selectors_namespaceObject, |
4290 actions: actions_namespaceObject, |
4304 actions: actions_namespaceObject |
4291 controls: { ...external_wp_dataControls_["controls"], |
|
4292 ...store_controls |
|
4293 } |
|
4294 }; |
4305 }; |
4295 /** |
4306 /** |
4296 * Store definition for the editor namespace. |
4307 * Store definition for the editor namespace. |
4297 * |
4308 * |
4298 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
4309 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
4299 * |
4310 * |
4300 * @type {Object} |
4311 * @type {Object} |
4301 */ |
4312 */ |
4302 |
4313 |
4303 const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, { ...storeConfig, |
4314 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { ...storeConfig |
4304 persist: ['preferences'] |
|
4305 }); // Once we build a more generic persistence plugin that works across types of stores |
|
4306 // we'd be able to replace this with a register call. |
|
4307 |
|
4308 Object(external_wp_data_["registerStore"])(STORE_NAME, { ...storeConfig, |
|
4309 persist: ['preferences'] |
|
4310 }); |
4315 }); |
4311 |
4316 (0,external_wp_data_namespaceObject.register)(store_store); |
4312 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js |
4317 |
4313 |
4318 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js |
4314 |
4319 |
4315 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js |
4320 |
4321 |
|
4322 /** |
|
4323 * External dependencies |
|
4324 */ |
|
4325 |
|
4316 /** |
4326 /** |
4317 * WordPress dependencies |
4327 * WordPress dependencies |
4318 */ |
4328 */ |
4319 |
4329 |
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 /** |
|
4337 * Internal dependencies |
|
4338 */ |
|
4339 |
|
4340 |
|
4341 /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */ |
|
4342 |
|
4343 /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */ |
|
4344 |
|
4345 /** |
|
4346 * Object whose keys are the names of block attributes, where each value |
|
4347 * represents the meta key to which the block attribute is intended to save. |
|
4348 * |
|
4349 * @see https://developer.wordpress.org/reference/functions/register_meta/ |
|
4350 * |
|
4351 * @typedef {Object<string,string>} WPMetaAttributeMapping |
|
4352 */ |
|
4353 |
|
4354 /** |
|
4355 * Given a mapping of attribute names (meta source attributes) to their |
|
4356 * associated meta key, returns a higher order component that overrides its |
|
4357 * `attributes` and `setAttributes` props to sync any changes with the edited |
|
4358 * post's meta keys. |
|
4359 * |
|
4360 * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping. |
|
4361 * |
|
4362 * @return {WPHigherOrderComponent} Higher-order component. |
|
4363 */ |
|
4364 |
|
4365 const createWithMetaAttributeSource = metaAttributes => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => _ref => { |
|
4366 let { |
|
4367 attributes, |
|
4368 setAttributes, |
|
4369 ...props |
|
4370 } = _ref; |
|
4371 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getCurrentPostType(), []); |
|
4372 const [meta, setMeta] = (0,external_wp_coreData_namespaceObject.useEntityProp)('postType', postType, 'meta'); |
|
4373 const mergedAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...attributes, |
|
4374 ...(0,external_lodash_namespaceObject.mapValues)(metaAttributes, metaKey => meta[metaKey]) |
|
4375 }), [attributes, meta]); |
|
4376 return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({ |
|
4377 attributes: mergedAttributes, |
|
4378 setAttributes: nextAttributes => { |
|
4379 const nextMeta = (0,external_lodash_namespaceObject.mapKeys)( // Filter to intersection of keys between the updated |
|
4380 // attributes and those with an associated meta key. |
|
4381 (0,external_lodash_namespaceObject.pickBy)(nextAttributes, (value, key) => metaAttributes[key]), // Rename the keys to the expected meta key name. |
|
4382 (value, attributeKey) => metaAttributes[attributeKey]); |
|
4383 |
|
4384 if (!(0,external_lodash_namespaceObject.isEmpty)(nextMeta)) { |
|
4385 setMeta(nextMeta); |
|
4386 } |
|
4387 |
|
4388 setAttributes(nextAttributes); |
|
4389 } |
|
4390 }, props)); |
|
4391 }, 'withMetaAttributeSource'); |
|
4392 /** |
|
4393 * Filters a registered block's settings to enhance a block's `edit` component |
|
4394 * to upgrade meta-sourced attributes to use the post's meta entity property. |
|
4395 * |
|
4396 * @param {WPBlockSettings} settings Registered block settings. |
|
4397 * |
|
4398 * @return {WPBlockSettings} Filtered block settings. |
|
4399 */ |
|
4400 |
|
4401 |
|
4402 function shimAttributeSource(settings) { |
|
4403 /** @type {WPMetaAttributeMapping} */ |
|
4404 const metaAttributes = (0,external_lodash_namespaceObject.mapValues)((0,external_lodash_namespaceObject.pickBy)(settings.attributes, { |
|
4405 source: 'meta' |
|
4406 }), 'meta'); |
|
4407 |
|
4408 if (!(0,external_lodash_namespaceObject.isEmpty)(metaAttributes)) { |
|
4409 settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit); |
|
4410 } |
|
4411 |
|
4412 return settings; |
|
4413 } |
|
4414 |
|
4415 (0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); // The above filter will only capture blocks registered after the filter was |
|
4416 // added. There may already be blocks registered by this point, and those must |
|
4417 // be updated to apply the shim. |
|
4418 // |
|
4419 // The following implementation achieves this, albeit with a couple caveats: |
|
4420 // - Only blocks registered on the global store will be modified. |
|
4421 // - The block settings are directly mutated, since there is currently no |
|
4422 // mechanism to update an existing block registration. This is the reason for |
|
4423 // `getBlockType` separate from `getBlockTypes`, since the latter returns a |
|
4424 // _copy_ of the block registration (i.e. the mutation would not affect the |
|
4425 // actual registered block settings). |
|
4426 // |
|
4427 // `getBlockTypes` or `getBlockType` implementation could change in the future |
|
4428 // in regards to creating settings clones, but the corresponding end-to-end |
|
4429 // tests for meta blocks should cover against any potential regressions. |
|
4430 // |
|
4431 // In the future, we could support updating block settings, at which point this |
|
4432 // implementation could use that mechanism instead. |
|
4433 |
|
4434 (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getBlockTypes().map(_ref2 => { |
|
4435 let { |
|
4436 name |
|
4437 } = _ref2; |
|
4438 return (0,external_wp_data_namespaceObject.select)(external_wp_blocks_namespaceObject.store).getBlockType(name); |
|
4439 }).forEach(shimAttributeSource); |
|
4440 |
|
4441 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js |
|
4442 |
|
4443 |
|
4444 /** |
|
4445 * WordPress dependencies |
|
4446 */ |
|
4447 |
|
4448 |
|
4449 |
|
4450 /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */ |
|
4451 |
|
4452 function getUserLabel(user) { |
|
4453 const avatar = user.avatar_urls && user.avatar_urls[24] ? (0,external_wp_element_namespaceObject.createElement)("img", { |
|
4454 className: "editor-autocompleters__user-avatar", |
|
4455 alt: "", |
|
4456 src: user.avatar_urls[24] |
|
4457 }) : (0,external_wp_element_namespaceObject.createElement)("span", { |
|
4458 className: "editor-autocompleters__no-avatar" |
|
4459 }); |
|
4460 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, avatar, (0,external_wp_element_namespaceObject.createElement)("span", { |
|
4461 className: "editor-autocompleters__user-name" |
|
4462 }, user.name), (0,external_wp_element_namespaceObject.createElement)("span", { |
|
4463 className: "editor-autocompleters__user-slug" |
|
4464 }, user.slug)); |
|
4465 } |
|
4466 /** |
|
4467 * A user mentions completer. |
|
4468 * |
|
4469 * @type {WPCompleter} |
|
4470 */ |
|
4471 |
|
4472 /* harmony default export */ var user = ({ |
|
4473 name: 'users', |
|
4474 className: 'editor-autocompleters__user', |
|
4475 triggerPrefix: '@', |
|
4476 |
|
4477 useItems(filterValue) { |
|
4478 const users = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
4479 const { |
|
4480 getUsers |
|
4481 } = select(external_wp_coreData_namespaceObject.store); |
|
4482 return getUsers({ |
|
4483 context: 'view', |
|
4484 search: encodeURIComponent(filterValue) |
|
4485 }); |
|
4486 }, [filterValue]); |
|
4487 const options = (0,external_wp_element_namespaceObject.useMemo)(() => users ? users.map(user => ({ |
|
4488 key: `user-${user.slug}`, |
|
4489 value: user, |
|
4490 label: getUserLabel(user) |
|
4491 })) : [], [users]); |
|
4492 return [options]; |
|
4493 }, |
|
4494 |
|
4495 getOptionCompletion(user) { |
|
4496 return `@${user.slug}`; |
|
4497 } |
|
4498 |
|
4499 }); |
|
4500 |
|
4501 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js |
|
4502 /** |
|
4503 * External dependencies |
|
4504 */ |
|
4505 |
|
4506 /** |
|
4507 * WordPress dependencies |
|
4508 */ |
|
4509 |
|
4510 |
|
4511 /** |
|
4512 * Internal dependencies |
|
4513 */ |
|
4514 |
|
4515 |
|
4516 |
|
4517 function setDefaultCompleters() { |
|
4518 let completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
|
4519 // Provide copies so filters may directly modify them. |
|
4520 completers.push((0,external_lodash_namespaceObject.clone)(user)); |
|
4521 return completers; |
|
4522 } |
|
4523 |
|
4524 (0,external_wp_hooks_namespaceObject.addFilter)('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters); |
|
4525 |
|
4526 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js |
|
4527 /** |
|
4528 * Internal dependencies |
|
4529 */ |
|
4530 |
|
4531 |
|
4532 |
|
4533 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js |
|
4534 |
|
4535 |
|
4536 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js |
|
4537 /** |
|
4538 * WordPress dependencies |
|
4539 */ |
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 /** |
|
4545 * Internal dependencies |
|
4546 */ |
|
4320 |
4547 |
4321 |
4548 |
4322 /** |
4549 /** |
4323 * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected. |
4550 * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected. |
4324 * |
4551 * |
4329 * There are two caveats: |
4556 * There are two caveats: |
4330 * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second. |
4557 * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second. |
4331 * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`. |
4558 * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`. |
4332 */ |
4559 */ |
4333 |
4560 |
4334 class autosave_monitor_AutosaveMonitor extends external_wp_element_["Component"] { |
4561 class AutosaveMonitor extends external_wp_element_namespaceObject.Component { |
4335 constructor(props) { |
4562 constructor(props) { |
4336 super(props); |
4563 super(props); |
4337 this.needsAutosave = !!(props.isDirty && props.isAutosaveable); |
4564 this.needsAutosave = !!(props.isDirty && props.isAutosaveable); |
4338 } |
4565 } |
4339 |
4566 |
4350 } |
4577 } |
4351 |
4578 |
4352 return; |
4579 return; |
4353 } |
4580 } |
4354 |
4581 |
4582 if (this.props.interval !== prevProps.interval) { |
|
4583 clearTimeout(this.timerId); |
|
4584 this.setAutosaveTimer(); |
|
4585 } |
|
4586 |
|
4355 if (!this.props.isDirty) { |
4587 if (!this.props.isDirty) { |
4356 this.needsAutosave = false; |
4588 this.needsAutosave = false; |
4357 return; |
4589 return; |
4358 } |
4590 } |
4359 |
4591 |
4369 |
4601 |
4370 componentWillUnmount() { |
4602 componentWillUnmount() { |
4371 clearTimeout(this.timerId); |
4603 clearTimeout(this.timerId); |
4372 } |
4604 } |
4373 |
4605 |
4374 setAutosaveTimer(timeout = this.props.interval * 1000) { |
4606 setAutosaveTimer() { |
4607 let timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.interval * 1000; |
|
4375 this.timerId = setTimeout(() => { |
4608 this.timerId = setTimeout(() => { |
4376 this.autosaveTimerHandler(); |
4609 this.autosaveTimerHandler(); |
4377 }, timeout); |
4610 }, timeout); |
4378 } |
4611 } |
4379 |
4612 |
4394 render() { |
4627 render() { |
4395 return null; |
4628 return null; |
4396 } |
4629 } |
4397 |
4630 |
4398 } |
4631 } |
4399 /* harmony default export */ var autosave_monitor = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, ownProps) => { |
4632 /* harmony default export */ var autosave_monitor = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => { |
4400 const { |
4633 const { |
4401 getReferenceByDistinctEdits |
4634 getReferenceByDistinctEdits |
4402 } = select('core'); |
4635 } = select(external_wp_coreData_namespaceObject.store); |
4403 const { |
4636 const { |
4404 isEditedPostDirty, |
4637 isEditedPostDirty, |
4405 isEditedPostAutosaveable, |
4638 isEditedPostAutosaveable, |
4406 isAutosavingPost, |
4639 isAutosavingPost, |
4407 getEditorSettings |
4640 getEditorSettings |
4408 } = select('core/editor'); |
4641 } = select(store_store); |
4409 const { |
4642 const { |
4410 interval = getEditorSettings().autosaveInterval |
4643 interval = getEditorSettings().autosaveInterval |
4411 } = ownProps; |
4644 } = ownProps; |
4412 return { |
4645 return { |
4413 editsReference: getReferenceByDistinctEdits(), |
4646 editsReference: getReferenceByDistinctEdits(), |
4414 isDirty: isEditedPostDirty(), |
4647 isDirty: isEditedPostDirty(), |
4415 isAutosaveable: isEditedPostAutosaveable(), |
4648 isAutosaveable: isEditedPostAutosaveable(), |
4416 isAutosaving: isAutosavingPost(), |
4649 isAutosaving: isAutosavingPost(), |
4417 interval |
4650 interval |
4418 }; |
4651 }; |
4419 }), Object(external_wp_data_["withDispatch"])((dispatch, ownProps) => ({ |
4652 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({ |
4420 autosave() { |
4653 autosave() { |
4421 const { |
4654 const { |
4422 autosave = dispatch('core/editor').autosave |
4655 autosave = dispatch(store_store).autosave |
4423 } = ownProps; |
4656 } = ownProps; |
4424 autosave(); |
4657 autosave(); |
4425 } |
4658 } |
4426 |
4659 |
4427 }))])(autosave_monitor_AutosaveMonitor)); |
4660 }))])(AutosaveMonitor)); |
4428 |
4661 |
4662 ;// CONCATENATED MODULE: external ["wp","richText"] |
|
4663 var external_wp_richText_namespaceObject = window["wp"]["richText"]; |
|
4429 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
4664 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
4430 var classnames = __webpack_require__("TSYQ"); |
4665 var classnames = __webpack_require__(4403); |
4431 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
4666 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
4432 |
4667 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js |
4433 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js |
|
4434 |
4668 |
4435 |
4669 |
4436 /** |
4670 /** |
4437 * External dependencies |
4671 * External dependencies |
4438 */ |
4672 */ |
4439 |
4673 |
4440 |
4674 |
4441 const TableOfContentsItem = ({ |
4675 const TableOfContentsItem = _ref => { |
4442 children, |
4676 let { |
4443 isValid, |
4677 children, |
4444 level, |
4678 isValid, |
4445 href, |
4679 level, |
4446 onSelect |
4680 href, |
4447 }) => Object(external_wp_element_["createElement"])("li", { |
4681 onSelect |
4448 className: classnames_default()('document-outline__item', `is-${level.toLowerCase()}`, { |
4682 } = _ref; |
4449 'is-invalid': !isValid |
4683 return (0,external_wp_element_namespaceObject.createElement)("li", { |
4450 }) |
4684 className: classnames_default()('document-outline__item', `is-${level.toLowerCase()}`, { |
4451 }, Object(external_wp_element_["createElement"])("a", { |
4685 'is-invalid': !isValid |
4452 href: href, |
4686 }) |
4453 className: "document-outline__button", |
4687 }, (0,external_wp_element_namespaceObject.createElement)("a", { |
4454 onClick: onSelect |
4688 href: href, |
4455 }, Object(external_wp_element_["createElement"])("span", { |
4689 className: "document-outline__button", |
4456 className: "document-outline__emdash", |
4690 onClick: onSelect |
4457 "aria-hidden": "true" |
4691 }, (0,external_wp_element_namespaceObject.createElement)("span", { |
4458 }), Object(external_wp_element_["createElement"])("strong", { |
4692 className: "document-outline__emdash", |
4459 className: "document-outline__level" |
4693 "aria-hidden": "true" |
4460 }, level), Object(external_wp_element_["createElement"])("span", { |
4694 }), (0,external_wp_element_namespaceObject.createElement)("strong", { |
4461 className: "document-outline__item-content" |
4695 className: "document-outline__level" |
4462 }, children))); |
4696 }, level), (0,external_wp_element_namespaceObject.createElement)("span", { |
4697 className: "document-outline__item-content" |
|
4698 }, children))); |
|
4699 }; |
|
4463 |
4700 |
4464 /* harmony default export */ var document_outline_item = (TableOfContentsItem); |
4701 /* harmony default export */ var document_outline_item = (TableOfContentsItem); |
4465 |
4702 |
4466 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js |
4703 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js |
4467 |
4704 |
4468 |
4705 |
4469 /** |
4706 /** |
4470 * External dependencies |
4707 * External dependencies |
4471 */ |
4708 */ |
4477 |
4714 |
4478 |
4715 |
4479 |
4716 |
4480 |
4717 |
4481 |
4718 |
4719 |
|
4482 /** |
4720 /** |
4483 * Internal dependencies |
4721 * Internal dependencies |
4484 */ |
4722 */ |
4485 |
4723 |
4486 |
4724 |
4725 |
|
4487 /** |
4726 /** |
4488 * Module constants |
4727 * Module constants |
4489 */ |
4728 */ |
4490 |
4729 |
4491 const emptyHeadingContent = Object(external_wp_element_["createElement"])("em", null, Object(external_wp_i18n_["__"])('(Empty heading)')); |
4730 const emptyHeadingContent = (0,external_wp_element_namespaceObject.createElement)("em", null, (0,external_wp_i18n_namespaceObject.__)('(Empty heading)')); |
4492 const incorrectLevelContent = [Object(external_wp_element_["createElement"])("br", { |
4731 const incorrectLevelContent = [(0,external_wp_element_namespaceObject.createElement)("br", { |
4493 key: "incorrect-break" |
4732 key: "incorrect-break" |
4494 }), Object(external_wp_element_["createElement"])("em", { |
4733 }), (0,external_wp_element_namespaceObject.createElement)("em", { |
4495 key: "incorrect-message" |
4734 key: "incorrect-message" |
4496 }, Object(external_wp_i18n_["__"])('(Incorrect heading level)'))]; |
4735 }, (0,external_wp_i18n_namespaceObject.__)('(Incorrect heading level)'))]; |
4497 const singleH1Headings = [Object(external_wp_element_["createElement"])("br", { |
4736 const singleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", { |
4498 key: "incorrect-break-h1" |
4737 key: "incorrect-break-h1" |
4499 }), Object(external_wp_element_["createElement"])("em", { |
4738 }), (0,external_wp_element_namespaceObject.createElement)("em", { |
4500 key: "incorrect-message-h1" |
4739 key: "incorrect-message-h1" |
4501 }, Object(external_wp_i18n_["__"])('(Your theme may already use a H1 for the post title)'))]; |
4740 }, (0,external_wp_i18n_namespaceObject.__)('(Your theme may already use a H1 for the post title)'))]; |
4502 const multipleH1Headings = [Object(external_wp_element_["createElement"])("br", { |
4741 const multipleH1Headings = [(0,external_wp_element_namespaceObject.createElement)("br", { |
4503 key: "incorrect-break-multiple-h1" |
4742 key: "incorrect-break-multiple-h1" |
4504 }), Object(external_wp_element_["createElement"])("em", { |
4743 }), (0,external_wp_element_namespaceObject.createElement)("em", { |
4505 key: "incorrect-message-multiple-h1" |
4744 key: "incorrect-message-multiple-h1" |
4506 }, Object(external_wp_i18n_["__"])('(Multiple H1 headings are not recommended)'))]; |
4745 }, (0,external_wp_i18n_namespaceObject.__)('(Multiple H1 headings are not recommended)'))]; |
4507 /** |
4746 /** |
4508 * Returns an array of heading blocks enhanced with the following properties: |
4747 * Returns an array of heading blocks enhanced with the following properties: |
4509 * level - An integer with the heading level. |
4748 * level - An integer with the heading level. |
4510 * isEmpty - Flag indicating if the heading has no content. |
4749 * isEmpty - Flag indicating if the heading has no content. |
4511 * |
4750 * |
4512 * @param {?Array} blocks An array of blocks. |
4751 * @param {?Array} blocks An array of blocks. |
4513 * |
4752 * |
4514 * @return {Array} An array of heading blocks enhanced with the properties described above. |
4753 * @return {Array} An array of heading blocks enhanced with the properties described above. |
4515 */ |
4754 */ |
4516 |
4755 |
4517 const computeOutlineHeadings = (blocks = []) => { |
4756 const computeOutlineHeadings = function () { |
4518 return Object(external_lodash_["flatMap"])(blocks, (block = {}) => { |
4757 let blocks = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; |
4758 return (0,external_lodash_namespaceObject.flatMap)(blocks, function () { |
|
4759 let block = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
4760 |
|
4519 if (block.name === 'core/heading') { |
4761 if (block.name === 'core/heading') { |
4520 return { ...block, |
4762 return { ...block, |
4521 level: block.attributes.level, |
4763 level: block.attributes.level, |
4522 isEmpty: isEmptyHeading(block) |
4764 isEmpty: isEmptyHeading(block) |
4523 }; |
4765 }; |
4527 }); |
4769 }); |
4528 }; |
4770 }; |
4529 |
4771 |
4530 const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0; |
4772 const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0; |
4531 |
4773 |
4532 const DocumentOutline = ({ |
4774 const DocumentOutline = _ref => { |
4533 blocks = [], |
4775 let { |
4534 title, |
4776 blocks = [], |
4535 onSelect, |
4777 title, |
4536 isTitleSupported, |
4778 onSelect, |
4537 hasOutlineItemsDisabled |
4779 isTitleSupported, |
4538 }) => { |
4780 hasOutlineItemsDisabled |
4781 } = _ref; |
|
4539 const headings = computeOutlineHeadings(blocks); |
4782 const headings = computeOutlineHeadings(blocks); |
4540 |
4783 |
4541 if (headings.length < 1) { |
4784 if (headings.length < 1) { |
4542 return null; |
4785 return null; |
4543 } |
4786 } |
4544 |
4787 |
4545 let prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now. |
4788 let prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now. |
4546 |
4789 |
4547 const titleNode = document.querySelector('.editor-post-title__input'); |
4790 const titleNode = document.querySelector('.editor-post-title__input'); |
4548 const hasTitle = isTitleSupported && title && titleNode; |
4791 const hasTitle = isTitleSupported && title && titleNode; |
4549 const countByLevel = Object(external_lodash_["countBy"])(headings, 'level'); |
4792 const countByLevel = (0,external_lodash_namespaceObject.countBy)(headings, 'level'); |
4550 const hasMultipleH1 = countByLevel[1] > 1; |
4793 const hasMultipleH1 = countByLevel[1] > 1; |
4551 return Object(external_wp_element_["createElement"])("div", { |
4794 return (0,external_wp_element_namespaceObject.createElement)("div", { |
4552 className: "document-outline" |
4795 className: "document-outline" |
4553 }, Object(external_wp_element_["createElement"])("ul", null, hasTitle && Object(external_wp_element_["createElement"])(document_outline_item, { |
4796 }, (0,external_wp_element_namespaceObject.createElement)("ul", null, hasTitle && (0,external_wp_element_namespaceObject.createElement)(document_outline_item, { |
4554 level: Object(external_wp_i18n_["__"])('Title'), |
4797 level: (0,external_wp_i18n_namespaceObject.__)('Title'), |
4555 isValid: true, |
4798 isValid: true, |
4556 onSelect: onSelect, |
4799 onSelect: onSelect, |
4557 href: `#${titleNode.id}`, |
4800 href: `#${titleNode.id}`, |
4558 isDisabled: hasOutlineItemsDisabled |
4801 isDisabled: hasOutlineItemsDisabled |
4559 }, title), headings.map((item, index) => { |
4802 }, title), headings.map((item, index) => { |
4560 // Headings remain the same, go up by one, or down by any amount. |
4803 // Headings remain the same, go up by one, or down by any amount. |
4561 // Otherwise there are missing levels. |
4804 // Otherwise there are missing levels. |
4562 const isIncorrectLevel = item.level > prevHeadingLevel + 1; |
4805 const isIncorrectLevel = item.level > prevHeadingLevel + 1; |
4563 const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); |
4806 const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle); |
4564 prevHeadingLevel = item.level; |
4807 prevHeadingLevel = item.level; |
4565 return Object(external_wp_element_["createElement"])(document_outline_item, { |
4808 return (0,external_wp_element_namespaceObject.createElement)(document_outline_item, { |
4566 key: index, |
4809 key: index, |
4567 level: `H${item.level}`, |
4810 level: `H${item.level}`, |
4568 isValid: isValid, |
4811 isValid: isValid, |
4569 isDisabled: hasOutlineItemsDisabled, |
4812 isDisabled: hasOutlineItemsDisabled, |
4570 href: `#block-${item.clientId}`, |
4813 href: `#block-${item.clientId}`, |
4571 onSelect: onSelect |
4814 onSelect: onSelect |
4572 }, item.isEmpty ? emptyHeadingContent : Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["create"])({ |
4815 }, item.isEmpty ? emptyHeadingContent : (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.create)({ |
4573 html: item.attributes.content |
4816 html: item.attributes.content |
4574 })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings); |
4817 })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings); |
4575 }))); |
4818 }))); |
4576 }; |
4819 }; |
4577 /* harmony default export */ var document_outline = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => { |
4820 /* harmony default export */ var document_outline = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { |
4578 const { |
4821 const { |
4579 getBlocks |
4822 getBlocks |
4580 } = select(external_wp_blockEditor_["store"]); |
4823 } = select(external_wp_blockEditor_namespaceObject.store); |
4581 const { |
4824 const { |
4582 getEditedPostAttribute |
4825 getEditedPostAttribute |
4583 } = select('core/editor'); |
4826 } = select(store_store); |
4584 const { |
4827 const { |
4585 getPostType |
4828 getPostType |
4586 } = select('core'); |
4829 } = select(external_wp_coreData_namespaceObject.store); |
4587 const postType = getPostType(getEditedPostAttribute('type')); |
4830 const postType = getPostType(getEditedPostAttribute('type')); |
4588 return { |
4831 return { |
4589 title: getEditedPostAttribute('title'), |
4832 title: getEditedPostAttribute('title'), |
4590 blocks: getBlocks(), |
4833 blocks: getBlocks(), |
4591 isTitleSupported: Object(external_lodash_["get"])(postType, ['supports', 'title'], false) |
4834 isTitleSupported: (0,external_lodash_namespaceObject.get)(postType, ['supports', 'title'], false) |
4592 }; |
4835 }; |
4593 }))(DocumentOutline)); |
4836 }))(DocumentOutline)); |
4594 |
4837 |
4595 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js |
4838 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js |
4596 /** |
4839 /** |
4597 * External dependencies |
4840 * External dependencies |
4598 */ |
4841 */ |
4599 |
4842 |
4600 /** |
4843 /** |
4602 */ |
4845 */ |
4603 |
4846 |
4604 |
4847 |
4605 |
4848 |
4606 |
4849 |
4607 function DocumentOutlineCheck({ |
4850 function DocumentOutlineCheck(_ref) { |
4608 blocks, |
4851 let { |
4609 children |
4852 blocks, |
4610 }) { |
4853 children |
4611 const headings = Object(external_lodash_["filter"])(blocks, block => block.name === 'core/heading'); |
4854 } = _ref; |
4855 const headings = (0,external_lodash_namespaceObject.filter)(blocks, block => block.name === 'core/heading'); |
|
4612 |
4856 |
4613 if (headings.length < 1) { |
4857 if (headings.length < 1) { |
4614 return null; |
4858 return null; |
4615 } |
4859 } |
4616 |
4860 |
4617 return children; |
4861 return children; |
4618 } |
4862 } |
4619 |
4863 |
4620 /* harmony default export */ var check = (Object(external_wp_data_["withSelect"])(select => ({ |
4864 /* harmony default export */ var check = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ |
4621 blocks: select(external_wp_blockEditor_["store"]).getBlocks() |
4865 blocks: select(external_wp_blockEditor_namespaceObject.store).getBlocks() |
4622 }))(DocumentOutlineCheck)); |
4866 }))(DocumentOutlineCheck)); |
4623 |
4867 |
4624 // EXTERNAL MODULE: external ["wp","keyboardShortcuts"] |
4868 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] |
4625 var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m"); |
4869 var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; |
4626 |
4870 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js |
4627 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js |
|
4628 /** |
4871 /** |
4629 * WordPress dependencies |
4872 * WordPress dependencies |
4630 */ |
4873 */ |
4631 |
4874 |
4632 |
4875 |
4633 |
4876 |
4634 |
4877 /** |
4635 function SaveShortcut({ |
4878 * Internal dependencies |
4636 resetBlocksOnSave |
4879 */ |
4637 }) { |
4880 |
4881 |
|
4882 |
|
4883 function SaveShortcut(_ref) { |
|
4884 let { |
|
4885 resetBlocksOnSave |
|
4886 } = _ref; |
|
4638 const { |
4887 const { |
4639 resetEditorBlocks, |
4888 resetEditorBlocks, |
4640 savePost |
4889 savePost |
4641 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
4890 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
4642 const { |
4891 const { |
4643 isEditedPostDirty, |
4892 isEditedPostDirty, |
4644 getPostEdits |
4893 getPostEdits, |
4645 } = Object(external_wp_data_["useSelect"])(select => { |
4894 isPostSavingLocked |
4646 const { |
4895 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); |
4647 isEditedPostDirty: _isEditedPostDirty, |
4896 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/save', event => { |
4648 getPostEdits: _getPostEdits |
4897 event.preventDefault(); |
4649 } = select('core/editor'); |
4898 /** |
4650 return { |
4899 * Do not save the post if post saving is locked. |
4651 isEditedPostDirty: _isEditedPostDirty, |
4900 */ |
4652 getPostEdits: _getPostEdits |
4901 |
4653 }; |
4902 if (isPostSavingLocked()) { |
4654 }, []); |
4903 return; |
4655 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/save', event => { |
4904 } // TODO: This should be handled in the `savePost` effect in |
4656 event.preventDefault(); // TODO: This should be handled in the `savePost` effect in |
|
4657 // considering `isSaveable`. See note on `isEditedPostSaveable` |
4905 // considering `isSaveable`. See note on `isEditedPostSaveable` |
4658 // selector about dirtiness and meta-boxes. |
4906 // selector about dirtiness and meta-boxes. |
4659 // |
4907 // |
4660 // See: `isEditedPostSaveable` |
4908 // See: `isEditedPostSaveable` |
4909 |
|
4661 |
4910 |
4662 if (!isEditedPostDirty()) { |
4911 if (!isEditedPostDirty()) { |
4663 return; |
4912 return; |
4664 } // The text editor requires that editor blocks are updated for a |
4913 } // The text editor requires that editor blocks are updated for a |
4665 // save to work correctly. Usually this happens when the textarea |
4914 // save to work correctly. Usually this happens when the textarea |
4669 |
4918 |
4670 if (resetBlocksOnSave) { |
4919 if (resetBlocksOnSave) { |
4671 const postEdits = getPostEdits(); |
4920 const postEdits = getPostEdits(); |
4672 |
4921 |
4673 if (postEdits.content && typeof postEdits.content === 'string') { |
4922 if (postEdits.content && typeof postEdits.content === 'string') { |
4674 const blocks = Object(external_wp_blocks_["parse"])(postEdits.content); |
4923 const blocks = (0,external_wp_blocks_namespaceObject.parse)(postEdits.content); |
4675 resetEditorBlocks(blocks); |
4924 resetEditorBlocks(blocks); |
4676 } |
4925 } |
4677 } |
4926 } |
4678 |
4927 |
4679 savePost(); |
4928 savePost(); |
4680 }, { |
|
4681 bindGlobal: true |
|
4682 }); |
4929 }); |
4683 return null; |
4930 return null; |
4684 } |
4931 } |
4685 |
4932 |
4686 /* harmony default export */ var save_shortcut = (SaveShortcut); |
4933 /* harmony default export */ var save_shortcut = (SaveShortcut); |
4687 |
4934 |
4688 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js |
4935 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js |
4689 |
4936 |
4690 |
4937 |
4691 /** |
4938 /** |
4692 * WordPress dependencies |
4939 * WordPress dependencies |
4693 */ |
4940 */ |
4694 |
4941 |
4695 |
4942 |
4696 |
|
4697 /** |
4943 /** |
4698 * Internal dependencies |
4944 * Internal dependencies |
4699 */ |
4945 */ |
4946 |
|
4700 |
4947 |
4701 |
4948 |
4702 |
4949 |
4703 function VisualEditorGlobalKeyboardShortcuts() { |
4950 function VisualEditorGlobalKeyboardShortcuts() { |
4704 const { |
4951 const { |
4705 redo, |
4952 redo, |
4706 undo |
4953 undo |
4707 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
4954 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
4708 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/undo', event => { |
4955 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/undo', event => { |
4709 undo(); |
4956 undo(); |
4710 event.preventDefault(); |
4957 event.preventDefault(); |
4711 }, { |
|
4712 bindGlobal: true |
|
4713 }); |
4958 }); |
4714 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/redo', event => { |
4959 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/editor/redo', event => { |
4715 redo(); |
4960 redo(); |
4716 event.preventDefault(); |
4961 event.preventDefault(); |
4717 }, { |
|
4718 bindGlobal: true |
|
4719 }); |
4962 }); |
4720 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_wp_element_["createElement"])(save_shortcut, null)); |
4963 return (0,external_wp_element_namespaceObject.createElement)(save_shortcut, null); |
4721 } |
4964 } |
4722 |
4965 |
4723 /* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts); |
4966 /* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts); |
4724 |
4967 |
4725 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js |
4968 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js |
4726 |
4969 |
4727 |
4970 |
4728 /** |
4971 /** |
4729 * Internal dependencies |
4972 * Internal dependencies |
4730 */ |
4973 */ |
4731 |
4974 |
4732 function TextEditorGlobalKeyboardShortcuts() { |
4975 function TextEditorGlobalKeyboardShortcuts() { |
4733 return Object(external_wp_element_["createElement"])(save_shortcut, { |
4976 return (0,external_wp_element_namespaceObject.createElement)(save_shortcut, { |
4734 resetBlocksOnSave: true |
4977 resetBlocksOnSave: true |
4735 }); |
4978 }); |
4736 } |
4979 } |
4737 |
4980 |
4738 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js |
4981 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js |
4739 |
4982 |
4740 |
4983 |
4741 /** |
4984 /** |
4742 * WordPress dependencies |
4985 * WordPress dependencies |
4743 */ |
4986 */ |
4746 |
4989 |
4747 |
4990 |
4748 |
4991 |
4749 |
4992 |
4750 function EditorKeyboardShortcutsRegister() { |
4993 function EditorKeyboardShortcutsRegister() { |
4751 // Registering the shortcuts |
4994 // Registering the shortcuts. |
4752 const { |
4995 const { |
4753 registerShortcut |
4996 registerShortcut |
4754 } = Object(external_wp_data_["useDispatch"])(external_wp_keyboardShortcuts_["store"]); |
4997 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); |
4755 Object(external_wp_element_["useEffect"])(() => { |
4998 (0,external_wp_element_namespaceObject.useEffect)(() => { |
4756 registerShortcut({ |
4999 registerShortcut({ |
4757 name: 'core/editor/save', |
5000 name: 'core/editor/save', |
4758 category: 'global', |
5001 category: 'global', |
4759 description: Object(external_wp_i18n_["__"])('Save your changes.'), |
5002 description: (0,external_wp_i18n_namespaceObject.__)('Save your changes.'), |
4760 keyCombination: { |
5003 keyCombination: { |
4761 modifier: 'primary', |
5004 modifier: 'primary', |
4762 character: 's' |
5005 character: 's' |
4763 } |
5006 } |
4764 }); |
5007 }); |
4765 registerShortcut({ |
5008 registerShortcut({ |
4766 name: 'core/editor/undo', |
5009 name: 'core/editor/undo', |
4767 category: 'global', |
5010 category: 'global', |
4768 description: Object(external_wp_i18n_["__"])('Undo your last changes.'), |
5011 description: (0,external_wp_i18n_namespaceObject.__)('Undo your last changes.'), |
4769 keyCombination: { |
5012 keyCombination: { |
4770 modifier: 'primary', |
5013 modifier: 'primary', |
4771 character: 'z' |
5014 character: 'z' |
4772 } |
5015 } |
4773 }); |
5016 }); |
4774 registerShortcut({ |
5017 registerShortcut({ |
4775 name: 'core/editor/redo', |
5018 name: 'core/editor/redo', |
4776 category: 'global', |
5019 category: 'global', |
4777 description: Object(external_wp_i18n_["__"])('Redo your last undo.'), |
5020 description: (0,external_wp_i18n_namespaceObject.__)('Redo your last undo.'), |
4778 keyCombination: { |
5021 keyCombination: { |
4779 modifier: 'primaryShift', |
5022 modifier: 'primaryShift', |
4780 character: 'z' |
5023 character: 'z' |
4781 } |
5024 } |
4782 }); |
5025 }); |
4783 }, [registerShortcut]); |
5026 }, [registerShortcut]); |
4784 return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"].Register, null); |
5027 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts.Register, null); |
4785 } |
5028 } |
4786 |
5029 |
4787 /* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister); |
5030 /* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister); |
4788 |
5031 |
4789 // EXTERNAL MODULE: external ["wp","components"] |
5032 ;// CONCATENATED MODULE: external ["wp","components"] |
4790 var external_wp_components_ = __webpack_require__("tI+e"); |
5033 var external_wp_components_namespaceObject = window["wp"]["components"]; |
4791 |
5034 ;// CONCATENATED MODULE: external ["wp","keycodes"] |
4792 // EXTERNAL MODULE: external ["wp","keycodes"] |
5035 var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; |
4793 var external_wp_keycodes_ = __webpack_require__("RxS6"); |
5036 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js |
4794 |
|
4795 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js |
|
4796 var library_redo = __webpack_require__("K2cm"); |
|
4797 |
|
4798 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js |
|
4799 var library_undo = __webpack_require__("Ntru"); |
|
4800 |
|
4801 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js |
|
4802 |
|
4803 |
5037 |
4804 |
5038 |
4805 /** |
5039 /** |
4806 * WordPress dependencies |
5040 * WordPress dependencies |
4807 */ |
5041 */ |
4808 |
5042 |
5043 const redo_redo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5044 xmlns: "http://www.w3.org/2000/svg", |
|
5045 viewBox: "0 0 24 24" |
|
5046 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5047 d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" |
|
5048 })); |
|
5049 /* harmony default export */ var library_redo = (redo_redo); |
|
5050 |
|
5051 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js |
|
5052 |
|
5053 |
|
5054 /** |
|
5055 * WordPress dependencies |
|
5056 */ |
|
5057 |
|
5058 const undo_undo = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
5059 xmlns: "http://www.w3.org/2000/svg", |
|
5060 viewBox: "0 0 24 24" |
|
5061 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
5062 d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" |
|
5063 })); |
|
5064 /* harmony default export */ var library_undo = (undo_undo); |
|
5065 |
|
5066 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js |
|
5067 |
|
5068 |
|
5069 |
|
5070 /** |
|
5071 * WordPress dependencies |
|
5072 */ |
|
5073 |
|
4809 |
5074 |
4810 |
5075 |
4811 |
5076 |
4812 |
5077 |
4813 |
5078 |
4816 */ |
5081 */ |
4817 |
5082 |
4818 |
5083 |
4819 |
5084 |
4820 function EditorHistoryRedo(props, ref) { |
5085 function EditorHistoryRedo(props, ref) { |
4821 const hasRedo = Object(external_wp_data_["useSelect"])(select => select(store).hasEditorRedo(), []); |
5086 const hasRedo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorRedo(), []); |
4822 const { |
5087 const { |
4823 redo |
5088 redo |
4824 } = Object(external_wp_data_["useDispatch"])(store); |
5089 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
4825 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { |
5090 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, { |
4826 ref: ref, |
5091 ref: ref, |
4827 icon: !Object(external_wp_i18n_["isRTL"])() ? library_redo["a" /* default */] : library_undo["a" /* default */] |
5092 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_redo : library_undo |
4828 /* translators: button label text should, if possible, be under 16 characters. */ |
5093 /* translators: button label text should, if possible, be under 16 characters. */ |
4829 , |
5094 , |
4830 label: Object(external_wp_i18n_["__"])('Redo'), |
5095 label: (0,external_wp_i18n_namespaceObject.__)('Redo'), |
4831 shortcut: external_wp_keycodes_["displayShortcut"].primaryShift('z') // If there are no redo levels we don't want to actually disable this |
5096 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('z') // If there are no redo levels we don't want to actually disable this |
4832 // button, because it will remove focus for keyboard users. |
5097 // button, because it will remove focus for keyboard users. |
4833 // See: https://github.com/WordPress/gutenberg/issues/3486 |
5098 // See: https://github.com/WordPress/gutenberg/issues/3486 |
4834 , |
5099 , |
4835 "aria-disabled": !hasRedo, |
5100 "aria-disabled": !hasRedo, |
4836 onClick: hasRedo ? redo : undefined, |
5101 onClick: hasRedo ? redo : undefined, |
4837 className: "editor-history__redo" |
5102 className: "editor-history__redo" |
4838 })); |
5103 })); |
4839 } |
5104 } |
4840 |
5105 |
4841 /* harmony default export */ var editor_history_redo = (Object(external_wp_element_["forwardRef"])(EditorHistoryRedo)); |
5106 /* harmony default export */ var editor_history_redo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryRedo)); |
4842 |
5107 |
4843 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js |
5108 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js |
4844 |
5109 |
4845 |
5110 |
4846 |
5111 |
4847 /** |
5112 /** |
4848 * WordPress dependencies |
5113 * WordPress dependencies |
4858 */ |
5123 */ |
4859 |
5124 |
4860 |
5125 |
4861 |
5126 |
4862 function EditorHistoryUndo(props, ref) { |
5127 function EditorHistoryUndo(props, ref) { |
4863 const hasUndo = Object(external_wp_data_["useSelect"])(select => select(store).hasEditorUndo(), []); |
5128 const hasUndo = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasEditorUndo(), []); |
4864 const { |
5129 const { |
4865 undo |
5130 undo |
4866 } = Object(external_wp_data_["useDispatch"])(store); |
5131 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
4867 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { |
5132 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, { |
4868 ref: ref, |
5133 ref: ref, |
4869 icon: !Object(external_wp_i18n_["isRTL"])() ? library_undo["a" /* default */] : library_redo["a" /* default */] |
5134 icon: !(0,external_wp_i18n_namespaceObject.isRTL)() ? library_undo : library_redo |
4870 /* translators: button label text should, if possible, be under 16 characters. */ |
5135 /* translators: button label text should, if possible, be under 16 characters. */ |
4871 , |
5136 , |
4872 label: Object(external_wp_i18n_["__"])('Undo'), |
5137 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), |
4873 shortcut: external_wp_keycodes_["displayShortcut"].primary('z') // If there are no undo levels we don't want to actually disable this |
5138 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('z') // If there are no undo levels we don't want to actually disable this |
4874 // button, because it will remove focus for keyboard users. |
5139 // button, because it will remove focus for keyboard users. |
4875 // See: https://github.com/WordPress/gutenberg/issues/3486 |
5140 // See: https://github.com/WordPress/gutenberg/issues/3486 |
4876 , |
5141 , |
4877 "aria-disabled": !hasUndo, |
5142 "aria-disabled": !hasUndo, |
4878 onClick: hasUndo ? undo : undefined, |
5143 onClick: hasUndo ? undo : undefined, |
4879 className: "editor-history__undo" |
5144 className: "editor-history__undo" |
4880 })); |
5145 })); |
4881 } |
5146 } |
4882 |
5147 |
4883 /* harmony default export */ var editor_history_undo = (Object(external_wp_element_["forwardRef"])(EditorHistoryUndo)); |
5148 /* harmony default export */ var editor_history_undo = ((0,external_wp_element_namespaceObject.forwardRef)(EditorHistoryUndo)); |
4884 |
5149 |
4885 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js |
5150 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js |
4886 |
5151 |
4887 |
5152 |
4888 /** |
5153 /** |
4889 * WordPress dependencies |
5154 * WordPress dependencies |
4890 */ |
5155 */ |
4892 |
5157 |
4893 |
5158 |
4894 |
5159 |
4895 |
5160 |
4896 |
5161 |
4897 function TemplateValidationNotice({ |
5162 function TemplateValidationNotice(_ref) { |
4898 isValid, |
5163 let { |
4899 ...props |
5164 isValid, |
4900 }) { |
5165 ...props |
5166 } = _ref; |
|
5167 |
|
4901 if (isValid) { |
5168 if (isValid) { |
4902 return null; |
5169 return null; |
4903 } |
5170 } |
4904 |
5171 |
4905 const confirmSynchronization = () => { |
5172 const confirmSynchronization = () => { |
4906 if ( // eslint-disable-next-line no-alert |
5173 if ( // eslint-disable-next-line no-alert |
4907 window.confirm(Object(external_wp_i18n_["__"])('Resetting the template may result in loss of content, do you want to continue?'))) { |
5174 window.confirm((0,external_wp_i18n_namespaceObject.__)('Resetting the template may result in loss of content, do you want to continue?'))) { |
4908 props.synchronizeTemplate(); |
5175 props.synchronizeTemplate(); |
4909 } |
5176 } |
4910 }; |
5177 }; |
4911 |
5178 |
4912 return Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], { |
5179 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, { |
4913 className: "editor-template-validation-notice", |
5180 className: "editor-template-validation-notice", |
4914 isDismissible: false, |
5181 isDismissible: false, |
4915 status: "warning", |
5182 status: "warning", |
4916 actions: [{ |
5183 actions: [{ |
4917 label: Object(external_wp_i18n_["__"])('Keep it as is'), |
5184 label: (0,external_wp_i18n_namespaceObject.__)('Keep it as is'), |
4918 onClick: props.resetTemplateValidity |
5185 onClick: props.resetTemplateValidity |
4919 }, { |
5186 }, { |
4920 label: Object(external_wp_i18n_["__"])('Reset the template'), |
5187 label: (0,external_wp_i18n_namespaceObject.__)('Reset the template'), |
4921 onClick: confirmSynchronization |
5188 onClick: confirmSynchronization |
4922 }] |
5189 }] |
4923 }, Object(external_wp_i18n_["__"])('The content of your post doesn’t match the template assigned to your post type.')); |
5190 }, (0,external_wp_i18n_namespaceObject.__)('The content of your post doesn’t match the template assigned to your post type.')); |
4924 } |
5191 } |
4925 |
5192 |
4926 /* harmony default export */ var template_validation_notice = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({ |
5193 /* harmony default export */ var template_validation_notice = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({ |
4927 isValid: select(external_wp_blockEditor_["store"]).isValidTemplate() |
5194 isValid: select(external_wp_blockEditor_namespaceObject.store).isValidTemplate() |
4928 })), Object(external_wp_data_["withDispatch"])(dispatch => { |
5195 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
4929 const { |
5196 const { |
4930 setTemplateValidity, |
5197 setTemplateValidity, |
4931 synchronizeTemplate |
5198 synchronizeTemplate |
4932 } = dispatch(external_wp_blockEditor_["store"]); |
5199 } = dispatch(external_wp_blockEditor_namespaceObject.store); |
4933 return { |
5200 return { |
4934 resetTemplateValidity: () => setTemplateValidity(true), |
5201 resetTemplateValidity: () => setTemplateValidity(true), |
4935 synchronizeTemplate |
5202 synchronizeTemplate |
4936 }; |
5203 }; |
4937 })])(TemplateValidationNotice)); |
5204 })])(TemplateValidationNotice)); |
4938 |
5205 |
4939 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js |
5206 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js |
4940 |
5207 |
4941 |
5208 |
4942 /** |
5209 /** |
4943 * External dependencies |
5210 * External dependencies |
4944 */ |
5211 */ |
4954 /** |
5221 /** |
4955 * Internal dependencies |
5222 * Internal dependencies |
4956 */ |
5223 */ |
4957 |
5224 |
4958 |
5225 |
4959 function EditorNotices({ |
5226 function EditorNotices(_ref) { |
4960 notices, |
5227 let { |
4961 onRemove |
5228 notices, |
4962 }) { |
5229 onRemove |
4963 const dismissibleNotices = Object(external_lodash_["filter"])(notices, { |
5230 } = _ref; |
5231 const dismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, { |
|
4964 isDismissible: true, |
5232 isDismissible: true, |
4965 type: 'default' |
5233 type: 'default' |
4966 }); |
5234 }); |
4967 const nonDismissibleNotices = Object(external_lodash_["filter"])(notices, { |
5235 const nonDismissibleNotices = (0,external_lodash_namespaceObject.filter)(notices, { |
4968 isDismissible: false, |
5236 isDismissible: false, |
4969 type: 'default' |
5237 type: 'default' |
4970 }); |
5238 }); |
4971 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], { |
5239 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, { |
4972 notices: nonDismissibleNotices, |
5240 notices: nonDismissibleNotices, |
4973 className: "components-editor-notices__pinned" |
5241 className: "components-editor-notices__pinned" |
4974 }), Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], { |
5242 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.NoticeList, { |
4975 notices: dismissibleNotices, |
5243 notices: dismissibleNotices, |
4976 className: "components-editor-notices__dismissible", |
5244 className: "components-editor-notices__dismissible", |
4977 onRemove: onRemove |
5245 onRemove: onRemove |
4978 }, Object(external_wp_element_["createElement"])(template_validation_notice, null))); |
5246 }, (0,external_wp_element_namespaceObject.createElement)(template_validation_notice, null))); |
4979 } |
5247 } |
4980 /* harmony default export */ var editor_notices = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({ |
5248 /* harmony default export */ var editor_notices = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({ |
4981 notices: select(external_wp_notices_["store"]).getNotices() |
5249 notices: select(external_wp_notices_namespaceObject.store).getNotices() |
4982 })), Object(external_wp_data_["withDispatch"])(dispatch => ({ |
5250 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
4983 onRemove: dispatch(external_wp_notices_["store"]).removeNotice |
5251 onRemove: dispatch(external_wp_notices_namespaceObject.store).removeNotice |
4984 }))])(EditorNotices)); |
5252 }))])(EditorNotices)); |
4985 |
5253 |
4986 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js |
5254 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js |
4987 |
5255 |
4988 |
5256 |
4989 /** |
5257 /** |
4990 * External dependencies |
5258 * External dependencies |
4991 */ |
5259 */ |
4996 |
5264 |
4997 |
5265 |
4998 |
5266 |
4999 |
5267 |
5000 function EditorSnackbars() { |
5268 function EditorSnackbars() { |
5001 const notices = Object(external_wp_data_["useSelect"])(select => select(external_wp_notices_["store"]).getNotices(), []); |
5269 const notices = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_notices_namespaceObject.store).getNotices(), []); |
5002 const { |
5270 const { |
5003 removeNotice |
5271 removeNotice |
5004 } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); |
5272 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
5005 const snackbarNotices = Object(external_lodash_["filter"])(notices, { |
5273 const snackbarNotices = (0,external_lodash_namespaceObject.filter)(notices, { |
5006 type: 'snackbar' |
5274 type: 'snackbar' |
5007 }); |
5275 }); |
5008 return Object(external_wp_element_["createElement"])(external_wp_components_["SnackbarList"], { |
5276 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SnackbarList, { |
5009 notices: snackbarNotices, |
5277 notices: snackbarNotices, |
5010 className: "components-editor-notices__snackbar", |
5278 className: "components-editor-notices__snackbar", |
5011 onRemove: removeNotice |
5279 onRemove: removeNotice |
5012 }); |
5280 }); |
5013 } |
5281 } |
5014 |
5282 |
5015 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js |
5283 ;// CONCATENATED MODULE: external ["wp","htmlEntities"] |
5016 var library_close = __webpack_require__("w95h"); |
5284 var external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; |
5017 |
5285 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js |
5018 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js |
|
5019 |
5286 |
5020 |
5287 |
5021 /** |
5288 /** |
5022 * WordPress dependencies |
5289 * WordPress dependencies |
5023 */ |
5290 */ |
5024 |
5291 |
5025 const page_page = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { |
5292 |
5026 xmlns: "http://www.w3.org/2000/svg", |
5293 |
5027 viewBox: "0 0 24 24" |
5294 |
5028 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { |
5295 |
5029 d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z" |
5296 |
5030 })); |
5297 |
5031 /* harmony default export */ var library_page = (page_page); |
5298 /** |
5032 |
5299 * Internal dependencies |
5033 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js |
5300 */ |
5034 |
5301 |
5035 |
5302 |
5036 /** |
5303 function EntityRecordItem(_ref) { |
5037 * WordPress dependencies |
5304 let { |
5038 */ |
5305 record, |
5039 |
5306 checked, |
5040 |
5307 onChange, |
5041 |
5308 closePanel |
5042 |
5309 } = _ref; |
5043 |
|
5044 function EntityRecordItem({ |
|
5045 record, |
|
5046 checked, |
|
5047 onChange, |
|
5048 closePanel |
|
5049 }) { |
|
5050 const { |
5310 const { |
5051 name, |
5311 name, |
5052 kind, |
5312 kind, |
5053 title, |
5313 title, |
5054 key |
5314 key |
5055 } = record; |
5315 } = record; |
5056 const parentBlockId = Object(external_wp_data_["useSelect"])(select => { |
5316 const parentBlockId = (0,external_wp_data_namespaceObject.useSelect)(select => { |
5057 var _blocks$; |
5317 var _blocks$; |
5058 |
5318 |
5059 // Get entity's blocks. |
5319 // Get entity's blocks. |
5060 const { |
5320 const { |
5061 blocks = [] |
5321 blocks = [] |
5062 } = select('core').getEditedEntityRecord(kind, name, key); // Get parents of the entity's first block. |
5322 } = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key); // Get parents of the entity's first block. |
5063 |
5323 |
5064 const parents = select(external_wp_blockEditor_["store"]).getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId. |
5324 const parents = select(external_wp_blockEditor_namespaceObject.store).getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId. |
5065 |
5325 |
5066 return parents[parents.length - 1]; |
5326 return parents[parents.length - 1]; |
5067 }, []); // Handle templates that might use default descriptive titles |
5327 }, []); // Handle templates that might use default descriptive titles. |
5068 |
5328 |
5069 const entityRecordTitle = Object(external_wp_data_["useSelect"])(select => { |
5329 const entityRecordTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { |
5070 if ('postType' !== kind || 'wp_template' !== name) { |
5330 if ('postType' !== kind || 'wp_template' !== name) { |
5071 return title; |
5331 return title; |
5072 } |
5332 } |
5073 |
5333 |
5074 const template = select('core').getEditedEntityRecord(kind, name, key); |
5334 const template = select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord(kind, name, key); |
5075 return select('core/editor').__experimentalGetTemplateInfo(template).title; |
5335 return select(store_store).__experimentalGetTemplateInfo(template).title; |
5076 }, [name, kind, title, key]); |
5336 }, [name, kind, title, key]); |
5077 const isSelected = Object(external_wp_data_["useSelect"])(select => { |
5337 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => { |
5078 const selectedBlockId = select(external_wp_blockEditor_["store"]).getSelectedBlockClientId(); |
5338 const selectedBlockId = select(external_wp_blockEditor_namespaceObject.store).getSelectedBlockClientId(); |
5079 return selectedBlockId === parentBlockId; |
5339 return selectedBlockId === parentBlockId; |
5080 }, [parentBlockId]); |
5340 }, [parentBlockId]); |
5081 const isSelectedText = isSelected ? Object(external_wp_i18n_["__"])('Selected') : Object(external_wp_i18n_["__"])('Select'); |
5341 const isSelectedText = isSelected ? (0,external_wp_i18n_namespaceObject.__)('Selected') : (0,external_wp_i18n_namespaceObject.__)('Select'); |
5082 const { |
5342 const { |
5083 selectBlock |
5343 selectBlock |
5084 } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); |
5344 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
5085 const selectParentBlock = Object(external_wp_element_["useCallback"])(() => selectBlock(parentBlockId), [parentBlockId]); |
5345 const selectParentBlock = (0,external_wp_element_namespaceObject.useCallback)(() => selectBlock(parentBlockId), [parentBlockId]); |
5086 const selectAndDismiss = Object(external_wp_element_["useCallback"])(() => { |
5346 const selectAndDismiss = (0,external_wp_element_namespaceObject.useCallback)(() => { |
5087 selectBlock(parentBlockId); |
5347 selectBlock(parentBlockId); |
5088 closePanel(); |
5348 closePanel(); |
5089 }, [parentBlockId]); |
5349 }, [parentBlockId]); |
5090 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { |
5350 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { |
5091 label: Object(external_wp_element_["createElement"])("strong", null, entityRecordTitle || Object(external_wp_i18n_["__"])('Untitled')), |
5351 label: (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(entityRecordTitle) || (0,external_wp_i18n_namespaceObject.__)('Untitled')), |
5092 checked: checked, |
5352 checked: checked, |
5093 onChange: onChange |
5353 onChange: onChange |
5094 }), parentBlockId ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
5354 }), parentBlockId ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
5095 onClick: selectParentBlock, |
5355 onClick: selectParentBlock, |
5096 className: "entities-saved-states__find-entity", |
5356 className: "entities-saved-states__find-entity", |
5097 disabled: isSelected |
5357 disabled: isSelected |
5098 }, isSelectedText), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
5358 }, isSelectedText), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
5099 onClick: selectAndDismiss, |
5359 onClick: selectAndDismiss, |
5100 className: "entities-saved-states__find-entity-small", |
5360 className: "entities-saved-states__find-entity-small", |
5101 disabled: isSelected |
5361 disabled: isSelected |
5102 }, isSelectedText)) : null); |
5362 }, isSelectedText)) : null); |
5103 } |
5363 } |
5104 |
5364 |
5105 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js |
5365 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js |
5106 |
5366 |
5107 |
5367 |
5108 /** |
5368 /** |
5109 * External dependencies |
5369 * External dependencies |
5110 */ |
5370 */ |
5120 /** |
5380 /** |
5121 * Internal dependencies |
5381 * Internal dependencies |
5122 */ |
5382 */ |
5123 |
5383 |
5124 |
5384 |
5125 const ENTITY_NAME_ICONS = { |
5385 |
5126 site: layout["a" /* default */], |
5386 function getEntityDescription(entity, count) { |
5127 page: library_page |
5387 switch (entity) { |
5128 }; |
5388 case 'site': |
5129 function EntityTypeList({ |
5389 return 1 === count ? (0,external_wp_i18n_namespaceObject.__)('This change will affect your whole site.') : (0,external_wp_i18n_namespaceObject.__)('These changes will affect your whole site.'); |
5130 list, |
5390 |
5131 unselectedEntities, |
5391 case 'wp_template': |
5132 setUnselectedEntities, |
5392 return (0,external_wp_i18n_namespaceObject.__)('This change will affect pages and posts that use this template.'); |
5133 closePanel |
5393 |
5134 }) { |
5394 case 'page': |
5395 case 'post': |
|
5396 return (0,external_wp_i18n_namespaceObject.__)('The following content has been modified.'); |
|
5397 } |
|
5398 } |
|
5399 |
|
5400 function EntityTypeList(_ref) { |
|
5401 let { |
|
5402 list, |
|
5403 unselectedEntities, |
|
5404 setUnselectedEntities, |
|
5405 closePanel |
|
5406 } = _ref; |
|
5407 const count = list.length; |
|
5135 const firstRecord = list[0]; |
5408 const firstRecord = list[0]; |
5136 const entity = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEntity(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]); // Set icon based on type of entity. |
5409 const entityConfig = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]); |
5137 |
|
5138 const { |
5410 const { |
5139 name |
5411 name |
5140 } = firstRecord; |
5412 } = firstRecord; |
5141 const icon = ENTITY_NAME_ICONS[name]; |
5413 let entityLabel = entityConfig.label; |
5142 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { |
5414 |
5143 title: entity.label, |
5415 if (name === 'wp_template_part') { |
5144 initialOpen: true, |
5416 entityLabel = 1 === count ? (0,external_wp_i18n_namespaceObject.__)('Template Part') : (0,external_wp_i18n_namespaceObject.__)('Template Parts'); |
5145 icon: icon |
5417 } // Set description based on type of entity. |
5146 }, list.map(record => { |
5418 |
5147 return Object(external_wp_element_["createElement"])(EntityRecordItem, { |
5419 |
5420 const description = getEntityDescription(name, count); |
|
5421 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
5422 title: entityLabel, |
|
5423 initialOpen: true |
|
5424 }, description && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, description), list.map(record => { |
|
5425 return (0,external_wp_element_namespaceObject.createElement)(EntityRecordItem, { |
|
5148 key: record.key || record.property, |
5426 key: record.key || record.property, |
5149 record: record, |
5427 record: record, |
5150 checked: !Object(external_lodash_["some"])(unselectedEntities, elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property), |
5428 checked: !(0,external_lodash_namespaceObject.some)(unselectedEntities, elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property), |
5151 onChange: value => setUnselectedEntities(record, value), |
5429 onChange: value => setUnselectedEntities(record, value), |
5152 closePanel: closePanel |
5430 closePanel: closePanel |
5153 }); |
5431 }); |
5154 })); |
5432 })); |
5155 } |
5433 } |
5156 |
5434 |
5157 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js |
5435 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js |
5158 |
5436 |
5159 |
5437 |
5160 |
5438 |
5161 /** |
5439 /** |
5162 * External dependencies |
5440 * External dependencies |
5171 |
5449 |
5172 |
5450 |
5173 |
5451 |
5174 |
5452 |
5175 |
5453 |
5454 |
|
5176 /** |
5455 /** |
5177 * Internal dependencies |
5456 * Internal dependencies |
5178 */ |
5457 */ |
5179 |
5458 |
5180 |
5459 |
5181 const TRANSLATED_SITE_PROTPERTIES = { |
5460 const TRANSLATED_SITE_PROPERTIES = { |
5182 title: Object(external_wp_i18n_["__"])('Title'), |
5461 title: (0,external_wp_i18n_namespaceObject.__)('Title'), |
5183 description: Object(external_wp_i18n_["__"])('Tagline'), |
5462 description: (0,external_wp_i18n_namespaceObject.__)('Tagline'), |
5184 site_logo: Object(external_wp_i18n_["__"])('Logo'), |
5463 site_logo: (0,external_wp_i18n_namespaceObject.__)('Logo'), |
5185 show_on_front: Object(external_wp_i18n_["__"])('Show on front'), |
5464 site_icon: (0,external_wp_i18n_namespaceObject.__)('Icon'), |
5186 page_on_front: Object(external_wp_i18n_["__"])('Page on front') |
5465 show_on_front: (0,external_wp_i18n_namespaceObject.__)('Show on front'), |
5466 page_on_front: (0,external_wp_i18n_namespaceObject.__)('Page on front') |
|
5187 }; |
5467 }; |
5188 function EntitiesSavedStates({ |
5468 const PUBLISH_ON_SAVE_ENTITIES = [{ |
5189 close |
5469 kind: 'postType', |
5190 }) { |
5470 name: 'wp_navigation' |
5191 const saveButtonRef = Object(external_wp_element_["useRef"])(); |
5471 }]; |
5472 function EntitiesSavedStates(_ref) { |
|
5473 let { |
|
5474 close |
|
5475 } = _ref; |
|
5476 const saveButtonRef = (0,external_wp_element_namespaceObject.useRef)(); |
|
5192 const { |
5477 const { |
5193 dirtyEntityRecords |
5478 dirtyEntityRecords |
5194 } = Object(external_wp_data_["useSelect"])(select => { |
5479 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
5195 const dirtyRecords = select(external_wp_coreData_["store"]).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces. |
5480 const dirtyRecords = select(external_wp_coreData_namespaceObject.store).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces. |
5196 |
5481 |
5197 |
5482 |
5198 const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site')); |
5483 const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site')); |
5199 const siteEdits = select(external_wp_coreData_["store"]).getEntityRecordEdits('root', 'site'); |
5484 const siteEdits = select(external_wp_coreData_namespaceObject.store).getEntityRecordEdits('root', 'site'); |
5200 const siteEditsAsEntities = []; |
5485 const siteEditsAsEntities = []; |
5201 |
5486 |
5202 for (const property in siteEdits) { |
5487 for (const property in siteEdits) { |
5203 siteEditsAsEntities.push({ |
5488 siteEditsAsEntities.push({ |
5204 kind: 'root', |
5489 kind: 'root', |
5205 name: 'site', |
5490 name: 'site', |
5206 title: TRANSLATED_SITE_PROTPERTIES[property] || property, |
5491 title: TRANSLATED_SITE_PROPERTIES[property] || property, |
5207 property |
5492 property |
5208 }); |
5493 }); |
5209 } |
5494 } |
5210 |
5495 |
5211 const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities]; |
5496 const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities]; |
5212 return { |
5497 return { |
5213 dirtyEntityRecords: dirtyRecordsWithSiteItems |
5498 dirtyEntityRecords: dirtyRecordsWithSiteItems |
5214 }; |
5499 }; |
5215 }, []); |
5500 }, []); |
5216 const { |
5501 const { |
5502 editEntityRecord, |
|
5217 saveEditedEntityRecord, |
5503 saveEditedEntityRecord, |
5218 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits |
5504 __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits |
5219 } = Object(external_wp_data_["useDispatch"])(external_wp_coreData_["store"]); // To group entities by type. |
5505 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
5220 |
5506 const { |
5221 const partitionedSavables = Object.values(Object(external_lodash_["groupBy"])(dirtyEntityRecords, 'name')); // Unchecked entities to be ignored by save function. |
5507 __unstableMarkLastChangeAsPersistent |
5222 |
5508 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
5223 const [unselectedEntities, _setUnselectedEntities] = Object(external_wp_element_["useState"])([]); |
5509 const { |
5224 |
5510 createSuccessNotice, |
5225 const setUnselectedEntities = ({ |
5511 createErrorNotice |
5226 kind, |
5512 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); // To group entities by type. |
5227 name, |
5513 |
5228 key, |
5514 const partitionedSavables = (0,external_lodash_namespaceObject.groupBy)(dirtyEntityRecords, 'name'); // Sort entity groups. |
5229 property |
5515 |
5230 }, checked) => { |
5516 const { |
5517 site: siteSavables, |
|
5518 wp_template: templateSavables, |
|
5519 wp_template_part: templatePartSavables, |
|
5520 ...contentSavables |
|
5521 } = partitionedSavables; |
|
5522 const sortedPartitionedSavables = [siteSavables, templateSavables, templatePartSavables, ...Object.values(contentSavables)].filter(Array.isArray); // Unchecked entities to be ignored by save function. |
|
5523 |
|
5524 const [unselectedEntities, _setUnselectedEntities] = (0,external_wp_element_namespaceObject.useState)([]); |
|
5525 |
|
5526 const setUnselectedEntities = (_ref2, checked) => { |
|
5527 let { |
|
5528 kind, |
|
5529 name, |
|
5530 key, |
|
5531 property |
|
5532 } = _ref2; |
|
5533 |
|
5231 if (checked) { |
5534 if (checked) { |
5232 _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property)); |
5535 _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property)); |
5233 } else { |
5536 } else { |
5234 _setUnselectedEntities([...unselectedEntities, { |
5537 _setUnselectedEntities([...unselectedEntities, { |
5235 kind, |
5538 kind, |
5239 }]); |
5542 }]); |
5240 } |
5543 } |
5241 }; |
5544 }; |
5242 |
5545 |
5243 const saveCheckedEntities = () => { |
5546 const saveCheckedEntities = () => { |
5244 const entitiesToSave = dirtyEntityRecords.filter(({ |
5547 const entitiesToSave = dirtyEntityRecords.filter(_ref3 => { |
5245 kind, |
5548 let { |
5246 name, |
5549 kind, |
5247 key, |
5550 name, |
5248 property |
5551 key, |
5249 }) => { |
5552 property |
5250 return !Object(external_lodash_["some"])(unselectedEntities, elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property); |
5553 } = _ref3; |
5554 return !(0,external_lodash_namespaceObject.some)(unselectedEntities, elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property); |
|
5251 }); |
5555 }); |
5252 close(entitiesToSave); |
5556 close(entitiesToSave); |
5253 const siteItemsToSave = []; |
5557 const siteItemsToSave = []; |
5254 entitiesToSave.forEach(({ |
5558 const pendingSavedRecords = []; |
5255 kind, |
5559 entitiesToSave.forEach(_ref4 => { |
5256 name, |
5560 let { |
5257 key, |
5561 kind, |
5258 property |
5562 name, |
5259 }) => { |
5563 key, |
5564 property |
|
5565 } = _ref4; |
|
5566 |
|
5260 if ('root' === kind && 'site' === name) { |
5567 if ('root' === kind && 'site' === name) { |
5261 siteItemsToSave.push(property); |
5568 siteItemsToSave.push(property); |
5262 } else { |
5569 } else { |
5263 saveEditedEntityRecord(kind, name, key); |
5570 if (PUBLISH_ON_SAVE_ENTITIES.some(typeToPublish => typeToPublish.kind === kind && typeToPublish.name === name)) { |
5571 editEntityRecord(kind, name, key, { |
|
5572 status: 'publish' |
|
5573 }); |
|
5574 } |
|
5575 |
|
5576 pendingSavedRecords.push(saveEditedEntityRecord(kind, name, key)); |
|
5264 } |
5577 } |
5265 }); |
5578 }); |
5266 saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave); |
5579 |
5580 if (siteItemsToSave.length) { |
|
5581 pendingSavedRecords.push(saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave)); |
|
5582 } |
|
5583 |
|
5584 __unstableMarkLastChangeAsPersistent(); |
|
5585 |
|
5586 Promise.all(pendingSavedRecords).then(values => { |
|
5587 if (values.some(value => typeof value === 'undefined')) { |
|
5588 createErrorNotice((0,external_wp_i18n_namespaceObject.__)('Saving failed.')); |
|
5589 } else { |
|
5590 createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Site updated.'), { |
|
5591 type: 'snackbar' |
|
5592 }); |
|
5593 } |
|
5594 }).catch(error => createErrorNotice(`${(0,external_wp_i18n_namespaceObject.__)('Saving failed.')} ${error}`)); |
|
5267 }; // Explicitly define this with no argument passed. Using `close` on |
5595 }; // Explicitly define this with no argument passed. Using `close` on |
5268 // its own will use the event object in place of the expected saved entities. |
5596 // its own will use the event object in place of the expected saved entities. |
5269 |
5597 |
5270 |
5598 |
5271 const dismissPanel = Object(external_wp_element_["useCallback"])(() => close(), [close]); |
5599 const dismissPanel = (0,external_wp_element_namespaceObject.useCallback)(() => close(), [close]); |
5272 const [saveDialogRef, saveDialogProps] = Object(external_wp_compose_["__experimentalUseDialog"])({ |
5600 const [saveDialogRef, saveDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ |
5273 onClose: () => dismissPanel() |
5601 onClose: () => dismissPanel() |
5274 }); |
5602 }); |
5275 return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ |
5603 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ |
5276 ref: saveDialogRef |
5604 ref: saveDialogRef |
5277 }, saveDialogProps, { |
5605 }, saveDialogProps, { |
5278 className: "entities-saved-states__panel" |
5606 className: "entities-saved-states__panel" |
5279 }), Object(external_wp_element_["createElement"])("div", { |
5607 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
5280 className: "entities-saved-states__panel-header" |
5608 className: "entities-saved-states__panel-header", |
5281 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
5609 gap: 2 |
5610 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { |
|
5611 isBlock: true, |
|
5612 as: external_wp_components_namespaceObject.Button, |
|
5282 ref: saveButtonRef, |
5613 ref: saveButtonRef, |
5283 isPrimary: true, |
5614 variant: "primary", |
5284 disabled: dirtyEntityRecords.length - unselectedEntities.length === 0, |
5615 disabled: dirtyEntityRecords.length - unselectedEntities.length === 0, |
5285 onClick: saveCheckedEntities, |
5616 onClick: saveCheckedEntities, |
5286 className: "editor-entities-saved-states__save-button" |
5617 className: "editor-entities-saved-states__save-button" |
5287 }, Object(external_wp_i18n_["__"])('Save')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
5618 }, (0,external_wp_i18n_namespaceObject.__)('Save')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, { |
5288 icon: library_close["a" /* default */], |
5619 isBlock: true, |
5289 onClick: dismissPanel, |
5620 as: external_wp_components_namespaceObject.Button, |
5290 label: Object(external_wp_i18n_["__"])('Close panel') |
5621 variant: "secondary", |
5291 })), Object(external_wp_element_["createElement"])("div", { |
5622 onClick: dismissPanel |
5623 }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
5292 className: "entities-saved-states__text-prompt" |
5624 className: "entities-saved-states__text-prompt" |
5293 }, Object(external_wp_element_["createElement"])("strong", null, Object(external_wp_i18n_["__"])('Select the changes you want to save')), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Some changes may affect other areas of your site.'))), partitionedSavables.map(list => { |
5625 }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('Are you ready to save?')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('The following changes have been made to your site, templates, and content.'))), sortedPartitionedSavables.map(list => { |
5294 return Object(external_wp_element_["createElement"])(EntityTypeList, { |
5626 return (0,external_wp_element_namespaceObject.createElement)(EntityTypeList, { |
5295 key: list[0].name, |
5627 key: list[0].name, |
5296 list: list, |
5628 list: list, |
5297 closePanel: dismissPanel, |
5629 closePanel: dismissPanel, |
5298 unselectedEntities: unselectedEntities, |
5630 unselectedEntities: unselectedEntities, |
5299 setUnselectedEntities: setUnselectedEntities |
5631 setUnselectedEntities: setUnselectedEntities |
5300 }); |
5632 }); |
5301 })); |
5633 })); |
5302 } |
5634 } |
5303 |
5635 |
5304 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js |
5636 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js |
5305 |
5637 |
5306 |
5638 |
5307 /** |
5639 /** |
5308 * WordPress dependencies |
5640 * WordPress dependencies |
5309 */ |
5641 */ |
5311 |
5643 |
5312 |
5644 |
5313 |
5645 |
5314 |
5646 |
5315 |
5647 |
5316 |
5648 /** |
5317 function CopyButton({ |
5649 * Internal dependencies |
5318 text, |
5650 */ |
5319 children |
5651 |
5320 }) { |
5652 |
5321 const ref = Object(external_wp_compose_["useCopyToClipboard"])(text); |
5653 |
5322 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
5654 function CopyButton(_ref) { |
5323 isSecondary: true, |
5655 let { |
5656 text, |
|
5657 children |
|
5658 } = _ref; |
|
5659 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text); |
|
5660 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
5661 variant: "secondary", |
|
5324 ref: ref |
5662 ref: ref |
5325 }, children); |
5663 }, children); |
5326 } |
5664 } |
5327 |
5665 |
5328 class error_boundary_ErrorBoundary extends external_wp_element_["Component"] { |
5666 class ErrorBoundary extends external_wp_element_namespaceObject.Component { |
5329 constructor() { |
5667 constructor() { |
5330 super(...arguments); |
5668 super(...arguments); |
5331 this.reboot = this.reboot.bind(this); |
5669 this.reboot = this.reboot.bind(this); |
5332 this.getContent = this.getContent.bind(this); |
5670 this.getContent = this.getContent.bind(this); |
5333 this.state = { |
5671 this.state = { |
5351 // used here because it (a) reduces the chance of data loss in the |
5689 // used here because it (a) reduces the chance of data loss in the |
5352 // case of additional errors by performing a direct retrieval and |
5690 // case of additional errors by performing a direct retrieval and |
5353 // (b) avoids the performance cost associated with unnecessary |
5691 // (b) avoids the performance cost associated with unnecessary |
5354 // content serialization throughout the lifetime of a non-erroring |
5692 // content serialization throughout the lifetime of a non-erroring |
5355 // application. |
5693 // application. |
5356 return Object(external_wp_data_["select"])('core/editor').getEditedPostContent(); |
5694 return (0,external_wp_data_namespaceObject.select)(store_store).getEditedPostContent(); |
5357 } catch (error) {} |
5695 } catch (error) {} |
5358 } |
5696 } |
5359 |
5697 |
5360 render() { |
5698 render() { |
5361 const { |
5699 const { |
5364 |
5702 |
5365 if (!error) { |
5703 if (!error) { |
5366 return this.props.children; |
5704 return this.props.children; |
5367 } |
5705 } |
5368 |
5706 |
5369 return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], { |
5707 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { |
5370 className: "editor-error-boundary", |
5708 className: "editor-error-boundary", |
5371 actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
5709 actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
5372 key: "recovery", |
5710 key: "recovery", |
5373 onClick: this.reboot, |
5711 onClick: this.reboot, |
5374 isSecondary: true |
5712 variant: "secondary" |
5375 }, Object(external_wp_i18n_["__"])('Attempt Recovery')), Object(external_wp_element_["createElement"])(CopyButton, { |
5713 }, (0,external_wp_i18n_namespaceObject.__)('Attempt Recovery')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, { |
5376 key: "copy-post", |
5714 key: "copy-post", |
5377 text: this.getContent |
5715 text: this.getContent |
5378 }, Object(external_wp_i18n_["__"])('Copy Post Text')), Object(external_wp_element_["createElement"])(CopyButton, { |
5716 }, (0,external_wp_i18n_namespaceObject.__)('Copy Post Text')), (0,external_wp_element_namespaceObject.createElement)(CopyButton, { |
5379 key: "copy-error", |
5717 key: "copy-error", |
5380 text: error.stack |
5718 text: error.stack |
5381 }, Object(external_wp_i18n_["__"])('Copy Error'))] |
5719 }, (0,external_wp_i18n_namespaceObject.__)('Copy Error'))] |
5382 }, Object(external_wp_i18n_["__"])('The editor has encountered an unexpected error.')); |
5720 }, (0,external_wp_i18n_namespaceObject.__)('The editor has encountered an unexpected error.')); |
5383 } |
5721 } |
5384 |
5722 |
5385 } |
5723 } |
5386 |
5724 |
5387 /* harmony default export */ var error_boundary = (error_boundary_ErrorBoundary); |
5725 /* harmony default export */ var error_boundary = (ErrorBoundary); |
5388 |
5726 |
5389 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js |
5727 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js |
5390 |
5728 |
5391 |
5729 |
5392 /** |
5730 /** |
5393 * External dependencies |
5731 * External dependencies |
5394 */ |
5732 */ |
5404 |
5742 |
5405 |
5743 |
5406 /** |
5744 /** |
5407 * Internal dependencies |
5745 * Internal dependencies |
5408 */ |
5746 */ |
5747 |
|
5409 |
5748 |
5410 |
5749 |
5411 |
5750 |
5412 const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; |
5751 const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame; |
5413 /** |
5752 /** |
5414 * Function which returns true if the current environment supports browser |
5753 * Function which returns true if the current environment supports browser |
5415 * sessionStorage, or false otherwise. The result of this function is cached and |
5754 * sessionStorage, or false otherwise. The result of this function is cached and |
5416 * reused in subsequent invocations. |
5755 * reused in subsequent invocations. |
5417 */ |
5756 */ |
5418 |
5757 |
5419 const hasSessionStorageSupport = Object(external_lodash_["once"])(() => { |
5758 const hasSessionStorageSupport = (0,external_lodash_namespaceObject.once)(() => { |
5420 try { |
5759 try { |
5421 // Private Browsing in Safari 10 and earlier will throw an error when |
5760 // Private Browsing in Safari 10 and earlier will throw an error when |
5422 // attempting to set into sessionStorage. The test here is intentional in |
5761 // attempting to set into sessionStorage. The test here is intentional in |
5423 // causing a thrown error as condition bailing from local autosave. |
5762 // causing a thrown error as condition bailing from local autosave. |
5424 window.sessionStorage.setItem('__wpEditorTestSessionStorage', ''); |
5763 window.sessionStorage.setItem('__wpEditorTestSessionStorage', ''); |
5436 function useAutosaveNotice() { |
5775 function useAutosaveNotice() { |
5437 const { |
5776 const { |
5438 postId, |
5777 postId, |
5439 isEditedPostNew, |
5778 isEditedPostNew, |
5440 hasRemoteAutosave |
5779 hasRemoteAutosave |
5441 } = Object(external_wp_data_["useSelect"])(select => ({ |
5780 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
5442 postId: select('core/editor').getCurrentPostId(), |
5781 postId: select(store_store).getCurrentPostId(), |
5443 isEditedPostNew: select('core/editor').isEditedPostNew(), |
5782 isEditedPostNew: select(store_store).isEditedPostNew(), |
5444 getEditedPostAttribute: select('core/editor').getEditedPostAttribute, |
5783 hasRemoteAutosave: !!select(store_store).getEditorSettings().autosave |
5445 hasRemoteAutosave: !!select('core/editor').getEditorSettings().autosave |
|
5446 }), []); |
5784 }), []); |
5447 const { |
5785 const { |
5448 getEditedPostAttribute |
5786 getEditedPostAttribute |
5449 } = Object(external_wp_data_["useSelect"])('core/editor'); |
5787 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); |
5450 const { |
5788 const { |
5451 createWarningNotice, |
5789 createWarningNotice, |
5452 removeNotice |
5790 removeNotice |
5453 } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); |
5791 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
5454 const { |
5792 const { |
5455 editPost, |
5793 editPost, |
5456 resetEditorBlocks |
5794 resetEditorBlocks |
5457 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
5795 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
5458 Object(external_wp_element_["useEffect"])(() => { |
5796 (0,external_wp_element_namespaceObject.useEffect)(() => { |
5459 let localAutosave = localAutosaveGet(postId, isEditedPostNew); |
5797 let localAutosave = localAutosaveGet(postId, isEditedPostNew); |
5460 |
5798 |
5461 if (!localAutosave) { |
5799 if (!localAutosave) { |
5462 return; |
5800 return; |
5463 } |
5801 } |
5495 |
5833 |
5496 if (hasRemoteAutosave) { |
5834 if (hasRemoteAutosave) { |
5497 return; |
5835 return; |
5498 } |
5836 } |
5499 |
5837 |
5500 const noticeId = Object(external_lodash_["uniqueId"])('wpEditorAutosaveRestore'); |
5838 const noticeId = (0,external_lodash_namespaceObject.uniqueId)('wpEditorAutosaveRestore'); |
5501 createWarningNotice(Object(external_wp_i18n_["__"])('The backup of this post in your browser is different from the version below.'), { |
5839 createWarningNotice((0,external_wp_i18n_namespaceObject.__)('The backup of this post in your browser is different from the version below.'), { |
5502 id: noticeId, |
5840 id: noticeId, |
5503 actions: [{ |
5841 actions: [{ |
5504 label: Object(external_wp_i18n_["__"])('Restore the backup'), |
5842 label: (0,external_wp_i18n_namespaceObject.__)('Restore the backup'), |
5505 |
5843 |
5506 onClick() { |
5844 onClick() { |
5507 editPost(Object(external_lodash_["omit"])(edits, ['content'])); |
5845 editPost((0,external_lodash_namespaceObject.omit)(edits, ['content'])); |
5508 resetEditorBlocks(Object(external_wp_blocks_["parse"])(edits.content)); |
5846 resetEditorBlocks((0,external_wp_blocks_namespaceObject.parse)(edits.content)); |
5509 removeNotice(noticeId); |
5847 removeNotice(noticeId); |
5510 } |
5848 } |
5511 |
5849 |
5512 }] |
5850 }] |
5513 }); |
5851 }); |
5523 postId, |
5861 postId, |
5524 isEditedPostNew, |
5862 isEditedPostNew, |
5525 isDirty, |
5863 isDirty, |
5526 isAutosaving, |
5864 isAutosaving, |
5527 didError |
5865 didError |
5528 } = Object(external_wp_data_["useSelect"])(select => ({ |
5866 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
5529 postId: select('core/editor').getCurrentPostId(), |
5867 postId: select(store_store).getCurrentPostId(), |
5530 isEditedPostNew: select('core/editor').isEditedPostNew(), |
5868 isEditedPostNew: select(store_store).isEditedPostNew(), |
5531 isDirty: select('core/editor').isEditedPostDirty(), |
5869 isDirty: select(store_store).isEditedPostDirty(), |
5532 isAutosaving: select('core/editor').isAutosavingPost(), |
5870 isAutosaving: select(store_store).isAutosavingPost(), |
5533 didError: select('core/editor').didPostSaveRequestFail() |
5871 didError: select(store_store).didPostSaveRequestFail() |
5534 }), []); |
5872 }), []); |
5535 const lastIsDirty = Object(external_wp_element_["useRef"])(isDirty); |
5873 const lastIsDirty = (0,external_wp_element_namespaceObject.useRef)(isDirty); |
5536 const lastIsAutosaving = Object(external_wp_element_["useRef"])(isAutosaving); |
5874 const lastIsAutosaving = (0,external_wp_element_namespaceObject.useRef)(isAutosaving); |
5537 Object(external_wp_element_["useEffect"])(() => { |
5875 (0,external_wp_element_namespaceObject.useEffect)(() => { |
5538 if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) { |
5876 if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) { |
5539 localAutosaveClear(postId, isEditedPostNew); |
5877 localAutosaveClear(postId, isEditedPostNew); |
5540 } |
5878 } |
5541 |
5879 |
5542 lastIsDirty.current = isDirty; |
5880 lastIsDirty.current = isDirty; |
5543 lastIsAutosaving.current = isAutosaving; |
5881 lastIsAutosaving.current = isAutosaving; |
5544 }, [isDirty, isAutosaving, didError]); // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave. |
5882 }, [isDirty, isAutosaving, didError]); // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave. |
5545 |
5883 |
5546 const wasEditedPostNew = Object(external_wp_compose_["usePrevious"])(isEditedPostNew); |
5884 const wasEditedPostNew = (0,external_wp_compose_namespaceObject.usePrevious)(isEditedPostNew); |
5547 const prevPostId = Object(external_wp_compose_["usePrevious"])(postId); |
5885 const prevPostId = (0,external_wp_compose_namespaceObject.usePrevious)(postId); |
5548 Object(external_wp_element_["useEffect"])(() => { |
5886 (0,external_wp_element_namespaceObject.useEffect)(() => { |
5549 if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) { |
5887 if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) { |
5550 localAutosaveClear(postId, true); |
5888 localAutosaveClear(postId, true); |
5551 } |
5889 } |
5552 }, [isEditedPostNew, postId]); |
5890 }, [isEditedPostNew, postId]); |
5553 } |
5891 } |
5554 |
5892 |
5555 function LocalAutosaveMonitor() { |
5893 function LocalAutosaveMonitor() { |
5556 const { |
5894 const { |
5557 autosave |
5895 autosave |
5558 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
5896 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
5559 const deferedAutosave = Object(external_wp_element_["useCallback"])(() => { |
5897 const deferredAutosave = (0,external_wp_element_namespaceObject.useCallback)(() => { |
5560 requestIdleCallback(() => autosave({ |
5898 requestIdleCallback(() => autosave({ |
5561 local: true |
5899 local: true |
5562 })); |
5900 })); |
5563 }, []); |
5901 }, []); |
5564 useAutosaveNotice(); |
5902 useAutosaveNotice(); |
5565 useAutosavePurge(); |
5903 useAutosavePurge(); |
5566 const { |
5904 const { |
5567 localAutosaveInterval |
5905 localAutosaveInterval |
5568 } = Object(external_wp_data_["useSelect"])(select => ({ |
5906 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
5569 localAutosaveInterval: select('core/editor').getEditorSettings().__experimentalLocalAutosaveInterval |
5907 localAutosaveInterval: select(store_store).getEditorSettings().localAutosaveInterval |
5570 }), []); |
5908 }), []); |
5571 return Object(external_wp_element_["createElement"])(autosave_monitor, { |
5909 return (0,external_wp_element_namespaceObject.createElement)(autosave_monitor, { |
5572 interval: localAutosaveInterval, |
5910 interval: localAutosaveInterval, |
5573 autosave: deferedAutosave |
5911 autosave: deferredAutosave |
5574 }); |
5912 }); |
5575 } |
5913 } |
5576 |
5914 |
5577 /* harmony default export */ var local_autosave_monitor = (Object(external_wp_compose_["ifCondition"])(hasSessionStorageSupport)(LocalAutosaveMonitor)); |
5915 /* harmony default export */ var local_autosave_monitor = ((0,external_wp_compose_namespaceObject.ifCondition)(hasSessionStorageSupport)(LocalAutosaveMonitor)); |
5578 |
5916 |
5579 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js |
5917 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js |
5580 /** |
5918 /** |
5581 * External dependencies |
5919 * External dependencies |
5582 */ |
5920 */ |
5583 |
5921 |
5584 /** |
5922 /** |
5590 /** |
5928 /** |
5591 * Internal dependencies |
5929 * Internal dependencies |
5592 */ |
5930 */ |
5593 |
5931 |
5594 |
5932 |
5595 function PageAttributesCheck({ |
5933 function PageAttributesCheck(_ref) { |
5596 children |
5934 let { |
5597 }) { |
5935 children |
5598 const postType = Object(external_wp_data_["useSelect"])(select => { |
5936 } = _ref; |
5937 const postType = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
5599 const { |
5938 const { |
5600 getEditedPostAttribute |
5939 getEditedPostAttribute |
5601 } = select(store); |
5940 } = select(store_store); |
5602 const { |
5941 const { |
5603 getPostType |
5942 getPostType |
5604 } = select(external_wp_coreData_["store"]); |
5943 } = select(external_wp_coreData_namespaceObject.store); |
5605 return getPostType(getEditedPostAttribute('type')); |
5944 return getPostType(getEditedPostAttribute('type')); |
5606 }, []); |
5945 }, []); |
5607 const supportsPageAttributes = Object(external_lodash_["get"])(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist. |
5946 const supportsPageAttributes = (0,external_lodash_namespaceObject.get)(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist. |
5608 |
5947 |
5609 if (!supportsPageAttributes) { |
5948 if (!supportsPageAttributes) { |
5610 return null; |
5949 return null; |
5611 } |
5950 } |
5612 |
5951 |
5613 return children; |
5952 return children; |
5614 } |
5953 } |
5615 /* harmony default export */ var page_attributes_check = (PageAttributesCheck); |
5954 /* harmony default export */ var page_attributes_check = (PageAttributesCheck); |
5616 |
5955 |
5617 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js |
5956 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js |
5618 /** |
5957 /** |
5619 * External dependencies |
5958 * External dependencies |
5620 */ |
5959 */ |
5621 |
5960 |
5622 /** |
5961 /** |
5623 * WordPress dependencies |
5962 * WordPress dependencies |
5963 */ |
|
5964 |
|
5965 |
|
5966 |
|
5967 /** |
|
5968 * Internal dependencies |
|
5624 */ |
5969 */ |
5625 |
5970 |
5626 |
5971 |
5627 /** |
5972 /** |
5628 * A component which renders its own children only if the current editor post |
5973 * A component which renders its own children only if the current editor post |
5629 * type supports one of the given `supportKeys` prop. |
5974 * type supports one of the given `supportKeys` prop. |
5630 * |
5975 * |
5631 * @param {Object} props Props. |
5976 * @param {Object} props Props. |
5632 * @param {string} [props.postType] Current post type. |
5977 * @param {string} [props.postType] Current post type. |
5633 * @param {WPElement} props.children Children to be rendered if post |
5978 * @param {WPElement} props.children Children to be rendered if post |
5634 * type supports. |
5979 * type supports. |
5635 * @param {(string|string[])} props.supportKeys String or string array of keys |
5980 * @param {(string|string[])} props.supportKeys String or string array of keys |
5636 * to test. |
5981 * to test. |
5637 * |
5982 * |
5638 * @return {WPComponent} The component to be rendered. |
5983 * @return {WPComponent} The component to be rendered. |
5639 */ |
5984 */ |
5640 |
5985 |
5641 function PostTypeSupportCheck({ |
5986 function PostTypeSupportCheck(_ref) { |
5642 postType, |
5987 let { |
5643 children, |
5988 postType, |
5644 supportKeys |
5989 children, |
5645 }) { |
5990 supportKeys |
5991 } = _ref; |
|
5646 let isSupported = true; |
5992 let isSupported = true; |
5647 |
5993 |
5648 if (postType) { |
5994 if (postType) { |
5649 isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), key => !!postType.supports[key]); |
5995 isSupported = (0,external_lodash_namespaceObject.some)((0,external_lodash_namespaceObject.castArray)(supportKeys), key => !!postType.supports[key]); |
5650 } |
5996 } |
5651 |
5997 |
5652 if (!isSupported) { |
5998 if (!isSupported) { |
5653 return null; |
5999 return null; |
5654 } |
6000 } |
5655 |
6001 |
5656 return children; |
6002 return children; |
5657 } |
6003 } |
5658 /* harmony default export */ var post_type_support_check = (Object(external_wp_data_["withSelect"])(select => { |
6004 /* harmony default export */ var post_type_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
5659 const { |
6005 const { |
5660 getEditedPostAttribute |
6006 getEditedPostAttribute |
5661 } = select('core/editor'); |
6007 } = select(store_store); |
5662 const { |
6008 const { |
5663 getPostType |
6009 getPostType |
5664 } = select('core'); |
6010 } = select(external_wp_coreData_namespaceObject.store); |
5665 return { |
6011 return { |
5666 postType: getPostType(getEditedPostAttribute('type')) |
6012 postType: getPostType(getEditedPostAttribute('type')) |
5667 }; |
6013 }; |
5668 })(PostTypeSupportCheck)); |
6014 })(PostTypeSupportCheck)); |
5669 |
6015 |
5670 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js |
6016 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js |
5671 |
6017 |
5672 |
6018 |
5673 /** |
6019 /** |
5674 * External dependencies |
6020 * External dependencies |
5675 */ |
6021 */ |
5680 |
6026 |
5681 |
6027 |
5682 |
6028 |
5683 |
6029 |
5684 |
6030 |
6031 |
|
5685 /** |
6032 /** |
5686 * Internal dependencies |
6033 * Internal dependencies |
5687 */ |
6034 */ |
5688 |
6035 |
5689 |
6036 |
5690 const PageAttributesOrder = Object(external_wp_compose_["withState"])({ |
6037 |
5691 orderInput: null |
6038 const PageAttributesOrder = _ref => { |
5692 })(({ |
6039 let { |
5693 onUpdateOrder, |
6040 onUpdateOrder, |
5694 order = 0, |
6041 order = 0 |
5695 orderInput, |
6042 } = _ref; |
5696 setState |
6043 const [orderInput, setOrderInput] = (0,external_wp_element_namespaceObject.useState)(null); |
5697 }) => { |
6044 |
5698 const setUpdatedOrder = value => { |
6045 const setUpdatedOrder = value => { |
5699 setState({ |
6046 setOrderInput(value); |
5700 orderInput: value |
|
5701 }); |
|
5702 const newOrder = Number(value); |
6047 const newOrder = Number(value); |
5703 |
6048 |
5704 if (Number.isInteger(newOrder) && Object(external_lodash_["invoke"])(value, ['trim']) !== '') { |
6049 if (Number.isInteger(newOrder) && (0,external_lodash_namespaceObject.invoke)(value, ['trim']) !== '') { |
5705 onUpdateOrder(Number(value)); |
6050 onUpdateOrder(Number(value)); |
5706 } |
6051 } |
5707 }; |
6052 }; |
5708 |
6053 |
5709 const value = orderInput === null ? order : orderInput; |
6054 const value = orderInput === null ? order : orderInput; |
5710 return Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { |
6055 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
5711 className: "editor-page-attributes__order", |
6056 className: "editor-page-attributes__order", |
5712 type: "number", |
6057 type: "number", |
5713 label: Object(external_wp_i18n_["__"])('Order'), |
6058 label: (0,external_wp_i18n_namespaceObject.__)('Order'), |
5714 value: value, |
6059 value: value, |
5715 onChange: setUpdatedOrder, |
6060 onChange: setUpdatedOrder, |
5716 size: 6, |
6061 size: 6, |
5717 onBlur: () => { |
6062 onBlur: () => { |
5718 setState({ |
6063 setOrderInput(null); |
5719 orderInput: null |
|
5720 }); |
|
5721 } |
6064 } |
5722 }); |
6065 }); |
5723 }); |
6066 }; |
5724 |
6067 |
5725 function PageAttributesOrderWithChecks(props) { |
6068 function PageAttributesOrderWithChecks(props) { |
5726 return Object(external_wp_element_["createElement"])(post_type_support_check, { |
6069 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { |
5727 supportKeys: "page-attributes" |
6070 supportKeys: "page-attributes" |
5728 }, Object(external_wp_element_["createElement"])(PageAttributesOrder, props)); |
6071 }, (0,external_wp_element_namespaceObject.createElement)(PageAttributesOrder, props)); |
5729 } |
6072 } |
5730 |
6073 |
5731 /* harmony default export */ var page_attributes_order = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
6074 /* harmony default export */ var order = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
5732 return { |
6075 return { |
5733 order: select('core/editor').getEditedPostAttribute('menu_order') |
6076 order: select(store_store).getEditedPostAttribute('menu_order') |
5734 }; |
6077 }; |
5735 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ |
6078 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
5736 onUpdateOrder(order) { |
6079 onUpdateOrder(order) { |
5737 dispatch('core/editor').editPost({ |
6080 dispatch(store_store).editPost({ |
5738 menu_order: order |
6081 menu_order: order |
5739 }); |
6082 }); |
5740 } |
6083 } |
5741 |
6084 |
5742 }))])(PageAttributesOrderWithChecks)); |
6085 }))])(PageAttributesOrderWithChecks)); |
5743 |
6086 |
5744 // EXTERNAL MODULE: external ["wp","htmlEntities"] |
6087 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js |
5745 var external_wp_htmlEntities_ = __webpack_require__("rmEH"); |
|
5746 |
|
5747 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js |
|
5748 /** |
6088 /** |
5749 * External dependencies |
6089 * External dependencies |
5750 */ |
6090 */ |
5751 |
6091 |
5752 /** |
6092 /** |
5753 * Returns terms in a tree form. |
6093 * Returns terms in a tree form. |
5754 * |
6094 * |
5755 * @param {Array} flatTerms Array of terms in flat format. |
6095 * @param {Array} flatTerms Array of terms in flat format. |
5756 * |
6096 * |
5757 * @return {Array} Array of terms in tree format. |
6097 * @return {Array} Array of terms in tree format. |
5758 */ |
6098 */ |
5759 |
6099 |
5760 function buildTermsTree(flatTerms) { |
6100 function buildTermsTree(flatTerms) { |
5763 children: [], |
6103 children: [], |
5764 parent: null, |
6104 parent: null, |
5765 ...term |
6105 ...term |
5766 }; |
6106 }; |
5767 }); |
6107 }); |
5768 const termsByParent = Object(external_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent'); |
6108 const termsByParent = (0,external_lodash_namespaceObject.groupBy)(flatTermsWithParentAndChildren, 'parent'); |
5769 |
6109 |
5770 if (termsByParent.null && termsByParent.null.length) { |
6110 if (termsByParent.null && termsByParent.null.length) { |
5771 return flatTermsWithParentAndChildren; |
6111 return flatTermsWithParentAndChildren; |
5772 } |
6112 } |
5773 |
6113 |
5782 |
6122 |
5783 return fillWithChildren(termsByParent['0'] || []); |
6123 return fillWithChildren(termsByParent['0'] || []); |
5784 } // Lodash unescape function handles ' but not ' which may be return in some API requests. |
6124 } // Lodash unescape function handles ' but not ' which may be return in some API requests. |
5785 |
6125 |
5786 const unescapeString = arg => { |
6126 const unescapeString = arg => { |
5787 return Object(external_lodash_["unescape"])(arg.replace(''', "'")); |
6127 return (0,external_lodash_namespaceObject.unescape)(arg.replace(''', "'")); |
5788 }; |
6128 }; |
5789 /** |
6129 /** |
5790 * Returns a term object with name unescaped. |
6130 * Returns a term object with name unescaped. |
5791 * The unescape of the name property is done using lodash unescape function. |
6131 * The unescape of the name property is done using lodash unescape function. |
5792 * |
6132 * |
5808 * |
6148 * |
5809 * @return {Object[]} Array of term objects unescaped. |
6149 * @return {Object[]} Array of term objects unescaped. |
5810 */ |
6150 */ |
5811 |
6151 |
5812 const unescapeTerms = terms => { |
6152 const unescapeTerms = terms => { |
5813 return Object(external_lodash_["map"])(terms, unescapeTerm); |
6153 return (0,external_lodash_namespaceObject.map)(terms, unescapeTerm); |
5814 }; |
6154 }; |
5815 |
6155 |
5816 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js |
6156 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js |
5817 |
6157 |
5818 |
6158 |
5819 /** |
6159 /** |
5820 * External dependencies |
6160 * External dependencies |
5821 */ |
6161 */ |
5827 |
6167 |
5828 |
6168 |
5829 |
6169 |
5830 |
6170 |
5831 |
6171 |
6172 |
|
5832 /** |
6173 /** |
5833 * Internal dependencies |
6174 * Internal dependencies |
5834 */ |
6175 */ |
6176 |
|
5835 |
6177 |
5836 |
6178 |
5837 |
6179 |
5838 function getTitle(post) { |
6180 function getTitle(post) { |
5839 var _post$title; |
6181 var _post$title; |
5840 |
6182 |
5841 return post !== null && post !== void 0 && (_post$title = post.title) !== null && _post$title !== void 0 && _post$title.rendered ? Object(external_wp_htmlEntities_["decodeEntities"])(post.title.rendered) : `#${post.id} (${Object(external_wp_i18n_["__"])('no title')})`; |
6183 return post !== null && post !== void 0 && (_post$title = post.title) !== null && _post$title !== void 0 && _post$title.rendered ? (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title.rendered) : `#${post.id} (${(0,external_wp_i18n_namespaceObject.__)('no title')})`; |
5842 } |
6184 } |
5843 |
6185 |
5844 const getItemPriority = (name, searchValue) => { |
6186 const getItemPriority = (name, searchValue) => { |
5845 const normalizedName = Object(external_lodash_["deburr"])(name).toLowerCase(); |
6187 const normalizedName = (0,external_lodash_namespaceObject.deburr)(name).toLowerCase(); |
5846 const normalizedSearch = Object(external_lodash_["deburr"])(searchValue).toLowerCase(); |
6188 const normalizedSearch = (0,external_lodash_namespaceObject.deburr)(searchValue).toLowerCase(); |
5847 |
6189 |
5848 if (normalizedName === normalizedSearch) { |
6190 if (normalizedName === normalizedSearch) { |
5849 return 0; |
6191 return 0; |
5850 } |
6192 } |
5851 |
6193 |
5856 return Infinity; |
6198 return Infinity; |
5857 }; |
6199 }; |
5858 function PageAttributesParent() { |
6200 function PageAttributesParent() { |
5859 const { |
6201 const { |
5860 editPost |
6202 editPost |
5861 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
6203 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
5862 const [fieldValue, setFieldValue] = Object(external_wp_element_["useState"])(false); |
6204 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(false); |
5863 const { |
6205 const { |
5864 parentPost, |
6206 parentPost, |
5865 parentPostId, |
6207 parentPostId, |
5866 items, |
6208 items, |
5867 postType |
6209 postType |
5868 } = Object(external_wp_data_["useSelect"])(select => { |
6210 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
5869 const { |
6211 const { |
5870 getPostType, |
6212 getPostType, |
5871 getEntityRecords, |
6213 getEntityRecords, |
5872 getEntityRecord |
6214 getEntityRecord |
5873 } = select('core'); |
6215 } = select(external_wp_coreData_namespaceObject.store); |
5874 const { |
6216 const { |
5875 getCurrentPostId, |
6217 getCurrentPostId, |
5876 getEditedPostAttribute |
6218 getEditedPostAttribute |
5877 } = select('core/editor'); |
6219 } = select(store_store); |
5878 const postTypeSlug = getEditedPostAttribute('type'); |
6220 const postTypeSlug = getEditedPostAttribute('type'); |
5879 const pageId = getEditedPostAttribute('parent'); |
6221 const pageId = getEditedPostAttribute('parent'); |
5880 const pType = getPostType(postTypeSlug); |
6222 const pType = getPostType(postTypeSlug); |
5881 const postId = getCurrentPostId(); |
6223 const postId = getCurrentPostId(); |
5882 const isHierarchical = Object(external_lodash_["get"])(pType, ['hierarchical'], false); |
6224 const isHierarchical = (0,external_lodash_namespaceObject.get)(pType, ['hierarchical'], false); |
5883 const query = { |
6225 const query = { |
5884 per_page: 100, |
6226 per_page: 100, |
5885 exclude: postId, |
6227 exclude: postId, |
5886 parent_exclude: postId, |
6228 parent_exclude: postId, |
5887 orderby: 'menu_order', |
6229 orderby: 'menu_order', |
5898 parentPost: pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null, |
6240 parentPost: pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null, |
5899 items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [], |
6241 items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [], |
5900 postType: pType |
6242 postType: pType |
5901 }; |
6243 }; |
5902 }, [fieldValue]); |
6244 }, [fieldValue]); |
5903 const isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false); |
6245 const isHierarchical = (0,external_lodash_namespaceObject.get)(postType, ['hierarchical'], false); |
5904 const parentPageLabel = Object(external_lodash_["get"])(postType, ['labels', 'parent_item_colon']); |
6246 const parentPageLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'parent_item_colon']); |
5905 const pageItems = items || []; |
6247 const pageItems = items || []; |
5906 const parentOptions = Object(external_wp_element_["useMemo"])(() => { |
6248 const parentOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { |
5907 const getOptionsFromTree = (tree, level = 0) => { |
6249 const getOptionsFromTree = function (tree) { |
6250 let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; |
|
5908 const mappedNodes = tree.map(treeNode => [{ |
6251 const mappedNodes = tree.map(treeNode => [{ |
5909 value: treeNode.id, |
6252 value: treeNode.id, |
5910 label: Object(external_lodash_["repeat"])('— ', level) + Object(external_lodash_["unescape"])(treeNode.name), |
6253 label: (0,external_lodash_namespaceObject.repeat)('— ', level) + (0,external_lodash_namespaceObject.unescape)(treeNode.name), |
5911 rawName: treeNode.name |
6254 rawName: treeNode.name |
5912 }, ...getOptionsFromTree(treeNode.children || [], level + 1)]); |
6255 }, ...getOptionsFromTree(treeNode.children || [], level + 1)]); |
5913 const sortedNodes = mappedNodes.sort(([a], [b]) => { |
6256 const sortedNodes = mappedNodes.sort((_ref, _ref2) => { |
6257 let [a] = _ref; |
|
6258 let [b] = _ref2; |
|
5914 const priorityA = getItemPriority(a.rawName, fieldValue); |
6259 const priorityA = getItemPriority(a.rawName, fieldValue); |
5915 const priorityB = getItemPriority(b.rawName, fieldValue); |
6260 const priorityB = getItemPriority(b.rawName, fieldValue); |
5916 return priorityA >= priorityB ? 1 : -1; |
6261 return priorityA >= priorityB ? 1 : -1; |
5917 }); |
6262 }); |
5918 return Object(external_lodash_["flatten"])(sortedNodes); |
6263 return (0,external_lodash_namespaceObject.flatten)(sortedNodes); |
5919 }; |
6264 }; |
5920 |
6265 |
5921 let tree = pageItems.map(item => ({ |
6266 let tree = pageItems.map(item => ({ |
5922 id: item.id, |
6267 id: item.id, |
5923 parent: item.parent, |
6268 parent: item.parent, |
5928 tree = buildTermsTree(tree); |
6273 tree = buildTermsTree(tree); |
5929 } |
6274 } |
5930 |
6275 |
5931 const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list. |
6276 const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list. |
5932 |
6277 |
5933 const optsHasParent = Object(external_lodash_["find"])(opts, item => item.value === parentPostId); |
6278 const optsHasParent = (0,external_lodash_namespaceObject.find)(opts, item => item.value === parentPostId); |
5934 |
6279 |
5935 if (parentPost && !optsHasParent) { |
6280 if (parentPost && !optsHasParent) { |
5936 opts.unshift({ |
6281 opts.unshift({ |
5937 value: parentPostId, |
6282 value: parentPostId, |
5938 label: getTitle(parentPost) |
6283 label: getTitle(parentPost) |
5966 editPost({ |
6311 editPost({ |
5967 parent: selectedPostId |
6312 parent: selectedPostId |
5968 }); |
6313 }); |
5969 }; |
6314 }; |
5970 |
6315 |
5971 return Object(external_wp_element_["createElement"])(external_wp_components_["ComboboxControl"], { |
6316 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, { |
5972 className: "editor-page-attributes__parent", |
6317 className: "editor-page-attributes__parent", |
5973 label: parentPageLabel, |
6318 label: parentPageLabel, |
5974 value: parentPostId, |
6319 value: parentPostId, |
5975 options: parentOptions, |
6320 options: parentOptions, |
5976 onFilterValueChange: Object(external_lodash_["debounce"])(handleKeydown, 300), |
6321 onFilterValueChange: (0,external_lodash_namespaceObject.debounce)(handleKeydown, 300), |
5977 onChange: handleChange |
6322 onChange: handleChange |
5978 }); |
6323 }); |
5979 } |
6324 } |
5980 /* harmony default export */ var page_attributes_parent = (PageAttributesParent); |
6325 /* harmony default export */ var page_attributes_parent = (PageAttributesParent); |
5981 |
6326 |
5982 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/index.js |
6327 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/index.js |
5983 |
6328 |
5984 |
6329 |
5985 /** |
6330 /** |
5986 * External dependencies |
6331 * External dependencies |
5987 */ |
6332 */ |
5997 /** |
6342 /** |
5998 * Internal dependencies |
6343 * Internal dependencies |
5999 */ |
6344 */ |
6000 |
6345 |
6001 |
6346 |
6002 function PostTemplate({}) { |
6347 function PostTemplate(_ref) { |
6348 let {} = _ref; |
|
6003 const { |
6349 const { |
6004 availableTemplates, |
6350 availableTemplates, |
6005 selectedTemplate, |
6351 selectedTemplate, |
6006 isViewable |
6352 isViewable |
6007 } = Object(external_wp_data_["useSelect"])(select => { |
6353 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
6008 var _getPostType$viewable, _getPostType; |
6354 var _getPostType$viewable, _getPostType; |
6009 |
6355 |
6010 const { |
6356 const { |
6011 getEditedPostAttribute, |
6357 getEditedPostAttribute, |
6012 getEditorSettings, |
6358 getEditorSettings, |
6013 getCurrentPostType |
6359 getCurrentPostType |
6014 } = select(store); |
6360 } = select(store_store); |
6015 const { |
6361 const { |
6016 getPostType |
6362 getPostType |
6017 } = select(external_wp_coreData_["store"]); |
6363 } = select(external_wp_coreData_namespaceObject.store); |
6018 return { |
6364 return { |
6019 selectedTemplate: getEditedPostAttribute('template'), |
6365 selectedTemplate: getEditedPostAttribute('template'), |
6020 availableTemplates: getEditorSettings().availableTemplates, |
6366 availableTemplates: getEditorSettings().availableTemplates, |
6021 isViewable: (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false |
6367 isViewable: (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false |
6022 }; |
6368 }; |
6023 }, []); |
6369 }, []); |
6024 const { |
6370 const { |
6025 editPost |
6371 editPost |
6026 } = Object(external_wp_data_["useDispatch"])(store); |
6372 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
6027 |
6373 |
6028 if (!isViewable || Object(external_lodash_["isEmpty"])(availableTemplates)) { |
6374 if (!isViewable || (0,external_lodash_namespaceObject.isEmpty)(availableTemplates)) { |
6029 return null; |
6375 return null; |
6030 } |
6376 } |
6031 |
6377 |
6032 return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { |
6378 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { |
6033 label: Object(external_wp_i18n_["__"])('Template:'), |
6379 label: (0,external_wp_i18n_namespaceObject.__)('Template:'), |
6034 value: selectedTemplate, |
6380 value: selectedTemplate, |
6035 onChange: templateSlug => { |
6381 onChange: templateSlug => { |
6036 editPost({ |
6382 editPost({ |
6037 template: templateSlug || '' |
6383 template: templateSlug || '' |
6038 }); |
6384 }); |
6039 }, |
6385 }, |
6040 options: Object(external_lodash_["map"])(availableTemplates, (templateName, templateSlug) => ({ |
6386 options: (0,external_lodash_namespaceObject.map)(availableTemplates, (templateName, templateSlug) => ({ |
6041 value: templateSlug, |
6387 value: templateSlug, |
6042 label: templateName |
6388 label: templateName |
6043 })) |
6389 })) |
6044 }); |
6390 }); |
6045 } |
6391 } |
6046 /* harmony default export */ var post_template = (PostTemplate); |
6392 /* harmony default export */ var post_template = (PostTemplate); |
6047 |
6393 |
6048 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js |
6394 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/constants.js |
6395 const AUTHORS_QUERY = { |
|
6396 who: 'authors', |
|
6397 per_page: 50, |
|
6398 _fields: 'id,name', |
|
6399 context: 'view' // Allows non-admins to perform requests. |
|
6400 |
|
6401 }; |
|
6402 |
|
6403 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js |
|
6049 |
6404 |
6050 |
6405 |
6051 /** |
6406 /** |
6052 * External dependencies |
6407 * External dependencies |
6053 */ |
6408 */ |
6059 |
6414 |
6060 |
6415 |
6061 |
6416 |
6062 |
6417 |
6063 |
6418 |
6419 |
|
6420 /** |
|
6421 * Internal dependencies |
|
6422 */ |
|
6423 |
|
6424 |
|
6425 |
|
6426 |
|
6064 function PostAuthorCombobox() { |
6427 function PostAuthorCombobox() { |
6065 const [fieldValue, setFieldValue] = Object(external_wp_element_["useState"])(); |
6428 const [fieldValue, setFieldValue] = (0,external_wp_element_namespaceObject.useState)(); |
6066 const { |
6429 const { |
6067 authorId, |
6430 authorId, |
6068 isLoading, |
6431 isLoading, |
6069 authors, |
6432 authors, |
6070 postAuthor |
6433 postAuthor |
6071 } = Object(external_wp_data_["useSelect"])(select => { |
6434 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
6072 const { |
6435 const { |
6073 __unstableGetAuthor, |
6436 getUser, |
6074 getAuthors, |
6437 getUsers, |
6075 isResolving |
6438 isResolving |
6076 } = select('core'); |
6439 } = select(external_wp_coreData_namespaceObject.store); |
6077 const { |
6440 const { |
6078 getEditedPostAttribute |
6441 getEditedPostAttribute |
6079 } = select('core/editor'); |
6442 } = select(store_store); |
6080 |
6443 const author = getUser(getEditedPostAttribute('author'), { |
6081 const author = __unstableGetAuthor(getEditedPostAttribute('author')); |
6444 context: 'view' |
6082 |
6445 }); |
6083 const query = !fieldValue || '' === fieldValue ? {} : { |
6446 const query = { ...AUTHORS_QUERY |
6084 search: fieldValue |
|
6085 }; |
6447 }; |
6448 |
|
6449 if (fieldValue) { |
|
6450 query.search = fieldValue; |
|
6451 } |
|
6452 |
|
6086 return { |
6453 return { |
6087 authorId: getEditedPostAttribute('author'), |
6454 authorId: getEditedPostAttribute('author'), |
6088 postAuthor: author, |
6455 postAuthor: author, |
6089 authors: getAuthors(query), |
6456 authors: getUsers(query), |
6090 isLoading: isResolving('core', 'getAuthors', [query]) |
6457 isLoading: isResolving('core', 'getUsers', [query]) |
6091 }; |
6458 }; |
6092 }, [fieldValue]); |
6459 }, [fieldValue]); |
6093 const { |
6460 const { |
6094 editPost |
6461 editPost |
6095 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
6462 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
6096 const authorOptions = Object(external_wp_element_["useMemo"])(() => { |
6463 const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { |
6097 const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => { |
6464 const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => { |
6098 return { |
6465 return { |
6099 value: author.id, |
6466 value: author.id, |
6100 label: author.name |
6467 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name) |
6101 }; |
6468 }; |
6102 }); // Ensure the current author is included in the dropdown list. |
6469 }); // Ensure the current author is included in the dropdown list. |
6103 |
6470 |
6104 const foundAuthor = fetchedAuthors.findIndex(({ |
6471 const foundAuthor = fetchedAuthors.findIndex(_ref => { |
6105 value |
6472 let { |
6106 }) => (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value); |
6473 value |
6474 } = _ref; |
|
6475 return (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value; |
|
6476 }); |
|
6107 |
6477 |
6108 if (foundAuthor < 0 && postAuthor) { |
6478 if (foundAuthor < 0 && postAuthor) { |
6109 return [{ |
6479 return [{ |
6110 value: postAuthor.id, |
6480 value: postAuthor.id, |
6111 label: postAuthor.name |
6481 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(postAuthor.name) |
6112 }, ...fetchedAuthors]; |
6482 }, ...fetchedAuthors]; |
6113 } |
6483 } |
6114 |
6484 |
6115 return fetchedAuthors; |
6485 return fetchedAuthors; |
6116 }, [authors, postAuthor]); // Initializes the post author properly |
6486 }, [authors, postAuthor]); |
6117 // Also ensures external changes are reflected. |
|
6118 |
|
6119 Object(external_wp_element_["useEffect"])(() => { |
|
6120 if (postAuthor) { |
|
6121 setFieldValue(postAuthor.name); |
|
6122 } |
|
6123 }, [postAuthor]); |
|
6124 /** |
6487 /** |
6125 * Handle author selection. |
6488 * Handle author selection. |
6126 * |
6489 * |
6127 * @param {number} postAuthorId The selected Author. |
6490 * @param {number} postAuthorId The selected Author. |
6128 */ |
6491 */ |
6149 |
6512 |
6150 if (!postAuthor) { |
6513 if (!postAuthor) { |
6151 return null; |
6514 return null; |
6152 } |
6515 } |
6153 |
6516 |
6154 return Object(external_wp_element_["createElement"])(external_wp_components_["ComboboxControl"], { |
6517 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ComboboxControl, { |
6155 label: Object(external_wp_i18n_["__"])('Author'), |
6518 label: (0,external_wp_i18n_namespaceObject.__)('Author'), |
6156 options: authorOptions, |
6519 options: authorOptions, |
6157 value: authorId, |
6520 value: authorId, |
6158 onFilterValueChange: Object(external_lodash_["debounce"])(handleKeydown, 300), |
6521 onFilterValueChange: (0,external_lodash_namespaceObject.debounce)(handleKeydown, 300), |
6159 onChange: handleSelect, |
6522 onChange: handleSelect, |
6160 isLoading: isLoading, |
6523 isLoading: isLoading, |
6161 allowReset: false |
6524 allowReset: false |
6162 }); |
6525 }); |
6163 } |
6526 } |
6164 |
6527 |
6165 /* harmony default export */ var combobox = (PostAuthorCombobox); |
6528 /* harmony default export */ var combobox = (PostAuthorCombobox); |
6166 |
6529 |
6167 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js |
6530 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js |
6168 |
6531 |
6169 |
6532 |
6170 /** |
6533 /** |
6171 * WordPress dependencies |
6534 * WordPress dependencies |
6172 */ |
6535 */ |
6173 |
6536 |
6537 |
|
6538 |
|
6539 |
|
6540 |
|
6541 |
|
6542 /** |
|
6543 * Internal dependencies |
|
6544 */ |
|
6174 |
6545 |
6175 |
6546 |
6176 |
6547 |
6177 |
6548 |
6178 function PostAuthorSelect() { |
6549 function PostAuthorSelect() { |
6179 const { |
6550 const { |
6180 editPost |
6551 editPost |
6181 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
6552 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
6182 const { |
6553 const { |
6183 postAuthor, |
6554 postAuthor, |
6184 authors |
6555 authors |
6185 } = Object(external_wp_data_["useSelect"])(select => { |
6556 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
6186 const authorsFromAPI = select('core').getAuthors(); |
|
6187 return { |
6557 return { |
6188 postAuthor: select('core/editor').getEditedPostAttribute('author'), |
6558 postAuthor: select(store_store).getEditedPostAttribute('author'), |
6189 authors: authorsFromAPI.map(author => ({ |
6559 authors: select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY) |
6190 label: Object(external_wp_htmlEntities_["decodeEntities"])(author.name), |
|
6191 value: author.id |
|
6192 })) |
|
6193 }; |
6560 }; |
6194 }, []); |
6561 }, []); |
6562 const authorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
6563 return (authors !== null && authors !== void 0 ? authors : []).map(author => { |
|
6564 return { |
|
6565 value: author.id, |
|
6566 label: (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(author.name) |
|
6567 }; |
|
6568 }); |
|
6569 }, [authors]); |
|
6195 |
6570 |
6196 const setAuthorId = value => { |
6571 const setAuthorId = value => { |
6197 const author = Number(value); |
6572 const author = Number(value); |
6198 editPost({ |
6573 editPost({ |
6199 author |
6574 author |
6200 }); |
6575 }); |
6201 }; |
6576 }; |
6202 |
6577 |
6203 return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { |
6578 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { |
6204 className: "post-author-selector", |
6579 className: "post-author-selector", |
6205 label: Object(external_wp_i18n_["__"])('Author'), |
6580 label: (0,external_wp_i18n_namespaceObject.__)('Author'), |
6206 options: authors, |
6581 options: authorOptions, |
6207 onChange: setAuthorId, |
6582 onChange: setAuthorId, |
6208 value: postAuthor |
6583 value: postAuthor |
6209 }); |
6584 }); |
6210 } |
6585 } |
6211 |
6586 |
6212 /* harmony default export */ var post_author_select = (PostAuthorSelect); |
6587 /* harmony default export */ var post_author_select = (PostAuthorSelect); |
6213 |
6588 |
6214 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js |
6589 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js |
6215 |
6590 |
6216 |
6591 |
6217 /** |
6592 /** |
6218 * WordPress dependencies |
6593 * WordPress dependencies |
6219 */ |
6594 */ |
6223 * Internal dependencies |
6598 * Internal dependencies |
6224 */ |
6599 */ |
6225 |
6600 |
6226 |
6601 |
6227 |
6602 |
6603 |
|
6228 const minimumUsersForCombobox = 25; |
6604 const minimumUsersForCombobox = 25; |
6229 |
6605 |
6230 function PostAuthor() { |
6606 function PostAuthor() { |
6231 const showCombobox = Object(external_wp_data_["useSelect"])(select => { |
6607 const showCombobox = (0,external_wp_data_namespaceObject.useSelect)(select => { |
6232 // Not using `getUsers()` because it requires `list_users` capability. |
6608 const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); |
6233 const authors = select(external_wp_coreData_["store"]).getAuthors(); |
|
6234 return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox; |
6609 return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox; |
6235 }, []); |
6610 }, []); |
6236 |
6611 |
6237 if (showCombobox) { |
6612 if (showCombobox) { |
6238 return Object(external_wp_element_["createElement"])(combobox, null); |
6613 return (0,external_wp_element_namespaceObject.createElement)(combobox, null); |
6239 } |
6614 } |
6240 |
6615 |
6241 return Object(external_wp_element_["createElement"])(post_author_select, null); |
6616 return (0,external_wp_element_namespaceObject.createElement)(post_author_select, null); |
6242 } |
6617 } |
6243 |
6618 |
6244 /* harmony default export */ var post_author = (PostAuthor); |
6619 /* harmony default export */ var post_author = (PostAuthor); |
6245 |
6620 |
6246 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js |
6621 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js |
6247 |
6622 |
6248 |
6623 |
6249 /** |
6624 /** |
6250 * External dependencies |
6625 * External dependencies |
6251 */ |
6626 */ |
6259 /** |
6634 /** |
6260 * Internal dependencies |
6635 * Internal dependencies |
6261 */ |
6636 */ |
6262 |
6637 |
6263 |
6638 |
6264 function PostAuthorCheck({ |
6639 |
6265 hasAssignAuthorAction, |
6640 |
6266 authors, |
6641 function PostAuthorCheck(_ref) { |
6267 children |
6642 let { |
6268 }) { |
6643 children |
6269 if (!hasAssignAuthorAction || !authors || 1 >= authors.length) { |
6644 } = _ref; |
6645 const { |
|
6646 hasAssignAuthorAction, |
|
6647 hasAuthors |
|
6648 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
6649 const post = select(store_store).getCurrentPost(); |
|
6650 const authors = select(external_wp_coreData_namespaceObject.store).getUsers(AUTHORS_QUERY); |
|
6651 return { |
|
6652 hasAssignAuthorAction: (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-assign-author'], false), |
|
6653 hasAuthors: (authors === null || authors === void 0 ? void 0 : authors.length) >= 1 |
|
6654 }; |
|
6655 }, []); |
|
6656 |
|
6657 if (!hasAssignAuthorAction || !hasAuthors) { |
|
6270 return null; |
6658 return null; |
6271 } |
6659 } |
6272 |
6660 |
6273 return Object(external_wp_element_["createElement"])(post_type_support_check, { |
6661 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { |
6274 supportKeys: "author" |
6662 supportKeys: "author" |
6275 }, children); |
6663 }, children); |
6276 } |
6664 } |
6277 /* harmony default export */ var post_author_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
6665 |
6278 const post = select('core/editor').getCurrentPost(); |
6666 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js |
6279 return { |
|
6280 hasAssignAuthorAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-assign-author'], false), |
|
6281 postType: select('core/editor').getCurrentPostType(), |
|
6282 authors: select('core').getAuthors() |
|
6283 }; |
|
6284 }), external_wp_compose_["withInstanceId"]])(PostAuthorCheck)); |
|
6285 |
|
6286 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js |
|
6287 |
6667 |
6288 |
6668 |
6289 /** |
6669 /** |
6290 * WordPress dependencies |
6670 * WordPress dependencies |
6291 */ |
6671 */ |
6292 |
6672 |
6293 |
6673 |
6294 |
6674 |
6295 |
6675 |
6296 |
6676 /** |
6297 function PostComments({ |
6677 * Internal dependencies |
6298 commentStatus = 'open', |
6678 */ |
6299 ...props |
6679 |
6300 }) { |
6680 |
6681 |
|
6682 function PostComments(_ref) { |
|
6683 let { |
|
6684 commentStatus = 'open', |
|
6685 ...props |
|
6686 } = _ref; |
|
6687 |
|
6301 const onToggleComments = () => props.editPost({ |
6688 const onToggleComments = () => props.editPost({ |
6302 comment_status: commentStatus === 'open' ? 'closed' : 'open' |
6689 comment_status: commentStatus === 'open' ? 'closed' : 'open' |
6303 }); |
6690 }); |
6304 |
6691 |
6305 return Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { |
6692 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { |
6306 label: Object(external_wp_i18n_["__"])('Allow comments'), |
6693 label: (0,external_wp_i18n_namespaceObject.__)('Allow comments'), |
6307 checked: commentStatus === 'open', |
6694 checked: commentStatus === 'open', |
6308 onChange: onToggleComments |
6695 onChange: onToggleComments |
6309 }); |
6696 }); |
6310 } |
6697 } |
6311 |
6698 |
6312 /* harmony default export */ var post_comments = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
6699 /* harmony default export */ var post_comments = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
6313 return { |
6700 return { |
6314 commentStatus: select('core/editor').getEditedPostAttribute('comment_status') |
6701 commentStatus: select(store_store).getEditedPostAttribute('comment_status') |
6315 }; |
6702 }; |
6316 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ |
6703 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
6317 editPost: dispatch('core/editor').editPost |
6704 editPost: dispatch(store_store).editPost |
6318 }))])(PostComments)); |
6705 }))])(PostComments)); |
6319 |
6706 |
6320 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js |
6707 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js |
6321 |
6708 |
6322 |
6709 |
6323 /** |
6710 /** |
6324 * WordPress dependencies |
6711 * WordPress dependencies |
6325 */ |
6712 */ |
6326 |
6713 |
6327 |
6714 |
6328 |
6715 |
6329 |
6716 |
6330 |
6717 /** |
6331 function PostExcerpt({ |
6718 * Internal dependencies |
6332 excerpt, |
6719 */ |
6333 onUpdateExcerpt |
6720 |
6334 }) { |
6721 |
6335 return Object(external_wp_element_["createElement"])("div", { |
6722 |
6723 function PostExcerpt(_ref) { |
|
6724 let { |
|
6725 excerpt, |
|
6726 onUpdateExcerpt |
|
6727 } = _ref; |
|
6728 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
6336 className: "editor-post-excerpt" |
6729 className: "editor-post-excerpt" |
6337 }, Object(external_wp_element_["createElement"])(external_wp_components_["TextareaControl"], { |
6730 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextareaControl, { |
6338 label: Object(external_wp_i18n_["__"])('Write an excerpt (optional)'), |
6731 label: (0,external_wp_i18n_namespaceObject.__)('Write an excerpt (optional)'), |
6339 className: "editor-post-excerpt__textarea", |
6732 className: "editor-post-excerpt__textarea", |
6340 onChange: value => onUpdateExcerpt(value), |
6733 onChange: value => onUpdateExcerpt(value), |
6341 value: excerpt |
6734 value: excerpt |
6342 }), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { |
6735 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { |
6343 href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/excerpt/') |
6736 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/settings-sidebar/#excerpt') |
6344 }, Object(external_wp_i18n_["__"])('Learn more about manual excerpts'))); |
6737 }, (0,external_wp_i18n_namespaceObject.__)('Learn more about manual excerpts'))); |
6345 } |
6738 } |
6346 |
6739 |
6347 /* harmony default export */ var post_excerpt = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
6740 /* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
6348 return { |
6741 return { |
6349 excerpt: select('core/editor').getEditedPostAttribute('excerpt') |
6742 excerpt: select(store_store).getEditedPostAttribute('excerpt') |
6350 }; |
6743 }; |
6351 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ |
6744 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
6352 onUpdateExcerpt(excerpt) { |
6745 onUpdateExcerpt(excerpt) { |
6353 dispatch('core/editor').editPost({ |
6746 dispatch(store_store).editPost({ |
6354 excerpt |
6747 excerpt |
6355 }); |
6748 }); |
6356 } |
6749 } |
6357 |
6750 |
6358 }))])(PostExcerpt)); |
6751 }))])(PostExcerpt)); |
6359 |
6752 |
6360 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js |
6753 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js |
6361 |
6754 |
6362 |
6755 |
6363 |
6756 |
6364 /** |
6757 /** |
6365 * Internal dependencies |
6758 * Internal dependencies |
6366 */ |
6759 */ |
6367 |
6760 |
6368 |
6761 |
6369 function PostExcerptCheck(props) { |
6762 function PostExcerptCheck(props) { |
6370 return Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, { |
6763 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, { |
6371 supportKeys: "excerpt" |
6764 supportKeys: "excerpt" |
6372 })); |
6765 })); |
6373 } |
6766 } |
6374 |
6767 |
6375 /* harmony default export */ var post_excerpt_check = (PostExcerptCheck); |
6768 /* harmony default export */ var post_excerpt_check = (PostExcerptCheck); |
6376 |
6769 |
6377 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js |
6770 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js |
6378 /** |
6771 /** |
6379 * External dependencies |
6772 * External dependencies |
6380 */ |
6773 */ |
6381 |
6774 |
6382 /** |
6775 /** |
6383 * WordPress dependencies |
6776 * WordPress dependencies |
6384 */ |
6777 */ |
6385 |
6778 |
6386 |
6779 |
6387 function ThemeSupportCheck({ |
6780 |
6388 themeSupports, |
6781 /** |
6389 children, |
6782 * Internal dependencies |
6390 postType, |
6783 */ |
6391 supportKeys |
6784 |
6392 }) { |
6785 |
6393 const isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), key => { |
6786 function ThemeSupportCheck(_ref) { |
6394 const supported = Object(external_lodash_["get"])(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types. |
6787 let { |
6788 themeSupports, |
|
6789 children, |
|
6790 postType, |
|
6791 supportKeys |
|
6792 } = _ref; |
|
6793 const isSupported = (0,external_lodash_namespaceObject.some)((0,external_lodash_namespaceObject.castArray)(supportKeys), key => { |
|
6794 const supported = (0,external_lodash_namespaceObject.get)(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types. |
|
6395 // In the latter case, we need to verify `postType` exists |
6795 // In the latter case, we need to verify `postType` exists |
6396 // within `supported`. If `postType` isn't passed, then the check |
6796 // within `supported`. If `postType` isn't passed, then the check |
6397 // should fail. |
6797 // should fail. |
6398 |
6798 |
6399 if ('post-thumbnails' === key && Object(external_lodash_["isArray"])(supported)) { |
6799 if ('post-thumbnails' === key && (0,external_lodash_namespaceObject.isArray)(supported)) { |
6400 return Object(external_lodash_["includes"])(supported, postType); |
6800 return (0,external_lodash_namespaceObject.includes)(supported, postType); |
6401 } |
6801 } |
6402 |
6802 |
6403 return supported; |
6803 return supported; |
6404 }); |
6804 }); |
6405 |
6805 |
6407 return null; |
6807 return null; |
6408 } |
6808 } |
6409 |
6809 |
6410 return children; |
6810 return children; |
6411 } |
6811 } |
6412 /* harmony default export */ var theme_support_check = (Object(external_wp_data_["withSelect"])(select => { |
6812 /* harmony default export */ var theme_support_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
6413 const { |
6813 const { |
6414 getThemeSupports |
6814 getThemeSupports |
6415 } = select('core'); |
6815 } = select(external_wp_coreData_namespaceObject.store); |
6416 const { |
6816 const { |
6417 getEditedPostAttribute |
6817 getEditedPostAttribute |
6418 } = select('core/editor'); |
6818 } = select(store_store); |
6419 return { |
6819 return { |
6420 postType: getEditedPostAttribute('type'), |
6820 postType: getEditedPostAttribute('type'), |
6421 themeSupports: getThemeSupports() |
6821 themeSupports: getThemeSupports() |
6422 }; |
6822 }; |
6423 })(ThemeSupportCheck)); |
6823 })(ThemeSupportCheck)); |
6424 |
6824 |
6425 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js |
6825 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js |
6426 |
6826 |
6427 |
6827 |
6428 |
6828 |
6429 /** |
6829 /** |
6430 * Internal dependencies |
6830 * Internal dependencies |
6431 */ |
6831 */ |
6432 |
6832 |
6433 |
6833 |
6434 |
6834 |
6435 function PostFeaturedImageCheck(props) { |
6835 function PostFeaturedImageCheck(props) { |
6436 return Object(external_wp_element_["createElement"])(theme_support_check, { |
6836 return (0,external_wp_element_namespaceObject.createElement)(theme_support_check, { |
6437 supportKeys: "post-thumbnails" |
6837 supportKeys: "post-thumbnails" |
6438 }, Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, { |
6838 }, (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, { |
6439 supportKeys: "thumbnail" |
6839 supportKeys: "thumbnail" |
6440 }))); |
6840 }))); |
6441 } |
6841 } |
6442 |
6842 |
6443 /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck); |
6843 /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck); |
6444 |
6844 |
6445 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js |
6845 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js |
6446 |
6846 |
6447 |
6847 |
6448 /** |
6848 /** |
6449 * External dependencies |
6849 * External dependencies |
6450 */ |
6850 */ |
6457 |
6857 |
6458 |
6858 |
6459 |
6859 |
6460 |
6860 |
6461 |
6861 |
6862 |
|
6462 /** |
6863 /** |
6463 * Internal dependencies |
6864 * Internal dependencies |
6464 */ |
6865 */ |
6465 |
6866 |
6466 |
6867 |
6868 |
|
6467 const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present. |
6869 const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present. |
6468 |
6870 |
6469 const DEFAULT_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Featured image'); |
6871 const DEFAULT_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Featured image'); |
6470 |
6872 |
6471 const DEFAULT_SET_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Set featured image'); |
6873 const DEFAULT_SET_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Set featured image'); |
6472 |
6874 |
6473 const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Remove image'); |
6875 const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = (0,external_wp_i18n_namespaceObject.__)('Remove image'); |
6474 |
6876 |
6475 function PostFeaturedImage({ |
6877 function PostFeaturedImage(_ref) { |
6476 currentPostId, |
|
6477 featuredImageId, |
|
6478 onUpdateImage, |
|
6479 onDropImage, |
|
6480 onRemoveImage, |
|
6481 media, |
|
6482 postType, |
|
6483 noticeUI |
|
6484 }) { |
|
6485 var _media$media_details$, _media$media_details$2; |
6878 var _media$media_details$, _media$media_details$2; |
6486 |
6879 |
6487 const postLabel = Object(external_lodash_["get"])(postType, ['labels'], {}); |
6880 let { |
6488 const instructions = Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('To edit the featured image, you need permission to upload media.')); |
6881 currentPostId, |
6882 featuredImageId, |
|
6883 onUpdateImage, |
|
6884 onDropImage, |
|
6885 onRemoveImage, |
|
6886 media, |
|
6887 postType, |
|
6888 noticeUI |
|
6889 } = _ref; |
|
6890 const postLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels'], {}); |
|
6891 const instructions = (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('To edit the featured image, you need permission to upload media.')); |
|
6489 let mediaWidth, mediaHeight, mediaSourceUrl; |
6892 let mediaWidth, mediaHeight, mediaSourceUrl; |
6490 |
6893 |
6491 if (media) { |
6894 if (media) { |
6492 const mediaSize = Object(external_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId); |
6895 const mediaSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId); |
6493 |
6896 |
6494 if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', mediaSize])) { |
6897 if ((0,external_lodash_namespaceObject.has)(media, ['media_details', 'sizes', mediaSize])) { |
6495 // use mediaSize when available |
6898 // Use mediaSize when available. |
6496 mediaWidth = media.media_details.sizes[mediaSize].width; |
6899 mediaWidth = media.media_details.sizes[mediaSize].width; |
6497 mediaHeight = media.media_details.sizes[mediaSize].height; |
6900 mediaHeight = media.media_details.sizes[mediaSize].height; |
6498 mediaSourceUrl = media.media_details.sizes[mediaSize].source_url; |
6901 mediaSourceUrl = media.media_details.sizes[mediaSize].source_url; |
6499 } else { |
6902 } else { |
6500 // get fallbackMediaSize if mediaSize is not available |
6903 // Get fallbackMediaSize if mediaSize is not available. |
6501 const fallbackMediaSize = Object(external_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, currentPostId); |
6904 const fallbackMediaSize = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, currentPostId); |
6502 |
6905 |
6503 if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', fallbackMediaSize])) { |
6906 if ((0,external_lodash_namespaceObject.has)(media, ['media_details', 'sizes', fallbackMediaSize])) { |
6504 // use fallbackMediaSize when mediaSize is not available |
6907 // Use fallbackMediaSize when mediaSize is not available. |
6505 mediaWidth = media.media_details.sizes[fallbackMediaSize].width; |
6908 mediaWidth = media.media_details.sizes[fallbackMediaSize].width; |
6506 mediaHeight = media.media_details.sizes[fallbackMediaSize].height; |
6909 mediaHeight = media.media_details.sizes[fallbackMediaSize].height; |
6507 mediaSourceUrl = media.media_details.sizes[fallbackMediaSize].source_url; |
6910 mediaSourceUrl = media.media_details.sizes[fallbackMediaSize].source_url; |
6508 } else { |
6911 } else { |
6509 // use full image size when mediaFallbackSize and mediaSize are not available |
6912 // Use full image size when mediaFallbackSize and mediaSize are not available. |
6510 mediaWidth = media.media_details.width; |
6913 mediaWidth = media.media_details.width; |
6511 mediaHeight = media.media_details.height; |
6914 mediaHeight = media.media_details.height; |
6512 mediaSourceUrl = media.source_url; |
6915 mediaSourceUrl = media.source_url; |
6513 } |
6916 } |
6514 } |
6917 } |
6515 } |
6918 } |
6516 |
6919 |
6517 return Object(external_wp_element_["createElement"])(post_featured_image_check, null, noticeUI, Object(external_wp_element_["createElement"])("div", { |
6920 return (0,external_wp_element_namespaceObject.createElement)(post_featured_image_check, null, noticeUI, (0,external_wp_element_namespaceObject.createElement)("div", { |
6518 className: "editor-post-featured-image" |
6921 className: "editor-post-featured-image" |
6519 }, media && Object(external_wp_element_["createElement"])("div", { |
6922 }, media && (0,external_wp_element_namespaceObject.createElement)("div", { |
6520 id: `editor-post-featured-image-${featuredImageId}-describedby`, |
6923 id: `editor-post-featured-image-${featuredImageId}-describedby`, |
6521 className: "hidden" |
6924 className: "hidden" |
6522 }, media.alt_text && Object(external_wp_i18n_["sprintf"])( // Translators: %s: The selected image alt text. |
6925 }, media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image alt text. |
6523 Object(external_wp_i18n_["__"])('Current image: %s'), media.alt_text), !media.alt_text && Object(external_wp_i18n_["sprintf"])( // Translators: %s: The selected image filename. |
6926 (0,external_wp_i18n_namespaceObject.__)('Current image: %s'), media.alt_text), !media.alt_text && (0,external_wp_i18n_namespaceObject.sprintf)( // Translators: %s: The selected image filename. |
6524 Object(external_wp_i18n_["__"])('The current image has no alternative text. The file name is: %s'), ((_media$media_details$ = media.media_details.sizes) === null || _media$media_details$ === void 0 ? void 0 : (_media$media_details$2 = _media$media_details$.full) === null || _media$media_details$2 === void 0 ? void 0 : _media$media_details$2.file) || media.slug)), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], { |
6927 (0,external_wp_i18n_namespaceObject.__)('The current image has no alternative text. The file name is: %s'), ((_media$media_details$ = media.media_details.sizes) === null || _media$media_details$ === void 0 ? void 0 : (_media$media_details$2 = _media$media_details$.full) === null || _media$media_details$2 === void 0 ? void 0 : _media$media_details$2.file) || media.slug)), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, { |
6525 fallback: instructions |
6928 fallback: instructions |
6526 }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUpload"], { |
6929 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, { |
6527 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, |
6930 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, |
6528 onSelect: onUpdateImage, |
6931 onSelect: onUpdateImage, |
6529 unstableFeaturedImageFlow: true, |
6932 unstableFeaturedImageFlow: true, |
6530 allowedTypes: ALLOWED_MEDIA_TYPES, |
6933 allowedTypes: ALLOWED_MEDIA_TYPES, |
6531 modalClass: "editor-post-featured-image__media-modal", |
6934 modalClass: "editor-post-featured-image__media-modal", |
6532 render: ({ |
6935 render: _ref2 => { |
6533 open |
6936 let { |
6534 }) => Object(external_wp_element_["createElement"])("div", { |
6937 open |
6535 className: "editor-post-featured-image__container" |
6938 } = _ref2; |
6536 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
6939 return (0,external_wp_element_namespaceObject.createElement)("div", { |
6537 className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', |
6940 className: "editor-post-featured-image__container" |
6538 onClick: open, |
6941 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
6539 "aria-label": !featuredImageId ? null : Object(external_wp_i18n_["__"])('Edit or update the image'), |
6942 className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview', |
6540 "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby` |
6943 onClick: open, |
6541 }, !!featuredImageId && media && Object(external_wp_element_["createElement"])(external_wp_components_["ResponsiveWrapper"], { |
6944 "aria-label": !featuredImageId ? null : (0,external_wp_i18n_namespaceObject.__)('Edit or update the image'), |
6542 naturalWidth: mediaWidth, |
6945 "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby` |
6543 naturalHeight: mediaHeight, |
6946 }, !!featuredImageId && media && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ResponsiveWrapper, { |
6544 isInline: true |
6947 naturalWidth: mediaWidth, |
6545 }, Object(external_wp_element_["createElement"])("img", { |
6948 naturalHeight: mediaHeight, |
6546 src: mediaSourceUrl, |
6949 isInline: true |
6547 alt: "" |
6950 }, (0,external_wp_element_namespaceObject.createElement)("img", { |
6548 })), !!featuredImageId && !media && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), Object(external_wp_element_["createElement"])(external_wp_components_["DropZone"], { |
6951 src: mediaSourceUrl, |
6549 onFilesDrop: onDropImage |
6952 alt: "" |
6550 })), |
6953 })), !!featuredImageId && !media && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DropZone, { |
6954 onFilesDrop: onDropImage |
|
6955 })); |
|
6956 }, |
|
6551 value: featuredImageId |
6957 value: featuredImageId |
6552 })), !!featuredImageId && media && !media.isLoading && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUpload"], { |
6958 })), !!featuredImageId && media && !media.isLoading && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUpload, { |
6553 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, |
6959 title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL, |
6554 onSelect: onUpdateImage, |
6960 onSelect: onUpdateImage, |
6555 unstableFeaturedImageFlow: true, |
6961 unstableFeaturedImageFlow: true, |
6556 allowedTypes: ALLOWED_MEDIA_TYPES, |
6962 allowedTypes: ALLOWED_MEDIA_TYPES, |
6557 modalClass: "editor-post-featured-image__media-modal", |
6963 modalClass: "editor-post-featured-image__media-modal", |
6558 render: ({ |
6964 render: _ref3 => { |
6559 open |
6965 let { |
6560 }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
6966 open |
6561 onClick: open, |
6967 } = _ref3; |
6562 isSecondary: true |
6968 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
6563 }, Object(external_wp_i18n_["__"])('Replace Image')) |
6969 onClick: open, |
6564 })), !!featuredImageId && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
6970 variant: "secondary" |
6971 }, (0,external_wp_i18n_namespaceObject.__)('Replace Image')); |
|
6972 } |
|
6973 })), !!featuredImageId && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.MediaUploadCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
6565 onClick: onRemoveImage, |
6974 onClick: onRemoveImage, |
6566 isLink: true, |
6975 variant: "link", |
6567 isDestructive: true |
6976 isDestructive: true |
6568 }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL)))); |
6977 }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL)))); |
6569 } |
6978 } |
6570 |
6979 |
6571 const applyWithSelect = Object(external_wp_data_["withSelect"])(select => { |
6980 const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => { |
6572 const { |
6981 const { |
6573 getMedia, |
6982 getMedia, |
6574 getPostType |
6983 getPostType |
6575 } = select('core'); |
6984 } = select(external_wp_coreData_namespaceObject.store); |
6576 const { |
6985 const { |
6577 getCurrentPostId, |
6986 getCurrentPostId, |
6578 getEditedPostAttribute |
6987 getEditedPostAttribute |
6579 } = select('core/editor'); |
6988 } = select(store_store); |
6580 const featuredImageId = getEditedPostAttribute('featured_media'); |
6989 const featuredImageId = getEditedPostAttribute('featured_media'); |
6581 return { |
6990 return { |
6582 media: featuredImageId ? getMedia(featuredImageId) : null, |
6991 media: featuredImageId ? getMedia(featuredImageId, { |
6992 context: 'view' |
|
6993 }) : null, |
|
6583 currentPostId: getCurrentPostId(), |
6994 currentPostId: getCurrentPostId(), |
6584 postType: getPostType(getEditedPostAttribute('type')), |
6995 postType: getPostType(getEditedPostAttribute('type')), |
6585 featuredImageId |
6996 featuredImageId |
6586 }; |
6997 }; |
6587 }); |
6998 }); |
6588 const applyWithDispatch = Object(external_wp_data_["withDispatch"])((dispatch, { |
6999 const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref4, _ref5) => { |
6589 noticeOperations |
7000 let { |
6590 }, { |
7001 noticeOperations |
6591 select |
7002 } = _ref4; |
6592 }) => { |
7003 let { |
7004 select |
|
7005 } = _ref5; |
|
6593 const { |
7006 const { |
6594 editPost |
7007 editPost |
6595 } = dispatch('core/editor'); |
7008 } = dispatch(store_store); |
6596 return { |
7009 return { |
6597 onUpdateImage(image) { |
7010 onUpdateImage(image) { |
6598 editPost({ |
7011 editPost({ |
6599 featured_media: image.id |
7012 featured_media: image.id |
6600 }); |
7013 }); |
6601 }, |
7014 }, |
6602 |
7015 |
6603 onDropImage(filesList) { |
7016 onDropImage(filesList) { |
6604 select(external_wp_blockEditor_["store"]).getSettings().mediaUpload({ |
7017 select(external_wp_blockEditor_namespaceObject.store).getSettings().mediaUpload({ |
6605 allowedTypes: ['image'], |
7018 allowedTypes: ['image'], |
6606 filesList, |
7019 filesList, |
6607 |
7020 |
6608 onFileChange([image]) { |
7021 onFileChange(_ref6) { |
7022 let [image] = _ref6; |
|
6609 editPost({ |
7023 editPost({ |
6610 featured_media: image.id |
7024 featured_media: image.id |
6611 }); |
7025 }); |
6612 }, |
7026 }, |
6613 |
7027 |
6625 }); |
7039 }); |
6626 } |
7040 } |
6627 |
7041 |
6628 }; |
7042 }; |
6629 }); |
7043 }); |
6630 /* harmony default export */ var post_featured_image = (Object(external_wp_compose_["compose"])(external_wp_components_["withNotices"], applyWithSelect, applyWithDispatch, Object(external_wp_components_["withFilters"])('editor.PostFeaturedImage'))(PostFeaturedImage)); |
7044 /* harmony default export */ var post_featured_image = ((0,external_wp_compose_namespaceObject.compose)(external_wp_components_namespaceObject.withNotices, applyWithSelect, applyWithDispatch, (0,external_wp_components_namespaceObject.withFilters)('editor.PostFeaturedImage'))(PostFeaturedImage)); |
6631 |
7045 |
6632 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js |
7046 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js |
6633 |
7047 |
6634 |
7048 |
6635 |
7049 |
6636 /** |
7050 /** |
6637 * WordPress dependencies |
7051 * WordPress dependencies |
6641 * Internal dependencies |
7055 * Internal dependencies |
6642 */ |
7056 */ |
6643 |
7057 |
6644 |
7058 |
6645 |
7059 |
6646 function PostFormatCheck({ |
7060 |
6647 disablePostFormats, |
7061 function PostFormatCheck(_ref) { |
6648 ...props |
7062 let { |
6649 }) { |
7063 disablePostFormats, |
6650 return !disablePostFormats && Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, { |
7064 ...props |
7065 } = _ref; |
|
7066 return !disablePostFormats && (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, _extends({}, props, { |
|
6651 supportKeys: "post-formats" |
7067 supportKeys: "post-formats" |
6652 })); |
7068 })); |
6653 } |
7069 } |
6654 |
7070 |
6655 /* harmony default export */ var post_format_check = (Object(external_wp_data_["withSelect"])(select => { |
7071 /* harmony default export */ var post_format_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
6656 const editorSettings = select('core/editor').getEditorSettings(); |
7072 const editorSettings = select(store_store).getEditorSettings(); |
6657 return { |
7073 return { |
6658 disablePostFormats: editorSettings.disablePostFormats |
7074 disablePostFormats: editorSettings.disablePostFormats |
6659 }; |
7075 }; |
6660 })(PostFormatCheck)); |
7076 })(PostFormatCheck)); |
6661 |
7077 |
6662 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js |
7078 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js |
6663 |
7079 |
6664 |
7080 |
6665 /** |
7081 /** |
6666 * External dependencies |
7082 * External dependencies |
6667 */ |
7083 */ |
6672 |
7088 |
6673 |
7089 |
6674 |
7090 |
6675 |
7091 |
6676 |
7092 |
7093 |
|
6677 /** |
7094 /** |
6678 * Internal dependencies |
7095 * Internal dependencies |
6679 */ |
7096 */ |
7097 |
|
6680 |
7098 |
6681 // All WP post formats, sorted alphabetically by translated name. |
7099 // All WP post formats, sorted alphabetically by translated name. |
6682 |
7100 |
6683 const POST_FORMATS = [{ |
7101 const POST_FORMATS = [{ |
6684 id: 'aside', |
7102 id: 'aside', |
6685 caption: Object(external_wp_i18n_["__"])('Aside') |
7103 caption: (0,external_wp_i18n_namespaceObject.__)('Aside') |
6686 }, { |
7104 }, { |
6687 id: 'audio', |
7105 id: 'audio', |
6688 caption: Object(external_wp_i18n_["__"])('Audio') |
7106 caption: (0,external_wp_i18n_namespaceObject.__)('Audio') |
6689 }, { |
7107 }, { |
6690 id: 'chat', |
7108 id: 'chat', |
6691 caption: Object(external_wp_i18n_["__"])('Chat') |
7109 caption: (0,external_wp_i18n_namespaceObject.__)('Chat') |
6692 }, { |
7110 }, { |
6693 id: 'gallery', |
7111 id: 'gallery', |
6694 caption: Object(external_wp_i18n_["__"])('Gallery') |
7112 caption: (0,external_wp_i18n_namespaceObject.__)('Gallery') |
6695 }, { |
7113 }, { |
6696 id: 'image', |
7114 id: 'image', |
6697 caption: Object(external_wp_i18n_["__"])('Image') |
7115 caption: (0,external_wp_i18n_namespaceObject.__)('Image') |
6698 }, { |
7116 }, { |
6699 id: 'link', |
7117 id: 'link', |
6700 caption: Object(external_wp_i18n_["__"])('Link') |
7118 caption: (0,external_wp_i18n_namespaceObject.__)('Link') |
6701 }, { |
7119 }, { |
6702 id: 'quote', |
7120 id: 'quote', |
6703 caption: Object(external_wp_i18n_["__"])('Quote') |
7121 caption: (0,external_wp_i18n_namespaceObject.__)('Quote') |
6704 }, { |
7122 }, { |
6705 id: 'standard', |
7123 id: 'standard', |
6706 caption: Object(external_wp_i18n_["__"])('Standard') |
7124 caption: (0,external_wp_i18n_namespaceObject.__)('Standard') |
6707 }, { |
7125 }, { |
6708 id: 'status', |
7126 id: 'status', |
6709 caption: Object(external_wp_i18n_["__"])('Status') |
7127 caption: (0,external_wp_i18n_namespaceObject.__)('Status') |
6710 }, { |
7128 }, { |
6711 id: 'video', |
7129 id: 'video', |
6712 caption: Object(external_wp_i18n_["__"])('Video') |
7130 caption: (0,external_wp_i18n_namespaceObject.__)('Video') |
6713 }].sort((a, b) => { |
7131 }].sort((a, b) => { |
6714 const normalizedA = a.caption.toUpperCase(); |
7132 const normalizedA = a.caption.toUpperCase(); |
6715 const normalizedB = b.caption.toUpperCase(); |
7133 const normalizedB = b.caption.toUpperCase(); |
6716 |
7134 |
6717 if (normalizedA < normalizedB) { |
7135 if (normalizedA < normalizedB) { |
6723 } |
7141 } |
6724 |
7142 |
6725 return 0; |
7143 return 0; |
6726 }); |
7144 }); |
6727 function PostFormat() { |
7145 function PostFormat() { |
6728 const instanceId = Object(external_wp_compose_["useInstanceId"])(PostFormat); |
7146 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostFormat); |
6729 const postFormatSelectorId = `post-format-selector-${instanceId}`; |
7147 const postFormatSelectorId = `post-format-selector-${instanceId}`; |
6730 const { |
7148 const { |
6731 postFormat, |
7149 postFormat, |
6732 suggestedFormat, |
7150 suggestedFormat, |
6733 supportedFormats |
7151 supportedFormats |
6734 } = Object(external_wp_data_["useSelect"])(select => { |
7152 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
6735 const { |
7153 const { |
6736 getEditedPostAttribute, |
7154 getEditedPostAttribute, |
6737 getSuggestedPostFormat |
7155 getSuggestedPostFormat |
6738 } = select('core/editor'); |
7156 } = select(store_store); |
6739 |
7157 |
6740 const _postFormat = getEditedPostAttribute('format'); |
7158 const _postFormat = getEditedPostAttribute('format'); |
6741 |
7159 |
6742 const themeSupports = select('core').getThemeSupports(); |
7160 const themeSupports = select(external_wp_coreData_namespaceObject.store).getThemeSupports(); |
6743 return { |
7161 return { |
6744 postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard', |
7162 postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard', |
6745 suggestedFormat: getSuggestedPostFormat(), |
7163 suggestedFormat: getSuggestedPostFormat(), |
6746 // Ensure current format is always in the set. |
7164 supportedFormats: themeSupports.formats |
6747 // The current format may not be a format supported by the theme. |
|
6748 supportedFormats: Object(external_lodash_["union"])([_postFormat], Object(external_lodash_["get"])(themeSupports, ['formats'], [])) |
|
6749 }; |
7165 }; |
6750 }, []); |
7166 }, []); |
6751 const formats = POST_FORMATS.filter(format => Object(external_lodash_["includes"])(supportedFormats, format.id)); |
7167 const formats = POST_FORMATS.filter(format => { |
6752 const suggestion = Object(external_lodash_["find"])(formats, format => format.id === suggestedFormat); |
7168 // Ensure current format is always in the set. |
7169 // The current format may not be a format supported by the theme. |
|
7170 return (0,external_lodash_namespaceObject.includes)(supportedFormats, format.id) || postFormat === format.id; |
|
7171 }); |
|
7172 const suggestion = (0,external_lodash_namespaceObject.find)(formats, format => format.id === suggestedFormat); |
|
6753 const { |
7173 const { |
6754 editPost |
7174 editPost |
6755 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
7175 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
6756 |
7176 |
6757 const onUpdatePostFormat = format => editPost({ |
7177 const onUpdatePostFormat = format => editPost({ |
6758 format |
7178 format |
6759 }); |
7179 }); |
6760 |
7180 |
6761 return Object(external_wp_element_["createElement"])(post_format_check, null, Object(external_wp_element_["createElement"])("div", { |
7181 return (0,external_wp_element_namespaceObject.createElement)(post_format_check, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
6762 className: "editor-post-format" |
7182 className: "editor-post-format" |
6763 }, Object(external_wp_element_["createElement"])("div", { |
7183 }, (0,external_wp_element_namespaceObject.createElement)("div", { |
6764 className: "editor-post-format__content" |
7184 className: "editor-post-format__content" |
6765 }, Object(external_wp_element_["createElement"])("label", { |
7185 }, (0,external_wp_element_namespaceObject.createElement)("label", { |
6766 htmlFor: postFormatSelectorId |
7186 htmlFor: postFormatSelectorId |
6767 }, Object(external_wp_i18n_["__"])('Post Format')), Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { |
7187 }, (0,external_wp_i18n_namespaceObject.__)('Post Format')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { |
6768 value: postFormat, |
7188 value: postFormat, |
6769 onChange: format => onUpdatePostFormat(format), |
7189 onChange: format => onUpdatePostFormat(format), |
6770 id: postFormatSelectorId, |
7190 id: postFormatSelectorId, |
6771 options: formats.map(format => ({ |
7191 options: formats.map(format => ({ |
6772 label: format.caption, |
7192 label: format.caption, |
6773 value: format.id |
7193 value: format.id |
6774 })) |
7194 })) |
6775 })), suggestion && suggestion.id !== postFormat && Object(external_wp_element_["createElement"])("div", { |
7195 })), suggestion && suggestion.id !== postFormat && (0,external_wp_element_namespaceObject.createElement)("div", { |
6776 className: "editor-post-format__suggestion" |
7196 className: "editor-post-format__suggestion" |
6777 }, Object(external_wp_i18n_["__"])('Suggestion:'), ' ', Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
7197 }, (0,external_wp_i18n_namespaceObject.__)('Suggestion:'), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
6778 isLink: true, |
7198 variant: "link", |
6779 onClick: () => onUpdatePostFormat(suggestion.id) |
7199 onClick: () => onUpdatePostFormat(suggestion.id) |
6780 }, suggestion.caption)))); |
7200 }, (0,external_wp_i18n_namespaceObject.sprintf)( |
6781 } |
7201 /* translators: %s: post format */ |
6782 |
7202 (0,external_wp_i18n_namespaceObject.__)('Apply format: %s'), suggestion.caption))))); |
6783 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js |
7203 } |
7204 |
|
7205 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js |
|
6784 |
7206 |
6785 |
7207 |
6786 /** |
7208 /** |
6787 * WordPress dependencies |
7209 * WordPress dependencies |
6788 */ |
7210 */ |
6789 |
7211 |
6790 const backup = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { |
7212 const backup = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
6791 xmlns: "http://www.w3.org/2000/svg", |
7213 xmlns: "http://www.w3.org/2000/svg", |
6792 viewBox: "0 0 24 24" |
7214 viewBox: "0 0 24 24" |
6793 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { |
7215 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
6794 d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" |
7216 d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z" |
6795 })); |
7217 })); |
6796 /* harmony default export */ var library_backup = (backup); |
7218 /* harmony default export */ var library_backup = (backup); |
6797 |
7219 |
6798 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js |
7220 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js |
6799 |
7221 |
6800 |
7222 |
6801 /** |
7223 /** |
6802 * WordPress dependencies |
7224 * WordPress dependencies |
6803 */ |
7225 */ |
6805 /** |
7227 /** |
6806 * Internal dependencies |
7228 * Internal dependencies |
6807 */ |
7229 */ |
6808 |
7230 |
6809 |
7231 |
6810 function PostLastRevisionCheck({ |
7232 |
6811 lastRevisionId, |
7233 function PostLastRevisionCheck(_ref) { |
6812 revisionsCount, |
7234 let { |
6813 children |
7235 lastRevisionId, |
6814 }) { |
7236 revisionsCount, |
7237 children |
|
7238 } = _ref; |
|
7239 |
|
6815 if (!lastRevisionId || revisionsCount < 2) { |
7240 if (!lastRevisionId || revisionsCount < 2) { |
6816 return null; |
7241 return null; |
6817 } |
7242 } |
6818 |
7243 |
6819 return Object(external_wp_element_["createElement"])(post_type_support_check, { |
7244 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { |
6820 supportKeys: "revisions" |
7245 supportKeys: "revisions" |
6821 }, children); |
7246 }, children); |
6822 } |
7247 } |
6823 /* harmony default export */ var post_last_revision_check = (Object(external_wp_data_["withSelect"])(select => { |
7248 /* harmony default export */ var post_last_revision_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
6824 const { |
7249 const { |
6825 getCurrentPostLastRevisionId, |
7250 getCurrentPostLastRevisionId, |
6826 getCurrentPostRevisionsCount |
7251 getCurrentPostRevisionsCount |
6827 } = select('core/editor'); |
7252 } = select(store_store); |
6828 return { |
7253 return { |
6829 lastRevisionId: getCurrentPostLastRevisionId(), |
7254 lastRevisionId: getCurrentPostLastRevisionId(), |
6830 revisionsCount: getCurrentPostRevisionsCount() |
7255 revisionsCount: getCurrentPostRevisionsCount() |
6831 }; |
7256 }; |
6832 })(PostLastRevisionCheck)); |
7257 })(PostLastRevisionCheck)); |
6833 |
7258 |
6834 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js |
7259 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js |
6835 |
7260 |
6836 |
7261 |
6837 /** |
7262 /** |
6838 * WordPress dependencies |
7263 * WordPress dependencies |
6839 */ |
7264 */ |
6840 |
7265 |
6841 |
7266 |
6842 |
7267 |
6843 |
7268 |
7269 |
|
6844 /** |
7270 /** |
6845 * Internal dependencies |
7271 * Internal dependencies |
6846 */ |
7272 */ |
6847 |
7273 |
6848 |
7274 |
6849 |
7275 |
6850 |
7276 |
6851 function LastRevision({ |
7277 function LastRevision(_ref) { |
6852 lastRevisionId, |
7278 let { |
6853 revisionsCount |
7279 lastRevisionId, |
6854 }) { |
7280 revisionsCount |
6855 return Object(external_wp_element_["createElement"])(post_last_revision_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
7281 } = _ref; |
6856 href: getWPAdminURL('revision.php', { |
7282 return (0,external_wp_element_namespaceObject.createElement)(post_last_revision_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
7283 href: (0,external_wp_url_namespaceObject.addQueryArgs)('revision.php', { |
|
6857 revision: lastRevisionId, |
7284 revision: lastRevisionId, |
6858 gutenberg: true |
7285 gutenberg: true |
6859 }), |
7286 }), |
6860 className: "editor-post-last-revision__title", |
7287 className: "editor-post-last-revision__title", |
6861 icon: library_backup |
7288 icon: library_backup |
6862 }, Object(external_wp_i18n_["sprintf"])( |
7289 }, (0,external_wp_i18n_namespaceObject.sprintf)( |
6863 /* translators: %d: number of revisions */ |
7290 /* translators: %d: number of revisions */ |
6864 Object(external_wp_i18n_["_n"])('%d Revision', '%d Revisions', revisionsCount), revisionsCount))); |
7291 (0,external_wp_i18n_namespaceObject._n)('%d Revision', '%d Revisions', revisionsCount), revisionsCount))); |
6865 } |
7292 } |
6866 |
7293 |
6867 /* harmony default export */ var post_last_revision = (Object(external_wp_data_["withSelect"])(select => { |
7294 /* harmony default export */ var post_last_revision = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
6868 const { |
7295 const { |
6869 getCurrentPostLastRevisionId, |
7296 getCurrentPostLastRevisionId, |
6870 getCurrentPostRevisionsCount |
7297 getCurrentPostRevisionsCount |
6871 } = select('core/editor'); |
7298 } = select(store_store); |
6872 return { |
7299 return { |
6873 lastRevisionId: getCurrentPostLastRevisionId(), |
7300 lastRevisionId: getCurrentPostLastRevisionId(), |
6874 revisionsCount: getCurrentPostRevisionsCount() |
7301 revisionsCount: getCurrentPostRevisionsCount() |
6875 }; |
7302 }; |
6876 })(LastRevision)); |
7303 })(LastRevision)); |
6877 |
7304 |
6878 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js |
7305 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js |
6879 |
7306 |
6880 |
7307 |
6881 /** |
7308 /** |
6882 * External dependencies |
7309 * External dependencies |
6883 */ |
7310 */ |
6884 |
7311 |
6885 |
|
6886 /** |
7312 /** |
6887 * WordPress dependencies |
7313 * WordPress dependencies |
6888 */ |
7314 */ |
6889 |
7315 |
6890 |
7316 |
6892 |
7318 |
6893 |
7319 |
6894 |
7320 |
6895 |
7321 |
6896 |
7322 |
7323 |
|
7324 /** |
|
7325 * Internal dependencies |
|
7326 */ |
|
7327 |
|
7328 |
|
7329 function PostLockedModal() { |
|
7330 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostLockedModal); |
|
7331 const hookName = 'core/editor/post-locked-modal-' + instanceId; |
|
7332 const { |
|
7333 autosave, |
|
7334 updatePostLock |
|
7335 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
7336 const { |
|
7337 isLocked, |
|
7338 isTakeover, |
|
7339 user, |
|
7340 postId, |
|
7341 postLockUtils, |
|
7342 activePostLock, |
|
7343 postType, |
|
7344 previewLink |
|
7345 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
7346 const { |
|
7347 isPostLocked, |
|
7348 isPostLockTakeover, |
|
7349 getPostLockUser, |
|
7350 getCurrentPostId, |
|
7351 getActivePostLock, |
|
7352 getEditedPostAttribute, |
|
7353 getEditedPostPreviewLink, |
|
7354 getEditorSettings |
|
7355 } = select(store_store); |
|
7356 const { |
|
7357 getPostType |
|
7358 } = select(external_wp_coreData_namespaceObject.store); |
|
7359 return { |
|
7360 isLocked: isPostLocked(), |
|
7361 isTakeover: isPostLockTakeover(), |
|
7362 user: getPostLockUser(), |
|
7363 postId: getCurrentPostId(), |
|
7364 postLockUtils: getEditorSettings().postLockUtils, |
|
7365 activePostLock: getActivePostLock(), |
|
7366 postType: getPostType(getEditedPostAttribute('type')), |
|
7367 previewLink: getEditedPostPreviewLink() |
|
7368 }; |
|
7369 }, []); |
|
7370 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
7371 /** |
|
7372 * Keep the lock refreshed. |
|
7373 * |
|
7374 * When the user does not send a heartbeat in a heartbeat-tick |
|
7375 * the user is no longer editing and another user can start editing. |
|
7376 * |
|
7377 * @param {Object} data Data to send in the heartbeat request. |
|
7378 */ |
|
7379 function sendPostLock(data) { |
|
7380 if (isLocked) { |
|
7381 return; |
|
7382 } |
|
7383 |
|
7384 data['wp-refresh-post-lock'] = { |
|
7385 lock: activePostLock, |
|
7386 post_id: postId |
|
7387 }; |
|
7388 } |
|
7389 /** |
|
7390 * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing. |
|
7391 * |
|
7392 * @param {Object} data Data received in the heartbeat request |
|
7393 */ |
|
7394 |
|
7395 |
|
7396 function receivePostLock(data) { |
|
7397 if (!data['wp-refresh-post-lock']) { |
|
7398 return; |
|
7399 } |
|
7400 |
|
7401 const received = data['wp-refresh-post-lock']; |
|
7402 |
|
7403 if (received.lock_error) { |
|
7404 // Auto save and display the takeover modal. |
|
7405 autosave(); |
|
7406 updatePostLock({ |
|
7407 isLocked: true, |
|
7408 isTakeover: true, |
|
7409 user: { |
|
7410 name: received.lock_error.name, |
|
7411 avatar: received.lock_error.avatar_src_2x |
|
7412 } |
|
7413 }); |
|
7414 } else if (received.new_lock) { |
|
7415 updatePostLock({ |
|
7416 isLocked: false, |
|
7417 activePostLock: received.new_lock |
|
7418 }); |
|
7419 } |
|
7420 } |
|
7421 /** |
|
7422 * Unlock the post before the window is exited. |
|
7423 */ |
|
7424 |
|
7425 |
|
7426 function releasePostLock() { |
|
7427 if (isLocked || !activePostLock) { |
|
7428 return; |
|
7429 } |
|
7430 |
|
7431 const data = new window.FormData(); |
|
7432 data.append('action', 'wp-remove-post-lock'); |
|
7433 data.append('_wpnonce', postLockUtils.unlockNonce); |
|
7434 data.append('post_ID', postId); |
|
7435 data.append('active_post_lock', activePostLock); |
|
7436 |
|
7437 if (window.navigator.sendBeacon) { |
|
7438 window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); |
|
7439 } else { |
|
7440 const xhr = new window.XMLHttpRequest(); |
|
7441 xhr.open('POST', postLockUtils.ajaxUrl, false); |
|
7442 xhr.send(data); |
|
7443 } |
|
7444 } // Details on these events on the Heartbeat API docs |
|
7445 // https://developer.wordpress.org/plugins/javascript/heartbeat-api/ |
|
7446 |
|
7447 |
|
7448 (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.send', hookName, sendPostLock); |
|
7449 (0,external_wp_hooks_namespaceObject.addAction)('heartbeat.tick', hookName, receivePostLock); |
|
7450 window.addEventListener('beforeunload', releasePostLock); |
|
7451 return () => { |
|
7452 (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.send', hookName); |
|
7453 (0,external_wp_hooks_namespaceObject.removeAction)('heartbeat.tick', hookName); |
|
7454 window.removeEventListener('beforeunload', releasePostLock); |
|
7455 }; |
|
7456 }, []); |
|
7457 |
|
7458 if (!isLocked) { |
|
7459 return null; |
|
7460 } |
|
7461 |
|
7462 const userDisplayName = user.name; |
|
7463 const userAvatar = user.avatar; |
|
7464 const unlockUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { |
|
7465 'get-post-lock': '1', |
|
7466 lockKey: true, |
|
7467 post: postId, |
|
7468 action: 'edit', |
|
7469 _wpnonce: postLockUtils.nonce |
|
7470 }); |
|
7471 const allPostsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { |
|
7472 post_type: (0,external_lodash_namespaceObject.get)(postType, ['slug']) |
|
7473 }); |
|
7474 |
|
7475 const allPostsLabel = (0,external_wp_i18n_namespaceObject.__)('Exit editor'); |
|
7476 |
|
7477 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
|
7478 title: isTakeover ? (0,external_wp_i18n_namespaceObject.__)('Someone else has taken over this post') : (0,external_wp_i18n_namespaceObject.__)('This post is already being edited'), |
|
7479 focusOnMount: true, |
|
7480 shouldCloseOnClickOutside: false, |
|
7481 shouldCloseOnEsc: false, |
|
7482 isDismissible: false, |
|
7483 className: "editor-post-locked-modal" |
|
7484 }, !!userAvatar && (0,external_wp_element_namespaceObject.createElement)("img", { |
|
7485 src: userAvatar, |
|
7486 alt: (0,external_wp_i18n_namespaceObject.__)('Avatar'), |
|
7487 className: "editor-post-locked-modal__avatar", |
|
7488 width: 64, |
|
7489 height: 64 |
|
7490 }), (0,external_wp_element_namespaceObject.createElement)("div", null, !!isTakeover && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( |
|
7491 /* translators: %s: user's display name */ |
|
7492 (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> now has editing control of this posts (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'), { |
|
7493 strong: (0,external_wp_element_namespaceObject.createElement)("strong", null), |
|
7494 PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { |
|
7495 href: previewLink |
|
7496 }, (0,external_wp_i18n_namespaceObject.__)('preview')) |
|
7497 })), !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createInterpolateElement)(userDisplayName ? (0,external_wp_i18n_namespaceObject.sprintf)( |
|
7498 /* translators: %s: user's display name */ |
|
7499 (0,external_wp_i18n_namespaceObject.__)('<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), userDisplayName) : (0,external_wp_i18n_namespaceObject.__)('Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'), { |
|
7500 strong: (0,external_wp_element_namespaceObject.createElement)("strong", null), |
|
7501 PreviewLink: (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { |
|
7502 href: previewLink |
|
7503 }, (0,external_wp_i18n_namespaceObject.__)('preview')) |
|
7504 })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('If you take over, the other user will lose editing control to the post, but their changes will be saved.'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
|
7505 className: "editor-post-locked-modal__buttons", |
|
7506 justify: "flex-end", |
|
7507 expanded: false |
|
7508 }, !isTakeover && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
7509 variant: "tertiary", |
|
7510 href: unlockUrl |
|
7511 }, (0,external_wp_i18n_namespaceObject.__)('Take over'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
7512 variant: "primary", |
|
7513 href: allPostsUrl |
|
7514 }, allPostsLabel))))); |
|
7515 } |
|
7516 |
|
7517 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js |
|
7518 /** |
|
7519 * External dependencies |
|
7520 */ |
|
7521 |
|
7522 /** |
|
7523 * WordPress dependencies |
|
7524 */ |
|
7525 |
|
7526 |
|
7527 |
|
7528 /** |
|
7529 * Internal dependencies |
|
7530 */ |
|
7531 |
|
7532 |
|
7533 function PostPendingStatusCheck(_ref) { |
|
7534 let { |
|
7535 hasPublishAction, |
|
7536 isPublished, |
|
7537 children |
|
7538 } = _ref; |
|
7539 |
|
7540 if (isPublished || !hasPublishAction) { |
|
7541 return null; |
|
7542 } |
|
7543 |
|
7544 return children; |
|
7545 } |
|
7546 /* harmony default export */ var post_pending_status_check = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { |
|
7547 const { |
|
7548 isCurrentPostPublished, |
|
7549 getCurrentPostType, |
|
7550 getCurrentPost |
|
7551 } = select(store_store); |
|
7552 return { |
|
7553 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
|
7554 isPublished: isCurrentPostPublished(), |
|
7555 postType: getCurrentPostType() |
|
7556 }; |
|
7557 }))(PostPendingStatusCheck)); |
|
7558 |
|
7559 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js |
|
7560 |
|
7561 |
|
7562 /** |
|
7563 * WordPress dependencies |
|
7564 */ |
|
7565 |
|
7566 |
|
7567 |
|
7568 |
|
7569 /** |
|
7570 * Internal dependencies |
|
7571 */ |
|
7572 |
|
7573 |
|
7574 |
|
7575 function PostPendingStatus(_ref) { |
|
7576 let { |
|
7577 status, |
|
7578 onUpdateStatus |
|
7579 } = _ref; |
|
7580 |
|
7581 const togglePendingStatus = () => { |
|
7582 const updatedStatus = status === 'pending' ? 'draft' : 'pending'; |
|
7583 onUpdateStatus(updatedStatus); |
|
7584 }; |
|
7585 |
|
7586 return (0,external_wp_element_namespaceObject.createElement)(post_pending_status_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { |
|
7587 label: (0,external_wp_i18n_namespaceObject.__)('Pending review'), |
|
7588 checked: status === 'pending', |
|
7589 onChange: togglePendingStatus |
|
7590 })); |
|
7591 } |
|
7592 /* harmony default export */ var post_pending_status = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({ |
|
7593 status: select(store_store).getEditedPostAttribute('status') |
|
7594 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
|
7595 onUpdateStatus(status) { |
|
7596 dispatch(store_store).editPost({ |
|
7597 status |
|
7598 }); |
|
7599 } |
|
7600 |
|
7601 })))(PostPendingStatus)); |
|
7602 |
|
7603 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js |
|
7604 |
|
7605 |
|
7606 /** |
|
7607 * WordPress dependencies |
|
7608 */ |
|
7609 |
|
7610 |
|
7611 |
|
7612 |
|
7613 /** |
|
7614 * Internal dependencies |
|
7615 */ |
|
7616 |
|
7617 |
|
7618 |
|
7619 function PostPingbacks(_ref) { |
|
7620 let { |
|
7621 pingStatus = 'open', |
|
7622 ...props |
|
7623 } = _ref; |
|
7624 |
|
7625 const onTogglePingback = () => props.editPost({ |
|
7626 ping_status: pingStatus === 'open' ? 'closed' : 'open' |
|
7627 }); |
|
7628 |
|
7629 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { |
|
7630 label: (0,external_wp_i18n_namespaceObject.__)('Allow pingbacks & trackbacks'), |
|
7631 checked: pingStatus === 'open', |
|
7632 onChange: onTogglePingback |
|
7633 }); |
|
7634 } |
|
7635 |
|
7636 /* harmony default export */ var post_pingbacks = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
|
7637 return { |
|
7638 pingStatus: select(store_store).getEditedPostAttribute('ping_status') |
|
7639 }; |
|
7640 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
|
7641 editPost: dispatch(store_store).editPost |
|
7642 }))])(PostPingbacks)); |
|
7643 |
|
7644 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js |
|
7645 |
|
7646 |
|
7647 /** |
|
7648 * External dependencies |
|
7649 */ |
|
7650 |
|
7651 |
|
7652 /** |
|
7653 * WordPress dependencies |
|
7654 */ |
|
7655 |
|
7656 |
|
7657 |
|
7658 |
|
7659 |
|
7660 |
|
7661 |
|
7662 |
|
7663 /** |
|
7664 * Internal dependencies |
|
7665 */ |
|
7666 |
|
7667 |
|
7668 |
|
6897 function writeInterstitialMessage(targetDocument) { |
7669 function writeInterstitialMessage(targetDocument) { |
6898 let markup = Object(external_wp_element_["renderToString"])(Object(external_wp_element_["createElement"])("div", { |
7670 let markup = (0,external_wp_element_namespaceObject.renderToString)((0,external_wp_element_namespaceObject.createElement)("div", { |
6899 className: "editor-post-preview-button__interstitial-message" |
7671 className: "editor-post-preview-button__interstitial-message" |
6900 }, Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { |
7672 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { |
6901 xmlns: "http://www.w3.org/2000/svg", |
7673 xmlns: "http://www.w3.org/2000/svg", |
6902 viewBox: "0 0 96 96" |
7674 viewBox: "0 0 96 96" |
6903 }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { |
7675 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { |
6904 className: "outer", |
7676 className: "outer", |
6905 d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", |
7677 d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36", |
6906 fill: "none" |
7678 fill: "none" |
6907 }), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { |
7679 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { |
6908 className: "inner", |
7680 className: "inner", |
6909 d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z", |
7681 d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z", |
6910 fill: "none" |
7682 fill: "none" |
6911 })), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Generating preview…')))); |
7683 })), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Generating preview…')))); |
6912 markup += ` |
7684 markup += ` |
6913 <style> |
7685 <style> |
6914 body { |
7686 body { |
6915 margin: 0; |
7687 margin: 0; |
6916 } |
7688 } |
6967 * Filters the interstitial message shown when generating previews. |
7739 * Filters the interstitial message shown when generating previews. |
6968 * |
7740 * |
6969 * @param {string} markup The preview interstitial markup. |
7741 * @param {string} markup The preview interstitial markup. |
6970 */ |
7742 */ |
6971 |
7743 |
6972 markup = Object(external_wp_hooks_["applyFilters"])('editor.PostPreview.interstitialMarkup', markup); |
7744 markup = (0,external_wp_hooks_namespaceObject.applyFilters)('editor.PostPreview.interstitialMarkup', markup); |
6973 targetDocument.write(markup); |
7745 targetDocument.write(markup); |
6974 targetDocument.title = Object(external_wp_i18n_["__"])('Generating preview…'); |
7746 targetDocument.title = (0,external_wp_i18n_namespaceObject.__)('Generating preview…'); |
6975 targetDocument.close(); |
7747 targetDocument.close(); |
6976 } |
7748 } |
6977 |
7749 |
6978 class post_preview_button_PostPreviewButton extends external_wp_element_["Component"] { |
7750 class PostPreviewButton extends external_wp_element_namespaceObject.Component { |
6979 constructor() { |
7751 constructor() { |
6980 super(...arguments); |
7752 super(...arguments); |
6981 this.buttonRef = Object(external_wp_element_["createRef"])(); |
7753 this.buttonRef = (0,external_wp_element_namespaceObject.createRef)(); |
6982 this.openPreviewWindow = this.openPreviewWindow.bind(this); |
7754 this.openPreviewWindow = this.openPreviewWindow.bind(this); |
6983 } |
7755 } |
6984 |
7756 |
6985 componentDidUpdate(prevProps) { |
7757 componentDidUpdate(prevProps) { |
6986 const { |
7758 const { |
7076 |
7848 |
7077 const href = previewLink || currentPostLink; |
7849 const href = previewLink || currentPostLink; |
7078 const classNames = classnames_default()({ |
7850 const classNames = classnames_default()({ |
7079 'editor-post-preview': !this.props.className |
7851 'editor-post-preview': !this.props.className |
7080 }, this.props.className); |
7852 }, this.props.className); |
7081 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
7853 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
7082 isTertiary: !this.props.className, |
7854 variant: !this.props.className ? 'tertiary' : undefined, |
7083 className: classNames, |
7855 className: classNames, |
7084 href: href, |
7856 href: href, |
7085 target: this.getWindowTarget(), |
7857 target: this.getWindowTarget(), |
7086 disabled: !isSaveable, |
7858 disabled: !isSaveable, |
7087 onClick: this.openPreviewWindow, |
7859 onClick: this.openPreviewWindow, |
7088 ref: this.buttonRef, |
7860 ref: this.buttonRef, |
7089 role: role |
7861 role: role |
7090 }, this.props.textContent ? this.props.textContent : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["_x"])('Preview', 'imperative verb'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { |
7862 }, this.props.textContent ? this.props.textContent : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject._x)('Preview', 'imperative verb'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
7091 as: "span" |
7863 as: "span" |
7092 }, |
7864 }, |
7093 /* translators: accessibility text */ |
7865 /* translators: accessibility text */ |
7094 Object(external_wp_i18n_["__"])('(opens in a new tab)')))); |
7866 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))); |
7095 } |
7867 } |
7096 |
7868 |
7097 } |
7869 } |
7098 /* harmony default export */ var post_preview_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { |
7870 /* harmony default export */ var post_preview_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref) => { |
7099 forcePreviewLink, |
7871 let { |
7100 forceIsAutosaveable |
7872 forcePreviewLink, |
7101 }) => { |
7873 forceIsAutosaveable |
7874 } = _ref; |
|
7102 const { |
7875 const { |
7103 getCurrentPostId, |
7876 getCurrentPostId, |
7104 getCurrentPostAttribute, |
7877 getCurrentPostAttribute, |
7105 getEditedPostAttribute, |
7878 getEditedPostAttribute, |
7106 isEditedPostSaveable, |
7879 isEditedPostSaveable, |
7107 isEditedPostAutosaveable, |
7880 isEditedPostAutosaveable, |
7108 getEditedPostPreviewLink, |
7881 getEditedPostPreviewLink, |
7109 isPostLocked |
7882 isPostLocked |
7110 } = select('core/editor'); |
7883 } = select(store_store); |
7111 const { |
7884 const { |
7112 getPostType |
7885 getPostType |
7113 } = select('core'); |
7886 } = select(external_wp_coreData_namespaceObject.store); |
7114 const previewLink = getEditedPostPreviewLink(); |
7887 const previewLink = getEditedPostPreviewLink(); |
7115 const postType = getPostType(getEditedPostAttribute('type')); |
7888 const postType = getPostType(getEditedPostAttribute('type')); |
7116 return { |
7889 return { |
7117 postId: getCurrentPostId(), |
7890 postId: getCurrentPostId(), |
7118 currentPostLink: getCurrentPostAttribute('link'), |
7891 currentPostLink: getCurrentPostAttribute('link'), |
7119 previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink, |
7892 previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink, |
7120 isSaveable: isEditedPostSaveable(), |
7893 isSaveable: isEditedPostSaveable(), |
7121 isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(), |
7894 isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(), |
7122 isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), |
7895 isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false), |
7123 isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1, |
7896 isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1, |
7124 isPostLocked: isPostLocked() |
7897 isPostLocked: isPostLocked() |
7125 }; |
7898 }; |
7126 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ |
7899 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ |
7127 autosave: dispatch('core/editor').autosave, |
7900 autosave: dispatch(store_store).autosave, |
7128 savePost: dispatch('core/editor').savePost |
7901 savePost: dispatch(store_store).savePost |
7129 })), Object(external_wp_compose_["ifCondition"])(({ |
7902 })), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => { |
7130 isViewable |
7903 let { |
7131 }) => isViewable)])(post_preview_button_PostPreviewButton)); |
7904 isViewable |
7132 |
7905 } = _ref2; |
7133 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js |
7906 return isViewable; |
7134 |
7907 })])(PostPreviewButton)); |
7135 |
7908 |
7909 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js |
|
7136 /** |
7910 /** |
7137 * External dependencies |
7911 * External dependencies |
7138 */ |
7912 */ |
7139 |
7913 |
7140 /** |
7914 /** |
7142 */ |
7916 */ |
7143 |
7917 |
7144 |
7918 |
7145 |
7919 |
7146 |
7920 |
7147 |
|
7148 |
|
7149 |
|
7150 |
|
7151 /** |
7921 /** |
7152 * Internal dependencies |
7922 * Internal dependencies |
7153 */ |
7923 */ |
7154 |
7924 |
7155 |
7925 |
7156 |
7926 function PublishButtonLabel(_ref) { |
7157 function PostLockedModal() { |
7927 let { |
7158 const instanceId = Object(external_wp_compose_["useInstanceId"])(PostLockedModal); |
7928 isPublished, |
7159 const hookName = 'core/editor/post-locked-modal-' + instanceId; |
7929 isBeingScheduled, |
7160 const { |
7930 isSaving, |
7161 autosave, |
7931 isPublishing, |
7162 updatePostLock |
7932 hasPublishAction, |
7163 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
7933 isAutosaving, |
7164 const { |
7934 hasNonPostEntityChanges |
7165 isLocked, |
7935 } = _ref; |
7166 isTakeover, |
7936 |
7167 user, |
|
7168 postId, |
|
7169 postLockUtils, |
|
7170 activePostLock, |
|
7171 postType |
|
7172 } = Object(external_wp_data_["useSelect"])(select => { |
|
7173 const { |
|
7174 isPostLocked, |
|
7175 isPostLockTakeover, |
|
7176 getPostLockUser, |
|
7177 getCurrentPostId, |
|
7178 getActivePostLock, |
|
7179 getEditedPostAttribute, |
|
7180 getEditorSettings |
|
7181 } = select('core/editor'); |
|
7182 const { |
|
7183 getPostType |
|
7184 } = select('core'); |
|
7185 return { |
|
7186 isLocked: isPostLocked(), |
|
7187 isTakeover: isPostLockTakeover(), |
|
7188 user: getPostLockUser(), |
|
7189 postId: getCurrentPostId(), |
|
7190 postLockUtils: getEditorSettings().postLockUtils, |
|
7191 activePostLock: getActivePostLock(), |
|
7192 postType: getPostType(getEditedPostAttribute('type')) |
|
7193 }; |
|
7194 }); |
|
7195 Object(external_wp_element_["useEffect"])(() => { |
|
7196 /** |
|
7197 * Keep the lock refreshed. |
|
7198 * |
|
7199 * When the user does not send a heartbeat in a heartbeat-tick |
|
7200 * the user is no longer editing and another user can start editing. |
|
7201 * |
|
7202 * @param {Object} data Data to send in the heartbeat request. |
|
7203 */ |
|
7204 function sendPostLock(data) { |
|
7205 if (isLocked) { |
|
7206 return; |
|
7207 } |
|
7208 |
|
7209 data['wp-refresh-post-lock'] = { |
|
7210 lock: activePostLock, |
|
7211 post_id: postId |
|
7212 }; |
|
7213 } |
|
7214 /** |
|
7215 * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing. |
|
7216 * |
|
7217 * @param {Object} data Data received in the heartbeat request |
|
7218 */ |
|
7219 |
|
7220 |
|
7221 function receivePostLock(data) { |
|
7222 if (!data['wp-refresh-post-lock']) { |
|
7223 return; |
|
7224 } |
|
7225 |
|
7226 const received = data['wp-refresh-post-lock']; |
|
7227 |
|
7228 if (received.lock_error) { |
|
7229 // Auto save and display the takeover modal. |
|
7230 autosave(); |
|
7231 updatePostLock({ |
|
7232 isLocked: true, |
|
7233 isTakeover: true, |
|
7234 user: { |
|
7235 avatar: received.lock_error.avatar_src |
|
7236 } |
|
7237 }); |
|
7238 } else if (received.new_lock) { |
|
7239 updatePostLock({ |
|
7240 isLocked: false, |
|
7241 activePostLock: received.new_lock |
|
7242 }); |
|
7243 } |
|
7244 } |
|
7245 /** |
|
7246 * Unlock the post before the window is exited. |
|
7247 */ |
|
7248 |
|
7249 |
|
7250 function releasePostLock() { |
|
7251 if (isLocked || !activePostLock) { |
|
7252 return; |
|
7253 } |
|
7254 |
|
7255 const data = new window.FormData(); |
|
7256 data.append('action', 'wp-remove-post-lock'); |
|
7257 data.append('_wpnonce', postLockUtils.unlockNonce); |
|
7258 data.append('post_ID', postId); |
|
7259 data.append('active_post_lock', activePostLock); |
|
7260 |
|
7261 if (window.navigator.sendBeacon) { |
|
7262 window.navigator.sendBeacon(postLockUtils.ajaxUrl, data); |
|
7263 } else { |
|
7264 const xhr = new window.XMLHttpRequest(); |
|
7265 xhr.open('POST', postLockUtils.ajaxUrl, false); |
|
7266 xhr.send(data); |
|
7267 } |
|
7268 } // Details on these events on the Heartbeat API docs |
|
7269 // https://developer.wordpress.org/plugins/javascript/heartbeat-api/ |
|
7270 |
|
7271 |
|
7272 Object(external_wp_hooks_["addAction"])('heartbeat.send', hookName, sendPostLock); |
|
7273 Object(external_wp_hooks_["addAction"])('heartbeat.tick', hookName, receivePostLock); |
|
7274 window.addEventListener('beforeunload', releasePostLock); |
|
7275 return () => { |
|
7276 Object(external_wp_hooks_["removeAction"])('heartbeat.send', hookName); |
|
7277 Object(external_wp_hooks_["removeAction"])('heartbeat.tick', hookName); |
|
7278 window.removeEventListener('beforeunload', releasePostLock); |
|
7279 }; |
|
7280 }, []); |
|
7281 |
|
7282 if (!isLocked) { |
|
7283 return null; |
|
7284 } |
|
7285 |
|
7286 const userDisplayName = user.name; |
|
7287 const userAvatar = user.avatar; |
|
7288 const unlockUrl = Object(external_wp_url_["addQueryArgs"])('post.php', { |
|
7289 'get-post-lock': '1', |
|
7290 lockKey: true, |
|
7291 post: postId, |
|
7292 action: 'edit', |
|
7293 _wpnonce: postLockUtils.nonce |
|
7294 }); |
|
7295 const allPostsUrl = getWPAdminURL('edit.php', { |
|
7296 post_type: Object(external_lodash_["get"])(postType, ['slug']) |
|
7297 }); |
|
7298 |
|
7299 const allPostsLabel = Object(external_wp_i18n_["__"])('Exit the Editor'); |
|
7300 |
|
7301 return Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], { |
|
7302 title: isTakeover ? Object(external_wp_i18n_["__"])('Someone else has taken over this post.') : Object(external_wp_i18n_["__"])('This post is already being edited.'), |
|
7303 focusOnMount: true, |
|
7304 shouldCloseOnClickOutside: false, |
|
7305 shouldCloseOnEsc: false, |
|
7306 isDismissible: false, |
|
7307 className: "editor-post-locked-modal" |
|
7308 }, !!userAvatar && Object(external_wp_element_["createElement"])("img", { |
|
7309 src: userAvatar, |
|
7310 alt: Object(external_wp_i18n_["__"])('Avatar'), |
|
7311 className: "editor-post-locked-modal__avatar" |
|
7312 }), !!isTakeover && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_wp_i18n_["sprintf"])( |
|
7313 /* translators: %s: user's display name */ |
|
7314 Object(external_wp_i18n_["__"])('%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : Object(external_wp_i18n_["__"])('Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.')), Object(external_wp_element_["createElement"])("div", { |
|
7315 className: "editor-post-locked-modal__buttons" |
|
7316 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
7317 isPrimary: true, |
|
7318 href: allPostsUrl |
|
7319 }, allPostsLabel))), !isTakeover && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_wp_i18n_["sprintf"])( |
|
7320 /* translators: %s: user's display name */ |
|
7321 Object(external_wp_i18n_["__"])('%s is currently working on this post, which means you cannot make changes, unless you take over.'), userDisplayName) : Object(external_wp_i18n_["__"])('Another user is currently working on this post, which means you cannot make changes, unless you take over.')), Object(external_wp_element_["createElement"])("div", { |
|
7322 className: "editor-post-locked-modal__buttons" |
|
7323 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
7324 isSecondary: true, |
|
7325 href: allPostsUrl |
|
7326 }, allPostsLabel), Object(external_wp_element_["createElement"])(post_preview_button, null), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
7327 isPrimary: true, |
|
7328 href: unlockUrl |
|
7329 }, Object(external_wp_i18n_["__"])('Take Over'))))); |
|
7330 } |
|
7331 |
|
7332 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js |
|
7333 /** |
|
7334 * External dependencies |
|
7335 */ |
|
7336 |
|
7337 /** |
|
7338 * WordPress dependencies |
|
7339 */ |
|
7340 |
|
7341 |
|
7342 |
|
7343 function PostPendingStatusCheck({ |
|
7344 hasPublishAction, |
|
7345 isPublished, |
|
7346 children |
|
7347 }) { |
|
7348 if (isPublished || !hasPublishAction) { |
|
7349 return null; |
|
7350 } |
|
7351 |
|
7352 return children; |
|
7353 } |
|
7354 /* harmony default export */ var post_pending_status_check = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => { |
|
7355 const { |
|
7356 isCurrentPostPublished, |
|
7357 getCurrentPostType, |
|
7358 getCurrentPost |
|
7359 } = select('core/editor'); |
|
7360 return { |
|
7361 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
|
7362 isPublished: isCurrentPostPublished(), |
|
7363 postType: getCurrentPostType() |
|
7364 }; |
|
7365 }))(PostPendingStatusCheck)); |
|
7366 |
|
7367 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js |
|
7368 |
|
7369 |
|
7370 /** |
|
7371 * WordPress dependencies |
|
7372 */ |
|
7373 |
|
7374 |
|
7375 |
|
7376 |
|
7377 /** |
|
7378 * Internal dependencies |
|
7379 */ |
|
7380 |
|
7381 |
|
7382 function PostPendingStatus({ |
|
7383 status, |
|
7384 onUpdateStatus |
|
7385 }) { |
|
7386 const togglePendingStatus = () => { |
|
7387 const updatedStatus = status === 'pending' ? 'draft' : 'pending'; |
|
7388 onUpdateStatus(updatedStatus); |
|
7389 }; |
|
7390 |
|
7391 return Object(external_wp_element_["createElement"])(post_pending_status_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { |
|
7392 label: Object(external_wp_i18n_["__"])('Pending review'), |
|
7393 checked: status === 'pending', |
|
7394 onChange: togglePendingStatus |
|
7395 })); |
|
7396 } |
|
7397 /* harmony default export */ var post_pending_status = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => ({ |
|
7398 status: select('core/editor').getEditedPostAttribute('status') |
|
7399 })), Object(external_wp_data_["withDispatch"])(dispatch => ({ |
|
7400 onUpdateStatus(status) { |
|
7401 dispatch('core/editor').editPost({ |
|
7402 status |
|
7403 }); |
|
7404 } |
|
7405 |
|
7406 })))(PostPendingStatus)); |
|
7407 |
|
7408 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js |
|
7409 |
|
7410 |
|
7411 /** |
|
7412 * WordPress dependencies |
|
7413 */ |
|
7414 |
|
7415 |
|
7416 |
|
7417 |
|
7418 |
|
7419 function PostPingbacks({ |
|
7420 pingStatus = 'open', |
|
7421 ...props |
|
7422 }) { |
|
7423 const onTogglePingback = () => props.editPost({ |
|
7424 ping_status: pingStatus === 'open' ? 'closed' : 'open' |
|
7425 }); |
|
7426 |
|
7427 return Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { |
|
7428 label: Object(external_wp_i18n_["__"])('Allow pingbacks & trackbacks'), |
|
7429 checked: pingStatus === 'open', |
|
7430 onChange: onTogglePingback |
|
7431 }); |
|
7432 } |
|
7433 |
|
7434 /* harmony default export */ var post_pingbacks = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
|
7435 return { |
|
7436 pingStatus: select('core/editor').getEditedPostAttribute('ping_status') |
|
7437 }; |
|
7438 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ |
|
7439 editPost: dispatch('core/editor').editPost |
|
7440 }))])(PostPingbacks)); |
|
7441 |
|
7442 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js |
|
7443 /** |
|
7444 * External dependencies |
|
7445 */ |
|
7446 |
|
7447 /** |
|
7448 * WordPress dependencies |
|
7449 */ |
|
7450 |
|
7451 |
|
7452 |
|
7453 |
|
7454 function PublishButtonLabel({ |
|
7455 isPublished, |
|
7456 isBeingScheduled, |
|
7457 isSaving, |
|
7458 isPublishing, |
|
7459 hasPublishAction, |
|
7460 isAutosaving, |
|
7461 hasNonPostEntityChanges |
|
7462 }) { |
|
7463 if (isPublishing) { |
7937 if (isPublishing) { |
7464 /* translators: button label text should, if possible, be under 16 characters. */ |
7938 /* translators: button label text should, if possible, be under 16 characters. */ |
7465 return Object(external_wp_i18n_["__"])('Publishing…'); |
7939 return (0,external_wp_i18n_namespaceObject.__)('Publishing…'); |
7466 } else if (isPublished && isSaving && !isAutosaving) { |
7940 } else if (isPublished && isSaving && !isAutosaving) { |
7467 /* translators: button label text should, if possible, be under 16 characters. */ |
7941 /* translators: button label text should, if possible, be under 16 characters. */ |
7468 return Object(external_wp_i18n_["__"])('Updating…'); |
7942 return (0,external_wp_i18n_namespaceObject.__)('Updating…'); |
7469 } else if (isBeingScheduled && isSaving && !isAutosaving) { |
7943 } else if (isBeingScheduled && isSaving && !isAutosaving) { |
7470 /* translators: button label text should, if possible, be under 16 characters. */ |
7944 /* translators: button label text should, if possible, be under 16 characters. */ |
7471 return Object(external_wp_i18n_["__"])('Scheduling…'); |
7945 return (0,external_wp_i18n_namespaceObject.__)('Scheduling…'); |
7472 } |
7946 } |
7473 |
7947 |
7474 if (!hasPublishAction) { |
7948 if (!hasPublishAction) { |
7475 return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Submit for Review…') : Object(external_wp_i18n_["__"])('Submit for Review'); |
7949 return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Submit for Review…') : (0,external_wp_i18n_namespaceObject.__)('Submit for Review'); |
7476 } else if (isPublished) { |
7950 } else if (isPublished) { |
7477 return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Update…') : Object(external_wp_i18n_["__"])('Update'); |
7951 return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Update…') : (0,external_wp_i18n_namespaceObject.__)('Update'); |
7478 } else if (isBeingScheduled) { |
7952 } else if (isBeingScheduled) { |
7479 return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Schedule…') : Object(external_wp_i18n_["__"])('Schedule'); |
7953 return hasNonPostEntityChanges ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Schedule'); |
7480 } |
7954 } |
7481 |
7955 |
7482 return Object(external_wp_i18n_["__"])('Publish'); |
7956 return (0,external_wp_i18n_namespaceObject.__)('Publish'); |
7483 } |
7957 } |
7484 /* harmony default export */ var post_publish_button_label = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { |
7958 /* harmony default export */ var label = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => { |
7485 forceIsSaving |
7959 let { |
7486 }) => { |
7960 forceIsSaving |
7961 } = _ref2; |
|
7487 const { |
7962 const { |
7488 isCurrentPostPublished, |
7963 isCurrentPostPublished, |
7489 isEditedPostBeingScheduled, |
7964 isEditedPostBeingScheduled, |
7490 isSavingPost, |
7965 isSavingPost, |
7491 isPublishingPost, |
7966 isPublishingPost, |
7492 getCurrentPost, |
7967 getCurrentPost, |
7493 getCurrentPostType, |
7968 getCurrentPostType, |
7494 isAutosavingPost |
7969 isAutosavingPost |
7495 } = select('core/editor'); |
7970 } = select(store_store); |
7496 return { |
7971 return { |
7497 isPublished: isCurrentPostPublished(), |
7972 isPublished: isCurrentPostPublished(), |
7498 isBeingScheduled: isEditedPostBeingScheduled(), |
7973 isBeingScheduled: isEditedPostBeingScheduled(), |
7499 isSaving: forceIsSaving || isSavingPost(), |
7974 isSaving: forceIsSaving || isSavingPost(), |
7500 isPublishing: isPublishingPost(), |
7975 isPublishing: isPublishingPost(), |
7501 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
7976 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
7502 postType: getCurrentPostType(), |
7977 postType: getCurrentPostType(), |
7503 isAutosaving: isAutosavingPost() |
7978 isAutosaving: isAutosavingPost() |
7504 }; |
7979 }; |
7505 })])(PublishButtonLabel)); |
7980 })])(PublishButtonLabel)); |
7506 |
7981 |
7507 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js |
7982 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js |
7508 |
7983 |
7509 |
7984 |
7510 |
7985 |
7511 /** |
7986 /** |
7512 * External dependencies |
7987 * External dependencies |
7525 /** |
8000 /** |
7526 * Internal dependencies |
8001 * Internal dependencies |
7527 */ |
8002 */ |
7528 |
8003 |
7529 |
8004 |
7530 class post_publish_button_PostPublishButton extends external_wp_element_["Component"] { |
8005 |
8006 class PostPublishButton extends external_wp_element_namespaceObject.Component { |
|
7531 constructor(props) { |
8007 constructor(props) { |
7532 super(props); |
8008 super(props); |
7533 this.buttonNode = Object(external_wp_element_["createRef"])(); |
8009 this.buttonNode = (0,external_wp_element_namespaceObject.createRef)(); |
7534 this.createOnClick = this.createOnClick.bind(this); |
8010 this.createOnClick = this.createOnClick.bind(this); |
7535 this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this); |
8011 this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this); |
7536 this.state = { |
8012 this.state = { |
7537 entitiesSavedStatesCallback: false |
8013 entitiesSavedStatesCallback: false |
7538 }; |
8014 }; |
7543 this.buttonNode.current.focus(); |
8019 this.buttonNode.current.focus(); |
7544 } |
8020 } |
7545 } |
8021 } |
7546 |
8022 |
7547 createOnClick(callback) { |
8023 createOnClick(callback) { |
7548 return (...args) => { |
8024 var _this = this; |
8025 |
|
8026 return function () { |
|
8027 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
|
8028 args[_key] = arguments[_key]; |
|
8029 } |
|
8030 |
|
7549 const { |
8031 const { |
7550 hasNonPostEntityChanges |
8032 hasNonPostEntityChanges, |
7551 } = this.props; |
8033 setEntitiesSavedStatesCallback |
7552 |
8034 } = _this.props; // If a post with non-post entities is published, but the user |
7553 if (hasNonPostEntityChanges) { |
8035 // elects to not save changes to the non-post entities, those |
8036 // entities will still be dirty when the Publish button is clicked. |
|
8037 // We also need to check that the `setEntitiesSavedStatesCallback` |
|
8038 // prop was passed. See https://github.com/WordPress/gutenberg/pull/37383 |
|
8039 |
|
8040 if (hasNonPostEntityChanges && setEntitiesSavedStatesCallback) { |
|
7554 // The modal for multiple entity saving will open, |
8041 // The modal for multiple entity saving will open, |
7555 // hold the callback for saving/publishing the post |
8042 // hold the callback for saving/publishing the post |
7556 // so that we can call it if the post entity is checked. |
8043 // so that we can call it if the post entity is checked. |
7557 this.setState({ |
8044 _this.setState({ |
7558 entitiesSavedStatesCallback: () => callback(...args) |
8045 entitiesSavedStatesCallback: () => callback(...args) |
7559 }); // Open the save panel by setting its callback. |
8046 }); // Open the save panel by setting its callback. |
7560 // To set a function on the useState hook, we must set it |
8047 // To set a function on the useState hook, we must set it |
7561 // with another function (() => myFunction). Passing the |
8048 // with another function (() => myFunction). Passing the |
7562 // function on its own will cause an error when called. |
8049 // function on its own will cause an error when called. |
7563 |
8050 |
7564 this.props.setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates); |
8051 |
7565 return external_lodash_["noop"]; |
8052 setEntitiesSavedStatesCallback(() => _this.closeEntitiesSavedStates); |
8053 return external_lodash_namespaceObject.noop; |
|
7566 } |
8054 } |
7567 |
8055 |
7568 return callback(...args); |
8056 return callback(...args); |
7569 }; |
8057 }; |
7570 } |
8058 } |
7578 entitiesSavedStatesCallback |
8066 entitiesSavedStatesCallback |
7579 } = this.state; |
8067 } = this.state; |
7580 this.setState({ |
8068 this.setState({ |
7581 entitiesSavedStatesCallback: false |
8069 entitiesSavedStatesCallback: false |
7582 }, () => { |
8070 }, () => { |
7583 if (savedEntities && Object(external_lodash_["some"])(savedEntities, elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) { |
8071 if (savedEntities && (0,external_lodash_namespaceObject.some)(savedEntities, elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) { |
7584 // The post entity was checked, call the held callback from `createOnClick`. |
8072 // The post entity was checked, call the held callback from `createOnClick`. |
7585 entitiesSavedStatesCallback(); |
8073 entitiesSavedStatesCallback(); |
7586 } |
8074 } |
7587 }); |
8075 }); |
7588 } |
8076 } |
7601 isSaving, |
8089 isSaving, |
7602 isAutoSaving, |
8090 isAutoSaving, |
7603 isToggle, |
8091 isToggle, |
7604 onSave, |
8092 onSave, |
7605 onStatusChange, |
8093 onStatusChange, |
7606 onSubmit = external_lodash_["noop"], |
8094 onSubmit = external_lodash_namespaceObject.noop, |
7607 onToggle, |
8095 onToggle, |
7608 visibility, |
8096 visibility, |
7609 hasNonPostEntityChanges |
8097 hasNonPostEntityChanges, |
8098 isSavingNonPostEntityChanges |
|
7610 } = this.props; |
8099 } = this.props; |
7611 const isButtonDisabled = isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty; |
8100 const isButtonDisabled = (isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); |
7612 const isToggleDisabled = isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty; |
8101 const isToggleDisabled = (isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty) && (!hasNonPostEntityChanges || isSavingNonPostEntityChanges); |
7613 let publishStatus; |
8102 let publishStatus; |
7614 |
8103 |
7615 if (!hasPublishAction) { |
8104 if (!hasPublishAction) { |
7616 publishStatus = 'pending'; |
8105 publishStatus = 'pending'; |
7617 } else if (visibility === 'private') { |
8106 } else if (visibility === 'private') { |
7639 |
8128 |
7640 onToggle(); |
8129 onToggle(); |
7641 }; |
8130 }; |
7642 |
8131 |
7643 const buttonProps = { |
8132 const buttonProps = { |
7644 'aria-disabled': isButtonDisabled && !hasNonPostEntityChanges, |
8133 'aria-disabled': isButtonDisabled, |
7645 className: 'editor-post-publish-button', |
8134 className: 'editor-post-publish-button', |
7646 isBusy: !isAutoSaving && isSaving && isPublished, |
8135 isBusy: !isAutoSaving && isSaving && isPublished, |
7647 isPrimary: true, |
8136 variant: 'primary', |
7648 onClick: this.createOnClick(onClickButton) |
8137 onClick: this.createOnClick(onClickButton) |
7649 }; |
8138 }; |
7650 const toggleProps = { |
8139 const toggleProps = { |
7651 'aria-disabled': isToggleDisabled && !hasNonPostEntityChanges, |
8140 'aria-disabled': isToggleDisabled, |
7652 'aria-expanded': isOpen, |
8141 'aria-expanded': isOpen, |
7653 className: 'editor-post-publish-panel__toggle', |
8142 className: 'editor-post-publish-panel__toggle', |
7654 isBusy: isSaving && isPublished, |
8143 isBusy: isSaving && isPublished, |
7655 isPrimary: true, |
8144 variant: 'primary', |
7656 onClick: this.createOnClick(onClickToggle) |
8145 onClick: this.createOnClick(onClickToggle) |
7657 }; |
8146 }; |
7658 const toggleChildren = isBeingScheduled ? Object(external_wp_i18n_["__"])('Schedule…') : Object(external_wp_i18n_["__"])('Publish'); |
8147 const toggleChildren = isBeingScheduled ? (0,external_wp_i18n_namespaceObject.__)('Schedule…') : (0,external_wp_i18n_namespaceObject.__)('Publish'); |
7659 const buttonChildren = Object(external_wp_element_["createElement"])(post_publish_button_label, { |
8148 const buttonChildren = (0,external_wp_element_namespaceObject.createElement)(label, { |
7660 forceIsSaving: forceIsSaving, |
8149 forceIsSaving: forceIsSaving, |
7661 hasNonPostEntityChanges: hasNonPostEntityChanges |
8150 hasNonPostEntityChanges: hasNonPostEntityChanges |
7662 }); |
8151 }); |
7663 const componentProps = isToggle ? toggleProps : buttonProps; |
8152 const componentProps = isToggle ? toggleProps : buttonProps; |
7664 const componentChildren = isToggle ? toggleChildren : buttonChildren; |
8153 const componentChildren = isToggle ? toggleChildren : buttonChildren; |
7665 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({ |
8154 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({ |
7666 ref: this.buttonNode |
8155 ref: this.buttonNode |
7667 }, componentProps, { |
8156 }, componentProps, { |
7668 className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', { |
8157 className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', { |
7669 'has-changes-dot': hasNonPostEntityChanges |
8158 'has-changes-dot': hasNonPostEntityChanges |
7670 }) |
8159 }) |
7671 }), componentChildren)); |
8160 }), componentChildren)); |
7672 } |
8161 } |
7673 |
8162 |
7674 } |
8163 } |
7675 /* harmony default export */ var post_publish_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
8164 /* harmony default export */ var post_publish_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
7676 const { |
8165 const { |
7677 isSavingPost, |
8166 isSavingPost, |
7678 isAutosavingPost, |
8167 isAutosavingPost, |
7679 isEditedPostBeingScheduled, |
8168 isEditedPostBeingScheduled, |
7680 getEditedPostVisibility, |
8169 getEditedPostVisibility, |
7683 isEditedPostPublishable, |
8172 isEditedPostPublishable, |
7684 isPostSavingLocked, |
8173 isPostSavingLocked, |
7685 getCurrentPost, |
8174 getCurrentPost, |
7686 getCurrentPostType, |
8175 getCurrentPostType, |
7687 getCurrentPostId, |
8176 getCurrentPostId, |
7688 hasNonPostEntityChanges |
8177 hasNonPostEntityChanges, |
7689 } = select('core/editor'); |
8178 isSavingNonPostEntityChanges |
8179 } = select(store_store); |
|
7690 |
8180 |
7691 const _isAutoSaving = isAutosavingPost(); |
8181 const _isAutoSaving = isAutosavingPost(); |
7692 |
8182 |
7693 return { |
8183 return { |
7694 isSaving: isSavingPost() || _isAutoSaving, |
8184 isSaving: isSavingPost() || _isAutoSaving, |
7697 visibility: getEditedPostVisibility(), |
8187 visibility: getEditedPostVisibility(), |
7698 isSaveable: isEditedPostSaveable(), |
8188 isSaveable: isEditedPostSaveable(), |
7699 isPostSavingLocked: isPostSavingLocked(), |
8189 isPostSavingLocked: isPostSavingLocked(), |
7700 isPublishable: isEditedPostPublishable(), |
8190 isPublishable: isEditedPostPublishable(), |
7701 isPublished: isCurrentPostPublished(), |
8191 isPublished: isCurrentPostPublished(), |
7702 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
8192 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
7703 postType: getCurrentPostType(), |
8193 postType: getCurrentPostType(), |
7704 postId: getCurrentPostId(), |
8194 postId: getCurrentPostId(), |
7705 hasNonPostEntityChanges: hasNonPostEntityChanges() |
8195 hasNonPostEntityChanges: hasNonPostEntityChanges(), |
8196 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges() |
|
7706 }; |
8197 }; |
7707 }), Object(external_wp_data_["withDispatch"])(dispatch => { |
8198 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
7708 const { |
8199 const { |
7709 editPost, |
8200 editPost, |
7710 savePost |
8201 savePost |
7711 } = dispatch('core/editor'); |
8202 } = dispatch(store_store); |
7712 return { |
8203 return { |
7713 onStatusChange: status => editPost({ |
8204 onStatusChange: status => editPost({ |
7714 status |
8205 status |
7715 }, { |
8206 }, { |
7716 undoIgnore: true |
8207 undoIgnore: true |
7717 }), |
8208 }), |
7718 onSave: savePost |
8209 onSave: savePost |
7719 }; |
8210 }; |
7720 })])(post_publish_button_PostPublishButton)); |
8211 })])(PostPublishButton)); |
7721 |
8212 |
7722 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js |
8213 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js |
7723 var close_small = __webpack_require__("bWcr"); |
8214 |
7724 |
8215 |
7725 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js |
8216 /** |
7726 var wordpress = __webpack_require__("wduq"); |
8217 * WordPress dependencies |
7727 |
8218 */ |
7728 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js |
8219 |
8220 const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
8221 xmlns: "http://www.w3.org/2000/svg", |
|
8222 viewBox: "0 0 24 24" |
|
8223 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
8224 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" |
|
8225 })); |
|
8226 /* harmony default export */ var close_small = (closeSmall); |
|
8227 |
|
8228 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js |
|
8229 |
|
8230 |
|
8231 /** |
|
8232 * WordPress dependencies |
|
8233 */ |
|
8234 |
|
8235 const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
8236 xmlns: "http://www.w3.org/2000/svg", |
|
8237 viewBox: "-2 -2 24 24" |
|
8238 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
8239 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" |
|
8240 })); |
|
8241 /* harmony default export */ var library_wordpress = (wordpress); |
|
8242 |
|
8243 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js |
|
8244 function _defineProperty(obj, key, value) { |
|
8245 if (key in obj) { |
|
8246 Object.defineProperty(obj, key, { |
|
8247 value: value, |
|
8248 enumerable: true, |
|
8249 configurable: true, |
|
8250 writable: true |
|
8251 }); |
|
8252 } else { |
|
8253 obj[key] = value; |
|
8254 } |
|
8255 |
|
8256 return obj; |
|
8257 } |
|
8258 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js |
|
7729 /** |
8259 /** |
7730 * WordPress dependencies |
8260 * WordPress dependencies |
7731 */ |
8261 */ |
7732 |
8262 |
7733 const visibilityOptions = [{ |
8263 const visibilityOptions = [{ |
7734 value: 'public', |
8264 value: 'public', |
7735 label: Object(external_wp_i18n_["__"])('Public'), |
8265 label: (0,external_wp_i18n_namespaceObject.__)('Public'), |
7736 info: Object(external_wp_i18n_["__"])('Visible to everyone.') |
8266 info: (0,external_wp_i18n_namespaceObject.__)('Visible to everyone.') |
7737 }, { |
8267 }, { |
7738 value: 'private', |
8268 value: 'private', |
7739 label: Object(external_wp_i18n_["__"])('Private'), |
8269 label: (0,external_wp_i18n_namespaceObject.__)('Private'), |
7740 info: Object(external_wp_i18n_["__"])('Only visible to site admins and editors.') |
8270 info: (0,external_wp_i18n_namespaceObject.__)('Only visible to site admins and editors.') |
7741 }, { |
8271 }, { |
7742 value: 'password', |
8272 value: 'password', |
7743 label: Object(external_wp_i18n_["__"])('Password Protected'), |
8273 label: (0,external_wp_i18n_namespaceObject.__)('Password Protected'), |
7744 info: Object(external_wp_i18n_["__"])('Protected with a password you choose. Only those with the password can view this post.') |
8274 info: (0,external_wp_i18n_namespaceObject.__)('Protected with a password you choose. Only those with the password can view this post.') |
7745 }]; |
8275 }]; |
7746 |
8276 |
7747 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js |
8277 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js |
8278 |
|
7748 |
8279 |
7749 |
8280 |
7750 /** |
8281 /** |
7751 * WordPress dependencies |
8282 * WordPress dependencies |
7752 */ |
8283 */ |
7758 /** |
8289 /** |
7759 * Internal dependencies |
8290 * Internal dependencies |
7760 */ |
8291 */ |
7761 |
8292 |
7762 |
8293 |
7763 class post_visibility_PostVisibility extends external_wp_element_["Component"] { |
8294 |
8295 class PostVisibility extends external_wp_element_namespaceObject.Component { |
|
7764 constructor(props) { |
8296 constructor(props) { |
7765 super(...arguments); |
8297 super(...arguments); |
8298 |
|
8299 _defineProperty(this, "confirmPrivate", () => { |
|
8300 const { |
|
8301 onUpdateVisibility, |
|
8302 onSave |
|
8303 } = this.props; |
|
8304 onUpdateVisibility('private'); |
|
8305 this.setState({ |
|
8306 hasPassword: false, |
|
8307 showPrivateConfirmDialog: false |
|
8308 }); |
|
8309 onSave(); |
|
8310 }); |
|
8311 |
|
8312 _defineProperty(this, "handleDialogCancel", () => { |
|
8313 this.setState({ |
|
8314 showPrivateConfirmDialog: false |
|
8315 }); |
|
8316 }); |
|
8317 |
|
7766 this.setPublic = this.setPublic.bind(this); |
8318 this.setPublic = this.setPublic.bind(this); |
7767 this.setPrivate = this.setPrivate.bind(this); |
8319 this.setPrivate = this.setPrivate.bind(this); |
7768 this.setPasswordProtected = this.setPasswordProtected.bind(this); |
8320 this.setPasswordProtected = this.setPasswordProtected.bind(this); |
7769 this.updatePassword = this.updatePassword.bind(this); |
8321 this.updatePassword = this.updatePassword.bind(this); |
7770 this.state = { |
8322 this.state = { |
7771 hasPassword: !!props.password |
8323 hasPassword: !!props.password, |
8324 showPrivateConfirmDialog: false |
|
7772 }; |
8325 }; |
7773 } |
8326 } |
7774 |
8327 |
7775 setPublic() { |
8328 setPublic() { |
7776 const { |
8329 const { |
7783 hasPassword: false |
8336 hasPassword: false |
7784 }); |
8337 }); |
7785 } |
8338 } |
7786 |
8339 |
7787 setPrivate() { |
8340 setPrivate() { |
7788 if ( // eslint-disable-next-line no-alert |
|
7789 !window.confirm(Object(external_wp_i18n_["__"])('Would you like to privately publish this post now?'))) { |
|
7790 return; |
|
7791 } |
|
7792 |
|
7793 const { |
|
7794 onUpdateVisibility, |
|
7795 onSave |
|
7796 } = this.props; |
|
7797 onUpdateVisibility('private'); |
|
7798 this.setState({ |
8341 this.setState({ |
7799 hasPassword: false |
8342 showPrivateConfirmDialog: true |
7800 }); |
8343 }); |
7801 onSave(); |
|
7802 } |
8344 } |
7803 |
8345 |
7804 setPasswordProtected() { |
8346 setPasswordProtected() { |
7805 const { |
8347 const { |
7806 visibility, |
8348 visibility, |
7840 password: { |
8382 password: { |
7841 onSelect: this.setPasswordProtected, |
8383 onSelect: this.setPasswordProtected, |
7842 checked: this.state.hasPassword |
8384 checked: this.state.hasPassword |
7843 } |
8385 } |
7844 }; |
8386 }; |
7845 return [Object(external_wp_element_["createElement"])("fieldset", { |
8387 return [(0,external_wp_element_namespaceObject.createElement)("fieldset", { |
7846 key: "visibility-selector", |
8388 key: "visibility-selector", |
7847 className: "editor-post-visibility__dialog-fieldset" |
8389 className: "editor-post-visibility__dialog-fieldset" |
7848 }, Object(external_wp_element_["createElement"])("legend", { |
8390 }, (0,external_wp_element_namespaceObject.createElement)("legend", { |
7849 className: "editor-post-visibility__dialog-legend" |
8391 className: "editor-post-visibility__dialog-legend" |
7850 }, Object(external_wp_i18n_["__"])('Post Visibility')), visibilityOptions.map(({ |
8392 }, (0,external_wp_i18n_namespaceObject.__)('Post Visibility')), visibilityOptions.map(_ref => { |
7851 value, |
8393 let { |
7852 label, |
8394 value, |
7853 info |
8395 label, |
7854 }) => Object(external_wp_element_["createElement"])("div", { |
8396 info |
7855 key: value, |
8397 } = _ref; |
7856 className: "editor-post-visibility__choice" |
8398 return (0,external_wp_element_namespaceObject.createElement)("div", { |
7857 }, Object(external_wp_element_["createElement"])("input", { |
8399 key: value, |
7858 type: "radio", |
8400 className: "editor-post-visibility__choice" |
7859 name: `editor-post-visibility__setting-${instanceId}`, |
8401 }, (0,external_wp_element_namespaceObject.createElement)("input", { |
7860 value: value, |
8402 type: "radio", |
7861 onChange: visibilityHandlers[value].onSelect, |
8403 name: `editor-post-visibility__setting-${instanceId}`, |
7862 checked: visibilityHandlers[value].checked, |
8404 value: value, |
7863 id: `editor-post-${value}-${instanceId}`, |
8405 onChange: visibilityHandlers[value].onSelect, |
7864 "aria-describedby": `editor-post-${value}-${instanceId}-description`, |
8406 checked: visibilityHandlers[value].checked, |
7865 className: "editor-post-visibility__dialog-radio" |
8407 id: `editor-post-${value}-${instanceId}`, |
7866 }), Object(external_wp_element_["createElement"])("label", { |
8408 "aria-describedby": `editor-post-${value}-${instanceId}-description`, |
7867 htmlFor: `editor-post-${value}-${instanceId}`, |
8409 className: "editor-post-visibility__dialog-radio" |
7868 className: "editor-post-visibility__dialog-label" |
8410 }), (0,external_wp_element_namespaceObject.createElement)("label", { |
7869 }, label), Object(external_wp_element_["createElement"])("p", { |
8411 htmlFor: `editor-post-${value}-${instanceId}`, |
7870 id: `editor-post-${value}-${instanceId}-description`, |
8412 className: "editor-post-visibility__dialog-label" |
7871 className: "editor-post-visibility__dialog-info" |
8413 }, label), (0,external_wp_element_namespaceObject.createElement)("p", { |
7872 }, info)))), this.state.hasPassword && Object(external_wp_element_["createElement"])("div", { |
8414 id: `editor-post-${value}-${instanceId}-description`, |
8415 className: "editor-post-visibility__dialog-info" |
|
8416 }, info)); |
|
8417 })), this.state.hasPassword && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
7873 className: "editor-post-visibility__dialog-password", |
8418 className: "editor-post-visibility__dialog-password", |
7874 key: "password-selector" |
8419 key: "password-selector" |
7875 }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { |
8420 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
7876 as: "label", |
8421 as: "label", |
7877 htmlFor: `editor-post-visibility__dialog-password-input-${instanceId}` |
8422 htmlFor: `editor-post-visibility__dialog-password-input-${instanceId}` |
7878 }, Object(external_wp_i18n_["__"])('Create password')), Object(external_wp_element_["createElement"])("input", { |
8423 }, (0,external_wp_i18n_namespaceObject.__)('Create password')), (0,external_wp_element_namespaceObject.createElement)("input", { |
7879 className: "editor-post-visibility__dialog-password-input", |
8424 className: "editor-post-visibility__dialog-password-input", |
7880 id: `editor-post-visibility__dialog-password-input-${instanceId}`, |
8425 id: `editor-post-visibility__dialog-password-input-${instanceId}`, |
7881 type: "text", |
8426 type: "text", |
7882 onChange: this.updatePassword, |
8427 onChange: this.updatePassword, |
7883 value: password, |
8428 value: password, |
7884 placeholder: Object(external_wp_i18n_["__"])('Use a secure password') |
8429 placeholder: (0,external_wp_i18n_namespaceObject.__)('Use a secure password') |
7885 }))]; |
8430 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { |
7886 } |
8431 key: "private-publish-confirmation", |
7887 |
8432 isOpen: this.state.showPrivateConfirmDialog, |
7888 } |
8433 onConfirm: this.confirmPrivate, |
7889 /* harmony default export */ var post_visibility = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
8434 onCancel: this.handleDialogCancel |
8435 }, (0,external_wp_i18n_namespaceObject.__)('Would you like to privately publish this post now?'))]; |
|
8436 } |
|
8437 |
|
8438 } |
|
8439 /* harmony default export */ var post_visibility = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
|
7890 const { |
8440 const { |
7891 getEditedPostAttribute, |
8441 getEditedPostAttribute, |
7892 getEditedPostVisibility |
8442 getEditedPostVisibility |
7893 } = select('core/editor'); |
8443 } = select(store_store); |
7894 return { |
8444 return { |
7895 status: getEditedPostAttribute('status'), |
8445 status: getEditedPostAttribute('status'), |
7896 visibility: getEditedPostVisibility(), |
8446 visibility: getEditedPostVisibility(), |
7897 password: getEditedPostAttribute('password') |
8447 password: getEditedPostAttribute('password') |
7898 }; |
8448 }; |
7899 }), Object(external_wp_data_["withDispatch"])(dispatch => { |
8449 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
7900 const { |
8450 const { |
7901 savePost, |
8451 savePost, |
7902 editPost |
8452 editPost |
7903 } = dispatch('core/editor'); |
8453 } = dispatch(store_store); |
7904 return { |
8454 return { |
7905 onSave: savePost, |
8455 onSave: savePost, |
7906 |
8456 |
7907 onUpdateVisibility(status, password = '') { |
8457 onUpdateVisibility(status) { |
8458 let password = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; |
|
7908 editPost({ |
8459 editPost({ |
7909 status, |
8460 status, |
7910 password |
8461 password |
7911 }); |
8462 }); |
7912 } |
8463 } |
7913 |
8464 |
7914 }; |
8465 }; |
7915 }), external_wp_compose_["withInstanceId"]])(post_visibility_PostVisibility)); |
8466 }), external_wp_compose_namespaceObject.withInstanceId])(PostVisibility)); |
7916 |
8467 |
7917 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js |
8468 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js |
7918 /** |
8469 /** |
7919 * External dependencies |
8470 * External dependencies |
7920 */ |
8471 */ |
7921 |
8472 |
7922 /** |
8473 /** |
7928 * Internal dependencies |
8479 * Internal dependencies |
7929 */ |
8480 */ |
7930 |
8481 |
7931 |
8482 |
7932 |
8483 |
7933 function PostVisibilityLabel({ |
8484 |
7934 visibility |
8485 function PostVisibilityLabel(_ref) { |
7935 }) { |
8486 let { |
7936 const getVisibilityLabel = () => Object(external_lodash_["find"])(visibilityOptions, { |
8487 visibility |
8488 } = _ref; |
|
8489 |
|
8490 const getVisibilityLabel = () => (0,external_lodash_namespaceObject.find)(visibilityOptions, { |
|
7937 value: visibility |
8491 value: visibility |
7938 }).label; |
8492 }).label; |
7939 |
8493 |
7940 return getVisibilityLabel(visibility); |
8494 return getVisibilityLabel(visibility); |
7941 } |
8495 } |
7942 |
8496 |
7943 /* harmony default export */ var post_visibility_label = (Object(external_wp_data_["withSelect"])(select => ({ |
8497 /* harmony default export */ var post_visibility_label = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ |
7944 visibility: select('core/editor').getEditedPostVisibility() |
8498 visibility: select(store_store).getEditedPostVisibility() |
7945 }))(PostVisibilityLabel)); |
8499 }))(PostVisibilityLabel)); |
7946 |
8500 |
7947 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js |
8501 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js |
7948 |
8502 |
7949 |
8503 |
7950 /** |
8504 /** |
7951 * WordPress dependencies |
8505 * WordPress dependencies |
7952 */ |
8506 */ |
7959 * Internal dependencies |
8513 * Internal dependencies |
7960 */ |
8514 */ |
7961 |
8515 |
7962 |
8516 |
7963 |
8517 |
7964 function getDayOfTheMonth(date = new Date(), firstDay = true) { |
8518 function getDayOfTheMonth() { |
8519 let date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date(); |
|
8520 let firstDay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; |
|
7965 const d = new Date(date); |
8521 const d = new Date(date); |
7966 return new Date(d.getFullYear(), d.getMonth() + (firstDay ? 0 : 1), firstDay ? 1 : 0).toISOString(); |
8522 return new Date(d.getFullYear(), d.getMonth() + (firstDay ? 0 : 1), firstDay ? 1 : 0).toISOString(); |
7967 } |
8523 } |
7968 |
8524 |
7969 function PostSchedule() { |
8525 function PostSchedule() { |
7970 const { |
8526 const { |
7971 postDate, |
8527 postDate, |
7972 postType |
8528 postType |
7973 } = Object(external_wp_data_["useSelect"])(select => ({ |
8529 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
7974 postDate: select(store).getEditedPostAttribute('date'), |
8530 postDate: select(store_store).getEditedPostAttribute('date'), |
7975 postType: select(store).getCurrentPostType() |
8531 postType: select(store_store).getCurrentPostType() |
7976 }), []); |
8532 }), []); |
7977 const { |
8533 const { |
7978 editPost |
8534 editPost |
7979 } = Object(external_wp_data_["useDispatch"])(store); |
8535 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
7980 |
8536 |
7981 const onUpdateDate = date => editPost({ |
8537 const onUpdateDate = date => editPost({ |
7982 date |
8538 date |
7983 }); |
8539 }); |
7984 |
8540 |
7985 const [previewedMonth, setPreviewedMonth] = Object(external_wp_element_["useState"])(getDayOfTheMonth(postDate)); // Pick up published and schduled site posts. |
8541 const [previewedMonth, setPreviewedMonth] = (0,external_wp_element_namespaceObject.useState)(getDayOfTheMonth(postDate)); // Pick up published and schduled site posts. |
7986 |
8542 |
7987 const eventsByPostType = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEntityRecords('postType', postType, { |
8543 const eventsByPostType = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', postType, { |
7988 status: 'publish,future', |
8544 status: 'publish,future', |
7989 after: getDayOfTheMonth(previewedMonth), |
8545 after: getDayOfTheMonth(previewedMonth), |
7990 before: getDayOfTheMonth(previewedMonth, false), |
8546 before: getDayOfTheMonth(previewedMonth, false), |
7991 exclude: [select(store).getCurrentPostId()] |
8547 exclude: [select(store_store).getCurrentPostId()] |
7992 }), [previewedMonth, postType]); |
8548 }), [previewedMonth, postType]); |
7993 const events = Object(external_wp_element_["useMemo"])(() => (eventsByPostType || []).map(({ |
8549 const events = (0,external_wp_element_namespaceObject.useMemo)(() => (eventsByPostType || []).map(_ref => { |
7994 title, |
8550 let { |
7995 type, |
8551 title, |
7996 date: eventDate |
8552 type, |
7997 }) => ({ |
8553 date: eventDate |
7998 title: title === null || title === void 0 ? void 0 : title.rendered, |
8554 } = _ref; |
7999 type, |
8555 return { |
8000 date: new Date(eventDate) |
8556 title: title === null || title === void 0 ? void 0 : title.rendered, |
8001 })), [eventsByPostType]); |
8557 type, |
8002 const ref = Object(external_wp_element_["useRef"])(); |
8558 date: new Date(eventDate) |
8003 |
8559 }; |
8004 const settings = Object(external_wp_date_["__experimentalGetSettings"])(); // To know if the current timezone is a 12 hour time with look for "a" in the time format |
8560 }), [eventsByPostType]); |
8561 const ref = (0,external_wp_element_namespaceObject.useRef)(); |
|
8562 |
|
8563 const settings = (0,external_wp_date_namespaceObject.__experimentalGetSettings)(); // To know if the current timezone is a 12 hour time with look for "a" in the time format |
|
8005 // We also make sure this a is not escaped by a "/" |
8564 // We also make sure this a is not escaped by a "/" |
8006 |
8565 |
8007 |
8566 |
8008 const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a |
8567 const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a. |
8009 .replace(/\\\\/g, '') // Replace "//" with empty strings |
8568 .replace(/\\\\/g, '') // Replace "//" with empty strings. |
8010 .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash |
8569 .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash. |
8011 ); |
8570 ); |
8012 |
8571 |
8013 function onChange(newDate) { |
8572 function onChange(newDate) { |
8014 onUpdateDate(newDate); |
8573 onUpdateDate(newDate); |
8015 const { |
8574 const { |
8016 ownerDocument |
8575 ownerDocument |
8017 } = ref.current; |
8576 } = ref.current; |
8018 ownerDocument.activeElement.blur(); |
8577 ownerDocument.activeElement.blur(); |
8019 } |
8578 } |
8020 |
8579 |
8021 return Object(external_wp_element_["createElement"])(external_wp_components_["DateTimePicker"], { |
8580 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.DateTimePicker, { |
8022 ref: ref, |
8581 ref: ref, |
8023 currentDate: postDate, |
8582 currentDate: postDate, |
8024 onChange: onChange, |
8583 onChange: onChange, |
8025 is12Hour: is12HourTime, |
8584 is12Hour: is12HourTime, |
8026 events: events, |
8585 events: events, |
8027 onMonthPreviewed: setPreviewedMonth |
8586 onMonthPreviewed: setPreviewedMonth |
8028 }); |
8587 }); |
8029 } |
8588 } |
8030 |
8589 |
8031 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js |
8590 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js |
8032 /** |
8591 /** |
8033 * WordPress dependencies |
8592 * WordPress dependencies |
8034 */ |
8593 */ |
8035 |
8594 |
8036 |
8595 |
8037 |
8596 |
8038 function PostScheduleLabel({ |
8597 /** |
8039 date, |
8598 * Internal dependencies |
8040 isFloating |
8599 */ |
8041 }) { |
8600 |
8042 const settings = Object(external_wp_date_["__experimentalGetSettings"])(); |
8601 |
8043 |
8602 function PostScheduleLabel(_ref) { |
8044 return date && !isFloating ? Object(external_wp_date_["format"])(`${settings.formats.date} ${settings.formats.time}`, date) : Object(external_wp_i18n_["__"])('Immediately'); |
8603 let { |
8045 } |
8604 date, |
8046 /* harmony default export */ var post_schedule_label = (Object(external_wp_data_["withSelect"])(select => { |
8605 isFloating |
8606 } = _ref; |
|
8607 |
|
8608 const settings = (0,external_wp_date_namespaceObject.__experimentalGetSettings)(); |
|
8609 |
|
8610 return date && !isFloating ? (0,external_wp_date_namespaceObject.format)(`${settings.formats.date} ${settings.formats.time}`, date) : (0,external_wp_i18n_namespaceObject.__)('Immediately'); |
|
8611 } |
|
8612 /* harmony default export */ var post_schedule_label = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
|
8047 return { |
8613 return { |
8048 date: select('core/editor').getEditedPostAttribute('date'), |
8614 date: select(store_store).getEditedPostAttribute('date'), |
8049 isFloating: select('core/editor').isEditedPostDateFloating() |
8615 isFloating: select(store_store).isEditedPostDateFloating() |
8050 }; |
8616 }; |
8051 })(PostScheduleLabel)); |
8617 })(PostScheduleLabel)); |
8052 |
8618 |
8053 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js |
8619 ;// CONCATENATED MODULE: external ["wp","a11y"] |
8620 var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; |
|
8621 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js |
|
8054 |
8622 |
8055 |
8623 |
8056 /** |
8624 /** |
8057 * External dependencies |
8625 * External dependencies |
8058 */ |
8626 */ |
8067 /** |
8635 /** |
8068 * Internal dependencies |
8636 * Internal dependencies |
8069 */ |
8637 */ |
8070 |
8638 |
8071 |
8639 |
8072 const MAX_MOST_USED_TERMS = 10; |
8640 const MIN_MOST_USED_TERMS = 3; |
8073 const DEFAULT_QUERY = { |
8641 const DEFAULT_QUERY = { |
8074 per_page: MAX_MOST_USED_TERMS, |
8642 per_page: 10, |
8075 orderby: 'count', |
8643 orderby: 'count', |
8076 order: 'desc', |
8644 order: 'desc', |
8077 hide_empty: true, |
8645 hide_empty: true, |
8078 _fields: 'id,name,count' |
8646 _fields: 'id,name,count', |
8647 context: 'view' |
|
8079 }; |
8648 }; |
8080 function MostUsedTerms({ |
8649 function MostUsedTerms(_ref) { |
8081 onSelect, |
8650 let { |
8082 taxonomy |
8651 onSelect, |
8083 }) { |
8652 taxonomy |
8653 } = _ref; |
|
8084 const { |
8654 const { |
8085 _terms, |
8655 _terms, |
8086 showTerms |
8656 showTerms |
8087 } = Object(external_wp_data_["useSelect"])(select => { |
8657 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
8088 const mostUsedTerms = select(external_wp_coreData_["store"]).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY); |
8658 const mostUsedTerms = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY); |
8089 return { |
8659 return { |
8090 _terms: mostUsedTerms, |
8660 _terms: mostUsedTerms, |
8091 showTerms: (mostUsedTerms === null || mostUsedTerms === void 0 ? void 0 : mostUsedTerms.length) >= MAX_MOST_USED_TERMS |
8661 showTerms: (mostUsedTerms === null || mostUsedTerms === void 0 ? void 0 : mostUsedTerms.length) >= MIN_MOST_USED_TERMS |
8092 }; |
8662 }; |
8093 }, []); |
8663 }, []); |
8094 |
8664 |
8095 if (!showTerms) { |
8665 if (!showTerms) { |
8096 return null; |
8666 return null; |
8097 } |
8667 } |
8098 |
8668 |
8099 const terms = unescapeTerms(_terms); |
8669 const terms = unescapeTerms(_terms); |
8100 const label = Object(external_lodash_["get"])(taxonomy, ['labels', 'most_used']); |
8670 const label = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'most_used']); |
8101 return Object(external_wp_element_["createElement"])("div", { |
8671 return (0,external_wp_element_namespaceObject.createElement)("div", { |
8102 className: "editor-post-taxonomies__flat-term-most-used" |
8672 className: "editor-post-taxonomies__flat-term-most-used" |
8103 }, Object(external_wp_element_["createElement"])("h3", { |
8673 }, (0,external_wp_element_namespaceObject.createElement)("h3", { |
8104 className: "editor-post-taxonomies__flat-term-most-used-label" |
8674 className: "editor-post-taxonomies__flat-term-most-used-label" |
8105 }, label), Object(external_wp_element_["createElement"])("ul", { |
8675 }, label), (0,external_wp_element_namespaceObject.createElement)("ul", { |
8106 role: "list", |
8676 role: "list", |
8107 className: "editor-post-taxonomies__flat-term-most-used-list" |
8677 className: "editor-post-taxonomies__flat-term-most-used-list" |
8108 }, terms.map(term => Object(external_wp_element_["createElement"])("li", { |
8678 }, terms.map(term => (0,external_wp_element_namespaceObject.createElement)("li", { |
8109 key: term.id |
8679 key: term.id |
8110 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
8680 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
8111 isLink: true, |
8681 variant: "link", |
8112 onClick: () => onSelect(term) |
8682 onClick: () => onSelect(term) |
8113 }, term.name))))); |
8683 }, term.name))))); |
8114 } |
8684 } |
8115 |
8685 |
8116 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js |
8686 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js |
8117 |
8687 |
8118 |
8688 |
8119 /** |
8689 /** |
8120 * External dependencies |
8690 * External dependencies |
8121 */ |
8691 */ |
8130 |
8700 |
8131 |
8701 |
8132 |
8702 |
8133 |
8703 |
8134 |
8704 |
8705 |
|
8135 /** |
8706 /** |
8136 * Internal dependencies |
8707 * Internal dependencies |
8137 */ |
8708 */ |
8138 |
8709 |
8139 |
8710 |
8140 |
8711 |
8141 |
8712 |
8713 /** |
|
8714 * Shared reference to an empty array for cases where it is important to avoid |
|
8715 * returning a new array reference on every invocation. |
|
8716 * |
|
8717 * @type {Array<any>} |
|
8718 */ |
|
8719 |
|
8720 const flat_term_selector_EMPTY_ARRAY = []; |
|
8142 /** |
8721 /** |
8143 * Module constants |
8722 * Module constants |
8144 */ |
8723 */ |
8145 |
8724 |
8146 const MAX_TERMS_SUGGESTIONS = 20; |
8725 const MAX_TERMS_SUGGESTIONS = 20; |
8147 const flat_term_selector_DEFAULT_QUERY = { |
8726 const flat_term_selector_DEFAULT_QUERY = { |
8148 per_page: MAX_TERMS_SUGGESTIONS, |
8727 per_page: MAX_TERMS_SUGGESTIONS, |
8149 orderby: 'count', |
8728 orderby: 'count', |
8150 order: 'desc', |
8729 order: 'desc', |
8151 _fields: 'id,name,count' |
8730 _fields: 'id,name', |
8731 context: 'view' |
|
8152 }; |
8732 }; |
8153 |
8733 |
8154 const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase(); |
8734 const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase(); |
8155 |
8735 |
8156 const termNamesToIds = (names, terms) => { |
8736 const termNamesToIds = (names, terms) => { |
8157 return names.map(termName => Object(external_lodash_["find"])(terms, term => isSameTermName(term.name, termName)).id); |
8737 return names.map(termName => (0,external_lodash_namespaceObject.find)(terms, term => isSameTermName(term.name, termName)).id); |
8158 }; |
8738 }; // Tries to create a term or fetch it if it already exists. |
8159 |
8739 |
8160 class flat_term_selector_FlatTermSelector extends external_wp_element_["Component"] { |
8740 |
8161 constructor() { |
8741 function findOrCreateTerm(termName, restBase) { |
8162 super(...arguments); |
8742 const escapedTermName = (0,external_lodash_namespaceObject.escape)(termName); |
8163 this.onChange = this.onChange.bind(this); |
8743 return external_wp_apiFetch_default()({ |
8164 this.searchTerms = Object(external_lodash_["debounce"])(this.searchTerms.bind(this), 500); |
8744 path: `/wp/v2/${restBase}`, |
8165 this.findOrCreateTerm = this.findOrCreateTerm.bind(this); |
8745 method: 'POST', |
8166 this.appendTerm = this.appendTerm.bind(this); |
8746 data: { |
8167 this.state = { |
8747 name: escapedTermName |
8168 loading: !Object(external_lodash_["isEmpty"])(this.props.terms), |
8748 } |
8169 availableTerms: [], |
8749 }).catch(error => { |
8170 selectedTerms: [] |
8750 const errorCode = error.code; |
8171 }; |
8751 |
8172 } |
8752 if (errorCode === 'term_exists') { |
8173 |
8753 // If the terms exist, fetch it instead of creating a new one. |
8174 componentDidMount() { |
8754 const addRequest = external_wp_apiFetch_default()({ |
8175 if (!Object(external_lodash_["isEmpty"])(this.props.terms)) { |
8755 path: (0,external_wp_url_namespaceObject.addQueryArgs)(`/wp/v2/${restBase}`, { ...flat_term_selector_DEFAULT_QUERY, |
8176 this.initRequest = this.fetchTerms({ |
8756 search: escapedTermName |
8177 include: this.props.terms.join(','), |
8757 }) |
8178 per_page: -1 |
8758 }).then(unescapeTerms); |
8179 }); |
8759 return addRequest.then(searchResult => { |
8180 this.initRequest.then(() => { |
8760 return (0,external_lodash_namespaceObject.find)(searchResult, result => isSameTermName(result.name, termName)); |
8181 this.setState({ |
|
8182 loading: false |
|
8183 }); |
|
8184 }, xhr => { |
|
8185 if (xhr.statusText === 'abort') { |
|
8186 return; |
|
8187 } |
|
8188 |
|
8189 this.setState({ |
|
8190 loading: false |
|
8191 }); |
|
8192 }); |
8761 }); |
8193 } |
8762 } |
8194 } |
8763 |
8195 |
8764 return Promise.reject(error); |
8196 componentWillUnmount() { |
8765 }).then(unescapeTerm); |
8197 Object(external_lodash_["invoke"])(this.initRequest, ['abort']); |
8766 } |
8198 Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); |
8767 |
8199 } |
8768 function FlatTermSelector(_ref) { |
8200 |
8769 let { |
8201 componentDidUpdate(prevProps) { |
8770 slug |
8202 if (prevProps.terms !== this.props.terms) { |
8771 } = _ref; |
8203 this.updateSelectedTerms(this.props.terms); |
8772 const [values, setValues] = (0,external_wp_element_namespaceObject.useState)([]); |
8773 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); |
|
8774 const debouncedSearch = (0,external_wp_compose_namespaceObject.useDebounce)(setSearch, 500); |
|
8775 const { |
|
8776 terms, |
|
8777 termIds, |
|
8778 taxonomy, |
|
8779 hasAssignAction, |
|
8780 hasCreateAction, |
|
8781 hasResolvedTerms |
|
8782 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
8783 const { |
|
8784 getCurrentPost, |
|
8785 getEditedPostAttribute |
|
8786 } = select(store_store); |
|
8787 const { |
|
8788 getEntityRecords, |
|
8789 getTaxonomy, |
|
8790 hasFinishedResolution |
|
8791 } = select(external_wp_coreData_namespaceObject.store); |
|
8792 const post = getCurrentPost(); |
|
8793 |
|
8794 const _taxonomy = getTaxonomy(slug); |
|
8795 |
|
8796 const _termIds = _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : flat_term_selector_EMPTY_ARRAY; |
|
8797 |
|
8798 const query = { ...flat_term_selector_DEFAULT_QUERY, |
|
8799 include: _termIds.join(','), |
|
8800 per_page: -1 |
|
8801 }; |
|
8802 return { |
|
8803 hasCreateAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-create-' + _taxonomy.rest_base], false) : false, |
|
8804 hasAssignAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-assign-' + _taxonomy.rest_base], false) : false, |
|
8805 taxonomy: _taxonomy, |
|
8806 termIds: _termIds, |
|
8807 terms: _termIds.length ? getEntityRecords('taxonomy', slug, query) : flat_term_selector_EMPTY_ARRAY, |
|
8808 hasResolvedTerms: hasFinishedResolution('getEntityRecords', ['taxonomy', slug, query]) |
|
8809 }; |
|
8810 }, [slug]); |
|
8811 const { |
|
8812 searchResults |
|
8813 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
8814 const { |
|
8815 getEntityRecords |
|
8816 } = select(external_wp_coreData_namespaceObject.store); |
|
8817 return { |
|
8818 searchResults: !!search ? getEntityRecords('taxonomy', slug, { ...flat_term_selector_DEFAULT_QUERY, |
|
8819 search |
|
8820 }) : flat_term_selector_EMPTY_ARRAY |
|
8821 }; |
|
8822 }, [search]); // Update terms state only after the selectors are resolved. |
|
8823 // We're using this to avoid terms temporarily disappearing on slow networks |
|
8824 // while core data makes REST API requests. |
|
8825 |
|
8826 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
8827 if (hasResolvedTerms) { |
|
8828 const newValues = (terms !== null && terms !== void 0 ? terms : []).map(term => unescapeString(term.name)); |
|
8829 setValues(newValues); |
|
8204 } |
8830 } |
8205 } |
8831 }, [terms, hasResolvedTerms]); |
8206 |
8832 const suggestions = (0,external_wp_element_namespaceObject.useMemo)(() => { |
8207 fetchTerms(params = {}) { |
8833 return (searchResults !== null && searchResults !== void 0 ? searchResults : []).map(term => unescapeString(term.name)); |
8208 const { |
8834 }, [searchResults]); |
8209 taxonomy |
8835 const { |
8210 } = this.props; |
8836 editPost |
8211 const query = { ...flat_term_selector_DEFAULT_QUERY, |
8837 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
8212 ...params |
8838 |
8213 }; |
8839 if (!hasAssignAction) { |
8214 const request = external_wp_apiFetch_default()({ |
8840 return null; |
8215 path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, query) |
8841 } |
8842 |
|
8843 function onUpdateTerms(newTermIds) { |
|
8844 editPost({ |
|
8845 [taxonomy.rest_base]: newTermIds |
|
8216 }); |
8846 }); |
8217 request.then(unescapeTerms).then(terms => { |
8847 } |
8218 this.setState(state => ({ |
8848 |
8219 availableTerms: state.availableTerms.concat(terms.filter(term => !Object(external_lodash_["find"])(state.availableTerms, availableTerm => availableTerm.id === term.id))) |
8849 function onChange(termNames) { |
8220 })); |
8850 const availableTerms = [...(terms !== null && terms !== void 0 ? terms : []), ...(searchResults !== null && searchResults !== void 0 ? searchResults : [])]; |
8221 this.updateSelectedTerms(this.props.terms); |
8851 const uniqueTerms = (0,external_lodash_namespaceObject.uniqBy)(termNames, term => term.toLowerCase()); |
8222 }); |
8852 const newTermNames = uniqueTerms.filter(termName => !(0,external_lodash_namespaceObject.find)(availableTerms, term => isSameTermName(term.name, termName))); // Optimistically update term values. |
8223 return request; |
8853 // The selector will always re-fetch terms later. |
8224 } |
8854 |
8225 |
8855 setValues(uniqueTerms); |
8226 updateSelectedTerms(terms = []) { |
|
8227 const selectedTerms = terms.reduce((accumulator, termId) => { |
|
8228 const termObject = Object(external_lodash_["find"])(this.state.availableTerms, term => term.id === termId); |
|
8229 |
|
8230 if (termObject) { |
|
8231 accumulator.push(termObject.name); |
|
8232 } |
|
8233 |
|
8234 return accumulator; |
|
8235 }, []); |
|
8236 this.setState({ |
|
8237 selectedTerms |
|
8238 }); |
|
8239 } |
|
8240 |
|
8241 findOrCreateTerm(termName) { |
|
8242 const { |
|
8243 taxonomy |
|
8244 } = this.props; |
|
8245 const termNameEscaped = Object(external_lodash_["escape"])(termName); // Tries to create a term or fetch it if it already exists. |
|
8246 |
|
8247 return external_wp_apiFetch_default()({ |
|
8248 path: `/wp/v2/${taxonomy.rest_base}`, |
|
8249 method: 'POST', |
|
8250 data: { |
|
8251 name: termNameEscaped |
|
8252 } |
|
8253 }).catch(error => { |
|
8254 const errorCode = error.code; |
|
8255 |
|
8256 if (errorCode === 'term_exists') { |
|
8257 // If the terms exist, fetch it instead of creating a new one. |
|
8258 this.addRequest = external_wp_apiFetch_default()({ |
|
8259 path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, { ...flat_term_selector_DEFAULT_QUERY, |
|
8260 search: termNameEscaped |
|
8261 }) |
|
8262 }).then(unescapeTerms); |
|
8263 return this.addRequest.then(searchResult => { |
|
8264 return Object(external_lodash_["find"])(searchResult, result => isSameTermName(result.name, termName)); |
|
8265 }); |
|
8266 } |
|
8267 |
|
8268 return Promise.reject(error); |
|
8269 }).then(unescapeTerm); |
|
8270 } |
|
8271 |
|
8272 onChange(termNames) { |
|
8273 const uniqueTerms = Object(external_lodash_["uniqBy"])(termNames, term => term.toLowerCase()); |
|
8274 this.setState({ |
|
8275 selectedTerms: uniqueTerms |
|
8276 }); |
|
8277 const newTermNames = uniqueTerms.filter(termName => !Object(external_lodash_["find"])(this.state.availableTerms, term => isSameTermName(term.name, termName))); |
|
8278 |
8856 |
8279 if (newTermNames.length === 0) { |
8857 if (newTermNames.length === 0) { |
8280 return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, this.state.availableTerms), this.props.taxonomy.rest_base); |
8858 return onUpdateTerms(termNamesToIds(uniqueTerms, availableTerms)); |
8281 } |
8859 } |
8282 |
8860 |
8283 Promise.all(newTermNames.map(this.findOrCreateTerm)).then(newTerms => { |
8861 if (!hasCreateAction) { |
8284 const newAvailableTerms = this.state.availableTerms.concat(newTerms); |
|
8285 this.setState({ |
|
8286 availableTerms: newAvailableTerms |
|
8287 }); |
|
8288 return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms), this.props.taxonomy.rest_base); |
|
8289 }); |
|
8290 } |
|
8291 |
|
8292 searchTerms(search = '') { |
|
8293 Object(external_lodash_["invoke"])(this.searchRequest, ['abort']); |
|
8294 |
|
8295 if (search.length >= 3) { |
|
8296 this.searchRequest = this.fetchTerms({ |
|
8297 search |
|
8298 }); |
|
8299 } |
|
8300 } |
|
8301 |
|
8302 appendTerm(newTerm) { |
|
8303 const { |
|
8304 onUpdateTerms, |
|
8305 taxonomy, |
|
8306 terms = [], |
|
8307 slug, |
|
8308 speak |
|
8309 } = this.props; |
|
8310 |
|
8311 if (terms.includes(newTerm.id)) { |
|
8312 return; |
8862 return; |
8313 } |
8863 } |
8314 |
8864 |
8315 const newTerms = [...terms, newTerm.id]; |
8865 Promise.all(newTermNames.map(termName => findOrCreateTerm(termName, taxonomy.rest_base))).then(newTerms => { |
8316 const termAddedMessage = Object(external_wp_i18n_["sprintf"])( |
8866 const newAvailableTerms = availableTerms.concat(newTerms); |
8867 return onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms)); |
|
8868 }); |
|
8869 } |
|
8870 |
|
8871 function appendTerm(newTerm) { |
|
8872 if (termIds.includes(newTerm.id)) { |
|
8873 return; |
|
8874 } |
|
8875 |
|
8876 const newTermIds = [...termIds, newTerm.id]; |
|
8877 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( |
|
8317 /* translators: %s: term name. */ |
8878 /* translators: %s: term name. */ |
8318 Object(external_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Tag') : Object(external_wp_i18n_["__"])('Term'))); |
8879 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term'))); |
8319 speak(termAddedMessage, 'assertive'); |
8880 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); |
8320 this.setState({ |
8881 onUpdateTerms(newTermIds); |
8321 availableTerms: [...this.state.availableTerms, newTerm] |
8882 } |
8322 }); |
8883 |
8323 onUpdateTerms(newTerms, taxonomy.rest_base); |
8884 const newTermLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Add new tag') : (0,external_wp_i18n_namespaceObject.__)('Add new Term')); |
8324 } |
8885 const singularName = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? (0,external_wp_i18n_namespaceObject.__)('Tag') : (0,external_wp_i18n_namespaceObject.__)('Term')); |
8325 |
8886 const termAddedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( |
8326 render() { |
8887 /* translators: %s: term name. */ |
8327 const { |
8888 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), singularName); |
8328 slug, |
8889 const termRemovedLabel = (0,external_wp_i18n_namespaceObject.sprintf)( |
8329 taxonomy, |
8890 /* translators: %s: term name. */ |
8330 hasAssignAction |
8891 (0,external_wp_i18n_namespaceObject._x)('%s removed', 'term'), singularName); |
8331 } = this.props; |
8892 const removeTermLabel = (0,external_wp_i18n_namespaceObject.sprintf)( |
8332 |
8893 /* translators: %s: term name. */ |
8333 if (!hasAssignAction) { |
8894 (0,external_wp_i18n_namespaceObject._x)('Remove %s', 'term'), singularName); |
8334 return null; |
8895 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FormTokenField, { |
8896 value: values, |
|
8897 suggestions: suggestions, |
|
8898 onChange: onChange, |
|
8899 onInputChange: debouncedSearch, |
|
8900 maxSuggestions: MAX_TERMS_SUGGESTIONS, |
|
8901 label: newTermLabel, |
|
8902 messages: { |
|
8903 added: termAddedLabel, |
|
8904 removed: termRemovedLabel, |
|
8905 remove: removeTermLabel |
|
8335 } |
8906 } |
8336 |
8907 }), (0,external_wp_element_namespaceObject.createElement)(MostUsedTerms, { |
8337 const { |
8908 taxonomy: taxonomy, |
8338 loading, |
8909 onSelect: appendTerm |
8339 availableTerms, |
8910 })); |
8340 selectedTerms |
8911 } |
8341 } = this.state; |
8912 |
8342 const termNames = availableTerms.map(term => term.name); |
8913 /* harmony default export */ var flat_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(FlatTermSelector)); |
8343 const newTermLabel = Object(external_lodash_["get"])(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Add new tag') : Object(external_wp_i18n_["__"])('Add new Term')); |
8914 |
8344 const singularName = Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Tag') : Object(external_wp_i18n_["__"])('Term')); |
8915 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js |
8345 const termAddedLabel = Object(external_wp_i18n_["sprintf"])( |
|
8346 /* translators: %s: term name. */ |
|
8347 Object(external_wp_i18n_["_x"])('%s added', 'term'), singularName); |
|
8348 const termRemovedLabel = Object(external_wp_i18n_["sprintf"])( |
|
8349 /* translators: %s: term name. */ |
|
8350 Object(external_wp_i18n_["_x"])('%s removed', 'term'), singularName); |
|
8351 const removeTermLabel = Object(external_wp_i18n_["sprintf"])( |
|
8352 /* translators: %s: term name. */ |
|
8353 Object(external_wp_i18n_["_x"])('Remove %s', 'term'), singularName); |
|
8354 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["FormTokenField"], { |
|
8355 value: selectedTerms, |
|
8356 suggestions: termNames, |
|
8357 onChange: this.onChange, |
|
8358 onInputChange: this.searchTerms, |
|
8359 maxSuggestions: MAX_TERMS_SUGGESTIONS, |
|
8360 disabled: loading, |
|
8361 label: newTermLabel, |
|
8362 messages: { |
|
8363 added: termAddedLabel, |
|
8364 removed: termRemovedLabel, |
|
8365 remove: removeTermLabel |
|
8366 } |
|
8367 }), Object(external_wp_element_["createElement"])(MostUsedTerms, { |
|
8368 taxonomy: taxonomy, |
|
8369 onSelect: this.appendTerm |
|
8370 })); |
|
8371 } |
|
8372 |
|
8373 } |
|
8374 |
|
8375 /* harmony default export */ var flat_term_selector = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, { |
|
8376 slug |
|
8377 }) => { |
|
8378 const { |
|
8379 getCurrentPost |
|
8380 } = select(store); |
|
8381 const { |
|
8382 getTaxonomy |
|
8383 } = select(external_wp_coreData_["store"]); |
|
8384 const taxonomy = getTaxonomy(slug); |
|
8385 return { |
|
8386 hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, |
|
8387 hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, |
|
8388 terms: taxonomy ? select(store).getEditedPostAttribute(taxonomy.rest_base) : [], |
|
8389 taxonomy |
|
8390 }; |
|
8391 }), Object(external_wp_data_["withDispatch"])(dispatch => { |
|
8392 return { |
|
8393 onUpdateTerms(terms, restBase) { |
|
8394 dispatch(store).editPost({ |
|
8395 [restBase]: terms |
|
8396 }); |
|
8397 } |
|
8398 |
|
8399 }; |
|
8400 }), external_wp_components_["withSpokenMessages"], Object(external_wp_components_["withFilters"])('editor.PostTaxonomyType'))(flat_term_selector_FlatTermSelector)); |
|
8401 |
|
8402 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js |
|
8403 |
8916 |
8404 |
8917 |
8405 /** |
8918 /** |
8406 * External dependencies |
8919 * External dependencies |
8407 */ |
8920 */ |
8413 |
8926 |
8414 |
8927 |
8415 |
8928 |
8416 |
8929 |
8417 |
8930 |
8931 |
|
8418 /** |
8932 /** |
8419 * Internal dependencies |
8933 * Internal dependencies |
8420 */ |
8934 */ |
8421 |
8935 |
8422 |
8936 |
8423 |
8937 |
8938 |
|
8424 const TagsPanel = () => { |
8939 const TagsPanel = () => { |
8425 const panelBodyTitle = [Object(external_wp_i18n_["__"])('Suggestion:'), Object(external_wp_element_["createElement"])("span", { |
8940 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", { |
8426 className: "editor-post-publish-panel__link", |
8941 className: "editor-post-publish-panel__link", |
8427 key: "label" |
8942 key: "label" |
8428 }, Object(external_wp_i18n_["__"])('Add tags'))]; |
8943 }, (0,external_wp_i18n_namespaceObject.__)('Add tags'))]; |
8429 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { |
8944 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
8430 initialOpen: false, |
8945 initialOpen: false, |
8431 title: panelBodyTitle |
8946 title: panelBodyTitle |
8432 }, Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), Object(external_wp_element_["createElement"])(flat_term_selector, { |
8947 }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), (0,external_wp_element_namespaceObject.createElement)(flat_term_selector, { |
8433 slug: 'post_tag' |
8948 slug: 'post_tag' |
8434 })); |
8949 })); |
8435 }; |
8950 }; |
8436 |
8951 |
8437 class maybe_tags_panel_MaybeTagsPanel extends external_wp_element_["Component"] { |
8952 class MaybeTagsPanel extends external_wp_element_namespaceObject.Component { |
8438 constructor(props) { |
8953 constructor(props) { |
8439 super(props); |
8954 super(props); |
8440 this.state = { |
8955 this.state = { |
8441 hadTagsWhenOpeningThePanel: props.hasTags |
8956 hadTagsWhenOpeningThePanel: props.hasTags |
8442 }; |
8957 }; |
8453 */ |
8968 */ |
8454 |
8969 |
8455 |
8970 |
8456 render() { |
8971 render() { |
8457 if (!this.state.hadTagsWhenOpeningThePanel) { |
8972 if (!this.state.hadTagsWhenOpeningThePanel) { |
8458 return Object(external_wp_element_["createElement"])(TagsPanel, null); |
8973 return (0,external_wp_element_namespaceObject.createElement)(TagsPanel, null); |
8459 } |
8974 } |
8460 |
8975 |
8461 return null; |
8976 return null; |
8462 } |
8977 } |
8463 |
8978 |
8464 } |
8979 } |
8465 |
8980 |
8466 /* harmony default export */ var maybe_tags_panel = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => { |
8981 /* harmony default export */ var maybe_tags_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { |
8467 const postType = select('core/editor').getCurrentPostType(); |
8982 const postType = select(store_store).getCurrentPostType(); |
8468 const tagsTaxonomy = select('core').getTaxonomy('post_tag'); |
8983 const tagsTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('post_tag'); |
8469 const tags = tagsTaxonomy && select('core/editor').getEditedPostAttribute(tagsTaxonomy.rest_base); |
8984 const tags = tagsTaxonomy && select(store_store).getEditedPostAttribute(tagsTaxonomy.rest_base); |
8470 return { |
8985 return { |
8471 areTagsFetched: tagsTaxonomy !== undefined, |
8986 areTagsFetched: tagsTaxonomy !== undefined, |
8472 isPostTypeSupported: tagsTaxonomy && Object(external_lodash_["some"])(tagsTaxonomy.types, type => type === postType), |
8987 isPostTypeSupported: tagsTaxonomy && (0,external_lodash_namespaceObject.some)(tagsTaxonomy.types, type => type === postType), |
8473 hasTags: tags && tags.length |
8988 hasTags: tags && tags.length |
8474 }; |
8989 }; |
8475 }), Object(external_wp_compose_["ifCondition"])(({ |
8990 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref => { |
8476 areTagsFetched, |
8991 let { |
8477 isPostTypeSupported |
8992 areTagsFetched, |
8478 }) => isPostTypeSupported && areTagsFetched))(maybe_tags_panel_MaybeTagsPanel)); |
8993 isPostTypeSupported |
8479 |
8994 } = _ref; |
8480 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js |
8995 return isPostTypeSupported && areTagsFetched; |
8996 }))(MaybeTagsPanel)); |
|
8997 |
|
8998 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js |
|
8481 |
8999 |
8482 |
9000 |
8483 /** |
9001 /** |
8484 * External dependencies |
9002 * External dependencies |
8485 */ |
9003 */ |
8489 */ |
9007 */ |
8490 |
9008 |
8491 |
9009 |
8492 |
9010 |
8493 |
9011 |
9012 |
|
8494 /** |
9013 /** |
8495 * Internal dependencies |
9014 * Internal dependencies |
8496 */ |
9015 */ |
8497 |
9016 |
8498 |
9017 |
8499 |
9018 |
9019 |
|
8500 const getSuggestion = (supportedFormats, suggestedPostFormat) => { |
9020 const getSuggestion = (supportedFormats, suggestedPostFormat) => { |
8501 const formats = POST_FORMATS.filter(format => Object(external_lodash_["includes"])(supportedFormats, format.id)); |
9021 const formats = POST_FORMATS.filter(format => (0,external_lodash_namespaceObject.includes)(supportedFormats, format.id)); |
8502 return Object(external_lodash_["find"])(formats, format => format.id === suggestedPostFormat); |
9022 return (0,external_lodash_namespaceObject.find)(formats, format => format.id === suggestedPostFormat); |
8503 }; |
9023 }; |
8504 |
9024 |
8505 const PostFormatSuggestion = ({ |
9025 const PostFormatSuggestion = _ref => { |
8506 suggestedPostFormat, |
9026 let { |
8507 suggestionText, |
9027 suggestedPostFormat, |
8508 onUpdatePostFormat |
9028 suggestionText, |
8509 }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
9029 onUpdatePostFormat |
8510 isLink: true, |
9030 } = _ref; |
8511 onClick: () => onUpdatePostFormat(suggestedPostFormat) |
9031 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
8512 }, suggestionText); |
9032 variant: "link", |
9033 onClick: () => onUpdatePostFormat(suggestedPostFormat) |
|
9034 }, suggestionText); |
|
9035 }; |
|
8513 |
9036 |
8514 function PostFormatPanel() { |
9037 function PostFormatPanel() { |
8515 const { |
9038 const { |
8516 currentPostFormat, |
9039 currentPostFormat, |
8517 suggestion |
9040 suggestion |
8518 } = Object(external_wp_data_["useSelect"])(select => { |
9041 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
8519 const { |
9042 const { |
8520 getEditedPostAttribute, |
9043 getEditedPostAttribute, |
8521 getSuggestedPostFormat |
9044 getSuggestedPostFormat |
8522 } = select('core/editor'); |
9045 } = select(store_store); |
8523 const supportedFormats = Object(external_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []); |
9046 const supportedFormats = (0,external_lodash_namespaceObject.get)(select(external_wp_coreData_namespaceObject.store).getThemeSupports(), ['formats'], []); |
8524 return { |
9047 return { |
8525 currentPostFormat: getEditedPostAttribute('format'), |
9048 currentPostFormat: getEditedPostAttribute('format'), |
8526 suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat()) |
9049 suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat()) |
8527 }; |
9050 }; |
8528 }, []); |
9051 }, []); |
8529 const { |
9052 const { |
8530 editPost |
9053 editPost |
8531 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
9054 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
8532 |
9055 |
8533 const onUpdatePostFormat = format => editPost({ |
9056 const onUpdatePostFormat = format => editPost({ |
8534 format |
9057 format |
8535 }); |
9058 }); |
8536 |
9059 |
8537 const panelBodyTitle = [Object(external_wp_i18n_["__"])('Suggestion:'), Object(external_wp_element_["createElement"])("span", { |
9060 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", { |
8538 className: "editor-post-publish-panel__link", |
9061 className: "editor-post-publish-panel__link", |
8539 key: "label" |
9062 key: "label" |
8540 }, Object(external_wp_i18n_["__"])('Use a post format'))]; |
9063 }, (0,external_wp_i18n_namespaceObject.__)('Use a post format'))]; |
8541 |
9064 |
8542 if (!suggestion || suggestion.id === currentPostFormat) { |
9065 if (!suggestion || suggestion.id === currentPostFormat) { |
8543 return null; |
9066 return null; |
8544 } |
9067 } |
8545 |
9068 |
8546 return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { |
9069 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
8547 initialOpen: false, |
9070 initialOpen: false, |
8548 title: panelBodyTitle |
9071 title: panelBodyTitle |
8549 }, Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_element_["createElement"])(PostFormatSuggestion, { |
9072 }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(PostFormatSuggestion, { |
8550 onUpdatePostFormat: onUpdatePostFormat, |
9073 onUpdatePostFormat: onUpdatePostFormat, |
8551 suggestedPostFormat: suggestion.id, |
9074 suggestedPostFormat: suggestion.id, |
8552 suggestionText: Object(external_wp_i18n_["sprintf"])( |
9075 suggestionText: (0,external_wp_i18n_namespaceObject.sprintf)( |
8553 /* translators: %s: post format */ |
9076 /* translators: %s: post format */ |
8554 Object(external_wp_i18n_["__"])('Apply the "%1$s" format.'), suggestion.caption) |
9077 (0,external_wp_i18n_namespaceObject.__)('Apply the "%1$s" format.'), suggestion.caption) |
8555 }))); |
9078 }))); |
8556 } |
9079 } |
8557 |
9080 |
8558 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js |
9081 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js |
8559 |
9082 |
8560 |
9083 |
8561 /** |
9084 /** |
8562 * External dependencies |
9085 * External dependencies |
8563 */ |
9086 */ |
8569 |
9092 |
8570 |
9093 |
8571 |
9094 |
8572 |
9095 |
8573 |
9096 |
9097 |
|
9098 |
|
8574 /** |
9099 /** |
8575 * Internal dependencies |
9100 * Internal dependencies |
8576 */ |
9101 */ |
8577 |
9102 |
8578 |
9103 |
8579 |
9104 |
8580 |
9105 /** |
8581 |
9106 * Module Constants |
8582 |
9107 */ |
8583 |
9108 |
8584 |
9109 const hierarchical_term_selector_DEFAULT_QUERY = { |
8585 function PostPublishPanelPrepublish({ |
9110 per_page: -1, |
8586 children |
9111 orderby: 'name', |
8587 }) { |
9112 order: 'asc', |
9113 _fields: 'id,name,parent', |
|
9114 context: 'view' |
|
9115 }; |
|
9116 const MIN_TERMS_COUNT_FOR_FILTER = 8; |
|
9117 const hierarchical_term_selector_EMPTY_ARRAY = []; |
|
9118 /** |
|
9119 * Sort Terms by Selected. |
|
9120 * |
|
9121 * @param {Object[]} termsTree Array of terms in tree format. |
|
9122 * @param {number[]} terms Selected terms. |
|
9123 * |
|
9124 * @return {Object[]} Sorted array of terms. |
|
9125 */ |
|
9126 |
|
9127 function sortBySelected(termsTree, terms) { |
|
9128 const treeHasSelection = termTree => { |
|
9129 if (terms.indexOf(termTree.id) !== -1) { |
|
9130 return true; |
|
9131 } |
|
9132 |
|
9133 if (undefined === termTree.children) { |
|
9134 return false; |
|
9135 } |
|
9136 |
|
9137 return termTree.children.map(treeHasSelection).filter(child => child).length > 0; |
|
9138 }; |
|
9139 |
|
9140 const termOrChildIsSelected = (termA, termB) => { |
|
9141 const termASelected = treeHasSelection(termA); |
|
9142 const termBSelected = treeHasSelection(termB); |
|
9143 |
|
9144 if (termASelected === termBSelected) { |
|
9145 return 0; |
|
9146 } |
|
9147 |
|
9148 if (termASelected && !termBSelected) { |
|
9149 return -1; |
|
9150 } |
|
9151 |
|
9152 if (!termASelected && termBSelected) { |
|
9153 return 1; |
|
9154 } |
|
9155 |
|
9156 return 0; |
|
9157 }; |
|
9158 |
|
9159 const newTermTree = [...termsTree]; |
|
9160 newTermTree.sort(termOrChildIsSelected); |
|
9161 return newTermTree; |
|
9162 } |
|
9163 /** |
|
9164 * Find term by parent id or name. |
|
9165 * |
|
9166 * @param {Object[]} terms Array of Terms. |
|
9167 * @param {number|string} parent id. |
|
9168 * @param {string} name Term name. |
|
9169 * @return {Object} Term object. |
|
9170 */ |
|
9171 |
|
9172 function findTerm(terms, parent, name) { |
|
9173 return (0,external_lodash_namespaceObject.find)(terms, term => { |
|
9174 return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); |
|
9175 }); |
|
9176 } |
|
9177 /** |
|
9178 * Get filter matcher function. |
|
9179 * |
|
9180 * @param {string} filterValue Filter value. |
|
9181 * @return {(function(Object): (Object|boolean))} Matcher function. |
|
9182 */ |
|
9183 |
|
9184 function getFilterMatcher(filterValue) { |
|
9185 const matchTermsForFilter = originalTerm => { |
|
9186 if ('' === filterValue) { |
|
9187 return originalTerm; |
|
9188 } // Shallow clone, because we'll be filtering the term's children and |
|
9189 // don't want to modify the original term. |
|
9190 |
|
9191 |
|
9192 const term = { ...originalTerm |
|
9193 }; // Map and filter the children, recursive so we deal with grandchildren |
|
9194 // and any deeper levels. |
|
9195 |
|
9196 if (term.children.length > 0) { |
|
9197 term.children = term.children.map(matchTermsForFilter).filter(child => child); |
|
9198 } // If the term's name contains the filterValue, or it has children |
|
9199 // (i.e. some child matched at some point in the tree) then return it. |
|
9200 |
|
9201 |
|
9202 if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) { |
|
9203 return term; |
|
9204 } // Otherwise, return false. After mapping, the list of terms will need |
|
9205 // to have false values filtered out. |
|
9206 |
|
9207 |
|
9208 return false; |
|
9209 }; |
|
9210 |
|
9211 return matchTermsForFilter; |
|
9212 } |
|
9213 /** |
|
9214 * Hierarchical term selector. |
|
9215 * |
|
9216 * @param {Object} props Component props. |
|
9217 * @param {string} props.slug Taxonomy slug. |
|
9218 * @return {WPElement} Hierarchical term selector component. |
|
9219 */ |
|
9220 |
|
9221 function HierarchicalTermSelector(_ref) { |
|
9222 let { |
|
9223 slug |
|
9224 } = _ref; |
|
9225 const [adding, setAdding] = (0,external_wp_element_namespaceObject.useState)(false); |
|
9226 const [formName, setFormName] = (0,external_wp_element_namespaceObject.useState)(''); |
|
9227 /** |
|
9228 * @type {[number|'', Function]} |
|
9229 */ |
|
9230 |
|
9231 const [formParent, setFormParent] = (0,external_wp_element_namespaceObject.useState)(''); |
|
9232 const [showForm, setShowForm] = (0,external_wp_element_namespaceObject.useState)(false); |
|
9233 const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)(''); |
|
9234 const [filteredTermsTree, setFilteredTermsTree] = (0,external_wp_element_namespaceObject.useState)([]); |
|
9235 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); |
|
9236 const { |
|
9237 hasCreateAction, |
|
9238 hasAssignAction, |
|
9239 terms, |
|
9240 loading, |
|
9241 availableTerms, |
|
9242 taxonomy |
|
9243 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
9244 const { |
|
9245 getCurrentPost, |
|
9246 getEditedPostAttribute |
|
9247 } = select(store_store); |
|
9248 const { |
|
9249 getTaxonomy, |
|
9250 getEntityRecords, |
|
9251 isResolving |
|
9252 } = select(external_wp_coreData_namespaceObject.store); |
|
9253 |
|
9254 const _taxonomy = getTaxonomy(slug); |
|
9255 |
|
9256 return { |
|
9257 hasCreateAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-create-' + _taxonomy.rest_base], false) : false, |
|
9258 hasAssignAction: _taxonomy ? (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-assign-' + _taxonomy.rest_base], false) : false, |
|
9259 terms: _taxonomy ? getEditedPostAttribute(_taxonomy.rest_base) : hierarchical_term_selector_EMPTY_ARRAY, |
|
9260 loading: isResolving('getEntityRecords', ['taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY]), |
|
9261 availableTerms: getEntityRecords('taxonomy', slug, hierarchical_term_selector_DEFAULT_QUERY) || hierarchical_term_selector_EMPTY_ARRAY, |
|
9262 taxonomy: _taxonomy |
|
9263 }; |
|
9264 }, [slug]); |
|
9265 const { |
|
9266 editPost |
|
9267 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
9268 const { |
|
9269 saveEntityRecord |
|
9270 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
9271 const availableTermsTree = (0,external_wp_element_namespaceObject.useMemo)(() => sortBySelected(buildTermsTree(availableTerms), terms), // Remove `terms` from the dependency list to avoid reordering every time |
|
9272 // checking or unchecking a term. |
|
9273 [availableTerms]); |
|
9274 |
|
9275 if (!hasAssignAction) { |
|
9276 return null; |
|
9277 } |
|
9278 /** |
|
9279 * Append new term. |
|
9280 * |
|
9281 * @param {Object} term Term object. |
|
9282 * @return {Promise} A promise that resolves to save term object. |
|
9283 */ |
|
9284 |
|
9285 |
|
9286 const addTerm = term => { |
|
9287 return saveEntityRecord('taxonomy', slug, term); |
|
9288 }; |
|
9289 /** |
|
9290 * Update terms for post. |
|
9291 * |
|
9292 * @param {number[]} termIds Term ids. |
|
9293 */ |
|
9294 |
|
9295 |
|
9296 const onUpdateTerms = termIds => { |
|
9297 editPost({ |
|
9298 [taxonomy.rest_base]: termIds |
|
9299 }); |
|
9300 }; |
|
9301 /** |
|
9302 * Handler for checking term. |
|
9303 * |
|
9304 * @param {number} termId |
|
9305 */ |
|
9306 |
|
9307 |
|
9308 const onChange = termId => { |
|
9309 const hasTerm = terms.includes(termId); |
|
9310 const newTerms = hasTerm ? (0,external_lodash_namespaceObject.without)(terms, termId) : [...terms, termId]; |
|
9311 onUpdateTerms(newTerms); |
|
9312 }; |
|
9313 |
|
9314 const onChangeFormName = value => { |
|
9315 setFormName(value); |
|
9316 }; |
|
9317 /** |
|
9318 * Handler for changing form parent. |
|
9319 * |
|
9320 * @param {number|''} parentId Parent post id. |
|
9321 */ |
|
9322 |
|
9323 |
|
9324 const onChangeFormParent = parentId => { |
|
9325 setFormParent(parentId); |
|
9326 }; |
|
9327 |
|
9328 const onToggleForm = () => { |
|
9329 setShowForm(!showForm); |
|
9330 }; |
|
9331 |
|
9332 const onAddTerm = async event => { |
|
9333 event.preventDefault(); |
|
9334 |
|
9335 if (formName === '' || adding) { |
|
9336 return; |
|
9337 } // Check if the term we are adding already exists. |
|
9338 |
|
9339 |
|
9340 const existingTerm = findTerm(availableTerms, formParent, formName); |
|
9341 |
|
9342 if (existingTerm) { |
|
9343 // If the term we are adding exists but is not selected select it. |
|
9344 if (!(0,external_lodash_namespaceObject.some)(terms, term => term === existingTerm.id)) { |
|
9345 onUpdateTerms([...terms, existingTerm.id]); |
|
9346 } |
|
9347 |
|
9348 setFormName(''); |
|
9349 setFormParent(''); |
|
9350 return; |
|
9351 } |
|
9352 |
|
9353 setAdding(true); |
|
9354 const newTerm = await addTerm({ |
|
9355 name: formName, |
|
9356 parent: formParent ? formParent : undefined |
|
9357 }); |
|
9358 const termAddedMessage = (0,external_wp_i18n_namespaceObject.sprintf)( |
|
9359 /* translators: %s: taxonomy name */ |
|
9360 (0,external_wp_i18n_namespaceObject._x)('%s added', 'term'), (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'singular_name'], slug === 'category' ? (0,external_wp_i18n_namespaceObject.__)('Category') : (0,external_wp_i18n_namespaceObject.__)('Term'))); |
|
9361 (0,external_wp_a11y_namespaceObject.speak)(termAddedMessage, 'assertive'); |
|
9362 setAdding(false); |
|
9363 setFormName(''); |
|
9364 setFormParent(''); |
|
9365 onUpdateTerms([...terms, newTerm.id]); |
|
9366 }; |
|
9367 |
|
9368 const setFilter = value => { |
|
9369 const newFilteredTermsTree = availableTermsTree.map(getFilterMatcher(value)).filter(term => term); |
|
9370 |
|
9371 const getResultCount = termsTree => { |
|
9372 let count = 0; |
|
9373 |
|
9374 for (let i = 0; i < termsTree.length; i++) { |
|
9375 count++; |
|
9376 |
|
9377 if (undefined !== termsTree[i].children) { |
|
9378 count += getResultCount(termsTree[i].children); |
|
9379 } |
|
9380 } |
|
9381 |
|
9382 return count; |
|
9383 }; |
|
9384 |
|
9385 setFilterValue(value); |
|
9386 setFilteredTermsTree(newFilteredTermsTree); |
|
9387 const resultCount = getResultCount(newFilteredTermsTree); |
|
9388 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( |
|
9389 /* translators: %d: number of results */ |
|
9390 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', resultCount), resultCount); |
|
9391 debouncedSpeak(resultsFoundMessage, 'assertive'); |
|
9392 }; |
|
9393 |
|
9394 const renderTerms = renderedTerms => { |
|
9395 return renderedTerms.map(term => { |
|
9396 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
9397 key: term.id, |
|
9398 className: "editor-post-taxonomies__hierarchical-terms-choice" |
|
9399 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { |
|
9400 checked: terms.indexOf(term.id) !== -1, |
|
9401 onChange: () => { |
|
9402 const termId = parseInt(term.id, 10); |
|
9403 onChange(termId); |
|
9404 }, |
|
9405 label: (0,external_lodash_namespaceObject.unescape)(term.name) |
|
9406 }), !!term.children.length && (0,external_wp_element_namespaceObject.createElement)("div", { |
|
9407 className: "editor-post-taxonomies__hierarchical-terms-subchoices" |
|
9408 }, renderTerms(term.children))); |
|
9409 }); |
|
9410 }; |
|
9411 |
|
9412 const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory); |
|
9413 |
|
9414 const newTermButtonLabel = labelWithFallback('add_new_item', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); |
|
9415 const newTermLabel = labelWithFallback('new_item_name', (0,external_wp_i18n_namespaceObject.__)('Add new category'), (0,external_wp_i18n_namespaceObject.__)('Add new term')); |
|
9416 const parentSelectLabel = labelWithFallback('parent_item', (0,external_wp_i18n_namespaceObject.__)('Parent Category'), (0,external_wp_i18n_namespaceObject.__)('Parent Term')); |
|
9417 const noParentOption = `— ${parentSelectLabel} —`; |
|
9418 const newTermSubmitLabel = newTermButtonLabel; |
|
9419 const filterLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'search_items'], (0,external_wp_i18n_namespaceObject.__)('Search Terms')); |
|
9420 const groupLabel = (0,external_lodash_namespaceObject.get)(taxonomy, ['name'], (0,external_wp_i18n_namespaceObject.__)('Terms')); |
|
9421 const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; |
|
9422 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showFilter && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
9423 className: "editor-post-taxonomies__hierarchical-terms-filter", |
|
9424 label: filterLabel, |
|
9425 value: filterValue, |
|
9426 onChange: setFilter |
|
9427 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
|
9428 className: "editor-post-taxonomies__hierarchical-terms-list", |
|
9429 tabIndex: "0", |
|
9430 role: "group", |
|
9431 "aria-label": groupLabel |
|
9432 }, renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
9433 onClick: onToggleForm, |
|
9434 className: "editor-post-taxonomies__hierarchical-terms-add", |
|
9435 "aria-expanded": showForm, |
|
9436 variant: "link" |
|
9437 }, newTermButtonLabel), showForm && (0,external_wp_element_namespaceObject.createElement)("form", { |
|
9438 onSubmit: onAddTerm |
|
9439 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
9440 className: "editor-post-taxonomies__hierarchical-terms-input", |
|
9441 label: newTermLabel, |
|
9442 value: formName, |
|
9443 onChange: onChangeFormName, |
|
9444 required: true |
|
9445 }), !!availableTerms.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TreeSelect, { |
|
9446 label: parentSelectLabel, |
|
9447 noOptionLabel: noParentOption, |
|
9448 onChange: onChangeFormParent, |
|
9449 selectedId: formParent, |
|
9450 tree: availableTermsTree |
|
9451 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
9452 variant: "secondary", |
|
9453 type: "submit", |
|
9454 className: "editor-post-taxonomies__hierarchical-terms-submit" |
|
9455 }, newTermSubmitLabel))); |
|
9456 } |
|
9457 |
|
9458 /* harmony default export */ var hierarchical_term_selector = ((0,external_wp_components_namespaceObject.withFilters)('editor.PostTaxonomyType')(HierarchicalTermSelector)); |
|
9459 |
|
9460 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-category-panel.js |
|
9461 |
|
9462 |
|
9463 /** |
|
9464 * External dependencies |
|
9465 */ |
|
9466 |
|
9467 /** |
|
9468 * WordPress dependencies |
|
9469 */ |
|
9470 |
|
9471 |
|
9472 |
|
9473 |
|
9474 |
|
9475 |
|
9476 /** |
|
9477 * Internal dependencies |
|
9478 */ |
|
9479 |
|
9480 |
|
9481 |
|
9482 |
|
9483 function MaybeCategoryPanel() { |
|
9484 const hasNoCategory = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
9485 var _select$getEntityReco; |
|
9486 |
|
9487 const postType = select(store_store).getCurrentPostType(); |
|
9488 const categoriesTaxonomy = select(external_wp_coreData_namespaceObject.store).getTaxonomy('category'); |
|
9489 const defaultCategorySlug = 'uncategorized'; |
|
9490 const defaultCategory = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('taxonomy', 'category', { |
|
9491 slug: defaultCategorySlug |
|
9492 })) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco[0]; |
|
9493 const postTypeSupportsCategories = categoriesTaxonomy && (0,external_lodash_namespaceObject.some)(categoriesTaxonomy.types, type => type === postType); |
|
9494 const categories = categoriesTaxonomy && select(store_store).getEditedPostAttribute(categoriesTaxonomy.rest_base); // This boolean should return true if everything is loaded |
|
9495 // ( categoriesTaxonomy, defaultCategory ) |
|
9496 // and the post has not been assigned a category different than "uncategorized". |
|
9497 |
|
9498 return !!categoriesTaxonomy && !!defaultCategory && postTypeSupportsCategories && ((categories === null || categories === void 0 ? void 0 : categories.length) === 0 || (categories === null || categories === void 0 ? void 0 : categories.length) === 1 && defaultCategory.id === categories[0]); |
|
9499 }, []); |
|
9500 const [shouldShowPanel, setShouldShowPanel] = (0,external_wp_element_namespaceObject.useState)(false); |
|
9501 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
9502 // We use state to avoid hiding the panel if the user edits the categories |
|
9503 // and adds one within the panel itself (while visible). |
|
9504 if (hasNoCategory) { |
|
9505 setShouldShowPanel(true); |
|
9506 } |
|
9507 }, [hasNoCategory]); |
|
9508 |
|
9509 if (!shouldShowPanel) { |
|
9510 return null; |
|
9511 } |
|
9512 |
|
9513 const panelBodyTitle = [(0,external_wp_i18n_namespaceObject.__)('Suggestion:'), (0,external_wp_element_namespaceObject.createElement)("span", { |
|
9514 className: "editor-post-publish-panel__link", |
|
9515 key: "label" |
|
9516 }, (0,external_wp_i18n_namespaceObject.__)('Assign a category'))]; |
|
9517 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
|
9518 initialOpen: false, |
|
9519 title: panelBodyTitle |
|
9520 }, (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Categories provide a helpful way to group related posts together and to quickly tell readers what a post is about.')), (0,external_wp_element_namespaceObject.createElement)(hierarchical_term_selector, { |
|
9521 slug: "category" |
|
9522 })); |
|
9523 } |
|
9524 |
|
9525 /* harmony default export */ var maybe_category_panel = (MaybeCategoryPanel); |
|
9526 |
|
9527 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js |
|
9528 |
|
9529 |
|
9530 /** |
|
9531 * External dependencies |
|
9532 */ |
|
9533 |
|
9534 /** |
|
9535 * WordPress dependencies |
|
9536 */ |
|
9537 |
|
9538 |
|
9539 |
|
9540 |
|
9541 |
|
9542 |
|
9543 |
|
9544 |
|
9545 /** |
|
9546 * Internal dependencies |
|
9547 */ |
|
9548 |
|
9549 |
|
9550 |
|
9551 |
|
9552 |
|
9553 |
|
9554 |
|
9555 |
|
9556 |
|
9557 |
|
9558 function PostPublishPanelPrepublish(_ref) { |
|
9559 let { |
|
9560 children |
|
9561 } = _ref; |
|
8588 const { |
9562 const { |
8589 isBeingScheduled, |
9563 isBeingScheduled, |
8590 isRequestingSiteIcon, |
9564 isRequestingSiteIcon, |
8591 hasPublishAction, |
9565 hasPublishAction, |
8592 siteIconUrl, |
9566 siteIconUrl, |
8593 siteTitle, |
9567 siteTitle, |
8594 siteHome |
9568 siteHome |
8595 } = Object(external_wp_data_["useSelect"])(select => { |
9569 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
8596 const { |
|
8597 isResolving |
|
8598 } = select('core/data'); |
|
8599 const { |
9570 const { |
8600 getCurrentPost, |
9571 getCurrentPost, |
8601 isEditedPostBeingScheduled |
9572 isEditedPostBeingScheduled |
8602 } = select('core/editor'); |
9573 } = select(store_store); |
8603 const { |
9574 const { |
8604 getEntityRecord |
9575 getEntityRecord, |
8605 } = select('core'); |
9576 isResolving |
9577 } = select(external_wp_coreData_namespaceObject.store); |
|
8606 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; |
9578 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; |
8607 return { |
9579 return { |
8608 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
9580 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
8609 isBeingScheduled: isEditedPostBeingScheduled(), |
9581 isBeingScheduled: isEditedPostBeingScheduled(), |
8610 isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]), |
9582 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), |
8611 siteIconUrl: siteData.site_icon_url, |
9583 siteIconUrl: siteData.site_icon_url, |
8612 siteTitle: siteData.name, |
9584 siteTitle: siteData.name, |
8613 siteHome: siteData.home && Object(external_wp_url_["filterURLForDisplay"])(siteData.home) |
9585 siteHome: siteData.home && (0,external_wp_url_namespaceObject.filterURLForDisplay)(siteData.home) |
8614 }; |
9586 }; |
8615 }, []); |
9587 }, []); |
8616 let siteIcon = Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], { |
9588 let siteIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { |
8617 className: "components-site-icon", |
9589 className: "components-site-icon", |
8618 size: "36px", |
9590 size: "36px", |
8619 icon: wordpress["a" /* default */] |
9591 icon: library_wordpress |
8620 }); |
9592 }); |
8621 |
9593 |
8622 if (siteIconUrl) { |
9594 if (siteIconUrl) { |
8623 siteIcon = Object(external_wp_element_["createElement"])("img", { |
9595 siteIcon = (0,external_wp_element_namespaceObject.createElement)("img", { |
8624 alt: Object(external_wp_i18n_["__"])('Site Icon'), |
9596 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), |
8625 className: "components-site-icon", |
9597 className: "components-site-icon", |
8626 src: siteIconUrl |
9598 src: siteIconUrl |
8627 }); |
9599 }); |
8628 } |
9600 } |
8629 |
9601 |
8632 } |
9604 } |
8633 |
9605 |
8634 let prePublishTitle, prePublishBodyText; |
9606 let prePublishTitle, prePublishBodyText; |
8635 |
9607 |
8636 if (!hasPublishAction) { |
9608 if (!hasPublishAction) { |
8637 prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to submit for review?'); |
9609 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to submit for review?'); |
8638 prePublishBodyText = Object(external_wp_i18n_["__"])('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'); |
9610 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.'); |
8639 } else if (isBeingScheduled) { |
9611 } else if (isBeingScheduled) { |
8640 prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to schedule?'); |
9612 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to schedule?'); |
8641 prePublishBodyText = Object(external_wp_i18n_["__"])('Your work will be published at the specified date and time.'); |
9613 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Your work will be published at the specified date and time.'); |
8642 } else { |
9614 } else { |
8643 prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to publish?'); |
9615 prePublishTitle = (0,external_wp_i18n_namespaceObject.__)('Are you ready to publish?'); |
8644 prePublishBodyText = Object(external_wp_i18n_["__"])('Double-check your settings before publishing.'); |
9616 prePublishBodyText = (0,external_wp_i18n_namespaceObject.__)('Double-check your settings before publishing.'); |
8645 } |
9617 } |
8646 |
9618 |
8647 return Object(external_wp_element_["createElement"])("div", { |
9619 return (0,external_wp_element_namespaceObject.createElement)("div", { |
8648 className: "editor-post-publish-panel__prepublish" |
9620 className: "editor-post-publish-panel__prepublish" |
8649 }, Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("strong", null, prePublishTitle)), Object(external_wp_element_["createElement"])("p", null, prePublishBodyText), Object(external_wp_element_["createElement"])("div", { |
9621 }, (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)("strong", null, prePublishTitle)), (0,external_wp_element_namespaceObject.createElement)("p", null, prePublishBodyText), (0,external_wp_element_namespaceObject.createElement)("div", { |
8650 className: "components-site-card" |
9622 className: "components-site-card" |
8651 }, siteIcon, Object(external_wp_element_["createElement"])("div", { |
9623 }, siteIcon, (0,external_wp_element_namespaceObject.createElement)("div", { |
8652 className: "components-site-info" |
9624 className: "components-site-info" |
8653 }, Object(external_wp_element_["createElement"])("span", { |
9625 }, (0,external_wp_element_namespaceObject.createElement)("span", { |
8654 className: "components-site-name" |
9626 className: "components-site-name" |
8655 }, siteTitle || Object(external_wp_i18n_["__"])('(Untitled)')), Object(external_wp_element_["createElement"])("span", { |
9627 }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(siteTitle) || (0,external_wp_i18n_namespaceObject.__)('(Untitled)')), (0,external_wp_element_namespaceObject.createElement)("span", { |
8656 className: "components-site-home" |
9628 className: "components-site-home" |
8657 }, siteHome))), hasPublishAction && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { |
9629 }, siteHome))), hasPublishAction && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
8658 initialOpen: false, |
9630 initialOpen: false, |
8659 title: [Object(external_wp_i18n_["__"])('Visibility:'), Object(external_wp_element_["createElement"])("span", { |
9631 title: [(0,external_wp_i18n_namespaceObject.__)('Visibility:'), (0,external_wp_element_namespaceObject.createElement)("span", { |
8660 className: "editor-post-publish-panel__link", |
9632 className: "editor-post-publish-panel__link", |
8661 key: "label" |
9633 key: "label" |
8662 }, Object(external_wp_element_["createElement"])(post_visibility_label, null))] |
9634 }, (0,external_wp_element_namespaceObject.createElement)(post_visibility_label, null))] |
8663 }, Object(external_wp_element_["createElement"])(post_visibility, null)), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { |
9635 }, (0,external_wp_element_namespaceObject.createElement)(post_visibility, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
8664 initialOpen: false, |
9636 initialOpen: false, |
8665 title: [Object(external_wp_i18n_["__"])('Publish:'), Object(external_wp_element_["createElement"])("span", { |
9637 title: [(0,external_wp_i18n_namespaceObject.__)('Publish:'), (0,external_wp_element_namespaceObject.createElement)("span", { |
8666 className: "editor-post-publish-panel__link", |
9638 className: "editor-post-publish-panel__link", |
8667 key: "label" |
9639 key: "label" |
8668 }, Object(external_wp_element_["createElement"])(post_schedule_label, null))] |
9640 }, (0,external_wp_element_namespaceObject.createElement)(post_schedule_label, null))] |
8669 }, Object(external_wp_element_["createElement"])(PostSchedule, null))), Object(external_wp_element_["createElement"])(PostFormatPanel, null), Object(external_wp_element_["createElement"])(maybe_tags_panel, null), children); |
9641 }, (0,external_wp_element_namespaceObject.createElement)(PostSchedule, null))), (0,external_wp_element_namespaceObject.createElement)(PostFormatPanel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_tags_panel, null), (0,external_wp_element_namespaceObject.createElement)(maybe_category_panel, null), children); |
8670 } |
9642 } |
8671 |
9643 |
8672 /* harmony default export */ var prepublish = (PostPublishPanelPrepublish); |
9644 /* harmony default export */ var prepublish = (PostPublishPanelPrepublish); |
8673 |
9645 |
8674 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js |
9646 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js |
8675 |
9647 |
8676 |
9648 |
8677 /** |
9649 /** |
8678 * External dependencies |
9650 * External dependencies |
8679 */ |
9651 */ |
8687 |
9659 |
8688 |
9660 |
8689 |
9661 |
8690 |
9662 |
8691 |
9663 |
9664 |
|
8692 /** |
9665 /** |
8693 * Internal dependencies |
9666 * Internal dependencies |
8694 */ |
9667 */ |
8695 |
9668 |
8696 |
9669 |
9670 |
|
8697 const POSTNAME = '%postname%'; |
9671 const POSTNAME = '%postname%'; |
8698 /** |
9672 /** |
8699 * Returns URL for a future post. |
9673 * Returns URL for a future post. |
8700 * |
9674 * |
8701 * @param {Object} post Post object. |
9675 * @param {Object} post Post object. |
8702 * |
9676 * |
8703 * @return {string} PostPublish URL. |
9677 * @return {string} PostPublish URL. |
8704 */ |
9678 */ |
8705 |
9679 |
8706 const getFuturePostUrl = post => { |
9680 const getFuturePostUrl = post => { |
8713 } |
9687 } |
8714 |
9688 |
8715 return post.permalink_template; |
9689 return post.permalink_template; |
8716 }; |
9690 }; |
8717 |
9691 |
8718 function postpublish_CopyButton({ |
9692 function postpublish_CopyButton(_ref) { |
8719 text, |
9693 let { |
8720 onCopy, |
9694 text, |
8721 children |
9695 onCopy, |
8722 }) { |
9696 children |
8723 const ref = Object(external_wp_compose_["useCopyToClipboard"])(text, onCopy); |
9697 } = _ref; |
8724 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
9698 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, onCopy); |
8725 isSecondary: true, |
9699 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
9700 variant: "secondary", |
|
8726 ref: ref |
9701 ref: ref |
8727 }, children); |
9702 }, children); |
8728 } |
9703 } |
8729 |
9704 |
8730 class postpublish_PostPublishPanelPostpublish extends external_wp_element_["Component"] { |
9705 class PostPublishPanelPostpublish extends external_wp_element_namespaceObject.Component { |
8731 constructor() { |
9706 constructor() { |
8732 super(...arguments); |
9707 super(...arguments); |
8733 this.state = { |
9708 this.state = { |
8734 showCopyConfirmation: false |
9709 showCopyConfirmation: false |
8735 }; |
9710 }; |
8736 this.onCopy = this.onCopy.bind(this); |
9711 this.onCopy = this.onCopy.bind(this); |
8737 this.onSelectInput = this.onSelectInput.bind(this); |
9712 this.onSelectInput = this.onSelectInput.bind(this); |
8738 this.postLink = Object(external_wp_element_["createRef"])(); |
9713 this.postLink = (0,external_wp_element_namespaceObject.createRef)(); |
8739 } |
9714 } |
8740 |
9715 |
8741 componentDidMount() { |
9716 componentDidMount() { |
8742 if (this.props.focusOnMount) { |
9717 if (this.props.focusOnMount) { |
8743 this.postLink.current.focus(); |
9718 this.postLink.current.focus(); |
8769 children, |
9744 children, |
8770 isScheduled, |
9745 isScheduled, |
8771 post, |
9746 post, |
8772 postType |
9747 postType |
8773 } = this.props; |
9748 } = this.props; |
8774 const postLabel = Object(external_lodash_["get"])(postType, ['labels', 'singular_name']); |
9749 const postLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'singular_name']); |
8775 const viewPostLabel = Object(external_lodash_["get"])(postType, ['labels', 'view_item']); |
9750 const viewPostLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_item']); |
9751 const addNewPostLabel = (0,external_lodash_namespaceObject.get)(postType, ['labels', 'add_new_item']); |
|
8776 const link = post.status === 'future' ? getFuturePostUrl(post) : post.link; |
9752 const link = post.status === 'future' ? getFuturePostUrl(post) : post.link; |
8777 const postPublishNonLinkHeader = isScheduled ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["__"])('is now scheduled. It will go live on'), ' ', Object(external_wp_element_["createElement"])(post_schedule_label, null), ".") : Object(external_wp_i18n_["__"])('is now live.'); |
9753 const addLink = (0,external_wp_url_namespaceObject.addQueryArgs)('post-new.php', { |
8778 return Object(external_wp_element_["createElement"])("div", { |
9754 post_type: post.type |
9755 }); |
|
9756 const postPublishNonLinkHeader = isScheduled ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('is now scheduled. It will go live on'), ' ', (0,external_wp_element_namespaceObject.createElement)(post_schedule_label, null), ".") : (0,external_wp_i18n_namespaceObject.__)('is now live.'); |
|
9757 return (0,external_wp_element_namespaceObject.createElement)("div", { |
|
8779 className: "post-publish-panel__postpublish" |
9758 className: "post-publish-panel__postpublish" |
8780 }, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { |
9759 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { |
8781 className: "post-publish-panel__postpublish-header" |
9760 className: "post-publish-panel__postpublish-header" |
8782 }, Object(external_wp_element_["createElement"])("a", { |
9761 }, (0,external_wp_element_namespaceObject.createElement)("a", { |
8783 ref: this.postLink, |
9762 ref: this.postLink, |
8784 href: link |
9763 href: link |
8785 }, Object(external_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_wp_i18n_["__"])('(no title)')), ' ', postPublishNonLinkHeader), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], null, Object(external_wp_element_["createElement"])("p", { |
9764 }, (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(post.title) || (0,external_wp_i18n_namespaceObject.__)('(no title)')), ' ', postPublishNonLinkHeader), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)("p", { |
8786 className: "post-publish-panel__postpublish-subheader" |
9765 className: "post-publish-panel__postpublish-subheader" |
8787 }, Object(external_wp_element_["createElement"])("strong", null, Object(external_wp_i18n_["__"])('What’s next?'))), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { |
9766 }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_i18n_namespaceObject.__)('What’s next?'))), (0,external_wp_element_namespaceObject.createElement)("div", { |
9767 className: "post-publish-panel__postpublish-post-address-container" |
|
9768 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
8788 className: "post-publish-panel__postpublish-post-address", |
9769 className: "post-publish-panel__postpublish-post-address", |
8789 readOnly: true, |
9770 readOnly: true, |
8790 label: Object(external_wp_i18n_["sprintf"])( |
9771 label: (0,external_wp_i18n_namespaceObject.sprintf)( |
8791 /* translators: %s: post type singular name */ |
9772 /* translators: %s: post type singular name */ |
8792 Object(external_wp_i18n_["__"])('%s address'), postLabel), |
9773 (0,external_wp_i18n_namespaceObject.__)('%s address'), postLabel), |
8793 value: Object(external_wp_url_["safeDecodeURIComponent"])(link), |
9774 value: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(link), |
8794 onFocus: this.onSelectInput |
9775 onFocus: this.onSelectInput |
8795 }), Object(external_wp_element_["createElement"])("div", { |
9776 }), (0,external_wp_element_namespaceObject.createElement)("div", { |
8796 className: "post-publish-panel__postpublish-buttons" |
9777 className: "post-publish-panel__postpublish-post-address__copy-button-wrap" |
8797 }, !isScheduled && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
9778 }, (0,external_wp_element_namespaceObject.createElement)(postpublish_CopyButton, { |
8798 isSecondary: true, |
|
8799 href: link |
|
8800 }, viewPostLabel), Object(external_wp_element_["createElement"])(postpublish_CopyButton, { |
|
8801 text: link, |
9779 text: link, |
8802 onCopy: this.onCopy |
9780 onCopy: this.onCopy |
8803 }, this.state.showCopyConfirmation ? Object(external_wp_i18n_["__"])('Copied!') : Object(external_wp_i18n_["__"])('Copy Link')))), children); |
9781 }, this.state.showCopyConfirmation ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy')))), (0,external_wp_element_namespaceObject.createElement)("div", { |
8804 } |
9782 className: "post-publish-panel__postpublish-buttons" |
8805 |
9783 }, !isScheduled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
8806 } |
9784 variant: "primary", |
8807 |
9785 href: link |
8808 /* harmony default export */ var postpublish = (Object(external_wp_data_["withSelect"])(select => { |
9786 }, viewPostLabel), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
9787 variant: isScheduled ? 'primary' : 'secondary', |
|
9788 href: addLink |
|
9789 }, addNewPostLabel))), children); |
|
9790 } |
|
9791 |
|
9792 } |
|
9793 |
|
9794 /* harmony default export */ var postpublish = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
|
8809 const { |
9795 const { |
8810 getEditedPostAttribute, |
9796 getEditedPostAttribute, |
8811 getCurrentPost, |
9797 getCurrentPost, |
8812 isCurrentPostScheduled |
9798 isCurrentPostScheduled |
8813 } = select('core/editor'); |
9799 } = select(store_store); |
8814 const { |
9800 const { |
8815 getPostType |
9801 getPostType |
8816 } = select('core'); |
9802 } = select(external_wp_coreData_namespaceObject.store); |
8817 return { |
9803 return { |
8818 post: getCurrentPost(), |
9804 post: getCurrentPost(), |
8819 postType: getPostType(getEditedPostAttribute('type')), |
9805 postType: getPostType(getEditedPostAttribute('type')), |
8820 isScheduled: isCurrentPostScheduled() |
9806 isScheduled: isCurrentPostScheduled() |
8821 }; |
9807 }; |
8822 })(postpublish_PostPublishPanelPostpublish)); |
9808 })(PostPublishPanelPostpublish)); |
8823 |
9809 |
8824 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js |
9810 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js |
8825 |
9811 |
8826 |
9812 |
8827 |
9813 |
8828 /** |
9814 /** |
8829 * External dependencies |
9815 * External dependencies |
8837 |
9823 |
8838 |
9824 |
8839 |
9825 |
8840 |
9826 |
8841 |
9827 |
9828 |
|
8842 /** |
9829 /** |
8843 * Internal dependencies |
9830 * Internal dependencies |
8844 */ |
9831 */ |
8845 |
9832 |
8846 |
9833 |
8847 |
9834 |
8848 |
9835 |
8849 class post_publish_panel_PostPublishPanel extends external_wp_element_["Component"] { |
9836 |
9837 class PostPublishPanel extends external_wp_element_namespaceObject.Component { |
|
8850 constructor() { |
9838 constructor() { |
8851 super(...arguments); |
9839 super(...arguments); |
8852 this.onSubmit = this.onSubmit.bind(this); |
9840 this.onSubmit = this.onSubmit.bind(this); |
8853 } |
9841 } |
8854 |
9842 |
8879 isBeingScheduled, |
9867 isBeingScheduled, |
8880 isPublished, |
9868 isPublished, |
8881 isPublishSidebarEnabled, |
9869 isPublishSidebarEnabled, |
8882 isScheduled, |
9870 isScheduled, |
8883 isSaving, |
9871 isSaving, |
9872 isSavingNonPostEntityChanges, |
|
8884 onClose, |
9873 onClose, |
8885 onTogglePublishSidebar, |
9874 onTogglePublishSidebar, |
8886 PostPublishExtension, |
9875 PostPublishExtension, |
8887 PrePublishExtension, |
9876 PrePublishExtension, |
8888 ...additionalProps |
9877 ...additionalProps |
8889 } = this.props; |
9878 } = this.props; |
8890 const propsForPanel = Object(external_lodash_["omit"])(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']); |
9879 const propsForPanel = (0,external_lodash_namespaceObject.omit)(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']); |
8891 const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; |
9880 const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled; |
8892 const isPrePublish = !isPublishedOrScheduled && !isSaving; |
9881 const isPrePublish = !isPublishedOrScheduled && !isSaving; |
8893 const isPostPublish = isPublishedOrScheduled && !isSaving; |
9882 const isPostPublish = isPublishedOrScheduled && !isSaving; |
8894 return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ |
9883 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({ |
8895 className: "editor-post-publish-panel" |
9884 className: "editor-post-publish-panel" |
8896 }, propsForPanel), Object(external_wp_element_["createElement"])("div", { |
9885 }, propsForPanel), (0,external_wp_element_namespaceObject.createElement)("div", { |
8897 className: "editor-post-publish-panel__header" |
9886 className: "editor-post-publish-panel__header" |
8898 }, isPostPublish ? Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
9887 }, isPostPublish ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
8899 onClick: onClose, |
9888 onClick: onClose, |
8900 icon: close_small["a" /* default */], |
9889 icon: close_small, |
8901 label: Object(external_wp_i18n_["__"])('Close panel') |
9890 label: (0,external_wp_i18n_namespaceObject.__)('Close panel') |
8902 }) : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { |
9891 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
8903 className: "editor-post-publish-panel__header-publish-button" |
9892 className: "editor-post-publish-panel__header-publish-button" |
8904 }, Object(external_wp_element_["createElement"])(post_publish_button, { |
9893 }, (0,external_wp_element_namespaceObject.createElement)(post_publish_button, { |
8905 focusOnMount: true, |
9894 focusOnMount: true, |
8906 onSubmit: this.onSubmit, |
9895 onSubmit: this.onSubmit, |
8907 forceIsDirty: forceIsDirty, |
9896 forceIsDirty: forceIsDirty, |
8908 forceIsSaving: forceIsSaving |
9897 forceIsSaving: forceIsSaving |
8909 })), Object(external_wp_element_["createElement"])("div", { |
9898 })), (0,external_wp_element_namespaceObject.createElement)("div", { |
8910 className: "editor-post-publish-panel__header-cancel-button" |
9899 className: "editor-post-publish-panel__header-cancel-button" |
8911 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
9900 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
9901 disabled: isSavingNonPostEntityChanges, |
|
8912 onClick: onClose, |
9902 onClick: onClose, |
8913 isSecondary: true |
9903 variant: "secondary" |
8914 }, Object(external_wp_i18n_["__"])('Cancel'))))), Object(external_wp_element_["createElement"])("div", { |
9904 }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))))), (0,external_wp_element_namespaceObject.createElement)("div", { |
8915 className: "editor-post-publish-panel__content" |
9905 className: "editor-post-publish-panel__content" |
8916 }, isPrePublish && Object(external_wp_element_["createElement"])(prepublish, null, PrePublishExtension && Object(external_wp_element_["createElement"])(PrePublishExtension, null)), isPostPublish && Object(external_wp_element_["createElement"])(postpublish, { |
9906 }, isPrePublish && (0,external_wp_element_namespaceObject.createElement)(prepublish, null, PrePublishExtension && (0,external_wp_element_namespaceObject.createElement)(PrePublishExtension, null)), isPostPublish && (0,external_wp_element_namespaceObject.createElement)(postpublish, { |
8917 focusOnMount: true |
9907 focusOnMount: true |
8918 }, PostPublishExtension && Object(external_wp_element_["createElement"])(PostPublishExtension, null)), isSaving && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)), Object(external_wp_element_["createElement"])("div", { |
9908 }, PostPublishExtension && (0,external_wp_element_namespaceObject.createElement)(PostPublishExtension, null)), isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), (0,external_wp_element_namespaceObject.createElement)("div", { |
8919 className: "editor-post-publish-panel__footer" |
9909 className: "editor-post-publish-panel__footer" |
8920 }, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { |
9910 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { |
8921 label: Object(external_wp_i18n_["__"])('Always show pre-publish checks.'), |
9911 label: (0,external_wp_i18n_namespaceObject.__)('Always show pre-publish checks.'), |
8922 checked: isPublishSidebarEnabled, |
9912 checked: isPublishSidebarEnabled, |
8923 onChange: onTogglePublishSidebar |
9913 onChange: onTogglePublishSidebar |
8924 }))); |
9914 }))); |
8925 } |
9915 } |
8926 |
9916 |
8927 } |
9917 } |
8928 /* harmony default export */ var post_publish_panel = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
9918 /* harmony default export */ var post_publish_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
8929 const { |
9919 const { |
8930 getPostType |
9920 getPostType |
8931 } = select('core'); |
9921 } = select(external_wp_coreData_namespaceObject.store); |
8932 const { |
9922 const { |
8933 getCurrentPost, |
9923 getCurrentPost, |
8934 getEditedPostAttribute, |
9924 getEditedPostAttribute, |
8935 isCurrentPostPublished, |
9925 isCurrentPostPublished, |
8936 isCurrentPostScheduled, |
9926 isCurrentPostScheduled, |
8937 isEditedPostBeingScheduled, |
9927 isEditedPostBeingScheduled, |
8938 isEditedPostDirty, |
9928 isEditedPostDirty, |
8939 isSavingPost |
9929 isSavingPost, |
8940 } = select('core/editor'); |
9930 isSavingNonPostEntityChanges |
9931 } = select(store_store); |
|
8941 const { |
9932 const { |
8942 isPublishSidebarEnabled |
9933 isPublishSidebarEnabled |
8943 } = select('core/editor'); |
9934 } = select(store_store); |
8944 const postType = getPostType(getEditedPostAttribute('type')); |
9935 const postType = getPostType(getEditedPostAttribute('type')); |
8945 return { |
9936 return { |
8946 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
9937 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
8947 isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false), |
9938 isPostTypeViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false), |
8948 isBeingScheduled: isEditedPostBeingScheduled(), |
9939 isBeingScheduled: isEditedPostBeingScheduled(), |
8949 isDirty: isEditedPostDirty(), |
9940 isDirty: isEditedPostDirty(), |
8950 isPublished: isCurrentPostPublished(), |
9941 isPublished: isCurrentPostPublished(), |
8951 isPublishSidebarEnabled: isPublishSidebarEnabled(), |
9942 isPublishSidebarEnabled: isPublishSidebarEnabled(), |
8952 isSaving: isSavingPost(), |
9943 isSaving: isSavingPost(), |
9944 isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(), |
|
8953 isScheduled: isCurrentPostScheduled() |
9945 isScheduled: isCurrentPostScheduled() |
8954 }; |
9946 }; |
8955 }), Object(external_wp_data_["withDispatch"])((dispatch, { |
9947 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref) => { |
8956 isPublishSidebarEnabled |
9948 let { |
8957 }) => { |
9949 isPublishSidebarEnabled |
9950 } = _ref; |
|
8958 const { |
9951 const { |
8959 disablePublishSidebar, |
9952 disablePublishSidebar, |
8960 enablePublishSidebar |
9953 enablePublishSidebar |
8961 } = dispatch('core/editor'); |
9954 } = dispatch(store_store); |
8962 return { |
9955 return { |
8963 onTogglePublishSidebar: () => { |
9956 onTogglePublishSidebar: () => { |
8964 if (isPublishSidebarEnabled) { |
9957 if (isPublishSidebarEnabled) { |
8965 disablePublishSidebar(); |
9958 disablePublishSidebar(); |
8966 } else { |
9959 } else { |
8967 enablePublishSidebar(); |
9960 enablePublishSidebar(); |
8968 } |
9961 } |
8969 } |
9962 } |
8970 }; |
9963 }; |
8971 }), external_wp_components_["withFocusReturn"], external_wp_components_["withConstrainedTabbing"]])(post_publish_panel_PostPublishPanel)); |
9964 }), external_wp_components_namespaceObject.withFocusReturn, external_wp_components_namespaceObject.withConstrainedTabbing])(PostPublishPanel)); |
8972 |
9965 |
8973 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js |
9966 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js |
8974 var build_module_icon = __webpack_require__("iClF"); |
|
8975 |
|
8976 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js |
|
8977 |
9967 |
8978 |
9968 |
8979 /** |
9969 /** |
8980 * WordPress dependencies |
9970 * WordPress dependencies |
8981 */ |
9971 */ |
8982 |
9972 |
8983 const cloud = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { |
9973 const cloudUpload = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
8984 xmlns: "http://www.w3.org/2000/svg", |
9974 xmlns: "http://www.w3.org/2000/svg", |
8985 viewBox: "0 0 24 24" |
9975 viewBox: "0 0 24 24" |
8986 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { |
9976 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
9977 d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z" |
|
9978 })); |
|
9979 /* harmony default export */ var cloud_upload = (cloudUpload); |
|
9980 |
|
9981 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js |
|
9982 /** |
|
9983 * WordPress dependencies |
|
9984 */ |
|
9985 |
|
9986 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ |
|
9987 |
|
9988 /** |
|
9989 * Return an SVG icon. |
|
9990 * |
|
9991 * @param {IconProps} props icon is the SVG component to render |
|
9992 * size is a number specifiying the icon size in pixels |
|
9993 * Other props will be passed to wrapped SVG component |
|
9994 * |
|
9995 * @return {JSX.Element} Icon component |
|
9996 */ |
|
9997 |
|
9998 function Icon(_ref) { |
|
9999 let { |
|
10000 icon, |
|
10001 size = 24, |
|
10002 ...props |
|
10003 } = _ref; |
|
10004 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { |
|
10005 width: size, |
|
10006 height: size, |
|
10007 ...props |
|
10008 }); |
|
10009 } |
|
10010 |
|
10011 /* harmony default export */ var icon = (Icon); |
|
10012 |
|
10013 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js |
|
10014 |
|
10015 |
|
10016 /** |
|
10017 * WordPress dependencies |
|
10018 */ |
|
10019 |
|
10020 const check_check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
10021 xmlns: "http://www.w3.org/2000/svg", |
|
10022 viewBox: "0 0 24 24" |
|
10023 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
10024 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" |
|
10025 })); |
|
10026 /* harmony default export */ var library_check = (check_check); |
|
10027 |
|
10028 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js |
|
10029 |
|
10030 |
|
10031 /** |
|
10032 * WordPress dependencies |
|
10033 */ |
|
10034 |
|
10035 const cloud = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
|
10036 xmlns: "http://www.w3.org/2000/svg", |
|
10037 viewBox: "0 0 24 24" |
|
10038 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
8987 d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z" |
10039 d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z" |
8988 })); |
10040 })); |
8989 /* harmony default export */ var library_cloud = (cloud); |
10041 /* harmony default export */ var library_cloud = (cloud); |
8990 |
10042 |
8991 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js |
10043 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js |
8992 var library_check = __webpack_require__("RMJe"); |
|
8993 |
|
8994 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js |
|
8995 |
10044 |
8996 |
10045 |
8997 /** |
10046 /** |
8998 * WordPress dependencies |
10047 * WordPress dependencies |
8999 */ |
10048 */ |
9000 |
10049 |
9001 const cloudUpload = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { |
10050 |
9002 xmlns: "http://www.w3.org/2000/svg", |
10051 |
9003 viewBox: "0 0 24 24" |
10052 |
9004 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { |
10053 |
9005 d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z" |
10054 /** |
9006 })); |
10055 * Internal dependencies |
9007 /* harmony default export */ var cloud_upload = (cloudUpload); |
10056 */ |
9008 |
10057 |
9009 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js |
10058 |
9010 |
10059 |
9011 |
10060 function PostSwitchToDraftButton(_ref) { |
9012 /** |
10061 let { |
9013 * WordPress dependencies |
10062 isSaving, |
9014 */ |
10063 isPublished, |
9015 |
10064 isScheduled, |
9016 |
10065 onClick |
9017 |
10066 } = _ref; |
9018 |
10067 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small', '<'); |
9019 |
10068 const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false); |
9020 function PostSwitchToDraftButton({ |
|
9021 isSaving, |
|
9022 isPublished, |
|
9023 isScheduled, |
|
9024 onClick |
|
9025 }) { |
|
9026 const isMobileViewport = Object(external_wp_compose_["useViewportMatch"])('small', '<'); |
|
9027 |
10069 |
9028 if (!isPublished && !isScheduled) { |
10070 if (!isPublished && !isScheduled) { |
9029 return null; |
10071 return null; |
9030 } |
10072 } |
9031 |
10073 |
9032 const onSwitch = () => { |
10074 let alertMessage; |
9033 let alertMessage; |
10075 |
9034 |
10076 if (isPublished) { |
9035 if (isPublished) { |
10077 alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unpublish this post?'); |
9036 alertMessage = Object(external_wp_i18n_["__"])('Are you sure you want to unpublish this post?'); |
10078 } else if (isScheduled) { |
9037 } else if (isScheduled) { |
10079 alertMessage = (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to unschedule this post?'); |
9038 alertMessage = Object(external_wp_i18n_["__"])('Are you sure you want to unschedule this post?'); |
10080 } |
9039 } // eslint-disable-next-line no-alert |
10081 |
9040 |
10082 const handleConfirm = () => { |
9041 |
10083 setShowConfirmDialog(false); |
9042 if (window.confirm(alertMessage)) { |
10084 onClick(); |
9043 onClick(); |
|
9044 } |
|
9045 }; |
10085 }; |
9046 |
10086 |
9047 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
10087 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
9048 className: "editor-post-switch-to-draft", |
10088 className: "editor-post-switch-to-draft", |
9049 onClick: onSwitch, |
10089 onClick: () => { |
10090 setShowConfirmDialog(true); |
|
10091 }, |
|
9050 disabled: isSaving, |
10092 disabled: isSaving, |
9051 isTertiary: true |
10093 variant: "tertiary" |
9052 }, isMobileViewport ? Object(external_wp_i18n_["__"])('Draft') : Object(external_wp_i18n_["__"])('Switch to draft')); |
10094 }, isMobileViewport ? (0,external_wp_i18n_namespaceObject.__)('Draft') : (0,external_wp_i18n_namespaceObject.__)('Switch to draft')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, { |
9053 } |
10095 isOpen: showConfirmDialog, |
9054 |
10096 onConfirm: handleConfirm, |
9055 /* harmony default export */ var post_switch_to_draft_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
10097 onCancel: () => setShowConfirmDialog(false) |
10098 }, alertMessage)); |
|
10099 } |
|
10100 |
|
10101 /* harmony default export */ var post_switch_to_draft_button = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
|
9056 const { |
10102 const { |
9057 isSavingPost, |
10103 isSavingPost, |
9058 isCurrentPostPublished, |
10104 isCurrentPostPublished, |
9059 isCurrentPostScheduled |
10105 isCurrentPostScheduled |
9060 } = select('core/editor'); |
10106 } = select(store_store); |
9061 return { |
10107 return { |
9062 isSaving: isSavingPost(), |
10108 isSaving: isSavingPost(), |
9063 isPublished: isCurrentPostPublished(), |
10109 isPublished: isCurrentPostPublished(), |
9064 isScheduled: isCurrentPostScheduled() |
10110 isScheduled: isCurrentPostScheduled() |
9065 }; |
10111 }; |
9066 }), Object(external_wp_data_["withDispatch"])(dispatch => { |
10112 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
9067 const { |
10113 const { |
9068 editPost, |
10114 editPost, |
9069 savePost |
10115 savePost |
9070 } = dispatch('core/editor'); |
10116 } = dispatch(store_store); |
9071 return { |
10117 return { |
9072 onClick: () => { |
10118 onClick: () => { |
9073 editPost({ |
10119 editPost({ |
9074 status: 'draft' |
10120 status: 'draft' |
9075 }); |
10121 }); |
9076 savePost(); |
10122 savePost(); |
9077 } |
10123 } |
9078 }; |
10124 }; |
9079 })])(PostSwitchToDraftButton)); |
10125 })])(PostSwitchToDraftButton)); |
9080 |
10126 |
9081 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js |
10127 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js |
9082 |
10128 |
9083 |
10129 |
9084 /** |
10130 /** |
9085 * External dependencies |
10131 * External dependencies |
9086 */ |
10132 */ |
9097 |
10143 |
9098 |
10144 |
9099 /** |
10145 /** |
9100 * Internal dependencies |
10146 * Internal dependencies |
9101 */ |
10147 */ |
10148 |
|
9102 |
10149 |
9103 |
10150 |
9104 /** |
10151 /** |
9105 * Component showing whether the post is saved or not and providing save |
10152 * Component showing whether the post is saved or not and providing save |
9106 * buttons. |
10153 * buttons. |
9107 * |
10154 * |
9108 * @param {Object} props Component props. |
10155 * @param {Object} props Component props. |
9109 * @param {?boolean} props.forceIsDirty Whether to force the post to be marked |
10156 * @param {?boolean} props.forceIsDirty Whether to force the post to be marked |
9110 * as dirty. |
10157 * as dirty. |
9111 * @param {?boolean} props.forceIsSaving Whether to force the post to be marked |
10158 * @param {?boolean} props.forceIsSaving Whether to force the post to be marked |
9112 * as being saved. |
10159 * as being saved. |
9113 * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons |
10160 * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons |
9114 * @return {import('@wordpress/element').WPComponent} The component. |
10161 * @return {import('@wordpress/element').WPComponent} The component. |
9115 */ |
10162 */ |
9116 |
10163 |
9117 function PostSavedState({ |
10164 function PostSavedState(_ref) { |
9118 forceIsDirty, |
10165 let { |
9119 forceIsSaving, |
10166 forceIsDirty, |
9120 showIconLabels = false |
10167 forceIsSaving, |
9121 }) { |
10168 showIconLabels = false |
9122 const [forceSavedMessage, setForceSavedMessage] = Object(external_wp_element_["useState"])(false); |
10169 } = _ref; |
9123 const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('small'); |
10170 const [forceSavedMessage, setForceSavedMessage] = (0,external_wp_element_namespaceObject.useState)(false); |
10171 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); |
|
9124 const { |
10172 const { |
9125 isAutosaving, |
10173 isAutosaving, |
9126 isDirty, |
10174 isDirty, |
9127 isNew, |
10175 isNew, |
9128 isPending, |
10176 isPending, |
9129 isPublished, |
10177 isPublished, |
9130 isSaveable, |
10178 isSaveable, |
9131 isSaving, |
10179 isSaving, |
9132 isScheduled, |
10180 isScheduled, |
9133 hasPublishAction |
10181 hasPublishAction |
9134 } = Object(external_wp_data_["useSelect"])(select => { |
10182 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
9135 var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2; |
10183 var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2; |
9136 |
10184 |
9137 const { |
10185 const { |
9138 isEditedPostNew, |
10186 isEditedPostNew, |
9139 isCurrentPostPublished, |
10187 isCurrentPostPublished, |
9142 isSavingPost, |
10190 isSavingPost, |
9143 isEditedPostSaveable, |
10191 isEditedPostSaveable, |
9144 getCurrentPost, |
10192 getCurrentPost, |
9145 isAutosavingPost, |
10193 isAutosavingPost, |
9146 getEditedPostAttribute |
10194 getEditedPostAttribute |
9147 } = select('core/editor'); |
10195 } = select(store_store); |
9148 return { |
10196 return { |
9149 isAutosaving: isAutosavingPost(), |
10197 isAutosaving: isAutosavingPost(), |
9150 isDirty: forceIsDirty || isEditedPostDirty(), |
10198 isDirty: forceIsDirty || isEditedPostDirty(), |
9151 isNew: isEditedPostNew(), |
10199 isNew: isEditedPostNew(), |
9152 isPending: 'pending' === getEditedPostAttribute('status'), |
10200 isPending: 'pending' === getEditedPostAttribute('status'), |
9157 hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost = getCurrentPost()) === null || _getCurrentPost === void 0 ? void 0 : (_getCurrentPost$_link2 = _getCurrentPost._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false |
10205 hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost = getCurrentPost()) === null || _getCurrentPost === void 0 ? void 0 : (_getCurrentPost$_link2 = _getCurrentPost._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false |
9158 }; |
10206 }; |
9159 }, [forceIsDirty, forceIsSaving]); |
10207 }, [forceIsDirty, forceIsSaving]); |
9160 const { |
10208 const { |
9161 savePost |
10209 savePost |
9162 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
10210 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
9163 const wasSaving = Object(external_wp_compose_["usePrevious"])(isSaving); |
10211 const wasSaving = (0,external_wp_compose_namespaceObject.usePrevious)(isSaving); |
9164 Object(external_wp_element_["useEffect"])(() => { |
10212 (0,external_wp_element_namespaceObject.useEffect)(() => { |
9165 let timeoutId; |
10213 let timeoutId; |
9166 |
10214 |
9167 if (wasSaving && !isSaving) { |
10215 if (wasSaving && !isSaving) { |
9168 setForceSavedMessage(true); |
10216 setForceSavedMessage(true); |
9169 timeoutId = setTimeout(() => { |
10217 timeoutId = setTimeout(() => { |
9170 setForceSavedMessage(false); |
10218 setForceSavedMessage(false); |
9171 }, 1000); |
10219 }, 1000); |
9172 } |
10220 } |
9173 |
10221 |
9174 return () => clearTimeout(timeoutId); |
10222 return () => clearTimeout(timeoutId); |
9175 }, [isSaving]); |
10223 }, [isSaving]); // Once the post has been submitted for review this button |
9176 |
|
9177 if (isSaving) { |
|
9178 // TODO: Classes generation should be common across all return |
|
9179 // paths of this function, including proper naming convention for |
|
9180 // the "Save Draft" button. |
|
9181 const classes = classnames_default()('editor-post-saved-state', 'is-saving', Object(external_wp_components_["__unstableGetAnimateClassName"])({ |
|
9182 type: 'loading' |
|
9183 }), { |
|
9184 'is-autosaving': isAutosaving |
|
9185 }); |
|
9186 return Object(external_wp_element_["createElement"])("span", { |
|
9187 className: classes |
|
9188 }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { |
|
9189 icon: library_cloud |
|
9190 }), isAutosaving ? Object(external_wp_i18n_["__"])('Autosaving') : Object(external_wp_i18n_["__"])('Saving')); |
|
9191 } |
|
9192 |
|
9193 if (isPublished || isScheduled) { |
|
9194 return Object(external_wp_element_["createElement"])(post_switch_to_draft_button, null); |
|
9195 } |
|
9196 |
|
9197 if (!isSaveable) { |
|
9198 return null; |
|
9199 } |
|
9200 |
|
9201 if (forceSavedMessage || !isNew && !isDirty) { |
|
9202 return Object(external_wp_element_["createElement"])("span", { |
|
9203 className: "editor-post-saved-state is-saved" |
|
9204 }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], { |
|
9205 icon: library_check["a" /* default */] |
|
9206 }), Object(external_wp_i18n_["__"])('Saved')); |
|
9207 } // Once the post has been submitted for review this button |
|
9208 // is not needed for the contributor role. |
10224 // is not needed for the contributor role. |
9209 |
|
9210 |
10225 |
9211 if (!hasPublishAction && isPending) { |
10226 if (!hasPublishAction && isPending) { |
9212 return null; |
10227 return null; |
9213 } |
10228 } |
10229 |
|
10230 if (isPublished || isScheduled) { |
|
10231 return (0,external_wp_element_namespaceObject.createElement)(post_switch_to_draft_button, null); |
|
10232 } |
|
9214 /* translators: button label text should, if possible, be under 16 characters. */ |
10233 /* translators: button label text should, if possible, be under 16 characters. */ |
9215 |
10234 |
9216 |
10235 |
9217 const label = isPending ? Object(external_wp_i18n_["__"])('Save as pending') : Object(external_wp_i18n_["__"])('Save draft'); |
10236 const label = isPending ? (0,external_wp_i18n_namespaceObject.__)('Save as pending') : (0,external_wp_i18n_namespaceObject.__)('Save draft'); |
9218 /* translators: button label text should, if possible, be under 16 characters. */ |
10237 /* translators: button label text should, if possible, be under 16 characters. */ |
9219 |
10238 |
9220 const shortLabel = Object(external_wp_i18n_["__"])('Save'); |
10239 const shortLabel = (0,external_wp_i18n_namespaceObject.__)('Save'); |
9221 |
10240 |
9222 if (!isLargeViewport) { |
10241 const isSaved = forceSavedMessage || !isNew && !isDirty; |
9223 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
10242 const isSavedState = isSaving || isSaved; |
9224 className: "editor-post-save-draft", |
10243 const isDisabled = isSaving || isSaved || !isSaveable; |
9225 label: label, |
10244 let text; |
9226 onClick: () => savePost(), |
10245 |
9227 shortcut: external_wp_keycodes_["displayShortcut"].primary('s'), |
10246 if (isSaving) { |
9228 icon: cloud_upload |
10247 text = isAutosaving ? (0,external_wp_i18n_namespaceObject.__)('Autosaving') : (0,external_wp_i18n_namespaceObject.__)('Saving'); |
9229 }, showIconLabels && shortLabel); |
10248 } else if (isSaved) { |
9230 } |
10249 text = (0,external_wp_i18n_namespaceObject.__)('Saved'); |
9231 |
10250 } else if (isLargeViewport) { |
9232 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
10251 text = label; |
9233 className: "editor-post-save-draft", |
10252 } else if (showIconLabels) { |
9234 onClick: () => savePost(), |
10253 text = shortLabel; |
9235 shortcut: external_wp_keycodes_["displayShortcut"].primary('s'), |
10254 } // Use common Button instance for all saved states so that focus is not |
9236 isTertiary: true |
10255 // lost. |
9237 }, label); |
10256 |
9238 } |
10257 |
9239 |
10258 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
9240 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js |
10259 className: isSaveable || isSaving ? classnames_default()({ |
10260 'editor-post-save-draft': !isSavedState, |
|
10261 'editor-post-saved-state': isSavedState, |
|
10262 'is-saving': isSaving, |
|
10263 'is-autosaving': isAutosaving, |
|
10264 'is-saved': isSaved, |
|
10265 [(0,external_wp_components_namespaceObject.__unstableGetAnimateClassName)({ |
|
10266 type: 'loading' |
|
10267 })]: isSaving |
|
10268 }) : undefined, |
|
10269 onClick: isDisabled ? undefined : () => savePost(), |
|
10270 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primary('s'), |
|
10271 variant: isLargeViewport ? 'tertiary' : undefined, |
|
10272 icon: isLargeViewport ? undefined : cloud_upload, |
|
10273 label: showIconLabels ? undefined : label, |
|
10274 "aria-disabled": isDisabled |
|
10275 }, isSavedState && (0,external_wp_element_namespaceObject.createElement)(icon, { |
|
10276 icon: isSaved ? library_check : library_cloud |
|
10277 }), text); |
|
10278 } |
|
10279 |
|
10280 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js |
|
9241 /** |
10281 /** |
9242 * External dependencies |
10282 * External dependencies |
9243 */ |
10283 */ |
9244 |
10284 |
9245 /** |
10285 /** |
9246 * WordPress dependencies |
10286 * WordPress dependencies |
9247 */ |
10287 */ |
9248 |
10288 |
9249 |
10289 |
9250 |
10290 |
9251 function PostScheduleCheck({ |
10291 /** |
9252 hasPublishAction, |
10292 * Internal dependencies |
9253 children |
10293 */ |
9254 }) { |
10294 |
10295 |
|
10296 function PostScheduleCheck(_ref) { |
|
10297 let { |
|
10298 hasPublishAction, |
|
10299 children |
|
10300 } = _ref; |
|
10301 |
|
9255 if (!hasPublishAction) { |
10302 if (!hasPublishAction) { |
9256 return null; |
10303 return null; |
9257 } |
10304 } |
9258 |
10305 |
9259 return children; |
10306 return children; |
9260 } |
10307 } |
9261 /* harmony default export */ var post_schedule_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
10308 /* harmony default export */ var post_schedule_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
9262 const { |
10309 const { |
9263 getCurrentPost, |
10310 getCurrentPost, |
9264 getCurrentPostType |
10311 getCurrentPostType |
9265 } = select('core/editor'); |
10312 } = select(store_store); |
9266 return { |
10313 return { |
9267 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
10314 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
9268 postType: getCurrentPostType() |
10315 postType: getCurrentPostType() |
9269 }; |
10316 }; |
9270 })])(PostScheduleCheck)); |
10317 })])(PostScheduleCheck)); |
9271 |
10318 |
9272 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js |
10319 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js |
9273 |
10320 |
9274 |
10321 |
9275 /** |
10322 /** |
9276 * Internal dependencies |
10323 * Internal dependencies |
9277 */ |
10324 */ |
9278 |
10325 |
9279 function PostSlugCheck({ |
10326 function PostSlugCheck(_ref) { |
9280 children |
10327 let { |
9281 }) { |
10328 children |
9282 return Object(external_wp_element_["createElement"])(post_type_support_check, { |
10329 } = _ref; |
10330 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { |
|
9283 supportKeys: "slug" |
10331 supportKeys: "slug" |
9284 }, children); |
10332 }, children); |
9285 } |
10333 } |
9286 |
10334 |
9287 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js |
10335 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js |
9288 |
10336 |
9289 |
10337 |
9290 /** |
10338 /** |
9291 * WordPress dependencies |
10339 * WordPress dependencies |
9292 */ |
10340 */ |
9299 * Internal dependencies |
10347 * Internal dependencies |
9300 */ |
10348 */ |
9301 |
10349 |
9302 |
10350 |
9303 |
10351 |
9304 class post_slug_PostSlug extends external_wp_element_["Component"] { |
10352 class PostSlug extends external_wp_element_namespaceObject.Component { |
9305 constructor({ |
10353 constructor(_ref) { |
9306 postSlug, |
10354 let { |
9307 postTitle, |
10355 postSlug, |
9308 postID |
10356 postTitle, |
9309 }) { |
10357 postID |
10358 } = _ref; |
|
9310 super(...arguments); |
10359 super(...arguments); |
9311 this.state = { |
10360 this.state = { |
9312 editedSlug: Object(external_wp_url_["safeDecodeURIComponent"])(postSlug) || cleanForSlug(postTitle) || postID |
10361 editedSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(postSlug) || (0,external_wp_url_namespaceObject.cleanForSlug)(postTitle) || postID |
9313 }; |
10362 }; |
9314 this.setSlug = this.setSlug.bind(this); |
10363 this.setSlug = this.setSlug.bind(this); |
9315 } |
10364 } |
9316 |
10365 |
9317 setSlug(event) { |
10366 setSlug(event) { |
9320 onUpdateSlug |
10369 onUpdateSlug |
9321 } = this.props; |
10370 } = this.props; |
9322 const { |
10371 const { |
9323 value |
10372 value |
9324 } = event.target; |
10373 } = event.target; |
9325 const editedSlug = cleanForSlug(value); |
10374 const editedSlug = (0,external_wp_url_namespaceObject.cleanForSlug)(value); |
9326 |
10375 |
9327 if (editedSlug === postSlug) { |
10376 if (editedSlug === postSlug) { |
9328 return; |
10377 return; |
9329 } |
10378 } |
9330 |
10379 |
9337 } = this.props; |
10386 } = this.props; |
9338 const { |
10387 const { |
9339 editedSlug |
10388 editedSlug |
9340 } = this.state; |
10389 } = this.state; |
9341 const inputId = 'editor-post-slug-' + instanceId; |
10390 const inputId = 'editor-post-slug-' + instanceId; |
9342 return Object(external_wp_element_["createElement"])(PostSlugCheck, null, Object(external_wp_element_["createElement"])("label", { |
10391 return (0,external_wp_element_namespaceObject.createElement)(PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)("label", { |
9343 htmlFor: inputId |
10392 htmlFor: inputId |
9344 }, Object(external_wp_i18n_["__"])('Slug')), Object(external_wp_element_["createElement"])("input", { |
10393 }, (0,external_wp_i18n_namespaceObject.__)('Slug')), (0,external_wp_element_namespaceObject.createElement)("input", { |
10394 autoComplete: "off", |
|
10395 spellCheck: "false", |
|
9345 type: "text", |
10396 type: "text", |
9346 id: inputId, |
10397 id: inputId, |
9347 value: editedSlug, |
10398 value: editedSlug, |
9348 onChange: event => this.setState({ |
10399 onChange: event => this.setState({ |
9349 editedSlug: event.target.value |
10400 editedSlug: event.target.value |
9352 className: "editor-post-slug__input" |
10403 className: "editor-post-slug__input" |
9353 })); |
10404 })); |
9354 } |
10405 } |
9355 |
10406 |
9356 } |
10407 } |
9357 /* harmony default export */ var post_slug = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
10408 /* harmony default export */ var post_slug = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
9358 const { |
10409 const { |
9359 getCurrentPost, |
10410 getCurrentPost, |
9360 getEditedPostAttribute |
10411 getEditedPostAttribute |
9361 } = select('core/editor'); |
10412 } = select(store_store); |
9362 const { |
10413 const { |
9363 id |
10414 id |
9364 } = getCurrentPost(); |
10415 } = getCurrentPost(); |
9365 return { |
10416 return { |
9366 postSlug: getEditedPostAttribute('slug'), |
10417 postSlug: getEditedPostAttribute('slug'), |
9367 postTitle: getEditedPostAttribute('title'), |
10418 postTitle: getEditedPostAttribute('title'), |
9368 postID: id |
10419 postID: id |
9369 }; |
10420 }; |
9370 }), Object(external_wp_data_["withDispatch"])(dispatch => { |
10421 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
9371 const { |
10422 const { |
9372 editPost |
10423 editPost |
9373 } = dispatch('core/editor'); |
10424 } = dispatch(store_store); |
9374 return { |
10425 return { |
9375 onUpdateSlug(slug) { |
10426 onUpdateSlug(slug) { |
9376 editPost({ |
10427 editPost({ |
9377 slug |
10428 slug |
9378 }); |
10429 }); |
9379 } |
10430 } |
9380 |
10431 |
9381 }; |
10432 }; |
9382 }), external_wp_compose_["withInstanceId"]])(post_slug_PostSlug)); |
10433 }), external_wp_compose_namespaceObject.withInstanceId])(PostSlug)); |
9383 |
10434 |
9384 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js |
10435 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js |
9385 /** |
10436 /** |
9386 * External dependencies |
10437 * External dependencies |
9387 */ |
10438 */ |
9388 |
10439 |
9389 /** |
10440 /** |
9390 * WordPress dependencies |
10441 * WordPress dependencies |
9391 */ |
10442 */ |
9392 |
10443 |
9393 |
10444 |
9394 |
10445 |
9395 function PostStickyCheck({ |
10446 /** |
9396 hasStickyAction, |
10447 * Internal dependencies |
9397 postType, |
10448 */ |
9398 children |
10449 |
9399 }) { |
10450 |
10451 function PostStickyCheck(_ref) { |
|
10452 let { |
|
10453 hasStickyAction, |
|
10454 postType, |
|
10455 children |
|
10456 } = _ref; |
|
10457 |
|
9400 if (postType !== 'post' || !hasStickyAction) { |
10458 if (postType !== 'post' || !hasStickyAction) { |
9401 return null; |
10459 return null; |
9402 } |
10460 } |
9403 |
10461 |
9404 return children; |
10462 return children; |
9405 } |
10463 } |
9406 /* harmony default export */ var post_sticky_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
10464 /* harmony default export */ var post_sticky_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
9407 const post = select('core/editor').getCurrentPost(); |
10465 const post = select(store_store).getCurrentPost(); |
9408 return { |
10466 return { |
9409 hasStickyAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-sticky'], false), |
10467 hasStickyAction: (0,external_lodash_namespaceObject.get)(post, ['_links', 'wp:action-sticky'], false), |
9410 postType: select('core/editor').getCurrentPostType() |
10468 postType: select(store_store).getCurrentPostType() |
9411 }; |
10469 }; |
9412 })])(PostStickyCheck)); |
10470 })])(PostStickyCheck)); |
9413 |
10471 |
9414 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js |
10472 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js |
9415 |
10473 |
9416 |
10474 |
9417 /** |
10475 /** |
9418 * WordPress dependencies |
10476 * WordPress dependencies |
9419 */ |
10477 */ |
9424 /** |
10482 /** |
9425 * Internal dependencies |
10483 * Internal dependencies |
9426 */ |
10484 */ |
9427 |
10485 |
9428 |
10486 |
9429 function PostSticky({ |
10487 |
9430 onUpdateSticky, |
10488 function PostSticky(_ref) { |
9431 postSticky = false |
10489 let { |
9432 }) { |
10490 onUpdateSticky, |
9433 return Object(external_wp_element_["createElement"])(post_sticky_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { |
10491 postSticky = false |
9434 label: Object(external_wp_i18n_["__"])('Stick to the top of the blog'), |
10492 } = _ref; |
10493 return (0,external_wp_element_namespaceObject.createElement)(post_sticky_check, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { |
|
10494 label: (0,external_wp_i18n_namespaceObject.__)('Stick to the top of the blog'), |
|
9435 checked: postSticky, |
10495 checked: postSticky, |
9436 onChange: () => onUpdateSticky(!postSticky) |
10496 onChange: () => onUpdateSticky(!postSticky) |
9437 })); |
10497 })); |
9438 } |
10498 } |
9439 /* harmony default export */ var post_sticky = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
10499 /* harmony default export */ var post_sticky = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
9440 return { |
10500 return { |
9441 postSticky: select('core/editor').getEditedPostAttribute('sticky') |
10501 postSticky: select(store_store).getEditedPostAttribute('sticky') |
9442 }; |
10502 }; |
9443 }), Object(external_wp_data_["withDispatch"])(dispatch => { |
10503 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { |
9444 return { |
10504 return { |
9445 onUpdateSticky(postSticky) { |
10505 onUpdateSticky(postSticky) { |
9446 dispatch('core/editor').editPost({ |
10506 dispatch(store_store).editPost({ |
9447 sticky: postSticky |
10507 sticky: postSticky |
9448 }); |
10508 }); |
9449 } |
10509 } |
9450 |
10510 |
9451 }; |
10511 }; |
9452 })])(PostSticky)); |
10512 })])(PostSticky)); |
9453 |
10513 |
9454 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js |
10514 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js |
9455 |
10515 |
9456 |
10516 |
9457 /** |
10517 /** |
9458 * External dependencies |
10518 * External dependencies |
9459 */ |
10519 */ |
9464 |
10524 |
9465 |
10525 |
9466 |
10526 |
9467 |
10527 |
9468 |
10528 |
9469 |
|
9470 |
|
9471 |
|
9472 /** |
10529 /** |
9473 * Internal dependencies |
10530 * Internal dependencies |
9474 */ |
10531 */ |
9475 |
10532 |
9476 |
10533 |
9477 /** |
10534 |
9478 * Module Constants |
10535 |
9479 */ |
10536 function PostTaxonomies(_ref) { |
9480 |
10537 let { |
9481 const hierarchical_term_selector_DEFAULT_QUERY = { |
10538 postType, |
9482 per_page: -1, |
10539 taxonomies, |
9483 orderby: 'name', |
10540 taxonomyWrapper = external_lodash_namespaceObject.identity |
9484 order: 'asc', |
10541 } = _ref; |
9485 _fields: 'id,name,parent' |
10542 const availableTaxonomies = (0,external_lodash_namespaceObject.filter)(taxonomies, taxonomy => (0,external_lodash_namespaceObject.includes)(taxonomy.types, postType)); |
9486 }; |
10543 const visibleTaxonomies = (0,external_lodash_namespaceObject.filter)(availableTaxonomies, // In some circumstances .visibility can end up as undefined so optional chaining operator required. |
9487 const MIN_TERMS_COUNT_FOR_FILTER = 8; |
10544 // https://github.com/WordPress/gutenberg/issues/40326 |
9488 |
10545 taxonomy => { |
9489 class hierarchical_term_selector_HierarchicalTermSelector extends external_wp_element_["Component"] { |
10546 var _taxonomy$visibility; |
9490 constructor() { |
10547 |
9491 super(...arguments); |
10548 return (_taxonomy$visibility = taxonomy.visibility) === null || _taxonomy$visibility === void 0 ? void 0 : _taxonomy$visibility.show_ui; |
9492 this.findTerm = this.findTerm.bind(this); |
10549 }); |
9493 this.onChange = this.onChange.bind(this); |
|
9494 this.onChangeFormName = this.onChangeFormName.bind(this); |
|
9495 this.onChangeFormParent = this.onChangeFormParent.bind(this); |
|
9496 this.onAddTerm = this.onAddTerm.bind(this); |
|
9497 this.onToggleForm = this.onToggleForm.bind(this); |
|
9498 this.setFilterValue = this.setFilterValue.bind(this); |
|
9499 this.sortBySelected = this.sortBySelected.bind(this); |
|
9500 this.state = { |
|
9501 loading: true, |
|
9502 availableTermsTree: [], |
|
9503 availableTerms: [], |
|
9504 adding: false, |
|
9505 formName: '', |
|
9506 formParent: '', |
|
9507 showForm: false, |
|
9508 filterValue: '', |
|
9509 filteredTermsTree: [] |
|
9510 }; |
|
9511 } |
|
9512 |
|
9513 onChange(termId) { |
|
9514 const { |
|
9515 onUpdateTerms, |
|
9516 terms = [], |
|
9517 taxonomy |
|
9518 } = this.props; |
|
9519 const hasTerm = terms.indexOf(termId) !== -1; |
|
9520 const newTerms = hasTerm ? Object(external_lodash_["without"])(terms, termId) : [...terms, termId]; |
|
9521 onUpdateTerms(newTerms, taxonomy.rest_base); |
|
9522 } |
|
9523 |
|
9524 onChangeFormName(event) { |
|
9525 const newValue = event.target.value.trim() === '' ? '' : event.target.value; |
|
9526 this.setState({ |
|
9527 formName: newValue |
|
9528 }); |
|
9529 } |
|
9530 |
|
9531 onChangeFormParent(newParent) { |
|
9532 this.setState({ |
|
9533 formParent: newParent |
|
9534 }); |
|
9535 } |
|
9536 |
|
9537 onToggleForm() { |
|
9538 this.setState(state => ({ |
|
9539 showForm: !state.showForm |
|
9540 })); |
|
9541 } |
|
9542 |
|
9543 findTerm(terms, parent, name) { |
|
9544 return Object(external_lodash_["find"])(terms, term => { |
|
9545 return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase(); |
|
9546 }); |
|
9547 } |
|
9548 |
|
9549 onAddTerm(event) { |
|
9550 event.preventDefault(); |
|
9551 const { |
|
9552 onUpdateTerms, |
|
9553 taxonomy, |
|
9554 terms, |
|
9555 slug |
|
9556 } = this.props; |
|
9557 const { |
|
9558 formName, |
|
9559 formParent, |
|
9560 adding, |
|
9561 availableTerms |
|
9562 } = this.state; |
|
9563 |
|
9564 if (formName === '' || adding) { |
|
9565 return; |
|
9566 } // check if the term we are adding already exists |
|
9567 |
|
9568 |
|
9569 const existingTerm = this.findTerm(availableTerms, formParent, formName); |
|
9570 |
|
9571 if (existingTerm) { |
|
9572 // if the term we are adding exists but is not selected select it |
|
9573 if (!Object(external_lodash_["some"])(terms, term => term === existingTerm.id)) { |
|
9574 onUpdateTerms([...terms, existingTerm.id], taxonomy.rest_base); |
|
9575 } |
|
9576 |
|
9577 this.setState({ |
|
9578 formName: '', |
|
9579 formParent: '' |
|
9580 }); |
|
9581 return; |
|
9582 } |
|
9583 |
|
9584 this.setState({ |
|
9585 adding: true |
|
9586 }); |
|
9587 this.addRequest = external_wp_apiFetch_default()({ |
|
9588 path: `/wp/v2/${taxonomy.rest_base}`, |
|
9589 method: 'POST', |
|
9590 data: { |
|
9591 name: formName, |
|
9592 parent: formParent ? formParent : undefined |
|
9593 } |
|
9594 }); // Tries to create a term or fetch it if it already exists |
|
9595 |
|
9596 const findOrCreatePromise = this.addRequest.catch(error => { |
|
9597 const errorCode = error.code; |
|
9598 |
|
9599 if (errorCode === 'term_exists') { |
|
9600 // search the new category created since last fetch |
|
9601 this.addRequest = external_wp_apiFetch_default()({ |
|
9602 path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, { ...hierarchical_term_selector_DEFAULT_QUERY, |
|
9603 parent: formParent || 0, |
|
9604 search: formName |
|
9605 }) |
|
9606 }); |
|
9607 return this.addRequest.then(searchResult => { |
|
9608 return this.findTerm(searchResult, formParent, formName); |
|
9609 }); |
|
9610 } |
|
9611 |
|
9612 return Promise.reject(error); |
|
9613 }); |
|
9614 findOrCreatePromise.then(term => { |
|
9615 const hasTerm = !!Object(external_lodash_["find"])(this.state.availableTerms, availableTerm => availableTerm.id === term.id); |
|
9616 const newAvailableTerms = hasTerm ? this.state.availableTerms : [term, ...this.state.availableTerms]; |
|
9617 const termAddedMessage = Object(external_wp_i18n_["sprintf"])( |
|
9618 /* translators: %s: taxonomy name */ |
|
9619 Object(external_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'singular_name'], slug === 'category' ? Object(external_wp_i18n_["__"])('Category') : Object(external_wp_i18n_["__"])('Term'))); |
|
9620 this.props.speak(termAddedMessage, 'assertive'); |
|
9621 this.addRequest = null; |
|
9622 this.setState({ |
|
9623 adding: false, |
|
9624 formName: '', |
|
9625 formParent: '', |
|
9626 availableTerms: newAvailableTerms, |
|
9627 availableTermsTree: this.sortBySelected(buildTermsTree(newAvailableTerms)) |
|
9628 }); |
|
9629 onUpdateTerms([...terms, term.id], taxonomy.rest_base); |
|
9630 }, xhr => { |
|
9631 if (xhr.statusText === 'abort') { |
|
9632 return; |
|
9633 } |
|
9634 |
|
9635 this.addRequest = null; |
|
9636 this.setState({ |
|
9637 adding: false |
|
9638 }); |
|
9639 }); |
|
9640 } |
|
9641 |
|
9642 componentDidMount() { |
|
9643 this.fetchTerms(); |
|
9644 } |
|
9645 |
|
9646 componentWillUnmount() { |
|
9647 Object(external_lodash_["invoke"])(this.fetchRequest, ['abort']); |
|
9648 Object(external_lodash_["invoke"])(this.addRequest, ['abort']); |
|
9649 } |
|
9650 |
|
9651 componentDidUpdate(prevProps) { |
|
9652 if (this.props.taxonomy !== prevProps.taxonomy) { |
|
9653 this.fetchTerms(); |
|
9654 } |
|
9655 } |
|
9656 |
|
9657 fetchTerms() { |
|
9658 const { |
|
9659 taxonomy |
|
9660 } = this.props; |
|
9661 |
|
9662 if (!taxonomy) { |
|
9663 return; |
|
9664 } |
|
9665 |
|
9666 this.fetchRequest = external_wp_apiFetch_default()({ |
|
9667 path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, hierarchical_term_selector_DEFAULT_QUERY) |
|
9668 }); |
|
9669 this.fetchRequest.then(terms => { |
|
9670 // resolve |
|
9671 const availableTermsTree = this.sortBySelected(buildTermsTree(terms)); |
|
9672 this.fetchRequest = null; |
|
9673 this.setState({ |
|
9674 loading: false, |
|
9675 availableTermsTree, |
|
9676 availableTerms: terms |
|
9677 }); |
|
9678 }, xhr => { |
|
9679 // reject |
|
9680 if (xhr.statusText === 'abort') { |
|
9681 return; |
|
9682 } |
|
9683 |
|
9684 this.fetchRequest = null; |
|
9685 this.setState({ |
|
9686 loading: false |
|
9687 }); |
|
9688 }); |
|
9689 } |
|
9690 |
|
9691 sortBySelected(termsTree) { |
|
9692 const { |
|
9693 terms |
|
9694 } = this.props; |
|
9695 |
|
9696 const treeHasSelection = termTree => { |
|
9697 if (terms.indexOf(termTree.id) !== -1) { |
|
9698 return true; |
|
9699 } |
|
9700 |
|
9701 if (undefined === termTree.children) { |
|
9702 return false; |
|
9703 } |
|
9704 |
|
9705 const anyChildIsSelected = termTree.children.map(treeHasSelection).filter(child => child).length > 0; |
|
9706 |
|
9707 if (anyChildIsSelected) { |
|
9708 return true; |
|
9709 } |
|
9710 |
|
9711 return false; |
|
9712 }; |
|
9713 |
|
9714 const termOrChildIsSelected = (termA, termB) => { |
|
9715 const termASelected = treeHasSelection(termA); |
|
9716 const termBSelected = treeHasSelection(termB); |
|
9717 |
|
9718 if (termASelected === termBSelected) { |
|
9719 return 0; |
|
9720 } |
|
9721 |
|
9722 if (termASelected && !termBSelected) { |
|
9723 return -1; |
|
9724 } |
|
9725 |
|
9726 if (!termASelected && termBSelected) { |
|
9727 return 1; |
|
9728 } |
|
9729 |
|
9730 return 0; |
|
9731 }; |
|
9732 |
|
9733 termsTree.sort(termOrChildIsSelected); |
|
9734 return termsTree; |
|
9735 } |
|
9736 |
|
9737 setFilterValue(event) { |
|
9738 const { |
|
9739 availableTermsTree |
|
9740 } = this.state; |
|
9741 const filterValue = event.target.value; |
|
9742 const filteredTermsTree = availableTermsTree.map(this.getFilterMatcher(filterValue)).filter(term => term); |
|
9743 |
|
9744 const getResultCount = terms => { |
|
9745 let count = 0; |
|
9746 |
|
9747 for (let i = 0; i < terms.length; i++) { |
|
9748 count++; |
|
9749 |
|
9750 if (undefined !== terms[i].children) { |
|
9751 count += getResultCount(terms[i].children); |
|
9752 } |
|
9753 } |
|
9754 |
|
9755 return count; |
|
9756 }; |
|
9757 |
|
9758 this.setState({ |
|
9759 filterValue, |
|
9760 filteredTermsTree |
|
9761 }); |
|
9762 const resultCount = getResultCount(filteredTermsTree); |
|
9763 const resultsFoundMessage = Object(external_wp_i18n_["sprintf"])( |
|
9764 /* translators: %d: number of results */ |
|
9765 Object(external_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount); |
|
9766 this.props.debouncedSpeak(resultsFoundMessage, 'assertive'); |
|
9767 } |
|
9768 |
|
9769 getFilterMatcher(filterValue) { |
|
9770 const matchTermsForFilter = originalTerm => { |
|
9771 if ('' === filterValue) { |
|
9772 return originalTerm; |
|
9773 } // Shallow clone, because we'll be filtering the term's children and |
|
9774 // don't want to modify the original term. |
|
9775 |
|
9776 |
|
9777 const term = { ...originalTerm |
|
9778 }; // Map and filter the children, recursive so we deal with grandchildren |
|
9779 // and any deeper levels. |
|
9780 |
|
9781 if (term.children.length > 0) { |
|
9782 term.children = term.children.map(matchTermsForFilter).filter(child => child); |
|
9783 } // If the term's name contains the filterValue, or it has children |
|
9784 // (i.e. some child matched at some point in the tree) then return it. |
|
9785 |
|
9786 |
|
9787 if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) { |
|
9788 return term; |
|
9789 } // Otherwise, return false. After mapping, the list of terms will need |
|
9790 // to have false values filtered out. |
|
9791 |
|
9792 |
|
9793 return false; |
|
9794 }; |
|
9795 |
|
9796 return matchTermsForFilter; |
|
9797 } |
|
9798 |
|
9799 renderTerms(renderedTerms) { |
|
9800 const { |
|
9801 terms = [] |
|
9802 } = this.props; |
|
9803 return renderedTerms.map(term => { |
|
9804 return Object(external_wp_element_["createElement"])("div", { |
|
9805 key: term.id, |
|
9806 className: "editor-post-taxonomies__hierarchical-terms-choice" |
|
9807 }, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], { |
|
9808 checked: terms.indexOf(term.id) !== -1, |
|
9809 onChange: () => { |
|
9810 const termId = parseInt(term.id, 10); |
|
9811 this.onChange(termId); |
|
9812 }, |
|
9813 label: Object(external_lodash_["unescape"])(term.name) |
|
9814 }), !!term.children.length && Object(external_wp_element_["createElement"])("div", { |
|
9815 className: "editor-post-taxonomies__hierarchical-terms-subchoices" |
|
9816 }, this.renderTerms(term.children))); |
|
9817 }); |
|
9818 } |
|
9819 |
|
9820 render() { |
|
9821 const { |
|
9822 slug, |
|
9823 taxonomy, |
|
9824 instanceId, |
|
9825 hasCreateAction, |
|
9826 hasAssignAction |
|
9827 } = this.props; |
|
9828 |
|
9829 if (!hasAssignAction) { |
|
9830 return null; |
|
9831 } |
|
9832 |
|
9833 const { |
|
9834 availableTermsTree, |
|
9835 availableTerms, |
|
9836 filteredTermsTree, |
|
9837 formName, |
|
9838 formParent, |
|
9839 loading, |
|
9840 showForm, |
|
9841 filterValue |
|
9842 } = this.state; |
|
9843 |
|
9844 const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => Object(external_lodash_["get"])(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory); |
|
9845 |
|
9846 const newTermButtonLabel = labelWithFallback('add_new_item', Object(external_wp_i18n_["__"])('Add new category'), Object(external_wp_i18n_["__"])('Add new term')); |
|
9847 const newTermLabel = labelWithFallback('new_item_name', Object(external_wp_i18n_["__"])('Add new category'), Object(external_wp_i18n_["__"])('Add new term')); |
|
9848 const parentSelectLabel = labelWithFallback('parent_item', Object(external_wp_i18n_["__"])('Parent Category'), Object(external_wp_i18n_["__"])('Parent Term')); |
|
9849 const noParentOption = `— ${parentSelectLabel} —`; |
|
9850 const newTermSubmitLabel = newTermButtonLabel; |
|
9851 const inputId = `editor-post-taxonomies__hierarchical-terms-input-${instanceId}`; |
|
9852 const filterInputId = `editor-post-taxonomies__hierarchical-terms-filter-${instanceId}`; |
|
9853 const filterLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'search_items'], Object(external_wp_i18n_["__"])('Search Terms')); |
|
9854 const groupLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['name'], Object(external_wp_i18n_["__"])('Terms')); |
|
9855 const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER; |
|
9856 return [showFilter && Object(external_wp_element_["createElement"])("label", { |
|
9857 key: "filter-label", |
|
9858 htmlFor: filterInputId |
|
9859 }, filterLabel), showFilter && Object(external_wp_element_["createElement"])("input", { |
|
9860 type: "search", |
|
9861 id: filterInputId, |
|
9862 value: filterValue, |
|
9863 onChange: this.setFilterValue, |
|
9864 className: "editor-post-taxonomies__hierarchical-terms-filter", |
|
9865 key: "term-filter-input" |
|
9866 }), Object(external_wp_element_["createElement"])("div", { |
|
9867 className: "editor-post-taxonomies__hierarchical-terms-list", |
|
9868 key: "term-list", |
|
9869 tabIndex: "0", |
|
9870 role: "group", |
|
9871 "aria-label": groupLabel |
|
9872 }, this.renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
9873 key: "term-add-button", |
|
9874 onClick: this.onToggleForm, |
|
9875 className: "editor-post-taxonomies__hierarchical-terms-add", |
|
9876 "aria-expanded": showForm, |
|
9877 isLink: true |
|
9878 }, newTermButtonLabel), showForm && Object(external_wp_element_["createElement"])("form", { |
|
9879 onSubmit: this.onAddTerm, |
|
9880 key: "hierarchical-terms-form" |
|
9881 }, Object(external_wp_element_["createElement"])("label", { |
|
9882 htmlFor: inputId, |
|
9883 className: "editor-post-taxonomies__hierarchical-terms-label" |
|
9884 }, newTermLabel), Object(external_wp_element_["createElement"])("input", { |
|
9885 type: "text", |
|
9886 id: inputId, |
|
9887 className: "editor-post-taxonomies__hierarchical-terms-input", |
|
9888 value: formName, |
|
9889 onChange: this.onChangeFormName, |
|
9890 required: true |
|
9891 }), !!availableTerms.length && Object(external_wp_element_["createElement"])(external_wp_components_["TreeSelect"], { |
|
9892 label: parentSelectLabel, |
|
9893 noOptionLabel: noParentOption, |
|
9894 onChange: this.onChangeFormParent, |
|
9895 selectedId: formParent, |
|
9896 tree: availableTermsTree |
|
9897 }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
9898 isSecondary: true, |
|
9899 type: "submit", |
|
9900 className: "editor-post-taxonomies__hierarchical-terms-submit" |
|
9901 }, newTermSubmitLabel))]; |
|
9902 } |
|
9903 |
|
9904 } |
|
9905 |
|
9906 /* harmony default export */ var hierarchical_term_selector = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, { |
|
9907 slug |
|
9908 }) => { |
|
9909 const { |
|
9910 getCurrentPost |
|
9911 } = select('core/editor'); |
|
9912 const { |
|
9913 getTaxonomy |
|
9914 } = select('core'); |
|
9915 const taxonomy = getTaxonomy(slug); |
|
9916 return { |
|
9917 hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false, |
|
9918 hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false, |
|
9919 terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [], |
|
9920 taxonomy |
|
9921 }; |
|
9922 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ |
|
9923 onUpdateTerms(terms, restBase) { |
|
9924 dispatch('core/editor').editPost({ |
|
9925 [restBase]: terms |
|
9926 }); |
|
9927 } |
|
9928 |
|
9929 })), external_wp_components_["withSpokenMessages"], external_wp_compose_["withInstanceId"], Object(external_wp_components_["withFilters"])('editor.PostTaxonomyType')])(hierarchical_term_selector_HierarchicalTermSelector)); |
|
9930 |
|
9931 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js |
|
9932 |
|
9933 |
|
9934 /** |
|
9935 * External dependencies |
|
9936 */ |
|
9937 |
|
9938 /** |
|
9939 * WordPress dependencies |
|
9940 */ |
|
9941 |
|
9942 |
|
9943 |
|
9944 |
|
9945 /** |
|
9946 * Internal dependencies |
|
9947 */ |
|
9948 |
|
9949 |
|
9950 |
|
9951 function PostTaxonomies({ |
|
9952 postType, |
|
9953 taxonomies, |
|
9954 taxonomyWrapper = external_lodash_["identity"] |
|
9955 }) { |
|
9956 const availableTaxonomies = Object(external_lodash_["filter"])(taxonomies, taxonomy => Object(external_lodash_["includes"])(taxonomy.types, postType)); |
|
9957 const visibleTaxonomies = Object(external_lodash_["filter"])(availableTaxonomies, taxonomy => taxonomy.visibility.show_ui); |
|
9958 return visibleTaxonomies.map(taxonomy => { |
10550 return visibleTaxonomies.map(taxonomy => { |
9959 const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; |
10551 const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector; |
9960 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], { |
10552 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { |
9961 key: `taxonomy-${taxonomy.slug}` |
10553 key: `taxonomy-${taxonomy.slug}` |
9962 }, taxonomyWrapper(Object(external_wp_element_["createElement"])(TaxonomyComponent, { |
10554 }, taxonomyWrapper((0,external_wp_element_namespaceObject.createElement)(TaxonomyComponent, { |
9963 slug: taxonomy.slug |
10555 slug: taxonomy.slug |
9964 }), taxonomy)); |
10556 }), taxonomy)); |
9965 }); |
10557 }); |
9966 } |
10558 } |
9967 /* harmony default export */ var post_taxonomies = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
10559 /* harmony default export */ var post_taxonomies = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
9968 return { |
10560 return { |
9969 postType: select('core/editor').getCurrentPostType(), |
10561 postType: select(store_store).getCurrentPostType(), |
9970 taxonomies: select('core').getTaxonomies({ |
10562 taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({ |
9971 per_page: -1 |
10563 per_page: -1 |
9972 }) |
10564 }) |
9973 }; |
10565 }; |
9974 })])(PostTaxonomies)); |
10566 })])(PostTaxonomies)); |
9975 |
10567 |
9976 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js |
10568 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js |
9977 /** |
10569 /** |
9978 * External dependencies |
10570 * External dependencies |
9979 */ |
10571 */ |
9980 |
10572 |
9981 /** |
10573 /** |
9982 * WordPress dependencies |
10574 * WordPress dependencies |
9983 */ |
10575 */ |
9984 |
10576 |
9985 |
10577 |
9986 |
10578 |
9987 function PostTaxonomiesCheck({ |
10579 |
9988 postType, |
10580 /** |
9989 taxonomies, |
10581 * Internal dependencies |
9990 children |
10582 */ |
9991 }) { |
10583 |
9992 const hasTaxonomies = Object(external_lodash_["some"])(taxonomies, taxonomy => Object(external_lodash_["includes"])(taxonomy.types, postType)); |
10584 |
10585 function PostTaxonomiesCheck(_ref) { |
|
10586 let { |
|
10587 postType, |
|
10588 taxonomies, |
|
10589 children |
|
10590 } = _ref; |
|
10591 const hasTaxonomies = (0,external_lodash_namespaceObject.some)(taxonomies, taxonomy => (0,external_lodash_namespaceObject.includes)(taxonomy.types, postType)); |
|
9993 |
10592 |
9994 if (!hasTaxonomies) { |
10593 if (!hasTaxonomies) { |
9995 return null; |
10594 return null; |
9996 } |
10595 } |
9997 |
10596 |
9998 return children; |
10597 return children; |
9999 } |
10598 } |
10000 /* harmony default export */ var post_taxonomies_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
10599 /* harmony default export */ var post_taxonomies_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
10001 return { |
10600 return { |
10002 postType: select('core/editor').getCurrentPostType(), |
10601 postType: select(store_store).getCurrentPostType(), |
10003 taxonomies: select('core').getTaxonomies({ |
10602 taxonomies: select(external_wp_coreData_namespaceObject.store).getTaxonomies({ |
10004 per_page: -1 |
10603 per_page: -1 |
10005 }) |
10604 }) |
10006 }; |
10605 }; |
10007 })])(PostTaxonomiesCheck)); |
10606 })])(PostTaxonomiesCheck)); |
10008 |
10607 |
10009 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js |
10608 // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js |
10010 var lib = __webpack_require__("O6Fj"); |
10609 var lib = __webpack_require__(773); |
10011 var lib_default = /*#__PURE__*/__webpack_require__.n(lib); |
10610 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js |
10012 |
|
10013 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js |
|
10014 |
10611 |
10015 |
10612 |
10016 /** |
10613 /** |
10017 * External dependencies |
10614 * External dependencies |
10018 */ |
10615 */ |
10025 |
10622 |
10026 |
10623 |
10027 |
10624 |
10028 |
10625 |
10029 |
10626 |
10627 /** |
|
10628 * Internal dependencies |
|
10629 */ |
|
10630 |
|
10631 |
|
10030 function PostTextEditor() { |
10632 function PostTextEditor() { |
10031 const postContent = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostContent(), []); |
10633 const postContent = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostContent(), []); |
10032 const { |
10634 const { |
10033 editPost, |
10635 editPost, |
10034 resetEditorBlocks |
10636 resetEditorBlocks |
10035 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
10637 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
10036 const [value, setValue] = Object(external_wp_element_["useState"])(postContent); |
10638 const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(postContent); |
10037 const [isDirty, setIsDirty] = Object(external_wp_element_["useState"])(false); |
10639 const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(false); |
10038 const instanceId = Object(external_wp_compose_["useInstanceId"])(PostTextEditor); |
10640 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(PostTextEditor); |
10641 const valueRef = (0,external_wp_element_namespaceObject.useRef)(); |
|
10039 |
10642 |
10040 if (!isDirty && value !== postContent) { |
10643 if (!isDirty && value !== postContent) { |
10041 setValue(postContent); |
10644 setValue(postContent); |
10042 } |
10645 } |
10043 /** |
10646 /** |
10068 */ |
10671 */ |
10069 |
10672 |
10070 |
10673 |
10071 const stopEditing = () => { |
10674 const stopEditing = () => { |
10072 if (isDirty) { |
10675 if (isDirty) { |
10073 const blocks = Object(external_wp_blocks_["parse"])(value); |
10676 const blocks = (0,external_wp_blocks_namespaceObject.parse)(value); |
10074 resetEditorBlocks(blocks); |
10677 resetEditorBlocks(blocks); |
10075 setIsDirty(false); |
10678 setIsDirty(false); |
10076 } |
10679 } |
10077 }; |
10680 }; |
10078 |
10681 |
10079 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { |
10682 (0,external_wp_element_namespaceObject.useEffect)(() => { |
10683 valueRef.current = value; |
|
10684 }, [value]); // Ensure changes aren't lost when component unmounts. |
|
10685 |
|
10686 (0,external_wp_element_namespaceObject.useEffect)(() => { |
|
10687 return () => { |
|
10688 const blocks = (0,external_wp_blocks_namespaceObject.parse)(valueRef.current); |
|
10689 resetEditorBlocks(blocks); |
|
10690 }; |
|
10691 }, []); |
|
10692 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { |
|
10080 as: "label", |
10693 as: "label", |
10081 htmlFor: `post-content-${instanceId}` |
10694 htmlFor: `post-content-${instanceId}` |
10082 }, Object(external_wp_i18n_["__"])('Type text or HTML')), Object(external_wp_element_["createElement"])(lib_default.a, { |
10695 }, (0,external_wp_i18n_namespaceObject.__)('Type text or HTML')), (0,external_wp_element_namespaceObject.createElement)(lib/* default */.Z, { |
10083 autoComplete: "off", |
10696 autoComplete: "off", |
10084 dir: "auto", |
10697 dir: "auto", |
10085 value: value, |
10698 value: value, |
10086 onChange: onChange, |
10699 onChange: onChange, |
10087 onBlur: stopEditing, |
10700 onBlur: stopEditing, |
10088 className: "editor-post-text-editor", |
10701 className: "editor-post-text-editor", |
10089 id: `post-content-${instanceId}`, |
10702 id: `post-content-${instanceId}`, |
10090 placeholder: Object(external_wp_i18n_["__"])('Start writing with text or HTML') |
10703 placeholder: (0,external_wp_i18n_namespaceObject.__)('Start writing with text or HTML') |
10091 })); |
10704 })); |
10092 } |
10705 } |
10093 |
10706 |
10094 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js |
10707 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js |
10095 |
10708 |
10096 |
10709 |
10097 /** |
10710 /** |
10098 * External dependencies |
10711 * External dependencies |
10099 */ |
10712 */ |
10100 |
10713 |
10101 |
|
10102 /** |
10714 /** |
10103 * WordPress dependencies |
10715 * WordPress dependencies |
10104 */ |
10716 */ |
10105 |
10717 |
10106 |
10718 |
10113 |
10725 |
10114 |
10726 |
10115 /** |
10727 /** |
10116 * Internal dependencies |
10728 * Internal dependencies |
10117 */ |
10729 */ |
10730 |
|
10118 |
10731 |
10119 |
10732 |
10120 /** |
10733 /** |
10121 * Constants |
10734 * Constants |
10122 */ |
10735 */ |
10123 |
10736 |
10124 const REGEXP_NEWLINES = /[\r\n]+/g; |
10737 const REGEXP_NEWLINES = /[\r\n]+/g; |
10125 function PostTitle() { |
10738 function PostTitle() { |
10126 const instanceId = Object(external_wp_compose_["useInstanceId"])(PostTitle); |
10739 const ref = (0,external_wp_element_namespaceObject.useRef)(); |
10127 const ref = Object(external_wp_element_["useRef"])(); |
10740 const [isSelected, setIsSelected] = (0,external_wp_element_namespaceObject.useState)(false); |
10128 const [isSelected, setIsSelected] = Object(external_wp_element_["useState"])(false); |
|
10129 const { |
10741 const { |
10130 editPost |
10742 editPost |
10131 } = Object(external_wp_data_["useDispatch"])('core/editor'); |
10743 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
10132 const { |
10744 const { |
10133 insertDefaultBlock, |
10745 insertDefaultBlock, |
10134 clearSelectedBlock, |
10746 clearSelectedBlock, |
10135 insertBlocks |
10747 insertBlocks |
10136 } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); |
10748 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
10137 const { |
10749 const { |
10138 isCleanNewPost, |
10750 isCleanNewPost, |
10139 title, |
10751 title, |
10140 placeholder, |
10752 placeholder, |
10141 isFocusMode, |
10753 isFocusMode, |
10142 hasFixedToolbar |
10754 hasFixedToolbar |
10143 } = Object(external_wp_data_["useSelect"])(select => { |
10755 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
10144 const { |
10756 const { |
10145 getEditedPostAttribute, |
10757 getEditedPostAttribute, |
10146 isCleanNewPost: _isCleanNewPost |
10758 isCleanNewPost: _isCleanNewPost |
10147 } = select('core/editor'); |
10759 } = select(store_store); |
10148 const { |
10760 const { |
10149 getSettings |
10761 getSettings |
10150 } = select(external_wp_blockEditor_["store"]); |
10762 } = select(external_wp_blockEditor_namespaceObject.store); |
10151 const { |
10763 const { |
10152 titlePlaceholder, |
10764 titlePlaceholder, |
10153 focusMode, |
10765 focusMode, |
10154 hasFixedToolbar: _hasFixedToolbar |
10766 hasFixedToolbar: _hasFixedToolbar |
10155 } = getSettings(); |
10767 } = getSettings(); |
10158 title: getEditedPostAttribute('title'), |
10770 title: getEditedPostAttribute('title'), |
10159 placeholder: titlePlaceholder, |
10771 placeholder: titlePlaceholder, |
10160 isFocusMode: focusMode, |
10772 isFocusMode: focusMode, |
10161 hasFixedToolbar: _hasFixedToolbar |
10773 hasFixedToolbar: _hasFixedToolbar |
10162 }; |
10774 }; |
10163 }); |
10775 }, []); |
10164 Object(external_wp_element_["useEffect"])(() => { |
10776 (0,external_wp_element_namespaceObject.useEffect)(() => { |
10165 if (!ref.current) { |
10777 if (!ref.current) { |
10166 return; |
10778 return; |
10167 } |
10779 } |
10168 |
10780 |
10169 const { |
10781 const { |
10194 editPost({ |
10806 editPost({ |
10195 title: newTitle |
10807 title: newTitle |
10196 }); |
10808 }); |
10197 } |
10809 } |
10198 |
10810 |
10811 const [selection, setSelection] = (0,external_wp_element_namespaceObject.useState)({}); |
|
10812 |
|
10199 function onSelect() { |
10813 function onSelect() { |
10200 setIsSelected(true); |
10814 setIsSelected(true); |
10201 clearSelectedBlock(); |
10815 clearSelectedBlock(); |
10202 } |
10816 } |
10203 |
10817 |
10204 function onUnselect() { |
10818 function onUnselect() { |
10205 setIsSelected(false); |
10819 setIsSelected(false); |
10206 } |
10820 setSelection({}); |
10207 |
10821 } |
10208 function onChange(event) { |
10822 |
10209 onUpdate(event.target.value.replace(REGEXP_NEWLINES, ' ')); |
10823 function onChange(value) { |
10824 onUpdate(value.replace(REGEXP_NEWLINES, ' ')); |
|
10210 } |
10825 } |
10211 |
10826 |
10212 function onKeyDown(event) { |
10827 function onKeyDown(event) { |
10213 if (event.keyCode === external_wp_keycodes_["ENTER"]) { |
10828 if (event.keyCode === external_wp_keycodes_namespaceObject.ENTER) { |
10214 event.preventDefault(); |
10829 event.preventDefault(); |
10215 onEnterPress(); |
10830 onEnterPress(); |
10216 } |
10831 } |
10217 } |
10832 } |
10218 |
10833 |
10238 } // Allows us to ask for this information when we get a report. |
10853 } // Allows us to ask for this information when we get a report. |
10239 |
10854 |
10240 |
10855 |
10241 window.console.log('Received HTML:\n\n', html); |
10856 window.console.log('Received HTML:\n\n', html); |
10242 window.console.log('Received plain text:\n\n', plainText); |
10857 window.console.log('Received plain text:\n\n', plainText); |
10243 const content = Object(external_wp_blocks_["pasteHandler"])({ |
10858 const content = (0,external_wp_blocks_namespaceObject.pasteHandler)({ |
10244 HTML: html, |
10859 HTML: html, |
10245 plainText |
10860 plainText |
10246 }); |
10861 }); |
10247 |
10862 |
10248 if (typeof content !== 'string' && content.length) { |
10863 if (typeof content !== 'string' && content.length) { |
10258 } |
10873 } |
10259 } // The wp-block className is important for editor styles. |
10874 } // The wp-block className is important for editor styles. |
10260 // This same block is used in both the visual and the code editor. |
10875 // This same block is used in both the visual and the code editor. |
10261 |
10876 |
10262 |
10877 |
10263 const className = classnames_default()('wp-block editor-post-title editor-post-title__block', { |
10878 const className = classnames_default()('wp-block wp-block-post-title block-editor-block-list__block editor-post-title editor-post-title__input rich-text', { |
10264 'is-selected': isSelected, |
10879 'is-selected': isSelected, |
10265 'is-focus-mode': isFocusMode, |
10880 'is-focus-mode': isFocusMode, |
10266 'has-fixed-toolbar': hasFixedToolbar |
10881 'has-fixed-toolbar': hasFixedToolbar |
10267 }); |
10882 }); |
10268 const decodedPlaceholder = Object(external_wp_htmlEntities_["decodeEntities"])(placeholder); |
10883 |
10269 return Object(external_wp_element_["createElement"])(post_type_support_check, { |
10884 const decodedPlaceholder = (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(placeholder) || (0,external_wp_i18n_namespaceObject.__)('Add title'); |
10885 |
|
10886 const { |
|
10887 ref: richTextRef |
|
10888 } = (0,external_wp_richText_namespaceObject.__unstableUseRichText)({ |
|
10889 value: title, |
|
10890 onChange, |
|
10891 placeholder: decodedPlaceholder, |
|
10892 selectionStart: selection.start, |
|
10893 selectionEnd: selection.end, |
|
10894 |
|
10895 onSelectionChange(newStart, newEnd) { |
|
10896 setSelection(sel => { |
|
10897 const { |
|
10898 start, |
|
10899 end |
|
10900 } = sel; |
|
10901 |
|
10902 if (start === newStart && end === newEnd) { |
|
10903 return sel; |
|
10904 } |
|
10905 |
|
10906 return { |
|
10907 start: newStart, |
|
10908 end: newEnd |
|
10909 }; |
|
10910 }); |
|
10911 }, |
|
10912 |
|
10913 __unstableDisableFormats: true, |
|
10914 preserveWhiteSpace: true |
|
10915 }); |
|
10916 /* eslint-disable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */ |
|
10917 |
|
10918 return (0,external_wp_element_namespaceObject.createElement)(post_type_support_check, { |
|
10270 supportKeys: "title" |
10919 supportKeys: "title" |
10271 }, Object(external_wp_element_["createElement"])("div", { |
10920 }, (0,external_wp_element_namespaceObject.createElement)("h1", { |
10272 className: className |
10921 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([richTextRef, ref]), |
10273 }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { |
10922 contentEditable: true, |
10274 as: "label", |
10923 className: className, |
10275 htmlFor: `post-title-${instanceId}` |
10924 "aria-label": decodedPlaceholder, |
10276 }, decodedPlaceholder || Object(external_wp_i18n_["__"])('Add title')), Object(external_wp_element_["createElement"])(lib_default.a, { |
10925 role: "textbox", |
10277 ref: ref, |
10926 "aria-multiline": "true", |
10278 id: `post-title-${instanceId}`, |
|
10279 className: "editor-post-title__input", |
|
10280 value: title, |
|
10281 onChange: onChange, |
|
10282 placeholder: decodedPlaceholder || Object(external_wp_i18n_["__"])('Add title'), |
|
10283 onFocus: onSelect, |
10927 onFocus: onSelect, |
10284 onBlur: onUnselect, |
10928 onBlur: onUnselect, |
10285 onKeyDown: onKeyDown, |
10929 onKeyDown: onKeyDown, |
10286 onKeyPress: onUnselect, |
10930 onKeyPress: onUnselect, |
10287 onPaste: onPaste |
10931 onPaste: onPaste |
10288 }))); |
10932 })); |
10289 } |
10933 /* eslint-enable jsx-a11y/heading-has-content, jsx-a11y/no-noninteractive-element-to-interactive-role */ |
10290 |
10934 } |
10291 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js |
10935 |
10936 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js |
|
10292 |
10937 |
10293 |
10938 |
10294 /** |
10939 /** |
10295 * WordPress dependencies |
10940 * WordPress dependencies |
10296 */ |
10941 */ |
10297 |
10942 |
10298 |
10943 |
10299 |
10944 |
10300 |
10945 /** |
10301 |
10946 * Internal dependencies |
10302 function PostTrash({ |
10947 */ |
10303 isNew, |
10948 |
10304 postId, |
10949 |
10305 postType, |
10950 function PostTrash() { |
10306 ...props |
10951 const { |
10307 }) { |
10952 isNew, |
10953 postId |
|
10954 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
10955 const store = select(store_store); |
|
10956 return { |
|
10957 isNew: store.isEditedPostNew(), |
|
10958 postId: store.getCurrentPostId() |
|
10959 }; |
|
10960 }, []); |
|
10961 const { |
|
10962 trashPost |
|
10963 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
|
10964 |
|
10308 if (isNew || !postId) { |
10965 if (isNew || !postId) { |
10309 return null; |
10966 return null; |
10310 } |
10967 } |
10311 |
10968 |
10312 const onClick = () => props.trashPost(postId, postType); |
10969 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
10313 |
|
10314 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
10315 className: "editor-post-trash", |
10970 className: "editor-post-trash", |
10316 isDestructive: true, |
10971 isDestructive: true, |
10317 isTertiary: true, |
10972 variant: "secondary", |
10318 onClick: onClick |
10973 onClick: () => trashPost() |
10319 }, Object(external_wp_i18n_["__"])('Move to trash')); |
10974 }, (0,external_wp_i18n_namespaceObject.__)('Move to trash')); |
10320 } |
10975 } |
10321 |
10976 |
10322 /* harmony default export */ var post_trash = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
10977 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js |
10978 /** |
|
10979 * WordPress dependencies |
|
10980 */ |
|
10981 |
|
10982 |
|
10983 /** |
|
10984 * Internal dependencies |
|
10985 */ |
|
10986 |
|
10987 |
|
10988 |
|
10989 function PostTrashCheck(_ref) { |
|
10990 let { |
|
10991 isNew, |
|
10992 postId, |
|
10993 canUserDelete, |
|
10994 children |
|
10995 } = _ref; |
|
10996 |
|
10997 if (isNew || !postId || !canUserDelete) { |
|
10998 return null; |
|
10999 } |
|
11000 |
|
11001 return children; |
|
11002 } |
|
11003 |
|
11004 /* harmony default export */ var post_trash_check = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
|
10323 const { |
11005 const { |
10324 isEditedPostNew, |
11006 isEditedPostNew, |
10325 getCurrentPostId, |
11007 getCurrentPostId, |
10326 getCurrentPostType |
11008 getCurrentPostType |
10327 } = select('core/editor'); |
11009 } = select(store_store); |
10328 return { |
|
10329 isNew: isEditedPostNew(), |
|
10330 postId: getCurrentPostId(), |
|
10331 postType: getCurrentPostType() |
|
10332 }; |
|
10333 }), Object(external_wp_data_["withDispatch"])(dispatch => ({ |
|
10334 trashPost: dispatch('core/editor').trashPost |
|
10335 }))])(PostTrash)); |
|
10336 |
|
10337 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js |
|
10338 /** |
|
10339 * WordPress dependencies |
|
10340 */ |
|
10341 |
|
10342 |
|
10343 function PostTrashCheck({ |
|
10344 isNew, |
|
10345 postId, |
|
10346 canUserDelete, |
|
10347 children |
|
10348 }) { |
|
10349 if (isNew || !postId || !canUserDelete) { |
|
10350 return null; |
|
10351 } |
|
10352 |
|
10353 return children; |
|
10354 } |
|
10355 |
|
10356 /* harmony default export */ var post_trash_check = (Object(external_wp_data_["withSelect"])(select => { |
|
10357 const { |
|
10358 isEditedPostNew, |
|
10359 getCurrentPostId, |
|
10360 getCurrentPostType |
|
10361 } = select('core/editor'); |
|
10362 const { |
11010 const { |
10363 getPostType, |
11011 getPostType, |
10364 canUser |
11012 canUser |
10365 } = select('core'); |
11013 } = select(external_wp_coreData_namespaceObject.store); |
10366 const postId = getCurrentPostId(); |
11014 const postId = getCurrentPostId(); |
10367 const postType = getPostType(getCurrentPostType()); |
11015 const postType = getPostType(getCurrentPostType()); |
10368 const resource = (postType === null || postType === void 0 ? void 0 : postType.rest_base) || ''; // eslint-disable-line camelcase |
11016 const resource = (postType === null || postType === void 0 ? void 0 : postType.rest_base) || ''; // eslint-disable-line camelcase |
10369 |
11017 |
10370 return { |
11018 return { |
10372 postId, |
11020 postId, |
10373 canUserDelete: postId && resource ? canUser('delete', resource, postId) : false |
11021 canUserDelete: postId && resource ? canUser('delete', resource, postId) : false |
10374 }; |
11022 }; |
10375 })(PostTrashCheck)); |
11023 })(PostTrashCheck)); |
10376 |
11024 |
10377 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js |
11025 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js |
10378 /** |
11026 /** |
10379 * External dependencies |
11027 * External dependencies |
10380 */ |
11028 */ |
10381 |
11029 |
10382 /** |
11030 /** |
10383 * WordPress dependencies |
11031 * WordPress dependencies |
10384 */ |
11032 */ |
10385 |
11033 |
10386 |
11034 |
10387 |
11035 |
10388 function PostVisibilityCheck({ |
11036 /** |
10389 hasPublishAction, |
11037 * Internal dependencies |
10390 render |
11038 */ |
10391 }) { |
11039 |
11040 |
|
11041 function PostVisibilityCheck(_ref) { |
|
11042 let { |
|
11043 hasPublishAction, |
|
11044 render |
|
11045 } = _ref; |
|
10392 const canEdit = hasPublishAction; |
11046 const canEdit = hasPublishAction; |
10393 return render({ |
11047 return render({ |
10394 canEdit |
11048 canEdit |
10395 }); |
11049 }); |
10396 } |
11050 } |
10397 /* harmony default export */ var post_visibility_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => { |
11051 /* harmony default export */ var post_visibility_check = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { |
10398 const { |
11052 const { |
10399 getCurrentPost, |
11053 getCurrentPost, |
10400 getCurrentPostType |
11054 getCurrentPostType |
10401 } = select('core/editor'); |
11055 } = select(store_store); |
10402 return { |
11056 return { |
10403 hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
11057 hasPublishAction: (0,external_lodash_namespaceObject.get)(getCurrentPost(), ['_links', 'wp:action-publish'], false), |
10404 postType: getCurrentPostType() |
11058 postType: getCurrentPostType() |
10405 }; |
11059 }; |
10406 })])(PostVisibilityCheck)); |
11060 })])(PostVisibilityCheck)); |
10407 |
11061 |
10408 // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js |
11062 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js |
10409 |
11063 |
10410 |
11064 |
10411 /** |
11065 /** |
10412 * WordPress dependencies |
11066 * WordPress dependencies |
10413 */ |
11067 */ |
10414 |
11068 |
10415 const info_info = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { |
11069 const info = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
10416 xmlns: "http://www.w3.org/2000/svg", |
11070 xmlns: "http://www.w3.org/2000/svg", |
10417 viewBox: "0 0 24 24" |
11071 viewBox: "0 0 24 24" |
10418 }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { |
11072 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
10419 d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z" |
11073 d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z" |
10420 })); |
11074 })); |
10421 /* harmony default export */ var library_info = (info_info); |
11075 /* harmony default export */ var library_info = (info); |
10422 |
11076 |
10423 // EXTERNAL MODULE: external ["wp","wordcount"] |
11077 ;// CONCATENATED MODULE: external ["wp","wordcount"] |
10424 var external_wp_wordcount_ = __webpack_require__("7fqt"); |
11078 var external_wp_wordcount_namespaceObject = window["wp"]["wordcount"]; |
10425 |
11079 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js |
10426 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js |
|
10427 |
11080 |
10428 |
11081 |
10429 /** |
11082 /** |
10430 * WordPress dependencies |
11083 * WordPress dependencies |
10431 */ |
11084 */ |
10432 |
11085 |
10433 |
11086 |
10434 |
11087 |
11088 /** |
|
11089 * Internal dependencies |
|
11090 */ |
|
11091 |
|
11092 |
|
10435 function WordCount() { |
11093 function WordCount() { |
10436 const content = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostAttribute('content')); |
11094 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); |
10437 /* |
11095 /* |
10438 * translators: If your word count is based on single characters (e.g. East Asian characters), |
11096 * translators: If your word count is based on single characters (e.g. East Asian characters), |
10439 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. |
11097 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. |
10440 * Do not translate into your own language. |
11098 * Do not translate into your own language. |
10441 */ |
11099 */ |
10442 |
11100 |
10443 const wordCountType = Object(external_wp_i18n_["_x"])('words', 'Word count type. Do not translate!'); |
11101 const wordCountType = (0,external_wp_i18n_namespaceObject._x)('words', 'Word count type. Do not translate!'); |
10444 |
11102 |
10445 return Object(external_wp_element_["createElement"])("span", { |
11103 return (0,external_wp_element_namespaceObject.createElement)("span", { |
10446 className: "word-count" |
11104 className: "word-count" |
10447 }, Object(external_wp_wordcount_["count"])(content, wordCountType)); |
11105 }, (0,external_wp_wordcount_namespaceObject.count)(content, wordCountType)); |
10448 } |
11106 } |
10449 |
11107 |
10450 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/character-count/index.js |
11108 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/character-count/index.js |
10451 /** |
11109 /** |
10452 * WordPress dependencies |
11110 * WordPress dependencies |
10453 */ |
11111 */ |
10454 |
11112 |
10455 |
11113 |
11114 /** |
|
11115 * Internal dependencies |
|
11116 */ |
|
11117 |
|
11118 |
|
10456 function CharacterCount() { |
11119 function CharacterCount() { |
10457 const content = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostAttribute('content')); |
11120 const content = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).getEditedPostAttribute('content'), []); |
10458 return Object(external_wp_wordcount_["count"])(content, 'characters_including_spaces'); |
11121 return (0,external_wp_wordcount_namespaceObject.count)(content, 'characters_including_spaces'); |
10459 } |
11122 } |
10460 |
11123 |
10461 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js |
11124 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js |
10462 |
11125 |
10463 |
11126 |
10464 /** |
11127 /** |
10465 * WordPress dependencies |
11128 * WordPress dependencies |
10466 */ |
11129 */ |
10473 |
11136 |
10474 |
11137 |
10475 |
11138 |
10476 |
11139 |
10477 |
11140 |
10478 function TableOfContentsPanel({ |
11141 function TableOfContentsPanel(_ref) { |
10479 hasOutlineItemsDisabled, |
11142 let { |
10480 onRequestClose |
11143 hasOutlineItemsDisabled, |
10481 }) { |
11144 onRequestClose |
11145 } = _ref; |
|
10482 const { |
11146 const { |
10483 headingCount, |
11147 headingCount, |
10484 paragraphCount, |
11148 paragraphCount, |
10485 numberOfBlocks |
11149 numberOfBlocks |
10486 } = Object(external_wp_data_["useSelect"])(select => { |
11150 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
10487 const { |
11151 const { |
10488 getGlobalBlockCount |
11152 getGlobalBlockCount |
10489 } = select(external_wp_blockEditor_["store"]); |
11153 } = select(external_wp_blockEditor_namespaceObject.store); |
10490 return { |
11154 return { |
10491 headingCount: getGlobalBlockCount('core/heading'), |
11155 headingCount: getGlobalBlockCount('core/heading'), |
10492 paragraphCount: getGlobalBlockCount('core/paragraph'), |
11156 paragraphCount: getGlobalBlockCount('core/paragraph'), |
10493 numberOfBlocks: getGlobalBlockCount() |
11157 numberOfBlocks: getGlobalBlockCount() |
10494 }; |
11158 }; |
10498 * Disable reason: The `list` ARIA role is redundant but |
11162 * Disable reason: The `list` ARIA role is redundant but |
10499 * Safari+VoiceOver won't announce the list otherwise. |
11163 * Safari+VoiceOver won't announce the list otherwise. |
10500 */ |
11164 */ |
10501 |
11165 |
10502 /* eslint-disable jsx-a11y/no-redundant-roles */ |
11166 /* eslint-disable jsx-a11y/no-redundant-roles */ |
10503 Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { |
11167 (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { |
10504 className: "table-of-contents__wrapper", |
11168 className: "table-of-contents__wrapper", |
10505 role: "note", |
11169 role: "note", |
10506 "aria-label": Object(external_wp_i18n_["__"])('Document Statistics'), |
11170 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Document Statistics'), |
10507 tabIndex: "0" |
11171 tabIndex: "0" |
10508 }, Object(external_wp_element_["createElement"])("ul", { |
11172 }, (0,external_wp_element_namespaceObject.createElement)("ul", { |
10509 role: "list", |
11173 role: "list", |
10510 className: "table-of-contents__counts" |
11174 className: "table-of-contents__counts" |
10511 }, Object(external_wp_element_["createElement"])("li", { |
11175 }, (0,external_wp_element_namespaceObject.createElement)("li", { |
10512 className: "table-of-contents__count" |
11176 className: "table-of-contents__count" |
10513 }, Object(external_wp_i18n_["__"])('Characters'), Object(external_wp_element_["createElement"])("span", { |
11177 }, (0,external_wp_i18n_namespaceObject.__)('Characters'), (0,external_wp_element_namespaceObject.createElement)("span", { |
10514 className: "table-of-contents__number" |
11178 className: "table-of-contents__number" |
10515 }, Object(external_wp_element_["createElement"])(CharacterCount, null))), Object(external_wp_element_["createElement"])("li", { |
11179 }, (0,external_wp_element_namespaceObject.createElement)(CharacterCount, null))), (0,external_wp_element_namespaceObject.createElement)("li", { |
10516 className: "table-of-contents__count" |
11180 className: "table-of-contents__count" |
10517 }, Object(external_wp_i18n_["__"])('Words'), Object(external_wp_element_["createElement"])(WordCount, null)), Object(external_wp_element_["createElement"])("li", { |
11181 }, (0,external_wp_i18n_namespaceObject.__)('Words'), (0,external_wp_element_namespaceObject.createElement)(WordCount, null)), (0,external_wp_element_namespaceObject.createElement)("li", { |
10518 className: "table-of-contents__count" |
11182 className: "table-of-contents__count" |
10519 }, Object(external_wp_i18n_["__"])('Headings'), Object(external_wp_element_["createElement"])("span", { |
11183 }, (0,external_wp_i18n_namespaceObject.__)('Headings'), (0,external_wp_element_namespaceObject.createElement)("span", { |
10520 className: "table-of-contents__number" |
11184 className: "table-of-contents__number" |
10521 }, headingCount)), Object(external_wp_element_["createElement"])("li", { |
11185 }, headingCount)), (0,external_wp_element_namespaceObject.createElement)("li", { |
10522 className: "table-of-contents__count" |
11186 className: "table-of-contents__count" |
10523 }, Object(external_wp_i18n_["__"])('Paragraphs'), Object(external_wp_element_["createElement"])("span", { |
11187 }, (0,external_wp_i18n_namespaceObject.__)('Paragraphs'), (0,external_wp_element_namespaceObject.createElement)("span", { |
10524 className: "table-of-contents__number" |
11188 className: "table-of-contents__number" |
10525 }, paragraphCount)), Object(external_wp_element_["createElement"])("li", { |
11189 }, paragraphCount)), (0,external_wp_element_namespaceObject.createElement)("li", { |
10526 className: "table-of-contents__count" |
11190 className: "table-of-contents__count" |
10527 }, Object(external_wp_i18n_["__"])('Blocks'), Object(external_wp_element_["createElement"])("span", { |
11191 }, (0,external_wp_i18n_namespaceObject.__)('Blocks'), (0,external_wp_element_namespaceObject.createElement)("span", { |
10528 className: "table-of-contents__number" |
11192 className: "table-of-contents__number" |
10529 }, numberOfBlocks)))), headingCount > 0 && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("hr", null), Object(external_wp_element_["createElement"])("h2", { |
11193 }, numberOfBlocks)))), headingCount > 0 && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("hr", null), (0,external_wp_element_namespaceObject.createElement)("h2", { |
10530 className: "table-of-contents__title" |
11194 className: "table-of-contents__title" |
10531 }, Object(external_wp_i18n_["__"])('Document Outline')), Object(external_wp_element_["createElement"])(document_outline, { |
11195 }, (0,external_wp_i18n_namespaceObject.__)('Document Outline')), (0,external_wp_element_namespaceObject.createElement)(document_outline, { |
10532 onSelect: onRequestClose, |
11196 onSelect: onRequestClose, |
10533 hasOutlineItemsDisabled: hasOutlineItemsDisabled |
11197 hasOutlineItemsDisabled: hasOutlineItemsDisabled |
10534 }))) |
11198 }))) |
10535 /* eslint-enable jsx-a11y/no-redundant-roles */ |
11199 /* eslint-enable jsx-a11y/no-redundant-roles */ |
10536 |
11200 |
10537 ); |
11201 ); |
10538 } |
11202 } |
10539 |
11203 |
10540 /* harmony default export */ var panel = (TableOfContentsPanel); |
11204 /* harmony default export */ var panel = (TableOfContentsPanel); |
10541 |
11205 |
10542 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js |
11206 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js |
10543 |
11207 |
10544 |
11208 |
10545 |
11209 |
10546 /** |
11210 /** |
10547 * WordPress dependencies |
11211 * WordPress dependencies |
10556 * Internal dependencies |
11220 * Internal dependencies |
10557 */ |
11221 */ |
10558 |
11222 |
10559 |
11223 |
10560 |
11224 |
10561 function TableOfContents({ |
11225 function TableOfContents(_ref, ref) { |
10562 hasOutlineItemsDisabled, |
11226 let { |
10563 repositionDropdown, |
11227 hasOutlineItemsDisabled, |
10564 ...props |
11228 repositionDropdown, |
10565 }, ref) { |
11229 ...props |
10566 const hasBlocks = Object(external_wp_data_["useSelect"])(select => !!select(external_wp_blockEditor_["store"]).getBlockCount(), []); |
11230 } = _ref; |
10567 return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { |
11231 const hasBlocks = (0,external_wp_data_namespaceObject.useSelect)(select => !!select(external_wp_blockEditor_namespaceObject.store).getBlockCount(), []); |
11232 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { |
|
10568 position: repositionDropdown ? 'middle right right' : 'bottom', |
11233 position: repositionDropdown ? 'middle right right' : 'bottom', |
10569 className: "table-of-contents", |
11234 className: "table-of-contents", |
10570 contentClassName: "table-of-contents__popover", |
11235 contentClassName: "table-of-contents__popover", |
10571 renderToggle: ({ |
11236 renderToggle: _ref2 => { |
10572 isOpen, |
11237 let { |
10573 onToggle |
11238 isOpen, |
10574 }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, { |
11239 onToggle |
10575 ref: ref, |
11240 } = _ref2; |
10576 onClick: hasBlocks ? onToggle : undefined, |
11241 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, _extends({}, props, { |
10577 icon: library_info, |
11242 ref: ref, |
10578 "aria-expanded": isOpen, |
11243 onClick: hasBlocks ? onToggle : undefined, |
10579 "aria-haspopup": "true" |
11244 icon: library_info, |
10580 /* translators: button label text should, if possible, be under 16 characters. */ |
11245 "aria-expanded": isOpen, |
10581 , |
11246 "aria-haspopup": "true" |
10582 label: Object(external_wp_i18n_["__"])('Details'), |
11247 /* translators: button label text should, if possible, be under 16 characters. */ |
10583 tooltipPosition: "bottom", |
11248 , |
10584 "aria-disabled": !hasBlocks |
11249 label: (0,external_wp_i18n_namespaceObject.__)('Details'), |
10585 })), |
11250 tooltipPosition: "bottom", |
10586 renderContent: ({ |
11251 "aria-disabled": !hasBlocks |
10587 onClose |
11252 })); |
10588 }) => Object(external_wp_element_["createElement"])(panel, { |
11253 }, |
10589 onRequestClose: onClose, |
11254 renderContent: _ref3 => { |
10590 hasOutlineItemsDisabled: hasOutlineItemsDisabled |
11255 let { |
10591 }) |
11256 onClose |
11257 } = _ref3; |
|
11258 return (0,external_wp_element_namespaceObject.createElement)(panel, { |
|
11259 onRequestClose: onClose, |
|
11260 hasOutlineItemsDisabled: hasOutlineItemsDisabled |
|
11261 }); |
|
11262 } |
|
10592 }); |
11263 }); |
10593 } |
11264 } |
10594 |
11265 |
10595 /* harmony default export */ var table_of_contents = (Object(external_wp_element_["forwardRef"])(TableOfContents)); |
11266 /* harmony default export */ var table_of_contents = ((0,external_wp_element_namespaceObject.forwardRef)(TableOfContents)); |
10596 |
11267 |
10597 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js |
11268 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js |
10598 /** |
11269 /** |
10599 * WordPress dependencies |
11270 * WordPress dependencies |
10600 */ |
11271 */ |
11272 |
|
10601 |
11273 |
10602 |
11274 |
10603 |
11275 |
10604 /** |
11276 /** |
10605 * Warns the user if there are unsaved changes before leaving the editor. |
11277 * Warns the user if there are unsaved changes before leaving the editor. |
10607 * |
11279 * |
10608 * @return {WPComponent} The component. |
11280 * @return {WPComponent} The component. |
10609 */ |
11281 */ |
10610 |
11282 |
10611 function UnsavedChangesWarning() { |
11283 function UnsavedChangesWarning() { |
10612 const isDirty = Object(external_wp_data_["useSelect"])(select => { |
11284 const isDirty = (0,external_wp_data_namespaceObject.useSelect)(select => { |
10613 return () => { |
11285 return () => { |
10614 const { |
11286 const { |
10615 __experimentalGetDirtyEntityRecords |
11287 __experimentalGetDirtyEntityRecords |
10616 } = select('core'); |
11288 } = select(external_wp_coreData_namespaceObject.store); |
10617 |
11289 |
10618 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); |
11290 const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); |
10619 |
11291 |
10620 return dirtyEntityRecords.length > 0; |
11292 return dirtyEntityRecords.length > 0; |
10621 }; |
11293 }; |
10632 // We need to call the selector directly in the listener to avoid race |
11304 // We need to call the selector directly in the listener to avoid race |
10633 // conditions with `BrowserURL` where `componentDidUpdate` gets the |
11305 // conditions with `BrowserURL` where `componentDidUpdate` gets the |
10634 // new value of `isEditedPostDirty` before this component does, |
11306 // new value of `isEditedPostDirty` before this component does, |
10635 // causing this component to incorrectly think a trashed post is still dirty. |
11307 // causing this component to incorrectly think a trashed post is still dirty. |
10636 if (isDirty()) { |
11308 if (isDirty()) { |
10637 event.returnValue = Object(external_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.'); |
11309 event.returnValue = (0,external_wp_i18n_namespaceObject.__)('You have unsaved changes. If you proceed, they will be lost.'); |
10638 return event.returnValue; |
11310 return event.returnValue; |
10639 } |
11311 } |
10640 }; |
11312 }; |
10641 |
11313 |
10642 Object(external_wp_element_["useEffect"])(() => { |
11314 (0,external_wp_element_namespaceObject.useEffect)(() => { |
10643 window.addEventListener('beforeunload', warnIfUnsavedChanges); |
11315 window.addEventListener('beforeunload', warnIfUnsavedChanges); |
10644 return () => { |
11316 return () => { |
10645 window.removeEventListener('beforeunload', warnIfUnsavedChanges); |
11317 window.removeEventListener('beforeunload', warnIfUnsavedChanges); |
10646 }; |
11318 }; |
10647 }, []); |
11319 }, []); |
10648 return null; |
11320 return null; |
10649 } |
11321 } |
10650 |
11322 |
10651 // EXTERNAL MODULE: external ["wp","reusableBlocks"] |
11323 ;// CONCATENATED MODULE: external ["wp","reusableBlocks"] |
10652 var external_wp_reusableBlocks_ = __webpack_require__("diJD"); |
11324 var external_wp_reusableBlocks_namespaceObject = window["wp"]["reusableBlocks"]; |
10653 |
11325 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js |
10654 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js |
|
10655 |
11326 |
10656 |
11327 |
10657 /** |
11328 /** |
10658 * WordPress dependencies |
11329 * WordPress dependencies |
10659 */ |
11330 */ |
10664 /** |
11335 /** |
10665 * Internal dependencies |
11336 * Internal dependencies |
10666 */ |
11337 */ |
10667 |
11338 |
10668 |
11339 |
10669 const withRegistryProvider = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => Object(external_wp_data_["withRegistry"])(props => { |
11340 const withRegistryProvider = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => (0,external_wp_data_namespaceObject.withRegistry)(props => { |
10670 const { |
11341 const { |
10671 useSubRegistry = true, |
11342 useSubRegistry = true, |
10672 registry, |
11343 registry, |
10673 ...additionalProps |
11344 ...additionalProps |
10674 } = props; |
11345 } = props; |
10675 |
11346 |
10676 if (!useSubRegistry) { |
11347 if (!useSubRegistry) { |
10677 return Object(external_wp_element_["createElement"])(WrappedComponent, additionalProps); |
11348 return (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, additionalProps); |
10678 } |
11349 } |
10679 |
11350 |
10680 const [subRegistry, setSubRegistry] = Object(external_wp_element_["useState"])(null); |
11351 const [subRegistry, setSubRegistry] = (0,external_wp_element_namespaceObject.useState)(null); |
10681 Object(external_wp_element_["useEffect"])(() => { |
11352 (0,external_wp_element_namespaceObject.useEffect)(() => { |
10682 const newRegistry = Object(external_wp_data_["createRegistry"])({ |
11353 const newRegistry = (0,external_wp_data_namespaceObject.createRegistry)({ |
10683 'core/block-editor': external_wp_blockEditor_["storeConfig"] |
11354 'core/block-editor': external_wp_blockEditor_namespaceObject.storeConfig |
10684 }, registry); |
11355 }, registry); |
10685 newRegistry.registerStore('core/editor', storeConfig); |
11356 newRegistry.registerStore('core/editor', storeConfig); |
10686 setSubRegistry(newRegistry); |
11357 setSubRegistry(newRegistry); |
10687 }, [registry]); |
11358 }, [registry]); |
10688 |
11359 |
10689 if (!subRegistry) { |
11360 if (!subRegistry) { |
10690 return null; |
11361 return null; |
10691 } |
11362 } |
10692 |
11363 |
10693 return Object(external_wp_element_["createElement"])(external_wp_data_["RegistryProvider"], { |
11364 return (0,external_wp_element_namespaceObject.createElement)(external_wp_data_namespaceObject.RegistryProvider, { |
10694 value: subRegistry |
11365 value: subRegistry |
10695 }, Object(external_wp_element_["createElement"])(WrappedComponent, additionalProps)); |
11366 }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, additionalProps)); |
10696 }), 'withRegistryProvider'); |
11367 }), 'withRegistryProvider'); |
10697 /* harmony default export */ var with_registry_provider = (withRegistryProvider); |
11368 /* harmony default export */ var with_registry_provider = (withRegistryProvider); |
10698 |
11369 |
10699 // EXTERNAL MODULE: external ["wp","mediaUtils"] |
11370 ;// CONCATENATED MODULE: external ["wp","mediaUtils"] |
10700 var external_wp_mediaUtils_ = __webpack_require__("6aBm"); |
11371 var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; |
10701 |
11372 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js |
10702 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js |
|
10703 /** |
11373 /** |
10704 * External dependencies |
11374 * External dependencies |
10705 */ |
11375 */ |
10706 |
11376 |
10707 /** |
11377 /** |
10708 * WordPress dependencies |
11378 * WordPress dependencies |
10709 */ |
11379 */ |
10710 |
11380 |
11381 |
|
11382 |
|
11383 /** |
|
11384 * Internal dependencies |
|
11385 */ |
|
10711 |
11386 |
10712 |
11387 |
10713 /** |
11388 /** |
10714 * Upload a media file when the file upload button is activated. |
11389 * Upload a media file when the file upload button is activated. |
10715 * Wrapper around mediaUpload() that injects the current post ID. |
11390 * Wrapper around mediaUpload() that injects the current post ID. |
10716 * |
11391 * |
10717 * @param {Object} $0 Parameters object passed to the function. |
11392 * @param {Object} $0 Parameters object passed to the function. |
10718 * @param {?Object} $0.additionalData Additional data to include in the request. |
11393 * @param {?Object} $0.additionalData Additional data to include in the request. |
10719 * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. |
11394 * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed. |
10720 * @param {Array} $0.filesList List of files. |
11395 * @param {Array} $0.filesList List of files. |
10721 * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. |
11396 * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site. |
10722 * @param {Function} $0.onError Function called when an error happens. |
11397 * @param {Function} $0.onError Function called when an error happens. |
10723 * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. |
11398 * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available. |
10724 */ |
11399 */ |
10725 |
11400 |
10726 function mediaUpload({ |
11401 function mediaUpload(_ref) { |
10727 additionalData = {}, |
11402 let { |
10728 allowedTypes, |
11403 additionalData = {}, |
10729 filesList, |
11404 allowedTypes, |
10730 maxUploadFileSize, |
11405 filesList, |
10731 onError = external_lodash_["noop"], |
11406 maxUploadFileSize, |
10732 onFileChange |
11407 onError = external_lodash_namespaceObject.noop, |
10733 }) { |
11408 onFileChange |
11409 } = _ref; |
|
10734 const { |
11410 const { |
10735 getCurrentPostId, |
11411 getCurrentPostId, |
10736 getEditorSettings |
11412 getEditorSettings |
10737 } = Object(external_wp_data_["select"])('core/editor'); |
11413 } = (0,external_wp_data_namespaceObject.select)(store_store); |
10738 const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; |
11414 const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes; |
10739 maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; |
11415 maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize; |
10740 Object(external_wp_mediaUtils_["uploadMedia"])({ |
11416 (0,external_wp_mediaUtils_namespaceObject.uploadMedia)({ |
10741 allowedTypes, |
11417 allowedTypes, |
10742 filesList, |
11418 filesList, |
10743 onFileChange, |
11419 onFileChange, |
10744 additionalData: { |
11420 additionalData: { |
10745 post: getCurrentPostId(), |
11421 post: getCurrentPostId(), |
10746 ...additionalData |
11422 ...additionalData |
10747 }, |
11423 }, |
10748 maxUploadFileSize, |
11424 maxUploadFileSize, |
10749 onError: ({ |
11425 onError: _ref2 => { |
10750 message |
11426 let { |
10751 }) => onError(message), |
11427 message |
11428 } = _ref2; |
|
11429 return onError(message); |
|
11430 }, |
|
10752 wpAllowedMimeTypes |
11431 wpAllowedMimeTypes |
10753 }); |
11432 }); |
10754 } |
11433 } |
10755 |
11434 |
10756 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js |
11435 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js |
10757 /** |
11436 /** |
10758 * External dependencies |
11437 * External dependencies |
10759 */ |
11438 */ |
10760 |
11439 |
10761 /** |
11440 /** |
10762 * WordPress dependencies |
11441 * WordPress dependencies |
10763 */ |
11442 */ |
11443 |
|
10764 |
11444 |
10765 |
11445 |
10766 |
11446 |
10767 |
11447 |
10768 /** |
11448 /** |
10779 * |
11459 * |
10780 * @return {Object} Block Editor Settings. |
11460 * @return {Object} Block Editor Settings. |
10781 */ |
11461 */ |
10782 |
11462 |
10783 function useBlockEditorSettings(settings, hasTemplate) { |
11463 function useBlockEditorSettings(settings, hasTemplate) { |
11464 var _settings$__experimen, _settings$__experimen2; |
|
11465 |
|
10784 const { |
11466 const { |
10785 reusableBlocks, |
11467 reusableBlocks, |
10786 hasUploadPermissions, |
11468 hasUploadPermissions, |
10787 canUseUnfilteredHTML, |
11469 canUseUnfilteredHTML, |
10788 isTitleSelected |
11470 userCanCreatePages, |
10789 } = Object(external_wp_data_["useSelect"])(select => { |
11471 pageOnFront |
11472 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
|
10790 const { |
11473 const { |
10791 canUserUseUnfilteredHTML, |
11474 canUserUseUnfilteredHTML |
10792 isPostTitleSelected |
11475 } = select(store_store); |
10793 } = select(store); |
11476 const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web'; |
10794 const { |
11477 const { |
10795 canUser |
11478 canUser, |
10796 } = select(external_wp_coreData_["store"]); |
11479 getEntityRecord |
11480 } = select(external_wp_coreData_namespaceObject.store); |
|
11481 const siteSettings = getEntityRecord('root', 'site'); |
|
10797 return { |
11482 return { |
10798 canUseUnfilteredHTML: canUserUseUnfilteredHTML(), |
11483 canUseUnfilteredHTML: canUserUseUnfilteredHTML(), |
10799 reusableBlocks: select(external_wp_coreData_["store"]).getEntityRecords('postType', 'wp_block', |
11484 reusableBlocks: isWeb ? select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_block', { |
10800 /** |
11485 per_page: -1 |
10801 * Unbounded queries are not supported on native so as a workaround, we set per_page with the maximum value that native version can handle. |
11486 }) : [], |
10802 * Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661 |
11487 // Reusable blocks are fetched in the native version of this hook. |
10803 */ |
11488 hasUploadPermissions: (0,external_lodash_namespaceObject.defaultTo)(canUser('create', 'media'), true), |
10804 { |
11489 userCanCreatePages: canUser('create', 'pages'), |
10805 per_page: external_wp_element_["Platform"].select({ |
11490 pageOnFront: siteSettings === null || siteSettings === void 0 ? void 0 : siteSettings.page_on_front |
10806 web: -1, |
|
10807 native: 100 |
|
10808 }) |
|
10809 }), |
|
10810 hasUploadPermissions: Object(external_lodash_["defaultTo"])(canUser('create', 'media'), true), |
|
10811 // This selector is only defined on mobile. |
|
10812 isTitleSelected: isPostTitleSelected && isPostTitleSelected() |
|
10813 }; |
11491 }; |
10814 }, []); |
11492 }, []); |
11493 const settingsBlockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : // WP 6.0 |
|
11494 settings.__experimentalBlockPatterns; // WP 5.9 |
|
11495 |
|
11496 const settingsBlockPatternCategories = (_settings$__experimen2 = settings.__experimentalAdditionalBlockPatternCategories) !== null && _settings$__experimen2 !== void 0 ? _settings$__experimen2 : // WP 6.0 |
|
11497 settings.__experimentalBlockPatternCategories; // WP 5.9 |
|
11498 |
|
11499 const { |
|
11500 restBlockPatterns, |
|
11501 restBlockPatternCategories |
|
11502 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ |
|
11503 restBlockPatterns: select(external_wp_coreData_namespaceObject.store).getBlockPatterns(), |
|
11504 restBlockPatternCategories: select(external_wp_coreData_namespaceObject.store).getBlockPatternCategories() |
|
11505 }), []); |
|
11506 const blockPatterns = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.unionBy)(settingsBlockPatterns, restBlockPatterns, 'name'), [settingsBlockPatterns, restBlockPatterns]); |
|
11507 const blockPatternCategories = (0,external_wp_element_namespaceObject.useMemo)(() => (0,external_lodash_namespaceObject.unionBy)(settingsBlockPatternCategories, restBlockPatternCategories, 'name'), [settingsBlockPatternCategories, restBlockPatternCategories]); |
|
10815 const { |
11508 const { |
10816 undo |
11509 undo |
10817 } = Object(external_wp_data_["useDispatch"])(store); |
11510 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
10818 return Object(external_wp_element_["useMemo"])(() => ({ ...Object(external_lodash_["pick"])(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatternCategories', '__experimentalBlockPatterns', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalGlobalStylesUserEntityId', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock']), |
11511 const { |
11512 saveEntityRecord |
|
11513 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store); |
|
11514 /** |
|
11515 * Creates a Post entity. |
|
11516 * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages. |
|
11517 * |
|
11518 * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord. |
|
11519 * @return {Object} the post type object that was created. |
|
11520 */ |
|
11521 |
|
11522 const createPageEntity = options => { |
|
11523 if (!userCanCreatePages) { |
|
11524 return Promise.reject({ |
|
11525 message: (0,external_wp_i18n_namespaceObject.__)('You do not have permission to create Pages.') |
|
11526 }); |
|
11527 } |
|
11528 |
|
11529 return saveEntityRecord('postType', 'page', options); |
|
11530 }; |
|
11531 |
|
11532 return (0,external_wp_element_namespaceObject.useMemo)(() => ({ ...(0,external_lodash_namespaceObject.pick)(settings, ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets']), |
|
10819 mediaUpload: hasUploadPermissions ? mediaUpload : undefined, |
11533 mediaUpload: hasUploadPermissions ? mediaUpload : undefined, |
10820 __experimentalReusableBlocks: reusableBlocks, |
11534 __experimentalReusableBlocks: reusableBlocks, |
10821 __experimentalFetchLinkSuggestions: (search, searchOptions) => Object(external_wp_coreData_["__experimentalFetchLinkSuggestions"])(search, searchOptions, settings), |
11535 __experimentalBlockPatterns: blockPatterns, |
10822 __experimentalFetchRemoteUrlData: url => Object(external_wp_coreData_["__experimentalFetchRemoteUrlData"])(url), |
11536 __experimentalBlockPatternCategories: blockPatternCategories, |
11537 __experimentalFetchLinkSuggestions: (search, searchOptions) => (0,external_wp_coreData_namespaceObject.__experimentalFetchLinkSuggestions)(search, searchOptions, settings), |
|
11538 __experimentalFetchRichUrlData: external_wp_coreData_namespaceObject.__experimentalFetchUrlData, |
|
10823 __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML, |
11539 __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML, |
10824 __experimentalUndo: undo, |
11540 __experimentalUndo: undo, |
10825 __experimentalShouldInsertAtTheTop: isTitleSelected, |
11541 outlineMode: hasTemplate, |
10826 outlineMode: hasTemplate |
11542 __experimentalCreatePageEntity: createPageEntity, |
10827 }), [settings, hasUploadPermissions, reusableBlocks, canUseUnfilteredHTML, undo, isTitleSelected, hasTemplate]); |
11543 __experimentalUserCanCreatePages: userCanCreatePages, |
11544 pageOnFront, |
|
11545 __experimentalPreferPatternsOnRoot: hasTemplate |
|
11546 }), [settings, hasUploadPermissions, reusableBlocks, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, hasTemplate, userCanCreatePages, pageOnFront]); |
|
10828 } |
11547 } |
10829 |
11548 |
10830 /* harmony default export */ var use_block_editor_settings = (useBlockEditorSettings); |
11549 /* harmony default export */ var use_block_editor_settings = (useBlockEditorSettings); |
10831 |
11550 |
10832 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js |
11551 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js |
10833 |
11552 |
10834 |
11553 |
10835 /** |
11554 /** |
10836 * WordPress dependencies |
11555 * WordPress dependencies |
10837 */ |
11556 */ |
10848 |
11567 |
10849 |
11568 |
10850 |
11569 |
10851 |
11570 |
10852 |
11571 |
10853 function EditorProvider({ |
11572 function EditorProvider(_ref) { |
10854 __unstableTemplate, |
11573 let { |
10855 post, |
11574 __unstableTemplate, |
10856 settings, |
11575 post, |
10857 recovery, |
11576 settings, |
10858 initialEdits, |
11577 recovery, |
10859 children |
11578 initialEdits, |
10860 }) { |
11579 children |
10861 const defaultBlockContext = Object(external_wp_element_["useMemo"])(() => { |
11580 } = _ref; |
11581 const defaultBlockContext = (0,external_wp_element_namespaceObject.useMemo)(() => { |
|
10862 if (post.type === 'wp_template') { |
11582 if (post.type === 'wp_template') { |
10863 return {}; |
11583 return {}; |
10864 } |
11584 } |
10865 |
11585 |
10866 return { |
11586 return { |
10869 }; |
11589 }; |
10870 }, [post.id, post.type]); |
11590 }, [post.id, post.type]); |
10871 const { |
11591 const { |
10872 selection, |
11592 selection, |
10873 isReady |
11593 isReady |
10874 } = Object(external_wp_data_["useSelect"])(select => { |
11594 } = (0,external_wp_data_namespaceObject.useSelect)(select => { |
10875 const { |
11595 const { |
10876 getEditorSelection, |
11596 getEditorSelection, |
10877 __unstableIsEditorReady |
11597 __unstableIsEditorReady |
10878 } = select(store); |
11598 } = select(store_store); |
10879 return { |
11599 return { |
10880 isReady: __unstableIsEditorReady(), |
11600 isReady: __unstableIsEditorReady(), |
10881 selection: getEditorSelection() |
11601 selection: getEditorSelection() |
10882 }; |
11602 }; |
10883 }, []); |
11603 }, []); |
10884 const { |
11604 const { |
10885 id, |
11605 id, |
10886 type |
11606 type |
10887 } = __unstableTemplate !== null && __unstableTemplate !== void 0 ? __unstableTemplate : post; |
11607 } = __unstableTemplate !== null && __unstableTemplate !== void 0 ? __unstableTemplate : post; |
10888 const [blocks, onInput, onChange] = Object(external_wp_coreData_["useEntityBlockEditor"])('postType', type, { |
11608 const [blocks, onInput, onChange] = (0,external_wp_coreData_namespaceObject.useEntityBlockEditor)('postType', type, { |
10889 id |
11609 id |
10890 }); |
11610 }); |
10891 const editorSettings = use_block_editor_settings(settings, !!__unstableTemplate); |
11611 const editorSettings = use_block_editor_settings(settings, !!__unstableTemplate); |
10892 const { |
11612 const { |
10893 updatePostLock, |
11613 updatePostLock, |
10894 setupEditor, |
11614 setupEditor, |
10895 updateEditorSettings, |
11615 updateEditorSettings, |
10896 __experimentalTearDownEditor |
11616 __experimentalTearDownEditor |
10897 } = Object(external_wp_data_["useDispatch"])(store); |
11617 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); |
10898 const { |
11618 const { |
10899 createWarningNotice |
11619 createWarningNotice |
10900 } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); // Iniitialize and tear down the editor. |
11620 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); // Initialize and tear down the editor. |
10901 // Ideally this should be synced on each change and not just something you do once. |
11621 // Ideally this should be synced on each change and not just something you do once. |
10902 |
11622 |
10903 Object(external_wp_element_["useLayoutEffect"])(() => { |
11623 (0,external_wp_element_namespaceObject.useLayoutEffect)(() => { |
10904 // Assume that we don't need to initialize in the case of an error recovery. |
11624 // Assume that we don't need to initialize in the case of an error recovery. |
10905 if (recovery) { |
11625 if (recovery) { |
10906 return; |
11626 return; |
10907 } |
11627 } |
10908 |
11628 |
10909 updatePostLock(settings.postLock); |
11629 updatePostLock(settings.postLock); |
10910 setupEditor(post, initialEdits, settings.template); |
11630 setupEditor(post, initialEdits, settings.template); |
10911 |
11631 |
10912 if (settings.autosave) { |
11632 if (settings.autosave) { |
10913 createWarningNotice(Object(external_wp_i18n_["__"])('There is an autosave of this post that is more recent than the version below.'), { |
11633 createWarningNotice((0,external_wp_i18n_namespaceObject.__)('There is an autosave of this post that is more recent than the version below.'), { |
10914 id: 'autosave-exists', |
11634 id: 'autosave-exists', |
10915 actions: [{ |
11635 actions: [{ |
10916 label: Object(external_wp_i18n_["__"])('View the autosave'), |
11636 label: (0,external_wp_i18n_namespaceObject.__)('View the autosave'), |
10917 url: settings.autosave.editLink |
11637 url: settings.autosave.editLink |
10918 }] |
11638 }] |
10919 }); |
11639 }); |
10920 } |
11640 } |
10921 |
11641 |
10922 return () => { |
11642 return () => { |
10923 __experimentalTearDownEditor(); |
11643 __experimentalTearDownEditor(); |
10924 }; |
11644 }; |
10925 }, []); // Synchronize the editor settings as they change |
11645 }, []); // Synchronize the editor settings as they change. |
10926 |
11646 |
10927 Object(external_wp_element_["useEffect"])(() => { |
11647 (0,external_wp_element_namespaceObject.useEffect)(() => { |
10928 updateEditorSettings(settings); |
11648 updateEditorSettings(settings); |
10929 }, [settings]); |
11649 }, [settings]); |
10930 |
11650 |
10931 if (!isReady) { |
11651 if (!isReady) { |
10932 return null; |
11652 return null; |
10933 } |
11653 } |
10934 |
11654 |
10935 return Object(external_wp_element_["createElement"])(external_wp_coreData_["EntityProvider"], { |
11655 return (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { |
10936 kind: "root", |
11656 kind: "root", |
10937 type: "site" |
11657 type: "site" |
10938 }, Object(external_wp_element_["createElement"])(external_wp_coreData_["EntityProvider"], { |
11658 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_coreData_namespaceObject.EntityProvider, { |
10939 kind: "postType", |
11659 kind: "postType", |
10940 type: post.type, |
11660 type: post.type, |
10941 id: post.id |
11661 id: post.id |
10942 }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockContextProvider"], { |
11662 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockContextProvider, { |
10943 value: defaultBlockContext |
11663 value: defaultBlockContext |
10944 }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorProvider"], { |
11664 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockEditorProvider, { |
10945 value: blocks, |
11665 value: blocks, |
10946 onChange: onChange, |
11666 onChange: onChange, |
10947 onInput: onInput, |
11667 onInput: onInput, |
10948 selection: selection, |
11668 selection: selection, |
10949 settings: editorSettings, |
11669 settings: editorSettings, |
10950 useSubRegistry: false |
11670 useSubRegistry: false |
10951 }, children, Object(external_wp_element_["createElement"])(external_wp_reusableBlocks_["ReusableBlocksMenuItems"], null))))); |
11671 }, children, (0,external_wp_element_namespaceObject.createElement)(external_wp_reusableBlocks_namespaceObject.ReusableBlocksMenuItems, null))))); |
10952 } |
11672 } |
10953 |
11673 |
10954 /* harmony default export */ var provider = (with_registry_provider(EditorProvider)); |
11674 /* harmony default export */ var provider = (with_registry_provider(EditorProvider)); |
10955 |
11675 |
10956 // EXTERNAL MODULE: external ["wp","serverSideRender"] |
11676 ;// CONCATENATED MODULE: external ["wp","serverSideRender"] |
10957 var external_wp_serverSideRender_ = __webpack_require__("JREk"); |
11677 var external_wp_serverSideRender_namespaceObject = window["wp"]["serverSideRender"]; |
10958 var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_); |
11678 var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_namespaceObject); |
10959 |
11679 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js |
10960 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js |
11680 |
10961 |
11681 |
10962 |
11682 // Block Creation Components. |
10963 // Block Creation Components |
|
10964 |
11683 |
10965 /** |
11684 /** |
10966 * WordPress dependencies |
11685 * WordPress dependencies |
10967 */ |
11686 */ |
10968 |
11687 |
10969 |
11688 |
10970 |
11689 |
10971 |
11690 |
10972 |
11691 |
10973 function deprecateComponent(name, Wrapped, staticsToHoist = []) { |
11692 function deprecateComponent(name, Wrapped) { |
10974 const Component = Object(external_wp_element_["forwardRef"])((props, ref) => { |
11693 let staticsToHoist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; |
11694 const Component = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => { |
|
10975 external_wp_deprecated_default()('wp.editor.' + name, { |
11695 external_wp_deprecated_default()('wp.editor.' + name, { |
10976 since: '5.3', |
11696 since: '5.3', |
10977 alternative: 'wp.blockEditor.' + name |
11697 alternative: 'wp.blockEditor.' + name, |
11698 version: '6.2' |
|
10978 }); |
11699 }); |
10979 return Object(external_wp_element_["createElement"])(Wrapped, Object(esm_extends["a" /* default */])({ |
11700 return (0,external_wp_element_namespaceObject.createElement)(Wrapped, _extends({ |
10980 ref: ref |
11701 ref: ref |
10981 }, props)); |
11702 }, props)); |
10982 }); |
11703 }); |
10983 staticsToHoist.forEach(staticName => { |
11704 staticsToHoist.forEach(staticName => { |
10984 Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]); |
11705 Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]); |
10985 }); |
11706 }); |
10986 return Component; |
11707 return Component; |
10987 } |
11708 } |
10988 |
11709 |
10989 function deprecateFunction(name, func) { |
11710 function deprecateFunction(name, func) { |
10990 return (...args) => { |
11711 return function () { |
10991 external_wp_deprecated_default()('wp.editor.' + name, { |
11712 external_wp_deprecated_default()('wp.editor.' + name, { |
10992 since: '5.3', |
11713 since: '5.3', |
10993 alternative: 'wp.blockEditor.' + name |
11714 alternative: 'wp.blockEditor.' + name, |
11715 version: '6.2' |
|
10994 }); |
11716 }); |
10995 return func(...args); |
11717 return func(...arguments); |
10996 }; |
11718 }; |
10997 } |
11719 } |
10998 |
11720 |
10999 const RichText = deprecateComponent('RichText', external_wp_blockEditor_["RichText"], ['Content']); |
11721 const RichText = deprecateComponent('RichText', external_wp_blockEditor_namespaceObject.RichText, ['Content']); |
11000 RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_["RichText"].isEmpty); |
11722 RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_namespaceObject.RichText.isEmpty); |
11001 |
11723 |
11002 const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_["Autocomplete"]); |
11724 const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_namespaceObject.Autocomplete); |
11003 const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_["AlignmentToolbar"]); |
11725 const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_namespaceObject.AlignmentToolbar); |
11004 const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_["BlockAlignmentToolbar"]); |
11726 const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_namespaceObject.BlockAlignmentToolbar); |
11005 const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_["BlockControls"], ['Slot']); |
11727 const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_namespaceObject.BlockControls, ['Slot']); |
11006 const deprecated_BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_["BlockEdit"]); |
11728 const BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_namespaceObject.BlockEdit); |
11007 const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_["BlockEditorKeyboardShortcuts"]); |
11729 const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_namespaceObject.BlockEditorKeyboardShortcuts); |
11008 const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_["BlockFormatControls"], ['Slot']); |
11730 const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_namespaceObject.BlockFormatControls, ['Slot']); |
11009 const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_["BlockIcon"]); |
11731 const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_namespaceObject.BlockIcon); |
11010 const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_["BlockInspector"]); |
11732 const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_namespaceObject.BlockInspector); |
11011 const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_["BlockList"]); |
11733 const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_namespaceObject.BlockList); |
11012 const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_["BlockMover"]); |
11734 const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_namespaceObject.BlockMover); |
11013 const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_["BlockNavigationDropdown"]); |
11735 const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_namespaceObject.BlockNavigationDropdown); |
11014 const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_["BlockSelectionClearer"]); |
11736 const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_namespaceObject.BlockSelectionClearer); |
11015 const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_["BlockSettingsMenu"]); |
11737 const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_namespaceObject.BlockSettingsMenu); |
11016 const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_["BlockTitle"]); |
11738 const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_namespaceObject.BlockTitle); |
11017 const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_["BlockToolbar"]); |
11739 const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_namespaceObject.BlockToolbar); |
11018 const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_["ColorPalette"]); |
11740 const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_namespaceObject.ColorPalette); |
11019 const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_["ContrastChecker"]); |
11741 const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_namespaceObject.ContrastChecker); |
11020 const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_["CopyHandler"]); |
11742 const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_namespaceObject.CopyHandler); |
11021 const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_["DefaultBlockAppender"]); |
11743 const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_namespaceObject.DefaultBlockAppender); |
11022 const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_["FontSizePicker"]); |
11744 const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_namespaceObject.FontSizePicker); |
11023 const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_["Inserter"]); |
11745 const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_namespaceObject.Inserter); |
11024 const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_["InnerBlocks"], ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']); |
11746 const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_namespaceObject.InnerBlocks, ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']); |
11025 const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_["InspectorAdvancedControls"], ['Slot']); |
11747 const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_namespaceObject.InspectorAdvancedControls, ['Slot']); |
11026 const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_["InspectorControls"], ['Slot']); |
11748 const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_namespaceObject.InspectorControls, ['Slot']); |
11027 const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_["PanelColorSettings"]); |
11749 const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_namespaceObject.PanelColorSettings); |
11028 const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_["PlainText"]); |
11750 const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_namespaceObject.PlainText); |
11029 const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_["RichTextShortcut"]); |
11751 const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_namespaceObject.RichTextShortcut); |
11030 const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_["RichTextToolbarButton"]); |
11752 const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_namespaceObject.RichTextToolbarButton); |
11031 const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_["__unstableRichTextInputEvent"]); |
11753 const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_namespaceObject.__unstableRichTextInputEvent); |
11032 const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_["MediaPlaceholder"]); |
11754 const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_namespaceObject.MediaPlaceholder); |
11033 const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_["MediaUpload"]); |
11755 const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_namespaceObject.MediaUpload); |
11034 const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_["MediaUploadCheck"]); |
11756 const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_namespaceObject.MediaUploadCheck); |
11035 const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_["MultiSelectScrollIntoView"]); |
11757 const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_namespaceObject.MultiSelectScrollIntoView); |
11036 const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_["NavigableToolbar"]); |
11758 const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_namespaceObject.NavigableToolbar); |
11037 const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_["ObserveTyping"]); |
11759 const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_namespaceObject.ObserveTyping); |
11038 const PreserveScrollInReorder = deprecateComponent('PreserveScrollInReorder', external_wp_blockEditor_["PreserveScrollInReorder"]); |
11760 const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_namespaceObject.SkipToSelectedBlock); |
11039 const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_["SkipToSelectedBlock"]); |
11761 const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_namespaceObject.URLInput); |
11040 const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_["URLInput"]); |
11762 const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_namespaceObject.URLInputButton); |
11041 const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_["URLInputButton"]); |
11763 const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_namespaceObject.URLPopover); |
11042 const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_["URLPopover"]); |
11764 const Warning = deprecateComponent('Warning', external_wp_blockEditor_namespaceObject.Warning); |
11043 const Warning = deprecateComponent('Warning', external_wp_blockEditor_["Warning"]); |
11765 const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_namespaceObject.WritingFlow); |
11044 const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_["WritingFlow"]); |
11766 const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_namespaceObject.createCustomColorsHOC); |
11045 const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_["createCustomColorsHOC"]); |
11767 const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_namespaceObject.getColorClassName); |
11046 const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_["getColorClassName"]); |
11768 const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_namespaceObject.getColorObjectByAttributeValues); |
11047 const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_["getColorObjectByAttributeValues"]); |
11769 const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_namespaceObject.getColorObjectByColorValue); |
11048 const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_["getColorObjectByColorValue"]); |
11770 const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_namespaceObject.getFontSize); |
11049 const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_["getFontSize"]); |
11771 const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_namespaceObject.getFontSizeClass); |
11050 const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_["getFontSizeClass"]); |
11772 const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_namespaceObject.withColorContext); |
11051 const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_["withColorContext"]); |
11773 const withColors = deprecateFunction('withColors', external_wp_blockEditor_namespaceObject.withColors); |
11052 const withColors = deprecateFunction('withColors', external_wp_blockEditor_["withColors"]); |
11774 const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_namespaceObject.withFontSizes); |
11053 const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_["withFontSizes"]); |
11775 |
11054 |
11776 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js |
11055 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js |
11777 // Block Creation Components. |
11056 // Block Creation Components |
11778 // Post Related Components. |
11057 // Post Related Components |
11779 |
11058 |
11780 |
11059 |
11781 |
11060 |
11782 |
11061 |
11783 |
11062 |
11784 |
11063 |
11785 |
11064 |
11786 |
11065 |
11787 |
11066 |
11788 |
11067 |
11789 |
11068 |
11790 |
11069 |
11791 |
11070 |
11792 |
11071 |
11793 |
11072 |
11794 |
11073 |
11795 |
11074 |
11796 |
11075 |
11797 |
11076 |
11798 |
11077 |
11799 |
11078 |
11800 |
11079 |
11801 |
11080 |
11802 |
11081 |
11803 |
11082 |
11804 |
11083 |
11805 |
11084 |
11806 |
11085 |
11807 |
11086 |
11808 |
11087 |
11809 |
11088 |
11810 |
11089 |
11811 |
11090 |
11812 |
11091 |
11813 |
11092 |
11814 |
11093 |
11815 |
11094 |
11816 |
11095 |
11817 |
11096 |
11818 |
11097 |
11819 |
11098 |
11820 |
11099 |
11821 |
11100 |
11822 |
11101 |
11823 |
11102 |
11824 |
11103 |
11825 |
11104 |
11826 |
11105 |
11827 |
11106 |
11828 |
11107 |
11829 |
11108 |
11830 |
11109 |
11831 |
11110 |
11832 |
11111 |
11833 |
11112 |
11834 |
11113 |
11835 |
11114 |
11836 |
11115 |
11837 |
11116 // State Related Components |
11838 |
11117 |
11839 |
11118 |
11840 // State Related Components. |
11119 |
11841 |
11120 |
11842 |
11121 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js |
11843 |
11844 |
|
11845 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js |
|
11846 /** |
|
11847 * WordPress dependencies |
|
11848 */ |
|
11849 |
|
11850 |
|
11851 /** |
|
11852 * Performs some basic cleanup of a string for use as a post slug |
|
11853 * |
|
11854 * This replicates some of what sanitize_title() does in WordPress core, but |
|
11855 * is only designed to approximate what the slug will be. |
|
11856 * |
|
11857 * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters. |
|
11858 * Removes combining diacritical marks. Converts whitespace, periods, |
|
11859 * and forward slashes to hyphens. Removes any remaining non-word characters |
|
11860 * except hyphens and underscores. Converts remaining string to lowercase. |
|
11861 * It does not account for octets, HTML entities, or other encoded characters. |
|
11862 * |
|
11863 * @param {string} string Title or slug to be processed |
|
11864 * |
|
11865 * @return {string} Processed string |
|
11866 */ |
|
11867 |
|
11868 function cleanForSlug(string) { |
|
11869 external_wp_deprecated_default()('wp.editor.cleanForSlug', { |
|
11870 since: '12.7', |
|
11871 plugin: 'Gutenberg', |
|
11872 alternative: 'wp.url.cleanForSlug' |
|
11873 }); |
|
11874 return (0,external_wp_url_namespaceObject.cleanForSlug)(string); |
|
11875 } |
|
11876 |
|
11877 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js |
|
11122 /** |
11878 /** |
11123 * Internal dependencies |
11879 * Internal dependencies |
11124 */ |
11880 */ |
11125 |
11881 |
11126 |
11882 |
11127 |
11883 |
11128 |
11884 |
11129 // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js |
11885 |
11130 /** |
11886 ;// CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js |
11131 * WordPress dependencies |
|
11132 */ |
|
11133 |
|
11134 |
|
11135 |
|
11136 /** |
11887 /** |
11137 * Internal dependencies |
11888 * Internal dependencies |
11138 */ |
11889 */ |
11139 |
|
11140 |
11890 |
11141 |
11891 |
11142 |
11892 |
11143 |
11893 |
11144 /* |
11894 /* |
11145 * Backward compatibility |
11895 * Backward compatibility |
11146 */ |
11896 */ |
11147 |
11897 |
11148 |
11898 |
11149 |
11899 |
11150 |
11900 }(); |
11151 /***/ }), |
11901 (window.wp = window.wp || {}).editor = __webpack_exports__; |
11152 |
11902 /******/ })() |
11153 /***/ "RMJe": |
11903 ; |
11154 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
11155 |
|
11156 "use strict"; |
|
11157 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
11158 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
11159 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
11160 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
11161 |
|
11162 |
|
11163 /** |
|
11164 * WordPress dependencies |
|
11165 */ |
|
11166 |
|
11167 const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
11168 xmlns: "http://www.w3.org/2000/svg", |
|
11169 viewBox: "0 0 24 24" |
|
11170 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
11171 d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z" |
|
11172 })); |
|
11173 /* harmony default export */ __webpack_exports__["a"] = (check); |
|
11174 |
|
11175 |
|
11176 /***/ }), |
|
11177 |
|
11178 /***/ "Rk8H": |
|
11179 /***/ (function(module, exports, __webpack_require__) { |
|
11180 |
|
11181 // Load in dependencies |
|
11182 var computedStyle = __webpack_require__("jTPX"); |
|
11183 |
|
11184 /** |
|
11185 * Calculate the `line-height` of a given node |
|
11186 * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM. |
|
11187 * @returns {Number} `line-height` of the element in pixels |
|
11188 */ |
|
11189 function lineHeight(node) { |
|
11190 // Grab the line-height via style |
|
11191 var lnHeightStr = computedStyle(node, 'line-height'); |
|
11192 var lnHeight = parseFloat(lnHeightStr, 10); |
|
11193 |
|
11194 // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em') |
|
11195 if (lnHeightStr === lnHeight + '') { |
|
11196 // Save the old lineHeight style and update the em unit to the element |
|
11197 var _lnHeightStyle = node.style.lineHeight; |
|
11198 node.style.lineHeight = lnHeightStr + 'em'; |
|
11199 |
|
11200 // Calculate the em based height |
|
11201 lnHeightStr = computedStyle(node, 'line-height'); |
|
11202 lnHeight = parseFloat(lnHeightStr, 10); |
|
11203 |
|
11204 // Revert the lineHeight style |
|
11205 if (_lnHeightStyle) { |
|
11206 node.style.lineHeight = _lnHeightStyle; |
|
11207 } else { |
|
11208 delete node.style.lineHeight; |
|
11209 } |
|
11210 } |
|
11211 |
|
11212 // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt) |
|
11213 // DEV: `em` units are converted to `pt` in IE6 |
|
11214 // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length |
|
11215 if (lnHeightStr.indexOf('pt') !== -1) { |
|
11216 lnHeight *= 4; |
|
11217 lnHeight /= 3; |
|
11218 // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm) |
|
11219 } else if (lnHeightStr.indexOf('mm') !== -1) { |
|
11220 lnHeight *= 96; |
|
11221 lnHeight /= 25.4; |
|
11222 // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm) |
|
11223 } else if (lnHeightStr.indexOf('cm') !== -1) { |
|
11224 lnHeight *= 96; |
|
11225 lnHeight /= 2.54; |
|
11226 // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in) |
|
11227 } else if (lnHeightStr.indexOf('in') !== -1) { |
|
11228 lnHeight *= 96; |
|
11229 // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc) |
|
11230 } else if (lnHeightStr.indexOf('pc') !== -1) { |
|
11231 lnHeight *= 16; |
|
11232 } |
|
11233 |
|
11234 // Continue our computation |
|
11235 lnHeight = Math.round(lnHeight); |
|
11236 |
|
11237 // If the line-height is "normal", calculate by font-size |
|
11238 if (lnHeightStr === 'normal') { |
|
11239 // Create a temporary node |
|
11240 var nodeName = node.nodeName; |
|
11241 var _node = document.createElement(nodeName); |
|
11242 _node.innerHTML = ' '; |
|
11243 |
|
11244 // If we have a text area, reset it to only 1 row |
|
11245 // https://github.com/twolfson/line-height/issues/4 |
|
11246 if (nodeName.toUpperCase() === 'TEXTAREA') { |
|
11247 _node.setAttribute('rows', '1'); |
|
11248 } |
|
11249 |
|
11250 // Set the font-size of the element |
|
11251 var fontSizeStr = computedStyle(node, 'font-size'); |
|
11252 _node.style.fontSize = fontSizeStr; |
|
11253 |
|
11254 // Remove default padding/border which can affect offset height |
|
11255 // https://github.com/twolfson/line-height/issues/4 |
|
11256 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight |
|
11257 _node.style.padding = '0px'; |
|
11258 _node.style.border = '0px'; |
|
11259 |
|
11260 // Append it to the body |
|
11261 var body = document.body; |
|
11262 body.appendChild(_node); |
|
11263 |
|
11264 // Assume the line height of the element is the height |
|
11265 var height = _node.offsetHeight; |
|
11266 lnHeight = height; |
|
11267 |
|
11268 // Remove our child from the DOM |
|
11269 body.removeChild(_node); |
|
11270 } |
|
11271 |
|
11272 // Return the calculated height |
|
11273 return lnHeight; |
|
11274 } |
|
11275 |
|
11276 // Export lineHeight |
|
11277 module.exports = lineHeight; |
|
11278 |
|
11279 |
|
11280 /***/ }), |
|
11281 |
|
11282 /***/ "RxS6": |
|
11283 /***/ (function(module, exports) { |
|
11284 |
|
11285 (function() { module.exports = window["wp"]["keycodes"]; }()); |
|
11286 |
|
11287 /***/ }), |
|
11288 |
|
11289 /***/ "TSYQ": |
|
11290 /***/ (function(module, exports, __webpack_require__) { |
|
11291 |
|
11292 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
11293 Copyright (c) 2018 Jed Watson. |
|
11294 Licensed under the MIT License (MIT), see |
|
11295 http://jedwatson.github.io/classnames |
|
11296 */ |
|
11297 /* global define */ |
|
11298 |
|
11299 (function () { |
|
11300 'use strict'; |
|
11301 |
|
11302 var hasOwn = {}.hasOwnProperty; |
|
11303 |
|
11304 function classNames() { |
|
11305 var classes = []; |
|
11306 |
|
11307 for (var i = 0; i < arguments.length; i++) { |
|
11308 var arg = arguments[i]; |
|
11309 if (!arg) continue; |
|
11310 |
|
11311 var argType = typeof arg; |
|
11312 |
|
11313 if (argType === 'string' || argType === 'number') { |
|
11314 classes.push(arg); |
|
11315 } else if (Array.isArray(arg)) { |
|
11316 if (arg.length) { |
|
11317 var inner = classNames.apply(null, arg); |
|
11318 if (inner) { |
|
11319 classes.push(inner); |
|
11320 } |
|
11321 } |
|
11322 } else if (argType === 'object') { |
|
11323 if (arg.toString === Object.prototype.toString) { |
|
11324 for (var key in arg) { |
|
11325 if (hasOwn.call(arg, key) && arg[key]) { |
|
11326 classes.push(key); |
|
11327 } |
|
11328 } |
|
11329 } else { |
|
11330 classes.push(arg.toString()); |
|
11331 } |
|
11332 } |
|
11333 } |
|
11334 |
|
11335 return classes.join(' '); |
|
11336 } |
|
11337 |
|
11338 if ( true && module.exports) { |
|
11339 classNames.default = classNames; |
|
11340 module.exports = classNames; |
|
11341 } else if (true) { |
|
11342 // register as 'classnames', consistent with npm package name |
|
11343 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { |
|
11344 return classNames; |
|
11345 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
|
11346 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
11347 } else {} |
|
11348 }()); |
|
11349 |
|
11350 |
|
11351 /***/ }), |
|
11352 |
|
11353 /***/ "Tqx9": |
|
11354 /***/ (function(module, exports) { |
|
11355 |
|
11356 (function() { module.exports = window["wp"]["primitives"]; }()); |
|
11357 |
|
11358 /***/ }), |
|
11359 |
|
11360 /***/ "WbBG": |
|
11361 /***/ (function(module, exports, __webpack_require__) { |
|
11362 |
|
11363 "use strict"; |
|
11364 /** |
|
11365 * Copyright (c) 2013-present, Facebook, Inc. |
|
11366 * |
|
11367 * This source code is licensed under the MIT license found in the |
|
11368 * LICENSE file in the root directory of this source tree. |
|
11369 */ |
|
11370 |
|
11371 |
|
11372 |
|
11373 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; |
|
11374 |
|
11375 module.exports = ReactPropTypesSecret; |
|
11376 |
|
11377 |
|
11378 /***/ }), |
|
11379 |
|
11380 /***/ "YLtl": |
|
11381 /***/ (function(module, exports) { |
|
11382 |
|
11383 (function() { module.exports = window["lodash"]; }()); |
|
11384 |
|
11385 /***/ }), |
|
11386 |
|
11387 /***/ "axFQ": |
|
11388 /***/ (function(module, exports) { |
|
11389 |
|
11390 (function() { module.exports = window["wp"]["blockEditor"]; }()); |
|
11391 |
|
11392 /***/ }), |
|
11393 |
|
11394 /***/ "bWcr": |
|
11395 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
11396 |
|
11397 "use strict"; |
|
11398 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
11399 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
11400 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
11401 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
11402 |
|
11403 |
|
11404 /** |
|
11405 * WordPress dependencies |
|
11406 */ |
|
11407 |
|
11408 const closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
11409 xmlns: "http://www.w3.org/2000/svg", |
|
11410 viewBox: "0 0 24 24" |
|
11411 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
11412 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" |
|
11413 })); |
|
11414 /* harmony default export */ __webpack_exports__["a"] = (closeSmall); |
|
11415 |
|
11416 |
|
11417 /***/ }), |
|
11418 |
|
11419 /***/ "cDcd": |
|
11420 /***/ (function(module, exports) { |
|
11421 |
|
11422 (function() { module.exports = window["React"]; }()); |
|
11423 |
|
11424 /***/ }), |
|
11425 |
|
11426 /***/ "diJD": |
|
11427 /***/ (function(module, exports) { |
|
11428 |
|
11429 (function() { module.exports = window["wp"]["reusableBlocks"]; }()); |
|
11430 |
|
11431 /***/ }), |
|
11432 |
|
11433 /***/ "g56x": |
|
11434 /***/ (function(module, exports) { |
|
11435 |
|
11436 (function() { module.exports = window["wp"]["hooks"]; }()); |
|
11437 |
|
11438 /***/ }), |
|
11439 |
|
11440 /***/ "hF7m": |
|
11441 /***/ (function(module, exports) { |
|
11442 |
|
11443 (function() { module.exports = window["wp"]["keyboardShortcuts"]; }()); |
|
11444 |
|
11445 /***/ }), |
|
11446 |
|
11447 /***/ "iClF": |
|
11448 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
11449 |
|
11450 "use strict"; |
|
11451 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
11452 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
11453 /** |
|
11454 * WordPress dependencies |
|
11455 */ |
|
11456 |
|
11457 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ |
|
11458 |
|
11459 /** |
|
11460 * Return an SVG icon. |
|
11461 * |
|
11462 * @param {IconProps} props icon is the SVG component to render |
|
11463 * size is a number specifiying the icon size in pixels |
|
11464 * Other props will be passed to wrapped SVG component |
|
11465 * |
|
11466 * @return {JSX.Element} Icon component |
|
11467 */ |
|
11468 |
|
11469 function Icon({ |
|
11470 icon, |
|
11471 size = 24, |
|
11472 ...props |
|
11473 }) { |
|
11474 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, { |
|
11475 width: size, |
|
11476 height: size, |
|
11477 ...props |
|
11478 }); |
|
11479 } |
|
11480 |
|
11481 /* harmony default export */ __webpack_exports__["a"] = (Icon); |
|
11482 |
|
11483 |
|
11484 /***/ }), |
|
11485 |
|
11486 /***/ "jTPX": |
|
11487 /***/ (function(module, exports) { |
|
11488 |
|
11489 // This code has been refactored for 140 bytes |
|
11490 // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js |
|
11491 var computedStyle = function (el, prop, getComputedStyle) { |
|
11492 getComputedStyle = window.getComputedStyle; |
|
11493 |
|
11494 // In one fell swoop |
|
11495 return ( |
|
11496 // If we have getComputedStyle |
|
11497 getComputedStyle ? |
|
11498 // Query it |
|
11499 // TODO: From CSS-Query notes, we might need (node, null) for FF |
|
11500 getComputedStyle(el) : |
|
11501 |
|
11502 // Otherwise, we are in IE and use currentStyle |
|
11503 el.currentStyle |
|
11504 )[ |
|
11505 // Switch to camelCase for CSSOM |
|
11506 // DEV: Grabbed from jQuery |
|
11507 // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194 |
|
11508 // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597 |
|
11509 prop.replace(/-(\w)/gi, function (word, letter) { |
|
11510 return letter.toUpperCase(); |
|
11511 }) |
|
11512 ]; |
|
11513 }; |
|
11514 |
|
11515 module.exports = computedStyle; |
|
11516 |
|
11517 |
|
11518 /***/ }), |
|
11519 |
|
11520 /***/ "jZUy": |
|
11521 /***/ (function(module, exports) { |
|
11522 |
|
11523 (function() { module.exports = window["wp"]["coreData"]; }()); |
|
11524 |
|
11525 /***/ }), |
|
11526 |
|
11527 /***/ "l3Sj": |
|
11528 /***/ (function(module, exports) { |
|
11529 |
|
11530 (function() { module.exports = window["wp"]["i18n"]; }()); |
|
11531 |
|
11532 /***/ }), |
|
11533 |
|
11534 /***/ "onLe": |
|
11535 /***/ (function(module, exports) { |
|
11536 |
|
11537 (function() { module.exports = window["wp"]["notices"]; }()); |
|
11538 |
|
11539 /***/ }), |
|
11540 |
|
11541 /***/ "pPDe": |
|
11542 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
11543 |
|
11544 "use strict"; |
|
11545 |
|
11546 |
|
11547 var LEAF_KEY, hasWeakMap; |
|
11548 |
|
11549 /** |
|
11550 * Arbitrary value used as key for referencing cache object in WeakMap tree. |
|
11551 * |
|
11552 * @type {Object} |
|
11553 */ |
|
11554 LEAF_KEY = {}; |
|
11555 |
|
11556 /** |
|
11557 * Whether environment supports WeakMap. |
|
11558 * |
|
11559 * @type {boolean} |
|
11560 */ |
|
11561 hasWeakMap = typeof WeakMap !== 'undefined'; |
|
11562 |
|
11563 /** |
|
11564 * Returns the first argument as the sole entry in an array. |
|
11565 * |
|
11566 * @param {*} value Value to return. |
|
11567 * |
|
11568 * @return {Array} Value returned as entry in array. |
|
11569 */ |
|
11570 function arrayOf( value ) { |
|
11571 return [ value ]; |
|
11572 } |
|
11573 |
|
11574 /** |
|
11575 * Returns true if the value passed is object-like, or false otherwise. A value |
|
11576 * is object-like if it can support property assignment, e.g. object or array. |
|
11577 * |
|
11578 * @param {*} value Value to test. |
|
11579 * |
|
11580 * @return {boolean} Whether value is object-like. |
|
11581 */ |
|
11582 function isObjectLike( value ) { |
|
11583 return !! value && 'object' === typeof value; |
|
11584 } |
|
11585 |
|
11586 /** |
|
11587 * Creates and returns a new cache object. |
|
11588 * |
|
11589 * @return {Object} Cache object. |
|
11590 */ |
|
11591 function createCache() { |
|
11592 var cache = { |
|
11593 clear: function() { |
|
11594 cache.head = null; |
|
11595 }, |
|
11596 }; |
|
11597 |
|
11598 return cache; |
|
11599 } |
|
11600 |
|
11601 /** |
|
11602 * Returns true if entries within the two arrays are strictly equal by |
|
11603 * reference from a starting index. |
|
11604 * |
|
11605 * @param {Array} a First array. |
|
11606 * @param {Array} b Second array. |
|
11607 * @param {number} fromIndex Index from which to start comparison. |
|
11608 * |
|
11609 * @return {boolean} Whether arrays are shallowly equal. |
|
11610 */ |
|
11611 function isShallowEqual( a, b, fromIndex ) { |
|
11612 var i; |
|
11613 |
|
11614 if ( a.length !== b.length ) { |
|
11615 return false; |
|
11616 } |
|
11617 |
|
11618 for ( i = fromIndex; i < a.length; i++ ) { |
|
11619 if ( a[ i ] !== b[ i ] ) { |
|
11620 return false; |
|
11621 } |
|
11622 } |
|
11623 |
|
11624 return true; |
|
11625 } |
|
11626 |
|
11627 /** |
|
11628 * Returns a memoized selector function. The getDependants function argument is |
|
11629 * called before the memoized selector and is expected to return an immutable |
|
11630 * reference or array of references on which the selector depends for computing |
|
11631 * its own return value. The memoize cache is preserved only as long as those |
|
11632 * dependant references remain the same. If getDependants returns a different |
|
11633 * reference(s), the cache is cleared and the selector value regenerated. |
|
11634 * |
|
11635 * @param {Function} selector Selector function. |
|
11636 * @param {Function} getDependants Dependant getter returning an immutable |
|
11637 * reference or array of reference used in |
|
11638 * cache bust consideration. |
|
11639 * |
|
11640 * @return {Function} Memoized selector. |
|
11641 */ |
|
11642 /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) { |
|
11643 var rootCache, getCache; |
|
11644 |
|
11645 // Use object source as dependant if getter not provided |
|
11646 if ( ! getDependants ) { |
|
11647 getDependants = arrayOf; |
|
11648 } |
|
11649 |
|
11650 /** |
|
11651 * Returns the root cache. If WeakMap is supported, this is assigned to the |
|
11652 * root WeakMap cache set, otherwise it is a shared instance of the default |
|
11653 * cache object. |
|
11654 * |
|
11655 * @return {(WeakMap|Object)} Root cache object. |
|
11656 */ |
|
11657 function getRootCache() { |
|
11658 return rootCache; |
|
11659 } |
|
11660 |
|
11661 /** |
|
11662 * Returns the cache for a given dependants array. When possible, a WeakMap |
|
11663 * will be used to create a unique cache for each set of dependants. This |
|
11664 * is feasible due to the nature of WeakMap in allowing garbage collection |
|
11665 * to occur on entries where the key object is no longer referenced. Since |
|
11666 * WeakMap requires the key to be an object, this is only possible when the |
|
11667 * dependant is object-like. The root cache is created as a hierarchy where |
|
11668 * each top-level key is the first entry in a dependants set, the value a |
|
11669 * WeakMap where each key is the next dependant, and so on. This continues |
|
11670 * so long as the dependants are object-like. If no dependants are object- |
|
11671 * like, then the cache is shared across all invocations. |
|
11672 * |
|
11673 * @see isObjectLike |
|
11674 * |
|
11675 * @param {Array} dependants Selector dependants. |
|
11676 * |
|
11677 * @return {Object} Cache object. |
|
11678 */ |
|
11679 function getWeakMapCache( dependants ) { |
|
11680 var caches = rootCache, |
|
11681 isUniqueByDependants = true, |
|
11682 i, dependant, map, cache; |
|
11683 |
|
11684 for ( i = 0; i < dependants.length; i++ ) { |
|
11685 dependant = dependants[ i ]; |
|
11686 |
|
11687 // Can only compose WeakMap from object-like key. |
|
11688 if ( ! isObjectLike( dependant ) ) { |
|
11689 isUniqueByDependants = false; |
|
11690 break; |
|
11691 } |
|
11692 |
|
11693 // Does current segment of cache already have a WeakMap? |
|
11694 if ( caches.has( dependant ) ) { |
|
11695 // Traverse into nested WeakMap. |
|
11696 caches = caches.get( dependant ); |
|
11697 } else { |
|
11698 // Create, set, and traverse into a new one. |
|
11699 map = new WeakMap(); |
|
11700 caches.set( dependant, map ); |
|
11701 caches = map; |
|
11702 } |
|
11703 } |
|
11704 |
|
11705 // We use an arbitrary (but consistent) object as key for the last item |
|
11706 // in the WeakMap to serve as our running cache. |
|
11707 if ( ! caches.has( LEAF_KEY ) ) { |
|
11708 cache = createCache(); |
|
11709 cache.isUniqueByDependants = isUniqueByDependants; |
|
11710 caches.set( LEAF_KEY, cache ); |
|
11711 } |
|
11712 |
|
11713 return caches.get( LEAF_KEY ); |
|
11714 } |
|
11715 |
|
11716 // Assign cache handler by availability of WeakMap |
|
11717 getCache = hasWeakMap ? getWeakMapCache : getRootCache; |
|
11718 |
|
11719 /** |
|
11720 * Resets root memoization cache. |
|
11721 */ |
|
11722 function clear() { |
|
11723 rootCache = hasWeakMap ? new WeakMap() : createCache(); |
|
11724 } |
|
11725 |
|
11726 // eslint-disable-next-line jsdoc/check-param-names |
|
11727 /** |
|
11728 * The augmented selector call, considering first whether dependants have |
|
11729 * changed before passing it to underlying memoize function. |
|
11730 * |
|
11731 * @param {Object} source Source object for derivation. |
|
11732 * @param {...*} extraArgs Additional arguments to pass to selector. |
|
11733 * |
|
11734 * @return {*} Selector result. |
|
11735 */ |
|
11736 function callSelector( /* source, ...extraArgs */ ) { |
|
11737 var len = arguments.length, |
|
11738 cache, node, i, args, dependants; |
|
11739 |
|
11740 // Create copy of arguments (avoid leaking deoptimization). |
|
11741 args = new Array( len ); |
|
11742 for ( i = 0; i < len; i++ ) { |
|
11743 args[ i ] = arguments[ i ]; |
|
11744 } |
|
11745 |
|
11746 dependants = getDependants.apply( null, args ); |
|
11747 cache = getCache( dependants ); |
|
11748 |
|
11749 // If not guaranteed uniqueness by dependants (primitive type or lack |
|
11750 // of WeakMap support), shallow compare against last dependants and, if |
|
11751 // references have changed, destroy cache to recalculate result. |
|
11752 if ( ! cache.isUniqueByDependants ) { |
|
11753 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { |
|
11754 cache.clear(); |
|
11755 } |
|
11756 |
|
11757 cache.lastDependants = dependants; |
|
11758 } |
|
11759 |
|
11760 node = cache.head; |
|
11761 while ( node ) { |
|
11762 // Check whether node arguments match arguments |
|
11763 if ( ! isShallowEqual( node.args, args, 1 ) ) { |
|
11764 node = node.next; |
|
11765 continue; |
|
11766 } |
|
11767 |
|
11768 // At this point we can assume we've found a match |
|
11769 |
|
11770 // Surface matched node to head if not already |
|
11771 if ( node !== cache.head ) { |
|
11772 // Adjust siblings to point to each other. |
|
11773 node.prev.next = node.next; |
|
11774 if ( node.next ) { |
|
11775 node.next.prev = node.prev; |
|
11776 } |
|
11777 |
|
11778 node.next = cache.head; |
|
11779 node.prev = null; |
|
11780 cache.head.prev = node; |
|
11781 cache.head = node; |
|
11782 } |
|
11783 |
|
11784 // Return immediately |
|
11785 return node.val; |
|
11786 } |
|
11787 |
|
11788 // No cached value found. Continue to insertion phase: |
|
11789 |
|
11790 node = { |
|
11791 // Generate the result from original function |
|
11792 val: selector.apply( null, args ), |
|
11793 }; |
|
11794 |
|
11795 // Avoid including the source object in the cache. |
|
11796 args[ 0 ] = null; |
|
11797 node.args = args; |
|
11798 |
|
11799 // Don't need to check whether node is already head, since it would |
|
11800 // have been returned above already if it was |
|
11801 |
|
11802 // Shift existing head down list |
|
11803 if ( cache.head ) { |
|
11804 cache.head.prev = node; |
|
11805 node.next = cache.head; |
|
11806 } |
|
11807 |
|
11808 cache.head = node; |
|
11809 |
|
11810 return node.val; |
|
11811 } |
|
11812 |
|
11813 callSelector.getDependants = getDependants; |
|
11814 callSelector.clear = clear; |
|
11815 clear(); |
|
11816 |
|
11817 return callSelector; |
|
11818 }); |
|
11819 |
|
11820 |
|
11821 /***/ }), |
|
11822 |
|
11823 /***/ "qRz9": |
|
11824 /***/ (function(module, exports) { |
|
11825 |
|
11826 (function() { module.exports = window["wp"]["richText"]; }()); |
|
11827 |
|
11828 /***/ }), |
|
11829 |
|
11830 /***/ "rmEH": |
|
11831 /***/ (function(module, exports) { |
|
11832 |
|
11833 (function() { module.exports = window["wp"]["htmlEntities"]; }()); |
|
11834 |
|
11835 /***/ }), |
|
11836 |
|
11837 /***/ "tI+e": |
|
11838 /***/ (function(module, exports) { |
|
11839 |
|
11840 (function() { module.exports = window["wp"]["components"]; }()); |
|
11841 |
|
11842 /***/ }), |
|
11843 |
|
11844 /***/ "w95h": |
|
11845 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
11846 |
|
11847 "use strict"; |
|
11848 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
11849 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
11850 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
11851 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
11852 |
|
11853 |
|
11854 /** |
|
11855 * WordPress dependencies |
|
11856 */ |
|
11857 |
|
11858 const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
11859 xmlns: "http://www.w3.org/2000/svg", |
|
11860 viewBox: "0 0 24 24" |
|
11861 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
11862 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" |
|
11863 })); |
|
11864 /* harmony default export */ __webpack_exports__["a"] = (close); |
|
11865 |
|
11866 |
|
11867 /***/ }), |
|
11868 |
|
11869 /***/ "wduq": |
|
11870 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
11871 |
|
11872 "use strict"; |
|
11873 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
11874 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
11875 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
11876 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
11877 |
|
11878 |
|
11879 /** |
|
11880 * WordPress dependencies |
|
11881 */ |
|
11882 |
|
11883 const wordpress = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
11884 xmlns: "http://www.w3.org/2000/svg", |
|
11885 viewBox: "-2 -2 24 24" |
|
11886 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
11887 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" |
|
11888 })); |
|
11889 /* harmony default export */ __webpack_exports__["a"] = (wordpress); |
|
11890 |
|
11891 |
|
11892 /***/ }), |
|
11893 |
|
11894 /***/ "wx14": |
|
11895 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
11896 |
|
11897 "use strict"; |
|
11898 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
|
11899 function _extends() { |
|
11900 _extends = Object.assign || function (target) { |
|
11901 for (var i = 1; i < arguments.length; i++) { |
|
11902 var source = arguments[i]; |
|
11903 |
|
11904 for (var key in source) { |
|
11905 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
11906 target[key] = source[key]; |
|
11907 } |
|
11908 } |
|
11909 } |
|
11910 |
|
11911 return target; |
|
11912 }; |
|
11913 |
|
11914 return _extends.apply(this, arguments); |
|
11915 } |
|
11916 |
|
11917 /***/ }), |
|
11918 |
|
11919 /***/ "ywyh": |
|
11920 /***/ (function(module, exports) { |
|
11921 |
|
11922 (function() { module.exports = window["wp"]["apiFetch"]; }()); |
|
11923 |
|
11924 /***/ }) |
|
11925 |
|
11926 /******/ }); |